• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP MS_Factory类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



在下文中一共展示了MS_Factory类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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);
     }
 }
开发者ID:nayabbukhari,项目名称:circulocristiano,代码行数:15,代码来源:class-ms-controller-communication.php


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


示例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;
    }
开发者ID:jsandlin85,项目名称:SkylineSports,代码行数:29,代码来源:class-ms-view-member-list.php


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


示例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);
    }
开发者ID:jsandlin85,项目名称:SkylineSports,代码行数:36,代码来源:class-ms-addon-coupon-view-list.php


示例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;
 }
开发者ID:jsandlin85,项目名称:SkylineSports,代码行数:16,代码来源:class-ms-addon-buddypress-rule.php


示例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();
    }
开发者ID:EdoMagen,项目名称:project-s-v2,代码行数:39,代码来源:class-ms-view-migrationm1.php


示例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;
    }
开发者ID:klgrimley,项目名称:mzf,代码行数:37,代码来源:class-ms-view-membership-list.php


示例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();
    }
开发者ID:nayabbukhari,项目名称:circulocristiano,代码行数:35,代码来源:class-ms-view-settings-page-general.php


示例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);
 }
开发者ID:EdoMagen,项目名称:project-s-v2,代码行数:13,代码来源:class-ms-model-option.php


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


示例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');
     }
 }
开发者ID:jsandlin85,项目名称:SkylineSports,代码行数:14,代码来源:class-ms-addon-bbpress.php


示例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');
 }
开发者ID:EdoMagen,项目名称:project-s-v2,代码行数:14,代码来源:class-ms-addon.php


示例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;
 }
开发者ID:EdoMagen,项目名称:project-s-v2,代码行数:17,代码来源:class-ms-gateway-stripe.php


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


示例16: stripeplan_subscription

 /**
  * Tests the Stripe Subscription gateway
  * @test
  */
 function stripeplan_subscription()
 {
     $gateway = MS_Model_Gateway::factory(MS_Gateway_Stripeplan::ID);
     $user_id = TData::id('user', 'editor');
     $membership_id = TData::id('membership', 'recurring');
     $subscription = TData::subscribe($user_id, $membership_id);
     $controller = MS_Factory::load('MS_Controller_Gateway');
     $gateway->update_stripe_data();
     $data = array('card' => array('number' => '4242424242424242', 'exp_month' => 12, 'exp_year' => date('Y') + 1, 'cvc' => '314'));
     $res = M2_Stripe_Token::create($data);
     $token = $res->id;
     $form_data = array('_wpnonce' => wp_create_nonce($gateway->id . '_' . $subscription->id), 'gateway' => $gateway->id, 'ms_relationship_id' => $subscription->id, 'step' => 'process_purchase', 'stripeToken' => $token, 'stripeTokenType' => 'card', 'stripeEmail' => '[email protected]');
     $_POST = $form_data;
     $_REQUEST = $_POST;
     // Right now the subscription must have status PENDING
     $this->assertEquals(MS_Model_Relationship::STATUS_PENDING, $subscription->status);
     /*
      * This function processes the purchase and will set the subscription
      * to active.
      */
     $controller->process_purchase();
     // Check the subscription status.
     $this->assertEquals(MS_Model_Relationship::STATUS_ACTIVE, $subscription->status);
     $this->assertEquals(1, count($subscription->payments));
     // Modify the expiration date to trigger another payment.
     $today = date('Y-m-d');
     $subscription->expire_date = $today;
     $this->assertEquals($today, $subscription->expire_date);
     $this->assertEquals(0, $subscription->get_remaining_period());
     // Trigger next payment and validate it.
     $subscription->check_membership_status();
     $this->assertEquals(2, count($subscription->payments));
     // Modify the expiration date to trigger another payment.
     $subscription->expire_date = $today;
     $this->assertEquals($today, $subscription->expire_date);
     $this->assertEquals(0, $subscription->get_remaining_period());
     // Trigger next payment and validate it.
     // THIS TIME NO PAYMENT SHOULD BE MADE because paycycle_repetitions = 2!
     $subscription->check_membership_status();
     $this->assertEquals(2, count($subscription->payments));
     // Also the subscription should be cancelled at stripe now.
     $customer_id = $subscription->get_member()->get_gateway_profile(MS_Gateway_Stripe_Api::ID, 'customer_id');
     $customer = M2_Stripe_Customer::retrieve($customer_id);
     $invoice = $subscription->get_previous_invoice();
     $stripe_sub_id = $invoice->external_id;
     $stripe_sub = $customer->subscriptions->retrieve($stripe_sub_id);
     $this->assertEquals('active', $stripe_sub->status);
     $this->assertTrue($stripe_sub->cancel_at_period_end);
     // Clean up.
     $customer->delete();
 }
