本文整理汇总了PHP中wp_unschedule_event函数的典型用法代码示例。如果您正苦于以下问题:PHP wp_unschedule_event函数的具体用法?PHP wp_unschedule_event怎么用?PHP wp_unschedule_event使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了wp_unschedule_event函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: unschedule
/**
* Unschedule possibly previously scheduled task(s)
*
* @access public
* @param string $hook
* @param int $subscription_id
* @param int $timestamp
* @return void
*/
public static function unschedule($hook, $subscription_id = null, $timestamp = null)
{
// Specific single event?
if ($timestamp) {
// Match arguments?
if ($subscription_id) {
wp_unschedule_event($timestamp, $hook, array((int)$subscription_id));
}
else {
wp_unschedule_event($timestamp, $hook);
}
}
// All matching events?
else {
// Match arguments?
if ($subscription_id) {
wp_clear_scheduled_hook($hook, array((int)$subscription_id));
}
else {
wp_clear_scheduled_hook($hook);
}
}
}
示例2: unschedule_event
/**
* Unschedule the event
*
* @since 1.0
*/
public function unschedule_event()
{
$timestamp = $this->get_next_scheduled();
if ($timestamp !== false) {
wp_unschedule_event($timestamp, self::$event_name);
}
}
示例3: cart_product_deactivate_plugin
function cart_product_deactivate_plugin()
{
$next_refresh = wp_next_scheduled('update_cartfeeds_hook');
if ($next_refresh) {
wp_unschedule_event($next_refresh, 'update_cartfeeds_hook');
}
}
开发者ID:adnanoner,项目名称:purple-xmls-google-product-feed-for-woocommerce,代码行数:7,代码来源:cart-product-setup.php
示例4: plugin_deactivate
/**
* Perform one-time operations on plugin deactivation.
*
* @since 1.0.0
*/
public function plugin_deactivate()
{
// Remove version check.
wp_unschedule_event(wp_next_scheduled('slack_notif_check_versions'), 'slack_notif_check_versions');
// Remove settings from database.
delete_option('slack_webhook_endpoint');
delete_option('slack_channel_name');
delete_option('slack_bot_username');
delete_option('slack_bot_image');
delete_option('slack_notif_core_update');
delete_option('slack_notif_theme_update');
delete_option('slack_notif_plugin_update');
delete_option('slack_notif_new_post');
delete_option('slack_notif_new_page');
delete_option('slack_notif_new_comment');
delete_option('slack_notif_new_user');
delete_option('slack_notif_admin_logged');
delete_option('slack_notif_core_version');
delete_option('slack_notif_theme_version');
delete_option('slack_notif_plugins_version');
// Delte custom post types settings.
foreach ($this->postTypes as $postType) {
delete_option('slack_notif_new_' . $postType->name);
}
}
示例5: do_cron
function do_cron()
{
# Lifted from wp-cron.php because it can't handle multiple blogs
if (false === ($crons = _get_cron_array())) {
print "no crons.\n";
return;
}
$keys = array_keys($crons);
$local_time = time();
if (isset($keys[0]) && $keys[0] > $local_time) {
print "not yet time.\n";
return;
}
foreach ($crons as $timestamp => $cronhooks) {
if ($timestamp > $local_time) {
break;
}
foreach ($cronhooks as $hook => $keys) {
foreach ($keys as $k => $v) {
$schedule = $v['schedule'];
if ($schedule != false) {
$new_args = array($timestamp, $schedule, $hook, $v['args']);
call_user_func_array('wp_reschedule_event', $new_args);
}
wp_unschedule_event($timestamp, $hook, $v['args']);
print $hook . "... ";
do_action_ref_array($hook, $v['args']);
}
}
}
# /end lifted from wp-cron.php
}
示例6: __construct
/**
* Sets up gateaway and adds relevant actions/filters
*/
function __construct()
{
//Booking Interception
if ($this->is_active() && absint(get_option('em_' . $this->gateway . '_booking_timeout')) > 0) {
$this->count_pending_spaces = true;
}
parent::__construct();
$this->status_txt = __('Awaiting PayPal Payment', 'em-pro');
add_action('admin_enqueue_scripts', array(&$this, 'gateway_admin_js'));
if ($this->is_active()) {
add_action('em_gateway_js', array(&$this, 'em_gateway_js'));
//Gateway-Specific
add_action('em_template_my_bookings_header', array(&$this, 'say_thanks'));
//say thanks on my_bookings page
add_filter('em_bookings_table_booking_actions_4', array(&$this, 'bookings_table_actions'), 1, 2);
//add_filter('em_my_bookings_booking_actions', array(&$this,'em_my_bookings_booking_actions'),1,2);
//set up cron
$timestamp = wp_next_scheduled('emp_paypal_cron');
if (absint(get_option('em_paypal_booking_timeout')) > 0 && !$timestamp) {
$result = wp_schedule_event(time(), 'em_minute', 'emp_paypal_cron');
} elseif (!$timestamp) {
wp_unschedule_event($timestamp, 'emp_paypal_cron');
}
} else {
//unschedule the cron
wp_clear_scheduled_hook('emp_paypal_cron');
}
}
示例7: deactivate
/**
* Short Description. (use period)
*
* Long Description.
*
* @since 0.0.1
*/
public static function deactivate()
{
// find out when the last event was scheduled
$timestamp = wp_next_scheduled('market_exporter_daily');
// unschedule previous event if any
wp_unschedule_event($timestamp, 'market_exporter_daily');
}
示例8: wp_clear_scheduled_hook
function wp_clear_scheduled_hook($hook)
{
$args = array_slice(func_get_args(), 1);
while ($timestamp = wp_next_scheduled($hook, $args)) {
wp_unschedule_event($timestamp, $hook, $args);
}
}
示例9: wpga_uninstallPlugin
/**
* Remove plugin data from database
*/
function wpga_uninstallPlugin()
{
/* Plugin main options */
delete_option(WPGA_PREFIX . '_options');
delete_option(WPGA_PREFIX . '_used_totp');
$args = array('meta_query' => array('relation' => 'OR', array('key' => 'wpga_attempts', 'value' => '', 'compare' => '!='), array('key' => 'wpga_secret', 'value' => '', 'compare' => '!=')));
$users = new WP_User_Query($args);
/* Delete all user metas */
if (!empty($users->results)) {
foreach ($users->results as $key => $user) {
delete_user_meta($user->ID, 'wpga_active');
delete_user_meta($user->ID, 'wpga_attempts');
delete_user_meta($user->ID, 'wpga_secret');
delete_user_meta($user->ID, 'wpga_backup_key');
delete_user_meta($user->ID, 'wpga_backup_key_time');
delete_user_meta($user->ID, 'wpga_apps_passwords');
delete_user_meta($user->ID, 'wpga_apps_passwords_log');
}
}
/**
* Remove cron task
*/
$timestamp = wp_next_scheduled('wpas_clean_totps');
wp_unschedule_event($timestamp, 'wpas_clean_totps');
}
示例10: rm_stop_cron
function rm_stop_cron()
{
if (wp_next_scheduled('rm_job_hook')) {
wp_unschedule_event(wp_next_scheduled('rm_job_hook'), 'rm_job_hook');
//error_log("stopped batch!");
}
}
示例11: schedule_the_events
/**
* On an early action hook, check if the hook is scheduled - if not, schedule it.
*
* @version 2.5.7
* @since 2.5.7
*/
function schedule_the_events()
{
$update_intervals = array('minutely', 'hourly', 'twicedaily', 'daily', 'weekly');
$total_number = apply_filters('booster_get_option', 1, get_option('wcj_products_xml_total_files', 1));
for ($i = 1; $i <= $total_number; $i++) {
$event_hook = 'wcj_create_products_xml_hook_' . $i;
if ('yes' === get_option('wcj_products_xml_enabled_' . $i, 'yes')) {
$selected_interval = apply_filters('booster_get_option', 'weekly', get_option('wcj_create_products_xml_period_' . $i, 'weekly'));
foreach ($update_intervals as $interval) {
$event_timestamp = wp_next_scheduled($event_hook, array($interval, $i));
if ($selected_interval === $interval) {
update_option('wcj_create_products_xml_cron_time_' . $i, $event_timestamp);
}
if (!$event_timestamp && $selected_interval === $interval) {
wp_schedule_event(time(), $selected_interval, $event_hook, array($selected_interval, $i));
} elseif ($event_timestamp && $selected_interval !== $interval) {
wp_unschedule_event($event_timestamp, $event_hook, array($interval, $i));
}
}
} else {
// unschedule all events
update_option('wcj_create_products_xml_cron_time_' . $i, '');
foreach ($update_intervals as $interval) {
$event_timestamp = wp_next_scheduled($event_hook, array($interval, $i));
if ($event_timestamp) {
wp_unschedule_event($event_timestamp, $event_hook, array($interval, $i));
}
}
}
}
}
示例12: unschedule
/**
* Unschedule License cron
*/
public function unschedule()
{
$timestamp = wp_next_scheduled('license_wp_license_expiring_email');
// unschedule
if (false !== $timestamp) {
wp_unschedule_event($timestamp, 'license_wp_license_expiring_email');
}
}
示例13: clear_schedule
/**
* Clear a schedule for an account
*
* @param $account_id
* @param $frequency
*/
public function clear_schedule($account_id, $frequency)
{
$args = array('account_id' => $account_id, 'frequency' => 'schedule', 'schedule' => $frequency);
$timestamp = wp_next_scheduled('igp_scheduled_post_account', $args);
if ($timestamp) {
wp_unschedule_event($timestamp, 'igp_scheduled_post_account', $args);
}
}
示例14: amen_unschedule_crons
function amen_unschedule_crons()
{
$crons = _get_cron_array();
foreach ($crons as $time => $cron_data) {
foreach ($cron_data as $cron_event => $data) {
'amenemailprayers' == $cron_event ? wp_unschedule_event($time, $cron_event) : FALSE;
}
}
}
示例15: vidtrial_update_cron
function vidtrial_update_cron()
{
$frequency = get_option('vidtrial_schedule_freq');
if (!$frequency) {
$frequency = "daily";
}
$timestamp = wp_next_scheduled("vidtrial_cron_schedule_hook");
if ($timestamp !== false) {
wp_unschedule_event($timestamp, "vidtrial_cron_schedule_hook");
}
wp_schedule_event(time(), $frequency, "vidtrial_cron_schedule_hook");
}