本文整理汇总了PHP中delete_transient函数的典型用法代码示例。如果您正苦于以下问题:PHP delete_transient函数的具体用法?PHP delete_transient怎么用?PHP delete_transient使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了delete_transient函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
protected function __construct()
{
if (false !== get_transient('_my-wp-backup-activated')) {
delete_transient('_my-wp-backup-activated');
wp_redirect(Admin::get_page_url(''));
}
self::$info = get_file_data(__FILE__, array('name' => 'Plugin Name', 'pluginUri' => 'Plugin URI', 'supportUri' => 'Support URI', 'version' => 'Version', 'description' => 'Description', 'author' => 'Author', 'authorUri' => 'Author URI', 'textDomain' => 'Text Domain', 'domainPath' => 'Domain Path', 'slug' => 'Slug', 'license' => 'License', 'licenseUri' => 'License URI'));
Admin::get_instance();
$options = get_site_option('my-wp-backup-options', Admin::$options);
self::$info['baseDir'] = plugin_dir_path(__FILE__);
self::$info['baseDirUrl'] = plugin_dir_url(__FILE__);
self::$info['backup_dir'] = trailingslashit(ABSPATH) . trailingslashit(ltrim($options['backup_dir'], '/'));
self::$info['root_dir'] = trailingslashit(ABSPATH);
if (defined('WP_CLI') && WP_CLI) {
\WP_CLI::add_command('job', new Cli\Job());
\WP_CLI::add_command('backup', new Cli\Backup());
}
add_action('wp_backup_run_job', array(Job::get_instance(), 'cron_run'));
add_action('wp_backup_restore_backup', array(Backup::get_instance(), 'cron_run'));
$version = get_site_option(self::KEY_VERSION);
if (!$version || self::$info['version'] !== $version) {
if ($this->update_options()) {
update_site_option(self::KEY_VERSION, self::$info['version']);
}
}
}
示例2: __construct
function __construct()
{
$this->username = $this->get_license() ? base64_decode(file_get_contents($this->get_license())) : NULL;
if (isset($_GET['updated']) && $_GET['updated'] === 'retry_auth') {
delete_transient('security_api_result');
}
}
示例3: wc_crm_delete_group_transient
function wc_crm_delete_group_transient()
{
$transient = array('wc_crm_static_group_taxonomies', 'wc_crm_group_taxonomies', 'wc_crm_dynamic_group_taxonomies');
foreach ($transient as $name) {
delete_transient($name);
}
}
示例4: w3tc_ajax_extension_cloudflare_zones_done
public function w3tc_ajax_extension_cloudflare_zones_done()
{
$email = $_REQUEST['email'];
$key = $_REQUEST['key'];
$zone_id = Util_Request::get('zone_id');
if (empty($zone_id)) {
return $this->_render_extension_cloudflare_zones(array('email' => $email, 'key' => $key, 'error_message' => 'Please select zone'));
}
$zone_name = '';
// get zone name
try {
$api = new Extension_CloudFlare_Api(array('email' => $email, 'key' => $key));
$zone = $api->zone($zone_id);
$zone_name = $zone['name'];
} catch (\Exception $ex) {
$details['error_message'] = 'Can\'t authenticate: ' . $ex->getMessage();
include W3TC_DIR . '/Extension_CloudFlare_Popup_View_Intro.php';
exit;
}
$c = Dispatcher::config();
$c->set(array('cloudflare', 'email'), $email);
$c->set(array('cloudflare', 'key'), $key);
$c->set(array('cloudflare', 'zone_id'), $zone_id);
$c->set(array('cloudflare', 'zone_name'), $zone_name);
$c->save();
delete_transient('w3tc_cloudflare_stats');
$postfix = Util_Admin::custom_message_id(array(), array('extension_cloudflare_configuration_saved' => 'CloudFlare credentials are saved successfully'));
echo 'Location admin.php?page=w3tc_extensions&extension=cloudflare&' . 'action=view&' . $postfix;
exit;
}
示例5: possible_state_change
/**
* @param W3_Config $config
* @param W3_Config $old_config
*/
function possible_state_change($config, $old_config)
{
if ($old_config->get_string('plugin.license_key') != '' && $config->get_string('plugin.license_key') == '') {
$result = edd_w3edge_w3tc_deactivate_license($old_config->get_string('plugin.license_key'));
if ($result) {
$this->site_inactivated = true;
}
delete_transient('w3tc_license_status');
} else {
if ($old_config->get_string('plugin.license_key') == '' && $config->get_string('plugin.license_key') != '') {
$result = edd_w3edge_w3tc_activate_license($config->get_string('plugin.license_key'));
if ($result) {
$this->site_activated = true;
}
delete_transient('w3tc_license_status');
} else {
if ($old_config->get_string('plugin.license_key') != $config->get_string('plugin.license_key')) {
$result = edd_w3edge_w3tc_activate_license($config->get_string('plugin.license_key'));
if ($result) {
$this->site_activated = true;
}
delete_transient('w3tc_license_status');
}
}
}
}
示例6: apiRequest
private static function apiRequest($act, $post_data = null, $use_ssl = true)
{
global $wp_version;
$site = rawurlencode(base64_encode(get_option('siteurl')));
$url = "http" . ($use_ssl ? "s://ssl-account.com" : ":/") . "/interface.fabi.me/wpfilebase-pro/{$act}.php";
$get_args = array('version' => WPFB_VERSION, 'pl_slug' => 'wp-filebase', 'pl_ver' => WPFB_VERSION, 'wp_ver' => $wp_version, 'site' => $site);
// try to get from cache
$cache_key = 'wpfb_apireq_' . md5($act . '||' . serialize($get_args) . '||' . serialize($post_data) . '||' . __FILE__);
if (isset($_REQUEST['no_api_cache'])) {
delete_transient($cache_key);
}
$res = get_transient($cache_key);
if ($res !== false) {
return $res;
}
//trigger_error ( "WP-Filebase apiRequest (ssl=$use_ssl): $act ".json_encode($post_data), E_USER_NOTICE );
if (empty($post_data)) {
$res = wp_remote_get($url, $get_args);
} else {
$res = wp_remote_post(add_query_arg($get_args, $url), array('body' => $post_data));
}
if (is_wp_error($res)) {
if ($use_ssl) {
// retry without ssl
return self::apiRequest($act, $post_data, false);
}
echo "<b>WP-Filebase API request error:</b>";
print_r($res);
return false;
}
$res = empty($res['body']) ? false : json_decode($res['body']);
set_transient($cache_key, $res, 0 + 6 * HOUR_IN_SECONDS);
return $res;
}
示例7: empty_cache
/**
* Empty the Lists cache
*/
public function empty_cache()
{
delete_transient($this->transient_name);
delete_transient($this->transient_name . '_fallback');
delete_transient('mc4wp_list_counts');
delete_transient('mc4wp_list_counts_fallback');
}
示例8: disable_variation_prices_cache
/**
* Disables the product price cache. This function looks for the cache key
* that is about to be retrieved by WooCommerce, and deletes the cached data
* associated to it.
*
* IMPORTANT
* This function can have an impact on WooCommerce's performance, and it
* should not be used unless necessary.
*
* @param array cache_key_args The arguments that form the cache key.
* @param WC_Product product The product for which the key is being generated.
* @param bool display Indicates if the prices are being retrieved for display
* purposes.
* @return array
* @since WooCommerce 2.4
* @author Aelia <support@aelia.co>
* @link http://aelia.co/2015/08/11/wc-2-4-workaround-for-price-cache
*/
function disable_variation_prices_cache($cache_key_args, $product, $display)
{
// Delete the cached data, if it exists
$cache_key = 'wc_var_prices' . md5(json_encode($cache_key_args));
delete_transient($cache_key);
return $cache_key_args;
}
示例9: wps_requirements_check
function wps_requirements_check($force_check = false)
{
$check_okay = get_transient('wps_requirements_check');
if (empty($force_check) && false !== $check_okay) {
return $check_okay;
}
$deactivate_reason = false;
if (!function_exists('aihr_check_aihrus_framework')) {
$deactivate_reason = esc_html__('Missing Aihrus Framework');
add_action('admin_notices', 'wps_notice_aihrus');
} elseif (!aihr_check_aihrus_framework(WPS_BASE, WPS_NAME, WPS_AIHR_VERSION)) {
$deactivate_reason = esc_html__('Old Aihrus Framework version detected');
}
if (!aihr_check_php(WPS_BASE, WPS_NAME)) {
$deactivate_reason = esc_html__('Old PHP version detected');
}
if (!aihr_check_wp(WPS_BASE, WPS_NAME)) {
$deactivate_reason = esc_html__('Old WordPress version detected');
}
if (!empty($deactivate_reason)) {
aihr_deactivate_plugin(WPS_BASE, WPS_NAME, $deactivate_reason);
}
$check_okay = empty($deactivate_reason);
if ($check_okay) {
delete_transient('wps_requirements_check');
set_transient('wps_requirements_check', $check_okay, HOUR_IN_SECONDS);
}
return $check_okay;
}
示例10: erase_transient_data
public function erase_transient_data()
{
delete_transient(self::CATALOG_SITE_TYPES);
delete_transient(self::CATALOG_THEMES);
delete_transient(self::CATALOG_PLUGINS);
delete_transient(self::TRANSIENT_CHECK_FLAG);
}
示例11: delete_cache_transition
function delete_cache_transition($new_status, $old_status, $post)
{
global $wpdb;
$cache_duration = vibe_get_option('cache_duration');
if (!isset($cache_duration)) {
$cache_duration = 0;
}
if ($cache_duration) {
$key = 'kposts_' . $post->post_type;
$instructor_content_privacy = vibe_get_option('instructor_content_privacy');
if ($instructor_content_privacy) {
$user_id = get_current_user_id();
$key .= '_' . $user_id;
}
$linkage = vibe_get_option('linkage');
if (isset($linkage) && $linkage) {
$linkage_terms = get_the_terms($post_id, 'linkage');
if (isset($linkage_terms) && is_array($linkage_terms)) {
foreach ($linkage_terms as $term) {
$key .= '_' . $term->name;
}
}
}
delete_transient($key);
if ($post->post_type == 'course') {
global $wpdb;
$wpdb->query("DELETE FROM {$wpdb->options} WHERE option_name LIKE '%wplms_%_course%'");
}
}
}
示例12: admin_notices
/**
* Admin notices
*/
function admin_notices()
{
if ('removed_ht_kb_data' == get_transient('_removed_ht_kb_data')) {
delete_transient('_removed_ht_kb_data');
?>
<div class="updated">
<p><?php
_e('Knowldge Base Data Removed', 'ht-knowledge-base');
?>
</p>
</div>
<?php
}
if ('install_sample_ht_kb_data' == get_transient('_install_sample_ht_kb_data')) {
delete_transient('_install_sample_ht_kb_data');
?>
<div class="updated">
<p><?php
_e('Knowldge Base Sample Data Added', 'ht-knowledge-base');
?>
</p>
</div>
<?php
}
}
示例13: wp_dlm_clear_cached_stuff
function wp_dlm_clear_cached_stuff()
{
delete_transient('dlm_categories');
delete_transient('dlm_tags');
delete_transient('dlm_used_tags');
wp_cache_flush();
}
示例14: uninstall
static function uninstall()
{
global $wpdb;
if (is_multisite()) {
// Cleanup Network install
foreach (wp_get_sites(array('limit' => apply_filters('gadwp_sites_limit', 100))) as $blog) {
switch_to_blog($blog['blog_id']);
$sqlquery = $wpdb->query("DELETE FROM {$wpdb->options} WHERE option_name LIKE '_transient_gadash%%'");
$sqlquery = $wpdb->query("DELETE FROM {$wpdb->options} WHERE option_name LIKE '_transient_timeout_gadash%%'");
$sqlquery = $wpdb->query("DELETE FROM {$wpdb->options} WHERE option_name LIKE '_transient_ga_dash%%'");
$sqlquery = $wpdb->query("DELETE FROM {$wpdb->options} WHERE option_name LIKE '_transient_timeout_ga_dash%%'");
delete_option('gadash_options');
delete_transient('ga_dash_lasterror');
delete_transient('ga_dash_refresh_token');
delete_transient('ga_dash_gapi_errors');
restore_current_blog();
}
delete_site_option('gadash_network_options');
delete_site_transient('ga_dash_refresh_token');
} else {
// Cleanup Single install
$sqlquery = $wpdb->query("DELETE FROM {$wpdb->options} WHERE option_name LIKE '_transient_gadash%%'");
$sqlquery = $wpdb->query("DELETE FROM {$wpdb->options} WHERE option_name LIKE '_transient_timeout_gadash%%'");
$sqlquery = $wpdb->query("DELETE FROM {$wpdb->options} WHERE option_name LIKE '_transient_ga_dash%%'");
$sqlquery = $wpdb->query("DELETE FROM {$wpdb->options} WHERE option_name LIKE '_transient_timeout_ga_dash%%'");
delete_option('gadash_options');
delete_transient('ga_dash_lasterror');
delete_transient('ga_dash_refresh_token');
delete_transient('ga_dash_gapi_errors');
}
}
示例15: bqw_sliderpro_delete_all_data
function bqw_sliderpro_delete_all_data()
{
global $wpdb;
$prefix = $wpdb->prefix;
$sliders_table = $prefix . 'slider_pro_sliders';
$slides_table = $prefix . 'slider_pro_slides';
$layers_table = $prefix . 'slider_pro_layers';
$wpdb->query("DROP TABLE {$sliders_table}, {$slides_table}, {$layers_table}");
delete_option('sliderpro_custom_css');
delete_option('sliderpro_custom_js');
delete_option('sliderpro_is_custom_css');
delete_option('sliderpro_is_custom_js');
delete_option('sliderpro_load_stylesheets');
delete_option('sliderpro_load_custom_css_js');
delete_option('sliderpro_load_unminified_scripts');
delete_option('sliderpro_purchase_code');
delete_option('sliderpro_purchase_code_message');
delete_option('sliderpro_purchase_code_status');
delete_option('sliderpro_hide_inline_info');
delete_option('sliderpro_hide_getting_started_info');
delete_option('sliderpro_access');
delete_option('sliderpro_version');
delete_transient('sliderpro_post_names');
delete_transient('sliderpro_posts_data');
delete_transient('sliderpro_update_notification_message');
$wpdb->query("DELETE FROM " . $prefix . "options WHERE option_name LIKE '%sliderpro_cache%'");
}