当前位置: 首页>>代码示例>>PHP>>正文


PHP MS_Model_Membership::get_membership_count方法代码示例

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


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

示例1: 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

示例2: get_edit_tabs

 /**
  * Get available tabs for Membership2 page.
  *
  * @since  1.0.0
  *
  * @return array The tabs configuration.
  */
 public function get_edit_tabs()
 {
     static $Tabs = null;
     if (null === $Tabs) {
         $membership = $this->load_membership();
         $args = array('include_guest' => false);
         $count = MS_Model_Membership::get_membership_count($args);
         $Tabs = array(self::TAB_DETAILS => array('title' => __('Details', 'membership2')), self::TAB_TYPE => array('title' => __('Membership Type', 'membership2')), self::TAB_PAYMENT => array('title' => __('Payment options', 'membership2')), self::TAB_UPGRADE => array('title' => __('Upgrade paths', 'membership2')), self::TAB_MESSAGES => array('title' => __('Protection Messages', 'membership2')), self::TAB_EMAILS => array('title' => __('Automated Email Responses', 'membership2')));
         if ($membership->is_system()) {
             unset($Tabs[self::TAB_TYPE]);
             unset($Tabs[self::TAB_PAYMENT]);
             unset($Tabs[self::TAB_EMAILS]);
             unset($Tabs[self::TAB_UPGRADE]);
         } elseif ($membership->is_free) {
             $Tabs[self::TAB_PAYMENT]['title'] = __('Access options', 'membership2');
         }
         if ($count < 2) {
             unset($Tabs[self::TAB_UPGRADE]);
         }
         // Allow Add-ons to add or remove rule tabs
         $Tabs = apply_filters('ms_controller_membership_tabs', $Tabs);
         foreach ($Tabs as $key => $tab) {
             if (!empty($Tabs['key']['url'])) {
                 continue;
             }
             $url = sprintf('%1$s?page=%2$s&step=%3$s&tab=%4$s&membership_id=%5$s', admin_url('admin.php'), esc_attr($_REQUEST['page']), MS_Controller_Membership::STEP_EDIT, $key, $membership->id);
             $Tabs[$key]['url'] = $url;
         }
     }
     return $Tabs;
 }
开发者ID:nayabbukhari,项目名称:circulocristiano,代码行数:38,代码来源:class-ms-controller-membership.php

示例3: prepare_fields

 /**
  * Prepare the fields displayed in the form.
  *
  * @since  1.0.0
  * @return array
  */
 public function prepare_fields()
 {
     $membership = $this->data['membership'];
     $fields = array('type' => array('id' => 'type', 'type' => MS_Helper_Html::INPUT_TYPE_RADIO, 'value' => $membership->type ? $membership->type : MS_Model_Membership::TYPE_STANDARD, 'class' => 'ms-choose-type', 'field_options' => array(MS_Model_Membership::TYPE_STANDARD => array('text' => __('Standard Membership', MS_TEXT_DOMAIN), 'desc' => __('Make your content available to Members and hidden to Guests (logged-out users).', MS_TEXT_DOMAIN)), MS_Model_Membership::TYPE_DRIPPED => array('text' => __('Dripped Content Membership.', MS_TEXT_DOMAIN), 'desc' => __('Set-up membership content to be released / made available in intervals.', MS_TEXT_DOMAIN)), MS_Model_Membership::TYPE_GUEST => array('text' => __('Guest Membership', MS_TEXT_DOMAIN), 'desc' => __('Make your content available only to Guests (logged-out users).', MS_TEXT_DOMAIN)), MS_Model_Membership::TYPE_USER => array('text' => __('Default Membership', MS_TEXT_DOMAIN), 'desc' => __('Content is available to all logged-in users that did not join any other Membership yet.', MS_TEXT_DOMAIN)))), 'name' => array('id' => 'name', 'type' => MS_Helper_Html::INPUT_TYPE_TEXT, 'title' => __('Name Your Membership:', MS_TEXT_DOMAIN), 'value' => $membership->name, 'class' => 'ms-text-large', 'placeholder' => __('Choose a name that will identify this membership...', MS_TEXT_DOMAIN), 'label_type' => 'h3'), 'config_fields' => array('public' => array('id' => 'public', 'type' => MS_Helper_Html::INPUT_TYPE_CHECKBOX, 'title' => __('Allow users to register for this membership.', MS_TEXT_DOMAIN), 'desc' => __('If selected, registration experience will be added to your site. Do not tick if you want to make this a private membership.', MS_TEXT_DOMAIN), 'after' => sprintf('<span class="locked-info">%1$s</span>', __('Not available for the Guest Membership', MS_TEXT_DOMAIN)), 'value' => !$membership->private), 'public_flag' => array('id' => 'set_public_flag', 'type' => MS_Helper_Html::INPUT_TYPE_HIDDEN, 'value' => 1), 'paid' => array('id' => 'paid', 'type' => MS_Helper_Html::INPUT_TYPE_CHECKBOX, 'title' => __('This is a paid membership.', MS_TEXT_DOMAIN), 'desc' => __('Choose this if you want to receive payments from members via Payment Gateways.', MS_TEXT_DOMAIN), 'after' => sprintf('<span class="locked-info">%1$s</span>', __('Not available for the Guest Membership', MS_TEXT_DOMAIN)), 'value' => !$membership->is_free()), 'paid_flag' => array('id' => 'set_paid_flag', 'type' => MS_Helper_Html::INPUT_TYPE_HIDDEN, 'value' => 1)), 'control_fields' => array('membership_id' => array('id' => 'membership_id', 'type' => MS_Helper_Html::INPUT_TYPE_HIDDEN, 'value' => $membership->id), 'step' => array('id' => 'step', 'type' => MS_Helper_Html::INPUT_TYPE_HIDDEN, 'value' => $this->data['step']), 'action' => array('id' => 'action', 'type' => MS_Helper_Html::INPUT_TYPE_HIDDEN, 'value' => $this->data['action']), '_wpnonce' => array('id' => '_wpnonce', 'type' => MS_Helper_Html::INPUT_TYPE_HIDDEN, 'value' => wp_create_nonce($this->data['action'])), 'cancel' => array('id' => 'cancel', 'type' => MS_Helper_Html::INPUT_TYPE_BUTTON, 'value' => __('Cancel', MS_TEXT_DOMAIN), 'data_ms' => array('action' => MS_Controller_Settings::AJAX_ACTION_UPDATE_SETTING, 'field' => 'initial_setup', 'value' => '0')), 'save' => array('id' => 'save', 'type' => MS_Helper_Html::INPUT_TYPE_SUBMIT, 'value' => __('Save and continue', MS_TEXT_DOMAIN) . ' &raquo;')));
     // Only one Guest Membership can be added
     if (MS_Model_Membership::get_guest()->is_valid()) {
         unset($fields['type']['field_options'][MS_Model_Membership::TYPE_GUEST]);
     }
     // Only one User Membership can be added
     if (MS_Model_Membership::get_user()->is_valid()) {
         unset($fields['type']['field_options'][MS_Model_Membership::TYPE_USER]);
     }
     // Wizard can only be cancelled when at least one membership exists in DB.
     $count = MS_Model_Membership::get_membership_count();
     if (!$count) {
         unset($fields['control_fields']['cancel']);
     }
     return $fields;
 }
开发者ID:klgrimley,项目名称:mzf,代码行数:25,代码来源:class-ms-view-membership-add.php


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