Ejemplo n.º 1
0
        $cache_dir = self::get_cache_dir();
        if (is_dir($cache_dir) && ($dh = opendir($cache_dir))) {
            while (($dir = readdir($dh)) !== false) {
                if (!in_array($dir, array('.', '..', 'scripts', 'styles', "{$post_id}"))) {
                    self::removeDirectory($cache_dir . '/' . $dir);
                }
            }
            closedir($dh);
        }
    }
    public static function check_version()
    {
        return version_compare(PHP_VERSION, '5.4', '>=');
    }
}
if (TFCache::check_version() && themify_get('setting-page_builder_is_active') == 'enable') {
    if (!is_admin() && !TFCache::is_ajax()) {
        TFCache::$turnoff_cache = TFCache::is_cache_activate();
        if (!TFCache::$turnoff_cache) {
            $dirname = dirname(__FILE__);
            require_once $dirname . '/minify/minify.php';
            require_once $dirname . '/minify/css.php';
            require_once $dirname . '/minify/html.php';
            require_once $dirname . '/minify/converter.php';
            TFCache::wp_enque_scripts();
        }
    } elseif (is_admin()) {
        add_action('save_post', array('TFCache', 'cache_update'), 10, 3);
    }
} else {
    TFCache::$turnoff_cache = true;
Ejemplo n.º 2
0
 /**
  * Builder Setting cache
  * @param array $data
  * @return string
  * @since 2.0.0
  */
 function themify_manage_builder_cache($data = array())
 {
     if (TFCache::check_version()) {
         $pre = 'setting-page_builder_';
         $output = sprintf('<p><label for="%s"><input type="checkbox" id="%s" name="%s"%s> %s</label></p>', esc_attr($pre . 'cache'), esc_attr($pre . 'cache'), esc_attr($pre . 'cache'), checked(true, themify_check($pre . 'cache'), false), __('Disable Builder caching (keep caching enabled for faster performance)', 'themify'));
         $output .= sprintf('<p data-show-if-element="%s" data-show-if-value="false"><a href="#" data-clearing-text="%s" data-done-text="%s" data-default-text="%s" data-default-icon="ti-eraser" class="button button-outline js-clear-builder-cache"> <i class="ti-eraser"></i> <span>%s</span></a><br><small>%s</small></p>', esc_attr('#' . $pre . 'cache'), esc_html__('Clearing cache...', 'themify'), esc_html__('Done', 'themify'), esc_html__('Clear cache', 'themify'), esc_html__('Clear cache', 'themify'), esc_html__('Clear all Builder cache', 'themify'));
     } else {
         $output = __('Your server does not support Builder cache, thus it is disabled. It requires PHP 5.4+', 'themify');
     }
     return $output;
 }