本文整理汇总了PHP中MS_Factory::get_option方法的典型用法代码示例。如果您正苦于以下问题:PHP MS_Factory::get_option方法的具体用法?PHP MS_Factory::get_option怎么用?PHP MS_Factory::get_option使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MS_Factory
的用法示例。
在下文中一共展示了MS_Factory::get_option方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: refresh
/**
* Reads the options from options table
*
* @since 1.0.0
*/
public function refresh()
{
$option_key = $this->option_key();
$settings = MS_Factory::get_option($option_key);
MS_Factory::populate_model($this, $settings);
wp_cache_set($option_key, $this, 'MS_Model_Option');
}
示例2: collission_check
/**
* Checks, if some BuddyPress pages overlap with M2 membership pages.
*
* In some cases people used the same page-ID for both BuddyPress
* registration and M2 registration. This will cause problems and must be
* resolved to have M2 and BuddyPress work symbiotically.
*
* @since 1.0.1.1
*/
protected function collission_check()
{
$buddy_pages = MS_Factory::get_option('bp-pages');
if (!is_array($buddy_pages)) {
// Okay, no BuddyPress pages set up yet.
return;
}
$duplicates = array();
foreach ($buddy_pages as $type => $page_id) {
$collission = MS_Model_Pages::get_page_by('id', $page_id);
if ($collission) {
$title = $collission->post_title;
if (!$title) {
$title = $collission->post_name;
}
$duplicates[] = sprintf('%s - %s', $page_id, $title);
}
}
if (count($duplicates)) {
$msg = sprintf('%s<br><br>%s', sprintf(__('BuddyPress uses a page that is also used as a Membership page by Membership 2.<br>Please assign a different page for either %sMembership 2%s or %sBuddyPress%s to avoid conflicts.', 'membership2'), '<a href="' . MS_Controller_Plugin::get_admin_url('settings') . '">', '</a>', '<a href="' . admin_url('admin.php?page=bp-page-settings') . '">', '</a>'), implode('<br>', $duplicates));
lib3()->ui->admin_message($msg, 'error');
}
}
示例3: 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);
}