@@ -12,8 +12,9 @@ |
||
12 | 12 | |
13 | 13 | wp_reset_vars( array( 'tab' ) ); |
14 | 14 | |
15 | -if ( ! current_user_can('install_themes') ) |
|
15 | +if ( ! current_user_can('install_themes') ) { |
|
16 | 16 | wp_die( __( 'You do not have sufficient permissions to install themes on this site.' ) ); |
17 | +} |
|
17 | 18 | |
18 | 19 | if ( is_multisite() && ! is_network_admin() ) { |
19 | 20 | wp_redirect( network_admin_url( 'theme-install.php' ) ); |
@@ -7,59 +7,59 @@ discard block |
||
7 | 7 | */ |
8 | 8 | |
9 | 9 | /** WordPress Administration Bootstrap */ |
10 | -require_once( dirname( __FILE__ ) . '/admin.php' ); |
|
11 | -require( ABSPATH . 'wp-admin/includes/theme-install.php' ); |
|
10 | +require_once(dirname(__FILE__).'/admin.php'); |
|
11 | +require(ABSPATH.'wp-admin/includes/theme-install.php'); |
|
12 | 12 | |
13 | -wp_reset_vars( array( 'tab' ) ); |
|
13 | +wp_reset_vars(array('tab')); |
|
14 | 14 | |
15 | -if ( ! current_user_can('install_themes') ) |
|
16 | - wp_die( __( 'You do not have sufficient permissions to install themes on this site.' ) ); |
|
15 | +if ( ! current_user_can('install_themes')) |
|
16 | + wp_die(__('You do not have sufficient permissions to install themes on this site.')); |
|
17 | 17 | |
18 | -if ( is_multisite() && ! is_network_admin() ) { |
|
19 | - wp_redirect( network_admin_url( 'theme-install.php' ) ); |
|
18 | +if (is_multisite() && ! is_network_admin()) { |
|
19 | + wp_redirect(network_admin_url('theme-install.php')); |
|
20 | 20 | exit(); |
21 | 21 | } |
22 | 22 | |
23 | -$title = __( 'Add Themes' ); |
|
23 | +$title = __('Add Themes'); |
|
24 | 24 | $parent_file = 'themes.php'; |
25 | 25 | |
26 | -if ( ! is_network_admin() ) { |
|
26 | +if ( ! is_network_admin()) { |
|
27 | 27 | $submenu_file = 'themes.php'; |
28 | 28 | } |
29 | 29 | |
30 | 30 | $installed_themes = search_theme_directories(); |
31 | -foreach ( $installed_themes as $k => $v ) { |
|
32 | - if ( false !== strpos( $k, '/' ) ) { |
|
33 | - unset( $installed_themes[ $k ] ); |
|
31 | +foreach ($installed_themes as $k => $v) { |
|
32 | + if (false !== strpos($k, '/')) { |
|
33 | + unset($installed_themes[$k]); |
|
34 | 34 | } |
35 | 35 | } |
36 | 36 | |
37 | -wp_localize_script( 'theme', '_wpThemeSettings', array( |
|
37 | +wp_localize_script('theme', '_wpThemeSettings', array( |
|
38 | 38 | 'themes' => false, |
39 | 39 | 'settings' => array( |
40 | 40 | 'isInstall' => true, |
41 | - 'canInstall' => current_user_can( 'install_themes' ), |
|
42 | - 'installURI' => current_user_can( 'install_themes' ) ? self_admin_url( 'theme-install.php' ) : null, |
|
43 | - 'adminUrl' => parse_url( self_admin_url(), PHP_URL_PATH ) |
|
41 | + 'canInstall' => current_user_can('install_themes'), |
|
42 | + 'installURI' => current_user_can('install_themes') ? self_admin_url('theme-install.php') : null, |
|
43 | + 'adminUrl' => parse_url(self_admin_url(), PHP_URL_PATH) |
|
44 | 44 | ), |
45 | 45 | 'l10n' => array( |
46 | - 'addNew' => __( 'Add New Theme' ), |
|
47 | - 'search' => __( 'Search Themes' ), |
|
48 | - 'searchPlaceholder' => __( 'Search themes...' ), // placeholder (no ellipsis) |
|
49 | - 'upload' => __( 'Upload Theme' ), |
|
50 | - 'back' => __( 'Back' ), |
|
51 | - 'error' => __( 'An unexpected error occurred. Something may be wrong with WordPress.org or this server’s configuration. If you continue to have problems, please try the <a href="https://wordpress.org/support/">support forums</a>.' ), |
|
52 | - 'themesFound' => __( 'Number of Themes found: %d' ), |
|
53 | - 'noThemesFound' => __( 'No themes found. Try a different search.' ), |
|
54 | - 'collapseSidebar' => __( 'Collapse Sidebar' ), |
|
55 | - 'expandSidebar' => __( 'Expand Sidebar' ), |
|
46 | + 'addNew' => __('Add New Theme'), |
|
47 | + 'search' => __('Search Themes'), |
|
48 | + 'searchPlaceholder' => __('Search themes...'), // placeholder (no ellipsis) |
|
49 | + 'upload' => __('Upload Theme'), |
|
50 | + 'back' => __('Back'), |
|
51 | + 'error' => __('An unexpected error occurred. Something may be wrong with WordPress.org or this server’s configuration. If you continue to have problems, please try the <a href="https://wordpress.org/support/">support forums</a>.'), |
|
52 | + 'themesFound' => __('Number of Themes found: %d'), |
|
53 | + 'noThemesFound' => __('No themes found. Try a different search.'), |
|
54 | + 'collapseSidebar' => __('Collapse Sidebar'), |
|
55 | + 'expandSidebar' => __('Expand Sidebar'), |
|
56 | 56 | ), |
57 | - 'installedThemes' => array_keys( $installed_themes ), |
|
58 | -) ); |
|
57 | + 'installedThemes' => array_keys($installed_themes), |
|
58 | +)); |
|
59 | 59 | |
60 | -wp_enqueue_script( 'theme' ); |
|
60 | +wp_enqueue_script('theme'); |
|
61 | 61 | |
62 | -if ( $tab ) { |
|
62 | +if ($tab) { |
|
63 | 63 | /** |
64 | 64 | * Fires before each of the tabs are rendered on the Install Themes page. |
65 | 65 | * |
@@ -69,51 +69,51 @@ discard block |
||
69 | 69 | * |
70 | 70 | * @since 2.8.0 |
71 | 71 | */ |
72 | - do_action( "install_themes_pre_{$tab}" ); |
|
72 | + do_action("install_themes_pre_{$tab}"); |
|
73 | 73 | } |
74 | 74 | |
75 | 75 | $help_overview = |
76 | - '<p>' . sprintf( |
|
76 | + '<p>'.sprintf( |
|
77 | 77 | /* translators: %s: Theme Directory URL */ |
78 | - __( 'You can find additional themes for your site by using the Theme Browser/Installer on this screen, which will display themes from the <a href="%s" target="_blank">WordPress.org Theme Directory</a>. These themes are designed and developed by third parties, are available free of charge, and are compatible with the license WordPress uses.' ), |
|
79 | - __( 'https://wordpress.org/themes/' ) |
|
80 | - ) . '</p>' . |
|
81 | - '<p>' . __( 'You can Search for themes by keyword, author, or tag, or can get more specific and search by criteria listed in the feature filter.' ) . ' <span id="live-search-desc">' . __( 'The search results will be updated as you type.' ) . '</span></p>' . |
|
82 | - '<p>' . __( 'Alternately, you can browse the themes that are Featured, Popular, or Latest. When you find a theme you like, you can preview it or install it.' ) . '</p>' . |
|
83 | - '<p>' . sprintf( |
|
78 | + __('You can find additional themes for your site by using the Theme Browser/Installer on this screen, which will display themes from the <a href="%s" target="_blank">WordPress.org Theme Directory</a>. These themes are designed and developed by third parties, are available free of charge, and are compatible with the license WordPress uses.'), |
|
79 | + __('https://wordpress.org/themes/') |
|
80 | + ).'</p>'. |
|
81 | + '<p>'.__('You can Search for themes by keyword, author, or tag, or can get more specific and search by criteria listed in the feature filter.').' <span id="live-search-desc">'.__('The search results will be updated as you type.').'</span></p>'. |
|
82 | + '<p>'.__('Alternately, you can browse the themes that are Featured, Popular, or Latest. When you find a theme you like, you can preview it or install it.').'</p>'. |
|
83 | + '<p>'.sprintf( |
|
84 | 84 | /* translators: %s: /wp-content/themes */ |
85 | - __( 'You can Upload a theme manually if you have already downloaded its ZIP archive onto your computer (make sure it is from a trusted and original source). You can also do it the old-fashioned way and copy a downloaded theme’s folder via FTP into your %s directory.' ), |
|
85 | + __('You can Upload a theme manually if you have already downloaded its ZIP archive onto your computer (make sure it is from a trusted and original source). You can also do it the old-fashioned way and copy a downloaded theme’s folder via FTP into your %s directory.'), |
|
86 | 86 | '<code>/wp-content/themes</code>' |
87 | - ) . '</p>'; |
|
87 | + ).'</p>'; |
|
88 | 88 | |
89 | -get_current_screen()->add_help_tab( array( |
|
89 | +get_current_screen()->add_help_tab(array( |
|
90 | 90 | 'id' => 'overview', |
91 | 91 | 'title' => __('Overview'), |
92 | 92 | 'content' => $help_overview |
93 | -) ); |
|
93 | +)); |
|
94 | 94 | |
95 | 95 | $help_installing = |
96 | - '<p>' . __('Once you have generated a list of themes, you can preview and install any of them. Click on the thumbnail of the theme you’re interested in previewing. It will open up in a full-screen Preview page to give you a better idea of how that theme will look.') . '</p>' . |
|
97 | - '<p>' . __('To install the theme so you can preview it with your site’s content and customize its theme options, click the "Install" button at the top of the left-hand pane. The theme files will be downloaded to your website automatically. When this is complete, the theme is now available for activation, which you can do by clicking the "Activate" link, or by navigating to your Manage Themes screen and clicking the "Live Preview" link under any installed theme’s thumbnail image.') . '</p>'; |
|
96 | + '<p>'.__('Once you have generated a list of themes, you can preview and install any of them. Click on the thumbnail of the theme you’re interested in previewing. It will open up in a full-screen Preview page to give you a better idea of how that theme will look.').'</p>'. |
|
97 | + '<p>'.__('To install the theme so you can preview it with your site’s content and customize its theme options, click the "Install" button at the top of the left-hand pane. The theme files will be downloaded to your website automatically. When this is complete, the theme is now available for activation, which you can do by clicking the "Activate" link, or by navigating to your Manage Themes screen and clicking the "Live Preview" link under any installed theme’s thumbnail image.').'</p>'; |
|
98 | 98 | |
99 | -get_current_screen()->add_help_tab( array( |
|
99 | +get_current_screen()->add_help_tab(array( |
|
100 | 100 | 'id' => 'installing', |
101 | 101 | 'title' => __('Previewing and Installing'), |
102 | 102 | 'content' => $help_installing |
103 | -) ); |
|
103 | +)); |
|
104 | 104 | |
105 | 105 | get_current_screen()->set_help_sidebar( |
106 | - '<p><strong>' . __('For more information:') . '</strong></p>' . |
|
107 | - '<p>' . __('<a href="https://codex.wordpress.org/Using_Themes#Adding_New_Themes" target="_blank">Documentation on Adding New Themes</a>') . '</p>' . |
|
108 | - '<p>' . __('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>' |
|
106 | + '<p><strong>'.__('For more information:').'</strong></p>'. |
|
107 | + '<p>'.__('<a href="https://codex.wordpress.org/Using_Themes#Adding_New_Themes" target="_blank">Documentation on Adding New Themes</a>').'</p>'. |
|
108 | + '<p>'.__('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>').'</p>' |
|
109 | 109 | ); |
110 | 110 | |
111 | -include(ABSPATH . 'wp-admin/admin-header.php'); |
|
111 | +include(ABSPATH.'wp-admin/admin-header.php'); |
|
112 | 112 | |
113 | 113 | ?> |
114 | 114 | <div class="wrap"> |
115 | 115 | <h1><?php |
116 | - echo esc_html( $title ); |
|
116 | + echo esc_html($title); |
|
117 | 117 | |
118 | 118 | /** |
119 | 119 | * Filter the tabs shown on the Add Themes screen. |
@@ -125,10 +125,10 @@ discard block |
||
125 | 125 | * |
126 | 126 | * @param array $tabs The tabs shown on the Add Themes screen. Default is 'upload'. |
127 | 127 | */ |
128 | - $tabs = apply_filters( 'install_themes_tabs', array( 'upload' => __( 'Upload Theme' ) ) ); |
|
129 | - if ( ! empty( $tabs['upload'] ) && current_user_can( 'upload_themes' ) ) { |
|
130 | - echo ' <a href="#" class="upload page-title-action">' . __( 'Upload Theme' ) . '</a>'; |
|
131 | - echo ' <a href="#" class="browse-themes page-title-action">' . _x( 'Browse', 'themes' ) . '</a>'; |
|
128 | + $tabs = apply_filters('install_themes_tabs', array('upload' => __('Upload Theme'))); |
|
129 | + if ( ! empty($tabs['upload']) && current_user_can('upload_themes')) { |
|
130 | + echo ' <a href="#" class="upload page-title-action">'.__('Upload Theme').'</a>'; |
|
131 | + echo ' <a href="#" class="browse-themes page-title-action">'._x('Browse', 'themes').'</a>'; |
|
132 | 132 | } |
133 | 133 | ?></h1> |
134 | 134 | |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | <?php install_themes_upload(); ?> |
137 | 137 | </div> |
138 | 138 | |
139 | - <h2 class="screen-reader-text"><?php _e( 'Filter themes list' ); ?></h2> |
|
139 | + <h2 class="screen-reader-text"><?php _e('Filter themes list'); ?></h2> |
|
140 | 140 | |
141 | 141 | <div class="wp-filter"> |
142 | 142 | <div class="filter-count"> |
@@ -144,67 +144,67 @@ discard block |
||
144 | 144 | </div> |
145 | 145 | |
146 | 146 | <ul class="filter-links"> |
147 | - <li><a href="#" data-sort="featured"><?php _ex( 'Featured', 'themes' ); ?></a></li> |
|
148 | - <li><a href="#" data-sort="popular"><?php _ex( 'Popular', 'themes' ); ?></a></li> |
|
149 | - <li><a href="#" data-sort="new"><?php _ex( 'Latest', 'themes' ); ?></a></li> |
|
150 | - <li><a href="#" data-sort="favorites"><?php _ex( 'Favorites', 'themes' ); ?></a></li> |
|
147 | + <li><a href="#" data-sort="featured"><?php _ex('Featured', 'themes'); ?></a></li> |
|
148 | + <li><a href="#" data-sort="popular"><?php _ex('Popular', 'themes'); ?></a></li> |
|
149 | + <li><a href="#" data-sort="new"><?php _ex('Latest', 'themes'); ?></a></li> |
|
150 | + <li><a href="#" data-sort="favorites"><?php _ex('Favorites', 'themes'); ?></a></li> |
|
151 | 151 | </ul> |
152 | 152 | |
153 | - <a class="drawer-toggle" href="#"><?php _e( 'Feature Filter' ); ?></a> |
|
153 | + <a class="drawer-toggle" href="#"><?php _e('Feature Filter'); ?></a> |
|
154 | 154 | |
155 | 155 | <div class="search-form"></div> |
156 | 156 | |
157 | 157 | <div class="favorites-form"> |
158 | 158 | <?php |
159 | - $user = isset( $_GET['user'] ) ? wp_unslash( $_GET['user'] ) : get_user_option( 'wporg_favorites' ); |
|
160 | - update_user_meta( get_current_user_id(), 'wporg_favorites', $user ); |
|
159 | + $user = isset($_GET['user']) ? wp_unslash($_GET['user']) : get_user_option('wporg_favorites'); |
|
160 | + update_user_meta(get_current_user_id(), 'wporg_favorites', $user); |
|
161 | 161 | ?> |
162 | - <p class="install-help"><?php _e( 'If you have marked themes as favorites on WordPress.org, you can browse them here.' ); ?></p> |
|
162 | + <p class="install-help"><?php _e('If you have marked themes as favorites on WordPress.org, you can browse them here.'); ?></p> |
|
163 | 163 | |
164 | 164 | <p> |
165 | - <label for="wporg-username-input"><?php _e( 'Your WordPress.org username:' ); ?></label> |
|
166 | - <input type="search" id="wporg-username-input" value="<?php echo esc_attr( $user ); ?>" /> |
|
167 | - <input type="button" class="button button-secondary favorites-form-submit" value="<?php esc_attr_e( 'Get Favorites' ); ?>" /> |
|
165 | + <label for="wporg-username-input"><?php _e('Your WordPress.org username:'); ?></label> |
|
166 | + <input type="search" id="wporg-username-input" value="<?php echo esc_attr($user); ?>" /> |
|
167 | + <input type="button" class="button button-secondary favorites-form-submit" value="<?php esc_attr_e('Get Favorites'); ?>" /> |
|
168 | 168 | </p> |
169 | 169 | </div> |
170 | 170 | |
171 | 171 | <div class="filter-drawer"> |
172 | 172 | <div class="buttons"> |
173 | - <a class="apply-filters button button-secondary" href="#"><?php _e( 'Apply Filters' ); ?><span></span></a> |
|
174 | - <a class="clear-filters button button-secondary" href="#"><?php _e( 'Clear' ); ?></a> |
|
173 | + <a class="apply-filters button button-secondary" href="#"><?php _e('Apply Filters'); ?><span></span></a> |
|
174 | + <a class="clear-filters button button-secondary" href="#"><?php _e('Clear'); ?></a> |
|
175 | 175 | </div> |
176 | 176 | <?php |
177 | 177 | $feature_list = get_theme_feature_list(); |
178 | - foreach ( $feature_list as $feature_name => $features ) { |
|
178 | + foreach ($feature_list as $feature_name => $features) { |
|
179 | 179 | echo '<fieldset class="filter-group">'; |
180 | - $feature_name = esc_html( $feature_name ); |
|
181 | - echo '<legend>' . $feature_name . '</legend>'; |
|
180 | + $feature_name = esc_html($feature_name); |
|
181 | + echo '<legend>'.$feature_name.'</legend>'; |
|
182 | 182 | echo '<div class="filter-group-feature">'; |
183 | - foreach ( $features as $feature => $feature_name ) { |
|
184 | - $feature = esc_attr( $feature ); |
|
185 | - echo '<input type="checkbox" id="filter-id-' . $feature . '" value="' . $feature . '" /> '; |
|
186 | - echo '<label for="filter-id-' . $feature . '">' . $feature_name . '</label><br>'; |
|
183 | + foreach ($features as $feature => $feature_name) { |
|
184 | + $feature = esc_attr($feature); |
|
185 | + echo '<input type="checkbox" id="filter-id-'.$feature.'" value="'.$feature.'" /> '; |
|
186 | + echo '<label for="filter-id-'.$feature.'">'.$feature_name.'</label><br>'; |
|
187 | 187 | } |
188 | 188 | echo '</div>'; |
189 | 189 | echo '</fieldset>'; |
190 | 190 | } |
191 | 191 | ?> |
192 | 192 | <div class="filtered-by"> |
193 | - <span><?php _e( 'Filtering by:' ); ?></span> |
|
193 | + <span><?php _e('Filtering by:'); ?></span> |
|
194 | 194 | <div class="tags"></div> |
195 | - <a href="#"><?php _e( 'Edit' ); ?></a> |
|
195 | + <a href="#"><?php _e('Edit'); ?></a> |
|
196 | 196 | </div> |
197 | 197 | </div> |
198 | 198 | </div> |
199 | - <h2 class="screen-reader-text"><?php _e( 'Themes list' ); ?></h2> |
|
199 | + <h2 class="screen-reader-text"><?php _e('Themes list'); ?></h2> |
|
200 | 200 | <div class="theme-browser content-filterable"></div> |
201 | 201 | <div class="theme-install-overlay wp-full-overlay expanded"></div> |
202 | 202 | |
203 | - <p class="no-themes"><?php _e( 'No themes found. Try a different search.' ); ?></p> |
|
203 | + <p class="no-themes"><?php _e('No themes found. Try a different search.'); ?></p> |
|
204 | 204 | <span class="spinner"></span> |
205 | 205 | |
206 | 206 | <?php |
207 | -if ( $tab ) { |
|
207 | +if ($tab) { |
|
208 | 208 | /** |
209 | 209 | * Fires at the top of each of the tabs on the Install Themes page. |
210 | 210 | * |
@@ -216,7 +216,7 @@ discard block |
||
216 | 216 | * |
217 | 217 | * @param int $paged Number of the current page of results being viewed. |
218 | 218 | */ |
219 | - do_action( "install_themes_{$tab}", $paged ); |
|
219 | + do_action("install_themes_{$tab}", $paged); |
|
220 | 220 | } |
221 | 221 | ?> |
222 | 222 | </div> |
@@ -229,36 +229,36 @@ discard block |
||
229 | 229 | <# } else { #> |
230 | 230 | <div class="theme-screenshot blank"></div> |
231 | 231 | <# } #> |
232 | - <span class="more-details"><?php _ex( 'Details & Preview', 'theme' ); ?></span> |
|
233 | - <div class="theme-author"><?php printf( __( 'By %s' ), '{{ data.author }}' ); ?></div> |
|
232 | + <span class="more-details"><?php _ex('Details & Preview', 'theme'); ?></span> |
|
233 | + <div class="theme-author"><?php printf(__('By %s'), '{{ data.author }}'); ?></div> |
|
234 | 234 | <h3 class="theme-name">{{ data.name }}</h3> |
235 | 235 | |
236 | 236 | <div class="theme-actions"> |
237 | - <a class="button button-primary" href="{{ data.install_url }}"><?php esc_html_e( 'Install' ); ?></a> |
|
238 | - <a class="button button-secondary preview install-theme-preview" href="#"><?php esc_html_e( 'Preview' ); ?></a> |
|
237 | + <a class="button button-primary" href="{{ data.install_url }}"><?php esc_html_e('Install'); ?></a> |
|
238 | + <a class="button button-secondary preview install-theme-preview" href="#"><?php esc_html_e('Preview'); ?></a> |
|
239 | 239 | </div> |
240 | 240 | |
241 | 241 | <# if ( data.installed ) { #> |
242 | - <div class="theme-installed"><?php _ex( 'Already Installed', 'theme' ); ?></div> |
|
242 | + <div class="theme-installed"><?php _ex('Already Installed', 'theme'); ?></div> |
|
243 | 243 | <# } #> |
244 | 244 | </script> |
245 | 245 | |
246 | 246 | <script id="tmpl-theme-preview" type="text/template"> |
247 | 247 | <div class="wp-full-overlay-sidebar"> |
248 | 248 | <div class="wp-full-overlay-header"> |
249 | - <a href="#" class="close-full-overlay"><span class="screen-reader-text"><?php _e( 'Close' ); ?></span></a> |
|
250 | - <a href="#" class="previous-theme"><span class="screen-reader-text"><?php _ex( 'Previous', 'Button label for a theme' ); ?></span></a> |
|
251 | - <a href="#" class="next-theme"><span class="screen-reader-text"><?php _ex( 'Next', 'Button label for a theme' ); ?></span></a> |
|
249 | + <a href="#" class="close-full-overlay"><span class="screen-reader-text"><?php _e('Close'); ?></span></a> |
|
250 | + <a href="#" class="previous-theme"><span class="screen-reader-text"><?php _ex('Previous', 'Button label for a theme'); ?></span></a> |
|
251 | + <a href="#" class="next-theme"><span class="screen-reader-text"><?php _ex('Next', 'Button label for a theme'); ?></span></a> |
|
252 | 252 | <# if ( data.installed ) { #> |
253 | - <a href="#" class="button button-primary theme-install disabled"><?php _ex( 'Installed', 'theme' ); ?></a> |
|
253 | + <a href="#" class="button button-primary theme-install disabled"><?php _ex('Installed', 'theme'); ?></a> |
|
254 | 254 | <# } else { #> |
255 | - <a href="{{ data.install_url }}" class="button button-primary theme-install"><?php _e( 'Install' ); ?></a> |
|
255 | + <a href="{{ data.install_url }}" class="button button-primary theme-install"><?php _e('Install'); ?></a> |
|
256 | 256 | <# } #> |
257 | 257 | </div> |
258 | 258 | <div class="wp-full-overlay-sidebar-content"> |
259 | 259 | <div class="install-theme-info"> |
260 | 260 | <h3 class="theme-name">{{ data.name }}</h3> |
261 | - <span class="theme-by"><?php printf( __( 'By %s' ), '{{ data.author }}' ); ?></span> |
|
261 | + <span class="theme-by"><?php printf(__('By %s'), '{{ data.author }}'); ?></span> |
|
262 | 262 | |
263 | 263 | <img class="theme-screenshot" src="{{ data.screenshot_url }}" alt="" /> |
264 | 264 | |
@@ -269,29 +269,29 @@ discard block |
||
269 | 269 | <span class="num-ratings" aria-hidden="true">({{ data.num_ratings }})</span> |
270 | 270 | </div> |
271 | 271 | <# } else { #> |
272 | - <span class="no-rating"><?php _e( 'This theme has not been rated yet.' ); ?></span> |
|
272 | + <span class="no-rating"><?php _e('This theme has not been rated yet.'); ?></span> |
|
273 | 273 | <# } #> |
274 | - <div class="theme-version"><?php printf( __( 'Version: %s' ), '{{ data.version }}' ); ?></div> |
|
274 | + <div class="theme-version"><?php printf(__('Version: %s'), '{{ data.version }}'); ?></div> |
|
275 | 275 | <div class="theme-description">{{{ data.description }}}</div> |
276 | 276 | </div> |
277 | 277 | </div> |
278 | 278 | </div> |
279 | 279 | <div class="wp-full-overlay-footer"> |
280 | 280 | <div class="devices"> |
281 | - <button type="button" class="preview-desktop active" aria-pressed="true" data-device="desktop"><span class="screen-reader-text"><?php _e( 'Enter desktop preview mode' ); ?></span></button> |
|
282 | - <button type="button" class="preview-tablet" aria-pressed="false" data-device="tablet"><span class="screen-reader-text"><?php _e( 'Enter tablet preview mode' ); ?></span></button> |
|
283 | - <button type="button" class="preview-mobile" aria-pressed="false" data-device="mobile"><span class="screen-reader-text"><?php _e( 'Enter mobile preview mode' ); ?></span></button> |
|
281 | + <button type="button" class="preview-desktop active" aria-pressed="true" data-device="desktop"><span class="screen-reader-text"><?php _e('Enter desktop preview mode'); ?></span></button> |
|
282 | + <button type="button" class="preview-tablet" aria-pressed="false" data-device="tablet"><span class="screen-reader-text"><?php _e('Enter tablet preview mode'); ?></span></button> |
|
283 | + <button type="button" class="preview-mobile" aria-pressed="false" data-device="mobile"><span class="screen-reader-text"><?php _e('Enter mobile preview mode'); ?></span></button> |
|
284 | 284 | </div> |
285 | - <button type="button" class="collapse-sidebar button-secondary" aria-expanded="true" aria-label="<?php esc_attr_e( 'Collapse Sidebar' ); ?>"> |
|
285 | + <button type="button" class="collapse-sidebar button-secondary" aria-expanded="true" aria-label="<?php esc_attr_e('Collapse Sidebar'); ?>"> |
|
286 | 286 | <span class="collapse-sidebar-arrow"></span> |
287 | - <span class="collapse-sidebar-label"><?php _e( 'Collapse' ); ?></span> |
|
287 | + <span class="collapse-sidebar-label"><?php _e('Collapse'); ?></span> |
|
288 | 288 | </button> |
289 | 289 | </div> |
290 | 290 | </div> |
291 | 291 | <div class="wp-full-overlay-main"> |
292 | - <iframe src="{{ data.preview_url }}" title="<?php esc_attr_e( 'Preview' ); ?>" /> |
|
292 | + <iframe src="{{ data.preview_url }}" title="<?php esc_attr_e('Preview'); ?>" /> |
|
293 | 293 | </div> |
294 | 294 | </script> |
295 | 295 | |
296 | 296 | <?php |
297 | -include(ABSPATH . 'wp-admin/admin-footer.php'); |
|
297 | +include(ABSPATH.'wp-admin/admin-footer.php'); |
@@ -1,12 +1,12 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * WordPress Administration Scheme API |
|
4 | - * |
|
5 | - * Here we keep the DB structure and option values. |
|
6 | - * |
|
7 | - * @package WordPress |
|
8 | - * @subpackage Administration |
|
9 | - */ |
|
3 | + * WordPress Administration Scheme API |
|
4 | + * |
|
5 | + * Here we keep the DB structure and option values. |
|
6 | + * |
|
7 | + * @package WordPress |
|
8 | + * @subpackage Administration |
|
9 | + */ |
|
10 | 10 | |
11 | 11 | /** |
12 | 12 | * Declare these as global in case schema.php is included from a function. |
@@ -33,21 +33,21 @@ discard block |
||
33 | 33 | * @param int $blog_id Optional. The site ID for which to retrieve SQL. Default is the current site ID. |
34 | 34 | * @return string The SQL needed to create the requested tables. |
35 | 35 | */ |
36 | -function wp_get_db_schema( $scope = 'all', $blog_id = null ) { |
|
36 | +function wp_get_db_schema($scope = 'all', $blog_id = null) { |
|
37 | 37 | global $wpdb; |
38 | 38 | |
39 | 39 | $charset_collate = ''; |
40 | 40 | |
41 | - if ( ! empty($wpdb->charset) ) |
|
41 | + if ( ! empty($wpdb->charset)) |
|
42 | 42 | $charset_collate = "DEFAULT CHARACTER SET $wpdb->charset"; |
43 | - if ( ! empty($wpdb->collate) ) |
|
43 | + if ( ! empty($wpdb->collate)) |
|
44 | 44 | $charset_collate .= " COLLATE $wpdb->collate"; |
45 | 45 | |
46 | - if ( $blog_id && $blog_id != $wpdb->blogid ) |
|
47 | - $old_blog_id = $wpdb->set_blog_id( $blog_id ); |
|
46 | + if ($blog_id && $blog_id != $wpdb->blogid) |
|
47 | + $old_blog_id = $wpdb->set_blog_id($blog_id); |
|
48 | 48 | |
49 | 49 | // Engage multisite if in the middle of turning it on from network.php. |
50 | - $is_multisite = is_multisite() || ( defined( 'WP_INSTALLING_NETWORK' ) && WP_INSTALLING_NETWORK ); |
|
50 | + $is_multisite = is_multisite() || (defined('WP_INSTALLING_NETWORK') && WP_INSTALLING_NETWORK); |
|
51 | 51 | |
52 | 52 | /* |
53 | 53 | * Indexes have a maximum size of 767 bytes. Historically, we haven't need to be concerned about that. |
@@ -240,10 +240,10 @@ discard block |
||
240 | 240 | ) $charset_collate;\n"; |
241 | 241 | |
242 | 242 | // Global tables |
243 | - if ( $is_multisite ) |
|
244 | - $global_tables = $users_multi_table . $usermeta_table; |
|
243 | + if ($is_multisite) |
|
244 | + $global_tables = $users_multi_table.$usermeta_table; |
|
245 | 245 | else |
246 | - $global_tables = $users_single_table . $usermeta_table; |
|
246 | + $global_tables = $users_single_table.$usermeta_table; |
|
247 | 247 | |
248 | 248 | // Multisite global tables. |
249 | 249 | $ms_global_tables = "CREATE TABLE $wpdb->blogs ( |
@@ -314,13 +314,13 @@ discard block |
||
314 | 314 | KEY domain_path (domain(140),path(51)) |
315 | 315 | ) $charset_collate;"; |
316 | 316 | |
317 | - switch ( $scope ) { |
|
317 | + switch ($scope) { |
|
318 | 318 | case 'blog' : |
319 | 319 | $queries = $blog_tables; |
320 | 320 | break; |
321 | 321 | case 'global' : |
322 | 322 | $queries = $global_tables; |
323 | - if ( $is_multisite ) |
|
323 | + if ($is_multisite) |
|
324 | 324 | $queries .= $ms_global_tables; |
325 | 325 | break; |
326 | 326 | case 'ms_global' : |
@@ -328,20 +328,20 @@ discard block |
||
328 | 328 | break; |
329 | 329 | case 'all' : |
330 | 330 | default: |
331 | - $queries = $global_tables . $blog_tables; |
|
332 | - if ( $is_multisite ) |
|
331 | + $queries = $global_tables.$blog_tables; |
|
332 | + if ($is_multisite) |
|
333 | 333 | $queries .= $ms_global_tables; |
334 | 334 | break; |
335 | 335 | } |
336 | 336 | |
337 | - if ( isset( $old_blog_id ) ) |
|
338 | - $wpdb->set_blog_id( $old_blog_id ); |
|
337 | + if (isset($old_blog_id)) |
|
338 | + $wpdb->set_blog_id($old_blog_id); |
|
339 | 339 | |
340 | 340 | return $queries; |
341 | 341 | } |
342 | 342 | |
343 | 343 | // Populate for back compat. |
344 | -$wp_queries = wp_get_db_schema( 'all' ); |
|
344 | +$wp_queries = wp_get_db_schema('all'); |
|
345 | 345 | |
346 | 346 | /** |
347 | 347 | * Create WordPress options and set the default values. |
@@ -361,9 +361,9 @@ discard block |
||
361 | 361 | * |
362 | 362 | * @since 2.6.0 |
363 | 363 | */ |
364 | - do_action( 'populate_options' ); |
|
364 | + do_action('populate_options'); |
|
365 | 365 | |
366 | - if ( ini_get('safe_mode') ) { |
|
366 | + if (ini_get('safe_mode')) { |
|
367 | 367 | // Safe mode can break mkdir() so use a flat structure by default. |
368 | 368 | $uploads_use_yearmonth_folders = 0; |
369 | 369 | } else { |
@@ -372,13 +372,13 @@ discard block |
||
372 | 372 | |
373 | 373 | // If WP_DEFAULT_THEME doesn't exist, fall back to the latest core default theme. |
374 | 374 | $stylesheet = $template = WP_DEFAULT_THEME; |
375 | - $theme = wp_get_theme( WP_DEFAULT_THEME ); |
|
376 | - if ( ! $theme->exists() ) { |
|
375 | + $theme = wp_get_theme(WP_DEFAULT_THEME); |
|
376 | + if ( ! $theme->exists()) { |
|
377 | 377 | $theme = WP_Theme::get_core_default_theme(); |
378 | 378 | } |
379 | 379 | |
380 | 380 | // If we can't find a core default theme, WP_DEFAULT_THEME is the best we can do. |
381 | - if ( $theme ) { |
|
381 | + if ($theme) { |
|
382 | 382 | $stylesheet = $theme->get_stylesheet(); |
383 | 383 | $template = $theme->get_template(); |
384 | 384 | } |
@@ -389,10 +389,10 @@ discard block |
||
389 | 389 | or a valid timezone string (America/New_York). See http://us3.php.net/manual/en/timezones.php |
390 | 390 | for all timezone strings supported by PHP. |
391 | 391 | */ |
392 | - $offset_or_tz = _x( '0', 'default GMT offset or timezone string' ); |
|
393 | - if ( is_numeric( $offset_or_tz ) ) |
|
392 | + $offset_or_tz = _x('0', 'default GMT offset or timezone string'); |
|
393 | + if (is_numeric($offset_or_tz)) |
|
394 | 394 | $gmt_offset = $offset_or_tz; |
395 | - elseif ( $offset_or_tz && in_array( $offset_or_tz, timezone_identifiers_list() ) ) |
|
395 | + elseif ($offset_or_tz && in_array($offset_or_tz, timezone_identifiers_list())) |
|
396 | 396 | $timezone_string = $offset_or_tz; |
397 | 397 | |
398 | 398 | $options = array( |
@@ -404,7 +404,7 @@ discard block |
||
404 | 404 | 'users_can_register' => 0, |
405 | 405 | 'admin_email' => '[email protected]', |
406 | 406 | /* translators: default start of the week. 0 = Sunday, 1 = Monday */ |
407 | - 'start_of_week' => _x( '1', 'start of week' ), |
|
407 | + 'start_of_week' => _x('1', 'start of week'), |
|
408 | 408 | 'use_balanceTags' => 0, |
409 | 409 | 'use_smilies' => 1, |
410 | 410 | 'require_name_email' => 1, |
@@ -524,45 +524,45 @@ discard block |
||
524 | 524 | ); |
525 | 525 | |
526 | 526 | // 3.3 |
527 | - if ( ! is_multisite() ) { |
|
528 | - $options['initial_db_version'] = ! empty( $wp_current_db_version ) && $wp_current_db_version < $wp_db_version |
|
527 | + if ( ! is_multisite()) { |
|
528 | + $options['initial_db_version'] = ! empty($wp_current_db_version) && $wp_current_db_version < $wp_db_version |
|
529 | 529 | ? $wp_current_db_version : $wp_db_version; |
530 | 530 | } |
531 | 531 | |
532 | 532 | // 3.0 multisite |
533 | - if ( is_multisite() ) { |
|
533 | + if (is_multisite()) { |
|
534 | 534 | /* translators: site tagline */ |
535 | - $options[ 'blogdescription' ] = sprintf(__('Just another %s site'), get_current_site()->site_name ); |
|
536 | - $options[ 'permalink_structure' ] = '/%year%/%monthnum%/%day%/%postname%/'; |
|
535 | + $options['blogdescription'] = sprintf(__('Just another %s site'), get_current_site()->site_name); |
|
536 | + $options['permalink_structure'] = '/%year%/%monthnum%/%day%/%postname%/'; |
|
537 | 537 | } |
538 | 538 | |
539 | 539 | // Set autoload to no for these options |
540 | - $fat_options = array( 'moderation_keys', 'recently_edited', 'blacklist_keys', 'uninstall_plugins' ); |
|
540 | + $fat_options = array('moderation_keys', 'recently_edited', 'blacklist_keys', 'uninstall_plugins'); |
|
541 | 541 | |
542 | - $keys = "'" . implode( "', '", array_keys( $options ) ) . "'"; |
|
543 | - $existing_options = $wpdb->get_col( "SELECT option_name FROM $wpdb->options WHERE option_name in ( $keys )" ); |
|
542 | + $keys = "'".implode("', '", array_keys($options))."'"; |
|
543 | + $existing_options = $wpdb->get_col("SELECT option_name FROM $wpdb->options WHERE option_name in ( $keys )"); |
|
544 | 544 | |
545 | 545 | $insert = ''; |
546 | - foreach ( $options as $option => $value ) { |
|
547 | - if ( in_array($option, $existing_options) ) |
|
546 | + foreach ($options as $option => $value) { |
|
547 | + if (in_array($option, $existing_options)) |
|
548 | 548 | continue; |
549 | - if ( in_array($option, $fat_options) ) |
|
549 | + if (in_array($option, $fat_options)) |
|
550 | 550 | $autoload = 'no'; |
551 | 551 | else |
552 | 552 | $autoload = 'yes'; |
553 | 553 | |
554 | - if ( is_array($value) ) |
|
554 | + if (is_array($value)) |
|
555 | 555 | $value = serialize($value); |
556 | - if ( !empty($insert) ) |
|
556 | + if ( ! empty($insert)) |
|
557 | 557 | $insert .= ', '; |
558 | - $insert .= $wpdb->prepare( "(%s, %s, %s)", $option, $value, $autoload ); |
|
558 | + $insert .= $wpdb->prepare("(%s, %s, %s)", $option, $value, $autoload); |
|
559 | 559 | } |
560 | 560 | |
561 | - if ( !empty($insert) ) |
|
562 | - $wpdb->query("INSERT INTO $wpdb->options (option_name, option_value, autoload) VALUES " . $insert); |
|
561 | + if ( ! empty($insert)) |
|
562 | + $wpdb->query("INSERT INTO $wpdb->options (option_name, option_value, autoload) VALUES ".$insert); |
|
563 | 563 | |
564 | 564 | // In case it is set, but blank, update "home". |
565 | - if ( !__get_option('home') ) update_option('home', $guessurl); |
|
565 | + if ( ! __get_option('home')) update_option('home', $guessurl); |
|
566 | 566 | |
567 | 567 | // Delete unused options. |
568 | 568 | $unusedoptions = array( |
@@ -583,7 +583,7 @@ discard block |
||
583 | 583 | 'wporg_popular_tags', 'what_to_show', 'rss_language', 'language', 'enable_xmlrpc', 'enable_app', |
584 | 584 | 'embed_autourls', 'default_post_edit_rows', 'gzipcompression', 'advanced_edit' |
585 | 585 | ); |
586 | - foreach ( $unusedoptions as $option ) |
|
586 | + foreach ($unusedoptions as $option) |
|
587 | 587 | delete_option($option); |
588 | 588 | |
589 | 589 | // Delete obsolete magpie stuff. |
@@ -600,15 +600,15 @@ discard block |
||
600 | 600 | AND a.option_name NOT LIKE %s |
601 | 601 | AND b.option_name = CONCAT( '_transient_timeout_', SUBSTRING( a.option_name, 12 ) ) |
602 | 602 | AND b.option_value < %d"; |
603 | - $wpdb->query( $wpdb->prepare( $sql, $wpdb->esc_like( '_transient_' ) . '%', $wpdb->esc_like( '_transient_timeout_' ) . '%', $time ) ); |
|
603 | + $wpdb->query($wpdb->prepare($sql, $wpdb->esc_like('_transient_').'%', $wpdb->esc_like('_transient_timeout_').'%', $time)); |
|
604 | 604 | |
605 | - if ( is_main_site() && is_main_network() ) { |
|
605 | + if (is_main_site() && is_main_network()) { |
|
606 | 606 | $sql = "DELETE a, b FROM $wpdb->options a, $wpdb->options b |
607 | 607 | WHERE a.option_name LIKE %s |
608 | 608 | AND a.option_name NOT LIKE %s |
609 | 609 | AND b.option_name = CONCAT( '_site_transient_timeout_', SUBSTRING( a.option_name, 17 ) ) |
610 | 610 | AND b.option_value < %d"; |
611 | - $wpdb->query( $wpdb->prepare( $sql, $wpdb->esc_like( '_site_transient_' ) . '%', $wpdb->esc_like( '_site_transient_timeout_' ) . '%', $time ) ); |
|
611 | + $wpdb->query($wpdb->prepare($sql, $wpdb->esc_like('_site_transient_').'%', $wpdb->esc_like('_site_transient_timeout_').'%', $time)); |
|
612 | 612 | } |
613 | 613 | } |
614 | 614 | |
@@ -742,7 +742,7 @@ discard block |
||
742 | 742 | $roles = array('administrator', 'editor'); |
743 | 743 | foreach ($roles as $role) { |
744 | 744 | $role = get_role($role); |
745 | - if ( empty($role) ) |
|
745 | + if (empty($role)) |
|
746 | 746 | continue; |
747 | 747 | |
748 | 748 | $role->add_cap('edit_others_pages'); |
@@ -763,19 +763,19 @@ discard block |
||
763 | 763 | } |
764 | 764 | |
765 | 765 | $role = get_role('administrator'); |
766 | - if ( ! empty($role) ) { |
|
766 | + if ( ! empty($role)) { |
|
767 | 767 | $role->add_cap('delete_users'); |
768 | 768 | $role->add_cap('create_users'); |
769 | 769 | } |
770 | 770 | |
771 | 771 | $role = get_role('author'); |
772 | - if ( ! empty($role) ) { |
|
772 | + if ( ! empty($role)) { |
|
773 | 773 | $role->add_cap('delete_posts'); |
774 | 774 | $role->add_cap('delete_published_posts'); |
775 | 775 | } |
776 | 776 | |
777 | 777 | $role = get_role('contributor'); |
778 | - if ( ! empty($role) ) { |
|
778 | + if ( ! empty($role)) { |
|
779 | 779 | $role->add_cap('delete_posts'); |
780 | 780 | } |
781 | 781 | } |
@@ -786,10 +786,10 @@ discard block |
||
786 | 786 | * @since 2.3.0 |
787 | 787 | */ |
788 | 788 | function populate_roles_230() { |
789 | - $role = get_role( 'administrator' ); |
|
789 | + $role = get_role('administrator'); |
|
790 | 790 | |
791 | - if ( !empty( $role ) ) { |
|
792 | - $role->add_cap( 'unfiltered_upload' ); |
|
791 | + if ( ! empty($role)) { |
|
792 | + $role->add_cap('unfiltered_upload'); |
|
793 | 793 | } |
794 | 794 | } |
795 | 795 | |
@@ -799,10 +799,10 @@ discard block |
||
799 | 799 | * @since 2.5.0 |
800 | 800 | */ |
801 | 801 | function populate_roles_250() { |
802 | - $role = get_role( 'administrator' ); |
|
802 | + $role = get_role('administrator'); |
|
803 | 803 | |
804 | - if ( !empty( $role ) ) { |
|
805 | - $role->add_cap( 'edit_dashboard' ); |
|
804 | + if ( ! empty($role)) { |
|
805 | + $role->add_cap('edit_dashboard'); |
|
806 | 806 | } |
807 | 807 | } |
808 | 808 | |
@@ -812,11 +812,11 @@ discard block |
||
812 | 812 | * @since 2.6.0 |
813 | 813 | */ |
814 | 814 | function populate_roles_260() { |
815 | - $role = get_role( 'administrator' ); |
|
815 | + $role = get_role('administrator'); |
|
816 | 816 | |
817 | - if ( !empty( $role ) ) { |
|
818 | - $role->add_cap( 'update_plugins' ); |
|
819 | - $role->add_cap( 'delete_plugins' ); |
|
817 | + if ( ! empty($role)) { |
|
818 | + $role->add_cap('update_plugins'); |
|
819 | + $role->add_cap('delete_plugins'); |
|
820 | 820 | } |
821 | 821 | } |
822 | 822 | |
@@ -826,11 +826,11 @@ discard block |
||
826 | 826 | * @since 2.7.0 |
827 | 827 | */ |
828 | 828 | function populate_roles_270() { |
829 | - $role = get_role( 'administrator' ); |
|
829 | + $role = get_role('administrator'); |
|
830 | 830 | |
831 | - if ( !empty( $role ) ) { |
|
832 | - $role->add_cap( 'install_plugins' ); |
|
833 | - $role->add_cap( 'update_themes' ); |
|
831 | + if ( ! empty($role)) { |
|
832 | + $role->add_cap('install_plugins'); |
|
833 | + $role->add_cap('update_themes'); |
|
834 | 834 | } |
835 | 835 | } |
836 | 836 | |
@@ -840,10 +840,10 @@ discard block |
||
840 | 840 | * @since 2.8.0 |
841 | 841 | */ |
842 | 842 | function populate_roles_280() { |
843 | - $role = get_role( 'administrator' ); |
|
843 | + $role = get_role('administrator'); |
|
844 | 844 | |
845 | - if ( !empty( $role ) ) { |
|
846 | - $role->add_cap( 'install_themes' ); |
|
845 | + if ( ! empty($role)) { |
|
846 | + $role->add_cap('install_themes'); |
|
847 | 847 | } |
848 | 848 | } |
849 | 849 | |
@@ -853,16 +853,16 @@ discard block |
||
853 | 853 | * @since 3.0.0 |
854 | 854 | */ |
855 | 855 | function populate_roles_300() { |
856 | - $role = get_role( 'administrator' ); |
|
857 | - |
|
858 | - if ( !empty( $role ) ) { |
|
859 | - $role->add_cap( 'update_core' ); |
|
860 | - $role->add_cap( 'list_users' ); |
|
861 | - $role->add_cap( 'remove_users' ); |
|
862 | - $role->add_cap( 'promote_users' ); |
|
863 | - $role->add_cap( 'edit_theme_options' ); |
|
864 | - $role->add_cap( 'delete_themes' ); |
|
865 | - $role->add_cap( 'export' ); |
|
856 | + $role = get_role('administrator'); |
|
857 | + |
|
858 | + if ( ! empty($role)) { |
|
859 | + $role->add_cap('update_core'); |
|
860 | + $role->add_cap('list_users'); |
|
861 | + $role->add_cap('remove_users'); |
|
862 | + $role->add_cap('promote_users'); |
|
863 | + $role->add_cap('edit_theme_options'); |
|
864 | + $role->add_cap('delete_themes'); |
|
865 | + $role->add_cap('export'); |
|
866 | 866 | } |
867 | 867 | } |
868 | 868 | |
@@ -872,12 +872,12 @@ discard block |
||
872 | 872 | * @since 3.0.0 |
873 | 873 | * |
874 | 874 | */ |
875 | -if ( !function_exists( 'install_network' ) ) : |
|
875 | +if ( ! function_exists('install_network')) : |
|
876 | 876 | function install_network() { |
877 | - if ( ! defined( 'WP_INSTALLING_NETWORK' ) ) |
|
878 | - define( 'WP_INSTALLING_NETWORK', true ); |
|
877 | + if ( ! defined('WP_INSTALLING_NETWORK')) |
|
878 | + define('WP_INSTALLING_NETWORK', true); |
|
879 | 879 | |
880 | - dbDelta( wp_get_db_schema( 'global' ) ); |
|
880 | + dbDelta(wp_get_db_schema('global')); |
|
881 | 881 | } |
882 | 882 | endif; |
883 | 883 | |
@@ -901,75 +901,75 @@ discard block |
||
901 | 901 | * @return bool|WP_Error True on success, or WP_Error on warning (with the install otherwise successful, |
902 | 902 | * so the error code must be checked) or failure. |
903 | 903 | */ |
904 | -function populate_network( $network_id = 1, $domain = '', $email = '', $site_name = '', $path = '/', $subdomain_install = false ) { |
|
904 | +function populate_network($network_id = 1, $domain = '', $email = '', $site_name = '', $path = '/', $subdomain_install = false) { |
|
905 | 905 | global $wpdb, $current_site, $wp_db_version, $wp_rewrite; |
906 | 906 | |
907 | 907 | $errors = new WP_Error(); |
908 | - if ( '' == $domain ) |
|
909 | - $errors->add( 'empty_domain', __( 'You must provide a domain name.' ) ); |
|
910 | - if ( '' == $site_name ) |
|
911 | - $errors->add( 'empty_sitename', __( 'You must provide a name for your network of sites.' ) ); |
|
908 | + if ('' == $domain) |
|
909 | + $errors->add('empty_domain', __('You must provide a domain name.')); |
|
910 | + if ('' == $site_name) |
|
911 | + $errors->add('empty_sitename', __('You must provide a name for your network of sites.')); |
|
912 | 912 | |
913 | 913 | // Check for network collision. |
914 | - if ( $network_id == $wpdb->get_var( $wpdb->prepare( "SELECT id FROM $wpdb->site WHERE id = %d", $network_id ) ) ) |
|
915 | - $errors->add( 'siteid_exists', __( 'The network already exists.' ) ); |
|
914 | + if ($network_id == $wpdb->get_var($wpdb->prepare("SELECT id FROM $wpdb->site WHERE id = %d", $network_id))) |
|
915 | + $errors->add('siteid_exists', __('The network already exists.')); |
|
916 | 916 | |
917 | - if ( ! is_email( $email ) ) |
|
918 | - $errors->add( 'invalid_email', __( 'You must provide a valid email address.' ) ); |
|
917 | + if ( ! is_email($email)) |
|
918 | + $errors->add('invalid_email', __('You must provide a valid email address.')); |
|
919 | 919 | |
920 | - if ( $errors->get_error_code() ) |
|
920 | + if ($errors->get_error_code()) |
|
921 | 921 | return $errors; |
922 | 922 | |
923 | 923 | // If a user with the provided email does not exist, default to the current user as the new network admin. |
924 | - $site_user = get_user_by( 'email', $email ); |
|
925 | - if ( false === $site_user ) { |
|
924 | + $site_user = get_user_by('email', $email); |
|
925 | + if (false === $site_user) { |
|
926 | 926 | $site_user = wp_get_current_user(); |
927 | 927 | } |
928 | 928 | |
929 | 929 | // Set up site tables. |
930 | - $template = get_option( 'template' ); |
|
931 | - $stylesheet = get_option( 'stylesheet' ); |
|
932 | - $allowed_themes = array( $stylesheet => true ); |
|
930 | + $template = get_option('template'); |
|
931 | + $stylesheet = get_option('stylesheet'); |
|
932 | + $allowed_themes = array($stylesheet => true); |
|
933 | 933 | |
934 | - if ( $template != $stylesheet ) { |
|
935 | - $allowed_themes[ $template ] = true; |
|
934 | + if ($template != $stylesheet) { |
|
935 | + $allowed_themes[$template] = true; |
|
936 | 936 | } |
937 | 937 | |
938 | - if ( WP_DEFAULT_THEME != $stylesheet && WP_DEFAULT_THEME != $template ) { |
|
939 | - $allowed_themes[ WP_DEFAULT_THEME ] = true; |
|
938 | + if (WP_DEFAULT_THEME != $stylesheet && WP_DEFAULT_THEME != $template) { |
|
939 | + $allowed_themes[WP_DEFAULT_THEME] = true; |
|
940 | 940 | } |
941 | 941 | |
942 | 942 | // If WP_DEFAULT_THEME doesn't exist, also whitelist the latest core default theme. |
943 | - if ( ! wp_get_theme( WP_DEFAULT_THEME )->exists() ) { |
|
944 | - if ( $core_default = WP_Theme::get_core_default_theme() ) { |
|
945 | - $allowed_themes[ $core_default->get_stylesheet() ] = true; |
|
943 | + if ( ! wp_get_theme(WP_DEFAULT_THEME)->exists()) { |
|
944 | + if ($core_default = WP_Theme::get_core_default_theme()) { |
|
945 | + $allowed_themes[$core_default->get_stylesheet()] = true; |
|
946 | 946 | } |
947 | 947 | } |
948 | 948 | |
949 | - if ( 1 == $network_id ) { |
|
950 | - $wpdb->insert( $wpdb->site, array( 'domain' => $domain, 'path' => $path ) ); |
|
949 | + if (1 == $network_id) { |
|
950 | + $wpdb->insert($wpdb->site, array('domain' => $domain, 'path' => $path)); |
|
951 | 951 | $network_id = $wpdb->insert_id; |
952 | 952 | } else { |
953 | - $wpdb->insert( $wpdb->site, array( 'domain' => $domain, 'path' => $path, 'id' => $network_id ) ); |
|
953 | + $wpdb->insert($wpdb->site, array('domain' => $domain, 'path' => $path, 'id' => $network_id)); |
|
954 | 954 | } |
955 | 955 | |
956 | - wp_cache_delete( 'networks_have_paths', 'site-options' ); |
|
956 | + wp_cache_delete('networks_have_paths', 'site-options'); |
|
957 | 957 | |
958 | - if ( !is_multisite() ) { |
|
959 | - $site_admins = array( $site_user->user_login ); |
|
960 | - $users = get_users( array( 'fields' => array( 'ID', 'user_login' ) ) ); |
|
961 | - if ( $users ) { |
|
962 | - foreach ( $users as $user ) { |
|
963 | - if ( is_super_admin( $user->ID ) && !in_array( $user->user_login, $site_admins ) ) |
|
958 | + if ( ! is_multisite()) { |
|
959 | + $site_admins = array($site_user->user_login); |
|
960 | + $users = get_users(array('fields' => array('ID', 'user_login'))); |
|
961 | + if ($users) { |
|
962 | + foreach ($users as $user) { |
|
963 | + if (is_super_admin($user->ID) && ! in_array($user->user_login, $site_admins)) |
|
964 | 964 | $site_admins[] = $user->user_login; |
965 | 965 | } |
966 | 966 | } |
967 | 967 | } else { |
968 | - $site_admins = get_site_option( 'site_admins' ); |
|
968 | + $site_admins = get_site_option('site_admins'); |
|
969 | 969 | } |
970 | 970 | |
971 | 971 | /* translators: Do not translate USERNAME, SITE_NAME, BLOG_URL, PASSWORD: those are placeholders. */ |
972 | - $welcome_email = __( 'Howdy USERNAME, |
|
972 | + $welcome_email = __('Howdy USERNAME, |
|
973 | 973 | |
974 | 974 | Your new SITE_NAME site has been successfully set up at: |
975 | 975 | BLOG_URL |
@@ -996,35 +996,35 @@ discard block |
||
996 | 996 | ); |
997 | 997 | $audio_exts = wp_get_audio_extensions(); |
998 | 998 | $video_exts = wp_get_video_extensions(); |
999 | - $upload_filetypes = array_unique( array_merge( $misc_exts, $audio_exts, $video_exts ) ); |
|
999 | + $upload_filetypes = array_unique(array_merge($misc_exts, $audio_exts, $video_exts)); |
|
1000 | 1000 | |
1001 | 1001 | $sitemeta = array( |
1002 | 1002 | 'site_name' => $site_name, |
1003 | 1003 | 'admin_email' => $email, |
1004 | 1004 | 'admin_user_id' => $site_user->ID, |
1005 | 1005 | 'registration' => 'none', |
1006 | - 'upload_filetypes' => implode( ' ', $upload_filetypes ), |
|
1006 | + 'upload_filetypes' => implode(' ', $upload_filetypes), |
|
1007 | 1007 | 'blog_upload_space' => 100, |
1008 | 1008 | 'fileupload_maxk' => 1500, |
1009 | 1009 | 'site_admins' => $site_admins, |
1010 | 1010 | 'allowedthemes' => $allowed_themes, |
1011 | - 'illegal_names' => array( 'www', 'web', 'root', 'admin', 'main', 'invite', 'administrator', 'files' ), |
|
1011 | + 'illegal_names' => array('www', 'web', 'root', 'admin', 'main', 'invite', 'administrator', 'files'), |
|
1012 | 1012 | 'wpmu_upgrade_site' => $wp_db_version, |
1013 | 1013 | 'welcome_email' => $welcome_email, |
1014 | 1014 | /* translators: %s: site link */ |
1015 | - 'first_post' => __( 'Welcome to %s. This is your first post. Edit or delete it, then start blogging!' ), |
|
1015 | + 'first_post' => __('Welcome to %s. This is your first post. Edit or delete it, then start blogging!'), |
|
1016 | 1016 | // @todo - network admins should have a method of editing the network siteurl (used for cookie hash) |
1017 | - 'siteurl' => get_option( 'siteurl' ) . '/', |
|
1017 | + 'siteurl' => get_option('siteurl').'/', |
|
1018 | 1018 | 'add_new_users' => '0', |
1019 | - 'upload_space_check_disabled' => is_multisite() ? get_site_option( 'upload_space_check_disabled' ) : '1', |
|
1020 | - 'subdomain_install' => intval( $subdomain_install ), |
|
1019 | + 'upload_space_check_disabled' => is_multisite() ? get_site_option('upload_space_check_disabled') : '1', |
|
1020 | + 'subdomain_install' => intval($subdomain_install), |
|
1021 | 1021 | 'global_terms_enabled' => global_terms_enabled() ? '1' : '0', |
1022 | - 'ms_files_rewriting' => is_multisite() ? get_site_option( 'ms_files_rewriting' ) : '0', |
|
1023 | - 'initial_db_version' => get_option( 'initial_db_version' ), |
|
1022 | + 'ms_files_rewriting' => is_multisite() ? get_site_option('ms_files_rewriting') : '0', |
|
1023 | + 'initial_db_version' => get_option('initial_db_version'), |
|
1024 | 1024 | 'active_sitewide_plugins' => array(), |
1025 | 1025 | 'WPLANG' => get_locale(), |
1026 | 1026 | ); |
1027 | - if ( ! $subdomain_install ) |
|
1027 | + if ( ! $subdomain_install) |
|
1028 | 1028 | $sitemeta['illegal_names'][] = 'blog'; |
1029 | 1029 | |
1030 | 1030 | /** |
@@ -1035,17 +1035,17 @@ discard block |
||
1035 | 1035 | * @param array $sitemeta Associative array of network meta keys and values to be inserted. |
1036 | 1036 | * @param int $network_id ID of network to populate. |
1037 | 1037 | */ |
1038 | - $sitemeta = apply_filters( 'populate_network_meta', $sitemeta, $network_id ); |
|
1038 | + $sitemeta = apply_filters('populate_network_meta', $sitemeta, $network_id); |
|
1039 | 1039 | |
1040 | 1040 | $insert = ''; |
1041 | - foreach ( $sitemeta as $meta_key => $meta_value ) { |
|
1042 | - if ( is_array( $meta_value ) ) |
|
1043 | - $meta_value = serialize( $meta_value ); |
|
1044 | - if ( !empty( $insert ) ) |
|
1041 | + foreach ($sitemeta as $meta_key => $meta_value) { |
|
1042 | + if (is_array($meta_value)) |
|
1043 | + $meta_value = serialize($meta_value); |
|
1044 | + if ( ! empty($insert)) |
|
1045 | 1045 | $insert .= ', '; |
1046 | - $insert .= $wpdb->prepare( "( %d, %s, %s)", $network_id, $meta_key, $meta_value ); |
|
1046 | + $insert .= $wpdb->prepare("( %d, %s, %s)", $network_id, $meta_key, $meta_value); |
|
1047 | 1047 | } |
1048 | - $wpdb->query( "INSERT INTO $wpdb->sitemeta ( site_id, meta_key, meta_value ) VALUES " . $insert ); |
|
1048 | + $wpdb->query("INSERT INTO $wpdb->sitemeta ( site_id, meta_key, meta_value ) VALUES ".$insert); |
|
1049 | 1049 | |
1050 | 1050 | /* |
1051 | 1051 | * When upgrading from single to multisite, assume the current site will |
@@ -1054,58 +1054,58 @@ discard block |
||
1054 | 1054 | * these steps since the main site of the new network has not yet been |
1055 | 1055 | * created. |
1056 | 1056 | */ |
1057 | - if ( ! is_multisite() ) { |
|
1057 | + if ( ! is_multisite()) { |
|
1058 | 1058 | $current_site = new stdClass; |
1059 | 1059 | $current_site->domain = $domain; |
1060 | 1060 | $current_site->path = $path; |
1061 | - $current_site->site_name = ucfirst( $domain ); |
|
1062 | - $wpdb->insert( $wpdb->blogs, array( 'site_id' => $network_id, 'blog_id' => 1, 'domain' => $domain, 'path' => $path, 'registered' => current_time( 'mysql' ) ) ); |
|
1061 | + $current_site->site_name = ucfirst($domain); |
|
1062 | + $wpdb->insert($wpdb->blogs, array('site_id' => $network_id, 'blog_id' => 1, 'domain' => $domain, 'path' => $path, 'registered' => current_time('mysql'))); |
|
1063 | 1063 | $current_site->blog_id = $blog_id = $wpdb->insert_id; |
1064 | - update_user_meta( $site_user->ID, 'source_domain', $domain ); |
|
1065 | - update_user_meta( $site_user->ID, 'primary_blog', $blog_id ); |
|
1064 | + update_user_meta($site_user->ID, 'source_domain', $domain); |
|
1065 | + update_user_meta($site_user->ID, 'primary_blog', $blog_id); |
|
1066 | 1066 | |
1067 | - if ( $subdomain_install ) |
|
1068 | - $wp_rewrite->set_permalink_structure( '/%year%/%monthnum%/%day%/%postname%/' ); |
|
1067 | + if ($subdomain_install) |
|
1068 | + $wp_rewrite->set_permalink_structure('/%year%/%monthnum%/%day%/%postname%/'); |
|
1069 | 1069 | else |
1070 | - $wp_rewrite->set_permalink_structure( '/blog/%year%/%monthnum%/%day%/%postname%/' ); |
|
1070 | + $wp_rewrite->set_permalink_structure('/blog/%year%/%monthnum%/%day%/%postname%/'); |
|
1071 | 1071 | |
1072 | 1072 | flush_rewrite_rules(); |
1073 | 1073 | |
1074 | - if ( ! $subdomain_install ) |
|
1074 | + if ( ! $subdomain_install) |
|
1075 | 1075 | return true; |
1076 | 1076 | |
1077 | 1077 | $vhost_ok = false; |
1078 | 1078 | $errstr = ''; |
1079 | - $hostname = substr( md5( time() ), 0, 6 ) . '.' . $domain; // Very random hostname! |
|
1080 | - $page = wp_remote_get( 'http://' . $hostname, array( 'timeout' => 5, 'httpversion' => '1.1' ) ); |
|
1081 | - if ( is_wp_error( $page ) ) |
|
1079 | + $hostname = substr(md5(time()), 0, 6).'.'.$domain; // Very random hostname! |
|
1080 | + $page = wp_remote_get('http://'.$hostname, array('timeout' => 5, 'httpversion' => '1.1')); |
|
1081 | + if (is_wp_error($page)) |
|
1082 | 1082 | $errstr = $page->get_error_message(); |
1083 | - elseif ( 200 == wp_remote_retrieve_response_code( $page ) ) |
|
1083 | + elseif (200 == wp_remote_retrieve_response_code($page)) |
|
1084 | 1084 | $vhost_ok = true; |
1085 | 1085 | |
1086 | - if ( ! $vhost_ok ) { |
|
1087 | - $msg = '<p><strong>' . __( 'Warning! Wildcard DNS may not be configured correctly!' ) . '</strong></p>'; |
|
1086 | + if ( ! $vhost_ok) { |
|
1087 | + $msg = '<p><strong>'.__('Warning! Wildcard DNS may not be configured correctly!').'</strong></p>'; |
|
1088 | 1088 | |
1089 | - $msg .= '<p>' . sprintf( |
|
1089 | + $msg .= '<p>'.sprintf( |
|
1090 | 1090 | /* translators: %s: host name */ |
1091 | - __( 'The installer attempted to contact a random hostname (%s) on your domain.' ), |
|
1092 | - '<code>' . $hostname . '</code>' |
|
1091 | + __('The installer attempted to contact a random hostname (%s) on your domain.'), |
|
1092 | + '<code>'.$hostname.'</code>' |
|
1093 | 1093 | ); |
1094 | - if ( ! empty ( $errstr ) ) { |
|
1094 | + if ( ! empty ($errstr)) { |
|
1095 | 1095 | /* translators: %s: error message */ |
1096 | - $msg .= ' ' . sprintf( __( 'This resulted in an error message: %s' ), '<code>' . $errstr . '</code>' ); |
|
1096 | + $msg .= ' '.sprintf(__('This resulted in an error message: %s'), '<code>'.$errstr.'</code>'); |
|
1097 | 1097 | } |
1098 | 1098 | $msg .= '</p>'; |
1099 | 1099 | |
1100 | - $msg .= '<p>' . sprintf( |
|
1100 | + $msg .= '<p>'.sprintf( |
|
1101 | 1101 | /* translators: %s: asterisk symbol (*) */ |
1102 | - __( 'To use a subdomain configuration, you must have a wildcard entry in your DNS. This usually means adding a %s hostname record pointing at your web server in your DNS configuration tool.' ), |
|
1102 | + __('To use a subdomain configuration, you must have a wildcard entry in your DNS. This usually means adding a %s hostname record pointing at your web server in your DNS configuration tool.'), |
|
1103 | 1103 | '<code>*</code>' |
1104 | - ) . '</p>'; |
|
1104 | + ).'</p>'; |
|
1105 | 1105 | |
1106 | - $msg .= '<p>' . __( 'You can still use your site but any subdomain you create may not be accessible. If you know your DNS is correct, ignore this message.' ) . '</p>'; |
|
1106 | + $msg .= '<p>'.__('You can still use your site but any subdomain you create may not be accessible. If you know your DNS is correct, ignore this message.').'</p>'; |
|
1107 | 1107 | |
1108 | - return new WP_Error( 'no_wildcard_dns', $msg ); |
|
1108 | + return new WP_Error('no_wildcard_dns', $msg); |
|
1109 | 1109 | } |
1110 | 1110 | } |
1111 | 1111 |
@@ -38,13 +38,16 @@ discard block |
||
38 | 38 | |
39 | 39 | $charset_collate = ''; |
40 | 40 | |
41 | - if ( ! empty($wpdb->charset) ) |
|
42 | - $charset_collate = "DEFAULT CHARACTER SET $wpdb->charset"; |
|
43 | - if ( ! empty($wpdb->collate) ) |
|
44 | - $charset_collate .= " COLLATE $wpdb->collate"; |
|
41 | + if ( ! empty($wpdb->charset) ) { |
|
42 | + $charset_collate = "DEFAULT CHARACTER SET $wpdb->charset"; |
|
43 | + } |
|
44 | + if ( ! empty($wpdb->collate) ) { |
|
45 | + $charset_collate .= " COLLATE $wpdb->collate"; |
|
46 | + } |
|
45 | 47 | |
46 | - if ( $blog_id && $blog_id != $wpdb->blogid ) |
|
47 | - $old_blog_id = $wpdb->set_blog_id( $blog_id ); |
|
48 | + if ( $blog_id && $blog_id != $wpdb->blogid ) { |
|
49 | + $old_blog_id = $wpdb->set_blog_id( $blog_id ); |
|
50 | + } |
|
48 | 51 | |
49 | 52 | // Engage multisite if in the middle of turning it on from network.php. |
50 | 53 | $is_multisite = is_multisite() || ( defined( 'WP_INSTALLING_NETWORK' ) && WP_INSTALLING_NETWORK ); |
@@ -240,10 +243,11 @@ discard block |
||
240 | 243 | ) $charset_collate;\n"; |
241 | 244 | |
242 | 245 | // Global tables |
243 | - if ( $is_multisite ) |
|
244 | - $global_tables = $users_multi_table . $usermeta_table; |
|
245 | - else |
|
246 | - $global_tables = $users_single_table . $usermeta_table; |
|
246 | + if ( $is_multisite ) { |
|
247 | + $global_tables = $users_multi_table . $usermeta_table; |
|
248 | + } else { |
|
249 | + $global_tables = $users_single_table . $usermeta_table; |
|
250 | + } |
|
247 | 251 | |
248 | 252 | // Multisite global tables. |
249 | 253 | $ms_global_tables = "CREATE TABLE $wpdb->blogs ( |
@@ -320,8 +324,9 @@ discard block |
||
320 | 324 | break; |
321 | 325 | case 'global' : |
322 | 326 | $queries = $global_tables; |
323 | - if ( $is_multisite ) |
|
324 | - $queries .= $ms_global_tables; |
|
327 | + if ( $is_multisite ) { |
|
328 | + $queries .= $ms_global_tables; |
|
329 | + } |
|
325 | 330 | break; |
326 | 331 | case 'ms_global' : |
327 | 332 | $queries = $ms_global_tables; |
@@ -329,13 +334,15 @@ discard block |
||
329 | 334 | case 'all' : |
330 | 335 | default: |
331 | 336 | $queries = $global_tables . $blog_tables; |
332 | - if ( $is_multisite ) |
|
333 | - $queries .= $ms_global_tables; |
|
337 | + if ( $is_multisite ) { |
|
338 | + $queries .= $ms_global_tables; |
|
339 | + } |
|
334 | 340 | break; |
335 | 341 | } |
336 | 342 | |
337 | - if ( isset( $old_blog_id ) ) |
|
338 | - $wpdb->set_blog_id( $old_blog_id ); |
|
343 | + if ( isset( $old_blog_id ) ) { |
|
344 | + $wpdb->set_blog_id( $old_blog_id ); |
|
345 | + } |
|
339 | 346 | |
340 | 347 | return $queries; |
341 | 348 | } |
@@ -390,10 +397,11 @@ discard block |
||
390 | 397 | for all timezone strings supported by PHP. |
391 | 398 | */ |
392 | 399 | $offset_or_tz = _x( '0', 'default GMT offset or timezone string' ); |
393 | - if ( is_numeric( $offset_or_tz ) ) |
|
394 | - $gmt_offset = $offset_or_tz; |
|
395 | - elseif ( $offset_or_tz && in_array( $offset_or_tz, timezone_identifiers_list() ) ) |
|
396 | - $timezone_string = $offset_or_tz; |
|
400 | + if ( is_numeric( $offset_or_tz ) ) { |
|
401 | + $gmt_offset = $offset_or_tz; |
|
402 | + } elseif ( $offset_or_tz && in_array( $offset_or_tz, timezone_identifiers_list() ) ) { |
|
403 | + $timezone_string = $offset_or_tz; |
|
404 | + } |
|
397 | 405 | |
398 | 406 | $options = array( |
399 | 407 | 'siteurl' => $guessurl, |
@@ -544,25 +552,32 @@ discard block |
||
544 | 552 | |
545 | 553 | $insert = ''; |
546 | 554 | foreach ( $options as $option => $value ) { |
547 | - if ( in_array($option, $existing_options) ) |
|
548 | - continue; |
|
549 | - if ( in_array($option, $fat_options) ) |
|
550 | - $autoload = 'no'; |
|
551 | - else |
|
552 | - $autoload = 'yes'; |
|
553 | - |
|
554 | - if ( is_array($value) ) |
|
555 | - $value = serialize($value); |
|
556 | - if ( !empty($insert) ) |
|
557 | - $insert .= ', '; |
|
555 | + if ( in_array($option, $existing_options) ) { |
|
556 | + continue; |
|
557 | + } |
|
558 | + if ( in_array($option, $fat_options) ) { |
|
559 | + $autoload = 'no'; |
|
560 | + } else { |
|
561 | + $autoload = 'yes'; |
|
562 | + } |
|
563 | + |
|
564 | + if ( is_array($value) ) { |
|
565 | + $value = serialize($value); |
|
566 | + } |
|
567 | + if ( !empty($insert) ) { |
|
568 | + $insert .= ', '; |
|
569 | + } |
|
558 | 570 | $insert .= $wpdb->prepare( "(%s, %s, %s)", $option, $value, $autoload ); |
559 | 571 | } |
560 | 572 | |
561 | - if ( !empty($insert) ) |
|
562 | - $wpdb->query("INSERT INTO $wpdb->options (option_name, option_value, autoload) VALUES " . $insert); |
|
573 | + if ( !empty($insert) ) { |
|
574 | + $wpdb->query("INSERT INTO $wpdb->options (option_name, option_value, autoload) VALUES " . $insert); |
|
575 | + } |
|
563 | 576 | |
564 | 577 | // In case it is set, but blank, update "home". |
565 | - if ( !__get_option('home') ) update_option('home', $guessurl); |
|
578 | + if ( !__get_option('home') ) { |
|
579 | + update_option('home', $guessurl); |
|
580 | + } |
|
566 | 581 | |
567 | 582 | // Delete unused options. |
568 | 583 | $unusedoptions = array( |
@@ -583,8 +598,9 @@ discard block |
||
583 | 598 | 'wporg_popular_tags', 'what_to_show', 'rss_language', 'language', 'enable_xmlrpc', 'enable_app', |
584 | 599 | 'embed_autourls', 'default_post_edit_rows', 'gzipcompression', 'advanced_edit' |
585 | 600 | ); |
586 | - foreach ( $unusedoptions as $option ) |
|
587 | - delete_option($option); |
|
601 | + foreach ( $unusedoptions as $option ) { |
|
602 | + delete_option($option); |
|
603 | + } |
|
588 | 604 | |
589 | 605 | // Delete obsolete magpie stuff. |
590 | 606 | $wpdb->query("DELETE FROM $wpdb->options WHERE option_name REGEXP '^rss_[0-9a-f]{32}(_ts)?$'"); |
@@ -742,8 +758,9 @@ discard block |
||
742 | 758 | $roles = array('administrator', 'editor'); |
743 | 759 | foreach ($roles as $role) { |
744 | 760 | $role = get_role($role); |
745 | - if ( empty($role) ) |
|
746 | - continue; |
|
761 | + if ( empty($role) ) { |
|
762 | + continue; |
|
763 | + } |
|
747 | 764 | |
748 | 765 | $role->add_cap('edit_others_pages'); |
749 | 766 | $role->add_cap('edit_published_pages'); |
@@ -874,8 +891,9 @@ discard block |
||
874 | 891 | */ |
875 | 892 | if ( !function_exists( 'install_network' ) ) : |
876 | 893 | function install_network() { |
877 | - if ( ! defined( 'WP_INSTALLING_NETWORK' ) ) |
|
878 | - define( 'WP_INSTALLING_NETWORK', true ); |
|
894 | + if ( ! defined( 'WP_INSTALLING_NETWORK' ) ) { |
|
895 | + define( 'WP_INSTALLING_NETWORK', true ); |
|
896 | + } |
|
879 | 897 | |
880 | 898 | dbDelta( wp_get_db_schema( 'global' ) ); |
881 | 899 | } |
@@ -905,20 +923,25 @@ discard block |
||
905 | 923 | global $wpdb, $current_site, $wp_db_version, $wp_rewrite; |
906 | 924 | |
907 | 925 | $errors = new WP_Error(); |
908 | - if ( '' == $domain ) |
|
909 | - $errors->add( 'empty_domain', __( 'You must provide a domain name.' ) ); |
|
910 | - if ( '' == $site_name ) |
|
911 | - $errors->add( 'empty_sitename', __( 'You must provide a name for your network of sites.' ) ); |
|
926 | + if ( '' == $domain ) { |
|
927 | + $errors->add( 'empty_domain', __( 'You must provide a domain name.' ) ); |
|
928 | + } |
|
929 | + if ( '' == $site_name ) { |
|
930 | + $errors->add( 'empty_sitename', __( 'You must provide a name for your network of sites.' ) ); |
|
931 | + } |
|
912 | 932 | |
913 | 933 | // Check for network collision. |
914 | - if ( $network_id == $wpdb->get_var( $wpdb->prepare( "SELECT id FROM $wpdb->site WHERE id = %d", $network_id ) ) ) |
|
915 | - $errors->add( 'siteid_exists', __( 'The network already exists.' ) ); |
|
934 | + if ( $network_id == $wpdb->get_var( $wpdb->prepare( "SELECT id FROM $wpdb->site WHERE id = %d", $network_id ) ) ) { |
|
935 | + $errors->add( 'siteid_exists', __( 'The network already exists.' ) ); |
|
936 | + } |
|
916 | 937 | |
917 | - if ( ! is_email( $email ) ) |
|
918 | - $errors->add( 'invalid_email', __( 'You must provide a valid email address.' ) ); |
|
938 | + if ( ! is_email( $email ) ) { |
|
939 | + $errors->add( 'invalid_email', __( 'You must provide a valid email address.' ) ); |
|
940 | + } |
|
919 | 941 | |
920 | - if ( $errors->get_error_code() ) |
|
921 | - return $errors; |
|
942 | + if ( $errors->get_error_code() ) { |
|
943 | + return $errors; |
|
944 | + } |
|
922 | 945 | |
923 | 946 | // If a user with the provided email does not exist, default to the current user as the new network admin. |
924 | 947 | $site_user = get_user_by( 'email', $email ); |
@@ -960,8 +983,9 @@ discard block |
||
960 | 983 | $users = get_users( array( 'fields' => array( 'ID', 'user_login' ) ) ); |
961 | 984 | if ( $users ) { |
962 | 985 | foreach ( $users as $user ) { |
963 | - if ( is_super_admin( $user->ID ) && !in_array( $user->user_login, $site_admins ) ) |
|
964 | - $site_admins[] = $user->user_login; |
|
986 | + if ( is_super_admin( $user->ID ) && !in_array( $user->user_login, $site_admins ) ) { |
|
987 | + $site_admins[] = $user->user_login; |
|
988 | + } |
|
965 | 989 | } |
966 | 990 | } |
967 | 991 | } else { |
@@ -1024,8 +1048,9 @@ discard block |
||
1024 | 1048 | 'active_sitewide_plugins' => array(), |
1025 | 1049 | 'WPLANG' => get_locale(), |
1026 | 1050 | ); |
1027 | - if ( ! $subdomain_install ) |
|
1028 | - $sitemeta['illegal_names'][] = 'blog'; |
|
1051 | + if ( ! $subdomain_install ) { |
|
1052 | + $sitemeta['illegal_names'][] = 'blog'; |
|
1053 | + } |
|
1029 | 1054 | |
1030 | 1055 | /** |
1031 | 1056 | * Filter meta for a network on creation. |
@@ -1039,10 +1064,12 @@ discard block |
||
1039 | 1064 | |
1040 | 1065 | $insert = ''; |
1041 | 1066 | foreach ( $sitemeta as $meta_key => $meta_value ) { |
1042 | - if ( is_array( $meta_value ) ) |
|
1043 | - $meta_value = serialize( $meta_value ); |
|
1044 | - if ( !empty( $insert ) ) |
|
1045 | - $insert .= ', '; |
|
1067 | + if ( is_array( $meta_value ) ) { |
|
1068 | + $meta_value = serialize( $meta_value ); |
|
1069 | + } |
|
1070 | + if ( !empty( $insert ) ) { |
|
1071 | + $insert .= ', '; |
|
1072 | + } |
|
1046 | 1073 | $insert .= $wpdb->prepare( "( %d, %s, %s)", $network_id, $meta_key, $meta_value ); |
1047 | 1074 | } |
1048 | 1075 | $wpdb->query( "INSERT INTO $wpdb->sitemeta ( site_id, meta_key, meta_value ) VALUES " . $insert ); |
@@ -1064,24 +1091,27 @@ discard block |
||
1064 | 1091 | update_user_meta( $site_user->ID, 'source_domain', $domain ); |
1065 | 1092 | update_user_meta( $site_user->ID, 'primary_blog', $blog_id ); |
1066 | 1093 | |
1067 | - if ( $subdomain_install ) |
|
1068 | - $wp_rewrite->set_permalink_structure( '/%year%/%monthnum%/%day%/%postname%/' ); |
|
1069 | - else |
|
1070 | - $wp_rewrite->set_permalink_structure( '/blog/%year%/%monthnum%/%day%/%postname%/' ); |
|
1094 | + if ( $subdomain_install ) { |
|
1095 | + $wp_rewrite->set_permalink_structure( '/%year%/%monthnum%/%day%/%postname%/' ); |
|
1096 | + } else { |
|
1097 | + $wp_rewrite->set_permalink_structure( '/blog/%year%/%monthnum%/%day%/%postname%/' ); |
|
1098 | + } |
|
1071 | 1099 | |
1072 | 1100 | flush_rewrite_rules(); |
1073 | 1101 | |
1074 | - if ( ! $subdomain_install ) |
|
1075 | - return true; |
|
1102 | + if ( ! $subdomain_install ) { |
|
1103 | + return true; |
|
1104 | + } |
|
1076 | 1105 | |
1077 | 1106 | $vhost_ok = false; |
1078 | 1107 | $errstr = ''; |
1079 | 1108 | $hostname = substr( md5( time() ), 0, 6 ) . '.' . $domain; // Very random hostname! |
1080 | 1109 | $page = wp_remote_get( 'http://' . $hostname, array( 'timeout' => 5, 'httpversion' => '1.1' ) ); |
1081 | - if ( is_wp_error( $page ) ) |
|
1082 | - $errstr = $page->get_error_message(); |
|
1083 | - elseif ( 200 == wp_remote_retrieve_response_code( $page ) ) |
|
1084 | - $vhost_ok = true; |
|
1110 | + if ( is_wp_error( $page ) ) { |
|
1111 | + $errstr = $page->get_error_message(); |
|
1112 | + } elseif ( 200 == wp_remote_retrieve_response_code( $page ) ) { |
|
1113 | + $vhost_ok = true; |
|
1114 | + } |
|
1085 | 1115 | |
1086 | 1116 | if ( ! $vhost_ok ) { |
1087 | 1117 | $msg = '<p><strong>' . __( 'Warning! Wildcard DNS may not be configured correctly!' ) . '</strong></p>'; |
@@ -107,8 +107,11 @@ discard block |
||
107 | 107 | <option<?php selected( $post->post_status, 'pending' ); ?> value='pending'><?php _e('Pending Review') ?></option> |
108 | 108 | <?php if ( 'auto-draft' == $post->post_status ) : ?> |
109 | 109 | <option<?php selected( $post->post_status, 'auto-draft' ); ?> value='draft'><?php _e('Draft') ?></option> |
110 | -<?php else : ?> |
|
111 | -<option<?php selected( $post->post_status, 'draft' ); ?> value='draft'><?php _e('Draft') ?></option> |
|
110 | +<?php else { |
|
111 | + : ?> |
|
112 | +<option<?php selected( $post->post_status, 'draft' ); |
|
113 | +} |
|
114 | +?> value='draft'><?php _e('Draft') ?></option> |
|
112 | 115 | <?php endif; ?> |
113 | 116 | </select> |
114 | 117 | <a href="#post_status" class="save-post-status hide-if-no-js button"><?php _e('OK'); ?></a> |
@@ -238,10 +241,11 @@ discard block |
||
238 | 241 | <div id="delete-action"> |
239 | 242 | <?php |
240 | 243 | if ( current_user_can( "delete_post", $post->ID ) ) { |
241 | - if ( !EMPTY_TRASH_DAYS ) |
|
242 | - $delete_text = __('Delete Permanently'); |
|
243 | - else |
|
244 | - $delete_text = __('Move to Trash'); |
|
244 | + if ( !EMPTY_TRASH_DAYS ) { |
|
245 | + $delete_text = __('Delete Permanently'); |
|
246 | + } else { |
|
247 | + $delete_text = __('Move to Trash'); |
|
248 | + } |
|
245 | 249 | ?> |
246 | 250 | <a class="submitdelete deletion" href="<?php echo get_delete_post_link($post->ID); ?>"><?php echo $delete_text; ?></a><?php |
247 | 251 | } ?> |
@@ -255,13 +259,19 @@ discard block |
||
255 | 259 | if ( !empty($post->post_date_gmt) && time() < strtotime( $post->post_date_gmt . ' +0000' ) ) : ?> |
256 | 260 | <input name="original_publish" type="hidden" id="original_publish" value="<?php esc_attr_e('Schedule') ?>" /> |
257 | 261 | <?php submit_button( __( 'Schedule' ), 'primary button-large', 'publish', false ); ?> |
258 | -<?php else : ?> |
|
262 | +<?php else { |
|
263 | + : ?> |
|
259 | 264 | <input name="original_publish" type="hidden" id="original_publish" value="<?php esc_attr_e('Publish') ?>" /> |
260 | - <?php submit_button( __( 'Publish' ), 'primary button-large', 'publish', false ); ?> |
|
265 | + <?php submit_button( __( 'Publish' ), 'primary button-large', 'publish', false ); |
|
266 | +} |
|
267 | +?> |
|
261 | 268 | <?php endif; |
262 | - else : ?> |
|
269 | + else { |
|
270 | + : ?> |
|
263 | 271 | <input name="original_publish" type="hidden" id="original_publish" value="<?php esc_attr_e('Submit for Review') ?>" /> |
264 | - <?php submit_button( __( 'Submit for Review' ), 'primary button-large', 'publish', false ); ?> |
|
272 | + <?php submit_button( __( 'Submit for Review' ), 'primary button-large', 'publish', false ); |
|
273 | + } |
|
274 | + ?> |
|
265 | 275 | <?php |
266 | 276 | endif; |
267 | 277 | } else { ?> |
@@ -323,9 +333,10 @@ discard block |
||
323 | 333 | <div id="major-publishing-actions"> |
324 | 334 | <div id="delete-action"> |
325 | 335 | <?php |
326 | - if ( current_user_can( 'delete_post', $post->ID ) ) |
|
327 | - if ( EMPTY_TRASH_DAYS && MEDIA_TRASH ) { |
|
336 | + if ( current_user_can( 'delete_post', $post->ID ) ) { |
|
337 | + if ( EMPTY_TRASH_DAYS && MEDIA_TRASH ) { |
|
328 | 338 | echo "<a class='submitdelete deletion' href='" . get_delete_post_link( $post->ID ) . "'>" . __( 'Trash' ) . "</a>"; |
339 | + } |
|
329 | 340 | } else { |
330 | 341 | $delete_ays = ! MEDIA_TRASH ? " onclick='return showNotice.warn();'" : ''; |
331 | 342 | echo "<a class='submitdelete deletion'$delete_ays href='" . get_delete_post_link( $post->ID, null, true ) . "'>" . __( 'Delete Permanently' ) . "</a>"; |
@@ -367,11 +378,13 @@ discard block |
||
367 | 378 | |
368 | 379 | if ( is_array( $post_formats[0] ) ) : |
369 | 380 | $post_format = get_post_format( $post->ID ); |
370 | - if ( !$post_format ) |
|
371 | - $post_format = '0'; |
|
381 | + if ( !$post_format ) { |
|
382 | + $post_format = '0'; |
|
383 | + } |
|
372 | 384 | // Add in the current one if it isn't there yet, in case the current theme doesn't support it |
373 | - if ( $post_format && !in_array( $post_format, $post_formats[0] ) ) |
|
374 | - $post_formats[0][] = $post_format; |
|
385 | + if ( $post_format && !in_array( $post_format, $post_formats[0] ) ) { |
|
386 | + $post_formats[0][] = $post_format; |
|
387 | + } |
|
375 | 388 | ?> |
376 | 389 | <div id="post-formats-select"> |
377 | 390 | <fieldset> |
@@ -557,9 +570,10 @@ discard block |
||
557 | 570 | <p><label for="trackback_url"><?php _e('Send trackbacks to:'); ?></label> <?php echo $form_trackback; ?><br /> (<?php _e('Separate multiple URLs with spaces'); ?>)</p> |
558 | 571 | <p><?php _e('Trackbacks are a way to notify legacy blog systems that you’ve linked to them. If you link other WordPress sites, they’ll be notified automatically using <a href="https://codex.wordpress.org/Introduction_to_Blogging#Managing_Comments" target="_blank">pingbacks</a>, no other action necessary.'); ?></p> |
559 | 572 | <?php |
560 | -if ( ! empty($pings) ) |
|
573 | +if ( ! empty($pings) ) { |
|
561 | 574 | echo $pings; |
562 | 575 | } |
576 | +} |
|
563 | 577 | |
564 | 578 | /** |
565 | 579 | * Display custom fields form fields. |
@@ -575,9 +589,10 @@ discard block |
||
575 | 589 | <?php |
576 | 590 | $metadata = has_meta($post->ID); |
577 | 591 | foreach ( $metadata as $key => $value ) { |
578 | - if ( is_protected_meta( $metadata[ $key ][ 'meta_key' ], 'post' ) || ! current_user_can( 'edit_post_meta', $post->ID, $metadata[ $key ][ 'meta_key' ] ) ) |
|
579 | - unset( $metadata[ $key ] ); |
|
580 | -} |
|
592 | + if ( is_protected_meta( $metadata[ $key ][ 'meta_key' ], 'post' ) || ! current_user_can( 'edit_post_meta', $post->ID, $metadata[ $key ][ 'meta_key' ] ) ) { |
|
593 | + unset( $metadata[ $key ] ); |
|
594 | + } |
|
595 | + } |
|
581 | 596 | list_meta( $metadata ); |
582 | 597 | meta_form( $post ); ?> |
583 | 598 | </div> |
@@ -868,10 +883,11 @@ discard block |
||
868 | 883 | <div id="categories-all" class="tabs-panel"> |
869 | 884 | <ul id="categorychecklist" data-wp-lists="list:category" class="categorychecklist form-no-clear"> |
870 | 885 | <?php |
871 | - if ( isset($link->link_id) ) |
|
872 | - wp_link_category_checklist($link->link_id); |
|
873 | - else |
|
874 | - wp_link_category_checklist(); |
|
886 | + if ( isset($link->link_id) ) { |
|
887 | + wp_link_category_checklist($link->link_id); |
|
888 | + } else { |
|
889 | + wp_link_category_checklist(); |
|
890 | + } |
|
875 | 891 | ?> |
876 | 892 | </ul> |
877 | 893 | </div> |
@@ -933,8 +949,10 @@ discard block |
||
933 | 949 | function xfn_check( $class, $value = '', $deprecated = '' ) { |
934 | 950 | global $link; |
935 | 951 | |
936 | - if ( !empty( $deprecated ) ) |
|
937 | - _deprecated_argument( __FUNCTION__, '0.0' ); // Never implemented |
|
952 | + if ( !empty( $deprecated ) ) { |
|
953 | + _deprecated_argument( __FUNCTION__, '0.0' ); |
|
954 | + } |
|
955 | + // Never implemented |
|
938 | 956 | |
939 | 957 | $link_rel = isset( $link->link_rel ) ? $link->link_rel : ''; // In PHP 5.3: $link_rel = $link->link_rel ?: ''; |
940 | 958 | $rels = preg_split('/\s+/', $link_rel); |
@@ -944,10 +962,18 @@ discard block |
||
944 | 962 | } |
945 | 963 | |
946 | 964 | if ('' == $value) { |
947 | - if ('family' == $class && strpos($link_rel, 'child') === false && strpos($link_rel, 'parent') === false && strpos($link_rel, 'sibling') === false && strpos($link_rel, 'spouse') === false && strpos($link_rel, 'kin') === false) echo ' checked="checked"'; |
|
948 | - if ('friendship' == $class && strpos($link_rel, 'friend') === false && strpos($link_rel, 'acquaintance') === false && strpos($link_rel, 'contact') === false) echo ' checked="checked"'; |
|
949 | - if ('geographical' == $class && strpos($link_rel, 'co-resident') === false && strpos($link_rel, 'neighbor') === false) echo ' checked="checked"'; |
|
950 | - if ('identity' == $class && in_array('me', $rels) ) echo ' checked="checked"'; |
|
965 | + if ('family' == $class && strpos($link_rel, 'child') === false && strpos($link_rel, 'parent') === false && strpos($link_rel, 'sibling') === false && strpos($link_rel, 'spouse') === false && strpos($link_rel, 'kin') === false) { |
|
966 | + echo ' checked="checked"'; |
|
967 | + } |
|
968 | + if ('friendship' == $class && strpos($link_rel, 'friend') === false && strpos($link_rel, 'acquaintance') === false && strpos($link_rel, 'contact') === false) { |
|
969 | + echo ' checked="checked"'; |
|
970 | + } |
|
971 | + if ('geographical' == $class && strpos($link_rel, 'co-resident') === false && strpos($link_rel, 'neighbor') === false) { |
|
972 | + echo ' checked="checked"'; |
|
973 | + } |
|
974 | + if ('identity' == $class && in_array('me', $rels) ) { |
|
975 | + echo ' checked="checked"'; |
|
976 | + } |
|
951 | 977 | } |
952 | 978 | } |
953 | 979 | |
@@ -1097,8 +1123,9 @@ discard block |
||
1097 | 1123 | <?php |
1098 | 1124 | for ( $r = 0; $r <= 10; $r++ ) { |
1099 | 1125 | echo '<option value="' . $r . '"'; |
1100 | - if ( isset($link->link_rating) && $link->link_rating == $r ) |
|
1101 | - echo ' selected="selected"'; |
|
1126 | + if ( isset($link->link_rating) && $link->link_rating == $r ) { |
|
1127 | + echo ' selected="selected"'; |
|
1128 | + } |
|
1102 | 1129 | echo('>' . $r . '</option>'); |
1103 | 1130 | } |
1104 | 1131 | ?></select> <?php _e('(Leave at 0 for no rating.)') ?> |
@@ -61,12 +61,12 @@ discard block |
||
61 | 61 | <?php endif; // public post type ?> |
62 | 62 | <?php |
63 | 63 | /** |
64 | - * Fires before the post time/date setting in the Publish meta box. |
|
65 | - * |
|
66 | - * @since 4.4.0 |
|
67 | - * |
|
68 | - * @param WP_Post $post WP_Post object for the current post. |
|
69 | - */ |
|
64 | + * Fires before the post time/date setting in the Publish meta box. |
|
65 | + * |
|
66 | + * @since 4.4.0 |
|
67 | + * |
|
68 | + * @param WP_Post $post WP_Post object for the current post. |
|
69 | + */ |
|
70 | 70 | do_action( 'post_submitbox_minor_actions', $post ); |
71 | 71 | ?> |
72 | 72 | <div class="clear"></div> |
@@ -835,14 +835,14 @@ discard block |
||
835 | 835 | <label class="screen-reader-text" for="page_template"><?php _e('Page Template') ?></label><select name="page_template" id="page_template"> |
836 | 836 | <?php |
837 | 837 | /** |
838 | - * Filter the title of the default page template displayed in the drop-down. |
|
839 | - * |
|
840 | - * @since 4.1.0 |
|
841 | - * |
|
842 | - * @param string $label The display value for the default page template title. |
|
843 | - * @param string $context Where the option label is displayed. Possible values |
|
844 | - * include 'meta-box' or 'quick-edit'. |
|
845 | - */ |
|
838 | + * Filter the title of the default page template displayed in the drop-down. |
|
839 | + * |
|
840 | + * @since 4.1.0 |
|
841 | + * |
|
842 | + * @param string $label The display value for the default page template title. |
|
843 | + * @param string $context Where the option label is displayed. Possible values |
|
844 | + * include 'meta-box' or 'quick-edit'. |
|
845 | + */ |
|
846 | 846 | $default_title = apply_filters( 'default_page_template_title', __( 'Default Template' ), 'meta-box' ); |
847 | 847 | ?> |
848 | 848 | <option value="default"><?php echo esc_html( $default_title ); ?></option> |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | * @type array $args Extra meta box arguments. |
20 | 20 | * } |
21 | 21 | */ |
22 | -function post_submit_meta_box( $post, $args = array() ) { |
|
22 | +function post_submit_meta_box($post, $args = array()) { |
|
23 | 23 | global $action; |
24 | 24 | |
25 | 25 | $post_type = $post->post_type; |
@@ -32,27 +32,27 @@ discard block |
||
32 | 32 | |
33 | 33 | <?php // Hidden submit button early on so that the browser chooses the right button when form is submitted with Return key ?> |
34 | 34 | <div style="display:none;"> |
35 | -<?php submit_button( __( 'Save' ), 'button', 'save' ); ?> |
|
35 | +<?php submit_button(__('Save'), 'button', 'save'); ?> |
|
36 | 36 | </div> |
37 | 37 | |
38 | 38 | <div id="minor-publishing-actions"> |
39 | 39 | <div id="save-action"> |
40 | -<?php if ( 'publish' != $post->post_status && 'future' != $post->post_status && 'pending' != $post->post_status ) { ?> |
|
41 | -<input <?php if ( 'private' == $post->post_status ) { ?>style="display:none"<?php } ?> type="submit" name="save" id="save-post" value="<?php esc_attr_e('Save Draft'); ?>" class="button" /> |
|
40 | +<?php if ('publish' != $post->post_status && 'future' != $post->post_status && 'pending' != $post->post_status) { ?> |
|
41 | +<input <?php if ('private' == $post->post_status) { ?>style="display:none"<?php } ?> type="submit" name="save" id="save-post" value="<?php esc_attr_e('Save Draft'); ?>" class="button" /> |
|
42 | 42 | <span class="spinner"></span> |
43 | -<?php } elseif ( 'pending' == $post->post_status && $can_publish ) { ?> |
|
43 | +<?php } elseif ('pending' == $post->post_status && $can_publish) { ?> |
|
44 | 44 | <input type="submit" name="save" id="save-post" value="<?php esc_attr_e('Save as Pending'); ?>" class="button" /> |
45 | 45 | <span class="spinner"></span> |
46 | 46 | <?php } ?> |
47 | 47 | </div> |
48 | -<?php if ( is_post_type_viewable( $post_type_object ) ) : ?> |
|
48 | +<?php if (is_post_type_viewable($post_type_object)) : ?> |
|
49 | 49 | <div id="preview-action"> |
50 | 50 | <?php |
51 | -$preview_link = esc_url( get_preview_post_link( $post ) ); |
|
52 | -if ( 'publish' == $post->post_status ) { |
|
53 | - $preview_button = __( 'Preview Changes' ); |
|
51 | +$preview_link = esc_url(get_preview_post_link($post)); |
|
52 | +if ('publish' == $post->post_status) { |
|
53 | + $preview_button = __('Preview Changes'); |
|
54 | 54 | } else { |
55 | - $preview_button = __( 'Preview' ); |
|
55 | + $preview_button = __('Preview'); |
|
56 | 56 | } |
57 | 57 | ?> |
58 | 58 | <a class="preview button" href="<?php echo $preview_link; ?>" target="wp-preview-<?php echo (int) $post->ID; ?>" id="post-preview"><?php echo $preview_button; ?></a> |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | * |
68 | 68 | * @param WP_Post $post WP_Post object for the current post. |
69 | 69 | */ |
70 | -do_action( 'post_submitbox_minor_actions', $post ); |
|
70 | +do_action('post_submitbox_minor_actions', $post); |
|
71 | 71 | ?> |
72 | 72 | <div class="clear"></div> |
73 | 73 | </div><!-- #minor-publishing-actions --> |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | <div class="misc-pub-section misc-pub-post-status"><label for="post_status"><?php _e('Status:') ?></label> |
78 | 78 | <span id="post-status-display"> |
79 | 79 | <?php |
80 | -switch ( $post->post_status ) { |
|
80 | +switch ($post->post_status) { |
|
81 | 81 | case 'private': |
82 | 82 | _e('Privately Published'); |
83 | 83 | break; |
@@ -97,24 +97,24 @@ discard block |
||
97 | 97 | } |
98 | 98 | ?> |
99 | 99 | </span> |
100 | -<?php if ( 'publish' == $post->post_status || 'private' == $post->post_status || $can_publish ) { ?> |
|
101 | -<a href="#post_status" <?php if ( 'private' == $post->post_status ) { ?>style="display:none;" <?php } ?>class="edit-post-status hide-if-no-js"><span aria-hidden="true"><?php _e( 'Edit' ); ?></span> <span class="screen-reader-text"><?php _e( 'Edit status' ); ?></span></a> |
|
100 | +<?php if ('publish' == $post->post_status || 'private' == $post->post_status || $can_publish) { ?> |
|
101 | +<a href="#post_status" <?php if ('private' == $post->post_status) { ?>style="display:none;" <?php } ?>class="edit-post-status hide-if-no-js"><span aria-hidden="true"><?php _e('Edit'); ?></span> <span class="screen-reader-text"><?php _e('Edit status'); ?></span></a> |
|
102 | 102 | |
103 | 103 | <div id="post-status-select" class="hide-if-js"> |
104 | -<input type="hidden" name="hidden_post_status" id="hidden_post_status" value="<?php echo esc_attr( ('auto-draft' == $post->post_status ) ? 'draft' : $post->post_status); ?>" /> |
|
104 | +<input type="hidden" name="hidden_post_status" id="hidden_post_status" value="<?php echo esc_attr(('auto-draft' == $post->post_status) ? 'draft' : $post->post_status); ?>" /> |
|
105 | 105 | <select name='post_status' id='post_status'> |
106 | -<?php if ( 'publish' == $post->post_status ) : ?> |
|
107 | -<option<?php selected( $post->post_status, 'publish' ); ?> value='publish'><?php _e('Published') ?></option> |
|
108 | -<?php elseif ( 'private' == $post->post_status ) : ?> |
|
109 | -<option<?php selected( $post->post_status, 'private' ); ?> value='publish'><?php _e('Privately Published') ?></option> |
|
110 | -<?php elseif ( 'future' == $post->post_status ) : ?> |
|
111 | -<option<?php selected( $post->post_status, 'future' ); ?> value='future'><?php _e('Scheduled') ?></option> |
|
106 | +<?php if ('publish' == $post->post_status) : ?> |
|
107 | +<option<?php selected($post->post_status, 'publish'); ?> value='publish'><?php _e('Published') ?></option> |
|
108 | +<?php elseif ('private' == $post->post_status) : ?> |
|
109 | +<option<?php selected($post->post_status, 'private'); ?> value='publish'><?php _e('Privately Published') ?></option> |
|
110 | +<?php elseif ('future' == $post->post_status) : ?> |
|
111 | +<option<?php selected($post->post_status, 'future'); ?> value='future'><?php _e('Scheduled') ?></option> |
|
112 | 112 | <?php endif; ?> |
113 | -<option<?php selected( $post->post_status, 'pending' ); ?> value='pending'><?php _e('Pending Review') ?></option> |
|
114 | -<?php if ( 'auto-draft' == $post->post_status ) : ?> |
|
115 | -<option<?php selected( $post->post_status, 'auto-draft' ); ?> value='draft'><?php _e('Draft') ?></option> |
|
113 | +<option<?php selected($post->post_status, 'pending'); ?> value='pending'><?php _e('Pending Review') ?></option> |
|
114 | +<?php if ('auto-draft' == $post->post_status) : ?> |
|
115 | +<option<?php selected($post->post_status, 'auto-draft'); ?> value='draft'><?php _e('Draft') ?></option> |
|
116 | 116 | <?php else : ?> |
117 | -<option<?php selected( $post->post_status, 'draft' ); ?> value='draft'><?php _e('Draft') ?></option> |
|
117 | +<option<?php selected($post->post_status, 'draft'); ?> value='draft'><?php _e('Draft') ?></option> |
|
118 | 118 | <?php endif; ?> |
119 | 119 | </select> |
120 | 120 | <a href="#post_status" class="save-post-status hide-if-no-js button"><?php _e('OK'); ?></a> |
@@ -127,14 +127,14 @@ discard block |
||
127 | 127 | <div class="misc-pub-section misc-pub-visibility" id="visibility"> |
128 | 128 | <?php _e('Visibility:'); ?> <span id="post-visibility-display"><?php |
129 | 129 | |
130 | -if ( 'private' == $post->post_status ) { |
|
130 | +if ('private' == $post->post_status) { |
|
131 | 131 | $post->post_password = ''; |
132 | 132 | $visibility = 'private'; |
133 | 133 | $visibility_trans = __('Private'); |
134 | -} elseif ( !empty( $post->post_password ) ) { |
|
134 | +} elseif ( ! empty($post->post_password)) { |
|
135 | 135 | $visibility = 'password'; |
136 | 136 | $visibility_trans = __('Password protected'); |
137 | -} elseif ( $post_type == 'post' && is_sticky( $post->ID ) ) { |
|
137 | +} elseif ($post_type == 'post' && is_sticky($post->ID)) { |
|
138 | 138 | $visibility = 'public'; |
139 | 139 | $visibility_trans = __('Public, Sticky'); |
140 | 140 | } else { |
@@ -142,23 +142,23 @@ discard block |
||
142 | 142 | $visibility_trans = __('Public'); |
143 | 143 | } |
144 | 144 | |
145 | -echo esc_html( $visibility_trans ); ?></span> |
|
146 | -<?php if ( $can_publish ) { ?> |
|
147 | -<a href="#visibility" class="edit-visibility hide-if-no-js"><span aria-hidden="true"><?php _e( 'Edit' ); ?></span> <span class="screen-reader-text"><?php _e( 'Edit visibility' ); ?></span></a> |
|
145 | +echo esc_html($visibility_trans); ?></span> |
|
146 | +<?php if ($can_publish) { ?> |
|
147 | +<a href="#visibility" class="edit-visibility hide-if-no-js"><span aria-hidden="true"><?php _e('Edit'); ?></span> <span class="screen-reader-text"><?php _e('Edit visibility'); ?></span></a> |
|
148 | 148 | |
149 | 149 | <div id="post-visibility-select" class="hide-if-js"> |
150 | 150 | <input type="hidden" name="hidden_post_password" id="hidden-post-password" value="<?php echo esc_attr($post->post_password); ?>" /> |
151 | 151 | <?php if ($post_type == 'post'): ?> |
152 | 152 | <input type="checkbox" style="display:none" name="hidden_post_sticky" id="hidden-post-sticky" value="sticky" <?php checked(is_sticky($post->ID)); ?> /> |
153 | 153 | <?php endif; ?> |
154 | -<input type="hidden" name="hidden_post_visibility" id="hidden-post-visibility" value="<?php echo esc_attr( $visibility ); ?>" /> |
|
155 | -<input type="radio" name="visibility" id="visibility-radio-public" value="public" <?php checked( $visibility, 'public' ); ?> /> <label for="visibility-radio-public" class="selectit"><?php _e('Public'); ?></label><br /> |
|
156 | -<?php if ( $post_type == 'post' && current_user_can( 'edit_others_posts' ) ) : ?> |
|
157 | -<span id="sticky-span"><input id="sticky" name="sticky" type="checkbox" value="sticky" <?php checked( is_sticky( $post->ID ) ); ?> /> <label for="sticky" class="selectit"><?php _e( 'Stick this post to the front page' ); ?></label><br /></span> |
|
154 | +<input type="hidden" name="hidden_post_visibility" id="hidden-post-visibility" value="<?php echo esc_attr($visibility); ?>" /> |
|
155 | +<input type="radio" name="visibility" id="visibility-radio-public" value="public" <?php checked($visibility, 'public'); ?> /> <label for="visibility-radio-public" class="selectit"><?php _e('Public'); ?></label><br /> |
|
156 | +<?php if ($post_type == 'post' && current_user_can('edit_others_posts')) : ?> |
|
157 | +<span id="sticky-span"><input id="sticky" name="sticky" type="checkbox" value="sticky" <?php checked(is_sticky($post->ID)); ?> /> <label for="sticky" class="selectit"><?php _e('Stick this post to the front page'); ?></label><br /></span> |
|
158 | 158 | <?php endif; ?> |
159 | -<input type="radio" name="visibility" id="visibility-radio-password" value="password" <?php checked( $visibility, 'password' ); ?> /> <label for="visibility-radio-password" class="selectit"><?php _e('Password protected'); ?></label><br /> |
|
159 | +<input type="radio" name="visibility" id="visibility-radio-password" value="password" <?php checked($visibility, 'password'); ?> /> <label for="visibility-radio-password" class="selectit"><?php _e('Password protected'); ?></label><br /> |
|
160 | 160 | <span id="password-span"><label for="post_password"><?php _e('Password:'); ?></label> <input type="text" name="post_password" id="post_password" value="<?php echo esc_attr($post->post_password); ?>" maxlength="20" /><br /></span> |
161 | -<input type="radio" name="visibility" id="visibility-radio-private" value="private" <?php checked( $visibility, 'private' ); ?> /> <label for="visibility-radio-private" class="selectit"><?php _e('Private'); ?></label><br /> |
|
161 | +<input type="radio" name="visibility" id="visibility-radio-private" value="private" <?php checked($visibility, 'private'); ?> /> <label for="visibility-radio-private" class="selectit"><?php _e('Private'); ?></label><br /> |
|
162 | 162 | |
163 | 163 | <p> |
164 | 164 | <a href="#visibility" class="save-post-visibility hide-if-no-js button"><?php _e('OK'); ?></a> |
@@ -171,40 +171,40 @@ discard block |
||
171 | 171 | |
172 | 172 | <?php |
173 | 173 | /* translators: Publish box date format, see http://php.net/date */ |
174 | -$datef = __( 'M j, Y @ H:i' ); |
|
175 | -if ( 0 != $post->ID ) { |
|
176 | - if ( 'future' == $post->post_status ) { // scheduled for publishing at a future date |
|
174 | +$datef = __('M j, Y @ H:i'); |
|
175 | +if (0 != $post->ID) { |
|
176 | + if ('future' == $post->post_status) { // scheduled for publishing at a future date |
|
177 | 177 | $stamp = __('Scheduled for: <b>%1$s</b>'); |
178 | - } elseif ( 'publish' == $post->post_status || 'private' == $post->post_status ) { // already published |
|
178 | + } elseif ('publish' == $post->post_status || 'private' == $post->post_status) { // already published |
|
179 | 179 | $stamp = __('Published on: <b>%1$s</b>'); |
180 | - } elseif ( '0000-00-00 00:00:00' == $post->post_date_gmt ) { // draft, 1 or more saves, no date specified |
|
180 | + } elseif ('0000-00-00 00:00:00' == $post->post_date_gmt) { // draft, 1 or more saves, no date specified |
|
181 | 181 | $stamp = __('Publish <b>immediately</b>'); |
182 | - } elseif ( time() < strtotime( $post->post_date_gmt . ' +0000' ) ) { // draft, 1 or more saves, future date specified |
|
182 | + } elseif (time() < strtotime($post->post_date_gmt.' +0000')) { // draft, 1 or more saves, future date specified |
|
183 | 183 | $stamp = __('Schedule for: <b>%1$s</b>'); |
184 | 184 | } else { // draft, 1 or more saves, date specified |
185 | 185 | $stamp = __('Publish on: <b>%1$s</b>'); |
186 | 186 | } |
187 | - $date = date_i18n( $datef, strtotime( $post->post_date ) ); |
|
187 | + $date = date_i18n($datef, strtotime($post->post_date)); |
|
188 | 188 | } else { // draft (no saves, and thus no date specified) |
189 | 189 | $stamp = __('Publish <b>immediately</b>'); |
190 | - $date = date_i18n( $datef, strtotime( current_time('mysql') ) ); |
|
190 | + $date = date_i18n($datef, strtotime(current_time('mysql'))); |
|
191 | 191 | } |
192 | 192 | |
193 | -if ( ! empty( $args['args']['revisions_count'] ) ) : ?> |
|
193 | +if ( ! empty($args['args']['revisions_count'])) : ?> |
|
194 | 194 | <div class="misc-pub-section misc-pub-revisions"> |
195 | - <?php printf( __( 'Revisions: %s' ), '<b>' . number_format_i18n( $args['args']['revisions_count'] ) . '</b>' ); ?> |
|
196 | - <a class="hide-if-no-js" href="<?php echo esc_url( get_edit_post_link( $args['args']['revision_id'] ) ); ?>"><span aria-hidden="true"><?php _ex( 'Browse', 'revisions' ); ?></span> <span class="screen-reader-text"><?php _e( 'Browse revisions' ); ?></span></a> |
|
195 | + <?php printf(__('Revisions: %s'), '<b>'.number_format_i18n($args['args']['revisions_count']).'</b>'); ?> |
|
196 | + <a class="hide-if-no-js" href="<?php echo esc_url(get_edit_post_link($args['args']['revision_id'])); ?>"><span aria-hidden="true"><?php _ex('Browse', 'revisions'); ?></span> <span class="screen-reader-text"><?php _e('Browse revisions'); ?></span></a> |
|
197 | 197 | </div> |
198 | 198 | <?php endif; |
199 | 199 | |
200 | -if ( $can_publish ) : // Contributors don't get to choose the date of publish ?> |
|
200 | +if ($can_publish) : // Contributors don't get to choose the date of publish ?> |
|
201 | 201 | <div class="misc-pub-section curtime misc-pub-curtime"> |
202 | 202 | <span id="timestamp"> |
203 | 203 | <?php printf($stamp, $date); ?></span> |
204 | - <a href="#edit_timestamp" class="edit-timestamp hide-if-no-js"><span aria-hidden="true"><?php _e( 'Edit' ); ?></span> <span class="screen-reader-text"><?php _e( 'Edit date and time' ); ?></span></a> |
|
204 | + <a href="#edit_timestamp" class="edit-timestamp hide-if-no-js"><span aria-hidden="true"><?php _e('Edit'); ?></span> <span class="screen-reader-text"><?php _e('Edit date and time'); ?></span></a> |
|
205 | 205 | <fieldset id="timestampdiv" class="hide-if-js"> |
206 | - <legend class="screen-reader-text"><?php _e( 'Date and time' ); ?></legend> |
|
207 | - <?php touch_time( ( $action === 'edit' ), 1 ); ?> |
|
206 | + <legend class="screen-reader-text"><?php _e('Date and time'); ?></legend> |
|
207 | + <?php touch_time(($action === 'edit'), 1); ?> |
|
208 | 208 | </fieldset> |
209 | 209 | </div><?php // /misc-pub-section ?> |
210 | 210 | <?php endif; ?> |
@@ -218,7 +218,7 @@ discard block |
||
218 | 218 | * |
219 | 219 | * @param WP_Post $post WP_Post object for the current post. |
220 | 220 | */ |
221 | -do_action( 'post_submitbox_misc_actions', $post ); |
|
221 | +do_action('post_submitbox_misc_actions', $post); |
|
222 | 222 | ?> |
223 | 223 | </div> |
224 | 224 | <div class="clear"></div> |
@@ -231,12 +231,12 @@ discard block |
||
231 | 231 | * |
232 | 232 | * @since 2.7.0 |
233 | 233 | */ |
234 | -do_action( 'post_submitbox_start' ); |
|
234 | +do_action('post_submitbox_start'); |
|
235 | 235 | ?> |
236 | 236 | <div id="delete-action"> |
237 | 237 | <?php |
238 | -if ( current_user_can( "delete_post", $post->ID ) ) { |
|
239 | - if ( !EMPTY_TRASH_DAYS ) |
|
238 | +if (current_user_can("delete_post", $post->ID)) { |
|
239 | + if ( ! EMPTY_TRASH_DAYS) |
|
240 | 240 | $delete_text = __('Delete Permanently'); |
241 | 241 | else |
242 | 242 | $delete_text = __('Move to Trash'); |
@@ -248,23 +248,23 @@ discard block |
||
248 | 248 | <div id="publishing-action"> |
249 | 249 | <span class="spinner"></span> |
250 | 250 | <?php |
251 | -if ( !in_array( $post->post_status, array('publish', 'future', 'private') ) || 0 == $post->ID ) { |
|
252 | - if ( $can_publish ) : |
|
253 | - if ( !empty($post->post_date_gmt) && time() < strtotime( $post->post_date_gmt . ' +0000' ) ) : ?> |
|
251 | +if ( ! in_array($post->post_status, array('publish', 'future', 'private')) || 0 == $post->ID) { |
|
252 | + if ($can_publish) : |
|
253 | + if ( ! empty($post->post_date_gmt) && time() < strtotime($post->post_date_gmt.' +0000')) : ?> |
|
254 | 254 | <input name="original_publish" type="hidden" id="original_publish" value="<?php esc_attr_e('Schedule') ?>" /> |
255 | - <?php submit_button( __( 'Schedule' ), 'primary button-large', 'publish', false ); ?> |
|
255 | + <?php submit_button(__('Schedule'), 'primary button-large', 'publish', false); ?> |
|
256 | 256 | <?php else : ?> |
257 | 257 | <input name="original_publish" type="hidden" id="original_publish" value="<?php esc_attr_e('Publish') ?>" /> |
258 | - <?php submit_button( __( 'Publish' ), 'primary button-large', 'publish', false ); ?> |
|
258 | + <?php submit_button(__('Publish'), 'primary button-large', 'publish', false); ?> |
|
259 | 259 | <?php endif; |
260 | 260 | else : ?> |
261 | 261 | <input name="original_publish" type="hidden" id="original_publish" value="<?php esc_attr_e('Submit for Review') ?>" /> |
262 | - <?php submit_button( __( 'Submit for Review' ), 'primary button-large', 'publish', false ); ?> |
|
262 | + <?php submit_button(__('Submit for Review'), 'primary button-large', 'publish', false); ?> |
|
263 | 263 | <?php |
264 | 264 | endif; |
265 | 265 | } else { ?> |
266 | 266 | <input name="original_publish" type="hidden" id="original_publish" value="<?php esc_attr_e('Update') ?>" /> |
267 | - <input name="save" type="submit" class="button button-primary button-large" id="publish" value="<?php esc_attr_e( 'Update' ) ?>" /> |
|
267 | + <input name="save" type="submit" class="button button-primary button-large" id="publish" value="<?php esc_attr_e('Update') ?>" /> |
|
268 | 268 | <?php |
269 | 269 | } ?> |
270 | 270 | </div> |
@@ -282,7 +282,7 @@ discard block |
||
282 | 282 | * |
283 | 283 | * @param object $post |
284 | 284 | */ |
285 | -function attachment_submit_meta_box( $post ) { |
|
285 | +function attachment_submit_meta_box($post) { |
|
286 | 286 | ?> |
287 | 287 | <div class="submitbox" id="submitpost"> |
288 | 288 | |
@@ -290,16 +290,16 @@ discard block |
||
290 | 290 | |
291 | 291 | <?php // Hidden submit button early on so that the browser chooses the right button when form is submitted with Return key ?> |
292 | 292 | <div style="display:none;"> |
293 | -<?php submit_button( __( 'Save' ), 'button', 'save' ); ?> |
|
293 | +<?php submit_button(__('Save'), 'button', 'save'); ?> |
|
294 | 294 | </div> |
295 | 295 | |
296 | 296 | |
297 | 297 | <div id="misc-publishing-actions"> |
298 | 298 | <?php |
299 | 299 | /* translators: Publish box date format, see http://php.net/date */ |
300 | - $datef = __( 'M j, Y @ H:i' ); |
|
300 | + $datef = __('M j, Y @ H:i'); |
|
301 | 301 | $stamp = __('Uploaded on: <b>%1$s</b>'); |
302 | - $date = date_i18n( $datef, strtotime( $post->post_date ) ); |
|
302 | + $date = date_i18n($datef, strtotime($post->post_date)); |
|
303 | 303 | ?> |
304 | 304 | <div class="misc-pub-section curtime misc-pub-curtime"> |
305 | 305 | <span id="timestamp"><?php printf($stamp, $date); ?></span> |
@@ -312,7 +312,7 @@ discard block |
||
312 | 312 | * |
313 | 313 | * @since 3.5.0 |
314 | 314 | */ |
315 | - do_action( 'attachment_submitbox_misc_actions' ); |
|
315 | + do_action('attachment_submitbox_misc_actions'); |
|
316 | 316 | ?> |
317 | 317 | </div><!-- #misc-publishing-actions --> |
318 | 318 | <div class="clear"></div> |
@@ -321,12 +321,12 @@ discard block |
||
321 | 321 | <div id="major-publishing-actions"> |
322 | 322 | <div id="delete-action"> |
323 | 323 | <?php |
324 | - if ( current_user_can( 'delete_post', $post->ID ) ) |
|
325 | - if ( EMPTY_TRASH_DAYS && MEDIA_TRASH ) { |
|
326 | - echo "<a class='submitdelete deletion' href='" . get_delete_post_link( $post->ID ) . "'>" . _x( 'Trash', 'verb' ) . "</a>"; |
|
324 | + if (current_user_can('delete_post', $post->ID)) |
|
325 | + if (EMPTY_TRASH_DAYS && MEDIA_TRASH) { |
|
326 | + echo "<a class='submitdelete deletion' href='".get_delete_post_link($post->ID)."'>"._x('Trash', 'verb')."</a>"; |
|
327 | 327 | } else { |
328 | 328 | $delete_ays = ! MEDIA_TRASH ? " onclick='return showNotice.warn();'" : ''; |
329 | - echo "<a class='submitdelete deletion'$delete_ays href='" . get_delete_post_link( $post->ID, null, true ) . "'>" . __( 'Delete Permanently' ) . "</a>"; |
|
329 | + echo "<a class='submitdelete deletion'$delete_ays href='".get_delete_post_link($post->ID, null, true)."'>".__('Delete Permanently')."</a>"; |
|
330 | 330 | } |
331 | 331 | ?> |
332 | 332 | </div> |
@@ -334,7 +334,7 @@ discard block |
||
334 | 334 | <div id="publishing-action"> |
335 | 335 | <span class="spinner"></span> |
336 | 336 | <input name="original_publish" type="hidden" id="original_publish" value="<?php esc_attr_e('Update') ?>" /> |
337 | - <input name="save" type="submit" class="button-primary button-large" id="publish" value="<?php esc_attr_e( 'Update' ) ?>" /> |
|
337 | + <input name="save" type="submit" class="button-primary button-large" id="publish" value="<?php esc_attr_e('Update') ?>" /> |
|
338 | 338 | </div> |
339 | 339 | <div class="clear"></div> |
340 | 340 | </div><!-- #major-publishing-actions --> |
@@ -359,24 +359,24 @@ discard block |
||
359 | 359 | * @type array $args Extra meta box arguments. |
360 | 360 | * } |
361 | 361 | */ |
362 | -function post_format_meta_box( $post, $box ) { |
|
363 | - if ( current_theme_supports( 'post-formats' ) && post_type_supports( $post->post_type, 'post-formats' ) ) : |
|
364 | - $post_formats = get_theme_support( 'post-formats' ); |
|
362 | +function post_format_meta_box($post, $box) { |
|
363 | + if (current_theme_supports('post-formats') && post_type_supports($post->post_type, 'post-formats')) : |
|
364 | + $post_formats = get_theme_support('post-formats'); |
|
365 | 365 | |
366 | - if ( is_array( $post_formats[0] ) ) : |
|
367 | - $post_format = get_post_format( $post->ID ); |
|
368 | - if ( !$post_format ) |
|
366 | + if (is_array($post_formats[0])) : |
|
367 | + $post_format = get_post_format($post->ID); |
|
368 | + if ( ! $post_format) |
|
369 | 369 | $post_format = '0'; |
370 | 370 | // Add in the current one if it isn't there yet, in case the current theme doesn't support it |
371 | - if ( $post_format && !in_array( $post_format, $post_formats[0] ) ) |
|
371 | + if ($post_format && ! in_array($post_format, $post_formats[0])) |
|
372 | 372 | $post_formats[0][] = $post_format; |
373 | 373 | ?> |
374 | 374 | <div id="post-formats-select"> |
375 | 375 | <fieldset> |
376 | - <legend class="screen-reader-text"><?php _e( 'Post Formats' ); ?></legend> |
|
377 | - <input type="radio" name="post_format" class="post-format" id="post-format-0" value="0" <?php checked( $post_format, '0' ); ?> /> <label for="post-format-0" class="post-format-icon post-format-standard"><?php echo get_post_format_string( 'standard' ); ?></label> |
|
378 | - <?php foreach ( $post_formats[0] as $format ) : ?> |
|
379 | - <br /><input type="radio" name="post_format" class="post-format" id="post-format-<?php echo esc_attr( $format ); ?>" value="<?php echo esc_attr( $format ); ?>" <?php checked( $post_format, $format ); ?> /> <label for="post-format-<?php echo esc_attr( $format ); ?>" class="post-format-icon post-format-<?php echo esc_attr( $format ); ?>"><?php echo esc_html( get_post_format_string( $format ) ); ?></label> |
|
376 | + <legend class="screen-reader-text"><?php _e('Post Formats'); ?></legend> |
|
377 | + <input type="radio" name="post_format" class="post-format" id="post-format-0" value="0" <?php checked($post_format, '0'); ?> /> <label for="post-format-0" class="post-format-icon post-format-standard"><?php echo get_post_format_string('standard'); ?></label> |
|
378 | + <?php foreach ($post_formats[0] as $format) : ?> |
|
379 | + <br /><input type="radio" name="post_format" class="post-format" id="post-format-<?php echo esc_attr($format); ?>" value="<?php echo esc_attr($format); ?>" <?php checked($post_format, $format); ?> /> <label for="post-format-<?php echo esc_attr($format); ?>" class="post-format-icon post-format-<?php echo esc_attr($format); ?>"><?php echo esc_html(get_post_format_string($format)); ?></label> |
|
380 | 380 | <?php endforeach; ?> |
381 | 381 | </fieldset> |
382 | 382 | </div> |
@@ -404,20 +404,20 @@ discard block |
||
404 | 404 | * } |
405 | 405 | * } |
406 | 406 | */ |
407 | -function post_tags_meta_box( $post, $box ) { |
|
408 | - $defaults = array( 'taxonomy' => 'post_tag' ); |
|
409 | - if ( ! isset( $box['args'] ) || ! is_array( $box['args'] ) ) { |
|
407 | +function post_tags_meta_box($post, $box) { |
|
408 | + $defaults = array('taxonomy' => 'post_tag'); |
|
409 | + if ( ! isset($box['args']) || ! is_array($box['args'])) { |
|
410 | 410 | $args = array(); |
411 | 411 | } else { |
412 | 412 | $args = $box['args']; |
413 | 413 | } |
414 | - $r = wp_parse_args( $args, $defaults ); |
|
415 | - $tax_name = esc_attr( $r['taxonomy'] ); |
|
416 | - $taxonomy = get_taxonomy( $r['taxonomy'] ); |
|
417 | - $user_can_assign_terms = current_user_can( $taxonomy->cap->assign_terms ); |
|
418 | - $comma = _x( ',', 'tag delimiter' ); |
|
419 | - $terms_to_edit = get_terms_to_edit( $post->ID, $tax_name ); |
|
420 | - if ( ! is_string( $terms_to_edit ) ) { |
|
414 | + $r = wp_parse_args($args, $defaults); |
|
415 | + $tax_name = esc_attr($r['taxonomy']); |
|
416 | + $taxonomy = get_taxonomy($r['taxonomy']); |
|
417 | + $user_can_assign_terms = current_user_can($taxonomy->cap->assign_terms); |
|
418 | + $comma = _x(',', 'tag delimiter'); |
|
419 | + $terms_to_edit = get_terms_to_edit($post->ID, $tax_name); |
|
420 | + if ( ! is_string($terms_to_edit)) { |
|
421 | 421 | $terms_to_edit = ''; |
422 | 422 | } |
423 | 423 | ?> |
@@ -425,9 +425,9 @@ discard block |
||
425 | 425 | <div class="jaxtag"> |
426 | 426 | <div class="nojs-tags hide-if-js"> |
427 | 427 | <label for="tax-input-<?php echo $tax_name; ?>"><?php echo $taxonomy->labels->add_or_remove_items; ?></label> |
428 | - <p><textarea name="<?php echo "tax_input[$tax_name]"; ?>" rows="3" cols="20" class="the-tags" id="tax-input-<?php echo $tax_name; ?>" <?php disabled( ! $user_can_assign_terms ); ?> aria-describedby="new-tag-<?php echo $tax_name; ?>-desc"><?php echo str_replace( ',', $comma . ' ', $terms_to_edit ); // textarea_escaped by esc_attr() ?></textarea></p> |
|
428 | + <p><textarea name="<?php echo "tax_input[$tax_name]"; ?>" rows="3" cols="20" class="the-tags" id="tax-input-<?php echo $tax_name; ?>" <?php disabled( ! $user_can_assign_terms); ?> aria-describedby="new-tag-<?php echo $tax_name; ?>-desc"><?php echo str_replace(',', $comma.' ', $terms_to_edit); // textarea_escaped by esc_attr() ?></textarea></p> |
|
429 | 429 | </div> |
430 | - <?php if ( $user_can_assign_terms ) : ?> |
|
430 | + <?php if ($user_can_assign_terms) : ?> |
|
431 | 431 | <div class="ajaxtag hide-if-no-js"> |
432 | 432 | <label class="screen-reader-text" for="new-tag-<?php echo $tax_name; ?>"><?php echo $taxonomy->labels->add_new_item; ?></label> |
433 | 433 | <p><input type="text" id="new-tag-<?php echo $tax_name; ?>" name="newtag[<?php echo $tax_name; ?>]" class="newtag form-input-tip" size="16" autocomplete="off" aria-describedby="new-tag-<?php echo $tax_name; ?>-desc" value="" /> |
@@ -438,7 +438,7 @@ discard block |
||
438 | 438 | </div> |
439 | 439 | <div class="tagchecklist"></div> |
440 | 440 | </div> |
441 | -<?php if ( $user_can_assign_terms ) : ?> |
|
441 | +<?php if ($user_can_assign_terms) : ?> |
|
442 | 442 | <p class="hide-if-no-js"><a href="#titlediv" class="tagcloud-link" id="link-<?php echo $tax_name; ?>"><?php echo $taxonomy->labels->choose_from_most_used; ?></a></p> |
443 | 443 | <?php endif; ?> |
444 | 444 | <?php |
@@ -465,49 +465,49 @@ discard block |
||
465 | 465 | * } |
466 | 466 | * } |
467 | 467 | */ |
468 | -function post_categories_meta_box( $post, $box ) { |
|
469 | - $defaults = array( 'taxonomy' => 'category' ); |
|
470 | - if ( ! isset( $box['args'] ) || ! is_array( $box['args'] ) ) { |
|
468 | +function post_categories_meta_box($post, $box) { |
|
469 | + $defaults = array('taxonomy' => 'category'); |
|
470 | + if ( ! isset($box['args']) || ! is_array($box['args'])) { |
|
471 | 471 | $args = array(); |
472 | 472 | } else { |
473 | 473 | $args = $box['args']; |
474 | 474 | } |
475 | - $r = wp_parse_args( $args, $defaults ); |
|
476 | - $tax_name = esc_attr( $r['taxonomy'] ); |
|
477 | - $taxonomy = get_taxonomy( $r['taxonomy'] ); |
|
475 | + $r = wp_parse_args($args, $defaults); |
|
476 | + $tax_name = esc_attr($r['taxonomy']); |
|
477 | + $taxonomy = get_taxonomy($r['taxonomy']); |
|
478 | 478 | ?> |
479 | 479 | <div id="taxonomy-<?php echo $tax_name; ?>" class="categorydiv"> |
480 | 480 | <ul id="<?php echo $tax_name; ?>-tabs" class="category-tabs"> |
481 | 481 | <li class="tabs"><a href="#<?php echo $tax_name; ?>-all"><?php echo $taxonomy->labels->all_items; ?></a></li> |
482 | - <li class="hide-if-no-js"><a href="#<?php echo $tax_name; ?>-pop"><?php _e( 'Most Used' ); ?></a></li> |
|
482 | + <li class="hide-if-no-js"><a href="#<?php echo $tax_name; ?>-pop"><?php _e('Most Used'); ?></a></li> |
|
483 | 483 | </ul> |
484 | 484 | |
485 | 485 | <div id="<?php echo $tax_name; ?>-pop" class="tabs-panel" style="display: none;"> |
486 | 486 | <ul id="<?php echo $tax_name; ?>checklist-pop" class="categorychecklist form-no-clear" > |
487 | - <?php $popular_ids = wp_popular_terms_checklist( $tax_name ); ?> |
|
487 | + <?php $popular_ids = wp_popular_terms_checklist($tax_name); ?> |
|
488 | 488 | </ul> |
489 | 489 | </div> |
490 | 490 | |
491 | 491 | <div id="<?php echo $tax_name; ?>-all" class="tabs-panel"> |
492 | 492 | <?php |
493 | - $name = ( $tax_name == 'category' ) ? 'post_category' : 'tax_input[' . $tax_name . ']'; |
|
493 | + $name = ($tax_name == 'category') ? 'post_category' : 'tax_input['.$tax_name.']'; |
|
494 | 494 | echo "<input type='hidden' name='{$name}[]' value='0' />"; // Allows for an empty term set to be sent. 0 is an invalid Term ID and will be ignored by empty() checks. |
495 | 495 | ?> |
496 | 496 | <ul id="<?php echo $tax_name; ?>checklist" data-wp-lists="list:<?php echo $tax_name; ?>" class="categorychecklist form-no-clear"> |
497 | - <?php wp_terms_checklist( $post->ID, array( 'taxonomy' => $tax_name, 'popular_cats' => $popular_ids ) ); ?> |
|
497 | + <?php wp_terms_checklist($post->ID, array('taxonomy' => $tax_name, 'popular_cats' => $popular_ids)); ?> |
|
498 | 498 | </ul> |
499 | 499 | </div> |
500 | - <?php if ( current_user_can( $taxonomy->cap->edit_terms ) ) : ?> |
|
500 | + <?php if (current_user_can($taxonomy->cap->edit_terms)) : ?> |
|
501 | 501 | <div id="<?php echo $tax_name; ?>-adder" class="wp-hidden-children"> |
502 | 502 | <a id="<?php echo $tax_name; ?>-add-toggle" href="#<?php echo $tax_name; ?>-add" class="hide-if-no-js taxonomy-add-new"> |
503 | 503 | <?php |
504 | 504 | /* translators: %s: add new taxonomy label */ |
505 | - printf( __( '+ %s' ), $taxonomy->labels->add_new_item ); |
|
505 | + printf(__('+ %s'), $taxonomy->labels->add_new_item); |
|
506 | 506 | ?> |
507 | 507 | </a> |
508 | 508 | <p id="<?php echo $tax_name; ?>-add" class="category-add wp-hidden-child"> |
509 | 509 | <label class="screen-reader-text" for="new<?php echo $tax_name; ?>"><?php echo $taxonomy->labels->add_new_item; ?></label> |
510 | - <input type="text" name="new<?php echo $tax_name; ?>" id="new<?php echo $tax_name; ?>" class="form-required form-input-tip" value="<?php echo esc_attr( $taxonomy->labels->new_item_name ); ?>" aria-required="true"/> |
|
510 | + <input type="text" name="new<?php echo $tax_name; ?>" id="new<?php echo $tax_name; ?>" class="form-required form-input-tip" value="<?php echo esc_attr($taxonomy->labels->new_item_name); ?>" aria-required="true"/> |
|
511 | 511 | <label class="screen-reader-text" for="new<?php echo $tax_name; ?>_parent"> |
512 | 512 | <?php echo $taxonomy->labels->parent_item_colon; ?> |
513 | 513 | </label> |
@@ -515,10 +515,10 @@ discard block |
||
515 | 515 | $parent_dropdown_args = array( |
516 | 516 | 'taxonomy' => $tax_name, |
517 | 517 | 'hide_empty' => 0, |
518 | - 'name' => 'new' . $tax_name . '_parent', |
|
518 | + 'name' => 'new'.$tax_name.'_parent', |
|
519 | 519 | 'orderby' => 'name', |
520 | 520 | 'hierarchical' => 1, |
521 | - 'show_option_none' => '— ' . $taxonomy->labels->parent_item . ' —', |
|
521 | + 'show_option_none' => '— '.$taxonomy->labels->parent_item.' —', |
|
522 | 522 | ); |
523 | 523 | |
524 | 524 | /** |
@@ -545,12 +545,12 @@ discard block |
||
545 | 545 | * taxonomy label. |
546 | 546 | * } |
547 | 547 | */ |
548 | - $parent_dropdown_args = apply_filters( 'post_edit_category_parent_dropdown_args', $parent_dropdown_args ); |
|
548 | + $parent_dropdown_args = apply_filters('post_edit_category_parent_dropdown_args', $parent_dropdown_args); |
|
549 | 549 | |
550 | - wp_dropdown_categories( $parent_dropdown_args ); |
|
550 | + wp_dropdown_categories($parent_dropdown_args); |
|
551 | 551 | ?> |
552 | - <input type="button" id="<?php echo $tax_name; ?>-add-submit" data-wp-lists="add:<?php echo $tax_name; ?>checklist:<?php echo $tax_name; ?>-add" class="button category-add-submit" value="<?php echo esc_attr( $taxonomy->labels->add_new_item ); ?>" /> |
|
553 | - <?php wp_nonce_field( 'add-' . $tax_name, '_ajax_nonce-add-' . $tax_name, false ); ?> |
|
552 | + <input type="button" id="<?php echo $tax_name; ?>-add-submit" data-wp-lists="add:<?php echo $tax_name; ?>checklist:<?php echo $tax_name; ?>-add" class="button category-add-submit" value="<?php echo esc_attr($taxonomy->labels->add_new_item); ?>" /> |
|
553 | + <?php wp_nonce_field('add-'.$tax_name, '_ajax_nonce-add-'.$tax_name, false); ?> |
|
554 | 554 | <span id="<?php echo $tax_name; ?>-ajax-response"></span> |
555 | 555 | </p> |
556 | 556 | </div> |
@@ -572,8 +572,8 @@ discard block |
||
572 | 572 | <p><?php |
573 | 573 | printf( |
574 | 574 | /* translators: %s: Codex URL */ |
575 | - __( 'Excerpts are optional hand-crafted summaries of your content that can be used in your theme. <a href="%s">Learn more about manual excerpts</a>.' ), |
|
576 | - __( 'https://codex.wordpress.org/Excerpt' ) |
|
575 | + __('Excerpts are optional hand-crafted summaries of your content that can be used in your theme. <a href="%s">Learn more about manual excerpts</a>.'), |
|
576 | + __('https://codex.wordpress.org/Excerpt') |
|
577 | 577 | ); |
578 | 578 | ?></p> |
579 | 579 | <?php |
@@ -587,32 +587,32 @@ discard block |
||
587 | 587 | * @param object $post |
588 | 588 | */ |
589 | 589 | function post_trackback_meta_box($post) { |
590 | - $form_trackback = '<input type="text" name="trackback_url" id="trackback_url" class="code" value="' . |
|
591 | - esc_attr( str_replace( "\n", ' ', $post->to_ping ) ) . '" aria-describedby="trackback-url-desc" />'; |
|
590 | + $form_trackback = '<input type="text" name="trackback_url" id="trackback_url" class="code" value="'. |
|
591 | + esc_attr(str_replace("\n", ' ', $post->to_ping)).'" aria-describedby="trackback-url-desc" />'; |
|
592 | 592 | if ('' != $post->pinged) { |
593 | - $pings = '<p>'. __('Already pinged:') . '</p><ul>'; |
|
593 | + $pings = '<p>'.__('Already pinged:').'</p><ul>'; |
|
594 | 594 | $already_pinged = explode("\n", trim($post->pinged)); |
595 | 595 | foreach ($already_pinged as $pinged_url) { |
596 | - $pings .= "\n\t<li>" . esc_html($pinged_url) . "</li>"; |
|
596 | + $pings .= "\n\t<li>".esc_html($pinged_url)."</li>"; |
|
597 | 597 | } |
598 | 598 | $pings .= '</ul>'; |
599 | 599 | } |
600 | 600 | |
601 | 601 | ?> |
602 | 602 | <p> |
603 | - <label for="trackback_url"><?php _e( 'Send trackbacks to:' ); ?></label> |
|
603 | + <label for="trackback_url"><?php _e('Send trackbacks to:'); ?></label> |
|
604 | 604 | <?php echo $form_trackback; ?> |
605 | 605 | </p> |
606 | -<p id="trackback-url-desc" class="howto"><?php _e( 'Separate multiple URLs with spaces' ); ?></p> |
|
606 | +<p id="trackback-url-desc" class="howto"><?php _e('Separate multiple URLs with spaces'); ?></p> |
|
607 | 607 | <p><?php |
608 | 608 | printf( |
609 | 609 | /* translators: %s: Codex URL */ |
610 | - __( 'Trackbacks are a way to notify legacy blog systems that you’ve linked to them. If you link other WordPress sites, they’ll be notified automatically using <a href="%s">pingbacks</a>, no other action necessary.' ), |
|
611 | - __( 'https://codex.wordpress.org/Introduction_to_Blogging#Managing_Comments' ) |
|
610 | + __('Trackbacks are a way to notify legacy blog systems that you’ve linked to them. If you link other WordPress sites, they’ll be notified automatically using <a href="%s">pingbacks</a>, no other action necessary.'), |
|
611 | + __('https://codex.wordpress.org/Introduction_to_Blogging#Managing_Comments') |
|
612 | 612 | ); |
613 | 613 | ?></p> |
614 | 614 | <?php |
615 | -if ( ! empty($pings) ) |
|
615 | +if ( ! empty($pings)) |
|
616 | 616 | echo $pings; |
617 | 617 | } |
618 | 618 | |
@@ -629,18 +629,18 @@ discard block |
||
629 | 629 | <div id="ajax-response"></div> |
630 | 630 | <?php |
631 | 631 | $metadata = has_meta($post->ID); |
632 | -foreach ( $metadata as $key => $value ) { |
|
633 | - if ( is_protected_meta( $metadata[ $key ][ 'meta_key' ], 'post' ) || ! current_user_can( 'edit_post_meta', $post->ID, $metadata[ $key ][ 'meta_key' ] ) ) |
|
634 | - unset( $metadata[ $key ] ); |
|
632 | +foreach ($metadata as $key => $value) { |
|
633 | + if (is_protected_meta($metadata[$key]['meta_key'], 'post') || ! current_user_can('edit_post_meta', $post->ID, $metadata[$key]['meta_key'])) |
|
634 | + unset($metadata[$key]); |
|
635 | 635 | } |
636 | -list_meta( $metadata ); |
|
637 | -meta_form( $post ); ?> |
|
636 | +list_meta($metadata); |
|
637 | +meta_form($post); ?> |
|
638 | 638 | </div> |
639 | 639 | <p><?php |
640 | 640 | printf( |
641 | 641 | /* translators: %s: Codex URL */ |
642 | - __( 'Custom fields can be used to add extra metadata to a post that you can <a href="%s">use in your theme</a>.' ), |
|
643 | - __( 'https://codex.wordpress.org/Using_Custom_Fields' ) |
|
642 | + __('Custom fields can be used to add extra metadata to a post that you can <a href="%s">use in your theme</a>.'), |
|
643 | + __('https://codex.wordpress.org/Using_Custom_Fields') |
|
644 | 644 | ); |
645 | 645 | ?></p> |
646 | 646 | <?php |
@@ -657,12 +657,12 @@ discard block |
||
657 | 657 | ?> |
658 | 658 | <input name="advanced_view" type="hidden" value="1" /> |
659 | 659 | <p class="meta-options"> |
660 | - <label for="comment_status" class="selectit"><input name="comment_status" type="checkbox" id="comment_status" value="open" <?php checked($post->comment_status, 'open'); ?> /> <?php _e( 'Allow comments.' ) ?></label><br /> |
|
660 | + <label for="comment_status" class="selectit"><input name="comment_status" type="checkbox" id="comment_status" value="open" <?php checked($post->comment_status, 'open'); ?> /> <?php _e('Allow comments.') ?></label><br /> |
|
661 | 661 | <label for="ping_status" class="selectit"><input name="ping_status" type="checkbox" id="ping_status" value="open" <?php checked($post->ping_status, 'open'); ?> /> <?php |
662 | 662 | printf( |
663 | 663 | /* translators: %s: Codex URL */ |
664 | - __( 'Allow <a href="%s">trackbacks and pingbacks</a> on this page.' ), |
|
665 | - __( 'https://codex.wordpress.org/Introduction_to_Blogging#Managing_Comments' ) ); |
|
664 | + __('Allow <a href="%s">trackbacks and pingbacks</a> on this page.'), |
|
665 | + __('https://codex.wordpress.org/Introduction_to_Blogging#Managing_Comments') ); |
|
666 | 666 | ?></label> |
667 | 667 | <?php |
668 | 668 | /** |
@@ -672,7 +672,7 @@ discard block |
||
672 | 672 | * |
673 | 673 | * @param WP_Post $post WP_Post object of the current post. |
674 | 674 | */ |
675 | - do_action( 'post_comment_status_meta_box-options', $post ); |
|
675 | + do_action('post_comment_status_meta_box-options', $post); |
|
676 | 676 | ?> |
677 | 677 | </p> |
678 | 678 | <?php |
@@ -698,21 +698,21 @@ discard block |
||
698 | 698 | * |
699 | 699 | * @param object $post |
700 | 700 | */ |
701 | -function post_comment_meta_box( $post ) { |
|
702 | - wp_nonce_field( 'get-comments', 'add_comment_nonce', false ); |
|
701 | +function post_comment_meta_box($post) { |
|
702 | + wp_nonce_field('get-comments', 'add_comment_nonce', false); |
|
703 | 703 | ?> |
704 | 704 | <p class="hide-if-no-js" id="add-new-comment"><a class="button" href="#commentstatusdiv" onclick="window.commentReply && commentReply.addcomment(<?php echo $post->ID; ?>);return false;"><?php _e('Add comment'); ?></a></p> |
705 | 705 | <?php |
706 | 706 | |
707 | - $total = get_comments( array( 'post_id' => $post->ID, 'number' => 1, 'count' => true ) ); |
|
707 | + $total = get_comments(array('post_id' => $post->ID, 'number' => 1, 'count' => true)); |
|
708 | 708 | $wp_list_table = _get_list_table('WP_Post_Comments_List_Table'); |
709 | - $wp_list_table->display( true ); |
|
709 | + $wp_list_table->display(true); |
|
710 | 710 | |
711 | - if ( 1 > $total ) { |
|
712 | - echo '<p id="no-comments">' . __('No comments yet.') . '</p>'; |
|
711 | + if (1 > $total) { |
|
712 | + echo '<p id="no-comments">'.__('No comments yet.').'</p>'; |
|
713 | 713 | } else { |
714 | - $hidden = get_hidden_meta_boxes( get_current_screen() ); |
|
715 | - if ( ! in_array('commentsdiv', $hidden) ) { |
|
714 | + $hidden = get_hidden_meta_boxes(get_current_screen()); |
|
715 | + if ( ! in_array('commentsdiv', $hidden)) { |
|
716 | 716 | ?> |
717 | 717 | <script type="text/javascript">jQuery(document).ready(function(){commentsBox.get(<?php echo $total; ?>, 10);});</script> |
718 | 718 | <?php |
@@ -735,9 +735,9 @@ discard block |
||
735 | 735 | */ |
736 | 736 | function post_slug_meta_box($post) { |
737 | 737 | /** This filter is documented in wp-admin/edit-tag-form.php */ |
738 | -$editable_slug = apply_filters( 'editable_slug', $post->post_name, $post ); |
|
738 | +$editable_slug = apply_filters('editable_slug', $post->post_name, $post); |
|
739 | 739 | ?> |
740 | -<label class="screen-reader-text" for="post_name"><?php _e('Slug') ?></label><input name="post_name" type="text" size="13" id="post_name" value="<?php echo esc_attr( $editable_slug ); ?>" /> |
|
740 | +<label class="screen-reader-text" for="post_name"><?php _e('Slug') ?></label><input name="post_name" type="text" size="13" id="post_name" value="<?php echo esc_attr($editable_slug); ?>" /> |
|
741 | 741 | <?php |
742 | 742 | } |
743 | 743 | |
@@ -755,13 +755,13 @@ discard block |
||
755 | 755 | ?> |
756 | 756 | <label class="screen-reader-text" for="post_author_override"><?php _e('Author'); ?></label> |
757 | 757 | <?php |
758 | - wp_dropdown_users( array( |
|
758 | + wp_dropdown_users(array( |
|
759 | 759 | 'who' => 'authors', |
760 | 760 | 'name' => 'post_author_override', |
761 | 761 | 'selected' => empty($post->ID) ? $user_ID : $post->post_author, |
762 | 762 | 'include_selected' => true, |
763 | 763 | 'show' => 'display_name_with_login', |
764 | - ) ); |
|
764 | + )); |
|
765 | 765 | } |
766 | 766 | |
767 | 767 | /** |
@@ -771,8 +771,8 @@ discard block |
||
771 | 771 | * |
772 | 772 | * @param object $post |
773 | 773 | */ |
774 | -function post_revisions_meta_box( $post ) { |
|
775 | - wp_list_post_revisions( $post ); |
|
774 | +function post_revisions_meta_box($post) { |
|
775 | + wp_list_post_revisions($post); |
|
776 | 776 | } |
777 | 777 | |
778 | 778 | // -- Page related Meta Boxes |
@@ -786,7 +786,7 @@ discard block |
||
786 | 786 | */ |
787 | 787 | function page_attributes_meta_box($post) { |
788 | 788 | $post_type_object = get_post_type_object($post->post_type); |
789 | - if ( $post_type_object->hierarchical ) { |
|
789 | + if ($post_type_object->hierarchical) { |
|
790 | 790 | $dropdown_args = array( |
791 | 791 | 'post_type' => $post->post_type, |
792 | 792 | 'exclude_tree' => $post->ID, |
@@ -807,9 +807,9 @@ discard block |
||
807 | 807 | * @param array $dropdown_args Array of arguments used to generate the pages drop-down. |
808 | 808 | * @param WP_Post $post The current WP_Post object. |
809 | 809 | */ |
810 | - $dropdown_args = apply_filters( 'page_attributes_dropdown_pages_args', $dropdown_args, $post ); |
|
811 | - $pages = wp_dropdown_pages( $dropdown_args ); |
|
812 | - if ( ! empty($pages) ) { |
|
810 | + $dropdown_args = apply_filters('page_attributes_dropdown_pages_args', $dropdown_args, $post); |
|
811 | + $pages = wp_dropdown_pages($dropdown_args); |
|
812 | + if ( ! empty($pages)) { |
|
813 | 813 | ?> |
814 | 814 | <p><strong><?php _e('Parent') ?></strong></p> |
815 | 815 | <label class="screen-reader-text" for="parent_id"><?php _e('Parent') ?></label> |
@@ -817,8 +817,8 @@ discard block |
||
817 | 817 | <?php |
818 | 818 | } // end empty pages check |
819 | 819 | } // end hierarchical check. |
820 | - if ( 'page' == $post->post_type && 0 != count( get_page_templates( $post ) ) && get_option( 'page_for_posts' ) != $post->ID ) { |
|
821 | - $template = !empty($post->page_template) ? $post->page_template : false; |
|
820 | + if ('page' == $post->post_type && 0 != count(get_page_templates($post)) && get_option('page_for_posts') != $post->ID) { |
|
821 | + $template = ! empty($post->page_template) ? $post->page_template : false; |
|
822 | 822 | ?> |
823 | 823 | <p><strong><?php _e('Template') ?></strong><?php |
824 | 824 | /** |
@@ -830,7 +830,7 @@ discard block |
||
830 | 830 | * @param string $template The template used for the current post. |
831 | 831 | * @param WP_Post $post The current post. |
832 | 832 | */ |
833 | - do_action( 'page_attributes_meta_box_template', $template, $post ); |
|
833 | + do_action('page_attributes_meta_box_template', $template, $post); |
|
834 | 834 | ?></p> |
835 | 835 | <label class="screen-reader-text" for="page_template"><?php _e('Page Template') ?></label><select name="page_template" id="page_template"> |
836 | 836 | <?php |
@@ -843,17 +843,17 @@ discard block |
||
843 | 843 | * @param string $context Where the option label is displayed. Possible values |
844 | 844 | * include 'meta-box' or 'quick-edit'. |
845 | 845 | */ |
846 | -$default_title = apply_filters( 'default_page_template_title', __( 'Default Template' ), 'meta-box' ); |
|
846 | +$default_title = apply_filters('default_page_template_title', __('Default Template'), 'meta-box'); |
|
847 | 847 | ?> |
848 | -<option value="default"><?php echo esc_html( $default_title ); ?></option> |
|
848 | +<option value="default"><?php echo esc_html($default_title); ?></option> |
|
849 | 849 | <?php page_template_dropdown($template); ?> |
850 | 850 | </select> |
851 | 851 | <?php |
852 | 852 | } ?> |
853 | 853 | <p><strong><?php _e('Order') ?></strong></p> |
854 | 854 | <p><label class="screen-reader-text" for="menu_order"><?php _e('Order') ?></label><input name="menu_order" type="text" size="4" id="menu_order" value="<?php echo esc_attr($post->menu_order) ?>" /></p> |
855 | -<?php if ( 'page' == $post->post_type && get_current_screen()->get_help_tabs() ) { ?> |
|
856 | -<p><?php _e( 'Need help? Use the Help tab in the upper right of your screen.' ); ?></p> |
|
855 | +<?php if ('page' == $post->post_type && get_current_screen()->get_help_tabs()) { ?> |
|
856 | +<p><?php _e('Need help? Use the Help tab in the upper right of your screen.'); ?></p> |
|
857 | 857 | <?php |
858 | 858 | } |
859 | 859 | } |
@@ -875,12 +875,12 @@ discard block |
||
875 | 875 | |
876 | 876 | <?php // Hidden submit button early on so that the browser chooses the right button when form is submitted with Return key ?> |
877 | 877 | <div style="display:none;"> |
878 | -<?php submit_button( __( 'Save' ), 'button', 'save', false ); ?> |
|
878 | +<?php submit_button(__('Save'), 'button', 'save', false); ?> |
|
879 | 879 | </div> |
880 | 880 | |
881 | 881 | <div id="minor-publishing-actions"> |
882 | 882 | <div id="preview-action"> |
883 | -<?php if ( !empty($link->link_id) ) { ?> |
|
883 | +<?php if ( ! empty($link->link_id)) { ?> |
|
884 | 884 | <a class="preview button" href="<?php echo $link->link_url; ?>" target="_blank"><?php _e('Visit Link'); ?></a> |
885 | 885 | <?php } ?> |
886 | 886 | </div> |
@@ -898,20 +898,20 @@ discard block |
||
898 | 898 | <div id="major-publishing-actions"> |
899 | 899 | <?php |
900 | 900 | /** This action is documented in wp-admin/includes/meta-boxes.php */ |
901 | -do_action( 'post_submitbox_start' ); |
|
901 | +do_action('post_submitbox_start'); |
|
902 | 902 | ?> |
903 | 903 | <div id="delete-action"> |
904 | 904 | <?php |
905 | -if ( !empty($_GET['action']) && 'edit' == $_GET['action'] && current_user_can('manage_links') ) { ?> |
|
906 | - <a class="submitdelete deletion" href="<?php echo wp_nonce_url("link.php?action=delete&link_id=$link->link_id", 'delete-bookmark_' . $link->link_id); ?>" onclick="if ( confirm('<?php echo esc_js(sprintf(__("You are about to delete this link '%s'\n 'Cancel' to stop, 'OK' to delete."), $link->link_name )); ?>') ) {return true;}return false;"><?php _e('Delete'); ?></a> |
|
905 | +if ( ! empty($_GET['action']) && 'edit' == $_GET['action'] && current_user_can('manage_links')) { ?> |
|
906 | + <a class="submitdelete deletion" href="<?php echo wp_nonce_url("link.php?action=delete&link_id=$link->link_id", 'delete-bookmark_'.$link->link_id); ?>" onclick="if ( confirm('<?php echo esc_js(sprintf(__("You are about to delete this link '%s'\n 'Cancel' to stop, 'OK' to delete."), $link->link_name)); ?>') ) {return true;}return false;"><?php _e('Delete'); ?></a> |
|
907 | 907 | <?php } ?> |
908 | 908 | </div> |
909 | 909 | |
910 | 910 | <div id="publishing-action"> |
911 | -<?php if ( !empty($link->link_id) ) { ?> |
|
912 | - <input name="save" type="submit" class="button-large button-primary" id="publish" value="<?php esc_attr_e( 'Update Link' ) ?>" /> |
|
911 | +<?php if ( ! empty($link->link_id)) { ?> |
|
912 | + <input name="save" type="submit" class="button-large button-primary" id="publish" value="<?php esc_attr_e('Update Link') ?>" /> |
|
913 | 913 | <?php } else { ?> |
914 | - <input name="save" type="submit" class="button-large button-primary" id="publish" value="<?php esc_attr_e( 'Add Link' ) ?>" /> |
|
914 | + <input name="save" type="submit" class="button-large button-primary" id="publish" value="<?php esc_attr_e('Add Link') ?>" /> |
|
915 | 915 | <?php } ?> |
916 | 916 | </div> |
917 | 917 | <div class="clear"></div> |
@@ -922,7 +922,7 @@ discard block |
||
922 | 922 | * |
923 | 923 | * @since 2.5.0 |
924 | 924 | */ |
925 | -do_action( 'submitlink_box' ); |
|
925 | +do_action('submitlink_box'); |
|
926 | 926 | ?> |
927 | 927 | <div class="clear"></div> |
928 | 928 | </div> |
@@ -940,14 +940,14 @@ discard block |
||
940 | 940 | ?> |
941 | 941 | <div id="taxonomy-linkcategory" class="categorydiv"> |
942 | 942 | <ul id="category-tabs" class="category-tabs"> |
943 | - <li class="tabs"><a href="#categories-all"><?php _e( 'All Categories' ); ?></a></li> |
|
944 | - <li class="hide-if-no-js"><a href="#categories-pop"><?php _e( 'Most Used' ); ?></a></li> |
|
943 | + <li class="tabs"><a href="#categories-all"><?php _e('All Categories'); ?></a></li> |
|
944 | + <li class="hide-if-no-js"><a href="#categories-pop"><?php _e('Most Used'); ?></a></li> |
|
945 | 945 | </ul> |
946 | 946 | |
947 | 947 | <div id="categories-all" class="tabs-panel"> |
948 | 948 | <ul id="categorychecklist" data-wp-lists="list:category" class="categorychecklist form-no-clear"> |
949 | 949 | <?php |
950 | - if ( isset($link->link_id) ) |
|
950 | + if (isset($link->link_id)) |
|
951 | 951 | wp_link_category_checklist($link->link_id); |
952 | 952 | else |
953 | 953 | wp_link_category_checklist(); |
@@ -962,12 +962,12 @@ discard block |
||
962 | 962 | </div> |
963 | 963 | |
964 | 964 | <div id="category-adder" class="wp-hidden-children"> |
965 | - <a id="category-add-toggle" href="#category-add" class="taxonomy-add-new"><?php _e( '+ Add New Category' ); ?></a> |
|
965 | + <a id="category-add-toggle" href="#category-add" class="taxonomy-add-new"><?php _e('+ Add New Category'); ?></a> |
|
966 | 966 | <p id="link-category-add" class="wp-hidden-child"> |
967 | - <label class="screen-reader-text" for="newcat"><?php _e( '+ Add New Category' ); ?></label> |
|
968 | - <input type="text" name="newcat" id="newcat" class="form-required form-input-tip" value="<?php esc_attr_e( 'New category name' ); ?>" aria-required="true" /> |
|
969 | - <input type="button" id="link-category-add-submit" data-wp-lists="add:categorychecklist:link-category-add" class="button" value="<?php esc_attr_e( 'Add' ); ?>" /> |
|
970 | - <?php wp_nonce_field( 'add-link-category', '_ajax_nonce', false ); ?> |
|
967 | + <label class="screen-reader-text" for="newcat"><?php _e('+ Add New Category'); ?></label> |
|
968 | + <input type="text" name="newcat" id="newcat" class="form-required form-input-tip" value="<?php esc_attr_e('New category name'); ?>" aria-required="true" /> |
|
969 | + <input type="button" id="link-category-add-submit" data-wp-lists="add:categorychecklist:link-category-add" class="button" value="<?php esc_attr_e('Add'); ?>" /> |
|
970 | + <?php wp_nonce_field('add-link-category', '_ajax_nonce', false); ?> |
|
971 | 971 | <span id="category-ajax-response"></span> |
972 | 972 | </p> |
973 | 973 | </div> |
@@ -985,13 +985,13 @@ discard block |
||
985 | 985 | function link_target_meta_box($link) { ?> |
986 | 986 | <fieldset><legend class="screen-reader-text"><span><?php _e('Target') ?></span></legend> |
987 | 987 | <p><label for="link_target_blank" class="selectit"> |
988 | -<input id="link_target_blank" type="radio" name="link_target" value="_blank" <?php echo ( isset( $link->link_target ) && ($link->link_target == '_blank') ? 'checked="checked"' : ''); ?> /> |
|
988 | +<input id="link_target_blank" type="radio" name="link_target" value="_blank" <?php echo (isset($link->link_target) && ($link->link_target == '_blank') ? 'checked="checked"' : ''); ?> /> |
|
989 | 989 | <?php _e('<code>_blank</code> — new window or tab.'); ?></label></p> |
990 | 990 | <p><label for="link_target_top" class="selectit"> |
991 | -<input id="link_target_top" type="radio" name="link_target" value="_top" <?php echo ( isset( $link->link_target ) && ($link->link_target == '_top') ? 'checked="checked"' : ''); ?> /> |
|
991 | +<input id="link_target_top" type="radio" name="link_target" value="_top" <?php echo (isset($link->link_target) && ($link->link_target == '_top') ? 'checked="checked"' : ''); ?> /> |
|
992 | 992 | <?php _e('<code>_top</code> — current window or tab, with no frames.'); ?></label></p> |
993 | 993 | <p><label for="link_target_none" class="selectit"> |
994 | -<input id="link_target_none" type="radio" name="link_target" value="" <?php echo ( isset( $link->link_target ) && ($link->link_target == '') ? 'checked="checked"' : ''); ?> /> |
|
994 | +<input id="link_target_none" type="radio" name="link_target" value="" <?php echo (isset($link->link_target) && ($link->link_target == '') ? 'checked="checked"' : ''); ?> /> |
|
995 | 995 | <?php _e('<code>_none</code> — same window or tab.'); ?></label></p> |
996 | 996 | </fieldset> |
997 | 997 | <p><?php _e('Choose the target frame for your link.'); ?></p> |
@@ -1009,16 +1009,16 @@ discard block |
||
1009 | 1009 | * @param string $value |
1010 | 1010 | * @param mixed $deprecated Never used. |
1011 | 1011 | */ |
1012 | -function xfn_check( $class, $value = '', $deprecated = '' ) { |
|
1012 | +function xfn_check($class, $value = '', $deprecated = '') { |
|
1013 | 1013 | global $link; |
1014 | 1014 | |
1015 | - if ( !empty( $deprecated ) ) |
|
1016 | - _deprecated_argument( __FUNCTION__, '0.0' ); // Never implemented |
|
1015 | + if ( ! empty($deprecated)) |
|
1016 | + _deprecated_argument(__FUNCTION__, '0.0'); // Never implemented |
|
1017 | 1017 | |
1018 | - $link_rel = isset( $link->link_rel ) ? $link->link_rel : ''; // In PHP 5.3: $link_rel = $link->link_rel ?: ''; |
|
1018 | + $link_rel = isset($link->link_rel) ? $link->link_rel : ''; // In PHP 5.3: $link_rel = $link->link_rel ?: ''; |
|
1019 | 1019 | $rels = preg_split('/\s+/', $link_rel); |
1020 | 1020 | |
1021 | - if ('' != $value && in_array($value, $rels) ) { |
|
1021 | + if ('' != $value && in_array($value, $rels)) { |
|
1022 | 1022 | echo ' checked="checked"'; |
1023 | 1023 | } |
1024 | 1024 | |
@@ -1026,7 +1026,7 @@ discard block |
||
1026 | 1026 | if ('family' == $class && strpos($link_rel, 'child') === false && strpos($link_rel, 'parent') === false && strpos($link_rel, 'sibling') === false && strpos($link_rel, 'spouse') === false && strpos($link_rel, 'kin') === false) echo ' checked="checked"'; |
1027 | 1027 | if ('friendship' == $class && strpos($link_rel, 'friend') === false && strpos($link_rel, 'acquaintance') === false && strpos($link_rel, 'contact') === false) echo ' checked="checked"'; |
1028 | 1028 | if ('geographical' == $class && strpos($link_rel, 'co-resident') === false && strpos($link_rel, 'neighbor') === false) echo ' checked="checked"'; |
1029 | - if ('identity' == $class && in_array('me', $rels) ) echo ' checked="checked"'; |
|
1029 | + if ('identity' == $class && in_array('me', $rels)) echo ' checked="checked"'; |
|
1030 | 1030 | } |
1031 | 1031 | } |
1032 | 1032 | |
@@ -1042,7 +1042,7 @@ discard block |
||
1042 | 1042 | <table class="links-table"> |
1043 | 1043 | <tr> |
1044 | 1044 | <th scope="row"><label for="link_rel"><?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('rel:') ?></label></th> |
1045 | - <td><input type="text" name="link_rel" id="link_rel" value="<?php echo ( isset( $link->link_rel ) ? esc_attr($link->link_rel) : ''); ?>" /></td> |
|
1045 | + <td><input type="text" name="link_rel" id="link_rel" value="<?php echo (isset($link->link_rel) ? esc_attr($link->link_rel) : ''); ?>" /></td> |
|
1046 | 1046 | </tr> |
1047 | 1047 | <tr> |
1048 | 1048 | <th scope="row"><?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('identity') ?></th> |
@@ -1160,25 +1160,25 @@ discard block |
||
1160 | 1160 | <table class="links-table" cellpadding="0"> |
1161 | 1161 | <tr> |
1162 | 1162 | <th scope="row"><label for="link_image"><?php _e('Image Address') ?></label></th> |
1163 | - <td><input type="text" name="link_image" class="code" id="link_image" maxlength="255" value="<?php echo ( isset( $link->link_image ) ? esc_attr($link->link_image) : ''); ?>" /></td> |
|
1163 | + <td><input type="text" name="link_image" class="code" id="link_image" maxlength="255" value="<?php echo (isset($link->link_image) ? esc_attr($link->link_image) : ''); ?>" /></td> |
|
1164 | 1164 | </tr> |
1165 | 1165 | <tr> |
1166 | 1166 | <th scope="row"><label for="rss_uri"><?php _e('RSS Address') ?></label></th> |
1167 | - <td><input name="link_rss" class="code" type="text" id="rss_uri" maxlength="255" value="<?php echo ( isset( $link->link_rss ) ? esc_attr($link->link_rss) : ''); ?>" /></td> |
|
1167 | + <td><input name="link_rss" class="code" type="text" id="rss_uri" maxlength="255" value="<?php echo (isset($link->link_rss) ? esc_attr($link->link_rss) : ''); ?>" /></td> |
|
1168 | 1168 | </tr> |
1169 | 1169 | <tr> |
1170 | 1170 | <th scope="row"><label for="link_notes"><?php _e('Notes') ?></label></th> |
1171 | - <td><textarea name="link_notes" id="link_notes" rows="10"><?php echo ( isset( $link->link_notes ) ? $link->link_notes : ''); // textarea_escaped ?></textarea></td> |
|
1171 | + <td><textarea name="link_notes" id="link_notes" rows="10"><?php echo (isset($link->link_notes) ? $link->link_notes : ''); // textarea_escaped ?></textarea></td> |
|
1172 | 1172 | </tr> |
1173 | 1173 | <tr> |
1174 | 1174 | <th scope="row"><label for="link_rating"><?php _e('Rating') ?></label></th> |
1175 | 1175 | <td><select name="link_rating" id="link_rating" size="1"> |
1176 | 1176 | <?php |
1177 | - for ( $r = 0; $r <= 10; $r++ ) { |
|
1178 | - echo '<option value="' . $r . '"'; |
|
1179 | - if ( isset($link->link_rating) && $link->link_rating == $r ) |
|
1177 | + for ($r = 0; $r <= 10; $r++) { |
|
1178 | + echo '<option value="'.$r.'"'; |
|
1179 | + if (isset($link->link_rating) && $link->link_rating == $r) |
|
1180 | 1180 | echo ' selected="selected"'; |
1181 | - echo('>' . $r . '</option>'); |
|
1181 | + echo('>'.$r.'</option>'); |
|
1182 | 1182 | } |
1183 | 1183 | ?></select> <?php _e('(Leave at 0 for no rating.)') ?> |
1184 | 1184 | </td> |
@@ -1194,9 +1194,9 @@ discard block |
||
1194 | 1194 | * |
1195 | 1195 | * @param WP_Post $post A post object. |
1196 | 1196 | */ |
1197 | -function post_thumbnail_meta_box( $post ) { |
|
1198 | - $thumbnail_id = get_post_meta( $post->ID, '_thumbnail_id', true ); |
|
1199 | - echo _wp_post_thumbnail_html( $thumbnail_id, $post->ID ); |
|
1197 | +function post_thumbnail_meta_box($post) { |
|
1198 | + $thumbnail_id = get_post_meta($post->ID, '_thumbnail_id', true); |
|
1199 | + echo _wp_post_thumbnail_html($thumbnail_id, $post->ID); |
|
1200 | 1200 | } |
1201 | 1201 | |
1202 | 1202 | /** |
@@ -1206,18 +1206,18 @@ discard block |
||
1206 | 1206 | * |
1207 | 1207 | * @param WP_Post $post A post object. |
1208 | 1208 | */ |
1209 | -function attachment_id3_data_meta_box( $post ) { |
|
1209 | +function attachment_id3_data_meta_box($post) { |
|
1210 | 1210 | $meta = array(); |
1211 | - if ( ! empty( $post->ID ) ) { |
|
1212 | - $meta = wp_get_attachment_metadata( $post->ID ); |
|
1211 | + if ( ! empty($post->ID)) { |
|
1212 | + $meta = wp_get_attachment_metadata($post->ID); |
|
1213 | 1213 | } |
1214 | 1214 | |
1215 | - foreach ( wp_get_attachment_id3_keys( $post, 'edit' ) as $key => $label ) : ?> |
|
1215 | + foreach (wp_get_attachment_id3_keys($post, 'edit') as $key => $label) : ?> |
|
1216 | 1216 | <p> |
1217 | 1217 | <label for="title"><?php echo $label ?></label><br /> |
1218 | - <input type="text" name="id3_<?php echo esc_attr( $key ) ?>" id="id3_<?php echo esc_attr( $key ) ?>" class="large-text" value="<?php |
|
1219 | - if ( ! empty( $meta[ $key ] ) ) { |
|
1220 | - echo esc_attr( $meta[ $key ] ); |
|
1218 | + <input type="text" name="id3_<?php echo esc_attr($key) ?>" id="id3_<?php echo esc_attr($key) ?>" class="large-text" value="<?php |
|
1219 | + if ( ! empty($meta[$key])) { |
|
1220 | + echo esc_attr($meta[$key]); |
|
1221 | 1221 | } |
1222 | 1222 | ?>" /> |
1223 | 1223 | </p> |
@@ -156,12 +156,12 @@ |
||
156 | 156 | } else { |
157 | 157 | $ext = '.jpg'; |
158 | 158 | switch ( $metadata['image']['mime'] ) { |
159 | - case 'image/gif': |
|
160 | - $ext = '.gif'; |
|
161 | - break; |
|
162 | - case 'image/png': |
|
163 | - $ext = '.png'; |
|
164 | - break; |
|
159 | + case 'image/gif': |
|
160 | + $ext = '.gif'; |
|
161 | + break; |
|
162 | + case 'image/png': |
|
163 | + $ext = '.png'; |
|
164 | + break; |
|
165 | 165 | } |
166 | 166 | $basename = str_replace( '.', '-', basename( $file ) ) . '-image' . $ext; |
167 | 167 | $uploaded = wp_upload_bits( $basename, '', $metadata['image']['data'] ); |
@@ -37,15 +37,18 @@ discard block |
||
37 | 37 | } |
38 | 38 | |
39 | 39 | $editor = wp_get_image_editor( $src ); |
40 | - if ( is_wp_error( $editor ) ) |
|
41 | - return $editor; |
|
40 | + if ( is_wp_error( $editor ) ) { |
|
41 | + return $editor; |
|
42 | + } |
|
42 | 43 | |
43 | 44 | $src = $editor->crop( $src_x, $src_y, $src_w, $src_h, $dst_w, $dst_h, $src_abs ); |
44 | - if ( is_wp_error( $src ) ) |
|
45 | - return $src; |
|
45 | + if ( is_wp_error( $src ) ) { |
|
46 | + return $src; |
|
47 | + } |
|
46 | 48 | |
47 | - if ( ! $dst_file ) |
|
48 | - $dst_file = str_replace( basename( $src_file ), 'cropped-' . basename( $src_file ), $src_file ); |
|
49 | + if ( ! $dst_file ) { |
|
50 | + $dst_file = str_replace( basename( $src_file ), 'cropped-' . basename( $src_file ), $src_file ); |
|
51 | + } |
|
49 | 52 | |
50 | 53 | /* |
51 | 54 | * The directory containing the original file may no longer exist when |
@@ -56,8 +59,9 @@ discard block |
||
56 | 59 | $dst_file = dirname( $dst_file ) . '/' . wp_unique_filename( dirname( $dst_file ), basename( $dst_file ) ); |
57 | 60 | |
58 | 61 | $result = $editor->save( $dst_file ); |
59 | - if ( is_wp_error( $result ) ) |
|
60 | - return $result; |
|
62 | + if ( is_wp_error( $result ) ) { |
|
63 | + return $result; |
|
64 | + } |
|
61 | 65 | |
62 | 66 | return $dst_file; |
63 | 67 | } |
@@ -92,18 +96,30 @@ discard block |
||
92 | 96 | $sizes = array(); |
93 | 97 | foreach ( get_intermediate_image_sizes() as $s ) { |
94 | 98 | $sizes[$s] = array( 'width' => '', 'height' => '', 'crop' => false ); |
95 | - if ( isset( $_wp_additional_image_sizes[$s]['width'] ) ) |
|
96 | - $sizes[$s]['width'] = intval( $_wp_additional_image_sizes[$s]['width'] ); // For theme-added sizes |
|
97 | - else |
|
98 | - $sizes[$s]['width'] = get_option( "{$s}_size_w" ); // For default sizes set in options |
|
99 | - if ( isset( $_wp_additional_image_sizes[$s]['height'] ) ) |
|
100 | - $sizes[$s]['height'] = intval( $_wp_additional_image_sizes[$s]['height'] ); // For theme-added sizes |
|
101 | - else |
|
102 | - $sizes[$s]['height'] = get_option( "{$s}_size_h" ); // For default sizes set in options |
|
103 | - if ( isset( $_wp_additional_image_sizes[$s]['crop'] ) ) |
|
104 | - $sizes[$s]['crop'] = $_wp_additional_image_sizes[$s]['crop']; // For theme-added sizes |
|
105 | - else |
|
106 | - $sizes[$s]['crop'] = get_option( "{$s}_crop" ); // For default sizes set in options |
|
99 | + if ( isset( $_wp_additional_image_sizes[$s]['width'] ) ) { |
|
100 | + $sizes[$s]['width'] = intval( $_wp_additional_image_sizes[$s]['width'] ); |
|
101 | + } |
|
102 | + // For theme-added sizes |
|
103 | + else { |
|
104 | + $sizes[$s]['width'] = get_option( "{$s}_size_w" ); |
|
105 | + } |
|
106 | + // For default sizes set in options |
|
107 | + if ( isset( $_wp_additional_image_sizes[$s]['height'] ) ) { |
|
108 | + $sizes[$s]['height'] = intval( $_wp_additional_image_sizes[$s]['height'] ); |
|
109 | + } |
|
110 | + // For theme-added sizes |
|
111 | + else { |
|
112 | + $sizes[$s]['height'] = get_option( "{$s}_size_h" ); |
|
113 | + } |
|
114 | + // For default sizes set in options |
|
115 | + if ( isset( $_wp_additional_image_sizes[$s]['crop'] ) ) { |
|
116 | + $sizes[$s]['crop'] = $_wp_additional_image_sizes[$s]['crop']; |
|
117 | + } |
|
118 | + // For theme-added sizes |
|
119 | + else { |
|
120 | + $sizes[$s]['crop'] = get_option( "{$s}_crop" ); |
|
121 | + } |
|
122 | + // For default sizes set in options |
|
107 | 123 | } |
108 | 124 | |
109 | 125 | /** |
@@ -118,16 +134,18 @@ discard block |
||
118 | 134 | if ( $sizes ) { |
119 | 135 | $editor = wp_get_image_editor( $file ); |
120 | 136 | |
121 | - if ( ! is_wp_error( $editor ) ) |
|
122 | - $metadata['sizes'] = $editor->multi_resize( $sizes ); |
|
137 | + if ( ! is_wp_error( $editor ) ) { |
|
138 | + $metadata['sizes'] = $editor->multi_resize( $sizes ); |
|
139 | + } |
|
123 | 140 | } else { |
124 | 141 | $metadata['sizes'] = array(); |
125 | 142 | } |
126 | 143 | |
127 | 144 | // Fetch additional metadata from EXIF/IPTC. |
128 | 145 | $image_meta = wp_read_image_metadata( $file ); |
129 | - if ( $image_meta ) |
|
130 | - $metadata['image_meta'] = $image_meta; |
|
146 | + if ( $image_meta ) { |
|
147 | + $metadata['image_meta'] = $image_meta; |
|
148 | + } |
|
131 | 149 | |
132 | 150 | } elseif ( wp_attachment_is( 'video', $attachment ) ) { |
133 | 151 | $metadata = wp_read_video_metadata( $file ); |
@@ -215,8 +233,9 @@ discard block |
||
215 | 233 | */ |
216 | 234 | function wp_exif_frac2dec($str) { |
217 | 235 | @list( $n, $d ) = explode( '/', $str ); |
218 | - if ( !empty($d) ) |
|
219 | - return $n / $d; |
|
236 | + if ( !empty($d) ) { |
|
237 | + return $n / $d; |
|
238 | + } |
|
220 | 239 | return $str; |
221 | 240 | } |
222 | 241 | |
@@ -252,8 +271,9 @@ discard block |
||
252 | 271 | * @return bool|array False on failure. Image metadata array on success. |
253 | 272 | */ |
254 | 273 | function wp_read_image_metadata( $file ) { |
255 | - if ( ! file_exists( $file ) ) |
|
256 | - return false; |
|
274 | + if ( ! file_exists( $file ) ) { |
|
275 | + return false; |
|
276 | + } |
|
257 | 277 | |
258 | 278 | list( , , $sourceImageType ) = getimagesize( $file ); |
259 | 279 | |
@@ -313,16 +333,23 @@ discard block |
||
313 | 333 | $meta['caption'] = $caption; |
314 | 334 | } |
315 | 335 | |
316 | - if ( ! empty( $iptc['2#110'][0] ) ) // credit |
|
336 | + if ( ! empty( $iptc['2#110'][0] ) ) { |
|
337 | + // credit |
|
317 | 338 | $meta['credit'] = trim( $iptc['2#110'][0] ); |
318 | - elseif ( ! empty( $iptc['2#080'][0] ) ) // creator / legacy byline |
|
339 | + } elseif ( ! empty( $iptc['2#080'][0] ) ) { |
|
340 | + // creator / legacy byline |
|
319 | 341 | $meta['credit'] = trim( $iptc['2#080'][0] ); |
342 | + } |
|
320 | 343 | |
321 | - if ( ! empty( $iptc['2#055'][0] ) && ! empty( $iptc['2#060'][0] ) ) // created date and time |
|
344 | + if ( ! empty( $iptc['2#055'][0] ) && ! empty( $iptc['2#060'][0] ) ) { |
|
345 | + // created date and time |
|
322 | 346 | $meta['created_timestamp'] = strtotime( $iptc['2#055'][0] . ' ' . $iptc['2#060'][0] ); |
347 | + } |
|
323 | 348 | |
324 | - if ( ! empty( $iptc['2#116'][0] ) ) // copyright |
|
349 | + if ( ! empty( $iptc['2#116'][0] ) ) { |
|
350 | + // copyright |
|
325 | 351 | $meta['copyright'] = trim( $iptc['2#116'][0] ); |
352 | + } |
|
326 | 353 | } |
327 | 354 | } |
328 | 355 | |
@@ -473,8 +500,9 @@ discard block |
||
473 | 500 | */ |
474 | 501 | function load_image_to_edit( $attachment_id, $mime_type, $size = 'full' ) { |
475 | 502 | $filepath = _load_image_to_edit_path( $attachment_id, $size ); |
476 | - if ( empty( $filepath ) ) |
|
477 | - return false; |
|
503 | + if ( empty( $filepath ) ) { |
|
504 | + return false; |
|
505 | + } |
|
478 | 506 | |
479 | 507 | switch ( $mime_type ) { |
480 | 508 | case 'image/jpeg': |
@@ -578,8 +606,9 @@ discard block |
||
578 | 606 | */ |
579 | 607 | function _copy_image_file( $attachment_id ) { |
580 | 608 | $dst_file = $src_file = get_attached_file( $attachment_id ); |
581 | - if ( ! file_exists( $src_file ) ) |
|
582 | - $src_file = _load_image_to_edit_path( $attachment_id ); |
|
609 | + if ( ! file_exists( $src_file ) ) { |
|
610 | + $src_file = _load_image_to_edit_path( $attachment_id ); |
|
611 | + } |
|
583 | 612 | |
584 | 613 | if ( $src_file ) { |
585 | 614 | $dst_file = str_replace( basename( $dst_file ), 'copy-' . basename( $dst_file ), $dst_file ); |
@@ -591,8 +620,9 @@ discard block |
||
591 | 620 | */ |
592 | 621 | wp_mkdir_p( dirname( $dst_file ) ); |
593 | 622 | |
594 | - if ( ! @copy( $src_file, $dst_file ) ) |
|
595 | - $dst_file = false; |
|
623 | + if ( ! @copy( $src_file, $dst_file ) ) { |
|
624 | + $dst_file = false; |
|
625 | + } |
|
596 | 626 | } else { |
597 | 627 | $dst_file = false; |
598 | 628 | } |
@@ -20,7 +20,7 @@ |
||
20 | 20 | * @param int $dst_h The destination height. |
21 | 21 | * @param int $src_abs Optional. If the source crop points are absolute. |
22 | 22 | * @param string $dst_file Optional. The destination file to write to. |
23 | - * @return string|WP_Error New filepath on success, WP_Error on failure. |
|
23 | + * @return string New filepath on success, WP_Error on failure. |
|
24 | 24 | */ |
25 | 25 | function wp_crop_image( $src, $src_x, $src_y, $src_w, $src_h, $dst_w, $dst_h, $src_abs = false, $dst_file = false ) { |
26 | 26 | $src_file = $src; |
@@ -22,41 +22,41 @@ discard block |
||
22 | 22 | * @param string $dst_file Optional. The destination file to write to. |
23 | 23 | * @return string|WP_Error New filepath on success, WP_Error on failure. |
24 | 24 | */ |
25 | -function wp_crop_image( $src, $src_x, $src_y, $src_w, $src_h, $dst_w, $dst_h, $src_abs = false, $dst_file = false ) { |
|
25 | +function wp_crop_image($src, $src_x, $src_y, $src_w, $src_h, $dst_w, $dst_h, $src_abs = false, $dst_file = false) { |
|
26 | 26 | $src_file = $src; |
27 | - if ( is_numeric( $src ) ) { // Handle int as attachment ID |
|
28 | - $src_file = get_attached_file( $src ); |
|
27 | + if (is_numeric($src)) { // Handle int as attachment ID |
|
28 | + $src_file = get_attached_file($src); |
|
29 | 29 | |
30 | - if ( ! file_exists( $src_file ) ) { |
|
30 | + if ( ! file_exists($src_file)) { |
|
31 | 31 | // If the file doesn't exist, attempt a URL fopen on the src link. |
32 | 32 | // This can occur with certain file replication plugins. |
33 | - $src = _load_image_to_edit_path( $src, 'full' ); |
|
33 | + $src = _load_image_to_edit_path($src, 'full'); |
|
34 | 34 | } else { |
35 | 35 | $src = $src_file; |
36 | 36 | } |
37 | 37 | } |
38 | 38 | |
39 | - $editor = wp_get_image_editor( $src ); |
|
40 | - if ( is_wp_error( $editor ) ) |
|
39 | + $editor = wp_get_image_editor($src); |
|
40 | + if (is_wp_error($editor)) |
|
41 | 41 | return $editor; |
42 | 42 | |
43 | - $src = $editor->crop( $src_x, $src_y, $src_w, $src_h, $dst_w, $dst_h, $src_abs ); |
|
44 | - if ( is_wp_error( $src ) ) |
|
43 | + $src = $editor->crop($src_x, $src_y, $src_w, $src_h, $dst_w, $dst_h, $src_abs); |
|
44 | + if (is_wp_error($src)) |
|
45 | 45 | return $src; |
46 | 46 | |
47 | - if ( ! $dst_file ) |
|
48 | - $dst_file = str_replace( basename( $src_file ), 'cropped-' . basename( $src_file ), $src_file ); |
|
47 | + if ( ! $dst_file) |
|
48 | + $dst_file = str_replace(basename($src_file), 'cropped-'.basename($src_file), $src_file); |
|
49 | 49 | |
50 | 50 | /* |
51 | 51 | * The directory containing the original file may no longer exist when |
52 | 52 | * using a replication plugin. |
53 | 53 | */ |
54 | - wp_mkdir_p( dirname( $dst_file ) ); |
|
54 | + wp_mkdir_p(dirname($dst_file)); |
|
55 | 55 | |
56 | - $dst_file = dirname( $dst_file ) . '/' . wp_unique_filename( dirname( $dst_file ), basename( $dst_file ) ); |
|
56 | + $dst_file = dirname($dst_file).'/'.wp_unique_filename(dirname($dst_file), basename($dst_file)); |
|
57 | 57 | |
58 | - $result = $editor->save( $dst_file ); |
|
59 | - if ( is_wp_error( $result ) ) |
|
58 | + $result = $editor->save($dst_file); |
|
59 | + if (is_wp_error($result)) |
|
60 | 60 | return $result; |
61 | 61 | |
62 | 62 | return $dst_file; |
@@ -73,13 +73,13 @@ discard block |
||
73 | 73 | * @param string $file Filepath of the Attached image. |
74 | 74 | * @return mixed Metadata for attachment. |
75 | 75 | */ |
76 | -function wp_generate_attachment_metadata( $attachment_id, $file ) { |
|
77 | - $attachment = get_post( $attachment_id ); |
|
76 | +function wp_generate_attachment_metadata($attachment_id, $file) { |
|
77 | + $attachment = get_post($attachment_id); |
|
78 | 78 | |
79 | 79 | $metadata = array(); |
80 | 80 | $support = false; |
81 | - if ( preg_match('!^image/!', get_post_mime_type( $attachment )) && file_is_displayable_image($file) ) { |
|
82 | - $imagesize = getimagesize( $file ); |
|
81 | + if (preg_match('!^image/!', get_post_mime_type($attachment)) && file_is_displayable_image($file)) { |
|
82 | + $imagesize = getimagesize($file); |
|
83 | 83 | $metadata['width'] = $imagesize[0]; |
84 | 84 | $metadata['height'] = $imagesize[1]; |
85 | 85 | |
@@ -90,20 +90,20 @@ discard block |
||
90 | 90 | global $_wp_additional_image_sizes; |
91 | 91 | |
92 | 92 | $sizes = array(); |
93 | - foreach ( get_intermediate_image_sizes() as $s ) { |
|
94 | - $sizes[$s] = array( 'width' => '', 'height' => '', 'crop' => false ); |
|
95 | - if ( isset( $_wp_additional_image_sizes[$s]['width'] ) ) |
|
96 | - $sizes[$s]['width'] = intval( $_wp_additional_image_sizes[$s]['width'] ); // For theme-added sizes |
|
93 | + foreach (get_intermediate_image_sizes() as $s) { |
|
94 | + $sizes[$s] = array('width' => '', 'height' => '', 'crop' => false); |
|
95 | + if (isset($_wp_additional_image_sizes[$s]['width'])) |
|
96 | + $sizes[$s]['width'] = intval($_wp_additional_image_sizes[$s]['width']); // For theme-added sizes |
|
97 | 97 | else |
98 | - $sizes[$s]['width'] = get_option( "{$s}_size_w" ); // For default sizes set in options |
|
99 | - if ( isset( $_wp_additional_image_sizes[$s]['height'] ) ) |
|
100 | - $sizes[$s]['height'] = intval( $_wp_additional_image_sizes[$s]['height'] ); // For theme-added sizes |
|
98 | + $sizes[$s]['width'] = get_option("{$s}_size_w"); // For default sizes set in options |
|
99 | + if (isset($_wp_additional_image_sizes[$s]['height'])) |
|
100 | + $sizes[$s]['height'] = intval($_wp_additional_image_sizes[$s]['height']); // For theme-added sizes |
|
101 | 101 | else |
102 | - $sizes[$s]['height'] = get_option( "{$s}_size_h" ); // For default sizes set in options |
|
103 | - if ( isset( $_wp_additional_image_sizes[$s]['crop'] ) ) |
|
102 | + $sizes[$s]['height'] = get_option("{$s}_size_h"); // For default sizes set in options |
|
103 | + if (isset($_wp_additional_image_sizes[$s]['crop'])) |
|
104 | 104 | $sizes[$s]['crop'] = $_wp_additional_image_sizes[$s]['crop']; // For theme-added sizes |
105 | 105 | else |
106 | - $sizes[$s]['crop'] = get_option( "{$s}_crop" ); // For default sizes set in options |
|
106 | + $sizes[$s]['crop'] = get_option("{$s}_crop"); // For default sizes set in options |
|
107 | 107 | } |
108 | 108 | |
109 | 109 | /** |
@@ -115,34 +115,34 @@ discard block |
||
115 | 115 | * @param array $sizes An associative array of image sizes. |
116 | 116 | * @param array $metadata An associative array of image metadata: width, height, file. |
117 | 117 | */ |
118 | - $sizes = apply_filters( 'intermediate_image_sizes_advanced', $sizes, $metadata ); |
|
118 | + $sizes = apply_filters('intermediate_image_sizes_advanced', $sizes, $metadata); |
|
119 | 119 | |
120 | - if ( $sizes ) { |
|
121 | - $editor = wp_get_image_editor( $file ); |
|
120 | + if ($sizes) { |
|
121 | + $editor = wp_get_image_editor($file); |
|
122 | 122 | |
123 | - if ( ! is_wp_error( $editor ) ) |
|
124 | - $metadata['sizes'] = $editor->multi_resize( $sizes ); |
|
123 | + if ( ! is_wp_error($editor)) |
|
124 | + $metadata['sizes'] = $editor->multi_resize($sizes); |
|
125 | 125 | } else { |
126 | 126 | $metadata['sizes'] = array(); |
127 | 127 | } |
128 | 128 | |
129 | 129 | // Fetch additional metadata from EXIF/IPTC. |
130 | - $image_meta = wp_read_image_metadata( $file ); |
|
131 | - if ( $image_meta ) |
|
130 | + $image_meta = wp_read_image_metadata($file); |
|
131 | + if ($image_meta) |
|
132 | 132 | $metadata['image_meta'] = $image_meta; |
133 | 133 | |
134 | - } elseif ( wp_attachment_is( 'video', $attachment ) ) { |
|
135 | - $metadata = wp_read_video_metadata( $file ); |
|
136 | - $support = current_theme_supports( 'post-thumbnails', 'attachment:video' ) || post_type_supports( 'attachment:video', 'thumbnail' ); |
|
137 | - } elseif ( wp_attachment_is( 'audio', $attachment ) ) { |
|
138 | - $metadata = wp_read_audio_metadata( $file ); |
|
139 | - $support = current_theme_supports( 'post-thumbnails', 'attachment:audio' ) || post_type_supports( 'attachment:audio', 'thumbnail' ); |
|
134 | + } elseif (wp_attachment_is('video', $attachment)) { |
|
135 | + $metadata = wp_read_video_metadata($file); |
|
136 | + $support = current_theme_supports('post-thumbnails', 'attachment:video') || post_type_supports('attachment:video', 'thumbnail'); |
|
137 | + } elseif (wp_attachment_is('audio', $attachment)) { |
|
138 | + $metadata = wp_read_audio_metadata($file); |
|
139 | + $support = current_theme_supports('post-thumbnails', 'attachment:audio') || post_type_supports('attachment:audio', 'thumbnail'); |
|
140 | 140 | } |
141 | 141 | |
142 | - if ( $support && ! empty( $metadata['image']['data'] ) ) { |
|
142 | + if ($support && ! empty($metadata['image']['data'])) { |
|
143 | 143 | // Check for existing cover. |
144 | - $hash = md5( $metadata['image']['data'] ); |
|
145 | - $posts = get_posts( array( |
|
144 | + $hash = md5($metadata['image']['data']); |
|
145 | + $posts = get_posts(array( |
|
146 | 146 | 'fields' => 'ids', |
147 | 147 | 'post_type' => 'attachment', |
148 | 148 | 'post_mime_type' => $metadata['image']['mime'], |
@@ -150,14 +150,14 @@ discard block |
||
150 | 150 | 'posts_per_page' => 1, |
151 | 151 | 'meta_key' => '_cover_hash', |
152 | 152 | 'meta_value' => $hash |
153 | - ) ); |
|
154 | - $exists = reset( $posts ); |
|
153 | + )); |
|
154 | + $exists = reset($posts); |
|
155 | 155 | |
156 | - if ( ! empty( $exists ) ) { |
|
157 | - update_post_meta( $attachment_id, '_thumbnail_id', $exists ); |
|
156 | + if ( ! empty($exists)) { |
|
157 | + update_post_meta($attachment_id, '_thumbnail_id', $exists); |
|
158 | 158 | } else { |
159 | 159 | $ext = '.jpg'; |
160 | - switch ( $metadata['image']['mime'] ) { |
|
160 | + switch ($metadata['image']['mime']) { |
|
161 | 161 | case 'image/gif': |
162 | 162 | $ext = '.gif'; |
163 | 163 | break; |
@@ -165,9 +165,9 @@ discard block |
||
165 | 165 | $ext = '.png'; |
166 | 166 | break; |
167 | 167 | } |
168 | - $basename = str_replace( '.', '-', basename( $file ) ) . '-image' . $ext; |
|
169 | - $uploaded = wp_upload_bits( $basename, '', $metadata['image']['data'] ); |
|
170 | - if ( false === $uploaded['error'] ) { |
|
168 | + $basename = str_replace('.', '-', basename($file)).'-image'.$ext; |
|
169 | + $uploaded = wp_upload_bits($basename, '', $metadata['image']['data']); |
|
170 | + if (false === $uploaded['error']) { |
|
171 | 171 | $image_attachment = array( |
172 | 172 | 'post_mime_type' => $metadata['image']['mime'], |
173 | 173 | 'post_type' => 'attachment', |
@@ -182,20 +182,20 @@ discard block |
||
182 | 182 | * @param array $metadata Current attachment metadata. |
183 | 183 | * @param array $uploaded An array containing the thumbnail path and url. |
184 | 184 | */ |
185 | - $image_attachment = apply_filters( 'attachment_thumbnail_args', $image_attachment, $metadata, $uploaded ); |
|
185 | + $image_attachment = apply_filters('attachment_thumbnail_args', $image_attachment, $metadata, $uploaded); |
|
186 | 186 | |
187 | - $sub_attachment_id = wp_insert_attachment( $image_attachment, $uploaded['file'] ); |
|
188 | - add_post_meta( $sub_attachment_id, '_cover_hash', $hash ); |
|
189 | - $attach_data = wp_generate_attachment_metadata( $sub_attachment_id, $uploaded['file'] ); |
|
190 | - wp_update_attachment_metadata( $sub_attachment_id, $attach_data ); |
|
191 | - update_post_meta( $attachment_id, '_thumbnail_id', $sub_attachment_id ); |
|
187 | + $sub_attachment_id = wp_insert_attachment($image_attachment, $uploaded['file']); |
|
188 | + add_post_meta($sub_attachment_id, '_cover_hash', $hash); |
|
189 | + $attach_data = wp_generate_attachment_metadata($sub_attachment_id, $uploaded['file']); |
|
190 | + wp_update_attachment_metadata($sub_attachment_id, $attach_data); |
|
191 | + update_post_meta($attachment_id, '_thumbnail_id', $sub_attachment_id); |
|
192 | 192 | } |
193 | 193 | } |
194 | 194 | } |
195 | 195 | |
196 | 196 | // Remove the blob of binary data from the array. |
197 | - if ( $metadata ) { |
|
198 | - unset( $metadata['image']['data'] ); |
|
197 | + if ($metadata) { |
|
198 | + unset($metadata['image']['data']); |
|
199 | 199 | } |
200 | 200 | |
201 | 201 | /** |
@@ -206,7 +206,7 @@ discard block |
||
206 | 206 | * @param array $metadata An array of attachment meta data. |
207 | 207 | * @param int $attachment_id Current attachment ID. |
208 | 208 | */ |
209 | - return apply_filters( 'wp_generate_attachment_metadata', $metadata, $attachment_id ); |
|
209 | + return apply_filters('wp_generate_attachment_metadata', $metadata, $attachment_id); |
|
210 | 210 | } |
211 | 211 | |
212 | 212 | /** |
@@ -218,8 +218,8 @@ discard block |
||
218 | 218 | * @return int|float |
219 | 219 | */ |
220 | 220 | function wp_exif_frac2dec($str) { |
221 | - @list( $n, $d ) = explode( '/', $str ); |
|
222 | - if ( !empty($d) ) |
|
221 | + @list($n, $d) = explode('/', $str); |
|
222 | + if ( ! empty($d)) |
|
223 | 223 | return $n / $d; |
224 | 224 | return $str; |
225 | 225 | } |
@@ -233,10 +233,10 @@ discard block |
||
233 | 233 | * @return int |
234 | 234 | */ |
235 | 235 | function wp_exif_date2ts($str) { |
236 | - @list( $date, $time ) = explode( ' ', trim($str) ); |
|
237 | - @list( $y, $m, $d ) = explode( ':', $date ); |
|
236 | + @list($date, $time) = explode(' ', trim($str)); |
|
237 | + @list($y, $m, $d) = explode(':', $date); |
|
238 | 238 | |
239 | - return strtotime( "{$y}-{$m}-{$d} {$time}" ); |
|
239 | + return strtotime("{$y}-{$m}-{$d} {$time}"); |
|
240 | 240 | } |
241 | 241 | |
242 | 242 | /** |
@@ -255,11 +255,11 @@ discard block |
||
255 | 255 | * @param string $file |
256 | 256 | * @return bool|array False on failure. Image metadata array on success. |
257 | 257 | */ |
258 | -function wp_read_image_metadata( $file ) { |
|
259 | - if ( ! file_exists( $file ) ) |
|
258 | +function wp_read_image_metadata($file) { |
|
259 | + if ( ! file_exists($file)) |
|
260 | 260 | return false; |
261 | 261 | |
262 | - list( , , $sourceImageType ) = getimagesize( $file ); |
|
262 | + list(,, $sourceImageType) = getimagesize($file); |
|
263 | 263 | |
264 | 264 | /* |
265 | 265 | * EXIF contains a bunch of data we'll probably never need formatted in ways |
@@ -287,31 +287,31 @@ discard block |
||
287 | 287 | * Read IPTC first, since it might contain data not available in exif such |
288 | 288 | * as caption, description etc. |
289 | 289 | */ |
290 | - if ( is_callable( 'iptcparse' ) ) { |
|
291 | - getimagesize( $file, $info ); |
|
290 | + if (is_callable('iptcparse')) { |
|
291 | + getimagesize($file, $info); |
|
292 | 292 | |
293 | - if ( ! empty( $info['APP13'] ) ) { |
|
294 | - $iptc = iptcparse( $info['APP13'] ); |
|
293 | + if ( ! empty($info['APP13'])) { |
|
294 | + $iptc = iptcparse($info['APP13']); |
|
295 | 295 | |
296 | 296 | // Headline, "A brief synopsis of the caption." |
297 | - if ( ! empty( $iptc['2#105'][0] ) ) { |
|
298 | - $meta['title'] = trim( $iptc['2#105'][0] ); |
|
297 | + if ( ! empty($iptc['2#105'][0])) { |
|
298 | + $meta['title'] = trim($iptc['2#105'][0]); |
|
299 | 299 | /* |
300 | 300 | * Title, "Many use the Title field to store the filename of the image, |
301 | 301 | * though the field may be used in many ways." |
302 | 302 | */ |
303 | - } elseif ( ! empty( $iptc['2#005'][0] ) ) { |
|
304 | - $meta['title'] = trim( $iptc['2#005'][0] ); |
|
303 | + } elseif ( ! empty($iptc['2#005'][0])) { |
|
304 | + $meta['title'] = trim($iptc['2#005'][0]); |
|
305 | 305 | } |
306 | 306 | |
307 | - if ( ! empty( $iptc['2#120'][0] ) ) { // description / legacy caption |
|
308 | - $caption = trim( $iptc['2#120'][0] ); |
|
307 | + if ( ! empty($iptc['2#120'][0])) { // description / legacy caption |
|
308 | + $caption = trim($iptc['2#120'][0]); |
|
309 | 309 | |
310 | 310 | mbstring_binary_safe_encoding(); |
311 | - $caption_length = strlen( $caption ); |
|
311 | + $caption_length = strlen($caption); |
|
312 | 312 | reset_mbstring_encoding(); |
313 | 313 | |
314 | - if ( empty( $meta['title'] ) && $caption_length < 80 ) { |
|
314 | + if (empty($meta['title']) && $caption_length < 80) { |
|
315 | 315 | // Assume the title is stored in 2:120 if it's short. |
316 | 316 | $meta['title'] = $caption; |
317 | 317 | } |
@@ -319,19 +319,19 @@ discard block |
||
319 | 319 | $meta['caption'] = $caption; |
320 | 320 | } |
321 | 321 | |
322 | - if ( ! empty( $iptc['2#110'][0] ) ) // credit |
|
323 | - $meta['credit'] = trim( $iptc['2#110'][0] ); |
|
324 | - elseif ( ! empty( $iptc['2#080'][0] ) ) // creator / legacy byline |
|
325 | - $meta['credit'] = trim( $iptc['2#080'][0] ); |
|
322 | + if ( ! empty($iptc['2#110'][0])) // credit |
|
323 | + $meta['credit'] = trim($iptc['2#110'][0]); |
|
324 | + elseif ( ! empty($iptc['2#080'][0])) // creator / legacy byline |
|
325 | + $meta['credit'] = trim($iptc['2#080'][0]); |
|
326 | 326 | |
327 | - if ( ! empty( $iptc['2#055'][0] ) && ! empty( $iptc['2#060'][0] ) ) // created date and time |
|
328 | - $meta['created_timestamp'] = strtotime( $iptc['2#055'][0] . ' ' . $iptc['2#060'][0] ); |
|
327 | + if ( ! empty($iptc['2#055'][0]) && ! empty($iptc['2#060'][0])) // created date and time |
|
328 | + $meta['created_timestamp'] = strtotime($iptc['2#055'][0].' '.$iptc['2#060'][0]); |
|
329 | 329 | |
330 | - if ( ! empty( $iptc['2#116'][0] ) ) // copyright |
|
331 | - $meta['copyright'] = trim( $iptc['2#116'][0] ); |
|
330 | + if ( ! empty($iptc['2#116'][0])) // copyright |
|
331 | + $meta['copyright'] = trim($iptc['2#116'][0]); |
|
332 | 332 | |
333 | - if ( ! empty( $iptc['2#025'][0] ) ) { // keywords array |
|
334 | - $meta['keywords'] = array_values( $iptc['2#025'] ); |
|
333 | + if ( ! empty($iptc['2#025'][0])) { // keywords array |
|
334 | + $meta['keywords'] = array_values($iptc['2#025']); |
|
335 | 335 | } |
336 | 336 | } |
337 | 337 | } |
@@ -343,78 +343,78 @@ discard block |
||
343 | 343 | * |
344 | 344 | * @param array $image_types Image types to check for exif data. |
345 | 345 | */ |
346 | - if ( is_callable( 'exif_read_data' ) && in_array( $sourceImageType, apply_filters( 'wp_read_image_metadata_types', array( IMAGETYPE_JPEG, IMAGETYPE_TIFF_II, IMAGETYPE_TIFF_MM ) ) ) ) { |
|
347 | - $exif = @exif_read_data( $file ); |
|
346 | + if (is_callable('exif_read_data') && in_array($sourceImageType, apply_filters('wp_read_image_metadata_types', array(IMAGETYPE_JPEG, IMAGETYPE_TIFF_II, IMAGETYPE_TIFF_MM)))) { |
|
347 | + $exif = @exif_read_data($file); |
|
348 | 348 | |
349 | - if ( ! empty( $exif['ImageDescription'] ) ) { |
|
349 | + if ( ! empty($exif['ImageDescription'])) { |
|
350 | 350 | mbstring_binary_safe_encoding(); |
351 | - $description_length = strlen( $exif['ImageDescription'] ); |
|
351 | + $description_length = strlen($exif['ImageDescription']); |
|
352 | 352 | reset_mbstring_encoding(); |
353 | 353 | |
354 | - if ( empty( $meta['title'] ) && $description_length < 80 ) { |
|
354 | + if (empty($meta['title']) && $description_length < 80) { |
|
355 | 355 | // Assume the title is stored in ImageDescription |
356 | - $meta['title'] = trim( $exif['ImageDescription'] ); |
|
356 | + $meta['title'] = trim($exif['ImageDescription']); |
|
357 | 357 | } |
358 | 358 | |
359 | - if ( empty( $meta['caption'] ) && ! empty( $exif['COMPUTED']['UserComment'] ) ) { |
|
360 | - $meta['caption'] = trim( $exif['COMPUTED']['UserComment'] ); |
|
359 | + if (empty($meta['caption']) && ! empty($exif['COMPUTED']['UserComment'])) { |
|
360 | + $meta['caption'] = trim($exif['COMPUTED']['UserComment']); |
|
361 | 361 | } |
362 | 362 | |
363 | - if ( empty( $meta['caption'] ) ) { |
|
364 | - $meta['caption'] = trim( $exif['ImageDescription'] ); |
|
363 | + if (empty($meta['caption'])) { |
|
364 | + $meta['caption'] = trim($exif['ImageDescription']); |
|
365 | 365 | } |
366 | - } elseif ( empty( $meta['caption'] ) && ! empty( $exif['Comments'] ) ) { |
|
367 | - $meta['caption'] = trim( $exif['Comments'] ); |
|
366 | + } elseif (empty($meta['caption']) && ! empty($exif['Comments'])) { |
|
367 | + $meta['caption'] = trim($exif['Comments']); |
|
368 | 368 | } |
369 | 369 | |
370 | - if ( empty( $meta['credit'] ) ) { |
|
371 | - if ( ! empty( $exif['Artist'] ) ) { |
|
372 | - $meta['credit'] = trim( $exif['Artist'] ); |
|
373 | - } elseif ( ! empty($exif['Author'] ) ) { |
|
374 | - $meta['credit'] = trim( $exif['Author'] ); |
|
370 | + if (empty($meta['credit'])) { |
|
371 | + if ( ! empty($exif['Artist'])) { |
|
372 | + $meta['credit'] = trim($exif['Artist']); |
|
373 | + } elseif ( ! empty($exif['Author'])) { |
|
374 | + $meta['credit'] = trim($exif['Author']); |
|
375 | 375 | } |
376 | 376 | } |
377 | 377 | |
378 | - if ( empty( $meta['copyright'] ) && ! empty( $exif['Copyright'] ) ) { |
|
379 | - $meta['copyright'] = trim( $exif['Copyright'] ); |
|
378 | + if (empty($meta['copyright']) && ! empty($exif['Copyright'])) { |
|
379 | + $meta['copyright'] = trim($exif['Copyright']); |
|
380 | 380 | } |
381 | - if ( ! empty( $exif['FNumber'] ) ) { |
|
382 | - $meta['aperture'] = round( wp_exif_frac2dec( $exif['FNumber'] ), 2 ); |
|
381 | + if ( ! empty($exif['FNumber'])) { |
|
382 | + $meta['aperture'] = round(wp_exif_frac2dec($exif['FNumber']), 2); |
|
383 | 383 | } |
384 | - if ( ! empty( $exif['Model'] ) ) { |
|
385 | - $meta['camera'] = trim( $exif['Model'] ); |
|
384 | + if ( ! empty($exif['Model'])) { |
|
385 | + $meta['camera'] = trim($exif['Model']); |
|
386 | 386 | } |
387 | - if ( empty( $meta['created_timestamp'] ) && ! empty( $exif['DateTimeDigitized'] ) ) { |
|
388 | - $meta['created_timestamp'] = wp_exif_date2ts( $exif['DateTimeDigitized'] ); |
|
387 | + if (empty($meta['created_timestamp']) && ! empty($exif['DateTimeDigitized'])) { |
|
388 | + $meta['created_timestamp'] = wp_exif_date2ts($exif['DateTimeDigitized']); |
|
389 | 389 | } |
390 | - if ( ! empty( $exif['FocalLength'] ) ) { |
|
391 | - $meta['focal_length'] = (string) wp_exif_frac2dec( $exif['FocalLength'] ); |
|
390 | + if ( ! empty($exif['FocalLength'])) { |
|
391 | + $meta['focal_length'] = (string) wp_exif_frac2dec($exif['FocalLength']); |
|
392 | 392 | } |
393 | - if ( ! empty( $exif['ISOSpeedRatings'] ) ) { |
|
394 | - $meta['iso'] = is_array( $exif['ISOSpeedRatings'] ) ? reset( $exif['ISOSpeedRatings'] ) : $exif['ISOSpeedRatings']; |
|
395 | - $meta['iso'] = trim( $meta['iso'] ); |
|
393 | + if ( ! empty($exif['ISOSpeedRatings'])) { |
|
394 | + $meta['iso'] = is_array($exif['ISOSpeedRatings']) ? reset($exif['ISOSpeedRatings']) : $exif['ISOSpeedRatings']; |
|
395 | + $meta['iso'] = trim($meta['iso']); |
|
396 | 396 | } |
397 | - if ( ! empty( $exif['ExposureTime'] ) ) { |
|
398 | - $meta['shutter_speed'] = (string) wp_exif_frac2dec( $exif['ExposureTime'] ); |
|
397 | + if ( ! empty($exif['ExposureTime'])) { |
|
398 | + $meta['shutter_speed'] = (string) wp_exif_frac2dec($exif['ExposureTime']); |
|
399 | 399 | } |
400 | - if ( ! empty( $exif['Orientation'] ) ) { |
|
400 | + if ( ! empty($exif['Orientation'])) { |
|
401 | 401 | $meta['orientation'] = $exif['Orientation']; |
402 | 402 | } |
403 | 403 | } |
404 | 404 | |
405 | - foreach ( array( 'title', 'caption', 'credit', 'copyright', 'camera', 'iso' ) as $key ) { |
|
406 | - if ( $meta[ $key ] && ! seems_utf8( $meta[ $key ] ) ) { |
|
407 | - $meta[ $key ] = utf8_encode( $meta[ $key ] ); |
|
405 | + foreach (array('title', 'caption', 'credit', 'copyright', 'camera', 'iso') as $key) { |
|
406 | + if ($meta[$key] && ! seems_utf8($meta[$key])) { |
|
407 | + $meta[$key] = utf8_encode($meta[$key]); |
|
408 | 408 | } |
409 | 409 | } |
410 | 410 | |
411 | - foreach ( $meta['keywords'] as $key => $keyword ) { |
|
412 | - if ( ! seems_utf8( $keyword ) ) { |
|
413 | - $meta['keywords'][ $key ] = utf8_encode( $keyword ); |
|
411 | + foreach ($meta['keywords'] as $key => $keyword) { |
|
412 | + if ( ! seems_utf8($keyword)) { |
|
413 | + $meta['keywords'][$key] = utf8_encode($keyword); |
|
414 | 414 | } |
415 | 415 | } |
416 | 416 | |
417 | - $meta = wp_kses_post_deep( $meta ); |
|
417 | + $meta = wp_kses_post_deep($meta); |
|
418 | 418 | |
419 | 419 | /** |
420 | 420 | * Filter the array of meta data read from an image's exif data. |
@@ -427,7 +427,7 @@ discard block |
||
427 | 427 | * @param int $sourceImageType Type of image. |
428 | 428 | * @param array $iptc IPTC data. |
429 | 429 | */ |
430 | - return apply_filters( 'wp_read_image_metadata', $meta, $file, $sourceImageType, $iptc ); |
|
430 | + return apply_filters('wp_read_image_metadata', $meta, $file, $sourceImageType, $iptc); |
|
431 | 431 | |
432 | 432 | } |
433 | 433 | |
@@ -441,7 +441,7 @@ discard block |
||
441 | 441 | */ |
442 | 442 | function file_is_valid_image($path) { |
443 | 443 | $size = @getimagesize($path); |
444 | - return !empty($size); |
|
444 | + return ! empty($size); |
|
445 | 445 | } |
446 | 446 | |
447 | 447 | /** |
@@ -453,12 +453,12 @@ discard block |
||
453 | 453 | * @return bool True if suitable, false if not suitable. |
454 | 454 | */ |
455 | 455 | function file_is_displayable_image($path) { |
456 | - $displayable_image_types = array( IMAGETYPE_GIF, IMAGETYPE_JPEG, IMAGETYPE_PNG, IMAGETYPE_BMP ); |
|
456 | + $displayable_image_types = array(IMAGETYPE_GIF, IMAGETYPE_JPEG, IMAGETYPE_PNG, IMAGETYPE_BMP); |
|
457 | 457 | |
458 | - $info = @getimagesize( $path ); |
|
459 | - if ( empty( $info ) ) { |
|
458 | + $info = @getimagesize($path); |
|
459 | + if (empty($info)) { |
|
460 | 460 | $result = false; |
461 | - } elseif ( ! in_array( $info[2], $displayable_image_types ) ) { |
|
461 | + } elseif ( ! in_array($info[2], $displayable_image_types)) { |
|
462 | 462 | $result = false; |
463 | 463 | } else { |
464 | 464 | $result = true; |
@@ -472,7 +472,7 @@ discard block |
||
472 | 472 | * @param bool $result Whether the image can be displayed. Default true. |
473 | 473 | * @param string $path Path to the image. |
474 | 474 | */ |
475 | - return apply_filters( 'file_is_displayable_image', $result, $path ); |
|
475 | + return apply_filters('file_is_displayable_image', $result, $path); |
|
476 | 476 | } |
477 | 477 | |
478 | 478 | /** |
@@ -485,12 +485,12 @@ discard block |
||
485 | 485 | * @param string $size Optional. Image size, defaults to 'full'. |
486 | 486 | * @return resource|false The resulting image resource on success, false on failure. |
487 | 487 | */ |
488 | -function load_image_to_edit( $attachment_id, $mime_type, $size = 'full' ) { |
|
489 | - $filepath = _load_image_to_edit_path( $attachment_id, $size ); |
|
490 | - if ( empty( $filepath ) ) |
|
488 | +function load_image_to_edit($attachment_id, $mime_type, $size = 'full') { |
|
489 | + $filepath = _load_image_to_edit_path($attachment_id, $size); |
|
490 | + if (empty($filepath)) |
|
491 | 491 | return false; |
492 | 492 | |
493 | - switch ( $mime_type ) { |
|
493 | + switch ($mime_type) { |
|
494 | 494 | case 'image/jpeg': |
495 | 495 | $image = imagecreatefromjpeg($filepath); |
496 | 496 | break; |
@@ -504,7 +504,7 @@ discard block |
||
504 | 504 | $image = false; |
505 | 505 | break; |
506 | 506 | } |
507 | - if ( is_resource($image) ) { |
|
507 | + if (is_resource($image)) { |
|
508 | 508 | /** |
509 | 509 | * Filter the current image being loaded for editing. |
510 | 510 | * |
@@ -514,8 +514,8 @@ discard block |
||
514 | 514 | * @param string $attachment_id Attachment ID. |
515 | 515 | * @param string $size Image size. |
516 | 516 | */ |
517 | - $image = apply_filters( 'load_image_to_edit', $image, $attachment_id, $size ); |
|
518 | - if ( function_exists('imagealphablending') && function_exists('imagesavealpha') ) { |
|
517 | + $image = apply_filters('load_image_to_edit', $image, $attachment_id, $size); |
|
518 | + if (function_exists('imagealphablending') && function_exists('imagesavealpha')) { |
|
519 | 519 | imagealphablending($image, false); |
520 | 520 | imagesavealpha($image, true); |
521 | 521 | } |
@@ -536,11 +536,11 @@ discard block |
||
536 | 536 | * @param string $size Optional. Image size, defaults to 'full'. |
537 | 537 | * @return string|false File path or url on success, false on failure. |
538 | 538 | */ |
539 | -function _load_image_to_edit_path( $attachment_id, $size = 'full' ) { |
|
540 | - $filepath = get_attached_file( $attachment_id ); |
|
539 | +function _load_image_to_edit_path($attachment_id, $size = 'full') { |
|
540 | + $filepath = get_attached_file($attachment_id); |
|
541 | 541 | |
542 | - if ( $filepath && file_exists( $filepath ) ) { |
|
543 | - if ( 'full' != $size && ( $data = image_get_intermediate_size( $attachment_id, $size ) ) ) { |
|
542 | + if ($filepath && file_exists($filepath)) { |
|
543 | + if ('full' != $size && ($data = image_get_intermediate_size($attachment_id, $size))) { |
|
544 | 544 | /** |
545 | 545 | * Filter the path to the current image. |
546 | 546 | * |
@@ -552,9 +552,9 @@ discard block |
||
552 | 552 | * @param string $attachment_id Attachment ID. |
553 | 553 | * @param string $size Size of the image. |
554 | 554 | */ |
555 | - $filepath = apply_filters( 'load_image_to_edit_filesystempath', path_join( dirname( $filepath ), $data['file'] ), $attachment_id, $size ); |
|
555 | + $filepath = apply_filters('load_image_to_edit_filesystempath', path_join(dirname($filepath), $data['file']), $attachment_id, $size); |
|
556 | 556 | } |
557 | - } elseif ( function_exists( 'fopen' ) && function_exists( 'ini_get' ) && true == ini_get( 'allow_url_fopen' ) ) { |
|
557 | + } elseif (function_exists('fopen') && function_exists('ini_get') && true == ini_get('allow_url_fopen')) { |
|
558 | 558 | /** |
559 | 559 | * Filter the image URL if not in the local filesystem. |
560 | 560 | * |
@@ -566,7 +566,7 @@ discard block |
||
566 | 566 | * @param string $attachment_id Attachment ID. |
567 | 567 | * @param string $size Size of the image. |
568 | 568 | */ |
569 | - $filepath = apply_filters( 'load_image_to_edit_attachmenturl', wp_get_attachment_url( $attachment_id ), $attachment_id, $size ); |
|
569 | + $filepath = apply_filters('load_image_to_edit_attachmenturl', wp_get_attachment_url($attachment_id), $attachment_id, $size); |
|
570 | 570 | } |
571 | 571 | |
572 | 572 | /** |
@@ -578,7 +578,7 @@ discard block |
||
578 | 578 | * @param string $attachment_id Attachment ID. |
579 | 579 | * @param string $size Size of the image. |
580 | 580 | */ |
581 | - return apply_filters( 'load_image_to_edit_path', $filepath, $attachment_id, $size ); |
|
581 | + return apply_filters('load_image_to_edit_path', $filepath, $attachment_id, $size); |
|
582 | 582 | } |
583 | 583 | |
584 | 584 | /** |
@@ -590,22 +590,22 @@ discard block |
||
590 | 590 | * @param string $attachment_id Attachment ID. |
591 | 591 | * @return string|false New file path on success, false on failure. |
592 | 592 | */ |
593 | -function _copy_image_file( $attachment_id ) { |
|
594 | - $dst_file = $src_file = get_attached_file( $attachment_id ); |
|
595 | - if ( ! file_exists( $src_file ) ) |
|
596 | - $src_file = _load_image_to_edit_path( $attachment_id ); |
|
593 | +function _copy_image_file($attachment_id) { |
|
594 | + $dst_file = $src_file = get_attached_file($attachment_id); |
|
595 | + if ( ! file_exists($src_file)) |
|
596 | + $src_file = _load_image_to_edit_path($attachment_id); |
|
597 | 597 | |
598 | - if ( $src_file ) { |
|
599 | - $dst_file = str_replace( basename( $dst_file ), 'copy-' . basename( $dst_file ), $dst_file ); |
|
600 | - $dst_file = dirname( $dst_file ) . '/' . wp_unique_filename( dirname( $dst_file ), basename( $dst_file ) ); |
|
598 | + if ($src_file) { |
|
599 | + $dst_file = str_replace(basename($dst_file), 'copy-'.basename($dst_file), $dst_file); |
|
600 | + $dst_file = dirname($dst_file).'/'.wp_unique_filename(dirname($dst_file), basename($dst_file)); |
|
601 | 601 | |
602 | 602 | /* |
603 | 603 | * The directory containing the original file may no longer |
604 | 604 | * exist when using a replication plugin. |
605 | 605 | */ |
606 | - wp_mkdir_p( dirname( $dst_file ) ); |
|
606 | + wp_mkdir_p(dirname($dst_file)); |
|
607 | 607 | |
608 | - if ( ! @copy( $src_file, $dst_file ) ) |
|
608 | + if ( ! @copy($src_file, $dst_file)) |
|
609 | 609 | $dst_file = false; |
610 | 610 | } else { |
611 | 611 | $dst_file = false; |
@@ -1,11 +1,11 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * Helper functions for displaying a list of items in an ajaxified HTML table. |
|
4 | - * |
|
5 | - * @package WordPress |
|
6 | - * @subpackage List_Table |
|
7 | - * @since 3.1.0 |
|
8 | - */ |
|
3 | + * Helper functions for displaying a list of items in an ajaxified HTML table. |
|
4 | + * |
|
5 | + * @package WordPress |
|
6 | + * @subpackage List_Table |
|
7 | + * @since 3.1.0 |
|
8 | + */ |
|
9 | 9 | |
10 | 10 | /** |
11 | 11 | * Fetch an instance of a WP_List_Table class. |
@@ -40,15 +40,17 @@ discard block |
||
40 | 40 | ); |
41 | 41 | |
42 | 42 | if ( isset( $core_classes[ $class ] ) ) { |
43 | - foreach ( (array) $core_classes[ $class ] as $required ) |
|
44 | - require_once( ABSPATH . 'wp-admin/includes/class-wp-' . $required . '-list-table.php' ); |
|
43 | + foreach ( (array) $core_classes[ $class ] as $required ) { |
|
44 | + require_once( ABSPATH . 'wp-admin/includes/class-wp-' . $required . '-list-table.php' ); |
|
45 | + } |
|
45 | 46 | |
46 | - if ( isset( $args['screen'] ) ) |
|
47 | - $args['screen'] = convert_to_screen( $args['screen'] ); |
|
48 | - elseif ( isset( $GLOBALS['hook_suffix'] ) ) |
|
49 | - $args['screen'] = get_current_screen(); |
|
50 | - else |
|
51 | - $args['screen'] = null; |
|
47 | + if ( isset( $args['screen'] ) ) { |
|
48 | + $args['screen'] = convert_to_screen( $args['screen'] ); |
|
49 | + } elseif ( isset( $GLOBALS['hook_suffix'] ) ) { |
|
50 | + $args['screen'] = get_current_screen(); |
|
51 | + } else { |
|
52 | + $args['screen'] = null; |
|
53 | + } |
|
52 | 54 | |
53 | 55 | return new $class( $args ); |
54 | 56 | } |
@@ -90,8 +92,9 @@ discard block |
||
90 | 92 | public $_columns; |
91 | 93 | |
92 | 94 | public function __construct( $screen, $columns = array() ) { |
93 | - if ( is_string( $screen ) ) |
|
94 | - $screen = convert_to_screen( $screen ); |
|
95 | + if ( is_string( $screen ) ) { |
|
96 | + $screen = convert_to_screen( $screen ); |
|
97 | + } |
|
95 | 98 | |
96 | 99 | $this->_screen = $screen; |
97 | 100 |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | * @param array $args Optional. Arguments to pass to the class. Accepts 'screen'. |
20 | 20 | * @return object|bool Object on success, false if the class does not exist. |
21 | 21 | */ |
22 | -function _get_list_table( $class, $args = array() ) { |
|
22 | +function _get_list_table($class, $args = array()) { |
|
23 | 23 | $core_classes = array( |
24 | 24 | //Site Admin |
25 | 25 | 'WP_Posts_List_Table' => 'posts', |
@@ -27,11 +27,11 @@ discard block |
||
27 | 27 | 'WP_Terms_List_Table' => 'terms', |
28 | 28 | 'WP_Users_List_Table' => 'users', |
29 | 29 | 'WP_Comments_List_Table' => 'comments', |
30 | - 'WP_Post_Comments_List_Table' => array( 'comments', 'post-comments' ), |
|
30 | + 'WP_Post_Comments_List_Table' => array('comments', 'post-comments'), |
|
31 | 31 | 'WP_Links_List_Table' => 'links', |
32 | 32 | 'WP_Plugin_Install_List_Table' => 'plugin-install', |
33 | 33 | 'WP_Themes_List_Table' => 'themes', |
34 | - 'WP_Theme_Install_List_Table' => array( 'themes', 'theme-install' ), |
|
34 | + 'WP_Theme_Install_List_Table' => array('themes', 'theme-install'), |
|
35 | 35 | 'WP_Plugins_List_Table' => 'plugins', |
36 | 36 | // Network Admin |
37 | 37 | 'WP_MS_Sites_List_Table' => 'ms-sites', |
@@ -39,18 +39,18 @@ discard block |
||
39 | 39 | 'WP_MS_Themes_List_Table' => 'ms-themes', |
40 | 40 | ); |
41 | 41 | |
42 | - if ( isset( $core_classes[ $class ] ) ) { |
|
43 | - foreach ( (array) $core_classes[ $class ] as $required ) |
|
44 | - require_once( ABSPATH . 'wp-admin/includes/class-wp-' . $required . '-list-table.php' ); |
|
42 | + if (isset($core_classes[$class])) { |
|
43 | + foreach ((array) $core_classes[$class] as $required) |
|
44 | + require_once(ABSPATH.'wp-admin/includes/class-wp-'.$required.'-list-table.php'); |
|
45 | 45 | |
46 | - if ( isset( $args['screen'] ) ) |
|
47 | - $args['screen'] = convert_to_screen( $args['screen'] ); |
|
48 | - elseif ( isset( $GLOBALS['hook_suffix'] ) ) |
|
46 | + if (isset($args['screen'])) |
|
47 | + $args['screen'] = convert_to_screen($args['screen']); |
|
48 | + elseif (isset($GLOBALS['hook_suffix'])) |
|
49 | 49 | $args['screen'] = get_current_screen(); |
50 | 50 | else |
51 | 51 | $args['screen'] = null; |
52 | 52 | |
53 | - return new $class( $args ); |
|
53 | + return new $class($args); |
|
54 | 54 | } |
55 | 55 | |
56 | 56 | return false; |
@@ -77,10 +77,10 @@ discard block |
||
77 | 77 | * @param string|WP_Screen $screen The screen hook name or screen object. |
78 | 78 | * @param bool $with_id Whether to set the id attribute or not. |
79 | 79 | */ |
80 | -function print_column_headers( $screen, $with_id = true ) { |
|
80 | +function print_column_headers($screen, $with_id = true) { |
|
81 | 81 | $wp_list_table = new _WP_List_Table_Compat($screen); |
82 | 82 | |
83 | - $wp_list_table->print_column_headers( $with_id ); |
|
83 | + $wp_list_table->print_column_headers($with_id); |
|
84 | 84 | } |
85 | 85 | |
86 | 86 | /** |
@@ -92,15 +92,15 @@ discard block |
||
92 | 92 | public $_screen; |
93 | 93 | public $_columns; |
94 | 94 | |
95 | - public function __construct( $screen, $columns = array() ) { |
|
96 | - if ( is_string( $screen ) ) |
|
97 | - $screen = convert_to_screen( $screen ); |
|
95 | + public function __construct($screen, $columns = array()) { |
|
96 | + if (is_string($screen)) |
|
97 | + $screen = convert_to_screen($screen); |
|
98 | 98 | |
99 | 99 | $this->_screen = $screen; |
100 | 100 | |
101 | - if ( !empty( $columns ) ) { |
|
101 | + if ( ! empty($columns)) { |
|
102 | 102 | $this->_columns = $columns; |
103 | - add_filter( 'manage_' . $screen->id . '_columns', array( $this, 'get_columns' ), 0 ); |
|
103 | + add_filter('manage_'.$screen->id.'_columns', array($this, 'get_columns'), 0); |
|
104 | 104 | } |
105 | 105 | } |
106 | 106 | |
@@ -110,12 +110,12 @@ discard block |
||
110 | 110 | * @return array |
111 | 111 | */ |
112 | 112 | protected function get_column_info() { |
113 | - $columns = get_column_headers( $this->_screen ); |
|
114 | - $hidden = get_hidden_columns( $this->_screen ); |
|
113 | + $columns = get_column_headers($this->_screen); |
|
114 | + $hidden = get_hidden_columns($this->_screen); |
|
115 | 115 | $sortable = array(); |
116 | 116 | $primary = $this->get_default_primary_column_name(); |
117 | 117 | |
118 | - return array( $columns, $hidden, $sortable, $primary ); |
|
118 | + return array($columns, $hidden, $sortable, $primary); |
|
119 | 119 | } |
120 | 120 | |
121 | 121 | /** |
@@ -19,26 +19,31 @@ discard block |
||
19 | 19 | * Or, false on failure. |
20 | 20 | */ |
21 | 21 | function wp_get_revision_ui_diff( $post, $compare_from, $compare_to ) { |
22 | - if ( ! $post = get_post( $post ) ) |
|
23 | - return false; |
|
22 | + if ( ! $post = get_post( $post ) ) { |
|
23 | + return false; |
|
24 | + } |
|
24 | 25 | |
25 | 26 | if ( $compare_from ) { |
26 | - if ( ! $compare_from = get_post( $compare_from ) ) |
|
27 | - return false; |
|
27 | + if ( ! $compare_from = get_post( $compare_from ) ) { |
|
28 | + return false; |
|
29 | + } |
|
28 | 30 | } else { |
29 | 31 | // If we're dealing with the first revision... |
30 | 32 | $compare_from = false; |
31 | 33 | } |
32 | 34 | |
33 | - if ( ! $compare_to = get_post( $compare_to ) ) |
|
34 | - return false; |
|
35 | + if ( ! $compare_to = get_post( $compare_to ) ) { |
|
36 | + return false; |
|
37 | + } |
|
35 | 38 | |
36 | 39 | // If comparing revisions, make sure we're dealing with the right post parent. |
37 | 40 | // The parent post may be a 'revision' when revisions are disabled and we're looking at autosaves. |
38 | - if ( $compare_from && $compare_from->post_parent !== $post->ID && $compare_from->ID !== $post->ID ) |
|
39 | - return false; |
|
40 | - if ( $compare_to->post_parent !== $post->ID && $compare_to->ID !== $post->ID ) |
|
41 | - return false; |
|
41 | + if ( $compare_from && $compare_from->post_parent !== $post->ID && $compare_from->ID !== $post->ID ) { |
|
42 | + return false; |
|
43 | + } |
|
44 | + if ( $compare_to->post_parent !== $post->ID && $compare_to->ID !== $post->ID ) { |
|
45 | + return false; |
|
46 | + } |
|
42 | 47 | |
43 | 48 | if ( $compare_from && strtotime( $compare_from->post_date_gmt ) > strtotime( $compare_to->post_date_gmt ) ) { |
44 | 49 | $temp = $compare_from; |
@@ -47,10 +52,12 @@ discard block |
||
47 | 52 | } |
48 | 53 | |
49 | 54 | // Add default title if title field is empty |
50 | - if ( $compare_from && empty( $compare_from->post_title ) ) |
|
51 | - $compare_from->post_title = __( '(no title)' ); |
|
52 | - if ( empty( $compare_to->post_title ) ) |
|
53 | - $compare_to->post_title = __( '(no title)' ); |
|
55 | + if ( $compare_from && empty( $compare_from->post_title ) ) { |
|
56 | + $compare_from->post_title = __( '(no title)' ); |
|
57 | + } |
|
58 | + if ( empty( $compare_to->post_title ) ) { |
|
59 | + $compare_to->post_title = __( '(no title)' ); |
|
60 | + } |
|
54 | 61 | |
55 | 62 | $return = array(); |
56 | 63 | |
@@ -150,8 +157,9 @@ discard block |
||
150 | 157 | // If revisions are disabled, we only want autosaves and the current post. |
151 | 158 | if ( ! wp_revisions_enabled( $post ) ) { |
152 | 159 | foreach ( $revisions as $revision_id => $revision ) { |
153 | - if ( ! wp_is_post_autosave( $revision ) ) |
|
154 | - unset( $revisions[ $revision_id ] ); |
|
160 | + if ( ! wp_is_post_autosave( $revision ) ) { |
|
161 | + unset( $revisions[ $revision_id ] ); |
|
162 | + } |
|
155 | 163 | } |
156 | 164 | $revisions = array( $post->ID => $post ) + $revisions; |
157 | 165 | } |
@@ -1,11 +1,11 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * WordPress Administration Revisions API |
|
4 | - * |
|
5 | - * @package WordPress |
|
6 | - * @subpackage Administration |
|
7 | - * @since 3.6.0 |
|
8 | - */ |
|
3 | + * WordPress Administration Revisions API |
|
4 | + * |
|
5 | + * @package WordPress |
|
6 | + * @subpackage Administration |
|
7 | + * @since 3.6.0 |
|
8 | + */ |
|
9 | 9 | |
10 | 10 | /** |
11 | 11 | * Get the revision UI diff. |
@@ -19,43 +19,43 @@ discard block |
||
19 | 19 | * @return array|bool Associative array of a post's revisioned fields and their diffs. |
20 | 20 | * Or, false on failure. |
21 | 21 | */ |
22 | -function wp_get_revision_ui_diff( $post, $compare_from, $compare_to ) { |
|
23 | - if ( ! $post = get_post( $post ) ) |
|
22 | +function wp_get_revision_ui_diff($post, $compare_from, $compare_to) { |
|
23 | + if ( ! $post = get_post($post)) |
|
24 | 24 | return false; |
25 | 25 | |
26 | - if ( $compare_from ) { |
|
27 | - if ( ! $compare_from = get_post( $compare_from ) ) |
|
26 | + if ($compare_from) { |
|
27 | + if ( ! $compare_from = get_post($compare_from)) |
|
28 | 28 | return false; |
29 | 29 | } else { |
30 | 30 | // If we're dealing with the first revision... |
31 | 31 | $compare_from = false; |
32 | 32 | } |
33 | 33 | |
34 | - if ( ! $compare_to = get_post( $compare_to ) ) |
|
34 | + if ( ! $compare_to = get_post($compare_to)) |
|
35 | 35 | return false; |
36 | 36 | |
37 | 37 | // If comparing revisions, make sure we're dealing with the right post parent. |
38 | 38 | // The parent post may be a 'revision' when revisions are disabled and we're looking at autosaves. |
39 | - if ( $compare_from && $compare_from->post_parent !== $post->ID && $compare_from->ID !== $post->ID ) |
|
39 | + if ($compare_from && $compare_from->post_parent !== $post->ID && $compare_from->ID !== $post->ID) |
|
40 | 40 | return false; |
41 | - if ( $compare_to->post_parent !== $post->ID && $compare_to->ID !== $post->ID ) |
|
41 | + if ($compare_to->post_parent !== $post->ID && $compare_to->ID !== $post->ID) |
|
42 | 42 | return false; |
43 | 43 | |
44 | - if ( $compare_from && strtotime( $compare_from->post_date_gmt ) > strtotime( $compare_to->post_date_gmt ) ) { |
|
44 | + if ($compare_from && strtotime($compare_from->post_date_gmt) > strtotime($compare_to->post_date_gmt)) { |
|
45 | 45 | $temp = $compare_from; |
46 | 46 | $compare_from = $compare_to; |
47 | 47 | $compare_to = $temp; |
48 | 48 | } |
49 | 49 | |
50 | 50 | // Add default title if title field is empty |
51 | - if ( $compare_from && empty( $compare_from->post_title ) ) |
|
52 | - $compare_from->post_title = __( '(no title)' ); |
|
53 | - if ( empty( $compare_to->post_title ) ) |
|
54 | - $compare_to->post_title = __( '(no title)' ); |
|
51 | + if ($compare_from && empty($compare_from->post_title)) |
|
52 | + $compare_from->post_title = __('(no title)'); |
|
53 | + if (empty($compare_to->post_title)) |
|
54 | + $compare_to->post_title = __('(no title)'); |
|
55 | 55 | |
56 | 56 | $return = array(); |
57 | 57 | |
58 | - foreach ( _wp_post_revision_fields( $post ) as $field => $name ) { |
|
58 | + foreach (_wp_post_revision_fields($post) as $field => $name) { |
|
59 | 59 | /** |
60 | 60 | * Contextually filter a post revision field. |
61 | 61 | * |
@@ -70,10 +70,10 @@ discard block |
||
70 | 70 | * @param string null The context of whether the current revision is the old |
71 | 71 | * or the new one. Values are 'to' or 'from'. |
72 | 72 | */ |
73 | - $content_from = $compare_from ? apply_filters( "_wp_post_revision_field_$field", $compare_from->$field, $field, $compare_from, 'from' ) : ''; |
|
73 | + $content_from = $compare_from ? apply_filters("_wp_post_revision_field_$field", $compare_from->$field, $field, $compare_from, 'from') : ''; |
|
74 | 74 | |
75 | 75 | /** This filter is documented in wp-admin/includes/revision.php */ |
76 | - $content_to = apply_filters( "_wp_post_revision_field_$field", $compare_to->$field, $field, $compare_to, 'to' ); |
|
76 | + $content_to = apply_filters("_wp_post_revision_field_$field", $compare_to->$field, $field, $compare_to, 'to'); |
|
77 | 77 | |
78 | 78 | $args = array( |
79 | 79 | 'show_split_view' => true |
@@ -96,20 +96,20 @@ discard block |
||
96 | 96 | * @param WP_Post $compare_from The revision post to compare from. |
97 | 97 | * @param WP_Post $compare_to The revision post to compare to. |
98 | 98 | */ |
99 | - $args = apply_filters( 'revision_text_diff_options', $args, $field, $compare_from, $compare_to ); |
|
99 | + $args = apply_filters('revision_text_diff_options', $args, $field, $compare_from, $compare_to); |
|
100 | 100 | |
101 | - $diff = wp_text_diff( $content_from, $content_to, $args ); |
|
101 | + $diff = wp_text_diff($content_from, $content_to, $args); |
|
102 | 102 | |
103 | - if ( ! $diff && 'post_title' === $field ) { |
|
103 | + if ( ! $diff && 'post_title' === $field) { |
|
104 | 104 | // It's a better user experience to still show the Title, even if it didn't change. |
105 | 105 | // No, you didn't see this. |
106 | 106 | $diff = '<table class="diff"><colgroup><col class="content diffsplit left"><col class="content diffsplit middle"><col class="content diffsplit right"></colgroup><tbody><tr>'; |
107 | - $diff .= '<td>' . esc_html( $compare_from->post_title ) . '</td><td></td><td>' . esc_html( $compare_to->post_title ) . '</td>'; |
|
107 | + $diff .= '<td>'.esc_html($compare_from->post_title).'</td><td></td><td>'.esc_html($compare_to->post_title).'</td>'; |
|
108 | 108 | $diff .= '</tr></tbody>'; |
109 | 109 | $diff .= '</table>'; |
110 | 110 | } |
111 | 111 | |
112 | - if ( $diff ) { |
|
112 | + if ($diff) { |
|
113 | 113 | $return[] = array( |
114 | 114 | 'id' => $field, |
115 | 115 | 'name' => $name, |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | * @param WP_Post $compare_from The revision post to compare from. |
128 | 128 | * @param WP_Post $compare_to The revision post to compare to. |
129 | 129 | */ |
130 | - return apply_filters( 'wp_get_revision_ui_diff', $return, $compare_from, $compare_to ); |
|
130 | + return apply_filters('wp_get_revision_ui_diff', $return, $compare_from, $compare_to); |
|
131 | 131 | |
132 | 132 | } |
133 | 133 | |
@@ -142,71 +142,71 @@ discard block |
||
142 | 142 | * |
143 | 143 | * @return array An associative array of revision data and related settings. |
144 | 144 | */ |
145 | -function wp_prepare_revisions_for_js( $post, $selected_revision_id, $from = null ) { |
|
146 | - $post = get_post( $post ); |
|
145 | +function wp_prepare_revisions_for_js($post, $selected_revision_id, $from = null) { |
|
146 | + $post = get_post($post); |
|
147 | 147 | $authors = array(); |
148 | 148 | $now_gmt = time(); |
149 | 149 | |
150 | - $revisions = wp_get_post_revisions( $post->ID, array( 'order' => 'ASC', 'check_enabled' => false ) ); |
|
150 | + $revisions = wp_get_post_revisions($post->ID, array('order' => 'ASC', 'check_enabled' => false)); |
|
151 | 151 | // If revisions are disabled, we only want autosaves and the current post. |
152 | - if ( ! wp_revisions_enabled( $post ) ) { |
|
153 | - foreach ( $revisions as $revision_id => $revision ) { |
|
154 | - if ( ! wp_is_post_autosave( $revision ) ) |
|
155 | - unset( $revisions[ $revision_id ] ); |
|
152 | + if ( ! wp_revisions_enabled($post)) { |
|
153 | + foreach ($revisions as $revision_id => $revision) { |
|
154 | + if ( ! wp_is_post_autosave($revision)) |
|
155 | + unset($revisions[$revision_id]); |
|
156 | 156 | } |
157 | - $revisions = array( $post->ID => $post ) + $revisions; |
|
157 | + $revisions = array($post->ID => $post) + $revisions; |
|
158 | 158 | } |
159 | 159 | |
160 | - $show_avatars = get_option( 'show_avatars' ); |
|
160 | + $show_avatars = get_option('show_avatars'); |
|
161 | 161 | |
162 | - cache_users( wp_list_pluck( $revisions, 'post_author' ) ); |
|
162 | + cache_users(wp_list_pluck($revisions, 'post_author')); |
|
163 | 163 | |
164 | - $can_restore = current_user_can( 'edit_post', $post->ID ); |
|
164 | + $can_restore = current_user_can('edit_post', $post->ID); |
|
165 | 165 | $current_id = false; |
166 | 166 | |
167 | - foreach ( $revisions as $revision ) { |
|
168 | - $modified = strtotime( $revision->post_modified ); |
|
169 | - $modified_gmt = strtotime( $revision->post_modified_gmt ); |
|
170 | - if ( $can_restore ) { |
|
171 | - $restore_link = str_replace( '&', '&', wp_nonce_url( |
|
167 | + foreach ($revisions as $revision) { |
|
168 | + $modified = strtotime($revision->post_modified); |
|
169 | + $modified_gmt = strtotime($revision->post_modified_gmt); |
|
170 | + if ($can_restore) { |
|
171 | + $restore_link = str_replace('&', '&', wp_nonce_url( |
|
172 | 172 | add_query_arg( |
173 | - array( 'revision' => $revision->ID, |
|
174 | - 'action' => 'restore' ), |
|
175 | - admin_url( 'revision.php' ) |
|
173 | + array('revision' => $revision->ID, |
|
174 | + 'action' => 'restore'), |
|
175 | + admin_url('revision.php') |
|
176 | 176 | ), |
177 | 177 | "restore-post_{$revision->ID}" |
178 | - ) ); |
|
178 | + )); |
|
179 | 179 | } |
180 | 180 | |
181 | - if ( ! isset( $authors[ $revision->post_author ] ) ) { |
|
182 | - $authors[ $revision->post_author ] = array( |
|
181 | + if ( ! isset($authors[$revision->post_author])) { |
|
182 | + $authors[$revision->post_author] = array( |
|
183 | 183 | 'id' => (int) $revision->post_author, |
184 | - 'avatar' => $show_avatars ? get_avatar( $revision->post_author, 32 ) : '', |
|
185 | - 'name' => get_the_author_meta( 'display_name', $revision->post_author ), |
|
184 | + 'avatar' => $show_avatars ? get_avatar($revision->post_author, 32) : '', |
|
185 | + 'name' => get_the_author_meta('display_name', $revision->post_author), |
|
186 | 186 | ); |
187 | 187 | } |
188 | 188 | |
189 | - $autosave = (bool) wp_is_post_autosave( $revision ); |
|
189 | + $autosave = (bool) wp_is_post_autosave($revision); |
|
190 | 190 | $current = ! $autosave && $revision->post_modified_gmt === $post->post_modified_gmt; |
191 | - if ( $current && ! empty( $current_id ) ) { |
|
191 | + if ($current && ! empty($current_id)) { |
|
192 | 192 | // If multiple revisions have the same post_modified_gmt, highest ID is current. |
193 | - if ( $current_id < $revision->ID ) { |
|
194 | - $revisions[ $current_id ]['current'] = false; |
|
193 | + if ($current_id < $revision->ID) { |
|
194 | + $revisions[$current_id]['current'] = false; |
|
195 | 195 | $current_id = $revision->ID; |
196 | 196 | } else { |
197 | 197 | $current = false; |
198 | 198 | } |
199 | - } elseif ( $current ) { |
|
199 | + } elseif ($current) { |
|
200 | 200 | $current_id = $revision->ID; |
201 | 201 | } |
202 | 202 | |
203 | 203 | $revisions_data = array( |
204 | 204 | 'id' => $revision->ID, |
205 | - 'title' => get_the_title( $post->ID ), |
|
206 | - 'author' => $authors[ $revision->post_author ], |
|
207 | - 'date' => date_i18n( __( 'M j, Y @ H:i' ), $modified ), |
|
208 | - 'dateShort' => date_i18n( _x( 'j M @ H:i', 'revision date short format' ), $modified ), |
|
209 | - 'timeAgo' => sprintf( __( '%s ago' ), human_time_diff( $modified_gmt, $now_gmt ) ), |
|
205 | + 'title' => get_the_title($post->ID), |
|
206 | + 'author' => $authors[$revision->post_author], |
|
207 | + 'date' => date_i18n(__('M j, Y @ H:i'), $modified), |
|
208 | + 'dateShort' => date_i18n(_x('j M @ H:i', 'revision date short format'), $modified), |
|
209 | + 'timeAgo' => sprintf(__('%s ago'), human_time_diff($modified_gmt, $now_gmt)), |
|
210 | 210 | 'autosave' => $autosave, |
211 | 211 | 'current' => $current, |
212 | 212 | 'restoreUrl' => $can_restore ? $restore_link : false, |
@@ -234,21 +234,21 @@ discard block |
||
234 | 234 | * @param WP_Post $revision The revision's WP_Post object. |
235 | 235 | * @param WP_Post $post The revision's parent WP_Post object. |
236 | 236 | */ |
237 | - $revisions[ $revision->ID ] = apply_filters( 'wp_prepare_revision_for_js', $revisions_data, $revision, $post ); |
|
237 | + $revisions[$revision->ID] = apply_filters('wp_prepare_revision_for_js', $revisions_data, $revision, $post); |
|
238 | 238 | } |
239 | 239 | |
240 | 240 | /** |
241 | 241 | * If we only have one revision, the initial revision is missing; This happens |
242 | 242 | * when we have an autsosave and the user has clicked 'View the Autosave' |
243 | 243 | */ |
244 | - if ( 1 === sizeof( $revisions ) ) { |
|
245 | - $revisions[ $post->ID ] = array( |
|
244 | + if (1 === sizeof($revisions)) { |
|
245 | + $revisions[$post->ID] = array( |
|
246 | 246 | 'id' => $post->ID, |
247 | - 'title' => get_the_title( $post->ID ), |
|
248 | - 'author' => $authors[ $post->post_author ], |
|
249 | - 'date' => date_i18n( __( 'M j, Y @ H:i' ), strtotime( $post->post_modified ) ), |
|
250 | - 'dateShort' => date_i18n( _x( 'j M @ H:i', 'revision date short format' ), strtotime( $post->post_modified ) ), |
|
251 | - 'timeAgo' => sprintf( __( '%s ago' ), human_time_diff( strtotime( $post->post_modified_gmt ), $now_gmt ) ), |
|
247 | + 'title' => get_the_title($post->ID), |
|
248 | + 'author' => $authors[$post->post_author], |
|
249 | + 'date' => date_i18n(__('M j, Y @ H:i'), strtotime($post->post_modified)), |
|
250 | + 'dateShort' => date_i18n(_x('j M @ H:i', 'revision date short format'), strtotime($post->post_modified)), |
|
251 | + 'timeAgo' => sprintf(__('%s ago'), human_time_diff(strtotime($post->post_modified_gmt), $now_gmt)), |
|
252 | 252 | 'autosave' => false, |
253 | 253 | 'current' => true, |
254 | 254 | 'restoreUrl' => false, |
@@ -261,48 +261,48 @@ discard block |
||
261 | 261 | * were changed), we may not have a "current" revision. Mark the latest |
262 | 262 | * revision as "current". |
263 | 263 | */ |
264 | - if ( empty( $current_id ) ) { |
|
265 | - if ( $revisions[ $revision->ID ]['autosave'] ) { |
|
266 | - $revision = end( $revisions ); |
|
267 | - while ( $revision['autosave'] ) { |
|
268 | - $revision = prev( $revisions ); |
|
264 | + if (empty($current_id)) { |
|
265 | + if ($revisions[$revision->ID]['autosave']) { |
|
266 | + $revision = end($revisions); |
|
267 | + while ($revision['autosave']) { |
|
268 | + $revision = prev($revisions); |
|
269 | 269 | } |
270 | 270 | $current_id = $revision['id']; |
271 | 271 | } else { |
272 | 272 | $current_id = $revision->ID; |
273 | 273 | } |
274 | - $revisions[ $current_id ]['current'] = true; |
|
274 | + $revisions[$current_id]['current'] = true; |
|
275 | 275 | } |
276 | 276 | |
277 | 277 | // Now, grab the initial diff. |
278 | - $compare_two_mode = is_numeric( $from ); |
|
279 | - if ( ! $compare_two_mode ) { |
|
280 | - $found = array_search( $selected_revision_id, array_keys( $revisions ) ); |
|
281 | - if ( $found ) { |
|
282 | - $from = array_keys( array_slice( $revisions, $found - 1, 1, true ) ); |
|
283 | - $from = reset( $from ); |
|
278 | + $compare_two_mode = is_numeric($from); |
|
279 | + if ( ! $compare_two_mode) { |
|
280 | + $found = array_search($selected_revision_id, array_keys($revisions)); |
|
281 | + if ($found) { |
|
282 | + $from = array_keys(array_slice($revisions, $found - 1, 1, true)); |
|
283 | + $from = reset($from); |
|
284 | 284 | } else { |
285 | 285 | $from = 0; |
286 | 286 | } |
287 | 287 | } |
288 | 288 | |
289 | - $from = absint( $from ); |
|
289 | + $from = absint($from); |
|
290 | 290 | |
291 | - $diffs = array( array( |
|
292 | - 'id' => $from . ':' . $selected_revision_id, |
|
293 | - 'fields' => wp_get_revision_ui_diff( $post->ID, $from, $selected_revision_id ), |
|
291 | + $diffs = array(array( |
|
292 | + 'id' => $from.':'.$selected_revision_id, |
|
293 | + 'fields' => wp_get_revision_ui_diff($post->ID, $from, $selected_revision_id), |
|
294 | 294 | )); |
295 | 295 | |
296 | 296 | return array( |
297 | 297 | 'postId' => $post->ID, |
298 | - 'nonce' => wp_create_nonce( 'revisions-ajax-nonce' ), |
|
299 | - 'revisionData' => array_values( $revisions ), |
|
298 | + 'nonce' => wp_create_nonce('revisions-ajax-nonce'), |
|
299 | + 'revisionData' => array_values($revisions), |
|
300 | 300 | 'to' => $selected_revision_id, |
301 | 301 | 'from' => $from, |
302 | 302 | 'diffData' => $diffs, |
303 | - 'baseUrl' => parse_url( admin_url( 'revision.php' ), PHP_URL_PATH ), |
|
304 | - 'compareTwoMode' => absint( $compare_two_mode ), // Apparently booleans are not allowed |
|
305 | - 'revisionIds' => array_keys( $revisions ), |
|
303 | + 'baseUrl' => parse_url(admin_url('revision.php'), PHP_URL_PATH), |
|
304 | + 'compareTwoMode' => absint($compare_two_mode), // Apparently booleans are not allowed |
|
305 | + 'revisionIds' => array_keys($revisions), |
|
306 | 306 | ); |
307 | 307 | } |
308 | 308 | |
@@ -322,11 +322,11 @@ discard block |
||
322 | 322 | |
323 | 323 | <script id="tmpl-revisions-buttons" type="text/html"> |
324 | 324 | <div class="revisions-previous"> |
325 | - <input class="button" type="button" value="<?php echo esc_attr_x( 'Previous', 'Button label for a previous revision' ); ?>" /> |
|
325 | + <input class="button" type="button" value="<?php echo esc_attr_x('Previous', 'Button label for a previous revision'); ?>" /> |
|
326 | 326 | </div> |
327 | 327 | |
328 | 328 | <div class="revisions-next"> |
329 | - <input class="button" type="button" value="<?php echo esc_attr_x( 'Next', 'Button label for a next revision' ); ?>" /> |
|
329 | + <input class="button" type="button" value="<?php echo esc_attr_x('Next', 'Button label for a next revision'); ?>" /> |
|
330 | 330 | </div> |
331 | 331 | </script> |
332 | 332 | |
@@ -340,7 +340,7 @@ discard block |
||
340 | 340 | } |
341 | 341 | #> |
342 | 342 | /> |
343 | - <?php esc_attr_e( 'Compare any two revisions' ); ?> |
|
343 | + <?php esc_attr_e('Compare any two revisions'); ?> |
|
344 | 344 | </label> |
345 | 345 | </div> |
346 | 346 | </script> |
@@ -349,28 +349,28 @@ discard block |
||
349 | 349 | <# if ( ! _.isUndefined( data.attributes ) ) { #> |
350 | 350 | <div class="diff-title"> |
351 | 351 | <# if ( 'from' === data.type ) { #> |
352 | - <strong><?php _ex( 'From:', 'Followed by post revision info' ); ?></strong> |
|
352 | + <strong><?php _ex('From:', 'Followed by post revision info'); ?></strong> |
|
353 | 353 | <# } else if ( 'to' === data.type ) { #> |
354 | - <strong><?php _ex( 'To:', 'Followed by post revision info' ); ?></strong> |
|
354 | + <strong><?php _ex('To:', 'Followed by post revision info'); ?></strong> |
|
355 | 355 | <# } #> |
356 | 356 | <div class="author-card<# if ( data.attributes.autosave ) { #> autosave<# } #>"> |
357 | 357 | {{{ data.attributes.author.avatar }}} |
358 | 358 | <div class="author-info"> |
359 | 359 | <# if ( data.attributes.autosave ) { #> |
360 | - <span class="byline"><?php printf( __( 'Autosave by %s' ), |
|
361 | - '<span class="author-name">{{ data.attributes.author.name }}</span>' ); ?></span> |
|
360 | + <span class="byline"><?php printf(__('Autosave by %s'), |
|
361 | + '<span class="author-name">{{ data.attributes.author.name }}</span>'); ?></span> |
|
362 | 362 | <# } else if ( data.attributes.current ) { #> |
363 | - <span class="byline"><?php printf( __( 'Current Revision by %s' ), |
|
364 | - '<span class="author-name">{{ data.attributes.author.name }}</span>' ); ?></span> |
|
363 | + <span class="byline"><?php printf(__('Current Revision by %s'), |
|
364 | + '<span class="author-name">{{ data.attributes.author.name }}</span>'); ?></span> |
|
365 | 365 | <# } else { #> |
366 | - <span class="byline"><?php printf( __( 'Revision by %s' ), |
|
367 | - '<span class="author-name">{{ data.attributes.author.name }}</span>' ); ?></span> |
|
366 | + <span class="byline"><?php printf(__('Revision by %s'), |
|
367 | + '<span class="author-name">{{ data.attributes.author.name }}</span>'); ?></span> |
|
368 | 368 | <# } #> |
369 | 369 | <span class="time-ago">{{ data.attributes.timeAgo }}</span> |
370 | 370 | <span class="date">({{ data.attributes.dateShort }})</span> |
371 | 371 | </div> |
372 | 372 | <# if ( 'to' === data.type && data.attributes.restoreUrl ) { #> |
373 | - <input <?php if ( wp_check_post_lock( $post->ID ) ) { ?> |
|
373 | + <input <?php if (wp_check_post_lock($post->ID)) { ?> |
|
374 | 374 | disabled="disabled" |
375 | 375 | <?php } else { ?> |
376 | 376 | <# if ( data.attributes.current ) { #> |
@@ -378,9 +378,9 @@ discard block |
||
378 | 378 | <# } #> |
379 | 379 | <?php } ?> |
380 | 380 | <# if ( data.attributes.autosave ) { #> |
381 | - type="button" class="restore-revision button button-primary" value="<?php esc_attr_e( 'Restore This Autosave' ); ?>" /> |
|
381 | + type="button" class="restore-revision button button-primary" value="<?php esc_attr_e('Restore This Autosave'); ?>" /> |
|
382 | 382 | <# } else { #> |
383 | - type="button" class="restore-revision button button-primary" value="<?php esc_attr_e( 'Restore This Revision' ); ?>" /> |
|
383 | + type="button" class="restore-revision button button-primary" value="<?php esc_attr_e('Restore This Revision'); ?>" /> |
|
384 | 384 | <# } #> |
385 | 385 | <# } #> |
386 | 386 | </div> |
@@ -392,7 +392,7 @@ discard block |
||
392 | 392 | |
393 | 393 | <script id="tmpl-revisions-diff" type="text/html"> |
394 | 394 | <div class="loading-indicator"><span class="spinner"></span></div> |
395 | - <div class="diff-error"><?php _e( 'Sorry, something went wrong. The requested comparison could not be loaded.' ); ?></div> |
|
395 | + <div class="diff-error"><?php _e('Sorry, something went wrong. The requested comparison could not be loaded.'); ?></div> |
|
396 | 396 | <div class="diff"> |
397 | 397 | <# _.each( data.fields, function( field ) { #> |
398 | 398 | <h3>{{ field.name }}</h3> |
@@ -9,77 +9,77 @@ discard block |
||
9 | 9 | */ |
10 | 10 | |
11 | 11 | // Bookmark hooks. |
12 | -add_action( 'admin_page_access_denied', 'wp_link_manager_disabled_message' ); |
|
12 | +add_action('admin_page_access_denied', 'wp_link_manager_disabled_message'); |
|
13 | 13 | |
14 | 14 | // Dashboard hooks. |
15 | -add_action( 'activity_box_end', 'wp_dashboard_quota' ); |
|
15 | +add_action('activity_box_end', 'wp_dashboard_quota'); |
|
16 | 16 | |
17 | 17 | // Media hooks. |
18 | -add_action( 'attachment_submitbox_misc_actions', 'attachment_submitbox_metadata' ); |
|
18 | +add_action('attachment_submitbox_misc_actions', 'attachment_submitbox_metadata'); |
|
19 | 19 | |
20 | -add_action( 'media_upload_image', 'wp_media_upload_handler' ); |
|
21 | -add_action( 'media_upload_audio', 'wp_media_upload_handler' ); |
|
22 | -add_action( 'media_upload_video', 'wp_media_upload_handler' ); |
|
23 | -add_action( 'media_upload_file', 'wp_media_upload_handler' ); |
|
20 | +add_action('media_upload_image', 'wp_media_upload_handler'); |
|
21 | +add_action('media_upload_audio', 'wp_media_upload_handler'); |
|
22 | +add_action('media_upload_video', 'wp_media_upload_handler'); |
|
23 | +add_action('media_upload_file', 'wp_media_upload_handler'); |
|
24 | 24 | |
25 | -add_action( 'post-plupload-upload-ui', 'media_upload_flash_bypass' ); |
|
25 | +add_action('post-plupload-upload-ui', 'media_upload_flash_bypass'); |
|
26 | 26 | |
27 | -add_action( 'post-html-upload-ui', 'media_upload_html_bypass' ); |
|
27 | +add_action('post-html-upload-ui', 'media_upload_html_bypass'); |
|
28 | 28 | |
29 | -add_filter( 'async_upload_image', 'get_media_item', 10, 2 ); |
|
30 | -add_filter( 'async_upload_audio', 'get_media_item', 10, 2 ); |
|
31 | -add_filter( 'async_upload_video', 'get_media_item', 10, 2 ); |
|
32 | -add_filter( 'async_upload_file', 'get_media_item', 10, 2 ); |
|
29 | +add_filter('async_upload_image', 'get_media_item', 10, 2); |
|
30 | +add_filter('async_upload_audio', 'get_media_item', 10, 2); |
|
31 | +add_filter('async_upload_video', 'get_media_item', 10, 2); |
|
32 | +add_filter('async_upload_file', 'get_media_item', 10, 2); |
|
33 | 33 | |
34 | -add_filter( 'attachment_fields_to_save', 'image_attachment_fields_to_save', 10, 2 ); |
|
34 | +add_filter('attachment_fields_to_save', 'image_attachment_fields_to_save', 10, 2); |
|
35 | 35 | |
36 | -add_filter( 'media_upload_gallery', 'media_upload_gallery' ); |
|
37 | -add_filter( 'media_upload_library', 'media_upload_library' ); |
|
36 | +add_filter('media_upload_gallery', 'media_upload_gallery'); |
|
37 | +add_filter('media_upload_library', 'media_upload_library'); |
|
38 | 38 | |
39 | -add_filter( 'media_upload_tabs', 'update_gallery_tab' ); |
|
39 | +add_filter('media_upload_tabs', 'update_gallery_tab'); |
|
40 | 40 | |
41 | 41 | // Misc hooks. |
42 | -add_action( 'admin_head', 'wp_admin_canonical_url' ); |
|
43 | -add_action( 'admin_head', 'wp_color_scheme_settings' ); |
|
44 | -add_action( 'admin_head', 'wp_site_icon' ); |
|
45 | -add_action( 'admin_head', '_ipad_meta' ); |
|
42 | +add_action('admin_head', 'wp_admin_canonical_url'); |
|
43 | +add_action('admin_head', 'wp_color_scheme_settings'); |
|
44 | +add_action('admin_head', 'wp_site_icon'); |
|
45 | +add_action('admin_head', '_ipad_meta'); |
|
46 | 46 | |
47 | -add_action( 'post_edit_form_tag', 'post_form_autocomplete_off' ); |
|
47 | +add_action('post_edit_form_tag', 'post_form_autocomplete_off'); |
|
48 | 48 | |
49 | -add_action( 'update_option_home', 'update_home_siteurl', 10, 2 ); |
|
50 | -add_action( 'update_option_siteurl', 'update_home_siteurl', 10, 2 ); |
|
51 | -add_action( 'update_option_page_on_front', 'update_home_siteurl', 10, 2 ); |
|
49 | +add_action('update_option_home', 'update_home_siteurl', 10, 2); |
|
50 | +add_action('update_option_siteurl', 'update_home_siteurl', 10, 2); |
|
51 | +add_action('update_option_page_on_front', 'update_home_siteurl', 10, 2); |
|
52 | 52 | |
53 | -add_filter( 'heartbeat_received', 'wp_check_locked_posts', 10, 3 ); |
|
54 | -add_filter( 'heartbeat_received', 'wp_refresh_post_lock', 10, 3 ); |
|
55 | -add_filter( 'wp_refresh_nonces', 'wp_refresh_post_nonces', 10, 3 ); |
|
56 | -add_filter( 'heartbeat_received', 'heartbeat_autosave', 500, 2 ); |
|
53 | +add_filter('heartbeat_received', 'wp_check_locked_posts', 10, 3); |
|
54 | +add_filter('heartbeat_received', 'wp_refresh_post_lock', 10, 3); |
|
55 | +add_filter('wp_refresh_nonces', 'wp_refresh_post_nonces', 10, 3); |
|
56 | +add_filter('heartbeat_received', 'heartbeat_autosave', 500, 2); |
|
57 | 57 | |
58 | -add_filter( 'heartbeat_settings', 'wp_heartbeat_set_suspension' ); |
|
58 | +add_filter('heartbeat_settings', 'wp_heartbeat_set_suspension'); |
|
59 | 59 | |
60 | 60 | // Nav Menu hooks. |
61 | -add_action( 'admin_head-nav-menus.php', '_wp_delete_orphaned_draft_menu_items' ); |
|
61 | +add_action('admin_head-nav-menus.php', '_wp_delete_orphaned_draft_menu_items'); |
|
62 | 62 | |
63 | 63 | // Plugin hooks. |
64 | -add_filter( 'whitelist_options', 'option_update_filter' ); |
|
64 | +add_filter('whitelist_options', 'option_update_filter'); |
|
65 | 65 | |
66 | 66 | // Plugin Install hooks. |
67 | -add_action( 'install_plugins_featured', 'install_dashboard' ); |
|
68 | -add_action( 'install_plugins_upload', 'install_plugins_upload' ); |
|
69 | -add_action( 'install_plugins_search', 'display_plugins_table' ); |
|
70 | -add_action( 'install_plugins_popular', 'display_plugins_table' ); |
|
71 | -add_action( 'install_plugins_recommended', 'display_plugins_table' ); |
|
72 | -add_action( 'install_plugins_new', 'display_plugins_table' ); |
|
73 | -add_action( 'install_plugins_beta', 'display_plugins_table' ); |
|
74 | -add_action( 'install_plugins_favorites', 'display_plugins_table' ); |
|
75 | -add_action( 'install_plugins_pre_plugin-information', 'install_plugin_information' ); |
|
67 | +add_action('install_plugins_featured', 'install_dashboard'); |
|
68 | +add_action('install_plugins_upload', 'install_plugins_upload'); |
|
69 | +add_action('install_plugins_search', 'display_plugins_table'); |
|
70 | +add_action('install_plugins_popular', 'display_plugins_table'); |
|
71 | +add_action('install_plugins_recommended', 'display_plugins_table'); |
|
72 | +add_action('install_plugins_new', 'display_plugins_table'); |
|
73 | +add_action('install_plugins_beta', 'display_plugins_table'); |
|
74 | +add_action('install_plugins_favorites', 'display_plugins_table'); |
|
75 | +add_action('install_plugins_pre_plugin-information', 'install_plugin_information'); |
|
76 | 76 | |
77 | 77 | // Template hooks. |
78 | -add_action( 'admin_enqueue_scripts', array( 'WP_Internal_Pointers', 'enqueue_scripts' ) ); |
|
79 | -add_action( 'user_register', array( 'WP_Internal_Pointers', 'dismiss_pointers_for_new_users' ) ); |
|
78 | +add_action('admin_enqueue_scripts', array('WP_Internal_Pointers', 'enqueue_scripts')); |
|
79 | +add_action('user_register', array('WP_Internal_Pointers', 'dismiss_pointers_for_new_users')); |
|
80 | 80 | |
81 | 81 | // Theme hooks. |
82 | -add_action( 'customize_controls_print_footer_scripts', 'customize_themes_print_templates' ); |
|
82 | +add_action('customize_controls_print_footer_scripts', 'customize_themes_print_templates'); |
|
83 | 83 | |
84 | 84 | // Theme Install hooks. |
85 | 85 | // add_action('install_themes_dashboard', 'install_themes_dashboard'); |
@@ -88,26 +88,26 @@ discard block |
||
88 | 88 | // add_action('install_themes_featured', 'display_themes'); |
89 | 89 | // add_action('install_themes_new', 'display_themes'); |
90 | 90 | // add_action('install_themes_updated', 'display_themes'); |
91 | -add_action( 'install_themes_pre_theme-information', 'install_theme_information' ); |
|
91 | +add_action('install_themes_pre_theme-information', 'install_theme_information'); |
|
92 | 92 | |
93 | 93 | // User hooks. |
94 | -add_action( 'admin_init', 'default_password_nag_handler' ); |
|
94 | +add_action('admin_init', 'default_password_nag_handler'); |
|
95 | 95 | |
96 | -add_action( 'admin_notices', 'default_password_nag' ); |
|
96 | +add_action('admin_notices', 'default_password_nag'); |
|
97 | 97 | |
98 | -add_action( 'profile_update', 'default_password_nag_edit_user', 10, 2 ); |
|
98 | +add_action('profile_update', 'default_password_nag_edit_user', 10, 2); |
|
99 | 99 | |
100 | 100 | // Update hooks. |
101 | -add_action( 'admin_init', 'wp_plugin_update_rows' ); |
|
102 | -add_action( 'admin_init', 'wp_theme_update_rows' ); |
|
101 | +add_action('admin_init', 'wp_plugin_update_rows'); |
|
102 | +add_action('admin_init', 'wp_theme_update_rows'); |
|
103 | 103 | |
104 | -add_action( 'admin_notices', 'update_nag', 3 ); |
|
105 | -add_action( 'admin_notices', 'maintenance_nag', 10 ); |
|
104 | +add_action('admin_notices', 'update_nag', 3); |
|
105 | +add_action('admin_notices', 'maintenance_nag', 10); |
|
106 | 106 | |
107 | -add_filter( 'update_footer', 'core_update_footer' ); |
|
107 | +add_filter('update_footer', 'core_update_footer'); |
|
108 | 108 | |
109 | 109 | // Update Core hooks. |
110 | -add_action( '_core_updated_successfully', '_redirect_to_about_wordpress' ); |
|
110 | +add_action('_core_updated_successfully', '_redirect_to_about_wordpress'); |
|
111 | 111 | |
112 | 112 | // Upgrade hooks. |
113 | -add_action( 'upgrader_process_complete', array( 'Language_Pack_Upgrader', 'async_upgrade' ), 20 ); |
|
113 | +add_action('upgrader_process_complete', array('Language_Pack_Upgrader', 'async_upgrade'), 20); |
@@ -1,11 +1,11 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * Administration API: Default admin hooks |
|
4 | - * |
|
5 | - * @package WordPress |
|
6 | - * @subpackage Administration |
|
7 | - * @since 4.3.0 |
|
8 | - */ |
|
3 | + * Administration API: Default admin hooks |
|
4 | + * |
|
5 | + * @package WordPress |
|
6 | + * @subpackage Administration |
|
7 | + * @since 4.3.0 |
|
8 | + */ |
|
9 | 9 | |
10 | 10 | // Bookmark hooks. |
11 | 11 | add_action( 'admin_page_access_denied', 'wp_link_manager_disabled_message' ); |
@@ -1,10 +1,10 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * WordPress Theme Administration API |
|
4 | - * |
|
5 | - * @package WordPress |
|
6 | - * @subpackage Administration |
|
7 | - */ |
|
3 | + * WordPress Theme Administration API |
|
4 | + * |
|
5 | + * @package WordPress |
|
6 | + * @subpackage Administration |
|
7 | + */ |
|
8 | 8 | |
9 | 9 | /** |
10 | 10 | * Remove a theme |
@@ -20,12 +20,14 @@ discard block |
||
20 | 20 | function delete_theme($stylesheet, $redirect = '') { |
21 | 21 | global $wp_filesystem; |
22 | 22 | |
23 | - if ( empty($stylesheet) ) |
|
24 | - return false; |
|
23 | + if ( empty($stylesheet) ) { |
|
24 | + return false; |
|
25 | + } |
|
25 | 26 | |
26 | 27 | ob_start(); |
27 | - if ( empty( $redirect ) ) |
|
28 | - $redirect = wp_nonce_url('themes.php?action=delete&stylesheet=' . urlencode( $stylesheet ), 'delete-theme_' . $stylesheet); |
|
28 | + if ( empty( $redirect ) ) { |
|
29 | + $redirect = wp_nonce_url('themes.php?action=delete&stylesheet=' . urlencode( $stylesheet ), 'delete-theme_' . $stylesheet); |
|
30 | + } |
|
29 | 31 | if ( false === ($credentials = request_filesystem_credentials($redirect)) ) { |
30 | 32 | $data = ob_get_clean(); |
31 | 33 | |
@@ -51,11 +53,13 @@ discard block |
||
51 | 53 | return; |
52 | 54 | } |
53 | 55 | |
54 | - if ( ! is_object($wp_filesystem) ) |
|
55 | - return new WP_Error('fs_unavailable', __('Could not access filesystem.')); |
|
56 | + if ( ! is_object($wp_filesystem) ) { |
|
57 | + return new WP_Error('fs_unavailable', __('Could not access filesystem.')); |
|
58 | + } |
|
56 | 59 | |
57 | - if ( is_wp_error($wp_filesystem->errors) && $wp_filesystem->errors->get_error_code() ) |
|
58 | - return new WP_Error('fs_error', __('Filesystem error.'), $wp_filesystem->errors); |
|
60 | + if ( is_wp_error($wp_filesystem->errors) && $wp_filesystem->errors->get_error_code() ) { |
|
61 | + return new WP_Error('fs_error', __('Filesystem error.'), $wp_filesystem->errors); |
|
62 | + } |
|
59 | 63 | |
60 | 64 | // Get the base plugin folder. |
61 | 65 | $themes_dir = $wp_filesystem->wp_themes_dir(); |
@@ -144,11 +148,13 @@ discard block |
||
144 | 148 | function get_theme_update_available( $theme ) { |
145 | 149 | static $themes_update = null; |
146 | 150 | |
147 | - if ( !current_user_can('update_themes' ) ) |
|
148 | - return false; |
|
151 | + if ( !current_user_can('update_themes' ) ) { |
|
152 | + return false; |
|
153 | + } |
|
149 | 154 | |
150 | - if ( !isset($themes_update) ) |
|
151 | - $themes_update = get_site_transient('update_themes'); |
|
155 | + if ( !isset($themes_update) ) { |
|
156 | + $themes_update = get_site_transient('update_themes'); |
|
157 | + } |
|
152 | 158 | |
153 | 159 | if ( ! ( $theme instanceof WP_Theme ) ) { |
154 | 160 | return false; |
@@ -253,20 +259,24 @@ discard block |
||
253 | 259 | ) |
254 | 260 | ); |
255 | 261 | |
256 | - if ( ! $api || ! current_user_can( 'install_themes' ) ) |
|
257 | - return $features; |
|
262 | + if ( ! $api || ! current_user_can( 'install_themes' ) ) { |
|
263 | + return $features; |
|
264 | + } |
|
258 | 265 | |
259 | - if ( !$feature_list = get_site_transient( 'wporg_theme_feature_list' ) ) |
|
260 | - set_site_transient( 'wporg_theme_feature_list', array(), 3 * HOUR_IN_SECONDS ); |
|
266 | + if ( !$feature_list = get_site_transient( 'wporg_theme_feature_list' ) ) { |
|
267 | + set_site_transient( 'wporg_theme_feature_list', array(), 3 * HOUR_IN_SECONDS ); |
|
268 | + } |
|
261 | 269 | |
262 | 270 | if ( !$feature_list ) { |
263 | 271 | $feature_list = themes_api( 'feature_list', array() ); |
264 | - if ( is_wp_error( $feature_list ) ) |
|
265 | - return $features; |
|
272 | + if ( is_wp_error( $feature_list ) ) { |
|
273 | + return $features; |
|
274 | + } |
|
266 | 275 | } |
267 | 276 | |
268 | - if ( !$feature_list ) |
|
269 | - return $features; |
|
277 | + if ( !$feature_list ) { |
|
278 | + return $features; |
|
279 | + } |
|
270 | 280 | |
271 | 281 | set_site_transient( 'wporg_theme_feature_list', $feature_list, 3 * HOUR_IN_SECONDS ); |
272 | 282 | |
@@ -280,15 +290,17 @@ discard block |
||
280 | 290 | // Loop over the wporg canonical list and apply translations |
281 | 291 | $wporg_features = array(); |
282 | 292 | foreach ( (array) $feature_list as $feature_category => $feature_items ) { |
283 | - if ( isset($category_translations[$feature_category]) ) |
|
284 | - $feature_category = $category_translations[$feature_category]; |
|
293 | + if ( isset($category_translations[$feature_category]) ) { |
|
294 | + $feature_category = $category_translations[$feature_category]; |
|
295 | + } |
|
285 | 296 | $wporg_features[$feature_category] = array(); |
286 | 297 | |
287 | 298 | foreach ( $feature_items as $feature ) { |
288 | - if ( isset($features[$feature_category][$feature]) ) |
|
289 | - $wporg_features[$feature_category][$feature] = $features[$feature_category][$feature]; |
|
290 | - else |
|
291 | - $wporg_features[$feature_category][$feature] = $feature; |
|
299 | + if ( isset($features[$feature_category][$feature]) ) { |
|
300 | + $wporg_features[$feature_category][$feature] = $features[$feature_category][$feature]; |
|
301 | + } else { |
|
302 | + $wporg_features[$feature_category][$feature] = $feature; |
|
303 | + } |
|
292 | 304 | } |
293 | 305 | } |
294 | 306 | |
@@ -360,8 +372,9 @@ discard block |
||
360 | 372 | |
361 | 373 | if ( ! $res ) { |
362 | 374 | $url = $http_url = 'http://api.wordpress.org/themes/info/1.0/'; |
363 | - if ( $ssl = wp_http_supports( array( 'ssl' ) ) ) |
|
364 | - $url = set_url_scheme( $url, 'https' ); |
|
375 | + if ( $ssl = wp_http_supports( array( 'ssl' ) ) ) { |
|
376 | + $url = set_url_scheme( $url, 'https' ); |
|
377 | + } |
|
365 | 378 | |
366 | 379 | $http_args = array( |
367 | 380 | 'body' => array( |
@@ -382,8 +395,9 @@ discard block |
||
382 | 395 | $res = new WP_Error('themes_api_failed', __( 'An unexpected error occurred. Something may be wrong with WordPress.org or this server’s configuration. If you continue to have problems, please try the <a href="https://wordpress.org/support/">support forums</a>.' ), $request->get_error_message() ); |
383 | 396 | } else { |
384 | 397 | $res = maybe_unserialize( wp_remote_retrieve_body( $request ) ); |
385 | - if ( ! is_object( $res ) && ! is_array( $res ) ) |
|
386 | - $res = new WP_Error('themes_api_failed', __( 'An unexpected error occurred. Something may be wrong with WordPress.org or this server’s configuration. If you continue to have problems, please try the <a href="https://wordpress.org/support/">support forums</a>.' ), wp_remote_retrieve_body( $request ) ); |
|
398 | + if ( ! is_object( $res ) && ! is_array( $res ) ) { |
|
399 | + $res = new WP_Error('themes_api_failed', __( 'An unexpected error occurred. Something may be wrong with WordPress.org or this server’s configuration. If you continue to have problems, please try the <a href="https://wordpress.org/support/">support forums</a>.' ), wp_remote_retrieve_body( $request ) ); |
|
400 | + } |
|
387 | 401 | } |
388 | 402 | } |
389 | 403 |
@@ -20,71 +20,71 @@ discard block |
||
20 | 20 | function delete_theme($stylesheet, $redirect = '') { |
21 | 21 | global $wp_filesystem; |
22 | 22 | |
23 | - if ( empty($stylesheet) ) |
|
23 | + if (empty($stylesheet)) |
|
24 | 24 | return false; |
25 | 25 | |
26 | 26 | ob_start(); |
27 | - if ( empty( $redirect ) ) |
|
28 | - $redirect = wp_nonce_url('themes.php?action=delete&stylesheet=' . urlencode( $stylesheet ), 'delete-theme_' . $stylesheet); |
|
29 | - if ( false === ($credentials = request_filesystem_credentials($redirect)) ) { |
|
27 | + if (empty($redirect)) |
|
28 | + $redirect = wp_nonce_url('themes.php?action=delete&stylesheet='.urlencode($stylesheet), 'delete-theme_'.$stylesheet); |
|
29 | + if (false === ($credentials = request_filesystem_credentials($redirect))) { |
|
30 | 30 | $data = ob_get_clean(); |
31 | 31 | |
32 | - if ( ! empty($data) ){ |
|
33 | - include_once( ABSPATH . 'wp-admin/admin-header.php'); |
|
32 | + if ( ! empty($data)) { |
|
33 | + include_once(ABSPATH.'wp-admin/admin-header.php'); |
|
34 | 34 | echo $data; |
35 | - include( ABSPATH . 'wp-admin/admin-footer.php'); |
|
35 | + include(ABSPATH.'wp-admin/admin-footer.php'); |
|
36 | 36 | exit; |
37 | 37 | } |
38 | 38 | return; |
39 | 39 | } |
40 | 40 | |
41 | - if ( ! WP_Filesystem($credentials) ) { |
|
41 | + if ( ! WP_Filesystem($credentials)) { |
|
42 | 42 | request_filesystem_credentials($redirect, '', true); // Failed to connect, Error and request again |
43 | 43 | $data = ob_get_clean(); |
44 | 44 | |
45 | - if ( ! empty($data) ) { |
|
46 | - include_once( ABSPATH . 'wp-admin/admin-header.php'); |
|
45 | + if ( ! empty($data)) { |
|
46 | + include_once(ABSPATH.'wp-admin/admin-header.php'); |
|
47 | 47 | echo $data; |
48 | - include( ABSPATH . 'wp-admin/admin-footer.php'); |
|
48 | + include(ABSPATH.'wp-admin/admin-footer.php'); |
|
49 | 49 | exit; |
50 | 50 | } |
51 | 51 | return; |
52 | 52 | } |
53 | 53 | |
54 | - if ( ! is_object($wp_filesystem) ) |
|
54 | + if ( ! is_object($wp_filesystem)) |
|
55 | 55 | return new WP_Error('fs_unavailable', __('Could not access filesystem.')); |
56 | 56 | |
57 | - if ( is_wp_error($wp_filesystem->errors) && $wp_filesystem->errors->get_error_code() ) |
|
57 | + if (is_wp_error($wp_filesystem->errors) && $wp_filesystem->errors->get_error_code()) |
|
58 | 58 | return new WP_Error('fs_error', __('Filesystem error.'), $wp_filesystem->errors); |
59 | 59 | |
60 | 60 | // Get the base plugin folder. |
61 | 61 | $themes_dir = $wp_filesystem->wp_themes_dir(); |
62 | - if ( empty( $themes_dir ) ) { |
|
63 | - return new WP_Error( 'fs_no_themes_dir', __( 'Unable to locate WordPress theme directory.' ) ); |
|
62 | + if (empty($themes_dir)) { |
|
63 | + return new WP_Error('fs_no_themes_dir', __('Unable to locate WordPress theme directory.')); |
|
64 | 64 | } |
65 | 65 | |
66 | - $themes_dir = trailingslashit( $themes_dir ); |
|
67 | - $theme_dir = trailingslashit( $themes_dir . $stylesheet ); |
|
68 | - $deleted = $wp_filesystem->delete( $theme_dir, true ); |
|
66 | + $themes_dir = trailingslashit($themes_dir); |
|
67 | + $theme_dir = trailingslashit($themes_dir.$stylesheet); |
|
68 | + $deleted = $wp_filesystem->delete($theme_dir, true); |
|
69 | 69 | |
70 | - if ( ! $deleted ) { |
|
71 | - return new WP_Error( 'could_not_remove_theme', sprintf( __( 'Could not fully remove the theme %s.' ), $stylesheet ) ); |
|
70 | + if ( ! $deleted) { |
|
71 | + return new WP_Error('could_not_remove_theme', sprintf(__('Could not fully remove the theme %s.'), $stylesheet)); |
|
72 | 72 | } |
73 | 73 | |
74 | - $theme_translations = wp_get_installed_translations( 'themes' ); |
|
74 | + $theme_translations = wp_get_installed_translations('themes'); |
|
75 | 75 | |
76 | 76 | // Remove language files, silently. |
77 | - if ( ! empty( $theme_translations[ $stylesheet ] ) ) { |
|
78 | - $translations = $theme_translations[ $stylesheet ]; |
|
77 | + if ( ! empty($theme_translations[$stylesheet])) { |
|
78 | + $translations = $theme_translations[$stylesheet]; |
|
79 | 79 | |
80 | - foreach ( $translations as $translation => $data ) { |
|
81 | - $wp_filesystem->delete( WP_LANG_DIR . '/themes/' . $stylesheet . '-' . $translation . '.po' ); |
|
82 | - $wp_filesystem->delete( WP_LANG_DIR . '/themes/' . $stylesheet . '-' . $translation . '.mo' ); |
|
80 | + foreach ($translations as $translation => $data) { |
|
81 | + $wp_filesystem->delete(WP_LANG_DIR.'/themes/'.$stylesheet.'-'.$translation.'.po'); |
|
82 | + $wp_filesystem->delete(WP_LANG_DIR.'/themes/'.$stylesheet.'-'.$translation.'.mo'); |
|
83 | 83 | } |
84 | 84 | } |
85 | 85 | |
86 | 86 | // Force refresh of theme update information. |
87 | - delete_site_transient( 'update_themes' ); |
|
87 | + delete_site_transient('update_themes'); |
|
88 | 88 | |
89 | 89 | return true; |
90 | 90 | } |
@@ -97,8 +97,8 @@ discard block |
||
97 | 97 | * @param WP_Post|null $post Optional. The post being edited, provided for context. |
98 | 98 | * @return array Key is the template name, value is the filename of the template |
99 | 99 | */ |
100 | -function get_page_templates( $post = null ) { |
|
101 | - return array_flip( wp_get_theme()->get_page_templates( $post ) ); |
|
100 | +function get_page_templates($post = null) { |
|
101 | + return array_flip(wp_get_theme()->get_page_templates($post)); |
|
102 | 102 | } |
103 | 103 | |
104 | 104 | /** |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | * @return string |
113 | 113 | */ |
114 | 114 | function _get_template_edit_filename($fullpath, $containingfolder) { |
115 | - return str_replace(dirname(dirname( $containingfolder )) , '', $fullpath); |
|
115 | + return str_replace(dirname(dirname($containingfolder)), '', $fullpath); |
|
116 | 116 | } |
117 | 117 | |
118 | 118 | /** |
@@ -125,8 +125,8 @@ discard block |
||
125 | 125 | * |
126 | 126 | * @param WP_Theme $theme Theme data object. |
127 | 127 | */ |
128 | -function theme_update_available( $theme ) { |
|
129 | - echo get_theme_update_available( $theme ); |
|
128 | +function theme_update_available($theme) { |
|
129 | + echo get_theme_update_available($theme); |
|
130 | 130 | } |
131 | 131 | |
132 | 132 | /** |
@@ -141,16 +141,16 @@ discard block |
||
141 | 141 | * @param WP_Theme $theme WP_Theme object. |
142 | 142 | * @return false|string HTML for the update link, or false if invalid info was passed. |
143 | 143 | */ |
144 | -function get_theme_update_available( $theme ) { |
|
144 | +function get_theme_update_available($theme) { |
|
145 | 145 | static $themes_update = null; |
146 | 146 | |
147 | - if ( !current_user_can('update_themes' ) ) |
|
147 | + if ( ! current_user_can('update_themes')) |
|
148 | 148 | return false; |
149 | 149 | |
150 | - if ( !isset($themes_update) ) |
|
150 | + if ( ! isset($themes_update)) |
|
151 | 151 | $themes_update = get_site_transient('update_themes'); |
152 | 152 | |
153 | - if ( ! ( $theme instanceof WP_Theme ) ) { |
|
153 | + if ( ! ($theme instanceof WP_Theme)) { |
|
154 | 154 | return false; |
155 | 155 | } |
156 | 156 | |
@@ -158,42 +158,42 @@ discard block |
||
158 | 158 | |
159 | 159 | $html = ''; |
160 | 160 | |
161 | - if ( isset($themes_update->response[ $stylesheet ]) ) { |
|
162 | - $update = $themes_update->response[ $stylesheet ]; |
|
161 | + if (isset($themes_update->response[$stylesheet])) { |
|
162 | + $update = $themes_update->response[$stylesheet]; |
|
163 | 163 | $theme_name = $theme->display('Name'); |
164 | 164 | $details_url = add_query_arg(array('TB_iframe' => 'true', 'width' => 1024, 'height' => 800), $update['url']); //Theme browser inside WP? replace this, Also, theme preview JS will override this on the available list. |
165 | - $update_url = wp_nonce_url( admin_url( 'update.php?action=upgrade-theme&theme=' . urlencode( $stylesheet ) ), 'upgrade-theme_' . $stylesheet ); |
|
165 | + $update_url = wp_nonce_url(admin_url('update.php?action=upgrade-theme&theme='.urlencode($stylesheet)), 'upgrade-theme_'.$stylesheet); |
|
166 | 166 | |
167 | - if ( !is_multisite() ) { |
|
168 | - if ( ! current_user_can('update_themes') ) { |
|
167 | + if ( ! is_multisite()) { |
|
168 | + if ( ! current_user_can('update_themes')) { |
|
169 | 169 | /* translators: 1: theme name, 2: theme details URL, 3: accessibility text, 4: version number */ |
170 | - $html = sprintf( '<p><strong>' . __( 'There is a new version of %1$s available. <a href="%2$s" class="thickbox" aria-label="%3$s">View version %4$s details</a>.' ) . '</strong></p>', |
|
170 | + $html = sprintf('<p><strong>'.__('There is a new version of %1$s available. <a href="%2$s" class="thickbox" aria-label="%3$s">View version %4$s details</a>.').'</strong></p>', |
|
171 | 171 | $theme_name, |
172 | - esc_url( $details_url ), |
|
172 | + esc_url($details_url), |
|
173 | 173 | /* translators: 1: theme name, 2: version number */ |
174 | - esc_attr( sprintf( __( 'View %1$s version %2$s details' ), $theme_name, $update['new_version'] ) ), |
|
174 | + esc_attr(sprintf(__('View %1$s version %2$s details'), $theme_name, $update['new_version'])), |
|
175 | 175 | $update['new_version'] |
176 | 176 | ); |
177 | - } elseif ( empty( $update['package'] ) ) { |
|
177 | + } elseif (empty($update['package'])) { |
|
178 | 178 | /* translators: 1: theme name, 2: theme details URL, 3: accessibility text, 4: version number */ |
179 | - $html = sprintf( '<p><strong>' . __( 'There is a new version of %1$s available. <a href="%2$s" class="thickbox" aria-label="%3$s">View version %4$s details</a>. <em>Automatic update is unavailable for this theme.</em>' ) . '</strong></p>', |
|
179 | + $html = sprintf('<p><strong>'.__('There is a new version of %1$s available. <a href="%2$s" class="thickbox" aria-label="%3$s">View version %4$s details</a>. <em>Automatic update is unavailable for this theme.</em>').'</strong></p>', |
|
180 | 180 | $theme_name, |
181 | - esc_url( $details_url ), |
|
181 | + esc_url($details_url), |
|
182 | 182 | /* translators: 1: theme name, 2: version number */ |
183 | - esc_attr( sprintf( __( 'View %1$s version %2$s details' ), $theme_name, $update['new_version'] ) ), |
|
183 | + esc_attr(sprintf(__('View %1$s version %2$s details'), $theme_name, $update['new_version'])), |
|
184 | 184 | $update['new_version'] |
185 | 185 | ); |
186 | 186 | } else { |
187 | 187 | /* translators: 1: theme name, 2: theme details URL, 3: accessibility text, 4: version number, 5: update URL, 6: accessibility text */ |
188 | - $html = sprintf( '<p><strong>' . __( 'There is a new version of %1$s available. <a href="%2$s" class="thickbox" aria-label="%3$s">View version %4$s details</a> or <a href="%5$s" aria-label="%6$s">update now</a>.' ) . '</strong></p>', |
|
188 | + $html = sprintf('<p><strong>'.__('There is a new version of %1$s available. <a href="%2$s" class="thickbox" aria-label="%3$s">View version %4$s details</a> or <a href="%5$s" aria-label="%6$s">update now</a>.').'</strong></p>', |
|
189 | 189 | $theme_name, |
190 | - esc_url( $details_url ), |
|
190 | + esc_url($details_url), |
|
191 | 191 | /* translators: 1: theme name, 2: version number */ |
192 | - esc_attr( sprintf( __( 'View %1$s version %2$s details' ), $theme_name, $update['new_version'] ) ), |
|
192 | + esc_attr(sprintf(__('View %1$s version %2$s details'), $theme_name, $update['new_version'])), |
|
193 | 193 | $update['new_version'], |
194 | 194 | $update_url, |
195 | 195 | /* translators: %s: theme name */ |
196 | - esc_attr( sprintf( __( 'Update %s now' ), $theme_name ) ) |
|
196 | + esc_attr(sprintf(__('Update %s now'), $theme_name)) |
|
197 | 197 | ); |
198 | 198 | } |
199 | 199 | } |
@@ -210,102 +210,102 @@ discard block |
||
210 | 210 | * @param bool $api Optional. Whether try to fetch tags from the WordPress.org API. Defaults to true. |
211 | 211 | * @return array Array of features keyed by category with translations keyed by slug. |
212 | 212 | */ |
213 | -function get_theme_feature_list( $api = true ) { |
|
213 | +function get_theme_feature_list($api = true) { |
|
214 | 214 | // Hard-coded list is used if api not accessible. |
215 | 215 | $features = array( |
216 | - __( 'Colors' ) => array( |
|
217 | - 'black' => __( 'Black' ), |
|
218 | - 'blue' => __( 'Blue' ), |
|
219 | - 'brown' => __( 'Brown' ), |
|
220 | - 'gray' => __( 'Gray' ), |
|
221 | - 'green' => __( 'Green' ), |
|
222 | - 'orange' => __( 'Orange' ), |
|
223 | - 'pink' => __( 'Pink' ), |
|
224 | - 'purple' => __( 'Purple' ), |
|
225 | - 'red' => __( 'Red' ), |
|
226 | - 'silver' => __( 'Silver' ), |
|
227 | - 'tan' => __( 'Tan' ), |
|
228 | - 'white' => __( 'White' ), |
|
229 | - 'yellow' => __( 'Yellow' ), |
|
230 | - 'dark' => __( 'Dark' ), |
|
231 | - 'light' => __( 'Light' ), |
|
216 | + __('Colors') => array( |
|
217 | + 'black' => __('Black'), |
|
218 | + 'blue' => __('Blue'), |
|
219 | + 'brown' => __('Brown'), |
|
220 | + 'gray' => __('Gray'), |
|
221 | + 'green' => __('Green'), |
|
222 | + 'orange' => __('Orange'), |
|
223 | + 'pink' => __('Pink'), |
|
224 | + 'purple' => __('Purple'), |
|
225 | + 'red' => __('Red'), |
|
226 | + 'silver' => __('Silver'), |
|
227 | + 'tan' => __('Tan'), |
|
228 | + 'white' => __('White'), |
|
229 | + 'yellow' => __('Yellow'), |
|
230 | + 'dark' => __('Dark'), |
|
231 | + 'light' => __('Light'), |
|
232 | 232 | ), |
233 | 233 | |
234 | - __( 'Layout' ) => array( |
|
235 | - 'fixed-layout' => __( 'Fixed Layout' ), |
|
236 | - 'fluid-layout' => __( 'Fluid Layout' ), |
|
237 | - 'responsive-layout' => __( 'Responsive Layout' ), |
|
238 | - 'one-column' => __( 'One Column' ), |
|
239 | - 'two-columns' => __( 'Two Columns' ), |
|
240 | - 'three-columns' => __( 'Three Columns' ), |
|
241 | - 'four-columns' => __( 'Four Columns' ), |
|
242 | - 'left-sidebar' => __( 'Left Sidebar' ), |
|
243 | - 'right-sidebar' => __( 'Right Sidebar' ), |
|
234 | + __('Layout') => array( |
|
235 | + 'fixed-layout' => __('Fixed Layout'), |
|
236 | + 'fluid-layout' => __('Fluid Layout'), |
|
237 | + 'responsive-layout' => __('Responsive Layout'), |
|
238 | + 'one-column' => __('One Column'), |
|
239 | + 'two-columns' => __('Two Columns'), |
|
240 | + 'three-columns' => __('Three Columns'), |
|
241 | + 'four-columns' => __('Four Columns'), |
|
242 | + 'left-sidebar' => __('Left Sidebar'), |
|
243 | + 'right-sidebar' => __('Right Sidebar'), |
|
244 | 244 | ), |
245 | 245 | |
246 | - __( 'Features' ) => array( |
|
247 | - 'accessibility-ready' => __( 'Accessibility Ready' ), |
|
248 | - 'blavatar' => __( 'Blavatar' ), |
|
249 | - 'buddypress' => __( 'BuddyPress' ), |
|
250 | - 'custom-background' => __( 'Custom Background' ), |
|
251 | - 'custom-colors' => __( 'Custom Colors' ), |
|
252 | - 'custom-header' => __( 'Custom Header' ), |
|
253 | - 'custom-menu' => __( 'Custom Menu' ), |
|
254 | - 'editor-style' => __( 'Editor Style' ), |
|
255 | - 'featured-image-header' => __( 'Featured Image Header' ), |
|
256 | - 'featured-images' => __( 'Featured Images' ), |
|
257 | - 'flexible-header' => __( 'Flexible Header' ), |
|
258 | - 'front-page-post-form' => __( 'Front Page Posting' ), |
|
259 | - 'full-width-template' => __( 'Full Width Template' ), |
|
260 | - 'microformats' => __( 'Microformats' ), |
|
261 | - 'post-formats' => __( 'Post Formats' ), |
|
262 | - 'rtl-language-support' => __( 'RTL Language Support' ), |
|
263 | - 'sticky-post' => __( 'Sticky Post' ), |
|
264 | - 'theme-options' => __( 'Theme Options' ), |
|
265 | - 'threaded-comments' => __( 'Threaded Comments' ), |
|
266 | - 'translation-ready' => __( 'Translation Ready' ), |
|
246 | + __('Features') => array( |
|
247 | + 'accessibility-ready' => __('Accessibility Ready'), |
|
248 | + 'blavatar' => __('Blavatar'), |
|
249 | + 'buddypress' => __('BuddyPress'), |
|
250 | + 'custom-background' => __('Custom Background'), |
|
251 | + 'custom-colors' => __('Custom Colors'), |
|
252 | + 'custom-header' => __('Custom Header'), |
|
253 | + 'custom-menu' => __('Custom Menu'), |
|
254 | + 'editor-style' => __('Editor Style'), |
|
255 | + 'featured-image-header' => __('Featured Image Header'), |
|
256 | + 'featured-images' => __('Featured Images'), |
|
257 | + 'flexible-header' => __('Flexible Header'), |
|
258 | + 'front-page-post-form' => __('Front Page Posting'), |
|
259 | + 'full-width-template' => __('Full Width Template'), |
|
260 | + 'microformats' => __('Microformats'), |
|
261 | + 'post-formats' => __('Post Formats'), |
|
262 | + 'rtl-language-support' => __('RTL Language Support'), |
|
263 | + 'sticky-post' => __('Sticky Post'), |
|
264 | + 'theme-options' => __('Theme Options'), |
|
265 | + 'threaded-comments' => __('Threaded Comments'), |
|
266 | + 'translation-ready' => __('Translation Ready'), |
|
267 | 267 | ), |
268 | 268 | |
269 | - __( 'Subject' ) => array( |
|
270 | - 'holiday' => __( 'Holiday' ), |
|
271 | - 'photoblogging' => __( 'Photoblogging' ), |
|
272 | - 'seasonal' => __( 'Seasonal' ), |
|
269 | + __('Subject') => array( |
|
270 | + 'holiday' => __('Holiday'), |
|
271 | + 'photoblogging' => __('Photoblogging'), |
|
272 | + 'seasonal' => __('Seasonal'), |
|
273 | 273 | ) |
274 | 274 | ); |
275 | 275 | |
276 | - if ( ! $api || ! current_user_can( 'install_themes' ) ) |
|
276 | + if ( ! $api || ! current_user_can('install_themes')) |
|
277 | 277 | return $features; |
278 | 278 | |
279 | - if ( !$feature_list = get_site_transient( 'wporg_theme_feature_list' ) ) |
|
280 | - set_site_transient( 'wporg_theme_feature_list', array(), 3 * HOUR_IN_SECONDS ); |
|
279 | + if ( ! $feature_list = get_site_transient('wporg_theme_feature_list')) |
|
280 | + set_site_transient('wporg_theme_feature_list', array(), 3 * HOUR_IN_SECONDS); |
|
281 | 281 | |
282 | - if ( !$feature_list ) { |
|
283 | - $feature_list = themes_api( 'feature_list', array() ); |
|
284 | - if ( is_wp_error( $feature_list ) ) |
|
282 | + if ( ! $feature_list) { |
|
283 | + $feature_list = themes_api('feature_list', array()); |
|
284 | + if (is_wp_error($feature_list)) |
|
285 | 285 | return $features; |
286 | 286 | } |
287 | 287 | |
288 | - if ( !$feature_list ) |
|
288 | + if ( ! $feature_list) |
|
289 | 289 | return $features; |
290 | 290 | |
291 | - set_site_transient( 'wporg_theme_feature_list', $feature_list, 3 * HOUR_IN_SECONDS ); |
|
291 | + set_site_transient('wporg_theme_feature_list', $feature_list, 3 * HOUR_IN_SECONDS); |
|
292 | 292 | |
293 | 293 | $category_translations = array( |
294 | - 'Colors' => __( 'Colors' ), |
|
295 | - 'Layout' => __( 'Layout' ), |
|
296 | - 'Features' => __( 'Features' ), |
|
297 | - 'Subject' => __( 'Subject' ) |
|
294 | + 'Colors' => __('Colors'), |
|
295 | + 'Layout' => __('Layout'), |
|
296 | + 'Features' => __('Features'), |
|
297 | + 'Subject' => __('Subject') |
|
298 | 298 | ); |
299 | 299 | |
300 | 300 | // Loop over the wporg canonical list and apply translations |
301 | 301 | $wporg_features = array(); |
302 | - foreach ( (array) $feature_list as $feature_category => $feature_items ) { |
|
303 | - if ( isset($category_translations[$feature_category]) ) |
|
302 | + foreach ((array) $feature_list as $feature_category => $feature_items) { |
|
303 | + if (isset($category_translations[$feature_category])) |
|
304 | 304 | $feature_category = $category_translations[$feature_category]; |
305 | 305 | $wporg_features[$feature_category] = array(); |
306 | 306 | |
307 | - foreach ( $feature_items as $feature ) { |
|
308 | - if ( isset($features[$feature_category][$feature]) ) |
|
307 | + foreach ($feature_items as $feature) { |
|
308 | + if (isset($features[$feature_category][$feature])) |
|
309 | 309 | $wporg_features[$feature_category][$feature] = $features[$feature_category][$feature]; |
310 | 310 | else |
311 | 311 | $wporg_features[$feature_category][$feature] = $feature; |
@@ -396,17 +396,17 @@ discard block |
||
396 | 396 | * {@link https://developer.wordpress.org/reference/functions/themes_api/ function reference article} |
397 | 397 | * for more information on the make-up of possible return objects depending on the value of `$action`. |
398 | 398 | */ |
399 | -function themes_api( $action, $args = array() ) { |
|
399 | +function themes_api($action, $args = array()) { |
|
400 | 400 | |
401 | - if ( is_array( $args ) ) { |
|
401 | + if (is_array($args)) { |
|
402 | 402 | $args = (object) $args; |
403 | 403 | } |
404 | 404 | |
405 | - if ( ! isset( $args->per_page ) ) { |
|
405 | + if ( ! isset($args->per_page)) { |
|
406 | 406 | $args->per_page = 24; |
407 | 407 | } |
408 | 408 | |
409 | - if ( ! isset( $args->locale ) ) { |
|
409 | + if ( ! isset($args->locale)) { |
|
410 | 410 | $args->locale = get_locale(); |
411 | 411 | } |
412 | 412 | |
@@ -421,7 +421,7 @@ discard block |
||
421 | 421 | * @param string $action Requested action. Likely values are 'theme_information', |
422 | 422 | * 'feature_list', or 'query_themes'. |
423 | 423 | */ |
424 | - $args = apply_filters( 'themes_api_args', $args, $action ); |
|
424 | + $args = apply_filters('themes_api_args', $args, $action); |
|
425 | 425 | |
426 | 426 | /** |
427 | 427 | * Filter whether to override the WordPress.org Themes API. |
@@ -438,34 +438,34 @@ discard block |
||
438 | 438 | * 'feature_list', or 'query_themes'. |
439 | 439 | * @param object $args Arguments used to query for installer pages from the Themes API. |
440 | 440 | */ |
441 | - $res = apply_filters( 'themes_api', false, $action, $args ); |
|
441 | + $res = apply_filters('themes_api', false, $action, $args); |
|
442 | 442 | |
443 | - if ( ! $res ) { |
|
443 | + if ( ! $res) { |
|
444 | 444 | $url = $http_url = 'http://api.wordpress.org/themes/info/1.0/'; |
445 | - if ( $ssl = wp_http_supports( array( 'ssl' ) ) ) |
|
446 | - $url = set_url_scheme( $url, 'https' ); |
|
445 | + if ($ssl = wp_http_supports(array('ssl'))) |
|
446 | + $url = set_url_scheme($url, 'https'); |
|
447 | 447 | |
448 | 448 | $http_args = array( |
449 | 449 | 'body' => array( |
450 | 450 | 'action' => $action, |
451 | - 'request' => serialize( $args ) |
|
451 | + 'request' => serialize($args) |
|
452 | 452 | ) |
453 | 453 | ); |
454 | - $request = wp_remote_post( $url, $http_args ); |
|
454 | + $request = wp_remote_post($url, $http_args); |
|
455 | 455 | |
456 | - if ( $ssl && is_wp_error( $request ) ) { |
|
457 | - if ( ! defined( 'DOING_AJAX' ) || ! DOING_AJAX ) { |
|
458 | - trigger_error( __( 'An unexpected error occurred. Something may be wrong with WordPress.org or this server’s configuration. If you continue to have problems, please try the <a href="https://wordpress.org/support/">support forums</a>.' ) . ' ' . __( '(WordPress could not establish a secure connection to WordPress.org. Please contact your server administrator.)' ), headers_sent() || WP_DEBUG ? E_USER_WARNING : E_USER_NOTICE ); |
|
456 | + if ($ssl && is_wp_error($request)) { |
|
457 | + if ( ! defined('DOING_AJAX') || ! DOING_AJAX) { |
|
458 | + trigger_error(__('An unexpected error occurred. Something may be wrong with WordPress.org or this server’s configuration. If you continue to have problems, please try the <a href="https://wordpress.org/support/">support forums</a>.').' '.__('(WordPress could not establish a secure connection to WordPress.org. Please contact your server administrator.)'), headers_sent() || WP_DEBUG ? E_USER_WARNING : E_USER_NOTICE); |
|
459 | 459 | } |
460 | - $request = wp_remote_post( $http_url, $http_args ); |
|
460 | + $request = wp_remote_post($http_url, $http_args); |
|
461 | 461 | } |
462 | 462 | |
463 | - if ( is_wp_error($request) ) { |
|
464 | - $res = new WP_Error('themes_api_failed', __( 'An unexpected error occurred. Something may be wrong with WordPress.org or this server’s configuration. If you continue to have problems, please try the <a href="https://wordpress.org/support/">support forums</a>.' ), $request->get_error_message() ); |
|
463 | + if (is_wp_error($request)) { |
|
464 | + $res = new WP_Error('themes_api_failed', __('An unexpected error occurred. Something may be wrong with WordPress.org or this server’s configuration. If you continue to have problems, please try the <a href="https://wordpress.org/support/">support forums</a>.'), $request->get_error_message()); |
|
465 | 465 | } else { |
466 | - $res = maybe_unserialize( wp_remote_retrieve_body( $request ) ); |
|
467 | - if ( ! is_object( $res ) && ! is_array( $res ) ) |
|
468 | - $res = new WP_Error('themes_api_failed', __( 'An unexpected error occurred. Something may be wrong with WordPress.org or this server’s configuration. If you continue to have problems, please try the <a href="https://wordpress.org/support/">support forums</a>.' ), wp_remote_retrieve_body( $request ) ); |
|
466 | + $res = maybe_unserialize(wp_remote_retrieve_body($request)); |
|
467 | + if ( ! is_object($res) && ! is_array($res)) |
|
468 | + $res = new WP_Error('themes_api_failed', __('An unexpected error occurred. Something may be wrong with WordPress.org or this server’s configuration. If you continue to have problems, please try the <a href="https://wordpress.org/support/">support forums</a>.'), wp_remote_retrieve_body($request)); |
|
469 | 469 | } |
470 | 470 | } |
471 | 471 | |
@@ -479,7 +479,7 @@ discard block |
||
479 | 479 | * 'feature_list', or 'query_themes'. |
480 | 480 | * @param object $args Arguments used to query for installer pages from the WordPress.org Themes API. |
481 | 481 | */ |
482 | - return apply_filters( 'themes_api_result', $res, $action, $args ); |
|
482 | + return apply_filters('themes_api_result', $res, $action, $args); |
|
483 | 483 | } |
484 | 484 | |
485 | 485 | /** |
@@ -492,7 +492,7 @@ discard block |
||
492 | 492 | * |
493 | 493 | * @return array An associative array of theme data, sorted by name. |
494 | 494 | */ |
495 | -function wp_prepare_themes_for_js( $themes = null ) { |
|
495 | +function wp_prepare_themes_for_js($themes = null) { |
|
496 | 496 | $current_theme = get_stylesheet(); |
497 | 497 | |
498 | 498 | /** |
@@ -507,78 +507,78 @@ discard block |
||
507 | 507 | * @param null|array $themes An array of WP_Theme objects to prepare, if any. |
508 | 508 | * @param string $current_theme The current theme slug. |
509 | 509 | */ |
510 | - $prepared_themes = (array) apply_filters( 'pre_prepare_themes_for_js', array(), $themes, $current_theme ); |
|
510 | + $prepared_themes = (array) apply_filters('pre_prepare_themes_for_js', array(), $themes, $current_theme); |
|
511 | 511 | |
512 | - if ( ! empty( $prepared_themes ) ) { |
|
512 | + if ( ! empty($prepared_themes)) { |
|
513 | 513 | return $prepared_themes; |
514 | 514 | } |
515 | 515 | |
516 | 516 | // Make sure the current theme is listed first. |
517 | - $prepared_themes[ $current_theme ] = array(); |
|
517 | + $prepared_themes[$current_theme] = array(); |
|
518 | 518 | |
519 | - if ( null === $themes ) { |
|
520 | - $themes = wp_get_themes( array( 'allowed' => true ) ); |
|
521 | - if ( ! isset( $themes[ $current_theme ] ) ) { |
|
522 | - $themes[ $current_theme ] = wp_get_theme(); |
|
519 | + if (null === $themes) { |
|
520 | + $themes = wp_get_themes(array('allowed' => true)); |
|
521 | + if ( ! isset($themes[$current_theme])) { |
|
522 | + $themes[$current_theme] = wp_get_theme(); |
|
523 | 523 | } |
524 | 524 | } |
525 | 525 | |
526 | 526 | $updates = array(); |
527 | - if ( current_user_can( 'update_themes' ) ) { |
|
528 | - $updates_transient = get_site_transient( 'update_themes' ); |
|
529 | - if ( isset( $updates_transient->response ) ) { |
|
527 | + if (current_user_can('update_themes')) { |
|
528 | + $updates_transient = get_site_transient('update_themes'); |
|
529 | + if (isset($updates_transient->response)) { |
|
530 | 530 | $updates = $updates_transient->response; |
531 | 531 | } |
532 | 532 | } |
533 | 533 | |
534 | - WP_Theme::sort_by_name( $themes ); |
|
534 | + WP_Theme::sort_by_name($themes); |
|
535 | 535 | |
536 | 536 | $parents = array(); |
537 | 537 | |
538 | - foreach ( $themes as $theme ) { |
|
538 | + foreach ($themes as $theme) { |
|
539 | 539 | $slug = $theme->get_stylesheet(); |
540 | - $encoded_slug = urlencode( $slug ); |
|
540 | + $encoded_slug = urlencode($slug); |
|
541 | 541 | |
542 | 542 | $parent = false; |
543 | - if ( $theme->parent() ) { |
|
544 | - $parent = $theme->parent()->display( 'Name' ); |
|
545 | - $parents[ $slug ] = $theme->parent()->get_stylesheet(); |
|
543 | + if ($theme->parent()) { |
|
544 | + $parent = $theme->parent()->display('Name'); |
|
545 | + $parents[$slug] = $theme->parent()->get_stylesheet(); |
|
546 | 546 | } |
547 | 547 | |
548 | 548 | $customize_action = null; |
549 | - if ( current_user_can( 'edit_theme_options' ) && current_user_can( 'customize' ) ) { |
|
550 | - $customize_action = esc_url( add_query_arg( |
|
549 | + if (current_user_can('edit_theme_options') && current_user_can('customize')) { |
|
550 | + $customize_action = esc_url(add_query_arg( |
|
551 | 551 | array( |
552 | - 'return' => urlencode( esc_url_raw( wp_unslash( $_SERVER['REQUEST_URI'] ) ) ), |
|
552 | + 'return' => urlencode(esc_url_raw(wp_unslash($_SERVER['REQUEST_URI']))), |
|
553 | 553 | ), |
554 | - wp_customize_url( $slug ) |
|
555 | - ) ); |
|
554 | + wp_customize_url($slug) |
|
555 | + )); |
|
556 | 556 | } |
557 | 557 | |
558 | - $prepared_themes[ $slug ] = array( |
|
558 | + $prepared_themes[$slug] = array( |
|
559 | 559 | 'id' => $slug, |
560 | - 'name' => $theme->display( 'Name' ), |
|
561 | - 'screenshot' => array( $theme->get_screenshot() ), // @todo multiple |
|
562 | - 'description' => $theme->display( 'Description' ), |
|
563 | - 'author' => $theme->display( 'Author', false, true ), |
|
564 | - 'authorAndUri' => $theme->display( 'Author' ), |
|
565 | - 'version' => $theme->display( 'Version' ), |
|
566 | - 'tags' => $theme->display( 'Tags' ), |
|
560 | + 'name' => $theme->display('Name'), |
|
561 | + 'screenshot' => array($theme->get_screenshot()), // @todo multiple |
|
562 | + 'description' => $theme->display('Description'), |
|
563 | + 'author' => $theme->display('Author', false, true), |
|
564 | + 'authorAndUri' => $theme->display('Author'), |
|
565 | + 'version' => $theme->display('Version'), |
|
566 | + 'tags' => $theme->display('Tags'), |
|
567 | 567 | 'parent' => $parent, |
568 | 568 | 'active' => $slug === $current_theme, |
569 | - 'hasUpdate' => isset( $updates[ $slug ] ), |
|
570 | - 'update' => get_theme_update_available( $theme ), |
|
569 | + 'hasUpdate' => isset($updates[$slug]), |
|
570 | + 'update' => get_theme_update_available($theme), |
|
571 | 571 | 'actions' => array( |
572 | - 'activate' => current_user_can( 'switch_themes' ) ? wp_nonce_url( admin_url( 'themes.php?action=activate&stylesheet=' . $encoded_slug ), 'switch-theme_' . $slug ) : null, |
|
572 | + 'activate' => current_user_can('switch_themes') ? wp_nonce_url(admin_url('themes.php?action=activate&stylesheet='.$encoded_slug), 'switch-theme_'.$slug) : null, |
|
573 | 573 | 'customize' => $customize_action, |
574 | - 'delete' => current_user_can( 'delete_themes' ) ? wp_nonce_url( admin_url( 'themes.php?action=delete&stylesheet=' . $encoded_slug ), 'delete-theme_' . $slug ) : null, |
|
574 | + 'delete' => current_user_can('delete_themes') ? wp_nonce_url(admin_url('themes.php?action=delete&stylesheet='.$encoded_slug), 'delete-theme_'.$slug) : null, |
|
575 | 575 | ), |
576 | 576 | ); |
577 | 577 | } |
578 | 578 | |
579 | 579 | // Remove 'delete' action if theme has an active child |
580 | - if ( ! empty( $parents ) && array_key_exists( $current_theme, $parents ) ) { |
|
581 | - unset( $prepared_themes[ $parents[ $current_theme ] ]['actions']['delete'] ); |
|
580 | + if ( ! empty($parents) && array_key_exists($current_theme, $parents)) { |
|
581 | + unset($prepared_themes[$parents[$current_theme]]['actions']['delete']); |
|
582 | 582 | } |
583 | 583 | |
584 | 584 | /** |
@@ -590,9 +590,9 @@ discard block |
||
590 | 590 | * |
591 | 591 | * @param array $prepared_themes Array of themes. |
592 | 592 | */ |
593 | - $prepared_themes = apply_filters( 'wp_prepare_themes_for_js', $prepared_themes ); |
|
594 | - $prepared_themes = array_values( $prepared_themes ); |
|
595 | - return array_filter( $prepared_themes ); |
|
593 | + $prepared_themes = apply_filters('wp_prepare_themes_for_js', $prepared_themes); |
|
594 | + $prepared_themes = array_values($prepared_themes); |
|
595 | + return array_filter($prepared_themes); |
|
596 | 596 | } |
597 | 597 | |
598 | 598 | /** |
@@ -601,16 +601,16 @@ discard block |
||
601 | 601 | * @since 4.2.0 |
602 | 602 | */ |
603 | 603 | function customize_themes_print_templates() { |
604 | - $preview_url = esc_url( add_query_arg( 'theme', '__THEME__' ) ); // Token because esc_url() strips curly braces. |
|
605 | - $preview_url = str_replace( '__THEME__', '{{ data.id }}', $preview_url ); |
|
604 | + $preview_url = esc_url(add_query_arg('theme', '__THEME__')); // Token because esc_url() strips curly braces. |
|
605 | + $preview_url = str_replace('__THEME__', '{{ data.id }}', $preview_url); |
|
606 | 606 | ?> |
607 | 607 | <script type="text/html" id="tmpl-customize-themes-details-view"> |
608 | 608 | <div class="theme-backdrop"></div> |
609 | 609 | <div class="theme-wrap wp-clearfix"> |
610 | 610 | <div class="theme-header"> |
611 | - <button type="button" class="left dashicons dashicons-no"><span class="screen-reader-text"><?php _e( 'Show previous theme' ); ?></span></button> |
|
612 | - <button type="button" class="right dashicons dashicons-no"><span class="screen-reader-text"><?php _e( 'Show next theme' ); ?></span></button> |
|
613 | - <button type="button" class="close dashicons dashicons-no"><span class="screen-reader-text"><?php _e( 'Close details dialog' ); ?></span></button> |
|
611 | + <button type="button" class="left dashicons dashicons-no"><span class="screen-reader-text"><?php _e('Show previous theme'); ?></span></button> |
|
612 | + <button type="button" class="right dashicons dashicons-no"><span class="screen-reader-text"><?php _e('Show next theme'); ?></span></button> |
|
613 | + <button type="button" class="close dashicons dashicons-no"><span class="screen-reader-text"><?php _e('Close details dialog'); ?></span></button> |
|
614 | 614 | </div> |
615 | 615 | <div class="theme-about wp-clearfix"> |
616 | 616 | <div class="theme-screenshots"> |
@@ -623,18 +623,18 @@ discard block |
||
623 | 623 | |
624 | 624 | <div class="theme-info"> |
625 | 625 | <# if ( data.active ) { #> |
626 | - <span class="current-label"><?php _e( 'Current Theme' ); ?></span> |
|
626 | + <span class="current-label"><?php _e('Current Theme'); ?></span> |
|
627 | 627 | <# } #> |
628 | - <h2 class="theme-name">{{{ data.name }}}<span class="theme-version"><?php printf( __( 'Version: %s' ), '{{ data.version }}' ); ?></span></h2> |
|
629 | - <h3 class="theme-author"><?php printf( __( 'By %s' ), '{{{ data.authorAndUri }}}' ); ?></h3> |
|
628 | + <h2 class="theme-name">{{{ data.name }}}<span class="theme-version"><?php printf(__('Version: %s'), '{{ data.version }}'); ?></span></h2> |
|
629 | + <h3 class="theme-author"><?php printf(__('By %s'), '{{{ data.authorAndUri }}}'); ?></h3> |
|
630 | 630 | <p class="theme-description">{{{ data.description }}}</p> |
631 | 631 | |
632 | 632 | <# if ( data.parent ) { #> |
633 | - <p class="parent-theme"><?php printf( __( 'This is a child theme of %s.' ), '<strong>{{{ data.parent }}}</strong>' ); ?></p> |
|
633 | + <p class="parent-theme"><?php printf(__('This is a child theme of %s.'), '<strong>{{{ data.parent }}}</strong>'); ?></p> |
|
634 | 634 | <# } #> |
635 | 635 | |
636 | 636 | <# if ( data.tags ) { #> |
637 | - <p class="theme-tags"><span><?php _e( 'Tags:' ); ?></span> {{ data.tags }}</p> |
|
637 | + <p class="theme-tags"><span><?php _e('Tags:'); ?></span> {{ data.tags }}</p> |
|
638 | 638 | <# } #> |
639 | 639 | </div> |
640 | 640 | </div> |
@@ -642,7 +642,7 @@ discard block |
||
642 | 642 | <# if ( ! data.active ) { #> |
643 | 643 | <div class="theme-actions"> |
644 | 644 | <div class="inactive-theme"> |
645 | - <a href="<?php echo $preview_url; ?>" target="_top" class="button button-primary"><?php _e( 'Live Preview' ); ?></a> |
|
645 | + <a href="<?php echo $preview_url; ?>" target="_top" class="button button-primary"><?php _e('Live Preview'); ?></a> |
|
646 | 646 | </div> |
647 | 647 | </div> |
648 | 648 | <# } #> |
@@ -1,12 +1,12 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * Deprecated admin functions from past WordPress versions. You shouldn't use these |
|
4 | - * functions and look for the alternatives instead. The functions will be removed |
|
5 | - * in a later version. |
|
6 | - * |
|
7 | - * @package WordPress |
|
8 | - * @subpackage Deprecated |
|
9 | - */ |
|
3 | + * Deprecated admin functions from past WordPress versions. You shouldn't use these |
|
4 | + * functions and look for the alternatives instead. The functions will be removed |
|
5 | + * in a later version. |
|
6 | + * |
|
7 | + * @package WordPress |
|
8 | + * @subpackage Deprecated |
|
9 | + */ |
|
10 | 10 | |
11 | 11 | /* |
12 | 12 | * Deprecated functions come here to die. |
@@ -127,8 +127,8 @@ |
||
127 | 127 | * @param int $currentparent Optional. Current parent category ID. Default 0. |
128 | 128 | * @param int $parent Optional. Parent ID to retrieve categories for. Default 0. |
129 | 129 | * @param int $level Optional. Number of levels deep to display. Default 0. |
130 | - * @param array $categories Optional. Categories to include in the control. Default 0. |
|
131 | - * @return bool|null False if no categories were found. |
|
130 | + * @param integer $categories Optional. Categories to include in the control. Default 0. |
|
131 | + * @return null|false False if no categories were found. |
|
132 | 132 | */ |
133 | 133 | function wp_dropdown_cats( $currentcat = 0, $currentparent = 0, $parent = 0, $level = 0, $categories = 0 ) { |
134 | 134 | _deprecated_function( __FUNCTION__, '3.0', 'wp_dropdown_categories()' ); |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | * @see wp_editor() |
19 | 19 | */ |
20 | 20 | function tinymce_include() { |
21 | - _deprecated_function( __FUNCTION__, '2.1', 'wp_editor()' ); |
|
21 | + _deprecated_function(__FUNCTION__, '2.1', 'wp_editor()'); |
|
22 | 22 | |
23 | 23 | wp_tiny_mce(); |
24 | 24 | } |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | * |
32 | 32 | */ |
33 | 33 | function documentation_link() { |
34 | - _deprecated_function( __FUNCTION__, '2.5' ); |
|
34 | + _deprecated_function(__FUNCTION__, '2.5'); |
|
35 | 35 | } |
36 | 36 | |
37 | 37 | /** |
@@ -47,9 +47,9 @@ discard block |
||
47 | 47 | * @param int $hmax Maximum wanted height |
48 | 48 | * @return array Shrunk dimensions (width, height). |
49 | 49 | */ |
50 | -function wp_shrink_dimensions( $width, $height, $wmax = 128, $hmax = 96 ) { |
|
51 | - _deprecated_function( __FUNCTION__, '3.0', 'wp_constrain_dimensions()' ); |
|
52 | - return wp_constrain_dimensions( $width, $height, $wmax, $hmax ); |
|
50 | +function wp_shrink_dimensions($width, $height, $wmax = 128, $hmax = 96) { |
|
51 | + _deprecated_function(__FUNCTION__, '3.0', 'wp_constrain_dimensions()'); |
|
52 | + return wp_constrain_dimensions($width, $height, $wmax, $hmax); |
|
53 | 53 | } |
54 | 54 | |
55 | 55 | /** |
@@ -63,9 +63,9 @@ discard block |
||
63 | 63 | * @param int $height Current height of the image |
64 | 64 | * @return array Shrunk dimensions (width, height). |
65 | 65 | */ |
66 | -function get_udims( $width, $height ) { |
|
67 | - _deprecated_function( __FUNCTION__, '3.5', 'wp_constrain_dimensions()' ); |
|
68 | - return wp_constrain_dimensions( $width, $height, 128, 96 ); |
|
66 | +function get_udims($width, $height) { |
|
67 | + _deprecated_function(__FUNCTION__, '3.5', 'wp_constrain_dimensions()'); |
|
68 | + return wp_constrain_dimensions($width, $height, 128, 96); |
|
69 | 69 | } |
70 | 70 | |
71 | 71 | /** |
@@ -79,10 +79,10 @@ discard block |
||
79 | 79 | * @param int $parent Unused. |
80 | 80 | * @param array $popular_ids Unused. |
81 | 81 | */ |
82 | -function dropdown_categories( $default = 0, $parent = 0, $popular_ids = array() ) { |
|
83 | - _deprecated_function( __FUNCTION__, '2.6', 'wp_category_checklist()' ); |
|
82 | +function dropdown_categories($default = 0, $parent = 0, $popular_ids = array()) { |
|
83 | + _deprecated_function(__FUNCTION__, '2.6', 'wp_category_checklist()'); |
|
84 | 84 | global $post_ID; |
85 | - wp_category_checklist( $post_ID ); |
|
85 | + wp_category_checklist($post_ID); |
|
86 | 86 | } |
87 | 87 | |
88 | 88 | /** |
@@ -94,10 +94,10 @@ discard block |
||
94 | 94 | * |
95 | 95 | * @param int $default Unused. |
96 | 96 | */ |
97 | -function dropdown_link_categories( $default = 0 ) { |
|
98 | - _deprecated_function( __FUNCTION__, '2.6', 'wp_link_category_checklist()' ); |
|
97 | +function dropdown_link_categories($default = 0) { |
|
98 | + _deprecated_function(__FUNCTION__, '2.6', 'wp_link_category_checklist()'); |
|
99 | 99 | global $link_id; |
100 | - wp_link_category_checklist( $link_id ); |
|
100 | + wp_link_category_checklist($link_id); |
|
101 | 101 | } |
102 | 102 | |
103 | 103 | /** |
@@ -110,10 +110,10 @@ discard block |
||
110 | 110 | * @param string $file Filesystem path relative to the wp-content directory. |
111 | 111 | * @return string Full filesystem path to edit. |
112 | 112 | */ |
113 | -function get_real_file_to_edit( $file ) { |
|
114 | - _deprecated_function( __FUNCTION__, '2.9' ); |
|
113 | +function get_real_file_to_edit($file) { |
|
114 | + _deprecated_function(__FUNCTION__, '2.9'); |
|
115 | 115 | |
116 | - return WP_CONTENT_DIR . $file; |
|
116 | + return WP_CONTENT_DIR.$file; |
|
117 | 117 | } |
118 | 118 | |
119 | 119 | /** |
@@ -130,21 +130,21 @@ discard block |
||
130 | 130 | * @param array $categories Optional. Categories to include in the control. Default 0. |
131 | 131 | * @return bool|null False if no categories were found. |
132 | 132 | */ |
133 | -function wp_dropdown_cats( $currentcat = 0, $currentparent = 0, $parent = 0, $level = 0, $categories = 0 ) { |
|
134 | - _deprecated_function( __FUNCTION__, '3.0', 'wp_dropdown_categories()' ); |
|
135 | - if (!$categories ) |
|
136 | - $categories = get_categories( array('hide_empty' => 0) ); |
|
133 | +function wp_dropdown_cats($currentcat = 0, $currentparent = 0, $parent = 0, $level = 0, $categories = 0) { |
|
134 | + _deprecated_function(__FUNCTION__, '3.0', 'wp_dropdown_categories()'); |
|
135 | + if ( ! $categories) |
|
136 | + $categories = get_categories(array('hide_empty' => 0)); |
|
137 | 137 | |
138 | - if ( $categories ) { |
|
139 | - foreach ( $categories as $category ) { |
|
140 | - if ( $currentcat != $category->term_id && $parent == $category->parent) { |
|
141 | - $pad = str_repeat( '– ', $level ); |
|
142 | - $category->name = esc_html( $category->name ); |
|
138 | + if ($categories) { |
|
139 | + foreach ($categories as $category) { |
|
140 | + if ($currentcat != $category->term_id && $parent == $category->parent) { |
|
141 | + $pad = str_repeat('– ', $level); |
|
142 | + $category->name = esc_html($category->name); |
|
143 | 143 | echo "\n\t<option value='$category->term_id'"; |
144 | - if ( $currentparent == $category->term_id ) |
|
144 | + if ($currentparent == $category->term_id) |
|
145 | 145 | echo " selected='selected'"; |
146 | 146 | echo ">$pad$category->name</option>"; |
147 | - wp_dropdown_cats( $currentcat, $currentparent, $category->term_id, $level +1, $categories ); |
|
147 | + wp_dropdown_cats($currentcat, $currentparent, $category->term_id, $level + 1, $categories); |
|
148 | 148 | } |
149 | 149 | } |
150 | 150 | } else { |
@@ -164,9 +164,9 @@ discard block |
||
164 | 164 | * @param string $option_name The name of an option to sanitize and save. |
165 | 165 | * @param callable $sanitize_callback A callback function that sanitizes the option's value. |
166 | 166 | */ |
167 | -function add_option_update_handler( $option_group, $option_name, $sanitize_callback = '' ) { |
|
168 | - _deprecated_function( __FUNCTION__, '3.0', 'register_setting()' ); |
|
169 | - register_setting( $option_group, $option_name, $sanitize_callback ); |
|
167 | +function add_option_update_handler($option_group, $option_name, $sanitize_callback = '') { |
|
168 | + _deprecated_function(__FUNCTION__, '3.0', 'register_setting()'); |
|
169 | + register_setting($option_group, $option_name, $sanitize_callback); |
|
170 | 170 | } |
171 | 171 | |
172 | 172 | /** |
@@ -180,9 +180,9 @@ discard block |
||
180 | 180 | * @param string $option_name |
181 | 181 | * @param callable $sanitize_callback |
182 | 182 | */ |
183 | -function remove_option_update_handler( $option_group, $option_name, $sanitize_callback = '' ) { |
|
184 | - _deprecated_function( __FUNCTION__, '3.0', 'unregister_setting()' ); |
|
185 | - unregister_setting( $option_group, $option_name, $sanitize_callback ); |
|
183 | +function remove_option_update_handler($option_group, $option_name, $sanitize_callback = '') { |
|
184 | + _deprecated_function(__FUNCTION__, '3.0', 'unregister_setting()'); |
|
185 | + unregister_setting($option_group, $option_name, $sanitize_callback); |
|
186 | 186 | } |
187 | 187 | |
188 | 188 | /** |
@@ -193,8 +193,8 @@ discard block |
||
193 | 193 | * |
194 | 194 | * @param string $filename |
195 | 195 | **/ |
196 | -function codepress_get_lang( $filename ) { |
|
197 | - _deprecated_function( __FUNCTION__, '3.0' ); |
|
196 | +function codepress_get_lang($filename) { |
|
197 | + _deprecated_function(__FUNCTION__, '3.0'); |
|
198 | 198 | } |
199 | 199 | |
200 | 200 | /** |
@@ -204,7 +204,7 @@ discard block |
||
204 | 204 | * @deprecated 3.0.0 |
205 | 205 | **/ |
206 | 206 | function codepress_footer_js() { |
207 | - _deprecated_function( __FUNCTION__, '3.0' ); |
|
207 | + _deprecated_function(__FUNCTION__, '3.0'); |
|
208 | 208 | } |
209 | 209 | |
210 | 210 | /** |
@@ -214,7 +214,7 @@ discard block |
||
214 | 214 | * @deprecated 3.0.0 |
215 | 215 | **/ |
216 | 216 | function use_codepress() { |
217 | - _deprecated_function( __FUNCTION__, '3.0' ); |
|
217 | + _deprecated_function(__FUNCTION__, '3.0'); |
|
218 | 218 | } |
219 | 219 | |
220 | 220 | /** |
@@ -225,15 +225,15 @@ discard block |
||
225 | 225 | * @return array List of user IDs. |
226 | 226 | */ |
227 | 227 | function get_author_user_ids() { |
228 | - _deprecated_function( __FUNCTION__, '3.1', 'get_users()' ); |
|
228 | + _deprecated_function(__FUNCTION__, '3.1', 'get_users()'); |
|
229 | 229 | |
230 | 230 | global $wpdb; |
231 | - if ( !is_multisite() ) |
|
232 | - $level_key = $wpdb->get_blog_prefix() . 'user_level'; |
|
231 | + if ( ! is_multisite()) |
|
232 | + $level_key = $wpdb->get_blog_prefix().'user_level'; |
|
233 | 233 | else |
234 | - $level_key = $wpdb->get_blog_prefix() . 'capabilities'; // wpmu site admins don't have user_levels |
|
234 | + $level_key = $wpdb->get_blog_prefix().'capabilities'; // wpmu site admins don't have user_levels |
|
235 | 235 | |
236 | - return $wpdb->get_col( $wpdb->prepare("SELECT user_id FROM $wpdb->usermeta WHERE meta_key = %s AND meta_value != '0'", $level_key) ); |
|
236 | + return $wpdb->get_col($wpdb->prepare("SELECT user_id FROM $wpdb->usermeta WHERE meta_key = %s AND meta_value != '0'", $level_key)); |
|
237 | 237 | } |
238 | 238 | |
239 | 239 | /** |
@@ -244,18 +244,18 @@ discard block |
||
244 | 244 | * @param int $user_id User ID. |
245 | 245 | * @return array|bool List of editable authors. False if no editable users. |
246 | 246 | */ |
247 | -function get_editable_authors( $user_id ) { |
|
248 | - _deprecated_function( __FUNCTION__, '3.1', 'get_users()' ); |
|
247 | +function get_editable_authors($user_id) { |
|
248 | + _deprecated_function(__FUNCTION__, '3.1', 'get_users()'); |
|
249 | 249 | |
250 | 250 | global $wpdb; |
251 | 251 | |
252 | - $editable = get_editable_user_ids( $user_id ); |
|
252 | + $editable = get_editable_user_ids($user_id); |
|
253 | 253 | |
254 | - if ( !$editable ) { |
|
254 | + if ( ! $editable) { |
|
255 | 255 | return false; |
256 | 256 | } else { |
257 | 257 | $editable = join(',', $editable); |
258 | - $authors = $wpdb->get_results( "SELECT * FROM $wpdb->users WHERE ID IN ($editable) ORDER BY display_name" ); |
|
258 | + $authors = $wpdb->get_results("SELECT * FROM $wpdb->users WHERE ID IN ($editable) ORDER BY display_name"); |
|
259 | 259 | } |
260 | 260 | |
261 | 261 | return apply_filters('get_editable_authors', $authors); |
@@ -270,32 +270,32 @@ discard block |
||
270 | 270 | * @param bool $exclude_zeros Optional. Whether to exclude zeroes. Default true. |
271 | 271 | * @return array Array of editable user IDs, empty array otherwise. |
272 | 272 | */ |
273 | -function get_editable_user_ids( $user_id, $exclude_zeros = true, $post_type = 'post' ) { |
|
274 | - _deprecated_function( __FUNCTION__, '3.1', 'get_users()' ); |
|
273 | +function get_editable_user_ids($user_id, $exclude_zeros = true, $post_type = 'post') { |
|
274 | + _deprecated_function(__FUNCTION__, '3.1', 'get_users()'); |
|
275 | 275 | |
276 | 276 | global $wpdb; |
277 | 277 | |
278 | - if ( ! $user = get_userdata( $user_id ) ) |
|
278 | + if ( ! $user = get_userdata($user_id)) |
|
279 | 279 | return array(); |
280 | 280 | $post_type_obj = get_post_type_object($post_type); |
281 | 281 | |
282 | - if ( ! $user->has_cap($post_type_obj->cap->edit_others_posts) ) { |
|
283 | - if ( $user->has_cap($post_type_obj->cap->edit_posts) || ! $exclude_zeros ) |
|
282 | + if ( ! $user->has_cap($post_type_obj->cap->edit_others_posts)) { |
|
283 | + if ($user->has_cap($post_type_obj->cap->edit_posts) || ! $exclude_zeros) |
|
284 | 284 | return array($user->ID); |
285 | 285 | else |
286 | 286 | return array(); |
287 | 287 | } |
288 | 288 | |
289 | - if ( !is_multisite() ) |
|
290 | - $level_key = $wpdb->get_blog_prefix() . 'user_level'; |
|
289 | + if ( ! is_multisite()) |
|
290 | + $level_key = $wpdb->get_blog_prefix().'user_level'; |
|
291 | 291 | else |
292 | - $level_key = $wpdb->get_blog_prefix() . 'capabilities'; // wpmu site admins don't have user_levels |
|
292 | + $level_key = $wpdb->get_blog_prefix().'capabilities'; // wpmu site admins don't have user_levels |
|
293 | 293 | |
294 | 294 | $query = $wpdb->prepare("SELECT user_id FROM $wpdb->usermeta WHERE meta_key = %s", $level_key); |
295 | - if ( $exclude_zeros ) |
|
295 | + if ($exclude_zeros) |
|
296 | 296 | $query .= " AND meta_value != '0'"; |
297 | 297 | |
298 | - return $wpdb->get_col( $query ); |
|
298 | + return $wpdb->get_col($query); |
|
299 | 299 | } |
300 | 300 | |
301 | 301 | /** |
@@ -304,19 +304,19 @@ discard block |
||
304 | 304 | * @deprecated 3.1.0 Use get_users() |
305 | 305 | */ |
306 | 306 | function get_nonauthor_user_ids() { |
307 | - _deprecated_function( __FUNCTION__, '3.1', 'get_users()' ); |
|
307 | + _deprecated_function(__FUNCTION__, '3.1', 'get_users()'); |
|
308 | 308 | |
309 | 309 | global $wpdb; |
310 | 310 | |
311 | - if ( !is_multisite() ) |
|
312 | - $level_key = $wpdb->get_blog_prefix() . 'user_level'; |
|
311 | + if ( ! is_multisite()) |
|
312 | + $level_key = $wpdb->get_blog_prefix().'user_level'; |
|
313 | 313 | else |
314 | - $level_key = $wpdb->get_blog_prefix() . 'capabilities'; // wpmu site admins don't have user_levels |
|
314 | + $level_key = $wpdb->get_blog_prefix().'capabilities'; // wpmu site admins don't have user_levels |
|
315 | 315 | |
316 | - return $wpdb->get_col( $wpdb->prepare("SELECT user_id FROM $wpdb->usermeta WHERE meta_key = %s AND meta_value = '0'", $level_key) ); |
|
316 | + return $wpdb->get_col($wpdb->prepare("SELECT user_id FROM $wpdb->usermeta WHERE meta_key = %s AND meta_value = '0'", $level_key)); |
|
317 | 317 | } |
318 | 318 | |
319 | -if ( ! class_exists( 'WP_User_Search', false ) ) : |
|
319 | +if ( ! class_exists('WP_User_Search', false)) : |
|
320 | 320 | /** |
321 | 321 | * WordPress User Search class. |
322 | 322 | * |
@@ -479,12 +479,12 @@ discard block |
||
479 | 479 | * @param string $role Role name. |
480 | 480 | * @return WP_User_Search |
481 | 481 | */ |
482 | - function __construct( $search_term = '', $page = '', $role = '' ) { |
|
483 | - _deprecated_function( __FUNCTION__, '3.1', 'WP_User_Query' ); |
|
482 | + function __construct($search_term = '', $page = '', $role = '') { |
|
483 | + _deprecated_function(__FUNCTION__, '3.1', 'WP_User_Query'); |
|
484 | 484 | |
485 | - $this->search_term = wp_unslash( $search_term ); |
|
486 | - $this->raw_page = ( '' == $page ) ? false : (int) $page; |
|
487 | - $this->page = (int) ( '' == $page ) ? 1 : $page; |
|
485 | + $this->search_term = wp_unslash($search_term); |
|
486 | + $this->raw_page = ('' == $page) ? false : (int) $page; |
|
487 | + $this->page = (int) ('' == $page) ? 1 : $page; |
|
488 | 488 | $this->role = $role; |
489 | 489 | |
490 | 490 | $this->prepare_query(); |
@@ -502,8 +502,8 @@ discard block |
||
502 | 502 | * @param string $role Role name. |
503 | 503 | * @return WP_User_Search |
504 | 504 | */ |
505 | - public function WP_User_Search( $search_term = '', $page = '', $role = '' ) { |
|
506 | - self::__construct( $search_term, $page, $role ); |
|
505 | + public function WP_User_Search($search_term = '', $page = '', $role = '') { |
|
506 | + self::__construct($search_term, $page, $role); |
|
507 | 507 | } |
508 | 508 | |
509 | 509 | /** |
@@ -520,11 +520,11 @@ discard block |
||
520 | 520 | $this->query_orderby = ' ORDER BY user_login'; |
521 | 521 | |
522 | 522 | $search_sql = ''; |
523 | - if ( $this->search_term ) { |
|
523 | + if ($this->search_term) { |
|
524 | 524 | $searches = array(); |
525 | 525 | $search_sql = 'AND ('; |
526 | - foreach ( array('user_login', 'user_nicename', 'user_email', 'user_url', 'display_name') as $col ) |
|
527 | - $searches[] = $wpdb->prepare( $col . ' LIKE %s', '%' . like_escape($this->search_term) . '%' ); |
|
526 | + foreach (array('user_login', 'user_nicename', 'user_email', 'user_url', 'display_name') as $col) |
|
527 | + $searches[] = $wpdb->prepare($col.' LIKE %s', '%'.like_escape($this->search_term).'%'); |
|
528 | 528 | $search_sql .= implode(' OR ', $searches); |
529 | 529 | $search_sql .= ')'; |
530 | 530 | } |
@@ -532,16 +532,16 @@ discard block |
||
532 | 532 | $this->query_from = " FROM $wpdb->users"; |
533 | 533 | $this->query_where = " WHERE 1=1 $search_sql"; |
534 | 534 | |
535 | - if ( $this->role ) { |
|
535 | + if ($this->role) { |
|
536 | 536 | $this->query_from .= " INNER JOIN $wpdb->usermeta ON $wpdb->users.ID = $wpdb->usermeta.user_id"; |
537 | - $this->query_where .= $wpdb->prepare(" AND $wpdb->usermeta.meta_key = '{$wpdb->prefix}capabilities' AND $wpdb->usermeta.meta_value LIKE %s", '%' . $this->role . '%'); |
|
538 | - } elseif ( is_multisite() ) { |
|
539 | - $level_key = $wpdb->prefix . 'capabilities'; // wpmu site admins don't have user_levels |
|
537 | + $this->query_where .= $wpdb->prepare(" AND $wpdb->usermeta.meta_key = '{$wpdb->prefix}capabilities' AND $wpdb->usermeta.meta_value LIKE %s", '%'.$this->role.'%'); |
|
538 | + } elseif (is_multisite()) { |
|
539 | + $level_key = $wpdb->prefix.'capabilities'; // wpmu site admins don't have user_levels |
|
540 | 540 | $this->query_from .= ", $wpdb->usermeta"; |
541 | 541 | $this->query_where .= " AND $wpdb->users.ID = $wpdb->usermeta.user_id AND meta_key = '{$level_key}'"; |
542 | 542 | } |
543 | 543 | |
544 | - do_action_ref_array( 'pre_user_search', array( &$this ) ); |
|
544 | + do_action_ref_array('pre_user_search', array(&$this)); |
|
545 | 545 | } |
546 | 546 | |
547 | 547 | /** |
@@ -553,10 +553,10 @@ discard block |
||
553 | 553 | public function query() { |
554 | 554 | global $wpdb; |
555 | 555 | |
556 | - $this->results = $wpdb->get_col("SELECT DISTINCT($wpdb->users.ID)" . $this->query_from . $this->query_where . $this->query_orderby . $this->query_limit); |
|
556 | + $this->results = $wpdb->get_col("SELECT DISTINCT($wpdb->users.ID)".$this->query_from.$this->query_where.$this->query_orderby.$this->query_limit); |
|
557 | 557 | |
558 | - if ( $this->results ) |
|
559 | - $this->total_users_for_query = $wpdb->get_var("SELECT COUNT(DISTINCT($wpdb->users.ID))" . $this->query_from . $this->query_where); // no limit |
|
558 | + if ($this->results) |
|
559 | + $this->total_users_for_query = $wpdb->get_var("SELECT COUNT(DISTINCT($wpdb->users.ID))".$this->query_from.$this->query_where); // no limit |
|
560 | 560 | else |
561 | 561 | $this->search_errors = new WP_Error('no_matching_users_found', __('No users found.')); |
562 | 562 | } |
@@ -576,25 +576,25 @@ discard block |
||
576 | 576 | * @access public |
577 | 577 | */ |
578 | 578 | public function do_paging() { |
579 | - if ( $this->total_users_for_query > $this->users_per_page ) { // have to page the results |
|
579 | + if ($this->total_users_for_query > $this->users_per_page) { // have to page the results |
|
580 | 580 | $args = array(); |
581 | - if ( ! empty($this->search_term) ) |
|
581 | + if ( ! empty($this->search_term)) |
|
582 | 582 | $args['usersearch'] = urlencode($this->search_term); |
583 | - if ( ! empty($this->role) ) |
|
583 | + if ( ! empty($this->role)) |
|
584 | 584 | $args['role'] = urlencode($this->role); |
585 | 585 | |
586 | - $this->paging_text = paginate_links( array( |
|
586 | + $this->paging_text = paginate_links(array( |
|
587 | 587 | 'total' => ceil($this->total_users_for_query / $this->users_per_page), |
588 | 588 | 'current' => $this->page, |
589 | 589 | 'base' => 'users.php?%_%', |
590 | 590 | 'format' => 'userspage=%#%', |
591 | 591 | 'add_args' => $args |
592 | - ) ); |
|
593 | - if ( $this->paging_text ) { |
|
594 | - $this->paging_text = sprintf( '<span class="displaying-num">' . __( 'Displaying %s–%s of %s' ) . '</span>%s', |
|
595 | - number_format_i18n( ( $this->page - 1 ) * $this->users_per_page + 1 ), |
|
596 | - number_format_i18n( min( $this->page * $this->users_per_page, $this->total_users_for_query ) ), |
|
597 | - number_format_i18n( $this->total_users_for_query ), |
|
592 | + )); |
|
593 | + if ($this->paging_text) { |
|
594 | + $this->paging_text = sprintf('<span class="displaying-num">'.__('Displaying %s–%s of %s').'</span>%s', |
|
595 | + number_format_i18n(($this->page - 1) * $this->users_per_page + 1), |
|
596 | + number_format_i18n(min($this->page * $this->users_per_page, $this->total_users_for_query)), |
|
597 | + number_format_i18n($this->total_users_for_query), |
|
598 | 598 | $this->paging_text |
599 | 599 | ); |
600 | 600 | } |
@@ -636,7 +636,7 @@ discard block |
||
636 | 636 | * @return bool |
637 | 637 | */ |
638 | 638 | function results_are_paged() { |
639 | - if ( $this->paging_text ) |
|
639 | + if ($this->paging_text) |
|
640 | 640 | return true; |
641 | 641 | return false; |
642 | 642 | } |
@@ -650,7 +650,7 @@ discard block |
||
650 | 650 | * @return bool |
651 | 651 | */ |
652 | 652 | function is_search() { |
653 | - if ( $this->search_term ) |
|
653 | + if ($this->search_term) |
|
654 | 654 | return true; |
655 | 655 | return false; |
656 | 656 | } |
@@ -669,25 +669,25 @@ discard block |
||
669 | 669 | * Default 'any'. |
670 | 670 | * @return array List of posts from others. |
671 | 671 | */ |
672 | -function get_others_unpublished_posts( $user_id, $type = 'any' ) { |
|
673 | - _deprecated_function( __FUNCTION__, '3.1' ); |
|
672 | +function get_others_unpublished_posts($user_id, $type = 'any') { |
|
673 | + _deprecated_function(__FUNCTION__, '3.1'); |
|
674 | 674 | |
675 | 675 | global $wpdb; |
676 | 676 | |
677 | - $editable = get_editable_user_ids( $user_id ); |
|
677 | + $editable = get_editable_user_ids($user_id); |
|
678 | 678 | |
679 | - if ( in_array($type, array('draft', 'pending')) ) |
|
679 | + if (in_array($type, array('draft', 'pending'))) |
|
680 | 680 | $type_sql = " post_status = '$type' "; |
681 | 681 | else |
682 | 682 | $type_sql = " ( post_status = 'draft' OR post_status = 'pending' ) "; |
683 | 683 | |
684 | - $dir = ( 'pending' == $type ) ? 'ASC' : 'DESC'; |
|
684 | + $dir = ('pending' == $type) ? 'ASC' : 'DESC'; |
|
685 | 685 | |
686 | - if ( !$editable ) { |
|
686 | + if ( ! $editable) { |
|
687 | 687 | $other_unpubs = ''; |
688 | 688 | } else { |
689 | 689 | $editable = join(',', $editable); |
690 | - $other_unpubs = $wpdb->get_results( $wpdb->prepare("SELECT ID, post_title, post_author FROM $wpdb->posts WHERE post_type = 'post' AND $type_sql AND post_author IN ($editable) AND post_author != %d ORDER BY post_modified $dir", $user_id) ); |
|
690 | + $other_unpubs = $wpdb->get_results($wpdb->prepare("SELECT ID, post_title, post_author FROM $wpdb->posts WHERE post_type = 'post' AND $type_sql AND post_author IN ($editable) AND post_author != %d ORDER BY post_modified $dir", $user_id)); |
|
691 | 691 | } |
692 | 692 | |
693 | 693 | return apply_filters('get_others_drafts', $other_unpubs); |
@@ -703,7 +703,7 @@ discard block |
||
703 | 703 | * @return array List of drafts from other users. |
704 | 704 | */ |
705 | 705 | function get_others_drafts($user_id) { |
706 | - _deprecated_function( __FUNCTION__, '3.1' ); |
|
706 | + _deprecated_function(__FUNCTION__, '3.1'); |
|
707 | 707 | |
708 | 708 | return get_others_unpublished_posts($user_id, 'draft'); |
709 | 709 | } |
@@ -718,7 +718,7 @@ discard block |
||
718 | 718 | * @return array List of posts with pending review post type from other users. |
719 | 719 | */ |
720 | 720 | function get_others_pending($user_id) { |
721 | - _deprecated_function( __FUNCTION__, '3.1' ); |
|
721 | + _deprecated_function(__FUNCTION__, '3.1'); |
|
722 | 722 | |
723 | 723 | return get_others_unpublished_posts($user_id, 'pending'); |
724 | 724 | } |
@@ -731,7 +731,7 @@ discard block |
||
731 | 731 | * @see wp_dashboard_quick_press() |
732 | 732 | */ |
733 | 733 | function wp_dashboard_quick_press_output() { |
734 | - _deprecated_function( __FUNCTION__, '3.2', 'wp_dashboard_quick_press()' ); |
|
734 | + _deprecated_function(__FUNCTION__, '3.2', 'wp_dashboard_quick_press()'); |
|
735 | 735 | wp_dashboard_quick_press(); |
736 | 736 | } |
737 | 737 | |
@@ -744,15 +744,15 @@ discard block |
||
744 | 744 | * |
745 | 745 | * @staticvar int $num |
746 | 746 | */ |
747 | -function wp_tiny_mce( $teeny = false, $settings = false ) { |
|
748 | - _deprecated_function( __FUNCTION__, '3.3', 'wp_editor()' ); |
|
747 | +function wp_tiny_mce($teeny = false, $settings = false) { |
|
748 | + _deprecated_function(__FUNCTION__, '3.3', 'wp_editor()'); |
|
749 | 749 | |
750 | 750 | static $num = 1; |
751 | 751 | |
752 | - if ( ! class_exists( '_WP_Editors', false ) ) |
|
753 | - require_once( ABSPATH . WPINC . '/class-wp-editor.php' ); |
|
752 | + if ( ! class_exists('_WP_Editors', false)) |
|
753 | + require_once(ABSPATH.WPINC.'/class-wp-editor.php'); |
|
754 | 754 | |
755 | - $editor_id = 'content' . $num++; |
|
755 | + $editor_id = 'content'.$num++; |
|
756 | 756 | |
757 | 757 | $set = array( |
758 | 758 | 'teeny' => $teeny, |
@@ -771,7 +771,7 @@ discard block |
||
771 | 771 | * @see wp_editor() |
772 | 772 | */ |
773 | 773 | function wp_preload_dialogs() { |
774 | - _deprecated_function( __FUNCTION__, '3.3', 'wp_editor()' ); |
|
774 | + _deprecated_function(__FUNCTION__, '3.3', 'wp_editor()'); |
|
775 | 775 | } |
776 | 776 | |
777 | 777 | /** |
@@ -781,7 +781,7 @@ discard block |
||
781 | 781 | * @see wp_editor() |
782 | 782 | */ |
783 | 783 | function wp_print_editor_js() { |
784 | - _deprecated_function( __FUNCTION__, '3.3', 'wp_editor()' ); |
|
784 | + _deprecated_function(__FUNCTION__, '3.3', 'wp_editor()'); |
|
785 | 785 | } |
786 | 786 | |
787 | 787 | /** |
@@ -791,7 +791,7 @@ discard block |
||
791 | 791 | * @see wp_editor() |
792 | 792 | */ |
793 | 793 | function wp_quicktags() { |
794 | - _deprecated_function( __FUNCTION__, '3.3', 'wp_editor()' ); |
|
794 | + _deprecated_function(__FUNCTION__, '3.3', 'wp_editor()'); |
|
795 | 795 | } |
796 | 796 | |
797 | 797 | /** |
@@ -801,12 +801,12 @@ discard block |
||
801 | 801 | * @deprecated 3.3.0 WP_Screen::render_screen_layout() |
802 | 802 | * @see WP_Screen::render_screen_layout() |
803 | 803 | */ |
804 | -function screen_layout( $screen ) { |
|
805 | - _deprecated_function( __FUNCTION__, '3.3', '$current_screen->render_screen_layout()' ); |
|
804 | +function screen_layout($screen) { |
|
805 | + _deprecated_function(__FUNCTION__, '3.3', '$current_screen->render_screen_layout()'); |
|
806 | 806 | |
807 | 807 | $current_screen = get_current_screen(); |
808 | 808 | |
809 | - if ( ! $current_screen ) |
|
809 | + if ( ! $current_screen) |
|
810 | 810 | return ''; |
811 | 811 | |
812 | 812 | ob_start(); |
@@ -821,12 +821,12 @@ discard block |
||
821 | 821 | * @deprecated 3.3.0 Use WP_Screen::render_per_page_options() |
822 | 822 | * @see WP_Screen::render_per_page_options() |
823 | 823 | */ |
824 | -function screen_options( $screen ) { |
|
825 | - _deprecated_function( __FUNCTION__, '3.3', '$current_screen->render_per_page_options()' ); |
|
824 | +function screen_options($screen) { |
|
825 | + _deprecated_function(__FUNCTION__, '3.3', '$current_screen->render_per_page_options()'); |
|
826 | 826 | |
827 | 827 | $current_screen = get_current_screen(); |
828 | 828 | |
829 | - if ( ! $current_screen ) |
|
829 | + if ( ! $current_screen) |
|
830 | 830 | return ''; |
831 | 831 | |
832 | 832 | ob_start(); |
@@ -841,7 +841,7 @@ discard block |
||
841 | 841 | * @deprecated 3.3.0 Use WP_Screen::render_screen_meta() |
842 | 842 | * @see WP_Screen::render_screen_meta() |
843 | 843 | */ |
844 | -function screen_meta( $screen ) { |
|
844 | +function screen_meta($screen) { |
|
845 | 845 | $current_screen = get_current_screen(); |
846 | 846 | $current_screen->render_screen_meta(); |
847 | 847 | } |
@@ -854,7 +854,7 @@ discard block |
||
854 | 854 | * @see WP_Admin_Bar |
855 | 855 | */ |
856 | 856 | function favorite_actions() { |
857 | - _deprecated_function( __FUNCTION__, '3.2', 'WP_Admin_Bar' ); |
|
857 | + _deprecated_function(__FUNCTION__, '3.2', 'WP_Admin_Bar'); |
|
858 | 858 | } |
859 | 859 | |
860 | 860 | /** |
@@ -866,7 +866,7 @@ discard block |
||
866 | 866 | * @return null|string |
867 | 867 | */ |
868 | 868 | function media_upload_image() { |
869 | - _deprecated_function( __FUNCTION__, '3.3', 'wp_media_upload_handler()' ); |
|
869 | + _deprecated_function(__FUNCTION__, '3.3', 'wp_media_upload_handler()'); |
|
870 | 870 | return wp_media_upload_handler(); |
871 | 871 | } |
872 | 872 | |
@@ -879,7 +879,7 @@ discard block |
||
879 | 879 | * @return null|string |
880 | 880 | */ |
881 | 881 | function media_upload_audio() { |
882 | - _deprecated_function( __FUNCTION__, '3.3', 'wp_media_upload_handler()' ); |
|
882 | + _deprecated_function(__FUNCTION__, '3.3', 'wp_media_upload_handler()'); |
|
883 | 883 | return wp_media_upload_handler(); |
884 | 884 | } |
885 | 885 | |
@@ -892,7 +892,7 @@ discard block |
||
892 | 892 | * @return null|string |
893 | 893 | */ |
894 | 894 | function media_upload_video() { |
895 | - _deprecated_function( __FUNCTION__, '3.3', 'wp_media_upload_handler()' ); |
|
895 | + _deprecated_function(__FUNCTION__, '3.3', 'wp_media_upload_handler()'); |
|
896 | 896 | return wp_media_upload_handler(); |
897 | 897 | } |
898 | 898 | |
@@ -905,7 +905,7 @@ discard block |
||
905 | 905 | * @return null|string |
906 | 906 | */ |
907 | 907 | function media_upload_file() { |
908 | - _deprecated_function( __FUNCTION__, '3.3', 'wp_media_upload_handler()' ); |
|
908 | + _deprecated_function(__FUNCTION__, '3.3', 'wp_media_upload_handler()'); |
|
909 | 909 | return wp_media_upload_handler(); |
910 | 910 | } |
911 | 911 | |
@@ -918,8 +918,8 @@ discard block |
||
918 | 918 | * @return string |
919 | 919 | */ |
920 | 920 | function type_url_form_image() { |
921 | - _deprecated_function( __FUNCTION__, '3.3', "wp_media_insert_url_form('image')" ); |
|
922 | - return wp_media_insert_url_form( 'image' ); |
|
921 | + _deprecated_function(__FUNCTION__, '3.3', "wp_media_insert_url_form('image')"); |
|
922 | + return wp_media_insert_url_form('image'); |
|
923 | 923 | } |
924 | 924 | |
925 | 925 | /** |
@@ -931,8 +931,8 @@ discard block |
||
931 | 931 | * @return string |
932 | 932 | */ |
933 | 933 | function type_url_form_audio() { |
934 | - _deprecated_function( __FUNCTION__, '3.3', "wp_media_insert_url_form('audio')" ); |
|
935 | - return wp_media_insert_url_form( 'audio' ); |
|
934 | + _deprecated_function(__FUNCTION__, '3.3', "wp_media_insert_url_form('audio')"); |
|
935 | + return wp_media_insert_url_form('audio'); |
|
936 | 936 | } |
937 | 937 | |
938 | 938 | /** |
@@ -944,8 +944,8 @@ discard block |
||
944 | 944 | * @return string |
945 | 945 | */ |
946 | 946 | function type_url_form_video() { |
947 | - _deprecated_function( __FUNCTION__, '3.3', "wp_media_insert_url_form('video')" ); |
|
948 | - return wp_media_insert_url_form( 'video' ); |
|
947 | + _deprecated_function(__FUNCTION__, '3.3', "wp_media_insert_url_form('video')"); |
|
948 | + return wp_media_insert_url_form('video'); |
|
949 | 949 | } |
950 | 950 | |
951 | 951 | /** |
@@ -957,8 +957,8 @@ discard block |
||
957 | 957 | * @return string |
958 | 958 | */ |
959 | 959 | function type_url_form_file() { |
960 | - _deprecated_function( __FUNCTION__, '3.3', "wp_media_insert_url_form('file')" ); |
|
961 | - return wp_media_insert_url_form( 'file' ); |
|
960 | + _deprecated_function(__FUNCTION__, '3.3', "wp_media_insert_url_form('file')"); |
|
961 | + return wp_media_insert_url_form('file'); |
|
962 | 962 | } |
963 | 963 | |
964 | 964 | /** |
@@ -973,13 +973,13 @@ discard block |
||
973 | 973 | * @param string $screen The handle for the screen to add help to. This is usually the hook name returned by the add_*_page() functions. |
974 | 974 | * @param string $help The content of an 'Overview' help tab. |
975 | 975 | */ |
976 | -function add_contextual_help( $screen, $help ) { |
|
977 | - _deprecated_function( __FUNCTION__, '3.3', 'get_current_screen()->add_help_tab()' ); |
|
976 | +function add_contextual_help($screen, $help) { |
|
977 | + _deprecated_function(__FUNCTION__, '3.3', 'get_current_screen()->add_help_tab()'); |
|
978 | 978 | |
979 | - if ( is_string( $screen ) ) |
|
980 | - $screen = convert_to_screen( $screen ); |
|
979 | + if (is_string($screen)) |
|
980 | + $screen = convert_to_screen($screen); |
|
981 | 981 | |
982 | - WP_Screen::add_old_compat_help( $screen, $help ); |
|
982 | + WP_Screen::add_old_compat_help($screen, $help); |
|
983 | 983 | } |
984 | 984 | |
985 | 985 | /** |
@@ -992,13 +992,13 @@ discard block |
||
992 | 992 | * @return array $themes Array of allowed themes. |
993 | 993 | */ |
994 | 994 | function get_allowed_themes() { |
995 | - _deprecated_function( __FUNCTION__, '3.4', "wp_get_themes( array( 'allowed' => true ) )" ); |
|
995 | + _deprecated_function(__FUNCTION__, '3.4', "wp_get_themes( array( 'allowed' => true ) )"); |
|
996 | 996 | |
997 | - $themes = wp_get_themes( array( 'allowed' => true ) ); |
|
997 | + $themes = wp_get_themes(array('allowed' => true)); |
|
998 | 998 | |
999 | 999 | $wp_themes = array(); |
1000 | - foreach ( $themes as $theme ) { |
|
1001 | - $wp_themes[ $theme->get('Name') ] = $theme; |
|
1000 | + foreach ($themes as $theme) { |
|
1001 | + $wp_themes[$theme->get('Name')] = $theme; |
|
1002 | 1002 | } |
1003 | 1003 | |
1004 | 1004 | return $wp_themes; |
@@ -1014,13 +1014,13 @@ discard block |
||
1014 | 1014 | * @return array |
1015 | 1015 | */ |
1016 | 1016 | function get_broken_themes() { |
1017 | - _deprecated_function( __FUNCTION__, '3.4', "wp_get_themes( array( 'errors' => true )" ); |
|
1017 | + _deprecated_function(__FUNCTION__, '3.4', "wp_get_themes( array( 'errors' => true )"); |
|
1018 | 1018 | |
1019 | - $themes = wp_get_themes( array( 'errors' => true ) ); |
|
1019 | + $themes = wp_get_themes(array('errors' => true)); |
|
1020 | 1020 | $broken = array(); |
1021 | - foreach ( $themes as $theme ) { |
|
1021 | + foreach ($themes as $theme) { |
|
1022 | 1022 | $name = $theme->get('Name'); |
1023 | - $broken[ $name ] = array( |
|
1023 | + $broken[$name] = array( |
|
1024 | 1024 | 'Name' => $name, |
1025 | 1025 | 'Title' => $name, |
1026 | 1026 | 'Description' => $theme->errors()->get_error_message(), |
@@ -1039,7 +1039,7 @@ discard block |
||
1039 | 1039 | * @return WP_Theme |
1040 | 1040 | */ |
1041 | 1041 | function current_theme_info() { |
1042 | - _deprecated_function( __FUNCTION__, '3.4', 'wp_get_theme()' ); |
|
1042 | + _deprecated_function(__FUNCTION__, '3.4', 'wp_get_theme()'); |
|
1043 | 1043 | |
1044 | 1044 | return wp_get_theme(); |
1045 | 1045 | } |
@@ -1051,8 +1051,8 @@ discard block |
||
1051 | 1051 | * |
1052 | 1052 | * @deprecated 3.5.0 |
1053 | 1053 | */ |
1054 | -function _insert_into_post_button( $type ) { |
|
1055 | - _deprecated_function( __FUNCTION__, '3.5' ); |
|
1054 | +function _insert_into_post_button($type) { |
|
1055 | + _deprecated_function(__FUNCTION__, '3.5'); |
|
1056 | 1056 | } |
1057 | 1057 | |
1058 | 1058 | /** |
@@ -1063,7 +1063,7 @@ discard block |
||
1063 | 1063 | * @deprecated 3.5.0 |
1064 | 1064 | */ |
1065 | 1065 | function _media_button($title, $icon, $type, $id) { |
1066 | - _deprecated_function( __FUNCTION__, '3.5' ); |
|
1066 | + _deprecated_function(__FUNCTION__, '3.5'); |
|
1067 | 1067 | } |
1068 | 1068 | |
1069 | 1069 | /** |
@@ -1076,10 +1076,10 @@ discard block |
||
1076 | 1076 | * @param int $id |
1077 | 1077 | * @return object |
1078 | 1078 | */ |
1079 | -function get_post_to_edit( $id ) { |
|
1080 | - _deprecated_function( __FUNCTION__, '3.5', 'get_post()' ); |
|
1079 | +function get_post_to_edit($id) { |
|
1080 | + _deprecated_function(__FUNCTION__, '3.5', 'get_post()'); |
|
1081 | 1081 | |
1082 | - return get_post( $id, OBJECT, 'edit' ); |
|
1082 | + return get_post($id, OBJECT, 'edit'); |
|
1083 | 1083 | } |
1084 | 1084 | |
1085 | 1085 | /** |
@@ -1092,7 +1092,7 @@ discard block |
||
1092 | 1092 | * @return WP_Post Post object containing all the default post data as attributes |
1093 | 1093 | */ |
1094 | 1094 | function get_default_page_to_edit() { |
1095 | - _deprecated_function( __FUNCTION__, '3.5', "get_default_post_to_edit( 'page' )" ); |
|
1095 | + _deprecated_function(__FUNCTION__, '3.5', "get_default_post_to_edit( 'page' )"); |
|
1096 | 1096 | |
1097 | 1097 | $page = get_default_post_to_edit(); |
1098 | 1098 | $page->post_type = 'page'; |
@@ -1111,9 +1111,9 @@ discard block |
||
1111 | 1111 | * @param mixed $deprecated Never used. |
1112 | 1112 | * @return string Thumbnail path on success, Error string on failure. |
1113 | 1113 | */ |
1114 | -function wp_create_thumbnail( $file, $max_side, $deprecated = '' ) { |
|
1115 | - _deprecated_function( __FUNCTION__, '3.5', 'image_resize()' ); |
|
1116 | - return apply_filters( 'wp_create_thumbnail', image_resize( $file, $max_side, $max_side ) ); |
|
1114 | +function wp_create_thumbnail($file, $max_side, $deprecated = '') { |
|
1115 | + _deprecated_function(__FUNCTION__, '3.5', 'image_resize()'); |
|
1116 | + return apply_filters('wp_create_thumbnail', image_resize($file, $max_side, $max_side)); |
|
1117 | 1117 | } |
1118 | 1118 | |
1119 | 1119 | /** |
@@ -1125,7 +1125,7 @@ discard block |
||
1125 | 1125 | * @deprecated 3.6.0 |
1126 | 1126 | */ |
1127 | 1127 | function wp_nav_menu_locations_meta_box() { |
1128 | - _deprecated_function( __FUNCTION__, '3.6' ); |
|
1128 | + _deprecated_function(__FUNCTION__, '3.6'); |
|
1129 | 1129 | } |
1130 | 1130 | |
1131 | 1131 | /** |
@@ -1139,12 +1139,12 @@ discard block |
||
1139 | 1139 | * @see Core_Upgrader |
1140 | 1140 | */ |
1141 | 1141 | function wp_update_core($current, $feedback = '') { |
1142 | - _deprecated_function( __FUNCTION__, '3.7', 'new Core_Upgrader();' ); |
|
1142 | + _deprecated_function(__FUNCTION__, '3.7', 'new Core_Upgrader();'); |
|
1143 | 1143 | |
1144 | - if ( !empty($feedback) ) |
|
1144 | + if ( ! empty($feedback)) |
|
1145 | 1145 | add_filter('update_feedback', $feedback); |
1146 | 1146 | |
1147 | - include( ABSPATH . 'wp-admin/includes/class-wp-upgrader.php' ); |
|
1147 | + include(ABSPATH.'wp-admin/includes/class-wp-upgrader.php'); |
|
1148 | 1148 | $upgrader = new Core_Upgrader(); |
1149 | 1149 | return $upgrader->upgrade($current); |
1150 | 1150 | |
@@ -1162,12 +1162,12 @@ discard block |
||
1162 | 1162 | * @see Plugin_Upgrader |
1163 | 1163 | */ |
1164 | 1164 | function wp_update_plugin($plugin, $feedback = '') { |
1165 | - _deprecated_function( __FUNCTION__, '3.7', 'new Plugin_Upgrader();' ); |
|
1165 | + _deprecated_function(__FUNCTION__, '3.7', 'new Plugin_Upgrader();'); |
|
1166 | 1166 | |
1167 | - if ( !empty($feedback) ) |
|
1167 | + if ( ! empty($feedback)) |
|
1168 | 1168 | add_filter('update_feedback', $feedback); |
1169 | 1169 | |
1170 | - include( ABSPATH . 'wp-admin/includes/class-wp-upgrader.php' ); |
|
1170 | + include(ABSPATH.'wp-admin/includes/class-wp-upgrader.php'); |
|
1171 | 1171 | $upgrader = new Plugin_Upgrader(); |
1172 | 1172 | return $upgrader->upgrade($plugin); |
1173 | 1173 | } |
@@ -1184,12 +1184,12 @@ discard block |
||
1184 | 1184 | * @see Theme_Upgrader |
1185 | 1185 | */ |
1186 | 1186 | function wp_update_theme($theme, $feedback = '') { |
1187 | - _deprecated_function( __FUNCTION__, '3.7', 'new Theme_Upgrader();' ); |
|
1187 | + _deprecated_function(__FUNCTION__, '3.7', 'new Theme_Upgrader();'); |
|
1188 | 1188 | |
1189 | - if ( !empty($feedback) ) |
|
1189 | + if ( ! empty($feedback)) |
|
1190 | 1190 | add_filter('update_feedback', $feedback); |
1191 | 1191 | |
1192 | - include( ABSPATH . 'wp-admin/includes/class-wp-upgrader.php' ); |
|
1192 | + include(ABSPATH.'wp-admin/includes/class-wp-upgrader.php'); |
|
1193 | 1193 | $upgrader = new Theme_Upgrader(); |
1194 | 1194 | return $upgrader->upgrade($theme); |
1195 | 1195 | } |
@@ -1202,8 +1202,8 @@ discard block |
||
1202 | 1202 | * |
1203 | 1203 | * @param int|bool $id |
1204 | 1204 | */ |
1205 | -function the_attachment_links( $id = false ) { |
|
1206 | - _deprecated_function( __FUNCTION__, '3.7' ); |
|
1205 | +function the_attachment_links($id = false) { |
|
1206 | + _deprecated_function(__FUNCTION__, '3.7'); |
|
1207 | 1207 | } |
1208 | 1208 | |
1209 | 1209 | /** |
@@ -1304,8 +1304,8 @@ discard block |
||
1304 | 1304 | * @param int $old_ID |
1305 | 1305 | * @param int $new_ID |
1306 | 1306 | */ |
1307 | -function _relocate_children( $old_ID, $new_ID ) { |
|
1308 | - _deprecated_function( __FUNCTION__, '3.9' ); |
|
1307 | +function _relocate_children($old_ID, $new_ID) { |
|
1308 | + _deprecated_function(__FUNCTION__, '3.9'); |
|
1309 | 1309 | } |
1310 | 1310 | |
1311 | 1311 | /** |
@@ -1331,8 +1331,8 @@ discard block |
||
1331 | 1331 | * @param string $icon_url The url to the icon to be used for this menu. |
1332 | 1332 | * @return string The resulting page's hook_suffix. |
1333 | 1333 | */ |
1334 | -function add_object_page( $page_title, $menu_title, $capability, $menu_slug, $function = '', $icon_url = '') { |
|
1335 | - _deprecated_function( __FUNCTION__, '4.5', 'add_menu_page()' ); |
|
1334 | +function add_object_page($page_title, $menu_title, $capability, $menu_slug, $function = '', $icon_url = '') { |
|
1335 | + _deprecated_function(__FUNCTION__, '4.5', 'add_menu_page()'); |
|
1336 | 1336 | |
1337 | 1337 | global $_wp_last_object_menu; |
1338 | 1338 | |
@@ -1364,8 +1364,8 @@ discard block |
||
1364 | 1364 | * @param string $icon_url The url to the icon to be used for this menu. |
1365 | 1365 | * @return string The resulting page's hook_suffix. |
1366 | 1366 | */ |
1367 | -function add_utility_page( $page_title, $menu_title, $capability, $menu_slug, $function = '', $icon_url = '') { |
|
1368 | - _deprecated_function( __FUNCTION__, '4.5', 'add_menu_page()' ); |
|
1367 | +function add_utility_page($page_title, $menu_title, $capability, $menu_slug, $function = '', $icon_url = '') { |
|
1368 | + _deprecated_function(__FUNCTION__, '4.5', 'add_menu_page()'); |
|
1369 | 1369 | |
1370 | 1370 | global $_wp_last_utility_menu; |
1371 | 1371 |
@@ -132,8 +132,9 @@ discard block |
||
132 | 132 | */ |
133 | 133 | function wp_dropdown_cats( $currentcat = 0, $currentparent = 0, $parent = 0, $level = 0, $categories = 0 ) { |
134 | 134 | _deprecated_function( __FUNCTION__, '3.0', 'wp_dropdown_categories()' ); |
135 | - if (!$categories ) |
|
136 | - $categories = get_categories( array('hide_empty' => 0) ); |
|
135 | + if (!$categories ) { |
|
136 | + $categories = get_categories( array('hide_empty' => 0) ); |
|
137 | + } |
|
137 | 138 | |
138 | 139 | if ( $categories ) { |
139 | 140 | foreach ( $categories as $category ) { |
@@ -141,8 +142,9 @@ discard block |
||
141 | 142 | $pad = str_repeat( '– ', $level ); |
142 | 143 | $category->name = esc_html( $category->name ); |
143 | 144 | echo "\n\t<option value='$category->term_id'"; |
144 | - if ( $currentparent == $category->term_id ) |
|
145 | - echo " selected='selected'"; |
|
145 | + if ( $currentparent == $category->term_id ) { |
|
146 | + echo " selected='selected'"; |
|
147 | + } |
|
146 | 148 | echo ">$pad$category->name</option>"; |
147 | 149 | wp_dropdown_cats( $currentcat, $currentparent, $category->term_id, $level +1, $categories ); |
148 | 150 | } |
@@ -228,10 +230,12 @@ discard block |
||
228 | 230 | _deprecated_function( __FUNCTION__, '3.1', 'get_users()' ); |
229 | 231 | |
230 | 232 | global $wpdb; |
231 | - if ( !is_multisite() ) |
|
232 | - $level_key = $wpdb->get_blog_prefix() . 'user_level'; |
|
233 | - else |
|
234 | - $level_key = $wpdb->get_blog_prefix() . 'capabilities'; // wpmu site admins don't have user_levels |
|
233 | + if ( !is_multisite() ) { |
|
234 | + $level_key = $wpdb->get_blog_prefix() . 'user_level'; |
|
235 | + } else { |
|
236 | + $level_key = $wpdb->get_blog_prefix() . 'capabilities'; |
|
237 | + } |
|
238 | + // wpmu site admins don't have user_levels |
|
235 | 239 | |
236 | 240 | return $wpdb->get_col( $wpdb->prepare("SELECT user_id FROM $wpdb->usermeta WHERE meta_key = %s AND meta_value != '0'", $level_key) ); |
237 | 241 | } |
@@ -275,25 +279,30 @@ discard block |
||
275 | 279 | |
276 | 280 | global $wpdb; |
277 | 281 | |
278 | - if ( ! $user = get_userdata( $user_id ) ) |
|
279 | - return array(); |
|
282 | + if ( ! $user = get_userdata( $user_id ) ) { |
|
283 | + return array(); |
|
284 | + } |
|
280 | 285 | $post_type_obj = get_post_type_object($post_type); |
281 | 286 | |
282 | 287 | if ( ! $user->has_cap($post_type_obj->cap->edit_others_posts) ) { |
283 | - if ( $user->has_cap($post_type_obj->cap->edit_posts) || ! $exclude_zeros ) |
|
284 | - return array($user->ID); |
|
285 | - else |
|
286 | - return array(); |
|
288 | + if ( $user->has_cap($post_type_obj->cap->edit_posts) || ! $exclude_zeros ) { |
|
289 | + return array($user->ID); |
|
290 | + } else { |
|
291 | + return array(); |
|
292 | + } |
|
287 | 293 | } |
288 | 294 | |
289 | - if ( !is_multisite() ) |
|
290 | - $level_key = $wpdb->get_blog_prefix() . 'user_level'; |
|
291 | - else |
|
292 | - $level_key = $wpdb->get_blog_prefix() . 'capabilities'; // wpmu site admins don't have user_levels |
|
295 | + if ( !is_multisite() ) { |
|
296 | + $level_key = $wpdb->get_blog_prefix() . 'user_level'; |
|
297 | + } else { |
|
298 | + $level_key = $wpdb->get_blog_prefix() . 'capabilities'; |
|
299 | + } |
|
300 | + // wpmu site admins don't have user_levels |
|
293 | 301 | |
294 | 302 | $query = $wpdb->prepare("SELECT user_id FROM $wpdb->usermeta WHERE meta_key = %s", $level_key); |
295 | - if ( $exclude_zeros ) |
|
296 | - $query .= " AND meta_value != '0'"; |
|
303 | + if ( $exclude_zeros ) { |
|
304 | + $query .= " AND meta_value != '0'"; |
|
305 | + } |
|
297 | 306 | |
298 | 307 | return $wpdb->get_col( $query ); |
299 | 308 | } |
@@ -308,10 +317,12 @@ discard block |
||
308 | 317 | |
309 | 318 | global $wpdb; |
310 | 319 | |
311 | - if ( !is_multisite() ) |
|
312 | - $level_key = $wpdb->get_blog_prefix() . 'user_level'; |
|
313 | - else |
|
314 | - $level_key = $wpdb->get_blog_prefix() . 'capabilities'; // wpmu site admins don't have user_levels |
|
320 | + if ( !is_multisite() ) { |
|
321 | + $level_key = $wpdb->get_blog_prefix() . 'user_level'; |
|
322 | + } else { |
|
323 | + $level_key = $wpdb->get_blog_prefix() . 'capabilities'; |
|
324 | + } |
|
325 | + // wpmu site admins don't have user_levels |
|
315 | 326 | |
316 | 327 | return $wpdb->get_col( $wpdb->prepare("SELECT user_id FROM $wpdb->usermeta WHERE meta_key = %s AND meta_value = '0'", $level_key) ); |
317 | 328 | } |
@@ -523,8 +534,9 @@ discard block |
||
523 | 534 | if ( $this->search_term ) { |
524 | 535 | $searches = array(); |
525 | 536 | $search_sql = 'AND ('; |
526 | - foreach ( array('user_login', 'user_nicename', 'user_email', 'user_url', 'display_name') as $col ) |
|
527 | - $searches[] = $wpdb->prepare( $col . ' LIKE %s', '%' . like_escape($this->search_term) . '%' ); |
|
537 | + foreach ( array('user_login', 'user_nicename', 'user_email', 'user_url', 'display_name') as $col ) { |
|
538 | + $searches[] = $wpdb->prepare( $col . ' LIKE %s', '%' . like_escape($this->search_term) . '%' ); |
|
539 | + } |
|
528 | 540 | $search_sql .= implode(' OR ', $searches); |
529 | 541 | $search_sql .= ')'; |
530 | 542 | } |
@@ -555,10 +567,13 @@ discard block |
||
555 | 567 | |
556 | 568 | $this->results = $wpdb->get_col("SELECT DISTINCT($wpdb->users.ID)" . $this->query_from . $this->query_where . $this->query_orderby . $this->query_limit); |
557 | 569 | |
558 | - if ( $this->results ) |
|
559 | - $this->total_users_for_query = $wpdb->get_var("SELECT COUNT(DISTINCT($wpdb->users.ID))" . $this->query_from . $this->query_where); // no limit |
|
560 | - else |
|
561 | - $this->search_errors = new WP_Error('no_matching_users_found', __('No users found.')); |
|
570 | + if ( $this->results ) { |
|
571 | + $this->total_users_for_query = $wpdb->get_var("SELECT COUNT(DISTINCT($wpdb->users.ID))" . $this->query_from . $this->query_where); |
|
572 | + } |
|
573 | + // no limit |
|
574 | + else { |
|
575 | + $this->search_errors = new WP_Error('no_matching_users_found', __('No users found.')); |
|
576 | + } |
|
562 | 577 | } |
563 | 578 | |
564 | 579 | /** |
@@ -578,10 +593,12 @@ discard block |
||
578 | 593 | public function do_paging() { |
579 | 594 | if ( $this->total_users_for_query > $this->users_per_page ) { // have to page the results |
580 | 595 | $args = array(); |
581 | - if ( ! empty($this->search_term) ) |
|
582 | - $args['usersearch'] = urlencode($this->search_term); |
|
583 | - if ( ! empty($this->role) ) |
|
584 | - $args['role'] = urlencode($this->role); |
|
596 | + if ( ! empty($this->search_term) ) { |
|
597 | + $args['usersearch'] = urlencode($this->search_term); |
|
598 | + } |
|
599 | + if ( ! empty($this->role) ) { |
|
600 | + $args['role'] = urlencode($this->role); |
|
601 | + } |
|
585 | 602 | |
586 | 603 | $this->paging_text = paginate_links( array( |
587 | 604 | 'total' => ceil($this->total_users_for_query / $this->users_per_page), |
@@ -636,8 +653,9 @@ discard block |
||
636 | 653 | * @return bool |
637 | 654 | */ |
638 | 655 | function results_are_paged() { |
639 | - if ( $this->paging_text ) |
|
640 | - return true; |
|
656 | + if ( $this->paging_text ) { |
|
657 | + return true; |
|
658 | + } |
|
641 | 659 | return false; |
642 | 660 | } |
643 | 661 | |
@@ -650,8 +668,9 @@ discard block |
||
650 | 668 | * @return bool |
651 | 669 | */ |
652 | 670 | function is_search() { |
653 | - if ( $this->search_term ) |
|
654 | - return true; |
|
671 | + if ( $this->search_term ) { |
|
672 | + return true; |
|
673 | + } |
|
655 | 674 | return false; |
656 | 675 | } |
657 | 676 | } |
@@ -676,10 +695,11 @@ discard block |
||
676 | 695 | |
677 | 696 | $editable = get_editable_user_ids( $user_id ); |
678 | 697 | |
679 | - if ( in_array($type, array('draft', 'pending')) ) |
|
680 | - $type_sql = " post_status = '$type' "; |
|
681 | - else |
|
682 | - $type_sql = " ( post_status = 'draft' OR post_status = 'pending' ) "; |
|
698 | + if ( in_array($type, array('draft', 'pending')) ) { |
|
699 | + $type_sql = " post_status = '$type' "; |
|
700 | + } else { |
|
701 | + $type_sql = " ( post_status = 'draft' OR post_status = 'pending' ) "; |
|
702 | + } |
|
683 | 703 | |
684 | 704 | $dir = ( 'pending' == $type ) ? 'ASC' : 'DESC'; |
685 | 705 | |
@@ -749,8 +769,9 @@ discard block |
||
749 | 769 | |
750 | 770 | static $num = 1; |
751 | 771 | |
752 | - if ( ! class_exists( '_WP_Editors', false ) ) |
|
753 | - require_once( ABSPATH . WPINC . '/class-wp-editor.php' ); |
|
772 | + if ( ! class_exists( '_WP_Editors', false ) ) { |
|
773 | + require_once( ABSPATH . WPINC . '/class-wp-editor.php' ); |
|
774 | + } |
|
754 | 775 | |
755 | 776 | $editor_id = 'content' . $num++; |
756 | 777 | |
@@ -806,8 +827,9 @@ discard block |
||
806 | 827 | |
807 | 828 | $current_screen = get_current_screen(); |
808 | 829 | |
809 | - if ( ! $current_screen ) |
|
810 | - return ''; |
|
830 | + if ( ! $current_screen ) { |
|
831 | + return ''; |
|
832 | + } |
|
811 | 833 | |
812 | 834 | ob_start(); |
813 | 835 | $current_screen->render_screen_layout(); |
@@ -826,8 +848,9 @@ discard block |
||
826 | 848 | |
827 | 849 | $current_screen = get_current_screen(); |
828 | 850 | |
829 | - if ( ! $current_screen ) |
|
830 | - return ''; |
|
851 | + if ( ! $current_screen ) { |
|
852 | + return ''; |
|
853 | + } |
|
831 | 854 | |
832 | 855 | ob_start(); |
833 | 856 | $current_screen->render_per_page_options(); |
@@ -976,8 +999,9 @@ discard block |
||
976 | 999 | function add_contextual_help( $screen, $help ) { |
977 | 1000 | _deprecated_function( __FUNCTION__, '3.3', 'get_current_screen()->add_help_tab()' ); |
978 | 1001 | |
979 | - if ( is_string( $screen ) ) |
|
980 | - $screen = convert_to_screen( $screen ); |
|
1002 | + if ( is_string( $screen ) ) { |
|
1003 | + $screen = convert_to_screen( $screen ); |
|
1004 | + } |
|
981 | 1005 | |
982 | 1006 | WP_Screen::add_old_compat_help( $screen, $help ); |
983 | 1007 | } |
@@ -1141,8 +1165,9 @@ discard block |
||
1141 | 1165 | function wp_update_core($current, $feedback = '') { |
1142 | 1166 | _deprecated_function( __FUNCTION__, '3.7', 'new Core_Upgrader();' ); |
1143 | 1167 | |
1144 | - if ( !empty($feedback) ) |
|
1145 | - add_filter('update_feedback', $feedback); |
|
1168 | + if ( !empty($feedback) ) { |
|
1169 | + add_filter('update_feedback', $feedback); |
|
1170 | + } |
|
1146 | 1171 | |
1147 | 1172 | include( ABSPATH . 'wp-admin/includes/class-wp-upgrader.php' ); |
1148 | 1173 | $upgrader = new Core_Upgrader(); |
@@ -1164,8 +1189,9 @@ discard block |
||
1164 | 1189 | function wp_update_plugin($plugin, $feedback = '') { |
1165 | 1190 | _deprecated_function( __FUNCTION__, '3.7', 'new Plugin_Upgrader();' ); |
1166 | 1191 | |
1167 | - if ( !empty($feedback) ) |
|
1168 | - add_filter('update_feedback', $feedback); |
|
1192 | + if ( !empty($feedback) ) { |
|
1193 | + add_filter('update_feedback', $feedback); |
|
1194 | + } |
|
1169 | 1195 | |
1170 | 1196 | include( ABSPATH . 'wp-admin/includes/class-wp-upgrader.php' ); |
1171 | 1197 | $upgrader = new Plugin_Upgrader(); |
@@ -1186,8 +1212,9 @@ discard block |
||
1186 | 1212 | function wp_update_theme($theme, $feedback = '') { |
1187 | 1213 | _deprecated_function( __FUNCTION__, '3.7', 'new Theme_Upgrader();' ); |
1188 | 1214 | |
1189 | - if ( !empty($feedback) ) |
|
1190 | - add_filter('update_feedback', $feedback); |
|
1215 | + if ( !empty($feedback) ) { |
|
1216 | + add_filter('update_feedback', $feedback); |
|
1217 | + } |
|
1191 | 1218 | |
1192 | 1219 | include( ABSPATH . 'wp-admin/includes/class-wp-upgrader.php' ); |
1193 | 1220 | $upgrader = new Theme_Upgrader(); |