public static function flush_cache() { return HeadwayOption::delete('webfont-cache'); }
/** * @return bool **/ public static function flush_cache($hard = false) { //Flush Headway cache if it is active. if (self::can_cache()) { //Delete the Headway cache option if hard flush otherwise delete the ones that aren't set to stay with soft flush if ($hard) { HeadwayOption::delete('cache'); } else { $cache = HeadwayOption::get('cache'); foreach ($cache as $cached_file_id => $cached_file) { if (!headway_get('require-hard-flush', $cached_file, false)) { unset($cache[$cached_file_id]); } } HeadwayOption::set('cache', $cache); } //Set do not delete list $no_delete = array('..', '.'); if ($handle = opendir(HEADWAY_CACHE_DIR)) { while (false !== ($file = readdir($handle))) { if (in_array($file, $no_delete) || strpos($file, 'hard-cache') !== false && !$hard) { continue; } @unlink(HEADWAY_CACHE_DIR . '/' . $file); } closedir($handle); } } //Flush plugin caches self::flush_plugin_caches(); return true; }
public static function secure_method_revert_layout() { $layout = headway_post('layout_to_revert'); //Delete the blocks HeadwayBlocksData::delete_by_layout($layout); //Delete the wrappers HeadwayOption::delete($layout, 'wrappers'); //Remove the customized flag HeadwayLayoutOption::set($layout, 'customized', false); do_action('headway_visual_editor_reset_layout'); echo 'success'; }