/**
  * CSS
  */
 public static function frontend_enqueue_css()
 {
     $css = ['frontend' => ['deps' => ['awesome'], 'url' => theme_features::get_theme_css('frontend/frontend')], 'awesome' => ['deps' => [], 'url' => 'http://cdn.bootcss.com/font-awesome/4.4.0/css/font-awesome.min.css', 'version' => null]];
     foreach ($css as $k => $v) {
         wp_enqueue_style($k, $v['url'], isset($v['deps']) ? $v['deps'] : [], self::get_version($v));
     }
 }
Beispiel #2
0
 /**
  * frontend css
  */
 public static function frontend_enqueue_css()
 {
     $frontend_css = theme_cache::is_user_logged_in() ? 'frontend-logged' : 'frontend';
     $css = ['frontend' => ['deps' => ['awesome'], 'url' => theme_features::get_theme_css($frontend_css)], 'awesome' => ['deps' => [], 'url' => '//cdn.bootcss.com/font-awesome/4.4.0/css/font-awesome.min.css', 'version' => null]];
     foreach ($css as $k => $v) {
         wp_enqueue_style($k, $v['url'], isset($v['deps']) ? $v['deps'] : [], self::get_version($v));
     }
 }
Beispiel #3
0
    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_js()
    {
        if (!theme_cache::current_user_can('manage_options')) {
            return false;
        }
        if (!self::is_options_page()) {
            return false;
        }
        ?>
<script id="seajsnode" src="<?php 
        echo theme_features::get_theme_js('seajs/sea');
        ?>
"></script>
		<script>
		<?php 
        $config = [];
        $config['base'] = theme_features::get_theme_js();
        $config['paths'] = array('theme_js' => theme_features::get_theme_js(), 'theme_css' => theme_features::get_theme_css());
        $config['vars'] = array('locale' => str_replace('-', '_', theme_cache::get_bloginfo('language')), 'theme_js' => theme_features::get_theme_js(), 'theme_css' => theme_features::get_theme_css(), 'process_url' => theme_features::get_process_url());
        $config['map'] = array(['.css', '.css?v=' . theme_file_timestamp::get_timestamp()], ['.js', '.js?v=' . theme_file_timestamp::get_timestamp()]);
        /** 
         * seajs hook
         */
        $config['paths'] = apply_filters('backend_seajs_paths', $config['paths']);
        $config['alias'] = apply_filters('backend_seajs_alias', []);
        $config['vars'] = apply_filters('backend_seajs_vars', $config['vars']);
        $config['map'] = apply_filters('backend_seajs_map', $config['map']);
        ?>
		seajs.config(<?php 
        echo json_encode($config);
        ?>
);
		<?php 
        do_action('before_backend_tab_init');
        ?>
		seajs.use('backend',function(backend_m){
			backend_m.config.lang.M01 = '<?php 
        echo ___('Saving your settings, please wait...');
        ?>
';
			backend_m.init();
			<?php 
        do_action('after_backend_tab_init');
        ?>
		});
		</script>
		<?php 
    }