本文整理汇总了PHP中MS_Factory::create方法的典型用法代码示例。如果您正苦于以下问题:PHP MS_Factory::create方法的具体用法?PHP MS_Factory::create怎么用?PHP MS_Factory::create使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MS_Factory
的用法示例。
在下文中一共展示了MS_Factory::create方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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();
}
示例2: 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);
}
示例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()
{
$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;
}
示例5: 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;
}
示例6: 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();
}
示例7: 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);
}
示例8: ajax_submit
/**
* Ajax handler. Handles incoming form data that was submitted via ajax.
* Typically this form is displayed inside a popup.
*
* @since 1.0.0
* @access public
*/
public function ajax_submit()
{
$data = '';
if (isset($_REQUEST['dialog'])) {
$dialog = $_REQUEST['dialog'];
$dlg = MS_Factory::create('MS_' . $dialog);
$data = $dlg->submit();
}
$this->respond($data);
}
示例9: admin_page
/**
* Load and render the Documentation view.
*
* @since 1.0.0
*/
public function admin_page()
{
/**
* Create / Filter the view.
*
* @since 1.0.0
* @param object $this The MS_Controller_Help object.
*/
$view = MS_Factory::create('MS_View_Help');
$data = array();
$data['tabs'] = $this->get_tabs();
$view->data = apply_filters('ms_view_help_data', $data);
$view->render();
}
示例10: show_setup_note
/**
* Displays a PopUp to the user that shows a sumary of the setup wizard
* including possible next steps for configuration.
*
* @since 1.0.0
* @param MS_Model_Membership $membership The membership that was created.
*/
public static function show_setup_note($membership)
{
$popup = array();
$popup['title'] = sprintf('<i class="dashicons dashicons-yes"></i> %1$s<div class="subtitle">%2$s</div>', __('Congratulations!', 'membership2'), sprintf(__('You have successfully set up your <b>%1$s</b> Membership.', 'membership2'), $membership->name));
$setup = MS_Factory::create('MS_View_Settings_Page_Setup');
$popup['modal'] = true;
$popup['close'] = false;
$popup['sticky'] = false;
$popup['class'] = 'ms-setup-done';
$popup['body'] = $setup->to_html();
$popup['height'] = $setup->dialog_height();
$popup['body'] .= sprintf('<div class="buttons">' . '<a href="%s" class="button">%s</a> ' . '<button type="button" class="button-primary close">%s</button>' . '</div>', MS_Controller_Plugin::get_admin_url('protection'), __('Set-up Access Levels', 'membership2'), __('Finish', 'membership2'));
lib3()->html->popup($popup);
$settings = MS_Plugin::instance()->settings;
$settings->is_first_membership = false;
if (!$membership->is_free) {
$settings->is_first_paid_membership = false;
}
$settings->save();
}
示例11: page_welcome
/**
* Display a welcome screen.
*
* @since 1.0.0
*/
public function page_welcome()
{
$data = array();
$data['step'] = $this->get_step();
$data['action'] = 'start';
$view = MS_Factory::create('MS_View_Welcome');
$view->data = apply_filters('ms_view_welcome_data', $data, $this);
$view->render();
}
示例12: admin_page
/**
* Callback function from 'Membership' navigation.
*
* Menu Item: Membership > Settings
*
* @since 1.0.0
*/
public function admin_page()
{
$hook = 'ms_controller_settings-' . $this->active_tab;
do_action($hook);
$view = MS_Factory::create('MS_View_Settings_Edit');
$view = apply_filters($hook . '_view', $view);
$data = array();
$data['tabs'] = $this->get_tabs();
$data['settings'] = $this->get_model();
$data['message'] = self::_message();
if (isset($data['message']['error'])) {
lib3()->ui->admin_message($data['message']['error'], 'err');
}
switch ($this->get_active_tab()) {
case self::TAB_EMAILS:
$type = MS_Model_Communication::COMM_TYPE_REGISTRATION;
$temp_type = isset($_GET['comm_type']) ? $_GET['comm_type'] : '';
if (MS_Model_Communication::is_valid_communication_type($temp_type)) {
$type = $temp_type;
}
$comm = MS_Model_Communication::get_communication($type);
$data['comm'] = $comm;
break;
}
$data = array_merge($data, $view->data);
$view->data = apply_filters($hook . '_data', $data);
$view->model = $this->get_model();
$view->render();
}
示例13: user_account_manager
/**
* Manage user account actions.
*
* @since 1.0.0
* @internal
*/
public function user_account_manager()
{
$action = $this->get_action();
$member = MS_Model_Member::get_current_member();
/**
* These actions are always executed when any user account page loads.
*
* @since 1.0.1.0
*/
do_action('ms_frontend_user_account_manager-' . $action, $this);
do_action('ms_frontend_user_account_manager', $action, $this);
if ($this->verify_nonce()) {
/**
* The following two actions are only executed when a form was
* submitted on a user account page.
*
* @since 1.0.1.0
*/
do_action('ms_frontend_user_account_manager_submit-' . $action, $this);
do_action('ms_frontend_user_account_manager_submit', $action, $this);
}
switch ($action) {
case self::ACTION_EDIT_PROFILE:
$data = array();
if ($this->verify_nonce()) {
if (is_array($_POST)) {
foreach ($_POST as $field => $value) {
$member->{$field} = $value;
}
}
try {
$member->validate_member_info();
$member->save();
wp_safe_redirect(esc_url_raw(remove_query_arg('action')));
exit;
} catch (Exception $e) {
$data['errors'] = $e->getMessage();
}
}
$view = MS_Factory::create('MS_View_Frontend_Profile');
$data['member'] = $member;
$data['action'] = $action;
$view->data = apply_filters('ms_view_frontend_profile_data', $data, $this);
$view->add_filter('the_content', 'to_html', 1);
break;
case self::ACTION_VIEW_INVOICES:
$data['invoices'] = MS_Model_Invoice::get_public_invoices($member->id);
$view = MS_Factory::create('MS_View_Frontend_Invoices');
$view->data = apply_filters('ms_view_frontend_frontend_invoices', $data, $this);
$view->add_filter('the_content', 'to_html', 1);
break;
case self::ACTION_VIEW_ACTIVITIES:
$data['events'] = MS_Model_Event::get_events(array('author' => $member->id, 'posts_per_page' => -1));
$view = MS_Factory::create('MS_View_Frontend_Activities');
$view->data = apply_filters('ms_view_frontend_frontend_activities', $data, $this);
$view->add_filter('the_content', 'to_html', 1);
break;
case self::ACTION_VIEW_RESETPASS:
/**
* Reset password action.
* This action is accessed via the password-reset email
* @see class-ms-controller-dialog.php
*
* The action is targeted to the Account-page but actually calls
* the Login-Shortcode.
*/
$view = MS_Factory::create('MS_View_Shortcode_Login');
$view->data = array('action' => 'resetpass');
$view->add_filter('the_content', 'to_html', 1);
break;
default:
// Do nothing...
break;
}
}
示例14: import_membership
/**
* Import specific data: A single membership
*
* @since 1.0.0
* @param object $obj The import object
*/
public function import_membership($obj)
{
$membership = MS_Factory::create('MS_Model_Membership');
$this->populate_membership($membership, $obj);
$membership->save();
$this->store_import_obj('membership', $obj->id, $membership);
}
示例15: admin_page
/**
* Load and render the Add-on manager view.
*
* @since 1.0.0
*/
public function admin_page()
{
// Reload the add-on list.
do_action('ms_model_addon_flush');
/**
* Create / Filter the Addon admin view.
*
* @since 1.0.0
* @param object $this The MS_Controller_Addon object.
*/
$view = MS_Factory::create('MS_View_Addon');
$data = array('addon' => MS_Factory::load('MS_Model_Addon'));
$view->data = apply_filters('ms_view_addon_data', $data);
$view->render();
}