当前位置: 首页>>代码示例>>PHP>>正文


PHP MS_Factory::update_option方法代码示例

本文整理汇总了PHP中MS_Factory::update_option方法的典型用法代码示例。如果您正苦于以下问题:PHP MS_Factory::update_option方法的具体用法?PHP MS_Factory::update_option怎么用?PHP MS_Factory::update_option使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在MS_Factory的用法示例。


在下文中一共展示了MS_Factory::update_option方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: save

 /**
  * Save content in wp_option table.
  *
  * Update WP cache and instance singleton.
  *
  * @since  1.0.0
  */
 public function save()
 {
     $this->before_save();
     $option_key = $this->option_key();
     $settings = MS_Factory::serialize_model($this);
     MS_Factory::update_option($option_key, $settings);
     $this->instance = $this;
     $this->after_save();
     wp_cache_set($option_key, $this, 'MS_Model_Option');
 }
开发者ID:EdoMagen,项目名称:project-s-v2,代码行数:17,代码来源:class-ms-model-option.php

示例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);
 }
开发者ID:nayabbukhari,项目名称:circulocristiano,代码行数:41,代码来源:class-ms-model-plugin.php


注:本文中的MS_Factory::update_option方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。