@@ -1,10 +1,10 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * Themes administration panel. |
|
4 | - * |
|
5 | - * @package WordPress |
|
6 | - * @subpackage Administration |
|
7 | - */ |
|
3 | + * Themes administration panel. |
|
4 | + * |
|
5 | + * @package WordPress |
|
6 | + * @subpackage Administration |
|
7 | + */ |
|
8 | 8 | |
9 | 9 | /** WordPress Administration Bootstrap */ |
10 | 10 | require_once( dirname( __FILE__ ) . '/admin.php' ); |
@@ -7,31 +7,31 @@ discard block |
||
7 | 7 | */ |
8 | 8 | |
9 | 9 | /** WordPress Administration Bootstrap */ |
10 | -require_once( dirname( __FILE__ ) . '/admin.php' ); |
|
11 | - |
|
12 | -if ( !current_user_can('switch_themes') && !current_user_can('edit_theme_options') ) |
|
13 | - wp_die( __( 'Cheatin’ uh?' ), 403 ); |
|
14 | - |
|
15 | -if ( current_user_can( 'switch_themes' ) && isset($_GET['action'] ) ) { |
|
16 | - if ( 'activate' == $_GET['action'] ) { |
|
17 | - check_admin_referer('switch-theme_' . $_GET['stylesheet']); |
|
18 | - $theme = wp_get_theme( $_GET['stylesheet'] ); |
|
19 | - if ( ! $theme->exists() || ! $theme->is_allowed() ) |
|
20 | - wp_die( __( 'Cheatin’ uh?' ), 403 ); |
|
21 | - switch_theme( $theme->get_stylesheet() ); |
|
22 | - wp_redirect( admin_url('themes.php?activated=true') ); |
|
10 | +require_once(dirname(__FILE__).'/admin.php'); |
|
11 | + |
|
12 | +if ( ! current_user_can('switch_themes') && ! current_user_can('edit_theme_options')) |
|
13 | + wp_die(__('Cheatin’ uh?'), 403); |
|
14 | + |
|
15 | +if (current_user_can('switch_themes') && isset($_GET['action'])) { |
|
16 | + if ('activate' == $_GET['action']) { |
|
17 | + check_admin_referer('switch-theme_'.$_GET['stylesheet']); |
|
18 | + $theme = wp_get_theme($_GET['stylesheet']); |
|
19 | + if ( ! $theme->exists() || ! $theme->is_allowed()) |
|
20 | + wp_die(__('Cheatin’ uh?'), 403); |
|
21 | + switch_theme($theme->get_stylesheet()); |
|
22 | + wp_redirect(admin_url('themes.php?activated=true')); |
|
23 | 23 | exit; |
24 | - } elseif ( 'delete' == $_GET['action'] ) { |
|
25 | - check_admin_referer('delete-theme_' . $_GET['stylesheet']); |
|
26 | - $theme = wp_get_theme( $_GET['stylesheet'] ); |
|
27 | - if ( !current_user_can('delete_themes') || ! $theme->exists() ) |
|
28 | - wp_die( __( 'Cheatin’ uh?' ), 403 ); |
|
24 | + } elseif ('delete' == $_GET['action']) { |
|
25 | + check_admin_referer('delete-theme_'.$_GET['stylesheet']); |
|
26 | + $theme = wp_get_theme($_GET['stylesheet']); |
|
27 | + if ( ! current_user_can('delete_themes') || ! $theme->exists()) |
|
28 | + wp_die(__('Cheatin’ uh?'), 403); |
|
29 | 29 | $active = wp_get_theme(); |
30 | - if ( $active->get( 'Template' ) == $_GET['stylesheet'] ) { |
|
31 | - wp_redirect( admin_url( 'themes.php?delete-active-child=true' ) ); |
|
30 | + if ($active->get('Template') == $_GET['stylesheet']) { |
|
31 | + wp_redirect(admin_url('themes.php?delete-active-child=true')); |
|
32 | 32 | } else { |
33 | - delete_theme( $_GET['stylesheet'] ); |
|
34 | - wp_redirect( admin_url( 'themes.php?deleted=true' ) ); |
|
33 | + delete_theme($_GET['stylesheet']); |
|
34 | + wp_redirect(admin_url('themes.php?deleted=true')); |
|
35 | 35 | } |
36 | 36 | exit; |
37 | 37 | } |
@@ -41,115 +41,115 @@ discard block |
||
41 | 41 | $parent_file = 'themes.php'; |
42 | 42 | |
43 | 43 | // Help tab: Overview |
44 | -if ( current_user_can( 'switch_themes' ) ) { |
|
45 | - $help_overview = '<p>' . __( 'This screen is used for managing your installed themes. Aside from the default theme(s) included with your WordPress installation, themes are designed and developed by third parties.' ) . '</p>' . |
|
46 | - '<p>' . __( 'From this screen you can:' ) . '</p>' . |
|
47 | - '<ul><li>' . __( 'Hover or tap to see Activate and Live Preview buttons' ) . '</li>' . |
|
48 | - '<li>' . __( 'Click on the theme to see the theme name, version, author, description, tags, and the Delete link' ) . '</li>' . |
|
49 | - '<li>' . __( 'Click Customize for the current theme or Live Preview for any other theme to see a live preview' ) . '</li></ul>' . |
|
50 | - '<p>' . __( 'The current theme is displayed highlighted as the first theme.' ) . '</p>' . |
|
51 | - '<p>' . __( 'The search for installed themes will search for terms in their name, description, author, or tag.' ) . ' <span id="live-search-desc">' . __( 'The search results will be updated as you type.' ) . '</span></p>'; |
|
52 | - |
|
53 | - get_current_screen()->add_help_tab( array( |
|
44 | +if (current_user_can('switch_themes')) { |
|
45 | + $help_overview = '<p>'.__('This screen is used for managing your installed themes. Aside from the default theme(s) included with your WordPress installation, themes are designed and developed by third parties.').'</p>'. |
|
46 | + '<p>'.__('From this screen you can:').'</p>'. |
|
47 | + '<ul><li>'.__('Hover or tap to see Activate and Live Preview buttons').'</li>'. |
|
48 | + '<li>'.__('Click on the theme to see the theme name, version, author, description, tags, and the Delete link').'</li>'. |
|
49 | + '<li>'.__('Click Customize for the current theme or Live Preview for any other theme to see a live preview').'</li></ul>'. |
|
50 | + '<p>'.__('The current theme is displayed highlighted as the first theme.').'</p>'. |
|
51 | + '<p>'.__('The search for installed themes will search for terms in their name, description, author, or tag.').' <span id="live-search-desc">'.__('The search results will be updated as you type.').'</span></p>'; |
|
52 | + |
|
53 | + get_current_screen()->add_help_tab(array( |
|
54 | 54 | 'id' => 'overview', |
55 | - 'title' => __( 'Overview' ), |
|
55 | + 'title' => __('Overview'), |
|
56 | 56 | 'content' => $help_overview |
57 | - ) ); |
|
57 | + )); |
|
58 | 58 | } // switch_themes |
59 | 59 | |
60 | 60 | // Help tab: Adding Themes |
61 | -if ( current_user_can( 'install_themes' ) ) { |
|
62 | - if ( is_multisite() ) { |
|
63 | - $help_install = '<p>' . __('Installing themes on Multisite can only be done from the Network Admin section.') . '</p>'; |
|
61 | +if (current_user_can('install_themes')) { |
|
62 | + if (is_multisite()) { |
|
63 | + $help_install = '<p>'.__('Installing themes on Multisite can only be done from the Network Admin section.').'</p>'; |
|
64 | 64 | } else { |
65 | - $help_install = '<p>' . sprintf( __('If you would like to see more themes to choose from, click on the “Add New” button and you will be able to browse or search for additional themes from the <a href="%s" target="_blank">WordPress.org Theme Directory</a>. Themes in the WordPress.org Theme Directory are designed and developed by third parties, and are compatible with the license WordPress uses. Oh, and they’re free!'), 'https://wordpress.org/themes/' ) . '</p>'; |
|
65 | + $help_install = '<p>'.sprintf(__('If you would like to see more themes to choose from, click on the “Add New” button and you will be able to browse or search for additional themes from the <a href="%s" target="_blank">WordPress.org Theme Directory</a>. Themes in the WordPress.org Theme Directory are designed and developed by third parties, and are compatible with the license WordPress uses. Oh, and they’re free!'), 'https://wordpress.org/themes/').'</p>'; |
|
66 | 66 | } |
67 | 67 | |
68 | - get_current_screen()->add_help_tab( array( |
|
68 | + get_current_screen()->add_help_tab(array( |
|
69 | 69 | 'id' => 'adding-themes', |
70 | 70 | 'title' => __('Adding Themes'), |
71 | 71 | 'content' => $help_install |
72 | - ) ); |
|
72 | + )); |
|
73 | 73 | } // install_themes |
74 | 74 | |
75 | 75 | // Help tab: Previewing and Customizing |
76 | -if ( current_user_can( 'edit_theme_options' ) && current_user_can( 'customize' ) ) { |
|
76 | +if (current_user_can('edit_theme_options') && current_user_can('customize')) { |
|
77 | 77 | $help_customize = |
78 | - '<p>' . __( 'Tap or hover on any theme then click the Live Preview button to see a live preview of that theme and change theme options in a separate, full-screen view. You can also find a Live Preview button at the bottom of the theme details screen. Any installed theme can be previewed and customized in this way.' ) . '</p>'. |
|
79 | - '<p>' . __( 'The theme being previewed is fully interactive — navigate to different pages to see how the theme handles posts, archives, and other page templates. The settings may differ depending on what theme features the theme being previewed supports. To accept the new settings and activate the theme all in one step, click the Save & Activate button above the menu.' ) . '</p>' . |
|
80 | - '<p>' . __( 'When previewing on smaller monitors, you can use the collapse icon at the bottom of the left-hand pane. This will hide the pane, giving you more room to preview your site in the new theme. To bring the pane back, click on the collapse icon again.' ) . '</p>'; |
|
78 | + '<p>'.__('Tap or hover on any theme then click the Live Preview button to see a live preview of that theme and change theme options in a separate, full-screen view. You can also find a Live Preview button at the bottom of the theme details screen. Any installed theme can be previewed and customized in this way.').'</p>'. |
|
79 | + '<p>'.__('The theme being previewed is fully interactive — navigate to different pages to see how the theme handles posts, archives, and other page templates. The settings may differ depending on what theme features the theme being previewed supports. To accept the new settings and activate the theme all in one step, click the Save & Activate button above the menu.').'</p>'. |
|
80 | + '<p>'.__('When previewing on smaller monitors, you can use the collapse icon at the bottom of the left-hand pane. This will hide the pane, giving you more room to preview your site in the new theme. To bring the pane back, click on the collapse icon again.').'</p>'; |
|
81 | 81 | |
82 | - get_current_screen()->add_help_tab( array( |
|
82 | + get_current_screen()->add_help_tab(array( |
|
83 | 83 | 'id' => 'customize-preview-themes', |
84 | - 'title' => __( 'Previewing and Customizing' ), |
|
84 | + 'title' => __('Previewing and Customizing'), |
|
85 | 85 | 'content' => $help_customize |
86 | - ) ); |
|
86 | + )); |
|
87 | 87 | } // edit_theme_options && customize |
88 | 88 | |
89 | 89 | get_current_screen()->set_help_sidebar( |
90 | - '<p><strong>' . __( 'For more information:' ) . '</strong></p>' . |
|
91 | - '<p>' . __( '<a href="https://codex.wordpress.org/Using_Themes" target="_blank">Documentation on Using Themes</a>' ) . '</p>' . |
|
92 | - '<p>' . __( '<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>' ) . '</p>' |
|
90 | + '<p><strong>'.__('For more information:').'</strong></p>'. |
|
91 | + '<p>'.__('<a href="https://codex.wordpress.org/Using_Themes" target="_blank">Documentation on Using Themes</a>').'</p>'. |
|
92 | + '<p>'.__('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>').'</p>' |
|
93 | 93 | ); |
94 | 94 | |
95 | -if ( current_user_can( 'switch_themes' ) ) { |
|
95 | +if (current_user_can('switch_themes')) { |
|
96 | 96 | $themes = wp_prepare_themes_for_js(); |
97 | 97 | } else { |
98 | - $themes = wp_prepare_themes_for_js( array( wp_get_theme() ) ); |
|
98 | + $themes = wp_prepare_themes_for_js(array(wp_get_theme())); |
|
99 | 99 | } |
100 | -wp_reset_vars( array( 'theme', 'search' ) ); |
|
100 | +wp_reset_vars(array('theme', 'search')); |
|
101 | 101 | |
102 | -wp_localize_script( 'theme', '_wpThemeSettings', array( |
|
102 | +wp_localize_script('theme', '_wpThemeSettings', array( |
|
103 | 103 | 'themes' => $themes, |
104 | 104 | 'settings' => array( |
105 | - 'canInstall' => ( ! is_multisite() && current_user_can( 'install_themes' ) ), |
|
106 | - 'installURI' => ( ! is_multisite() && current_user_can( 'install_themes' ) ) ? admin_url( 'theme-install.php' ) : null, |
|
107 | - 'confirmDelete' => __( "Are you sure you want to delete this theme?\n\nClick 'Cancel' to go back, 'OK' to confirm the delete." ), |
|
108 | - 'adminUrl' => parse_url( admin_url(), PHP_URL_PATH ), |
|
105 | + 'canInstall' => ( ! is_multisite() && current_user_can('install_themes')), |
|
106 | + 'installURI' => ( ! is_multisite() && current_user_can('install_themes')) ? admin_url('theme-install.php') : null, |
|
107 | + 'confirmDelete' => __("Are you sure you want to delete this theme?\n\nClick 'Cancel' to go back, 'OK' to confirm the delete."), |
|
108 | + 'adminUrl' => parse_url(admin_url(), PHP_URL_PATH), |
|
109 | 109 | ), |
110 | 110 | 'l10n' => array( |
111 | - 'addNew' => __( 'Add New Theme' ), |
|
112 | - 'search' => __( 'Search Installed Themes' ), |
|
113 | - 'searchPlaceholder' => __( 'Search installed themes...' ), // placeholder (no ellipsis) |
|
114 | - 'themesFound' => __( 'Number of Themes found: %d' ), |
|
115 | - 'noThemesFound' => __( 'No themes found. Try a different search.' ), |
|
111 | + 'addNew' => __('Add New Theme'), |
|
112 | + 'search' => __('Search Installed Themes'), |
|
113 | + 'searchPlaceholder' => __('Search installed themes...'), // placeholder (no ellipsis) |
|
114 | + 'themesFound' => __('Number of Themes found: %d'), |
|
115 | + 'noThemesFound' => __('No themes found. Try a different search.'), |
|
116 | 116 | ), |
117 | -) ); |
|
117 | +)); |
|
118 | 118 | |
119 | 119 | add_thickbox(); |
120 | -wp_enqueue_script( 'theme' ); |
|
121 | -wp_enqueue_script( 'customize-loader' ); |
|
120 | +wp_enqueue_script('theme'); |
|
121 | +wp_enqueue_script('customize-loader'); |
|
122 | 122 | |
123 | -require_once( ABSPATH . 'wp-admin/admin-header.php' ); |
|
123 | +require_once(ABSPATH.'wp-admin/admin-header.php'); |
|
124 | 124 | ?> |
125 | 125 | |
126 | 126 | <div class="wrap"> |
127 | - <h1><?php esc_html_e( 'Themes' ); ?> |
|
128 | - <span class="title-count theme-count"><?php echo count( $themes ); ?></span> |
|
129 | - <?php if ( ! is_multisite() && current_user_can( 'install_themes' ) ) : ?> |
|
130 | - <a href="<?php echo admin_url( 'theme-install.php' ); ?>" class="hide-if-no-js page-title-action"><?php echo esc_html_x( 'Add New', 'Add new theme' ); ?></a> |
|
127 | + <h1><?php esc_html_e('Themes'); ?> |
|
128 | + <span class="title-count theme-count"><?php echo count($themes); ?></span> |
|
129 | + <?php if ( ! is_multisite() && current_user_can('install_themes')) : ?> |
|
130 | + <a href="<?php echo admin_url('theme-install.php'); ?>" class="hide-if-no-js page-title-action"><?php echo esc_html_x('Add New', 'Add new theme'); ?></a> |
|
131 | 131 | <?php endif; ?> |
132 | 132 | </h1> |
133 | 133 | <?php |
134 | -if ( ! validate_current_theme() || isset( $_GET['broken'] ) ) : ?> |
|
134 | +if ( ! validate_current_theme() || isset($_GET['broken'])) : ?> |
|
135 | 135 | <div id="message1" class="updated notice is-dismissible"><p><?php _e('The active theme is broken. Reverting to the default theme.'); ?></p></div> |
136 | -<?php elseif ( isset($_GET['activated']) ) : |
|
137 | - if ( isset( $_GET['previewed'] ) ) { ?> |
|
138 | - <div id="message2" class="updated notice is-dismissible"><p><?php printf( __( 'Settings saved and theme activated. <a href="%s">Visit site</a>' ), home_url( '/' ) ); ?></p></div> |
|
136 | +<?php elseif (isset($_GET['activated'])) : |
|
137 | + if (isset($_GET['previewed'])) { ?> |
|
138 | + <div id="message2" class="updated notice is-dismissible"><p><?php printf(__('Settings saved and theme activated. <a href="%s">Visit site</a>'), home_url('/')); ?></p></div> |
|
139 | 139 | <?php } else { ?> |
140 | -<div id="message2" class="updated notice is-dismissible"><p><?php printf( __( 'New theme activated. <a href="%s">Visit site</a>' ), home_url( '/' ) ); ?></p></div><?php |
|
140 | +<div id="message2" class="updated notice is-dismissible"><p><?php printf(__('New theme activated. <a href="%s">Visit site</a>'), home_url('/')); ?></p></div><?php |
|
141 | 141 | } |
142 | - elseif ( isset($_GET['deleted']) ) : ?> |
|
142 | + elseif (isset($_GET['deleted'])) : ?> |
|
143 | 143 | <div id="message3" class="updated notice is-dismissible"><p><?php _e('Theme deleted.') ?></p></div> |
144 | -<?php elseif ( isset( $_GET['delete-active-child'] ) ) : ?> |
|
145 | - <div id="message4" class="error"><p><?php _e( 'You cannot delete a theme while it has an active child theme.' ); ?></p></div> |
|
144 | +<?php elseif (isset($_GET['delete-active-child'])) : ?> |
|
145 | + <div id="message4" class="error"><p><?php _e('You cannot delete a theme while it has an active child theme.'); ?></p></div> |
|
146 | 146 | <?php |
147 | 147 | endif; |
148 | 148 | |
149 | 149 | $ct = wp_get_theme(); |
150 | 150 | |
151 | -if ( $ct->errors() && ( ! is_multisite() || current_user_can( 'manage_network_themes' ) ) ) { |
|
152 | - echo '<div class="error"><p>' . sprintf( __( 'ERROR: %s' ), $ct->errors()->get_error_message() ) . '</p></div>'; |
|
151 | +if ($ct->errors() && ( ! is_multisite() || current_user_can('manage_network_themes'))) { |
|
152 | + echo '<div class="error"><p>'.sprintf(__('ERROR: %s'), $ct->errors()->get_error_message()).'</p></div>'; |
|
153 | 153 | } |
154 | 154 | |
155 | 155 | /* |
@@ -160,37 +160,37 @@ discard block |
||
160 | 160 | |
161 | 161 | // Pretend you didn't see this. |
162 | 162 | $current_theme_actions = array(); |
163 | - if ( is_array( $submenu ) && isset( $submenu['themes.php'] ) ) { |
|
164 | - foreach ( (array) $submenu['themes.php'] as $item) { |
|
163 | + if (is_array($submenu) && isset($submenu['themes.php'])) { |
|
164 | + foreach ((array) $submenu['themes.php'] as $item) { |
|
165 | 165 | $class = ''; |
166 | - if ( 'themes.php' == $item[2] || 'theme-editor.php' == $item[2] || 0 === strpos( $item[2], 'customize.php' ) ) |
|
166 | + if ('themes.php' == $item[2] || 'theme-editor.php' == $item[2] || 0 === strpos($item[2], 'customize.php')) |
|
167 | 167 | continue; |
168 | 168 | // 0 = name, 1 = capability, 2 = file |
169 | - if ( ( strcmp($self, $item[2]) == 0 && empty($parent_file)) || ($parent_file && ($item[2] == $parent_file)) ) |
|
169 | + if ((strcmp($self, $item[2]) == 0 && empty($parent_file)) || ($parent_file && ($item[2] == $parent_file))) |
|
170 | 170 | $class = ' current'; |
171 | - if ( !empty($submenu[$item[2]]) ) { |
|
171 | + if ( ! empty($submenu[$item[2]])) { |
|
172 | 172 | $submenu[$item[2]] = array_values($submenu[$item[2]]); // Re-index. |
173 | 173 | $menu_hook = get_plugin_page_hook($submenu[$item[2]][0][2], $item[2]); |
174 | - if ( file_exists(WP_PLUGIN_DIR . "/{$submenu[$item[2]][0][2]}") || !empty($menu_hook)) |
|
174 | + if (file_exists(WP_PLUGIN_DIR."/{$submenu[$item[2]][0][2]}") || ! empty($menu_hook)) |
|
175 | 175 | $current_theme_actions[] = "<a class='button button-secondary$class' href='admin.php?page={$submenu[$item[2]][0][2]}'>{$item[0]}</a>"; |
176 | 176 | else |
177 | 177 | $current_theme_actions[] = "<a class='button button-secondary$class' href='{$submenu[$item[2]][0][2]}'>{$item[0]}</a>"; |
178 | - } elseif ( ! empty( $item[2] ) && current_user_can( $item[1] ) ) { |
|
178 | + } elseif ( ! empty($item[2]) && current_user_can($item[1])) { |
|
179 | 179 | $menu_file = $item[2]; |
180 | 180 | |
181 | - if ( current_user_can( 'customize' ) ) { |
|
182 | - if ( 'custom-header' === $menu_file ) { |
|
181 | + if (current_user_can('customize')) { |
|
182 | + if ('custom-header' === $menu_file) { |
|
183 | 183 | $current_theme_actions[] = "<a class='button button-secondary hide-if-no-customize$class' href='customize.php?autofocus[control]=header_image'>{$item[0]}</a>"; |
184 | - } elseif ( 'custom-background' === $menu_file ) { |
|
184 | + } elseif ('custom-background' === $menu_file) { |
|
185 | 185 | $current_theme_actions[] = "<a class='button button-secondary hide-if-no-customize$class' href='customize.php?autofocus[control]=background_image'>{$item[0]}</a>"; |
186 | 186 | } |
187 | 187 | } |
188 | 188 | |
189 | - if ( false !== ( $pos = strpos( $menu_file, '?' ) ) ) { |
|
190 | - $menu_file = substr( $menu_file, 0, $pos ); |
|
189 | + if (false !== ($pos = strpos($menu_file, '?'))) { |
|
190 | + $menu_file = substr($menu_file, 0, $pos); |
|
191 | 191 | } |
192 | 192 | |
193 | - if ( file_exists( ABSPATH . "wp-admin/$menu_file" ) ) { |
|
193 | + if (file_exists(ABSPATH."wp-admin/$menu_file")) { |
|
194 | 194 | $current_theme_actions[] = "<a class='button button-secondary$class' href='{$item[2]}'>{$item[0]}</a>"; |
195 | 195 | } else { |
196 | 196 | $current_theme_actions[] = "<a class='button button-secondary$class' href='themes.php?page={$item[2]}'>{$item[0]}</a>"; |
@@ -209,26 +209,26 @@ discard block |
||
209 | 209 | * This PHP is synchronized with the tmpl-theme template below! |
210 | 210 | */ |
211 | 211 | |
212 | -foreach ( $themes as $theme ) : |
|
213 | - $aria_action = esc_attr( $theme['id'] . '-action' ); |
|
214 | - $aria_name = esc_attr( $theme['id'] . '-name' ); |
|
212 | +foreach ($themes as $theme) : |
|
213 | + $aria_action = esc_attr($theme['id'].'-action'); |
|
214 | + $aria_name = esc_attr($theme['id'].'-name'); |
|
215 | 215 | ?> |
216 | -<div class="theme<?php if ( $theme['active'] ) echo ' active'; ?>" tabindex="0" aria-describedby="<?php echo $aria_action . ' ' . $aria_name; ?>"> |
|
217 | - <?php if ( ! empty( $theme['screenshot'][0] ) ) { ?> |
|
216 | +<div class="theme<?php if ($theme['active']) echo ' active'; ?>" tabindex="0" aria-describedby="<?php echo $aria_action.' '.$aria_name; ?>"> |
|
217 | + <?php if ( ! empty($theme['screenshot'][0])) { ?> |
|
218 | 218 | <div class="theme-screenshot"> |
219 | 219 | <img src="<?php echo $theme['screenshot'][0]; ?>" alt="" /> |
220 | 220 | </div> |
221 | 221 | <?php } else { ?> |
222 | 222 | <div class="theme-screenshot blank"></div> |
223 | 223 | <?php } ?> |
224 | - <span class="more-details" id="<?php echo $aria_action; ?>"><?php _e( 'Theme Details' ); ?></span> |
|
225 | - <div class="theme-author"><?php printf( __( 'By %s' ), $theme['author'] ); ?></div> |
|
224 | + <span class="more-details" id="<?php echo $aria_action; ?>"><?php _e('Theme Details'); ?></span> |
|
225 | + <div class="theme-author"><?php printf(__('By %s'), $theme['author']); ?></div> |
|
226 | 226 | |
227 | - <?php if ( $theme['active'] ) { ?> |
|
227 | + <?php if ($theme['active']) { ?> |
|
228 | 228 | <h3 class="theme-name" id="<?php echo $aria_name; ?>"> |
229 | 229 | <?php |
230 | 230 | /* translators: %s: theme name */ |
231 | - printf( __( '<span>Active:</span> %s' ), $theme['name'] ); |
|
231 | + printf(__('<span>Active:</span> %s'), $theme['name']); |
|
232 | 232 | ?> |
233 | 233 | </h3> |
234 | 234 | <?php } else { ?> |
@@ -237,21 +237,21 @@ discard block |
||
237 | 237 | |
238 | 238 | <div class="theme-actions"> |
239 | 239 | |
240 | - <?php if ( $theme['active'] ) { ?> |
|
241 | - <?php if ( $theme['actions']['customize'] && current_user_can( 'edit_theme_options' ) && current_user_can( 'customize' ) ) { ?> |
|
242 | - <a class="button button-primary customize load-customize hide-if-no-customize" href="<?php echo $theme['actions']['customize']; ?>"><?php _e( 'Customize' ); ?></a> |
|
240 | + <?php if ($theme['active']) { ?> |
|
241 | + <?php if ($theme['actions']['customize'] && current_user_can('edit_theme_options') && current_user_can('customize')) { ?> |
|
242 | + <a class="button button-primary customize load-customize hide-if-no-customize" href="<?php echo $theme['actions']['customize']; ?>"><?php _e('Customize'); ?></a> |
|
243 | 243 | <?php } ?> |
244 | 244 | <?php } else { ?> |
245 | - <a class="button button-secondary activate" href="<?php echo $theme['actions']['activate']; ?>"><?php _e( 'Activate' ); ?></a> |
|
246 | - <?php if ( current_user_can( 'edit_theme_options' ) && current_user_can( 'customize' ) ) { ?> |
|
247 | - <a class="button button-primary load-customize hide-if-no-customize" href="<?php echo $theme['actions']['customize']; ?>"><?php _e( 'Live Preview' ); ?></a> |
|
245 | + <a class="button button-secondary activate" href="<?php echo $theme['actions']['activate']; ?>"><?php _e('Activate'); ?></a> |
|
246 | + <?php if (current_user_can('edit_theme_options') && current_user_can('customize')) { ?> |
|
247 | + <a class="button button-primary load-customize hide-if-no-customize" href="<?php echo $theme['actions']['customize']; ?>"><?php _e('Live Preview'); ?></a> |
|
248 | 248 | <?php } ?> |
249 | 249 | <?php } ?> |
250 | 250 | |
251 | 251 | </div> |
252 | 252 | |
253 | - <?php if ( $theme['hasUpdate'] ) { ?> |
|
254 | - <div class="theme-update"><?php _e( 'Update Available' ); ?></div> |
|
253 | + <?php if ($theme['hasUpdate']) { ?> |
|
254 | + <div class="theme-update"><?php _e('Update Available'); ?></div> |
|
255 | 255 | <?php } ?> |
256 | 256 | </div> |
257 | 257 | <?php endforeach; ?> |
@@ -260,11 +260,11 @@ discard block |
||
260 | 260 | </div> |
261 | 261 | <div class="theme-overlay"></div> |
262 | 262 | |
263 | -<p class="no-themes"><?php _e( 'No themes found. Try a different search.' ); ?></p> |
|
263 | +<p class="no-themes"><?php _e('No themes found. Try a different search.'); ?></p> |
|
264 | 264 | |
265 | 265 | <?php |
266 | 266 | // List broken themes, if any. |
267 | -if ( ! is_multisite() && current_user_can('edit_themes') && $broken_themes = wp_get_themes( array( 'errors' => true ) ) ) { |
|
267 | +if ( ! is_multisite() && current_user_can('edit_themes') && $broken_themes = wp_get_themes(array('errors' => true))) { |
|
268 | 268 | ?> |
269 | 269 | |
270 | 270 | <div class="broken-themes"> |
@@ -272,31 +272,31 @@ discard block |
||
272 | 272 | <p><?php _e('The following themes are installed but incomplete. Themes must have a stylesheet and a template.'); ?></p> |
273 | 273 | |
274 | 274 | <?php |
275 | -$can_delete = current_user_can( 'delete_themes' ); |
|
275 | +$can_delete = current_user_can('delete_themes'); |
|
276 | 276 | ?> |
277 | 277 | <table> |
278 | 278 | <tr> |
279 | 279 | <th><?php _ex('Name', 'theme name'); ?></th> |
280 | 280 | <th><?php _e('Description'); ?></th> |
281 | - <?php if ( $can_delete ) { ?> |
|
281 | + <?php if ($can_delete) { ?> |
|
282 | 282 | <td></td> |
283 | 283 | <?php } ?> |
284 | 284 | </tr> |
285 | 285 | </tr> |
286 | - <?php foreach ( $broken_themes as $broken_theme ) : ?> |
|
286 | + <?php foreach ($broken_themes as $broken_theme) : ?> |
|
287 | 287 | <tr> |
288 | - <td><?php echo $broken_theme->get( 'Name' ) ? $broken_theme->display( 'Name' ) : $broken_theme->get_stylesheet(); ?></td> |
|
288 | + <td><?php echo $broken_theme->get('Name') ? $broken_theme->display('Name') : $broken_theme->get_stylesheet(); ?></td> |
|
289 | 289 | <td><?php echo $broken_theme->errors()->get_error_message(); ?></td> |
290 | 290 | <?php |
291 | - if ( $can_delete ) { |
|
291 | + if ($can_delete) { |
|
292 | 292 | $stylesheet = $broken_theme->get_stylesheet(); |
293 | - $delete_url = add_query_arg( array( |
|
293 | + $delete_url = add_query_arg(array( |
|
294 | 294 | 'action' => 'delete', |
295 | - 'stylesheet' => urlencode( $stylesheet ), |
|
296 | - ), admin_url( 'themes.php' ) ); |
|
297 | - $delete_url = wp_nonce_url( $delete_url, 'delete-theme_' . $stylesheet ); |
|
295 | + 'stylesheet' => urlencode($stylesheet), |
|
296 | + ), admin_url('themes.php')); |
|
297 | + $delete_url = wp_nonce_url($delete_url, 'delete-theme_'.$stylesheet); |
|
298 | 298 | ?> |
299 | - <td><a href="<?php echo esc_url( $delete_url ); ?>" class="button button-secondary delete-theme"><?php _e( 'Delete' ); ?></a></td> |
|
299 | + <td><a href="<?php echo esc_url($delete_url); ?>" class="button button-secondary delete-theme"><?php _e('Delete'); ?></a></td> |
|
300 | 300 | <?php |
301 | 301 | } |
302 | 302 | ?> |
@@ -323,14 +323,14 @@ discard block |
||
323 | 323 | <# } else { #> |
324 | 324 | <div class="theme-screenshot blank"></div> |
325 | 325 | <# } #> |
326 | - <span class="more-details" id="{{ data.id }}-action"><?php _e( 'Theme Details' ); ?></span> |
|
327 | - <div class="theme-author"><?php printf( __( 'By %s' ), '{{{ data.author }}}' ); ?></div> |
|
326 | + <span class="more-details" id="{{ data.id }}-action"><?php _e('Theme Details'); ?></span> |
|
327 | + <div class="theme-author"><?php printf(__('By %s'), '{{{ data.author }}}'); ?></div> |
|
328 | 328 | |
329 | 329 | <# if ( data.active ) { #> |
330 | 330 | <h3 class="theme-name" id="{{ data.id }}-name"> |
331 | 331 | <?php |
332 | 332 | /* translators: %s: theme name */ |
333 | - printf( __( '<span>Active:</span> %s' ), '{{{ data.name }}}' ); |
|
333 | + printf(__('<span>Active:</span> %s'), '{{{ data.name }}}'); |
|
334 | 334 | ?> |
335 | 335 | </h3> |
336 | 336 | <# } else { #> |
@@ -341,17 +341,17 @@ discard block |
||
341 | 341 | |
342 | 342 | <# if ( data.active ) { #> |
343 | 343 | <# if ( data.actions.customize ) { #> |
344 | - <a class="button button-primary customize load-customize hide-if-no-customize" href="{{ data.actions.customize }}"><?php _e( 'Customize' ); ?></a> |
|
344 | + <a class="button button-primary customize load-customize hide-if-no-customize" href="{{ data.actions.customize }}"><?php _e('Customize'); ?></a> |
|
345 | 345 | <# } #> |
346 | 346 | <# } else { #> |
347 | - <a class="button button-secondary activate" href="{{{ data.actions.activate }}}"><?php _e( 'Activate' ); ?></a> |
|
348 | - <a class="button button-primary load-customize hide-if-no-customize" href="{{{ data.actions.customize }}}"><?php _e( 'Live Preview' ); ?></a> |
|
347 | + <a class="button button-secondary activate" href="{{{ data.actions.activate }}}"><?php _e('Activate'); ?></a> |
|
348 | + <a class="button button-primary load-customize hide-if-no-customize" href="{{{ data.actions.customize }}}"><?php _e('Live Preview'); ?></a> |
|
349 | 349 | <# } #> |
350 | 350 | |
351 | 351 | </div> |
352 | 352 | |
353 | 353 | <# if ( data.hasUpdate ) { #> |
354 | - <div class="theme-update"><?php _e( 'Update Available' ); ?></div> |
|
354 | + <div class="theme-update"><?php _e('Update Available'); ?></div> |
|
355 | 355 | <# } #> |
356 | 356 | </script> |
357 | 357 | |
@@ -359,9 +359,9 @@ discard block |
||
359 | 359 | <div class="theme-backdrop"></div> |
360 | 360 | <div class="theme-wrap"> |
361 | 361 | <div class="theme-header"> |
362 | - <button class="left dashicons dashicons-no"><span class="screen-reader-text"><?php _e( 'Show previous theme' ); ?></span></button> |
|
363 | - <button class="right dashicons dashicons-no"><span class="screen-reader-text"><?php _e( 'Show next theme' ); ?></span></button> |
|
364 | - <button class="close dashicons dashicons-no"><span class="screen-reader-text"><?php _e( 'Close details dialog' ); ?></span></button> |
|
362 | + <button class="left dashicons dashicons-no"><span class="screen-reader-text"><?php _e('Show previous theme'); ?></span></button> |
|
363 | + <button class="right dashicons dashicons-no"><span class="screen-reader-text"><?php _e('Show next theme'); ?></span></button> |
|
364 | + <button class="close dashicons dashicons-no"><span class="screen-reader-text"><?php _e('Close details dialog'); ?></span></button> |
|
365 | 365 | </div> |
366 | 366 | <div class="theme-about"> |
367 | 367 | <div class="theme-screenshots"> |
@@ -374,46 +374,46 @@ discard block |
||
374 | 374 | |
375 | 375 | <div class="theme-info"> |
376 | 376 | <# if ( data.active ) { #> |
377 | - <span class="current-label"><?php _e( 'Current Theme' ); ?></span> |
|
377 | + <span class="current-label"><?php _e('Current Theme'); ?></span> |
|
378 | 378 | <# } #> |
379 | - <h3 class="theme-name">{{{ data.name }}}<span class="theme-version"><?php printf( __( 'Version: %s' ), '{{ data.version }}' ); ?></span></h3> |
|
380 | - <h4 class="theme-author"><?php printf( __( 'By %s' ), '{{{ data.authorAndUri }}}' ); ?></h4> |
|
379 | + <h3 class="theme-name">{{{ data.name }}}<span class="theme-version"><?php printf(__('Version: %s'), '{{ data.version }}'); ?></span></h3> |
|
380 | + <h4 class="theme-author"><?php printf(__('By %s'), '{{{ data.authorAndUri }}}'); ?></h4> |
|
381 | 381 | |
382 | 382 | <# if ( data.hasUpdate ) { #> |
383 | 383 | <div class="theme-update-message"> |
384 | - <h4 class="theme-update"><?php _e( 'Update Available' ); ?></h4> |
|
384 | + <h4 class="theme-update"><?php _e('Update Available'); ?></h4> |
|
385 | 385 | {{{ data.update }}} |
386 | 386 | </div> |
387 | 387 | <# } #> |
388 | 388 | <p class="theme-description">{{{ data.description }}}</p> |
389 | 389 | |
390 | 390 | <# if ( data.parent ) { #> |
391 | - <p class="parent-theme"><?php printf( __( 'This is a child theme of %s.' ), '<strong>{{{ data.parent }}}</strong>' ); ?></p> |
|
391 | + <p class="parent-theme"><?php printf(__('This is a child theme of %s.'), '<strong>{{{ data.parent }}}</strong>'); ?></p> |
|
392 | 392 | <# } #> |
393 | 393 | |
394 | 394 | <# if ( data.tags ) { #> |
395 | - <p class="theme-tags"><span><?php _e( 'Tags:' ); ?></span> {{{ data.tags }}}</p> |
|
395 | + <p class="theme-tags"><span><?php _e('Tags:'); ?></span> {{{ data.tags }}}</p> |
|
396 | 396 | <# } #> |
397 | 397 | </div> |
398 | 398 | </div> |
399 | 399 | |
400 | 400 | <div class="theme-actions"> |
401 | 401 | <div class="active-theme"> |
402 | - <a href="{{{ data.actions.customize }}}" class="button button-primary customize load-customize hide-if-no-customize"><?php _e( 'Customize' ); ?></a> |
|
403 | - <?php echo implode( ' ', $current_theme_actions ); ?> |
|
402 | + <a href="{{{ data.actions.customize }}}" class="button button-primary customize load-customize hide-if-no-customize"><?php _e('Customize'); ?></a> |
|
403 | + <?php echo implode(' ', $current_theme_actions); ?> |
|
404 | 404 | </div> |
405 | 405 | <div class="inactive-theme"> |
406 | 406 | <# if ( data.actions.activate ) { #> |
407 | - <a href="{{{ data.actions.activate }}}" class="button button-secondary activate"><?php _e( 'Activate' ); ?></a> |
|
407 | + <a href="{{{ data.actions.activate }}}" class="button button-secondary activate"><?php _e('Activate'); ?></a> |
|
408 | 408 | <# } #> |
409 | - <a href="{{{ data.actions.customize }}}" class="button button-primary load-customize hide-if-no-customize"><?php _e( 'Live Preview' ); ?></a> |
|
409 | + <a href="{{{ data.actions.customize }}}" class="button button-primary load-customize hide-if-no-customize"><?php _e('Live Preview'); ?></a> |
|
410 | 410 | </div> |
411 | 411 | |
412 | 412 | <# if ( ! data.active && data.actions['delete'] ) { #> |
413 | - <a href="{{{ data.actions['delete'] }}}" class="button button-secondary delete-theme"><?php _e( 'Delete' ); ?></a> |
|
413 | + <a href="{{{ data.actions['delete'] }}}" class="button button-secondary delete-theme"><?php _e('Delete'); ?></a> |
|
414 | 414 | <# } #> |
415 | 415 | </div> |
416 | 416 | </div> |
417 | 417 | </script> |
418 | 418 | |
419 | -<?php require( ABSPATH . 'wp-admin/admin-footer.php' ); |
|
419 | +<?php require(ABSPATH.'wp-admin/admin-footer.php'); |
@@ -9,23 +9,26 @@ discard block |
||
9 | 9 | /** WordPress Administration Bootstrap */ |
10 | 10 | require_once( dirname( __FILE__ ) . '/admin.php' ); |
11 | 11 | |
12 | -if ( !current_user_can('switch_themes') && !current_user_can('edit_theme_options') ) |
|
12 | +if ( !current_user_can('switch_themes') && !current_user_can('edit_theme_options') ) { |
|
13 | 13 | wp_die( __( 'Cheatin’ uh?' ), 403 ); |
14 | +} |
|
14 | 15 | |
15 | 16 | if ( current_user_can( 'switch_themes' ) && isset($_GET['action'] ) ) { |
16 | 17 | if ( 'activate' == $_GET['action'] ) { |
17 | 18 | check_admin_referer('switch-theme_' . $_GET['stylesheet']); |
18 | 19 | $theme = wp_get_theme( $_GET['stylesheet'] ); |
19 | - if ( ! $theme->exists() || ! $theme->is_allowed() ) |
|
20 | - wp_die( __( 'Cheatin’ uh?' ), 403 ); |
|
20 | + if ( ! $theme->exists() || ! $theme->is_allowed() ) { |
|
21 | + wp_die( __( 'Cheatin’ uh?' ), 403 ); |
|
22 | + } |
|
21 | 23 | switch_theme( $theme->get_stylesheet() ); |
22 | 24 | wp_redirect( admin_url('themes.php?activated=true') ); |
23 | 25 | exit; |
24 | 26 | } elseif ( 'delete' == $_GET['action'] ) { |
25 | 27 | check_admin_referer('delete-theme_' . $_GET['stylesheet']); |
26 | 28 | $theme = wp_get_theme( $_GET['stylesheet'] ); |
27 | - if ( !current_user_can('delete_themes') || ! $theme->exists() ) |
|
28 | - wp_die( __( 'Cheatin’ uh?' ), 403 ); |
|
29 | + if ( !current_user_can('delete_themes') || ! $theme->exists() ) { |
|
30 | + wp_die( __( 'Cheatin’ uh?' ), 403 ); |
|
31 | + } |
|
29 | 32 | $active = wp_get_theme(); |
30 | 33 | if ( $active->get( 'Template' ) == $_GET['stylesheet'] ) { |
31 | 34 | wp_redirect( admin_url( 'themes.php?delete-active-child=true' ) ); |
@@ -138,8 +141,7 @@ discard block |
||
138 | 141 | <div id="message2" class="updated notice is-dismissible"><p><?php printf( __( 'Settings saved and theme activated. <a href="%s">Visit site</a>' ), home_url( '/' ) ); ?></p></div> |
139 | 142 | <?php } else { ?> |
140 | 143 | <div id="message2" class="updated notice is-dismissible"><p><?php printf( __( 'New theme activated. <a href="%s">Visit site</a>' ), home_url( '/' ) ); ?></p></div><?php |
141 | - } |
|
142 | - elseif ( isset($_GET['deleted']) ) : ?> |
|
144 | + } elseif ( isset($_GET['deleted']) ) : ?> |
|
143 | 145 | <div id="message3" class="updated notice is-dismissible"><p><?php _e('Theme deleted.') ?></p></div> |
144 | 146 | <?php elseif ( isset( $_GET['delete-active-child'] ) ) : ?> |
145 | 147 | <div id="message4" class="error"><p><?php _e( 'You cannot delete a theme while it has an active child theme.' ); ?></p></div> |
@@ -163,18 +165,21 @@ discard block |
||
163 | 165 | if ( is_array( $submenu ) && isset( $submenu['themes.php'] ) ) { |
164 | 166 | foreach ( (array) $submenu['themes.php'] as $item) { |
165 | 167 | $class = ''; |
166 | - if ( 'themes.php' == $item[2] || 'theme-editor.php' == $item[2] || 0 === strpos( $item[2], 'customize.php' ) ) |
|
167 | - continue; |
|
168 | + if ( 'themes.php' == $item[2] || 'theme-editor.php' == $item[2] || 0 === strpos( $item[2], 'customize.php' ) ) { |
|
169 | + continue; |
|
170 | + } |
|
168 | 171 | // 0 = name, 1 = capability, 2 = file |
169 | - if ( ( strcmp($self, $item[2]) == 0 && empty($parent_file)) || ($parent_file && ($item[2] == $parent_file)) ) |
|
170 | - $class = ' current'; |
|
172 | + if ( ( strcmp($self, $item[2]) == 0 && empty($parent_file)) || ($parent_file && ($item[2] == $parent_file)) ) { |
|
173 | + $class = ' current'; |
|
174 | + } |
|
171 | 175 | if ( !empty($submenu[$item[2]]) ) { |
172 | 176 | $submenu[$item[2]] = array_values($submenu[$item[2]]); // Re-index. |
173 | 177 | $menu_hook = get_plugin_page_hook($submenu[$item[2]][0][2], $item[2]); |
174 | - if ( file_exists(WP_PLUGIN_DIR . "/{$submenu[$item[2]][0][2]}") || !empty($menu_hook)) |
|
175 | - $current_theme_actions[] = "<a class='button button-secondary$class' href='admin.php?page={$submenu[$item[2]][0][2]}'>{$item[0]}</a>"; |
|
176 | - else |
|
177 | - $current_theme_actions[] = "<a class='button button-secondary$class' href='{$submenu[$item[2]][0][2]}'>{$item[0]}</a>"; |
|
178 | + if ( file_exists(WP_PLUGIN_DIR . "/{$submenu[$item[2]][0][2]}") || !empty($menu_hook)) { |
|
179 | + $current_theme_actions[] = "<a class='button button-secondary$class' href='admin.php?page={$submenu[$item[2]][0][2]}'>{$item[0]}</a>"; |
|
180 | + } else { |
|
181 | + $current_theme_actions[] = "<a class='button button-secondary$class' href='{$submenu[$item[2]][0][2]}'>{$item[0]}</a>"; |
|
182 | + } |
|
178 | 183 | } elseif ( ! empty( $item[2] ) && current_user_can( $item[1] ) ) { |
179 | 184 | $menu_file = $item[2]; |
180 | 185 | |
@@ -213,7 +218,10 @@ discard block |
||
213 | 218 | $aria_action = esc_attr( $theme['id'] . '-action' ); |
214 | 219 | $aria_name = esc_attr( $theme['id'] . '-name' ); |
215 | 220 | ?> |
216 | -<div class="theme<?php if ( $theme['active'] ) echo ' active'; ?>" tabindex="0" aria-describedby="<?php echo $aria_action . ' ' . $aria_name; ?>"> |
|
221 | +<div class="theme<?php if ( $theme['active'] ) { |
|
222 | + echo ' active'; |
|
223 | +} |
|
224 | +?>" tabindex="0" aria-describedby="<?php echo $aria_action . ' ' . $aria_name; ?>"> |
|
217 | 225 | <?php if ( ! empty( $theme['screenshot'][0] ) ) { ?> |
218 | 226 | <div class="theme-screenshot"> |
219 | 227 | <img src="<?php echo $theme['screenshot'][0]; ?>" alt="" /> |
@@ -1,10 +1,10 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * User Profile Administration Screen. |
|
4 | - * |
|
5 | - * @package WordPress |
|
6 | - * @subpackage Administration |
|
7 | - */ |
|
3 | + * User Profile Administration Screen. |
|
4 | + * |
|
5 | + * @package WordPress |
|
6 | + * @subpackage Administration |
|
7 | + */ |
|
8 | 8 | |
9 | 9 | /** |
10 | 10 | * This is a profile page. |
@@ -15,4 +15,4 @@ |
||
15 | 15 | define('IS_PROFILE_PAGE', true); |
16 | 16 | |
17 | 17 | /** Load User Editing Page */ |
18 | -require_once( dirname( __FILE__ ) . '/user-edit.php' ); |
|
18 | +require_once(dirname(__FILE__).'/user-edit.php'); |
@@ -456,12 +456,12 @@ discard block |
||
456 | 456 | </div> |
457 | 457 | <form name="post" action="post.php" method="post" id="post"<?php |
458 | 458 | /** |
459 | - * Fires inside the post editor form tag. |
|
460 | - * |
|
461 | - * @since 3.0.0 |
|
462 | - * |
|
463 | - * @param WP_Post $post Post object. |
|
464 | - */ |
|
459 | + * Fires inside the post editor form tag. |
|
460 | + * |
|
461 | + * @since 3.0.0 |
|
462 | + * |
|
463 | + * @param WP_Post $post Post object. |
|
464 | + */ |
|
465 | 465 | do_action( 'post_edit_form_tag', $post ); |
466 | 466 | |
467 | 467 | $referer = wp_get_referer(); |
@@ -522,12 +522,12 @@ discard block |
||
522 | 522 | </div> |
523 | 523 | <?php |
524 | 524 | /** |
525 | - * Fires before the permalink field in the edit form. |
|
526 | - * |
|
527 | - * @since 4.1.0 |
|
528 | - * |
|
529 | - * @param WP_Post $post Post object. |
|
530 | - */ |
|
525 | + * Fires before the permalink field in the edit form. |
|
526 | + * |
|
527 | + * @since 4.1.0 |
|
528 | + * |
|
529 | + * @param WP_Post $post Post object. |
|
530 | + */ |
|
531 | 531 | do_action( 'edit_form_before_permalink', $post ); |
532 | 532 | ?> |
533 | 533 | <div class="inside"> |
@@ -537,7 +537,7 @@ discard block |
||
537 | 537 | $shortlink = wp_get_shortlink($post->ID, 'post'); |
538 | 538 | |
539 | 539 | if ( !empty( $shortlink ) && $shortlink !== $permalink && $permalink !== home_url('?page_id=' . $post->ID) ) |
540 | - $sample_permalink_html .= '<input id="shortlink" type="hidden" value="' . esc_attr($shortlink) . '" /><a href="#" class="button button-small" onclick="prompt('URL:', jQuery(\'#shortlink\').val()); return false;">' . __('Get Shortlink') . '</a>'; |
|
540 | + $sample_permalink_html .= '<input id="shortlink" type="hidden" value="' . esc_attr($shortlink) . '" /><a href="#" class="button button-small" onclick="prompt('URL:', jQuery(\'#shortlink\').val()); return false;">' . __('Get Shortlink') . '</a>'; |
|
541 | 541 | |
542 | 542 | if ( $post_type_object->public && ! ( 'pending' == get_post_status( $post ) && !current_user_can( $post_type_object->cap->publish_posts ) ) ) { |
543 | 543 | $has_sample_permalink = $sample_permalink_html && 'auto-draft' != $post->post_status; |
@@ -560,12 +560,12 @@ discard block |
||
560 | 560 | <?php |
561 | 561 | } |
562 | 562 | /** |
563 | - * Fires after the title field. |
|
564 | - * |
|
565 | - * @since 3.5.0 |
|
566 | - * |
|
567 | - * @param WP_Post $post Post object. |
|
568 | - */ |
|
563 | + * Fires after the title field. |
|
564 | + * |
|
565 | + * @since 3.5.0 |
|
566 | + * |
|
567 | + * @param WP_Post $post Post object. |
|
568 | + */ |
|
569 | 569 | do_action( 'edit_form_after_title', $post ); |
570 | 570 | |
571 | 571 | if ( post_type_supports($post_type, 'editor') ) { |
@@ -604,12 +604,12 @@ discard block |
||
604 | 604 | </div> |
605 | 605 | <?php } |
606 | 606 | /** |
607 | - * Fires after the content editor. |
|
608 | - * |
|
609 | - * @since 3.5.0 |
|
610 | - * |
|
611 | - * @param WP_Post $post Post object. |
|
612 | - */ |
|
607 | + * Fires after the content editor. |
|
608 | + * |
|
609 | + * @since 3.5.0 |
|
610 | + * |
|
611 | + * @param WP_Post $post Post object. |
|
612 | + */ |
|
613 | 613 | do_action( 'edit_form_after_editor', $post ); |
614 | 614 | ?> |
615 | 615 | </div><!-- /post-body-content --> |
@@ -7,7 +7,7 @@ discard block |
||
7 | 7 | */ |
8 | 8 | |
9 | 9 | // don't load directly |
10 | -if ( !defined('ABSPATH') ) |
|
10 | +if ( ! defined('ABSPATH')) |
|
11 | 11 | die('-1'); |
12 | 12 | |
13 | 13 | /** |
@@ -29,17 +29,17 @@ discard block |
||
29 | 29 | * @param bool $expand Whether to enable the 'expand' functionality. Default true. |
30 | 30 | * @param string $post_type Post type. |
31 | 31 | */ |
32 | -if ( post_type_supports( $post_type, 'editor' ) && ! wp_is_mobile() && |
|
33 | - ! ( $is_IE && preg_match( '/MSIE [5678]/', $_SERVER['HTTP_USER_AGENT'] ) ) && |
|
34 | - apply_filters( 'wp_editor_expand', true, $post_type ) ) { |
|
32 | +if (post_type_supports($post_type, 'editor') && ! wp_is_mobile() && |
|
33 | + ! ($is_IE && preg_match('/MSIE [5678]/', $_SERVER['HTTP_USER_AGENT'])) && |
|
34 | + apply_filters('wp_editor_expand', true, $post_type)) { |
|
35 | 35 | |
36 | 36 | wp_enqueue_script('editor-expand'); |
37 | 37 | $_content_editor_dfw = true; |
38 | - $_wp_editor_expand = ( get_user_setting( 'editor_expand', 'on' ) === 'on' ); |
|
38 | + $_wp_editor_expand = (get_user_setting('editor_expand', 'on') === 'on'); |
|
39 | 39 | } |
40 | 40 | |
41 | -if ( wp_is_mobile() ) |
|
42 | - wp_enqueue_script( 'jquery-touch-punch' ); |
|
41 | +if (wp_is_mobile()) |
|
42 | + wp_enqueue_script('jquery-touch-punch'); |
|
43 | 43 | |
44 | 44 | /** |
45 | 45 | * Post ID global |
@@ -50,98 +50,98 @@ discard block |
||
50 | 50 | $user_ID = isset($user_ID) ? (int) $user_ID : 0; |
51 | 51 | $action = isset($action) ? $action : ''; |
52 | 52 | |
53 | -if ( $post_ID == get_option( 'page_for_posts' ) && empty( $post->post_content ) ) { |
|
54 | - add_action( 'edit_form_after_title', '_wp_posts_page_notice' ); |
|
55 | - remove_post_type_support( $post_type, 'editor' ); |
|
53 | +if ($post_ID == get_option('page_for_posts') && empty($post->post_content)) { |
|
54 | + add_action('edit_form_after_title', '_wp_posts_page_notice'); |
|
55 | + remove_post_type_support($post_type, 'editor'); |
|
56 | 56 | } |
57 | 57 | |
58 | -$thumbnail_support = current_theme_supports( 'post-thumbnails', $post_type ) && post_type_supports( $post_type, 'thumbnail' ); |
|
59 | -if ( ! $thumbnail_support && 'attachment' === $post_type && $post->post_mime_type ) { |
|
60 | - if ( wp_attachment_is( 'audio', $post ) ) { |
|
61 | - $thumbnail_support = post_type_supports( 'attachment:audio', 'thumbnail' ) || current_theme_supports( 'post-thumbnails', 'attachment:audio' ); |
|
62 | - } elseif ( wp_attachment_is( 'video', $post ) ) { |
|
63 | - $thumbnail_support = post_type_supports( 'attachment:video', 'thumbnail' ) || current_theme_supports( 'post-thumbnails', 'attachment:video' ); |
|
58 | +$thumbnail_support = current_theme_supports('post-thumbnails', $post_type) && post_type_supports($post_type, 'thumbnail'); |
|
59 | +if ( ! $thumbnail_support && 'attachment' === $post_type && $post->post_mime_type) { |
|
60 | + if (wp_attachment_is('audio', $post)) { |
|
61 | + $thumbnail_support = post_type_supports('attachment:audio', 'thumbnail') || current_theme_supports('post-thumbnails', 'attachment:audio'); |
|
62 | + } elseif (wp_attachment_is('video', $post)) { |
|
63 | + $thumbnail_support = post_type_supports('attachment:video', 'thumbnail') || current_theme_supports('post-thumbnails', 'attachment:video'); |
|
64 | 64 | } |
65 | 65 | } |
66 | 66 | |
67 | -if ( $thumbnail_support ) { |
|
67 | +if ($thumbnail_support) { |
|
68 | 68 | add_thickbox(); |
69 | - wp_enqueue_media( array( 'post' => $post_ID ) ); |
|
69 | + wp_enqueue_media(array('post' => $post_ID)); |
|
70 | 70 | } |
71 | 71 | |
72 | 72 | // Add the local autosave notice HTML |
73 | -add_action( 'admin_footer', '_local_storage_notice' ); |
|
73 | +add_action('admin_footer', '_local_storage_notice'); |
|
74 | 74 | |
75 | 75 | /* |
76 | 76 | * @todo Document the $messages array(s). |
77 | 77 | */ |
78 | -$permalink = get_permalink( $post_ID ); |
|
79 | -if ( ! $permalink ) { |
|
78 | +$permalink = get_permalink($post_ID); |
|
79 | +if ( ! $permalink) { |
|
80 | 80 | $permalink = ''; |
81 | 81 | } |
82 | 82 | |
83 | 83 | $messages = array(); |
84 | 84 | /** This filter is documented in wp-admin/includes/meta-boxes.php */ |
85 | -$post_preview_url = apply_filters( 'preview_post_link', add_query_arg( 'preview', 'true', $permalink ), $post ); |
|
85 | +$post_preview_url = apply_filters('preview_post_link', add_query_arg('preview', 'true', $permalink), $post); |
|
86 | 86 | |
87 | 87 | $preview_link_html = $scheduled_link_html = $view_post_html = ''; |
88 | 88 | |
89 | -$viewable = is_post_type_viewable( $post_type_object ); |
|
89 | +$viewable = is_post_type_viewable($post_type_object); |
|
90 | 90 | |
91 | -if ( $viewable ) { |
|
91 | +if ($viewable) { |
|
92 | 92 | // Preview link. |
93 | - $preview_link_html = sprintf( ' <a target="_blank" href="%s">%s</a>', |
|
94 | - esc_url( $post_preview_url ), |
|
95 | - __( 'Preview post' ) |
|
93 | + $preview_link_html = sprintf(' <a target="_blank" href="%s">%s</a>', |
|
94 | + esc_url($post_preview_url), |
|
95 | + __('Preview post') |
|
96 | 96 | ); |
97 | 97 | |
98 | 98 | // Scheduled preview link. |
99 | - $scheduled_link_html = sprintf( ' <a target="_blank" href="%s">%s</a>', |
|
100 | - esc_url( $permalink ), |
|
101 | - __( 'Preview post' ) |
|
99 | + $scheduled_link_html = sprintf(' <a target="_blank" href="%s">%s</a>', |
|
100 | + esc_url($permalink), |
|
101 | + __('Preview post') |
|
102 | 102 | ); |
103 | 103 | |
104 | 104 | // View post link. |
105 | - $view_post_html = sprintf( ' <a href="%s">%s</a>', |
|
106 | - esc_url( $permalink ), |
|
107 | - __( 'View post' ) |
|
105 | + $view_post_html = sprintf(' <a href="%s">%s</a>', |
|
106 | + esc_url($permalink), |
|
107 | + __('View post') |
|
108 | 108 | ); |
109 | 109 | } |
110 | 110 | |
111 | 111 | /* translators: Publish box date format, see http://php.net/date */ |
112 | -$scheduled_date = date_i18n( __( 'M j, Y @ H:i' ), strtotime( $post->post_date ) ); |
|
112 | +$scheduled_date = date_i18n(__('M j, Y @ H:i'), strtotime($post->post_date)); |
|
113 | 113 | $messages['post'] = array( |
114 | 114 | 0 => '', // Unused. Messages start at index 1. |
115 | - 1 => __( 'Post updated.' ) . $view_post_html, |
|
115 | + 1 => __('Post updated.').$view_post_html, |
|
116 | 116 | 2 => __('Custom field updated.'), |
117 | 117 | 3 => __('Custom field deleted.'), |
118 | 118 | 4 => __('Post updated.'), |
119 | 119 | /* translators: %s: date and time of the revision */ |
120 | - 5 => isset($_GET['revision']) ? sprintf( __('Post restored to revision from %s'), wp_post_revision_title( (int) $_GET['revision'], false ) ) : false, |
|
121 | - 6 => __( 'Post published.' ) . $view_post_html, |
|
120 | + 5 => isset($_GET['revision']) ? sprintf(__('Post restored to revision from %s'), wp_post_revision_title((int) $_GET['revision'], false)) : false, |
|
121 | + 6 => __('Post published.').$view_post_html, |
|
122 | 122 | 7 => __('Post saved.'), |
123 | - 8 => __( 'Post submitted.' ) . $preview_link_html, |
|
124 | - 9 => sprintf( __( 'Post scheduled for: <strong>%1$s</strong>' ), $scheduled_date ) . $scheduled_link_html, |
|
125 | - 10 => __( 'Post draft updated.' ) . $preview_link_html, |
|
123 | + 8 => __('Post submitted.').$preview_link_html, |
|
124 | + 9 => sprintf(__('Post scheduled for: <strong>%1$s</strong>'), $scheduled_date).$scheduled_link_html, |
|
125 | + 10 => __('Post draft updated.').$preview_link_html, |
|
126 | 126 | ); |
127 | 127 | |
128 | 128 | /** This filter is documented in wp-admin/includes/meta-boxes.php */ |
129 | -$page_preview_url = apply_filters( 'preview_post_link', add_query_arg( 'preview', 'true', $permalink ), $post ); |
|
129 | +$page_preview_url = apply_filters('preview_post_link', add_query_arg('preview', 'true', $permalink), $post); |
|
130 | 130 | |
131 | 131 | $messages['page'] = array( |
132 | 132 | 0 => '', // Unused. Messages start at index 1. |
133 | - 1 => sprintf( __('Page updated. <a href="%s">View page</a>'), esc_url( $permalink ) ), |
|
133 | + 1 => sprintf(__('Page updated. <a href="%s">View page</a>'), esc_url($permalink)), |
|
134 | 134 | 2 => __('Custom field updated.'), |
135 | 135 | 3 => __('Custom field deleted.'), |
136 | 136 | 4 => __('Page updated.'), |
137 | - 5 => isset($_GET['revision']) ? sprintf( __('Page restored to revision from %s'), wp_post_revision_title( (int) $_GET['revision'], false ) ) : false, |
|
138 | - 6 => sprintf( __('Page published. <a href="%s">View page</a>'), esc_url( $permalink ) ), |
|
137 | + 5 => isset($_GET['revision']) ? sprintf(__('Page restored to revision from %s'), wp_post_revision_title((int) $_GET['revision'], false)) : false, |
|
138 | + 6 => sprintf(__('Page published. <a href="%s">View page</a>'), esc_url($permalink)), |
|
139 | 139 | 7 => __('Page saved.'), |
140 | - 8 => sprintf( __('Page submitted. <a target="_blank" href="%s">Preview page</a>'), esc_url( $page_preview_url ) ), |
|
141 | - 9 => sprintf( __('Page scheduled for: <strong>%1$s</strong>. <a target="_blank" href="%2$s">Preview page</a>'), date_i18n( __( 'M j, Y @ H:i' ), strtotime( $post->post_date ) ), esc_url( $permalink ) ), |
|
142 | - 10 => sprintf( __('Page draft updated. <a target="_blank" href="%s">Preview page</a>'), esc_url( $page_preview_url ) ), |
|
140 | + 8 => sprintf(__('Page submitted. <a target="_blank" href="%s">Preview page</a>'), esc_url($page_preview_url)), |
|
141 | + 9 => sprintf(__('Page scheduled for: <strong>%1$s</strong>. <a target="_blank" href="%2$s">Preview page</a>'), date_i18n(__('M j, Y @ H:i'), strtotime($post->post_date)), esc_url($permalink)), |
|
142 | + 10 => sprintf(__('Page draft updated. <a target="_blank" href="%s">Preview page</a>'), esc_url($page_preview_url)), |
|
143 | 143 | ); |
144 | -$messages['attachment'] = array_fill( 1, 10, __( 'Media attachment updated.' ) ); // Hack, for now. |
|
144 | +$messages['attachment'] = array_fill(1, 10, __('Media attachment updated.')); // Hack, for now. |
|
145 | 145 | |
146 | 146 | /** |
147 | 147 | * Filter the post updated messages. |
@@ -150,109 +150,109 @@ discard block |
||
150 | 150 | * |
151 | 151 | * @param array $messages Post updated messages. For defaults @see $messages declarations above. |
152 | 152 | */ |
153 | -$messages = apply_filters( 'post_updated_messages', $messages ); |
|
153 | +$messages = apply_filters('post_updated_messages', $messages); |
|
154 | 154 | |
155 | 155 | $message = false; |
156 | -if ( isset($_GET['message']) ) { |
|
157 | - $_GET['message'] = absint( $_GET['message'] ); |
|
158 | - if ( isset($messages[$post_type][$_GET['message']]) ) |
|
156 | +if (isset($_GET['message'])) { |
|
157 | + $_GET['message'] = absint($_GET['message']); |
|
158 | + if (isset($messages[$post_type][$_GET['message']])) |
|
159 | 159 | $message = $messages[$post_type][$_GET['message']]; |
160 | - elseif ( !isset($messages[$post_type]) && isset($messages['post'][$_GET['message']]) ) |
|
160 | + elseif ( ! isset($messages[$post_type]) && isset($messages['post'][$_GET['message']])) |
|
161 | 161 | $message = $messages['post'][$_GET['message']]; |
162 | 162 | } |
163 | 163 | |
164 | 164 | $notice = false; |
165 | 165 | $form_extra = ''; |
166 | -if ( 'auto-draft' == $post->post_status ) { |
|
167 | - if ( 'edit' == $action ) |
|
166 | +if ('auto-draft' == $post->post_status) { |
|
167 | + if ('edit' == $action) |
|
168 | 168 | $post->post_title = ''; |
169 | 169 | $autosave = false; |
170 | 170 | $form_extra .= "<input type='hidden' id='auto_draft' name='auto_draft' value='1' />"; |
171 | 171 | } else { |
172 | - $autosave = wp_get_post_autosave( $post_ID ); |
|
172 | + $autosave = wp_get_post_autosave($post_ID); |
|
173 | 173 | } |
174 | 174 | |
175 | 175 | $form_action = 'editpost'; |
176 | -$nonce_action = 'update-post_' . $post_ID; |
|
177 | -$form_extra .= "<input type='hidden' id='post_ID' name='post_ID' value='" . esc_attr($post_ID) . "' />"; |
|
176 | +$nonce_action = 'update-post_'.$post_ID; |
|
177 | +$form_extra .= "<input type='hidden' id='post_ID' name='post_ID' value='".esc_attr($post_ID)."' />"; |
|
178 | 178 | |
179 | 179 | // Detect if there exists an autosave newer than the post and if that autosave is different than the post |
180 | -if ( $autosave && mysql2date( 'U', $autosave->post_modified_gmt, false ) > mysql2date( 'U', $post->post_modified_gmt, false ) ) { |
|
181 | - foreach ( _wp_post_revision_fields() as $autosave_field => $_autosave_field ) { |
|
182 | - if ( normalize_whitespace( $autosave->$autosave_field ) != normalize_whitespace( $post->$autosave_field ) ) { |
|
183 | - $notice = sprintf( __( 'There is an autosave of this post that is more recent than the version below. <a href="%s">View the autosave</a>' ), get_edit_post_link( $autosave->ID ) ); |
|
180 | +if ($autosave && mysql2date('U', $autosave->post_modified_gmt, false) > mysql2date('U', $post->post_modified_gmt, false)) { |
|
181 | + foreach (_wp_post_revision_fields() as $autosave_field => $_autosave_field) { |
|
182 | + if (normalize_whitespace($autosave->$autosave_field) != normalize_whitespace($post->$autosave_field)) { |
|
183 | + $notice = sprintf(__('There is an autosave of this post that is more recent than the version below. <a href="%s">View the autosave</a>'), get_edit_post_link($autosave->ID)); |
|
184 | 184 | break; |
185 | 185 | } |
186 | 186 | } |
187 | 187 | // If this autosave isn't different from the current post, begone. |
188 | - if ( ! $notice ) |
|
189 | - wp_delete_post_revision( $autosave->ID ); |
|
188 | + if ( ! $notice) |
|
189 | + wp_delete_post_revision($autosave->ID); |
|
190 | 190 | unset($autosave_field, $_autosave_field); |
191 | 191 | } |
192 | 192 | |
193 | 193 | $post_type_object = get_post_type_object($post_type); |
194 | 194 | |
195 | 195 | // All meta boxes should be defined and added before the first do_meta_boxes() call (or potentially during the do_meta_boxes action). |
196 | -require_once( ABSPATH . 'wp-admin/includes/meta-boxes.php' ); |
|
196 | +require_once(ABSPATH.'wp-admin/includes/meta-boxes.php'); |
|
197 | 197 | |
198 | 198 | |
199 | 199 | $publish_callback_args = null; |
200 | -if ( post_type_supports($post_type, 'revisions') && 'auto-draft' != $post->post_status ) { |
|
201 | - $revisions = wp_get_post_revisions( $post_ID ); |
|
200 | +if (post_type_supports($post_type, 'revisions') && 'auto-draft' != $post->post_status) { |
|
201 | + $revisions = wp_get_post_revisions($post_ID); |
|
202 | 202 | |
203 | 203 | // We should aim to show the revisions metabox only when there are revisions. |
204 | - if ( count( $revisions ) > 1 ) { |
|
205 | - reset( $revisions ); // Reset pointer for key() |
|
206 | - $publish_callback_args = array( 'revisions_count' => count( $revisions ), 'revision_id' => key( $revisions ) ); |
|
204 | + if (count($revisions) > 1) { |
|
205 | + reset($revisions); // Reset pointer for key() |
|
206 | + $publish_callback_args = array('revisions_count' => count($revisions), 'revision_id' => key($revisions)); |
|
207 | 207 | add_meta_box('revisionsdiv', __('Revisions'), 'post_revisions_meta_box', null, 'normal', 'core'); |
208 | 208 | } |
209 | 209 | } |
210 | 210 | |
211 | -if ( 'attachment' == $post_type ) { |
|
212 | - wp_enqueue_script( 'image-edit' ); |
|
213 | - wp_enqueue_style( 'imgareaselect' ); |
|
214 | - add_meta_box( 'submitdiv', __('Save'), 'attachment_submit_meta_box', null, 'side', 'core' ); |
|
215 | - add_action( 'edit_form_after_title', 'edit_form_image_editor' ); |
|
211 | +if ('attachment' == $post_type) { |
|
212 | + wp_enqueue_script('image-edit'); |
|
213 | + wp_enqueue_style('imgareaselect'); |
|
214 | + add_meta_box('submitdiv', __('Save'), 'attachment_submit_meta_box', null, 'side', 'core'); |
|
215 | + add_action('edit_form_after_title', 'edit_form_image_editor'); |
|
216 | 216 | |
217 | - if ( wp_attachment_is( 'audio', $post ) ) { |
|
218 | - add_meta_box( 'attachment-id3', __( 'Metadata' ), 'attachment_id3_data_meta_box', null, 'normal', 'core' ); |
|
217 | + if (wp_attachment_is('audio', $post)) { |
|
218 | + add_meta_box('attachment-id3', __('Metadata'), 'attachment_id3_data_meta_box', null, 'normal', 'core'); |
|
219 | 219 | } |
220 | 220 | } else { |
221 | - add_meta_box( 'submitdiv', __( 'Publish' ), 'post_submit_meta_box', null, 'side', 'core', $publish_callback_args ); |
|
221 | + add_meta_box('submitdiv', __('Publish'), 'post_submit_meta_box', null, 'side', 'core', $publish_callback_args); |
|
222 | 222 | } |
223 | 223 | |
224 | -if ( current_theme_supports( 'post-formats' ) && post_type_supports( $post_type, 'post-formats' ) ) |
|
225 | - add_meta_box( 'formatdiv', _x( 'Format', 'post format' ), 'post_format_meta_box', null, 'side', 'core' ); |
|
224 | +if (current_theme_supports('post-formats') && post_type_supports($post_type, 'post-formats')) |
|
225 | + add_meta_box('formatdiv', _x('Format', 'post format'), 'post_format_meta_box', null, 'side', 'core'); |
|
226 | 226 | |
227 | 227 | // all taxonomies |
228 | -foreach ( get_object_taxonomies( $post ) as $tax_name ) { |
|
229 | - $taxonomy = get_taxonomy( $tax_name ); |
|
230 | - if ( ! $taxonomy->show_ui || false === $taxonomy->meta_box_cb ) |
|
228 | +foreach (get_object_taxonomies($post) as $tax_name) { |
|
229 | + $taxonomy = get_taxonomy($tax_name); |
|
230 | + if ( ! $taxonomy->show_ui || false === $taxonomy->meta_box_cb) |
|
231 | 231 | continue; |
232 | 232 | |
233 | 233 | $label = $taxonomy->labels->name; |
234 | 234 | |
235 | - if ( ! is_taxonomy_hierarchical( $tax_name ) ) |
|
236 | - $tax_meta_box_id = 'tagsdiv-' . $tax_name; |
|
235 | + if ( ! is_taxonomy_hierarchical($tax_name)) |
|
236 | + $tax_meta_box_id = 'tagsdiv-'.$tax_name; |
|
237 | 237 | else |
238 | - $tax_meta_box_id = $tax_name . 'div'; |
|
238 | + $tax_meta_box_id = $tax_name.'div'; |
|
239 | 239 | |
240 | - add_meta_box( $tax_meta_box_id, $label, $taxonomy->meta_box_cb, null, 'side', 'core', array( 'taxonomy' => $tax_name ) ); |
|
240 | + add_meta_box($tax_meta_box_id, $label, $taxonomy->meta_box_cb, null, 'side', 'core', array('taxonomy' => $tax_name)); |
|
241 | 241 | } |
242 | 242 | |
243 | -if ( post_type_supports($post_type, 'page-attributes') ) |
|
243 | +if (post_type_supports($post_type, 'page-attributes')) |
|
244 | 244 | add_meta_box('pageparentdiv', 'page' == $post_type ? __('Page Attributes') : __('Attributes'), 'page_attributes_meta_box', null, 'side', 'core'); |
245 | 245 | |
246 | -if ( $thumbnail_support && current_user_can( 'upload_files' ) ) |
|
247 | - add_meta_box('postimagediv', esc_html( $post_type_object->labels->featured_image ), 'post_thumbnail_meta_box', null, 'side', 'low'); |
|
246 | +if ($thumbnail_support && current_user_can('upload_files')) |
|
247 | + add_meta_box('postimagediv', esc_html($post_type_object->labels->featured_image), 'post_thumbnail_meta_box', null, 'side', 'low'); |
|
248 | 248 | |
249 | -if ( post_type_supports($post_type, 'excerpt') ) |
|
249 | +if (post_type_supports($post_type, 'excerpt')) |
|
250 | 250 | add_meta_box('postexcerpt', __('Excerpt'), 'post_excerpt_meta_box', null, 'normal', 'core'); |
251 | 251 | |
252 | -if ( post_type_supports($post_type, 'trackbacks') ) |
|
252 | +if (post_type_supports($post_type, 'trackbacks')) |
|
253 | 253 | add_meta_box('trackbacksdiv', __('Send Trackbacks'), 'post_trackback_meta_box', null, 'normal', 'core'); |
254 | 254 | |
255 | -if ( post_type_supports($post_type, 'custom-fields') ) |
|
255 | +if (post_type_supports($post_type, 'custom-fields')) |
|
256 | 256 | add_meta_box('postcustom', __('Custom Fields'), 'post_custom_meta_box', null, 'normal', 'core'); |
257 | 257 | |
258 | 258 | /** |
@@ -263,19 +263,19 @@ discard block |
||
263 | 263 | * |
264 | 264 | * @param WP_Post $post Post object. |
265 | 265 | */ |
266 | -do_action( 'dbx_post_advanced', $post ); |
|
266 | +do_action('dbx_post_advanced', $post); |
|
267 | 267 | |
268 | -if ( post_type_supports($post_type, 'comments') ) |
|
268 | +if (post_type_supports($post_type, 'comments')) |
|
269 | 269 | add_meta_box('commentstatusdiv', __('Discussion'), 'post_comment_status_meta_box', null, 'normal', 'core'); |
270 | 270 | |
271 | -if ( ( 'publish' == get_post_status( $post ) || 'private' == get_post_status( $post ) ) && post_type_supports($post_type, 'comments') ) |
|
271 | +if (('publish' == get_post_status($post) || 'private' == get_post_status($post)) && post_type_supports($post_type, 'comments')) |
|
272 | 272 | add_meta_box('commentsdiv', __('Comments'), 'post_comment_meta_box', null, 'normal', 'core'); |
273 | 273 | |
274 | -if ( ! ( 'pending' == get_post_status( $post ) && ! current_user_can( $post_type_object->cap->publish_posts ) ) ) |
|
274 | +if ( ! ('pending' == get_post_status($post) && ! current_user_can($post_type_object->cap->publish_posts))) |
|
275 | 275 | add_meta_box('slugdiv', __('Slug'), 'post_slug_meta_box', null, 'normal', 'core'); |
276 | 276 | |
277 | -if ( post_type_supports($post_type, 'author') ) { |
|
278 | - if ( is_super_admin() || current_user_can( $post_type_object->cap->edit_others_posts ) ) |
|
277 | +if (post_type_supports($post_type, 'author')) { |
|
278 | + if (is_super_admin() || current_user_can($post_type_object->cap->edit_others_posts)) |
|
279 | 279 | add_meta_box('authordiv', __('Author'), 'post_author_meta_box', null, 'normal', 'core'); |
280 | 280 | } |
281 | 281 | |
@@ -287,7 +287,7 @@ discard block |
||
287 | 287 | * @param string $post_type Post type. |
288 | 288 | * @param WP_Post $post Post object. |
289 | 289 | */ |
290 | -do_action( 'add_meta_boxes', $post_type, $post ); |
|
290 | +do_action('add_meta_boxes', $post_type, $post); |
|
291 | 291 | |
292 | 292 | /** |
293 | 293 | * Fires after all built-in meta boxes have been added, contextually for the given post type. |
@@ -298,7 +298,7 @@ discard block |
||
298 | 298 | * |
299 | 299 | * @param WP_Post $post Post object. |
300 | 300 | */ |
301 | -do_action( 'add_meta_boxes_' . $post_type, $post ); |
|
301 | +do_action('add_meta_boxes_'.$post_type, $post); |
|
302 | 302 | |
303 | 303 | /** |
304 | 304 | * Fires after meta boxes have been added. |
@@ -311,147 +311,147 @@ discard block |
||
311 | 311 | * @param string $context string Meta box context. |
312 | 312 | * @param WP_Post $post Post object. |
313 | 313 | */ |
314 | -do_action( 'do_meta_boxes', $post_type, 'normal', $post ); |
|
314 | +do_action('do_meta_boxes', $post_type, 'normal', $post); |
|
315 | 315 | /** This action is documented in wp-admin/edit-form-advanced.php */ |
316 | -do_action( 'do_meta_boxes', $post_type, 'advanced', $post ); |
|
316 | +do_action('do_meta_boxes', $post_type, 'advanced', $post); |
|
317 | 317 | /** This action is documented in wp-admin/edit-form-advanced.php */ |
318 | -do_action( 'do_meta_boxes', $post_type, 'side', $post ); |
|
318 | +do_action('do_meta_boxes', $post_type, 'side', $post); |
|
319 | 319 | |
320 | -add_screen_option('layout_columns', array('max' => 2, 'default' => 2) ); |
|
320 | +add_screen_option('layout_columns', array('max' => 2, 'default' => 2)); |
|
321 | 321 | |
322 | -if ( 'post' == $post_type ) { |
|
323 | - $customize_display = '<p>' . __('The title field and the big Post Editing Area are fixed in place, but you can reposition all the other boxes using drag and drop. You can also minimize or expand them by clicking the title bar of each box. Use the Screen Options tab to unhide more boxes (Excerpt, Send Trackbacks, Custom Fields, Discussion, Slug, Author) or to choose a 1- or 2-column layout for this screen.') . '</p>'; |
|
322 | +if ('post' == $post_type) { |
|
323 | + $customize_display = '<p>'.__('The title field and the big Post Editing Area are fixed in place, but you can reposition all the other boxes using drag and drop. You can also minimize or expand them by clicking the title bar of each box. Use the Screen Options tab to unhide more boxes (Excerpt, Send Trackbacks, Custom Fields, Discussion, Slug, Author) or to choose a 1- or 2-column layout for this screen.').'</p>'; |
|
324 | 324 | |
325 | - get_current_screen()->add_help_tab( array( |
|
325 | + get_current_screen()->add_help_tab(array( |
|
326 | 326 | 'id' => 'customize-display', |
327 | 327 | 'title' => __('Customizing This Display'), |
328 | 328 | 'content' => $customize_display, |
329 | - ) ); |
|
329 | + )); |
|
330 | 330 | |
331 | - $title_and_editor = '<p>' . __('<strong>Title</strong> — Enter a title for your post. After you enter a title, you’ll see the permalink below, which you can edit.') . '</p>'; |
|
332 | - $title_and_editor .= '<p>' . __( '<strong>Post editor</strong> — Enter the text for your post. There are two modes of editing: Visual and Text. Choose the mode by clicking on the appropriate tab.' ) . '</p>'; |
|
333 | - $title_and_editor .= '<p>' . __( 'Visual mode gives you a WYSIWYG editor. Click the last icon in the row to get a second row of controls. ') . '</p>'; |
|
334 | - $title_and_editor .= '<p>' . __( 'The Text mode allows you to enter HTML along with your post text. Line breaks will be converted to paragraphs automatically.' ) . '</p>'; |
|
335 | - $title_and_editor .= '<p>' . __( 'You can insert media files by clicking the icons above the post editor and following the directions. You can align or edit images using the inline formatting toolbar available in Visual mode.' ) . '</p>'; |
|
336 | - $title_and_editor .= '<p>' . __( 'You can enable distraction-free writing mode using the icon to the right. This feature is not available for old browsers or devices with small screens, and requires that the full-height editor be enabled in Screen Options.' ) . '</p>'; |
|
337 | - $title_and_editor .= '<p>' . __( 'Keyboard users: When you’re working in the visual editor, you can use <kbd>Alt + F10</kbd> to access the toolbar.' ) . '</p>'; |
|
331 | + $title_and_editor = '<p>'.__('<strong>Title</strong> — Enter a title for your post. After you enter a title, you’ll see the permalink below, which you can edit.').'</p>'; |
|
332 | + $title_and_editor .= '<p>'.__('<strong>Post editor</strong> — Enter the text for your post. There are two modes of editing: Visual and Text. Choose the mode by clicking on the appropriate tab.').'</p>'; |
|
333 | + $title_and_editor .= '<p>'.__('Visual mode gives you a WYSIWYG editor. Click the last icon in the row to get a second row of controls. ').'</p>'; |
|
334 | + $title_and_editor .= '<p>'.__('The Text mode allows you to enter HTML along with your post text. Line breaks will be converted to paragraphs automatically.').'</p>'; |
|
335 | + $title_and_editor .= '<p>'.__('You can insert media files by clicking the icons above the post editor and following the directions. You can align or edit images using the inline formatting toolbar available in Visual mode.').'</p>'; |
|
336 | + $title_and_editor .= '<p>'.__('You can enable distraction-free writing mode using the icon to the right. This feature is not available for old browsers or devices with small screens, and requires that the full-height editor be enabled in Screen Options.').'</p>'; |
|
337 | + $title_and_editor .= '<p>'.__('Keyboard users: When you’re working in the visual editor, you can use <kbd>Alt + F10</kbd> to access the toolbar.').'</p>'; |
|
338 | 338 | |
339 | - get_current_screen()->add_help_tab( array( |
|
339 | + get_current_screen()->add_help_tab(array( |
|
340 | 340 | 'id' => 'title-post-editor', |
341 | 341 | 'title' => __('Title and Post Editor'), |
342 | 342 | 'content' => $title_and_editor, |
343 | - ) ); |
|
343 | + )); |
|
344 | 344 | |
345 | 345 | get_current_screen()->set_help_sidebar( |
346 | - '<p>' . sprintf(__('You can also create posts with the <a href="%s">Press This bookmarklet</a>.'), 'tools.php') . '</p>' . |
|
347 | - '<p><strong>' . __('For more information:') . '</strong></p>' . |
|
348 | - '<p>' . __('<a href="https://codex.wordpress.org/Posts_Add_New_Screen" target="_blank">Documentation on Writing and Editing Posts</a>') . '</p>' . |
|
349 | - '<p>' . __('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>' |
|
346 | + '<p>'.sprintf(__('You can also create posts with the <a href="%s">Press This bookmarklet</a>.'), 'tools.php').'</p>'. |
|
347 | + '<p><strong>'.__('For more information:').'</strong></p>'. |
|
348 | + '<p>'.__('<a href="https://codex.wordpress.org/Posts_Add_New_Screen" target="_blank">Documentation on Writing and Editing Posts</a>').'</p>'. |
|
349 | + '<p>'.__('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>').'</p>' |
|
350 | 350 | ); |
351 | -} elseif ( 'page' == $post_type ) { |
|
352 | - $about_pages = '<p>' . __('Pages are similar to posts in that they have a title, body text, and associated metadata, but they are different in that they are not part of the chronological blog stream, kind of like permanent posts. Pages are not categorized or tagged, but can have a hierarchy. You can nest pages under other pages by making one the “Parent” of the other, creating a group of pages.') . '</p>' . |
|
353 | - '<p>' . __('Creating a Page is very similar to creating a Post, and the screens can be customized in the same way using drag and drop, the Screen Options tab, and expanding/collapsing boxes as you choose. This screen also has the distraction-free writing space, available in both the Visual and Text modes via the Fullscreen buttons. The Page editor mostly works the same as the Post editor, but there are some Page-specific features in the Page Attributes box:') . '</p>'; |
|
351 | +} elseif ('page' == $post_type) { |
|
352 | + $about_pages = '<p>'.__('Pages are similar to posts in that they have a title, body text, and associated metadata, but they are different in that they are not part of the chronological blog stream, kind of like permanent posts. Pages are not categorized or tagged, but can have a hierarchy. You can nest pages under other pages by making one the “Parent” of the other, creating a group of pages.').'</p>'. |
|
353 | + '<p>'.__('Creating a Page is very similar to creating a Post, and the screens can be customized in the same way using drag and drop, the Screen Options tab, and expanding/collapsing boxes as you choose. This screen also has the distraction-free writing space, available in both the Visual and Text modes via the Fullscreen buttons. The Page editor mostly works the same as the Post editor, but there are some Page-specific features in the Page Attributes box:').'</p>'; |
|
354 | 354 | |
355 | - get_current_screen()->add_help_tab( array( |
|
355 | + get_current_screen()->add_help_tab(array( |
|
356 | 356 | 'id' => 'about-pages', |
357 | 357 | 'title' => __('About Pages'), |
358 | 358 | 'content' => $about_pages, |
359 | - ) ); |
|
359 | + )); |
|
360 | 360 | |
361 | 361 | get_current_screen()->set_help_sidebar( |
362 | - '<p><strong>' . __('For more information:') . '</strong></p>' . |
|
363 | - '<p>' . __('<a href="https://codex.wordpress.org/Pages_Add_New_Screen" target="_blank">Documentation on Adding New Pages</a>') . '</p>' . |
|
364 | - '<p>' . __('<a href="https://codex.wordpress.org/Pages_Screen#Editing_Individual_Pages" target="_blank">Documentation on Editing Pages</a>') . '</p>' . |
|
365 | - '<p>' . __('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>' |
|
362 | + '<p><strong>'.__('For more information:').'</strong></p>'. |
|
363 | + '<p>'.__('<a href="https://codex.wordpress.org/Pages_Add_New_Screen" target="_blank">Documentation on Adding New Pages</a>').'</p>'. |
|
364 | + '<p>'.__('<a href="https://codex.wordpress.org/Pages_Screen#Editing_Individual_Pages" target="_blank">Documentation on Editing Pages</a>').'</p>'. |
|
365 | + '<p>'.__('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>').'</p>' |
|
366 | 366 | ); |
367 | -} elseif ( 'attachment' == $post_type ) { |
|
368 | - get_current_screen()->add_help_tab( array( |
|
367 | +} elseif ('attachment' == $post_type) { |
|
368 | + get_current_screen()->add_help_tab(array( |
|
369 | 369 | 'id' => 'overview', |
370 | 370 | 'title' => __('Overview'), |
371 | 371 | 'content' => |
372 | - '<p>' . __('This screen allows you to edit four fields for metadata in a file within the media library.') . '</p>' . |
|
373 | - '<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>' . |
|
374 | - '<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>' . |
|
375 | - '<p>' . __('Remember to click Update Media to save metadata entered or changed.') . '</p>' |
|
376 | - ) ); |
|
372 | + '<p>'.__('This screen allows you to edit four fields for metadata in a file within the media library.').'</p>'. |
|
373 | + '<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>'. |
|
374 | + '<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>'. |
|
375 | + '<p>'.__('Remember to click Update Media to save metadata entered or changed.').'</p>' |
|
376 | + )); |
|
377 | 377 | |
378 | 378 | get_current_screen()->set_help_sidebar( |
379 | - '<p><strong>' . __('For more information:') . '</strong></p>' . |
|
380 | - '<p>' . __('<a href="https://codex.wordpress.org/Media_Add_New_Screen#Edit_Media" target="_blank">Documentation on Edit Media</a>') . '</p>' . |
|
381 | - '<p>' . __('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>' |
|
379 | + '<p><strong>'.__('For more information:').'</strong></p>'. |
|
380 | + '<p>'.__('<a href="https://codex.wordpress.org/Media_Add_New_Screen#Edit_Media" target="_blank">Documentation on Edit Media</a>').'</p>'. |
|
381 | + '<p>'.__('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>').'</p>' |
|
382 | 382 | ); |
383 | 383 | } |
384 | 384 | |
385 | -if ( 'post' == $post_type || 'page' == $post_type ) { |
|
386 | - $inserting_media = '<p>' . __( 'You can upload and insert media (images, audio, documents, etc.) by clicking the Add Media button. You can select from the images and files already uploaded to the Media Library, or upload new media to add to your page or post. To create an image gallery, select the images to add and click the “Create a new gallery” button.' ) . '</p>'; |
|
387 | - $inserting_media .= '<p>' . __( 'You can also embed media from many popular websites including Twitter, YouTube, Flickr and others by pasting the media URL on its own line into the content of your post/page. Please refer to the Codex to <a href="https://codex.wordpress.org/Embeds">learn more about embeds</a>.' ) . '</p>'; |
|
385 | +if ('post' == $post_type || 'page' == $post_type) { |
|
386 | + $inserting_media = '<p>'.__('You can upload and insert media (images, audio, documents, etc.) by clicking the Add Media button. You can select from the images and files already uploaded to the Media Library, or upload new media to add to your page or post. To create an image gallery, select the images to add and click the “Create a new gallery” button.').'</p>'; |
|
387 | + $inserting_media .= '<p>'.__('You can also embed media from many popular websites including Twitter, YouTube, Flickr and others by pasting the media URL on its own line into the content of your post/page. Please refer to the Codex to <a href="https://codex.wordpress.org/Embeds">learn more about embeds</a>.').'</p>'; |
|
388 | 388 | |
389 | - get_current_screen()->add_help_tab( array( |
|
389 | + get_current_screen()->add_help_tab(array( |
|
390 | 390 | 'id' => 'inserting-media', |
391 | - 'title' => __( 'Inserting Media' ), |
|
391 | + 'title' => __('Inserting Media'), |
|
392 | 392 | 'content' => $inserting_media, |
393 | - ) ); |
|
393 | + )); |
|
394 | 394 | } |
395 | 395 | |
396 | -if ( 'post' == $post_type ) { |
|
397 | - $publish_box = '<p>' . __('Several boxes on this screen contain settings for how your content will be published, including:') . '</p>'; |
|
398 | - $publish_box .= '<ul><li>' . __('<strong>Publish</strong> — You can set the terms of publishing your post in the Publish box. For Status, Visibility, and Publish (immediately), click on the Edit link to reveal more options. Visibility includes options for password-protecting a post or making it stay at the top of your blog indefinitely (sticky). Publish (immediately) allows you to set a future or past date and time, so you can schedule a post to be published in the future or backdate a post.') . '</li>'; |
|
396 | +if ('post' == $post_type) { |
|
397 | + $publish_box = '<p>'.__('Several boxes on this screen contain settings for how your content will be published, including:').'</p>'; |
|
398 | + $publish_box .= '<ul><li>'.__('<strong>Publish</strong> — You can set the terms of publishing your post in the Publish box. For Status, Visibility, and Publish (immediately), click on the Edit link to reveal more options. Visibility includes options for password-protecting a post or making it stay at the top of your blog indefinitely (sticky). Publish (immediately) allows you to set a future or past date and time, so you can schedule a post to be published in the future or backdate a post.').'</li>'; |
|
399 | 399 | |
400 | - if ( current_theme_supports( 'post-formats' ) && post_type_supports( 'post', 'post-formats' ) ) { |
|
401 | - $publish_box .= '<li>' . __( '<strong>Format</strong> — Post Formats designate how your theme will display a specific post. For example, you could have a <em>standard</em> blog post with a title and paragraphs, or a short <em>aside</em> that omits the title and contains a short text blurb. Please refer to the Codex for <a href="https://codex.wordpress.org/Post_Formats#Supported_Formats">descriptions of each post format</a>. Your theme could enable all or some of 10 possible formats.' ) . '</li>'; |
|
400 | + if (current_theme_supports('post-formats') && post_type_supports('post', 'post-formats')) { |
|
401 | + $publish_box .= '<li>'.__('<strong>Format</strong> — Post Formats designate how your theme will display a specific post. For example, you could have a <em>standard</em> blog post with a title and paragraphs, or a short <em>aside</em> that omits the title and contains a short text blurb. Please refer to the Codex for <a href="https://codex.wordpress.org/Post_Formats#Supported_Formats">descriptions of each post format</a>. Your theme could enable all or some of 10 possible formats.').'</li>'; |
|
402 | 402 | } |
403 | 403 | |
404 | - if ( current_theme_supports( 'post-thumbnails' ) && post_type_supports( 'post', 'thumbnail' ) ) { |
|
404 | + if (current_theme_supports('post-thumbnails') && post_type_supports('post', 'thumbnail')) { |
|
405 | 405 | /* translators: %s: Featured Image */ |
406 | - $publish_box .= '<li>' . sprintf( __( '<strong>%s</strong> — This allows you to associate an image with your post without inserting it. This is usually useful only if your theme makes use of the image as a post thumbnail on the home page, a custom header, etc.' ), esc_html( $post_type_object->labels->featured_image ) ) . '</li>'; |
|
406 | + $publish_box .= '<li>'.sprintf(__('<strong>%s</strong> — This allows you to associate an image with your post without inserting it. This is usually useful only if your theme makes use of the image as a post thumbnail on the home page, a custom header, etc.'), esc_html($post_type_object->labels->featured_image)).'</li>'; |
|
407 | 407 | } |
408 | 408 | |
409 | 409 | $publish_box .= '</ul>'; |
410 | 410 | |
411 | - get_current_screen()->add_help_tab( array( |
|
411 | + get_current_screen()->add_help_tab(array( |
|
412 | 412 | 'id' => 'publish-box', |
413 | 413 | 'title' => __('Publish Settings'), |
414 | 414 | 'content' => $publish_box, |
415 | - ) ); |
|
415 | + )); |
|
416 | 416 | |
417 | - $discussion_settings = '<p>' . __('<strong>Send Trackbacks</strong> — Trackbacks are a way to notify legacy blog systems that you’ve linked to them. Enter the URL(s) you want to send trackbacks. If you link to other WordPress sites they’ll be notified automatically using pingbacks, and this field is unnecessary.') . '</p>'; |
|
418 | - $discussion_settings .= '<p>' . __('<strong>Discussion</strong> — You can turn comments and pings on or off, and if there are comments on the post, you can see them here and moderate them.') . '</p>'; |
|
417 | + $discussion_settings = '<p>'.__('<strong>Send Trackbacks</strong> — Trackbacks are a way to notify legacy blog systems that you’ve linked to them. Enter the URL(s) you want to send trackbacks. If you link to other WordPress sites they’ll be notified automatically using pingbacks, and this field is unnecessary.').'</p>'; |
|
418 | + $discussion_settings .= '<p>'.__('<strong>Discussion</strong> — You can turn comments and pings on or off, and if there are comments on the post, you can see them here and moderate them.').'</p>'; |
|
419 | 419 | |
420 | - get_current_screen()->add_help_tab( array( |
|
420 | + get_current_screen()->add_help_tab(array( |
|
421 | 421 | 'id' => 'discussion-settings', |
422 | 422 | 'title' => __('Discussion Settings'), |
423 | 423 | 'content' => $discussion_settings, |
424 | - ) ); |
|
425 | -} elseif ( 'page' == $post_type ) { |
|
426 | - $page_attributes = '<p>' . __('<strong>Parent</strong> — You can arrange your pages in hierarchies. For example, you could have an “About” page that has “Life Story” and “My Dog” pages under it. There are no limits to how many levels you can nest pages.') . '</p>' . |
|
427 | - '<p>' . __('<strong>Template</strong> — Some themes have custom templates you can use for certain pages that might have additional features or custom layouts. If so, you’ll see them in this dropdown menu.') . '</p>' . |
|
428 | - '<p>' . __('<strong>Order</strong> — Pages are usually ordered alphabetically, but you can choose your own order by entering a number (1 for first, etc.) in this field.') . '</p>'; |
|
424 | + )); |
|
425 | +} elseif ('page' == $post_type) { |
|
426 | + $page_attributes = '<p>'.__('<strong>Parent</strong> — You can arrange your pages in hierarchies. For example, you could have an “About” page that has “Life Story” and “My Dog” pages under it. There are no limits to how many levels you can nest pages.').'</p>'. |
|
427 | + '<p>'.__('<strong>Template</strong> — Some themes have custom templates you can use for certain pages that might have additional features or custom layouts. If so, you’ll see them in this dropdown menu.').'</p>'. |
|
428 | + '<p>'.__('<strong>Order</strong> — Pages are usually ordered alphabetically, but you can choose your own order by entering a number (1 for first, etc.) in this field.').'</p>'; |
|
429 | 429 | |
430 | - get_current_screen()->add_help_tab( array( |
|
430 | + get_current_screen()->add_help_tab(array( |
|
431 | 431 | 'id' => 'page-attributes', |
432 | 432 | 'title' => __('Page Attributes'), |
433 | 433 | 'content' => $page_attributes, |
434 | - ) ); |
|
434 | + )); |
|
435 | 435 | } |
436 | 436 | |
437 | -require_once( ABSPATH . 'wp-admin/admin-header.php' ); |
|
437 | +require_once(ABSPATH.'wp-admin/admin-header.php'); |
|
438 | 438 | ?> |
439 | 439 | |
440 | 440 | <div class="wrap"> |
441 | 441 | <h1><?php |
442 | -echo esc_html( $title ); |
|
443 | -if ( isset( $post_new_file ) && current_user_can( $post_type_object->cap->create_posts ) ) |
|
444 | - echo ' <a href="' . esc_url( admin_url( $post_new_file ) ) . '" class="page-title-action">' . esc_html( $post_type_object->labels->add_new ) . '</a>'; |
|
442 | +echo esc_html($title); |
|
443 | +if (isset($post_new_file) && current_user_can($post_type_object->cap->create_posts)) |
|
444 | + echo ' <a href="'.esc_url(admin_url($post_new_file)).'" class="page-title-action">'.esc_html($post_type_object->labels->add_new).'</a>'; |
|
445 | 445 | ?></h1> |
446 | -<?php if ( $notice ) : ?> |
|
446 | +<?php if ($notice) : ?> |
|
447 | 447 | <div id="notice" class="notice notice-warning"><p id="has-newer-autosave"><?php echo $notice ?></p></div> |
448 | 448 | <?php endif; ?> |
449 | -<?php if ( $message ) : ?> |
|
449 | +<?php if ($message) : ?> |
|
450 | 450 | <div id="message" class="updated notice notice-success is-dismissible"><p><?php echo $message; ?></p></div> |
451 | 451 | <?php endif; ?> |
452 | 452 | <div id="lost-connection-notice" class="error hidden"> |
453 | - <p><span class="spinner"></span> <?php _e( '<strong>Connection lost.</strong> Saving has been disabled until you’re reconnected.' ); ?> |
|
454 | - <span class="hide-if-no-sessionstorage"><?php _e( 'We’re backing up this post in your browser, just in case.' ); ?></span> |
|
453 | + <p><span class="spinner"></span> <?php _e('<strong>Connection lost.</strong> Saving has been disabled until you’re reconnected.'); ?> |
|
454 | + <span class="hide-if-no-sessionstorage"><?php _e('We’re backing up this post in your browser, just in case.'); ?></span> |
|
455 | 455 | </p> |
456 | 456 | </div> |
457 | 457 | <form name="post" action="post.php" method="post" id="post"<?php |
@@ -462,29 +462,29 @@ discard block |
||
462 | 462 | * |
463 | 463 | * @param WP_Post $post Post object. |
464 | 464 | */ |
465 | -do_action( 'post_edit_form_tag', $post ); |
|
465 | +do_action('post_edit_form_tag', $post); |
|
466 | 466 | |
467 | 467 | $referer = wp_get_referer(); |
468 | 468 | ?>> |
469 | 469 | <?php wp_nonce_field($nonce_action); ?> |
470 | 470 | <input type="hidden" id="user-id" name="user_ID" value="<?php echo (int) $user_ID ?>" /> |
471 | -<input type="hidden" id="hiddenaction" name="action" value="<?php echo esc_attr( $form_action ) ?>" /> |
|
472 | -<input type="hidden" id="originalaction" name="originalaction" value="<?php echo esc_attr( $form_action ) ?>" /> |
|
473 | -<input type="hidden" id="post_author" name="post_author" value="<?php echo esc_attr( $post->post_author ); ?>" /> |
|
474 | -<input type="hidden" id="post_type" name="post_type" value="<?php echo esc_attr( $post_type ) ?>" /> |
|
475 | -<input type="hidden" id="original_post_status" name="original_post_status" value="<?php echo esc_attr( $post->post_status) ?>" /> |
|
476 | -<input type="hidden" id="referredby" name="referredby" value="<?php echo $referer ? esc_url( $referer ) : ''; ?>" /> |
|
477 | -<?php if ( ! empty( $active_post_lock ) ) { ?> |
|
478 | -<input type="hidden" id="active_post_lock" value="<?php echo esc_attr( implode( ':', $active_post_lock ) ); ?>" /> |
|
471 | +<input type="hidden" id="hiddenaction" name="action" value="<?php echo esc_attr($form_action) ?>" /> |
|
472 | +<input type="hidden" id="originalaction" name="originalaction" value="<?php echo esc_attr($form_action) ?>" /> |
|
473 | +<input type="hidden" id="post_author" name="post_author" value="<?php echo esc_attr($post->post_author); ?>" /> |
|
474 | +<input type="hidden" id="post_type" name="post_type" value="<?php echo esc_attr($post_type) ?>" /> |
|
475 | +<input type="hidden" id="original_post_status" name="original_post_status" value="<?php echo esc_attr($post->post_status) ?>" /> |
|
476 | +<input type="hidden" id="referredby" name="referredby" value="<?php echo $referer ? esc_url($referer) : ''; ?>" /> |
|
477 | +<?php if ( ! empty($active_post_lock)) { ?> |
|
478 | +<input type="hidden" id="active_post_lock" value="<?php echo esc_attr(implode(':', $active_post_lock)); ?>" /> |
|
479 | 479 | <?php |
480 | 480 | } |
481 | -if ( 'draft' != get_post_status( $post ) ) |
|
481 | +if ('draft' != get_post_status($post)) |
|
482 | 482 | wp_original_referer_field(true, 'previous'); |
483 | 483 | |
484 | 484 | echo $form_extra; |
485 | 485 | |
486 | -wp_nonce_field( 'meta-box-order', 'meta-box-order-nonce', false ); |
|
487 | -wp_nonce_field( 'closedpostboxes', 'closedpostboxesnonce', false ); |
|
486 | +wp_nonce_field('meta-box-order', 'meta-box-order-nonce', false); |
|
487 | +wp_nonce_field('closedpostboxes', 'closedpostboxesnonce', false); |
|
488 | 488 | ?> |
489 | 489 | |
490 | 490 | <?php |
@@ -497,13 +497,13 @@ discard block |
||
497 | 497 | * |
498 | 498 | * @param WP_Post $post Post object. |
499 | 499 | */ |
500 | -do_action( 'edit_form_top', $post ); ?> |
|
500 | +do_action('edit_form_top', $post); ?> |
|
501 | 501 | |
502 | 502 | <div id="poststuff"> |
503 | 503 | <div id="post-body" class="metabox-holder columns-<?php echo 1 == get_current_screen()->get_columns() ? '1' : '2'; ?>"> |
504 | 504 | <div id="post-body-content"> |
505 | 505 | |
506 | -<?php if ( post_type_supports($post_type, 'title') ) { ?> |
|
506 | +<?php if (post_type_supports($post_type, 'title')) { ?> |
|
507 | 507 | <div id="titlediv"> |
508 | 508 | <div id="titlewrap"> |
509 | 509 | <?php |
@@ -515,10 +515,10 @@ discard block |
||
515 | 515 | * @param string $text Placeholder text. Default 'Enter title here'. |
516 | 516 | * @param WP_Post $post Post object. |
517 | 517 | */ |
518 | - $title_placeholder = apply_filters( 'enter_title_here', __( 'Enter title here' ), $post ); |
|
518 | + $title_placeholder = apply_filters('enter_title_here', __('Enter title here'), $post); |
|
519 | 519 | ?> |
520 | 520 | <label class="screen-reader-text" id="title-prompt-text" for="title"><?php echo $title_placeholder; ?></label> |
521 | - <input type="text" name="post_title" size="30" value="<?php echo esc_attr( $post->post_title ); ?>" id="title" spellcheck="true" autocomplete="off" /> |
|
521 | + <input type="text" name="post_title" size="30" value="<?php echo esc_attr($post->post_title); ?>" id="title" spellcheck="true" autocomplete="off" /> |
|
522 | 522 | </div> |
523 | 523 | <?php |
524 | 524 | /** |
@@ -528,23 +528,23 @@ discard block |
||
528 | 528 | * |
529 | 529 | * @param WP_Post $post Post object. |
530 | 530 | */ |
531 | -do_action( 'edit_form_before_permalink', $post ); |
|
531 | +do_action('edit_form_before_permalink', $post); |
|
532 | 532 | ?> |
533 | 533 | <div class="inside"> |
534 | 534 | <?php |
535 | -if ( $viewable ) : |
|
535 | +if ($viewable) : |
|
536 | 536 | $sample_permalink_html = $post_type_object->public ? get_sample_permalink_html($post->ID) : ''; |
537 | 537 | $shortlink = wp_get_shortlink($post->ID, 'post'); |
538 | 538 | |
539 | -if ( !empty( $shortlink ) && $shortlink !== $permalink && $permalink !== home_url('?page_id=' . $post->ID) ) |
|
540 | - $sample_permalink_html .= '<input id="shortlink" type="hidden" value="' . esc_attr($shortlink) . '" /><a href="#" class="button button-small" onclick="prompt('URL:', jQuery(\'#shortlink\').val()); return false;">' . __('Get Shortlink') . '</a>'; |
|
539 | +if ( ! empty($shortlink) && $shortlink !== $permalink && $permalink !== home_url('?page_id='.$post->ID)) |
|
540 | + $sample_permalink_html .= '<input id="shortlink" type="hidden" value="'.esc_attr($shortlink).'" /><a href="#" class="button button-small" onclick="prompt('URL:', jQuery(\'#shortlink\').val()); return false;">'.__('Get Shortlink').'</a>'; |
|
541 | 541 | |
542 | -if ( $post_type_object->public && ! ( 'pending' == get_post_status( $post ) && !current_user_can( $post_type_object->cap->publish_posts ) ) ) { |
|
542 | +if ($post_type_object->public && ! ('pending' == get_post_status($post) && ! current_user_can($post_type_object->cap->publish_posts))) { |
|
543 | 543 | $has_sample_permalink = $sample_permalink_html && 'auto-draft' != $post->post_status; |
544 | 544 | ?> |
545 | 545 | <div id="edit-slug-box" class="hide-if-no-js"> |
546 | 546 | <?php |
547 | - if ( $has_sample_permalink ) |
|
547 | + if ($has_sample_permalink) |
|
548 | 548 | echo $sample_permalink_html; |
549 | 549 | ?> |
550 | 550 | </div> |
@@ -554,7 +554,7 @@ discard block |
||
554 | 554 | ?> |
555 | 555 | </div> |
556 | 556 | <?php |
557 | -wp_nonce_field( 'samplepermalink', 'samplepermalinknonce', false ); |
|
557 | +wp_nonce_field('samplepermalink', 'samplepermalinknonce', false); |
|
558 | 558 | ?> |
559 | 559 | </div><!-- /titlediv --> |
560 | 560 | <?php |
@@ -566,13 +566,13 @@ discard block |
||
566 | 566 | * |
567 | 567 | * @param WP_Post $post Post object. |
568 | 568 | */ |
569 | -do_action( 'edit_form_after_title', $post ); |
|
569 | +do_action('edit_form_after_title', $post); |
|
570 | 570 | |
571 | -if ( post_type_supports($post_type, 'editor') ) { |
|
571 | +if (post_type_supports($post_type, 'editor')) { |
|
572 | 572 | ?> |
573 | -<div id="postdivrich" class="postarea<?php if ( $_wp_editor_expand ) { echo ' wp-editor-expand'; } ?>"> |
|
573 | +<div id="postdivrich" class="postarea<?php if ($_wp_editor_expand) { echo ' wp-editor-expand'; } ?>"> |
|
574 | 574 | |
575 | -<?php wp_editor( $post->post_content, 'content', array( |
|
575 | +<?php wp_editor($post->post_content, 'content', array( |
|
576 | 576 | '_content_editor_dfw' => $_content_editor_dfw, |
577 | 577 | 'drag_drop_upload' => true, |
578 | 578 | 'tabfocus_elements' => 'content-html,save-post', |
@@ -582,16 +582,16 @@ discard block |
||
582 | 582 | 'wp_autoresize_on' => $_wp_editor_expand, |
583 | 583 | 'add_unload_trigger' => false, |
584 | 584 | ), |
585 | -) ); ?> |
|
585 | +)); ?> |
|
586 | 586 | <table id="post-status-info"><tbody><tr> |
587 | - <td id="wp-word-count"><?php printf( __( 'Word count: %s' ), '<span class="word-count">0</span>' ); ?></td> |
|
587 | + <td id="wp-word-count"><?php printf(__('Word count: %s'), '<span class="word-count">0</span>'); ?></td> |
|
588 | 588 | <td class="autosave-info"> |
589 | 589 | <span class="autosave-message"> </span> |
590 | 590 | <?php |
591 | - if ( 'auto-draft' != $post->post_status ) { |
|
591 | + if ('auto-draft' != $post->post_status) { |
|
592 | 592 | echo '<span id="last-edit">'; |
593 | - if ( $last_user = get_userdata( get_post_meta( $post_ID, '_edit_last', true ) ) ) { |
|
594 | - printf(__('Last edited by %1$s on %2$s at %3$s'), esc_html( $last_user->display_name ), mysql2date(get_option('date_format'), $post->post_modified), mysql2date(get_option('time_format'), $post->post_modified)); |
|
593 | + if ($last_user = get_userdata(get_post_meta($post_ID, '_edit_last', true))) { |
|
594 | + printf(__('Last edited by %1$s on %2$s at %3$s'), esc_html($last_user->display_name), mysql2date(get_option('date_format'), $post->post_modified), mysql2date(get_option('time_format'), $post->post_modified)); |
|
595 | 595 | } else { |
596 | 596 | printf(__('Last edited on %1$s at %2$s'), mysql2date(get_option('date_format'), $post->post_modified), mysql2date(get_option('time_format'), $post->post_modified)); |
597 | 597 | } |
@@ -610,14 +610,14 @@ discard block |
||
610 | 610 | * |
611 | 611 | * @param WP_Post $post Post object. |
612 | 612 | */ |
613 | -do_action( 'edit_form_after_editor', $post ); |
|
613 | +do_action('edit_form_after_editor', $post); |
|
614 | 614 | ?> |
615 | 615 | </div><!-- /post-body-content --> |
616 | 616 | |
617 | 617 | <div id="postbox-container-1" class="postbox-container"> |
618 | 618 | <?php |
619 | 619 | |
620 | -if ( 'page' == $post_type ) { |
|
620 | +if ('page' == $post_type) { |
|
621 | 621 | /** |
622 | 622 | * Fires before meta boxes with 'side' context are output for the 'page' post type. |
623 | 623 | * |
@@ -627,7 +627,7 @@ discard block |
||
627 | 627 | * |
628 | 628 | * @param WP_Post $post Post object. |
629 | 629 | */ |
630 | - do_action( 'submitpage_box', $post ); |
|
630 | + do_action('submitpage_box', $post); |
|
631 | 631 | } |
632 | 632 | else { |
633 | 633 | /** |
@@ -639,7 +639,7 @@ discard block |
||
639 | 639 | * |
640 | 640 | * @param WP_Post $post Post object. |
641 | 641 | */ |
642 | - do_action( 'submitpost_box', $post ); |
|
642 | + do_action('submitpost_box', $post); |
|
643 | 643 | } |
644 | 644 | |
645 | 645 | |
@@ -652,7 +652,7 @@ discard block |
||
652 | 652 | |
653 | 653 | do_meta_boxes(null, 'normal', $post); |
654 | 654 | |
655 | -if ( 'page' == $post_type ) { |
|
655 | +if ('page' == $post_type) { |
|
656 | 656 | /** |
657 | 657 | * Fires after 'normal' context meta boxes have been output for the 'page' post type. |
658 | 658 | * |
@@ -660,7 +660,7 @@ discard block |
||
660 | 660 | * |
661 | 661 | * @param WP_Post $post Post object. |
662 | 662 | */ |
663 | - do_action( 'edit_page_form', $post ); |
|
663 | + do_action('edit_page_form', $post); |
|
664 | 664 | } |
665 | 665 | else { |
666 | 666 | /** |
@@ -670,7 +670,7 @@ discard block |
||
670 | 670 | * |
671 | 671 | * @param WP_Post $post Post object. |
672 | 672 | */ |
673 | - do_action( 'edit_form_advanced', $post ); |
|
673 | + do_action('edit_form_advanced', $post); |
|
674 | 674 | } |
675 | 675 | |
676 | 676 | |
@@ -686,7 +686,7 @@ discard block |
||
686 | 686 | * |
687 | 687 | * @param WP_Post $post Post object. |
688 | 688 | */ |
689 | -do_action( 'dbx_post_sidebar', $post ); |
|
689 | +do_action('dbx_post_sidebar', $post); |
|
690 | 690 | |
691 | 691 | ?> |
692 | 692 | </div><!-- /post-body --> |
@@ -696,11 +696,11 @@ discard block |
||
696 | 696 | </div> |
697 | 697 | |
698 | 698 | <?php |
699 | -if ( post_type_supports( $post_type, 'comments' ) ) |
|
699 | +if (post_type_supports($post_type, 'comments')) |
|
700 | 700 | wp_comment_reply(); |
701 | 701 | ?> |
702 | 702 | |
703 | -<?php if ( ! wp_is_mobile() && post_type_supports( $post_type, 'title' ) && '' === $post->post_title ) : ?> |
|
703 | +<?php if ( ! wp_is_mobile() && post_type_supports($post_type, 'title') && '' === $post->post_title) : ?> |
|
704 | 704 | <script type="text/javascript"> |
705 | 705 | try{document.post.title.focus();}catch(e){} |
706 | 706 | </script> |
@@ -7,8 +7,9 @@ discard block |
||
7 | 7 | */ |
8 | 8 | |
9 | 9 | // don't load directly |
10 | -if ( !defined('ABSPATH') ) |
|
10 | +if ( !defined('ABSPATH') ) { |
|
11 | 11 | die('-1'); |
12 | +} |
|
12 | 13 | |
13 | 14 | /** |
14 | 15 | * @global string $post_type |
@@ -38,8 +39,9 @@ discard block |
||
38 | 39 | $_wp_editor_expand = ( get_user_setting( 'editor_expand', 'on' ) === 'on' ); |
39 | 40 | } |
40 | 41 | |
41 | -if ( wp_is_mobile() ) |
|
42 | +if ( wp_is_mobile() ) { |
|
42 | 43 | wp_enqueue_script( 'jquery-touch-punch' ); |
44 | +} |
|
43 | 45 | |
44 | 46 | /** |
45 | 47 | * Post ID global |
@@ -155,17 +157,19 @@ discard block |
||
155 | 157 | $message = false; |
156 | 158 | if ( isset($_GET['message']) ) { |
157 | 159 | $_GET['message'] = absint( $_GET['message'] ); |
158 | - if ( isset($messages[$post_type][$_GET['message']]) ) |
|
159 | - $message = $messages[$post_type][$_GET['message']]; |
|
160 | - elseif ( !isset($messages[$post_type]) && isset($messages['post'][$_GET['message']]) ) |
|
161 | - $message = $messages['post'][$_GET['message']]; |
|
162 | -} |
|
160 | + if ( isset($messages[$post_type][$_GET['message']]) ) { |
|
161 | + $message = $messages[$post_type][$_GET['message']]; |
|
162 | + } elseif ( !isset($messages[$post_type]) && isset($messages['post'][$_GET['message']]) ) { |
|
163 | + $message = $messages['post'][$_GET['message']]; |
|
164 | + } |
|
165 | + } |
|
163 | 166 | |
164 | 167 | $notice = false; |
165 | 168 | $form_extra = ''; |
166 | 169 | if ( 'auto-draft' == $post->post_status ) { |
167 | - if ( 'edit' == $action ) |
|
168 | - $post->post_title = ''; |
|
170 | + if ( 'edit' == $action ) { |
|
171 | + $post->post_title = ''; |
|
172 | + } |
|
169 | 173 | $autosave = false; |
170 | 174 | $form_extra .= "<input type='hidden' id='auto_draft' name='auto_draft' value='1' />"; |
171 | 175 | } else { |
@@ -185,8 +189,9 @@ discard block |
||
185 | 189 | } |
186 | 190 | } |
187 | 191 | // If this autosave isn't different from the current post, begone. |
188 | - if ( ! $notice ) |
|
189 | - wp_delete_post_revision( $autosave->ID ); |
|
192 | + if ( ! $notice ) { |
|
193 | + wp_delete_post_revision( $autosave->ID ); |
|
194 | + } |
|
190 | 195 | unset($autosave_field, $_autosave_field); |
191 | 196 | } |
192 | 197 | |
@@ -221,39 +226,47 @@ discard block |
||
221 | 226 | add_meta_box( 'submitdiv', __( 'Publish' ), 'post_submit_meta_box', null, 'side', 'core', $publish_callback_args ); |
222 | 227 | } |
223 | 228 | |
224 | -if ( current_theme_supports( 'post-formats' ) && post_type_supports( $post_type, 'post-formats' ) ) |
|
229 | +if ( current_theme_supports( 'post-formats' ) && post_type_supports( $post_type, 'post-formats' ) ) { |
|
225 | 230 | add_meta_box( 'formatdiv', _x( 'Format', 'post format' ), 'post_format_meta_box', null, 'side', 'core' ); |
231 | +} |
|
226 | 232 | |
227 | 233 | // all taxonomies |
228 | 234 | foreach ( get_object_taxonomies( $post ) as $tax_name ) { |
229 | 235 | $taxonomy = get_taxonomy( $tax_name ); |
230 | - if ( ! $taxonomy->show_ui || false === $taxonomy->meta_box_cb ) |
|
231 | - continue; |
|
236 | + if ( ! $taxonomy->show_ui || false === $taxonomy->meta_box_cb ) { |
|
237 | + continue; |
|
238 | + } |
|
232 | 239 | |
233 | 240 | $label = $taxonomy->labels->name; |
234 | 241 | |
235 | - if ( ! is_taxonomy_hierarchical( $tax_name ) ) |
|
236 | - $tax_meta_box_id = 'tagsdiv-' . $tax_name; |
|
237 | - else |
|
238 | - $tax_meta_box_id = $tax_name . 'div'; |
|
242 | + if ( ! is_taxonomy_hierarchical( $tax_name ) ) { |
|
243 | + $tax_meta_box_id = 'tagsdiv-' . $tax_name; |
|
244 | + } else { |
|
245 | + $tax_meta_box_id = $tax_name . 'div'; |
|
246 | + } |
|
239 | 247 | |
240 | 248 | add_meta_box( $tax_meta_box_id, $label, $taxonomy->meta_box_cb, null, 'side', 'core', array( 'taxonomy' => $tax_name ) ); |
241 | 249 | } |
242 | 250 | |
243 | -if ( post_type_supports($post_type, 'page-attributes') ) |
|
251 | +if ( post_type_supports($post_type, 'page-attributes') ) { |
|
244 | 252 | add_meta_box('pageparentdiv', 'page' == $post_type ? __('Page Attributes') : __('Attributes'), 'page_attributes_meta_box', null, 'side', 'core'); |
253 | +} |
|
245 | 254 | |
246 | -if ( $thumbnail_support && current_user_can( 'upload_files' ) ) |
|
255 | +if ( $thumbnail_support && current_user_can( 'upload_files' ) ) { |
|
247 | 256 | add_meta_box('postimagediv', esc_html( $post_type_object->labels->featured_image ), 'post_thumbnail_meta_box', null, 'side', 'low'); |
257 | +} |
|
248 | 258 | |
249 | -if ( post_type_supports($post_type, 'excerpt') ) |
|
259 | +if ( post_type_supports($post_type, 'excerpt') ) { |
|
250 | 260 | add_meta_box('postexcerpt', __('Excerpt'), 'post_excerpt_meta_box', null, 'normal', 'core'); |
261 | +} |
|
251 | 262 | |
252 | -if ( post_type_supports($post_type, 'trackbacks') ) |
|
263 | +if ( post_type_supports($post_type, 'trackbacks') ) { |
|
253 | 264 | add_meta_box('trackbacksdiv', __('Send Trackbacks'), 'post_trackback_meta_box', null, 'normal', 'core'); |
265 | +} |
|
254 | 266 | |
255 | -if ( post_type_supports($post_type, 'custom-fields') ) |
|
267 | +if ( post_type_supports($post_type, 'custom-fields') ) { |
|
256 | 268 | add_meta_box('postcustom', __('Custom Fields'), 'post_custom_meta_box', null, 'normal', 'core'); |
269 | +} |
|
257 | 270 | |
258 | 271 | /** |
259 | 272 | * Fires in the middle of built-in meta box registration. |
@@ -265,19 +278,23 @@ discard block |
||
265 | 278 | */ |
266 | 279 | do_action( 'dbx_post_advanced', $post ); |
267 | 280 | |
268 | -if ( post_type_supports($post_type, 'comments') ) |
|
281 | +if ( post_type_supports($post_type, 'comments') ) { |
|
269 | 282 | add_meta_box('commentstatusdiv', __('Discussion'), 'post_comment_status_meta_box', null, 'normal', 'core'); |
283 | +} |
|
270 | 284 | |
271 | -if ( ( 'publish' == get_post_status( $post ) || 'private' == get_post_status( $post ) ) && post_type_supports($post_type, 'comments') ) |
|
285 | +if ( ( 'publish' == get_post_status( $post ) || 'private' == get_post_status( $post ) ) && post_type_supports($post_type, 'comments') ) { |
|
272 | 286 | add_meta_box('commentsdiv', __('Comments'), 'post_comment_meta_box', null, 'normal', 'core'); |
287 | +} |
|
273 | 288 | |
274 | -if ( ! ( 'pending' == get_post_status( $post ) && ! current_user_can( $post_type_object->cap->publish_posts ) ) ) |
|
289 | +if ( ! ( 'pending' == get_post_status( $post ) && ! current_user_can( $post_type_object->cap->publish_posts ) ) ) { |
|
275 | 290 | add_meta_box('slugdiv', __('Slug'), 'post_slug_meta_box', null, 'normal', 'core'); |
291 | +} |
|
276 | 292 | |
277 | 293 | if ( post_type_supports($post_type, 'author') ) { |
278 | - if ( is_super_admin() || current_user_can( $post_type_object->cap->edit_others_posts ) ) |
|
279 | - add_meta_box('authordiv', __('Author'), 'post_author_meta_box', null, 'normal', 'core'); |
|
280 | -} |
|
294 | + if ( is_super_admin() || current_user_can( $post_type_object->cap->edit_others_posts ) ) { |
|
295 | + add_meta_box('authordiv', __('Author'), 'post_author_meta_box', null, 'normal', 'core'); |
|
296 | + } |
|
297 | + } |
|
281 | 298 | |
282 | 299 | /** |
283 | 300 | * Fires after all built-in meta boxes have been added. |
@@ -440,8 +457,9 @@ discard block |
||
440 | 457 | <div class="wrap"> |
441 | 458 | <h1><?php |
442 | 459 | echo esc_html( $title ); |
443 | -if ( isset( $post_new_file ) && current_user_can( $post_type_object->cap->create_posts ) ) |
|
460 | +if ( isset( $post_new_file ) && current_user_can( $post_type_object->cap->create_posts ) ) { |
|
444 | 461 | echo ' <a href="' . esc_url( admin_url( $post_new_file ) ) . '" class="page-title-action">' . esc_html( $post_type_object->labels->add_new ) . '</a>'; |
462 | +} |
|
445 | 463 | ?></h1> |
446 | 464 | <?php if ( $notice ) : ?> |
447 | 465 | <div id="notice" class="notice notice-warning"><p id="has-newer-autosave"><?php echo $notice ?></p></div> |
@@ -478,8 +496,9 @@ discard block |
||
478 | 496 | <input type="hidden" id="active_post_lock" value="<?php echo esc_attr( implode( ':', $active_post_lock ) ); ?>" /> |
479 | 497 | <?php |
480 | 498 | } |
481 | -if ( 'draft' != get_post_status( $post ) ) |
|
499 | +if ( 'draft' != get_post_status( $post ) ) { |
|
482 | 500 | wp_original_referer_field(true, 'previous'); |
501 | +} |
|
483 | 502 | |
484 | 503 | echo $form_extra; |
485 | 504 | |
@@ -536,16 +555,18 @@ discard block |
||
536 | 555 | $sample_permalink_html = $post_type_object->public ? get_sample_permalink_html($post->ID) : ''; |
537 | 556 | $shortlink = wp_get_shortlink($post->ID, 'post'); |
538 | 557 | |
539 | -if ( !empty( $shortlink ) && $shortlink !== $permalink && $permalink !== home_url('?page_id=' . $post->ID) ) |
|
558 | +if ( !empty( $shortlink ) && $shortlink !== $permalink && $permalink !== home_url('?page_id=' . $post->ID) ) { |
|
540 | 559 | $sample_permalink_html .= '<input id="shortlink" type="hidden" value="' . esc_attr($shortlink) . '" /><a href="#" class="button button-small" onclick="prompt('URL:', jQuery(\'#shortlink\').val()); return false;">' . __('Get Shortlink') . '</a>'; |
560 | +} |
|
541 | 561 | |
542 | 562 | if ( $post_type_object->public && ! ( 'pending' == get_post_status( $post ) && !current_user_can( $post_type_object->cap->publish_posts ) ) ) { |
543 | 563 | $has_sample_permalink = $sample_permalink_html && 'auto-draft' != $post->post_status; |
544 | 564 | ?> |
545 | 565 | <div id="edit-slug-box" class="hide-if-no-js"> |
546 | 566 | <?php |
547 | - if ( $has_sample_permalink ) |
|
548 | - echo $sample_permalink_html; |
|
567 | + if ( $has_sample_permalink ) { |
|
568 | + echo $sample_permalink_html; |
|
569 | + } |
|
549 | 570 | ?> |
550 | 571 | </div> |
551 | 572 | <?php |
@@ -628,8 +649,7 @@ discard block |
||
628 | 649 | * @param WP_Post $post Post object. |
629 | 650 | */ |
630 | 651 | do_action( 'submitpage_box', $post ); |
631 | -} |
|
632 | -else { |
|
652 | +} else { |
|
633 | 653 | /** |
634 | 654 | * Fires before meta boxes with 'side' context are output for all post types other than 'page'. |
635 | 655 | * |
@@ -661,8 +681,7 @@ discard block |
||
661 | 681 | * @param WP_Post $post Post object. |
662 | 682 | */ |
663 | 683 | do_action( 'edit_page_form', $post ); |
664 | -} |
|
665 | -else { |
|
684 | +} else { |
|
666 | 685 | /** |
667 | 686 | * Fires after 'normal' context meta boxes have been output for all post types other than 'page'. |
668 | 687 | * |
@@ -696,8 +715,9 @@ discard block |
||
696 | 715 | </div> |
697 | 716 | |
698 | 717 | <?php |
699 | -if ( post_type_supports( $post_type, 'comments' ) ) |
|
718 | +if ( post_type_supports( $post_type, 'comments' ) ) { |
|
700 | 719 | wp_comment_reply(); |
720 | +} |
|
701 | 721 | ?> |
702 | 722 | |
703 | 723 | <?php if ( ! wp_is_mobile() && post_type_supports( $post_type, 'title' ) && '' === $post->post_title ) : ?> |
@@ -1,10 +1,10 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * Update Core administration panel. |
|
4 | - * |
|
5 | - * @package WordPress |
|
6 | - * @subpackage Administration |
|
7 | - */ |
|
3 | + * Update Core administration panel. |
|
4 | + * |
|
5 | + * @package WordPress |
|
6 | + * @subpackage Administration |
|
7 | + */ |
|
8 | 8 | |
9 | 9 | /** WordPress Administration Bootstrap */ |
10 | 10 | require_once( dirname( __FILE__ ) . '/admin.php' ); |
@@ -105,10 +105,10 @@ discard block |
||
105 | 105 | submit_button( __('Bring back this update'), 'button', 'undismiss', false ); |
106 | 106 | echo '</p>'; |
107 | 107 | if ( 'en_US' != $update->locale && ( !isset($wp_local_package) || $wp_local_package != $update->locale ) ) |
108 | - echo '<p class="hint">'.__('This localized version contains both the translation and various other localization fixes. You can skip upgrading if you want to keep your current translation.').'</p>'; |
|
108 | + echo '<p class="hint">'.__('This localized version contains both the translation and various other localization fixes. You can skip upgrading if you want to keep your current translation.').'</p>'; |
|
109 | 109 | // Partial builds don't need language-specific warnings. |
110 | 110 | elseif ( 'en_US' == $update->locale && get_locale() != 'en_US' && ( ! $update->packages->partial && $wp_version == $update->partial_version ) ) { |
111 | - echo '<p class="hint">'.sprintf( __('You are about to install WordPress %s <strong>in English (US).</strong> There is a chance this update will break your translation. You may prefer to wait for the localized version to be released.'), $update->response != 'development' ? $update->current : '' ).'</p>'; |
|
111 | + echo '<p class="hint">'.sprintf( __('You are about to install WordPress %s <strong>in English (US).</strong> There is a chance this update will break your translation. You may prefer to wait for the localized version to be released.'), $update->response != 'development' ? $update->current : '' ).'</p>'; |
|
112 | 112 | } |
113 | 113 | echo '</form>'; |
114 | 114 |
@@ -7,20 +7,20 @@ discard block |
||
7 | 7 | */ |
8 | 8 | |
9 | 9 | /** WordPress Administration Bootstrap */ |
10 | -require_once( dirname( __FILE__ ) . '/admin.php' ); |
|
10 | +require_once(dirname(__FILE__).'/admin.php'); |
|
11 | 11 | |
12 | -wp_enqueue_style( 'plugin-install' ); |
|
13 | -wp_enqueue_script( 'plugin-install' ); |
|
14 | -wp_enqueue_script( 'updates' ); |
|
12 | +wp_enqueue_style('plugin-install'); |
|
13 | +wp_enqueue_script('plugin-install'); |
|
14 | +wp_enqueue_script('updates'); |
|
15 | 15 | add_thickbox(); |
16 | 16 | |
17 | -if ( is_multisite() && ! is_network_admin() ) { |
|
18 | - wp_redirect( network_admin_url( 'update-core.php' ) ); |
|
17 | +if (is_multisite() && ! is_network_admin()) { |
|
18 | + wp_redirect(network_admin_url('update-core.php')); |
|
19 | 19 | exit(); |
20 | 20 | } |
21 | 21 | |
22 | -if ( ! current_user_can( 'update_core' ) && ! current_user_can( 'update_themes' ) && ! current_user_can( 'update_plugins' ) ) |
|
23 | - wp_die( __( 'You do not have sufficient permissions to update this site.' ) ); |
|
22 | +if ( ! current_user_can('update_core') && ! current_user_can('update_themes') && ! current_user_can('update_plugins')) |
|
23 | + wp_die(__('You do not have sufficient permissions to update this site.')); |
|
24 | 24 | |
25 | 25 | /** |
26 | 26 | * |
@@ -32,50 +32,50 @@ discard block |
||
32 | 32 | * |
33 | 33 | * @param object $update |
34 | 34 | */ |
35 | -function list_core_update( $update ) { |
|
35 | +function list_core_update($update) { |
|
36 | 36 | global $wp_local_package, $wpdb, $wp_version; |
37 | 37 | static $first_pass = true; |
38 | 38 | |
39 | - if ( 'en_US' == $update->locale && 'en_US' == get_locale() ) |
|
39 | + if ('en_US' == $update->locale && 'en_US' == get_locale()) |
|
40 | 40 | $version_string = $update->current; |
41 | 41 | // If the only available update is a partial builds, it doesn't need a language-specific version string. |
42 | - elseif ( 'en_US' == $update->locale && $update->packages->partial && $wp_version == $update->partial_version && ( $updates = get_core_updates() ) && 1 == count( $updates ) ) |
|
42 | + elseif ('en_US' == $update->locale && $update->packages->partial && $wp_version == $update->partial_version && ($updates = get_core_updates()) && 1 == count($updates)) |
|
43 | 43 | $version_string = $update->current; |
44 | 44 | else |
45 | - $version_string = sprintf( "%s–<strong>%s</strong>", $update->current, $update->locale ); |
|
45 | + $version_string = sprintf("%s–<strong>%s</strong>", $update->current, $update->locale); |
|
46 | 46 | |
47 | 47 | $current = false; |
48 | - if ( !isset($update->response) || 'latest' == $update->response ) |
|
48 | + if ( ! isset($update->response) || 'latest' == $update->response) |
|
49 | 49 | $current = true; |
50 | 50 | $submit = __('Update Now'); |
51 | 51 | $form_action = 'update-core.php?action=do-core-upgrade'; |
52 | 52 | $php_version = phpversion(); |
53 | 53 | $mysql_version = $wpdb->db_version(); |
54 | 54 | $show_buttons = true; |
55 | - if ( 'development' == $update->response ) { |
|
55 | + if ('development' == $update->response) { |
|
56 | 56 | $message = __('You are using a development version of WordPress. You can update to the latest nightly build automatically or download the nightly build and install it manually:'); |
57 | 57 | $download = __('Download nightly build'); |
58 | 58 | } else { |
59 | - if ( $current ) { |
|
60 | - $message = sprintf( __( 'If you need to re-install version %s, you can do so here or download the package and re-install manually:' ), $version_string ); |
|
59 | + if ($current) { |
|
60 | + $message = sprintf(__('If you need to re-install version %s, you can do so here or download the package and re-install manually:'), $version_string); |
|
61 | 61 | $submit = __('Re-install Now'); |
62 | 62 | $form_action = 'update-core.php?action=do-core-reinstall'; |
63 | 63 | } else { |
64 | - $php_compat = version_compare( $php_version, $update->php_version, '>=' ); |
|
65 | - if ( file_exists( WP_CONTENT_DIR . '/db.php' ) && empty( $wpdb->is_mysql ) ) |
|
64 | + $php_compat = version_compare($php_version, $update->php_version, '>='); |
|
65 | + if (file_exists(WP_CONTENT_DIR.'/db.php') && empty($wpdb->is_mysql)) |
|
66 | 66 | $mysql_compat = true; |
67 | 67 | else |
68 | - $mysql_compat = version_compare( $mysql_version, $update->mysql_version, '>=' ); |
|
69 | - |
|
70 | - if ( !$mysql_compat && !$php_compat ) |
|
71 | - $message = sprintf( __('You cannot update because <a href="https://codex.wordpress.org/Version_%1$s">WordPress %1$s</a> requires PHP version %2$s or higher and MySQL version %3$s or higher. You are running PHP version %4$s and MySQL version %5$s.'), $update->current, $update->php_version, $update->mysql_version, $php_version, $mysql_version ); |
|
72 | - elseif ( !$php_compat ) |
|
73 | - $message = sprintf( __('You cannot update because <a href="https://codex.wordpress.org/Version_%1$s">WordPress %1$s</a> requires PHP version %2$s or higher. You are running version %3$s.'), $update->current, $update->php_version, $php_version ); |
|
74 | - elseif ( !$mysql_compat ) |
|
75 | - $message = sprintf( __('You cannot update because <a href="https://codex.wordpress.org/Version_%1$s">WordPress %1$s</a> requires MySQL version %2$s or higher. You are running version %3$s.'), $update->current, $update->mysql_version, $mysql_version ); |
|
68 | + $mysql_compat = version_compare($mysql_version, $update->mysql_version, '>='); |
|
69 | + |
|
70 | + if ( ! $mysql_compat && ! $php_compat) |
|
71 | + $message = sprintf(__('You cannot update because <a href="https://codex.wordpress.org/Version_%1$s">WordPress %1$s</a> requires PHP version %2$s or higher and MySQL version %3$s or higher. You are running PHP version %4$s and MySQL version %5$s.'), $update->current, $update->php_version, $update->mysql_version, $php_version, $mysql_version); |
|
72 | + elseif ( ! $php_compat) |
|
73 | + $message = sprintf(__('You cannot update because <a href="https://codex.wordpress.org/Version_%1$s">WordPress %1$s</a> requires PHP version %2$s or higher. You are running version %3$s.'), $update->current, $update->php_version, $php_version); |
|
74 | + elseif ( ! $mysql_compat) |
|
75 | + $message = sprintf(__('You cannot update because <a href="https://codex.wordpress.org/Version_%1$s">WordPress %1$s</a> requires MySQL version %2$s or higher. You are running version %3$s.'), $update->current, $update->mysql_version, $mysql_version); |
|
76 | 76 | else |
77 | - $message = sprintf(__('You can update to <a href="https://codex.wordpress.org/Version_%1$s">WordPress %2$s</a> automatically or download the package and install it manually:'), $update->current, $version_string); |
|
78 | - if ( !$mysql_compat || !$php_compat ) |
|
77 | + $message = sprintf(__('You can update to <a href="https://codex.wordpress.org/Version_%1$s">WordPress %2$s</a> automatically or download the package and install it manually:'), $update->current, $version_string); |
|
78 | + if ( ! $mysql_compat || ! $php_compat) |
|
79 | 79 | $show_buttons = false; |
80 | 80 | } |
81 | 81 | $download = sprintf(__('Download %s'), $version_string); |
@@ -84,31 +84,31 @@ discard block |
||
84 | 84 | echo '<p>'; |
85 | 85 | echo $message; |
86 | 86 | echo '</p>'; |
87 | - echo '<form method="post" action="' . $form_action . '" name="upgrade" class="upgrade">'; |
|
87 | + echo '<form method="post" action="'.$form_action.'" name="upgrade" class="upgrade">'; |
|
88 | 88 | wp_nonce_field('upgrade-core'); |
89 | 89 | echo '<p>'; |
90 | - echo '<input name="version" value="'. esc_attr($update->current) .'" type="hidden"/>'; |
|
91 | - echo '<input name="locale" value="'. esc_attr($update->locale) .'" type="hidden"/>'; |
|
92 | - if ( $show_buttons ) { |
|
93 | - if ( $first_pass ) { |
|
94 | - submit_button( $submit, $current ? 'button' : 'primary regular', 'upgrade', false ); |
|
90 | + echo '<input name="version" value="'.esc_attr($update->current).'" type="hidden"/>'; |
|
91 | + echo '<input name="locale" value="'.esc_attr($update->locale).'" type="hidden"/>'; |
|
92 | + if ($show_buttons) { |
|
93 | + if ($first_pass) { |
|
94 | + submit_button($submit, $current ? 'button' : 'primary regular', 'upgrade', false); |
|
95 | 95 | $first_pass = false; |
96 | 96 | } else { |
97 | - submit_button( $submit, 'button', 'upgrade', false ); |
|
97 | + submit_button($submit, 'button', 'upgrade', false); |
|
98 | 98 | } |
99 | - echo ' <a href="' . esc_url( $update->download ) . '" class="button">' . $download . '</a> '; |
|
99 | + echo ' <a href="'.esc_url($update->download).'" class="button">'.$download.'</a> '; |
|
100 | 100 | } |
101 | - if ( 'en_US' != $update->locale ) |
|
102 | - if ( !isset( $update->dismissed ) || !$update->dismissed ) |
|
103 | - submit_button( __('Hide this update'), 'button', 'dismiss', false ); |
|
101 | + if ('en_US' != $update->locale) |
|
102 | + if ( ! isset($update->dismissed) || ! $update->dismissed) |
|
103 | + submit_button(__('Hide this update'), 'button', 'dismiss', false); |
|
104 | 104 | else |
105 | - submit_button( __('Bring back this update'), 'button', 'undismiss', false ); |
|
105 | + submit_button(__('Bring back this update'), 'button', 'undismiss', false); |
|
106 | 106 | echo '</p>'; |
107 | - if ( 'en_US' != $update->locale && ( !isset($wp_local_package) || $wp_local_package != $update->locale ) ) |
|
107 | + if ('en_US' != $update->locale && ( ! isset($wp_local_package) || $wp_local_package != $update->locale)) |
|
108 | 108 | echo '<p class="hint">'.__('This localized version contains both the translation and various other localization fixes. You can skip upgrading if you want to keep your current translation.').'</p>'; |
109 | 109 | // Partial builds don't need language-specific warnings. |
110 | - elseif ( 'en_US' == $update->locale && get_locale() != 'en_US' && ( ! $update->packages->partial && $wp_version == $update->partial_version ) ) { |
|
111 | - echo '<p class="hint">'.sprintf( __('You are about to install WordPress %s <strong>in English (US).</strong> There is a chance this update will break your translation. You may prefer to wait for the localized version to be released.'), $update->response != 'development' ? $update->current : '' ).'</p>'; |
|
110 | + elseif ('en_US' == $update->locale && get_locale() != 'en_US' && ( ! $update->packages->partial && $wp_version == $update->partial_version)) { |
|
111 | + echo '<p class="hint">'.sprintf(__('You are about to install WordPress %s <strong>in English (US).</strong> There is a chance this update will break your translation. You may prefer to wait for the localized version to be released.'), $update->response != 'development' ? $update->current : '').'</p>'; |
|
112 | 112 | } |
113 | 113 | echo '</form>'; |
114 | 114 | |
@@ -118,8 +118,8 @@ discard block |
||
118 | 118 | * @since 2.7.0 |
119 | 119 | */ |
120 | 120 | function dismissed_updates() { |
121 | - $dismissed = get_core_updates( array( 'dismissed' => true, 'available' => false ) ); |
|
122 | - if ( $dismissed ) { |
|
121 | + $dismissed = get_core_updates(array('dismissed' => true, 'available' => false)); |
|
122 | + if ($dismissed) { |
|
123 | 123 | |
124 | 124 | $show_text = esc_js(__('Show hidden updates')); |
125 | 125 | $hide_text = esc_js(__('Hide hidden updates')); |
@@ -135,9 +135,9 @@ discard block |
||
135 | 135 | <?php |
136 | 136 | echo '<p class="hide-if-no-js"><a id="show-dismissed" href="#">'.__('Show hidden updates').'</a></p>'; |
137 | 137 | echo '<ul id="dismissed-updates" class="core-updates dismissed">'; |
138 | - foreach( (array) $dismissed as $update) { |
|
138 | + foreach ((array) $dismissed as $update) { |
|
139 | 139 | echo '<li>'; |
140 | - list_core_update( $update ); |
|
140 | + list_core_update($update); |
|
141 | 141 | echo '</li>'; |
142 | 142 | } |
143 | 143 | echo '</ul>'; |
@@ -158,22 +158,22 @@ discard block |
||
158 | 158 | |
159 | 159 | $updates = get_core_updates(); |
160 | 160 | |
161 | - if ( !isset($updates[0]->response) || 'latest' == $updates[0]->response ) { |
|
161 | + if ( ! isset($updates[0]->response) || 'latest' == $updates[0]->response) { |
|
162 | 162 | echo '<h3>'; |
163 | 163 | _e('You have the latest version of WordPress.'); |
164 | 164 | |
165 | - if ( wp_http_supports( array( 'ssl' ) ) ) { |
|
166 | - require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php'; |
|
165 | + if (wp_http_supports(array('ssl'))) { |
|
166 | + require_once ABSPATH.'wp-admin/includes/class-wp-upgrader.php'; |
|
167 | 167 | $upgrader = new WP_Automatic_Updater; |
168 | 168 | $future_minor_update = (object) array( |
169 | - 'current' => $wp_version . '.1.next.minor', |
|
170 | - 'version' => $wp_version . '.1.next.minor', |
|
169 | + 'current' => $wp_version.'.1.next.minor', |
|
170 | + 'version' => $wp_version.'.1.next.minor', |
|
171 | 171 | 'php_version' => $required_php_version, |
172 | 172 | 'mysql_version' => $required_mysql_version, |
173 | 173 | ); |
174 | - $should_auto_update = $upgrader->should_update( 'core', $future_minor_update, ABSPATH ); |
|
175 | - if ( $should_auto_update ) |
|
176 | - echo ' ' . __( 'Future security updates will be applied automatically.' ); |
|
174 | + $should_auto_update = $upgrader->should_update('core', $future_minor_update, ABSPATH); |
|
175 | + if ($should_auto_update) |
|
176 | + echo ' '.__('Future security updates will be applied automatically.'); |
|
177 | 177 | } |
178 | 178 | echo '</h3>'; |
179 | 179 | } else { |
@@ -182,33 +182,33 @@ discard block |
||
182 | 182 | echo '</p></div>'; |
183 | 183 | |
184 | 184 | echo '<h3 class="response">'; |
185 | - _e( 'An updated version of WordPress is available.' ); |
|
185 | + _e('An updated version of WordPress is available.'); |
|
186 | 186 | echo '</h3>'; |
187 | 187 | } |
188 | 188 | |
189 | - if ( isset( $updates[0] ) && $updates[0]->response == 'development' ) { |
|
190 | - require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php'; |
|
189 | + if (isset($updates[0]) && $updates[0]->response == 'development') { |
|
190 | + require_once ABSPATH.'wp-admin/includes/class-wp-upgrader.php'; |
|
191 | 191 | $upgrader = new WP_Automatic_Updater; |
192 | - if ( wp_http_supports( 'ssl' ) && $upgrader->should_update( 'core', $updates[0], ABSPATH ) ) { |
|
192 | + if (wp_http_supports('ssl') && $upgrader->should_update('core', $updates[0], ABSPATH)) { |
|
193 | 193 | echo '<div class="updated inline"><p>'; |
194 | - echo '<strong>' . __( 'BETA TESTERS:' ) . '</strong> ' . __( 'This site is set up to install updates of future beta versions automatically.' ); |
|
194 | + echo '<strong>'.__('BETA TESTERS:').'</strong> '.__('This site is set up to install updates of future beta versions automatically.'); |
|
195 | 195 | echo '</p></div>'; |
196 | 196 | } |
197 | 197 | } |
198 | 198 | |
199 | 199 | echo '<ul class="core-updates">'; |
200 | - foreach( (array) $updates as $update ) { |
|
200 | + foreach ((array) $updates as $update) { |
|
201 | 201 | echo '<li>'; |
202 | - list_core_update( $update ); |
|
202 | + list_core_update($update); |
|
203 | 203 | echo '</li>'; |
204 | 204 | } |
205 | 205 | echo '</ul>'; |
206 | 206 | // Don't show the maintenance mode notice when we are only showing a single re-install option. |
207 | - if ( $updates && ( count( $updates ) > 1 || $updates[0]->response != 'latest' ) ) { |
|
208 | - echo '<p>' . __( 'While your site is being updated, it will be in maintenance mode. As soon as your updates are complete, your site will return to normal.' ) . '</p>'; |
|
209 | - } elseif ( ! $updates ) { |
|
210 | - list( $normalized_version ) = explode( '-', $wp_version ); |
|
211 | - echo '<p>' . sprintf( __( '<a href="%s">Learn more about WordPress %s</a>.' ), esc_url( self_admin_url( 'about.php' ) ), $normalized_version ) . '</p>'; |
|
207 | + if ($updates && (count($updates) > 1 || $updates[0]->response != 'latest')) { |
|
208 | + echo '<p>'.__('While your site is being updated, it will be in maintenance mode. As soon as your updates are complete, your site will return to normal.').'</p>'; |
|
209 | + } elseif ( ! $updates) { |
|
210 | + list($normalized_version) = explode('-', $wp_version); |
|
211 | + echo '<p>'.sprintf(__('<a href="%s">Learn more about WordPress %s</a>.'), esc_url(self_admin_url('about.php')), $normalized_version).'</p>'; |
|
212 | 212 | } |
213 | 213 | dismissed_updates(); |
214 | 214 | } |
@@ -222,24 +222,24 @@ discard block |
||
222 | 222 | |
223 | 223 | $cur_wp_version = preg_replace('/-.*$/', '', $wp_version); |
224 | 224 | |
225 | - require_once(ABSPATH . 'wp-admin/includes/plugin-install.php'); |
|
225 | + require_once(ABSPATH.'wp-admin/includes/plugin-install.php'); |
|
226 | 226 | $plugins = get_plugin_updates(); |
227 | - if ( empty( $plugins ) ) { |
|
228 | - echo '<h3>' . __( 'Plugins' ) . '</h3>'; |
|
229 | - echo '<p>' . __( 'Your plugins are all up to date.' ) . '</p>'; |
|
227 | + if (empty($plugins)) { |
|
228 | + echo '<h3>'.__('Plugins').'</h3>'; |
|
229 | + echo '<p>'.__('Your plugins are all up to date.').'</p>'; |
|
230 | 230 | return; |
231 | 231 | } |
232 | 232 | $form_action = 'update-core.php?action=do-plugin-upgrade'; |
233 | 233 | |
234 | 234 | $core_updates = get_core_updates(); |
235 | - if ( !isset($core_updates[0]->response) || 'latest' == $core_updates[0]->response || 'development' == $core_updates[0]->response || version_compare( $core_updates[0]->current, $cur_wp_version, '=') ) |
|
235 | + if ( ! isset($core_updates[0]->response) || 'latest' == $core_updates[0]->response || 'development' == $core_updates[0]->response || version_compare($core_updates[0]->current, $cur_wp_version, '=')) |
|
236 | 236 | $core_update_version = false; |
237 | 237 | else |
238 | 238 | $core_update_version = $core_updates[0]->current; |
239 | 239 | ?> |
240 | -<h3><?php _e( 'Plugins' ); ?></h3> |
|
241 | -<p><?php _e( 'The following plugins have new versions available. Check the ones you want to update and then click “Update Plugins”.' ); ?></p> |
|
242 | -<form method="post" action="<?php echo esc_url( $form_action ); ?>" name="upgrade-plugins" class="upgrade"> |
|
240 | +<h3><?php _e('Plugins'); ?></h3> |
|
241 | +<p><?php _e('The following plugins have new versions available. Check the ones you want to update and then click “Update Plugins”.'); ?></p> |
|
242 | +<form method="post" action="<?php echo esc_url($form_action); ?>" name="upgrade-plugins" class="upgrade"> |
|
243 | 243 | <?php wp_nonce_field('upgrade-core'); ?> |
244 | 244 | <p><input id="upgrade-plugins" class="button" type="submit" value="<?php esc_attr_e('Update Plugins'); ?>" name="upgrade" /></p> |
245 | 245 | <table class="widefat" id="update-plugins-table"> |
@@ -252,45 +252,45 @@ discard block |
||
252 | 252 | |
253 | 253 | <tbody class="plugins"> |
254 | 254 | <?php |
255 | - foreach ( (array) $plugins as $plugin_file => $plugin_data) { |
|
256 | - $info = plugins_api('plugin_information', array('slug' => $plugin_data->update->slug )); |
|
257 | - if ( is_wp_error( $info ) ) { |
|
255 | + foreach ((array) $plugins as $plugin_file => $plugin_data) { |
|
256 | + $info = plugins_api('plugin_information', array('slug' => $plugin_data->update->slug)); |
|
257 | + if (is_wp_error($info)) { |
|
258 | 258 | $info = false; |
259 | 259 | } |
260 | 260 | |
261 | 261 | // Get plugin compat for running version of WordPress. |
262 | - if ( isset($info->tested) && version_compare($info->tested, $cur_wp_version, '>=') ) { |
|
263 | - $compat = '<br />' . sprintf(__('Compatibility with WordPress %1$s: 100%% (according to its author)'), $cur_wp_version); |
|
264 | - } elseif ( isset($info->compatibility[$cur_wp_version][$plugin_data->update->new_version]) ) { |
|
262 | + if (isset($info->tested) && version_compare($info->tested, $cur_wp_version, '>=')) { |
|
263 | + $compat = '<br />'.sprintf(__('Compatibility with WordPress %1$s: 100%% (according to its author)'), $cur_wp_version); |
|
264 | + } elseif (isset($info->compatibility[$cur_wp_version][$plugin_data->update->new_version])) { |
|
265 | 265 | $compat = $info->compatibility[$cur_wp_version][$plugin_data->update->new_version]; |
266 | - $compat = '<br />' . sprintf(__('Compatibility with WordPress %1$s: %2$d%% (%3$d "works" votes out of %4$d total)'), $cur_wp_version, $compat[0], $compat[2], $compat[1]); |
|
266 | + $compat = '<br />'.sprintf(__('Compatibility with WordPress %1$s: %2$d%% (%3$d "works" votes out of %4$d total)'), $cur_wp_version, $compat[0], $compat[2], $compat[1]); |
|
267 | 267 | } else { |
268 | - $compat = '<br />' . sprintf(__('Compatibility with WordPress %1$s: Unknown'), $cur_wp_version); |
|
268 | + $compat = '<br />'.sprintf(__('Compatibility with WordPress %1$s: Unknown'), $cur_wp_version); |
|
269 | 269 | } |
270 | 270 | // Get plugin compat for updated version of WordPress. |
271 | - if ( $core_update_version ) { |
|
272 | - if ( isset($info->compatibility[$core_update_version][$plugin_data->update->new_version]) ) { |
|
271 | + if ($core_update_version) { |
|
272 | + if (isset($info->compatibility[$core_update_version][$plugin_data->update->new_version])) { |
|
273 | 273 | $update_compat = $info->compatibility[$core_update_version][$plugin_data->update->new_version]; |
274 | - $compat .= '<br />' . sprintf(__('Compatibility with WordPress %1$s: %2$d%% (%3$d "works" votes out of %4$d total)'), $core_update_version, $update_compat[0], $update_compat[2], $update_compat[1]); |
|
274 | + $compat .= '<br />'.sprintf(__('Compatibility with WordPress %1$s: %2$d%% (%3$d "works" votes out of %4$d total)'), $core_update_version, $update_compat[0], $update_compat[2], $update_compat[1]); |
|
275 | 275 | } else { |
276 | - $compat .= '<br />' . sprintf(__('Compatibility with WordPress %1$s: Unknown'), $core_update_version); |
|
276 | + $compat .= '<br />'.sprintf(__('Compatibility with WordPress %1$s: Unknown'), $core_update_version); |
|
277 | 277 | } |
278 | 278 | } |
279 | 279 | // Get the upgrade notice for the new plugin version. |
280 | - if ( isset($plugin_data->update->upgrade_notice) ) { |
|
281 | - $upgrade_notice = '<br />' . strip_tags($plugin_data->update->upgrade_notice); |
|
280 | + if (isset($plugin_data->update->upgrade_notice)) { |
|
281 | + $upgrade_notice = '<br />'.strip_tags($plugin_data->update->upgrade_notice); |
|
282 | 282 | } else { |
283 | 283 | $upgrade_notice = ''; |
284 | 284 | } |
285 | 285 | |
286 | - $details_url = self_admin_url('plugin-install.php?tab=plugin-information&plugin=' . $plugin_data->update->slug . '§ion=changelog&TB_iframe=true&width=640&height=662'); |
|
286 | + $details_url = self_admin_url('plugin-install.php?tab=plugin-information&plugin='.$plugin_data->update->slug.'§ion=changelog&TB_iframe=true&width=640&height=662'); |
|
287 | 287 | $details_text = sprintf(__('View version %1$s details'), $plugin_data->update->new_version); |
288 | 288 | $details = sprintf('<a href="%1$s" class="thickbox" title="%2$s">%3$s</a>.', esc_url($details_url), esc_attr($plugin_data->Name), $details_text); |
289 | 289 | |
290 | 290 | echo " |
291 | 291 | <tr> |
292 | - <th scope='row' class='check-column'><input type='checkbox' name='checked[]' value='" . esc_attr($plugin_file) . "' /></th> |
|
293 | - <td><p><strong>{$plugin_data->Name}</strong><br />" . sprintf(__('You have version %1$s installed. Update to %2$s.'), $plugin_data->Version, $plugin_data->update->new_version) . ' ' . $details . $compat . $upgrade_notice . "</p></td> |
|
292 | + <th scope='row' class='check-column'><input type='checkbox' name='checked[]' value='" . esc_attr($plugin_file)."' /></th> |
|
293 | + <td><p><strong>{$plugin_data->Name}</strong><br />".sprintf(__('You have version %1$s installed. Update to %2$s.'), $plugin_data->Version, $plugin_data->update->new_version).' '.$details.$compat.$upgrade_notice."</p></td> |
|
294 | 294 | </tr>"; |
295 | 295 | } |
296 | 296 | ?> |
@@ -299,7 +299,7 @@ discard block |
||
299 | 299 | <tfoot> |
300 | 300 | <tr> |
301 | 301 | <td scope="col" class="manage-column check-column"><input type="checkbox" id="plugins-select-all-2" /></td> |
302 | - <th scope="col" class="manage-column"><label for="plugins-select-all-2"><?php _e( 'Select All' ); ?></label></th> |
|
302 | + <th scope="col" class="manage-column"><label for="plugins-select-all-2"><?php _e('Select All'); ?></label></th> |
|
303 | 303 | </tr> |
304 | 304 | </tfoot> |
305 | 305 | </table> |
@@ -313,18 +313,18 @@ discard block |
||
313 | 313 | */ |
314 | 314 | function list_theme_updates() { |
315 | 315 | $themes = get_theme_updates(); |
316 | - if ( empty( $themes ) ) { |
|
317 | - echo '<h3>' . __( 'Themes' ) . '</h3>'; |
|
318 | - echo '<p>' . __( 'Your themes are all up to date.' ) . '</p>'; |
|
316 | + if (empty($themes)) { |
|
317 | + echo '<h3>'.__('Themes').'</h3>'; |
|
318 | + echo '<p>'.__('Your themes are all up to date.').'</p>'; |
|
319 | 319 | return; |
320 | 320 | } |
321 | 321 | |
322 | 322 | $form_action = 'update-core.php?action=do-theme-upgrade'; |
323 | 323 | ?> |
324 | -<h3><?php _e( 'Themes' ); ?></h3> |
|
325 | -<p><?php _e( 'The following themes have new versions available. Check the ones you want to update and then click “Update Themes”.' ); ?></p> |
|
326 | -<p><?php printf( __( '<strong>Please Note:</strong> Any customizations you have made to theme files will be lost. Please consider using <a href="%s">child themes</a> for modifications.' ), __( 'https://codex.wordpress.org/Child_Themes' ) ); ?></p> |
|
327 | -<form method="post" action="<?php echo esc_url( $form_action ); ?>" name="upgrade-themes" class="upgrade"> |
|
324 | +<h3><?php _e('Themes'); ?></h3> |
|
325 | +<p><?php _e('The following themes have new versions available. Check the ones you want to update and then click “Update Themes”.'); ?></p> |
|
326 | +<p><?php printf(__('<strong>Please Note:</strong> Any customizations you have made to theme files will be lost. Please consider using <a href="%s">child themes</a> for modifications.'), __('https://codex.wordpress.org/Child_Themes')); ?></p> |
|
327 | +<form method="post" action="<?php echo esc_url($form_action); ?>" name="upgrade-themes" class="upgrade"> |
|
328 | 328 | <?php wp_nonce_field('upgrade-core'); ?> |
329 | 329 | <p><input id="upgrade-themes" class="button" type="submit" value="<?php esc_attr_e('Update Themes'); ?>" name="upgrade" /></p> |
330 | 330 | <table class="widefat" id="update-themes-table"> |
@@ -337,11 +337,11 @@ discard block |
||
337 | 337 | |
338 | 338 | <tbody class="plugins"> |
339 | 339 | <?php |
340 | - foreach ( $themes as $stylesheet => $theme ) { |
|
340 | + foreach ($themes as $stylesheet => $theme) { |
|
341 | 341 | echo " |
342 | 342 | <tr> |
343 | - <th scope='row' class='check-column'><input type='checkbox' name='checked[]' value='" . esc_attr( $stylesheet ) . "' /></th> |
|
344 | - <td class='plugin-title'><img src='" . esc_url( $theme->get_screenshot() ) . "' width='85' height='64' style='float:left; padding: 0 5px 5px' /><strong>" . $theme->display('Name') . '</strong> ' . sprintf( __( 'You have version %1$s installed. Update to %2$s.' ), $theme->display('Version'), $theme->update['new_version'] ) . "</td> |
|
343 | + <th scope='row' class='check-column'><input type='checkbox' name='checked[]' value='" . esc_attr($stylesheet)."' /></th> |
|
344 | + <td class='plugin-title'><img src='" . esc_url($theme->get_screenshot())."' width='85' height='64' style='float:left; padding: 0 5px 5px' /><strong>".$theme->display('Name').'</strong> '.sprintf(__('You have version %1$s installed. Update to %2$s.'), $theme->display('Version'), $theme->update['new_version'])."</td> |
|
345 | 345 | </tr>"; |
346 | 346 | } |
347 | 347 | ?> |
@@ -350,7 +350,7 @@ discard block |
||
350 | 350 | <tfoot> |
351 | 351 | <tr> |
352 | 352 | <td scope="col" class="manage-column check-column"><input type="checkbox" id="themes-select-all-2" /></td> |
353 | - <th scope="col" class="manage-column"><label for="themes-select-all-2"><?php _e( 'Select All' ); ?></label></th> |
|
353 | + <th scope="col" class="manage-column"><label for="themes-select-all-2"><?php _e('Select All'); ?></label></th> |
|
354 | 354 | </tr> |
355 | 355 | </tfoot> |
356 | 356 | </table> |
@@ -364,21 +364,21 @@ discard block |
||
364 | 364 | */ |
365 | 365 | function list_translation_updates() { |
366 | 366 | $updates = wp_get_translation_updates(); |
367 | - if ( ! $updates ) { |
|
368 | - if ( 'en_US' != get_locale() ) { |
|
369 | - echo '<h3>' . __( 'Translations' ) . '</h3>'; |
|
370 | - echo '<p>' . __( 'Your translations are all up to date.' ) . '</p>'; |
|
367 | + if ( ! $updates) { |
|
368 | + if ('en_US' != get_locale()) { |
|
369 | + echo '<h3>'.__('Translations').'</h3>'; |
|
370 | + echo '<p>'.__('Your translations are all up to date.').'</p>'; |
|
371 | 371 | } |
372 | 372 | return; |
373 | 373 | } |
374 | 374 | |
375 | 375 | $form_action = 'update-core.php?action=do-translation-upgrade'; |
376 | 376 | ?> |
377 | - <h3><?php _e( 'Translations' ); ?></h3> |
|
378 | - <form method="post" action="<?php echo esc_url( $form_action ); ?>" name="upgrade-translations" class="upgrade"> |
|
379 | - <p><?php _e( 'New translations are available.' ); ?></p> |
|
380 | - <?php wp_nonce_field( 'upgrade-translations' ); ?> |
|
381 | - <p><input class="button" type="submit" value="<?php esc_attr_e( 'Update Translations' ); ?>" name="upgrade" /></p> |
|
377 | + <h3><?php _e('Translations'); ?></h3> |
|
378 | + <form method="post" action="<?php echo esc_url($form_action); ?>" name="upgrade-translations" class="upgrade"> |
|
379 | + <p><?php _e('New translations are available.'); ?></p> |
|
380 | + <?php wp_nonce_field('upgrade-translations'); ?> |
|
381 | + <p><input class="button" type="submit" value="<?php esc_attr_e('Update Translations'); ?>" name="upgrade" /></p> |
|
382 | 382 | </form> |
383 | 383 | <?php |
384 | 384 | } |
@@ -392,76 +392,76 @@ discard block |
||
392 | 392 | * |
393 | 393 | * @param bool $reinstall |
394 | 394 | */ |
395 | -function do_core_upgrade( $reinstall = false ) { |
|
395 | +function do_core_upgrade($reinstall = false) { |
|
396 | 396 | global $wp_filesystem; |
397 | 397 | |
398 | - include_once( ABSPATH . 'wp-admin/includes/class-wp-upgrader.php' ); |
|
398 | + include_once(ABSPATH.'wp-admin/includes/class-wp-upgrader.php'); |
|
399 | 399 | |
400 | - if ( $reinstall ) |
|
400 | + if ($reinstall) |
|
401 | 401 | $url = 'update-core.php?action=do-core-reinstall'; |
402 | 402 | else |
403 | 403 | $url = 'update-core.php?action=do-core-upgrade'; |
404 | 404 | $url = wp_nonce_url($url, 'upgrade-core'); |
405 | 405 | |
406 | - $version = isset( $_POST['version'] )? $_POST['version'] : false; |
|
407 | - $locale = isset( $_POST['locale'] )? $_POST['locale'] : 'en_US'; |
|
408 | - $update = find_core_update( $version, $locale ); |
|
409 | - if ( !$update ) |
|
406 | + $version = isset($_POST['version']) ? $_POST['version'] : false; |
|
407 | + $locale = isset($_POST['locale']) ? $_POST['locale'] : 'en_US'; |
|
408 | + $update = find_core_update($version, $locale); |
|
409 | + if ( ! $update) |
|
410 | 410 | return; |
411 | 411 | |
412 | 412 | // Allow relaxed file ownership writes for User-initiated upgrades when the API specifies |
413 | 413 | // that it's safe to do so. This only happens when there are no new files to create. |
414 | - $allow_relaxed_file_ownership = ! $reinstall && isset( $update->new_files ) && ! $update->new_files; |
|
414 | + $allow_relaxed_file_ownership = ! $reinstall && isset($update->new_files) && ! $update->new_files; |
|
415 | 415 | |
416 | 416 | ?> |
417 | 417 | <div class="wrap"> |
418 | - <h1><?php _e( 'Update WordPress' ); ?></h1> |
|
418 | + <h1><?php _e('Update WordPress'); ?></h1> |
|
419 | 419 | <?php |
420 | 420 | |
421 | - if ( false === ( $credentials = request_filesystem_credentials( $url, '', false, ABSPATH, array( 'version', 'locale' ), $allow_relaxed_file_ownership ) ) ) { |
|
421 | + if (false === ($credentials = request_filesystem_credentials($url, '', false, ABSPATH, array('version', 'locale'), $allow_relaxed_file_ownership))) { |
|
422 | 422 | echo '</div>'; |
423 | 423 | return; |
424 | 424 | } |
425 | 425 | |
426 | - if ( ! WP_Filesystem( $credentials, ABSPATH, $allow_relaxed_file_ownership ) ) { |
|
426 | + if ( ! WP_Filesystem($credentials, ABSPATH, $allow_relaxed_file_ownership)) { |
|
427 | 427 | // Failed to connect, Error and request again |
428 | - request_filesystem_credentials( $url, '', true, ABSPATH, array( 'version', 'locale' ), $allow_relaxed_file_ownership ); |
|
428 | + request_filesystem_credentials($url, '', true, ABSPATH, array('version', 'locale'), $allow_relaxed_file_ownership); |
|
429 | 429 | echo '</div>'; |
430 | 430 | return; |
431 | 431 | } |
432 | 432 | |
433 | - if ( $wp_filesystem->errors->get_error_code() ) { |
|
434 | - foreach ( $wp_filesystem->errors->get_error_messages() as $message ) |
|
433 | + if ($wp_filesystem->errors->get_error_code()) { |
|
434 | + foreach ($wp_filesystem->errors->get_error_messages() as $message) |
|
435 | 435 | show_message($message); |
436 | 436 | echo '</div>'; |
437 | 437 | return; |
438 | 438 | } |
439 | 439 | |
440 | - if ( $reinstall ) |
|
440 | + if ($reinstall) |
|
441 | 441 | $update->response = 'reinstall'; |
442 | 442 | |
443 | - add_filter( 'update_feedback', 'show_message' ); |
|
443 | + add_filter('update_feedback', 'show_message'); |
|
444 | 444 | |
445 | 445 | $upgrader = new Core_Upgrader(); |
446 | - $result = $upgrader->upgrade( $update, array( |
|
446 | + $result = $upgrader->upgrade($update, array( |
|
447 | 447 | 'allow_relaxed_file_ownership' => $allow_relaxed_file_ownership |
448 | - ) ); |
|
448 | + )); |
|
449 | 449 | |
450 | - if ( is_wp_error($result) ) { |
|
450 | + if (is_wp_error($result)) { |
|
451 | 451 | show_message($result); |
452 | - if ('up_to_date' != $result->get_error_code() ) |
|
453 | - show_message( __('Installation Failed') ); |
|
452 | + if ('up_to_date' != $result->get_error_code()) |
|
453 | + show_message(__('Installation Failed')); |
|
454 | 454 | echo '</div>'; |
455 | 455 | return; |
456 | 456 | } |
457 | 457 | |
458 | - show_message( __('WordPress updated successfully') ); |
|
459 | - show_message( '<span class="hide-if-no-js">' . sprintf( __( 'Welcome to WordPress %1$s. You will be redirected to the About WordPress screen. If not, click <a href="%2$s">here</a>.' ), $result, esc_url( self_admin_url( 'about.php?updated' ) ) ) . '</span>' ); |
|
460 | - show_message( '<span class="hide-if-js">' . sprintf( __( 'Welcome to WordPress %1$s. <a href="%2$s">Learn more</a>.' ), $result, esc_url( self_admin_url( 'about.php?updated' ) ) ) . '</span>' ); |
|
458 | + show_message(__('WordPress updated successfully')); |
|
459 | + show_message('<span class="hide-if-no-js">'.sprintf(__('Welcome to WordPress %1$s. You will be redirected to the About WordPress screen. If not, click <a href="%2$s">here</a>.'), $result, esc_url(self_admin_url('about.php?updated'))).'</span>'); |
|
460 | + show_message('<span class="hide-if-js">'.sprintf(__('Welcome to WordPress %1$s. <a href="%2$s">Learn more</a>.'), $result, esc_url(self_admin_url('about.php?updated'))).'</span>'); |
|
461 | 461 | ?> |
462 | 462 | </div> |
463 | 463 | <script type="text/javascript"> |
464 | - window.location = '<?php echo self_admin_url( 'about.php?updated' ); ?>'; |
|
464 | + window.location = '<?php echo self_admin_url('about.php?updated'); ?>'; |
|
465 | 465 | </script> |
466 | 466 | <?php |
467 | 467 | } |
@@ -470,13 +470,13 @@ discard block |
||
470 | 470 | * @since 2.7.0 |
471 | 471 | */ |
472 | 472 | function do_dismiss_core_update() { |
473 | - $version = isset( $_POST['version'] )? $_POST['version'] : false; |
|
474 | - $locale = isset( $_POST['locale'] )? $_POST['locale'] : 'en_US'; |
|
475 | - $update = find_core_update( $version, $locale ); |
|
476 | - if ( !$update ) |
|
473 | + $version = isset($_POST['version']) ? $_POST['version'] : false; |
|
474 | + $locale = isset($_POST['locale']) ? $_POST['locale'] : 'en_US'; |
|
475 | + $update = find_core_update($version, $locale); |
|
476 | + if ( ! $update) |
|
477 | 477 | return; |
478 | - dismiss_core_update( $update ); |
|
479 | - wp_redirect( wp_nonce_url('update-core.php?action=upgrade-core', 'upgrade-core') ); |
|
478 | + dismiss_core_update($update); |
|
479 | + wp_redirect(wp_nonce_url('update-core.php?action=upgrade-core', 'upgrade-core')); |
|
480 | 480 | exit; |
481 | 481 | } |
482 | 482 | |
@@ -484,21 +484,21 @@ discard block |
||
484 | 484 | * @since 2.7.0 |
485 | 485 | */ |
486 | 486 | function do_undismiss_core_update() { |
487 | - $version = isset( $_POST['version'] )? $_POST['version'] : false; |
|
488 | - $locale = isset( $_POST['locale'] )? $_POST['locale'] : 'en_US'; |
|
489 | - $update = find_core_update( $version, $locale ); |
|
490 | - if ( !$update ) |
|
487 | + $version = isset($_POST['version']) ? $_POST['version'] : false; |
|
488 | + $locale = isset($_POST['locale']) ? $_POST['locale'] : 'en_US'; |
|
489 | + $update = find_core_update($version, $locale); |
|
490 | + if ( ! $update) |
|
491 | 491 | return; |
492 | - undismiss_core_update( $version, $locale ); |
|
493 | - wp_redirect( wp_nonce_url('update-core.php?action=upgrade-core', 'upgrade-core') ); |
|
492 | + undismiss_core_update($version, $locale); |
|
493 | + wp_redirect(wp_nonce_url('update-core.php?action=upgrade-core', 'upgrade-core')); |
|
494 | 494 | exit; |
495 | 495 | } |
496 | 496 | |
497 | 497 | $action = isset($_GET['action']) ? $_GET['action'] : 'upgrade-core'; |
498 | 498 | |
499 | 499 | $upgrade_error = false; |
500 | -if ( ( 'do-theme-upgrade' == $action || ( 'do-plugin-upgrade' == $action && ! isset( $_GET['plugins'] ) ) ) |
|
501 | - && ! isset( $_POST['checked'] ) ) { |
|
500 | +if (('do-theme-upgrade' == $action || ('do-plugin-upgrade' == $action && ! isset($_GET['plugins']))) |
|
501 | + && ! isset($_POST['checked'])) { |
|
502 | 502 | $upgrade_error = $action == 'do-theme-upgrade' ? 'themes' : 'plugins'; |
503 | 503 | $action = 'upgrade-core'; |
504 | 504 | } |
@@ -506,47 +506,47 @@ discard block |
||
506 | 506 | $title = __('WordPress Updates'); |
507 | 507 | $parent_file = 'index.php'; |
508 | 508 | |
509 | -$updates_overview = '<p>' . __( 'On this screen, you can update to the latest version of WordPress, as well as update your themes and plugins from the WordPress.org repositories.' ) . '</p>'; |
|
510 | -$updates_overview .= '<p>' . __( 'If an update is available, you᾿ll see a notification appear in the Toolbar and navigation menu.' ) . ' ' . __( 'Keeping your site updated is important for security. It also makes the internet a safer place for you and your readers.' ) . '</p>'; |
|
509 | +$updates_overview = '<p>'.__('On this screen, you can update to the latest version of WordPress, as well as update your themes and plugins from the WordPress.org repositories.').'</p>'; |
|
510 | +$updates_overview .= '<p>'.__('If an update is available, you᾿ll see a notification appear in the Toolbar and navigation menu.').' '.__('Keeping your site updated is important for security. It also makes the internet a safer place for you and your readers.').'</p>'; |
|
511 | 511 | |
512 | -get_current_screen()->add_help_tab( array( |
|
512 | +get_current_screen()->add_help_tab(array( |
|
513 | 513 | 'id' => 'overview', |
514 | - 'title' => __( 'Overview' ), |
|
514 | + 'title' => __('Overview'), |
|
515 | 515 | 'content' => $updates_overview |
516 | -) ); |
|
516 | +)); |
|
517 | 517 | |
518 | -$updates_howto = '<p>' . __( '<strong>WordPress</strong> — Updating your WordPress installation is a simple one-click procedure: just <strong>click on the “Update Now” button</strong> when you are notified that a new version is available.' ) . ' ' . __( 'In most cases, WordPress will automatically apply maintenance and security updates in the background for you.' ) . '</p>'; |
|
519 | -$updates_howto .= '<p>' . __( '<strong>Themes and Plugins</strong> — To update individual themes or plugins from this screen, use the checkboxes to make your selection, then <strong>click on the appropriate “Update” button</strong>. To update all of your themes or plugins at once, you can check the box at the top of the section to select all before clicking the update button.' ) . '</p>'; |
|
518 | +$updates_howto = '<p>'.__('<strong>WordPress</strong> — Updating your WordPress installation is a simple one-click procedure: just <strong>click on the “Update Now” button</strong> when you are notified that a new version is available.').' '.__('In most cases, WordPress will automatically apply maintenance and security updates in the background for you.').'</p>'; |
|
519 | +$updates_howto .= '<p>'.__('<strong>Themes and Plugins</strong> — To update individual themes or plugins from this screen, use the checkboxes to make your selection, then <strong>click on the appropriate “Update” button</strong>. To update all of your themes or plugins at once, you can check the box at the top of the section to select all before clicking the update button.').'</p>'; |
|
520 | 520 | |
521 | -if ( 'en_US' != get_locale() ) { |
|
522 | - $updates_howto .= '<p>' . __( '<strong>Translations</strong> — The files translating WordPress into your language are updated for you whenever any other updates occur. But if these files are out of date, you can <strong>click the “Update Translations”</strong> button.' ) . '</p>'; |
|
521 | +if ('en_US' != get_locale()) { |
|
522 | + $updates_howto .= '<p>'.__('<strong>Translations</strong> — The files translating WordPress into your language are updated for you whenever any other updates occur. But if these files are out of date, you can <strong>click the “Update Translations”</strong> button.').'</p>'; |
|
523 | 523 | } |
524 | 524 | |
525 | -get_current_screen()->add_help_tab( array( |
|
525 | +get_current_screen()->add_help_tab(array( |
|
526 | 526 | 'id' => 'how-to-update', |
527 | - 'title' => __( 'How to Update' ), |
|
527 | + 'title' => __('How to Update'), |
|
528 | 528 | 'content' => $updates_howto |
529 | -) ); |
|
529 | +)); |
|
530 | 530 | |
531 | 531 | get_current_screen()->set_help_sidebar( |
532 | - '<p><strong>' . __('For more information:') . '</strong></p>' . |
|
533 | - '<p>' . __( '<a href="https://codex.wordpress.org/Dashboard_Updates_Screen" target="_blank">Documentation on Updating WordPress</a>' ) . '</p>' . |
|
534 | - '<p>' . __( '<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>' ) . '</p>' |
|
532 | + '<p><strong>'.__('For more information:').'</strong></p>'. |
|
533 | + '<p>'.__('<a href="https://codex.wordpress.org/Dashboard_Updates_Screen" target="_blank">Documentation on Updating WordPress</a>').'</p>'. |
|
534 | + '<p>'.__('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>').'</p>' |
|
535 | 535 | ); |
536 | 536 | |
537 | -if ( 'upgrade-core' == $action ) { |
|
537 | +if ('upgrade-core' == $action) { |
|
538 | 538 | // Force a update check when requested |
539 | - $force_check = ! empty( $_GET['force-check'] ); |
|
540 | - wp_version_check( array(), $force_check ); |
|
539 | + $force_check = ! empty($_GET['force-check']); |
|
540 | + wp_version_check(array(), $force_check); |
|
541 | 541 | |
542 | - require_once(ABSPATH . 'wp-admin/admin-header.php'); |
|
542 | + require_once(ABSPATH.'wp-admin/admin-header.php'); |
|
543 | 543 | ?> |
544 | 544 | <div class="wrap"> |
545 | - <h1><?php _e( 'WordPress Updates' ); ?></h1> |
|
545 | + <h1><?php _e('WordPress Updates'); ?></h1> |
|
546 | 546 | <?php |
547 | - if ( $upgrade_error ) { |
|
547 | + if ($upgrade_error) { |
|
548 | 548 | echo '<div class="error"><p>'; |
549 | - if ( $upgrade_error == 'themes' ) |
|
549 | + if ($upgrade_error == 'themes') |
|
550 | 550 | _e('Please select one or more themes to update.'); |
551 | 551 | else |
552 | 552 | _e('Please select one or more plugins to update.'); |
@@ -555,129 +555,129 @@ discard block |
||
555 | 555 | |
556 | 556 | echo '<p>'; |
557 | 557 | /* translators: %1 date, %2 time. */ |
558 | - printf( __('Last checked on %1$s at %2$s.'), date_i18n( get_option( 'date_format' ) ), date_i18n( get_option( 'time_format' ) ) ); |
|
559 | - echo ' <a class="button" href="' . esc_url( self_admin_url('update-core.php?force-check=1') ) . '">' . __( 'Check Again' ) . '</a>'; |
|
558 | + printf(__('Last checked on %1$s at %2$s.'), date_i18n(get_option('date_format')), date_i18n(get_option('time_format'))); |
|
559 | + echo ' <a class="button" href="'.esc_url(self_admin_url('update-core.php?force-check=1')).'">'.__('Check Again').'</a>'; |
|
560 | 560 | echo '</p>'; |
561 | 561 | |
562 | - if ( $core = current_user_can( 'update_core' ) ) |
|
562 | + if ($core = current_user_can('update_core')) |
|
563 | 563 | core_upgrade_preamble(); |
564 | - if ( $plugins = current_user_can( 'update_plugins' ) ) |
|
564 | + if ($plugins = current_user_can('update_plugins')) |
|
565 | 565 | list_plugin_updates(); |
566 | - if ( $themes = current_user_can( 'update_themes' ) ) |
|
566 | + if ($themes = current_user_can('update_themes')) |
|
567 | 567 | list_theme_updates(); |
568 | - if ( $core || $plugins || $themes ) |
|
568 | + if ($core || $plugins || $themes) |
|
569 | 569 | list_translation_updates(); |
570 | - unset( $core, $plugins, $themes ); |
|
570 | + unset($core, $plugins, $themes); |
|
571 | 571 | /** |
572 | 572 | * Fires after the core, plugin, and theme update tables. |
573 | 573 | * |
574 | 574 | * @since 2.9.0 |
575 | 575 | */ |
576 | - do_action( 'core_upgrade_preamble' ); |
|
576 | + do_action('core_upgrade_preamble'); |
|
577 | 577 | echo '</div>'; |
578 | - include(ABSPATH . 'wp-admin/admin-footer.php'); |
|
578 | + include(ABSPATH.'wp-admin/admin-footer.php'); |
|
579 | 579 | |
580 | -} elseif ( 'do-core-upgrade' == $action || 'do-core-reinstall' == $action ) { |
|
580 | +} elseif ('do-core-upgrade' == $action || 'do-core-reinstall' == $action) { |
|
581 | 581 | |
582 | - if ( ! current_user_can( 'update_core' ) ) |
|
583 | - wp_die( __( 'You do not have sufficient permissions to update this site.' ) ); |
|
582 | + if ( ! current_user_can('update_core')) |
|
583 | + wp_die(__('You do not have sufficient permissions to update this site.')); |
|
584 | 584 | |
585 | 585 | check_admin_referer('upgrade-core'); |
586 | 586 | |
587 | 587 | // Do the (un)dismiss actions before headers, so that they can redirect. |
588 | - if ( isset( $_POST['dismiss'] ) ) |
|
588 | + if (isset($_POST['dismiss'])) |
|
589 | 589 | do_dismiss_core_update(); |
590 | - elseif ( isset( $_POST['undismiss'] ) ) |
|
590 | + elseif (isset($_POST['undismiss'])) |
|
591 | 591 | do_undismiss_core_update(); |
592 | 592 | |
593 | - require_once(ABSPATH . 'wp-admin/admin-header.php'); |
|
594 | - if ( 'do-core-reinstall' == $action ) |
|
593 | + require_once(ABSPATH.'wp-admin/admin-header.php'); |
|
594 | + if ('do-core-reinstall' == $action) |
|
595 | 595 | $reinstall = true; |
596 | 596 | else |
597 | 597 | $reinstall = false; |
598 | 598 | |
599 | - if ( isset( $_POST['upgrade'] ) ) |
|
599 | + if (isset($_POST['upgrade'])) |
|
600 | 600 | do_core_upgrade($reinstall); |
601 | 601 | |
602 | - include(ABSPATH . 'wp-admin/admin-footer.php'); |
|
602 | + include(ABSPATH.'wp-admin/admin-footer.php'); |
|
603 | 603 | |
604 | -} elseif ( 'do-plugin-upgrade' == $action ) { |
|
604 | +} elseif ('do-plugin-upgrade' == $action) { |
|
605 | 605 | |
606 | - if ( ! current_user_can( 'update_plugins' ) ) |
|
607 | - wp_die( __( 'You do not have sufficient permissions to update this site.' ) ); |
|
606 | + if ( ! current_user_can('update_plugins')) |
|
607 | + wp_die(__('You do not have sufficient permissions to update this site.')); |
|
608 | 608 | |
609 | 609 | check_admin_referer('upgrade-core'); |
610 | 610 | |
611 | - if ( isset( $_GET['plugins'] ) ) { |
|
612 | - $plugins = explode( ',', $_GET['plugins'] ); |
|
613 | - } elseif ( isset( $_POST['checked'] ) ) { |
|
611 | + if (isset($_GET['plugins'])) { |
|
612 | + $plugins = explode(',', $_GET['plugins']); |
|
613 | + } elseif (isset($_POST['checked'])) { |
|
614 | 614 | $plugins = (array) $_POST['checked']; |
615 | 615 | } else { |
616 | - wp_redirect( admin_url('update-core.php') ); |
|
616 | + wp_redirect(admin_url('update-core.php')); |
|
617 | 617 | exit; |
618 | 618 | } |
619 | 619 | |
620 | - $url = 'update.php?action=update-selected&plugins=' . urlencode(implode(',', $plugins)); |
|
620 | + $url = 'update.php?action=update-selected&plugins='.urlencode(implode(',', $plugins)); |
|
621 | 621 | $url = wp_nonce_url($url, 'bulk-update-plugins'); |
622 | 622 | |
623 | 623 | $title = __('Update Plugins'); |
624 | 624 | |
625 | - require_once(ABSPATH . 'wp-admin/admin-header.php'); |
|
625 | + require_once(ABSPATH.'wp-admin/admin-header.php'); |
|
626 | 626 | echo '<div class="wrap">'; |
627 | - echo '<h1>' . __( 'Update Plugins' ) . '</h1>'; |
|
627 | + echo '<h1>'.__('Update Plugins').'</h1>'; |
|
628 | 628 | echo '<iframe src="', $url, '" style="width: 100%; height: 100%; min-height: 750px;" frameborder="0"></iframe>'; |
629 | 629 | echo '</div>'; |
630 | - include(ABSPATH . 'wp-admin/admin-footer.php'); |
|
630 | + include(ABSPATH.'wp-admin/admin-footer.php'); |
|
631 | 631 | |
632 | -} elseif ( 'do-theme-upgrade' == $action ) { |
|
632 | +} elseif ('do-theme-upgrade' == $action) { |
|
633 | 633 | |
634 | - if ( ! current_user_can( 'update_themes' ) ) |
|
635 | - wp_die( __( 'You do not have sufficient permissions to update this site.' ) ); |
|
634 | + if ( ! current_user_can('update_themes')) |
|
635 | + wp_die(__('You do not have sufficient permissions to update this site.')); |
|
636 | 636 | |
637 | 637 | check_admin_referer('upgrade-core'); |
638 | 638 | |
639 | - if ( isset( $_GET['themes'] ) ) { |
|
640 | - $themes = explode( ',', $_GET['themes'] ); |
|
641 | - } elseif ( isset( $_POST['checked'] ) ) { |
|
639 | + if (isset($_GET['themes'])) { |
|
640 | + $themes = explode(',', $_GET['themes']); |
|
641 | + } elseif (isset($_POST['checked'])) { |
|
642 | 642 | $themes = (array) $_POST['checked']; |
643 | 643 | } else { |
644 | - wp_redirect( admin_url('update-core.php') ); |
|
644 | + wp_redirect(admin_url('update-core.php')); |
|
645 | 645 | exit; |
646 | 646 | } |
647 | 647 | |
648 | - $url = 'update.php?action=update-selected-themes&themes=' . urlencode(implode(',', $themes)); |
|
648 | + $url = 'update.php?action=update-selected-themes&themes='.urlencode(implode(',', $themes)); |
|
649 | 649 | $url = wp_nonce_url($url, 'bulk-update-themes'); |
650 | 650 | |
651 | 651 | $title = __('Update Themes'); |
652 | 652 | |
653 | - require_once(ABSPATH . 'wp-admin/admin-header.php'); |
|
653 | + require_once(ABSPATH.'wp-admin/admin-header.php'); |
|
654 | 654 | ?> |
655 | 655 | <div class="wrap"> |
656 | - <h1><?php _e( 'Update Themes' ); ?></h1> |
|
656 | + <h1><?php _e('Update Themes'); ?></h1> |
|
657 | 657 | <iframe src="<?php echo $url ?>" style="width: 100%; height: 100%; min-height: 750px;" frameborder="0"></iframe> |
658 | 658 | </div> |
659 | 659 | <?php |
660 | - include(ABSPATH . 'wp-admin/admin-footer.php'); |
|
660 | + include(ABSPATH.'wp-admin/admin-footer.php'); |
|
661 | 661 | |
662 | -} elseif ( 'do-translation-upgrade' == $action ) { |
|
662 | +} elseif ('do-translation-upgrade' == $action) { |
|
663 | 663 | |
664 | - if ( ! current_user_can( 'update_core' ) && ! current_user_can( 'update_plugins' ) && ! current_user_can( 'update_themes' ) ) |
|
665 | - wp_die( __( 'You do not have sufficient permissions to update this site.' ) ); |
|
664 | + if ( ! current_user_can('update_core') && ! current_user_can('update_plugins') && ! current_user_can('update_themes')) |
|
665 | + wp_die(__('You do not have sufficient permissions to update this site.')); |
|
666 | 666 | |
667 | - check_admin_referer( 'upgrade-translations' ); |
|
667 | + check_admin_referer('upgrade-translations'); |
|
668 | 668 | |
669 | - require_once( ABSPATH . 'wp-admin/admin-header.php' ); |
|
670 | - include_once( ABSPATH . 'wp-admin/includes/class-wp-upgrader.php' ); |
|
669 | + require_once(ABSPATH.'wp-admin/admin-header.php'); |
|
670 | + include_once(ABSPATH.'wp-admin/includes/class-wp-upgrader.php'); |
|
671 | 671 | |
672 | 672 | $url = 'update-core.php?action=do-translation-upgrade'; |
673 | 673 | $nonce = 'upgrade-translations'; |
674 | - $title = __( 'Update Translations' ); |
|
674 | + $title = __('Update Translations'); |
|
675 | 675 | $context = WP_LANG_DIR; |
676 | 676 | |
677 | - $upgrader = new Language_Pack_Upgrader( new Language_Pack_Upgrader_Skin( compact( 'url', 'nonce', 'title', 'context' ) ) ); |
|
677 | + $upgrader = new Language_Pack_Upgrader(new Language_Pack_Upgrader_Skin(compact('url', 'nonce', 'title', 'context'))); |
|
678 | 678 | $result = $upgrader->bulk_upgrade(); |
679 | 679 | |
680 | - require_once( ABSPATH . 'wp-admin/admin-footer.php' ); |
|
680 | + require_once(ABSPATH.'wp-admin/admin-footer.php'); |
|
681 | 681 | |
682 | 682 | } else { |
683 | 683 | /** |
@@ -689,5 +689,5 @@ discard block |
||
689 | 689 | * |
690 | 690 | * @since 3.2.0 |
691 | 691 | */ |
692 | - do_action( "update-core-custom_{$action}" ); |
|
692 | + do_action("update-core-custom_{$action}"); |
|
693 | 693 | } |
@@ -19,8 +19,9 @@ discard block |
||
19 | 19 | exit(); |
20 | 20 | } |
21 | 21 | |
22 | -if ( ! current_user_can( 'update_core' ) && ! current_user_can( 'update_themes' ) && ! current_user_can( 'update_plugins' ) ) |
|
22 | +if ( ! current_user_can( 'update_core' ) && ! current_user_can( 'update_themes' ) && ! current_user_can( 'update_plugins' ) ) { |
|
23 | 23 | wp_die( __( 'You do not have sufficient permissions to update this site.' ) ); |
24 | +} |
|
24 | 25 | |
25 | 26 | /** |
26 | 27 | * |
@@ -36,17 +37,20 @@ discard block |
||
36 | 37 | global $wp_local_package, $wpdb, $wp_version; |
37 | 38 | static $first_pass = true; |
38 | 39 | |
39 | - if ( 'en_US' == $update->locale && 'en_US' == get_locale() ) |
|
40 | - $version_string = $update->current; |
|
40 | + if ( 'en_US' == $update->locale && 'en_US' == get_locale() ) { |
|
41 | + $version_string = $update->current; |
|
42 | + } |
|
41 | 43 | // If the only available update is a partial builds, it doesn't need a language-specific version string. |
42 | - elseif ( 'en_US' == $update->locale && $update->packages->partial && $wp_version == $update->partial_version && ( $updates = get_core_updates() ) && 1 == count( $updates ) ) |
|
43 | - $version_string = $update->current; |
|
44 | - else |
|
45 | - $version_string = sprintf( "%s–<strong>%s</strong>", $update->current, $update->locale ); |
|
44 | + elseif ( 'en_US' == $update->locale && $update->packages->partial && $wp_version == $update->partial_version && ( $updates = get_core_updates() ) && 1 == count( $updates ) ) { |
|
45 | + $version_string = $update->current; |
|
46 | + } else { |
|
47 | + $version_string = sprintf( "%s–<strong>%s</strong>", $update->current, $update->locale ); |
|
48 | + } |
|
46 | 49 | |
47 | 50 | $current = false; |
48 | - if ( !isset($update->response) || 'latest' == $update->response ) |
|
49 | - $current = true; |
|
51 | + if ( !isset($update->response) || 'latest' == $update->response ) { |
|
52 | + $current = true; |
|
53 | + } |
|
50 | 54 | $submit = __('Update Now'); |
51 | 55 | $form_action = 'update-core.php?action=do-core-upgrade'; |
52 | 56 | $php_version = phpversion(); |
@@ -62,21 +66,24 @@ discard block |
||
62 | 66 | $form_action = 'update-core.php?action=do-core-reinstall'; |
63 | 67 | } else { |
64 | 68 | $php_compat = version_compare( $php_version, $update->php_version, '>=' ); |
65 | - if ( file_exists( WP_CONTENT_DIR . '/db.php' ) && empty( $wpdb->is_mysql ) ) |
|
66 | - $mysql_compat = true; |
|
67 | - else |
|
68 | - $mysql_compat = version_compare( $mysql_version, $update->mysql_version, '>=' ); |
|
69 | - |
|
70 | - if ( !$mysql_compat && !$php_compat ) |
|
71 | - $message = sprintf( __('You cannot update because <a href="https://codex.wordpress.org/Version_%1$s">WordPress %1$s</a> requires PHP version %2$s or higher and MySQL version %3$s or higher. You are running PHP version %4$s and MySQL version %5$s.'), $update->current, $update->php_version, $update->mysql_version, $php_version, $mysql_version ); |
|
72 | - elseif ( !$php_compat ) |
|
73 | - $message = sprintf( __('You cannot update because <a href="https://codex.wordpress.org/Version_%1$s">WordPress %1$s</a> requires PHP version %2$s or higher. You are running version %3$s.'), $update->current, $update->php_version, $php_version ); |
|
74 | - elseif ( !$mysql_compat ) |
|
75 | - $message = sprintf( __('You cannot update because <a href="https://codex.wordpress.org/Version_%1$s">WordPress %1$s</a> requires MySQL version %2$s or higher. You are running version %3$s.'), $update->current, $update->mysql_version, $mysql_version ); |
|
76 | - else |
|
77 | - $message = sprintf(__('You can update to <a href="https://codex.wordpress.org/Version_%1$s">WordPress %2$s</a> automatically or download the package and install it manually:'), $update->current, $version_string); |
|
78 | - if ( !$mysql_compat || !$php_compat ) |
|
79 | - $show_buttons = false; |
|
69 | + if ( file_exists( WP_CONTENT_DIR . '/db.php' ) && empty( $wpdb->is_mysql ) ) { |
|
70 | + $mysql_compat = true; |
|
71 | + } else { |
|
72 | + $mysql_compat = version_compare( $mysql_version, $update->mysql_version, '>=' ); |
|
73 | + } |
|
74 | + |
|
75 | + if ( !$mysql_compat && !$php_compat ) { |
|
76 | + $message = sprintf( __('You cannot update because <a href="https://codex.wordpress.org/Version_%1$s">WordPress %1$s</a> requires PHP version %2$s or higher and MySQL version %3$s or higher. You are running PHP version %4$s and MySQL version %5$s.'), $update->current, $update->php_version, $update->mysql_version, $php_version, $mysql_version ); |
|
77 | + } elseif ( !$php_compat ) { |
|
78 | + $message = sprintf( __('You cannot update because <a href="https://codex.wordpress.org/Version_%1$s">WordPress %1$s</a> requires PHP version %2$s or higher. You are running version %3$s.'), $update->current, $update->php_version, $php_version ); |
|
79 | + } elseif ( !$mysql_compat ) { |
|
80 | + $message = sprintf( __('You cannot update because <a href="https://codex.wordpress.org/Version_%1$s">WordPress %1$s</a> requires MySQL version %2$s or higher. You are running version %3$s.'), $update->current, $update->mysql_version, $mysql_version ); |
|
81 | + } else { |
|
82 | + $message = sprintf(__('You can update to <a href="https://codex.wordpress.org/Version_%1$s">WordPress %2$s</a> automatically or download the package and install it manually:'), $update->current, $version_string); |
|
83 | + } |
|
84 | + if ( !$mysql_compat || !$php_compat ) { |
|
85 | + $show_buttons = false; |
|
86 | + } |
|
80 | 87 | } |
81 | 88 | $download = sprintf(__('Download %s'), $version_string); |
82 | 89 | } |
@@ -98,14 +105,16 @@ discard block |
||
98 | 105 | } |
99 | 106 | echo ' <a href="' . esc_url( $update->download ) . '" class="button">' . $download . '</a> '; |
100 | 107 | } |
101 | - if ( 'en_US' != $update->locale ) |
|
102 | - if ( !isset( $update->dismissed ) || !$update->dismissed ) |
|
108 | + if ( 'en_US' != $update->locale ) { |
|
109 | + if ( !isset( $update->dismissed ) || !$update->dismissed ) |
|
103 | 110 | submit_button( __('Hide this update'), 'button', 'dismiss', false ); |
104 | - else |
|
105 | - submit_button( __('Bring back this update'), 'button', 'undismiss', false ); |
|
111 | + } else { |
|
112 | + submit_button( __('Bring back this update'), 'button', 'undismiss', false ); |
|
113 | + } |
|
106 | 114 | echo '</p>'; |
107 | - if ( 'en_US' != $update->locale && ( !isset($wp_local_package) || $wp_local_package != $update->locale ) ) |
|
108 | - echo '<p class="hint">'.__('This localized version contains both the translation and various other localization fixes. You can skip upgrading if you want to keep your current translation.').'</p>'; |
|
115 | + if ( 'en_US' != $update->locale && ( !isset($wp_local_package) || $wp_local_package != $update->locale ) ) { |
|
116 | + echo '<p class="hint">'.__('This localized version contains both the translation and various other localization fixes. You can skip upgrading if you want to keep your current translation.').'</p>'; |
|
117 | + } |
|
109 | 118 | // Partial builds don't need language-specific warnings. |
110 | 119 | elseif ( 'en_US' == $update->locale && get_locale() != 'en_US' && ( ! $update->packages->partial && $wp_version == $update->partial_version ) ) { |
111 | 120 | echo '<p class="hint">'.sprintf( __('You are about to install WordPress %s <strong>in English (US).</strong> There is a chance this update will break your translation. You may prefer to wait for the localized version to be released.'), $update->response != 'development' ? $update->current : '' ).'</p>'; |
@@ -172,8 +181,9 @@ discard block |
||
172 | 181 | 'mysql_version' => $required_mysql_version, |
173 | 182 | ); |
174 | 183 | $should_auto_update = $upgrader->should_update( 'core', $future_minor_update, ABSPATH ); |
175 | - if ( $should_auto_update ) |
|
176 | - echo ' ' . __( 'Future security updates will be applied automatically.' ); |
|
184 | + if ( $should_auto_update ) { |
|
185 | + echo ' ' . __( 'Future security updates will be applied automatically.' ); |
|
186 | + } |
|
177 | 187 | } |
178 | 188 | echo '</h3>'; |
179 | 189 | } else { |
@@ -232,10 +242,11 @@ discard block |
||
232 | 242 | $form_action = 'update-core.php?action=do-plugin-upgrade'; |
233 | 243 | |
234 | 244 | $core_updates = get_core_updates(); |
235 | - if ( !isset($core_updates[0]->response) || 'latest' == $core_updates[0]->response || 'development' == $core_updates[0]->response || version_compare( $core_updates[0]->current, $cur_wp_version, '=') ) |
|
236 | - $core_update_version = false; |
|
237 | - else |
|
238 | - $core_update_version = $core_updates[0]->current; |
|
245 | + if ( !isset($core_updates[0]->response) || 'latest' == $core_updates[0]->response || 'development' == $core_updates[0]->response || version_compare( $core_updates[0]->current, $cur_wp_version, '=') ) { |
|
246 | + $core_update_version = false; |
|
247 | + } else { |
|
248 | + $core_update_version = $core_updates[0]->current; |
|
249 | + } |
|
239 | 250 | ?> |
240 | 251 | <h3><?php _e( 'Plugins' ); ?></h3> |
241 | 252 | <p><?php _e( 'The following plugins have new versions available. Check the ones you want to update and then click “Update Plugins”.' ); ?></p> |
@@ -397,17 +408,19 @@ discard block |
||
397 | 408 | |
398 | 409 | include_once( ABSPATH . 'wp-admin/includes/class-wp-upgrader.php' ); |
399 | 410 | |
400 | - if ( $reinstall ) |
|
401 | - $url = 'update-core.php?action=do-core-reinstall'; |
|
402 | - else |
|
403 | - $url = 'update-core.php?action=do-core-upgrade'; |
|
411 | + if ( $reinstall ) { |
|
412 | + $url = 'update-core.php?action=do-core-reinstall'; |
|
413 | + } else { |
|
414 | + $url = 'update-core.php?action=do-core-upgrade'; |
|
415 | + } |
|
404 | 416 | $url = wp_nonce_url($url, 'upgrade-core'); |
405 | 417 | |
406 | 418 | $version = isset( $_POST['version'] )? $_POST['version'] : false; |
407 | 419 | $locale = isset( $_POST['locale'] )? $_POST['locale'] : 'en_US'; |
408 | 420 | $update = find_core_update( $version, $locale ); |
409 | - if ( !$update ) |
|
410 | - return; |
|
421 | + if ( !$update ) { |
|
422 | + return; |
|
423 | + } |
|
411 | 424 | |
412 | 425 | // Allow relaxed file ownership writes for User-initiated upgrades when the API specifies |
413 | 426 | // that it's safe to do so. This only happens when there are no new files to create. |
@@ -431,14 +444,16 @@ discard block |
||
431 | 444 | } |
432 | 445 | |
433 | 446 | if ( $wp_filesystem->errors->get_error_code() ) { |
434 | - foreach ( $wp_filesystem->errors->get_error_messages() as $message ) |
|
435 | - show_message($message); |
|
447 | + foreach ( $wp_filesystem->errors->get_error_messages() as $message ) { |
|
448 | + show_message($message); |
|
449 | + } |
|
436 | 450 | echo '</div>'; |
437 | 451 | return; |
438 | 452 | } |
439 | 453 | |
440 | - if ( $reinstall ) |
|
441 | - $update->response = 'reinstall'; |
|
454 | + if ( $reinstall ) { |
|
455 | + $update->response = 'reinstall'; |
|
456 | + } |
|
442 | 457 | |
443 | 458 | add_filter( 'update_feedback', 'show_message' ); |
444 | 459 | |
@@ -449,8 +464,9 @@ discard block |
||
449 | 464 | |
450 | 465 | if ( is_wp_error($result) ) { |
451 | 466 | show_message($result); |
452 | - if ('up_to_date' != $result->get_error_code() ) |
|
453 | - show_message( __('Installation Failed') ); |
|
467 | + if ('up_to_date' != $result->get_error_code() ) { |
|
468 | + show_message( __('Installation Failed') ); |
|
469 | + } |
|
454 | 470 | echo '</div>'; |
455 | 471 | return; |
456 | 472 | } |
@@ -473,8 +489,9 @@ discard block |
||
473 | 489 | $version = isset( $_POST['version'] )? $_POST['version'] : false; |
474 | 490 | $locale = isset( $_POST['locale'] )? $_POST['locale'] : 'en_US'; |
475 | 491 | $update = find_core_update( $version, $locale ); |
476 | - if ( !$update ) |
|
477 | - return; |
|
492 | + if ( !$update ) { |
|
493 | + return; |
|
494 | + } |
|
478 | 495 | dismiss_core_update( $update ); |
479 | 496 | wp_redirect( wp_nonce_url('update-core.php?action=upgrade-core', 'upgrade-core') ); |
480 | 497 | exit; |
@@ -487,8 +504,9 @@ discard block |
||
487 | 504 | $version = isset( $_POST['version'] )? $_POST['version'] : false; |
488 | 505 | $locale = isset( $_POST['locale'] )? $_POST['locale'] : 'en_US'; |
489 | 506 | $update = find_core_update( $version, $locale ); |
490 | - if ( !$update ) |
|
491 | - return; |
|
507 | + if ( !$update ) { |
|
508 | + return; |
|
509 | + } |
|
492 | 510 | undismiss_core_update( $version, $locale ); |
493 | 511 | wp_redirect( wp_nonce_url('update-core.php?action=upgrade-core', 'upgrade-core') ); |
494 | 512 | exit; |
@@ -546,10 +564,11 @@ discard block |
||
546 | 564 | <?php |
547 | 565 | if ( $upgrade_error ) { |
548 | 566 | echo '<div class="error"><p>'; |
549 | - if ( $upgrade_error == 'themes' ) |
|
550 | - _e('Please select one or more themes to update.'); |
|
551 | - else |
|
552 | - _e('Please select one or more plugins to update.'); |
|
567 | + if ( $upgrade_error == 'themes' ) { |
|
568 | + _e('Please select one or more themes to update.'); |
|
569 | + } else { |
|
570 | + _e('Please select one or more plugins to update.'); |
|
571 | + } |
|
553 | 572 | echo '</p></div>'; |
554 | 573 | } |
555 | 574 | |
@@ -559,14 +578,18 @@ discard block |
||
559 | 578 | echo ' <a class="button" href="' . esc_url( self_admin_url('update-core.php?force-check=1') ) . '">' . __( 'Check Again' ) . '</a>'; |
560 | 579 | echo '</p>'; |
561 | 580 | |
562 | - if ( $core = current_user_can( 'update_core' ) ) |
|
563 | - core_upgrade_preamble(); |
|
564 | - if ( $plugins = current_user_can( 'update_plugins' ) ) |
|
565 | - list_plugin_updates(); |
|
566 | - if ( $themes = current_user_can( 'update_themes' ) ) |
|
567 | - list_theme_updates(); |
|
568 | - if ( $core || $plugins || $themes ) |
|
569 | - list_translation_updates(); |
|
581 | + if ( $core = current_user_can( 'update_core' ) ) { |
|
582 | + core_upgrade_preamble(); |
|
583 | + } |
|
584 | + if ( $plugins = current_user_can( 'update_plugins' ) ) { |
|
585 | + list_plugin_updates(); |
|
586 | + } |
|
587 | + if ( $themes = current_user_can( 'update_themes' ) ) { |
|
588 | + list_theme_updates(); |
|
589 | + } |
|
590 | + if ( $core || $plugins || $themes ) { |
|
591 | + list_translation_updates(); |
|
592 | + } |
|
570 | 593 | unset( $core, $plugins, $themes ); |
571 | 594 | /** |
572 | 595 | * Fires after the core, plugin, and theme update tables. |
@@ -579,32 +602,37 @@ discard block |
||
579 | 602 | |
580 | 603 | } elseif ( 'do-core-upgrade' == $action || 'do-core-reinstall' == $action ) { |
581 | 604 | |
582 | - if ( ! current_user_can( 'update_core' ) ) |
|
583 | - wp_die( __( 'You do not have sufficient permissions to update this site.' ) ); |
|
605 | + if ( ! current_user_can( 'update_core' ) ) { |
|
606 | + wp_die( __( 'You do not have sufficient permissions to update this site.' ) ); |
|
607 | + } |
|
584 | 608 | |
585 | 609 | check_admin_referer('upgrade-core'); |
586 | 610 | |
587 | 611 | // Do the (un)dismiss actions before headers, so that they can redirect. |
588 | - if ( isset( $_POST['dismiss'] ) ) |
|
589 | - do_dismiss_core_update(); |
|
590 | - elseif ( isset( $_POST['undismiss'] ) ) |
|
591 | - do_undismiss_core_update(); |
|
612 | + if ( isset( $_POST['dismiss'] ) ) { |
|
613 | + do_dismiss_core_update(); |
|
614 | + } elseif ( isset( $_POST['undismiss'] ) ) { |
|
615 | + do_undismiss_core_update(); |
|
616 | + } |
|
592 | 617 | |
593 | 618 | require_once(ABSPATH . 'wp-admin/admin-header.php'); |
594 | - if ( 'do-core-reinstall' == $action ) |
|
595 | - $reinstall = true; |
|
596 | - else |
|
597 | - $reinstall = false; |
|
619 | + if ( 'do-core-reinstall' == $action ) { |
|
620 | + $reinstall = true; |
|
621 | + } else { |
|
622 | + $reinstall = false; |
|
623 | + } |
|
598 | 624 | |
599 | - if ( isset( $_POST['upgrade'] ) ) |
|
600 | - do_core_upgrade($reinstall); |
|
625 | + if ( isset( $_POST['upgrade'] ) ) { |
|
626 | + do_core_upgrade($reinstall); |
|
627 | + } |
|
601 | 628 | |
602 | 629 | include(ABSPATH . 'wp-admin/admin-footer.php'); |
603 | 630 | |
604 | 631 | } elseif ( 'do-plugin-upgrade' == $action ) { |
605 | 632 | |
606 | - if ( ! current_user_can( 'update_plugins' ) ) |
|
607 | - wp_die( __( 'You do not have sufficient permissions to update this site.' ) ); |
|
633 | + if ( ! current_user_can( 'update_plugins' ) ) { |
|
634 | + wp_die( __( 'You do not have sufficient permissions to update this site.' ) ); |
|
635 | + } |
|
608 | 636 | |
609 | 637 | check_admin_referer('upgrade-core'); |
610 | 638 | |
@@ -631,8 +659,9 @@ discard block |
||
631 | 659 | |
632 | 660 | } elseif ( 'do-theme-upgrade' == $action ) { |
633 | 661 | |
634 | - if ( ! current_user_can( 'update_themes' ) ) |
|
635 | - wp_die( __( 'You do not have sufficient permissions to update this site.' ) ); |
|
662 | + if ( ! current_user_can( 'update_themes' ) ) { |
|
663 | + wp_die( __( 'You do not have sufficient permissions to update this site.' ) ); |
|
664 | + } |
|
636 | 665 | |
637 | 666 | check_admin_referer('upgrade-core'); |
638 | 667 | |
@@ -661,8 +690,9 @@ discard block |
||
661 | 690 | |
662 | 691 | } elseif ( 'do-translation-upgrade' == $action ) { |
663 | 692 | |
664 | - if ( ! current_user_can( 'update_core' ) && ! current_user_can( 'update_plugins' ) && ! current_user_can( 'update_themes' ) ) |
|
665 | - wp_die( __( 'You do not have sufficient permissions to update this site.' ) ); |
|
693 | + if ( ! current_user_can( 'update_core' ) && ! current_user_can( 'update_plugins' ) && ! current_user_can( 'update_themes' ) ) { |
|
694 | + wp_die( __( 'You do not have sufficient permissions to update this site.' ) ); |
|
695 | + } |
|
666 | 696 | |
667 | 697 | check_admin_referer( 'upgrade-translations' ); |
668 | 698 |
@@ -1,38 +1,38 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * Plugins may load this file to gain access to special helper functions for |
|
4 | - * plugin installation. This file is not included by WordPress and it is |
|
5 | - * recommended, to prevent fatal errors, that this file is included using |
|
6 | - * require_once(). |
|
7 | - * |
|
8 | - * These functions are not optimized for speed, but they should only be used |
|
9 | - * once in a while, so speed shouldn't be a concern. If it is and you are |
|
10 | - * needing to use these functions a lot, you might experience time outs. If you |
|
11 | - * do, then it is advised to just write the SQL code yourself. |
|
12 | - * |
|
13 | - * check_column( 'wp_links', 'link_description', 'mediumtext' ); |
|
14 | - * if ( check_column( $wpdb->comments, 'comment_author', 'tinytext' ) ) { |
|
15 | - * echo "ok\n"; |
|
16 | - * } |
|
17 | - * |
|
18 | - * $error_count = 0; |
|
19 | - * $tablename = $wpdb->links; |
|
20 | - * // Check the column. |
|
21 | - * if ( ! check_column($wpdb->links, 'link_description', 'varchar( 255 )' ) ) { |
|
22 | - * $ddl = "ALTER TABLE $wpdb->links MODIFY COLUMN link_description varchar(255) NOT NULL DEFAULT '' "; |
|
23 | - * $q = $wpdb->query( $ddl ); |
|
24 | - * } |
|
25 | - * |
|
26 | - * if ( check_column( $wpdb->links, 'link_description', 'varchar( 255 )' ) ) { |
|
27 | - * $res .= $tablename . ' - ok <br />'; |
|
28 | - * } else { |
|
29 | - * $res .= 'There was a problem with ' . $tablename . '<br />'; |
|
30 | - * ++$error_count; |
|
31 | - * } |
|
32 | - * |
|
33 | - * @package WordPress |
|
34 | - * @subpackage Plugin |
|
35 | - */ |
|
3 | + * Plugins may load this file to gain access to special helper functions for |
|
4 | + * plugin installation. This file is not included by WordPress and it is |
|
5 | + * recommended, to prevent fatal errors, that this file is included using |
|
6 | + * require_once(). |
|
7 | + * |
|
8 | + * These functions are not optimized for speed, but they should only be used |
|
9 | + * once in a while, so speed shouldn't be a concern. If it is and you are |
|
10 | + * needing to use these functions a lot, you might experience time outs. If you |
|
11 | + * do, then it is advised to just write the SQL code yourself. |
|
12 | + * |
|
13 | + * check_column( 'wp_links', 'link_description', 'mediumtext' ); |
|
14 | + * if ( check_column( $wpdb->comments, 'comment_author', 'tinytext' ) ) { |
|
15 | + * echo "ok\n"; |
|
16 | + * } |
|
17 | + * |
|
18 | + * $error_count = 0; |
|
19 | + * $tablename = $wpdb->links; |
|
20 | + * // Check the column. |
|
21 | + * if ( ! check_column($wpdb->links, 'link_description', 'varchar( 255 )' ) ) { |
|
22 | + * $ddl = "ALTER TABLE $wpdb->links MODIFY COLUMN link_description varchar(255) NOT NULL DEFAULT '' "; |
|
23 | + * $q = $wpdb->query( $ddl ); |
|
24 | + * } |
|
25 | + * |
|
26 | + * if ( check_column( $wpdb->links, 'link_description', 'varchar( 255 )' ) ) { |
|
27 | + * $res .= $tablename . ' - ok <br />'; |
|
28 | + * } else { |
|
29 | + * $res .= 'There was a problem with ' . $tablename . '<br />'; |
|
30 | + * ++$error_count; |
|
31 | + * } |
|
32 | + * |
|
33 | + * @package WordPress |
|
34 | + * @subpackage Plugin |
|
35 | + */ |
|
36 | 36 | |
37 | 37 | /** Load WordPress Bootstrap */ |
38 | 38 | require_once(dirname(dirname(__FILE__)).'/wp-load.php'); |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | /** Load WordPress Bootstrap */ |
38 | 38 | require_once(dirname(dirname(__FILE__)).'/wp-load.php'); |
39 | 39 | |
40 | -if ( ! function_exists('maybe_create_table') ) : |
|
40 | +if ( ! function_exists('maybe_create_table')) : |
|
41 | 41 | /** |
42 | 42 | * Create database table, if it doesn't already exist. |
43 | 43 | * |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | */ |
52 | 52 | function maybe_create_table($table_name, $create_ddl) { |
53 | 53 | global $wpdb; |
54 | - foreach ($wpdb->get_col("SHOW TABLES",0) as $table ) { |
|
54 | + foreach ($wpdb->get_col("SHOW TABLES", 0) as $table) { |
|
55 | 55 | if ($table == $table_name) { |
56 | 56 | return true; |
57 | 57 | } |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | $wpdb->query($create_ddl); |
61 | 61 | |
62 | 62 | // We cannot directly tell that whether this succeeded! |
63 | - foreach ($wpdb->get_col("SHOW TABLES",0) as $table ) { |
|
63 | + foreach ($wpdb->get_col("SHOW TABLES", 0) as $table) { |
|
64 | 64 | if ($table == $table_name) { |
65 | 65 | return true; |
66 | 66 | } |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | } |
70 | 70 | endif; |
71 | 71 | |
72 | -if ( ! function_exists('maybe_add_column') ) : |
|
72 | +if ( ! function_exists('maybe_add_column')) : |
|
73 | 73 | /** |
74 | 74 | * Add column to database table, if column doesn't already exist in table. |
75 | 75 | * |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | */ |
85 | 85 | function maybe_add_column($table_name, $column_name, $create_ddl) { |
86 | 86 | global $wpdb; |
87 | - foreach ($wpdb->get_col("DESC $table_name",0) as $column ) { |
|
87 | + foreach ($wpdb->get_col("DESC $table_name", 0) as $column) { |
|
88 | 88 | |
89 | 89 | if ($column == $column_name) { |
90 | 90 | return true; |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | $wpdb->query($create_ddl); |
96 | 96 | |
97 | 97 | // We cannot directly tell that whether this succeeded! |
98 | - foreach ($wpdb->get_col("DESC $table_name",0) as $column ) { |
|
98 | + foreach ($wpdb->get_col("DESC $table_name", 0) as $column) { |
|
99 | 99 | if ($column == $column_name) { |
100 | 100 | return true; |
101 | 101 | } |
@@ -118,14 +118,14 @@ discard block |
||
118 | 118 | */ |
119 | 119 | function maybe_drop_column($table_name, $column_name, $drop_ddl) { |
120 | 120 | global $wpdb; |
121 | - foreach ($wpdb->get_col("DESC $table_name",0) as $column ) { |
|
121 | + foreach ($wpdb->get_col("DESC $table_name", 0) as $column) { |
|
122 | 122 | if ($column == $column_name) { |
123 | 123 | |
124 | 124 | // Found it, so try to drop it. |
125 | 125 | $wpdb->query($drop_ddl); |
126 | 126 | |
127 | 127 | // We cannot directly tell that whether this succeeded! |
128 | - foreach ($wpdb->get_col("DESC $table_name",0) as $column ) { |
|
128 | + foreach ($wpdb->get_col("DESC $table_name", 0) as $column) { |
|
129 | 129 | if ($column == $column_name) { |
130 | 130 | return false; |
131 | 131 | } |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | $diffs = 0; |
171 | 171 | $results = $wpdb->get_results("DESC $table_name"); |
172 | 172 | |
173 | - foreach ($results as $row ) { |
|
173 | + foreach ($results as $row) { |
|
174 | 174 | |
175 | 175 | if ($row->Field == $col_name) { |
176 | 176 | |
@@ -181,7 +181,7 @@ discard block |
||
181 | 181 | if (($is_null != null) && ($row->Null != $is_null)) { |
182 | 182 | ++$diffs; |
183 | 183 | } |
184 | - if (($key != null) && ($row->Key != $key)) { |
|
184 | + if (($key != null) && ($row->Key != $key)) { |
|
185 | 185 | ++$diffs; |
186 | 186 | } |
187 | 187 | if (($default != null) && ($row->Default != $default)) { |
@@ -1,10 +1,10 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * Plugins administration panel. |
|
4 | - * |
|
5 | - * @package WordPress |
|
6 | - * @subpackage Administration |
|
7 | - */ |
|
3 | + * Plugins administration panel. |
|
4 | + * |
|
5 | + * @package WordPress |
|
6 | + * @subpackage Administration |
|
7 | + */ |
|
8 | 8 | |
9 | 9 | /** WordPress Administration Bootstrap */ |
10 | 10 | require_once( dirname( __FILE__ ) . '/admin.php' ); |
@@ -456,17 +456,17 @@ discard block |
||
456 | 456 | |
457 | 457 | <?php |
458 | 458 | /** |
459 | - * Fires before the plugins list table is rendered. |
|
460 | - * |
|
461 | - * This hook also fires before the plugins list table is rendered in the Network Admin. |
|
462 | - * |
|
463 | - * Please note: The 'active' portion of the hook name does not refer to whether the current |
|
464 | - * view is for active plugins, but rather all plugins actively-installed. |
|
465 | - * |
|
466 | - * @since 3.0.0 |
|
467 | - * |
|
468 | - * @param array $plugins_all An array containing all installed plugins. |
|
469 | - */ |
|
459 | + * Fires before the plugins list table is rendered. |
|
460 | + * |
|
461 | + * This hook also fires before the plugins list table is rendered in the Network Admin. |
|
462 | + * |
|
463 | + * Please note: The 'active' portion of the hook name does not refer to whether the current |
|
464 | + * view is for active plugins, but rather all plugins actively-installed. |
|
465 | + * |
|
466 | + * @since 3.0.0 |
|
467 | + * |
|
468 | + * @param array $plugins_all An array containing all installed plugins. |
|
469 | + */ |
|
470 | 470 | do_action( 'pre_current_active_plugins', $plugins['all'] ); |
471 | 471 | ?> |
472 | 472 |
@@ -7,10 +7,10 @@ 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 | -if ( ! current_user_can('activate_plugins') ) |
|
13 | - wp_die( __( 'You do not have sufficient permissions to manage plugins for this site.' ) ); |
|
12 | +if ( ! current_user_can('activate_plugins')) |
|
13 | + wp_die(__('You do not have sufficient permissions to manage plugins for this site.')); |
|
14 | 14 | |
15 | 15 | $wp_list_table = _get_list_table('WP_Plugins_List_Table'); |
16 | 16 | $pagenum = $wp_list_table->get_pagenum(); |
@@ -23,127 +23,127 @@ discard block |
||
23 | 23 | // Clean up request URI from temporary args for screen options/paging uri's to work as expected. |
24 | 24 | $_SERVER['REQUEST_URI'] = remove_query_arg(array('error', 'deleted', 'activate', 'activate-multi', 'deactivate', 'deactivate-multi', '_error_nonce'), $_SERVER['REQUEST_URI']); |
25 | 25 | |
26 | -wp_enqueue_script( 'updates' ); |
|
26 | +wp_enqueue_script('updates'); |
|
27 | 27 | |
28 | -if ( $action ) { |
|
28 | +if ($action) { |
|
29 | 29 | |
30 | - switch ( $action ) { |
|
30 | + switch ($action) { |
|
31 | 31 | case 'activate': |
32 | - if ( ! current_user_can('activate_plugins') ) |
|
32 | + if ( ! current_user_can('activate_plugins')) |
|
33 | 33 | wp_die(__('You do not have sufficient permissions to activate plugins for this site.')); |
34 | 34 | |
35 | - if ( is_multisite() && ! is_network_admin() && is_network_only_plugin( $plugin ) ) { |
|
36 | - wp_redirect( self_admin_url("plugins.php?plugin_status=$status&paged=$page&s=$s") ); |
|
35 | + if (is_multisite() && ! is_network_admin() && is_network_only_plugin($plugin)) { |
|
36 | + wp_redirect(self_admin_url("plugins.php?plugin_status=$status&paged=$page&s=$s")); |
|
37 | 37 | exit; |
38 | 38 | } |
39 | 39 | |
40 | - check_admin_referer('activate-plugin_' . $plugin); |
|
40 | + check_admin_referer('activate-plugin_'.$plugin); |
|
41 | 41 | |
42 | - $result = activate_plugin($plugin, self_admin_url('plugins.php?error=true&plugin=' . $plugin), is_network_admin() ); |
|
43 | - if ( is_wp_error( $result ) ) { |
|
44 | - if ( 'unexpected_output' == $result->get_error_code() ) { |
|
45 | - $redirect = self_admin_url('plugins.php?error=true&charsout=' . strlen($result->get_error_data()) . '&plugin=' . $plugin . "&plugin_status=$status&paged=$page&s=$s"); |
|
46 | - wp_redirect(add_query_arg('_error_nonce', wp_create_nonce('plugin-activation-error_' . $plugin), $redirect)); |
|
42 | + $result = activate_plugin($plugin, self_admin_url('plugins.php?error=true&plugin='.$plugin), is_network_admin()); |
|
43 | + if (is_wp_error($result)) { |
|
44 | + if ('unexpected_output' == $result->get_error_code()) { |
|
45 | + $redirect = self_admin_url('plugins.php?error=true&charsout='.strlen($result->get_error_data()).'&plugin='.$plugin."&plugin_status=$status&paged=$page&s=$s"); |
|
46 | + wp_redirect(add_query_arg('_error_nonce', wp_create_nonce('plugin-activation-error_'.$plugin), $redirect)); |
|
47 | 47 | exit; |
48 | 48 | } else { |
49 | 49 | wp_die($result); |
50 | 50 | } |
51 | 51 | } |
52 | 52 | |
53 | - if ( ! is_network_admin() ) { |
|
54 | - $recent = (array) get_option( 'recently_activated' ); |
|
55 | - unset( $recent[ $plugin ] ); |
|
56 | - update_option( 'recently_activated', $recent ); |
|
53 | + if ( ! is_network_admin()) { |
|
54 | + $recent = (array) get_option('recently_activated'); |
|
55 | + unset($recent[$plugin]); |
|
56 | + update_option('recently_activated', $recent); |
|
57 | 57 | } |
58 | 58 | |
59 | - if ( isset($_GET['from']) && 'import' == $_GET['from'] ) { |
|
60 | - wp_redirect( self_admin_url("import.php?import=" . str_replace('-importer', '', dirname($plugin))) ); // overrides the ?error=true one above and redirects to the Imports page, stripping the -importer suffix |
|
59 | + if (isset($_GET['from']) && 'import' == $_GET['from']) { |
|
60 | + wp_redirect(self_admin_url("import.php?import=".str_replace('-importer', '', dirname($plugin)))); // overrides the ?error=true one above and redirects to the Imports page, stripping the -importer suffix |
|
61 | 61 | } else { |
62 | - wp_redirect( self_admin_url("plugins.php?activate=true&plugin_status=$status&paged=$page&s=$s") ); // overrides the ?error=true one above |
|
62 | + wp_redirect(self_admin_url("plugins.php?activate=true&plugin_status=$status&paged=$page&s=$s")); // overrides the ?error=true one above |
|
63 | 63 | } |
64 | 64 | exit; |
65 | 65 | |
66 | 66 | case 'activate-selected': |
67 | - if ( ! current_user_can('activate_plugins') ) |
|
67 | + if ( ! current_user_can('activate_plugins')) |
|
68 | 68 | wp_die(__('You do not have sufficient permissions to activate plugins for this site.')); |
69 | 69 | |
70 | 70 | check_admin_referer('bulk-plugins'); |
71 | 71 | |
72 | - $plugins = isset( $_POST['checked'] ) ? (array) $_POST['checked'] : array(); |
|
72 | + $plugins = isset($_POST['checked']) ? (array) $_POST['checked'] : array(); |
|
73 | 73 | |
74 | - if ( is_network_admin() ) { |
|
75 | - foreach ( $plugins as $i => $plugin ) { |
|
74 | + if (is_network_admin()) { |
|
75 | + foreach ($plugins as $i => $plugin) { |
|
76 | 76 | // Only activate plugins which are not already network activated. |
77 | - if ( is_plugin_active_for_network( $plugin ) ) { |
|
78 | - unset( $plugins[ $i ] ); |
|
77 | + if (is_plugin_active_for_network($plugin)) { |
|
78 | + unset($plugins[$i]); |
|
79 | 79 | } |
80 | 80 | } |
81 | 81 | } else { |
82 | - foreach ( $plugins as $i => $plugin ) { |
|
82 | + foreach ($plugins as $i => $plugin) { |
|
83 | 83 | // Only activate plugins which are not already active and are not network-only when on Multisite. |
84 | - if ( is_plugin_active( $plugin ) || ( is_multisite() && is_network_only_plugin( $plugin ) ) ) { |
|
85 | - unset( $plugins[ $i ] ); |
|
84 | + if (is_plugin_active($plugin) || (is_multisite() && is_network_only_plugin($plugin))) { |
|
85 | + unset($plugins[$i]); |
|
86 | 86 | } |
87 | 87 | } |
88 | 88 | } |
89 | 89 | |
90 | - if ( empty($plugins) ) { |
|
91 | - wp_redirect( self_admin_url("plugins.php?plugin_status=$status&paged=$page&s=$s") ); |
|
90 | + if (empty($plugins)) { |
|
91 | + wp_redirect(self_admin_url("plugins.php?plugin_status=$status&paged=$page&s=$s")); |
|
92 | 92 | exit; |
93 | 93 | } |
94 | 94 | |
95 | - activate_plugins($plugins, self_admin_url('plugins.php?error=true'), is_network_admin() ); |
|
95 | + activate_plugins($plugins, self_admin_url('plugins.php?error=true'), is_network_admin()); |
|
96 | 96 | |
97 | - if ( ! is_network_admin() ) { |
|
98 | - $recent = (array) get_option('recently_activated' ); |
|
99 | - foreach ( $plugins as $plugin ) |
|
100 | - unset( $recent[ $plugin ] ); |
|
101 | - update_option( 'recently_activated', $recent ); |
|
97 | + if ( ! is_network_admin()) { |
|
98 | + $recent = (array) get_option('recently_activated'); |
|
99 | + foreach ($plugins as $plugin) |
|
100 | + unset($recent[$plugin]); |
|
101 | + update_option('recently_activated', $recent); |
|
102 | 102 | } |
103 | 103 | |
104 | - wp_redirect( self_admin_url("plugins.php?activate-multi=true&plugin_status=$status&paged=$page&s=$s") ); |
|
104 | + wp_redirect(self_admin_url("plugins.php?activate-multi=true&plugin_status=$status&paged=$page&s=$s")); |
|
105 | 105 | exit; |
106 | 106 | |
107 | 107 | case 'update-selected' : |
108 | 108 | |
109 | - check_admin_referer( 'bulk-plugins' ); |
|
109 | + check_admin_referer('bulk-plugins'); |
|
110 | 110 | |
111 | - if ( isset( $_GET['plugins'] ) ) |
|
112 | - $plugins = explode( ',', $_GET['plugins'] ); |
|
113 | - elseif ( isset( $_POST['checked'] ) ) |
|
111 | + if (isset($_GET['plugins'])) |
|
112 | + $plugins = explode(',', $_GET['plugins']); |
|
113 | + elseif (isset($_POST['checked'])) |
|
114 | 114 | $plugins = (array) $_POST['checked']; |
115 | 115 | else |
116 | 116 | $plugins = array(); |
117 | 117 | |
118 | - $title = __( 'Update Plugins' ); |
|
118 | + $title = __('Update Plugins'); |
|
119 | 119 | $parent_file = 'plugins.php'; |
120 | 120 | |
121 | - wp_enqueue_script( 'updates' ); |
|
122 | - require_once(ABSPATH . 'wp-admin/admin-header.php'); |
|
121 | + wp_enqueue_script('updates'); |
|
122 | + require_once(ABSPATH.'wp-admin/admin-header.php'); |
|
123 | 123 | |
124 | 124 | echo '<div class="wrap">'; |
125 | - echo '<h1>' . esc_html( $title ) . '</h1>'; |
|
125 | + echo '<h1>'.esc_html($title).'</h1>'; |
|
126 | 126 | |
127 | - $url = self_admin_url('update.php?action=update-selected&plugins=' . urlencode( join(',', $plugins) )); |
|
127 | + $url = self_admin_url('update.php?action=update-selected&plugins='.urlencode(join(',', $plugins))); |
|
128 | 128 | $url = wp_nonce_url($url, 'bulk-update-plugins'); |
129 | 129 | |
130 | 130 | echo "<iframe src='$url' style='width: 100%; height:100%; min-height:850px;'></iframe>"; |
131 | 131 | echo '</div>'; |
132 | - require_once(ABSPATH . 'wp-admin/admin-footer.php'); |
|
132 | + require_once(ABSPATH.'wp-admin/admin-footer.php'); |
|
133 | 133 | exit; |
134 | 134 | |
135 | 135 | case 'error_scrape': |
136 | - if ( ! current_user_can('activate_plugins') ) |
|
136 | + if ( ! current_user_can('activate_plugins')) |
|
137 | 137 | wp_die(__('You do not have sufficient permissions to activate plugins for this site.')); |
138 | 138 | |
139 | - check_admin_referer('plugin-activation-error_' . $plugin); |
|
139 | + check_admin_referer('plugin-activation-error_'.$plugin); |
|
140 | 140 | |
141 | 141 | $valid = validate_plugin($plugin); |
142 | - if ( is_wp_error($valid) ) |
|
142 | + if (is_wp_error($valid)) |
|
143 | 143 | wp_die($valid); |
144 | 144 | |
145 | - if ( ! WP_DEBUG ) { |
|
146 | - error_reporting( E_CORE_ERROR | E_CORE_WARNING | E_COMPILE_ERROR | E_ERROR | E_WARNING | E_PARSE | E_USER_ERROR | E_USER_WARNING | E_RECOVERABLE_ERROR ); |
|
145 | + if ( ! WP_DEBUG) { |
|
146 | + error_reporting(E_CORE_ERROR | E_CORE_WARNING | E_COMPILE_ERROR | E_ERROR | E_WARNING | E_PARSE | E_USER_ERROR | E_USER_WARNING | E_RECOVERABLE_ERROR); |
|
147 | 147 | } |
148 | 148 | |
149 | 149 | @ini_set('display_errors', true); //Ensure that Fatal errors are displayed. |
@@ -151,172 +151,172 @@ discard block |
||
151 | 151 | /** |
152 | 152 | * @param string $plugin |
153 | 153 | */ |
154 | - function plugin_sandbox_scrape( $plugin ) { |
|
155 | - wp_register_plugin_realpath( WP_PLUGIN_DIR . '/' . $plugin ); |
|
156 | - include( WP_PLUGIN_DIR . '/' . $plugin ); |
|
154 | + function plugin_sandbox_scrape($plugin) { |
|
155 | + wp_register_plugin_realpath(WP_PLUGIN_DIR.'/'.$plugin); |
|
156 | + include(WP_PLUGIN_DIR.'/'.$plugin); |
|
157 | 157 | } |
158 | - plugin_sandbox_scrape( $plugin ); |
|
158 | + plugin_sandbox_scrape($plugin); |
|
159 | 159 | /** This action is documented in wp-admin/includes/plugin.php */ |
160 | - do_action( "activate_{$plugin}" ); |
|
160 | + do_action("activate_{$plugin}"); |
|
161 | 161 | exit; |
162 | 162 | |
163 | 163 | case 'deactivate': |
164 | - if ( ! current_user_can('activate_plugins') ) |
|
164 | + if ( ! current_user_can('activate_plugins')) |
|
165 | 165 | wp_die(__('You do not have sufficient permissions to deactivate plugins for this site.')); |
166 | 166 | |
167 | - check_admin_referer('deactivate-plugin_' . $plugin); |
|
167 | + check_admin_referer('deactivate-plugin_'.$plugin); |
|
168 | 168 | |
169 | - if ( ! is_network_admin() && is_plugin_active_for_network( $plugin ) ) { |
|
170 | - wp_redirect( self_admin_url("plugins.php?plugin_status=$status&paged=$page&s=$s") ); |
|
169 | + if ( ! is_network_admin() && is_plugin_active_for_network($plugin)) { |
|
170 | + wp_redirect(self_admin_url("plugins.php?plugin_status=$status&paged=$page&s=$s")); |
|
171 | 171 | exit; |
172 | 172 | } |
173 | 173 | |
174 | - deactivate_plugins( $plugin, false, is_network_admin() ); |
|
175 | - if ( ! is_network_admin() ) |
|
176 | - update_option( 'recently_activated', array( $plugin => time() ) + (array) get_option( 'recently_activated' ) ); |
|
177 | - if ( headers_sent() ) |
|
178 | - echo "<meta http-equiv='refresh' content='" . esc_attr( "0;url=plugins.php?deactivate=true&plugin_status=$status&paged=$page&s=$s" ) . "' />"; |
|
174 | + deactivate_plugins($plugin, false, is_network_admin()); |
|
175 | + if ( ! is_network_admin()) |
|
176 | + update_option('recently_activated', array($plugin => time()) + (array) get_option('recently_activated')); |
|
177 | + if (headers_sent()) |
|
178 | + echo "<meta http-equiv='refresh' content='".esc_attr("0;url=plugins.php?deactivate=true&plugin_status=$status&paged=$page&s=$s")."' />"; |
|
179 | 179 | else |
180 | - wp_redirect( self_admin_url("plugins.php?deactivate=true&plugin_status=$status&paged=$page&s=$s") ); |
|
180 | + wp_redirect(self_admin_url("plugins.php?deactivate=true&plugin_status=$status&paged=$page&s=$s")); |
|
181 | 181 | exit; |
182 | 182 | |
183 | 183 | case 'deactivate-selected': |
184 | - if ( ! current_user_can('activate_plugins') ) |
|
184 | + if ( ! current_user_can('activate_plugins')) |
|
185 | 185 | wp_die(__('You do not have sufficient permissions to deactivate plugins for this site.')); |
186 | 186 | |
187 | 187 | check_admin_referer('bulk-plugins'); |
188 | 188 | |
189 | - $plugins = isset( $_POST['checked'] ) ? (array) $_POST['checked'] : array(); |
|
189 | + $plugins = isset($_POST['checked']) ? (array) $_POST['checked'] : array(); |
|
190 | 190 | // Do not deactivate plugins which are already deactivated. |
191 | - if ( is_network_admin() ) { |
|
192 | - $plugins = array_filter( $plugins, 'is_plugin_active_for_network' ); |
|
191 | + if (is_network_admin()) { |
|
192 | + $plugins = array_filter($plugins, 'is_plugin_active_for_network'); |
|
193 | 193 | } else { |
194 | - $plugins = array_filter( $plugins, 'is_plugin_active' ); |
|
195 | - $plugins = array_diff( $plugins, array_filter( $plugins, 'is_plugin_active_for_network' ) ); |
|
194 | + $plugins = array_filter($plugins, 'is_plugin_active'); |
|
195 | + $plugins = array_diff($plugins, array_filter($plugins, 'is_plugin_active_for_network')); |
|
196 | 196 | } |
197 | - if ( empty($plugins) ) { |
|
198 | - wp_redirect( self_admin_url("plugins.php?plugin_status=$status&paged=$page&s=$s") ); |
|
197 | + if (empty($plugins)) { |
|
198 | + wp_redirect(self_admin_url("plugins.php?plugin_status=$status&paged=$page&s=$s")); |
|
199 | 199 | exit; |
200 | 200 | } |
201 | 201 | |
202 | - deactivate_plugins( $plugins, false, is_network_admin() ); |
|
202 | + deactivate_plugins($plugins, false, is_network_admin()); |
|
203 | 203 | |
204 | - if ( ! is_network_admin() ) { |
|
204 | + if ( ! is_network_admin()) { |
|
205 | 205 | $deactivated = array(); |
206 | - foreach ( $plugins as $plugin ) |
|
207 | - $deactivated[ $plugin ] = time(); |
|
208 | - update_option( 'recently_activated', $deactivated + (array) get_option( 'recently_activated' ) ); |
|
206 | + foreach ($plugins as $plugin) |
|
207 | + $deactivated[$plugin] = time(); |
|
208 | + update_option('recently_activated', $deactivated + (array) get_option('recently_activated')); |
|
209 | 209 | } |
210 | 210 | |
211 | - wp_redirect( self_admin_url("plugins.php?deactivate-multi=true&plugin_status=$status&paged=$page&s=$s") ); |
|
211 | + wp_redirect(self_admin_url("plugins.php?deactivate-multi=true&plugin_status=$status&paged=$page&s=$s")); |
|
212 | 212 | exit; |
213 | 213 | |
214 | 214 | case 'delete-selected': |
215 | - if ( ! current_user_can('delete_plugins') ) { |
|
215 | + if ( ! current_user_can('delete_plugins')) { |
|
216 | 216 | wp_die(__('You do not have sufficient permissions to delete plugins for this site.')); |
217 | 217 | } |
218 | 218 | |
219 | 219 | check_admin_referer('bulk-plugins'); |
220 | 220 | |
221 | 221 | //$_POST = from the plugin form; $_GET = from the FTP details screen. |
222 | - $plugins = isset( $_REQUEST['checked'] ) ? (array) $_REQUEST['checked'] : array(); |
|
223 | - if ( empty( $plugins ) ) { |
|
224 | - wp_redirect( self_admin_url("plugins.php?plugin_status=$status&paged=$page&s=$s") ); |
|
222 | + $plugins = isset($_REQUEST['checked']) ? (array) $_REQUEST['checked'] : array(); |
|
223 | + if (empty($plugins)) { |
|
224 | + wp_redirect(self_admin_url("plugins.php?plugin_status=$status&paged=$page&s=$s")); |
|
225 | 225 | exit; |
226 | 226 | } |
227 | 227 | |
228 | 228 | $plugins = array_filter($plugins, 'is_plugin_inactive'); // Do not allow to delete Activated plugins. |
229 | - if ( empty( $plugins ) ) { |
|
230 | - wp_redirect( self_admin_url( "plugins.php?error=true&main=true&plugin_status=$status&paged=$page&s=$s" ) ); |
|
229 | + if (empty($plugins)) { |
|
230 | + wp_redirect(self_admin_url("plugins.php?error=true&main=true&plugin_status=$status&paged=$page&s=$s")); |
|
231 | 231 | exit; |
232 | 232 | } |
233 | 233 | |
234 | - include(ABSPATH . 'wp-admin/update.php'); |
|
234 | + include(ABSPATH.'wp-admin/update.php'); |
|
235 | 235 | |
236 | 236 | $parent_file = 'plugins.php'; |
237 | 237 | |
238 | - if ( ! isset($_REQUEST['verify-delete']) ) { |
|
238 | + if ( ! isset($_REQUEST['verify-delete'])) { |
|
239 | 239 | wp_enqueue_script('jquery'); |
240 | - require_once(ABSPATH . 'wp-admin/admin-header.php'); |
|
240 | + require_once(ABSPATH.'wp-admin/admin-header.php'); |
|
241 | 241 | ?> |
242 | 242 | <div class="wrap"> |
243 | 243 | <?php |
244 | 244 | $files_to_delete = $plugin_info = array(); |
245 | 245 | $have_non_network_plugins = false; |
246 | - $plugin_translations = wp_get_installed_translations( 'plugins' ); |
|
247 | - foreach ( (array) $plugins as $plugin ) { |
|
248 | - $plugin_slug = dirname( $plugin ); |
|
249 | - |
|
250 | - if ( '.' == $plugin_slug ) { |
|
251 | - $files_to_delete[] = WP_PLUGIN_DIR . '/' . $plugin; |
|
252 | - if ( $data = get_plugin_data( WP_PLUGIN_DIR . '/' . $plugin ) ) { |
|
253 | - $plugin_info[ $plugin ] = $data; |
|
254 | - $plugin_info[ $plugin ]['is_uninstallable'] = is_uninstallable_plugin( $plugin ); |
|
255 | - if ( ! $plugin_info[ $plugin ]['Network'] ) { |
|
246 | + $plugin_translations = wp_get_installed_translations('plugins'); |
|
247 | + foreach ((array) $plugins as $plugin) { |
|
248 | + $plugin_slug = dirname($plugin); |
|
249 | + |
|
250 | + if ('.' == $plugin_slug) { |
|
251 | + $files_to_delete[] = WP_PLUGIN_DIR.'/'.$plugin; |
|
252 | + if ($data = get_plugin_data(WP_PLUGIN_DIR.'/'.$plugin)) { |
|
253 | + $plugin_info[$plugin] = $data; |
|
254 | + $plugin_info[$plugin]['is_uninstallable'] = is_uninstallable_plugin($plugin); |
|
255 | + if ( ! $plugin_info[$plugin]['Network']) { |
|
256 | 256 | $have_non_network_plugins = true; |
257 | 257 | } |
258 | 258 | } |
259 | 259 | } else { |
260 | 260 | // Locate all the files in that folder. |
261 | - $files = list_files( WP_PLUGIN_DIR . '/' . $plugin_slug ); |
|
262 | - if ( $files ) { |
|
263 | - $files_to_delete = array_merge( $files_to_delete, $files ); |
|
261 | + $files = list_files(WP_PLUGIN_DIR.'/'.$plugin_slug); |
|
262 | + if ($files) { |
|
263 | + $files_to_delete = array_merge($files_to_delete, $files); |
|
264 | 264 | } |
265 | 265 | |
266 | 266 | // Get plugins list from that folder. |
267 | - if ( $folder_plugins = get_plugins( '/' . $plugin_slug ) ) { |
|
268 | - foreach( $folder_plugins as $plugin_file => $data ) { |
|
269 | - $plugin_info[ $plugin_file ] = _get_plugin_data_markup_translate( $plugin_file, $data ); |
|
270 | - $plugin_info[ $plugin_file ]['is_uninstallable'] = is_uninstallable_plugin( $plugin ); |
|
271 | - if ( ! $plugin_info[ $plugin_file ]['Network'] ) { |
|
267 | + if ($folder_plugins = get_plugins('/'.$plugin_slug)) { |
|
268 | + foreach ($folder_plugins as $plugin_file => $data) { |
|
269 | + $plugin_info[$plugin_file] = _get_plugin_data_markup_translate($plugin_file, $data); |
|
270 | + $plugin_info[$plugin_file]['is_uninstallable'] = is_uninstallable_plugin($plugin); |
|
271 | + if ( ! $plugin_info[$plugin_file]['Network']) { |
|
272 | 272 | $have_non_network_plugins = true; |
273 | 273 | } |
274 | 274 | } |
275 | 275 | } |
276 | 276 | |
277 | 277 | // Add translation files. |
278 | - if ( ! empty( $plugin_translations[ $plugin_slug ] ) ) { |
|
279 | - $translations = $plugin_translations[ $plugin_slug ]; |
|
278 | + if ( ! empty($plugin_translations[$plugin_slug])) { |
|
279 | + $translations = $plugin_translations[$plugin_slug]; |
|
280 | 280 | |
281 | - foreach ( $translations as $translation => $data ) { |
|
282 | - $files_to_delete[] = $plugin_slug . '-' . $translation . '.po'; |
|
283 | - $files_to_delete[] = $plugin_slug . '-' . $translation . '.mo'; |
|
281 | + foreach ($translations as $translation => $data) { |
|
282 | + $files_to_delete[] = $plugin_slug.'-'.$translation.'.po'; |
|
283 | + $files_to_delete[] = $plugin_slug.'-'.$translation.'.mo'; |
|
284 | 284 | } |
285 | 285 | } |
286 | 286 | } |
287 | 287 | } |
288 | - $plugins_to_delete = count( $plugin_info ); |
|
288 | + $plugins_to_delete = count($plugin_info); |
|
289 | 289 | ?> |
290 | - <?php if ( 1 == $plugins_to_delete ) : ?> |
|
291 | - <h1><?php _e( 'Delete Plugin' ); ?></h1> |
|
292 | - <?php if ( $have_non_network_plugins && is_network_admin() ) : ?> |
|
293 | - <div class="error"><p><strong><?php _e( 'Caution:' ); ?></strong> <?php _e( 'This plugin may be active on other sites in the network.' ); ?></p></div> |
|
290 | + <?php if (1 == $plugins_to_delete) : ?> |
|
291 | + <h1><?php _e('Delete Plugin'); ?></h1> |
|
292 | + <?php if ($have_non_network_plugins && is_network_admin()) : ?> |
|
293 | + <div class="error"><p><strong><?php _e('Caution:'); ?></strong> <?php _e('This plugin may be active on other sites in the network.'); ?></p></div> |
|
294 | 294 | <?php endif; ?> |
295 | - <p><?php _e( 'You are about to remove the following plugin:' ); ?></p> |
|
295 | + <p><?php _e('You are about to remove the following plugin:'); ?></p> |
|
296 | 296 | <?php else: ?> |
297 | - <h1><?php _e( 'Delete Plugins' ); ?></h1> |
|
298 | - <?php if ( $have_non_network_plugins && is_network_admin() ) : ?> |
|
299 | - <div class="error"><p><strong><?php _e( 'Caution:' ); ?></strong> <?php _e( 'These plugins may be active on other sites in the network.' ); ?></p></div> |
|
297 | + <h1><?php _e('Delete Plugins'); ?></h1> |
|
298 | + <?php if ($have_non_network_plugins && is_network_admin()) : ?> |
|
299 | + <div class="error"><p><strong><?php _e('Caution:'); ?></strong> <?php _e('These plugins may be active on other sites in the network.'); ?></p></div> |
|
300 | 300 | <?php endif; ?> |
301 | - <p><?php _e( 'You are about to remove the following plugins:' ); ?></p> |
|
301 | + <p><?php _e('You are about to remove the following plugins:'); ?></p> |
|
302 | 302 | <?php endif; ?> |
303 | 303 | <ul class="ul-disc"> |
304 | 304 | <?php |
305 | 305 | $data_to_delete = false; |
306 | - foreach ( $plugin_info as $plugin ) { |
|
307 | - if ( $plugin['is_uninstallable'] ) { |
|
306 | + foreach ($plugin_info as $plugin) { |
|
307 | + if ($plugin['is_uninstallable']) { |
|
308 | 308 | /* translators: 1: plugin name, 2: plugin author */ |
309 | - echo '<li>', sprintf( __( '<strong>%1$s</strong> by <em>%2$s</em> (will also <strong>delete its data</strong>)' ), esc_html($plugin['Name']), esc_html($plugin['AuthorName']) ), '</li>'; |
|
309 | + echo '<li>', sprintf(__('<strong>%1$s</strong> by <em>%2$s</em> (will also <strong>delete its data</strong>)'), esc_html($plugin['Name']), esc_html($plugin['AuthorName'])), '</li>'; |
|
310 | 310 | $data_to_delete = true; |
311 | 311 | } else { |
312 | 312 | /* translators: 1: plugin name, 2: plugin author */ |
313 | - echo '<li>', sprintf( __('<strong>%1$s</strong> by <em>%2$s</em>' ), esc_html($plugin['Name']), esc_html($plugin['AuthorName']) ), '</li>'; |
|
313 | + echo '<li>', sprintf(__('<strong>%1$s</strong> by <em>%2$s</em>'), esc_html($plugin['Name']), esc_html($plugin['AuthorName'])), '</li>'; |
|
314 | 314 | } |
315 | 315 | } |
316 | 316 | ?> |
317 | 317 | </ul> |
318 | 318 | <p><?php |
319 | - if ( $data_to_delete ) |
|
319 | + if ($data_to_delete) |
|
320 | 320 | _e('Are you sure you wish to delete these files and data?'); |
321 | 321 | else |
322 | 322 | _e('Are you sure you wish to delete these files?'); |
@@ -325,44 +325,44 @@ discard block |
||
325 | 325 | <input type="hidden" name="verify-delete" value="1" /> |
326 | 326 | <input type="hidden" name="action" value="delete-selected" /> |
327 | 327 | <?php |
328 | - foreach ( (array) $plugins as $plugin ) { |
|
329 | - echo '<input type="hidden" name="checked[]" value="' . esc_attr( $plugin ) . '" />'; |
|
328 | + foreach ((array) $plugins as $plugin) { |
|
329 | + echo '<input type="hidden" name="checked[]" value="'.esc_attr($plugin).'" />'; |
|
330 | 330 | } |
331 | 331 | ?> |
332 | 332 | <?php wp_nonce_field('bulk-plugins') ?> |
333 | - <?php submit_button( $data_to_delete ? __( 'Yes, delete these files and data' ) : __( 'Yes, delete these files' ), 'button', 'submit', false ); ?> |
|
333 | + <?php submit_button($data_to_delete ? __('Yes, delete these files and data') : __('Yes, delete these files'), 'button', 'submit', false); ?> |
|
334 | 334 | </form> |
335 | 335 | <?php |
336 | 336 | $referer = wp_get_referer(); |
337 | 337 | ?> |
338 | - <form method="post" action="<?php echo $referer ? esc_url( $referer ) : ''; ?>" style="display:inline;"> |
|
339 | - <?php submit_button( __( 'No, return me to the plugin list' ), 'button', 'submit', false ); ?> |
|
338 | + <form method="post" action="<?php echo $referer ? esc_url($referer) : ''; ?>" style="display:inline;"> |
|
339 | + <?php submit_button(__('No, return me to the plugin list'), 'button', 'submit', false); ?> |
|
340 | 340 | </form> |
341 | 341 | |
342 | 342 | <p><a href="#" onclick="jQuery('#files-list').toggle(); return false;"><?php _e('Click to view entire list of files which will be deleted'); ?></a></p> |
343 | 343 | <div id="files-list" style="display:none;"> |
344 | 344 | <ul class="code"> |
345 | 345 | <?php |
346 | - foreach ( (array) $files_to_delete as $file ) { |
|
347 | - echo '<li>' . esc_html( str_replace( WP_PLUGIN_DIR, '', $file ) ) . '</li>'; |
|
346 | + foreach ((array) $files_to_delete as $file) { |
|
347 | + echo '<li>'.esc_html(str_replace(WP_PLUGIN_DIR, '', $file)).'</li>'; |
|
348 | 348 | } |
349 | 349 | ?> |
350 | 350 | </ul> |
351 | 351 | </div> |
352 | 352 | </div> |
353 | 353 | <?php |
354 | - require_once(ABSPATH . 'wp-admin/admin-footer.php'); |
|
354 | + require_once(ABSPATH.'wp-admin/admin-footer.php'); |
|
355 | 355 | exit; |
356 | 356 | } //Endif verify-delete |
357 | 357 | $delete_result = delete_plugins($plugins); |
358 | 358 | |
359 | - set_transient('plugins_delete_result_' . $user_ID, $delete_result); //Store the result in a cache rather than a URL param due to object type & length |
|
360 | - wp_redirect( self_admin_url("plugins.php?deleted=true&plugin_status=$status&paged=$page&s=$s") ); |
|
359 | + set_transient('plugins_delete_result_'.$user_ID, $delete_result); //Store the result in a cache rather than a URL param due to object type & length |
|
360 | + wp_redirect(self_admin_url("plugins.php?deleted=true&plugin_status=$status&paged=$page&s=$s")); |
|
361 | 361 | exit; |
362 | 362 | |
363 | 363 | case 'clear-recent-list': |
364 | - if ( ! is_network_admin() ) |
|
365 | - update_option( 'recently_activated', array() ); |
|
364 | + if ( ! is_network_admin()) |
|
365 | + update_option('recently_activated', array()); |
|
366 | 366 | break; |
367 | 367 | } |
368 | 368 | } |
@@ -372,86 +372,86 @@ discard block |
||
372 | 372 | wp_enqueue_script('plugin-install'); |
373 | 373 | add_thickbox(); |
374 | 374 | |
375 | -add_screen_option( 'per_page', array( 'default' => 999 ) ); |
|
375 | +add_screen_option('per_page', array('default' => 999)); |
|
376 | 376 | |
377 | -get_current_screen()->add_help_tab( array( |
|
377 | +get_current_screen()->add_help_tab(array( |
|
378 | 378 | 'id' => 'overview', |
379 | 379 | 'title' => __('Overview'), |
380 | 380 | 'content' => |
381 | - '<p>' . __('Plugins extend and expand the functionality of WordPress. Once a plugin is installed, you may activate it or deactivate it here.') . '</p>' . |
|
382 | - '<p>' . sprintf(__('You can find additional plugins for your site by using the <a href="%1$s">Plugin Browser/Installer</a> functionality or by browsing the <a href="%2$s" target="_blank">WordPress Plugin Directory</a> directly and installing new plugins manually. To manually install a plugin you generally just need to upload the plugin file into your <code>/wp-content/plugins</code> directory. Once a plugin has been installed, you can activate it here.'), 'plugin-install.php', 'https://wordpress.org/plugins/') . '</p>' |
|
383 | -) ); |
|
384 | -get_current_screen()->add_help_tab( array( |
|
381 | + '<p>'.__('Plugins extend and expand the functionality of WordPress. Once a plugin is installed, you may activate it or deactivate it here.').'</p>'. |
|
382 | + '<p>'.sprintf(__('You can find additional plugins for your site by using the <a href="%1$s">Plugin Browser/Installer</a> functionality or by browsing the <a href="%2$s" target="_blank">WordPress Plugin Directory</a> directly and installing new plugins manually. To manually install a plugin you generally just need to upload the plugin file into your <code>/wp-content/plugins</code> directory. Once a plugin has been installed, you can activate it here.'), 'plugin-install.php', 'https://wordpress.org/plugins/').'</p>' |
|
383 | +)); |
|
384 | +get_current_screen()->add_help_tab(array( |
|
385 | 385 | 'id' => 'compatibility-problems', |
386 | 386 | 'title' => __('Troubleshooting'), |
387 | 387 | 'content' => |
388 | - '<p>' . __('Most of the time, plugins play nicely with the core of WordPress and with other plugins. Sometimes, though, a plugin’s code will get in the way of another plugin, causing compatibility issues. If your site starts doing strange things, this may be the problem. Try deactivating all your plugins and re-activating them in various combinations until you isolate which one(s) caused the issue.') . '</p>' . |
|
389 | - '<p>' . sprintf( __('If something goes wrong with a plugin and you can’t use WordPress, delete or rename that file in the <code>%s</code> directory and it will be automatically deactivated.'), WP_PLUGIN_DIR) . '</p>' |
|
390 | -) ); |
|
388 | + '<p>'.__('Most of the time, plugins play nicely with the core of WordPress and with other plugins. Sometimes, though, a plugin’s code will get in the way of another plugin, causing compatibility issues. If your site starts doing strange things, this may be the problem. Try deactivating all your plugins and re-activating them in various combinations until you isolate which one(s) caused the issue.').'</p>'. |
|
389 | + '<p>'.sprintf(__('If something goes wrong with a plugin and you can’t use WordPress, delete or rename that file in the <code>%s</code> directory and it will be automatically deactivated.'), WP_PLUGIN_DIR).'</p>' |
|
390 | +)); |
|
391 | 391 | |
392 | 392 | get_current_screen()->set_help_sidebar( |
393 | - '<p><strong>' . __('For more information:') . '</strong></p>' . |
|
394 | - '<p>' . __('<a href="https://codex.wordpress.org/Managing_Plugins#Plugin_Management" target="_blank">Documentation on Managing Plugins</a>') . '</p>' . |
|
395 | - '<p>' . __('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>' |
|
393 | + '<p><strong>'.__('For more information:').'</strong></p>'. |
|
394 | + '<p>'.__('<a href="https://codex.wordpress.org/Managing_Plugins#Plugin_Management" target="_blank">Documentation on Managing Plugins</a>').'</p>'. |
|
395 | + '<p>'.__('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>').'</p>' |
|
396 | 396 | ); |
397 | 397 | |
398 | 398 | $title = __('Plugins'); |
399 | 399 | $parent_file = 'plugins.php'; |
400 | 400 | |
401 | -require_once(ABSPATH . 'wp-admin/admin-header.php'); |
|
401 | +require_once(ABSPATH.'wp-admin/admin-header.php'); |
|
402 | 402 | |
403 | 403 | $invalid = validate_active_plugins(); |
404 | -if ( !empty($invalid) ) |
|
405 | - foreach ( $invalid as $plugin_file => $error ) |
|
406 | - echo '<div id="message" class="error"><p>' . sprintf(__('The plugin <code>%s</code> has been <strong>deactivated</strong> due to an error: %s'), esc_html($plugin_file), $error->get_error_message()) . '</p></div>'; |
|
404 | +if ( ! empty($invalid)) |
|
405 | + foreach ($invalid as $plugin_file => $error) |
|
406 | + echo '<div id="message" class="error"><p>'.sprintf(__('The plugin <code>%s</code> has been <strong>deactivated</strong> due to an error: %s'), esc_html($plugin_file), $error->get_error_message()).'</p></div>'; |
|
407 | 407 | ?> |
408 | 408 | |
409 | -<?php if ( isset($_GET['error']) ) : |
|
409 | +<?php if (isset($_GET['error'])) : |
|
410 | 410 | |
411 | - if ( isset( $_GET['main'] ) ) |
|
412 | - $errmsg = __( 'You cannot delete a plugin while it is active on the main site.' ); |
|
413 | - elseif ( isset($_GET['charsout']) ) |
|
411 | + if (isset($_GET['main'])) |
|
412 | + $errmsg = __('You cannot delete a plugin while it is active on the main site.'); |
|
413 | + elseif (isset($_GET['charsout'])) |
|
414 | 414 | $errmsg = sprintf(__('The plugin generated %d characters of <strong>unexpected output</strong> during activation. If you notice “headers already sent” messages, problems with syndication feeds or other issues, try deactivating or removing this plugin.'), $_GET['charsout']); |
415 | 415 | else |
416 | 416 | $errmsg = __('Plugin could not be activated because it triggered a <strong>fatal error</strong>.'); |
417 | 417 | ?> |
418 | 418 | <div id="message" class="error"><p><?php echo $errmsg; ?></p> |
419 | 419 | <?php |
420 | - if ( !isset( $_GET['main'] ) && !isset($_GET['charsout']) && wp_verify_nonce($_GET['_error_nonce'], 'plugin-activation-error_' . $plugin) ) { ?> |
|
421 | - <iframe style="border:0" width="100%" height="70px" src="<?php echo 'plugins.php?action=error_scrape&plugin=' . esc_attr($plugin) . '&_wpnonce=' . esc_attr($_GET['_error_nonce']); ?>"></iframe> |
|
420 | + if ( ! isset($_GET['main']) && ! isset($_GET['charsout']) && wp_verify_nonce($_GET['_error_nonce'], 'plugin-activation-error_'.$plugin)) { ?> |
|
421 | + <iframe style="border:0" width="100%" height="70px" src="<?php echo 'plugins.php?action=error_scrape&plugin='.esc_attr($plugin).'&_wpnonce='.esc_attr($_GET['_error_nonce']); ?>"></iframe> |
|
422 | 422 | <?php |
423 | 423 | } |
424 | 424 | ?> |
425 | 425 | </div> |
426 | -<?php elseif ( isset($_GET['deleted']) ) : |
|
427 | - $delete_result = get_transient( 'plugins_delete_result_' . $user_ID ); |
|
426 | +<?php elseif (isset($_GET['deleted'])) : |
|
427 | + $delete_result = get_transient('plugins_delete_result_'.$user_ID); |
|
428 | 428 | // Delete it once we're done. |
429 | - delete_transient( 'plugins_delete_result_' . $user_ID ); |
|
429 | + delete_transient('plugins_delete_result_'.$user_ID); |
|
430 | 430 | |
431 | - if ( is_wp_error($delete_result) ) : ?> |
|
432 | - <div id="message" class="error notice is-dismissible"><p><?php printf( __('Plugin could not be deleted due to an error: %s'), $delete_result->get_error_message() ); ?></p></div> |
|
431 | + if (is_wp_error($delete_result)) : ?> |
|
432 | + <div id="message" class="error notice is-dismissible"><p><?php printf(__('Plugin could not be deleted due to an error: %s'), $delete_result->get_error_message()); ?></p></div> |
|
433 | 433 | <?php else : ?> |
434 | 434 | <div id="message" class="updated notice is-dismissible"><p><?php _e('The selected plugins have been <strong>deleted</strong>.'); ?></p></div> |
435 | 435 | <?php endif; ?> |
436 | -<?php elseif ( isset($_GET['activate']) ) : ?> |
|
436 | +<?php elseif (isset($_GET['activate'])) : ?> |
|
437 | 437 | <div id="message" class="updated notice is-dismissible"><p><?php _e('Plugin <strong>activated</strong>.') ?></p></div> |
438 | 438 | <?php elseif (isset($_GET['activate-multi'])) : ?> |
439 | 439 | <div id="message" class="updated notice is-dismissible"><p><?php _e('Selected plugins <strong>activated</strong>.'); ?></p></div> |
440 | -<?php elseif ( isset($_GET['deactivate']) ) : ?> |
|
440 | +<?php elseif (isset($_GET['deactivate'])) : ?> |
|
441 | 441 | <div id="message" class="updated notice is-dismissible"><p><?php _e('Plugin <strong>deactivated</strong>.') ?></p></div> |
442 | 442 | <?php elseif (isset($_GET['deactivate-multi'])) : ?> |
443 | 443 | <div id="message" class="updated notice is-dismissible"><p><?php _e('Selected plugins <strong>deactivated</strong>.'); ?></p></div> |
444 | -<?php elseif ( 'update-selected' == $action ) : ?> |
|
444 | +<?php elseif ('update-selected' == $action) : ?> |
|
445 | 445 | <div id="message" class="updated notice is-dismissible"><p><?php _e('No out of date plugins were selected.'); ?></p></div> |
446 | 446 | <?php endif; ?> |
447 | 447 | |
448 | 448 | <div class="wrap"> |
449 | -<h1><?php echo esc_html( $title ); |
|
450 | -if ( ( ! is_multisite() || is_network_admin() ) && current_user_can('install_plugins') ) { ?> |
|
451 | - <a href="<?php echo self_admin_url( 'plugin-install.php' ); ?>" class="page-title-action"><?php echo esc_html_x('Add New', 'plugin'); ?></a> |
|
449 | +<h1><?php echo esc_html($title); |
|
450 | +if (( ! is_multisite() || is_network_admin()) && current_user_can('install_plugins')) { ?> |
|
451 | + <a href="<?php echo self_admin_url('plugin-install.php'); ?>" class="page-title-action"><?php echo esc_html_x('Add New', 'plugin'); ?></a> |
|
452 | 452 | <?php } |
453 | -if ( $s ) |
|
454 | - printf( '<span class="subtitle">' . __('Search results for “%s”') . '</span>', esc_html( $s ) ); ?> |
|
453 | +if ($s) |
|
454 | + printf('<span class="subtitle">'.__('Search results for “%s”').'</span>', esc_html($s)); ?> |
|
455 | 455 | </h1> |
456 | 456 | |
457 | 457 | <?php |
@@ -467,13 +467,13 @@ discard block |
||
467 | 467 | * |
468 | 468 | * @param array $plugins_all An array containing all installed plugins. |
469 | 469 | */ |
470 | -do_action( 'pre_current_active_plugins', $plugins['all'] ); |
|
470 | +do_action('pre_current_active_plugins', $plugins['all']); |
|
471 | 471 | ?> |
472 | 472 | |
473 | 473 | <?php $wp_list_table->views(); ?> |
474 | 474 | |
475 | 475 | <form method="get"> |
476 | -<?php $wp_list_table->search_box( __( 'Search Installed Plugins' ), 'plugin' ); ?> |
|
476 | +<?php $wp_list_table->search_box(__('Search Installed Plugins'), 'plugin'); ?> |
|
477 | 477 | </form> |
478 | 478 | |
479 | 479 | <form method="post" id="bulk-action-form"> |
@@ -489,4 +489,4 @@ discard block |
||
489 | 489 | <?php |
490 | 490 | wp_print_request_filesystem_credentials_modal(); |
491 | 491 | |
492 | -include(ABSPATH . 'wp-admin/admin-footer.php'); |
|
492 | +include(ABSPATH.'wp-admin/admin-footer.php'); |
@@ -9,8 +9,9 @@ discard block |
||
9 | 9 | /** WordPress Administration Bootstrap */ |
10 | 10 | require_once( dirname( __FILE__ ) . '/admin.php' ); |
11 | 11 | |
12 | -if ( ! current_user_can('activate_plugins') ) |
|
12 | +if ( ! current_user_can('activate_plugins') ) { |
|
13 | 13 | wp_die( __( 'You do not have sufficient permissions to manage plugins for this site.' ) ); |
14 | +} |
|
14 | 15 | |
15 | 16 | $wp_list_table = _get_list_table('WP_Plugins_List_Table'); |
16 | 17 | $pagenum = $wp_list_table->get_pagenum(); |
@@ -29,8 +30,9 @@ discard block |
||
29 | 30 | |
30 | 31 | switch ( $action ) { |
31 | 32 | case 'activate': |
32 | - if ( ! current_user_can('activate_plugins') ) |
|
33 | - wp_die(__('You do not have sufficient permissions to activate plugins for this site.')); |
|
33 | + if ( ! current_user_can('activate_plugins') ) { |
|
34 | + wp_die(__('You do not have sufficient permissions to activate plugins for this site.')); |
|
35 | + } |
|
34 | 36 | |
35 | 37 | if ( is_multisite() && ! is_network_admin() && is_network_only_plugin( $plugin ) ) { |
36 | 38 | wp_redirect( self_admin_url("plugins.php?plugin_status=$status&paged=$page&s=$s") ); |
@@ -64,8 +66,9 @@ discard block |
||
64 | 66 | exit; |
65 | 67 | |
66 | 68 | case 'activate-selected': |
67 | - if ( ! current_user_can('activate_plugins') ) |
|
68 | - wp_die(__('You do not have sufficient permissions to activate plugins for this site.')); |
|
69 | + if ( ! current_user_can('activate_plugins') ) { |
|
70 | + wp_die(__('You do not have sufficient permissions to activate plugins for this site.')); |
|
71 | + } |
|
69 | 72 | |
70 | 73 | check_admin_referer('bulk-plugins'); |
71 | 74 | |
@@ -96,8 +99,9 @@ discard block |
||
96 | 99 | |
97 | 100 | if ( ! is_network_admin() ) { |
98 | 101 | $recent = (array) get_option('recently_activated' ); |
99 | - foreach ( $plugins as $plugin ) |
|
100 | - unset( $recent[ $plugin ] ); |
|
102 | + foreach ( $plugins as $plugin ) { |
|
103 | + unset( $recent[ $plugin ] ); |
|
104 | + } |
|
101 | 105 | update_option( 'recently_activated', $recent ); |
102 | 106 | } |
103 | 107 | |
@@ -108,12 +112,13 @@ discard block |
||
108 | 112 | |
109 | 113 | check_admin_referer( 'bulk-plugins' ); |
110 | 114 | |
111 | - if ( isset( $_GET['plugins'] ) ) |
|
112 | - $plugins = explode( ',', $_GET['plugins'] ); |
|
113 | - elseif ( isset( $_POST['checked'] ) ) |
|
114 | - $plugins = (array) $_POST['checked']; |
|
115 | - else |
|
116 | - $plugins = array(); |
|
115 | + if ( isset( $_GET['plugins'] ) ) { |
|
116 | + $plugins = explode( ',', $_GET['plugins'] ); |
|
117 | + } elseif ( isset( $_POST['checked'] ) ) { |
|
118 | + $plugins = (array) $_POST['checked']; |
|
119 | + } else { |
|
120 | + $plugins = array(); |
|
121 | + } |
|
117 | 122 | |
118 | 123 | $title = __( 'Update Plugins' ); |
119 | 124 | $parent_file = 'plugins.php'; |
@@ -133,14 +138,16 @@ discard block |
||
133 | 138 | exit; |
134 | 139 | |
135 | 140 | case 'error_scrape': |
136 | - if ( ! current_user_can('activate_plugins') ) |
|
137 | - wp_die(__('You do not have sufficient permissions to activate plugins for this site.')); |
|
141 | + if ( ! current_user_can('activate_plugins') ) { |
|
142 | + wp_die(__('You do not have sufficient permissions to activate plugins for this site.')); |
|
143 | + } |
|
138 | 144 | |
139 | 145 | check_admin_referer('plugin-activation-error_' . $plugin); |
140 | 146 | |
141 | 147 | $valid = validate_plugin($plugin); |
142 | - if ( is_wp_error($valid) ) |
|
143 | - wp_die($valid); |
|
148 | + if ( is_wp_error($valid) ) { |
|
149 | + wp_die($valid); |
|
150 | + } |
|
144 | 151 | |
145 | 152 | if ( ! WP_DEBUG ) { |
146 | 153 | error_reporting( E_CORE_ERROR | E_CORE_WARNING | E_COMPILE_ERROR | E_ERROR | E_WARNING | E_PARSE | E_USER_ERROR | E_USER_WARNING | E_RECOVERABLE_ERROR ); |
@@ -161,8 +168,9 @@ discard block |
||
161 | 168 | exit; |
162 | 169 | |
163 | 170 | case 'deactivate': |
164 | - if ( ! current_user_can('activate_plugins') ) |
|
165 | - wp_die(__('You do not have sufficient permissions to deactivate plugins for this site.')); |
|
171 | + if ( ! current_user_can('activate_plugins') ) { |
|
172 | + wp_die(__('You do not have sufficient permissions to deactivate plugins for this site.')); |
|
173 | + } |
|
166 | 174 | |
167 | 175 | check_admin_referer('deactivate-plugin_' . $plugin); |
168 | 176 | |
@@ -172,17 +180,20 @@ discard block |
||
172 | 180 | } |
173 | 181 | |
174 | 182 | deactivate_plugins( $plugin, false, is_network_admin() ); |
175 | - if ( ! is_network_admin() ) |
|
176 | - update_option( 'recently_activated', array( $plugin => time() ) + (array) get_option( 'recently_activated' ) ); |
|
177 | - if ( headers_sent() ) |
|
178 | - echo "<meta http-equiv='refresh' content='" . esc_attr( "0;url=plugins.php?deactivate=true&plugin_status=$status&paged=$page&s=$s" ) . "' />"; |
|
179 | - else |
|
180 | - wp_redirect( self_admin_url("plugins.php?deactivate=true&plugin_status=$status&paged=$page&s=$s") ); |
|
183 | + if ( ! is_network_admin() ) { |
|
184 | + update_option( 'recently_activated', array( $plugin => time() ) + (array) get_option( 'recently_activated' ) ); |
|
185 | + } |
|
186 | + if ( headers_sent() ) { |
|
187 | + echo "<meta http-equiv='refresh' content='" . esc_attr( "0;url=plugins.php?deactivate=true&plugin_status=$status&paged=$page&s=$s" ) . "' />"; |
|
188 | + } else { |
|
189 | + wp_redirect( self_admin_url("plugins.php?deactivate=true&plugin_status=$status&paged=$page&s=$s") ); |
|
190 | + } |
|
181 | 191 | exit; |
182 | 192 | |
183 | 193 | case 'deactivate-selected': |
184 | - if ( ! current_user_can('activate_plugins') ) |
|
185 | - wp_die(__('You do not have sufficient permissions to deactivate plugins for this site.')); |
|
194 | + if ( ! current_user_can('activate_plugins') ) { |
|
195 | + wp_die(__('You do not have sufficient permissions to deactivate plugins for this site.')); |
|
196 | + } |
|
186 | 197 | |
187 | 198 | check_admin_referer('bulk-plugins'); |
188 | 199 | |
@@ -203,8 +214,9 @@ discard block |
||
203 | 214 | |
204 | 215 | if ( ! is_network_admin() ) { |
205 | 216 | $deactivated = array(); |
206 | - foreach ( $plugins as $plugin ) |
|
207 | - $deactivated[ $plugin ] = time(); |
|
217 | + foreach ( $plugins as $plugin ) { |
|
218 | + $deactivated[ $plugin ] = time(); |
|
219 | + } |
|
208 | 220 | update_option( 'recently_activated', $deactivated + (array) get_option( 'recently_activated' ) ); |
209 | 221 | } |
210 | 222 | |
@@ -293,8 +305,11 @@ discard block |
||
293 | 305 | <div class="error"><p><strong><?php _e( 'Caution:' ); ?></strong> <?php _e( 'This plugin may be active on other sites in the network.' ); ?></p></div> |
294 | 306 | <?php endif; ?> |
295 | 307 | <p><?php _e( 'You are about to remove the following plugin:' ); ?></p> |
296 | - <?php else: ?> |
|
297 | - <h1><?php _e( 'Delete Plugins' ); ?></h1> |
|
308 | + <?php else { |
|
309 | + : ?> |
|
310 | + <h1><?php _e( 'Delete Plugins' ); |
|
311 | +} |
|
312 | +?></h1> |
|
298 | 313 | <?php if ( $have_non_network_plugins && is_network_admin() ) : ?> |
299 | 314 | <div class="error"><p><strong><?php _e( 'Caution:' ); ?></strong> <?php _e( 'These plugins may be active on other sites in the network.' ); ?></p></div> |
300 | 315 | <?php endif; ?> |
@@ -316,10 +331,11 @@ discard block |
||
316 | 331 | ?> |
317 | 332 | </ul> |
318 | 333 | <p><?php |
319 | - if ( $data_to_delete ) |
|
320 | - _e('Are you sure you wish to delete these files and data?'); |
|
321 | - else |
|
322 | - _e('Are you sure you wish to delete these files?'); |
|
334 | + if ( $data_to_delete ) { |
|
335 | + _e('Are you sure you wish to delete these files and data?'); |
|
336 | + } else { |
|
337 | + _e('Are you sure you wish to delete these files?'); |
|
338 | + } |
|
323 | 339 | ?></p> |
324 | 340 | <form method="post" action="<?php echo esc_url($_SERVER['REQUEST_URI']); ?>" style="display:inline;"> |
325 | 341 | <input type="hidden" name="verify-delete" value="1" /> |
@@ -361,8 +377,9 @@ discard block |
||
361 | 377 | exit; |
362 | 378 | |
363 | 379 | case 'clear-recent-list': |
364 | - if ( ! is_network_admin() ) |
|
365 | - update_option( 'recently_activated', array() ); |
|
380 | + if ( ! is_network_admin() ) { |
|
381 | + update_option( 'recently_activated', array() ); |
|
382 | + } |
|
366 | 383 | break; |
367 | 384 | } |
368 | 385 | } |
@@ -401,19 +418,21 @@ discard block |
||
401 | 418 | require_once(ABSPATH . 'wp-admin/admin-header.php'); |
402 | 419 | |
403 | 420 | $invalid = validate_active_plugins(); |
404 | -if ( !empty($invalid) ) |
|
421 | +if ( !empty($invalid) ) { |
|
405 | 422 | foreach ( $invalid as $plugin_file => $error ) |
406 | 423 | echo '<div id="message" class="error"><p>' . sprintf(__('The plugin <code>%s</code> has been <strong>deactivated</strong> due to an error: %s'), esc_html($plugin_file), $error->get_error_message()) . '</p></div>'; |
424 | +} |
|
407 | 425 | ?> |
408 | 426 | |
409 | 427 | <?php if ( isset($_GET['error']) ) : |
410 | 428 | |
411 | - if ( isset( $_GET['main'] ) ) |
|
412 | - $errmsg = __( 'You cannot delete a plugin while it is active on the main site.' ); |
|
413 | - elseif ( isset($_GET['charsout']) ) |
|
414 | - $errmsg = sprintf(__('The plugin generated %d characters of <strong>unexpected output</strong> during activation. If you notice “headers already sent” messages, problems with syndication feeds or other issues, try deactivating or removing this plugin.'), $_GET['charsout']); |
|
415 | - else |
|
416 | - $errmsg = __('Plugin could not be activated because it triggered a <strong>fatal error</strong>.'); |
|
429 | + if ( isset( $_GET['main'] ) ) { |
|
430 | + $errmsg = __( 'You cannot delete a plugin while it is active on the main site.' ); |
|
431 | + } elseif ( isset($_GET['charsout']) ) { |
|
432 | + $errmsg = sprintf(__('The plugin generated %d characters of <strong>unexpected output</strong> during activation. If you notice “headers already sent” messages, problems with syndication feeds or other issues, try deactivating or removing this plugin.'), $_GET['charsout']); |
|
433 | + } else { |
|
434 | + $errmsg = __('Plugin could not be activated because it triggered a <strong>fatal error</strong>.'); |
|
435 | + } |
|
417 | 436 | ?> |
418 | 437 | <div id="message" class="error"><p><?php echo $errmsg; ?></p> |
419 | 438 | <?php |
@@ -430,8 +449,11 @@ discard block |
||
430 | 449 | |
431 | 450 | if ( is_wp_error($delete_result) ) : ?> |
432 | 451 | <div id="message" class="error notice is-dismissible"><p><?php printf( __('Plugin could not be deleted due to an error: %s'), $delete_result->get_error_message() ); ?></p></div> |
433 | - <?php else : ?> |
|
434 | - <div id="message" class="updated notice is-dismissible"><p><?php _e('The selected plugins have been <strong>deleted</strong>.'); ?></p></div> |
|
452 | + <?php else { |
|
453 | + : ?> |
|
454 | + <div id="message" class="updated notice is-dismissible"><p><?php _e('The selected plugins have been <strong>deleted</strong>.'); |
|
455 | +} |
|
456 | +?></p></div> |
|
435 | 457 | <?php endif; ?> |
436 | 458 | <?php elseif ( isset($_GET['activate']) ) : ?> |
437 | 459 | <div id="message" class="updated notice is-dismissible"><p><?php _e('Plugin <strong>activated</strong>.') ?></p></div> |
@@ -450,8 +472,10 @@ discard block |
||
450 | 472 | if ( ( ! is_multisite() || is_network_admin() ) && current_user_can('install_plugins') ) { ?> |
451 | 473 | <a href="<?php echo self_admin_url( 'plugin-install.php' ); ?>" class="page-title-action"><?php echo esc_html_x('Add New', 'plugin'); ?></a> |
452 | 474 | <?php } |
453 | -if ( $s ) |
|
454 | - printf( '<span class="subtitle">' . __('Search results for “%s”') . '</span>', esc_html( $s ) ); ?> |
|
475 | +if ( $s ) { |
|
476 | + printf( '<span class="subtitle">' . __('Search results for “%s”') . '</span>', esc_html( $s ) ); |
|
477 | +} |
|
478 | +?> |
|
455 | 479 | </h1> |
456 | 480 | |
457 | 481 | <?php |
@@ -228,10 +228,10 @@ |
||
228 | 228 | |
229 | 229 | <?php |
230 | 230 | /** |
231 | - * Fires after the export filters form. |
|
232 | - * |
|
233 | - * @since 3.5.0 |
|
234 | - */ |
|
231 | + * Fires after the export filters form. |
|
232 | + * |
|
233 | + * @since 3.5.0 |
|
234 | + */ |
|
235 | 235 | do_action( 'export_filters' ); |
236 | 236 | ?> |
237 | 237 |
@@ -7,13 +7,13 @@ 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 | -if ( !current_user_can('export') ) |
|
12 | +if ( ! current_user_can('export')) |
|
13 | 13 | wp_die(__('You do not have sufficient permissions to export the content of this site.')); |
14 | 14 | |
15 | 15 | /** Load WordPress export API */ |
16 | -require_once( ABSPATH . 'wp-admin/includes/export.php' ); |
|
16 | +require_once(ABSPATH.'wp-admin/includes/export.php'); |
|
17 | 17 | $title = __('Export'); |
18 | 18 | |
19 | 19 | /** |
@@ -39,55 +39,55 @@ discard block |
||
39 | 39 | </script> |
40 | 40 | <?php |
41 | 41 | } |
42 | -add_action( 'admin_head', 'export_add_js' ); |
|
42 | +add_action('admin_head', 'export_add_js'); |
|
43 | 43 | |
44 | -get_current_screen()->add_help_tab( array( |
|
44 | +get_current_screen()->add_help_tab(array( |
|
45 | 45 | 'id' => 'overview', |
46 | 46 | 'title' => __('Overview'), |
47 | - 'content' => '<p>' . __('You can export a file of your site’s content in order to import it into another installation or platform. The export file will be an XML file format called WXR. Posts, pages, comments, custom fields, categories, and tags can be included. You can choose for the WXR file to include only certain posts or pages by setting the dropdown filters to limit the export by category, author, date range by month, or publishing status.') . '</p>' . |
|
48 | - '<p>' . __('Once generated, your WXR file can be imported by another WordPress site or by another blogging platform able to access this format.') . '</p>', |
|
49 | -) ); |
|
47 | + 'content' => '<p>'.__('You can export a file of your site’s content in order to import it into another installation or platform. The export file will be an XML file format called WXR. Posts, pages, comments, custom fields, categories, and tags can be included. You can choose for the WXR file to include only certain posts or pages by setting the dropdown filters to limit the export by category, author, date range by month, or publishing status.').'</p>'. |
|
48 | + '<p>'.__('Once generated, your WXR file can be imported by another WordPress site or by another blogging platform able to access this format.').'</p>', |
|
49 | +)); |
|
50 | 50 | |
51 | 51 | get_current_screen()->set_help_sidebar( |
52 | - '<p><strong>' . __('For more information:') . '</strong></p>' . |
|
53 | - '<p>' . __('<a href="https://codex.wordpress.org/Tools_Export_Screen" target="_blank">Documentation on Export</a>') . '</p>' . |
|
54 | - '<p>' . __('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>' |
|
52 | + '<p><strong>'.__('For more information:').'</strong></p>'. |
|
53 | + '<p>'.__('<a href="https://codex.wordpress.org/Tools_Export_Screen" target="_blank">Documentation on Export</a>').'</p>'. |
|
54 | + '<p>'.__('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>').'</p>' |
|
55 | 55 | ); |
56 | 56 | |
57 | 57 | // If the 'download' URL parameter is set, a WXR export file is baked and returned. |
58 | -if ( isset( $_GET['download'] ) ) { |
|
58 | +if (isset($_GET['download'])) { |
|
59 | 59 | $args = array(); |
60 | 60 | |
61 | - if ( ! isset( $_GET['content'] ) || 'all' == $_GET['content'] ) { |
|
61 | + if ( ! isset($_GET['content']) || 'all' == $_GET['content']) { |
|
62 | 62 | $args['content'] = 'all'; |
63 | - } elseif ( 'posts' == $_GET['content'] ) { |
|
63 | + } elseif ('posts' == $_GET['content']) { |
|
64 | 64 | $args['content'] = 'post'; |
65 | 65 | |
66 | - if ( $_GET['cat'] ) |
|
66 | + if ($_GET['cat']) |
|
67 | 67 | $args['category'] = (int) $_GET['cat']; |
68 | 68 | |
69 | - if ( $_GET['post_author'] ) |
|
69 | + if ($_GET['post_author']) |
|
70 | 70 | $args['author'] = (int) $_GET['post_author']; |
71 | 71 | |
72 | - if ( $_GET['post_start_date'] || $_GET['post_end_date'] ) { |
|
72 | + if ($_GET['post_start_date'] || $_GET['post_end_date']) { |
|
73 | 73 | $args['start_date'] = $_GET['post_start_date']; |
74 | 74 | $args['end_date'] = $_GET['post_end_date']; |
75 | 75 | } |
76 | 76 | |
77 | - if ( $_GET['post_status'] ) |
|
77 | + if ($_GET['post_status']) |
|
78 | 78 | $args['status'] = $_GET['post_status']; |
79 | - } elseif ( 'pages' == $_GET['content'] ) { |
|
79 | + } elseif ('pages' == $_GET['content']) { |
|
80 | 80 | $args['content'] = 'page'; |
81 | 81 | |
82 | - if ( $_GET['page_author'] ) |
|
82 | + if ($_GET['page_author']) |
|
83 | 83 | $args['author'] = (int) $_GET['page_author']; |
84 | 84 | |
85 | - if ( $_GET['page_start_date'] || $_GET['page_end_date'] ) { |
|
85 | + if ($_GET['page_start_date'] || $_GET['page_end_date']) { |
|
86 | 86 | $args['start_date'] = $_GET['page_start_date']; |
87 | 87 | $args['end_date'] = $_GET['page_end_date']; |
88 | 88 | } |
89 | 89 | |
90 | - if ( $_GET['page_status'] ) |
|
90 | + if ($_GET['page_status']) |
|
91 | 91 | $args['status'] = $_GET['page_status']; |
92 | 92 | } else { |
93 | 93 | $args['content'] = $_GET['content']; |
@@ -100,13 +100,13 @@ discard block |
||
100 | 100 | * |
101 | 101 | * @param array $args The arguments to send to the exporter. |
102 | 102 | */ |
103 | - $args = apply_filters( 'export_args', $args ); |
|
103 | + $args = apply_filters('export_args', $args); |
|
104 | 104 | |
105 | - export_wp( $args ); |
|
105 | + export_wp($args); |
|
106 | 106 | die(); |
107 | 107 | } |
108 | 108 | |
109 | -require_once( ABSPATH . 'wp-admin/admin-header.php' ); |
|
109 | +require_once(ABSPATH.'wp-admin/admin-header.php'); |
|
110 | 110 | |
111 | 111 | /** |
112 | 112 | * Create the date options fields for exporting a given post type. |
@@ -118,112 +118,112 @@ discard block |
||
118 | 118 | * |
119 | 119 | * @param string $post_type The post type. Default 'post'. |
120 | 120 | */ |
121 | -function export_date_options( $post_type = 'post' ) { |
|
121 | +function export_date_options($post_type = 'post') { |
|
122 | 122 | global $wpdb, $wp_locale; |
123 | 123 | |
124 | - $months = $wpdb->get_results( $wpdb->prepare( " |
|
124 | + $months = $wpdb->get_results($wpdb->prepare(" |
|
125 | 125 | SELECT DISTINCT YEAR( post_date ) AS year, MONTH( post_date ) AS month |
126 | 126 | FROM $wpdb->posts |
127 | 127 | WHERE post_type = %s AND post_status != 'auto-draft' |
128 | 128 | ORDER BY post_date DESC |
129 | - ", $post_type ) ); |
|
129 | + ", $post_type)); |
|
130 | 130 | |
131 | - $month_count = count( $months ); |
|
132 | - if ( !$month_count || ( 1 == $month_count && 0 == $months[0]->month ) ) |
|
131 | + $month_count = count($months); |
|
132 | + if ( ! $month_count || (1 == $month_count && 0 == $months[0]->month)) |
|
133 | 133 | return; |
134 | 134 | |
135 | - foreach ( $months as $date ) { |
|
136 | - if ( 0 == $date->year ) |
|
135 | + foreach ($months as $date) { |
|
136 | + if (0 == $date->year) |
|
137 | 137 | continue; |
138 | 138 | |
139 | - $month = zeroise( $date->month, 2 ); |
|
140 | - echo '<option value="' . $date->year . '-' . $month . '">' . $wp_locale->get_month( $month ) . ' ' . $date->year . '</option>'; |
|
139 | + $month = zeroise($date->month, 2); |
|
140 | + echo '<option value="'.$date->year.'-'.$month.'">'.$wp_locale->get_month($month).' '.$date->year.'</option>'; |
|
141 | 141 | } |
142 | 142 | } |
143 | 143 | ?> |
144 | 144 | |
145 | 145 | <div class="wrap"> |
146 | -<h1><?php echo esc_html( $title ); ?></h1> |
|
146 | +<h1><?php echo esc_html($title); ?></h1> |
|
147 | 147 | |
148 | 148 | <p><?php _e('When you click the button below WordPress will create an XML file for you to save to your computer.'); ?></p> |
149 | 149 | <p><?php _e('This format, which we call WordPress eXtended RSS or WXR, will contain your posts, pages, comments, custom fields, categories, and tags.'); ?></p> |
150 | 150 | <p><?php _e('Once you’ve saved the download file, you can use the Import function in another WordPress installation to import the content from this site.'); ?></p> |
151 | 151 | |
152 | -<h3><?php _e( 'Choose what to export' ); ?></h3> |
|
152 | +<h3><?php _e('Choose what to export'); ?></h3> |
|
153 | 153 | <form method="get" id="export-filters"> |
154 | 154 | <input type="hidden" name="download" value="true" /> |
155 | -<p><label><input type="radio" name="content" value="all" checked="checked" /> <?php _e( 'All content' ); ?></label></p> |
|
156 | -<p class="description"><?php _e( 'This will contain all of your posts, pages, comments, custom fields, terms, navigation menus and custom posts.' ); ?></p> |
|
155 | +<p><label><input type="radio" name="content" value="all" checked="checked" /> <?php _e('All content'); ?></label></p> |
|
156 | +<p class="description"><?php _e('This will contain all of your posts, pages, comments, custom fields, terms, navigation menus and custom posts.'); ?></p> |
|
157 | 157 | |
158 | -<p><label><input type="radio" name="content" value="posts" /> <?php _e( 'Posts' ); ?></label></p> |
|
158 | +<p><label><input type="radio" name="content" value="posts" /> <?php _e('Posts'); ?></label></p> |
|
159 | 159 | <ul id="post-filters" class="export-filters"> |
160 | 160 | <li> |
161 | - <label><?php _e( 'Categories:' ); ?></label> |
|
162 | - <?php wp_dropdown_categories( array( 'show_option_all' => __('All') ) ); ?> |
|
161 | + <label><?php _e('Categories:'); ?></label> |
|
162 | + <?php wp_dropdown_categories(array('show_option_all' => __('All'))); ?> |
|
163 | 163 | </li> |
164 | 164 | <li> |
165 | - <label><?php _e( 'Authors:' ); ?></label> |
|
165 | + <label><?php _e('Authors:'); ?></label> |
|
166 | 166 | <?php |
167 | - $authors = $wpdb->get_col( "SELECT DISTINCT post_author FROM {$wpdb->posts} WHERE post_type = 'post'" ); |
|
168 | - wp_dropdown_users( array( 'include' => $authors, 'name' => 'post_author', 'multi' => true, 'show_option_all' => __('All') ) ); |
|
167 | + $authors = $wpdb->get_col("SELECT DISTINCT post_author FROM {$wpdb->posts} WHERE post_type = 'post'"); |
|
168 | + wp_dropdown_users(array('include' => $authors, 'name' => 'post_author', 'multi' => true, 'show_option_all' => __('All'))); |
|
169 | 169 | ?> |
170 | 170 | </li> |
171 | 171 | <li> |
172 | - <label><?php _e( 'Date range:' ); ?></label> |
|
172 | + <label><?php _e('Date range:'); ?></label> |
|
173 | 173 | <select name="post_start_date"> |
174 | - <option value="0"><?php _e( 'Start Date' ); ?></option> |
|
174 | + <option value="0"><?php _e('Start Date'); ?></option> |
|
175 | 175 | <?php export_date_options(); ?> |
176 | 176 | </select> |
177 | 177 | <select name="post_end_date"> |
178 | - <option value="0"><?php _e( 'End Date' ); ?></option> |
|
178 | + <option value="0"><?php _e('End Date'); ?></option> |
|
179 | 179 | <?php export_date_options(); ?> |
180 | 180 | </select> |
181 | 181 | </li> |
182 | 182 | <li> |
183 | - <label><?php _e( 'Status:' ); ?></label> |
|
183 | + <label><?php _e('Status:'); ?></label> |
|
184 | 184 | <select name="post_status"> |
185 | - <option value="0"><?php _e( 'All' ); ?></option> |
|
186 | - <?php $post_stati = get_post_stati( array( 'internal' => false ), 'objects' ); |
|
187 | - foreach ( $post_stati as $status ) : ?> |
|
188 | - <option value="<?php echo esc_attr( $status->name ); ?>"><?php echo esc_html( $status->label ); ?></option> |
|
185 | + <option value="0"><?php _e('All'); ?></option> |
|
186 | + <?php $post_stati = get_post_stati(array('internal' => false), 'objects'); |
|
187 | + foreach ($post_stati as $status) : ?> |
|
188 | + <option value="<?php echo esc_attr($status->name); ?>"><?php echo esc_html($status->label); ?></option> |
|
189 | 189 | <?php endforeach; ?> |
190 | 190 | </select> |
191 | 191 | </li> |
192 | 192 | </ul> |
193 | 193 | |
194 | -<p><label><input type="radio" name="content" value="pages" /> <?php _e( 'Pages' ); ?></label></p> |
|
194 | +<p><label><input type="radio" name="content" value="pages" /> <?php _e('Pages'); ?></label></p> |
|
195 | 195 | <ul id="page-filters" class="export-filters"> |
196 | 196 | <li> |
197 | - <label><?php _e( 'Authors:' ); ?></label> |
|
197 | + <label><?php _e('Authors:'); ?></label> |
|
198 | 198 | <?php |
199 | - $authors = $wpdb->get_col( "SELECT DISTINCT post_author FROM {$wpdb->posts} WHERE post_type = 'page'" ); |
|
200 | - wp_dropdown_users( array( 'include' => $authors, 'name' => 'page_author', 'multi' => true, 'show_option_all' => __('All') ) ); |
|
199 | + $authors = $wpdb->get_col("SELECT DISTINCT post_author FROM {$wpdb->posts} WHERE post_type = 'page'"); |
|
200 | + wp_dropdown_users(array('include' => $authors, 'name' => 'page_author', 'multi' => true, 'show_option_all' => __('All'))); |
|
201 | 201 | ?> |
202 | 202 | </li> |
203 | 203 | <li> |
204 | - <label><?php _e( 'Date range:' ); ?></label> |
|
204 | + <label><?php _e('Date range:'); ?></label> |
|
205 | 205 | <select name="page_start_date"> |
206 | - <option value="0"><?php _e( 'Start Date' ); ?></option> |
|
207 | - <?php export_date_options( 'page' ); ?> |
|
206 | + <option value="0"><?php _e('Start Date'); ?></option> |
|
207 | + <?php export_date_options('page'); ?> |
|
208 | 208 | </select> |
209 | 209 | <select name="page_end_date"> |
210 | - <option value="0"><?php _e( 'End Date' ); ?></option> |
|
211 | - <?php export_date_options( 'page' ); ?> |
|
210 | + <option value="0"><?php _e('End Date'); ?></option> |
|
211 | + <?php export_date_options('page'); ?> |
|
212 | 212 | </select> |
213 | 213 | </li> |
214 | 214 | <li> |
215 | - <label><?php _e( 'Status:' ); ?></label> |
|
215 | + <label><?php _e('Status:'); ?></label> |
|
216 | 216 | <select name="page_status"> |
217 | - <option value="0"><?php _e( 'All' ); ?></option> |
|
218 | - <?php foreach ( $post_stati as $status ) : ?> |
|
219 | - <option value="<?php echo esc_attr( $status->name ); ?>"><?php echo esc_html( $status->label ); ?></option> |
|
217 | + <option value="0"><?php _e('All'); ?></option> |
|
218 | + <?php foreach ($post_stati as $status) : ?> |
|
219 | + <option value="<?php echo esc_attr($status->name); ?>"><?php echo esc_html($status->label); ?></option> |
|
220 | 220 | <?php endforeach; ?> |
221 | 221 | </select> |
222 | 222 | </li> |
223 | 223 | </ul> |
224 | 224 | |
225 | -<?php foreach ( get_post_types( array( '_builtin' => false, 'can_export' => true ), 'objects' ) as $post_type ) : ?> |
|
226 | -<p><label><input type="radio" name="content" value="<?php echo esc_attr( $post_type->name ); ?>" /> <?php echo esc_html( $post_type->label ); ?></label></p> |
|
225 | +<?php foreach (get_post_types(array('_builtin' => false, 'can_export' => true), 'objects') as $post_type) : ?> |
|
226 | +<p><label><input type="radio" name="content" value="<?php echo esc_attr($post_type->name); ?>" /> <?php echo esc_html($post_type->label); ?></label></p> |
|
227 | 227 | <?php endforeach; ?> |
228 | 228 | |
229 | 229 | <?php |
@@ -232,11 +232,11 @@ discard block |
||
232 | 232 | * |
233 | 233 | * @since 3.5.0 |
234 | 234 | */ |
235 | -do_action( 'export_filters' ); |
|
235 | +do_action('export_filters'); |
|
236 | 236 | ?> |
237 | 237 | |
238 | -<?php submit_button( __('Download Export File') ); ?> |
|
238 | +<?php submit_button(__('Download Export File')); ?> |
|
239 | 239 | </form> |
240 | 240 | </div> |
241 | 241 | |
242 | -<?php include( ABSPATH . 'wp-admin/admin-footer.php' ); ?> |
|
242 | +<?php include(ABSPATH.'wp-admin/admin-footer.php'); ?> |
@@ -9,8 +9,9 @@ discard block |
||
9 | 9 | /** Load WordPress Bootstrap */ |
10 | 10 | require_once( dirname( __FILE__ ) . '/admin.php' ); |
11 | 11 | |
12 | -if ( !current_user_can('export') ) |
|
12 | +if ( !current_user_can('export') ) { |
|
13 | 13 | wp_die(__('You do not have sufficient permissions to export the content of this site.')); |
14 | +} |
|
14 | 15 | |
15 | 16 | /** Load WordPress export API */ |
16 | 17 | require_once( ABSPATH . 'wp-admin/includes/export.php' ); |
@@ -63,32 +64,37 @@ discard block |
||
63 | 64 | } elseif ( 'posts' == $_GET['content'] ) { |
64 | 65 | $args['content'] = 'post'; |
65 | 66 | |
66 | - if ( $_GET['cat'] ) |
|
67 | - $args['category'] = (int) $_GET['cat']; |
|
67 | + if ( $_GET['cat'] ) { |
|
68 | + $args['category'] = (int) $_GET['cat']; |
|
69 | + } |
|
68 | 70 | |
69 | - if ( $_GET['post_author'] ) |
|
70 | - $args['author'] = (int) $_GET['post_author']; |
|
71 | + if ( $_GET['post_author'] ) { |
|
72 | + $args['author'] = (int) $_GET['post_author']; |
|
73 | + } |
|
71 | 74 | |
72 | 75 | if ( $_GET['post_start_date'] || $_GET['post_end_date'] ) { |
73 | 76 | $args['start_date'] = $_GET['post_start_date']; |
74 | 77 | $args['end_date'] = $_GET['post_end_date']; |
75 | 78 | } |
76 | 79 | |
77 | - if ( $_GET['post_status'] ) |
|
78 | - $args['status'] = $_GET['post_status']; |
|
80 | + if ( $_GET['post_status'] ) { |
|
81 | + $args['status'] = $_GET['post_status']; |
|
82 | + } |
|
79 | 83 | } elseif ( 'pages' == $_GET['content'] ) { |
80 | 84 | $args['content'] = 'page'; |
81 | 85 | |
82 | - if ( $_GET['page_author'] ) |
|
83 | - $args['author'] = (int) $_GET['page_author']; |
|
86 | + if ( $_GET['page_author'] ) { |
|
87 | + $args['author'] = (int) $_GET['page_author']; |
|
88 | + } |
|
84 | 89 | |
85 | 90 | if ( $_GET['page_start_date'] || $_GET['page_end_date'] ) { |
86 | 91 | $args['start_date'] = $_GET['page_start_date']; |
87 | 92 | $args['end_date'] = $_GET['page_end_date']; |
88 | 93 | } |
89 | 94 | |
90 | - if ( $_GET['page_status'] ) |
|
91 | - $args['status'] = $_GET['page_status']; |
|
95 | + if ( $_GET['page_status'] ) { |
|
96 | + $args['status'] = $_GET['page_status']; |
|
97 | + } |
|
92 | 98 | } else { |
93 | 99 | $args['content'] = $_GET['content']; |
94 | 100 | } |
@@ -129,12 +135,14 @@ discard block |
||
129 | 135 | ", $post_type ) ); |
130 | 136 | |
131 | 137 | $month_count = count( $months ); |
132 | - if ( !$month_count || ( 1 == $month_count && 0 == $months[0]->month ) ) |
|
133 | - return; |
|
138 | + if ( !$month_count || ( 1 == $month_count && 0 == $months[0]->month ) ) { |
|
139 | + return; |
|
140 | + } |
|
134 | 141 | |
135 | 142 | foreach ( $months as $date ) { |
136 | - if ( 0 == $date->year ) |
|
137 | - continue; |
|
143 | + if ( 0 == $date->year ) { |
|
144 | + continue; |
|
145 | + } |
|
138 | 146 | |
139 | 147 | $month = zeroise( $date->month, 2 ); |
140 | 148 | echo '<option value="' . $date->year . '-' . $month . '">' . $wp_locale->get_month( $month ) . ' ' . $date->year . '</option>'; |
@@ -1,10 +1,10 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * Your Rights administration panel. |
|
4 | - * |
|
5 | - * @package WordPress |
|
6 | - * @subpackage Administration |
|
7 | - */ |
|
3 | + * Your Rights administration panel. |
|
4 | + * |
|
5 | + * @package WordPress |
|
6 | + * @subpackage Administration |
|
7 | + */ |
|
8 | 8 | |
9 | 9 | /** WordPress Administration Bootstrap */ |
10 | 10 | require_once( dirname( __FILE__ ) . '/admin.php' ); |
@@ -7,51 +7,51 @@ |
||
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 | -$title = __( 'Freedoms' ); |
|
12 | +$title = __('Freedoms'); |
|
13 | 13 | |
14 | -list( $display_version ) = explode( '-', $wp_version ); |
|
14 | +list($display_version) = explode('-', $wp_version); |
|
15 | 15 | |
16 | -include( ABSPATH . 'wp-admin/admin-header.php' ); |
|
16 | +include(ABSPATH.'wp-admin/admin-header.php'); |
|
17 | 17 | ?> |
18 | 18 | <div class="wrap about-wrap"> |
19 | 19 | |
20 | -<h1><?php printf( __( 'Welcome to WordPress %s' ), $display_version ); ?></h1> |
|
20 | +<h1><?php printf(__('Welcome to WordPress %s'), $display_version); ?></h1> |
|
21 | 21 | |
22 | -<div class="about-text"><?php printf( __( 'Thank you for updating! WordPress %s makes it even easier to format your content and customize your site.' ), $display_version ); ?></div> |
|
22 | +<div class="about-text"><?php printf(__('Thank you for updating! WordPress %s makes it even easier to format your content and customize your site.'), $display_version); ?></div> |
|
23 | 23 | |
24 | -<div class="wp-badge"><?php printf( __( 'Version %s' ), $display_version ); ?></div> |
|
24 | +<div class="wp-badge"><?php printf(__('Version %s'), $display_version); ?></div> |
|
25 | 25 | |
26 | 26 | <h2 class="nav-tab-wrapper"> |
27 | 27 | <a href="about.php" class="nav-tab"> |
28 | - <?php _e( 'What’s New' ); ?> |
|
28 | + <?php _e('What’s New'); ?> |
|
29 | 29 | </a><a href="credits.php" class="nav-tab"> |
30 | - <?php _e( 'Credits' ); ?> |
|
30 | + <?php _e('Credits'); ?> |
|
31 | 31 | </a><a href="freedoms.php" class="nav-tab nav-tab-active"> |
32 | - <?php _e( 'Freedoms' ); ?> |
|
32 | + <?php _e('Freedoms'); ?> |
|
33 | 33 | </a> |
34 | 34 | </h2> |
35 | 35 | |
36 | -<p class="about-description"><?php printf( __( 'WordPress is Free and open source software, built by a distributed community of mostly volunteer developers from around the world. WordPress comes with some awesome, worldview-changing rights courtesy of its <a href="%s">license</a>, the GPL.' ), 'https://wordpress.org/about/license/' ); ?></p> |
|
36 | +<p class="about-description"><?php printf(__('WordPress is Free and open source software, built by a distributed community of mostly volunteer developers from around the world. WordPress comes with some awesome, worldview-changing rights courtesy of its <a href="%s">license</a>, the GPL.'), 'https://wordpress.org/about/license/'); ?></p> |
|
37 | 37 | |
38 | 38 | <ol start="0"> |
39 | - <li><p><?php _e( 'You have the freedom to run the program, for any purpose.' ); ?></p></li> |
|
40 | - <li><p><?php _e( 'You have access to the source code, the freedom to study how the program works, and the freedom to change it to make it do what you wish.' ); ?></p></li> |
|
41 | - <li><p><?php _e( 'You have the freedom to redistribute copies of the original program so you can help your neighbor.' ); ?></p></li> |
|
42 | - <li><p><?php _e( 'You have the freedom to distribute copies of your modified versions to others. By doing this you can give the whole community a chance to benefit from your changes.' ); ?></p></li> |
|
39 | + <li><p><?php _e('You have the freedom to run the program, for any purpose.'); ?></p></li> |
|
40 | + <li><p><?php _e('You have access to the source code, the freedom to study how the program works, and the freedom to change it to make it do what you wish.'); ?></p></li> |
|
41 | + <li><p><?php _e('You have the freedom to redistribute copies of the original program so you can help your neighbor.'); ?></p></li> |
|
42 | + <li><p><?php _e('You have the freedom to distribute copies of your modified versions to others. By doing this you can give the whole community a chance to benefit from your changes.'); ?></p></li> |
|
43 | 43 | </ol> |
44 | 44 | |
45 | -<p><?php printf( __( 'WordPress grows when people like you tell their friends about it, and the thousands of businesses and services that are built on and around WordPress share that fact with their users. We’re flattered every time someone spreads the good word, just make sure to <a href="%s">check out our trademark guidelines</a> first.' ), 'http://wordpressfoundation.org/trademark-policy/' ); ?></p> |
|
45 | +<p><?php printf(__('WordPress grows when people like you tell their friends about it, and the thousands of businesses and services that are built on and around WordPress share that fact with their users. We’re flattered every time someone spreads the good word, just make sure to <a href="%s">check out our trademark guidelines</a> first.'), 'http://wordpressfoundation.org/trademark-policy/'); ?></p> |
|
46 | 46 | |
47 | 47 | <p><?php |
48 | 48 | |
49 | -$plugins_url = current_user_can( 'activate_plugins' ) ? admin_url( 'plugins.php' ) : 'https://wordpress.org/plugins/'; |
|
50 | -$themes_url = current_user_can( 'switch_themes' ) ? admin_url( 'themes.php' ) : 'https://wordpress.org/themes/'; |
|
49 | +$plugins_url = current_user_can('activate_plugins') ? admin_url('plugins.php') : 'https://wordpress.org/plugins/'; |
|
50 | +$themes_url = current_user_can('switch_themes') ? admin_url('themes.php') : 'https://wordpress.org/themes/'; |
|
51 | 51 | |
52 | -printf( __( 'Every plugin and theme in WordPress.org’s directory is 100%% GPL or a similarly free and compatible license, so you can feel safe finding <a href="%1$s">plugins</a> and <a href="%2$s">themes</a> there. If you get a plugin or theme from another source, make sure to <a href="%3$s">ask them if it’s GPL</a> first. If they don’t respect the WordPress license, we don’t recommend them.' ), $plugins_url, $themes_url, 'https://wordpress.org/about/license/' ); ?></p> |
|
52 | +printf(__('Every plugin and theme in WordPress.org’s directory is 100%% GPL or a similarly free and compatible license, so you can feel safe finding <a href="%1$s">plugins</a> and <a href="%2$s">themes</a> there. If you get a plugin or theme from another source, make sure to <a href="%3$s">ask them if it’s GPL</a> first. If they don’t respect the WordPress license, we don’t recommend them.'), $plugins_url, $themes_url, 'https://wordpress.org/about/license/'); ?></p> |
|
53 | 53 | |
54 | -<p><?php _e( 'Don’t you wish all software came with these freedoms? So do we! For more information, check out the <a href="http://www.fsf.org/">Free Software Foundation</a>.' ); ?></p> |
|
54 | +<p><?php _e('Don’t you wish all software came with these freedoms? So do we! For more information, check out the <a href="http://www.fsf.org/">Free Software Foundation</a>.'); ?></p> |
|
55 | 55 | |
56 | 56 | </div> |
57 | -<?php include( ABSPATH . 'wp-admin/admin-footer.php' ); ?> |
|
57 | +<?php include(ABSPATH.'wp-admin/admin-footer.php'); ?> |
@@ -191,18 +191,18 @@ |
||
191 | 191 | |
192 | 192 | /* translators: 1: WordPress version number. */ |
193 | 193 | _n_noop( '<strong>Version %1$s</strong> addressed a security issue.', |
194 | - '<strong>Version %1$s</strong> addressed some security issues.' ); |
|
194 | + '<strong>Version %1$s</strong> addressed some security issues.' ); |
|
195 | 195 | |
196 | 196 | /* translators: 1: WordPress version number, 2: plural number of bugs. */ |
197 | 197 | _n_noop( '<strong>Version %1$s</strong> addressed %2$s bug.', |
198 | - '<strong>Version %1$s</strong> addressed %2$s bugs.' ); |
|
198 | + '<strong>Version %1$s</strong> addressed %2$s bugs.' ); |
|
199 | 199 | |
200 | 200 | /* translators: 1: WordPress version number, 2: plural number of bugs. Singular security issue. */ |
201 | 201 | _n_noop( '<strong>Version %1$s</strong> addressed a security issue and fixed %2$s bug.', |
202 | - '<strong>Version %1$s</strong> addressed a security issue and fixed %2$s bugs.' ); |
|
202 | + '<strong>Version %1$s</strong> addressed a security issue and fixed %2$s bugs.' ); |
|
203 | 203 | |
204 | 204 | /* translators: 1: WordPress version number, 2: plural number of bugs. More than one security issue. */ |
205 | 205 | _n_noop( '<strong>Version %1$s</strong> addressed some security issues and fixed %2$s bug.', |
206 | - '<strong>Version %1$s</strong> addressed some security issues and fixed %2$s bugs.' ); |
|
206 | + '<strong>Version %1$s</strong> addressed some security issues and fixed %2$s bugs.' ); |
|
207 | 207 | |
208 | 208 | __( 'For more information, see <a href="%s">the release notes</a>.' ); |
@@ -7,28 +7,28 @@ discard block |
||
7 | 7 | */ |
8 | 8 | |
9 | 9 | /** WordPress Administration Bootstrap */ |
10 | -require_once( dirname( __FILE__ ) . '/admin.php' ); |
|
10 | +require_once(dirname(__FILE__).'/admin.php'); |
|
11 | 11 | |
12 | -wp_enqueue_style( 'wp-mediaelement' ); |
|
13 | -wp_enqueue_script( 'wp-mediaelement' ); |
|
14 | -wp_localize_script( 'mediaelement', '_wpmejsSettings', array( |
|
15 | - 'pluginPath' => includes_url( 'js/mediaelement/', 'relative' ), |
|
12 | +wp_enqueue_style('wp-mediaelement'); |
|
13 | +wp_enqueue_script('wp-mediaelement'); |
|
14 | +wp_localize_script('mediaelement', '_wpmejsSettings', array( |
|
15 | + 'pluginPath' => includes_url('js/mediaelement/', 'relative'), |
|
16 | 16 | 'pauseOtherPlayers' => '' |
17 | -) ); |
|
17 | +)); |
|
18 | 18 | |
19 | -$title = __( 'About' ); |
|
19 | +$title = __('About'); |
|
20 | 20 | |
21 | -list( $display_version ) = explode( '-', $wp_version ); |
|
21 | +list($display_version) = explode('-', $wp_version); |
|
22 | 22 | |
23 | -include( ABSPATH . 'wp-admin/admin-header.php' ); |
|
23 | +include(ABSPATH.'wp-admin/admin-header.php'); |
|
24 | 24 | |
25 | 25 | $video_url = 'https://videopress.com/embed/T54Iy7Tw'; |
26 | -$locale = str_replace( '_', '-', get_locale() ); |
|
27 | -if ( 'en-AU' !== $locale ) { |
|
28 | - list( $locale ) = explode( '-', $locale ); |
|
26 | +$locale = str_replace('_', '-', get_locale()); |
|
27 | +if ('en-AU' !== $locale) { |
|
28 | + list($locale) = explode('-', $locale); |
|
29 | 29 | } |
30 | -if ( 'en' !== $locale ) { |
|
31 | - $video_url = add_query_arg( 'defaultLangCode', $locale, $video_url ); |
|
30 | +if ('en' !== $locale) { |
|
31 | + $video_url = add_query_arg('defaultLangCode', $locale, $video_url); |
|
32 | 32 | } |
33 | 33 | |
34 | 34 | $major_features = array( |
@@ -38,90 +38,90 @@ discard block |
||
38 | 38 | 'ogv' => '//s.w.org/images/core/4.3/formatting.ogv', |
39 | 39 | 'webm' => '//s.w.org/images/core/4.3/formatting.webm', |
40 | 40 | ), |
41 | - 'heading' => __( 'Formatting Shortcuts' ), |
|
41 | + 'heading' => __('Formatting Shortcuts'), |
|
42 | 42 | /* Translators: 1: asterisks; 2: number sign; */ |
43 | - 'description' => sprintf( __( 'Your writing flow just got faster with new formatting shortcuts in WordPress 4.3. Use asterisks to create lists and number signs to make a heading. No more breaking your flow; your text looks great with a %1$s and a %2$s.' ), '<code>*</code>', '<code>#</code>' ), |
|
43 | + 'description' => sprintf(__('Your writing flow just got faster with new formatting shortcuts in WordPress 4.3. Use asterisks to create lists and number signs to make a heading. No more breaking your flow; your text looks great with a %1$s and a %2$s.'), '<code>*</code>', '<code>#</code>'), |
|
44 | 44 | ), |
45 | 45 | array( |
46 | 46 | 'src' => '//s.w.org/images/core/4.3/menu-customizer.png', |
47 | - 'heading' => __( 'Menus in the Customizer' ), |
|
48 | - 'description' => __( 'Create your menu, update it, and assign it, all while live-previewing in the customizer. The streamlined customizer design provides a mobile-friendly and accessible interface. With every release, it becomes easier and faster to make your site just the way you want it.' ), |
|
47 | + 'heading' => __('Menus in the Customizer'), |
|
48 | + 'description' => __('Create your menu, update it, and assign it, all while live-previewing in the customizer. The streamlined customizer design provides a mobile-friendly and accessible interface. With every release, it becomes easier and faster to make your site just the way you want it.'), |
|
49 | 49 | ), |
50 | 50 | array( |
51 | 51 | 'src' => '//s.w.org/images/core/4.3/better-passwords.png', |
52 | - 'heading' => __( 'Better Passwords' ), |
|
53 | - 'description' => __( 'Keep your site more secure with WordPress’ improved approach to passwords. Instead of receiving passwords via email, you’ll get a password reset link. When you add new users to your site or edit a user profile, WordPress will automatically generate a secure password.' ), |
|
52 | + 'heading' => __('Better Passwords'), |
|
53 | + 'description' => __('Keep your site more secure with WordPress’ improved approach to passwords. Instead of receiving passwords via email, you’ll get a password reset link. When you add new users to your site or edit a user profile, WordPress will automatically generate a secure password.'), |
|
54 | 54 | ), |
55 | 55 | array( |
56 | 56 | 'src' => '//s.w.org/images/core/4.3/site-icon-customizer.png', |
57 | - 'heading' => __( 'Site Icons' ), |
|
58 | - 'description' => __( 'Site icons represent your site in browser tabs, bookmark menus, and on the home screen of mobile devices. Add your unique site icon in the customizer; it will even stay in place when you switch themes. Make your whole site reflect your brand.' ), |
|
57 | + 'heading' => __('Site Icons'), |
|
58 | + 'description' => __('Site icons represent your site in browser tabs, bookmark menus, and on the home screen of mobile devices. Add your unique site icon in the customizer; it will even stay in place when you switch themes. Make your whole site reflect your brand.'), |
|
59 | 59 | ), |
60 | 60 | ); |
61 | -shuffle( $major_features ); |
|
61 | +shuffle($major_features); |
|
62 | 62 | |
63 | 63 | $minor_features = array( |
64 | 64 | array( |
65 | 65 | 'src' => 'data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCA0MDAgNDAwIj48cGF0aCBmaWxsPSIjMDBhMGQyIiBkPSJNNTAgMjE1aDI0MHYzMEg1MHpNNTAgMjc1aDI0MHYzMEg1MHpNNTAgMTU1aDI0MHYzMEg1MHpNNTAgOTVoMjQwdjMwSDUwek0zMTAuMSA5NWwxOS45IDMwIDIwLjEtMzAiLz48L3N2Zz4=', |
66 | - 'heading' => __( 'A smoother admin experience' ), |
|
67 | - 'description' => __( 'Refinements to the list view across the admin make your WordPress more accessible and easier to work with on any device.' ), |
|
66 | + 'heading' => __('A smoother admin experience'), |
|
67 | + 'description' => __('Refinements to the list view across the admin make your WordPress more accessible and easier to work with on any device.'), |
|
68 | 68 | ), |
69 | 69 | array( |
70 | 70 | 'src' => 'data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyMCAyMCI+PHBhdGggZmlsbD0iIzAwYTBkMiIgZD0iTTUgMmgxMHEuODIgMCAxLjQxLjU5VDE3IDR2OHEwIC44Mi0uNTkgMS40MVQxNSAxNGgtMmwtNSA1di01SDVxLS44MiAwLTEuNDEtLjU5VDMgMTJWNHEwLS44Mi41OS0xLjQxVDUgMnptOC41IDguNUwxMSA4bDIuNS0yLjUtMS0xTDEwIDcgNy41IDQuNWwtMSAxTDkgOGwtMi41IDIuNSAxIDFMMTAgOWwyLjUgMi41eiIvPjwvc3ZnPg==', |
71 | - 'heading' => __( 'Comments turned off on pages' ), |
|
72 | - 'description' => __( 'All new pages that you create will have comments turned off. Keep discussions to your blog, right where they’re supposed to happen.' ), |
|
71 | + 'heading' => __('Comments turned off on pages'), |
|
72 | + 'description' => __('All new pages that you create will have comments turned off. Keep discussions to your blog, right where they’re supposed to happen.'), |
|
73 | 73 | ), |
74 | 74 | array( |
75 | 75 | 'src' => 'data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAzMiAzMiI+PHBhdGggZmlsbD0iIzAwYTBkMiIgZD0iTTI5LjMyOCA1LjcxMnEuMDQ4LS4xNDQuMDk2LS4zODR0LS4wNjQtLjgxNi0uNTI4LS45NzZxLS4zODQtLjM2OC0uODcyLS40NjR0LS43OTIgMGwtLjI4OC4wOHEtMS40NTYuNzItNS44OCAzLjczNnQtNi4zOTIgNS4xNzZxLS43MzYuODMyLTEuNDA4IDIuMzJ0LS44OCAzIC41NDQgMi4zOTJxLjgzMi43MzYgMi4zNDQuNTc2dDMuMDcyLS44MjQgMi4yNDgtMS4zNTJxMi4xNDQtMi4xNDQgNS4xNjgtNi42NTZ0My42MzItNS44MDh6TTIuMjQgMjguMjRxMS4wNTYtLjY4OCAxLjcxMi0xLjUyOHQuOTUyLTEuNjE2LjU0NC0xLjUyLjcyLTEuNDggMS4yNC0xLjI4cTEuMDg4LS44IDIuNTA0LS43MDR0Mi40MjQgMS4xNjhxLjgxNi44OC44MjQgMi42NHQtMS4wOCAyLjg5NnEtMS4yMTYgMS4xMi0yLjkwNCAxLjYyNHQtMy40MjQuNDI0LTMuNTEyLS42MjR6Ii8+PC9zdmc+', |
76 | - 'heading' => __( 'Customize your site quickly' ), |
|
77 | - 'description' => __( 'Wherever you are on the front-end, you can click the customize link in the toolbar to swiftly make changes to your site.' ), |
|
76 | + 'heading' => __('Customize your site quickly'), |
|
77 | + 'description' => __('Wherever you are on the front-end, you can click the customize link in the toolbar to swiftly make changes to your site.'), |
|
78 | 78 | ), |
79 | 79 | ); |
80 | 80 | |
81 | 81 | $tech_features = array( |
82 | 82 | array( |
83 | - 'heading' => __( 'Taxonomy Roadmap' ), |
|
84 | - 'description' => __( 'Terms shared across multiple taxonomies are now split into separate terms.' ), |
|
83 | + 'heading' => __('Taxonomy Roadmap'), |
|
84 | + 'description' => __('Terms shared across multiple taxonomies are now split into separate terms.'), |
|
85 | 85 | ), |
86 | 86 | array( |
87 | - 'heading' => __( 'Template Hierarchy' ), |
|
87 | + 'heading' => __('Template Hierarchy'), |
|
88 | 88 | /* Translators: 1: singular.php; 2: single.php; 3:page.php */ |
89 | - 'description' => sprintf( __( 'Added %1$s as a fallback for %2$s and %3$s' ), '<code>singular.php</code>', '<code>single.php</code>', '<code>page.php</code>.' ), |
|
89 | + 'description' => sprintf(__('Added %1$s as a fallback for %2$s and %3$s'), '<code>singular.php</code>', '<code>single.php</code>', '<code>page.php</code>.'), |
|
90 | 90 | ), |
91 | 91 | array( |
92 | 92 | 'heading' => '<code>WP_List_Table</code>', |
93 | - 'description' => __( 'List tables can and should designate a primary column.' ), |
|
93 | + 'description' => __('List tables can and should designate a primary column.'), |
|
94 | 94 | ), |
95 | 95 | ); |
96 | 96 | |
97 | 97 | ?> |
98 | 98 | <div class="wrap about-wrap"> |
99 | - <h1><?php printf( __( 'Welcome to WordPress %s' ), $display_version ); ?></h1> |
|
99 | + <h1><?php printf(__('Welcome to WordPress %s'), $display_version); ?></h1> |
|
100 | 100 | |
101 | - <div class="about-text"><?php printf( __( 'Thank you for updating! WordPress %s makes it even easier to format your content and customize your site.' ), $display_version ); ?></div> |
|
102 | - <div class="wp-badge"><?php printf( __( 'Version %s' ), $display_version ); ?></div> |
|
101 | + <div class="about-text"><?php printf(__('Thank you for updating! WordPress %s makes it even easier to format your content and customize your site.'), $display_version); ?></div> |
|
102 | + <div class="wp-badge"><?php printf(__('Version %s'), $display_version); ?></div> |
|
103 | 103 | |
104 | 104 | <h2 class="nav-tab-wrapper"> |
105 | - <a href="about.php" class="nav-tab nav-tab-active"><?php _e( 'What’s New' ); ?></a> |
|
106 | - <a href="credits.php" class="nav-tab"><?php _e( 'Credits' ); ?></a> |
|
107 | - <a href="freedoms.php" class="nav-tab"><?php _e( 'Freedoms' ); ?></a> |
|
105 | + <a href="about.php" class="nav-tab nav-tab-active"><?php _e('What’s New'); ?></a> |
|
106 | + <a href="credits.php" class="nav-tab"><?php _e('Credits'); ?></a> |
|
107 | + <a href="freedoms.php" class="nav-tab"><?php _e('Freedoms'); ?></a> |
|
108 | 108 | </h2> |
109 | 109 | |
110 | 110 | <div class="headline-feature feature-video"> |
111 | - <iframe width="1050" height="591" src="<?php echo esc_url( $video_url ); ?>" frameborder="0" allowfullscreen></iframe> |
|
111 | + <iframe width="1050" height="591" src="<?php echo esc_url($video_url); ?>" frameborder="0" allowfullscreen></iframe> |
|
112 | 112 | <script src="https://videopress.com/videopress-iframe.js"></script> |
113 | 113 | </div> |
114 | 114 | |
115 | 115 | <hr/> |
116 | 116 | |
117 | 117 | <div class="feature-section two-col"> |
118 | - <?php foreach ( $major_features as $feature ) : ?> |
|
118 | + <?php foreach ($major_features as $feature) : ?> |
|
119 | 119 | <div class="col"> |
120 | 120 | <div class="media-container"> |
121 | 121 | <?php |
122 | 122 | // Video. |
123 | - if ( is_array( $feature['src'] ) ) : |
|
124 | - echo wp_video_shortcode( array( |
|
123 | + if (is_array($feature['src'])) : |
|
124 | + echo wp_video_shortcode(array( |
|
125 | 125 | 'mp4' => $feature['src']['mp4'], |
126 | 126 | 'ogv' => $feature['src']['ogv'], |
127 | 127 | 'webm' => $feature['src']['webm'], |
@@ -129,12 +129,12 @@ discard block |
||
129 | 129 | 'autoplay' => true, |
130 | 130 | 'width' => 500, |
131 | 131 | 'height' => 284 |
132 | - ) ); |
|
132 | + )); |
|
133 | 133 | |
134 | 134 | // Image. |
135 | 135 | else: |
136 | 136 | ?> |
137 | - <img src="<?php echo esc_url( $feature['src'] ); ?>" /> |
|
137 | + <img src="<?php echo esc_url($feature['src']); ?>" /> |
|
138 | 138 | <?php endif; ?> |
139 | 139 | </div> |
140 | 140 | <h3><?php echo $feature['heading']; ?></h3> |
@@ -144,10 +144,10 @@ discard block |
||
144 | 144 | </div> |
145 | 145 | |
146 | 146 | <div class="feature-section three-col"> |
147 | - <?php foreach ( $minor_features as $feature ) : ?> |
|
147 | + <?php foreach ($minor_features as $feature) : ?> |
|
148 | 148 | <div class="col"> |
149 | 149 | <div class="svg-container"> |
150 | - <img src="<?php echo esc_attr( $feature['src'] ); ?>" /> |
|
150 | + <img src="<?php echo esc_attr($feature['src']); ?>" /> |
|
151 | 151 | </div> |
152 | 152 | <h3><?php echo $feature['heading']; ?></h3> |
153 | 153 | <p><?php echo $feature['description']; ?></p> |
@@ -156,10 +156,10 @@ discard block |
||
156 | 156 | </div> |
157 | 157 | |
158 | 158 | <div class="changelog"> |
159 | - <h3><?php _e( 'Under the Hood' ); ?></h3> |
|
159 | + <h3><?php _e('Under the Hood'); ?></h3> |
|
160 | 160 | |
161 | 161 | <div class="feature-section under-the-hood three-col"> |
162 | - <?php foreach ( $tech_features as $feature ) : ?> |
|
162 | + <?php foreach ($tech_features as $feature) : ?> |
|
163 | 163 | <div class="col"> |
164 | 164 | <h4><?php echo $feature['heading']; ?></h4> |
165 | 165 | <p><?php echo $feature['description']; ?></p> |
@@ -168,41 +168,41 @@ discard block |
||
168 | 168 | </div> |
169 | 169 | |
170 | 170 | <div class="return-to-dashboard"> |
171 | - <?php if ( current_user_can( 'update_core' ) && isset( $_GET['updated'] ) ) : ?> |
|
172 | - <a href="<?php echo esc_url( self_admin_url( 'update-core.php' ) ); ?>"> |
|
173 | - <?php is_multisite() ? _e( 'Return to Updates' ) : _e( 'Return to Dashboard → Updates' ); ?> |
|
171 | + <?php if (current_user_can('update_core') && isset($_GET['updated'])) : ?> |
|
172 | + <a href="<?php echo esc_url(self_admin_url('update-core.php')); ?>"> |
|
173 | + <?php is_multisite() ? _e('Return to Updates') : _e('Return to Dashboard → Updates'); ?> |
|
174 | 174 | </a> | |
175 | 175 | <?php endif; ?> |
176 | - <a href="<?php echo esc_url( self_admin_url() ); ?>"><?php is_blog_admin() ? _e( 'Go to Dashboard → Home' ) : _e( 'Go to Dashboard' ); ?></a> |
|
176 | + <a href="<?php echo esc_url(self_admin_url()); ?>"><?php is_blog_admin() ? _e('Go to Dashboard → Home') : _e('Go to Dashboard'); ?></a> |
|
177 | 177 | </div> |
178 | 178 | |
179 | 179 | </div> |
180 | 180 | </div> |
181 | 181 | <?php |
182 | 182 | |
183 | -include( ABSPATH . 'wp-admin/admin-footer.php' ); |
|
183 | +include(ABSPATH.'wp-admin/admin-footer.php'); |
|
184 | 184 | |
185 | 185 | // These are strings we may use to describe maintenance/security releases, where we aim for no new strings. |
186 | 186 | return; |
187 | 187 | |
188 | -_n_noop( 'Maintenance Release', 'Maintenance Releases' ); |
|
189 | -_n_noop( 'Security Release', 'Security Releases' ); |
|
190 | -_n_noop( 'Maintenance and Security Release', 'Maintenance and Security Releases' ); |
|
188 | +_n_noop('Maintenance Release', 'Maintenance Releases'); |
|
189 | +_n_noop('Security Release', 'Security Releases'); |
|
190 | +_n_noop('Maintenance and Security Release', 'Maintenance and Security Releases'); |
|
191 | 191 | |
192 | 192 | /* translators: 1: WordPress version number. */ |
193 | -_n_noop( '<strong>Version %1$s</strong> addressed a security issue.', |
|
194 | - '<strong>Version %1$s</strong> addressed some security issues.' ); |
|
193 | +_n_noop('<strong>Version %1$s</strong> addressed a security issue.', |
|
194 | + '<strong>Version %1$s</strong> addressed some security issues.'); |
|
195 | 195 | |
196 | 196 | /* translators: 1: WordPress version number, 2: plural number of bugs. */ |
197 | -_n_noop( '<strong>Version %1$s</strong> addressed %2$s bug.', |
|
198 | - '<strong>Version %1$s</strong> addressed %2$s bugs.' ); |
|
197 | +_n_noop('<strong>Version %1$s</strong> addressed %2$s bug.', |
|
198 | + '<strong>Version %1$s</strong> addressed %2$s bugs.'); |
|
199 | 199 | |
200 | 200 | /* translators: 1: WordPress version number, 2: plural number of bugs. Singular security issue. */ |
201 | -_n_noop( '<strong>Version %1$s</strong> addressed a security issue and fixed %2$s bug.', |
|
202 | - '<strong>Version %1$s</strong> addressed a security issue and fixed %2$s bugs.' ); |
|
201 | +_n_noop('<strong>Version %1$s</strong> addressed a security issue and fixed %2$s bug.', |
|
202 | + '<strong>Version %1$s</strong> addressed a security issue and fixed %2$s bugs.'); |
|
203 | 203 | |
204 | 204 | /* translators: 1: WordPress version number, 2: plural number of bugs. More than one security issue. */ |
205 | -_n_noop( '<strong>Version %1$s</strong> addressed some security issues and fixed %2$s bug.', |
|
206 | - '<strong>Version %1$s</strong> addressed some security issues and fixed %2$s bugs.' ); |
|
205 | +_n_noop('<strong>Version %1$s</strong> addressed some security issues and fixed %2$s bug.', |
|
206 | + '<strong>Version %1$s</strong> addressed some security issues and fixed %2$s bugs.'); |
|
207 | 207 | |
208 | -__( 'For more information, see <a href="%s">the release notes</a>.' ); |
|
208 | +__('For more information, see <a href="%s">the release notes</a>.'); |
@@ -132,9 +132,12 @@ |
||
132 | 132 | ) ); |
133 | 133 | |
134 | 134 | // Image. |
135 | - else: |
|
135 | + else { |
|
136 | + : |
|
136 | 137 | ?> |
137 | - <img src="<?php echo esc_url( $feature['src'] ); ?>" /> |
|
138 | + <img src="<?php echo esc_url( $feature['src'] ); |
|
139 | + } |
|
140 | + ?>" /> |
|
138 | 141 | <?php endif; ?> |
139 | 142 | </div> |
140 | 143 | <h3><?php echo $feature['heading']; ?></h3> |