开发者ID:jsandlin85,项目名称:SkylineSports,代码行数:55,代码来源:test-gateways.php


示例17: 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();
 }
开发者ID:jsandlin85,项目名称:SkylineSports,代码行数:19,代码来源:class-ms-controller-help.php


示例18: staging_data_is_correct

 /**
  * Checks if shared-setup was working.
  * @test
  */
 function staging_data_is_correct()
 {
     $this->assertFalse(empty(TData::id('user', 'admin')));
     wp_set_current_user(TData::id('user', 'admin'));
     $this->assertEquals(get_current_user_id(), TData::id('user', 'admin'));
     $this->assertFalse(empty(TData::id('user', 'editor')));
     $this->assertFalse(empty(TData::id('post', 'sample-page')));
     $this->assertEquals('page', get_post_type(TData::id('post', 'sample-page')));
     $ms_id = TData::id('membership', 'simple');
     $this->assertFalse(empty($ms_id));
     $membership = MS_Factory::load('MS_Model_Membership', $ms_id);
     $this->assertEquals($ms_id, $membership->id);
     $this->assertEquals(29, $membership->price);
 }
开发者ID:jsandlin85,项目名称:SkylineSports,代码行数:18,代码来源:test-general.php


示例19: member_capabilities_rule

 /**
  * Check member capability add-on.
  * @test
  */
 function member_capabilities_rule()
 {
     // We only test the addon as an isolated unit.
     $addon = MS_Factory::load('MS_Rule_MemberCaps_Model');
     remove_all_filters('user_has_cap');
     $addon->protect_admin_content();
     wp_set_current_user(TData::id('user', 'admin'));
     $this->assertTrue(current_user_can('manage_options'), 'admin');
     $this->assertTrue(current_user_can('edit_theme_options'), 'admin');
     wp_set_current_user(TData::id('user', 'editor'));
     $this->assertFalse(current_user_can('manage_options'), 'editor');
     $this->assertFalse(current_user_can('edit_theme_options'), 'editor');
     $this->assertTrue(current_user_can('edit_pages'), 'editor');
     $this->assertTrue(current_user_can('delete_pages'), 'editor');
 }
开发者ID:jsandlin85,项目名称:SkylineSports,代码行数:19,代码来源:test-rules.php


示例20: did_import

 /**
  * Checks if the user did import data from this source before.
  *
  * This information is not entirely reliable, since data could have been
  * deleted again after import.
  *
  * @since  1.0.0
  * @return bool
  */
 public static function did_import()
 {
     $settings = MS_Factory::load('MS_Model_Settings');
     $did_import = !empty($settings->import[self::KEY]);
     /**
      * Allow users to manually declare that some M2 subscriptions were
      * imported from old Membership plugin.
      *
      * As a result M2 will additionally listen to the old M1 IPN URL for
      * PayPal payment notifications.
      *
      * @since  1.0.2.4
      * @param  bool $did_import
      */
     return apply_filters('ms_did_import_m1_data', $did_import);
 }
开发者ID:nayabbukhari,项目名称:circulocristiano,代码行数:25,代码来源:class-ms-model-import-membership.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP MS_Helper_Html类代码示例发布时间:2022-05-23
下一篇:
PHP MS_Controller_Plugin类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap