/** * JS */ public static function seajs_enqueue_scripts() { $js = ['frontend-seajs' => ['deps' => [], 'url' => theme_features::get_theme_js('seajs/sea')]]; foreach ($js as $k => $v) { wp_enqueue_script($k, $v['url'], isset($v['deps']) ? $v['deps'] : [], self::get_version($v), true); } }
/** frontend js */ public static function frontend_enqueue_scripts() { $frontend_js = theme_cache::is_user_logged_in() ? 'frontend-logged' : 'frontend-entry'; $js = ['frontend' => ['deps' => [], 'url' => theme_features::get_theme_js($frontend_js)]]; foreach ($js as $k => $v) { wp_enqueue_script($k, $v['url'], isset($v['deps']) ? $v['deps'] : [], self::get_version($v), true); } }
public static function backend_js() { if (!self::is_options_page()) { return; } $config = ['vars' => ['locale' => str_replace('-', '_', theme_cache::get_bloginfo('language')), 'theme_js' => theme_features::get_theme_js(), 'theme_css' => theme_features::get_theme_css(), 'theme_images' => theme_features::get_theme_images_url(), 'process_url' => theme_features::get_process_url(), 'timestamp' => theme_file_timestamp::get_timestamp()], 'lang' => ['M01' => ___('Loading, please wait...'), 'E01' => ___('Sorry, server is busy now, can not respond your request, please try again later.')]]; /** Hook 'backend_js_config' */ ?> <script> window.THEME_CONFIG = <?php echo json_encode(apply_filters('backend_js_config', (array) $config)); ?> ; </script> <?php }
public static function backend_seajs_alias(array $alias = []) { $alias['backend'] = theme_features::get_theme_js('backend'); return $alias; }