@@ -58,12 +58,12 @@ |
||
58 | 58 | </div> |
59 | 59 | <?php |
60 | 60 | /** |
61 | - * Print scripts or data before the default footer scripts. |
|
62 | - * |
|
63 | - * @since 1.2.0 |
|
64 | - * |
|
65 | - * @param string $data The data to print. |
|
66 | - */ |
|
61 | + * Print scripts or data before the default footer scripts. |
|
62 | + * |
|
63 | + * @since 1.2.0 |
|
64 | + * |
|
65 | + * @param string $data The data to print. |
|
66 | + */ |
|
67 | 67 | do_action( 'admin_footer', '' ); |
68 | 68 | |
69 | 69 | /** |
@@ -7,7 +7,7 @@ discard block |
||
7 | 7 | */ |
8 | 8 | |
9 | 9 | // don't load directly |
10 | -if ( !defined('ABSPATH') ) |
|
10 | +if ( ! defined('ABSPATH')) |
|
11 | 11 | die('-1'); |
12 | 12 | ?> |
13 | 13 | |
@@ -22,11 +22,11 @@ discard block |
||
22 | 22 | * |
23 | 23 | * @since 2.5.0 |
24 | 24 | */ |
25 | - do_action( 'in_admin_footer' ); |
|
25 | + do_action('in_admin_footer'); |
|
26 | 26 | ?> |
27 | 27 | <p id="footer-left" class="alignleft"> |
28 | 28 | <?php |
29 | - $text = sprintf( __( 'Thank you for creating with <a href="%s">WordPress</a>.' ), __( 'https://wordpress.org/' ) ); |
|
29 | + $text = sprintf(__('Thank you for creating with <a href="%s">WordPress</a>.'), __('https://wordpress.org/')); |
|
30 | 30 | /** |
31 | 31 | * Filter the "Thank you" text displayed in the admin footer. |
32 | 32 | * |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | * |
35 | 35 | * @param string $text The content that will be printed. |
36 | 36 | */ |
37 | - echo apply_filters( 'admin_footer_text', '<span id="footer-thankyou">' . $text . '</span>' ); |
|
37 | + echo apply_filters('admin_footer_text', '<span id="footer-thankyou">'.$text.'</span>'); |
|
38 | 38 | ?> |
39 | 39 | </p> |
40 | 40 | <p id="footer-upgrade" class="alignright"> |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | * |
52 | 52 | * @param string $content The content that will be printed. |
53 | 53 | */ |
54 | - echo apply_filters( 'update_footer', '' ); |
|
54 | + echo apply_filters('update_footer', ''); |
|
55 | 55 | ?> |
56 | 56 | </p> |
57 | 57 | <div class="clear"></div> |
@@ -64,14 +64,14 @@ discard block |
||
64 | 64 | * |
65 | 65 | * @param string $data The data to print. |
66 | 66 | */ |
67 | -do_action( 'admin_footer', '' ); |
|
67 | +do_action('admin_footer', ''); |
|
68 | 68 | |
69 | 69 | /** |
70 | 70 | * Prints any scripts and data queued for the footer. |
71 | 71 | * |
72 | 72 | * @since 2.8.0 |
73 | 73 | */ |
74 | -do_action( 'admin_print_footer_scripts' ); |
|
74 | +do_action('admin_print_footer_scripts'); |
|
75 | 75 | |
76 | 76 | /** |
77 | 77 | * Print scripts or data after the default footer scripts. |
@@ -84,11 +84,11 @@ discard block |
||
84 | 84 | * @global string $hook_suffix |
85 | 85 | * @param string $hook_suffix The current admin page. |
86 | 86 | */ |
87 | -do_action( "admin_footer-" . $GLOBALS['hook_suffix'] ); |
|
87 | +do_action("admin_footer-".$GLOBALS['hook_suffix']); |
|
88 | 88 | |
89 | 89 | // get_site_option() won't exist when auto upgrading from <= 2.7 |
90 | -if ( function_exists('get_site_option') ) { |
|
91 | - if ( false === get_site_option('can_compress_scripts') ) |
|
90 | +if (function_exists('get_site_option')) { |
|
91 | + if (false === get_site_option('can_compress_scripts')) |
|
92 | 92 | compression_test(); |
93 | 93 | } |
94 | 94 |
@@ -7,8 +7,9 @@ discard block |
||
7 | 7 | */ |
8 | 8 | |
9 | 9 | // don't load directly |
10 | -if ( !defined('ABSPATH') ) |
|
10 | +if ( !defined('ABSPATH') ) { |
|
11 | 11 | die('-1'); |
12 | +} |
|
12 | 13 | ?> |
13 | 14 | |
14 | 15 | <div class="clear"></div></div><!-- wpbody-content --> |
@@ -88,9 +89,10 @@ discard block |
||
88 | 89 | |
89 | 90 | // get_site_option() won't exist when auto upgrading from <= 2.7 |
90 | 91 | if ( function_exists('get_site_option') ) { |
91 | - if ( false === get_site_option('can_compress_scripts') ) |
|
92 | - compression_test(); |
|
93 | -} |
|
92 | + if ( false === get_site_option('can_compress_scripts') ) { |
|
93 | + compression_test(); |
|
94 | + } |
|
95 | + } |
|
94 | 96 | |
95 | 97 | ?> |
96 | 98 |
@@ -1,10 +1,10 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * The custom background script. |
|
4 | - * |
|
5 | - * @package WordPress |
|
6 | - * @subpackage Administration |
|
7 | - */ |
|
3 | + * The custom background script. |
|
4 | + * |
|
5 | + * @package WordPress |
|
6 | + * @subpackage Administration |
|
7 | + */ |
|
8 | 8 | |
9 | 9 | /** |
10 | 10 | * The custom background class. |
@@ -47,12 +47,12 @@ discard block |
||
47 | 47 | $this->admin_header_callback = $admin_header_callback; |
48 | 48 | $this->admin_image_div_callback = $admin_image_div_callback; |
49 | 49 | |
50 | - add_action( 'admin_menu', array( $this, 'init' ) ); |
|
50 | + add_action('admin_menu', array($this, 'init')); |
|
51 | 51 | |
52 | - add_action( 'wp_ajax_custom-background-add', array( $this, 'ajax_background_add' ) ); |
|
52 | + add_action('wp_ajax_custom-background-add', array($this, 'ajax_background_add')); |
|
53 | 53 | |
54 | 54 | // Unused since 3.5.0. |
55 | - add_action( 'wp_ajax_set-background-image', array( $this, 'wp_set_background_image' ) ); |
|
55 | + add_action('wp_ajax_set-background-image', array($this, 'wp_set_background_image')); |
|
56 | 56 | } |
57 | 57 | |
58 | 58 | /** |
@@ -61,17 +61,17 @@ discard block |
||
61 | 61 | * @since 3.0.0 |
62 | 62 | */ |
63 | 63 | public function init() { |
64 | - $page = add_theme_page( __( 'Background' ), __( 'Background' ), 'edit_theme_options', 'custom-background', array( $this, 'admin_page' ) ); |
|
65 | - if ( ! $page ) { |
|
64 | + $page = add_theme_page(__('Background'), __('Background'), 'edit_theme_options', 'custom-background', array($this, 'admin_page')); |
|
65 | + if ( ! $page) { |
|
66 | 66 | return; |
67 | 67 | } |
68 | 68 | |
69 | - add_action( "load-$page", array( $this, 'admin_load' ) ); |
|
70 | - add_action( "load-$page", array( $this, 'take_action' ), 49 ); |
|
71 | - add_action( "load-$page", array( $this, 'handle_upload' ), 49 ); |
|
69 | + add_action("load-$page", array($this, 'admin_load')); |
|
70 | + add_action("load-$page", array($this, 'take_action'), 49); |
|
71 | + add_action("load-$page", array($this, 'handle_upload'), 49); |
|
72 | 72 | |
73 | - if ( $this->admin_header_callback ) { |
|
74 | - add_action( "admin_head-$page", $this->admin_header_callback, 51 ); |
|
73 | + if ($this->admin_header_callback) { |
|
74 | + add_action("admin_head-$page", $this->admin_header_callback, 51); |
|
75 | 75 | } |
76 | 76 | } |
77 | 77 | |
@@ -81,20 +81,20 @@ discard block |
||
81 | 81 | * @since 3.0.0 |
82 | 82 | */ |
83 | 83 | public function admin_load() { |
84 | - get_current_screen()->add_help_tab( array( |
|
84 | + get_current_screen()->add_help_tab(array( |
|
85 | 85 | 'id' => 'overview', |
86 | 86 | 'title' => __('Overview'), |
87 | 87 | 'content' => |
88 | - '<p>' . __( 'You can customize the look of your site without touching any of your theme’s code by using a custom background. Your background can be an image or a color.' ) . '</p>' . |
|
89 | - '<p>' . __( 'To use a background image, simply upload it or choose an image that has already been uploaded to your Media Library by clicking the “Choose Image” button. You can display a single instance of your image, or tile it to fill the screen. You can have your background fixed in place, so your site content moves on top of it, or you can have it scroll with your site.' ) . '</p>' . |
|
90 | - '<p>' . __( 'You can also choose a background color by clicking the Select Color button and either typing in a legitimate HTML hex value, e.g. “#ff0000” for red, or by choosing a color using the color picker.' ) . '</p>' . |
|
91 | - '<p>' . __( 'Don’t forget to click on the Save Changes button when you are finished.' ) . '</p>' |
|
92 | - ) ); |
|
88 | + '<p>'.__('You can customize the look of your site without touching any of your theme’s code by using a custom background. Your background can be an image or a color.').'</p>'. |
|
89 | + '<p>'.__('To use a background image, simply upload it or choose an image that has already been uploaded to your Media Library by clicking the “Choose Image” button. You can display a single instance of your image, or tile it to fill the screen. You can have your background fixed in place, so your site content moves on top of it, or you can have it scroll with your site.').'</p>'. |
|
90 | + '<p>'.__('You can also choose a background color by clicking the Select Color button and either typing in a legitimate HTML hex value, e.g. “#ff0000” for red, or by choosing a color using the color picker.').'</p>'. |
|
91 | + '<p>'.__('Don’t forget to click on the Save Changes button when you are finished.').'</p>' |
|
92 | + )); |
|
93 | 93 | |
94 | 94 | get_current_screen()->set_help_sidebar( |
95 | - '<p><strong>' . __( 'For more information:' ) . '</strong></p>' . |
|
96 | - '<p>' . __( '<a href="https://codex.wordpress.org/Appearance_Background_Screen" target="_blank">Documentation on Custom Background</a>' ) . '</p>' . |
|
97 | - '<p>' . __( '<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>' ) . '</p>' |
|
95 | + '<p><strong>'.__('For more information:').'</strong></p>'. |
|
96 | + '<p>'.__('<a href="https://codex.wordpress.org/Appearance_Background_Screen" target="_blank">Documentation on Custom Background</a>').'</p>'. |
|
97 | + '<p>'.__('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>').'</p>' |
|
98 | 98 | ); |
99 | 99 | |
100 | 100 | wp_enqueue_media(); |
@@ -108,10 +108,10 @@ discard block |
||
108 | 108 | * @since 3.0.0 |
109 | 109 | */ |
110 | 110 | public function take_action() { |
111 | - if ( empty($_POST) ) |
|
111 | + if (empty($_POST)) |
|
112 | 112 | return; |
113 | 113 | |
114 | - if ( isset($_POST['reset-background']) ) { |
|
114 | + if (isset($_POST['reset-background'])) { |
|
115 | 115 | check_admin_referer('custom-background-reset', '_wpnonce-custom-background-reset'); |
116 | 116 | remove_theme_mod('background_image'); |
117 | 117 | remove_theme_mod('background_image_thumb'); |
@@ -119,47 +119,47 @@ discard block |
||
119 | 119 | return; |
120 | 120 | } |
121 | 121 | |
122 | - if ( isset($_POST['remove-background']) ) { |
|
122 | + if (isset($_POST['remove-background'])) { |
|
123 | 123 | // @TODO: Uploaded files are not removed here. |
124 | 124 | check_admin_referer('custom-background-remove', '_wpnonce-custom-background-remove'); |
125 | 125 | set_theme_mod('background_image', ''); |
126 | 126 | set_theme_mod('background_image_thumb', ''); |
127 | 127 | $this->updated = true; |
128 | - wp_safe_redirect( $_POST['_wp_http_referer'] ); |
|
128 | + wp_safe_redirect($_POST['_wp_http_referer']); |
|
129 | 129 | return; |
130 | 130 | } |
131 | 131 | |
132 | - if ( isset($_POST['background-repeat']) ) { |
|
132 | + if (isset($_POST['background-repeat'])) { |
|
133 | 133 | check_admin_referer('custom-background'); |
134 | - if ( in_array($_POST['background-repeat'], array('repeat', 'no-repeat', 'repeat-x', 'repeat-y')) ) |
|
134 | + if (in_array($_POST['background-repeat'], array('repeat', 'no-repeat', 'repeat-x', 'repeat-y'))) |
|
135 | 135 | $repeat = $_POST['background-repeat']; |
136 | 136 | else |
137 | 137 | $repeat = 'repeat'; |
138 | 138 | set_theme_mod('background_repeat', $repeat); |
139 | 139 | } |
140 | 140 | |
141 | - if ( isset($_POST['background-position-x']) ) { |
|
141 | + if (isset($_POST['background-position-x'])) { |
|
142 | 142 | check_admin_referer('custom-background'); |
143 | - if ( in_array($_POST['background-position-x'], array('center', 'right', 'left')) ) |
|
143 | + if (in_array($_POST['background-position-x'], array('center', 'right', 'left'))) |
|
144 | 144 | $position = $_POST['background-position-x']; |
145 | 145 | else |
146 | 146 | $position = 'left'; |
147 | 147 | set_theme_mod('background_position_x', $position); |
148 | 148 | } |
149 | 149 | |
150 | - if ( isset($_POST['background-attachment']) ) { |
|
150 | + if (isset($_POST['background-attachment'])) { |
|
151 | 151 | check_admin_referer('custom-background'); |
152 | - if ( in_array($_POST['background-attachment'], array('fixed', 'scroll')) ) |
|
152 | + if (in_array($_POST['background-attachment'], array('fixed', 'scroll'))) |
|
153 | 153 | $attachment = $_POST['background-attachment']; |
154 | 154 | else |
155 | 155 | $attachment = 'fixed'; |
156 | 156 | set_theme_mod('background_attachment', $attachment); |
157 | 157 | } |
158 | 158 | |
159 | - if ( isset($_POST['background-color']) ) { |
|
159 | + if (isset($_POST['background-color'])) { |
|
160 | 160 | check_admin_referer('custom-background'); |
161 | 161 | $color = preg_replace('/[^0-9a-fA-F]/', '', $_POST['background-color']); |
162 | - if ( strlen($color) == 6 || strlen($color) == 3 ) |
|
162 | + if (strlen($color) == 6 || strlen($color) == 3) |
|
163 | 163 | set_theme_mod('background_color', $color); |
164 | 164 | else |
165 | 165 | set_theme_mod('background_color', ''); |
@@ -176,54 +176,54 @@ discard block |
||
176 | 176 | public function admin_page() { |
177 | 177 | ?> |
178 | 178 | <div class="wrap" id="custom-background"> |
179 | -<h1><?php _e( 'Custom Background' ); ?></h1> |
|
179 | +<h1><?php _e('Custom Background'); ?></h1> |
|
180 | 180 | |
181 | -<?php if ( current_user_can( 'customize' ) ) { ?> |
|
181 | +<?php if (current_user_can('customize')) { ?> |
|
182 | 182 | <div class="notice notice-info hide-if-no-customize"> |
183 | 183 | <p> |
184 | 184 | <?php |
185 | 185 | printf( |
186 | - __( 'You can now manage and live-preview Custom Backgrounds in the <a href="%1$s">Customizer</a>.' ), |
|
187 | - admin_url( 'customize.php?autofocus[control]=background_image' ) |
|
186 | + __('You can now manage and live-preview Custom Backgrounds in the <a href="%1$s">Customizer</a>.'), |
|
187 | + admin_url('customize.php?autofocus[control]=background_image') |
|
188 | 188 | ); |
189 | 189 | ?> |
190 | 190 | </p> |
191 | 191 | </div> |
192 | 192 | <?php } ?> |
193 | 193 | |
194 | -<?php if ( ! empty( $this->updated ) ) { ?> |
|
194 | +<?php if ( ! empty($this->updated)) { ?> |
|
195 | 195 | <div id="message" class="updated"> |
196 | -<p><?php printf( __( 'Background updated. <a href="%s">Visit your site</a> to see how it looks.' ), home_url( '/' ) ); ?></p> |
|
196 | +<p><?php printf(__('Background updated. <a href="%s">Visit your site</a> to see how it looks.'), home_url('/')); ?></p> |
|
197 | 197 | </div> |
198 | 198 | <?php } ?> |
199 | 199 | |
200 | -<h3><?php _e( 'Background Image' ); ?></h3> |
|
200 | +<h3><?php _e('Background Image'); ?></h3> |
|
201 | 201 | |
202 | 202 | <table class="form-table"> |
203 | 203 | <tbody> |
204 | 204 | <tr> |
205 | -<th scope="row"><?php _e( 'Preview' ); ?></th> |
|
205 | +<th scope="row"><?php _e('Preview'); ?></th> |
|
206 | 206 | <td> |
207 | 207 | <?php |
208 | - if ( $this->admin_image_div_callback ) { |
|
209 | - call_user_func( $this->admin_image_div_callback ); |
|
208 | + if ($this->admin_image_div_callback) { |
|
209 | + call_user_func($this->admin_image_div_callback); |
|
210 | 210 | } else { |
211 | 211 | $background_styles = ''; |
212 | - if ( $bgcolor = get_background_color() ) |
|
213 | - $background_styles .= 'background-color: #' . $bgcolor . ';'; |
|
212 | + if ($bgcolor = get_background_color()) |
|
213 | + $background_styles .= 'background-color: #'.$bgcolor.';'; |
|
214 | 214 | |
215 | 215 | $background_image_thumb = get_background_image(); |
216 | - if ( $background_image_thumb ) { |
|
217 | - $background_image_thumb = esc_url( set_url_scheme( get_theme_mod( 'background_image_thumb', str_replace( '%', '%%', $background_image_thumb ) ) ) ); |
|
216 | + if ($background_image_thumb) { |
|
217 | + $background_image_thumb = esc_url(set_url_scheme(get_theme_mod('background_image_thumb', str_replace('%', '%%', $background_image_thumb)))); |
|
218 | 218 | |
219 | 219 | // Background-image URL must be single quote, see below. |
220 | - $background_styles .= ' background-image: url(\'' . $background_image_thumb . '\');' |
|
221 | - . ' background-repeat: ' . get_theme_mod( 'background_repeat', get_theme_support( 'custom-background', 'default-repeat' ) ) . ';' |
|
222 | - . ' background-position: top ' . get_theme_mod( 'background_position_x', get_theme_support( 'custom-background', 'default-position-x' ) ); |
|
220 | + $background_styles .= ' background-image: url(\''.$background_image_thumb.'\');' |
|
221 | + . ' background-repeat: '.get_theme_mod('background_repeat', get_theme_support('custom-background', 'default-repeat')).';' |
|
222 | + . ' background-position: top '.get_theme_mod('background_position_x', get_theme_support('custom-background', 'default-position-x')); |
|
223 | 223 | } |
224 | 224 | ?> |
225 | 225 | <div id="custom-background-image" style="<?php echo $background_styles; ?>"><?php // must be double quote, see above ?> |
226 | - <?php if ( $background_image_thumb ) { ?> |
|
226 | + <?php if ($background_image_thumb) { ?> |
|
227 | 227 | <img class="custom-background-image" src="<?php echo $background_image_thumb; ?>" style="visibility:hidden;" alt="" /><br /> |
228 | 228 | <img class="custom-background-image" src="<?php echo $background_image_thumb; ?>" style="visibility:hidden;" alt="" /> |
229 | 229 | <?php } ?> |
@@ -232,49 +232,49 @@ discard block |
||
232 | 232 | </td> |
233 | 233 | </tr> |
234 | 234 | |
235 | -<?php if ( get_background_image() ) : ?> |
|
235 | +<?php if (get_background_image()) : ?> |
|
236 | 236 | <tr> |
237 | 237 | <th scope="row"><?php _e('Remove Image'); ?></th> |
238 | 238 | <td> |
239 | 239 | <form method="post"> |
240 | 240 | <?php wp_nonce_field('custom-background-remove', '_wpnonce-custom-background-remove'); ?> |
241 | -<?php submit_button( __( 'Remove Background Image' ), 'button', 'remove-background', false ); ?><br/> |
|
241 | +<?php submit_button(__('Remove Background Image'), 'button', 'remove-background', false); ?><br/> |
|
242 | 242 | <?php _e('This will remove the background image. You will not be able to restore any customizations.') ?> |
243 | 243 | </form> |
244 | 244 | </td> |
245 | 245 | </tr> |
246 | 246 | <?php endif; ?> |
247 | 247 | |
248 | -<?php $default_image = get_theme_support( 'custom-background', 'default-image' ); ?> |
|
249 | -<?php if ( $default_image && get_background_image() != $default_image ) : ?> |
|
248 | +<?php $default_image = get_theme_support('custom-background', 'default-image'); ?> |
|
249 | +<?php if ($default_image && get_background_image() != $default_image) : ?> |
|
250 | 250 | <tr> |
251 | 251 | <th scope="row"><?php _e('Restore Original Image'); ?></th> |
252 | 252 | <td> |
253 | 253 | <form method="post"> |
254 | 254 | <?php wp_nonce_field('custom-background-reset', '_wpnonce-custom-background-reset'); ?> |
255 | -<?php submit_button( __( 'Restore Original Image' ), 'button', 'reset-background', false ); ?><br/> |
|
255 | +<?php submit_button(__('Restore Original Image'), 'button', 'reset-background', false); ?><br/> |
|
256 | 256 | <?php _e('This will restore the original background image. You will not be able to restore any customizations.') ?> |
257 | 257 | </form> |
258 | 258 | </td> |
259 | 259 | </tr> |
260 | 260 | <?php endif; ?> |
261 | 261 | |
262 | -<?php if ( current_user_can( 'upload_files' ) ): ?> |
|
262 | +<?php if (current_user_can('upload_files')): ?> |
|
263 | 263 | <tr> |
264 | 264 | <th scope="row"><?php _e('Select Image'); ?></th> |
265 | 265 | <td><form enctype="multipart/form-data" id="upload-form" class="wp-upload-form" method="post"> |
266 | 266 | <p> |
267 | - <label for="upload"><?php _e( 'Choose an image from your computer:' ); ?></label><br /> |
|
267 | + <label for="upload"><?php _e('Choose an image from your computer:'); ?></label><br /> |
|
268 | 268 | <input type="file" id="upload" name="import" /> |
269 | 269 | <input type="hidden" name="action" value="save" /> |
270 | - <?php wp_nonce_field( 'custom-background-upload', '_wpnonce-custom-background-upload' ); ?> |
|
271 | - <?php submit_button( __( 'Upload' ), 'button', 'submit', false ); ?> |
|
270 | + <?php wp_nonce_field('custom-background-upload', '_wpnonce-custom-background-upload'); ?> |
|
271 | + <?php submit_button(__('Upload'), 'button', 'submit', false); ?> |
|
272 | 272 | </p> |
273 | 273 | <p> |
274 | - <label for="choose-from-library-link"><?php _e( 'Or choose an image from your media library:' ); ?></label><br /> |
|
274 | + <label for="choose-from-library-link"><?php _e('Or choose an image from your media library:'); ?></label><br /> |
|
275 | 275 | <button id="choose-from-library-link" class="button" |
276 | - data-choose="<?php esc_attr_e( 'Choose a Background Image' ); ?>" |
|
277 | - data-update="<?php esc_attr_e( 'Set as background' ); ?>"><?php _e( 'Choose Image' ); ?></button> |
|
276 | + data-choose="<?php esc_attr_e('Choose a Background Image'); ?>" |
|
277 | + data-update="<?php esc_attr_e('Set as background'); ?>"><?php _e('Choose Image'); ?></button> |
|
278 | 278 | </p> |
279 | 279 | </form> |
280 | 280 | </td> |
@@ -287,65 +287,65 @@ discard block |
||
287 | 287 | <form method="post"> |
288 | 288 | <table class="form-table"> |
289 | 289 | <tbody> |
290 | -<?php if ( get_background_image() ) : ?> |
|
290 | +<?php if (get_background_image()) : ?> |
|
291 | 291 | <tr> |
292 | -<th scope="row"><?php _e( 'Position' ); ?></th> |
|
293 | -<td><fieldset><legend class="screen-reader-text"><span><?php _e( 'Background Position' ); ?></span></legend> |
|
292 | +<th scope="row"><?php _e('Position'); ?></th> |
|
293 | +<td><fieldset><legend class="screen-reader-text"><span><?php _e('Background Position'); ?></span></legend> |
|
294 | 294 | <label> |
295 | -<input name="background-position-x" type="radio" value="left"<?php checked( 'left', get_theme_mod( 'background_position_x', get_theme_support( 'custom-background', 'default-position-x' ) ) ); ?> /> |
|
295 | +<input name="background-position-x" type="radio" value="left"<?php checked('left', get_theme_mod('background_position_x', get_theme_support('custom-background', 'default-position-x'))); ?> /> |
|
296 | 296 | <?php _e('Left') ?> |
297 | 297 | </label> |
298 | 298 | <label> |
299 | -<input name="background-position-x" type="radio" value="center"<?php checked( 'center', get_theme_mod( 'background_position_x', get_theme_support( 'custom-background', 'default-position-x' ) ) ); ?> /> |
|
299 | +<input name="background-position-x" type="radio" value="center"<?php checked('center', get_theme_mod('background_position_x', get_theme_support('custom-background', 'default-position-x'))); ?> /> |
|
300 | 300 | <?php _e('Center') ?> |
301 | 301 | </label> |
302 | 302 | <label> |
303 | -<input name="background-position-x" type="radio" value="right"<?php checked( 'right', get_theme_mod( 'background_position_x', get_theme_support( 'custom-background', 'default-position-x' ) ) ); ?> /> |
|
303 | +<input name="background-position-x" type="radio" value="right"<?php checked('right', get_theme_mod('background_position_x', get_theme_support('custom-background', 'default-position-x'))); ?> /> |
|
304 | 304 | <?php _e('Right') ?> |
305 | 305 | </label> |
306 | 306 | </fieldset></td> |
307 | 307 | </tr> |
308 | 308 | |
309 | 309 | <tr> |
310 | -<th scope="row"><?php _e( 'Repeat' ); ?></th> |
|
311 | -<td><fieldset><legend class="screen-reader-text"><span><?php _e( 'Background Repeat' ); ?></span></legend> |
|
312 | -<label><input type="radio" name="background-repeat" value="no-repeat"<?php checked( 'no-repeat', get_theme_mod( 'background_repeat', get_theme_support( 'custom-background', 'default-repeat' ) ) ); ?> /> <?php _e('No Repeat'); ?></label> |
|
313 | - <label><input type="radio" name="background-repeat" value="repeat"<?php checked( 'repeat', get_theme_mod( 'background_repeat', get_theme_support( 'custom-background', 'default-repeat' ) ) ); ?> /> <?php _e('Tile'); ?></label> |
|
314 | - <label><input type="radio" name="background-repeat" value="repeat-x"<?php checked( 'repeat-x', get_theme_mod( 'background_repeat', get_theme_support( 'custom-background', 'default-repeat' ) ) ); ?> /> <?php _e('Tile Horizontally'); ?></label> |
|
315 | - <label><input type="radio" name="background-repeat" value="repeat-y"<?php checked( 'repeat-y', get_theme_mod( 'background_repeat', get_theme_support( 'custom-background', 'default-repeat' ) ) ); ?> /> <?php _e('Tile Vertically'); ?></label> |
|
310 | +<th scope="row"><?php _e('Repeat'); ?></th> |
|
311 | +<td><fieldset><legend class="screen-reader-text"><span><?php _e('Background Repeat'); ?></span></legend> |
|
312 | +<label><input type="radio" name="background-repeat" value="no-repeat"<?php checked('no-repeat', get_theme_mod('background_repeat', get_theme_support('custom-background', 'default-repeat'))); ?> /> <?php _e('No Repeat'); ?></label> |
|
313 | + <label><input type="radio" name="background-repeat" value="repeat"<?php checked('repeat', get_theme_mod('background_repeat', get_theme_support('custom-background', 'default-repeat'))); ?> /> <?php _e('Tile'); ?></label> |
|
314 | + <label><input type="radio" name="background-repeat" value="repeat-x"<?php checked('repeat-x', get_theme_mod('background_repeat', get_theme_support('custom-background', 'default-repeat'))); ?> /> <?php _e('Tile Horizontally'); ?></label> |
|
315 | + <label><input type="radio" name="background-repeat" value="repeat-y"<?php checked('repeat-y', get_theme_mod('background_repeat', get_theme_support('custom-background', 'default-repeat'))); ?> /> <?php _e('Tile Vertically'); ?></label> |
|
316 | 316 | </fieldset></td> |
317 | 317 | </tr> |
318 | 318 | |
319 | 319 | <tr> |
320 | -<th scope="row"><?php _ex( 'Attachment', 'Background Attachment' ); ?></th> |
|
321 | -<td><fieldset><legend class="screen-reader-text"><span><?php _e( 'Background Attachment' ); ?></span></legend> |
|
320 | +<th scope="row"><?php _ex('Attachment', 'Background Attachment'); ?></th> |
|
321 | +<td><fieldset><legend class="screen-reader-text"><span><?php _e('Background Attachment'); ?></span></legend> |
|
322 | 322 | <label> |
323 | -<input name="background-attachment" type="radio" value="scroll" <?php checked( 'scroll', get_theme_mod( 'background_attachment', get_theme_support( 'custom-background', 'default-attachment' ) ) ); ?> /> |
|
324 | -<?php _e( 'Scroll' ); ?> |
|
323 | +<input name="background-attachment" type="radio" value="scroll" <?php checked('scroll', get_theme_mod('background_attachment', get_theme_support('custom-background', 'default-attachment'))); ?> /> |
|
324 | +<?php _e('Scroll'); ?> |
|
325 | 325 | </label> |
326 | 326 | <label> |
327 | -<input name="background-attachment" type="radio" value="fixed" <?php checked( 'fixed', get_theme_mod( 'background_attachment', get_theme_support( 'custom-background', 'default-attachment' ) ) ); ?> /> |
|
328 | -<?php _e( 'Fixed' ); ?> |
|
327 | +<input name="background-attachment" type="radio" value="fixed" <?php checked('fixed', get_theme_mod('background_attachment', get_theme_support('custom-background', 'default-attachment'))); ?> /> |
|
328 | +<?php _e('Fixed'); ?> |
|
329 | 329 | </label> |
330 | 330 | </fieldset></td> |
331 | 331 | </tr> |
332 | 332 | <?php endif; // get_background_image() ?> |
333 | 333 | <tr> |
334 | -<th scope="row"><?php _e( 'Background Color' ); ?></th> |
|
335 | -<td><fieldset><legend class="screen-reader-text"><span><?php _e( 'Background Color' ); ?></span></legend> |
|
334 | +<th scope="row"><?php _e('Background Color'); ?></th> |
|
335 | +<td><fieldset><legend class="screen-reader-text"><span><?php _e('Background Color'); ?></span></legend> |
|
336 | 336 | <?php |
337 | 337 | $default_color = ''; |
338 | -if ( current_theme_supports( 'custom-background', 'default-color' ) ) |
|
339 | - $default_color = ' data-default-color="#' . esc_attr( get_theme_support( 'custom-background', 'default-color' ) ) . '"'; |
|
338 | +if (current_theme_supports('custom-background', 'default-color')) |
|
339 | + $default_color = ' data-default-color="#'.esc_attr(get_theme_support('custom-background', 'default-color')).'"'; |
|
340 | 340 | ?> |
341 | -<input type="text" name="background-color" id="background-color" value="#<?php echo esc_attr( get_background_color() ); ?>"<?php echo $default_color ?> /> |
|
341 | +<input type="text" name="background-color" id="background-color" value="#<?php echo esc_attr(get_background_color()); ?>"<?php echo $default_color ?> /> |
|
342 | 342 | </fieldset></td> |
343 | 343 | </tr> |
344 | 344 | </tbody> |
345 | 345 | </table> |
346 | 346 | |
347 | 347 | <?php wp_nonce_field('custom-background'); ?> |
348 | -<?php submit_button( null, 'primary', 'save-background-options' ); ?> |
|
348 | +<?php submit_button(null, 'primary', 'save-background-options'); ?> |
|
349 | 349 | </form> |
350 | 350 | |
351 | 351 | </div> |
@@ -358,21 +358,21 @@ discard block |
||
358 | 358 | * @since 3.0.0 |
359 | 359 | */ |
360 | 360 | public function handle_upload() { |
361 | - if ( empty($_FILES) ) |
|
361 | + if (empty($_FILES)) |
|
362 | 362 | return; |
363 | 363 | |
364 | 364 | check_admin_referer('custom-background-upload', '_wpnonce-custom-background-upload'); |
365 | 365 | $overrides = array('test_form' => false); |
366 | 366 | |
367 | 367 | $uploaded_file = $_FILES['import']; |
368 | - $wp_filetype = wp_check_filetype_and_ext( $uploaded_file['tmp_name'], $uploaded_file['name'] ); |
|
369 | - if ( ! wp_match_mime_types( 'image', $wp_filetype['type'] ) ) |
|
370 | - wp_die( __( 'The uploaded file is not a valid image. Please try again.' ) ); |
|
368 | + $wp_filetype = wp_check_filetype_and_ext($uploaded_file['tmp_name'], $uploaded_file['name']); |
|
369 | + if ( ! wp_match_mime_types('image', $wp_filetype['type'])) |
|
370 | + wp_die(__('The uploaded file is not a valid image. Please try again.')); |
|
371 | 371 | |
372 | 372 | $file = wp_handle_upload($uploaded_file, $overrides); |
373 | 373 | |
374 | - if ( isset($file['error']) ) |
|
375 | - wp_die( $file['error'] ); |
|
374 | + if (isset($file['error'])) |
|
375 | + wp_die($file['error']); |
|
376 | 376 | |
377 | 377 | $url = $file['url']; |
378 | 378 | $type = $file['type']; |
@@ -392,16 +392,16 @@ discard block |
||
392 | 392 | $id = wp_insert_attachment($object, $file); |
393 | 393 | |
394 | 394 | // Add the meta-data |
395 | - wp_update_attachment_metadata( $id, wp_generate_attachment_metadata( $id, $file ) ); |
|
396 | - update_post_meta( $id, '_wp_attachment_is_custom_background', get_option('stylesheet' ) ); |
|
395 | + wp_update_attachment_metadata($id, wp_generate_attachment_metadata($id, $file)); |
|
396 | + update_post_meta($id, '_wp_attachment_is_custom_background', get_option('stylesheet')); |
|
397 | 397 | |
398 | 398 | set_theme_mod('background_image', esc_url_raw($url)); |
399 | 399 | |
400 | - $thumbnail = wp_get_attachment_image_src( $id, 'thumbnail' ); |
|
401 | - set_theme_mod('background_image_thumb', esc_url_raw( $thumbnail[0] ) ); |
|
400 | + $thumbnail = wp_get_attachment_image_src($id, 'thumbnail'); |
|
401 | + set_theme_mod('background_image_thumb', esc_url_raw($thumbnail[0])); |
|
402 | 402 | |
403 | 403 | /** This action is documented in wp-admin/custom-header.php */ |
404 | - do_action( 'wp_create_file_in_uploads', $file, $id ); // For replication |
|
404 | + do_action('wp_create_file_in_uploads', $file, $id); // For replication |
|
405 | 405 | $this->updated = true; |
406 | 406 | } |
407 | 407 | |
@@ -414,18 +414,18 @@ discard block |
||
414 | 414 | * @since 4.1.0 |
415 | 415 | */ |
416 | 416 | public function ajax_background_add() { |
417 | - check_ajax_referer( 'background-add', 'nonce' ); |
|
417 | + check_ajax_referer('background-add', 'nonce'); |
|
418 | 418 | |
419 | - if ( ! current_user_can( 'edit_theme_options' ) ) { |
|
419 | + if ( ! current_user_can('edit_theme_options')) { |
|
420 | 420 | wp_send_json_error(); |
421 | 421 | } |
422 | 422 | |
423 | - $attachment_id = absint( $_POST['attachment_id'] ); |
|
424 | - if ( $attachment_id < 1 ) { |
|
423 | + $attachment_id = absint($_POST['attachment_id']); |
|
424 | + if ($attachment_id < 1) { |
|
425 | 425 | wp_send_json_error(); |
426 | 426 | } |
427 | 427 | |
428 | - update_post_meta( $attachment_id, '_wp_attachment_is_custom_background', get_stylesheet() ); |
|
428 | + update_post_meta($attachment_id, '_wp_attachment_is_custom_background', get_stylesheet()); |
|
429 | 429 | |
430 | 430 | wp_send_json_success(); |
431 | 431 | } |
@@ -438,7 +438,7 @@ discard block |
||
438 | 438 | * @param array $form_fields |
439 | 439 | * @return array $form_fields |
440 | 440 | */ |
441 | - public function attachment_fields_to_edit( $form_fields ) { |
|
441 | + public function attachment_fields_to_edit($form_fields) { |
|
442 | 442 | return $form_fields; |
443 | 443 | } |
444 | 444 | |
@@ -450,7 +450,7 @@ discard block |
||
450 | 450 | * @param array $tabs |
451 | 451 | * @return array $tabs |
452 | 452 | */ |
453 | - public function filter_upload_tabs( $tabs ) { |
|
453 | + public function filter_upload_tabs($tabs) { |
|
454 | 454 | return $tabs; |
455 | 455 | } |
456 | 456 | |
@@ -460,19 +460,19 @@ discard block |
||
460 | 460 | * @deprecated 3.5.0 |
461 | 461 | */ |
462 | 462 | public function wp_set_background_image() { |
463 | - if ( ! current_user_can('edit_theme_options') || ! isset( $_POST['attachment_id'] ) ) exit; |
|
463 | + if ( ! current_user_can('edit_theme_options') || ! isset($_POST['attachment_id'])) exit; |
|
464 | 464 | $attachment_id = absint($_POST['attachment_id']); |
465 | 465 | /** This filter is documented in wp-admin/includes/media.php */ |
466 | - $sizes = array_keys(apply_filters( 'image_size_names_choose', array('thumbnail' => __('Thumbnail'), 'medium' => __('Medium'), 'large' => __('Large'), 'full' => __('Full Size')) )); |
|
466 | + $sizes = array_keys(apply_filters('image_size_names_choose', array('thumbnail' => __('Thumbnail'), 'medium' => __('Medium'), 'large' => __('Large'), 'full' => __('Full Size')))); |
|
467 | 467 | $size = 'thumbnail'; |
468 | - if ( in_array( $_POST['size'], $sizes ) ) |
|
469 | - $size = esc_attr( $_POST['size'] ); |
|
470 | - |
|
471 | - update_post_meta( $attachment_id, '_wp_attachment_is_custom_background', get_option('stylesheet' ) ); |
|
472 | - $url = wp_get_attachment_image_src( $attachment_id, $size ); |
|
473 | - $thumbnail = wp_get_attachment_image_src( $attachment_id, 'thumbnail' ); |
|
474 | - set_theme_mod( 'background_image', esc_url_raw( $url[0] ) ); |
|
475 | - set_theme_mod( 'background_image_thumb', esc_url_raw( $thumbnail[0] ) ); |
|
468 | + if (in_array($_POST['size'], $sizes)) |
|
469 | + $size = esc_attr($_POST['size']); |
|
470 | + |
|
471 | + update_post_meta($attachment_id, '_wp_attachment_is_custom_background', get_option('stylesheet')); |
|
472 | + $url = wp_get_attachment_image_src($attachment_id, $size); |
|
473 | + $thumbnail = wp_get_attachment_image_src($attachment_id, 'thumbnail'); |
|
474 | + set_theme_mod('background_image', esc_url_raw($url[0])); |
|
475 | + set_theme_mod('background_image_thumb', esc_url_raw($thumbnail[0])); |
|
476 | 476 | exit; |
477 | 477 | } |
478 | 478 | } |
@@ -108,8 +108,9 @@ discard block |
||
108 | 108 | * @since 3.0.0 |
109 | 109 | */ |
110 | 110 | public function take_action() { |
111 | - if ( empty($_POST) ) |
|
112 | - return; |
|
111 | + if ( empty($_POST) ) { |
|
112 | + return; |
|
113 | + } |
|
113 | 114 | |
114 | 115 | if ( isset($_POST['reset-background']) ) { |
115 | 116 | check_admin_referer('custom-background-reset', '_wpnonce-custom-background-reset'); |
@@ -131,38 +132,42 @@ discard block |
||
131 | 132 | |
132 | 133 | if ( isset($_POST['background-repeat']) ) { |
133 | 134 | check_admin_referer('custom-background'); |
134 | - if ( in_array($_POST['background-repeat'], array('repeat', 'no-repeat', 'repeat-x', 'repeat-y')) ) |
|
135 | - $repeat = $_POST['background-repeat']; |
|
136 | - else |
|
137 | - $repeat = 'repeat'; |
|
135 | + if ( in_array($_POST['background-repeat'], array('repeat', 'no-repeat', 'repeat-x', 'repeat-y')) ) { |
|
136 | + $repeat = $_POST['background-repeat']; |
|
137 | + } else { |
|
138 | + $repeat = 'repeat'; |
|
139 | + } |
|
138 | 140 | set_theme_mod('background_repeat', $repeat); |
139 | 141 | } |
140 | 142 | |
141 | 143 | if ( isset($_POST['background-position-x']) ) { |
142 | 144 | check_admin_referer('custom-background'); |
143 | - if ( in_array($_POST['background-position-x'], array('center', 'right', 'left')) ) |
|
144 | - $position = $_POST['background-position-x']; |
|
145 | - else |
|
146 | - $position = 'left'; |
|
145 | + if ( in_array($_POST['background-position-x'], array('center', 'right', 'left')) ) { |
|
146 | + $position = $_POST['background-position-x']; |
|
147 | + } else { |
|
148 | + $position = 'left'; |
|
149 | + } |
|
147 | 150 | set_theme_mod('background_position_x', $position); |
148 | 151 | } |
149 | 152 | |
150 | 153 | if ( isset($_POST['background-attachment']) ) { |
151 | 154 | check_admin_referer('custom-background'); |
152 | - if ( in_array($_POST['background-attachment'], array('fixed', 'scroll')) ) |
|
153 | - $attachment = $_POST['background-attachment']; |
|
154 | - else |
|
155 | - $attachment = 'fixed'; |
|
155 | + if ( in_array($_POST['background-attachment'], array('fixed', 'scroll')) ) { |
|
156 | + $attachment = $_POST['background-attachment']; |
|
157 | + } else { |
|
158 | + $attachment = 'fixed'; |
|
159 | + } |
|
156 | 160 | set_theme_mod('background_attachment', $attachment); |
157 | 161 | } |
158 | 162 | |
159 | 163 | if ( isset($_POST['background-color']) ) { |
160 | 164 | check_admin_referer('custom-background'); |
161 | 165 | $color = preg_replace('/[^0-9a-fA-F]/', '', $_POST['background-color']); |
162 | - if ( strlen($color) == 6 || strlen($color) == 3 ) |
|
163 | - set_theme_mod('background_color', $color); |
|
164 | - else |
|
165 | - set_theme_mod('background_color', ''); |
|
166 | + if ( strlen($color) == 6 || strlen($color) == 3 ) { |
|
167 | + set_theme_mod('background_color', $color); |
|
168 | + } else { |
|
169 | + set_theme_mod('background_color', ''); |
|
170 | + } |
|
166 | 171 | } |
167 | 172 | |
168 | 173 | $this->updated = true; |
@@ -209,8 +214,9 @@ discard block |
||
209 | 214 | call_user_func( $this->admin_image_div_callback ); |
210 | 215 | } else { |
211 | 216 | $background_styles = ''; |
212 | - if ( $bgcolor = get_background_color() ) |
|
213 | - $background_styles .= 'background-color: #' . $bgcolor . ';'; |
|
217 | + if ( $bgcolor = get_background_color() ) { |
|
218 | + $background_styles .= 'background-color: #' . $bgcolor . ';'; |
|
219 | + } |
|
214 | 220 | |
215 | 221 | $background_image_thumb = get_background_image(); |
216 | 222 | if ( $background_image_thumb ) { |
@@ -335,8 +341,9 @@ discard block |
||
335 | 341 | <td><fieldset><legend class="screen-reader-text"><span><?php _e( 'Background Color' ); ?></span></legend> |
336 | 342 | <?php |
337 | 343 | $default_color = ''; |
338 | -if ( current_theme_supports( 'custom-background', 'default-color' ) ) |
|
344 | +if ( current_theme_supports( 'custom-background', 'default-color' ) ) { |
|
339 | 345 | $default_color = ' data-default-color="#' . esc_attr( get_theme_support( 'custom-background', 'default-color' ) ) . '"'; |
346 | +} |
|
340 | 347 | ?> |
341 | 348 | <input type="text" name="background-color" id="background-color" value="#<?php echo esc_attr( get_background_color() ); ?>"<?php echo $default_color ?> /> |
342 | 349 | </fieldset></td> |
@@ -358,21 +365,24 @@ discard block |
||
358 | 365 | * @since 3.0.0 |
359 | 366 | */ |
360 | 367 | public function handle_upload() { |
361 | - if ( empty($_FILES) ) |
|
362 | - return; |
|
368 | + if ( empty($_FILES) ) { |
|
369 | + return; |
|
370 | + } |
|
363 | 371 | |
364 | 372 | check_admin_referer('custom-background-upload', '_wpnonce-custom-background-upload'); |
365 | 373 | $overrides = array('test_form' => false); |
366 | 374 | |
367 | 375 | $uploaded_file = $_FILES['import']; |
368 | 376 | $wp_filetype = wp_check_filetype_and_ext( $uploaded_file['tmp_name'], $uploaded_file['name'] ); |
369 | - if ( ! wp_match_mime_types( 'image', $wp_filetype['type'] ) ) |
|
370 | - wp_die( __( 'The uploaded file is not a valid image. Please try again.' ) ); |
|
377 | + if ( ! wp_match_mime_types( 'image', $wp_filetype['type'] ) ) { |
|
378 | + wp_die( __( 'The uploaded file is not a valid image. Please try again.' ) ); |
|
379 | + } |
|
371 | 380 | |
372 | 381 | $file = wp_handle_upload($uploaded_file, $overrides); |
373 | 382 | |
374 | - if ( isset($file['error']) ) |
|
375 | - wp_die( $file['error'] ); |
|
383 | + if ( isset($file['error']) ) { |
|
384 | + wp_die( $file['error'] ); |
|
385 | + } |
|
376 | 386 | |
377 | 387 | $url = $file['url']; |
378 | 388 | $type = $file['type']; |
@@ -460,13 +470,16 @@ discard block |
||
460 | 470 | * @deprecated 3.5.0 |
461 | 471 | */ |
462 | 472 | public function wp_set_background_image() { |
463 | - if ( ! current_user_can('edit_theme_options') || ! isset( $_POST['attachment_id'] ) ) exit; |
|
473 | + if ( ! current_user_can('edit_theme_options') || ! isset( $_POST['attachment_id'] ) ) { |
|
474 | + exit; |
|
475 | + } |
|
464 | 476 | $attachment_id = absint($_POST['attachment_id']); |
465 | 477 | /** This filter is documented in wp-admin/includes/media.php */ |
466 | 478 | $sizes = array_keys(apply_filters( 'image_size_names_choose', array('thumbnail' => __('Thumbnail'), 'medium' => __('Medium'), 'large' => __('Large'), 'full' => __('Full Size')) )); |
467 | 479 | $size = 'thumbnail'; |
468 | - if ( in_array( $_POST['size'], $sizes ) ) |
|
469 | - $size = esc_attr( $_POST['size'] ); |
|
480 | + if ( in_array( $_POST['size'], $sizes ) ) { |
|
481 | + $size = esc_attr( $_POST['size'] ); |
|
482 | + } |
|
470 | 483 | |
471 | 484 | update_post_meta( $attachment_id, '_wp_attachment_is_custom_background', get_option('stylesheet' ) ); |
472 | 485 | $url = wp_get_attachment_image_src( $attachment_id, $size ); |
@@ -24,10 +24,11 @@ discard block |
||
24 | 24 | |
25 | 25 | delete_site_transient('update_core'); |
26 | 26 | |
27 | -if ( isset( $_GET['step'] ) ) |
|
27 | +if ( isset( $_GET['step'] ) ) { |
|
28 | 28 | $step = $_GET['step']; |
29 | -else |
|
29 | +} else { |
|
30 | 30 | $step = 0; |
31 | +} |
|
31 | 32 | |
32 | 33 | // Do it. No output. |
33 | 34 | if ( 'upgrade_db' === $step ) { |
@@ -48,10 +49,11 @@ discard block |
||
48 | 49 | $php_version = phpversion(); |
49 | 50 | $mysql_version = $wpdb->db_version(); |
50 | 51 | $php_compat = version_compare( $php_version, $required_php_version, '>=' ); |
51 | -if ( file_exists( WP_CONTENT_DIR . '/db.php' ) && empty( $wpdb->is_mysql ) ) |
|
52 | +if ( file_exists( WP_CONTENT_DIR . '/db.php' ) && empty( $wpdb->is_mysql ) ) { |
|
52 | 53 | $mysql_compat = true; |
53 | -else |
|
54 | +} else { |
|
54 | 55 | $mysql_compat = version_compare( $mysql_version, $required_mysql_version, '>=' ); |
56 | +} |
|
55 | 57 | |
56 | 58 | @header( 'Content-Type: ' . get_option( 'html_type' ) . '; charset=' . get_option( 'blog_charset' ) ); |
57 | 59 | ?> |
@@ -76,17 +78,20 @@ discard block |
||
76 | 78 | <p class="step"><a class="button button-large" href="<?php echo get_option( 'home' ); ?>/"><?php _e( 'Continue' ); ?></a></p> |
77 | 79 | |
78 | 80 | <?php elseif ( !$php_compat || !$mysql_compat ) : |
79 | - if ( !$mysql_compat && !$php_compat ) |
|
80 | - printf( __('You cannot update because <a href="https://codex.wordpress.org/Version_%1$s">WordPress %1$s</a> requires PHP version %2$s or higher and MySQL version %3$s or higher. You are running PHP version %4$s and MySQL version %5$s.'), $wp_version, $required_php_version, $required_mysql_version, $php_version, $mysql_version ); |
|
81 | - elseif ( !$php_compat ) |
|
82 | - printf( __('You cannot update because <a href="https://codex.wordpress.org/Version_%1$s">WordPress %1$s</a> requires PHP version %2$s or higher. You are running version %3$s.'), $wp_version, $required_php_version, $php_version ); |
|
83 | - elseif ( !$mysql_compat ) |
|
84 | - printf( __('You cannot update because <a href="https://codex.wordpress.org/Version_%1$s">WordPress %1$s</a> requires MySQL version %2$s or higher. You are running version %3$s.'), $wp_version, $required_mysql_version, $mysql_version ); |
|
85 | -?> |
|
86 | -<?php else : |
|
81 | + if ( !$mysql_compat && !$php_compat ) { |
|
82 | + printf( __('You cannot update because <a href="https://codex.wordpress.org/Version_%1$s">WordPress %1$s</a> requires PHP version %2$s or higher and MySQL version %3$s or higher. You are running PHP version %4$s and MySQL version %5$s.'), $wp_version, $required_php_version, $required_mysql_version, $php_version, $mysql_version ); |
|
83 | + } elseif ( !$php_compat ) { |
|
84 | + printf( __('You cannot update because <a href="https://codex.wordpress.org/Version_%1$s">WordPress %1$s</a> requires PHP version %2$s or higher. You are running version %3$s.'), $wp_version, $required_php_version, $php_version ); |
|
85 | + } elseif ( !$mysql_compat ) { |
|
86 | + printf( __('You cannot update because <a href="https://codex.wordpress.org/Version_%1$s">WordPress %1$s</a> requires MySQL version %2$s or higher. You are running version %3$s.'), $wp_version, $required_mysql_version, $mysql_version ); |
|
87 | + } |
|
88 | + ?> |
|
89 | +<?php else { |
|
90 | + : |
|
87 | 91 | switch ( $step ) : |
88 | 92 | case 0: |
89 | 93 | $goback = wp_get_referer(); |
94 | +} |
|
90 | 95 | if ( $goback ) { |
91 | 96 | $goback = esc_url_raw( $goback ); |
92 | 97 | $goback = urlencode( $goback ); |
@@ -12,27 +12,27 @@ discard block |
||
12 | 12 | * @since 1.5.1 |
13 | 13 | * @var bool |
14 | 14 | */ |
15 | -define( 'WP_INSTALLING', true ); |
|
15 | +define('WP_INSTALLING', true); |
|
16 | 16 | |
17 | 17 | /** Load WordPress Bootstrap */ |
18 | -require( dirname( dirname( __FILE__ ) ) . '/wp-load.php' ); |
|
18 | +require(dirname(dirname(__FILE__)).'/wp-load.php'); |
|
19 | 19 | |
20 | 20 | nocache_headers(); |
21 | 21 | |
22 | 22 | timer_start(); |
23 | -require_once( ABSPATH . 'wp-admin/includes/upgrade.php' ); |
|
23 | +require_once(ABSPATH.'wp-admin/includes/upgrade.php'); |
|
24 | 24 | |
25 | 25 | delete_site_transient('update_core'); |
26 | 26 | |
27 | -if ( isset( $_GET['step'] ) ) |
|
27 | +if (isset($_GET['step'])) |
|
28 | 28 | $step = $_GET['step']; |
29 | 29 | else |
30 | 30 | $step = 0; |
31 | 31 | |
32 | 32 | // Do it. No output. |
33 | -if ( 'upgrade_db' === $step ) { |
|
33 | +if ('upgrade_db' === $step) { |
|
34 | 34 | wp_upgrade(); |
35 | - die( '0' ); |
|
35 | + die('0'); |
|
36 | 36 | } |
37 | 37 | |
38 | 38 | /** |
@@ -47,74 +47,74 @@ discard block |
||
47 | 47 | |
48 | 48 | $php_version = phpversion(); |
49 | 49 | $mysql_version = $wpdb->db_version(); |
50 | -$php_compat = version_compare( $php_version, $required_php_version, '>=' ); |
|
51 | -if ( file_exists( WP_CONTENT_DIR . '/db.php' ) && empty( $wpdb->is_mysql ) ) |
|
50 | +$php_compat = version_compare($php_version, $required_php_version, '>='); |
|
51 | +if (file_exists(WP_CONTENT_DIR.'/db.php') && empty($wpdb->is_mysql)) |
|
52 | 52 | $mysql_compat = true; |
53 | 53 | else |
54 | - $mysql_compat = version_compare( $mysql_version, $required_mysql_version, '>=' ); |
|
54 | + $mysql_compat = version_compare($mysql_version, $required_mysql_version, '>='); |
|
55 | 55 | |
56 | -@header( 'Content-Type: ' . get_option( 'html_type' ) . '; charset=' . get_option( 'blog_charset' ) ); |
|
56 | +@header('Content-Type: '.get_option('html_type').'; charset='.get_option('blog_charset')); |
|
57 | 57 | ?> |
58 | 58 | <!DOCTYPE html> |
59 | 59 | <html xmlns="http://www.w3.org/1999/xhtml" <?php language_attributes(); ?>> |
60 | 60 | <head> |
61 | 61 | <meta name="viewport" content="width=device-width" /> |
62 | - <meta http-equiv="Content-Type" content="<?php bloginfo( 'html_type' ); ?>; charset=<?php echo get_option( 'blog_charset' ); ?>" /> |
|
62 | + <meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php echo get_option('blog_charset'); ?>" /> |
|
63 | 63 | <meta name="robots" content="noindex,nofollow" /> |
64 | - <title><?php _e( 'WordPress › Update' ); ?></title> |
|
64 | + <title><?php _e('WordPress › Update'); ?></title> |
|
65 | 65 | <?php |
66 | - wp_admin_css( 'install', true ); |
|
67 | - wp_admin_css( 'ie', true ); |
|
66 | + wp_admin_css('install', true); |
|
67 | + wp_admin_css('ie', true); |
|
68 | 68 | ?> |
69 | 69 | </head> |
70 | 70 | <body class="wp-core-ui"> |
71 | -<p id="logo"><a href="<?php echo esc_url( __( 'https://wordpress.org/' ) ); ?>" tabindex="-1"><?php _e( 'WordPress' ); ?></a></p> |
|
71 | +<p id="logo"><a href="<?php echo esc_url(__('https://wordpress.org/')); ?>" tabindex="-1"><?php _e('WordPress'); ?></a></p> |
|
72 | 72 | |
73 | -<?php if ( get_option( 'db_version' ) == $wp_db_version || !is_blog_installed() ) : ?> |
|
73 | +<?php if (get_option('db_version') == $wp_db_version || ! is_blog_installed()) : ?> |
|
74 | 74 | |
75 | -<h1><?php _e( 'No Update Required' ); ?></h1> |
|
76 | -<p><?php _e( 'Your WordPress database is already up-to-date!' ); ?></p> |
|
77 | -<p class="step"><a class="button button-large" href="<?php echo get_option( 'home' ); ?>/"><?php _e( 'Continue' ); ?></a></p> |
|
75 | +<h1><?php _e('No Update Required'); ?></h1> |
|
76 | +<p><?php _e('Your WordPress database is already up-to-date!'); ?></p> |
|
77 | +<p class="step"><a class="button button-large" href="<?php echo get_option('home'); ?>/"><?php _e('Continue'); ?></a></p> |
|
78 | 78 | |
79 | -<?php elseif ( !$php_compat || !$mysql_compat ) : |
|
80 | - if ( !$mysql_compat && !$php_compat ) |
|
81 | - printf( __('You cannot update because <a href="https://codex.wordpress.org/Version_%1$s">WordPress %1$s</a> requires PHP version %2$s or higher and MySQL version %3$s or higher. You are running PHP version %4$s and MySQL version %5$s.'), $wp_version, $required_php_version, $required_mysql_version, $php_version, $mysql_version ); |
|
82 | - elseif ( !$php_compat ) |
|
83 | - printf( __('You cannot update because <a href="https://codex.wordpress.org/Version_%1$s">WordPress %1$s</a> requires PHP version %2$s or higher. You are running version %3$s.'), $wp_version, $required_php_version, $php_version ); |
|
84 | - elseif ( !$mysql_compat ) |
|
85 | - printf( __('You cannot update because <a href="https://codex.wordpress.org/Version_%1$s">WordPress %1$s</a> requires MySQL version %2$s or higher. You are running version %3$s.'), $wp_version, $required_mysql_version, $mysql_version ); |
|
79 | +<?php elseif ( ! $php_compat || ! $mysql_compat) : |
|
80 | + if ( ! $mysql_compat && ! $php_compat) |
|
81 | + printf(__('You cannot update because <a href="https://codex.wordpress.org/Version_%1$s">WordPress %1$s</a> requires PHP version %2$s or higher and MySQL version %3$s or higher. You are running PHP version %4$s and MySQL version %5$s.'), $wp_version, $required_php_version, $required_mysql_version, $php_version, $mysql_version); |
|
82 | + elseif ( ! $php_compat) |
|
83 | + printf(__('You cannot update because <a href="https://codex.wordpress.org/Version_%1$s">WordPress %1$s</a> requires PHP version %2$s or higher. You are running version %3$s.'), $wp_version, $required_php_version, $php_version); |
|
84 | + elseif ( ! $mysql_compat) |
|
85 | + printf(__('You cannot update because <a href="https://codex.wordpress.org/Version_%1$s">WordPress %1$s</a> requires MySQL version %2$s or higher. You are running version %3$s.'), $wp_version, $required_mysql_version, $mysql_version); |
|
86 | 86 | ?> |
87 | 87 | <?php else : |
88 | -switch ( $step ) : |
|
88 | +switch ($step) : |
|
89 | 89 | case 0: |
90 | 90 | $goback = wp_get_referer(); |
91 | - if ( $goback ) { |
|
92 | - $goback = esc_url_raw( $goback ); |
|
93 | - $goback = urlencode( $goback ); |
|
91 | + if ($goback) { |
|
92 | + $goback = esc_url_raw($goback); |
|
93 | + $goback = urlencode($goback); |
|
94 | 94 | } |
95 | 95 | ?> |
96 | -<h1><?php _e( 'Database Update Required' ); ?></h1> |
|
97 | -<p><?php _e( 'WordPress has been updated! Before we send you on your way, we have to update your database to the newest version.' ); ?></p> |
|
98 | -<p><?php _e( 'The database update process may take a little while, so please be patient.' ); ?></p> |
|
99 | -<p class="step"><a class="button button-large button-primary" href="upgrade.php?step=1&backto=<?php echo $goback; ?>"><?php _e( 'Update WordPress Database' ); ?></a></p> |
|
96 | +<h1><?php _e('Database Update Required'); ?></h1> |
|
97 | +<p><?php _e('WordPress has been updated! Before we send you on your way, we have to update your database to the newest version.'); ?></p> |
|
98 | +<p><?php _e('The database update process may take a little while, so please be patient.'); ?></p> |
|
99 | +<p class="step"><a class="button button-large button-primary" href="upgrade.php?step=1&backto=<?php echo $goback; ?>"><?php _e('Update WordPress Database'); ?></a></p> |
|
100 | 100 | <?php |
101 | 101 | break; |
102 | 102 | case 1: |
103 | 103 | wp_upgrade(); |
104 | 104 | |
105 | - $backto = !empty($_GET['backto']) ? wp_unslash( urldecode( $_GET['backto'] ) ) : __get_option( 'home' ) . '/'; |
|
106 | - $backto = esc_url( $backto ); |
|
107 | - $backto = wp_validate_redirect($backto, __get_option( 'home' ) . '/'); |
|
105 | + $backto = ! empty($_GET['backto']) ? wp_unslash(urldecode($_GET['backto'])) : __get_option('home').'/'; |
|
106 | + $backto = esc_url($backto); |
|
107 | + $backto = wp_validate_redirect($backto, __get_option('home').'/'); |
|
108 | 108 | ?> |
109 | -<h1><?php _e( 'Update Complete' ); ?></h1> |
|
110 | - <p><?php _e( 'Your WordPress database has been successfully updated!' ); ?></p> |
|
111 | - <p class="step"><a class="button button-large" href="<?php echo $backto; ?>"><?php _e( 'Continue' ); ?></a></p> |
|
109 | +<h1><?php _e('Update Complete'); ?></h1> |
|
110 | + <p><?php _e('Your WordPress database has been successfully updated!'); ?></p> |
|
111 | + <p class="step"><a class="button button-large" href="<?php echo $backto; ?>"><?php _e('Continue'); ?></a></p> |
|
112 | 112 | |
113 | 113 | <!-- |
114 | 114 | <pre> |
115 | -<?php printf( __( '%s queries' ), $wpdb->num_queries ); ?> |
|
115 | +<?php printf(__('%s queries'), $wpdb->num_queries); ?> |
|
116 | 116 | |
117 | -<?php printf( __( '%s seconds' ), timer_stop( 0 ) ); ?> |
|
117 | +<?php printf(__('%s seconds'), timer_stop(0)); ?> |
|
118 | 118 | </pre> |
119 | 119 | --> |
120 | 120 |
@@ -11,8 +11,9 @@ discard block |
||
11 | 11 | /** Load WordPress Bootstrap */ |
12 | 12 | require_once( dirname( __FILE__ ) . '/admin.php' ); |
13 | 13 | |
14 | -if ( !current_user_can('import') ) |
|
14 | +if ( !current_user_can('import') ) { |
|
15 | 15 | wp_die(__('You do not have sufficient permissions to import content in this site.')); |
16 | +} |
|
16 | 17 | |
17 | 18 | $title = __('Import'); |
18 | 19 | |
@@ -29,10 +30,11 @@ discard block |
||
29 | 30 | '<p>' . __('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>' |
30 | 31 | ); |
31 | 32 | |
32 | -if ( current_user_can( 'install_plugins' ) ) |
|
33 | +if ( current_user_can( 'install_plugins' ) ) { |
|
33 | 34 | $popular_importers = wp_get_popular_importers(); |
34 | -else |
|
35 | +} else { |
|
35 | 36 | $popular_importers = array(); |
37 | +} |
|
36 | 38 | |
37 | 39 | // Detect and redirect invalid importers like 'movabletype', which is registered as 'mt' |
38 | 40 | if ( ! empty( $_GET['invalid'] ) && isset( $popular_importers[ $_GET['invalid'] ] ) ) { |
@@ -64,10 +66,12 @@ discard block |
||
64 | 66 | |
65 | 67 | // If a popular importer is not registered, create a dummy registration that links to the plugin installer. |
66 | 68 | foreach ( $popular_importers as $pop_importer => $pop_data ) { |
67 | - if ( isset( $importers[ $pop_importer ] ) ) |
|
68 | - continue; |
|
69 | - if ( isset( $importers[ $pop_data['importer-id'] ] ) ) |
|
70 | - continue; |
|
69 | + if ( isset( $importers[ $pop_importer ] ) ) { |
|
70 | + continue; |
|
71 | + } |
|
72 | + if ( isset( $importers[ $pop_data['importer-id'] ] ) ) { |
|
73 | + continue; |
|
74 | + } |
|
71 | 75 | $importers[ $pop_data['importer-id'] ] = array( $pop_data['name'], $pop_data['description'], 'install' => $pop_data['plugin-slug'] ); |
72 | 76 | } |
73 | 77 | |
@@ -119,8 +123,9 @@ discard block |
||
119 | 123 | <?php |
120 | 124 | } |
121 | 125 | |
122 | -if ( current_user_can('install_plugins') ) |
|
126 | +if ( current_user_can('install_plugins') ) { |
|
123 | 127 | echo '<p>' . sprintf( __('If the importer you need is not listed, <a href="%s">search the plugin directory</a> to see if an importer is available.'), esc_url( network_admin_url( 'plugin-install.php?tab=search&type=tag&s=importer' ) ) ) . '</p>'; |
128 | +} |
|
124 | 129 | ?> |
125 | 130 | |
126 | 131 | </div> |
@@ -9,55 +9,55 @@ discard block |
||
9 | 9 | define('WP_LOAD_IMPORTERS', true); |
10 | 10 | |
11 | 11 | /** Load WordPress Bootstrap */ |
12 | -require_once( dirname( __FILE__ ) . '/admin.php' ); |
|
12 | +require_once(dirname(__FILE__).'/admin.php'); |
|
13 | 13 | |
14 | -if ( !current_user_can('import') ) |
|
14 | +if ( ! current_user_can('import')) |
|
15 | 15 | wp_die(__('You do not have sufficient permissions to import content in this site.')); |
16 | 16 | |
17 | 17 | $title = __('Import'); |
18 | 18 | |
19 | -get_current_screen()->add_help_tab( array( |
|
19 | +get_current_screen()->add_help_tab(array( |
|
20 | 20 | 'id' => 'overview', |
21 | 21 | 'title' => __('Overview'), |
22 | - 'content' => '<p>' . __('This screen lists links to plugins to import data from blogging/content management platforms. Choose the platform you want to import from, and click Install Now when you are prompted in the popup window. If your platform is not listed, click the link to search the plugin directory for other importer plugins to see if there is one for your platform.') . '</p>' . |
|
23 | - '<p>' . __('In previous versions of WordPress, all importers were built-in. They have been turned into plugins since most people only use them once or infrequently.') . '</p>', |
|
24 | -) ); |
|
22 | + 'content' => '<p>'.__('This screen lists links to plugins to import data from blogging/content management platforms. Choose the platform you want to import from, and click Install Now when you are prompted in the popup window. If your platform is not listed, click the link to search the plugin directory for other importer plugins to see if there is one for your platform.').'</p>'. |
|
23 | + '<p>'.__('In previous versions of WordPress, all importers were built-in. They have been turned into plugins since most people only use them once or infrequently.').'</p>', |
|
24 | +)); |
|
25 | 25 | |
26 | 26 | get_current_screen()->set_help_sidebar( |
27 | - '<p><strong>' . __('For more information:') . '</strong></p>' . |
|
28 | - '<p>' . __('<a href="https://codex.wordpress.org/Tools_Import_Screen" target="_blank">Documentation on Import</a>') . '</p>' . |
|
29 | - '<p>' . __('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>' |
|
27 | + '<p><strong>'.__('For more information:').'</strong></p>'. |
|
28 | + '<p>'.__('<a href="https://codex.wordpress.org/Tools_Import_Screen" target="_blank">Documentation on Import</a>').'</p>'. |
|
29 | + '<p>'.__('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>').'</p>' |
|
30 | 30 | ); |
31 | 31 | |
32 | -if ( current_user_can( 'install_plugins' ) ) |
|
32 | +if (current_user_can('install_plugins')) |
|
33 | 33 | $popular_importers = wp_get_popular_importers(); |
34 | 34 | else |
35 | 35 | $popular_importers = array(); |
36 | 36 | |
37 | 37 | // Detect and redirect invalid importers like 'movabletype', which is registered as 'mt' |
38 | -if ( ! empty( $_GET['invalid'] ) && isset( $popular_importers[ $_GET['invalid'] ] ) ) { |
|
39 | - $importer_id = $popular_importers[ $_GET['invalid'] ]['importer-id']; |
|
40 | - if ( $importer_id != $_GET['invalid'] ) { // Prevent redirect loops. |
|
41 | - wp_redirect( admin_url( 'admin.php?import=' . $importer_id ) ); |
|
38 | +if ( ! empty($_GET['invalid']) && isset($popular_importers[$_GET['invalid']])) { |
|
39 | + $importer_id = $popular_importers[$_GET['invalid']]['importer-id']; |
|
40 | + if ($importer_id != $_GET['invalid']) { // Prevent redirect loops. |
|
41 | + wp_redirect(admin_url('admin.php?import='.$importer_id)); |
|
42 | 42 | exit; |
43 | 43 | } |
44 | - unset( $importer_id ); |
|
44 | + unset($importer_id); |
|
45 | 45 | } |
46 | 46 | |
47 | 47 | add_thickbox(); |
48 | -wp_enqueue_script( 'plugin-install' ); |
|
48 | +wp_enqueue_script('plugin-install'); |
|
49 | 49 | |
50 | -require_once( ABSPATH . 'wp-admin/admin-header.php' ); |
|
50 | +require_once(ABSPATH.'wp-admin/admin-header.php'); |
|
51 | 51 | $parent_file = 'tools.php'; |
52 | 52 | ?> |
53 | 53 | |
54 | 54 | <div class="wrap"> |
55 | -<h1><?php echo esc_html( $title ); ?></h1> |
|
56 | -<?php if ( ! empty( $_GET['invalid'] ) ) : ?> |
|
55 | +<h1><?php echo esc_html($title); ?></h1> |
|
56 | +<?php if ( ! empty($_GET['invalid'])) : ?> |
|
57 | 57 | <div class="error"> |
58 | - <p><strong><?php _e( 'ERROR:' ); ?></strong> <?php |
|
58 | + <p><strong><?php _e('ERROR:'); ?></strong> <?php |
|
59 | 59 | /* translators: %s: importer slug */ |
60 | - printf( __( 'The %s importer is invalid or is not installed.' ), '<strong>' . esc_html( $_GET['invalid'] ) . '</strong>' ); |
|
60 | + printf(__('The %s importer is invalid or is not installed.'), '<strong>'.esc_html($_GET['invalid']).'</strong>'); |
|
61 | 61 | ?></p> |
62 | 62 | </div> |
63 | 63 | <?php endif; ?> |
@@ -68,48 +68,48 @@ discard block |
||
68 | 68 | $importers = get_importers(); |
69 | 69 | |
70 | 70 | // If a popular importer is not registered, create a dummy registration that links to the plugin installer. |
71 | -foreach ( $popular_importers as $pop_importer => $pop_data ) { |
|
72 | - if ( isset( $importers[ $pop_importer ] ) ) |
|
71 | +foreach ($popular_importers as $pop_importer => $pop_data) { |
|
72 | + if (isset($importers[$pop_importer])) |
|
73 | 73 | continue; |
74 | - if ( isset( $importers[ $pop_data['importer-id'] ] ) ) |
|
74 | + if (isset($importers[$pop_data['importer-id']])) |
|
75 | 75 | continue; |
76 | - $importers[ $pop_data['importer-id'] ] = array( $pop_data['name'], $pop_data['description'], 'install' => $pop_data['plugin-slug'] ); |
|
76 | + $importers[$pop_data['importer-id']] = array($pop_data['name'], $pop_data['description'], 'install' => $pop_data['plugin-slug']); |
|
77 | 77 | } |
78 | 78 | |
79 | -if ( empty( $importers ) ) { |
|
80 | - echo '<p>' . __('No importers are available.') . '</p>'; // TODO: make more helpful |
|
79 | +if (empty($importers)) { |
|
80 | + echo '<p>'.__('No importers are available.').'</p>'; // TODO: make more helpful |
|
81 | 81 | } else { |
82 | - uasort( $importers, '_usort_by_first_member' ); |
|
82 | + uasort($importers, '_usort_by_first_member'); |
|
83 | 83 | ?> |
84 | 84 | <table class="widefat importers striped"> |
85 | 85 | |
86 | 86 | <?php |
87 | 87 | foreach ($importers as $importer_id => $data) { |
88 | 88 | $action = ''; |
89 | - if ( isset( $data['install'] ) ) { |
|
89 | + if (isset($data['install'])) { |
|
90 | 90 | $plugin_slug = $data['install']; |
91 | - if ( file_exists( WP_PLUGIN_DIR . '/' . $plugin_slug ) ) { |
|
91 | + if (file_exists(WP_PLUGIN_DIR.'/'.$plugin_slug)) { |
|
92 | 92 | // Looks like Importer is installed, But not active |
93 | - $plugins = get_plugins( '/' . $plugin_slug ); |
|
94 | - if ( !empty($plugins) ) { |
|
93 | + $plugins = get_plugins('/'.$plugin_slug); |
|
94 | + if ( ! empty($plugins)) { |
|
95 | 95 | $keys = array_keys($plugins); |
96 | - $plugin_file = $plugin_slug . '/' . $keys[0]; |
|
97 | - $action = '<a href="' . esc_url(wp_nonce_url(admin_url('plugins.php?action=activate&plugin=' . $plugin_file . '&from=import'), 'activate-plugin_' . $plugin_file)) . |
|
98 | - '"title="' . esc_attr__('Activate importer') . '"">' . $data[0] . '</a>'; |
|
96 | + $plugin_file = $plugin_slug.'/'.$keys[0]; |
|
97 | + $action = '<a href="'.esc_url(wp_nonce_url(admin_url('plugins.php?action=activate&plugin='.$plugin_file.'&from=import'), 'activate-plugin_'.$plugin_file)). |
|
98 | + '"title="'.esc_attr__('Activate importer').'"">'.$data[0].'</a>'; |
|
99 | 99 | } |
100 | 100 | } |
101 | - if ( empty($action) ) { |
|
102 | - if ( is_main_site() ) { |
|
103 | - $action = '<a href="' . esc_url( network_admin_url( 'plugin-install.php?tab=plugin-information&plugin=' . $plugin_slug . |
|
104 | - '&from=import&TB_iframe=true&width=600&height=550' ) ) . '" class="thickbox open-plugin-details-modal" title="' . |
|
105 | - esc_attr__('Install importer') . '">' . $data[0] . '</a>'; |
|
101 | + if (empty($action)) { |
|
102 | + if (is_main_site()) { |
|
103 | + $action = '<a href="'.esc_url(network_admin_url('plugin-install.php?tab=plugin-information&plugin='.$plugin_slug. |
|
104 | + '&from=import&TB_iframe=true&width=600&height=550')).'" class="thickbox open-plugin-details-modal" title="'. |
|
105 | + esc_attr__('Install importer').'">'.$data[0].'</a>'; |
|
106 | 106 | } else { |
107 | 107 | $action = $data[0]; |
108 | - $data[1] = sprintf( __( 'This importer is not installed. Please install importers from <a href="%s">the main site</a>.' ), get_admin_url( $current_site->blog_id, 'import.php' ) ); |
|
108 | + $data[1] = sprintf(__('This importer is not installed. Please install importers from <a href="%s">the main site</a>.'), get_admin_url($current_site->blog_id, 'import.php')); |
|
109 | 109 | } |
110 | 110 | } |
111 | 111 | } else { |
112 | - $action = "<a href='" . esc_url( "admin.php?import=$importer_id" ) . "' title='" . esc_attr( wptexturize( strip_tags( $data[1] ) ) ) ."'>{$data[0]}</a>"; |
|
112 | + $action = "<a href='".esc_url("admin.php?import=$importer_id")."' title='".esc_attr(wptexturize(strip_tags($data[1])))."'>{$data[0]}</a>"; |
|
113 | 113 | } |
114 | 114 | |
115 | 115 | echo " |
@@ -124,12 +124,12 @@ discard block |
||
124 | 124 | <?php |
125 | 125 | } |
126 | 126 | |
127 | -if ( current_user_can('install_plugins') ) |
|
128 | - echo '<p>' . sprintf( __('If the importer you need is not listed, <a href="%s">search the plugin directory</a> to see if an importer is available.'), esc_url( network_admin_url( 'plugin-install.php?tab=search&type=tag&s=importer' ) ) ) . '</p>'; |
|
127 | +if (current_user_can('install_plugins')) |
|
128 | + echo '<p>'.sprintf(__('If the importer you need is not listed, <a href="%s">search the plugin directory</a> to see if an importer is available.'), esc_url(network_admin_url('plugin-install.php?tab=search&type=tag&s=importer'))).'</p>'; |
|
129 | 129 | ?> |
130 | 130 | |
131 | 131 | </div> |
132 | 132 | |
133 | 133 | <?php |
134 | 134 | |
135 | -include( ABSPATH . 'wp-admin/admin-footer.php' ); |
|
135 | +include(ABSPATH.'wp-admin/admin-footer.php'); |
@@ -81,12 +81,14 @@ discard block |
||
81 | 81 | $class[] = ! empty( $submenu_items ) ? 'wp-has-current-submenu wp-menu-open' : 'current'; |
82 | 82 | } else { |
83 | 83 | $class[] = 'wp-not-current-submenu'; |
84 | - if ( ! empty( $submenu_items ) ) |
|
85 | - $aria_attributes .= 'aria-haspopup="true"'; |
|
84 | + if ( ! empty( $submenu_items ) ) { |
|
85 | + $aria_attributes .= 'aria-haspopup="true"'; |
|
86 | + } |
|
86 | 87 | } |
87 | 88 | |
88 | - if ( ! empty( $item[4] ) ) |
|
89 | - $class[] = esc_attr( $item[4] ); |
|
89 | + if ( ! empty( $item[4] ) ) { |
|
90 | + $class[] = esc_attr( $item[4] ); |
|
91 | + } |
|
90 | 92 | |
91 | 93 | $class = $class ? ' class="' . join( ' ', $class ) . '"' : ''; |
92 | 94 | $id = ! empty( $item[5] ) ? ' id="' . preg_replace( '|[^a-zA-Z0-9_:.]|', '-', $item[5] ) . '"' : ''; |
@@ -134,8 +136,9 @@ discard block |
||
134 | 136 | $submenu_items = array_values( $submenu_items ); // Re-index. |
135 | 137 | $menu_hook = get_plugin_page_hook( $submenu_items[0][2], $item[2] ); |
136 | 138 | $menu_file = $submenu_items[0][2]; |
137 | - if ( false !== ( $pos = strpos( $menu_file, '?' ) ) ) |
|
138 | - $menu_file = substr( $menu_file, 0, $pos ); |
|
139 | + if ( false !== ( $pos = strpos( $menu_file, '?' ) ) ) { |
|
140 | + $menu_file = substr( $menu_file, 0, $pos ); |
|
141 | + } |
|
139 | 142 | if ( ! empty( $menu_hook ) || ( ( 'index.php' != $submenu_items[0][2] ) && file_exists( WP_PLUGIN_DIR . "/$menu_file" ) && ! file_exists( ABSPATH . "/wp-admin/$menu_file" ) ) ) { |
140 | 143 | $admin_is_parent = true; |
141 | 144 | echo "<a href='admin.php?page={$submenu_items[0][2]}'$class $aria_attributes>$arrow<div class='wp-menu-image$img_class'$img_style>$img</div><div class='wp-menu-name'>$title</div></a>"; |
@@ -145,8 +148,9 @@ discard block |
||
145 | 148 | } elseif ( ! empty( $item[2] ) && current_user_can( $item[1] ) ) { |
146 | 149 | $menu_hook = get_plugin_page_hook( $item[2], 'admin.php' ); |
147 | 150 | $menu_file = $item[2]; |
148 | - if ( false !== ( $pos = strpos( $menu_file, '?' ) ) ) |
|
149 | - $menu_file = substr( $menu_file, 0, $pos ); |
|
151 | + if ( false !== ( $pos = strpos( $menu_file, '?' ) ) ) { |
|
152 | + $menu_file = substr( $menu_file, 0, $pos ); |
|
153 | + } |
|
150 | 154 | if ( ! empty( $menu_hook ) || ( ( 'index.php' != $item[2] ) && file_exists( WP_PLUGIN_DIR . "/$menu_file" ) && ! file_exists( ABSPATH . "/wp-admin/$menu_file" ) ) ) { |
151 | 155 | $admin_is_parent = true; |
152 | 156 | echo "\n\t<a href='admin.php?page={$item[2]}'$class $aria_attributes>$arrow<div class='wp-menu-image$img_class'$img_style>$img</div><div class='wp-menu-name'>{$item[0]}</div></a>"; |
@@ -163,8 +167,9 @@ discard block |
||
163 | 167 | |
164 | 168 | // 0 = menu_title, 1 = capability, 2 = menu_slug, 3 = page_title, 4 = classes |
165 | 169 | foreach ( $submenu_items as $sub_key => $sub_item ) { |
166 | - if ( ! current_user_can( $sub_item[1] ) ) |
|
167 | - continue; |
|
170 | + if ( ! current_user_can( $sub_item[1] ) ) { |
|
171 | + continue; |
|
172 | + } |
|
168 | 173 | |
169 | 174 | $class = array(); |
170 | 175 | if ( $first ) { |
@@ -174,15 +179,17 @@ discard block |
||
174 | 179 | |
175 | 180 | $menu_file = $item[2]; |
176 | 181 | |
177 | - if ( false !== ( $pos = strpos( $menu_file, '?' ) ) ) |
|
178 | - $menu_file = substr( $menu_file, 0, $pos ); |
|
182 | + if ( false !== ( $pos = strpos( $menu_file, '?' ) ) ) { |
|
183 | + $menu_file = substr( $menu_file, 0, $pos ); |
|
184 | + } |
|
179 | 185 | |
180 | 186 | // Handle current for post_type=post|page|foo pages, which won't match $self. |
181 | 187 | $self_type = ! empty( $typenow ) ? $self . '?post_type=' . $typenow : 'nothing'; |
182 | 188 | |
183 | 189 | if ( isset( $submenu_file ) ) { |
184 | - if ( $submenu_file == $sub_item[2] ) |
|
185 | - $class[] = 'current'; |
|
190 | + if ( $submenu_file == $sub_item[2] ) { |
|
191 | + $class[] = 'current'; |
|
192 | + } |
|
186 | 193 | // If plugin_page is set the parent must either match the current page or not physically exist. |
187 | 194 | // This allows plugin pages with the same hook to exist under different parents. |
188 | 195 | } elseif ( |
@@ -200,17 +207,19 @@ discard block |
||
200 | 207 | |
201 | 208 | $menu_hook = get_plugin_page_hook($sub_item[2], $item[2]); |
202 | 209 | $sub_file = $sub_item[2]; |
203 | - if ( false !== ( $pos = strpos( $sub_file, '?' ) ) ) |
|
204 | - $sub_file = substr($sub_file, 0, $pos); |
|
210 | + if ( false !== ( $pos = strpos( $sub_file, '?' ) ) ) { |
|
211 | + $sub_file = substr($sub_file, 0, $pos); |
|
212 | + } |
|
205 | 213 | |
206 | 214 | $title = wptexturize($sub_item[0]); |
207 | 215 | |
208 | 216 | if ( ! empty( $menu_hook ) || ( ( 'index.php' != $sub_item[2] ) && file_exists( WP_PLUGIN_DIR . "/$sub_file" ) && ! file_exists( ABSPATH . "/wp-admin/$sub_file" ) ) ) { |
209 | 217 | // If admin.php is the current page or if the parent exists as a file in the plugins or admin dir |
210 | - if ( ( ! $admin_is_parent && file_exists( WP_PLUGIN_DIR . "/$menu_file" ) && ! is_dir( WP_PLUGIN_DIR . "/{$item[2]}" ) ) || file_exists( $menu_file ) ) |
|
211 | - $sub_item_url = add_query_arg( array( 'page' => $sub_item[2] ), $item[2] ); |
|
212 | - else |
|
213 | - $sub_item_url = add_query_arg( array( 'page' => $sub_item[2] ), 'admin.php' ); |
|
218 | + if ( ( ! $admin_is_parent && file_exists( WP_PLUGIN_DIR . "/$menu_file" ) && ! is_dir( WP_PLUGIN_DIR . "/{$item[2]}" ) ) || file_exists( $menu_file ) ) { |
|
219 | + $sub_item_url = add_query_arg( array( 'page' => $sub_item[2] ), $item[2] ); |
|
220 | + } else { |
|
221 | + $sub_item_url = add_query_arg( array( 'page' => $sub_item[2] ), 'admin.php' ); |
|
222 | + } |
|
214 | 223 | |
215 | 224 | $sub_item_url = esc_url( $sub_item_url ); |
216 | 225 | echo "<li$class><a href='$sub_item_url'$class>$title</a></li>"; |
@@ -1,10 +1,10 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * Displays Administration Menu. |
|
4 | - * |
|
5 | - * @package WordPress |
|
6 | - * @subpackage Administration |
|
7 | - */ |
|
3 | + * Displays Administration Menu. |
|
4 | + * |
|
5 | + * @package WordPress |
|
6 | + * @subpackage Administration |
|
7 | + */ |
|
8 | 8 | |
9 | 9 | /** |
10 | 10 | * The current page. |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | * |
36 | 36 | * @param string $parent_file The parent file. |
37 | 37 | */ |
38 | -$parent_file = apply_filters( 'parent_file', $parent_file ); |
|
38 | +$parent_file = apply_filters('parent_file', $parent_file); |
|
39 | 39 | |
40 | 40 | /** |
41 | 41 | * Filter the file of an admin menu sub-menu item. |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | * @param string $submenu_file The submenu file. |
46 | 46 | * @param string $parent_file The submenu item's parent file. |
47 | 47 | */ |
48 | -$submenu_file = apply_filters( 'submenu_file', $submenu_file, $parent_file ); |
|
48 | +$submenu_file = apply_filters('submenu_file', $submenu_file, $parent_file); |
|
49 | 49 | |
50 | 50 | get_admin_page_parent(); |
51 | 51 | |
@@ -65,46 +65,46 @@ discard block |
||
65 | 65 | * @param array $submenu |
66 | 66 | * @param bool $submenu_as_parent |
67 | 67 | */ |
68 | -function _wp_menu_output( $menu, $submenu, $submenu_as_parent = true ) { |
|
68 | +function _wp_menu_output($menu, $submenu, $submenu_as_parent = true) { |
|
69 | 69 | global $self, $parent_file, $submenu_file, $plugin_page, $typenow; |
70 | 70 | |
71 | 71 | $first = true; |
72 | 72 | // 0 = menu_title, 1 = capability, 2 = menu_slug, 3 = page_title, 4 = classes, 5 = hookname, 6 = icon_url |
73 | - foreach ( $menu as $key => $item ) { |
|
73 | + foreach ($menu as $key => $item) { |
|
74 | 74 | $admin_is_parent = false; |
75 | 75 | $class = array(); |
76 | 76 | $aria_attributes = ''; |
77 | 77 | $aria_hidden = ''; |
78 | 78 | $is_separator = false; |
79 | 79 | |
80 | - if ( $first ) { |
|
80 | + if ($first) { |
|
81 | 81 | $class[] = 'wp-first-item'; |
82 | 82 | $first = false; |
83 | 83 | } |
84 | 84 | |
85 | 85 | $submenu_items = array(); |
86 | - if ( ! empty( $submenu[$item[2]] ) ) { |
|
86 | + if ( ! empty($submenu[$item[2]])) { |
|
87 | 87 | $class[] = 'wp-has-submenu'; |
88 | 88 | $submenu_items = $submenu[$item[2]]; |
89 | 89 | } |
90 | 90 | |
91 | - if ( ( $parent_file && $item[2] == $parent_file ) || ( empty($typenow) && $self == $item[2] ) ) { |
|
92 | - $class[] = ! empty( $submenu_items ) ? 'wp-has-current-submenu wp-menu-open' : 'current'; |
|
91 | + if (($parent_file && $item[2] == $parent_file) || (empty($typenow) && $self == $item[2])) { |
|
92 | + $class[] = ! empty($submenu_items) ? 'wp-has-current-submenu wp-menu-open' : 'current'; |
|
93 | 93 | } else { |
94 | 94 | $class[] = 'wp-not-current-submenu'; |
95 | - if ( ! empty( $submenu_items ) ) |
|
95 | + if ( ! empty($submenu_items)) |
|
96 | 96 | $aria_attributes .= 'aria-haspopup="true"'; |
97 | 97 | } |
98 | 98 | |
99 | - if ( ! empty( $item[4] ) ) |
|
100 | - $class[] = esc_attr( $item[4] ); |
|
99 | + if ( ! empty($item[4])) |
|
100 | + $class[] = esc_attr($item[4]); |
|
101 | 101 | |
102 | - $class = $class ? ' class="' . join( ' ', $class ) . '"' : ''; |
|
103 | - $id = ! empty( $item[5] ) ? ' id="' . preg_replace( '|[^a-zA-Z0-9_:.]|', '-', $item[5] ) . '"' : ''; |
|
102 | + $class = $class ? ' class="'.join(' ', $class).'"' : ''; |
|
103 | + $id = ! empty($item[5]) ? ' id="'.preg_replace('|[^a-zA-Z0-9_:.]|', '-', $item[5]).'"' : ''; |
|
104 | 104 | $img = $img_style = ''; |
105 | 105 | $img_class = ' dashicons-before'; |
106 | 106 | |
107 | - if ( false !== strpos( $class, 'wp-menu-separator' ) ) { |
|
107 | + if (false !== strpos($class, 'wp-menu-separator')) { |
|
108 | 108 | $is_separator = true; |
109 | 109 | } |
110 | 110 | |
@@ -114,51 +114,51 @@ discard block |
||
114 | 114 | * with CSS. Dashicons and base64-encoded data:image/svg_xml URIs are also handled |
115 | 115 | * as special cases. |
116 | 116 | */ |
117 | - if ( ! empty( $item[6] ) ) { |
|
118 | - $img = '<img src="' . $item[6] . '" alt="" />'; |
|
117 | + if ( ! empty($item[6])) { |
|
118 | + $img = '<img src="'.$item[6].'" alt="" />'; |
|
119 | 119 | |
120 | - if ( 'none' === $item[6] || 'div' === $item[6] ) { |
|
120 | + if ('none' === $item[6] || 'div' === $item[6]) { |
|
121 | 121 | $img = '<br />'; |
122 | - } elseif ( 0 === strpos( $item[6], 'data:image/svg+xml;base64,' ) ) { |
|
122 | + } elseif (0 === strpos($item[6], 'data:image/svg+xml;base64,')) { |
|
123 | 123 | $img = '<br />'; |
124 | - $img_style = ' style="background-image:url(\'' . esc_attr( $item[6] ) . '\')"'; |
|
124 | + $img_style = ' style="background-image:url(\''.esc_attr($item[6]).'\')"'; |
|
125 | 125 | $img_class = ' svg'; |
126 | - } elseif ( 0 === strpos( $item[6], 'dashicons-' ) ) { |
|
126 | + } elseif (0 === strpos($item[6], 'dashicons-')) { |
|
127 | 127 | $img = '<br />'; |
128 | - $img_class = ' dashicons-before ' . sanitize_html_class( $item[6] ); |
|
128 | + $img_class = ' dashicons-before '.sanitize_html_class($item[6]); |
|
129 | 129 | } |
130 | 130 | } |
131 | 131 | $arrow = '<div class="wp-menu-arrow"><div></div></div>'; |
132 | 132 | |
133 | - $title = wptexturize( $item[0] ); |
|
133 | + $title = wptexturize($item[0]); |
|
134 | 134 | |
135 | 135 | // hide separators from screen readers |
136 | - if ( $is_separator ) { |
|
136 | + if ($is_separator) { |
|
137 | 137 | $aria_hidden = ' aria-hidden="true"'; |
138 | 138 | } |
139 | 139 | |
140 | 140 | echo "\n\t<li$class$id$aria_hidden>"; |
141 | 141 | |
142 | - if ( $is_separator ) { |
|
142 | + if ($is_separator) { |
|
143 | 143 | echo '<div class="separator"></div>'; |
144 | - } elseif ( $submenu_as_parent && ! empty( $submenu_items ) ) { |
|
145 | - $submenu_items = array_values( $submenu_items ); // Re-index. |
|
146 | - $menu_hook = get_plugin_page_hook( $submenu_items[0][2], $item[2] ); |
|
144 | + } elseif ($submenu_as_parent && ! empty($submenu_items)) { |
|
145 | + $submenu_items = array_values($submenu_items); // Re-index. |
|
146 | + $menu_hook = get_plugin_page_hook($submenu_items[0][2], $item[2]); |
|
147 | 147 | $menu_file = $submenu_items[0][2]; |
148 | - if ( false !== ( $pos = strpos( $menu_file, '?' ) ) ) |
|
149 | - $menu_file = substr( $menu_file, 0, $pos ); |
|
150 | - if ( ! empty( $menu_hook ) || ( ( 'index.php' != $submenu_items[0][2] ) && file_exists( WP_PLUGIN_DIR . "/$menu_file" ) && ! file_exists( ABSPATH . "/wp-admin/$menu_file" ) ) ) { |
|
148 | + if (false !== ($pos = strpos($menu_file, '?'))) |
|
149 | + $menu_file = substr($menu_file, 0, $pos); |
|
150 | + if ( ! empty($menu_hook) || (('index.php' != $submenu_items[0][2]) && file_exists(WP_PLUGIN_DIR."/$menu_file") && ! file_exists(ABSPATH."/wp-admin/$menu_file"))) { |
|
151 | 151 | $admin_is_parent = true; |
152 | 152 | echo "<a href='admin.php?page={$submenu_items[0][2]}'$class $aria_attributes>$arrow<div class='wp-menu-image$img_class'$img_style>$img</div><div class='wp-menu-name'>$title</div></a>"; |
153 | 153 | } else { |
154 | 154 | echo "\n\t<a href='{$submenu_items[0][2]}'$class $aria_attributes>$arrow<div class='wp-menu-image$img_class'$img_style>$img</div><div class='wp-menu-name'>$title</div></a>"; |
155 | 155 | } |
156 | - } elseif ( ! empty( $item[2] ) && current_user_can( $item[1] ) ) { |
|
157 | - $menu_hook = get_plugin_page_hook( $item[2], 'admin.php' ); |
|
156 | + } elseif ( ! empty($item[2]) && current_user_can($item[1])) { |
|
157 | + $menu_hook = get_plugin_page_hook($item[2], 'admin.php'); |
|
158 | 158 | $menu_file = $item[2]; |
159 | - if ( false !== ( $pos = strpos( $menu_file, '?' ) ) ) |
|
160 | - $menu_file = substr( $menu_file, 0, $pos ); |
|
161 | - if ( ! empty( $menu_hook ) || ( ( 'index.php' != $item[2] ) && file_exists( WP_PLUGIN_DIR . "/$menu_file" ) && ! file_exists( ABSPATH . "/wp-admin/$menu_file" ) ) ) { |
|
159 | + if (false !== ($pos = strpos($menu_file, '?'))) |
|
160 | + $menu_file = substr($menu_file, 0, $pos); |
|
161 | + if ( ! empty($menu_hook) || (('index.php' != $item[2]) && file_exists(WP_PLUGIN_DIR."/$menu_file") && ! file_exists(ABSPATH."/wp-admin/$menu_file"))) { |
|
162 | 162 | $admin_is_parent = true; |
163 | 163 | echo "\n\t<a href='admin.php?page={$item[2]}'$class $aria_attributes>$arrow<div class='wp-menu-image$img_class'$img_style>$img</div><div class='wp-menu-name'>{$item[0]}</div></a>"; |
164 | 164 | } else { |
@@ -166,64 +166,64 @@ discard block |
||
166 | 166 | } |
167 | 167 | } |
168 | 168 | |
169 | - if ( ! empty( $submenu_items ) ) { |
|
169 | + if ( ! empty($submenu_items)) { |
|
170 | 170 | echo "\n\t<ul class='wp-submenu wp-submenu-wrap'>"; |
171 | 171 | echo "<li class='wp-submenu-head' aria-hidden='true'>{$item[0]}</li>"; |
172 | 172 | |
173 | 173 | $first = true; |
174 | 174 | |
175 | 175 | // 0 = menu_title, 1 = capability, 2 = menu_slug, 3 = page_title, 4 = classes |
176 | - foreach ( $submenu_items as $sub_key => $sub_item ) { |
|
177 | - if ( ! current_user_can( $sub_item[1] ) ) |
|
176 | + foreach ($submenu_items as $sub_key => $sub_item) { |
|
177 | + if ( ! current_user_can($sub_item[1])) |
|
178 | 178 | continue; |
179 | 179 | |
180 | 180 | $class = array(); |
181 | - if ( $first ) { |
|
181 | + if ($first) { |
|
182 | 182 | $class[] = 'wp-first-item'; |
183 | 183 | $first = false; |
184 | 184 | } |
185 | 185 | |
186 | 186 | $menu_file = $item[2]; |
187 | 187 | |
188 | - if ( false !== ( $pos = strpos( $menu_file, '?' ) ) ) |
|
189 | - $menu_file = substr( $menu_file, 0, $pos ); |
|
188 | + if (false !== ($pos = strpos($menu_file, '?'))) |
|
189 | + $menu_file = substr($menu_file, 0, $pos); |
|
190 | 190 | |
191 | 191 | // Handle current for post_type=post|page|foo pages, which won't match $self. |
192 | - $self_type = ! empty( $typenow ) ? $self . '?post_type=' . $typenow : 'nothing'; |
|
192 | + $self_type = ! empty($typenow) ? $self.'?post_type='.$typenow : 'nothing'; |
|
193 | 193 | |
194 | - if ( isset( $submenu_file ) ) { |
|
195 | - if ( $submenu_file == $sub_item[2] ) |
|
194 | + if (isset($submenu_file)) { |
|
195 | + if ($submenu_file == $sub_item[2]) |
|
196 | 196 | $class[] = 'current'; |
197 | 197 | // If plugin_page is set the parent must either match the current page or not physically exist. |
198 | 198 | // This allows plugin pages with the same hook to exist under different parents. |
199 | 199 | } elseif ( |
200 | - ( ! isset( $plugin_page ) && $self == $sub_item[2] ) || |
|
201 | - ( isset( $plugin_page ) && $plugin_page == $sub_item[2] && ( $item[2] == $self_type || $item[2] == $self || file_exists($menu_file) === false ) ) |
|
200 | + ( ! isset($plugin_page) && $self == $sub_item[2]) || |
|
201 | + (isset($plugin_page) && $plugin_page == $sub_item[2] && ($item[2] == $self_type || $item[2] == $self || file_exists($menu_file) === false)) |
|
202 | 202 | ) { |
203 | 203 | $class[] = 'current'; |
204 | 204 | } |
205 | 205 | |
206 | - if ( ! empty( $sub_item[4] ) ) { |
|
207 | - $class[] = esc_attr( $sub_item[4] ); |
|
206 | + if ( ! empty($sub_item[4])) { |
|
207 | + $class[] = esc_attr($sub_item[4]); |
|
208 | 208 | } |
209 | 209 | |
210 | - $class = $class ? ' class="' . join( ' ', $class ) . '"' : ''; |
|
210 | + $class = $class ? ' class="'.join(' ', $class).'"' : ''; |
|
211 | 211 | |
212 | 212 | $menu_hook = get_plugin_page_hook($sub_item[2], $item[2]); |
213 | 213 | $sub_file = $sub_item[2]; |
214 | - if ( false !== ( $pos = strpos( $sub_file, '?' ) ) ) |
|
214 | + if (false !== ($pos = strpos($sub_file, '?'))) |
|
215 | 215 | $sub_file = substr($sub_file, 0, $pos); |
216 | 216 | |
217 | 217 | $title = wptexturize($sub_item[0]); |
218 | 218 | |
219 | - if ( ! empty( $menu_hook ) || ( ( 'index.php' != $sub_item[2] ) && file_exists( WP_PLUGIN_DIR . "/$sub_file" ) && ! file_exists( ABSPATH . "/wp-admin/$sub_file" ) ) ) { |
|
219 | + if ( ! empty($menu_hook) || (('index.php' != $sub_item[2]) && file_exists(WP_PLUGIN_DIR."/$sub_file") && ! file_exists(ABSPATH."/wp-admin/$sub_file"))) { |
|
220 | 220 | // If admin.php is the current page or if the parent exists as a file in the plugins or admin dir |
221 | - if ( ( ! $admin_is_parent && file_exists( WP_PLUGIN_DIR . "/$menu_file" ) && ! is_dir( WP_PLUGIN_DIR . "/{$item[2]}" ) ) || file_exists( $menu_file ) ) |
|
222 | - $sub_item_url = add_query_arg( array( 'page' => $sub_item[2] ), $item[2] ); |
|
221 | + if (( ! $admin_is_parent && file_exists(WP_PLUGIN_DIR."/$menu_file") && ! is_dir(WP_PLUGIN_DIR."/{$item[2]}")) || file_exists($menu_file)) |
|
222 | + $sub_item_url = add_query_arg(array('page' => $sub_item[2]), $item[2]); |
|
223 | 223 | else |
224 | - $sub_item_url = add_query_arg( array( 'page' => $sub_item[2] ), 'admin.php' ); |
|
224 | + $sub_item_url = add_query_arg(array('page' => $sub_item[2]), 'admin.php'); |
|
225 | 225 | |
226 | - $sub_item_url = esc_url( $sub_item_url ); |
|
226 | + $sub_item_url = esc_url($sub_item_url); |
|
227 | 227 | echo "<li$class><a href='$sub_item_url'$class>$title</a></li>"; |
228 | 228 | } else { |
229 | 229 | echo "<li$class><a href='{$sub_item[2]}'$class>$title</a></li>"; |
@@ -235,28 +235,28 @@ discard block |
||
235 | 235 | } |
236 | 236 | |
237 | 237 | echo '<li id="collapse-menu" class="hide-if-no-js"><div id="collapse-button"><div></div></div>'; |
238 | - echo '<span>' . esc_html__( 'Collapse menu' ) . '</span>'; |
|
238 | + echo '<span>'.esc_html__('Collapse menu').'</span>'; |
|
239 | 239 | echo '</li>'; |
240 | 240 | } |
241 | 241 | |
242 | 242 | ?> |
243 | 243 | |
244 | -<div id="adminmenumain" role="navigation" aria-label="<?php esc_attr_e( 'Main menu' ); ?>"> |
|
245 | -<a href="#wpbody-content" class="screen-reader-shortcut"><?php _e( 'Skip to main content' ); ?></a> |
|
246 | -<a href="#wp-toolbar" class="screen-reader-shortcut"><?php _e( 'Skip to toolbar' ); ?></a> |
|
244 | +<div id="adminmenumain" role="navigation" aria-label="<?php esc_attr_e('Main menu'); ?>"> |
|
245 | +<a href="#wpbody-content" class="screen-reader-shortcut"><?php _e('Skip to main content'); ?></a> |
|
246 | +<a href="#wp-toolbar" class="screen-reader-shortcut"><?php _e('Skip to toolbar'); ?></a> |
|
247 | 247 | <div id="adminmenuback"></div> |
248 | 248 | <div id="adminmenuwrap"> |
249 | 249 | <ul id="adminmenu"> |
250 | 250 | |
251 | 251 | <?php |
252 | 252 | |
253 | -_wp_menu_output( $menu, $submenu ); |
|
253 | +_wp_menu_output($menu, $submenu); |
|
254 | 254 | /** |
255 | 255 | * Fires after the admin menu has been output. |
256 | 256 | * |
257 | 257 | * @since 2.5.0 |
258 | 258 | */ |
259 | -do_action( 'adminmenu' ); |
|
259 | +do_action('adminmenu'); |
|
260 | 260 | |
261 | 261 | ?> |
262 | 262 | </ul> |
@@ -7,8 +7,9 @@ discard block |
||
7 | 7 | */ |
8 | 8 | |
9 | 9 | // don't load directly |
10 | -if ( !defined('ABSPATH') ) |
|
10 | +if ( !defined('ABSPATH') ) { |
|
11 | 11 | die('-1'); |
12 | +} |
|
12 | 13 | |
13 | 14 | if ( ! empty($link_id) ) { |
14 | 15 | $heading = sprintf( __( '<a href="%s">Links</a> / Edit Link' ), 'link-manager.php' ); |
@@ -139,9 +140,12 @@ discard block |
||
139 | 140 | <input type="hidden" name="action" value="save" /> |
140 | 141 | <input type="hidden" name="link_id" value="<?php echo (int) $link_id; ?>" /> |
141 | 142 | <input type="hidden" name="cat_id" value="<?php echo (int) $cat_id ?>" /> |
142 | -<?php else: ?> |
|
143 | +<?php else { |
|
144 | + : ?> |
|
143 | 145 | <input type="hidden" name="action" value="add" /> |
144 | -<?php endif; ?> |
|
146 | +<?php endif; |
|
147 | +} |
|
148 | +?> |
|
145 | 149 | |
146 | 150 | </div> |
147 | 151 | </div> |
@@ -1,10 +1,10 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * Edit links form for inclusion in administration panels. |
|
4 | - * |
|
5 | - * @package WordPress |
|
6 | - * @subpackage Administration |
|
7 | - */ |
|
3 | + * Edit links form for inclusion in administration panels. |
|
4 | + * |
|
5 | + * @package WordPress |
|
6 | + * @subpackage Administration |
|
7 | + */ |
|
8 | 8 | |
9 | 9 | // don't load directly |
10 | 10 | if ( !defined('ABSPATH') ) |
@@ -7,22 +7,22 @@ discard block |
||
7 | 7 | */ |
8 | 8 | |
9 | 9 | // don't load directly |
10 | -if ( !defined('ABSPATH') ) |
|
10 | +if ( ! defined('ABSPATH')) |
|
11 | 11 | die('-1'); |
12 | 12 | |
13 | -if ( ! empty($link_id) ) { |
|
14 | - $heading = sprintf( __( '<a href="%s">Links</a> / Edit Link' ), 'link-manager.php' ); |
|
13 | +if ( ! empty($link_id)) { |
|
14 | + $heading = sprintf(__('<a href="%s">Links</a> / Edit Link'), 'link-manager.php'); |
|
15 | 15 | $submit_text = __('Update Link'); |
16 | 16 | $form_name = 'editlink'; |
17 | - $nonce_action = 'update-bookmark_' . $link_id; |
|
17 | + $nonce_action = 'update-bookmark_'.$link_id; |
|
18 | 18 | } else { |
19 | - $heading = sprintf( __( '<a href="%s">Links</a> / Add New Link' ), 'link-manager.php' ); |
|
19 | + $heading = sprintf(__('<a href="%s">Links</a> / Add New Link'), 'link-manager.php'); |
|
20 | 20 | $submit_text = __('Add Link'); |
21 | 21 | $form_name = 'addlink'; |
22 | 22 | $nonce_action = 'add-bookmark'; |
23 | 23 | } |
24 | 24 | |
25 | -require_once( ABSPATH . 'wp-admin/includes/meta-boxes.php' ); |
|
25 | +require_once(ABSPATH.'wp-admin/includes/meta-boxes.php'); |
|
26 | 26 | |
27 | 27 | add_meta_box('linksubmitdiv', __('Save'), 'link_submit_meta_box', null, 'side', 'core'); |
28 | 28 | add_meta_box('linkcategorydiv', __('Categories'), 'link_categories_meta_box', null, 'normal', 'core'); |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | add_meta_box('linkadvanceddiv', __('Advanced'), 'link_advanced_meta_box', null, 'normal', 'core'); |
32 | 32 | |
33 | 33 | /** This action is documented in wp-admin/edit-form-advanced.php */ |
34 | -do_action( 'add_meta_boxes', 'link', $link ); |
|
34 | +do_action('add_meta_boxes', 'link', $link); |
|
35 | 35 | |
36 | 36 | /** |
37 | 37 | * Fires when link-specific meta boxes are added. |
@@ -40,58 +40,58 @@ discard block |
||
40 | 40 | * |
41 | 41 | * @param object $link Link object. |
42 | 42 | */ |
43 | -do_action( 'add_meta_boxes_link', $link ); |
|
43 | +do_action('add_meta_boxes_link', $link); |
|
44 | 44 | |
45 | 45 | /** This action is documented in wp-admin/edit-form-advanced.php */ |
46 | -do_action( 'do_meta_boxes', 'link', 'normal', $link ); |
|
46 | +do_action('do_meta_boxes', 'link', 'normal', $link); |
|
47 | 47 | /** This action is documented in wp-admin/edit-form-advanced.php */ |
48 | -do_action( 'do_meta_boxes', 'link', 'advanced', $link ); |
|
48 | +do_action('do_meta_boxes', 'link', 'advanced', $link); |
|
49 | 49 | /** This action is documented in wp-admin/edit-form-advanced.php */ |
50 | -do_action( 'do_meta_boxes', 'link', 'side', $link ); |
|
50 | +do_action('do_meta_boxes', 'link', 'side', $link); |
|
51 | 51 | |
52 | -add_screen_option('layout_columns', array('max' => 2, 'default' => 2) ); |
|
52 | +add_screen_option('layout_columns', array('max' => 2, 'default' => 2)); |
|
53 | 53 | |
54 | -get_current_screen()->add_help_tab( array( |
|
54 | +get_current_screen()->add_help_tab(array( |
|
55 | 55 | 'id' => 'overview', |
56 | 56 | 'title' => __('Overview'), |
57 | 57 | 'content' => |
58 | - '<p>' . __( 'You can add or edit links on this screen by entering information in each of the boxes. Only the link’s web address and name (the text you want to display on your site as the link) are required fields.' ) . '</p>' . |
|
59 | - '<p>' . __( 'The boxes for link name, web address, and description have fixed positions, while the others may be repositioned using drag and drop. You can also hide boxes you don’t use in the Screen Options tab, or minimize boxes by clicking on the title bar of the box.' ) . '</p>' . |
|
60 | - '<p>' . __( 'XFN stands for <a href="http://gmpg.org/xfn/" target="_blank">XHTML Friends Network</a>, which is optional. WordPress allows the generation of XFN attributes to show how you are related to the authors/owners of the site to which you are linking.' ) . '</p>' |
|
61 | -) ); |
|
58 | + '<p>'.__('You can add or edit links on this screen by entering information in each of the boxes. Only the link’s web address and name (the text you want to display on your site as the link) are required fields.').'</p>'. |
|
59 | + '<p>'.__('The boxes for link name, web address, and description have fixed positions, while the others may be repositioned using drag and drop. You can also hide boxes you don’t use in the Screen Options tab, or minimize boxes by clicking on the title bar of the box.').'</p>'. |
|
60 | + '<p>'.__('XFN stands for <a href="http://gmpg.org/xfn/" target="_blank">XHTML Friends Network</a>, which is optional. WordPress allows the generation of XFN attributes to show how you are related to the authors/owners of the site to which you are linking.').'</p>' |
|
61 | +)); |
|
62 | 62 | |
63 | 63 | get_current_screen()->set_help_sidebar( |
64 | - '<p><strong>' . __( 'For more information:' ) . '</strong></p>' . |
|
65 | - '<p>' . __( '<a href="https://codex.wordpress.org/Links_Add_New_Screen" target="_blank">Documentation on Creating Links</a>' ) . '</p>' . |
|
66 | - '<p>' . __( '<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>' ) . '</p>' |
|
64 | + '<p><strong>'.__('For more information:').'</strong></p>'. |
|
65 | + '<p>'.__('<a href="https://codex.wordpress.org/Links_Add_New_Screen" target="_blank">Documentation on Creating Links</a>').'</p>'. |
|
66 | + '<p>'.__('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>').'</p>' |
|
67 | 67 | ); |
68 | 68 | |
69 | -require_once( ABSPATH . 'wp-admin/admin-header.php' ); |
|
69 | +require_once(ABSPATH.'wp-admin/admin-header.php'); |
|
70 | 70 | ?> |
71 | 71 | |
72 | 72 | <div class="wrap"> |
73 | -<h1><?php echo esc_html( $title ); ?> <a href="link-add.php" class="page-title-action"><?php echo esc_html_x('Add New', 'link'); ?></a></h1> |
|
73 | +<h1><?php echo esc_html($title); ?> <a href="link-add.php" class="page-title-action"><?php echo esc_html_x('Add New', 'link'); ?></a></h1> |
|
74 | 74 | |
75 | -<?php if ( isset( $_GET['added'] ) ) : ?> |
|
75 | +<?php if (isset($_GET['added'])) : ?> |
|
76 | 76 | <div id="message" class="updated notice is-dismissible"><p><?php _e('Link added.'); ?></p></div> |
77 | 77 | <?php endif; ?> |
78 | 78 | |
79 | -<form name="<?php echo esc_attr( $form_name ); ?>" id="<?php echo esc_attr( $form_name ); ?>" method="post" action="link.php"> |
|
79 | +<form name="<?php echo esc_attr($form_name); ?>" id="<?php echo esc_attr($form_name); ?>" method="post" action="link.php"> |
|
80 | 80 | <?php |
81 | -if ( ! empty( $link_added ) ) { |
|
81 | +if ( ! empty($link_added)) { |
|
82 | 82 | echo $link_added; |
83 | 83 | } |
84 | 84 | |
85 | -wp_nonce_field( $nonce_action ); |
|
86 | -wp_nonce_field( 'closedpostboxes', 'closedpostboxesnonce', false ); |
|
87 | -wp_nonce_field( 'meta-box-order', 'meta-box-order-nonce', false ); ?> |
|
85 | +wp_nonce_field($nonce_action); |
|
86 | +wp_nonce_field('closedpostboxes', 'closedpostboxesnonce', false); |
|
87 | +wp_nonce_field('meta-box-order', 'meta-box-order-nonce', false); ?> |
|
88 | 88 | |
89 | 89 | <div id="poststuff"> |
90 | 90 | |
91 | 91 | <div id="post-body" class="metabox-holder columns-<?php echo 1 == get_current_screen()->get_columns() ? '1' : '2'; ?>"> |
92 | 92 | <div id="post-body-content"> |
93 | 93 | <div id="namediv" class="stuffbox"> |
94 | -<h2><label for="link_name"><?php _ex( 'Name', 'link name' ) ?></label></h2> |
|
94 | +<h2><label for="link_name"><?php _ex('Name', 'link name') ?></label></h2> |
|
95 | 95 | <div class="inside"> |
96 | 96 | <input type="text" name="link_name" size="30" maxlength="255" value="<?php echo esc_attr($link->link_name); ?>" id="link_name" /> |
97 | 97 | <p><?php _e('Example: Nifty blogging software'); ?></p> |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | </div> |
100 | 100 | |
101 | 101 | <div id="addressdiv" class="stuffbox"> |
102 | -<h2><label for="link_url"><?php _e( 'Web Address' ) ?></label></h2> |
|
102 | +<h2><label for="link_url"><?php _e('Web Address') ?></label></h2> |
|
103 | 103 | <div class="inside"> |
104 | 104 | <input type="text" name="link_url" size="30" maxlength="255" class="code" value="<?php echo esc_attr($link->link_url); ?>" id="link_url" /> |
105 | 105 | <p><?php _e('Example: <code>http://wordpress.org/</code> — don’t forget the <code>http://</code>'); ?></p> |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | </div> |
108 | 108 | |
109 | 109 | <div id="descriptiondiv" class="stuffbox"> |
110 | -<h2><label for="link_description"><?php _e( 'Description' ) ?></label></h2> |
|
110 | +<h2><label for="link_description"><?php _e('Description') ?></label></h2> |
|
111 | 111 | <div class="inside"> |
112 | 112 | <input type="text" name="link_description" size="30" maxlength="255" value="<?php echo isset($link->link_description) ? esc_attr($link->link_description) : ''; ?>" id="link_description" /> |
113 | 113 | <p><?php _e('This will be shown when someone hovers over the link in the blogroll, or optionally below the link.'); ?></p> |
@@ -119,8 +119,8 @@ discard block |
||
119 | 119 | <?php |
120 | 120 | |
121 | 121 | /** This action is documented in wp-admin/includes/meta-boxes.php */ |
122 | -do_action( 'submitlink_box' ); |
|
123 | -$side_meta_boxes = do_meta_boxes( 'link', 'side', $link ); |
|
122 | +do_action('submitlink_box'); |
|
123 | +$side_meta_boxes = do_meta_boxes('link', 'side', $link); |
|
124 | 124 | |
125 | 125 | ?> |
126 | 126 | </div> |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | </div> |
136 | 136 | <?php |
137 | 137 | |
138 | -if ( $link_id ) : ?> |
|
138 | +if ($link_id) : ?> |
|
139 | 139 | <input type="hidden" name="action" value="save" /> |
140 | 140 | <input type="hidden" name="link_id" value="<?php echo (int) $link_id; ?>" /> |
141 | 141 | <input type="hidden" name="cat_id" value="<?php echo (int) $cat_id ?>" /> |
@@ -6,7 +6,7 @@ discard block |
||
6 | 6 | * @subpackage Administration |
7 | 7 | */ |
8 | 8 | |
9 | -if ( ! defined('ABSPATH') ) |
|
9 | +if ( ! defined('ABSPATH')) |
|
10 | 10 | die(); |
11 | 11 | |
12 | 12 | /** |
@@ -33,28 +33,28 @@ discard block |
||
33 | 33 | function startElement($parser, $tagName, $attrs) { |
34 | 34 | global $names, $urls, $targets, $descriptions, $feeds; |
35 | 35 | |
36 | - if ( 'OUTLINE' === $tagName ) { |
|
36 | + if ('OUTLINE' === $tagName) { |
|
37 | 37 | $name = ''; |
38 | - if ( isset( $attrs['TEXT'] ) ) { |
|
38 | + if (isset($attrs['TEXT'])) { |
|
39 | 39 | $name = $attrs['TEXT']; |
40 | 40 | } |
41 | - if ( isset( $attrs['TITLE'] ) ) { |
|
41 | + if (isset($attrs['TITLE'])) { |
|
42 | 42 | $name = $attrs['TITLE']; |
43 | 43 | } |
44 | 44 | $url = ''; |
45 | - if ( isset( $attrs['URL'] ) ) { |
|
45 | + if (isset($attrs['URL'])) { |
|
46 | 46 | $url = $attrs['URL']; |
47 | 47 | } |
48 | - if ( isset( $attrs['HTMLURL'] ) ) { |
|
48 | + if (isset($attrs['HTMLURL'])) { |
|
49 | 49 | $url = $attrs['HTMLURL']; |
50 | 50 | } |
51 | 51 | |
52 | 52 | // Save the data away. |
53 | 53 | $names[] = $name; |
54 | 54 | $urls[] = $url; |
55 | - $targets[] = isset( $attrs['TARGET'] ) ? $attrs['TARGET'] : ''; |
|
56 | - $feeds[] = isset( $attrs['XMLURL'] ) ? $attrs['XMLURL'] : ''; |
|
57 | - $descriptions[] = isset( $attrs['DESCRIPTION'] ) ? $attrs['DESCRIPTION'] : ''; |
|
55 | + $targets[] = isset($attrs['TARGET']) ? $attrs['TARGET'] : ''; |
|
56 | + $feeds[] = isset($attrs['XMLURL']) ? $attrs['XMLURL'] : ''; |
|
57 | + $descriptions[] = isset($attrs['DESCRIPTION']) ? $attrs['DESCRIPTION'] : ''; |
|
58 | 58 | } // End if outline. |
59 | 59 | } |
60 | 60 | |
@@ -77,12 +77,12 @@ discard block |
||
77 | 77 | // Set the functions to handle opening and closing tags |
78 | 78 | xml_set_element_handler($xml_parser, "startElement", "endElement"); |
79 | 79 | |
80 | -if ( ! xml_parse( $xml_parser, $opml, true ) ) { |
|
80 | +if ( ! xml_parse($xml_parser, $opml, true)) { |
|
81 | 81 | printf( |
82 | 82 | /* translators: 1: error message, 2: line number */ |
83 | - __( 'XML Error: %1$s at line %2$s' ), |
|
84 | - xml_error_string( xml_get_error_code( $xml_parser ) ), |
|
85 | - xml_get_current_line_number( $xml_parser ) |
|
83 | + __('XML Error: %1$s at line %2$s'), |
|
84 | + xml_error_string(xml_get_error_code($xml_parser)), |
|
85 | + xml_get_current_line_number($xml_parser) |
|
86 | 86 | ); |
87 | 87 | } |
88 | 88 |
@@ -6,8 +6,9 @@ |
||
6 | 6 | * @subpackage Administration |
7 | 7 | */ |
8 | 8 | |
9 | -if ( ! defined('ABSPATH') ) |
|
9 | +if ( ! defined('ABSPATH') ) { |
|
10 | 10 | die(); |
11 | +} |
|
11 | 12 | |
12 | 13 | /** |
13 | 14 | * @global string $opml |
@@ -7,43 +7,43 @@ discard block |
||
7 | 7 | * @since 3.0.0 |
8 | 8 | */ |
9 | 9 | |
10 | -require_once( dirname( __FILE__ ) . '/admin.php' ); |
|
10 | +require_once(dirname(__FILE__).'/admin.php'); |
|
11 | 11 | |
12 | -if ( !is_multisite() ) |
|
13 | - wp_die( __( 'Multisite support is not enabled.' ) ); |
|
12 | +if ( ! is_multisite()) |
|
13 | + wp_die(__('Multisite support is not enabled.')); |
|
14 | 14 | |
15 | -if ( ! current_user_can( 'delete_site' ) ) |
|
16 | - wp_die(__( 'You do not have sufficient permissions to delete this site.')); |
|
15 | +if ( ! current_user_can('delete_site')) |
|
16 | + wp_die(__('You do not have sufficient permissions to delete this site.')); |
|
17 | 17 | |
18 | -if ( isset( $_GET['h'] ) && $_GET['h'] != '' && get_option( 'delete_blog_hash' ) != false ) { |
|
19 | - if ( get_option( 'delete_blog_hash' ) == $_GET['h'] ) { |
|
20 | - wpmu_delete_blog( $wpdb->blogid ); |
|
21 | - wp_die( sprintf( __( 'Thank you for using %s, your site has been deleted. Happy trails to you until we meet again.' ), $current_site->site_name ) ); |
|
18 | +if (isset($_GET['h']) && $_GET['h'] != '' && get_option('delete_blog_hash') != false) { |
|
19 | + if (get_option('delete_blog_hash') == $_GET['h']) { |
|
20 | + wpmu_delete_blog($wpdb->blogid); |
|
21 | + wp_die(sprintf(__('Thank you for using %s, your site has been deleted. Happy trails to you until we meet again.'), $current_site->site_name)); |
|
22 | 22 | } else { |
23 | - wp_die( __( "I'm sorry, the link you clicked is stale. Please select another option." ) ); |
|
23 | + wp_die(__("I'm sorry, the link you clicked is stale. Please select another option.")); |
|
24 | 24 | } |
25 | 25 | } |
26 | 26 | |
27 | 27 | $blog = get_blog_details(); |
28 | 28 | $user = wp_get_current_user(); |
29 | 29 | |
30 | -$title = __( 'Delete Site' ); |
|
30 | +$title = __('Delete Site'); |
|
31 | 31 | $parent_file = 'tools.php'; |
32 | -require_once( ABSPATH . 'wp-admin/admin-header.php' ); |
|
32 | +require_once(ABSPATH.'wp-admin/admin-header.php'); |
|
33 | 33 | |
34 | 34 | echo '<div class="wrap">'; |
35 | -echo '<h1>' . esc_html( $title ) . '</h1>'; |
|
35 | +echo '<h1>'.esc_html($title).'</h1>'; |
|
36 | 36 | |
37 | -if ( isset( $_POST['action'] ) && $_POST['action'] == 'deleteblog' && isset( $_POST['confirmdelete'] ) && $_POST['confirmdelete'] == '1' ) { |
|
38 | - check_admin_referer( 'delete-blog' ); |
|
37 | +if (isset($_POST['action']) && $_POST['action'] == 'deleteblog' && isset($_POST['confirmdelete']) && $_POST['confirmdelete'] == '1') { |
|
38 | + check_admin_referer('delete-blog'); |
|
39 | 39 | |
40 | - $hash = wp_generate_password( 20, false ); |
|
41 | - update_option( 'delete_blog_hash', $hash ); |
|
40 | + $hash = wp_generate_password(20, false); |
|
41 | + update_option('delete_blog_hash', $hash); |
|
42 | 42 | |
43 | - $url_delete = esc_url( admin_url( 'ms-delete-site.php?h=' . $hash ) ); |
|
43 | + $url_delete = esc_url(admin_url('ms-delete-site.php?h='.$hash)); |
|
44 | 44 | |
45 | 45 | /* translators: Do not translate USERNAME, URL_DELETE, SITE_NAME: those are placeholders. */ |
46 | - $content = __( "Howdy ###USERNAME###, |
|
46 | + $content = __("Howdy ###USERNAME###, |
|
47 | 47 | |
48 | 48 | You recently clicked the 'Delete Site' link on your site and filled in a |
49 | 49 | form on that page. |
@@ -66,30 +66,30 @@ discard block |
||
66 | 66 | * |
67 | 67 | * @param string $content The email content that will be sent to the user who deleted a site in a Multisite network. |
68 | 68 | */ |
69 | - $content = apply_filters( 'delete_site_email_content', $content ); |
|
69 | + $content = apply_filters('delete_site_email_content', $content); |
|
70 | 70 | |
71 | - $content = str_replace( '###USERNAME###', $user->user_login, $content ); |
|
72 | - $content = str_replace( '###URL_DELETE###', $url_delete, $content ); |
|
73 | - $content = str_replace( '###SITE_NAME###', $current_site->site_name, $content ); |
|
71 | + $content = str_replace('###USERNAME###', $user->user_login, $content); |
|
72 | + $content = str_replace('###URL_DELETE###', $url_delete, $content); |
|
73 | + $content = str_replace('###SITE_NAME###', $current_site->site_name, $content); |
|
74 | 74 | |
75 | - wp_mail( get_option( 'admin_email' ), "[ " . wp_specialchars_decode( get_option( 'blogname' ) ) . " ] ".__( 'Delete My Site' ), $content ); |
|
75 | + wp_mail(get_option('admin_email'), "[ ".wp_specialchars_decode(get_option('blogname'))." ] ".__('Delete My Site'), $content); |
|
76 | 76 | ?> |
77 | 77 | |
78 | - <p><?php _e( 'Thank you. Please check your email for a link to confirm your action. Your site will not be deleted until this link is clicked.' ) ?></p> |
|
78 | + <p><?php _e('Thank you. Please check your email for a link to confirm your action. Your site will not be deleted until this link is clicked.') ?></p> |
|
79 | 79 | |
80 | 80 | <?php } else { |
81 | 81 | ?> |
82 | - <p><?php printf( __( 'If you do not want to use your %s site any more, you can delete it using the form below. When you click <strong>Delete My Site Permanently</strong> you will be sent an email with a link in it. Click on this link to delete your site.'), $current_site->site_name); ?></p> |
|
83 | - <p><?php _e( 'Remember, once deleted your site cannot be restored.' ) ?></p> |
|
82 | + <p><?php printf(__('If you do not want to use your %s site any more, you can delete it using the form below. When you click <strong>Delete My Site Permanently</strong> you will be sent an email with a link in it. Click on this link to delete your site.'), $current_site->site_name); ?></p> |
|
83 | + <p><?php _e('Remember, once deleted your site cannot be restored.') ?></p> |
|
84 | 84 | |
85 | 85 | <form method="post" name="deletedirect"> |
86 | - <?php wp_nonce_field( 'delete-blog' ) ?> |
|
86 | + <?php wp_nonce_field('delete-blog') ?> |
|
87 | 87 | <input type="hidden" name="action" value="deleteblog" /> |
88 | - <p><input id="confirmdelete" type="checkbox" name="confirmdelete" value="1" /> <label for="confirmdelete"><strong><?php printf( __( "I'm sure I want to permanently disable my site, and I am aware I can never get it back or use %s again." ), is_subdomain_install() ? $blog->domain : $blog->domain . $blog->path ); ?></strong></label></p> |
|
89 | - <?php submit_button( __( 'Delete My Site Permanently' ) ); ?> |
|
88 | + <p><input id="confirmdelete" type="checkbox" name="confirmdelete" value="1" /> <label for="confirmdelete"><strong><?php printf(__("I'm sure I want to permanently disable my site, and I am aware I can never get it back or use %s again."), is_subdomain_install() ? $blog->domain : $blog->domain.$blog->path); ?></strong></label></p> |
|
89 | + <?php submit_button(__('Delete My Site Permanently')); ?> |
|
90 | 90 | </form> |
91 | 91 | <?php |
92 | 92 | } |
93 | 93 | echo '</div>'; |
94 | 94 | |
95 | -include( ABSPATH . 'wp-admin/admin-footer.php' ); |
|
95 | +include(ABSPATH.'wp-admin/admin-footer.php'); |
@@ -9,11 +9,13 @@ |
||
9 | 9 | |
10 | 10 | require_once( dirname( __FILE__ ) . '/admin.php' ); |
11 | 11 | |
12 | -if ( !is_multisite() ) |
|
12 | +if ( !is_multisite() ) { |
|
13 | 13 | wp_die( __( 'Multisite support is not enabled.' ) ); |
14 | +} |
|
14 | 15 | |
15 | -if ( ! current_user_can( 'delete_site' ) ) |
|
16 | +if ( ! current_user_can( 'delete_site' ) ) { |
|
16 | 17 | wp_die(__( 'You do not have sufficient permissions to delete this site.')); |
18 | +} |
|
17 | 19 | |
18 | 20 | if ( isset( $_GET['h'] ) && $_GET['h'] != '' && get_option( 'delete_blog_hash' ) != false ) { |
19 | 21 | if ( get_option( 'delete_blog_hash' ) == $_GET['h'] ) { |
@@ -9,7 +9,7 @@ |
||
9 | 9 | * @subpackage Administration |
10 | 10 | */ |
11 | 11 | |
12 | -_deprecated_file( basename(__FILE__), '2.5', 'wp-admin/includes/admin.php' ); |
|
12 | +_deprecated_file(basename(__FILE__), '2.5', 'wp-admin/includes/admin.php'); |
|
13 | 13 | |
14 | 14 | /** WordPress Administration API: Includes all Administration functions. */ |
15 | -require_once(ABSPATH . 'wp-admin/includes/admin.php'); |
|
15 | +require_once(ABSPATH.'wp-admin/includes/admin.php'); |