@@ -7,13 +7,13 @@ |
||
7 | 7 | * @since 3.1.0 |
8 | 8 | */ |
9 | 9 | |
10 | -if ( isset( $_GET['action'] ) && in_array( $_GET['action'], array( 'update-selected', 'activate-plugin', 'update-selected-themes' ) ) ) |
|
11 | - define( 'IFRAME_REQUEST', true ); |
|
10 | +if (isset($_GET['action']) && in_array($_GET['action'], array('update-selected', 'activate-plugin', 'update-selected-themes'))) |
|
11 | + define('IFRAME_REQUEST', true); |
|
12 | 12 | |
13 | 13 | /** Load WordPress Administration Bootstrap */ |
14 | -require_once( dirname( __FILE__ ) . '/admin.php' ); |
|
14 | +require_once(dirname(__FILE__).'/admin.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 | -require( ABSPATH . 'wp-admin/update.php' ); |
|
19 | +require(ABSPATH.'wp-admin/update.php'); |
@@ -7,13 +7,15 @@ |
||
7 | 7 | * @since 3.1.0 |
8 | 8 | */ |
9 | 9 | |
10 | -if ( isset( $_GET['action'] ) && in_array( $_GET['action'], array( 'update-selected', 'activate-plugin', 'update-selected-themes' ) ) ) |
|
10 | +if ( isset( $_GET['action'] ) && in_array( $_GET['action'], array( 'update-selected', 'activate-plugin', 'update-selected-themes' ) ) ) { |
|
11 | 11 | define( 'IFRAME_REQUEST', true ); |
12 | +} |
|
12 | 13 | |
13 | 14 | /** Load WordPress Administration Bootstrap */ |
14 | 15 | require_once( dirname( __FILE__ ) . '/admin.php' ); |
15 | 16 | |
16 | -if ( ! is_multisite() ) |
|
17 | +if ( ! is_multisite() ) { |
|
17 | 18 | wp_die( __( 'Multisite support is not enabled.' ) ); |
19 | +} |
|
18 | 20 | |
19 | 21 | require( ABSPATH . 'wp-admin/update.php' ); |
@@ -8,75 +8,75 @@ 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( __( 'You do not have permission to access this page.' ), 403 ); |
|
38 | +if ( ! current_user_can('manage_network')) |
|
39 | + wp_die(__('You do not have permission 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 registered 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 registered 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( 'timeout' => 120, 'httpversion' => '1.1' ) ); |
|
73 | - if ( is_wp_error( $response ) ) { |
|
74 | - wp_die( sprintf( |
|
72 | + $response = wp_remote_get($upgrade_url, array('timeout' => 120, 'httpversion' => '1.1')); |
|
73 | + if (is_wp_error($response)) { |
|
74 | + wp_die(sprintf( |
|
75 | 75 | /* translators: 1: site url, 2: server error message */ |
76 | - __( 'Warning! Problem updating %1$s. Your server may not be able to connect to sites running on it. Error message: %2$s' ), |
|
76 | + __('Warning! Problem updating %1$s. Your server may not be able to connect to sites running on it. Error message: %2$s'), |
|
77 | 77 | $siteurl, |
78 | - '<em>' . $response->get_error_message() . '</em>' |
|
79 | - ) ); |
|
78 | + '<em>'.$response->get_error_message().'</em>' |
|
79 | + )); |
|
80 | 80 | } |
81 | 81 | |
82 | 82 | /** |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | * |
87 | 87 | * @param array|WP_Error $response The upgrade response array or WP_Error on failure. |
88 | 88 | */ |
89 | - do_action( 'after_mu_upgrade', $response ); |
|
89 | + do_action('after_mu_upgrade', $response); |
|
90 | 90 | /** |
91 | 91 | * Fires after each site has been upgraded. |
92 | 92 | * |
@@ -94,10 +94,10 @@ discard block |
||
94 | 94 | * |
95 | 95 | * @param int $blog_id The id of the blog. |
96 | 96 | */ |
97 | - do_action( 'wpmu_upgrade_site', $details[ 'blog_id' ] ); |
|
97 | + do_action('wpmu_upgrade_site', $details['blog_id']); |
|
98 | 98 | } |
99 | 99 | echo "</ul>"; |
100 | - ?><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> |
|
100 | + ?><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> |
|
101 | 101 | <script type="text/javascript"> |
102 | 102 | <!-- |
103 | 103 | function nextpage() { |
@@ -109,24 +109,24 @@ discard block |
||
109 | 109 | break; |
110 | 110 | case 'show': |
111 | 111 | default: |
112 | - if ( get_site_option( 'wpmu_upgrade_site' ) != $GLOBALS['wp_db_version'] ) : |
|
112 | + if (get_site_option('wpmu_upgrade_site') != $GLOBALS['wp_db_version']) : |
|
113 | 113 | ?> |
114 | - <h3><?php _e( 'Database Upgrade Required' ); ?></h3> |
|
115 | - <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> |
|
114 | + <h3><?php _e('Database Upgrade Required'); ?></h3> |
|
115 | + <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> |
|
116 | 116 | <?php endif; ?> |
117 | 117 | |
118 | - <p><?php _e( 'The database upgrade process may take a little while, so please be patient.' ); ?></p> |
|
119 | - <p><a class="button" href="upgrade.php?action=upgrade"><?php _e( 'Upgrade Network' ); ?></a></p> |
|
118 | + <p><?php _e('The database upgrade process may take a little while, so please be patient.'); ?></p> |
|
119 | + <p><a class="button" href="upgrade.php?action=upgrade"><?php _e('Upgrade Network'); ?></a></p> |
|
120 | 120 | <?php |
121 | 121 | /** |
122 | 122 | * Fires before the footer on the network upgrade screen. |
123 | 123 | * |
124 | 124 | * @since MU |
125 | 125 | */ |
126 | - do_action( 'wpmu_upgrade_page' ); |
|
126 | + do_action('wpmu_upgrade_page'); |
|
127 | 127 | break; |
128 | 128 | } |
129 | 129 | ?> |
130 | 130 | </div> |
131 | 131 | |
132 | -<?php include( ABSPATH . 'wp-admin/admin-footer.php' ); ?> |
|
132 | +<?php include(ABSPATH.'wp-admin/admin-footer.php'); ?> |
@@ -10,8 +10,9 @@ 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 | 17 | require_once( ABSPATH . WPINC . '/http.php' ); |
17 | 18 | |
@@ -35,8 +36,9 @@ discard block |
||
35 | 36 | |
36 | 37 | require_once( ABSPATH . 'wp-admin/admin-header.php' ); |
37 | 38 | |
38 | -if ( ! current_user_can( 'manage_network' ) ) |
|
39 | +if ( ! current_user_can( 'manage_network' ) ) { |
|
39 | 40 | wp_die( __( 'You do not have permission to access this page.' ), 403 ); |
41 | +} |
|
40 | 42 | |
41 | 43 | echo '<div class="wrap">'; |
42 | 44 | echo '<h1>' . __( 'Upgrade Network' ) . '</h1>'; |
@@ -1,11 +1,11 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * Edit Site Info Administration Screen |
|
4 | - * |
|
5 | - * @package WordPress |
|
6 | - * @subpackage Multisite |
|
7 | - * @since 3.1.0 |
|
8 | - */ |
|
3 | + * Edit Site Info Administration Screen |
|
4 | + * |
|
5 | + * @package WordPress |
|
6 | + * @subpackage Multisite |
|
7 | + * @since 3.1.0 |
|
8 | + */ |
|
9 | 9 | |
10 | 10 | /** Load WordPress Administration Bootstrap */ |
11 | 11 | require_once( dirname( __FILE__ ) . '/admin.php' ); |
@@ -8,201 +8,201 @@ 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 | 16 | |
17 | -if ( ! current_user_can( 'manage_sites' ) ) { |
|
18 | - wp_die( __( 'You do not have sufficient permissions to edit this site.' ) ); |
|
17 | +if ( ! current_user_can('manage_sites')) { |
|
18 | + wp_die(__('You do not have sufficient permissions to edit this site.')); |
|
19 | 19 | } |
20 | 20 | |
21 | -get_current_screen()->add_help_tab( array( |
|
21 | +get_current_screen()->add_help_tab(array( |
|
22 | 22 | 'id' => 'overview', |
23 | - 'title' => __( 'Overview' ), |
|
23 | + 'title' => __('Overview'), |
|
24 | 24 | 'content' => |
25 | - '<p>' . __( 'The menu is for editing information specific to individual sites, particularly if the admin area of a site is unavailable.' ) . '</p>' . |
|
26 | - '<p>' . __( '<strong>Info</strong> — The domain and path are 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>' . |
|
27 | - '<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>' . |
|
28 | - '<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>' . |
|
29 | - '<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>' |
|
30 | -) ); |
|
25 | + '<p>'.__('The menu is for editing information specific to individual sites, particularly if the admin area of a site is unavailable.').'</p>'. |
|
26 | + '<p>'.__('<strong>Info</strong> — The domain and path are 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>'. |
|
27 | + '<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>'. |
|
28 | + '<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>'. |
|
29 | + '<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>' |
|
30 | +)); |
|
31 | 31 | |
32 | 32 | get_current_screen()->set_help_sidebar( |
33 | - '<p><strong>' . __( 'For more information:' ) . '</strong></p>' . |
|
34 | - '<p>' . __( '<a href="https://codex.wordpress.org/Network_Admin_Sites_Screen" target="_blank">Documentation on Site Management</a>' ) . '</p>' . |
|
35 | - '<p>' . __( '<a href="https://wordpress.org/support/forum/multisite/" target="_blank">Support Forums</a>' ) . '</p>' |
|
33 | + '<p><strong>'.__('For more information:').'</strong></p>'. |
|
34 | + '<p>'.__('<a href="https://codex.wordpress.org/Network_Admin_Sites_Screen" target="_blank">Documentation on Site Management</a>').'</p>'. |
|
35 | + '<p>'.__('<a href="https://wordpress.org/support/forum/multisite/" target="_blank">Support Forums</a>').'</p>' |
|
36 | 36 | ); |
37 | 37 | |
38 | -$id = isset( $_REQUEST['id'] ) ? intval( $_REQUEST['id'] ) : 0; |
|
38 | +$id = isset($_REQUEST['id']) ? intval($_REQUEST['id']) : 0; |
|
39 | 39 | |
40 | -if ( ! $id ) { |
|
41 | - wp_die( __('Invalid site ID.') ); |
|
40 | +if ( ! $id) { |
|
41 | + wp_die(__('Invalid site ID.')); |
|
42 | 42 | } |
43 | 43 | |
44 | -$details = get_blog_details( $id ); |
|
45 | -if ( ! $details ) { |
|
46 | - wp_die( __( 'The requested site does not exist.' ) ); |
|
44 | +$details = get_blog_details($id); |
|
45 | +if ( ! $details) { |
|
46 | + wp_die(__('The requested site does not exist.')); |
|
47 | 47 | } |
48 | 48 | |
49 | -if ( ! can_edit_network( $details->site_id ) ) { |
|
50 | - wp_die( __( 'You do not have permission to access this page.' ), 403 ); |
|
49 | +if ( ! can_edit_network($details->site_id)) { |
|
50 | + wp_die(__('You do not have permission to access this page.'), 403); |
|
51 | 51 | } |
52 | 52 | |
53 | -$parsed_scheme = parse_url( $details->siteurl, PHP_URL_SCHEME ); |
|
54 | -$is_main_site = is_main_site( $id ); |
|
53 | +$parsed_scheme = parse_url($details->siteurl, PHP_URL_SCHEME); |
|
54 | +$is_main_site = is_main_site($id); |
|
55 | 55 | |
56 | -if ( isset( $_REQUEST['action'] ) && 'update-site' == $_REQUEST['action'] ) { |
|
57 | - check_admin_referer( 'edit-site' ); |
|
56 | +if (isset($_REQUEST['action']) && 'update-site' == $_REQUEST['action']) { |
|
57 | + check_admin_referer('edit-site'); |
|
58 | 58 | |
59 | - switch_to_blog( $id ); |
|
59 | + switch_to_blog($id); |
|
60 | 60 | |
61 | 61 | // Rewrite rules can't be flushed during switch to blog. |
62 | - delete_option( 'rewrite_rules' ); |
|
62 | + delete_option('rewrite_rules'); |
|
63 | 63 | |
64 | - $blog_data = wp_unslash( $_POST['blog'] ); |
|
64 | + $blog_data = wp_unslash($_POST['blog']); |
|
65 | 65 | $blog_data['scheme'] = $parsed_scheme; |
66 | 66 | |
67 | - if ( $is_main_site ) { |
|
67 | + if ($is_main_site) { |
|
68 | 68 | // On the network's main site, don't allow the domain or path to change. |
69 | 69 | $blog_data['domain'] = $details->domain; |
70 | 70 | $blog_data['path'] = $details->path; |
71 | 71 | } else { |
72 | 72 | // For any other site, the scheme, domain, and path can all be changed. We first |
73 | 73 | // need to ensure a scheme has been provided, otherwise fallback to the existing. |
74 | - $new_url_scheme = parse_url( $blog_data['url'], PHP_URL_SCHEME ); |
|
74 | + $new_url_scheme = parse_url($blog_data['url'], PHP_URL_SCHEME); |
|
75 | 75 | |
76 | - if ( ! $new_url_scheme ) { |
|
77 | - $blog_data['url'] = esc_url( $parsed_scheme . '://' . $blog_data['url'] ); |
|
76 | + if ( ! $new_url_scheme) { |
|
77 | + $blog_data['url'] = esc_url($parsed_scheme.'://'.$blog_data['url']); |
|
78 | 78 | } |
79 | - $update_parsed_url = parse_url( $blog_data['url'] ); |
|
79 | + $update_parsed_url = parse_url($blog_data['url']); |
|
80 | 80 | |
81 | 81 | $blog_data['scheme'] = $update_parsed_url['scheme']; |
82 | 82 | $blog_data['domain'] = $update_parsed_url['host']; |
83 | 83 | $blog_data['path'] = $update_parsed_url['path']; |
84 | 84 | } |
85 | 85 | |
86 | - $existing_details = get_blog_details( $id, false ); |
|
87 | - $blog_data_checkboxes = array( 'public', 'archived', 'spam', 'mature', 'deleted' ); |
|
88 | - foreach ( $blog_data_checkboxes as $c ) { |
|
89 | - if ( ! in_array( $existing_details->$c, array( 0, 1 ) ) ) { |
|
90 | - $blog_data[ $c ] = $existing_details->$c; |
|
86 | + $existing_details = get_blog_details($id, false); |
|
87 | + $blog_data_checkboxes = array('public', 'archived', 'spam', 'mature', 'deleted'); |
|
88 | + foreach ($blog_data_checkboxes as $c) { |
|
89 | + if ( ! in_array($existing_details->$c, array(0, 1))) { |
|
90 | + $blog_data[$c] = $existing_details->$c; |
|
91 | 91 | } else { |
92 | - $blog_data[ $c ] = isset( $_POST['blog'][ $c ] ) ? 1 : 0; |
|
92 | + $blog_data[$c] = isset($_POST['blog'][$c]) ? 1 : 0; |
|
93 | 93 | } |
94 | 94 | } |
95 | 95 | |
96 | - update_blog_details( $id, $blog_data ); |
|
96 | + update_blog_details($id, $blog_data); |
|
97 | 97 | |
98 | 98 | // Maybe update home and siteurl options. |
99 | - $new_details = get_blog_details( $id, false ); |
|
99 | + $new_details = get_blog_details($id, false); |
|
100 | 100 | |
101 | - $old_home_url = trailingslashit( esc_url( get_option( 'home' ) ) ); |
|
102 | - $old_home_parsed = parse_url( $old_home_url ); |
|
101 | + $old_home_url = trailingslashit(esc_url(get_option('home'))); |
|
102 | + $old_home_parsed = parse_url($old_home_url); |
|
103 | 103 | |
104 | - if ( $old_home_parsed['host'] === $existing_details->domain && $old_home_parsed['path'] === $existing_details->path ) { |
|
105 | - $new_home_url = untrailingslashit( esc_url_raw( $blog_data['scheme'] . '://' . $new_details->domain . $new_details->path ) ); |
|
106 | - update_option( 'home', $new_home_url ); |
|
104 | + if ($old_home_parsed['host'] === $existing_details->domain && $old_home_parsed['path'] === $existing_details->path) { |
|
105 | + $new_home_url = untrailingslashit(esc_url_raw($blog_data['scheme'].'://'.$new_details->domain.$new_details->path)); |
|
106 | + update_option('home', $new_home_url); |
|
107 | 107 | } |
108 | 108 | |
109 | - $old_site_url = trailingslashit( esc_url( get_option( 'siteurl' ) ) ); |
|
110 | - $old_site_parsed = parse_url( $old_site_url ); |
|
109 | + $old_site_url = trailingslashit(esc_url(get_option('siteurl'))); |
|
110 | + $old_site_parsed = parse_url($old_site_url); |
|
111 | 111 | |
112 | - if ( $old_site_parsed['host'] === $existing_details->domain && $old_site_parsed['path'] === $existing_details->path ) { |
|
113 | - $new_site_url = untrailingslashit( esc_url_raw( $blog_data['scheme'] . '://' . $new_details->domain . $new_details->path ) ); |
|
114 | - update_option( 'siteurl', $new_site_url ); |
|
112 | + if ($old_site_parsed['host'] === $existing_details->domain && $old_site_parsed['path'] === $existing_details->path) { |
|
113 | + $new_site_url = untrailingslashit(esc_url_raw($blog_data['scheme'].'://'.$new_details->domain.$new_details->path)); |
|
114 | + update_option('siteurl', $new_site_url); |
|
115 | 115 | } |
116 | 116 | |
117 | 117 | restore_current_blog(); |
118 | - wp_redirect( add_query_arg( array( 'update' => 'updated', 'id' => $id ), 'site-info.php' ) ); |
|
118 | + wp_redirect(add_query_arg(array('update' => 'updated', 'id' => $id), 'site-info.php')); |
|
119 | 119 | exit; |
120 | 120 | } |
121 | 121 | |
122 | -if ( isset( $_GET['update'] ) ) { |
|
122 | +if (isset($_GET['update'])) { |
|
123 | 123 | $messages = array(); |
124 | - if ( 'updated' == $_GET['update'] ) { |
|
125 | - $messages[] = __( 'Site info updated.' ); |
|
124 | + if ('updated' == $_GET['update']) { |
|
125 | + $messages[] = __('Site info updated.'); |
|
126 | 126 | } |
127 | 127 | } |
128 | 128 | |
129 | -$title = sprintf( __( 'Edit Site: %s' ), esc_html( $details->blogname ) ); |
|
129 | +$title = sprintf(__('Edit Site: %s'), esc_html($details->blogname)); |
|
130 | 130 | |
131 | 131 | $parent_file = 'sites.php'; |
132 | 132 | $submenu_file = 'sites.php'; |
133 | 133 | |
134 | -require( ABSPATH . 'wp-admin/admin-header.php' ); |
|
134 | +require(ABSPATH.'wp-admin/admin-header.php'); |
|
135 | 135 | |
136 | 136 | ?> |
137 | 137 | |
138 | 138 | <div class="wrap"> |
139 | 139 | <h1 id="edit-site"><?php echo $title; ?></h1> |
140 | -<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> |
|
140 | +<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> |
|
141 | 141 | <h3 class="nav-tab-wrapper"> |
142 | 142 | <?php |
143 | 143 | $tabs = array( |
144 | - 'site-info' => array( 'label' => __( 'Info' ), 'url' => 'site-info.php' ), |
|
145 | - 'site-users' => array( 'label' => __( 'Users' ), 'url' => 'site-users.php' ), |
|
146 | - 'site-themes' => array( 'label' => __( 'Themes' ), 'url' => 'site-themes.php' ), |
|
147 | - 'site-settings' => array( 'label' => __( 'Settings' ), 'url' => 'site-settings.php' ), |
|
144 | + 'site-info' => array('label' => __('Info'), 'url' => 'site-info.php'), |
|
145 | + 'site-users' => array('label' => __('Users'), 'url' => 'site-users.php'), |
|
146 | + 'site-themes' => array('label' => __('Themes'), 'url' => 'site-themes.php'), |
|
147 | + 'site-settings' => array('label' => __('Settings'), 'url' => 'site-settings.php'), |
|
148 | 148 | ); |
149 | -foreach ( $tabs as $tab_id => $tab ) { |
|
150 | - $class = ( $tab['url'] == $pagenow ) ? ' nav-tab-active' : ''; |
|
151 | - echo '<a href="' . $tab['url'] . '?id=' . $id .'" class="nav-tab' . $class . '">' . esc_html( $tab['label'] ) . '</a>'; |
|
149 | +foreach ($tabs as $tab_id => $tab) { |
|
150 | + $class = ($tab['url'] == $pagenow) ? ' nav-tab-active' : ''; |
|
151 | + echo '<a href="'.$tab['url'].'?id='.$id.'" class="nav-tab'.$class.'">'.esc_html($tab['label']).'</a>'; |
|
152 | 152 | } |
153 | 153 | ?> |
154 | 154 | </h3> |
155 | 155 | <?php |
156 | -if ( ! empty( $messages ) ) { |
|
157 | - foreach ( $messages as $msg ) { |
|
158 | - echo '<div id="message" class="updated notice is-dismissible"><p>' . $msg . '</p></div>'; |
|
156 | +if ( ! empty($messages)) { |
|
157 | + foreach ($messages as $msg) { |
|
158 | + echo '<div id="message" class="updated notice is-dismissible"><p>'.$msg.'</p></div>'; |
|
159 | 159 | } |
160 | 160 | } |
161 | 161 | ?> |
162 | 162 | <form method="post" action="site-info.php?action=update-site"> |
163 | - <?php wp_nonce_field( 'edit-site' ); ?> |
|
164 | - <input type="hidden" name="id" value="<?php echo esc_attr( $id ) ?>" /> |
|
163 | + <?php wp_nonce_field('edit-site'); ?> |
|
164 | + <input type="hidden" name="id" value="<?php echo esc_attr($id) ?>" /> |
|
165 | 165 | <table class="form-table"> |
166 | 166 | <?php |
167 | 167 | // The main site of the network should not be updated on this page. |
168 | - if ( $is_main_site ) : ?> |
|
168 | + if ($is_main_site) : ?> |
|
169 | 169 | <tr class="form-field"> |
170 | - <th scope="row"><?php _e( 'Site URL' ); ?></th> |
|
171 | - <td><?php echo esc_url( $details->siteurl ); ?></td> |
|
170 | + <th scope="row"><?php _e('Site URL'); ?></th> |
|
171 | + <td><?php echo esc_url($details->siteurl); ?></td> |
|
172 | 172 | </tr> |
173 | 173 | <?php |
174 | 174 | // For any other site, the scheme, domain, and path can all be changed. |
175 | 175 | else : ?> |
176 | 176 | <tr class="form-field form-required"> |
177 | - <th scope="row"><?php _e( 'Site URL' ); ?></th> |
|
178 | - <td><input name="blog[url]" type="text" id="url" value="<?php echo $parsed_scheme . '://' . esc_attr( $details->domain ) . esc_attr( $details->path ); ?>" /></td> |
|
177 | + <th scope="row"><?php _e('Site URL'); ?></th> |
|
178 | + <td><input name="blog[url]" type="text" id="url" value="<?php echo $parsed_scheme.'://'.esc_attr($details->domain).esc_attr($details->path); ?>" /></td> |
|
179 | 179 | </tr> |
180 | 180 | <?php endif; ?> |
181 | 181 | |
182 | 182 | <tr class="form-field"> |
183 | - <th scope="row"><label for="blog_registered"><?php _ex( 'Registered', 'site' ) ?></label></th> |
|
184 | - <td><input name="blog[registered]" type="text" id="blog_registered" value="<?php echo esc_attr( $details->registered ) ?>" /></td> |
|
183 | + <th scope="row"><label for="blog_registered"><?php _ex('Registered', 'site') ?></label></th> |
|
184 | + <td><input name="blog[registered]" type="text" id="blog_registered" value="<?php echo esc_attr($details->registered) ?>" /></td> |
|
185 | 185 | </tr> |
186 | 186 | <tr class="form-field"> |
187 | - <th scope="row"><label for="blog_last_updated"><?php _e( 'Last Updated' ); ?></label></th> |
|
188 | - <td><input name="blog[last_updated]" type="text" id="blog_last_updated" value="<?php echo esc_attr( $details->last_updated ) ?>" /></td> |
|
187 | + <th scope="row"><label for="blog_last_updated"><?php _e('Last Updated'); ?></label></th> |
|
188 | + <td><input name="blog[last_updated]" type="text" id="blog_last_updated" value="<?php echo esc_attr($details->last_updated) ?>" /></td> |
|
189 | 189 | </tr> |
190 | 190 | <?php |
191 | - $attribute_fields = array( 'public' => __( 'Public' ) ); |
|
192 | - if ( ! $is_main_site ) { |
|
193 | - $attribute_fields['archived'] = __( 'Archived' ); |
|
194 | - $attribute_fields['spam'] = _x( 'Spam', 'site' ); |
|
195 | - $attribute_fields['deleted'] = __( 'Deleted' ); |
|
191 | + $attribute_fields = array('public' => __('Public')); |
|
192 | + if ( ! $is_main_site) { |
|
193 | + $attribute_fields['archived'] = __('Archived'); |
|
194 | + $attribute_fields['spam'] = _x('Spam', 'site'); |
|
195 | + $attribute_fields['deleted'] = __('Deleted'); |
|
196 | 196 | } |
197 | - $attribute_fields['mature'] = __( 'Mature' ); |
|
197 | + $attribute_fields['mature'] = __('Mature'); |
|
198 | 198 | ?> |
199 | 199 | <tr> |
200 | - <th scope="row"><?php _e( 'Attributes' ); ?></th> |
|
200 | + <th scope="row"><?php _e('Attributes'); ?></th> |
|
201 | 201 | <td> |
202 | 202 | <fieldset> |
203 | - <legend class="screen-reader-text"><?php _e( 'Set site attributes' ) ?></legend> |
|
204 | - <?php foreach ( $attribute_fields as $field_key => $field_label ) : ?> |
|
205 | - <label><input type="checkbox" name="blog[<?php echo $field_key; ?>]" value="1" <?php checked( (bool) $details->$field_key, true ); disabled( ! in_array( $details->$field_key, array( 0, 1 ) ) ); ?> /> |
|
203 | + <legend class="screen-reader-text"><?php _e('Set site attributes') ?></legend> |
|
204 | + <?php foreach ($attribute_fields as $field_key => $field_label) : ?> |
|
205 | + <label><input type="checkbox" name="blog[<?php echo $field_key; ?>]" value="1" <?php checked((bool) $details->$field_key, true); disabled( ! in_array($details->$field_key, array(0, 1))); ?> /> |
|
206 | 206 | <?php echo $field_label; ?></label><br/> |
207 | 207 | <?php endforeach; ?> |
208 | 208 | <fieldset> |
@@ -214,4 +214,4 @@ discard block |
||
214 | 214 | |
215 | 215 | </div> |
216 | 216 | <?php |
217 | -require( ABSPATH . 'wp-admin/admin-footer.php' ); |
|
217 | +require(ABSPATH.'wp-admin/admin-footer.php'); |
@@ -172,9 +172,12 @@ |
||
172 | 172 | </tr> |
173 | 173 | <?php |
174 | 174 | // For any other site, the scheme, domain, and path can all be changed. |
175 | - else : ?> |
|
175 | + else { |
|
176 | + : ?> |
|
176 | 177 | <tr class="form-field form-required"> |
177 | - <th scope="row"><?php _e( 'Site URL' ); ?></th> |
|
178 | + <th scope="row"><?php _e( 'Site URL' ); |
|
179 | + } |
|
180 | + ?></th> |
|
178 | 181 | <td><input name="blog[url]" type="text" id="url" value="<?php echo $parsed_scheme . '://' . esc_attr( $details->domain ) . esc_attr( $details->path ); ?>" /></td> |
179 | 182 | </tr> |
180 | 183 | <?php endif; ?> |
@@ -1,11 +1,11 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * Add Site Administration Screen |
|
4 | - * |
|
5 | - * @package WordPress |
|
6 | - * @subpackage Multisite |
|
7 | - * @since 3.1.0 |
|
8 | - */ |
|
3 | + * Add Site Administration Screen |
|
4 | + * |
|
5 | + * @package WordPress |
|
6 | + * @subpackage Multisite |
|
7 | + * @since 3.1.0 |
|
8 | + */ |
|
9 | 9 | |
10 | 10 | /** Load WordPress Administration Bootstrap */ |
11 | 11 | require_once( dirname( __FILE__ ) . '/admin.php' ); |
@@ -8,163 +8,163 @@ |
||
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( __( 'You do not have sufficient permissions to add sites to this network.' ) ); |
|
16 | +if ( ! current_user_can('manage_sites')) |
|
17 | + wp_die(__('You do not have sufficient permissions to add sites 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>' . __('This screen is for Super Admins to add new sites to the network. This is not affected by the registration settings.') . '</p>' . |
|
24 | - '<p>' . __('If the admin email for the new site does not exist in the database, a new user will also be created.') . '</p>' |
|
25 | -) ); |
|
23 | + '<p>'.__('This screen is for Super Admins to add new sites to the network. This is not affected by the registration settings.').'</p>'. |
|
24 | + '<p>'.__('If the admin email for the new site does not exist in the database, a new user will also be created.').'</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_Sites_Screen" target="_blank">Documentation on Site Management</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_Sites_Screen" target="_blank">Documentation on Site Management</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-site' == $_REQUEST['action'] ) { |
|
34 | - check_admin_referer( 'add-blog', '_wpnonce_add-blog' ); |
|
33 | +if (isset($_REQUEST['action']) && 'add-site' == $_REQUEST['action']) { |
|
34 | + check_admin_referer('add-blog', '_wpnonce_add-blog'); |
|
35 | 35 | |
36 | - if ( ! is_array( $_POST['blog'] ) ) |
|
37 | - wp_die( __( 'Can’t create an empty site.' ) ); |
|
36 | + if ( ! is_array($_POST['blog'])) |
|
37 | + wp_die(__('Can’t create an empty site.')); |
|
38 | 38 | |
39 | 39 | $blog = $_POST['blog']; |
40 | 40 | $domain = ''; |
41 | - if ( preg_match( '|^([a-zA-Z0-9-])+$|', $blog['domain'] ) ) |
|
42 | - $domain = strtolower( $blog['domain'] ); |
|
41 | + if (preg_match('|^([a-zA-Z0-9-])+$|', $blog['domain'])) |
|
42 | + $domain = strtolower($blog['domain']); |
|
43 | 43 | |
44 | 44 | // If not a subdomain install, make sure the domain isn't a reserved word |
45 | - if ( ! is_subdomain_install() ) { |
|
45 | + if ( ! is_subdomain_install()) { |
|
46 | 46 | /** This filter is documented in wp-includes/ms-functions.php */ |
47 | - $subdirectory_reserved_names = apply_filters( 'subdirectory_reserved_names', array( 'page', 'comments', 'blog', 'files', 'feed' ) ); |
|
48 | - if ( in_array( $domain, $subdirectory_reserved_names ) ) |
|
49 | - wp_die( sprintf( __('The following words are reserved for use by WordPress functions and cannot be used as blog names: <code>%s</code>' ), implode( '</code>, <code>', $subdirectory_reserved_names ) ) ); |
|
47 | + $subdirectory_reserved_names = apply_filters('subdirectory_reserved_names', array('page', 'comments', 'blog', 'files', 'feed')); |
|
48 | + if (in_array($domain, $subdirectory_reserved_names)) |
|
49 | + wp_die(sprintf(__('The following words are reserved for use by WordPress functions and cannot be used as blog names: <code>%s</code>'), implode('</code>, <code>', $subdirectory_reserved_names))); |
|
50 | 50 | } |
51 | 51 | |
52 | 52 | $title = $blog['title']; |
53 | 53 | |
54 | - if ( empty( $domain ) ) |
|
55 | - wp_die( __( 'Missing or invalid site address.' ) ); |
|
54 | + if (empty($domain)) |
|
55 | + wp_die(__('Missing or invalid site address.')); |
|
56 | 56 | |
57 | - if ( isset( $blog['email'] ) && '' === trim( $blog['email'] ) ) { |
|
58 | - wp_die( __( 'Missing email address.' ) ); |
|
57 | + if (isset($blog['email']) && '' === trim($blog['email'])) { |
|
58 | + wp_die(__('Missing email address.')); |
|
59 | 59 | } |
60 | 60 | |
61 | - $email = sanitize_email( $blog['email'] ); |
|
62 | - if ( ! is_email( $email ) ) { |
|
63 | - wp_die( __( 'Invalid email address.' ) ); |
|
61 | + $email = sanitize_email($blog['email']); |
|
62 | + if ( ! is_email($email)) { |
|
63 | + wp_die(__('Invalid email address.')); |
|
64 | 64 | } |
65 | 65 | |
66 | - if ( is_subdomain_install() ) { |
|
67 | - $newdomain = $domain . '.' . preg_replace( '|^www\.|', '', $current_site->domain ); |
|
66 | + if (is_subdomain_install()) { |
|
67 | + $newdomain = $domain.'.'.preg_replace('|^www\.|', '', $current_site->domain); |
|
68 | 68 | $path = $current_site->path; |
69 | 69 | } else { |
70 | 70 | $newdomain = $current_site->domain; |
71 | - $path = $current_site->path . $domain . '/'; |
|
71 | + $path = $current_site->path.$domain.'/'; |
|
72 | 72 | } |
73 | 73 | |
74 | 74 | $password = 'N/A'; |
75 | 75 | $user_id = email_exists($email); |
76 | - if ( !$user_id ) { // Create a new user with a random password |
|
77 | - $password = wp_generate_password( 12, false ); |
|
78 | - $user_id = wpmu_create_user( $domain, $password, $email ); |
|
79 | - if ( false === $user_id ) |
|
80 | - wp_die( __( 'There was an error creating the user.' ) ); |
|
76 | + if ( ! $user_id) { // Create a new user with a random password |
|
77 | + $password = wp_generate_password(12, false); |
|
78 | + $user_id = wpmu_create_user($domain, $password, $email); |
|
79 | + if (false === $user_id) |
|
80 | + wp_die(__('There was an error creating the user.')); |
|
81 | 81 | else |
82 | - wp_new_user_notification( $user_id, 'both' ); |
|
82 | + wp_new_user_notification($user_id, 'both'); |
|
83 | 83 | } |
84 | 84 | |
85 | 85 | $wpdb->hide_errors(); |
86 | - $id = wpmu_create_blog( $newdomain, $path, $title, $user_id , array( 'public' => 1 ), $current_site->id ); |
|
86 | + $id = wpmu_create_blog($newdomain, $path, $title, $user_id, array('public' => 1), $current_site->id); |
|
87 | 87 | $wpdb->show_errors(); |
88 | - if ( ! is_wp_error( $id ) ) { |
|
89 | - if ( ! is_super_admin( $user_id ) && !get_user_option( 'primary_blog', $user_id ) ) { |
|
90 | - update_user_option( $user_id, 'primary_blog', $id, true ); |
|
88 | + if ( ! is_wp_error($id)) { |
|
89 | + if ( ! is_super_admin($user_id) && ! get_user_option('primary_blog', $user_id)) { |
|
90 | + update_user_option($user_id, 'primary_blog', $id, true); |
|
91 | 91 | } |
92 | 92 | |
93 | 93 | $content_mail = sprintf( |
94 | 94 | /* translators: 1: user login, 2: site url, 3: site name/title */ |
95 | - __( 'New site created by %1$s |
|
95 | + __('New site created by %1$s |
|
96 | 96 | |
97 | 97 | Address: %2$s |
98 | 98 | Name: %3$s' ), |
99 | 99 | $current_user->user_login, |
100 | - get_site_url( $id ), |
|
101 | - wp_unslash( $title ) |
|
100 | + get_site_url($id), |
|
101 | + wp_unslash($title) |
|
102 | 102 | ); |
103 | - wp_mail( get_site_option('admin_email'), sprintf( __( '[%s] New Site Created' ), $current_site->site_name ), $content_mail, 'From: "Site Admin" <' . get_site_option( 'admin_email' ) . '>' ); |
|
104 | - wpmu_welcome_notification( $id, $user_id, $password, $title, array( 'public' => 1 ) ); |
|
105 | - wp_redirect( add_query_arg( array( 'update' => 'added', 'id' => $id ), 'site-new.php' ) ); |
|
103 | + wp_mail(get_site_option('admin_email'), sprintf(__('[%s] New Site Created'), $current_site->site_name), $content_mail, 'From: "Site Admin" <'.get_site_option('admin_email').'>'); |
|
104 | + wpmu_welcome_notification($id, $user_id, $password, $title, array('public' => 1)); |
|
105 | + wp_redirect(add_query_arg(array('update' => 'added', 'id' => $id), 'site-new.php')); |
|
106 | 106 | exit; |
107 | 107 | } else { |
108 | - wp_die( $id->get_error_message() ); |
|
108 | + wp_die($id->get_error_message()); |
|
109 | 109 | } |
110 | 110 | } |
111 | 111 | |
112 | -if ( isset($_GET['update']) ) { |
|
112 | +if (isset($_GET['update'])) { |
|
113 | 113 | $messages = array(); |
114 | - if ( 'added' == $_GET['update'] ) |
|
114 | + if ('added' == $_GET['update']) |
|
115 | 115 | $messages[] = sprintf( |
116 | 116 | /* translators: 1: dashboard url, 2: network admin edit url */ |
117 | - __( 'Site added. <a href="%1$s">Visit Dashboard</a> or <a href="%2$s">Edit Site</a>' ), |
|
118 | - esc_url( get_admin_url( absint( $_GET['id'] ) ) ), |
|
119 | - network_admin_url( 'site-info.php?id=' . absint( $_GET['id'] ) ) |
|
117 | + __('Site added. <a href="%1$s">Visit Dashboard</a> or <a href="%2$s">Edit Site</a>'), |
|
118 | + esc_url(get_admin_url(absint($_GET['id']))), |
|
119 | + network_admin_url('site-info.php?id='.absint($_GET['id'])) |
|
120 | 120 | ); |
121 | 121 | } |
122 | 122 | |
123 | 123 | $title = __('Add New Site'); |
124 | 124 | $parent_file = 'sites.php'; |
125 | 125 | |
126 | -wp_enqueue_script( 'user-suggest' ); |
|
126 | +wp_enqueue_script('user-suggest'); |
|
127 | 127 | |
128 | -require( ABSPATH . 'wp-admin/admin-header.php' ); |
|
128 | +require(ABSPATH.'wp-admin/admin-header.php'); |
|
129 | 129 | |
130 | 130 | ?> |
131 | 131 | |
132 | 132 | <div class="wrap"> |
133 | -<h1 id="add-new-site"><?php _e( 'Add New Site' ); ?></h1> |
|
133 | +<h1 id="add-new-site"><?php _e('Add New Site'); ?></h1> |
|
134 | 134 | <?php |
135 | -if ( ! empty( $messages ) ) { |
|
136 | - foreach ( $messages as $msg ) |
|
137 | - echo '<div id="message" class="updated notice is-dismissible"><p>' . $msg . '</p></div>'; |
|
135 | +if ( ! empty($messages)) { |
|
136 | + foreach ($messages as $msg) |
|
137 | + echo '<div id="message" class="updated notice is-dismissible"><p>'.$msg.'</p></div>'; |
|
138 | 138 | } ?> |
139 | -<form method="post" action="<?php echo network_admin_url( 'site-new.php?action=add-site' ); ?>" novalidate="novalidate"> |
|
140 | -<?php wp_nonce_field( 'add-blog', '_wpnonce_add-blog' ) ?> |
|
139 | +<form method="post" action="<?php echo network_admin_url('site-new.php?action=add-site'); ?>" novalidate="novalidate"> |
|
140 | +<?php wp_nonce_field('add-blog', '_wpnonce_add-blog') ?> |
|
141 | 141 | <table class="form-table"> |
142 | 142 | <tr class="form-field form-required"> |
143 | - <th scope="row"><label for="site-address"><?php _e( 'Site Address' ) ?></label></th> |
|
143 | + <th scope="row"><label for="site-address"><?php _e('Site Address') ?></label></th> |
|
144 | 144 | <td> |
145 | - <?php if ( is_subdomain_install() ) { ?> |
|
146 | - <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> |
|
145 | + <?php if (is_subdomain_install()) { ?> |
|
146 | + <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> |
|
147 | 147 | <?php } else { |
148 | - 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" /> |
|
148 | + 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" /> |
|
149 | 149 | <?php } |
150 | - echo '<p id="site-address-desc">' . __( 'Only lowercase letters (a-z) and numbers are allowed.' ) . '</p>'; |
|
150 | + echo '<p id="site-address-desc">'.__('Only lowercase letters (a-z) and numbers are allowed.').'</p>'; |
|
151 | 151 | ?> |
152 | 152 | </td> |
153 | 153 | </tr> |
154 | 154 | <tr class="form-field form-required"> |
155 | - <th scope="row"><label for="site-title"><?php _e( 'Site Title' ) ?></label></th> |
|
155 | + <th scope="row"><label for="site-title"><?php _e('Site Title') ?></label></th> |
|
156 | 156 | <td><input name="blog[title]" type="text" class="regular-text" id="site-title" /></td> |
157 | 157 | </tr> |
158 | 158 | <tr class="form-field form-required"> |
159 | - <th scope="row"><label for="admin-email"><?php _e( 'Admin Email' ) ?></label></th> |
|
159 | + <th scope="row"><label for="admin-email"><?php _e('Admin Email') ?></label></th> |
|
160 | 160 | <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> |
161 | 161 | </tr> |
162 | 162 | <tr class="form-field"> |
163 | - <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> |
|
163 | + <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> |
|
164 | 164 | </tr> |
165 | 165 | </table> |
166 | - <?php submit_button( __('Add Site'), 'primary', 'add-site' ); ?> |
|
166 | + <?php submit_button(__('Add Site'), 'primary', 'add-site'); ?> |
|
167 | 167 | </form> |
168 | 168 | </div> |
169 | 169 | <?php |
170 | -require( ABSPATH . 'wp-admin/admin-footer.php' ); |
|
170 | +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( 'manage_sites' ) ) |
|
17 | +if ( ! current_user_can( 'manage_sites' ) ) { |
|
17 | 18 | wp_die( __( 'You do not have sufficient permissions to add sites to this network.' ) ); |
19 | +} |
|
18 | 20 | |
19 | 21 | get_current_screen()->add_help_tab( array( |
20 | 22 | 'id' => 'overview', |
@@ -33,26 +35,30 @@ discard block |
||
33 | 35 | if ( isset($_REQUEST['action']) && 'add-site' == $_REQUEST['action'] ) { |
34 | 36 | check_admin_referer( 'add-blog', '_wpnonce_add-blog' ); |
35 | 37 | |
36 | - if ( ! is_array( $_POST['blog'] ) ) |
|
37 | - wp_die( __( 'Can’t create an empty site.' ) ); |
|
38 | + if ( ! is_array( $_POST['blog'] ) ) { |
|
39 | + wp_die( __( 'Can’t create an empty site.' ) ); |
|
40 | + } |
|
38 | 41 | |
39 | 42 | $blog = $_POST['blog']; |
40 | 43 | $domain = ''; |
41 | - if ( preg_match( '|^([a-zA-Z0-9-])+$|', $blog['domain'] ) ) |
|
42 | - $domain = strtolower( $blog['domain'] ); |
|
44 | + if ( preg_match( '|^([a-zA-Z0-9-])+$|', $blog['domain'] ) ) { |
|
45 | + $domain = strtolower( $blog['domain'] ); |
|
46 | + } |
|
43 | 47 | |
44 | 48 | // If not a subdomain install, make sure the domain isn't a reserved word |
45 | 49 | if ( ! is_subdomain_install() ) { |
46 | 50 | /** This filter is documented in wp-includes/ms-functions.php */ |
47 | 51 | $subdirectory_reserved_names = apply_filters( 'subdirectory_reserved_names', array( 'page', 'comments', 'blog', 'files', 'feed' ) ); |
48 | - if ( in_array( $domain, $subdirectory_reserved_names ) ) |
|
49 | - wp_die( sprintf( __('The following words are reserved for use by WordPress functions and cannot be used as blog names: <code>%s</code>' ), implode( '</code>, <code>', $subdirectory_reserved_names ) ) ); |
|
52 | + if ( in_array( $domain, $subdirectory_reserved_names ) ) { |
|
53 | + wp_die( sprintf( __('The following words are reserved for use by WordPress functions and cannot be used as blog names: <code>%s</code>' ), implode( '</code>, <code>', $subdirectory_reserved_names ) ) ); |
|
54 | + } |
|
50 | 55 | } |
51 | 56 | |
52 | 57 | $title = $blog['title']; |
53 | 58 | |
54 | - if ( empty( $domain ) ) |
|
55 | - wp_die( __( 'Missing or invalid site address.' ) ); |
|
59 | + if ( empty( $domain ) ) { |
|
60 | + wp_die( __( 'Missing or invalid site address.' ) ); |
|
61 | + } |
|
56 | 62 | |
57 | 63 | if ( isset( $blog['email'] ) && '' === trim( $blog['email'] ) ) { |
58 | 64 | wp_die( __( 'Missing email address.' ) ); |
@@ -76,10 +82,11 @@ discard block |
||
76 | 82 | if ( !$user_id ) { // Create a new user with a random password |
77 | 83 | $password = wp_generate_password( 12, false ); |
78 | 84 | $user_id = wpmu_create_user( $domain, $password, $email ); |
79 | - if ( false === $user_id ) |
|
80 | - wp_die( __( 'There was an error creating the user.' ) ); |
|
81 | - else |
|
82 | - wp_new_user_notification( $user_id, 'both' ); |
|
85 | + if ( false === $user_id ) { |
|
86 | + wp_die( __( 'There was an error creating the user.' ) ); |
|
87 | + } else { |
|
88 | + wp_new_user_notification( $user_id, 'both' ); |
|
89 | + } |
|
83 | 90 | } |
84 | 91 | |
85 | 92 | $wpdb->hide_errors(); |
@@ -111,14 +118,15 @@ discard block |
||
111 | 118 | |
112 | 119 | if ( isset($_GET['update']) ) { |
113 | 120 | $messages = array(); |
114 | - if ( 'added' == $_GET['update'] ) |
|
115 | - $messages[] = sprintf( |
|
121 | + if ( 'added' == $_GET['update'] ) { |
|
122 | + $messages[] = sprintf( |
|
116 | 123 | /* translators: 1: dashboard url, 2: network admin edit url */ |
117 | 124 | __( 'Site added. <a href="%1$s">Visit Dashboard</a> or <a href="%2$s">Edit Site</a>' ), |
118 | 125 | esc_url( get_admin_url( absint( $_GET['id'] ) ) ), |
119 | 126 | network_admin_url( 'site-info.php?id=' . absint( $_GET['id'] ) ) |
120 | 127 | ); |
121 | -} |
|
128 | + } |
|
129 | + } |
|
122 | 130 | |
123 | 131 | $title = __('Add New Site'); |
124 | 132 | $parent_file = 'sites.php'; |
@@ -133,9 +141,10 @@ discard block |
||
133 | 141 | <h1 id="add-new-site"><?php _e( 'Add New Site' ); ?></h1> |
134 | 142 | <?php |
135 | 143 | if ( ! empty( $messages ) ) { |
136 | - foreach ( $messages as $msg ) |
|
137 | - echo '<div id="message" class="updated notice is-dismissible"><p>' . $msg . '</p></div>'; |
|
138 | -} ?> |
|
144 | + foreach ( $messages as $msg ) { |
|
145 | + echo '<div id="message" class="updated notice is-dismissible"><p>' . $msg . '</p></div>'; |
|
146 | + } |
|
147 | + } ?> |
|
139 | 148 | <form method="post" action="<?php echo network_admin_url( 'site-new.php?action=add-site' ); ?>" novalidate="novalidate"> |
140 | 149 | <?php wp_nonce_field( 'add-blog', '_wpnonce_add-blog' ) ?> |
141 | 150 | <table class="form-table"> |
@@ -1,11 +1,11 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * Multisite network settings administration panel. |
|
4 | - * |
|
5 | - * @package WordPress |
|
6 | - * @subpackage Multisite |
|
7 | - * @since 3.0.0 |
|
8 | - */ |
|
3 | + * Multisite network settings administration panel. |
|
4 | + * |
|
5 | + * @package WordPress |
|
6 | + * @subpackage Multisite |
|
7 | + * @since 3.0.0 |
|
8 | + */ |
|
9 | 9 | |
10 | 10 | /** Load WordPress Administration Bootstrap */ |
11 | 11 | require_once( dirname( __FILE__ ) . '/admin.php' ); |
@@ -8,18 +8,18 @@ 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( __( 'You do not have permission to access this page.' ), 403 ); |
|
19 | +if ( ! current_user_can('manage_network_options')) |
|
20 | + wp_die(__('You do not have permission to access this page.'), 403); |
|
21 | 21 | |
22 | -$title = __( 'Network Settings' ); |
|
22 | +$title = __('Network Settings'); |
|
23 | 23 | $parent_file = 'settings.php'; |
24 | 24 | |
25 | 25 | /** |
@@ -43,37 +43,37 @@ discard block |
||
43 | 43 | </script> |
44 | 44 | <?php |
45 | 45 | } |
46 | -add_action( 'admin_head', 'network_settings_add_js' ); |
|
46 | +add_action('admin_head', 'network_settings_add_js'); |
|
47 | 47 | |
48 | -get_current_screen()->add_help_tab( array( |
|
48 | +get_current_screen()->add_help_tab(array( |
|
49 | 49 | 'id' => 'overview', |
50 | 50 | 'title' => __('Overview'), |
51 | 51 | 'content' => |
52 | - '<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>' . |
|
53 | - '<p>' . __('Operational settings has fields for the network’s name and admin email.') . '</p>' . |
|
54 | - '<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>' . |
|
55 | - '<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>' . |
|
56 | - '<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>' . |
|
57 | - '<p>' . __( 'You can set the language, and the translation files will be automatically downloaded and installed (available if your filesystem is writable).' ) . '</p>' . |
|
58 | - '<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>' . |
|
59 | - '<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>' |
|
60 | -) ); |
|
52 | + '<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>'. |
|
53 | + '<p>'.__('Operational settings has fields for the network’s name and admin email.').'</p>'. |
|
54 | + '<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>'. |
|
55 | + '<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>'. |
|
56 | + '<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>'. |
|
57 | + '<p>'.__('You can set the language, and the translation files will be automatically downloaded and installed (available if your filesystem is writable).').'</p>'. |
|
58 | + '<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>'. |
|
59 | + '<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>' |
|
60 | +)); |
|
61 | 61 | |
62 | 62 | get_current_screen()->set_help_sidebar( |
63 | - '<p><strong>' . __('For more information:') . '</strong></p>' . |
|
64 | - '<p>' . __('<a href="https://codex.wordpress.org/Network_Admin_Settings_Screen" target="_blank">Documentation on Network Settings</a>') . '</p>' . |
|
65 | - '<p>' . __('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>' |
|
63 | + '<p><strong>'.__('For more information:').'</strong></p>'. |
|
64 | + '<p>'.__('<a href="https://codex.wordpress.org/Network_Admin_Settings_Screen" target="_blank">Documentation on Network Settings</a>').'</p>'. |
|
65 | + '<p>'.__('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>').'</p>' |
|
66 | 66 | ); |
67 | 67 | |
68 | -if ( $_POST ) { |
|
68 | +if ($_POST) { |
|
69 | 69 | /** This action is documented in wp-admin/network/edit.php */ |
70 | - do_action( 'wpmuadminedit' ); |
|
70 | + do_action('wpmuadminedit'); |
|
71 | 71 | |
72 | - check_admin_referer( 'siteoptions' ); |
|
72 | + check_admin_referer('siteoptions'); |
|
73 | 73 | |
74 | - $checked_options = array( 'menu_items' => array(), 'registrationnotification' => 'no', 'upload_space_check_disabled' => 1, 'add_new_users' => 0 ); |
|
75 | - foreach ( $checked_options as $option_name => $option_unchecked_value ) { |
|
76 | - if ( ! isset( $_POST[$option_name] ) ) |
|
74 | + $checked_options = array('menu_items' => array(), 'registrationnotification' => 'no', 'upload_space_check_disabled' => 1, 'add_new_users' => 0); |
|
75 | + foreach ($checked_options as $option_name => $option_unchecked_value) { |
|
76 | + if ( ! isset($_POST[$option_name])) |
|
77 | 77 | $_POST[$option_name] = $option_unchecked_value; |
78 | 78 | } |
79 | 79 | |
@@ -86,18 +86,18 @@ discard block |
||
86 | 86 | ); |
87 | 87 | |
88 | 88 | // Handle translation install. |
89 | - if ( ! empty( $_POST['WPLANG'] ) && wp_can_install_language_pack() ) { // @todo: Skip if already installed |
|
90 | - $language = wp_download_language_pack( $_POST['WPLANG'] ); |
|
91 | - if ( $language ) { |
|
89 | + if ( ! empty($_POST['WPLANG']) && wp_can_install_language_pack()) { // @todo: Skip if already installed |
|
90 | + $language = wp_download_language_pack($_POST['WPLANG']); |
|
91 | + if ($language) { |
|
92 | 92 | $_POST['WPLANG'] = $language; |
93 | 93 | } |
94 | 94 | } |
95 | 95 | |
96 | - foreach ( $options as $option_name ) { |
|
97 | - if ( ! isset($_POST[$option_name]) ) |
|
96 | + foreach ($options as $option_name) { |
|
97 | + if ( ! isset($_POST[$option_name])) |
|
98 | 98 | continue; |
99 | - $value = wp_unslash( $_POST[$option_name] ); |
|
100 | - update_site_option( $option_name, $value ); |
|
99 | + $value = wp_unslash($_POST[$option_name]); |
|
100 | + update_site_option($option_name, $value); |
|
101 | 101 | } |
102 | 102 | |
103 | 103 | /** |
@@ -105,102 +105,102 @@ discard block |
||
105 | 105 | * |
106 | 106 | * @since MU |
107 | 107 | */ |
108 | - do_action( 'update_wpmu_options' ); |
|
108 | + do_action('update_wpmu_options'); |
|
109 | 109 | |
110 | - wp_redirect( add_query_arg( 'updated', 'true', network_admin_url( 'settings.php' ) ) ); |
|
110 | + wp_redirect(add_query_arg('updated', 'true', network_admin_url('settings.php'))); |
|
111 | 111 | exit(); |
112 | 112 | } |
113 | 113 | |
114 | -include( ABSPATH . 'wp-admin/admin-header.php' ); |
|
114 | +include(ABSPATH.'wp-admin/admin-header.php'); |
|
115 | 115 | |
116 | -if ( isset( $_GET['updated'] ) ) { |
|
117 | - ?><div id="message" class="updated notice is-dismissible"><p><?php _e( 'Options saved.' ) ?></p></div><?php |
|
116 | +if (isset($_GET['updated'])) { |
|
117 | + ?><div id="message" class="updated notice is-dismissible"><p><?php _e('Options saved.') ?></p></div><?php |
|
118 | 118 | } |
119 | 119 | ?> |
120 | 120 | |
121 | 121 | <div class="wrap"> |
122 | - <h1><?php echo esc_html( $title ); ?></h1> |
|
122 | + <h1><?php echo esc_html($title); ?></h1> |
|
123 | 123 | <form method="post" action="settings.php" novalidate="novalidate"> |
124 | - <?php wp_nonce_field( 'siteoptions' ); ?> |
|
125 | - <h3><?php _e( 'Operational Settings' ); ?></h3> |
|
124 | + <?php wp_nonce_field('siteoptions'); ?> |
|
125 | + <h3><?php _e('Operational Settings'); ?></h3> |
|
126 | 126 | <table class="form-table"> |
127 | 127 | <tr> |
128 | - <th scope="row"><label for="site_name"><?php _e( 'Network Title' ) ?></label></th> |
|
128 | + <th scope="row"><label for="site_name"><?php _e('Network Title') ?></label></th> |
|
129 | 129 | <td> |
130 | - <input name="site_name" type="text" id="site_name" class="regular-text" value="<?php echo esc_attr( $current_site->site_name ) ?>" /> |
|
130 | + <input name="site_name" type="text" id="site_name" class="regular-text" value="<?php echo esc_attr($current_site->site_name) ?>" /> |
|
131 | 131 | </td> |
132 | 132 | </tr> |
133 | 133 | |
134 | 134 | <tr> |
135 | - <th scope="row"><label for="admin_email"><?php _e( 'Network Admin Email' ) ?></label></th> |
|
135 | + <th scope="row"><label for="admin_email"><?php _e('Network Admin Email') ?></label></th> |
|
136 | 136 | <td> |
137 | - <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' ) ) ?>" /> |
|
137 | + <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')) ?>" /> |
|
138 | 138 | <p class="description" id="admin-email-desc"> |
139 | - <?php _e( 'This email address will receive notifications. Registration and support emails will also come from this address.' ); ?> |
|
139 | + <?php _e('This email address will receive notifications. Registration and support emails will also come from this address.'); ?> |
|
140 | 140 | </p> |
141 | 141 | </td> |
142 | 142 | </tr> |
143 | 143 | </table> |
144 | - <h3><?php _e( 'Registration Settings' ); ?></h3> |
|
144 | + <h3><?php _e('Registration Settings'); ?></h3> |
|
145 | 145 | <table class="form-table"> |
146 | 146 | <tr> |
147 | - <th scope="row"><?php _e( 'Allow new registrations' ) ?></th> |
|
147 | + <th scope="row"><?php _e('Allow new registrations') ?></th> |
|
148 | 148 | <?php |
149 | - if ( !get_site_option( 'registration' ) ) |
|
150 | - update_site_option( 'registration', 'none' ); |
|
151 | - $reg = get_site_option( 'registration' ); |
|
149 | + if ( ! get_site_option('registration')) |
|
150 | + update_site_option('registration', 'none'); |
|
151 | + $reg = get_site_option('registration'); |
|
152 | 152 | ?> |
153 | 153 | <td> |
154 | 154 | <fieldset> |
155 | - <legend class="screen-reader-text"><?php _e( 'New registrations settings' ) ?></legend> |
|
156 | - <label><input name="registration" type="radio" id="registration1" value="none"<?php checked( $reg, 'none') ?> /> <?php _e( 'Registration is disabled.' ); ?></label><br /> |
|
157 | - <label><input name="registration" type="radio" id="registration2" value="user"<?php checked( $reg, 'user') ?> /> <?php _e( 'User accounts may be registered.' ); ?></label><br /> |
|
158 | - <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 /> |
|
159 | - <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> |
|
160 | - <?php if ( is_subdomain_install() ) { |
|
161 | - echo '<p class="description">' . __( 'If registration is disabled, please set <code>NOBLOGREDIRECT</code> in <code>wp-config.php</code> to a URL you will redirect visitors to if they visit a non-existent site.' ) . '</p>'; |
|
155 | + <legend class="screen-reader-text"><?php _e('New registrations settings') ?></legend> |
|
156 | + <label><input name="registration" type="radio" id="registration1" value="none"<?php checked($reg, 'none') ?> /> <?php _e('Registration is disabled.'); ?></label><br /> |
|
157 | + <label><input name="registration" type="radio" id="registration2" value="user"<?php checked($reg, 'user') ?> /> <?php _e('User accounts may be registered.'); ?></label><br /> |
|
158 | + <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 /> |
|
159 | + <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> |
|
160 | + <?php if (is_subdomain_install()) { |
|
161 | + echo '<p class="description">'.__('If registration is disabled, please set <code>NOBLOGREDIRECT</code> in <code>wp-config.php</code> to a URL you will redirect visitors to if they visit a non-existent site.').'</p>'; |
|
162 | 162 | } ?> |
163 | 163 | </fieldset> |
164 | 164 | </td> |
165 | 165 | </tr> |
166 | 166 | |
167 | 167 | <tr> |
168 | - <th scope="row"><?php _e( 'Registration notification' ) ?></th> |
|
168 | + <th scope="row"><?php _e('Registration notification') ?></th> |
|
169 | 169 | <?php |
170 | - if ( !get_site_option( 'registrationnotification' ) ) |
|
171 | - update_site_option( 'registrationnotification', 'yes' ); |
|
170 | + if ( ! get_site_option('registrationnotification')) |
|
171 | + update_site_option('registrationnotification', 'yes'); |
|
172 | 172 | ?> |
173 | 173 | <td> |
174 | - <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> |
|
174 | + <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> |
|
175 | 175 | </td> |
176 | 176 | </tr> |
177 | 177 | |
178 | 178 | <tr id="addnewusers"> |
179 | - <th scope="row"><?php _e( 'Add New Users' ) ?></th> |
|
179 | + <th scope="row"><?php _e('Add New Users') ?></th> |
|
180 | 180 | <td> |
181 | - <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> |
|
181 | + <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> |
|
182 | 182 | </td> |
183 | 183 | </tr> |
184 | 184 | |
185 | 185 | <tr> |
186 | - <th scope="row"><label for="illegal_names"><?php _e( 'Banned Names' ) ?></label></th> |
|
186 | + <th scope="row"><label for="illegal_names"><?php _e('Banned Names') ?></label></th> |
|
187 | 187 | <td> |
188 | - <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" /> |
|
188 | + <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" /> |
|
189 | 189 | <p class="description" id="illegal-names-desc"> |
190 | - <?php _e( 'Users are not allowed to register these sites. Separate names by spaces.' ) ?> |
|
190 | + <?php _e('Users are not allowed to register these sites. Separate names by spaces.') ?> |
|
191 | 191 | </p> |
192 | 192 | </td> |
193 | 193 | </tr> |
194 | 194 | |
195 | 195 | <tr> |
196 | - <th scope="row"><label for="limited_email_domains"><?php _e( 'Limited Email Registrations' ) ?></label></th> |
|
196 | + <th scope="row"><label for="limited_email_domains"><?php _e('Limited Email Registrations') ?></label></th> |
|
197 | 197 | <td> |
198 | - <?php $limited_email_domains = get_site_option( 'limited_email_domains' ); |
|
199 | - $limited_email_domains = str_replace( ' ', "\n", $limited_email_domains ); ?> |
|
198 | + <?php $limited_email_domains = get_site_option('limited_email_domains'); |
|
199 | + $limited_email_domains = str_replace(' ', "\n", $limited_email_domains); ?> |
|
200 | 200 | <textarea name="limited_email_domains" id="limited_email_domains" aria-describedby="limited-email-domains-desc" cols="45" rows="5"> |
201 | -<?php echo esc_textarea( $limited_email_domains == '' ? '' : implode( "\n", (array) $limited_email_domains ) ); ?></textarea> |
|
201 | +<?php echo esc_textarea($limited_email_domains == '' ? '' : implode("\n", (array) $limited_email_domains)); ?></textarea> |
|
202 | 202 | <p class="description" id="limited-email-domains-desc"> |
203 | - <?php _e( 'If you want to limit site registrations to certain domains. One domain per line.' ) ?> |
|
203 | + <?php _e('If you want to limit site registrations to certain domains. One domain per line.') ?> |
|
204 | 204 | </p> |
205 | 205 | </td> |
206 | 206 | </tr> |
@@ -209,9 +209,9 @@ discard block |
||
209 | 209 | <th scope="row"><label for="banned_email_domains"><?php _e('Banned Email Domains') ?></label></th> |
210 | 210 | <td> |
211 | 211 | <textarea name="banned_email_domains" id="banned_email_domains" aria-describedby="banned-email-domains-desc" cols="45" rows="5"> |
212 | -<?php echo esc_textarea( get_site_option( 'banned_email_domains' ) == '' ? '' : implode( "\n", (array) get_site_option( 'banned_email_domains' ) ) ); ?></textarea> |
|
212 | +<?php echo esc_textarea(get_site_option('banned_email_domains') == '' ? '' : implode("\n", (array) get_site_option('banned_email_domains'))); ?></textarea> |
|
213 | 213 | <p class="description" id="banned-email-domains-desc"> |
214 | - <?php _e( 'If you want to ban domains from site registrations. One domain per line.' ) ?> |
|
214 | + <?php _e('If you want to ban domains from site registrations. One domain per line.') ?> |
|
215 | 215 | </p> |
216 | 216 | </td> |
217 | 217 | </tr> |
@@ -221,102 +221,102 @@ discard block |
||
221 | 221 | <table class="form-table"> |
222 | 222 | |
223 | 223 | <tr> |
224 | - <th scope="row"><label for="welcome_email"><?php _e( 'Welcome Email' ) ?></label></th> |
|
224 | + <th scope="row"><label for="welcome_email"><?php _e('Welcome Email') ?></label></th> |
|
225 | 225 | <td> |
226 | 226 | <textarea name="welcome_email" id="welcome_email" aria-describedby="welcome-email-desc" rows="5" cols="45" class="large-text"> |
227 | -<?php echo esc_textarea( get_site_option( 'welcome_email' ) ) ?></textarea> |
|
227 | +<?php echo esc_textarea(get_site_option('welcome_email')) ?></textarea> |
|
228 | 228 | <p class="description" id="welcome-email-desc"> |
229 | - <?php _e( 'The welcome email sent to new site owners.' ) ?> |
|
229 | + <?php _e('The welcome email sent to new site owners.') ?> |
|
230 | 230 | </p> |
231 | 231 | </td> |
232 | 232 | </tr> |
233 | 233 | <tr> |
234 | - <th scope="row"><label for="welcome_user_email"><?php _e( 'Welcome User Email' ) ?></label></th> |
|
234 | + <th scope="row"><label for="welcome_user_email"><?php _e('Welcome User Email') ?></label></th> |
|
235 | 235 | <td> |
236 | 236 | <textarea name="welcome_user_email" id="welcome_user_email" aria-describedby="welcome-user-email-desc" rows="5" cols="45" class="large-text"> |
237 | -<?php echo esc_textarea( get_site_option( 'welcome_user_email' ) ) ?></textarea> |
|
237 | +<?php echo esc_textarea(get_site_option('welcome_user_email')) ?></textarea> |
|
238 | 238 | <p class="description" id="welcome-user-email-desc"> |
239 | - <?php _e( 'The welcome email sent to new users.' ) ?> |
|
239 | + <?php _e('The welcome email sent to new users.') ?> |
|
240 | 240 | </p> |
241 | 241 | </td> |
242 | 242 | </tr> |
243 | 243 | <tr> |
244 | - <th scope="row"><label for="first_post"><?php _e( 'First Post' ) ?></label></th> |
|
244 | + <th scope="row"><label for="first_post"><?php _e('First Post') ?></label></th> |
|
245 | 245 | <td> |
246 | 246 | <textarea name="first_post" id="first_post" aria-describedby="first-post-desc" rows="5" cols="45" class="large-text"> |
247 | -<?php echo esc_textarea( get_site_option( 'first_post' ) ) ?></textarea> |
|
247 | +<?php echo esc_textarea(get_site_option('first_post')) ?></textarea> |
|
248 | 248 | <p class="description" id="first-post-desc"> |
249 | - <?php _e( 'The first post on a new site.' ) ?> |
|
249 | + <?php _e('The first post on a new site.') ?> |
|
250 | 250 | </p> |
251 | 251 | </td> |
252 | 252 | </tr> |
253 | 253 | <tr> |
254 | - <th scope="row"><label for="first_page"><?php _e( 'First Page' ) ?></label></th> |
|
254 | + <th scope="row"><label for="first_page"><?php _e('First Page') ?></label></th> |
|
255 | 255 | <td> |
256 | 256 | <textarea name="first_page" id="first_page" aria-describedby="first-page-desc" rows="5" cols="45" class="large-text"> |
257 | -<?php echo esc_textarea( get_site_option( 'first_page' ) ) ?></textarea> |
|
257 | +<?php echo esc_textarea(get_site_option('first_page')) ?></textarea> |
|
258 | 258 | <p class="description" id="first-page-desc"> |
259 | - <?php _e( 'The first page on a new site.' ) ?> |
|
259 | + <?php _e('The first page on a new site.') ?> |
|
260 | 260 | </p> |
261 | 261 | </td> |
262 | 262 | </tr> |
263 | 263 | <tr> |
264 | - <th scope="row"><label for="first_comment"><?php _e( 'First Comment' ) ?></label></th> |
|
264 | + <th scope="row"><label for="first_comment"><?php _e('First Comment') ?></label></th> |
|
265 | 265 | <td> |
266 | 266 | <textarea name="first_comment" id="first_comment" aria-describedby="first-comment-desc" rows="5" cols="45" class="large-text"> |
267 | -<?php echo esc_textarea( get_site_option( 'first_comment' ) ) ?></textarea> |
|
267 | +<?php echo esc_textarea(get_site_option('first_comment')) ?></textarea> |
|
268 | 268 | <p class="description" id="first-comment-desc"> |
269 | - <?php _e( 'The first comment on a new site.' ) ?> |
|
269 | + <?php _e('The first comment on a new site.') ?> |
|
270 | 270 | </p> |
271 | 271 | </td> |
272 | 272 | </tr> |
273 | 273 | <tr> |
274 | - <th scope="row"><label for="first_comment_author"><?php _e( 'First Comment Author' ) ?></label></th> |
|
274 | + <th scope="row"><label for="first_comment_author"><?php _e('First Comment Author') ?></label></th> |
|
275 | 275 | <td> |
276 | 276 | <input type="text" size="40" name="first_comment_author" id="first_comment_author" aria-describedby="first-comment-author-desc" value="<?php echo get_site_option('first_comment_author') ?>" /> |
277 | 277 | <p class="description" id="first-comment-author-desc"> |
278 | - <?php _e( 'The author of the first comment on a new site.' ) ?> |
|
278 | + <?php _e('The author of the first comment on a new site.') ?> |
|
279 | 279 | </p> |
280 | 280 | </td> |
281 | 281 | </tr> |
282 | 282 | <tr> |
283 | - <th scope="row"><label for="first_comment_url"><?php _e( 'First Comment URL' ) ?></label></th> |
|
283 | + <th scope="row"><label for="first_comment_url"><?php _e('First Comment URL') ?></label></th> |
|
284 | 284 | <td> |
285 | - <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' ) ) ?>" /> |
|
285 | + <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')) ?>" /> |
|
286 | 286 | <p class="description" id="first-comment-url-desc"> |
287 | - <?php _e( 'The URL for the first comment on a new site.' ) ?> |
|
287 | + <?php _e('The URL for the first comment on a new site.') ?> |
|
288 | 288 | </p> |
289 | 289 | </td> |
290 | 290 | </tr> |
291 | 291 | </table> |
292 | - <h3><?php _e( 'Upload Settings' ); ?></h3> |
|
292 | + <h3><?php _e('Upload Settings'); ?></h3> |
|
293 | 293 | <table class="form-table"> |
294 | 294 | <tr> |
295 | - <th scope="row"><?php _e( 'Site upload space' ) ?></th> |
|
295 | + <th scope="row"><?php _e('Site upload space') ?></th> |
|
296 | 296 | <td> |
297 | - <label><input type="checkbox" id="upload_space_check_disabled" name="upload_space_check_disabled" value="0"<?php checked( get_site_option( 'upload_space_check_disabled' ), 0 ) ?>/> <?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 /> |
|
297 | + <label><input type="checkbox" id="upload_space_check_disabled" name="upload_space_check_disabled" value="0"<?php checked(get_site_option('upload_space_check_disabled'), 0) ?>/> <?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 /> |
|
298 | 298 | <p class="screen-reader-text" id="blog-upload-space-desc"> |
299 | - <?php _e( 'Size in megabytes' ) ?> |
|
299 | + <?php _e('Size in megabytes') ?> |
|
300 | 300 | </p> |
301 | 301 | </td> |
302 | 302 | </tr> |
303 | 303 | |
304 | 304 | <tr> |
305 | - <th scope="row"><label for="upload_filetypes"><?php _e( 'Upload file types' ) ?></label></th> |
|
305 | + <th scope="row"><label for="upload_filetypes"><?php _e('Upload file types') ?></label></th> |
|
306 | 306 | <td> |
307 | - <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" /> |
|
307 | + <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" /> |
|
308 | 308 | <p class="description" id="upload-filetypes-desc"> |
309 | - <?php _e( 'Allowed file types. Separate types by spaces.' ) ?> |
|
309 | + <?php _e('Allowed file types. Separate types by spaces.') ?> |
|
310 | 310 | </p> |
311 | 311 | </td> |
312 | 312 | </tr> |
313 | 313 | |
314 | 314 | <tr> |
315 | - <th scope="row"><label for="fileupload_maxk"><?php _e( 'Max upload file size' ) ?></label></th> |
|
315 | + <th scope="row"><label for="fileupload_maxk"><?php _e('Max upload file size') ?></label></th> |
|
316 | 316 | <td> |
317 | - <?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 ) ) . '" />' ); ?> |
|
317 | + <?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)).'" />'); ?> |
|
318 | 318 | <p class="screen-reader-text" id="fileupload-maxk-desc"> |
319 | - <?php _e( 'Size in kilobytes' ) ?> |
|
319 | + <?php _e('Size in kilobytes') ?> |
|
320 | 320 | </p> |
321 | 321 | </td> |
322 | 322 | </tr> |
@@ -325,27 +325,27 @@ discard block |
||
325 | 325 | <?php |
326 | 326 | $languages = get_available_languages(); |
327 | 327 | $translations = wp_get_available_translations(); |
328 | - if ( ! empty( $languages ) || ! empty( $translations ) ) { |
|
328 | + if ( ! empty($languages) || ! empty($translations)) { |
|
329 | 329 | ?> |
330 | - <h3><?php _e( 'Language Settings' ); ?></h3> |
|
330 | + <h3><?php _e('Language Settings'); ?></h3> |
|
331 | 331 | <table class="form-table"> |
332 | 332 | <tr> |
333 | - <th><label for="WPLANG"><?php _e( 'Default Language' ); ?></label></th> |
|
333 | + <th><label for="WPLANG"><?php _e('Default Language'); ?></label></th> |
|
334 | 334 | <td> |
335 | 335 | <?php |
336 | - $lang = get_site_option( 'WPLANG' ); |
|
337 | - if ( ! in_array( $lang, $languages ) ) { |
|
336 | + $lang = get_site_option('WPLANG'); |
|
337 | + if ( ! in_array($lang, $languages)) { |
|
338 | 338 | $lang = ''; |
339 | 339 | } |
340 | 340 | |
341 | - wp_dropdown_languages( array( |
|
341 | + wp_dropdown_languages(array( |
|
342 | 342 | 'name' => 'WPLANG', |
343 | 343 | 'id' => 'WPLANG', |
344 | 344 | 'selected' => $lang, |
345 | 345 | 'languages' => $languages, |
346 | 346 | 'translations' => $translations, |
347 | 347 | 'show_available_translations' => wp_can_install_language_pack(), |
348 | - ) ); |
|
348 | + )); |
|
349 | 349 | ?> |
350 | 350 | </td> |
351 | 351 | </tr> |
@@ -354,13 +354,13 @@ discard block |
||
354 | 354 | } |
355 | 355 | ?> |
356 | 356 | |
357 | - <h3><?php _e( 'Menu Settings' ); ?></h3> |
|
357 | + <h3><?php _e('Menu Settings'); ?></h3> |
|
358 | 358 | <table id="menu" class="form-table"> |
359 | 359 | <tr> |
360 | - <th scope="row"><?php _e( 'Enable administration menus' ); ?></th> |
|
360 | + <th scope="row"><?php _e('Enable administration menus'); ?></th> |
|
361 | 361 | <td> |
362 | 362 | <?php |
363 | - $menu_perms = get_site_option( 'menu_items' ); |
|
363 | + $menu_perms = get_site_option('menu_items'); |
|
364 | 364 | /** |
365 | 365 | * Filter available network-wide administration menu options. |
366 | 366 | * |
@@ -376,14 +376,14 @@ discard block |
||
376 | 376 | * |
377 | 377 | * @param array $admin_menus The menu items available. |
378 | 378 | */ |
379 | - $menu_items = apply_filters( 'mu_menu_items', array( 'plugins' => __( 'Plugins' ) ) ); |
|
379 | + $menu_items = apply_filters('mu_menu_items', array('plugins' => __('Plugins'))); |
|
380 | 380 | $fieldset_end = ''; |
381 | - if ( count( (array) $menu_items ) > 1 ) { |
|
382 | - echo '<fieldset><legend class="screen-reader-text">' . __( 'Enable menus' ) . '</legend>'; |
|
381 | + if (count((array) $menu_items) > 1) { |
|
382 | + echo '<fieldset><legend class="screen-reader-text">'.__('Enable menus').'</legend>'; |
|
383 | 383 | $fieldset_end = '</fieldset>'; |
384 | 384 | } |
385 | - foreach ( (array) $menu_items as $key => $val ) { |
|
386 | - 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/>"; |
|
385 | + foreach ((array) $menu_items as $key => $val) { |
|
386 | + 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/>"; |
|
387 | 387 | } |
388 | 388 | echo $fieldset_end; |
389 | 389 | ?> |
@@ -397,9 +397,9 @@ discard block |
||
397 | 397 | * |
398 | 398 | * @since MU |
399 | 399 | */ |
400 | - do_action( 'wpmu_options' ); ?> |
|
400 | + do_action('wpmu_options'); ?> |
|
401 | 401 | <?php submit_button(); ?> |
402 | 402 | </form> |
403 | 403 | </div> |
404 | 404 | |
405 | -<?php include( ABSPATH . 'wp-admin/admin-footer.php' ); ?> |
|
405 | +<?php include(ABSPATH.'wp-admin/admin-footer.php'); ?> |
@@ -13,11 +13,13 @@ discard block |
||
13 | 13 | /** WordPress Translation Install API */ |
14 | 14 | require_once( ABSPATH . 'wp-admin/includes/translation-install.php' ); |
15 | 15 | |
16 | -if ( ! is_multisite() ) |
|
16 | +if ( ! is_multisite() ) { |
|
17 | 17 | wp_die( __( 'Multisite support is not enabled.' ) ); |
18 | +} |
|
18 | 19 | |
19 | -if ( ! current_user_can( 'manage_network_options' ) ) |
|
20 | +if ( ! current_user_can( 'manage_network_options' ) ) { |
|
20 | 21 | wp_die( __( 'You do not have permission to access this page.' ), 403 ); |
22 | +} |
|
21 | 23 | |
22 | 24 | $title = __( 'Network Settings' ); |
23 | 25 | $parent_file = 'settings.php'; |
@@ -73,8 +75,9 @@ discard block |
||
73 | 75 | |
74 | 76 | $checked_options = array( 'menu_items' => array(), 'registrationnotification' => 'no', 'upload_space_check_disabled' => 1, 'add_new_users' => 0 ); |
75 | 77 | foreach ( $checked_options as $option_name => $option_unchecked_value ) { |
76 | - if ( ! isset( $_POST[$option_name] ) ) |
|
77 | - $_POST[$option_name] = $option_unchecked_value; |
|
78 | + if ( ! isset( $_POST[$option_name] ) ) { |
|
79 | + $_POST[$option_name] = $option_unchecked_value; |
|
80 | + } |
|
78 | 81 | } |
79 | 82 | |
80 | 83 | $options = array( |
@@ -94,8 +97,9 @@ discard block |
||
94 | 97 | } |
95 | 98 | |
96 | 99 | foreach ( $options as $option_name ) { |
97 | - if ( ! isset($_POST[$option_name]) ) |
|
98 | - continue; |
|
100 | + if ( ! isset($_POST[$option_name]) ) { |
|
101 | + continue; |
|
102 | + } |
|
99 | 103 | $value = wp_unslash( $_POST[$option_name] ); |
100 | 104 | update_site_option( $option_name, $value ); |
101 | 105 | } |
@@ -146,8 +150,9 @@ discard block |
||
146 | 150 | <tr> |
147 | 151 | <th scope="row"><?php _e( 'Allow new registrations' ) ?></th> |
148 | 152 | <?php |
149 | - if ( !get_site_option( 'registration' ) ) |
|
150 | - update_site_option( 'registration', 'none' ); |
|
153 | + if ( !get_site_option( 'registration' ) ) { |
|
154 | + update_site_option( 'registration', 'none' ); |
|
155 | + } |
|
151 | 156 | $reg = get_site_option( 'registration' ); |
152 | 157 | ?> |
153 | 158 | <td> |
@@ -167,8 +172,9 @@ discard block |
||
167 | 172 | <tr> |
168 | 173 | <th scope="row"><?php _e( 'Registration notification' ) ?></th> |
169 | 174 | <?php |
170 | - if ( !get_site_option( 'registrationnotification' ) ) |
|
171 | - update_site_option( 'registrationnotification', 'yes' ); |
|
175 | + if ( !get_site_option( 'registrationnotification' ) ) { |
|
176 | + update_site_option( 'registrationnotification', 'yes' ); |
|
177 | + } |
|
172 | 178 | ?> |
173 | 179 | <td> |
174 | 180 | <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> |
@@ -1,11 +1,11 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * Edit Site Settings Administration Screen |
|
4 | - * |
|
5 | - * @package WordPress |
|
6 | - * @subpackage Multisite |
|
7 | - * @since 3.1.0 |
|
8 | - */ |
|
3 | + * Edit Site Settings Administration Screen |
|
4 | + * |
|
5 | + * @package WordPress |
|
6 | + * @subpackage Multisite |
|
7 | + * @since 3.1.0 |
|
8 | + */ |
|
9 | 9 | |
10 | 10 | /** Load WordPress Administration Bootstrap */ |
11 | 11 | require_once( dirname( __FILE__ ) . '/admin.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( __( 'You do not have sufficient permissions to edit this site.' ) ); |
|
16 | +if ( ! current_user_can('manage_sites')) |
|
17 | + wp_die(__('You do not have sufficient permissions 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 domain and path are 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 domain and path are 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( __( 'You do not have permission to access this page.' ), 403 ); |
|
46 | +if ( ! can_edit_network($details->site_id)) |
|
47 | + wp_die(__('You do not have permission 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 | /** |
@@ -67,92 +67,92 @@ discard block |
||
67 | 67 | * |
68 | 68 | * @since 3.0.0 |
69 | 69 | */ |
70 | - do_action( 'wpmu_update_blog_options' ); |
|
70 | + do_action('wpmu_update_blog_options'); |
|
71 | 71 | restore_current_blog(); |
72 | - wp_redirect( add_query_arg( array( 'update' => 'updated', 'id' => $id ), 'site-settings.php') ); |
|
72 | + wp_redirect(add_query_arg(array('update' => 'updated', 'id' => $id), 'site-settings.php')); |
|
73 | 73 | exit; |
74 | 74 | } |
75 | 75 | |
76 | -if ( isset($_GET['update']) ) { |
|
76 | +if (isset($_GET['update'])) { |
|
77 | 77 | $messages = array(); |
78 | - if ( 'updated' == $_GET['update'] ) |
|
78 | + if ('updated' == $_GET['update']) |
|
79 | 79 | $messages[] = __('Site options updated.'); |
80 | 80 | } |
81 | 81 | |
82 | -$title = sprintf( __( 'Edit Site: %s' ), esc_html( $details->blogname ) ); |
|
82 | +$title = sprintf(__('Edit Site: %s'), esc_html($details->blogname)); |
|
83 | 83 | |
84 | 84 | $parent_file = 'sites.php'; |
85 | 85 | $submenu_file = 'sites.php'; |
86 | 86 | |
87 | -require( ABSPATH . 'wp-admin/admin-header.php' ); |
|
87 | +require(ABSPATH.'wp-admin/admin-header.php'); |
|
88 | 88 | |
89 | 89 | ?> |
90 | 90 | |
91 | 91 | <div class="wrap"> |
92 | 92 | <h1 id="edit-site"><?php echo $title; ?></h1> |
93 | -<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> |
|
93 | +<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> |
|
94 | 94 | <h3 class="nav-tab-wrapper"> |
95 | 95 | <?php |
96 | 96 | $tabs = array( |
97 | - 'site-info' => array( 'label' => __( 'Info' ), 'url' => 'site-info.php' ), |
|
98 | - 'site-users' => array( 'label' => __( 'Users' ), 'url' => 'site-users.php' ), |
|
99 | - 'site-themes' => array( 'label' => __( 'Themes' ), 'url' => 'site-themes.php' ), |
|
100 | - 'site-settings' => array( 'label' => __( 'Settings' ), 'url' => 'site-settings.php' ), |
|
97 | + 'site-info' => array('label' => __('Info'), 'url' => 'site-info.php'), |
|
98 | + 'site-users' => array('label' => __('Users'), 'url' => 'site-users.php'), |
|
99 | + 'site-themes' => array('label' => __('Themes'), 'url' => 'site-themes.php'), |
|
100 | + 'site-settings' => array('label' => __('Settings'), 'url' => 'site-settings.php'), |
|
101 | 101 | ); |
102 | -foreach ( $tabs as $tab_id => $tab ) { |
|
103 | - $class = ( $tab['url'] == $pagenow ) ? ' nav-tab-active' : ''; |
|
104 | - echo '<a href="' . $tab['url'] . '?id=' . $id .'" class="nav-tab' . $class . '">' . esc_html( $tab['label'] ) . '</a>'; |
|
102 | +foreach ($tabs as $tab_id => $tab) { |
|
103 | + $class = ($tab['url'] == $pagenow) ? ' nav-tab-active' : ''; |
|
104 | + echo '<a href="'.$tab['url'].'?id='.$id.'" class="nav-tab'.$class.'">'.esc_html($tab['label']).'</a>'; |
|
105 | 105 | } |
106 | 106 | ?> |
107 | 107 | </h3> |
108 | 108 | <?php |
109 | -if ( ! empty( $messages ) ) { |
|
110 | - foreach ( $messages as $msg ) |
|
111 | - echo '<div id="message" class="updated notice is-dismissible"><p>' . $msg . '</p></div>'; |
|
109 | +if ( ! empty($messages)) { |
|
110 | + foreach ($messages as $msg) |
|
111 | + echo '<div id="message" class="updated notice is-dismissible"><p>'.$msg.'</p></div>'; |
|
112 | 112 | } ?> |
113 | 113 | <form method="post" action="site-settings.php?action=update-site"> |
114 | - <?php wp_nonce_field( 'edit-site' ); ?> |
|
115 | - <input type="hidden" name="id" value="<?php echo esc_attr( $id ) ?>" /> |
|
114 | + <?php wp_nonce_field('edit-site'); ?> |
|
115 | + <input type="hidden" name="id" value="<?php echo esc_attr($id) ?>" /> |
|
116 | 116 | <table class="form-table"> |
117 | 117 | <?php |
118 | - $blog_prefix = $wpdb->get_blog_prefix( $id ); |
|
118 | + $blog_prefix = $wpdb->get_blog_prefix($id); |
|
119 | 119 | $sql = "SELECT * FROM {$blog_prefix}options |
120 | 120 | WHERE option_name NOT LIKE %s |
121 | 121 | AND option_name NOT LIKE %s"; |
122 | - $query = $wpdb->prepare( $sql, |
|
123 | - $wpdb->esc_like( '_' ) . '%', |
|
124 | - '%' . $wpdb->esc_like( 'user_roles' ) |
|
122 | + $query = $wpdb->prepare($sql, |
|
123 | + $wpdb->esc_like('_').'%', |
|
124 | + '%'.$wpdb->esc_like('user_roles') |
|
125 | 125 | ); |
126 | - $options = $wpdb->get_results( $query ); |
|
127 | - foreach ( $options as $option ) { |
|
128 | - if ( $option->option_name == 'default_role' ) |
|
126 | + $options = $wpdb->get_results($query); |
|
127 | + foreach ($options as $option) { |
|
128 | + if ($option->option_name == 'default_role') |
|
129 | 129 | $editblog_default_role = $option->option_value; |
130 | 130 | $disabled = false; |
131 | 131 | $class = 'all-options'; |
132 | - if ( is_serialized( $option->option_value ) ) { |
|
133 | - if ( is_serialized_string( $option->option_value ) ) { |
|
134 | - $option->option_value = esc_html( maybe_unserialize( $option->option_value ) ); |
|
132 | + if (is_serialized($option->option_value)) { |
|
133 | + if (is_serialized_string($option->option_value)) { |
|
134 | + $option->option_value = esc_html(maybe_unserialize($option->option_value)); |
|
135 | 135 | } else { |
136 | 136 | $option->option_value = 'SERIALIZED DATA'; |
137 | 137 | $disabled = true; |
138 | 138 | $class = 'all-options disabled'; |
139 | 139 | } |
140 | 140 | } |
141 | - if ( strpos( $option->option_value, "\n" ) !== false ) { |
|
141 | + if (strpos($option->option_value, "\n") !== false) { |
|
142 | 142 | ?> |
143 | 143 | <tr class="form-field"> |
144 | - <th scope="row"><label for="<?php echo esc_attr( $option->option_name ) ?>"><?php echo ucwords( str_replace( "_", " ", $option->option_name ) ) ?></label></th> |
|
145 | - <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> |
|
144 | + <th scope="row"><label for="<?php echo esc_attr($option->option_name) ?>"><?php echo ucwords(str_replace("_", " ", $option->option_name)) ?></label></th> |
|
145 | + <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> |
|
146 | 146 | </tr> |
147 | 147 | <?php |
148 | 148 | } else { |
149 | 149 | ?> |
150 | 150 | <tr class="form-field"> |
151 | - <th scope="row"><label for="<?php echo esc_attr( $option->option_name ) ?>"><?php echo esc_html( ucwords( str_replace( "_", " ", $option->option_name ) ) ); ?></label></th> |
|
152 | - <?php if ( $is_main_site && in_array( $option->option_name, array( 'siteurl', 'home' ) ) ) { ?> |
|
153 | - <td><code><?php echo esc_html( $option->option_value ) ?></code></td> |
|
151 | + <th scope="row"><label for="<?php echo esc_attr($option->option_name) ?>"><?php echo esc_html(ucwords(str_replace("_", " ", $option->option_name))); ?></label></th> |
|
152 | + <?php if ($is_main_site && in_array($option->option_name, array('siteurl', 'home'))) { ?> |
|
153 | + <td><code><?php echo esc_html($option->option_value) ?></code></td> |
|
154 | 154 | <?php } else { ?> |
155 | - <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> |
|
155 | + <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> |
|
156 | 156 | <?php } ?> |
157 | 157 | </tr> |
158 | 158 | <?php |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | * |
166 | 166 | * @param int $id Site ID. |
167 | 167 | */ |
168 | - do_action( 'wpmueditblogaction', $id ); |
|
168 | + do_action('wpmueditblogaction', $id); |
|
169 | 169 | ?> |
170 | 170 | </table> |
171 | 171 | <?php submit_button(); ?> |
@@ -173,4 +173,4 @@ discard block |
||
173 | 173 | |
174 | 174 | </div> |
175 | 175 | <?php |
176 | -require( ABSPATH . 'wp-admin/admin-footer.php' ); |
|
176 | +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( 'manage_sites' ) ) |
|
17 | +if ( ! current_user_can( 'manage_sites' ) ) { |
|
17 | 18 | wp_die( __( 'You do not have sufficient permissions to edit this site.' ) ); |
19 | +} |
|
18 | 20 | |
19 | 21 | get_current_screen()->add_help_tab( array( |
20 | 22 | 'id' => 'overview', |
@@ -35,16 +37,18 @@ discard block |
||
35 | 37 | |
36 | 38 | $id = isset( $_REQUEST['id'] ) ? intval( $_REQUEST['id'] ) : 0; |
37 | 39 | |
38 | -if ( ! $id ) |
|
40 | +if ( ! $id ) { |
|
39 | 41 | wp_die( __('Invalid site ID.') ); |
42 | +} |
|
40 | 43 | |
41 | 44 | $details = get_blog_details( $id ); |
42 | 45 | if ( ! $details ) { |
43 | 46 | wp_die( __( 'The requested site does not exist.' ) ); |
44 | 47 | } |
45 | 48 | |
46 | -if ( !can_edit_network( $details->site_id ) ) |
|
49 | +if ( !can_edit_network( $details->site_id ) ) { |
|
47 | 50 | wp_die( __( 'You do not have permission to access this page.' ), 403 ); |
51 | +} |
|
48 | 52 | |
49 | 53 | $is_main_site = is_main_site( $id ); |
50 | 54 | |
@@ -57,8 +61,10 @@ discard block |
||
57 | 61 | foreach ( (array) $_POST['option'] as $key => $val ) { |
58 | 62 | $key = wp_unslash( $key ); |
59 | 63 | $val = wp_unslash( $val ); |
60 | - if ( $key === 0 || is_array( $val ) || in_array($key, $skip_options) ) |
|
61 | - continue; // Avoids "0 is a protected WP option and may not be modified" error when edit blog options |
|
64 | + if ( $key === 0 || is_array( $val ) || in_array($key, $skip_options) ) { |
|
65 | + continue; |
|
66 | + } |
|
67 | + // Avoids "0 is a protected WP option and may not be modified" error when edit blog options |
|
62 | 68 | update_option( $key, $val ); |
63 | 69 | } |
64 | 70 | |
@@ -75,9 +81,10 @@ discard block |
||
75 | 81 | |
76 | 82 | if ( isset($_GET['update']) ) { |
77 | 83 | $messages = array(); |
78 | - if ( 'updated' == $_GET['update'] ) |
|
79 | - $messages[] = __('Site options updated.'); |
|
80 | -} |
|
84 | + if ( 'updated' == $_GET['update'] ) { |
|
85 | + $messages[] = __('Site options updated.'); |
|
86 | + } |
|
87 | + } |
|
81 | 88 | |
82 | 89 | $title = sprintf( __( 'Edit Site: %s' ), esc_html( $details->blogname ) ); |
83 | 90 | |
@@ -107,9 +114,10 @@ discard block |
||
107 | 114 | </h3> |
108 | 115 | <?php |
109 | 116 | if ( ! empty( $messages ) ) { |
110 | - foreach ( $messages as $msg ) |
|
111 | - echo '<div id="message" class="updated notice is-dismissible"><p>' . $msg . '</p></div>'; |
|
112 | -} ?> |
|
117 | + foreach ( $messages as $msg ) { |
|
118 | + echo '<div id="message" class="updated notice is-dismissible"><p>' . $msg . '</p></div>'; |
|
119 | + } |
|
120 | + } ?> |
|
113 | 121 | <form method="post" action="site-settings.php?action=update-site"> |
114 | 122 | <?php wp_nonce_field( 'edit-site' ); ?> |
115 | 123 | <input type="hidden" name="id" value="<?php echo esc_attr( $id ) ?>" /> |
@@ -125,8 +133,9 @@ discard block |
||
125 | 133 | ); |
126 | 134 | $options = $wpdb->get_results( $query ); |
127 | 135 | foreach ( $options as $option ) { |
128 | - if ( $option->option_name == 'default_role' ) |
|
129 | - $editblog_default_role = $option->option_value; |
|
136 | + if ( $option->option_name == 'default_role' ) { |
|
137 | + $editblog_default_role = $option->option_value; |
|
138 | + } |
|
130 | 139 | $disabled = false; |
131 | 140 | $class = 'all-options'; |
132 | 141 | if ( is_serialized( $option->option_value ) ) { |
@@ -1,11 +1,11 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * Add New User network administration panel. |
|
4 | - * |
|
5 | - * @package WordPress |
|
6 | - * @subpackage Multisite |
|
7 | - * @since 3.1.0 |
|
8 | - */ |
|
3 | + * Add New User network administration panel. |
|
4 | + * |
|
5 | + * @package WordPress |
|
6 | + * @subpackage Multisite |
|
7 | + * @since 3.1.0 |
|
8 | + */ |
|
9 | 9 | |
10 | 10 | /** Load WordPress Administration Bootstrap */ |
11 | 11 | require_once( dirname( __FILE__ ) . '/admin.php' ); |
@@ -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 | -if ( ! current_user_can('create_users') ) |
|
16 | +if ( ! current_user_can('create_users')) |
|
17 | 17 | wp_die(__('You do not have sufficient permissions 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( __( 'You do not have permission to access this page.' ), 403 ); |
|
36 | + if ( ! current_user_can('manage_network_users')) |
|
37 | + wp_die(__('You do not have permission 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 | - wp_new_user_notification( $user_id, 'both' ); |
|
55 | - wp_redirect( add_query_arg( array('update' => 'added'), 'user-new.php' ) ); |
|
54 | + wp_new_user_notification($user_id, 'both'); |
|
55 | + wp_redirect(add_query_arg(array('update' => 'added'), 'user-new.php')); |
|
56 | 56 | exit; |
57 | 57 | } |
58 | 58 | } |
59 | 59 | } |
60 | 60 | |
61 | -if ( isset($_GET['update']) ) { |
|
61 | +if (isset($_GET['update'])) { |
|
62 | 62 | $messages = array(); |
63 | - if ( 'added' == $_GET['update'] ) |
|
63 | + if ('added' == $_GET['update']) |
|
64 | 64 | $messages[] = __('User added.'); |
65 | 65 | } |
66 | 66 | |
67 | 67 | $title = __('Add New User'); |
68 | 68 | $parent_file = 'users.php'; |
69 | 69 | |
70 | -require( ABSPATH . 'wp-admin/admin-header.php' ); ?> |
|
70 | +require(ABSPATH.'wp-admin/admin-header.php'); ?> |
|
71 | 71 | |
72 | 72 | <div class="wrap"> |
73 | -<h1 id="add-new-user"><?php _e( 'Add New User' ); ?></h1> |
|
73 | +<h1 id="add-new-user"><?php _e('Add New User'); ?></h1> |
|
74 | 74 | <?php |
75 | -if ( ! empty( $messages ) ) { |
|
76 | - foreach ( $messages as $msg ) |
|
77 | - echo '<div id="message" class="updated notice is-dismissible"><p>' . $msg . '</p></div>'; |
|
75 | +if ( ! empty($messages)) { |
|
76 | + foreach ($messages as $msg) |
|
77 | + echo '<div id="message" class="updated notice is-dismissible"><p>'.$msg.'</p></div>'; |
|
78 | 78 | } |
79 | 79 | |
80 | -if ( isset( $add_user_errors ) && is_wp_error( $add_user_errors ) ) { ?> |
|
80 | +if (isset($add_user_errors) && is_wp_error($add_user_errors)) { ?> |
|
81 | 81 | <div class="error"> |
82 | 82 | <?php |
83 | - foreach ( $add_user_errors->get_error_messages() as $message ) |
|
83 | + foreach ($add_user_errors->get_error_messages() as $message) |
|
84 | 84 | echo "<p>$message</p>"; |
85 | 85 | ?> |
86 | 86 | </div> |
@@ -88,20 +88,20 @@ discard block |
||
88 | 88 | <form action="<?php echo network_admin_url('user-new.php?action=add-user'); ?>" id="adduser" method="post" novalidate="novalidate"> |
89 | 89 | <table class="form-table"> |
90 | 90 | <tr class="form-field form-required"> |
91 | - <th scope="row"><label for="username"><?php _e( 'Username' ) ?></label></th> |
|
91 | + <th scope="row"><label for="username"><?php _e('Username') ?></label></th> |
|
92 | 92 | <td><input type="text" class="regular-text" name="user[username]" id="username" autocapitalize="none" autocorrect="off" /></td> |
93 | 93 | </tr> |
94 | 94 | <tr class="form-field form-required"> |
95 | - <th scope="row"><label for="email"><?php _e( 'Email' ) ?></label></th> |
|
95 | + <th scope="row"><label for="email"><?php _e('Email') ?></label></th> |
|
96 | 96 | <td><input type="email" class="regular-text" name="user[email]" id="email"/></td> |
97 | 97 | </tr> |
98 | 98 | <tr class="form-field"> |
99 | - <td colspan="2"><?php _e( 'A password reset link will be sent to the user via email.' ) ?></td> |
|
99 | + <td colspan="2"><?php _e('A password reset link will be sent to the user via email.') ?></td> |
|
100 | 100 | </tr> |
101 | 101 | </table> |
102 | - <?php wp_nonce_field( 'add-user', '_wpnonce_add-user' ); ?> |
|
103 | - <?php submit_button( __('Add User'), 'primary', 'add-user' ); ?> |
|
102 | + <?php wp_nonce_field('add-user', '_wpnonce_add-user'); ?> |
|
103 | + <?php submit_button(__('Add User'), 'primary', 'add-user'); ?> |
|
104 | 104 | </form> |
105 | 105 | </div> |
106 | 106 | <?php |
107 | -require( ABSPATH . 'wp-admin/admin-footer.php' ); |
|
107 | +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(__('You do not have sufficient permissions 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( __( 'You do not have permission to access this page.' ), 403 ); |
|
38 | + if ( ! current_user_can( 'manage_network_users' ) ) { |
|
39 | + wp_die( __( 'You do not have permission 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 | |
@@ -60,9 +64,10 @@ discard block |
||
60 | 64 | |
61 | 65 | if ( isset($_GET['update']) ) { |
62 | 66 | $messages = array(); |
63 | - if ( 'added' == $_GET['update'] ) |
|
64 | - $messages[] = __('User added.'); |
|
65 | -} |
|
67 | + if ( 'added' == $_GET['update'] ) { |
|
68 | + $messages[] = __('User added.'); |
|
69 | + } |
|
70 | + } |
|
66 | 71 | |
67 | 72 | $title = __('Add New User'); |
68 | 73 | $parent_file = 'users.php'; |
@@ -73,15 +78,17 @@ discard block |
||
73 | 78 | <h1 id="add-new-user"><?php _e( 'Add New User' ); ?></h1> |
74 | 79 | <?php |
75 | 80 | if ( ! empty( $messages ) ) { |
76 | - foreach ( $messages as $msg ) |
|
77 | - echo '<div id="message" class="updated notice is-dismissible"><p>' . $msg . '</p></div>'; |
|
78 | -} |
|
81 | + foreach ( $messages as $msg ) { |
|
82 | + echo '<div id="message" class="updated notice is-dismissible"><p>' . $msg . '</p></div>'; |
|
83 | + } |
|
84 | + } |
|
79 | 85 | |
80 | 86 | if ( isset( $add_user_errors ) && is_wp_error( $add_user_errors ) ) { ?> |
81 | 87 | <div class="error"> |
82 | 88 | <?php |
83 | - foreach ( $add_user_errors->get_error_messages() as $message ) |
|
84 | - echo "<p>$message</p>"; |
|
89 | + foreach ( $add_user_errors->get_error_messages() as $message ) { |
|
90 | + echo "<p>$message</p>"; |
|
91 | + } |
|
85 | 92 | ?> |
86 | 93 | </div> |
87 | 94 | <?php } ?> |
@@ -1,11 +1,11 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * WordPress Network Administration Bootstrap |
|
4 | - * |
|
5 | - * @package WordPress |
|
6 | - * @subpackage Multisite |
|
7 | - * @since 3.1.0 |
|
8 | - */ |
|
3 | + * WordPress Network Administration Bootstrap |
|
4 | + * |
|
5 | + * @package WordPress |
|
6 | + * @subpackage Multisite |
|
7 | + * @since 3.1.0 |
|
8 | + */ |
|
9 | 9 | |
10 | 10 | define( 'WP_NETWORK_ADMIN', true ); |
11 | 11 |
@@ -7,15 +7,15 @@ discard block |
||
7 | 7 | * @since 3.1.0 |
8 | 8 | */ |
9 | 9 | |
10 | -define( 'WP_NETWORK_ADMIN', true ); |
|
10 | +define('WP_NETWORK_ADMIN', true); |
|
11 | 11 | |
12 | 12 | /** Load WordPress Administration Bootstrap */ |
13 | -require_once( dirname( dirname( __FILE__ ) ) . '/admin.php' ); |
|
13 | +require_once(dirname(dirname(__FILE__)).'/admin.php'); |
|
14 | 14 | |
15 | -if ( ! is_multisite() ) |
|
16 | - wp_die( __( 'Multisite support is not enabled.' ) ); |
|
15 | +if ( ! is_multisite()) |
|
16 | + wp_die(__('Multisite support is not enabled.')); |
|
17 | 17 | |
18 | -$redirect_network_admin_request = 0 !== strcasecmp( $current_blog->domain, $current_site->domain ) || 0 !== strcasecmp( $current_blog->path, $current_site->path ); |
|
18 | +$redirect_network_admin_request = 0 !== strcasecmp($current_blog->domain, $current_site->domain) || 0 !== strcasecmp($current_blog->path, $current_site->path); |
|
19 | 19 | |
20 | 20 | /** |
21 | 21 | * Filter whether to redirect the request to the Network Admin. |
@@ -24,9 +24,9 @@ discard block |
||
24 | 24 | * |
25 | 25 | * @param bool $redirect_network_admin_request Whether the request should be redirected. |
26 | 26 | */ |
27 | -$redirect_network_admin_request = apply_filters( 'redirect_network_admin_request', $redirect_network_admin_request ); |
|
28 | -if ( $redirect_network_admin_request ) { |
|
29 | - wp_redirect( network_admin_url() ); |
|
27 | +$redirect_network_admin_request = apply_filters('redirect_network_admin_request', $redirect_network_admin_request); |
|
28 | +if ($redirect_network_admin_request) { |
|
29 | + wp_redirect(network_admin_url()); |
|
30 | 30 | exit; |
31 | 31 | } |
32 | -unset( $redirect_network_admin_request ); |
|
32 | +unset($redirect_network_admin_request); |
@@ -12,8 +12,9 @@ |
||
12 | 12 | /** Load WordPress Administration Bootstrap */ |
13 | 13 | require_once( dirname( dirname( __FILE__ ) ) . '/admin.php' ); |
14 | 14 | |
15 | -if ( ! is_multisite() ) |
|
15 | +if ( ! is_multisite() ) { |
|
16 | 16 | wp_die( __( 'Multisite support is not enabled.' ) ); |
17 | +} |
|
17 | 18 | |
18 | 19 | $redirect_network_admin_request = 0 !== strcasecmp( $current_blog->domain, $current_site->domain ) || 0 !== strcasecmp( $current_blog->path, $current_site->path ); |
19 | 20 |
@@ -1,11 +1,11 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * Install plugin network administration panel. |
|
4 | - * |
|
5 | - * @package WordPress |
|
6 | - * @subpackage Multisite |
|
7 | - * @since 3.1.0 |
|
8 | - */ |
|
3 | + * Install plugin network administration panel. |
|
4 | + * |
|
5 | + * @package WordPress |
|
6 | + * @subpackage Multisite |
|
7 | + * @since 3.1.0 |
|
8 | + */ |
|
9 | 9 | |
10 | 10 | if ( isset( $_GET['tab'] ) && ( 'plugin-information' == $_GET['tab'] ) ) |
11 | 11 | define( 'IFRAME_REQUEST', true ); |
@@ -7,13 +7,13 @@ |
||
7 | 7 | * @since 3.1.0 |
8 | 8 | */ |
9 | 9 | |
10 | -if ( isset( $_GET['tab'] ) && ( 'plugin-information' == $_GET['tab'] ) ) |
|
11 | - define( 'IFRAME_REQUEST', true ); |
|
10 | +if (isset($_GET['tab']) && ('plugin-information' == $_GET['tab'])) |
|
11 | + define('IFRAME_REQUEST', true); |
|
12 | 12 | |
13 | 13 | /** Load WordPress Administration Bootstrap */ |
14 | -require_once( dirname( __FILE__ ) . '/admin.php' ); |
|
14 | +require_once(dirname(__FILE__).'/admin.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 | -require( ABSPATH . 'wp-admin/plugin-install.php' ); |
|
19 | +require(ABSPATH.'wp-admin/plugin-install.php'); |
@@ -7,13 +7,15 @@ |
||
7 | 7 | * @since 3.1.0 |
8 | 8 | */ |
9 | 9 | |
10 | -if ( isset( $_GET['tab'] ) && ( 'plugin-information' == $_GET['tab'] ) ) |
|
10 | +if ( isset( $_GET['tab'] ) && ( 'plugin-information' == $_GET['tab'] ) ) { |
|
11 | 11 | define( 'IFRAME_REQUEST', true ); |
12 | +} |
|
12 | 13 | |
13 | 14 | /** Load WordPress Administration Bootstrap */ |
14 | 15 | require_once( dirname( __FILE__ ) . '/admin.php' ); |
15 | 16 | |
16 | -if ( ! is_multisite() ) |
|
17 | +if ( ! is_multisite() ) { |
|
17 | 18 | wp_die( __( 'Multisite support is not enabled.' ) ); |
19 | +} |
|
18 | 20 | |
19 | 21 | require( ABSPATH . 'wp-admin/plugin-install.php' ); |