Changeset 58813
- Timestamp:
- 07/27/2024 12:25:44 AM (2 months ago)
- Location:
- trunk
- Files:
-
- 1 added
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/includes/credits.php
r55988 r58813 20 20 function wp_credits( $version = '', $locale = '' ) { 21 21 if ( ! $version ) { 22 // Include an unmodified $wp_version. 23 require ABSPATH . WPINC . '/version.php'; 24 25 $version = $wp_version; 22 $version = wp_get_wp_version(); 26 23 } 27 24 -
trunk/src/wp-admin/includes/dashboard.php
r57571 r58813 1820 1820 1821 1821 if ( false === $response ) { 1822 // Include an unmodified $wp_version.1823 require ABSPATH . WPINC . '/version.php';1824 1825 1822 $url = 'http://api.wordpress.org/core/browse-happy/1.1/'; 1826 1823 $options = array( 1827 1824 'body' => array( 'useragent' => $_SERVER['HTTP_USER_AGENT'] ), 1828 'user-agent' => 'WordPress/' . $wp_version. '; ' . home_url( '/' ),1825 'user-agent' => 'WordPress/' . wp_get_wp_version() . '; ' . home_url( '/' ), 1829 1826 ); 1830 1827 -
trunk/src/wp-admin/includes/import.php
r53794 r58813 137 137 */ 138 138 function wp_get_popular_importers() { 139 // Include an unmodified $wp_version.140 require ABSPATH . WPINC . '/version.php';141 142 139 $locale = get_user_locale(); 143 $cache_key = 'popular_importers_' . md5( $locale . $wp_version);140 $cache_key = 'popular_importers_' . md5( $locale . wp_get_wp_version() ); 144 141 $popular_importers = get_site_transient( $cache_key ); 145 142 … … 148 145 array( 149 146 'locale' => $locale, 150 'version' => $wp_version,147 'version' => wp_get_wp_version(), 151 148 ), 152 149 'http://api.wordpress.org/core/importers/1.1/' 153 150 ); 154 $options = array( 'user-agent' => 'WordPress/' . $wp_version. '; ' . home_url( '/' ) );151 $options = array( 'user-agent' => 'WordPress/' . wp_get_wp_version() . '; ' . home_url( '/' ) ); 155 152 156 153 if ( wp_http_supports( array( 'ssl' ) ) ) { -
trunk/src/wp-admin/includes/plugin-install.php
r58409 r58813 101 101 */ 102 102 function plugins_api( $action, $args = array() ) { 103 // Include an unmodified $wp_version.104 require ABSPATH . WPINC . '/version.php';105 106 103 if ( is_array( $args ) ) { 107 104 $args = (object) $args; … … 119 116 120 117 if ( ! isset( $args->wp_version ) ) { 121 $args->wp_version = substr( $wp_version, 0, 3 ); // x.y118 $args->wp_version = substr( wp_get_wp_version(), 0, 3 ); // x.y 122 119 } 123 120 … … 169 166 $http_args = array( 170 167 'timeout' => 15, 171 'user-agent' => 'WordPress/' . $wp_version. '; ' . home_url( '/' ),168 'user-agent' => 'WordPress/' . wp_get_wp_version() . '; ' . home_url( '/' ), 172 169 ); 173 170 $request = wp_remote_get( $url, $http_args ); -
trunk/src/wp-admin/includes/theme.php
r58409 r58813 494 494 */ 495 495 function themes_api( $action, $args = array() ) { 496 // Include an unmodified $wp_version.497 require ABSPATH . WPINC . '/version.php';498 499 496 if ( is_array( $args ) ) { 500 497 $args = (object) $args; … … 512 509 513 510 if ( ! isset( $args->wp_version ) ) { 514 $args->wp_version = substr( $wp_version, 0, 3 ); // x.y511 $args->wp_version = substr( wp_get_wp_version(), 0, 3 ); // x.y 515 512 } 516 513 … … 563 560 $http_args = array( 564 561 'timeout' => 15, 565 'user-agent' => 'WordPress/' . $wp_version. '; ' . home_url( '/' ),562 'user-agent' => 'WordPress/' . wp_get_wp_version() . '; ' . home_url( '/' ), 566 563 ); 567 564 $request = wp_remote_get( $url, $http_args ); -
trunk/src/wp-admin/includes/translation-install.php
r58409 r58813 18 18 */ 19 19 function translations_api( $type, $args = null ) { 20 // Include an unmodified $wp_version.21 require ABSPATH . WPINC . '/version.php';22 23 20 if ( ! in_array( $type, array( 'plugins', 'themes', 'core' ), true ) ) { 24 21 return new WP_Error( 'invalid_type', __( 'Invalid translation type.' ) ); … … 47 44 'timeout' => 3, 48 45 'body' => array( 49 'wp_version' => $wp_version,46 'wp_version' => wp_get_wp_version(), 50 47 'locale' => get_locale(), 51 48 'version' => $args['version'], // Version of plugin, theme or core. … … 129 126 } 130 127 131 // Include an unmodified $wp_version. 132 require ABSPATH . WPINC . '/version.php'; 133 134 $api = translations_api( 'core', array( 'version' => $wp_version ) ); 128 $api = translations_api( 'core', array( 'version' => wp_get_wp_version() ) ); 135 129 136 130 if ( is_wp_error( $api ) || empty( $api['translations'] ) ) { -
trunk/src/wp-admin/includes/update.php
r58409 r58813 265 265 } 266 266 267 // Include an unmodified $wp_version. 268 require ABSPATH . WPINC . '/version.php'; 269 270 $is_development_version = preg_match( '/alpha|beta|RC/', $wp_version ); 267 $is_development_version = preg_match( '/alpha|beta|RC/', wp_get_wp_version() ); 271 268 272 269 if ( $is_development_version ) { … … 855 852 */ 856 853 function maintenance_nag() { 857 // Include an unmodified $wp_version.858 require ABSPATH . WPINC . '/version.php';859 854 global $upgrading; 860 855 … … 874 869 */ 875 870 $comparison = ! empty( $failed['critical'] ) ? '>=' : '>'; 876 if ( isset( $failed['attempted'] ) && version_compare( $failed['attempted'], $wp_version, $comparison ) ) {871 if ( isset( $failed['attempted'] ) && version_compare( $failed['attempted'], wp_get_wp_version(), $comparison ) ) { 877 872 $nag = true; 878 873 } -
trunk/src/wp-includes/functions.php
r58763 r58813 9007 9007 echo wp_kses_post( wp_get_admin_notice( $message, $args ) ); 9008 9008 } 9009 9010 /** 9011 * Returns the current WordPress Version. 9012 * 9013 * Returns an unmodified version of `$wp_version`. Some plugins modify the 9014 * global in an attempt to improve security through obscurity. This 9015 * practice can cause errors in WordPress so the ability to get an 9016 * unmodified version is needed. 9017 * 9018 * @since 6.7.0 9019 * 9020 * @return string The current WordPress Version. 9021 */ 9022 function wp_get_wp_version() { 9023 require ABSPATH . WPINC . '/version.php'; 9024 9025 return $wp_version; 9026 } -
trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-pattern-directory-controller.php
r56753 r58813 88 88 */ 89 89 public function get_items( $request ) { 90 /*91 * Include an unmodified `$wp_version`, so the API can craft a response that's tailored to92 * it. Some plugins modify the version in a misguided attempt to improve security by93 * obscuring the version, which can cause invalid requests.94 */95 require ABSPATH . WPINC . '/version.php';96 97 90 $valid_query_args = array( 98 91 'offset' => true, … … 107 100 108 101 $query_args['locale'] = get_user_locale(); 109 $query_args['wp-version'] = $wp_version;102 $query_args['wp-version'] = wp_get_wp_version(); 110 103 $query_args['pattern-categories'] = isset( $request['category'] ) ? $request['category'] : false; 111 104 $query_args['pattern-keywords'] = isset( $request['keyword'] ) ? $request['keyword'] : false; -
trunk/src/wp-includes/script-loader.php
r58800 r58813 685 685 686 686 if ( null === $suffixes ) { 687 // Include an unmodified $wp_version. 687 /* 688 * Include an unmodified $wp_version. 689 * 690 * Note: wp_get_wp_version() is not used here, as this file can be included 691 * via wp-admin/load-scripts.php or wp-admin/load-styles.php, in which case 692 * wp-includes/functions.php is not loaded. 693 */ 688 694 require ABSPATH . WPINC . '/version.php'; 689 695 … … 1523 1529 global $editor_styles; 1524 1530 1525 // Include an unmodified $wp_version. 1531 /* 1532 * Include an unmodified $wp_version. 1533 * 1534 * Note: wp_get_wp_version() is not used here, as this file can be included 1535 * via wp-admin/load-scripts.php or wp-admin/load-styles.php, in which case 1536 * wp-includes/functions.php is not loaded. 1537 */ 1526 1538 require ABSPATH . WPINC . '/version.php'; 1527 1539 -
trunk/src/wp-includes/update.php
r58409 r58813 32 32 } 33 33 34 // Include an unmodified $wp_version.35 require ABSPATH . WPINC . '/version.php';36 34 $php_version = PHP_VERSION; 37 35 … … 40 38 41 39 // Invalidate the transient when $wp_version changes. 42 if ( is_object( $current ) && $wp_version!== $current->version_checked ) {40 if ( is_object( $current ) && wp_get_wp_version() !== $current->version_checked ) { 43 41 $current = false; 44 42 } … … 47 45 $current = new stdClass(); 48 46 $current->updates = array(); 49 $current->version_checked = $wp_version;47 $current->version_checked = wp_get_wp_version(); 50 48 } 51 49 … … 96 94 sort( $extensions, SORT_STRING | SORT_FLAG_CASE ); 97 95 $query = array( 98 'version' => $wp_version,96 'version' => wp_get_wp_version(), 99 97 'php' => $php_version, 100 98 'locale' => $locale, … … 192 190 $options = array( 193 191 'timeout' => $doing_cron ? 30 : 3, 194 'user-agent' => 'WordPress/' . $wp_version. '; ' . home_url( '/' ),192 'user-agent' => 'WordPress/' . wp_get_wp_version() . '; ' . home_url( '/' ), 195 193 'headers' => array( 196 194 'wp_install' => $wp_install, … … 267 265 $updates->updates = $offers; 268 266 $updates->last_checked = time(); 269 $updates->version_checked = $wp_version;267 $updates->version_checked = wp_get_wp_version(); 270 268 271 269 if ( isset( $body['translations'] ) ) { … … 315 313 return; 316 314 } 317 318 // Include an unmodified $wp_version.319 require ABSPATH . WPINC . '/version.php';320 315 321 316 // If running blog-side, bail unless we've not checked in the last 12 hours. … … 424 419 'all' => wp_json_encode( true ), 425 420 ), 426 'user-agent' => 'WordPress/' . $wp_version. '; ' . home_url( '/' ),421 'user-agent' => 'WordPress/' . wp_get_wp_version() . '; ' . home_url( '/' ), 427 422 ); 428 423 … … 591 586 } 592 587 593 // Include an unmodified $wp_version.594 require ABSPATH . WPINC . '/version.php';595 596 588 $installed_themes = wp_get_themes(); 597 589 $translations = wp_get_installed_translations( 'themes' ); … … 706 698 'locale' => wp_json_encode( $locales ), 707 699 ), 708 'user-agent' => 'WordPress/' . $wp_version. '; ' . home_url( '/' ),700 'user-agent' => 'WordPress/' . wp_get_wp_version() . '; ' . home_url( '/' ), 709 701 ); 710 702 … … 990 982 */ 991 983 function _maybe_update_core() { 992 // Include an unmodified $wp_version.993 require ABSPATH . WPINC . '/version.php';994 995 984 $current = get_site_transient( 'update_core' ); 996 985 997 986 if ( isset( $current->last_checked, $current->version_checked ) 998 987 && 12 * HOUR_IN_SECONDS > ( time() - $current->last_checked ) 999 && $current->version_checked === $wp_version988 && wp_get_wp_version() === $current->version_checked 1000 989 ) { 1001 990 return;
Note: See TracChangeset
for help on using the changeset viewer.