wp/wp-settings.php
changeset 7 cf61fcea0001
parent 5 5e2f62d02dcd
child 9 177826044cd9
equal deleted inserted replaced
6:490d5cc509ed 7:cf61fcea0001
     2 /**
     2 /**
     3  * Used to set up and fix common variables and include
     3  * Used to set up and fix common variables and include
     4  * the WordPress procedural and class library.
     4  * the WordPress procedural and class library.
     5  *
     5  *
     6  * Allows for some configuration in wp-config.php (see default-constants.php)
     6  * Allows for some configuration in wp-config.php (see default-constants.php)
     7  *
       
     8  * @internal This file must be parsable by PHP4.
       
     9  *
     7  *
    10  * @package WordPress
     8  * @package WordPress
    11  */
     9  */
    12 
    10 
    13 /**
    11 /**
    18 define( 'WPINC', 'wp-includes' );
    16 define( 'WPINC', 'wp-includes' );
    19 
    17 
    20 // Include files required for initialization.
    18 // Include files required for initialization.
    21 require( ABSPATH . WPINC . '/load.php' );
    19 require( ABSPATH . WPINC . '/load.php' );
    22 require( ABSPATH . WPINC . '/default-constants.php' );
    20 require( ABSPATH . WPINC . '/default-constants.php' );
       
    21 require_once( ABSPATH . WPINC . '/plugin.php' );
    23 
    22 
    24 /*
    23 /*
    25  * These can't be directly globalized in version.php. When updating,
    24  * These can't be directly globalized in version.php. When updating,
    26  * we're including version.php from another install and don't want
    25  * we're including version.php from another installation and don't want
    27  * these values to be overridden if already set.
    26  * these values to be overridden if already set.
    28  */
    27  */
    29 global $wp_version, $wp_db_version, $tinymce_version, $required_php_version, $required_mysql_version;
    28 global $wp_version, $wp_db_version, $tinymce_version, $required_php_version, $required_mysql_version, $wp_local_package;
    30 require( ABSPATH . WPINC . '/version.php' );
    29 require( ABSPATH . WPINC . '/version.php' );
    31 
    30 
    32 // Set initial default constants including WP_MEMORY_LIMIT, WP_MAX_MEMORY_LIMIT, WP_DEBUG, WP_CONTENT_DIR and WP_CACHE.
    31 /**
       
    32  * If not already configured, `$blog_id` will default to 1 in a single site
       
    33  * configuration. In multisite, it will be overridden by default in ms-settings.php.
       
    34  *
       
    35  * @global int $blog_id
       
    36  * @since 2.0.0
       
    37  */
       
    38 global $blog_id;
       
    39 
       
    40 // Set initial default constants including WP_MEMORY_LIMIT, WP_MAX_MEMORY_LIMIT, WP_DEBUG, SCRIPT_DEBUG, WP_CONTENT_DIR and WP_CACHE.
    33 wp_initial_constants();
    41 wp_initial_constants();
    34 
    42 
    35 // Check for the required PHP version and for the MySQL extension or a database drop-in.
    43 // Check for the required PHP version and for the MySQL extension or a database drop-in.
    36 wp_check_php_mysql_versions();
    44 wp_check_php_mysql_versions();
    37 
    45 
    58 timer_start();
    66 timer_start();
    59 
    67 
    60 // Check if we're in WP_DEBUG mode.
    68 // Check if we're in WP_DEBUG mode.
    61 wp_debug_mode();
    69 wp_debug_mode();
    62 
    70 
    63 // For an advanced caching plugin to use. Uses a static drop-in because you would only want one.
    71 /**
    64 if ( WP_CACHE )
    72  * Filters whether to enable loading of the advanced-cache.php drop-in.
       
    73  *
       
    74  * This filter runs before it can be used by plugins. It is designed for non-web
       
    75  * run-times. If false is returned, advanced-cache.php will never be loaded.
       
    76  *
       
    77  * @since 4.6.0
       
    78  *
       
    79  * @param bool $enable_advanced_cache Whether to enable loading advanced-cache.php (if present).
       
    80  *                                    Default true.
       
    81  */
       
    82 if ( WP_CACHE && apply_filters( 'enable_loading_advanced_cache_dropin', true ) ) {
       
    83 	// For an advanced caching plugin to use. Uses a static drop-in because you would only want one.
    65 	WP_DEBUG ? include( WP_CONTENT_DIR . '/advanced-cache.php' ) : @include( WP_CONTENT_DIR . '/advanced-cache.php' );
    84 	WP_DEBUG ? include( WP_CONTENT_DIR . '/advanced-cache.php' ) : @include( WP_CONTENT_DIR . '/advanced-cache.php' );
       
    85 
       
    86 	// Re-initialize any hooks added manually by advanced-cache.php
       
    87 	if ( $wp_filter ) {
       
    88 		$wp_filter = WP_Hook::build_preinitialized_hooks( $wp_filter );
       
    89 	}
       
    90 }
    66 
    91 
    67 // Define WP_LANG_DIR if not set.
    92 // Define WP_LANG_DIR if not set.
    68 wp_set_lang_dir();
    93 wp_set_lang_dir();
    69 
    94 
    70 // Load early WordPress files.
    95 // Load early WordPress files.
    71 require( ABSPATH . WPINC . '/compat.php' );
    96 require( ABSPATH . WPINC . '/compat.php' );
       
    97 require( ABSPATH . WPINC . '/class-wp-list-util.php' );
    72 require( ABSPATH . WPINC . '/functions.php' );
    98 require( ABSPATH . WPINC . '/functions.php' );
       
    99 require( ABSPATH . WPINC . '/class-wp-matchesmapregex.php' );
    73 require( ABSPATH . WPINC . '/class-wp.php' );
   100 require( ABSPATH . WPINC . '/class-wp.php' );
    74 require( ABSPATH . WPINC . '/class-wp-error.php' );
   101 require( ABSPATH . WPINC . '/class-wp-error.php' );
    75 require( ABSPATH . WPINC . '/plugin.php' );
       
    76 require( ABSPATH . WPINC . '/pomo/mo.php' );
   102 require( ABSPATH . WPINC . '/pomo/mo.php' );
    77 
   103 
    78 // Include the wpdb class and, if present, a db.php database drop-in.
   104 // Include the wpdb class and, if present, a db.php database drop-in.
       
   105 global $wpdb;
    79 require_wp_db();
   106 require_wp_db();
    80 
   107 
    81 // Set the database table prefix and the format specifiers for database table columns.
   108 // Set the database table prefix and the format specifiers for database table columns.
    82 $GLOBALS['table_prefix'] = $table_prefix;
   109 $GLOBALS['table_prefix'] = $table_prefix;
    83 wp_set_wpdb_vars();
   110 wp_set_wpdb_vars();
    88 // Attach the default filters.
   115 // Attach the default filters.
    89 require( ABSPATH . WPINC . '/default-filters.php' );
   116 require( ABSPATH . WPINC . '/default-filters.php' );
    90 
   117 
    91 // Initialize multisite if enabled.
   118 // Initialize multisite if enabled.
    92 if ( is_multisite() ) {
   119 if ( is_multisite() ) {
       
   120 	require( ABSPATH . WPINC . '/class-wp-site-query.php' );
       
   121 	require( ABSPATH . WPINC . '/class-wp-network-query.php' );
    93 	require( ABSPATH . WPINC . '/ms-blogs.php' );
   122 	require( ABSPATH . WPINC . '/ms-blogs.php' );
    94 	require( ABSPATH . WPINC . '/ms-settings.php' );
   123 	require( ABSPATH . WPINC . '/ms-settings.php' );
    95 } elseif ( ! defined( 'MULTISITE' ) ) {
   124 } elseif ( ! defined( 'MULTISITE' ) ) {
    96 	define( 'MULTISITE', false );
   125 	define( 'MULTISITE', false );
    97 }
   126 }
   102 if ( SHORTINIT )
   131 if ( SHORTINIT )
   103 	return false;
   132 	return false;
   104 
   133 
   105 // Load the L10n library.
   134 // Load the L10n library.
   106 require_once( ABSPATH . WPINC . '/l10n.php' );
   135 require_once( ABSPATH . WPINC . '/l10n.php' );
       
   136 require_once( ABSPATH . WPINC . '/class-wp-locale.php' );
       
   137 require_once( ABSPATH . WPINC . '/class-wp-locale-switcher.php' );
   107 
   138 
   108 // Run the installer if WordPress is not installed.
   139 // Run the installer if WordPress is not installed.
   109 wp_not_installed();
   140 wp_not_installed();
   110 
   141 
   111 // Load most of WordPress.
   142 // Load most of WordPress.
   112 require( ABSPATH . WPINC . '/class-wp-walker.php' );
   143 require( ABSPATH . WPINC . '/class-wp-walker.php' );
   113 require( ABSPATH . WPINC . '/class-wp-ajax-response.php' );
   144 require( ABSPATH . WPINC . '/class-wp-ajax-response.php' );
   114 require( ABSPATH . WPINC . '/formatting.php' );
   145 require( ABSPATH . WPINC . '/formatting.php' );
   115 require( ABSPATH . WPINC . '/capabilities.php' );
   146 require( ABSPATH . WPINC . '/capabilities.php' );
       
   147 require( ABSPATH . WPINC . '/class-wp-roles.php' );
       
   148 require( ABSPATH . WPINC . '/class-wp-role.php' );
       
   149 require( ABSPATH . WPINC . '/class-wp-user.php' );
       
   150 require( ABSPATH . WPINC . '/class-wp-query.php' );
   116 require( ABSPATH . WPINC . '/query.php' );
   151 require( ABSPATH . WPINC . '/query.php' );
   117 require( ABSPATH . WPINC . '/date.php' );
   152 require( ABSPATH . WPINC . '/date.php' );
   118 require( ABSPATH . WPINC . '/theme.php' );
   153 require( ABSPATH . WPINC . '/theme.php' );
   119 require( ABSPATH . WPINC . '/class-wp-theme.php' );
   154 require( ABSPATH . WPINC . '/class-wp-theme.php' );
   120 require( ABSPATH . WPINC . '/template.php' );
   155 require( ABSPATH . WPINC . '/template.php' );
   121 require( ABSPATH . WPINC . '/user.php' );
   156 require( ABSPATH . WPINC . '/user.php' );
   122 require( ABSPATH . WPINC . '/session.php' );
   157 require( ABSPATH . WPINC . '/class-wp-user-query.php' );
       
   158 require( ABSPATH . WPINC . '/class-wp-session-tokens.php' );
       
   159 require( ABSPATH . WPINC . '/class-wp-user-meta-session-tokens.php' );
   123 require( ABSPATH . WPINC . '/meta.php' );
   160 require( ABSPATH . WPINC . '/meta.php' );
       
   161 require( ABSPATH . WPINC . '/class-wp-meta-query.php' );
       
   162 require( ABSPATH . WPINC . '/class-wp-metadata-lazyloader.php' );
   124 require( ABSPATH . WPINC . '/general-template.php' );
   163 require( ABSPATH . WPINC . '/general-template.php' );
   125 require( ABSPATH . WPINC . '/link-template.php' );
   164 require( ABSPATH . WPINC . '/link-template.php' );
   126 require( ABSPATH . WPINC . '/author-template.php' );
   165 require( ABSPATH . WPINC . '/author-template.php' );
   127 require( ABSPATH . WPINC . '/post.php' );
   166 require( ABSPATH . WPINC . '/post.php' );
       
   167 require( ABSPATH . WPINC . '/class-walker-page.php' );
       
   168 require( ABSPATH . WPINC . '/class-walker-page-dropdown.php' );
       
   169 require( ABSPATH . WPINC . '/class-wp-post-type.php' );
       
   170 require( ABSPATH . WPINC . '/class-wp-post.php' );
   128 require( ABSPATH . WPINC . '/post-template.php' );
   171 require( ABSPATH . WPINC . '/post-template.php' );
   129 require( ABSPATH . WPINC . '/revision.php' );
   172 require( ABSPATH . WPINC . '/revision.php' );
   130 require( ABSPATH . WPINC . '/post-formats.php' );
   173 require( ABSPATH . WPINC . '/post-formats.php' );
   131 require( ABSPATH . WPINC . '/post-thumbnail-template.php' );
   174 require( ABSPATH . WPINC . '/post-thumbnail-template.php' );
   132 require( ABSPATH . WPINC . '/category.php' );
   175 require( ABSPATH . WPINC . '/category.php' );
       
   176 require( ABSPATH . WPINC . '/class-walker-category.php' );
       
   177 require( ABSPATH . WPINC . '/class-walker-category-dropdown.php' );
   133 require( ABSPATH . WPINC . '/category-template.php' );
   178 require( ABSPATH . WPINC . '/category-template.php' );
   134 require( ABSPATH . WPINC . '/comment.php' );
   179 require( ABSPATH . WPINC . '/comment.php' );
       
   180 require( ABSPATH . WPINC . '/class-wp-comment.php' );
       
   181 require( ABSPATH . WPINC . '/class-wp-comment-query.php' );
       
   182 require( ABSPATH . WPINC . '/class-walker-comment.php' );
   135 require( ABSPATH . WPINC . '/comment-template.php' );
   183 require( ABSPATH . WPINC . '/comment-template.php' );
   136 require( ABSPATH . WPINC . '/rewrite.php' );
   184 require( ABSPATH . WPINC . '/rewrite.php' );
       
   185 require( ABSPATH . WPINC . '/class-wp-rewrite.php' );
   137 require( ABSPATH . WPINC . '/feed.php' );
   186 require( ABSPATH . WPINC . '/feed.php' );
   138 require( ABSPATH . WPINC . '/bookmark.php' );
   187 require( ABSPATH . WPINC . '/bookmark.php' );
   139 require( ABSPATH . WPINC . '/bookmark-template.php' );
   188 require( ABSPATH . WPINC . '/bookmark-template.php' );
   140 require( ABSPATH . WPINC . '/kses.php' );
   189 require( ABSPATH . WPINC . '/kses.php' );
   141 require( ABSPATH . WPINC . '/cron.php' );
   190 require( ABSPATH . WPINC . '/cron.php' );
   142 require( ABSPATH . WPINC . '/deprecated.php' );
   191 require( ABSPATH . WPINC . '/deprecated.php' );
   143 require( ABSPATH . WPINC . '/script-loader.php' );
   192 require( ABSPATH . WPINC . '/script-loader.php' );
   144 require( ABSPATH . WPINC . '/taxonomy.php' );
   193 require( ABSPATH . WPINC . '/taxonomy.php' );
       
   194 require( ABSPATH . WPINC . '/class-wp-taxonomy.php' );
       
   195 require( ABSPATH . WPINC . '/class-wp-term.php' );
       
   196 require( ABSPATH . WPINC . '/class-wp-term-query.php' );
       
   197 require( ABSPATH . WPINC . '/class-wp-tax-query.php' );
   145 require( ABSPATH . WPINC . '/update.php' );
   198 require( ABSPATH . WPINC . '/update.php' );
   146 require( ABSPATH . WPINC . '/canonical.php' );
   199 require( ABSPATH . WPINC . '/canonical.php' );
   147 require( ABSPATH . WPINC . '/shortcodes.php' );
   200 require( ABSPATH . WPINC . '/shortcodes.php' );
       
   201 require( ABSPATH . WPINC . '/embed.php' );
   148 require( ABSPATH . WPINC . '/class-wp-embed.php' );
   202 require( ABSPATH . WPINC . '/class-wp-embed.php' );
       
   203 require( ABSPATH . WPINC . '/class-oembed.php' );
       
   204 require( ABSPATH . WPINC . '/class-wp-oembed-controller.php' );
   149 require( ABSPATH . WPINC . '/media.php' );
   205 require( ABSPATH . WPINC . '/media.php' );
   150 require( ABSPATH . WPINC . '/http.php' );
   206 require( ABSPATH . WPINC . '/http.php' );
   151 require( ABSPATH . WPINC . '/class-http.php' );
   207 require( ABSPATH . WPINC . '/class-http.php' );
       
   208 require( ABSPATH . WPINC . '/class-wp-http-streams.php' );
       
   209 require( ABSPATH . WPINC . '/class-wp-http-curl.php' );
       
   210 require( ABSPATH . WPINC . '/class-wp-http-proxy.php' );
       
   211 require( ABSPATH . WPINC . '/class-wp-http-cookie.php' );
       
   212 require( ABSPATH . WPINC . '/class-wp-http-encoding.php' );
       
   213 require( ABSPATH . WPINC . '/class-wp-http-response.php' );
       
   214 require( ABSPATH . WPINC . '/class-wp-http-requests-response.php' );
       
   215 require( ABSPATH . WPINC . '/class-wp-http-requests-hooks.php' );
   152 require( ABSPATH . WPINC . '/widgets.php' );
   216 require( ABSPATH . WPINC . '/widgets.php' );
       
   217 require( ABSPATH . WPINC . '/class-wp-widget.php' );
       
   218 require( ABSPATH . WPINC . '/class-wp-widget-factory.php' );
   153 require( ABSPATH . WPINC . '/nav-menu.php' );
   219 require( ABSPATH . WPINC . '/nav-menu.php' );
   154 require( ABSPATH . WPINC . '/nav-menu-template.php' );
   220 require( ABSPATH . WPINC . '/nav-menu-template.php' );
   155 require( ABSPATH . WPINC . '/admin-bar.php' );
   221 require( ABSPATH . WPINC . '/admin-bar.php' );
       
   222 require( ABSPATH . WPINC . '/rest-api.php' );
       
   223 require( ABSPATH . WPINC . '/rest-api/class-wp-rest-server.php' );
       
   224 require( ABSPATH . WPINC . '/rest-api/class-wp-rest-response.php' );
       
   225 require( ABSPATH . WPINC . '/rest-api/class-wp-rest-request.php' );
       
   226 require( ABSPATH . WPINC . '/rest-api/endpoints/class-wp-rest-controller.php' );
       
   227 require( ABSPATH . WPINC . '/rest-api/endpoints/class-wp-rest-posts-controller.php' );
       
   228 require( ABSPATH . WPINC . '/rest-api/endpoints/class-wp-rest-attachments-controller.php' );
       
   229 require( ABSPATH . WPINC . '/rest-api/endpoints/class-wp-rest-post-types-controller.php' );
       
   230 require( ABSPATH . WPINC . '/rest-api/endpoints/class-wp-rest-post-statuses-controller.php' );
       
   231 require( ABSPATH . WPINC . '/rest-api/endpoints/class-wp-rest-revisions-controller.php' );
       
   232 require( ABSPATH . WPINC . '/rest-api/endpoints/class-wp-rest-taxonomies-controller.php' );
       
   233 require( ABSPATH . WPINC . '/rest-api/endpoints/class-wp-rest-terms-controller.php' );
       
   234 require( ABSPATH . WPINC . '/rest-api/endpoints/class-wp-rest-users-controller.php' );
       
   235 require( ABSPATH . WPINC . '/rest-api/endpoints/class-wp-rest-comments-controller.php' );
       
   236 require( ABSPATH . WPINC . '/rest-api/endpoints/class-wp-rest-settings-controller.php' );
       
   237 require( ABSPATH . WPINC . '/rest-api/fields/class-wp-rest-meta-fields.php' );
       
   238 require( ABSPATH . WPINC . '/rest-api/fields/class-wp-rest-comment-meta-fields.php' );
       
   239 require( ABSPATH . WPINC . '/rest-api/fields/class-wp-rest-post-meta-fields.php' );
       
   240 require( ABSPATH . WPINC . '/rest-api/fields/class-wp-rest-term-meta-fields.php' );
       
   241 require( ABSPATH . WPINC . '/rest-api/fields/class-wp-rest-user-meta-fields.php' );
       
   242 
       
   243 $GLOBALS['wp_embed'] = new WP_Embed();
   156 
   244 
   157 // Load multisite-specific files.
   245 // Load multisite-specific files.
   158 if ( is_multisite() ) {
   246 if ( is_multisite() ) {
   159 	require( ABSPATH . WPINC . '/ms-functions.php' );
   247 	require( ABSPATH . WPINC . '/ms-functions.php' );
   160 	require( ABSPATH . WPINC . '/ms-default-filters.php' );
   248 	require( ABSPATH . WPINC . '/ms-default-filters.php' );
   173 }
   261 }
   174 unset( $mu_plugin );
   262 unset( $mu_plugin );
   175 
   263 
   176 // Load network activated plugins.
   264 // Load network activated plugins.
   177 if ( is_multisite() ) {
   265 if ( is_multisite() ) {
   178 	foreach( wp_get_active_network_plugins() as $network_plugin ) {
   266 	foreach ( wp_get_active_network_plugins() as $network_plugin ) {
   179 		wp_register_plugin_realpath( $network_plugin );
   267 		wp_register_plugin_realpath( $network_plugin );
   180 		include_once( $network_plugin );
   268 		include_once( $network_plugin );
   181 	}
   269 	}
   182 	unset( $network_plugin );
   270 	unset( $network_plugin );
   183 }
   271 }
   204 // Make taxonomies and posts available to plugins and themes.
   292 // Make taxonomies and posts available to plugins and themes.
   205 // @plugin authors: warning: these get registered again on the init hook.
   293 // @plugin authors: warning: these get registered again on the init hook.
   206 create_initial_taxonomies();
   294 create_initial_taxonomies();
   207 create_initial_post_types();
   295 create_initial_post_types();
   208 
   296 
       
   297 wp_start_scraping_edited_file_errors();
       
   298 
   209 // Register the default theme directory root
   299 // Register the default theme directory root
   210 register_theme_directory( get_theme_root() );
   300 register_theme_directory( get_theme_root() );
   211 
   301 
   212 // Load active plugins.
   302 // Load active plugins.
   213 foreach ( wp_get_active_and_valid_plugins() as $plugin ) {
   303 foreach ( wp_get_active_and_valid_plugins() as $plugin ) {
   249  */
   339  */
   250 do_action( 'sanitize_comment_cookies' );
   340 do_action( 'sanitize_comment_cookies' );
   251 
   341 
   252 /**
   342 /**
   253  * WordPress Query object
   343  * WordPress Query object
   254  * @global object $wp_the_query
   344  * @global WP_Query $wp_the_query
   255  * @since 2.0.0
   345  * @since 2.0.0
   256  */
   346  */
   257 $GLOBALS['wp_the_query'] = new WP_Query();
   347 $GLOBALS['wp_the_query'] = new WP_Query();
   258 
   348 
   259 /**
   349 /**
   260  * Holds the reference to @see $wp_the_query
   350  * Holds the reference to @see $wp_the_query
   261  * Use this global for WordPress queries
   351  * Use this global for WordPress queries
   262  * @global object $wp_query
   352  * @global WP_Query $wp_query
   263  * @since 1.5.0
   353  * @since 1.5.0
   264  */
   354  */
   265 $GLOBALS['wp_query'] = $GLOBALS['wp_the_query'];
   355 $GLOBALS['wp_query'] = $GLOBALS['wp_the_query'];
   266 
   356 
   267 /**
   357 /**
   268  * Holds the WordPress Rewrite object for creating pretty URLs
   358  * Holds the WordPress Rewrite object for creating pretty URLs
   269  * @global object $wp_rewrite
   359  * @global WP_Rewrite $wp_rewrite
   270  * @since 1.5.0
   360  * @since 1.5.0
   271  */
   361  */
   272 $GLOBALS['wp_rewrite'] = new WP_Rewrite();
   362 $GLOBALS['wp_rewrite'] = new WP_Rewrite();
   273 
   363 
   274 /**
   364 /**
   275  * WordPress Object
   365  * WordPress Object
   276  * @global object $wp
   366  * @global WP $wp
   277  * @since 2.0.0
   367  * @since 2.0.0
   278  */
   368  */
   279 $GLOBALS['wp'] = new WP();
   369 $GLOBALS['wp'] = new WP();
   280 
   370 
   281 /**
   371 /**
   282  * WordPress Widget Factory Object
   372  * WordPress Widget Factory Object
   283  * @global object $wp_widget_factory
   373  * @global WP_Widget_Factory $wp_widget_factory
   284  * @since 2.8.0
   374  * @since 2.8.0
   285  */
   375  */
   286 $GLOBALS['wp_widget_factory'] = new WP_Widget_Factory();
   376 $GLOBALS['wp_widget_factory'] = new WP_Widget_Factory();
   287 
   377 
   288 /**
   378 /**
   289  * WordPress User Roles
   379  * WordPress User Roles
   290  * @global object $wp_roles
   380  * @global WP_Roles $wp_roles
   291  * @since 2.0.0
   381  * @since 2.0.0
   292  */
   382  */
   293 $GLOBALS['wp_roles'] = new WP_Roles();
   383 $GLOBALS['wp_roles'] = new WP_Roles();
   294 
   384 
   295 /**
   385 /**
   309 $locale_file = WP_LANG_DIR . "/$locale.php";
   399 $locale_file = WP_LANG_DIR . "/$locale.php";
   310 if ( ( 0 === validate_file( $locale ) ) && is_readable( $locale_file ) )
   400 if ( ( 0 === validate_file( $locale ) ) && is_readable( $locale_file ) )
   311 	require( $locale_file );
   401 	require( $locale_file );
   312 unset( $locale_file );
   402 unset( $locale_file );
   313 
   403 
   314 // Pull in locale data after loading text domain.
       
   315 require_once( ABSPATH . WPINC . '/locale.php' );
       
   316 
       
   317 /**
   404 /**
   318  * WordPress Locale object for loading locale domain date and various strings.
   405  * WordPress Locale object for loading locale domain date and various strings.
   319  * @global object $wp_locale
   406  * @global WP_Locale $wp_locale
   320  * @since 2.1.0
   407  * @since 2.1.0
   321  */
   408  */
   322 $GLOBALS['wp_locale'] = new WP_Locale();
   409 $GLOBALS['wp_locale'] = new WP_Locale();
   323 
   410 
       
   411 /**
       
   412  *  WordPress Locale Switcher object for switching locales.
       
   413  *
       
   414  * @since 4.7.0
       
   415  *
       
   416  * @global WP_Locale_Switcher $wp_locale_switcher WordPress locale switcher object.
       
   417  */
       
   418 $GLOBALS['wp_locale_switcher'] = new WP_Locale_Switcher();
       
   419 $GLOBALS['wp_locale_switcher']->init();
       
   420 
   324 // Load the functions for the active theme, for both parent and child theme if applicable.
   421 // Load the functions for the active theme, for both parent and child theme if applicable.
   325 if ( ! defined( 'WP_INSTALLING' ) || 'wp-activate.php' === $pagenow ) {
   422 if ( ! wp_installing() || 'wp-activate.php' === $pagenow ) {
   326 	if ( TEMPLATEPATH !== STYLESHEETPATH && file_exists( STYLESHEETPATH . '/functions.php' ) )
   423 	if ( TEMPLATEPATH !== STYLESHEETPATH && file_exists( STYLESHEETPATH . '/functions.php' ) )
   327 		include( STYLESHEETPATH . '/functions.php' );
   424 		include( STYLESHEETPATH . '/functions.php' );
   328 	if ( file_exists( TEMPLATEPATH . '/functions.php' ) )
   425 	if ( file_exists( TEMPLATEPATH . '/functions.php' ) )
   329 		include( TEMPLATEPATH . '/functions.php' );
   426 		include( TEMPLATEPATH . '/functions.php' );
   330 }
   427 }
   341 
   438 
   342 /**
   439 /**
   343  * Fires after WordPress has finished loading but before any headers are sent.
   440  * Fires after WordPress has finished loading but before any headers are sent.
   344  *
   441  *
   345  * Most of WP is loaded at this stage, and the user is authenticated. WP continues
   442  * Most of WP is loaded at this stage, and the user is authenticated. WP continues
   346  * to load on the init hook that follows (e.g. widgets), and many plugins instantiate
   443  * to load on the {@see 'init'} hook that follows (e.g. widgets), and many plugins instantiate
   347  * themselves on it for all sorts of reasons (e.g. they need a user, a taxonomy, etc.).
   444  * themselves on it for all sorts of reasons (e.g. they need a user, a taxonomy, etc.).
   348  *
   445  *
   349  * If you wish to plug an action once WP is loaded, use the wp_loaded hook below.
   446  * If you wish to plug an action once WP is loaded, use the {@see 'wp_loaded'} hook below.
   350  *
   447  *
   351  * @since 1.5.0
   448  * @since 1.5.0
   352  */
   449  */
   353 do_action( 'init' );
   450 do_action( 'init' );
   354 
   451 
   362 }
   459 }
   363 
   460 
   364 /**
   461 /**
   365  * This hook is fired once WP, all plugins, and the theme are fully loaded and instantiated.
   462  * This hook is fired once WP, all plugins, and the theme are fully loaded and instantiated.
   366  *
   463  *
   367  * AJAX requests should use wp-admin/admin-ajax.php. admin-ajax.php can handle requests for
   464  * Ajax requests should use wp-admin/admin-ajax.php. admin-ajax.php can handle requests for
   368  * users not logged in.
   465  * users not logged in.
   369  *
   466  *
   370  * @link https://codex.wordpress.org/AJAX_in_Plugins
   467  * @link https://codex.wordpress.org/AJAX_in_Plugins
   371  *
   468  *
   372  * @since 3.0.0
   469  * @since 3.0.0