本文整理汇总了PHP中MS_Model_Membership::get_base方法的典型用法代码示例。如果您正苦于以下问题:PHP MS_Model_Membership::get_base方法的具体用法?PHP MS_Model_Membership::get_base怎么用?PHP MS_Model_Membership::get_base使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MS_Model_Membership
的用法示例。
在下文中一共展示了MS_Model_Membership::get_base方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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();
}
示例2: 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();
}
示例3: 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();
}
示例4: 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();
}
示例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();
}
示例6: 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();
}
示例7: 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();
}
示例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();
}
示例9: load_membership
/**
* Load membership from request.
*
* @since 1.0.0
*
* @return MS_Model_Membership The membership model object.
*/
public function load_membership()
{
$membership_id = 0;
if (empty($this->model)) {
if (!empty($_REQUEST['membership_id'])) {
$membership_id = absint($_REQUEST['membership_id']);
if ($membership_id == MS_Model_Membership::get_base()->id) {
wp_safe_redirect(esc_url_raw(remove_query_arg(array('membership_id'))));
}
} else {
$membership_id = MS_Model_Membership::get_base()->id;
}
$this->model = MS_Factory::load('MS_Model_Membership', $membership_id);
$this->model = apply_filters('ms_controller_protection_load_membership', $this->model, $this);
}
return $this->model;
}
示例10: 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();
}
示例11: 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();
}
示例12: 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();
}
示例13: return_listtable
/**
* Returns the ListTable object for this rule.
*
* @since 1.0.0
*
* @return MS_Helper_ListTable
*/
public function return_listtable($empty)
{
$base = MS_Model_Membership::get_base();
$rule = $base->get_rule(self::RULE_ID);
return new MS_Rule_MemberRoles_ListTable($rule);
}
示例14: prepare_fields
/**
* Prepare html fields.
*
* @since 1.0.0
*
* @return array
*/
public function prepare_fields()
{
// The ID of the main system membership.
$base_id = MS_Model_Membership::get_base()->id;
$sorted_memberships = array();
$memberships = MS_Model_Membership::get_memberships(array('include_base' => 1));
foreach ($memberships as $membership) {
if ($base_id == $membership->id) {
$label = __('- No membership / Visitor -', MS_TEXT_DOMAIN);
} else {
$label = $membership->name;
if (!$membership->active) {
$label .= ' ' . __('(Inactive)', MS_TEXT_DOMAIN);
}
}
$sorted_memberships[$membership->id] = $label;
}
asort($sorted_memberships);
$fields = array('exit_button' => array('type' => MS_Helper_Html::TYPE_HTML_LINK, 'value' => __('Exit Test Mode', MS_TEXT_DOMAIN), 'url' => MS_Controller_Adminbar::get_simulation_exit_url(), 'class' => 'button'), 'action_field' => array('name' => 'action', 'value' => 'ms_simulate', 'type' => MS_Helper_Html::INPUT_TYPE_HIDDEN), 'membership_id' => array('id' => 'ab-membership-id', 'name' => 'membership_id', 'value' => $this->data['membership_id'], 'type' => MS_Helper_Html::INPUT_TYPE_SELECT, 'field_options' => $sorted_memberships), 'nonce_field' => array('id' => '_wpnonce', 'value' => wp_create_nonce('ms_simulate'), 'type' => MS_Helper_Html::INPUT_TYPE_HIDDEN), 'simulate_date' => array('id' => 'simulate_date', 'type' => MS_Helper_Html::INPUT_TYPE_DATEPICKER, 'value' => $this->data['simulate_date'], 'class' => 'ms-admin-bar-date ms-date'), 'simulate_submit' => array('id' => 'simulate_submit', 'type' => MS_Helper_Html::INPUT_TYPE_SUBMIT, 'value' => __('Go', MS_TEXT_DOMAIN), 'class' => 'ms-admin-bar-submit'));
return apply_filters('ms_view_admin_bar_prepare_fields', $fields, $this);
}
示例15: 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;
}