@@ -24,8 +24,8 @@ discard block |
||
24 | 24 | protected function get_column_info() { |
25 | 25 | return array( |
26 | 26 | array( |
27 | - 'author' => __( 'Author' ), |
|
28 | - 'comment' => _x( 'Comment', 'column name' ), |
|
27 | + 'author' => __('Author'), |
|
28 | + 'comment' => _x('Comment', 'column name'), |
|
29 | 29 | ), |
30 | 30 | array(), |
31 | 31 | array(), |
@@ -48,17 +48,17 @@ discard block |
||
48 | 48 | * |
49 | 49 | * @param bool $output_empty |
50 | 50 | */ |
51 | - public function display( $output_empty = false ) { |
|
51 | + public function display($output_empty = false) { |
|
52 | 52 | $singular = $this->_args['singular']; |
53 | 53 | |
54 | - wp_nonce_field( "fetch-list-" . get_class( $this ), '_ajax_fetch_list_nonce' ); |
|
54 | + wp_nonce_field("fetch-list-".get_class($this), '_ajax_fetch_list_nonce'); |
|
55 | 55 | ?> |
56 | -<table class="<?php echo implode( ' ', $this->get_table_classes() ); ?>" style="display:none;"> |
|
56 | +<table class="<?php echo implode(' ', $this->get_table_classes()); ?>" style="display:none;"> |
|
57 | 57 | <tbody id="the-comment-list"<?php |
58 | - if ( $singular ) { |
|
58 | + if ($singular) { |
|
59 | 59 | echo " data-wp-lists='list:$singular'"; |
60 | 60 | } ?>> |
61 | - <?php if ( ! $output_empty ) { |
|
61 | + <?php if ( ! $output_empty) { |
|
62 | 62 | $this->display_rows_or_placeholder(); |
63 | 63 | } ?> |
64 | 64 | </tbody> |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | * @param bool $comment_status |
72 | 72 | * @return int |
73 | 73 | */ |
74 | - public function get_per_page( $comment_status = false ) { |
|
74 | + public function get_per_page($comment_status = false) { |
|
75 | 75 | return 10; |
76 | 76 | } |
77 | 77 | } |
@@ -48,8 +48,9 @@ discard block |
||
48 | 48 | $search_terms = array_unique( array_filter( array_map( 'trim', explode( ',', $search_string ) ) ) ); |
49 | 49 | } |
50 | 50 | |
51 | - if ( ! empty( $_REQUEST['features'] ) ) |
|
52 | - $this->features = $_REQUEST['features']; |
|
51 | + if ( ! empty( $_REQUEST['features'] ) ) { |
|
52 | + $this->features = $_REQUEST['features']; |
|
53 | + } |
|
53 | 54 | |
54 | 55 | $paged = $this->get_pagenum(); |
55 | 56 | |
@@ -58,8 +59,9 @@ discard block |
||
58 | 59 | // These are the tabs which are shown on the page, |
59 | 60 | $tabs = array(); |
60 | 61 | $tabs['dashboard'] = __( 'Search' ); |
61 | - if ( 'search' === $tab ) |
|
62 | - $tabs['search'] = __( 'Search Results' ); |
|
62 | + if ( 'search' === $tab ) { |
|
63 | + $tabs['search'] = __( 'Search Results' ); |
|
64 | + } |
|
63 | 65 | $tabs['upload'] = __( 'Upload' ); |
64 | 66 | $tabs['featured'] = _x( 'Featured', 'themes' ); |
65 | 67 | //$tabs['popular'] = _x( 'Popular', 'themes' ); |
@@ -82,8 +84,9 @@ discard block |
||
82 | 84 | $nonmenu_tabs = apply_filters( 'install_themes_nonmenu_tabs', $nonmenu_tabs ); |
83 | 85 | |
84 | 86 | // If a non-valid menu tab has been selected, And it's not a non-menu action. |
85 | - if ( empty( $tab ) || ( ! isset( $tabs[ $tab ] ) && ! in_array( $tab, (array) $nonmenu_tabs ) ) ) |
|
86 | - $tab = key( $tabs ); |
|
87 | + if ( empty( $tab ) || ( ! isset( $tabs[ $tab ] ) && ! in_array( $tab, (array) $nonmenu_tabs ) ) ) { |
|
88 | + $tab = key( $tabs ); |
|
89 | + } |
|
87 | 90 | |
88 | 91 | $args = array( 'page' => $paged, 'per_page' => $per_page, 'fields' => $theme_field_defaults ); |
89 | 92 | |
@@ -136,13 +139,15 @@ discard block |
||
136 | 139 | */ |
137 | 140 | $args = apply_filters( 'install_themes_table_api_args_' . $tab, $args ); |
138 | 141 | |
139 | - if ( ! $args ) |
|
140 | - return; |
|
142 | + if ( ! $args ) { |
|
143 | + return; |
|
144 | + } |
|
141 | 145 | |
142 | 146 | $api = themes_api( 'query_themes', $args ); |
143 | 147 | |
144 | - if ( is_wp_error( $api ) ) |
|
145 | - wp_die( $api->get_error_message() . '</p> <p><a href="#" onclick="document.location.reload(); return false;">' . __( 'Try again' ) . '</a>' ); |
|
148 | + if ( is_wp_error( $api ) ) { |
|
149 | + wp_die( $api->get_error_message() . '</p> <p><a href="#" onclick="document.location.reload(); return false;">' . __( 'Try again' ) . '</a>' ); |
|
150 | + } |
|
146 | 151 | |
147 | 152 | $this->items = $api->themes; |
148 | 153 | |
@@ -247,8 +252,9 @@ discard block |
||
247 | 252 | public function single_row( $theme ) { |
248 | 253 | global $themes_allowedtags; |
249 | 254 | |
250 | - if ( empty( $theme ) ) |
|
251 | - return; |
|
255 | + if ( empty( $theme ) ) { |
|
256 | + return; |
|
257 | + } |
|
252 | 258 | |
253 | 259 | $name = wp_kses( $theme->name, $themes_allowedtags ); |
254 | 260 | $author = wp_kses( $theme->author, $themes_allowedtags ); |
@@ -376,8 +382,9 @@ discard block |
||
376 | 382 | public function install_theme_info( $theme ) { |
377 | 383 | global $themes_allowedtags; |
378 | 384 | |
379 | - if ( empty( $theme ) ) |
|
380 | - return; |
|
385 | + if ( empty( $theme ) ) { |
|
386 | + return; |
|
387 | + } |
|
381 | 388 | |
382 | 389 | $name = wp_kses( $theme->name, $themes_allowedtags ); |
383 | 390 | $author = wp_kses( $theme->author, $themes_allowedtags ); |
@@ -459,12 +466,13 @@ discard block |
||
459 | 466 | |
460 | 467 | $installed_theme = wp_get_theme( $theme->slug ); |
461 | 468 | if ( $installed_theme->exists() ) { |
462 | - if ( version_compare( $installed_theme->get('Version'), $theme->version, '=' ) ) |
|
463 | - $status = 'latest_installed'; |
|
464 | - elseif ( version_compare( $installed_theme->get('Version'), $theme->version, '>' ) ) |
|
465 | - $status = 'newer_installed'; |
|
466 | - else |
|
467 | - $status = 'update_available'; |
|
469 | + if ( version_compare( $installed_theme->get('Version'), $theme->version, '=' ) ) { |
|
470 | + $status = 'latest_installed'; |
|
471 | + } elseif ( version_compare( $installed_theme->get('Version'), $theme->version, '>' ) ) { |
|
472 | + $status = 'newer_installed'; |
|
473 | + } else { |
|
474 | + $status = 'update_available'; |
|
475 | + } |
|
468 | 476 | } |
469 | 477 | |
470 | 478 | return $status; |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | * @return bool |
25 | 25 | */ |
26 | 26 | public function ajax_user_can() { |
27 | - return current_user_can( 'install_themes' ); |
|
27 | + return current_user_can('install_themes'); |
|
28 | 28 | } |
29 | 29 | |
30 | 30 | /** |
@@ -36,19 +36,19 @@ discard block |
||
36 | 36 | * @global array $theme_field_defaults |
37 | 37 | */ |
38 | 38 | public function prepare_items() { |
39 | - include( ABSPATH . 'wp-admin/includes/theme-install.php' ); |
|
39 | + include(ABSPATH.'wp-admin/includes/theme-install.php'); |
|
40 | 40 | |
41 | 41 | global $tabs, $tab, $paged, $type, $theme_field_defaults; |
42 | - wp_reset_vars( array( 'tab' ) ); |
|
42 | + wp_reset_vars(array('tab')); |
|
43 | 43 | |
44 | 44 | $search_terms = array(); |
45 | 45 | $search_string = ''; |
46 | - if ( ! empty( $_REQUEST['s'] ) ){ |
|
47 | - $search_string = strtolower( wp_unslash( $_REQUEST['s'] ) ); |
|
48 | - $search_terms = array_unique( array_filter( array_map( 'trim', explode( ',', $search_string ) ) ) ); |
|
46 | + if ( ! empty($_REQUEST['s'])) { |
|
47 | + $search_string = strtolower(wp_unslash($_REQUEST['s'])); |
|
48 | + $search_terms = array_unique(array_filter(array_map('trim', explode(',', $search_string)))); |
|
49 | 49 | } |
50 | 50 | |
51 | - if ( ! empty( $_REQUEST['features'] ) ) |
|
51 | + if ( ! empty($_REQUEST['features'])) |
|
52 | 52 | $this->features = $_REQUEST['features']; |
53 | 53 | |
54 | 54 | $paged = $this->get_pagenum(); |
@@ -57,19 +57,19 @@ discard block |
||
57 | 57 | |
58 | 58 | // These are the tabs which are shown on the page, |
59 | 59 | $tabs = array(); |
60 | - $tabs['dashboard'] = __( 'Search' ); |
|
61 | - if ( 'search' === $tab ) |
|
62 | - $tabs['search'] = __( 'Search Results' ); |
|
63 | - $tabs['upload'] = __( 'Upload' ); |
|
64 | - $tabs['featured'] = _x( 'Featured', 'themes' ); |
|
60 | + $tabs['dashboard'] = __('Search'); |
|
61 | + if ('search' === $tab) |
|
62 | + $tabs['search'] = __('Search Results'); |
|
63 | + $tabs['upload'] = __('Upload'); |
|
64 | + $tabs['featured'] = _x('Featured', 'themes'); |
|
65 | 65 | //$tabs['popular'] = _x( 'Popular', 'themes' ); |
66 | - $tabs['new'] = _x( 'Latest', 'themes' ); |
|
67 | - $tabs['updated'] = _x( 'Recently Updated', 'themes' ); |
|
66 | + $tabs['new'] = _x('Latest', 'themes'); |
|
67 | + $tabs['updated'] = _x('Recently Updated', 'themes'); |
|
68 | 68 | |
69 | - $nonmenu_tabs = array( 'theme-information' ); // Valid actions to perform which do not have a Menu item. |
|
69 | + $nonmenu_tabs = array('theme-information'); // Valid actions to perform which do not have a Menu item. |
|
70 | 70 | |
71 | 71 | /** This filter is documented in wp-admin/theme-install.php */ |
72 | - $tabs = apply_filters( 'install_themes_tabs', $tabs ); |
|
72 | + $tabs = apply_filters('install_themes_tabs', $tabs); |
|
73 | 73 | |
74 | 74 | /** |
75 | 75 | * Filters tabs not associated with a menu item on the Install Themes screen. |
@@ -79,20 +79,20 @@ discard block |
||
79 | 79 | * @param array $nonmenu_tabs The tabs that don't have a menu item on |
80 | 80 | * the Install Themes screen. |
81 | 81 | */ |
82 | - $nonmenu_tabs = apply_filters( 'install_themes_nonmenu_tabs', $nonmenu_tabs ); |
|
82 | + $nonmenu_tabs = apply_filters('install_themes_nonmenu_tabs', $nonmenu_tabs); |
|
83 | 83 | |
84 | 84 | // If a non-valid menu tab has been selected, And it's not a non-menu action. |
85 | - if ( empty( $tab ) || ( ! isset( $tabs[ $tab ] ) && ! in_array( $tab, (array) $nonmenu_tabs ) ) ) |
|
86 | - $tab = key( $tabs ); |
|
85 | + if (empty($tab) || ( ! isset($tabs[$tab]) && ! in_array($tab, (array) $nonmenu_tabs))) |
|
86 | + $tab = key($tabs); |
|
87 | 87 | |
88 | - $args = array( 'page' => $paged, 'per_page' => $per_page, 'fields' => $theme_field_defaults ); |
|
88 | + $args = array('page' => $paged, 'per_page' => $per_page, 'fields' => $theme_field_defaults); |
|
89 | 89 | |
90 | - switch ( $tab ) { |
|
90 | + switch ($tab) { |
|
91 | 91 | case 'search': |
92 | - $type = isset( $_REQUEST['type'] ) ? wp_unslash( $_REQUEST['type'] ) : 'term'; |
|
93 | - switch ( $type ) { |
|
92 | + $type = isset($_REQUEST['type']) ? wp_unslash($_REQUEST['type']) : 'term'; |
|
93 | + switch ($type) { |
|
94 | 94 | case 'tag': |
95 | - $args['tag'] = array_map( 'sanitize_key', $search_terms ); |
|
95 | + $args['tag'] = array_map('sanitize_key', $search_terms); |
|
96 | 96 | break; |
97 | 97 | case 'term': |
98 | 98 | $args['search'] = $search_string; |
@@ -102,13 +102,13 @@ discard block |
||
102 | 102 | break; |
103 | 103 | } |
104 | 104 | |
105 | - if ( ! empty( $this->features ) ) { |
|
105 | + if ( ! empty($this->features)) { |
|
106 | 106 | $args['tag'] = $this->features; |
107 | - $_REQUEST['s'] = implode( ',', $this->features ); |
|
107 | + $_REQUEST['s'] = implode(',', $this->features); |
|
108 | 108 | $_REQUEST['type'] = 'tag'; |
109 | 109 | } |
110 | 110 | |
111 | - add_action( 'install_themes_table_header', 'install_theme_search_form', 10, 0 ); |
|
111 | + add_action('install_themes_table_header', 'install_theme_search_form', 10, 0); |
|
112 | 112 | break; |
113 | 113 | |
114 | 114 | case 'featured': |
@@ -134,30 +134,30 @@ discard block |
||
134 | 134 | * |
135 | 135 | * @param array $args An array of themes API arguments. |
136 | 136 | */ |
137 | - $args = apply_filters( "install_themes_table_api_args_{$tab}", $args ); |
|
137 | + $args = apply_filters("install_themes_table_api_args_{$tab}", $args); |
|
138 | 138 | |
139 | - if ( ! $args ) |
|
139 | + if ( ! $args) |
|
140 | 140 | return; |
141 | 141 | |
142 | - $api = themes_api( 'query_themes', $args ); |
|
142 | + $api = themes_api('query_themes', $args); |
|
143 | 143 | |
144 | - if ( is_wp_error( $api ) ) |
|
145 | - wp_die( $api->get_error_message() . '</p> <p><a href="#" onclick="document.location.reload(); return false;">' . __( 'Try again' ) . '</a>' ); |
|
144 | + if (is_wp_error($api)) |
|
145 | + wp_die($api->get_error_message().'</p> <p><a href="#" onclick="document.location.reload(); return false;">'.__('Try again').'</a>'); |
|
146 | 146 | |
147 | 147 | $this->items = $api->themes; |
148 | 148 | |
149 | - $this->set_pagination_args( array( |
|
149 | + $this->set_pagination_args(array( |
|
150 | 150 | 'total_items' => $api->info['results'], |
151 | 151 | 'per_page' => $args['per_page'], |
152 | 152 | 'infinite_scroll' => true, |
153 | - ) ); |
|
153 | + )); |
|
154 | 154 | } |
155 | 155 | |
156 | 156 | /** |
157 | 157 | * @access public |
158 | 158 | */ |
159 | 159 | public function no_items() { |
160 | - _e( 'No themes match your request.' ); |
|
160 | + _e('No themes match your request.'); |
|
161 | 161 | } |
162 | 162 | |
163 | 163 | /** |
@@ -170,9 +170,9 @@ discard block |
||
170 | 170 | global $tabs, $tab; |
171 | 171 | |
172 | 172 | $display_tabs = array(); |
173 | - foreach ( (array) $tabs as $action => $text ) { |
|
174 | - $class = ( $action === $tab ) ? ' class="current"' : ''; |
|
175 | - $href = self_admin_url('theme-install.php?tab=' . $action); |
|
173 | + foreach ((array) $tabs as $action => $text) { |
|
174 | + $class = ($action === $tab) ? ' class="current"' : ''; |
|
175 | + $href = self_admin_url('theme-install.php?tab='.$action); |
|
176 | 176 | $display_tabs['theme-install-'.$action] = "<a href='$href'$class>$text</a>"; |
177 | 177 | } |
178 | 178 | |
@@ -183,7 +183,7 @@ discard block |
||
183 | 183 | * @access public |
184 | 184 | */ |
185 | 185 | public function display() { |
186 | - wp_nonce_field( "fetch-list-" . get_class( $this ), '_ajax_fetch_list_nonce' ); |
|
186 | + wp_nonce_field("fetch-list-".get_class($this), '_ajax_fetch_list_nonce'); |
|
187 | 187 | ?> |
188 | 188 | <div class="tablenav top themes"> |
189 | 189 | <div class="alignleft actions"> |
@@ -193,10 +193,10 @@ discard block |
||
193 | 193 | * |
194 | 194 | * @since 2.8.0 |
195 | 195 | */ |
196 | - do_action( 'install_themes_table_header' ); |
|
196 | + do_action('install_themes_table_header'); |
|
197 | 197 | ?> |
198 | 198 | </div> |
199 | - <?php $this->pagination( 'top' ); ?> |
|
199 | + <?php $this->pagination('top'); ?> |
|
200 | 200 | <br class="clear" /> |
201 | 201 | </div> |
202 | 202 | |
@@ -205,7 +205,7 @@ discard block |
||
205 | 205 | </div> |
206 | 206 | |
207 | 207 | <?php |
208 | - $this->tablenav( 'bottom' ); |
|
208 | + $this->tablenav('bottom'); |
|
209 | 209 | } |
210 | 210 | |
211 | 211 | /** |
@@ -213,10 +213,10 @@ discard block |
||
213 | 213 | */ |
214 | 214 | public function display_rows() { |
215 | 215 | $themes = $this->items; |
216 | - foreach ( $themes as $theme ) { |
|
216 | + foreach ($themes as $theme) { |
|
217 | 217 | ?> |
218 | 218 | <div class="available-theme installable-theme"><?php |
219 | - $this->single_row( $theme ); |
|
219 | + $this->single_row($theme); |
|
220 | 220 | ?></div> |
221 | 221 | <?php } // end foreach $theme_names |
222 | 222 | |
@@ -247,50 +247,50 @@ discard block |
||
247 | 247 | * @type string $download_link Theme ZIP download URL. |
248 | 248 | * } |
249 | 249 | */ |
250 | - public function single_row( $theme ) { |
|
250 | + public function single_row($theme) { |
|
251 | 251 | global $themes_allowedtags; |
252 | 252 | |
253 | - if ( empty( $theme ) ) |
|
253 | + if (empty($theme)) |
|
254 | 254 | return; |
255 | 255 | |
256 | - $name = wp_kses( $theme->name, $themes_allowedtags ); |
|
257 | - $author = wp_kses( $theme->author, $themes_allowedtags ); |
|
256 | + $name = wp_kses($theme->name, $themes_allowedtags); |
|
257 | + $author = wp_kses($theme->author, $themes_allowedtags); |
|
258 | 258 | |
259 | - $preview_title = sprintf( __('Preview “%s”'), $name ); |
|
260 | - $preview_url = add_query_arg( array( |
|
259 | + $preview_title = sprintf(__('Preview “%s”'), $name); |
|
260 | + $preview_url = add_query_arg(array( |
|
261 | 261 | 'tab' => 'theme-information', |
262 | 262 | 'theme' => $theme->slug, |
263 | - ), self_admin_url( 'theme-install.php' ) ); |
|
263 | + ), self_admin_url('theme-install.php')); |
|
264 | 264 | |
265 | 265 | $actions = array(); |
266 | 266 | |
267 | - $install_url = add_query_arg( array( |
|
267 | + $install_url = add_query_arg(array( |
|
268 | 268 | 'action' => 'install-theme', |
269 | 269 | 'theme' => $theme->slug, |
270 | - ), self_admin_url( 'update.php' ) ); |
|
270 | + ), self_admin_url('update.php')); |
|
271 | 271 | |
272 | - $update_url = add_query_arg( array( |
|
272 | + $update_url = add_query_arg(array( |
|
273 | 273 | 'action' => 'upgrade-theme', |
274 | 274 | 'theme' => $theme->slug, |
275 | - ), self_admin_url( 'update.php' ) ); |
|
275 | + ), self_admin_url('update.php')); |
|
276 | 276 | |
277 | - $status = $this->_get_theme_status( $theme ); |
|
277 | + $status = $this->_get_theme_status($theme); |
|
278 | 278 | |
279 | - switch ( $status ) { |
|
279 | + switch ($status) { |
|
280 | 280 | case 'update_available': |
281 | - $actions[] = '<a class="install-now" href="' . esc_url( wp_nonce_url( $update_url, 'upgrade-theme_' . $theme->slug ) ) . '" title="' . esc_attr( sprintf( __( 'Update to version %s' ), $theme->version ) ) . '">' . __( 'Update' ) . '</a>'; |
|
281 | + $actions[] = '<a class="install-now" href="'.esc_url(wp_nonce_url($update_url, 'upgrade-theme_'.$theme->slug)).'" title="'.esc_attr(sprintf(__('Update to version %s'), $theme->version)).'">'.__('Update').'</a>'; |
|
282 | 282 | break; |
283 | 283 | case 'newer_installed': |
284 | 284 | case 'latest_installed': |
285 | - $actions[] = '<span class="install-now" title="' . esc_attr__( 'This theme is already installed and is up to date' ) . '">' . _x( 'Installed', 'theme' ) . '</span>'; |
|
285 | + $actions[] = '<span class="install-now" title="'.esc_attr__('This theme is already installed and is up to date').'">'._x('Installed', 'theme').'</span>'; |
|
286 | 286 | break; |
287 | 287 | case 'install': |
288 | 288 | default: |
289 | - $actions[] = '<a class="install-now" href="' . esc_url( wp_nonce_url( $install_url, 'install-theme_' . $theme->slug ) ) . '" title="' . esc_attr( sprintf( __( 'Install %s' ), $name ) ) . '">' . __( 'Install Now' ) . '</a>'; |
|
289 | + $actions[] = '<a class="install-now" href="'.esc_url(wp_nonce_url($install_url, 'install-theme_'.$theme->slug)).'" title="'.esc_attr(sprintf(__('Install %s'), $name)).'">'.__('Install Now').'</a>'; |
|
290 | 290 | break; |
291 | 291 | } |
292 | 292 | |
293 | - $actions[] = '<a class="install-theme-preview" href="' . esc_url( $preview_url ) . '" title="' . esc_attr( sprintf( __( 'Preview %s' ), $name ) ) . '">' . __( 'Preview' ) . '</a>'; |
|
293 | + $actions[] = '<a class="install-theme-preview" href="'.esc_url($preview_url).'" title="'.esc_attr(sprintf(__('Preview %s'), $name)).'">'.__('Preview').'</a>'; |
|
294 | 294 | |
295 | 295 | /** |
296 | 296 | * Filters the install action links for a theme in the Install Themes list table. |
@@ -301,19 +301,19 @@ discard block |
||
301 | 301 | * links to Install Now, Preview, and Details. |
302 | 302 | * @param WP_Theme $theme Theme object. |
303 | 303 | */ |
304 | - $actions = apply_filters( 'theme_install_actions', $actions, $theme ); |
|
304 | + $actions = apply_filters('theme_install_actions', $actions, $theme); |
|
305 | 305 | |
306 | 306 | ?> |
307 | - <a class="screenshot install-theme-preview" href="<?php echo esc_url( $preview_url ); ?>" title="<?php echo esc_attr( $preview_title ); ?>"> |
|
308 | - <img src="<?php echo esc_url( $theme->screenshot_url ); ?>" width="150" alt="" /> |
|
307 | + <a class="screenshot install-theme-preview" href="<?php echo esc_url($preview_url); ?>" title="<?php echo esc_attr($preview_title); ?>"> |
|
308 | + <img src="<?php echo esc_url($theme->screenshot_url); ?>" width="150" alt="" /> |
|
309 | 309 | </a> |
310 | 310 | |
311 | 311 | <h3><?php echo $name; ?></h3> |
312 | - <div class="theme-author"><?php printf( __( 'By %s' ), $author ); ?></div> |
|
312 | + <div class="theme-author"><?php printf(__('By %s'), $author); ?></div> |
|
313 | 313 | |
314 | 314 | <div class="action-links"> |
315 | 315 | <ul> |
316 | - <?php foreach ( $actions as $action ): ?> |
|
316 | + <?php foreach ($actions as $action): ?> |
|
317 | 317 | <li><?php echo $action; ?></li> |
318 | 318 | <?php endforeach; ?> |
319 | 319 | <li class="hide-if-no-js"><a href="#" class="theme-detail"><?php _e('Details') ?></a></li> |
@@ -321,7 +321,7 @@ discard block |
||
321 | 321 | </div> |
322 | 322 | |
323 | 323 | <?php |
324 | - $this->install_theme_info( $theme ); |
|
324 | + $this->install_theme_info($theme); |
|
325 | 325 | } |
326 | 326 | |
327 | 327 | /** |
@@ -332,16 +332,16 @@ discard block |
||
332 | 332 | <div id="theme-installer" class="wp-full-overlay expanded"> |
333 | 333 | <div class="wp-full-overlay-sidebar"> |
334 | 334 | <div class="wp-full-overlay-header"> |
335 | - <a href="#" class="close-full-overlay button"><?php _e( 'Close' ); ?></a> |
|
335 | + <a href="#" class="close-full-overlay button"><?php _e('Close'); ?></a> |
|
336 | 336 | <span class="theme-install"></span> |
337 | 337 | </div> |
338 | 338 | <div class="wp-full-overlay-sidebar-content"> |
339 | 339 | <div class="install-theme-info"></div> |
340 | 340 | </div> |
341 | 341 | <div class="wp-full-overlay-footer"> |
342 | - <button type="button" class="collapse-sidebar button" aria-expanded="true" aria-label="<?php esc_attr_e( 'Collapse Sidebar' ); ?>"> |
|
342 | + <button type="button" class="collapse-sidebar button" aria-expanded="true" aria-label="<?php esc_attr_e('Collapse Sidebar'); ?>"> |
|
343 | 343 | <span class="collapse-sidebar-arrow"></span> |
344 | - <span class="collapse-sidebar-label"><?php _e( 'Collapse' ); ?></span> |
|
344 | + <span class="collapse-sidebar-label"><?php _e('Collapse'); ?></span> |
|
345 | 345 | </button> |
346 | 346 | </div> |
347 | 347 | </div> |
@@ -356,14 +356,14 @@ discard block |
||
356 | 356 | * |
357 | 357 | * @param object $theme - A WordPress.org Theme API object. |
358 | 358 | */ |
359 | - public function theme_installer_single( $theme ) { |
|
359 | + public function theme_installer_single($theme) { |
|
360 | 360 | ?> |
361 | 361 | <div id="theme-installer" class="wp-full-overlay single-theme"> |
362 | 362 | <div class="wp-full-overlay-sidebar"> |
363 | - <?php $this->install_theme_info( $theme ); ?> |
|
363 | + <?php $this->install_theme_info($theme); ?> |
|
364 | 364 | </div> |
365 | 365 | <div class="wp-full-overlay-main"> |
366 | - <iframe src="<?php echo esc_url( $theme->preview_url ); ?>"></iframe> |
|
366 | + <iframe src="<?php echo esc_url($theme->preview_url); ?>"></iframe> |
|
367 | 367 | </div> |
368 | 368 | </div> |
369 | 369 | <?php |
@@ -376,58 +376,58 @@ discard block |
||
376 | 376 | * |
377 | 377 | * @param object $theme - A WordPress.org Theme API object. |
378 | 378 | */ |
379 | - public function install_theme_info( $theme ) { |
|
379 | + public function install_theme_info($theme) { |
|
380 | 380 | global $themes_allowedtags; |
381 | 381 | |
382 | - if ( empty( $theme ) ) |
|
382 | + if (empty($theme)) |
|
383 | 383 | return; |
384 | 384 | |
385 | - $name = wp_kses( $theme->name, $themes_allowedtags ); |
|
386 | - $author = wp_kses( $theme->author, $themes_allowedtags ); |
|
385 | + $name = wp_kses($theme->name, $themes_allowedtags); |
|
386 | + $author = wp_kses($theme->author, $themes_allowedtags); |
|
387 | 387 | |
388 | - $install_url = add_query_arg( array( |
|
388 | + $install_url = add_query_arg(array( |
|
389 | 389 | 'action' => 'install-theme', |
390 | 390 | 'theme' => $theme->slug, |
391 | - ), self_admin_url( 'update.php' ) ); |
|
391 | + ), self_admin_url('update.php')); |
|
392 | 392 | |
393 | - $update_url = add_query_arg( array( |
|
393 | + $update_url = add_query_arg(array( |
|
394 | 394 | 'action' => 'upgrade-theme', |
395 | 395 | 'theme' => $theme->slug, |
396 | - ), self_admin_url( 'update.php' ) ); |
|
396 | + ), self_admin_url('update.php')); |
|
397 | 397 | |
398 | - $status = $this->_get_theme_status( $theme ); |
|
398 | + $status = $this->_get_theme_status($theme); |
|
399 | 399 | |
400 | 400 | ?> |
401 | 401 | <div class="install-theme-info"><?php |
402 | - switch ( $status ) { |
|
402 | + switch ($status) { |
|
403 | 403 | case 'update_available': |
404 | - echo '<a class="theme-install button button-primary" href="' . esc_url( wp_nonce_url( $update_url, 'upgrade-theme_' . $theme->slug ) ) . '" title="' . esc_attr( sprintf( __( 'Update to version %s' ), $theme->version ) ) . '">' . __( 'Update' ) . '</a>'; |
|
404 | + echo '<a class="theme-install button button-primary" href="'.esc_url(wp_nonce_url($update_url, 'upgrade-theme_'.$theme->slug)).'" title="'.esc_attr(sprintf(__('Update to version %s'), $theme->version)).'">'.__('Update').'</a>'; |
|
405 | 405 | break; |
406 | 406 | case 'newer_installed': |
407 | 407 | case 'latest_installed': |
408 | - echo '<span class="theme-install" title="' . esc_attr__( 'This theme is already installed and is up to date' ) . '">' . _x( 'Installed', 'theme' ) . '</span>'; |
|
408 | + echo '<span class="theme-install" title="'.esc_attr__('This theme is already installed and is up to date').'">'._x('Installed', 'theme').'</span>'; |
|
409 | 409 | break; |
410 | 410 | case 'install': |
411 | 411 | default: |
412 | - echo '<a class="theme-install button button-primary" href="' . esc_url( wp_nonce_url( $install_url, 'install-theme_' . $theme->slug ) ) . '">' . __( 'Install' ) . '</a>'; |
|
412 | + echo '<a class="theme-install button button-primary" href="'.esc_url(wp_nonce_url($install_url, 'install-theme_'.$theme->slug)).'">'.__('Install').'</a>'; |
|
413 | 413 | break; |
414 | 414 | } ?> |
415 | 415 | <h3 class="theme-name"><?php echo $name; ?></h3> |
416 | - <span class="theme-by"><?php printf( __( 'By %s' ), $author ); ?></span> |
|
417 | - <?php if ( isset( $theme->screenshot_url ) ): ?> |
|
418 | - <img class="theme-screenshot" src="<?php echo esc_url( $theme->screenshot_url ); ?>" alt="" /> |
|
416 | + <span class="theme-by"><?php printf(__('By %s'), $author); ?></span> |
|
417 | + <?php if (isset($theme->screenshot_url)): ?> |
|
418 | + <img class="theme-screenshot" src="<?php echo esc_url($theme->screenshot_url); ?>" alt="" /> |
|
419 | 419 | <?php endif; ?> |
420 | 420 | <div class="theme-details"> |
421 | - <?php wp_star_rating( array( 'rating' => $theme->rating, 'type' => 'percent', 'number' => $theme->num_ratings ) ); ?> |
|
421 | + <?php wp_star_rating(array('rating' => $theme->rating, 'type' => 'percent', 'number' => $theme->num_ratings)); ?> |
|
422 | 422 | <div class="theme-version"> |
423 | 423 | <strong><?php _e('Version:') ?> </strong> |
424 | - <?php echo wp_kses( $theme->version, $themes_allowedtags ); ?> |
|
424 | + <?php echo wp_kses($theme->version, $themes_allowedtags); ?> |
|
425 | 425 | </div> |
426 | 426 | <div class="theme-description"> |
427 | - <?php echo wp_kses( $theme->description, $themes_allowedtags ); ?> |
|
427 | + <?php echo wp_kses($theme->description, $themes_allowedtags); ?> |
|
428 | 428 | </div> |
429 | 429 | </div> |
430 | - <input class="theme-preview-url" type="hidden" value="<?php echo esc_url( $theme->preview_url ); ?>" /> |
|
430 | + <input class="theme-preview-url" type="hidden" value="<?php echo esc_url($theme->preview_url); ?>" /> |
|
431 | 431 | </div> |
432 | 432 | <?php |
433 | 433 | } |
@@ -443,9 +443,9 @@ discard block |
||
443 | 443 | * |
444 | 444 | * @param array $extra_args Unused. |
445 | 445 | */ |
446 | - public function _js_vars( $extra_args = array() ) { |
|
446 | + public function _js_vars($extra_args = array()) { |
|
447 | 447 | global $tab, $type; |
448 | - parent::_js_vars( compact( 'tab', 'type' ) ); |
|
448 | + parent::_js_vars(compact('tab', 'type')); |
|
449 | 449 | } |
450 | 450 | |
451 | 451 | /** |
@@ -457,14 +457,14 @@ discard block |
||
457 | 457 | * @param object $theme - A WordPress.org Theme API object. |
458 | 458 | * @return string Theme status. |
459 | 459 | */ |
460 | - private function _get_theme_status( $theme ) { |
|
460 | + private function _get_theme_status($theme) { |
|
461 | 461 | $status = 'install'; |
462 | 462 | |
463 | - $installed_theme = wp_get_theme( $theme->slug ); |
|
464 | - if ( $installed_theme->exists() ) { |
|
465 | - if ( version_compare( $installed_theme->get('Version'), $theme->version, '=' ) ) |
|
463 | + $installed_theme = wp_get_theme($theme->slug); |
|
464 | + if ($installed_theme->exists()) { |
|
465 | + if (version_compare($installed_theme->get('Version'), $theme->version, '=')) |
|
466 | 466 | $status = 'latest_installed'; |
467 | - elseif ( version_compare( $installed_theme->get('Version'), $theme->version, '>' ) ) |
|
467 | + elseif (version_compare($installed_theme->get('Version'), $theme->version, '>')) |
|
468 | 468 | $status = 'newer_installed'; |
469 | 469 | else |
470 | 470 | $status = 'update_available'; |
@@ -39,11 +39,13 @@ discard block |
||
39 | 39 | ) ); |
40 | 40 | |
41 | 41 | $status = 'all'; |
42 | - if ( isset( $_REQUEST['plugin_status'] ) && in_array( $_REQUEST['plugin_status'], array( 'active', 'inactive', 'recently_activated', 'upgrade', 'mustuse', 'dropins', 'search' ) ) ) |
|
43 | - $status = $_REQUEST['plugin_status']; |
|
42 | + if ( isset( $_REQUEST['plugin_status'] ) && in_array( $_REQUEST['plugin_status'], array( 'active', 'inactive', 'recently_activated', 'upgrade', 'mustuse', 'dropins', 'search' ) ) ) { |
|
43 | + $status = $_REQUEST['plugin_status']; |
|
44 | + } |
|
44 | 45 | |
45 | - if ( isset($_REQUEST['s']) ) |
|
46 | - $_SERVER['REQUEST_URI'] = add_query_arg('s', wp_unslash($_REQUEST['s']) ); |
|
46 | + if ( isset($_REQUEST['s']) ) { |
|
47 | + $_SERVER['REQUEST_URI'] = add_query_arg('s', wp_unslash($_REQUEST['s']) ); |
|
48 | + } |
|
47 | 49 | |
48 | 50 | $page = $this->get_pagenum(); |
49 | 51 | } |
@@ -123,8 +125,9 @@ discard block |
||
123 | 125 | } |
124 | 126 | |
125 | 127 | /** This action is documented in wp-admin/includes/class-wp-plugins-list-table.php */ |
126 | - if ( apply_filters( 'show_advanced_plugins', true, 'dropins' ) ) |
|
127 | - $plugins['dropins'] = get_dropins(); |
|
128 | + if ( apply_filters( 'show_advanced_plugins', true, 'dropins' ) ) { |
|
129 | + $plugins['dropins'] = get_dropins(); |
|
130 | + } |
|
128 | 131 | |
129 | 132 | if ( current_user_can( 'update_plugins' ) ) { |
130 | 133 | $current = get_site_transient( 'update_plugins' ); |
@@ -232,11 +235,13 @@ discard block |
||
232 | 235 | } |
233 | 236 | |
234 | 237 | $totals = array(); |
235 | - foreach ( $plugins as $type => $list ) |
|
236 | - $totals[ $type ] = count( $list ); |
|
238 | + foreach ( $plugins as $type => $list ) { |
|
239 | + $totals[ $type ] = count( $list ); |
|
240 | + } |
|
237 | 241 | |
238 | - if ( empty( $plugins[ $status ] ) && !in_array( $status, array( 'all', 'search' ) ) ) |
|
239 | - $status = 'all'; |
|
242 | + if ( empty( $plugins[ $status ] ) && !in_array( $status, array( 'all', 'search' ) ) ) { |
|
243 | + $status = 'all'; |
|
244 | + } |
|
240 | 245 | |
241 | 246 | $this->items = array(); |
242 | 247 | foreach ( $plugins[ $status ] as $plugin_file => $plugin_data ) { |
@@ -260,8 +265,9 @@ discard block |
||
260 | 265 | |
261 | 266 | $start = ( $page - 1 ) * $plugins_per_page; |
262 | 267 | |
263 | - if ( $total_this_page > $plugins_per_page ) |
|
264 | - $this->items = array_slice( $this->items, $start, $plugins_per_page ); |
|
268 | + if ( $total_this_page > $plugins_per_page ) { |
|
269 | + $this->items = array_slice( $this->items, $start, $plugins_per_page ); |
|
270 | + } |
|
265 | 271 | |
266 | 272 | $this->set_pagination_args( array( |
267 | 273 | 'total_items' => $total_this_page, |
@@ -300,8 +306,9 @@ discard block |
||
300 | 306 | $a = $plugin_a[$orderby]; |
301 | 307 | $b = $plugin_b[$orderby]; |
302 | 308 | |
303 | - if ( $a == $b ) |
|
304 | - return 0; |
|
309 | + if ( $a == $b ) { |
|
310 | + return 0; |
|
311 | + } |
|
305 | 312 | |
306 | 313 | if ( 'DESC' === $order ) { |
307 | 314 | return strcasecmp( $b, $a ); |
@@ -326,10 +333,11 @@ discard block |
||
326 | 333 | if ( ! is_multisite() && current_user_can( 'install_plugins' ) ) { |
327 | 334 | echo ' <a href="' . esc_url( admin_url( 'plugin-install.php?tab=search&s=' . urlencode( $s ) ) ) . '">' . __( 'Search for plugins in the WordPress Plugin Directory.' ) . '</a>'; |
328 | 335 | } |
329 | - } elseif ( ! empty( $plugins['all'] ) ) |
|
330 | - _e( 'No plugins found.' ); |
|
331 | - else |
|
332 | - _e( 'You do not appear to have any plugins available at this time.' ); |
|
336 | + } elseif ( ! empty( $plugins['all'] ) ) { |
|
337 | + _e( 'No plugins found.' ); |
|
338 | + } else { |
|
339 | + _e( 'You do not appear to have any plugins available at this time.' ); |
|
340 | + } |
|
333 | 341 | } |
334 | 342 | |
335 | 343 | /** |
@@ -365,8 +373,9 @@ discard block |
||
365 | 373 | |
366 | 374 | $status_links = array(); |
367 | 375 | foreach ( $totals as $type => $count ) { |
368 | - if ( !$count ) |
|
369 | - continue; |
|
376 | + if ( !$count ) { |
|
377 | + continue; |
|
378 | + } |
|
370 | 379 | |
371 | 380 | switch ( $type ) { |
372 | 381 | case 'all': |
@@ -414,17 +423,21 @@ discard block |
||
414 | 423 | |
415 | 424 | $actions = array(); |
416 | 425 | |
417 | - if ( 'active' != $status ) |
|
418 | - $actions['activate-selected'] = $this->screen->in_admin( 'network' ) ? __( 'Network Activate' ) : __( 'Activate' ); |
|
426 | + if ( 'active' != $status ) { |
|
427 | + $actions['activate-selected'] = $this->screen->in_admin( 'network' ) ? __( 'Network Activate' ) : __( 'Activate' ); |
|
428 | + } |
|
419 | 429 | |
420 | - if ( 'inactive' != $status && 'recent' != $status ) |
|
421 | - $actions['deactivate-selected'] = $this->screen->in_admin( 'network' ) ? __( 'Network Deactivate' ) : __( 'Deactivate' ); |
|
430 | + if ( 'inactive' != $status && 'recent' != $status ) { |
|
431 | + $actions['deactivate-selected'] = $this->screen->in_admin( 'network' ) ? __( 'Network Deactivate' ) : __( 'Deactivate' ); |
|
432 | + } |
|
422 | 433 | |
423 | 434 | if ( !is_multisite() || $this->screen->in_admin( 'network' ) ) { |
424 | - if ( current_user_can( 'update_plugins' ) ) |
|
425 | - $actions['update-selected'] = __( 'Update' ); |
|
426 | - if ( current_user_can( 'delete_plugins' ) && ( 'active' != $status ) ) |
|
427 | - $actions['delete-selected'] = __( 'Delete' ); |
|
435 | + if ( current_user_can( 'update_plugins' ) ) { |
|
436 | + $actions['update-selected'] = __( 'Update' ); |
|
437 | + } |
|
438 | + if ( current_user_can( 'delete_plugins' ) && ( 'active' != $status ) ) { |
|
439 | + $actions['delete-selected'] = __( 'Delete' ); |
|
440 | + } |
|
428 | 441 | } |
429 | 442 | |
430 | 443 | return $actions; |
@@ -437,8 +450,9 @@ discard block |
||
437 | 450 | public function bulk_actions( $which = '' ) { |
438 | 451 | global $status; |
439 | 452 | |
440 | - if ( in_array( $status, array( 'mustuse', 'dropins' ) ) ) |
|
441 | - return; |
|
453 | + if ( in_array( $status, array( 'mustuse', 'dropins' ) ) ) { |
|
454 | + return; |
|
455 | + } |
|
442 | 456 | |
443 | 457 | parent::bulk_actions( $which ); |
444 | 458 | } |
@@ -450,8 +464,9 @@ discard block |
||
450 | 464 | protected function extra_tablenav( $which ) { |
451 | 465 | global $status; |
452 | 466 | |
453 | - if ( ! in_array($status, array('recently_activated', 'mustuse', 'dropins') ) ) |
|
454 | - return; |
|
467 | + if ( ! in_array($status, array('recently_activated', 'mustuse', 'dropins') ) ) { |
|
468 | + return; |
|
469 | + } |
|
455 | 470 | |
456 | 471 | echo '<div class="alignleft actions">'; |
457 | 472 | |
@@ -475,8 +490,9 @@ discard block |
||
475 | 490 | * @return string |
476 | 491 | */ |
477 | 492 | public function current_action() { |
478 | - if ( isset($_POST['clear-recent-list']) ) |
|
479 | - return 'clear-recent-list'; |
|
493 | + if ( isset($_POST['clear-recent-list']) ) { |
|
494 | + return 'clear-recent-list'; |
|
495 | + } |
|
480 | 496 | |
481 | 497 | return parent::current_action(); |
482 | 498 | } |
@@ -488,11 +504,13 @@ discard block |
||
488 | 504 | public function display_rows() { |
489 | 505 | global $status; |
490 | 506 | |
491 | - if ( is_multisite() && ! $this->screen->in_admin( 'network' ) && in_array( $status, array( 'mustuse', 'dropins' ) ) ) |
|
492 | - return; |
|
507 | + if ( is_multisite() && ! $this->screen->in_admin( 'network' ) && in_array( $status, array( 'mustuse', 'dropins' ) ) ) { |
|
508 | + return; |
|
509 | + } |
|
493 | 510 | |
494 | - foreach ( $this->items as $plugin_file => $plugin_data ) |
|
495 | - $this->single_row( array( $plugin_file, $plugin_data ) ); |
|
511 | + foreach ( $this->items as $plugin_file => $plugin_data ) { |
|
512 | + $this->single_row( array( $plugin_file, $plugin_data ) ); |
|
513 | + } |
|
496 | 514 | } |
497 | 515 | |
498 | 516 | /** |
@@ -528,8 +546,9 @@ discard block |
||
528 | 546 | } elseif ( 'dropins' === $context ) { |
529 | 547 | $dropins = _get_dropins(); |
530 | 548 | $plugin_name = $plugin_file; |
531 | - if ( $plugin_file != $plugin_data['Name'] ) |
|
532 | - $plugin_name .= '<br/>' . $plugin_data['Name']; |
|
549 | + if ( $plugin_file != $plugin_data['Name'] ) { |
|
550 | + $plugin_name .= '<br/>' . $plugin_data['Name']; |
|
551 | + } |
|
533 | 552 | if ( true === ( $dropins[ $plugin_file ][1] ) ) { // Doesn't require a constant |
534 | 553 | $is_active = true; |
535 | 554 | $description = '<p><strong>' . $dropins[ $plugin_file ][0] . '</strong></p>'; |
@@ -545,8 +564,9 @@ discard block |
||
545 | 564 | '<code>wp-config.php</code>' |
546 | 565 | ) . '</p>'; |
547 | 566 | } |
548 | - if ( $plugin_data['Description'] ) |
|
549 | - $description .= '<p>' . $plugin_data['Description'] . '</p>'; |
|
567 | + if ( $plugin_data['Description'] ) { |
|
568 | + $description .= '<p>' . $plugin_data['Description'] . '</p>'; |
|
569 | + } |
|
550 | 570 | } else { |
551 | 571 | if ( $screen->in_admin( 'network' ) ) { |
552 | 572 | $is_active = is_plugin_active_for_network( $plugin_file ); |
@@ -696,8 +716,9 @@ discard block |
||
696 | 716 | $plugin_name = $plugin_data['Name']; |
697 | 717 | } |
698 | 718 | |
699 | - if ( ! empty( $totals['upgrade'] ) && ! empty( $plugin_data['update'] ) ) |
|
700 | - $class .= ' update'; |
|
719 | + if ( ! empty( $totals['upgrade'] ) && ! empty( $plugin_data['update'] ) ) { |
|
720 | + $class .= ' update'; |
|
721 | + } |
|
701 | 722 | |
702 | 723 | $plugin_slug = isset( $plugin_data['slug'] ) ? $plugin_data['slug'] : sanitize_title( $plugin_name ); |
703 | 724 | printf( '<tr class="%s" data-slug="%s" data-plugin="%s">', |
@@ -731,12 +752,14 @@ discard block |
||
731 | 752 | <div class='$class second plugin-version-author-uri'>"; |
732 | 753 | |
733 | 754 | $plugin_meta = array(); |
734 | - if ( !empty( $plugin_data['Version'] ) ) |
|
735 | - $plugin_meta[] = sprintf( __( 'Version %s' ), $plugin_data['Version'] ); |
|
755 | + if ( !empty( $plugin_data['Version'] ) ) { |
|
756 | + $plugin_meta[] = sprintf( __( 'Version %s' ), $plugin_data['Version'] ); |
|
757 | + } |
|
736 | 758 | if ( !empty( $plugin_data['Author'] ) ) { |
737 | 759 | $author = $plugin_data['Author']; |
738 | - if ( !empty( $plugin_data['AuthorURI'] ) ) |
|
739 | - $author = '<a href="' . $plugin_data['AuthorURI'] . '">' . $plugin_data['Author'] . '</a>'; |
|
760 | + if ( !empty( $plugin_data['AuthorURI'] ) ) { |
|
761 | + $author = '<a href="' . $plugin_data['AuthorURI'] . '">' . $plugin_data['Author'] . '</a>'; |
|
762 | + } |
|
740 | 763 | $plugin_meta[] = sprintf( __( 'By %s' ), $author ); |
741 | 764 | } |
742 | 765 |
@@ -30,20 +30,20 @@ discard block |
||
30 | 30 | * |
31 | 31 | * @param array $args An associative array of arguments. |
32 | 32 | */ |
33 | - public function __construct( $args = array() ) { |
|
33 | + public function __construct($args = array()) { |
|
34 | 34 | global $status, $page; |
35 | 35 | |
36 | - parent::__construct( array( |
|
36 | + parent::__construct(array( |
|
37 | 37 | 'plural' => 'plugins', |
38 | - 'screen' => isset( $args['screen'] ) ? $args['screen'] : null, |
|
39 | - ) ); |
|
38 | + 'screen' => isset($args['screen']) ? $args['screen'] : null, |
|
39 | + )); |
|
40 | 40 | |
41 | 41 | $status = 'all'; |
42 | - if ( isset( $_REQUEST['plugin_status'] ) && in_array( $_REQUEST['plugin_status'], array( 'active', 'inactive', 'recently_activated', 'upgrade', 'mustuse', 'dropins', 'search' ) ) ) |
|
42 | + if (isset($_REQUEST['plugin_status']) && in_array($_REQUEST['plugin_status'], array('active', 'inactive', 'recently_activated', 'upgrade', 'mustuse', 'dropins', 'search'))) |
|
43 | 43 | $status = $_REQUEST['plugin_status']; |
44 | 44 | |
45 | - if ( isset($_REQUEST['s']) ) |
|
46 | - $_SERVER['REQUEST_URI'] = add_query_arg('s', wp_unslash($_REQUEST['s']) ); |
|
45 | + if (isset($_REQUEST['s'])) |
|
46 | + $_SERVER['REQUEST_URI'] = add_query_arg('s', wp_unslash($_REQUEST['s'])); |
|
47 | 47 | |
48 | 48 | $page = $this->get_pagenum(); |
49 | 49 | } |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | * @return array |
53 | 53 | */ |
54 | 54 | protected function get_table_classes() { |
55 | - return array( 'widefat', $this->_args['plural'] ); |
|
55 | + return array('widefat', $this->_args['plural']); |
|
56 | 56 | } |
57 | 57 | |
58 | 58 | /** |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | public function prepare_items() { |
76 | 76 | global $status, $plugins, $totals, $page, $orderby, $order, $s; |
77 | 77 | |
78 | - wp_reset_vars( array( 'orderby', 'order' ) ); |
|
78 | + wp_reset_vars(array('orderby', 'order')); |
|
79 | 79 | |
80 | 80 | /** |
81 | 81 | * Filters the full array of plugins to list in the Plugins list table. |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | * |
87 | 87 | * @param array $all_plugins An array of plugins to display in the list table. |
88 | 88 | */ |
89 | - $all_plugins = apply_filters( 'all_plugins', get_plugins() ); |
|
89 | + $all_plugins = apply_filters('all_plugins', get_plugins()); |
|
90 | 90 | |
91 | 91 | $plugins = array( |
92 | 92 | 'all' => $all_plugins, |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | |
102 | 102 | $screen = $this->screen; |
103 | 103 | |
104 | - if ( ! is_multisite() || ( $screen->in_admin( 'network' ) && current_user_can( 'manage_network_plugins' ) ) ) { |
|
104 | + if ( ! is_multisite() || ($screen->in_admin('network') && current_user_can('manage_network_plugins'))) { |
|
105 | 105 | |
106 | 106 | /** |
107 | 107 | * Filters whether to display the advanced plugins list table. |
@@ -118,27 +118,27 @@ discard block |
||
118 | 118 | * plugin type. Default true. |
119 | 119 | * @param string $type The plugin type. Accepts 'mustuse', 'dropins'. |
120 | 120 | */ |
121 | - if ( apply_filters( 'show_advanced_plugins', true, 'mustuse' ) ) { |
|
121 | + if (apply_filters('show_advanced_plugins', true, 'mustuse')) { |
|
122 | 122 | $plugins['mustuse'] = get_mu_plugins(); |
123 | 123 | } |
124 | 124 | |
125 | 125 | /** This action is documented in wp-admin/includes/class-wp-plugins-list-table.php */ |
126 | - if ( apply_filters( 'show_advanced_plugins', true, 'dropins' ) ) |
|
126 | + if (apply_filters('show_advanced_plugins', true, 'dropins')) |
|
127 | 127 | $plugins['dropins'] = get_dropins(); |
128 | 128 | |
129 | - if ( current_user_can( 'update_plugins' ) ) { |
|
130 | - $current = get_site_transient( 'update_plugins' ); |
|
131 | - foreach ( (array) $plugins['all'] as $plugin_file => $plugin_data ) { |
|
132 | - if ( isset( $current->response[ $plugin_file ] ) ) { |
|
133 | - $plugins['all'][ $plugin_file ]['update'] = true; |
|
134 | - $plugins['upgrade'][ $plugin_file ] = $plugins['all'][ $plugin_file ]; |
|
129 | + if (current_user_can('update_plugins')) { |
|
130 | + $current = get_site_transient('update_plugins'); |
|
131 | + foreach ((array) $plugins['all'] as $plugin_file => $plugin_data) { |
|
132 | + if (isset($current->response[$plugin_file])) { |
|
133 | + $plugins['all'][$plugin_file]['update'] = true; |
|
134 | + $plugins['upgrade'][$plugin_file] = $plugins['all'][$plugin_file]; |
|
135 | 135 | } |
136 | 136 | } |
137 | 137 | } |
138 | 138 | } |
139 | 139 | |
140 | - if ( ! $screen->in_admin( 'network' ) ) { |
|
141 | - $show = current_user_can( 'manage_network_plugins' ); |
|
140 | + if ( ! $screen->in_admin('network')) { |
|
141 | + $show = current_user_can('manage_network_plugins'); |
|
142 | 142 | /** |
143 | 143 | * Filters whether to display network-active plugins alongside plugins active for the current site. |
144 | 144 | * |
@@ -152,131 +152,131 @@ discard block |
||
152 | 152 | * @param bool $show Whether to show network-active plugins. Default is whether the current |
153 | 153 | * user can manage network plugins (ie. a Super Admin). |
154 | 154 | */ |
155 | - $show_network_active = apply_filters( 'show_network_active_plugins', $show ); |
|
155 | + $show_network_active = apply_filters('show_network_active_plugins', $show); |
|
156 | 156 | } |
157 | 157 | |
158 | - set_transient( 'plugin_slugs', array_keys( $plugins['all'] ), DAY_IN_SECONDS ); |
|
158 | + set_transient('plugin_slugs', array_keys($plugins['all']), DAY_IN_SECONDS); |
|
159 | 159 | |
160 | - if ( $screen->in_admin( 'network' ) ) { |
|
161 | - $recently_activated = get_site_option( 'recently_activated', array() ); |
|
160 | + if ($screen->in_admin('network')) { |
|
161 | + $recently_activated = get_site_option('recently_activated', array()); |
|
162 | 162 | } else { |
163 | - $recently_activated = get_option( 'recently_activated', array() ); |
|
163 | + $recently_activated = get_option('recently_activated', array()); |
|
164 | 164 | } |
165 | 165 | |
166 | - foreach ( $recently_activated as $key => $time ) { |
|
167 | - if ( $time + WEEK_IN_SECONDS < time() ) { |
|
168 | - unset( $recently_activated[$key] ); |
|
166 | + foreach ($recently_activated as $key => $time) { |
|
167 | + if ($time + WEEK_IN_SECONDS < time()) { |
|
168 | + unset($recently_activated[$key]); |
|
169 | 169 | } |
170 | 170 | } |
171 | 171 | |
172 | - if ( $screen->in_admin( 'network' ) ) { |
|
173 | - update_site_option( 'recently_activated', $recently_activated ); |
|
172 | + if ($screen->in_admin('network')) { |
|
173 | + update_site_option('recently_activated', $recently_activated); |
|
174 | 174 | } else { |
175 | - update_option( 'recently_activated', $recently_activated ); |
|
175 | + update_option('recently_activated', $recently_activated); |
|
176 | 176 | } |
177 | 177 | |
178 | - $plugin_info = get_site_transient( 'update_plugins' ); |
|
178 | + $plugin_info = get_site_transient('update_plugins'); |
|
179 | 179 | |
180 | - foreach ( (array) $plugins['all'] as $plugin_file => $plugin_data ) { |
|
180 | + foreach ((array) $plugins['all'] as $plugin_file => $plugin_data) { |
|
181 | 181 | // Extra info if known. array_merge() ensures $plugin_data has precedence if keys collide. |
182 | - if ( isset( $plugin_info->response[ $plugin_file ] ) ) { |
|
183 | - $plugins['all'][ $plugin_file ] = $plugin_data = array_merge( (array) $plugin_info->response[ $plugin_file ], $plugin_data ); |
|
182 | + if (isset($plugin_info->response[$plugin_file])) { |
|
183 | + $plugins['all'][$plugin_file] = $plugin_data = array_merge((array) $plugin_info->response[$plugin_file], $plugin_data); |
|
184 | 184 | // Make sure that $plugins['upgrade'] also receives the extra info since it is used on ?plugin_status=upgrade |
185 | - if ( isset( $plugins['upgrade'][ $plugin_file ] ) ) { |
|
186 | - $plugins['upgrade'][ $plugin_file ] = $plugin_data = array_merge( (array) $plugin_info->response[ $plugin_file ], $plugin_data ); |
|
185 | + if (isset($plugins['upgrade'][$plugin_file])) { |
|
186 | + $plugins['upgrade'][$plugin_file] = $plugin_data = array_merge((array) $plugin_info->response[$plugin_file], $plugin_data); |
|
187 | 187 | } |
188 | 188 | |
189 | - } elseif ( isset( $plugin_info->no_update[ $plugin_file ] ) ) { |
|
190 | - $plugins['all'][ $plugin_file ] = $plugin_data = array_merge( (array) $plugin_info->no_update[ $plugin_file ], $plugin_data ); |
|
189 | + } elseif (isset($plugin_info->no_update[$plugin_file])) { |
|
190 | + $plugins['all'][$plugin_file] = $plugin_data = array_merge((array) $plugin_info->no_update[$plugin_file], $plugin_data); |
|
191 | 191 | // Make sure that $plugins['upgrade'] also receives the extra info since it is used on ?plugin_status=upgrade |
192 | - if ( isset( $plugins['upgrade'][ $plugin_file ] ) ) { |
|
193 | - $plugins['upgrade'][ $plugin_file ] = $plugin_data = array_merge( (array) $plugin_info->no_update[ $plugin_file ], $plugin_data ); |
|
192 | + if (isset($plugins['upgrade'][$plugin_file])) { |
|
193 | + $plugins['upgrade'][$plugin_file] = $plugin_data = array_merge((array) $plugin_info->no_update[$plugin_file], $plugin_data); |
|
194 | 194 | } |
195 | 195 | } |
196 | 196 | |
197 | 197 | // Filter into individual sections |
198 | - if ( is_multisite() && ! $screen->in_admin( 'network' ) && is_network_only_plugin( $plugin_file ) && ! is_plugin_active( $plugin_file ) ) { |
|
199 | - if ( $show_network_active ) { |
|
198 | + if (is_multisite() && ! $screen->in_admin('network') && is_network_only_plugin($plugin_file) && ! is_plugin_active($plugin_file)) { |
|
199 | + if ($show_network_active) { |
|
200 | 200 | // On the non-network screen, show inactive network-only plugins if allowed |
201 | - $plugins['inactive'][ $plugin_file ] = $plugin_data; |
|
201 | + $plugins['inactive'][$plugin_file] = $plugin_data; |
|
202 | 202 | } else { |
203 | 203 | // On the non-network screen, filter out network-only plugins as long as they're not individually active |
204 | - unset( $plugins['all'][ $plugin_file ] ); |
|
204 | + unset($plugins['all'][$plugin_file]); |
|
205 | 205 | } |
206 | - } elseif ( ! $screen->in_admin( 'network' ) && is_plugin_active_for_network( $plugin_file ) ) { |
|
207 | - if ( $show_network_active ) { |
|
206 | + } elseif ( ! $screen->in_admin('network') && is_plugin_active_for_network($plugin_file)) { |
|
207 | + if ($show_network_active) { |
|
208 | 208 | // On the non-network screen, show network-active plugins if allowed |
209 | - $plugins['active'][ $plugin_file ] = $plugin_data; |
|
209 | + $plugins['active'][$plugin_file] = $plugin_data; |
|
210 | 210 | } else { |
211 | 211 | // On the non-network screen, filter out network-active plugins |
212 | - unset( $plugins['all'][ $plugin_file ] ); |
|
212 | + unset($plugins['all'][$plugin_file]); |
|
213 | 213 | } |
214 | - } elseif ( ( ! $screen->in_admin( 'network' ) && is_plugin_active( $plugin_file ) ) |
|
215 | - || ( $screen->in_admin( 'network' ) && is_plugin_active_for_network( $plugin_file ) ) ) { |
|
214 | + } elseif (( ! $screen->in_admin('network') && is_plugin_active($plugin_file)) |
|
215 | + || ($screen->in_admin('network') && is_plugin_active_for_network($plugin_file))) { |
|
216 | 216 | // On the non-network screen, populate the active list with plugins that are individually activated |
217 | 217 | // On the network-admin screen, populate the active list with plugins that are network activated |
218 | - $plugins['active'][ $plugin_file ] = $plugin_data; |
|
218 | + $plugins['active'][$plugin_file] = $plugin_data; |
|
219 | 219 | } else { |
220 | - if ( isset( $recently_activated[ $plugin_file ] ) ) { |
|
220 | + if (isset($recently_activated[$plugin_file])) { |
|
221 | 221 | // Populate the recently activated list with plugins that have been recently activated |
222 | - $plugins['recently_activated'][ $plugin_file ] = $plugin_data; |
|
222 | + $plugins['recently_activated'][$plugin_file] = $plugin_data; |
|
223 | 223 | } |
224 | 224 | // Populate the inactive list with plugins that aren't activated |
225 | - $plugins['inactive'][ $plugin_file ] = $plugin_data; |
|
225 | + $plugins['inactive'][$plugin_file] = $plugin_data; |
|
226 | 226 | } |
227 | 227 | } |
228 | 228 | |
229 | - if ( strlen( $s ) ) { |
|
229 | + if (strlen($s)) { |
|
230 | 230 | $status = 'search'; |
231 | - $plugins['search'] = array_filter( $plugins['all'], array( $this, '_search_callback' ) ); |
|
231 | + $plugins['search'] = array_filter($plugins['all'], array($this, '_search_callback')); |
|
232 | 232 | } |
233 | 233 | |
234 | 234 | $totals = array(); |
235 | - foreach ( $plugins as $type => $list ) |
|
236 | - $totals[ $type ] = count( $list ); |
|
235 | + foreach ($plugins as $type => $list) |
|
236 | + $totals[$type] = count($list); |
|
237 | 237 | |
238 | - if ( empty( $plugins[ $status ] ) && !in_array( $status, array( 'all', 'search' ) ) ) |
|
238 | + if (empty($plugins[$status]) && ! in_array($status, array('all', 'search'))) |
|
239 | 239 | $status = 'all'; |
240 | 240 | |
241 | 241 | $this->items = array(); |
242 | - foreach ( $plugins[ $status ] as $plugin_file => $plugin_data ) { |
|
242 | + foreach ($plugins[$status] as $plugin_file => $plugin_data) { |
|
243 | 243 | // Translate, Don't Apply Markup, Sanitize HTML |
244 | - $this->items[$plugin_file] = _get_plugin_data_markup_translate( $plugin_file, $plugin_data, false, true ); |
|
244 | + $this->items[$plugin_file] = _get_plugin_data_markup_translate($plugin_file, $plugin_data, false, true); |
|
245 | 245 | } |
246 | 246 | |
247 | - $total_this_page = $totals[ $status ]; |
|
247 | + $total_this_page = $totals[$status]; |
|
248 | 248 | |
249 | 249 | $js_plugins = array(); |
250 | - foreach ( $plugins as $key => $list ) { |
|
251 | - $js_plugins[ $key ] = array_keys( (array) $list ); |
|
250 | + foreach ($plugins as $key => $list) { |
|
251 | + $js_plugins[$key] = array_keys((array) $list); |
|
252 | 252 | } |
253 | 253 | |
254 | - wp_localize_script( 'updates', '_wpUpdatesItemCounts', array( |
|
254 | + wp_localize_script('updates', '_wpUpdatesItemCounts', array( |
|
255 | 255 | 'plugins' => $js_plugins, |
256 | 256 | 'totals' => wp_get_update_data(), |
257 | - ) ); |
|
257 | + )); |
|
258 | 258 | |
259 | - if ( ! $orderby ) { |
|
259 | + if ( ! $orderby) { |
|
260 | 260 | $orderby = 'Name'; |
261 | 261 | } else { |
262 | - $orderby = ucfirst( $orderby ); |
|
262 | + $orderby = ucfirst($orderby); |
|
263 | 263 | } |
264 | 264 | |
265 | - $order = strtoupper( $order ); |
|
265 | + $order = strtoupper($order); |
|
266 | 266 | |
267 | - uasort( $this->items, array( $this, '_order_callback' ) ); |
|
267 | + uasort($this->items, array($this, '_order_callback')); |
|
268 | 268 | |
269 | - $plugins_per_page = $this->get_items_per_page( str_replace( '-', '_', $screen->id . '_per_page' ), 999 ); |
|
269 | + $plugins_per_page = $this->get_items_per_page(str_replace('-', '_', $screen->id.'_per_page'), 999); |
|
270 | 270 | |
271 | - $start = ( $page - 1 ) * $plugins_per_page; |
|
271 | + $start = ($page - 1) * $plugins_per_page; |
|
272 | 272 | |
273 | - if ( $total_this_page > $plugins_per_page ) |
|
274 | - $this->items = array_slice( $this->items, $start, $plugins_per_page ); |
|
273 | + if ($total_this_page > $plugins_per_page) |
|
274 | + $this->items = array_slice($this->items, $start, $plugins_per_page); |
|
275 | 275 | |
276 | - $this->set_pagination_args( array( |
|
276 | + $this->set_pagination_args(array( |
|
277 | 277 | 'total_items' => $total_this_page, |
278 | 278 | 'per_page' => $plugins_per_page, |
279 | - ) ); |
|
279 | + )); |
|
280 | 280 | } |
281 | 281 | |
282 | 282 | /** |
@@ -285,11 +285,11 @@ discard block |
||
285 | 285 | * @param array $plugin |
286 | 286 | * @return bool |
287 | 287 | */ |
288 | - public function _search_callback( $plugin ) { |
|
288 | + public function _search_callback($plugin) { |
|
289 | 289 | global $s; |
290 | 290 | |
291 | - foreach ( $plugin as $value ) { |
|
292 | - if ( is_string( $value ) && false !== stripos( strip_tags( $value ), urldecode( $s ) ) ) { |
|
291 | + foreach ($plugin as $value) { |
|
292 | + if (is_string($value) && false !== stripos(strip_tags($value), urldecode($s))) { |
|
293 | 293 | return true; |
294 | 294 | } |
295 | 295 | } |
@@ -304,19 +304,19 @@ discard block |
||
304 | 304 | * @param array $plugin_b |
305 | 305 | * @return int |
306 | 306 | */ |
307 | - public function _order_callback( $plugin_a, $plugin_b ) { |
|
307 | + public function _order_callback($plugin_a, $plugin_b) { |
|
308 | 308 | global $orderby, $order; |
309 | 309 | |
310 | 310 | $a = $plugin_a[$orderby]; |
311 | 311 | $b = $plugin_b[$orderby]; |
312 | 312 | |
313 | - if ( $a == $b ) |
|
313 | + if ($a == $b) |
|
314 | 314 | return 0; |
315 | 315 | |
316 | - if ( 'DESC' === $order ) { |
|
317 | - return strcasecmp( $b, $a ); |
|
316 | + if ('DESC' === $order) { |
|
317 | + return strcasecmp($b, $a); |
|
318 | 318 | } else { |
319 | - return strcasecmp( $a, $b ); |
|
319 | + return strcasecmp($a, $b); |
|
320 | 320 | } |
321 | 321 | } |
322 | 322 | |
@@ -327,19 +327,19 @@ discard block |
||
327 | 327 | public function no_items() { |
328 | 328 | global $plugins; |
329 | 329 | |
330 | - if ( ! empty( $_REQUEST['s'] ) ) { |
|
331 | - $s = esc_html( wp_unslash( $_REQUEST['s'] ) ); |
|
330 | + if ( ! empty($_REQUEST['s'])) { |
|
331 | + $s = esc_html(wp_unslash($_REQUEST['s'])); |
|
332 | 332 | |
333 | - printf( __( 'No plugins found for “%s”.' ), $s ); |
|
333 | + printf(__('No plugins found for “%s”.'), $s); |
|
334 | 334 | |
335 | 335 | // We assume that somebody who can install plugins in multisite is experienced enough to not need this helper link. |
336 | - if ( ! is_multisite() && current_user_can( 'install_plugins' ) ) { |
|
337 | - echo ' <a href="' . esc_url( admin_url( 'plugin-install.php?tab=search&s=' . urlencode( $s ) ) ) . '">' . __( 'Search for plugins in the WordPress Plugin Directory.' ) . '</a>'; |
|
336 | + if ( ! is_multisite() && current_user_can('install_plugins')) { |
|
337 | + echo ' <a href="'.esc_url(admin_url('plugin-install.php?tab=search&s='.urlencode($s))).'">'.__('Search for plugins in the WordPress Plugin Directory.').'</a>'; |
|
338 | 338 | } |
339 | - } elseif ( ! empty( $plugins['all'] ) ) |
|
340 | - _e( 'No plugins found.' ); |
|
339 | + } elseif ( ! empty($plugins['all'])) |
|
340 | + _e('No plugins found.'); |
|
341 | 341 | else |
342 | - _e( 'You do not appear to have any plugins available at this time.' ); |
|
342 | + _e('You do not appear to have any plugins available at this time.'); |
|
343 | 343 | } |
344 | 344 | |
345 | 345 | /** |
@@ -351,24 +351,24 @@ discard block |
||
351 | 351 | * @param string $text The 'submit' button label. |
352 | 352 | * @param string $input_id ID attribute value for the search input field. |
353 | 353 | */ |
354 | - public function search_box( $text, $input_id ) { |
|
355 | - if ( empty( $_REQUEST['s'] ) && ! $this->has_items() ) { |
|
354 | + public function search_box($text, $input_id) { |
|
355 | + if (empty($_REQUEST['s']) && ! $this->has_items()) { |
|
356 | 356 | return; |
357 | 357 | } |
358 | 358 | |
359 | - $input_id = $input_id . '-search-input'; |
|
359 | + $input_id = $input_id.'-search-input'; |
|
360 | 360 | |
361 | - if ( ! empty( $_REQUEST['orderby'] ) ) { |
|
362 | - echo '<input type="hidden" name="orderby" value="' . esc_attr( $_REQUEST['orderby'] ) . '" />'; |
|
361 | + if ( ! empty($_REQUEST['orderby'])) { |
|
362 | + echo '<input type="hidden" name="orderby" value="'.esc_attr($_REQUEST['orderby']).'" />'; |
|
363 | 363 | } |
364 | - if ( ! empty( $_REQUEST['order'] ) ) { |
|
365 | - echo '<input type="hidden" name="order" value="' . esc_attr( $_REQUEST['order'] ) . '" />'; |
|
364 | + if ( ! empty($_REQUEST['order'])) { |
|
365 | + echo '<input type="hidden" name="order" value="'.esc_attr($_REQUEST['order']).'" />'; |
|
366 | 366 | } |
367 | 367 | ?> |
368 | 368 | <p class="search-box"> |
369 | - <label class="screen-reader-text" for="<?php echo esc_attr( $input_id ); ?>"><?php echo $text; ?>:</label> |
|
370 | - <input type="search" id="<?php echo esc_attr( $input_id ); ?>" class="wp-filter-search" name="s" value="<?php _admin_search_query(); ?>" placeholder="<?php esc_attr_e( 'Search installed plugins...' ); ?>"/> |
|
371 | - <?php submit_button( $text, 'hide-if-js', '', false, array( 'id' => 'search-submit' ) ); ?> |
|
369 | + <label class="screen-reader-text" for="<?php echo esc_attr($input_id); ?>"><?php echo $text; ?>:</label> |
|
370 | + <input type="search" id="<?php echo esc_attr($input_id); ?>" class="wp-filter-search" name="s" value="<?php _admin_search_query(); ?>" placeholder="<?php esc_attr_e('Search installed plugins...'); ?>"/> |
|
371 | + <?php submit_button($text, 'hide-if-js', '', false, array('id' => 'search-submit')); ?> |
|
372 | 372 | </p> |
373 | 373 | <?php |
374 | 374 | } |
@@ -382,9 +382,9 @@ discard block |
||
382 | 382 | global $status; |
383 | 383 | |
384 | 384 | return array( |
385 | - 'cb' => !in_array( $status, array( 'mustuse', 'dropins' ) ) ? '<input type="checkbox" />' : '', |
|
386 | - 'name' => __( 'Plugin' ), |
|
387 | - 'description' => __( 'Description' ), |
|
385 | + 'cb' => ! in_array($status, array('mustuse', 'dropins')) ? '<input type="checkbox" />' : '', |
|
386 | + 'name' => __('Plugin'), |
|
387 | + 'description' => __('Description'), |
|
388 | 388 | ); |
389 | 389 | } |
390 | 390 | |
@@ -405,39 +405,39 @@ discard block |
||
405 | 405 | global $totals, $status; |
406 | 406 | |
407 | 407 | $status_links = array(); |
408 | - foreach ( $totals as $type => $count ) { |
|
409 | - if ( !$count ) |
|
408 | + foreach ($totals as $type => $count) { |
|
409 | + if ( ! $count) |
|
410 | 410 | continue; |
411 | 411 | |
412 | - switch ( $type ) { |
|
412 | + switch ($type) { |
|
413 | 413 | case 'all': |
414 | - $text = _nx( 'All <span class="count">(%s)</span>', 'All <span class="count">(%s)</span>', $count, 'plugins' ); |
|
414 | + $text = _nx('All <span class="count">(%s)</span>', 'All <span class="count">(%s)</span>', $count, 'plugins'); |
|
415 | 415 | break; |
416 | 416 | case 'active': |
417 | - $text = _n( 'Active <span class="count">(%s)</span>', 'Active <span class="count">(%s)</span>', $count ); |
|
417 | + $text = _n('Active <span class="count">(%s)</span>', 'Active <span class="count">(%s)</span>', $count); |
|
418 | 418 | break; |
419 | 419 | case 'recently_activated': |
420 | - $text = _n( 'Recently Active <span class="count">(%s)</span>', 'Recently Active <span class="count">(%s)</span>', $count ); |
|
420 | + $text = _n('Recently Active <span class="count">(%s)</span>', 'Recently Active <span class="count">(%s)</span>', $count); |
|
421 | 421 | break; |
422 | 422 | case 'inactive': |
423 | - $text = _n( 'Inactive <span class="count">(%s)</span>', 'Inactive <span class="count">(%s)</span>', $count ); |
|
423 | + $text = _n('Inactive <span class="count">(%s)</span>', 'Inactive <span class="count">(%s)</span>', $count); |
|
424 | 424 | break; |
425 | 425 | case 'mustuse': |
426 | - $text = _n( 'Must-Use <span class="count">(%s)</span>', 'Must-Use <span class="count">(%s)</span>', $count ); |
|
426 | + $text = _n('Must-Use <span class="count">(%s)</span>', 'Must-Use <span class="count">(%s)</span>', $count); |
|
427 | 427 | break; |
428 | 428 | case 'dropins': |
429 | - $text = _n( 'Drop-ins <span class="count">(%s)</span>', 'Drop-ins <span class="count">(%s)</span>', $count ); |
|
429 | + $text = _n('Drop-ins <span class="count">(%s)</span>', 'Drop-ins <span class="count">(%s)</span>', $count); |
|
430 | 430 | break; |
431 | 431 | case 'upgrade': |
432 | - $text = _n( 'Update Available <span class="count">(%s)</span>', 'Update Available <span class="count">(%s)</span>', $count ); |
|
432 | + $text = _n('Update Available <span class="count">(%s)</span>', 'Update Available <span class="count">(%s)</span>', $count); |
|
433 | 433 | break; |
434 | 434 | } |
435 | 435 | |
436 | - if ( 'search' !== $type ) { |
|
437 | - $status_links[$type] = sprintf( "<a href='%s' %s>%s</a>", |
|
436 | + if ('search' !== $type) { |
|
437 | + $status_links[$type] = sprintf("<a href='%s' %s>%s</a>", |
|
438 | 438 | add_query_arg('plugin_status', $type, 'plugins.php'), |
439 | - ( $type === $status ) ? ' class="current"' : '', |
|
440 | - sprintf( $text, number_format_i18n( $count ) ) |
|
439 | + ($type === $status) ? ' class="current"' : '', |
|
440 | + sprintf($text, number_format_i18n($count)) |
|
441 | 441 | ); |
442 | 442 | } |
443 | 443 | } |
@@ -455,17 +455,17 @@ discard block |
||
455 | 455 | |
456 | 456 | $actions = array(); |
457 | 457 | |
458 | - if ( 'active' != $status ) |
|
459 | - $actions['activate-selected'] = $this->screen->in_admin( 'network' ) ? __( 'Network Activate' ) : __( 'Activate' ); |
|
458 | + if ('active' != $status) |
|
459 | + $actions['activate-selected'] = $this->screen->in_admin('network') ? __('Network Activate') : __('Activate'); |
|
460 | 460 | |
461 | - if ( 'inactive' != $status && 'recent' != $status ) |
|
462 | - $actions['deactivate-selected'] = $this->screen->in_admin( 'network' ) ? __( 'Network Deactivate' ) : __( 'Deactivate' ); |
|
461 | + if ('inactive' != $status && 'recent' != $status) |
|
462 | + $actions['deactivate-selected'] = $this->screen->in_admin('network') ? __('Network Deactivate') : __('Deactivate'); |
|
463 | 463 | |
464 | - if ( !is_multisite() || $this->screen->in_admin( 'network' ) ) { |
|
465 | - if ( current_user_can( 'update_plugins' ) ) |
|
466 | - $actions['update-selected'] = __( 'Update' ); |
|
467 | - if ( current_user_can( 'delete_plugins' ) && ( 'active' != $status ) ) |
|
468 | - $actions['delete-selected'] = __( 'Delete' ); |
|
464 | + if ( ! is_multisite() || $this->screen->in_admin('network')) { |
|
465 | + if (current_user_can('update_plugins')) |
|
466 | + $actions['update-selected'] = __('Update'); |
|
467 | + if (current_user_can('delete_plugins') && ('active' != $status)) |
|
468 | + $actions['delete-selected'] = __('Delete'); |
|
469 | 469 | } |
470 | 470 | |
471 | 471 | return $actions; |
@@ -475,39 +475,39 @@ discard block |
||
475 | 475 | * @global string $status |
476 | 476 | * @param string $which |
477 | 477 | */ |
478 | - public function bulk_actions( $which = '' ) { |
|
478 | + public function bulk_actions($which = '') { |
|
479 | 479 | global $status; |
480 | 480 | |
481 | - if ( in_array( $status, array( 'mustuse', 'dropins' ) ) ) |
|
481 | + if (in_array($status, array('mustuse', 'dropins'))) |
|
482 | 482 | return; |
483 | 483 | |
484 | - parent::bulk_actions( $which ); |
|
484 | + parent::bulk_actions($which); |
|
485 | 485 | } |
486 | 486 | |
487 | 487 | /** |
488 | 488 | * @global string $status |
489 | 489 | * @param string $which |
490 | 490 | */ |
491 | - protected function extra_tablenav( $which ) { |
|
491 | + protected function extra_tablenav($which) { |
|
492 | 492 | global $status; |
493 | 493 | |
494 | - if ( ! in_array($status, array('recently_activated', 'mustuse', 'dropins') ) ) |
|
494 | + if ( ! in_array($status, array('recently_activated', 'mustuse', 'dropins'))) |
|
495 | 495 | return; |
496 | 496 | |
497 | 497 | echo '<div class="alignleft actions">'; |
498 | 498 | |
499 | - if ( 'recently_activated' == $status ) { |
|
500 | - submit_button( __( 'Clear List' ), '', 'clear-recent-list', false ); |
|
501 | - } elseif ( 'top' === $which && 'mustuse' === $status ) { |
|
499 | + if ('recently_activated' == $status) { |
|
500 | + submit_button(__('Clear List'), '', 'clear-recent-list', false); |
|
501 | + } elseif ('top' === $which && 'mustuse' === $status) { |
|
502 | 502 | /* translators: %s: mu-plugins directory name */ |
503 | - echo '<p>' . sprintf( __( 'Files in the %s directory are executed automatically.' ), |
|
504 | - '<code>' . str_replace( ABSPATH, '/', WPMU_PLUGIN_DIR ) . '</code>' |
|
505 | - ) . '</p>'; |
|
506 | - } elseif ( 'top' === $which && 'dropins' === $status ) { |
|
503 | + echo '<p>'.sprintf(__('Files in the %s directory are executed automatically.'), |
|
504 | + '<code>'.str_replace(ABSPATH, '/', WPMU_PLUGIN_DIR).'</code>' |
|
505 | + ).'</p>'; |
|
506 | + } elseif ('top' === $which && 'dropins' === $status) { |
|
507 | 507 | /* translators: %s: wp-content directory name */ |
508 | - echo '<p>' . sprintf( __( 'Drop-ins are advanced plugins in the %s directory that replace WordPress functionality when present.' ), |
|
509 | - '<code>' . str_replace( ABSPATH, '', WP_CONTENT_DIR ) . '</code>' |
|
510 | - ) . '</p>'; |
|
508 | + echo '<p>'.sprintf(__('Drop-ins are advanced plugins in the %s directory that replace WordPress functionality when present.'), |
|
509 | + '<code>'.str_replace(ABSPATH, '', WP_CONTENT_DIR).'</code>' |
|
510 | + ).'</p>'; |
|
511 | 511 | } |
512 | 512 | echo '</div>'; |
513 | 513 | } |
@@ -516,7 +516,7 @@ discard block |
||
516 | 516 | * @return string |
517 | 517 | */ |
518 | 518 | public function current_action() { |
519 | - if ( isset($_POST['clear-recent-list']) ) |
|
519 | + if (isset($_POST['clear-recent-list'])) |
|
520 | 520 | return 'clear-recent-list'; |
521 | 521 | |
522 | 522 | return parent::current_action(); |
@@ -529,11 +529,11 @@ discard block |
||
529 | 529 | public function display_rows() { |
530 | 530 | global $status; |
531 | 531 | |
532 | - if ( is_multisite() && ! $this->screen->in_admin( 'network' ) && in_array( $status, array( 'mustuse', 'dropins' ) ) ) |
|
532 | + if (is_multisite() && ! $this->screen->in_admin('network') && in_array($status, array('mustuse', 'dropins'))) |
|
533 | 533 | return; |
534 | 534 | |
535 | - foreach ( $this->items as $plugin_file => $plugin_data ) |
|
536 | - $this->single_row( array( $plugin_file, $plugin_data ) ); |
|
535 | + foreach ($this->items as $plugin_file => $plugin_data) |
|
536 | + $this->single_row(array($plugin_file, $plugin_data)); |
|
537 | 537 | } |
538 | 538 | |
539 | 539 | /** |
@@ -544,10 +544,10 @@ discard block |
||
544 | 544 | * |
545 | 545 | * @param array $item |
546 | 546 | */ |
547 | - public function single_row( $item ) { |
|
547 | + public function single_row($item) { |
|
548 | 548 | global $status, $page, $s, $totals; |
549 | 549 | |
550 | - list( $plugin_file, $plugin_data ) = $item; |
|
550 | + list($plugin_file, $plugin_data) = $item; |
|
551 | 551 | $context = $status; |
552 | 552 | $screen = $this->screen; |
553 | 553 | |
@@ -564,88 +564,88 @@ discard block |
||
564 | 564 | $restrict_network_active = false; |
565 | 565 | $restrict_network_only = false; |
566 | 566 | |
567 | - if ( 'mustuse' === $context ) { |
|
567 | + if ('mustuse' === $context) { |
|
568 | 568 | $is_active = true; |
569 | - } elseif ( 'dropins' === $context ) { |
|
569 | + } elseif ('dropins' === $context) { |
|
570 | 570 | $dropins = _get_dropins(); |
571 | 571 | $plugin_name = $plugin_file; |
572 | - if ( $plugin_file != $plugin_data['Name'] ) |
|
573 | - $plugin_name .= '<br/>' . $plugin_data['Name']; |
|
574 | - if ( true === ( $dropins[ $plugin_file ][1] ) ) { // Doesn't require a constant |
|
572 | + if ($plugin_file != $plugin_data['Name']) |
|
573 | + $plugin_name .= '<br/>'.$plugin_data['Name']; |
|
574 | + if (true === ($dropins[$plugin_file][1])) { // Doesn't require a constant |
|
575 | 575 | $is_active = true; |
576 | - $description = '<p><strong>' . $dropins[ $plugin_file ][0] . '</strong></p>'; |
|
577 | - } elseif ( defined( $dropins[ $plugin_file ][1] ) && constant( $dropins[ $plugin_file ][1] ) ) { // Constant is true |
|
576 | + $description = '<p><strong>'.$dropins[$plugin_file][0].'</strong></p>'; |
|
577 | + } elseif (defined($dropins[$plugin_file][1]) && constant($dropins[$plugin_file][1])) { // Constant is true |
|
578 | 578 | $is_active = true; |
579 | - $description = '<p><strong>' . $dropins[ $plugin_file ][0] . '</strong></p>'; |
|
579 | + $description = '<p><strong>'.$dropins[$plugin_file][0].'</strong></p>'; |
|
580 | 580 | } else { |
581 | 581 | $is_active = false; |
582 | - $description = '<p><strong>' . $dropins[ $plugin_file ][0] . ' <span class="error-message">' . __( 'Inactive:' ) . '</span></strong> ' . |
|
582 | + $description = '<p><strong>'.$dropins[$plugin_file][0].' <span class="error-message">'.__('Inactive:').'</span></strong> '. |
|
583 | 583 | /* translators: 1: drop-in constant name, 2: wp-config.php */ |
584 | - sprintf( __( 'Requires %1$s in %2$s file.' ), |
|
585 | - "<code>define('" . $dropins[ $plugin_file ][1] . "', true);</code>", |
|
584 | + sprintf(__('Requires %1$s in %2$s file.'), |
|
585 | + "<code>define('".$dropins[$plugin_file][1]."', true);</code>", |
|
586 | 586 | '<code>wp-config.php</code>' |
587 | - ) . '</p>'; |
|
587 | + ).'</p>'; |
|
588 | 588 | } |
589 | - if ( $plugin_data['Description'] ) |
|
590 | - $description .= '<p>' . $plugin_data['Description'] . '</p>'; |
|
589 | + if ($plugin_data['Description']) |
|
590 | + $description .= '<p>'.$plugin_data['Description'].'</p>'; |
|
591 | 591 | } else { |
592 | - if ( $screen->in_admin( 'network' ) ) { |
|
593 | - $is_active = is_plugin_active_for_network( $plugin_file ); |
|
592 | + if ($screen->in_admin('network')) { |
|
593 | + $is_active = is_plugin_active_for_network($plugin_file); |
|
594 | 594 | } else { |
595 | - $is_active = is_plugin_active( $plugin_file ); |
|
596 | - $restrict_network_active = ( is_multisite() && is_plugin_active_for_network( $plugin_file ) ); |
|
597 | - $restrict_network_only = ( is_multisite() && is_network_only_plugin( $plugin_file ) && ! $is_active ); |
|
595 | + $is_active = is_plugin_active($plugin_file); |
|
596 | + $restrict_network_active = (is_multisite() && is_plugin_active_for_network($plugin_file)); |
|
597 | + $restrict_network_only = (is_multisite() && is_network_only_plugin($plugin_file) && ! $is_active); |
|
598 | 598 | } |
599 | 599 | |
600 | - if ( $screen->in_admin( 'network' ) ) { |
|
601 | - if ( $is_active ) { |
|
602 | - if ( current_user_can( 'manage_network_plugins' ) ) { |
|
600 | + if ($screen->in_admin('network')) { |
|
601 | + if ($is_active) { |
|
602 | + if (current_user_can('manage_network_plugins')) { |
|
603 | 603 | /* translators: %s: plugin name */ |
604 | - $actions['deactivate'] = '<a href="' . wp_nonce_url( 'plugins.php?action=deactivate&plugin=' . $plugin_file . '&plugin_status=' . $context . '&paged=' . $page . '&s=' . $s, 'deactivate-plugin_' . $plugin_file ) . '" aria-label="' . esc_attr( sprintf( _x( 'Network Deactivate %s', 'plugin' ), $plugin_data['Name'] ) ) . '">' . __( 'Network Deactivate' ) . '</a>'; |
|
604 | + $actions['deactivate'] = '<a href="'.wp_nonce_url('plugins.php?action=deactivate&plugin='.$plugin_file.'&plugin_status='.$context.'&paged='.$page.'&s='.$s, 'deactivate-plugin_'.$plugin_file).'" aria-label="'.esc_attr(sprintf(_x('Network Deactivate %s', 'plugin'), $plugin_data['Name'])).'">'.__('Network Deactivate').'</a>'; |
|
605 | 605 | } |
606 | 606 | } else { |
607 | - if ( current_user_can( 'manage_network_plugins' ) ) { |
|
607 | + if (current_user_can('manage_network_plugins')) { |
|
608 | 608 | /* translators: %s: plugin name */ |
609 | - $actions['activate'] = '<a href="' . wp_nonce_url( 'plugins.php?action=activate&plugin=' . $plugin_file . '&plugin_status=' . $context . '&paged=' . $page . '&s=' . $s, 'activate-plugin_' . $plugin_file ) . '" class="edit" aria-label="' . esc_attr( sprintf( _x( 'Network Activate %s', 'plugin' ), $plugin_data['Name'] ) ) . '">' . __( 'Network Activate' ) . '</a>'; |
|
609 | + $actions['activate'] = '<a href="'.wp_nonce_url('plugins.php?action=activate&plugin='.$plugin_file.'&plugin_status='.$context.'&paged='.$page.'&s='.$s, 'activate-plugin_'.$plugin_file).'" class="edit" aria-label="'.esc_attr(sprintf(_x('Network Activate %s', 'plugin'), $plugin_data['Name'])).'">'.__('Network Activate').'</a>'; |
|
610 | 610 | } |
611 | - if ( current_user_can( 'delete_plugins' ) && ! is_plugin_active( $plugin_file ) ) { |
|
611 | + if (current_user_can('delete_plugins') && ! is_plugin_active($plugin_file)) { |
|
612 | 612 | /* translators: %s: plugin name */ |
613 | - $actions['delete'] = '<a href="' . wp_nonce_url( 'plugins.php?action=delete-selected&checked[]=' . $plugin_file . '&plugin_status=' . $context . '&paged=' . $page . '&s=' . $s, 'bulk-plugins' ) . '" class="delete" aria-label="' . esc_attr( sprintf( _x( 'Delete %s', 'plugin' ), $plugin_data['Name'] ) ) . '">' . __( 'Delete' ) . '</a>'; |
|
613 | + $actions['delete'] = '<a href="'.wp_nonce_url('plugins.php?action=delete-selected&checked[]='.$plugin_file.'&plugin_status='.$context.'&paged='.$page.'&s='.$s, 'bulk-plugins').'" class="delete" aria-label="'.esc_attr(sprintf(_x('Delete %s', 'plugin'), $plugin_data['Name'])).'">'.__('Delete').'</a>'; |
|
614 | 614 | } |
615 | 615 | } |
616 | 616 | } else { |
617 | - if ( $restrict_network_active ) { |
|
617 | + if ($restrict_network_active) { |
|
618 | 618 | $actions = array( |
619 | - 'network_active' => __( 'Network Active' ), |
|
619 | + 'network_active' => __('Network Active'), |
|
620 | 620 | ); |
621 | - } elseif ( $restrict_network_only ) { |
|
621 | + } elseif ($restrict_network_only) { |
|
622 | 622 | $actions = array( |
623 | - 'network_only' => __( 'Network Only' ), |
|
623 | + 'network_only' => __('Network Only'), |
|
624 | 624 | ); |
625 | - } elseif ( $is_active ) { |
|
625 | + } elseif ($is_active) { |
|
626 | 626 | /* translators: %s: plugin name */ |
627 | - $actions['deactivate'] = '<a href="' . wp_nonce_url( 'plugins.php?action=deactivate&plugin=' . $plugin_file . '&plugin_status=' . $context . '&paged=' . $page . '&s=' . $s, 'deactivate-plugin_' . $plugin_file ) . '" aria-label="' . esc_attr( sprintf( _x( 'Deactivate %s', 'plugin' ), $plugin_data['Name'] ) ) . '">' . __( 'Deactivate' ) . '</a>'; |
|
627 | + $actions['deactivate'] = '<a href="'.wp_nonce_url('plugins.php?action=deactivate&plugin='.$plugin_file.'&plugin_status='.$context.'&paged='.$page.'&s='.$s, 'deactivate-plugin_'.$plugin_file).'" aria-label="'.esc_attr(sprintf(_x('Deactivate %s', 'plugin'), $plugin_data['Name'])).'">'.__('Deactivate').'</a>'; |
|
628 | 628 | } else { |
629 | 629 | /* translators: %s: plugin name */ |
630 | - $actions['activate'] = '<a href="' . wp_nonce_url( 'plugins.php?action=activate&plugin=' . $plugin_file . '&plugin_status=' . $context . '&paged=' . $page . '&s=' . $s, 'activate-plugin_' . $plugin_file ) . '" class="edit" aria-label="' . esc_attr( sprintf( _x( 'Activate %s', 'plugin' ), $plugin_data['Name'] ) ) . '">' . __( 'Activate' ) . '</a>'; |
|
630 | + $actions['activate'] = '<a href="'.wp_nonce_url('plugins.php?action=activate&plugin='.$plugin_file.'&plugin_status='.$context.'&paged='.$page.'&s='.$s, 'activate-plugin_'.$plugin_file).'" class="edit" aria-label="'.esc_attr(sprintf(_x('Activate %s', 'plugin'), $plugin_data['Name'])).'">'.__('Activate').'</a>'; |
|
631 | 631 | |
632 | - if ( ! is_multisite() && current_user_can( 'delete_plugins' ) ) { |
|
632 | + if ( ! is_multisite() && current_user_can('delete_plugins')) { |
|
633 | 633 | /* translators: %s: plugin name */ |
634 | - $actions['delete'] = '<a href="' . wp_nonce_url( 'plugins.php?action=delete-selected&checked[]=' . $plugin_file . '&plugin_status=' . $context . '&paged=' . $page . '&s=' . $s, 'bulk-plugins' ) . '" class="delete" aria-label="' . esc_attr( sprintf( _x( 'Delete %s', 'plugin' ), $plugin_data['Name'] ) ) . '">' . __( 'Delete' ) . '</a>'; |
|
634 | + $actions['delete'] = '<a href="'.wp_nonce_url('plugins.php?action=delete-selected&checked[]='.$plugin_file.'&plugin_status='.$context.'&paged='.$page.'&s='.$s, 'bulk-plugins').'" class="delete" aria-label="'.esc_attr(sprintf(_x('Delete %s', 'plugin'), $plugin_data['Name'])).'">'.__('Delete').'</a>'; |
|
635 | 635 | } |
636 | 636 | } // end if $is_active |
637 | 637 | |
638 | 638 | } // end if $screen->in_admin( 'network' ) |
639 | 639 | |
640 | - if ( ( ! is_multisite() || $screen->in_admin( 'network' ) ) && current_user_can( 'edit_plugins' ) && is_writable( WP_PLUGIN_DIR . '/' . $plugin_file ) ) { |
|
640 | + if (( ! is_multisite() || $screen->in_admin('network')) && current_user_can('edit_plugins') && is_writable(WP_PLUGIN_DIR.'/'.$plugin_file)) { |
|
641 | 641 | /* translators: %s: plugin name */ |
642 | - $actions['edit'] = '<a href="plugin-editor.php?file=' . $plugin_file . '" class="edit" aria-label="' . esc_attr( sprintf( __( 'Edit %s' ), $plugin_data['Name'] ) ) . '">' . __( 'Edit' ) . '</a>'; |
|
642 | + $actions['edit'] = '<a href="plugin-editor.php?file='.$plugin_file.'" class="edit" aria-label="'.esc_attr(sprintf(__('Edit %s'), $plugin_data['Name'])).'">'.__('Edit').'</a>'; |
|
643 | 643 | } |
644 | 644 | } // end if $context |
645 | 645 | |
646 | - $actions = array_filter( $actions ); |
|
646 | + $actions = array_filter($actions); |
|
647 | 647 | |
648 | - if ( $screen->in_admin( 'network' ) ) { |
|
648 | + if ($screen->in_admin('network')) { |
|
649 | 649 | |
650 | 650 | /** |
651 | 651 | * Filters the action links displayed for each plugin in the Network Admin Plugins list table. |
@@ -662,7 +662,7 @@ discard block |
||
662 | 662 | * 'Inactive', 'Recently Activated', 'Upgrade', |
663 | 663 | * 'Must-Use', 'Drop-ins', 'Search'. |
664 | 664 | */ |
665 | - $actions = apply_filters( 'network_admin_plugin_action_links', $actions, $plugin_file, $plugin_data, $context ); |
|
665 | + $actions = apply_filters('network_admin_plugin_action_links', $actions, $plugin_file, $plugin_data, $context); |
|
666 | 666 | |
667 | 667 | /** |
668 | 668 | * Filters the list of action links displayed for a specific plugin in the Network Admin Plugins list table. |
@@ -679,7 +679,7 @@ discard block |
||
679 | 679 | * 'Inactive', 'Recently Activated', 'Upgrade', |
680 | 680 | * 'Must-Use', 'Drop-ins', 'Search'. |
681 | 681 | */ |
682 | - $actions = apply_filters( "network_admin_plugin_action_links_{$plugin_file}", $actions, $plugin_file, $plugin_data, $context ); |
|
682 | + $actions = apply_filters("network_admin_plugin_action_links_{$plugin_file}", $actions, $plugin_file, $plugin_data, $context); |
|
683 | 683 | |
684 | 684 | } else { |
685 | 685 | |
@@ -700,7 +700,7 @@ discard block |
||
700 | 700 | * 'Inactive', 'Recently Activated', 'Upgrade', |
701 | 701 | * 'Must-Use', 'Drop-ins', 'Search'. |
702 | 702 | */ |
703 | - $actions = apply_filters( 'plugin_action_links', $actions, $plugin_file, $plugin_data, $context ); |
|
703 | + $actions = apply_filters('plugin_action_links', $actions, $plugin_file, $plugin_data, $context); |
|
704 | 704 | |
705 | 705 | /** |
706 | 706 | * Filters the list of action links displayed for a specific plugin in the Plugins list table. |
@@ -717,48 +717,48 @@ discard block |
||
717 | 717 | * 'Inactive', 'Recently Activated', 'Upgrade', |
718 | 718 | * 'Must-Use', 'Drop-ins', 'Search'. |
719 | 719 | */ |
720 | - $actions = apply_filters( "plugin_action_links_{$plugin_file}", $actions, $plugin_file, $plugin_data, $context ); |
|
720 | + $actions = apply_filters("plugin_action_links_{$plugin_file}", $actions, $plugin_file, $plugin_data, $context); |
|
721 | 721 | |
722 | 722 | } |
723 | 723 | |
724 | 724 | $class = $is_active ? 'active' : 'inactive'; |
725 | - $checkbox_id = "checkbox_" . md5($plugin_data['Name']); |
|
726 | - if ( $restrict_network_active || $restrict_network_only || in_array( $status, array( 'mustuse', 'dropins' ) ) ) { |
|
725 | + $checkbox_id = "checkbox_".md5($plugin_data['Name']); |
|
726 | + if ($restrict_network_active || $restrict_network_only || in_array($status, array('mustuse', 'dropins'))) { |
|
727 | 727 | $checkbox = ''; |
728 | 728 | } else { |
729 | - $checkbox = "<label class='screen-reader-text' for='" . $checkbox_id . "' >" . sprintf( __( 'Select %s' ), $plugin_data['Name'] ) . "</label>" |
|
730 | - . "<input type='checkbox' name='checked[]' value='" . esc_attr( $plugin_file ) . "' id='" . $checkbox_id . "' />"; |
|
729 | + $checkbox = "<label class='screen-reader-text' for='".$checkbox_id."' >".sprintf(__('Select %s'), $plugin_data['Name'])."</label>" |
|
730 | + . "<input type='checkbox' name='checked[]' value='".esc_attr($plugin_file)."' id='".$checkbox_id."' />"; |
|
731 | 731 | } |
732 | - if ( 'dropins' != $context ) { |
|
733 | - $description = '<p>' . ( $plugin_data['Description'] ? $plugin_data['Description'] : ' ' ) . '</p>'; |
|
732 | + if ('dropins' != $context) { |
|
733 | + $description = '<p>'.($plugin_data['Description'] ? $plugin_data['Description'] : ' ').'</p>'; |
|
734 | 734 | $plugin_name = $plugin_data['Name']; |
735 | 735 | } |
736 | 736 | |
737 | - if ( ! empty( $totals['upgrade'] ) && ! empty( $plugin_data['update'] ) ) |
|
737 | + if ( ! empty($totals['upgrade']) && ! empty($plugin_data['update'])) |
|
738 | 738 | $class .= ' update'; |
739 | 739 | |
740 | - $plugin_slug = isset( $plugin_data['slug'] ) ? $plugin_data['slug'] : sanitize_title( $plugin_name ); |
|
741 | - printf( '<tr class="%s" data-slug="%s" data-plugin="%s">', |
|
742 | - esc_attr( $class ), |
|
743 | - esc_attr( $plugin_slug ), |
|
744 | - esc_attr( $plugin_file ) |
|
740 | + $plugin_slug = isset($plugin_data['slug']) ? $plugin_data['slug'] : sanitize_title($plugin_name); |
|
741 | + printf('<tr class="%s" data-slug="%s" data-plugin="%s">', |
|
742 | + esc_attr($class), |
|
743 | + esc_attr($plugin_slug), |
|
744 | + esc_attr($plugin_file) |
|
745 | 745 | ); |
746 | 746 | |
747 | - list( $columns, $hidden, $sortable, $primary ) = $this->get_column_info(); |
|
747 | + list($columns, $hidden, $sortable, $primary) = $this->get_column_info(); |
|
748 | 748 | |
749 | - foreach ( $columns as $column_name => $column_display_name ) { |
|
749 | + foreach ($columns as $column_name => $column_display_name) { |
|
750 | 750 | $extra_classes = ''; |
751 | - if ( in_array( $column_name, $hidden ) ) { |
|
751 | + if (in_array($column_name, $hidden)) { |
|
752 | 752 | $extra_classes = ' hidden'; |
753 | 753 | } |
754 | 754 | |
755 | - switch ( $column_name ) { |
|
755 | + switch ($column_name) { |
|
756 | 756 | case 'cb': |
757 | 757 | echo "<th scope='row' class='check-column'>$checkbox</th>"; |
758 | 758 | break; |
759 | 759 | case 'name': |
760 | 760 | echo "<td class='plugin-title column-primary'><strong>$plugin_name</strong>"; |
761 | - echo $this->row_actions( $actions, true ); |
|
761 | + echo $this->row_actions($actions, true); |
|
762 | 762 | echo "</td>"; |
763 | 763 | break; |
764 | 764 | case 'description': |
@@ -769,28 +769,28 @@ discard block |
||
769 | 769 | <div class='$class second plugin-version-author-uri'>"; |
770 | 770 | |
771 | 771 | $plugin_meta = array(); |
772 | - if ( !empty( $plugin_data['Version'] ) ) |
|
773 | - $plugin_meta[] = sprintf( __( 'Version %s' ), $plugin_data['Version'] ); |
|
774 | - if ( !empty( $plugin_data['Author'] ) ) { |
|
772 | + if ( ! empty($plugin_data['Version'])) |
|
773 | + $plugin_meta[] = sprintf(__('Version %s'), $plugin_data['Version']); |
|
774 | + if ( ! empty($plugin_data['Author'])) { |
|
775 | 775 | $author = $plugin_data['Author']; |
776 | - if ( !empty( $plugin_data['AuthorURI'] ) ) |
|
777 | - $author = '<a href="' . $plugin_data['AuthorURI'] . '">' . $plugin_data['Author'] . '</a>'; |
|
778 | - $plugin_meta[] = sprintf( __( 'By %s' ), $author ); |
|
776 | + if ( ! empty($plugin_data['AuthorURI'])) |
|
777 | + $author = '<a href="'.$plugin_data['AuthorURI'].'">'.$plugin_data['Author'].'</a>'; |
|
778 | + $plugin_meta[] = sprintf(__('By %s'), $author); |
|
779 | 779 | } |
780 | 780 | |
781 | 781 | // Details link using API info, if available |
782 | - if ( isset( $plugin_data['slug'] ) && current_user_can( 'install_plugins' ) ) { |
|
783 | - $plugin_meta[] = sprintf( '<a href="%s" class="thickbox open-plugin-details-modal" aria-label="%s" data-title="%s">%s</a>', |
|
784 | - esc_url( network_admin_url( 'plugin-install.php?tab=plugin-information&plugin=' . $plugin_data['slug'] . |
|
785 | - '&TB_iframe=true&width=600&height=550' ) ), |
|
786 | - esc_attr( sprintf( __( 'More information about %s' ), $plugin_name ) ), |
|
787 | - esc_attr( $plugin_name ), |
|
788 | - __( 'View details' ) |
|
782 | + if (isset($plugin_data['slug']) && current_user_can('install_plugins')) { |
|
783 | + $plugin_meta[] = sprintf('<a href="%s" class="thickbox open-plugin-details-modal" aria-label="%s" data-title="%s">%s</a>', |
|
784 | + esc_url(network_admin_url('plugin-install.php?tab=plugin-information&plugin='.$plugin_data['slug']. |
|
785 | + '&TB_iframe=true&width=600&height=550')), |
|
786 | + esc_attr(sprintf(__('More information about %s'), $plugin_name)), |
|
787 | + esc_attr($plugin_name), |
|
788 | + __('View details') |
|
789 | 789 | ); |
790 | - } elseif ( ! empty( $plugin_data['PluginURI'] ) ) { |
|
791 | - $plugin_meta[] = sprintf( '<a href="%s">%s</a>', |
|
792 | - esc_url( $plugin_data['PluginURI'] ), |
|
793 | - __( 'Visit plugin site' ) |
|
790 | + } elseif ( ! empty($plugin_data['PluginURI'])) { |
|
791 | + $plugin_meta[] = sprintf('<a href="%s">%s</a>', |
|
792 | + esc_url($plugin_data['PluginURI']), |
|
793 | + __('Visit plugin site') |
|
794 | 794 | ); |
795 | 795 | } |
796 | 796 | |
@@ -808,8 +808,8 @@ discard block |
||
808 | 808 | * 'Inactive', 'Recently Activated', 'Upgrade', 'Must-Use', |
809 | 809 | * 'Drop-ins', 'Search'. |
810 | 810 | */ |
811 | - $plugin_meta = apply_filters( 'plugin_row_meta', $plugin_meta, $plugin_file, $plugin_data, $status ); |
|
812 | - echo implode( ' | ', $plugin_meta ); |
|
811 | + $plugin_meta = apply_filters('plugin_row_meta', $plugin_meta, $plugin_file, $plugin_data, $status); |
|
812 | + echo implode(' | ', $plugin_meta); |
|
813 | 813 | |
814 | 814 | echo "</div></td>"; |
815 | 815 | break; |
@@ -827,7 +827,7 @@ discard block |
||
827 | 827 | * @param string $plugin_file Path to the plugin file. |
828 | 828 | * @param array $plugin_data An array of plugin data. |
829 | 829 | */ |
830 | - do_action( 'manage_plugins_custom_column', $column_name, $plugin_file, $plugin_data ); |
|
830 | + do_action('manage_plugins_custom_column', $column_name, $plugin_file, $plugin_data); |
|
831 | 831 | |
832 | 832 | echo "</td>"; |
833 | 833 | } |
@@ -846,7 +846,7 @@ discard block |
||
846 | 846 | * 'Inactive', 'Recently Activated', 'Upgrade', 'Must-Use', |
847 | 847 | * 'Drop-ins', 'Search'. |
848 | 848 | */ |
849 | - do_action( 'after_plugin_row', $plugin_file, $plugin_data, $status ); |
|
849 | + do_action('after_plugin_row', $plugin_file, $plugin_data, $status); |
|
850 | 850 | |
851 | 851 | /** |
852 | 852 | * Fires after each specific row in the Plugins list table. |
@@ -862,7 +862,7 @@ discard block |
||
862 | 862 | * 'Inactive', 'Recently Activated', 'Upgrade', 'Must-Use', |
863 | 863 | * 'Drop-ins', 'Search'. |
864 | 864 | */ |
865 | - do_action( "after_plugin_row_{$plugin_file}", $plugin_file, $plugin_data, $status ); |
|
865 | + do_action("after_plugin_row_{$plugin_file}", $plugin_file, $plugin_data, $status); |
|
866 | 866 | } |
867 | 867 | |
868 | 868 | /** |
@@ -143,12 +143,12 @@ discard block |
||
143 | 143 | private $_help_sidebar = ''; |
144 | 144 | |
145 | 145 | /** |
146 | - * The accessible hidden headings and text associated with the screen, if any. |
|
147 | - * |
|
148 | - * @since 4.4.0 |
|
149 | - * @access private |
|
150 | - * @var array |
|
151 | - */ |
|
146 | + * The accessible hidden headings and text associated with the screen, if any. |
|
147 | + * |
|
148 | + * @since 4.4.0 |
|
149 | + * @access private |
|
150 | + * @var array |
|
151 | + */ |
|
152 | 152 | private $_screen_reader_content = array(); |
153 | 153 | |
154 | 154 | /** |
@@ -656,14 +656,14 @@ discard block |
||
656 | 656 | } |
657 | 657 | |
658 | 658 | /** |
659 | - * Get the accessible hidden headings and text used in the screen. |
|
660 | - * |
|
661 | - * @since 4.4.0 |
|
662 | - * |
|
663 | - * @see set_screen_reader_content() For more information on the array format. |
|
664 | - * |
|
665 | - * @return array An associative array of screen reader text strings. |
|
666 | - */ |
|
659 | + * Get the accessible hidden headings and text used in the screen. |
|
660 | + * |
|
661 | + * @since 4.4.0 |
|
662 | + * |
|
663 | + * @see set_screen_reader_content() For more information on the array format. |
|
664 | + * |
|
665 | + * @return array An associative array of screen reader text strings. |
|
666 | + */ |
|
667 | 667 | public function get_screen_reader_content() { |
668 | 668 | return $this->_screen_reader_content; |
669 | 669 | } |
@@ -223,18 +223,20 @@ discard block |
||
223 | 223 | $in_admin = false; |
224 | 224 | $action = ''; |
225 | 225 | |
226 | - if ( $hook_name ) |
|
227 | - $id = $hook_name; |
|
228 | - else |
|
229 | - $id = $GLOBALS['hook_suffix']; |
|
226 | + if ( $hook_name ) { |
|
227 | + $id = $hook_name; |
|
228 | + } else { |
|
229 | + $id = $GLOBALS['hook_suffix']; |
|
230 | + } |
|
230 | 231 | |
231 | 232 | // For those pesky meta boxes. |
232 | 233 | if ( $hook_name && post_type_exists( $hook_name ) ) { |
233 | 234 | $post_type = $id; |
234 | 235 | $id = 'post'; // changes later. ends up being $base. |
235 | 236 | } else { |
236 | - if ( '.php' == substr( $id, -4 ) ) |
|
237 | - $id = substr( $id, 0, -4 ); |
|
237 | + if ( '.php' == substr( $id, -4 ) ) { |
|
238 | + $id = substr( $id, 0, -4 ); |
|
239 | + } |
|
238 | 240 | |
239 | 241 | if ( 'post-new' == $id || 'link-add' == $id || 'media-new' == $id || 'user-new' == $id ) { |
240 | 242 | $id = substr( $id, 0, -4 ); |
@@ -263,74 +265,86 @@ discard block |
||
263 | 265 | } |
264 | 266 | } |
265 | 267 | |
266 | - if ( ! $in_admin ) |
|
267 | - $in_admin = 'site'; |
|
268 | + if ( ! $in_admin ) { |
|
269 | + $in_admin = 'site'; |
|
270 | + } |
|
268 | 271 | } else { |
269 | - if ( defined( 'WP_NETWORK_ADMIN' ) && WP_NETWORK_ADMIN ) |
|
270 | - $in_admin = 'network'; |
|
271 | - elseif ( defined( 'WP_USER_ADMIN' ) && WP_USER_ADMIN ) |
|
272 | - $in_admin = 'user'; |
|
273 | - else |
|
274 | - $in_admin = 'site'; |
|
272 | + if ( defined( 'WP_NETWORK_ADMIN' ) && WP_NETWORK_ADMIN ) { |
|
273 | + $in_admin = 'network'; |
|
274 | + } elseif ( defined( 'WP_USER_ADMIN' ) && WP_USER_ADMIN ) { |
|
275 | + $in_admin = 'user'; |
|
276 | + } else { |
|
277 | + $in_admin = 'site'; |
|
278 | + } |
|
275 | 279 | } |
276 | 280 | |
277 | - if ( 'index' == $id ) |
|
278 | - $id = 'dashboard'; |
|
279 | - elseif ( 'front' == $id ) |
|
280 | - $in_admin = false; |
|
281 | + if ( 'index' == $id ) { |
|
282 | + $id = 'dashboard'; |
|
283 | + } elseif ( 'front' == $id ) { |
|
284 | + $in_admin = false; |
|
285 | + } |
|
281 | 286 | |
282 | 287 | $base = $id; |
283 | 288 | |
284 | 289 | // If this is the current screen, see if we can be more accurate for post types and taxonomies. |
285 | 290 | if ( ! $hook_name ) { |
286 | - if ( isset( $_REQUEST['post_type'] ) ) |
|
287 | - $post_type = post_type_exists( $_REQUEST['post_type'] ) ? $_REQUEST['post_type'] : false; |
|
288 | - if ( isset( $_REQUEST['taxonomy'] ) ) |
|
289 | - $taxonomy = taxonomy_exists( $_REQUEST['taxonomy'] ) ? $_REQUEST['taxonomy'] : false; |
|
291 | + if ( isset( $_REQUEST['post_type'] ) ) { |
|
292 | + $post_type = post_type_exists( $_REQUEST['post_type'] ) ? $_REQUEST['post_type'] : false; |
|
293 | + } |
|
294 | + if ( isset( $_REQUEST['taxonomy'] ) ) { |
|
295 | + $taxonomy = taxonomy_exists( $_REQUEST['taxonomy'] ) ? $_REQUEST['taxonomy'] : false; |
|
296 | + } |
|
290 | 297 | |
291 | 298 | switch ( $base ) { |
292 | 299 | case 'post' : |
293 | - if ( isset( $_GET['post'] ) ) |
|
294 | - $post_id = (int) $_GET['post']; |
|
295 | - elseif ( isset( $_POST['post_ID'] ) ) |
|
296 | - $post_id = (int) $_POST['post_ID']; |
|
297 | - else |
|
298 | - $post_id = 0; |
|
300 | + if ( isset( $_GET['post'] ) ) { |
|
301 | + $post_id = (int) $_GET['post']; |
|
302 | + } elseif ( isset( $_POST['post_ID'] ) ) { |
|
303 | + $post_id = (int) $_POST['post_ID']; |
|
304 | + } else { |
|
305 | + $post_id = 0; |
|
306 | + } |
|
299 | 307 | |
300 | 308 | if ( $post_id ) { |
301 | 309 | $post = get_post( $post_id ); |
302 | - if ( $post ) |
|
303 | - $post_type = $post->post_type; |
|
310 | + if ( $post ) { |
|
311 | + $post_type = $post->post_type; |
|
312 | + } |
|
304 | 313 | } |
305 | 314 | break; |
306 | 315 | case 'edit-tags' : |
307 | 316 | case 'term' : |
308 | - if ( null === $post_type && is_object_in_taxonomy( 'post', $taxonomy ? $taxonomy : 'post_tag' ) ) |
|
309 | - $post_type = 'post'; |
|
317 | + if ( null === $post_type && is_object_in_taxonomy( 'post', $taxonomy ? $taxonomy : 'post_tag' ) ) { |
|
318 | + $post_type = 'post'; |
|
319 | + } |
|
310 | 320 | break; |
311 | 321 | } |
312 | 322 | } |
313 | 323 | |
314 | 324 | switch ( $base ) { |
315 | 325 | case 'post' : |
316 | - if ( null === $post_type ) |
|
317 | - $post_type = 'post'; |
|
326 | + if ( null === $post_type ) { |
|
327 | + $post_type = 'post'; |
|
328 | + } |
|
318 | 329 | $id = $post_type; |
319 | 330 | break; |
320 | 331 | case 'edit' : |
321 | - if ( null === $post_type ) |
|
322 | - $post_type = 'post'; |
|
332 | + if ( null === $post_type ) { |
|
333 | + $post_type = 'post'; |
|
334 | + } |
|
323 | 335 | $id .= '-' . $post_type; |
324 | 336 | break; |
325 | 337 | case 'edit-tags' : |
326 | 338 | case 'term' : |
327 | - if ( null === $taxonomy ) |
|
328 | - $taxonomy = 'post_tag'; |
|
339 | + if ( null === $taxonomy ) { |
|
340 | + $taxonomy = 'post_tag'; |
|
341 | + } |
|
329 | 342 | // The edit-tags ID does not contain the post type. Look for it in the request. |
330 | 343 | if ( null === $post_type ) { |
331 | 344 | $post_type = 'post'; |
332 | - if ( isset( $_REQUEST['post_type'] ) && post_type_exists( $_REQUEST['post_type'] ) ) |
|
333 | - $post_type = $_REQUEST['post_type']; |
|
345 | + if ( isset( $_REQUEST['post_type'] ) && post_type_exists( $_REQUEST['post_type'] ) ) { |
|
346 | + $post_type = $_REQUEST['post_type']; |
|
347 | + } |
|
334 | 348 | } |
335 | 349 | |
336 | 350 | $id = 'edit-' . $taxonomy; |
@@ -347,8 +361,9 @@ discard block |
||
347 | 361 | |
348 | 362 | if ( isset( self::$_registry[ $id ] ) ) { |
349 | 363 | $screen = self::$_registry[ $id ]; |
350 | - if ( $screen === get_current_screen() ) |
|
351 | - return $screen; |
|
364 | + if ( $screen === get_current_screen() ) { |
|
365 | + return $screen; |
|
366 | + } |
|
352 | 367 | } else { |
353 | 368 | $screen = new WP_Screen(); |
354 | 369 | $screen->id = $id; |
@@ -411,8 +426,9 @@ discard block |
||
411 | 426 | * @return bool True if the screen is in the indicated admin, false otherwise. |
412 | 427 | */ |
413 | 428 | public function in_admin( $admin = null ) { |
414 | - if ( empty( $admin ) ) |
|
415 | - return (bool) $this->in_admin; |
|
429 | + if ( empty( $admin ) ) { |
|
430 | + return (bool) $this->in_admin; |
|
431 | + } |
|
416 | 432 | |
417 | 433 | return ( $admin == $this->in_admin ); |
418 | 434 | } |
@@ -502,11 +518,13 @@ discard block |
||
502 | 518 | * @return string The option value if set, null otherwise. |
503 | 519 | */ |
504 | 520 | public function get_option( $option, $key = false ) { |
505 | - if ( ! isset( $this->_options[ $option ] ) ) |
|
506 | - return null; |
|
521 | + if ( ! isset( $this->_options[ $option ] ) ) { |
|
522 | + return null; |
|
523 | + } |
|
507 | 524 | if ( $key ) { |
508 | - if ( isset( $this->_options[ $option ][ $key ] ) ) |
|
509 | - return $this->_options[ $option ][ $key ]; |
|
525 | + if ( isset( $this->_options[ $option ][ $key ] ) ) { |
|
526 | + return $this->_options[ $option ][ $key ]; |
|
527 | + } |
|
510 | 528 | return null; |
511 | 529 | } |
512 | 530 | return $this->_options[ $option ]; |
@@ -553,8 +571,9 @@ discard block |
||
553 | 571 | * @return array Help tab arguments. |
554 | 572 | */ |
555 | 573 | public function get_help_tab( $id ) { |
556 | - if ( ! isset( $this->_help_tabs[ $id ] ) ) |
|
557 | - return null; |
|
574 | + if ( ! isset( $this->_help_tabs[ $id ] ) ) { |
|
575 | + return null; |
|
576 | + } |
|
558 | 577 | return $this->_help_tabs[ $id ]; |
559 | 578 | } |
560 | 579 | |
@@ -588,8 +607,9 @@ discard block |
||
588 | 607 | $args['id'] = sanitize_html_class( $args['id'] ); |
589 | 608 | |
590 | 609 | // Ensure we have an ID and title. |
591 | - if ( ! $args['id'] || ! $args['title'] ) |
|
592 | - return; |
|
610 | + if ( ! $args['id'] || ! $args['title'] ) { |
|
611 | + return; |
|
612 | + } |
|
593 | 613 | |
594 | 614 | // Allows for overriding an existing tab with that ID. |
595 | 615 | $this->_help_tabs[ $args['id'] ] = $args; |
@@ -771,8 +791,9 @@ discard block |
||
771 | 791 | * @param string $old_help_default Default contextual help text. |
772 | 792 | */ |
773 | 793 | $default_help = apply_filters( 'default_contextual_help', '' ); |
774 | - if ( $default_help ) |
|
775 | - $old_help = '<p>' . $default_help . '</p>'; |
|
794 | + if ( $default_help ) { |
|
795 | + $old_help = '<p>' . $default_help . '</p>'; |
|
796 | + } |
|
776 | 797 | } |
777 | 798 | |
778 | 799 | if ( $old_help ) { |
@@ -786,8 +807,9 @@ discard block |
||
786 | 807 | $help_sidebar = $this->get_help_sidebar(); |
787 | 808 | |
788 | 809 | $help_class = 'hidden'; |
789 | - if ( ! $help_sidebar ) |
|
790 | - $help_class .= ' no-sidebar'; |
|
810 | + if ( ! $help_sidebar ) { |
|
811 | + $help_class .= ' no-sidebar'; |
|
812 | + } |
|
791 | 813 | |
792 | 814 | // Time to render! |
793 | 815 | ?> |
@@ -836,8 +858,9 @@ discard block |
||
836 | 858 | echo $tab['content']; |
837 | 859 | |
838 | 860 | // If it exists, fire tab callback. |
839 | - if ( ! empty( $tab['callback'] ) ) |
|
840 | - call_user_func_array( $tab['callback'], array( $this, $tab ) ); |
|
861 | + if ( ! empty( $tab['callback'] ) ) { |
|
862 | + call_user_func_array( $tab['callback'], array( $this, $tab ) ); |
|
863 | + } |
|
841 | 864 | ?> |
842 | 865 | </div> |
843 | 866 | <?php |
@@ -864,25 +887,29 @@ discard block |
||
864 | 887 | */ |
865 | 888 | $columns = apply_filters( 'screen_layout_columns', array(), $this->id, $this ); |
866 | 889 | |
867 | - if ( ! empty( $columns ) && isset( $columns[ $this->id ] ) ) |
|
868 | - $this->add_option( 'layout_columns', array('max' => $columns[ $this->id ] ) ); |
|
890 | + if ( ! empty( $columns ) && isset( $columns[ $this->id ] ) ) { |
|
891 | + $this->add_option( 'layout_columns', array('max' => $columns[ $this->id ] ) ); |
|
892 | + } |
|
869 | 893 | |
870 | 894 | if ( $this->get_option( 'layout_columns' ) ) { |
871 | 895 | $this->columns = (int) get_user_option("screen_layout_$this->id"); |
872 | 896 | |
873 | - if ( ! $this->columns && $this->get_option( 'layout_columns', 'default' ) ) |
|
874 | - $this->columns = $this->get_option( 'layout_columns', 'default' ); |
|
897 | + if ( ! $this->columns && $this->get_option( 'layout_columns', 'default' ) ) { |
|
898 | + $this->columns = $this->get_option( 'layout_columns', 'default' ); |
|
899 | + } |
|
875 | 900 | } |
876 | 901 | $GLOBALS[ 'screen_layout_columns' ] = $this->columns; // Set the global for back-compat. |
877 | 902 | |
878 | 903 | // Add screen options |
879 | - if ( $this->show_screen_options() ) |
|
880 | - $this->render_screen_options(); |
|
904 | + if ( $this->show_screen_options() ) { |
|
905 | + $this->render_screen_options(); |
|
906 | + } |
|
881 | 907 | ?> |
882 | 908 | </div> |
883 | 909 | <?php |
884 | - if ( ! $this->get_help_tabs() && ! $this->show_screen_options() ) |
|
885 | - return; |
|
910 | + if ( ! $this->get_help_tabs() && ! $this->show_screen_options() ) { |
|
911 | + return; |
|
912 | + } |
|
886 | 913 | ?> |
887 | 914 | <div id="screen-meta-links"> |
888 | 915 | <?php if ( $this->get_help_tabs() ) : ?> |
@@ -908,8 +935,9 @@ discard block |
||
908 | 935 | public function show_screen_options() { |
909 | 936 | global $wp_meta_boxes; |
910 | 937 | |
911 | - if ( is_bool( $this->_show_screen_options ) ) |
|
912 | - return $this->_show_screen_options; |
|
938 | + if ( is_bool( $this->_show_screen_options ) ) { |
|
939 | + return $this->_show_screen_options; |
|
940 | + } |
|
913 | 941 | |
914 | 942 | $columns = get_column_headers( $this ); |
915 | 943 | |
@@ -943,8 +971,9 @@ discard block |
||
943 | 971 | */ |
944 | 972 | $this->_screen_settings = apply_filters( 'screen_settings', $this->_screen_settings, $this ); |
945 | 973 | |
946 | - if ( $this->_screen_settings || $this->_options ) |
|
947 | - $show_screen = true; |
|
974 | + if ( $this->_screen_settings || $this->_options ) { |
|
975 | + $show_screen = true; |
|
976 | + } |
|
948 | 977 | |
949 | 978 | /** |
950 | 979 | * Filter whether to show the Screen Options tab. |
@@ -214,8 +214,8 @@ discard block |
||
214 | 214 | * Defaults to the current $hook_suffix global. |
215 | 215 | * @return WP_Screen Screen object. |
216 | 216 | */ |
217 | - public static function get( $hook_name = '' ) { |
|
218 | - if ( $hook_name instanceof WP_Screen ) { |
|
217 | + public static function get($hook_name = '') { |
|
218 | + if ($hook_name instanceof WP_Screen) { |
|
219 | 219 | return $hook_name; |
220 | 220 | } |
221 | 221 | |
@@ -223,146 +223,146 @@ discard block |
||
223 | 223 | $in_admin = false; |
224 | 224 | $action = ''; |
225 | 225 | |
226 | - if ( $hook_name ) |
|
226 | + if ($hook_name) |
|
227 | 227 | $id = $hook_name; |
228 | 228 | else |
229 | 229 | $id = $GLOBALS['hook_suffix']; |
230 | 230 | |
231 | 231 | // For those pesky meta boxes. |
232 | - if ( $hook_name && post_type_exists( $hook_name ) ) { |
|
232 | + if ($hook_name && post_type_exists($hook_name)) { |
|
233 | 233 | $post_type = $id; |
234 | 234 | $id = 'post'; // changes later. ends up being $base. |
235 | 235 | } else { |
236 | - if ( '.php' == substr( $id, -4 ) ) |
|
237 | - $id = substr( $id, 0, -4 ); |
|
236 | + if ('.php' == substr($id, -4)) |
|
237 | + $id = substr($id, 0, -4); |
|
238 | 238 | |
239 | - if ( 'post-new' == $id || 'link-add' == $id || 'media-new' == $id || 'user-new' == $id ) { |
|
240 | - $id = substr( $id, 0, -4 ); |
|
239 | + if ('post-new' == $id || 'link-add' == $id || 'media-new' == $id || 'user-new' == $id) { |
|
240 | + $id = substr($id, 0, -4); |
|
241 | 241 | $action = 'add'; |
242 | 242 | } |
243 | 243 | } |
244 | 244 | |
245 | - if ( ! $post_type && $hook_name ) { |
|
246 | - if ( '-network' == substr( $id, -8 ) ) { |
|
247 | - $id = substr( $id, 0, -8 ); |
|
245 | + if ( ! $post_type && $hook_name) { |
|
246 | + if ('-network' == substr($id, -8)) { |
|
247 | + $id = substr($id, 0, -8); |
|
248 | 248 | $in_admin = 'network'; |
249 | - } elseif ( '-user' == substr( $id, -5 ) ) { |
|
250 | - $id = substr( $id, 0, -5 ); |
|
249 | + } elseif ('-user' == substr($id, -5)) { |
|
250 | + $id = substr($id, 0, -5); |
|
251 | 251 | $in_admin = 'user'; |
252 | 252 | } |
253 | 253 | |
254 | - $id = sanitize_key( $id ); |
|
255 | - if ( 'edit-comments' != $id && 'edit-tags' != $id && 'edit-' == substr( $id, 0, 5 ) ) { |
|
256 | - $maybe = substr( $id, 5 ); |
|
257 | - if ( taxonomy_exists( $maybe ) ) { |
|
254 | + $id = sanitize_key($id); |
|
255 | + if ('edit-comments' != $id && 'edit-tags' != $id && 'edit-' == substr($id, 0, 5)) { |
|
256 | + $maybe = substr($id, 5); |
|
257 | + if (taxonomy_exists($maybe)) { |
|
258 | 258 | $id = 'edit-tags'; |
259 | 259 | $taxonomy = $maybe; |
260 | - } elseif ( post_type_exists( $maybe ) ) { |
|
260 | + } elseif (post_type_exists($maybe)) { |
|
261 | 261 | $id = 'edit'; |
262 | 262 | $post_type = $maybe; |
263 | 263 | } |
264 | 264 | } |
265 | 265 | |
266 | - if ( ! $in_admin ) |
|
266 | + if ( ! $in_admin) |
|
267 | 267 | $in_admin = 'site'; |
268 | 268 | } else { |
269 | - if ( defined( 'WP_NETWORK_ADMIN' ) && WP_NETWORK_ADMIN ) |
|
269 | + if (defined('WP_NETWORK_ADMIN') && WP_NETWORK_ADMIN) |
|
270 | 270 | $in_admin = 'network'; |
271 | - elseif ( defined( 'WP_USER_ADMIN' ) && WP_USER_ADMIN ) |
|
271 | + elseif (defined('WP_USER_ADMIN') && WP_USER_ADMIN) |
|
272 | 272 | $in_admin = 'user'; |
273 | 273 | else |
274 | 274 | $in_admin = 'site'; |
275 | 275 | } |
276 | 276 | |
277 | - if ( 'index' == $id ) |
|
277 | + if ('index' == $id) |
|
278 | 278 | $id = 'dashboard'; |
279 | - elseif ( 'front' == $id ) |
|
279 | + elseif ('front' == $id) |
|
280 | 280 | $in_admin = false; |
281 | 281 | |
282 | 282 | $base = $id; |
283 | 283 | |
284 | 284 | // If this is the current screen, see if we can be more accurate for post types and taxonomies. |
285 | - if ( ! $hook_name ) { |
|
286 | - if ( isset( $_REQUEST['post_type'] ) ) |
|
287 | - $post_type = post_type_exists( $_REQUEST['post_type'] ) ? $_REQUEST['post_type'] : false; |
|
288 | - if ( isset( $_REQUEST['taxonomy'] ) ) |
|
289 | - $taxonomy = taxonomy_exists( $_REQUEST['taxonomy'] ) ? $_REQUEST['taxonomy'] : false; |
|
285 | + if ( ! $hook_name) { |
|
286 | + if (isset($_REQUEST['post_type'])) |
|
287 | + $post_type = post_type_exists($_REQUEST['post_type']) ? $_REQUEST['post_type'] : false; |
|
288 | + if (isset($_REQUEST['taxonomy'])) |
|
289 | + $taxonomy = taxonomy_exists($_REQUEST['taxonomy']) ? $_REQUEST['taxonomy'] : false; |
|
290 | 290 | |
291 | - switch ( $base ) { |
|
291 | + switch ($base) { |
|
292 | 292 | case 'post' : |
293 | - if ( isset( $_GET['post'] ) ) |
|
293 | + if (isset($_GET['post'])) |
|
294 | 294 | $post_id = (int) $_GET['post']; |
295 | - elseif ( isset( $_POST['post_ID'] ) ) |
|
295 | + elseif (isset($_POST['post_ID'])) |
|
296 | 296 | $post_id = (int) $_POST['post_ID']; |
297 | 297 | else |
298 | 298 | $post_id = 0; |
299 | 299 | |
300 | - if ( $post_id ) { |
|
301 | - $post = get_post( $post_id ); |
|
302 | - if ( $post ) |
|
300 | + if ($post_id) { |
|
301 | + $post = get_post($post_id); |
|
302 | + if ($post) |
|
303 | 303 | $post_type = $post->post_type; |
304 | 304 | } |
305 | 305 | break; |
306 | 306 | case 'edit-tags' : |
307 | 307 | case 'term' : |
308 | - if ( null === $post_type && is_object_in_taxonomy( 'post', $taxonomy ? $taxonomy : 'post_tag' ) ) |
|
308 | + if (null === $post_type && is_object_in_taxonomy('post', $taxonomy ? $taxonomy : 'post_tag')) |
|
309 | 309 | $post_type = 'post'; |
310 | 310 | break; |
311 | 311 | } |
312 | 312 | } |
313 | 313 | |
314 | - switch ( $base ) { |
|
314 | + switch ($base) { |
|
315 | 315 | case 'post' : |
316 | - if ( null === $post_type ) |
|
316 | + if (null === $post_type) |
|
317 | 317 | $post_type = 'post'; |
318 | 318 | $id = $post_type; |
319 | 319 | break; |
320 | 320 | case 'edit' : |
321 | - if ( null === $post_type ) |
|
321 | + if (null === $post_type) |
|
322 | 322 | $post_type = 'post'; |
323 | - $id .= '-' . $post_type; |
|
323 | + $id .= '-'.$post_type; |
|
324 | 324 | break; |
325 | 325 | case 'edit-tags' : |
326 | 326 | case 'term' : |
327 | - if ( null === $taxonomy ) |
|
327 | + if (null === $taxonomy) |
|
328 | 328 | $taxonomy = 'post_tag'; |
329 | 329 | // The edit-tags ID does not contain the post type. Look for it in the request. |
330 | - if ( null === $post_type ) { |
|
330 | + if (null === $post_type) { |
|
331 | 331 | $post_type = 'post'; |
332 | - if ( isset( $_REQUEST['post_type'] ) && post_type_exists( $_REQUEST['post_type'] ) ) |
|
332 | + if (isset($_REQUEST['post_type']) && post_type_exists($_REQUEST['post_type'])) |
|
333 | 333 | $post_type = $_REQUEST['post_type']; |
334 | 334 | } |
335 | 335 | |
336 | - $id = 'edit-' . $taxonomy; |
|
336 | + $id = 'edit-'.$taxonomy; |
|
337 | 337 | break; |
338 | 338 | } |
339 | 339 | |
340 | - if ( 'network' == $in_admin ) { |
|
340 | + if ('network' == $in_admin) { |
|
341 | 341 | $id .= '-network'; |
342 | 342 | $base .= '-network'; |
343 | - } elseif ( 'user' == $in_admin ) { |
|
343 | + } elseif ('user' == $in_admin) { |
|
344 | 344 | $id .= '-user'; |
345 | 345 | $base .= '-user'; |
346 | 346 | } |
347 | 347 | |
348 | - if ( isset( self::$_registry[ $id ] ) ) { |
|
349 | - $screen = self::$_registry[ $id ]; |
|
350 | - if ( $screen === get_current_screen() ) |
|
348 | + if (isset(self::$_registry[$id])) { |
|
349 | + $screen = self::$_registry[$id]; |
|
350 | + if ($screen === get_current_screen()) |
|
351 | 351 | return $screen; |
352 | 352 | } else { |
353 | 353 | $screen = new WP_Screen(); |
354 | - $screen->id = $id; |
|
354 | + $screen->id = $id; |
|
355 | 355 | } |
356 | 356 | |
357 | 357 | $screen->base = $base; |
358 | 358 | $screen->action = $action; |
359 | 359 | $screen->post_type = (string) $post_type; |
360 | 360 | $screen->taxonomy = (string) $taxonomy; |
361 | - $screen->is_user = ( 'user' == $in_admin ); |
|
362 | - $screen->is_network = ( 'network' == $in_admin ); |
|
361 | + $screen->is_user = ('user' == $in_admin); |
|
362 | + $screen->is_network = ('network' == $in_admin); |
|
363 | 363 | $screen->in_admin = $in_admin; |
364 | 364 | |
365 | - self::$_registry[ $id ] = $screen; |
|
365 | + self::$_registry[$id] = $screen; |
|
366 | 366 | |
367 | 367 | return $screen; |
368 | 368 | } |
@@ -390,7 +390,7 @@ discard block |
||
390 | 390 | * |
391 | 391 | * @param WP_Screen $current_screen Current WP_Screen object. |
392 | 392 | */ |
393 | - do_action( 'current_screen', $current_screen ); |
|
393 | + do_action('current_screen', $current_screen); |
|
394 | 394 | } |
395 | 395 | |
396 | 396 | /** |
@@ -410,11 +410,11 @@ discard block |
||
410 | 410 | * If empty any of the three admins will result in true. |
411 | 411 | * @return bool True if the screen is in the indicated admin, false otherwise. |
412 | 412 | */ |
413 | - public function in_admin( $admin = null ) { |
|
414 | - if ( empty( $admin ) ) |
|
413 | + public function in_admin($admin = null) { |
|
414 | + if (empty($admin)) |
|
415 | 415 | return (bool) $this->in_admin; |
416 | 416 | |
417 | - return ( $admin == $this->in_admin ); |
|
417 | + return ($admin == $this->in_admin); |
|
418 | 418 | } |
419 | 419 | |
420 | 420 | /** |
@@ -427,8 +427,8 @@ discard block |
||
427 | 427 | * @param WP_Screen $screen A screen object. |
428 | 428 | * @param string $help Help text. |
429 | 429 | */ |
430 | - public static function add_old_compat_help( $screen, $help ) { |
|
431 | - self::$_old_compat_help[ $screen->id ] = $help; |
|
430 | + public static function add_old_compat_help($screen, $help) { |
|
431 | + self::$_old_compat_help[$screen->id] = $help; |
|
432 | 432 | } |
433 | 433 | |
434 | 434 | /** |
@@ -439,10 +439,10 @@ discard block |
||
439 | 439 | * |
440 | 440 | * @param string $parent_file The parent file of the screen. Typically the $parent_file global. |
441 | 441 | */ |
442 | - public function set_parentage( $parent_file ) { |
|
442 | + public function set_parentage($parent_file) { |
|
443 | 443 | $this->parent_file = $parent_file; |
444 | - list( $this->parent_base ) = explode( '?', $parent_file ); |
|
445 | - $this->parent_base = str_replace( '.php', '', $this->parent_base ); |
|
444 | + list($this->parent_base) = explode('?', $parent_file); |
|
445 | + $this->parent_base = str_replace('.php', '', $this->parent_base); |
|
446 | 446 | } |
447 | 447 | |
448 | 448 | /** |
@@ -454,8 +454,8 @@ discard block |
||
454 | 454 | * @param string $option Option ID |
455 | 455 | * @param mixed $args Option-dependent arguments. |
456 | 456 | */ |
457 | - public function add_option( $option, $args = array() ) { |
|
458 | - $this->_options[ $option ] = $args; |
|
457 | + public function add_option($option, $args = array()) { |
|
458 | + $this->_options[$option] = $args; |
|
459 | 459 | } |
460 | 460 | |
461 | 461 | /** |
@@ -465,8 +465,8 @@ discard block |
||
465 | 465 | * |
466 | 466 | * @param string $option Option ID. |
467 | 467 | */ |
468 | - public function remove_option( $option ) { |
|
469 | - unset( $this->_options[ $option ] ); |
|
468 | + public function remove_option($option) { |
|
469 | + unset($this->_options[$option]); |
|
470 | 470 | } |
471 | 471 | |
472 | 472 | /** |
@@ -499,15 +499,15 @@ discard block |
||
499 | 499 | * Default false. |
500 | 500 | * @return string The option value if set, null otherwise. |
501 | 501 | */ |
502 | - public function get_option( $option, $key = false ) { |
|
503 | - if ( ! isset( $this->_options[ $option ] ) ) |
|
502 | + public function get_option($option, $key = false) { |
|
503 | + if ( ! isset($this->_options[$option])) |
|
504 | 504 | return null; |
505 | - if ( $key ) { |
|
506 | - if ( isset( $this->_options[ $option ][ $key ] ) ) |
|
507 | - return $this->_options[ $option ][ $key ]; |
|
505 | + if ($key) { |
|
506 | + if (isset($this->_options[$option][$key])) |
|
507 | + return $this->_options[$option][$key]; |
|
508 | 508 | return null; |
509 | 509 | } |
510 | - return $this->_options[ $option ]; |
|
510 | + return $this->_options[$option]; |
|
511 | 511 | } |
512 | 512 | |
513 | 513 | /** |
@@ -522,20 +522,20 @@ discard block |
||
522 | 522 | $help_tabs = $this->_help_tabs; |
523 | 523 | |
524 | 524 | $priorities = array(); |
525 | - foreach ( $help_tabs as $help_tab ) { |
|
526 | - if ( isset( $priorities[ $help_tab['priority'] ] ) ) { |
|
527 | - $priorities[ $help_tab['priority'] ][] = $help_tab; |
|
525 | + foreach ($help_tabs as $help_tab) { |
|
526 | + if (isset($priorities[$help_tab['priority']])) { |
|
527 | + $priorities[$help_tab['priority']][] = $help_tab; |
|
528 | 528 | } else { |
529 | - $priorities[ $help_tab['priority'] ] = array( $help_tab ); |
|
529 | + $priorities[$help_tab['priority']] = array($help_tab); |
|
530 | 530 | } |
531 | 531 | } |
532 | 532 | |
533 | - ksort( $priorities ); |
|
533 | + ksort($priorities); |
|
534 | 534 | |
535 | 535 | $sorted = array(); |
536 | - foreach ( $priorities as $list ) { |
|
537 | - foreach ( $list as $tab ) { |
|
538 | - $sorted[ $tab['id'] ] = $tab; |
|
536 | + foreach ($priorities as $list) { |
|
537 | + foreach ($list as $tab) { |
|
538 | + $sorted[$tab['id']] = $tab; |
|
539 | 539 | } |
540 | 540 | } |
541 | 541 | |
@@ -550,10 +550,10 @@ discard block |
||
550 | 550 | * @param string $id Help Tab ID. |
551 | 551 | * @return array Help tab arguments. |
552 | 552 | */ |
553 | - public function get_help_tab( $id ) { |
|
554 | - if ( ! isset( $this->_help_tabs[ $id ] ) ) |
|
553 | + public function get_help_tab($id) { |
|
554 | + if ( ! isset($this->_help_tabs[$id])) |
|
555 | 555 | return null; |
556 | - return $this->_help_tabs[ $id ]; |
|
556 | + return $this->_help_tabs[$id]; |
|
557 | 557 | } |
558 | 558 | |
559 | 559 | /** |
@@ -573,7 +573,7 @@ discard block |
||
573 | 573 | * @type int $priority Optional. The priority of the tab, used for ordering. Default 10. |
574 | 574 | * } |
575 | 575 | */ |
576 | - public function add_help_tab( $args ) { |
|
576 | + public function add_help_tab($args) { |
|
577 | 577 | $defaults = array( |
578 | 578 | 'title' => false, |
579 | 579 | 'id' => false, |
@@ -581,16 +581,16 @@ discard block |
||
581 | 581 | 'callback' => false, |
582 | 582 | 'priority' => 10, |
583 | 583 | ); |
584 | - $args = wp_parse_args( $args, $defaults ); |
|
584 | + $args = wp_parse_args($args, $defaults); |
|
585 | 585 | |
586 | - $args['id'] = sanitize_html_class( $args['id'] ); |
|
586 | + $args['id'] = sanitize_html_class($args['id']); |
|
587 | 587 | |
588 | 588 | // Ensure we have an ID and title. |
589 | - if ( ! $args['id'] || ! $args['title'] ) |
|
589 | + if ( ! $args['id'] || ! $args['title']) |
|
590 | 590 | return; |
591 | 591 | |
592 | 592 | // Allows for overriding an existing tab with that ID. |
593 | - $this->_help_tabs[ $args['id'] ] = $args; |
|
593 | + $this->_help_tabs[$args['id']] = $args; |
|
594 | 594 | } |
595 | 595 | |
596 | 596 | /** |
@@ -600,8 +600,8 @@ discard block |
||
600 | 600 | * |
601 | 601 | * @param string $id The help tab ID. |
602 | 602 | */ |
603 | - public function remove_help_tab( $id ) { |
|
604 | - unset( $this->_help_tabs[ $id ] ); |
|
603 | + public function remove_help_tab($id) { |
|
604 | + unset($this->_help_tabs[$id]); |
|
605 | 605 | } |
606 | 606 | |
607 | 607 | /** |
@@ -632,7 +632,7 @@ discard block |
||
632 | 632 | * |
633 | 633 | * @param string $content Sidebar content in plain text or HTML. |
634 | 634 | */ |
635 | - public function set_help_sidebar( $content ) { |
|
635 | + public function set_help_sidebar($content) { |
|
636 | 636 | $this->_help_sidebar = $content; |
637 | 637 | } |
638 | 638 | |
@@ -674,11 +674,11 @@ discard block |
||
674 | 674 | * @param string $key Screen reader text array named key. |
675 | 675 | * @return string Screen reader text string. |
676 | 676 | */ |
677 | - public function get_screen_reader_text( $key ) { |
|
678 | - if ( ! isset( $this->_screen_reader_content[ $key ] ) ) { |
|
677 | + public function get_screen_reader_text($key) { |
|
678 | + if ( ! isset($this->_screen_reader_content[$key])) { |
|
679 | 679 | return null; |
680 | 680 | } |
681 | - return $this->_screen_reader_content[ $key ]; |
|
681 | + return $this->_screen_reader_content[$key]; |
|
682 | 682 | } |
683 | 683 | |
684 | 684 | /** |
@@ -697,13 +697,13 @@ discard block |
||
697 | 697 | * Default 'Items list'. |
698 | 698 | * } |
699 | 699 | */ |
700 | - public function set_screen_reader_content( $content = array() ) { |
|
700 | + public function set_screen_reader_content($content = array()) { |
|
701 | 701 | $defaults = array( |
702 | - 'heading_views' => __( 'Filter items list' ), |
|
703 | - 'heading_pagination' => __( 'Items list navigation' ), |
|
704 | - 'heading_list' => __( 'Items list' ), |
|
702 | + 'heading_views' => __('Filter items list'), |
|
703 | + 'heading_pagination' => __('Items list navigation'), |
|
704 | + 'heading_list' => __('Items list'), |
|
705 | 705 | ); |
706 | - $content = wp_parse_args( $content, $defaults ); |
|
706 | + $content = wp_parse_args($content, $defaults); |
|
707 | 707 | |
708 | 708 | $this->_screen_reader_content = $content; |
709 | 709 | } |
@@ -738,9 +738,9 @@ discard block |
||
738 | 738 | * @param array $old_compat_help Old contextual help. |
739 | 739 | * @param WP_Screen $this Current WP_Screen instance. |
740 | 740 | */ |
741 | - self::$_old_compat_help = apply_filters( 'contextual_help_list', self::$_old_compat_help, $this ); |
|
741 | + self::$_old_compat_help = apply_filters('contextual_help_list', self::$_old_compat_help, $this); |
|
742 | 742 | |
743 | - $old_help = isset( self::$_old_compat_help[ $this->id ] ) ? self::$_old_compat_help[ $this->id ] : ''; |
|
743 | + $old_help = isset(self::$_old_compat_help[$this->id]) ? self::$_old_compat_help[$this->id] : ''; |
|
744 | 744 | |
745 | 745 | /** |
746 | 746 | * Filters the legacy contextual help text. |
@@ -754,10 +754,10 @@ discard block |
||
754 | 754 | * @param WP_Screen $this Current WP_Screen instance. |
755 | 755 | * |
756 | 756 | */ |
757 | - $old_help = apply_filters( 'contextual_help', $old_help, $this->id, $this ); |
|
757 | + $old_help = apply_filters('contextual_help', $old_help, $this->id, $this); |
|
758 | 758 | |
759 | 759 | // Default help only if there is no old-style block of text and no new-style help tabs. |
760 | - if ( empty( $old_help ) && ! $this->get_help_tabs() ) { |
|
760 | + if (empty($old_help) && ! $this->get_help_tabs()) { |
|
761 | 761 | |
762 | 762 | /** |
763 | 763 | * Filters the default legacy contextual help text. |
@@ -768,44 +768,44 @@ discard block |
||
768 | 768 | * |
769 | 769 | * @param string $old_help_default Default contextual help text. |
770 | 770 | */ |
771 | - $default_help = apply_filters( 'default_contextual_help', '' ); |
|
772 | - if ( $default_help ) |
|
773 | - $old_help = '<p>' . $default_help . '</p>'; |
|
771 | + $default_help = apply_filters('default_contextual_help', ''); |
|
772 | + if ($default_help) |
|
773 | + $old_help = '<p>'.$default_help.'</p>'; |
|
774 | 774 | } |
775 | 775 | |
776 | - if ( $old_help ) { |
|
777 | - $this->add_help_tab( array( |
|
776 | + if ($old_help) { |
|
777 | + $this->add_help_tab(array( |
|
778 | 778 | 'id' => 'old-contextual-help', |
779 | 779 | 'title' => __('Overview'), |
780 | 780 | 'content' => $old_help, |
781 | - ) ); |
|
781 | + )); |
|
782 | 782 | } |
783 | 783 | |
784 | 784 | $help_sidebar = $this->get_help_sidebar(); |
785 | 785 | |
786 | 786 | $help_class = 'hidden'; |
787 | - if ( ! $help_sidebar ) |
|
787 | + if ( ! $help_sidebar) |
|
788 | 788 | $help_class .= ' no-sidebar'; |
789 | 789 | |
790 | 790 | // Time to render! |
791 | 791 | ?> |
792 | 792 | <div id="screen-meta" class="metabox-prefs"> |
793 | 793 | |
794 | - <div id="contextual-help-wrap" class="<?php echo esc_attr( $help_class ); ?>" tabindex="-1" aria-label="<?php esc_attr_e('Contextual Help Tab'); ?>"> |
|
794 | + <div id="contextual-help-wrap" class="<?php echo esc_attr($help_class); ?>" tabindex="-1" aria-label="<?php esc_attr_e('Contextual Help Tab'); ?>"> |
|
795 | 795 | <div id="contextual-help-back"></div> |
796 | 796 | <div id="contextual-help-columns"> |
797 | 797 | <div class="contextual-help-tabs"> |
798 | 798 | <ul> |
799 | 799 | <?php |
800 | 800 | $class = ' class="active"'; |
801 | - foreach ( $this->get_help_tabs() as $tab ) : |
|
801 | + foreach ($this->get_help_tabs() as $tab) : |
|
802 | 802 | $link_id = "tab-link-{$tab['id']}"; |
803 | 803 | $panel_id = "tab-panel-{$tab['id']}"; |
804 | 804 | ?> |
805 | 805 | |
806 | - <li id="<?php echo esc_attr( $link_id ); ?>"<?php echo $class; ?>> |
|
807 | - <a href="<?php echo esc_url( "#$panel_id" ); ?>" aria-controls="<?php echo esc_attr( $panel_id ); ?>"> |
|
808 | - <?php echo esc_html( $tab['title'] ); ?> |
|
806 | + <li id="<?php echo esc_attr($link_id); ?>"<?php echo $class; ?>> |
|
807 | + <a href="<?php echo esc_url("#$panel_id"); ?>" aria-controls="<?php echo esc_attr($panel_id); ?>"> |
|
808 | + <?php echo esc_html($tab['title']); ?> |
|
809 | 809 | </a> |
810 | 810 | </li> |
811 | 811 | <?php |
@@ -815,7 +815,7 @@ discard block |
||
815 | 815 | </ul> |
816 | 816 | </div> |
817 | 817 | |
818 | - <?php if ( $help_sidebar ) : ?> |
|
818 | + <?php if ($help_sidebar) : ?> |
|
819 | 819 | <div class="contextual-help-sidebar"> |
820 | 820 | <?php echo $help_sidebar; ?> |
821 | 821 | </div> |
@@ -824,18 +824,18 @@ discard block |
||
824 | 824 | <div class="contextual-help-tabs-wrap"> |
825 | 825 | <?php |
826 | 826 | $classes = 'help-tab-content active'; |
827 | - foreach ( $this->get_help_tabs() as $tab ): |
|
827 | + foreach ($this->get_help_tabs() as $tab): |
|
828 | 828 | $panel_id = "tab-panel-{$tab['id']}"; |
829 | 829 | ?> |
830 | 830 | |
831 | - <div id="<?php echo esc_attr( $panel_id ); ?>" class="<?php echo $classes; ?>"> |
|
831 | + <div id="<?php echo esc_attr($panel_id); ?>" class="<?php echo $classes; ?>"> |
|
832 | 832 | <?php |
833 | 833 | // Print tab content. |
834 | 834 | echo $tab['content']; |
835 | 835 | |
836 | 836 | // If it exists, fire tab callback. |
837 | - if ( ! empty( $tab['callback'] ) ) |
|
838 | - call_user_func_array( $tab['callback'], array( $this, $tab ) ); |
|
837 | + if ( ! empty($tab['callback'])) |
|
838 | + call_user_func_array($tab['callback'], array($this, $tab)); |
|
839 | 839 | ?> |
840 | 840 | </div> |
841 | 841 | <?php |
@@ -860,37 +860,37 @@ discard block |
||
860 | 860 | * @param string $screen_id Screen ID. |
861 | 861 | * @param WP_Screen $this Current WP_Screen instance. |
862 | 862 | */ |
863 | - $columns = apply_filters( 'screen_layout_columns', array(), $this->id, $this ); |
|
863 | + $columns = apply_filters('screen_layout_columns', array(), $this->id, $this); |
|
864 | 864 | |
865 | - if ( ! empty( $columns ) && isset( $columns[ $this->id ] ) ) |
|
866 | - $this->add_option( 'layout_columns', array('max' => $columns[ $this->id ] ) ); |
|
865 | + if ( ! empty($columns) && isset($columns[$this->id])) |
|
866 | + $this->add_option('layout_columns', array('max' => $columns[$this->id])); |
|
867 | 867 | |
868 | - if ( $this->get_option( 'layout_columns' ) ) { |
|
868 | + if ($this->get_option('layout_columns')) { |
|
869 | 869 | $this->columns = (int) get_user_option("screen_layout_$this->id"); |
870 | 870 | |
871 | - if ( ! $this->columns && $this->get_option( 'layout_columns', 'default' ) ) |
|
872 | - $this->columns = $this->get_option( 'layout_columns', 'default' ); |
|
871 | + if ( ! $this->columns && $this->get_option('layout_columns', 'default')) |
|
872 | + $this->columns = $this->get_option('layout_columns', 'default'); |
|
873 | 873 | } |
874 | - $GLOBALS[ 'screen_layout_columns' ] = $this->columns; // Set the global for back-compat. |
|
874 | + $GLOBALS['screen_layout_columns'] = $this->columns; // Set the global for back-compat. |
|
875 | 875 | |
876 | 876 | // Add screen options |
877 | - if ( $this->show_screen_options() ) |
|
877 | + if ($this->show_screen_options()) |
|
878 | 878 | $this->render_screen_options(); |
879 | 879 | ?> |
880 | 880 | </div> |
881 | 881 | <?php |
882 | - if ( ! $this->get_help_tabs() && ! $this->show_screen_options() ) |
|
882 | + if ( ! $this->get_help_tabs() && ! $this->show_screen_options()) |
|
883 | 883 | return; |
884 | 884 | ?> |
885 | 885 | <div id="screen-meta-links"> |
886 | - <?php if ( $this->get_help_tabs() ) : ?> |
|
886 | + <?php if ($this->get_help_tabs()) : ?> |
|
887 | 887 | <div id="contextual-help-link-wrap" class="hide-if-no-js screen-meta-toggle"> |
888 | - <button type="button" id="contextual-help-link" class="button show-settings" aria-controls="contextual-help-wrap" aria-expanded="false"><?php _e( 'Help' ); ?></button> |
|
888 | + <button type="button" id="contextual-help-link" class="button show-settings" aria-controls="contextual-help-wrap" aria-expanded="false"><?php _e('Help'); ?></button> |
|
889 | 889 | </div> |
890 | 890 | <?php endif; |
891 | - if ( $this->show_screen_options() ) : ?> |
|
891 | + if ($this->show_screen_options()) : ?> |
|
892 | 892 | <div id="screen-options-link-wrap" class="hide-if-no-js screen-meta-toggle"> |
893 | - <button type="button" id="show-settings-link" class="button show-settings" aria-controls="screen-options-wrap" aria-expanded="false"><?php _e( 'Screen Options' ); ?></button> |
|
893 | + <button type="button" id="show-settings-link" class="button show-settings" aria-controls="screen-options-wrap" aria-expanded="false"><?php _e('Screen Options'); ?></button> |
|
894 | 894 | </div> |
895 | 895 | <?php endif; ?> |
896 | 896 | </div> |
@@ -906,21 +906,21 @@ discard block |
||
906 | 906 | public function show_screen_options() { |
907 | 907 | global $wp_meta_boxes; |
908 | 908 | |
909 | - if ( is_bool( $this->_show_screen_options ) ) |
|
909 | + if (is_bool($this->_show_screen_options)) |
|
910 | 910 | return $this->_show_screen_options; |
911 | 911 | |
912 | - $columns = get_column_headers( $this ); |
|
912 | + $columns = get_column_headers($this); |
|
913 | 913 | |
914 | - $show_screen = ! empty( $wp_meta_boxes[ $this->id ] ) || $columns || $this->get_option( 'per_page' ); |
|
914 | + $show_screen = ! empty($wp_meta_boxes[$this->id]) || $columns || $this->get_option('per_page'); |
|
915 | 915 | |
916 | - switch ( $this->base ) { |
|
916 | + switch ($this->base) { |
|
917 | 917 | case 'widgets': |
918 | - $this->_screen_settings = '<p><a id="access-on" href="widgets.php?widgets-access=on">' . __('Enable accessibility mode') . '</a><a id="access-off" href="widgets.php?widgets-access=off">' . __('Disable accessibility mode') . "</a></p>\n"; |
|
918 | + $this->_screen_settings = '<p><a id="access-on" href="widgets.php?widgets-access=on">'.__('Enable accessibility mode').'</a><a id="access-off" href="widgets.php?widgets-access=off">'.__('Disable accessibility mode')."</a></p>\n"; |
|
919 | 919 | break; |
920 | 920 | case 'post' : |
921 | - $expand = '<fieldset class="editor-expand hidden"><legend>' . __( 'Additional settings' ) . '</legend><label for="editor-expand-toggle">'; |
|
922 | - $expand .= '<input type="checkbox" id="editor-expand-toggle"' . checked( get_user_setting( 'editor_expand', 'on' ), 'on', false ) . ' />'; |
|
923 | - $expand .= __( 'Enable full-height editor and distraction-free functionality.' ) . '</label></fieldset>'; |
|
921 | + $expand = '<fieldset class="editor-expand hidden"><legend>'.__('Additional settings').'</legend><label for="editor-expand-toggle">'; |
|
922 | + $expand .= '<input type="checkbox" id="editor-expand-toggle"'.checked(get_user_setting('editor_expand', 'on'), 'on', false).' />'; |
|
923 | + $expand .= __('Enable full-height editor and distraction-free functionality.').'</label></fieldset>'; |
|
924 | 924 | $this->_screen_settings = $expand; |
925 | 925 | break; |
926 | 926 | default: |
@@ -939,9 +939,9 @@ discard block |
||
939 | 939 | * @param string $screen_settings Screen settings. |
940 | 940 | * @param WP_Screen $this WP_Screen object. |
941 | 941 | */ |
942 | - $this->_screen_settings = apply_filters( 'screen_settings', $this->_screen_settings, $this ); |
|
942 | + $this->_screen_settings = apply_filters('screen_settings', $this->_screen_settings, $this); |
|
943 | 943 | |
944 | - if ( $this->_screen_settings || $this->_options ) |
|
944 | + if ($this->_screen_settings || $this->_options) |
|
945 | 945 | $show_screen = true; |
946 | 946 | |
947 | 947 | /** |
@@ -953,7 +953,7 @@ discard block |
||
953 | 953 | * Default true. |
954 | 954 | * @param WP_Screen $this Current WP_Screen instance. |
955 | 955 | */ |
956 | - $this->_show_screen_options = apply_filters( 'screen_options_show_screen', $show_screen, $this ); |
|
956 | + $this->_show_screen_options = apply_filters('screen_options_show_screen', $show_screen, $this); |
|
957 | 957 | return $this->_show_screen_options; |
958 | 958 | } |
959 | 959 | |
@@ -966,26 +966,26 @@ discard block |
||
966 | 966 | * @type bool $wrap Whether the screen-options-wrap div will be included. Defaults to true. |
967 | 967 | * } |
968 | 968 | */ |
969 | - public function render_screen_options( $options = array() ) { |
|
970 | - $options = wp_parse_args( $options, array( |
|
969 | + public function render_screen_options($options = array()) { |
|
970 | + $options = wp_parse_args($options, array( |
|
971 | 971 | 'wrap' => true, |
972 | - ) ); |
|
972 | + )); |
|
973 | 973 | |
974 | 974 | $wrapper_start = $wrapper_end = $form_start = $form_end = ''; |
975 | 975 | |
976 | 976 | // Output optional wrapper. |
977 | - if ( $options['wrap'] ) { |
|
978 | - $wrapper_start = '<div id="screen-options-wrap" class="hidden" tabindex="-1" aria-label="' . esc_attr__( 'Screen Options Tab' ) . '">'; |
|
977 | + if ($options['wrap']) { |
|
978 | + $wrapper_start = '<div id="screen-options-wrap" class="hidden" tabindex="-1" aria-label="'.esc_attr__('Screen Options Tab').'">'; |
|
979 | 979 | $wrapper_end = '</div>'; |
980 | 980 | } |
981 | 981 | |
982 | 982 | // Don't output the form and nonce for the widgets accessibility mode links. |
983 | - if ( 'widgets' !== $this->base ) { |
|
983 | + if ('widgets' !== $this->base) { |
|
984 | 984 | $form_start = "\n<form id='adv-settings' method='post'>\n"; |
985 | - $form_end = "\n" . wp_nonce_field( 'screen-options-nonce', 'screenoptionnonce', false, false ) . "\n</form>\n"; |
|
985 | + $form_end = "\n".wp_nonce_field('screen-options-nonce', 'screenoptionnonce', false, false)."\n</form>\n"; |
|
986 | 986 | } |
987 | 987 | |
988 | - echo $wrapper_start . $form_start; |
|
988 | + echo $wrapper_start.$form_start; |
|
989 | 989 | |
990 | 990 | $this->render_meta_boxes_preferences(); |
991 | 991 | $this->render_list_table_columns_preferences(); |
@@ -1003,13 +1003,13 @@ discard block |
||
1003 | 1003 | * Default false. |
1004 | 1004 | * @param WP_Screen $this Current WP_Screen instance. |
1005 | 1005 | */ |
1006 | - $show_button = apply_filters( 'screen_options_show_submit', false, $this ); |
|
1006 | + $show_button = apply_filters('screen_options_show_submit', false, $this); |
|
1007 | 1007 | |
1008 | - if ( $show_button ) { |
|
1009 | - submit_button( __( 'Apply' ), 'primary', 'screen-options-apply', true ); |
|
1008 | + if ($show_button) { |
|
1009 | + submit_button(__('Apply'), 'primary', 'screen-options-apply', true); |
|
1010 | 1010 | } |
1011 | 1011 | |
1012 | - echo $form_end . $wrapper_end; |
|
1012 | + echo $form_end.$wrapper_end; |
|
1013 | 1013 | } |
1014 | 1014 | |
1015 | 1015 | /** |
@@ -1022,28 +1022,28 @@ discard block |
||
1022 | 1022 | public function render_meta_boxes_preferences() { |
1023 | 1023 | global $wp_meta_boxes; |
1024 | 1024 | |
1025 | - if ( ! isset( $wp_meta_boxes[ $this->id ] ) ) { |
|
1025 | + if ( ! isset($wp_meta_boxes[$this->id])) { |
|
1026 | 1026 | return; |
1027 | 1027 | } |
1028 | 1028 | ?> |
1029 | 1029 | <fieldset class="metabox-prefs"> |
1030 | - <legend><?php _e( 'Boxes' ); ?></legend> |
|
1030 | + <legend><?php _e('Boxes'); ?></legend> |
|
1031 | 1031 | <?php |
1032 | - meta_box_prefs( $this ); |
|
1032 | + meta_box_prefs($this); |
|
1033 | 1033 | |
1034 | - if ( 'dashboard' === $this->id && has_action( 'welcome_panel' ) && current_user_can( 'edit_theme_options' ) ) { |
|
1035 | - if ( isset( $_GET['welcome'] ) ) { |
|
1036 | - $welcome_checked = empty( $_GET['welcome'] ) ? 0 : 1; |
|
1037 | - update_user_meta( get_current_user_id(), 'show_welcome_panel', $welcome_checked ); |
|
1034 | + if ('dashboard' === $this->id && has_action('welcome_panel') && current_user_can('edit_theme_options')) { |
|
1035 | + if (isset($_GET['welcome'])) { |
|
1036 | + $welcome_checked = empty($_GET['welcome']) ? 0 : 1; |
|
1037 | + update_user_meta(get_current_user_id(), 'show_welcome_panel', $welcome_checked); |
|
1038 | 1038 | } else { |
1039 | - $welcome_checked = get_user_meta( get_current_user_id(), 'show_welcome_panel', true ); |
|
1040 | - if ( 2 == $welcome_checked && wp_get_current_user()->user_email != get_option( 'admin_email' ) ) { |
|
1039 | + $welcome_checked = get_user_meta(get_current_user_id(), 'show_welcome_panel', true); |
|
1040 | + if (2 == $welcome_checked && wp_get_current_user()->user_email != get_option('admin_email')) { |
|
1041 | 1041 | $welcome_checked = false; |
1042 | 1042 | } |
1043 | 1043 | } |
1044 | 1044 | echo '<label for="wp_welcome_panel-hide">'; |
1045 | - echo '<input type="checkbox" id="wp_welcome_panel-hide"' . checked( (bool) $welcome_checked, true, false ) . ' />'; |
|
1046 | - echo _x( 'Welcome', 'Welcome panel' ) . "</label>\n"; |
|
1045 | + echo '<input type="checkbox" id="wp_welcome_panel-hide"'.checked((bool) $welcome_checked, true, false).' />'; |
|
1046 | + echo _x('Welcome', 'Welcome panel')."</label>\n"; |
|
1047 | 1047 | } |
1048 | 1048 | ?> |
1049 | 1049 | </fieldset> |
@@ -1057,37 +1057,37 @@ discard block |
||
1057 | 1057 | */ |
1058 | 1058 | public function render_list_table_columns_preferences() { |
1059 | 1059 | |
1060 | - $columns = get_column_headers( $this ); |
|
1061 | - $hidden = get_hidden_columns( $this ); |
|
1060 | + $columns = get_column_headers($this); |
|
1061 | + $hidden = get_hidden_columns($this); |
|
1062 | 1062 | |
1063 | - if ( ! $columns ) { |
|
1063 | + if ( ! $columns) { |
|
1064 | 1064 | return; |
1065 | 1065 | } |
1066 | 1066 | |
1067 | - $legend = ! empty( $columns['_title'] ) ? $columns['_title'] : __( 'Columns' ); |
|
1067 | + $legend = ! empty($columns['_title']) ? $columns['_title'] : __('Columns'); |
|
1068 | 1068 | ?> |
1069 | 1069 | <fieldset class="metabox-prefs"> |
1070 | 1070 | <legend><?php echo $legend; ?></legend> |
1071 | 1071 | <?php |
1072 | - $special = array( '_title', 'cb', 'comment', 'media', 'name', 'title', 'username', 'blogname' ); |
|
1072 | + $special = array('_title', 'cb', 'comment', 'media', 'name', 'title', 'username', 'blogname'); |
|
1073 | 1073 | |
1074 | - foreach ( $columns as $column => $title ) { |
|
1074 | + foreach ($columns as $column => $title) { |
|
1075 | 1075 | // Can't hide these for they are special |
1076 | - if ( in_array( $column, $special ) ) { |
|
1076 | + if (in_array($column, $special)) { |
|
1077 | 1077 | continue; |
1078 | 1078 | } |
1079 | 1079 | |
1080 | - if ( empty( $title ) ) { |
|
1080 | + if (empty($title)) { |
|
1081 | 1081 | continue; |
1082 | 1082 | } |
1083 | 1083 | |
1084 | - if ( 'comments' == $column ) { |
|
1085 | - $title = __( 'Comments' ); |
|
1084 | + if ('comments' == $column) { |
|
1085 | + $title = __('Comments'); |
|
1086 | 1086 | } |
1087 | 1087 | |
1088 | 1088 | $id = "$column-hide"; |
1089 | 1089 | echo '<label>'; |
1090 | - echo '<input class="hide-column-tog" name="' . $id . '" type="checkbox" id="' . $id . '" value="' . $column . '"' . checked( ! in_array( $column, $hidden ), true, false ) . ' />'; |
|
1090 | + echo '<input class="hide-column-tog" name="'.$id.'" type="checkbox" id="'.$id.'" value="'.$column.'"'.checked( ! in_array($column, $hidden), true, false).' />'; |
|
1091 | 1091 | echo "$title</label>\n"; |
1092 | 1092 | } |
1093 | 1093 | ?> |
@@ -1101,22 +1101,22 @@ discard block |
||
1101 | 1101 | * @since 3.3.0 |
1102 | 1102 | */ |
1103 | 1103 | public function render_screen_layout() { |
1104 | - if ( ! $this->get_option( 'layout_columns' ) ) { |
|
1104 | + if ( ! $this->get_option('layout_columns')) { |
|
1105 | 1105 | return; |
1106 | 1106 | } |
1107 | 1107 | |
1108 | 1108 | $screen_layout_columns = $this->get_columns(); |
1109 | - $num = $this->get_option( 'layout_columns', 'max' ); |
|
1109 | + $num = $this->get_option('layout_columns', 'max'); |
|
1110 | 1110 | |
1111 | 1111 | ?> |
1112 | 1112 | <fieldset class='columns-prefs'> |
1113 | - <legend class="screen-layout"><?php _e( 'Layout' ); ?></legend><?php |
|
1114 | - for ( $i = 1; $i <= $num; ++$i ): |
|
1113 | + <legend class="screen-layout"><?php _e('Layout'); ?></legend><?php |
|
1114 | + for ($i = 1; $i <= $num; ++$i): |
|
1115 | 1115 | ?> |
1116 | 1116 | <label class="columns-prefs-<?php echo $i; ?>"> |
1117 | - <input type='radio' name='screen_columns' value='<?php echo esc_attr( $i ); ?>' |
|
1118 | - <?php checked( $screen_layout_columns, $i ); ?> /> |
|
1119 | - <?php printf( _n( '%s column', '%s columns', $i ), number_format_i18n( $i ) ); ?> |
|
1117 | + <input type='radio' name='screen_columns' value='<?php echo esc_attr($i); ?>' |
|
1118 | + <?php checked($screen_layout_columns, $i); ?> /> |
|
1119 | + <?php printf(_n('%s column', '%s columns', $i), number_format_i18n($i)); ?> |
|
1120 | 1120 | </label> |
1121 | 1121 | <?php |
1122 | 1122 | endfor; ?> |
@@ -1130,60 +1130,60 @@ discard block |
||
1130 | 1130 | * @since 3.3.0 |
1131 | 1131 | */ |
1132 | 1132 | public function render_per_page_options() { |
1133 | - if ( null === $this->get_option( 'per_page' ) ) { |
|
1133 | + if (null === $this->get_option('per_page')) { |
|
1134 | 1134 | return; |
1135 | 1135 | } |
1136 | 1136 | |
1137 | - $per_page_label = $this->get_option( 'per_page', 'label' ); |
|
1138 | - if ( null === $per_page_label ) { |
|
1139 | - $per_page_label = __( 'Number of items per page:' ); |
|
1137 | + $per_page_label = $this->get_option('per_page', 'label'); |
|
1138 | + if (null === $per_page_label) { |
|
1139 | + $per_page_label = __('Number of items per page:'); |
|
1140 | 1140 | } |
1141 | 1141 | |
1142 | - $option = $this->get_option( 'per_page', 'option' ); |
|
1143 | - if ( ! $option ) { |
|
1144 | - $option = str_replace( '-', '_', "{$this->id}_per_page" ); |
|
1142 | + $option = $this->get_option('per_page', 'option'); |
|
1143 | + if ( ! $option) { |
|
1144 | + $option = str_replace('-', '_', "{$this->id}_per_page"); |
|
1145 | 1145 | } |
1146 | 1146 | |
1147 | - $per_page = (int) get_user_option( $option ); |
|
1148 | - if ( empty( $per_page ) || $per_page < 1 ) { |
|
1149 | - $per_page = $this->get_option( 'per_page', 'default' ); |
|
1150 | - if ( ! $per_page ) { |
|
1147 | + $per_page = (int) get_user_option($option); |
|
1148 | + if (empty($per_page) || $per_page < 1) { |
|
1149 | + $per_page = $this->get_option('per_page', 'default'); |
|
1150 | + if ( ! $per_page) { |
|
1151 | 1151 | $per_page = 20; |
1152 | 1152 | } |
1153 | 1153 | } |
1154 | 1154 | |
1155 | - if ( 'edit_comments_per_page' == $option ) { |
|
1156 | - $comment_status = isset( $_REQUEST['comment_status'] ) ? $_REQUEST['comment_status'] : 'all'; |
|
1155 | + if ('edit_comments_per_page' == $option) { |
|
1156 | + $comment_status = isset($_REQUEST['comment_status']) ? $_REQUEST['comment_status'] : 'all'; |
|
1157 | 1157 | |
1158 | 1158 | /** This filter is documented in wp-admin/includes/class-wp-comments-list-table.php */ |
1159 | - $per_page = apply_filters( 'comments_per_page', $per_page, $comment_status ); |
|
1160 | - } elseif ( 'categories_per_page' == $option ) { |
|
1159 | + $per_page = apply_filters('comments_per_page', $per_page, $comment_status); |
|
1160 | + } elseif ('categories_per_page' == $option) { |
|
1161 | 1161 | /** This filter is documented in wp-admin/includes/class-wp-terms-list-table.php */ |
1162 | - $per_page = apply_filters( 'edit_categories_per_page', $per_page ); |
|
1162 | + $per_page = apply_filters('edit_categories_per_page', $per_page); |
|
1163 | 1163 | } else { |
1164 | 1164 | /** This filter is documented in wp-admin/includes/class-wp-list-table.php */ |
1165 | - $per_page = apply_filters( "{$option}", $per_page ); |
|
1165 | + $per_page = apply_filters("{$option}", $per_page); |
|
1166 | 1166 | } |
1167 | 1167 | |
1168 | 1168 | // Back compat |
1169 | - if ( isset( $this->post_type ) ) { |
|
1169 | + if (isset($this->post_type)) { |
|
1170 | 1170 | /** This filter is documented in wp-admin/includes/post.php */ |
1171 | - $per_page = apply_filters( 'edit_posts_per_page', $per_page, $this->post_type ); |
|
1171 | + $per_page = apply_filters('edit_posts_per_page', $per_page, $this->post_type); |
|
1172 | 1172 | } |
1173 | 1173 | |
1174 | 1174 | // This needs a submit button |
1175 | - add_filter( 'screen_options_show_submit', '__return_true' ); |
|
1175 | + add_filter('screen_options_show_submit', '__return_true'); |
|
1176 | 1176 | |
1177 | 1177 | ?> |
1178 | 1178 | <fieldset class="screen-options"> |
1179 | - <legend><?php _e( 'Pagination' ); ?></legend> |
|
1180 | - <?php if ( $per_page_label ) : ?> |
|
1181 | - <label for="<?php echo esc_attr( $option ); ?>"><?php echo $per_page_label; ?></label> |
|
1179 | + <legend><?php _e('Pagination'); ?></legend> |
|
1180 | + <?php if ($per_page_label) : ?> |
|
1181 | + <label for="<?php echo esc_attr($option); ?>"><?php echo $per_page_label; ?></label> |
|
1182 | 1182 | <input type="number" step="1" min="1" max="999" class="screen-per-page" name="wp_screen_options[value]" |
1183 | - id="<?php echo esc_attr( $option ); ?>" maxlength="3" |
|
1184 | - value="<?php echo esc_attr( $per_page ); ?>" /> |
|
1183 | + id="<?php echo esc_attr($option); ?>" maxlength="3" |
|
1184 | + value="<?php echo esc_attr($per_page); ?>" /> |
|
1185 | 1185 | <?php endif; ?> |
1186 | - <input type="hidden" name="wp_screen_options[option]" value="<?php echo esc_attr( $option ); ?>" /> |
|
1186 | + <input type="hidden" name="wp_screen_options[option]" value="<?php echo esc_attr($option); ?>" /> |
|
1187 | 1187 | </fieldset> |
1188 | 1188 | <?php |
1189 | 1189 | } |
@@ -1197,11 +1197,11 @@ discard block |
||
1197 | 1197 | $screen = get_current_screen(); |
1198 | 1198 | |
1199 | 1199 | // Currently only enabled for posts lists |
1200 | - if ( 'edit' !== $screen->base ) { |
|
1200 | + if ('edit' !== $screen->base) { |
|
1201 | 1201 | return; |
1202 | 1202 | } |
1203 | 1203 | |
1204 | - $view_mode_post_types = get_post_types( array( 'hierarchical' => false, 'show_ui' => true ) ); |
|
1204 | + $view_mode_post_types = get_post_types(array('hierarchical' => false, 'show_ui' => true)); |
|
1205 | 1205 | |
1206 | 1206 | /** |
1207 | 1207 | * Filters the post types that have different view mode options. |
@@ -1211,26 +1211,26 @@ discard block |
||
1211 | 1211 | * @param array $view_mode_post_types Array of post types that can change view modes. |
1212 | 1212 | * Default hierarchical post types with show_ui on. |
1213 | 1213 | */ |
1214 | - $view_mode_post_types = apply_filters( 'view_mode_post_types', $view_mode_post_types ); |
|
1214 | + $view_mode_post_types = apply_filters('view_mode_post_types', $view_mode_post_types); |
|
1215 | 1215 | |
1216 | - if ( ! in_array( $this->post_type, $view_mode_post_types ) ) { |
|
1216 | + if ( ! in_array($this->post_type, $view_mode_post_types)) { |
|
1217 | 1217 | return; |
1218 | 1218 | } |
1219 | 1219 | |
1220 | 1220 | global $mode; |
1221 | 1221 | |
1222 | 1222 | // This needs a submit button |
1223 | - add_filter( 'screen_options_show_submit', '__return_true' ); |
|
1223 | + add_filter('screen_options_show_submit', '__return_true'); |
|
1224 | 1224 | ?> |
1225 | 1225 | <fieldset class="metabox-prefs view-mode"> |
1226 | - <legend><?php _e( 'View Mode' ); ?></legend> |
|
1226 | + <legend><?php _e('View Mode'); ?></legend> |
|
1227 | 1227 | <label for="list-view-mode"> |
1228 | - <input id="list-view-mode" type="radio" name="mode" value="list" <?php checked( 'list', $mode ); ?> /> |
|
1229 | - <?php _e( 'List View' ); ?> |
|
1228 | + <input id="list-view-mode" type="radio" name="mode" value="list" <?php checked('list', $mode); ?> /> |
|
1229 | + <?php _e('List View'); ?> |
|
1230 | 1230 | </label> |
1231 | 1231 | <label for="excerpt-view-mode"> |
1232 | - <input id="excerpt-view-mode" type="radio" name="mode" value="excerpt" <?php checked( 'excerpt', $mode ); ?> /> |
|
1233 | - <?php _e( 'Excerpt View' ); ?> |
|
1232 | + <input id="excerpt-view-mode" type="radio" name="mode" value="excerpt" <?php checked('excerpt', $mode); ?> /> |
|
1233 | + <?php _e('Excerpt View'); ?> |
|
1234 | 1234 | </label> |
1235 | 1235 | </fieldset> |
1236 | 1236 | <?php |
@@ -1244,11 +1244,11 @@ discard block |
||
1244 | 1244 | * @param string $key The screen reader text array named key. |
1245 | 1245 | * @param string $tag Optional. The HTML tag to wrap the screen reader text. Default h2. |
1246 | 1246 | */ |
1247 | - public function render_screen_reader_content( $key = '', $tag = 'h2' ) { |
|
1247 | + public function render_screen_reader_content($key = '', $tag = 'h2') { |
|
1248 | 1248 | |
1249 | - if ( ! isset( $this->_screen_reader_content[ $key ] ) ) { |
|
1249 | + if ( ! isset($this->_screen_reader_content[$key])) { |
|
1250 | 1250 | return; |
1251 | 1251 | } |
1252 | - echo "<$tag class='screen-reader-text'>" . $this->_screen_reader_content[ $key ] . "</$tag>"; |
|
1252 | + echo "<$tag class='screen-reader-text'>".$this->_screen_reader_content[$key]."</$tag>"; |
|
1253 | 1253 | } |
1254 | 1254 | } |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | * |
29 | 29 | * @param string $hook_suffix The current admin page. |
30 | 30 | */ |
31 | - public static function enqueue_scripts( $hook_suffix ) { |
|
31 | + public static function enqueue_scripts($hook_suffix) { |
|
32 | 32 | /* |
33 | 33 | * Register feature pointers |
34 | 34 | * |
@@ -47,10 +47,10 @@ discard block |
||
47 | 47 | ); |
48 | 48 | |
49 | 49 | // Check if screen related pointer is registered |
50 | - if ( empty( $registered_pointers[ $hook_suffix ] ) ) |
|
50 | + if (empty($registered_pointers[$hook_suffix])) |
|
51 | 51 | return; |
52 | 52 | |
53 | - $pointers = (array) $registered_pointers[ $hook_suffix ]; |
|
53 | + $pointers = (array) $registered_pointers[$hook_suffix]; |
|
54 | 54 | |
55 | 55 | /* |
56 | 56 | * Specify required capabilities for feature pointers |
@@ -70,28 +70,28 @@ discard block |
||
70 | 70 | ); |
71 | 71 | |
72 | 72 | // Get dismissed pointers |
73 | - $dismissed = explode( ',', (string) get_user_meta( get_current_user_id(), 'dismissed_wp_pointers', true ) ); |
|
73 | + $dismissed = explode(',', (string) get_user_meta(get_current_user_id(), 'dismissed_wp_pointers', true)); |
|
74 | 74 | |
75 | 75 | $got_pointers = false; |
76 | - foreach ( array_diff( $pointers, $dismissed ) as $pointer ) { |
|
77 | - if ( isset( $caps_required[ $pointer ] ) ) { |
|
78 | - foreach ( $caps_required[ $pointer ] as $cap ) { |
|
79 | - if ( ! current_user_can( $cap ) ) |
|
76 | + foreach (array_diff($pointers, $dismissed) as $pointer) { |
|
77 | + if (isset($caps_required[$pointer])) { |
|
78 | + foreach ($caps_required[$pointer] as $cap) { |
|
79 | + if ( ! current_user_can($cap)) |
|
80 | 80 | continue 2; |
81 | 81 | } |
82 | 82 | } |
83 | 83 | |
84 | 84 | // Bind pointer print function |
85 | - add_action( 'admin_print_footer_scripts', array( 'WP_Internal_Pointers', 'pointer_' . $pointer ) ); |
|
85 | + add_action('admin_print_footer_scripts', array('WP_Internal_Pointers', 'pointer_'.$pointer)); |
|
86 | 86 | $got_pointers = true; |
87 | 87 | } |
88 | 88 | |
89 | - if ( ! $got_pointers ) |
|
89 | + if ( ! $got_pointers) |
|
90 | 90 | return; |
91 | 91 | |
92 | 92 | // Add pointers script and style to queue |
93 | - wp_enqueue_style( 'wp-pointer' ); |
|
94 | - wp_enqueue_script( 'wp-pointer' ); |
|
93 | + wp_enqueue_style('wp-pointer'); |
|
94 | + wp_enqueue_script('wp-pointer'); |
|
95 | 95 | } |
96 | 96 | |
97 | 97 | /** |
@@ -105,14 +105,14 @@ discard block |
||
105 | 105 | * @param string $selector The HTML elements, on which the pointer should be attached. |
106 | 106 | * @param array $args Arguments to be passed to the pointer JS (see wp-pointer.js). |
107 | 107 | */ |
108 | - private static function print_js( $pointer_id, $selector, $args ) { |
|
109 | - if ( empty( $pointer_id ) || empty( $selector ) || empty( $args ) || empty( $args['content'] ) ) |
|
108 | + private static function print_js($pointer_id, $selector, $args) { |
|
109 | + if (empty($pointer_id) || empty($selector) || empty($args) || empty($args['content'])) |
|
110 | 110 | return; |
111 | 111 | |
112 | 112 | ?> |
113 | 113 | <script type="text/javascript"> |
114 | 114 | (function($){ |
115 | - var options = <?php echo wp_json_encode( $args ); ?>, setup; |
|
115 | + var options = <?php echo wp_json_encode($args); ?>, setup; |
|
116 | 116 | |
117 | 117 | if ( ! options ) |
118 | 118 | return; |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | * |
161 | 161 | * @param int $user_id User ID. |
162 | 162 | */ |
163 | - public static function dismiss_pointers_for_new_users( $user_id ) { |
|
164 | - add_user_meta( $user_id, 'dismissed_wp_pointers', '' ); |
|
163 | + public static function dismiss_pointers_for_new_users($user_id) { |
|
164 | + add_user_meta($user_id, 'dismissed_wp_pointers', ''); |
|
165 | 165 | } |
166 | 166 | } |
@@ -47,8 +47,9 @@ discard block |
||
47 | 47 | ); |
48 | 48 | |
49 | 49 | // Check if screen related pointer is registered |
50 | - if ( empty( $registered_pointers[ $hook_suffix ] ) ) |
|
51 | - return; |
|
50 | + if ( empty( $registered_pointers[ $hook_suffix ] ) ) { |
|
51 | + return; |
|
52 | + } |
|
52 | 53 | |
53 | 54 | $pointers = (array) $registered_pointers[ $hook_suffix ]; |
54 | 55 | |
@@ -76,8 +77,9 @@ discard block |
||
76 | 77 | foreach ( array_diff( $pointers, $dismissed ) as $pointer ) { |
77 | 78 | if ( isset( $caps_required[ $pointer ] ) ) { |
78 | 79 | foreach ( $caps_required[ $pointer ] as $cap ) { |
79 | - if ( ! current_user_can( $cap ) ) |
|
80 | - continue 2; |
|
80 | + if ( ! current_user_can( $cap ) ) { |
|
81 | + continue 2; |
|
82 | + } |
|
81 | 83 | } |
82 | 84 | } |
83 | 85 | |
@@ -86,8 +88,9 @@ discard block |
||
86 | 88 | $got_pointers = true; |
87 | 89 | } |
88 | 90 | |
89 | - if ( ! $got_pointers ) |
|
90 | - return; |
|
91 | + if ( ! $got_pointers ) { |
|
92 | + return; |
|
93 | + } |
|
91 | 94 | |
92 | 95 | // Add pointers script and style to queue |
93 | 96 | wp_enqueue_style( 'wp-pointer' ); |
@@ -106,8 +109,9 @@ discard block |
||
106 | 109 | * @param array $args Arguments to be passed to the pointer JS (see wp-pointer.js). |
107 | 110 | */ |
108 | 111 | private static function print_js( $pointer_id, $selector, $args ) { |
109 | - if ( empty( $pointer_id ) || empty( $selector ) || empty( $args ) || empty( $args['content'] ) ) |
|
110 | - return; |
|
112 | + if ( empty( $pointer_id ) || empty( $selector ) || empty( $args ) || empty( $args['content'] ) ) { |
|
113 | + return; |
|
114 | + } |
|
111 | 115 | |
112 | 116 | ?> |
113 | 117 | <script type="text/javascript"> |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | */ |
19 | 19 | class Walker_Category_Checklist extends Walker { |
20 | 20 | public $tree_type = 'category'; |
21 | - public $db_fields = array ('parent' => 'parent', 'id' => 'term_id'); //TODO: decouple this |
|
21 | + public $db_fields = array('parent' => 'parent', 'id' => 'term_id'); //TODO: decouple this |
|
22 | 22 | |
23 | 23 | /** |
24 | 24 | * Starts the list before the elements are added. |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | * @param int $depth Depth of category. Used for tab indentation. |
32 | 32 | * @param array $args An array of arguments. @see wp_terms_checklist() |
33 | 33 | */ |
34 | - public function start_lvl( &$output, $depth = 0, $args = array() ) { |
|
34 | + public function start_lvl(&$output, $depth = 0, $args = array()) { |
|
35 | 35 | $indent = str_repeat("\t", $depth); |
36 | 36 | $output .= "$indent<ul class='children'>\n"; |
37 | 37 | } |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | * @param int $depth Depth of category. Used for tab indentation. |
48 | 48 | * @param array $args An array of arguments. @see wp_terms_checklist() |
49 | 49 | */ |
50 | - public function end_lvl( &$output, $depth = 0, $args = array() ) { |
|
50 | + public function end_lvl(&$output, $depth = 0, $args = array()) { |
|
51 | 51 | $indent = str_repeat("\t", $depth); |
52 | 52 | $output .= "$indent</ul>\n"; |
53 | 53 | } |
@@ -65,45 +65,45 @@ discard block |
||
65 | 65 | * @param array $args An array of arguments. @see wp_terms_checklist() |
66 | 66 | * @param int $id ID of the current term. |
67 | 67 | */ |
68 | - public function start_el( &$output, $category, $depth = 0, $args = array(), $id = 0 ) { |
|
69 | - if ( empty( $args['taxonomy'] ) ) { |
|
68 | + public function start_el(&$output, $category, $depth = 0, $args = array(), $id = 0) { |
|
69 | + if (empty($args['taxonomy'])) { |
|
70 | 70 | $taxonomy = 'category'; |
71 | 71 | } else { |
72 | 72 | $taxonomy = $args['taxonomy']; |
73 | 73 | } |
74 | 74 | |
75 | - if ( $taxonomy == 'category' ) { |
|
75 | + if ($taxonomy == 'category') { |
|
76 | 76 | $name = 'post_category'; |
77 | 77 | } else { |
78 | - $name = 'tax_input[' . $taxonomy . ']'; |
|
78 | + $name = 'tax_input['.$taxonomy.']'; |
|
79 | 79 | } |
80 | 80 | |
81 | - $args['popular_cats'] = empty( $args['popular_cats'] ) ? array() : $args['popular_cats']; |
|
82 | - $class = in_array( $category->term_id, $args['popular_cats'] ) ? ' class="popular-category"' : ''; |
|
81 | + $args['popular_cats'] = empty($args['popular_cats']) ? array() : $args['popular_cats']; |
|
82 | + $class = in_array($category->term_id, $args['popular_cats']) ? ' class="popular-category"' : ''; |
|
83 | 83 | |
84 | - $args['selected_cats'] = empty( $args['selected_cats'] ) ? array() : $args['selected_cats']; |
|
84 | + $args['selected_cats'] = empty($args['selected_cats']) ? array() : $args['selected_cats']; |
|
85 | 85 | |
86 | - if ( ! empty( $args['list_only'] ) ) { |
|
86 | + if ( ! empty($args['list_only'])) { |
|
87 | 87 | $aria_cheched = 'false'; |
88 | 88 | $inner_class = 'category'; |
89 | 89 | |
90 | - if ( in_array( $category->term_id, $args['selected_cats'] ) ) { |
|
90 | + if (in_array($category->term_id, $args['selected_cats'])) { |
|
91 | 91 | $inner_class .= ' selected'; |
92 | 92 | $aria_cheched = 'true'; |
93 | 93 | } |
94 | 94 | |
95 | 95 | /** This filter is documented in wp-includes/category-template.php */ |
96 | - $output .= "\n" . '<li' . $class . '>' . |
|
97 | - '<div class="' . $inner_class . '" data-term-id=' . $category->term_id . |
|
98 | - ' tabindex="0" role="checkbox" aria-checked="' . $aria_cheched . '">' . |
|
99 | - esc_html( apply_filters( 'the_category', $category->name ) ) . '</div>'; |
|
96 | + $output .= "\n".'<li'.$class.'>'. |
|
97 | + '<div class="'.$inner_class.'" data-term-id='.$category->term_id. |
|
98 | + ' tabindex="0" role="checkbox" aria-checked="'.$aria_cheched.'">'. |
|
99 | + esc_html(apply_filters('the_category', $category->name)).'</div>'; |
|
100 | 100 | } else { |
101 | 101 | /** This filter is documented in wp-includes/category-template.php */ |
102 | - $output .= "\n<li id='{$taxonomy}-{$category->term_id}'$class>" . |
|
103 | - '<label class="selectit"><input value="' . $category->term_id . '" type="checkbox" name="'.$name.'[]" id="in-'.$taxonomy.'-' . $category->term_id . '"' . |
|
104 | - checked( in_array( $category->term_id, $args['selected_cats'] ), true, false ) . |
|
105 | - disabled( empty( $args['disabled'] ), false, false ) . ' /> ' . |
|
106 | - esc_html( apply_filters( 'the_category', $category->name ) ) . '</label>'; |
|
102 | + $output .= "\n<li id='{$taxonomy}-{$category->term_id}'$class>". |
|
103 | + '<label class="selectit"><input value="'.$category->term_id.'" type="checkbox" name="'.$name.'[]" id="in-'.$taxonomy.'-'.$category->term_id.'"'. |
|
104 | + checked(in_array($category->term_id, $args['selected_cats']), true, false). |
|
105 | + disabled(empty($args['disabled']), false, false).' /> '. |
|
106 | + esc_html(apply_filters('the_category', $category->name)).'</label>'; |
|
107 | 107 | } |
108 | 108 | } |
109 | 109 | |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | * @param int $depth Depth of the term in reference to parents. Default 0. |
120 | 120 | * @param array $args An array of arguments. @see wp_terms_checklist() |
121 | 121 | */ |
122 | - public function end_el( &$output, $category, $depth = 0, $args = array() ) { |
|
122 | + public function end_el(&$output, $category, $depth = 0, $args = array()) { |
|
123 | 123 | $output .= "</li>\n"; |
124 | 124 | } |
125 | 125 | } |
@@ -18,8 +18,8 @@ discard block |
||
18 | 18 | * |
19 | 19 | * @param array $fields |
20 | 20 | */ |
21 | - public function __construct( $fields = false ) { |
|
22 | - if ( $fields ) { |
|
21 | + public function __construct($fields = false) { |
|
22 | + if ($fields) { |
|
23 | 23 | $this->db_fields = $fields; |
24 | 24 | } |
25 | 25 | } |
@@ -35,8 +35,8 @@ discard block |
||
35 | 35 | * @param int $depth Depth of page. Used for padding. |
36 | 36 | * @param array $args Not used. |
37 | 37 | */ |
38 | - public function start_lvl( &$output, $depth = 0, $args = array() ) { |
|
39 | - $indent = str_repeat( "\t", $depth ); |
|
38 | + public function start_lvl(&$output, $depth = 0, $args = array()) { |
|
39 | + $indent = str_repeat("\t", $depth); |
|
40 | 40 | $output .= "\n$indent<ul class='children'>\n"; |
41 | 41 | } |
42 | 42 | |
@@ -51,8 +51,8 @@ discard block |
||
51 | 51 | * @param int $depth Depth of page. Used for padding. |
52 | 52 | * @param array $args Not used. |
53 | 53 | */ |
54 | - public function end_lvl( &$output, $depth = 0, $args = array() ) { |
|
55 | - $indent = str_repeat( "\t", $depth ); |
|
54 | + public function end_lvl(&$output, $depth = 0, $args = array()) { |
|
55 | + $indent = str_repeat("\t", $depth); |
|
56 | 56 | $output .= "\n$indent</ul>"; |
57 | 57 | } |
58 | 58 | |
@@ -71,47 +71,47 @@ discard block |
||
71 | 71 | * @param array $args Not used. |
72 | 72 | * @param int $id Not used. |
73 | 73 | */ |
74 | - public function start_el( &$output, $item, $depth = 0, $args = array(), $id = 0 ) { |
|
74 | + public function start_el(&$output, $item, $depth = 0, $args = array(), $id = 0) { |
|
75 | 75 | global $_nav_menu_placeholder; |
76 | 76 | |
77 | - $_nav_menu_placeholder = ( 0 > $_nav_menu_placeholder ) ? intval($_nav_menu_placeholder) - 1 : -1; |
|
78 | - $possible_object_id = isset( $item->post_type ) && 'nav_menu_item' == $item->post_type ? $item->object_id : $_nav_menu_placeholder; |
|
79 | - $possible_db_id = ( ! empty( $item->ID ) ) && ( 0 < $possible_object_id ) ? (int) $item->ID : 0; |
|
77 | + $_nav_menu_placeholder = (0 > $_nav_menu_placeholder) ? intval($_nav_menu_placeholder) - 1 : -1; |
|
78 | + $possible_object_id = isset($item->post_type) && 'nav_menu_item' == $item->post_type ? $item->object_id : $_nav_menu_placeholder; |
|
79 | + $possible_db_id = ( ! empty($item->ID)) && (0 < $possible_object_id) ? (int) $item->ID : 0; |
|
80 | 80 | |
81 | - $indent = ( $depth ) ? str_repeat( "\t", $depth ) : ''; |
|
81 | + $indent = ($depth) ? str_repeat("\t", $depth) : ''; |
|
82 | 82 | |
83 | - $output .= $indent . '<li>'; |
|
83 | + $output .= $indent.'<li>'; |
|
84 | 84 | $output .= '<label class="menu-item-title">'; |
85 | 85 | $output .= '<input type="checkbox" class="menu-item-checkbox'; |
86 | 86 | |
87 | - if ( ! empty( $item->front_or_home ) ) |
|
87 | + if ( ! empty($item->front_or_home)) |
|
88 | 88 | $output .= ' add-to-top'; |
89 | 89 | |
90 | - $output .= '" name="menu-item[' . $possible_object_id . '][menu-item-object-id]" value="'. esc_attr( $item->object_id ) .'" /> '; |
|
90 | + $output .= '" name="menu-item['.$possible_object_id.'][menu-item-object-id]" value="'.esc_attr($item->object_id).'" /> '; |
|
91 | 91 | |
92 | - if ( ! empty( $item->label ) ) { |
|
92 | + if ( ! empty($item->label)) { |
|
93 | 93 | $title = $item->label; |
94 | - } elseif ( isset( $item->post_type ) ) { |
|
94 | + } elseif (isset($item->post_type)) { |
|
95 | 95 | /** This filter is documented in wp-includes/post-template.php */ |
96 | - $title = apply_filters( 'the_title', $item->post_title, $item->ID ); |
|
97 | - if ( ! empty( $item->front_or_home ) && _x( 'Home', 'nav menu home label' ) !== $title ) |
|
98 | - $title = sprintf( _x( 'Home: %s', 'nav menu front page title' ), $title ); |
|
96 | + $title = apply_filters('the_title', $item->post_title, $item->ID); |
|
97 | + if ( ! empty($item->front_or_home) && _x('Home', 'nav menu home label') !== $title) |
|
98 | + $title = sprintf(_x('Home: %s', 'nav menu front page title'), $title); |
|
99 | 99 | } |
100 | 100 | |
101 | - $output .= isset( $title ) ? esc_html( $title ) : esc_html( $item->title ); |
|
101 | + $output .= isset($title) ? esc_html($title) : esc_html($item->title); |
|
102 | 102 | $output .= '</label>'; |
103 | 103 | |
104 | 104 | // Menu item hidden fields |
105 | - $output .= '<input type="hidden" class="menu-item-db-id" name="menu-item[' . $possible_object_id . '][menu-item-db-id]" value="' . $possible_db_id . '" />'; |
|
106 | - $output .= '<input type="hidden" class="menu-item-object" name="menu-item[' . $possible_object_id . '][menu-item-object]" value="'. esc_attr( $item->object ) .'" />'; |
|
107 | - $output .= '<input type="hidden" class="menu-item-parent-id" name="menu-item[' . $possible_object_id . '][menu-item-parent-id]" value="'. esc_attr( $item->menu_item_parent ) .'" />'; |
|
108 | - $output .= '<input type="hidden" class="menu-item-type" name="menu-item[' . $possible_object_id . '][menu-item-type]" value="'. esc_attr( $item->type ) .'" />'; |
|
109 | - $output .= '<input type="hidden" class="menu-item-title" name="menu-item[' . $possible_object_id . '][menu-item-title]" value="'. esc_attr( $item->title ) .'" />'; |
|
110 | - $output .= '<input type="hidden" class="menu-item-url" name="menu-item[' . $possible_object_id . '][menu-item-url]" value="'. esc_attr( $item->url ) .'" />'; |
|
111 | - $output .= '<input type="hidden" class="menu-item-target" name="menu-item[' . $possible_object_id . '][menu-item-target]" value="'. esc_attr( $item->target ) .'" />'; |
|
112 | - $output .= '<input type="hidden" class="menu-item-attr_title" name="menu-item[' . $possible_object_id . '][menu-item-attr_title]" value="'. esc_attr( $item->attr_title ) .'" />'; |
|
113 | - $output .= '<input type="hidden" class="menu-item-classes" name="menu-item[' . $possible_object_id . '][menu-item-classes]" value="'. esc_attr( implode( ' ', $item->classes ) ) .'" />'; |
|
114 | - $output .= '<input type="hidden" class="menu-item-xfn" name="menu-item[' . $possible_object_id . '][menu-item-xfn]" value="'. esc_attr( $item->xfn ) .'" />'; |
|
105 | + $output .= '<input type="hidden" class="menu-item-db-id" name="menu-item['.$possible_object_id.'][menu-item-db-id]" value="'.$possible_db_id.'" />'; |
|
106 | + $output .= '<input type="hidden" class="menu-item-object" name="menu-item['.$possible_object_id.'][menu-item-object]" value="'.esc_attr($item->object).'" />'; |
|
107 | + $output .= '<input type="hidden" class="menu-item-parent-id" name="menu-item['.$possible_object_id.'][menu-item-parent-id]" value="'.esc_attr($item->menu_item_parent).'" />'; |
|
108 | + $output .= '<input type="hidden" class="menu-item-type" name="menu-item['.$possible_object_id.'][menu-item-type]" value="'.esc_attr($item->type).'" />'; |
|
109 | + $output .= '<input type="hidden" class="menu-item-title" name="menu-item['.$possible_object_id.'][menu-item-title]" value="'.esc_attr($item->title).'" />'; |
|
110 | + $output .= '<input type="hidden" class="menu-item-url" name="menu-item['.$possible_object_id.'][menu-item-url]" value="'.esc_attr($item->url).'" />'; |
|
111 | + $output .= '<input type="hidden" class="menu-item-target" name="menu-item['.$possible_object_id.'][menu-item-target]" value="'.esc_attr($item->target).'" />'; |
|
112 | + $output .= '<input type="hidden" class="menu-item-attr_title" name="menu-item['.$possible_object_id.'][menu-item-attr_title]" value="'.esc_attr($item->attr_title).'" />'; |
|
113 | + $output .= '<input type="hidden" class="menu-item-classes" name="menu-item['.$possible_object_id.'][menu-item-classes]" value="'.esc_attr(implode(' ', $item->classes)).'" />'; |
|
114 | + $output .= '<input type="hidden" class="menu-item-xfn" name="menu-item['.$possible_object_id.'][menu-item-xfn]" value="'.esc_attr($item->xfn).'" />'; |
|
115 | 115 | } |
116 | 116 | |
117 | 117 | } // Walker_Nav_Menu_Checklist |
@@ -84,8 +84,9 @@ discard block |
||
84 | 84 | $output .= '<label class="menu-item-title">'; |
85 | 85 | $output .= '<input type="checkbox" class="menu-item-checkbox'; |
86 | 86 | |
87 | - if ( ! empty( $item->front_or_home ) ) |
|
88 | - $output .= ' add-to-top'; |
|
87 | + if ( ! empty( $item->front_or_home ) ) { |
|
88 | + $output .= ' add-to-top'; |
|
89 | + } |
|
89 | 90 | |
90 | 91 | $output .= '" name="menu-item[' . $possible_object_id . '][menu-item-object-id]" value="'. esc_attr( $item->object_id ) .'" /> '; |
91 | 92 | |
@@ -94,8 +95,9 @@ discard block |
||
94 | 95 | } elseif ( isset( $item->post_type ) ) { |
95 | 96 | /** This filter is documented in wp-includes/post-template.php */ |
96 | 97 | $title = apply_filters( 'the_title', $item->post_title, $item->ID ); |
97 | - if ( ! empty( $item->front_or_home ) && _x( 'Home', 'nav menu home label' ) !== $title ) |
|
98 | - $title = sprintf( _x( 'Home: %s', 'nav menu front page title' ), $title ); |
|
98 | + if ( ! empty( $item->front_or_home ) && _x( 'Home', 'nav menu home label' ) !== $title ) { |
|
99 | + $title = sprintf( _x( 'Home: %s', 'nav menu front page title' ), $title ); |
|
100 | + } |
|
99 | 101 | } |
100 | 102 | |
101 | 103 | $output .= isset( $title ) ? esc_html( $title ) : esc_html( $item->title ); |
@@ -34,8 +34,9 @@ discard block |
||
34 | 34 | */ |
35 | 35 | function allow_subdomain_install() { |
36 | 36 | $domain = preg_replace( '|https?://([^/]+)|', '$1', get_option( 'home' ) ); |
37 | - if ( parse_url( get_option( 'home' ), PHP_URL_PATH ) || 'localhost' == $domain || preg_match( '|^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$|', $domain ) ) |
|
38 | - return false; |
|
37 | + if ( parse_url( get_option( 'home' ), PHP_URL_PATH ) || 'localhost' == $domain || preg_match( '|^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$|', $domain ) ) { |
|
38 | + return false; |
|
39 | + } |
|
39 | 40 | |
40 | 41 | return true; |
41 | 42 | } |
@@ -58,15 +59,18 @@ discard block |
||
58 | 59 | * |
59 | 60 | * @param bool $allow Whether to enable the subdirectory install feature in Multisite. Default is false. |
60 | 61 | */ |
61 | - if ( apply_filters( 'allow_subdirectory_install', false ) ) |
|
62 | - return true; |
|
62 | + if ( apply_filters( 'allow_subdirectory_install', false ) ) { |
|
63 | + return true; |
|
64 | + } |
|
63 | 65 | |
64 | - if ( defined( 'ALLOW_SUBDIRECTORY_INSTALL' ) && ALLOW_SUBDIRECTORY_INSTALL ) |
|
65 | - return true; |
|
66 | + if ( defined( 'ALLOW_SUBDIRECTORY_INSTALL' ) && ALLOW_SUBDIRECTORY_INSTALL ) { |
|
67 | + return true; |
|
68 | + } |
|
66 | 69 | |
67 | 70 | $post = $wpdb->get_row( "SELECT ID FROM $wpdb->posts WHERE post_date < DATE_SUB(NOW(), INTERVAL 1 MONTH) AND post_status = 'publish'" ); |
68 | - if ( empty( $post ) ) |
|
69 | - return true; |
|
71 | + if ( empty( $post ) ) { |
|
72 | + return true; |
|
73 | + } |
|
70 | 74 | |
71 | 75 | return false; |
72 | 76 | } |
@@ -78,11 +82,13 @@ discard block |
||
78 | 82 | * @return string Base domain. |
79 | 83 | */ |
80 | 84 | function get_clean_basedomain() { |
81 | - if ( $existing_domain = network_domain_check() ) |
|
82 | - return $existing_domain; |
|
85 | + if ( $existing_domain = network_domain_check() ) { |
|
86 | + return $existing_domain; |
|
87 | + } |
|
83 | 88 | $domain = preg_replace( '|https?://|', '', get_option( 'siteurl' ) ); |
84 | - if ( $slash = strpos( $domain, '/' ) ) |
|
85 | - $domain = substr( $domain, 0, $slash ); |
|
89 | + if ( $slash = strpos( $domain, '/' ) ) { |
|
90 | + $domain = substr( $domain, 0, $slash ); |
|
91 | + } |
|
86 | 92 | return $domain; |
87 | 93 | } |
88 | 94 | |
@@ -138,8 +144,9 @@ discard block |
||
138 | 144 | $error_codes = array(); |
139 | 145 | if ( is_wp_error( $errors ) ) { |
140 | 146 | echo '<div class="error"><p><strong>' . __( 'ERROR: The network could not be created.' ) . '</strong></p>'; |
141 | - foreach ( $errors->get_error_messages() as $error ) |
|
142 | - echo "<p>$error</p>"; |
|
147 | + foreach ( $errors->get_error_messages() as $error ) { |
|
148 | + echo "<p>$error</p>"; |
|
149 | + } |
|
143 | 150 | echo '</div>'; |
144 | 151 | $error_codes = $errors->get_error_codes(); |
145 | 152 | } |
@@ -215,8 +222,9 @@ discard block |
||
215 | 222 | <?php |
216 | 223 | endif; |
217 | 224 | |
218 | - if ( WP_CONTENT_DIR != ABSPATH . 'wp-content' && ( allow_subdirectory_install() || ! allow_subdomain_install() ) ) |
|
219 | - echo '<div class="error inline"><p><strong>' . __('Warning!') . '</strong> ' . __( 'Subdirectory networks may not be fully compatible with custom wp-content directories.' ) . '</p></div>'; |
|
225 | + if ( WP_CONTENT_DIR != ABSPATH . 'wp-content' && ( allow_subdirectory_install() || ! allow_subdomain_install() ) ) { |
|
226 | + echo '<div class="error inline"><p><strong>' . __('Warning!') . '</strong> ' . __( 'Subdirectory networks may not be fully compatible with custom wp-content directories.' ) . '</p></div>'; |
|
227 | + } |
|
220 | 228 | |
221 | 229 | $is_www = ( 0 === strpos( $hostname, 'www.' ) ); |
222 | 230 | if ( $is_www ) : |
@@ -256,8 +264,9 @@ discard block |
||
256 | 264 | '<code>localhost.localdomain</code>' |
257 | 265 | ); |
258 | 266 | // Uh oh: |
259 | - if ( !allow_subdirectory_install() ) |
|
260 | - echo ' <strong>' . __( 'Warning!' ) . ' ' . __( 'The main site in a sub-directory install will need to use a modified permalink structure, potentially breaking existing links.' ) . '</strong>'; |
|
267 | + if ( !allow_subdirectory_install() ) { |
|
268 | + echo ' <strong>' . __( 'Warning!' ) . ' ' . __( 'The main site in a sub-directory install will need to use a modified permalink structure, potentially breaking existing links.' ) . '</strong>'; |
|
269 | + } |
|
261 | 270 | ?></td> |
262 | 271 | </tr> |
263 | 272 | <?php elseif ( !allow_subdomain_install() ) : ?> |
@@ -266,8 +275,9 @@ discard block |
||
266 | 275 | <td><?php |
267 | 276 | _e( 'Because your install is in a directory, the sites in your WordPress network must use sub-directories.' ); |
268 | 277 | // Uh oh: |
269 | - if ( !allow_subdirectory_install() ) |
|
270 | - echo ' <strong>' . __( 'Warning!' ) . ' ' . __( 'The main site in a sub-directory install will need to use a modified permalink structure, potentially breaking existing links.' ) . '</strong>'; |
|
278 | + if ( !allow_subdirectory_install() ) { |
|
279 | + echo ' <strong>' . __( 'Warning!' ) . ' ' . __( 'The main site in a sub-directory install will need to use a modified permalink structure, potentially breaking existing links.' ) . '</strong>'; |
|
280 | + } |
|
271 | 281 | ?></td> |
272 | 282 | </tr> |
273 | 283 | <?php elseif ( !allow_subdirectory_install() ) : ?> |
@@ -343,14 +353,16 @@ discard block |
||
343 | 353 | $location_of_wp_config = trailingslashit( $location_of_wp_config ); |
344 | 354 | |
345 | 355 | // Wildcard DNS message. |
346 | - if ( is_wp_error( $errors ) ) |
|
347 | - echo '<div class="error">' . $errors->get_error_message() . '</div>'; |
|
356 | + if ( is_wp_error( $errors ) ) { |
|
357 | + echo '<div class="error">' . $errors->get_error_message() . '</div>'; |
|
358 | + } |
|
348 | 359 | |
349 | 360 | if ( $_POST ) { |
350 | - if ( allow_subdomain_install() ) |
|
351 | - $subdomain_install = allow_subdirectory_install() ? ! empty( $_POST['subdomain_install'] ) : true; |
|
352 | - else |
|
353 | - $subdomain_install = false; |
|
361 | + if ( allow_subdomain_install() ) { |
|
362 | + $subdomain_install = allow_subdirectory_install() ? ! empty( $_POST['subdomain_install'] ) : true; |
|
363 | + } else { |
|
364 | + $subdomain_install = false; |
|
365 | + } |
|
354 | 366 | } else { |
355 | 367 | if ( is_multisite() ) { |
356 | 368 | $subdomain_install = is_subdomain_install(); |
@@ -421,8 +433,9 @@ discard block |
||
421 | 433 | <?php |
422 | 434 | $keys_salts = array( 'AUTH_KEY' => '', 'SECURE_AUTH_KEY' => '', 'LOGGED_IN_KEY' => '', 'NONCE_KEY' => '', 'AUTH_SALT' => '', 'SECURE_AUTH_SALT' => '', 'LOGGED_IN_SALT' => '', 'NONCE_SALT' => '' ); |
423 | 435 | foreach ( $keys_salts as $c => $v ) { |
424 | - if ( defined( $c ) ) |
|
425 | - unset( $keys_salts[ $c ] ); |
|
436 | + if ( defined( $c ) ) { |
|
437 | + unset( $keys_salts[ $c ] ); |
|
438 | + } |
|
426 | 439 | } |
427 | 440 | |
428 | 441 | if ( ! empty( $keys_salts ) ) { |
@@ -525,16 +538,19 @@ discard block |
||
525 | 538 | '<code>' . $home_path . '</code>' |
526 | 539 | ); |
527 | 540 | echo '</p>'; |
528 | - if ( ! $subdomain_install && WP_CONTENT_DIR != ABSPATH . 'wp-content' ) |
|
529 | - echo '<p><strong>' . __('Warning:') . ' ' . __( 'Subdirectory networks may not be fully compatible with custom wp-content directories.' ) . '</strong></p>'; |
|
541 | + if ( ! $subdomain_install && WP_CONTENT_DIR != ABSPATH . 'wp-content' ) { |
|
542 | + echo '<p><strong>' . __('Warning:') . ' ' . __( 'Subdirectory networks may not be fully compatible with custom wp-content directories.' ) . '</strong></p>'; |
|
543 | + } |
|
530 | 544 | ?> |
531 | 545 | <textarea class="code" readonly="readonly" cols="100" rows="20"><?php echo esc_textarea( $web_config_file ); ?> |
532 | 546 | </textarea></li> |
533 | 547 | </ol> |
534 | 548 | |
535 | - <?php else : // end iis7_supports_permalinks(). construct an htaccess file instead: |
|
549 | + <?php else { |
|
550 | + : // end iis7_supports_permalinks(). construct an htaccess file instead: |
|
536 | 551 | |
537 | 552 | $ms_files_rewriting = ''; |
553 | +} |
|
538 | 554 | if ( is_multisite() && get_site_option( 'ms_files_rewriting' ) ) { |
539 | 555 | $ms_files_rewriting = "\n# uploaded files\nRewriteRule ^"; |
540 | 556 | $ms_files_rewriting .= $subdir_match . "files/(.+) {$rewrite_base}" . WPINC . "/ms-files.php?file={$subdir_replacement_12} [L]" . "\n"; |
@@ -565,8 +581,9 @@ discard block |
||
565 | 581 | '<code>' . $home_path . '</code>' |
566 | 582 | ); |
567 | 583 | echo '</p>'; |
568 | - if ( ! $subdomain_install && WP_CONTENT_DIR != ABSPATH . 'wp-content' ) |
|
569 | - echo '<p><strong>' . __('Warning:') . ' ' . __( 'Subdirectory networks may not be fully compatible with custom wp-content directories.' ) . '</strong></p>'; |
|
584 | + if ( ! $subdomain_install && WP_CONTENT_DIR != ABSPATH . 'wp-content' ) { |
|
585 | + echo '<p><strong>' . __('Warning:') . ' ' . __( 'Subdirectory networks may not be fully compatible with custom wp-content directories.' ) . '</strong></p>'; |
|
586 | + } |
|
570 | 587 | ?> |
571 | 588 | <textarea class="code" readonly="readonly" cols="100" rows="<?php echo substr_count( $htaccess_file, "\n" ) + 1; ?>"> |
572 | 589 | <?php echo esc_textarea( $htaccess_file ); ?></textarea></li> |
@@ -51,13 +51,13 @@ discard block |
||
51 | 51 | */ |
52 | 52 | function allow_subdirectory_install() { |
53 | 53 | global $wpdb; |
54 | - /** |
|
55 | - * Filters whether to enable the subdirectory install feature in Multisite. |
|
56 | - * |
|
57 | - * @since 3.0.0 |
|
58 | - * |
|
59 | - * @param bool $allow Whether to enable the subdirectory install feature in Multisite. Default is false. |
|
60 | - */ |
|
54 | + /** |
|
55 | + * Filters whether to enable the subdirectory install feature in Multisite. |
|
56 | + * |
|
57 | + * @since 3.0.0 |
|
58 | + * |
|
59 | + * @param bool $allow Whether to enable the subdirectory install feature in Multisite. Default is false. |
|
60 | + */ |
|
61 | 61 | if ( apply_filters( 'allow_subdirectory_install', false ) ) |
62 | 62 | return true; |
63 | 63 | |
@@ -491,8 +491,8 @@ discard block |
||
491 | 491 | <match url="^' . $iis_subdir_match . 'files/(.+)" ignoreCase="false" /> |
492 | 492 | <action type="Rewrite" url="' . $iis_rewrite_base . WPINC . '/ms-files.php?file={R:1}" appendQueryString="false" /> |
493 | 493 | </rule>'; |
494 | - } |
|
495 | - $web_config_file .= ' |
|
494 | + } |
|
495 | + $web_config_file .= ' |
|
496 | 496 | <rule name="WordPress Rule 2" stopProcessing="true"> |
497 | 497 | <match url="^' . $iis_subdir_match . 'wp-admin$" ignoreCase="false" /> |
498 | 498 | <action type="Redirect" url="' . $iis_subdir_replacement . 'wp-admin/" redirectType="Permanent" /> |
@@ -19,9 +19,9 @@ discard block |
||
19 | 19 | function network_domain_check() { |
20 | 20 | global $wpdb; |
21 | 21 | |
22 | - $sql = $wpdb->prepare( "SHOW TABLES LIKE %s", $wpdb->esc_like( $wpdb->site ) ); |
|
23 | - if ( $wpdb->get_var( $sql ) ) { |
|
24 | - return $wpdb->get_var( "SELECT domain FROM $wpdb->site ORDER BY id ASC LIMIT 1" ); |
|
22 | + $sql = $wpdb->prepare("SHOW TABLES LIKE %s", $wpdb->esc_like($wpdb->site)); |
|
23 | + if ($wpdb->get_var($sql)) { |
|
24 | + return $wpdb->get_var("SELECT domain FROM $wpdb->site ORDER BY id ASC LIMIT 1"); |
|
25 | 25 | } |
26 | 26 | return false; |
27 | 27 | } |
@@ -33,8 +33,8 @@ discard block |
||
33 | 33 | * @return bool Whether subdomain install is allowed |
34 | 34 | */ |
35 | 35 | function allow_subdomain_install() { |
36 | - $domain = preg_replace( '|https?://([^/]+)|', '$1', get_option( 'home' ) ); |
|
37 | - if ( parse_url( get_option( 'home' ), PHP_URL_PATH ) || 'localhost' == $domain || preg_match( '|^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$|', $domain ) ) |
|
36 | + $domain = preg_replace('|https?://([^/]+)|', '$1', get_option('home')); |
|
37 | + if (parse_url(get_option('home'), PHP_URL_PATH) || 'localhost' == $domain || preg_match('|^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$|', $domain)) |
|
38 | 38 | return false; |
39 | 39 | |
40 | 40 | return true; |
@@ -58,14 +58,14 @@ discard block |
||
58 | 58 | * |
59 | 59 | * @param bool $allow Whether to enable the subdirectory install feature in Multisite. Default is false. |
60 | 60 | */ |
61 | - if ( apply_filters( 'allow_subdirectory_install', false ) ) |
|
61 | + if (apply_filters('allow_subdirectory_install', false)) |
|
62 | 62 | return true; |
63 | 63 | |
64 | - if ( defined( 'ALLOW_SUBDIRECTORY_INSTALL' ) && ALLOW_SUBDIRECTORY_INSTALL ) |
|
64 | + if (defined('ALLOW_SUBDIRECTORY_INSTALL') && ALLOW_SUBDIRECTORY_INSTALL) |
|
65 | 65 | return true; |
66 | 66 | |
67 | - $post = $wpdb->get_row( "SELECT ID FROM $wpdb->posts WHERE post_date < DATE_SUB(NOW(), INTERVAL 1 MONTH) AND post_status = 'publish'" ); |
|
68 | - if ( empty( $post ) ) |
|
67 | + $post = $wpdb->get_row("SELECT ID FROM $wpdb->posts WHERE post_date < DATE_SUB(NOW(), INTERVAL 1 MONTH) AND post_status = 'publish'"); |
|
68 | + if (empty($post)) |
|
69 | 69 | return true; |
70 | 70 | |
71 | 71 | return false; |
@@ -78,11 +78,11 @@ discard block |
||
78 | 78 | * @return string Base domain. |
79 | 79 | */ |
80 | 80 | function get_clean_basedomain() { |
81 | - if ( $existing_domain = network_domain_check() ) |
|
81 | + if ($existing_domain = network_domain_check()) |
|
82 | 82 | return $existing_domain; |
83 | - $domain = preg_replace( '|https?://|', '', get_option( 'siteurl' ) ); |
|
84 | - if ( $slash = strpos( $domain, '/' ) ) |
|
85 | - $domain = substr( $domain, 0, $slash ); |
|
83 | + $domain = preg_replace('|https?://|', '', get_option('siteurl')); |
|
84 | + if ($slash = strpos($domain, '/')) |
|
85 | + $domain = substr($domain, 0, $slash); |
|
86 | 86 | return $domain; |
87 | 87 | } |
88 | 88 | |
@@ -98,97 +98,97 @@ discard block |
||
98 | 98 | * |
99 | 99 | * @param WP_Error $errors |
100 | 100 | */ |
101 | -function network_step1( $errors = false ) { |
|
101 | +function network_step1($errors = false) { |
|
102 | 102 | global $is_apache; |
103 | 103 | |
104 | - if ( defined('DO_NOT_UPGRADE_GLOBAL_TABLES') ) { |
|
105 | - echo '<div class="error"><p><strong>' . __('ERROR:') . '</strong> ' . __( 'The constant DO_NOT_UPGRADE_GLOBAL_TABLES cannot be defined when creating a network.' ) . '</p></div>'; |
|
104 | + if (defined('DO_NOT_UPGRADE_GLOBAL_TABLES')) { |
|
105 | + echo '<div class="error"><p><strong>'.__('ERROR:').'</strong> '.__('The constant DO_NOT_UPGRADE_GLOBAL_TABLES cannot be defined when creating a network.').'</p></div>'; |
|
106 | 106 | echo '</div>'; |
107 | - include( ABSPATH . 'wp-admin/admin-footer.php' ); |
|
107 | + include(ABSPATH.'wp-admin/admin-footer.php'); |
|
108 | 108 | die(); |
109 | 109 | } |
110 | 110 | |
111 | - $active_plugins = get_option( 'active_plugins' ); |
|
112 | - if ( ! empty( $active_plugins ) ) { |
|
113 | - echo '<div class="updated"><p><strong>' . __('Warning:') . '</strong> ' . sprintf( __( 'Please <a href="%s">deactivate your plugins</a> before enabling the Network feature.' ), admin_url( 'plugins.php?plugin_status=active' ) ) . '</p></div><p>' . __( 'Once the network is created, you may reactivate your plugins.' ) . '</p>'; |
|
111 | + $active_plugins = get_option('active_plugins'); |
|
112 | + if ( ! empty($active_plugins)) { |
|
113 | + echo '<div class="updated"><p><strong>'.__('Warning:').'</strong> '.sprintf(__('Please <a href="%s">deactivate your plugins</a> before enabling the Network feature.'), admin_url('plugins.php?plugin_status=active')).'</p></div><p>'.__('Once the network is created, you may reactivate your plugins.').'</p>'; |
|
114 | 114 | echo '</div>'; |
115 | - include( ABSPATH . 'wp-admin/admin-footer.php' ); |
|
115 | + include(ABSPATH.'wp-admin/admin-footer.php'); |
|
116 | 116 | die(); |
117 | 117 | } |
118 | 118 | |
119 | 119 | $hostname = get_clean_basedomain(); |
120 | - $has_ports = strstr( $hostname, ':' ); |
|
121 | - if ( ( false !== $has_ports && ! in_array( $has_ports, array( ':80', ':443' ) ) ) ) { |
|
122 | - echo '<div class="error"><p><strong>' . __( 'ERROR:') . '</strong> ' . __( 'You cannot install a network of sites with your server address.' ) . '</p></div>'; |
|
123 | - echo '<p>' . sprintf( |
|
120 | + $has_ports = strstr($hostname, ':'); |
|
121 | + if ((false !== $has_ports && ! in_array($has_ports, array(':80', ':443')))) { |
|
122 | + echo '<div class="error"><p><strong>'.__('ERROR:').'</strong> '.__('You cannot install a network of sites with your server address.').'</p></div>'; |
|
123 | + echo '<p>'.sprintf( |
|
124 | 124 | /* translators: %s: port number */ |
125 | - __( 'You cannot use port numbers such as %s.' ), |
|
126 | - '<code>' . $has_ports . '</code>' |
|
127 | - ) . '</p>'; |
|
128 | - echo '<a href="' . esc_url( admin_url() ) . '">' . __( 'Return to Dashboard' ) . '</a>'; |
|
125 | + __('You cannot use port numbers such as %s.'), |
|
126 | + '<code>'.$has_ports.'</code>' |
|
127 | + ).'</p>'; |
|
128 | + echo '<a href="'.esc_url(admin_url()).'">'.__('Return to Dashboard').'</a>'; |
|
129 | 129 | echo '</div>'; |
130 | - include( ABSPATH . 'wp-admin/admin-footer.php' ); |
|
130 | + include(ABSPATH.'wp-admin/admin-footer.php'); |
|
131 | 131 | die(); |
132 | 132 | } |
133 | 133 | |
134 | 134 | echo '<form method="post">'; |
135 | 135 | |
136 | - wp_nonce_field( 'install-network-1' ); |
|
136 | + wp_nonce_field('install-network-1'); |
|
137 | 137 | |
138 | 138 | $error_codes = array(); |
139 | - if ( is_wp_error( $errors ) ) { |
|
140 | - echo '<div class="error"><p><strong>' . __( 'ERROR: The network could not be created.' ) . '</strong></p>'; |
|
141 | - foreach ( $errors->get_error_messages() as $error ) |
|
139 | + if (is_wp_error($errors)) { |
|
140 | + echo '<div class="error"><p><strong>'.__('ERROR: The network could not be created.').'</strong></p>'; |
|
141 | + foreach ($errors->get_error_messages() as $error) |
|
142 | 142 | echo "<p>$error</p>"; |
143 | 143 | echo '</div>'; |
144 | 144 | $error_codes = $errors->get_error_codes(); |
145 | 145 | } |
146 | 146 | |
147 | - if ( ! empty( $_POST['sitename'] ) && ! in_array( 'empty_sitename', $error_codes ) ) { |
|
147 | + if ( ! empty($_POST['sitename']) && ! in_array('empty_sitename', $error_codes)) { |
|
148 | 148 | $site_name = $_POST['sitename']; |
149 | 149 | } else { |
150 | 150 | /* translators: %s: Default network name */ |
151 | - $site_name = sprintf( __( '%s Sites' ), get_option( 'blogname' ) ); |
|
151 | + $site_name = sprintf(__('%s Sites'), get_option('blogname')); |
|
152 | 152 | } |
153 | 153 | |
154 | - if ( ! empty( $_POST['email'] ) && ! in_array( 'invalid_email', $error_codes ) ) { |
|
154 | + if ( ! empty($_POST['email']) && ! in_array('invalid_email', $error_codes)) { |
|
155 | 155 | $admin_email = $_POST['email']; |
156 | 156 | } else { |
157 | - $admin_email = get_option( 'admin_email' ); |
|
157 | + $admin_email = get_option('admin_email'); |
|
158 | 158 | } |
159 | 159 | ?> |
160 | - <p><?php _e( 'Welcome to the Network installation process!' ); ?></p> |
|
161 | - <p><?php _e( 'Fill in the information below and you’ll be on your way to creating a network of WordPress sites. We will create configuration files in the next step.' ); ?></p> |
|
160 | + <p><?php _e('Welcome to the Network installation process!'); ?></p> |
|
161 | + <p><?php _e('Fill in the information below and you’ll be on your way to creating a network of WordPress sites. We will create configuration files in the next step.'); ?></p> |
|
162 | 162 | <?php |
163 | 163 | |
164 | - if ( isset( $_POST['subdomain_install'] ) ) { |
|
164 | + if (isset($_POST['subdomain_install'])) { |
|
165 | 165 | $subdomain_install = (bool) $_POST['subdomain_install']; |
166 | - } elseif ( apache_mod_loaded('mod_rewrite') ) { // assume nothing |
|
166 | + } elseif (apache_mod_loaded('mod_rewrite')) { // assume nothing |
|
167 | 167 | $subdomain_install = true; |
168 | - } elseif ( !allow_subdirectory_install() ) { |
|
168 | + } elseif ( ! allow_subdirectory_install()) { |
|
169 | 169 | $subdomain_install = true; |
170 | 170 | } else { |
171 | 171 | $subdomain_install = false; |
172 | - if ( $got_mod_rewrite = got_mod_rewrite() ) { // dangerous assumptions |
|
173 | - echo '<div class="updated inline"><p><strong>' . __( 'Note:' ) . '</strong> '; |
|
172 | + if ($got_mod_rewrite = got_mod_rewrite()) { // dangerous assumptions |
|
173 | + echo '<div class="updated inline"><p><strong>'.__('Note:').'</strong> '; |
|
174 | 174 | /* translators: %s: mod_rewrite */ |
175 | - printf( __( 'Please make sure the Apache %s module is installed as it will be used at the end of this installation.' ), |
|
175 | + printf(__('Please make sure the Apache %s module is installed as it will be used at the end of this installation.'), |
|
176 | 176 | '<code>mod_rewrite</code>' |
177 | 177 | ); |
178 | 178 | echo '</p>'; |
179 | - } elseif ( $is_apache ) { |
|
180 | - echo '<div class="error inline"><p><strong>' . __( 'Warning!' ) . '</strong> '; |
|
179 | + } elseif ($is_apache) { |
|
180 | + echo '<div class="error inline"><p><strong>'.__('Warning!').'</strong> '; |
|
181 | 181 | /* translators: %s: mod_rewrite */ |
182 | - printf( __( 'It looks like the Apache %s module is not installed.' ), |
|
182 | + printf(__('It looks like the Apache %s module is not installed.'), |
|
183 | 183 | '<code>mod_rewrite</code>' |
184 | 184 | ); |
185 | 185 | echo '</p>'; |
186 | 186 | } |
187 | 187 | |
188 | - if ( $got_mod_rewrite || $is_apache ) { // Protect against mod_rewrite mimicry (but ! Apache) |
|
188 | + if ($got_mod_rewrite || $is_apache) { // Protect against mod_rewrite mimicry (but ! Apache) |
|
189 | 189 | echo '<p>'; |
190 | 190 | /* translators: 1: mod_rewrite, 2: mod_rewrite documentation URL, 3: Google search for mod_rewrite */ |
191 | - printf( __( 'If %1$s is disabled, ask your administrator to enable that module, or look at the <a href="%2$s">Apache documentation</a> or <a href="%3$s">elsewhere</a> for help setting it up.' ), |
|
191 | + printf(__('If %1$s is disabled, ask your administrator to enable that module, or look at the <a href="%2$s">Apache documentation</a> or <a href="%3$s">elsewhere</a> for help setting it up.'), |
|
192 | 192 | '<code>mod_rewrite</code>', |
193 | 193 | 'https://httpd.apache.org/docs/mod/mod_rewrite.html', |
194 | 194 | 'https://www.google.com/search?q=apache+mod_rewrite' |
@@ -197,26 +197,26 @@ discard block |
||
197 | 197 | } |
198 | 198 | } |
199 | 199 | |
200 | - if ( allow_subdomain_install() && allow_subdirectory_install() ) : ?> |
|
201 | - <h3><?php esc_html_e( 'Addresses of Sites in your Network' ); ?></h3> |
|
202 | - <p><?php _e( 'Please choose whether you would like sites in your WordPress network to use sub-domains or sub-directories.' ); ?> |
|
203 | - <strong><?php _e( 'You cannot change this later.' ); ?></strong></p> |
|
204 | - <p><?php _e( 'You will need a wildcard DNS record if you are going to use the virtual host (sub-domain) functionality.' ); ?></p> |
|
200 | + if (allow_subdomain_install() && allow_subdirectory_install()) : ?> |
|
201 | + <h3><?php esc_html_e('Addresses of Sites in your Network'); ?></h3> |
|
202 | + <p><?php _e('Please choose whether you would like sites in your WordPress network to use sub-domains or sub-directories.'); ?> |
|
203 | + <strong><?php _e('You cannot change this later.'); ?></strong></p> |
|
204 | + <p><?php _e('You will need a wildcard DNS record if you are going to use the virtual host (sub-domain) functionality.'); ?></p> |
|
205 | 205 | <?php // @todo: Link to an MS readme? ?> |
206 | 206 | <table class="form-table"> |
207 | 207 | <tr> |
208 | - <th><label><input type="radio" name="subdomain_install" value="1"<?php checked( $subdomain_install ); ?> /> <?php _e( 'Sub-domains' ); ?></label></th> |
|
208 | + <th><label><input type="radio" name="subdomain_install" value="1"<?php checked($subdomain_install); ?> /> <?php _e('Sub-domains'); ?></label></th> |
|
209 | 209 | <td><?php printf( |
210 | 210 | /* translators: 1: hostname */ |
211 | - _x( 'like <code>site1.%1$s</code> and <code>site2.%1$s</code>', 'subdomain examples' ), |
|
211 | + _x('like <code>site1.%1$s</code> and <code>site2.%1$s</code>', 'subdomain examples'), |
|
212 | 212 | $hostname |
213 | 213 | ); ?></td> |
214 | 214 | </tr> |
215 | 215 | <tr> |
216 | - <th><label><input type="radio" name="subdomain_install" value="0"<?php checked( ! $subdomain_install ); ?> /> <?php _e( 'Sub-directories' ); ?></label></th> |
|
216 | + <th><label><input type="radio" name="subdomain_install" value="0"<?php checked( ! $subdomain_install); ?> /> <?php _e('Sub-directories'); ?></label></th> |
|
217 | 217 | <td><?php printf( |
218 | 218 | /* translators: 1: hostname */ |
219 | - _x( 'like <code>%1$s/site1</code> and <code>%1$s/site2</code>', 'subdirectory examples' ), |
|
219 | + _x('like <code>%1$s/site1</code> and <code>%1$s/site2</code>', 'subdirectory examples'), |
|
220 | 220 | $hostname |
221 | 221 | ); ?></td> |
222 | 222 | </tr> |
@@ -225,101 +225,101 @@ discard block |
||
225 | 225 | <?php |
226 | 226 | endif; |
227 | 227 | |
228 | - if ( WP_CONTENT_DIR != ABSPATH . 'wp-content' && ( allow_subdirectory_install() || ! allow_subdomain_install() ) ) |
|
229 | - echo '<div class="error inline"><p><strong>' . __('Warning!') . '</strong> ' . __( 'Subdirectory networks may not be fully compatible with custom wp-content directories.' ) . '</p></div>'; |
|
228 | + if (WP_CONTENT_DIR != ABSPATH.'wp-content' && (allow_subdirectory_install() || ! allow_subdomain_install())) |
|
229 | + echo '<div class="error inline"><p><strong>'.__('Warning!').'</strong> '.__('Subdirectory networks may not be fully compatible with custom wp-content directories.').'</p></div>'; |
|
230 | 230 | |
231 | - $is_www = ( 0 === strpos( $hostname, 'www.' ) ); |
|
232 | - if ( $is_www ) : |
|
231 | + $is_www = (0 === strpos($hostname, 'www.')); |
|
232 | + if ($is_www) : |
|
233 | 233 | ?> |
234 | - <h3><?php esc_html_e( 'Server Address' ); ?></h3> |
|
234 | + <h3><?php esc_html_e('Server Address'); ?></h3> |
|
235 | 235 | <p><?php printf( |
236 | 236 | /* translators: 1: site url 2: host name 3. www */ |
237 | - __( 'We recommend you change your siteurl to %1$s before enabling the network feature. It will still be possible to visit your site using the %3$s prefix with an address like %2$s but any links will not have the %3$s prefix.' ), |
|
238 | - '<code>' . substr( $hostname, 4 ) . '</code>', |
|
239 | - '<code>' . $hostname . '</code>', |
|
237 | + __('We recommend you change your siteurl to %1$s before enabling the network feature. It will still be possible to visit your site using the %3$s prefix with an address like %2$s but any links will not have the %3$s prefix.'), |
|
238 | + '<code>'.substr($hostname, 4).'</code>', |
|
239 | + '<code>'.$hostname.'</code>', |
|
240 | 240 | '<code>www</code>' |
241 | 241 | ); ?></p> |
242 | 242 | <table class="form-table"> |
243 | 243 | <tr> |
244 | - <th scope='row'><?php esc_html_e( 'Server Address' ); ?></th> |
|
244 | + <th scope='row'><?php esc_html_e('Server Address'); ?></th> |
|
245 | 245 | <td> |
246 | 246 | <?php printf( |
247 | 247 | /* translators: %s: host name */ |
248 | - __( 'The internet address of your network will be %s.' ), |
|
249 | - '<code>' . $hostname . '</code>' |
|
248 | + __('The internet address of your network will be %s.'), |
|
249 | + '<code>'.$hostname.'</code>' |
|
250 | 250 | ); ?> |
251 | 251 | </td> |
252 | 252 | </tr> |
253 | 253 | </table> |
254 | 254 | <?php endif; ?> |
255 | 255 | |
256 | - <h3><?php esc_html_e( 'Network Details' ); ?></h3> |
|
256 | + <h3><?php esc_html_e('Network Details'); ?></h3> |
|
257 | 257 | <table class="form-table"> |
258 | - <?php if ( 'localhost' == $hostname ) : ?> |
|
258 | + <?php if ('localhost' == $hostname) : ?> |
|
259 | 259 | <tr> |
260 | - <th scope="row"><?php esc_html_e( 'Sub-directory Install' ); ?></th> |
|
260 | + <th scope="row"><?php esc_html_e('Sub-directory Install'); ?></th> |
|
261 | 261 | <td><?php |
262 | 262 | printf( |
263 | 263 | /* translators: 1: localhost 2: localhost.localdomain */ |
264 | - __( 'Because you are using %1$s, the sites in your WordPress network must use sub-directories. Consider using %2$s if you wish to use sub-domains.' ), |
|
264 | + __('Because you are using %1$s, the sites in your WordPress network must use sub-directories. Consider using %2$s if you wish to use sub-domains.'), |
|
265 | 265 | '<code>localhost</code>', |
266 | 266 | '<code>localhost.localdomain</code>' |
267 | 267 | ); |
268 | 268 | // Uh oh: |
269 | - if ( !allow_subdirectory_install() ) |
|
270 | - echo ' <strong>' . __( 'Warning!' ) . ' ' . __( 'The main site in a sub-directory install will need to use a modified permalink structure, potentially breaking existing links.' ) . '</strong>'; |
|
269 | + if ( ! allow_subdirectory_install()) |
|
270 | + echo ' <strong>'.__('Warning!').' '.__('The main site in a sub-directory install will need to use a modified permalink structure, potentially breaking existing links.').'</strong>'; |
|
271 | 271 | ?></td> |
272 | 272 | </tr> |
273 | - <?php elseif ( !allow_subdomain_install() ) : ?> |
|
273 | + <?php elseif ( ! allow_subdomain_install()) : ?> |
|
274 | 274 | <tr> |
275 | - <th scope="row"><?php esc_html_e( 'Sub-directory Install' ); ?></th> |
|
275 | + <th scope="row"><?php esc_html_e('Sub-directory Install'); ?></th> |
|
276 | 276 | <td><?php |
277 | - _e( 'Because your install is in a directory, the sites in your WordPress network must use sub-directories.' ); |
|
277 | + _e('Because your install is in a directory, the sites in your WordPress network must use sub-directories.'); |
|
278 | 278 | // Uh oh: |
279 | - if ( !allow_subdirectory_install() ) |
|
280 | - echo ' <strong>' . __( 'Warning!' ) . ' ' . __( 'The main site in a sub-directory install will need to use a modified permalink structure, potentially breaking existing links.' ) . '</strong>'; |
|
279 | + if ( ! allow_subdirectory_install()) |
|
280 | + echo ' <strong>'.__('Warning!').' '.__('The main site in a sub-directory install will need to use a modified permalink structure, potentially breaking existing links.').'</strong>'; |
|
281 | 281 | ?></td> |
282 | 282 | </tr> |
283 | - <?php elseif ( !allow_subdirectory_install() ) : ?> |
|
283 | + <?php elseif ( ! allow_subdirectory_install()) : ?> |
|
284 | 284 | <tr> |
285 | - <th scope="row"><?php esc_html_e( 'Sub-domain Install' ); ?></th> |
|
286 | - <td><?php _e( 'Because your install is not new, the sites in your WordPress network must use sub-domains.' ); |
|
287 | - echo ' <strong>' . __( 'The main site in a sub-directory install will need to use a modified permalink structure, potentially breaking existing links.' ) . '</strong>'; |
|
285 | + <th scope="row"><?php esc_html_e('Sub-domain Install'); ?></th> |
|
286 | + <td><?php _e('Because your install is not new, the sites in your WordPress network must use sub-domains.'); |
|
287 | + echo ' <strong>'.__('The main site in a sub-directory install will need to use a modified permalink structure, potentially breaking existing links.').'</strong>'; |
|
288 | 288 | ?></td> |
289 | 289 | </tr> |
290 | 290 | <?php endif; ?> |
291 | - <?php if ( ! $is_www ) : ?> |
|
291 | + <?php if ( ! $is_www) : ?> |
|
292 | 292 | <tr> |
293 | - <th scope='row'><?php esc_html_e( 'Server Address' ); ?></th> |
|
293 | + <th scope='row'><?php esc_html_e('Server Address'); ?></th> |
|
294 | 294 | <td> |
295 | 295 | <?php printf( |
296 | 296 | /* translators: %s: host name */ |
297 | - __( 'The internet address of your network will be %s.' ), |
|
298 | - '<code>' . $hostname . '</code>' |
|
297 | + __('The internet address of your network will be %s.'), |
|
298 | + '<code>'.$hostname.'</code>' |
|
299 | 299 | ); ?> |
300 | 300 | </td> |
301 | 301 | </tr> |
302 | 302 | <?php endif; ?> |
303 | 303 | <tr> |
304 | - <th scope='row'><?php esc_html_e( 'Network Title' ); ?></th> |
|
304 | + <th scope='row'><?php esc_html_e('Network Title'); ?></th> |
|
305 | 305 | <td> |
306 | - <input name='sitename' type='text' size='45' value='<?php echo esc_attr( $site_name ); ?>' /> |
|
306 | + <input name='sitename' type='text' size='45' value='<?php echo esc_attr($site_name); ?>' /> |
|
307 | 307 | <p class="description"> |
308 | - <?php _e( 'What would you like to call your network?' ); ?> |
|
308 | + <?php _e('What would you like to call your network?'); ?> |
|
309 | 309 | </p> |
310 | 310 | </td> |
311 | 311 | </tr> |
312 | 312 | <tr> |
313 | - <th scope='row'><?php esc_html_e( 'Network Admin Email' ); ?></th> |
|
313 | + <th scope='row'><?php esc_html_e('Network Admin Email'); ?></th> |
|
314 | 314 | <td> |
315 | - <input name='email' type='text' size='45' value='<?php echo esc_attr( $admin_email ); ?>' /> |
|
315 | + <input name='email' type='text' size='45' value='<?php echo esc_attr($admin_email); ?>' /> |
|
316 | 316 | <p class="description"> |
317 | - <?php _e( 'Your email address.' ); ?> |
|
317 | + <?php _e('Your email address.'); ?> |
|
318 | 318 | </p> |
319 | 319 | </td> |
320 | 320 | </tr> |
321 | 321 | </table> |
322 | - <?php submit_button( __( 'Install' ), 'primary', 'submit' ); ?> |
|
322 | + <?php submit_button(__('Install'), 'primary', 'submit'); ?> |
|
323 | 323 | </form> |
324 | 324 | <?php |
325 | 325 | } |
@@ -333,45 +333,45 @@ discard block |
||
333 | 333 | * |
334 | 334 | * @param WP_Error $errors |
335 | 335 | */ |
336 | -function network_step2( $errors = false ) { |
|
336 | +function network_step2($errors = false) { |
|
337 | 337 | global $wpdb; |
338 | 338 | |
339 | 339 | $hostname = get_clean_basedomain(); |
340 | - $slashed_home = trailingslashit( get_option( 'home' ) ); |
|
341 | - $base = parse_url( $slashed_home, PHP_URL_PATH ); |
|
342 | - $document_root_fix = str_replace( '\\', '/', realpath( $_SERVER['DOCUMENT_ROOT'] ) ); |
|
343 | - $abspath_fix = str_replace( '\\', '/', ABSPATH ); |
|
344 | - $home_path = 0 === strpos( $abspath_fix, $document_root_fix ) ? $document_root_fix . $base : get_home_path(); |
|
345 | - $wp_siteurl_subdir = preg_replace( '#^' . preg_quote( $home_path, '#' ) . '#', '', $abspath_fix ); |
|
346 | - $rewrite_base = ! empty( $wp_siteurl_subdir ) ? ltrim( trailingslashit( $wp_siteurl_subdir ), '/' ) : ''; |
|
340 | + $slashed_home = trailingslashit(get_option('home')); |
|
341 | + $base = parse_url($slashed_home, PHP_URL_PATH); |
|
342 | + $document_root_fix = str_replace('\\', '/', realpath($_SERVER['DOCUMENT_ROOT'])); |
|
343 | + $abspath_fix = str_replace('\\', '/', ABSPATH); |
|
344 | + $home_path = 0 === strpos($abspath_fix, $document_root_fix) ? $document_root_fix.$base : get_home_path(); |
|
345 | + $wp_siteurl_subdir = preg_replace('#^'.preg_quote($home_path, '#').'#', '', $abspath_fix); |
|
346 | + $rewrite_base = ! empty($wp_siteurl_subdir) ? ltrim(trailingslashit($wp_siteurl_subdir), '/') : ''; |
|
347 | 347 | |
348 | 348 | |
349 | 349 | $location_of_wp_config = $abspath_fix; |
350 | - if ( ! file_exists( ABSPATH . 'wp-config.php' ) && file_exists( dirname( ABSPATH ) . '/wp-config.php' ) ) { |
|
351 | - $location_of_wp_config = dirname( $abspath_fix ); |
|
350 | + if ( ! file_exists(ABSPATH.'wp-config.php') && file_exists(dirname(ABSPATH).'/wp-config.php')) { |
|
351 | + $location_of_wp_config = dirname($abspath_fix); |
|
352 | 352 | } |
353 | - $location_of_wp_config = trailingslashit( $location_of_wp_config ); |
|
353 | + $location_of_wp_config = trailingslashit($location_of_wp_config); |
|
354 | 354 | |
355 | 355 | // Wildcard DNS message. |
356 | - if ( is_wp_error( $errors ) ) |
|
357 | - echo '<div class="error">' . $errors->get_error_message() . '</div>'; |
|
356 | + if (is_wp_error($errors)) |
|
357 | + echo '<div class="error">'.$errors->get_error_message().'</div>'; |
|
358 | 358 | |
359 | - if ( $_POST ) { |
|
360 | - if ( allow_subdomain_install() ) |
|
361 | - $subdomain_install = allow_subdirectory_install() ? ! empty( $_POST['subdomain_install'] ) : true; |
|
359 | + if ($_POST) { |
|
360 | + if (allow_subdomain_install()) |
|
361 | + $subdomain_install = allow_subdirectory_install() ? ! empty($_POST['subdomain_install']) : true; |
|
362 | 362 | else |
363 | 363 | $subdomain_install = false; |
364 | 364 | } else { |
365 | - if ( is_multisite() ) { |
|
365 | + if (is_multisite()) { |
|
366 | 366 | $subdomain_install = is_subdomain_install(); |
367 | 367 | ?> |
368 | - <p><?php _e( 'The original configuration steps are shown here for reference.' ); ?></p> |
|
368 | + <p><?php _e('The original configuration steps are shown here for reference.'); ?></p> |
|
369 | 369 | <?php |
370 | 370 | } else { |
371 | - $subdomain_install = (bool) $wpdb->get_var( "SELECT meta_value FROM $wpdb->sitemeta WHERE site_id = 1 AND meta_key = 'subdomain_install'" ); |
|
371 | + $subdomain_install = (bool) $wpdb->get_var("SELECT meta_value FROM $wpdb->sitemeta WHERE site_id = 1 AND meta_key = 'subdomain_install'"); |
|
372 | 372 | ?> |
373 | - <div class="error"><p><strong><?php _e('Warning:'); ?></strong> <?php _e( 'An existing WordPress network was detected.' ); ?></p></div> |
|
374 | - <p><?php _e( 'Please complete the configuration steps. To create a new network, you will need to empty or remove the network database tables.' ); ?></p> |
|
373 | + <div class="error"><p><strong><?php _e('Warning:'); ?></strong> <?php _e('An existing WordPress network was detected.'); ?></p></div> |
|
374 | + <p><?php _e('Please complete the configuration steps. To create a new network, you will need to empty or remove the network database tables.'); ?></p> |
|
375 | 375 | <?php |
376 | 376 | } |
377 | 377 | } |
@@ -380,32 +380,32 @@ discard block |
||
380 | 380 | $subdir_replacement_01 = $subdomain_install ? '' : '$1'; |
381 | 381 | $subdir_replacement_12 = $subdomain_install ? '$1' : '$2'; |
382 | 382 | |
383 | - if ( $_POST || ! is_multisite() ) { |
|
383 | + if ($_POST || ! is_multisite()) { |
|
384 | 384 | ?> |
385 | - <h3><?php esc_html_e( 'Enabling the Network' ); ?></h3> |
|
386 | - <p><?php _e( 'Complete the following steps to enable the features for creating a network of sites.' ); ?></p> |
|
385 | + <h3><?php esc_html_e('Enabling the Network'); ?></h3> |
|
386 | + <p><?php _e('Complete the following steps to enable the features for creating a network of sites.'); ?></p> |
|
387 | 387 | <div class="updated inline"><p><?php |
388 | - if ( file_exists( $home_path . '.htaccess' ) ) { |
|
389 | - echo '<strong>' . __( 'Caution:' ) . '</strong> '; |
|
388 | + if (file_exists($home_path.'.htaccess')) { |
|
389 | + echo '<strong>'.__('Caution:').'</strong> '; |
|
390 | 390 | printf( |
391 | 391 | /* translators: 1: wp-config.php 2: .htaccess */ |
392 | - __( 'We recommend you back up your existing %1$s and %2$s files.' ), |
|
392 | + __('We recommend you back up your existing %1$s and %2$s files.'), |
|
393 | 393 | '<code>wp-config.php</code>', |
394 | 394 | '<code>.htaccess</code>' |
395 | 395 | ); |
396 | - } elseif ( file_exists( $home_path . 'web.config' ) ) { |
|
397 | - echo '<strong>' . __( 'Caution:' ) . '</strong> '; |
|
396 | + } elseif (file_exists($home_path.'web.config')) { |
|
397 | + echo '<strong>'.__('Caution:').'</strong> '; |
|
398 | 398 | printf( |
399 | 399 | /* translators: 1: wp-config.php 2: web.config */ |
400 | - __( 'We recommend you back up your existing %1$s and %2$s files.' ), |
|
400 | + __('We recommend you back up your existing %1$s and %2$s files.'), |
|
401 | 401 | '<code>wp-config.php</code>', |
402 | 402 | '<code>web.config</code>' |
403 | 403 | ); |
404 | 404 | } else { |
405 | - echo '<strong>' . __( 'Caution:' ) . '</strong> '; |
|
405 | + echo '<strong>'.__('Caution:').'</strong> '; |
|
406 | 406 | printf( |
407 | 407 | /* translators: 1: wp-config.php */ |
408 | - __( 'We recommend you back up your existing %s file.' ), |
|
408 | + __('We recommend you back up your existing %s file.'), |
|
409 | 409 | '<code>wp-config.php</code>' |
410 | 410 | ); |
411 | 411 | } |
@@ -416,15 +416,15 @@ discard block |
||
416 | 416 | <ol> |
417 | 417 | <li><p><?php printf( |
418 | 418 | /* translators: 1: wp-config.php 2: location of wp-config file, 3: translated version of "That's all, stop editing! Happy blogging." */ |
419 | - __( 'Add the following to your %1$s file in %2$s <strong>above</strong> the line reading %3$s:' ), |
|
419 | + __('Add the following to your %1$s file in %2$s <strong>above</strong> the line reading %3$s:'), |
|
420 | 420 | '<code>wp-config.php</code>', |
421 | - '<code>' . $location_of_wp_config . '</code>', |
|
421 | + '<code>'.$location_of_wp_config.'</code>', |
|
422 | 422 | /* |
423 | 423 | * translators: This string should only be translated if wp-config-sample.php is localized. |
424 | 424 | * You can check the localized release package or |
425 | 425 | * https://i18n.svn.wordpress.org/<locale code>/branches/<wp version>/dist/wp-config-sample.php |
426 | 426 | */ |
427 | - '<code>/* ' . __( 'That’s all, stop editing! Happy blogging.' ) . ' */</code>' |
|
427 | + '<code>/* '.__('That’s all, stop editing! Happy blogging.').' */</code>' |
|
428 | 428 | ); ?></p> |
429 | 429 | <textarea class="code" readonly="readonly" cols="100" rows="7"> |
430 | 430 | define('MULTISITE', true); |
@@ -435,55 +435,55 @@ discard block |
||
435 | 435 | define('BLOG_ID_CURRENT_SITE', 1); |
436 | 436 | </textarea> |
437 | 437 | <?php |
438 | - $keys_salts = array( 'AUTH_KEY' => '', 'SECURE_AUTH_KEY' => '', 'LOGGED_IN_KEY' => '', 'NONCE_KEY' => '', 'AUTH_SALT' => '', 'SECURE_AUTH_SALT' => '', 'LOGGED_IN_SALT' => '', 'NONCE_SALT' => '' ); |
|
439 | - foreach ( $keys_salts as $c => $v ) { |
|
440 | - if ( defined( $c ) ) |
|
441 | - unset( $keys_salts[ $c ] ); |
|
438 | + $keys_salts = array('AUTH_KEY' => '', 'SECURE_AUTH_KEY' => '', 'LOGGED_IN_KEY' => '', 'NONCE_KEY' => '', 'AUTH_SALT' => '', 'SECURE_AUTH_SALT' => '', 'LOGGED_IN_SALT' => '', 'NONCE_SALT' => ''); |
|
439 | + foreach ($keys_salts as $c => $v) { |
|
440 | + if (defined($c)) |
|
441 | + unset($keys_salts[$c]); |
|
442 | 442 | } |
443 | 443 | |
444 | - if ( ! empty( $keys_salts ) ) { |
|
444 | + if ( ! empty($keys_salts)) { |
|
445 | 445 | $keys_salts_str = ''; |
446 | - $from_api = wp_remote_get( 'https://api.wordpress.org/secret-key/1.1/salt/' ); |
|
447 | - if ( is_wp_error( $from_api ) ) { |
|
448 | - foreach ( $keys_salts as $c => $v ) { |
|
449 | - $keys_salts_str .= "\ndefine( '$c', '" . wp_generate_password( 64, true, true ) . "' );"; |
|
446 | + $from_api = wp_remote_get('https://api.wordpress.org/secret-key/1.1/salt/'); |
|
447 | + if (is_wp_error($from_api)) { |
|
448 | + foreach ($keys_salts as $c => $v) { |
|
449 | + $keys_salts_str .= "\ndefine( '$c', '".wp_generate_password(64, true, true)."' );"; |
|
450 | 450 | } |
451 | 451 | } else { |
452 | - $from_api = explode( "\n", wp_remote_retrieve_body( $from_api ) ); |
|
453 | - foreach ( $keys_salts as $c => $v ) { |
|
454 | - $keys_salts_str .= "\ndefine( '$c', '" . substr( array_shift( $from_api ), 28, 64 ) . "' );"; |
|
452 | + $from_api = explode("\n", wp_remote_retrieve_body($from_api)); |
|
453 | + foreach ($keys_salts as $c => $v) { |
|
454 | + $keys_salts_str .= "\ndefine( '$c', '".substr(array_shift($from_api), 28, 64)."' );"; |
|
455 | 455 | } |
456 | 456 | } |
457 | - $num_keys_salts = count( $keys_salts ); |
|
457 | + $num_keys_salts = count($keys_salts); |
|
458 | 458 | ?> |
459 | 459 | <p> |
460 | 460 | <?php |
461 | - if ( 1 == $num_keys_salts ) { |
|
461 | + if (1 == $num_keys_salts) { |
|
462 | 462 | printf( |
463 | 463 | /* translators: 1: wp-config.php */ |
464 | - __( 'This unique authentication key is also missing from your %s file.' ), |
|
464 | + __('This unique authentication key is also missing from your %s file.'), |
|
465 | 465 | '<code>wp-config.php</code>' |
466 | 466 | ); |
467 | 467 | } else { |
468 | 468 | printf( |
469 | 469 | /* translators: 1: wp-config.php */ |
470 | - __( 'These unique authentication keys are also missing from your %s file.' ), |
|
470 | + __('These unique authentication keys are also missing from your %s file.'), |
|
471 | 471 | '<code>wp-config.php</code>' |
472 | 472 | ); |
473 | 473 | } |
474 | 474 | ?> |
475 | - <?php _e( 'To make your installation more secure, you should also add:' ); ?> |
|
475 | + <?php _e('To make your installation more secure, you should also add:'); ?> |
|
476 | 476 | </p> |
477 | - <textarea class="code" readonly="readonly" cols="100" rows="<?php echo $num_keys_salts; ?>"><?php echo esc_textarea( $keys_salts_str ); ?></textarea> |
|
477 | + <textarea class="code" readonly="readonly" cols="100" rows="<?php echo $num_keys_salts; ?>"><?php echo esc_textarea($keys_salts_str); ?></textarea> |
|
478 | 478 | <?php |
479 | 479 | } |
480 | 480 | ?> |
481 | 481 | </li> |
482 | 482 | <?php |
483 | - if ( iis7_supports_permalinks() ) : |
|
483 | + if (iis7_supports_permalinks()) : |
|
484 | 484 | // IIS doesn't support RewriteBase, all your RewriteBase are belong to us |
485 | - $iis_subdir_match = ltrim( $base, '/' ) . $subdir_match; |
|
486 | - $iis_rewrite_base = ltrim( $base, '/' ) . $rewrite_base; |
|
485 | + $iis_subdir_match = ltrim($base, '/').$subdir_match; |
|
486 | + $iis_rewrite_base = ltrim($base, '/').$rewrite_base; |
|
487 | 487 | $iis_subdir_replacement = $subdomain_install ? '' : '{R:1}'; |
488 | 488 | |
489 | 489 | $web_config_file = '<?xml version="1.0" encoding="UTF-8"?> |
@@ -495,17 +495,17 @@ discard block |
||
495 | 495 | <match url="^index\.php$" ignoreCase="false" /> |
496 | 496 | <action type="None" /> |
497 | 497 | </rule>'; |
498 | - if ( is_multisite() && get_site_option( 'ms_files_rewriting' ) ) { |
|
498 | + if (is_multisite() && get_site_option('ms_files_rewriting')) { |
|
499 | 499 | $web_config_file .= ' |
500 | 500 | <rule name="WordPress Rule for Files" stopProcessing="true"> |
501 | - <match url="^' . $iis_subdir_match . 'files/(.+)" ignoreCase="false" /> |
|
502 | - <action type="Rewrite" url="' . $iis_rewrite_base . WPINC . '/ms-files.php?file={R:1}" appendQueryString="false" /> |
|
501 | + <match url="^' . $iis_subdir_match.'files/(.+)" ignoreCase="false" /> |
|
502 | + <action type="Rewrite" url="' . $iis_rewrite_base.WPINC.'/ms-files.php?file={R:1}" appendQueryString="false" /> |
|
503 | 503 | </rule>'; |
504 | 504 | } |
505 | 505 | $web_config_file .= ' |
506 | 506 | <rule name="WordPress Rule 2" stopProcessing="true"> |
507 | - <match url="^' . $iis_subdir_match . 'wp-admin$" ignoreCase="false" /> |
|
508 | - <action type="Redirect" url="' . $iis_subdir_replacement . 'wp-admin/" redirectType="Permanent" /> |
|
507 | + <match url="^' . $iis_subdir_match.'wp-admin$" ignoreCase="false" /> |
|
508 | + <action type="Redirect" url="' . $iis_subdir_replacement.'wp-admin/" redirectType="Permanent" /> |
|
509 | 509 | </rule> |
510 | 510 | <rule name="WordPress Rule 3" stopProcessing="true"> |
511 | 511 | <match url="^" ignoreCase="false" /> |
@@ -516,12 +516,12 @@ discard block |
||
516 | 516 | <action type="None" /> |
517 | 517 | </rule> |
518 | 518 | <rule name="WordPress Rule 4" stopProcessing="true"> |
519 | - <match url="^' . $iis_subdir_match . '(wp-(content|admin|includes).*)" ignoreCase="false" /> |
|
520 | - <action type="Rewrite" url="' . $iis_rewrite_base . '{R:1}" /> |
|
519 | + <match url="^' . $iis_subdir_match.'(wp-(content|admin|includes).*)" ignoreCase="false" /> |
|
520 | + <action type="Rewrite" url="' . $iis_rewrite_base.'{R:1}" /> |
|
521 | 521 | </rule> |
522 | 522 | <rule name="WordPress Rule 5" stopProcessing="true"> |
523 | - <match url="^' . $iis_subdir_match . '([_0-9a-zA-Z-]+/)?(.*\.php)$" ignoreCase="false" /> |
|
524 | - <action type="Rewrite" url="' . $iis_rewrite_base . '{R:2}" /> |
|
523 | + <match url="^' . $iis_subdir_match.'([_0-9a-zA-Z-]+/)?(.*\.php)$" ignoreCase="false" /> |
|
524 | + <action type="Rewrite" url="' . $iis_rewrite_base.'{R:2}" /> |
|
525 | 525 | </rule> |
526 | 526 | <rule name="WordPress Rule 6" stopProcessing="true"> |
527 | 527 | <match url="." ignoreCase="false" /> |
@@ -536,24 +536,24 @@ discard block |
||
536 | 536 | echo '<li><p>'; |
537 | 537 | printf( |
538 | 538 | /* translators: 1: a filename like .htaccess. 2: a file path. */ |
539 | - __( 'Add the following to your %1$s file in %2$s, <strong>replacing</strong> other WordPress rules:' ), |
|
539 | + __('Add the following to your %1$s file in %2$s, <strong>replacing</strong> other WordPress rules:'), |
|
540 | 540 | '<code>web.config</code>', |
541 | - '<code>' . $home_path . '</code>' |
|
541 | + '<code>'.$home_path.'</code>' |
|
542 | 542 | ); |
543 | 543 | echo '</p>'; |
544 | - if ( ! $subdomain_install && WP_CONTENT_DIR != ABSPATH . 'wp-content' ) |
|
545 | - echo '<p><strong>' . __('Warning:') . ' ' . __( 'Subdirectory networks may not be fully compatible with custom wp-content directories.' ) . '</strong></p>'; |
|
544 | + if ( ! $subdomain_install && WP_CONTENT_DIR != ABSPATH.'wp-content') |
|
545 | + echo '<p><strong>'.__('Warning:').' '.__('Subdirectory networks may not be fully compatible with custom wp-content directories.').'</strong></p>'; |
|
546 | 546 | ?> |
547 | - <textarea class="code" readonly="readonly" cols="100" rows="20"><?php echo esc_textarea( $web_config_file ); ?> |
|
547 | + <textarea class="code" readonly="readonly" cols="100" rows="20"><?php echo esc_textarea($web_config_file); ?> |
|
548 | 548 | </textarea></li> |
549 | 549 | </ol> |
550 | 550 | |
551 | 551 | <?php else : // end iis7_supports_permalinks(). construct an htaccess file instead: |
552 | 552 | |
553 | 553 | $ms_files_rewriting = ''; |
554 | - if ( is_multisite() && get_site_option( 'ms_files_rewriting' ) ) { |
|
554 | + if (is_multisite() && get_site_option('ms_files_rewriting')) { |
|
555 | 555 | $ms_files_rewriting = "\n# uploaded files\nRewriteRule ^"; |
556 | - $ms_files_rewriting .= $subdir_match . "files/(.+) {$rewrite_base}" . WPINC . "/ms-files.php?file={$subdir_replacement_12} [L]" . "\n"; |
|
556 | + $ms_files_rewriting .= $subdir_match."files/(.+) {$rewrite_base}".WPINC."/ms-files.php?file={$subdir_replacement_12} [L]"."\n"; |
|
557 | 557 | } |
558 | 558 | |
559 | 559 | $htaccess_file = <<<EOF |
@@ -576,22 +576,22 @@ discard block |
||
576 | 576 | echo '<li><p>'; |
577 | 577 | printf( |
578 | 578 | /* translators: 1: a filename like .htaccess. 2: a file path. */ |
579 | - __( 'Add the following to your %1$s file in %2$s, <strong>replacing</strong> other WordPress rules:' ), |
|
579 | + __('Add the following to your %1$s file in %2$s, <strong>replacing</strong> other WordPress rules:'), |
|
580 | 580 | '<code>.htaccess</code>', |
581 | - '<code>' . $home_path . '</code>' |
|
581 | + '<code>'.$home_path.'</code>' |
|
582 | 582 | ); |
583 | 583 | echo '</p>'; |
584 | - if ( ! $subdomain_install && WP_CONTENT_DIR != ABSPATH . 'wp-content' ) |
|
585 | - echo '<p><strong>' . __('Warning:') . ' ' . __( 'Subdirectory networks may not be fully compatible with custom wp-content directories.' ) . '</strong></p>'; |
|
584 | + if ( ! $subdomain_install && WP_CONTENT_DIR != ABSPATH.'wp-content') |
|
585 | + echo '<p><strong>'.__('Warning:').' '.__('Subdirectory networks may not be fully compatible with custom wp-content directories.').'</strong></p>'; |
|
586 | 586 | ?> |
587 | - <textarea class="code" readonly="readonly" cols="100" rows="<?php echo substr_count( $htaccess_file, "\n" ) + 1; ?>"> |
|
588 | -<?php echo esc_textarea( $htaccess_file ); ?></textarea></li> |
|
587 | + <textarea class="code" readonly="readonly" cols="100" rows="<?php echo substr_count($htaccess_file, "\n") + 1; ?>"> |
|
588 | +<?php echo esc_textarea($htaccess_file); ?></textarea></li> |
|
589 | 589 | </ol> |
590 | 590 | |
591 | 591 | <?php endif; // end IIS/Apache code branches. |
592 | 592 | |
593 | - if ( !is_multisite() ) { ?> |
|
594 | - <p><?php _e( 'Once you complete these steps, your network is enabled and configured. You will have to log in again.' ); ?> <a href="<?php echo esc_url( wp_login_url() ); ?>"><?php _e( 'Log In' ); ?></a></p> |
|
593 | + if ( ! is_multisite()) { ?> |
|
594 | + <p><?php _e('Once you complete these steps, your network is enabled and configured. You will have to log in again.'); ?> <a href="<?php echo esc_url(wp_login_url()); ?>"><?php _e('Log In'); ?></a></p> |
|
595 | 595 | <?php |
596 | 596 | } |
597 | 597 | } |
@@ -8,36 +8,36 @@ |
||
8 | 8 | */ |
9 | 9 | |
10 | 10 | // Media Hooks. |
11 | -add_filter( 'wp_handle_upload_prefilter', 'check_upload_size' ); |
|
11 | +add_filter('wp_handle_upload_prefilter', 'check_upload_size'); |
|
12 | 12 | |
13 | 13 | // User Hooks |
14 | -add_action( 'admin_notices', 'new_user_email_admin_notice' ); |
|
15 | -add_action( 'user_admin_notices', 'new_user_email_admin_notice' ); |
|
14 | +add_action('admin_notices', 'new_user_email_admin_notice'); |
|
15 | +add_action('user_admin_notices', 'new_user_email_admin_notice'); |
|
16 | 16 | |
17 | -add_action( 'admin_page_access_denied', '_access_denied_splash', 99 ); |
|
17 | +add_action('admin_page_access_denied', '_access_denied_splash', 99); |
|
18 | 18 | |
19 | -add_action( 'add_option_new_admin_email', 'update_option_new_admin_email', 10, 2 ); |
|
19 | +add_action('add_option_new_admin_email', 'update_option_new_admin_email', 10, 2); |
|
20 | 20 | |
21 | -add_action( 'personal_options_update', 'send_confirmation_on_profile_email' ); |
|
21 | +add_action('personal_options_update', 'send_confirmation_on_profile_email'); |
|
22 | 22 | |
23 | -add_action( 'update_option_new_admin_email', 'update_option_new_admin_email', 10, 2 ); |
|
23 | +add_action('update_option_new_admin_email', 'update_option_new_admin_email', 10, 2); |
|
24 | 24 | |
25 | 25 | // Site Hooks. |
26 | -add_action( 'wpmueditblogaction', 'upload_space_setting' ); |
|
26 | +add_action('wpmueditblogaction', 'upload_space_setting'); |
|
27 | 27 | |
28 | 28 | // Taxonomy Hooks |
29 | -add_filter( 'get_term', 'sync_category_tag_slugs', 10, 2 ); |
|
29 | +add_filter('get_term', 'sync_category_tag_slugs', 10, 2); |
|
30 | 30 | |
31 | 31 | // Post Hooks. |
32 | -add_filter( 'wp_insert_post_data', 'avoid_blog_page_permalink_collision', 10, 2 ); |
|
32 | +add_filter('wp_insert_post_data', 'avoid_blog_page_permalink_collision', 10, 2); |
|
33 | 33 | |
34 | 34 | // Tools Hooks. |
35 | -add_filter( 'import_allow_create_users', 'check_import_new_users' ); |
|
35 | +add_filter('import_allow_create_users', 'check_import_new_users'); |
|
36 | 36 | |
37 | 37 | // Notices Hooks |
38 | -add_action( 'admin_notices', 'site_admin_notice' ); |
|
39 | -add_action( 'network_admin_notices', 'site_admin_notice' ); |
|
38 | +add_action('admin_notices', 'site_admin_notice'); |
|
39 | +add_action('network_admin_notices', 'site_admin_notice'); |
|
40 | 40 | |
41 | 41 | // Update Hooks |
42 | -add_action( 'network_admin_notices', 'update_nag', 3 ); |
|
43 | -add_action( 'network_admin_notices', 'maintenance_nag', 10 ); |
|
42 | +add_action('network_admin_notices', 'update_nag', 3); |
|
43 | +add_action('network_admin_notices', 'maintenance_nag', 10); |