@@ -10,64 +10,64 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | /** Load WordPress Administration Bootstrap */ |
13 | -require_once( dirname( __FILE__ ) . '/admin.php' ); |
|
13 | +require_once(dirname(__FILE__).'/admin.php'); |
|
14 | 14 | |
15 | -if (!current_user_can('upload_files')) |
|
15 | +if ( ! current_user_can('upload_files')) |
|
16 | 16 | wp_die(__('You do not have permission to upload files.')); |
17 | 17 | |
18 | 18 | wp_enqueue_script('plupload-handlers'); |
19 | 19 | |
20 | 20 | $post_id = 0; |
21 | -if ( isset( $_REQUEST['post_id'] ) ) { |
|
22 | - $post_id = absint( $_REQUEST['post_id'] ); |
|
23 | - if ( ! get_post( $post_id ) || ! current_user_can( 'edit_post', $post_id ) ) |
|
21 | +if (isset($_REQUEST['post_id'])) { |
|
22 | + $post_id = absint($_REQUEST['post_id']); |
|
23 | + if ( ! get_post($post_id) || ! current_user_can('edit_post', $post_id)) |
|
24 | 24 | $post_id = 0; |
25 | 25 | } |
26 | 26 | |
27 | -if ( $_POST ) { |
|
28 | - if ( isset($_POST['html-upload']) && !empty($_FILES) ) { |
|
27 | +if ($_POST) { |
|
28 | + if (isset($_POST['html-upload']) && ! empty($_FILES)) { |
|
29 | 29 | check_admin_referer('media-form'); |
30 | 30 | // Upload File button was clicked |
31 | - $upload_id = media_handle_upload( 'async-upload', $post_id ); |
|
32 | - if ( is_wp_error( $upload_id ) ) { |
|
33 | - wp_die( $upload_id ); |
|
31 | + $upload_id = media_handle_upload('async-upload', $post_id); |
|
32 | + if (is_wp_error($upload_id)) { |
|
33 | + wp_die($upload_id); |
|
34 | 34 | } |
35 | 35 | } |
36 | - wp_redirect( admin_url( 'upload.php' ) ); |
|
36 | + wp_redirect(admin_url('upload.php')); |
|
37 | 37 | exit; |
38 | 38 | } |
39 | 39 | |
40 | 40 | $title = __('Upload New Media'); |
41 | 41 | $parent_file = 'upload.php'; |
42 | 42 | |
43 | -get_current_screen()->add_help_tab( array( |
|
43 | +get_current_screen()->add_help_tab(array( |
|
44 | 44 | 'id' => 'overview', |
45 | 45 | 'title' => __('Overview'), |
46 | 46 | 'content' => |
47 | - '<p>' . __('You can upload media files here without creating a post first. This allows you to upload files to use with posts and pages later and/or to get a web link for a particular file that you can share. There are three options for uploading files:') . '</p>' . |
|
48 | - '<ul>' . |
|
49 | - '<li>' . __('<strong>Drag and drop</strong> your files into the area below. Multiple files are allowed.') . '</li>' . |
|
50 | - '<li>' . __('Clicking <strong>Select Files</strong> opens a navigation window showing you files in your operating system. Selecting <strong>Open</strong> after clicking on the file you want activates a progress bar on the uploader screen.') . '</li>' . |
|
51 | - '<li>' . __('Revert to the <strong>Browser Uploader</strong> by clicking the link below the drag and drop box.') . '</li>' . |
|
47 | + '<p>'.__('You can upload media files here without creating a post first. This allows you to upload files to use with posts and pages later and/or to get a web link for a particular file that you can share. There are three options for uploading files:').'</p>'. |
|
48 | + '<ul>'. |
|
49 | + '<li>'.__('<strong>Drag and drop</strong> your files into the area below. Multiple files are allowed.').'</li>'. |
|
50 | + '<li>'.__('Clicking <strong>Select Files</strong> opens a navigation window showing you files in your operating system. Selecting <strong>Open</strong> after clicking on the file you want activates a progress bar on the uploader screen.').'</li>'. |
|
51 | + '<li>'.__('Revert to the <strong>Browser Uploader</strong> by clicking the link below the drag and drop box.').'</li>'. |
|
52 | 52 | '</ul>' |
53 | -) ); |
|
53 | +)); |
|
54 | 54 | get_current_screen()->set_help_sidebar( |
55 | - '<p><strong>' . __('For more information:') . '</strong></p>' . |
|
56 | - '<p>' . __('<a href="https://codex.wordpress.org/Media_Add_New_Screen" target="_blank">Documentation on Uploading Media Files</a>') . '</p>' . |
|
57 | - '<p>' . __('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>' |
|
55 | + '<p><strong>'.__('For more information:').'</strong></p>'. |
|
56 | + '<p>'.__('<a href="https://codex.wordpress.org/Media_Add_New_Screen" target="_blank">Documentation on Uploading Media Files</a>').'</p>'. |
|
57 | + '<p>'.__('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>').'</p>' |
|
58 | 58 | ); |
59 | 59 | |
60 | -require_once( ABSPATH . 'wp-admin/admin-header.php' ); |
|
60 | +require_once(ABSPATH.'wp-admin/admin-header.php'); |
|
61 | 61 | |
62 | 62 | $form_class = 'media-upload-form type-form validate'; |
63 | 63 | |
64 | -if ( get_user_setting('uploader') || isset( $_GET['browser-uploader'] ) ) |
|
64 | +if (get_user_setting('uploader') || isset($_GET['browser-uploader'])) |
|
65 | 65 | $form_class .= ' html-uploader'; |
66 | 66 | ?> |
67 | 67 | <div class="wrap"> |
68 | - <h1><?php echo esc_html( $title ); ?></h1> |
|
68 | + <h1><?php echo esc_html($title); ?></h1> |
|
69 | 69 | |
70 | - <form enctype="multipart/form-data" method="post" action="<?php echo admin_url('media-new.php'); ?>" class="<?php echo esc_attr( $form_class ); ?>" id="file-form"> |
|
70 | + <form enctype="multipart/form-data" method="post" action="<?php echo admin_url('media-new.php'); ?>" class="<?php echo esc_attr($form_class); ?>" id="file-form"> |
|
71 | 71 | |
72 | 72 | <?php media_upload_form(); ?> |
73 | 73 | |
@@ -81,4 +81,4 @@ discard block |
||
81 | 81 | </div> |
82 | 82 | |
83 | 83 | <?php |
84 | -include( ABSPATH . 'wp-admin/admin-footer.php' ); |
|
84 | +include(ABSPATH.'wp-admin/admin-footer.php'); |
@@ -12,17 +12,19 @@ discard block |
||
12 | 12 | /** Load WordPress Administration Bootstrap */ |
13 | 13 | require_once( dirname( __FILE__ ) . '/admin.php' ); |
14 | 14 | |
15 | -if (!current_user_can('upload_files')) |
|
15 | +if (!current_user_can('upload_files')) { |
|
16 | 16 | wp_die(__('You do not have permission to upload files.')); |
17 | +} |
|
17 | 18 | |
18 | 19 | wp_enqueue_script('plupload-handlers'); |
19 | 20 | |
20 | 21 | $post_id = 0; |
21 | 22 | if ( isset( $_REQUEST['post_id'] ) ) { |
22 | 23 | $post_id = absint( $_REQUEST['post_id'] ); |
23 | - if ( ! get_post( $post_id ) || ! current_user_can( 'edit_post', $post_id ) ) |
|
24 | - $post_id = 0; |
|
25 | -} |
|
24 | + if ( ! get_post( $post_id ) || ! current_user_can( 'edit_post', $post_id ) ) { |
|
25 | + $post_id = 0; |
|
26 | + } |
|
27 | + } |
|
26 | 28 | |
27 | 29 | if ( $_POST ) { |
28 | 30 | if ( isset($_POST['html-upload']) && !empty($_FILES) ) { |
@@ -61,8 +63,9 @@ discard block |
||
61 | 63 | |
62 | 64 | $form_class = 'media-upload-form type-form validate'; |
63 | 65 | |
64 | -if ( get_user_setting('uploader') || isset( $_GET['browser-uploader'] ) ) |
|
66 | +if ( get_user_setting('uploader') || isset( $_GET['browser-uploader'] ) ) { |
|
65 | 67 | $form_class .= ' html-uploader'; |
68 | +} |
|
66 | 69 | ?> |
67 | 70 | <div class="wrap"> |
68 | 71 | <h1><?php echo esc_html( $title ); ?></h1> |
@@ -1,12 +1,12 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * Edit post administration panel. |
|
4 | - * |
|
5 | - * Manage Post actions: post, edit, delete, etc. |
|
6 | - * |
|
7 | - * @package WordPress |
|
8 | - * @subpackage Administration |
|
9 | - */ |
|
3 | + * Edit post administration panel. |
|
4 | + * |
|
5 | + * Manage Post actions: post, edit, delete, etc. |
|
6 | + * |
|
7 | + * @package WordPress |
|
8 | + * @subpackage Administration |
|
9 | + */ |
|
10 | 10 | |
11 | 11 | /** WordPress Administration Bootstrap */ |
12 | 12 | require_once( dirname( __FILE__ ) . '/admin.php' ); |
@@ -45,8 +45,8 @@ discard block |
||
45 | 45 | |
46 | 46 | $sendback = wp_get_referer(); |
47 | 47 | if ( ! $sendback || |
48 | - strpos( $sendback, 'post.php' ) !== false || |
|
49 | - strpos( $sendback, 'post-new.php' ) !== false ) { |
|
48 | + strpos( $sendback, 'post.php' ) !== false || |
|
49 | + strpos( $sendback, 'post-new.php' ) !== false ) { |
|
50 | 50 | if ( 'attachment' == $post_type ) { |
51 | 51 | $sendback = admin_url( 'upload.php' ); |
52 | 52 | } else { |
@@ -9,16 +9,16 @@ discard block |
||
9 | 9 | */ |
10 | 10 | |
11 | 11 | /** WordPress Administration Bootstrap */ |
12 | -require_once( dirname( __FILE__ ) . '/admin.php' ); |
|
12 | +require_once(dirname(__FILE__).'/admin.php'); |
|
13 | 13 | |
14 | 14 | $parent_file = 'edit.php'; |
15 | 15 | $submenu_file = 'edit.php'; |
16 | 16 | |
17 | -wp_reset_vars( array( 'action' ) ); |
|
17 | +wp_reset_vars(array('action')); |
|
18 | 18 | |
19 | -if ( isset( $_GET['post'] ) ) |
|
19 | +if (isset($_GET['post'])) |
|
20 | 20 | $post_id = $post_ID = (int) $_GET['post']; |
21 | -elseif ( isset( $_POST['post_ID'] ) ) |
|
21 | +elseif (isset($_POST['post_ID'])) |
|
22 | 22 | $post_id = $post_ID = (int) $_POST['post_ID']; |
23 | 23 | else |
24 | 24 | $post_id = $post_ID = 0; |
@@ -30,59 +30,59 @@ discard block |
||
30 | 30 | */ |
31 | 31 | global $post_type, $post_type_object, $post; |
32 | 32 | |
33 | -if ( $post_id ) |
|
34 | - $post = get_post( $post_id ); |
|
33 | +if ($post_id) |
|
34 | + $post = get_post($post_id); |
|
35 | 35 | |
36 | -if ( $post ) { |
|
36 | +if ($post) { |
|
37 | 37 | $post_type = $post->post_type; |
38 | - $post_type_object = get_post_type_object( $post_type ); |
|
38 | + $post_type_object = get_post_type_object($post_type); |
|
39 | 39 | } |
40 | 40 | |
41 | -if ( isset( $_POST['deletepost'] ) ) |
|
41 | +if (isset($_POST['deletepost'])) |
|
42 | 42 | $action = 'delete'; |
43 | -elseif ( isset($_POST['wp-preview']) && 'dopreview' == $_POST['wp-preview'] ) |
|
43 | +elseif (isset($_POST['wp-preview']) && 'dopreview' == $_POST['wp-preview']) |
|
44 | 44 | $action = 'preview'; |
45 | 45 | |
46 | 46 | $sendback = wp_get_referer(); |
47 | 47 | if ( ! $sendback || |
48 | - strpos( $sendback, 'post.php' ) !== false || |
|
49 | - strpos( $sendback, 'post-new.php' ) !== false ) { |
|
50 | - if ( 'attachment' == $post_type ) { |
|
51 | - $sendback = admin_url( 'upload.php' ); |
|
48 | + strpos($sendback, 'post.php') !== false || |
|
49 | + strpos($sendback, 'post-new.php') !== false) { |
|
50 | + if ('attachment' == $post_type) { |
|
51 | + $sendback = admin_url('upload.php'); |
|
52 | 52 | } else { |
53 | - $sendback = admin_url( 'edit.php' ); |
|
54 | - if ( ! empty( $post_type ) ) { |
|
55 | - $sendback = add_query_arg( 'post_type', $post_type, $sendback ); |
|
53 | + $sendback = admin_url('edit.php'); |
|
54 | + if ( ! empty($post_type)) { |
|
55 | + $sendback = add_query_arg('post_type', $post_type, $sendback); |
|
56 | 56 | } |
57 | 57 | } |
58 | 58 | } else { |
59 | - $sendback = remove_query_arg( array('trashed', 'untrashed', 'deleted', 'ids'), $sendback ); |
|
59 | + $sendback = remove_query_arg(array('trashed', 'untrashed', 'deleted', 'ids'), $sendback); |
|
60 | 60 | } |
61 | 61 | |
62 | -switch($action) { |
|
62 | +switch ($action) { |
|
63 | 63 | case 'post-quickdraft-save': |
64 | 64 | // Check nonce and capabilities |
65 | 65 | $nonce = $_REQUEST['_wpnonce']; |
66 | 66 | $error_msg = false; |
67 | 67 | |
68 | 68 | // For output of the quickdraft dashboard widget |
69 | - require_once ABSPATH . 'wp-admin/includes/dashboard.php'; |
|
69 | + require_once ABSPATH.'wp-admin/includes/dashboard.php'; |
|
70 | 70 | |
71 | - if ( ! wp_verify_nonce( $nonce, 'add-post' ) ) |
|
72 | - $error_msg = __( 'Unable to submit this form, please refresh and try again.' ); |
|
71 | + if ( ! wp_verify_nonce($nonce, 'add-post')) |
|
72 | + $error_msg = __('Unable to submit this form, please refresh and try again.'); |
|
73 | 73 | |
74 | - if ( ! current_user_can( get_post_type_object( 'post' )->cap->create_posts ) ) { |
|
74 | + if ( ! current_user_can(get_post_type_object('post')->cap->create_posts)) { |
|
75 | 75 | exit; |
76 | 76 | } |
77 | 77 | |
78 | - if ( $error_msg ) |
|
79 | - return wp_dashboard_quick_press( $error_msg ); |
|
78 | + if ($error_msg) |
|
79 | + return wp_dashboard_quick_press($error_msg); |
|
80 | 80 | |
81 | - $post = get_post( $_REQUEST['post_ID'] ); |
|
82 | - check_admin_referer( 'add-' . $post->post_type ); |
|
81 | + $post = get_post($_REQUEST['post_ID']); |
|
82 | + check_admin_referer('add-'.$post->post_type); |
|
83 | 83 | |
84 | - $_POST['comment_status'] = get_default_comment_status( $post->post_type ); |
|
85 | - $_POST['ping_status'] = get_default_comment_status( $post->post_type, 'pingback' ); |
|
84 | + $_POST['comment_status'] = get_default_comment_status($post->post_type); |
|
85 | + $_POST['ping_status'] = get_default_comment_status($post->post_type, 'pingback'); |
|
86 | 86 | |
87 | 87 | edit_post(); |
88 | 88 | wp_dashboard_quick_press(); |
@@ -90,53 +90,53 @@ discard block |
||
90 | 90 | |
91 | 91 | case 'postajaxpost': |
92 | 92 | case 'post': |
93 | - check_admin_referer( 'add-' . $post_type ); |
|
93 | + check_admin_referer('add-'.$post_type); |
|
94 | 94 | $post_id = 'postajaxpost' == $action ? edit_post() : write_post(); |
95 | - redirect_post( $post_id ); |
|
95 | + redirect_post($post_id); |
|
96 | 96 | exit(); |
97 | 97 | |
98 | 98 | case 'edit': |
99 | 99 | $editing = true; |
100 | 100 | |
101 | - if ( empty( $post_id ) ) { |
|
102 | - wp_redirect( admin_url('post.php') ); |
|
101 | + if (empty($post_id)) { |
|
102 | + wp_redirect(admin_url('post.php')); |
|
103 | 103 | exit(); |
104 | 104 | } |
105 | 105 | |
106 | - if ( ! $post ) |
|
107 | - wp_die( __( 'You attempted to edit an item that doesn’t exist. Perhaps it was deleted?' ) ); |
|
106 | + if ( ! $post) |
|
107 | + wp_die(__('You attempted to edit an item that doesn’t exist. Perhaps it was deleted?')); |
|
108 | 108 | |
109 | - if ( ! $post_type_object ) |
|
110 | - wp_die( __( 'Unknown post type.' ) ); |
|
109 | + if ( ! $post_type_object) |
|
110 | + wp_die(__('Unknown post type.')); |
|
111 | 111 | |
112 | - if ( ! in_array( $typenow, get_post_types( array( 'show_ui' => true ) ) ) ) { |
|
113 | - wp_die( __( 'You are not allowed to edit posts in this post type.' ) ); |
|
112 | + if ( ! in_array($typenow, get_post_types(array('show_ui' => true)))) { |
|
113 | + wp_die(__('You are not allowed to edit posts in this post type.')); |
|
114 | 114 | } |
115 | 115 | |
116 | - if ( ! current_user_can( 'edit_post', $post_id ) ) |
|
117 | - wp_die( __( 'You are not allowed to edit this item.' ) ); |
|
116 | + if ( ! current_user_can('edit_post', $post_id)) |
|
117 | + wp_die(__('You are not allowed to edit this item.')); |
|
118 | 118 | |
119 | - if ( 'trash' == $post->post_status ) |
|
120 | - wp_die( __( 'You can’t edit this item because it is in the Trash. Please restore it and try again.' ) ); |
|
119 | + if ('trash' == $post->post_status) |
|
120 | + wp_die(__('You can’t edit this item because it is in the Trash. Please restore it and try again.')); |
|
121 | 121 | |
122 | - if ( ! empty( $_GET['get-post-lock'] ) ) { |
|
123 | - check_admin_referer( 'lock-post_' . $post_id ); |
|
124 | - wp_set_post_lock( $post_id ); |
|
125 | - wp_redirect( get_edit_post_link( $post_id, 'url' ) ); |
|
122 | + if ( ! empty($_GET['get-post-lock'])) { |
|
123 | + check_admin_referer('lock-post_'.$post_id); |
|
124 | + wp_set_post_lock($post_id); |
|
125 | + wp_redirect(get_edit_post_link($post_id, 'url')); |
|
126 | 126 | exit(); |
127 | 127 | } |
128 | 128 | |
129 | 129 | $post_type = $post->post_type; |
130 | - if ( 'post' == $post_type ) { |
|
130 | + if ('post' == $post_type) { |
|
131 | 131 | $parent_file = "edit.php"; |
132 | 132 | $submenu_file = "edit.php"; |
133 | 133 | $post_new_file = "post-new.php"; |
134 | - } elseif ( 'attachment' == $post_type ) { |
|
134 | + } elseif ('attachment' == $post_type) { |
|
135 | 135 | $parent_file = 'upload.php'; |
136 | 136 | $submenu_file = 'upload.php'; |
137 | 137 | $post_new_file = 'media-new.php'; |
138 | 138 | } else { |
139 | - if ( isset( $post_type_object ) && $post_type_object->show_in_menu && $post_type_object->show_in_menu !== true ) |
|
139 | + if (isset($post_type_object) && $post_type_object->show_in_menu && $post_type_object->show_in_menu !== true) |
|
140 | 140 | $parent_file = $post_type_object->show_in_menu; |
141 | 141 | else |
142 | 142 | $parent_file = "edit.php?post_type=$post_type"; |
@@ -144,57 +144,57 @@ discard block |
||
144 | 144 | $post_new_file = "post-new.php?post_type=$post_type"; |
145 | 145 | } |
146 | 146 | |
147 | - if ( ! wp_check_post_lock( $post->ID ) ) { |
|
148 | - $active_post_lock = wp_set_post_lock( $post->ID ); |
|
147 | + if ( ! wp_check_post_lock($post->ID)) { |
|
148 | + $active_post_lock = wp_set_post_lock($post->ID); |
|
149 | 149 | |
150 | - if ( 'attachment' !== $post_type ) |
|
150 | + if ('attachment' !== $post_type) |
|
151 | 151 | wp_enqueue_script('autosave'); |
152 | 152 | } |
153 | 153 | |
154 | - if ( is_multisite() ) { |
|
155 | - add_action( 'admin_footer', '_admin_notice_post_locked' ); |
|
154 | + if (is_multisite()) { |
|
155 | + add_action('admin_footer', '_admin_notice_post_locked'); |
|
156 | 156 | } else { |
157 | - $check_users = get_users( array( 'fields' => 'ID', 'number' => 2 ) ); |
|
157 | + $check_users = get_users(array('fields' => 'ID', 'number' => 2)); |
|
158 | 158 | |
159 | - if ( count( $check_users ) > 1 ) |
|
160 | - add_action( 'admin_footer', '_admin_notice_post_locked' ); |
|
159 | + if (count($check_users) > 1) |
|
160 | + add_action('admin_footer', '_admin_notice_post_locked'); |
|
161 | 161 | |
162 | - unset( $check_users ); |
|
162 | + unset($check_users); |
|
163 | 163 | } |
164 | 164 | |
165 | 165 | $title = $post_type_object->labels->edit_item; |
166 | 166 | $post = get_post($post_id, OBJECT, 'edit'); |
167 | 167 | |
168 | - if ( post_type_supports($post_type, 'comments') ) { |
|
168 | + if (post_type_supports($post_type, 'comments')) { |
|
169 | 169 | wp_enqueue_script('admin-comments'); |
170 | 170 | enqueue_comment_hotkeys_js(); |
171 | 171 | } |
172 | 172 | |
173 | - include( ABSPATH . 'wp-admin/edit-form-advanced.php' ); |
|
173 | + include(ABSPATH.'wp-admin/edit-form-advanced.php'); |
|
174 | 174 | |
175 | 175 | break; |
176 | 176 | |
177 | 177 | case 'editattachment': |
178 | - check_admin_referer('update-post_' . $post_id); |
|
178 | + check_admin_referer('update-post_'.$post_id); |
|
179 | 179 | |
180 | 180 | // Don't let these be changed |
181 | 181 | unset($_POST['guid']); |
182 | 182 | $_POST['post_type'] = 'attachment'; |
183 | 183 | |
184 | 184 | // Update the thumbnail filename |
185 | - $newmeta = wp_get_attachment_metadata( $post_id, true ); |
|
185 | + $newmeta = wp_get_attachment_metadata($post_id, true); |
|
186 | 186 | $newmeta['thumb'] = $_POST['thumb']; |
187 | 187 | |
188 | - wp_update_attachment_metadata( $post_id, $newmeta ); |
|
188 | + wp_update_attachment_metadata($post_id, $newmeta); |
|
189 | 189 | |
190 | 190 | case 'editpost': |
191 | - check_admin_referer('update-post_' . $post_id); |
|
191 | + check_admin_referer('update-post_'.$post_id); |
|
192 | 192 | |
193 | 193 | $post_id = edit_post(); |
194 | 194 | |
195 | 195 | // Session cookie flag that the post was saved |
196 | - if ( isset( $_COOKIE['wp-saving-post'] ) && $_COOKIE['wp-saving-post'] === $post_id . '-check' ) { |
|
197 | - setcookie( 'wp-saving-post', $post_id . '-saved', time() + DAY_IN_SECONDS, ADMIN_COOKIE_PATH, COOKIE_DOMAIN, is_ssl() ); |
|
196 | + if (isset($_COOKIE['wp-saving-post']) && $_COOKIE['wp-saving-post'] === $post_id.'-check') { |
|
197 | + setcookie('wp-saving-post', $post_id.'-saved', time() + DAY_IN_SECONDS, ADMIN_COOKIE_PATH, COOKIE_DOMAIN, is_ssl()); |
|
198 | 198 | } |
199 | 199 | |
200 | 200 | redirect_post($post_id); // Send user on their way while we keep working |
@@ -202,72 +202,72 @@ discard block |
||
202 | 202 | exit(); |
203 | 203 | |
204 | 204 | case 'trash': |
205 | - check_admin_referer('trash-post_' . $post_id); |
|
205 | + check_admin_referer('trash-post_'.$post_id); |
|
206 | 206 | |
207 | - if ( ! $post ) |
|
208 | - wp_die( __( 'The item you are trying to move to the Trash no longer exists.' ) ); |
|
207 | + if ( ! $post) |
|
208 | + wp_die(__('The item you are trying to move to the Trash no longer exists.')); |
|
209 | 209 | |
210 | - if ( ! $post_type_object ) |
|
211 | - wp_die( __( 'Unknown post type.' ) ); |
|
210 | + if ( ! $post_type_object) |
|
211 | + wp_die(__('Unknown post type.')); |
|
212 | 212 | |
213 | - if ( ! current_user_can( 'delete_post', $post_id ) ) |
|
214 | - wp_die( __( 'You are not allowed to move this item to the Trash.' ) ); |
|
213 | + if ( ! current_user_can('delete_post', $post_id)) |
|
214 | + wp_die(__('You are not allowed to move this item to the Trash.')); |
|
215 | 215 | |
216 | - if ( $user_id = wp_check_post_lock( $post_id ) ) { |
|
217 | - $user = get_userdata( $user_id ); |
|
218 | - wp_die( sprintf( __( 'You cannot move this item to the Trash. %s is currently editing.' ), $user->display_name ) ); |
|
216 | + if ($user_id = wp_check_post_lock($post_id)) { |
|
217 | + $user = get_userdata($user_id); |
|
218 | + wp_die(sprintf(__('You cannot move this item to the Trash. %s is currently editing.'), $user->display_name)); |
|
219 | 219 | } |
220 | 220 | |
221 | - if ( ! wp_trash_post( $post_id ) ) |
|
222 | - wp_die( __( 'Error in moving to Trash.' ) ); |
|
221 | + if ( ! wp_trash_post($post_id)) |
|
222 | + wp_die(__('Error in moving to Trash.')); |
|
223 | 223 | |
224 | - wp_redirect( add_query_arg( array('trashed' => 1, 'ids' => $post_id), $sendback ) ); |
|
224 | + wp_redirect(add_query_arg(array('trashed' => 1, 'ids' => $post_id), $sendback)); |
|
225 | 225 | exit(); |
226 | 226 | |
227 | 227 | case 'untrash': |
228 | - check_admin_referer('untrash-post_' . $post_id); |
|
228 | + check_admin_referer('untrash-post_'.$post_id); |
|
229 | 229 | |
230 | - if ( ! $post ) |
|
231 | - wp_die( __( 'The item you are trying to restore from the Trash no longer exists.' ) ); |
|
230 | + if ( ! $post) |
|
231 | + wp_die(__('The item you are trying to restore from the Trash no longer exists.')); |
|
232 | 232 | |
233 | - if ( ! $post_type_object ) |
|
234 | - wp_die( __( 'Unknown post type.' ) ); |
|
233 | + if ( ! $post_type_object) |
|
234 | + wp_die(__('Unknown post type.')); |
|
235 | 235 | |
236 | - if ( ! current_user_can( 'delete_post', $post_id ) ) |
|
237 | - wp_die( __( 'You are not allowed to restore this item from the Trash.' ) ); |
|
236 | + if ( ! current_user_can('delete_post', $post_id)) |
|
237 | + wp_die(__('You are not allowed to restore this item from the Trash.')); |
|
238 | 238 | |
239 | - if ( ! wp_untrash_post( $post_id ) ) |
|
240 | - wp_die( __( 'Error in restoring from Trash.' ) ); |
|
239 | + if ( ! wp_untrash_post($post_id)) |
|
240 | + wp_die(__('Error in restoring from Trash.')); |
|
241 | 241 | |
242 | - wp_redirect( add_query_arg('untrashed', 1, $sendback) ); |
|
242 | + wp_redirect(add_query_arg('untrashed', 1, $sendback)); |
|
243 | 243 | exit(); |
244 | 244 | |
245 | 245 | case 'delete': |
246 | - check_admin_referer('delete-post_' . $post_id); |
|
246 | + check_admin_referer('delete-post_'.$post_id); |
|
247 | 247 | |
248 | - if ( ! $post ) |
|
249 | - wp_die( __( 'This item has already been deleted.' ) ); |
|
248 | + if ( ! $post) |
|
249 | + wp_die(__('This item has already been deleted.')); |
|
250 | 250 | |
251 | - if ( ! $post_type_object ) |
|
252 | - wp_die( __( 'Unknown post type.' ) ); |
|
251 | + if ( ! $post_type_object) |
|
252 | + wp_die(__('Unknown post type.')); |
|
253 | 253 | |
254 | - if ( ! current_user_can( 'delete_post', $post_id ) ) |
|
255 | - wp_die( __( 'You are not allowed to delete this item.' ) ); |
|
254 | + if ( ! current_user_can('delete_post', $post_id)) |
|
255 | + wp_die(__('You are not allowed to delete this item.')); |
|
256 | 256 | |
257 | - if ( $post->post_type == 'attachment' ) { |
|
258 | - $force = ( ! MEDIA_TRASH ); |
|
259 | - if ( ! wp_delete_attachment( $post_id, $force ) ) |
|
260 | - wp_die( __( 'Error in deleting.' ) ); |
|
257 | + if ($post->post_type == 'attachment') { |
|
258 | + $force = ( ! MEDIA_TRASH); |
|
259 | + if ( ! wp_delete_attachment($post_id, $force)) |
|
260 | + wp_die(__('Error in deleting.')); |
|
261 | 261 | } else { |
262 | - if ( ! wp_delete_post( $post_id, true ) ) |
|
263 | - wp_die( __( 'Error in deleting.' ) ); |
|
262 | + if ( ! wp_delete_post($post_id, true)) |
|
263 | + wp_die(__('Error in deleting.')); |
|
264 | 264 | } |
265 | 265 | |
266 | - wp_redirect( add_query_arg('deleted', 1, $sendback) ); |
|
266 | + wp_redirect(add_query_arg('deleted', 1, $sendback)); |
|
267 | 267 | exit(); |
268 | 268 | |
269 | 269 | case 'preview': |
270 | - check_admin_referer( 'update-post_' . $post_id ); |
|
270 | + check_admin_referer('update-post_'.$post_id); |
|
271 | 271 | |
272 | 272 | $url = post_preview(); |
273 | 273 | |
@@ -275,7 +275,7 @@ discard block |
||
275 | 275 | exit(); |
276 | 276 | |
277 | 277 | default: |
278 | - wp_redirect( admin_url('edit.php') ); |
|
278 | + wp_redirect(admin_url('edit.php')); |
|
279 | 279 | exit(); |
280 | 280 | } // end switch |
281 | -include( ABSPATH . 'wp-admin/admin-footer.php' ); |
|
281 | +include(ABSPATH.'wp-admin/admin-footer.php'); |
@@ -16,12 +16,13 @@ discard block |
||
16 | 16 | |
17 | 17 | wp_reset_vars( array( 'action' ) ); |
18 | 18 | |
19 | -if ( isset( $_GET['post'] ) ) |
|
19 | +if ( isset( $_GET['post'] ) ) { |
|
20 | 20 | $post_id = $post_ID = (int) $_GET['post']; |
21 | -elseif ( isset( $_POST['post_ID'] ) ) |
|
21 | +} elseif ( isset( $_POST['post_ID'] ) ) { |
|
22 | 22 | $post_id = $post_ID = (int) $_POST['post_ID']; |
23 | -else |
|
23 | +} else { |
|
24 | 24 | $post_id = $post_ID = 0; |
25 | +} |
|
25 | 26 | |
26 | 27 | /** |
27 | 28 | * @global string $post_type |
@@ -30,18 +31,20 @@ discard block |
||
30 | 31 | */ |
31 | 32 | global $post_type, $post_type_object, $post; |
32 | 33 | |
33 | -if ( $post_id ) |
|
34 | +if ( $post_id ) { |
|
34 | 35 | $post = get_post( $post_id ); |
36 | +} |
|
35 | 37 | |
36 | 38 | if ( $post ) { |
37 | 39 | $post_type = $post->post_type; |
38 | 40 | $post_type_object = get_post_type_object( $post_type ); |
39 | 41 | } |
40 | 42 | |
41 | -if ( isset( $_POST['deletepost'] ) ) |
|
43 | +if ( isset( $_POST['deletepost'] ) ) { |
|
42 | 44 | $action = 'delete'; |
43 | -elseif ( isset($_POST['wp-preview']) && 'dopreview' == $_POST['wp-preview'] ) |
|
45 | +} elseif ( isset($_POST['wp-preview']) && 'dopreview' == $_POST['wp-preview'] ) { |
|
44 | 46 | $action = 'preview'; |
47 | +} |
|
45 | 48 | |
46 | 49 | $sendback = wp_get_referer(); |
47 | 50 | if ( ! $sendback || |
@@ -68,15 +71,17 @@ discard block |
||
68 | 71 | // For output of the quickdraft dashboard widget |
69 | 72 | require_once ABSPATH . 'wp-admin/includes/dashboard.php'; |
70 | 73 | |
71 | - if ( ! wp_verify_nonce( $nonce, 'add-post' ) ) |
|
72 | - $error_msg = __( 'Unable to submit this form, please refresh and try again.' ); |
|
74 | + if ( ! wp_verify_nonce( $nonce, 'add-post' ) ) { |
|
75 | + $error_msg = __( 'Unable to submit this form, please refresh and try again.' ); |
|
76 | + } |
|
73 | 77 | |
74 | 78 | if ( ! current_user_can( get_post_type_object( 'post' )->cap->create_posts ) ) { |
75 | 79 | exit; |
76 | 80 | } |
77 | 81 | |
78 | - if ( $error_msg ) |
|
79 | - return wp_dashboard_quick_press( $error_msg ); |
|
82 | + if ( $error_msg ) { |
|
83 | + return wp_dashboard_quick_press( $error_msg ); |
|
84 | + } |
|
80 | 85 | |
81 | 86 | $post = get_post( $_REQUEST['post_ID'] ); |
82 | 87 | check_admin_referer( 'add-' . $post->post_type ); |
@@ -103,21 +108,25 @@ discard block |
||
103 | 108 | exit(); |
104 | 109 | } |
105 | 110 | |
106 | - if ( ! $post ) |
|
107 | - wp_die( __( 'You attempted to edit an item that doesn’t exist. Perhaps it was deleted?' ) ); |
|
111 | + if ( ! $post ) { |
|
112 | + wp_die( __( 'You attempted to edit an item that doesn’t exist. Perhaps it was deleted?' ) ); |
|
113 | + } |
|
108 | 114 | |
109 | - if ( ! $post_type_object ) |
|
110 | - wp_die( __( 'Unknown post type.' ) ); |
|
115 | + if ( ! $post_type_object ) { |
|
116 | + wp_die( __( 'Unknown post type.' ) ); |
|
117 | + } |
|
111 | 118 | |
112 | 119 | if ( ! in_array( $typenow, get_post_types( array( 'show_ui' => true ) ) ) ) { |
113 | 120 | wp_die( __( 'You are not allowed to edit posts in this post type.' ) ); |
114 | 121 | } |
115 | 122 | |
116 | - if ( ! current_user_can( 'edit_post', $post_id ) ) |
|
117 | - wp_die( __( 'You are not allowed to edit this item.' ) ); |
|
123 | + if ( ! current_user_can( 'edit_post', $post_id ) ) { |
|
124 | + wp_die( __( 'You are not allowed to edit this item.' ) ); |
|
125 | + } |
|
118 | 126 | |
119 | - if ( 'trash' == $post->post_status ) |
|
120 | - wp_die( __( 'You can’t edit this item because it is in the Trash. Please restore it and try again.' ) ); |
|
127 | + if ( 'trash' == $post->post_status ) { |
|
128 | + wp_die( __( 'You can’t edit this item because it is in the Trash. Please restore it and try again.' ) ); |
|
129 | + } |
|
121 | 130 | |
122 | 131 | if ( ! empty( $_GET['get-post-lock'] ) ) { |
123 | 132 | check_admin_referer( 'lock-post_' . $post_id ); |
@@ -136,10 +145,11 @@ discard block |
||
136 | 145 | $submenu_file = 'upload.php'; |
137 | 146 | $post_new_file = 'media-new.php'; |
138 | 147 | } else { |
139 | - if ( isset( $post_type_object ) && $post_type_object->show_in_menu && $post_type_object->show_in_menu !== true ) |
|
140 | - $parent_file = $post_type_object->show_in_menu; |
|
141 | - else |
|
142 | - $parent_file = "edit.php?post_type=$post_type"; |
|
148 | + if ( isset( $post_type_object ) && $post_type_object->show_in_menu && $post_type_object->show_in_menu !== true ) { |
|
149 | + $parent_file = $post_type_object->show_in_menu; |
|
150 | + } else { |
|
151 | + $parent_file = "edit.php?post_type=$post_type"; |
|
152 | + } |
|
143 | 153 | $submenu_file = "edit.php?post_type=$post_type"; |
144 | 154 | $post_new_file = "post-new.php?post_type=$post_type"; |
145 | 155 | } |
@@ -147,8 +157,9 @@ discard block |
||
147 | 157 | if ( ! wp_check_post_lock( $post->ID ) ) { |
148 | 158 | $active_post_lock = wp_set_post_lock( $post->ID ); |
149 | 159 | |
150 | - if ( 'attachment' !== $post_type ) |
|
151 | - wp_enqueue_script('autosave'); |
|
160 | + if ( 'attachment' !== $post_type ) { |
|
161 | + wp_enqueue_script('autosave'); |
|
162 | + } |
|
152 | 163 | } |
153 | 164 | |
154 | 165 | if ( is_multisite() ) { |
@@ -156,8 +167,9 @@ discard block |
||
156 | 167 | } else { |
157 | 168 | $check_users = get_users( array( 'fields' => 'ID', 'number' => 2 ) ); |
158 | 169 | |
159 | - if ( count( $check_users ) > 1 ) |
|
160 | - add_action( 'admin_footer', '_admin_notice_post_locked' ); |
|
170 | + if ( count( $check_users ) > 1 ) { |
|
171 | + add_action( 'admin_footer', '_admin_notice_post_locked' ); |
|
172 | + } |
|
161 | 173 | |
162 | 174 | unset( $check_users ); |
163 | 175 | } |
@@ -204,22 +216,26 @@ discard block |
||
204 | 216 | case 'trash': |
205 | 217 | check_admin_referer('trash-post_' . $post_id); |
206 | 218 | |
207 | - if ( ! $post ) |
|
208 | - wp_die( __( 'The item you are trying to move to the Trash no longer exists.' ) ); |
|
219 | + if ( ! $post ) { |
|
220 | + wp_die( __( 'The item you are trying to move to the Trash no longer exists.' ) ); |
|
221 | + } |
|
209 | 222 | |
210 | - if ( ! $post_type_object ) |
|
211 | - wp_die( __( 'Unknown post type.' ) ); |
|
223 | + if ( ! $post_type_object ) { |
|
224 | + wp_die( __( 'Unknown post type.' ) ); |
|
225 | + } |
|
212 | 226 | |
213 | - if ( ! current_user_can( 'delete_post', $post_id ) ) |
|
214 | - wp_die( __( 'You are not allowed to move this item to the Trash.' ) ); |
|
227 | + if ( ! current_user_can( 'delete_post', $post_id ) ) { |
|
228 | + wp_die( __( 'You are not allowed to move this item to the Trash.' ) ); |
|
229 | + } |
|
215 | 230 | |
216 | 231 | if ( $user_id = wp_check_post_lock( $post_id ) ) { |
217 | 232 | $user = get_userdata( $user_id ); |
218 | 233 | wp_die( sprintf( __( 'You cannot move this item to the Trash. %s is currently editing.' ), $user->display_name ) ); |
219 | 234 | } |
220 | 235 | |
221 | - if ( ! wp_trash_post( $post_id ) ) |
|
222 | - wp_die( __( 'Error in moving to Trash.' ) ); |
|
236 | + if ( ! wp_trash_post( $post_id ) ) { |
|
237 | + wp_die( __( 'Error in moving to Trash.' ) ); |
|
238 | + } |
|
223 | 239 | |
224 | 240 | wp_redirect( add_query_arg( array('trashed' => 1, 'ids' => $post_id), $sendback ) ); |
225 | 241 | exit(); |
@@ -227,17 +243,21 @@ discard block |
||
227 | 243 | case 'untrash': |
228 | 244 | check_admin_referer('untrash-post_' . $post_id); |
229 | 245 | |
230 | - if ( ! $post ) |
|
231 | - wp_die( __( 'The item you are trying to restore from the Trash no longer exists.' ) ); |
|
246 | + if ( ! $post ) { |
|
247 | + wp_die( __( 'The item you are trying to restore from the Trash no longer exists.' ) ); |
|
248 | + } |
|
232 | 249 | |
233 | - if ( ! $post_type_object ) |
|
234 | - wp_die( __( 'Unknown post type.' ) ); |
|
250 | + if ( ! $post_type_object ) { |
|
251 | + wp_die( __( 'Unknown post type.' ) ); |
|
252 | + } |
|
235 | 253 | |
236 | - if ( ! current_user_can( 'delete_post', $post_id ) ) |
|
237 | - wp_die( __( 'You are not allowed to restore this item from the Trash.' ) ); |
|
254 | + if ( ! current_user_can( 'delete_post', $post_id ) ) { |
|
255 | + wp_die( __( 'You are not allowed to restore this item from the Trash.' ) ); |
|
256 | + } |
|
238 | 257 | |
239 | - if ( ! wp_untrash_post( $post_id ) ) |
|
240 | - wp_die( __( 'Error in restoring from Trash.' ) ); |
|
258 | + if ( ! wp_untrash_post( $post_id ) ) { |
|
259 | + wp_die( __( 'Error in restoring from Trash.' ) ); |
|
260 | + } |
|
241 | 261 | |
242 | 262 | wp_redirect( add_query_arg('untrashed', 1, $sendback) ); |
243 | 263 | exit(); |
@@ -245,22 +265,27 @@ discard block |
||
245 | 265 | case 'delete': |
246 | 266 | check_admin_referer('delete-post_' . $post_id); |
247 | 267 | |
248 | - if ( ! $post ) |
|
249 | - wp_die( __( 'This item has already been deleted.' ) ); |
|
268 | + if ( ! $post ) { |
|
269 | + wp_die( __( 'This item has already been deleted.' ) ); |
|
270 | + } |
|
250 | 271 | |
251 | - if ( ! $post_type_object ) |
|
252 | - wp_die( __( 'Unknown post type.' ) ); |
|
272 | + if ( ! $post_type_object ) { |
|
273 | + wp_die( __( 'Unknown post type.' ) ); |
|
274 | + } |
|
253 | 275 | |
254 | - if ( ! current_user_can( 'delete_post', $post_id ) ) |
|
255 | - wp_die( __( 'You are not allowed to delete this item.' ) ); |
|
276 | + if ( ! current_user_can( 'delete_post', $post_id ) ) { |
|
277 | + wp_die( __( 'You are not allowed to delete this item.' ) ); |
|
278 | + } |
|
256 | 279 | |
257 | 280 | if ( $post->post_type == 'attachment' ) { |
258 | 281 | $force = ( ! MEDIA_TRASH ); |
259 | - if ( ! wp_delete_attachment( $post_id, $force ) ) |
|
260 | - wp_die( __( 'Error in deleting.' ) ); |
|
282 | + if ( ! wp_delete_attachment( $post_id, $force ) ) { |
|
283 | + wp_die( __( 'Error in deleting.' ) ); |
|
284 | + } |
|
261 | 285 | } else { |
262 | - if ( ! wp_delete_post( $post_id, true ) ) |
|
263 | - wp_die( __( 'Error in deleting.' ) ); |
|
286 | + if ( ! wp_delete_post( $post_id, true ) ) { |
|
287 | + wp_die( __( 'Error in deleting.' ) ); |
|
288 | + } |
|
264 | 289 | } |
265 | 290 | |
266 | 291 | wp_redirect( add_query_arg('deleted', 1, $sendback) ); |
@@ -1,10 +1,10 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * About This Version administration panel. |
|
4 | - * |
|
5 | - * @package WordPress |
|
6 | - * @subpackage Administration |
|
7 | - */ |
|
3 | + * About This Version administration panel. |
|
4 | + * |
|
5 | + * @package WordPress |
|
6 | + * @subpackage Administration |
|
7 | + */ |
|
8 | 8 | |
9 | 9 | /** WordPress Administration Bootstrap */ |
10 | 10 | require_once( dirname( __FILE__ ) . '/admin.php' ); |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | '<a href="https://developer.wordpress.org/reference/functions/add_term_meta"><code>add_term_meta()</code></a>', |
161 | 161 | '<a href="https://developer.wordpress.org/reference/functions/get_term_meta"><code>get_term_meta()</code></a>', |
162 | 162 | '<a href="https://developer.wordpress.org/reference/functions/update_term_meta"><code>update_term_meta()</code></a>' |
163 | - ); |
|
163 | + ); |
|
164 | 164 | ?></p> |
165 | 165 | </div> |
166 | 166 | <div class="col"> |
@@ -217,15 +217,15 @@ discard block |
||
217 | 217 | |
218 | 218 | /* translators: 1: WordPress version number, 2: plural number of bugs. */ |
219 | 219 | _n_noop( '<strong>Version %1$s</strong> addressed %2$s bug.', |
220 | - '<strong>Version %1$s</strong> addressed %2$s bugs.' ); |
|
220 | + '<strong>Version %1$s</strong> addressed %2$s bugs.' ); |
|
221 | 221 | |
222 | 222 | /* translators: 1: WordPress version number, 2: plural number of bugs. Singular security issue. */ |
223 | 223 | _n_noop( '<strong>Version %1$s</strong> addressed a security issue and fixed %2$s bug.', |
224 | - '<strong>Version %1$s</strong> addressed a security issue and fixed %2$s bugs.' ); |
|
224 | + '<strong>Version %1$s</strong> addressed a security issue and fixed %2$s bugs.' ); |
|
225 | 225 | |
226 | 226 | /* translators: 1: WordPress version number, 2: plural number of bugs. More than one security issue. */ |
227 | 227 | _n_noop( '<strong>Version %1$s</strong> addressed some security issues and fixed %2$s bug.', |
228 | - '<strong>Version %1$s</strong> addressed some security issues and fixed %2$s bugs.' ); |
|
228 | + '<strong>Version %1$s</strong> addressed some security issues and fixed %2$s bugs.' ); |
|
229 | 229 | |
230 | 230 | /* translators: %s: Codex URL */ |
231 | 231 | __( 'For more information, see <a href="%s">the release notes</a>.' ); |
@@ -7,64 +7,64 @@ discard block |
||
7 | 7 | */ |
8 | 8 | |
9 | 9 | /** WordPress Administration Bootstrap */ |
10 | -require_once( dirname( __FILE__ ) . '/admin.php' ); |
|
10 | +require_once(dirname(__FILE__).'/admin.php'); |
|
11 | 11 | |
12 | -wp_enqueue_style( 'wp-mediaelement' ); |
|
13 | -wp_enqueue_script( 'wp-mediaelement' ); |
|
14 | -wp_localize_script( 'mediaelement', '_wpmejsSettings', array( |
|
15 | - 'pluginPath' => includes_url( 'js/mediaelement/', 'relative' ), |
|
12 | +wp_enqueue_style('wp-mediaelement'); |
|
13 | +wp_enqueue_script('wp-mediaelement'); |
|
14 | +wp_localize_script('mediaelement', '_wpmejsSettings', array( |
|
15 | + 'pluginPath' => includes_url('js/mediaelement/', 'relative'), |
|
16 | 16 | 'pauseOtherPlayers' => '' |
17 | -) ); |
|
17 | +)); |
|
18 | 18 | |
19 | -if ( current_user_can( 'install_plugins' ) ) { |
|
19 | +if (current_user_can('install_plugins')) { |
|
20 | 20 | add_thickbox(); |
21 | - wp_enqueue_script( 'plugin-install' ); |
|
21 | + wp_enqueue_script('plugin-install'); |
|
22 | 22 | } |
23 | 23 | |
24 | 24 | $video_url = 'https://videopress.com/embed/J44FHXvg?hd=true'; |
25 | -$locale = str_replace( '_', '-', get_locale() ); |
|
26 | -list( $locale ) = explode( '-', $locale ); |
|
27 | -if ( 'en' !== $locale ) { |
|
28 | - $video_url = add_query_arg( 'defaultLangCode', $locale, $video_url ); |
|
25 | +$locale = str_replace('_', '-', get_locale()); |
|
26 | +list($locale) = explode('-', $locale); |
|
27 | +if ('en' !== $locale) { |
|
28 | + $video_url = add_query_arg('defaultLangCode', $locale, $video_url); |
|
29 | 29 | } |
30 | 30 | |
31 | 31 | wp_oembed_add_host_js(); |
32 | 32 | |
33 | -$title = __( 'About' ); |
|
33 | +$title = __('About'); |
|
34 | 34 | |
35 | -list( $display_version ) = explode( '-', $wp_version ); |
|
35 | +list($display_version) = explode('-', $wp_version); |
|
36 | 36 | |
37 | -include( ABSPATH . 'wp-admin/admin-header.php' ); |
|
37 | +include(ABSPATH.'wp-admin/admin-header.php'); |
|
38 | 38 | ?> |
39 | 39 | <div class="wrap about-wrap"> |
40 | - <h1><?php printf( __( 'Welcome to WordPress %s' ), $display_version ); ?></h1> |
|
40 | + <h1><?php printf(__('Welcome to WordPress %s'), $display_version); ?></h1> |
|
41 | 41 | |
42 | - <div class="about-text"><?php printf( __( 'Thank you for updating! WordPress %s makes your site more connected and responsive.' ), $display_version ); ?></div> |
|
43 | - <div class="wp-badge"><?php printf( __( 'Version %s' ), $display_version ); ?></div> |
|
42 | + <div class="about-text"><?php printf(__('Thank you for updating! WordPress %s makes your site more connected and responsive.'), $display_version); ?></div> |
|
43 | + <div class="wp-badge"><?php printf(__('Version %s'), $display_version); ?></div> |
|
44 | 44 | |
45 | 45 | <h2 class="nav-tab-wrapper wp-clearfix"> |
46 | - <a href="about.php" class="nav-tab nav-tab-active"><?php _e( 'What’s New' ); ?></a> |
|
47 | - <a href="credits.php" class="nav-tab"><?php _e( 'Credits' ); ?></a> |
|
48 | - <a href="freedoms.php" class="nav-tab"><?php _e( 'Freedoms' ); ?></a> |
|
46 | + <a href="about.php" class="nav-tab nav-tab-active"><?php _e('What’s New'); ?></a> |
|
47 | + <a href="credits.php" class="nav-tab"><?php _e('Credits'); ?></a> |
|
48 | + <a href="freedoms.php" class="nav-tab"><?php _e('Freedoms'); ?></a> |
|
49 | 49 | </h2> |
50 | 50 | |
51 | 51 | <div class="headline-feature feature-video"> |
52 | - <iframe width="1050" height="591" src="<?php echo esc_url( $video_url ); ?>" frameborder="0" allowfullscreen></iframe> |
|
52 | + <iframe width="1050" height="591" src="<?php echo esc_url($video_url); ?>" frameborder="0" allowfullscreen></iframe> |
|
53 | 53 | <script src="https://videopress.com/videopress-iframe.js"></script> |
54 | 54 | </div> |
55 | 55 | |
56 | 56 | <hr> |
57 | 57 | |
58 | 58 | <div class="headline-feature feature-section one-col"> |
59 | - <h2><?php _e( 'Twenty Sixteen' ); ?></h2> |
|
59 | + <h2><?php _e('Twenty Sixteen'); ?></h2> |
|
60 | 60 | <div class="media-container"> |
61 | 61 | <img src="https://s.w.org/images/core/4.4/twenty-sixteen-white-fullsize-2x.png" alt="" srcset="https://s.w.org/images/core/4.4/twenty-sixteen-white-smartphone-1x.png 268w, https://s.w.org/images/core/4.4/twenty-sixteen-white-smartphone-2x.png 536w, https://s.w.org/images/core/4.4/twenty-sixteen-white-tablet-1x.png 558w, https://s.w.org/images/core/4.4/twenty-sixteen-white-desktop-1x.png 840w, https://s.w.org/images/core/4.4/twenty-sixteen-white-fullsize-1x.png 1086w, https://s.w.org/images/core/4.4/twenty-sixteen-white-tablet-2x.png 1116w, https://s.w.org/images/core/4.4/twenty-sixteen-white-desktop-2x.png 1680w, https://s.w.org/images/core/4.4/twenty-sixteen-white-fullsize-2x.png 2172w" sizes="(max-width: 500px) calc((100vw - 40px) * .8), (max-width: 782px) calc((100vw - 70px) * .8), (max-width: 960px) calc((100vw - 116px) * .8), (max-width: 1290px) calc((100vw - 240px) * .8), 840px" /> |
62 | 62 | </div> |
63 | 63 | <div class="two-col"> |
64 | 64 | <div class="col"> |
65 | - <h3><?php _e( 'Introducing Twenty Sixteen' ); ?></h3> |
|
66 | - <p><?php _e( 'Our newest default theme, Twenty Sixteen, is a modern take on a classic blog design.' ); ?></p> |
|
67 | - <p><?php _e( 'Twenty Sixteen was built to look great on any device. A fluid grid design, flexible header, fun color schemes, and more, will make your content shine.' ); ?></p> |
|
65 | + <h3><?php _e('Introducing Twenty Sixteen'); ?></h3> |
|
66 | + <p><?php _e('Our newest default theme, Twenty Sixteen, is a modern take on a classic blog design.'); ?></p> |
|
67 | + <p><?php _e('Twenty Sixteen was built to look great on any device. A fluid grid design, flexible header, fun color schemes, and more, will make your content shine.'); ?></p> |
|
68 | 68 | <div class="horizontal-image"> |
69 | 69 | <div class="content"> |
70 | 70 | <img class="feature-image horizontal-screen" src="https://s.w.org/images/core/4.4/twenty-sixteen-dark-fullsize-2x.png" alt="" srcset="https://s.w.org/images/core/4.4/twenty-sixteen-dark-smartphone-1x.png 268w, https://s.w.org/images/core/4.4/twenty-sixteen-dark-smartphone-2x.png 535w, https://s.w.org/images/core/4.4/twenty-sixteen-dark-desktop-1x.png 558w, https://s.w.org/images/core/4.4/twenty-sixteen-dark-fullsize-1x.png 783w, https://s.w.org/images/core/4.4/twenty-sixteen-dark-desktop-2x.png 1116w, https://s.w.org/images/core/4.4/twenty-sixteen-dark-fullsize-2x.png 1566w" sizes="(max-width: 500px) calc((100vw - 40px) * .8), (max-width: 782px) calc((100vw - 70px) * .8), (max-width: 960px) calc((100vw - 116px) * .5216), (max-width: 1290px) calc((100vw - 240px) * .5216), 548px" /> |
@@ -86,8 +86,8 @@ discard block |
||
86 | 86 | </div> |
87 | 87 | </div> |
88 | 88 | <div class="col"> |
89 | - <h3><?php _e( 'Responsive images' ); ?></h3> |
|
90 | - <p><?php _e( 'WordPress now takes a smarter approach to displaying appropriate image sizes on any device, ensuring a perfect fit every time. You don’t need to do anything to your theme, it just works.' ); ?></p> |
|
89 | + <h3><?php _e('Responsive images'); ?></h3> |
|
90 | + <p><?php _e('WordPress now takes a smarter approach to displaying appropriate image sizes on any device, ensuring a perfect fit every time. You don’t need to do anything to your theme, it just works.'); ?></p> |
|
91 | 91 | </div> |
92 | 92 | </div> |
93 | 93 | |
@@ -96,12 +96,12 @@ discard block |
||
96 | 96 | <div class="feature-section two-col"> |
97 | 97 | <div class="col"> |
98 | 98 | <div class="embed-container"> |
99 | - <blockquote data-secret="OcUe7B6Edh" class="wp-embedded-content"><a href="https://wordpress.org/news/2015/12/clifford/">WordPress 4.4 “Clifford”</a></blockquote><iframe class="wp-embedded-content" sandbox="allow-scripts" security="restricted" style="display:none;" src="https://wordpress.org/news/2015/12/clifford/embed/#?secret=OcUe7B6Edh" data-secret="OcUe7B6Edh" width="600" height="338" title="<?php esc_attr_e( 'Embedded WordPress Post' ); ?>" frameborder="0" marginwidth="0" marginheight="0" scrolling="no"></iframe> |
|
99 | + <blockquote data-secret="OcUe7B6Edh" class="wp-embedded-content"><a href="https://wordpress.org/news/2015/12/clifford/">WordPress 4.4 “Clifford”</a></blockquote><iframe class="wp-embedded-content" sandbox="allow-scripts" security="restricted" style="display:none;" src="https://wordpress.org/news/2015/12/clifford/embed/#?secret=OcUe7B6Edh" data-secret="OcUe7B6Edh" width="600" height="338" title="<?php esc_attr_e('Embedded WordPress Post'); ?>" frameborder="0" marginwidth="0" marginheight="0" scrolling="no"></iframe> |
|
100 | 100 | </div> |
101 | 101 | </div> |
102 | 102 | <div class="col"> |
103 | - <h3><?php _e( 'Embed your WordPress content' ); ?></h3> |
|
104 | - <p><?php _e( 'Now you can embed your posts on other sites, even other WordPress sites. Simply drop a post URL into the editor and see an instant embed preview, complete with the title, excerpt, and featured image if you’ve set one. We’ll even include your site icon and links for comments and sharing.' ); ?></p> |
|
103 | + <h3><?php _e('Embed your WordPress content'); ?></h3> |
|
104 | + <p><?php _e('Now you can embed your posts on other sites, even other WordPress sites. Simply drop a post URL into the editor and see an instant embed preview, complete with the title, excerpt, and featured image if you’ve set one. We’ll even include your site icon and links for comments and sharing.'); ?></p> |
|
105 | 105 | </div> |
106 | 106 | </div> |
107 | 107 | |
@@ -114,23 +114,23 @@ discard block |
||
114 | 114 | </div> |
115 | 115 | </div> |
116 | 116 | <div class="col"> |
117 | - <h3><?php _e( 'Even more embed providers' ); ?></h3> |
|
118 | - <p><?php _e( 'In addition to post embeds, WordPress 4.4 also adds support for five new oEmbed providers: Cloudup, Reddit Comments, ReverbNation, Speaker Deck, and VideoPress.' ); ?></p> |
|
117 | + <h3><?php _e('Even more embed providers'); ?></h3> |
|
118 | + <p><?php _e('In addition to post embeds, WordPress 4.4 also adds support for five new oEmbed providers: Cloudup, Reddit Comments, ReverbNation, Speaker Deck, and VideoPress.'); ?></p> |
|
119 | 119 | </div> |
120 | 120 | </div> |
121 | 121 | |
122 | 122 | <hr /> |
123 | 123 | |
124 | 124 | <div class="changelog"> |
125 | - <h3><?php _e( 'Under the Hood' ); ?></h3> |
|
125 | + <h3><?php _e('Under the Hood'); ?></h3> |
|
126 | 126 | |
127 | 127 | <div class="feature-section under-the-hood one-col"> |
128 | 128 | <div class="col"> |
129 | - <h4><?php _e( 'REST API infrastructure' ); ?></h4> |
|
129 | + <h4><?php _e('REST API infrastructure'); ?></h4> |
|
130 | 130 | <div class="two-col-text"> |
131 | - <p><?php _e( 'Infrastructure for the REST API has been integrated into core, marking a new era in developing with WordPress. The REST API serves to provide developers with a path forward for building and extending RESTful APIs on top of WordPress.' ); ?></p> |
|
131 | + <p><?php _e('Infrastructure for the REST API has been integrated into core, marking a new era in developing with WordPress. The REST API serves to provide developers with a path forward for building and extending RESTful APIs on top of WordPress.'); ?></p> |
|
132 | 132 | <p><?php |
133 | - if ( current_user_can( 'install_plugins' ) ) { |
|
133 | + if (current_user_can('install_plugins')) { |
|
134 | 134 | $url_args = array( |
135 | 135 | 'tab' => 'plugin-information', |
136 | 136 | 'plugin' => 'rest-api', |
@@ -139,13 +139,13 @@ discard block |
||
139 | 139 | 'height' => 550 |
140 | 140 | ); |
141 | 141 | |
142 | - $plugin_link = '<a href="' . esc_url( add_query_arg( $url_args, network_admin_url( 'plugin-install.php' ) ) ) . '" class="thickbox open-plugin-details-modal">WordPress REST API</a>'; |
|
142 | + $plugin_link = '<a href="'.esc_url(add_query_arg($url_args, network_admin_url('plugin-install.php'))).'" class="thickbox open-plugin-details-modal">WordPress REST API</a>'; |
|
143 | 143 | } else { |
144 | 144 | $plugin_link = '<a href="https://wordpress.org/plugins/rest-api">WordPress REST API</a>'; |
145 | 145 | } |
146 | 146 | |
147 | 147 | /* translators: WordPress REST API plugin link */ |
148 | - printf( __( 'Infrastructure is the first part of a multi-stage rollout for the REST API. Inclusion of core endpoints is targeted for an upcoming release. To get a sneak peek of the core endpoints, and for more information on extending the REST API, check out the official %s plugin.' ), $plugin_link ); |
|
148 | + printf(__('Infrastructure is the first part of a multi-stage rollout for the REST API. Inclusion of core endpoints is targeted for an upcoming release. To get a sneak peek of the core endpoints, and for more information on extending the REST API, check out the official %s plugin.'), $plugin_link); |
|
149 | 149 | ?></p> |
150 | 150 | </div> |
151 | 151 | </div> |
@@ -153,10 +153,10 @@ discard block |
||
153 | 153 | |
154 | 154 | <div class="feature-section under-the-hood three-col"> |
155 | 155 | <div class="col"> |
156 | - <h4><?php _e( 'Term meta' ); ?></h4> |
|
156 | + <h4><?php _e('Term meta'); ?></h4> |
|
157 | 157 | <p><?php |
158 | 158 | /* translators: 1: add_term_meta() docs link, 2: get_term_meta() docs link, 3: update_term_meta() docs link */ |
159 | - printf( __( 'Terms now support metadata, just like posts. See %1$s, %2$s, and %3$s for more information.' ), |
|
159 | + printf(__('Terms now support metadata, just like posts. See %1$s, %2$s, and %3$s for more information.'), |
|
160 | 160 | '<a href="https://developer.wordpress.org/reference/functions/add_term_meta"><code>add_term_meta()</code></a>', |
161 | 161 | '<a href="https://developer.wordpress.org/reference/functions/get_term_meta"><code>get_term_meta()</code></a>', |
162 | 162 | '<a href="https://developer.wordpress.org/reference/functions/update_term_meta"><code>update_term_meta()</code></a>' |
@@ -164,17 +164,17 @@ discard block |
||
164 | 164 | ?></p> |
165 | 165 | </div> |
166 | 166 | <div class="col"> |
167 | - <h4><?php _e( 'Comment query improvements' ); ?></h4> |
|
167 | + <h4><?php _e('Comment query improvements'); ?></h4> |
|
168 | 168 | <p><?php |
169 | 169 | /* translators: WP_Comment_Query class name */ |
170 | - printf( __( 'Comment queries now have cache handling to improve performance. New arguments in %s make crafting robust comment queries simpler.' ), '<code>WP_Comment_Query</code>' ); |
|
170 | + printf(__('Comment queries now have cache handling to improve performance. New arguments in %s make crafting robust comment queries simpler.'), '<code>WP_Comment_Query</code>'); |
|
171 | 171 | ?></p> |
172 | 172 | </div> |
173 | 173 | <div class="col"> |
174 | - <h4><?php _e( 'Term, comment, and network objects' ); ?></h4> |
|
174 | + <h4><?php _e('Term, comment, and network objects'); ?></h4> |
|
175 | 175 | <p><?php |
176 | 176 | /* translators: 1: WP_Term class name, WP_Comment class name, WP_Network class name */ |
177 | - printf( __( 'New %1$s, %2$s, and %3$s objects make interacting with terms, comments, and networks more predictable and intuitive in code.' ), |
|
177 | + printf(__('New %1$s, %2$s, and %3$s objects make interacting with terms, comments, and networks more predictable and intuitive in code.'), |
|
178 | 178 | '<code>WP_Term</code>', |
179 | 179 | '<code>WP_Comment</code>', |
180 | 180 | '<code>WP_Network</code>' |
@@ -184,48 +184,48 @@ discard block |
||
184 | 184 | </div> |
185 | 185 | |
186 | 186 | <div class="return-to-dashboard"> |
187 | - <?php if ( current_user_can( 'update_core' ) && isset( $_GET['updated'] ) ) : ?> |
|
188 | - <a href="<?php echo esc_url( self_admin_url( 'update-core.php' ) ); ?>"> |
|
189 | - <?php is_multisite() ? _e( 'Return to Updates' ) : _e( 'Return to Dashboard → Updates' ); ?> |
|
187 | + <?php if (current_user_can('update_core') && isset($_GET['updated'])) : ?> |
|
188 | + <a href="<?php echo esc_url(self_admin_url('update-core.php')); ?>"> |
|
189 | + <?php is_multisite() ? _e('Return to Updates') : _e('Return to Dashboard → Updates'); ?> |
|
190 | 190 | </a> | |
191 | 191 | <?php endif; ?> |
192 | - <a href="<?php echo esc_url( self_admin_url() ); ?>"><?php is_blog_admin() ? _e( 'Go to Dashboard → Home' ) : _e( 'Go to Dashboard' ); ?></a> |
|
192 | + <a href="<?php echo esc_url(self_admin_url()); ?>"><?php is_blog_admin() ? _e('Go to Dashboard → Home') : _e('Go to Dashboard'); ?></a> |
|
193 | 193 | </div> |
194 | 194 | |
195 | 195 | </div> |
196 | 196 | </div> |
197 | 197 | <?php |
198 | 198 | |
199 | -include( ABSPATH . 'wp-admin/admin-footer.php' ); |
|
199 | +include(ABSPATH.'wp-admin/admin-footer.php'); |
|
200 | 200 | |
201 | 201 | // These are strings we may use to describe maintenance/security releases, where we aim for no new strings. |
202 | 202 | return; |
203 | 203 | |
204 | -__( 'Maintenance Release' ); |
|
205 | -__( 'Maintenance Releases' ); |
|
204 | +__('Maintenance Release'); |
|
205 | +__('Maintenance Releases'); |
|
206 | 206 | |
207 | -__( 'Security Release' ); |
|
208 | -__( 'Security Releases' ); |
|
207 | +__('Security Release'); |
|
208 | +__('Security Releases'); |
|
209 | 209 | |
210 | -__( 'Maintenance and Security Release' ); |
|
211 | -__( 'Maintenance and Security Releases' ); |
|
210 | +__('Maintenance and Security Release'); |
|
211 | +__('Maintenance and Security Releases'); |
|
212 | 212 | |
213 | 213 | /* translators: %s: WordPress version number */ |
214 | -__( '<strong>Version %s</strong> addressed one security issue.' ); |
|
214 | +__('<strong>Version %s</strong> addressed one security issue.'); |
|
215 | 215 | /* translators: %s: WordPress version number */ |
216 | -__( '<strong>Version %s</strong> addressed some security issues.' ); |
|
216 | +__('<strong>Version %s</strong> addressed some security issues.'); |
|
217 | 217 | |
218 | 218 | /* translators: 1: WordPress version number, 2: plural number of bugs. */ |
219 | -_n_noop( '<strong>Version %1$s</strong> addressed %2$s bug.', |
|
220 | - '<strong>Version %1$s</strong> addressed %2$s bugs.' ); |
|
219 | +_n_noop('<strong>Version %1$s</strong> addressed %2$s bug.', |
|
220 | + '<strong>Version %1$s</strong> addressed %2$s bugs.'); |
|
221 | 221 | |
222 | 222 | /* translators: 1: WordPress version number, 2: plural number of bugs. Singular security issue. */ |
223 | -_n_noop( '<strong>Version %1$s</strong> addressed a security issue and fixed %2$s bug.', |
|
224 | - '<strong>Version %1$s</strong> addressed a security issue and fixed %2$s bugs.' ); |
|
223 | +_n_noop('<strong>Version %1$s</strong> addressed a security issue and fixed %2$s bug.', |
|
224 | + '<strong>Version %1$s</strong> addressed a security issue and fixed %2$s bugs.'); |
|
225 | 225 | |
226 | 226 | /* translators: 1: WordPress version number, 2: plural number of bugs. More than one security issue. */ |
227 | -_n_noop( '<strong>Version %1$s</strong> addressed some security issues and fixed %2$s bug.', |
|
228 | - '<strong>Version %1$s</strong> addressed some security issues and fixed %2$s bugs.' ); |
|
227 | +_n_noop('<strong>Version %1$s</strong> addressed some security issues and fixed %2$s bug.', |
|
228 | + '<strong>Version %1$s</strong> addressed some security issues and fixed %2$s bugs.'); |
|
229 | 229 | |
230 | 230 | /* translators: %s: Codex URL */ |
231 | -__( 'For more information, see <a href="%s">the release notes</a>.' ); |
|
231 | +__('For more information, see <a href="%s">the release notes</a>.'); |
@@ -8,13 +8,13 @@ discard block |
||
8 | 8 | */ |
9 | 9 | |
10 | 10 | /** Load WordPress Administration Bootstrap */ |
11 | -require_once( dirname( __FILE__ ) . '/admin.php' ); |
|
11 | +require_once(dirname(__FILE__).'/admin.php'); |
|
12 | 12 | |
13 | -if ( ! is_multisite() ) |
|
14 | - wp_die( __( 'Multisite support is not enabled.' ) ); |
|
13 | +if ( ! is_multisite()) |
|
14 | + wp_die(__('Multisite support is not enabled.')); |
|
15 | 15 | |
16 | -if ( !current_user_can('manage_network_themes') ) |
|
17 | - wp_die( __( 'You do not have sufficient permissions to manage network themes.' ) ); |
|
16 | +if ( ! current_user_can('manage_network_themes')) |
|
17 | + wp_die(__('You do not have sufficient permissions to manage network themes.')); |
|
18 | 18 | |
19 | 19 | $wp_list_table = _get_list_table('WP_MS_Themes_List_Table'); |
20 | 20 | $pagenum = $wp_list_table->get_pagenum(); |
@@ -24,183 +24,183 @@ discard block |
||
24 | 24 | $s = isset($_REQUEST['s']) ? $_REQUEST['s'] : ''; |
25 | 25 | |
26 | 26 | // Clean up request URI from temporary args for screen options/paging uri's to work as expected. |
27 | -$temp_args = array( 'enabled', 'disabled', 'deleted', 'error' ); |
|
28 | -$_SERVER['REQUEST_URI'] = remove_query_arg( $temp_args, $_SERVER['REQUEST_URI'] ); |
|
29 | -$referer = remove_query_arg( $temp_args, wp_get_referer() ); |
|
27 | +$temp_args = array('enabled', 'disabled', 'deleted', 'error'); |
|
28 | +$_SERVER['REQUEST_URI'] = remove_query_arg($temp_args, $_SERVER['REQUEST_URI']); |
|
29 | +$referer = remove_query_arg($temp_args, wp_get_referer()); |
|
30 | 30 | |
31 | -if ( $action ) { |
|
32 | - $allowed_themes = get_site_option( 'allowedthemes' ); |
|
33 | - switch ( $action ) { |
|
31 | +if ($action) { |
|
32 | + $allowed_themes = get_site_option('allowedthemes'); |
|
33 | + switch ($action) { |
|
34 | 34 | case 'enable': |
35 | - check_admin_referer('enable-theme_' . $_GET['theme']); |
|
36 | - $allowed_themes[ $_GET['theme'] ] = true; |
|
37 | - update_site_option( 'allowedthemes', $allowed_themes ); |
|
38 | - if ( false === strpos( $referer, '/network/themes.php' ) ) |
|
39 | - wp_redirect( network_admin_url( 'themes.php?enabled=1' ) ); |
|
35 | + check_admin_referer('enable-theme_'.$_GET['theme']); |
|
36 | + $allowed_themes[$_GET['theme']] = true; |
|
37 | + update_site_option('allowedthemes', $allowed_themes); |
|
38 | + if (false === strpos($referer, '/network/themes.php')) |
|
39 | + wp_redirect(network_admin_url('themes.php?enabled=1')); |
|
40 | 40 | else |
41 | - wp_safe_redirect( add_query_arg( 'enabled', 1, $referer ) ); |
|
41 | + wp_safe_redirect(add_query_arg('enabled', 1, $referer)); |
|
42 | 42 | exit; |
43 | 43 | case 'disable': |
44 | - check_admin_referer('disable-theme_' . $_GET['theme']); |
|
45 | - unset( $allowed_themes[ $_GET['theme'] ] ); |
|
46 | - update_site_option( 'allowedthemes', $allowed_themes ); |
|
47 | - wp_safe_redirect( add_query_arg( 'disabled', '1', $referer ) ); |
|
44 | + check_admin_referer('disable-theme_'.$_GET['theme']); |
|
45 | + unset($allowed_themes[$_GET['theme']]); |
|
46 | + update_site_option('allowedthemes', $allowed_themes); |
|
47 | + wp_safe_redirect(add_query_arg('disabled', '1', $referer)); |
|
48 | 48 | exit; |
49 | 49 | case 'enable-selected': |
50 | 50 | check_admin_referer('bulk-themes'); |
51 | - $themes = isset( $_POST['checked'] ) ? (array) $_POST['checked'] : array(); |
|
52 | - if ( empty($themes) ) { |
|
53 | - wp_safe_redirect( add_query_arg( 'error', 'none', $referer ) ); |
|
51 | + $themes = isset($_POST['checked']) ? (array) $_POST['checked'] : array(); |
|
52 | + if (empty($themes)) { |
|
53 | + wp_safe_redirect(add_query_arg('error', 'none', $referer)); |
|
54 | 54 | exit; |
55 | 55 | } |
56 | - foreach ( (array) $themes as $theme ) |
|
57 | - $allowed_themes[ $theme ] = true; |
|
58 | - update_site_option( 'allowedthemes', $allowed_themes ); |
|
59 | - wp_safe_redirect( add_query_arg( 'enabled', count( $themes ), $referer ) ); |
|
56 | + foreach ((array) $themes as $theme) |
|
57 | + $allowed_themes[$theme] = true; |
|
58 | + update_site_option('allowedthemes', $allowed_themes); |
|
59 | + wp_safe_redirect(add_query_arg('enabled', count($themes), $referer)); |
|
60 | 60 | exit; |
61 | 61 | case 'disable-selected': |
62 | 62 | check_admin_referer('bulk-themes'); |
63 | - $themes = isset( $_POST['checked'] ) ? (array) $_POST['checked'] : array(); |
|
64 | - if ( empty($themes) ) { |
|
65 | - wp_safe_redirect( add_query_arg( 'error', 'none', $referer ) ); |
|
63 | + $themes = isset($_POST['checked']) ? (array) $_POST['checked'] : array(); |
|
64 | + if (empty($themes)) { |
|
65 | + wp_safe_redirect(add_query_arg('error', 'none', $referer)); |
|
66 | 66 | exit; |
67 | 67 | } |
68 | - foreach ( (array) $themes as $theme ) |
|
69 | - unset( $allowed_themes[ $theme ] ); |
|
70 | - update_site_option( 'allowedthemes', $allowed_themes ); |
|
71 | - wp_safe_redirect( add_query_arg( 'disabled', count( $themes ), $referer ) ); |
|
68 | + foreach ((array) $themes as $theme) |
|
69 | + unset($allowed_themes[$theme]); |
|
70 | + update_site_option('allowedthemes', $allowed_themes); |
|
71 | + wp_safe_redirect(add_query_arg('disabled', count($themes), $referer)); |
|
72 | 72 | exit; |
73 | 73 | case 'update-selected' : |
74 | - check_admin_referer( 'bulk-themes' ); |
|
74 | + check_admin_referer('bulk-themes'); |
|
75 | 75 | |
76 | - if ( isset( $_GET['themes'] ) ) |
|
77 | - $themes = explode( ',', $_GET['themes'] ); |
|
78 | - elseif ( isset( $_POST['checked'] ) ) |
|
76 | + if (isset($_GET['themes'])) |
|
77 | + $themes = explode(',', $_GET['themes']); |
|
78 | + elseif (isset($_POST['checked'])) |
|
79 | 79 | $themes = (array) $_POST['checked']; |
80 | 80 | else |
81 | 81 | $themes = array(); |
82 | 82 | |
83 | - $title = __( 'Update Themes' ); |
|
83 | + $title = __('Update Themes'); |
|
84 | 84 | $parent_file = 'themes.php'; |
85 | 85 | |
86 | - require_once(ABSPATH . 'wp-admin/admin-header.php'); |
|
86 | + require_once(ABSPATH.'wp-admin/admin-header.php'); |
|
87 | 87 | |
88 | 88 | echo '<div class="wrap">'; |
89 | - echo '<h1>' . esc_html( $title ) . '</h1>'; |
|
89 | + echo '<h1>'.esc_html($title).'</h1>'; |
|
90 | 90 | |
91 | - $url = self_admin_url('update.php?action=update-selected-themes&themes=' . urlencode( join(',', $themes) )); |
|
91 | + $url = self_admin_url('update.php?action=update-selected-themes&themes='.urlencode(join(',', $themes))); |
|
92 | 92 | $url = wp_nonce_url($url, 'bulk-update-themes'); |
93 | 93 | |
94 | 94 | echo "<iframe src='$url' style='width: 100%; height:100%; min-height:850px;'></iframe>"; |
95 | 95 | echo '</div>'; |
96 | - require_once(ABSPATH . 'wp-admin/admin-footer.php'); |
|
96 | + require_once(ABSPATH.'wp-admin/admin-footer.php'); |
|
97 | 97 | exit; |
98 | 98 | case 'delete-selected': |
99 | - if ( ! current_user_can( 'delete_themes' ) ) { |
|
100 | - wp_die( __('You do not have sufficient permissions to delete themes for this site.') ); |
|
99 | + if ( ! current_user_can('delete_themes')) { |
|
100 | + wp_die(__('You do not have sufficient permissions to delete themes for this site.')); |
|
101 | 101 | } |
102 | 102 | |
103 | - check_admin_referer( 'bulk-themes' ); |
|
103 | + check_admin_referer('bulk-themes'); |
|
104 | 104 | |
105 | - $themes = isset( $_REQUEST['checked'] ) ? (array) $_REQUEST['checked'] : array(); |
|
105 | + $themes = isset($_REQUEST['checked']) ? (array) $_REQUEST['checked'] : array(); |
|
106 | 106 | |
107 | - if ( empty( $themes ) ) { |
|
108 | - wp_safe_redirect( add_query_arg( 'error', 'none', $referer ) ); |
|
107 | + if (empty($themes)) { |
|
108 | + wp_safe_redirect(add_query_arg('error', 'none', $referer)); |
|
109 | 109 | exit; |
110 | 110 | } |
111 | 111 | |
112 | - $themes = array_diff( $themes, array( get_option( 'stylesheet' ), get_option( 'template' ) ) ); |
|
112 | + $themes = array_diff($themes, array(get_option('stylesheet'), get_option('template'))); |
|
113 | 113 | |
114 | - if ( empty( $themes ) ) { |
|
115 | - wp_safe_redirect( add_query_arg( 'error', 'main', $referer ) ); |
|
114 | + if (empty($themes)) { |
|
115 | + wp_safe_redirect(add_query_arg('error', 'main', $referer)); |
|
116 | 116 | exit; |
117 | 117 | } |
118 | 118 | |
119 | 119 | $theme_info = array(); |
120 | - foreach ( $themes as $key => $theme ) { |
|
121 | - $theme_info[ $theme ] = wp_get_theme( $theme ); |
|
120 | + foreach ($themes as $key => $theme) { |
|
121 | + $theme_info[$theme] = wp_get_theme($theme); |
|
122 | 122 | } |
123 | 123 | |
124 | - include(ABSPATH . 'wp-admin/update.php'); |
|
124 | + include(ABSPATH.'wp-admin/update.php'); |
|
125 | 125 | |
126 | 126 | $parent_file = 'themes.php'; |
127 | 127 | |
128 | - if ( ! isset( $_REQUEST['verify-delete'] ) ) { |
|
129 | - wp_enqueue_script( 'jquery' ); |
|
130 | - require_once( ABSPATH . 'wp-admin/admin-header.php' ); |
|
131 | - $themes_to_delete = count( $themes ); |
|
128 | + if ( ! isset($_REQUEST['verify-delete'])) { |
|
129 | + wp_enqueue_script('jquery'); |
|
130 | + require_once(ABSPATH.'wp-admin/admin-header.php'); |
|
131 | + $themes_to_delete = count($themes); |
|
132 | 132 | ?> |
133 | 133 | <div class="wrap"> |
134 | - <?php if ( 1 == $themes_to_delete ) : ?> |
|
135 | - <h1><?php _e( 'Delete Theme' ); ?></h1> |
|
136 | - <div class="error"><p><strong><?php _e( 'Caution:' ); ?></strong> <?php _e( 'This theme may be active on other sites in the network.' ); ?></p></div> |
|
137 | - <p><?php _e( 'You are about to remove the following theme:' ); ?></p> |
|
134 | + <?php if (1 == $themes_to_delete) : ?> |
|
135 | + <h1><?php _e('Delete Theme'); ?></h1> |
|
136 | + <div class="error"><p><strong><?php _e('Caution:'); ?></strong> <?php _e('This theme may be active on other sites in the network.'); ?></p></div> |
|
137 | + <p><?php _e('You are about to remove the following theme:'); ?></p> |
|
138 | 138 | <?php else : ?> |
139 | - <h1><?php _e( 'Delete Themes' ); ?></h1> |
|
140 | - <div class="error"><p><strong><?php _e( 'Caution:' ); ?></strong> <?php _e( 'These themes may be active on other sites in the network.' ); ?></p></div> |
|
141 | - <p><?php _e( 'You are about to remove the following themes:' ); ?></p> |
|
139 | + <h1><?php _e('Delete Themes'); ?></h1> |
|
140 | + <div class="error"><p><strong><?php _e('Caution:'); ?></strong> <?php _e('These themes may be active on other sites in the network.'); ?></p></div> |
|
141 | + <p><?php _e('You are about to remove the following themes:'); ?></p> |
|
142 | 142 | <?php endif; ?> |
143 | 143 | <ul class="ul-disc"> |
144 | 144 | <?php |
145 | - foreach ( $theme_info as $theme ) { |
|
146 | - echo '<li>' . sprintf( |
|
145 | + foreach ($theme_info as $theme) { |
|
146 | + echo '<li>'.sprintf( |
|
147 | 147 | /* translators: 1: theme name, 2: theme author */ |
148 | - _x( '%1$s by %2$s', 'theme' ), |
|
149 | - '<strong>' . $theme->display( 'Name' ) . '</strong>', |
|
150 | - '<em>' . $theme->display( 'Author' ) . '</em>' |
|
151 | - ) . '</li>'; |
|
148 | + _x('%1$s by %2$s', 'theme'), |
|
149 | + '<strong>'.$theme->display('Name').'</strong>', |
|
150 | + '<em>'.$theme->display('Author').'</em>' |
|
151 | + ).'</li>'; |
|
152 | 152 | } |
153 | 153 | ?> |
154 | 154 | </ul> |
155 | - <?php if ( 1 == $themes_to_delete ) : ?> |
|
156 | - <p><?php _e( 'Are you sure you wish to delete this theme?' ); ?></p> |
|
155 | + <?php if (1 == $themes_to_delete) : ?> |
|
156 | + <p><?php _e('Are you sure you wish to delete this theme?'); ?></p> |
|
157 | 157 | <?php else : ?> |
158 | - <p><?php _e( 'Are you sure you wish to delete these themes?' ); ?></p> |
|
158 | + <p><?php _e('Are you sure you wish to delete these themes?'); ?></p> |
|
159 | 159 | <?php endif; ?> |
160 | 160 | <form method="post" action="<?php echo esc_url($_SERVER['REQUEST_URI']); ?>" style="display:inline;"> |
161 | 161 | <input type="hidden" name="verify-delete" value="1" /> |
162 | 162 | <input type="hidden" name="action" value="delete-selected" /> |
163 | 163 | <?php |
164 | - foreach ( (array) $themes as $theme ) { |
|
165 | - echo '<input type="hidden" name="checked[]" value="' . esc_attr($theme) . '" />'; |
|
164 | + foreach ((array) $themes as $theme) { |
|
165 | + echo '<input type="hidden" name="checked[]" value="'.esc_attr($theme).'" />'; |
|
166 | 166 | } |
167 | 167 | |
168 | - wp_nonce_field( 'bulk-themes' ); |
|
168 | + wp_nonce_field('bulk-themes'); |
|
169 | 169 | |
170 | - if ( 1 == $themes_to_delete ) { |
|
171 | - submit_button( __( 'Yes, delete this theme' ), 'button', 'submit', false ); |
|
170 | + if (1 == $themes_to_delete) { |
|
171 | + submit_button(__('Yes, delete this theme'), 'button', 'submit', false); |
|
172 | 172 | } else { |
173 | - submit_button( __( 'Yes, delete these themes' ), 'button', 'submit', false ); |
|
173 | + submit_button(__('Yes, delete these themes'), 'button', 'submit', false); |
|
174 | 174 | } |
175 | 175 | ?> |
176 | 176 | </form> |
177 | 177 | <?php |
178 | 178 | $referer = wp_get_referer(); |
179 | 179 | ?> |
180 | - <form method="post" action="<?php echo $referer ? esc_url( $referer ) : ''; ?>" style="display:inline;"> |
|
181 | - <?php submit_button( __( 'No, return me to the theme list' ), 'button', 'submit', false ); ?> |
|
180 | + <form method="post" action="<?php echo $referer ? esc_url($referer) : ''; ?>" style="display:inline;"> |
|
181 | + <?php submit_button(__('No, return me to the theme list'), 'button', 'submit', false); ?> |
|
182 | 182 | </form> |
183 | 183 | </div> |
184 | 184 | <?php |
185 | - require_once(ABSPATH . 'wp-admin/admin-footer.php'); |
|
185 | + require_once(ABSPATH.'wp-admin/admin-footer.php'); |
|
186 | 186 | exit; |
187 | 187 | } // Endif verify-delete |
188 | 188 | |
189 | - foreach ( $themes as $theme ) { |
|
190 | - $delete_result = delete_theme( $theme, esc_url( add_query_arg( array( |
|
189 | + foreach ($themes as $theme) { |
|
190 | + $delete_result = delete_theme($theme, esc_url(add_query_arg(array( |
|
191 | 191 | 'verify-delete' => 1, |
192 | 192 | 'action' => 'delete-selected', |
193 | 193 | 'checked' => $_REQUEST['checked'], |
194 | 194 | '_wpnonce' => $_REQUEST['_wpnonce'] |
195 | - ), network_admin_url( 'themes.php' ) ) ) ); |
|
195 | + ), network_admin_url('themes.php')))); |
|
196 | 196 | } |
197 | 197 | |
198 | - $paged = ( $_REQUEST['paged'] ) ? $_REQUEST['paged'] : 1; |
|
199 | - wp_redirect( add_query_arg( array( |
|
200 | - 'deleted' => count( $themes ), |
|
198 | + $paged = ($_REQUEST['paged']) ? $_REQUEST['paged'] : 1; |
|
199 | + wp_redirect(add_query_arg(array( |
|
200 | + 'deleted' => count($themes), |
|
201 | 201 | 'paged' => $paged, |
202 | 202 | 's' => $s |
203 | - ), network_admin_url( 'themes.php' ) ) ); |
|
203 | + ), network_admin_url('themes.php'))); |
|
204 | 204 | exit; |
205 | 205 | } |
206 | 206 | } |
@@ -209,89 +209,89 @@ discard block |
||
209 | 209 | |
210 | 210 | add_thickbox(); |
211 | 211 | |
212 | -add_screen_option( 'per_page' ); |
|
212 | +add_screen_option('per_page'); |
|
213 | 213 | |
214 | -get_current_screen()->add_help_tab( array( |
|
214 | +get_current_screen()->add_help_tab(array( |
|
215 | 215 | 'id' => 'overview', |
216 | 216 | 'title' => __('Overview'), |
217 | 217 | 'content' => |
218 | - '<p>' . __('This screen enables and disables the inclusion of themes available to choose in the Appearance menu for each site. It does not activate or deactivate which theme a site is currently using.') . '</p>' . |
|
219 | - '<p>' . __('If the network admin disables a theme that is in use, it can still remain selected on that site. If another theme is chosen, the disabled theme will not appear in the site’s Appearance > Themes screen.') . '</p>' . |
|
220 | - '<p>' . __('Themes can be enabled on a site by site basis by the network admin on the Edit Site screen (which has a Themes tab); get there via the Edit action link on the All Sites screen. Only network admins are able to install or edit themes.') . '</p>' |
|
221 | -) ); |
|
218 | + '<p>'.__('This screen enables and disables the inclusion of themes available to choose in the Appearance menu for each site. It does not activate or deactivate which theme a site is currently using.').'</p>'. |
|
219 | + '<p>'.__('If the network admin disables a theme that is in use, it can still remain selected on that site. If another theme is chosen, the disabled theme will not appear in the site’s Appearance > Themes screen.').'</p>'. |
|
220 | + '<p>'.__('Themes can be enabled on a site by site basis by the network admin on the Edit Site screen (which has a Themes tab); get there via the Edit action link on the All Sites screen. Only network admins are able to install or edit themes.').'</p>' |
|
221 | +)); |
|
222 | 222 | |
223 | 223 | get_current_screen()->set_help_sidebar( |
224 | - '<p><strong>' . __('For more information:') . '</strong></p>' . |
|
225 | - '<p>' . __('<a href="https://codex.wordpress.org/Network_Admin_Themes_Screen" target="_blank">Documentation on Network Themes</a>') . '</p>' . |
|
226 | - '<p>' . __('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>' |
|
224 | + '<p><strong>'.__('For more information:').'</strong></p>'. |
|
225 | + '<p>'.__('<a href="https://codex.wordpress.org/Network_Admin_Themes_Screen" target="_blank">Documentation on Network Themes</a>').'</p>'. |
|
226 | + '<p>'.__('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>').'</p>' |
|
227 | 227 | ); |
228 | 228 | |
229 | -get_current_screen()->set_screen_reader_content( array( |
|
230 | - 'heading_views' => __( 'Filter themes list' ), |
|
231 | - 'heading_pagination' => __( 'Themes list navigation' ), |
|
232 | - 'heading_list' => __( 'Themes list' ), |
|
233 | -) ); |
|
229 | +get_current_screen()->set_screen_reader_content(array( |
|
230 | + 'heading_views' => __('Filter themes list'), |
|
231 | + 'heading_pagination' => __('Themes list navigation'), |
|
232 | + 'heading_list' => __('Themes list'), |
|
233 | +)); |
|
234 | 234 | |
235 | 235 | $title = __('Themes'); |
236 | 236 | $parent_file = 'themes.php'; |
237 | 237 | |
238 | -wp_enqueue_script( 'theme-preview' ); |
|
238 | +wp_enqueue_script('theme-preview'); |
|
239 | 239 | |
240 | -require_once(ABSPATH . 'wp-admin/admin-header.php'); |
|
240 | +require_once(ABSPATH.'wp-admin/admin-header.php'); |
|
241 | 241 | |
242 | 242 | ?> |
243 | 243 | |
244 | 244 | <div class="wrap"> |
245 | -<h1><?php echo esc_html( $title ); if ( current_user_can('install_themes') ) { ?> <a href="theme-install.php" class="page-title-action"><?php echo esc_html_x('Add New', 'theme'); ?></a><?php } |
|
246 | -if ( isset( $_REQUEST['s'] ) && strlen( $_REQUEST['s'] ) ) { |
|
245 | +<h1><?php echo esc_html($title); if (current_user_can('install_themes')) { ?> <a href="theme-install.php" class="page-title-action"><?php echo esc_html_x('Add New', 'theme'); ?></a><?php } |
|
246 | +if (isset($_REQUEST['s']) && strlen($_REQUEST['s'])) { |
|
247 | 247 | /* translators: %s: search keywords */ |
248 | - printf( '<span class="subtitle">' . __( 'Search results for “%s”' ) . '</span>', esc_html( $s ) ); |
|
248 | + printf('<span class="subtitle">'.__('Search results for “%s”').'</span>', esc_html($s)); |
|
249 | 249 | } |
250 | 250 | ?> |
251 | 251 | </h1> |
252 | 252 | |
253 | 253 | <?php |
254 | -if ( isset( $_GET['enabled'] ) ) { |
|
255 | - $enabled = absint( $_GET['enabled'] ); |
|
256 | - if ( 1 == $enabled ) { |
|
257 | - $message = __( 'Theme enabled.' ); |
|
254 | +if (isset($_GET['enabled'])) { |
|
255 | + $enabled = absint($_GET['enabled']); |
|
256 | + if (1 == $enabled) { |
|
257 | + $message = __('Theme enabled.'); |
|
258 | 258 | } else { |
259 | - $message = _n( '%s theme enabled.', '%s themes enabled.', $enabled ); |
|
259 | + $message = _n('%s theme enabled.', '%s themes enabled.', $enabled); |
|
260 | 260 | } |
261 | - echo '<div id="message" class="updated notice is-dismissible"><p>' . sprintf( $message, number_format_i18n( $enabled ) ) . '</p></div>'; |
|
262 | -} elseif ( isset( $_GET['disabled'] ) ) { |
|
263 | - $disabled = absint( $_GET['disabled'] ); |
|
264 | - if ( 1 == $disabled ) { |
|
265 | - $message = __( 'Theme disabled.' ); |
|
261 | + echo '<div id="message" class="updated notice is-dismissible"><p>'.sprintf($message, number_format_i18n($enabled)).'</p></div>'; |
|
262 | +} elseif (isset($_GET['disabled'])) { |
|
263 | + $disabled = absint($_GET['disabled']); |
|
264 | + if (1 == $disabled) { |
|
265 | + $message = __('Theme disabled.'); |
|
266 | 266 | } else { |
267 | - $message = _n( '%s theme disabled.', '%s themes disabled.', $disabled ); |
|
267 | + $message = _n('%s theme disabled.', '%s themes disabled.', $disabled); |
|
268 | 268 | } |
269 | - echo '<div id="message" class="updated notice is-dismissible"><p>' . sprintf( $message, number_format_i18n( $disabled ) ) . '</p></div>'; |
|
270 | -} elseif ( isset( $_GET['deleted'] ) ) { |
|
271 | - $deleted = absint( $_GET['deleted'] ); |
|
272 | - if ( 1 == $deleted ) { |
|
273 | - $message = __( 'Theme deleted.' ); |
|
269 | + echo '<div id="message" class="updated notice is-dismissible"><p>'.sprintf($message, number_format_i18n($disabled)).'</p></div>'; |
|
270 | +} elseif (isset($_GET['deleted'])) { |
|
271 | + $deleted = absint($_GET['deleted']); |
|
272 | + if (1 == $deleted) { |
|
273 | + $message = __('Theme deleted.'); |
|
274 | 274 | } else { |
275 | - $message = _n( '%s theme deleted.', '%s themes deleted.', $deleted ); |
|
275 | + $message = _n('%s theme deleted.', '%s themes deleted.', $deleted); |
|
276 | 276 | } |
277 | - echo '<div id="message" class="updated notice is-dismissible"><p>' . sprintf( $message, number_format_i18n( $deleted ) ) . '</p></div>'; |
|
278 | -} elseif ( isset( $_GET['error'] ) && 'none' == $_GET['error'] ) { |
|
279 | - echo '<div id="message" class="error notice is-dismissible"><p>' . __( 'No theme selected.' ) . '</p></div>'; |
|
280 | -} elseif ( isset( $_GET['error'] ) && 'main' == $_GET['error'] ) { |
|
281 | - echo '<div class="error notice is-dismissible"><p>' . __( 'You cannot delete a theme while it is active on the main site.' ) . '</p></div>'; |
|
277 | + echo '<div id="message" class="updated notice is-dismissible"><p>'.sprintf($message, number_format_i18n($deleted)).'</p></div>'; |
|
278 | +} elseif (isset($_GET['error']) && 'none' == $_GET['error']) { |
|
279 | + echo '<div id="message" class="error notice is-dismissible"><p>'.__('No theme selected.').'</p></div>'; |
|
280 | +} elseif (isset($_GET['error']) && 'main' == $_GET['error']) { |
|
281 | + echo '<div class="error notice is-dismissible"><p>'.__('You cannot delete a theme while it is active on the main site.').'</p></div>'; |
|
282 | 282 | } |
283 | 283 | |
284 | 284 | ?> |
285 | 285 | |
286 | 286 | <form method="get"> |
287 | -<?php $wp_list_table->search_box( __( 'Search Installed Themes' ), 'theme' ); ?> |
|
287 | +<?php $wp_list_table->search_box(__('Search Installed Themes'), 'theme'); ?> |
|
288 | 288 | </form> |
289 | 289 | |
290 | 290 | <?php |
291 | 291 | $wp_list_table->views(); |
292 | 292 | |
293 | -if ( 'broken' == $status ) |
|
294 | - echo '<p class="clear">' . __( 'The following themes are installed but incomplete.' ) . '</p>'; |
|
293 | +if ('broken' == $status) |
|
294 | + echo '<p class="clear">'.__('The following themes are installed but incomplete.').'</p>'; |
|
295 | 295 | ?> |
296 | 296 | |
297 | 297 | <form method="post"> |
@@ -304,4 +304,4 @@ discard block |
||
304 | 304 | </div> |
305 | 305 | |
306 | 306 | <?php |
307 | -include(ABSPATH . 'wp-admin/admin-footer.php'); |
|
307 | +include(ABSPATH.'wp-admin/admin-footer.php'); |
@@ -10,11 +10,13 @@ discard block |
||
10 | 10 | /** Load WordPress Administration Bootstrap */ |
11 | 11 | require_once( dirname( __FILE__ ) . '/admin.php' ); |
12 | 12 | |
13 | -if ( ! is_multisite() ) |
|
13 | +if ( ! is_multisite() ) { |
|
14 | 14 | wp_die( __( 'Multisite support is not enabled.' ) ); |
15 | +} |
|
15 | 16 | |
16 | -if ( !current_user_can('manage_network_themes') ) |
|
17 | +if ( !current_user_can('manage_network_themes') ) { |
|
17 | 18 | wp_die( __( 'You do not have sufficient permissions to manage network themes.' ) ); |
19 | +} |
|
18 | 20 | |
19 | 21 | $wp_list_table = _get_list_table('WP_MS_Themes_List_Table'); |
20 | 22 | $pagenum = $wp_list_table->get_pagenum(); |
@@ -35,10 +37,11 @@ discard block |
||
35 | 37 | check_admin_referer('enable-theme_' . $_GET['theme']); |
36 | 38 | $allowed_themes[ $_GET['theme'] ] = true; |
37 | 39 | update_site_option( 'allowedthemes', $allowed_themes ); |
38 | - if ( false === strpos( $referer, '/network/themes.php' ) ) |
|
39 | - wp_redirect( network_admin_url( 'themes.php?enabled=1' ) ); |
|
40 | - else |
|
41 | - wp_safe_redirect( add_query_arg( 'enabled', 1, $referer ) ); |
|
40 | + if ( false === strpos( $referer, '/network/themes.php' ) ) { |
|
41 | + wp_redirect( network_admin_url( 'themes.php?enabled=1' ) ); |
|
42 | + } else { |
|
43 | + wp_safe_redirect( add_query_arg( 'enabled', 1, $referer ) ); |
|
44 | + } |
|
42 | 45 | exit; |
43 | 46 | case 'disable': |
44 | 47 | check_admin_referer('disable-theme_' . $_GET['theme']); |
@@ -53,8 +56,9 @@ discard block |
||
53 | 56 | wp_safe_redirect( add_query_arg( 'error', 'none', $referer ) ); |
54 | 57 | exit; |
55 | 58 | } |
56 | - foreach ( (array) $themes as $theme ) |
|
57 | - $allowed_themes[ $theme ] = true; |
|
59 | + foreach ( (array) $themes as $theme ) { |
|
60 | + $allowed_themes[ $theme ] = true; |
|
61 | + } |
|
58 | 62 | update_site_option( 'allowedthemes', $allowed_themes ); |
59 | 63 | wp_safe_redirect( add_query_arg( 'enabled', count( $themes ), $referer ) ); |
60 | 64 | exit; |
@@ -65,20 +69,22 @@ discard block |
||
65 | 69 | wp_safe_redirect( add_query_arg( 'error', 'none', $referer ) ); |
66 | 70 | exit; |
67 | 71 | } |
68 | - foreach ( (array) $themes as $theme ) |
|
69 | - unset( $allowed_themes[ $theme ] ); |
|
72 | + foreach ( (array) $themes as $theme ) { |
|
73 | + unset( $allowed_themes[ $theme ] ); |
|
74 | + } |
|
70 | 75 | update_site_option( 'allowedthemes', $allowed_themes ); |
71 | 76 | wp_safe_redirect( add_query_arg( 'disabled', count( $themes ), $referer ) ); |
72 | 77 | exit; |
73 | 78 | case 'update-selected' : |
74 | 79 | check_admin_referer( 'bulk-themes' ); |
75 | 80 | |
76 | - if ( isset( $_GET['themes'] ) ) |
|
77 | - $themes = explode( ',', $_GET['themes'] ); |
|
78 | - elseif ( isset( $_POST['checked'] ) ) |
|
79 | - $themes = (array) $_POST['checked']; |
|
80 | - else |
|
81 | - $themes = array(); |
|
81 | + if ( isset( $_GET['themes'] ) ) { |
|
82 | + $themes = explode( ',', $_GET['themes'] ); |
|
83 | + } elseif ( isset( $_POST['checked'] ) ) { |
|
84 | + $themes = (array) $_POST['checked']; |
|
85 | + } else { |
|
86 | + $themes = array(); |
|
87 | + } |
|
82 | 88 | |
83 | 89 | $title = __( 'Update Themes' ); |
84 | 90 | $parent_file = 'themes.php'; |
@@ -135,8 +141,11 @@ discard block |
||
135 | 141 | <h1><?php _e( 'Delete Theme' ); ?></h1> |
136 | 142 | <div class="error"><p><strong><?php _e( 'Caution:' ); ?></strong> <?php _e( 'This theme may be active on other sites in the network.' ); ?></p></div> |
137 | 143 | <p><?php _e( 'You are about to remove the following theme:' ); ?></p> |
138 | - <?php else : ?> |
|
139 | - <h1><?php _e( 'Delete Themes' ); ?></h1> |
|
144 | + <?php else { |
|
145 | + : ?> |
|
146 | + <h1><?php _e( 'Delete Themes' ); |
|
147 | +} |
|
148 | +?></h1> |
|
140 | 149 | <div class="error"><p><strong><?php _e( 'Caution:' ); ?></strong> <?php _e( 'These themes may be active on other sites in the network.' ); ?></p></div> |
141 | 150 | <p><?php _e( 'You are about to remove the following themes:' ); ?></p> |
142 | 151 | <?php endif; ?> |
@@ -154,8 +163,11 @@ discard block |
||
154 | 163 | </ul> |
155 | 164 | <?php if ( 1 == $themes_to_delete ) : ?> |
156 | 165 | <p><?php _e( 'Are you sure you wish to delete this theme?' ); ?></p> |
157 | - <?php else : ?> |
|
158 | - <p><?php _e( 'Are you sure you wish to delete these themes?' ); ?></p> |
|
166 | + <?php else { |
|
167 | + : ?> |
|
168 | + <p><?php _e( 'Are you sure you wish to delete these themes?' ); |
|
169 | +} |
|
170 | +?></p> |
|
159 | 171 | <?php endif; ?> |
160 | 172 | <form method="post" action="<?php echo esc_url($_SERVER['REQUEST_URI']); ?>" style="display:inline;"> |
161 | 173 | <input type="hidden" name="verify-delete" value="1" /> |
@@ -290,8 +302,9 @@ discard block |
||
290 | 302 | <?php |
291 | 303 | $wp_list_table->views(); |
292 | 304 | |
293 | -if ( 'broken' == $status ) |
|
305 | +if ( 'broken' == $status ) { |
|
294 | 306 | echo '<p class="clear">' . __( 'The following themes are installed but incomplete.' ) . '</p>'; |
307 | +} |
|
295 | 308 | ?> |
296 | 309 | |
297 | 310 | <form method="post"> |
@@ -8,36 +8,36 @@ discard block |
||
8 | 8 | */ |
9 | 9 | |
10 | 10 | /** Load WordPress Administration Bootstrap */ |
11 | -require_once( dirname( __FILE__ ) . '/admin.php' ); |
|
11 | +require_once(dirname(__FILE__).'/admin.php'); |
|
12 | 12 | |
13 | -if ( ! is_multisite() ) |
|
14 | - wp_die( __( 'Multisite support is not enabled.' ) ); |
|
13 | +if ( ! is_multisite()) |
|
14 | + wp_die(__('Multisite support is not enabled.')); |
|
15 | 15 | |
16 | -if ( ! current_user_can( 'manage_sites' ) ) |
|
17 | - wp_die( __( 'You do not have sufficient permissions to manage themes for this site.' ) ); |
|
16 | +if ( ! current_user_can('manage_sites')) |
|
17 | + wp_die(__('You do not have sufficient permissions to manage themes for this site.')); |
|
18 | 18 | |
19 | -get_current_screen()->add_help_tab( array( |
|
19 | +get_current_screen()->add_help_tab(array( |
|
20 | 20 | 'id' => 'overview', |
21 | 21 | 'title' => __('Overview'), |
22 | 22 | 'content' => |
23 | - '<p>' . __('The menu is for editing information specific to individual sites, particularly if the admin area of a site is unavailable.') . '</p>' . |
|
24 | - '<p>' . __('<strong>Info</strong> — The site URL is rarely edited as this can cause the site to not work properly. The Registered date and Last Updated date are displayed. Network admins can mark a site as archived, spam, deleted and mature, to remove from public listings or disable.') . '</p>' . |
|
25 | - '<p>' . __('<strong>Users</strong> — This displays the users associated with this site. You can also change their role, reset their password, or remove them from the site. Removing the user from the site does not remove the user from the network.') . '</p>' . |
|
26 | - '<p>' . sprintf( __('<strong>Themes</strong> — This area shows themes that are not already enabled across the network. Enabling a theme in this menu makes it accessible to this site. It does not activate the theme, but allows it to show in the site’s Appearance menu. To enable a theme for the entire network, see the <a href="%s">Network Themes</a> screen.' ), network_admin_url( 'themes.php' ) ) . '</p>' . |
|
27 | - '<p>' . __('<strong>Settings</strong> — This page shows a list of all settings associated with this site. Some are created by WordPress and others are created by plugins you activate. Note that some fields are grayed out and say Serialized Data. You cannot modify these values due to the way the setting is stored in the database.') . '</p>' |
|
28 | -) ); |
|
23 | + '<p>'.__('The menu is for editing information specific to individual sites, particularly if the admin area of a site is unavailable.').'</p>'. |
|
24 | + '<p>'.__('<strong>Info</strong> — The site URL is rarely edited as this can cause the site to not work properly. The Registered date and Last Updated date are displayed. Network admins can mark a site as archived, spam, deleted and mature, to remove from public listings or disable.').'</p>'. |
|
25 | + '<p>'.__('<strong>Users</strong> — This displays the users associated with this site. You can also change their role, reset their password, or remove them from the site. Removing the user from the site does not remove the user from the network.').'</p>'. |
|
26 | + '<p>'.sprintf(__('<strong>Themes</strong> — This area shows themes that are not already enabled across the network. Enabling a theme in this menu makes it accessible to this site. It does not activate the theme, but allows it to show in the site’s Appearance menu. To enable a theme for the entire network, see the <a href="%s">Network Themes</a> screen.'), network_admin_url('themes.php')).'</p>'. |
|
27 | + '<p>'.__('<strong>Settings</strong> — This page shows a list of all settings associated with this site. Some are created by WordPress and others are created by plugins you activate. Note that some fields are grayed out and say Serialized Data. You cannot modify these values due to the way the setting is stored in the database.').'</p>' |
|
28 | +)); |
|
29 | 29 | |
30 | 30 | get_current_screen()->set_help_sidebar( |
31 | - '<p><strong>' . __('For more information:') . '</strong></p>' . |
|
32 | - '<p>' . __('<a href="https://codex.wordpress.org/Network_Admin_Sites_Screen" target="_blank">Documentation on Site Management</a>') . '</p>' . |
|
33 | - '<p>' . __('<a href="https://wordpress.org/support/forum/multisite/" target="_blank">Support Forums</a>') . '</p>' |
|
31 | + '<p><strong>'.__('For more information:').'</strong></p>'. |
|
32 | + '<p>'.__('<a href="https://codex.wordpress.org/Network_Admin_Sites_Screen" target="_blank">Documentation on Site Management</a>').'</p>'. |
|
33 | + '<p>'.__('<a href="https://wordpress.org/support/forum/multisite/" target="_blank">Support Forums</a>').'</p>' |
|
34 | 34 | ); |
35 | 35 | |
36 | -get_current_screen()->set_screen_reader_content( array( |
|
37 | - 'heading_views' => __( 'Filter site themes list' ), |
|
38 | - 'heading_pagination' => __( 'Site themes list navigation' ), |
|
39 | - 'heading_list' => __( 'Site themes list' ), |
|
40 | -) ); |
|
36 | +get_current_screen()->set_screen_reader_content(array( |
|
37 | + 'heading_views' => __('Filter site themes list'), |
|
38 | + 'heading_pagination' => __('Site themes list navigation'), |
|
39 | + 'heading_list' => __('Site themes list'), |
|
40 | +)); |
|
41 | 41 | |
42 | 42 | $wp_list_table = _get_list_table('WP_MS_Themes_List_Table'); |
43 | 43 | |
@@ -46,77 +46,77 @@ discard block |
||
46 | 46 | $s = isset($_REQUEST['s']) ? $_REQUEST['s'] : ''; |
47 | 47 | |
48 | 48 | // Clean up request URI from temporary args for screen options/paging uri's to work as expected. |
49 | -$temp_args = array( 'enabled', 'disabled', 'error' ); |
|
50 | -$_SERVER['REQUEST_URI'] = remove_query_arg( $temp_args, $_SERVER['REQUEST_URI'] ); |
|
51 | -$referer = remove_query_arg( $temp_args, wp_get_referer() ); |
|
49 | +$temp_args = array('enabled', 'disabled', 'error'); |
|
50 | +$_SERVER['REQUEST_URI'] = remove_query_arg($temp_args, $_SERVER['REQUEST_URI']); |
|
51 | +$referer = remove_query_arg($temp_args, wp_get_referer()); |
|
52 | 52 | |
53 | -if ( ! empty( $_REQUEST['paged'] ) ) { |
|
54 | - $referer = add_query_arg( 'paged', (int) $_REQUEST['paged'], $referer ); |
|
53 | +if ( ! empty($_REQUEST['paged'])) { |
|
54 | + $referer = add_query_arg('paged', (int) $_REQUEST['paged'], $referer); |
|
55 | 55 | } |
56 | 56 | |
57 | -$id = isset( $_REQUEST['id'] ) ? intval( $_REQUEST['id'] ) : 0; |
|
57 | +$id = isset($_REQUEST['id']) ? intval($_REQUEST['id']) : 0; |
|
58 | 58 | |
59 | -if ( ! $id ) |
|
60 | - wp_die( __('Invalid site ID.') ); |
|
59 | +if ( ! $id) |
|
60 | + wp_die(__('Invalid site ID.')); |
|
61 | 61 | |
62 | 62 | $wp_list_table->prepare_items(); |
63 | 63 | |
64 | -$details = get_blog_details( $id ); |
|
65 | -if ( ! $details ) { |
|
66 | - wp_die( __( 'The requested site does not exist.' ) ); |
|
64 | +$details = get_blog_details($id); |
|
65 | +if ( ! $details) { |
|
66 | + wp_die(__('The requested site does not exist.')); |
|
67 | 67 | } |
68 | 68 | |
69 | -if ( !can_edit_network( $details->site_id ) ) |
|
70 | - wp_die( __( 'You do not have permission to access this page.' ), 403 ); |
|
69 | +if ( ! can_edit_network($details->site_id)) |
|
70 | + wp_die(__('You do not have permission to access this page.'), 403); |
|
71 | 71 | |
72 | -$is_main_site = is_main_site( $id ); |
|
72 | +$is_main_site = is_main_site($id); |
|
73 | 73 | |
74 | -if ( $action ) { |
|
75 | - switch_to_blog( $id ); |
|
76 | - $allowed_themes = get_option( 'allowedthemes' ); |
|
74 | +if ($action) { |
|
75 | + switch_to_blog($id); |
|
76 | + $allowed_themes = get_option('allowedthemes'); |
|
77 | 77 | |
78 | - switch ( $action ) { |
|
78 | + switch ($action) { |
|
79 | 79 | case 'enable': |
80 | - check_admin_referer( 'enable-theme_' . $_GET['theme'] ); |
|
80 | + check_admin_referer('enable-theme_'.$_GET['theme']); |
|
81 | 81 | $theme = $_GET['theme']; |
82 | 82 | $action = 'enabled'; |
83 | 83 | $n = 1; |
84 | - if ( !$allowed_themes ) |
|
85 | - $allowed_themes = array( $theme => true ); |
|
84 | + if ( ! $allowed_themes) |
|
85 | + $allowed_themes = array($theme => true); |
|
86 | 86 | else |
87 | 87 | $allowed_themes[$theme] = true; |
88 | 88 | break; |
89 | 89 | case 'disable': |
90 | - check_admin_referer( 'disable-theme_' . $_GET['theme'] ); |
|
90 | + check_admin_referer('disable-theme_'.$_GET['theme']); |
|
91 | 91 | $theme = $_GET['theme']; |
92 | 92 | $action = 'disabled'; |
93 | 93 | $n = 1; |
94 | - if ( !$allowed_themes ) |
|
94 | + if ( ! $allowed_themes) |
|
95 | 95 | $allowed_themes = array(); |
96 | 96 | else |
97 | - unset( $allowed_themes[$theme] ); |
|
97 | + unset($allowed_themes[$theme]); |
|
98 | 98 | break; |
99 | 99 | case 'enable-selected': |
100 | - check_admin_referer( 'bulk-themes' ); |
|
101 | - if ( isset( $_POST['checked'] ) ) { |
|
100 | + check_admin_referer('bulk-themes'); |
|
101 | + if (isset($_POST['checked'])) { |
|
102 | 102 | $themes = (array) $_POST['checked']; |
103 | 103 | $action = 'enabled'; |
104 | - $n = count( $themes ); |
|
105 | - foreach ( (array) $themes as $theme ) |
|
106 | - $allowed_themes[ $theme ] = true; |
|
104 | + $n = count($themes); |
|
105 | + foreach ((array) $themes as $theme) |
|
106 | + $allowed_themes[$theme] = true; |
|
107 | 107 | } else { |
108 | 108 | $action = 'error'; |
109 | 109 | $n = 'none'; |
110 | 110 | } |
111 | 111 | break; |
112 | 112 | case 'disable-selected': |
113 | - check_admin_referer( 'bulk-themes' ); |
|
114 | - if ( isset( $_POST['checked'] ) ) { |
|
113 | + check_admin_referer('bulk-themes'); |
|
114 | + if (isset($_POST['checked'])) { |
|
115 | 115 | $themes = (array) $_POST['checked']; |
116 | 116 | $action = 'disabled'; |
117 | - $n = count( $themes ); |
|
118 | - foreach ( (array) $themes as $theme ) |
|
119 | - unset( $allowed_themes[ $theme ] ); |
|
117 | + $n = count($themes); |
|
118 | + foreach ((array) $themes as $theme) |
|
119 | + unset($allowed_themes[$theme]); |
|
120 | 120 | } else { |
121 | 121 | $action = 'error'; |
122 | 122 | $n = 'none'; |
@@ -124,81 +124,81 @@ discard block |
||
124 | 124 | break; |
125 | 125 | } |
126 | 126 | |
127 | - update_option( 'allowedthemes', $allowed_themes ); |
|
127 | + update_option('allowedthemes', $allowed_themes); |
|
128 | 128 | restore_current_blog(); |
129 | 129 | |
130 | - wp_safe_redirect( add_query_arg( array( 'id' => $id, $action => $n ), $referer ) ); |
|
130 | + wp_safe_redirect(add_query_arg(array('id' => $id, $action => $n), $referer)); |
|
131 | 131 | exit; |
132 | 132 | } |
133 | 133 | |
134 | -if ( isset( $_GET['action'] ) && 'update-site' == $_GET['action'] ) { |
|
135 | - wp_safe_redirect( $referer ); |
|
134 | +if (isset($_GET['action']) && 'update-site' == $_GET['action']) { |
|
135 | + wp_safe_redirect($referer); |
|
136 | 136 | exit(); |
137 | 137 | } |
138 | 138 | |
139 | 139 | add_thickbox(); |
140 | -add_screen_option( 'per_page' ); |
|
140 | +add_screen_option('per_page'); |
|
141 | 141 | |
142 | -$title = sprintf( __( 'Edit Site: %s' ), esc_html( $details->blogname ) ); |
|
142 | +$title = sprintf(__('Edit Site: %s'), esc_html($details->blogname)); |
|
143 | 143 | |
144 | 144 | $parent_file = 'sites.php'; |
145 | 145 | $submenu_file = 'sites.php'; |
146 | 146 | |
147 | -require( ABSPATH . 'wp-admin/admin-header.php' ); ?> |
|
147 | +require(ABSPATH.'wp-admin/admin-header.php'); ?> |
|
148 | 148 | |
149 | 149 | <div class="wrap"> |
150 | 150 | <h1 id="edit-site"><?php echo $title; ?></h1> |
151 | -<p class="edit-site-actions"><a href="<?php echo esc_url( get_home_url( $id, '/' ) ); ?>"><?php _e( 'Visit' ); ?></a> | <a href="<?php echo esc_url( get_admin_url( $id ) ); ?>"><?php _e( 'Dashboard' ); ?></a></p> |
|
151 | +<p class="edit-site-actions"><a href="<?php echo esc_url(get_home_url($id, '/')); ?>"><?php _e('Visit'); ?></a> | <a href="<?php echo esc_url(get_admin_url($id)); ?>"><?php _e('Dashboard'); ?></a></p> |
|
152 | 152 | <h2 class="nav-tab-wrapper nav-tab-small wp-clearfix"> |
153 | 153 | <?php |
154 | 154 | $tabs = array( |
155 | - 'site-info' => array( 'label' => __( 'Info' ), 'url' => 'site-info.php' ), |
|
156 | - 'site-users' => array( 'label' => __( 'Users' ), 'url' => 'site-users.php' ), |
|
157 | - 'site-themes' => array( 'label' => __( 'Themes' ), 'url' => 'site-themes.php' ), |
|
158 | - 'site-settings' => array( 'label' => __( 'Settings' ), 'url' => 'site-settings.php' ), |
|
155 | + 'site-info' => array('label' => __('Info'), 'url' => 'site-info.php'), |
|
156 | + 'site-users' => array('label' => __('Users'), 'url' => 'site-users.php'), |
|
157 | + 'site-themes' => array('label' => __('Themes'), 'url' => 'site-themes.php'), |
|
158 | + 'site-settings' => array('label' => __('Settings'), 'url' => 'site-settings.php'), |
|
159 | 159 | ); |
160 | -foreach ( $tabs as $tab_id => $tab ) { |
|
161 | - $class = ( $tab['url'] == $pagenow ) ? ' nav-tab-active' : ''; |
|
162 | - echo '<a href="' . $tab['url'] . '?id=' . $id .'" class="nav-tab' . $class . '">' . esc_html( $tab['label'] ) . '</a>'; |
|
160 | +foreach ($tabs as $tab_id => $tab) { |
|
161 | + $class = ($tab['url'] == $pagenow) ? ' nav-tab-active' : ''; |
|
162 | + echo '<a href="'.$tab['url'].'?id='.$id.'" class="nav-tab'.$class.'">'.esc_html($tab['label']).'</a>'; |
|
163 | 163 | } |
164 | 164 | ?> |
165 | 165 | </h2><?php |
166 | 166 | |
167 | -if ( isset( $_GET['enabled'] ) ) { |
|
168 | - $enabled = absint( $_GET['enabled'] ); |
|
169 | - if ( 1 == $enabled ) { |
|
170 | - $message = __( 'Theme enabled.' ); |
|
167 | +if (isset($_GET['enabled'])) { |
|
168 | + $enabled = absint($_GET['enabled']); |
|
169 | + if (1 == $enabled) { |
|
170 | + $message = __('Theme enabled.'); |
|
171 | 171 | } else { |
172 | - $message = _n( '%s theme enabled.', '%s themes enabled.', $enabled ); |
|
172 | + $message = _n('%s theme enabled.', '%s themes enabled.', $enabled); |
|
173 | 173 | } |
174 | - echo '<div id="message" class="updated notice is-dismissible"><p>' . sprintf( $message, number_format_i18n( $enabled ) ) . '</p></div>'; |
|
175 | -} elseif ( isset( $_GET['disabled'] ) ) { |
|
176 | - $disabled = absint( $_GET['disabled'] ); |
|
177 | - if ( 1 == $disabled ) { |
|
178 | - $message = __( 'Theme disabled.' ); |
|
174 | + echo '<div id="message" class="updated notice is-dismissible"><p>'.sprintf($message, number_format_i18n($enabled)).'</p></div>'; |
|
175 | +} elseif (isset($_GET['disabled'])) { |
|
176 | + $disabled = absint($_GET['disabled']); |
|
177 | + if (1 == $disabled) { |
|
178 | + $message = __('Theme disabled.'); |
|
179 | 179 | } else { |
180 | - $message = _n( '%s theme disabled.', '%s themes disabled.', $disabled ); |
|
180 | + $message = _n('%s theme disabled.', '%s themes disabled.', $disabled); |
|
181 | 181 | } |
182 | - echo '<div id="message" class="updated notice is-dismissible"><p>' . sprintf( $message, number_format_i18n( $disabled ) ) . '</p></div>'; |
|
183 | -} elseif ( isset( $_GET['error'] ) && 'none' == $_GET['error'] ) { |
|
184 | - echo '<div id="message" class="error notice is-dismissible"><p>' . __( 'No theme selected.' ) . '</p></div>'; |
|
182 | + echo '<div id="message" class="updated notice is-dismissible"><p>'.sprintf($message, number_format_i18n($disabled)).'</p></div>'; |
|
183 | +} elseif (isset($_GET['error']) && 'none' == $_GET['error']) { |
|
184 | + echo '<div id="message" class="error notice is-dismissible"><p>'.__('No theme selected.').'</p></div>'; |
|
185 | 185 | } ?> |
186 | 186 | |
187 | -<p><?php _e( 'Network enabled themes are not shown on this screen.' ) ?></p> |
|
187 | +<p><?php _e('Network enabled themes are not shown on this screen.') ?></p> |
|
188 | 188 | |
189 | 189 | <form method="get"> |
190 | -<?php $wp_list_table->search_box( __( 'Search Installed Themes' ), 'theme' ); ?> |
|
191 | -<input type="hidden" name="id" value="<?php echo esc_attr( $id ) ?>" /> |
|
190 | +<?php $wp_list_table->search_box(__('Search Installed Themes'), 'theme'); ?> |
|
191 | +<input type="hidden" name="id" value="<?php echo esc_attr($id) ?>" /> |
|
192 | 192 | </form> |
193 | 193 | |
194 | 194 | <?php $wp_list_table->views(); ?> |
195 | 195 | |
196 | 196 | <form method="post" action="site-themes.php?action=update-site"> |
197 | - <input type="hidden" name="id" value="<?php echo esc_attr( $id ) ?>" /> |
|
197 | + <input type="hidden" name="id" value="<?php echo esc_attr($id) ?>" /> |
|
198 | 198 | |
199 | 199 | <?php $wp_list_table->display(); ?> |
200 | 200 | |
201 | 201 | </form> |
202 | 202 | |
203 | 203 | </div> |
204 | -<?php include(ABSPATH . 'wp-admin/admin-footer.php'); ?> |
|
204 | +<?php include(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 manage themes for this site.' ) ); |
19 | +} |
|
18 | 20 | |
19 | 21 | get_current_screen()->add_help_tab( array( |
20 | 22 | 'id' => 'overview', |
@@ -56,8 +58,9 @@ discard block |
||
56 | 58 | |
57 | 59 | $id = isset( $_REQUEST['id'] ) ? intval( $_REQUEST['id'] ) : 0; |
58 | 60 | |
59 | -if ( ! $id ) |
|
61 | +if ( ! $id ) { |
|
60 | 62 | wp_die( __('Invalid site ID.') ); |
63 | +} |
|
61 | 64 | |
62 | 65 | $wp_list_table->prepare_items(); |
63 | 66 | |
@@ -66,8 +69,9 @@ discard block |
||
66 | 69 | wp_die( __( 'The requested site does not exist.' ) ); |
67 | 70 | } |
68 | 71 | |
69 | -if ( !can_edit_network( $details->site_id ) ) |
|
72 | +if ( !can_edit_network( $details->site_id ) ) { |
|
70 | 73 | wp_die( __( 'You do not have permission to access this page.' ), 403 ); |
74 | +} |
|
71 | 75 | |
72 | 76 | $is_main_site = is_main_site( $id ); |
73 | 77 | |
@@ -81,20 +85,22 @@ discard block |
||
81 | 85 | $theme = $_GET['theme']; |
82 | 86 | $action = 'enabled'; |
83 | 87 | $n = 1; |
84 | - if ( !$allowed_themes ) |
|
85 | - $allowed_themes = array( $theme => true ); |
|
86 | - else |
|
87 | - $allowed_themes[$theme] = true; |
|
88 | + if ( !$allowed_themes ) { |
|
89 | + $allowed_themes = array( $theme => true ); |
|
90 | + } else { |
|
91 | + $allowed_themes[$theme] = true; |
|
92 | + } |
|
88 | 93 | break; |
89 | 94 | case 'disable': |
90 | 95 | check_admin_referer( 'disable-theme_' . $_GET['theme'] ); |
91 | 96 | $theme = $_GET['theme']; |
92 | 97 | $action = 'disabled'; |
93 | 98 | $n = 1; |
94 | - if ( !$allowed_themes ) |
|
95 | - $allowed_themes = array(); |
|
96 | - else |
|
97 | - unset( $allowed_themes[$theme] ); |
|
99 | + if ( !$allowed_themes ) { |
|
100 | + $allowed_themes = array(); |
|
101 | + } else { |
|
102 | + unset( $allowed_themes[$theme] ); |
|
103 | + } |
|
98 | 104 | break; |
99 | 105 | case 'enable-selected': |
100 | 106 | check_admin_referer( 'bulk-themes' ); |
@@ -102,8 +108,9 @@ discard block |
||
102 | 108 | $themes = (array) $_POST['checked']; |
103 | 109 | $action = 'enabled'; |
104 | 110 | $n = count( $themes ); |
105 | - foreach ( (array) $themes as $theme ) |
|
106 | - $allowed_themes[ $theme ] = true; |
|
111 | + foreach ( (array) $themes as $theme ) { |
|
112 | + $allowed_themes[ $theme ] = true; |
|
113 | + } |
|
107 | 114 | } else { |
108 | 115 | $action = 'error'; |
109 | 116 | $n = 'none'; |
@@ -115,8 +122,9 @@ discard block |
||
115 | 122 | $themes = (array) $_POST['checked']; |
116 | 123 | $action = 'disabled'; |
117 | 124 | $n = count( $themes ); |
118 | - foreach ( (array) $themes as $theme ) |
|
119 | - unset( $allowed_themes[ $theme ] ); |
|
125 | + foreach ( (array) $themes as $theme ) { |
|
126 | + unset( $allowed_themes[ $theme ] ); |
|
127 | + } |
|
120 | 128 | } else { |
121 | 129 | $action = 'error'; |
122 | 130 | $n = 'none'; |
@@ -8,78 +8,78 @@ 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 site URL is rarely edited as this can cause the site to not work properly. The Registered date and Last Updated date are displayed. Network admins can mark a site as archived, spam, deleted and mature, to remove from public listings or disable.' ) . '</p>' . |
|
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 site URL is rarely edited as this can cause the site to not work properly. The Registered date and Last Updated date are displayed. Network admins can mark a site as archived, spam, deleted and mature, to remove from public listings or disable.').'</p>'. |
|
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 | // If a path is not provided, use the default of `/`. |
82 | - if ( ! isset( $update_parsed_url['path'] ) ) { |
|
82 | + if ( ! isset($update_parsed_url['path'])) { |
|
83 | 83 | $update_parsed_url['path'] = '/'; |
84 | 84 | } |
85 | 85 | |
@@ -88,126 +88,126 @@ discard block |
||
88 | 88 | $blog_data['path'] = $update_parsed_url['path']; |
89 | 89 | } |
90 | 90 | |
91 | - $existing_details = get_blog_details( $id, false ); |
|
92 | - $blog_data_checkboxes = array( 'public', 'archived', 'spam', 'mature', 'deleted' ); |
|
93 | - foreach ( $blog_data_checkboxes as $c ) { |
|
94 | - if ( ! in_array( $existing_details->$c, array( 0, 1 ) ) ) { |
|
95 | - $blog_data[ $c ] = $existing_details->$c; |
|
91 | + $existing_details = get_blog_details($id, false); |
|
92 | + $blog_data_checkboxes = array('public', 'archived', 'spam', 'mature', 'deleted'); |
|
93 | + foreach ($blog_data_checkboxes as $c) { |
|
94 | + if ( ! in_array($existing_details->$c, array(0, 1))) { |
|
95 | + $blog_data[$c] = $existing_details->$c; |
|
96 | 96 | } else { |
97 | - $blog_data[ $c ] = isset( $_POST['blog'][ $c ] ) ? 1 : 0; |
|
97 | + $blog_data[$c] = isset($_POST['blog'][$c]) ? 1 : 0; |
|
98 | 98 | } |
99 | 99 | } |
100 | 100 | |
101 | - update_blog_details( $id, $blog_data ); |
|
101 | + update_blog_details($id, $blog_data); |
|
102 | 102 | |
103 | 103 | // Maybe update home and siteurl options. |
104 | - $new_details = get_blog_details( $id, false ); |
|
104 | + $new_details = get_blog_details($id, false); |
|
105 | 105 | |
106 | - $old_home_url = trailingslashit( esc_url( get_option( 'home' ) ) ); |
|
107 | - $old_home_parsed = parse_url( $old_home_url ); |
|
106 | + $old_home_url = trailingslashit(esc_url(get_option('home'))); |
|
107 | + $old_home_parsed = parse_url($old_home_url); |
|
108 | 108 | |
109 | - if ( $old_home_parsed['host'] === $existing_details->domain && $old_home_parsed['path'] === $existing_details->path ) { |
|
110 | - $new_home_url = untrailingslashit( esc_url_raw( $blog_data['scheme'] . '://' . $new_details->domain . $new_details->path ) ); |
|
111 | - update_option( 'home', $new_home_url ); |
|
109 | + if ($old_home_parsed['host'] === $existing_details->domain && $old_home_parsed['path'] === $existing_details->path) { |
|
110 | + $new_home_url = untrailingslashit(esc_url_raw($blog_data['scheme'].'://'.$new_details->domain.$new_details->path)); |
|
111 | + update_option('home', $new_home_url); |
|
112 | 112 | } |
113 | 113 | |
114 | - $old_site_url = trailingslashit( esc_url( get_option( 'siteurl' ) ) ); |
|
115 | - $old_site_parsed = parse_url( $old_site_url ); |
|
114 | + $old_site_url = trailingslashit(esc_url(get_option('siteurl'))); |
|
115 | + $old_site_parsed = parse_url($old_site_url); |
|
116 | 116 | |
117 | - if ( $old_site_parsed['host'] === $existing_details->domain && $old_site_parsed['path'] === $existing_details->path ) { |
|
118 | - $new_site_url = untrailingslashit( esc_url_raw( $blog_data['scheme'] . '://' . $new_details->domain . $new_details->path ) ); |
|
119 | - update_option( 'siteurl', $new_site_url ); |
|
117 | + if ($old_site_parsed['host'] === $existing_details->domain && $old_site_parsed['path'] === $existing_details->path) { |
|
118 | + $new_site_url = untrailingslashit(esc_url_raw($blog_data['scheme'].'://'.$new_details->domain.$new_details->path)); |
|
119 | + update_option('siteurl', $new_site_url); |
|
120 | 120 | } |
121 | 121 | |
122 | 122 | restore_current_blog(); |
123 | - wp_redirect( add_query_arg( array( 'update' => 'updated', 'id' => $id ), 'site-info.php' ) ); |
|
123 | + wp_redirect(add_query_arg(array('update' => 'updated', 'id' => $id), 'site-info.php')); |
|
124 | 124 | exit; |
125 | 125 | } |
126 | 126 | |
127 | -if ( isset( $_GET['update'] ) ) { |
|
127 | +if (isset($_GET['update'])) { |
|
128 | 128 | $messages = array(); |
129 | - if ( 'updated' == $_GET['update'] ) { |
|
130 | - $messages[] = __( 'Site info updated.' ); |
|
129 | + if ('updated' == $_GET['update']) { |
|
130 | + $messages[] = __('Site info updated.'); |
|
131 | 131 | } |
132 | 132 | } |
133 | 133 | |
134 | -$title = sprintf( __( 'Edit Site: %s' ), esc_html( $details->blogname ) ); |
|
134 | +$title = sprintf(__('Edit Site: %s'), esc_html($details->blogname)); |
|
135 | 135 | |
136 | 136 | $parent_file = 'sites.php'; |
137 | 137 | $submenu_file = 'sites.php'; |
138 | 138 | |
139 | -require( ABSPATH . 'wp-admin/admin-header.php' ); |
|
139 | +require(ABSPATH.'wp-admin/admin-header.php'); |
|
140 | 140 | |
141 | 141 | ?> |
142 | 142 | |
143 | 143 | <div class="wrap"> |
144 | 144 | <h1 id="edit-site"><?php echo $title; ?></h1> |
145 | -<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> |
|
145 | +<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> |
|
146 | 146 | <h2 class="nav-tab-wrapper nav-tab-small wp-clearfix"> |
147 | 147 | <?php |
148 | 148 | $tabs = array( |
149 | - 'site-info' => array( 'label' => __( 'Info' ), 'url' => 'site-info.php' ), |
|
150 | - 'site-users' => array( 'label' => __( 'Users' ), 'url' => 'site-users.php' ), |
|
151 | - 'site-themes' => array( 'label' => __( 'Themes' ), 'url' => 'site-themes.php' ), |
|
152 | - 'site-settings' => array( 'label' => __( 'Settings' ), 'url' => 'site-settings.php' ), |
|
149 | + 'site-info' => array('label' => __('Info'), 'url' => 'site-info.php'), |
|
150 | + 'site-users' => array('label' => __('Users'), 'url' => 'site-users.php'), |
|
151 | + 'site-themes' => array('label' => __('Themes'), 'url' => 'site-themes.php'), |
|
152 | + 'site-settings' => array('label' => __('Settings'), 'url' => 'site-settings.php'), |
|
153 | 153 | ); |
154 | -foreach ( $tabs as $tab_id => $tab ) { |
|
155 | - $class = ( $tab['url'] == $pagenow ) ? ' nav-tab-active' : ''; |
|
156 | - echo '<a href="' . $tab['url'] . '?id=' . $id .'" class="nav-tab' . $class . '">' . esc_html( $tab['label'] ) . '</a>'; |
|
154 | +foreach ($tabs as $tab_id => $tab) { |
|
155 | + $class = ($tab['url'] == $pagenow) ? ' nav-tab-active' : ''; |
|
156 | + echo '<a href="'.$tab['url'].'?id='.$id.'" class="nav-tab'.$class.'">'.esc_html($tab['label']).'</a>'; |
|
157 | 157 | } |
158 | 158 | ?> |
159 | 159 | </h2> |
160 | 160 | <?php |
161 | -if ( ! empty( $messages ) ) { |
|
162 | - foreach ( $messages as $msg ) { |
|
163 | - echo '<div id="message" class="updated notice is-dismissible"><p>' . $msg . '</p></div>'; |
|
161 | +if ( ! empty($messages)) { |
|
162 | + foreach ($messages as $msg) { |
|
163 | + echo '<div id="message" class="updated notice is-dismissible"><p>'.$msg.'</p></div>'; |
|
164 | 164 | } |
165 | 165 | } |
166 | 166 | ?> |
167 | 167 | <form method="post" action="site-info.php?action=update-site"> |
168 | - <?php wp_nonce_field( 'edit-site' ); ?> |
|
169 | - <input type="hidden" name="id" value="<?php echo esc_attr( $id ) ?>" /> |
|
168 | + <?php wp_nonce_field('edit-site'); ?> |
|
169 | + <input type="hidden" name="id" value="<?php echo esc_attr($id) ?>" /> |
|
170 | 170 | <table class="form-table"> |
171 | 171 | <?php |
172 | 172 | // The main site of the network should not be updated on this page. |
173 | - if ( $is_main_site ) : ?> |
|
173 | + if ($is_main_site) : ?> |
|
174 | 174 | <tr class="form-field"> |
175 | - <th scope="row"><?php _e( 'Site Address (URL)' ); ?></th> |
|
176 | - <td><?php echo esc_url( $details->domain . $details->path ); ?></td> |
|
175 | + <th scope="row"><?php _e('Site Address (URL)'); ?></th> |
|
176 | + <td><?php echo esc_url($details->domain.$details->path); ?></td> |
|
177 | 177 | </tr> |
178 | 178 | <?php |
179 | 179 | // For any other site, the scheme, domain, and path can all be changed. |
180 | 180 | else : ?> |
181 | 181 | <tr class="form-field form-required"> |
182 | - <th scope="row"><?php _e( 'Site Address (URL)' ); ?></th> |
|
183 | - <td><input name="blog[url]" type="text" id="url" value="<?php echo $parsed_scheme . '://' . esc_attr( $details->domain ) . esc_attr( $details->path ); ?>" /></td> |
|
182 | + <th scope="row"><?php _e('Site Address (URL)'); ?></th> |
|
183 | + <td><input name="blog[url]" type="text" id="url" value="<?php echo $parsed_scheme.'://'.esc_attr($details->domain).esc_attr($details->path); ?>" /></td> |
|
184 | 184 | </tr> |
185 | 185 | <?php endif; ?> |
186 | 186 | |
187 | 187 | <tr class="form-field"> |
188 | - <th scope="row"><label for="blog_registered"><?php _ex( 'Registered', 'site' ) ?></label></th> |
|
189 | - <td><input name="blog[registered]" type="text" id="blog_registered" value="<?php echo esc_attr( $details->registered ) ?>" /></td> |
|
188 | + <th scope="row"><label for="blog_registered"><?php _ex('Registered', 'site') ?></label></th> |
|
189 | + <td><input name="blog[registered]" type="text" id="blog_registered" value="<?php echo esc_attr($details->registered) ?>" /></td> |
|
190 | 190 | </tr> |
191 | 191 | <tr class="form-field"> |
192 | - <th scope="row"><label for="blog_last_updated"><?php _e( 'Last Updated' ); ?></label></th> |
|
193 | - <td><input name="blog[last_updated]" type="text" id="blog_last_updated" value="<?php echo esc_attr( $details->last_updated ) ?>" /></td> |
|
192 | + <th scope="row"><label for="blog_last_updated"><?php _e('Last Updated'); ?></label></th> |
|
193 | + <td><input name="blog[last_updated]" type="text" id="blog_last_updated" value="<?php echo esc_attr($details->last_updated) ?>" /></td> |
|
194 | 194 | </tr> |
195 | 195 | <?php |
196 | - $attribute_fields = array( 'public' => __( 'Public' ) ); |
|
197 | - if ( ! $is_main_site ) { |
|
198 | - $attribute_fields['archived'] = __( 'Archived' ); |
|
199 | - $attribute_fields['spam'] = _x( 'Spam', 'site' ); |
|
200 | - $attribute_fields['deleted'] = __( 'Deleted' ); |
|
196 | + $attribute_fields = array('public' => __('Public')); |
|
197 | + if ( ! $is_main_site) { |
|
198 | + $attribute_fields['archived'] = __('Archived'); |
|
199 | + $attribute_fields['spam'] = _x('Spam', 'site'); |
|
200 | + $attribute_fields['deleted'] = __('Deleted'); |
|
201 | 201 | } |
202 | - $attribute_fields['mature'] = __( 'Mature' ); |
|
202 | + $attribute_fields['mature'] = __('Mature'); |
|
203 | 203 | ?> |
204 | 204 | <tr> |
205 | - <th scope="row"><?php _e( 'Attributes' ); ?></th> |
|
205 | + <th scope="row"><?php _e('Attributes'); ?></th> |
|
206 | 206 | <td> |
207 | 207 | <fieldset> |
208 | - <legend class="screen-reader-text"><?php _e( 'Set site attributes' ) ?></legend> |
|
209 | - <?php foreach ( $attribute_fields as $field_key => $field_label ) : ?> |
|
210 | - <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 ) ) ); ?> /> |
|
208 | + <legend class="screen-reader-text"><?php _e('Set site attributes') ?></legend> |
|
209 | + <?php foreach ($attribute_fields as $field_key => $field_label) : ?> |
|
210 | + <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))); ?> /> |
|
211 | 211 | <?php echo $field_label; ?></label><br/> |
212 | 212 | <?php endforeach; ?> |
213 | 213 | <fieldset> |
@@ -219,4 +219,4 @@ discard block |
||
219 | 219 | |
220 | 220 | </div> |
221 | 221 | <?php |
222 | -require( ABSPATH . 'wp-admin/admin-footer.php' ); |
|
222 | +require(ABSPATH.'wp-admin/admin-footer.php'); |
@@ -177,9 +177,12 @@ |
||
177 | 177 | </tr> |
178 | 178 | <?php |
179 | 179 | // For any other site, the scheme, domain, and path can all be changed. |
180 | - else : ?> |
|
180 | + else { |
|
181 | + : ?> |
|
181 | 182 | <tr class="form-field form-required"> |
182 | - <th scope="row"><?php _e( 'Site Address (URL)' ); ?></th> |
|
183 | + <th scope="row"><?php _e( 'Site Address (URL)' ); |
|
184 | + } |
|
185 | + ?></th> |
|
183 | 186 | <td><input name="blog[url]" type="text" id="url" value="<?php echo $parsed_scheme . '://' . esc_attr( $details->domain ) . esc_attr( $details->path ); ?>" /></td> |
184 | 187 | </tr> |
185 | 188 | <?php endif; ?> |
@@ -115,12 +115,12 @@ |
||
115 | 115 | } |
116 | 116 | |
117 | 117 | /** |
118 | - * Fires after a new user has been created via the network site-new.php page. |
|
119 | - * |
|
120 | - * @since 4.4.0 |
|
121 | - * |
|
122 | - * @param int $user_id ID of the newly created user. |
|
123 | - */ |
|
118 | + * Fires after a new user has been created via the network site-new.php page. |
|
119 | + * |
|
120 | + * @since 4.4.0 |
|
121 | + * |
|
122 | + * @param int $user_id ID of the newly created user. |
|
123 | + */ |
|
124 | 124 | do_action( 'network_site_new_created_user', $user_id ); |
125 | 125 | } |
126 | 126 |
@@ -8,51 +8,51 @@ discard block |
||
8 | 8 | */ |
9 | 9 | |
10 | 10 | /** Load WordPress Administration Bootstrap */ |
11 | -require_once( dirname( __FILE__ ) . '/admin.php' ); |
|
11 | +require_once(dirname(__FILE__).'/admin.php'); |
|
12 | 12 | |
13 | 13 | /** WordPress Translation Install API */ |
14 | -require_once( ABSPATH . 'wp-admin/includes/translation-install.php' ); |
|
14 | +require_once(ABSPATH.'wp-admin/includes/translation-install.php'); |
|
15 | 15 | |
16 | -if ( ! is_multisite() ) |
|
17 | - wp_die( __( 'Multisite support is not enabled.' ) ); |
|
16 | +if ( ! is_multisite()) |
|
17 | + wp_die(__('Multisite support is not enabled.')); |
|
18 | 18 | |
19 | -if ( ! current_user_can( 'manage_sites' ) ) |
|
20 | - wp_die( __( 'You do not have sufficient permissions to add sites to this network.' ) ); |
|
19 | +if ( ! current_user_can('manage_sites')) |
|
20 | + wp_die(__('You do not have sufficient permissions to add sites to this network.')); |
|
21 | 21 | |
22 | -get_current_screen()->add_help_tab( array( |
|
22 | +get_current_screen()->add_help_tab(array( |
|
23 | 23 | 'id' => 'overview', |
24 | 24 | 'title' => __('Overview'), |
25 | 25 | 'content' => |
26 | - '<p>' . __('This screen is for Super Admins to add new sites to the network. This is not affected by the registration settings.') . '</p>' . |
|
27 | - '<p>' . __('If the admin email for the new site does not exist in the database, a new user will also be created.') . '</p>' |
|
28 | -) ); |
|
26 | + '<p>'.__('This screen is for Super Admins to add new sites to the network. This is not affected by the registration settings.').'</p>'. |
|
27 | + '<p>'.__('If the admin email for the new site does not exist in the database, a new user will also be created.').'</p>' |
|
28 | +)); |
|
29 | 29 | |
30 | 30 | get_current_screen()->set_help_sidebar( |
31 | - '<p><strong>' . __('For more information:') . '</strong></p>' . |
|
32 | - '<p>' . __('<a href="https://codex.wordpress.org/Network_Admin_Sites_Screen" target="_blank">Documentation on Site Management</a>') . '</p>' . |
|
33 | - '<p>' . __('<a href="https://wordpress.org/support/forum/multisite/" target="_blank">Support Forums</a>') . '</p>' |
|
31 | + '<p><strong>'.__('For more information:').'</strong></p>'. |
|
32 | + '<p>'.__('<a href="https://codex.wordpress.org/Network_Admin_Sites_Screen" target="_blank">Documentation on Site Management</a>').'</p>'. |
|
33 | + '<p>'.__('<a href="https://wordpress.org/support/forum/multisite/" target="_blank">Support Forums</a>').'</p>' |
|
34 | 34 | ); |
35 | 35 | |
36 | -if ( isset($_REQUEST['action']) && 'add-site' == $_REQUEST['action'] ) { |
|
37 | - check_admin_referer( 'add-blog', '_wpnonce_add-blog' ); |
|
36 | +if (isset($_REQUEST['action']) && 'add-site' == $_REQUEST['action']) { |
|
37 | + check_admin_referer('add-blog', '_wpnonce_add-blog'); |
|
38 | 38 | |
39 | - if ( ! is_array( $_POST['blog'] ) ) |
|
40 | - wp_die( __( 'Can’t create an empty site.' ) ); |
|
39 | + if ( ! is_array($_POST['blog'])) |
|
40 | + wp_die(__('Can’t create an empty site.')); |
|
41 | 41 | |
42 | 42 | $blog = $_POST['blog']; |
43 | 43 | $domain = ''; |
44 | - if ( preg_match( '|^([a-zA-Z0-9-])+$|', $blog['domain'] ) ) |
|
45 | - $domain = strtolower( $blog['domain'] ); |
|
44 | + if (preg_match('|^([a-zA-Z0-9-])+$|', $blog['domain'])) |
|
45 | + $domain = strtolower($blog['domain']); |
|
46 | 46 | |
47 | 47 | // If not a subdomain install, make sure the domain isn't a reserved word |
48 | - if ( ! is_subdomain_install() ) { |
|
48 | + if ( ! is_subdomain_install()) { |
|
49 | 49 | $subdirectory_reserved_names = get_subdirectory_reserved_names(); |
50 | 50 | |
51 | - if ( in_array( $domain, $subdirectory_reserved_names ) ) { |
|
51 | + if (in_array($domain, $subdirectory_reserved_names)) { |
|
52 | 52 | wp_die( |
53 | 53 | /* translators: %s: reserved names list */ |
54 | - sprintf( __( 'The following words are reserved for use by WordPress functions and cannot be used as blog names: %s' ), |
|
55 | - '<code>' . implode( '</code>, <code>', $subdirectory_reserved_names ) . '</code>' |
|
54 | + sprintf(__('The following words are reserved for use by WordPress functions and cannot be used as blog names: %s'), |
|
55 | + '<code>'.implode('</code>, <code>', $subdirectory_reserved_names).'</code>' |
|
56 | 56 | ) |
57 | 57 | ); |
58 | 58 | } |
@@ -65,36 +65,36 @@ discard block |
||
65 | 65 | ); |
66 | 66 | |
67 | 67 | // Handle translation install for the new site. |
68 | - if ( ! empty( $_POST['WPLANG'] ) && wp_can_install_language_pack() ) { |
|
69 | - $language = wp_download_language_pack( wp_unslash( $_POST['WPLANG'] ) ); |
|
70 | - if ( $language ) { |
|
68 | + if ( ! empty($_POST['WPLANG']) && wp_can_install_language_pack()) { |
|
69 | + $language = wp_download_language_pack(wp_unslash($_POST['WPLANG'])); |
|
70 | + if ($language) { |
|
71 | 71 | $meta['WPLANG'] = $language; |
72 | 72 | } |
73 | 73 | } |
74 | 74 | |
75 | - if ( empty( $domain ) ) |
|
76 | - wp_die( __( 'Missing or invalid site address.' ) ); |
|
75 | + if (empty($domain)) |
|
76 | + wp_die(__('Missing or invalid site address.')); |
|
77 | 77 | |
78 | - if ( isset( $blog['email'] ) && '' === trim( $blog['email'] ) ) { |
|
79 | - wp_die( __( 'Missing email address.' ) ); |
|
78 | + if (isset($blog['email']) && '' === trim($blog['email'])) { |
|
79 | + wp_die(__('Missing email address.')); |
|
80 | 80 | } |
81 | 81 | |
82 | - $email = sanitize_email( $blog['email'] ); |
|
83 | - if ( ! is_email( $email ) ) { |
|
84 | - wp_die( __( 'Invalid email address.' ) ); |
|
82 | + $email = sanitize_email($blog['email']); |
|
83 | + if ( ! is_email($email)) { |
|
84 | + wp_die(__('Invalid email address.')); |
|
85 | 85 | } |
86 | 86 | |
87 | - if ( is_subdomain_install() ) { |
|
88 | - $newdomain = $domain . '.' . preg_replace( '|^www\.|', '', $current_site->domain ); |
|
87 | + if (is_subdomain_install()) { |
|
88 | + $newdomain = $domain.'.'.preg_replace('|^www\.|', '', $current_site->domain); |
|
89 | 89 | $path = $current_site->path; |
90 | 90 | } else { |
91 | 91 | $newdomain = $current_site->domain; |
92 | - $path = $current_site->path . $domain . '/'; |
|
92 | + $path = $current_site->path.$domain.'/'; |
|
93 | 93 | } |
94 | 94 | |
95 | 95 | $password = 'N/A'; |
96 | 96 | $user_id = email_exists($email); |
97 | - if ( !$user_id ) { // Create a new user with a random password |
|
97 | + if ( ! $user_id) { // Create a new user with a random password |
|
98 | 98 | /** |
99 | 99 | * Fires immediately before a new user is created via the network site-new.php page. |
100 | 100 | * |
@@ -102,16 +102,16 @@ discard block |
||
102 | 102 | * |
103 | 103 | * @param string $email Email of the non-existent user. |
104 | 104 | */ |
105 | - do_action( 'pre_network_site_new_created_user', $email ); |
|
105 | + do_action('pre_network_site_new_created_user', $email); |
|
106 | 106 | |
107 | - $user_id = username_exists( $domain ); |
|
108 | - if ( $user_id ) { |
|
109 | - wp_die( __( 'The domain or path entered conflicts with an existing username.' ) ); |
|
107 | + $user_id = username_exists($domain); |
|
108 | + if ($user_id) { |
|
109 | + wp_die(__('The domain or path entered conflicts with an existing username.')); |
|
110 | 110 | } |
111 | - $password = wp_generate_password( 12, false ); |
|
112 | - $user_id = wpmu_create_user( $domain, $password, $email ); |
|
113 | - if ( false === $user_id ) { |
|
114 | - wp_die( __( 'There was an error creating the user.' ) ); |
|
111 | + $password = wp_generate_password(12, false); |
|
112 | + $user_id = wpmu_create_user($domain, $password, $email); |
|
113 | + if (false === $user_id) { |
|
114 | + wp_die(__('There was an error creating the user.')); |
|
115 | 115 | } |
116 | 116 | |
117 | 117 | /** |
@@ -121,129 +121,129 @@ discard block |
||
121 | 121 | * |
122 | 122 | * @param int $user_id ID of the newly created user. |
123 | 123 | */ |
124 | - do_action( 'network_site_new_created_user', $user_id ); |
|
124 | + do_action('network_site_new_created_user', $user_id); |
|
125 | 125 | } |
126 | 126 | |
127 | 127 | $wpdb->hide_errors(); |
128 | - $id = wpmu_create_blog( $newdomain, $path, $title, $user_id, $meta, $current_site->id ); |
|
128 | + $id = wpmu_create_blog($newdomain, $path, $title, $user_id, $meta, $current_site->id); |
|
129 | 129 | $wpdb->show_errors(); |
130 | - if ( ! is_wp_error( $id ) ) { |
|
131 | - if ( ! is_super_admin( $user_id ) && !get_user_option( 'primary_blog', $user_id ) ) { |
|
132 | - update_user_option( $user_id, 'primary_blog', $id, true ); |
|
130 | + if ( ! is_wp_error($id)) { |
|
131 | + if ( ! is_super_admin($user_id) && ! get_user_option('primary_blog', $user_id)) { |
|
132 | + update_user_option($user_id, 'primary_blog', $id, true); |
|
133 | 133 | } |
134 | 134 | |
135 | 135 | wp_mail( |
136 | - get_site_option( 'admin_email' ), |
|
136 | + get_site_option('admin_email'), |
|
137 | 137 | sprintf( |
138 | 138 | /* translators: %s: network name */ |
139 | - __( '[%s] New Site Created' ), |
|
139 | + __('[%s] New Site Created'), |
|
140 | 140 | $current_site->site_name |
141 | 141 | ), |
142 | 142 | sprintf( |
143 | 143 | /* translators: 1: user login, 2: site url, 3: site name/title */ |
144 | - __( 'New site created by %1$s |
|
144 | + __('New site created by %1$s |
|
145 | 145 | |
146 | 146 | Address: %2$s |
147 | 147 | Name: %3$s' ), |
148 | 148 | $current_user->user_login, |
149 | - get_site_url( $id ), |
|
150 | - wp_unslash( $title ) |
|
149 | + get_site_url($id), |
|
150 | + wp_unslash($title) |
|
151 | 151 | ), |
152 | 152 | sprintf( |
153 | 153 | 'From: "%1$s" <%2$s>', |
154 | - _x( 'Site Admin', 'email "From" field' ), |
|
155 | - get_site_option( 'admin_email' ) |
|
154 | + _x('Site Admin', 'email "From" field'), |
|
155 | + get_site_option('admin_email') |
|
156 | 156 | ) |
157 | 157 | ); |
158 | - wpmu_welcome_notification( $id, $user_id, $password, $title, array( 'public' => 1 ) ); |
|
159 | - wp_redirect( add_query_arg( array( 'update' => 'added', 'id' => $id ), 'site-new.php' ) ); |
|
158 | + wpmu_welcome_notification($id, $user_id, $password, $title, array('public' => 1)); |
|
159 | + wp_redirect(add_query_arg(array('update' => 'added', 'id' => $id), 'site-new.php')); |
|
160 | 160 | exit; |
161 | 161 | } else { |
162 | - wp_die( $id->get_error_message() ); |
|
162 | + wp_die($id->get_error_message()); |
|
163 | 163 | } |
164 | 164 | } |
165 | 165 | |
166 | -if ( isset($_GET['update']) ) { |
|
166 | +if (isset($_GET['update'])) { |
|
167 | 167 | $messages = array(); |
168 | - if ( 'added' == $_GET['update'] ) |
|
168 | + if ('added' == $_GET['update']) |
|
169 | 169 | $messages[] = sprintf( |
170 | 170 | /* translators: 1: dashboard url, 2: network admin edit url */ |
171 | - __( 'Site added. <a href="%1$s">Visit Dashboard</a> or <a href="%2$s">Edit Site</a>' ), |
|
172 | - esc_url( get_admin_url( absint( $_GET['id'] ) ) ), |
|
173 | - network_admin_url( 'site-info.php?id=' . absint( $_GET['id'] ) ) |
|
171 | + __('Site added. <a href="%1$s">Visit Dashboard</a> or <a href="%2$s">Edit Site</a>'), |
|
172 | + esc_url(get_admin_url(absint($_GET['id']))), |
|
173 | + network_admin_url('site-info.php?id='.absint($_GET['id'])) |
|
174 | 174 | ); |
175 | 175 | } |
176 | 176 | |
177 | 177 | $title = __('Add New Site'); |
178 | 178 | $parent_file = 'sites.php'; |
179 | 179 | |
180 | -wp_enqueue_script( 'user-suggest' ); |
|
180 | +wp_enqueue_script('user-suggest'); |
|
181 | 181 | |
182 | -require( ABSPATH . 'wp-admin/admin-header.php' ); |
|
182 | +require(ABSPATH.'wp-admin/admin-header.php'); |
|
183 | 183 | |
184 | 184 | ?> |
185 | 185 | |
186 | 186 | <div class="wrap"> |
187 | -<h1 id="add-new-site"><?php _e( 'Add New Site' ); ?></h1> |
|
187 | +<h1 id="add-new-site"><?php _e('Add New Site'); ?></h1> |
|
188 | 188 | <?php |
189 | -if ( ! empty( $messages ) ) { |
|
190 | - foreach ( $messages as $msg ) |
|
191 | - echo '<div id="message" class="updated notice is-dismissible"><p>' . $msg . '</p></div>'; |
|
189 | +if ( ! empty($messages)) { |
|
190 | + foreach ($messages as $msg) |
|
191 | + echo '<div id="message" class="updated notice is-dismissible"><p>'.$msg.'</p></div>'; |
|
192 | 192 | } ?> |
193 | -<form method="post" action="<?php echo network_admin_url( 'site-new.php?action=add-site' ); ?>" novalidate="novalidate"> |
|
194 | -<?php wp_nonce_field( 'add-blog', '_wpnonce_add-blog' ) ?> |
|
193 | +<form method="post" action="<?php echo network_admin_url('site-new.php?action=add-site'); ?>" novalidate="novalidate"> |
|
194 | +<?php wp_nonce_field('add-blog', '_wpnonce_add-blog') ?> |
|
195 | 195 | <table class="form-table"> |
196 | 196 | <tr class="form-field form-required"> |
197 | - <th scope="row"><label for="site-address"><?php _e( 'Site Address (URL)' ) ?></label></th> |
|
197 | + <th scope="row"><label for="site-address"><?php _e('Site Address (URL)') ?></label></th> |
|
198 | 198 | <td> |
199 | - <?php if ( is_subdomain_install() ) { ?> |
|
200 | - <input name="blog[domain]" type="text" class="regular-text" id="site-address" aria-describedby="site-address-desc" autocapitalize="none" autocorrect="off"/><span class="no-break">.<?php echo preg_replace( '|^www\.|', '', $current_site->domain ); ?></span> |
|
199 | + <?php if (is_subdomain_install()) { ?> |
|
200 | + <input name="blog[domain]" type="text" class="regular-text" id="site-address" aria-describedby="site-address-desc" autocapitalize="none" autocorrect="off"/><span class="no-break">.<?php echo preg_replace('|^www\.|', '', $current_site->domain); ?></span> |
|
201 | 201 | <?php } else { |
202 | - echo $current_site->domain . $current_site->path ?><input name="blog[domain]" type="text" class="regular-text" id="site-address" aria-describedby="site-address-desc" autocapitalize="none" autocorrect="off" /> |
|
202 | + echo $current_site->domain.$current_site->path ?><input name="blog[domain]" type="text" class="regular-text" id="site-address" aria-describedby="site-address-desc" autocapitalize="none" autocorrect="off" /> |
|
203 | 203 | <?php } |
204 | - echo '<p class="description" id="site-address-desc">' . __( 'Only lowercase letters (a-z), numbers, and hyphens are allowed.' ) . '</p>'; |
|
204 | + echo '<p class="description" id="site-address-desc">'.__('Only lowercase letters (a-z), numbers, and hyphens are allowed.').'</p>'; |
|
205 | 205 | ?> |
206 | 206 | </td> |
207 | 207 | </tr> |
208 | 208 | <tr class="form-field form-required"> |
209 | - <th scope="row"><label for="site-title"><?php _e( 'Site Title' ) ?></label></th> |
|
209 | + <th scope="row"><label for="site-title"><?php _e('Site Title') ?></label></th> |
|
210 | 210 | <td><input name="blog[title]" type="text" class="regular-text" id="site-title" /></td> |
211 | 211 | </tr> |
212 | 212 | <?php |
213 | 213 | $languages = get_available_languages(); |
214 | 214 | $translations = wp_get_available_translations(); |
215 | - if ( ! empty( $languages ) || ! empty( $translations ) ) : |
|
215 | + if ( ! empty($languages) || ! empty($translations)) : |
|
216 | 216 | ?> |
217 | 217 | <tr class="form-field form-required"> |
218 | - <th scope="row"><label for="site-language"><?php _e( 'Site Language' ); ?></label></th> |
|
218 | + <th scope="row"><label for="site-language"><?php _e('Site Language'); ?></label></th> |
|
219 | 219 | <td> |
220 | 220 | <?php |
221 | 221 | // Network default. |
222 | - $lang = get_site_option( 'WPLANG' ); |
|
222 | + $lang = get_site_option('WPLANG'); |
|
223 | 223 | |
224 | 224 | // Use English if the default isn't available. |
225 | - if ( ! in_array( $lang, $languages ) ) { |
|
225 | + if ( ! in_array($lang, $languages)) { |
|
226 | 226 | $lang = ''; |
227 | 227 | } |
228 | 228 | |
229 | - wp_dropdown_languages( array( |
|
229 | + wp_dropdown_languages(array( |
|
230 | 230 | 'name' => 'WPLANG', |
231 | 231 | 'id' => 'site-language', |
232 | 232 | 'selected' => $lang, |
233 | 233 | 'languages' => $languages, |
234 | 234 | 'translations' => $translations, |
235 | 235 | 'show_available_translations' => wp_can_install_language_pack(), |
236 | - ) ); |
|
236 | + )); |
|
237 | 237 | ?> |
238 | 238 | </td> |
239 | 239 | </tr> |
240 | 240 | <?php endif; // Languages. ?> |
241 | 241 | <tr class="form-field form-required"> |
242 | - <th scope="row"><label for="admin-email"><?php _e( 'Admin Email' ) ?></label></th> |
|
242 | + <th scope="row"><label for="admin-email"><?php _e('Admin Email') ?></label></th> |
|
243 | 243 | <td><input name="blog[email]" type="email" class="regular-text wp-suggest-user" id="admin-email" data-autocomplete-type="search" data-autocomplete-field="user_email" /></td> |
244 | 244 | </tr> |
245 | 245 | <tr class="form-field"> |
246 | - <td colspan="2"><?php _e( 'A new user will be created if the above email address is not in the database.' ) ?><br /><?php _e( 'The username and password will be mailed to this email address.' ) ?></td> |
|
246 | + <td colspan="2"><?php _e('A new user will be created if the above email address is not in the database.') ?><br /><?php _e('The username and password will be mailed to this email address.') ?></td> |
|
247 | 247 | </tr> |
248 | 248 | </table> |
249 | 249 | |
@@ -253,11 +253,11 @@ discard block |
||
253 | 253 | * |
254 | 254 | * @since 4.5.0 |
255 | 255 | */ |
256 | - do_action( 'network_site_new_form' ); |
|
256 | + do_action('network_site_new_form'); |
|
257 | 257 | |
258 | - submit_button( __( 'Add Site' ), 'primary', 'add-site' ); |
|
258 | + submit_button(__('Add Site'), 'primary', 'add-site'); |
|
259 | 259 | ?> |
260 | 260 | </form> |
261 | 261 | </div> |
262 | 262 | <?php |
263 | -require( ABSPATH . 'wp-admin/admin-footer.php' ); |
|
263 | +require(ABSPATH.'wp-admin/admin-footer.php'); |
@@ -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_sites' ) ) |
|
20 | +if ( ! current_user_can( 'manage_sites' ) ) { |
|
20 | 21 | wp_die( __( 'You do not have sufficient permissions to add sites to this network.' ) ); |
22 | +} |
|
21 | 23 | |
22 | 24 | get_current_screen()->add_help_tab( array( |
23 | 25 | 'id' => 'overview', |
@@ -36,13 +38,15 @@ discard block |
||
36 | 38 | if ( isset($_REQUEST['action']) && 'add-site' == $_REQUEST['action'] ) { |
37 | 39 | check_admin_referer( 'add-blog', '_wpnonce_add-blog' ); |
38 | 40 | |
39 | - if ( ! is_array( $_POST['blog'] ) ) |
|
40 | - wp_die( __( 'Can’t create an empty site.' ) ); |
|
41 | + if ( ! is_array( $_POST['blog'] ) ) { |
|
42 | + wp_die( __( 'Can’t create an empty site.' ) ); |
|
43 | + } |
|
41 | 44 | |
42 | 45 | $blog = $_POST['blog']; |
43 | 46 | $domain = ''; |
44 | - if ( preg_match( '|^([a-zA-Z0-9-])+$|', $blog['domain'] ) ) |
|
45 | - $domain = strtolower( $blog['domain'] ); |
|
47 | + if ( preg_match( '|^([a-zA-Z0-9-])+$|', $blog['domain'] ) ) { |
|
48 | + $domain = strtolower( $blog['domain'] ); |
|
49 | + } |
|
46 | 50 | |
47 | 51 | // If not a subdomain install, make sure the domain isn't a reserved word |
48 | 52 | if ( ! is_subdomain_install() ) { |
@@ -72,8 +76,9 @@ discard block |
||
72 | 76 | } |
73 | 77 | } |
74 | 78 | |
75 | - if ( empty( $domain ) ) |
|
76 | - wp_die( __( 'Missing or invalid site address.' ) ); |
|
79 | + if ( empty( $domain ) ) { |
|
80 | + wp_die( __( 'Missing or invalid site address.' ) ); |
|
81 | + } |
|
77 | 82 | |
78 | 83 | if ( isset( $blog['email'] ) && '' === trim( $blog['email'] ) ) { |
79 | 84 | wp_die( __( 'Missing email address.' ) ); |
@@ -165,14 +170,15 @@ discard block |
||
165 | 170 | |
166 | 171 | if ( isset($_GET['update']) ) { |
167 | 172 | $messages = array(); |
168 | - if ( 'added' == $_GET['update'] ) |
|
169 | - $messages[] = sprintf( |
|
173 | + if ( 'added' == $_GET['update'] ) { |
|
174 | + $messages[] = sprintf( |
|
170 | 175 | /* translators: 1: dashboard url, 2: network admin edit url */ |
171 | 176 | __( 'Site added. <a href="%1$s">Visit Dashboard</a> or <a href="%2$s">Edit Site</a>' ), |
172 | 177 | esc_url( get_admin_url( absint( $_GET['id'] ) ) ), |
173 | 178 | network_admin_url( 'site-info.php?id=' . absint( $_GET['id'] ) ) |
174 | 179 | ); |
175 | -} |
|
180 | + } |
|
181 | + } |
|
176 | 182 | |
177 | 183 | $title = __('Add New Site'); |
178 | 184 | $parent_file = 'sites.php'; |
@@ -187,9 +193,10 @@ discard block |
||
187 | 193 | <h1 id="add-new-site"><?php _e( 'Add New Site' ); ?></h1> |
188 | 194 | <?php |
189 | 195 | if ( ! empty( $messages ) ) { |
190 | - foreach ( $messages as $msg ) |
|
191 | - echo '<div id="message" class="updated notice is-dismissible"><p>' . $msg . '</p></div>'; |
|
192 | -} ?> |
|
196 | + foreach ( $messages as $msg ) { |
|
197 | + echo '<div id="message" class="updated notice is-dismissible"><p>' . $msg . '</p></div>'; |
|
198 | + } |
|
199 | + } ?> |
|
193 | 200 | <form method="post" action="<?php echo network_admin_url( 'site-new.php?action=add-site' ); ?>" novalidate="novalidate"> |
194 | 201 | <?php wp_nonce_field( 'add-blog', '_wpnonce_add-blog' ) ?> |
195 | 202 | <table class="form-table"> |
@@ -1,11 +1,11 @@ discard block |
||
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' ); |
@@ -52,12 +52,12 @@ discard block |
||
52 | 52 | $add_user_errors = new WP_Error( 'add_user_fail', __( 'Cannot add user.' ) ); |
53 | 53 | } else { |
54 | 54 | /** |
55 | - * Fires after a new user has been created via the network user-new.php page. |
|
56 | - * |
|
57 | - * @since 4.4.0 |
|
58 | - * |
|
59 | - * @param int $user_id ID of the newly created user. |
|
60 | - */ |
|
55 | + * Fires after a new user has been created via the network user-new.php page. |
|
56 | + * |
|
57 | + * @since 4.4.0 |
|
58 | + * |
|
59 | + * @param int $user_id ID of the newly created user. |
|
60 | + */ |
|
61 | 61 | do_action( 'network_user_new_created_user', $user_id ); |
62 | 62 | wp_redirect( add_query_arg( array('update' => 'added', 'user_id' => $user_id ), 'user-new.php' ) ); |
63 | 63 | exit; |
@@ -8,48 +8,48 @@ discard block |
||
8 | 8 | */ |
9 | 9 | |
10 | 10 | /** Load WordPress Administration Bootstrap */ |
11 | -require_once( dirname( __FILE__ ) . '/admin.php' ); |
|
11 | +require_once(dirname(__FILE__).'/admin.php'); |
|
12 | 12 | |
13 | -if ( ! is_multisite() ) |
|
14 | - wp_die( __( 'Multisite support is not enabled.' ) ); |
|
13 | +if ( ! is_multisite()) |
|
14 | + wp_die(__('Multisite support is not enabled.')); |
|
15 | 15 | |
16 | -if ( ! current_user_can('create_users') ) |
|
16 | +if ( ! current_user_can('create_users')) |
|
17 | 17 | wp_die(__('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 | 54 | /** |
55 | 55 | * Fires after a new user has been created via the network user-new.php page. |
@@ -58,29 +58,29 @@ discard block |
||
58 | 58 | * |
59 | 59 | * @param int $user_id ID of the newly created user. |
60 | 60 | */ |
61 | - do_action( 'network_user_new_created_user', $user_id ); |
|
62 | - wp_redirect( add_query_arg( array('update' => 'added', 'user_id' => $user_id ), 'user-new.php' ) ); |
|
61 | + do_action('network_user_new_created_user', $user_id); |
|
62 | + wp_redirect(add_query_arg(array('update' => 'added', 'user_id' => $user_id), 'user-new.php')); |
|
63 | 63 | exit; |
64 | 64 | } |
65 | 65 | } |
66 | 66 | } |
67 | 67 | |
68 | -if ( isset($_GET['update']) ) { |
|
68 | +if (isset($_GET['update'])) { |
|
69 | 69 | $messages = array(); |
70 | - if ( 'added' == $_GET['update'] ) { |
|
70 | + if ('added' == $_GET['update']) { |
|
71 | 71 | $edit_link = ''; |
72 | - if ( isset( $_GET['user_id'] ) ) { |
|
73 | - $user_id_new = absint( $_GET['user_id'] ); |
|
74 | - if ( $user_id_new ) { |
|
75 | - $edit_link = esc_url( add_query_arg( 'wp_http_referer', urlencode( wp_unslash( $_SERVER['REQUEST_URI'] ) ), get_edit_user_link( $user_id_new ) ) ); |
|
72 | + if (isset($_GET['user_id'])) { |
|
73 | + $user_id_new = absint($_GET['user_id']); |
|
74 | + if ($user_id_new) { |
|
75 | + $edit_link = esc_url(add_query_arg('wp_http_referer', urlencode(wp_unslash($_SERVER['REQUEST_URI'])), get_edit_user_link($user_id_new))); |
|
76 | 76 | } |
77 | 77 | } |
78 | 78 | |
79 | - if ( empty( $edit_link ) ) { |
|
80 | - $messages[] = __( 'User added.' ); |
|
79 | + if (empty($edit_link)) { |
|
80 | + $messages[] = __('User added.'); |
|
81 | 81 | } else { |
82 | 82 | /* translators: %s: edit page url */ |
83 | - $messages[] = sprintf( __( 'User added. <a href="%s">Edit user</a>' ), $edit_link ); |
|
83 | + $messages[] = sprintf(__('User added. <a href="%s">Edit user</a>'), $edit_link); |
|
84 | 84 | } |
85 | 85 | } |
86 | 86 | } |
@@ -88,20 +88,20 @@ discard block |
||
88 | 88 | $title = __('Add New User'); |
89 | 89 | $parent_file = 'users.php'; |
90 | 90 | |
91 | -require( ABSPATH . 'wp-admin/admin-header.php' ); ?> |
|
91 | +require(ABSPATH.'wp-admin/admin-header.php'); ?> |
|
92 | 92 | |
93 | 93 | <div class="wrap"> |
94 | -<h1 id="add-new-user"><?php _e( 'Add New User' ); ?></h1> |
|
94 | +<h1 id="add-new-user"><?php _e('Add New User'); ?></h1> |
|
95 | 95 | <?php |
96 | -if ( ! empty( $messages ) ) { |
|
97 | - foreach ( $messages as $msg ) |
|
98 | - echo '<div id="message" class="updated notice is-dismissible"><p>' . $msg . '</p></div>'; |
|
96 | +if ( ! empty($messages)) { |
|
97 | + foreach ($messages as $msg) |
|
98 | + echo '<div id="message" class="updated notice is-dismissible"><p>'.$msg.'</p></div>'; |
|
99 | 99 | } |
100 | 100 | |
101 | -if ( isset( $add_user_errors ) && is_wp_error( $add_user_errors ) ) { ?> |
|
101 | +if (isset($add_user_errors) && is_wp_error($add_user_errors)) { ?> |
|
102 | 102 | <div class="error"> |
103 | 103 | <?php |
104 | - foreach ( $add_user_errors->get_error_messages() as $message ) |
|
104 | + foreach ($add_user_errors->get_error_messages() as $message) |
|
105 | 105 | echo "<p>$message</p>"; |
106 | 106 | ?> |
107 | 107 | </div> |
@@ -109,15 +109,15 @@ discard block |
||
109 | 109 | <form action="<?php echo network_admin_url('user-new.php?action=add-user'); ?>" id="adduser" method="post" novalidate="novalidate"> |
110 | 110 | <table class="form-table"> |
111 | 111 | <tr class="form-field form-required"> |
112 | - <th scope="row"><label for="username"><?php _e( 'Username' ) ?></label></th> |
|
112 | + <th scope="row"><label for="username"><?php _e('Username') ?></label></th> |
|
113 | 113 | <td><input type="text" class="regular-text" name="user[username]" id="username" autocapitalize="none" autocorrect="off" maxlength="60" /></td> |
114 | 114 | </tr> |
115 | 115 | <tr class="form-field form-required"> |
116 | - <th scope="row"><label for="email"><?php _e( 'Email' ) ?></label></th> |
|
116 | + <th scope="row"><label for="email"><?php _e('Email') ?></label></th> |
|
117 | 117 | <td><input type="email" class="regular-text" name="user[email]" id="email"/></td> |
118 | 118 | </tr> |
119 | 119 | <tr class="form-field"> |
120 | - <td colspan="2"><?php _e( 'A password reset link will be sent to the user via email.' ) ?></td> |
|
120 | + <td colspan="2"><?php _e('A password reset link will be sent to the user via email.') ?></td> |
|
121 | 121 | </tr> |
122 | 122 | </table> |
123 | 123 | <?php |
@@ -126,12 +126,12 @@ discard block |
||
126 | 126 | * |
127 | 127 | * @since 4.5.0 |
128 | 128 | */ |
129 | - do_action( 'network_user_new_form' ); |
|
129 | + do_action('network_user_new_form'); |
|
130 | 130 | |
131 | - wp_nonce_field( 'add-user', '_wpnonce_add-user' ); |
|
132 | - submit_button( __('Add User'), 'primary', 'add-user' ); |
|
131 | + wp_nonce_field('add-user', '_wpnonce_add-user'); |
|
132 | + submit_button(__('Add User'), 'primary', 'add-user'); |
|
133 | 133 | ?> |
134 | 134 | </form> |
135 | 135 | </div> |
136 | 136 | <?php |
137 | -require( ABSPATH . 'wp-admin/admin-footer.php' ); |
|
137 | +require(ABSPATH.'wp-admin/admin-footer.php'); |
@@ -10,11 +10,13 @@ discard block |
||
10 | 10 | /** Load WordPress Administration Bootstrap */ |
11 | 11 | require_once( dirname( __FILE__ ) . '/admin.php' ); |
12 | 12 | |
13 | -if ( ! is_multisite() ) |
|
13 | +if ( ! is_multisite() ) { |
|
14 | 14 | wp_die( __( 'Multisite support is not enabled.' ) ); |
15 | +} |
|
15 | 16 | |
16 | -if ( ! current_user_can('create_users') ) |
|
17 | +if ( ! current_user_can('create_users') ) { |
|
17 | 18 | wp_die(__('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 | |
@@ -94,15 +98,17 @@ discard block |
||
94 | 98 | <h1 id="add-new-user"><?php _e( 'Add New User' ); ?></h1> |
95 | 99 | <?php |
96 | 100 | if ( ! empty( $messages ) ) { |
97 | - foreach ( $messages as $msg ) |
|
98 | - echo '<div id="message" class="updated notice is-dismissible"><p>' . $msg . '</p></div>'; |
|
99 | -} |
|
101 | + foreach ( $messages as $msg ) { |
|
102 | + echo '<div id="message" class="updated notice is-dismissible"><p>' . $msg . '</p></div>'; |
|
103 | + } |
|
104 | + } |
|
100 | 105 | |
101 | 106 | if ( isset( $add_user_errors ) && is_wp_error( $add_user_errors ) ) { ?> |
102 | 107 | <div class="error"> |
103 | 108 | <?php |
104 | - foreach ( $add_user_errors->get_error_messages() as $message ) |
|
105 | - echo "<p>$message</p>"; |
|
109 | + foreach ( $add_user_errors->get_error_messages() as $message ) { |
|
110 | + echo "<p>$message</p>"; |
|
111 | + } |
|
106 | 112 | ?> |
107 | 113 | </div> |
108 | 114 | <?php } ?> |
@@ -1,11 +1,11 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * Multisite users administration panel. |
|
4 | - * |
|
5 | - * @package WordPress |
|
6 | - * @subpackage Multisite |
|
7 | - * @since 3.0.0 |
|
8 | - */ |
|
3 | + * Multisite users administration panel. |
|
4 | + * |
|
5 | + * @package WordPress |
|
6 | + * @subpackage Multisite |
|
7 | + * @since 3.0.0 |
|
8 | + */ |
|
9 | 9 | |
10 | 10 | require_once( dirname( __FILE__ ) . '/admin.php' ); |
11 | 11 |
@@ -8,134 +8,134 @@ discard block |
||
8 | 8 | */ |
9 | 9 | |
10 | 10 | /** Load WordPress Administration Bootstrap */ |
11 | -require_once( dirname( __FILE__ ) . '/admin.php' ); |
|
11 | +require_once(dirname(__FILE__).'/admin.php'); |
|
12 | 12 | |
13 | -if ( ! is_multisite() ) |
|
14 | - wp_die( __( 'Multisite support is not enabled.' ) ); |
|
13 | +if ( ! is_multisite()) |
|
14 | + wp_die(__('Multisite support is not enabled.')); |
|
15 | 15 | |
16 | -if ( ! current_user_can( 'manage_network_users' ) ) |
|
17 | - wp_die( __( 'You do not have permission to access this page.' ), 403 ); |
|
16 | +if ( ! current_user_can('manage_network_users')) |
|
17 | + wp_die(__('You do not have permission to access this page.'), 403); |
|
18 | 18 | |
19 | -if ( isset( $_GET['action'] ) ) { |
|
19 | +if (isset($_GET['action'])) { |
|
20 | 20 | /** This action is documented in wp-admin/network/edit.php */ |
21 | - do_action( 'wpmuadminedit' ); |
|
21 | + do_action('wpmuadminedit'); |
|
22 | 22 | |
23 | - switch ( $_GET['action'] ) { |
|
23 | + switch ($_GET['action']) { |
|
24 | 24 | case 'deleteuser': |
25 | - if ( ! current_user_can( 'manage_network_users' ) ) |
|
26 | - wp_die( __( 'You do not have permission to access this page.' ), 403 ); |
|
25 | + if ( ! current_user_can('manage_network_users')) |
|
26 | + wp_die(__('You do not have permission to access this page.'), 403); |
|
27 | 27 | |
28 | - check_admin_referer( 'deleteuser' ); |
|
28 | + check_admin_referer('deleteuser'); |
|
29 | 29 | |
30 | - $id = intval( $_GET['id'] ); |
|
31 | - if ( $id != '0' && $id != '1' ) { |
|
32 | - $_POST['allusers'] = array( $id ); // confirm_delete_users() can only handle with arrays |
|
33 | - $title = __( 'Users' ); |
|
30 | + $id = intval($_GET['id']); |
|
31 | + if ($id != '0' && $id != '1') { |
|
32 | + $_POST['allusers'] = array($id); // confirm_delete_users() can only handle with arrays |
|
33 | + $title = __('Users'); |
|
34 | 34 | $parent_file = 'users.php'; |
35 | - require_once( ABSPATH . 'wp-admin/admin-header.php' ); |
|
35 | + require_once(ABSPATH.'wp-admin/admin-header.php'); |
|
36 | 36 | echo '<div class="wrap">'; |
37 | - confirm_delete_users( $_POST['allusers'] ); |
|
37 | + confirm_delete_users($_POST['allusers']); |
|
38 | 38 | echo '</div>'; |
39 | - require_once( ABSPATH . 'wp-admin/admin-footer.php' ); |
|
39 | + require_once(ABSPATH.'wp-admin/admin-footer.php'); |
|
40 | 40 | } else { |
41 | - wp_redirect( network_admin_url( 'users.php' ) ); |
|
41 | + wp_redirect(network_admin_url('users.php')); |
|
42 | 42 | } |
43 | 43 | exit(); |
44 | 44 | |
45 | 45 | case 'allusers': |
46 | - if ( !current_user_can( 'manage_network_users' ) ) |
|
47 | - wp_die( __( 'You do not have permission to access this page.' ), 403 ); |
|
46 | + if ( ! current_user_can('manage_network_users')) |
|
47 | + wp_die(__('You do not have permission to access this page.'), 403); |
|
48 | 48 | |
49 | - if ( ( isset( $_POST['action']) || isset($_POST['action2'] ) ) && isset( $_POST['allusers'] ) ) { |
|
50 | - check_admin_referer( 'bulk-users-network' ); |
|
49 | + if ((isset($_POST['action']) || isset($_POST['action2'])) && isset($_POST['allusers'])) { |
|
50 | + check_admin_referer('bulk-users-network'); |
|
51 | 51 | |
52 | 52 | $doaction = $_POST['action'] != -1 ? $_POST['action'] : $_POST['action2']; |
53 | 53 | $userfunction = ''; |
54 | 54 | |
55 | - foreach ( (array) $_POST['allusers'] as $user_id ) { |
|
56 | - if ( !empty( $user_id ) ) { |
|
57 | - switch ( $doaction ) { |
|
55 | + foreach ((array) $_POST['allusers'] as $user_id) { |
|
56 | + if ( ! empty($user_id)) { |
|
57 | + switch ($doaction) { |
|
58 | 58 | case 'delete': |
59 | - if ( ! current_user_can( 'delete_users' ) ) |
|
60 | - wp_die( __( 'You do not have permission to access this page.' ), 403 ); |
|
61 | - $title = __( 'Users' ); |
|
59 | + if ( ! current_user_can('delete_users')) |
|
60 | + wp_die(__('You do not have permission to access this page.'), 403); |
|
61 | + $title = __('Users'); |
|
62 | 62 | $parent_file = 'users.php'; |
63 | - require_once( ABSPATH . 'wp-admin/admin-header.php' ); |
|
63 | + require_once(ABSPATH.'wp-admin/admin-header.php'); |
|
64 | 64 | echo '<div class="wrap">'; |
65 | - confirm_delete_users( $_POST['allusers'] ); |
|
65 | + confirm_delete_users($_POST['allusers']); |
|
66 | 66 | echo '</div>'; |
67 | - require_once( ABSPATH . 'wp-admin/admin-footer.php' ); |
|
67 | + require_once(ABSPATH.'wp-admin/admin-footer.php'); |
|
68 | 68 | exit(); |
69 | 69 | |
70 | 70 | case 'spam': |
71 | - $user = get_userdata( $user_id ); |
|
72 | - if ( is_super_admin( $user->ID ) ) |
|
73 | - wp_die( sprintf( __( 'Warning! User cannot be modified. The user %s is a network administrator.' ), esc_html( $user->user_login ) ) ); |
|
71 | + $user = get_userdata($user_id); |
|
72 | + if (is_super_admin($user->ID)) |
|
73 | + wp_die(sprintf(__('Warning! User cannot be modified. The user %s is a network administrator.'), esc_html($user->user_login))); |
|
74 | 74 | |
75 | 75 | $userfunction = 'all_spam'; |
76 | - $blogs = get_blogs_of_user( $user_id, true ); |
|
77 | - foreach ( (array) $blogs as $details ) { |
|
78 | - if ( $details->userblog_id != $current_site->blog_id ) // main blog not a spam ! |
|
79 | - update_blog_status( $details->userblog_id, 'spam', '1' ); |
|
76 | + $blogs = get_blogs_of_user($user_id, true); |
|
77 | + foreach ((array) $blogs as $details) { |
|
78 | + if ($details->userblog_id != $current_site->blog_id) // main blog not a spam ! |
|
79 | + update_blog_status($details->userblog_id, 'spam', '1'); |
|
80 | 80 | } |
81 | - update_user_status( $user_id, 'spam', '1' ); |
|
81 | + update_user_status($user_id, 'spam', '1'); |
|
82 | 82 | break; |
83 | 83 | |
84 | 84 | case 'notspam': |
85 | 85 | $userfunction = 'all_notspam'; |
86 | - $blogs = get_blogs_of_user( $user_id, true ); |
|
87 | - foreach ( (array) $blogs as $details ) |
|
88 | - update_blog_status( $details->userblog_id, 'spam', '0' ); |
|
86 | + $blogs = get_blogs_of_user($user_id, true); |
|
87 | + foreach ((array) $blogs as $details) |
|
88 | + update_blog_status($details->userblog_id, 'spam', '0'); |
|
89 | 89 | |
90 | - update_user_status( $user_id, 'spam', '0' ); |
|
90 | + update_user_status($user_id, 'spam', '0'); |
|
91 | 91 | break; |
92 | 92 | } |
93 | 93 | } |
94 | 94 | } |
95 | 95 | |
96 | - wp_safe_redirect( add_query_arg( array( 'updated' => 'true', 'action' => $userfunction ), wp_get_referer() ) ); |
|
96 | + wp_safe_redirect(add_query_arg(array('updated' => 'true', 'action' => $userfunction), wp_get_referer())); |
|
97 | 97 | } else { |
98 | - $location = network_admin_url( 'users.php' ); |
|
98 | + $location = network_admin_url('users.php'); |
|
99 | 99 | |
100 | - if ( ! empty( $_REQUEST['paged'] ) ) |
|
101 | - $location = add_query_arg( 'paged', (int) $_REQUEST['paged'], $location ); |
|
102 | - wp_redirect( $location ); |
|
100 | + if ( ! empty($_REQUEST['paged'])) |
|
101 | + $location = add_query_arg('paged', (int) $_REQUEST['paged'], $location); |
|
102 | + wp_redirect($location); |
|
103 | 103 | } |
104 | 104 | exit(); |
105 | 105 | |
106 | 106 | case 'dodelete': |
107 | - check_admin_referer( 'ms-users-delete' ); |
|
108 | - if ( ! ( current_user_can( 'manage_network_users' ) && current_user_can( 'delete_users' ) ) ) |
|
109 | - wp_die( __( 'You do not have permission to access this page.' ), 403 ); |
|
110 | - |
|
111 | - if ( ! empty( $_POST['blog'] ) && is_array( $_POST['blog'] ) ) { |
|
112 | - foreach ( $_POST['blog'] as $id => $users ) { |
|
113 | - foreach ( $users as $blogid => $user_id ) { |
|
114 | - if ( ! current_user_can( 'delete_user', $id ) ) |
|
107 | + check_admin_referer('ms-users-delete'); |
|
108 | + if ( ! (current_user_can('manage_network_users') && current_user_can('delete_users'))) |
|
109 | + wp_die(__('You do not have permission to access this page.'), 403); |
|
110 | + |
|
111 | + if ( ! empty($_POST['blog']) && is_array($_POST['blog'])) { |
|
112 | + foreach ($_POST['blog'] as $id => $users) { |
|
113 | + foreach ($users as $blogid => $user_id) { |
|
114 | + if ( ! current_user_can('delete_user', $id)) |
|
115 | 115 | continue; |
116 | 116 | |
117 | - if ( ! empty( $_POST['delete'] ) && 'reassign' == $_POST['delete'][$blogid][$id] ) |
|
118 | - remove_user_from_blog( $id, $blogid, $user_id ); |
|
117 | + if ( ! empty($_POST['delete']) && 'reassign' == $_POST['delete'][$blogid][$id]) |
|
118 | + remove_user_from_blog($id, $blogid, $user_id); |
|
119 | 119 | else |
120 | - remove_user_from_blog( $id, $blogid ); |
|
120 | + remove_user_from_blog($id, $blogid); |
|
121 | 121 | } |
122 | 122 | } |
123 | 123 | } |
124 | 124 | $i = 0; |
125 | - if ( is_array( $_POST['user'] ) && ! empty( $_POST['user'] ) ) |
|
126 | - foreach ( $_POST['user'] as $id ) { |
|
127 | - if ( ! current_user_can( 'delete_user', $id ) ) |
|
125 | + if (is_array($_POST['user']) && ! empty($_POST['user'])) |
|
126 | + foreach ($_POST['user'] as $id) { |
|
127 | + if ( ! current_user_can('delete_user', $id)) |
|
128 | 128 | continue; |
129 | - wpmu_delete_user( $id ); |
|
129 | + wpmu_delete_user($id); |
|
130 | 130 | $i++; |
131 | 131 | } |
132 | 132 | |
133 | - if ( $i == 1 ) |
|
133 | + if ($i == 1) |
|
134 | 134 | $deletefunction = 'delete'; |
135 | 135 | else |
136 | 136 | $deletefunction = 'all_delete'; |
137 | 137 | |
138 | - wp_redirect( add_query_arg( array( 'updated' => 'true', 'action' => $deletefunction ), network_admin_url( 'users.php' ) ) ); |
|
138 | + wp_redirect(add_query_arg(array('updated' => 'true', 'action' => $deletefunction), network_admin_url('users.php'))); |
|
139 | 139 | exit(); |
140 | 140 | } |
141 | 141 | } |
@@ -143,62 +143,62 @@ discard block |
||
143 | 143 | $wp_list_table = _get_list_table('WP_MS_Users_List_Table'); |
144 | 144 | $pagenum = $wp_list_table->get_pagenum(); |
145 | 145 | $wp_list_table->prepare_items(); |
146 | -$total_pages = $wp_list_table->get_pagination_arg( 'total_pages' ); |
|
146 | +$total_pages = $wp_list_table->get_pagination_arg('total_pages'); |
|
147 | 147 | |
148 | -if ( $pagenum > $total_pages && $total_pages > 0 ) { |
|
149 | - wp_redirect( add_query_arg( 'paged', $total_pages ) ); |
|
148 | +if ($pagenum > $total_pages && $total_pages > 0) { |
|
149 | + wp_redirect(add_query_arg('paged', $total_pages)); |
|
150 | 150 | exit; |
151 | 151 | } |
152 | -$title = __( 'Users' ); |
|
152 | +$title = __('Users'); |
|
153 | 153 | $parent_file = 'users.php'; |
154 | 154 | |
155 | -add_screen_option( 'per_page' ); |
|
155 | +add_screen_option('per_page'); |
|
156 | 156 | |
157 | -get_current_screen()->add_help_tab( array( |
|
157 | +get_current_screen()->add_help_tab(array( |
|
158 | 158 | 'id' => 'overview', |
159 | 159 | 'title' => __('Overview'), |
160 | 160 | 'content' => |
161 | - '<p>' . __('This table shows all users across the network and the sites to which they are assigned.') . '</p>' . |
|
162 | - '<p>' . __('Hover over any user on the list to make the edit links appear. The Edit link on the left will take you to their Edit User profile page; the Edit link on the right by any site name goes to an Edit Site screen for that site.') . '</p>' . |
|
163 | - '<p>' . __('You can also go to the user’s profile page by clicking on the individual username.') . '</p>' . |
|
164 | - '<p>' . __('You can sort the table by clicking on any of the bold headings and switch between list and excerpt views by using the icons in the upper right.') . '</p>' . |
|
165 | - '<p>' . __('The bulk action will permanently delete selected users, or mark/unmark those selected as spam. Spam users will have posts removed and will be unable to sign up again with the same email addresses.') . '</p>' . |
|
166 | - '<p>' . __('You can make an existing user an additional super admin by going to the Edit User profile page and checking the box to grant that privilege.') . '</p>' |
|
167 | -) ); |
|
161 | + '<p>'.__('This table shows all users across the network and the sites to which they are assigned.').'</p>'. |
|
162 | + '<p>'.__('Hover over any user on the list to make the edit links appear. The Edit link on the left will take you to their Edit User profile page; the Edit link on the right by any site name goes to an Edit Site screen for that site.').'</p>'. |
|
163 | + '<p>'.__('You can also go to the user’s profile page by clicking on the individual username.').'</p>'. |
|
164 | + '<p>'.__('You can sort the table by clicking on any of the bold headings and switch between list and excerpt views by using the icons in the upper right.').'</p>'. |
|
165 | + '<p>'.__('The bulk action will permanently delete selected users, or mark/unmark those selected as spam. Spam users will have posts removed and will be unable to sign up again with the same email addresses.').'</p>'. |
|
166 | + '<p>'.__('You can make an existing user an additional super admin by going to the Edit User profile page and checking the box to grant that privilege.').'</p>' |
|
167 | +)); |
|
168 | 168 | |
169 | 169 | get_current_screen()->set_help_sidebar( |
170 | - '<p><strong>' . __('For more information:') . '</strong></p>' . |
|
171 | - '<p>' . __('<a href="https://codex.wordpress.org/Network_Admin_Users_Screen" target="_blank">Documentation on Network Users</a>') . '</p>' . |
|
172 | - '<p>' . __('<a href="https://wordpress.org/support/forum/multisite/" target="_blank">Support Forums</a>') . '</p>' |
|
170 | + '<p><strong>'.__('For more information:').'</strong></p>'. |
|
171 | + '<p>'.__('<a href="https://codex.wordpress.org/Network_Admin_Users_Screen" target="_blank">Documentation on Network Users</a>').'</p>'. |
|
172 | + '<p>'.__('<a href="https://wordpress.org/support/forum/multisite/" target="_blank">Support Forums</a>').'</p>' |
|
173 | 173 | ); |
174 | 174 | |
175 | -get_current_screen()->set_screen_reader_content( array( |
|
176 | - 'heading_views' => __( 'Filter users list' ), |
|
177 | - 'heading_pagination' => __( 'Users list navigation' ), |
|
178 | - 'heading_list' => __( 'Users list' ), |
|
179 | -) ); |
|
175 | +get_current_screen()->set_screen_reader_content(array( |
|
176 | + 'heading_views' => __('Filter users list'), |
|
177 | + 'heading_pagination' => __('Users list navigation'), |
|
178 | + 'heading_list' => __('Users list'), |
|
179 | +)); |
|
180 | 180 | |
181 | -require_once( ABSPATH . 'wp-admin/admin-header.php' ); |
|
181 | +require_once(ABSPATH.'wp-admin/admin-header.php'); |
|
182 | 182 | |
183 | -if ( isset( $_REQUEST['updated'] ) && $_REQUEST['updated'] == 'true' && ! empty( $_REQUEST['action'] ) ) { |
|
183 | +if (isset($_REQUEST['updated']) && $_REQUEST['updated'] == 'true' && ! empty($_REQUEST['action'])) { |
|
184 | 184 | ?> |
185 | 185 | <div id="message" class="updated notice is-dismissible"><p> |
186 | 186 | <?php |
187 | - switch ( $_REQUEST['action'] ) { |
|
187 | + switch ($_REQUEST['action']) { |
|
188 | 188 | case 'delete': |
189 | - _e( 'User deleted.' ); |
|
189 | + _e('User deleted.'); |
|
190 | 190 | break; |
191 | 191 | case 'all_spam': |
192 | - _e( 'Users marked as spam.' ); |
|
192 | + _e('Users marked as spam.'); |
|
193 | 193 | break; |
194 | 194 | case 'all_notspam': |
195 | - _e( 'Users removed from spam.' ); |
|
195 | + _e('Users removed from spam.'); |
|
196 | 196 | break; |
197 | 197 | case 'all_delete': |
198 | - _e( 'Users deleted.' ); |
|
198 | + _e('Users deleted.'); |
|
199 | 199 | break; |
200 | 200 | case 'add': |
201 | - _e( 'User added.' ); |
|
201 | + _e('User added.'); |
|
202 | 202 | break; |
203 | 203 | } |
204 | 204 | ?> |
@@ -207,14 +207,14 @@ discard block |
||
207 | 207 | } |
208 | 208 | ?> |
209 | 209 | <div class="wrap"> |
210 | - <h1><?php esc_html_e( 'Users' ); |
|
211 | - if ( current_user_can( 'create_users') ) : ?> |
|
212 | - <a href="<?php echo network_admin_url('user-new.php'); ?>" class="page-title-action"><?php echo esc_html_x( 'Add New', 'user' ); ?></a><?php |
|
210 | + <h1><?php esc_html_e('Users'); |
|
211 | + if (current_user_can('create_users')) : ?> |
|
212 | + <a href="<?php echo network_admin_url('user-new.php'); ?>" class="page-title-action"><?php echo esc_html_x('Add New', 'user'); ?></a><?php |
|
213 | 213 | endif; |
214 | 214 | |
215 | - if ( strlen( $usersearch ) ) { |
|
215 | + if (strlen($usersearch)) { |
|
216 | 216 | /* translators: %s: search keywords */ |
217 | - printf( '<span class="subtitle">' . __( 'Search results for “%s”' ) . '</span>', esc_html( $usersearch ) ); |
|
217 | + printf('<span class="subtitle">'.__('Search results for “%s”').'</span>', esc_html($usersearch)); |
|
218 | 218 | } |
219 | 219 | ?> |
220 | 220 | </h1> |
@@ -222,7 +222,7 @@ discard block |
||
222 | 222 | <?php $wp_list_table->views(); ?> |
223 | 223 | |
224 | 224 | <form method="get" class="search-form"> |
225 | - <?php $wp_list_table->search_box( __( 'Search Users' ), 'all-user' ); ?> |
|
225 | + <?php $wp_list_table->search_box(__('Search Users'), 'all-user'); ?> |
|
226 | 226 | </form> |
227 | 227 | |
228 | 228 | <form id="form-user-list" action="users.php?action=allusers" method="post"> |
@@ -230,4 +230,4 @@ discard block |
||
230 | 230 | </form> |
231 | 231 | </div> |
232 | 232 | |
233 | -<?php require_once( ABSPATH . 'wp-admin/admin-footer.php' ); ?> |
|
233 | +<?php require_once(ABSPATH.'wp-admin/admin-footer.php'); ?> |
@@ -10,11 +10,13 @@ discard block |
||
10 | 10 | /** Load WordPress Administration Bootstrap */ |
11 | 11 | require_once( dirname( __FILE__ ) . '/admin.php' ); |
12 | 12 | |
13 | -if ( ! is_multisite() ) |
|
13 | +if ( ! is_multisite() ) { |
|
14 | 14 | wp_die( __( 'Multisite support is not enabled.' ) ); |
15 | +} |
|
15 | 16 | |
16 | -if ( ! current_user_can( 'manage_network_users' ) ) |
|
17 | +if ( ! current_user_can( 'manage_network_users' ) ) { |
|
17 | 18 | wp_die( __( 'You do not have permission to access this page.' ), 403 ); |
19 | +} |
|
18 | 20 | |
19 | 21 | if ( isset( $_GET['action'] ) ) { |
20 | 22 | /** This action is documented in wp-admin/network/edit.php */ |
@@ -22,8 +24,9 @@ discard block |
||
22 | 24 | |
23 | 25 | switch ( $_GET['action'] ) { |
24 | 26 | case 'deleteuser': |
25 | - if ( ! current_user_can( 'manage_network_users' ) ) |
|
26 | - wp_die( __( 'You do not have permission to access this page.' ), 403 ); |
|
27 | + if ( ! current_user_can( 'manage_network_users' ) ) { |
|
28 | + wp_die( __( 'You do not have permission to access this page.' ), 403 ); |
|
29 | + } |
|
27 | 30 | |
28 | 31 | check_admin_referer( 'deleteuser' ); |
29 | 32 | |
@@ -43,8 +46,9 @@ discard block |
||
43 | 46 | exit(); |
44 | 47 | |
45 | 48 | case 'allusers': |
46 | - if ( !current_user_can( 'manage_network_users' ) ) |
|
47 | - wp_die( __( 'You do not have permission to access this page.' ), 403 ); |
|
49 | + if ( !current_user_can( 'manage_network_users' ) ) { |
|
50 | + wp_die( __( 'You do not have permission to access this page.' ), 403 ); |
|
51 | + } |
|
48 | 52 | |
49 | 53 | if ( ( isset( $_POST['action']) || isset($_POST['action2'] ) ) && isset( $_POST['allusers'] ) ) { |
50 | 54 | check_admin_referer( 'bulk-users-network' ); |
@@ -56,8 +60,9 @@ discard block |
||
56 | 60 | if ( !empty( $user_id ) ) { |
57 | 61 | switch ( $doaction ) { |
58 | 62 | case 'delete': |
59 | - if ( ! current_user_can( 'delete_users' ) ) |
|
60 | - wp_die( __( 'You do not have permission to access this page.' ), 403 ); |
|
63 | + if ( ! current_user_can( 'delete_users' ) ) { |
|
64 | + wp_die( __( 'You do not have permission to access this page.' ), 403 ); |
|
65 | + } |
|
61 | 66 | $title = __( 'Users' ); |
62 | 67 | $parent_file = 'users.php'; |
63 | 68 | require_once( ABSPATH . 'wp-admin/admin-header.php' ); |
@@ -69,14 +74,17 @@ discard block |
||
69 | 74 | |
70 | 75 | case 'spam': |
71 | 76 | $user = get_userdata( $user_id ); |
72 | - if ( is_super_admin( $user->ID ) ) |
|
73 | - wp_die( sprintf( __( 'Warning! User cannot be modified. The user %s is a network administrator.' ), esc_html( $user->user_login ) ) ); |
|
77 | + if ( is_super_admin( $user->ID ) ) { |
|
78 | + wp_die( sprintf( __( 'Warning! User cannot be modified. The user %s is a network administrator.' ), esc_html( $user->user_login ) ) ); |
|
79 | + } |
|
74 | 80 | |
75 | 81 | $userfunction = 'all_spam'; |
76 | 82 | $blogs = get_blogs_of_user( $user_id, true ); |
77 | 83 | foreach ( (array) $blogs as $details ) { |
78 | - if ( $details->userblog_id != $current_site->blog_id ) // main blog not a spam ! |
|
84 | + if ( $details->userblog_id != $current_site->blog_id ) { |
|
85 | + // main blog not a spam ! |
|
79 | 86 | update_blog_status( $details->userblog_id, 'spam', '1' ); |
87 | + } |
|
80 | 88 | } |
81 | 89 | update_user_status( $user_id, 'spam', '1' ); |
82 | 90 | break; |
@@ -84,8 +92,9 @@ discard block |
||
84 | 92 | case 'notspam': |
85 | 93 | $userfunction = 'all_notspam'; |
86 | 94 | $blogs = get_blogs_of_user( $user_id, true ); |
87 | - foreach ( (array) $blogs as $details ) |
|
88 | - update_blog_status( $details->userblog_id, 'spam', '0' ); |
|
95 | + foreach ( (array) $blogs as $details ) { |
|
96 | + update_blog_status( $details->userblog_id, 'spam', '0' ); |
|
97 | + } |
|
89 | 98 | |
90 | 99 | update_user_status( $user_id, 'spam', '0' ); |
91 | 100 | break; |
@@ -97,43 +106,49 @@ discard block |
||
97 | 106 | } else { |
98 | 107 | $location = network_admin_url( 'users.php' ); |
99 | 108 | |
100 | - if ( ! empty( $_REQUEST['paged'] ) ) |
|
101 | - $location = add_query_arg( 'paged', (int) $_REQUEST['paged'], $location ); |
|
109 | + if ( ! empty( $_REQUEST['paged'] ) ) { |
|
110 | + $location = add_query_arg( 'paged', (int) $_REQUEST['paged'], $location ); |
|
111 | + } |
|
102 | 112 | wp_redirect( $location ); |
103 | 113 | } |
104 | 114 | exit(); |
105 | 115 | |
106 | 116 | case 'dodelete': |
107 | 117 | check_admin_referer( 'ms-users-delete' ); |
108 | - if ( ! ( current_user_can( 'manage_network_users' ) && current_user_can( 'delete_users' ) ) ) |
|
109 | - wp_die( __( 'You do not have permission to access this page.' ), 403 ); |
|
118 | + if ( ! ( current_user_can( 'manage_network_users' ) && current_user_can( 'delete_users' ) ) ) { |
|
119 | + wp_die( __( 'You do not have permission to access this page.' ), 403 ); |
|
120 | + } |
|
110 | 121 | |
111 | 122 | if ( ! empty( $_POST['blog'] ) && is_array( $_POST['blog'] ) ) { |
112 | 123 | foreach ( $_POST['blog'] as $id => $users ) { |
113 | 124 | foreach ( $users as $blogid => $user_id ) { |
114 | - if ( ! current_user_can( 'delete_user', $id ) ) |
|
115 | - continue; |
|
125 | + if ( ! current_user_can( 'delete_user', $id ) ) { |
|
126 | + continue; |
|
127 | + } |
|
116 | 128 | |
117 | - if ( ! empty( $_POST['delete'] ) && 'reassign' == $_POST['delete'][$blogid][$id] ) |
|
118 | - remove_user_from_blog( $id, $blogid, $user_id ); |
|
119 | - else |
|
120 | - remove_user_from_blog( $id, $blogid ); |
|
129 | + if ( ! empty( $_POST['delete'] ) && 'reassign' == $_POST['delete'][$blogid][$id] ) { |
|
130 | + remove_user_from_blog( $id, $blogid, $user_id ); |
|
131 | + } else { |
|
132 | + remove_user_from_blog( $id, $blogid ); |
|
133 | + } |
|
121 | 134 | } |
122 | 135 | } |
123 | 136 | } |
124 | 137 | $i = 0; |
125 | - if ( is_array( $_POST['user'] ) && ! empty( $_POST['user'] ) ) |
|
126 | - foreach ( $_POST['user'] as $id ) { |
|
138 | + if ( is_array( $_POST['user'] ) && ! empty( $_POST['user'] ) ) { |
|
139 | + foreach ( $_POST['user'] as $id ) { |
|
127 | 140 | if ( ! current_user_can( 'delete_user', $id ) ) |
128 | 141 | continue; |
142 | + } |
|
129 | 143 | wpmu_delete_user( $id ); |
130 | 144 | $i++; |
131 | 145 | } |
132 | 146 | |
133 | - if ( $i == 1 ) |
|
134 | - $deletefunction = 'delete'; |
|
135 | - else |
|
136 | - $deletefunction = 'all_delete'; |
|
147 | + if ( $i == 1 ) { |
|
148 | + $deletefunction = 'delete'; |
|
149 | + } else { |
|
150 | + $deletefunction = 'all_delete'; |
|
151 | + } |
|
137 | 152 | |
138 | 153 | wp_redirect( add_query_arg( array( 'updated' => 'true', 'action' => $deletefunction ), network_admin_url( 'users.php' ) ) ); |
139 | 154 | exit(); |