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

PHP MS_Model_Membership类代码示例

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

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



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

示例1: to_html

    public function to_html()
    {
        $membership = MS_Model_Membership::get_base();
        $rule = $membership->get_rule(MS_Rule_CptItem::RULE_ID);
        $rule_listtable = new MS_Rule_CptItem_ListTable($rule);
        $rule_listtable->prepare_items();
        $header_data = apply_filters('ms_view_membership_protectedcontent_header', array('title' => __('Choose Custom Post Types you want to protect', MS_TEXT_DOMAIN), 'desc' => ''), MS_Rule_CptItem::RULE_ID, $this);
        ob_start();
        ?>
		<div class="ms-settings">
			<?php 
        MS_Helper_Html::settings_tab_header($header_data);
        $rule_listtable->views();
        $rule_listtable->search_box(__('Posts', MS_TEXT_DOMAIN));
        ?>
			<form action="" method="post">
				<?php 
        $rule_listtable->display();
        do_action('ms_view_membership_protectedcontent_footer', MS_Rule_CptItem::RULE_ID, $this);
        ?>
			</form>
		</div>
		<?php 
        MS_Helper_Html::settings_footer();
        return ob_get_clean();
    }
开发者ID:jsandlin85,项目名称:SkylineSports,代码行数:26,代码来源:class-ms-rule-cptitem-view.php


示例2: init

 /**
  * Initialize the rule object.
  *
  * @since  4.6
  */
 protected function init()
 {
     global $wpdb;
     $this->filename = basename(__FILE__);
     // 'pc_subscription' rule.
     $this->add_rule('pc_subscription', __('For Members (Membership 2)', PO_LANG), __('Only shows the PopUp if the user has subscribed to a certain Membership (Membership2 plugin).', PO_LANG), 'pc_unsubscription', 25);
     // 'pc_unsubscription' rule.
     $this->add_rule('pc_unsubscription', __('For Non-Members (Membership 2)', PO_LANG), __('Only shows the PopUp if the user has not yet subscribed to a certain Membership (Membership2 plugin).', PO_LANG), 'pc_subscription', 25);
     // -- Initialize rule.
     /**
      * Note we're not using the M2 API yet, because it was introduced only
      * a few releases back and some people that use older version of M2/PC
      * will have problems if we do.
      *
      * @todo replace with official API function anytime in 2016
      *
      * $this->is_active = false;
      * if ( apply_filters( 'ms_active', false ) ) {
      *   $this->is_active = true;
      *   $this->memberships = MS_Plugin::$api->list_memberships( true );
      * }
      *
      */
     $this->is_active = class_exists('MS_Plugin');
     if (!$this->is_active) {
         return;
     }
     $args = array('include_base' => false, 'include_guest' => true);
     $list = MS_Model_Membership::get_memberships($args);
     $this->memberships = $list;
 }
开发者ID:TakenCdosG,项目名称:admissionsrevolution_new,代码行数:36,代码来源:class-popup-rule-protectedcontent.php


示例3: to_html

    public function to_html()
    {
        $membership = MS_Model_Membership::get_base();
        $rule = $membership->get_rule(MS_Rule_Adminside::RULE_ID);
        $rule_listtable = new MS_Rule_Adminside_ListTable($rule);
        $rule_listtable->prepare_items();
        $header_data = apply_filters('ms_view_membership_protectedcontent_header', array('title' => __('Protect Admin Side pages', 'membership2'), 'desc' => array(__('Note that WordPress also restricts access to pages before Content Protection is applied.', 'membership2'), __('Tip: Combine with the <b>User Role</b> rules to grant your members additional permission if required!', 'membership2'))), MS_Rule_Adminside::RULE_ID, $this);
        ob_start();
        ?>
		<div class="ms-settings">
			<?php 
        MS_Helper_Html::settings_tab_header($header_data);
        $rule_listtable->views();
        $rule_listtable->search_box();
        ?>
			<form action="" method="post">
				<?php 
        $rule_listtable->display();
        do_action('ms_view_membership_protectedcontent_footer', MS_Rule_Adminside::RULE_ID, $this);
        ?>
			</form>
		</div>
		<?php 
        MS_Helper_Html::settings_footer();
        return ob_get_clean();
    }
开发者ID:nayabbukhari,项目名称:circulocristiano,代码行数:26,代码来源:class-ms-rule-adminside-view.php


