Пример #1
0
 public static function frontend_css()
 {
     if (!self::is_page()) {
         return false;
     }
     wp_enqueue_style(__CLASS__, theme_features::get_theme_addons_css(__DIR__), 'frontend', theme_file_timestamp::get_timestamp());
 }
 public static function set_timestamp($value = null)
 {
     if (!$value) {
         $value = $_SERVER['REQUEST_TIME'];
     }
     self::$timestamp = $value;
     theme_options::set_options(self::$iden, self::$timestamp);
 }
Пример #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 
    }
 private static function get_version($v)
 {
     return array_key_exists('version', $v) ? $v['version'] : theme_file_timestamp::get_timestamp();
 }
Пример #5
0
 public static function frontend_enqueue_scripts()
 {
     $data = apply_filters('dynamic_request', []);
     $data['action'] = __CLASS__;
     wp_enqueue_script(__CLASS__, theme_features::get_process_url($data), [], theme_file_timestamp::get_timestamp(), true);
 }
 /**
  * process
  */
 public static function process()
 {
     if (!theme_cache::current_user_can('manage_options')) {
         return false;
     }
     @ini_set('max_input_nesting_level', '10000');
     @ini_set('max_execution_time', 0);
     remove_dir(theme_features::get_stylesheet_directory() . theme_features::$basedir_js_min);
     theme_features::minify_force(theme_features::get_stylesheet_directory() . theme_features::$basedir_js_src);
     remove_dir(theme_features::get_stylesheet_directory() . theme_features::$basedir_css_min);
     theme_features::minify_force(theme_features::get_stylesheet_directory() . theme_features::$basedir_css_src);
     theme_features::minify_force(theme_features::get_stylesheet_directory() . theme_features::$basedir_addons);
     theme_file_timestamp::set_timestamp();
     wp_redirect(add_query_arg(__CLASS__, 1, theme_options::get_url()));
     die;
 }
Пример #7
0
 public static function frontend_css()
 {
     if (!self::is_page()) {
         return false;
     }
     $tabs = self::get_tabs();
     $tab_active = get_query_var('tab');
     switch ($tab_active) {
         case 'avatar':
             wp_enqueue_style(__CLASS__ . '-' . $tab_active, theme_features::get_theme_addons_css(__DIR__, $tab_active), 'frontend', theme_file_timestamp::get_timestamp());
             wp_enqueue_style(__CLASS__ . '-cropper', theme_features::get_theme_addons_css(__DIR__, 'cropper'), 'frontend', theme_file_timestamp::get_timestamp());
             break;
     }
 }
Пример #8
0
 public static function frontend_css()
 {
     if (!theme_cache::is_singular('post') || !self::is_enabled()) {
         return false;
     }
     wp_enqueue_style(__CLASS__, theme_features::get_theme_addons_css(__DIR__), 'frontend', theme_file_timestamp::get_timestamp());
 }
Пример #9
0
 /**
  * check_timestamp
  *
  * @version 1.0.1
  */
 public static function check_timestamp()
 {
     if (theme_cache::current_user_can('manage_options') && theme_file_timestamp::get_timestamp() < self::get_theme_mtime()) {
         /** clear opcache */
         if (function_exists('opcache_reset')) {
             opcache_reset();
         }
         /** update timestamp */
         theme_file_timestamp::set_timestamp();
     }
 }
 public static function backend_css()
 {
     wp_register_style(__CLASS__ . '-backend', theme_features::get_theme_addons_css(__DIR__, 'backend'), false, theme_file_timestamp::get_timestamp());
     wp_enqueue_style(__CLASS__ . '-backend');
 }
    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 
    }
 /**
  * auto_minify
  *
  * @return 
  * @version 2.0.0
  */
 public static function auto_minify()
 {
     /** 
      * js and css files version
      */
     if (theme_cache::current_user_can('manage_options') && theme_file_timestamp::get_timestamp() < self::get_theme_mtime()) {
         ini_set('max_input_nesting_level', 10000);
         ini_set('max_execution_time', 0);
         self::minify_force(self::get_stylesheet_directory() . self::$basedir_js_src);
         self::minify_force(self::get_stylesheet_directory() . self::$basedir_css_src);
         self::minify_force(self::get_stylesheet_directory() . self::$basedir_addons);
         theme_file_timestamp::set_timestamp();
     }
 }