@@ -224,7 +224,7 @@ discard block |
||
224 | 224 | $right_now = time(); |
225 | 225 | foreach ( timezone_transitions_get($date_time_zone_selected) as $tr) { |
226 | 226 | if ( $tr['ts'] > $right_now ) { |
227 | - $found = true; |
|
227 | + $found = true; |
|
228 | 228 | break; |
229 | 229 | } |
230 | 230 | } |
@@ -254,13 +254,13 @@ discard block |
||
254 | 254 | <fieldset><legend class="screen-reader-text"><span><?php _e('Date Format') ?></span></legend> |
255 | 255 | <?php |
256 | 256 | /** |
257 | - * Filter the default date formats. |
|
258 | - * |
|
259 | - * @since 2.7.0 |
|
260 | - * @since 4.0.0 Added ISO date standard YYYY-MM-DD format. |
|
261 | - * |
|
262 | - * @param array $default_date_formats Array of default date formats. |
|
263 | - */ |
|
257 | + * Filter the default date formats. |
|
258 | + * |
|
259 | + * @since 2.7.0 |
|
260 | + * @since 4.0.0 Added ISO date standard YYYY-MM-DD format. |
|
261 | + * |
|
262 | + * @param array $default_date_formats Array of default date formats. |
|
263 | + */ |
|
264 | 264 | $date_formats = array_unique( apply_filters( 'date_formats', array( __( 'F j, Y' ), 'Y-m-d', 'm/d/Y', 'd/m/Y' ) ) ); |
265 | 265 | |
266 | 266 | $custom = true; |
@@ -288,12 +288,12 @@ discard block |
||
288 | 288 | <fieldset><legend class="screen-reader-text"><span><?php _e('Time Format') ?></span></legend> |
289 | 289 | <?php |
290 | 290 | /** |
291 | - * Filter the default time formats. |
|
292 | - * |
|
293 | - * @since 2.7.0 |
|
294 | - * |
|
295 | - * @param array $default_time_formats Array of default time formats. |
|
296 | - */ |
|
291 | + * Filter the default time formats. |
|
292 | + * |
|
293 | + * @since 2.7.0 |
|
294 | + * |
|
295 | + * @param array $default_time_formats Array of default time formats. |
|
296 | + */ |
|
297 | 297 | $time_formats = array_unique( apply_filters( 'time_formats', array( __( 'g:i a' ), 'g:i A', 'H:i' ) ) ); |
298 | 298 | |
299 | 299 | $custom = true; |
@@ -322,8 +322,8 @@ discard block |
||
322 | 322 | <td><select name="start_of_week" id="start_of_week"> |
323 | 323 | <?php |
324 | 324 | /** |
325 | - * @global WP_Locale $wp_locale |
|
326 | - */ |
|
325 | + * @global WP_Locale $wp_locale |
|
326 | + */ |
|
327 | 327 | global $wp_locale; |
328 | 328 | |
329 | 329 | for ($day_index = 0; $day_index <= 6; $day_index++) : |
@@ -7,13 +7,13 @@ discard block |
||
7 | 7 | */ |
8 | 8 | |
9 | 9 | /** WordPress Administration Bootstrap */ |
10 | -require_once( dirname( __FILE__ ) . '/admin.php' ); |
|
10 | +require_once(dirname(__FILE__).'/admin.php'); |
|
11 | 11 | |
12 | 12 | /** WordPress Translation Install API */ |
13 | -require_once( ABSPATH . 'wp-admin/includes/translation-install.php' ); |
|
13 | +require_once(ABSPATH.'wp-admin/includes/translation-install.php'); |
|
14 | 14 | |
15 | -if ( ! current_user_can( 'manage_options' ) ) |
|
16 | - wp_die( __( 'You do not have sufficient permissions to manage options for this site.' ) ); |
|
15 | +if ( ! current_user_can('manage_options')) |
|
16 | + wp_die(__('You do not have sufficient permissions to manage options for this site.')); |
|
17 | 17 | |
18 | 18 | $title = __('General Settings'); |
19 | 19 | $parent_file = 'options-general.php'; |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | <script type="text/javascript"> |
31 | 31 | jQuery(document).ready(function($){ |
32 | 32 | var $siteName = $( '#wp-admin-bar-site-name' ).children( 'a' ).first(), |
33 | - homeURL = ( <?php echo wp_json_encode( get_home_url() ); ?> || '' ).replace( /^(https?:\/\/)?(www\.)?/, '' ); |
|
33 | + homeURL = ( <?php echo wp_json_encode(get_home_url()); ?> || '' ).replace( /^(https?:\/\/)?(www\.)?/, '' ); |
|
34 | 34 | |
35 | 35 | $( '#blogname' ).on( 'input', function() { |
36 | 36 | var title = $.trim( $( this ).val() ) || homeURL; |
@@ -81,35 +81,35 @@ discard block |
||
81 | 81 | } |
82 | 82 | add_action('admin_head', 'options_general_add_js'); |
83 | 83 | |
84 | -$options_help = '<p>' . __('The fields on this screen determine some of the basics of your site setup.') . '</p>' . |
|
85 | - '<p>' . __('Most themes display the site title at the top of every page, in the title bar of the browser, and as the identifying name for syndicated feeds. The tagline is also displayed by many themes.') . '</p>'; |
|
84 | +$options_help = '<p>'.__('The fields on this screen determine some of the basics of your site setup.').'</p>'. |
|
85 | + '<p>'.__('Most themes display the site title at the top of every page, in the title bar of the browser, and as the identifying name for syndicated feeds. The tagline is also displayed by many themes.').'</p>'; |
|
86 | 86 | |
87 | -if ( ! is_multisite() ) { |
|
88 | - $options_help .= '<p>' . __('The WordPress URL and the Site URL can be the same (example.com) or different; for example, having the WordPress core files (example.com/wordpress) in a subdirectory instead of the root directory.') . '</p>' . |
|
89 | - '<p>' . __('If you want site visitors to be able to register themselves, as opposed to by the site administrator, check the membership box. A default user role can be set for all new users, whether self-registered or registered by the site admin.') . '</p>'; |
|
87 | +if ( ! is_multisite()) { |
|
88 | + $options_help .= '<p>'.__('The WordPress URL and the Site URL can be the same (example.com) or different; for example, having the WordPress core files (example.com/wordpress) in a subdirectory instead of the root directory.').'</p>'. |
|
89 | + '<p>'.__('If you want site visitors to be able to register themselves, as opposed to by the site administrator, check the membership box. A default user role can be set for all new users, whether self-registered or registered by the site admin.').'</p>'; |
|
90 | 90 | } |
91 | 91 | |
92 | -$options_help .= '<p>' . __( 'You can set the language, and the translation files will be automatically downloaded and installed (available if your filesystem is writable).' ) . '</p>' . |
|
93 | - '<p>' . __( 'UTC means Coordinated Universal Time.' ) . '</p>' . |
|
94 | - '<p>' . __( 'You must click the Save Changes button at the bottom of the screen for new settings to take effect.' ) . '</p>'; |
|
92 | +$options_help .= '<p>'.__('You can set the language, and the translation files will be automatically downloaded and installed (available if your filesystem is writable).').'</p>'. |
|
93 | + '<p>'.__('UTC means Coordinated Universal Time.').'</p>'. |
|
94 | + '<p>'.__('You must click the Save Changes button at the bottom of the screen for new settings to take effect.').'</p>'; |
|
95 | 95 | |
96 | -get_current_screen()->add_help_tab( array( |
|
96 | +get_current_screen()->add_help_tab(array( |
|
97 | 97 | 'id' => 'overview', |
98 | 98 | 'title' => __('Overview'), |
99 | 99 | 'content' => $options_help, |
100 | -) ); |
|
100 | +)); |
|
101 | 101 | |
102 | 102 | get_current_screen()->set_help_sidebar( |
103 | - '<p><strong>' . __('For more information:') . '</strong></p>' . |
|
104 | - '<p>' . __('<a href="https://codex.wordpress.org/Settings_General_Screen" target="_blank">Documentation on General Settings</a>') . '</p>' . |
|
105 | - '<p>' . __('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>' |
|
103 | + '<p><strong>'.__('For more information:').'</strong></p>'. |
|
104 | + '<p>'.__('<a href="https://codex.wordpress.org/Settings_General_Screen" target="_blank">Documentation on General Settings</a>').'</p>'. |
|
105 | + '<p>'.__('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>').'</p>' |
|
106 | 106 | ); |
107 | 107 | |
108 | -include( ABSPATH . 'wp-admin/admin-header.php' ); |
|
108 | +include(ABSPATH.'wp-admin/admin-header.php'); |
|
109 | 109 | ?> |
110 | 110 | |
111 | 111 | <div class="wrap"> |
112 | -<h1><?php echo esc_html( $title ); ?></h1> |
|
112 | +<h1><?php echo esc_html($title); ?></h1> |
|
113 | 113 | |
114 | 114 | <form method="post" action="options.php" novalidate="novalidate"> |
115 | 115 | <?php settings_fields('general'); ?> |
@@ -122,22 +122,22 @@ discard block |
||
122 | 122 | <tr> |
123 | 123 | <th scope="row"><label for="blogdescription"><?php _e('Tagline') ?></label></th> |
124 | 124 | <td><input name="blogdescription" type="text" id="blogdescription" aria-describedby="tagline-description" value="<?php form_option('blogdescription'); ?>" class="regular-text" /> |
125 | -<p class="description" id="tagline-description"><?php _e( 'In a few words, explain what this site is about.' ) ?></p></td> |
|
125 | +<p class="description" id="tagline-description"><?php _e('In a few words, explain what this site is about.') ?></p></td> |
|
126 | 126 | </tr> |
127 | -<?php if ( !is_multisite() ) { ?> |
|
127 | +<?php if ( ! is_multisite()) { ?> |
|
128 | 128 | <tr> |
129 | 129 | <th scope="row"><label for="siteurl"><?php _e('WordPress Address (URL)') ?></label></th> |
130 | -<td><input name="siteurl" type="url" id="siteurl" value="<?php form_option( 'siteurl' ); ?>"<?php disabled( defined( 'WP_SITEURL' ) ); ?> class="regular-text code<?php if ( defined( 'WP_SITEURL' ) ) echo ' disabled' ?>" /></td> |
|
130 | +<td><input name="siteurl" type="url" id="siteurl" value="<?php form_option('siteurl'); ?>"<?php disabled(defined('WP_SITEURL')); ?> class="regular-text code<?php if (defined('WP_SITEURL')) echo ' disabled' ?>" /></td> |
|
131 | 131 | </tr> |
132 | 132 | <tr> |
133 | 133 | <th scope="row"><label for="home"><?php _e('Site Address (URL)') ?></label></th> |
134 | -<td><input name="home" type="url" id="home" aria-describedby="home-description" value="<?php form_option( 'home' ); ?>"<?php disabled( defined( 'WP_HOME' ) ); ?> class="regular-text code<?php if ( defined( 'WP_HOME' ) ) echo ' disabled' ?>" /> |
|
135 | -<p class="description" id="home-description"><?php _e( 'Enter the address here if you <a href="https://codex.wordpress.org/Giving_WordPress_Its_Own_Directory">want your site home page to be different from your WordPress installation directory.</a>' ); ?></p></td> |
|
134 | +<td><input name="home" type="url" id="home" aria-describedby="home-description" value="<?php form_option('home'); ?>"<?php disabled(defined('WP_HOME')); ?> class="regular-text code<?php if (defined('WP_HOME')) echo ' disabled' ?>" /> |
|
135 | +<p class="description" id="home-description"><?php _e('Enter the address here if you <a href="https://codex.wordpress.org/Giving_WordPress_Its_Own_Directory">want your site home page to be different from your WordPress installation directory.</a>'); ?></p></td> |
|
136 | 136 | </tr> |
137 | 137 | <tr> |
138 | 138 | <th scope="row"><label for="admin_email"><?php _e('E-mail Address') ?> </label></th> |
139 | -<td><input name="admin_email" type="email" id="admin_email" aria-describedby="admin-email-description" value="<?php form_option( 'admin_email' ); ?>" class="regular-text ltr" /> |
|
140 | -<p class="description" id="admin-email-description"><?php _e( 'This address is used for admin purposes, like new user notification.' ) ?></p></td> |
|
139 | +<td><input name="admin_email" type="email" id="admin_email" aria-describedby="admin-email-description" value="<?php form_option('admin_email'); ?>" class="regular-text ltr" /> |
|
140 | +<p class="description" id="admin-email-description"><?php _e('This address is used for admin purposes, like new user notification.') ?></p></td> |
|
141 | 141 | </tr> |
142 | 142 | <tr> |
143 | 143 | <th scope="row"><?php _e('Membership') ?></th> |
@@ -149,19 +149,19 @@ discard block |
||
149 | 149 | <tr> |
150 | 150 | <th scope="row"><label for="default_role"><?php _e('New User Default Role') ?></label></th> |
151 | 151 | <td> |
152 | -<select name="default_role" id="default_role"><?php wp_dropdown_roles( get_option('default_role') ); ?></select> |
|
152 | +<select name="default_role" id="default_role"><?php wp_dropdown_roles(get_option('default_role')); ?></select> |
|
153 | 153 | </td> |
154 | 154 | </tr> |
155 | 155 | <?php } else { ?> |
156 | 156 | <tr> |
157 | 157 | <th scope="row"><label for="new_admin_email"><?php _e('E-mail Address') ?> </label></th> |
158 | -<td><input name="new_admin_email" type="email" id="new_admin_email" aria-describedby="new-admin-email-description" value="<?php form_option( 'admin_email' ); ?>" class="regular-text ltr" /> |
|
159 | -<p class="description" id="new-admin-email-description"><?php _e( 'This address is used for admin purposes. If you change this we will send you an e-mail at your new address to confirm it. <strong>The new address will not become active until confirmed.</strong>' ) ?></p> |
|
158 | +<td><input name="new_admin_email" type="email" id="new_admin_email" aria-describedby="new-admin-email-description" value="<?php form_option('admin_email'); ?>" class="regular-text ltr" /> |
|
159 | +<p class="description" id="new-admin-email-description"><?php _e('This address is used for admin purposes. If you change this we will send you an e-mail at your new address to confirm it. <strong>The new address will not become active until confirmed.</strong>') ?></p> |
|
160 | 160 | <?php |
161 | -$new_admin_email = get_option( 'new_admin_email' ); |
|
162 | -if ( $new_admin_email && $new_admin_email != get_option('admin_email') ) : ?> |
|
161 | +$new_admin_email = get_option('new_admin_email'); |
|
162 | +if ($new_admin_email && $new_admin_email != get_option('admin_email')) : ?> |
|
163 | 163 | <div class="updated inline"> |
164 | -<p><?php printf( __('There is a pending change of the admin e-mail to <code>%1$s</code>. <a href="%2$s">Cancel</a>'), esc_html( $new_admin_email ), esc_url( admin_url( 'options.php?dismiss=new_admin_email' ) ) ); ?></p> |
|
164 | +<p><?php printf(__('There is a pending change of the admin e-mail to <code>%1$s</code>. <a href="%2$s">Cancel</a>'), esc_html($new_admin_email), esc_url(admin_url('options.php?dismiss=new_admin_email'))); ?></p> |
|
165 | 165 | </div> |
166 | 166 | <?php endif; ?> |
167 | 167 | </td> |
@@ -175,17 +175,17 @@ discard block |
||
175 | 175 | $check_zone_info = true; |
176 | 176 | |
177 | 177 | // Remove old Etc mappings. Fallback to gmt_offset. |
178 | -if ( false !== strpos($tzstring,'Etc/GMT') ) |
|
178 | +if (false !== strpos($tzstring, 'Etc/GMT')) |
|
179 | 179 | $tzstring = ''; |
180 | 180 | |
181 | -if ( empty($tzstring) ) { // Create a UTC+- zone if no timezone string exists |
|
181 | +if (empty($tzstring)) { // Create a UTC+- zone if no timezone string exists |
|
182 | 182 | $check_zone_info = false; |
183 | - if ( 0 == $current_offset ) |
|
183 | + if (0 == $current_offset) |
|
184 | 184 | $tzstring = 'UTC+0'; |
185 | 185 | elseif ($current_offset < 0) |
186 | - $tzstring = 'UTC' . $current_offset; |
|
186 | + $tzstring = 'UTC'.$current_offset; |
|
187 | 187 | else |
188 | - $tzstring = 'UTC+' . $current_offset; |
|
188 | + $tzstring = 'UTC+'.$current_offset; |
|
189 | 189 | } |
190 | 190 | |
191 | 191 | ?> |
@@ -197,10 +197,10 @@ discard block |
||
197 | 197 | </select> |
198 | 198 | |
199 | 199 | <span id="utc-time"><?php printf(__('<abbr title="Coordinated Universal Time">UTC</abbr> time is <code>%s</code>'), date_i18n($timezone_format, false, 'gmt')); ?></span> |
200 | -<?php if ( get_option('timezone_string') || !empty($current_offset) ) : ?> |
|
200 | +<?php if (get_option('timezone_string') || ! empty($current_offset)) : ?> |
|
201 | 201 | <span id="local-time"><?php printf(__('Local time is <code>%1$s</code>'), date_i18n($timezone_format)); ?></span> |
202 | 202 | <?php endif; ?> |
203 | -<p class="description" id="timezone-description"><?php _e( 'Choose a city in the same timezone as you.' ); ?></p> |
|
203 | +<p class="description" id="timezone-description"><?php _e('Choose a city in the same timezone as you.'); ?></p> |
|
204 | 204 | <?php if ($check_zone_info && $tzstring) : ?> |
205 | 205 | <br /> |
206 | 206 | <span> |
@@ -208,7 +208,7 @@ discard block |
||
208 | 208 | // Set TZ so localtime works. |
209 | 209 | date_default_timezone_set($tzstring); |
210 | 210 | $now = localtime(time(), true); |
211 | - if ( $now['tm_isdst'] ) |
|
211 | + if ($now['tm_isdst']) |
|
212 | 212 | _e('This timezone is currently in daylight saving time.'); |
213 | 213 | else |
214 | 214 | _e('This timezone is currently in standard time.'); |
@@ -217,25 +217,24 @@ discard block |
||
217 | 217 | <?php |
218 | 218 | $allowed_zones = timezone_identifiers_list(); |
219 | 219 | |
220 | - if ( in_array( $tzstring, $allowed_zones) ) { |
|
220 | + if (in_array($tzstring, $allowed_zones)) { |
|
221 | 221 | $found = false; |
222 | 222 | $date_time_zone_selected = new DateTimeZone($tzstring); |
223 | 223 | $tz_offset = timezone_offset_get($date_time_zone_selected, date_create()); |
224 | 224 | $right_now = time(); |
225 | - foreach ( timezone_transitions_get($date_time_zone_selected) as $tr) { |
|
226 | - if ( $tr['ts'] > $right_now ) { |
|
225 | + foreach (timezone_transitions_get($date_time_zone_selected) as $tr) { |
|
226 | + if ($tr['ts'] > $right_now) { |
|
227 | 227 | $found = true; |
228 | 228 | break; |
229 | 229 | } |
230 | 230 | } |
231 | 231 | |
232 | - if ( $found ) { |
|
232 | + if ($found) { |
|
233 | 233 | echo ' '; |
234 | 234 | $message = $tr['isdst'] ? |
235 | - __('Daylight saving time begins on: <code>%s</code>.') : |
|
236 | - __('Standard time begins on: <code>%s</code>.'); |
|
235 | + __('Daylight saving time begins on: <code>%s</code>.') : __('Standard time begins on: <code>%s</code>.'); |
|
237 | 236 | // Add the difference between the current offset and the new offset to ts to get the correct transition time from date_i18n(). |
238 | - printf( $message, date_i18n(get_option('date_format') . ' ' . get_option('time_format'), $tr['ts'] + ($tz_offset - $tr['offset']) ) ); |
|
237 | + printf($message, date_i18n(get_option('date_format').' '.get_option('time_format'), $tr['ts'] + ($tz_offset - $tr['offset']))); |
|
239 | 238 | } else { |
240 | 239 | _e('This timezone does not observe daylight saving time.'); |
241 | 240 | } |
@@ -261,23 +260,23 @@ discard block |
||
261 | 260 | * |
262 | 261 | * @param array $default_date_formats Array of default date formats. |
263 | 262 | */ |
264 | - $date_formats = array_unique( apply_filters( 'date_formats', array( __( 'F j, Y' ), 'Y-m-d', 'm/d/Y', 'd/m/Y' ) ) ); |
|
263 | + $date_formats = array_unique(apply_filters('date_formats', array(__('F j, Y'), 'Y-m-d', 'm/d/Y', 'd/m/Y'))); |
|
265 | 264 | |
266 | 265 | $custom = true; |
267 | 266 | |
268 | - foreach ( $date_formats as $format ) { |
|
269 | - echo "\t<label title='" . esc_attr($format) . "'><input type='radio' name='date_format' value='" . esc_attr($format) . "'"; |
|
270 | - if ( get_option('date_format') === $format ) { // checked() uses "==" rather than "===" |
|
267 | + foreach ($date_formats as $format) { |
|
268 | + echo "\t<label title='".esc_attr($format)."'><input type='radio' name='date_format' value='".esc_attr($format)."'"; |
|
269 | + if (get_option('date_format') === $format) { // checked() uses "==" rather than "===" |
|
271 | 270 | echo " checked='checked'"; |
272 | 271 | $custom = false; |
273 | 272 | } |
274 | - echo ' /> ' . date_i18n( $format ) . "</label><br />\n"; |
|
273 | + echo ' /> '.date_i18n($format)."</label><br />\n"; |
|
275 | 274 | } |
276 | 275 | |
277 | 276 | echo ' <label><input type="radio" name="date_format" id="date_format_custom_radio" value="\c\u\s\t\o\m"'; |
278 | - checked( $custom ); |
|
279 | - echo '/> ' . __( 'Custom:' ) . '<span class="screen-reader-text"> ' . __( 'enter a custom date format in the following field' ) . "</span></label>\n"; |
|
280 | - echo '<label for="date_format_custom" class="screen-reader-text">' . __( 'Custom date format:' ) . '</label><input type="text" name="date_format_custom" id="date_format_custom" value="' . esc_attr( get_option('date_format') ) . '" class="small-text" /> <span class="screen-reader-text">' . __( 'example:' ) . ' </span><span class="example"> ' . date_i18n( get_option('date_format') ) . "</span> <span class='spinner'></span>\n"; |
|
277 | + checked($custom); |
|
278 | + echo '/> '.__('Custom:').'<span class="screen-reader-text"> '.__('enter a custom date format in the following field')."</span></label>\n"; |
|
279 | + echo '<label for="date_format_custom" class="screen-reader-text">'.__('Custom date format:').'</label><input type="text" name="date_format_custom" id="date_format_custom" value="'.esc_attr(get_option('date_format')).'" class="small-text" /> <span class="screen-reader-text">'.__('example:').' </span><span class="example"> '.date_i18n(get_option('date_format'))."</span> <span class='spinner'></span>\n"; |
|
281 | 280 | ?> |
282 | 281 | </fieldset> |
283 | 282 | </td> |
@@ -294,25 +293,25 @@ discard block |
||
294 | 293 | * |
295 | 294 | * @param array $default_time_formats Array of default time formats. |
296 | 295 | */ |
297 | - $time_formats = array_unique( apply_filters( 'time_formats', array( __( 'g:i a' ), 'g:i A', 'H:i' ) ) ); |
|
296 | + $time_formats = array_unique(apply_filters('time_formats', array(__('g:i a'), 'g:i A', 'H:i'))); |
|
298 | 297 | |
299 | 298 | $custom = true; |
300 | 299 | |
301 | - foreach ( $time_formats as $format ) { |
|
302 | - echo "\t<label title='" . esc_attr($format) . "'><input type='radio' name='time_format' value='" . esc_attr($format) . "'"; |
|
303 | - if ( get_option('time_format') === $format ) { // checked() uses "==" rather than "===" |
|
300 | + foreach ($time_formats as $format) { |
|
301 | + echo "\t<label title='".esc_attr($format)."'><input type='radio' name='time_format' value='".esc_attr($format)."'"; |
|
302 | + if (get_option('time_format') === $format) { // checked() uses "==" rather than "===" |
|
304 | 303 | echo " checked='checked'"; |
305 | 304 | $custom = false; |
306 | 305 | } |
307 | - echo ' /> ' . date_i18n( $format ) . "</label><br />\n"; |
|
306 | + echo ' /> '.date_i18n($format)."</label><br />\n"; |
|
308 | 307 | } |
309 | 308 | |
310 | 309 | echo ' <label><input type="radio" name="time_format" id="time_format_custom_radio" value="\c\u\s\t\o\m"'; |
311 | - checked( $custom ); |
|
312 | - echo '/> ' . __( 'Custom:' ) . '<span class="screen-reader-text"> ' . __( 'enter a custom time format in the following field' ) . "</span></label>\n"; |
|
313 | - echo '<label for="time_format_custom" class="screen-reader-text">' . __( 'Custom time format:' ) . '</label><input type="text" name="time_format_custom" id="time_format_custom" value="' . esc_attr( get_option('time_format') ) . '" class="small-text" /> <span class="screen-reader-text">' . __( 'example:' ) . ' </span><span class="example"> ' . date_i18n( get_option('time_format') ) . "</span> <span class='spinner'></span>\n"; |
|
310 | + checked($custom); |
|
311 | + echo '/> '.__('Custom:').'<span class="screen-reader-text"> '.__('enter a custom time format in the following field')."</span></label>\n"; |
|
312 | + echo '<label for="time_format_custom" class="screen-reader-text">'.__('Custom time format:').'</label><input type="text" name="time_format_custom" id="time_format_custom" value="'.esc_attr(get_option('time_format')).'" class="small-text" /> <span class="screen-reader-text">'.__('example:').' </span><span class="example"> '.date_i18n(get_option('time_format'))."</span> <span class='spinner'></span>\n"; |
|
314 | 313 | |
315 | - echo "\t<p>" . __('<a href="https://codex.wordpress.org/Formatting_Date_and_Time">Documentation on date and time formatting</a>.') . "</p>\n"; |
|
314 | + echo "\t<p>".__('<a href="https://codex.wordpress.org/Formatting_Date_and_Time">Documentation on date and time formatting</a>.')."</p>\n"; |
|
316 | 315 | ?> |
317 | 316 | </fieldset> |
318 | 317 | </td> |
@@ -328,7 +327,7 @@ discard block |
||
328 | 327 | |
329 | 328 | for ($day_index = 0; $day_index <= 6; $day_index++) : |
330 | 329 | $selected = (get_option('start_of_week') == $day_index) ? 'selected="selected"' : ''; |
331 | - echo "\n\t<option value='" . esc_attr($day_index) . "' $selected>" . $wp_locale->get_weekday($day_index) . '</option>'; |
|
330 | + echo "\n\t<option value='".esc_attr($day_index)."' $selected>".$wp_locale->get_weekday($day_index).'</option>'; |
|
332 | 331 | endfor; |
333 | 332 | ?> |
334 | 333 | </select></td> |
@@ -338,39 +337,39 @@ discard block |
||
338 | 337 | <?php |
339 | 338 | $languages = get_available_languages(); |
340 | 339 | $translations = wp_get_available_translations(); |
341 | -if ( ! is_multisite() && defined( 'WPLANG' ) && '' !== WPLANG && 'en_US' !== WPLANG && ! in_array( WPLANG, $languages ) ) { |
|
340 | +if ( ! is_multisite() && defined('WPLANG') && '' !== WPLANG && 'en_US' !== WPLANG && ! in_array(WPLANG, $languages)) { |
|
342 | 341 | $languages[] = WPLANG; |
343 | 342 | } |
344 | -if ( ! empty( $languages ) || ! empty( $translations ) ) { |
|
343 | +if ( ! empty($languages) || ! empty($translations)) { |
|
345 | 344 | ?> |
346 | 345 | <tr> |
347 | - <th width="33%" scope="row"><label for="WPLANG"><?php _e( 'Site Language' ); ?></label></th> |
|
346 | + <th width="33%" scope="row"><label for="WPLANG"><?php _e('Site Language'); ?></label></th> |
|
348 | 347 | <td> |
349 | 348 | <?php |
350 | 349 | $locale = get_locale(); |
351 | - if ( ! in_array( $locale, $languages ) ) { |
|
350 | + if ( ! in_array($locale, $languages)) { |
|
352 | 351 | $locale = ''; |
353 | 352 | } |
354 | 353 | |
355 | - wp_dropdown_languages( array( |
|
354 | + wp_dropdown_languages(array( |
|
356 | 355 | 'name' => 'WPLANG', |
357 | 356 | 'id' => 'WPLANG', |
358 | 357 | 'selected' => $locale, |
359 | 358 | 'languages' => $languages, |
360 | 359 | 'translations' => $translations, |
361 | - 'show_available_translations' => ( ! is_multisite() || is_super_admin() ) && wp_can_install_language_pack(), |
|
362 | - ) ); |
|
360 | + 'show_available_translations' => ( ! is_multisite() || is_super_admin()) && wp_can_install_language_pack(), |
|
361 | + )); |
|
363 | 362 | |
364 | 363 | // Add note about deprecated WPLANG constant. |
365 | - if ( defined( 'WPLANG' ) && ( '' !== WPLANG ) && $locale !== WPLANG ) { |
|
366 | - if ( is_super_admin() ) { |
|
364 | + if (defined('WPLANG') && ('' !== WPLANG) && $locale !== WPLANG) { |
|
365 | + if (is_super_admin()) { |
|
367 | 366 | ?> |
368 | 367 | <p class="description"> |
369 | - <strong><?php _e( 'Note:' ); ?></strong> <?php printf( __( 'The %s constant in your %s file is no longer needed.' ), '<code>WPLANG</code>', '<code>wp-config.php</code>' ); ?> |
|
368 | + <strong><?php _e('Note:'); ?></strong> <?php printf(__('The %s constant in your %s file is no longer needed.'), '<code>WPLANG</code>', '<code>wp-config.php</code>'); ?> |
|
370 | 369 | </p> |
371 | 370 | <?php |
372 | 371 | } |
373 | - _deprecated_argument( 'define()', '4.0', sprintf( __( 'The %s constant in your %s file is no longer needed.' ), 'WPLANG', 'wp-config.php' ) ); |
|
372 | + _deprecated_argument('define()', '4.0', sprintf(__('The %s constant in your %s file is no longer needed.'), 'WPLANG', 'wp-config.php')); |
|
374 | 373 | } |
375 | 374 | ?> |
376 | 375 | </td> |
@@ -387,4 +386,4 @@ discard block |
||
387 | 386 | |
388 | 387 | </div> |
389 | 388 | |
390 | -<?php include( ABSPATH . 'wp-admin/admin-footer.php' ); ?> |
|
389 | +<?php include(ABSPATH.'wp-admin/admin-footer.php'); ?> |
@@ -12,8 +12,9 @@ discard block |
||
12 | 12 | /** WordPress Translation Install API */ |
13 | 13 | require_once( ABSPATH . 'wp-admin/includes/translation-install.php' ); |
14 | 14 | |
15 | -if ( ! current_user_can( 'manage_options' ) ) |
|
15 | +if ( ! current_user_can( 'manage_options' ) ) { |
|
16 | 16 | wp_die( __( 'You do not have sufficient permissions to manage options for this site.' ) ); |
17 | +} |
|
17 | 18 | |
18 | 19 | $title = __('General Settings'); |
19 | 20 | $parent_file = 'options-general.php'; |
@@ -127,12 +128,18 @@ discard block |
||
127 | 128 | <?php if ( !is_multisite() ) { ?> |
128 | 129 | <tr> |
129 | 130 | <th scope="row"><label for="siteurl"><?php _e('WordPress Address (URL)') ?></label></th> |
130 | -<td><input name="siteurl" type="url" id="siteurl" value="<?php form_option( 'siteurl' ); ?>"<?php disabled( defined( 'WP_SITEURL' ) ); ?> class="regular-text code<?php if ( defined( 'WP_SITEURL' ) ) echo ' disabled' ?>" /></td> |
|
131 | +<td><input name="siteurl" type="url" id="siteurl" value="<?php form_option( 'siteurl' ); ?>"<?php disabled( defined( 'WP_SITEURL' ) ); ?> class="regular-text code<?php if ( defined( 'WP_SITEURL' ) ) { |
|
132 | + echo ' disabled' ?>" /></td> |
|
131 | 133 | </tr> |
132 | 134 | <tr> |
133 | 135 | <th scope="row"><label for="home"><?php _e('Site Address (URL)') ?></label></th> |
134 | -<td><input name="home" type="url" id="home" aria-describedby="home-description" value="<?php form_option( 'home' ); ?>"<?php disabled( defined( 'WP_HOME' ) ); ?> class="regular-text code<?php if ( defined( 'WP_HOME' ) ) echo ' disabled' ?>" /> |
|
135 | -<p class="description" id="home-description"><?php _e( 'Enter the address here if you <a href="https://codex.wordpress.org/Giving_WordPress_Its_Own_Directory">want your site home page to be different from your WordPress installation directory.</a>' ); ?></p></td> |
|
136 | +<td><input name="home" type="url" id="home" aria-describedby="home-description" value="<?php form_option( 'home' ); |
|
137 | +} |
|
138 | +?>"<?php disabled( defined( 'WP_HOME' ) ); ?> class="regular-text code<?php if ( defined( 'WP_HOME' ) ) { |
|
139 | + echo ' disabled' ?>" /> |
|
140 | +<p class="description" id="home-description"><?php _e( 'Enter the address here if you <a href="https://codex.wordpress.org/Giving_WordPress_Its_Own_Directory">want your site home page to be different from your WordPress installation directory.</a>' ); |
|
141 | +} |
|
142 | +?></p></td> |
|
136 | 143 | </tr> |
137 | 144 | <tr> |
138 | 145 | <th scope="row"><label for="admin_email"><?php _e('E-mail Address') ?> </label></th> |
@@ -175,18 +182,20 @@ discard block |
||
175 | 182 | $check_zone_info = true; |
176 | 183 | |
177 | 184 | // Remove old Etc mappings. Fallback to gmt_offset. |
178 | -if ( false !== strpos($tzstring,'Etc/GMT') ) |
|
185 | +if ( false !== strpos($tzstring,'Etc/GMT') ) { |
|
179 | 186 | $tzstring = ''; |
187 | +} |
|
180 | 188 | |
181 | 189 | if ( empty($tzstring) ) { // Create a UTC+- zone if no timezone string exists |
182 | 190 | $check_zone_info = false; |
183 | - if ( 0 == $current_offset ) |
|
184 | - $tzstring = 'UTC+0'; |
|
185 | - elseif ($current_offset < 0) |
|
186 | - $tzstring = 'UTC' . $current_offset; |
|
187 | - else |
|
188 | - $tzstring = 'UTC+' . $current_offset; |
|
189 | -} |
|
191 | + if ( 0 == $current_offset ) { |
|
192 | + $tzstring = 'UTC+0'; |
|
193 | + } elseif ($current_offset < 0) { |
|
194 | + $tzstring = 'UTC' . $current_offset; |
|
195 | + } else { |
|
196 | + $tzstring = 'UTC+' . $current_offset; |
|
197 | + } |
|
198 | + } |
|
190 | 199 | |
191 | 200 | ?> |
192 | 201 | <th scope="row"><label for="timezone_string"><?php _e('Timezone') ?></label></th> |
@@ -208,10 +217,11 @@ discard block |
||
208 | 217 | // Set TZ so localtime works. |
209 | 218 | date_default_timezone_set($tzstring); |
210 | 219 | $now = localtime(time(), true); |
211 | - if ( $now['tm_isdst'] ) |
|
212 | - _e('This timezone is currently in daylight saving time.'); |
|
213 | - else |
|
214 | - _e('This timezone is currently in standard time.'); |
|
220 | + if ( $now['tm_isdst'] ) { |
|
221 | + _e('This timezone is currently in daylight saving time.'); |
|
222 | + } else { |
|
223 | + _e('This timezone is currently in standard time.'); |
|
224 | + } |
|
215 | 225 | ?> |
216 | 226 | <br /> |
217 | 227 | <?php |
@@ -1,10 +1,10 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * Database Repair and Optimization Script. |
|
4 | - * |
|
5 | - * @package WordPress |
|
6 | - * @subpackage Database |
|
7 | - */ |
|
3 | + * Database Repair and Optimization Script. |
|
4 | + * |
|
5 | + * @package WordPress |
|
6 | + * @subpackage Database |
|
7 | + */ |
|
8 | 8 | define('WP_REPAIRING', true); |
9 | 9 | |
10 | 10 | require_once( dirname( dirname( dirname( __FILE__ ) ) ) . '/wp-load.php' ); |
@@ -7,36 +7,36 @@ discard block |
||
7 | 7 | */ |
8 | 8 | define('WP_REPAIRING', true); |
9 | 9 | |
10 | -require_once( dirname( dirname( dirname( __FILE__ ) ) ) . '/wp-load.php' ); |
|
10 | +require_once(dirname(dirname(dirname(__FILE__))).'/wp-load.php'); |
|
11 | 11 | |
12 | -header( 'Content-Type: text/html; charset=utf-8' ); |
|
12 | +header('Content-Type: text/html; charset=utf-8'); |
|
13 | 13 | ?> |
14 | 14 | <!DOCTYPE html> |
15 | 15 | <html xmlns="http://www.w3.org/1999/xhtml" <?php language_attributes(); ?>> |
16 | 16 | <head> |
17 | 17 | <meta name="viewport" content="width=device-width" /> |
18 | 18 | <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> |
19 | - <title><?php _e( 'WordPress › Database Repair' ); ?></title> |
|
19 | + <title><?php _e('WordPress › Database Repair'); ?></title> |
|
20 | 20 | <?php |
21 | - wp_admin_css( 'install', true ); |
|
21 | + wp_admin_css('install', true); |
|
22 | 22 | ?> |
23 | 23 | </head> |
24 | 24 | <body class="wp-core-ui"> |
25 | -<h1 id="logo"><a href="<?php echo esc_url( __( 'https://wordpress.org/' ) ); ?>" tabindex="-1"><?php _e( 'WordPress' ); ?></a></h1> |
|
25 | +<h1 id="logo"><a href="<?php echo esc_url(__('https://wordpress.org/')); ?>" tabindex="-1"><?php _e('WordPress'); ?></a></h1> |
|
26 | 26 | |
27 | 27 | <?php |
28 | 28 | |
29 | -if ( ! defined( 'WP_ALLOW_REPAIR' ) ) { |
|
30 | - echo '<p>' . __( 'To allow use of this page to automatically repair database problems, please add the following line to your <code>wp-config.php</code> file. Once this line is added to your config, reload this page.' ) . "</p><p><code>define('WP_ALLOW_REPAIR', true);</code></p>"; |
|
29 | +if ( ! defined('WP_ALLOW_REPAIR')) { |
|
30 | + echo '<p>'.__('To allow use of this page to automatically repair database problems, please add the following line to your <code>wp-config.php</code> file. Once this line is added to your config, reload this page.')."</p><p><code>define('WP_ALLOW_REPAIR', true);</code></p>"; |
|
31 | 31 | |
32 | 32 | $default_key = 'put your unique phrase here'; |
33 | 33 | $missing_key = false; |
34 | 34 | $duplicated_keys = array(); |
35 | 35 | |
36 | - foreach ( array( 'AUTH_KEY', 'SECURE_AUTH_KEY', 'LOGGED_IN_KEY', 'NONCE_KEY', 'AUTH_SALT', 'SECURE_AUTH_SALT', 'LOGGED_IN_SALT', 'NONCE_SALT' ) as $key ) { |
|
37 | - if ( defined( $key ) ) { |
|
36 | + foreach (array('AUTH_KEY', 'SECURE_AUTH_KEY', 'LOGGED_IN_KEY', 'NONCE_KEY', 'AUTH_SALT', 'SECURE_AUTH_SALT', 'LOGGED_IN_SALT', 'NONCE_SALT') as $key) { |
|
37 | + if (defined($key)) { |
|
38 | 38 | // Check for unique values of each key. |
39 | - $duplicated_keys[ constant( $key ) ] = isset( $duplicated_keys[ constant( $key ) ] ); |
|
39 | + $duplicated_keys[constant($key)] = isset($duplicated_keys[constant($key)]); |
|
40 | 40 | } else { |
41 | 41 | // If a constant is not defined, it's missing. |
42 | 42 | $missing_key = true; |
@@ -44,19 +44,19 @@ discard block |
||
44 | 44 | } |
45 | 45 | |
46 | 46 | // If at least one key uses the default value, consider it duplicated. |
47 | - if ( isset( $duplicated_keys[ $default_key ] ) ) { |
|
48 | - $duplicated_keys[ $default_key ] = true; |
|
47 | + if (isset($duplicated_keys[$default_key])) { |
|
48 | + $duplicated_keys[$default_key] = true; |
|
49 | 49 | } |
50 | 50 | |
51 | 51 | // Weed out all unique, non-default values. |
52 | - $duplicated_keys = array_filter( $duplicated_keys ); |
|
52 | + $duplicated_keys = array_filter($duplicated_keys); |
|
53 | 53 | |
54 | - if ( $duplicated_keys || $missing_key ) { |
|
54 | + if ($duplicated_keys || $missing_key) { |
|
55 | 55 | // Translators: 1: wp-config.php; 2: Secret key service URL. |
56 | - echo '<p>' . sprintf( __( 'While you are editing your %1$s file, take a moment to make sure you have all 8 keys and that they are unique. You can generate these using the <a href="%2$s">WordPress.org secret key service</a>.' ), '<code>wp-config.php</code>', 'https://api.wordpress.org/secret-key/1.1/salt/' ) . '</p>'; |
|
56 | + echo '<p>'.sprintf(__('While you are editing your %1$s file, take a moment to make sure you have all 8 keys and that they are unique. You can generate these using the <a href="%2$s">WordPress.org secret key service</a>.'), '<code>wp-config.php</code>', 'https://api.wordpress.org/secret-key/1.1/salt/').'</p>'; |
|
57 | 57 | } |
58 | 58 | |
59 | -} elseif ( isset( $_GET['repair'] ) ) { |
|
59 | +} elseif (isset($_GET['repair'])) { |
|
60 | 60 | $optimize = 2 == $_GET['repair']; |
61 | 61 | $okay = true; |
62 | 62 | $problems = array(); |
@@ -64,9 +64,9 @@ discard block |
||
64 | 64 | $tables = $wpdb->tables(); |
65 | 65 | |
66 | 66 | // Sitecategories may not exist if global terms are disabled. |
67 | - $query = $wpdb->prepare( "SHOW TABLES LIKE %s", $wpdb->esc_like( $wpdb->sitecategories ) ); |
|
68 | - if ( is_multisite() && ! $wpdb->get_var( $query ) ) { |
|
69 | - unset( $tables['sitecategories'] ); |
|
67 | + $query = $wpdb->prepare("SHOW TABLES LIKE %s", $wpdb->esc_like($wpdb->sitecategories)); |
|
68 | + if (is_multisite() && ! $wpdb->get_var($query)) { |
|
69 | + unset($tables['sitecategories']); |
|
70 | 70 | } |
71 | 71 | |
72 | 72 | /** |
@@ -76,75 +76,75 @@ discard block |
||
76 | 76 | * |
77 | 77 | * @param array $tables Array of prefixed table names to be repaired. |
78 | 78 | */ |
79 | - $tables = array_merge( $tables, (array) apply_filters( 'tables_to_repair', array() ) ); |
|
79 | + $tables = array_merge($tables, (array) apply_filters('tables_to_repair', array())); |
|
80 | 80 | |
81 | 81 | // Loop over the tables, checking and repairing as needed. |
82 | - foreach ( $tables as $table ) { |
|
83 | - $check = $wpdb->get_row( "CHECK TABLE $table" ); |
|
82 | + foreach ($tables as $table) { |
|
83 | + $check = $wpdb->get_row("CHECK TABLE $table"); |
|
84 | 84 | |
85 | 85 | echo '<p>'; |
86 | - if ( 'OK' == $check->Msg_text ) { |
|
86 | + if ('OK' == $check->Msg_text) { |
|
87 | 87 | /* translators: %s: table name */ |
88 | - printf( __( 'The %s table is okay.' ), "<code>$table</code>" ); |
|
88 | + printf(__('The %s table is okay.'), "<code>$table</code>"); |
|
89 | 89 | } else { |
90 | 90 | /* translators: 1: table name, 2: error message, */ |
91 | - printf( __( 'The %1$s table is not okay. It is reporting the following error: %2$s. WordPress will attempt to repair this table…' ) , "<code>$table</code>", "<code>$check->Msg_text</code>" ); |
|
91 | + printf(__('The %1$s table is not okay. It is reporting the following error: %2$s. WordPress will attempt to repair this table…'), "<code>$table</code>", "<code>$check->Msg_text</code>"); |
|
92 | 92 | |
93 | - $repair = $wpdb->get_row( "REPAIR TABLE $table" ); |
|
93 | + $repair = $wpdb->get_row("REPAIR TABLE $table"); |
|
94 | 94 | |
95 | 95 | echo '<br /> '; |
96 | - if ( 'OK' == $check->Msg_text ) { |
|
96 | + if ('OK' == $check->Msg_text) { |
|
97 | 97 | /* translators: %s: table name */ |
98 | - printf( __( 'Successfully repaired the %s table.' ), "<code>$table</code>" ); |
|
98 | + printf(__('Successfully repaired the %s table.'), "<code>$table</code>"); |
|
99 | 99 | } else { |
100 | 100 | /* translators: 1: table name, 2: error message, */ |
101 | - echo sprintf( __( 'Failed to repair the %1$s table. Error: %2$s' ), "<code>$table</code>", "<code>$check->Msg_text</code>" ) . '<br />'; |
|
101 | + echo sprintf(__('Failed to repair the %1$s table. Error: %2$s'), "<code>$table</code>", "<code>$check->Msg_text</code>").'<br />'; |
|
102 | 102 | $problems[$table] = $check->Msg_text; |
103 | 103 | $okay = false; |
104 | 104 | } |
105 | 105 | } |
106 | 106 | |
107 | - if ( $okay && $optimize ) { |
|
108 | - $check = $wpdb->get_row( "ANALYZE TABLE $table" ); |
|
107 | + if ($okay && $optimize) { |
|
108 | + $check = $wpdb->get_row("ANALYZE TABLE $table"); |
|
109 | 109 | |
110 | 110 | echo '<br /> '; |
111 | - if ( 'Table is already up to date' == $check->Msg_text ) { |
|
111 | + if ('Table is already up to date' == $check->Msg_text) { |
|
112 | 112 | /* translators: %s: table name */ |
113 | - printf( __( 'The %s table is already optimized.' ), "<code>$table</code>" ); |
|
113 | + printf(__('The %s table is already optimized.'), "<code>$table</code>"); |
|
114 | 114 | } else { |
115 | - $check = $wpdb->get_row( "OPTIMIZE TABLE $table" ); |
|
115 | + $check = $wpdb->get_row("OPTIMIZE TABLE $table"); |
|
116 | 116 | |
117 | 117 | echo '<br /> '; |
118 | - if ( 'OK' == $check->Msg_text || 'Table is already up to date' == $check->Msg_text ) { |
|
118 | + if ('OK' == $check->Msg_text || 'Table is already up to date' == $check->Msg_text) { |
|
119 | 119 | /* translators: %s: table name */ |
120 | - printf( __( 'Successfully optimized the %s table.' ), "<code>$table</code>" ); |
|
120 | + printf(__('Successfully optimized the %s table.'), "<code>$table</code>"); |
|
121 | 121 | } else { |
122 | 122 | /* translators: 1: table name, 2: error message, */ |
123 | - printf( __( 'Failed to optimize the %1$s table. Error: %2$s' ), "<code>$table</code>", "<code>$check->Msg_text</code>" ); |
|
123 | + printf(__('Failed to optimize the %1$s table. Error: %2$s'), "<code>$table</code>", "<code>$check->Msg_text</code>"); |
|
124 | 124 | } |
125 | 125 | } |
126 | 126 | } |
127 | 127 | echo '</p>'; |
128 | 128 | } |
129 | 129 | |
130 | - if ( $problems ) { |
|
131 | - printf( '<p>' . __('Some database problems could not be repaired. Please copy-and-paste the following list of errors to the <a href="%s">WordPress support forums</a> to get additional assistance.') . '</p>', __( 'https://wordpress.org/support/forum/how-to-and-troubleshooting' ) ); |
|
130 | + if ($problems) { |
|
131 | + printf('<p>'.__('Some database problems could not be repaired. Please copy-and-paste the following list of errors to the <a href="%s">WordPress support forums</a> to get additional assistance.').'</p>', __('https://wordpress.org/support/forum/how-to-and-troubleshooting')); |
|
132 | 132 | $problem_output = ''; |
133 | - foreach ( $problems as $table => $problem ) |
|
133 | + foreach ($problems as $table => $problem) |
|
134 | 134 | $problem_output .= "$table: $problem\n"; |
135 | - echo '<p><textarea name="errors" id="errors" rows="20" cols="60">' . esc_textarea( $problem_output ) . '</textarea></p>'; |
|
135 | + echo '<p><textarea name="errors" id="errors" rows="20" cols="60">'.esc_textarea($problem_output).'</textarea></p>'; |
|
136 | 136 | } else { |
137 | - echo '<p>' . __( 'Repairs complete. Please remove the following line from wp-config.php to prevent this page from being used by unauthorized users.' ) . "</p><p><code>define('WP_ALLOW_REPAIR', true);</code></p>"; |
|
137 | + echo '<p>'.__('Repairs complete. Please remove the following line from wp-config.php to prevent this page from being used by unauthorized users.')."</p><p><code>define('WP_ALLOW_REPAIR', true);</code></p>"; |
|
138 | 138 | } |
139 | 139 | } else { |
140 | - if ( isset( $_GET['referrer'] ) && 'is_blog_installed' == $_GET['referrer'] ) |
|
141 | - echo '<p>' . __( 'One or more database tables are unavailable. To allow WordPress to attempt to repair these tables, press the “Repair Database” button. Repairing can take a while, so please be patient.' ) . '</p>'; |
|
140 | + if (isset($_GET['referrer']) && 'is_blog_installed' == $_GET['referrer']) |
|
141 | + echo '<p>'.__('One or more database tables are unavailable. To allow WordPress to attempt to repair these tables, press the “Repair Database” button. Repairing can take a while, so please be patient.').'</p>'; |
|
142 | 142 | else |
143 | - echo '<p>' . __( 'WordPress can automatically look for some common database problems and repair them. Repairing can take a while, so please be patient.' ) . '</p>'; |
|
143 | + echo '<p>'.__('WordPress can automatically look for some common database problems and repair them. Repairing can take a while, so please be patient.').'</p>'; |
|
144 | 144 | ?> |
145 | - <p class="step"><a class="button button-large" href="repair.php?repair=1"><?php _e( 'Repair Database' ); ?></a></p> |
|
146 | - <p><?php _e( 'WordPress can also attempt to optimize the database. This improves performance in some situations. Repairing and optimizing the database can take a long time and the database will be locked while optimizing.' ); ?></p> |
|
147 | - <p class="step"><a class="button button-large" href="repair.php?repair=2"><?php _e( 'Repair and Optimize Database' ); ?></a></p> |
|
145 | + <p class="step"><a class="button button-large" href="repair.php?repair=1"><?php _e('Repair Database'); ?></a></p> |
|
146 | + <p><?php _e('WordPress can also attempt to optimize the database. This improves performance in some situations. Repairing and optimizing the database can take a long time and the database will be locked while optimizing.'); ?></p> |
|
147 | + <p class="step"><a class="button button-large" href="repair.php?repair=2"><?php _e('Repair and Optimize Database'); ?></a></p> |
|
148 | 148 | <?php |
149 | 149 | } |
150 | 150 | ?> |
@@ -130,18 +130,20 @@ |
||
130 | 130 | if ( $problems ) { |
131 | 131 | printf( '<p>' . __('Some database problems could not be repaired. Please copy-and-paste the following list of errors to the <a href="%s">WordPress support forums</a> to get additional assistance.') . '</p>', __( 'https://wordpress.org/support/forum/how-to-and-troubleshooting' ) ); |
132 | 132 | $problem_output = ''; |
133 | - foreach ( $problems as $table => $problem ) |
|
134 | - $problem_output .= "$table: $problem\n"; |
|
133 | + foreach ( $problems as $table => $problem ) { |
|
134 | + $problem_output .= "$table: $problem\n"; |
|
135 | + } |
|
135 | 136 | echo '<p><textarea name="errors" id="errors" rows="20" cols="60">' . esc_textarea( $problem_output ) . '</textarea></p>'; |
136 | 137 | } else { |
137 | 138 | echo '<p>' . __( 'Repairs complete. Please remove the following line from wp-config.php to prevent this page from being used by unauthorized users.' ) . "</p><p><code>define('WP_ALLOW_REPAIR', true);</code></p>"; |
138 | 139 | } |
139 | 140 | } else { |
140 | - if ( isset( $_GET['referrer'] ) && 'is_blog_installed' == $_GET['referrer'] ) |
|
141 | - echo '<p>' . __( 'One or more database tables are unavailable. To allow WordPress to attempt to repair these tables, press the “Repair Database” button. Repairing can take a while, so please be patient.' ) . '</p>'; |
|
142 | - else |
|
143 | - echo '<p>' . __( 'WordPress can automatically look for some common database problems and repair them. Repairing can take a while, so please be patient.' ) . '</p>'; |
|
144 | -?> |
|
141 | + if ( isset( $_GET['referrer'] ) && 'is_blog_installed' == $_GET['referrer'] ) { |
|
142 | + echo '<p>' . __( 'One or more database tables are unavailable. To allow WordPress to attempt to repair these tables, press the “Repair Database” button. Repairing can take a while, so please be patient.' ) . '</p>'; |
|
143 | + } else { |
|
144 | + echo '<p>' . __( 'WordPress can automatically look for some common database problems and repair them. Repairing can take a while, so please be patient.' ) . '</p>'; |
|
145 | + } |
|
146 | + ?> |
|
145 | 147 | <p class="step"><a class="button button-large" href="repair.php?repair=1"><?php _e( 'Repair Database' ); ?></a></p> |
146 | 148 | <p><?php _e( 'WordPress can also attempt to optimize the database. This improves performance in some situations. Repairing and optimizing the database can take a long time and the database will be locked while optimizing.' ); ?></p> |
147 | 149 | <p class="step"><a class="button button-large" href="repair.php?repair=2"><?php _e( 'Repair and Optimize Database' ); ?></a></p> |
@@ -1,10 +1,10 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * Comment Management Screen |
|
4 | - * |
|
5 | - * @package WordPress |
|
6 | - * @subpackage Administration |
|
7 | - */ |
|
3 | + * Comment Management Screen |
|
4 | + * |
|
5 | + * @package WordPress |
|
6 | + * @subpackage Administration |
|
7 | + */ |
|
8 | 8 | |
9 | 9 | /** Load WordPress Bootstrap */ |
10 | 10 | require_once( dirname( __FILE__ ) . '/admin.php' ); |
@@ -7,7 +7,7 @@ discard block |
||
7 | 7 | */ |
8 | 8 | |
9 | 9 | /** Load WordPress Bootstrap */ |
10 | -require_once( dirname( __FILE__ ) . '/admin.php' ); |
|
10 | +require_once(dirname(__FILE__).'/admin.php'); |
|
11 | 11 | |
12 | 12 | $parent_file = 'edit-comments.php'; |
13 | 13 | $submenu_file = 'edit-comments.php'; |
@@ -16,20 +16,20 @@ discard block |
||
16 | 16 | * @global string $action |
17 | 17 | */ |
18 | 18 | global $action; |
19 | -wp_reset_vars( array('action') ); |
|
19 | +wp_reset_vars(array('action')); |
|
20 | 20 | |
21 | -if ( isset( $_POST['deletecomment'] ) ) |
|
21 | +if (isset($_POST['deletecomment'])) |
|
22 | 22 | $action = 'deletecomment'; |
23 | 23 | |
24 | -if ( 'cdc' == $action ) |
|
24 | +if ('cdc' == $action) |
|
25 | 25 | $action = 'delete'; |
26 | -elseif ( 'mac' == $action ) |
|
26 | +elseif ('mac' == $action) |
|
27 | 27 | $action = 'approve'; |
28 | 28 | |
29 | -if ( isset( $_GET['dt'] ) ) { |
|
30 | - if ( 'spam' == $_GET['dt'] ) |
|
29 | +if (isset($_GET['dt'])) { |
|
30 | + if ('spam' == $_GET['dt']) |
|
31 | 31 | $action = 'spam'; |
32 | - elseif ( 'trash' == $_GET['dt'] ) |
|
32 | + elseif ('trash' == $_GET['dt']) |
|
33 | 33 | $action = 'trash'; |
34 | 34 | } |
35 | 35 | |
@@ -38,48 +38,48 @@ discard block |
||
38 | 38 | * |
39 | 39 | * @param string $msg Error Message. Assumed to contain HTML and be sanitized. |
40 | 40 | */ |
41 | -function comment_footer_die( $msg ) { |
|
41 | +function comment_footer_die($msg) { |
|
42 | 42 | echo "<div class='wrap'><p>$msg</p></div>"; |
43 | - include( ABSPATH . 'wp-admin/admin-footer.php' ); |
|
43 | + include(ABSPATH.'wp-admin/admin-footer.php'); |
|
44 | 44 | die; |
45 | 45 | } |
46 | 46 | |
47 | -switch( $action ) { |
|
47 | +switch ($action) { |
|
48 | 48 | |
49 | 49 | case 'editcomment' : |
50 | 50 | $title = __('Edit Comment'); |
51 | 51 | |
52 | - get_current_screen()->add_help_tab( array( |
|
52 | + get_current_screen()->add_help_tab(array( |
|
53 | 53 | 'id' => 'overview', |
54 | 54 | 'title' => __('Overview'), |
55 | 55 | 'content' => |
56 | - '<p>' . __( 'You can edit the information left in a comment if needed. This is often useful when you notice that a commenter has made a typographical error.' ) . '</p>' . |
|
57 | - '<p>' . __( 'You can also moderate the comment from this screen using the Status box, where you can also change the timestamp of the comment.' ) . '</p>' |
|
58 | - ) ); |
|
56 | + '<p>'.__('You can edit the information left in a comment if needed. This is often useful when you notice that a commenter has made a typographical error.').'</p>'. |
|
57 | + '<p>'.__('You can also moderate the comment from this screen using the Status box, where you can also change the timestamp of the comment.').'</p>' |
|
58 | + )); |
|
59 | 59 | |
60 | 60 | get_current_screen()->set_help_sidebar( |
61 | - '<p><strong>' . __( 'For more information:' ) . '</strong></p>' . |
|
62 | - '<p>' . __( '<a href="https://codex.wordpress.org/Administration_Screens#Comments" target="_blank">Documentation on Comments</a>' ) . '</p>' . |
|
63 | - '<p>' . __( '<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>' ) . '</p>' |
|
61 | + '<p><strong>'.__('For more information:').'</strong></p>'. |
|
62 | + '<p>'.__('<a href="https://codex.wordpress.org/Administration_Screens#Comments" target="_blank">Documentation on Comments</a>').'</p>'. |
|
63 | + '<p>'.__('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>').'</p>' |
|
64 | 64 | ); |
65 | 65 | |
66 | 66 | wp_enqueue_script('comment'); |
67 | - require_once( ABSPATH . 'wp-admin/admin-header.php' ); |
|
67 | + require_once(ABSPATH.'wp-admin/admin-header.php'); |
|
68 | 68 | |
69 | - $comment_id = absint( $_GET['c'] ); |
|
69 | + $comment_id = absint($_GET['c']); |
|
70 | 70 | |
71 | - if ( !$comment = get_comment( $comment_id ) ) |
|
72 | - comment_footer_die( __( 'Invalid comment ID.' ) . sprintf(' <a href="%s">' . __('Go back') . '</a>.', 'javascript:history.go(-1)') ); |
|
71 | + if ( ! $comment = get_comment($comment_id)) |
|
72 | + comment_footer_die(__('Invalid comment ID.').sprintf(' <a href="%s">'.__('Go back').'</a>.', 'javascript:history.go(-1)')); |
|
73 | 73 | |
74 | - if ( !current_user_can( 'edit_comment', $comment_id ) ) |
|
75 | - comment_footer_die( __('You are not allowed to edit this comment.') ); |
|
74 | + if ( ! current_user_can('edit_comment', $comment_id)) |
|
75 | + comment_footer_die(__('You are not allowed to edit this comment.')); |
|
76 | 76 | |
77 | - if ( 'trash' == $comment->comment_approved ) |
|
78 | - comment_footer_die( __('This comment is in the Trash. Please move it out of the Trash if you want to edit it.') ); |
|
77 | + if ('trash' == $comment->comment_approved) |
|
78 | + comment_footer_die(__('This comment is in the Trash. Please move it out of the Trash if you want to edit it.')); |
|
79 | 79 | |
80 | - $comment = get_comment_to_edit( $comment_id ); |
|
80 | + $comment = get_comment_to_edit($comment_id); |
|
81 | 81 | |
82 | - include( ABSPATH . 'wp-admin/edit-form-comment.php' ); |
|
82 | + include(ABSPATH.'wp-admin/edit-form-comment.php'); |
|
83 | 83 | |
84 | 84 | break; |
85 | 85 | |
@@ -90,40 +90,40 @@ discard block |
||
90 | 90 | |
91 | 91 | $title = __('Moderate Comment'); |
92 | 92 | |
93 | - $comment_id = absint( $_GET['c'] ); |
|
93 | + $comment_id = absint($_GET['c']); |
|
94 | 94 | |
95 | - if ( !$comment = get_comment_to_edit( $comment_id ) ) { |
|
96 | - wp_redirect( admin_url('edit-comments.php?error=1') ); |
|
95 | + if ( ! $comment = get_comment_to_edit($comment_id)) { |
|
96 | + wp_redirect(admin_url('edit-comments.php?error=1')); |
|
97 | 97 | die(); |
98 | 98 | } |
99 | 99 | |
100 | - if ( !current_user_can( 'edit_comment', $comment->comment_ID ) ) { |
|
101 | - wp_redirect( admin_url('edit-comments.php?error=2') ); |
|
100 | + if ( ! current_user_can('edit_comment', $comment->comment_ID)) { |
|
101 | + wp_redirect(admin_url('edit-comments.php?error=2')); |
|
102 | 102 | die(); |
103 | 103 | } |
104 | 104 | |
105 | 105 | // No need to re-approve/re-trash/re-spam a comment. |
106 | - if ( $action == str_replace( '1', 'approve', $comment->comment_approved ) ) { |
|
107 | - wp_redirect( admin_url( 'edit-comments.php?same=' . $comment_id ) ); |
|
106 | + if ($action == str_replace('1', 'approve', $comment->comment_approved)) { |
|
107 | + wp_redirect(admin_url('edit-comments.php?same='.$comment_id)); |
|
108 | 108 | die(); |
109 | 109 | } |
110 | 110 | |
111 | - require_once( ABSPATH . 'wp-admin/admin-header.php' ); |
|
111 | + require_once(ABSPATH.'wp-admin/admin-header.php'); |
|
112 | 112 | |
113 | - $formaction = $action . 'comment'; |
|
113 | + $formaction = $action.'comment'; |
|
114 | 114 | $nonce_action = 'approve' == $action ? 'approve-comment_' : 'delete-comment_'; |
115 | 115 | $nonce_action .= $comment_id; |
116 | 116 | |
117 | 117 | ?> |
118 | 118 | <div class="wrap"> |
119 | 119 | |
120 | -<h1><?php echo esc_html( $title ); ?></h1> |
|
120 | +<h1><?php echo esc_html($title); ?></h1> |
|
121 | 121 | |
122 | 122 | <?php |
123 | -switch ( $action ) { |
|
123 | +switch ($action) { |
|
124 | 124 | case 'spam' : |
125 | 125 | $caution_msg = __('You are about to mark the following comment as spam:'); |
126 | - $button = _x( 'Mark as Spam', 'comment' ); |
|
126 | + $button = _x('Mark as Spam', 'comment'); |
|
127 | 127 | break; |
128 | 128 | case 'trash' : |
129 | 129 | $caution_msg = __('You are about to move the following comment to the Trash:'); |
@@ -139,9 +139,9 @@ discard block |
||
139 | 139 | break; |
140 | 140 | } |
141 | 141 | |
142 | -if ( $comment->comment_approved != '0' ) { // if not unapproved |
|
142 | +if ($comment->comment_approved != '0') { // if not unapproved |
|
143 | 143 | $message = ''; |
144 | - switch ( $comment->comment_approved ) { |
|
144 | + switch ($comment->comment_approved) { |
|
145 | 145 | case '1' : |
146 | 146 | $message = __('This comment is currently approved.'); |
147 | 147 | break; |
@@ -152,8 +152,8 @@ discard block |
||
152 | 152 | $message = __('This comment is currently in the Trash.'); |
153 | 153 | break; |
154 | 154 | } |
155 | - if ( $message ) { |
|
156 | - echo '<div class="notice notice-info"><p>' . $message . '</p></div>'; |
|
155 | + if ($message) { |
|
156 | + echo '<div class="notice notice-info"><p>'.$message.'</p></div>'; |
|
157 | 157 | } |
158 | 158 | } |
159 | 159 | ?> |
@@ -164,50 +164,50 @@ discard block |
||
164 | 164 | <th scope="row"><?php _e('Author'); ?></th> |
165 | 165 | <td><?php echo $comment->comment_author; ?></td> |
166 | 166 | </tr> |
167 | -<?php if ( $comment->comment_author_email ) { ?> |
|
167 | +<?php if ($comment->comment_author_email) { ?> |
|
168 | 168 | <tr> |
169 | 169 | <th scope="row"><?php _e('E-mail'); ?></th> |
170 | 170 | <td><?php echo $comment->comment_author_email; ?></td> |
171 | 171 | </tr> |
172 | 172 | <?php } ?> |
173 | -<?php if ( $comment->comment_author_url ) { ?> |
|
173 | +<?php if ($comment->comment_author_url) { ?> |
|
174 | 174 | <tr> |
175 | 175 | <th scope="row"><?php _e('URL'); ?></th> |
176 | 176 | <td><a href="<?php echo $comment->comment_author_url; ?>"><?php echo $comment->comment_author_url; ?></a></td> |
177 | 177 | </tr> |
178 | 178 | <?php } ?> |
179 | 179 | <tr> |
180 | - <th scope="row"><?php /* translators: column name or table row header */ _e( 'In Response To' ); ?></th> |
|
180 | + <th scope="row"><?php /* translators: column name or table row header */ _e('In Response To'); ?></th> |
|
181 | 181 | <td> |
182 | 182 | <?php |
183 | 183 | $post_id = $comment->comment_post_ID; |
184 | - if ( current_user_can( 'edit_post', $post_id ) ) { |
|
185 | - $post_link = "<a href='" . esc_url( get_edit_post_link( $post_id ) ) . "'>"; |
|
186 | - $post_link .= esc_html( get_the_title( $post_id ) ) . '</a>'; |
|
184 | + if (current_user_can('edit_post', $post_id)) { |
|
185 | + $post_link = "<a href='".esc_url(get_edit_post_link($post_id))."'>"; |
|
186 | + $post_link .= esc_html(get_the_title($post_id)).'</a>'; |
|
187 | 187 | } else { |
188 | - $post_link = esc_html( get_the_title( $post_id ) ); |
|
188 | + $post_link = esc_html(get_the_title($post_id)); |
|
189 | 189 | } |
190 | 190 | echo $post_link; |
191 | 191 | |
192 | - if ( $comment->comment_parent ) { |
|
193 | - $parent = get_comment( $comment->comment_parent ); |
|
194 | - $parent_link = esc_url( get_comment_link( $comment->comment_parent ) ); |
|
195 | - $name = get_comment_author( $parent->comment_ID ); |
|
196 | - printf( ' | ' . __( 'In reply to <a href="%1$s">%2$s</a>.' ), $parent_link, $name ); |
|
192 | + if ($comment->comment_parent) { |
|
193 | + $parent = get_comment($comment->comment_parent); |
|
194 | + $parent_link = esc_url(get_comment_link($comment->comment_parent)); |
|
195 | + $name = get_comment_author($parent->comment_ID); |
|
196 | + printf(' | '.__('In reply to <a href="%1$s">%2$s</a>.'), $parent_link, $name); |
|
197 | 197 | } |
198 | 198 | ?> |
199 | 199 | </td> |
200 | 200 | </tr> |
201 | 201 | <tr> |
202 | - <th scope="row"><?php _e( 'Submitted on' ); ?></th> |
|
202 | + <th scope="row"><?php _e('Submitted on'); ?></th> |
|
203 | 203 | <td> |
204 | 204 | <?php |
205 | 205 | /* translators: 2: comment date, 3: comment time */ |
206 | - printf( __( '<a href="%1$s">%2$s at %3$s</a>' ), |
|
207 | - esc_url( get_comment_link( $comment->comment_ID ) ), |
|
206 | + printf(__('<a href="%1$s">%2$s at %3$s</a>'), |
|
207 | + esc_url(get_comment_link($comment->comment_ID)), |
|
208 | 208 | /* translators: comment date format. See http://php.net/date */ |
209 | - get_comment_date( __( 'Y/m/d' ) ), |
|
210 | - get_comment_date( get_option( 'time_format' ) ) |
|
209 | + get_comment_date(__('Y/m/d')), |
|
210 | + get_comment_date(get_option('time_format')) |
|
211 | 211 | ); |
212 | 212 | ?> |
213 | 213 | </td> |
@@ -221,11 +221,11 @@ discard block |
||
221 | 221 | <form action="comment.php" method="get" class="comment-ays-submit"> |
222 | 222 | |
223 | 223 | <p> |
224 | - <?php submit_button( $button, 'primary', 'submit', false ); ?> |
|
225 | - <a href="<?php echo admin_url('edit-comments.php'); ?>" class="button-cancel"><?php esc_attr_e( 'Cancel' ); ?></a></td> |
|
224 | + <?php submit_button($button, 'primary', 'submit', false); ?> |
|
225 | + <a href="<?php echo admin_url('edit-comments.php'); ?>" class="button-cancel"><?php esc_attr_e('Cancel'); ?></a></td> |
|
226 | 226 | </p> |
227 | 227 | |
228 | -<?php wp_nonce_field( $nonce_action ); ?> |
|
228 | +<?php wp_nonce_field($nonce_action); ?> |
|
229 | 229 | <input type="hidden" name="action" value="<?php echo esc_attr($formaction); ?>" /> |
230 | 230 | <input type="hidden" name="c" value="<?php echo esc_attr($comment->comment_ID); ?>" /> |
231 | 231 | <input type="hidden" name="noredir" value="1" /> |
@@ -242,75 +242,75 @@ discard block |
||
242 | 242 | case 'unspamcomment' : |
243 | 243 | case 'approvecomment' : |
244 | 244 | case 'unapprovecomment' : |
245 | - $comment_id = absint( $_REQUEST['c'] ); |
|
245 | + $comment_id = absint($_REQUEST['c']); |
|
246 | 246 | |
247 | - if ( in_array( $action, array( 'approvecomment', 'unapprovecomment' ) ) ) |
|
248 | - check_admin_referer( 'approve-comment_' . $comment_id ); |
|
247 | + if (in_array($action, array('approvecomment', 'unapprovecomment'))) |
|
248 | + check_admin_referer('approve-comment_'.$comment_id); |
|
249 | 249 | else |
250 | - check_admin_referer( 'delete-comment_' . $comment_id ); |
|
250 | + check_admin_referer('delete-comment_'.$comment_id); |
|
251 | 251 | |
252 | 252 | $noredir = isset($_REQUEST['noredir']); |
253 | 253 | |
254 | - if ( !$comment = get_comment($comment_id) ) |
|
255 | - comment_footer_die( __( 'Invalid comment ID.' ) . sprintf(' <a href="%s">' . __('Go back') . '</a>.', 'edit-comments.php') ); |
|
256 | - if ( !current_user_can( 'edit_comment', $comment->comment_ID ) ) |
|
257 | - comment_footer_die( __('You are not allowed to edit comments on this post.') ); |
|
254 | + if ( ! $comment = get_comment($comment_id)) |
|
255 | + comment_footer_die(__('Invalid comment ID.').sprintf(' <a href="%s">'.__('Go back').'</a>.', 'edit-comments.php')); |
|
256 | + if ( ! current_user_can('edit_comment', $comment->comment_ID)) |
|
257 | + comment_footer_die(__('You are not allowed to edit comments on this post.')); |
|
258 | 258 | |
259 | - if ( '' != wp_get_referer() && ! $noredir && false === strpos(wp_get_referer(), 'comment.php') ) |
|
259 | + if ('' != wp_get_referer() && ! $noredir && false === strpos(wp_get_referer(), 'comment.php')) |
|
260 | 260 | $redir = wp_get_referer(); |
261 | - elseif ( '' != wp_get_original_referer() && ! $noredir ) |
|
261 | + elseif ('' != wp_get_original_referer() && ! $noredir) |
|
262 | 262 | $redir = wp_get_original_referer(); |
263 | - elseif ( in_array( $action, array( 'approvecomment', 'unapprovecomment' ) ) ) |
|
264 | - $redir = admin_url('edit-comments.php?p=' . absint( $comment->comment_post_ID ) ); |
|
263 | + elseif (in_array($action, array('approvecomment', 'unapprovecomment'))) |
|
264 | + $redir = admin_url('edit-comments.php?p='.absint($comment->comment_post_ID)); |
|
265 | 265 | else |
266 | 266 | $redir = admin_url('edit-comments.php'); |
267 | 267 | |
268 | - $redir = remove_query_arg( array('spammed', 'unspammed', 'trashed', 'untrashed', 'deleted', 'ids', 'approved', 'unapproved'), $redir ); |
|
268 | + $redir = remove_query_arg(array('spammed', 'unspammed', 'trashed', 'untrashed', 'deleted', 'ids', 'approved', 'unapproved'), $redir); |
|
269 | 269 | |
270 | - switch ( $action ) { |
|
270 | + switch ($action) { |
|
271 | 271 | case 'deletecomment' : |
272 | - wp_delete_comment( $comment_id ); |
|
273 | - $redir = add_query_arg( array('deleted' => '1'), $redir ); |
|
272 | + wp_delete_comment($comment_id); |
|
273 | + $redir = add_query_arg(array('deleted' => '1'), $redir); |
|
274 | 274 | break; |
275 | 275 | case 'trashcomment' : |
276 | 276 | wp_trash_comment($comment_id); |
277 | - $redir = add_query_arg( array('trashed' => '1', 'ids' => $comment_id), $redir ); |
|
277 | + $redir = add_query_arg(array('trashed' => '1', 'ids' => $comment_id), $redir); |
|
278 | 278 | break; |
279 | 279 | case 'untrashcomment' : |
280 | 280 | wp_untrash_comment($comment_id); |
281 | - $redir = add_query_arg( array('untrashed' => '1'), $redir ); |
|
281 | + $redir = add_query_arg(array('untrashed' => '1'), $redir); |
|
282 | 282 | break; |
283 | 283 | case 'spamcomment' : |
284 | 284 | wp_spam_comment($comment_id); |
285 | - $redir = add_query_arg( array('spammed' => '1', 'ids' => $comment_id), $redir ); |
|
285 | + $redir = add_query_arg(array('spammed' => '1', 'ids' => $comment_id), $redir); |
|
286 | 286 | break; |
287 | 287 | case 'unspamcomment' : |
288 | 288 | wp_unspam_comment($comment_id); |
289 | - $redir = add_query_arg( array('unspammed' => '1'), $redir ); |
|
289 | + $redir = add_query_arg(array('unspammed' => '1'), $redir); |
|
290 | 290 | break; |
291 | 291 | case 'approvecomment' : |
292 | - wp_set_comment_status( $comment_id, 'approve' ); |
|
293 | - $redir = add_query_arg( array( 'approved' => 1 ), $redir ); |
|
292 | + wp_set_comment_status($comment_id, 'approve'); |
|
293 | + $redir = add_query_arg(array('approved' => 1), $redir); |
|
294 | 294 | break; |
295 | 295 | case 'unapprovecomment' : |
296 | - wp_set_comment_status( $comment_id, 'hold' ); |
|
297 | - $redir = add_query_arg( array( 'unapproved' => 1 ), $redir ); |
|
296 | + wp_set_comment_status($comment_id, 'hold'); |
|
297 | + $redir = add_query_arg(array('unapproved' => 1), $redir); |
|
298 | 298 | break; |
299 | 299 | } |
300 | 300 | |
301 | - wp_redirect( $redir ); |
|
301 | + wp_redirect($redir); |
|
302 | 302 | die; |
303 | 303 | |
304 | 304 | case 'editedcomment' : |
305 | 305 | |
306 | - $comment_id = absint( $_POST['comment_ID'] ); |
|
307 | - $comment_post_id = absint( $_POST['comment_post_ID'] ); |
|
306 | + $comment_id = absint($_POST['comment_ID']); |
|
307 | + $comment_post_id = absint($_POST['comment_post_ID']); |
|
308 | 308 | |
309 | - check_admin_referer( 'update-comment_' . $comment_id ); |
|
309 | + check_admin_referer('update-comment_'.$comment_id); |
|
310 | 310 | |
311 | 311 | edit_comment(); |
312 | 312 | |
313 | - $location = ( empty( $_POST['referredby'] ) ? "edit-comments.php?p=$comment_post_id" : $_POST['referredby'] ) . '#comment-' . $comment_id; |
|
313 | + $location = (empty($_POST['referredby']) ? "edit-comments.php?p=$comment_post_id" : $_POST['referredby']).'#comment-'.$comment_id; |
|
314 | 314 | |
315 | 315 | /** |
316 | 316 | * Filter the URI the user is redirected to after editing a comment in the admin. |
@@ -320,14 +320,14 @@ discard block |
||
320 | 320 | * @param string $location The URI the user will be redirected to. |
321 | 321 | * @param int $comment_id The ID of the comment being edited. |
322 | 322 | */ |
323 | - $location = apply_filters( 'comment_edit_redirect', $location, $comment_id ); |
|
324 | - wp_redirect( $location ); |
|
323 | + $location = apply_filters('comment_edit_redirect', $location, $comment_id); |
|
324 | + wp_redirect($location); |
|
325 | 325 | |
326 | 326 | exit(); |
327 | 327 | |
328 | 328 | default: |
329 | - wp_die( __('Unknown action.') ); |
|
329 | + wp_die(__('Unknown action.')); |
|
330 | 330 | |
331 | 331 | } // end switch |
332 | 332 | |
333 | -include( ABSPATH . 'wp-admin/admin-footer.php' ); |
|
333 | +include(ABSPATH.'wp-admin/admin-footer.php'); |
@@ -18,20 +18,23 @@ discard block |
||
18 | 18 | global $action; |
19 | 19 | wp_reset_vars( array('action') ); |
20 | 20 | |
21 | -if ( isset( $_POST['deletecomment'] ) ) |
|
21 | +if ( isset( $_POST['deletecomment'] ) ) { |
|
22 | 22 | $action = 'deletecomment'; |
23 | +} |
|
23 | 24 | |
24 | -if ( 'cdc' == $action ) |
|
25 | +if ( 'cdc' == $action ) { |
|
25 | 26 | $action = 'delete'; |
26 | -elseif ( 'mac' == $action ) |
|
27 | +} elseif ( 'mac' == $action ) { |
|
27 | 28 | $action = 'approve'; |
29 | +} |
|
28 | 30 | |
29 | 31 | if ( isset( $_GET['dt'] ) ) { |
30 | - if ( 'spam' == $_GET['dt'] ) |
|
31 | - $action = 'spam'; |
|
32 | - elseif ( 'trash' == $_GET['dt'] ) |
|
33 | - $action = 'trash'; |
|
34 | -} |
|
32 | + if ( 'spam' == $_GET['dt'] ) { |
|
33 | + $action = 'spam'; |
|
34 | + } elseif ( 'trash' == $_GET['dt'] ) { |
|
35 | + $action = 'trash'; |
|
36 | + } |
|
37 | + } |
|
35 | 38 | |
36 | 39 | /** |
37 | 40 | * Display error message at bottom of comments. |
@@ -68,14 +71,17 @@ discard block |
||
68 | 71 | |
69 | 72 | $comment_id = absint( $_GET['c'] ); |
70 | 73 | |
71 | - if ( !$comment = get_comment( $comment_id ) ) |
|
72 | - comment_footer_die( __( 'Invalid comment ID.' ) . sprintf(' <a href="%s">' . __('Go back') . '</a>.', 'javascript:history.go(-1)') ); |
|
74 | + if ( !$comment = get_comment( $comment_id ) ) { |
|
75 | + comment_footer_die( __( 'Invalid comment ID.' ) . sprintf(' <a href="%s">' . __('Go back') . '</a>.', 'javascript:history.go(-1)') ); |
|
76 | + } |
|
73 | 77 | |
74 | - if ( !current_user_can( 'edit_comment', $comment_id ) ) |
|
75 | - comment_footer_die( __('You are not allowed to edit this comment.') ); |
|
78 | + if ( !current_user_can( 'edit_comment', $comment_id ) ) { |
|
79 | + comment_footer_die( __('You are not allowed to edit this comment.') ); |
|
80 | + } |
|
76 | 81 | |
77 | - if ( 'trash' == $comment->comment_approved ) |
|
78 | - comment_footer_die( __('This comment is in the Trash. Please move it out of the Trash if you want to edit it.') ); |
|
82 | + if ( 'trash' == $comment->comment_approved ) { |
|
83 | + comment_footer_die( __('This comment is in the Trash. Please move it out of the Trash if you want to edit it.') ); |
|
84 | + } |
|
79 | 85 | |
80 | 86 | $comment = get_comment_to_edit( $comment_id ); |
81 | 87 | |
@@ -244,26 +250,30 @@ discard block |
||
244 | 250 | case 'unapprovecomment' : |
245 | 251 | $comment_id = absint( $_REQUEST['c'] ); |
246 | 252 | |
247 | - if ( in_array( $action, array( 'approvecomment', 'unapprovecomment' ) ) ) |
|
248 | - check_admin_referer( 'approve-comment_' . $comment_id ); |
|
249 | - else |
|
250 | - check_admin_referer( 'delete-comment_' . $comment_id ); |
|
253 | + if ( in_array( $action, array( 'approvecomment', 'unapprovecomment' ) ) ) { |
|
254 | + check_admin_referer( 'approve-comment_' . $comment_id ); |
|
255 | + } else { |
|
256 | + check_admin_referer( 'delete-comment_' . $comment_id ); |
|
257 | + } |
|
251 | 258 | |
252 | 259 | $noredir = isset($_REQUEST['noredir']); |
253 | 260 | |
254 | - if ( !$comment = get_comment($comment_id) ) |
|
255 | - comment_footer_die( __( 'Invalid comment ID.' ) . sprintf(' <a href="%s">' . __('Go back') . '</a>.', 'edit-comments.php') ); |
|
256 | - if ( !current_user_can( 'edit_comment', $comment->comment_ID ) ) |
|
257 | - comment_footer_die( __('You are not allowed to edit comments on this post.') ); |
|
258 | - |
|
259 | - if ( '' != wp_get_referer() && ! $noredir && false === strpos(wp_get_referer(), 'comment.php') ) |
|
260 | - $redir = wp_get_referer(); |
|
261 | - elseif ( '' != wp_get_original_referer() && ! $noredir ) |
|
262 | - $redir = wp_get_original_referer(); |
|
263 | - elseif ( in_array( $action, array( 'approvecomment', 'unapprovecomment' ) ) ) |
|
264 | - $redir = admin_url('edit-comments.php?p=' . absint( $comment->comment_post_ID ) ); |
|
265 | - else |
|
266 | - $redir = admin_url('edit-comments.php'); |
|
261 | + if ( !$comment = get_comment($comment_id) ) { |
|
262 | + comment_footer_die( __( 'Invalid comment ID.' ) . sprintf(' <a href="%s">' . __('Go back') . '</a>.', 'edit-comments.php') ); |
|
263 | + } |
|
264 | + if ( !current_user_can( 'edit_comment', $comment->comment_ID ) ) { |
|
265 | + comment_footer_die( __('You are not allowed to edit comments on this post.') ); |
|
266 | + } |
|
267 | + |
|
268 | + if ( '' != wp_get_referer() && ! $noredir && false === strpos(wp_get_referer(), 'comment.php') ) { |
|
269 | + $redir = wp_get_referer(); |
|
270 | + } elseif ( '' != wp_get_original_referer() && ! $noredir ) { |
|
271 | + $redir = wp_get_original_referer(); |
|
272 | + } elseif ( in_array( $action, array( 'approvecomment', 'unapprovecomment' ) ) ) { |
|
273 | + $redir = admin_url('edit-comments.php?p=' . absint( $comment->comment_post_ID ) ); |
|
274 | + } else { |
|
275 | + $redir = admin_url('edit-comments.php'); |
|
276 | + } |
|
267 | 277 | |
268 | 278 | $redir = remove_query_arg( array('spammed', 'unspammed', 'trashed', 'untrashed', 'deleted', 'ids', 'approved', 'unapproved'), $redir ); |
269 | 279 |
@@ -7,106 +7,106 @@ discard block |
||
7 | 7 | */ |
8 | 8 | |
9 | 9 | /** Load WordPress Bootstrap */ |
10 | -require_once( dirname( __FILE__ ) . '/admin.php' ); |
|
10 | +require_once(dirname(__FILE__).'/admin.php'); |
|
11 | 11 | |
12 | 12 | /** Load WordPress dashboard API */ |
13 | -require_once(ABSPATH . 'wp-admin/includes/dashboard.php'); |
|
13 | +require_once(ABSPATH.'wp-admin/includes/dashboard.php'); |
|
14 | 14 | |
15 | 15 | wp_dashboard_setup(); |
16 | 16 | |
17 | -wp_enqueue_script( 'dashboard' ); |
|
18 | -if ( current_user_can( 'edit_theme_options' ) ) |
|
19 | - wp_enqueue_script( 'customize-loader' ); |
|
20 | -if ( current_user_can( 'install_plugins' ) ) |
|
21 | - wp_enqueue_script( 'plugin-install' ); |
|
22 | -if ( current_user_can( 'upload_files' ) ) |
|
23 | - wp_enqueue_script( 'media-upload' ); |
|
17 | +wp_enqueue_script('dashboard'); |
|
18 | +if (current_user_can('edit_theme_options')) |
|
19 | + wp_enqueue_script('customize-loader'); |
|
20 | +if (current_user_can('install_plugins')) |
|
21 | + wp_enqueue_script('plugin-install'); |
|
22 | +if (current_user_can('upload_files')) |
|
23 | + wp_enqueue_script('media-upload'); |
|
24 | 24 | add_thickbox(); |
25 | 25 | |
26 | -if ( wp_is_mobile() ) |
|
27 | - wp_enqueue_script( 'jquery-touch-punch' ); |
|
26 | +if (wp_is_mobile()) |
|
27 | + wp_enqueue_script('jquery-touch-punch'); |
|
28 | 28 | |
29 | 29 | $title = __('Dashboard'); |
30 | 30 | $parent_file = 'index.php'; |
31 | 31 | |
32 | -$help = '<p>' . __( 'Welcome to your WordPress Dashboard! This is the screen you will see when you log in to your site, and gives you access to all the site management features of WordPress. You can get help for any screen by clicking the Help tab in the upper corner.' ) . '</p>'; |
|
32 | +$help = '<p>'.__('Welcome to your WordPress Dashboard! This is the screen you will see when you log in to your site, and gives you access to all the site management features of WordPress. You can get help for any screen by clicking the Help tab in the upper corner.').'</p>'; |
|
33 | 33 | |
34 | 34 | // Not using chaining here, so as to be parseable by PHP4. |
35 | 35 | $screen = get_current_screen(); |
36 | 36 | |
37 | -$screen->add_help_tab( array( |
|
37 | +$screen->add_help_tab(array( |
|
38 | 38 | 'id' => 'overview', |
39 | - 'title' => __( 'Overview' ), |
|
39 | + 'title' => __('Overview'), |
|
40 | 40 | 'content' => $help, |
41 | -) ); |
|
41 | +)); |
|
42 | 42 | |
43 | 43 | // Help tabs |
44 | 44 | |
45 | -$help = '<p>' . __( 'The left-hand navigation menu provides links to all of the WordPress administration screens, with submenu items displayed on hover. You can minimize this menu to a narrow icon strip by clicking on the Collapse Menu arrow at the bottom.' ) . '</p>'; |
|
46 | -$help .= '<p>' . __( 'Links in the Toolbar at the top of the screen connect your dashboard and the front end of your site, and provide access to your profile and helpful WordPress information.' ) . '</p>'; |
|
45 | +$help = '<p>'.__('The left-hand navigation menu provides links to all of the WordPress administration screens, with submenu items displayed on hover. You can minimize this menu to a narrow icon strip by clicking on the Collapse Menu arrow at the bottom.').'</p>'; |
|
46 | +$help .= '<p>'.__('Links in the Toolbar at the top of the screen connect your dashboard and the front end of your site, and provide access to your profile and helpful WordPress information.').'</p>'; |
|
47 | 47 | |
48 | -$screen->add_help_tab( array( |
|
48 | +$screen->add_help_tab(array( |
|
49 | 49 | 'id' => 'help-navigation', |
50 | - 'title' => __( 'Navigation' ), |
|
50 | + 'title' => __('Navigation'), |
|
51 | 51 | 'content' => $help, |
52 | -) ); |
|
52 | +)); |
|
53 | 53 | |
54 | -$help = '<p>' . __( 'You can use the following controls to arrange your Dashboard screen to suit your workflow. This is true on most other administration screens as well.' ) . '</p>'; |
|
55 | -$help .= '<p>' . __( '<strong>Screen Options</strong> — Use the Screen Options tab to choose which Dashboard boxes to show.' ) . '</p>'; |
|
56 | -$help .= '<p>' . __( '<strong>Drag and Drop</strong> — To rearrange the boxes, drag and drop by clicking on the title bar of the selected box and releasing when you see a gray dotted-line rectangle appear in the location you want to place the box.' ) . '</p>'; |
|
57 | -$help .= '<p>' . __( '<strong>Box Controls</strong> — Click the title bar of the box to expand or collapse it. Some boxes added by plugins may have configurable content, and will show a “Configure” link in the title bar if you hover over it.' ) . '</p>'; |
|
54 | +$help = '<p>'.__('You can use the following controls to arrange your Dashboard screen to suit your workflow. This is true on most other administration screens as well.').'</p>'; |
|
55 | +$help .= '<p>'.__('<strong>Screen Options</strong> — Use the Screen Options tab to choose which Dashboard boxes to show.').'</p>'; |
|
56 | +$help .= '<p>'.__('<strong>Drag and Drop</strong> — To rearrange the boxes, drag and drop by clicking on the title bar of the selected box and releasing when you see a gray dotted-line rectangle appear in the location you want to place the box.').'</p>'; |
|
57 | +$help .= '<p>'.__('<strong>Box Controls</strong> — Click the title bar of the box to expand or collapse it. Some boxes added by plugins may have configurable content, and will show a “Configure” link in the title bar if you hover over it.').'</p>'; |
|
58 | 58 | |
59 | -$screen->add_help_tab( array( |
|
59 | +$screen->add_help_tab(array( |
|
60 | 60 | 'id' => 'help-layout', |
61 | - 'title' => __( 'Layout' ), |
|
61 | + 'title' => __('Layout'), |
|
62 | 62 | 'content' => $help, |
63 | -) ); |
|
64 | - |
|
65 | -$help = '<p>' . __( 'The boxes on your Dashboard screen are:' ) . '</p>'; |
|
66 | -if ( current_user_can( 'edit_posts' ) ) |
|
67 | - $help .= '<p>' . __( '<strong>At A Glance</strong> — Displays a summary of the content on your site and identifies which theme and version of WordPress you are using.' ) . '</p>'; |
|
68 | - $help .= '<p>' . __( '<strong>Activity</strong> — Shows the upcoming scheduled posts, recently published posts, and the most recent comments on your posts and allows you to moderate them.' ) . '</p>'; |
|
69 | -if ( is_blog_admin() && current_user_can( 'edit_posts' ) ) |
|
70 | - $help .= '<p>' . __( "<strong>Quick Draft</strong> — Allows you to create a new post and save it as a draft. Also displays links to the 5 most recent draft posts you've started." ) . '</p>'; |
|
71 | -if ( ! is_multisite() && current_user_can( 'install_plugins' ) ) |
|
72 | - $help .= '<p>' . __( '<strong>WordPress News</strong> — Latest news from the official WordPress project, the <a href="https://planet.wordpress.org/">WordPress Planet</a>, and popular and recent plugins.' ) . '</p>'; |
|
63 | +)); |
|
64 | + |
|
65 | +$help = '<p>'.__('The boxes on your Dashboard screen are:').'</p>'; |
|
66 | +if (current_user_can('edit_posts')) |
|
67 | + $help .= '<p>'.__('<strong>At A Glance</strong> — Displays a summary of the content on your site and identifies which theme and version of WordPress you are using.').'</p>'; |
|
68 | + $help .= '<p>'.__('<strong>Activity</strong> — Shows the upcoming scheduled posts, recently published posts, and the most recent comments on your posts and allows you to moderate them.').'</p>'; |
|
69 | +if (is_blog_admin() && current_user_can('edit_posts')) |
|
70 | + $help .= '<p>'.__("<strong>Quick Draft</strong> — Allows you to create a new post and save it as a draft. Also displays links to the 5 most recent draft posts you've started.").'</p>'; |
|
71 | +if ( ! is_multisite() && current_user_can('install_plugins')) |
|
72 | + $help .= '<p>'.__('<strong>WordPress News</strong> — Latest news from the official WordPress project, the <a href="https://planet.wordpress.org/">WordPress Planet</a>, and popular and recent plugins.').'</p>'; |
|
73 | 73 | else |
74 | - $help .= '<p>' . __( '<strong>WordPress News</strong> — Latest news from the official WordPress project, the <a href="https://planet.wordpress.org/">WordPress Planet</a>.' ) . '</p>'; |
|
75 | -if ( current_user_can( 'edit_theme_options' ) ) |
|
76 | - $help .= '<p>' . __( '<strong>Welcome</strong> — Shows links for some of the most common tasks when setting up a new site.' ) . '</p>'; |
|
74 | + $help .= '<p>'.__('<strong>WordPress News</strong> — Latest news from the official WordPress project, the <a href="https://planet.wordpress.org/">WordPress Planet</a>.').'</p>'; |
|
75 | +if (current_user_can('edit_theme_options')) |
|
76 | + $help .= '<p>'.__('<strong>Welcome</strong> — Shows links for some of the most common tasks when setting up a new site.').'</p>'; |
|
77 | 77 | |
78 | -$screen->add_help_tab( array( |
|
78 | +$screen->add_help_tab(array( |
|
79 | 79 | 'id' => 'help-content', |
80 | - 'title' => __( 'Content' ), |
|
80 | + 'title' => __('Content'), |
|
81 | 81 | 'content' => $help, |
82 | -) ); |
|
82 | +)); |
|
83 | 83 | |
84 | -unset( $help ); |
|
84 | +unset($help); |
|
85 | 85 | |
86 | 86 | $screen->set_help_sidebar( |
87 | - '<p><strong>' . __( 'For more information:' ) . '</strong></p>' . |
|
88 | - '<p>' . __( '<a href="https://codex.wordpress.org/Dashboard_Screen" target="_blank">Documentation on Dashboard</a>' ) . '</p>' . |
|
89 | - '<p>' . __( '<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>' ) . '</p>' |
|
87 | + '<p><strong>'.__('For more information:').'</strong></p>'. |
|
88 | + '<p>'.__('<a href="https://codex.wordpress.org/Dashboard_Screen" target="_blank">Documentation on Dashboard</a>').'</p>'. |
|
89 | + '<p>'.__('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>').'</p>' |
|
90 | 90 | ); |
91 | 91 | |
92 | -include( ABSPATH . 'wp-admin/admin-header.php' ); |
|
92 | +include(ABSPATH.'wp-admin/admin-header.php'); |
|
93 | 93 | ?> |
94 | 94 | |
95 | 95 | <div class="wrap"> |
96 | - <h1><?php echo esc_html( $title ); ?></h1> |
|
96 | + <h1><?php echo esc_html($title); ?></h1> |
|
97 | 97 | |
98 | -<?php if ( has_action( 'welcome_panel' ) && current_user_can( 'edit_theme_options' ) ) : |
|
98 | +<?php if (has_action('welcome_panel') && current_user_can('edit_theme_options')) : |
|
99 | 99 | $classes = 'welcome-panel'; |
100 | 100 | |
101 | - $option = get_user_meta( get_current_user_id(), 'show_welcome_panel', true ); |
|
101 | + $option = get_user_meta(get_current_user_id(), 'show_welcome_panel', true); |
|
102 | 102 | // 0 = hide, 1 = toggled to show or single site creator, 2 = multisite site owner |
103 | - $hide = 0 == $option || ( 2 == $option && wp_get_current_user()->user_email != get_option( 'admin_email' ) ); |
|
104 | - if ( $hide ) |
|
103 | + $hide = 0 == $option || (2 == $option && wp_get_current_user()->user_email != get_option('admin_email')); |
|
104 | + if ($hide) |
|
105 | 105 | $classes .= ' hidden'; ?> |
106 | 106 | |
107 | - <div id="welcome-panel" class="<?php echo esc_attr( $classes ); ?>"> |
|
108 | - <?php wp_nonce_field( 'welcome-panel-nonce', 'welcomepanelnonce', false ); ?> |
|
109 | - <a class="welcome-panel-close" href="<?php echo esc_url( admin_url( '?welcome=0' ) ); ?>"><?php _e( 'Dismiss' ); ?></a> |
|
107 | + <div id="welcome-panel" class="<?php echo esc_attr($classes); ?>"> |
|
108 | + <?php wp_nonce_field('welcome-panel-nonce', 'welcomepanelnonce', false); ?> |
|
109 | + <a class="welcome-panel-close" href="<?php echo esc_url(admin_url('?welcome=0')); ?>"><?php _e('Dismiss'); ?></a> |
|
110 | 110 | <?php |
111 | 111 | /** |
112 | 112 | * Add content to the welcome panel on the admin dashboard. |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | * |
118 | 118 | * @since 3.5.0 |
119 | 119 | */ |
120 | - do_action( 'welcome_panel' ); |
|
120 | + do_action('welcome_panel'); |
|
121 | 121 | ?> |
122 | 122 | </div> |
123 | 123 | <?php endif; ?> |
@@ -129,4 +129,4 @@ discard block |
||
129 | 129 | </div><!-- wrap --> |
130 | 130 | |
131 | 131 | <?php |
132 | -require( ABSPATH . 'wp-admin/admin-footer.php' ); |
|
132 | +require(ABSPATH.'wp-admin/admin-footer.php'); |
@@ -15,16 +15,20 @@ discard block |
||
15 | 15 | wp_dashboard_setup(); |
16 | 16 | |
17 | 17 | wp_enqueue_script( 'dashboard' ); |
18 | -if ( current_user_can( 'edit_theme_options' ) ) |
|
18 | +if ( current_user_can( 'edit_theme_options' ) ) { |
|
19 | 19 | wp_enqueue_script( 'customize-loader' ); |
20 | -if ( current_user_can( 'install_plugins' ) ) |
|
20 | +} |
|
21 | +if ( current_user_can( 'install_plugins' ) ) { |
|
21 | 22 | wp_enqueue_script( 'plugin-install' ); |
22 | -if ( current_user_can( 'upload_files' ) ) |
|
23 | +} |
|
24 | +if ( current_user_can( 'upload_files' ) ) { |
|
23 | 25 | wp_enqueue_script( 'media-upload' ); |
26 | +} |
|
24 | 27 | add_thickbox(); |
25 | 28 | |
26 | -if ( wp_is_mobile() ) |
|
29 | +if ( wp_is_mobile() ) { |
|
27 | 30 | wp_enqueue_script( 'jquery-touch-punch' ); |
31 | +} |
|
28 | 32 | |
29 | 33 | $title = __('Dashboard'); |
30 | 34 | $parent_file = 'index.php'; |
@@ -63,17 +67,21 @@ discard block |
||
63 | 67 | ) ); |
64 | 68 | |
65 | 69 | $help = '<p>' . __( 'The boxes on your Dashboard screen are:' ) . '</p>'; |
66 | -if ( current_user_can( 'edit_posts' ) ) |
|
70 | +if ( current_user_can( 'edit_posts' ) ) { |
|
67 | 71 | $help .= '<p>' . __( '<strong>At A Glance</strong> — Displays a summary of the content on your site and identifies which theme and version of WordPress you are using.' ) . '</p>'; |
72 | +} |
|
68 | 73 | $help .= '<p>' . __( '<strong>Activity</strong> — Shows the upcoming scheduled posts, recently published posts, and the most recent comments on your posts and allows you to moderate them.' ) . '</p>'; |
69 | -if ( is_blog_admin() && current_user_can( 'edit_posts' ) ) |
|
74 | +if ( is_blog_admin() && current_user_can( 'edit_posts' ) ) { |
|
70 | 75 | $help .= '<p>' . __( "<strong>Quick Draft</strong> — Allows you to create a new post and save it as a draft. Also displays links to the 5 most recent draft posts you've started." ) . '</p>'; |
71 | -if ( ! is_multisite() && current_user_can( 'install_plugins' ) ) |
|
76 | +} |
|
77 | +if ( ! is_multisite() && current_user_can( 'install_plugins' ) ) { |
|
72 | 78 | $help .= '<p>' . __( '<strong>WordPress News</strong> — Latest news from the official WordPress project, the <a href="https://planet.wordpress.org/">WordPress Planet</a>, and popular and recent plugins.' ) . '</p>'; |
73 | -else |
|
79 | +} else { |
|
74 | 80 | $help .= '<p>' . __( '<strong>WordPress News</strong> — Latest news from the official WordPress project, the <a href="https://planet.wordpress.org/">WordPress Planet</a>.' ) . '</p>'; |
75 | -if ( current_user_can( 'edit_theme_options' ) ) |
|
81 | +} |
|
82 | +if ( current_user_can( 'edit_theme_options' ) ) { |
|
76 | 83 | $help .= '<p>' . __( '<strong>Welcome</strong> — Shows links for some of the most common tasks when setting up a new site.' ) . '</p>'; |
84 | +} |
|
77 | 85 | |
78 | 86 | $screen->add_help_tab( array( |
79 | 87 | 'id' => 'help-content', |
@@ -101,8 +109,10 @@ discard block |
||
101 | 109 | $option = get_user_meta( get_current_user_id(), 'show_welcome_panel', true ); |
102 | 110 | // 0 = hide, 1 = toggled to show or single site creator, 2 = multisite site owner |
103 | 111 | $hide = 0 == $option || ( 2 == $option && wp_get_current_user()->user_email != get_option( 'admin_email' ) ); |
104 | - if ( $hide ) |
|
105 | - $classes .= ' hidden'; ?> |
|
112 | + if ( $hide ) { |
|
113 | + $classes .= ' hidden'; |
|
114 | + } |
|
115 | + ?> |
|
106 | 116 | |
107 | 117 | <div id="welcome-panel" class="<?php echo esc_attr( $classes ); ?>"> |
108 | 118 | <?php wp_nonce_field( 'welcome-panel-nonce', 'welcomepanelnonce', false ); ?> |
@@ -1,11 +1,11 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * Multisite sites administration panel. |
|
4 | - * |
|
5 | - * @package WordPress |
|
6 | - * @subpackage Multisite |
|
7 | - * @since 3.0.0 |
|
8 | - */ |
|
3 | + * Multisite sites administration panel. |
|
4 | + * |
|
5 | + * @package WordPress |
|
6 | + * @subpackage Multisite |
|
7 | + * @since 3.0.0 |
|
8 | + */ |
|
9 | 9 | |
10 | 10 | require_once( dirname( __FILE__ ) . '/admin.php' ); |
11 | 11 |
@@ -7,7 +7,7 @@ |
||
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 | -wp_redirect( network_admin_url('sites.php') ); |
|
12 | +wp_redirect(network_admin_url('sites.php')); |
|
13 | 13 | exit; |
@@ -15,87 +15,87 @@ discard block |
||
15 | 15 | wp_reset_vars(array('action')); |
16 | 16 | |
17 | 17 | switch ( $action ) { |
18 | -case 'editattachment' : |
|
19 | - $attachment_id = (int) $_POST['attachment_id']; |
|
20 | - check_admin_referer('media-form'); |
|
21 | - |
|
22 | - if ( !current_user_can('edit_post', $attachment_id) ) |
|
23 | - wp_die ( __('You are not allowed to edit this attachment.') ); |
|
24 | - |
|
25 | - $errors = media_upload_form_handler(); |
|
26 | - |
|
27 | - if ( empty($errors) ) { |
|
28 | - $location = 'media.php'; |
|
29 | - if ( $referer = wp_get_original_referer() ) { |
|
30 | - if ( false !== strpos($referer, 'upload.php') || ( url_to_postid($referer) == $attachment_id ) ) |
|
31 | - $location = $referer; |
|
32 | - } |
|
33 | - if ( false !== strpos($location, 'upload.php') ) { |
|
34 | - $location = remove_query_arg('message', $location); |
|
35 | - $location = add_query_arg('posted', $attachment_id, $location); |
|
36 | - } elseif ( false !== strpos($location, 'media.php') ) { |
|
37 | - $location = add_query_arg('message', 'updated', $location); |
|
18 | + case 'editattachment' : |
|
19 | + $attachment_id = (int) $_POST['attachment_id']; |
|
20 | + check_admin_referer('media-form'); |
|
21 | + |
|
22 | + if ( !current_user_can('edit_post', $attachment_id) ) |
|
23 | + wp_die ( __('You are not allowed to edit this attachment.') ); |
|
24 | + |
|
25 | + $errors = media_upload_form_handler(); |
|
26 | + |
|
27 | + if ( empty($errors) ) { |
|
28 | + $location = 'media.php'; |
|
29 | + if ( $referer = wp_get_original_referer() ) { |
|
30 | + if ( false !== strpos($referer, 'upload.php') || ( url_to_postid($referer) == $attachment_id ) ) |
|
31 | + $location = $referer; |
|
32 | + } |
|
33 | + if ( false !== strpos($location, 'upload.php') ) { |
|
34 | + $location = remove_query_arg('message', $location); |
|
35 | + $location = add_query_arg('posted', $attachment_id, $location); |
|
36 | + } elseif ( false !== strpos($location, 'media.php') ) { |
|
37 | + $location = add_query_arg('message', 'updated', $location); |
|
38 | + } |
|
39 | + wp_redirect($location); |
|
40 | + exit; |
|
38 | 41 | } |
39 | - wp_redirect($location); |
|
40 | - exit; |
|
41 | - } |
|
42 | 42 | |
43 | - // No break. |
|
44 | -case 'edit' : |
|
45 | - $title = __('Edit Media'); |
|
43 | + // No break. |
|
44 | + case 'edit' : |
|
45 | + $title = __('Edit Media'); |
|
46 | 46 | |
47 | - if ( empty($errors) ) |
|
48 | - $errors = null; |
|
47 | + if ( empty($errors) ) |
|
48 | + $errors = null; |
|
49 | 49 | |
50 | - if ( empty( $_GET['attachment_id'] ) ) { |
|
51 | - wp_redirect( admin_url('upload.php') ); |
|
52 | - exit(); |
|
53 | - } |
|
54 | - $att_id = (int) $_GET['attachment_id']; |
|
55 | - |
|
56 | - if ( !current_user_can('edit_post', $att_id) ) |
|
57 | - wp_die ( __('You are not allowed to edit this attachment.') ); |
|
58 | - |
|
59 | - $att = get_post($att_id); |
|
60 | - |
|
61 | - if ( empty($att->ID) ) wp_die( __('You attempted to edit an attachment that doesn’t exist. Perhaps it was deleted?') ); |
|
62 | - if ( 'attachment' !== $att->post_type ) wp_die( __('You attempted to edit an item that isn’t an attachment. Please go back and try again.') ); |
|
63 | - if ( $att->post_status == 'trash' ) wp_die( __('You can’t edit this attachment because it is in the Trash. Please move it out of the Trash and try again.') ); |
|
64 | - |
|
65 | - add_filter('attachment_fields_to_edit', 'media_single_attachment_fields_to_edit', 10, 2); |
|
66 | - |
|
67 | - wp_enqueue_script( 'wp-ajax-response' ); |
|
68 | - wp_enqueue_script('image-edit'); |
|
69 | - wp_enqueue_style('imgareaselect'); |
|
70 | - |
|
71 | - get_current_screen()->add_help_tab( array( |
|
72 | - 'id' => 'overview', |
|
73 | - 'title' => __('Overview'), |
|
74 | - 'content' => |
|
75 | - '<p>' . __('This screen allows you to edit five fields for metadata in a file within the media library.') . '</p>' . |
|
76 | - '<p>' . __('For images only, you can click on Edit Image under the thumbnail to expand out an inline image editor with icons for cropping, rotating, or flipping the image as well as for undoing and redoing. The boxes on the right give you more options for scaling the image, for cropping it, and for cropping the thumbnail in a different way than you crop the original image. You can click on Help in those boxes to get more information.') . '</p>' . |
|
77 | - '<p>' . __('Note that you crop the image by clicking on it (the Crop icon is already selected) and dragging the cropping frame to select the desired part. Then click Save to retain the cropping.') . '</p>' . |
|
78 | - '<p>' . __('Remember to click Update Media to save metadata entered or changed.') . '</p>' |
|
79 | - ) ); |
|
80 | - |
|
81 | - get_current_screen()->set_help_sidebar( |
|
82 | - '<p><strong>' . __('For more information:') . '</strong></p>' . |
|
83 | - '<p>' . __('<a href="https://codex.wordpress.org/Media_Add_New_Screen#Edit_Media" target="_blank">Documentation on Edit Media</a>') . '</p>' . |
|
84 | - '<p>' . __('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>' |
|
85 | - ); |
|
86 | - |
|
87 | - require( ABSPATH . 'wp-admin/admin-header.php' ); |
|
88 | - |
|
89 | - $parent_file = 'upload.php'; |
|
90 | - $message = ''; |
|
91 | - $class = ''; |
|
92 | - if ( isset($_GET['message']) ) { |
|
93 | - switch ( $_GET['message'] ) { |
|
50 | + if ( empty( $_GET['attachment_id'] ) ) { |
|
51 | + wp_redirect( admin_url('upload.php') ); |
|
52 | + exit(); |
|
53 | + } |
|
54 | + $att_id = (int) $_GET['attachment_id']; |
|
55 | + |
|
56 | + if ( !current_user_can('edit_post', $att_id) ) |
|
57 | + wp_die ( __('You are not allowed to edit this attachment.') ); |
|
58 | + |
|
59 | + $att = get_post($att_id); |
|
60 | + |
|
61 | + if ( empty($att->ID) ) wp_die( __('You attempted to edit an attachment that doesn’t exist. Perhaps it was deleted?') ); |
|
62 | + if ( 'attachment' !== $att->post_type ) wp_die( __('You attempted to edit an item that isn’t an attachment. Please go back and try again.') ); |
|
63 | + if ( $att->post_status == 'trash' ) wp_die( __('You can’t edit this attachment because it is in the Trash. Please move it out of the Trash and try again.') ); |
|
64 | + |
|
65 | + add_filter('attachment_fields_to_edit', 'media_single_attachment_fields_to_edit', 10, 2); |
|
66 | + |
|
67 | + wp_enqueue_script( 'wp-ajax-response' ); |
|
68 | + wp_enqueue_script('image-edit'); |
|
69 | + wp_enqueue_style('imgareaselect'); |
|
70 | + |
|
71 | + get_current_screen()->add_help_tab( array( |
|
72 | + 'id' => 'overview', |
|
73 | + 'title' => __('Overview'), |
|
74 | + 'content' => |
|
75 | + '<p>' . __('This screen allows you to edit five fields for metadata in a file within the media library.') . '</p>' . |
|
76 | + '<p>' . __('For images only, you can click on Edit Image under the thumbnail to expand out an inline image editor with icons for cropping, rotating, or flipping the image as well as for undoing and redoing. The boxes on the right give you more options for scaling the image, for cropping it, and for cropping the thumbnail in a different way than you crop the original image. You can click on Help in those boxes to get more information.') . '</p>' . |
|
77 | + '<p>' . __('Note that you crop the image by clicking on it (the Crop icon is already selected) and dragging the cropping frame to select the desired part. Then click Save to retain the cropping.') . '</p>' . |
|
78 | + '<p>' . __('Remember to click Update Media to save metadata entered or changed.') . '</p>' |
|
79 | + ) ); |
|
80 | + |
|
81 | + get_current_screen()->set_help_sidebar( |
|
82 | + '<p><strong>' . __('For more information:') . '</strong></p>' . |
|
83 | + '<p>' . __('<a href="https://codex.wordpress.org/Media_Add_New_Screen#Edit_Media" target="_blank">Documentation on Edit Media</a>') . '</p>' . |
|
84 | + '<p>' . __('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>' |
|
85 | + ); |
|
86 | + |
|
87 | + require( ABSPATH . 'wp-admin/admin-header.php' ); |
|
88 | + |
|
89 | + $parent_file = 'upload.php'; |
|
90 | + $message = ''; |
|
91 | + $class = ''; |
|
92 | + if ( isset($_GET['message']) ) { |
|
93 | + switch ( $_GET['message'] ) { |
|
94 | 94 | case 'updated' : |
95 | 95 | $message = __('Media attachment updated.'); |
96 | 96 | $class = 'updated'; |
97 | 97 | break; |
98 | - } |
|
98 | + } |
|
99 | 99 | } |
100 | 100 | if ( $message ) |
101 | 101 | echo "<div id='message' class='$class'><p>$message</p></div>\n"; |
@@ -139,8 +139,8 @@ discard block |
||
139 | 139 | |
140 | 140 | exit; |
141 | 141 | |
142 | -default: |
|
143 | - wp_redirect( admin_url('upload.php') ); |
|
144 | - exit; |
|
142 | + default: |
|
143 | + wp_redirect( admin_url('upload.php') ); |
|
144 | + exit; |
|
145 | 145 | |
146 | 146 | } |
@@ -7,33 +7,33 @@ discard block |
||
7 | 7 | */ |
8 | 8 | |
9 | 9 | /** Load WordPress Administration Bootstrap */ |
10 | -require_once( dirname( __FILE__ ) . '/admin.php' ); |
|
10 | +require_once(dirname(__FILE__).'/admin.php'); |
|
11 | 11 | |
12 | 12 | $parent_file = 'upload.php'; |
13 | 13 | $submenu_file = 'upload.php'; |
14 | 14 | |
15 | 15 | wp_reset_vars(array('action')); |
16 | 16 | |
17 | -switch ( $action ) { |
|
17 | +switch ($action) { |
|
18 | 18 | case 'editattachment' : |
19 | 19 | $attachment_id = (int) $_POST['attachment_id']; |
20 | 20 | check_admin_referer('media-form'); |
21 | 21 | |
22 | - if ( !current_user_can('edit_post', $attachment_id) ) |
|
23 | - wp_die ( __('You are not allowed to edit this attachment.') ); |
|
22 | + if ( ! current_user_can('edit_post', $attachment_id)) |
|
23 | + wp_die(__('You are not allowed to edit this attachment.')); |
|
24 | 24 | |
25 | 25 | $errors = media_upload_form_handler(); |
26 | 26 | |
27 | - if ( empty($errors) ) { |
|
27 | + if (empty($errors)) { |
|
28 | 28 | $location = 'media.php'; |
29 | - if ( $referer = wp_get_original_referer() ) { |
|
30 | - if ( false !== strpos($referer, 'upload.php') || ( url_to_postid($referer) == $attachment_id ) ) |
|
29 | + if ($referer = wp_get_original_referer()) { |
|
30 | + if (false !== strpos($referer, 'upload.php') || (url_to_postid($referer) == $attachment_id)) |
|
31 | 31 | $location = $referer; |
32 | 32 | } |
33 | - if ( false !== strpos($location, 'upload.php') ) { |
|
33 | + if (false !== strpos($location, 'upload.php')) { |
|
34 | 34 | $location = remove_query_arg('message', $location); |
35 | - $location = add_query_arg('posted', $attachment_id, $location); |
|
36 | - } elseif ( false !== strpos($location, 'media.php') ) { |
|
35 | + $location = add_query_arg('posted', $attachment_id, $location); |
|
36 | + } elseif (false !== strpos($location, 'media.php')) { |
|
37 | 37 | $location = add_query_arg('message', 'updated', $location); |
38 | 38 | } |
39 | 39 | wp_redirect($location); |
@@ -44,60 +44,60 @@ discard block |
||
44 | 44 | case 'edit' : |
45 | 45 | $title = __('Edit Media'); |
46 | 46 | |
47 | - if ( empty($errors) ) |
|
47 | + if (empty($errors)) |
|
48 | 48 | $errors = null; |
49 | 49 | |
50 | - if ( empty( $_GET['attachment_id'] ) ) { |
|
51 | - wp_redirect( admin_url('upload.php') ); |
|
50 | + if (empty($_GET['attachment_id'])) { |
|
51 | + wp_redirect(admin_url('upload.php')); |
|
52 | 52 | exit(); |
53 | 53 | } |
54 | 54 | $att_id = (int) $_GET['attachment_id']; |
55 | 55 | |
56 | - if ( !current_user_can('edit_post', $att_id) ) |
|
57 | - wp_die ( __('You are not allowed to edit this attachment.') ); |
|
56 | + if ( ! current_user_can('edit_post', $att_id)) |
|
57 | + wp_die(__('You are not allowed to edit this attachment.')); |
|
58 | 58 | |
59 | 59 | $att = get_post($att_id); |
60 | 60 | |
61 | - if ( empty($att->ID) ) wp_die( __('You attempted to edit an attachment that doesn’t exist. Perhaps it was deleted?') ); |
|
62 | - if ( 'attachment' !== $att->post_type ) wp_die( __('You attempted to edit an item that isn’t an attachment. Please go back and try again.') ); |
|
63 | - if ( $att->post_status == 'trash' ) wp_die( __('You can’t edit this attachment because it is in the Trash. Please move it out of the Trash and try again.') ); |
|
61 | + if (empty($att->ID)) wp_die(__('You attempted to edit an attachment that doesn’t exist. Perhaps it was deleted?')); |
|
62 | + if ('attachment' !== $att->post_type) wp_die(__('You attempted to edit an item that isn’t an attachment. Please go back and try again.')); |
|
63 | + if ($att->post_status == 'trash') wp_die(__('You can’t edit this attachment because it is in the Trash. Please move it out of the Trash and try again.')); |
|
64 | 64 | |
65 | 65 | add_filter('attachment_fields_to_edit', 'media_single_attachment_fields_to_edit', 10, 2); |
66 | 66 | |
67 | - wp_enqueue_script( 'wp-ajax-response' ); |
|
67 | + wp_enqueue_script('wp-ajax-response'); |
|
68 | 68 | wp_enqueue_script('image-edit'); |
69 | 69 | wp_enqueue_style('imgareaselect'); |
70 | 70 | |
71 | - get_current_screen()->add_help_tab( array( |
|
71 | + get_current_screen()->add_help_tab(array( |
|
72 | 72 | 'id' => 'overview', |
73 | 73 | 'title' => __('Overview'), |
74 | 74 | 'content' => |
75 | - '<p>' . __('This screen allows you to edit five fields for metadata in a file within the media library.') . '</p>' . |
|
76 | - '<p>' . __('For images only, you can click on Edit Image under the thumbnail to expand out an inline image editor with icons for cropping, rotating, or flipping the image as well as for undoing and redoing. The boxes on the right give you more options for scaling the image, for cropping it, and for cropping the thumbnail in a different way than you crop the original image. You can click on Help in those boxes to get more information.') . '</p>' . |
|
77 | - '<p>' . __('Note that you crop the image by clicking on it (the Crop icon is already selected) and dragging the cropping frame to select the desired part. Then click Save to retain the cropping.') . '</p>' . |
|
78 | - '<p>' . __('Remember to click Update Media to save metadata entered or changed.') . '</p>' |
|
79 | - ) ); |
|
75 | + '<p>'.__('This screen allows you to edit five fields for metadata in a file within the media library.').'</p>'. |
|
76 | + '<p>'.__('For images only, you can click on Edit Image under the thumbnail to expand out an inline image editor with icons for cropping, rotating, or flipping the image as well as for undoing and redoing. The boxes on the right give you more options for scaling the image, for cropping it, and for cropping the thumbnail in a different way than you crop the original image. You can click on Help in those boxes to get more information.').'</p>'. |
|
77 | + '<p>'.__('Note that you crop the image by clicking on it (the Crop icon is already selected) and dragging the cropping frame to select the desired part. Then click Save to retain the cropping.').'</p>'. |
|
78 | + '<p>'.__('Remember to click Update Media to save metadata entered or changed.').'</p>' |
|
79 | + )); |
|
80 | 80 | |
81 | 81 | get_current_screen()->set_help_sidebar( |
82 | - '<p><strong>' . __('For more information:') . '</strong></p>' . |
|
83 | - '<p>' . __('<a href="https://codex.wordpress.org/Media_Add_New_Screen#Edit_Media" target="_blank">Documentation on Edit Media</a>') . '</p>' . |
|
84 | - '<p>' . __('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>' |
|
82 | + '<p><strong>'.__('For more information:').'</strong></p>'. |
|
83 | + '<p>'.__('<a href="https://codex.wordpress.org/Media_Add_New_Screen#Edit_Media" target="_blank">Documentation on Edit Media</a>').'</p>'. |
|
84 | + '<p>'.__('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>').'</p>' |
|
85 | 85 | ); |
86 | 86 | |
87 | - require( ABSPATH . 'wp-admin/admin-header.php' ); |
|
87 | + require(ABSPATH.'wp-admin/admin-header.php'); |
|
88 | 88 | |
89 | 89 | $parent_file = 'upload.php'; |
90 | 90 | $message = ''; |
91 | 91 | $class = ''; |
92 | - if ( isset($_GET['message']) ) { |
|
93 | - switch ( $_GET['message'] ) { |
|
92 | + if (isset($_GET['message'])) { |
|
93 | + switch ($_GET['message']) { |
|
94 | 94 | case 'updated' : |
95 | 95 | $message = __('Media attachment updated.'); |
96 | 96 | $class = 'updated'; |
97 | 97 | break; |
98 | 98 | } |
99 | 99 | } |
100 | - if ( $message ) |
|
100 | + if ($message) |
|
101 | 101 | echo "<div id='message' class='$class'><p>$message</p></div>\n"; |
102 | 102 | |
103 | 103 | ?> |
@@ -105,24 +105,24 @@ discard block |
||
105 | 105 | <div class="wrap"> |
106 | 106 | <h1> |
107 | 107 | <?php |
108 | -echo esc_html( $title ); |
|
109 | -if ( current_user_can( 'upload_files' ) ) { ?> |
|
108 | +echo esc_html($title); |
|
109 | +if (current_user_can('upload_files')) { ?> |
|
110 | 110 | <a href="media-new.php" class="page-title-action"><?php echo esc_html_x('Add New', 'file'); ?></a> |
111 | 111 | <?php } ?> |
112 | 112 | </h1> |
113 | 113 | |
114 | 114 | <form method="post" class="media-upload-form" id="media-single-form"> |
115 | 115 | <p class="submit" style="padding-bottom: 0;"> |
116 | -<?php submit_button( __( 'Update Media' ), 'primary', 'save', false ); ?> |
|
116 | +<?php submit_button(__('Update Media'), 'primary', 'save', false); ?> |
|
117 | 117 | </p> |
118 | 118 | |
119 | 119 | <div class="media-single"> |
120 | 120 | <div id="media-item-<?php echo $att_id; ?>" class="media-item"> |
121 | -<?php echo get_media_item( $att_id, array( 'toggle' => false, 'send' => false, 'delete' => false, 'show_title' => false, 'errors' => !empty($errors[$att_id]) ? $errors[$att_id] : null ) ); ?> |
|
121 | +<?php echo get_media_item($att_id, array('toggle' => false, 'send' => false, 'delete' => false, 'show_title' => false, 'errors' => ! empty($errors[$att_id]) ? $errors[$att_id] : null)); ?> |
|
122 | 122 | </div> |
123 | 123 | </div> |
124 | 124 | |
125 | -<?php submit_button( __( 'Update Media' ), 'primary', 'save' ); ?> |
|
125 | +<?php submit_button(__('Update Media'), 'primary', 'save'); ?> |
|
126 | 126 | <input type="hidden" name="post_id" id="post_id" value="<?php echo isset($post_id) ? esc_attr($post_id) : ''; ?>" /> |
127 | 127 | <input type="hidden" name="attachment_id" id="attachment_id" value="<?php echo esc_attr($att_id); ?>" /> |
128 | 128 | <input type="hidden" name="action" value="editattachment" /> |
@@ -135,12 +135,12 @@ discard block |
||
135 | 135 | |
136 | 136 | <?php |
137 | 137 | |
138 | - require( ABSPATH . 'wp-admin/admin-footer.php' ); |
|
138 | + require(ABSPATH.'wp-admin/admin-footer.php'); |
|
139 | 139 | |
140 | 140 | exit; |
141 | 141 | |
142 | 142 | default: |
143 | - wp_redirect( admin_url('upload.php') ); |
|
143 | + wp_redirect(admin_url('upload.php')); |
|
144 | 144 | exit; |
145 | 145 | |
146 | 146 | } |
@@ -19,16 +19,18 @@ discard block |
||
19 | 19 | $attachment_id = (int) $_POST['attachment_id']; |
20 | 20 | check_admin_referer('media-form'); |
21 | 21 | |
22 | - if ( !current_user_can('edit_post', $attachment_id) ) |
|
23 | - wp_die ( __('You are not allowed to edit this attachment.') ); |
|
22 | + if ( !current_user_can('edit_post', $attachment_id) ) { |
|
23 | + wp_die ( __('You are not allowed to edit this attachment.') ); |
|
24 | + } |
|
24 | 25 | |
25 | 26 | $errors = media_upload_form_handler(); |
26 | 27 | |
27 | 28 | if ( empty($errors) ) { |
28 | 29 | $location = 'media.php'; |
29 | 30 | if ( $referer = wp_get_original_referer() ) { |
30 | - if ( false !== strpos($referer, 'upload.php') || ( url_to_postid($referer) == $attachment_id ) ) |
|
31 | - $location = $referer; |
|
31 | + if ( false !== strpos($referer, 'upload.php') || ( url_to_postid($referer) == $attachment_id ) ) { |
|
32 | + $location = $referer; |
|
33 | + } |
|
32 | 34 | } |
33 | 35 | if ( false !== strpos($location, 'upload.php') ) { |
34 | 36 | $location = remove_query_arg('message', $location); |
@@ -44,8 +46,9 @@ discard block |
||
44 | 46 | case 'edit' : |
45 | 47 | $title = __('Edit Media'); |
46 | 48 | |
47 | - if ( empty($errors) ) |
|
48 | - $errors = null; |
|
49 | + if ( empty($errors) ) { |
|
50 | + $errors = null; |
|
51 | + } |
|
49 | 52 | |
50 | 53 | if ( empty( $_GET['attachment_id'] ) ) { |
51 | 54 | wp_redirect( admin_url('upload.php') ); |
@@ -53,14 +56,21 @@ discard block |
||
53 | 56 | } |
54 | 57 | $att_id = (int) $_GET['attachment_id']; |
55 | 58 | |
56 | - if ( !current_user_can('edit_post', $att_id) ) |
|
57 | - wp_die ( __('You are not allowed to edit this attachment.') ); |
|
59 | + if ( !current_user_can('edit_post', $att_id) ) { |
|
60 | + wp_die ( __('You are not allowed to edit this attachment.') ); |
|
61 | + } |
|
58 | 62 | |
59 | 63 | $att = get_post($att_id); |
60 | 64 | |
61 | - if ( empty($att->ID) ) wp_die( __('You attempted to edit an attachment that doesn’t exist. Perhaps it was deleted?') ); |
|
62 | - if ( 'attachment' !== $att->post_type ) wp_die( __('You attempted to edit an item that isn’t an attachment. Please go back and try again.') ); |
|
63 | - if ( $att->post_status == 'trash' ) wp_die( __('You can’t edit this attachment because it is in the Trash. Please move it out of the Trash and try again.') ); |
|
65 | + if ( empty($att->ID) ) { |
|
66 | + wp_die( __('You attempted to edit an attachment that doesn’t exist. Perhaps it was deleted?') ); |
|
67 | + } |
|
68 | + if ( 'attachment' !== $att->post_type ) { |
|
69 | + wp_die( __('You attempted to edit an item that isn’t an attachment. Please go back and try again.') ); |
|
70 | + } |
|
71 | + if ( $att->post_status == 'trash' ) { |
|
72 | + wp_die( __('You can’t edit this attachment because it is in the Trash. Please move it out of the Trash and try again.') ); |
|
73 | + } |
|
64 | 74 | |
65 | 75 | add_filter('attachment_fields_to_edit', 'media_single_attachment_fields_to_edit', 10, 2); |
66 | 76 | |
@@ -97,8 +107,9 @@ discard block |
||
97 | 107 | break; |
98 | 108 | } |
99 | 109 | } |
100 | - if ( $message ) |
|
101 | - echo "<div id='message' class='$class'><p>$message</p></div>\n"; |
|
110 | + if ( $message ) { |
|
111 | + echo "<div id='message' class='$class'><p>$message</p></div>\n"; |
|
112 | + } |
|
102 | 113 | |
103 | 114 | ?> |
104 | 115 |
@@ -8,6 +8,6 @@ |
||
8 | 8 | */ |
9 | 9 | |
10 | 10 | /** Load WordPress Administration Bootstrap */ |
11 | -require_once( dirname( __FILE__ ) . '/admin.php' ); |
|
11 | +require_once(dirname(__FILE__).'/admin.php'); |
|
12 | 12 | |
13 | -require( ABSPATH . 'wp-admin/user-edit.php' ); |
|
13 | +require(ABSPATH.'wp-admin/user-edit.php'); |
@@ -8,6 +8,6 @@ |
||
8 | 8 | */ |
9 | 9 | |
10 | 10 | /** Load WordPress Administration Bootstrap */ |
11 | -require_once( dirname( __FILE__ ) . '/admin.php' ); |
|
11 | +require_once(dirname(__FILE__).'/admin.php'); |
|
12 | 12 | |
13 | -require( ABSPATH . 'wp-admin/credits.php' ); |
|
13 | +require(ABSPATH.'wp-admin/credits.php'); |
@@ -8,6 +8,6 @@ |
||
8 | 8 | */ |
9 | 9 | |
10 | 10 | /** Load WordPress Administration Bootstrap */ |
11 | -require_once( dirname( __FILE__ ) . '/admin.php' ); |
|
11 | +require_once(dirname(__FILE__).'/admin.php'); |
|
12 | 12 | |
13 | -require( ABSPATH . 'wp-admin/index.php' ); |
|
13 | +require(ABSPATH.'wp-admin/index.php'); |