PluginProbe
Plugin Detective – Troubleshooting Conflicts / 1.1.8
Plugin Detective – Troubleshooting Conflicts v1.1.8
1.2.35 1.2.33 1.2.32 1.2.31 1.1.1 1.1.2 1.1.3 1.1.4 1.1.5 1.1.6 1.1.7 1.1.8 1.1.9 1.2 1.2.1 1.2.10 1.2.12 1.2.13 1.2.14 1.2.16 1.2.19 1.2.20 1.2.22 1.2.23 1.2.24 All 54 releases
plugin-detective / troubleshoot / includes / class-settings.php

class-settings.php in Plugin Detective – Troubleshooting Conflicts 1.1.8, at troubleshoot/includes/class-settings.php

589 lines 21.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 function pd_maybe_require( $path ) {
3 if ( file_exists( $path ) ) {
4 require $path;
5 }
6 }
7 /**
8 * Troubleshoot Settings.
9 *
10 * @since 0.0.0
11 * @package Troubleshoot
12 */
13
14 /**
15 * Troubleshoot Settings.
16 *
17 * @since 0.0.0
18 */
19 class PDT_Settings {
20 /**
21 * Parent plugin class.
22 *
23 * @since 0.0.0
24 *
25 * @var Troubleshoot
26 */
27 protected $plugin = null;
28
29 /**
30 * Constructor.
31 *
32 * @since 0.0.0
33 *
34 * @param Troubleshoot $plugin Main plugin object.
35 */
36 public function __construct( $plugin ) {
37 $this->plugin = $plugin;
38 $this->hooks();
39 }
40
41 /**
42 * Initiate our hooks.
43 *
44 * @since 0.0.0
45 */
46 public function hooks() {
47
48 }
49 }
50
51 /**
52 * Used to set up and fix common variables and include
53 * the WordPress procedural and class library.
54 *
55 * Allows for some configuration in wp-config.php (see default-constants.php)
56 *
57 * @package WordPress
58 */
59
60 /**
61 * Stores the location of the WordPress directory of functions, classes, and core content.
62 *
63 * @since 1.0.0
64 */
65 define( 'WPINC', 'wp-includes' );
66
67 // Include files required for initialization.
68 pd_maybe_require( ABSPATH . WPINC . '/load.php' );
69 @include( ABSPATH . WPINC . '/class-wp-paused-extensions-storage.php' );
70 @include( ABSPATH . WPINC . '/class-wp-fatal-error-handler.php' );
71 @include( ABSPATH . WPINC . '/class-wp-recovery-mode-cookie-service.php' );
72 @include( ABSPATH . WPINC . '/class-wp-recovery-mode-key-service.php' );
73 @include( ABSPATH . WPINC . '/class-wp-recovery-mode-link-service.php' );
74 @include( ABSPATH . WPINC . '/class-wp-recovery-mode-email-service.php' );
75 @include( ABSPATH . WPINC . '/class-wp-recovery-mode.php' );
76 @include( ABSPATH . WPINC . '/error-protection.php' );
77 @include( ABSPATH . WPINC . '/default-constants.php' );
78 require_once( ABSPATH . WPINC . '/plugin.php' );
79
80 /*
81 * These can't be directly globalized in version.php. When updating,
82 * we're including version.php from another installation and don't want
83 * these values to be overridden if already set.
84 */
85 global $wp_version, $wp_db_version, $tinymce_version, $required_php_version, $required_mysql_version, $wp_local_package;
86 pd_maybe_require( ABSPATH . WPINC . '/version.php' );
87
88 /**
89 * If not already configured, `$blog_id` will default to 1 in a single site
90 * configuration. In multisite, it will be overridden by default in ms-settings.php.
91 *
92 * @global int $blog_id
93 * @since 2.0.0
94 */
95 global $blog_id;
96 global $table_prefix;
97
98 // Set initial default constants including WP_MEMORY_LIMIT, WP_MAX_MEMORY_LIMIT, WP_DEBUG, SCRIPT_DEBUG, WP_CONTENT_DIR and WP_CACHE.
99 wp_initial_constants();
100
101 if ( function_exists( 'wp_register_fatal_error_handler' ) ) {
102 // Make sure we register the shutdown handler for fatal errors as soon as possible.
103 wp_register_fatal_error_handler();
104 }
105
106 // Check for the required PHP version and for the MySQL extension or a database drop-in.
107 wp_check_php_mysql_versions();
108
109 // Disable magic quotes at runtime. Magic quotes are added using wpdb later in wp-settings.php.
110 @ini_set( 'magic_quotes_runtime', 0 );
111 @ini_set( 'magic_quotes_sybase', 0 );
112
113 // WordPress calculates offsets from UTC.
114 date_default_timezone_set( 'UTC' );
115
116 // Standardize $_SERVER variables across setups.
117 wp_fix_server_vars();
118
119 // Check if we have received a request due to missing favicon.ico
120 wp_favicon_request();
121
122 // Check if we're in maintenance mode.
123 // wp_maintenance();
124
125 // Start loading timer.
126 timer_start();
127
128 // Check if we're in WP_DEBUG mode.
129 wp_debug_mode();
130
131 /**
132 * Filters whether to enable loading of the advanced-cache.php drop-in.
133 *
134 * This filter runs before it can be used by plugins. It is designed for non-web
135 * run-times. If false is returned, advanced-cache.php will never be loaded.
136 *
137 * @since 4.6.0
138 *
139 * @param bool $enable_advanced_cache Whether to enable loading advanced-cache.php (if present).
140 * Default true.
141 */
142
143 /* PD: Start cache disable */
144 // if ( WP_CACHE && apply_filters( 'enable_loading_advanced_cache_dropin', true ) ) {
145 // For an advanced caching plugin to use. Uses a static drop-in because you would only want one.
146 // WP_DEBUG ? include( WP_CONTENT_DIR . '/advanced-cache.php' ) : @include( WP_CONTENT_DIR . '/advanced-cache.php' );
147 // Re-initialize any hooks added manually by advanced-cache.php
148 // if ( $wp_filter ) {
149 // $wp_filter = WP_Hook::build_preinitialized_hooks( $wp_filter );
150 // }
151 /* PD: End cache disable */
152
153
154
155 // Define WP_LANG_DIR if not set.
156 wp_set_lang_dir();
157
158 // Load early WordPress files.
159 pd_maybe_require( ABSPATH . WPINC . '/compat.php' );
160 pd_maybe_require( ABSPATH . WPINC . '/class-wp-list-util.php' );
161 pd_maybe_require( ABSPATH . WPINC . '/functions.php' );
162 pd_maybe_require( ABSPATH . WPINC . '/class-wp-matchesmapregex.php' );
163 pd_maybe_require( ABSPATH . WPINC . '/class-wp.php' );
164 pd_maybe_require( ABSPATH . WPINC . '/class-wp-error.php' );
165 pd_maybe_require( ABSPATH . WPINC . '/pomo/mo.php' );
166
167 // Include the wpdb class and, if present, a db.php database drop-in.
168 global $wpdb;
169 require_wp_db();
170 // Set the database table prefix and the format specifiers for database table columns.
171 $GLOBALS['table_prefix'] = $table_prefix;
172 wp_set_wpdb_vars();
173
174 // Start the WordPress object cache, or an external object cache if the drop-in is present.
175 wp_start_object_cache();
176
177 // Attach the default filters.
178 pd_maybe_require( ABSPATH . WPINC . '/default-filters.php' );
179
180 // Initialize multisite if enabled.
181 if ( is_multisite() ) {
182 pd_maybe_require( ABSPATH . WPINC . '/class-wp-site-query.php' );
183 pd_maybe_require( ABSPATH . WPINC . '/class-wp-network-query.php' );
184 pd_maybe_require( ABSPATH . WPINC . '/ms-blogs.php' );
185 pd_maybe_require( ABSPATH . WPINC . '/ms-settings.php' );
186 } elseif ( ! defined( 'MULTISITE' ) ) {
187 define( 'MULTISITE', false );
188 }
189
190 register_shutdown_function( 'shutdown_action_hook' );
191
192 // Stop most of WordPress from being loaded if we just want the basics.
193 if ( SHORTINIT )
194 return false;
195
196 // Load the L10n library.
197 require_once( ABSPATH . WPINC . '/l10n.php' );
198 require_once( ABSPATH . WPINC . '/class-wp-locale.php' );
199 require_once( ABSPATH . WPINC . '/class-wp-locale-switcher.php' );
200
201 // Run the installer if WordPress is not installed.
202 /* PD: Start wp_not_installed() disable */
203
204 // wp_not_installed();
205
206 /* PD: End wp_not_installed() disable */
207
208
209 // Load most of WordPress.
210 pd_maybe_require( ABSPATH . WPINC . '/class-wp-walker.php' );
211 pd_maybe_require( ABSPATH . WPINC . '/class-wp-ajax-response.php' );
212 pd_maybe_require( ABSPATH . WPINC . '/formatting.php' );
213 pd_maybe_require( ABSPATH . WPINC . '/capabilities.php' );
214 pd_maybe_require( ABSPATH . WPINC . '/class-wp-roles.php' );
215 pd_maybe_require( ABSPATH . WPINC . '/class-wp-role.php' );
216 pd_maybe_require( ABSPATH . WPINC . '/class-wp-user.php' );
217 pd_maybe_require( ABSPATH . WPINC . '/class-wp-query.php' );
218 pd_maybe_require( ABSPATH . WPINC . '/query.php' );
219 pd_maybe_require( ABSPATH . WPINC . '/date.php' );
220 pd_maybe_require( ABSPATH . WPINC . '/theme.php' );
221 pd_maybe_require( ABSPATH . WPINC . '/class-wp-theme.php' );
222 pd_maybe_require( ABSPATH . WPINC . '/template.php' );
223 pd_maybe_require( ABSPATH . WPINC . '/user.php' );
224 pd_maybe_require( ABSPATH . WPINC . '/class-wp-user-query.php' );
225 pd_maybe_require( ABSPATH . WPINC . '/class-wp-session-tokens.php' );
226 pd_maybe_require( ABSPATH . WPINC . '/class-wp-user-meta-session-tokens.php' );
227 pd_maybe_require( ABSPATH . WPINC . '/meta.php' );
228 pd_maybe_require( ABSPATH . WPINC . '/class-wp-meta-query.php' );
229 pd_maybe_require( ABSPATH . WPINC . '/class-wp-metadata-lazyloader.php' );
230 pd_maybe_require( ABSPATH . WPINC . '/general-template.php' );
231 pd_maybe_require( ABSPATH . WPINC . '/link-template.php' );
232
233
234 pd_maybe_require( ABSPATH . WPINC . '/author-template.php' );
235 pd_maybe_require( ABSPATH . WPINC . '/post.php' );
236 pd_maybe_require( ABSPATH . WPINC . '/class-walker-page.php' );
237 pd_maybe_require( ABSPATH . WPINC . '/class-walker-page-dropdown.php' );
238 pd_maybe_require( ABSPATH . WPINC . '/class-wp-post-type.php' );
239 pd_maybe_require( ABSPATH . WPINC . '/class-wp-post.php' );
240 pd_maybe_require( ABSPATH . WPINC . '/post-template.php' );
241 pd_maybe_require( ABSPATH . WPINC . '/revision.php' );
242 pd_maybe_require( ABSPATH . WPINC . '/post-formats.php' );
243 pd_maybe_require( ABSPATH . WPINC . '/post-thumbnail-template.php' );
244 pd_maybe_require( ABSPATH . WPINC . '/category.php' );
245 pd_maybe_require( ABSPATH . WPINC . '/class-walker-category.php' );
246 pd_maybe_require( ABSPATH . WPINC . '/class-walker-category-dropdown.php' );
247 pd_maybe_require( ABSPATH . WPINC . '/category-template.php' );
248 pd_maybe_require( ABSPATH . WPINC . '/comment.php' );
249 pd_maybe_require( ABSPATH . WPINC . '/class-wp-comment.php' );
250 pd_maybe_require( ABSPATH . WPINC . '/class-wp-comment-query.php' );
251 pd_maybe_require( ABSPATH . WPINC . '/class-walker-comment.php' );
252 pd_maybe_require( ABSPATH . WPINC . '/comment-template.php' );
253 pd_maybe_require( ABSPATH . WPINC . '/rewrite.php' );
254 pd_maybe_require( ABSPATH . WPINC . '/class-wp-rewrite.php' );
255 pd_maybe_require( ABSPATH . WPINC . '/feed.php' );
256 pd_maybe_require( ABSPATH . WPINC . '/bookmark.php' );
257 pd_maybe_require( ABSPATH . WPINC . '/bookmark-template.php' );
258 pd_maybe_require( ABSPATH . WPINC . '/kses.php' );
259 pd_maybe_require( ABSPATH . WPINC . '/cron.php' );
260 pd_maybe_require( ABSPATH . WPINC . '/deprecated.php' );
261 pd_maybe_require( ABSPATH . WPINC . '/script-loader.php' );
262 pd_maybe_require( ABSPATH . WPINC . '/taxonomy.php' );
263 pd_maybe_require( ABSPATH . WPINC . '/class-wp-taxonomy.php' );
264 pd_maybe_require( ABSPATH . WPINC . '/class-wp-term.php' );
265 pd_maybe_require( ABSPATH . WPINC . '/class-wp-term-query.php' );
266 pd_maybe_require( ABSPATH . WPINC . '/class-wp-tax-query.php' );
267 pd_maybe_require( ABSPATH . WPINC . '/update.php' );
268 pd_maybe_require( ABSPATH . WPINC . '/canonical.php' );
269 pd_maybe_require( ABSPATH . WPINC . '/shortcodes.php' );
270 pd_maybe_require( ABSPATH . WPINC . '/embed.php' );
271 pd_maybe_require( ABSPATH . WPINC . '/class-wp-embed.php' );
272 pd_maybe_require( ABSPATH . WPINC . '/class-oembed.php' );
273 pd_maybe_require( ABSPATH . WPINC . '/class-wp-oembed-controller.php' );
274 pd_maybe_require( ABSPATH . WPINC . '/media.php' );
275 pd_maybe_require( ABSPATH . WPINC . '/http.php' );
276 pd_maybe_require( ABSPATH . WPINC . '/class-http.php' );
277 pd_maybe_require( ABSPATH . WPINC . '/class-wp-http-streams.php' );
278 pd_maybe_require( ABSPATH . WPINC . '/class-wp-http-curl.php' );
279 pd_maybe_require( ABSPATH . WPINC . '/class-wp-http-proxy.php' );
280 pd_maybe_require( ABSPATH . WPINC . '/class-wp-http-cookie.php' );
281 pd_maybe_require( ABSPATH . WPINC . '/class-wp-http-encoding.php' );
282 pd_maybe_require( ABSPATH . WPINC . '/class-wp-http-response.php' );
283 pd_maybe_require( ABSPATH . WPINC . '/class-wp-http-requests-response.php' );
284 pd_maybe_require( ABSPATH . WPINC . '/class-wp-http-requests-hooks.php' );
285 pd_maybe_require( ABSPATH . WPINC . '/widgets.php' );
286 pd_maybe_require( ABSPATH . WPINC . '/class-wp-widget.php' );
287 pd_maybe_require( ABSPATH . WPINC . '/class-wp-widget-factory.php' );
288 pd_maybe_require( ABSPATH . WPINC . '/nav-menu.php' );
289 pd_maybe_require( ABSPATH . WPINC . '/nav-menu-template.php' );
290 pd_maybe_require( ABSPATH . WPINC . '/admin-bar.php' );
291 pd_maybe_require( ABSPATH . WPINC . '/rest-api.php' );
292 pd_maybe_require( ABSPATH . WPINC . '/rest-api/class-wp-rest-server.php' );
293 pd_maybe_require( ABSPATH . WPINC . '/rest-api/class-wp-rest-response.php' );
294 pd_maybe_require( ABSPATH . WPINC . '/rest-api/class-wp-rest-request.php' );
295 pd_maybe_require( ABSPATH . WPINC . '/rest-api/endpoints/class-wp-rest-controller.php' );
296 pd_maybe_require( ABSPATH . WPINC . '/rest-api/endpoints/class-wp-rest-posts-controller.php' );
297 pd_maybe_require( ABSPATH . WPINC . '/rest-api/endpoints/class-wp-rest-attachments-controller.php' );
298 pd_maybe_require( ABSPATH . WPINC . '/rest-api/endpoints/class-wp-rest-post-types-controller.php' );
299 pd_maybe_require( ABSPATH . WPINC . '/rest-api/endpoints/class-wp-rest-post-statuses-controller.php' );
300 pd_maybe_require( ABSPATH . WPINC . '/rest-api/endpoints/class-wp-rest-revisions-controller.php' );
301 pd_maybe_require( ABSPATH . WPINC . '/rest-api/endpoints/class-wp-rest-autosaves-controller.php' );
302 pd_maybe_require( ABSPATH . WPINC . '/rest-api/endpoints/class-wp-rest-taxonomies-controller.php' );
303 pd_maybe_require( ABSPATH . WPINC . '/rest-api/endpoints/class-wp-rest-terms-controller.php' );
304 pd_maybe_require( ABSPATH . WPINC . '/rest-api/endpoints/class-wp-rest-users-controller.php' );
305 pd_maybe_require( ABSPATH . WPINC . '/rest-api/endpoints/class-wp-rest-comments-controller.php' );
306 pd_maybe_require( ABSPATH . WPINC . '/rest-api/endpoints/class-wp-rest-search-controller.php' );
307 pd_maybe_require( ABSPATH . WPINC . '/rest-api/endpoints/class-wp-rest-blocks-controller.php' );
308 pd_maybe_require( ABSPATH . WPINC . '/rest-api/endpoints/class-wp-rest-block-types-controller.php' );
309 pd_maybe_require( ABSPATH . WPINC . '/rest-api/endpoints/class-wp-rest-block-renderer-controller.php' );
310 pd_maybe_require( ABSPATH . WPINC . '/rest-api/endpoints/class-wp-rest-settings-controller.php' );
311 pd_maybe_require( ABSPATH . WPINC . '/rest-api/endpoints/class-wp-rest-themes-controller.php' );
312 pd_maybe_require( ABSPATH . WPINC . '/rest-api/endpoints/class-wp-rest-plugins-controller.php' );
313 pd_maybe_require( ABSPATH . WPINC . '/rest-api/endpoints/class-wp-rest-block-directory-controller.php' );
314 pd_maybe_require( ABSPATH . WPINC . '/rest-api/fields/class-wp-rest-meta-fields.php' );
315 pd_maybe_require( ABSPATH . WPINC . '/rest-api/fields/class-wp-rest-comment-meta-fields.php' );
316 pd_maybe_require( ABSPATH . WPINC . '/rest-api/fields/class-wp-rest-post-meta-fields.php' );
317 pd_maybe_require( ABSPATH . WPINC . '/rest-api/fields/class-wp-rest-term-meta-fields.php' );
318 pd_maybe_require( ABSPATH . WPINC . '/rest-api/fields/class-wp-rest-user-meta-fields.php' );
319 pd_maybe_require( ABSPATH . WPINC . '/rest-api/search/class-wp-rest-search-handler.php' );
320 pd_maybe_require( ABSPATH . WPINC . '/rest-api/search/class-wp-rest-post-search-handler.php' );
321
322 pd_maybe_require( ABSPATH . WPINC . '/sitemaps.php' );
323 pd_maybe_require( ABSPATH . WPINC . '/sitemaps/class-wp-sitemaps.php' );
324 pd_maybe_require( ABSPATH . WPINC . '/sitemaps/class-wp-sitemaps-index.php' );
325 pd_maybe_require( ABSPATH . WPINC . '/sitemaps/class-wp-sitemaps-provider.php' );
326 pd_maybe_require( ABSPATH . WPINC . '/sitemaps/class-wp-sitemaps-registry.php' );
327 pd_maybe_require( ABSPATH . WPINC . '/sitemaps/class-wp-sitemaps-renderer.php' );
328 pd_maybe_require( ABSPATH . WPINC . '/sitemaps/class-wp-sitemaps-stylesheet.php' );
329 pd_maybe_require( ABSPATH . WPINC . '/sitemaps/providers/class-wp-sitemaps-posts.php' );
330 pd_maybe_require( ABSPATH . WPINC . '/sitemaps/providers/class-wp-sitemaps-taxonomies.php' );
331 pd_maybe_require( ABSPATH . WPINC . '/sitemaps/providers/class-wp-sitemaps-users.php' );
332
333 pd_maybe_require( ABSPATH . WPINC . '/class-wp-block-type.php' );
334 pd_maybe_require( ABSPATH . WPINC . '/class-wp-block-pattern-categories-registry.php' );
335 pd_maybe_require( ABSPATH . WPINC . '/class-wp-block-patterns-registry.php' );
336 pd_maybe_require( ABSPATH . WPINC . '/class-wp-block-styles-registry.php' );
337 pd_maybe_require( ABSPATH . WPINC . '/class-wp-block-type-registry.php' );
338 pd_maybe_require( ABSPATH . WPINC . '/class-wp-block.php' );
339 pd_maybe_require( ABSPATH . WPINC . '/class-wp-block-list.php' );
340 pd_maybe_require( ABSPATH . WPINC . '/class-wp-block-parser.php' );
341 pd_maybe_require( ABSPATH . WPINC . '/blocks.php' );
342 pd_maybe_require( ABSPATH . WPINC . '/blocks/index.php' );
343 pd_maybe_require( ABSPATH . WPINC . '/block-patterns.php' );
344
345 /* PD: Start bail out early */
346 // return;
347 /* PD: End bail out early */
348 $GLOBALS['wp_embed'] = new WP_Embed();
349
350 // Load multisite-specific files.
351 if ( is_multisite() ) {
352 pd_maybe_require( ABSPATH . WPINC . '/ms-functions.php' );
353 pd_maybe_require( ABSPATH . WPINC . '/ms-default-filters.php' );
354 pd_maybe_require( ABSPATH . WPINC . '/ms-deprecated.php' );
355 }
356
357 // Define constants that rely on the API to obtain the default value.
358 // Define must-use plugin directory constants, which may be overridden in the sunrise.php drop-in.
359 wp_plugin_directory_constants();
360
361 $GLOBALS['wp_plugin_paths'] = array();
362
363 // Load must-use plugins.
364 foreach ( wp_get_mu_plugins() as $mu_plugin ) {
365 include_once( $mu_plugin );
366 }
367 unset( $mu_plugin );
368
369 // Load network activated plugins.
370 if ( is_multisite() ) {
371 foreach ( wp_get_active_network_plugins() as $network_plugin ) {
372 wp_register_plugin_realpath( $network_plugin );
373 include_once( $network_plugin );
374 }
375 unset( $network_plugin );
376 }
377
378 /**
379 * Fires once all must-use and network-activated plugins have loaded.
380 *
381 * @since 2.8.0
382 */
383 do_action( 'muplugins_loaded' );
384
385 if ( is_multisite() )
386 ms_cookie_constants( );
387
388 // Define constants after multisite is loaded.
389 wp_cookie_constants();
390
391 // Define and enforce our SSL constants
392 wp_ssl_constants();
393
394 // Create common globals.
395 pd_maybe_require( ABSPATH . WPINC . '/vars.php' );
396
397 // Make taxonomies and posts available to plugins and themes.
398 // @plugin authors: warning: these get registered again on the init hook.
399 create_initial_taxonomies();
400 create_initial_post_types();
401
402 if ( function_exists( 'wp_start_scraping_edited_file_errors' ) ) {
403 wp_start_scraping_edited_file_errors();
404 }
405
406 // Register the default theme directory root
407 register_theme_directory( get_theme_root() );
408
409 /* PD: Start cache disable */
410
411 // Load active plugins.
412 // foreach ( wp_get_active_and_valid_plugins() as $plugin ) {
413 // wp_register_plugin_realpath( $plugin );
414 // include_once( $plugin );
415 // }
416 // unset( $plugin );
417
418 /* PD: End cache disable */
419
420 // Load pluggable functions.
421 pd_maybe_require( ABSPATH . WPINC . '/pluggable.php' );
422 pd_maybe_require( ABSPATH . WPINC . '/pluggable-deprecated.php' );
423
424 // Set internal encoding.
425 wp_set_internal_encoding();
426
427 // Run wp_cache_postload() if object cache is enabled and the function exists.
428 if ( WP_CACHE && function_exists( 'wp_cache_postload' ) )
429 wp_cache_postload();
430
431 /**
432 * Fires once activated plugins have loaded.
433 *
434 * Pluggable functions are also available at this point in the loading order.
435 *
436 * @since 1.5.0
437 */
438 do_action( 'plugins_loaded' );
439
440 // Define constants which affect functionality if not already defined.
441 wp_functionality_constants();
442
443 // Add magic quotes and set up $_REQUEST ( $_GET + $_POST )
444 wp_magic_quotes();
445
446 /**
447 * Fires when comment cookies are sanitized.
448 *
449 * @since 2.0.11
450 */
451 do_action( 'sanitize_comment_cookies' );
452
453 /**
454 * WordPress Query object
455 * @global WP_Query $wp_the_query
456 * @since 2.0.0
457 */
458 $GLOBALS['wp_the_query'] = new WP_Query();
459
460 /**
461 * Holds the reference to @see $wp_the_query
462 * Use this global for WordPress queries
463 * @global WP_Query $wp_query
464 * @since 1.5.0
465 */
466 $GLOBALS['wp_query'] = $GLOBALS['wp_the_query'];
467
468 /**
469 * Holds the WordPress Rewrite object for creating pretty URLs
470 * @global WP_Rewrite $wp_rewrite
471 * @since 1.5.0
472 */
473 $GLOBALS['wp_rewrite'] = new WP_Rewrite();
474
475 /**
476 * WordPress Object
477 * @global WP $wp
478 * @since 2.0.0
479 */
480 $GLOBALS['wp'] = new WP();
481
482 /**
483 * WordPress Widget Factory Object
484 * @global WP_Widget_Factory $wp_widget_factory
485 * @since 2.8.0
486 */
487 $GLOBALS['wp_widget_factory'] = new WP_Widget_Factory();
488
489 /**
490 * WordPress User Roles
491 * @global WP_Roles $wp_roles
492 * @since 2.0.0
493 */
494 $GLOBALS['wp_roles'] = new WP_Roles();
495
496 /**
497 * Fires before the theme is loaded.
498 *
499 * @since 2.6.0
500 */
501 do_action( 'setup_theme' );
502
503 // Define the template related constants.
504 wp_templating_constants( );
505
506 // Load the default text localization domain.
507 load_default_textdomain();
508
509 $locale = get_locale();
510 $locale_file = WP_LANG_DIR . "/$locale.php";
511 if ( ( 0 === validate_file( $locale ) ) && is_readable( $locale_file ) )
512 require( $locale_file );
513 unset( $locale_file );
514
515 /**
516 * WordPress Locale object for loading locale domain date and various strings.
517 * @global WP_Locale $wp_locale
518 * @since 2.1.0
519 */
520 $GLOBALS['wp_locale'] = new WP_Locale();
521
522 /**
523 * WordPress Locale Switcher object for switching locales.
524 *
525 * @since 4.7.0
526 *
527 * @global WP_Locale_Switcher $wp_locale_switcher WordPress locale switcher object.
528 */
529 $GLOBALS['wp_locale_switcher'] = new WP_Locale_Switcher();
530 $GLOBALS['wp_locale_switcher']->init();
531
532 // Load the functions for the active theme, for both parent and child theme if applicable.
533 if ( ! wp_installing() || 'wp-activate.php' === $pagenow ) {
534 if ( TEMPLATEPATH !== STYLESHEETPATH && file_exists( STYLESHEETPATH . '/functions.php' ) )
535 include( STYLESHEETPATH . '/functions.php' );
536 if ( file_exists( TEMPLATEPATH . '/functions.php' ) )
537 include( TEMPLATEPATH . '/functions.php' );
538 }
539
540 /**
541 * Fires after the theme is loaded.
542 *
543 * @since 3.0.0
544 */
545 do_action( 'after_setup_theme' );
546
547 // Create an instance of WP_Site_Health so that Cron events may fire.
548 if ( ! class_exists( 'WP_Site_Health' ) ) {
549 require_once ABSPATH . 'wp-admin/includes/class-wp-site-health.php';
550 }
551 WP_Site_Health::get_instance();
552
553 // Set up current user.
554 $GLOBALS['wp']->init();
555
556 /**
557 * Fires after WordPress has finished loading but before any headers are sent.
558 *
559 * Most of WP is loaded at this stage, and the user is authenticated. WP continues
560 * to load on the {@see 'init'} hook that follows (e.g. widgets), and many plugins instantiate
561 * themselves on it for all sorts of reasons (e.g. they need a user, a taxonomy, etc.).
562 *
563 * If you wish to plug an action once WP is loaded, use the {@see 'wp_loaded'} hook below.
564 *
565 * @since 1.5.0
566 */
567 do_action( 'init' );
568
569 // Check site status
570 if ( is_multisite() ) {
571 if ( true !== ( $file = ms_site_check() ) ) {
572 require( $file );
573 die();
574 }
575 unset($file);
576 }
577
578 /**
579 * This hook is fired once WP, all plugins, and the theme are fully loaded and instantiated.
580 *
581 * Ajax requests should use wp-admin/admin-ajax.php. admin-ajax.php can handle requests for
582 * users not logged in.
583 *
584 * @link https://codex.wordpress.org/AJAX_in_Plugins
585 *
586 * @since 3.0.0
587 */
588 do_action( 'wp_loaded' );
589