文件操作 - initialize.php
返回文件管理
返回主菜单
删除本文件
文件: /storage/v12552/jimbrandstatter/public_html/wp-content/themes/Total/inc/initialize.php
编辑文件内容
<?php declare(strict_types=1); namespace TotalTheme; \defined( 'ABSPATH' ) || exit; /** * Initialize Theme. */ class Initialize { /** * Class instance. */ protected static $instance; /** * Create or retrieve the class instance. */ public static function instance() { if ( \is_null( self::$instance ) ) { self::$instance = new self(); } return self::$instance; } /** * Constructor. */ private function __construct() { $this->global(); if ( \wpex_is_request( 'admin' ) ) { $this->admin(); } $this->public(); if ( \wpex_is_request( 'frontend' ) ) { $this->frontend(); } $this->init_hooks(); } /** * Global. */ public function global(): void { // Load Functions. require_once \WPEX_INC_DIR . 'deprecated.php'; require_once \WPEX_INC_DIR . 'functions/core-functions.php'; require_once \WPEX_INC_DIR . 'functions/conditionals.php'; require_once \WPEX_INC_DIR . 'functions/svgs.php'; require_once \WPEX_INC_DIR . 'functions/css-utility.php'; require_once \WPEX_INC_DIR . 'functions/parsers.php'; require_once \WPEX_INC_DIR . 'functions/sanitization-functions.php'; require_once \WPEX_INC_DIR . 'functions/arrays.php'; require_once \WPEX_INC_DIR . 'functions/translations.php'; require_once \WPEX_INC_DIR . 'functions/template-parts.php'; require_once \WPEX_INC_DIR . 'functions/fonts.php'; require_once \WPEX_INC_DIR . 'functions/post-thumbnails.php'; require_once \WPEX_INC_DIR . 'functions/aria-labels.php'; require_once \WPEX_INC_DIR . 'cards/card-functions.php'; // Set theme versions. $this->set_initial_version(); $this->set_db_version(); // Run after updates class. // update_option( 'totaltheme_version', '1.2' ); // !!! for internal testing !!! if ( totaltheme_version_check( 'initial', totaltheme_get_version(), '!=' ) // fresh install check. && totaltheme_version_check( 'db', totaltheme_get_version(), '<' ) // old install check. ) { totaltheme_call_static( 'Updates\After_Update', 'run_updater' ); } // Color scheme class. totaltheme_init_class( 'Color_Scheme' ); // Register widget areas. totaltheme_call_static( 'Widgets\Register_Widget_Areas', 'instance' ); // Register AJAX callbacks. totaltheme_init_class( 'Register_AJAX_Callbacks' ); // Register theme actions. \add_action( 'after_switch_theme', 'totaltheme_action_callback' ); // Filters. \add_filter( 'http_request_args', 'totaltheme_filter_callback', 5, 2 ); \add_filter( 'kses_allowed_protocols', 'totaltheme_filter_callback' ); \add_filter( 'wp_get_attachment_url', 'totaltheme_filter_callback' ); // Theme builder. require_once \WPEX_INC_DIR . 'theme-builder/functions.php'; // !! must load here !! require_once \WPEX_INC_DIR . 'theme-builder/theme-builder.php'; /** Maybe include */ if ( \get_theme_mod( 'header_builder_enable', true ) ) { require_once \WPEX_INC_DIR . 'theme-builder/header-builder.php'; } if ( \get_theme_mod( 'footer_builder_enable', true ) ) { require_once \WPEX_INC_DIR . 'theme-builder/footer-builder.php'; } // Custom 404 Page. totaltheme_call_static( 'Error_404', 'instance' ); if ( \get_theme_mod( 'page_animations_enable', true ) ) { totaltheme_init_class( 'Page_Animations' ); } if ( \get_theme_mod( 'header_image_enable', false ) ) { totaltheme_init_class( 'WP_Custom_Header' ); } if ( wpex_custom_wp_gallery_supported() ) { totaltheme_init_class( 'Post_Gallery' ); } if ( \get_theme_mod( 'under_construction_enable', true ) ) { totaltheme_init_class( 'Under_Construction' ); } if ( \wpex_disable_google_services() ) { totaltheme_init_class( 'Disable_Google_Services' ); } if ( ! \get_theme_mod( 'widget_block_editor_enable', true ) ) { totaltheme_call_static( 'Widgets\Block_Editor', 'disable_block_editor' ); } if ( \get_theme_mod( 'favicons_enable', true ) ) { totaltheme_init_class( 'Favicons' ); } if ( \get_theme_mod( 'custom_admin_login_enable', true ) ) { totaltheme_init_class( 'Custom_Login' ); } if ( \get_theme_mod( 'custom_actions_enable', true ) ) { totaltheme_init_class( 'Custom_Actions' ); } if ( \get_theme_mod( 'remove_posttype_slugs', false ) ) { totaltheme_init_class( 'Remove_Cpt_Slugs' ); } if ( \apply_filters( 'wpex_has_bundled_plugin_update_notices', true ) ) { totaltheme_init_class( 'Updates\Plugin_Updater' ); } if ( \get_theme_mod( 'auto_updates', true ) ) { totaltheme_init_class( 'Updates\Theme_Updater' ); } // Remove site emoji scripts. if ( \get_theme_mod( 'remove_emoji_scripts_enable', true ) ) { totaltheme_init_class( 'Disable_WP_Emoji' ); } /** 3rd Party Integrations **/ totaltheme_init_class( 'Integrations' ); /* These Classes must Load last */ // Image sizes panel and registration. if ( \get_theme_mod( 'image_sizes_enable', true ) ) { totaltheme_init_class( 'Image_Sizes' ); } totaltheme_init_class( 'Customizer' ); if ( \get_theme_mod( 'typography_enable', true ) ) { totaltheme_init_class( 'Typography' ); } } /** * Admin functions. */ public function admin(): void { if ( ! \is_admin() ) { return; } $this->health_checks(); totaltheme_init_class( 'Admin\Theme_Panel' ); totaltheme_init_class( 'Editor\Mce_Formats' ); if ( \get_theme_mod( 'recommend_plugins_enable', true ) ) { totaltheme_init_class( 'Admin\Recommended_Plugins' ); } if ( \get_theme_mod( 'post_type_admin_settings', true ) ) { totaltheme_init_class( 'Admin\CPT_Settings' ); } if ( \get_theme_mod( 'import_export_enable', true ) ) { totaltheme_init_class( 'Admin\Import_Export' ); } if ( \apply_filters( 'wpex_show_license_panel', true ) ) { totaltheme_init_class( 'Admin\License_Panel' ); } if ( \apply_filters( 'wpex_accessibility_panel', true ) ) { totaltheme_init_class( 'Admin\Accessibility_Panel' ); } if ( \get_theme_mod( 'editor_styles_enable', true ) ) { totaltheme_init_class( 'Editor\Editor_Styles' ); } totaltheme_init_class( 'Admin\Dashboard_Thumbnails' ); totaltheme_init_class( 'Admin\Scripts' ); } /** * Public functions. * * @todo move these into classes that are loaded automatically. */ public function public(): void { require_once \WPEX_INC_DIR . 'functions/frontend/google-analytics.php'; require_once \WPEX_INC_DIR . 'functions/frontend/layouts.php'; require_once \WPEX_INC_DIR . 'functions/frontend/breadcrumbs.php'; require_once \WPEX_INC_DIR . 'functions/frontend/wpex-the-content.php'; require_once \WPEX_INC_DIR . 'functions/frontend/head-meta-tags.php'; require_once \WPEX_INC_DIR . 'functions/frontend/social-share.php'; require_once \WPEX_INC_DIR . 'functions/frontend/videos.php'; require_once \WPEX_INC_DIR . 'functions/frontend/audio.php'; require_once \WPEX_INC_DIR . 'functions/frontend/author.php'; require_once \WPEX_INC_DIR . 'functions/frontend/post-media.php'; require_once \WPEX_INC_DIR . 'functions/frontend/excerpts.php'; require_once \WPEX_INC_DIR . 'functions/frontend/togglebar.php'; require_once \WPEX_INC_DIR . 'functions/frontend/header-menu.php'; require_once \WPEX_INC_DIR . 'functions/frontend/post-slider.php'; require_once \WPEX_INC_DIR . 'functions/frontend/post-gallery.php'; require_once \WPEX_INC_DIR . 'functions/frontend/page-header.php'; require_once \WPEX_INC_DIR . 'functions/frontend/grids.php'; require_once \WPEX_INC_DIR . 'functions/frontend/page.php'; require_once \WPEX_INC_DIR . 'functions/frontend/archives.php'; require_once \WPEX_INC_DIR . 'functions/frontend/loop.php'; require_once \WPEX_INC_DIR . 'functions/frontend/blog.php'; require_once \WPEX_INC_DIR . 'functions/frontend/portfolio.php'; require_once \WPEX_INC_DIR . 'functions/frontend/staff.php'; require_once \WPEX_INC_DIR . 'functions/frontend/testimonials.php'; require_once \WPEX_INC_DIR . 'functions/frontend/cpt.php'; require_once \WPEX_INC_DIR . 'functions/frontend/search.php'; require_once \WPEX_INC_DIR . 'functions/frontend/user-social-links.php'; require_once \WPEX_INC_DIR . 'functions/frontend/post-format-icons.php'; } /** * Frontend functionality. */ public function frontend(): void { if ( \get_theme_mod( 'bypostauthor_highlight' ) ) { totaltheme_init_class( 'Comments\Author_Badge' ); } if ( \get_theme_mod( 'thumbnail_format_icons', false ) ) { totaltheme_init_class( 'Thumbnail_Format_Icons' ); } totaltheme_init_class( 'Site_Backgrounds' ); totaltheme_init_class( 'Fonts\Global_Fonts' ); totaltheme_init_class( 'Advanced_Styles' ); totaltheme_init_class( 'Inline_CSS' ); // Register the general totaltheme_action_callback() callback in various hooks. \add_action( 'wp_enqueue_scripts', 'totaltheme_action_callback' ); \add_action( 'template_redirect', 'totaltheme_action_callback' ); \add_action( 'pre_get_posts', 'totaltheme_action_callback' ); // Register the general totaltheme_filter_callback() callback in various hooks. \add_filter( 'body_class', 'totaltheme_filter_callback' ); \add_filter( 'post_class', 'totaltheme_filter_callback', 10, 3 ); \add_filter( 'term_link', 'totaltheme_filter_callback', 10, 3 ); \add_filter( 'widget_tag_cloud_args', 'totaltheme_filter_callback' ); \add_filter( 'comment_form_fields', 'totaltheme_filter_callback' ); \add_filter( 'redirect_canonical', 'totaltheme_filter_callback' ); \add_filter( 'the_password_form', 'totaltheme_filter_callback' ); \add_filter( 'widget_nav_menu_args', 'totaltheme_filter_callback', 10, 4 ); \add_filter( 'embed_oembed_html', 'totaltheme_filter_callback', 100, 4 ); \add_filter( 'get_comments_link', 'totaltheme_filter_callback', 10, 2 ); \add_filter( 'respond_link', 'totaltheme_filter_callback', 10, 2 ); \add_filter( 'get_previous_post_join', 'totaltheme_filter_callback' ); \add_filter( 'get_next_post_join', 'totaltheme_filter_callback' ); \add_filter( 'get_previous_post_where', 'totaltheme_filter_callback' ); \add_filter( 'get_next_post_where', 'totaltheme_filter_callback' ); \add_filter( 'dynamic_sidebar_params', 'totaltheme_filter_callback' ); if ( \apply_filters( 'wpex_widget_counter_span', true ) ) { \add_filter( 'wp_list_categories', 'totaltheme_filter_callback' ); \add_filter( 'get_archives_link', 'totaltheme_filter_callback' ); } if ( \get_theme_mod( 'remove_menu_ids', false ) && \apply_filters( 'wpex_accessibility_panel', true ) ) { add_filter( 'nav_menu_item_id', '__return_false' ); } // Fix for WordPress messing with images and iFrames added in shortcodes. if ( \function_exists( '\wp_filter_content_tags' ) ) { \add_filter( 'the_content', 'wp_filter_content_tags', 10 ); \remove_filter( 'the_content', 'wp_filter_content_tags', 12 ); } } /** * Hook into actions and filters. */ public function init_hooks(): void { \add_action( 'after_setup_theme', 'totaltheme_action_callback' ); \add_action( 'after_setup_theme', [ $this, 'hooks_actions' ] ); \add_filter( 'woocommerce_create_pages', [ $this, 'disable_woocommerce_create_pages' ] ); } /** * Runs on the after_setup_theme hook. */ public function hooks_actions(): void { require_once \WPEX_INC_DIR . 'functions/hooks/hooks.php'; require_once \WPEX_INC_DIR . 'functions/hooks/add-actions.php'; require_once \WPEX_INC_DIR . 'functions/hooks/remove-actions.php'; require_once \WPEX_INC_DIR . 'functions/hooks/partials.php'; } /** * Set initial theme version. */ private function set_initial_version(): void { if ( \get_option( 'totaltheme_initial_version' ) ) { return; } if ( $old_option = \get_option( 'total_initial_version' ) ) { $version = $old_option; } else { $version = \totaltheme_get_version(); } $update_option = \update_option( 'totaltheme_initial_version', \sanitize_text_field( $version ), false ); if ( $update_option && $old_option ) { \delete_option( 'total_initial_version' ); } } /** * Set theme db version. */ private function set_db_version(): void { if ( ! \totaltheme_get_version( 'db' ) ) { \update_option( 'totaltheme_version', \totaltheme_get_version(), false ); } } /** * Registers health checks. */ private function health_checks(): void { if ( ! class_exists( 'TotalTheme\Health_Check' ) ) { return; } $health_checks = [ 'TotalTheme\Health_Check\Header_Menu_Dropdown_SuperFish', 'TotalTheme\Health_Check\Jquery_Easing', ]; if ( \WPEX_VC_ACTIVE ) { $health_checks[] = 'TotalTheme\Health_Check\WPBakery_Slim_Mode'; } foreach ( $health_checks as $health_check_classname ) { if ( class_exists( $health_check_classname ) ) { (new $health_check_classname())->register_test(); } } } /** * Prevent Woocommerce from installing pages on installation. * * @return array $pages Array of pages to create when the WooCommerce plugin is installed. */ public function disable_woocommerce_create_pages( $pages ) { if ( \defined( '\WC_INSTALLING' ) && true === \WC_INSTALLING ) { return []; } return $pages; } /** * Prevent cloning. */ protected function __clone() { } /** * Prevent wakeup. */ public function __wakeup() { throw new \Exception( 'Cannot unserialize a singleton.' ); } }
修改文件时间
将文件时间修改为当前时间的前一年
删除文件