示例4: to_html

    public function to_html()
    {
        $membership = MS_Model_Membership::get_base();
        $rule = $membership->get_rule(MS_Rule_Page::RULE_ID);
        $rule_listtable = new MS_Rule_Page_ListTable($rule);
        $rule_listtable->prepare_items();
        $header_data = apply_filters('ms_view_membership_protectedcontent_header', array('title' => __('Apply protection to Pages and and grant access to members', 'membership2'), 'desc' => __('All pages that do not have Content Protection applied are visible to Everyone', 'membership2')), MS_Rule_Page::RULE_ID, $this);
        ob_start();
        ?>
		<div class="ms-settings">
			<?php 
        MS_Helper_Html::settings_tab_header($header_data);
        $rule_listtable->views();
        $rule_listtable->search_box(__('Pages', 'membership2'));
        ?>
			<form action="" method="post">
				<?php 
        $rule_listtable->display();
        do_action('ms_view_membership_protectedcontent_footer', MS_Rule_Page::RULE_ID, $this);
        ?>
			</form>
		</div>
		<?php 
        MS_Helper_Html::settings_footer();
        return ob_get_clean();
    }
开发者ID:nayabbukhari,项目名称:circulocristiano,代码行数:26,代码来源:class-ms-rule-page-view.php


示例5: to_html

    public function to_html()
    {
        $membership = MS_Model_Membership::get_base();
        $rule = $membership->get_rule(MS_Rule_MemberRoles::RULE_ID);
        $rule_listtable = new MS_Rule_MemberRoles_ListTable($rule);
        $rule_listtable->prepare_items();
        $header_data['title'] = __('Assign WordPress User Roles to your Members', MS_TEXT_DOMAIN);
        $header_data['desc'] = array(__('When assigning a Membership to any role, then this role will be added to all members of that Membership. You can even assign multiple roles to a single Membership.', MS_TEXT_DOMAIN), __('For security reasons the Administrator role cannot be assigned to a Membership.', MS_TEXT_DOMAIN));
        $header_data = apply_filters('ms_view_membership_protectedcontent_header', $header_data, MS_Rule_MemberRoles::RULE_ID, $this);
        ob_start();
        ?>
		<div class="ms-settings">
			<?php 
        MS_Helper_Html::settings_tab_header($header_data);
        $rule_listtable->views();
        $rule_listtable->search_box(__('Capability', MS_TEXT_DOMAIN));
        ?>
			<form action="" method="post">
				<?php 
        $rule_listtable->display();
        do_action('ms_view_membership_protectedcontent_footer', MS_Rule_MemberRoles::RULE_ID, $this);
        ?>
			</form>
		</div>
		<?php 
        MS_Helper_Html::settings_footer();
        return ob_get_clean();
    }
开发者ID:jsandlin85,项目名称:SkylineSports,代码行数:28,代码来源:class-ms-rule-memberroles-view.php


示例6: to_html

    public function to_html()
    {
        $membership = MS_Model_Membership::get_base();
        $rule = $membership->get_rule(MS_Rule_Content::RULE_ID);
        // This fixes the list-title generated by MS_Helper_ListTable_Rule.
        unset($_GET['status']);
        $rule_listtable = new MS_Rule_Content_ListTable($rule);
        $rule_listtable->prepare_items();
        $header_data = apply_filters('ms_view_membership_protectedcontent_header', array('title' => __('Comments & More Tag', MS_TEXT_DOMAIN), 'desc' => __('Decide how to protect Comments and More Tag contents.', MS_TEXT_DOMAIN)), MS_Rule_Content::RULE_ID, $this);
        ob_start();
        ?>
		<div class="ms-settings">
			<?php 
        MS_Helper_Html::settings_tab_header($header_data);
        $rule_listtable->views();
        $rule_listtable->search_box(__('Pages', MS_TEXT_DOMAIN));
        ?>
			<form action="" method="post">
				<?php 
        $rule_listtable->display();
        do_action('ms_view_membership_protectedcontent_footer', MS_Rule_Content::RULE_ID, $this);
        ?>
			</form>
		</div>
		<?php 
        MS_Helper_Html::settings_footer();
        return ob_get_clean();
    }
开发者ID:jsandlin85,项目名称:SkylineSports,代码行数:28,代码来源:class-ms-rule-content-view.php


