本文整理汇总了PHP中wp_cache_clean_cache函数的典型用法代码示例。如果您正苦于以下问题:PHP wp_cache_clean_cache函数的具体用法?PHP wp_cache_clean_cache怎么用?PHP wp_cache_clean_cache使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了wp_cache_clean_cache函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: clear_cache
public function clear_cache()
{
if (function_exists('wp_cache_clean_cache')) {
global $file_prefix;
wp_cache_clean_cache($file_prefix);
}
}
示例2: clear_pagecache
/**
* Clear cache
*/
public function clear_pagecache()
{
global $file_prefix;
if (function_exists('wp_cache_clean_cache')) {
wp_cache_clean_cache($file_prefix, true);
}
}
示例3: ccfm_clear_cache_for_me
/**
* Clear the caches!
*/
function ccfm_clear_cache_for_me($source)
{
global $wp_fastest_cache;
do_action('ccfm_clear_cache_for_me_before', $source);
// if W3 Total Cache is being used, clear the cache
if (function_exists('w3tc_pgcache_flush')) {
w3tc_pgcache_flush();
} else {
if (function_exists('wp_cache_clean_cache')) {
global $file_prefix, $supercachedir;
if (empty($supercachedir) && function_exists('get_supercache_dir')) {
$supercachedir = get_supercache_dir();
}
wp_cache_clean_cache($file_prefix);
} else {
if (class_exists('WpeCommon')) {
//be extra careful, just in case 3rd party changes things on us
if (method_exists('WpeCommon', 'purge_memcached')) {
WpeCommon::purge_memcached();
}
if (method_exists('WpeCommon', 'purge_memcached')) {
WpeCommon::clear_maxcdn_cache();
}
if (method_exists('WpeCommon', 'purge_memcached')) {
WpeCommon::purge_varnish_cache();
}
} else {
if (method_exists('WpFastestCache', 'deleteCache') && !empty($wp_fastest_cache)) {
$wp_fastest_cache->deleteCache();
}
}
}
}
do_action('ccfm_clear_cache_for_me', $source);
}
示例4: ajax_refresh_static_posts
function ajax_refresh_static_posts()
{
check_ajax_referer('refreshstaticposts');
if (isset($_POST['number'])) {
$number = absint($_POST['number']);
$action = sanitize_text_field($_POST['action']);
$name = sanitize_text_field($_POST['name']);
//Get the SRP widgets
$settings = get_option($name);
$widget = $settings[$number];
//Get the new post IDs
$widget = $this->build_posts(intval($widget['postlimit']), $widget);
$post_ids = $widget['posts'];
//Save the settings
$settings[$number] = $widget;
//Only save if user is admin
if (is_user_logged_in() && current_user_can('administrator')) {
update_option($name, $settings);
//Let's clean up the cache
//Update WP Super Cache if available
if (function_exists("wp_cache_clean_cache")) {
@wp_cache_clean_cache('wp-cache-');
}
}
//Build and send the response
die($this->print_posts($post_ids, false));
}
exit;
}
示例5: reset_caches
function reset_caches()
{
global $cache_path, $file_prefix;
if (function_exists('prune_super_cache')) {
prune_super_cache($cache_path, true);
}
if (function_exists('wp_cache_clean_cache')) {
wp_cache_clean_cache($file_prefix);
}
}
示例6: mt_clear_cache
public static function mt_clear_cache()
{
global $file_prefix;
if (function_exists('w3tc_pgcache_flush')) {
w3tc_pgcache_flush();
}
if (function_exists('wp_cache_clean_cache')) {
wp_cache_clean_cache($file_prefix, true);
}
}
示例7: flush
/**
* Clear something from the cache.
*
* @synopsis [--post_id=<post-id>] [--permalink=<permalink>]
*/
function flush($args = array(), $assoc_args = array())
{
if (isset($assoc_args['post_id'])) {
if (is_numeric($assoc_args['post_id'])) {
wp_cache_post_change($assoc_args['post_id']);
} else {
WP_CLI::error('This is not a valid post id.');
}
wp_cache_post_change($assoc_args['post_id']);
} elseif (isset($assoc_args['permalink'])) {
$id = url_to_postid($assoc_args['permalink']);
if (is_numeric($id)) {
wp_cache_post_change($id);
} else {
WP_CLI::error('There is no post with this permalink.');
}
} else {
global $file_prefix;
wp_cache_clean_cache($file_prefix, true);
WP_CLI::success('Cache cleared.');
}
}
示例8: wp_cache_files
function wp_cache_files()
{
global $cache_path, $file_prefix, $cache_max_time, $valid_nonce, $supercachedir, $cache_enabled, $super_cache_enabled, $blog_cache_dir, $cache_compression;
if ('/' != substr($cache_path, -1)) {
$cache_path .= '/';
}
if ($valid_nonce) {
if (isset($_REQUEST['wp_delete_cache'])) {
wp_cache_clean_cache($file_prefix);
}
if (isset($_REQUEST['wp_delete_expired'])) {
wp_cache_clean_expired($file_prefix);
}
}
echo "<a name='listfiles'></a>";
echo '<fieldset class="options" id="show-this-fieldset"><h3>' . __('Cache Contents', 'wp-super-cache') . '</h3>';
$list_files = false;
// it doesn't list supercached files, and removing single pages is buggy
$count = 0;
$expired = 0;
$now = time();
if ($handle = @opendir($blog_cache_dir . 'meta/')) {
if ($list_files) {
echo "<table cellspacing=\"0\" cellpadding=\"5\">";
}
$wp_cache_fsize = 0;
if ($valid_nonce && isset($_GET['action']) && $_GET['action'] == 'deletewpcache') {
$deleteuri = preg_replace('/[ <>\'\\"\\r\\n\\t\\(\\)]/', '', str_replace('/index.php', '/', str_replace('..', '', preg_replace("/(\\?.*)?\$/", '', base64_decode($_GET['uri'])))));
$deleteuri = str_replace('\\', '', $deleteuri);
} else {
$deleteuri = '';
}
if ($valid_nonce && isset($_GET['action']) && $_GET['action'] == 'deletesupercache') {
$supercacheuri = preg_replace('/[ <>\'\\"\\r\\n\\t\\(\\)]/', '', str_replace('/index.php', '/', str_replace('..', '', preg_replace("/(\\?.*)?\$/", '', base64_decode($_GET['uri'])))));
$supercacheuri = trailingslashit(str_replace('\\', '', $supercacheuri));
printf(__("Deleting supercache file: <strong>%s</strong><br />", 'wp-super-cache'), $supercacheuri);
@unlink($cache_path . 'supercache/' . $supercacheuri . 'index.html');
@unlink($cache_path . 'supercache/' . $supercacheuri . 'index.html.gz');
prune_super_cache($cache_path . 'supercache/' . $supercacheuri . 'page', true);
@rmdir($cache_path . 'supercache/' . $supercacheuri);
}
while (false !== ($file = readdir($handle))) {
if (preg_match("/^{$file_prefix}.*\\.meta/", $file)) {
$content_file = preg_replace("/meta\$/", "html", $file);
$mtime = filemtime($blog_cache_dir . 'meta/' . $file);
if (!($fsize = @filesize($blog_cache_dir . $content_file))) {
continue;
}
// .meta does not exists
$age = $now - $mtime;
if ($valid_nonce && $_GET['listfiles']) {
$meta = unserialize(file_get_contents($blog_cache_dir . 'meta/' . $file));
if ($deleteuri != '' && $meta['uri'] == $deleteuri) {
printf(__("Deleting wp-cache file: <strong>%s</strong><br />", 'wp-super-cache'), $deleteuri);
@unlink($blog_cache_dir . 'meta/' . $file);
@unlink($blog_cache_dir . $content_file);
continue;
}
$meta['age'] = $age;
if ($age > $cache_max_time) {
$expired_list[$age][] = $meta;
} else {
$cached_list[$age][] = $meta;
}
}
if ($age > $cache_max_time) {
$expired++;
} else {
$count++;
}
$wp_cache_fsize += $fsize;
$fsize = intval($fsize / 1024);
}
}
closedir($handle);
if ($list_files) {
echo "</table>";
}
}
if ($wp_cache_fsize != 0) {
$wp_cache_fsize = $wp_cache_fsize / 1024;
} else {
$wp_cache_fsize = 0;
}
if ($wp_cache_fsize > 1024) {
$wp_cache_fsize = number_format($wp_cache_fsize / 1024, 2) . "MB";
} elseif ($wp_cache_fsize != 0) {
$wp_cache_fsize = number_format($wp_cache_fsize, 2) . "KB";
} else {
$wp_cache_fsize = '0KB';
}
if ($cache_enabled == true && $super_cache_enabled == true) {
$now = time();
$sizes = array('expired' => 0, 'expired_list' => array(), 'cached' => 0, 'cached_list' => array(), 'ts' => 0);
if (is_dir($supercachedir)) {
if ($dh = opendir($supercachedir)) {
while (($entry = readdir($dh)) !== false) {
if ($entry != '.' && $entry != '..') {
$sizes = wpsc_dirsize(trailingslashit($supercachedir) . $entry, $sizes);
}
//.........这里部分代码省略.........
示例9: manage_options
function manage_options()
{
if (isset($_GET['download'])) {
if ($_GET['download'] == 'site') {
check_admin_referer('thesis-download-site');
#wp
header("Cache-Control: public, must-revalidate");
header("Pragma: hack");
header("Content-Type: text/plain");
header('Content-Disposition: attachment; filename="thesis-site-options-' . date("Ymd") . '.dat"');
$site_options = new thesis_site_options();
$site_options->get_options();
echo serialize($site_options);
exit;
} elseif ($_GET['download'] == 'design') {
check_admin_referer('thesis-download-design');
#wp
header("Cache-Control: public, must-revalidate");
header("Pragma: hack");
header("Content-Type: text/plain");
header('Content-Disposition: attachment; filename="thesis-design-options-' . date("Ymd") . '.dat"');
$design_options = new thesis_design_options();
$design_options->get_options();
echo serialize($design_options);
exit;
} elseif ($_GET['download'] == 'all') {
check_admin_referer('thesis-download-all');
#wp
header("Cache-Control: public, must-revalidate");
header("Pragma: hack");
header("Content-Type: text/plain");
header('Content-Disposition: attachment; filename="thesis-all-options-' . date("Ymd") . '.dat"');
$site_options = new thesis_site_options();
$site_options->get_options();
$design_options = new thesis_design_options();
$design_options->get_options();
echo serialize(array('site_options' => $site_options, 'design_options' => $design_options));
exit;
}
} elseif (isset($_GET['restore'])) {
if ($_GET['restore'] == 'site') {
check_admin_referer('thesis-restore-site');
#wp
$default_site_options = new thesis_site_options();
$default_site_options->default_options();
update_option('thesis_options', $default_site_options);
#wp
wp_redirect(admin_url('admin.php?page=options-manager&restored=true&type=Site'));
#wp
} elseif ($_GET['restore'] == 'design') {
check_admin_referer('thesis-restore-design');
#wp
$default_design_options = new thesis_design_options();
$default_design_options->default_options();
update_option('thesis_design_options', $default_design_options);
#wp
thesis_generate_css();
wp_redirect(admin_url('admin.php?page=options-manager&restored=true&type=Design'));
#wp
} elseif ($_GET['restore'] == 'all') {
check_admin_referer('thesis-restore-all');
#wp
$default_site_options = new thesis_site_options();
$default_site_options->default_options();
$default_design_options = new thesis_design_options();
$default_design_options->default_options();
update_option('thesis_options', $default_site_options);
#wp
update_option('thesis_design_options', $default_design_options);
#wp
thesis_generate_css();
wp_redirect(admin_url('admin.php?page=options-manager&restored=true&type=All'));
#wp
}
} elseif (isset($_POST['upload'])) {
global $thesis_site;
if ($_POST['upload'] == 'site') {
check_admin_referer('thesis-upload-site', '_wpnonce-thesis-upload-site');
#wp
if (strpos($_FILES['file']['name'], 'thesis-site-options') === false) {
wp_redirect(admin_url('admin.php?page=options-manager&type=Site&error=wrongfile'));
} elseif ($_FILES['file']['error'] > 0) {
wp_redirect(admin_url('admin.php?page=options-manager&type=Site&error=file'));
} else {
$raw_options = file_get_contents($_FILES['file']['tmp_name']);
$site_options = new thesis_site_options();
$site_options = unserialize($raw_options);
if (function_exists('wp_cache_clean_cache')) {
#wp
global $file_prefix;
wp_cache_clean_cache($file_prefix);
}
if (is_object($site_options) && version_compare($thesis_site->version, $site_options->version, '==')) {
update_option('thesis_options', $site_options);
#wp
wp_redirect(admin_url('admin.php?page=options-manager&imported=true&type=Site'));
#wp
} else {
wp_redirect(admin_url("admin.php?page=options-manager&type=Site&error=version&tried={$site_options->version}"));
}
//.........这里部分代码省略.........
示例10: pagelines_import_export
/**
*
* @TODO do
*
*/
function pagelines_import_export()
{
if (isset($_POST['form_submitted']) && $_POST['form_submitted'] == 'export_settings_form') {
$pagelines_settings = (array) get_option(PAGELINES_SETTINGS);
$pagelines_template_map = (array) get_option(PAGELINES_TEMPLATE_MAP);
$pagelines_templates = (array) get_option(PAGELINES_TEMPLATES);
$pagelines_special = (array) get_option(PAGELINES_SPECIAL);
$options['pagelines_templates'] = $pagelines_templates;
$options['pagelines_template_map'] = $pagelines_template_map;
$options['pagelines_settings'] = $pagelines_settings;
$options['pagelines_special'] = $pagelines_special;
if (isset($options) && is_array($options)) {
header('Cache-Control: public, must-revalidate');
header('Pragma: hack');
header('Content-Type: text/plain');
header('Content-Disposition: attachment; filename="' . PL_THEMENAME . '-Settings-' . date('Ymd') . '.dat"');
echo json_encode($options);
exit;
}
}
if (isset($_POST['form_submitted']) && $_POST['form_submitted'] == 'import_settings_form') {
if (strpos($_FILES['file']['name'], 'Settings') === false && strpos($_FILES['file']['name'], 'settings') === false) {
wp_redirect(admin_url(PL_IMPORT_EXPORT_URL . '&pageaction=import&error=wrongfile'));
} elseif ($_FILES['file']['error'] > 0) {
$error_type = $_FILES['file']['error'];
wp_redirect(admin_url(PL_IMPORT_EXPORT_URL . '&pageaction=import&error=file&' . $error_type));
} else {
$raw_options = pl_file_get_contents($_FILES['file']['tmp_name']);
$all_options = json_decode(json_encode(json_decode($raw_options)), true);
if (!isset($_POST['pagelines_layout']) && is_array($all_options) && isset($all_options['pagelines_settings']) && is_array($all_options['pagelines_settings'])) {
unset($all_options['pagelines_settings']['layout']);
}
if (isset($_POST['pagelines_settings']) && is_array($all_options) && isset($all_options['pagelines_settings']) && is_array($all_options['pagelines_settings'])) {
update_option(PAGELINES_SETTINGS, array_merge(get_option(PAGELINES_SETTINGS), $all_options['pagelines_settings']));
$done = 1;
}
if (isset($_POST['pagelines_special']) && is_array($all_options) && isset($all_options['pagelines_special']) && is_array($all_options['pagelines_special'])) {
$special = (array) get_option(PAGELINES_SPECIAL);
update_option(PAGELINES_SPECIAL, array_merge($special, $all_options['pagelines_special']));
$done = 1;
}
if (isset($_POST['pagelines_templates']) && is_array($all_options) && isset($all_options['pagelines_template_map']) && is_array($all_options['pagelines_template_map'])) {
$template_map = (array) get_option(PAGELINES_TEMPLATE_MAP);
$template_settings = (array) get_option(PAGELINES_TEMPLATES);
$template_settings_new = isset($all_options['pagelines_templates']) && is_array($all_options['pagelines_templates']) ? $all_options['pagelines_templates'] : array();
$template_map_new = isset($all_options['pagelines_template_map']) && is_array($all_options['pagelines_template_map']) ? $all_options['pagelines_template_map'] : array();
update_option(PAGELINES_TEMPLATE_MAP, array_merge($template_map, $template_map_new));
update_option(PAGELINES_TEMPLATES, array_merge($template_settings, $template_settings_new));
$done = 1;
}
if (function_exists('wp_cache_clean_cache')) {
global $file_prefix;
wp_cache_clean_cache($file_prefix);
}
if (isset($done)) {
wp_redirect(admin_url(PL_IMPORT_EXPORT_URL . '&pageaction=import&imported=true'));
} else {
wp_redirect(admin_url(PL_IMPORT_EXPORT_URL . '&pageaction=import&error=wrongfile'));
}
}
}
}
示例11: clear_cache_plugins
private function clear_cache_plugins()
{
/* Not implemented yet - still testing */
/***
* Automatically clears page caches after plugin install or upgrade
* Called from upgrade_check()
* Added 1.9.6.2
***/
global $wpss_cache_check, $wp_fastest_cache;
if (empty($wpss_cache_check)) {
$wpss_cache_check = rs_wpss_check_cache_status();
}
if ($wpss_cache_check['cache_check_status'] === 'ACTIVE') {
if (rs_wpss_is_plugin_active('w3-total-cache/w3-total-cache.php') && function_exists('w3tc_pgcache_flush')) {
/* W3 Total Cache */
w3tc_pgcache_flush();
}
if (rs_wpss_is_plugin_active('wp-super-cache/wp-cache.php') && function_exists('wp_cache_clean_cache')) {
/* WP Super Cache */
global $file_prefix;
wp_cache_clean_cache($file_prefix);
}
if (rs_wpss_is_plugin_active('wp-fastest-cache/wpFastestCache.php') && !empty($wp_fastest_cache) && method_exists('WpFastestCache', 'deleteCache')) {
/* WP Fastest Cache */
$wp_fastest_cache->deleteCache();
}
if (class_exists('WPE_API', FALSE) && class_exists('WpeCommon')) {
/* WP Engine Hosting */
if (method_exists('WpeCommon', 'purge_memcached')) {
WpeCommon::purge_memcached();
}
if (method_exists('WpeCommon', 'clear_maxcdn_cache')) {
WpeCommon::clear_maxcdn_cache();
}
if (method_exists('WpeCommon', 'purge_varnish_cache')) {
WpeCommon::purge_varnish_cache();
}
}
}
}
示例12: clear_cache
/**
* Clear cache from:
* - W3TC,
* - WordPress Total Cache
* - WPEngine
* - Varnish
*/
public function clear_cache()
{
// if W3 Total Cache is being used, clear the cache
if (function_exists('w3tc_pgcache_flush')) {
w3tc_pgcache_flush();
} else {
if (function_exists('wp_cache_clean_cache')) {
global $file_prefix;
wp_cache_clean_cache($file_prefix);
} else {
if (class_exists('WpeCommon')) {
WpeCommon::purge_memcached();
WpeCommon::clear_maxcdn_cache();
WpeCommon::purge_varnish_cache();
}
}
}
// Clear Varnish caches
if (Avada()->settings->get('dynamic_css_compiler') && Avada()->settings->get('cache_server_ip')) {
$this->clear_varnish_cache(self::file('url'));
}
}
示例13: pagelines_import_export
function pagelines_import_export()
{
if (isset($_GET['download']) && $_GET['download'] == 'settings') {
header("Cache-Control: public, must-revalidate");
header("Pragma: hack");
header("Content-Type: text/plain");
header('Content-Disposition: attachment; filename="PageLines-' . THEMENAME . '-Settings-' . date("Ymd") . '.dat"');
$pagelines_settings = get_option(PAGELINES_SETTINGS);
$pagelines_template = get_option('pagelines_template_map');
echo serialize(array('pagelines_settings' => $pagelines_settings, 'pagelines_template' => $pagelines_template));
exit;
}
if (isset($_POST['settings_upload']) && $_POST['settings_upload'] == 'settings') {
if (strpos($_FILES['file']['name'], 'Settings') === false) {
wp_redirect(admin_url('admin.php?page=pagelines&pageaction=import&error=wrongfile'));
} elseif ($_FILES['file']['error'] > 0) {
wp_redirect(admin_url('admin.php?page=pagelines&pageaction=import&error=file'));
} else {
$raw_options = file_get_contents($_FILES['file']['tmp_name']);
$all_options = unserialize($raw_options);
if (isset($all_options['pagelines_settings']) && isset($all_options['pagelines_template'])) {
$pagelines_settings = $all_options['pagelines_settings'];
$pagelines_template = $all_options['pagelines_template'];
if (is_array($pagelines_settings)) {
update_option(PAGELINES_SETTINGS, $pagelines_settings);
}
if (is_array($pagelines_template)) {
update_option('pagelines_template_map', $pagelines_template);
}
}
if (function_exists('wp_cache_clean_cache')) {
global $file_prefix;
wp_cache_clean_cache($file_prefix);
}
pagelines_build_dynamic_css();
wp_redirect(admin_url('admin.php?page=pagelines&pageaction=import&imported=true'));
}
}
}
示例14: wp_cache_files
function wp_cache_files()
{
global $cache_path, $file_prefix, $cache_max_time, $valid_nonce;
if ('/' != substr($cache_path, -1)) {
$cache_path .= '/';
}
if ($valid_nonce) {
if (isset($_REQUEST['wp_delete_cache'])) {
wp_cache_clean_cache($file_prefix);
}
if (isset($_REQUEST['wp_delete_cache_file'])) {
wp_cache_clean_cache($_REQUEST['wp_delete_cache_file']);
}
if (isset($_REQUEST['wp_delete_expired'])) {
wp_cache_clean_expired($file_prefix);
}
}
if (isset($_REQUEST['wp_list_cache'])) {
$list_files = true;
$list_mess = "Update list";
} else {
$list_mess = "List files";
}
echo '<a name="list"></a><fieldset class="options"><legend>Cache contents</legend>';
echo '<form name="wp_cache_content_list" action="' . $_SERVER["REQUEST_URI"] . '#list" method="post">';
echo '<input type="hidden" name="wp_list_cache" />';
echo '<div class="submit"><input type="submit" value="' . $list_mess . '" /></div>';
echo "</form>\n";
$count = 0;
$expired = 0;
$now = time();
if ($handle = opendir($cache_path)) {
if ($list_files) {
echo "<table cellspacing=\"0\" cellpadding=\"5\">";
}
while (false !== ($file = readdir($handle))) {
if (preg_match("/^{$file_prefix}.*\\.meta/", $file)) {
$this_expired = false;
$content_file = preg_replace("/meta\$/", "html", $file);
$mtime = filemtime($cache_path . $file);
if (!($fsize = @filesize($cache_path . $content_file))) {
continue;
}
// .meta does not exists
$fsize = intval($fsize / 1024);
$age = $now - $mtime;
if ($age > $cache_max_time) {
$expired++;
$this_expired = true;
}
$count++;
if ($list_files) {
$meta = new CacheMeta();
$meta = unserialize(file_get_contents($cache_path . $file));
echo $flip ? '<tr style="background: #EAEAEA;">' : '<tr>';
$flip = !$flip;
echo '<td><a href="http://' . $meta->uri . '" target="_blank" >';
echo $meta->uri . "</a></td>";
if ($this_expired) {
echo "<td><span style='color:red'>{$age} secs</span></td>";
} else {
echo "<td>{$age} secs</td>";
}
echo "<td>{$fsize} KB</td>";
echo '<td><form name="wp_delete_cache_file" action="' . $_SERVER["REQUEST_URI"] . '#list" method="post">';
echo '<input type="hidden" name="wp_list_cache" />';
echo '<input type="hidden" name="wp_delete_cache_file" value="' . preg_replace("/^(.*)\\.meta\$/", "\$1", $file) . '" />';
echo '<div class="submit"><input id="deletepost" type="submit" value="Remove" /></div>';
wp_nonce_field('wp-cache');
echo "</form></td></tr>\n";
}
}
}
closedir($handle);
if ($list_files) {
echo "</table>";
}
}
echo "<P><b>{$count} cached pages</b></p>";
echo "<P><b>{$expired} expired pages</b></p>";
echo '<form name="wp_cache_content_expired" action="' . $_SERVER["REQUEST_URI"] . '#list" method="post">';
echo '<input type="hidden" name="wp_delete_expired" />';
echo '<input type="hidden" name="wp_list_cache" />';
echo '<div class="submit"><input type="submit" value="Delete expired" /></div>';
wp_nonce_field('wp-cache');
echo "</form>\n";
echo '<form name="wp_cache_content_delete" action="' . $_SERVER["REQUEST_URI"] . '#list" method="post">';
echo '<input type="hidden" name="wp_delete_cache" />';
echo '<div class="submit"><input id="deletepost" type="submit" value="Delete cache" /></div>';
wp_nonce_field('wp-cache');
echo "</form>\n";
echo '</fieldset>';
}
示例15: foreach
foreach ($items as $widget) {
$w = explode('X|X', $widget);
$options[$col][$i]['id'] = $w[0];
$options[$col][$i]['number'] = $w[1];
$options[$col][$i]['id_base'] = $w[2];
$i++;
}
}
}
$theOptions[$canvas_id]['widgets'] = $options;
update_option('eletro_widgets', $theOptions);
break;
case 'apply':
$canvas_id = $_POST['canvas_id'];
$adminOptions = get_option('eletro_widgets');
$publicOptions = get_option('eletro_widgets_public');
$publicOptions[$canvas_id] = $adminOptions[$canvas_id];
update_option('eletro_widgets_public', $publicOptions);
// if using wp-super-cache, clean the cache
if (function_exists('wp_cache_clean_cache')) {
wp_cache_clean_cache('wp-cache');
}
break;
case 'restore':
$canvas_id = $_POST['canvas_id'];
$adminOptions = get_option('eletro_widgets');
$publicOptions = get_option('eletro_widgets_public');
$adminOptions[$canvas_id] = $publicOptions[$canvas_id];
update_option('eletro_widgets', $adminOptions);
break;
}