Ticket #32845: 32845.01.patch
File 32845.01.patch, 10.5 KB (added by , 9 years ago) |
---|
-
src/wp-includes/plugin.php
35 35 $wp_current_filter = array(); 36 36 37 37 /** 38 * Helper function for including files in a filterable manner 39 * 40 * @since 4.4.0 41 * 42 * @param string $file Full path to the file to include 43 * @param bool $required True to require|False to include 44 * @param bool $once True to use _once|False not to 45 * 46 * @return void 47 */ 48 function wp_include( $file = '', $required = true, $once = false ) { 49 50 // Combine parameters into an array of arguments 51 $args = array( 52 'file' => $file, 53 'required' => $required, 54 'once' => $once 55 ); 56 57 /** 58 * Filter the file to include, and how to include it 59 * 60 * @since 4.4.0 61 * 62 * @param array $args An array built from the function parameters 63 */ 64 $r = apply_filters( 'wp_include', $args ); 65 66 // Overwrite local variables with filtered ones 67 extract( $r ); 68 69 // `require()` or `include()` 70 $func = ( true === $required ) 71 ? 'require' 72 : 'include'; 73 74 // `require_once()` or `include_once()` 75 $func .= ( true === $once ) 76 ? '_once' 77 : ''; 78 79 // Include/require the file, maybe one time only 80 call_user_func( $func, $file ); 81 } 82 83 /** 38 84 * Hook a function or method to a specific filter action. 39 85 * 40 86 * WordPress offers filter hooks to allow plugins to modify -
src/wp-settings.php
18 18 define( 'WPINC', 'wp-includes' ); 19 19 20 20 // Include files required for initialization. 21 require( ABSPATH . WPINC . '/load.php' );22 require( ABSPATH . WPINC . '/default-constants.php' );21 wp_include( ABSPATH . WPINC . '/load.php' ); 22 wp_include( ABSPATH . WPINC . '/default-constants.php' ); 23 23 24 24 /* 25 25 * These can't be directly globalized in version.php. When updating, … … 27 27 * these values to be overridden if already set. 28 28 */ 29 29 global $wp_version, $wp_db_version, $tinymce_version, $required_php_version, $required_mysql_version; 30 require( ABSPATH . WPINC . '/version.php' );30 wp_include( ABSPATH . WPINC . '/version.php' ); 31 31 32 32 // Set initial default constants including WP_MEMORY_LIMIT, WP_MAX_MEMORY_LIMIT, WP_DEBUG, SCRIPT_DEBUG, WP_CONTENT_DIR and WP_CACHE. 33 33 wp_initial_constants(); … … 68 68 wp_set_lang_dir(); 69 69 70 70 // Load early WordPress files. 71 require( ABSPATH . WPINC . '/compat.php' );72 require( ABSPATH . WPINC . '/functions.php' );73 require( ABSPATH . WPINC . '/class-wp.php' );74 require( ABSPATH . WPINC . '/class-wp-error.php' );75 require( ABSPATH . WPINC . '/plugin.php' );76 require( ABSPATH . WPINC . '/pomo/mo.php' );71 wp_include( ABSPATH . WPINC . '/compat.php' ); 72 wp_include( ABSPATH . WPINC . '/functions.php' ); 73 wp_include( ABSPATH . WPINC . '/class-wp.php' ); 74 wp_include( ABSPATH . WPINC . '/class-wp-error.php' ); 75 wp_include( ABSPATH . WPINC . '/plugin.php' ); 76 wp_include( ABSPATH . WPINC . '/pomo/mo.php' ); 77 77 78 78 // Include the wpdb class and, if present, a db.php database drop-in. 79 79 require_wp_db(); … … 86 86 wp_start_object_cache(); 87 87 88 88 // Attach the default filters. 89 require( ABSPATH . WPINC . '/default-filters.php' );89 wp_include( ABSPATH . WPINC . '/default-filters.php' ); 90 90 91 91 // Initialize multisite if enabled. 92 92 if ( is_multisite() ) { 93 require( ABSPATH . WPINC . '/ms-blogs.php' );94 require( ABSPATH . WPINC . '/ms-settings.php' );93 wp_include( ABSPATH . WPINC . '/ms-blogs.php' ); 94 wp_include( ABSPATH . WPINC . '/ms-settings.php' ); 95 95 } elseif ( ! defined( 'MULTISITE' ) ) { 96 96 define( 'MULTISITE', false ); 97 97 } … … 103 103 return false; 104 104 105 105 // Load the L10n library. 106 require_once( ABSPATH . WPINC . '/l10n.php');106 wp_include( ABSPATH . WPINC . '/l10n.php', true, true ); 107 107 108 108 // Run the installer if WordPress is not installed. 109 109 wp_not_installed(); 110 110 111 111 // Load most of WordPress. 112 require( ABSPATH . WPINC . '/class-wp-walker.php' );113 require( ABSPATH . WPINC . '/class-wp-ajax-response.php' );114 require( ABSPATH . WPINC . '/formatting.php' );115 require( ABSPATH . WPINC . '/capabilities.php' );116 require( ABSPATH . WPINC . '/query.php' );117 require( ABSPATH . WPINC . '/date.php' );118 require( ABSPATH . WPINC . '/theme.php' );119 require( ABSPATH . WPINC . '/class-wp-theme.php' );120 require( ABSPATH . WPINC . '/template.php' );121 require( ABSPATH . WPINC . '/user.php' );122 require( ABSPATH . WPINC . '/session.php' );123 require( ABSPATH . WPINC . '/meta.php' );124 require( ABSPATH . WPINC . '/general-template.php' );125 require( ABSPATH . WPINC . '/link-template.php' );126 require( ABSPATH . WPINC . '/author-template.php' );127 require( ABSPATH . WPINC . '/post.php' );128 require( ABSPATH . WPINC . '/post-template.php' );129 require( ABSPATH . WPINC . '/revision.php' );130 require( ABSPATH . WPINC . '/post-formats.php' );131 require( ABSPATH . WPINC . '/post-thumbnail-template.php' );132 require( ABSPATH . WPINC . '/category.php' );133 require( ABSPATH . WPINC . '/category-template.php' );134 require( ABSPATH . WPINC . '/comment.php' );135 require( ABSPATH . WPINC . '/comment-template.php' );136 require( ABSPATH . WPINC . '/rewrite.php' );137 require( ABSPATH . WPINC . '/feed.php' );138 require( ABSPATH . WPINC . '/bookmark.php' );139 require( ABSPATH . WPINC . '/bookmark-template.php' );140 require( ABSPATH . WPINC . '/kses.php' );141 require( ABSPATH . WPINC . '/cron.php' );142 require( ABSPATH . WPINC . '/deprecated.php' );143 require( ABSPATH . WPINC . '/script-loader.php' );144 require( ABSPATH . WPINC . '/taxonomy.php' );145 require( ABSPATH . WPINC . '/update.php' );146 require( ABSPATH . WPINC . '/canonical.php' );147 require( ABSPATH . WPINC . '/shortcodes.php' );148 require( ABSPATH . WPINC . '/class-wp-embed.php' );149 require( ABSPATH . WPINC . '/media.php' );150 require( ABSPATH . WPINC . '/http.php' );151 require( ABSPATH . WPINC . '/class-http.php' );152 require( ABSPATH . WPINC . '/widgets.php' );153 require( ABSPATH . WPINC . '/nav-menu.php' );154 require( ABSPATH . WPINC . '/nav-menu-template.php' );155 require( ABSPATH . WPINC . '/admin-bar.php' );112 wp_include( ABSPATH . WPINC . '/class-wp-walker.php' ); 113 wp_include( ABSPATH . WPINC . '/class-wp-ajax-response.php' ); 114 wp_include( ABSPATH . WPINC . '/formatting.php' ); 115 wp_include( ABSPATH . WPINC . '/capabilities.php' ); 116 wp_include( ABSPATH . WPINC . '/query.php' ); 117 wp_include( ABSPATH . WPINC . '/date.php' ); 118 wp_include( ABSPATH . WPINC . '/theme.php' ); 119 wp_include( ABSPATH . WPINC . '/class-wp-theme.php' ); 120 wp_include( ABSPATH . WPINC . '/template.php' ); 121 wp_include( ABSPATH . WPINC . '/user.php' ); 122 wp_include( ABSPATH . WPINC . '/session.php' ); 123 wp_include( ABSPATH . WPINC . '/meta.php' ); 124 wp_include( ABSPATH . WPINC . '/general-template.php' ); 125 wp_include( ABSPATH . WPINC . '/link-template.php' ); 126 wp_include( ABSPATH . WPINC . '/author-template.php' ); 127 wp_include( ABSPATH . WPINC . '/post.php' ); 128 wp_include( ABSPATH . WPINC . '/post-template.php' ); 129 wp_include( ABSPATH . WPINC . '/revision.php' ); 130 wp_include( ABSPATH . WPINC . '/post-formats.php' ); 131 wp_include( ABSPATH . WPINC . '/post-thumbnail-template.php' ); 132 wp_include( ABSPATH . WPINC . '/category.php' ); 133 wp_include( ABSPATH . WPINC . '/category-template.php' ); 134 wp_include( ABSPATH . WPINC . '/comment.php' ); 135 wp_include( ABSPATH . WPINC . '/comment-template.php' ); 136 wp_include( ABSPATH . WPINC . '/rewrite.php' ); 137 wp_include( ABSPATH . WPINC . '/feed.php' ); 138 wp_include( ABSPATH . WPINC . '/bookmark.php' ); 139 wp_include( ABSPATH . WPINC . '/bookmark-template.php' ); 140 wp_include( ABSPATH . WPINC . '/kses.php' ); 141 wp_include( ABSPATH . WPINC . '/cron.php' ); 142 wp_include( ABSPATH . WPINC . '/deprecated.php' ); 143 wp_include( ABSPATH . WPINC . '/script-loader.php' ); 144 wp_include( ABSPATH . WPINC . '/taxonomy.php' ); 145 wp_include( ABSPATH . WPINC . '/update.php' ); 146 wp_include( ABSPATH . WPINC . '/canonical.php' ); 147 wp_include( ABSPATH . WPINC . '/shortcodes.php' ); 148 wp_include( ABSPATH . WPINC . '/class-wp-embed.php' ); 149 wp_include( ABSPATH . WPINC . '/media.php' ); 150 wp_include( ABSPATH . WPINC . '/http.php' ); 151 wp_include( ABSPATH . WPINC . '/class-http.php' ); 152 wp_include( ABSPATH . WPINC . '/widgets.php' ); 153 wp_include( ABSPATH . WPINC . '/nav-menu.php' ); 154 wp_include( ABSPATH . WPINC . '/nav-menu-template.php' ); 155 wp_include( ABSPATH . WPINC . '/admin-bar.php' ); 156 156 157 157 // Load multisite-specific files. 158 158 if ( is_multisite() ) { 159 require( ABSPATH . WPINC . '/ms-functions.php' );160 require( ABSPATH . WPINC . '/ms-default-filters.php' );161 require( ABSPATH . WPINC . '/ms-deprecated.php' );159 wp_include( ABSPATH . WPINC . '/ms-functions.php' ); 160 wp_include( ABSPATH . WPINC . '/ms-default-filters.php' ); 161 wp_include( ABSPATH . WPINC . '/ms-deprecated.php' ); 162 162 } 163 163 164 164 // Define constants that rely on the API to obtain the default value. … … 169 169 170 170 // Load must-use plugins. 171 171 foreach ( wp_get_mu_plugins() as $mu_plugin ) { 172 include_once( $mu_plugin);172 wp_include( $mu_plugin, false, true ); 173 173 } 174 174 unset( $mu_plugin ); 175 175 … … 177 177 if ( is_multisite() ) { 178 178 foreach( wp_get_active_network_plugins() as $network_plugin ) { 179 179 wp_register_plugin_realpath( $network_plugin ); 180 include_once( $network_plugin);180 wp_include( $network_plugin, false, true ); 181 181 } 182 182 unset( $network_plugin ); 183 183 } … … 199 199 wp_ssl_constants(); 200 200 201 201 // Create common globals. 202 require( ABSPATH . WPINC . '/vars.php' );202 wp_include( ABSPATH . WPINC . '/vars.php' ); 203 203 204 204 // Make taxonomies and posts available to plugins and themes. 205 205 // @plugin authors: warning: these get registered again on the init hook. … … 212 212 // Load active plugins. 213 213 foreach ( wp_get_active_and_valid_plugins() as $plugin ) { 214 214 wp_register_plugin_realpath( $plugin ); 215 include_once( $plugin);215 wp_include( $plugin, false, true ); 216 216 } 217 217 unset( $plugin ); 218 218 219 219 // Load pluggable functions. 220 require( ABSPATH . WPINC . '/pluggable.php' );221 require( ABSPATH . WPINC . '/pluggable-deprecated.php' );220 wp_include( ABSPATH . WPINC . '/pluggable.php' ); 221 wp_include( ABSPATH . WPINC . '/pluggable-deprecated.php' ); 222 222 223 223 // Set internal encoding. 224 224 wp_set_internal_encoding(); … … 308 308 $locale = get_locale(); 309 309 $locale_file = WP_LANG_DIR . "/$locale.php"; 310 310 if ( ( 0 === validate_file( $locale ) ) && is_readable( $locale_file ) ) 311 require( $locale_file );311 wp_include( $locale_file ); 312 312 unset( $locale_file ); 313 313 314 314 // Pull in locale data after loading text domain. 315 require_once( ABSPATH . WPINC . '/locale.php');315 wp_include( ABSPATH . WPINC . '/locale.php', true, true ); 316 316 317 317 /** 318 318 * WordPress Locale object for loading locale domain date and various strings. … … 355 355 // Check site status 356 356 if ( is_multisite() ) { 357 357 if ( true !== ( $file = ms_site_check() ) ) { 358 require( $file );358 wp_include( $file ); 359 359 die(); 360 360 } 361 361 unset($file);