示例7: to_html

    public function to_html()
    {
        $membership = MS_Model_Membership::get_base();
        $rule = $membership->get_rule(MS_Rule_Category::RULE_ID);
        $rule_listtable = new MS_Rule_Category_ListTable($rule);
        $rule_listtable->prepare_items();
        $header_data = array();
        $header_data['title'] = __('Choose which Categories you want to protect', 'membership2');
        $header_data['desc'] = '';
        $header_data = apply_filters('ms_view_membership_protectedcontent_header', $header_data, MS_Rule_Category::RULE_ID, $this);
        ob_start();
        ?>
		<div class="ms-settings ">
			<?php 
        MS_Helper_Html::settings_tab_header($header_data);
        $rule_listtable->views();
        $rule_listtable->search_box(__('Categories', 'membership2'), 'search-cat');
        ?>
			<form action="" method="post">
				<?php 
        $rule_listtable->display();
        do_action('ms_view_membership_protectedcontent_footer', MS_Rule_Category::RULE_ID, $this);
        ?>
			</form>
		</div>
		<?php 
        MS_Helper_Html::settings_footer();
        return ob_get_clean();
    }
开发者ID:nayabbukhari,项目名称:circulocristiano,代码行数:29,代码来源:class-ms-rule-category-view.php


示例8: to_html

    public function to_html()
    {
        $membership = MS_Model_Membership::get_base();
        $rule = $membership->get_rule(MS_Rule_MemberCaps::RULE_ID);
        $rule_listtable = new MS_Rule_MemberCaps_ListTable($rule);
        $rule_listtable->prepare_items();
        $header_data = array();
        $header_data['title'] = __('Assign WordPress Capabilities to your Members', 'membership2');
        $header_data['desc'] = array(__('Fine-tune member permissions by assigning certain Capabilities to each Membership. All Members of that Membership are granted the specified Capabilities.', 'membership2'), __('Important: All users that are not inside these Memberships will be striped of any Protected Capability!', 'membership2'), __('You should only use these rules if you know what you are doing! Granting the wrong capabilities makes your website prone to abuse. For a bit of security we already removed the most critical Capabilities from this list.', 'membership2'));
        $header_data = apply_filters('ms_view_membership_protectedcontent_header', $header_data, MS_Rule_MemberCaps::RULE_ID, $this);
        ob_start();
        ?>
		<div class="ms-settings">
			<?php 
        MS_Helper_Html::settings_tab_header($header_data);
        $rule_listtable->views();
        $rule_listtable->search_box(__('Capability', 'membership2'));
        ?>
			<form action="" method="post">
				<?php 
        $rule_listtable->display();
        do_action('ms_view_membership_protectedcontent_footer', MS_Rule_MemberCaps::RULE_ID, $this);
        ?>
			</form>
		</div>
		<?php 
        MS_Helper_Html::settings_footer();
        return ob_get_clean();
    }
开发者ID:nayabbukhari,项目名称:circulocristiano,代码行数:29,代码来源:class-ms-rule-membercaps-view.php


示例9: to_html

    public function to_html()
    {
        $membership = MS_Model_Membership::get_base();
        $rule = $membership->get_rule(MS_Rule_ReplaceMenu::RULE_ID);
        // This fixes the list-title generated by MS_Helper_ListTable_Rule.
        unset($_GET['status']);
        $listtable = new MS_Rule_ReplaceMenu_ListTable($rule);
        $listtable->prepare_items();
        $header_data = apply_filters('ms_view_membership_protectedcontent_header', array('title' => __('Replace Menus', 'membership2'), 'desc' => __('Replace or protect WordPress menus.', 'membership2')), MS_Rule_ReplaceMenu::RULE_ID, $this);
        ob_start();
        ?>
		<div class="ms-settings">
			<?php 
        MS_Helper_Html::settings_tab_header($header_data);
        $listtable->views();
        $listtable->search_box();
        ?>
			<form action="" method="post">
				<?php 
        $listtable->display();
        do_action('ms_view_membership_protectedcontent_footer', MS_Rule_ReplaceMenu::RULE_ID, $this);
        ?>
			</form>
		</div>
		<?php 
        MS_Helper_Html::settings_footer();
        return ob_get_clean();
    }
开发者ID:nayabbukhari,项目名称:circulocristiano,代码行数:28,代码来源:class-ms-rule-replacemenu-view.php


