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


PHP MS_Model_Membership::get_membership_names方法代码示例

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


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

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

示例2: admin_page

 /**
  * Sets up the 'Billing' navigation and list page.
  *
  * @since  1.0.0
  */
 public function admin_page()
 {
     $this->print_admin_message();
     // Action view page request
     $isset = array('action', 'invoice_id');
     if (self::validate_required($isset, 'GET', false) && 'edit' == $_GET['action']) {
         $invoice_id = !empty($_GET['invoice_id']) ? $_GET['invoice_id'] : 0;
         $data['invoice'] = MS_Factory::load('MS_Model_Invoice', $_GET['invoice_id']);
         $data['action'] = $_GET['action'];
         $data['memberships'] = MS_Model_Membership::get_membership_names(array('include_guest' => 0));
         $view = MS_Factory::create('MS_View_Billing_Edit');
         $view->data = apply_filters('ms_view_billing_edit_data', $data);
         $view->render();
     } else {
         $view = MS_Factory::create('MS_View_Billing_List');
         $view->render();
     }
 }
开发者ID:EdoMagen,项目名称:project-s-v2,代码行数:23,代码来源:class-ms-controller-billing.php

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

示例4: admin_coupon

 /**
  * Render the Coupon admin manager.
  *
  * @since  1.0.0
  */
 public function admin_coupon()
 {
     $isset = array('action', 'coupon_id');
     if (self::validate_required($isset, 'GET', false) && 'edit' == $_GET['action']) {
         // Edit action view page request
         $coupon_id = !empty($_GET['coupon_id']) ? $_GET['coupon_id'] : 0;
         $data['coupon'] = MS_Factory::load('MS_Addon_Coupon_Model', $coupon_id);
         $data['memberships'] = array(__('Any', MS_TEXT_DOMAIN));
         $data['memberships'] += MS_Model_Membership::get_membership_names();
         $data['action'] = $_GET['action'];
         $view = MS_Factory::create('MS_Addon_Coupon_View_Edit');
         $view->data = apply_filters('ms_addon_coupon_view_edit_data', $data);
         $view->render();
     } else {
         // Coupon admin list page
         $view = MS_Factory::create('MS_Addon_Coupon_View_List');
         $view->render();
     }
 }
开发者ID:jsandlin85,项目名称:SkylineSports,代码行数:24,代码来源:class-ms-addon-coupon.php

示例5: get_bulk_actions

 /**
  * Defines bulk-actions that are available for this list.
  *
  * @since  1.0.0
  * @return array
  */
 public function get_bulk_actions()
 {
     $protect_key = __('Add Membership', 'membership2');
     $unprotect_key = __('Drop Membership', 'membership2');
     $bulk_actions = array('rem-all' => __('Drop all Memberships', 'membership2'), $protect_key => array(), $unprotect_key => array());
     $memberships = MS_Model_Membership::get_membership_names();
     $txt_add = __('Add: %s', 'membership2');
     $txt_rem = __('Drop: %s', 'membership2');
     foreach ($memberships as $id => $name) {
         $bulk_actions[$protect_key]['add-' . $id] = sprintf($txt_add, $name);
         $bulk_actions[$unprotect_key]['rem-' . $id] = sprintf($txt_rem, $name);
     }
     return apply_filters('ms_helper_listtable_' . $this->id . '_bulk_actions', $bulk_actions);
 }
开发者ID:EdoMagen,项目名称:project-s-v2,代码行数:20,代码来源:class-ms-helper-listtable-rule.php

示例6: protect_content_shortcode

 /**
  * Do membership content protection shortcode.
  *
  * self::PROTECT_CONTENT_SHORTCODE
  *
  * Verify if content is protected comparing to self::$membership_ids.
  *
  * @since  1.0.0
  *
  * @param  array $atts The shortcode attributes.
  * @param  string $content The content inside the shortcode.
  * @param  string $code The shortcode code.
  * @return string The shortcode output
  */
 public static function protect_content_shortcode($atts, $content = null, $code = '')
 {
     $atts = apply_filters('ms_model_shortcode_protect_content_shortcode_atts', shortcode_atts(array('id' => '', 'access' => true, 'silent' => false, 'msg' => false), $atts));
     extract($atts);
     $membership_ids = explode(',', $id);
     if ($silent) {
         $msg = '';
     } else {
         if (!is_string($msg) || !strlen($msg)) {
             $settings = MS_Factory::load('MS_Model_Settings');
             $membership_id = apply_filters('ms_detect_membership_id', 0);
             $msg = $settings->get_protection_message(MS_Model_Settings::PROTECTION_MSG_SHORTCODE, $membership_id);
         }
     }
     $access = lib3()->is_true($access);
     if (!$access) {
         // No access to member of membership_ids
         if (self::is_member_of($membership_ids)) {
             // User belongs to these memberships and therefore cannot see
             // this content...
             if ($silent) {
                 // Silent protection: Do not show a message, simply hide it
                 $content = '';
             } else {
                 $content = '<div class="ms-protection-msg">';
                 if (!empty($msg)) {
                     $content .= $msg;
                 } else {
                     $membership_names = MS_Model_Membership::get_membership_names(array('post__in' => $membership_ids));
                     $content .= __('No access to members of: ', 'membership2');
                     $content .= implode(', ', $membership_names);
                 }
                 $content .= '</div>';
             }
         }
     } else {
         // Give access to member of membership_ids
         if (!self::is_member_of($membership_ids)) {
             // User does not belong to these memberships and therefore
             // cannot see this content...
             if ($silent) {
                 // Silent protection: Do not show a message, simply hide it
                 $content = '';
             } else {
                 $content = '<div class="ms-protection-msg">';
                 if (!empty($msg)) {
                     $content .= $msg;
                 } else {
                     $membership_names = MS_Model_Membership::get_membership_names(array('post__in' => $membership_ids));
                     $content .= __('Content protected to members of: ', 'membership2');
                     $content .= implode(', ', $membership_names);
                 }
                 $content .= '</div>';
             }
         }
     }
     return apply_filters('ms_rule_shortcode_model_protect_content_shortcode_content', do_shortcode($content), $atts, $content, $code);
 }
开发者ID:EdoMagen,项目名称:project-s-v2,代码行数:72,代码来源:class-ms-rule-shortcode-model.php


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