Skip to main content
We are Brand SEO Beijing serving international business, your marketing partner, Contact us by mi@mgsh.com.cn

Website CMS source code interpretation (2)

Map: index.php->……->wp-config.php->wp-setting.php

Description: Programs and class libraries used to set public variables, load WP (where the folders where WP functions, classes, and core content are stored) are stored.The user does not need to modify this file, but it can be configured by modifying the wp-config.php file.
1) Define the WPINC constants and introduce the files WPINC/load.php, WPINC/default-constants.php, WPINC/version.php required for initialization.
2) Call the wp_initial_constants() function to initialize the constants WP_MEMORY_LIMIT, WP_DEBUG, WP_CONTENT_DIR and WP_CACHE.
3) Turn off the magic references at runtime, which will be added later by wpdb in wp-settings.php.
4) Set the default time zone for PHP5.
5) Call the wp_unregister_GLOBALS() function to close register_globals.
6) Unset global variables $wp_filter, $cache_lastcommentmodified, $cache_lastpostdate to ensure they do not exist.
7) Specification of $_SERVER variable settings.
8) Check the required PHP version and MySQL extension or database drop-in.
9) Check if a request is received due to a missing favicon.ico.
10) Check if it is in maintenance mode.
11) Start the loading timer.
12) Check if it is in WP_DEBUG mode.
13) According to the WP_CACHE and WP_DEBUG constants, determine whether to load and how to load the WP_CONTENT_DIR/advanced-cache.php file.
14) Call the wp_set_lang_dir() function to set the constant WP_LANG_DIR.
15) Load WP files WPINC/compat.php, WPINC/functions.php, WPINC/classes.php.
16) Call the require_wp_db() function to introduce the wpdb class, or the database drop-in db.php (if it exists).
17) Call the wp_set_wpdb_vars() function to set the database table prefix and the format specifier of the database table column
18) Call the wp_start_object_cache() function to enable the WP object cache, or expand the object cache (if the corresponding drop-in exists).
19) Load WP files WPINC/plugin.php, WPINC/default-filters.php, WPINC/pomo/mo.php.
20) If multi-site is enabled, load the files WPINC/ms-blogs.php, WPINC/ms-settings.php; otherwise, set the constant MULTISITE to false.
——If only basic functions are required (ie, the SHORTINIT constant is true), the wp-setting.php file will return to this point! ————
21) Load the l18n library WPINC/l10n.php.
22) Call the wp_not_installed() function, if WP has not been installed, start the installer.
23) Load *most of WP* of WP:
WPINC/formatting.php,
WPINC/capabilities.php,
WPINC/query.php,
WPINC/theme.php,
WPINC/user.php,
WPINC/meta.php,
WPINC/general-template.php,
WPINC/link-template.php,
WPINC/author-template.php,
WPINC/post.php,
WPINC/post-template.php,
WPINC/category.php,
WPINC/category-template.php,
WPINC/comment.php,
WPINC/comment-template.php,
WPINC/rewrite.php,
WPINC/feed.php,
WPINC/bookmark.php,
WPINC/bookmark-template.php,
WPINC/kses.php,
WPINC/cron.php,
wpin/deprecated.php,
WPINC/script-loader.php,
WPINC/taxonomy.php,
WPINC/update.php,
WPINC/canonical.php,
WPINC/shortcodes.php,
WPINC/media.php,
WPINC/http.php,
WPINC/class-http.php,
WPINC/widgets.php,
WPINC/nav-menu.php,
WPINC/nav-menu-template.php
24) Load multisite specific files, WPINC/ms-functions.php, WPINC/ms-default-filters.php, WPINC/ms-deprecated.php.
25) Call the wp_plugin_directory_constants() function, define constants that depend on the API to obtain default values, and define the plugin folder constants that must be used, which may be overridden in the sunrise.php drop-in.
26) Use the function wp_get_mu_plugins() to load the plugins that must be used, and trigger the mount point do_action( 'muplugins_loaded' );
27) Call the function ms_cookie_constants() to set cookie constants for multiple sites.
28) Call the function wp_cookie_constants() to define constants after multi-site loading, cookie-related constants may be overwritten in ms_network_cookies().
29) Call the function wp_ssl_constants() to define and execute SSL constants.
30) Load the file WPINC/vars.php to create public global variables.
31) Call the functions create_initial_taxonomies() and create_initial_post_types() to make categories and posts visible to plugins and themes.Note to plugin authors: these are registered again when the hook is initialized.
32) Use the function wp_get_active_and_valid_plugins() to load the activated plug-ins.
33) Load pluggable functions, WPINC/pluggable.php, WPINC/pluggable-deprecated.php.
34) Call the function wp_set_internal_encoding() to set the internal encoding.
35) If WP_CACHE is on and the wp_cache_postload() function exists, this function is called.
36) Trigger mount point do_action( 'plugins_loaded' ).
37) Call the function wp_functionality_constants() to define constants that have not yet been defined but will affect functionality.
38) Call the function wp_magic_quotes() to add magic quotes and assemble $_REQUEST ( $_GET + $_POST ).
39) Trigger mount point do_action( 'sanitize_comment_cookies' ) (harmless comment cookies).
40) Create a global WP query object $wp_the_query =& new WP_Query(), and save the reference of $wp_the_query to $wp_query, and use $wp_query to query.
41) Create a WP rewrite object $wp_rewrite =& new WP_Rewrite() to create beautiful URLs.
42) Create a WP object $wp =& new WP().
43) Create a WP Widget factory object $wp_widget_factory =& new WP_Widget_Factory().
44) Trigger mount point do_action( 'setup_theme' ).
45) Call the function wp_templating_constants() to set template-related constants.
46) Call the function load_default_textdomain() to load the default text localization domain.
47) Find blog locale $locale = get_locale().
48) After loading the text field, load the localization data WPINC/locale.php.
49) Create a localization object $wp_locale =& new WP_Locale() to load localized domain data and various strings.
50) Load the active theme's function library TEMPLATEPATH/functions.php.
51) Trigger mount point do_action( 'after_setup_theme' ).
52) Call the function require_if_theme_supports() to load all the functions supported by the theme.
53) Register the shutdown function register_shutdown_function( 'shutdown_action_hook' ).
54) Create the current user $wp->init().
55) Trigger mount point do_action( 'init' ), at this stage most of WP has been loaded and user has been authenticated. WP will continue to load mounters on init hooks, such as widgets and various plugin instances.If you want to insert an action after WP loads, use the wp_loaded hook below.
56) In case of multi-site, check the status of the site.
57) Trigger the mount point do_action('wp_loaded'), when WP, all plugins and themes are fully loaded and instantiated, the hook will be lifted. Ajax requests should use wp-admin/admin-ajax.php, admin-ajax.php can handle requests from users who are not logged in.
Source of this article: www.cnblogs.com/vicenteforever/category/224217.html
Back to Top