示例10: get_fields

 /**
  * Prepares fields for the edit form.
  *
  * @since  1.0.1.0
  * @return array
  */
 protected function get_fields()
 {
     $args = array('include_guest' => false);
     $memberships = MS_Model_Membership::get_memberships($args);
     $membership = $this->data['membership'];
     $action = MS_Controller_Membership::AJAX_ACTION_UPDATE_MEMBERSHIP;
     $nonce = wp_create_nonce($action);
     $fields = array();
     /*
      * The value of "allow_val" is negated, because the radio-slider is
      * reversed. So allow_val == false means that upgrading is allowed.
      *
      * This is just a UI tweak, the function ->update_allowed() returns true
      * when upgrading is allowed.
      */
     $list = array();
     $list['guest'] = array('allow' => __('Users without Membership can subscribe', 'membership2'), 'allow_val' => !$membership->update_allowed('guest'));
     foreach ($memberships as $item) {
         if ($item->id == $membership->id) {
             continue;
         }
         $list[$item->id] = array('allow' => sprintf(__('Members of %s can subscribe', 'membership2'), $item->get_name_tag()), 'allow_val' => !$membership->update_allowed($item->id));
         if (MS_Model_Addon::is_enabled(MS_Model_Addon::ADDON_MULTI_MEMBERSHIPS)) {
             $list[$item->id]['replace'] = sprintf(__('Cancel %s on subscription', 'membership2'), $item->get_name_tag());
             $list[$item->id]['replace_val'] = $membership->update_replaces($item->id);
         }
     }
     foreach ($list as $id => $data) {
         $fields[] = array('id' => 'deny_update[' . $id . ']', 'type' => MS_Helper_Html::INPUT_TYPE_RADIO_SLIDER, 'title' => $data['allow'], 'value' => $data['allow_val'], 'before' => __('Allow', 'membership2'), 'after' => __('Deny', 'membership2'), 'class' => 'reverse', 'wrapper_class' => 'ms-block inline-label ms-allow', 'ajax_data' => array(1));
         if (!empty($data['replace'])) {
             if (MS_Addon_Prorate::is_active()) {
                 $after_label = __('Cancel and Pro-Rate', 'membership2');
             } else {
                 $after_label = __('Cancel', 'membership2');
             }
             $fields[] = array('id' => 'replace_update[' . $id . ']', 'type' => MS_Helper_Html::INPUT_TYPE_RADIO_SLIDER, 'title' => $data['replace'], 'value' => $data['replace_val'], 'before' => __('Keep', 'membership2'), 'after' => $after_label, 'class' => 'reverse', 'wrapper_class' => 'ms-block inline-label ms-update-replace', 'ajax_data' => array(1));
         }
         $fields[] = array('type' => MS_Helper_Html::TYPE_HTML_SEPARATOR);
     }
     foreach ($fields as $key => $field) {
         if (!empty($field['ajax_data'])) {
             if (!empty($field['ajax_data']['action'])) {
                 continue;
             }
             if (!isset($fields[$key]['ajax_data']['field'])) {
                 $fields[$key]['ajax_data']['field'] = $fields[$key]['id'];
             }
             $fields[$key]['ajax_data']['_wpnonce'] = $nonce;
             $fields[$key]['ajax_data']['action'] = $action;
             $fields[$key]['ajax_data']['membership_id'] = $membership->id;
         }
     }
     return $fields;
 }
开发者ID:nayabbukhari,项目名称:circulocristiano,代码行数:60,代码来源:class-ms-view-membership-tab-upgrade.php


示例11: prepare_items

 public function prepare_items()
 {
     $this->_column_headers = array($this->get_columns(), $this->get_hidden_columns(), $this->get_sortable_columns());
     $args = array();
     if (!empty($_REQUEST['orderby']) && !empty($_REQUEST['order'])) {
         $args['orderby'] = $_REQUEST['orderby'];
         $args['order'] = $_REQUEST['order'];
     }
     // Prepare order by statement.
     if (!empty($args['orderby']) && property_exists('MS_Model_Membership', $args['orderby'])) {
         $args['meta_key'] = $args['orderby'];
         $args['orderby'] = 'meta_value';
     }
     $this->items = apply_filters('membership_helper_listtable_membership_items', MS_Model_Membership::get_memberships($args));
 }
开发者ID:nayabbukhari,项目名称:circulocristiano,代码行数:15,代码来源:class-ms-helper-listtable-membership.php


示例12: column_membership

 public function column_membership($item)
 {
     $html = '';
     $is_any = true;
     foreach ($item->membership_id as $id) {
         if (MS_Model_Membership::is_valid_membership($id)) {
             $is_any = false;
             $membership = MS_Factory::load('MS_Model_Membership', $id);
             $html .= sprintf('<span class="ms-bold">%s</span><br />', $membership->name);
         }
     }
     if ($is_any) {
         $html = sprintf('<span class="ms-low">%s</span>', __('Any', 'membership2'));
     }
     return $html;
 }
