文件操作 - wpbakery.php
返回文件管理
返回主菜单
删除本文件
文件: /storage/v12552/jimbrandstatter/public_html/wp-content/themes/Total/inc/integration/wpbakery.php
编辑文件内容
<?php namespace TotalTheme\Integration; use TotalTheme\Integration\WPBakery\Helpers; \defined( 'ABSPATH' ) || exit; /** * WPBakery Integration. */ class WPBakery { /** * Init. */ public static function init() { // Preload required classes. if ( ! \class_exists( '\TotalTheme\Integration\WPBakery\Helpers' ) ) { return; } // Get things started; self::init_classes(); self::init_hooks(); } /** * Initiate classes. */ public static function init_classes(): void { $slim_mode_enabled = totaltheme_call_static( 'Integration\WPBakery\Slim_Mode', 'is_enabled' ); if ( $slim_mode_enabled ) { totaltheme_init_class( __NAMESPACE__ . '\WPBakery\Slim_Mode' ); } else { totaltheme_init_class( __NAMESPACE__ . '\WPBakery\Modify_Weights' ); } totaltheme_init_class( __NAMESPACE__ . '\WPBakery\Remove_Elements' ); totaltheme_init_class( __NAMESPACE__ . '\WPBakery\Disable_About_Screen' ); totaltheme_init_class( __NAMESPACE__ . '\WPBakery\Inline_CSS' ); totaltheme_init_class( __NAMESPACE__ . '\WPBakery\Full_Width' ); totaltheme_init_class( __NAMESPACE__ . '\WPBakery\Shortcode_Theme_Styles' ); totaltheme_init_class( __NAMESPACE__ . '\WPBakery\Layout_Templates' ); if ( wp_validate_boolean( \get_theme_mod( 'wpb_optimize_js_enable', true ) ) ) { totaltheme_init_class( __NAMESPACE__ . '\WPBakery\Optimize_JS' ); } totaltheme_init_class( __NAMESPACE__ . '\WPBakery\Preload_Styles' ); totaltheme_init_class( __NAMESPACE__ . '\WPBakery\Patterns' ); totaltheme_init_class( __NAMESPACE__ . '\WPBakery\Elements\Section') ; totaltheme_init_class( __NAMESPACE__ . '\WPBakery\Elements\Row' ); totaltheme_init_class( __NAMESPACE__ . '\WPBakery\Elements\Column' ); // @todo create namespaced classes for these. require_once \WPEX_INC_DIR . 'integration/wpbakery/classes/class-vcex-parse-row-atts.php'; require_once \WPEX_INC_DIR . 'integration/wpbakery/classes/class-vcex-vc-column-text-config.php'; if ( ! $slim_mode_enabled ) { require_once \WPEX_INC_DIR . 'integration/wpbakery/actions/filter-font-container.php'; require_once \WPEX_INC_DIR . 'integration/wpbakery/classes/class-vcex-vc-tabs-config.php'; require_once \WPEX_INC_DIR . 'integration/wpbakery/classes/class-vcex-single-image-config.php'; } totaltheme_init_class( __NAMESPACE__ . '\WPBakery\BG_Overlays' ); totaltheme_init_class( __NAMESPACE__ . '\WPBakery\Video_Backgrounds' ); if ( \apply_filters( 'vcex_supports_advanced_parallax', true ) ) { totaltheme_init_class( __NAMESPACE__ . '\WPBakery\Advanced_Parallax' ); } if ( \apply_filters( 'vcex_supports_shape_dividers', true ) ) { totaltheme_init_class( __NAMESPACE__ . '\WPBakery\Shape_Dividers' ); } // Theme mode. if ( Helpers::is_theme_mode_enabled() ) { totaltheme_init_class( __NAMESPACE__ . '\WPBakery\Disable_Updates' ); if ( is_admin() ) { \wpex_remove_class_filter( 'admin_init', 'Vc_Notice_Controller', 'init', 10 ); // Remove the nasty sale notices. totaltheme_init_class( __NAMESPACE__ . '\WPBakery\Disable_Template_Library' ); totaltheme_init_class( __NAMESPACE__ . '\WPBakery\Disable_Custom_CSS_Page' ); totaltheme_init_class( __NAMESPACE__ . '\WPBakery\Disable_Product_License_Page' ); } if ( \get_theme_mod( 'wpbakery_design_options_enable', false ) && ! totaltheme_call_static( 'Integration\WPBakery\Slim_Mode', 'is_enabled' ) ) { totaltheme_init_class( __NAMESPACE__ . '\WPBakery\Enable_Design_Options' ); } else { totaltheme_init_class( __NAMESPACE__ . '\WPBakery\Disable_Design_Options' ); } } } /** * Hook into actions and filters. */ public static function init_hooks(): void { \add_action( 'init', [ self::class, 'init_hook' ], 20 ); \add_action( 'admin_init', [ self::class, 'admin_init_hook' ], 20 ); // Tweak scripts. if ( ! totaltheme_call_static( 'Integration\WPBakery\Slim_Mode', 'is_enabled' ) ) { \add_action( 'wp_enqueue_scripts', [ self::class, 'load_composer_front_css' ], 0 ); } // Disable default templates. \add_filter( 'vc_load_default_templates', '__return_empty_array' ); // Modify core scripts. \add_action( 'wp_enqueue_scripts', [ self::class, 'register_scripts' ] ); \add_action( 'wp_footer', [ self::class, 'remove_footer_scripts' ] ); \add_action( 'wp_footer', [ self::class, 'enqueue_dependent_scripts' ] ); \add_action( 'vc_load_iframe_jscss', [ self::class, 'iframe_scripts' ] ); // Editor Scripts. \add_action( 'vc_base_register_admin_css', [ self::class, 'register_admin_css' ] ); \add_action( 'vc_backend_editor_enqueue_js_css', [ self::class, 'enqueue_be_editor_scripts' ] ); \add_action( 'vc_frontend_editor_enqueue_js_css', [ self::class, 'enqueue_fe_editor_scripts' ] ); // Add new background styles - @todo is this still needed? \add_filter( 'vc_css_editor_background_style_options_data', [ self::class, 'background_styles' ] ); // Modify iFrame URL for header/footer builder - @todo remove as this shouldn't be needed anymore. \add_filter( 'vc_frontend_editor_iframe_url', [ self::class, 'vc_frontend_editor_iframe_url' ] ); // Inline scripts used to re-trigger js when elements are updated/added/removed. \add_action( 'vc_inline_editor_page_view', [ self::class, 'frontend_scripts' ], PHP_INT_MAX ); // Disable the WPBakery editor for certain post types. \add_filter( 'vc_check_post_type_validation', [ self::class, 'disable_editor' ], 10, 2 ); // Add customizer settings. \add_filter( 'wpex_customizer_panels', [ self::class, 'customizer_settings' ] ); // Insert noscript tags - @todo remove CSS added to VC js stretched rows and remove this. if ( true === \apply_filters( 'wpex_noscript_tags', true ) ) { \add_action( 'wp_head', [ self::class, 'noscript' ], 60 ); } // Fixes issues with multisite wp-activate.php template not displaying shortcodes. // @todo deprecate when no longer needed. if ( \is_multisite() && ! empty( $GLOBALS['pagenow'] ) && \in_array( $GLOBALS['pagenow'], [ 'wp-activate.php', 'wp-signup.php' ] ) && \function_exists( 'wpbakery' ) ) { \add_action( 'activate_header', [ self::class, 'init_wpbakery' ] ); \add_action( 'before_signup_header', [ self::class, 'init_wpbakery' ] ); } } /** * Functions that run on init. */ public static function init_hook(): void { if ( \function_exists( 'visual_composer' ) ) { \remove_action( 'wp_head', [ \visual_composer(), 'addMetaData' ] ); } if ( \function_exists( 'vc_set_default_editor_post_types' ) ) { \vc_set_default_editor_post_types( [ 'page', 'portfolio', 'staff' ] ); } } /** * Functions that run on admin_init. */ public static function admin_init_hook(): void { \add_filter( 'vc_nav_front_logo', [ self::class, 'editor_nav_logo' ] ); // Remove purchase notice \wpex_remove_class_filter( 'admin_notices', 'Vc_License', 'adminNoticeLicenseActivation', 10 ); } /** * Override editor logo. */ public static function editor_nav_logo(): string { return '<div id="vc_logo" class="vc_navbar-brand" aria-hidden="true"></div>'; } /** * Load js_composer_front CSS early on for easier modification. */ public static function load_composer_front_css(): void { \wp_enqueue_style( 'js_composer_front' ); } /** * Register scripts for later loading. */ public static function register_scripts(): void { \wp_register_script( 'wpex-vc_tabs-accessibility', \totaltheme_get_js_file( 'frontend/wpbakery/vc_tabs-accessibility' ), [ 'vc_tabs_script' ], \WPEX_THEME_VERSION, true ); \wp_register_script( 'wpex-vc_accordion-events', \totaltheme_get_js_file( 'frontend/wpbakery/vc_accordion-events' ), [ 'vc_accordion_script', 'jquery' ], \WPEX_THEME_VERSION, true ); \wp_register_script( 'wpex-vc_waypoints', \totaltheme_get_js_file( 'frontend/wpbakery/vc_waypoints' ), [ 'jquery-core', 'vc_waypoints' ], \WPEX_THEME_VERSION, true ); /** * Filters the vc_waypoints script settings. * * @param array $settings */ $waypoints_settings = [ 'delay' => 300, 'offset' => '85%' ]; $waypoints_settings = (array) \apply_filters( 'wpex_vc_waypoints_settings', $waypoints_settings ); \wp_localize_script( 'wpex-vc_waypoints', 'wpex_vc_waypoints_params', $waypoints_settings ); } /** * Remove scripts hooked in too late for me to remove on wp_enqueue_scripts. */ public static function remove_footer_scripts(): void { /** * Remove extra owl carousel if the Total carousel CSS has been loaded. * * @todo can this be removed at some point? */ if ( \wp_style_is( 'wpex-owl-carousel', 'enqueued' ) ) { \wp_deregister_style( 'vc_pageable_owl-carousel-css' ); \wp_dequeue_style( 'vc_pageable_owl-carousel-css' ); } } /** * Enqueues scripts dependent on other WPBakery scripts. */ public static function enqueue_dependent_scripts(): void { if ( \wp_script_is( 'vc_tabs_script' ) ) { \wp_enqueue_script( 'wpex-vc_tabs-accessibility' ); } if ( \wp_script_is( 'vc_accordion_script' ) ) { \wp_enqueue_script( 'wpex-vc_accordion-events' ); } if ( \wp_script_is( 'vc_waypoints' ) ) { \wp_enqueue_script( 'wpex-vc_waypoints' ); } } /** * iFrame Scripts. * * These scripts load in the front-end editor iframe which renders the site. */ public static function iframe_scripts(): void { \wp_enqueue_style( 'totaltheme-wpbakery-iframe', \wpex_asset_url( 'css/admin/wpbakery/iframe.css' ), [], \WPEX_THEME_VERSION ); \wp_style_add_data( 'totaltheme-wpbakery-iframe', 'rtl', 'replace' ); } /** * Frontend Editor Scripts. */ public static function frontend_scripts(): void { \wp_enqueue_script( 'wpex-vc_reload', \totaltheme_get_js_file( 'admin/wpbakery/vc_reload' ), [ 'jquery' ], \WPEX_THEME_VERSION, true ); if ( \get_theme_mod( 'extend_visual_composer', true ) ) { \wp_enqueue_style( 'vcex-shortcodes-vc_inline', \wpex_asset_url( 'css/vcex-shortcodes-vc_inline.css' ), [], \WPEX_THEME_VERSION ); } } /** * Register editor scripts. */ public static function register_admin_css(): void { \wp_register_style( 'totaltheme-wpbakery-backend-editor', \wpex_asset_url( 'css/admin/wpbakery/backend-editor.css' ), [ 'js_composer' ], \WPEX_THEME_VERSION ); \wp_style_add_data( 'totaltheme-wpbakery-backend-editor', 'rtl', 'replace' ); \wp_register_style( 'totaltheme-wpbakery-frontend-editor', \wpex_asset_url( 'css/admin/wpbakery/frontend-editor.css' ), [ 'vc_inline_css' ], \WPEX_THEME_VERSION ); \wp_style_add_data( 'totaltheme-wpbakery-frontend-editor', 'rtl', 'replace' ); // @todo remove following scripts if WPBakery ever adds PHP hooks. \wp_register_style( 'totaltheme-wpbakery-hide-layout-options', \wpex_asset_url( 'css/admin/wpbakery/hide-layout-options.css' ), [], \WPEX_THEME_VERSION ); \wp_register_style( 'totaltheme-wpbakery-hide-ai-buttons', \wpex_asset_url( 'css/admin/wpbakery/hide-ai-buttons.css' ), [], \WPEX_THEME_VERSION ); } /** * Enqueue backend editor scripts. */ public static function enqueue_be_editor_scripts(): void { \wp_enqueue_style( 'totaltheme-wpbakery-backend-editor' ); if ( totaltheme_call_static( 'Integration\WPBakery\Slim_Mode', 'is_enabled' ) ) { \wp_enqueue_style( 'totaltheme-wpbakery-hide-layout-options' ); } if ( Helpers::is_theme_mode_enabled() ) { \wp_enqueue_style( 'totaltheme-wpbakery-hide-ai-buttons' ); } } /** * Enqueue frontend editor scripts. */ public static function enqueue_fe_editor_scripts(): void { \wp_enqueue_style( 'totaltheme-wpbakery-frontend-editor' ); if ( totaltheme_call_static( 'Integration\WPBakery\Slim_Mode', 'is_enabled' ) ) { \wp_enqueue_style( 'totaltheme-wpbakery-hide-layout-options' ); } if ( Helpers::is_theme_mode_enabled() ) { \wp_enqueue_style( 'totaltheme-wpbakery-hide-ai-buttons' ); } } /** * Adds Customizer settings for VC. */ public static function customizer_settings( array $panels ): array { $branding = ( $branding = \wpex_get_theme_branding() ) ? ' (' . $branding . ')' : ''; $panels['visual_composer'] = [ 'title' => "WPBakery Builder{$branding}", 'settings' => \WPEX_INC_DIR . 'integration/wpbakery/customizer-settings.php', 'is_section' => true, ]; return $panels; } /** * Add noscript tag for stretched rows. */ public static function noscript(): void { echo '<noscript><style>body:not(.content-full-screen) .wpex-vc-row-stretched[data-vc-full-width-init="false"]{visibility:visible;}</style></noscript>'; } /** * Add new background style options. */ public static function background_styles( array $styles ): array { $styles[ \esc_html__( 'Repeat-x', 'total' ) ] = 'repeat-x'; $styles[ \esc_html__( 'Repeat-y', 'total' ) ] = 'repeat-y'; return $styles; } /** * Disable builder completely on admin post types. */ public static function disable_editor( $check, $type ) { $excluded_types = [ 'attachment', 'wpex_font', 'wpex_sidebars', 'wpex_color_palette', 'acf', 'acf-field-group', 'acf-ui-options-page', 'elementor_library', ]; if ( \in_array( $type, $excluded_types ) ) { $check = false; } return $check; } /** * Parse vc_frontend_editor_iframe_url to allow footer/header builder templates. */ public static function vc_frontend_editor_iframe_url( $url ) { if ( $url && is_string( $url ) ) { if ( isset( $_GET['wpex_inline_header_template_editor'] ) ) { $header_template_safe = \absint( $_GET['wpex_inline_header_template_editor'] ); $url = \esc_url( "{$url}&wpex_inline_header_template_editor={$header_template_safe}" ); } if ( isset( $_GET['wpex_inline_footer_template_editor'] ) ) { $footer_template_safe = \absint( $_GET['wpex_inline_footer_template_editor'] ); $url = \esc_url( "{$url}&wpex_inline_footer_template_editor={$footer_template_safe}" ); } } return $url; } /** * Fixes issues with multisite wp-activate.php and wp-signup.php template not displaying shortcodes. */ public static function init_wpbakery(): void { $methods = [ [ \wpbakery(), 'frontCss' ], [ \wpbakery(), 'frontJsRegister'], [ 'WPBMap', 'addAllMappedShortcodes' ], ]; foreach ( $methods as $method ) { if ( \is_callable( $method ) ) { \call_user_func( $method ); } } } }
修改文件时间
将文件时间修改为当前时间的前一年
删除文件