@@ -9,14 +9,14 @@ discard block |
||
9 | 9 | |
10 | 10 | define('WP_USER_ADMIN', true); |
11 | 11 | |
12 | -require_once( dirname(dirname(__FILE__)) . '/admin.php'); |
|
12 | +require_once(dirname(dirname(__FILE__)).'/admin.php'); |
|
13 | 13 | |
14 | -if ( ! is_multisite() ) { |
|
15 | - wp_redirect( admin_url() ); |
|
14 | +if ( ! is_multisite()) { |
|
15 | + wp_redirect(admin_url()); |
|
16 | 16 | exit; |
17 | 17 | } |
18 | 18 | |
19 | -$redirect_user_admin_request = ( ( $current_blog->domain != $current_site->domain ) || ( $current_blog->path != $current_site->path ) ); |
|
19 | +$redirect_user_admin_request = (($current_blog->domain != $current_site->domain) || ($current_blog->path != $current_site->path)); |
|
20 | 20 | /** |
21 | 21 | * Filter whether to redirect the request to the User Admin in Multisite. |
22 | 22 | * |
@@ -24,9 +24,9 @@ discard block |
||
24 | 24 | * |
25 | 25 | * @param bool $redirect_user_admin_request Whether the request should be redirected. |
26 | 26 | */ |
27 | -$redirect_user_admin_request = apply_filters( 'redirect_user_admin_request', $redirect_user_admin_request ); |
|
28 | -if ( $redirect_user_admin_request ) { |
|
29 | - wp_redirect( user_admin_url() ); |
|
27 | +$redirect_user_admin_request = apply_filters('redirect_user_admin_request', $redirect_user_admin_request); |
|
28 | +if ($redirect_user_admin_request) { |
|
29 | + wp_redirect(user_admin_url()); |
|
30 | 30 | exit; |
31 | 31 | } |
32 | -unset( $redirect_user_admin_request ); |
|
32 | +unset($redirect_user_admin_request); |
@@ -1,11 +1,11 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * User Profile Administration Screen. |
|
4 | - * |
|
5 | - * @package WordPress |
|
6 | - * @subpackage Administration |
|
7 | - * @since 3.1.0 |
|
8 | - */ |
|
3 | + * User Profile Administration Screen. |
|
4 | + * |
|
5 | + * @package WordPress |
|
6 | + * @subpackage Administration |
|
7 | + * @since 3.1.0 |
|
8 | + */ |
|
9 | 9 | |
10 | 10 | /** Load WordPress Administration Bootstrap */ |
11 | 11 | require_once( dirname( __FILE__ ) . '/admin.php' ); |
@@ -8,6 +8,6 @@ |
||
8 | 8 | */ |
9 | 9 | |
10 | 10 | /** Load WordPress Administration Bootstrap */ |
11 | -require_once( dirname( __FILE__ ) . '/admin.php' ); |
|
11 | +require_once(dirname(__FILE__).'/admin.php'); |
|
12 | 12 | |
13 | -require( ABSPATH . 'wp-admin/profile.php' ); |
|
13 | +require(ABSPATH.'wp-admin/profile.php'); |
@@ -8,6 +8,6 @@ |
||
8 | 8 | */ |
9 | 9 | |
10 | 10 | /** Load WordPress Administration Bootstrap */ |
11 | -require_once( dirname( __FILE__ ) . '/admin.php' ); |
|
11 | +require_once(dirname(__FILE__).'/admin.php'); |
|
12 | 12 | |
13 | -require( ABSPATH . 'wp-admin/freedoms.php' ); |
|
13 | +require(ABSPATH.'wp-admin/freedoms.php'); |
@@ -8,6 +8,6 @@ |
||
8 | 8 | */ |
9 | 9 | |
10 | 10 | /** Load WordPress Administration Bootstrap */ |
11 | -require_once( dirname( __FILE__ ) . '/admin.php' ); |
|
11 | +require_once(dirname(__FILE__).'/admin.php'); |
|
12 | 12 | |
13 | -require( ABSPATH . 'wp-admin/about.php' ); |
|
13 | +require(ABSPATH.'wp-admin/about.php'); |
@@ -7,27 +7,27 @@ discard block |
||
7 | 7 | * @since 3.4.0 |
8 | 8 | */ |
9 | 9 | |
10 | -define( 'IFRAME_REQUEST', true ); |
|
10 | +define('IFRAME_REQUEST', true); |
|
11 | 11 | |
12 | 12 | /** Load WordPress Administration Bootstrap */ |
13 | -require_once( dirname( __FILE__ ) . '/admin.php' ); |
|
13 | +require_once(dirname(__FILE__).'/admin.php'); |
|
14 | 14 | |
15 | -if ( ! current_user_can( 'customize' ) ) { |
|
16 | - wp_die( __( 'Cheatin’ uh?' ), 403 ); |
|
15 | +if ( ! current_user_can('customize')) { |
|
16 | + wp_die(__('Cheatin’ uh?'), 403); |
|
17 | 17 | } |
18 | 18 | |
19 | -wp_reset_vars( array( 'url', 'return' ) ); |
|
20 | -$url = wp_unslash( $url ); |
|
21 | -$url = wp_validate_redirect( $url, home_url( '/' ) ); |
|
22 | -if ( $return ) { |
|
23 | - $return = wp_unslash( $return ); |
|
24 | - $return = wp_validate_redirect( $return ); |
|
19 | +wp_reset_vars(array('url', 'return')); |
|
20 | +$url = wp_unslash($url); |
|
21 | +$url = wp_validate_redirect($url, home_url('/')); |
|
22 | +if ($return) { |
|
23 | + $return = wp_unslash($return); |
|
24 | + $return = wp_validate_redirect($return); |
|
25 | 25 | } |
26 | -if ( ! $return ) { |
|
27 | - if ( $url ) { |
|
26 | +if ( ! $return) { |
|
27 | + if ($url) { |
|
28 | 28 | $return = $url; |
29 | - } elseif ( current_user_can( 'edit_theme_options' ) || current_user_can( 'switch_themes' ) ) { |
|
30 | - $return = admin_url( 'themes.php' ); |
|
29 | + } elseif (current_user_can('edit_theme_options') || current_user_can('switch_themes')) { |
|
30 | + $return = admin_url('themes.php'); |
|
31 | 31 | } else { |
32 | 32 | $return = admin_url(); |
33 | 33 | } |
@@ -43,64 +43,64 @@ discard block |
||
43 | 43 | $wp_scripts = new WP_Scripts; |
44 | 44 | $wp_scripts->registered = $registered; |
45 | 45 | |
46 | -add_action( 'customize_controls_print_scripts', 'print_head_scripts', 20 ); |
|
47 | -add_action( 'customize_controls_print_footer_scripts', '_wp_footer_scripts' ); |
|
48 | -add_action( 'customize_controls_print_styles', 'print_admin_styles', 20 ); |
|
46 | +add_action('customize_controls_print_scripts', 'print_head_scripts', 20); |
|
47 | +add_action('customize_controls_print_footer_scripts', '_wp_footer_scripts'); |
|
48 | +add_action('customize_controls_print_styles', 'print_admin_styles', 20); |
|
49 | 49 | |
50 | 50 | /** |
51 | 51 | * Fires when Customizer controls are initialized, before scripts are enqueued. |
52 | 52 | * |
53 | 53 | * @since 3.4.0 |
54 | 54 | */ |
55 | -do_action( 'customize_controls_init' ); |
|
55 | +do_action('customize_controls_init'); |
|
56 | 56 | |
57 | -wp_enqueue_script( 'customize-controls' ); |
|
58 | -wp_enqueue_style( 'customize-controls' ); |
|
57 | +wp_enqueue_script('customize-controls'); |
|
58 | +wp_enqueue_style('customize-controls'); |
|
59 | 59 | |
60 | 60 | /** |
61 | 61 | * Enqueue Customizer control scripts. |
62 | 62 | * |
63 | 63 | * @since 3.4.0 |
64 | 64 | */ |
65 | -do_action( 'customize_controls_enqueue_scripts' ); |
|
65 | +do_action('customize_controls_enqueue_scripts'); |
|
66 | 66 | |
67 | 67 | // Let's roll. |
68 | -@header('Content-Type: ' . get_option('html_type') . '; charset=' . get_option('blog_charset')); |
|
68 | +@header('Content-Type: '.get_option('html_type').'; charset='.get_option('blog_charset')); |
|
69 | 69 | |
70 | 70 | wp_user_settings(); |
71 | 71 | _wp_admin_html_begin(); |
72 | 72 | |
73 | 73 | $body_class = 'wp-core-ui wp-customizer js'; |
74 | 74 | |
75 | -if ( wp_is_mobile() ) : |
|
75 | +if (wp_is_mobile()) : |
|
76 | 76 | $body_class .= ' mobile'; |
77 | 77 | |
78 | 78 | ?><meta name="viewport" id="viewport-meta" content="width=device-width, initial-scale=1.0, minimum-scale=0.5, maximum-scale=1.2" /><?php |
79 | 79 | endif; |
80 | 80 | |
81 | -$is_ios = wp_is_mobile() && preg_match( '/iPad|iPod|iPhone/', $_SERVER['HTTP_USER_AGENT'] ); |
|
81 | +$is_ios = wp_is_mobile() && preg_match('/iPad|iPod|iPhone/', $_SERVER['HTTP_USER_AGENT']); |
|
82 | 82 | |
83 | -if ( $is_ios ) { |
|
83 | +if ($is_ios) { |
|
84 | 84 | $body_class .= ' ios'; |
85 | 85 | } |
86 | 86 | |
87 | -if ( is_rtl() ) { |
|
87 | +if (is_rtl()) { |
|
88 | 88 | $body_class .= ' rtl'; |
89 | 89 | } |
90 | -$body_class .= ' locale-' . sanitize_html_class( strtolower( str_replace( '_', '-', get_locale() ) ) ); |
|
90 | +$body_class .= ' locale-'.sanitize_html_class(strtolower(str_replace('_', '-', get_locale()))); |
|
91 | 91 | |
92 | -if ( $wp_customize->is_theme_active() ) { |
|
93 | - $document_title_tmpl = _x( 'Customize: %s', 'Placeholder is the document title from the preview' ); |
|
92 | +if ($wp_customize->is_theme_active()) { |
|
93 | + $document_title_tmpl = _x('Customize: %s', 'Placeholder is the document title from the preview'); |
|
94 | 94 | } else { |
95 | - $document_title_tmpl = _x( 'Live Preview: %s', 'Placeholder is the document title from the preview' ); |
|
95 | + $document_title_tmpl = _x('Live Preview: %s', 'Placeholder is the document title from the preview'); |
|
96 | 96 | } |
97 | -$document_title_tmpl = html_entity_decode( $document_title_tmpl, ENT_QUOTES, 'UTF-8' ); // because exported to JS and assigned to document.title |
|
98 | -$admin_title = sprintf( $document_title_tmpl, __( 'Loading…' ) ); |
|
97 | +$document_title_tmpl = html_entity_decode($document_title_tmpl, ENT_QUOTES, 'UTF-8'); // because exported to JS and assigned to document.title |
|
98 | +$admin_title = sprintf($document_title_tmpl, __('Loading…')); |
|
99 | 99 | |
100 | 100 | ?><title><?php echo $admin_title; ?></title> |
101 | 101 | |
102 | 102 | <script type="text/javascript"> |
103 | -var ajaxurl = '<?php echo admin_url( 'admin-ajax.php', 'relative' ); ?>'; |
|
103 | +var ajaxurl = '<?php echo admin_url('admin-ajax.php', 'relative'); ?>'; |
|
104 | 104 | </script> |
105 | 105 | |
106 | 106 | <?php |
@@ -109,45 +109,45 @@ discard block |
||
109 | 109 | * |
110 | 110 | * @since 3.4.0 |
111 | 111 | */ |
112 | -do_action( 'customize_controls_print_styles' ); |
|
112 | +do_action('customize_controls_print_styles'); |
|
113 | 113 | |
114 | 114 | /** |
115 | 115 | * Fires when Customizer control scripts are printed. |
116 | 116 | * |
117 | 117 | * @since 3.4.0 |
118 | 118 | */ |
119 | -do_action( 'customize_controls_print_scripts' ); |
|
119 | +do_action('customize_controls_print_scripts'); |
|
120 | 120 | ?> |
121 | 121 | </head> |
122 | -<body class="<?php echo esc_attr( $body_class ); ?>"> |
|
122 | +<body class="<?php echo esc_attr($body_class); ?>"> |
|
123 | 123 | <div class="wp-full-overlay expanded"> |
124 | 124 | <form id="customize-controls" class="wrap wp-full-overlay-sidebar"> |
125 | 125 | <div id="customize-header-actions" class="wp-full-overlay-header"> |
126 | 126 | <?php |
127 | - $save_text = $wp_customize->is_theme_active() ? __( 'Save & Publish' ) : __( 'Save & Activate' ); |
|
128 | - submit_button( $save_text, 'primary save', 'save', false ); |
|
127 | + $save_text = $wp_customize->is_theme_active() ? __('Save & Publish') : __('Save & Activate'); |
|
128 | + submit_button($save_text, 'primary save', 'save', false); |
|
129 | 129 | ?> |
130 | 130 | <span class="spinner"></span> |
131 | 131 | <a class="customize-controls-preview-toggle" href="#"> |
132 | - <span class="controls"><?php _e( 'Customize' ); ?></span> |
|
133 | - <span class="preview"><?php _e( 'Preview' ); ?></span> |
|
132 | + <span class="controls"><?php _e('Customize'); ?></span> |
|
133 | + <span class="preview"><?php _e('Preview'); ?></span> |
|
134 | 134 | </a> |
135 | - <a class="customize-controls-close" href="<?php echo esc_url( $return ); ?>"> |
|
136 | - <span class="screen-reader-text"><?php _e( 'Cancel' ); ?></span> |
|
135 | + <a class="customize-controls-close" href="<?php echo esc_url($return); ?>"> |
|
136 | + <span class="screen-reader-text"><?php _e('Cancel'); ?></span> |
|
137 | 137 | </a> |
138 | 138 | </div> |
139 | 139 | |
140 | 140 | <div id="widgets-right"><!-- For Widget Customizer, many widgets try to look for instances under div#widgets-right, so we have to add that ID to a container div in the Customizer for compat --> |
141 | 141 | <div class="wp-full-overlay-sidebar-content" tabindex="-1"> |
142 | 142 | <div id="customize-info" class="accordion-section customize-info"> |
143 | - <div class="accordion-section-title" aria-label="<?php esc_attr_e( 'Customizer Options' ); ?>"> |
|
143 | + <div class="accordion-section-title" aria-label="<?php esc_attr_e('Customizer Options'); ?>"> |
|
144 | 144 | <span class="preview-notice"><?php |
145 | - echo sprintf( __( 'You are customizing %s' ), '<strong class="panel-title site-title">' . get_bloginfo( 'name' ) . '</strong>' ); |
|
145 | + echo sprintf(__('You are customizing %s'), '<strong class="panel-title site-title">'.get_bloginfo('name').'</strong>'); |
|
146 | 146 | ?></span> |
147 | - <button class="customize-help-toggle dashicons dashicons-editor-help" aria-expanded="false"><span class="screen-reader-text"><?php _e( 'Help' ); ?></span></button> |
|
147 | + <button class="customize-help-toggle dashicons dashicons-editor-help" aria-expanded="false"><span class="screen-reader-text"><?php _e('Help'); ?></span></button> |
|
148 | 148 | </div> |
149 | 149 | <div class="customize-panel-description"><?php |
150 | - _e( 'The Customizer allows you to preview changes to your site before publishing them. You can also navigate to different pages on your site to preview them.' ); |
|
150 | + _e('The Customizer allows you to preview changes to your site before publishing them. You can also navigate to different pages on your site to preview them.'); |
|
151 | 151 | ?></div> |
152 | 152 | </div> |
153 | 153 | |
@@ -158,9 +158,9 @@ discard block |
||
158 | 158 | </div> |
159 | 159 | |
160 | 160 | <div id="customize-footer-actions" class="wp-full-overlay-footer"> |
161 | - <button type="button" class="collapse-sidebar button-secondary" aria-expanded="true" aria-label="<?php esc_attr_e( 'Collapse Sidebar' ); ?>"> |
|
161 | + <button type="button" class="collapse-sidebar button-secondary" aria-expanded="true" aria-label="<?php esc_attr_e('Collapse Sidebar'); ?>"> |
|
162 | 162 | <span class="collapse-sidebar-arrow"></span> |
163 | - <span class="collapse-sidebar-label"><?php _e( 'Collapse' ); ?></span> |
|
163 | + <span class="collapse-sidebar-label"><?php _e('Collapse'); ?></span> |
|
164 | 164 | </button> |
165 | 165 | </div> |
166 | 166 | </form> |
@@ -177,7 +177,7 @@ discard block |
||
177 | 177 | * |
178 | 178 | * @since 3.4.0 |
179 | 179 | */ |
180 | - do_action( 'customize_controls_print_footer_scripts' ); |
|
180 | + do_action('customize_controls_print_footer_scripts'); |
|
181 | 181 | |
182 | 182 | /* |
183 | 183 | * If the frontend and the admin are served from the same domain, load the |
@@ -188,13 +188,13 @@ discard block |
||
188 | 188 | * using the customize_allowed_urls filter. |
189 | 189 | */ |
190 | 190 | |
191 | - $allowed_urls = array( home_url('/') ); |
|
192 | - $admin_origin = parse_url( admin_url() ); |
|
193 | - $home_origin = parse_url( home_url() ); |
|
194 | - $cross_domain = ( strtolower( $admin_origin[ 'host' ] ) != strtolower( $home_origin[ 'host' ] ) ); |
|
191 | + $allowed_urls = array(home_url('/')); |
|
192 | + $admin_origin = parse_url(admin_url()); |
|
193 | + $home_origin = parse_url(home_url()); |
|
194 | + $cross_domain = (strtolower($admin_origin['host']) != strtolower($home_origin['host'])); |
|
195 | 195 | |
196 | - if ( is_ssl() && ! $cross_domain ) |
|
197 | - $allowed_urls[] = home_url( '/', 'https' ); |
|
196 | + if (is_ssl() && ! $cross_domain) |
|
197 | + $allowed_urls[] = home_url('/', 'https'); |
|
198 | 198 | |
199 | 199 | /** |
200 | 200 | * Filter the list of URLs allowed to be clicked and followed in the Customizer preview. |
@@ -203,12 +203,12 @@ discard block |
||
203 | 203 | * |
204 | 204 | * @param array $allowed_urls An array of allowed URLs. |
205 | 205 | */ |
206 | - $allowed_urls = array_unique( apply_filters( 'customize_allowed_urls', $allowed_urls ) ); |
|
206 | + $allowed_urls = array_unique(apply_filters('customize_allowed_urls', $allowed_urls)); |
|
207 | 207 | |
208 | - $login_url = add_query_arg( array( |
|
208 | + $login_url = add_query_arg(array( |
|
209 | 209 | 'interim-login' => 1, |
210 | 210 | 'customize-login' => 1 |
211 | - ), wp_login_url() ); |
|
211 | + ), wp_login_url()); |
|
212 | 212 | |
213 | 213 | // Prepare Customizer settings to pass to JavaScript. |
214 | 214 | $settings = array( |
@@ -217,14 +217,14 @@ discard block |
||
217 | 217 | 'active' => $wp_customize->is_theme_active(), |
218 | 218 | ), |
219 | 219 | 'url' => array( |
220 | - 'preview' => esc_url_raw( $url ? $url : home_url( '/' ) ), |
|
221 | - 'parent' => esc_url_raw( admin_url() ), |
|
222 | - 'activated' => esc_url_raw( home_url( '/' ) ), |
|
223 | - 'ajax' => esc_url_raw( admin_url( 'admin-ajax.php', 'relative' ) ), |
|
224 | - 'allowed' => array_map( 'esc_url_raw', $allowed_urls ), |
|
220 | + 'preview' => esc_url_raw($url ? $url : home_url('/')), |
|
221 | + 'parent' => esc_url_raw(admin_url()), |
|
222 | + 'activated' => esc_url_raw(home_url('/')), |
|
223 | + 'ajax' => esc_url_raw(admin_url('admin-ajax.php', 'relative')), |
|
224 | + 'allowed' => array_map('esc_url_raw', $allowed_urls), |
|
225 | 225 | 'isCrossDomain' => $cross_domain, |
226 | - 'home' => esc_url_raw( home_url( '/' ) ), |
|
227 | - 'login' => esc_url_raw( $login_url ), |
|
226 | + 'home' => esc_url_raw(home_url('/')), |
|
227 | + 'login' => esc_url_raw($login_url), |
|
228 | 228 | ), |
229 | 229 | 'browser' => array( |
230 | 230 | 'mobile' => wp_is_mobile(), |
@@ -235,17 +235,17 @@ discard block |
||
235 | 235 | 'panels' => array(), |
236 | 236 | 'sections' => array(), |
237 | 237 | 'nonce' => array( |
238 | - 'save' => wp_create_nonce( 'save-customize_' . $wp_customize->get_stylesheet() ), |
|
239 | - 'preview' => wp_create_nonce( 'preview-customize_' . $wp_customize->get_stylesheet() ) |
|
238 | + 'save' => wp_create_nonce('save-customize_'.$wp_customize->get_stylesheet()), |
|
239 | + 'preview' => wp_create_nonce('preview-customize_'.$wp_customize->get_stylesheet()) |
|
240 | 240 | ), |
241 | 241 | 'autofocus' => array(), |
242 | 242 | 'documentTitleTmpl' => $document_title_tmpl, |
243 | 243 | ); |
244 | 244 | |
245 | 245 | // Prepare Customize Setting objects to pass to JavaScript. |
246 | - foreach ( $wp_customize->settings() as $id => $setting ) { |
|
247 | - if ( $setting->check_capabilities() ) { |
|
248 | - $settings['settings'][ $id ] = array( |
|
246 | + foreach ($wp_customize->settings() as $id => $setting) { |
|
247 | + if ($setting->check_capabilities()) { |
|
248 | + $settings['settings'][$id] = array( |
|
249 | 249 | 'value' => $setting->js_value(), |
250 | 250 | 'transport' => $setting->transport, |
251 | 251 | 'dirty' => $setting->dirty, |
@@ -254,38 +254,38 @@ discard block |
||
254 | 254 | } |
255 | 255 | |
256 | 256 | // Prepare Customize Control objects to pass to JavaScript. |
257 | - foreach ( $wp_customize->controls() as $id => $control ) { |
|
258 | - if ( $control->check_capabilities() ) { |
|
259 | - $settings['controls'][ $id ] = $control->json(); |
|
257 | + foreach ($wp_customize->controls() as $id => $control) { |
|
258 | + if ($control->check_capabilities()) { |
|
259 | + $settings['controls'][$id] = $control->json(); |
|
260 | 260 | } |
261 | 261 | } |
262 | 262 | |
263 | 263 | // Prepare Customize Section objects to pass to JavaScript. |
264 | - foreach ( $wp_customize->sections() as $id => $section ) { |
|
265 | - if ( $section->check_capabilities() ) { |
|
266 | - $settings['sections'][ $id ] = $section->json(); |
|
264 | + foreach ($wp_customize->sections() as $id => $section) { |
|
265 | + if ($section->check_capabilities()) { |
|
266 | + $settings['sections'][$id] = $section->json(); |
|
267 | 267 | } |
268 | 268 | } |
269 | 269 | |
270 | 270 | // Prepare Customize Panel objects to pass to JavaScript. |
271 | - foreach ( $wp_customize->panels() as $panel_id => $panel ) { |
|
272 | - if ( $panel->check_capabilities() ) { |
|
273 | - $settings['panels'][ $panel_id ] = $panel->json(); |
|
274 | - foreach ( $panel->sections as $section_id => $section ) { |
|
275 | - if ( $section->check_capabilities() ) { |
|
276 | - $settings['sections'][ $section_id ] = $section->json(); |
|
271 | + foreach ($wp_customize->panels() as $panel_id => $panel) { |
|
272 | + if ($panel->check_capabilities()) { |
|
273 | + $settings['panels'][$panel_id] = $panel->json(); |
|
274 | + foreach ($panel->sections as $section_id => $section) { |
|
275 | + if ($section->check_capabilities()) { |
|
276 | + $settings['sections'][$section_id] = $section->json(); |
|
277 | 277 | } |
278 | 278 | } |
279 | 279 | } |
280 | 280 | } |
281 | 281 | |
282 | 282 | // Pass to frontend the Customizer construct being deeplinked |
283 | - if ( isset( $_GET['autofocus'] ) ) { |
|
284 | - $autofocus = wp_unslash( $_GET['autofocus'] ); |
|
285 | - if ( is_array( $autofocus ) ) { |
|
286 | - foreach ( $autofocus as $type => $id ) { |
|
287 | - if ( isset( $settings[ $type . 's' ][ $id ] ) ) { |
|
288 | - $settings['autofocus'][ $type ] = $id; |
|
283 | + if (isset($_GET['autofocus'])) { |
|
284 | + $autofocus = wp_unslash($_GET['autofocus']); |
|
285 | + if (is_array($autofocus)) { |
|
286 | + foreach ($autofocus as $type => $id) { |
|
287 | + if (isset($settings[$type.'s'][$id])) { |
|
288 | + $settings['autofocus'][$type] = $id; |
|
289 | 289 | } |
290 | 290 | } |
291 | 291 | } |
@@ -293,7 +293,7 @@ discard block |
||
293 | 293 | |
294 | 294 | ?> |
295 | 295 | <script type="text/javascript"> |
296 | - var _wpCustomizeSettings = <?php echo wp_json_encode( $settings ); ?>; |
|
296 | + var _wpCustomizeSettings = <?php echo wp_json_encode($settings); ?>; |
|
297 | 297 | </script> |
298 | 298 | </div> |
299 | 299 | </body> |
@@ -193,8 +193,9 @@ |
||
193 | 193 | $home_origin = parse_url( home_url() ); |
194 | 194 | $cross_domain = ( strtolower( $admin_origin[ 'host' ] ) != strtolower( $home_origin[ 'host' ] ) ); |
195 | 195 | |
196 | - if ( is_ssl() && ! $cross_domain ) |
|
197 | - $allowed_urls[] = home_url( '/', 'https' ); |
|
196 | + if ( is_ssl() && ! $cross_domain ) { |
|
197 | + $allowed_urls[] = home_url( '/', 'https' ); |
|
198 | + } |
|
198 | 199 | |
199 | 200 | /** |
200 | 201 | * Filter the list of URLs allowed to be clicked and followed in the Customizer preview. |
@@ -1,10 +1,10 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * Install theme administration panel. |
|
4 | - * |
|
5 | - * @package WordPress |
|
6 | - * @subpackage Administration |
|
7 | - */ |
|
3 | + * Install theme administration panel. |
|
4 | + * |
|
5 | + * @package WordPress |
|
6 | + * @subpackage Administration |
|
7 | + */ |
|
8 | 8 | |
9 | 9 | /** WordPress Administration Bootstrap */ |
10 | 10 | require_once( dirname( __FILE__ ) . '/admin.php' ); |
@@ -7,59 +7,59 @@ discard block |
||
7 | 7 | */ |
8 | 8 | |
9 | 9 | /** WordPress Administration Bootstrap */ |
10 | -require_once( dirname( __FILE__ ) . '/admin.php' ); |
|
11 | -require( ABSPATH . 'wp-admin/includes/theme-install.php' ); |
|
10 | +require_once(dirname(__FILE__).'/admin.php'); |
|
11 | +require(ABSPATH.'wp-admin/includes/theme-install.php'); |
|
12 | 12 | |
13 | -wp_reset_vars( array( 'tab' ) ); |
|
13 | +wp_reset_vars(array('tab')); |
|
14 | 14 | |
15 | -if ( ! current_user_can('install_themes') ) |
|
16 | - wp_die( __( 'You do not have sufficient permissions to install themes on this site.' ) ); |
|
15 | +if ( ! current_user_can('install_themes')) |
|
16 | + wp_die(__('You do not have sufficient permissions to install themes on this site.')); |
|
17 | 17 | |
18 | -if ( is_multisite() && ! is_network_admin() ) { |
|
19 | - wp_redirect( network_admin_url( 'theme-install.php' ) ); |
|
18 | +if (is_multisite() && ! is_network_admin()) { |
|
19 | + wp_redirect(network_admin_url('theme-install.php')); |
|
20 | 20 | exit(); |
21 | 21 | } |
22 | 22 | |
23 | -$title = __( 'Add Themes' ); |
|
23 | +$title = __('Add Themes'); |
|
24 | 24 | $parent_file = 'themes.php'; |
25 | 25 | |
26 | -if ( ! is_network_admin() ) { |
|
26 | +if ( ! is_network_admin()) { |
|
27 | 27 | $submenu_file = 'themes.php'; |
28 | 28 | } |
29 | 29 | |
30 | 30 | $installed_themes = search_theme_directories(); |
31 | -foreach ( $installed_themes as $k => $v ) { |
|
32 | - if ( false !== strpos( $k, '/' ) ) { |
|
33 | - unset( $installed_themes[ $k ] ); |
|
31 | +foreach ($installed_themes as $k => $v) { |
|
32 | + if (false !== strpos($k, '/')) { |
|
33 | + unset($installed_themes[$k]); |
|
34 | 34 | } |
35 | 35 | } |
36 | 36 | |
37 | -wp_localize_script( 'theme', '_wpThemeSettings', array( |
|
37 | +wp_localize_script('theme', '_wpThemeSettings', array( |
|
38 | 38 | 'themes' => false, |
39 | 39 | 'settings' => array( |
40 | 40 | 'isInstall' => true, |
41 | - 'canInstall' => current_user_can( 'install_themes' ), |
|
42 | - 'installURI' => current_user_can( 'install_themes' ) ? self_admin_url( 'theme-install.php' ) : null, |
|
43 | - 'adminUrl' => parse_url( self_admin_url(), PHP_URL_PATH ) |
|
41 | + 'canInstall' => current_user_can('install_themes'), |
|
42 | + 'installURI' => current_user_can('install_themes') ? self_admin_url('theme-install.php') : null, |
|
43 | + 'adminUrl' => parse_url(self_admin_url(), PHP_URL_PATH) |
|
44 | 44 | ), |
45 | 45 | 'l10n' => array( |
46 | - 'addNew' => __( 'Add New Theme' ), |
|
47 | - 'search' => __( 'Search Themes' ), |
|
48 | - 'searchPlaceholder' => __( 'Search themes...' ), // placeholder (no ellipsis) |
|
49 | - 'upload' => __( 'Upload Theme' ), |
|
50 | - 'back' => __( 'Back' ), |
|
51 | - 'error' => __( 'An unexpected error occurred. Something may be wrong with WordPress.org or this server’s configuration. If you continue to have problems, please try the <a href="https://wordpress.org/support/">support forums</a>.' ), |
|
52 | - 'themesFound' => __( 'Number of Themes found: %d' ), |
|
53 | - 'noThemesFound' => __( 'No themes found. Try a different search.' ), |
|
54 | - 'collapseSidebar' => __( 'Collapse Sidebar' ), |
|
55 | - 'expandSidebar' => __( 'Expand Sidebar' ), |
|
46 | + 'addNew' => __('Add New Theme'), |
|
47 | + 'search' => __('Search Themes'), |
|
48 | + 'searchPlaceholder' => __('Search themes...'), // placeholder (no ellipsis) |
|
49 | + 'upload' => __('Upload Theme'), |
|
50 | + 'back' => __('Back'), |
|
51 | + 'error' => __('An unexpected error occurred. Something may be wrong with WordPress.org or this server’s configuration. If you continue to have problems, please try the <a href="https://wordpress.org/support/">support forums</a>.'), |
|
52 | + 'themesFound' => __('Number of Themes found: %d'), |
|
53 | + 'noThemesFound' => __('No themes found. Try a different search.'), |
|
54 | + 'collapseSidebar' => __('Collapse Sidebar'), |
|
55 | + 'expandSidebar' => __('Expand Sidebar'), |
|
56 | 56 | ), |
57 | - 'installedThemes' => array_keys( $installed_themes ), |
|
58 | -) ); |
|
57 | + 'installedThemes' => array_keys($installed_themes), |
|
58 | +)); |
|
59 | 59 | |
60 | -wp_enqueue_script( 'theme' ); |
|
60 | +wp_enqueue_script('theme'); |
|
61 | 61 | |
62 | -if ( $tab ) { |
|
62 | +if ($tab) { |
|
63 | 63 | /** |
64 | 64 | * Fires before each of the tabs are rendered on the Install Themes page. |
65 | 65 | * |
@@ -69,43 +69,43 @@ discard block |
||
69 | 69 | * |
70 | 70 | * @since 2.8.0 |
71 | 71 | */ |
72 | - do_action( "install_themes_pre_{$tab}" ); |
|
72 | + do_action("install_themes_pre_{$tab}"); |
|
73 | 73 | } |
74 | 74 | |
75 | 75 | $help_overview = |
76 | - '<p>' . sprintf(__('You can find additional themes for your site by using the Theme Browser/Installer on this screen, which will display themes from the <a href="%s" target="_blank">WordPress.org Theme Directory</a>. These themes are designed and developed by third parties, are available free of charge, and are compatible with the license WordPress uses.'), 'https://wordpress.org/themes/') . '</p>' . |
|
77 | - '<p>' . __( 'You can Search for themes by keyword, author, or tag, or can get more specific and search by criteria listed in the feature filter.' ) . ' <span id="live-search-desc">' . __( 'The search results will be updated as you type.' ) . '</span></p>' . |
|
78 | - '<p>' . __( 'Alternately, you can browse the themes that are Featured, Popular, or Latest. When you find a theme you like, you can preview it or install it.' ) . '</p>' . |
|
79 | - '<p>' . __('You can Upload a theme manually if you have already downloaded its ZIP archive onto your computer (make sure it is from a trusted and original source). You can also do it the old-fashioned way and copy a downloaded theme’s folder via FTP into your <code>/wp-content/themes</code> directory.') . '</p>'; |
|
76 | + '<p>'.sprintf(__('You can find additional themes for your site by using the Theme Browser/Installer on this screen, which will display themes from the <a href="%s" target="_blank">WordPress.org Theme Directory</a>. These themes are designed and developed by third parties, are available free of charge, and are compatible with the license WordPress uses.'), 'https://wordpress.org/themes/').'</p>'. |
|
77 | + '<p>'.__('You can Search for themes by keyword, author, or tag, or can get more specific and search by criteria listed in the feature filter.').' <span id="live-search-desc">'.__('The search results will be updated as you type.').'</span></p>'. |
|
78 | + '<p>'.__('Alternately, you can browse the themes that are Featured, Popular, or Latest. When you find a theme you like, you can preview it or install it.').'</p>'. |
|
79 | + '<p>'.__('You can Upload a theme manually if you have already downloaded its ZIP archive onto your computer (make sure it is from a trusted and original source). You can also do it the old-fashioned way and copy a downloaded theme’s folder via FTP into your <code>/wp-content/themes</code> directory.').'</p>'; |
|
80 | 80 | |
81 | -get_current_screen()->add_help_tab( array( |
|
81 | +get_current_screen()->add_help_tab(array( |
|
82 | 82 | 'id' => 'overview', |
83 | 83 | 'title' => __('Overview'), |
84 | 84 | 'content' => $help_overview |
85 | -) ); |
|
85 | +)); |
|
86 | 86 | |
87 | 87 | $help_installing = |
88 | - '<p>' . __('Once you have generated a list of themes, you can preview and install any of them. Click on the thumbnail of the theme you’re interested in previewing. It will open up in a full-screen Preview page to give you a better idea of how that theme will look.') . '</p>' . |
|
89 | - '<p>' . __('To install the theme so you can preview it with your site’s content and customize its theme options, click the "Install" button at the top of the left-hand pane. The theme files will be downloaded to your website automatically. When this is complete, the theme is now available for activation, which you can do by clicking the "Activate" link, or by navigating to your Manage Themes screen and clicking the "Live Preview" link under any installed theme’s thumbnail image.') . '</p>'; |
|
88 | + '<p>'.__('Once you have generated a list of themes, you can preview and install any of them. Click on the thumbnail of the theme you’re interested in previewing. It will open up in a full-screen Preview page to give you a better idea of how that theme will look.').'</p>'. |
|
89 | + '<p>'.__('To install the theme so you can preview it with your site’s content and customize its theme options, click the "Install" button at the top of the left-hand pane. The theme files will be downloaded to your website automatically. When this is complete, the theme is now available for activation, which you can do by clicking the "Activate" link, or by navigating to your Manage Themes screen and clicking the "Live Preview" link under any installed theme’s thumbnail image.').'</p>'; |
|
90 | 90 | |
91 | -get_current_screen()->add_help_tab( array( |
|
91 | +get_current_screen()->add_help_tab(array( |
|
92 | 92 | 'id' => 'installing', |
93 | 93 | 'title' => __('Previewing and Installing'), |
94 | 94 | 'content' => $help_installing |
95 | -) ); |
|
95 | +)); |
|
96 | 96 | |
97 | 97 | get_current_screen()->set_help_sidebar( |
98 | - '<p><strong>' . __('For more information:') . '</strong></p>' . |
|
99 | - '<p>' . __('<a href="https://codex.wordpress.org/Using_Themes#Adding_New_Themes" target="_blank">Documentation on Adding New Themes</a>') . '</p>' . |
|
100 | - '<p>' . __('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>' |
|
98 | + '<p><strong>'.__('For more information:').'</strong></p>'. |
|
99 | + '<p>'.__('<a href="https://codex.wordpress.org/Using_Themes#Adding_New_Themes" target="_blank">Documentation on Adding New Themes</a>').'</p>'. |
|
100 | + '<p>'.__('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>').'</p>' |
|
101 | 101 | ); |
102 | 102 | |
103 | -include(ABSPATH . 'wp-admin/admin-header.php'); |
|
103 | +include(ABSPATH.'wp-admin/admin-header.php'); |
|
104 | 104 | |
105 | 105 | ?> |
106 | 106 | <div class="wrap"> |
107 | 107 | <h1><?php |
108 | - echo esc_html( $title ); |
|
108 | + echo esc_html($title); |
|
109 | 109 | |
110 | 110 | /** |
111 | 111 | * Filter the tabs shown on the Add Themes screen. |
@@ -117,10 +117,10 @@ discard block |
||
117 | 117 | * |
118 | 118 | * @param array $tabs The tabs shown on the Add Themes screen. Default is 'upload'. |
119 | 119 | */ |
120 | - $tabs = apply_filters( 'install_themes_tabs', array( 'upload' => __( 'Upload Theme' ) ) ); |
|
121 | - if ( ! empty( $tabs['upload'] ) && current_user_can( 'upload_themes' ) ) { |
|
122 | - echo ' <a href="#" class="upload page-title-action">' . __( 'Upload Theme' ) . '</a>'; |
|
123 | - echo ' <a href="#" class="browse-themes page-title-action">' . _x( 'Browse', 'themes' ) . '</a>'; |
|
120 | + $tabs = apply_filters('install_themes_tabs', array('upload' => __('Upload Theme'))); |
|
121 | + if ( ! empty($tabs['upload']) && current_user_can('upload_themes')) { |
|
122 | + echo ' <a href="#" class="upload page-title-action">'.__('Upload Theme').'</a>'; |
|
123 | + echo ' <a href="#" class="browse-themes page-title-action">'._x('Browse', 'themes').'</a>'; |
|
124 | 124 | } |
125 | 125 | ?></h1> |
126 | 126 | |
@@ -134,52 +134,52 @@ discard block |
||
134 | 134 | </div> |
135 | 135 | |
136 | 136 | <ul class="filter-links"> |
137 | - <li><a href="#" data-sort="featured"><?php _ex( 'Featured', 'themes' ); ?></a></li> |
|
138 | - <li><a href="#" data-sort="popular"><?php _ex( 'Popular', 'themes' ); ?></a></li> |
|
139 | - <li><a href="#" data-sort="new"><?php _ex( 'Latest', 'themes' ); ?></a></li> |
|
137 | + <li><a href="#" data-sort="featured"><?php _ex('Featured', 'themes'); ?></a></li> |
|
138 | + <li><a href="#" data-sort="popular"><?php _ex('Popular', 'themes'); ?></a></li> |
|
139 | + <li><a href="#" data-sort="new"><?php _ex('Latest', 'themes'); ?></a></li> |
|
140 | 140 | </ul> |
141 | 141 | |
142 | - <a class="drawer-toggle" href="#"><?php _e( 'Feature Filter' ); ?></a> |
|
142 | + <a class="drawer-toggle" href="#"><?php _e('Feature Filter'); ?></a> |
|
143 | 143 | |
144 | 144 | <div class="search-form"></div> |
145 | 145 | |
146 | 146 | <div class="filter-drawer"> |
147 | 147 | <div class="buttons"> |
148 | - <a class="apply-filters button button-secondary" href="#"><?php _e( 'Apply Filters' ); ?><span></span></a> |
|
149 | - <a class="clear-filters button button-secondary" href="#"><?php _e( 'Clear' ); ?></a> |
|
148 | + <a class="apply-filters button button-secondary" href="#"><?php _e('Apply Filters'); ?><span></span></a> |
|
149 | + <a class="clear-filters button button-secondary" href="#"><?php _e('Clear'); ?></a> |
|
150 | 150 | </div> |
151 | 151 | <?php |
152 | 152 | $feature_list = get_theme_feature_list(); |
153 | - foreach ( $feature_list as $feature_name => $features ) { |
|
153 | + foreach ($feature_list as $feature_name => $features) { |
|
154 | 154 | echo '<div class="filter-group">'; |
155 | - $feature_name = esc_html( $feature_name ); |
|
156 | - echo '<h4>' . $feature_name . '</h4>'; |
|
155 | + $feature_name = esc_html($feature_name); |
|
156 | + echo '<h4>'.$feature_name.'</h4>'; |
|
157 | 157 | echo '<ol class="feature-group">'; |
158 | - foreach ( $features as $feature => $feature_name ) { |
|
159 | - $feature = esc_attr( $feature ); |
|
160 | - echo '<li><input type="checkbox" id="filter-id-' . $feature . '" value="' . $feature . '" /> '; |
|
161 | - echo '<label for="filter-id-' . $feature . '">' . $feature_name . '</label></li>'; |
|
158 | + foreach ($features as $feature => $feature_name) { |
|
159 | + $feature = esc_attr($feature); |
|
160 | + echo '<li><input type="checkbox" id="filter-id-'.$feature.'" value="'.$feature.'" /> '; |
|
161 | + echo '<label for="filter-id-'.$feature.'">'.$feature_name.'</label></li>'; |
|
162 | 162 | } |
163 | 163 | echo '</ol>'; |
164 | 164 | echo '</div>'; |
165 | 165 | } |
166 | 166 | ?> |
167 | 167 | <div class="filtered-by"> |
168 | - <span><?php _e( 'Filtering by:' ); ?></span> |
|
168 | + <span><?php _e('Filtering by:'); ?></span> |
|
169 | 169 | <div class="tags"></div> |
170 | - <a href="#"><?php _e( 'Edit' ); ?></a> |
|
170 | + <a href="#"><?php _e('Edit'); ?></a> |
|
171 | 171 | </div> |
172 | 172 | </div> |
173 | 173 | </div> |
174 | 174 | <div class="theme-browser content-filterable"></div> |
175 | 175 | <div class="theme-install-overlay wp-full-overlay expanded"></div> |
176 | 176 | |
177 | - <p class="no-themes"><?php _e( 'No themes found. Try a different search.' ); ?></p> |
|
177 | + <p class="no-themes"><?php _e('No themes found. Try a different search.'); ?></p> |
|
178 | 178 | <span class="spinner"></span> |
179 | 179 | |
180 | 180 | <br class="clear" /> |
181 | 181 | <?php |
182 | -if ( $tab ) { |
|
182 | +if ($tab) { |
|
183 | 183 | /** |
184 | 184 | * Fires at the top of each of the tabs on the Install Themes page. |
185 | 185 | * |
@@ -191,7 +191,7 @@ discard block |
||
191 | 191 | * |
192 | 192 | * @param int $paged Number of the current page of results being viewed. |
193 | 193 | */ |
194 | - do_action( "install_themes_{$tab}", $paged ); |
|
194 | + do_action("install_themes_{$tab}", $paged); |
|
195 | 195 | } |
196 | 196 | ?> |
197 | 197 | </div> |
@@ -204,36 +204,36 @@ discard block |
||
204 | 204 | <# } else { #> |
205 | 205 | <div class="theme-screenshot blank"></div> |
206 | 206 | <# } #> |
207 | - <span class="more-details"><?php _ex( 'Details & Preview', 'theme' ); ?></span> |
|
208 | - <div class="theme-author"><?php printf( __( 'By %s' ), '{{ data.author }}' ); ?></div> |
|
207 | + <span class="more-details"><?php _ex('Details & Preview', 'theme'); ?></span> |
|
208 | + <div class="theme-author"><?php printf(__('By %s'), '{{ data.author }}'); ?></div> |
|
209 | 209 | <h3 class="theme-name">{{ data.name }}</h3> |
210 | 210 | |
211 | 211 | <div class="theme-actions"> |
212 | - <a class="button button-primary" href="{{ data.install_url }}"><?php esc_html_e( 'Install' ); ?></a> |
|
213 | - <a class="button button-secondary preview install-theme-preview" href="#"><?php esc_html_e( 'Preview' ); ?></a> |
|
212 | + <a class="button button-primary" href="{{ data.install_url }}"><?php esc_html_e('Install'); ?></a> |
|
213 | + <a class="button button-secondary preview install-theme-preview" href="#"><?php esc_html_e('Preview'); ?></a> |
|
214 | 214 | </div> |
215 | 215 | |
216 | 216 | <# if ( data.installed ) { #> |
217 | - <div class="theme-installed"><?php _ex( 'Already Installed', 'theme' ); ?></div> |
|
217 | + <div class="theme-installed"><?php _ex('Already Installed', 'theme'); ?></div> |
|
218 | 218 | <# } #> |
219 | 219 | </script> |
220 | 220 | |
221 | 221 | <script id="tmpl-theme-preview" type="text/template"> |
222 | 222 | <div class="wp-full-overlay-sidebar"> |
223 | 223 | <div class="wp-full-overlay-header"> |
224 | - <a href="#" class="close-full-overlay"><span class="screen-reader-text"><?php _e( 'Close' ); ?></span></a> |
|
225 | - <a href="#" class="previous-theme"><span class="screen-reader-text"><?php _ex( 'Previous', 'Button label for a theme' ); ?></span></a> |
|
226 | - <a href="#" class="next-theme"><span class="screen-reader-text"><?php _ex( 'Next', 'Button label for a theme' ); ?></span></a> |
|
224 | + <a href="#" class="close-full-overlay"><span class="screen-reader-text"><?php _e('Close'); ?></span></a> |
|
225 | + <a href="#" class="previous-theme"><span class="screen-reader-text"><?php _ex('Previous', 'Button label for a theme'); ?></span></a> |
|
226 | + <a href="#" class="next-theme"><span class="screen-reader-text"><?php _ex('Next', 'Button label for a theme'); ?></span></a> |
|
227 | 227 | <# if ( data.installed ) { #> |
228 | - <a href="#" class="button button-primary theme-install disabled"><?php _ex( 'Installed', 'theme' ); ?></a> |
|
228 | + <a href="#" class="button button-primary theme-install disabled"><?php _ex('Installed', 'theme'); ?></a> |
|
229 | 229 | <# } else { #> |
230 | - <a href="{{ data.install_url }}" class="button button-primary theme-install"><?php _e( 'Install' ); ?></a> |
|
230 | + <a href="{{ data.install_url }}" class="button button-primary theme-install"><?php _e('Install'); ?></a> |
|
231 | 231 | <# } #> |
232 | 232 | </div> |
233 | 233 | <div class="wp-full-overlay-sidebar-content"> |
234 | 234 | <div class="install-theme-info"> |
235 | 235 | <h3 class="theme-name">{{ data.name }}</h3> |
236 | - <span class="theme-by"><?php printf( __( 'By %s' ), '{{ data.author }}' ); ?></span> |
|
236 | + <span class="theme-by"><?php printf(__('By %s'), '{{ data.author }}'); ?></span> |
|
237 | 237 | |
238 | 238 | <img class="theme-screenshot" src="{{ data.screenshot_url }}" alt="" /> |
239 | 239 | |
@@ -245,25 +245,25 @@ discard block |
||
245 | 245 | </div> |
246 | 246 | <# } else { #> |
247 | 247 | <div class="star-rating"> |
248 | - <small class="ratings"><?php _e( 'This theme has not been rated yet.' ); ?></small> |
|
248 | + <small class="ratings"><?php _e('This theme has not been rated yet.'); ?></small> |
|
249 | 249 | </div> |
250 | 250 | <# } #> |
251 | - <div class="theme-version"><?php printf( __( 'Version: %s' ), '{{ data.version }}' ); ?></div> |
|
251 | + <div class="theme-version"><?php printf(__('Version: %s'), '{{ data.version }}'); ?></div> |
|
252 | 252 | <div class="theme-description">{{{ data.description }}}</div> |
253 | 253 | </div> |
254 | 254 | </div> |
255 | 255 | </div> |
256 | 256 | <div class="wp-full-overlay-footer"> |
257 | - <button type="button" class="collapse-sidebar button-secondary" aria-expanded="true" aria-label="<?php esc_attr_e( 'Collapse Sidebar' ); ?>"> |
|
257 | + <button type="button" class="collapse-sidebar button-secondary" aria-expanded="true" aria-label="<?php esc_attr_e('Collapse Sidebar'); ?>"> |
|
258 | 258 | <span class="collapse-sidebar-arrow"></span> |
259 | - <span class="collapse-sidebar-label"><?php _e( 'Collapse' ); ?></span> |
|
259 | + <span class="collapse-sidebar-label"><?php _e('Collapse'); ?></span> |
|
260 | 260 | </button> |
261 | 261 | </div> |
262 | 262 | </div> |
263 | 263 | <div class="wp-full-overlay-main"> |
264 | - <iframe src="{{ data.preview_url }}" title="<?php esc_attr_e( 'Preview' ); ?>" /> |
|
264 | + <iframe src="{{ data.preview_url }}" title="<?php esc_attr_e('Preview'); ?>" /> |
|
265 | 265 | </div> |
266 | 266 | </script> |
267 | 267 | |
268 | 268 | <?php |
269 | -include(ABSPATH . 'wp-admin/admin-footer.php'); |
|
269 | +include(ABSPATH.'wp-admin/admin-footer.php'); |
@@ -12,8 +12,9 @@ |
||
12 | 12 | |
13 | 13 | wp_reset_vars( array( 'tab' ) ); |
14 | 14 | |
15 | -if ( ! current_user_can('install_themes') ) |
|
15 | +if ( ! current_user_can('install_themes') ) { |
|
16 | 16 | wp_die( __( 'You do not have sufficient permissions to install themes on this site.' ) ); |
17 | +} |
|
17 | 18 | |
18 | 19 | if ( is_multisite() && ! is_network_admin() ) { |
19 | 20 | wp_redirect( network_admin_url( 'theme-install.php' ) ); |
@@ -1,12 +1,12 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * Plugins List Table class. |
|
4 | - * |
|
5 | - * @package WordPress |
|
6 | - * @subpackage List_Table |
|
7 | - * @since 3.1.0 |
|
8 | - * @access private |
|
9 | - */ |
|
3 | + * Plugins List Table class. |
|
4 | + * |
|
5 | + * @package WordPress |
|
6 | + * @subpackage List_Table |
|
7 | + * @since 3.1.0 |
|
8 | + * @access private |
|
9 | + */ |
|
10 | 10 | class WP_Plugins_List_Table extends WP_List_Table { |
11 | 11 | |
12 | 12 | /** |
@@ -22,20 +22,20 @@ discard block |
||
22 | 22 | * |
23 | 23 | * @param array $args An associative array of arguments. |
24 | 24 | */ |
25 | - public function __construct( $args = array() ) { |
|
25 | + public function __construct($args = array()) { |
|
26 | 26 | global $status, $page; |
27 | 27 | |
28 | - parent::__construct( array( |
|
28 | + parent::__construct(array( |
|
29 | 29 | 'plural' => 'plugins', |
30 | - 'screen' => isset( $args['screen'] ) ? $args['screen'] : null, |
|
31 | - ) ); |
|
30 | + 'screen' => isset($args['screen']) ? $args['screen'] : null, |
|
31 | + )); |
|
32 | 32 | |
33 | 33 | $status = 'all'; |
34 | - if ( isset( $_REQUEST['plugin_status'] ) && in_array( $_REQUEST['plugin_status'], array( 'active', 'inactive', 'recently_activated', 'upgrade', 'mustuse', 'dropins', 'search' ) ) ) |
|
34 | + if (isset($_REQUEST['plugin_status']) && in_array($_REQUEST['plugin_status'], array('active', 'inactive', 'recently_activated', 'upgrade', 'mustuse', 'dropins', 'search'))) |
|
35 | 35 | $status = $_REQUEST['plugin_status']; |
36 | 36 | |
37 | - if ( isset($_REQUEST['s']) ) |
|
38 | - $_SERVER['REQUEST_URI'] = add_query_arg('s', wp_unslash($_REQUEST['s']) ); |
|
37 | + if (isset($_REQUEST['s'])) |
|
38 | + $_SERVER['REQUEST_URI'] = add_query_arg('s', wp_unslash($_REQUEST['s'])); |
|
39 | 39 | |
40 | 40 | $page = $this->get_pagenum(); |
41 | 41 | } |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | * @return array |
45 | 45 | */ |
46 | 46 | protected function get_table_classes() { |
47 | - return array( 'widefat', $this->_args['plural'] ); |
|
47 | + return array('widefat', $this->_args['plural']); |
|
48 | 48 | } |
49 | 49 | |
50 | 50 | /** |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | public function prepare_items() { |
68 | 68 | global $status, $plugins, $totals, $page, $orderby, $order, $s; |
69 | 69 | |
70 | - wp_reset_vars( array( 'orderby', 'order', 's' ) ); |
|
70 | + wp_reset_vars(array('orderby', 'order', 's')); |
|
71 | 71 | |
72 | 72 | /** |
73 | 73 | * Filter the full array of plugins to list in the Plugins list table. |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | * @param array $plugins An array of plugins to display in the list table. |
80 | 80 | */ |
81 | 81 | $plugins = array( |
82 | - 'all' => apply_filters( 'all_plugins', get_plugins() ), |
|
82 | + 'all' => apply_filters('all_plugins', get_plugins()), |
|
83 | 83 | 'search' => array(), |
84 | 84 | 'active' => array(), |
85 | 85 | 'inactive' => array(), |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | |
92 | 92 | $screen = $this->screen; |
93 | 93 | |
94 | - if ( ! is_multisite() || ( $screen->in_admin( 'network' ) && current_user_can( 'manage_network_plugins' ) ) ) { |
|
94 | + if ( ! is_multisite() || ($screen->in_admin('network') && current_user_can('manage_network_plugins'))) { |
|
95 | 95 | |
96 | 96 | /** |
97 | 97 | * Filter whether to display the advanced plugins list table. |
@@ -108,118 +108,118 @@ discard block |
||
108 | 108 | * plugin type. Default true. |
109 | 109 | * @param string $type The plugin type. Accepts 'mustuse', 'dropins'. |
110 | 110 | */ |
111 | - if ( apply_filters( 'show_advanced_plugins', true, 'mustuse' ) ) { |
|
111 | + if (apply_filters('show_advanced_plugins', true, 'mustuse')) { |
|
112 | 112 | $plugins['mustuse'] = get_mu_plugins(); |
113 | 113 | } |
114 | 114 | |
115 | 115 | /** This action is documented in wp-admin/includes/class-wp-plugins-list-table.php */ |
116 | - if ( apply_filters( 'show_advanced_plugins', true, 'dropins' ) ) |
|
116 | + if (apply_filters('show_advanced_plugins', true, 'dropins')) |
|
117 | 117 | $plugins['dropins'] = get_dropins(); |
118 | 118 | |
119 | - if ( current_user_can( 'update_plugins' ) ) { |
|
120 | - $current = get_site_transient( 'update_plugins' ); |
|
121 | - foreach ( (array) $plugins['all'] as $plugin_file => $plugin_data ) { |
|
122 | - if ( isset( $current->response[ $plugin_file ] ) ) { |
|
123 | - $plugins['all'][ $plugin_file ]['update'] = true; |
|
124 | - $plugins['upgrade'][ $plugin_file ] = $plugins['all'][ $plugin_file ]; |
|
119 | + if (current_user_can('update_plugins')) { |
|
120 | + $current = get_site_transient('update_plugins'); |
|
121 | + foreach ((array) $plugins['all'] as $plugin_file => $plugin_data) { |
|
122 | + if (isset($current->response[$plugin_file])) { |
|
123 | + $plugins['all'][$plugin_file]['update'] = true; |
|
124 | + $plugins['upgrade'][$plugin_file] = $plugins['all'][$plugin_file]; |
|
125 | 125 | } |
126 | 126 | } |
127 | 127 | } |
128 | 128 | } |
129 | 129 | |
130 | - set_transient( 'plugin_slugs', array_keys( $plugins['all'] ), DAY_IN_SECONDS ); |
|
130 | + set_transient('plugin_slugs', array_keys($plugins['all']), DAY_IN_SECONDS); |
|
131 | 131 | |
132 | - if ( ! $screen->in_admin( 'network' ) ) { |
|
133 | - $recently_activated = get_option( 'recently_activated', array() ); |
|
132 | + if ( ! $screen->in_admin('network')) { |
|
133 | + $recently_activated = get_option('recently_activated', array()); |
|
134 | 134 | |
135 | - foreach ( $recently_activated as $key => $time ) |
|
136 | - if ( $time + WEEK_IN_SECONDS < time() ) |
|
137 | - unset( $recently_activated[$key] ); |
|
138 | - update_option( 'recently_activated', $recently_activated ); |
|
135 | + foreach ($recently_activated as $key => $time) |
|
136 | + if ($time + WEEK_IN_SECONDS < time()) |
|
137 | + unset($recently_activated[$key]); |
|
138 | + update_option('recently_activated', $recently_activated); |
|
139 | 139 | } |
140 | 140 | |
141 | - $plugin_info = get_site_transient( 'update_plugins' ); |
|
141 | + $plugin_info = get_site_transient('update_plugins'); |
|
142 | 142 | |
143 | - foreach ( (array) $plugins['all'] as $plugin_file => $plugin_data ) { |
|
143 | + foreach ((array) $plugins['all'] as $plugin_file => $plugin_data) { |
|
144 | 144 | // Extra info if known. array_merge() ensures $plugin_data has precedence if keys collide. |
145 | - if ( isset( $plugin_info->response[ $plugin_file ] ) ) { |
|
146 | - $plugins['all'][ $plugin_file ] = $plugin_data = array_merge( (array) $plugin_info->response[ $plugin_file ], $plugin_data ); |
|
145 | + if (isset($plugin_info->response[$plugin_file])) { |
|
146 | + $plugins['all'][$plugin_file] = $plugin_data = array_merge((array) $plugin_info->response[$plugin_file], $plugin_data); |
|
147 | 147 | // Make sure that $plugins['upgrade'] also receives the extra info since it is used on ?plugin_status=upgrade |
148 | - if ( isset( $plugins['upgrade'][ $plugin_file ] ) ) { |
|
149 | - $plugins['upgrade'][ $plugin_file ] = $plugin_data = array_merge( (array) $plugin_info->response[ $plugin_file ], $plugin_data ); |
|
148 | + if (isset($plugins['upgrade'][$plugin_file])) { |
|
149 | + $plugins['upgrade'][$plugin_file] = $plugin_data = array_merge((array) $plugin_info->response[$plugin_file], $plugin_data); |
|
150 | 150 | } |
151 | 151 | |
152 | - } elseif ( isset( $plugin_info->no_update[ $plugin_file ] ) ) { |
|
153 | - $plugins['all'][ $plugin_file ] = $plugin_data = array_merge( (array) $plugin_info->no_update[ $plugin_file ], $plugin_data ); |
|
152 | + } elseif (isset($plugin_info->no_update[$plugin_file])) { |
|
153 | + $plugins['all'][$plugin_file] = $plugin_data = array_merge((array) $plugin_info->no_update[$plugin_file], $plugin_data); |
|
154 | 154 | // Make sure that $plugins['upgrade'] also receives the extra info since it is used on ?plugin_status=upgrade |
155 | - if ( isset( $plugins['upgrade'][ $plugin_file ] ) ) { |
|
156 | - $plugins['upgrade'][ $plugin_file ] = $plugin_data = array_merge( (array) $plugin_info->no_update[ $plugin_file ], $plugin_data ); |
|
155 | + if (isset($plugins['upgrade'][$plugin_file])) { |
|
156 | + $plugins['upgrade'][$plugin_file] = $plugin_data = array_merge((array) $plugin_info->no_update[$plugin_file], $plugin_data); |
|
157 | 157 | } |
158 | 158 | } |
159 | 159 | |
160 | 160 | // Filter into individual sections |
161 | - if ( is_multisite() && ! $screen->in_admin( 'network' ) && is_network_only_plugin( $plugin_file ) && ! is_plugin_active( $plugin_file ) ) { |
|
161 | + if (is_multisite() && ! $screen->in_admin('network') && is_network_only_plugin($plugin_file) && ! is_plugin_active($plugin_file)) { |
|
162 | 162 | // On the non-network screen, filter out network-only plugins as long as they're not individually activated |
163 | - unset( $plugins['all'][ $plugin_file ] ); |
|
164 | - } elseif ( ! $screen->in_admin( 'network' ) && is_plugin_active_for_network( $plugin_file ) ) { |
|
163 | + unset($plugins['all'][$plugin_file]); |
|
164 | + } elseif ( ! $screen->in_admin('network') && is_plugin_active_for_network($plugin_file)) { |
|
165 | 165 | // On the non-network screen, filter out network activated plugins |
166 | - unset( $plugins['all'][ $plugin_file ] ); |
|
167 | - } elseif ( ( ! $screen->in_admin( 'network' ) && is_plugin_active( $plugin_file ) ) |
|
168 | - || ( $screen->in_admin( 'network' ) && is_plugin_active_for_network( $plugin_file ) ) ) { |
|
166 | + unset($plugins['all'][$plugin_file]); |
|
167 | + } elseif (( ! $screen->in_admin('network') && is_plugin_active($plugin_file)) |
|
168 | + || ($screen->in_admin('network') && is_plugin_active_for_network($plugin_file))) { |
|
169 | 169 | // On the non-network screen, populate the active list with plugins that are individually activated |
170 | 170 | // On the network-admin screen, populate the active list with plugins that are network activated |
171 | - $plugins['active'][ $plugin_file ] = $plugin_data; |
|
171 | + $plugins['active'][$plugin_file] = $plugin_data; |
|
172 | 172 | } else { |
173 | - if ( ! $screen->in_admin( 'network' ) && isset( $recently_activated[ $plugin_file ] ) ) { |
|
173 | + if ( ! $screen->in_admin('network') && isset($recently_activated[$plugin_file])) { |
|
174 | 174 | // On the non-network screen, populate the recently activated list with plugins that have been recently activated |
175 | - $plugins['recently_activated'][ $plugin_file ] = $plugin_data; |
|
175 | + $plugins['recently_activated'][$plugin_file] = $plugin_data; |
|
176 | 176 | } |
177 | 177 | // Populate the inactive list with plugins that aren't activated |
178 | - $plugins['inactive'][ $plugin_file ] = $plugin_data; |
|
178 | + $plugins['inactive'][$plugin_file] = $plugin_data; |
|
179 | 179 | } |
180 | 180 | } |
181 | 181 | |
182 | - if ( $s ) { |
|
182 | + if ($s) { |
|
183 | 183 | $status = 'search'; |
184 | - $plugins['search'] = array_filter( $plugins['all'], array( $this, '_search_callback' ) ); |
|
184 | + $plugins['search'] = array_filter($plugins['all'], array($this, '_search_callback')); |
|
185 | 185 | } |
186 | 186 | |
187 | 187 | $totals = array(); |
188 | - foreach ( $plugins as $type => $list ) |
|
189 | - $totals[ $type ] = count( $list ); |
|
188 | + foreach ($plugins as $type => $list) |
|
189 | + $totals[$type] = count($list); |
|
190 | 190 | |
191 | - if ( empty( $plugins[ $status ] ) && !in_array( $status, array( 'all', 'search' ) ) ) |
|
191 | + if (empty($plugins[$status]) && ! in_array($status, array('all', 'search'))) |
|
192 | 192 | $status = 'all'; |
193 | 193 | |
194 | 194 | $this->items = array(); |
195 | - foreach ( $plugins[ $status ] as $plugin_file => $plugin_data ) { |
|
195 | + foreach ($plugins[$status] as $plugin_file => $plugin_data) { |
|
196 | 196 | // Translate, Don't Apply Markup, Sanitize HTML |
197 | - $this->items[$plugin_file] = _get_plugin_data_markup_translate( $plugin_file, $plugin_data, false, true ); |
|
197 | + $this->items[$plugin_file] = _get_plugin_data_markup_translate($plugin_file, $plugin_data, false, true); |
|
198 | 198 | } |
199 | 199 | |
200 | - $total_this_page = $totals[ $status ]; |
|
200 | + $total_this_page = $totals[$status]; |
|
201 | 201 | |
202 | - if ( ! $orderby ) { |
|
202 | + if ( ! $orderby) { |
|
203 | 203 | $orderby = 'Name'; |
204 | 204 | } else { |
205 | - $orderby = ucfirst( $orderby ); |
|
205 | + $orderby = ucfirst($orderby); |
|
206 | 206 | } |
207 | 207 | |
208 | - $order = strtoupper( $order ); |
|
208 | + $order = strtoupper($order); |
|
209 | 209 | |
210 | - uasort( $this->items, array( $this, '_order_callback' ) ); |
|
210 | + uasort($this->items, array($this, '_order_callback')); |
|
211 | 211 | |
212 | - $plugins_per_page = $this->get_items_per_page( str_replace( '-', '_', $screen->id . '_per_page' ), 999 ); |
|
212 | + $plugins_per_page = $this->get_items_per_page(str_replace('-', '_', $screen->id.'_per_page'), 999); |
|
213 | 213 | |
214 | - $start = ( $page - 1 ) * $plugins_per_page; |
|
214 | + $start = ($page - 1) * $plugins_per_page; |
|
215 | 215 | |
216 | - if ( $total_this_page > $plugins_per_page ) |
|
217 | - $this->items = array_slice( $this->items, $start, $plugins_per_page ); |
|
216 | + if ($total_this_page > $plugins_per_page) |
|
217 | + $this->items = array_slice($this->items, $start, $plugins_per_page); |
|
218 | 218 | |
219 | - $this->set_pagination_args( array( |
|
219 | + $this->set_pagination_args(array( |
|
220 | 220 | 'total_items' => $total_this_page, |
221 | 221 | 'per_page' => $plugins_per_page, |
222 | - ) ); |
|
222 | + )); |
|
223 | 223 | } |
224 | 224 | |
225 | 225 | /** |
@@ -227,13 +227,13 @@ discard block |
||
227 | 227 | * @param array $plugin |
228 | 228 | * @return bool |
229 | 229 | */ |
230 | - public function _search_callback( $plugin ) { |
|
230 | + public function _search_callback($plugin) { |
|
231 | 231 | static $term = null; |
232 | - if ( is_null( $term ) ) |
|
233 | - $term = wp_unslash( $_REQUEST['s'] ); |
|
232 | + if (is_null($term)) |
|
233 | + $term = wp_unslash($_REQUEST['s']); |
|
234 | 234 | |
235 | - foreach ( $plugin as $value ) { |
|
236 | - if ( false !== stripos( strip_tags( $value ), $term ) ) { |
|
235 | + foreach ($plugin as $value) { |
|
236 | + if (false !== stripos(strip_tags($value), $term)) { |
|
237 | 237 | return true; |
238 | 238 | } |
239 | 239 | } |
@@ -248,19 +248,19 @@ discard block |
||
248 | 248 | * @param array $plugin_b |
249 | 249 | * @return int |
250 | 250 | */ |
251 | - public function _order_callback( $plugin_a, $plugin_b ) { |
|
251 | + public function _order_callback($plugin_a, $plugin_b) { |
|
252 | 252 | global $orderby, $order; |
253 | 253 | |
254 | 254 | $a = $plugin_a[$orderby]; |
255 | 255 | $b = $plugin_b[$orderby]; |
256 | 256 | |
257 | - if ( $a == $b ) |
|
257 | + if ($a == $b) |
|
258 | 258 | return 0; |
259 | 259 | |
260 | - if ( 'DESC' == $order ) { |
|
261 | - return strcasecmp( $b, $a ); |
|
260 | + if ('DESC' == $order) { |
|
261 | + return strcasecmp($b, $a); |
|
262 | 262 | } else { |
263 | - return strcasecmp( $a, $b ); |
|
263 | + return strcasecmp($a, $b); |
|
264 | 264 | } |
265 | 265 | } |
266 | 266 | |
@@ -271,10 +271,10 @@ discard block |
||
271 | 271 | public function no_items() { |
272 | 272 | global $plugins; |
273 | 273 | |
274 | - if ( !empty( $plugins['all'] ) ) |
|
275 | - _e( 'No plugins found.' ); |
|
274 | + if ( ! empty($plugins['all'])) |
|
275 | + _e('No plugins found.'); |
|
276 | 276 | else |
277 | - _e( 'You do not appear to have any plugins available at this time.' ); |
|
277 | + _e('You do not appear to have any plugins available at this time.'); |
|
278 | 278 | } |
279 | 279 | |
280 | 280 | /** |
@@ -286,9 +286,9 @@ discard block |
||
286 | 286 | global $status; |
287 | 287 | |
288 | 288 | return array( |
289 | - 'cb' => !in_array( $status, array( 'mustuse', 'dropins' ) ) ? '<input type="checkbox" />' : '', |
|
290 | - 'name' => __( 'Plugin' ), |
|
291 | - 'description' => __( 'Description' ), |
|
289 | + 'cb' => ! in_array($status, array('mustuse', 'dropins')) ? '<input type="checkbox" />' : '', |
|
290 | + 'name' => __('Plugin'), |
|
291 | + 'description' => __('Description'), |
|
292 | 292 | ); |
293 | 293 | } |
294 | 294 | |
@@ -309,39 +309,39 @@ discard block |
||
309 | 309 | global $totals, $status; |
310 | 310 | |
311 | 311 | $status_links = array(); |
312 | - foreach ( $totals as $type => $count ) { |
|
313 | - if ( !$count ) |
|
312 | + foreach ($totals as $type => $count) { |
|
313 | + if ( ! $count) |
|
314 | 314 | continue; |
315 | 315 | |
316 | - switch ( $type ) { |
|
316 | + switch ($type) { |
|
317 | 317 | case 'all': |
318 | - $text = _nx( 'All <span class="count">(%s)</span>', 'All <span class="count">(%s)</span>', $count, 'plugins' ); |
|
318 | + $text = _nx('All <span class="count">(%s)</span>', 'All <span class="count">(%s)</span>', $count, 'plugins'); |
|
319 | 319 | break; |
320 | 320 | case 'active': |
321 | - $text = _n( 'Active <span class="count">(%s)</span>', 'Active <span class="count">(%s)</span>', $count ); |
|
321 | + $text = _n('Active <span class="count">(%s)</span>', 'Active <span class="count">(%s)</span>', $count); |
|
322 | 322 | break; |
323 | 323 | case 'recently_activated': |
324 | - $text = _n( 'Recently Active <span class="count">(%s)</span>', 'Recently Active <span class="count">(%s)</span>', $count ); |
|
324 | + $text = _n('Recently Active <span class="count">(%s)</span>', 'Recently Active <span class="count">(%s)</span>', $count); |
|
325 | 325 | break; |
326 | 326 | case 'inactive': |
327 | - $text = _n( 'Inactive <span class="count">(%s)</span>', 'Inactive <span class="count">(%s)</span>', $count ); |
|
327 | + $text = _n('Inactive <span class="count">(%s)</span>', 'Inactive <span class="count">(%s)</span>', $count); |
|
328 | 328 | break; |
329 | 329 | case 'mustuse': |
330 | - $text = _n( 'Must-Use <span class="count">(%s)</span>', 'Must-Use <span class="count">(%s)</span>', $count ); |
|
330 | + $text = _n('Must-Use <span class="count">(%s)</span>', 'Must-Use <span class="count">(%s)</span>', $count); |
|
331 | 331 | break; |
332 | 332 | case 'dropins': |
333 | - $text = _n( 'Drop-ins <span class="count">(%s)</span>', 'Drop-ins <span class="count">(%s)</span>', $count ); |
|
333 | + $text = _n('Drop-ins <span class="count">(%s)</span>', 'Drop-ins <span class="count">(%s)</span>', $count); |
|
334 | 334 | break; |
335 | 335 | case 'upgrade': |
336 | - $text = _n( 'Update Available <span class="count">(%s)</span>', 'Update Available <span class="count">(%s)</span>', $count ); |
|
336 | + $text = _n('Update Available <span class="count">(%s)</span>', 'Update Available <span class="count">(%s)</span>', $count); |
|
337 | 337 | break; |
338 | 338 | } |
339 | 339 | |
340 | - if ( 'search' != $type ) { |
|
341 | - $status_links[$type] = sprintf( "<a href='%s' %s>%s</a>", |
|
340 | + if ('search' != $type) { |
|
341 | + $status_links[$type] = sprintf("<a href='%s' %s>%s</a>", |
|
342 | 342 | add_query_arg('plugin_status', $type, 'plugins.php'), |
343 | - ( $type == $status ) ? ' class="current"' : '', |
|
344 | - sprintf( $text, number_format_i18n( $count ) ) |
|
343 | + ($type == $status) ? ' class="current"' : '', |
|
344 | + sprintf($text, number_format_i18n($count)) |
|
345 | 345 | ); |
346 | 346 | } |
347 | 347 | } |
@@ -359,17 +359,17 @@ discard block |
||
359 | 359 | |
360 | 360 | $actions = array(); |
361 | 361 | |
362 | - if ( 'active' != $status ) |
|
363 | - $actions['activate-selected'] = $this->screen->in_admin( 'network' ) ? __( 'Network Activate' ) : __( 'Activate' ); |
|
362 | + if ('active' != $status) |
|
363 | + $actions['activate-selected'] = $this->screen->in_admin('network') ? __('Network Activate') : __('Activate'); |
|
364 | 364 | |
365 | - if ( 'inactive' != $status && 'recent' != $status ) |
|
366 | - $actions['deactivate-selected'] = $this->screen->in_admin( 'network' ) ? __( 'Network Deactivate' ) : __( 'Deactivate' ); |
|
365 | + if ('inactive' != $status && 'recent' != $status) |
|
366 | + $actions['deactivate-selected'] = $this->screen->in_admin('network') ? __('Network Deactivate') : __('Deactivate'); |
|
367 | 367 | |
368 | - if ( !is_multisite() || $this->screen->in_admin( 'network' ) ) { |
|
369 | - if ( current_user_can( 'update_plugins' ) ) |
|
370 | - $actions['update-selected'] = __( 'Update' ); |
|
371 | - if ( current_user_can( 'delete_plugins' ) && ( 'active' != $status ) ) |
|
372 | - $actions['delete-selected'] = __( 'Delete' ); |
|
368 | + if ( ! is_multisite() || $this->screen->in_admin('network')) { |
|
369 | + if (current_user_can('update_plugins')) |
|
370 | + $actions['update-selected'] = __('Update'); |
|
371 | + if (current_user_can('delete_plugins') && ('active' != $status)) |
|
372 | + $actions['delete-selected'] = __('Delete'); |
|
373 | 373 | } |
374 | 374 | |
375 | 375 | return $actions; |
@@ -379,33 +379,33 @@ discard block |
||
379 | 379 | * @global string $status |
380 | 380 | * @param string $which |
381 | 381 | */ |
382 | - public function bulk_actions( $which = '' ) { |
|
382 | + public function bulk_actions($which = '') { |
|
383 | 383 | global $status; |
384 | 384 | |
385 | - if ( in_array( $status, array( 'mustuse', 'dropins' ) ) ) |
|
385 | + if (in_array($status, array('mustuse', 'dropins'))) |
|
386 | 386 | return; |
387 | 387 | |
388 | - parent::bulk_actions( $which ); |
|
388 | + parent::bulk_actions($which); |
|
389 | 389 | } |
390 | 390 | |
391 | 391 | /** |
392 | 392 | * @global string $status |
393 | 393 | * @param string $which |
394 | 394 | */ |
395 | - protected function extra_tablenav( $which ) { |
|
395 | + protected function extra_tablenav($which) { |
|
396 | 396 | global $status; |
397 | 397 | |
398 | - if ( ! in_array($status, array('recently_activated', 'mustuse', 'dropins') ) ) |
|
398 | + if ( ! in_array($status, array('recently_activated', 'mustuse', 'dropins'))) |
|
399 | 399 | return; |
400 | 400 | |
401 | 401 | echo '<div class="alignleft actions">'; |
402 | 402 | |
403 | - if ( ! $this->screen->in_admin( 'network' ) && 'recently_activated' == $status ) |
|
404 | - submit_button( __( 'Clear List' ), 'button', 'clear-recent-list', false ); |
|
405 | - elseif ( 'top' == $which && 'mustuse' == $status ) |
|
406 | - echo '<p>' . sprintf( __( 'Files in the <code>%s</code> directory are executed automatically.' ), str_replace( ABSPATH, '/', WPMU_PLUGIN_DIR ) ) . '</p>'; |
|
407 | - elseif ( 'top' == $which && 'dropins' == $status ) |
|
408 | - echo '<p>' . sprintf( __( 'Drop-ins are advanced plugins in the <code>%s</code> directory that replace WordPress functionality when present.' ), str_replace( ABSPATH, '', WP_CONTENT_DIR ) ) . '</p>'; |
|
403 | + if ( ! $this->screen->in_admin('network') && 'recently_activated' == $status) |
|
404 | + submit_button(__('Clear List'), 'button', 'clear-recent-list', false); |
|
405 | + elseif ('top' == $which && 'mustuse' == $status) |
|
406 | + echo '<p>'.sprintf(__('Files in the <code>%s</code> directory are executed automatically.'), str_replace(ABSPATH, '/', WPMU_PLUGIN_DIR)).'</p>'; |
|
407 | + elseif ('top' == $which && 'dropins' == $status) |
|
408 | + echo '<p>'.sprintf(__('Drop-ins are advanced plugins in the <code>%s</code> directory that replace WordPress functionality when present.'), str_replace(ABSPATH, '', WP_CONTENT_DIR)).'</p>'; |
|
409 | 409 | |
410 | 410 | echo '</div>'; |
411 | 411 | } |
@@ -414,7 +414,7 @@ discard block |
||
414 | 414 | * @return string |
415 | 415 | */ |
416 | 416 | public function current_action() { |
417 | - if ( isset($_POST['clear-recent-list']) ) |
|
417 | + if (isset($_POST['clear-recent-list'])) |
|
418 | 418 | return 'clear-recent-list'; |
419 | 419 | |
420 | 420 | return parent::current_action(); |
@@ -427,11 +427,11 @@ discard block |
||
427 | 427 | public function display_rows() { |
428 | 428 | global $status; |
429 | 429 | |
430 | - if ( is_multisite() && ! $this->screen->in_admin( 'network' ) && in_array( $status, array( 'mustuse', 'dropins' ) ) ) |
|
430 | + if (is_multisite() && ! $this->screen->in_admin('network') && in_array($status, array('mustuse', 'dropins'))) |
|
431 | 431 | return; |
432 | 432 | |
433 | - foreach ( $this->items as $plugin_file => $plugin_data ) |
|
434 | - $this->single_row( array( $plugin_file, $plugin_data ) ); |
|
433 | + foreach ($this->items as $plugin_file => $plugin_data) |
|
434 | + $this->single_row(array($plugin_file, $plugin_data)); |
|
435 | 435 | } |
436 | 436 | |
437 | 437 | /** |
@@ -442,10 +442,10 @@ discard block |
||
442 | 442 | * |
443 | 443 | * @param array $item |
444 | 444 | */ |
445 | - public function single_row( $item ) { |
|
445 | + public function single_row($item) { |
|
446 | 446 | global $status, $page, $s, $totals; |
447 | 447 | |
448 | - list( $plugin_file, $plugin_data ) = $item; |
|
448 | + list($plugin_file, $plugin_data) = $item; |
|
449 | 449 | $context = $status; |
450 | 450 | $screen = $this->screen; |
451 | 451 | |
@@ -458,70 +458,70 @@ discard block |
||
458 | 458 | 'delete' => '', |
459 | 459 | ); |
460 | 460 | |
461 | - if ( 'mustuse' == $context ) { |
|
461 | + if ('mustuse' == $context) { |
|
462 | 462 | $is_active = true; |
463 | - } elseif ( 'dropins' == $context ) { |
|
463 | + } elseif ('dropins' == $context) { |
|
464 | 464 | $dropins = _get_dropins(); |
465 | 465 | $plugin_name = $plugin_file; |
466 | - if ( $plugin_file != $plugin_data['Name'] ) |
|
467 | - $plugin_name .= '<br/>' . $plugin_data['Name']; |
|
468 | - if ( true === ( $dropins[ $plugin_file ][1] ) ) { // Doesn't require a constant |
|
466 | + if ($plugin_file != $plugin_data['Name']) |
|
467 | + $plugin_name .= '<br/>'.$plugin_data['Name']; |
|
468 | + if (true === ($dropins[$plugin_file][1])) { // Doesn't require a constant |
|
469 | 469 | $is_active = true; |
470 | - $description = '<p><strong>' . $dropins[ $plugin_file ][0] . '</strong></p>'; |
|
471 | - } elseif ( defined( $dropins[ $plugin_file ][1] ) && constant( $dropins[ $plugin_file ][1] ) ) { // Constant is true |
|
470 | + $description = '<p><strong>'.$dropins[$plugin_file][0].'</strong></p>'; |
|
471 | + } elseif (defined($dropins[$plugin_file][1]) && constant($dropins[$plugin_file][1])) { // Constant is true |
|
472 | 472 | $is_active = true; |
473 | - $description = '<p><strong>' . $dropins[ $plugin_file ][0] . '</strong></p>'; |
|
473 | + $description = '<p><strong>'.$dropins[$plugin_file][0].'</strong></p>'; |
|
474 | 474 | } else { |
475 | 475 | $is_active = false; |
476 | - $description = '<p><strong>' . $dropins[ $plugin_file ][0] . ' <span class="error-message">' . __('Inactive:') . '</span></strong> ' . sprintf( __( 'Requires <code>%s</code> in <code>wp-config.php</code>.' ), "define('" . $dropins[ $plugin_file ][1] . "', true);" ) . '</p>'; |
|
476 | + $description = '<p><strong>'.$dropins[$plugin_file][0].' <span class="error-message">'.__('Inactive:').'</span></strong> '.sprintf(__('Requires <code>%s</code> in <code>wp-config.php</code>.'), "define('".$dropins[$plugin_file][1]."', true);").'</p>'; |
|
477 | 477 | } |
478 | - if ( $plugin_data['Description'] ) |
|
479 | - $description .= '<p>' . $plugin_data['Description'] . '</p>'; |
|
478 | + if ($plugin_data['Description']) |
|
479 | + $description .= '<p>'.$plugin_data['Description'].'</p>'; |
|
480 | 480 | } else { |
481 | - if ( $screen->in_admin( 'network' ) ) |
|
482 | - $is_active = is_plugin_active_for_network( $plugin_file ); |
|
481 | + if ($screen->in_admin('network')) |
|
482 | + $is_active = is_plugin_active_for_network($plugin_file); |
|
483 | 483 | else |
484 | - $is_active = is_plugin_active( $plugin_file ); |
|
484 | + $is_active = is_plugin_active($plugin_file); |
|
485 | 485 | |
486 | - if ( $screen->in_admin( 'network' ) ) { |
|
487 | - if ( $is_active ) { |
|
488 | - if ( current_user_can( 'manage_network_plugins' ) ) { |
|
486 | + if ($screen->in_admin('network')) { |
|
487 | + if ($is_active) { |
|
488 | + if (current_user_can('manage_network_plugins')) { |
|
489 | 489 | /* translators: %s: plugin name */ |
490 | - $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( __( 'Network deactivate %s' ), $plugin_data['Name'] ) ) . '">' . __( 'Network Deactivate' ) . '</a>'; |
|
490 | + $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(__('Network deactivate %s'), $plugin_data['Name'])).'">'.__('Network Deactivate').'</a>'; |
|
491 | 491 | } |
492 | 492 | } else { |
493 | - if ( current_user_can( 'manage_network_plugins' ) ) { |
|
493 | + if (current_user_can('manage_network_plugins')) { |
|
494 | 494 | /* translators: %s: plugin name */ |
495 | - $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( __( 'Network Activate %s' ), $plugin_data['Name'] ) ) . '">' . __( 'Network Activate' ) . '</a>'; |
|
495 | + $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(__('Network Activate %s'), $plugin_data['Name'])).'">'.__('Network Activate').'</a>'; |
|
496 | 496 | } |
497 | - if ( current_user_can( 'delete_plugins' ) && ! is_plugin_active( $plugin_file ) ) { |
|
497 | + if (current_user_can('delete_plugins') && ! is_plugin_active($plugin_file)) { |
|
498 | 498 | /* translators: %s: plugin name */ |
499 | - $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( __( 'Delete %s' ), $plugin_data['Name'] ) ) . '">' . __( 'Delete' ) . '</a>'; |
|
499 | + $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(__('Delete %s'), $plugin_data['Name'])).'">'.__('Delete').'</a>'; |
|
500 | 500 | } |
501 | 501 | } |
502 | 502 | } else { |
503 | - if ( $is_active ) { |
|
503 | + if ($is_active) { |
|
504 | 504 | /* translators: %s: plugin name */ |
505 | - $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( __( 'Deactivate %s' ), $plugin_data['Name'] ) ) . '">' . __( 'Deactivate' ) . '</a>'; |
|
505 | + $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(__('Deactivate %s'), $plugin_data['Name'])).'">'.__('Deactivate').'</a>'; |
|
506 | 506 | } else { |
507 | 507 | /* translators: %s: plugin name */ |
508 | - $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( __( 'Activate %s' ), $plugin_data['Name'] ) ) . '">' . __( 'Activate' ) . '</a>'; |
|
508 | + $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(__('Activate %s'), $plugin_data['Name'])).'">'.__('Activate').'</a>'; |
|
509 | 509 | |
510 | - if ( ! is_multisite() && current_user_can( 'delete_plugins' ) ) { |
|
510 | + if ( ! is_multisite() && current_user_can('delete_plugins')) { |
|
511 | 511 | /* translators: %s: plugin name */ |
512 | - $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( __( 'Delete %s' ), $plugin_data['Name'] ) ) . '">' . __( 'Delete' ) . '</a>'; |
|
512 | + $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(__('Delete %s'), $plugin_data['Name'])).'">'.__('Delete').'</a>'; |
|
513 | 513 | } |
514 | 514 | } // end if $is_active |
515 | 515 | |
516 | 516 | } // end if $screen->in_admin( 'network' ) |
517 | 517 | |
518 | - if ( ( ! is_multisite() || $screen->in_admin( 'network' ) ) && current_user_can( 'edit_plugins' ) && is_writable( WP_PLUGIN_DIR . '/' . $plugin_file ) ) { |
|
518 | + if (( ! is_multisite() || $screen->in_admin('network')) && current_user_can('edit_plugins') && is_writable(WP_PLUGIN_DIR.'/'.$plugin_file)) { |
|
519 | 519 | /* translators: %s: plugin name */ |
520 | - $actions['edit'] = '<a href="plugin-editor.php?file=' . $plugin_file . '" class="edit" aria-label="' . esc_attr( sprintf( __( 'Edit %s' ), $plugin_data['Name'] ) ) . '">' . __( 'Edit' ) . '</a>'; |
|
520 | + $actions['edit'] = '<a href="plugin-editor.php?file='.$plugin_file.'" class="edit" aria-label="'.esc_attr(sprintf(__('Edit %s'), $plugin_data['Name'])).'">'.__('Edit').'</a>'; |
|
521 | 521 | } |
522 | 522 | } // end if $context |
523 | 523 | |
524 | - $prefix = $screen->in_admin( 'network' ) ? 'network_admin_' : ''; |
|
524 | + $prefix = $screen->in_admin('network') ? 'network_admin_' : ''; |
|
525 | 525 | |
526 | 526 | /** |
527 | 527 | * Filter the action links displayed for each plugin in the Plugins list table. |
@@ -547,7 +547,7 @@ discard block |
||
547 | 547 | * 'Inactive', 'Recently Activated', 'Upgrade', |
548 | 548 | * 'Must-Use', 'Drop-ins', 'Search'. |
549 | 549 | */ |
550 | - $actions = apply_filters( $prefix . 'plugin_action_links', array_filter( $actions ), $plugin_file, $plugin_data, $context ); |
|
550 | + $actions = apply_filters($prefix.'plugin_action_links', array_filter($actions), $plugin_file, $plugin_data, $context); |
|
551 | 551 | |
552 | 552 | /** |
553 | 553 | * Filter the list of action links displayed for a specific plugin. |
@@ -569,47 +569,47 @@ discard block |
||
569 | 569 | * 'Inactive', 'Recently Activated', 'Upgrade', |
570 | 570 | * 'Must-Use', 'Drop-ins', 'Search'. |
571 | 571 | */ |
572 | - $actions = apply_filters( $prefix . "plugin_action_links_$plugin_file", $actions, $plugin_file, $plugin_data, $context ); |
|
572 | + $actions = apply_filters($prefix."plugin_action_links_$plugin_file", $actions, $plugin_file, $plugin_data, $context); |
|
573 | 573 | |
574 | 574 | $class = $is_active ? 'active' : 'inactive'; |
575 | - $checkbox_id = "checkbox_" . md5($plugin_data['Name']); |
|
576 | - if ( in_array( $status, array( 'mustuse', 'dropins' ) ) ) { |
|
575 | + $checkbox_id = "checkbox_".md5($plugin_data['Name']); |
|
576 | + if (in_array($status, array('mustuse', 'dropins'))) { |
|
577 | 577 | $checkbox = ''; |
578 | 578 | } else { |
579 | - $checkbox = "<label class='screen-reader-text' for='" . $checkbox_id . "' >" . sprintf( __( 'Select %s' ), $plugin_data['Name'] ) . "</label>" |
|
580 | - . "<input type='checkbox' name='checked[]' value='" . esc_attr( $plugin_file ) . "' id='" . $checkbox_id . "' />"; |
|
579 | + $checkbox = "<label class='screen-reader-text' for='".$checkbox_id."' >".sprintf(__('Select %s'), $plugin_data['Name'])."</label>" |
|
580 | + . "<input type='checkbox' name='checked[]' value='".esc_attr($plugin_file)."' id='".$checkbox_id."' />"; |
|
581 | 581 | } |
582 | - if ( 'dropins' != $context ) { |
|
583 | - $description = '<p>' . ( $plugin_data['Description'] ? $plugin_data['Description'] : ' ' ) . '</p>'; |
|
582 | + if ('dropins' != $context) { |
|
583 | + $description = '<p>'.($plugin_data['Description'] ? $plugin_data['Description'] : ' ').'</p>'; |
|
584 | 584 | $plugin_name = $plugin_data['Name']; |
585 | 585 | } |
586 | 586 | |
587 | - $id = sanitize_title( $plugin_name ); |
|
588 | - if ( ! empty( $totals['upgrade'] ) && ! empty( $plugin_data['update'] ) ) |
|
587 | + $id = sanitize_title($plugin_name); |
|
588 | + if ( ! empty($totals['upgrade']) && ! empty($plugin_data['update'])) |
|
589 | 589 | $class .= ' update'; |
590 | 590 | |
591 | - $plugin_slug = ( isset( $plugin_data['slug'] ) ) ? $plugin_data['slug'] : ''; |
|
592 | - printf( "<tr id='%s' class='%s' data-slug='%s'>", |
|
591 | + $plugin_slug = (isset($plugin_data['slug'])) ? $plugin_data['slug'] : ''; |
|
592 | + printf("<tr id='%s' class='%s' data-slug='%s'>", |
|
593 | 593 | $id, |
594 | 594 | $class, |
595 | 595 | $plugin_slug |
596 | 596 | ); |
597 | 597 | |
598 | - list( $columns, $hidden, $sortable, $primary ) = $this->get_column_info(); |
|
598 | + list($columns, $hidden, $sortable, $primary) = $this->get_column_info(); |
|
599 | 599 | |
600 | - foreach ( $columns as $column_name => $column_display_name ) { |
|
600 | + foreach ($columns as $column_name => $column_display_name) { |
|
601 | 601 | $extra_classes = ''; |
602 | - if ( in_array( $column_name, $hidden ) ) { |
|
602 | + if (in_array($column_name, $hidden)) { |
|
603 | 603 | $extra_classes = ' hidden'; |
604 | 604 | } |
605 | 605 | |
606 | - switch ( $column_name ) { |
|
606 | + switch ($column_name) { |
|
607 | 607 | case 'cb': |
608 | 608 | echo "<th scope='row' class='check-column'>$checkbox</th>"; |
609 | 609 | break; |
610 | 610 | case 'name': |
611 | 611 | echo "<td class='plugin-title column-primary'><strong>$plugin_name</strong>"; |
612 | - echo $this->row_actions( $actions, true ); |
|
612 | + echo $this->row_actions($actions, true); |
|
613 | 613 | echo "</td>"; |
614 | 614 | break; |
615 | 615 | case 'description': |
@@ -620,28 +620,28 @@ discard block |
||
620 | 620 | <div class='$class second plugin-version-author-uri'>"; |
621 | 621 | |
622 | 622 | $plugin_meta = array(); |
623 | - if ( !empty( $plugin_data['Version'] ) ) |
|
624 | - $plugin_meta[] = sprintf( __( 'Version %s' ), $plugin_data['Version'] ); |
|
625 | - if ( !empty( $plugin_data['Author'] ) ) { |
|
623 | + if ( ! empty($plugin_data['Version'])) |
|
624 | + $plugin_meta[] = sprintf(__('Version %s'), $plugin_data['Version']); |
|
625 | + if ( ! empty($plugin_data['Author'])) { |
|
626 | 626 | $author = $plugin_data['Author']; |
627 | - if ( !empty( $plugin_data['AuthorURI'] ) ) |
|
628 | - $author = '<a href="' . $plugin_data['AuthorURI'] . '">' . $plugin_data['Author'] . '</a>'; |
|
629 | - $plugin_meta[] = sprintf( __( 'By %s' ), $author ); |
|
627 | + if ( ! empty($plugin_data['AuthorURI'])) |
|
628 | + $author = '<a href="'.$plugin_data['AuthorURI'].'">'.$plugin_data['Author'].'</a>'; |
|
629 | + $plugin_meta[] = sprintf(__('By %s'), $author); |
|
630 | 630 | } |
631 | 631 | |
632 | 632 | // Details link using API info, if available |
633 | - if ( isset( $plugin_data['slug'] ) && current_user_can( 'install_plugins' ) ) { |
|
634 | - $plugin_meta[] = sprintf( '<a href="%s" class="thickbox" aria-label="%s" data-title="%s">%s</a>', |
|
635 | - esc_url( network_admin_url( 'plugin-install.php?tab=plugin-information&plugin=' . $plugin_data['slug'] . |
|
636 | - '&TB_iframe=true&width=600&height=550' ) ), |
|
637 | - esc_attr( sprintf( __( 'More information about %s' ), $plugin_name ) ), |
|
638 | - esc_attr( $plugin_name ), |
|
639 | - __( 'View details' ) |
|
633 | + if (isset($plugin_data['slug']) && current_user_can('install_plugins')) { |
|
634 | + $plugin_meta[] = sprintf('<a href="%s" class="thickbox" aria-label="%s" data-title="%s">%s</a>', |
|
635 | + esc_url(network_admin_url('plugin-install.php?tab=plugin-information&plugin='.$plugin_data['slug']. |
|
636 | + '&TB_iframe=true&width=600&height=550')), |
|
637 | + esc_attr(sprintf(__('More information about %s'), $plugin_name)), |
|
638 | + esc_attr($plugin_name), |
|
639 | + __('View details') |
|
640 | 640 | ); |
641 | - } elseif ( ! empty( $plugin_data['PluginURI'] ) ) { |
|
642 | - $plugin_meta[] = sprintf( '<a href="%s">%s</a>', |
|
643 | - esc_url( $plugin_data['PluginURI'] ), |
|
644 | - __( 'Visit plugin site' ) |
|
641 | + } elseif ( ! empty($plugin_data['PluginURI'])) { |
|
642 | + $plugin_meta[] = sprintf('<a href="%s">%s</a>', |
|
643 | + esc_url($plugin_data['PluginURI']), |
|
644 | + __('Visit plugin site') |
|
645 | 645 | ); |
646 | 646 | } |
647 | 647 | |
@@ -659,8 +659,8 @@ discard block |
||
659 | 659 | * 'Inactive', 'Recently Activated', 'Upgrade', 'Must-Use', |
660 | 660 | * 'Drop-ins', 'Search'. |
661 | 661 | */ |
662 | - $plugin_meta = apply_filters( 'plugin_row_meta', $plugin_meta, $plugin_file, $plugin_data, $status ); |
|
663 | - echo implode( ' | ', $plugin_meta ); |
|
662 | + $plugin_meta = apply_filters('plugin_row_meta', $plugin_meta, $plugin_file, $plugin_data, $status); |
|
663 | + echo implode(' | ', $plugin_meta); |
|
664 | 664 | |
665 | 665 | echo "</div></td>"; |
666 | 666 | break; |
@@ -678,7 +678,7 @@ discard block |
||
678 | 678 | * @param string $plugin_file Path to the plugin file. |
679 | 679 | * @param array $plugin_data An array of plugin data. |
680 | 680 | */ |
681 | - do_action( 'manage_plugins_custom_column', $column_name, $plugin_file, $plugin_data ); |
|
681 | + do_action('manage_plugins_custom_column', $column_name, $plugin_file, $plugin_data); |
|
682 | 682 | |
683 | 683 | echo "</td>"; |
684 | 684 | } |
@@ -697,7 +697,7 @@ discard block |
||
697 | 697 | * 'Inactive', 'Recently Activated', 'Upgrade', 'Must-Use', |
698 | 698 | * 'Drop-ins', 'Search'. |
699 | 699 | */ |
700 | - do_action( 'after_plugin_row', $plugin_file, $plugin_data, $status ); |
|
700 | + do_action('after_plugin_row', $plugin_file, $plugin_data, $status); |
|
701 | 701 | |
702 | 702 | /** |
703 | 703 | * Fires after each specific row in the Plugins list table. |
@@ -713,7 +713,7 @@ discard block |
||
713 | 713 | * 'Inactive', 'Recently Activated', 'Upgrade', 'Must-Use', |
714 | 714 | * 'Drop-ins', 'Search'. |
715 | 715 | */ |
716 | - do_action( "after_plugin_row_$plugin_file", $plugin_file, $plugin_data, $status ); |
|
716 | + do_action("after_plugin_row_$plugin_file", $plugin_file, $plugin_data, $status); |
|
717 | 717 | } |
718 | 718 | |
719 | 719 | /** |
@@ -31,11 +31,13 @@ discard block |
||
31 | 31 | ) ); |
32 | 32 | |
33 | 33 | $status = 'all'; |
34 | - if ( isset( $_REQUEST['plugin_status'] ) && in_array( $_REQUEST['plugin_status'], array( 'active', 'inactive', 'recently_activated', 'upgrade', 'mustuse', 'dropins', 'search' ) ) ) |
|
35 | - $status = $_REQUEST['plugin_status']; |
|
34 | + if ( isset( $_REQUEST['plugin_status'] ) && in_array( $_REQUEST['plugin_status'], array( 'active', 'inactive', 'recently_activated', 'upgrade', 'mustuse', 'dropins', 'search' ) ) ) { |
|
35 | + $status = $_REQUEST['plugin_status']; |
|
36 | + } |
|
36 | 37 | |
37 | - if ( isset($_REQUEST['s']) ) |
|
38 | - $_SERVER['REQUEST_URI'] = add_query_arg('s', wp_unslash($_REQUEST['s']) ); |
|
38 | + if ( isset($_REQUEST['s']) ) { |
|
39 | + $_SERVER['REQUEST_URI'] = add_query_arg('s', wp_unslash($_REQUEST['s']) ); |
|
40 | + } |
|
39 | 41 | |
40 | 42 | $page = $this->get_pagenum(); |
41 | 43 | } |
@@ -113,8 +115,9 @@ discard block |
||
113 | 115 | } |
114 | 116 | |
115 | 117 | /** This action is documented in wp-admin/includes/class-wp-plugins-list-table.php */ |
116 | - if ( apply_filters( 'show_advanced_plugins', true, 'dropins' ) ) |
|
117 | - $plugins['dropins'] = get_dropins(); |
|
118 | + if ( apply_filters( 'show_advanced_plugins', true, 'dropins' ) ) { |
|
119 | + $plugins['dropins'] = get_dropins(); |
|
120 | + } |
|
118 | 121 | |
119 | 122 | if ( current_user_can( 'update_plugins' ) ) { |
120 | 123 | $current = get_site_transient( 'update_plugins' ); |
@@ -132,9 +135,10 @@ discard block |
||
132 | 135 | if ( ! $screen->in_admin( 'network' ) ) { |
133 | 136 | $recently_activated = get_option( 'recently_activated', array() ); |
134 | 137 | |
135 | - foreach ( $recently_activated as $key => $time ) |
|
136 | - if ( $time + WEEK_IN_SECONDS < time() ) |
|
138 | + foreach ( $recently_activated as $key => $time ) { |
|
139 | + if ( $time + WEEK_IN_SECONDS < time() ) |
|
137 | 140 | unset( $recently_activated[$key] ); |
141 | + } |
|
138 | 142 | update_option( 'recently_activated', $recently_activated ); |
139 | 143 | } |
140 | 144 | |
@@ -185,11 +189,13 @@ discard block |
||
185 | 189 | } |
186 | 190 | |
187 | 191 | $totals = array(); |
188 | - foreach ( $plugins as $type => $list ) |
|
189 | - $totals[ $type ] = count( $list ); |
|
192 | + foreach ( $plugins as $type => $list ) { |
|
193 | + $totals[ $type ] = count( $list ); |
|
194 | + } |
|
190 | 195 | |
191 | - if ( empty( $plugins[ $status ] ) && !in_array( $status, array( 'all', 'search' ) ) ) |
|
192 | - $status = 'all'; |
|
196 | + if ( empty( $plugins[ $status ] ) && !in_array( $status, array( 'all', 'search' ) ) ) { |
|
197 | + $status = 'all'; |
|
198 | + } |
|
193 | 199 | |
194 | 200 | $this->items = array(); |
195 | 201 | foreach ( $plugins[ $status ] as $plugin_file => $plugin_data ) { |
@@ -213,8 +219,9 @@ discard block |
||
213 | 219 | |
214 | 220 | $start = ( $page - 1 ) * $plugins_per_page; |
215 | 221 | |
216 | - if ( $total_this_page > $plugins_per_page ) |
|
217 | - $this->items = array_slice( $this->items, $start, $plugins_per_page ); |
|
222 | + if ( $total_this_page > $plugins_per_page ) { |
|
223 | + $this->items = array_slice( $this->items, $start, $plugins_per_page ); |
|
224 | + } |
|
218 | 225 | |
219 | 226 | $this->set_pagination_args( array( |
220 | 227 | 'total_items' => $total_this_page, |
@@ -229,8 +236,9 @@ discard block |
||
229 | 236 | */ |
230 | 237 | public function _search_callback( $plugin ) { |
231 | 238 | static $term = null; |
232 | - if ( is_null( $term ) ) |
|
233 | - $term = wp_unslash( $_REQUEST['s'] ); |
|
239 | + if ( is_null( $term ) ) { |
|
240 | + $term = wp_unslash( $_REQUEST['s'] ); |
|
241 | + } |
|
234 | 242 | |
235 | 243 | foreach ( $plugin as $value ) { |
236 | 244 | if ( false !== stripos( strip_tags( $value ), $term ) ) { |
@@ -254,8 +262,9 @@ discard block |
||
254 | 262 | $a = $plugin_a[$orderby]; |
255 | 263 | $b = $plugin_b[$orderby]; |
256 | 264 | |
257 | - if ( $a == $b ) |
|
258 | - return 0; |
|
265 | + if ( $a == $b ) { |
|
266 | + return 0; |
|
267 | + } |
|
259 | 268 | |
260 | 269 | if ( 'DESC' == $order ) { |
261 | 270 | return strcasecmp( $b, $a ); |
@@ -271,10 +280,11 @@ discard block |
||
271 | 280 | public function no_items() { |
272 | 281 | global $plugins; |
273 | 282 | |
274 | - if ( !empty( $plugins['all'] ) ) |
|
275 | - _e( 'No plugins found.' ); |
|
276 | - else |
|
277 | - _e( 'You do not appear to have any plugins available at this time.' ); |
|
283 | + if ( !empty( $plugins['all'] ) ) { |
|
284 | + _e( 'No plugins found.' ); |
|
285 | + } else { |
|
286 | + _e( 'You do not appear to have any plugins available at this time.' ); |
|
287 | + } |
|
278 | 288 | } |
279 | 289 | |
280 | 290 | /** |
@@ -310,8 +320,9 @@ discard block |
||
310 | 320 | |
311 | 321 | $status_links = array(); |
312 | 322 | foreach ( $totals as $type => $count ) { |
313 | - if ( !$count ) |
|
314 | - continue; |
|
323 | + if ( !$count ) { |
|
324 | + continue; |
|
325 | + } |
|
315 | 326 | |
316 | 327 | switch ( $type ) { |
317 | 328 | case 'all': |
@@ -359,17 +370,21 @@ discard block |
||
359 | 370 | |
360 | 371 | $actions = array(); |
361 | 372 | |
362 | - if ( 'active' != $status ) |
|
363 | - $actions['activate-selected'] = $this->screen->in_admin( 'network' ) ? __( 'Network Activate' ) : __( 'Activate' ); |
|
373 | + if ( 'active' != $status ) { |
|
374 | + $actions['activate-selected'] = $this->screen->in_admin( 'network' ) ? __( 'Network Activate' ) : __( 'Activate' ); |
|
375 | + } |
|
364 | 376 | |
365 | - if ( 'inactive' != $status && 'recent' != $status ) |
|
366 | - $actions['deactivate-selected'] = $this->screen->in_admin( 'network' ) ? __( 'Network Deactivate' ) : __( 'Deactivate' ); |
|
377 | + if ( 'inactive' != $status && 'recent' != $status ) { |
|
378 | + $actions['deactivate-selected'] = $this->screen->in_admin( 'network' ) ? __( 'Network Deactivate' ) : __( 'Deactivate' ); |
|
379 | + } |
|
367 | 380 | |
368 | 381 | if ( !is_multisite() || $this->screen->in_admin( 'network' ) ) { |
369 | - if ( current_user_can( 'update_plugins' ) ) |
|
370 | - $actions['update-selected'] = __( 'Update' ); |
|
371 | - if ( current_user_can( 'delete_plugins' ) && ( 'active' != $status ) ) |
|
372 | - $actions['delete-selected'] = __( 'Delete' ); |
|
382 | + if ( current_user_can( 'update_plugins' ) ) { |
|
383 | + $actions['update-selected'] = __( 'Update' ); |
|
384 | + } |
|
385 | + if ( current_user_can( 'delete_plugins' ) && ( 'active' != $status ) ) { |
|
386 | + $actions['delete-selected'] = __( 'Delete' ); |
|
387 | + } |
|
373 | 388 | } |
374 | 389 | |
375 | 390 | return $actions; |
@@ -382,8 +397,9 @@ discard block |
||
382 | 397 | public function bulk_actions( $which = '' ) { |
383 | 398 | global $status; |
384 | 399 | |
385 | - if ( in_array( $status, array( 'mustuse', 'dropins' ) ) ) |
|
386 | - return; |
|
400 | + if ( in_array( $status, array( 'mustuse', 'dropins' ) ) ) { |
|
401 | + return; |
|
402 | + } |
|
387 | 403 | |
388 | 404 | parent::bulk_actions( $which ); |
389 | 405 | } |
@@ -395,17 +411,19 @@ discard block |
||
395 | 411 | protected function extra_tablenav( $which ) { |
396 | 412 | global $status; |
397 | 413 | |
398 | - if ( ! in_array($status, array('recently_activated', 'mustuse', 'dropins') ) ) |
|
399 | - return; |
|
414 | + if ( ! in_array($status, array('recently_activated', 'mustuse', 'dropins') ) ) { |
|
415 | + return; |
|
416 | + } |
|
400 | 417 | |
401 | 418 | echo '<div class="alignleft actions">'; |
402 | 419 | |
403 | - if ( ! $this->screen->in_admin( 'network' ) && 'recently_activated' == $status ) |
|
404 | - submit_button( __( 'Clear List' ), 'button', 'clear-recent-list', false ); |
|
405 | - elseif ( 'top' == $which && 'mustuse' == $status ) |
|
406 | - echo '<p>' . sprintf( __( 'Files in the <code>%s</code> directory are executed automatically.' ), str_replace( ABSPATH, '/', WPMU_PLUGIN_DIR ) ) . '</p>'; |
|
407 | - elseif ( 'top' == $which && 'dropins' == $status ) |
|
408 | - echo '<p>' . sprintf( __( 'Drop-ins are advanced plugins in the <code>%s</code> directory that replace WordPress functionality when present.' ), str_replace( ABSPATH, '', WP_CONTENT_DIR ) ) . '</p>'; |
|
420 | + if ( ! $this->screen->in_admin( 'network' ) && 'recently_activated' == $status ) { |
|
421 | + submit_button( __( 'Clear List' ), 'button', 'clear-recent-list', false ); |
|
422 | + } elseif ( 'top' == $which && 'mustuse' == $status ) { |
|
423 | + echo '<p>' . sprintf( __( 'Files in the <code>%s</code> directory are executed automatically.' ), str_replace( ABSPATH, '/', WPMU_PLUGIN_DIR ) ) . '</p>'; |
|
424 | + } elseif ( 'top' == $which && 'dropins' == $status ) { |
|
425 | + echo '<p>' . sprintf( __( 'Drop-ins are advanced plugins in the <code>%s</code> directory that replace WordPress functionality when present.' ), str_replace( ABSPATH, '', WP_CONTENT_DIR ) ) . '</p>'; |
|
426 | + } |
|
409 | 427 | |
410 | 428 | echo '</div>'; |
411 | 429 | } |
@@ -414,8 +432,9 @@ discard block |
||
414 | 432 | * @return string |
415 | 433 | */ |
416 | 434 | public function current_action() { |
417 | - if ( isset($_POST['clear-recent-list']) ) |
|
418 | - return 'clear-recent-list'; |
|
435 | + if ( isset($_POST['clear-recent-list']) ) { |
|
436 | + return 'clear-recent-list'; |
|
437 | + } |
|
419 | 438 | |
420 | 439 | return parent::current_action(); |
421 | 440 | } |
@@ -427,11 +446,13 @@ discard block |
||
427 | 446 | public function display_rows() { |
428 | 447 | global $status; |
429 | 448 | |
430 | - if ( is_multisite() && ! $this->screen->in_admin( 'network' ) && in_array( $status, array( 'mustuse', 'dropins' ) ) ) |
|
431 | - return; |
|
449 | + if ( is_multisite() && ! $this->screen->in_admin( 'network' ) && in_array( $status, array( 'mustuse', 'dropins' ) ) ) { |
|
450 | + return; |
|
451 | + } |
|
432 | 452 | |
433 | - foreach ( $this->items as $plugin_file => $plugin_data ) |
|
434 | - $this->single_row( array( $plugin_file, $plugin_data ) ); |
|
453 | + foreach ( $this->items as $plugin_file => $plugin_data ) { |
|
454 | + $this->single_row( array( $plugin_file, $plugin_data ) ); |
|
455 | + } |
|
435 | 456 | } |
436 | 457 | |
437 | 458 | /** |
@@ -463,8 +484,9 @@ discard block |
||
463 | 484 | } elseif ( 'dropins' == $context ) { |
464 | 485 | $dropins = _get_dropins(); |
465 | 486 | $plugin_name = $plugin_file; |
466 | - if ( $plugin_file != $plugin_data['Name'] ) |
|
467 | - $plugin_name .= '<br/>' . $plugin_data['Name']; |
|
487 | + if ( $plugin_file != $plugin_data['Name'] ) { |
|
488 | + $plugin_name .= '<br/>' . $plugin_data['Name']; |
|
489 | + } |
|
468 | 490 | if ( true === ( $dropins[ $plugin_file ][1] ) ) { // Doesn't require a constant |
469 | 491 | $is_active = true; |
470 | 492 | $description = '<p><strong>' . $dropins[ $plugin_file ][0] . '</strong></p>'; |
@@ -475,13 +497,15 @@ discard block |
||
475 | 497 | $is_active = false; |
476 | 498 | $description = '<p><strong>' . $dropins[ $plugin_file ][0] . ' <span class="error-message">' . __('Inactive:') . '</span></strong> ' . sprintf( __( 'Requires <code>%s</code> in <code>wp-config.php</code>.' ), "define('" . $dropins[ $plugin_file ][1] . "', true);" ) . '</p>'; |
477 | 499 | } |
478 | - if ( $plugin_data['Description'] ) |
|
479 | - $description .= '<p>' . $plugin_data['Description'] . '</p>'; |
|
500 | + if ( $plugin_data['Description'] ) { |
|
501 | + $description .= '<p>' . $plugin_data['Description'] . '</p>'; |
|
502 | + } |
|
480 | 503 | } else { |
481 | - if ( $screen->in_admin( 'network' ) ) |
|
482 | - $is_active = is_plugin_active_for_network( $plugin_file ); |
|
483 | - else |
|
484 | - $is_active = is_plugin_active( $plugin_file ); |
|
504 | + if ( $screen->in_admin( 'network' ) ) { |
|
505 | + $is_active = is_plugin_active_for_network( $plugin_file ); |
|
506 | + } else { |
|
507 | + $is_active = is_plugin_active( $plugin_file ); |
|
508 | + } |
|
485 | 509 | |
486 | 510 | if ( $screen->in_admin( 'network' ) ) { |
487 | 511 | if ( $is_active ) { |
@@ -585,8 +609,9 @@ discard block |
||
585 | 609 | } |
586 | 610 | |
587 | 611 | $id = sanitize_title( $plugin_name ); |
588 | - if ( ! empty( $totals['upgrade'] ) && ! empty( $plugin_data['update'] ) ) |
|
589 | - $class .= ' update'; |
|
612 | + if ( ! empty( $totals['upgrade'] ) && ! empty( $plugin_data['update'] ) ) { |
|
613 | + $class .= ' update'; |
|
614 | + } |
|
590 | 615 | |
591 | 616 | $plugin_slug = ( isset( $plugin_data['slug'] ) ) ? $plugin_data['slug'] : ''; |
592 | 617 | printf( "<tr id='%s' class='%s' data-slug='%s'>", |
@@ -620,12 +645,14 @@ discard block |
||
620 | 645 | <div class='$class second plugin-version-author-uri'>"; |
621 | 646 | |
622 | 647 | $plugin_meta = array(); |
623 | - if ( !empty( $plugin_data['Version'] ) ) |
|
624 | - $plugin_meta[] = sprintf( __( 'Version %s' ), $plugin_data['Version'] ); |
|
648 | + if ( !empty( $plugin_data['Version'] ) ) { |
|
649 | + $plugin_meta[] = sprintf( __( 'Version %s' ), $plugin_data['Version'] ); |
|
650 | + } |
|
625 | 651 | if ( !empty( $plugin_data['Author'] ) ) { |
626 | 652 | $author = $plugin_data['Author']; |
627 | - if ( !empty( $plugin_data['AuthorURI'] ) ) |
|
628 | - $author = '<a href="' . $plugin_data['AuthorURI'] . '">' . $plugin_data['Author'] . '</a>'; |
|
653 | + if ( !empty( $plugin_data['AuthorURI'] ) ) { |
|
654 | + $author = '<a href="' . $plugin_data['AuthorURI'] . '">' . $plugin_data['Author'] . '</a>'; |
|
655 | + } |
|
629 | 656 | $plugin_meta[] = sprintf( __( 'By %s' ), $author ); |
630 | 657 | } |
631 | 658 |
@@ -1,12 +1,12 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * WordPress Administration Scheme API |
|
4 | - * |
|
5 | - * Here we keep the DB structure and option values. |
|
6 | - * |
|
7 | - * @package WordPress |
|
8 | - * @subpackage Administration |
|
9 | - */ |
|
3 | + * WordPress Administration Scheme API |
|
4 | + * |
|
5 | + * Here we keep the DB structure and option values. |
|
6 | + * |
|
7 | + * @package WordPress |
|
8 | + * @subpackage Administration |
|
9 | + */ |
|
10 | 10 | |
11 | 11 | /** |
12 | 12 | * Declare these as global in case schema.php is included from a function. |
@@ -33,21 +33,21 @@ discard block |
||
33 | 33 | * @param int $blog_id Optional. The blog ID for which to retrieve SQL. Default is the current blog ID. |
34 | 34 | * @return string The SQL needed to create the requested tables. |
35 | 35 | */ |
36 | -function wp_get_db_schema( $scope = 'all', $blog_id = null ) { |
|
36 | +function wp_get_db_schema($scope = 'all', $blog_id = null) { |
|
37 | 37 | global $wpdb; |
38 | 38 | |
39 | 39 | $charset_collate = ''; |
40 | 40 | |
41 | - if ( ! empty($wpdb->charset) ) |
|
41 | + if ( ! empty($wpdb->charset)) |
|
42 | 42 | $charset_collate = "DEFAULT CHARACTER SET $wpdb->charset"; |
43 | - if ( ! empty($wpdb->collate) ) |
|
43 | + if ( ! empty($wpdb->collate)) |
|
44 | 44 | $charset_collate .= " COLLATE $wpdb->collate"; |
45 | 45 | |
46 | - if ( $blog_id && $blog_id != $wpdb->blogid ) |
|
47 | - $old_blog_id = $wpdb->set_blog_id( $blog_id ); |
|
46 | + if ($blog_id && $blog_id != $wpdb->blogid) |
|
47 | + $old_blog_id = $wpdb->set_blog_id($blog_id); |
|
48 | 48 | |
49 | 49 | // Engage multisite if in the middle of turning it on from network.php. |
50 | - $is_multisite = is_multisite() || ( defined( 'WP_INSTALLING_NETWORK' ) && WP_INSTALLING_NETWORK ); |
|
50 | + $is_multisite = is_multisite() || (defined('WP_INSTALLING_NETWORK') && WP_INSTALLING_NETWORK); |
|
51 | 51 | |
52 | 52 | /* |
53 | 53 | * Indexes have a maximum size of 767 bytes. Historically, we haven't need to be concerned about that. |
@@ -229,10 +229,10 @@ discard block |
||
229 | 229 | ) $charset_collate;\n"; |
230 | 230 | |
231 | 231 | // Global tables |
232 | - if ( $is_multisite ) |
|
233 | - $global_tables = $users_multi_table . $usermeta_table; |
|
232 | + if ($is_multisite) |
|
233 | + $global_tables = $users_multi_table.$usermeta_table; |
|
234 | 234 | else |
235 | - $global_tables = $users_single_table . $usermeta_table; |
|
235 | + $global_tables = $users_single_table.$usermeta_table; |
|
236 | 236 | |
237 | 237 | // Multisite global tables. |
238 | 238 | $ms_global_tables = "CREATE TABLE $wpdb->blogs ( |
@@ -303,13 +303,13 @@ discard block |
||
303 | 303 | KEY domain_path (domain(140),path(51)) |
304 | 304 | ) $charset_collate;"; |
305 | 305 | |
306 | - switch ( $scope ) { |
|
306 | + switch ($scope) { |
|
307 | 307 | case 'blog' : |
308 | 308 | $queries = $blog_tables; |
309 | 309 | break; |
310 | 310 | case 'global' : |
311 | 311 | $queries = $global_tables; |
312 | - if ( $is_multisite ) |
|
312 | + if ($is_multisite) |
|
313 | 313 | $queries .= $ms_global_tables; |
314 | 314 | break; |
315 | 315 | case 'ms_global' : |
@@ -317,20 +317,20 @@ discard block |
||
317 | 317 | break; |
318 | 318 | case 'all' : |
319 | 319 | default: |
320 | - $queries = $global_tables . $blog_tables; |
|
321 | - if ( $is_multisite ) |
|
320 | + $queries = $global_tables.$blog_tables; |
|
321 | + if ($is_multisite) |
|
322 | 322 | $queries .= $ms_global_tables; |
323 | 323 | break; |
324 | 324 | } |
325 | 325 | |
326 | - if ( isset( $old_blog_id ) ) |
|
327 | - $wpdb->set_blog_id( $old_blog_id ); |
|
326 | + if (isset($old_blog_id)) |
|
327 | + $wpdb->set_blog_id($old_blog_id); |
|
328 | 328 | |
329 | 329 | return $queries; |
330 | 330 | } |
331 | 331 | |
332 | 332 | // Populate for back compat. |
333 | -$wp_queries = wp_get_db_schema( 'all' ); |
|
333 | +$wp_queries = wp_get_db_schema('all'); |
|
334 | 334 | |
335 | 335 | /** |
336 | 336 | * Create WordPress options and set the default values. |
@@ -350,9 +350,9 @@ discard block |
||
350 | 350 | * |
351 | 351 | * @since 2.6.0 |
352 | 352 | */ |
353 | - do_action( 'populate_options' ); |
|
353 | + do_action('populate_options'); |
|
354 | 354 | |
355 | - if ( ini_get('safe_mode') ) { |
|
355 | + if (ini_get('safe_mode')) { |
|
356 | 356 | // Safe mode can break mkdir() so use a flat structure by default. |
357 | 357 | $uploads_use_yearmonth_folders = 0; |
358 | 358 | } else { |
@@ -361,8 +361,8 @@ discard block |
||
361 | 361 | |
362 | 362 | $template = WP_DEFAULT_THEME; |
363 | 363 | // If default theme is a child theme, we need to get its template |
364 | - $theme = wp_get_theme( $template ); |
|
365 | - if ( ! $theme->errors() ) |
|
364 | + $theme = wp_get_theme($template); |
|
365 | + if ( ! $theme->errors()) |
|
366 | 366 | $template = $theme->get_template(); |
367 | 367 | |
368 | 368 | $timezone_string = ''; |
@@ -371,10 +371,10 @@ discard block |
||
371 | 371 | or a valid timezone string (America/New_York). See http://us3.php.net/manual/en/timezones.php |
372 | 372 | for all timezone strings supported by PHP. |
373 | 373 | */ |
374 | - $offset_or_tz = _x( '0', 'default GMT offset or timezone string' ); |
|
375 | - if ( is_numeric( $offset_or_tz ) ) |
|
374 | + $offset_or_tz = _x('0', 'default GMT offset or timezone string'); |
|
375 | + if (is_numeric($offset_or_tz)) |
|
376 | 376 | $gmt_offset = $offset_or_tz; |
377 | - elseif ( $offset_or_tz && in_array( $offset_or_tz, timezone_identifiers_list() ) ) |
|
377 | + elseif ($offset_or_tz && in_array($offset_or_tz, timezone_identifiers_list())) |
|
378 | 378 | $timezone_string = $offset_or_tz; |
379 | 379 | |
380 | 380 | $options = array( |
@@ -386,7 +386,7 @@ discard block |
||
386 | 386 | 'users_can_register' => 0, |
387 | 387 | 'admin_email' => '[email protected]', |
388 | 388 | /* translators: default start of the week. 0 = Sunday, 1 = Monday */ |
389 | - 'start_of_week' => _x( '1', 'start of week' ), |
|
389 | + 'start_of_week' => _x('1', 'start of week'), |
|
390 | 390 | 'use_balanceTags' => 0, |
391 | 391 | 'use_smilies' => 1, |
392 | 392 | 'require_name_email' => 1, |
@@ -502,45 +502,45 @@ discard block |
||
502 | 502 | ); |
503 | 503 | |
504 | 504 | // 3.3 |
505 | - if ( ! is_multisite() ) { |
|
506 | - $options['initial_db_version'] = ! empty( $wp_current_db_version ) && $wp_current_db_version < $wp_db_version |
|
505 | + if ( ! is_multisite()) { |
|
506 | + $options['initial_db_version'] = ! empty($wp_current_db_version) && $wp_current_db_version < $wp_db_version |
|
507 | 507 | ? $wp_current_db_version : $wp_db_version; |
508 | 508 | } |
509 | 509 | |
510 | 510 | // 3.0 multisite |
511 | - if ( is_multisite() ) { |
|
511 | + if (is_multisite()) { |
|
512 | 512 | /* translators: blog tagline */ |
513 | - $options[ 'blogdescription' ] = sprintf(__('Just another %s site'), get_current_site()->site_name ); |
|
514 | - $options[ 'permalink_structure' ] = '/%year%/%monthnum%/%day%/%postname%/'; |
|
513 | + $options['blogdescription'] = sprintf(__('Just another %s site'), get_current_site()->site_name); |
|
514 | + $options['permalink_structure'] = '/%year%/%monthnum%/%day%/%postname%/'; |
|
515 | 515 | } |
516 | 516 | |
517 | 517 | // Set autoload to no for these options |
518 | - $fat_options = array( 'moderation_keys', 'recently_edited', 'blacklist_keys', 'uninstall_plugins' ); |
|
518 | + $fat_options = array('moderation_keys', 'recently_edited', 'blacklist_keys', 'uninstall_plugins'); |
|
519 | 519 | |
520 | - $keys = "'" . implode( "', '", array_keys( $options ) ) . "'"; |
|
521 | - $existing_options = $wpdb->get_col( "SELECT option_name FROM $wpdb->options WHERE option_name in ( $keys )" ); |
|
520 | + $keys = "'".implode("', '", array_keys($options))."'"; |
|
521 | + $existing_options = $wpdb->get_col("SELECT option_name FROM $wpdb->options WHERE option_name in ( $keys )"); |
|
522 | 522 | |
523 | 523 | $insert = ''; |
524 | - foreach ( $options as $option => $value ) { |
|
525 | - if ( in_array($option, $existing_options) ) |
|
524 | + foreach ($options as $option => $value) { |
|
525 | + if (in_array($option, $existing_options)) |
|
526 | 526 | continue; |
527 | - if ( in_array($option, $fat_options) ) |
|
527 | + if (in_array($option, $fat_options)) |
|
528 | 528 | $autoload = 'no'; |
529 | 529 | else |
530 | 530 | $autoload = 'yes'; |
531 | 531 | |
532 | - if ( is_array($value) ) |
|
532 | + if (is_array($value)) |
|
533 | 533 | $value = serialize($value); |
534 | - if ( !empty($insert) ) |
|
534 | + if ( ! empty($insert)) |
|
535 | 535 | $insert .= ', '; |
536 | - $insert .= $wpdb->prepare( "(%s, %s, %s)", $option, $value, $autoload ); |
|
536 | + $insert .= $wpdb->prepare("(%s, %s, %s)", $option, $value, $autoload); |
|
537 | 537 | } |
538 | 538 | |
539 | - if ( !empty($insert) ) |
|
540 | - $wpdb->query("INSERT INTO $wpdb->options (option_name, option_value, autoload) VALUES " . $insert); |
|
539 | + if ( ! empty($insert)) |
|
540 | + $wpdb->query("INSERT INTO $wpdb->options (option_name, option_value, autoload) VALUES ".$insert); |
|
541 | 541 | |
542 | 542 | // In case it is set, but blank, update "home". |
543 | - if ( !__get_option('home') ) update_option('home', $guessurl); |
|
543 | + if ( ! __get_option('home')) update_option('home', $guessurl); |
|
544 | 544 | |
545 | 545 | // Delete unused options. |
546 | 546 | $unusedoptions = array( |
@@ -561,7 +561,7 @@ discard block |
||
561 | 561 | 'wporg_popular_tags', 'what_to_show', 'rss_language', 'language', 'enable_xmlrpc', 'enable_app', |
562 | 562 | 'embed_autourls', 'default_post_edit_rows', |
563 | 563 | ); |
564 | - foreach ( $unusedoptions as $option ) |
|
564 | + foreach ($unusedoptions as $option) |
|
565 | 565 | delete_option($option); |
566 | 566 | |
567 | 567 | // Delete obsolete magpie stuff. |
@@ -578,15 +578,15 @@ discard block |
||
578 | 578 | AND a.option_name NOT LIKE %s |
579 | 579 | AND b.option_name = CONCAT( '_transient_timeout_', SUBSTRING( a.option_name, 12 ) ) |
580 | 580 | AND b.option_value < %d"; |
581 | - $wpdb->query( $wpdb->prepare( $sql, $wpdb->esc_like( '_transient_' ) . '%', $wpdb->esc_like( '_transient_timeout_' ) . '%', $time ) ); |
|
581 | + $wpdb->query($wpdb->prepare($sql, $wpdb->esc_like('_transient_').'%', $wpdb->esc_like('_transient_timeout_').'%', $time)); |
|
582 | 582 | |
583 | - if ( is_main_site() && is_main_network() ) { |
|
583 | + if (is_main_site() && is_main_network()) { |
|
584 | 584 | $sql = "DELETE a, b FROM $wpdb->options a, $wpdb->options b |
585 | 585 | WHERE a.option_name LIKE %s |
586 | 586 | AND a.option_name NOT LIKE %s |
587 | 587 | AND b.option_name = CONCAT( '_site_transient_timeout_', SUBSTRING( a.option_name, 17 ) ) |
588 | 588 | AND b.option_value < %d"; |
589 | - $wpdb->query( $wpdb->prepare( $sql, $wpdb->esc_like( '_site_transient_' ) . '%', $wpdb->esc_like( '_site_transient_timeout_' ) . '%', $time ) ); |
|
589 | + $wpdb->query($wpdb->prepare($sql, $wpdb->esc_like('_site_transient_').'%', $wpdb->esc_like('_site_transient_timeout_').'%', $time)); |
|
590 | 590 | } |
591 | 591 | } |
592 | 592 | |
@@ -720,7 +720,7 @@ discard block |
||
720 | 720 | $roles = array('administrator', 'editor'); |
721 | 721 | foreach ($roles as $role) { |
722 | 722 | $role = get_role($role); |
723 | - if ( empty($role) ) |
|
723 | + if (empty($role)) |
|
724 | 724 | continue; |
725 | 725 | |
726 | 726 | $role->add_cap('edit_others_pages'); |
@@ -741,19 +741,19 @@ discard block |
||
741 | 741 | } |
742 | 742 | |
743 | 743 | $role = get_role('administrator'); |
744 | - if ( ! empty($role) ) { |
|
744 | + if ( ! empty($role)) { |
|
745 | 745 | $role->add_cap('delete_users'); |
746 | 746 | $role->add_cap('create_users'); |
747 | 747 | } |
748 | 748 | |
749 | 749 | $role = get_role('author'); |
750 | - if ( ! empty($role) ) { |
|
750 | + if ( ! empty($role)) { |
|
751 | 751 | $role->add_cap('delete_posts'); |
752 | 752 | $role->add_cap('delete_published_posts'); |
753 | 753 | } |
754 | 754 | |
755 | 755 | $role = get_role('contributor'); |
756 | - if ( ! empty($role) ) { |
|
756 | + if ( ! empty($role)) { |
|
757 | 757 | $role->add_cap('delete_posts'); |
758 | 758 | } |
759 | 759 | } |
@@ -764,10 +764,10 @@ discard block |
||
764 | 764 | * @since 2.3.0 |
765 | 765 | */ |
766 | 766 | function populate_roles_230() { |
767 | - $role = get_role( 'administrator' ); |
|
767 | + $role = get_role('administrator'); |
|
768 | 768 | |
769 | - if ( !empty( $role ) ) { |
|
770 | - $role->add_cap( 'unfiltered_upload' ); |
|
769 | + if ( ! empty($role)) { |
|
770 | + $role->add_cap('unfiltered_upload'); |
|
771 | 771 | } |
772 | 772 | } |
773 | 773 | |
@@ -777,10 +777,10 @@ discard block |
||
777 | 777 | * @since 2.5.0 |
778 | 778 | */ |
779 | 779 | function populate_roles_250() { |
780 | - $role = get_role( 'administrator' ); |
|
780 | + $role = get_role('administrator'); |
|
781 | 781 | |
782 | - if ( !empty( $role ) ) { |
|
783 | - $role->add_cap( 'edit_dashboard' ); |
|
782 | + if ( ! empty($role)) { |
|
783 | + $role->add_cap('edit_dashboard'); |
|
784 | 784 | } |
785 | 785 | } |
786 | 786 | |
@@ -790,11 +790,11 @@ discard block |
||
790 | 790 | * @since 2.6.0 |
791 | 791 | */ |
792 | 792 | function populate_roles_260() { |
793 | - $role = get_role( 'administrator' ); |
|
793 | + $role = get_role('administrator'); |
|
794 | 794 | |
795 | - if ( !empty( $role ) ) { |
|
796 | - $role->add_cap( 'update_plugins' ); |
|
797 | - $role->add_cap( 'delete_plugins' ); |
|
795 | + if ( ! empty($role)) { |
|
796 | + $role->add_cap('update_plugins'); |
|
797 | + $role->add_cap('delete_plugins'); |
|
798 | 798 | } |
799 | 799 | } |
800 | 800 | |
@@ -804,11 +804,11 @@ discard block |
||
804 | 804 | * @since 2.7.0 |
805 | 805 | */ |
806 | 806 | function populate_roles_270() { |
807 | - $role = get_role( 'administrator' ); |
|
807 | + $role = get_role('administrator'); |
|
808 | 808 | |
809 | - if ( !empty( $role ) ) { |
|
810 | - $role->add_cap( 'install_plugins' ); |
|
811 | - $role->add_cap( 'update_themes' ); |
|
809 | + if ( ! empty($role)) { |
|
810 | + $role->add_cap('install_plugins'); |
|
811 | + $role->add_cap('update_themes'); |
|
812 | 812 | } |
813 | 813 | } |
814 | 814 | |
@@ -818,10 +818,10 @@ discard block |
||
818 | 818 | * @since 2.8.0 |
819 | 819 | */ |
820 | 820 | function populate_roles_280() { |
821 | - $role = get_role( 'administrator' ); |
|
821 | + $role = get_role('administrator'); |
|
822 | 822 | |
823 | - if ( !empty( $role ) ) { |
|
824 | - $role->add_cap( 'install_themes' ); |
|
823 | + if ( ! empty($role)) { |
|
824 | + $role->add_cap('install_themes'); |
|
825 | 825 | } |
826 | 826 | } |
827 | 827 | |
@@ -831,23 +831,23 @@ discard block |
||
831 | 831 | * @since 3.0.0 |
832 | 832 | */ |
833 | 833 | function populate_roles_300() { |
834 | - $role = get_role( 'administrator' ); |
|
834 | + $role = get_role('administrator'); |
|
835 | 835 | |
836 | - if ( !empty( $role ) ) { |
|
837 | - $role->add_cap( 'update_core' ); |
|
838 | - $role->add_cap( 'list_users' ); |
|
839 | - $role->add_cap( 'remove_users' ); |
|
836 | + if ( ! empty($role)) { |
|
837 | + $role->add_cap('update_core'); |
|
838 | + $role->add_cap('list_users'); |
|
839 | + $role->add_cap('remove_users'); |
|
840 | 840 | |
841 | 841 | /* |
842 | 842 | * Never used, will be removed. create_users or promote_users |
843 | 843 | * is the capability you're looking for. |
844 | 844 | */ |
845 | - $role->add_cap( 'add_users' ); |
|
845 | + $role->add_cap('add_users'); |
|
846 | 846 | |
847 | - $role->add_cap( 'promote_users' ); |
|
848 | - $role->add_cap( 'edit_theme_options' ); |
|
849 | - $role->add_cap( 'delete_themes' ); |
|
850 | - $role->add_cap( 'export' ); |
|
847 | + $role->add_cap('promote_users'); |
|
848 | + $role->add_cap('edit_theme_options'); |
|
849 | + $role->add_cap('delete_themes'); |
|
850 | + $role->add_cap('export'); |
|
851 | 851 | } |
852 | 852 | } |
853 | 853 | |
@@ -857,12 +857,12 @@ discard block |
||
857 | 857 | * @since 3.0.0 |
858 | 858 | * |
859 | 859 | */ |
860 | -if ( !function_exists( 'install_network' ) ) : |
|
860 | +if ( ! function_exists('install_network')) : |
|
861 | 861 | function install_network() { |
862 | - if ( ! defined( 'WP_INSTALLING_NETWORK' ) ) |
|
863 | - define( 'WP_INSTALLING_NETWORK', true ); |
|
862 | + if ( ! defined('WP_INSTALLING_NETWORK')) |
|
863 | + define('WP_INSTALLING_NETWORK', true); |
|
864 | 864 | |
865 | - dbDelta( wp_get_db_schema( 'global' ) ); |
|
865 | + dbDelta(wp_get_db_schema('global')); |
|
866 | 866 | } |
867 | 867 | endif; |
868 | 868 | |
@@ -880,59 +880,59 @@ discard block |
||
880 | 880 | * @return bool|WP_Error True on success, or WP_Error on warning (with the install otherwise successful, |
881 | 881 | * so the error code must be checked) or failure. |
882 | 882 | */ |
883 | -function populate_network( $network_id = 1, $domain = '', $email = '', $site_name = '', $path = '/', $subdomain_install = false ) { |
|
883 | +function populate_network($network_id = 1, $domain = '', $email = '', $site_name = '', $path = '/', $subdomain_install = false) { |
|
884 | 884 | global $wpdb, $current_site, $wp_db_version, $wp_rewrite; |
885 | 885 | |
886 | 886 | $errors = new WP_Error(); |
887 | - if ( '' == $domain ) |
|
888 | - $errors->add( 'empty_domain', __( 'You must provide a domain name.' ) ); |
|
889 | - if ( '' == $site_name ) |
|
890 | - $errors->add( 'empty_sitename', __( 'You must provide a name for your network of sites.' ) ); |
|
887 | + if ('' == $domain) |
|
888 | + $errors->add('empty_domain', __('You must provide a domain name.')); |
|
889 | + if ('' == $site_name) |
|
890 | + $errors->add('empty_sitename', __('You must provide a name for your network of sites.')); |
|
891 | 891 | |
892 | 892 | // Check for network collision. |
893 | - if ( $network_id == $wpdb->get_var( $wpdb->prepare( "SELECT id FROM $wpdb->site WHERE id = %d", $network_id ) ) ) |
|
894 | - $errors->add( 'siteid_exists', __( 'The network already exists.' ) ); |
|
893 | + if ($network_id == $wpdb->get_var($wpdb->prepare("SELECT id FROM $wpdb->site WHERE id = %d", $network_id))) |
|
894 | + $errors->add('siteid_exists', __('The network already exists.')); |
|
895 | 895 | |
896 | - $site_user = get_user_by( 'email', $email ); |
|
897 | - if ( ! is_email( $email ) ) |
|
898 | - $errors->add( 'invalid_email', __( 'You must provide a valid e-mail address.' ) ); |
|
896 | + $site_user = get_user_by('email', $email); |
|
897 | + if ( ! is_email($email)) |
|
898 | + $errors->add('invalid_email', __('You must provide a valid e-mail address.')); |
|
899 | 899 | |
900 | - if ( $errors->get_error_code() ) |
|
900 | + if ($errors->get_error_code()) |
|
901 | 901 | return $errors; |
902 | 902 | |
903 | 903 | // Set up site tables. |
904 | - $template = get_option( 'template' ); |
|
905 | - $stylesheet = get_option( 'stylesheet' ); |
|
906 | - $allowed_themes = array( $stylesheet => true ); |
|
907 | - if ( $template != $stylesheet ) |
|
908 | - $allowed_themes[ $template ] = true; |
|
909 | - if ( WP_DEFAULT_THEME != $stylesheet && WP_DEFAULT_THEME != $template ) |
|
910 | - $allowed_themes[ WP_DEFAULT_THEME ] = true; |
|
911 | - |
|
912 | - if ( 1 == $network_id ) { |
|
913 | - $wpdb->insert( $wpdb->site, array( 'domain' => $domain, 'path' => $path ) ); |
|
904 | + $template = get_option('template'); |
|
905 | + $stylesheet = get_option('stylesheet'); |
|
906 | + $allowed_themes = array($stylesheet => true); |
|
907 | + if ($template != $stylesheet) |
|
908 | + $allowed_themes[$template] = true; |
|
909 | + if (WP_DEFAULT_THEME != $stylesheet && WP_DEFAULT_THEME != $template) |
|
910 | + $allowed_themes[WP_DEFAULT_THEME] = true; |
|
911 | + |
|
912 | + if (1 == $network_id) { |
|
913 | + $wpdb->insert($wpdb->site, array('domain' => $domain, 'path' => $path)); |
|
914 | 914 | $network_id = $wpdb->insert_id; |
915 | 915 | } else { |
916 | - $wpdb->insert( $wpdb->site, array( 'domain' => $domain, 'path' => $path, 'id' => $network_id ) ); |
|
916 | + $wpdb->insert($wpdb->site, array('domain' => $domain, 'path' => $path, 'id' => $network_id)); |
|
917 | 917 | } |
918 | 918 | |
919 | - wp_cache_delete( 'networks_have_paths', 'site-options' ); |
|
919 | + wp_cache_delete('networks_have_paths', 'site-options'); |
|
920 | 920 | |
921 | - if ( !is_multisite() ) { |
|
922 | - $site_admins = array( $site_user->user_login ); |
|
923 | - $users = get_users( array( 'fields' => array( 'ID', 'user_login' ) ) ); |
|
924 | - if ( $users ) { |
|
925 | - foreach ( $users as $user ) { |
|
926 | - if ( is_super_admin( $user->ID ) && !in_array( $user->user_login, $site_admins ) ) |
|
921 | + if ( ! is_multisite()) { |
|
922 | + $site_admins = array($site_user->user_login); |
|
923 | + $users = get_users(array('fields' => array('ID', 'user_login'))); |
|
924 | + if ($users) { |
|
925 | + foreach ($users as $user) { |
|
926 | + if (is_super_admin($user->ID) && ! in_array($user->user_login, $site_admins)) |
|
927 | 927 | $site_admins[] = $user->user_login; |
928 | 928 | } |
929 | 929 | } |
930 | 930 | } else { |
931 | - $site_admins = get_site_option( 'site_admins' ); |
|
931 | + $site_admins = get_site_option('site_admins'); |
|
932 | 932 | } |
933 | 933 | |
934 | 934 | /* translators: Do not translate USERNAME, SITE_NAME, BLOG_URL, PASSWORD: those are placeholders. */ |
935 | - $welcome_email = __( 'Howdy USERNAME, |
|
935 | + $welcome_email = __('Howdy USERNAME, |
|
936 | 936 | |
937 | 937 | Your new SITE_NAME site has been successfully set up at: |
938 | 938 | BLOG_URL |
@@ -959,34 +959,34 @@ discard block |
||
959 | 959 | ); |
960 | 960 | $audio_exts = wp_get_audio_extensions(); |
961 | 961 | $video_exts = wp_get_video_extensions(); |
962 | - $upload_filetypes = array_unique( array_merge( $misc_exts, $audio_exts, $video_exts ) ); |
|
962 | + $upload_filetypes = array_unique(array_merge($misc_exts, $audio_exts, $video_exts)); |
|
963 | 963 | |
964 | 964 | $sitemeta = array( |
965 | 965 | 'site_name' => $site_name, |
966 | 966 | 'admin_email' => $site_user->user_email, |
967 | 967 | 'admin_user_id' => $site_user->ID, |
968 | 968 | 'registration' => 'none', |
969 | - 'upload_filetypes' => implode( ' ', $upload_filetypes ), |
|
969 | + 'upload_filetypes' => implode(' ', $upload_filetypes), |
|
970 | 970 | 'blog_upload_space' => 100, |
971 | 971 | 'fileupload_maxk' => 1500, |
972 | 972 | 'site_admins' => $site_admins, |
973 | 973 | 'allowedthemes' => $allowed_themes, |
974 | - 'illegal_names' => array( 'www', 'web', 'root', 'admin', 'main', 'invite', 'administrator', 'files' ), |
|
974 | + 'illegal_names' => array('www', 'web', 'root', 'admin', 'main', 'invite', 'administrator', 'files'), |
|
975 | 975 | 'wpmu_upgrade_site' => $wp_db_version, |
976 | 976 | 'welcome_email' => $welcome_email, |
977 | - 'first_post' => __( 'Welcome to <a href="SITE_URL">SITE_NAME</a>. This is your first post. Edit or delete it, then start blogging!' ), |
|
977 | + 'first_post' => __('Welcome to <a href="SITE_URL">SITE_NAME</a>. This is your first post. Edit or delete it, then start blogging!'), |
|
978 | 978 | // @todo - network admins should have a method of editing the network siteurl (used for cookie hash) |
979 | - 'siteurl' => get_option( 'siteurl' ) . '/', |
|
979 | + 'siteurl' => get_option('siteurl').'/', |
|
980 | 980 | 'add_new_users' => '0', |
981 | - 'upload_space_check_disabled' => is_multisite() ? get_site_option( 'upload_space_check_disabled' ) : '1', |
|
982 | - 'subdomain_install' => intval( $subdomain_install ), |
|
981 | + 'upload_space_check_disabled' => is_multisite() ? get_site_option('upload_space_check_disabled') : '1', |
|
982 | + 'subdomain_install' => intval($subdomain_install), |
|
983 | 983 | 'global_terms_enabled' => global_terms_enabled() ? '1' : '0', |
984 | - 'ms_files_rewriting' => is_multisite() ? get_site_option( 'ms_files_rewriting' ) : '0', |
|
985 | - 'initial_db_version' => get_option( 'initial_db_version' ), |
|
984 | + 'ms_files_rewriting' => is_multisite() ? get_site_option('ms_files_rewriting') : '0', |
|
985 | + 'initial_db_version' => get_option('initial_db_version'), |
|
986 | 986 | 'active_sitewide_plugins' => array(), |
987 | 987 | 'WPLANG' => get_locale(), |
988 | 988 | ); |
989 | - if ( ! $subdomain_install ) |
|
989 | + if ( ! $subdomain_install) |
|
990 | 990 | $sitemeta['illegal_names'][] = 'blog'; |
991 | 991 | |
992 | 992 | /** |
@@ -997,17 +997,17 @@ discard block |
||
997 | 997 | * @param array $sitemeta Associative array of network meta keys and values to be inserted. |
998 | 998 | * @param int $network_id ID of network to populate. |
999 | 999 | */ |
1000 | - $sitemeta = apply_filters( 'populate_network_meta', $sitemeta, $network_id ); |
|
1000 | + $sitemeta = apply_filters('populate_network_meta', $sitemeta, $network_id); |
|
1001 | 1001 | |
1002 | 1002 | $insert = ''; |
1003 | - foreach ( $sitemeta as $meta_key => $meta_value ) { |
|
1004 | - if ( is_array( $meta_value ) ) |
|
1005 | - $meta_value = serialize( $meta_value ); |
|
1006 | - if ( !empty( $insert ) ) |
|
1003 | + foreach ($sitemeta as $meta_key => $meta_value) { |
|
1004 | + if (is_array($meta_value)) |
|
1005 | + $meta_value = serialize($meta_value); |
|
1006 | + if ( ! empty($insert)) |
|
1007 | 1007 | $insert .= ', '; |
1008 | - $insert .= $wpdb->prepare( "( %d, %s, %s)", $network_id, $meta_key, $meta_value ); |
|
1008 | + $insert .= $wpdb->prepare("( %d, %s, %s)", $network_id, $meta_key, $meta_value); |
|
1009 | 1009 | } |
1010 | - $wpdb->query( "INSERT INTO $wpdb->sitemeta ( site_id, meta_key, meta_value ) VALUES " . $insert ); |
|
1010 | + $wpdb->query("INSERT INTO $wpdb->sitemeta ( site_id, meta_key, meta_value ) VALUES ".$insert); |
|
1011 | 1011 | |
1012 | 1012 | /* |
1013 | 1013 | * When upgrading from single to multisite, assume the current site will |
@@ -1016,44 +1016,44 @@ discard block |
||
1016 | 1016 | * these steps since the main site of the new network has not yet been |
1017 | 1017 | * created. |
1018 | 1018 | */ |
1019 | - if ( ! is_multisite() ) { |
|
1019 | + if ( ! is_multisite()) { |
|
1020 | 1020 | $current_site = new stdClass; |
1021 | 1021 | $current_site->domain = $domain; |
1022 | 1022 | $current_site->path = $path; |
1023 | - $current_site->site_name = ucfirst( $domain ); |
|
1024 | - $wpdb->insert( $wpdb->blogs, array( 'site_id' => $network_id, 'blog_id' => 1, 'domain' => $domain, 'path' => $path, 'registered' => current_time( 'mysql' ) ) ); |
|
1023 | + $current_site->site_name = ucfirst($domain); |
|
1024 | + $wpdb->insert($wpdb->blogs, array('site_id' => $network_id, 'blog_id' => 1, 'domain' => $domain, 'path' => $path, 'registered' => current_time('mysql'))); |
|
1025 | 1025 | $current_site->blog_id = $blog_id = $wpdb->insert_id; |
1026 | - update_user_meta( $site_user->ID, 'source_domain', $domain ); |
|
1027 | - update_user_meta( $site_user->ID, 'primary_blog', $blog_id ); |
|
1026 | + update_user_meta($site_user->ID, 'source_domain', $domain); |
|
1027 | + update_user_meta($site_user->ID, 'primary_blog', $blog_id); |
|
1028 | 1028 | |
1029 | - if ( $subdomain_install ) |
|
1030 | - $wp_rewrite->set_permalink_structure( '/%year%/%monthnum%/%day%/%postname%/' ); |
|
1029 | + if ($subdomain_install) |
|
1030 | + $wp_rewrite->set_permalink_structure('/%year%/%monthnum%/%day%/%postname%/'); |
|
1031 | 1031 | else |
1032 | - $wp_rewrite->set_permalink_structure( '/blog/%year%/%monthnum%/%day%/%postname%/' ); |
|
1032 | + $wp_rewrite->set_permalink_structure('/blog/%year%/%monthnum%/%day%/%postname%/'); |
|
1033 | 1033 | |
1034 | 1034 | flush_rewrite_rules(); |
1035 | 1035 | |
1036 | - if ( ! $subdomain_install ) |
|
1036 | + if ( ! $subdomain_install) |
|
1037 | 1037 | return true; |
1038 | 1038 | |
1039 | 1039 | $vhost_ok = false; |
1040 | 1040 | $errstr = ''; |
1041 | - $hostname = substr( md5( time() ), 0, 6 ) . '.' . $domain; // Very random hostname! |
|
1042 | - $page = wp_remote_get( 'http://' . $hostname, array( 'timeout' => 5, 'httpversion' => '1.1' ) ); |
|
1043 | - if ( is_wp_error( $page ) ) |
|
1041 | + $hostname = substr(md5(time()), 0, 6).'.'.$domain; // Very random hostname! |
|
1042 | + $page = wp_remote_get('http://'.$hostname, array('timeout' => 5, 'httpversion' => '1.1')); |
|
1043 | + if (is_wp_error($page)) |
|
1044 | 1044 | $errstr = $page->get_error_message(); |
1045 | - elseif ( 200 == wp_remote_retrieve_response_code( $page ) ) |
|
1045 | + elseif (200 == wp_remote_retrieve_response_code($page)) |
|
1046 | 1046 | $vhost_ok = true; |
1047 | 1047 | |
1048 | - if ( ! $vhost_ok ) { |
|
1049 | - $msg = '<p><strong>' . __( 'Warning! Wildcard DNS may not be configured correctly!' ) . '</strong></p>'; |
|
1050 | - $msg .= '<p>' . sprintf( __( 'The installer attempted to contact a random hostname (<code>%1$s</code>) on your domain.' ), $hostname ); |
|
1051 | - if ( ! empty ( $errstr ) ) |
|
1052 | - $msg .= ' ' . sprintf( __( 'This resulted in an error message: %s' ), '<code>' . $errstr . '</code>' ); |
|
1048 | + if ( ! $vhost_ok) { |
|
1049 | + $msg = '<p><strong>'.__('Warning! Wildcard DNS may not be configured correctly!').'</strong></p>'; |
|
1050 | + $msg .= '<p>'.sprintf(__('The installer attempted to contact a random hostname (<code>%1$s</code>) on your domain.'), $hostname); |
|
1051 | + if ( ! empty ($errstr)) |
|
1052 | + $msg .= ' '.sprintf(__('This resulted in an error message: %s'), '<code>'.$errstr.'</code>'); |
|
1053 | 1053 | $msg .= '</p>'; |
1054 | - $msg .= '<p>' . __( 'To use a subdomain configuration, you must have a wildcard entry in your DNS. This usually means adding a <code>*</code> hostname record pointing at your web server in your DNS configuration tool.' ) . '</p>'; |
|
1055 | - $msg .= '<p>' . __( 'You can still use your site but any subdomain you create may not be accessible. If you know your DNS is correct, ignore this message.' ) . '</p>'; |
|
1056 | - return new WP_Error( 'no_wildcard_dns', $msg ); |
|
1054 | + $msg .= '<p>'.__('To use a subdomain configuration, you must have a wildcard entry in your DNS. This usually means adding a <code>*</code> hostname record pointing at your web server in your DNS configuration tool.').'</p>'; |
|
1055 | + $msg .= '<p>'.__('You can still use your site but any subdomain you create may not be accessible. If you know your DNS is correct, ignore this message.').'</p>'; |
|
1056 | + return new WP_Error('no_wildcard_dns', $msg); |
|
1057 | 1057 | } |
1058 | 1058 | } |
1059 | 1059 |
@@ -38,13 +38,16 @@ discard block |
||
38 | 38 | |
39 | 39 | $charset_collate = ''; |
40 | 40 | |
41 | - if ( ! empty($wpdb->charset) ) |
|
42 | - $charset_collate = "DEFAULT CHARACTER SET $wpdb->charset"; |
|
43 | - if ( ! empty($wpdb->collate) ) |
|
44 | - $charset_collate .= " COLLATE $wpdb->collate"; |
|
41 | + if ( ! empty($wpdb->charset) ) { |
|
42 | + $charset_collate = "DEFAULT CHARACTER SET $wpdb->charset"; |
|
43 | + } |
|
44 | + if ( ! empty($wpdb->collate) ) { |
|
45 | + $charset_collate .= " COLLATE $wpdb->collate"; |
|
46 | + } |
|
45 | 47 | |
46 | - if ( $blog_id && $blog_id != $wpdb->blogid ) |
|
47 | - $old_blog_id = $wpdb->set_blog_id( $blog_id ); |
|
48 | + if ( $blog_id && $blog_id != $wpdb->blogid ) { |
|
49 | + $old_blog_id = $wpdb->set_blog_id( $blog_id ); |
|
50 | + } |
|
48 | 51 | |
49 | 52 | // Engage multisite if in the middle of turning it on from network.php. |
50 | 53 | $is_multisite = is_multisite() || ( defined( 'WP_INSTALLING_NETWORK' ) && WP_INSTALLING_NETWORK ); |
@@ -229,10 +232,11 @@ discard block |
||
229 | 232 | ) $charset_collate;\n"; |
230 | 233 | |
231 | 234 | // Global tables |
232 | - if ( $is_multisite ) |
|
233 | - $global_tables = $users_multi_table . $usermeta_table; |
|
234 | - else |
|
235 | - $global_tables = $users_single_table . $usermeta_table; |
|
235 | + if ( $is_multisite ) { |
|
236 | + $global_tables = $users_multi_table . $usermeta_table; |
|
237 | + } else { |
|
238 | + $global_tables = $users_single_table . $usermeta_table; |
|
239 | + } |
|
236 | 240 | |
237 | 241 | // Multisite global tables. |
238 | 242 | $ms_global_tables = "CREATE TABLE $wpdb->blogs ( |
@@ -309,8 +313,9 @@ discard block |
||
309 | 313 | break; |
310 | 314 | case 'global' : |
311 | 315 | $queries = $global_tables; |
312 | - if ( $is_multisite ) |
|
313 | - $queries .= $ms_global_tables; |
|
316 | + if ( $is_multisite ) { |
|
317 | + $queries .= $ms_global_tables; |
|
318 | + } |
|
314 | 319 | break; |
315 | 320 | case 'ms_global' : |
316 | 321 | $queries = $ms_global_tables; |
@@ -318,13 +323,15 @@ discard block |
||
318 | 323 | case 'all' : |
319 | 324 | default: |
320 | 325 | $queries = $global_tables . $blog_tables; |
321 | - if ( $is_multisite ) |
|
322 | - $queries .= $ms_global_tables; |
|
326 | + if ( $is_multisite ) { |
|
327 | + $queries .= $ms_global_tables; |
|
328 | + } |
|
323 | 329 | break; |
324 | 330 | } |
325 | 331 | |
326 | - if ( isset( $old_blog_id ) ) |
|
327 | - $wpdb->set_blog_id( $old_blog_id ); |
|
332 | + if ( isset( $old_blog_id ) ) { |
|
333 | + $wpdb->set_blog_id( $old_blog_id ); |
|
334 | + } |
|
328 | 335 | |
329 | 336 | return $queries; |
330 | 337 | } |
@@ -362,8 +369,9 @@ discard block |
||
362 | 369 | $template = WP_DEFAULT_THEME; |
363 | 370 | // If default theme is a child theme, we need to get its template |
364 | 371 | $theme = wp_get_theme( $template ); |
365 | - if ( ! $theme->errors() ) |
|
366 | - $template = $theme->get_template(); |
|
372 | + if ( ! $theme->errors() ) { |
|
373 | + $template = $theme->get_template(); |
|
374 | + } |
|
367 | 375 | |
368 | 376 | $timezone_string = ''; |
369 | 377 | $gmt_offset = 0; |
@@ -372,10 +380,11 @@ discard block |
||
372 | 380 | for all timezone strings supported by PHP. |
373 | 381 | */ |
374 | 382 | $offset_or_tz = _x( '0', 'default GMT offset or timezone string' ); |
375 | - if ( is_numeric( $offset_or_tz ) ) |
|
376 | - $gmt_offset = $offset_or_tz; |
|
377 | - elseif ( $offset_or_tz && in_array( $offset_or_tz, timezone_identifiers_list() ) ) |
|
378 | - $timezone_string = $offset_or_tz; |
|
383 | + if ( is_numeric( $offset_or_tz ) ) { |
|
384 | + $gmt_offset = $offset_or_tz; |
|
385 | + } elseif ( $offset_or_tz && in_array( $offset_or_tz, timezone_identifiers_list() ) ) { |
|
386 | + $timezone_string = $offset_or_tz; |
|
387 | + } |
|
379 | 388 | |
380 | 389 | $options = array( |
381 | 390 | 'siteurl' => $guessurl, |
@@ -522,25 +531,32 @@ discard block |
||
522 | 531 | |
523 | 532 | $insert = ''; |
524 | 533 | foreach ( $options as $option => $value ) { |
525 | - if ( in_array($option, $existing_options) ) |
|
526 | - continue; |
|
527 | - if ( in_array($option, $fat_options) ) |
|
528 | - $autoload = 'no'; |
|
529 | - else |
|
530 | - $autoload = 'yes'; |
|
531 | - |
|
532 | - if ( is_array($value) ) |
|
533 | - $value = serialize($value); |
|
534 | - if ( !empty($insert) ) |
|
535 | - $insert .= ', '; |
|
534 | + if ( in_array($option, $existing_options) ) { |
|
535 | + continue; |
|
536 | + } |
|
537 | + if ( in_array($option, $fat_options) ) { |
|
538 | + $autoload = 'no'; |
|
539 | + } else { |
|
540 | + $autoload = 'yes'; |
|
541 | + } |
|
542 | + |
|
543 | + if ( is_array($value) ) { |
|
544 | + $value = serialize($value); |
|
545 | + } |
|
546 | + if ( !empty($insert) ) { |
|
547 | + $insert .= ', '; |
|
548 | + } |
|
536 | 549 | $insert .= $wpdb->prepare( "(%s, %s, %s)", $option, $value, $autoload ); |
537 | 550 | } |
538 | 551 | |
539 | - if ( !empty($insert) ) |
|
540 | - $wpdb->query("INSERT INTO $wpdb->options (option_name, option_value, autoload) VALUES " . $insert); |
|
552 | + if ( !empty($insert) ) { |
|
553 | + $wpdb->query("INSERT INTO $wpdb->options (option_name, option_value, autoload) VALUES " . $insert); |
|
554 | + } |
|
541 | 555 | |
542 | 556 | // In case it is set, but blank, update "home". |
543 | - if ( !__get_option('home') ) update_option('home', $guessurl); |
|
557 | + if ( !__get_option('home') ) { |
|
558 | + update_option('home', $guessurl); |
|
559 | + } |
|
544 | 560 | |
545 | 561 | // Delete unused options. |
546 | 562 | $unusedoptions = array( |
@@ -561,8 +577,9 @@ discard block |
||
561 | 577 | 'wporg_popular_tags', 'what_to_show', 'rss_language', 'language', 'enable_xmlrpc', 'enable_app', |
562 | 578 | 'embed_autourls', 'default_post_edit_rows', |
563 | 579 | ); |
564 | - foreach ( $unusedoptions as $option ) |
|
565 | - delete_option($option); |
|
580 | + foreach ( $unusedoptions as $option ) { |
|
581 | + delete_option($option); |
|
582 | + } |
|
566 | 583 | |
567 | 584 | // Delete obsolete magpie stuff. |
568 | 585 | $wpdb->query("DELETE FROM $wpdb->options WHERE option_name REGEXP '^rss_[0-9a-f]{32}(_ts)?$'"); |
@@ -720,8 +737,9 @@ discard block |
||
720 | 737 | $roles = array('administrator', 'editor'); |
721 | 738 | foreach ($roles as $role) { |
722 | 739 | $role = get_role($role); |
723 | - if ( empty($role) ) |
|
724 | - continue; |
|
740 | + if ( empty($role) ) { |
|
741 | + continue; |
|
742 | + } |
|
725 | 743 | |
726 | 744 | $role->add_cap('edit_others_pages'); |
727 | 745 | $role->add_cap('edit_published_pages'); |
@@ -859,8 +877,9 @@ discard block |
||
859 | 877 | */ |
860 | 878 | if ( !function_exists( 'install_network' ) ) : |
861 | 879 | function install_network() { |
862 | - if ( ! defined( 'WP_INSTALLING_NETWORK' ) ) |
|
863 | - define( 'WP_INSTALLING_NETWORK', true ); |
|
880 | + if ( ! defined( 'WP_INSTALLING_NETWORK' ) ) { |
|
881 | + define( 'WP_INSTALLING_NETWORK', true ); |
|
882 | + } |
|
864 | 883 | |
865 | 884 | dbDelta( wp_get_db_schema( 'global' ) ); |
866 | 885 | } |
@@ -884,30 +903,37 @@ discard block |
||
884 | 903 | global $wpdb, $current_site, $wp_db_version, $wp_rewrite; |
885 | 904 | |
886 | 905 | $errors = new WP_Error(); |
887 | - if ( '' == $domain ) |
|
888 | - $errors->add( 'empty_domain', __( 'You must provide a domain name.' ) ); |
|
889 | - if ( '' == $site_name ) |
|
890 | - $errors->add( 'empty_sitename', __( 'You must provide a name for your network of sites.' ) ); |
|
906 | + if ( '' == $domain ) { |
|
907 | + $errors->add( 'empty_domain', __( 'You must provide a domain name.' ) ); |
|
908 | + } |
|
909 | + if ( '' == $site_name ) { |
|
910 | + $errors->add( 'empty_sitename', __( 'You must provide a name for your network of sites.' ) ); |
|
911 | + } |
|
891 | 912 | |
892 | 913 | // Check for network collision. |
893 | - if ( $network_id == $wpdb->get_var( $wpdb->prepare( "SELECT id FROM $wpdb->site WHERE id = %d", $network_id ) ) ) |
|
894 | - $errors->add( 'siteid_exists', __( 'The network already exists.' ) ); |
|
914 | + if ( $network_id == $wpdb->get_var( $wpdb->prepare( "SELECT id FROM $wpdb->site WHERE id = %d", $network_id ) ) ) { |
|
915 | + $errors->add( 'siteid_exists', __( 'The network already exists.' ) ); |
|
916 | + } |
|
895 | 917 | |
896 | 918 | $site_user = get_user_by( 'email', $email ); |
897 | - if ( ! is_email( $email ) ) |
|
898 | - $errors->add( 'invalid_email', __( 'You must provide a valid e-mail address.' ) ); |
|
919 | + if ( ! is_email( $email ) ) { |
|
920 | + $errors->add( 'invalid_email', __( 'You must provide a valid e-mail address.' ) ); |
|
921 | + } |
|
899 | 922 | |
900 | - if ( $errors->get_error_code() ) |
|
901 | - return $errors; |
|
923 | + if ( $errors->get_error_code() ) { |
|
924 | + return $errors; |
|
925 | + } |
|
902 | 926 | |
903 | 927 | // Set up site tables. |
904 | 928 | $template = get_option( 'template' ); |
905 | 929 | $stylesheet = get_option( 'stylesheet' ); |
906 | 930 | $allowed_themes = array( $stylesheet => true ); |
907 | - if ( $template != $stylesheet ) |
|
908 | - $allowed_themes[ $template ] = true; |
|
909 | - if ( WP_DEFAULT_THEME != $stylesheet && WP_DEFAULT_THEME != $template ) |
|
910 | - $allowed_themes[ WP_DEFAULT_THEME ] = true; |
|
931 | + if ( $template != $stylesheet ) { |
|
932 | + $allowed_themes[ $template ] = true; |
|
933 | + } |
|
934 | + if ( WP_DEFAULT_THEME != $stylesheet && WP_DEFAULT_THEME != $template ) { |
|
935 | + $allowed_themes[ WP_DEFAULT_THEME ] = true; |
|
936 | + } |
|
911 | 937 | |
912 | 938 | if ( 1 == $network_id ) { |
913 | 939 | $wpdb->insert( $wpdb->site, array( 'domain' => $domain, 'path' => $path ) ); |
@@ -923,8 +949,9 @@ discard block |
||
923 | 949 | $users = get_users( array( 'fields' => array( 'ID', 'user_login' ) ) ); |
924 | 950 | if ( $users ) { |
925 | 951 | foreach ( $users as $user ) { |
926 | - if ( is_super_admin( $user->ID ) && !in_array( $user->user_login, $site_admins ) ) |
|
927 | - $site_admins[] = $user->user_login; |
|
952 | + if ( is_super_admin( $user->ID ) && !in_array( $user->user_login, $site_admins ) ) { |
|
953 | + $site_admins[] = $user->user_login; |
|
954 | + } |
|
928 | 955 | } |
929 | 956 | } |
930 | 957 | } else { |
@@ -986,8 +1013,9 @@ discard block |
||
986 | 1013 | 'active_sitewide_plugins' => array(), |
987 | 1014 | 'WPLANG' => get_locale(), |
988 | 1015 | ); |
989 | - if ( ! $subdomain_install ) |
|
990 | - $sitemeta['illegal_names'][] = 'blog'; |
|
1016 | + if ( ! $subdomain_install ) { |
|
1017 | + $sitemeta['illegal_names'][] = 'blog'; |
|
1018 | + } |
|
991 | 1019 | |
992 | 1020 | /** |
993 | 1021 | * Filter meta for a network on creation. |
@@ -1001,10 +1029,12 @@ discard block |
||
1001 | 1029 | |
1002 | 1030 | $insert = ''; |
1003 | 1031 | foreach ( $sitemeta as $meta_key => $meta_value ) { |
1004 | - if ( is_array( $meta_value ) ) |
|
1005 | - $meta_value = serialize( $meta_value ); |
|
1006 | - if ( !empty( $insert ) ) |
|
1007 | - $insert .= ', '; |
|
1032 | + if ( is_array( $meta_value ) ) { |
|
1033 | + $meta_value = serialize( $meta_value ); |
|
1034 | + } |
|
1035 | + if ( !empty( $insert ) ) { |
|
1036 | + $insert .= ', '; |
|
1037 | + } |
|
1008 | 1038 | $insert .= $wpdb->prepare( "( %d, %s, %s)", $network_id, $meta_key, $meta_value ); |
1009 | 1039 | } |
1010 | 1040 | $wpdb->query( "INSERT INTO $wpdb->sitemeta ( site_id, meta_key, meta_value ) VALUES " . $insert ); |
@@ -1026,30 +1056,34 @@ discard block |
||
1026 | 1056 | update_user_meta( $site_user->ID, 'source_domain', $domain ); |
1027 | 1057 | update_user_meta( $site_user->ID, 'primary_blog', $blog_id ); |
1028 | 1058 | |
1029 | - if ( $subdomain_install ) |
|
1030 | - $wp_rewrite->set_permalink_structure( '/%year%/%monthnum%/%day%/%postname%/' ); |
|
1031 | - else |
|
1032 | - $wp_rewrite->set_permalink_structure( '/blog/%year%/%monthnum%/%day%/%postname%/' ); |
|
1059 | + if ( $subdomain_install ) { |
|
1060 | + $wp_rewrite->set_permalink_structure( '/%year%/%monthnum%/%day%/%postname%/' ); |
|
1061 | + } else { |
|
1062 | + $wp_rewrite->set_permalink_structure( '/blog/%year%/%monthnum%/%day%/%postname%/' ); |
|
1063 | + } |
|
1033 | 1064 | |
1034 | 1065 | flush_rewrite_rules(); |
1035 | 1066 | |
1036 | - if ( ! $subdomain_install ) |
|
1037 | - return true; |
|
1067 | + if ( ! $subdomain_install ) { |
|
1068 | + return true; |
|
1069 | + } |
|
1038 | 1070 | |
1039 | 1071 | $vhost_ok = false; |
1040 | 1072 | $errstr = ''; |
1041 | 1073 | $hostname = substr( md5( time() ), 0, 6 ) . '.' . $domain; // Very random hostname! |
1042 | 1074 | $page = wp_remote_get( 'http://' . $hostname, array( 'timeout' => 5, 'httpversion' => '1.1' ) ); |
1043 | - if ( is_wp_error( $page ) ) |
|
1044 | - $errstr = $page->get_error_message(); |
|
1045 | - elseif ( 200 == wp_remote_retrieve_response_code( $page ) ) |
|
1046 | - $vhost_ok = true; |
|
1075 | + if ( is_wp_error( $page ) ) { |
|
1076 | + $errstr = $page->get_error_message(); |
|
1077 | + } elseif ( 200 == wp_remote_retrieve_response_code( $page ) ) { |
|
1078 | + $vhost_ok = true; |
|
1079 | + } |
|
1047 | 1080 | |
1048 | 1081 | if ( ! $vhost_ok ) { |
1049 | 1082 | $msg = '<p><strong>' . __( 'Warning! Wildcard DNS may not be configured correctly!' ) . '</strong></p>'; |
1050 | 1083 | $msg .= '<p>' . sprintf( __( 'The installer attempted to contact a random hostname (<code>%1$s</code>) on your domain.' ), $hostname ); |
1051 | - if ( ! empty ( $errstr ) ) |
|
1052 | - $msg .= ' ' . sprintf( __( 'This resulted in an error message: %s' ), '<code>' . $errstr . '</code>' ); |
|
1084 | + if ( ! empty ( $errstr ) ) { |
|
1085 | + $msg .= ' ' . sprintf( __( 'This resulted in an error message: %s' ), '<code>' . $errstr . '</code>' ); |
|
1086 | + } |
|
1053 | 1087 | $msg .= '</p>'; |
1054 | 1088 | $msg .= '<p>' . __( 'To use a subdomain configuration, you must have a wildcard entry in your DNS. This usually means adding a <code>*</code> hostname record pointing at your web server in your DNS configuration tool.' ) . '</p>'; |
1055 | 1089 | $msg .= '<p>' . __( 'You can still use your site but any subdomain you create may not be accessible. If you know your DNS is correct, ignore this message.' ) . '</p>'; |
@@ -487,9 +487,9 @@ discard block |
||
487 | 487 | |
488 | 488 | <div id="<?php echo $tax_name; ?>-all" class="tabs-panel"> |
489 | 489 | <?php |
490 | - $name = ( $tax_name == 'category' ) ? 'post_category' : 'tax_input[' . $tax_name . ']'; |
|
491 | - echo "<input type='hidden' name='{$name}[]' value='0' />"; // Allows for an empty term set to be sent. 0 is an invalid Term ID and will be ignored by empty() checks. |
|
492 | - ?> |
|
490 | + $name = ( $tax_name == 'category' ) ? 'post_category' : 'tax_input[' . $tax_name . ']'; |
|
491 | + echo "<input type='hidden' name='{$name}[]' value='0' />"; // Allows for an empty term set to be sent. 0 is an invalid Term ID and will be ignored by empty() checks. |
|
492 | + ?> |
|
493 | 493 | <ul id="<?php echo $tax_name; ?>checklist" data-wp-lists="list:<?php echo $tax_name; ?>" class="categorychecklist form-no-clear"> |
494 | 494 | <?php wp_terms_checklist( $post->ID, array( 'taxonomy' => $tax_name, 'popular_cats' => $popular_ids ) ); ?> |
495 | 495 | </ul> |
@@ -756,14 +756,14 @@ discard block |
||
756 | 756 | <label class="screen-reader-text" for="page_template"><?php _e('Page Template') ?></label><select name="page_template" id="page_template"> |
757 | 757 | <?php |
758 | 758 | /** |
759 | - * Filter the title of the default page template displayed in the drop-down. |
|
760 | - * |
|
761 | - * @since 4.1.0 |
|
762 | - * |
|
763 | - * @param string $label The display value for the default page template title. |
|
764 | - * @param string $context Where the option label is displayed. Possible values |
|
765 | - * include 'meta-box' or 'quick-edit'. |
|
766 | - */ |
|
759 | + * Filter the title of the default page template displayed in the drop-down. |
|
760 | + * |
|
761 | + * @since 4.1.0 |
|
762 | + * |
|
763 | + * @param string $label The display value for the default page template title. |
|
764 | + * @param string $context Where the option label is displayed. Possible values |
|
765 | + * include 'meta-box' or 'quick-edit'. |
|
766 | + */ |
|
767 | 767 | $default_title = apply_filters( 'default_page_template_title', __( 'Default Template' ), 'meta-box' ); |
768 | 768 | ?> |
769 | 769 | <option value="default"><?php echo esc_html( $default_title ); ?></option> |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | * |
12 | 12 | * @param object $post |
13 | 13 | */ |
14 | -function post_submit_meta_box($post, $args = array() ) { |
|
14 | +function post_submit_meta_box($post, $args = array()) { |
|
15 | 15 | global $action; |
16 | 16 | |
17 | 17 | $post_type = $post->post_type; |
@@ -24,27 +24,27 @@ discard block |
||
24 | 24 | |
25 | 25 | <?php // Hidden submit button early on so that the browser chooses the right button when form is submitted with Return key ?> |
26 | 26 | <div style="display:none;"> |
27 | -<?php submit_button( __( 'Save' ), 'button', 'save' ); ?> |
|
27 | +<?php submit_button(__('Save'), 'button', 'save'); ?> |
|
28 | 28 | </div> |
29 | 29 | |
30 | 30 | <div id="minor-publishing-actions"> |
31 | 31 | <div id="save-action"> |
32 | -<?php if ( 'publish' != $post->post_status && 'future' != $post->post_status && 'pending' != $post->post_status ) { ?> |
|
33 | -<input <?php if ( 'private' == $post->post_status ) { ?>style="display:none"<?php } ?> type="submit" name="save" id="save-post" value="<?php esc_attr_e('Save Draft'); ?>" class="button" /> |
|
32 | +<?php if ('publish' != $post->post_status && 'future' != $post->post_status && 'pending' != $post->post_status) { ?> |
|
33 | +<input <?php if ('private' == $post->post_status) { ?>style="display:none"<?php } ?> type="submit" name="save" id="save-post" value="<?php esc_attr_e('Save Draft'); ?>" class="button" /> |
|
34 | 34 | <span class="spinner"></span> |
35 | -<?php } elseif ( 'pending' == $post->post_status && $can_publish ) { ?> |
|
35 | +<?php } elseif ('pending' == $post->post_status && $can_publish) { ?> |
|
36 | 36 | <input type="submit" name="save" id="save-post" value="<?php esc_attr_e('Save as Pending'); ?>" class="button" /> |
37 | 37 | <span class="spinner"></span> |
38 | 38 | <?php } ?> |
39 | 39 | </div> |
40 | -<?php if ( is_post_type_viewable( $post_type_object ) ) : ?> |
|
40 | +<?php if (is_post_type_viewable($post_type_object)) : ?> |
|
41 | 41 | <div id="preview-action"> |
42 | 42 | <?php |
43 | -if ( 'publish' == $post->post_status ) { |
|
44 | - $preview_link = esc_url( get_permalink( $post->ID ) ); |
|
45 | - $preview_button = __( 'Preview Changes' ); |
|
43 | +if ('publish' == $post->post_status) { |
|
44 | + $preview_link = esc_url(get_permalink($post->ID)); |
|
45 | + $preview_button = __('Preview Changes'); |
|
46 | 46 | } else { |
47 | - $preview_link = set_url_scheme( get_permalink( $post->ID ) ); |
|
47 | + $preview_link = set_url_scheme(get_permalink($post->ID)); |
|
48 | 48 | |
49 | 49 | /** |
50 | 50 | * Filter the URI of a post preview in the post submit box. |
@@ -55,8 +55,8 @@ discard block |
||
55 | 55 | * @param string $preview_link URI the user will be directed to for a post preview. |
56 | 56 | * @param WP_Post $post Post object. |
57 | 57 | */ |
58 | - $preview_link = esc_url( apply_filters( 'preview_post_link', add_query_arg( 'preview', 'true', $preview_link ), $post ) ); |
|
59 | - $preview_button = __( 'Preview' ); |
|
58 | + $preview_link = esc_url(apply_filters('preview_post_link', add_query_arg('preview', 'true', $preview_link), $post)); |
|
59 | + $preview_button = __('Preview'); |
|
60 | 60 | } |
61 | 61 | ?> |
62 | 62 | <a class="preview button" href="<?php echo $preview_link; ?>" target="wp-preview-<?php echo (int) $post->ID; ?>" id="post-preview"><?php echo $preview_button; ?></a> |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | <div class="misc-pub-section misc-pub-post-status"><label for="post_status"><?php _e('Status:') ?></label> |
72 | 72 | <span id="post-status-display"> |
73 | 73 | <?php |
74 | -switch ( $post->post_status ) { |
|
74 | +switch ($post->post_status) { |
|
75 | 75 | case 'private': |
76 | 76 | _e('Privately Published'); |
77 | 77 | break; |
@@ -91,24 +91,24 @@ discard block |
||
91 | 91 | } |
92 | 92 | ?> |
93 | 93 | </span> |
94 | -<?php if ( 'publish' == $post->post_status || 'private' == $post->post_status || $can_publish ) { ?> |
|
95 | -<a href="#post_status" <?php if ( 'private' == $post->post_status ) { ?>style="display:none;" <?php } ?>class="edit-post-status hide-if-no-js"><span aria-hidden="true"><?php _e( 'Edit' ); ?></span> <span class="screen-reader-text"><?php _e( 'Edit status' ); ?></span></a> |
|
94 | +<?php if ('publish' == $post->post_status || 'private' == $post->post_status || $can_publish) { ?> |
|
95 | +<a href="#post_status" <?php if ('private' == $post->post_status) { ?>style="display:none;" <?php } ?>class="edit-post-status hide-if-no-js"><span aria-hidden="true"><?php _e('Edit'); ?></span> <span class="screen-reader-text"><?php _e('Edit status'); ?></span></a> |
|
96 | 96 | |
97 | 97 | <div id="post-status-select" class="hide-if-js"> |
98 | -<input type="hidden" name="hidden_post_status" id="hidden_post_status" value="<?php echo esc_attr( ('auto-draft' == $post->post_status ) ? 'draft' : $post->post_status); ?>" /> |
|
98 | +<input type="hidden" name="hidden_post_status" id="hidden_post_status" value="<?php echo esc_attr(('auto-draft' == $post->post_status) ? 'draft' : $post->post_status); ?>" /> |
|
99 | 99 | <select name='post_status' id='post_status'> |
100 | -<?php if ( 'publish' == $post->post_status ) : ?> |
|
101 | -<option<?php selected( $post->post_status, 'publish' ); ?> value='publish'><?php _e('Published') ?></option> |
|
102 | -<?php elseif ( 'private' == $post->post_status ) : ?> |
|
103 | -<option<?php selected( $post->post_status, 'private' ); ?> value='publish'><?php _e('Privately Published') ?></option> |
|
104 | -<?php elseif ( 'future' == $post->post_status ) : ?> |
|
105 | -<option<?php selected( $post->post_status, 'future' ); ?> value='future'><?php _e('Scheduled') ?></option> |
|
100 | +<?php if ('publish' == $post->post_status) : ?> |
|
101 | +<option<?php selected($post->post_status, 'publish'); ?> value='publish'><?php _e('Published') ?></option> |
|
102 | +<?php elseif ('private' == $post->post_status) : ?> |
|
103 | +<option<?php selected($post->post_status, 'private'); ?> value='publish'><?php _e('Privately Published') ?></option> |
|
104 | +<?php elseif ('future' == $post->post_status) : ?> |
|
105 | +<option<?php selected($post->post_status, 'future'); ?> value='future'><?php _e('Scheduled') ?></option> |
|
106 | 106 | <?php endif; ?> |
107 | -<option<?php selected( $post->post_status, 'pending' ); ?> value='pending'><?php _e('Pending Review') ?></option> |
|
108 | -<?php if ( 'auto-draft' == $post->post_status ) : ?> |
|
109 | -<option<?php selected( $post->post_status, 'auto-draft' ); ?> value='draft'><?php _e('Draft') ?></option> |
|
107 | +<option<?php selected($post->post_status, 'pending'); ?> value='pending'><?php _e('Pending Review') ?></option> |
|
108 | +<?php if ('auto-draft' == $post->post_status) : ?> |
|
109 | +<option<?php selected($post->post_status, 'auto-draft'); ?> value='draft'><?php _e('Draft') ?></option> |
|
110 | 110 | <?php else : ?> |
111 | -<option<?php selected( $post->post_status, 'draft' ); ?> value='draft'><?php _e('Draft') ?></option> |
|
111 | +<option<?php selected($post->post_status, 'draft'); ?> value='draft'><?php _e('Draft') ?></option> |
|
112 | 112 | <?php endif; ?> |
113 | 113 | </select> |
114 | 114 | <a href="#post_status" class="save-post-status hide-if-no-js button"><?php _e('OK'); ?></a> |
@@ -121,14 +121,14 @@ discard block |
||
121 | 121 | <div class="misc-pub-section misc-pub-visibility" id="visibility"> |
122 | 122 | <?php _e('Visibility:'); ?> <span id="post-visibility-display"><?php |
123 | 123 | |
124 | -if ( 'private' == $post->post_status ) { |
|
124 | +if ('private' == $post->post_status) { |
|
125 | 125 | $post->post_password = ''; |
126 | 126 | $visibility = 'private'; |
127 | 127 | $visibility_trans = __('Private'); |
128 | -} elseif ( !empty( $post->post_password ) ) { |
|
128 | +} elseif ( ! empty($post->post_password)) { |
|
129 | 129 | $visibility = 'password'; |
130 | 130 | $visibility_trans = __('Password protected'); |
131 | -} elseif ( $post_type == 'post' && is_sticky( $post->ID ) ) { |
|
131 | +} elseif ($post_type == 'post' && is_sticky($post->ID)) { |
|
132 | 132 | $visibility = 'public'; |
133 | 133 | $visibility_trans = __('Public, Sticky'); |
134 | 134 | } else { |
@@ -136,23 +136,23 @@ discard block |
||
136 | 136 | $visibility_trans = __('Public'); |
137 | 137 | } |
138 | 138 | |
139 | -echo esc_html( $visibility_trans ); ?></span> |
|
140 | -<?php if ( $can_publish ) { ?> |
|
141 | -<a href="#visibility" class="edit-visibility hide-if-no-js"><span aria-hidden="true"><?php _e( 'Edit' ); ?></span> <span class="screen-reader-text"><?php _e( 'Edit visibility' ); ?></span></a> |
|
139 | +echo esc_html($visibility_trans); ?></span> |
|
140 | +<?php if ($can_publish) { ?> |
|
141 | +<a href="#visibility" class="edit-visibility hide-if-no-js"><span aria-hidden="true"><?php _e('Edit'); ?></span> <span class="screen-reader-text"><?php _e('Edit visibility'); ?></span></a> |
|
142 | 142 | |
143 | 143 | <div id="post-visibility-select" class="hide-if-js"> |
144 | 144 | <input type="hidden" name="hidden_post_password" id="hidden-post-password" value="<?php echo esc_attr($post->post_password); ?>" /> |
145 | 145 | <?php if ($post_type == 'post'): ?> |
146 | 146 | <input type="checkbox" style="display:none" name="hidden_post_sticky" id="hidden-post-sticky" value="sticky" <?php checked(is_sticky($post->ID)); ?> /> |
147 | 147 | <?php endif; ?> |
148 | -<input type="hidden" name="hidden_post_visibility" id="hidden-post-visibility" value="<?php echo esc_attr( $visibility ); ?>" /> |
|
149 | -<input type="radio" name="visibility" id="visibility-radio-public" value="public" <?php checked( $visibility, 'public' ); ?> /> <label for="visibility-radio-public" class="selectit"><?php _e('Public'); ?></label><br /> |
|
150 | -<?php if ( $post_type == 'post' && current_user_can( 'edit_others_posts' ) ) : ?> |
|
151 | -<span id="sticky-span"><input id="sticky" name="sticky" type="checkbox" value="sticky" <?php checked( is_sticky( $post->ID ) ); ?> /> <label for="sticky" class="selectit"><?php _e( 'Stick this post to the front page' ); ?></label><br /></span> |
|
148 | +<input type="hidden" name="hidden_post_visibility" id="hidden-post-visibility" value="<?php echo esc_attr($visibility); ?>" /> |
|
149 | +<input type="radio" name="visibility" id="visibility-radio-public" value="public" <?php checked($visibility, 'public'); ?> /> <label for="visibility-radio-public" class="selectit"><?php _e('Public'); ?></label><br /> |
|
150 | +<?php if ($post_type == 'post' && current_user_can('edit_others_posts')) : ?> |
|
151 | +<span id="sticky-span"><input id="sticky" name="sticky" type="checkbox" value="sticky" <?php checked(is_sticky($post->ID)); ?> /> <label for="sticky" class="selectit"><?php _e('Stick this post to the front page'); ?></label><br /></span> |
|
152 | 152 | <?php endif; ?> |
153 | -<input type="radio" name="visibility" id="visibility-radio-password" value="password" <?php checked( $visibility, 'password' ); ?> /> <label for="visibility-radio-password" class="selectit"><?php _e('Password protected'); ?></label><br /> |
|
153 | +<input type="radio" name="visibility" id="visibility-radio-password" value="password" <?php checked($visibility, 'password'); ?> /> <label for="visibility-radio-password" class="selectit"><?php _e('Password protected'); ?></label><br /> |
|
154 | 154 | <span id="password-span"><label for="post_password"><?php _e('Password:'); ?></label> <input type="text" name="post_password" id="post_password" value="<?php echo esc_attr($post->post_password); ?>" maxlength="20" /><br /></span> |
155 | -<input type="radio" name="visibility" id="visibility-radio-private" value="private" <?php checked( $visibility, 'private' ); ?> /> <label for="visibility-radio-private" class="selectit"><?php _e('Private'); ?></label><br /> |
|
155 | +<input type="radio" name="visibility" id="visibility-radio-private" value="private" <?php checked($visibility, 'private'); ?> /> <label for="visibility-radio-private" class="selectit"><?php _e('Private'); ?></label><br /> |
|
156 | 156 | |
157 | 157 | <p> |
158 | 158 | <a href="#visibility" class="save-post-visibility hide-if-no-js button"><?php _e('OK'); ?></a> |
@@ -165,51 +165,51 @@ discard block |
||
165 | 165 | |
166 | 166 | <?php |
167 | 167 | /* translators: Publish box date format, see http://php.net/date */ |
168 | -$datef = __( 'M j, Y @ H:i' ); |
|
169 | -if ( 0 != $post->ID ) { |
|
170 | - if ( 'future' == $post->post_status ) { // scheduled for publishing at a future date |
|
168 | +$datef = __('M j, Y @ H:i'); |
|
169 | +if (0 != $post->ID) { |
|
170 | + if ('future' == $post->post_status) { // scheduled for publishing at a future date |
|
171 | 171 | $stamp = __('Scheduled for: <b>%1$s</b>'); |
172 | - } elseif ( 'publish' == $post->post_status || 'private' == $post->post_status ) { // already published |
|
172 | + } elseif ('publish' == $post->post_status || 'private' == $post->post_status) { // already published |
|
173 | 173 | $stamp = __('Published on: <b>%1$s</b>'); |
174 | - } elseif ( '0000-00-00 00:00:00' == $post->post_date_gmt ) { // draft, 1 or more saves, no date specified |
|
174 | + } elseif ('0000-00-00 00:00:00' == $post->post_date_gmt) { // draft, 1 or more saves, no date specified |
|
175 | 175 | $stamp = __('Publish <b>immediately</b>'); |
176 | - } elseif ( time() < strtotime( $post->post_date_gmt . ' +0000' ) ) { // draft, 1 or more saves, future date specified |
|
176 | + } elseif (time() < strtotime($post->post_date_gmt.' +0000')) { // draft, 1 or more saves, future date specified |
|
177 | 177 | $stamp = __('Schedule for: <b>%1$s</b>'); |
178 | 178 | } else { // draft, 1 or more saves, date specified |
179 | 179 | $stamp = __('Publish on: <b>%1$s</b>'); |
180 | 180 | } |
181 | - $date = date_i18n( $datef, strtotime( $post->post_date ) ); |
|
181 | + $date = date_i18n($datef, strtotime($post->post_date)); |
|
182 | 182 | } else { // draft (no saves, and thus no date specified) |
183 | 183 | $stamp = __('Publish <b>immediately</b>'); |
184 | - $date = date_i18n( $datef, strtotime( current_time('mysql') ) ); |
|
184 | + $date = date_i18n($datef, strtotime(current_time('mysql'))); |
|
185 | 185 | } |
186 | 186 | |
187 | -if ( ! empty( $args['args']['revisions_count'] ) ) : |
|
188 | - $revisions_to_keep = wp_revisions_to_keep( $post ); |
|
187 | +if ( ! empty($args['args']['revisions_count'])) : |
|
188 | + $revisions_to_keep = wp_revisions_to_keep($post); |
|
189 | 189 | ?> |
190 | 190 | <div class="misc-pub-section misc-pub-revisions"> |
191 | 191 | <?php |
192 | - if ( $revisions_to_keep > 0 && $revisions_to_keep <= $args['args']['revisions_count'] ) { |
|
193 | - echo '<span title="' . esc_attr( sprintf( __( 'Your site is configured to keep only the last %s revisions.' ), |
|
194 | - number_format_i18n( $revisions_to_keep ) ) ) . '">'; |
|
195 | - printf( __( 'Revisions: %s' ), '<b>' . number_format_i18n( $args['args']['revisions_count'] ) . '+</b>' ); |
|
192 | + if ($revisions_to_keep > 0 && $revisions_to_keep <= $args['args']['revisions_count']) { |
|
193 | + echo '<span title="'.esc_attr(sprintf(__('Your site is configured to keep only the last %s revisions.'), |
|
194 | + number_format_i18n($revisions_to_keep))).'">'; |
|
195 | + printf(__('Revisions: %s'), '<b>'.number_format_i18n($args['args']['revisions_count']).'+</b>'); |
|
196 | 196 | echo '</span>'; |
197 | 197 | } else { |
198 | - printf( __( 'Revisions: %s' ), '<b>' . number_format_i18n( $args['args']['revisions_count'] ) . '</b>' ); |
|
198 | + printf(__('Revisions: %s'), '<b>'.number_format_i18n($args['args']['revisions_count']).'</b>'); |
|
199 | 199 | } |
200 | 200 | ?> |
201 | - <a class="hide-if-no-js" href="<?php echo esc_url( get_edit_post_link( $args['args']['revision_id'] ) ); ?>"><span aria-hidden="true"><?php _ex( 'Browse', 'revisions' ); ?></span> <span class="screen-reader-text"><?php _e( 'Browse revisions' ); ?></span></a> |
|
201 | + <a class="hide-if-no-js" href="<?php echo esc_url(get_edit_post_link($args['args']['revision_id'])); ?>"><span aria-hidden="true"><?php _ex('Browse', 'revisions'); ?></span> <span class="screen-reader-text"><?php _e('Browse revisions'); ?></span></a> |
|
202 | 202 | </div> |
203 | 203 | <?php endif; |
204 | 204 | |
205 | -if ( $can_publish ) : // Contributors don't get to choose the date of publish ?> |
|
205 | +if ($can_publish) : // Contributors don't get to choose the date of publish ?> |
|
206 | 206 | <div class="misc-pub-section curtime misc-pub-curtime"> |
207 | 207 | <span id="timestamp"> |
208 | 208 | <?php printf($stamp, $date); ?></span> |
209 | - <a href="#edit_timestamp" class="edit-timestamp hide-if-no-js"><span aria-hidden="true"><?php _e( 'Edit' ); ?></span> <span class="screen-reader-text"><?php _e( 'Edit date and time' ); ?></span></a> |
|
209 | + <a href="#edit_timestamp" class="edit-timestamp hide-if-no-js"><span aria-hidden="true"><?php _e('Edit'); ?></span> <span class="screen-reader-text"><?php _e('Edit date and time'); ?></span></a> |
|
210 | 210 | <fieldset id="timestampdiv" class="hide-if-js"> |
211 | - <legend class="screen-reader-text"><?php _e( 'Date and time' ); ?></legend> |
|
212 | - <?php touch_time( ( $action === 'edit' ), 1 ); ?> |
|
211 | + <legend class="screen-reader-text"><?php _e('Date and time'); ?></legend> |
|
212 | + <?php touch_time(($action === 'edit'), 1); ?> |
|
213 | 213 | </fieldset> |
214 | 214 | </div><?php // /misc-pub-section ?> |
215 | 215 | <?php endif; ?> |
@@ -220,7 +220,7 @@ discard block |
||
220 | 220 | * |
221 | 221 | * @since 2.9.0 |
222 | 222 | */ |
223 | -do_action( 'post_submitbox_misc_actions' ); |
|
223 | +do_action('post_submitbox_misc_actions'); |
|
224 | 224 | ?> |
225 | 225 | </div> |
226 | 226 | <div class="clear"></div> |
@@ -233,12 +233,12 @@ discard block |
||
233 | 233 | * |
234 | 234 | * @since 2.7.0 |
235 | 235 | */ |
236 | -do_action( 'post_submitbox_start' ); |
|
236 | +do_action('post_submitbox_start'); |
|
237 | 237 | ?> |
238 | 238 | <div id="delete-action"> |
239 | 239 | <?php |
240 | -if ( current_user_can( "delete_post", $post->ID ) ) { |
|
241 | - if ( !EMPTY_TRASH_DAYS ) |
|
240 | +if (current_user_can("delete_post", $post->ID)) { |
|
241 | + if ( ! EMPTY_TRASH_DAYS) |
|
242 | 242 | $delete_text = __('Delete Permanently'); |
243 | 243 | else |
244 | 244 | $delete_text = __('Move to Trash'); |
@@ -250,23 +250,23 @@ discard block |
||
250 | 250 | <div id="publishing-action"> |
251 | 251 | <span class="spinner"></span> |
252 | 252 | <?php |
253 | -if ( !in_array( $post->post_status, array('publish', 'future', 'private') ) || 0 == $post->ID ) { |
|
254 | - if ( $can_publish ) : |
|
255 | - if ( !empty($post->post_date_gmt) && time() < strtotime( $post->post_date_gmt . ' +0000' ) ) : ?> |
|
253 | +if ( ! in_array($post->post_status, array('publish', 'future', 'private')) || 0 == $post->ID) { |
|
254 | + if ($can_publish) : |
|
255 | + if ( ! empty($post->post_date_gmt) && time() < strtotime($post->post_date_gmt.' +0000')) : ?> |
|
256 | 256 | <input name="original_publish" type="hidden" id="original_publish" value="<?php esc_attr_e('Schedule') ?>" /> |
257 | - <?php submit_button( __( 'Schedule' ), 'primary button-large', 'publish', false ); ?> |
|
257 | + <?php submit_button(__('Schedule'), 'primary button-large', 'publish', false); ?> |
|
258 | 258 | <?php else : ?> |
259 | 259 | <input name="original_publish" type="hidden" id="original_publish" value="<?php esc_attr_e('Publish') ?>" /> |
260 | - <?php submit_button( __( 'Publish' ), 'primary button-large', 'publish', false ); ?> |
|
260 | + <?php submit_button(__('Publish'), 'primary button-large', 'publish', false); ?> |
|
261 | 261 | <?php endif; |
262 | 262 | else : ?> |
263 | 263 | <input name="original_publish" type="hidden" id="original_publish" value="<?php esc_attr_e('Submit for Review') ?>" /> |
264 | - <?php submit_button( __( 'Submit for Review' ), 'primary button-large', 'publish', false ); ?> |
|
264 | + <?php submit_button(__('Submit for Review'), 'primary button-large', 'publish', false); ?> |
|
265 | 265 | <?php |
266 | 266 | endif; |
267 | 267 | } else { ?> |
268 | 268 | <input name="original_publish" type="hidden" id="original_publish" value="<?php esc_attr_e('Update') ?>" /> |
269 | - <input name="save" type="submit" class="button button-primary button-large" id="publish" value="<?php esc_attr_e( 'Update' ) ?>" /> |
|
269 | + <input name="save" type="submit" class="button button-primary button-large" id="publish" value="<?php esc_attr_e('Update') ?>" /> |
|
270 | 270 | <?php |
271 | 271 | } ?> |
272 | 272 | </div> |
@@ -284,7 +284,7 @@ discard block |
||
284 | 284 | * |
285 | 285 | * @param object $post |
286 | 286 | */ |
287 | -function attachment_submit_meta_box( $post ) { |
|
287 | +function attachment_submit_meta_box($post) { |
|
288 | 288 | ?> |
289 | 289 | <div class="submitbox" id="submitpost"> |
290 | 290 | |
@@ -292,16 +292,16 @@ discard block |
||
292 | 292 | |
293 | 293 | <?php // Hidden submit button early on so that the browser chooses the right button when form is submitted with Return key ?> |
294 | 294 | <div style="display:none;"> |
295 | -<?php submit_button( __( 'Save' ), 'button', 'save' ); ?> |
|
295 | +<?php submit_button(__('Save'), 'button', 'save'); ?> |
|
296 | 296 | </div> |
297 | 297 | |
298 | 298 | |
299 | 299 | <div id="misc-publishing-actions"> |
300 | 300 | <?php |
301 | 301 | /* translators: Publish box date format, see http://php.net/date */ |
302 | - $datef = __( 'M j, Y @ H:i' ); |
|
302 | + $datef = __('M j, Y @ H:i'); |
|
303 | 303 | $stamp = __('Uploaded on: <b>%1$s</b>'); |
304 | - $date = date_i18n( $datef, strtotime( $post->post_date ) ); |
|
304 | + $date = date_i18n($datef, strtotime($post->post_date)); |
|
305 | 305 | ?> |
306 | 306 | <div class="misc-pub-section curtime misc-pub-curtime"> |
307 | 307 | <span id="timestamp"><?php printf($stamp, $date); ?></span> |
@@ -314,7 +314,7 @@ discard block |
||
314 | 314 | * |
315 | 315 | * @since 3.5.0 |
316 | 316 | */ |
317 | - do_action( 'attachment_submitbox_misc_actions' ); |
|
317 | + do_action('attachment_submitbox_misc_actions'); |
|
318 | 318 | ?> |
319 | 319 | </div><!-- #misc-publishing-actions --> |
320 | 320 | <div class="clear"></div> |
@@ -323,12 +323,12 @@ discard block |
||
323 | 323 | <div id="major-publishing-actions"> |
324 | 324 | <div id="delete-action"> |
325 | 325 | <?php |
326 | - if ( current_user_can( 'delete_post', $post->ID ) ) |
|
327 | - if ( EMPTY_TRASH_DAYS && MEDIA_TRASH ) { |
|
328 | - echo "<a class='submitdelete deletion' href='" . get_delete_post_link( $post->ID ) . "'>" . __( 'Trash' ) . "</a>"; |
|
326 | + if (current_user_can('delete_post', $post->ID)) |
|
327 | + if (EMPTY_TRASH_DAYS && MEDIA_TRASH) { |
|
328 | + echo "<a class='submitdelete deletion' href='".get_delete_post_link($post->ID)."'>".__('Trash')."</a>"; |
|
329 | 329 | } else { |
330 | 330 | $delete_ays = ! MEDIA_TRASH ? " onclick='return showNotice.warn();'" : ''; |
331 | - echo "<a class='submitdelete deletion'$delete_ays href='" . get_delete_post_link( $post->ID, null, true ) . "'>" . __( 'Delete Permanently' ) . "</a>"; |
|
331 | + echo "<a class='submitdelete deletion'$delete_ays href='".get_delete_post_link($post->ID, null, true)."'>".__('Delete Permanently')."</a>"; |
|
332 | 332 | } |
333 | 333 | ?> |
334 | 334 | </div> |
@@ -336,7 +336,7 @@ discard block |
||
336 | 336 | <div id="publishing-action"> |
337 | 337 | <span class="spinner"></span> |
338 | 338 | <input name="original_publish" type="hidden" id="original_publish" value="<?php esc_attr_e('Update') ?>" /> |
339 | - <input name="save" type="submit" class="button-primary button-large" id="publish" value="<?php esc_attr_e( 'Update' ) ?>" /> |
|
339 | + <input name="save" type="submit" class="button-primary button-large" id="publish" value="<?php esc_attr_e('Update') ?>" /> |
|
340 | 340 | </div> |
341 | 341 | <div class="clear"></div> |
342 | 342 | </div><!-- #major-publishing-actions --> |
@@ -361,24 +361,24 @@ discard block |
||
361 | 361 | * @type array $args Extra meta box arguments. |
362 | 362 | * } |
363 | 363 | */ |
364 | -function post_format_meta_box( $post, $box ) { |
|
365 | - if ( current_theme_supports( 'post-formats' ) && post_type_supports( $post->post_type, 'post-formats' ) ) : |
|
366 | - $post_formats = get_theme_support( 'post-formats' ); |
|
364 | +function post_format_meta_box($post, $box) { |
|
365 | + if (current_theme_supports('post-formats') && post_type_supports($post->post_type, 'post-formats')) : |
|
366 | + $post_formats = get_theme_support('post-formats'); |
|
367 | 367 | |
368 | - if ( is_array( $post_formats[0] ) ) : |
|
369 | - $post_format = get_post_format( $post->ID ); |
|
370 | - if ( !$post_format ) |
|
368 | + if (is_array($post_formats[0])) : |
|
369 | + $post_format = get_post_format($post->ID); |
|
370 | + if ( ! $post_format) |
|
371 | 371 | $post_format = '0'; |
372 | 372 | // Add in the current one if it isn't there yet, in case the current theme doesn't support it |
373 | - if ( $post_format && !in_array( $post_format, $post_formats[0] ) ) |
|
373 | + if ($post_format && ! in_array($post_format, $post_formats[0])) |
|
374 | 374 | $post_formats[0][] = $post_format; |
375 | 375 | ?> |
376 | 376 | <div id="post-formats-select"> |
377 | 377 | <fieldset> |
378 | - <legend class="screen-reader-text"><?php _e( 'Post Formats' ); ?></legend> |
|
379 | - <input type="radio" name="post_format" class="post-format" id="post-format-0" value="0" <?php checked( $post_format, '0' ); ?> /> <label for="post-format-0" class="post-format-icon post-format-standard"><?php echo get_post_format_string( 'standard' ); ?></label> |
|
380 | - <?php foreach ( $post_formats[0] as $format ) : ?> |
|
381 | - <br /><input type="radio" name="post_format" class="post-format" id="post-format-<?php echo esc_attr( $format ); ?>" value="<?php echo esc_attr( $format ); ?>" <?php checked( $post_format, $format ); ?> /> <label for="post-format-<?php echo esc_attr( $format ); ?>" class="post-format-icon post-format-<?php echo esc_attr( $format ); ?>"><?php echo esc_html( get_post_format_string( $format ) ); ?></label> |
|
378 | + <legend class="screen-reader-text"><?php _e('Post Formats'); ?></legend> |
|
379 | + <input type="radio" name="post_format" class="post-format" id="post-format-0" value="0" <?php checked($post_format, '0'); ?> /> <label for="post-format-0" class="post-format-icon post-format-standard"><?php echo get_post_format_string('standard'); ?></label> |
|
380 | + <?php foreach ($post_formats[0] as $format) : ?> |
|
381 | + <br /><input type="radio" name="post_format" class="post-format" id="post-format-<?php echo esc_attr($format); ?>" value="<?php echo esc_attr($format); ?>" <?php checked($post_format, $format); ?> /> <label for="post-format-<?php echo esc_attr($format); ?>" class="post-format-icon post-format-<?php echo esc_attr($format); ?>"><?php echo esc_html(get_post_format_string($format)); ?></label> |
|
382 | 382 | <?php endforeach; ?> |
383 | 383 | </fieldset> |
384 | 384 | </div> |
@@ -406,25 +406,25 @@ discard block |
||
406 | 406 | * } |
407 | 407 | * } |
408 | 408 | */ |
409 | -function post_tags_meta_box( $post, $box ) { |
|
410 | - $defaults = array( 'taxonomy' => 'post_tag' ); |
|
411 | - if ( ! isset( $box['args'] ) || ! is_array( $box['args'] ) ) { |
|
409 | +function post_tags_meta_box($post, $box) { |
|
410 | + $defaults = array('taxonomy' => 'post_tag'); |
|
411 | + if ( ! isset($box['args']) || ! is_array($box['args'])) { |
|
412 | 412 | $args = array(); |
413 | 413 | } else { |
414 | 414 | $args = $box['args']; |
415 | 415 | } |
416 | - $r = wp_parse_args( $args, $defaults ); |
|
417 | - $tax_name = esc_attr( $r['taxonomy'] ); |
|
418 | - $taxonomy = get_taxonomy( $r['taxonomy'] ); |
|
419 | - $user_can_assign_terms = current_user_can( $taxonomy->cap->assign_terms ); |
|
420 | - $comma = _x( ',', 'tag delimiter' ); |
|
416 | + $r = wp_parse_args($args, $defaults); |
|
417 | + $tax_name = esc_attr($r['taxonomy']); |
|
418 | + $taxonomy = get_taxonomy($r['taxonomy']); |
|
419 | + $user_can_assign_terms = current_user_can($taxonomy->cap->assign_terms); |
|
420 | + $comma = _x(',', 'tag delimiter'); |
|
421 | 421 | ?> |
422 | 422 | <div class="tagsdiv" id="<?php echo $tax_name; ?>"> |
423 | 423 | <div class="jaxtag"> |
424 | 424 | <div class="nojs-tags hide-if-js"> |
425 | 425 | <p><?php echo $taxonomy->labels->add_or_remove_items; ?></p> |
426 | - <textarea name="<?php echo "tax_input[$tax_name]"; ?>" rows="3" cols="20" class="the-tags" id="tax-input-<?php echo $tax_name; ?>" <?php disabled( ! $user_can_assign_terms ); ?>><?php echo str_replace( ',', $comma . ' ', get_terms_to_edit( $post->ID, $tax_name ) ); // textarea_escaped by esc_attr() ?></textarea></div> |
|
427 | - <?php if ( $user_can_assign_terms ) : ?> |
|
426 | + <textarea name="<?php echo "tax_input[$tax_name]"; ?>" rows="3" cols="20" class="the-tags" id="tax-input-<?php echo $tax_name; ?>" <?php disabled( ! $user_can_assign_terms); ?>><?php echo str_replace(',', $comma.' ', get_terms_to_edit($post->ID, $tax_name)); // textarea_escaped by esc_attr() ?></textarea></div> |
|
427 | + <?php if ($user_can_assign_terms) : ?> |
|
428 | 428 | <div class="ajaxtag hide-if-no-js"> |
429 | 429 | <label class="screen-reader-text" for="new-tag-<?php echo $tax_name; ?>"><?php echo $box['title']; ?></label> |
430 | 430 | <p><input type="text" id="new-tag-<?php echo $tax_name; ?>" name="newtag[<?php echo $tax_name; ?>]" class="newtag form-input-tip" size="16" autocomplete="off" value="" /> |
@@ -435,7 +435,7 @@ discard block |
||
435 | 435 | </div> |
436 | 436 | <div class="tagchecklist"></div> |
437 | 437 | </div> |
438 | -<?php if ( $user_can_assign_terms ) : ?> |
|
438 | +<?php if ($user_can_assign_terms) : ?> |
|
439 | 439 | <p class="hide-if-no-js"><a href="#titlediv" class="tagcloud-link" id="link-<?php echo $tax_name; ?>"><?php echo $taxonomy->labels->choose_from_most_used; ?></a></p> |
440 | 440 | <?php endif; ?> |
441 | 441 | <?php |
@@ -462,57 +462,57 @@ discard block |
||
462 | 462 | * } |
463 | 463 | * } |
464 | 464 | */ |
465 | -function post_categories_meta_box( $post, $box ) { |
|
466 | - $defaults = array( 'taxonomy' => 'category' ); |
|
467 | - if ( ! isset( $box['args'] ) || ! is_array( $box['args'] ) ) { |
|
465 | +function post_categories_meta_box($post, $box) { |
|
466 | + $defaults = array('taxonomy' => 'category'); |
|
467 | + if ( ! isset($box['args']) || ! is_array($box['args'])) { |
|
468 | 468 | $args = array(); |
469 | 469 | } else { |
470 | 470 | $args = $box['args']; |
471 | 471 | } |
472 | - $r = wp_parse_args( $args, $defaults ); |
|
473 | - $tax_name = esc_attr( $r['taxonomy'] ); |
|
474 | - $taxonomy = get_taxonomy( $r['taxonomy'] ); |
|
472 | + $r = wp_parse_args($args, $defaults); |
|
473 | + $tax_name = esc_attr($r['taxonomy']); |
|
474 | + $taxonomy = get_taxonomy($r['taxonomy']); |
|
475 | 475 | ?> |
476 | 476 | <div id="taxonomy-<?php echo $tax_name; ?>" class="categorydiv"> |
477 | 477 | <ul id="<?php echo $tax_name; ?>-tabs" class="category-tabs"> |
478 | 478 | <li class="tabs"><a href="#<?php echo $tax_name; ?>-all"><?php echo $taxonomy->labels->all_items; ?></a></li> |
479 | - <li class="hide-if-no-js"><a href="#<?php echo $tax_name; ?>-pop"><?php _e( 'Most Used' ); ?></a></li> |
|
479 | + <li class="hide-if-no-js"><a href="#<?php echo $tax_name; ?>-pop"><?php _e('Most Used'); ?></a></li> |
|
480 | 480 | </ul> |
481 | 481 | |
482 | 482 | <div id="<?php echo $tax_name; ?>-pop" class="tabs-panel" style="display: none;"> |
483 | 483 | <ul id="<?php echo $tax_name; ?>checklist-pop" class="categorychecklist form-no-clear" > |
484 | - <?php $popular_ids = wp_popular_terms_checklist( $tax_name ); ?> |
|
484 | + <?php $popular_ids = wp_popular_terms_checklist($tax_name); ?> |
|
485 | 485 | </ul> |
486 | 486 | </div> |
487 | 487 | |
488 | 488 | <div id="<?php echo $tax_name; ?>-all" class="tabs-panel"> |
489 | 489 | <?php |
490 | - $name = ( $tax_name == 'category' ) ? 'post_category' : 'tax_input[' . $tax_name . ']'; |
|
490 | + $name = ($tax_name == 'category') ? 'post_category' : 'tax_input['.$tax_name.']'; |
|
491 | 491 | echo "<input type='hidden' name='{$name}[]' value='0' />"; // Allows for an empty term set to be sent. 0 is an invalid Term ID and will be ignored by empty() checks. |
492 | 492 | ?> |
493 | 493 | <ul id="<?php echo $tax_name; ?>checklist" data-wp-lists="list:<?php echo $tax_name; ?>" class="categorychecklist form-no-clear"> |
494 | - <?php wp_terms_checklist( $post->ID, array( 'taxonomy' => $tax_name, 'popular_cats' => $popular_ids ) ); ?> |
|
494 | + <?php wp_terms_checklist($post->ID, array('taxonomy' => $tax_name, 'popular_cats' => $popular_ids)); ?> |
|
495 | 495 | </ul> |
496 | 496 | </div> |
497 | - <?php if ( current_user_can( $taxonomy->cap->edit_terms ) ) : ?> |
|
497 | + <?php if (current_user_can($taxonomy->cap->edit_terms)) : ?> |
|
498 | 498 | <div id="<?php echo $tax_name; ?>-adder" class="wp-hidden-children"> |
499 | 499 | <h4> |
500 | 500 | <a id="<?php echo $tax_name; ?>-add-toggle" href="#<?php echo $tax_name; ?>-add" class="hide-if-no-js"> |
501 | 501 | <?php |
502 | 502 | /* translators: %s: add new taxonomy label */ |
503 | - printf( __( '+ %s' ), $taxonomy->labels->add_new_item ); |
|
503 | + printf(__('+ %s'), $taxonomy->labels->add_new_item); |
|
504 | 504 | ?> |
505 | 505 | </a> |
506 | 506 | </h4> |
507 | 507 | <p id="<?php echo $tax_name; ?>-add" class="category-add wp-hidden-child"> |
508 | 508 | <label class="screen-reader-text" for="new<?php echo $tax_name; ?>"><?php echo $taxonomy->labels->add_new_item; ?></label> |
509 | - <input type="text" name="new<?php echo $tax_name; ?>" id="new<?php echo $tax_name; ?>" class="form-required form-input-tip" value="<?php echo esc_attr( $taxonomy->labels->new_item_name ); ?>" aria-required="true"/> |
|
509 | + <input type="text" name="new<?php echo $tax_name; ?>" id="new<?php echo $tax_name; ?>" class="form-required form-input-tip" value="<?php echo esc_attr($taxonomy->labels->new_item_name); ?>" aria-required="true"/> |
|
510 | 510 | <label class="screen-reader-text" for="new<?php echo $tax_name; ?>_parent"> |
511 | 511 | <?php echo $taxonomy->labels->parent_item_colon; ?> |
512 | 512 | </label> |
513 | - <?php wp_dropdown_categories( array( 'taxonomy' => $tax_name, 'hide_empty' => 0, 'name' => 'new' . $tax_name . '_parent', 'orderby' => 'name', 'hierarchical' => 1, 'show_option_none' => '— ' . $taxonomy->labels->parent_item . ' —' ) ); ?> |
|
514 | - <input type="button" id="<?php echo $tax_name; ?>-add-submit" data-wp-lists="add:<?php echo $tax_name; ?>checklist:<?php echo $tax_name; ?>-add" class="button category-add-submit" value="<?php echo esc_attr( $taxonomy->labels->add_new_item ); ?>" /> |
|
515 | - <?php wp_nonce_field( 'add-' . $tax_name, '_ajax_nonce-add-' . $tax_name, false ); ?> |
|
513 | + <?php wp_dropdown_categories(array('taxonomy' => $tax_name, 'hide_empty' => 0, 'name' => 'new'.$tax_name.'_parent', 'orderby' => 'name', 'hierarchical' => 1, 'show_option_none' => '— '.$taxonomy->labels->parent_item.' —')); ?> |
|
514 | + <input type="button" id="<?php echo $tax_name; ?>-add-submit" data-wp-lists="add:<?php echo $tax_name; ?>checklist:<?php echo $tax_name; ?>-add" class="button category-add-submit" value="<?php echo esc_attr($taxonomy->labels->add_new_item); ?>" /> |
|
515 | + <?php wp_nonce_field('add-'.$tax_name, '_ajax_nonce-add-'.$tax_name, false); ?> |
|
516 | 516 | <span id="<?php echo $tax_name; ?>-ajax-response"></span> |
517 | 517 | </p> |
518 | 518 | </div> |
@@ -543,12 +543,12 @@ discard block |
||
543 | 543 | * @param object $post |
544 | 544 | */ |
545 | 545 | function post_trackback_meta_box($post) { |
546 | - $form_trackback = '<input type="text" name="trackback_url" id="trackback_url" class="code" value="'. esc_attr( str_replace("\n", ' ', $post->to_ping) ) .'" />'; |
|
546 | + $form_trackback = '<input type="text" name="trackback_url" id="trackback_url" class="code" value="'.esc_attr(str_replace("\n", ' ', $post->to_ping)).'" />'; |
|
547 | 547 | if ('' != $post->pinged) { |
548 | - $pings = '<p>'. __('Already pinged:') . '</p><ul>'; |
|
548 | + $pings = '<p>'.__('Already pinged:').'</p><ul>'; |
|
549 | 549 | $already_pinged = explode("\n", trim($post->pinged)); |
550 | 550 | foreach ($already_pinged as $pinged_url) { |
551 | - $pings .= "\n\t<li>" . esc_html($pinged_url) . "</li>"; |
|
551 | + $pings .= "\n\t<li>".esc_html($pinged_url)."</li>"; |
|
552 | 552 | } |
553 | 553 | $pings .= '</ul>'; |
554 | 554 | } |
@@ -557,7 +557,7 @@ discard block |
||
557 | 557 | <p><label for="trackback_url"><?php _e('Send trackbacks to:'); ?></label> <?php echo $form_trackback; ?><br /> (<?php _e('Separate multiple URLs with spaces'); ?>)</p> |
558 | 558 | <p><?php _e('Trackbacks are a way to notify legacy blog systems that you’ve linked to them. If you link other WordPress sites, they’ll be notified automatically using <a href="https://codex.wordpress.org/Introduction_to_Blogging#Managing_Comments" target="_blank">pingbacks</a>, no other action necessary.'); ?></p> |
559 | 559 | <?php |
560 | -if ( ! empty($pings) ) |
|
560 | +if ( ! empty($pings)) |
|
561 | 561 | echo $pings; |
562 | 562 | } |
563 | 563 | |
@@ -574,12 +574,12 @@ discard block |
||
574 | 574 | <div id="ajax-response"></div> |
575 | 575 | <?php |
576 | 576 | $metadata = has_meta($post->ID); |
577 | -foreach ( $metadata as $key => $value ) { |
|
578 | - if ( is_protected_meta( $metadata[ $key ][ 'meta_key' ], 'post' ) || ! current_user_can( 'edit_post_meta', $post->ID, $metadata[ $key ][ 'meta_key' ] ) ) |
|
579 | - unset( $metadata[ $key ] ); |
|
577 | +foreach ($metadata as $key => $value) { |
|
578 | + if (is_protected_meta($metadata[$key]['meta_key'], 'post') || ! current_user_can('edit_post_meta', $post->ID, $metadata[$key]['meta_key'])) |
|
579 | + unset($metadata[$key]); |
|
580 | 580 | } |
581 | -list_meta( $metadata ); |
|
582 | -meta_form( $post ); ?> |
|
581 | +list_meta($metadata); |
|
582 | +meta_form($post); ?> |
|
583 | 583 | </div> |
584 | 584 | <p><?php _e('Custom fields can be used to add extra metadata to a post that you can <a href="https://codex.wordpress.org/Using_Custom_Fields" target="_blank">use in your theme</a>.'); ?></p> |
585 | 585 | <?php |
@@ -596,8 +596,8 @@ discard block |
||
596 | 596 | ?> |
597 | 597 | <input name="advanced_view" type="hidden" value="1" /> |
598 | 598 | <p class="meta-options"> |
599 | - <label for="comment_status" class="selectit"><input name="comment_status" type="checkbox" id="comment_status" value="open" <?php checked($post->comment_status, 'open'); ?> /> <?php _e( 'Allow comments.' ) ?></label><br /> |
|
600 | - <label for="ping_status" class="selectit"><input name="ping_status" type="checkbox" id="ping_status" value="open" <?php checked($post->ping_status, 'open'); ?> /> <?php printf( __( 'Allow <a href="%s" target="_blank">trackbacks and pingbacks</a> on this page.' ), __( 'https://codex.wordpress.org/Introduction_to_Blogging#Managing_Comments' ) ); ?></label> |
|
599 | + <label for="comment_status" class="selectit"><input name="comment_status" type="checkbox" id="comment_status" value="open" <?php checked($post->comment_status, 'open'); ?> /> <?php _e('Allow comments.') ?></label><br /> |
|
600 | + <label for="ping_status" class="selectit"><input name="ping_status" type="checkbox" id="ping_status" value="open" <?php checked($post->ping_status, 'open'); ?> /> <?php printf(__('Allow <a href="%s" target="_blank">trackbacks and pingbacks</a> on this page.'), __('https://codex.wordpress.org/Introduction_to_Blogging#Managing_Comments')); ?></label> |
|
601 | 601 | <?php |
602 | 602 | /** |
603 | 603 | * Fires at the end of the Discussion meta box on the post editing screen. |
@@ -606,7 +606,7 @@ discard block |
||
606 | 606 | * |
607 | 607 | * @param WP_Post $post WP_Post object of the current post. |
608 | 608 | */ |
609 | - do_action( 'post_comment_status_meta_box-options', $post ); |
|
609 | + do_action('post_comment_status_meta_box-options', $post); |
|
610 | 610 | ?> |
611 | 611 | </p> |
612 | 612 | <?php |
@@ -632,21 +632,21 @@ discard block |
||
632 | 632 | * |
633 | 633 | * @param object $post |
634 | 634 | */ |
635 | -function post_comment_meta_box( $post ) { |
|
636 | - wp_nonce_field( 'get-comments', 'add_comment_nonce', false ); |
|
635 | +function post_comment_meta_box($post) { |
|
636 | + wp_nonce_field('get-comments', 'add_comment_nonce', false); |
|
637 | 637 | ?> |
638 | 638 | <p class="hide-if-no-js" id="add-new-comment"><a class="button" href="#commentstatusdiv" onclick="window.commentReply && commentReply.addcomment(<?php echo $post->ID; ?>);return false;"><?php _e('Add comment'); ?></a></p> |
639 | 639 | <?php |
640 | 640 | |
641 | - $total = get_comments( array( 'post_id' => $post->ID, 'number' => 1, 'count' => true ) ); |
|
641 | + $total = get_comments(array('post_id' => $post->ID, 'number' => 1, 'count' => true)); |
|
642 | 642 | $wp_list_table = _get_list_table('WP_Post_Comments_List_Table'); |
643 | - $wp_list_table->display( true ); |
|
643 | + $wp_list_table->display(true); |
|
644 | 644 | |
645 | - if ( 1 > $total ) { |
|
646 | - echo '<p id="no-comments">' . __('No comments yet.') . '</p>'; |
|
645 | + if (1 > $total) { |
|
646 | + echo '<p id="no-comments">'.__('No comments yet.').'</p>'; |
|
647 | 647 | } else { |
648 | - $hidden = get_hidden_meta_boxes( get_current_screen() ); |
|
649 | - if ( ! in_array('commentsdiv', $hidden) ) { |
|
648 | + $hidden = get_hidden_meta_boxes(get_current_screen()); |
|
649 | + if ( ! in_array('commentsdiv', $hidden)) { |
|
650 | 650 | ?> |
651 | 651 | <script type="text/javascript">jQuery(document).ready(function(){commentsBox.get(<?php echo $total; ?>, 10);});</script> |
652 | 652 | <?php |
@@ -670,7 +670,7 @@ discard block |
||
670 | 670 | function post_slug_meta_box($post) { |
671 | 671 | /** This filter is documented in wp-admin/edit-tag-form.php */ |
672 | 672 | ?> |
673 | -<label class="screen-reader-text" for="post_name"><?php _e('Slug') ?></label><input name="post_name" type="text" size="13" id="post_name" value="<?php echo esc_attr( apply_filters( 'editable_slug', $post->post_name ) ); ?>" /> |
|
673 | +<label class="screen-reader-text" for="post_name"><?php _e('Slug') ?></label><input name="post_name" type="text" size="13" id="post_name" value="<?php echo esc_attr(apply_filters('editable_slug', $post->post_name)); ?>" /> |
|
674 | 674 | <?php |
675 | 675 | } |
676 | 676 | |
@@ -688,12 +688,12 @@ discard block |
||
688 | 688 | ?> |
689 | 689 | <label class="screen-reader-text" for="post_author_override"><?php _e('Author'); ?></label> |
690 | 690 | <?php |
691 | - wp_dropdown_users( array( |
|
691 | + wp_dropdown_users(array( |
|
692 | 692 | 'who' => 'authors', |
693 | 693 | 'name' => 'post_author_override', |
694 | 694 | 'selected' => empty($post->ID) ? $user_ID : $post->post_author, |
695 | 695 | 'include_selected' => true |
696 | - ) ); |
|
696 | + )); |
|
697 | 697 | } |
698 | 698 | |
699 | 699 | /** |
@@ -703,8 +703,8 @@ discard block |
||
703 | 703 | * |
704 | 704 | * @param object $post |
705 | 705 | */ |
706 | -function post_revisions_meta_box( $post ) { |
|
707 | - wp_list_post_revisions( $post ); |
|
706 | +function post_revisions_meta_box($post) { |
|
707 | + wp_list_post_revisions($post); |
|
708 | 708 | } |
709 | 709 | |
710 | 710 | // -- Page related Meta Boxes |
@@ -718,7 +718,7 @@ discard block |
||
718 | 718 | */ |
719 | 719 | function page_attributes_meta_box($post) { |
720 | 720 | $post_type_object = get_post_type_object($post->post_type); |
721 | - if ( $post_type_object->hierarchical ) { |
|
721 | + if ($post_type_object->hierarchical) { |
|
722 | 722 | $dropdown_args = array( |
723 | 723 | 'post_type' => $post->post_type, |
724 | 724 | 'exclude_tree' => $post->ID, |
@@ -739,9 +739,9 @@ discard block |
||
739 | 739 | * @param array $dropdown_args Array of arguments used to generate the pages drop-down. |
740 | 740 | * @param WP_Post $post The current WP_Post object. |
741 | 741 | */ |
742 | - $dropdown_args = apply_filters( 'page_attributes_dropdown_pages_args', $dropdown_args, $post ); |
|
743 | - $pages = wp_dropdown_pages( $dropdown_args ); |
|
744 | - if ( ! empty($pages) ) { |
|
742 | + $dropdown_args = apply_filters('page_attributes_dropdown_pages_args', $dropdown_args, $post); |
|
743 | + $pages = wp_dropdown_pages($dropdown_args); |
|
744 | + if ( ! empty($pages)) { |
|
745 | 745 | ?> |
746 | 746 | <p><strong><?php _e('Parent') ?></strong></p> |
747 | 747 | <label class="screen-reader-text" for="parent_id"><?php _e('Parent') ?></label> |
@@ -749,8 +749,8 @@ discard block |
||
749 | 749 | <?php |
750 | 750 | } // end empty pages check |
751 | 751 | } // end hierarchical check. |
752 | - if ( 'page' == $post->post_type && 0 != count( get_page_templates( $post ) ) && get_option( 'page_for_posts' ) != $post->ID ) { |
|
753 | - $template = !empty($post->page_template) ? $post->page_template : false; |
|
752 | + if ('page' == $post->post_type && 0 != count(get_page_templates($post)) && get_option('page_for_posts') != $post->ID) { |
|
753 | + $template = ! empty($post->page_template) ? $post->page_template : false; |
|
754 | 754 | ?> |
755 | 755 | <p><strong><?php _e('Template') ?></strong></p> |
756 | 756 | <label class="screen-reader-text" for="page_template"><?php _e('Page Template') ?></label><select name="page_template" id="page_template"> |
@@ -764,17 +764,17 @@ discard block |
||
764 | 764 | * @param string $context Where the option label is displayed. Possible values |
765 | 765 | * include 'meta-box' or 'quick-edit'. |
766 | 766 | */ |
767 | -$default_title = apply_filters( 'default_page_template_title', __( 'Default Template' ), 'meta-box' ); |
|
767 | +$default_title = apply_filters('default_page_template_title', __('Default Template'), 'meta-box'); |
|
768 | 768 | ?> |
769 | -<option value="default"><?php echo esc_html( $default_title ); ?></option> |
|
769 | +<option value="default"><?php echo esc_html($default_title); ?></option> |
|
770 | 770 | <?php page_template_dropdown($template); ?> |
771 | 771 | </select> |
772 | 772 | <?php |
773 | 773 | } ?> |
774 | 774 | <p><strong><?php _e('Order') ?></strong></p> |
775 | 775 | <p><label class="screen-reader-text" for="menu_order"><?php _e('Order') ?></label><input name="menu_order" type="text" size="4" id="menu_order" value="<?php echo esc_attr($post->menu_order) ?>" /></p> |
776 | -<?php if ( 'page' == $post->post_type && get_current_screen()->get_help_tabs() ) { ?> |
|
777 | -<p><?php _e( 'Need help? Use the Help tab in the upper right of your screen.' ); ?></p> |
|
776 | +<?php if ('page' == $post->post_type && get_current_screen()->get_help_tabs()) { ?> |
|
777 | +<p><?php _e('Need help? Use the Help tab in the upper right of your screen.'); ?></p> |
|
778 | 778 | <?php |
779 | 779 | } |
780 | 780 | } |
@@ -796,12 +796,12 @@ discard block |
||
796 | 796 | |
797 | 797 | <?php // Hidden submit button early on so that the browser chooses the right button when form is submitted with Return key ?> |
798 | 798 | <div style="display:none;"> |
799 | -<?php submit_button( __( 'Save' ), 'button', 'save', false ); ?> |
|
799 | +<?php submit_button(__('Save'), 'button', 'save', false); ?> |
|
800 | 800 | </div> |
801 | 801 | |
802 | 802 | <div id="minor-publishing-actions"> |
803 | 803 | <div id="preview-action"> |
804 | -<?php if ( !empty($link->link_id) ) { ?> |
|
804 | +<?php if ( ! empty($link->link_id)) { ?> |
|
805 | 805 | <a class="preview button" href="<?php echo $link->link_url; ?>" target="_blank"><?php _e('Visit Link'); ?></a> |
806 | 806 | <?php } ?> |
807 | 807 | </div> |
@@ -819,20 +819,20 @@ discard block |
||
819 | 819 | <div id="major-publishing-actions"> |
820 | 820 | <?php |
821 | 821 | /** This action is documented in wp-admin/includes/meta-boxes.php */ |
822 | -do_action( 'post_submitbox_start' ); |
|
822 | +do_action('post_submitbox_start'); |
|
823 | 823 | ?> |
824 | 824 | <div id="delete-action"> |
825 | 825 | <?php |
826 | -if ( !empty($_GET['action']) && 'edit' == $_GET['action'] && current_user_can('manage_links') ) { ?> |
|
827 | - <a class="submitdelete deletion" href="<?php echo wp_nonce_url("link.php?action=delete&link_id=$link->link_id", 'delete-bookmark_' . $link->link_id); ?>" onclick="if ( confirm('<?php echo esc_js(sprintf(__("You are about to delete this link '%s'\n 'Cancel' to stop, 'OK' to delete."), $link->link_name )); ?>') ) {return true;}return false;"><?php _e('Delete'); ?></a> |
|
826 | +if ( ! empty($_GET['action']) && 'edit' == $_GET['action'] && current_user_can('manage_links')) { ?> |
|
827 | + <a class="submitdelete deletion" href="<?php echo wp_nonce_url("link.php?action=delete&link_id=$link->link_id", 'delete-bookmark_'.$link->link_id); ?>" onclick="if ( confirm('<?php echo esc_js(sprintf(__("You are about to delete this link '%s'\n 'Cancel' to stop, 'OK' to delete."), $link->link_name)); ?>') ) {return true;}return false;"><?php _e('Delete'); ?></a> |
|
828 | 828 | <?php } ?> |
829 | 829 | </div> |
830 | 830 | |
831 | 831 | <div id="publishing-action"> |
832 | -<?php if ( !empty($link->link_id) ) { ?> |
|
833 | - <input name="save" type="submit" class="button-large button-primary" id="publish" value="<?php esc_attr_e( 'Update Link' ) ?>" /> |
|
832 | +<?php if ( ! empty($link->link_id)) { ?> |
|
833 | + <input name="save" type="submit" class="button-large button-primary" id="publish" value="<?php esc_attr_e('Update Link') ?>" /> |
|
834 | 834 | <?php } else { ?> |
835 | - <input name="save" type="submit" class="button-large button-primary" id="publish" value="<?php esc_attr_e( 'Add Link' ) ?>" /> |
|
835 | + <input name="save" type="submit" class="button-large button-primary" id="publish" value="<?php esc_attr_e('Add Link') ?>" /> |
|
836 | 836 | <?php } ?> |
837 | 837 | </div> |
838 | 838 | <div class="clear"></div> |
@@ -843,7 +843,7 @@ discard block |
||
843 | 843 | * |
844 | 844 | * @since 2.5.0 |
845 | 845 | */ |
846 | -do_action( 'submitlink_box' ); |
|
846 | +do_action('submitlink_box'); |
|
847 | 847 | ?> |
848 | 848 | <div class="clear"></div> |
849 | 849 | </div> |
@@ -861,14 +861,14 @@ discard block |
||
861 | 861 | ?> |
862 | 862 | <div id="taxonomy-linkcategory" class="categorydiv"> |
863 | 863 | <ul id="category-tabs" class="category-tabs"> |
864 | - <li class="tabs"><a href="#categories-all"><?php _e( 'All Categories' ); ?></a></li> |
|
865 | - <li class="hide-if-no-js"><a href="#categories-pop"><?php _e( 'Most Used' ); ?></a></li> |
|
864 | + <li class="tabs"><a href="#categories-all"><?php _e('All Categories'); ?></a></li> |
|
865 | + <li class="hide-if-no-js"><a href="#categories-pop"><?php _e('Most Used'); ?></a></li> |
|
866 | 866 | </ul> |
867 | 867 | |
868 | 868 | <div id="categories-all" class="tabs-panel"> |
869 | 869 | <ul id="categorychecklist" data-wp-lists="list:category" class="categorychecklist form-no-clear"> |
870 | 870 | <?php |
871 | - if ( isset($link->link_id) ) |
|
871 | + if (isset($link->link_id)) |
|
872 | 872 | wp_link_category_checklist($link->link_id); |
873 | 873 | else |
874 | 874 | wp_link_category_checklist(); |
@@ -883,12 +883,12 @@ discard block |
||
883 | 883 | </div> |
884 | 884 | |
885 | 885 | <div id="category-adder" class="wp-hidden-children"> |
886 | - <h4><a id="category-add-toggle" href="#category-add"><?php _e( '+ Add New Category' ); ?></a></h4> |
|
886 | + <h4><a id="category-add-toggle" href="#category-add"><?php _e('+ Add New Category'); ?></a></h4> |
|
887 | 887 | <p id="link-category-add" class="wp-hidden-child"> |
888 | - <label class="screen-reader-text" for="newcat"><?php _e( '+ Add New Category' ); ?></label> |
|
889 | - <input type="text" name="newcat" id="newcat" class="form-required form-input-tip" value="<?php esc_attr_e( 'New category name' ); ?>" aria-required="true" /> |
|
890 | - <input type="button" id="link-category-add-submit" data-wp-lists="add:categorychecklist:link-category-add" class="button" value="<?php esc_attr_e( 'Add' ); ?>" /> |
|
891 | - <?php wp_nonce_field( 'add-link-category', '_ajax_nonce', false ); ?> |
|
888 | + <label class="screen-reader-text" for="newcat"><?php _e('+ Add New Category'); ?></label> |
|
889 | + <input type="text" name="newcat" id="newcat" class="form-required form-input-tip" value="<?php esc_attr_e('New category name'); ?>" aria-required="true" /> |
|
890 | + <input type="button" id="link-category-add-submit" data-wp-lists="add:categorychecklist:link-category-add" class="button" value="<?php esc_attr_e('Add'); ?>" /> |
|
891 | + <?php wp_nonce_field('add-link-category', '_ajax_nonce', false); ?> |
|
892 | 892 | <span id="category-ajax-response"></span> |
893 | 893 | </p> |
894 | 894 | </div> |
@@ -906,13 +906,13 @@ discard block |
||
906 | 906 | function link_target_meta_box($link) { ?> |
907 | 907 | <fieldset><legend class="screen-reader-text"><span><?php _e('Target') ?></span></legend> |
908 | 908 | <p><label for="link_target_blank" class="selectit"> |
909 | -<input id="link_target_blank" type="radio" name="link_target" value="_blank" <?php echo ( isset( $link->link_target ) && ($link->link_target == '_blank') ? 'checked="checked"' : ''); ?> /> |
|
909 | +<input id="link_target_blank" type="radio" name="link_target" value="_blank" <?php echo (isset($link->link_target) && ($link->link_target == '_blank') ? 'checked="checked"' : ''); ?> /> |
|
910 | 910 | <?php _e('<code>_blank</code> — new window or tab.'); ?></label></p> |
911 | 911 | <p><label for="link_target_top" class="selectit"> |
912 | -<input id="link_target_top" type="radio" name="link_target" value="_top" <?php echo ( isset( $link->link_target ) && ($link->link_target == '_top') ? 'checked="checked"' : ''); ?> /> |
|
912 | +<input id="link_target_top" type="radio" name="link_target" value="_top" <?php echo (isset($link->link_target) && ($link->link_target == '_top') ? 'checked="checked"' : ''); ?> /> |
|
913 | 913 | <?php _e('<code>_top</code> — current window or tab, with no frames.'); ?></label></p> |
914 | 914 | <p><label for="link_target_none" class="selectit"> |
915 | -<input id="link_target_none" type="radio" name="link_target" value="" <?php echo ( isset( $link->link_target ) && ($link->link_target == '') ? 'checked="checked"' : ''); ?> /> |
|
915 | +<input id="link_target_none" type="radio" name="link_target" value="" <?php echo (isset($link->link_target) && ($link->link_target == '') ? 'checked="checked"' : ''); ?> /> |
|
916 | 916 | <?php _e('<code>_none</code> — same window or tab.'); ?></label></p> |
917 | 917 | </fieldset> |
918 | 918 | <p><?php _e('Choose the target frame for your link.'); ?></p> |
@@ -930,16 +930,16 @@ discard block |
||
930 | 930 | * @param string $value |
931 | 931 | * @param mixed $deprecated Never used. |
932 | 932 | */ |
933 | -function xfn_check( $class, $value = '', $deprecated = '' ) { |
|
933 | +function xfn_check($class, $value = '', $deprecated = '') { |
|
934 | 934 | global $link; |
935 | 935 | |
936 | - if ( !empty( $deprecated ) ) |
|
937 | - _deprecated_argument( __FUNCTION__, '0.0' ); // Never implemented |
|
936 | + if ( ! empty($deprecated)) |
|
937 | + _deprecated_argument(__FUNCTION__, '0.0'); // Never implemented |
|
938 | 938 | |
939 | - $link_rel = isset( $link->link_rel ) ? $link->link_rel : ''; // In PHP 5.3: $link_rel = $link->link_rel ?: ''; |
|
939 | + $link_rel = isset($link->link_rel) ? $link->link_rel : ''; // In PHP 5.3: $link_rel = $link->link_rel ?: ''; |
|
940 | 940 | $rels = preg_split('/\s+/', $link_rel); |
941 | 941 | |
942 | - if ('' != $value && in_array($value, $rels) ) { |
|
942 | + if ('' != $value && in_array($value, $rels)) { |
|
943 | 943 | echo ' checked="checked"'; |
944 | 944 | } |
945 | 945 | |
@@ -947,7 +947,7 @@ discard block |
||
947 | 947 | if ('family' == $class && strpos($link_rel, 'child') === false && strpos($link_rel, 'parent') === false && strpos($link_rel, 'sibling') === false && strpos($link_rel, 'spouse') === false && strpos($link_rel, 'kin') === false) echo ' checked="checked"'; |
948 | 948 | if ('friendship' == $class && strpos($link_rel, 'friend') === false && strpos($link_rel, 'acquaintance') === false && strpos($link_rel, 'contact') === false) echo ' checked="checked"'; |
949 | 949 | if ('geographical' == $class && strpos($link_rel, 'co-resident') === false && strpos($link_rel, 'neighbor') === false) echo ' checked="checked"'; |
950 | - if ('identity' == $class && in_array('me', $rels) ) echo ' checked="checked"'; |
|
950 | + if ('identity' == $class && in_array('me', $rels)) echo ' checked="checked"'; |
|
951 | 951 | } |
952 | 952 | } |
953 | 953 | |
@@ -963,7 +963,7 @@ discard block |
||
963 | 963 | <table class="links-table"> |
964 | 964 | <tr> |
965 | 965 | <th scope="row"><label for="link_rel"><?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('rel:') ?></label></th> |
966 | - <td><input type="text" name="link_rel" id="link_rel" value="<?php echo ( isset( $link->link_rel ) ? esc_attr($link->link_rel) : ''); ?>" /></td> |
|
966 | + <td><input type="text" name="link_rel" id="link_rel" value="<?php echo (isset($link->link_rel) ? esc_attr($link->link_rel) : ''); ?>" /></td> |
|
967 | 967 | </tr> |
968 | 968 | <tr> |
969 | 969 | <th scope="row"><?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('identity') ?></th> |
@@ -1081,25 +1081,25 @@ discard block |
||
1081 | 1081 | <table class="links-table" cellpadding="0"> |
1082 | 1082 | <tr> |
1083 | 1083 | <th scope="row"><label for="link_image"><?php _e('Image Address') ?></label></th> |
1084 | - <td><input type="text" name="link_image" class="code" id="link_image" maxlength="255" value="<?php echo ( isset( $link->link_image ) ? esc_attr($link->link_image) : ''); ?>" /></td> |
|
1084 | + <td><input type="text" name="link_image" class="code" id="link_image" maxlength="255" value="<?php echo (isset($link->link_image) ? esc_attr($link->link_image) : ''); ?>" /></td> |
|
1085 | 1085 | </tr> |
1086 | 1086 | <tr> |
1087 | 1087 | <th scope="row"><label for="rss_uri"><?php _e('RSS Address') ?></label></th> |
1088 | - <td><input name="link_rss" class="code" type="text" id="rss_uri" maxlength="255" value="<?php echo ( isset( $link->link_rss ) ? esc_attr($link->link_rss) : ''); ?>" /></td> |
|
1088 | + <td><input name="link_rss" class="code" type="text" id="rss_uri" maxlength="255" value="<?php echo (isset($link->link_rss) ? esc_attr($link->link_rss) : ''); ?>" /></td> |
|
1089 | 1089 | </tr> |
1090 | 1090 | <tr> |
1091 | 1091 | <th scope="row"><label for="link_notes"><?php _e('Notes') ?></label></th> |
1092 | - <td><textarea name="link_notes" id="link_notes" rows="10"><?php echo ( isset( $link->link_notes ) ? $link->link_notes : ''); // textarea_escaped ?></textarea></td> |
|
1092 | + <td><textarea name="link_notes" id="link_notes" rows="10"><?php echo (isset($link->link_notes) ? $link->link_notes : ''); // textarea_escaped ?></textarea></td> |
|
1093 | 1093 | </tr> |
1094 | 1094 | <tr> |
1095 | 1095 | <th scope="row"><label for="link_rating"><?php _e('Rating') ?></label></th> |
1096 | 1096 | <td><select name="link_rating" id="link_rating" size="1"> |
1097 | 1097 | <?php |
1098 | - for ( $r = 0; $r <= 10; $r++ ) { |
|
1099 | - echo '<option value="' . $r . '"'; |
|
1100 | - if ( isset($link->link_rating) && $link->link_rating == $r ) |
|
1098 | + for ($r = 0; $r <= 10; $r++) { |
|
1099 | + echo '<option value="'.$r.'"'; |
|
1100 | + if (isset($link->link_rating) && $link->link_rating == $r) |
|
1101 | 1101 | echo ' selected="selected"'; |
1102 | - echo('>' . $r . '</option>'); |
|
1102 | + echo('>'.$r.'</option>'); |
|
1103 | 1103 | } |
1104 | 1104 | ?></select> <?php _e('(Leave at 0 for no rating.)') ?> |
1105 | 1105 | </td> |
@@ -1113,9 +1113,9 @@ discard block |
||
1113 | 1113 | * |
1114 | 1114 | * @since 2.9.0 |
1115 | 1115 | */ |
1116 | -function post_thumbnail_meta_box( $post ) { |
|
1117 | - $thumbnail_id = get_post_meta( $post->ID, '_thumbnail_id', true ); |
|
1118 | - echo _wp_post_thumbnail_html( $thumbnail_id, $post->ID ); |
|
1116 | +function post_thumbnail_meta_box($post) { |
|
1117 | + $thumbnail_id = get_post_meta($post->ID, '_thumbnail_id', true); |
|
1118 | + echo _wp_post_thumbnail_html($thumbnail_id, $post->ID); |
|
1119 | 1119 | } |
1120 | 1120 | |
1121 | 1121 | /** |
@@ -1125,18 +1125,18 @@ discard block |
||
1125 | 1125 | * |
1126 | 1126 | * @param WP_Post $post |
1127 | 1127 | */ |
1128 | -function attachment_id3_data_meta_box( $post ) { |
|
1128 | +function attachment_id3_data_meta_box($post) { |
|
1129 | 1129 | $meta = array(); |
1130 | - if ( ! empty( $post->ID ) ) { |
|
1131 | - $meta = wp_get_attachment_metadata( $post->ID ); |
|
1130 | + if ( ! empty($post->ID)) { |
|
1131 | + $meta = wp_get_attachment_metadata($post->ID); |
|
1132 | 1132 | } |
1133 | 1133 | |
1134 | - foreach ( wp_get_attachment_id3_keys( $post, 'edit' ) as $key => $label ) : ?> |
|
1134 | + foreach (wp_get_attachment_id3_keys($post, 'edit') as $key => $label) : ?> |
|
1135 | 1135 | <p> |
1136 | 1136 | <label for="title"><?php echo $label ?></label><br /> |
1137 | - <input type="text" name="id3_<?php echo esc_attr( $key ) ?>" id="id3_<?php echo esc_attr( $key ) ?>" class="large-text" value="<?php |
|
1138 | - if ( ! empty( $meta[ $key ] ) ) { |
|
1139 | - echo esc_attr( $meta[ $key ] ); |
|
1137 | + <input type="text" name="id3_<?php echo esc_attr($key) ?>" id="id3_<?php echo esc_attr($key) ?>" class="large-text" value="<?php |
|
1138 | + if ( ! empty($meta[$key])) { |
|
1139 | + echo esc_attr($meta[$key]); |
|
1140 | 1140 | } |
1141 | 1141 | ?>" /> |
1142 | 1142 | </p> |
@@ -107,8 +107,11 @@ discard block |
||
107 | 107 | <option<?php selected( $post->post_status, 'pending' ); ?> value='pending'><?php _e('Pending Review') ?></option> |
108 | 108 | <?php if ( 'auto-draft' == $post->post_status ) : ?> |
109 | 109 | <option<?php selected( $post->post_status, 'auto-draft' ); ?> value='draft'><?php _e('Draft') ?></option> |
110 | -<?php else : ?> |
|
111 | -<option<?php selected( $post->post_status, 'draft' ); ?> value='draft'><?php _e('Draft') ?></option> |
|
110 | +<?php else { |
|
111 | + : ?> |
|
112 | +<option<?php selected( $post->post_status, 'draft' ); |
|
113 | +} |
|
114 | +?> value='draft'><?php _e('Draft') ?></option> |
|
112 | 115 | <?php endif; ?> |
113 | 116 | </select> |
114 | 117 | <a href="#post_status" class="save-post-status hide-if-no-js button"><?php _e('OK'); ?></a> |
@@ -238,10 +241,11 @@ discard block |
||
238 | 241 | <div id="delete-action"> |
239 | 242 | <?php |
240 | 243 | if ( current_user_can( "delete_post", $post->ID ) ) { |
241 | - if ( !EMPTY_TRASH_DAYS ) |
|
242 | - $delete_text = __('Delete Permanently'); |
|
243 | - else |
|
244 | - $delete_text = __('Move to Trash'); |
|
244 | + if ( !EMPTY_TRASH_DAYS ) { |
|
245 | + $delete_text = __('Delete Permanently'); |
|
246 | + } else { |
|
247 | + $delete_text = __('Move to Trash'); |
|
248 | + } |
|
245 | 249 | ?> |
246 | 250 | <a class="submitdelete deletion" href="<?php echo get_delete_post_link($post->ID); ?>"><?php echo $delete_text; ?></a><?php |
247 | 251 | } ?> |
@@ -255,13 +259,19 @@ discard block |
||
255 | 259 | if ( !empty($post->post_date_gmt) && time() < strtotime( $post->post_date_gmt . ' +0000' ) ) : ?> |
256 | 260 | <input name="original_publish" type="hidden" id="original_publish" value="<?php esc_attr_e('Schedule') ?>" /> |
257 | 261 | <?php submit_button( __( 'Schedule' ), 'primary button-large', 'publish', false ); ?> |
258 | -<?php else : ?> |
|
262 | +<?php else { |
|
263 | + : ?> |
|
259 | 264 | <input name="original_publish" type="hidden" id="original_publish" value="<?php esc_attr_e('Publish') ?>" /> |
260 | - <?php submit_button( __( 'Publish' ), 'primary button-large', 'publish', false ); ?> |
|
265 | + <?php submit_button( __( 'Publish' ), 'primary button-large', 'publish', false ); |
|
266 | +} |
|
267 | +?> |
|
261 | 268 | <?php endif; |
262 | - else : ?> |
|
269 | + else { |
|
270 | + : ?> |
|
263 | 271 | <input name="original_publish" type="hidden" id="original_publish" value="<?php esc_attr_e('Submit for Review') ?>" /> |
264 | - <?php submit_button( __( 'Submit for Review' ), 'primary button-large', 'publish', false ); ?> |
|
272 | + <?php submit_button( __( 'Submit for Review' ), 'primary button-large', 'publish', false ); |
|
273 | + } |
|
274 | + ?> |
|
265 | 275 | <?php |
266 | 276 | endif; |
267 | 277 | } else { ?> |
@@ -323,9 +333,10 @@ discard block |
||
323 | 333 | <div id="major-publishing-actions"> |
324 | 334 | <div id="delete-action"> |
325 | 335 | <?php |
326 | - if ( current_user_can( 'delete_post', $post->ID ) ) |
|
327 | - if ( EMPTY_TRASH_DAYS && MEDIA_TRASH ) { |
|
336 | + if ( current_user_can( 'delete_post', $post->ID ) ) { |
|
337 | + if ( EMPTY_TRASH_DAYS && MEDIA_TRASH ) { |
|
328 | 338 | echo "<a class='submitdelete deletion' href='" . get_delete_post_link( $post->ID ) . "'>" . __( 'Trash' ) . "</a>"; |
339 | + } |
|
329 | 340 | } else { |
330 | 341 | $delete_ays = ! MEDIA_TRASH ? " onclick='return showNotice.warn();'" : ''; |
331 | 342 | echo "<a class='submitdelete deletion'$delete_ays href='" . get_delete_post_link( $post->ID, null, true ) . "'>" . __( 'Delete Permanently' ) . "</a>"; |
@@ -367,11 +378,13 @@ discard block |
||
367 | 378 | |
368 | 379 | if ( is_array( $post_formats[0] ) ) : |
369 | 380 | $post_format = get_post_format( $post->ID ); |
370 | - if ( !$post_format ) |
|
371 | - $post_format = '0'; |
|
381 | + if ( !$post_format ) { |
|
382 | + $post_format = '0'; |
|
383 | + } |
|
372 | 384 | // Add in the current one if it isn't there yet, in case the current theme doesn't support it |
373 | - if ( $post_format && !in_array( $post_format, $post_formats[0] ) ) |
|
374 | - $post_formats[0][] = $post_format; |
|
385 | + if ( $post_format && !in_array( $post_format, $post_formats[0] ) ) { |
|
386 | + $post_formats[0][] = $post_format; |
|
387 | + } |
|
375 | 388 | ?> |
376 | 389 | <div id="post-formats-select"> |
377 | 390 | <fieldset> |
@@ -557,9 +570,10 @@ discard block |
||
557 | 570 | <p><label for="trackback_url"><?php _e('Send trackbacks to:'); ?></label> <?php echo $form_trackback; ?><br /> (<?php _e('Separate multiple URLs with spaces'); ?>)</p> |
558 | 571 | <p><?php _e('Trackbacks are a way to notify legacy blog systems that you’ve linked to them. If you link other WordPress sites, they’ll be notified automatically using <a href="https://codex.wordpress.org/Introduction_to_Blogging#Managing_Comments" target="_blank">pingbacks</a>, no other action necessary.'); ?></p> |
559 | 572 | <?php |
560 | -if ( ! empty($pings) ) |
|
573 | +if ( ! empty($pings) ) { |
|
561 | 574 | echo $pings; |
562 | 575 | } |
576 | +} |
|
563 | 577 | |
564 | 578 | /** |
565 | 579 | * Display custom fields form fields. |
@@ -575,9 +589,10 @@ discard block |
||
575 | 589 | <?php |
576 | 590 | $metadata = has_meta($post->ID); |
577 | 591 | foreach ( $metadata as $key => $value ) { |
578 | - if ( is_protected_meta( $metadata[ $key ][ 'meta_key' ], 'post' ) || ! current_user_can( 'edit_post_meta', $post->ID, $metadata[ $key ][ 'meta_key' ] ) ) |
|
579 | - unset( $metadata[ $key ] ); |
|
580 | -} |
|
592 | + if ( is_protected_meta( $metadata[ $key ][ 'meta_key' ], 'post' ) || ! current_user_can( 'edit_post_meta', $post->ID, $metadata[ $key ][ 'meta_key' ] ) ) { |
|
593 | + unset( $metadata[ $key ] ); |
|
594 | + } |
|
595 | + } |
|
581 | 596 | list_meta( $metadata ); |
582 | 597 | meta_form( $post ); ?> |
583 | 598 | </div> |
@@ -868,10 +883,11 @@ discard block |
||
868 | 883 | <div id="categories-all" class="tabs-panel"> |
869 | 884 | <ul id="categorychecklist" data-wp-lists="list:category" class="categorychecklist form-no-clear"> |
870 | 885 | <?php |
871 | - if ( isset($link->link_id) ) |
|
872 | - wp_link_category_checklist($link->link_id); |
|
873 | - else |
|
874 | - wp_link_category_checklist(); |
|
886 | + if ( isset($link->link_id) ) { |
|
887 | + wp_link_category_checklist($link->link_id); |
|
888 | + } else { |
|
889 | + wp_link_category_checklist(); |
|
890 | + } |
|
875 | 891 | ?> |
876 | 892 | </ul> |
877 | 893 | </div> |
@@ -933,8 +949,10 @@ discard block |
||
933 | 949 | function xfn_check( $class, $value = '', $deprecated = '' ) { |
934 | 950 | global $link; |
935 | 951 | |
936 | - if ( !empty( $deprecated ) ) |
|
937 | - _deprecated_argument( __FUNCTION__, '0.0' ); // Never implemented |
|
952 | + if ( !empty( $deprecated ) ) { |
|
953 | + _deprecated_argument( __FUNCTION__, '0.0' ); |
|
954 | + } |
|
955 | + // Never implemented |
|
938 | 956 | |
939 | 957 | $link_rel = isset( $link->link_rel ) ? $link->link_rel : ''; // In PHP 5.3: $link_rel = $link->link_rel ?: ''; |
940 | 958 | $rels = preg_split('/\s+/', $link_rel); |
@@ -944,10 +962,18 @@ discard block |
||
944 | 962 | } |
945 | 963 | |
946 | 964 | if ('' == $value) { |
947 | - if ('family' == $class && strpos($link_rel, 'child') === false && strpos($link_rel, 'parent') === false && strpos($link_rel, 'sibling') === false && strpos($link_rel, 'spouse') === false && strpos($link_rel, 'kin') === false) echo ' checked="checked"'; |
|
948 | - if ('friendship' == $class && strpos($link_rel, 'friend') === false && strpos($link_rel, 'acquaintance') === false && strpos($link_rel, 'contact') === false) echo ' checked="checked"'; |
|
949 | - if ('geographical' == $class && strpos($link_rel, 'co-resident') === false && strpos($link_rel, 'neighbor') === false) echo ' checked="checked"'; |
|
950 | - if ('identity' == $class && in_array('me', $rels) ) echo ' checked="checked"'; |
|
965 | + if ('family' == $class && strpos($link_rel, 'child') === false && strpos($link_rel, 'parent') === false && strpos($link_rel, 'sibling') === false && strpos($link_rel, 'spouse') === false && strpos($link_rel, 'kin') === false) { |
|
966 | + echo ' checked="checked"'; |
|
967 | + } |
|
968 | + if ('friendship' == $class && strpos($link_rel, 'friend') === false && strpos($link_rel, 'acquaintance') === false && strpos($link_rel, 'contact') === false) { |
|
969 | + echo ' checked="checked"'; |
|
970 | + } |
|
971 | + if ('geographical' == $class && strpos($link_rel, 'co-resident') === false && strpos($link_rel, 'neighbor') === false) { |
|
972 | + echo ' checked="checked"'; |
|
973 | + } |
|
974 | + if ('identity' == $class && in_array('me', $rels) ) { |
|
975 | + echo ' checked="checked"'; |
|
976 | + } |
|
951 | 977 | } |
952 | 978 | } |
953 | 979 | |
@@ -1097,8 +1123,9 @@ discard block |
||
1097 | 1123 | <?php |
1098 | 1124 | for ( $r = 0; $r <= 10; $r++ ) { |
1099 | 1125 | echo '<option value="' . $r . '"'; |
1100 | - if ( isset($link->link_rating) && $link->link_rating == $r ) |
|
1101 | - echo ' selected="selected"'; |
|
1126 | + if ( isset($link->link_rating) && $link->link_rating == $r ) { |
|
1127 | + echo ' selected="selected"'; |
|
1128 | + } |
|
1102 | 1129 | echo('>' . $r . '</option>'); |
1103 | 1130 | } |
1104 | 1131 | ?></select> <?php _e('(Leave at 0 for no rating.)') ?> |