开发者ID:nayabbukhari,项目名称:circulocristiano,代码行数:16,代码来源:class-ms-addon-coupon-helper-listtable.php


示例13: to_html

    public function to_html()
    {
        $membership = MS_Model_Membership::get_base();
        $rule = $membership->get_rule(MS_Rule_Url::RULE_ID);
        $listtable = new MS_Rule_Url_ListTable($rule);
        $listtable->prepare_items();
        if ($listtable->list_shows_base_items()) {
            $add_fields = array('url' => array('id' => 'url_value', 'title' => __('Add new URL Address', 'membership2'), 'type' => MS_Helper_Html::INPUT_TYPE_TEXT, 'class' => 'ms-text-medium'), 'url_add' => array('id' => 'url_add', 'type' => MS_Helper_Html::INPUT_TYPE_SUBMIT, 'value' => __('Protect this URL', 'membership2'), 'button_type' => 'button'), 'url_action' => array('name' => 'rule_action', 'type' => MS_Helper_Html::INPUT_TYPE_HIDDEN, 'value' => MS_Rule_Url::ACTION_ADD), 'url_nonce' => array('name' => '_wpnonce', 'type' => MS_Helper_Html::INPUT_TYPE_HIDDEN, 'value' => wp_create_nonce(MS_Rule_Url::ACTION_ADD)));
        }
        $header_data = apply_filters('ms_view_membership_protectedcontent_header', array('title' => __('URL Restriction', 'membership2'), 'desc' => array(__('Specify URLs that you want to protect.', 'membership2'), __('e.g. <b>example.com/protectme/</b> will protect all URLs that contain <b>example.com/protectme/</b>, including any child page.', 'membership2')), 'class' => ''), MS_Rule_Url::RULE_ID, $this);
        ob_start();
        ?>
		<div class="ms-settings">
			<?php 
        MS_Helper_Html::settings_tab_header($header_data);
        ?>

			<form action="" method="post">
			<?php 
        if ($listtable->list_shows_base_items()) {
            foreach ($add_fields as $field) {
                MS_Helper_Html::html_element($field);
            }
        }
        ?>
			</form>

			<?php 
        $listtable->views();
        $listtable->search_box();
        ?>
			<form action="" method="post">
				<?php 
        $listtable->display();
        do_action('ms_view_membership_protectedcontent_footer', MS_Rule_Url::RULE_ID, $this);
        ?>
			</form>
		</div>
		<?php 
        MS_Helper_Html::settings_footer();
        return ob_get_clean();
    }
开发者ID:nayabbukhari,项目名称:circulocristiano,代码行数:42,代码来源:class-ms-rule-url-view.php


示例14: membership_filter

    /**
     * Display a filter to select the current membership
     *
     * @since  1.0.0
     */
    public function membership_filter()
    {
        $memberships = MS_Model_Membership::get_membership_names(array('active' => true, 'include_guest' => false));
        $url = esc_url_raw(remove_query_arg(array('membership_id', 'paged')));
        $links = array();
        $links['all'] = array('label' => __('All', MS_TEXT_DOMAIN), 'url' => $url);
        foreach ($memberships as $id => $name) {
            if (empty($name)) {
                $name = __('(No Name)', MS_TEXT_DOMAIN);
            }
            $filter_url = esc_url_raw(add_query_arg(array('membership_id' => $id), $url));
            $links['ms-' . $id] = array('label' => esc_html($name), 'url' => $filter_url);
        }
        ?>
		<div class="wp-filter">
			<ul class="filter-links">
				<?php 
        foreach ($links as $key => $item) {
            $is_current = MS_Helper_Utility::is_current_url($item['url']);
            $class = $is_current ? 'current' : '';
            ?>
					<li>
						<a href="<?php 
            echo esc_url($item['url']);
            ?>
" class="<?php 
            echo esc_attr($class);
            ?>
">
							<?php 
            echo esc_html($item['label']);
            ?>
						</a>
					</li>
				<?php 
        }
        ?>
			</ul>
		</div>
		<?php 
    }
开发者ID:jsandlin85,项目名称:SkylineSports,代码行数:46,代码来源:class-ms-view-member-list.php


