本文整理汇总了PHP中MS_Factory::delete_option方法的典型用法代码示例。如果您正苦于以下问题:PHP MS_Factory::delete_option方法的具体用法?PHP MS_Factory::delete_option怎么用?PHP MS_Factory::delete_option使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MS_Factory
的用法示例。
在下文中一共展示了MS_Factory::delete_option方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: delete
/**
* Delete from wp option table
*
* @since 1.0.0
*/
public function delete()
{
do_action('ms_model_option_delete_before', $this);
$option_key = $this->option_key();
MS_Factory::delete_option($option_key);
wp_cache_delete($option_key, 'MS_Model_Option');
do_action('ms_model_option_delete_after', $this);
}
示例2: check_membership_status
/**
* Check membership status.
*
* Execute actions when time/period condition are met.
* E.g. change membership status, add communication to queue, create invoices.
*
* @since 1.0.0
*/
public function check_membership_status()
{
do_action('ms_model_plugin_check_membership_status_before', $this);
if ($this->member->is_simulated_user()) {
return;
}
/*
* For performance reasons we only process a small batch at once.
* Here we find out, which subscriptions should be processed during
* the current request.
*/
$offset = (int) MS_Factory::get_option('ms_batch_check_offset_flag');
// Find the next X subscriptions from DB.
$args = apply_filters('ms_model_plugin_check_membership_status_get_subscription_args', array('status' => 'valid', 'orderby' => 'ID', 'posts_per_page' => $this->_process_per_batch, 'offset' => $offset, 'nopaging' => false));
$subscriptions = MS_Model_Relationship::get_subscriptions($args);
if (count($subscriptions) < $this->_process_per_batch) {
// We processed all subscriptions. Clean up.
MS_Factory::delete_option('ms_batch_check_offset_flag');
} else {
// We did not process all subscriptions. Remember where to continue.
MS_Factory::update_option('ms_batch_check_offset_flag', $offset + $this->_process_per_batch);
// Re-scheduling the cron job will run it again on next page load.
$hook = 'ms_cron_check_membership_status';
wp_clear_scheduled_hook($hook);
$this->setup_cron_services($hook);
}
// Perform the actual status checks!
foreach ($subscriptions as $subscription) {
error_log('This is ' . $subscription->id);
$subscription->check_membership_status();
}
do_action('ms_model_plugin_check_membership_status_after', $this);
}