Ticket #37699: 37699-version.2.diff
File 37699-version.2.diff, 47.4 KB (added by , 8 years ago) |
---|
-
src/wp-admin/about.php
42 42 43 43 $title = __( 'About' ); 44 44 45 list( $display_version ) = explode( '-', $wp_version);45 list( $display_version ) = explode( '-', WP::get( 'wp_version' ) ); 46 46 47 47 include( ABSPATH . 'wp-admin/admin-header.php' ); 48 48 ?> -
src/wp-admin/admin-header.php
18 18 * @global WP_Screen $current_screen 19 19 * @global WP_Locale $wp_locale 20 20 * @global string $pagenow 21 * @global string $wp_version22 21 * @global string $update_title 23 22 * @global int $total_update_count 24 23 * @global string $parent_file 25 24 */ 26 global $title, $hook_suffix, $current_screen, $wp_locale, $pagenow, $wp_version,25 global $title, $hook_suffix, $current_screen, $wp_locale, $pagenow, 27 26 $update_title, $total_update_count, $parent_file; 28 27 29 28 // Catch plugins that include admin-header.php before admin.php completes. … … 154 153 if ( $current_screen->taxonomy ) 155 154 $admin_body_class .= ' taxonomy-' . $current_screen->taxonomy; 156 155 156 $wp_version = WP::get( 'wp_version' ); 157 157 158 $admin_body_class .= ' branch-' . str_replace( array( '.', ',' ), '-', floatval( $wp_version ) ); 158 159 $admin_body_class .= ' version-' . str_replace( '.', '-', preg_replace( '/^([.0-9]+).*/', '$1', $wp_version ) ); 159 160 $admin_body_class .= ' admin-color-' . sanitize_html_class( get_user_option( 'admin_color' ), 'fresh' ); -
src/wp-admin/credits.php
12 12 13 13 $title = __( 'Credits' ); 14 14 15 list( $display_version ) = explode( '-', $wp_version);15 list( $display_version ) = explode( '-', WP::get( 'wp_version' ) ); 16 16 17 17 include( ABSPATH . 'wp-admin/admin-header.php' ); 18 18 ?> -
src/wp-admin/freedoms.php
11 11 12 12 $title = __( 'Freedoms' ); 13 13 14 list( $display_version ) = explode( '-', $wp_version);14 list( $display_version ) = explode( '-', WP::get( 'wp_version' ) ); 15 15 16 16 include( ABSPATH . 'wp-admin/admin-header.php' ); 17 17 ?> -
src/wp-admin/includes/class-core-upgrader.php
65 65 66 66 include( ABSPATH . WPINC . '/version.php' ); // $wp_version; 67 67 68 $wp_version = WP::get( 'wp_version' ); 69 68 70 $start_time = time(); 69 71 70 72 $defaults = array( … … 238 240 public static function should_update_to_version( $offered_ver ) { 239 241 include( ABSPATH . WPINC . '/version.php' ); // $wp_version; // x.y.z 240 242 243 $wp_version = WP::get( 'wp_version' ); 244 241 245 $current_branch = implode( '.', array_slice( preg_split( '/[.-]/', $wp_version ), 0, 2 ) ); // x.y 242 246 $new_branch = implode( '.', array_slice( preg_split( '/[.-]/', $offered_ver ), 0, 2 ) ); // x.y 243 247 $current_is_development_version = (bool) strpos( $wp_version, '-' ); … … 339 343 * @since 3.7.0 340 344 * @access public 341 345 * 342 * @global string $wp_version343 346 * @global string $wp_local_package 344 347 * 345 348 * @return bool True if the checksums match, otherwise false. 346 349 */ 347 350 public function check_files() { 348 global $wp_ version, $wp_local_package;351 global $wp_local_package; 349 352 350 $checksums = get_core_checksums( $wp_version, isset( $wp_local_package ) ? $wp_local_package : 'en_US' );353 $checksums = get_core_checksums( WP::get( 'wp_version' ), isset( $wp_local_package ) ? $wp_local_package : 'en_US' ); 351 354 352 355 if ( ! is_array( $checksums ) ) 353 356 return false; -
src/wp-admin/includes/class-wp-automatic-updater.php
373 373 * @access public 374 374 * 375 375 * @global wpdb $wpdb 376 * @global string $wp_version377 376 */ 378 377 public function run() { 379 global $wpdb , $wp_version;378 global $wpdb; 380 379 381 380 if ( $this->is_disabled() ) 382 381 return; … … 457 456 458 457 // Send debugging email to all development installs. 459 458 if ( ! empty( $this->update_results ) ) { 460 $development_version = false !== strpos( $wp_version, '-' );459 $development_version = false !== strpos( WP::get( 'wp_version' ), '-' ); 461 460 462 461 /** 463 462 * Filters whether to send a debugging email for each automatic background update. … … 494 493 * @since Unknown 495 494 * @access protected 496 495 * 497 * @global string $wp_version498 *499 496 * @param object $update_result The result of the core update. Includes the update offer and result. 500 497 */ 501 498 protected function after_core_update( $update_result ) { 502 global $wp_version; 503 499 $wp_version = WP::get( 'wp_version' ); 504 500 $core_update = $update_result->item; 505 501 $result = $update_result->result; 506 502 … … 584 580 * @since 3.7.0 585 581 * @access protected 586 582 * 587 * @global string $wp_version588 *589 583 * @param string $type The type of email to send. Can be one of 'success', 'fail', 'manual', 'critical'. 590 584 * @param object $core_update The update offer that was attempted. 591 585 * @param mixed $result Optional. The result for the core update. Can be WP_Error. … … 722 716 723 717 if ( 'critical' == $type && is_wp_error( $result ) ) { 724 718 $body .= "\n***\n\n"; 725 $body .= sprintf( __( 'Your site was running version %s.' ), $GLOBALS['wp_version']);719 $body .= sprintf( __( 'Your site was running version %s.' ), WP::get( 'wp_version' ) ); 726 720 $body .= ' ' . __( 'We have some data that describes the error your site encountered.' ); 727 721 $body .= ' ' . __( 'Your hosting company, support forum volunteers, or a friendly developer may be able to use this information to help you:' ); 728 722 -
src/wp-admin/includes/class-wp-plugin-install-list-table.php
69 69 * @global int $paged 70 70 * @global string $type 71 71 * @global string $term 72 * @global string $wp_version73 72 */ 74 73 public function prepare_items() { 75 74 include( ABSPATH . 'wp-admin/includes/plugin-install.php' ); … … 88 87 if ( 'search' === $tab ) { 89 88 $tabs['search'] = __( 'Search Results' ); 90 89 } 91 if ( $tab === 'beta' || false !== strpos( $GLOBALS['wp_version'], '-' ) ) {90 if ( $tab === 'beta' || false !== strpos( WP::get( 'wp_version' ), '-' ) ) { 92 91 $tabs['beta'] = _x( 'Beta Testing', 'Plugin Installer' ); 93 92 } 94 93 $tabs['featured'] = _x( 'Featured', 'Plugin Installer' ); … … 391 390 } 392 391 } 393 392 394 /**395 * @global string $wp_version396 */397 393 public function display_rows() { 394 $wp_version = WP::get( 'wp_version' ); 395 398 396 $plugins_allowedtags = array( 399 397 'a' => array( 'href' => array(),'title' => array(), 'target' => array() ), 400 398 'abbr' => array( 'title' => array() ),'acronym' => array( 'title' => array() ), … … 574 572 </div> 575 573 <div class="column-compatibility"> 576 574 <?php 577 if ( ! empty( $plugin['tested'] ) && version_compare( substr( $ GLOBALS['wp_version'], 0, strlen( $plugin['tested'] ) ), $plugin['tested'], '>' ) ) {575 if ( ! empty( $plugin['tested'] ) && version_compare( substr( $wp_version, 0, strlen( $plugin['tested'] ) ), $plugin['tested'], '>' ) ) { 578 576 echo '<span class="compatibility-untested">' . __( 'Untested with your version of WordPress' ) . '</span>'; 579 } elseif ( ! empty( $plugin['requires'] ) && version_compare( substr( $ GLOBALS['wp_version'], 0, strlen( $plugin['requires'] ) ), $plugin['requires'], '<' ) ) {577 } elseif ( ! empty( $plugin['requires'] ) && version_compare( substr( $wp_version, 0, strlen( $plugin['requires'] ) ), $plugin['requires'], '<' ) ) { 580 578 echo '<span class="compatibility-incompatible">' . __( '<strong>Incompatible</strong> with your version of WordPress' ) . '</span>'; 581 579 } else { 582 580 echo '<span class="compatibility-compatible">' . __( '<strong>Compatible</strong> with your version of WordPress' ) . '</span>'; -
src/wp-admin/includes/class-wp-press-this.php
267 267 * @return string Source's HTML sanitized markup 268 268 */ 269 269 public function fetch_source_html( $url ) { 270 global $wp_version;271 272 270 if ( empty( $url ) ) { 273 271 return new WP_Error( 'invalid-url', __( 'A valid URL was not provided.' ) ); 274 272 } … … 276 274 $remote_url = wp_safe_remote_get( $url, array( 277 275 'timeout' => 30, 278 276 // Use an explicit user-agent for Press This 279 'user-agent' => 'Press This (WordPress/' . $wp_version. '); ' . get_bloginfo( 'url' )277 'user-agent' => 'Press This (WordPress/' . WP::get( 'wp_version' ) . '); ' . get_bloginfo( 'url' ) 280 278 ) ); 281 279 282 280 if ( is_wp_error( $remote_url ) ) { … … 1189 1187 * @access public 1190 1188 * 1191 1189 * @global WP_Locale $wp_locale 1192 * @global string $wp_version1193 1190 * @global bool $is_IE 1194 1191 */ 1195 1192 public function html() { 1196 global $wp_locale , $wp_version;1193 global $wp_locale; 1197 1194 1198 1195 // Get data, new (POST) and old (GET). 1199 1196 $data = $this->merge_or_fetch_data(); … … 1307 1304 ?> 1308 1305 </head> 1309 1306 <?php 1307 $wp_version = WP::get( 'wp_version' ); 1310 1308 1311 1309 $admin_body_class = 'press-this'; 1312 1310 $admin_body_class .= ( is_rtl() ) ? ' rtl' : ''; -
src/wp-admin/includes/credits.php
10 10 /** 11 11 * Retrieve the contributor credits. 12 12 * 13 * @global string $wp_version The current WordPress version.14 *15 13 * @since 3.2.0 16 14 * 17 15 * @return array|false A list of all of the contributors, or false on error. 18 16 */ 19 17 function wp_credits() { 20 global $wp_version;18 $wp_version = WP::get( 'wp_version' ); 21 19 $locale = get_locale(); 22 20 23 21 $results = get_site_transient( 'wordpress_credits_' . $locale ); -
src/wp-admin/includes/dashboard.php
1393 1393 * 1394 1394 * @since 3.2.0 1395 1395 * 1396 * @global string $wp_version1397 *1398 1396 * @return array|bool False on failure, array of browser data on success. 1399 1397 */ 1400 1398 function wp_check_browser_version() { … … 1404 1402 $key = md5( $_SERVER['HTTP_USER_AGENT'] ); 1405 1403 1406 1404 if ( false === ($response = get_site_transient('browser_' . $key) ) ) { 1407 global $wp_version;1408 1409 1405 $options = array( 1410 1406 'body' => array( 'useragent' => $_SERVER['HTTP_USER_AGENT'] ), 1411 'user-agent' => 'WordPress/' . $wp_version. '; ' . home_url()1407 'user-agent' => 'WordPress/' . WP::get( 'wp_version' ) . '; ' . home_url() 1412 1408 ); 1413 1409 1414 1410 $response = wp_remote_post( 'http://api.wordpress.org/core/browse-happy/1.1/', $options ); -
src/wp-admin/includes/import.php
125 125 function wp_get_popular_importers() { 126 126 include( ABSPATH . WPINC . '/version.php' ); // include an unmodified $wp_version 127 127 128 $wp_version = WP::get( 'wp_version' ); 128 129 $locale = get_locale(); 129 130 $cache_key = 'popular_importers_' . md5( $locale . $wp_version ); 130 131 $popular_importers = get_site_transient( $cache_key ); -
src/wp-admin/includes/plugin-install.php
423 423 * @since 2.7.0 424 424 * 425 425 * @global string $tab 426 * @global string $wp_version427 426 */ 428 427 function install_plugin_information() { 429 428 global $tab; … … 432 431 return; 433 432 } 434 433 434 $wp_version = WP::get( 'wp_version' ); 435 435 436 $api = plugins_api( 'plugin_information', array( 436 437 'slug' => wp_unslash( $_REQUEST['plugin'] ), 437 438 'is_ssl' => is_ssl(), … … 630 631 </div> 631 632 <div id="section-holder" class="wrap"> 632 633 <?php 633 if ( ! empty( $api->tested ) && version_compare( substr( $ GLOBALS['wp_version'], 0, strlen( $api->tested ) ), $api->tested, '>' ) ) {634 if ( ! empty( $api->tested ) && version_compare( substr( $wp_version, 0, strlen( $api->tested ) ), $api->tested, '>' ) ) { 634 635 echo '<div class="notice notice-warning notice-alt"><p>' . __( '<strong>Warning:</strong> This plugin has <strong>not been tested</strong> with your current version of WordPress.' ) . '</p></div>'; 635 } elseif ( ! empty( $api->requires ) && version_compare( substr( $ GLOBALS['wp_version'], 0, strlen( $api->requires ) ), $api->requires, '<' ) ) {636 } elseif ( ! empty( $api->requires ) && version_compare( substr( $wp_version, 0, strlen( $api->requires ) ), $api->requires, '<' ) ) { 636 637 echo '<div class="notice notice-warning notice-alt"><p>' . __( '<strong>Warning:</strong> This plugin has <strong>not been marked as compatible</strong> with your version of WordPress.' ) . '</p></div>'; 637 638 } 638 639 -
src/wp-admin/includes/translation-install.php
43 43 $options = array( 44 44 'timeout' => 3, 45 45 'body' => array( 46 'wp_version' => $wp_version,46 'wp_version' => WP::get( 'wp_version' ), 47 47 'locale' => get_locale(), 48 48 'version' => $args['version'], // Version of plugin, theme or core 49 49 ), … … 100 100 101 101 include( ABSPATH . WPINC . '/version.php' ); // include an unmodified $wp_version 102 102 103 $api = translations_api( 'core', array( 'version' => $wp_version) );103 $api = translations_api( 'core', array( 'version' => WP::get( 'wp_version' ) ) ); 104 104 105 105 if ( is_wp_error( $api ) || empty( $api['translations'] ) ) { 106 106 return array(); -
src/wp-admin/includes/update-core.php
796 796 * @global array $_old_files 797 797 * @global array $_new_bundled_files 798 798 * @global wpdb $wpdb 799 * @global string $wp_version800 799 * @global string $required_php_version 801 800 * @global string $required_mysql_version 802 801 * … … 844 843 845 844 846 845 /** 847 * Import $ wp_version, $required_php_version, and $required_mysql_version from the new version846 * Import $required_php_version, and $required_mysql_version from the new version 848 847 * $wp_filesystem->wp_content_dir() returned unslashed pre-2.8 849 848 * 850 * @global string $wp_version851 849 * @global string $required_php_version 852 850 * @global string $required_mysql_version 853 851 */ 854 global $ wp_version, $required_php_version, $required_mysql_version;852 global $required_php_version, $required_mysql_version; 855 853 856 854 $versions_file = trailingslashit( $wp_filesystem->wp_content_dir() ) . 'upgrade/version-current.php'; 857 855 if ( ! $wp_filesystem->copy( $from . $distro . 'wp-includes/version.php', $versions_file ) ) { … … 863 861 require( WP_CONTENT_DIR . '/upgrade/version-current.php' ); 864 862 $wp_filesystem->delete( $versions_file ); 865 863 864 $wp_version = WP::get( 'wp_version' ); 866 865 $php_version = phpversion(); 867 866 $mysql_version = $wpdb->db_version(); 868 867 $old_wp_version = $wp_version; // The version of WordPress we're updating from … … 1200 1199 * 1201 1200 * @since 3.3.0 1202 1201 * 1203 * @global string $wp_version1204 1202 * @global string $pagenow 1205 1203 * @global string $action 1206 1204 * … … 1207 1205 * @param string $new_version 1208 1206 */ 1209 1207 function _redirect_to_about_wordpress( $new_version ) { 1210 global $ wp_version, $pagenow, $action;1208 global $pagenow, $action; 1211 1209 1212 if ( version_compare( $wp_version, '3.4-RC1', '>=' ) )1210 if ( version_compare( WP::get( 'wp_version' ), '3.4-RC1', '>=' ) ) 1213 1211 return; 1214 1212 1215 1213 // Ensure we only run this on the update-core.php page. The Core_Upgrader may be used in other contexts. -
src/wp-admin/includes/update.php
595 595 * This flag is cleared whenever a successful update occurs using Core_Upgrader. 596 596 */ 597 597 $comparison = ! empty( $failed['critical'] ) ? '>=' : '>'; 598 if ( version_compare( $failed['attempted'], $wp_version, $comparison ) )598 if ( version_compare( $failed['attempted'], WP::get( 'wp_version' ), $comparison ) ) 599 599 $nag = true; 600 600 } 601 601 -
src/wp-admin/install.php
217 217 } 218 218 219 219 /** 220 * @global string $wp_version221 220 * @global string $required_php_version 222 221 * @global string $required_mysql_version 223 222 * @global wpdb $wpdb 224 223 */ 225 global $ wp_version, $required_php_version, $required_mysql_version;224 global $required_php_version, $required_mysql_version; 226 225 226 $wp_version = WP::get( 'wp_version' ); 227 227 $php_version = phpversion(); 228 228 $mysql_version = $wpdb->db_version(); 229 229 $php_compat = version_compare( $php_version, $required_php_version, '>=' ); -
src/wp-admin/load-scripts.php
37 37 $wp_scripts = new WP_Scripts(); 38 38 wp_default_scripts($wp_scripts); 39 39 40 $wp_version = WP::get( 'wp_version' ); 41 40 42 if ( isset( $_SERVER['HTTP_IF_NONE_MATCH'] ) && stripslashes( $_SERVER['HTTP_IF_NONE_MATCH'] ) === $wp_version ) { 41 43 $protocol = $_SERVER['SERVER_PROTOCOL']; 42 44 if ( ! in_array( $protocol, array( 'HTTP/1.1', 'HTTP/2', 'HTTP/2.0' ) ) ) { -
src/wp-admin/load-styles.php
38 38 $wp_styles = new WP_Styles(); 39 39 wp_default_styles($wp_styles); 40 40 41 $wp_version = WP::get( 'wp_version' ); 42 41 43 if ( isset( $_SERVER['HTTP_IF_NONE_MATCH'] ) && stripslashes( $_SERVER['HTTP_IF_NONE_MATCH'] ) === $wp_version ) { 42 44 $protocol = $_SERVER['SERVER_PROTOCOL']; 43 45 if ( ! in_array( $protocol, array( 'HTTP/1.1', 'HTTP/2', 'HTTP/2.0' ) ) ) { -
src/wp-admin/plugin-editor.php
260 260 <input type="hidden" name="scrollto" id="scrollto" value="<?php echo $scrollto; ?>" /> 261 261 </div> 262 262 <?php if ( !empty( $docs_select ) ) : ?> 263 <div id="documentation" class="hide-if-no-js"><label for="docs-list"><?php _e('Documentation:') ?></label> <?php echo $docs_select ?> <input type="button" class="button" value="<?php esc_attr_e( 'Look Up' ) ?> " onclick="if ( '' != jQuery('#docs-list').val() ) { window.open( 'https://api.wordpress.org/core/handbook/1.0/?function=' + escape( jQuery( '#docs-list' ).val() ) + '&locale=<?php echo urlencode( get_locale() ) ?>&version=<?php echo urlencode( $wp_version) ?>&redirect=true'); }" /></div>263 <div id="documentation" class="hide-if-no-js"><label for="docs-list"><?php _e('Documentation:') ?></label> <?php echo $docs_select ?> <input type="button" class="button" value="<?php esc_attr_e( 'Look Up' ) ?> " onclick="if ( '' != jQuery('#docs-list').val() ) { window.open( 'https://api.wordpress.org/core/handbook/1.0/?function=' + escape( jQuery( '#docs-list' ).val() ) + '&locale=<?php echo urlencode( get_locale() ) ?>&version=<?php echo urlencode( WP::get( 'wp_version' ) ) ?>&redirect=true'); }" /></div> 264 264 <?php endif; ?> 265 265 <?php if ( is_writeable($real_file) ) : ?> 266 266 <?php if ( in_array( $file, (array) get_option( 'active_plugins', array() ) ) ) { ?> -
src/wp-admin/theme-editor.php
263 263 <div id="documentation" class="hide-if-no-js"> 264 264 <label for="docs-list"><?php _e('Documentation:') ?></label> 265 265 <?php echo $docs_select; ?> 266 <input type="button" class="button" value="<?php esc_attr_e( 'Look Up' ); ?>" onclick="if ( '' != jQuery('#docs-list').val() ) { window.open( 'https://api.wordpress.org/core/handbook/1.0/?function=' + escape( jQuery( '#docs-list' ).val() ) + '&locale=<?php echo urlencode( get_locale() ) ?>&version=<?php echo urlencode( $wp_version) ?>&redirect=true'); }" />266 <input type="button" class="button" value="<?php esc_attr_e( 'Look Up' ); ?>" onclick="if ( '' != jQuery('#docs-list').val() ) { window.open( 'https://api.wordpress.org/core/handbook/1.0/?function=' + escape( jQuery( '#docs-list' ).val() ) + '&locale=<?php echo urlencode( get_locale() ) ?>&version=<?php echo urlencode( WP::get( 'wp_version' ) ) ?>&redirect=true'); }" /> 267 267 </div> 268 268 <?php endif; ?> 269 269 -
src/wp-admin/update-core.php
26 26 * 27 27 * @global string $wp_local_package 28 28 * @global wpdb $wpdb 29 * @global string $wp_version30 29 * 31 30 * @staticvar bool $first_pass 32 31 * … … 33 32 * @param object $update 34 33 */ 35 34 function list_core_update( $update ) { 36 global $wp_local_package, $wpdb , $wp_version;35 global $wp_local_package, $wpdb; 37 36 static $first_pass = true; 38 37 39 if ( 'en_US' == $update->locale && 'en_US' == get_locale() ) 38 $wp_version = WP::get( 'wp_version' ); 39 40 if ( 'en_US' == $update->locale && 'en_US' == get_locale() ) { 40 41 $version_string = $update->current; 41 42 // If the only available update is a partial builds, it doesn't need a language-specific version string. 42 elseif ( 'en_US' == $update->locale && $update->packages->partial && $wp_version == $update->partial_version && ( $updates = get_core_updates() ) && 1 == count( $updates ) ) 43 } elseif ( 'en_US' == $update->locale && $update->packages->partial && $wp_version == $update->partial_version && ( $updates = get_core_updates() ) && 1 == count( $updates ) ) { 43 44 $version_string = $update->current; 44 else 45 } else { 45 46 $version_string = sprintf( "%s–<strong>%s</strong>", $update->current, $update->locale ); 46 47 } 47 48 $current = false; 48 49 if ( !isset($update->response) || 'latest' == $update->response ) 49 50 $current = true; … … 149 150 * 150 151 * @since 2.7.0 151 152 * 152 * @global string $wp_version153 153 * @global string $required_php_version 154 154 * @global string $required_mysql_version 155 155 */ 156 156 function core_upgrade_preamble() { 157 global $ wp_version, $required_php_version, $required_mysql_version;157 global $required_php_version, $required_mysql_version; 158 158 159 159 $updates = get_core_updates(); 160 160 161 $wp_version = WP::get( 'wp_version' ); 162 161 163 if ( !isset($updates[0]->response) || 'latest' == $updates[0]->response ) { 162 164 echo '<h2>'; 163 165 _e('You have the latest version of WordPress.'); … … 211 213 dismissed_updates(); 212 214 } 213 215 214 /**215 *216 * @global string $wp_version217 */218 216 function list_plugin_updates() { 219 global $wp_version;217 $cur_wp_version = preg_replace('/-.*$/', '', WP::get( 'wp_version' ) ); 220 218 221 $cur_wp_version = preg_replace('/-.*$/', '', $wp_version);222 223 219 require_once(ABSPATH . 'wp-admin/includes/plugin-install.php'); 224 220 $plugins = get_plugin_updates(); 225 221 if ( empty( $plugins ) ) { -
src/wp-admin/upgrade.php
36 36 } 37 37 38 38 /** 39 * @global string $wp_version40 39 * @global string $required_php_version 41 40 * @global string $required_mysql_version 42 41 * @global wpdb $wpdb 43 42 */ 44 global $ wp_version, $required_php_version, $required_mysql_version;43 global $required_php_version, $required_mysql_version; 45 44 45 $wp_version = WP::get( 'wp_version' ); 46 46 47 $step = (int) $step; 47 48 48 49 $php_version = phpversion(); -
src/wp-includes/class-http.php
101 101 * @access public 102 102 * @since 2.7.0 103 103 * 104 * @global string $wp_version105 *106 104 * @param string $url The request URL. 107 105 * @param string|array $args { 108 106 * Optional. Array or string of HTTP request arguments. … … 148 146 * A WP_Error instance upon error. 149 147 */ 150 148 public function request( $url, $args = array() ) { 151 global $wp_version;152 153 149 $defaults = array( 154 150 'method' => 'GET', 155 151 /** … … 185 181 * 186 182 * @param string $user_agent WordPress user agent string. 187 183 */ 188 'user-agent' => apply_filters( 'http_headers_useragent', 'WordPress/' . $wp_version. '; ' . get_bloginfo( 'url' ) ),184 'user-agent' => apply_filters( 'http_headers_useragent', 'WordPress/' . WP::get( 'wp_version' ) . '; ' . get_bloginfo( 'url' ) ), 189 185 /** 190 186 * Filters whether to pass URLs through wp_http_validate_url() in an HTTP request. 191 187 * -
src/wp-includes/class-wp-container.php
1 <?php 2 3 class WP_Container { 4 private $data = array(); 5 private static $instance; 6 7 public static function instance() { 8 if ( ! self::$instance ) { 9 self::$instance = new self; 10 } 11 return self::$instance; 12 } 13 14 public function reset() { 15 foreach ( $this->data as $name => $opts ) { 16 if ( ! $opts['global'] ) { 17 continue; 18 } 19 20 unset( $GLOBALS[ $name ] ); 21 } 22 23 $this->data = array(); 24 } 25 26 public function get( $name ) { 27 if ( ! $this->has( $name ) ) { 28 return; 29 } 30 31 $data = $this->data[ $name ]; 32 if ( is_callable( $data['value'] ) ) { 33 return call_user_func_array( $data['value'], $data['args'] ); 34 } 35 return $data['value']; 36 } 37 38 public function has( $name ) { 39 return array_key_exists( $name, $this->data ); 40 } 41 42 public function set( $name, $value, $opts = array() ) { 43 $defaults = array( 44 'global' => false, 45 'mutable' => true, 46 'args' => array() 47 ); 48 49 foreach ( $defaults as $key => $val ) { 50 if ( array_key_exists( $key, $opts ) ) { 51 continue; 52 } 53 54 $opts[ $key ] = $val; 55 } 56 57 $opts['value'] = $value; 58 59 if ( $this->has( $name ) ) { 60 $data = $this->data[ $name ]; 61 if ( ! $data['mutable'] ) { 62 return; 63 } 64 } 65 66 $this->data[ $name ] = $opts; 67 if ( $opts['global'] ) { 68 $GLOBALS[ $name ] = $value; 69 } 70 } 71 } -
src/wp-includes/class-wp-editor.php
296 296 /** 297 297 * @static 298 298 * 299 * @global string $wp_version300 299 * @global string $tinymce_version 301 300 * 302 301 * @param string $editor_id … … 303 302 * @param array $set 304 303 */ 305 304 public static function editor_settings($editor_id, $set) { 306 global $ wp_version, $tinymce_version;305 global $tinymce_version; 307 306 308 307 if ( empty(self::$first_init) ) { 309 308 if ( is_admin() ) { … … 559 558 } 560 559 561 560 $suffix = SCRIPT_DEBUG ? '' : '.min'; 562 $version = 'ver=' . $wp_version;561 $version = 'ver=' . WP::get( 'wp_version' ); 563 562 $dashicons = includes_url( "css/dashicons$suffix.css?$version" ); 564 563 565 564 // WordPress default stylesheet and dashicons … … 1131 1130 /** 1132 1131 * 1133 1132 * @static 1134 * @global string $wp_version1135 1133 * @global string $tinymce_version 1136 1134 * @global bool $concatenate_scripts 1137 1135 * @global bool $compress_scripts 1138 1136 */ 1139 1137 public static function editor_js() { 1140 global $ wp_version, $tinymce_version, $concatenate_scripts, $compress_scripts;1138 global $tinymce_version, $concatenate_scripts, $compress_scripts; 1141 1139 1142 1140 /** 1143 1141 * Filters "tiny_mce_version" is deprecated … … 1215 1213 1216 1214 $baseurl = self::$baseurl; 1217 1215 // Load tinymce.js when running from /src, else load wp-tinymce.js.gz (production) or tinymce.min.js (SCRIPT_DEBUG) 1218 $mce_suffix = false !== strpos( $wp_version, '-src' ) ? '' : '.min';1216 $mce_suffix = false !== strpos( WP::get( 'wp_version' ), '-src' ) ? '' : '.min'; 1219 1217 1220 1218 if ( $tmce_on ) { 1221 1219 if ( $compressed ) { -
src/wp-includes/class-wp-locale.php
125 125 * @access private 126 126 * 127 127 * @global string $text_direction 128 * @global string $wp_version129 128 */ 130 129 public function init() { 131 130 // The Weekdays … … 231 230 elseif ( 'rtl' == _x( 'ltr', 'text direction' ) ) 232 231 $this->text_direction = 'rtl'; 233 232 234 if ( 'rtl' === $this->text_direction && strpos( $GLOBALS['wp_version'], '-src' ) ) {233 if ( 'rtl' === $this->text_direction && strpos( WP::get( 'wp_version' ), '-src' ) ) { 235 234 $this->text_direction = 'ltr'; 236 235 add_action( 'all_admin_notices', array( $this, 'rtl_src_admin_notice' ) ); 237 236 } -
src/wp-includes/class-wp-xmlrpc-server.php
413 413 * Passes property through {@see 'xmlrpc_blog_options'} filter. 414 414 * 415 415 * @since 2.6.0 416 *417 * @global string $wp_version418 416 */ 419 417 public function initialise_blog_option_info() { 420 global $wp_version;421 422 418 $this->blog_options = array( 423 419 // Read only options 424 420 'software_name' => array( … … 429 425 'software_version' => array( 430 426 'desc' => __( 'Software Version' ), 431 427 'readonly' => true, 432 'value' => $wp_version428 'value' => WP::get( 'wp_version' ) 433 429 ), 434 430 'blog_url' => array( 435 431 'desc' => __( 'WordPress Address (URL)' ), … … 6186 6182 * 6187 6183 * @since 1.5.0 6188 6184 * 6189 * @global string $wp_version6190 *6191 6185 * @param array $args { 6192 6186 * Method arguments. Note: arguments must be ordered as documented. 6193 6187 * … … 6197 6191 * @return string|IXR_Error 6198 6192 */ 6199 6193 public function pingback_ping( $args ) { 6200 global $wp_version;6201 6202 6194 /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */ 6203 6195 do_action( 'xmlrpc_call', 'pingback.ping' ); 6204 6196 … … 6285 6277 $remote_ip = preg_replace( '/[^0-9a-fA-F:., ]/', '', $_SERVER['REMOTE_ADDR'] ); 6286 6278 6287 6279 /** This filter is documented in wp-includes/class-http.php */ 6288 $user_agent = apply_filters( 'http_headers_useragent', 'WordPress/' . $wp_version. '; ' . get_bloginfo( 'url' ) );6280 $user_agent = apply_filters( 'http_headers_useragent', 'WordPress/' . WP::get( 'wp_version' ) . '; ' . get_bloginfo( 'url' ) ); 6289 6281 6290 6282 // Let's check the remote site 6291 6283 $http_api_args = array( -
src/wp-includes/class-wp.php
737 737 */ 738 738 do_action_ref_array( 'wp', array( &$this ) ); 739 739 } 740 741 public static function get( $name ) { 742 return WP_Container::instance()->get( $name ); 743 } 744 745 public static function set( $name, $value, $opts = array() ) { 746 return WP_Container::instance()->set( $name, $value, $opts ); 747 } 740 748 } -
src/wp-includes/comment.php
2362 2362 * 2363 2363 * @since 0.71 2364 2364 * 2365 * @global string $wp_version2366 *2367 2365 * @param string $content Post content to check for links. 2368 2366 * @param int $post_ID Post ID. 2369 2367 */ 2370 2368 function pingback($content, $post_ID) { 2371 global $wp_version;2372 2373 2369 // original code by Mort (http://mort.mine.nu:8080) 2374 2370 $post_links = array(); 2375 2371 … … 2435 2431 * @param string $pagelinkedto URL of page linked to. 2436 2432 * @param string $pagelinkedfrom URL of page linked from. 2437 2433 */ 2438 $client->useragent = apply_filters( 'pingback_useragent', $client->useragent . ' -- WordPress/' . $wp_version, $client->useragent, $pingback_server_url, $pagelinkedto, $pagelinkedfrom );2434 $client->useragent = apply_filters( 'pingback_useragent', $client->useragent . ' -- WordPress/' . WP::get( 'wp_version' ), $client->useragent, $pingback_server_url, $pagelinkedto, $pagelinkedfrom ); 2439 2435 // when set to true, this outputs debug messages by itself 2440 2436 $client->debug = false; 2441 2437 … … 2504 2500 * 2505 2501 * @since 1.2.0 2506 2502 * 2507 * @global string $wp_version2508 *2509 2503 * @param string $server Host of blog to connect to. 2510 2504 * @param string $path Path to send the ping. 2511 2505 */ 2512 2506 function weblog_ping($server = '', $path = '') { 2513 global $wp_version;2514 2515 2507 // using a timeout of 3 seconds should be enough to cover slow servers 2516 2508 $client = new WP_HTTP_IXR_Client($server, ((!strlen(trim($path)) || ('/' == $path)) ? false : $path)); 2517 2509 $client->timeout = 3; 2518 $client->useragent .= ' -- WordPress/' .$wp_version;2510 $client->useragent .= ' -- WordPress/' . WP::get( 'wp_version' ); 2519 2511 2520 2512 // when set to true, this outputs debug messages by itself 2521 2513 $client->debug = false; -
src/wp-includes/formatting.php
4927 4927 * @ignore 4928 4928 * @since 4.6.0 4929 4929 * @access private 4930 *4931 * @global string $wp_version WordPress version string.4932 4930 */ 4933 4931 function _print_emoji_detection_script() { 4934 global $wp_version;4935 4936 4932 $settings = array( 4937 4933 /** 4938 4934 * Filters the URL where emoji png images are hosted. … … 4971 4967 'svgExt' => apply_filters( 'emoji_svg_ext', '.svg' ), 4972 4968 ); 4973 4969 4974 $version = 'ver=' . $wp_version;4970 $version = 'ver=' . WP::get( 'wp_version' ); 4975 4971 4976 4972 if ( SCRIPT_DEBUG ) { 4977 4973 $settings['source'] = array( -
src/wp-includes/general-template.php
637 637 * 638 638 * @since 0.71 639 639 * 640 * @global string $wp_version641 *642 640 * @param string $show Optional. Site info to retrieve. Default empty (site name). 643 641 * @param string $filter Optional. How to filter what is retrieved. Default 'raw'. 644 642 * @return string Mostly string values, might be empty. … … 705 703 $output = get_option('html_type'); 706 704 break; 707 705 case 'version': 708 global $wp_version; 709 $output = $wp_version; 706 $output = WP::get( 'wp_version' ); 710 707 break; 711 708 case 'language': 712 709 /* translators: Translate this to the correct language tag for your locale, … … 3344 3341 * Registers the default Admin color schemes 3345 3342 * 3346 3343 * @since 3.0.0 3347 *3348 * @global string $wp_version3349 3344 */ 3350 3345 function register_admin_color_schemes() { 3351 3346 $suffix = is_rtl() ? '-rtl' : ''; … … 3358 3353 ); 3359 3354 3360 3355 // Other color schemes are not available when running out of src 3361 if ( false !== strpos( $GLOBALS['wp_version'], '-src' ) )3356 if ( false !== strpos( WP::get( 'wp_version' ), '-src' ) ) 3362 3357 return; 3363 3358 3364 3359 wp_admin_css_color( 'light', _x( 'Light', 'admin color scheme' ), -
src/wp-includes/link-template.php
2898 2898 * @since 2.6.0 2899 2899 * 2900 2900 * @global bool $is_IE Whether the browser matches an Internet Explorer user agent. 2901 * @global string $wp_version WP version.2902 *2903 * @global bool $is_IE2904 * @global string $wp_version2905 2901 * @global WP_Press_This $wp_press_this 2906 2902 * 2907 2903 * @return string The Press This bookmarklet link URL. 2908 2904 */ 2909 2905 function get_shortcut_link() { 2910 global $is_IE , $wp_version;2906 global $is_IE; 2911 2907 2912 2908 $GLOBALS['wp_press_this'] = new WP_Press_This(); 2913 2909 $bookmarklet_version = $GLOBALS['wp_press_this']->version; -
src/wp-includes/load.php
118 118 * @access private 119 119 * 120 120 * @global string $required_php_version The required PHP version string. 121 * @global string $wp_version The WordPress version string.122 121 */ 123 122 function wp_check_php_mysql_versions() { 124 global $required_php_version , $wp_version;123 global $required_php_version; 125 124 $php_version = phpversion(); 126 125 127 126 if ( version_compare( $required_php_version, $php_version, '>' ) ) { … … 130 129 $protocol = wp_get_server_protocol(); 131 130 header( sprintf( '%s 500 Internal Server Error', $protocol ), true, 500 ); 132 131 header( 'Content-Type: text/html; charset=utf-8' ); 133 die( sprintf( __( 'Your server is running PHP version %1$s but WordPress %2$s requires at least %3$s.' ), $php_version, $wp_version, $required_php_version ) );132 die( sprintf( __( 'Your server is running PHP version %1$s but WordPress %2$s requires at least %3$s.' ), $php_version, WP::get( 'wp_version' ), $required_php_version ) ); 134 133 } 135 134 136 135 if ( ! extension_loaded( 'mysql' ) && ! extension_loaded( 'mysqli' ) && ! extension_loaded( 'mysqlnd' ) && ! file_exists( WP_CONTENT_DIR . '/db.php' ) ) { -
src/wp-includes/media.php
3810 3810 * 3811 3811 * @since 4.0.0 3812 3812 * 3813 * @global string $wp_version3814 *3815 3813 * @return array The relevant CSS file URLs. 3816 3814 */ 3817 3815 function wpview_media_sandbox_styles() { 3818 $version = 'ver=' . $GLOBALS['wp_version'];3816 $version = 'ver=' . WP::get( 'wp_version' ); 3819 3817 $mediaelement = includes_url( "js/mediaelement/mediaelementplayer.min.css?$version" ); 3820 3818 $wpmediaelement = includes_url( "js/mediaelement/wp-mediaelement.css?$version" ); 3821 3819 -
src/wp-includes/script-loader.php
36 36 function wp_default_scripts( &$scripts ) { 37 37 include( ABSPATH . WPINC . '/version.php' ); // include an unmodified $wp_version 38 38 39 $wp_version = WP::get( 'wp_version' ); 40 39 41 $develop_src = false !== strpos( $wp_version, '-src' ); 40 42 41 43 if ( ! defined( 'SCRIPT_DEBUG' ) ) { … … 746 748 function wp_default_styles( &$styles ) { 747 749 include( ABSPATH . WPINC . '/version.php' ); // include an unmodified $wp_version 748 750 749 if ( ! defined( 'SCRIPT_DEBUG' ) ) 751 $wp_version = WP::get( 'wp_version' ); 752 753 if ( ! defined( 'SCRIPT_DEBUG' ) ) { 750 754 define( 'SCRIPT_DEBUG', false !== strpos( $wp_version, '-src' ) ); 755 } 751 756 752 if ( ! $guessurl = site_url() ) 757 if ( ! $guessurl = site_url() ) { 753 758 $guessurl = wp_guess_url(); 759 } 754 760 755 761 $styles->base_url = $guessurl; 756 762 $styles->content_url = defined('WP_CONTENT_URL')? WP_CONTENT_URL : ''; -
src/wp-includes/update.php
14 14 * isn't installing. 15 15 * 16 16 * @since 2.3.0 17 * @global string $wp_version Used to check against the newest WordPress version.18 17 * @global wpdb $wpdb 19 18 * @global string $wp_local_package 20 19 * … … 29 28 global $wpdb, $wp_local_package; 30 29 // include an unmodified $wp_version 31 30 include( ABSPATH . WPINC . '/version.php' ); 31 32 $wp_version = WP::get( 'wp_version' ); 33 32 34 $php_version = phpversion(); 33 35 34 36 $current = get_site_transient( 'update_core' ); … … 183 185 * api.wordpress.org. Will only check if WordPress isn't installing. 184 186 * 185 187 * @since 2.3.0 186 * @global string $wp_version Used to notify the WordPress version.187 188 * 188 189 * @param array $extra_stats Extra statistics to report to the WordPress.org API. 189 190 */ … … 195 196 // include an unmodified $wp_version 196 197 include( ABSPATH . WPINC . '/version.php' ); 197 198 199 $wp_version = WP::get( 'wp_version' ); 200 198 201 // If running blog-side, bail unless we've not checked in the last 12 hours 199 202 if ( !function_exists( 'get_plugins' ) ) 200 203 require_once( ABSPATH . 'wp-admin/includes/plugin.php' ); … … 360 363 // include an unmodified $wp_version 361 364 include( ABSPATH . WPINC . '/version.php' ); 362 365 366 $wp_version = WP::get( 'wp_version' ); 367 363 368 $installed_themes = wp_get_themes(); 364 369 $translations = wp_get_installed_translations( 'themes' ); 365 370 … … 597 602 * Determines whether core should be updated. 598 603 * 599 604 * @since 2.8.0 600 *601 * @global string $wp_version602 605 */ 603 606 function _maybe_update_core() { 604 607 // include an unmodified $wp_version 605 608 include( ABSPATH . WPINC . '/version.php' ); 606 609 610 $wp_version = WP::get( 'wp_version' ); 611 607 612 $current = get_site_transient( 'update_core' ); 608 613 609 614 if ( isset( $current->last_checked, $current->version_checked ) && -
src/wp-includes/version.php
5 5 * @global string $wp_version 6 6 */ 7 7 $wp_version = '4.7-alpha-38178-src'; 8 8 WP::set( 'wp_version', $wp_version, array( 'global' => true ) ); 9 9 /** 10 10 * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. 11 11 * -
src/wp-includes/wp-db.php
616 616 * @link https://core.trac.wordpress.org/ticket/3354 617 617 * @since 2.0.8 618 618 * 619 * @global string $wp_version620 *621 619 * @param string $dbuser MySQL database user 622 620 * @param string $dbpassword MySQL database password 623 621 * @param string $dbname MySQL database name … … 640 638 $this->use_mysqli = ! WP_USE_EXT_MYSQL; 641 639 } elseif ( version_compare( phpversion(), '5.5', '>=' ) || ! function_exists( 'mysql_connect' ) ) { 642 640 $this->use_mysqli = true; 643 } elseif ( false !== strpos( $GLOBALS['wp_version'], '-' ) ) {641 } elseif ( false !== strpos( WP::get( 'wp_version' ), '-' ) ) { 644 642 $this->use_mysqli = true; 645 643 } 646 644 } … … 3196 3194 * 3197 3195 * @since 2.5.0 3198 3196 * 3199 * @global string $wp_version3200 3197 * @global string $required_mysql_version 3201 3198 * 3202 3199 * @return WP_Error|void 3203 3200 */ 3204 3201 public function check_database_version() { 3205 global $ wp_version, $required_mysql_version;3202 global $required_mysql_version; 3206 3203 // Make sure the server has the required MySQL version 3207 3204 if ( version_compare($this->db_version(), $required_mysql_version, '<') ) 3208 return new WP_Error('database_version', sprintf( __( '<strong>ERROR</strong>: WordPress %1$s requires MySQL %2$s or higher' ), $wp_version, $required_mysql_version ));3205 return new WP_Error('database_version', sprintf( __( '<strong>ERROR</strong>: WordPress %1$s requires MySQL %2$s or higher' ), WP::get( 'wp_version' ), $required_mysql_version )); 3209 3206 } 3210 3207 3211 3208 /** -
src/wp-vendor/autoload_52.php
4 4 5 5 require_once dirname(__FILE__) . '/composer'.'/autoload_real_52.php'; 6 6 7 return ComposerAutoloaderInit 1dd196791ebd0cfea0668c22edc062f9::getLoader();7 return ComposerAutoloaderInit2f31acae96c6d487f86d469e989d96d5::getLoader(); -
src/wp-vendor/composer/autoload_classmap.php
44 44 'WP_Comment' => $baseDir . '/wp-includes/class-wp-comment.php', 45 45 'WP_Comment_Query' => $baseDir . '/wp-includes/class-wp-comment-query.php', 46 46 'WP_Comments_List_Table' => $baseDir . '/wp-admin/includes/class-wp-comments-list-table.php', 47 'WP_Container' => $baseDir . '/wp-includes/class-wp-container.php', 47 48 'WP_Customize_Background_Image_Control' => $baseDir . '/wp-includes/customize/class-wp-customize-background-image-control.php', 48 49 'WP_Customize_Background_Image_Setting' => $baseDir . '/wp-includes/customize/class-wp-customize-background-image-setting.php', 49 50 'WP_Customize_Color_Control' => $baseDir . '/wp-includes/customize/class-wp-customize-color-control.php', -
src/wp-vendor/composer/autoload_real_52.php
2 2 3 3 // autoload_real_52.php generated by xrstf/composer-php52 4 4 5 class ComposerAutoloaderInit 1dd196791ebd0cfea0668c22edc062f9{5 class ComposerAutoloaderInit2f31acae96c6d487f86d469e989d96d5 { 6 6 private static $loader; 7 7 8 8 public static function loadClassLoader($class) { … … 19 19 return self::$loader; 20 20 } 21 21 22 spl_autoload_register(array('ComposerAutoloaderInit 1dd196791ebd0cfea0668c22edc062f9', 'loadClassLoader'), true /*, true */);22 spl_autoload_register(array('ComposerAutoloaderInit2f31acae96c6d487f86d469e989d96d5', 'loadClassLoader'), true /*, true */); 23 23 self::$loader = $loader = new xrstf_Composer52_ClassLoader(); 24 spl_autoload_unregister(array('ComposerAutoloaderInit 1dd196791ebd0cfea0668c22edc062f9', 'loadClassLoader'));24 spl_autoload_unregister(array('ComposerAutoloaderInit2f31acae96c6d487f86d469e989d96d5', 'loadClassLoader')); 25 25 26 26 $vendorDir = dirname(dirname(__FILE__)); 27 27 $baseDir = dirname($vendorDir); -
tests/phpunit/tests/container.php
1 <?php 2 /** 3 * @group container 4 */ 5 class Tests_WP_Container extends WP_UnitTestCase { 6 public function setUp() { 7 parent::setUp(); 8 9 WP_Container::instance()->reset(); 10 } 11 12 public function test_get_unset() { 13 $this->assertEmpty( WP::get( 'taco' ) ); 14 } 15 16 public function test_set_mutable_global() { 17 WP::set( 'taco', 'carnitas', array( 18 'global' => true, 19 ) ); 20 21 $this->assertArrayHasKey( 'taco', $GLOBALS ); 22 $this->assertEquals( 'carnitas', $GLOBALS['taco'] ); 23 $this->assertEquals( 'carnitas', WP::get( 'taco' ) ); 24 25 WP::set( 'taco', 'pollo', array( 26 'global' => true, 27 ) ); 28 29 $this->assertEquals( 'pollo', $GLOBALS['taco'] ); 30 $this->assertEquals( 'pollo', WP::get( 'taco' ) ); 31 32 WP::set( 'taco', 'bistec' ); 33 34 $this->assertEquals( 'pollo', $GLOBALS['taco'] ); 35 $this->assertEquals( 'bistec', WP::get( 'taco' ) ); 36 } 37 38 public function test_set_immutable_global() { 39 WP::set( 'taco', 'carnitas', array( 40 'global' => true, 41 'mutable' => false 42 ) ); 43 44 $this->assertArrayHasKey( 'taco', $GLOBALS ); 45 $this->assertEquals( 'carnitas', $GLOBALS['taco'] ); 46 $this->assertEquals( 'carnitas', WP::get( 'taco' ) ); 47 48 WP::set( 'taco', 'pollo' ); 49 50 $this->assertEquals( 'carnitas', $GLOBALS['taco'] ); 51 $this->assertEquals( 'carnitas', WP::get( 'taco' ) ); 52 } 53 } 54 No newline at end of file