示例15: to_html

    public function to_html()
    {
        $membership = MS_Model_Membership::get_base();
        $menus = $membership->get_rule(MS_Rule_MenuItem::RULE_ID)->get_menu_array();
        $menu_ids = array_keys($menus);
        $menu_id = reset($menu_ids);
        if (isset($_REQUEST['menu_id'])) {
            $menu_id = $_REQUEST['menu_id'];
        }
        // This fixes the list-title generated by MS_Helper_ListTable_Rule.
        unset($_GET['status']);
        $rule_menu = $membership->get_rule(MS_Rule_MenuItem::RULE_ID);
        $rule_listtable = new MS_Rule_MenuItem_ListTable($rule_menu, $menus, $menu_id);
        $fields['rule_menu'] = array('id' => 'rule_menu', 'name' => 'rule', 'value' => 'menu', 'type' => MS_Helper_Html::INPUT_TYPE_HIDDEN);
        $menu_url = esc_url_raw(add_query_arg(array('menu_id' => $menu_id)));
        $rule_listtable->prepare_items();
        $header_data = apply_filters('ms_view_membership_protectedcontent_header', array('title' => __('Menu Items', MS_TEXT_DOMAIN), 'desc' => __('Protect individual menu items.', MS_TEXT_DOMAIN)), MS_Rule_MenuItem::RULE_ID, $this);
        ob_start();
        ?>
		<div class="ms-settings">
			<?php 
        MS_Helper_Html::settings_tab_header($header_data);
        ?>

			<form id="ms-menu-form" method="post" action="<?php 
        echo '' . $menu_url;
        ?>
">
				<?php 
        MS_Helper_Html::html_element($fields['rule_menu']);
        $rule_listtable->views();
        $rule_listtable->display();
        do_action('ms_view_membership_protectedcontent_footer', MS_Rule_MenuItem::RULE_ID, $this);
        ?>
			</form>
		</div>
		<?php 
        MS_Helper_Html::settings_footer();
        return ob_get_clean();
    }
开发者ID:jsandlin85,项目名称:SkylineSports,代码行数:40,代码来源:class-ms-rule-menuitem-view.php


示例16: get_fields

 /**
  * Prepares fields for the edit form.
  *
  * @since  1.0.1.0
  * @return array
  */
 protected function get_fields()
 {
     $membership = $this->data['membership'];
     $action = MS_Controller_Membership::AJAX_ACTION_UPDATE_MEMBERSHIP;
     $nonce = wp_create_nonce($action);
     $fields = array();
     // Prepare the form fields.
     $fields['name'] = array('id' => 'name', 'type' => MS_Helper_Html::INPUT_TYPE_TEXT, 'title' => apply_filters('ms_translation_flag', __('Name:', MS_TEXT_DOMAIN), 'membership-name'), 'value' => $membership->name, 'ajax_data' => array(1));
     $fields['description'] = array('id' => 'description', 'type' => MS_Helper_Html::INPUT_TYPE_TEXT_AREA, 'title' => apply_filters('ms_translation_flag', __('Description:', MS_TEXT_DOMAIN), 'membership-name'), 'value' => $membership->description, 'ajax_data' => array(1));
     $fields['active'] = array('id' => 'active', 'type' => MS_Helper_Html::INPUT_TYPE_RADIO_SLIDER, 'title' => __('This membership is active', MS_TEXT_DOMAIN), 'before' => __('No', MS_TEXT_DOMAIN), 'after' => __('Yes', MS_TEXT_DOMAIN), 'class' => 'ms-active', 'value' => $membership->active, 'ajax_data' => array(1));
     $fields['public'] = array('id' => 'public', 'type' => MS_Helper_Html::INPUT_TYPE_RADIO_SLIDER, 'title' => __('This membership is public', MS_TEXT_DOMAIN), 'desc' => __('Users can see it listed on your site and can register for it', MS_TEXT_DOMAIN), 'before' => __('No', MS_TEXT_DOMAIN), 'after' => __('Yes', MS_TEXT_DOMAIN), 'class' => 'ms-public', 'value' => $membership->public, 'ajax_data' => array(1));
     $fields['paid'] = array('id' => 'is_paid', 'type' => MS_Helper_Html::INPUT_TYPE_RADIO_SLIDER, 'title' => __('This is a paid membership', MS_TEXT_DOMAIN), 'before' => __('No', MS_TEXT_DOMAIN), 'after' => __('Yes', MS_TEXT_DOMAIN), 'class' => 'ms-paid', 'value' => $membership->is_paid, 'ajax_data' => array(1));
     $priority_list = array();
     $args = array('include_guest' => 0);
     $count = MS_Model_Membership::get_membership_count($args);
     for ($i = 1; $i <= $count; $i += 1) {
         $priority_list[$i] = $i;
     }
     $priority_list[$membership->priority] = $membership->priority;
     $fields['priority'] = array('id' => 'priority', 'type' => MS_Helper_Html::INPUT_TYPE_SELECT, 'title' => __('Membership order', MS_TEXT_DOMAIN), 'desc' => __('This defines the display order on the Membership Page.', MS_TEXT_DOMAIN), 'class' => 'ms-priority', 'before' => __('Order', MS_TEXT_DOMAIN), 'value' => $membership->priority, 'field_options' => $priority_list, 'ajax_data' => array(1));
     if (MS_Model_Addon::is_enabled(MS_Model_Addon::ADDON_MULTI_MEMBERSHIPS)) {
         $fields['priority']['desc'] .= '<br>' . __('It also controlls which Protection Message is used in case a member has multiple memberships (the lowest value wins)', MS_TEXT_DOMAIN);
     }
     foreach ($fields as $key => $field) {
         if (!empty($field['ajax_data'])) {
             if (!empty($field['ajax_data']['action'])) {
                 continue;
             }
             if (!isset($fields[$key]['ajax_data']['field'])) {
                 $fields[$key]['ajax_data']['field'] = $fields[$key]['id'];
             }
             $fields[$key]['ajax_data']['_wpnonce'] = $nonce;
             $fields[$key]['ajax_data']['action'] = $action;
             $fields[$key]['ajax_data']['membership_id'] = $membership->id;
         }
     }
     return $fields;
 }
