HEX
Server: Apache
System: Linux webd001.cluster127.gra.hosting.ovh.net 6.18.42-ovh-vps-grsec-zfs+ #1 SMP PREEMPT_DYNAMIC Wed Aug 5 15:59:48 CEST 2026 x86_64
User: mciraet (192513)
PHP: 8.2.31
Disabled: _dyuweyrj4,_dyuweyrj4r,dl
Upload Files
File: /home/mciraet/www/wp-content/plugins/js_composer/include/autoload/hooks/hook-vc-element-teasers.php
<?php
/**
 * Initialize element teasers preloading on admin_init.
 *
 * @since 8.7
 */

if ( ! defined( 'ABSPATH' ) ) {
	die( '-1' );
}

/**
 * Initialize element teasers preloading on admin_init.
 *
 * Only runs in admin area for users with WPBakery access.
 * Preloads teasers data to cache so editor load is not delayed by API calls.
 *
 * @since 8.7
 */
function wpb_element_teasers_admin_init() {
	if ( ! is_admin() ) {
		return;
	}

	if ( ! vc_user_access()->part( 'shortcodes' )->can()->get() ) {
		return;
	}

	// Load teasers class file if not already loaded.
	if ( ! class_exists( 'WPB_Element_Teasers' ) ) {
		require_once vc_path_dir( 'EDITORS_DIR', 'popups/class-vc-element-teasers.php' );
	}

	// Preload teasers (will fetch from API if cache is empty/expired).
	if ( class_exists( 'WPB_Element_Teasers' ) ) {
		$teasers_manager = new WPB_Element_Teasers();
		$teasers_manager->preload_teasers();
	}
}

add_action( 'admin_init', 'wpb_element_teasers_admin_init' );