@@ -8,79 +8,79 @@ discard block |
||
8 | 8 | */ |
9 | 9 | |
10 | 10 | /** Load WordPress Administration Bootstrap */ |
11 | -require_once( dirname( __FILE__ ) . '/admin.php' ); |
|
11 | +require_once(dirname(__FILE__).'/admin.php'); |
|
12 | 12 | |
13 | -if ( ! is_multisite() ) |
|
14 | - wp_die( __( 'Multisite support is not enabled.' ) ); |
|
13 | +if ( ! is_multisite()) |
|
14 | + wp_die(__('Multisite support is not enabled.')); |
|
15 | 15 | |
16 | -require_once( ABSPATH . WPINC . '/http.php' ); |
|
16 | +require_once(ABSPATH.WPINC.'/http.php'); |
|
17 | 17 | |
18 | -$title = __( 'Upgrade Network' ); |
|
18 | +$title = __('Upgrade Network'); |
|
19 | 19 | $parent_file = 'upgrade.php'; |
20 | 20 | |
21 | -get_current_screen()->add_help_tab( array( |
|
21 | +get_current_screen()->add_help_tab(array( |
|
22 | 22 | 'id' => 'overview', |
23 | 23 | 'title' => __('Overview'), |
24 | 24 | 'content' => |
25 | - '<p>' . __('Only use this screen once you have updated to a new version of WordPress through Updates/Available Updates (via the Network Administration navigation menu or the Toolbar). Clicking the Upgrade Network button will step through each site in the network, five at a time, and make sure any database updates are applied.') . '</p>' . |
|
26 | - '<p>' . __('If a version update to core has not happened, clicking this button won’t affect anything.') . '</p>' . |
|
27 | - '<p>' . __('If this process fails for any reason, users logging in to their sites will force the same update.') . '</p>' |
|
28 | -) ); |
|
25 | + '<p>'.__('Only use this screen once you have updated to a new version of WordPress through Updates/Available Updates (via the Network Administration navigation menu or the Toolbar). Clicking the Upgrade Network button will step through each site in the network, five at a time, and make sure any database updates are applied.').'</p>'. |
|
26 | + '<p>'.__('If a version update to core has not happened, clicking this button won’t affect anything.').'</p>'. |
|
27 | + '<p>'.__('If this process fails for any reason, users logging in to their sites will force the same update.').'</p>' |
|
28 | +)); |
|
29 | 29 | |
30 | 30 | get_current_screen()->set_help_sidebar( |
31 | - '<p><strong>' . __('For more information:') . '</strong></p>' . |
|
32 | - '<p>' . __('<a href="https://codex.wordpress.org/Network_Admin_Updates_Screen" target="_blank">Documentation on Upgrade Network</a>') . '</p>' . |
|
33 | - '<p>' . __('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>' |
|
31 | + '<p><strong>'.__('For more information:').'</strong></p>'. |
|
32 | + '<p>'.__('<a href="https://codex.wordpress.org/Network_Admin_Updates_Screen" target="_blank">Documentation on Upgrade Network</a>').'</p>'. |
|
33 | + '<p>'.__('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>').'</p>' |
|
34 | 34 | ); |
35 | 35 | |
36 | -require_once( ABSPATH . 'wp-admin/admin-header.php' ); |
|
36 | +require_once(ABSPATH.'wp-admin/admin-header.php'); |
|
37 | 37 | |
38 | -if ( ! current_user_can( 'manage_network' ) ) |
|
39 | - wp_die( __( 'Sorry, you are not allowed to access this page.' ), 403 ); |
|
38 | +if ( ! current_user_can('manage_network')) |
|
39 | + wp_die(__('Sorry, you are not allowed to access this page.'), 403); |
|
40 | 40 | |
41 | 41 | echo '<div class="wrap">'; |
42 | -echo '<h1>' . __( 'Upgrade Network' ) . '</h1>'; |
|
42 | +echo '<h1>'.__('Upgrade Network').'</h1>'; |
|
43 | 43 | |
44 | 44 | $action = isset($_GET['action']) ? $_GET['action'] : 'show'; |
45 | 45 | |
46 | -switch ( $action ) { |
|
46 | +switch ($action) { |
|
47 | 47 | case "upgrade": |
48 | - $n = ( isset($_GET['n']) ) ? intval($_GET['n']) : 0; |
|
48 | + $n = (isset($_GET['n'])) ? intval($_GET['n']) : 0; |
|
49 | 49 | |
50 | - if ( $n < 5 ) { |
|
50 | + if ($n < 5) { |
|
51 | 51 | /** |
52 | 52 | * @global string $wp_db_version |
53 | 53 | */ |
54 | 54 | global $wp_db_version; |
55 | - update_site_option( 'wpmu_upgrade_site', $wp_db_version ); |
|
55 | + update_site_option('wpmu_upgrade_site', $wp_db_version); |
|
56 | 56 | } |
57 | 57 | |
58 | - $blogs = $wpdb->get_results( "SELECT blog_id FROM {$wpdb->blogs} WHERE site_id = '{$wpdb->siteid}' AND spam = '0' AND deleted = '0' AND archived = '0' ORDER BY blog_id DESC LIMIT {$n}, 5", ARRAY_A ); |
|
59 | - if ( empty( $blogs ) ) { |
|
60 | - echo '<p>' . __( 'All done!' ) . '</p>'; |
|
58 | + $blogs = $wpdb->get_results("SELECT blog_id FROM {$wpdb->blogs} WHERE site_id = '{$wpdb->siteid}' AND spam = '0' AND deleted = '0' AND archived = '0' ORDER BY blog_id DESC LIMIT {$n}, 5", ARRAY_A); |
|
59 | + if (empty($blogs)) { |
|
60 | + echo '<p>'.__('All done!').'</p>'; |
|
61 | 61 | break; |
62 | 62 | } |
63 | 63 | echo "<ul>"; |
64 | - foreach ( (array) $blogs as $details ) { |
|
65 | - switch_to_blog( $details['blog_id'] ); |
|
64 | + foreach ((array) $blogs as $details) { |
|
65 | + switch_to_blog($details['blog_id']); |
|
66 | 66 | $siteurl = site_url(); |
67 | - $upgrade_url = admin_url( 'upgrade.php?step=upgrade_db' ); |
|
67 | + $upgrade_url = admin_url('upgrade.php?step=upgrade_db'); |
|
68 | 68 | restore_current_blog(); |
69 | 69 | |
70 | 70 | echo "<li>$siteurl</li>"; |
71 | 71 | |
72 | - $response = wp_remote_get( $upgrade_url, array( |
|
72 | + $response = wp_remote_get($upgrade_url, array( |
|
73 | 73 | 'timeout' => 120, |
74 | 74 | 'httpversion' => '1.1', |
75 | 75 | 'sslverify' => false, |
76 | - ) ); |
|
77 | - if ( is_wp_error( $response ) ) { |
|
78 | - wp_die( sprintf( |
|
76 | + )); |
|
77 | + if (is_wp_error($response)) { |
|
78 | + wp_die(sprintf( |
|
79 | 79 | /* translators: 1: site url, 2: server error message */ |
80 | - __( 'Warning! Problem updating %1$s. Your server may not be able to connect to sites running on it. Error message: %2$s' ), |
|
80 | + __('Warning! Problem updating %1$s. Your server may not be able to connect to sites running on it. Error message: %2$s'), |
|
81 | 81 | $siteurl, |
82 | - '<em>' . $response->get_error_message() . '</em>' |
|
83 | - ) ); |
|
82 | + '<em>'.$response->get_error_message().'</em>' |
|
83 | + )); |
|
84 | 84 | } |
85 | 85 | |
86 | 86 | /** |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | * |
91 | 91 | * @param array|WP_Error $response The upgrade response array or WP_Error on failure. |
92 | 92 | */ |
93 | - do_action( 'after_mu_upgrade', $response ); |
|
93 | + do_action('after_mu_upgrade', $response); |
|
94 | 94 | /** |
95 | 95 | * Fires after each site has been upgraded. |
96 | 96 | * |
@@ -98,10 +98,10 @@ discard block |
||
98 | 98 | * |
99 | 99 | * @param int $blog_id The Site ID. |
100 | 100 | */ |
101 | - do_action( 'wpmu_upgrade_site', $details[ 'blog_id' ] ); |
|
101 | + do_action('wpmu_upgrade_site', $details['blog_id']); |
|
102 | 102 | } |
103 | 103 | echo "</ul>"; |
104 | - ?><p><?php _e( 'If your browser doesn’t start loading the next page automatically, click this link:' ); ?> <a class="button" href="upgrade.php?action=upgrade&n=<?php echo ($n + 5) ?>"><?php _e("Next Sites"); ?></a></p> |
|
104 | + ?><p><?php _e('If your browser doesn’t start loading the next page automatically, click this link:'); ?> <a class="button" href="upgrade.php?action=upgrade&n=<?php echo ($n + 5) ?>"><?php _e("Next Sites"); ?></a></p> |
|
105 | 105 | <script type="text/javascript"> |
106 | 106 | <!-- |
107 | 107 | function nextpage() { |
@@ -113,24 +113,24 @@ discard block |
||
113 | 113 | break; |
114 | 114 | case 'show': |
115 | 115 | default: |
116 | - if ( get_site_option( 'wpmu_upgrade_site' ) != $GLOBALS['wp_db_version'] ) : |
|
116 | + if (get_site_option('wpmu_upgrade_site') != $GLOBALS['wp_db_version']) : |
|
117 | 117 | ?> |
118 | - <h2><?php _e( 'Database Update Required' ); ?></h2> |
|
119 | - <p><?php _e( 'WordPress has been updated! Before we send you on your way, we need to individually upgrade the sites in your network.' ); ?></p> |
|
118 | + <h2><?php _e('Database Update Required'); ?></h2> |
|
119 | + <p><?php _e('WordPress has been updated! Before we send you on your way, we need to individually upgrade the sites in your network.'); ?></p> |
|
120 | 120 | <?php endif; ?> |
121 | 121 | |
122 | - <p><?php _e( 'The database update process may take a little while, so please be patient.' ); ?></p> |
|
123 | - <p><a class="button button-primary" href="upgrade.php?action=upgrade"><?php _e( 'Upgrade Network' ); ?></a></p> |
|
122 | + <p><?php _e('The database update process may take a little while, so please be patient.'); ?></p> |
|
123 | + <p><a class="button button-primary" href="upgrade.php?action=upgrade"><?php _e('Upgrade Network'); ?></a></p> |
|
124 | 124 | <?php |
125 | 125 | /** |
126 | 126 | * Fires before the footer on the network upgrade screen. |
127 | 127 | * |
128 | 128 | * @since MU |
129 | 129 | */ |
130 | - do_action( 'wpmu_upgrade_page' ); |
|
130 | + do_action('wpmu_upgrade_page'); |
|
131 | 131 | break; |
132 | 132 | } |
133 | 133 | ?> |
134 | 134 | </div> |
135 | 135 | |
136 | -<?php include( ABSPATH . 'wp-admin/admin-footer.php' ); ?> |
|
136 | +<?php include(ABSPATH.'wp-admin/admin-footer.php'); ?> |
@@ -8,58 +8,58 @@ discard block |
||
8 | 8 | */ |
9 | 9 | |
10 | 10 | /** Load WordPress Administration Bootstrap */ |
11 | -require_once( dirname( __FILE__ ) . '/admin.php' ); |
|
11 | +require_once(dirname(__FILE__).'/admin.php'); |
|
12 | 12 | |
13 | -if ( ! is_multisite() ) |
|
14 | - wp_die( __( 'Multisite support is not enabled.' ) ); |
|
13 | +if ( ! is_multisite()) |
|
14 | + wp_die(__('Multisite support is not enabled.')); |
|
15 | 15 | |
16 | -if ( ! current_user_can( 'manage_sites' ) ) |
|
17 | - wp_die( __( 'Sorry, you are not allowed to edit this site.' ) ); |
|
16 | +if ( ! current_user_can('manage_sites')) |
|
17 | + wp_die(__('Sorry, you are not allowed to edit this site.')); |
|
18 | 18 | |
19 | -get_current_screen()->add_help_tab( array( |
|
19 | +get_current_screen()->add_help_tab(array( |
|
20 | 20 | 'id' => 'overview', |
21 | 21 | 'title' => __('Overview'), |
22 | 22 | 'content' => |
23 | - '<p>' . __('The menu is for editing information specific to individual sites, particularly if the admin area of a site is unavailable.') . '</p>' . |
|
24 | - '<p>' . __('<strong>Info</strong> — The site URL is rarely edited as this can cause the site to not work properly. The Registered date and Last Updated date are displayed. Network admins can mark a site as archived, spam, deleted and mature, to remove from public listings or disable.') . '</p>' . |
|
25 | - '<p>' . __('<strong>Users</strong> — This displays the users associated with this site. You can also change their role, reset their password, or remove them from the site. Removing the user from the site does not remove the user from the network.') . '</p>' . |
|
26 | - '<p>' . sprintf( __('<strong>Themes</strong> — This area shows themes that are not already enabled across the network. Enabling a theme in this menu makes it accessible to this site. It does not activate the theme, but allows it to show in the site’s Appearance menu. To enable a theme for the entire network, see the <a href="%s">Network Themes</a> screen.' ), network_admin_url( 'themes.php' ) ) . '</p>' . |
|
27 | - '<p>' . __('<strong>Settings</strong> — This page shows a list of all settings associated with this site. Some are created by WordPress and others are created by plugins you activate. Note that some fields are grayed out and say Serialized Data. You cannot modify these values due to the way the setting is stored in the database.') . '</p>' |
|
28 | -) ); |
|
23 | + '<p>'.__('The menu is for editing information specific to individual sites, particularly if the admin area of a site is unavailable.').'</p>'. |
|
24 | + '<p>'.__('<strong>Info</strong> — The site URL is rarely edited as this can cause the site to not work properly. The Registered date and Last Updated date are displayed. Network admins can mark a site as archived, spam, deleted and mature, to remove from public listings or disable.').'</p>'. |
|
25 | + '<p>'.__('<strong>Users</strong> — This displays the users associated with this site. You can also change their role, reset their password, or remove them from the site. Removing the user from the site does not remove the user from the network.').'</p>'. |
|
26 | + '<p>'.sprintf(__('<strong>Themes</strong> — This area shows themes that are not already enabled across the network. Enabling a theme in this menu makes it accessible to this site. It does not activate the theme, but allows it to show in the site’s Appearance menu. To enable a theme for the entire network, see the <a href="%s">Network Themes</a> screen.'), network_admin_url('themes.php')).'</p>'. |
|
27 | + '<p>'.__('<strong>Settings</strong> — This page shows a list of all settings associated with this site. Some are created by WordPress and others are created by plugins you activate. Note that some fields are grayed out and say Serialized Data. You cannot modify these values due to the way the setting is stored in the database.').'</p>' |
|
28 | +)); |
|
29 | 29 | |
30 | 30 | get_current_screen()->set_help_sidebar( |
31 | - '<p><strong>' . __('For more information:') . '</strong></p>' . |
|
32 | - '<p>' . __('<a href="https://codex.wordpress.org/Network_Admin_Sites_Screen" target="_blank">Documentation on Site Management</a>') . '</p>' . |
|
33 | - '<p>' . __('<a href="https://wordpress.org/support/forum/multisite/" target="_blank">Support Forums</a>') . '</p>' |
|
31 | + '<p><strong>'.__('For more information:').'</strong></p>'. |
|
32 | + '<p>'.__('<a href="https://codex.wordpress.org/Network_Admin_Sites_Screen" target="_blank">Documentation on Site Management</a>').'</p>'. |
|
33 | + '<p>'.__('<a href="https://wordpress.org/support/forum/multisite/" target="_blank">Support Forums</a>').'</p>' |
|
34 | 34 | ); |
35 | 35 | |
36 | -$id = isset( $_REQUEST['id'] ) ? intval( $_REQUEST['id'] ) : 0; |
|
36 | +$id = isset($_REQUEST['id']) ? intval($_REQUEST['id']) : 0; |
|
37 | 37 | |
38 | -if ( ! $id ) |
|
39 | - wp_die( __('Invalid site ID.') ); |
|
38 | +if ( ! $id) |
|
39 | + wp_die(__('Invalid site ID.')); |
|
40 | 40 | |
41 | -$details = get_blog_details( $id ); |
|
42 | -if ( ! $details ) { |
|
43 | - wp_die( __( 'The requested site does not exist.' ) ); |
|
41 | +$details = get_blog_details($id); |
|
42 | +if ( ! $details) { |
|
43 | + wp_die(__('The requested site does not exist.')); |
|
44 | 44 | } |
45 | 45 | |
46 | -if ( !can_edit_network( $details->site_id ) ) |
|
47 | - wp_die( __( 'Sorry, you are not allowed to access this page.' ), 403 ); |
|
46 | +if ( ! can_edit_network($details->site_id)) |
|
47 | + wp_die(__('Sorry, you are not allowed to access this page.'), 403); |
|
48 | 48 | |
49 | -$is_main_site = is_main_site( $id ); |
|
49 | +$is_main_site = is_main_site($id); |
|
50 | 50 | |
51 | -if ( isset($_REQUEST['action']) && 'update-site' == $_REQUEST['action'] && is_array( $_POST['option'] ) ) { |
|
52 | - check_admin_referer( 'edit-site' ); |
|
51 | +if (isset($_REQUEST['action']) && 'update-site' == $_REQUEST['action'] && is_array($_POST['option'])) { |
|
52 | + check_admin_referer('edit-site'); |
|
53 | 53 | |
54 | - switch_to_blog( $id ); |
|
54 | + switch_to_blog($id); |
|
55 | 55 | |
56 | - $skip_options = array( 'allowedthemes' ); // Don't update these options since they are handled elsewhere in the form. |
|
57 | - foreach ( (array) $_POST['option'] as $key => $val ) { |
|
58 | - $key = wp_unslash( $key ); |
|
59 | - $val = wp_unslash( $val ); |
|
60 | - if ( $key === 0 || is_array( $val ) || in_array($key, $skip_options) ) |
|
56 | + $skip_options = array('allowedthemes'); // Don't update these options since they are handled elsewhere in the form. |
|
57 | + foreach ((array) $_POST['option'] as $key => $val) { |
|
58 | + $key = wp_unslash($key); |
|
59 | + $val = wp_unslash($val); |
|
60 | + if ($key === 0 || is_array($val) || in_array($key, $skip_options)) |
|
61 | 61 | continue; // Avoids "0 is a protected WP option and may not be modified" error when edit blog options |
62 | - update_option( $key, $val ); |
|
62 | + update_option($key, $val); |
|
63 | 63 | } |
64 | 64 | |
65 | 65 | /** |
@@ -70,86 +70,86 @@ discard block |
||
70 | 70 | * |
71 | 71 | * @param int $id The ID of the site being updated. |
72 | 72 | */ |
73 | - do_action( 'wpmu_update_blog_options', $id ); |
|
73 | + do_action('wpmu_update_blog_options', $id); |
|
74 | 74 | |
75 | 75 | restore_current_blog(); |
76 | - wp_redirect( add_query_arg( array( 'update' => 'updated', 'id' => $id ), 'site-settings.php') ); |
|
76 | + wp_redirect(add_query_arg(array('update' => 'updated', 'id' => $id), 'site-settings.php')); |
|
77 | 77 | exit; |
78 | 78 | } |
79 | 79 | |
80 | -if ( isset($_GET['update']) ) { |
|
80 | +if (isset($_GET['update'])) { |
|
81 | 81 | $messages = array(); |
82 | - if ( 'updated' == $_GET['update'] ) |
|
82 | + if ('updated' == $_GET['update']) |
|
83 | 83 | $messages[] = __('Site options updated.'); |
84 | 84 | } |
85 | 85 | |
86 | -$title = sprintf( __( 'Edit Site: %s' ), esc_html( $details->blogname ) ); |
|
86 | +$title = sprintf(__('Edit Site: %s'), esc_html($details->blogname)); |
|
87 | 87 | |
88 | 88 | $parent_file = 'sites.php'; |
89 | 89 | $submenu_file = 'sites.php'; |
90 | 90 | |
91 | -require( ABSPATH . 'wp-admin/admin-header.php' ); |
|
91 | +require(ABSPATH.'wp-admin/admin-header.php'); |
|
92 | 92 | |
93 | 93 | ?> |
94 | 94 | |
95 | 95 | <div class="wrap"> |
96 | 96 | <h1 id="edit-site"><?php echo $title; ?></h1> |
97 | -<p class="edit-site-actions"><a href="<?php echo esc_url( get_home_url( $id, '/' ) ); ?>"><?php _e( 'Visit' ); ?></a> | <a href="<?php echo esc_url( get_admin_url( $id ) ); ?>"><?php _e( 'Dashboard' ); ?></a></p> |
|
97 | +<p class="edit-site-actions"><a href="<?php echo esc_url(get_home_url($id, '/')); ?>"><?php _e('Visit'); ?></a> | <a href="<?php echo esc_url(get_admin_url($id)); ?>"><?php _e('Dashboard'); ?></a></p> |
|
98 | 98 | |
99 | 99 | <?php |
100 | 100 | |
101 | -network_edit_site_nav( array( |
|
101 | +network_edit_site_nav(array( |
|
102 | 102 | 'blog_id' => $id, |
103 | 103 | 'selected' => 'site-settings' |
104 | -) ); |
|
104 | +)); |
|
105 | 105 | |
106 | -if ( ! empty( $messages ) ) { |
|
107 | - foreach ( $messages as $msg ) |
|
108 | - echo '<div id="message" class="updated notice is-dismissible"><p>' . $msg . '</p></div>'; |
|
106 | +if ( ! empty($messages)) { |
|
107 | + foreach ($messages as $msg) |
|
108 | + echo '<div id="message" class="updated notice is-dismissible"><p>'.$msg.'</p></div>'; |
|
109 | 109 | } ?> |
110 | 110 | <form method="post" action="site-settings.php?action=update-site"> |
111 | - <?php wp_nonce_field( 'edit-site' ); ?> |
|
112 | - <input type="hidden" name="id" value="<?php echo esc_attr( $id ) ?>" /> |
|
111 | + <?php wp_nonce_field('edit-site'); ?> |
|
112 | + <input type="hidden" name="id" value="<?php echo esc_attr($id) ?>" /> |
|
113 | 113 | <table class="form-table"> |
114 | 114 | <?php |
115 | - $blog_prefix = $wpdb->get_blog_prefix( $id ); |
|
115 | + $blog_prefix = $wpdb->get_blog_prefix($id); |
|
116 | 116 | $sql = "SELECT * FROM {$blog_prefix}options |
117 | 117 | WHERE option_name NOT LIKE %s |
118 | 118 | AND option_name NOT LIKE %s"; |
119 | - $query = $wpdb->prepare( $sql, |
|
120 | - $wpdb->esc_like( '_' ) . '%', |
|
121 | - '%' . $wpdb->esc_like( 'user_roles' ) |
|
119 | + $query = $wpdb->prepare($sql, |
|
120 | + $wpdb->esc_like('_').'%', |
|
121 | + '%'.$wpdb->esc_like('user_roles') |
|
122 | 122 | ); |
123 | - $options = $wpdb->get_results( $query ); |
|
124 | - foreach ( $options as $option ) { |
|
125 | - if ( $option->option_name == 'default_role' ) |
|
123 | + $options = $wpdb->get_results($query); |
|
124 | + foreach ($options as $option) { |
|
125 | + if ($option->option_name == 'default_role') |
|
126 | 126 | $editblog_default_role = $option->option_value; |
127 | 127 | $disabled = false; |
128 | 128 | $class = 'all-options'; |
129 | - if ( is_serialized( $option->option_value ) ) { |
|
130 | - if ( is_serialized_string( $option->option_value ) ) { |
|
131 | - $option->option_value = esc_html( maybe_unserialize( $option->option_value ) ); |
|
129 | + if (is_serialized($option->option_value)) { |
|
130 | + if (is_serialized_string($option->option_value)) { |
|
131 | + $option->option_value = esc_html(maybe_unserialize($option->option_value)); |
|
132 | 132 | } else { |
133 | 133 | $option->option_value = 'SERIALIZED DATA'; |
134 | 134 | $disabled = true; |
135 | 135 | $class = 'all-options disabled'; |
136 | 136 | } |
137 | 137 | } |
138 | - if ( strpos( $option->option_value, "\n" ) !== false ) { |
|
138 | + if (strpos($option->option_value, "\n") !== false) { |
|
139 | 139 | ?> |
140 | 140 | <tr class="form-field"> |
141 | - <th scope="row"><label for="<?php echo esc_attr( $option->option_name ) ?>"><?php echo ucwords( str_replace( "_", " ", $option->option_name ) ) ?></label></th> |
|
142 | - <td><textarea class="<?php echo $class; ?>" rows="5" cols="40" name="option[<?php echo esc_attr( $option->option_name ) ?>]" id="<?php echo esc_attr( $option->option_name ) ?>"<?php disabled( $disabled ) ?>><?php echo esc_textarea( $option->option_value ) ?></textarea></td> |
|
141 | + <th scope="row"><label for="<?php echo esc_attr($option->option_name) ?>"><?php echo ucwords(str_replace("_", " ", $option->option_name)) ?></label></th> |
|
142 | + <td><textarea class="<?php echo $class; ?>" rows="5" cols="40" name="option[<?php echo esc_attr($option->option_name) ?>]" id="<?php echo esc_attr($option->option_name) ?>"<?php disabled($disabled) ?>><?php echo esc_textarea($option->option_value) ?></textarea></td> |
|
143 | 143 | </tr> |
144 | 144 | <?php |
145 | 145 | } else { |
146 | 146 | ?> |
147 | 147 | <tr class="form-field"> |
148 | - <th scope="row"><label for="<?php echo esc_attr( $option->option_name ) ?>"><?php echo esc_html( ucwords( str_replace( "_", " ", $option->option_name ) ) ); ?></label></th> |
|
149 | - <?php if ( $is_main_site && in_array( $option->option_name, array( 'siteurl', 'home' ) ) ) { ?> |
|
150 | - <td><code><?php echo esc_html( $option->option_value ) ?></code></td> |
|
148 | + <th scope="row"><label for="<?php echo esc_attr($option->option_name) ?>"><?php echo esc_html(ucwords(str_replace("_", " ", $option->option_name))); ?></label></th> |
|
149 | + <?php if ($is_main_site && in_array($option->option_name, array('siteurl', 'home'))) { ?> |
|
150 | + <td><code><?php echo esc_html($option->option_value) ?></code></td> |
|
151 | 151 | <?php } else { ?> |
152 | - <td><input class="<?php echo $class; ?>" name="option[<?php echo esc_attr( $option->option_name ) ?>]" type="text" id="<?php echo esc_attr( $option->option_name ) ?>" value="<?php echo esc_attr( $option->option_value ) ?>" size="40" <?php disabled( $disabled ) ?> /></td> |
|
152 | + <td><input class="<?php echo $class; ?>" name="option[<?php echo esc_attr($option->option_name) ?>]" type="text" id="<?php echo esc_attr($option->option_name) ?>" value="<?php echo esc_attr($option->option_value) ?>" size="40" <?php disabled($disabled) ?> /></td> |
|
153 | 153 | <?php } ?> |
154 | 154 | </tr> |
155 | 155 | <?php |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | * |
163 | 163 | * @param int $id Site ID. |
164 | 164 | */ |
165 | - do_action( 'wpmueditblogaction', $id ); |
|
165 | + do_action('wpmueditblogaction', $id); |
|
166 | 166 | ?> |
167 | 167 | </table> |
168 | 168 | <?php submit_button(); ?> |
@@ -170,4 +170,4 @@ discard block |
||
170 | 170 | |
171 | 171 | </div> |
172 | 172 | <?php |
173 | -require( ABSPATH . 'wp-admin/admin-footer.php' ); |
|
173 | +require(ABSPATH.'wp-admin/admin-footer.php'); |
@@ -8,48 +8,48 @@ discard block |
||
8 | 8 | */ |
9 | 9 | |
10 | 10 | /** Load WordPress Administration Bootstrap */ |
11 | -require_once( dirname( __FILE__ ) . '/admin.php' ); |
|
11 | +require_once(dirname(__FILE__).'/admin.php'); |
|
12 | 12 | |
13 | -if ( ! is_multisite() ) |
|
14 | - wp_die( __( 'Multisite support is not enabled.' ) ); |
|
13 | +if ( ! is_multisite()) |
|
14 | + wp_die(__('Multisite support is not enabled.')); |
|
15 | 15 | |
16 | -if ( ! current_user_can('create_users') ) |
|
16 | +if ( ! current_user_can('create_users')) |
|
17 | 17 | wp_die(__('Sorry, you are not allowed to add users to this network.')); |
18 | 18 | |
19 | -get_current_screen()->add_help_tab( array( |
|
19 | +get_current_screen()->add_help_tab(array( |
|
20 | 20 | 'id' => 'overview', |
21 | 21 | 'title' => __('Overview'), |
22 | 22 | 'content' => |
23 | - '<p>' . __('Add User will set up a new user account on the network and send that person an email with username and password.') . '</p>' . |
|
24 | - '<p>' . __('Users who are signed up to the network without a site are added as subscribers to the main or primary dashboard site, giving them profile pages to manage their accounts. These users will only see Dashboard and My Sites in the main navigation until a site is created for them.') . '</p>' |
|
25 | -) ); |
|
23 | + '<p>'.__('Add User will set up a new user account on the network and send that person an email with username and password.').'</p>'. |
|
24 | + '<p>'.__('Users who are signed up to the network without a site are added as subscribers to the main or primary dashboard site, giving them profile pages to manage their accounts. These users will only see Dashboard and My Sites in the main navigation until a site is created for them.').'</p>' |
|
25 | +)); |
|
26 | 26 | |
27 | 27 | get_current_screen()->set_help_sidebar( |
28 | - '<p><strong>' . __('For more information:') . '</strong></p>' . |
|
29 | - '<p>' . __('<a href="https://codex.wordpress.org/Network_Admin_Users_Screen" target="_blank">Documentation on Network Users</a>') . '</p>' . |
|
30 | - '<p>' . __('<a href="https://wordpress.org/support/forum/multisite/" target="_blank">Support Forums</a>') . '</p>' |
|
28 | + '<p><strong>'.__('For more information:').'</strong></p>'. |
|
29 | + '<p>'.__('<a href="https://codex.wordpress.org/Network_Admin_Users_Screen" target="_blank">Documentation on Network Users</a>').'</p>'. |
|
30 | + '<p>'.__('<a href="https://wordpress.org/support/forum/multisite/" target="_blank">Support Forums</a>').'</p>' |
|
31 | 31 | ); |
32 | 32 | |
33 | -if ( isset($_REQUEST['action']) && 'add-user' == $_REQUEST['action'] ) { |
|
34 | - check_admin_referer( 'add-user', '_wpnonce_add-user' ); |
|
33 | +if (isset($_REQUEST['action']) && 'add-user' == $_REQUEST['action']) { |
|
34 | + check_admin_referer('add-user', '_wpnonce_add-user'); |
|
35 | 35 | |
36 | - if ( ! current_user_can( 'manage_network_users' ) ) |
|
37 | - wp_die( __( 'Sorry, you are not allowed to access this page.' ), 403 ); |
|
36 | + if ( ! current_user_can('manage_network_users')) |
|
37 | + wp_die(__('Sorry, you are not allowed to access this page.'), 403); |
|
38 | 38 | |
39 | - if ( ! is_array( $_POST['user'] ) ) |
|
40 | - wp_die( __( 'Cannot create an empty user.' ) ); |
|
39 | + if ( ! is_array($_POST['user'])) |
|
40 | + wp_die(__('Cannot create an empty user.')); |
|
41 | 41 | |
42 | - $user = wp_unslash( $_POST['user'] ); |
|
42 | + $user = wp_unslash($_POST['user']); |
|
43 | 43 | |
44 | - $user_details = wpmu_validate_user_signup( $user['username'], $user['email'] ); |
|
45 | - if ( is_wp_error( $user_details[ 'errors' ] ) && ! empty( $user_details[ 'errors' ]->errors ) ) { |
|
46 | - $add_user_errors = $user_details[ 'errors' ]; |
|
44 | + $user_details = wpmu_validate_user_signup($user['username'], $user['email']); |
|
45 | + if (is_wp_error($user_details['errors']) && ! empty($user_details['errors']->errors)) { |
|
46 | + $add_user_errors = $user_details['errors']; |
|
47 | 47 | } else { |
48 | - $password = wp_generate_password( 12, false); |
|
49 | - $user_id = wpmu_create_user( esc_html( strtolower( $user['username'] ) ), $password, sanitize_email( $user['email'] ) ); |
|
48 | + $password = wp_generate_password(12, false); |
|
49 | + $user_id = wpmu_create_user(esc_html(strtolower($user['username'])), $password, sanitize_email($user['email'])); |
|
50 | 50 | |
51 | - if ( ! $user_id ) { |
|
52 | - $add_user_errors = new WP_Error( 'add_user_fail', __( 'Cannot add user.' ) ); |
|
51 | + if ( ! $user_id) { |
|
52 | + $add_user_errors = new WP_Error('add_user_fail', __('Cannot add user.')); |
|
53 | 53 | } else { |
54 | 54 | /** |
55 | 55 | * Fires after a new user has been created via the network user-new.php page. |
@@ -58,29 +58,29 @@ discard block |
||
58 | 58 | * |
59 | 59 | * @param int $user_id ID of the newly created user. |
60 | 60 | */ |
61 | - do_action( 'network_user_new_created_user', $user_id ); |
|
62 | - wp_redirect( add_query_arg( array('update' => 'added', 'user_id' => $user_id ), 'user-new.php' ) ); |
|
61 | + do_action('network_user_new_created_user', $user_id); |
|
62 | + wp_redirect(add_query_arg(array('update' => 'added', 'user_id' => $user_id), 'user-new.php')); |
|
63 | 63 | exit; |
64 | 64 | } |
65 | 65 | } |
66 | 66 | } |
67 | 67 | |
68 | -if ( isset($_GET['update']) ) { |
|
68 | +if (isset($_GET['update'])) { |
|
69 | 69 | $messages = array(); |
70 | - if ( 'added' == $_GET['update'] ) { |
|
70 | + if ('added' == $_GET['update']) { |
|
71 | 71 | $edit_link = ''; |
72 | - if ( isset( $_GET['user_id'] ) ) { |
|
73 | - $user_id_new = absint( $_GET['user_id'] ); |
|
74 | - if ( $user_id_new ) { |
|
75 | - $edit_link = esc_url( add_query_arg( 'wp_http_referer', urlencode( wp_unslash( $_SERVER['REQUEST_URI'] ) ), get_edit_user_link( $user_id_new ) ) ); |
|
72 | + if (isset($_GET['user_id'])) { |
|
73 | + $user_id_new = absint($_GET['user_id']); |
|
74 | + if ($user_id_new) { |
|
75 | + $edit_link = esc_url(add_query_arg('wp_http_referer', urlencode(wp_unslash($_SERVER['REQUEST_URI'])), get_edit_user_link($user_id_new))); |
|
76 | 76 | } |
77 | 77 | } |
78 | 78 | |
79 | - if ( empty( $edit_link ) ) { |
|
80 | - $messages[] = __( 'User added.' ); |
|
79 | + if (empty($edit_link)) { |
|
80 | + $messages[] = __('User added.'); |
|
81 | 81 | } else { |
82 | 82 | /* translators: %s: edit page url */ |
83 | - $messages[] = sprintf( __( 'User added. <a href="%s">Edit user</a>' ), $edit_link ); |
|
83 | + $messages[] = sprintf(__('User added. <a href="%s">Edit user</a>'), $edit_link); |
|
84 | 84 | } |
85 | 85 | } |
86 | 86 | } |
@@ -88,20 +88,20 @@ discard block |
||
88 | 88 | $title = __('Add New User'); |
89 | 89 | $parent_file = 'users.php'; |
90 | 90 | |
91 | -require( ABSPATH . 'wp-admin/admin-header.php' ); ?> |
|
91 | +require(ABSPATH.'wp-admin/admin-header.php'); ?> |
|
92 | 92 | |
93 | 93 | <div class="wrap"> |
94 | -<h1 id="add-new-user"><?php _e( 'Add New User' ); ?></h1> |
|
94 | +<h1 id="add-new-user"><?php _e('Add New User'); ?></h1> |
|
95 | 95 | <?php |
96 | -if ( ! empty( $messages ) ) { |
|
97 | - foreach ( $messages as $msg ) |
|
98 | - echo '<div id="message" class="updated notice is-dismissible"><p>' . $msg . '</p></div>'; |
|
96 | +if ( ! empty($messages)) { |
|
97 | + foreach ($messages as $msg) |
|
98 | + echo '<div id="message" class="updated notice is-dismissible"><p>'.$msg.'</p></div>'; |
|
99 | 99 | } |
100 | 100 | |
101 | -if ( isset( $add_user_errors ) && is_wp_error( $add_user_errors ) ) { ?> |
|
101 | +if (isset($add_user_errors) && is_wp_error($add_user_errors)) { ?> |
|
102 | 102 | <div class="error"> |
103 | 103 | <?php |
104 | - foreach ( $add_user_errors->get_error_messages() as $message ) |
|
104 | + foreach ($add_user_errors->get_error_messages() as $message) |
|
105 | 105 | echo "<p>$message</p>"; |
106 | 106 | ?> |
107 | 107 | </div> |
@@ -109,15 +109,15 @@ discard block |
||
109 | 109 | <form action="<?php echo network_admin_url('user-new.php?action=add-user'); ?>" id="adduser" method="post" novalidate="novalidate"> |
110 | 110 | <table class="form-table"> |
111 | 111 | <tr class="form-field form-required"> |
112 | - <th scope="row"><label for="username"><?php _e( 'Username' ) ?></label></th> |
|
112 | + <th scope="row"><label for="username"><?php _e('Username') ?></label></th> |
|
113 | 113 | <td><input type="text" class="regular-text" name="user[username]" id="username" autocapitalize="none" autocorrect="off" maxlength="60" /></td> |
114 | 114 | </tr> |
115 | 115 | <tr class="form-field form-required"> |
116 | - <th scope="row"><label for="email"><?php _e( 'Email' ) ?></label></th> |
|
116 | + <th scope="row"><label for="email"><?php _e('Email') ?></label></th> |
|
117 | 117 | <td><input type="email" class="regular-text" name="user[email]" id="email"/></td> |
118 | 118 | </tr> |
119 | 119 | <tr class="form-field"> |
120 | - <td colspan="2"><?php _e( 'A password reset link will be sent to the user via email.' ) ?></td> |
|
120 | + <td colspan="2"><?php _e('A password reset link will be sent to the user via email.') ?></td> |
|
121 | 121 | </tr> |
122 | 122 | </table> |
123 | 123 | <?php |
@@ -126,12 +126,12 @@ discard block |
||
126 | 126 | * |
127 | 127 | * @since 4.5.0 |
128 | 128 | */ |
129 | - do_action( 'network_user_new_form' ); |
|
129 | + do_action('network_user_new_form'); |
|
130 | 130 | |
131 | - wp_nonce_field( 'add-user', '_wpnonce_add-user' ); |
|
132 | - submit_button( __('Add User'), 'primary', 'add-user' ); |
|
131 | + wp_nonce_field('add-user', '_wpnonce_add-user'); |
|
132 | + submit_button(__('Add User'), 'primary', 'add-user'); |
|
133 | 133 | ?> |
134 | 134 | </form> |
135 | 135 | </div> |
136 | 136 | <?php |
137 | -require( ABSPATH . 'wp-admin/admin-footer.php' ); |
|
137 | +require(ABSPATH.'wp-admin/admin-footer.php'); |
@@ -10,11 +10,13 @@ discard block |
||
10 | 10 | /** Load WordPress Administration Bootstrap */ |
11 | 11 | require_once( dirname( __FILE__ ) . '/admin.php' ); |
12 | 12 | |
13 | -if ( ! is_multisite() ) |
|
13 | +if ( ! is_multisite() ) { |
|
14 | 14 | wp_die( __( 'Multisite support is not enabled.' ) ); |
15 | +} |
|
15 | 16 | |
16 | -if ( ! current_user_can('create_users') ) |
|
17 | +if ( ! current_user_can('create_users') ) { |
|
17 | 18 | wp_die(__('Sorry, you are not allowed to add users to this network.')); |
19 | +} |
|
18 | 20 | |
19 | 21 | get_current_screen()->add_help_tab( array( |
20 | 22 | 'id' => 'overview', |
@@ -33,11 +35,13 @@ discard block |
||
33 | 35 | if ( isset($_REQUEST['action']) && 'add-user' == $_REQUEST['action'] ) { |
34 | 36 | check_admin_referer( 'add-user', '_wpnonce_add-user' ); |
35 | 37 | |
36 | - if ( ! current_user_can( 'manage_network_users' ) ) |
|
37 | - wp_die( __( 'Sorry, you are not allowed to access this page.' ), 403 ); |
|
38 | + if ( ! current_user_can( 'manage_network_users' ) ) { |
|
39 | + wp_die( __( 'Sorry, you are not allowed to access this page.' ), 403 ); |
|
40 | + } |
|
38 | 41 | |
39 | - if ( ! is_array( $_POST['user'] ) ) |
|
40 | - wp_die( __( 'Cannot create an empty user.' ) ); |
|
42 | + if ( ! is_array( $_POST['user'] ) ) { |
|
43 | + wp_die( __( 'Cannot create an empty user.' ) ); |
|
44 | + } |
|
41 | 45 | |
42 | 46 | $user = wp_unslash( $_POST['user'] ); |
43 | 47 | |
@@ -94,15 +98,17 @@ discard block |
||
94 | 98 | <h1 id="add-new-user"><?php _e( 'Add New User' ); ?></h1> |
95 | 99 | <?php |
96 | 100 | if ( ! empty( $messages ) ) { |
97 | - foreach ( $messages as $msg ) |
|
98 | - echo '<div id="message" class="updated notice is-dismissible"><p>' . $msg . '</p></div>'; |
|
99 | -} |
|
101 | + foreach ( $messages as $msg ) { |
|
102 | + echo '<div id="message" class="updated notice is-dismissible"><p>' . $msg . '</p></div>'; |
|
103 | + } |
|
104 | + } |
|
100 | 105 | |
101 | 106 | if ( isset( $add_user_errors ) && is_wp_error( $add_user_errors ) ) { ?> |
102 | 107 | <div class="error"> |
103 | 108 | <?php |
104 | - foreach ( $add_user_errors->get_error_messages() as $message ) |
|
105 | - echo "<p>$message</p>"; |
|
109 | + foreach ( $add_user_errors->get_error_messages() as $message ) { |
|
110 | + echo "<p>$message</p>"; |
|
111 | + } |
|
106 | 112 | ?> |
107 | 113 | </div> |
108 | 114 | <?php } ?> |
@@ -8,175 +8,175 @@ discard block |
||
8 | 8 | */ |
9 | 9 | |
10 | 10 | /** Load WordPress Administration Bootstrap */ |
11 | -require_once( dirname( __FILE__ ) . '/admin.php' ); |
|
11 | +require_once(dirname(__FILE__).'/admin.php'); |
|
12 | 12 | |
13 | -if ( ! is_multisite() ) |
|
14 | - wp_die( __( 'Multisite support is not enabled.' ) ); |
|
13 | +if ( ! is_multisite()) |
|
14 | + wp_die(__('Multisite support is not enabled.')); |
|
15 | 15 | |
16 | -if ( ! current_user_can( 'manage_sites' ) ) |
|
17 | - wp_die( __( 'Sorry, you are not allowed to access this page.' ), 403 ); |
|
16 | +if ( ! current_user_can('manage_sites')) |
|
17 | + wp_die(__('Sorry, you are not allowed to access this page.'), 403); |
|
18 | 18 | |
19 | -$wp_list_table = _get_list_table( 'WP_MS_Sites_List_Table' ); |
|
19 | +$wp_list_table = _get_list_table('WP_MS_Sites_List_Table'); |
|
20 | 20 | $pagenum = $wp_list_table->get_pagenum(); |
21 | 21 | |
22 | -$title = __( 'Sites' ); |
|
22 | +$title = __('Sites'); |
|
23 | 23 | $parent_file = 'sites.php'; |
24 | 24 | |
25 | -add_screen_option( 'per_page' ); |
|
25 | +add_screen_option('per_page'); |
|
26 | 26 | |
27 | -get_current_screen()->add_help_tab( array( |
|
27 | +get_current_screen()->add_help_tab(array( |
|
28 | 28 | 'id' => 'overview', |
29 | 29 | 'title' => __('Overview'), |
30 | 30 | 'content' => |
31 | - '<p>' . __('Add New takes you to the Add New Site screen. You can search for a site by Name, ID number, or IP address. Screen Options allows you to choose how many sites to display on one page.') . '</p>' . |
|
32 | - '<p>' . __('This is the main table of all sites on this network. Switch between list and excerpt views by using the icons above the right side of the table.') . '</p>' . |
|
33 | - '<p>' . __('Hovering over each site reveals seven options (three for the primary site):') . '</p>' . |
|
34 | - '<ul><li>' . __('An Edit link to a separate Edit Site screen.') . '</li>' . |
|
35 | - '<li>' . __('Dashboard leads to the Dashboard for that site.') . '</li>' . |
|
36 | - '<li>' . __('Deactivate, Archive, and Spam which lead to confirmation screens. These actions can be reversed later.') . '</li>' . |
|
37 | - '<li>' . __('Delete which is a permanent action after the confirmation screens.') . '</li>' . |
|
38 | - '<li>' . __('Visit to go to the front-end site live.') . '</li></ul>' . |
|
39 | - '<p>' . __('The site ID is used internally, and is not shown on the front end of the site or to users/viewers.') . '</p>' . |
|
40 | - '<p>' . __('Clicking on bold headings can re-sort this table.') . '</p>' |
|
41 | -) ); |
|
31 | + '<p>'.__('Add New takes you to the Add New Site screen. You can search for a site by Name, ID number, or IP address. Screen Options allows you to choose how many sites to display on one page.').'</p>'. |
|
32 | + '<p>'.__('This is the main table of all sites on this network. Switch between list and excerpt views by using the icons above the right side of the table.').'</p>'. |
|
33 | + '<p>'.__('Hovering over each site reveals seven options (three for the primary site):').'</p>'. |
|
34 | + '<ul><li>'.__('An Edit link to a separate Edit Site screen.').'</li>'. |
|
35 | + '<li>'.__('Dashboard leads to the Dashboard for that site.').'</li>'. |
|
36 | + '<li>'.__('Deactivate, Archive, and Spam which lead to confirmation screens. These actions can be reversed later.').'</li>'. |
|
37 | + '<li>'.__('Delete which is a permanent action after the confirmation screens.').'</li>'. |
|
38 | + '<li>'.__('Visit to go to the front-end site live.').'</li></ul>'. |
|
39 | + '<p>'.__('The site ID is used internally, and is not shown on the front end of the site or to users/viewers.').'</p>'. |
|
40 | + '<p>'.__('Clicking on bold headings can re-sort this table.').'</p>' |
|
41 | +)); |
|
42 | 42 | |
43 | 43 | get_current_screen()->set_help_sidebar( |
44 | - '<p><strong>' . __('For more information:') . '</strong></p>' . |
|
45 | - '<p>' . __('<a href="https://codex.wordpress.org/Network_Admin_Sites_Screen" target="_blank">Documentation on Site Management</a>') . '</p>' . |
|
46 | - '<p>' . __('<a href="https://wordpress.org/support/forum/multisite/" target="_blank">Support Forums</a>') . '</p>' |
|
44 | + '<p><strong>'.__('For more information:').'</strong></p>'. |
|
45 | + '<p>'.__('<a href="https://codex.wordpress.org/Network_Admin_Sites_Screen" target="_blank">Documentation on Site Management</a>').'</p>'. |
|
46 | + '<p>'.__('<a href="https://wordpress.org/support/forum/multisite/" target="_blank">Support Forums</a>').'</p>' |
|
47 | 47 | ); |
48 | 48 | |
49 | -get_current_screen()->set_screen_reader_content( array( |
|
50 | - 'heading_pagination' => __( 'Sites list navigation' ), |
|
51 | - 'heading_list' => __( 'Sites list' ), |
|
52 | -) ); |
|
49 | +get_current_screen()->set_screen_reader_content(array( |
|
50 | + 'heading_pagination' => __('Sites list navigation'), |
|
51 | + 'heading_list' => __('Sites list'), |
|
52 | +)); |
|
53 | 53 | |
54 | -$id = isset( $_REQUEST['id'] ) ? intval( $_REQUEST['id'] ) : 0; |
|
54 | +$id = isset($_REQUEST['id']) ? intval($_REQUEST['id']) : 0; |
|
55 | 55 | |
56 | -if ( isset( $_GET['action'] ) ) { |
|
56 | +if (isset($_GET['action'])) { |
|
57 | 57 | /** This action is documented in wp-admin/network/edit.php */ |
58 | - do_action( 'wpmuadminedit' ); |
|
58 | + do_action('wpmuadminedit'); |
|
59 | 59 | |
60 | 60 | // A list of valid actions and their associated messaging for confirmation output. |
61 | 61 | $manage_actions = array( |
62 | - 'activateblog' => __( 'You are about to activate the site %s.' ), |
|
63 | - 'deactivateblog' => __( 'You are about to deactivate the site %s.' ), |
|
64 | - 'unarchiveblog' => __( 'You are about to unarchive the site %s.' ), |
|
65 | - 'archiveblog' => __( 'You are about to archive the site %s.' ), |
|
66 | - 'unspamblog' => __( 'You are about to unspam the site %s.' ), |
|
67 | - 'spamblog' => __( 'You are about to mark the site %s as spam.' ), |
|
68 | - 'deleteblog' => __( 'You are about to delete the site %s.' ), |
|
69 | - 'unmatureblog' => __( 'You are about to mark the site %s as mature.' ), |
|
70 | - 'matureblog' => __( 'You are about to mark the site %s as not mature.' ), |
|
62 | + 'activateblog' => __('You are about to activate the site %s.'), |
|
63 | + 'deactivateblog' => __('You are about to deactivate the site %s.'), |
|
64 | + 'unarchiveblog' => __('You are about to unarchive the site %s.'), |
|
65 | + 'archiveblog' => __('You are about to archive the site %s.'), |
|
66 | + 'unspamblog' => __('You are about to unspam the site %s.'), |
|
67 | + 'spamblog' => __('You are about to mark the site %s as spam.'), |
|
68 | + 'deleteblog' => __('You are about to delete the site %s.'), |
|
69 | + 'unmatureblog' => __('You are about to mark the site %s as mature.'), |
|
70 | + 'matureblog' => __('You are about to mark the site %s as not mature.'), |
|
71 | 71 | ); |
72 | 72 | |
73 | - if ( 'confirm' === $_GET['action'] ) { |
|
73 | + if ('confirm' === $_GET['action']) { |
|
74 | 74 | // The action2 parameter contains the action being taken on the site. |
75 | 75 | $site_action = $_GET['action2']; |
76 | 76 | |
77 | - if ( ! array_key_exists( $site_action, $manage_actions ) ) { |
|
78 | - wp_die( __( 'The requested action is not valid.' ) ); |
|
77 | + if ( ! array_key_exists($site_action, $manage_actions)) { |
|
78 | + wp_die(__('The requested action is not valid.')); |
|
79 | 79 | } |
80 | 80 | |
81 | 81 | // The mature/unmature UI exists only as external code. Check the "confirm" nonce for backward compatibility. |
82 | - if ( 'matureblog' === $site_action || 'unmatureblog' === $site_action ) { |
|
83 | - check_admin_referer( 'confirm' ); |
|
82 | + if ('matureblog' === $site_action || 'unmatureblog' === $site_action) { |
|
83 | + check_admin_referer('confirm'); |
|
84 | 84 | } else { |
85 | - check_admin_referer( $site_action . '_' . $id ); |
|
85 | + check_admin_referer($site_action.'_'.$id); |
|
86 | 86 | } |
87 | 87 | |
88 | - if ( ! headers_sent() ) { |
|
88 | + if ( ! headers_sent()) { |
|
89 | 89 | nocache_headers(); |
90 | - header( 'Content-Type: text/html; charset=utf-8' ); |
|
90 | + header('Content-Type: text/html; charset=utf-8'); |
|
91 | 91 | } |
92 | 92 | |
93 | - if ( $current_site->blog_id == $id ) { |
|
94 | - wp_die( __( 'Sorry, you are not allowed to change the current site.' ) ); |
|
93 | + if ($current_site->blog_id == $id) { |
|
94 | + wp_die(__('Sorry, you are not allowed to change the current site.')); |
|
95 | 95 | } |
96 | 96 | |
97 | - $site_details = get_blog_details( $id ); |
|
98 | - $site_address = untrailingslashit( $site_details->domain . $site_details->path ); |
|
97 | + $site_details = get_blog_details($id); |
|
98 | + $site_address = untrailingslashit($site_details->domain.$site_details->path); |
|
99 | 99 | |
100 | - require_once( ABSPATH . 'wp-admin/admin-header.php' ); |
|
100 | + require_once(ABSPATH.'wp-admin/admin-header.php'); |
|
101 | 101 | ?> |
102 | 102 | <div class="wrap"> |
103 | - <h1><?php _e( 'Confirm your action' ); ?></h1> |
|
104 | - <form action="sites.php?action=<?php echo esc_attr( $site_action ); ?>" method="post"> |
|
105 | - <input type="hidden" name="action" value="<?php echo esc_attr( $site_action ); ?>" /> |
|
106 | - <input type="hidden" name="id" value="<?php echo esc_attr( $id ); ?>" /> |
|
107 | - <input type="hidden" name="_wp_http_referer" value="<?php echo esc_attr( wp_get_referer() ); ?>" /> |
|
108 | - <?php wp_nonce_field( $site_action . '_' . $id, '_wpnonce', false ); ?> |
|
109 | - <p><?php echo sprintf( $manage_actions[ $site_action ], $site_address ); ?></p> |
|
110 | - <?php submit_button( __( 'Confirm' ), 'primary' ); ?> |
|
103 | + <h1><?php _e('Confirm your action'); ?></h1> |
|
104 | + <form action="sites.php?action=<?php echo esc_attr($site_action); ?>" method="post"> |
|
105 | + <input type="hidden" name="action" value="<?php echo esc_attr($site_action); ?>" /> |
|
106 | + <input type="hidden" name="id" value="<?php echo esc_attr($id); ?>" /> |
|
107 | + <input type="hidden" name="_wp_http_referer" value="<?php echo esc_attr(wp_get_referer()); ?>" /> |
|
108 | + <?php wp_nonce_field($site_action.'_'.$id, '_wpnonce', false); ?> |
|
109 | + <p><?php echo sprintf($manage_actions[$site_action], $site_address); ?></p> |
|
110 | + <?php submit_button(__('Confirm'), 'primary'); ?> |
|
111 | 111 | </form> |
112 | 112 | </div> |
113 | 113 | <?php |
114 | - require_once( ABSPATH . 'wp-admin/admin-footer.php' ); |
|
114 | + require_once(ABSPATH.'wp-admin/admin-footer.php'); |
|
115 | 115 | exit(); |
116 | - } elseif ( array_key_exists( $_GET['action'], $manage_actions ) ) { |
|
116 | + } elseif (array_key_exists($_GET['action'], $manage_actions)) { |
|
117 | 117 | $action = $_GET['action']; |
118 | - check_admin_referer( $action . '_' . $id ); |
|
119 | - } elseif ( 'allblogs' === $_GET['action'] ) { |
|
120 | - check_admin_referer( 'bulk-sites' ); |
|
118 | + check_admin_referer($action.'_'.$id); |
|
119 | + } elseif ('allblogs' === $_GET['action']) { |
|
120 | + check_admin_referer('bulk-sites'); |
|
121 | 121 | } |
122 | 122 | |
123 | 123 | $updated_action = ''; |
124 | 124 | |
125 | - switch ( $_GET['action'] ) { |
|
125 | + switch ($_GET['action']) { |
|
126 | 126 | |
127 | 127 | case 'deleteblog': |
128 | - if ( ! current_user_can( 'delete_sites' ) ) |
|
129 | - wp_die( __( 'Sorry, you are not allowed to access this page.' ), '', array( 'response' => 403 ) ); |
|
128 | + if ( ! current_user_can('delete_sites')) |
|
129 | + wp_die(__('Sorry, you are not allowed to access this page.'), '', array('response' => 403)); |
|
130 | 130 | |
131 | 131 | $updated_action = 'not_deleted'; |
132 | - if ( $id != '0' && $id != $current_site->blog_id && current_user_can( 'delete_site', $id ) ) { |
|
133 | - wpmu_delete_blog( $id, true ); |
|
132 | + if ($id != '0' && $id != $current_site->blog_id && current_user_can('delete_site', $id)) { |
|
133 | + wpmu_delete_blog($id, true); |
|
134 | 134 | $updated_action = 'delete'; |
135 | 135 | } |
136 | 136 | break; |
137 | 137 | |
138 | 138 | case 'allblogs': |
139 | - if ( ( isset( $_POST['action'] ) || isset( $_POST['action2'] ) ) && isset( $_POST['allblogs'] ) ) { |
|
139 | + if ((isset($_POST['action']) || isset($_POST['action2'])) && isset($_POST['allblogs'])) { |
|
140 | 140 | $doaction = $_POST['action'] != -1 ? $_POST['action'] : $_POST['action2']; |
141 | 141 | |
142 | - foreach ( (array) $_POST['allblogs'] as $key => $val ) { |
|
143 | - if ( $val != '0' && $val != $current_site->blog_id ) { |
|
144 | - switch ( $doaction ) { |
|
142 | + foreach ((array) $_POST['allblogs'] as $key => $val) { |
|
143 | + if ($val != '0' && $val != $current_site->blog_id) { |
|
144 | + switch ($doaction) { |
|
145 | 145 | case 'delete': |
146 | - if ( ! current_user_can( 'delete_site', $val ) ) |
|
147 | - wp_die( __( 'Sorry, you are not allowed to delete the site.' ) ); |
|
146 | + if ( ! current_user_can('delete_site', $val)) |
|
147 | + wp_die(__('Sorry, you are not allowed to delete the site.')); |
|
148 | 148 | |
149 | 149 | $updated_action = 'all_delete'; |
150 | - wpmu_delete_blog( $val, true ); |
|
150 | + wpmu_delete_blog($val, true); |
|
151 | 151 | break; |
152 | 152 | |
153 | 153 | case 'spam': |
154 | 154 | case 'notspam': |
155 | - $updated_action = ( 'spam' === $doaction ) ? 'all_spam' : 'all_notspam'; |
|
156 | - update_blog_status( $val, 'spam', ( 'spam' === $doaction ) ? '1' : '0' ); |
|
155 | + $updated_action = ('spam' === $doaction) ? 'all_spam' : 'all_notspam'; |
|
156 | + update_blog_status($val, 'spam', ('spam' === $doaction) ? '1' : '0'); |
|
157 | 157 | break; |
158 | 158 | } |
159 | 159 | } else { |
160 | - wp_die( __( 'Sorry, you are not allowed to change the current site.' ) ); |
|
160 | + wp_die(__('Sorry, you are not allowed to change the current site.')); |
|
161 | 161 | } |
162 | 162 | } |
163 | 163 | } else { |
164 | - $location = network_admin_url( 'sites.php' ); |
|
165 | - if ( ! empty( $_REQUEST['paged'] ) ) { |
|
166 | - $location = add_query_arg( 'paged', (int) $_REQUEST['paged'], $location ); |
|
164 | + $location = network_admin_url('sites.php'); |
|
165 | + if ( ! empty($_REQUEST['paged'])) { |
|
166 | + $location = add_query_arg('paged', (int) $_REQUEST['paged'], $location); |
|
167 | 167 | } |
168 | - wp_redirect( $location ); |
|
168 | + wp_redirect($location); |
|
169 | 169 | exit(); |
170 | 170 | } |
171 | 171 | break; |
172 | 172 | |
173 | 173 | case 'archiveblog': |
174 | 174 | case 'unarchiveblog': |
175 | - update_blog_status( $id, 'archived', ( 'archiveblog' === $_GET['action'] ) ? '1' : '0' ); |
|
175 | + update_blog_status($id, 'archived', ('archiveblog' === $_GET['action']) ? '1' : '0'); |
|
176 | 176 | break; |
177 | 177 | |
178 | 178 | case 'activateblog': |
179 | - update_blog_status( $id, 'deleted', '0' ); |
|
179 | + update_blog_status($id, 'deleted', '0'); |
|
180 | 180 | |
181 | 181 | /** |
182 | 182 | * Fires after a network site is activated. |
@@ -185,7 +185,7 @@ discard block |
||
185 | 185 | * |
186 | 186 | * @param string $id The ID of the activated site. |
187 | 187 | */ |
188 | - do_action( 'activate_blog', $id ); |
|
188 | + do_action('activate_blog', $id); |
|
189 | 189 | break; |
190 | 190 | |
191 | 191 | case 'deactivateblog': |
@@ -196,66 +196,66 @@ discard block |
||
196 | 196 | * |
197 | 197 | * @param string $id The ID of the site being deactivated. |
198 | 198 | */ |
199 | - do_action( 'deactivate_blog', $id ); |
|
200 | - update_blog_status( $id, 'deleted', '1' ); |
|
199 | + do_action('deactivate_blog', $id); |
|
200 | + update_blog_status($id, 'deleted', '1'); |
|
201 | 201 | break; |
202 | 202 | |
203 | 203 | case 'unspamblog': |
204 | 204 | case 'spamblog': |
205 | - update_blog_status( $id, 'spam', ( 'spamblog' === $_GET['action'] ) ? '1' : '0' ); |
|
205 | + update_blog_status($id, 'spam', ('spamblog' === $_GET['action']) ? '1' : '0'); |
|
206 | 206 | break; |
207 | 207 | |
208 | 208 | case 'unmatureblog': |
209 | 209 | case 'matureblog': |
210 | - update_blog_status( $id, 'mature', ( 'matureblog' === $_GET['action'] ) ? '1' : '0' ); |
|
210 | + update_blog_status($id, 'mature', ('matureblog' === $_GET['action']) ? '1' : '0'); |
|
211 | 211 | break; |
212 | 212 | } |
213 | 213 | |
214 | - if ( empty( $updated_action ) && array_key_exists( $_GET['action'], $manage_actions ) ) { |
|
214 | + if (empty($updated_action) && array_key_exists($_GET['action'], $manage_actions)) { |
|
215 | 215 | $updated_action = $_GET['action']; |
216 | 216 | } |
217 | 217 | |
218 | - if ( ! empty( $updated_action ) ) { |
|
219 | - wp_safe_redirect( add_query_arg( array( 'updated' => $updated_action ), wp_get_referer() ) ); |
|
218 | + if ( ! empty($updated_action)) { |
|
219 | + wp_safe_redirect(add_query_arg(array('updated' => $updated_action), wp_get_referer())); |
|
220 | 220 | exit(); |
221 | 221 | } |
222 | 222 | } |
223 | 223 | |
224 | 224 | $msg = ''; |
225 | -if ( isset( $_GET['updated'] ) ) { |
|
226 | - switch ( $_GET['updated'] ) { |
|
225 | +if (isset($_GET['updated'])) { |
|
226 | + switch ($_GET['updated']) { |
|
227 | 227 | case 'all_notspam': |
228 | - $msg = __( 'Sites removed from spam.' ); |
|
228 | + $msg = __('Sites removed from spam.'); |
|
229 | 229 | break; |
230 | 230 | case 'all_spam': |
231 | - $msg = __( 'Sites marked as spam.' ); |
|
231 | + $msg = __('Sites marked as spam.'); |
|
232 | 232 | break; |
233 | 233 | case 'all_delete': |
234 | - $msg = __( 'Sites deleted.' ); |
|
234 | + $msg = __('Sites deleted.'); |
|
235 | 235 | break; |
236 | 236 | case 'delete': |
237 | - $msg = __( 'Site deleted.' ); |
|
237 | + $msg = __('Site deleted.'); |
|
238 | 238 | break; |
239 | 239 | case 'not_deleted': |
240 | - $msg = __( 'Sorry, you are not allowed to delete that site.' ); |
|
240 | + $msg = __('Sorry, you are not allowed to delete that site.'); |
|
241 | 241 | break; |
242 | 242 | case 'archiveblog': |
243 | - $msg = __( 'Site archived.' ); |
|
243 | + $msg = __('Site archived.'); |
|
244 | 244 | break; |
245 | 245 | case 'unarchiveblog': |
246 | - $msg = __( 'Site unarchived.' ); |
|
246 | + $msg = __('Site unarchived.'); |
|
247 | 247 | break; |
248 | 248 | case 'activateblog': |
249 | - $msg = __( 'Site activated.' ); |
|
249 | + $msg = __('Site activated.'); |
|
250 | 250 | break; |
251 | 251 | case 'deactivateblog': |
252 | - $msg = __( 'Site deactivated.' ); |
|
252 | + $msg = __('Site deactivated.'); |
|
253 | 253 | break; |
254 | 254 | case 'unspamblog': |
255 | - $msg = __( 'Site removed from spam.' ); |
|
255 | + $msg = __('Site removed from spam.'); |
|
256 | 256 | break; |
257 | 257 | case 'spamblog': |
258 | - $msg = __( 'Site marked as spam.' ); |
|
258 | + $msg = __('Site marked as spam.'); |
|
259 | 259 | break; |
260 | 260 | default: |
261 | 261 | /** |
@@ -268,37 +268,37 @@ discard block |
||
268 | 268 | * |
269 | 269 | * @param string $msg The update message. Default 'Settings saved'. |
270 | 270 | */ |
271 | - $msg = apply_filters( 'network_sites_updated_message_' . $_GET['updated'], __( 'Settings saved.' ) ); |
|
271 | + $msg = apply_filters('network_sites_updated_message_'.$_GET['updated'], __('Settings saved.')); |
|
272 | 272 | break; |
273 | 273 | } |
274 | 274 | |
275 | - if ( ! empty( $msg ) ) |
|
276 | - $msg = '<div class="updated" id="message notice is-dismissible"><p>' . $msg . '</p></div>'; |
|
275 | + if ( ! empty($msg)) |
|
276 | + $msg = '<div class="updated" id="message notice is-dismissible"><p>'.$msg.'</p></div>'; |
|
277 | 277 | } |
278 | 278 | |
279 | 279 | $wp_list_table->prepare_items(); |
280 | 280 | |
281 | -require_once( ABSPATH . 'wp-admin/admin-header.php' ); |
|
281 | +require_once(ABSPATH.'wp-admin/admin-header.php'); |
|
282 | 282 | ?> |
283 | 283 | |
284 | 284 | <div class="wrap"> |
285 | -<h1><?php _e( 'Sites' ); ?> |
|
285 | +<h1><?php _e('Sites'); ?> |
|
286 | 286 | |
287 | -<?php if ( current_user_can( 'create_sites') ) : ?> |
|
288 | - <a href="<?php echo network_admin_url('site-new.php'); ?>" class="page-title-action"><?php echo esc_html_x( 'Add New', 'site' ); ?></a> |
|
287 | +<?php if (current_user_can('create_sites')) : ?> |
|
288 | + <a href="<?php echo network_admin_url('site-new.php'); ?>" class="page-title-action"><?php echo esc_html_x('Add New', 'site'); ?></a> |
|
289 | 289 | <?php endif; ?> |
290 | 290 | |
291 | 291 | <?php |
292 | -if ( isset( $_REQUEST['s'] ) && strlen( $_REQUEST['s'] ) ) { |
|
292 | +if (isset($_REQUEST['s']) && strlen($_REQUEST['s'])) { |
|
293 | 293 | /* translators: %s: search keywords */ |
294 | - printf( '<span class="subtitle">' . __( 'Search results for “%s”' ) . '</span>', esc_html( $s ) ); |
|
294 | + printf('<span class="subtitle">'.__('Search results for “%s”').'</span>', esc_html($s)); |
|
295 | 295 | } ?> |
296 | 296 | </h1> |
297 | 297 | |
298 | 298 | <?php echo $msg; ?> |
299 | 299 | |
300 | 300 | <form method="get" id="ms-search"> |
301 | -<?php $wp_list_table->search_box( __( 'Search Sites' ), 'site' ); ?> |
|
301 | +<?php $wp_list_table->search_box(__('Search Sites'), 'site'); ?> |
|
302 | 302 | <input type="hidden" name="action" value="blogs" /> |
303 | 303 | </form> |
304 | 304 | |
@@ -308,4 +308,4 @@ discard block |
||
308 | 308 | </div> |
309 | 309 | <?php |
310 | 310 | |
311 | -require_once( ABSPATH . 'wp-admin/admin-footer.php' ); ?> |
|
311 | +require_once(ABSPATH.'wp-admin/admin-footer.php'); ?> |
@@ -10,11 +10,13 @@ discard block |
||
10 | 10 | /** Load WordPress Administration Bootstrap */ |
11 | 11 | require_once( dirname( __FILE__ ) . '/admin.php' ); |
12 | 12 | |
13 | -if ( ! is_multisite() ) |
|
13 | +if ( ! is_multisite() ) { |
|
14 | 14 | wp_die( __( 'Multisite support is not enabled.' ) ); |
15 | +} |
|
15 | 16 | |
16 | -if ( ! current_user_can( 'manage_sites' ) ) |
|
17 | +if ( ! current_user_can( 'manage_sites' ) ) { |
|
17 | 18 | wp_die( __( 'Sorry, you are not allowed to access this page.' ), 403 ); |
19 | +} |
|
18 | 20 | |
19 | 21 | $wp_list_table = _get_list_table( 'WP_MS_Sites_List_Table' ); |
20 | 22 | $pagenum = $wp_list_table->get_pagenum(); |
@@ -125,8 +127,9 @@ discard block |
||
125 | 127 | switch ( $_GET['action'] ) { |
126 | 128 | |
127 | 129 | case 'deleteblog': |
128 | - if ( ! current_user_can( 'delete_sites' ) ) |
|
129 | - wp_die( __( 'Sorry, you are not allowed to access this page.' ), '', array( 'response' => 403 ) ); |
|
130 | + if ( ! current_user_can( 'delete_sites' ) ) { |
|
131 | + wp_die( __( 'Sorry, you are not allowed to access this page.' ), '', array( 'response' => 403 ) ); |
|
132 | + } |
|
130 | 133 | |
131 | 134 | $updated_action = 'not_deleted'; |
132 | 135 | if ( $id != '0' && $id != $current_site->blog_id && current_user_can( 'delete_site', $id ) ) { |
@@ -143,8 +146,9 @@ discard block |
||
143 | 146 | if ( $val != '0' && $val != $current_site->blog_id ) { |
144 | 147 | switch ( $doaction ) { |
145 | 148 | case 'delete': |
146 | - if ( ! current_user_can( 'delete_site', $val ) ) |
|
147 | - wp_die( __( 'Sorry, you are not allowed to delete the site.' ) ); |
|
149 | + if ( ! current_user_can( 'delete_site', $val ) ) { |
|
150 | + wp_die( __( 'Sorry, you are not allowed to delete the site.' ) ); |
|
151 | + } |
|
148 | 152 | |
149 | 153 | $updated_action = 'all_delete'; |
150 | 154 | wpmu_delete_blog( $val, true ); |
@@ -272,9 +276,10 @@ discard block |
||
272 | 276 | break; |
273 | 277 | } |
274 | 278 | |
275 | - if ( ! empty( $msg ) ) |
|
276 | - $msg = '<div class="updated" id="message notice is-dismissible"><p>' . $msg . '</p></div>'; |
|
277 | -} |
|
279 | + if ( ! empty( $msg ) ) { |
|
280 | + $msg = '<div class="updated" id="message notice is-dismissible"><p>' . $msg . '</p></div>'; |
|
281 | + } |
|
282 | + } |
|
278 | 283 | |
279 | 284 | $wp_list_table->prepare_items(); |
280 | 285 |
@@ -8,13 +8,13 @@ discard block |
||
8 | 8 | */ |
9 | 9 | |
10 | 10 | /** Load WordPress Administration Bootstrap */ |
11 | -require_once( dirname( __FILE__ ) . '/admin.php' ); |
|
11 | +require_once(dirname(__FILE__).'/admin.php'); |
|
12 | 12 | |
13 | -if ( ! is_multisite() ) |
|
14 | - wp_die( __( 'Multisite support is not enabled.' ) ); |
|
13 | +if ( ! is_multisite()) |
|
14 | + wp_die(__('Multisite support is not enabled.')); |
|
15 | 15 | |
16 | -if ( !current_user_can('manage_network_themes') ) |
|
17 | - wp_die( __( 'Sorry, you are not allowed to manage network themes.' ) ); |
|
16 | +if ( ! current_user_can('manage_network_themes')) |
|
17 | + wp_die(__('Sorry, you are not allowed to manage network themes.')); |
|
18 | 18 | |
19 | 19 | $wp_list_table = _get_list_table('WP_MS_Themes_List_Table'); |
20 | 20 | $pagenum = $wp_list_table->get_pagenum(); |
@@ -24,176 +24,176 @@ discard block |
||
24 | 24 | $s = isset($_REQUEST['s']) ? $_REQUEST['s'] : ''; |
25 | 25 | |
26 | 26 | // Clean up request URI from temporary args for screen options/paging uri's to work as expected. |
27 | -$temp_args = array( 'enabled', 'disabled', 'deleted', 'error' ); |
|
28 | -$_SERVER['REQUEST_URI'] = remove_query_arg( $temp_args, $_SERVER['REQUEST_URI'] ); |
|
29 | -$referer = remove_query_arg( $temp_args, wp_get_referer() ); |
|
27 | +$temp_args = array('enabled', 'disabled', 'deleted', 'error'); |
|
28 | +$_SERVER['REQUEST_URI'] = remove_query_arg($temp_args, $_SERVER['REQUEST_URI']); |
|
29 | +$referer = remove_query_arg($temp_args, wp_get_referer()); |
|
30 | 30 | |
31 | -if ( $action ) { |
|
32 | - switch ( $action ) { |
|
31 | +if ($action) { |
|
32 | + switch ($action) { |
|
33 | 33 | case 'enable': |
34 | - check_admin_referer('enable-theme_' . $_GET['theme']); |
|
35 | - WP_Theme::network_enable_theme( $_GET['theme'] ); |
|
36 | - if ( false === strpos( $referer, '/network/themes.php' ) ) |
|
37 | - wp_redirect( network_admin_url( 'themes.php?enabled=1' ) ); |
|
34 | + check_admin_referer('enable-theme_'.$_GET['theme']); |
|
35 | + WP_Theme::network_enable_theme($_GET['theme']); |
|
36 | + if (false === strpos($referer, '/network/themes.php')) |
|
37 | + wp_redirect(network_admin_url('themes.php?enabled=1')); |
|
38 | 38 | else |
39 | - wp_safe_redirect( add_query_arg( 'enabled', 1, $referer ) ); |
|
39 | + wp_safe_redirect(add_query_arg('enabled', 1, $referer)); |
|
40 | 40 | exit; |
41 | 41 | case 'disable': |
42 | - check_admin_referer('disable-theme_' . $_GET['theme']); |
|
43 | - WP_Theme::network_disable_theme( $_GET['theme'] ); |
|
44 | - wp_safe_redirect( add_query_arg( 'disabled', '1', $referer ) ); |
|
42 | + check_admin_referer('disable-theme_'.$_GET['theme']); |
|
43 | + WP_Theme::network_disable_theme($_GET['theme']); |
|
44 | + wp_safe_redirect(add_query_arg('disabled', '1', $referer)); |
|
45 | 45 | exit; |
46 | 46 | case 'enable-selected': |
47 | 47 | check_admin_referer('bulk-themes'); |
48 | - $themes = isset( $_POST['checked'] ) ? (array) $_POST['checked'] : array(); |
|
49 | - if ( empty($themes) ) { |
|
50 | - wp_safe_redirect( add_query_arg( 'error', 'none', $referer ) ); |
|
48 | + $themes = isset($_POST['checked']) ? (array) $_POST['checked'] : array(); |
|
49 | + if (empty($themes)) { |
|
50 | + wp_safe_redirect(add_query_arg('error', 'none', $referer)); |
|
51 | 51 | exit; |
52 | 52 | } |
53 | - WP_Theme::network_enable_theme( (array) $themes ); |
|
54 | - wp_safe_redirect( add_query_arg( 'enabled', count( $themes ), $referer ) ); |
|
53 | + WP_Theme::network_enable_theme((array) $themes); |
|
54 | + wp_safe_redirect(add_query_arg('enabled', count($themes), $referer)); |
|
55 | 55 | exit; |
56 | 56 | case 'disable-selected': |
57 | 57 | check_admin_referer('bulk-themes'); |
58 | - $themes = isset( $_POST['checked'] ) ? (array) $_POST['checked'] : array(); |
|
59 | - if ( empty($themes) ) { |
|
60 | - wp_safe_redirect( add_query_arg( 'error', 'none', $referer ) ); |
|
58 | + $themes = isset($_POST['checked']) ? (array) $_POST['checked'] : array(); |
|
59 | + if (empty($themes)) { |
|
60 | + wp_safe_redirect(add_query_arg('error', 'none', $referer)); |
|
61 | 61 | exit; |
62 | 62 | } |
63 | - WP_Theme::network_disable_theme( (array) $themes ); |
|
64 | - wp_safe_redirect( add_query_arg( 'disabled', count( $themes ), $referer ) ); |
|
63 | + WP_Theme::network_disable_theme((array) $themes); |
|
64 | + wp_safe_redirect(add_query_arg('disabled', count($themes), $referer)); |
|
65 | 65 | exit; |
66 | 66 | case 'update-selected' : |
67 | - check_admin_referer( 'bulk-themes' ); |
|
67 | + check_admin_referer('bulk-themes'); |
|
68 | 68 | |
69 | - if ( isset( $_GET['themes'] ) ) |
|
70 | - $themes = explode( ',', $_GET['themes'] ); |
|
71 | - elseif ( isset( $_POST['checked'] ) ) |
|
69 | + if (isset($_GET['themes'])) |
|
70 | + $themes = explode(',', $_GET['themes']); |
|
71 | + elseif (isset($_POST['checked'])) |
|
72 | 72 | $themes = (array) $_POST['checked']; |
73 | 73 | else |
74 | 74 | $themes = array(); |
75 | 75 | |
76 | - $title = __( 'Update Themes' ); |
|
76 | + $title = __('Update Themes'); |
|
77 | 77 | $parent_file = 'themes.php'; |
78 | 78 | |
79 | - require_once(ABSPATH . 'wp-admin/admin-header.php'); |
|
79 | + require_once(ABSPATH.'wp-admin/admin-header.php'); |
|
80 | 80 | |
81 | 81 | echo '<div class="wrap">'; |
82 | - echo '<h1>' . esc_html( $title ) . '</h1>'; |
|
82 | + echo '<h1>'.esc_html($title).'</h1>'; |
|
83 | 83 | |
84 | - $url = self_admin_url('update.php?action=update-selected-themes&themes=' . urlencode( join(',', $themes) )); |
|
84 | + $url = self_admin_url('update.php?action=update-selected-themes&themes='.urlencode(join(',', $themes))); |
|
85 | 85 | $url = wp_nonce_url($url, 'bulk-update-themes'); |
86 | 86 | |
87 | 87 | echo "<iframe src='$url' style='width: 100%; height:100%; min-height:850px;'></iframe>"; |
88 | 88 | echo '</div>'; |
89 | - require_once(ABSPATH . 'wp-admin/admin-footer.php'); |
|
89 | + require_once(ABSPATH.'wp-admin/admin-footer.php'); |
|
90 | 90 | exit; |
91 | 91 | case 'delete-selected': |
92 | - if ( ! current_user_can( 'delete_themes' ) ) { |
|
93 | - wp_die( __('Sorry, you are not allowed to delete themes for this site.') ); |
|
92 | + if ( ! current_user_can('delete_themes')) { |
|
93 | + wp_die(__('Sorry, you are not allowed to delete themes for this site.')); |
|
94 | 94 | } |
95 | 95 | |
96 | - check_admin_referer( 'bulk-themes' ); |
|
96 | + check_admin_referer('bulk-themes'); |
|
97 | 97 | |
98 | - $themes = isset( $_REQUEST['checked'] ) ? (array) $_REQUEST['checked'] : array(); |
|
98 | + $themes = isset($_REQUEST['checked']) ? (array) $_REQUEST['checked'] : array(); |
|
99 | 99 | |
100 | - if ( empty( $themes ) ) { |
|
101 | - wp_safe_redirect( add_query_arg( 'error', 'none', $referer ) ); |
|
100 | + if (empty($themes)) { |
|
101 | + wp_safe_redirect(add_query_arg('error', 'none', $referer)); |
|
102 | 102 | exit; |
103 | 103 | } |
104 | 104 | |
105 | - $themes = array_diff( $themes, array( get_option( 'stylesheet' ), get_option( 'template' ) ) ); |
|
105 | + $themes = array_diff($themes, array(get_option('stylesheet'), get_option('template'))); |
|
106 | 106 | |
107 | - if ( empty( $themes ) ) { |
|
108 | - wp_safe_redirect( add_query_arg( 'error', 'main', $referer ) ); |
|
107 | + if (empty($themes)) { |
|
108 | + wp_safe_redirect(add_query_arg('error', 'main', $referer)); |
|
109 | 109 | exit; |
110 | 110 | } |
111 | 111 | |
112 | 112 | $theme_info = array(); |
113 | - foreach ( $themes as $key => $theme ) { |
|
114 | - $theme_info[ $theme ] = wp_get_theme( $theme ); |
|
113 | + foreach ($themes as $key => $theme) { |
|
114 | + $theme_info[$theme] = wp_get_theme($theme); |
|
115 | 115 | } |
116 | 116 | |
117 | - include(ABSPATH . 'wp-admin/update.php'); |
|
117 | + include(ABSPATH.'wp-admin/update.php'); |
|
118 | 118 | |
119 | 119 | $parent_file = 'themes.php'; |
120 | 120 | |
121 | - if ( ! isset( $_REQUEST['verify-delete'] ) ) { |
|
122 | - wp_enqueue_script( 'jquery' ); |
|
123 | - require_once( ABSPATH . 'wp-admin/admin-header.php' ); |
|
124 | - $themes_to_delete = count( $themes ); |
|
121 | + if ( ! isset($_REQUEST['verify-delete'])) { |
|
122 | + wp_enqueue_script('jquery'); |
|
123 | + require_once(ABSPATH.'wp-admin/admin-header.php'); |
|
124 | + $themes_to_delete = count($themes); |
|
125 | 125 | ?> |
126 | 126 | <div class="wrap"> |
127 | - <?php if ( 1 == $themes_to_delete ) : ?> |
|
128 | - <h1><?php _e( 'Delete Theme' ); ?></h1> |
|
129 | - <div class="error"><p><strong><?php _e( 'Caution:' ); ?></strong> <?php _e( 'This theme may be active on other sites in the network.' ); ?></p></div> |
|
130 | - <p><?php _e( 'You are about to remove the following theme:' ); ?></p> |
|
127 | + <?php if (1 == $themes_to_delete) : ?> |
|
128 | + <h1><?php _e('Delete Theme'); ?></h1> |
|
129 | + <div class="error"><p><strong><?php _e('Caution:'); ?></strong> <?php _e('This theme may be active on other sites in the network.'); ?></p></div> |
|
130 | + <p><?php _e('You are about to remove the following theme:'); ?></p> |
|
131 | 131 | <?php else : ?> |
132 | - <h1><?php _e( 'Delete Themes' ); ?></h1> |
|
133 | - <div class="error"><p><strong><?php _e( 'Caution:' ); ?></strong> <?php _e( 'These themes may be active on other sites in the network.' ); ?></p></div> |
|
134 | - <p><?php _e( 'You are about to remove the following themes:' ); ?></p> |
|
132 | + <h1><?php _e('Delete Themes'); ?></h1> |
|
133 | + <div class="error"><p><strong><?php _e('Caution:'); ?></strong> <?php _e('These themes may be active on other sites in the network.'); ?></p></div> |
|
134 | + <p><?php _e('You are about to remove the following themes:'); ?></p> |
|
135 | 135 | <?php endif; ?> |
136 | 136 | <ul class="ul-disc"> |
137 | 137 | <?php |
138 | - foreach ( $theme_info as $theme ) { |
|
139 | - echo '<li>' . sprintf( |
|
138 | + foreach ($theme_info as $theme) { |
|
139 | + echo '<li>'.sprintf( |
|
140 | 140 | /* translators: 1: theme name, 2: theme author */ |
141 | - _x( '%1$s by %2$s', 'theme' ), |
|
142 | - '<strong>' . $theme->display( 'Name' ) . '</strong>', |
|
143 | - '<em>' . $theme->display( 'Author' ) . '</em>' |
|
144 | - ) . '</li>'; |
|
141 | + _x('%1$s by %2$s', 'theme'), |
|
142 | + '<strong>'.$theme->display('Name').'</strong>', |
|
143 | + '<em>'.$theme->display('Author').'</em>' |
|
144 | + ).'</li>'; |
|
145 | 145 | } |
146 | 146 | ?> |
147 | 147 | </ul> |
148 | - <?php if ( 1 == $themes_to_delete ) : ?> |
|
149 | - <p><?php _e( 'Are you sure you wish to delete this theme?' ); ?></p> |
|
148 | + <?php if (1 == $themes_to_delete) : ?> |
|
149 | + <p><?php _e('Are you sure you wish to delete this theme?'); ?></p> |
|
150 | 150 | <?php else : ?> |
151 | - <p><?php _e( 'Are you sure you wish to delete these themes?' ); ?></p> |
|
151 | + <p><?php _e('Are you sure you wish to delete these themes?'); ?></p> |
|
152 | 152 | <?php endif; ?> |
153 | 153 | <form method="post" action="<?php echo esc_url($_SERVER['REQUEST_URI']); ?>" style="display:inline;"> |
154 | 154 | <input type="hidden" name="verify-delete" value="1" /> |
155 | 155 | <input type="hidden" name="action" value="delete-selected" /> |
156 | 156 | <?php |
157 | - foreach ( (array) $themes as $theme ) { |
|
158 | - echo '<input type="hidden" name="checked[]" value="' . esc_attr($theme) . '" />'; |
|
157 | + foreach ((array) $themes as $theme) { |
|
158 | + echo '<input type="hidden" name="checked[]" value="'.esc_attr($theme).'" />'; |
|
159 | 159 | } |
160 | 160 | |
161 | - wp_nonce_field( 'bulk-themes' ); |
|
161 | + wp_nonce_field('bulk-themes'); |
|
162 | 162 | |
163 | - if ( 1 == $themes_to_delete ) { |
|
164 | - submit_button( __( 'Yes, delete this theme' ), 'button', 'submit', false ); |
|
163 | + if (1 == $themes_to_delete) { |
|
164 | + submit_button(__('Yes, delete this theme'), 'button', 'submit', false); |
|
165 | 165 | } else { |
166 | - submit_button( __( 'Yes, delete these themes' ), 'button', 'submit', false ); |
|
166 | + submit_button(__('Yes, delete these themes'), 'button', 'submit', false); |
|
167 | 167 | } |
168 | 168 | ?> |
169 | 169 | </form> |
170 | 170 | <?php |
171 | 171 | $referer = wp_get_referer(); |
172 | 172 | ?> |
173 | - <form method="post" action="<?php echo $referer ? esc_url( $referer ) : ''; ?>" style="display:inline;"> |
|
174 | - <?php submit_button( __( 'No, return me to the theme list' ), 'button', 'submit', false ); ?> |
|
173 | + <form method="post" action="<?php echo $referer ? esc_url($referer) : ''; ?>" style="display:inline;"> |
|
174 | + <?php submit_button(__('No, return me to the theme list'), 'button', 'submit', false); ?> |
|
175 | 175 | </form> |
176 | 176 | </div> |
177 | 177 | <?php |
178 | - require_once(ABSPATH . 'wp-admin/admin-footer.php'); |
|
178 | + require_once(ABSPATH.'wp-admin/admin-footer.php'); |
|
179 | 179 | exit; |
180 | 180 | } // Endif verify-delete |
181 | 181 | |
182 | - foreach ( $themes as $theme ) { |
|
183 | - $delete_result = delete_theme( $theme, esc_url( add_query_arg( array( |
|
182 | + foreach ($themes as $theme) { |
|
183 | + $delete_result = delete_theme($theme, esc_url(add_query_arg(array( |
|
184 | 184 | 'verify-delete' => 1, |
185 | 185 | 'action' => 'delete-selected', |
186 | 186 | 'checked' => $_REQUEST['checked'], |
187 | 187 | '_wpnonce' => $_REQUEST['_wpnonce'] |
188 | - ), network_admin_url( 'themes.php' ) ) ) ); |
|
188 | + ), network_admin_url('themes.php')))); |
|
189 | 189 | } |
190 | 190 | |
191 | - $paged = ( $_REQUEST['paged'] ) ? $_REQUEST['paged'] : 1; |
|
192 | - wp_redirect( add_query_arg( array( |
|
193 | - 'deleted' => count( $themes ), |
|
191 | + $paged = ($_REQUEST['paged']) ? $_REQUEST['paged'] : 1; |
|
192 | + wp_redirect(add_query_arg(array( |
|
193 | + 'deleted' => count($themes), |
|
194 | 194 | 'paged' => $paged, |
195 | 195 | 's' => $s |
196 | - ), network_admin_url( 'themes.php' ) ) ); |
|
196 | + ), network_admin_url('themes.php'))); |
|
197 | 197 | exit; |
198 | 198 | } |
199 | 199 | } |
@@ -202,90 +202,90 @@ discard block |
||
202 | 202 | |
203 | 203 | add_thickbox(); |
204 | 204 | |
205 | -add_screen_option( 'per_page' ); |
|
205 | +add_screen_option('per_page'); |
|
206 | 206 | |
207 | -get_current_screen()->add_help_tab( array( |
|
207 | +get_current_screen()->add_help_tab(array( |
|
208 | 208 | 'id' => 'overview', |
209 | 209 | 'title' => __('Overview'), |
210 | 210 | 'content' => |
211 | - '<p>' . __('This screen enables and disables the inclusion of themes available to choose in the Appearance menu for each site. It does not activate or deactivate which theme a site is currently using.') . '</p>' . |
|
212 | - '<p>' . __('If the network admin disables a theme that is in use, it can still remain selected on that site. If another theme is chosen, the disabled theme will not appear in the site’s Appearance > Themes screen.') . '</p>' . |
|
213 | - '<p>' . __('Themes can be enabled on a site by site basis by the network admin on the Edit Site screen (which has a Themes tab); get there via the Edit action link on the All Sites screen. Only network admins are able to install or edit themes.') . '</p>' |
|
214 | -) ); |
|
211 | + '<p>'.__('This screen enables and disables the inclusion of themes available to choose in the Appearance menu for each site. It does not activate or deactivate which theme a site is currently using.').'</p>'. |
|
212 | + '<p>'.__('If the network admin disables a theme that is in use, it can still remain selected on that site. If another theme is chosen, the disabled theme will not appear in the site’s Appearance > Themes screen.').'</p>'. |
|
213 | + '<p>'.__('Themes can be enabled on a site by site basis by the network admin on the Edit Site screen (which has a Themes tab); get there via the Edit action link on the All Sites screen. Only network admins are able to install or edit themes.').'</p>' |
|
214 | +)); |
|
215 | 215 | |
216 | 216 | get_current_screen()->set_help_sidebar( |
217 | - '<p><strong>' . __('For more information:') . '</strong></p>' . |
|
218 | - '<p>' . __('<a href="https://codex.wordpress.org/Network_Admin_Themes_Screen" target="_blank">Documentation on Network Themes</a>') . '</p>' . |
|
219 | - '<p>' . __('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>' |
|
217 | + '<p><strong>'.__('For more information:').'</strong></p>'. |
|
218 | + '<p>'.__('<a href="https://codex.wordpress.org/Network_Admin_Themes_Screen" target="_blank">Documentation on Network Themes</a>').'</p>'. |
|
219 | + '<p>'.__('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>').'</p>' |
|
220 | 220 | ); |
221 | 221 | |
222 | -get_current_screen()->set_screen_reader_content( array( |
|
223 | - 'heading_views' => __( 'Filter themes list' ), |
|
224 | - 'heading_pagination' => __( 'Themes list navigation' ), |
|
225 | - 'heading_list' => __( 'Themes list' ), |
|
226 | -) ); |
|
222 | +get_current_screen()->set_screen_reader_content(array( |
|
223 | + 'heading_views' => __('Filter themes list'), |
|
224 | + 'heading_pagination' => __('Themes list navigation'), |
|
225 | + 'heading_list' => __('Themes list'), |
|
226 | +)); |
|
227 | 227 | |
228 | 228 | $title = __('Themes'); |
229 | 229 | $parent_file = 'themes.php'; |
230 | 230 | |
231 | -wp_enqueue_script( 'updates' ); |
|
232 | -wp_enqueue_script( 'theme-preview' ); |
|
231 | +wp_enqueue_script('updates'); |
|
232 | +wp_enqueue_script('theme-preview'); |
|
233 | 233 | |
234 | -require_once(ABSPATH . 'wp-admin/admin-header.php'); |
|
234 | +require_once(ABSPATH.'wp-admin/admin-header.php'); |
|
235 | 235 | |
236 | 236 | ?> |
237 | 237 | |
238 | 238 | <div class="wrap"> |
239 | -<h1><?php echo esc_html( $title ); if ( current_user_can('install_themes') ) { ?> <a href="theme-install.php" class="page-title-action"><?php echo esc_html_x('Add New', 'theme'); ?></a><?php } |
|
240 | -if ( isset( $_REQUEST['s'] ) && strlen( $_REQUEST['s'] ) ) { |
|
239 | +<h1><?php echo esc_html($title); if (current_user_can('install_themes')) { ?> <a href="theme-install.php" class="page-title-action"><?php echo esc_html_x('Add New', 'theme'); ?></a><?php } |
|
240 | +if (isset($_REQUEST['s']) && strlen($_REQUEST['s'])) { |
|
241 | 241 | /* translators: %s: search keywords */ |
242 | - printf( '<span class="subtitle">' . __( 'Search results for “%s”' ) . '</span>', esc_html( $s ) ); |
|
242 | + printf('<span class="subtitle">'.__('Search results for “%s”').'</span>', esc_html($s)); |
|
243 | 243 | } |
244 | 244 | ?> |
245 | 245 | </h1> |
246 | 246 | |
247 | 247 | <?php |
248 | -if ( isset( $_GET['enabled'] ) ) { |
|
249 | - $enabled = absint( $_GET['enabled'] ); |
|
250 | - if ( 1 == $enabled ) { |
|
251 | - $message = __( 'Theme enabled.' ); |
|
248 | +if (isset($_GET['enabled'])) { |
|
249 | + $enabled = absint($_GET['enabled']); |
|
250 | + if (1 == $enabled) { |
|
251 | + $message = __('Theme enabled.'); |
|
252 | 252 | } else { |
253 | - $message = _n( '%s theme enabled.', '%s themes enabled.', $enabled ); |
|
253 | + $message = _n('%s theme enabled.', '%s themes enabled.', $enabled); |
|
254 | 254 | } |
255 | - echo '<div id="message" class="updated notice is-dismissible"><p>' . sprintf( $message, number_format_i18n( $enabled ) ) . '</p></div>'; |
|
256 | -} elseif ( isset( $_GET['disabled'] ) ) { |
|
257 | - $disabled = absint( $_GET['disabled'] ); |
|
258 | - if ( 1 == $disabled ) { |
|
259 | - $message = __( 'Theme disabled.' ); |
|
255 | + echo '<div id="message" class="updated notice is-dismissible"><p>'.sprintf($message, number_format_i18n($enabled)).'</p></div>'; |
|
256 | +} elseif (isset($_GET['disabled'])) { |
|
257 | + $disabled = absint($_GET['disabled']); |
|
258 | + if (1 == $disabled) { |
|
259 | + $message = __('Theme disabled.'); |
|
260 | 260 | } else { |
261 | - $message = _n( '%s theme disabled.', '%s themes disabled.', $disabled ); |
|
261 | + $message = _n('%s theme disabled.', '%s themes disabled.', $disabled); |
|
262 | 262 | } |
263 | - echo '<div id="message" class="updated notice is-dismissible"><p>' . sprintf( $message, number_format_i18n( $disabled ) ) . '</p></div>'; |
|
264 | -} elseif ( isset( $_GET['deleted'] ) ) { |
|
265 | - $deleted = absint( $_GET['deleted'] ); |
|
266 | - if ( 1 == $deleted ) { |
|
267 | - $message = __( 'Theme deleted.' ); |
|
263 | + echo '<div id="message" class="updated notice is-dismissible"><p>'.sprintf($message, number_format_i18n($disabled)).'</p></div>'; |
|
264 | +} elseif (isset($_GET['deleted'])) { |
|
265 | + $deleted = absint($_GET['deleted']); |
|
266 | + if (1 == $deleted) { |
|
267 | + $message = __('Theme deleted.'); |
|
268 | 268 | } else { |
269 | - $message = _n( '%s theme deleted.', '%s themes deleted.', $deleted ); |
|
269 | + $message = _n('%s theme deleted.', '%s themes deleted.', $deleted); |
|
270 | 270 | } |
271 | - echo '<div id="message" class="updated notice is-dismissible"><p>' . sprintf( $message, number_format_i18n( $deleted ) ) . '</p></div>'; |
|
272 | -} elseif ( isset( $_GET['error'] ) && 'none' == $_GET['error'] ) { |
|
273 | - echo '<div id="message" class="error notice is-dismissible"><p>' . __( 'No theme selected.' ) . '</p></div>'; |
|
274 | -} elseif ( isset( $_GET['error'] ) && 'main' == $_GET['error'] ) { |
|
275 | - echo '<div class="error notice is-dismissible"><p>' . __( 'You cannot delete a theme while it is active on the main site.' ) . '</p></div>'; |
|
271 | + echo '<div id="message" class="updated notice is-dismissible"><p>'.sprintf($message, number_format_i18n($deleted)).'</p></div>'; |
|
272 | +} elseif (isset($_GET['error']) && 'none' == $_GET['error']) { |
|
273 | + echo '<div id="message" class="error notice is-dismissible"><p>'.__('No theme selected.').'</p></div>'; |
|
274 | +} elseif (isset($_GET['error']) && 'main' == $_GET['error']) { |
|
275 | + echo '<div class="error notice is-dismissible"><p>'.__('You cannot delete a theme while it is active on the main site.').'</p></div>'; |
|
276 | 276 | } |
277 | 277 | |
278 | 278 | ?> |
279 | 279 | |
280 | 280 | <form method="get"> |
281 | -<?php $wp_list_table->search_box( __( 'Search Installed Themes' ), 'theme' ); ?> |
|
281 | +<?php $wp_list_table->search_box(__('Search Installed Themes'), 'theme'); ?> |
|
282 | 282 | </form> |
283 | 283 | |
284 | 284 | <?php |
285 | 285 | $wp_list_table->views(); |
286 | 286 | |
287 | -if ( 'broken' == $status ) |
|
288 | - echo '<p class="clear">' . __( 'The following themes are installed but incomplete.' ) . '</p>'; |
|
287 | +if ('broken' == $status) |
|
288 | + echo '<p class="clear">'.__('The following themes are installed but incomplete.').'</p>'; |
|
289 | 289 | ?> |
290 | 290 | |
291 | 291 | <form id="bulk-action-form" method="post"> |
@@ -302,4 +302,4 @@ discard block |
||
302 | 302 | wp_print_admin_notice_templates(); |
303 | 303 | wp_print_update_row_templates(); |
304 | 304 | |
305 | -include(ABSPATH . 'wp-admin/admin-footer.php'); |
|
305 | +include(ABSPATH.'wp-admin/admin-footer.php'); |
@@ -8,51 +8,51 @@ discard block |
||
8 | 8 | */ |
9 | 9 | |
10 | 10 | /** Load WordPress Administration Bootstrap */ |
11 | -require_once( dirname( __FILE__ ) . '/admin.php' ); |
|
11 | +require_once(dirname(__FILE__).'/admin.php'); |
|
12 | 12 | |
13 | 13 | /** WordPress Translation Install API */ |
14 | -require_once( ABSPATH . 'wp-admin/includes/translation-install.php' ); |
|
14 | +require_once(ABSPATH.'wp-admin/includes/translation-install.php'); |
|
15 | 15 | |
16 | -if ( ! is_multisite() ) |
|
17 | - wp_die( __( 'Multisite support is not enabled.' ) ); |
|
16 | +if ( ! is_multisite()) |
|
17 | + wp_die(__('Multisite support is not enabled.')); |
|
18 | 18 | |
19 | -if ( ! current_user_can( 'manage_network_options' ) ) |
|
20 | - wp_die( __( 'Sorry, you are not allowed to access this page.' ), 403 ); |
|
19 | +if ( ! current_user_can('manage_network_options')) |
|
20 | + wp_die(__('Sorry, you are not allowed to access this page.'), 403); |
|
21 | 21 | |
22 | -$title = __( 'Network Settings' ); |
|
22 | +$title = __('Network Settings'); |
|
23 | 23 | $parent_file = 'settings.php'; |
24 | 24 | |
25 | -add_action( 'admin_head', 'network_settings_add_js' ); |
|
25 | +add_action('admin_head', 'network_settings_add_js'); |
|
26 | 26 | |
27 | -get_current_screen()->add_help_tab( array( |
|
27 | +get_current_screen()->add_help_tab(array( |
|
28 | 28 | 'id' => 'overview', |
29 | 29 | 'title' => __('Overview'), |
30 | 30 | 'content' => |
31 | - '<p>' . __('This screen sets and changes options for the network as a whole. The first site is the main site in the network and network options are pulled from that original site’s options.') . '</p>' . |
|
32 | - '<p>' . __('Operational settings has fields for the network’s name and admin email.') . '</p>' . |
|
33 | - '<p>' . __('Registration settings can disable/enable public signups. If you let others sign up for a site, install spam plugins. Spaces, not commas, should separate names banned as sites for this network.') . '</p>' . |
|
34 | - '<p>' . __('New site settings are defaults applied when a new site is created in the network. These include welcome email for when a new site or user account is registered, and what᾿s put in the first post, page, comment, comment author, and comment URL.') . '</p>' . |
|
35 | - '<p>' . __('Upload settings control the size of the uploaded files and the amount of available upload space for each site. You can change the default value for specific sites when you edit a particular site. Allowed file types are also listed (space separated only).') . '</p>' . |
|
36 | - '<p>' . __( 'You can set the language, and the translation files will be automatically downloaded and installed (available if your filesystem is writable).' ) . '</p>' . |
|
37 | - '<p>' . __('Menu setting enables/disables the plugin menus from appearing for non super admins, so that only super admins, not site admins, have access to activate plugins.') . '</p>' . |
|
38 | - '<p>' . __('Super admins can no longer be added on the Options screen. You must now go to the list of existing users on Network Admin > Users and click on Username or the Edit action link below that name. This goes to an Edit User page where you can check a box to grant super admin privileges.') . '</p>' |
|
39 | -) ); |
|
31 | + '<p>'.__('This screen sets and changes options for the network as a whole. The first site is the main site in the network and network options are pulled from that original site’s options.').'</p>'. |
|
32 | + '<p>'.__('Operational settings has fields for the network’s name and admin email.').'</p>'. |
|
33 | + '<p>'.__('Registration settings can disable/enable public signups. If you let others sign up for a site, install spam plugins. Spaces, not commas, should separate names banned as sites for this network.').'</p>'. |
|
34 | + '<p>'.__('New site settings are defaults applied when a new site is created in the network. These include welcome email for when a new site or user account is registered, and what᾿s put in the first post, page, comment, comment author, and comment URL.').'</p>'. |
|
35 | + '<p>'.__('Upload settings control the size of the uploaded files and the amount of available upload space for each site. You can change the default value for specific sites when you edit a particular site. Allowed file types are also listed (space separated only).').'</p>'. |
|
36 | + '<p>'.__('You can set the language, and the translation files will be automatically downloaded and installed (available if your filesystem is writable).').'</p>'. |
|
37 | + '<p>'.__('Menu setting enables/disables the plugin menus from appearing for non super admins, so that only super admins, not site admins, have access to activate plugins.').'</p>'. |
|
38 | + '<p>'.__('Super admins can no longer be added on the Options screen. You must now go to the list of existing users on Network Admin > Users and click on Username or the Edit action link below that name. This goes to an Edit User page where you can check a box to grant super admin privileges.').'</p>' |
|
39 | +)); |
|
40 | 40 | |
41 | 41 | get_current_screen()->set_help_sidebar( |
42 | - '<p><strong>' . __('For more information:') . '</strong></p>' . |
|
43 | - '<p>' . __('<a href="https://codex.wordpress.org/Network_Admin_Settings_Screen" target="_blank">Documentation on Network Settings</a>') . '</p>' . |
|
44 | - '<p>' . __('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>' |
|
42 | + '<p><strong>'.__('For more information:').'</strong></p>'. |
|
43 | + '<p>'.__('<a href="https://codex.wordpress.org/Network_Admin_Settings_Screen" target="_blank">Documentation on Network Settings</a>').'</p>'. |
|
44 | + '<p>'.__('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>').'</p>' |
|
45 | 45 | ); |
46 | 46 | |
47 | -if ( $_POST ) { |
|
47 | +if ($_POST) { |
|
48 | 48 | /** This action is documented in wp-admin/network/edit.php */ |
49 | - do_action( 'wpmuadminedit' ); |
|
49 | + do_action('wpmuadminedit'); |
|
50 | 50 | |
51 | - check_admin_referer( 'siteoptions' ); |
|
51 | + check_admin_referer('siteoptions'); |
|
52 | 52 | |
53 | - $checked_options = array( 'menu_items' => array(), 'registrationnotification' => 'no', 'upload_space_check_disabled' => 1, 'add_new_users' => 0 ); |
|
54 | - foreach ( $checked_options as $option_name => $option_unchecked_value ) { |
|
55 | - if ( ! isset( $_POST[$option_name] ) ) |
|
53 | + $checked_options = array('menu_items' => array(), 'registrationnotification' => 'no', 'upload_space_check_disabled' => 1, 'add_new_users' => 0); |
|
54 | + foreach ($checked_options as $option_name => $option_unchecked_value) { |
|
55 | + if ( ! isset($_POST[$option_name])) |
|
56 | 56 | $_POST[$option_name] = $option_unchecked_value; |
57 | 57 | } |
58 | 58 | |
@@ -66,18 +66,18 @@ discard block |
||
66 | 66 | ); |
67 | 67 | |
68 | 68 | // Handle translation install. |
69 | - if ( ! empty( $_POST['WPLANG'] ) && wp_can_install_language_pack() ) { // @todo: Skip if already installed |
|
70 | - $language = wp_download_language_pack( $_POST['WPLANG'] ); |
|
71 | - if ( $language ) { |
|
69 | + if ( ! empty($_POST['WPLANG']) && wp_can_install_language_pack()) { // @todo: Skip if already installed |
|
70 | + $language = wp_download_language_pack($_POST['WPLANG']); |
|
71 | + if ($language) { |
|
72 | 72 | $_POST['WPLANG'] = $language; |
73 | 73 | } |
74 | 74 | } |
75 | 75 | |
76 | - foreach ( $options as $option_name ) { |
|
77 | - if ( ! isset($_POST[$option_name]) ) |
|
76 | + foreach ($options as $option_name) { |
|
77 | + if ( ! isset($_POST[$option_name])) |
|
78 | 78 | continue; |
79 | - $value = wp_unslash( $_POST[$option_name] ); |
|
80 | - update_site_option( $option_name, $value ); |
|
79 | + $value = wp_unslash($_POST[$option_name]); |
|
80 | + update_site_option($option_name, $value); |
|
81 | 81 | } |
82 | 82 | |
83 | 83 | /** |
@@ -85,62 +85,62 @@ discard block |
||
85 | 85 | * |
86 | 86 | * @since MU |
87 | 87 | */ |
88 | - do_action( 'update_wpmu_options' ); |
|
88 | + do_action('update_wpmu_options'); |
|
89 | 89 | |
90 | - wp_redirect( add_query_arg( 'updated', 'true', network_admin_url( 'settings.php' ) ) ); |
|
90 | + wp_redirect(add_query_arg('updated', 'true', network_admin_url('settings.php'))); |
|
91 | 91 | exit(); |
92 | 92 | } |
93 | 93 | |
94 | -include( ABSPATH . 'wp-admin/admin-header.php' ); |
|
94 | +include(ABSPATH.'wp-admin/admin-header.php'); |
|
95 | 95 | |
96 | -if ( isset( $_GET['updated'] ) ) { |
|
97 | - ?><div id="message" class="updated notice is-dismissible"><p><?php _e( 'Settings saved.' ) ?></p></div><?php |
|
96 | +if (isset($_GET['updated'])) { |
|
97 | + ?><div id="message" class="updated notice is-dismissible"><p><?php _e('Settings saved.') ?></p></div><?php |
|
98 | 98 | } |
99 | 99 | ?> |
100 | 100 | |
101 | 101 | <div class="wrap"> |
102 | - <h1><?php echo esc_html( $title ); ?></h1> |
|
102 | + <h1><?php echo esc_html($title); ?></h1> |
|
103 | 103 | <form method="post" action="settings.php" novalidate="novalidate"> |
104 | - <?php wp_nonce_field( 'siteoptions' ); ?> |
|
105 | - <h2><?php _e( 'Operational Settings' ); ?></h2> |
|
104 | + <?php wp_nonce_field('siteoptions'); ?> |
|
105 | + <h2><?php _e('Operational Settings'); ?></h2> |
|
106 | 106 | <table class="form-table"> |
107 | 107 | <tr> |
108 | - <th scope="row"><label for="site_name"><?php _e( 'Network Title' ) ?></label></th> |
|
108 | + <th scope="row"><label for="site_name"><?php _e('Network Title') ?></label></th> |
|
109 | 109 | <td> |
110 | - <input name="site_name" type="text" id="site_name" class="regular-text" value="<?php echo esc_attr( $current_site->site_name ) ?>" /> |
|
110 | + <input name="site_name" type="text" id="site_name" class="regular-text" value="<?php echo esc_attr($current_site->site_name) ?>" /> |
|
111 | 111 | </td> |
112 | 112 | </tr> |
113 | 113 | |
114 | 114 | <tr> |
115 | - <th scope="row"><label for="admin_email"><?php _e( 'Network Admin Email' ) ?></label></th> |
|
115 | + <th scope="row"><label for="admin_email"><?php _e('Network Admin Email') ?></label></th> |
|
116 | 116 | <td> |
117 | - <input name="admin_email" type="email" id="admin_email" aria-describedby="admin-email-desc" class="regular-text" value="<?php echo esc_attr( get_site_option( 'admin_email' ) ) ?>" /> |
|
117 | + <input name="admin_email" type="email" id="admin_email" aria-describedby="admin-email-desc" class="regular-text" value="<?php echo esc_attr(get_site_option('admin_email')) ?>" /> |
|
118 | 118 | <p class="description" id="admin-email-desc"> |
119 | - <?php _e( 'This email address will receive notifications. Registration and support emails will also come from this address.' ); ?> |
|
119 | + <?php _e('This email address will receive notifications. Registration and support emails will also come from this address.'); ?> |
|
120 | 120 | </p> |
121 | 121 | </td> |
122 | 122 | </tr> |
123 | 123 | </table> |
124 | - <h2><?php _e( 'Registration Settings' ); ?></h2> |
|
124 | + <h2><?php _e('Registration Settings'); ?></h2> |
|
125 | 125 | <table class="form-table"> |
126 | 126 | <tr> |
127 | - <th scope="row"><?php _e( 'Allow new registrations' ) ?></th> |
|
127 | + <th scope="row"><?php _e('Allow new registrations') ?></th> |
|
128 | 128 | <?php |
129 | - if ( !get_site_option( 'registration' ) ) |
|
130 | - update_site_option( 'registration', 'none' ); |
|
131 | - $reg = get_site_option( 'registration' ); |
|
129 | + if ( ! get_site_option('registration')) |
|
130 | + update_site_option('registration', 'none'); |
|
131 | + $reg = get_site_option('registration'); |
|
132 | 132 | ?> |
133 | 133 | <td> |
134 | 134 | <fieldset> |
135 | - <legend class="screen-reader-text"><?php _e( 'New registrations settings' ) ?></legend> |
|
136 | - <label><input name="registration" type="radio" id="registration1" value="none"<?php checked( $reg, 'none') ?> /> <?php _e( 'Registration is disabled.' ); ?></label><br /> |
|
137 | - <label><input name="registration" type="radio" id="registration2" value="user"<?php checked( $reg, 'user') ?> /> <?php _e( 'User accounts may be registered.' ); ?></label><br /> |
|
138 | - <label><input name="registration" type="radio" id="registration3" value="blog"<?php checked( $reg, 'blog') ?> /> <?php _e( 'Logged in users may register new sites.' ); ?></label><br /> |
|
139 | - <label><input name="registration" type="radio" id="registration4" value="all"<?php checked( $reg, 'all') ?> /> <?php _e( 'Both sites and user accounts can be registered.' ); ?></label> |
|
140 | - <?php if ( is_subdomain_install() ) { |
|
135 | + <legend class="screen-reader-text"><?php _e('New registrations settings') ?></legend> |
|
136 | + <label><input name="registration" type="radio" id="registration1" value="none"<?php checked($reg, 'none') ?> /> <?php _e('Registration is disabled.'); ?></label><br /> |
|
137 | + <label><input name="registration" type="radio" id="registration2" value="user"<?php checked($reg, 'user') ?> /> <?php _e('User accounts may be registered.'); ?></label><br /> |
|
138 | + <label><input name="registration" type="radio" id="registration3" value="blog"<?php checked($reg, 'blog') ?> /> <?php _e('Logged in users may register new sites.'); ?></label><br /> |
|
139 | + <label><input name="registration" type="radio" id="registration4" value="all"<?php checked($reg, 'all') ?> /> <?php _e('Both sites and user accounts can be registered.'); ?></label> |
|
140 | + <?php if (is_subdomain_install()) { |
|
141 | 141 | echo '<p class="description">'; |
142 | 142 | /* translators: 1: NOBLOGREDIRECT 2: wp-config.php */ |
143 | - printf( __( 'If registration is disabled, please set %1$s in %2$s to a URL you will redirect visitors to if they visit a non-existent site.' ), |
|
143 | + printf(__('If registration is disabled, please set %1$s in %2$s to a URL you will redirect visitors to if they visit a non-existent site.'), |
|
144 | 144 | '<code>NOBLOGREDIRECT</code>', |
145 | 145 | '<code>wp-config.php</code>' |
146 | 146 | ); |
@@ -151,42 +151,42 @@ discard block |
||
151 | 151 | </tr> |
152 | 152 | |
153 | 153 | <tr> |
154 | - <th scope="row"><?php _e( 'Registration notification' ) ?></th> |
|
154 | + <th scope="row"><?php _e('Registration notification') ?></th> |
|
155 | 155 | <?php |
156 | - if ( !get_site_option( 'registrationnotification' ) ) |
|
157 | - update_site_option( 'registrationnotification', 'yes' ); |
|
156 | + if ( ! get_site_option('registrationnotification')) |
|
157 | + update_site_option('registrationnotification', 'yes'); |
|
158 | 158 | ?> |
159 | 159 | <td> |
160 | - <label><input name="registrationnotification" type="checkbox" id="registrationnotification" value="yes"<?php checked( get_site_option( 'registrationnotification' ), 'yes' ) ?> /> <?php _e( 'Send the network admin an email notification every time someone registers a site or user account.' ) ?></label> |
|
160 | + <label><input name="registrationnotification" type="checkbox" id="registrationnotification" value="yes"<?php checked(get_site_option('registrationnotification'), 'yes') ?> /> <?php _e('Send the network admin an email notification every time someone registers a site or user account.') ?></label> |
|
161 | 161 | </td> |
162 | 162 | </tr> |
163 | 163 | |
164 | 164 | <tr id="addnewusers"> |
165 | - <th scope="row"><?php _e( 'Add New Users' ) ?></th> |
|
165 | + <th scope="row"><?php _e('Add New Users') ?></th> |
|
166 | 166 | <td> |
167 | - <label><input name="add_new_users" type="checkbox" id="add_new_users" value="1"<?php checked( get_site_option( 'add_new_users' ) ) ?> /> <?php _e( 'Allow site administrators to add new users to their site via the "Users → Add New" page.' ); ?></label> |
|
167 | + <label><input name="add_new_users" type="checkbox" id="add_new_users" value="1"<?php checked(get_site_option('add_new_users')) ?> /> <?php _e('Allow site administrators to add new users to their site via the "Users → Add New" page.'); ?></label> |
|
168 | 168 | </td> |
169 | 169 | </tr> |
170 | 170 | |
171 | 171 | <tr> |
172 | - <th scope="row"><label for="illegal_names"><?php _e( 'Banned Names' ) ?></label></th> |
|
172 | + <th scope="row"><label for="illegal_names"><?php _e('Banned Names') ?></label></th> |
|
173 | 173 | <td> |
174 | - <input name="illegal_names" type="text" id="illegal_names" aria-describedby="illegal-names-desc" class="large-text" value="<?php echo esc_attr( implode( " ", (array) get_site_option( 'illegal_names' ) ) ); ?>" size="45" /> |
|
174 | + <input name="illegal_names" type="text" id="illegal_names" aria-describedby="illegal-names-desc" class="large-text" value="<?php echo esc_attr(implode(" ", (array) get_site_option('illegal_names'))); ?>" size="45" /> |
|
175 | 175 | <p class="description" id="illegal-names-desc"> |
176 | - <?php _e( 'Users are not allowed to register these sites. Separate names by spaces.' ) ?> |
|
176 | + <?php _e('Users are not allowed to register these sites. Separate names by spaces.') ?> |
|
177 | 177 | </p> |
178 | 178 | </td> |
179 | 179 | </tr> |
180 | 180 | |
181 | 181 | <tr> |
182 | - <th scope="row"><label for="limited_email_domains"><?php _e( 'Limited Email Registrations' ) ?></label></th> |
|
182 | + <th scope="row"><label for="limited_email_domains"><?php _e('Limited Email Registrations') ?></label></th> |
|
183 | 183 | <td> |
184 | - <?php $limited_email_domains = get_site_option( 'limited_email_domains' ); |
|
185 | - $limited_email_domains = str_replace( ' ', "\n", $limited_email_domains ); ?> |
|
184 | + <?php $limited_email_domains = get_site_option('limited_email_domains'); |
|
185 | + $limited_email_domains = str_replace(' ', "\n", $limited_email_domains); ?> |
|
186 | 186 | <textarea name="limited_email_domains" id="limited_email_domains" aria-describedby="limited-email-domains-desc" cols="45" rows="5"> |
187 | -<?php echo esc_textarea( $limited_email_domains == '' ? '' : implode( "\n", (array) $limited_email_domains ) ); ?></textarea> |
|
187 | +<?php echo esc_textarea($limited_email_domains == '' ? '' : implode("\n", (array) $limited_email_domains)); ?></textarea> |
|
188 | 188 | <p class="description" id="limited-email-domains-desc"> |
189 | - <?php _e( 'If you want to limit site registrations to certain domains. One domain per line.' ) ?> |
|
189 | + <?php _e('If you want to limit site registrations to certain domains. One domain per line.') ?> |
|
190 | 190 | </p> |
191 | 191 | </td> |
192 | 192 | </tr> |
@@ -195,123 +195,123 @@ discard block |
||
195 | 195 | <th scope="row"><label for="banned_email_domains"><?php _e('Banned Email Domains') ?></label></th> |
196 | 196 | <td> |
197 | 197 | <textarea name="banned_email_domains" id="banned_email_domains" aria-describedby="banned-email-domains-desc" cols="45" rows="5"> |
198 | -<?php echo esc_textarea( get_site_option( 'banned_email_domains' ) == '' ? '' : implode( "\n", (array) get_site_option( 'banned_email_domains' ) ) ); ?></textarea> |
|
198 | +<?php echo esc_textarea(get_site_option('banned_email_domains') == '' ? '' : implode("\n", (array) get_site_option('banned_email_domains'))); ?></textarea> |
|
199 | 199 | <p class="description" id="banned-email-domains-desc"> |
200 | - <?php _e( 'If you want to ban domains from site registrations. One domain per line.' ) ?> |
|
200 | + <?php _e('If you want to ban domains from site registrations. One domain per line.') ?> |
|
201 | 201 | </p> |
202 | 202 | </td> |
203 | 203 | </tr> |
204 | 204 | |
205 | 205 | </table> |
206 | - <h2><?php _e( 'New Site Settings' ); ?></h2> |
|
206 | + <h2><?php _e('New Site Settings'); ?></h2> |
|
207 | 207 | <table class="form-table"> |
208 | 208 | |
209 | 209 | <tr> |
210 | - <th scope="row"><label for="welcome_email"><?php _e( 'Welcome Email' ) ?></label></th> |
|
210 | + <th scope="row"><label for="welcome_email"><?php _e('Welcome Email') ?></label></th> |
|
211 | 211 | <td> |
212 | 212 | <textarea name="welcome_email" id="welcome_email" aria-describedby="welcome-email-desc" rows="5" cols="45" class="large-text"> |
213 | -<?php echo esc_textarea( get_site_option( 'welcome_email' ) ) ?></textarea> |
|
213 | +<?php echo esc_textarea(get_site_option('welcome_email')) ?></textarea> |
|
214 | 214 | <p class="description" id="welcome-email-desc"> |
215 | - <?php _e( 'The welcome email sent to new site owners.' ) ?> |
|
215 | + <?php _e('The welcome email sent to new site owners.') ?> |
|
216 | 216 | </p> |
217 | 217 | </td> |
218 | 218 | </tr> |
219 | 219 | <tr> |
220 | - <th scope="row"><label for="welcome_user_email"><?php _e( 'Welcome User Email' ) ?></label></th> |
|
220 | + <th scope="row"><label for="welcome_user_email"><?php _e('Welcome User Email') ?></label></th> |
|
221 | 221 | <td> |
222 | 222 | <textarea name="welcome_user_email" id="welcome_user_email" aria-describedby="welcome-user-email-desc" rows="5" cols="45" class="large-text"> |
223 | -<?php echo esc_textarea( get_site_option( 'welcome_user_email' ) ) ?></textarea> |
|
223 | +<?php echo esc_textarea(get_site_option('welcome_user_email')) ?></textarea> |
|
224 | 224 | <p class="description" id="welcome-user-email-desc"> |
225 | - <?php _e( 'The welcome email sent to new users.' ) ?> |
|
225 | + <?php _e('The welcome email sent to new users.') ?> |
|
226 | 226 | </p> |
227 | 227 | </td> |
228 | 228 | </tr> |
229 | 229 | <tr> |
230 | - <th scope="row"><label for="first_post"><?php _e( 'First Post' ) ?></label></th> |
|
230 | + <th scope="row"><label for="first_post"><?php _e('First Post') ?></label></th> |
|
231 | 231 | <td> |
232 | 232 | <textarea name="first_post" id="first_post" aria-describedby="first-post-desc" rows="5" cols="45" class="large-text"> |
233 | -<?php echo esc_textarea( get_site_option( 'first_post' ) ) ?></textarea> |
|
233 | +<?php echo esc_textarea(get_site_option('first_post')) ?></textarea> |
|
234 | 234 | <p class="description" id="first-post-desc"> |
235 | - <?php _e( 'The first post on a new site.' ) ?> |
|
235 | + <?php _e('The first post on a new site.') ?> |
|
236 | 236 | </p> |
237 | 237 | </td> |
238 | 238 | </tr> |
239 | 239 | <tr> |
240 | - <th scope="row"><label for="first_page"><?php _e( 'First Page' ) ?></label></th> |
|
240 | + <th scope="row"><label for="first_page"><?php _e('First Page') ?></label></th> |
|
241 | 241 | <td> |
242 | 242 | <textarea name="first_page" id="first_page" aria-describedby="first-page-desc" rows="5" cols="45" class="large-text"> |
243 | -<?php echo esc_textarea( get_site_option( 'first_page' ) ) ?></textarea> |
|
243 | +<?php echo esc_textarea(get_site_option('first_page')) ?></textarea> |
|
244 | 244 | <p class="description" id="first-page-desc"> |
245 | - <?php _e( 'The first page on a new site.' ) ?> |
|
245 | + <?php _e('The first page on a new site.') ?> |
|
246 | 246 | </p> |
247 | 247 | </td> |
248 | 248 | </tr> |
249 | 249 | <tr> |
250 | - <th scope="row"><label for="first_comment"><?php _e( 'First Comment' ) ?></label></th> |
|
250 | + <th scope="row"><label for="first_comment"><?php _e('First Comment') ?></label></th> |
|
251 | 251 | <td> |
252 | 252 | <textarea name="first_comment" id="first_comment" aria-describedby="first-comment-desc" rows="5" cols="45" class="large-text"> |
253 | -<?php echo esc_textarea( get_site_option( 'first_comment' ) ) ?></textarea> |
|
253 | +<?php echo esc_textarea(get_site_option('first_comment')) ?></textarea> |
|
254 | 254 | <p class="description" id="first-comment-desc"> |
255 | - <?php _e( 'The first comment on a new site.' ) ?> |
|
255 | + <?php _e('The first comment on a new site.') ?> |
|
256 | 256 | </p> |
257 | 257 | </td> |
258 | 258 | </tr> |
259 | 259 | <tr> |
260 | - <th scope="row"><label for="first_comment_author"><?php _e( 'First Comment Author' ) ?></label></th> |
|
260 | + <th scope="row"><label for="first_comment_author"><?php _e('First Comment Author') ?></label></th> |
|
261 | 261 | <td> |
262 | - <input type="text" size="40" name="first_comment_author" id="first_comment_author" aria-describedby="first-comment-author-desc" value="<?php echo esc_attr( get_site_option('first_comment_author') ); ?>" /> |
|
262 | + <input type="text" size="40" name="first_comment_author" id="first_comment_author" aria-describedby="first-comment-author-desc" value="<?php echo esc_attr(get_site_option('first_comment_author')); ?>" /> |
|
263 | 263 | <p class="description" id="first-comment-author-desc"> |
264 | - <?php _e( 'The author of the first comment on a new site.' ) ?> |
|
264 | + <?php _e('The author of the first comment on a new site.') ?> |
|
265 | 265 | </p> |
266 | 266 | </td> |
267 | 267 | </tr> |
268 | 268 | <tr> |
269 | - <th scope="row"><label for="first_comment_email"><?php _e( 'First Comment Email' ) ?></label></th> |
|
269 | + <th scope="row"><label for="first_comment_email"><?php _e('First Comment Email') ?></label></th> |
|
270 | 270 | <td> |
271 | - <input type="text" size="40" name="first_comment_email" id="first_comment_email" aria-describedby="first-comment-email-desc" value="<?php echo esc_attr( get_site_option( 'first_comment_email' ) ); ?>" /> |
|
271 | + <input type="text" size="40" name="first_comment_email" id="first_comment_email" aria-describedby="first-comment-email-desc" value="<?php echo esc_attr(get_site_option('first_comment_email')); ?>" /> |
|
272 | 272 | <p class="description" id="first-comment-email-desc"> |
273 | - <?php _e( 'The email address of the first comment author on a new site.' ) ?> |
|
273 | + <?php _e('The email address of the first comment author on a new site.') ?> |
|
274 | 274 | </p> |
275 | 275 | </td> |
276 | 276 | </tr> |
277 | 277 | <tr> |
278 | - <th scope="row"><label for="first_comment_url"><?php _e( 'First Comment URL' ) ?></label></th> |
|
278 | + <th scope="row"><label for="first_comment_url"><?php _e('First Comment URL') ?></label></th> |
|
279 | 279 | <td> |
280 | - <input type="text" size="40" name="first_comment_url" id="first_comment_url" aria-describedby="first-comment-url-desc" value="<?php echo esc_attr( get_site_option( 'first_comment_url' ) ) ?>" /> |
|
280 | + <input type="text" size="40" name="first_comment_url" id="first_comment_url" aria-describedby="first-comment-url-desc" value="<?php echo esc_attr(get_site_option('first_comment_url')) ?>" /> |
|
281 | 281 | <p class="description" id="first-comment-url-desc"> |
282 | - <?php _e( 'The URL for the first comment on a new site.' ) ?> |
|
282 | + <?php _e('The URL for the first comment on a new site.') ?> |
|
283 | 283 | </p> |
284 | 284 | </td> |
285 | 285 | </tr> |
286 | 286 | </table> |
287 | - <h2><?php _e( 'Upload Settings' ); ?></h2> |
|
287 | + <h2><?php _e('Upload Settings'); ?></h2> |
|
288 | 288 | <table class="form-table"> |
289 | 289 | <tr> |
290 | - <th scope="row"><?php _e( 'Site upload space' ) ?></th> |
|
290 | + <th scope="row"><?php _e('Site upload space') ?></th> |
|
291 | 291 | <td> |
292 | - <label><input type="checkbox" id="upload_space_check_disabled" name="upload_space_check_disabled" value="0"<?php checked( (bool) get_site_option( 'upload_space_check_disabled' ), false ) ?>/> <?php printf( __( 'Limit total size of files uploaded to %s MB' ), '</label><label><input name="blog_upload_space" type="number" min="0" style="width: 100px" id="blog_upload_space" aria-describedby="blog-upload-space-desc" value="' . esc_attr( get_site_option('blog_upload_space', 100) ) . '" />' ); ?></label><br /> |
|
292 | + <label><input type="checkbox" id="upload_space_check_disabled" name="upload_space_check_disabled" value="0"<?php checked((bool) get_site_option('upload_space_check_disabled'), false) ?>/> <?php printf(__('Limit total size of files uploaded to %s MB'), '</label><label><input name="blog_upload_space" type="number" min="0" style="width: 100px" id="blog_upload_space" aria-describedby="blog-upload-space-desc" value="'.esc_attr(get_site_option('blog_upload_space', 100)).'" />'); ?></label><br /> |
|
293 | 293 | <p class="screen-reader-text" id="blog-upload-space-desc"> |
294 | - <?php _e( 'Size in megabytes' ) ?> |
|
294 | + <?php _e('Size in megabytes') ?> |
|
295 | 295 | </p> |
296 | 296 | </td> |
297 | 297 | </tr> |
298 | 298 | |
299 | 299 | <tr> |
300 | - <th scope="row"><label for="upload_filetypes"><?php _e( 'Upload file types' ) ?></label></th> |
|
300 | + <th scope="row"><label for="upload_filetypes"><?php _e('Upload file types') ?></label></th> |
|
301 | 301 | <td> |
302 | - <input name="upload_filetypes" type="text" id="upload_filetypes" aria-describedby="upload-filetypes-desc" class="large-text" value="<?php echo esc_attr( get_site_option( 'upload_filetypes', 'jpg jpeg png gif' ) ) ?>" size="45" /> |
|
302 | + <input name="upload_filetypes" type="text" id="upload_filetypes" aria-describedby="upload-filetypes-desc" class="large-text" value="<?php echo esc_attr(get_site_option('upload_filetypes', 'jpg jpeg png gif')) ?>" size="45" /> |
|
303 | 303 | <p class="description" id="upload-filetypes-desc"> |
304 | - <?php _e( 'Allowed file types. Separate types by spaces.' ) ?> |
|
304 | + <?php _e('Allowed file types. Separate types by spaces.') ?> |
|
305 | 305 | </p> |
306 | 306 | </td> |
307 | 307 | </tr> |
308 | 308 | |
309 | 309 | <tr> |
310 | - <th scope="row"><label for="fileupload_maxk"><?php _e( 'Max upload file size' ) ?></label></th> |
|
310 | + <th scope="row"><label for="fileupload_maxk"><?php _e('Max upload file size') ?></label></th> |
|
311 | 311 | <td> |
312 | - <?php printf( _x( '%s KB', 'File size in kilobytes' ), '<input name="fileupload_maxk" type="number" min="0" style="width: 100px" id="fileupload_maxk" aria-describedby="fileupload-maxk-desc" value="' . esc_attr( get_site_option( 'fileupload_maxk', 300 ) ) . '" />' ); ?> |
|
312 | + <?php printf(_x('%s KB', 'File size in kilobytes'), '<input name="fileupload_maxk" type="number" min="0" style="width: 100px" id="fileupload_maxk" aria-describedby="fileupload-maxk-desc" value="'.esc_attr(get_site_option('fileupload_maxk', 300)).'" />'); ?> |
|
313 | 313 | <p class="screen-reader-text" id="fileupload-maxk-desc"> |
314 | - <?php _e( 'Size in kilobytes' ) ?> |
|
314 | + <?php _e('Size in kilobytes') ?> |
|
315 | 315 | </p> |
316 | 316 | </td> |
317 | 317 | </tr> |
@@ -320,27 +320,27 @@ discard block |
||
320 | 320 | <?php |
321 | 321 | $languages = get_available_languages(); |
322 | 322 | $translations = wp_get_available_translations(); |
323 | - if ( ! empty( $languages ) || ! empty( $translations ) ) { |
|
323 | + if ( ! empty($languages) || ! empty($translations)) { |
|
324 | 324 | ?> |
325 | - <h2><?php _e( 'Language Settings' ); ?></h2> |
|
325 | + <h2><?php _e('Language Settings'); ?></h2> |
|
326 | 326 | <table class="form-table"> |
327 | 327 | <tr> |
328 | - <th><label for="WPLANG"><?php _e( 'Default Language' ); ?></label></th> |
|
328 | + <th><label for="WPLANG"><?php _e('Default Language'); ?></label></th> |
|
329 | 329 | <td> |
330 | 330 | <?php |
331 | - $lang = get_site_option( 'WPLANG' ); |
|
332 | - if ( ! in_array( $lang, $languages ) ) { |
|
331 | + $lang = get_site_option('WPLANG'); |
|
332 | + if ( ! in_array($lang, $languages)) { |
|
333 | 333 | $lang = ''; |
334 | 334 | } |
335 | 335 | |
336 | - wp_dropdown_languages( array( |
|
336 | + wp_dropdown_languages(array( |
|
337 | 337 | 'name' => 'WPLANG', |
338 | 338 | 'id' => 'WPLANG', |
339 | 339 | 'selected' => $lang, |
340 | 340 | 'languages' => $languages, |
341 | 341 | 'translations' => $translations, |
342 | 342 | 'show_available_translations' => wp_can_install_language_pack(), |
343 | - ) ); |
|
343 | + )); |
|
344 | 344 | ?> |
345 | 345 | </td> |
346 | 346 | </tr> |
@@ -349,13 +349,13 @@ discard block |
||
349 | 349 | } |
350 | 350 | ?> |
351 | 351 | |
352 | - <h2><?php _e( 'Menu Settings' ); ?></h2> |
|
352 | + <h2><?php _e('Menu Settings'); ?></h2> |
|
353 | 353 | <table id="menu" class="form-table"> |
354 | 354 | <tr> |
355 | - <th scope="row"><?php _e( 'Enable administration menus' ); ?></th> |
|
355 | + <th scope="row"><?php _e('Enable administration menus'); ?></th> |
|
356 | 356 | <td> |
357 | 357 | <?php |
358 | - $menu_perms = get_site_option( 'menu_items' ); |
|
358 | + $menu_perms = get_site_option('menu_items'); |
|
359 | 359 | /** |
360 | 360 | * Filters available network-wide administration menu options. |
361 | 361 | * |
@@ -371,14 +371,14 @@ discard block |
||
371 | 371 | * |
372 | 372 | * @param array $admin_menus The menu items available. |
373 | 373 | */ |
374 | - $menu_items = apply_filters( 'mu_menu_items', array( 'plugins' => __( 'Plugins' ) ) ); |
|
374 | + $menu_items = apply_filters('mu_menu_items', array('plugins' => __('Plugins'))); |
|
375 | 375 | $fieldset_end = ''; |
376 | - if ( count( (array) $menu_items ) > 1 ) { |
|
377 | - echo '<fieldset><legend class="screen-reader-text">' . __( 'Enable menus' ) . '</legend>'; |
|
376 | + if (count((array) $menu_items) > 1) { |
|
377 | + echo '<fieldset><legend class="screen-reader-text">'.__('Enable menus').'</legend>'; |
|
378 | 378 | $fieldset_end = '</fieldset>'; |
379 | 379 | } |
380 | - foreach ( (array) $menu_items as $key => $val ) { |
|
381 | - echo "<label><input type='checkbox' name='menu_items[" . $key . "]' value='1'" . ( isset( $menu_perms[$key] ) ? checked( $menu_perms[$key], '1', false ) : '' ) . " /> " . esc_html( $val ) . "</label><br/>"; |
|
380 | + foreach ((array) $menu_items as $key => $val) { |
|
381 | + echo "<label><input type='checkbox' name='menu_items[".$key."]' value='1'".(isset($menu_perms[$key]) ? checked($menu_perms[$key], '1', false) : '')." /> ".esc_html($val)."</label><br/>"; |
|
382 | 382 | } |
383 | 383 | echo $fieldset_end; |
384 | 384 | ?> |
@@ -392,9 +392,9 @@ discard block |
||
392 | 392 | * |
393 | 393 | * @since MU |
394 | 394 | */ |
395 | - do_action( 'wpmu_options' ); ?> |
|
395 | + do_action('wpmu_options'); ?> |
|
396 | 396 | <?php submit_button(); ?> |
397 | 397 | </form> |
398 | 398 | </div> |
399 | 399 | |
400 | -<?php include( ABSPATH . 'wp-admin/admin-footer.php' ); ?> |
|
400 | +<?php include(ABSPATH.'wp-admin/admin-footer.php'); ?> |
@@ -8,134 +8,134 @@ discard block |
||
8 | 8 | */ |
9 | 9 | |
10 | 10 | /** Load WordPress Administration Bootstrap */ |
11 | -require_once( dirname( __FILE__ ) . '/admin.php' ); |
|
11 | +require_once(dirname(__FILE__).'/admin.php'); |
|
12 | 12 | |
13 | -if ( ! is_multisite() ) |
|
14 | - wp_die( __( 'Multisite support is not enabled.' ) ); |
|
13 | +if ( ! is_multisite()) |
|
14 | + wp_die(__('Multisite support is not enabled.')); |
|
15 | 15 | |
16 | -if ( ! current_user_can( 'manage_network_users' ) ) |
|
17 | - wp_die( __( 'Sorry, you are not allowed to access this page.' ), 403 ); |
|
16 | +if ( ! current_user_can('manage_network_users')) |
|
17 | + wp_die(__('Sorry, you are not allowed to access this page.'), 403); |
|
18 | 18 | |
19 | -if ( isset( $_GET['action'] ) ) { |
|
19 | +if (isset($_GET['action'])) { |
|
20 | 20 | /** This action is documented in wp-admin/network/edit.php */ |
21 | - do_action( 'wpmuadminedit' ); |
|
21 | + do_action('wpmuadminedit'); |
|
22 | 22 | |
23 | - switch ( $_GET['action'] ) { |
|
23 | + switch ($_GET['action']) { |
|
24 | 24 | case 'deleteuser': |
25 | - if ( ! current_user_can( 'manage_network_users' ) ) |
|
26 | - wp_die( __( 'Sorry, you are not allowed to access this page.' ), 403 ); |
|
25 | + if ( ! current_user_can('manage_network_users')) |
|
26 | + wp_die(__('Sorry, you are not allowed to access this page.'), 403); |
|
27 | 27 | |
28 | - check_admin_referer( 'deleteuser' ); |
|
28 | + check_admin_referer('deleteuser'); |
|
29 | 29 | |
30 | - $id = intval( $_GET['id'] ); |
|
31 | - if ( $id != '0' && $id != '1' ) { |
|
32 | - $_POST['allusers'] = array( $id ); // confirm_delete_users() can only handle with arrays |
|
33 | - $title = __( 'Users' ); |
|
30 | + $id = intval($_GET['id']); |
|
31 | + if ($id != '0' && $id != '1') { |
|
32 | + $_POST['allusers'] = array($id); // confirm_delete_users() can only handle with arrays |
|
33 | + $title = __('Users'); |
|
34 | 34 | $parent_file = 'users.php'; |
35 | - require_once( ABSPATH . 'wp-admin/admin-header.php' ); |
|
35 | + require_once(ABSPATH.'wp-admin/admin-header.php'); |
|
36 | 36 | echo '<div class="wrap">'; |
37 | - confirm_delete_users( $_POST['allusers'] ); |
|
37 | + confirm_delete_users($_POST['allusers']); |
|
38 | 38 | echo '</div>'; |
39 | - require_once( ABSPATH . 'wp-admin/admin-footer.php' ); |
|
39 | + require_once(ABSPATH.'wp-admin/admin-footer.php'); |
|
40 | 40 | } else { |
41 | - wp_redirect( network_admin_url( 'users.php' ) ); |
|
41 | + wp_redirect(network_admin_url('users.php')); |
|
42 | 42 | } |
43 | 43 | exit(); |
44 | 44 | |
45 | 45 | case 'allusers': |
46 | - if ( !current_user_can( 'manage_network_users' ) ) |
|
47 | - wp_die( __( 'Sorry, you are not allowed to access this page.' ), 403 ); |
|
46 | + if ( ! current_user_can('manage_network_users')) |
|
47 | + wp_die(__('Sorry, you are not allowed to access this page.'), 403); |
|
48 | 48 | |
49 | - if ( ( isset( $_POST['action']) || isset($_POST['action2'] ) ) && isset( $_POST['allusers'] ) ) { |
|
50 | - check_admin_referer( 'bulk-users-network' ); |
|
49 | + if ((isset($_POST['action']) || isset($_POST['action2'])) && isset($_POST['allusers'])) { |
|
50 | + check_admin_referer('bulk-users-network'); |
|
51 | 51 | |
52 | 52 | $doaction = $_POST['action'] != -1 ? $_POST['action'] : $_POST['action2']; |
53 | 53 | $userfunction = ''; |
54 | 54 | |
55 | - foreach ( (array) $_POST['allusers'] as $user_id ) { |
|
56 | - if ( !empty( $user_id ) ) { |
|
57 | - switch ( $doaction ) { |
|
55 | + foreach ((array) $_POST['allusers'] as $user_id) { |
|
56 | + if ( ! empty($user_id)) { |
|
57 | + switch ($doaction) { |
|
58 | 58 | case 'delete': |
59 | - if ( ! current_user_can( 'delete_users' ) ) |
|
60 | - wp_die( __( 'Sorry, you are not allowed to access this page.' ), 403 ); |
|
61 | - $title = __( 'Users' ); |
|
59 | + if ( ! current_user_can('delete_users')) |
|
60 | + wp_die(__('Sorry, you are not allowed to access this page.'), 403); |
|
61 | + $title = __('Users'); |
|
62 | 62 | $parent_file = 'users.php'; |
63 | - require_once( ABSPATH . 'wp-admin/admin-header.php' ); |
|
63 | + require_once(ABSPATH.'wp-admin/admin-header.php'); |
|
64 | 64 | echo '<div class="wrap">'; |
65 | - confirm_delete_users( $_POST['allusers'] ); |
|
65 | + confirm_delete_users($_POST['allusers']); |
|
66 | 66 | echo '</div>'; |
67 | - require_once( ABSPATH . 'wp-admin/admin-footer.php' ); |
|
67 | + require_once(ABSPATH.'wp-admin/admin-footer.php'); |
|
68 | 68 | exit(); |
69 | 69 | |
70 | 70 | case 'spam': |
71 | - $user = get_userdata( $user_id ); |
|
72 | - if ( is_super_admin( $user->ID ) ) |
|
73 | - wp_die( sprintf( __( 'Warning! User cannot be modified. The user %s is a network administrator.' ), esc_html( $user->user_login ) ) ); |
|
71 | + $user = get_userdata($user_id); |
|
72 | + if (is_super_admin($user->ID)) |
|
73 | + wp_die(sprintf(__('Warning! User cannot be modified. The user %s is a network administrator.'), esc_html($user->user_login))); |
|
74 | 74 | |
75 | 75 | $userfunction = 'all_spam'; |
76 | - $blogs = get_blogs_of_user( $user_id, true ); |
|
77 | - foreach ( (array) $blogs as $details ) { |
|
78 | - if ( $details->userblog_id != $current_site->blog_id ) // main blog not a spam ! |
|
79 | - update_blog_status( $details->userblog_id, 'spam', '1' ); |
|
76 | + $blogs = get_blogs_of_user($user_id, true); |
|
77 | + foreach ((array) $blogs as $details) { |
|
78 | + if ($details->userblog_id != $current_site->blog_id) // main blog not a spam ! |
|
79 | + update_blog_status($details->userblog_id, 'spam', '1'); |
|
80 | 80 | } |
81 | - update_user_status( $user_id, 'spam', '1' ); |
|
81 | + update_user_status($user_id, 'spam', '1'); |
|
82 | 82 | break; |
83 | 83 | |
84 | 84 | case 'notspam': |
85 | 85 | $userfunction = 'all_notspam'; |
86 | - $blogs = get_blogs_of_user( $user_id, true ); |
|
87 | - foreach ( (array) $blogs as $details ) |
|
88 | - update_blog_status( $details->userblog_id, 'spam', '0' ); |
|
86 | + $blogs = get_blogs_of_user($user_id, true); |
|
87 | + foreach ((array) $blogs as $details) |
|
88 | + update_blog_status($details->userblog_id, 'spam', '0'); |
|
89 | 89 | |
90 | - update_user_status( $user_id, 'spam', '0' ); |
|
90 | + update_user_status($user_id, 'spam', '0'); |
|
91 | 91 | break; |
92 | 92 | } |
93 | 93 | } |
94 | 94 | } |
95 | 95 | |
96 | - wp_safe_redirect( add_query_arg( array( 'updated' => 'true', 'action' => $userfunction ), wp_get_referer() ) ); |
|
96 | + wp_safe_redirect(add_query_arg(array('updated' => 'true', 'action' => $userfunction), wp_get_referer())); |
|
97 | 97 | } else { |
98 | - $location = network_admin_url( 'users.php' ); |
|
98 | + $location = network_admin_url('users.php'); |
|
99 | 99 | |
100 | - if ( ! empty( $_REQUEST['paged'] ) ) |
|
101 | - $location = add_query_arg( 'paged', (int) $_REQUEST['paged'], $location ); |
|
102 | - wp_redirect( $location ); |
|
100 | + if ( ! empty($_REQUEST['paged'])) |
|
101 | + $location = add_query_arg('paged', (int) $_REQUEST['paged'], $location); |
|
102 | + wp_redirect($location); |
|
103 | 103 | } |
104 | 104 | exit(); |
105 | 105 | |
106 | 106 | case 'dodelete': |
107 | - check_admin_referer( 'ms-users-delete' ); |
|
108 | - if ( ! ( current_user_can( 'manage_network_users' ) && current_user_can( 'delete_users' ) ) ) |
|
109 | - wp_die( __( 'Sorry, you are not allowed to access this page.' ), 403 ); |
|
110 | - |
|
111 | - if ( ! empty( $_POST['blog'] ) && is_array( $_POST['blog'] ) ) { |
|
112 | - foreach ( $_POST['blog'] as $id => $users ) { |
|
113 | - foreach ( $users as $blogid => $user_id ) { |
|
114 | - if ( ! current_user_can( 'delete_user', $id ) ) |
|
107 | + check_admin_referer('ms-users-delete'); |
|
108 | + if ( ! (current_user_can('manage_network_users') && current_user_can('delete_users'))) |
|
109 | + wp_die(__('Sorry, you are not allowed to access this page.'), 403); |
|
110 | + |
|
111 | + if ( ! empty($_POST['blog']) && is_array($_POST['blog'])) { |
|
112 | + foreach ($_POST['blog'] as $id => $users) { |
|
113 | + foreach ($users as $blogid => $user_id) { |
|
114 | + if ( ! current_user_can('delete_user', $id)) |
|
115 | 115 | continue; |
116 | 116 | |
117 | - if ( ! empty( $_POST['delete'] ) && 'reassign' == $_POST['delete'][$blogid][$id] ) |
|
118 | - remove_user_from_blog( $id, $blogid, $user_id ); |
|
117 | + if ( ! empty($_POST['delete']) && 'reassign' == $_POST['delete'][$blogid][$id]) |
|
118 | + remove_user_from_blog($id, $blogid, $user_id); |
|
119 | 119 | else |
120 | - remove_user_from_blog( $id, $blogid ); |
|
120 | + remove_user_from_blog($id, $blogid); |
|
121 | 121 | } |
122 | 122 | } |
123 | 123 | } |
124 | 124 | $i = 0; |
125 | - if ( is_array( $_POST['user'] ) && ! empty( $_POST['user'] ) ) |
|
126 | - foreach ( $_POST['user'] as $id ) { |
|
127 | - if ( ! current_user_can( 'delete_user', $id ) ) |
|
125 | + if (is_array($_POST['user']) && ! empty($_POST['user'])) |
|
126 | + foreach ($_POST['user'] as $id) { |
|
127 | + if ( ! current_user_can('delete_user', $id)) |
|
128 | 128 | continue; |
129 | - wpmu_delete_user( $id ); |
|
129 | + wpmu_delete_user($id); |
|
130 | 130 | $i++; |
131 | 131 | } |
132 | 132 | |
133 | - if ( $i == 1 ) |
|
133 | + if ($i == 1) |
|
134 | 134 | $deletefunction = 'delete'; |
135 | 135 | else |
136 | 136 | $deletefunction = 'all_delete'; |
137 | 137 | |
138 | - wp_redirect( add_query_arg( array( 'updated' => 'true', 'action' => $deletefunction ), network_admin_url( 'users.php' ) ) ); |
|
138 | + wp_redirect(add_query_arg(array('updated' => 'true', 'action' => $deletefunction), network_admin_url('users.php'))); |
|
139 | 139 | exit(); |
140 | 140 | } |
141 | 141 | } |
@@ -143,62 +143,62 @@ discard block |
||
143 | 143 | $wp_list_table = _get_list_table('WP_MS_Users_List_Table'); |
144 | 144 | $pagenum = $wp_list_table->get_pagenum(); |
145 | 145 | $wp_list_table->prepare_items(); |
146 | -$total_pages = $wp_list_table->get_pagination_arg( 'total_pages' ); |
|
146 | +$total_pages = $wp_list_table->get_pagination_arg('total_pages'); |
|
147 | 147 | |
148 | -if ( $pagenum > $total_pages && $total_pages > 0 ) { |
|
149 | - wp_redirect( add_query_arg( 'paged', $total_pages ) ); |
|
148 | +if ($pagenum > $total_pages && $total_pages > 0) { |
|
149 | + wp_redirect(add_query_arg('paged', $total_pages)); |
|
150 | 150 | exit; |
151 | 151 | } |
152 | -$title = __( 'Users' ); |
|
152 | +$title = __('Users'); |
|
153 | 153 | $parent_file = 'users.php'; |
154 | 154 | |
155 | -add_screen_option( 'per_page' ); |
|
155 | +add_screen_option('per_page'); |
|
156 | 156 | |
157 | -get_current_screen()->add_help_tab( array( |
|
157 | +get_current_screen()->add_help_tab(array( |
|
158 | 158 | 'id' => 'overview', |
159 | 159 | 'title' => __('Overview'), |
160 | 160 | 'content' => |
161 | - '<p>' . __('This table shows all users across the network and the sites to which they are assigned.') . '</p>' . |
|
162 | - '<p>' . __('Hover over any user on the list to make the edit links appear. The Edit link on the left will take you to their Edit User profile page; the Edit link on the right by any site name goes to an Edit Site screen for that site.') . '</p>' . |
|
163 | - '<p>' . __('You can also go to the user’s profile page by clicking on the individual username.') . '</p>' . |
|
164 | - '<p>' . __( 'You can sort the table by clicking on any of the table headings and switch between list and excerpt views by using the icons above the users list.' ) . '</p>' . |
|
165 | - '<p>' . __('The bulk action will permanently delete selected users, or mark/unmark those selected as spam. Spam users will have posts removed and will be unable to sign up again with the same email addresses.') . '</p>' . |
|
166 | - '<p>' . __('You can make an existing user an additional super admin by going to the Edit User profile page and checking the box to grant that privilege.') . '</p>' |
|
167 | -) ); |
|
161 | + '<p>'.__('This table shows all users across the network and the sites to which they are assigned.').'</p>'. |
|
162 | + '<p>'.__('Hover over any user on the list to make the edit links appear. The Edit link on the left will take you to their Edit User profile page; the Edit link on the right by any site name goes to an Edit Site screen for that site.').'</p>'. |
|
163 | + '<p>'.__('You can also go to the user’s profile page by clicking on the individual username.').'</p>'. |
|
164 | + '<p>'.__('You can sort the table by clicking on any of the table headings and switch between list and excerpt views by using the icons above the users list.').'</p>'. |
|
165 | + '<p>'.__('The bulk action will permanently delete selected users, or mark/unmark those selected as spam. Spam users will have posts removed and will be unable to sign up again with the same email addresses.').'</p>'. |
|
166 | + '<p>'.__('You can make an existing user an additional super admin by going to the Edit User profile page and checking the box to grant that privilege.').'</p>' |
|
167 | +)); |
|
168 | 168 | |
169 | 169 | get_current_screen()->set_help_sidebar( |
170 | - '<p><strong>' . __('For more information:') . '</strong></p>' . |
|
171 | - '<p>' . __('<a href="https://codex.wordpress.org/Network_Admin_Users_Screen" target="_blank">Documentation on Network Users</a>') . '</p>' . |
|
172 | - '<p>' . __('<a href="https://wordpress.org/support/forum/multisite/" target="_blank">Support Forums</a>') . '</p>' |
|
170 | + '<p><strong>'.__('For more information:').'</strong></p>'. |
|
171 | + '<p>'.__('<a href="https://codex.wordpress.org/Network_Admin_Users_Screen" target="_blank">Documentation on Network Users</a>').'</p>'. |
|
172 | + '<p>'.__('<a href="https://wordpress.org/support/forum/multisite/" target="_blank">Support Forums</a>').'</p>' |
|
173 | 173 | ); |
174 | 174 | |
175 | -get_current_screen()->set_screen_reader_content( array( |
|
176 | - 'heading_views' => __( 'Filter users list' ), |
|
177 | - 'heading_pagination' => __( 'Users list navigation' ), |
|
178 | - 'heading_list' => __( 'Users list' ), |
|
179 | -) ); |
|
175 | +get_current_screen()->set_screen_reader_content(array( |
|
176 | + 'heading_views' => __('Filter users list'), |
|
177 | + 'heading_pagination' => __('Users list navigation'), |
|
178 | + 'heading_list' => __('Users list'), |
|
179 | +)); |
|
180 | 180 | |
181 | -require_once( ABSPATH . 'wp-admin/admin-header.php' ); |
|
181 | +require_once(ABSPATH.'wp-admin/admin-header.php'); |
|
182 | 182 | |
183 | -if ( isset( $_REQUEST['updated'] ) && $_REQUEST['updated'] == 'true' && ! empty( $_REQUEST['action'] ) ) { |
|
183 | +if (isset($_REQUEST['updated']) && $_REQUEST['updated'] == 'true' && ! empty($_REQUEST['action'])) { |
|
184 | 184 | ?> |
185 | 185 | <div id="message" class="updated notice is-dismissible"><p> |
186 | 186 | <?php |
187 | - switch ( $_REQUEST['action'] ) { |
|
187 | + switch ($_REQUEST['action']) { |
|
188 | 188 | case 'delete': |
189 | - _e( 'User deleted.' ); |
|
189 | + _e('User deleted.'); |
|
190 | 190 | break; |
191 | 191 | case 'all_spam': |
192 | - _e( 'Users marked as spam.' ); |
|
192 | + _e('Users marked as spam.'); |
|
193 | 193 | break; |
194 | 194 | case 'all_notspam': |
195 | - _e( 'Users removed from spam.' ); |
|
195 | + _e('Users removed from spam.'); |
|
196 | 196 | break; |
197 | 197 | case 'all_delete': |
198 | - _e( 'Users deleted.' ); |
|
198 | + _e('Users deleted.'); |
|
199 | 199 | break; |
200 | 200 | case 'add': |
201 | - _e( 'User added.' ); |
|
201 | + _e('User added.'); |
|
202 | 202 | break; |
203 | 203 | } |
204 | 204 | ?> |
@@ -207,14 +207,14 @@ discard block |
||
207 | 207 | } |
208 | 208 | ?> |
209 | 209 | <div class="wrap"> |
210 | - <h1><?php esc_html_e( 'Users' ); |
|
211 | - if ( current_user_can( 'create_users') ) : ?> |
|
212 | - <a href="<?php echo network_admin_url('user-new.php'); ?>" class="page-title-action"><?php echo esc_html_x( 'Add New', 'user' ); ?></a><?php |
|
210 | + <h1><?php esc_html_e('Users'); |
|
211 | + if (current_user_can('create_users')) : ?> |
|
212 | + <a href="<?php echo network_admin_url('user-new.php'); ?>" class="page-title-action"><?php echo esc_html_x('Add New', 'user'); ?></a><?php |
|
213 | 213 | endif; |
214 | 214 | |
215 | - if ( strlen( $usersearch ) ) { |
|
215 | + if (strlen($usersearch)) { |
|
216 | 216 | /* translators: %s: search keywords */ |
217 | - printf( '<span class="subtitle">' . __( 'Search results for “%s”' ) . '</span>', esc_html( $usersearch ) ); |
|
217 | + printf('<span class="subtitle">'.__('Search results for “%s”').'</span>', esc_html($usersearch)); |
|
218 | 218 | } |
219 | 219 | ?> |
220 | 220 | </h1> |
@@ -222,7 +222,7 @@ discard block |
||
222 | 222 | <?php $wp_list_table->views(); ?> |
223 | 223 | |
224 | 224 | <form method="get" class="search-form"> |
225 | - <?php $wp_list_table->search_box( __( 'Search Users' ), 'all-user' ); ?> |
|
225 | + <?php $wp_list_table->search_box(__('Search Users'), 'all-user'); ?> |
|
226 | 226 | </form> |
227 | 227 | |
228 | 228 | <form id="form-user-list" action="users.php?action=allusers" method="post"> |
@@ -230,4 +230,4 @@ discard block |
||
230 | 230 | </form> |
231 | 231 | </div> |
232 | 232 | |
233 | -<?php require_once( ABSPATH . 'wp-admin/admin-footer.php' ); ?> |
|
233 | +<?php require_once(ABSPATH.'wp-admin/admin-footer.php'); ?> |
@@ -10,11 +10,13 @@ discard block |
||
10 | 10 | /** Load WordPress Administration Bootstrap */ |
11 | 11 | require_once( dirname( __FILE__ ) . '/admin.php' ); |
12 | 12 | |
13 | -if ( ! is_multisite() ) |
|
13 | +if ( ! is_multisite() ) { |
|
14 | 14 | wp_die( __( 'Multisite support is not enabled.' ) ); |
15 | +} |
|
15 | 16 | |
16 | -if ( ! current_user_can( 'manage_network_users' ) ) |
|
17 | +if ( ! current_user_can( 'manage_network_users' ) ) { |
|
17 | 18 | wp_die( __( 'Sorry, you are not allowed to access this page.' ), 403 ); |
19 | +} |
|
18 | 20 | |
19 | 21 | if ( isset( $_GET['action'] ) ) { |
20 | 22 | /** This action is documented in wp-admin/network/edit.php */ |
@@ -22,8 +24,9 @@ discard block |
||
22 | 24 | |
23 | 25 | switch ( $_GET['action'] ) { |
24 | 26 | case 'deleteuser': |
25 | - if ( ! current_user_can( 'manage_network_users' ) ) |
|
26 | - wp_die( __( 'Sorry, you are not allowed to access this page.' ), 403 ); |
|
27 | + if ( ! current_user_can( 'manage_network_users' ) ) { |
|
28 | + wp_die( __( 'Sorry, you are not allowed to access this page.' ), 403 ); |
|
29 | + } |
|
27 | 30 | |
28 | 31 | check_admin_referer( 'deleteuser' ); |
29 | 32 | |
@@ -43,8 +46,9 @@ discard block |
||
43 | 46 | exit(); |
44 | 47 | |
45 | 48 | case 'allusers': |
46 | - if ( !current_user_can( 'manage_network_users' ) ) |
|
47 | - wp_die( __( 'Sorry, you are not allowed to access this page.' ), 403 ); |
|
49 | + if ( !current_user_can( 'manage_network_users' ) ) { |
|
50 | + wp_die( __( 'Sorry, you are not allowed to access this page.' ), 403 ); |
|
51 | + } |
|
48 | 52 | |
49 | 53 | if ( ( isset( $_POST['action']) || isset($_POST['action2'] ) ) && isset( $_POST['allusers'] ) ) { |
50 | 54 | check_admin_referer( 'bulk-users-network' ); |
@@ -56,8 +60,9 @@ discard block |
||
56 | 60 | if ( !empty( $user_id ) ) { |
57 | 61 | switch ( $doaction ) { |
58 | 62 | case 'delete': |
59 | - if ( ! current_user_can( 'delete_users' ) ) |
|
60 | - wp_die( __( 'Sorry, you are not allowed to access this page.' ), 403 ); |
|
63 | + if ( ! current_user_can( 'delete_users' ) ) { |
|
64 | + wp_die( __( 'Sorry, you are not allowed to access this page.' ), 403 ); |
|
65 | + } |
|
61 | 66 | $title = __( 'Users' ); |
62 | 67 | $parent_file = 'users.php'; |
63 | 68 | require_once( ABSPATH . 'wp-admin/admin-header.php' ); |
@@ -69,14 +74,17 @@ discard block |
||
69 | 74 | |
70 | 75 | case 'spam': |
71 | 76 | $user = get_userdata( $user_id ); |
72 | - if ( is_super_admin( $user->ID ) ) |
|
73 | - wp_die( sprintf( __( 'Warning! User cannot be modified. The user %s is a network administrator.' ), esc_html( $user->user_login ) ) ); |
|
77 | + if ( is_super_admin( $user->ID ) ) { |
|
78 | + wp_die( sprintf( __( 'Warning! User cannot be modified. The user %s is a network administrator.' ), esc_html( $user->user_login ) ) ); |
|
79 | + } |
|
74 | 80 | |
75 | 81 | $userfunction = 'all_spam'; |
76 | 82 | $blogs = get_blogs_of_user( $user_id, true ); |
77 | 83 | foreach ( (array) $blogs as $details ) { |
78 | - if ( $details->userblog_id != $current_site->blog_id ) // main blog not a spam ! |
|
84 | + if ( $details->userblog_id != $current_site->blog_id ) { |
|
85 | + // main blog not a spam ! |
|
79 | 86 | update_blog_status( $details->userblog_id, 'spam', '1' ); |
87 | + } |
|
80 | 88 | } |
81 | 89 | update_user_status( $user_id, 'spam', '1' ); |
82 | 90 | break; |
@@ -84,8 +92,9 @@ discard block |
||
84 | 92 | case 'notspam': |
85 | 93 | $userfunction = 'all_notspam'; |
86 | 94 | $blogs = get_blogs_of_user( $user_id, true ); |
87 | - foreach ( (array) $blogs as $details ) |
|
88 | - update_blog_status( $details->userblog_id, 'spam', '0' ); |
|
95 | + foreach ( (array) $blogs as $details ) { |
|
96 | + update_blog_status( $details->userblog_id, 'spam', '0' ); |
|
97 | + } |
|
89 | 98 | |
90 | 99 | update_user_status( $user_id, 'spam', '0' ); |
91 | 100 | break; |
@@ -97,43 +106,49 @@ discard block |
||
97 | 106 | } else { |
98 | 107 | $location = network_admin_url( 'users.php' ); |
99 | 108 | |
100 | - if ( ! empty( $_REQUEST['paged'] ) ) |
|
101 | - $location = add_query_arg( 'paged', (int) $_REQUEST['paged'], $location ); |
|
109 | + if ( ! empty( $_REQUEST['paged'] ) ) { |
|
110 | + $location = add_query_arg( 'paged', (int) $_REQUEST['paged'], $location ); |
|
111 | + } |
|
102 | 112 | wp_redirect( $location ); |
103 | 113 | } |
104 | 114 | exit(); |
105 | 115 | |
106 | 116 | case 'dodelete': |
107 | 117 | check_admin_referer( 'ms-users-delete' ); |
108 | - if ( ! ( current_user_can( 'manage_network_users' ) && current_user_can( 'delete_users' ) ) ) |
|
109 | - wp_die( __( 'Sorry, you are not allowed to access this page.' ), 403 ); |
|
118 | + if ( ! ( current_user_can( 'manage_network_users' ) && current_user_can( 'delete_users' ) ) ) { |
|
119 | + wp_die( __( 'Sorry, you are not allowed to access this page.' ), 403 ); |
|
120 | + } |
|
110 | 121 | |
111 | 122 | if ( ! empty( $_POST['blog'] ) && is_array( $_POST['blog'] ) ) { |
112 | 123 | foreach ( $_POST['blog'] as $id => $users ) { |
113 | 124 | foreach ( $users as $blogid => $user_id ) { |
114 | - if ( ! current_user_can( 'delete_user', $id ) ) |
|
115 | - continue; |
|
125 | + if ( ! current_user_can( 'delete_user', $id ) ) { |
|
126 | + continue; |
|
127 | + } |
|
116 | 128 | |
117 | - if ( ! empty( $_POST['delete'] ) && 'reassign' == $_POST['delete'][$blogid][$id] ) |
|
118 | - remove_user_from_blog( $id, $blogid, $user_id ); |
|
119 | - else |
|
120 | - remove_user_from_blog( $id, $blogid ); |
|
129 | + if ( ! empty( $_POST['delete'] ) && 'reassign' == $_POST['delete'][$blogid][$id] ) { |
|
130 | + remove_user_from_blog( $id, $blogid, $user_id ); |
|
131 | + } else { |
|
132 | + remove_user_from_blog( $id, $blogid ); |
|
133 | + } |
|
121 | 134 | } |
122 | 135 | } |
123 | 136 | } |
124 | 137 | $i = 0; |
125 | - if ( is_array( $_POST['user'] ) && ! empty( $_POST['user'] ) ) |
|
126 | - foreach ( $_POST['user'] as $id ) { |
|
138 | + if ( is_array( $_POST['user'] ) && ! empty( $_POST['user'] ) ) { |
|
139 | + foreach ( $_POST['user'] as $id ) { |
|
127 | 140 | if ( ! current_user_can( 'delete_user', $id ) ) |
128 | 141 | continue; |
142 | + } |
|
129 | 143 | wpmu_delete_user( $id ); |
130 | 144 | $i++; |
131 | 145 | } |
132 | 146 | |
133 | - if ( $i == 1 ) |
|
134 | - $deletefunction = 'delete'; |
|
135 | - else |
|
136 | - $deletefunction = 'all_delete'; |
|
147 | + if ( $i == 1 ) { |
|
148 | + $deletefunction = 'delete'; |
|
149 | + } else { |
|
150 | + $deletefunction = 'all_delete'; |
|
151 | + } |
|
137 | 152 | |
138 | 153 | wp_redirect( add_query_arg( array( 'updated' => 'true', 'action' => $deletefunction ), network_admin_url( 'users.php' ) ) ); |
139 | 154 | exit(); |
@@ -8,51 +8,51 @@ discard block |
||
8 | 8 | */ |
9 | 9 | |
10 | 10 | /** Load WordPress Administration Bootstrap */ |
11 | -require_once( dirname( __FILE__ ) . '/admin.php' ); |
|
11 | +require_once(dirname(__FILE__).'/admin.php'); |
|
12 | 12 | |
13 | 13 | /** WordPress Translation Install API */ |
14 | -require_once( ABSPATH . 'wp-admin/includes/translation-install.php' ); |
|
14 | +require_once(ABSPATH.'wp-admin/includes/translation-install.php'); |
|
15 | 15 | |
16 | -if ( ! is_multisite() ) |
|
17 | - wp_die( __( 'Multisite support is not enabled.' ) ); |
|
16 | +if ( ! is_multisite()) |
|
17 | + wp_die(__('Multisite support is not enabled.')); |
|
18 | 18 | |
19 | -if ( ! current_user_can( 'manage_sites' ) ) |
|
20 | - wp_die( __( 'Sorry, you are not allowed to add sites to this network.' ) ); |
|
19 | +if ( ! current_user_can('manage_sites')) |
|
20 | + wp_die(__('Sorry, you are not allowed to add sites to this network.')); |
|
21 | 21 | |
22 | -get_current_screen()->add_help_tab( array( |
|
22 | +get_current_screen()->add_help_tab(array( |
|
23 | 23 | 'id' => 'overview', |
24 | 24 | 'title' => __('Overview'), |
25 | 25 | 'content' => |
26 | - '<p>' . __('This screen is for Super Admins to add new sites to the network. This is not affected by the registration settings.') . '</p>' . |
|
27 | - '<p>' . __('If the admin email for the new site does not exist in the database, a new user will also be created.') . '</p>' |
|
28 | -) ); |
|
26 | + '<p>'.__('This screen is for Super Admins to add new sites to the network. This is not affected by the registration settings.').'</p>'. |
|
27 | + '<p>'.__('If the admin email for the new site does not exist in the database, a new user will also be created.').'</p>' |
|
28 | +)); |
|
29 | 29 | |
30 | 30 | get_current_screen()->set_help_sidebar( |
31 | - '<p><strong>' . __('For more information:') . '</strong></p>' . |
|
32 | - '<p>' . __('<a href="https://codex.wordpress.org/Network_Admin_Sites_Screen" target="_blank">Documentation on Site Management</a>') . '</p>' . |
|
33 | - '<p>' . __('<a href="https://wordpress.org/support/forum/multisite/" target="_blank">Support Forums</a>') . '</p>' |
|
31 | + '<p><strong>'.__('For more information:').'</strong></p>'. |
|
32 | + '<p>'.__('<a href="https://codex.wordpress.org/Network_Admin_Sites_Screen" target="_blank">Documentation on Site Management</a>').'</p>'. |
|
33 | + '<p>'.__('<a href="https://wordpress.org/support/forum/multisite/" target="_blank">Support Forums</a>').'</p>' |
|
34 | 34 | ); |
35 | 35 | |
36 | -if ( isset($_REQUEST['action']) && 'add-site' == $_REQUEST['action'] ) { |
|
37 | - check_admin_referer( 'add-blog', '_wpnonce_add-blog' ); |
|
36 | +if (isset($_REQUEST['action']) && 'add-site' == $_REQUEST['action']) { |
|
37 | + check_admin_referer('add-blog', '_wpnonce_add-blog'); |
|
38 | 38 | |
39 | - if ( ! is_array( $_POST['blog'] ) ) |
|
40 | - wp_die( __( 'Can’t create an empty site.' ) ); |
|
39 | + if ( ! is_array($_POST['blog'])) |
|
40 | + wp_die(__('Can’t create an empty site.')); |
|
41 | 41 | |
42 | 42 | $blog = $_POST['blog']; |
43 | 43 | $domain = ''; |
44 | - if ( preg_match( '|^([a-zA-Z0-9-])+$|', $blog['domain'] ) ) |
|
45 | - $domain = strtolower( $blog['domain'] ); |
|
44 | + if (preg_match('|^([a-zA-Z0-9-])+$|', $blog['domain'])) |
|
45 | + $domain = strtolower($blog['domain']); |
|
46 | 46 | |
47 | 47 | // If not a subdomain install, make sure the domain isn't a reserved word |
48 | - if ( ! is_subdomain_install() ) { |
|
48 | + if ( ! is_subdomain_install()) { |
|
49 | 49 | $subdirectory_reserved_names = get_subdirectory_reserved_names(); |
50 | 50 | |
51 | - if ( in_array( $domain, $subdirectory_reserved_names ) ) { |
|
51 | + if (in_array($domain, $subdirectory_reserved_names)) { |
|
52 | 52 | wp_die( |
53 | 53 | /* translators: %s: reserved names list */ |
54 | - sprintf( __( 'The following words are reserved for use by WordPress functions and cannot be used as blog names: %s' ), |
|
55 | - '<code>' . implode( '</code>, <code>', $subdirectory_reserved_names ) . '</code>' |
|
54 | + sprintf(__('The following words are reserved for use by WordPress functions and cannot be used as blog names: %s'), |
|
55 | + '<code>'.implode('</code>, <code>', $subdirectory_reserved_names).'</code>' |
|
56 | 56 | ) |
57 | 57 | ); |
58 | 58 | } |
@@ -65,36 +65,36 @@ discard block |
||
65 | 65 | ); |
66 | 66 | |
67 | 67 | // Handle translation install for the new site. |
68 | - if ( ! empty( $_POST['WPLANG'] ) && wp_can_install_language_pack() ) { |
|
69 | - $language = wp_download_language_pack( wp_unslash( $_POST['WPLANG'] ) ); |
|
70 | - if ( $language ) { |
|
68 | + if ( ! empty($_POST['WPLANG']) && wp_can_install_language_pack()) { |
|
69 | + $language = wp_download_language_pack(wp_unslash($_POST['WPLANG'])); |
|
70 | + if ($language) { |
|
71 | 71 | $meta['WPLANG'] = $language; |
72 | 72 | } |
73 | 73 | } |
74 | 74 | |
75 | - if ( empty( $domain ) ) |
|
76 | - wp_die( __( 'Missing or invalid site address.' ) ); |
|
75 | + if (empty($domain)) |
|
76 | + wp_die(__('Missing or invalid site address.')); |
|
77 | 77 | |
78 | - if ( isset( $blog['email'] ) && '' === trim( $blog['email'] ) ) { |
|
79 | - wp_die( __( 'Missing email address.' ) ); |
|
78 | + if (isset($blog['email']) && '' === trim($blog['email'])) { |
|
79 | + wp_die(__('Missing email address.')); |
|
80 | 80 | } |
81 | 81 | |
82 | - $email = sanitize_email( $blog['email'] ); |
|
83 | - if ( ! is_email( $email ) ) { |
|
84 | - wp_die( __( 'Invalid email address.' ) ); |
|
82 | + $email = sanitize_email($blog['email']); |
|
83 | + if ( ! is_email($email)) { |
|
84 | + wp_die(__('Invalid email address.')); |
|
85 | 85 | } |
86 | 86 | |
87 | - if ( is_subdomain_install() ) { |
|
88 | - $newdomain = $domain . '.' . preg_replace( '|^www\.|', '', $current_site->domain ); |
|
87 | + if (is_subdomain_install()) { |
|
88 | + $newdomain = $domain.'.'.preg_replace('|^www\.|', '', $current_site->domain); |
|
89 | 89 | $path = $current_site->path; |
90 | 90 | } else { |
91 | 91 | $newdomain = $current_site->domain; |
92 | - $path = $current_site->path . $domain . '/'; |
|
92 | + $path = $current_site->path.$domain.'/'; |
|
93 | 93 | } |
94 | 94 | |
95 | 95 | $password = 'N/A'; |
96 | 96 | $user_id = email_exists($email); |
97 | - if ( !$user_id ) { // Create a new user with a random password |
|
97 | + if ( ! $user_id) { // Create a new user with a random password |
|
98 | 98 | /** |
99 | 99 | * Fires immediately before a new user is created via the network site-new.php page. |
100 | 100 | * |
@@ -102,16 +102,16 @@ discard block |
||
102 | 102 | * |
103 | 103 | * @param string $email Email of the non-existent user. |
104 | 104 | */ |
105 | - do_action( 'pre_network_site_new_created_user', $email ); |
|
105 | + do_action('pre_network_site_new_created_user', $email); |
|
106 | 106 | |
107 | - $user_id = username_exists( $domain ); |
|
108 | - if ( $user_id ) { |
|
109 | - wp_die( __( 'The domain or path entered conflicts with an existing username.' ) ); |
|
107 | + $user_id = username_exists($domain); |
|
108 | + if ($user_id) { |
|
109 | + wp_die(__('The domain or path entered conflicts with an existing username.')); |
|
110 | 110 | } |
111 | - $password = wp_generate_password( 12, false ); |
|
112 | - $user_id = wpmu_create_user( $domain, $password, $email ); |
|
113 | - if ( false === $user_id ) { |
|
114 | - wp_die( __( 'There was an error creating the user.' ) ); |
|
111 | + $password = wp_generate_password(12, false); |
|
112 | + $user_id = wpmu_create_user($domain, $password, $email); |
|
113 | + if (false === $user_id) { |
|
114 | + wp_die(__('There was an error creating the user.')); |
|
115 | 115 | } |
116 | 116 | |
117 | 117 | /** |
@@ -121,129 +121,129 @@ discard block |
||
121 | 121 | * |
122 | 122 | * @param int $user_id ID of the newly created user. |
123 | 123 | */ |
124 | - do_action( 'network_site_new_created_user', $user_id ); |
|
124 | + do_action('network_site_new_created_user', $user_id); |
|
125 | 125 | } |
126 | 126 | |
127 | 127 | $wpdb->hide_errors(); |
128 | - $id = wpmu_create_blog( $newdomain, $path, $title, $user_id, $meta, $current_site->id ); |
|
128 | + $id = wpmu_create_blog($newdomain, $path, $title, $user_id, $meta, $current_site->id); |
|
129 | 129 | $wpdb->show_errors(); |
130 | - if ( ! is_wp_error( $id ) ) { |
|
131 | - if ( ! is_super_admin( $user_id ) && !get_user_option( 'primary_blog', $user_id ) ) { |
|
132 | - update_user_option( $user_id, 'primary_blog', $id, true ); |
|
130 | + if ( ! is_wp_error($id)) { |
|
131 | + if ( ! is_super_admin($user_id) && ! get_user_option('primary_blog', $user_id)) { |
|
132 | + update_user_option($user_id, 'primary_blog', $id, true); |
|
133 | 133 | } |
134 | 134 | |
135 | 135 | wp_mail( |
136 | - get_site_option( 'admin_email' ), |
|
136 | + get_site_option('admin_email'), |
|
137 | 137 | sprintf( |
138 | 138 | /* translators: %s: network name */ |
139 | - __( '[%s] New Site Created' ), |
|
139 | + __('[%s] New Site Created'), |
|
140 | 140 | $current_site->site_name |
141 | 141 | ), |
142 | 142 | sprintf( |
143 | 143 | /* translators: 1: user login, 2: site url, 3: site name/title */ |
144 | - __( 'New site created by %1$s |
|
144 | + __('New site created by %1$s |
|
145 | 145 | |
146 | 146 | Address: %2$s |
147 | 147 | Name: %3$s' ), |
148 | 148 | $current_user->user_login, |
149 | - get_site_url( $id ), |
|
150 | - wp_unslash( $title ) |
|
149 | + get_site_url($id), |
|
150 | + wp_unslash($title) |
|
151 | 151 | ), |
152 | 152 | sprintf( |
153 | 153 | 'From: "%1$s" <%2$s>', |
154 | - _x( 'Site Admin', 'email "From" field' ), |
|
155 | - get_site_option( 'admin_email' ) |
|
154 | + _x('Site Admin', 'email "From" field'), |
|
155 | + get_site_option('admin_email') |
|
156 | 156 | ) |
157 | 157 | ); |
158 | - wpmu_welcome_notification( $id, $user_id, $password, $title, array( 'public' => 1 ) ); |
|
159 | - wp_redirect( add_query_arg( array( 'update' => 'added', 'id' => $id ), 'site-new.php' ) ); |
|
158 | + wpmu_welcome_notification($id, $user_id, $password, $title, array('public' => 1)); |
|
159 | + wp_redirect(add_query_arg(array('update' => 'added', 'id' => $id), 'site-new.php')); |
|
160 | 160 | exit; |
161 | 161 | } else { |
162 | - wp_die( $id->get_error_message() ); |
|
162 | + wp_die($id->get_error_message()); |
|
163 | 163 | } |
164 | 164 | } |
165 | 165 | |
166 | -if ( isset($_GET['update']) ) { |
|
166 | +if (isset($_GET['update'])) { |
|
167 | 167 | $messages = array(); |
168 | - if ( 'added' == $_GET['update'] ) |
|
168 | + if ('added' == $_GET['update']) |
|
169 | 169 | $messages[] = sprintf( |
170 | 170 | /* translators: 1: dashboard url, 2: network admin edit url */ |
171 | - __( 'Site added. <a href="%1$s">Visit Dashboard</a> or <a href="%2$s">Edit Site</a>' ), |
|
172 | - esc_url( get_admin_url( absint( $_GET['id'] ) ) ), |
|
173 | - network_admin_url( 'site-info.php?id=' . absint( $_GET['id'] ) ) |
|
171 | + __('Site added. <a href="%1$s">Visit Dashboard</a> or <a href="%2$s">Edit Site</a>'), |
|
172 | + esc_url(get_admin_url(absint($_GET['id']))), |
|
173 | + network_admin_url('site-info.php?id='.absint($_GET['id'])) |
|
174 | 174 | ); |
175 | 175 | } |
176 | 176 | |
177 | 177 | $title = __('Add New Site'); |
178 | 178 | $parent_file = 'sites.php'; |
179 | 179 | |
180 | -wp_enqueue_script( 'user-suggest' ); |
|
180 | +wp_enqueue_script('user-suggest'); |
|
181 | 181 | |
182 | -require( ABSPATH . 'wp-admin/admin-header.php' ); |
|
182 | +require(ABSPATH.'wp-admin/admin-header.php'); |
|
183 | 183 | |
184 | 184 | ?> |
185 | 185 | |
186 | 186 | <div class="wrap"> |
187 | -<h1 id="add-new-site"><?php _e( 'Add New Site' ); ?></h1> |
|
187 | +<h1 id="add-new-site"><?php _e('Add New Site'); ?></h1> |
|
188 | 188 | <?php |
189 | -if ( ! empty( $messages ) ) { |
|
190 | - foreach ( $messages as $msg ) |
|
191 | - echo '<div id="message" class="updated notice is-dismissible"><p>' . $msg . '</p></div>'; |
|
189 | +if ( ! empty($messages)) { |
|
190 | + foreach ($messages as $msg) |
|
191 | + echo '<div id="message" class="updated notice is-dismissible"><p>'.$msg.'</p></div>'; |
|
192 | 192 | } ?> |
193 | -<form method="post" action="<?php echo network_admin_url( 'site-new.php?action=add-site' ); ?>" novalidate="novalidate"> |
|
194 | -<?php wp_nonce_field( 'add-blog', '_wpnonce_add-blog' ) ?> |
|
193 | +<form method="post" action="<?php echo network_admin_url('site-new.php?action=add-site'); ?>" novalidate="novalidate"> |
|
194 | +<?php wp_nonce_field('add-blog', '_wpnonce_add-blog') ?> |
|
195 | 195 | <table class="form-table"> |
196 | 196 | <tr class="form-field form-required"> |
197 | - <th scope="row"><label for="site-address"><?php _e( 'Site Address (URL)' ) ?></label></th> |
|
197 | + <th scope="row"><label for="site-address"><?php _e('Site Address (URL)') ?></label></th> |
|
198 | 198 | <td> |
199 | - <?php if ( is_subdomain_install() ) { ?> |
|
200 | - <input name="blog[domain]" type="text" class="regular-text" id="site-address" aria-describedby="site-address-desc" autocapitalize="none" autocorrect="off"/><span class="no-break">.<?php echo preg_replace( '|^www\.|', '', $current_site->domain ); ?></span> |
|
199 | + <?php if (is_subdomain_install()) { ?> |
|
200 | + <input name="blog[domain]" type="text" class="regular-text" id="site-address" aria-describedby="site-address-desc" autocapitalize="none" autocorrect="off"/><span class="no-break">.<?php echo preg_replace('|^www\.|', '', $current_site->domain); ?></span> |
|
201 | 201 | <?php } else { |
202 | - echo $current_site->domain . $current_site->path ?><input name="blog[domain]" type="text" class="regular-text" id="site-address" aria-describedby="site-address-desc" autocapitalize="none" autocorrect="off" /> |
|
202 | + echo $current_site->domain.$current_site->path ?><input name="blog[domain]" type="text" class="regular-text" id="site-address" aria-describedby="site-address-desc" autocapitalize="none" autocorrect="off" /> |
|
203 | 203 | <?php } |
204 | - echo '<p class="description" id="site-address-desc">' . __( 'Only lowercase letters (a-z), numbers, and hyphens are allowed.' ) . '</p>'; |
|
204 | + echo '<p class="description" id="site-address-desc">'.__('Only lowercase letters (a-z), numbers, and hyphens are allowed.').'</p>'; |
|
205 | 205 | ?> |
206 | 206 | </td> |
207 | 207 | </tr> |
208 | 208 | <tr class="form-field form-required"> |
209 | - <th scope="row"><label for="site-title"><?php _e( 'Site Title' ) ?></label></th> |
|
209 | + <th scope="row"><label for="site-title"><?php _e('Site Title') ?></label></th> |
|
210 | 210 | <td><input name="blog[title]" type="text" class="regular-text" id="site-title" /></td> |
211 | 211 | </tr> |
212 | 212 | <?php |
213 | 213 | $languages = get_available_languages(); |
214 | 214 | $translations = wp_get_available_translations(); |
215 | - if ( ! empty( $languages ) || ! empty( $translations ) ) : |
|
215 | + if ( ! empty($languages) || ! empty($translations)) : |
|
216 | 216 | ?> |
217 | 217 | <tr class="form-field form-required"> |
218 | - <th scope="row"><label for="site-language"><?php _e( 'Site Language' ); ?></label></th> |
|
218 | + <th scope="row"><label for="site-language"><?php _e('Site Language'); ?></label></th> |
|
219 | 219 | <td> |
220 | 220 | <?php |
221 | 221 | // Network default. |
222 | - $lang = get_site_option( 'WPLANG' ); |
|
222 | + $lang = get_site_option('WPLANG'); |
|
223 | 223 | |
224 | 224 | // Use English if the default isn't available. |
225 | - if ( ! in_array( $lang, $languages ) ) { |
|
225 | + if ( ! in_array($lang, $languages)) { |
|
226 | 226 | $lang = ''; |
227 | 227 | } |
228 | 228 | |
229 | - wp_dropdown_languages( array( |
|
229 | + wp_dropdown_languages(array( |
|
230 | 230 | 'name' => 'WPLANG', |
231 | 231 | 'id' => 'site-language', |
232 | 232 | 'selected' => $lang, |
233 | 233 | 'languages' => $languages, |
234 | 234 | 'translations' => $translations, |
235 | 235 | 'show_available_translations' => wp_can_install_language_pack(), |
236 | - ) ); |
|
236 | + )); |
|
237 | 237 | ?> |
238 | 238 | </td> |
239 | 239 | </tr> |
240 | 240 | <?php endif; // Languages. ?> |
241 | 241 | <tr class="form-field form-required"> |
242 | - <th scope="row"><label for="admin-email"><?php _e( 'Admin Email' ) ?></label></th> |
|
242 | + <th scope="row"><label for="admin-email"><?php _e('Admin Email') ?></label></th> |
|
243 | 243 | <td><input name="blog[email]" type="email" class="regular-text wp-suggest-user" id="admin-email" data-autocomplete-type="search" data-autocomplete-field="user_email" /></td> |
244 | 244 | </tr> |
245 | 245 | <tr class="form-field"> |
246 | - <td colspan="2"><?php _e( 'A new user will be created if the above email address is not in the database.' ) ?><br /><?php _e( 'The username and password will be mailed to this email address.' ) ?></td> |
|
246 | + <td colspan="2"><?php _e('A new user will be created if the above email address is not in the database.') ?><br /><?php _e('The username and password will be mailed to this email address.') ?></td> |
|
247 | 247 | </tr> |
248 | 248 | </table> |
249 | 249 | |
@@ -253,11 +253,11 @@ discard block |
||
253 | 253 | * |
254 | 254 | * @since 4.5.0 |
255 | 255 | */ |
256 | - do_action( 'network_site_new_form' ); |
|
256 | + do_action('network_site_new_form'); |
|
257 | 257 | |
258 | - submit_button( __( 'Add Site' ), 'primary', 'add-site' ); |
|
258 | + submit_button(__('Add Site'), 'primary', 'add-site'); |
|
259 | 259 | ?> |
260 | 260 | </form> |
261 | 261 | </div> |
262 | 262 | <?php |
263 | -require( ABSPATH . 'wp-admin/admin-footer.php' ); |
|
263 | +require(ABSPATH.'wp-admin/admin-footer.php'); |
@@ -8,36 +8,36 @@ discard block |
||
8 | 8 | */ |
9 | 9 | |
10 | 10 | /** Load WordPress Administration Bootstrap */ |
11 | -require_once( dirname( __FILE__ ) . '/admin.php' ); |
|
11 | +require_once(dirname(__FILE__).'/admin.php'); |
|
12 | 12 | |
13 | -if ( ! is_multisite() ) |
|
14 | - wp_die( __( 'Multisite support is not enabled.' ) ); |
|
13 | +if ( ! is_multisite()) |
|
14 | + wp_die(__('Multisite support is not enabled.')); |
|
15 | 15 | |
16 | -if ( ! current_user_can( 'manage_sites' ) ) |
|
17 | - wp_die( __( 'Sorry, you are not allowed to manage themes for this site.' ) ); |
|
16 | +if ( ! current_user_can('manage_sites')) |
|
17 | + wp_die(__('Sorry, you are not allowed to manage themes for this site.')); |
|
18 | 18 | |
19 | -get_current_screen()->add_help_tab( array( |
|
19 | +get_current_screen()->add_help_tab(array( |
|
20 | 20 | 'id' => 'overview', |
21 | 21 | 'title' => __('Overview'), |
22 | 22 | 'content' => |
23 | - '<p>' . __('The menu is for editing information specific to individual sites, particularly if the admin area of a site is unavailable.') . '</p>' . |
|
24 | - '<p>' . __('<strong>Info</strong> — The site URL is rarely edited as this can cause the site to not work properly. The Registered date and Last Updated date are displayed. Network admins can mark a site as archived, spam, deleted and mature, to remove from public listings or disable.') . '</p>' . |
|
25 | - '<p>' . __('<strong>Users</strong> — This displays the users associated with this site. You can also change their role, reset their password, or remove them from the site. Removing the user from the site does not remove the user from the network.') . '</p>' . |
|
26 | - '<p>' . sprintf( __('<strong>Themes</strong> — This area shows themes that are not already enabled across the network. Enabling a theme in this menu makes it accessible to this site. It does not activate the theme, but allows it to show in the site’s Appearance menu. To enable a theme for the entire network, see the <a href="%s">Network Themes</a> screen.' ), network_admin_url( 'themes.php' ) ) . '</p>' . |
|
27 | - '<p>' . __('<strong>Settings</strong> — This page shows a list of all settings associated with this site. Some are created by WordPress and others are created by plugins you activate. Note that some fields are grayed out and say Serialized Data. You cannot modify these values due to the way the setting is stored in the database.') . '</p>' |
|
28 | -) ); |
|
23 | + '<p>'.__('The menu is for editing information specific to individual sites, particularly if the admin area of a site is unavailable.').'</p>'. |
|
24 | + '<p>'.__('<strong>Info</strong> — The site URL is rarely edited as this can cause the site to not work properly. The Registered date and Last Updated date are displayed. Network admins can mark a site as archived, spam, deleted and mature, to remove from public listings or disable.').'</p>'. |
|
25 | + '<p>'.__('<strong>Users</strong> — This displays the users associated with this site. You can also change their role, reset their password, or remove them from the site. Removing the user from the site does not remove the user from the network.').'</p>'. |
|
26 | + '<p>'.sprintf(__('<strong>Themes</strong> — This area shows themes that are not already enabled across the network. Enabling a theme in this menu makes it accessible to this site. It does not activate the theme, but allows it to show in the site’s Appearance menu. To enable a theme for the entire network, see the <a href="%s">Network Themes</a> screen.'), network_admin_url('themes.php')).'</p>'. |
|
27 | + '<p>'.__('<strong>Settings</strong> — This page shows a list of all settings associated with this site. Some are created by WordPress and others are created by plugins you activate. Note that some fields are grayed out and say Serialized Data. You cannot modify these values due to the way the setting is stored in the database.').'</p>' |
|
28 | +)); |
|
29 | 29 | |
30 | 30 | get_current_screen()->set_help_sidebar( |
31 | - '<p><strong>' . __('For more information:') . '</strong></p>' . |
|
32 | - '<p>' . __('<a href="https://codex.wordpress.org/Network_Admin_Sites_Screen" target="_blank">Documentation on Site Management</a>') . '</p>' . |
|
33 | - '<p>' . __('<a href="https://wordpress.org/support/forum/multisite/" target="_blank">Support Forums</a>') . '</p>' |
|
31 | + '<p><strong>'.__('For more information:').'</strong></p>'. |
|
32 | + '<p>'.__('<a href="https://codex.wordpress.org/Network_Admin_Sites_Screen" target="_blank">Documentation on Site Management</a>').'</p>'. |
|
33 | + '<p>'.__('<a href="https://wordpress.org/support/forum/multisite/" target="_blank">Support Forums</a>').'</p>' |
|
34 | 34 | ); |
35 | 35 | |
36 | -get_current_screen()->set_screen_reader_content( array( |
|
37 | - 'heading_views' => __( 'Filter site themes list' ), |
|
38 | - 'heading_pagination' => __( 'Site themes list navigation' ), |
|
39 | - 'heading_list' => __( 'Site themes list' ), |
|
40 | -) ); |
|
36 | +get_current_screen()->set_screen_reader_content(array( |
|
37 | + 'heading_views' => __('Filter site themes list'), |
|
38 | + 'heading_pagination' => __('Site themes list navigation'), |
|
39 | + 'heading_list' => __('Site themes list'), |
|
40 | +)); |
|
41 | 41 | |
42 | 42 | $wp_list_table = _get_list_table('WP_MS_Themes_List_Table'); |
43 | 43 | |
@@ -46,77 +46,77 @@ discard block |
||
46 | 46 | $s = isset($_REQUEST['s']) ? $_REQUEST['s'] : ''; |
47 | 47 | |
48 | 48 | // Clean up request URI from temporary args for screen options/paging uri's to work as expected. |
49 | -$temp_args = array( 'enabled', 'disabled', 'error' ); |
|
50 | -$_SERVER['REQUEST_URI'] = remove_query_arg( $temp_args, $_SERVER['REQUEST_URI'] ); |
|
51 | -$referer = remove_query_arg( $temp_args, wp_get_referer() ); |
|
49 | +$temp_args = array('enabled', 'disabled', 'error'); |
|
50 | +$_SERVER['REQUEST_URI'] = remove_query_arg($temp_args, $_SERVER['REQUEST_URI']); |
|
51 | +$referer = remove_query_arg($temp_args, wp_get_referer()); |
|
52 | 52 | |
53 | -if ( ! empty( $_REQUEST['paged'] ) ) { |
|
54 | - $referer = add_query_arg( 'paged', (int) $_REQUEST['paged'], $referer ); |
|
53 | +if ( ! empty($_REQUEST['paged'])) { |
|
54 | + $referer = add_query_arg('paged', (int) $_REQUEST['paged'], $referer); |
|
55 | 55 | } |
56 | 56 | |
57 | -$id = isset( $_REQUEST['id'] ) ? intval( $_REQUEST['id'] ) : 0; |
|
57 | +$id = isset($_REQUEST['id']) ? intval($_REQUEST['id']) : 0; |
|
58 | 58 | |
59 | -if ( ! $id ) |
|
60 | - wp_die( __('Invalid site ID.') ); |
|
59 | +if ( ! $id) |
|
60 | + wp_die(__('Invalid site ID.')); |
|
61 | 61 | |
62 | 62 | $wp_list_table->prepare_items(); |
63 | 63 | |
64 | -$details = get_blog_details( $id ); |
|
65 | -if ( ! $details ) { |
|
66 | - wp_die( __( 'The requested site does not exist.' ) ); |
|
64 | +$details = get_blog_details($id); |
|
65 | +if ( ! $details) { |
|
66 | + wp_die(__('The requested site does not exist.')); |
|
67 | 67 | } |
68 | 68 | |
69 | -if ( !can_edit_network( $details->site_id ) ) |
|
70 | - wp_die( __( 'Sorry, you are not allowed to access this page.' ), 403 ); |
|
69 | +if ( ! can_edit_network($details->site_id)) |
|
70 | + wp_die(__('Sorry, you are not allowed to access this page.'), 403); |
|
71 | 71 | |
72 | -$is_main_site = is_main_site( $id ); |
|
72 | +$is_main_site = is_main_site($id); |
|
73 | 73 | |
74 | -if ( $action ) { |
|
75 | - switch_to_blog( $id ); |
|
76 | - $allowed_themes = get_option( 'allowedthemes' ); |
|
74 | +if ($action) { |
|
75 | + switch_to_blog($id); |
|
76 | + $allowed_themes = get_option('allowedthemes'); |
|
77 | 77 | |
78 | - switch ( $action ) { |
|
78 | + switch ($action) { |
|
79 | 79 | case 'enable': |
80 | - check_admin_referer( 'enable-theme_' . $_GET['theme'] ); |
|
80 | + check_admin_referer('enable-theme_'.$_GET['theme']); |
|
81 | 81 | $theme = $_GET['theme']; |
82 | 82 | $action = 'enabled'; |
83 | 83 | $n = 1; |
84 | - if ( !$allowed_themes ) |
|
85 | - $allowed_themes = array( $theme => true ); |
|
84 | + if ( ! $allowed_themes) |
|
85 | + $allowed_themes = array($theme => true); |
|
86 | 86 | else |
87 | 87 | $allowed_themes[$theme] = true; |
88 | 88 | break; |
89 | 89 | case 'disable': |
90 | - check_admin_referer( 'disable-theme_' . $_GET['theme'] ); |
|
90 | + check_admin_referer('disable-theme_'.$_GET['theme']); |
|
91 | 91 | $theme = $_GET['theme']; |
92 | 92 | $action = 'disabled'; |
93 | 93 | $n = 1; |
94 | - if ( !$allowed_themes ) |
|
94 | + if ( ! $allowed_themes) |
|
95 | 95 | $allowed_themes = array(); |
96 | 96 | else |
97 | - unset( $allowed_themes[$theme] ); |
|
97 | + unset($allowed_themes[$theme]); |
|
98 | 98 | break; |
99 | 99 | case 'enable-selected': |
100 | - check_admin_referer( 'bulk-themes' ); |
|
101 | - if ( isset( $_POST['checked'] ) ) { |
|
100 | + check_admin_referer('bulk-themes'); |
|
101 | + if (isset($_POST['checked'])) { |
|
102 | 102 | $themes = (array) $_POST['checked']; |
103 | 103 | $action = 'enabled'; |
104 | - $n = count( $themes ); |
|
105 | - foreach ( (array) $themes as $theme ) |
|
106 | - $allowed_themes[ $theme ] = true; |
|
104 | + $n = count($themes); |
|
105 | + foreach ((array) $themes as $theme) |
|
106 | + $allowed_themes[$theme] = true; |
|
107 | 107 | } else { |
108 | 108 | $action = 'error'; |
109 | 109 | $n = 'none'; |
110 | 110 | } |
111 | 111 | break; |
112 | 112 | case 'disable-selected': |
113 | - check_admin_referer( 'bulk-themes' ); |
|
114 | - if ( isset( $_POST['checked'] ) ) { |
|
113 | + check_admin_referer('bulk-themes'); |
|
114 | + if (isset($_POST['checked'])) { |
|
115 | 115 | $themes = (array) $_POST['checked']; |
116 | 116 | $action = 'disabled'; |
117 | - $n = count( $themes ); |
|
118 | - foreach ( (array) $themes as $theme ) |
|
119 | - unset( $allowed_themes[ $theme ] ); |
|
117 | + $n = count($themes); |
|
118 | + foreach ((array) $themes as $theme) |
|
119 | + unset($allowed_themes[$theme]); |
|
120 | 120 | } else { |
121 | 121 | $action = 'error'; |
122 | 122 | $n = 'none'; |
@@ -124,73 +124,73 @@ discard block |
||
124 | 124 | break; |
125 | 125 | } |
126 | 126 | |
127 | - update_option( 'allowedthemes', $allowed_themes ); |
|
127 | + update_option('allowedthemes', $allowed_themes); |
|
128 | 128 | restore_current_blog(); |
129 | 129 | |
130 | - wp_safe_redirect( add_query_arg( array( 'id' => $id, $action => $n ), $referer ) ); |
|
130 | + wp_safe_redirect(add_query_arg(array('id' => $id, $action => $n), $referer)); |
|
131 | 131 | exit; |
132 | 132 | } |
133 | 133 | |
134 | -if ( isset( $_GET['action'] ) && 'update-site' == $_GET['action'] ) { |
|
135 | - wp_safe_redirect( $referer ); |
|
134 | +if (isset($_GET['action']) && 'update-site' == $_GET['action']) { |
|
135 | + wp_safe_redirect($referer); |
|
136 | 136 | exit(); |
137 | 137 | } |
138 | 138 | |
139 | 139 | add_thickbox(); |
140 | -add_screen_option( 'per_page' ); |
|
140 | +add_screen_option('per_page'); |
|
141 | 141 | |
142 | -$title = sprintf( __( 'Edit Site: %s' ), esc_html( $details->blogname ) ); |
|
142 | +$title = sprintf(__('Edit Site: %s'), esc_html($details->blogname)); |
|
143 | 143 | |
144 | 144 | $parent_file = 'sites.php'; |
145 | 145 | $submenu_file = 'sites.php'; |
146 | 146 | |
147 | -require( ABSPATH . 'wp-admin/admin-header.php' ); ?> |
|
147 | +require(ABSPATH.'wp-admin/admin-header.php'); ?> |
|
148 | 148 | |
149 | 149 | <div class="wrap"> |
150 | 150 | <h1 id="edit-site"><?php echo $title; ?></h1> |
151 | -<p class="edit-site-actions"><a href="<?php echo esc_url( get_home_url( $id, '/' ) ); ?>"><?php _e( 'Visit' ); ?></a> | <a href="<?php echo esc_url( get_admin_url( $id ) ); ?>"><?php _e( 'Dashboard' ); ?></a></p> |
|
151 | +<p class="edit-site-actions"><a href="<?php echo esc_url(get_home_url($id, '/')); ?>"><?php _e('Visit'); ?></a> | <a href="<?php echo esc_url(get_admin_url($id)); ?>"><?php _e('Dashboard'); ?></a></p> |
|
152 | 152 | <?php |
153 | 153 | |
154 | -network_edit_site_nav( array( |
|
154 | +network_edit_site_nav(array( |
|
155 | 155 | 'blog_id' => $id, |
156 | 156 | 'selected' => 'site-themes' |
157 | -) ); |
|
157 | +)); |
|
158 | 158 | |
159 | -if ( isset( $_GET['enabled'] ) ) { |
|
160 | - $enabled = absint( $_GET['enabled'] ); |
|
161 | - if ( 1 == $enabled ) { |
|
162 | - $message = __( 'Theme enabled.' ); |
|
159 | +if (isset($_GET['enabled'])) { |
|
160 | + $enabled = absint($_GET['enabled']); |
|
161 | + if (1 == $enabled) { |
|
162 | + $message = __('Theme enabled.'); |
|
163 | 163 | } else { |
164 | - $message = _n( '%s theme enabled.', '%s themes enabled.', $enabled ); |
|
164 | + $message = _n('%s theme enabled.', '%s themes enabled.', $enabled); |
|
165 | 165 | } |
166 | - echo '<div id="message" class="updated notice is-dismissible"><p>' . sprintf( $message, number_format_i18n( $enabled ) ) . '</p></div>'; |
|
167 | -} elseif ( isset( $_GET['disabled'] ) ) { |
|
168 | - $disabled = absint( $_GET['disabled'] ); |
|
169 | - if ( 1 == $disabled ) { |
|
170 | - $message = __( 'Theme disabled.' ); |
|
166 | + echo '<div id="message" class="updated notice is-dismissible"><p>'.sprintf($message, number_format_i18n($enabled)).'</p></div>'; |
|
167 | +} elseif (isset($_GET['disabled'])) { |
|
168 | + $disabled = absint($_GET['disabled']); |
|
169 | + if (1 == $disabled) { |
|
170 | + $message = __('Theme disabled.'); |
|
171 | 171 | } else { |
172 | - $message = _n( '%s theme disabled.', '%s themes disabled.', $disabled ); |
|
172 | + $message = _n('%s theme disabled.', '%s themes disabled.', $disabled); |
|
173 | 173 | } |
174 | - echo '<div id="message" class="updated notice is-dismissible"><p>' . sprintf( $message, number_format_i18n( $disabled ) ) . '</p></div>'; |
|
175 | -} elseif ( isset( $_GET['error'] ) && 'none' == $_GET['error'] ) { |
|
176 | - echo '<div id="message" class="error notice is-dismissible"><p>' . __( 'No theme selected.' ) . '</p></div>'; |
|
174 | + echo '<div id="message" class="updated notice is-dismissible"><p>'.sprintf($message, number_format_i18n($disabled)).'</p></div>'; |
|
175 | +} elseif (isset($_GET['error']) && 'none' == $_GET['error']) { |
|
176 | + echo '<div id="message" class="error notice is-dismissible"><p>'.__('No theme selected.').'</p></div>'; |
|
177 | 177 | } ?> |
178 | 178 | |
179 | -<p><?php _e( 'Network enabled themes are not shown on this screen.' ) ?></p> |
|
179 | +<p><?php _e('Network enabled themes are not shown on this screen.') ?></p> |
|
180 | 180 | |
181 | 181 | <form method="get"> |
182 | -<?php $wp_list_table->search_box( __( 'Search Installed Themes' ), 'theme' ); ?> |
|
183 | -<input type="hidden" name="id" value="<?php echo esc_attr( $id ) ?>" /> |
|
182 | +<?php $wp_list_table->search_box(__('Search Installed Themes'), 'theme'); ?> |
|
183 | +<input type="hidden" name="id" value="<?php echo esc_attr($id) ?>" /> |
|
184 | 184 | </form> |
185 | 185 | |
186 | 186 | <?php $wp_list_table->views(); ?> |
187 | 187 | |
188 | 188 | <form method="post" action="site-themes.php?action=update-site"> |
189 | - <input type="hidden" name="id" value="<?php echo esc_attr( $id ) ?>" /> |
|
189 | + <input type="hidden" name="id" value="<?php echo esc_attr($id) ?>" /> |
|
190 | 190 | |
191 | 191 | <?php $wp_list_table->display(); ?> |
192 | 192 | |
193 | 193 | </form> |
194 | 194 | |
195 | 195 | </div> |
196 | -<?php include(ABSPATH . 'wp-admin/admin-footer.php'); ?> |
|
196 | +<?php include(ABSPATH.'wp-admin/admin-footer.php'); ?> |