开发者ID:klgrimley,项目名称:mzf,代码行数:44,代码来源:class-ms-view-membership-tab-details.php


示例17: to_html

    public function to_html()
    {
        $membership = MS_Model_Membership::get_base();
        $rule = $membership->get_rule(MS_Addon_Bbpress_Rule::RULE_ID);
        $listtable = new MS_Addon_Bbpress_Rule_Listtable($rule);
        $listtable->prepare_items();
        $header_data = apply_filters('ms_view_membership_protectedcontent_header', array('title' => __('bbPress', MS_TEXT_DOMAIN), 'desc' => __('Protect the following bbPress content to members only.', MS_TEXT_DOMAIN)), MS_Addon_Bbpress_Rule::RULE_ID, $this);
        ob_start();
        ?>
		<div class="ms-settings">
			<?php 
        MS_Helper_Html::settings_tab_header($header_data);
        $listtable->views();
        ?>
			<form action="" method="post">
				<?php 
        $listtable->display();
        ?>
			</form>
		</div>
		<?php 
        MS_Helper_Html::settings_footer();
        return ob_get_clean();
    }
开发者ID:jsandlin85,项目名称:SkylineSports,代码行数:24,代码来源:class-ms-addon-bbpress-rule-view.php


示例18: get_exclude_include

 /**
  * Returns a list of post_ids to exclude or include to fullfil the specified
  * Membership/Status filter.
  *
  * @since  1.0.0
  * @param  array $args
  * @return array {
  *     List of post_ids to exclude or include
  *
  *     array $include
  *     array $exclude
  * }
  */
 public function get_exclude_include($args)
 {
     // Filter for Membership and Protection status via 'exclude'/'include'
     $include = array();
     $exclude = array();
     $base_rule = $this;
     $child_rule = $this;
     if (!$this->is_base_rule) {
         $base_rule = MS_Model_Membership::get_base()->get_rule($this->rule_type);
     }
     if (!empty($args['membership_id'])) {
         $child_membership = MS_Factory::load('MS_Model_Membership', $args['membership_id']);
         $child_rule = $child_membership->get_rule($this->rule_type);
     }
     $base_items = array_keys($base_rule->rule_value, true);
     $child_items = array_keys($child_rule->rule_value, true);
     $status = !empty($args['rule_status']) ? $args['rule_status'] : null;
     switch ($status) {
         case MS_Model_Rule::FILTER_PROTECTED:
             if (!empty($args['membership_id'])) {
                 $include = array_intersect($child_items, $base_items);
             } else {
                 $include = $child_items;
             }
             if (empty($include)) {
                 $include = array(-1);
             }
             break;
         case MS_Model_Rule::FILTER_NOT_PROTECTED:
             if (!empty($args['membership_id'])) {
                 $include = array_diff($base_items, $child_items);
                 if (empty($include) && empty($exclude)) {
                     $include = array(-1);
                 }
             } else {
                 $exclude = $child_items;
                 if (empty($include) && empty($exclude)) {
                     $exclude = array(-1);
                 }
             }
             break;
         default:
             // If not visitor membership, just show all Membership2
             if (!$child_rule->is_base_rule) {
                 $include = $base_items;
             }
             break;
     }
     /**
      * Allow rules/Add-ons to modify the exclude/include list.
      *
      * @since  1.0.0
      */
     $exclude = array_unique(apply_filters('ms_rule_exclude_items-' . $this->rule_type, $exclude, $args));
     $include = array_unique(apply_filters('ms_rule_include_items-' . $this->rule_type, $include, $args));
     $res = (object) array('include' => null, 'exclude' => null);
     if (!empty($include)) {
         $res->include = $include;
     } elseif (!empty($exclude)) {
         $res->exclude = $exclude;
     } elseif (!empty($args['membership_id'])) {
         $res->include = array(-1);
     }
     return $res;
 }
