本文整理汇总了PHP中MS_Model_Addon类的典型用法代码示例。如果您正苦于以下问题:PHP MS_Model_Addon类的具体用法?PHP MS_Model_Addon怎么用?PHP MS_Model_Addon使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了MS_Model_Addon类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: is_enabled
/**
* Add a dependency check to this add-on: It can only be enabled when the
* parent Add-on "Media" is also enabled.
*
* Filter: 'ms_model_addon_is_enabled_addon_mediafiles'
*
* @since 1.0.0
* @internal
*
* @param bool $enabled State of this add-on
* (without considering the parent add-on)
* @return bool The actual state of this add-on.
*/
public function is_enabled($enabled)
{
if ($enabled) {
$enabled = MS_Model_Addon::is_enabled(MS_Model_Addon::ADDON_MEDIA);
}
return $enabled;
}
开发者ID:nayabbukhari,项目名称:circulocristiano,代码行数:20,代码来源:class-ms-addon-mediafiles.php
示例2: is_active
/**
* Checks if the current Add-on is enabled
*
* @since 1.0.0
* @return bool
*/
public static function is_active()
{
if (!self::buddypress_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:jsandlin85,项目名称:SkylineSports,代码行数:14,代码来源:class-ms-addon-buddypress.php
示例3: get_columns
/**
* Get list table columns.
*
* @since 1.0.0
*
* @return array {
* Returns array of $id => $title.
*
* @type string $id The list table column id.
* @type string $title The list table column title.
* }
*/
public function get_columns()
{
$columns = array('cb' => '<input type="checkbox" />', 'username' => __('Username', MS_TEXT_DOMAIN), 'email' => __('E-mail', MS_TEXT_DOMAIN), 'membership' => __('Membership', MS_TEXT_DOMAIN), 'infos' => ' ');
if (!MS_Model_Addon::is_enabled(MS_Model_Addon::ADDON_TRIAL)) {
unset($columns['trial']);
}
return apply_filters('ms_helper_listtable_member_get_columns', $columns);
}
开发者ID:jsandlin85,项目名称:SkylineSports,代码行数:20,代码来源:class-ms-helper-listtable-member.php
示例4: 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
示例5: protect_content
/**
* Set initial protection.
*
* Add [ms-protect-content] shortcode to protect membership content inside post.
*
* @since 1.0.0
*/
public function protect_content()
{
parent::protect_content();
self::$membership_ids[] = $this->membership_id;
add_shortcode(self::PROTECT_CONTENT_SHORTCODE, array(__CLASS__, 'protect_content_shortcode'));
if (MS_Model_Addon::is_enabled(MS_Model_Addon::ADDON_SHORTCODE)) {
global $shortcode_tags;
$exclude = MS_Helper_Shortcode::get_membership_shortcodes();
foreach ($shortcode_tags as $shortcode => $callback_funciton) {
if (in_array($shortcode, $exclude)) {
continue;
}
if (!parent::has_access($shortcode)) {
$shortcode_tags[$shortcode] = array(&$this, 'do_protected_shortcode');
}
}
}
}
开发者ID:EdoMagen,项目名称:project-s-v2,代码行数:25,代码来源:class-ms-rule-shortcode-model.php
示例6: get_contents
/**
* Returns the contens of the dialog
*
* @since 1.0.0
*
* @return object
*/
public function get_contents($data)
{
$member = $data['model'];
$currency = MS_Plugin::instance()->settings->currency;
$show_trial = MS_Model_Addon::is_enabled(MS_Model_Addon::ADDON_TRIAL);
$all_subscriptions = MS_Model_Relationship::get_subscriptions(array('user_id' => $member->id, 'status' => 'all', 'meta_key' => 'expire_date', 'orderby' => 'meta_value', 'order' => 'DESC'));
// Prepare the form fields.
$inp_dialog = array('type' => MS_Helper_Html::INPUT_TYPE_HIDDEN, 'name' => 'dialog', 'value' => 'View_Member_Dialog');
$inp_id = array('type' => MS_Helper_Html::INPUT_TYPE_HIDDEN, 'name' => 'member_id', 'value' => $member->id);
$inp_nonce = array('type' => MS_Helper_Html::INPUT_TYPE_HIDDEN, 'name' => '_wpnonce', 'value' => wp_create_nonce(self::ACTION_SAVE));
$inp_action = array('type' => MS_Helper_Html::INPUT_TYPE_HIDDEN, 'name' => 'dialog_action', 'value' => self::ACTION_SAVE);
$inp_save = array('type' => MS_Helper_Html::INPUT_TYPE_SUBMIT, 'value' => __('Save', 'membership2'), 'class' => 'ms-submit-form', 'data' => array('form' => 'ms-edit-member'));
$inp_cancel = array('type' => MS_Helper_Html::INPUT_TYPE_BUTTON, 'value' => __('Close', 'membership2'), 'class' => 'close');
ob_start();
?>
<div>
<form class="ms-form wpmui-ajax-update ms-edit-member" data-wpmui-ajax="<?php
echo esc_attr('save');
?>
">
<div class="ms-form wpmui-form wpmui-grid-8">
<table class="widefat">
<thead>
<tr>
<th class="column-membership">
<?php
_e('Membership', 'membership2');
?>
</th>
<th class="column-status">
<?php
_e('Status', 'membership2');
?>
</th>
<th class="column-start">
<?php
_e('Subscribed on', 'membership2');
?>
</th>
<th class="column-expire">
<?php
_e('Expires on', 'membership2');
?>
</th>
<?php
if ($show_trial) {
?>
<th class="column-trialexpire">
<?php
_e('Trial until', 'membership2');
?>
</th>
<?php
}
?>
<th class="column-payments">
<?php
_e('Payments', 'membership2');
?>
</th>
</tr>
</thead>
<tbody>
<?php
foreach ($all_subscriptions as $subscription) {
$membership = $subscription->get_membership();
$payments = $subscription->get_payments();
$num_payments = count($payments);
$amount_payments = 0;
foreach ($payments as $payment) {
$amount_payments += $payment['amount'];
}
$subscription_info = array('subscription_id' => $subscription->id);
$update_info = array('subscription_id' => $subscription->id, 'statuscheck' => 'yes');
?>
<tr>
<td class="column-membership">
<?php
$membership->name_tag();
?>
</td>
<td class="column-status">
<?php
printf('<a href="#" data-ms-dialog="View_Member_Subscription" data-ms-data="%2$s">%1$s</a>
<a href="#" data-ms-dialog="View_Member_Subscription" data-ms-data="%3$s" title="%5$s">%4$s</a>', $subscription->status, esc_attr(json_encode($subscription_info)), esc_attr(json_encode($update_info)), '<i class="dashicons dashicons-update"></i>', __('Check and update subscription status', 'membership2'));
?>
</td>
<td class="column-start">
<?php
echo $subscription->start_date;
?>
</td>
<td class="column-expire">
//.........这里部分代码省略.........
开发者ID:nayabbukhari,项目名称:circulocristiano,代码行数:101,代码来源:class-ms-view-member-dialog.php
示例7: add_rewrite_rules
/**
* Add rewrite rules.
*
* @since 1.0.0
*/
public function add_rewrite_rules()
{
$settings = MS_Factory::load('MS_Model_Settings');
// Gateway return - IPN.
add_rewrite_rule('ms-payment-return/(.+)/?', 'index.php?paymentgateway=$matches[1]', 'top');
// Alternative payment return URL: Membership
if (MS_Model_Import_Membership::did_import()) {
add_rewrite_rule('paymentreturn/(.+)/?', 'index.php?paymentgateway=$matches[1]', 'top');
}
// Media / download
$mmask = $settings->downloads['masked_url'];
$mtype = $settings->downloads['protection_type'];
if (MS_Model_Addon::is_enabled(MS_Model_Addon::ADDON_MEDIA) && $mmask) {
if (MS_Rule_Media_Model::PROTECTION_TYPE_HYBRID == $mtype) {
add_rewrite_rule(sprintf('^%1$s/?$', $mmask), 'index.php?protectedfile=0', 'top');
} else {
add_rewrite_rule(sprintf('^%1$s/([^/]+)', $mmask), 'index.php?protectedfile=$matches[1]', 'top');
}
}
// End: Media / download
do_action('ms_plugin_add_rewrite_rules', $this);
}
开发者ID:oshabaeva,项目名称:project-s-v2,代码行数:27,代码来源:membership.php
示例8: has_rule_for_current_page
/**
* Checks if the current page is a special page and if the special page is
* protected by this rule.
*
* @since 1.0.0
*
* @return bool
*/
public function has_rule_for_current_page()
{
if (null === $this->_has_rule) {
if (!MS_Model_Addon::is_enabled(MS_Model_Addon::ADDON_SPECIAL_PAGES)) {
$this->_has_rule = false;
} else {
$base = $this->get_membership()->get_base();
$base_rule = $base->get_rule($this->rule_type);
$this->_has_rule = $this->check_current_page($base_rule->rule_value);
}
}
return $this->_has_rule;
}
开发者ID:nayabbukhari,项目名称:circulocristiano,代码行数:21,代码来源:class-ms-rule-special-model.php
示例9: is_read_only
/**
* Determine whether Membership access can be changed or is read-only.
*
* @since 1.0.0
* @param string $post_type The post type of the post.
* @return bool
*/
public function is_read_only($post_type)
{
if ('post' == $post_type && !MS_Model_Addon::is_enabled(MS_Model_Addon::ADDON_POST_BY_POST)) {
$read_only = true;
} elseif ('attachment' == $post_type) {
$read_only = true;
} else {
$read_only = false;
}
return apply_filters('ms_controller_membership_metabox_is_read_only', $read_only, $post_type, $this);
}
开发者ID:oshabaeva,项目名称:project-s-v2,代码行数:18,代码来源:class-ms-controller-metabox.php
示例10: membership_signup
/**
* Membership signup callback function.
*
* @since 1.0.0
*
* @param mixed[] $atts Shortcode attributes.
*/
public function membership_signup($atts)
{
MS_Helper_Shortcode::did_shortcode(MS_Helper_Shortcode::SCODE_SIGNUP);
$data = apply_filters('ms_controller_shortcode_membership_signup_atts', shortcode_atts(array(MS_Helper_Membership::MEMBERSHIP_ACTION_SIGNUP . '_text' => __('Signup', 'membership2'), MS_Helper_Membership::MEMBERSHIP_ACTION_MOVE . '_text' => __('Change', 'membership2'), MS_Helper_Membership::MEMBERSHIP_ACTION_CANCEL . '_text' => __('Cancel', 'membership2'), MS_Helper_Membership::MEMBERSHIP_ACTION_RENEW . '_text' => __('Renew', 'membership2'), MS_Helper_Membership::MEMBERSHIP_ACTION_PAY . '_text' => __('Complete Payment', 'membership2')), $atts));
$member = MS_Model_Member::get_current_member();
$data['member'] = $member;
$data['subscriptions'] = array();
$exclude = array();
if ($member->is_valid()) {
// Get member's memberships, including pending relationships.
$data['subscriptions'] = MS_Model_Relationship::get_subscriptions(array('user_id' => $data['member']->id, 'status' => 'valid'));
foreach ($data['subscriptions'] as $key => $subscription) {
$exclude[] = $subscription->membership_id;
if (!$member->can_subscribe_to($subscription->membership_id)) {
unset($data['subscriptions'][$key]);
}
}
}
$memberships = MS_Model_Membership::get_signup_membership_list(null, $exclude);
$data['memberships'] = $memberships;
$move_from_ids = array();
// When Multiple memberships is not enabled, a member should move to another membership.
if (!MS_Model_Addon::is_enabled(MS_Model_Addon::ADDON_MULTI_MEMBERSHIPS)) {
// Membership Relationship status which can move to another one
$valid_status = array(MS_Model_Relationship::STATUS_TRIAL, MS_Model_Relationship::STATUS_ACTIVE, MS_Model_Relationship::STATUS_EXPIRED);
foreach ($data['member']->subscriptions as $subscription) {
if ($subscription->is_system()) {
continue;
}
if (in_array($subscription->status, $valid_status)) {
$move_from_ids[] = $subscription->membership_id;
}
}
foreach ($data['memberships'] as $key => $membership) {
$data['memberships'][$key]->_move_from = $move_from_ids;
}
} else {
foreach ($data['memberships'] as $key => $membership) {
$move_from_ids = $member->cancel_ids_on_subscription($membership->id);
$data['memberships'][$key]->_move_from = $move_from_ids;
}
}
$data['action'] = MS_Helper_Membership::MEMBERSHIP_ACTION_SIGNUP;
$data['step'] = MS_Controller_Frontend::STEP_PAYMENT_TABLE;
$view = MS_Factory::create('MS_View_Shortcode_MembershipSignup');
$view->data = apply_filters('ms_view_shortcode_membershipsignup_data', $data, $this);
return $view->to_html();
}
开发者ID:EdoMagen,项目名称:project-s-v2,代码行数:55,代码来源:class-ms-controller-shortcode.php
示例11: init
/**
* Initializes the Add-on. Always executed.
*
* @since 1.0.1.0
*/
public function init()
{
MS_Model_Addon::disable(self::ID);
}
开发者ID:EdoMagen,项目名称:project-s-v2,代码行数:9,代码来源:class-ms-addon-searchindex.php
示例12: is_active
/**
* Returns the active flag for a specific rule.
* State depends on Add-on
*
* @since 1.0.0
* @return bool
*/
public static function is_active()
{
return MS_Model_Addon::is_enabled(MS_Model_Addon::ADDON_POST_BY_POST);
}
开发者ID:jsandlin85,项目名称:SkylineSports,代码行数:11,代码来源:class-ms-rule-post-model.php
示例13: is_active
/**
* Returns the active flag for a specific rule.
* State depends on Add-on
*
* @since 1.0.0
* @return bool
*/
public static function is_active()
{
$def = MS_Model_Addon::is_enabled(MS_Model_Addon::ADDON_MEMBERCAPS);
$adv = MS_Model_Addon::is_enabled(MS_Model_Addon::ADDON_MEMBERCAPS_ADV);
return $def && !$adv;
}
开发者ID:klgrimley,项目名称:mzf,代码行数:13,代码来源:class-ms-rule-memberroles-model.php
示例14: has_access
/**
* Verify access to the current content.
*
* @since 1.0.0
*
* @param string $id The content id to verify access.
* @return bool|null True if has access, false otherwise.
* Null means: Rule not relevant for current page.
*/
public function has_access($id, $admin_has_access = true)
{
$has_access = null;
// Only verify permission if ruled by cpt post by post.
if (MS_Model_Addon::is_enabled(MS_Model_Addon::ADDON_CPT_POST_BY_POST)) {
if (empty($id)) {
$id = $this->get_current_post_id();
}
if (!empty($id)) {
$post_type = get_post_type($id);
$mspt = MS_Rule_CptGroup_Model::get_ms_post_types();
$cpt = MS_Rule_CptGroup_Model::get_custom_post_types();
if (in_array($post_type, $mspt)) {
// Always allow access to Membership2 pages.
$has_access = true;
} elseif (in_array($post_type, $cpt)) {
// Custom post type
$has_access = parent::has_access($id, $admin_has_access);
} else {
// WordPress core pages are ignored by this rule.
$has_access = null;
}
}
}
return apply_filters('ms_rule_custom_post_type_has_access', $has_access, $id, $this);
}
开发者ID:jsandlin85,项目名称:SkylineSports,代码行数:35,代码来源:class-ms-rule-cptitem-model.php
示例15: can_access_file
/**
* Checks if the current user can access the specified attachment.
*
* @since 1.0.0
* @param int $attachment_id
* @return bool
*/
public function can_access_file($attachment_id)
{
$access = false;
if (MS_Model_Member::is_normal_admin()) {
return true;
}
if (!MS_Model_Addon::is_enabled(MS_Addon_Mediafiles::ID)) {
/*
* Default protection mode:
* Protect Attachments based on the parent post.
*/
$parent_id = get_post_field('post_parent', $attachment_id);
if (!$parent_id) {
$access = true;
} else {
$member = MS_Model_Member::get_current_member();
foreach ($member->subscriptions as $subscription) {
$membership = $subscription->get_membership();
$access = $membership->has_access_to_post($parent_id);
if ($access) {
break;
}
}
}
} else {
/*
* Advanced protection mode (via Add-on):
* Each Attachment can be protected individually.
*/
$member = MS_Model_Member::get_current_member();
foreach ($member->subscriptions as $subscription) {
$rule = $subscription->get_membership()->get_rule(MS_Rule_Media::RULE_ID);
$access = $rule->has_access($attachment_id);
if ($access) {
break;
}
}
}
return apply_filters('ms_rule_media_can_access_file', $access, $attachment_id);
}
开发者ID:jsandlin85,项目名称:SkylineSports,代码行数:47,代码来源:class-ms-rule-media-model.php
示例16: prepare_fields_edit
/**
* Input fields displayed in the "Edit Member" screen.
*
* @since 1.0.1.0
* @return array
*/
public function prepare_fields_edit()
{
$action_update = MS_Controller_Member::ACTION_UPDATE_MEMBER;
$action_modify = MS_Controller_Member::ACTION_MODIFY_SUBSCRIPTIONS;
$user_id = $this->data['user_id'];
$user = MS_Factory::load('MS_Model_Member', $user_id);
$unused_memberships = array();
$temp_memberships = MS_Model_Membership::get_memberships(array('include_guest' => 0));
foreach ($temp_memberships as $membership) {
$unused_memberships[$membership->id] = $membership;
}
$fields = array();
$fields['editor'] = array('title' => array('type' => MS_Helper_Html::TYPE_HTML_TEXT, 'class' => 'group-title', 'value' => __('Basic Profile details', MS_TEXT_DOMAIN)), 'username' => array('id' => 'username', 'type' => MS_Helper_Html::INPUT_TYPE_TEXT, 'title' => __('Username', MS_TEXT_DOMAIN), 'value' => $user->username, 'class' => 'ms-text-medium', 'config' => array('disabled' => 'disabled')), 'email' => array('id' => 'email', 'type' => MS_Helper_Html::INPUT_TYPE_TEXT, 'title' => __('Email', MS_TEXT_DOMAIN), 'value' => $user->email, 'class' => 'ms-text-medium'), 'first_name' => array('id' => 'first_name', 'type' => MS_Helper_Html::INPUT_TYPE_TEXT, 'title' => __('First Name', MS_TEXT_DOMAIN), 'value' => $user->first_name, 'class' => 'ms-text-medium'), 'last_name' => array('id' => 'last_name', 'type' => MS_Helper_Html::INPUT_TYPE_TEXT, 'title' => __('Last Name', MS_TEXT_DOMAIN), 'value' => $user->last_name, 'class' => 'ms-text-medium'), 'displayname' => array('id' => 'displayname', 'type' => MS_Helper_Html::INPUT_TYPE_TEXT, 'title' => __('Display Name', MS_TEXT_DOMAIN), 'value' => $user->get_user()->display_name, 'class' => 'ms-text-medium'), 'sep' => array('type' => MS_Helper_Html::TYPE_HTML_SEPARATOR), 'user_id' => array('id' => 'user_id', 'type' => MS_Helper_Html::INPUT_TYPE_HIDDEN, 'value' => $user->id), 'button' => array('id' => 'btn_save', 'type' => MS_Helper_Html::INPUT_TYPE_SUBMIT, 'value' => __('Save', MS_TEXT_DOMAIN)), 'profile' => array('id' => 'user_profile', 'type' => MS_Helper_Html::TYPE_HTML_LINK, 'value' => __('Full User Profile', MS_TEXT_DOMAIN) . ' »', 'url' => admin_url('user-edit.php?user_id=' . $user->id), 'class' => 'button wpmui-field-input'), 'action' => array('id' => 'action', 'type' => MS_Helper_Html::INPUT_TYPE_HIDDEN, 'value' => $action_update), '_wpnonce' => array('id' => '_wpnonce', 'type' => MS_Helper_Html::INPUT_TYPE_HIDDEN, 'value' => wp_create_nonce($action_update)));
$fields['subscriptions'] = array();
// Section: Edit existing subscriptions.
$fields['subscriptions'][] = array('type' => MS_Helper_Html::TYPE_HTML_TEXT, 'class' => 'group-title', 'value' => __('Manage Subscriptions', MS_TEXT_DOMAIN));
if ($user->subscriptions) {
$gateways = MS_Model_Gateway::get_gateway_names(false, true);
foreach ($user->subscriptions as $subscription) {
if (MS_Model_Relationship::STATUS_DEACTIVATED == $subscription->status) {
continue;
}
$the_membership = $subscription->get_membership();
unset($unused_memberships[$the_membership->id]);
$status_options = array(MS_Model_Relationship::STATUS_PENDING => __('Pending (activate on next payment)', MS_TEXT_DOMAIN), MS_Model_Relationship::STATUS_WAITING => __('Waiting (activate on start date)', MS_TEXT_DOMAIN), MS_Model_Relationship::STATUS_TRIAL => __('Trial Active', MS_TEXT_DOMAIN), MS_Model_Relationship::STATUS_ACTIVE => __('Active', MS_TEXT_DOMAIN), MS_Model_Relationship::STATUS_CANCELED => __('Cancelled (deactivate on expire date)', MS_TEXT_DOMAIN), MS_Model_Relationship::STATUS_TRIAL_EXPIRED => __('Trial Expired (activate on next payment)', MS_TEXT_DOMAIN), MS_Model_Relationship::STATUS_EXPIRED => __('Expired (no access) ', MS_TEXT_DOMAIN), MS_Model_Relationship::STATUS_DEACTIVATED => __('Deactivated (no access)', MS_TEXT_DOMAIN));
if (!$the_membership->has_trial()) {
unset($status_options[MS_Model_Relationship::STATUS_TRIAL]);
unset($status_options[MS_Model_Relationship::STATUS_TRIAL_EXPIRED]);
}
if (isset($gateways[$subscription->gateway_id])) {
$gateway_name = $gateways[$subscription->gateway_id];
} elseif (empty($subscription->gateway_id)) {
$gateway_name = __('- No Gateway -', MS_TEXT_DOMAIN);
} else {
$gateway_name = '(' . $subscription->gateway_id . ')';
}
$field_start = array('name' => 'mem_' . $the_membership->id . '[start]', 'type' => MS_Helper_Html::INPUT_TYPE_DATEPICKER, 'value' => $subscription->start_date);
$field_expire = array('name' => 'mem_' . $the_membership->id . '[expire]', 'type' => MS_Helper_Html::INPUT_TYPE_DATEPICKER, 'value' => $subscription->expire_date);
$field_status = array('name' => 'mem_' . $the_membership->id . '[status]', 'type' => MS_Helper_Html::INPUT_TYPE_SELECT, 'value' => $subscription->status, 'field_options' => $status_options);
$fields['subscriptions'][] = array('name' => 'memberships[]', 'type' => MS_Helper_Html::INPUT_TYPE_HIDDEN, 'value' => $the_membership->id);
$fields['subscriptions'][] = array('title' => $the_membership->get_name_tag(), 'type' => MS_Helper_Html::TYPE_HTML_TABLE, 'value' => array(array(__('Subscription ID', MS_TEXT_DOMAIN), $subscription->id), array(__('Payment Gateway', MS_TEXT_DOMAIN), $gateway_name), array(__('Payment Type', MS_TEXT_DOMAIN), $subscription->get_payment_description(null, true)), array(__('Start Date', MS_TEXT_DOMAIN) . ' <sup>*)</sup>', MS_Helper_Html::html_element($field_start, true)), array(__('Expire Date', MS_TEXT_DOMAIN) . ' <sup>*)</sup>', MS_Helper_Html::html_element($field_expire, true)), array(__('Status', MS_TEXT_DOMAIN) . ' <sup>*)</sup>', MS_Helper_Html::html_element($field_status, true))), 'field_options' => array('head_col' => true));
}
} else {
$fields['subscriptions'][] = array('type' => MS_Helper_Html::TYPE_HTML_TEXT, 'value' => __('This user does not have any subscriptions yet.', MS_TEXT_DOMAIN));
}
// Section: Add new subscription.
if (count($unused_memberships)) {
$options = array();
if (MS_Model_Addon::is_enabled(MS_Model_Addon::ADDON_MULTI_MEMBERSHIPS)) {
$field_type = MS_Helper_Html::INPUT_TYPE_CHECKBOX;
$group_title = __('Add Subscriptions', MS_TEXT_DOMAIN);
} else {
$field_type = MS_Helper_Html::INPUT_TYPE_RADIO;
$group_title = __('Set Subscription', MS_TEXT_DOMAIN);
}
$fields['subscriptions'][] = array('type' => MS_Helper_Html::TYPE_HTML_SEPARATOR);
$fields['subscriptions'][] = array('type' => MS_Helper_Html::TYPE_HTML_TEXT, 'class' => 'group-title', 'value' => $group_title);
foreach ($unused_memberships as $the_membership) {
$options[$the_membership->id] = $the_membership->get_name_tag();
}
$fields['subscriptions'][] = array('id' => 'subscribe', 'type' => $field_type, 'field_options' => $options);
$fields['subscriptions'][] = array('id' => 'user_id', 'type' => MS_Helper_Html::INPUT_TYPE_HIDDEN, 'value' => $user->id);
}
if ($user->subscriptions) {
$fields['subscriptions'][] = array('type' => MS_Helper_Html::TYPE_HTML_SEPARATOR);
$fields['subscriptions'][] = array('type' => MS_Helper_Html::TYPE_HTML_TEXT, 'value' => '<sup>*)</sup> ' . __('Subscription Dates and Status are validated when saved and might result in a different value then the one specified above.', MS_TEXT_DOMAIN), 'class' => 'info-field');
}
$fields['subscriptions'][] = array('id' => 'btn_modify', 'type' => MS_Helper_Html::INPUT_TYPE_SUBMIT, 'value' => __('Save Changes', MS_TEXT_DOMAIN));
$fields['subscriptions'][] = array('id' => 'history', 'type' => MS_Helper_Html::TYPE_HTML_LINK, 'value' => '<i class="dashicons dashicons-id"></i>' . __('History and logs', MS_TEXT_DOMAIN), 'url' => '#history', 'class' => 'button wpmui-field-input', 'config' => array('data-ms-dialog' => 'View_Member_Dialog', 'data-ms-data' => array('member_id' => $user->id)));
$fields['subscriptions'][] = array('id' => 'action', 'type' => MS_Helper_Html::INPUT_TYPE_HIDDEN, 'value' => $action_modify);
$fields['subscriptions'][] = array('id' => '_wpnonce', 'type' => MS_Helper_Html::INPUT_TYPE_HIDDEN, 'value' => wp_create_nonce($action_modify));
return apply_filters('ms_view_member_editor_fields_edit', $fields);
}
开发者ID:jsandlin85,项目名称:SkylineSports,代码行数:79,代码来源:class-ms-view-member-editor.php
示例17: has_rule_for_post
/**
* Verify if a post/custom post type has protection rules.
*
* @since 1.0.0
*
* @return boolean True if has access, false otherwise.
*/
public function has_rule_for_post($post_id)
{
$has_rules = false;
if (MS_Model_Addon::is_enabled(MS_Model_Addon::ADDON_URL_GROUPS)) {
$url = get_permalink($post_id);
if ($this->check_url_expression_match($url, $this->get_protected_urls())) {
$has_rules = true;
}
}
return apply_filters('ms_rule_url_model_has_rule_for_post', $has_rules, $this);
}
开发者ID:klgrimley,项目名称:mzf,代码行数:18,代码来源:class-ms-rule-url-model.php
示例18: load_core_addons
/**
* Checks the /app/addon directory for a list of all addons and loads these
* files.
*
* @since 1.0.0
*/
protected static function load_core_addons()
{
$model = MS_Factory::load('MS_Model_Addon');
$root_path = trailingslashit(dirname(dirname(MS_Plugin::instance()->dir)));
$plugin_dir = substr(MS_Plugin::instance()->dir, strlen($root_path));
$addon_dir = $plugin_dir . 'app/addon/';
if (empty($model->addon_files) || self::$_reload_files) {
// In Admin dashboard we always refresh the addon-list...
self::$_reload_files = false;
$mask = $root_path . $addon_dir . '*/class-ms-addon-*.php';
$addons = glob($mask);
$model->addon_files = array();
foreach ($addons as $file) {
$model->addon_files[] = substr($file, strlen($root_path));
}
/**
* Allow other plugins/themes to register custom addons
*
* @since 1.0.0
*
* @var array
*/
$model->addon_files = apply_filters('ms_model_addon_files', $model->addon_files);
$model->save();
}
// Loop all recignized Add-ons and initialize them.
foreach ($model->addon_files as $file) {
$addon = $root_path . $file;
// Get class-name from file-name
$class = basename($file);
$class = str_replace('.php', '', $class);
$class = implode('_', array_map('ucfirst', explode('-', $class)));
$class = substr($class, 6);
// remove 'Class_' prefix
if (file_exists($addon)) {
if (!class_exists($class)) {
try {
include_once $addon;
} catch (Exception $ex) {
}
}
if (class_exists($class)) {
MS_Factory::load($class);
}
}
}
/**
* Allow custom addon-initialization code to run
*
* @since 1.0.0
*/
do_action('ms_model_addon_load');
}
开发者ID:oshabaeva,项目名称:project-s-v2,代码行数:59,代码来源:class-ms-model-addon.php
示例19: is_active
/**
* Returns the active flag for a specific rule.
* State depends on Add-on
*
* @since 1.0.0
* @return bool
*/
public static function is_active()
{
return MS_Model_Addon::is_enabled(MS_Addon_Category::ID);
}
开发者ID:EdoMagen,项目名称:project-s-v2,代码行数:11,代码来源:class-ms-rule-category-model.php
示例20: has_trial
/**
* Returns true if this membership is eligable for trial period.
*
* @since 1.0.1.0
* @return bool
*/
public function has_trial()
{
$result = $this->trial_period_enabled;
if ($result) {
if (!MS_Model_Addon::is_enabled(MS_Model_Addon::ADDON_TRIAL)) {
$result = false;
}
}
return $result;
}
开发者ID:nayabbukhari,项目名称:circulocristiano,代码行数:16,代码来源:class-ms-model-membership.php
注:本文中的MS_Model_Addon类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论