本文整理汇总了PHP中MS_Factory类的典型用法代码示例。如果您正苦于以下问题:PHP MS_Factory类的具体用法?PHP MS_Factory怎么用?PHP MS_Factory使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了MS_Factory类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: save_user_create_event
/**
* Fires only at user creation from admin
* Create even to send notification email.
*
* @since 1.0.2.6
*
* @var int $user_id
*/
public function save_user_create_event($user_id)
{
if (is_admin()) {
$member = MS_Factory::load('MS_Model_Member', $user_id);
MS_Model_Event::save_event(MS_Model_Event::TYPE_MS_REGISTERED, $member);
}
}
示例2: to_html
/**
* Create view output.
*
* @since 1.0.0
* @return string
*/
public function to_html()
{
$list_table = MS_Factory::create('MS_Helper_ListTable_Event');
$list_table->prepare_items();
if (isset($_REQUEST['membership_id'])) {
$membership = MS_Factory::load('MS_Model_Membership', $_REQUEST['membership_id']);
$title = sprintf(__('%s News', 'membership2'), $membership->get_name_tag());
$url = esc_url_raw(add_query_arg(array('step' => MS_Controller_Membership::STEP_OVERVIEW), remove_query_arg(array('paged', 'order', 'post_mime_type', 'detached', 'orderby', 's'))));
$back_link = array('id' => 'back', 'type' => MS_Helper_Html::TYPE_HTML_LINK, 'value' => __('» Back to Overview', 'membership2'), 'url' => $url, 'class' => 'wpmui-field-button button');
} else {
$title = __('Membership News', 'membership2');
$back_link = '';
}
ob_start();
?>
<div class="wrap ms-wrap ms-membership-news">
<?php
MS_Helper_Html::settings_header(array('title' => $title));
MS_Helper_Html::html_element($back_link);
$list_table->search_box();
$list_table->views();
?>
<form action="" method="post">
<?php
$list_table->display();
?>
</form>
</div>
<?php
$html = ob_get_clean();
echo '' . $html;
}
示例3: to_html
public function to_html()
{
$this->check_simulation();
// Search for orphaned relationships and delete them.
MS_Model_Member::clean_db();
$listview = MS_Factory::create('MS_Helper_ListTable_Member');
$listview->prepare_items();
ob_start();
?>
<div class="wrap ms-wrap ms-member-list">
<?php
MS_Helper_Html::settings_header(array('title' => __('Members', MS_TEXT_DOMAIN), 'title_icon_class' => 'wpmui-fa wpmui-fa-users', 'desc' => __('Here you can manage the Memberships of existing Users.', MS_TEXT_DOMAIN)));
// Display a filter to switch between individual memberships.
$this->membership_filter();
$listview->views();
$listview->search_box();
?>
<form method="post">
<?php
$listview->display();
?>
</form>
</div>
<?php
$html = ob_get_clean();
return $html;
}
示例4: to_html
/**
* Create view output.
*
* @since 1.0.0
*
* @return string
*/
public function to_html()
{
$code_list = MS_Factory::create('MS_Addon_Invitation_Helper_Listtable');
$code_list->prepare_items();
$title = __('Invitations', 'membership2');
$add_new_button = array('id' => 'add_new', 'type' => MS_Helper_Html::TYPE_HTML_LINK, 'url' => MS_Controller_Plugin::get_admin_url(MS_Addon_Invitation::SLUG, array('action' => 'edit', 'invitation_id' => 0)), 'value' => __('Add New Code', 'membership2'), 'class' => 'button');
ob_start();
?>
<div class="wrap ms-wrap">
<?php
MS_Helper_Html::settings_header(array('title' => $title, 'title_icon_class' => 'wpmui-fa wpmui-fa-ticket'));
?>
<div>
<?php
MS_Helper_Html::html_element($add_new_button);
?>
</div>
<form action="" method="post">
<?php
$code_list->display();
?>
</form>
<p><em>
<?php
_e('By default all Memberships are protected and require an invitation code to register.<br>You can manually change this for individual memberships via a new setting in the "Payment Options" settings of each membership.', 'membership2');
?>
</em></p>
</div>
<?php
$html = ob_get_clean();
return apply_filters('ms_addon_invitation_view_list_to_html', $html, $this);
}
示例5: to_html
/**
* Create view output.
*
* @since 1.0.0
*
* @return string
*/
public function to_html()
{
$coupon_list = MS_Factory::create('MS_Addon_Coupon_Helper_Listtable');
$coupon_list->prepare_items();
$title = __('Coupons', MS_TEXT_DOMAIN);
$add_new_button = array('id' => 'add_new', 'type' => MS_Helper_Html::TYPE_HTML_LINK, 'url' => MS_Controller_Plugin::get_admin_url('coupons', array('action' => 'edit', 'coupon_id' => 0)), 'value' => __('Add New Coupon', MS_TEXT_DOMAIN), 'class' => 'button');
ob_start();
?>
<div class="wrap ms-wrap">
<?php
MS_Helper_Html::settings_header(array('title' => $title, 'title_icon_class' => 'wpmui-fa wpmui-fa-credit-card'));
?>
<div>
<?php
MS_Helper_Html::html_element($add_new_button);
?>
</div>
<form action="" method="post">
<?php
$coupon_list->display();
?>
</form>
</div>
<?php
$html = ob_get_clean();
return apply_filters('ms_addon_coupon_view_list_to_html', $html, $this);
}
示例6: handle_render_callback
/**
* Tells Membership2 Admin to display this form to manage this rule.
*
* @since 1.0.0
*
* @param array $callback (Invalid callback)
* @param array $data The data collection.
* @return array Correct callback.
*/
public function handle_render_callback($callback, $data)
{
$view = MS_Factory::load('MS_Addon_BuddyPress_Rule_View');
$view->data = $data;
$callback = array($view, 'to_html');
return $callback;
}
示例7: to_html
/**
* Returns the HTML code of the view.
*
* @since 1.0.0
* @api
*
* @return string
*/
public function to_html()
{
$model = MS_Factory::create('MS_Model_Import_Membership');
$model->prepare();
$view = MS_Factory::create('MS_View_Settings_Import');
$view->data = array('model' => $model, 'compact' => true);
$msg = __('Tip: You can also import your data later by visiting the Admin page <b>Membership2 > Settings > Import Tool</b>.', 'membership2');
ob_start();
// Render tabbed interface.
?>
<div class="ms-wrap wrap">
<h2>
<?php
_e('Import Your Membership Data To Membership2', 'membership2');
?>
</h2>
<?php
if (MS_Plugin::is_network_wide()) {
$msg .= '<br><br>' . __('You have enabled Network Wide Protection. We will import Membership data from your main blog.', 'membership2');
}
lib3()->ui->admin_message($msg, 'info');
?>
<div class="ms-settings-import">
<?php
echo $view->to_html();
?>
</div>
</div>
<?php
return ob_get_clean();
}
示例8: to_html
/**
* Create view output.
*
* @since 1.0.0
* @return string
*/
public function to_html()
{
$this->check_simulation();
$membership = $this->data['membership'];
$admin_message = MS_Helper_Membership::get_admin_message(array($membership->name), $membership);
$title = MS_Helper_Membership::get_admin_title();
$membership_list = MS_Factory::create('MS_Helper_ListTable_Membership');
$membership_list->prepare_items();
$create_new_button = array('id' => 'create_new_ms_button', 'type' => MS_Helper_Html::TYPE_HTML_LINK, 'url' => $this->data['create_new_url'], 'value' => __('Create New Membership', MS_TEXT_DOMAIN), 'class' => 'button');
ob_start();
?>
<div class="wrap ms-wrap">
<?php
MS_Helper_Html::settings_header(array('title' => $title, 'desc' => array(__('Here you can view and edit all the Memberships you have created.', MS_TEXT_DOMAIN), $admin_message)));
?>
<form action="" method="post">
<div class="ms-list-table-wrapper ms-membership-list">
<?php
MS_Helper_Html::html_element($create_new_button);
$membership_list->display();
MS_Helper_Html::html_element($create_new_button);
?>
</div>
</form>
</div>
<?php
$html = ob_get_clean();
echo $html;
}
示例9: to_html
public function to_html()
{
$settings = $this->data['settings'];
$fields = array('plugin_enabled' => array('id' => 'plugin_enabled', 'type' => MS_Helper_Html::INPUT_TYPE_RADIO_SLIDER, 'title' => __('Content Protection', 'membership2'), 'desc' => __('This setting toggles the content protection on this site.', 'membership2'), 'value' => MS_Plugin::is_enabled(), 'data_ms' => array('action' => MS_Controller_Settings::AJAX_ACTION_TOGGLE_SETTINGS, 'setting' => 'plugin_enabled')), 'hide_admin_bar' => array('id' => 'hide_admin_bar', 'type' => MS_Helper_Html::INPUT_TYPE_RADIO_SLIDER, 'title' => __('Hide admin toolbar', 'membership2'), 'desc' => __('Hide the admin toolbar for non administrator users.', 'membership2'), 'value' => $settings->hide_admin_bar, 'data_ms' => array('action' => MS_Controller_Settings::AJAX_ACTION_TOGGLE_SETTINGS, 'setting' => 'hide_admin_bar')));
$fields = apply_filters('ms_view_settings_prepare_general_fields', $fields);
$setup = MS_Factory::create('MS_View_Settings_Page_Setup');
$action_url = esc_url_raw(remove_query_arg(array('msg')));
ob_start();
MS_Helper_Html::settings_tab_header();
?>
<form action="<?php
echo esc_url($action_url);
?>
" method="post" class="cf">
<div class="cf">
<div class="ms-half">
<?php
MS_Helper_Html::html_element($fields['plugin_enabled']);
?>
</div>
<div class="ms-half">
<?php
MS_Helper_Html::html_element($fields['hide_admin_bar']);
?>
</div>
</div>
<?php
MS_Helper_Html::html_separator();
MS_Helper_Html::html_element($setup->html_full_form());
?>
</form>
<?php
return ob_get_clean();
}
示例10: 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);
}
示例11: is_active
/**
* Checks if the current Add-on is enabled
*
* @since 1.0.0
* @return bool
*/
public static function is_active()
{
if (!self::wp_recaptcha_active() && MS_Model_Addon::is_enabled(self::ID)) {
$model = MS_Factory::load('MS_Model_Addon');
$model->disable(self::ID);
}
return MS_Model_Addon::is_enabled(self::ID);
}
示例12: init
/**
* Initializes the Add-on. Always executed.
*
* @since 1.0.0
*/
public function init()
{
// Always remove bbpress from MS_Rule_CptGroup_Model.
$this->add_filter('ms_rule_cptgroup_model_get_excluded_content', 'exclude_bbpress_cpts');
if (self::is_active()) {
$this->add_filter('ms_controller_protection_tabs', 'rule_tabs');
MS_Factory::load('MS_Addon_Bbpress_Rule');
}
}
示例13: __construct
/**
* Initialize the Add-On.
*
* @since 1.0.0
*/
public function __construct()
{
parent::__construct();
self::$model = MS_Factory::load('MS_Model_Addon');
self::$settings = MS_Factory::load('MS_Model_Settings');
$this->add_filter('ms_model_addon_register', 'register');
$this->add_action('ms_model_addon_initialize', 'init_addon');
$this->add_ajax_action($this->ajax_action(), 'ajax_update_settings');
}
示例14: after_load
/**
* Initialize the object.
*
* @since 1.0.0
* @internal
*/
public function after_load()
{
parent::after_load();
$this->_api = MS_Factory::load('MS_Gateway_Stripe_Api');
$this->id = self::ID;
$this->name = __('Stripe Single Gateway', 'membership2');
$this->group = 'Stripe';
$this->manual_payment = true;
// Recurring billed/paid manually
$this->pro_rate = true;
}
示例15: after_load
/**
* Initialize the object.
*
* @since 1.0.0
* @internal
*/
public function after_load()
{
parent::after_load();
$this->_api = MS_Factory::load('MS_Gateway_Stripe_Api');
$this->id = self::ID;
$this->name = __('Stripe Single Gateway', 'membership2');
$this->group = 'Stripe';
$this->manual_payment = true;
// Recurring billed/paid manually
$this->pro_rate = true;
$this->add_filter('ms_model_pages_get_ms_page_url', 'ms_model_pages_get_ms_page_url_cb', 99, 4);
}