开发者ID:EdoMagen,项目名称:project-s-v2,代码行数:78,代码来源:class-ms-rule.php


示例19: process_form

 /**
  * Processes a form submit and changes the rule values, if valid form data
  * is found.
  *
  * @since  1.0.0
  */
 private function process_form()
 {
     $action = false;
     if (isset($_POST['rule_action'])) {
         $action = $_POST['rule_action'];
         if (!$this->verify_nonce($action)) {
             $action = false;
         }
     } elseif (isset($_GET['rule_action'])) {
         $action = $_GET['rule_action'];
         if (!$this->verify_nonce($action, 'GET')) {
             $action = false;
         }
     }
     if (empty($action)) {
         return;
     }
     $redirect = false;
     switch ($action) {
         case self::ACTION_ADD:
             lib3()->array->strip_slashes($_POST, 'url_value');
             $url = $_POST['url_value'];
             $base = MS_Model_Membership::get_base();
             $rule = $base->get_rule(self::RULE_ID);
             $rule->add_url($url);
             $base->set_rule(self::RULE_ID, $rule);
             $base->save();
             $redirect = true;
             break;
         case self::ACTION_DELETE:
             $id = $_REQUEST['item'];
             $base = MS_Model_Membership::get_base();
             $rule = $base->get_rule(self::RULE_ID);
             $rule->delete_url($id);
             $base->set_rule(self::RULE_ID, $rule);
             $base->save();
             $redirect = true;
             break;
     }
     if ($redirect) {
         $target = esc_url_raw(remove_query_arg(array('_wpnonce', 'item', 'rule_action')));
         wp_safe_redirect($target);
         exit;
     }
 }
开发者ID:nayabbukhari,项目名称:circulocristiano,代码行数:51,代码来源:class-ms-rule-url.php


示例20: get_bulk_actions

 /**
  * Bulk actions options.
  *
  * @since  1.0.0
  *
  * @param array {
  *     @type string $action The action name.
  *     @type mixed $desciption The action description.
  * }
  */
 public function get_bulk_actions()
 {
     $protect_key = __('Add Membership', MS_TEXT_DOMAIN);
     $unprotect_key = __('Drop Membership', MS_TEXT_DOMAIN);
     $bulk_actions = array('drop-all' => __('Drop all Memberships', MS_TEXT_DOMAIN), $protect_key => array(), $unprotect_key => array());
     $args = array('include_guest' => 0);
     $memberships = MS_Model_Membership::get_membership_names($args);
     $txt_add = __('Add: %s', MS_TEXT_DOMAIN);
     $txt_rem = __('Drop: %s', MS_TEXT_DOMAIN);
     foreach ($memberships as $id => $name) {
         $bulk_actions[$protect_key]['add-' . $id] = sprintf($txt_add, $name);
         $bulk_actions[$unprotect_key]['drop-' . $id] = sprintf($txt_rem, $name);
     }
     return apply_filters('ms_helper_listtable_member_get_bulk_actions', $bulk_actions, $this);
 }
开发者ID:jsandlin85,项目名称:SkylineSports,代码行数:25,代码来源:class-ms-helper-listtable-member.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
PHP MS_Plugin类代码示例发布时间:2022-05-23
下一篇:
PHP MS_Model_Member类代码示例发布时间: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