public function prepare_fields()
 {
     $model = MS_Addon_Redirect::model();
     $action = MS_Addon_Redirect::AJAX_SAVE_SETTING;
     $fields = array('redirect_login' => array('id' => 'redirect_login', 'type' => MS_Helper_Html::INPUT_TYPE_TEXT, 'title' => __('After Login', 'membership2'), 'desc' => __('This page is displayed to users right after login.', 'membership2'), 'placeholder' => MS_Model_Pages::get_url_after_login(false), 'value' => $model->get('redirect_login'), 'class' => 'ms-text-large', 'ajax_data' => array('field' => 'redirect_login', 'action' => $action)), 'redirect_logout' => array('id' => 'redirect_logout', 'type' => MS_Helper_Html::INPUT_TYPE_TEXT, 'title' => __('After Logout', 'membership2'), 'desc' => __('This page is displayed to users right after they did log out.', 'membership2'), 'placeholder' => MS_Model_Pages::get_url_after_logout(false), 'value' => $model->get('redirect_logout'), 'class' => 'ms-text-large', 'ajax_data' => array('field' => 'redirect_logout', 'action' => $action)));
     return $fields;
 }
 /**
  * Prepare the PayPal IPN fields
  *
  * Details here:
  * https://developer.paypal.com/docs/classic/paypal-payments-standard/integration-guide/Appx_websitestandard_htmlvariables/
  *
  * @since  1.0.0
  * @return array
  */
 private function prepare_fields()
 {
     $subscription = $this->data['ms_relationship'];
     $membership = $subscription->get_membership();
     if (0 === $membership->price) {
         return;
     }
     $gateway = $this->data['gateway'];
     $invoice = $subscription->get_current_invoice();
     $fields = array('business' => array('id' => 'business', 'type' => MS_Helper_Html::INPUT_TYPE_HIDDEN, 'value' => $gateway->paypal_email), 'cmd' => array('id' => 'cmd', 'type' => MS_Helper_Html::INPUT_TYPE_HIDDEN, 'value' => '_xclick'), 'bn' => array('id' => 'bn', 'type' => MS_Helper_Html::INPUT_TYPE_HIDDEN, 'value' => 'incsub_SP'), 'item_number' => array('id' => 'item_number', 'type' => MS_Helper_Html::INPUT_TYPE_HIDDEN, 'value' => $subscription->membership_id), 'item_name' => array('id' => 'item_name', 'type' => MS_Helper_Html::INPUT_TYPE_HIDDEN, 'value' => $membership->name), 'amount' => array('id' => 'amount', 'type' => MS_Helper_Html::INPUT_TYPE_HIDDEN, 'value' => MS_Helper_Billing::format_price($invoice->total)), 'currency_code' => array('id' => 'currency_code', 'type' => MS_Helper_Html::INPUT_TYPE_HIDDEN, 'value' => $invoice->currency), 'return' => array('id' => 'return', 'type' => MS_Helper_Html::INPUT_TYPE_HIDDEN, 'value' => esc_url_raw(add_query_arg(array('ms_relationship_id' => $subscription->id), MS_Model_Pages::get_page_url(MS_Model_Pages::MS_PAGE_REG_COMPLETE, false)))), 'cancel_return' => array('id' => 'cancel_return', 'type' => MS_Helper_Html::INPUT_TYPE_HIDDEN, 'value' => MS_Model_Pages::get_page_url(MS_Model_Pages::MS_PAGE_REGISTER)), 'notify_url' => array('id' => 'notify_url', 'type' => MS_Helper_Html::INPUT_TYPE_HIDDEN, 'value' => $gateway->get_return_url()), 'lc' => array('id' => 'lc', 'type' => MS_Helper_Html::INPUT_TYPE_HIDDEN, 'value' => $gateway->paypal_site), 'invoice' => array('id' => 'invoice', 'type' => MS_Helper_Html::INPUT_TYPE_HIDDEN, 'value' => $invoice->id));
     // Don't send to paypal if free
     if (0 === $invoice->total) {
         $fields = array('gateway' => array('id' => 'gateway', 'type' => MS_Helper_Html::INPUT_TYPE_HIDDEN, 'value' => $gateway->id), 'ms_relationship_id' => array('id' => 'ms_relationship_id', 'type' => MS_Helper_Html::INPUT_TYPE_HIDDEN, 'value' => $subscription->id), 'step' => array('id' => 'step', 'type' => MS_Helper_Html::INPUT_TYPE_HIDDEN, 'value' => MS_Controller_Frontend::STEP_PROCESS_PURCHASE), '_wpnonce' => array('id' => '_wpnonce', 'type' => MS_Helper_Html::INPUT_TYPE_HIDDEN, 'value' => wp_create_nonce($gateway->id . '_' . $subscription->id)));
         $this->data['action_url'] = null;
     } else {
         if ($gateway->is_live_mode()) {
             $this->data['action_url'] = 'https://www.paypal.com/cgi-bin/webscr';
         } else {
             $this->data['action_url'] = 'https://www.sandbox.paypal.com/cgi-bin/webscr';
         }
     }
     $fields['submit'] = array('id' => 'submit', 'type' => MS_Helper_Html::INPUT_TYPE_IMAGE, 'value' => 'https://www.paypalobjects.com/en_US/i/btn/x-click-but06.gif', 'alt' => __('PayPal - The safer, easier way to pay online', MS_TEXT_DOMAIN));
     // custom pay button defined in gateway settings
     $custom_label = $gateway->pay_button_url;
     if (!empty($custom_label)) {
         if (false !== strpos($custom_label, '://')) {
             $fields['submit']['value'] = $custom_label;
         } else {
             $fields['submit'] = array('id' => 'submit', 'type' => MS_Helper_Html::INPUT_TYPE_SUBMIT, 'value' => $custom_label);
         }
     }
     return apply_filters('ms_gateway_paypalsingle_view_prepare_fields', $fields);
 }
 private function prepare_fields()
 {
     $gateway = $this->data['gateway'];
     $subscription = $this->data['ms_relationship'];
     $membership = $subscription->get_membership();
     $invoice = $subscription->get_current_invoice();
     $member = $subscription->get_member();
     $fields = array('sid' => array('type' => MS_Helper_Html::INPUT_TYPE_HIDDEN, 'id' => 'sid', 'value' => $gateway->seller_id), 'mode' => array('type' => MS_Helper_Html::INPUT_TYPE_HIDDEN, 'id' => 'mode', 'value' => '2CO'), 'type' => array('type' => MS_Helper_Html::INPUT_TYPE_HIDDEN, 'id' => 'li_0_type', 'value' => 'product'), 'name' => array('type' => MS_Helper_Html::INPUT_TYPE_HIDDEN, 'id' => 'li_0_name', 'value' => $membership->name), 'price' => array('type' => MS_Helper_Html::INPUT_TYPE_HIDDEN, 'id' => 'li_0_price', 'value' => $invoice->total), 'tangible' => array('type' => MS_Helper_Html::INPUT_TYPE_HIDDEN, 'id' => 'li_0_tangible', 'value' => 'N'), 'skip_landing' => array('type' => MS_Helper_Html::INPUT_TYPE_HIDDEN, 'id' => 'skip_landing', 'value' => '1'), 'user_id' => array('type' => MS_Helper_Html::INPUT_TYPE_HIDDEN, 'id' => 'user_id', 'value' => $member->id), 'email' => array('type' => MS_Helper_Html::INPUT_TYPE_HIDDEN, 'id' => 'email', 'value' => $member->email), 'currency' => array('type' => MS_Helper_Html::INPUT_TYPE_HIDDEN, 'id' => 'currency', 'value' => $invoice->currency), 'merchant_order_id' => array('type' => MS_Helper_Html::INPUT_TYPE_HIDDEN, 'id' => 'merchant_order_id', 'value' => $invoice->id), 'return_url' => array('type' => MS_Helper_Html::INPUT_TYPE_HIDDEN, 'id' => 'x_receipt_link_url', 'value' => esc_url_raw(add_query_arg(array('ms_relationship_id' => $subscription->id), MS_Model_Pages::get_page_url(MS_Model_Pages::MS_PAGE_REG_COMPLETE, false)))));
     if (MS_Model_Membership::PAYMENT_TYPE_RECURRING == $membership->payment_type) {
         #'li_0_reccurance' = '2 days'   // Can use # Week / # Month / # Year
         #'li_0_duration' = 'Forever'    // Same as _recurrence, with additional "Forever" option
     }
     if (false !== strpos($gateway->pay_button_url, '://')) {
         $fields['submit'] = array('id' => 'submit', 'type' => MS_Helper_Html::INPUT_TYPE_IMAGE, 'value' => $gateway->pay_button_url);
     } else {
         $fields['submit'] = array('id' => 'submit', 'type' => MS_Helper_Html::INPUT_TYPE_SUBMIT, 'value' => __('Signup', MS_TEXT_DOMAIN));
         if ($gateway->pay_button_url) {
             $fields['submit']['value'] = $gateway->pay_button_url;
         }
     }
     // Don't send to gateway if free
     if (0 === $invoice->total) {
         $this->data['action_url'] = null;
     } else {
         if ($gateway->is_live_mode()) {
             $this->data['action_url'] = 'https://www.2checkout.com/checkout/purchase';
         } else {
             $this->data['action_url'] = 'https://sandbox.2checkout.com/checkout/purchase';
         }
     }
     return $fields;
 }
    public function to_html()
    {
        $fields = $this->prepare_fields();
        $subscription = $this->data['ms_relationship'];
        $invoice = $subscription->get_current_invoice();
        $gateway = $this->data['gateway'];
        // Force ssl url
        $action_url = MS_Model_Pages::get_page_url(MS_Model_Pages::MS_PAGE_REGISTER, true);
        $action_url = apply_filters('ms_gateway_authorize_view_button_form_action_url', $action_url);
        $row_class = 'gateway_' . $gateway->id;
        if (!$gateway->is_live_mode()) {
            $row_class .= ' sandbox-mode';
        }
        ob_start();
        ?>
		<form action="<?php 
        echo esc_url($action_url);
        ?>
" method="post">
			<?php 
        MS_Helper_Html::html_element($fields['_wpnonce']);
        ?>
			<?php 
        MS_Helper_Html::html_element($fields['gateway']);
        ?>
			<?php 
        MS_Helper_Html::html_element($fields['ms_relationship_id']);
        ?>
			<?php 
        MS_Helper_Html::html_element($fields['step']);
        ?>
			<?php 
        MS_Helper_Html::html_element($fields['submit']);
        ?>
		</form>
		<?php 
        $payment_form = apply_filters('ms_gateway_form', ob_get_clean(), $gateway, $invoice, $this);
        ob_start();
        ?>
		<tr class="<?php 
        echo esc_attr($row_class);
        ?>
">
			<td class="ms-buy-now-column" colspan="2">
				<?php 
        echo $payment_form;
        ?>
			</td>
		</tr>
		<?php 
        $html = ob_get_clean();
        $html = apply_filters('ms_gateway_button-' . $gateway->id, $html, $this);
        $html = apply_filters('ms_gateway_button', $html, $gateway->id, $this);
        return $html;
    }
    public function to_html()
    {
        $fields = $this->prepare_fields();
        $gateway = $this->data['model'];
        ob_start();
        // Render tabbed interface.
        ?>
		<form class="ms-gateway-settings-form ms-form">
			<?php 
        $description = sprintf('%1$s<br />&nbsp;<br />%2$s <strong>%3$s</strong><br />%6$s <strong>%7$s</strong><br /><a href="%4$s" target="_blank">%5$s</a>', __('In order for Membership 2 to function correctly you must setup an INS (Instant Notification Service) URL with 2Checkout. Make sure you add the following URLs to your 2Checkout "Notifications" section as well as the "Approved URL" in the Site Management section. The domain must be the same as the one registered with your Live account for production sites.', 'membership2'), __('Your Global Notifications URL is:', 'membership2'), $this->data['model']->get_return_url(), 'https://www.2checkout.com/documentation/notifications/', __('Instructions &raquo;', 'membership2'), __('Your "Approved URL" is:', 'membership2'), MS_Model_Pages::get_page_url(MS_Model_Pages::MS_PAGE_REG_COMPLETE));
        MS_Helper_Html::settings_box_header('', $description);
        foreach ($fields as $field) {
            MS_Helper_Html::html_element($field);
        }
        MS_Helper_Html::settings_box_footer();
        ?>
		</form>
		<?php 
        $html = ob_get_clean();
        return $html;
    }
Пример #6
0
 /**
  * Outputs the options form on admin
  *
  * @since  1.0.0
  *
  * @param array $instance The widget options
  */
 public function form($instance)
 {
     $title = __('Login', MS_TEXT_DOMAIN);
     $redirect_login = '';
     $redirect_logout = '';
     $shortcode_args = '';
     if (isset($instance['title'])) {
         $title = $instance['title'];
     }
     if (isset($instance['redirect_login'])) {
         $redirect_login = $instance['redirect_login'];
     }
     if (isset($instance['redirect_logout'])) {
         $redirect_logout = $instance['redirect_logout'];
     }
     if (isset($instance['shortcode_args'])) {
         $shortcode_args = $instance['shortcode_args'];
     }
     $placeholder_login = MS_Model_Pages::get_url_after_login();
     if (strlen($placeholder_login) > 55) {
         $parts = explode('://', $placeholder_login);
         $placeholder_login = $parts[0] . '://' . substr($parts[1], 0, 5) . '&hellip;' . substr($parts[1], -38);
     }
     $placeholder_logout = MS_Model_Pages::get_url_after_logout();
     if (strlen($placeholder_logout) > 55) {
         $parts = explode('://', $placeholder_logout);
         $placeholder_logout = $parts[0] . '://' . substr($parts[1], 0, 5) . '&hellip;' . substr($parts[1], -38);
     }
     $field_title = array('id' => $this->get_field_id('title'), 'name' => $this->get_field_name('title'), 'type' => MS_Helper_Html::INPUT_TYPE_TEXT, 'title' => __('Title:', MS_TEXT_DOMAIN), 'value' => $title, 'class' => 'widefat');
     $field_redirect_login = array('id' => $this->get_field_id('redirect_login'), 'name' => $this->get_field_name('redirect_login'), 'type' => MS_Helper_Html::INPUT_TYPE_TEXT, 'title' => __('Show this page after login:'******'value' => $redirect_login, 'placeholder' => $placeholder_login, 'class' => 'widefat');
     $field_redirect_logout = array('id' => $this->get_field_id('redirect_logout'), 'name' => $this->get_field_name('redirect_logout'), 'type' => MS_Helper_Html::INPUT_TYPE_TEXT, 'title' => __('Show this page after logout:', MS_TEXT_DOMAIN), 'value' => $redirect_logout, 'placeholder' => $placeholder_logout, 'class' => 'widefat');
     $field_shortcode_args = array('id' => $this->get_field_id('shortcode_args'), 'name' => $this->get_field_name('shortcode_args'), 'type' => MS_Helper_Html::INPUT_TYPE_TEXT, 'title' => __('Shortcode Options:', MS_TEXT_DOMAIN), 'desc' => sprintf(__('Arguments to pass to the %slogin shortcode%s', MS_TEXT_DOMAIN), sprintf('<a href="%s#ms-membership-login" target="_blank">', MS_Controller_Plugin::get_admin_url('help', array('tab' => 'shortcodes'))), '</a>'), 'value' => $shortcode_args, 'placeholder' => 'header="no"', 'class' => 'widefat');
     MS_Helper_Html::html_element($field_title);
     MS_Helper_Html::html_element($field_redirect_login);
     MS_Helper_Html::html_element($field_redirect_logout);
     MS_Helper_Html::html_element($field_shortcode_args);
 }
 /**
  * Use a special template for our membership pages.
  *
  * Recognized templates are:
  *     m2-memberships.php
  *     m2-protected-content.php
  *     m2-account.php
  *     m2-register.php
  *     m2-registration-complete.php
  *
  * Note that certain pages receive a membership-ID when they are loaded
  * (like the m2-registration-complete or m2-register pages).
  * You can even specify special pages for each membership.
  *
  * Example:
  *     m2-register-100.php (register form for membership 100)
  *     m2-registration-complete-100.php (thank you page for membership 100)
  *
  * @since  1.0.1.0
  * @see filter page_template
  *
  * @param string $template The default template path to filter.
  * @return string The custom template path.
  */
 public function custom_page_template($default_template)
 {
     $template = '';
     // Checks for invoice single template.
     if ($type = MS_Model_Pages::is_membership_page()) {
         $membership_id = apply_filters('ms_detect_membership_id', 0, true, true);
         if ($membership_id) {
             $template = get_query_template('m2', 'm2-' . $type . '-' . $membership_id . '.php');
         }
         if (!$template) {
             $template = get_query_template('m2', 'm2-' . $type . '.php');
         }
     }
     if (!$template) {
         $template = $default_template;
     }
     return $template;
 }
 /**
  * Checks, if some BuddyPress pages overlap with M2 membership pages.
  *
  * In some cases people used the same page-ID for both BuddyPress
  * registration and M2 registration. This will cause problems and must be
  * resolved to have M2 and BuddyPress work symbiotically.
  *
  * @since  1.0.1.1
  */
 protected function collission_check()
 {
     $buddy_pages = MS_Factory::get_option('bp-pages');
     if (!is_array($buddy_pages)) {
         // Okay, no BuddyPress pages set up yet.
         return;
     }
     $duplicates = array();
     foreach ($buddy_pages as $type => $page_id) {
         $collission = MS_Model_Pages::get_page_by('id', $page_id);
         if ($collission) {
             $title = $collission->post_title;
             if (!$title) {
                 $title = $collission->post_name;
             }
             $duplicates[] = sprintf('%s - %s', $page_id, $title);
         }
     }
     if (count($duplicates)) {
         $msg = sprintf('%s<br><br>%s', sprintf(__('BuddyPress uses a page that is also used as a Membership page by Membership 2.<br>Please assign a different page for either %sMembership 2%s or %sBuddyPress%s to avoid conflicts.', 'membership2'), '<a href="' . MS_Controller_Plugin::get_admin_url('settings') . '">', '</a>', '<a href="' . admin_url('admin.php?page=bp-page-settings') . '">', '</a>'), implode('<br>', $duplicates));
         lib3()->ui->admin_message($msg, 'error');
     }
 }
    /**
     * Renders the Shortcode help contents
     *
     * @since  1.0.0
     * @return string
     */
    public function render_tab_shortcodes()
    {
        ob_start();
        ?>

		<?php 
        /*********
         **********   ms-protect-content   **************************************
         *********/
        ?>
		<h2><?php 
        _ex('Common shortcodes', 'help', MS_TEXT_DOMAIN);
        ?>
</h2>

		<div id="ms-protect-content" class="ms-help-box">
			<h3><code>[ms-protect-content]</code></h3>

			<?php 
        _ex('Wrap this around any content to protect it for/from certain members (based on their Membership level)', 'help', MS_TEXT_DOMAIN);
        ?>
			<div class="ms-help-toggle"><?php 
        _ex('Expand', 'help', MS_TEXT_DOMAIN);
        ?>
</div>
			<div class="ms-help-details" style="display:none">
				<ul>
					<li>
						<code>id</code>
						<?php 
        _ex('(ID list)', 'help', MS_TEXT_DOMAIN);
        ?>
						<strong><?php 
        _ex('Required', 'help', MS_TEXT_DOMAIN);
        ?>
</strong>.
						<?php 
        _ex('One or more membership IDs. Shortcode is triggered when the user belongs to at least one of these memberships', 'help', MS_TEXT_DOMAIN);
        ?>
					</li>
					<li>
						<code>access</code>
						<?php 
        _ex('(yes|no)', 'help', MS_TEXT_DOMAIN);
        ?>
						<?php 
        _ex('Defines if members of the memberships can see or not see the content', 'help', MS_TEXT_DOMAIN);
        ?>
						<span class="ms-help-default">
							<?php 
        _ex('Default:', 'help', MS_TEXT_DOMAIN);
        ?>
							yes
						</span>
					</li>
					<li>
						<code>silent</code>
						<?php 
        _ex('(yes|no)', 'help', MS_TEXT_DOMAIN);
        ?>
						<?php 
        _ex('Silent protection removes content without displaying any message to the user', 'help', MS_TEXT_DOMAIN);
        ?>
						<span class="ms-help-default">
							<?php 
        _ex('Default:', 'help', MS_TEXT_DOMAIN);
        ?>
							no
						</span>
					</li>
					<li>
						<code>msg</code>
						<?php 
        _ex('(Text)', 'help', MS_TEXT_DOMAIN);
        ?>
						<?php 
        _ex('Provide a custom protection message. <em>This will only be displayed when silent is not true</em>', 'help', MS_TEXT_DOMAIN);
        ?>
						<span class="ms-help-default">
							<?php 
        _ex('Default:', 'help', MS_TEXT_DOMAIN);
        ?>
							""
						</span>
					</li>
				</ul>

				<p><em><?php 
        _ex('Example:', 'help', MS_TEXT_DOMAIN);
        ?>
</em></p>
				<p>
					<code>[ms-protect-content id="1"]</code>
					<?php 
        _ex('Only members of membership-1 can see this!', 'help', MS_TEXT_DOMAIN);
        ?>
					<code>[/ms-protect-content]</code>
				</p>
				<p>
					<code>[ms-protect-content id="2,3" access="no" silent="yes"]</code>
					<?php 
        _ex('Everybody except members of memberships 2 or 3 can see this!', 'help', MS_TEXT_DOMAIN);
        ?>
					<code>[/ms-protect-content]</code>
				</p>
			</div>
		</div>


		<?php 
        /*********
         **********   ms-user   *************************************************
         *********/
        ?>

		<div id="ms-user" class="ms-help-box">
			<h3><code>[ms-user]</code></h3>

			<?php 
        _ex('Shows the content only to certain users (ignoring the Membership level)', 'help', MS_TEXT_DOMAIN);
        ?>
			<div class="ms-help-toggle"><?php 
        _ex('Expand', 'help', MS_TEXT_DOMAIN);
        ?>
</div>
			<div class="ms-help-details" style="display:none">
				<ul>
					<li>
						<code>type</code>
						<?php 
        _ex('(all|loggedin|guest|admin)', 'help', MS_TEXT_DOMAIN);
        ?>
						<?php 
        _ex('Decide, which type of users will see the message', 'help', MS_TEXT_DOMAIN);
        ?>
						<span class="ms-help-default">
							<?php 
        _ex('Default:', 'help', MS_TEXT_DOMAIN);
        ?>
							"loggedin"
						</span>
					</li>
					<li>
						<code>msg</code>
						<?php 
        _ex('(Text)', 'help', MS_TEXT_DOMAIN);
        ?>
						<?php 
        _ex('Provide a custom protection message that is displayed to users that have no access to the content', 'help', MS_TEXT_DOMAIN);
        ?>
						<span class="ms-help-default">
							<?php 
        _ex('Default:', 'help', MS_TEXT_DOMAIN);
        ?>
							""
						</span>
					</li>
				</ul>

				<p><em><?php 
        _ex('Example:', 'help', MS_TEXT_DOMAIN);
        ?>
</em></p>
				<p>
					<code>[ms-user]</code>
					<?php 
        _ex('You are logged in', 'help', MS_TEXT_DOMAIN);
        ?>
					<code>[/ms-user]</code>
				</p>
				<p>
					<code>[ms-user type="guest"]</code>
					<?php 
        printf(htmlspecialchars(_x('<a href="">Sign up now</a>! <a href="">Already have an account</a>?', 'help', MS_TEXT_DOMAIN)));
        ?>
					<code>[/ms-user]</code>
				</p>
			</div>
		</div>


		<?php 
        /*********
         **********   ms-membership-register-user   *****************************
         *********/
        ?>

		<div id="ms-membership-register-user" class="ms-help-box">
			<h3><code>[ms-membership-register-user]</code></h3>

			<?php 
        _ex('Displays a registration form. Visitors can create a WordPress user account with this form', 'help', MS_TEXT_DOMAIN);
        ?>
			<div class="ms-help-toggle"><?php 
        _ex('Expand', 'help', MS_TEXT_DOMAIN);
        ?>
</div>
			<div class="ms-help-details" style="display:none">
				<ul>
					<li>
						<code>title</code>
						<?php 
        _ex('(Text)', 'help', MS_TEXT_DOMAIN);
        ?>
						<?php 
        _ex('Title of the register form', 'help', MS_TEXT_DOMAIN);
        ?>
						<span class="ms-help-default">
							<?php 
        _ex('Default:', 'help', MS_TEXT_DOMAIN);
        ?>
							"<?php 
        _e('Create an Account', MS_TEXT_DOMAIN);
        ?>
"
						</span>
					</li>
					<li>
						<code>first_name</code>
						<?php 
        _ex('(Text)', 'help', MS_TEXT_DOMAIN);
        ?>
						<?php 
        _ex('Initial value for first name', 'help', MS_TEXT_DOMAIN);
        ?>
						<span class="ms-help-default">
							<?php 
        _ex('Default:', 'help', MS_TEXT_DOMAIN);
        ?>
							""
						</span>
					</li>
					<li>
						<code>last_name</code>
						<?php 
        _ex('(Text)', 'help', MS_TEXT_DOMAIN);
        ?>
						<?php 
        _ex('Initial value for last name', 'help', MS_TEXT_DOMAIN);
        ?>
						<span class="ms-help-default">
							<?php 
        _ex('Default:', 'help', MS_TEXT_DOMAIN);
        ?>
							""
						</span>
					</li>
					<li>
						<code>username</code>
						<?php 
        _ex('(Text)', 'help', MS_TEXT_DOMAIN);
        ?>
						<?php 
        _ex('Initial value for username', 'help', MS_TEXT_DOMAIN);
        ?>
						<span class="ms-help-default">
							<?php 
        _ex('Default:', 'help', MS_TEXT_DOMAIN);
        ?>
							""
						</span>
					</li>
					<li>
						<code>email</code>
						<?php 
        _ex('(Text)', 'help', MS_TEXT_DOMAIN);
        ?>
						<?php 
        _ex('Initial value for email address', 'help', MS_TEXT_DOMAIN);
        ?>
						<span class="ms-help-default">
							<?php 
        _ex('Default:', 'help', MS_TEXT_DOMAIN);
        ?>
							""
						</span>
					</li>
					<li>
						<code>membership_id</code>
						<?php 
        _ex('(Text)', 'help', MS_TEXT_DOMAIN);
        ?>
						<?php 
        _ex('Membership ID to assign to the new user. This field is hidden and cannot be changed during registration. <em>Note: If this membership requires payment, the user will be redirected to the payment gateway after registration</em>', 'help', MS_TEXT_DOMAIN);
        ?>
						<span class="ms-help-default">
							<?php 
        _ex('Default:', 'help', MS_TEXT_DOMAIN);
        ?>
							""
						</span>
					</li>
					<li>
						<code>loginlink</code>
						<?php 
        _ex('(yes|no)', 'help', MS_TEXT_DOMAIN);
        ?>
						<?php 
        _ex('Display a login-link below the form', 'help', MS_TEXT_DOMAIN);
        ?>
						<span class="ms-help-default">
							<?php 
        _ex('Default:', 'help', MS_TEXT_DOMAIN);
        ?>
							"yes"
						</span>
					</li>
				</ul>

				<h4><?php 
        _e('Field labels', MS_TEXT_DOMAIN);
        ?>
</h4>
				<ul>
					<li>
						<code>label_first_name</code>
						<?php 
        _ex('(Text)', 'help', MS_TEXT_DOMAIN);
        ?>
						<span class="ms-help-default">
							"<?php 
        _e('First Name', MS_TEXT_DOMAIN);
        ?>
"
						</span>
					</li>
					<li>
						<code>label_last_name</code>
						<?php 
        _ex('(Text)', 'help', MS_TEXT_DOMAIN);
        ?>
						<span class="ms-help-default">
							"<?php 
        _e('Last Name', MS_TEXT_DOMAIN);
        ?>
"
						</span>
					</li>
					<li>
						<code>label_username</code>
						<?php 
        _ex('(Text)', 'help', MS_TEXT_DOMAIN);
        ?>
						<span class="ms-help-default">
							"<?php 
        _e('Choose a Username', MS_TEXT_DOMAIN);
        ?>
"
						</span>
					</li>
					<li>
						<code>label_email</code>
						<?php 
        _ex('(Text)', 'help', MS_TEXT_DOMAIN);
        ?>
						<span class="ms-help-default">
							"<?php 
        _e('Email Address', MS_TEXT_DOMAIN);
        ?>
"
						</span>
					</li>
					<li>
						<code>label_password</code>
						<?php 
        _ex('(Text)', 'help', MS_TEXT_DOMAIN);
        ?>
						<span class="ms-help-default">
							"<?php 
        _e('Password', MS_TEXT_DOMAIN);
        ?>
"
						</span>
					</li>
					<li>
						<code>label_password2</code>
						<?php 
        _ex('(Text)', 'help', MS_TEXT_DOMAIN);
        ?>
						<span class="ms-help-default">
							"<?php 
        _e('Confirm Password', MS_TEXT_DOMAIN);
        ?>
"
						</span>
					</li>
					<li>
						<code>label_register</code>
						<?php 
        _ex('(Text)', 'help', MS_TEXT_DOMAIN);
        ?>
						<span class="ms-help-default">
							"<?php 
        _e('Register My Account', MS_TEXT_DOMAIN);
        ?>
"
						</span>
					</li>
					<li>
						<code>hint_first_name</code>
						<?php 
        _ex('(Text)', 'help', MS_TEXT_DOMAIN);
        ?>
						<?php 
        _ex('Placeholder inside Field', 'help', MS_TEXT_DOMAIN);
        ?>
						<span class="ms-help-default">
							""
						</span>
					</li>
					<li>
						<code>hint_last_name</code>
						<?php 
        _ex('(Text)', 'help', MS_TEXT_DOMAIN);
        ?>
						<?php 
        _ex('Placeholder inside Field', 'help', MS_TEXT_DOMAIN);
        ?>
						<span class="ms-help-default">
							""
						</span>
					</li>
					<li>
						<code>hint_username</code>
						<?php 
        _ex('(Text)', 'help', MS_TEXT_DOMAIN);
        ?>
						<?php 
        _ex('Placeholder inside Field', 'help', MS_TEXT_DOMAIN);
        ?>
						<span class="ms-help-default">
							""
						</span>
					</li>
					<li>
						<code>hint_email</code>
						<?php 
        _ex('(Text)', 'help', MS_TEXT_DOMAIN);
        ?>
						<?php 
        _ex('Placeholder inside Field', 'help', MS_TEXT_DOMAIN);
        ?>
						<span class="ms-help-default">
							""
						</span>
					</li>
					<li>
						<code>hint_password</code>
						<?php 
        _ex('(Text)', 'help', MS_TEXT_DOMAIN);
        ?>
						<?php 
        _ex('Placeholder inside Field', 'help', MS_TEXT_DOMAIN);
        ?>
						<span class="ms-help-default">
							""
						</span>
					</li>
					<li>
						<code>hint_password2</code>
						<?php 
        _ex('(Text)', 'help', MS_TEXT_DOMAIN);
        ?>
						<?php 
        _ex('Placeholder inside Field', 'help', MS_TEXT_DOMAIN);
        ?>
						<span class="ms-help-default">
							""
						</span>
				</ul>

				<p><em><?php 
        _ex('Example:', 'help', MS_TEXT_DOMAIN);
        ?>
</em></p>
				<p><code>[ms-membership-register-user]</code></p>
				<p><code>[ms-membership-register-user title="" hint_email="*****@*****.**" label_password2="Repeat"]</code></p>
			</div>
		</div>


		<?php 
        /*********
         **********   ms-membership-signup   ************************************
         *********/
        ?>

		<div id="ms-membership-signup" class="ms-help-box">
			<h3><code>[ms-membership-signup]</code></h3>

			<?php 
        _ex('Shows a list of all memberships which the current user can sign up for', 'help', MS_TEXT_DOMAIN);
        ?>
			<div class="ms-help-toggle"><?php 
        _ex('Expand', 'help', MS_TEXT_DOMAIN);
        ?>
</div>
			<div class="ms-help-details" style="display:none">
				<h4><?php 
        _ex('Common options', 'help', MS_TEXT_DOMAIN);
        ?>
</h4>
				<ul>
					<li>
						<code><?php 
        echo esc_html(MS_Helper_Membership::MEMBERSHIP_ACTION_SIGNUP);
        ?>
_text</code>
						<?php 
        _ex('(Text)', 'help', MS_TEXT_DOMAIN);
        ?>
						<?php 
        _ex('Button label', 'help', MS_TEXT_DOMAIN);
        ?>
						<span class="ms-help-default">
							<?php 
        _ex('Default:', 'help', MS_TEXT_DOMAIN);
        ?>
							"<?php 
        _e('Signup', MS_TEXT_DOMAIN);
        ?>
"
						</span>
					</li>
					<li>
						<code><?php 
        echo esc_html(MS_Helper_Membership::MEMBERSHIP_ACTION_MOVE);
        ?>
_text</code>
						<?php 
        _ex('(Text)', 'help', MS_TEXT_DOMAIN);
        ?>
						<?php 
        _ex('Button label', 'help', MS_TEXT_DOMAIN);
        ?>
						<span class="ms-help-default">
							<?php 
        _ex('Default:', 'help', MS_TEXT_DOMAIN);
        ?>
							"<?php 
        _e('Change', MS_TEXT_DOMAIN);
        ?>
"
						</span>
					</li>
					<li>
						<code><?php 
        echo esc_html(MS_Helper_Membership::MEMBERSHIP_ACTION_CANCEL);
        ?>
_text</code>
						<?php 
        _ex('(Text)', 'help', MS_TEXT_DOMAIN);
        ?>
						<?php 
        _ex('Button label', 'help', MS_TEXT_DOMAIN);
        ?>
						<span class="ms-help-default">
							<?php 
        _ex('Default:', 'help', MS_TEXT_DOMAIN);
        ?>
							"<?php 
        _e('Cancel', MS_TEXT_DOMAIN);
        ?>
"
						</span>
					</li>
					<li>
						<code><?php 
        echo esc_html(MS_Helper_Membership::MEMBERSHIP_ACTION_RENEW);
        ?>
_text</code>
						<?php 
        _ex('(Text)', 'help', MS_TEXT_DOMAIN);
        ?>
						<?php 
        _ex('Button label', 'help', MS_TEXT_DOMAIN);
        ?>
						<span class="ms-help-default">
							<?php 
        _ex('Default:', 'help', MS_TEXT_DOMAIN);
        ?>
							"<?php 
        _e('Renew', MS_TEXT_DOMAIN);
        ?>
"
						</span>
					</li>
					<li>
						<code><?php 
        echo esc_html(MS_Helper_Membership::MEMBERSHIP_ACTION_PAY);
        ?>
_text</code>
						<?php 
        _ex('(Text)', 'help', MS_TEXT_DOMAIN);
        ?>
						<?php 
        _ex('Button label', 'help', MS_TEXT_DOMAIN);
        ?>
						<span class="ms-help-default">
							<?php 
        _ex('Default:', 'help', MS_TEXT_DOMAIN);
        ?>
							"<?php 
        _e('Complete Payment', MS_TEXT_DOMAIN);
        ?>
"
						</span>
					</li>
				</ul>

				<p><em><?php 
        _ex('Example:', 'help', MS_TEXT_DOMAIN);
        ?>
</em></p>
				<p><code>[ms-membership-signup]</code></p>
			</div>
		</div>



		<?php 
        /*********
         **********   ms-membership-login   *************************************
         *********/
        ?>

		<div id="ms-membership-login" class="ms-help-box">
			<h3><code>[ms-membership-login]</code></h3>

			<?php 
        _ex('Displays the login/lost-password form, or for logged in users a logout link', 'help', MS_TEXT_DOMAIN);
        ?>
			<div class="ms-help-toggle"><?php 
        _ex('Expand', 'help', MS_TEXT_DOMAIN);
        ?>
</div>
			<div class="ms-help-details" style="display:none">
				<h4><?php 
        _ex('Common options', 'help', MS_TEXT_DOMAIN);
        ?>
</h4>
				<ul>
					<li>
						<code>title</code>
						<?php 
        _ex('(Text)', 'help', MS_TEXT_DOMAIN);
        ?>
						<?php 
        _ex('The title above the login form', 'help', MS_TEXT_DOMAIN);
        ?>
						<span class="ms-help-default">
							<?php 
        _ex('Default:', 'help', MS_TEXT_DOMAIN);
        ?>
							""
						</span>
					</li>
					<li>
						<code>show_labels</code>
						<?php 
        _ex('(yes|no)', 'help', MS_TEXT_DOMAIN);
        ?>
						<?php 
        _ex('Set to "yes" to display the labels for username and password in front of the input fields', 'help', MS_TEXT_DOMAIN);
        ?>
						<span class="ms-help-default">
							<?php 
        _ex('Default:', 'help', MS_TEXT_DOMAIN);
        ?>
							no
						</span>
					</li>
					<li>
						<code>redirect_login</code>
						<?php 
        _ex('(URL)', 'help', MS_TEXT_DOMAIN);
        ?>
						<?php 
        _ex('The page to display after the user was logged in', 'help', MS_TEXT_DOMAIN);
        ?>
						<span class="ms-help-default">
							<?php 
        _ex('Default:', 'help', MS_TEXT_DOMAIN);
        ?>
							"<?php 
        echo MS_Model_Pages::get_url_after_login();
        ?>
"
						</span>
					</li>
					<li>
						<code>redirect_logout</code>
						<?php 
        _ex('(URL)', 'help', MS_TEXT_DOMAIN);
        ?>
						<?php 
        _ex('The page to display after the user was logged out', 'help', MS_TEXT_DOMAIN);
        ?>
						<span class="ms-help-default">
							<?php 
        _ex('Default:', 'help', MS_TEXT_DOMAIN);
        ?>
							"<?php 
        echo MS_Model_Pages::get_url_after_logout();
        ?>
"
						</span>
					</li>
					<li>
						<code>header</code>
						<?php 
        _ex('(yes|no)', 'help', MS_TEXT_DOMAIN);
        ?>
						<span class="ms-help-default">
							<?php 
        _ex('Default:', 'help', MS_TEXT_DOMAIN);
        ?>
							yes
						</span>
					</li>
					<li>
						<code>register</code>
						<?php 
        _ex('(yes|no)', 'help', MS_TEXT_DOMAIN);
        ?>
						<span class="ms-help-default">
							<?php 
        _ex('Default:', 'help', MS_TEXT_DOMAIN);
        ?>
							yes
						</span>
					</li>
					<li>
						<code>autofocus</code>
						<?php 
        _ex('(yes|no)', 'help', MS_TEXT_DOMAIN);
        ?>
						<?php 
        _ex('Focus the login-form on page load', 'help', MS_TEXT_DOMAIN);
        ?>
						<span class="ms-help-default">
							<?php 
        _ex('Default:', 'help', MS_TEXT_DOMAIN);
        ?>
							yes
						</span>
					</li>
				</ul>

				<h4><?php 
        _ex('More options', 'help', MS_TEXT_DOMAIN);
        ?>
</h4>
				<ul>
					<li>
						<code>holder</code>
						<?php 
        _ex('(Text)', 'help', MS_TEXT_DOMAIN);
        ?>
						<span class="ms-help-default">
							<?php 
        _ex('Default:', 'help', MS_TEXT_DOMAIN);
        ?>
							"div"
						</span>
					</li>
					<li>
						<code>holderclass</code>
						<?php 
        _ex('(Text)', 'help', MS_TEXT_DOMAIN);
        ?>
						<span class="ms-help-default">
							<?php 
        _ex('Default:', 'help', MS_TEXT_DOMAIN);
        ?>
							"ms-login-form"
						</span>
					</li>
					<li>
						<code>item</code>
						<?php 
        _ex('(Text)', 'help', MS_TEXT_DOMAIN);
        ?>
						<span class="ms-help-default">
							<?php 
        _ex('Default:', 'help', MS_TEXT_DOMAIN);
        ?>
							""
						</span>
					</li>
					<li>
						<code>itemclass</code>
						<?php 
        _ex('(Text)', 'help', MS_TEXT_DOMAIN);
        ?>
						<span class="ms-help-default">
							<?php 
        _ex('Default:', 'help', MS_TEXT_DOMAIN);
        ?>
							""
						</span>
					</li>
					<li>
						<code>prefix</code>
						<?php 
        _ex('(Text)', 'help', MS_TEXT_DOMAIN);
        ?>
						<span class="ms-help-default">
							<?php 
        _ex('Default:', 'help', MS_TEXT_DOMAIN);
        ?>
							""
						</span>
					</li>
					<li>
						<code>postfix</code>
						<?php 
        _ex('(Text)', 'help', MS_TEXT_DOMAIN);
        ?>
						<span class="ms-help-default">
							<?php 
        _ex('Default:', 'help', MS_TEXT_DOMAIN);
        ?>
							""
						</span>
					</li>
					<li>
						<code>wrapwith</code>
						<?php 
        _ex('(Text)', 'help', MS_TEXT_DOMAIN);
        ?>
						<span class="ms-help-default">
							<?php 
        _ex('Default:', 'help', MS_TEXT_DOMAIN);
        ?>
							""
						</span>
					</li>
					<li>
						<code>wrapwithclass</code>
						<?php 
        _ex('(Text)', 'help', MS_TEXT_DOMAIN);
        ?>
						<span class="ms-help-default">
							<?php 
        _ex('Default:', 'help', MS_TEXT_DOMAIN);
        ?>
							""
						</span>
					</li>
					<li>
						<code>form</code>
						<?php 
        _ex('(login|lost|logout)', 'help', MS_TEXT_DOMAIN);
        ?>
						<?php 
        _ex('Defines which form should be displayed. An empty value allows the plugin to automatically choose between login/logout', 'help', MS_TEXT_DOMAIN);
        ?>
						<span class="ms-help-default">
							<?php 
        _ex('Default:', 'help', MS_TEXT_DOMAIN);
        ?>
							""
						</span>
					</li>
					<li>
						<code>nav_pos</code>
						<?php 
        _ex('(top|bottom)', 'help', MS_TEXT_DOMAIN);
        ?>
						<span class="ms-help-default">
							<?php 
        _ex('Default:', 'help', MS_TEXT_DOMAIN);
        ?>
							"top"
						</span>
					</li>
				</ul>

				<h4><?php 
        printf(__('Options only for <code>%s</code>', MS_TEXT_DOMAIN), 'form="login"');
        ?>
</h4>
				<ul>
					<li>
						<code>show_note</code>
						<?php 
        _ex('(yes|no)', 'help', MS_TEXT_DOMAIN);
        ?>
						<?php 
        _ex('Show a "You are not logged in" note above the login form', 'help', MS_TEXT_DOMAIN);
        ?>
						<span class="ms-help-default">
							<?php 
        _ex('Default:', 'help', MS_TEXT_DOMAIN);
        ?>
							yes
						</span>
					</li>
					<li>
						<code>label_username</code>
						<?php 
        _ex('(Text)', 'help', MS_TEXT_DOMAIN);
        ?>
						<span class="ms-help-default">
							<?php 
        _ex('Default:', 'help', MS_TEXT_DOMAIN);
        ?>
							"<?php 
        _e('Username');
        ?>
"
						</span>
					</li>
					<li>
						<code>label_password</code>
						<?php 
        _ex('(Text)', 'help', MS_TEXT_DOMAIN);
        ?>
						<span class="ms-help-default">
							<?php 
        _ex('Default:', 'help', MS_TEXT_DOMAIN);
        ?>
							"<?php 
        _e('Password');
        ?>
"
						</span>
					</li>
					<li>
						<code>label_remember</code>
						<?php 
        _ex('(Text)', 'help', MS_TEXT_DOMAIN);
        ?>
						<span class="ms-help-default">
							<?php 
        _ex('Default:', 'help', MS_TEXT_DOMAIN);
        ?>
							"<?php 
        _e('Remember Me');
        ?>
"
						</span>
					</li>
					<li>
						<code>label_log_in</code>
						<?php 
        _ex('(Text)', 'help', MS_TEXT_DOMAIN);
        ?>
						<span class="ms-help-default">
							<?php 
        _ex('Default:', 'help', MS_TEXT_DOMAIN);
        ?>
							"<?php 
        _e('Log In');
        ?>
"
						</span>
					</li>
					<li>
						<code>id_login_form</code>
						<?php 
        _ex('(Text)', 'help', MS_TEXT_DOMAIN);
        ?>
						<span class="ms-help-default">
							<?php 
        _ex('Default:', 'help', MS_TEXT_DOMAIN);
        ?>
							"loginform"
						</span>
					</li>
					<li>
						<code>id_username</code>
						<?php 
        _ex('(Text)', 'help', MS_TEXT_DOMAIN);
        ?>
						<span class="ms-help-default">
							<?php 
        _ex('Default:', 'help', MS_TEXT_DOMAIN);
        ?>
							"user_login"
						</span>
					</li>
					<li>
						<code>id_password</code>
						<?php 
        _ex('(Text)', 'help', MS_TEXT_DOMAIN);
        ?>
						<span class="ms-help-default">
							<?php 
        _ex('Default:', 'help', MS_TEXT_DOMAIN);
        ?>
							"user_pass"
						</span>
					</li>
					<li>
						<code>id_remember</code>
						<?php 
        _ex('(Text)', 'help', MS_TEXT_DOMAIN);
        ?>
						<span class="ms-help-default">
							<?php 
        _ex('Default:', 'help', MS_TEXT_DOMAIN);
        ?>
							"rememberme"
						</span>
					</li>
					<li>
						<code>id_login</code>
						<?php 
        _ex('(Text)', 'help', MS_TEXT_DOMAIN);
        ?>
						<span class="ms-help-default">
							<?php 
        _ex('Default:', 'help', MS_TEXT_DOMAIN);
        ?>
							"wp-submit"
						</span>
					</li>
					<li>
						<code>show_remember</code>
						<?php 
        _ex('(yes|no)', 'help', MS_TEXT_DOMAIN);
        ?>
						<span class="ms-help-default">
							<?php 
        _ex('Default:', 'help', MS_TEXT_DOMAIN);
        ?>
							yes
						</span>
					</li>
					<li>
						<code>value_username</code>
						<?php 
        _ex('(Text)', 'help', MS_TEXT_DOMAIN);
        ?>
						<span class="ms-help-default">
							<?php 
        _ex('Default:', 'help', MS_TEXT_DOMAIN);
        ?>
							""
						</span>
					</li>
					<li>
						<code>value_remember</code>
						<?php 
        _ex('(yes|no)', 'help', MS_TEXT_DOMAIN);
        ?>
						<?php 
        _ex('Set this to "yes" to default the "Remember me" checkbox to checked', 'help', MS_TEXT_DOMAIN);
        ?>
						<span class="ms-help-default">
							<?php 
        _ex('Default:', 'help', MS_TEXT_DOMAIN);
        ?>
							no
						</span>
					</li>
				</ul>

				<h4><?php 
        printf(__('Options only for <code>%s</code>', MS_TEXT_DOMAIN), 'form="lost"');
        ?>
</h4>
				<ul>
					<li>
						<code>label_lost_username</code>
						<?php 
        _ex('(Text)', 'help', MS_TEXT_DOMAIN);
        ?>
						<span class="ms-help-default">
							<?php 
        _ex('Default:', 'help', MS_TEXT_DOMAIN);
        ?>
							"<?php 
        _e('Username or E-mail', MS_TEXT_DOMAIN);
        ?>
"
						</span>
					</li>
					<li>
						<code>label_lostpass</code>
						<?php 
        _ex('(Text)', 'help', MS_TEXT_DOMAIN);
        ?>
						<span class="ms-help-default">
							<?php 
        _ex('Default:', 'help', MS_TEXT_DOMAIN);
        ?>
							"<?php 
        _e('Reset Password', MS_TEXT_DOMAIN);
        ?>
"
						</span>
					</li>
					<li>
						<code>id_lost_form</code>
						<?php 
        _ex('(Text)', 'help', MS_TEXT_DOMAIN);
        ?>
						<span class="ms-help-default">
							<?php 
        _ex('Default:', 'help', MS_TEXT_DOMAIN);
        ?>
							"lostpasswordform"
						</span>
					</li>
					<li>
						<code>id_lost_username</code>
						<?php 
        _ex('(Text)', 'help', MS_TEXT_DOMAIN);
        ?>
						<span class="ms-help-default">
							<?php 
        _ex('Default:', 'help', MS_TEXT_DOMAIN);
        ?>
							"user_login"
						</span>
					</li>
					<li>
						<code>id_lostpass</code>
						<?php 
        _ex('(Text)', 'help', MS_TEXT_DOMAIN);
        ?>
						<span class="ms-help-default">
							<?php 
        _ex('Default:', 'help', MS_TEXT_DOMAIN);
        ?>
							"wp-submit"
						</span>
					</li>
					<li>
						<code>value_username</code>
						<?php 
        _ex('(Text)', 'help', MS_TEXT_DOMAIN);
        ?>
						<span class="ms-help-default">
							<?php 
        _ex('Default:', 'help', MS_TEXT_DOMAIN);
        ?>
							""
						</span>
					</li>
				</ul>

				<p><em><?php 
        _ex('Example:', 'help', MS_TEXT_DOMAIN);
        ?>
</em></p>
				<p><code>[ms-membership-login]</code></p>
				<p>
					<code>[ms-membership-login form="logout"]</code>
					<?php 
        _ex('is identical to', 'help', MS_TEXT_DOMAIN);
        ?>
					<code>[ms-membership-logout]</code>
				</p>
			</div>
		</div>


		<?php 
        /*********
         **********   ms-note   *************************************************
         *********/
        ?>

		<div id="ms-note" class="ms-help-box">
			<h3><code>[ms-note]</code></h3>

			<?php 
        _ex('Displays a info/success message to the user', 'help', MS_TEXT_DOMAIN);
        ?>
			<div class="ms-help-toggle"><?php 
        _ex('Expand', 'help', MS_TEXT_DOMAIN);
        ?>
</div>
			<div class="ms-help-details" style="display:none">
				<ul>
					<li>
						<code>type</code>
						(info|warning)
						<?php 
        _ex('The type of the notice. Info is green and warning red', 'help', MS_TEXT_DOMAIN);
        ?>
						<span class="ms-help-default">
							<?php 
        _ex('Default:', 'help', MS_TEXT_DOMAIN);
        ?>
							"info"
						</span>
					</li>
					<li>
						<code>class</code>
						<?php 
        _ex('(Text)', 'help', MS_TEXT_DOMAIN);
        ?>
						<?php 
        _ex('An additional CSS class that should be added to the notice', 'help', MS_TEXT_DOMAIN);
        ?>
						<span class="ms-help-default">
							<?php 
        _ex('Default:', 'help', MS_TEXT_DOMAIN);
        ?>
							""
						</span>
					</li>
				</ul>

				<p><em><?php 
        _ex('Example:', 'help', MS_TEXT_DOMAIN);
        ?>
</em></p>
				<p>
					<code>[ms-note type="info"]</code>
					<?php 
        _ex('Thanks for joining our Premium Membership!', 'help', MS_TEXT_DOMAIN);
        ?>
					<code>[/ms-note]</code>
				</p>
				<p>
					<code>[ms-note type="warning"]</code>
					<?php 
        _ex('Please log in to access this page!', 'help', MS_TEXT_DOMAIN);
        ?>
					<code>[/ms-note]</code>
				</p>
			</div>
		</div>

		<?php 
        /*********
         **********   ms-member-info   ******************************************
         *********/
        ?>

		<div id="ms-member-info" class="ms-help-box">
			<h3><code>[ms-member-info]</code></h3>

			<?php 
        _ex('Displays details about the current member, like the members first name or a list of memberships he subscribed to', 'help', MS_TEXT_DOMAIN);
        ?>
			<div class="ms-help-toggle"><?php 
        _ex('Expand', 'help', MS_TEXT_DOMAIN);
        ?>
</div>
			<div class="ms-help-details" style="display:none">
				<ul>
					<li>
						<code>value</code>
						(email|firstname|lastname|fullname|memberships|custom)
						<?php 
        _ex('Defines which value to display.<br>A custom field can be set via the API (you find the API docs on the Advanced Settings tab)', 'help', MS_TEXT_DOMAIN);
        ?>
						<span class="ms-help-default">
							<?php 
        _ex('Default:', 'help', MS_TEXT_DOMAIN);
        ?>
							"fullname"
						</span>
					</li>
					<li>
						<code>default</code>
						<?php 
        _ex('(Text)', 'help', MS_TEXT_DOMAIN);
        ?>
						<?php 
        _ex('Default value to display when the defined field is empty', 'help', MS_TEXT_DOMAIN);
        ?>
						<span class="ms-help-default">
							<?php 
        _ex('Default:', 'help', MS_TEXT_DOMAIN);
        ?>
							""
						</span>
					</li>
					<li>
						<code>before</code>
						<?php 
        _ex('(Text)', 'help', MS_TEXT_DOMAIN);
        ?>
						<?php 
        _ex('Display this text before the field value. Only used when the field is not empty', 'help', MS_TEXT_DOMAIN);
        ?>
						<span class="ms-help-default">
							<?php 
        _ex('Default:', 'help', MS_TEXT_DOMAIN);
        ?>
							"&lt;span&gt;"
						</span>
					</li>
					<li>
						<code>after</code>
						<?php 
        _ex('(Text)', 'help', MS_TEXT_DOMAIN);
        ?>
						<?php 
        _ex('Display this text after the field value. Only used when the field is not empty', 'help', MS_TEXT_DOMAIN);
        ?>
						<span class="ms-help-default">
							<?php 
        _ex('Default:', 'help', MS_TEXT_DOMAIN);
        ?>
							"&lt;/span&gt;"
						</span>
					</li>
					<li>
						<code>custom_field</code>
						<?php 
        _ex('(Text)', 'help', MS_TEXT_DOMAIN);
        ?>
						<?php 
        _ex('Only relevant for the value <code>custom</code>. This is the name of the custom field to get', 'help', MS_TEXT_DOMAIN);
        ?>
						<span class="ms-help-default">
							<?php 
        _ex('Default:', 'help', MS_TEXT_DOMAIN);
        ?>
							""
						</span>
					</li>
					<li>
						<code>list_separator</code>
						<?php 
        _ex('(Text)', 'help', MS_TEXT_DOMAIN);
        ?>
						<?php 
        _ex('Used when the field value is a list (i.e. Membership list or contents of a custom field)', 'help', MS_TEXT_DOMAIN);
        ?>
						<span class="ms-help-default">
							<?php 
        _ex('Default:', 'help', MS_TEXT_DOMAIN);
        ?>
							", "
						</span>
					</li>
					<li>
						<code>list_before</code>
						<?php 
        _ex('(Text)', 'help', MS_TEXT_DOMAIN);
        ?>
						<?php 
        _ex('Used when the field value is a list (i.e. Membership list or contents of a custom field)', 'help', MS_TEXT_DOMAIN);
        ?>
						<span class="ms-help-default">
							<?php 
        _ex('Default:', 'help', MS_TEXT_DOMAIN);
        ?>
							""
						</span>
					</li>
					<li>
						<code>list_after</code>
						<?php 
        _ex('(Text)', 'help', MS_TEXT_DOMAIN);
        ?>
						<?php 
        _ex('Used when the field value is a list (i.e. Membership list or contents of a custom field)', 'help', MS_TEXT_DOMAIN);
        ?>
						<span class="ms-help-default">
							<?php 
        _ex('Default:', 'help', MS_TEXT_DOMAIN);
        ?>
							""
						</span>
					</li>
					<li>
						<code>user</code>
						<?php 
        _ex('(User-ID)', 'help', MS_TEXT_DOMAIN);
        ?>
						<?php 
        _ex('Use this to display data of any user. If not specified then the current user is displayed', 'help', MS_TEXT_DOMAIN);
        ?>
						<span class="ms-help-default">
							<?php 
        _ex('Default:', 'help', MS_TEXT_DOMAIN);
        ?>
							0
						</span>
					</li>
				</ul>

				<p><em><?php 
        _ex('Example:', 'help', MS_TEXT_DOMAIN);
        ?>
</em></p>
				<p>
					<code>[ms-member-info value="fullname" default="(Guest)"]</code>
				</p>
				<p>
					<code>[ms-member-info value="memberships" default="Sign up now!" list_separator=" | " before="Your Memberships: "]</code>
				</p>
			</div>
		</div>

		<?php 
        /**
         * Allow Add-ons to add their own shortcode documentation.
         *
         * @since  1.0.1.0
         */
        do_action('ms_view_help_shortcodes-common');
        ?>



		<hr />

		<h2><?php 
        _ex('Membership shortcodes', 'help', MS_TEXT_DOMAIN);
        ?>
</h2>


		<?php 
        /*********
         **********   ms-membership-title   *************************************
         *********/
        ?>

		<div id="ms-membership-title" class="ms-help-box">
			<h3><code>[ms-membership-title]</code></h3>

			<?php 
        _ex('Displays the name of a specific membership', 'help', MS_TEXT_DOMAIN);
        ?>
			<div class="ms-help-toggle"><?php 
        _ex('Expand', 'help', MS_TEXT_DOMAIN);
        ?>
</div>
			<div class="ms-help-details" style="display:none">
				<ul>
					<li>
						<code>id</code>
						<?php 
        _ex('(Single ID)', 'help', MS_TEXT_DOMAIN);
        ?>
						<strong><?php 
        _ex('Required', 'help', MS_TEXT_DOMAIN);
        ?>
</strong>.
						<?php 
        _ex('The membership ID', 'help', MS_TEXT_DOMAIN);
        ?>
					</li>
					<li>
						<code>label</code>
						<?php 
        _ex('(Text)', 'help', MS_TEXT_DOMAIN);
        ?>
						<?php 
        _ex('Displayed in front of the title', 'help', MS_TEXT_DOMAIN);
        ?>
						<span class="ms-help-default">
							<?php 
        _ex('Default:', 'help', MS_TEXT_DOMAIN);
        ?>
							"<?php 
        _e('Membership title:', MS_TEXT_DOMAIN);
        ?>
"
						</span>
					</li>
				</ul>

				<p><em><?php 
        _ex('Example:', 'help', MS_TEXT_DOMAIN);
        ?>
</em></p>
				<p><code>[ms-membership-title id="5" label=""]</code></p>
			</div>
		</div>


		<?php 
        /*********
         **********   ms-membership-price   *************************************
         *********/
        ?>

		<div id="ms-membership-price" class="ms-help-box">
			<h3><code>[ms-membership-price]</code></h3>

			<?php 
        _ex('Displays the price of a specific membership', 'help', MS_TEXT_DOMAIN);
        ?>
			<div class="ms-help-toggle"><?php 
        _ex('Expand', 'help', MS_TEXT_DOMAIN);
        ?>
</div>
			<div class="ms-help-details" style="display:none">
				<ul>
					<li>
						<code>id</code>
						<?php 
        _ex('(Single ID)', 'help', MS_TEXT_DOMAIN);
        ?>
						<strong><?php 
        _ex('Required', 'help', MS_TEXT_DOMAIN);
        ?>
</strong>.
						<?php 
        _ex('The membership ID', 'help', MS_TEXT_DOMAIN);
        ?>
					</li>
					<li>
						<code>currency</code>
						<?php 
        _ex('(yes|no)', 'help', MS_TEXT_DOMAIN);
        ?>
						<span class="ms-help-default">
							<?php 
        _ex('Default:', 'help', MS_TEXT_DOMAIN);
        ?>
							yes
						</span>
					</li>
					<li>
						<code>label</code>
						<?php 
        _ex('(Text)', 'help', MS_TEXT_DOMAIN);
        ?>
						<?php 
        _ex('Displayed in front of the price', 'help', MS_TEXT_DOMAIN);
        ?>
						<span class="ms-help-default">
							<?php 
        _ex('Default:', 'help', MS_TEXT_DOMAIN);
        ?>
							"<?php 
        _e('Membership price:', MS_TEXT_DOMAIN);
        ?>
"
						</span>
					</li>
				</ul>

				<p><em><?php 
        _ex('Example:', 'help', MS_TEXT_DOMAIN);
        ?>
</em></p>
				<p><code>[ms-membership-price id="5" currency="no" label="Only today:"]</code> $</p>
			</div>
		</div>


		<?php 
        /*********
         **********   ms-membership-details   ***********************************
         *********/
        ?>

		<div id="ms-membership-details" class="ms-help-box">
			<h3><code>[ms-membership-details]</code></h3>

			<?php 
        _ex('Displays the description of a specific membership', 'help', MS_TEXT_DOMAIN);
        ?>
			<div class="ms-help-toggle"><?php 
        _ex('Expand', 'help', MS_TEXT_DOMAIN);
        ?>
</div>
			<div class="ms-help-details" style="display:none">
				<ul>
					<li>
						<code>id</code>
						<?php 
        _ex('(Single ID)', 'help', MS_TEXT_DOMAIN);
        ?>
						<strong><?php 
        _ex('Required', 'help', MS_TEXT_DOMAIN);
        ?>
</strong>.
						<?php 
        _ex('The membership ID', 'help', MS_TEXT_DOMAIN);
        ?>
					</li>
					<li>
						<code>label</code>
						<?php 
        _ex('(Text)', 'help', MS_TEXT_DOMAIN);
        ?>
						<?php 
        _ex('Displayed in front of the description', 'help', MS_TEXT_DOMAIN);
        ?>
						<span class="ms-help-default">
							<?php 
        _ex('Default:', 'help', MS_TEXT_DOMAIN);
        ?>
							"<?php 
        _e('Membership details:', MS_TEXT_DOMAIN);
        ?>
"
						</span>
					</li>
				</ul>

				<p><em><?php 
        _ex('Example:', 'help', MS_TEXT_DOMAIN);
        ?>
</em></p>
				<p><code>[ms-membership-details id="5"]</code></p>
			</div>
		</div>


		<?php 
        /*********
         **********   ms-membership-buy   *************************************
         *********/
        ?>

		<div id="ms-membership-buy" class="ms-help-box">
			<h3><code>[ms-membership-buy]</code></h3>

			<?php 
        _ex('Displays a button to buy/sign-up for the specified membership', 'help', MS_TEXT_DOMAIN);
        ?>
			<div class="ms-help-toggle"><?php 
        _ex('Expand', 'help', MS_TEXT_DOMAIN);
        ?>
</div>
			<div class="ms-help-details" style="display:none">
				<ul>
					<li>
						<code>id</code>
						<?php 
        _ex('(Single ID)', 'help', MS_TEXT_DOMAIN);
        ?>
						<strong><?php 
        _ex('Required', 'help', MS_TEXT_DOMAIN);
        ?>
</strong>.
						<?php 
        _ex('The membership ID', 'help', MS_TEXT_DOMAIN);
        ?>
					</li>
					<li>
						<code>label</code>
						<?php 
        _ex('(Text)', 'help', MS_TEXT_DOMAIN);
        ?>
						<?php 
        _ex('The button label', 'help', MS_TEXT_DOMAIN);
        ?>
						<span class="ms-help-default">
							<?php 
        _ex('Default:', 'help', MS_TEXT_DOMAIN);
        ?>
							"<?php 
        _e('Signup', MS_TEXT_DOMAIN);
        ?>
"
						</span>
					</li>
				</ul>

				<p><em><?php 
        _ex('Example:', 'help', MS_TEXT_DOMAIN);
        ?>
</em></p>
				<p><code>[ms-membership-buy id="5" label="Buy now!"]</code></p>
			</div>
		</div>

		<?php 
        /**
         * Allow Add-ons to add their own shortcode documentation.
         *
         * @since  1.0.1.0
         */
        do_action('ms_view_help_shortcodes-membership');
        ?>


		<hr />

		<h2><?php 
        _ex('Less common shortcodes', 'help', MS_TEXT_DOMAIN);
        ?>
</h2>


		<?php 
        /*********
         **********   ms-membership-logout   ************************************
         *********/
        ?>

		<div id="ms-membership-logout" class="ms-help-box">
			<h3><code>[ms-membership-logout]</code></h3>

			<?php 
        _ex('Displays a logout link. When the user is not logged in then the shortcode will return an empty string', 'help', MS_TEXT_DOMAIN);
        ?>
			<div class="ms-help-toggle"><?php 
        _ex('Expand', 'help', MS_TEXT_DOMAIN);
        ?>
</div>
			<div class="ms-help-details" style="display:none">
				<h4><?php 
        _ex('Common options', 'help', MS_TEXT_DOMAIN);
        ?>
</h4>
				<ul>
					<li>
						<code>redirect</code>
						<?php 
        _ex('(URL)', 'help', MS_TEXT_DOMAIN);
        ?>
						<?php 
        _ex('The page to display after the user was logged out', 'help', MS_TEXT_DOMAIN);
        ?>
						<span class="ms-help-default">
							<?php 
        _ex('Default:', 'help', MS_TEXT_DOMAIN);
        ?>
							"<?php 
        echo MS_Model_Pages::get_url_after_logout();
        ?>
"
						</span>
					</li>
				</ul>

				<h4><?php 
        _ex('More options', 'help', MS_TEXT_DOMAIN);
        ?>
</h4>
				<ul>
					<li>
						<code>holder</code>
						<?php 
        _ex('Wrapper element (div, span, p)', 'help', MS_TEXT_DOMAIN);
        ?>
						<span class="ms-help-default">
							<?php 
        _ex('Default:', 'help', MS_TEXT_DOMAIN);
        ?>
							"div"
						</span>
					</li>
					<li>
						<code>holder_class</code>
						<?php 
        _ex('Class for the wrapper', 'help', MS_TEXT_DOMAIN);
        ?>
						<span class="ms-help-default">
							<?php 
        _ex('Default:', 'help', MS_TEXT_DOMAIN);
        ?>
							"ms-logout-form"
						</span>
					</li>
				</ul>

				<p><em><?php 
        _ex('Example:', 'help', MS_TEXT_DOMAIN);
        ?>
</em></p>
				<p><code>[ms-membership-logout]</code></p>
			</div>
		</div>


		<?php 
        /*********
         **********   ms-membership-account-link   ******************************
         *********/
        ?>

		<div id="ms-membership-account-link" class="ms-help-box">
			<h3><code>[ms-membership-account-link]</code></h3>

			<?php 
        _ex('Inserts a simple link to the Account page', 'help', MS_TEXT_DOMAIN);
        ?>
			<div class="ms-help-toggle"><?php 
        _ex('Expand', 'help', MS_TEXT_DOMAIN);
        ?>
</div>
			<div class="ms-help-details" style="display:none">
				<ul>
					<li>
						<code>label</code>
						<?php 
        _ex('(Text)', 'help', MS_TEXT_DOMAIN);
        ?>
						<?php 
        _ex('The contents of the link', 'help', MS_TEXT_DOMAIN);
        ?>
						<span class="ms-help-default">
							<?php 
        _ex('Default:', 'help', MS_TEXT_DOMAIN);
        ?>
							"<?php 
        _e('Visit your account page for more information', MS_TEXT_DOMAIN);
        ?>
"
						</span>
					</li>
				</ul>

				<p><em><?php 
        _ex('Example:', 'help', MS_TEXT_DOMAIN);
        ?>
</em></p>
				<p>
					<?php 
        _ex('Manage subscriptions in', 'help', MS_TEXT_DOMAIN);
        ?>
					<code>[ms-membership-account-link label="<?php 
        _ex('your Account', 'help', MS_TEXT_DOMAIN);
        ?>
"]!</code>
				</p>
			</div>
		</div>


		<?php 
        /*********
         **********   ms-protection-message   ***********************************
         *********/
        ?>

		<div id="ms-protection-message" class="ms-help-box">
			<h3><code>[ms-protection-message]</code></h3>

			<?php 
        _ex('Displays the protection message on pages that the user cannot access. This shortcode should only be used on the Membership Page "Membership2"', 'help', MS_TEXT_DOMAIN);
        ?>
			<div class="ms-help-toggle"><?php 
        _ex('Expand', 'help', MS_TEXT_DOMAIN);
        ?>
</div>
			<div class="ms-help-details" style="display:none">
				<ul>
					<li><em><?php 
        _ex('no arguments', 'help', MS_TEXT_DOMAIN);
        ?>
</em></li>
				</ul>

				<p>
					<?php 
        _ex('Tipp: If the user is not logged in this shortcode will also display the default login form. <em>If you provide your own login form via the shortcode [ms-membership-login] then this shortcode will not add a second login form.</em>', 'help', MS_TEXT_DOMAIN);
        ?>
				</p>

				<p><em><?php 
        _ex('Example:', 'help', MS_TEXT_DOMAIN);
        ?>
</em></p>
				<p><code>[ms-protection-message]</code></p>
			</div>
		</div>

		<?php 
        /*********
         **********   ms-membership-account   ***********************************
         *********/
        ?>

		<div id="ms-membership-account" class="ms-help-box">
			<h3><code>[ms-membership-account]</code></h3>

			<?php 
        _ex('Displays the "My Account" page of the currently logged in user', 'help', MS_TEXT_DOMAIN);
        ?>
			<div class="ms-help-toggle"><?php 
        _ex('Expand', 'help', MS_TEXT_DOMAIN);
        ?>
</div>
			<div class="ms-help-details" style="display:none">
				<h4><?php 
        _e('Membership section', MS_TEXT_DOMAIN);
        ?>
</h4>
				<ul>
					<li>
						<code>show_membership</code>
						<?php 
        _ex('(yes|no)', 'help', MS_TEXT_DOMAIN);
        ?>
						<?php 
        _ex('Whether to display the users current memberships', 'help', MS_TEXT_DOMAIN);
        ?>
						<span class="ms-help-default">
							<?php 
        _ex('Default:', 'help', MS_TEXT_DOMAIN);
        ?>
							yes
						</span>
					</li>
					<li>
						<code>membership_title</code>
						<?php 
        _ex('(text)', 'help', MS_TEXT_DOMAIN);
        ?>
						<?php 
        _ex('Title of the current memberships section', 'help', MS_TEXT_DOMAIN);
        ?>
						<span class="ms-help-default">
							<?php 
        _ex('Default:', 'help', MS_TEXT_DOMAIN);
        ?>
							"<?php 
        _e('Your Membership', MS_TEXT_DOMAIN);
        ?>
"
						</span>
					</li>
					<li>
						<code>show_membership_change</code>
						<?php 
        _ex('(yes|no)', 'help', MS_TEXT_DOMAIN);
        ?>
						<?php 
        _ex('Display the link to subscribe to other memberships', 'help', MS_TEXT_DOMAIN);
        ?>
						<span class="ms-help-default">
							<?php 
        _ex('Default:', 'help', MS_TEXT_DOMAIN);
        ?>
							yes
						</span>
					</li>
					<li>
						<code>membership_change_label</code>
						<?php 
        _ex('(text)', 'help', MS_TEXT_DOMAIN);
        ?>
						<?php 
        _ex('Title of the link', 'help', MS_TEXT_DOMAIN);
        ?>
						<span class="ms-help-default">
							<?php 
        _ex('Default:', 'help', MS_TEXT_DOMAIN);
        ?>
							"<?php 
        _e('Change', MS_TEXT_DOMAIN);
        ?>
"
						</span>
					</li>
				</ul>

				<h4><?php 
        _e('Profile section', MS_TEXT_DOMAIN);
        ?>
</h4>
				<ul>
					<li>
						<code>show_profile</code>
						<?php 
        _ex('(yes|no)', 'help', MS_TEXT_DOMAIN);
        ?>
						<?php 
        _ex('Whether to display the users profile details', 'help', MS_TEXT_DOMAIN);
        ?>
						<span class="ms-help-default">
							<?php 
        _ex('Default:', 'help', MS_TEXT_DOMAIN);
        ?>
							yes
						</span>
					</li>
					<li>
						<code>profile_title</code>
						<?php 
        _ex('(text)', 'help', MS_TEXT_DOMAIN);
        ?>
						<?php 
        _ex('Title of the user profile section', 'help', MS_TEXT_DOMAIN);
        ?>
						<span class="ms-help-default">
							<?php 
        _ex('Default:', 'help', MS_TEXT_DOMAIN);
        ?>
							"<?php 
        _e('Personal details', MS_TEXT_DOMAIN);
        ?>
"
						</span>
					</li>
					<li>
						<code>show_profile_change</code>
						<?php 
        _ex('(yes|no)', 'help', MS_TEXT_DOMAIN);
        ?>
						<?php 
        _ex('Display the link to edit the users profile', 'help', MS_TEXT_DOMAIN);
        ?>
						<span class="ms-help-default">
							<?php 
        _ex('Default:', 'help', MS_TEXT_DOMAIN);
        ?>
							yes
						</span>
					</li>
					<li>
						<code>profile_change_label</code>
						<?php 
        _ex('(text)', 'help', MS_TEXT_DOMAIN);
        ?>
						<?php 
        _ex('Title of the link', 'help', MS_TEXT_DOMAIN);
        ?>
						<span class="ms-help-default">
							<?php 
        _ex('Default:', 'help', MS_TEXT_DOMAIN);
        ?>
							"<?php 
        _e('Edit', MS_TEXT_DOMAIN);
        ?>
"
						</span>
					</li>
				</ul>

				<h4><?php 
        _e('Invoices section', MS_TEXT_DOMAIN);
        ?>
</h4>
				<ul>
					<li>
						<code>show_invoices</code>
						<?php 
        _ex('(yes|no)', 'help', MS_TEXT_DOMAIN);
        ?>
						<?php 
        _ex('Whether to display the section listing recent invoices', 'help', MS_TEXT_DOMAIN);
        ?>
						<span class="ms-help-default">
							<?php 
        _ex('Default:', 'help', MS_TEXT_DOMAIN);
        ?>
							yes
						</span>
					</li>
					<li>
						<code>invoices_title</code>
						<?php 
        _ex('(text)', 'help', MS_TEXT_DOMAIN);
        ?>
						<?php 
        _ex('Title of the invoices section', 'help', MS_TEXT_DOMAIN);
        ?>
						<span class="ms-help-default">
							<?php 
        _ex('Default:', 'help', MS_TEXT_DOMAIN);
        ?>
							"<?php 
        _e('Invoices', MS_TEXT_DOMAIN);
        ?>
"
						</span>
					</li>
					<li>
						<code>limit_invoices</code>
						<?php 
        _ex('(Number)', 'help', MS_TEXT_DOMAIN);
        ?>
						<?php 
        _ex('Number of invoices to display in the recent invoices list', 'help', MS_TEXT_DOMAIN);
        ?>
						<span class="ms-help-default">
							<?php 
        _ex('Default:', 'help', MS_TEXT_DOMAIN);
        ?>
							10
						</span>
					</li>
					<li>
						<code>show_all_invoices</code>
						<?php 
        _ex('(yes|no)', 'help', MS_TEXT_DOMAIN);
        ?>
						<?php 
        _ex('Display the link to the complete list of users invoices', 'help', MS_TEXT_DOMAIN);
        ?>
						<span class="ms-help-default">
							<?php 
        _ex('Default:', 'help', MS_TEXT_DOMAIN);
        ?>
							yes
						</span>
					</li>
					<li>
						<code>invoices_details_label</code>
						<?php 
        _ex('(text)', 'help', MS_TEXT_DOMAIN);
        ?>
						<?php 
        _ex('Title of the link', 'help', MS_TEXT_DOMAIN);
        ?>
						<span class="ms-help-default">
							<?php 
        _ex('Default:', 'help', MS_TEXT_DOMAIN);
        ?>
							"<?php 
        _e('View all', MS_TEXT_DOMAIN);
        ?>
"
						</span>
					</li>
				</ul>

				<h4><?php 
        _e('Activities section', MS_TEXT_DOMAIN);
        ?>
</h4>
				<ul>
					<li>
						<code>show_activity</code>
						<?php 
        _ex('(yes|no)', 'help', MS_TEXT_DOMAIN);
        ?>
						<?php 
        _ex('Whether to display the section containing the users recent activities', 'help', MS_TEXT_DOMAIN);
        ?>
						<span class="ms-help-default">
							<?php 
        _ex('Default:', 'help', MS_TEXT_DOMAIN);
        ?>
							yes
						</span>
					</li>
					<li>
						<code>activity_title</code>
						<?php 
        _ex('(text)', 'help', MS_TEXT_DOMAIN);
        ?>
						<?php 
        _ex('Title of the invoices section', 'help', MS_TEXT_DOMAIN);
        ?>
						<span class="ms-help-default">
							<?php 
        _ex('Default:', 'help', MS_TEXT_DOMAIN);
        ?>
							"<?php 
        _e('Activities', MS_TEXT_DOMAIN);
        ?>
"
						</span>
					</li>
					<li>
						<code>limit_activities</code>
						<?php 
        _ex('(Number)', 'help', MS_TEXT_DOMAIN);
        ?>
						<?php 
        _ex('Number of items to display in the recent activities list', 'help', MS_TEXT_DOMAIN);
        ?>
						<span class="ms-help-default">
							<?php 
        _ex('Default:', 'help', MS_TEXT_DOMAIN);
        ?>
							10
						</span>
					</li>
					<li>
						<code>show_all_activities</code>
						<?php 
        _ex('(yes|no)', 'help', MS_TEXT_DOMAIN);
        ?>
						<?php 
        _ex('Display the link to the complete list of users invoices', 'help', MS_TEXT_DOMAIN);
        ?>
						<span class="ms-help-default">
							<?php 
        _ex('Default:', 'help', MS_TEXT_DOMAIN);
        ?>
							yes
						</span>
					</li>
					<li>
						<code>activity_details_label</code>
						<?php 
        _ex('(text)', 'help', MS_TEXT_DOMAIN);
        ?>
						<?php 
        _ex('Title of the link', 'help', MS_TEXT_DOMAIN);
        ?>
						<span class="ms-help-default">
							<?php 
        _ex('Default:', 'help', MS_TEXT_DOMAIN);
        ?>
							"<?php 
        _e('View all', MS_TEXT_DOMAIN);
        ?>
"
						</span>
					</li>
				</ul>

				<p><em><?php 
        _ex('Example:', 'help', MS_TEXT_DOMAIN);
        ?>
</em></p>
				<p><code>[ms-membership-account]</code></p>
				<p><code>[ms-membership-account show_profile_change="no" show_activity="no" limit_invoices="3" invoices_title="Last 3 invoices"]</code></p>
			</div>
		</div>


		<?php 
        /*********
         **********   ms-invoice   **********************************************
         *********/
        ?>

		<div id="ms-invoice" class="ms-help-box">
			<h3><code>[ms-invoice]</code></h3>

			<?php 
        _ex('Display an invoice to the user. Not very useful in most cases, as the invoice can only be viewed by the invoice recipient', 'help', MS_TEXT_DOMAIN);
        ?>
			<div class="ms-help-toggle"><?php 
        _ex('Expand', 'help', MS_TEXT_DOMAIN);
        ?>
</div>
			<div class="ms-help-details" style="display:none">
				<ul>
					<li>
						<code>id</code>
						<?php 
        _ex('(Single ID)', 'help', MS_TEXT_DOMAIN);
        ?>
						<strong><?php 
        _ex('Required', 'help', MS_TEXT_DOMAIN);
        ?>
</strong>.
						<?php 
        _ex('The Invoice ID', 'help', MS_TEXT_DOMAIN);
        ?>
					</li>
					<li>
						<code>pay_button</code>
						<?php 
        _ex('(yes|no)', 'help', MS_TEXT_DOMAIN);
        ?>
						<?php 
        _ex('If the invoice should contain a "Pay" button', 'help', MS_TEXT_DOMAIN);
        ?>
						<span class="ms-help-default">
							<?php 
        _ex('Default:', 'help', MS_TEXT_DOMAIN);
        ?>
							yes
						</span>
					</li>
				</ul>

				<p><em><?php 
        _ex('Example:', 'help', MS_TEXT_DOMAIN);
        ?>
</em></p>
				<p><code>[ms-invoice id="123"]</code></p>
			</div>
		</div>

		<?php 
        /**
         * Allow Add-ons to add their own shortcode documentation.
         *
         * @since  1.0.1.0
         */
        do_action('ms_view_help_shortcodes-other');
        ?>

		<hr />
		<?php 
        $html = ob_get_clean();
        return apply_filters('ms_view_help_shortcodes', $html);
    }
 /**
  * This filter is called by WordPress when the page-listtable is created to
  * display all available Posts/Pages. We use this filter to add a note
  * to all pages that are special membership pages.
  *
  * @since  1.0.0
  * @param  array $states
  * @param  WP_Post $post
  * @return array
  */
 public function post_states($states, $post)
 {
     if ('page' == $post->post_type) {
         if (MS_Model_Pages::is_membership_page($post->ID)) {
             $url = MS_Controller_Plugin::get_admin_url('settings');
             $states['membership2'] = sprintf('<a style="%2$s" href="%3$s">%1$s</a>', __('Membership2 Page', 'membership2'), 'background:#aaa;color:#fff;padding:1px 4px;border-radius:4px;font-size:0.8em', $url);
         }
     }
     return $states;
 }
 /**
  * Completely whipe all Membership data from Database.
  *
  * Note: This function is not used currently...
  *
  * @since  1.0.0
  */
 private static function cleanup_db()
 {
     global $wpdb;
     $sql = array();
     $trash_ids = array();
     // Delete membership meta-data from users.
     $users = MS_Model_Member::get_members();
     foreach ($users as $user) {
         $user->delete_all_membership_usermeta();
         $user->save();
     }
     // Determine IDs of Membership Pages.
     $page_types = MS_Model_Pages::get_page_types();
     foreach ($page_types as $type => $name) {
         $page_id = MS_Model_Pages::get_setting($type);
         $trash_ids[] = $page_id;
     }
     /**
      * Delete all plugin settings.
      * Settings are saved by classes that extend MS_Model_option
      */
     foreach (MS_Model_Gateway::get_gateways() as $option) {
         $option->delete();
     }
     MS_Factory::load('MS_Model_Addon')->delete();
     MS_Factory::load('MS_Model_Pages')->delete();
     MS_Factory::load('MS_Model_Settings')->delete();
     /**
      * Delete transient data
      * Transient data is saved by classed that extend MS_Model_Transient
      */
     MS_Factory::load('MS_Model_Simulate')->delete();
     /**
      * Delete all plugin content.
      * Content is saved by classes that extend MS_Model_CustomPostType
      */
     $ms_posttypes = array(MS_Model_Communication::get_post_type(), MS_Model_Event::get_post_type(), MS_Model_Invoice::get_post_type(), MS_Model_Transactionlog::get_post_type(), MS_Model_Membership::get_post_type(), MS_Model_Relationship::get_post_type(), MS_Addon_Coupon_Model::get_post_type(), MS_Addon_Invitation_Model::get_post_type());
     foreach ($ms_posttypes as $type) {
         $sql[] = $wpdb->prepare("DELETE FROM {$wpdb->posts} WHERE post_type = %s;", $type);
     }
     // Remove orphaned post-metadata.
     $sql[] = "\n\t\tDELETE FROM {$wpdb->postmeta}\n\t\tWHERE NOT EXISTS (\n\t\t\tSELECT 1 FROM {$wpdb->posts} tmp WHERE tmp.ID = post_id\n\t\t);\n\t\t";
     // Clear all WP transient cache.
     $sql[] = "\n\t\tDELETE FROM {$wpdb->options}\n\t\tWHERE option_name LIKE '_transient_%';\n\t\t";
     foreach ($sql as $s) {
         $wpdb->query($s);
     }
     // Move Membership pages to trash.
     foreach ($trash_ids as $id) {
         wp_delete_post($id, true);
     }
     // Clear all data from WP Object cache.
     wp_cache_flush();
     // Redirect to the main page.
     wp_safe_redirect(MS_Controller_Plugin::get_admin_url());
     exit;
 }
Пример #12
0
/**
 * Desc:  Filter wp_nav_menu() to add profile link in a specific custom menu e.g. Login or logout
 * author: ajay3085006
 * dated: 27 Dec 2015
 * updated: 30 Dec 2015
 */
function x_nav_menu_signup_logout_link($menu, $args)
{
    //print_r($args);
    if (is_user_logged_in() && $args->theme_location == 'primary') {
        $profilelink = '<li><a href="' . wp_logout_url(get_permalink()) . '">' . __('Logout', 'x') . '</a></li>';
        $menu = $menu . $profilelink;
    } else {
        if ($args->theme_location == 'primary') {
            $url = MS_Model_Pages::get_page_url(MS_Model_Pages::MS_PAGE_REGISTER);
            $profilelink = '<li><a href="' . $url . '?step=register" class="show-register" >' . __('Signup', 'x') . '</a></li>';
            $menu = $menu . $profilelink;
        } else {
        }
    }
    return $menu;
}
 /**
  * Close comments for membership special pages.
  *
  * Related Action Hooks:
  * - the_content
  *
  * @since  1.0.0
  *
  * @param string $content The content to filter.
  */
 public function check_special_page($content)
 {
     if (MS_Model_Pages::is_membership_page()) {
         add_filter('comments_open', '__return_false', 100);
     }
     return apply_filters('ms_rule_content_model_check_special_page', $content, $this);
 }
Пример #14
0
 public function get_success_url()
 {
     if (Pronamic_WP_Pay_Extensions_WPMUDEV_Membership_Extension::is_membership2()) {
         return esc_url_raw(add_query_arg(array('ms_relationship_id' => $this->subscription->id), MS_Model_Pages::get_page_url(MS_Model_Pages::MS_PAGE_REG_COMPLETE, false)));
     }
     return M_get_registrationcompleted_permalink();
 }
Пример #15
0
 /**
  * Adds CSS and JS for Membership special pages used in the front end.
  *
  * @since  1.0.0
  *
  * @return void
  */
 public function enqueue_scripts()
 {
     do_action('ms_controller_frontend_enqueue_scripts', $this->get_signup_step(), $this->get_action(), $this);
     $is_ms_page = MS_Model_Pages::is_membership_page();
     $is_profile = self::ACTION_EDIT_PROFILE == $this->get_action() && MS_Model_Pages::is_membership_page(null, MS_Model_Pages::MS_PAGE_ACCOUNT);
     if ($is_ms_page) {
         $data = array('ms_init' => array('shortcode'), 'cancel_msg' => __('Are you sure you want to cancel?', MS_TEXT_DOMAIN));
         lib2()->ui->css('ms-styles');
         lib2()->ui->js('jquery-validate');
         lib2()->ui->js('ms-public');
         MS_Controller_Plugin::translate_jquery_validator();
         if ($is_profile) {
             $data['ms_init'][] = 'frontend_profile';
         }
         lib2()->ui->data('ms_data', $data);
     }
 }
 /**
  * Checks member permissions and protects current page.
  *
  * Related Action Hooks:
  * - template_redirect
  *
  * @since  1.0.0
  */
 public function protect_current_page()
 {
     do_action('ms_model_plugin_protect_current_page_before', $this);
     // Admin user has access to everything
     if ($this->member->is_normal_admin()) {
         return;
     }
     $access = $this->get_access_info();
     if (!$access['has_access']) {
         MS_Model_Pages::create_missing_pages();
         $no_access_page_url = MS_Model_Pages::get_page_url(MS_Model_Pages::MS_PAGE_PROTECTED_CONTENT, false);
         $current_page_url = MS_Helper_Utility::get_current_url();
         // Don't (re-)redirect the protection page.
         if (!MS_Model_Pages::is_membership_page(null, MS_Model_Pages::MS_PAGE_PROTECTED_CONTENT)) {
             $no_access_page_url = esc_url_raw(add_query_arg(array('redirect_to' => urlencode($current_page_url)), $no_access_page_url));
             $no_access_page_url = apply_filters('ms_model_plugin_protected_content_page', $no_access_page_url);
             wp_safe_redirect($no_access_page_url);
             exit;
         }
     }
     do_action('ms_model_plugin_protect_current_page_after', $this);
 }
 /**
  * Ajax handler. Used by shortcode `ms-membership-login` to recover password
  *
  * @since  1.0.0
  * @access public
  */
 public function ajax_lostpass()
 {
     global $wpdb, $wp_hasher;
     $resp = array();
     // First check the nonce, if it fails the function will break
     check_ajax_referer('ms-ajax-lostpass');
     // Nonce is checked, get the POST data and sign user on
     $errors = new WP_Error();
     if (empty($_POST['user_login'])) {
         $resp['error'] = __('Enter a username or e-mail address.', MS_TEXT_DOMAIN);
     } else {
         if (strpos($_POST['user_login'], '@')) {
             $user_data = get_user_by('email', trim($_POST['user_login']));
             if (empty($user_data)) {
                 $resp['error'] = __('There is no user registered with that email address.', MS_TEXT_DOMAIN);
             }
         } else {
             $login = trim($_POST['user_login']);
             $user_data = get_user_by('login', $login);
         }
     }
     do_action('lostpassword_post');
     if (!empty($resp['error'])) {
         $this->respond($resp);
     }
     if (!$user_data) {
         $resp['error'] = __('Invalid username or e-mail.', MS_TEXT_DOMAIN);
         $this->respond($resp);
     }
     // Redefining user_login ensures we return the right case in the email.
     $user_login = $user_data->user_login;
     $user_email = $user_data->user_email;
     do_action('retreive_password', $user_login);
     // Legacy (misspelled)
     do_action('retrieve_password', $user_login);
     $allow = apply_filters('allow_password_reset', true, $user_data->ID);
     if (!$allow) {
         $resp['error'] = __('Password reset is not allowed for this user', MS_TEXT_DOMAIN);
         $this->respond($resp);
     } else {
         if (is_wp_error($allow)) {
             return $allow;
         }
     }
     // Generate something random for a password reset key.
     $key = wp_generate_password(20, false);
     do_action('retrieve_password_key', $user_login, $key);
     // Now insert the key, hashed, into the DB.
     if (empty($wp_hasher)) {
         require_once ABSPATH . WPINC . '/class-phpass.php';
         $wp_hasher = new PasswordHash(8, true);
     }
     $hashed = $wp_hasher->HashPassword($key);
     $wpdb->update($wpdb->users, array('user_activation_key' => $hashed), array('user_login' => $user_login));
     MS_Model_Pages::create_missing_pages();
     $reset_url = MS_Model_Pages::get_page_url(MS_Model_Pages::MS_PAGE_ACCOUNT);
     $reset_url = esc_url_raw(add_query_arg(array('action' => MS_Controller_Frontend::ACTION_VIEW_RESETPASS, 'key' => $key, 'login' => rawurlencode($user_login)), $reset_url));
     $message = __('Someone requested that the password be reset for the following account:') . "\r\n\r\n";
     $message .= network_home_url('/') . "\r\n\r\n";
     $message .= sprintf(__('Username: %s'), $user_login) . "\r\n\r\n";
     $message .= __('If this was a mistake, just ignore this email and nothing will happen.') . "\r\n\r\n";
     $message .= __('To reset your password, visit the following address:') . "\r\n\r\n";
     $message .= '<' . $reset_url . ">\r\n";
     if (is_multisite()) {
         $blogname = $GLOBALS['current_site']->site_name;
     } else {
         $blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES);
     }
     $title = sprintf(__('[%s] Password Reset'), $blogname);
     $title = apply_filters('retrieve_password_title', $title);
     $message = apply_filters('retrieve_password_message', $message, $key, $reset_url);
     if ($message && !wp_mail($user_email, wp_specialchars_decode($title), $message)) {
         $resp['error'] = __('The e-mail could not be sent.') . '<br />' . __('Possible reason: your host may have disabled the mail() function.');
     } else {
         $resp['success'] = __('Check your e-mail for the confirmation link.', MS_TEXT_DOMAIN);
     }
     $this->respond($resp);
 }
Пример #18
0
 /**
  * Exclude the special Membership2 pages from the results as they
  * cannot be protected.
  *
  * @since  1.0.0
  * @param  array $excluded
  * @param  array $args
  * @return array
  */
 public function exclude_items($excluded, $args)
 {
     static $Page_Ids = null;
     if (null === $Page_Ids) {
         $Page_Ids = array();
         $types = MS_Model_Pages::get_page_types();
         foreach ($types as $type => $title) {
             $Page_Ids[] = MS_Model_Pages::get_setting($type);
         }
     }
     return array_merge($excluded, $Page_Ids);
 }
 /**
  * Prepare the PayPal IPN fields
  *
  * Details here:
  * https://developer.paypal.com/docs/classic/paypal-payments-standard/integration-guide/Appx_websitestandard_htmlvariables/
  *
  * @since  1.0.0
  * @return array
  */
 private function prepare_fields()
 {
     $subscription = $this->data['ms_relationship'];
     $membership = $subscription->get_membership();
     if (0 === $membership->price) {
         return;
     }
     $gateway = $this->data['gateway'];
     $invoice = $subscription->get_current_invoice();
     $regular_invoice = null;
     $settings = MS_Factory::load('MS_Model_Settings');
     $nonce = wp_create_nonce($gateway->id . '_' . $subscription->id);
     $cancel_url = MS_Model_Pages::get_page_url(MS_Model_Pages::MS_PAGE_REGISTER);
     $return_url = esc_url_raw(add_query_arg(array('ms_relationship_id' => $subscription->id), MS_Model_Pages::get_page_url(MS_Model_Pages::MS_PAGE_REG_COMPLETE, false)));
     $fields = array('_wpnonce' => array('id' => '_wpnonce', 'type' => MS_Helper_Html::INPUT_TYPE_HIDDEN, 'value' => $nonce), 'charset' => array('id' => 'charset', 'type' => MS_Helper_Html::INPUT_TYPE_HIDDEN, 'value' => 'utf-8'), 'business' => array('id' => 'business', 'type' => MS_Helper_Html::INPUT_TYPE_HIDDEN, 'value' => $gateway->merchant_id), 'cmd' => array('id' => 'cmd', 'type' => MS_Helper_Html::INPUT_TYPE_HIDDEN, 'value' => '_xclick-subscriptions'), 'bn' => array('id' => 'bn', 'type' => MS_Helper_Html::INPUT_TYPE_HIDDEN, 'value' => 'incsub_SP'), 'item_name' => array('id' => 'item_name', 'type' => MS_Helper_Html::INPUT_TYPE_HIDDEN, 'value' => $membership->name), 'item_number' => array('id' => 'item_number', 'type' => MS_Helper_Html::INPUT_TYPE_HIDDEN, 'value' => $membership->id), 'currency_code' => array('id' => 'currency_code', 'type' => MS_Helper_Html::INPUT_TYPE_HIDDEN, 'value' => MS_Plugin::instance()->settings->currency), 'return' => array('id' => 'return', 'type' => MS_Helper_Html::INPUT_TYPE_HIDDEN, 'value' => $return_url), 'cancel_return' => array('id' => 'cancel_return', 'type' => MS_Helper_Html::INPUT_TYPE_HIDDEN, 'value' => $cancel_url), 'notify_url' => array('id' => 'notify_url', 'type' => MS_Helper_Html::INPUT_TYPE_HIDDEN, 'value' => $gateway->get_return_url()), 'country' => array('id' => 'country', 'type' => MS_Helper_Html::INPUT_TYPE_HIDDEN, 'value' => $gateway->paypal_site), 'no_note' => array('id' => 'no_note', 'type' => MS_Helper_Html::INPUT_TYPE_HIDDEN, 'value' => 1), 'no_shipping' => array('id' => 'no_shipping', 'type' => MS_Helper_Html::INPUT_TYPE_HIDDEN, 'value' => 1), 'invoice' => array('id' => 'invoice', 'type' => MS_Helper_Html::INPUT_TYPE_HIDDEN, 'value' => $invoice->id));
     $fields['submit'] = array('id' => 'submit', 'type' => MS_Helper_Html::INPUT_TYPE_IMAGE, 'value' => 'https://www.paypal.com/en_US/i/btn/btn_subscribe_LG.gif', 'alt' => __('PayPal - The safer, easier way to pay online', 'membership2'));
     // custom pay button defined in gateway settings
     $custom_label = $gateway->pay_button_url;
     if (!empty($custom_label)) {
         if (false !== strpos($custom_label, '://')) {
             $fields['submit']['value'] = $custom_label;
         } else {
             $fields['submit'] = array('id' => 'submit', 'type' => MS_Helper_Html::INPUT_TYPE_SUBMIT, 'value' => $custom_label);
         }
     }
     // Trial period
     if ($subscription->is_trial_eligible()) {
         $fields['a1'] = array('id' => 'a1', 'type' => MS_Helper_Html::INPUT_TYPE_HIDDEN, 'value' => $invoice->trial_price);
         $trial_type = MS_Helper_Period::get_period_value($membership->trial_period, 'period_type');
         $trial_type = strtoupper($trial_type[0]);
         $trial_value = MS_Helper_Period::get_period_value($membership->trial_period, 'period_unit');
         $trial_value = MS_Helper_Period::validate_range($trial_value, $trial_type);
         $fields['p1'] = array('id' => 'p1', 'type' => MS_Helper_Html::INPUT_TYPE_HIDDEN, 'value' => $trial_value);
         $fields['t1'] = array('id' => 't1', 'type' => MS_Helper_Html::INPUT_TYPE_HIDDEN, 'value' => $trial_type);
     }
     // Membership price
     $membership_price = $invoice->total;
     $membership_price = MS_Helper_Billing::format_price($membership_price);
     $fields['a3'] = array('id' => 'a3', 'type' => MS_Helper_Html::INPUT_TYPE_HIDDEN, 'value' => $membership_price);
     $fields['amount'] = array('id' => 'amount', 'type' => MS_Helper_Html::INPUT_TYPE_HIDDEN, 'value' => $membership_price);
     $recurring = 0;
     switch ($membership->payment_type) {
         // == RECURRING PAYMENTS
         case MS_Model_Membership::PAYMENT_TYPE_RECURRING:
             $period_type = MS_Helper_Period::get_period_value($membership->pay_cycle_period, 'period_type');
             $period_type = strtoupper($period_type[0]);
             $period_value = MS_Helper_Period::get_period_value($membership->pay_cycle_period, 'period_unit');
             $period_value = MS_Helper_Period::validate_range($period_value, $period_type);
             $fields['p3'] = array('id' => 'p3', 'type' => MS_Helper_Html::INPUT_TYPE_HIDDEN, 'value' => $period_value);
             $fields['t3'] = array('id' => 't3', 'type' => MS_Helper_Html::INPUT_TYPE_HIDDEN, 'value' => $period_type);
             // This makes the payments recurring!
             $recurring = 1;
             break;
             // == FINITE END DATE
         // == FINITE END DATE
         case MS_Model_Membership::PAYMENT_TYPE_FINITE:
             $period_type = MS_Helper_Period::get_period_value($membership->period, 'period_type');
             $period_type = strtoupper($period_type[0]);
             $period_value = MS_Helper_Period::get_period_value($membership->period, 'period_unit');
             $period_value = MS_Helper_Period::validate_range($period_value, $period_type);
             $fields['p3'] = array('id' => 'p3', 'type' => MS_Helper_Html::INPUT_TYPE_HIDDEN, 'value' => $period_value);
             $fields['t3'] = array('id' => 't3', 'type' => MS_Helper_Html::INPUT_TYPE_HIDDEN, 'value' => $period_type);
             break;
             // == DATE RANGE
         // == DATE RANGE
         case MS_Model_Membership::PAYMENT_TYPE_DATE_RANGE:
             $period_value = MS_Helper_Period::subtract_dates($membership->period_date_end, $membership->period_date_start);
             $period_value = MS_Helper_Period::validate_range($period_value, 'D');
             $fields['p3'] = array('id' => 'p3', 'type' => MS_Helper_Html::INPUT_TYPE_HIDDEN, 'value' => $period_value);
             $fields['t3'] = array('id' => 't3', 'type' => MS_Helper_Html::INPUT_TYPE_HIDDEN, 'value' => 'D');
             break;
             // == PERMANENT
         // == PERMANENT
         case MS_Model_Membership::PAYMENT_TYPE_PERMANENT:
             /*
              * Permanent membership: Set the subscription range to 5 years!
              * PayPal requires us to provide the subscription range and the
              * maximum possible value is 5 years.
              */
             $period_value = MS_Helper_Period::validate_range(5, 'Y');
             $fields['p3'] = array('id' => 'p3', 'type' => MS_Helper_Html::INPUT_TYPE_HIDDEN, 'value' => $period_value);
             $fields['t3'] = array('id' => 't3', 'type' => MS_Helper_Html::INPUT_TYPE_HIDDEN, 'value' => 'Y');
             break;
     }
     if (1 == $recurring) {
         if (1 == $membership->pay_cycle_repetitions) {
             $recurring = 0;
         } elseif ($membership->pay_cycle_repetitions > 1) {
             /**
              * Recurring times.
              * The number of times that a recurring payment is made.
              */
             $fields['srt'] = array('id' => 'srt', 'type' => MS_Helper_Html::INPUT_TYPE_HIDDEN, 'value' => $membership->pay_cycle_repetitions);
         }
     }
     /**
      * Recurring field.
      * 0 - one time payment
      * 1 - recurring payments
      */
     $fields['src'] = array('id' => 'src', 'type' => MS_Helper_Html::INPUT_TYPE_HIDDEN, 'value' => $recurring);
     /**
      * Modify current subscription field.
      * value != 0 does not allow trial period.
      * 0 - allows subscribers only to sign up for new subscriptions
      * 1 - allows subscribers to sign up for new subscriptions and modify their current subscriptions
      * 2 - allows subscribers to modify only their current subscriptions
      */
     $modify = !empty($move_from_id);
     $fields['modify'] = array('id' => 'modify', 'type' => MS_Helper_Html::INPUT_TYPE_HIDDEN, 'value' => $modify ? 2 : 0);
     if ($gateway->is_live_mode()) {
         $this->data['action_url'] = 'https://www.paypal.com/cgi-bin/webscr';
     } else {
         $this->data['action_url'] = 'https://www.sandbox.paypal.com/cgi-bin/webscr';
     }
     return apply_filters('ms_gateway_paypalstandard_view_prepare_fields', $fields);
 }
Пример #20
0
 /**
  * Replace comm_vars with corresponding values.
  *
  * @since  1.0.0
  *
  * @param MS_Model_Relationship $subscription The membership relationship to send message to.
  * @param MS_Model_Member $member The member object to get info from.
  * @return array {
  *     Returns array of ( $var_name => $var_replace ).
  *
  *     @type string $var_name The variable name to replace.
  *     @type string $var_replace The variable corresponding replace string.
  * }
  */
 public function get_comm_vars($subscription, $member)
 {
     $currency = MS_Plugin::instance()->settings->currency . ' ';
     $invoice = null;
     $membership = null;
     if ($subscription && $subscription instanceof MS_Model_Relationship) {
         // First try to fetch the current invoice.
         $invoice = $subscription->get_current_invoice(false);
         $prev_invoice = $subscription->get_previous_invoice();
         // If no current invoice exists then fetch the previous invoice.
         if (empty($invoice)) {
             $invoice = $prev_invoice;
         }
         $membership = $subscription->get_membership();
     }
     $comm_vars = apply_filters('ms_model_communication_comm_vars', $this->comm_vars, $this->type, $member, $subscription);
     $wp_user = $member->get_user();
     foreach ($comm_vars as $key => $description) {
         $var_value = '';
         switch ($key) {
             case self::COMM_VAR_BLOG_NAME:
                 $var_value = get_option('blogname');
                 break;
             case self::COMM_VAR_BLOG_URL:
                 $var_value = get_option('home');
                 break;
             case self::COMM_VAR_USERNAME:
                 $var_value = $member->username;
                 break;
             case self::COMM_VAR_PASSWORD:
                 /**
                  * $member->password is ONLY available in the same request
                  * when the new user account was created! After this we only
                  * have the encrypted password in the DB, and the plain-text
                  * version will never be available again in code...
                  *
                  * @since 1.0.1.1
                  */
                 if (self::COMM_TYPE_SIGNUP == $this->type) {
                     $var_value = $member->password;
                 }
                 break;
             case self::COMM_VAR_USER_DISPLAY_NAME:
                 $var_value = $wp_user->display_name;
                 break;
             case self::COMM_VAR_USER_FIRST_NAME:
                 $var_value = $member->first_name;
                 break;
             case self::COMM_VAR_USER_LAST_NAME:
                 $var_value = $member->last_name;
                 break;
             case self::COMM_VAR_NET_NAME:
                 $var_value = get_site_option('site_name');
                 break;
             case self::COMM_VAR_NET_URL:
                 $var_value = get_site_option('siteurl');
                 break;
             case self::COMM_VAR_MS_ACCOUNT_PAGE_URL:
                 $var_value = sprintf('<a href="%s">%s</a>', MS_Model_Pages::get_page_url(MS_Model_Pages::MS_PAGE_ACCOUNT), __('account page', MS_TEXT_DOMAIN));
                 break;
                 // Needs: $membership
             // Needs: $membership
             case self::COMM_VAR_MS_NAME:
                 if ($membership && $membership->name) {
                     $var_value = $membership->name;
                 }
                 break;
                 // Needs: $invoice
             // Needs: $invoice
             case self::COMM_VAR_MS_INVOICE:
                 if ($invoice) {
                     if ($invoice->total > 0 || $invoice->uses_trial) {
                         $attr = array('post_id' => $invoice->id, 'pay_button' => 0);
                         $scode = MS_Factory::load('MS_Controller_Shortcode');
                         $var_value = $scode->membership_invoice($attr);
                     }
                 }
                 break;
                 // Needs: $subscription
             // Needs: $subscription
             case self::COMM_VAR_MS_REMAINING_DAYS:
                 if ($subscription) {
                     $days = $subscription->get_remaining_period();
                     $var_value = sprintf(__('%s day%s', MS_TEXT_DOMAIN), $days, abs($days) > 1 ? 's' : '');
                 }
                 break;
                 // Needs: $subscription
             // Needs: $subscription
             case self::COMM_VAR_MS_REMAINING_TRIAL_DAYS:
                 if ($subscription) {
                     $days = $subscription->get_remaining_trial_period();
                     $var_value = sprintf(__('%s day%s', MS_TEXT_DOMAIN), $days, abs($days) > 1 ? 's' : '');
                 }
                 break;
                 // Needs: $subscription
             // Needs: $subscription
             case self::COMM_VAR_MS_EXPIRY_DATE:
                 if ($subscription) {
                     $var_value = $subscription->expire_date;
                 }
                 break;
         }
         $comm_vars[$key] = apply_filters('ms_model_communication_send_message_comm_var-' . $key, $var_value, $this->type, $member, $subscription, $invoice);
     }
     return apply_filters('ms_model_communication_get_comm_vars', $comm_vars, $member);
 }
 /**
  * Creates a new password-reset key and stores it in the DB.
  *
  * @since  1.0.2.3
  * @return object {
  *         The reset-key that can be sent to the user.
  *
  *         @var  key   The reset key
  *         @var  url   The full reset URL
  *  }
  */
 public function new_password_reset_key()
 {
     global $wpdb, $wp_hasher;
     // Generate something random for a password reset key.
     $key = wp_generate_password(20, false);
     do_action('retrieve_password_key', $this->username, $key);
     // Now insert a hashed version of the key into the DB.
     // Important: The has needs to include the time() value!
     if (empty($wp_hasher)) {
         require_once ABSPATH . WPINC . '/class-phpass.php';
         $wp_hasher = new PasswordHash(8, true);
     }
     $hashed = time() . ':' . $wp_hasher->HashPassword($key);
     $wpdb->update($wpdb->users, array('user_activation_key' => $hashed), array('user_login' => $this->username));
     MS_Model_Pages::create_missing_pages();
     $reset_url = MS_Model_Pages::get_page_url(MS_Model_Pages::MS_PAGE_ACCOUNT);
     $reset_url = esc_url_raw(add_query_arg(array('action' => MS_Controller_Frontend::ACTION_VIEW_RESETPASS, 'key' => $key, 'login' => rawurlencode($this->username)), $reset_url));
     return (object) array('key' => $key, 'url' => $reset_url);
 }
    public function to_html()
    {
        global $post;
        /**
         * Provide a customized account page.
         *
         * @since  1.0.0
         */
        $html = apply_filters('ms_shortcode_custom_account', '', $this->data);
        if (!empty($html)) {
            return $html;
        } else {
            $html = '';
        }
        $member = MS_Model_Member::get_current_member();
        $fields = $this->prepare_fields();
        // Extract shortcode options.
        extract($this->data);
        ob_start();
        ?>
		<div class="ms-account-wrapper">
			<?php 
        if (MS_Model_Member::is_logged_in()) {
            ?>

				<?php 
            // ================================================= MEMBERSHIPS
            if ($show_membership) {
                ?>
				<div id="account-membership">
				<h2>
					<?php 
                echo $membership_title;
                if ($show_membership_change) {
                    $signup_url = MS_Model_Pages::get_page_url(MS_Model_Pages::MS_PAGE_REGISTER);
                    printf('<a href="%s" class="ms-edit-profile">%s</a>', $signup_url, $membership_change_label);
                }
                ?>
				</h2>
				<?php 
                /**
                 * Add custom content right before the memberships list.
                 *
                 * @since  1.0.0
                 */
                do_action('ms_view_account_memberships_top', $member, $this);
                if (MS_Model_Member::is_admin_user()) {
                    _e('You are an admin user and have access to all memberships', 'membership2');
                } else {
                    if (!empty($this->data['subscription'])) {
                        ?>
						<table>
							<tr>
								<th class="ms-col-membership"><?php 
                        _e('Membership name', 'membership2');
                        ?>
</th>
								<th class="ms-col-status"><?php 
                        _e('Status', 'membership2');
                        ?>
</th>
								<th class="ms-col-expire-date"><?php 
                        _e('Expire date', 'membership2');
                        ?>
</th>
							</tr>
							<?php 
                        $empty = true;
                        // These subscriptions have no expire date
                        $no_expire_list = array(MS_Model_Relationship::STATUS_PENDING, MS_Model_Relationship::STATUS_WAITING, MS_Model_Relationship::STATUS_DEACTIVATED);
                        // These subscriptions display the trial-expire date
                        $trial_expire_list = array(MS_Model_Relationship::STATUS_TRIAL, MS_Model_Relationship::STATUS_TRIAL_EXPIRED);
                        foreach ($this->data['subscription'] as $subscription) {
                            $empty = false;
                            $membership = $subscription->get_membership();
                            $subs_classes = array('ms-subscription-' . $subscription->id, 'ms-status-' . $subscription->status, 'ms-type-' . $membership->type, 'ms-payment-' . $membership->payment_type, 'ms-gateway-' . $subscription->gateway_id, 'ms-membership-' . $subscription->membership_id, $subscription->has_trial() ? 'ms-with-trial' : 'ms-no-trial');
                            ?>
								<tr class="<?php 
                            echo esc_attr(implode(' ', $subs_classes));
                            ?>
">
									<td class="ms-col-membership"><?php 
                            echo esc_html($membership->name);
                            ?>
</td>
									<td class="ms-col-status">
									<?php 
                            if (MS_Model_Relationship::STATUS_PENDING == $subscription->status) {
                                // Display a "Purchase" link when status is Pending
                                $code = sprintf('[%s id="%s" label="%s"]', MS_Helper_Shortcode::SCODE_MS_BUY, $membership->id, __('Pending', 'membership2'));
                                echo do_shortcode($code);
                            } else {
                                echo esc_html($subscription->status_text());
                            }
                            ?>
									</td>
									<td class="ms-col-expire-date"><?php 
                            if (in_array($subscription->status, $no_expire_list)) {
                                echo '&nbsp;';
                            } elseif (in_array($subscription->status, $trial_expire_list)) {
                                echo esc_html(MS_Helper_Period::format_date($subscription->trial_expire_date));
                            } elseif ($subscription->expire_date) {
                                echo esc_html(MS_Helper_Period::format_date($subscription->expire_date));
                            } else {
                                _e('Never', 'membership2');
                            }
                            ?>
</td>
								</tr>
							<?php 
                        }
                        if ($empty) {
                            $cols = 3;
                            if (MS_Model_Addon::is_enabled(MS_Model_Addon::ADDON_TRIAL)) {
                                $cols += 1;
                            }
                            printf('<tr><td colspan="%1$s">%2$s</td></tr>', $cols, __('(No Membership)', 'membership2'));
                        }
                        ?>
						</table>
					<?php 
                    } else {
                        _e('No memberships', 'membership2');
                    }
                }
                /**
                 * Add custom content right after the memberships list.
                 *
                 * @since  1.0.0
                 */
                do_action('ms_view_account_memberships_bottom', $member, $this);
                ?>
				</div>
				<?php 
            }
            // END: if ( $show_membership )
            // =============================================================
            ?>

				<?php 
            // ===================================================== PROFILE
            if ($show_profile) {
                ?>
				<div id="account-profile">
				<h2>
					<?php 
                echo $profile_title;
                if ($show_profile_change) {
                    $edit_url = esc_url_raw(add_query_arg(array('action' => MS_Controller_Frontend::ACTION_EDIT_PROFILE)));
                    printf('<a href="%s" class="ms-edit-profile">%s</a>', $edit_url, $profile_change_label);
                }
                ?>
				</h2>
				<?php 
                /**
                 * Add custom content right before the profile overview.
                 *
                 * @since  1.0.0
                 */
                do_action('ms_view_account_profile_top', $member, $this);
                ?>
				<table>
					<?php 
                foreach ($fields['personal_info'] as $field => $title) {
                    ?>
						<tr>
							<th class="ms-label-title"><?php 
                    echo esc_html($title);
                    ?>
: </th>
							<td class="ms-label-field"><?php 
                    echo esc_html($this->data['member']->{$field});
                    ?>
</td>
						</tr>
					<?php 
                }
                ?>
				</table>
				<?php 
                do_action('ms_view_shortcode_account_card_info', $this->data);
                /**
                 * Add custom content right after the profile overview.
                 *
                 * @since  1.0.0
                 */
                do_action('ms_view_account_profile_bottom', $member, $this);
                ?>
				</div>
				<?php 
            }
            // END: if ( $show_profile )
            // =============================================================
            ?>

				<?php 
            // ==================================================== INVOICES
            if ($show_invoices) {
                ?>
				<div id="account-invoices">
				<h2>
					<?php 
                echo $invoices_title;
                if ($show_all_invoices) {
                    $detail_url = esc_url_raw(add_query_arg(array('action' => MS_Controller_Frontend::ACTION_VIEW_INVOICES)));
                    printf('<a href="%s" class="ms-all-invoices">%s</a>', $detail_url, $invoices_details_label);
                }
                ?>
				</h2>
				<?php 
                /**
                 * Add custom content right before the invoice overview list.
                 *
                 * @since  1.0.0
                 */
                do_action('ms_view_account_invoices_top', $member, $this);
                ?>
				<table>
					<thead>
						<tr>
							<th class="ms-col-invoice-no"><?php 
                _e('Invoice #', 'membership2');
                ?>
</th>
							<th class="ms-col-invoice-status"><?php 
                _e('Status', 'membership2');
                ?>
</th>
							<th class="ms-col-invoice-total"><?php 
                printf('%s (%s)', __('Total', 'membership2'), MS_Plugin::instance()->settings->currency);
                ?>
</th>
							<th class="ms-col-invoice-title"><?php 
                _e('Membership', 'membership2');
                ?>
</th>
							<th class="ms-col-invoice-due"><?php 
                _e('Due date', 'membership2');
                ?>
</th>
						</tr>
					</thead>
					<tbody>
					<?php 
                foreach ($this->data['invoices'] as $invoice) {
                    $inv_membership = MS_Factory::load('MS_Model_Membership', $invoice->membership_id);
                    $inv_classes = array('ms-invoice-' . $invoice->id, 'ms-subscription-' . $invoice->ms_relationship_id, 'ms-invoice-' . $invoice->status, 'ms-gateway-' . $invoice->gateway_id, 'ms-membership-' . $invoice->membership_id, 'ms-type-' . $inv_membership->type, 'ms-payment-' . $inv_membership->payment_type);
                    ?>
						<tr class="<?php 
                    echo esc_attr(implode(' ', $inv_classes));
                    ?>
">
							<td class="ms-col-invoice-no"><?php 
                    printf('<a href="%s">%s</a>', get_permalink($invoice->id), $invoice->get_invoice_number());
                    ?>
</td>
							<td class="ms-col-invoice-status"><?php 
                    echo esc_html($invoice->status_text());
                    ?>
</td>
							<td class="ms-col-invoice-total"><?php 
                    echo esc_html(MS_Helper_Billing::format_price($invoice->total));
                    ?>
</td>
							<td class="ms-col-invoice-title"><?php 
                    echo esc_html($inv_membership->name);
                    ?>
</td>
							<td class="ms-col-invoice-due"><?php 
                    echo esc_html(MS_Helper_Period::format_date($invoice->due_date, __('F j', 'membership2')));
                    ?>
</td>
						</tr>
					<?php 
                }
                ?>
					</tbody>
				</table>
				<?php 
                /**
                 * Add custom content right after the invoices overview list.
                 *
                 * @since  1.0.0
                 */
                do_action('ms_view_account_invoices_bottom', $member, $this);
                ?>
				</div>
				<?php 
            }
            // END: if ( $show_invoices )
            // =============================================================
            ?>

				<?php 
            // ==================================================== ACTIVITY
            if ($show_activity) {
                ?>
				<div id="account-activity">
				<h2>
					<?php 
                echo $activity_title;
                if ($show_all_activities) {
                    $detail_url = esc_url_raw(add_query_arg(array('action' => MS_Controller_Frontend::ACTION_VIEW_ACTIVITIES)));
                    printf('<a href="%s" class="ms-all-activities">%s</a>', $detail_url, $activity_details_label);
                }
                ?>
				</h2>
				<?php 
                /**
                 * Add custom content right before the activities overview list.
                 *
                 * @since  1.0.0
                 */
                do_action('ms_view_account_activity_top', $member, $this);
                ?>
				<table>
					<thead>
						<tr>
							<th class="ms-col-activity-date"><?php 
                _e('Date', 'membership2');
                ?>
</th>
							<th class="ms-col-activity-title"><?php 
                _e('Activity', 'membership2');
                ?>
</th>
						</tr>
					</thead>
					<tbody>
					<?php 
                foreach ($this->data['events'] as $event) {
                    $ev_classes = array('ms-activity-topic-' . $event->topic, 'ms-activity-type-' . $event->type, 'ms-membership-' . $event->membership_id);
                    ?>
						<tr class="<?php 
                    echo esc_attr(implode(' ', $ev_classes));
                    ?>
">
							<td class="ms-col-activity-date"><?php 
                    echo esc_html(MS_Helper_Period::format_date($event->post_modified));
                    ?>
</td>
							<td class="ms-col-activity-title"><?php 
                    echo esc_html($event->description);
                    ?>
</td>
						</tr>
					<?php 
                }
                ?>
					</tbody>
				</table>
				<?php 
                /**
                 * Add custom content right after the activities overview list.
                 *
                 * @since  1.0.0
                 */
                do_action('ms_view_account_activity_bottom', $member, $this);
                ?>
				</div>
				<?php 
            }
            // END: if ( $show_activity )
            // =============================================================
            ?>

			<?php 
        } else {
            $has_login_form = MS_Helper_Shortcode::has_shortcode(MS_Helper_Shortcode::SCODE_LOGIN, $post->post_content);
            if (!$has_login_form) {
                $redirect = esc_url_raw(add_query_arg(array()));
                $title = __('Your account', 'membership2');
                $scode = sprintf('[%1$s redirect="%2$s" title="%3$s"]', MS_Helper_Shortcode::SCODE_LOGIN, esc_url($redirect), esc_attr($title));
                echo do_shortcode($scode);
            }
        }
        ?>
		</div>
		<?php 
        $html = ob_get_clean();
        $html = apply_filters('ms_compact_code', $html);
        return apply_filters('ms_shortcode_account', $html, $this->data);
    }
    /**
     * Returns the HTML code.
     *
     * @since  1.0.0
     * @return string
     */
    public function to_html()
    {
        $fields = $this->prepare_fields();
        $this->add_action('ms_shortcode_register_form_end', 'add_scripts');
        // When redirecting to login form we want to keep the previously submitted form data.
        $url_data = $_POST;
        $url_data['do-login'] = '******';
        $login_url = esc_url_raw(add_query_arg($url_data));
        if (!empty($_REQUEST['do-login'])) {
            $register_url = esc_url_raw(remove_query_arg('do-login'));
            $back_link = array('url' => $register_url, 'class' => 'alignleft', 'value' => __('Cancel', MS_TEXT_DOMAIN));
            $html = do_shortcode(sprintf('[%s show_note=false title="%s"]', MS_Helper_Shortcode::SCODE_LOGIN, __('Login', MS_TEXT_DOMAIN)));
            $html .= MS_Helper_Html::html_link($back_link, true);
            return $html;
        }
        $login_link = array('title' => __('Login', MS_TEXT_DOMAIN), 'url' => $login_url, 'class' => 'alignleft', 'value' => __('Already have a user account?', MS_TEXT_DOMAIN));
        $register_button = array('id' => 'register', 'type' => MS_Helper_Html::INPUT_TYPE_SUBMIT, 'value' => $this->data['label_register']);
        $title = $this->data['title'];
        ob_start();
        $reg_url = MS_Model_Pages::get_page_url(MS_Model_Pages::MS_PAGE_REGISTER);
        $reg_url = esc_url_raw(add_query_arg('action', 'register_user', $reg_url));
        // Default WP action hook
        do_action('before_signup_form');
        ?>
		<div class="ms-membership-form-wrapper">
			<?php 
        $this->render_errors();
        ?>
			<form
				id="ms-shortcode-register-user-form"
				class="form-membership"
				action="<?php 
        echo esc_url($reg_url);
        ?>
"
				method="post">

				<?php 
        wp_nonce_field($this->data['action']);
        ?>
				<?php 
        if (!empty($title)) {
            ?>
					<legend>
						<?php 
            echo $title;
            ?>
					</legend>
				<?php 
        }
        ?>

				<?php 
        foreach ($fields as $field) {
            if (is_string($field)) {
                MS_Helper_Html::html_element($field);
            } elseif (MS_Helper_Html::INPUT_TYPE_HIDDEN == $field['type']) {
                MS_Helper_Html::html_element($field);
            } else {
                ?>
						<div class="ms-form-element ms-form-element-<?php 
                echo esc_attr($field['id']);
                ?>
">
							<?php 
                MS_Helper_Html::html_element($field);
                ?>
						</div>
						<?php 
            }
        }
        echo '<div class="ms-extra-fields">';
        /**
         * Trigger default WordPress action to allow other plugins
         * to add custom fields to the registration form.
         *
         * signup_extra_fields Defined in wp-signup.php which is used
         *              for Multisite signup process.
         *
         * register_form Defined in wp-login.php which is only used for
         *              Single site registration process.
         *
         * @since  1.0.0
         */
        if (is_multisite()) {
            $empty_error = new WP_Error();
            do_action('signup_extra_fields', $empty_error);
        } else {
            do_action('register_form');
            // Always on the register form.
        }
        echo '</div>';
        MS_Helper_Html::html_element($register_button);
        if (is_wp_error($this->error)) {
            /**
             * Display registration errors.
             *
             * @since  1.0.0
             */
            do_action('registration_errors', $this->error);
        }
        /**
         * This hook is intended to output hidden fields or JS code
         * at the end of the form tag.
         *
         * @since  1.0.1.0
         */
        do_action('ms_shortcode_register_form_end', $this);
        ?>
			</form>
			<?php 
        if ($this->data['loginlink']) {
            MS_Helper_Html::html_link($login_link);
        }
        ?>
		</div>
		<?php 
        // Default WP action hook.
        do_action('signup_blogform', array());
        do_action('after_signup_form');
        $html = ob_get_clean();
        $html = apply_filters('ms_compact_code', $html);
        return apply_filters('ms_shortcode_register', $html, $this->data);
    }
Пример #24
0
 /**
  * Process purchase using gateway.
  *
  * Related Action Hooks:
  * - ms_controller_frontend_signup_process_purchase
  *
  * @since  1.0.0
  */
 public function process_purchase()
 {
     $fields = array('gateway', 'ms_relationship_id');
     lib2()->array->equip_request('gateway', 'ms_relationship_id');
     $valid = true;
     $nonce_name = $_REQUEST['gateway'] . '_' . $_REQUEST['ms_relationship_id'];
     if (!self::validate_required($fields, 'any')) {
         $valid = false;
         $err = 'GAT-01 (invalid fields)';
     } elseif (!MS_Model_Gateway::is_valid_gateway($_REQUEST['gateway'])) {
         $valid = false;
         $err = 'GAT-02 (invalid gateway)';
     } elseif (!$this->verify_nonce($nonce_name, 'any')) {
         $valid = false;
         $err = 'GAT-03 (invalid nonce)';
     }
     if ($valid) {
         $subscription = MS_Factory::load('MS_Model_Relationship', $_REQUEST['ms_relationship_id']);
         $gateway_id = $_REQUEST['gateway'];
         $gateway = MS_Model_Gateway::factory($gateway_id);
         try {
             $invoice = $gateway->process_purchase($subscription);
             // If invoice is successfully paid, redirect to welcome page.
             if ($invoice->is_paid() || $invoice->uses_trial && MS_Model_Invoice::STATUS_BILLED == $invoice->status) {
                 // Make sure to respect the single-membership rule
                 $this->validate_membership_states($subscription);
                 // Redirect user to the Payment-Completed page.
                 if (!defined('IS_UNIT_TEST')) {
                     MS_Model_Pages::redirect_to(MS_Model_Pages::MS_PAGE_REG_COMPLETE, array('ms_relationship_id' => $subscription->id));
                 }
             } elseif (MS_Gateway_Manual::ID == $gateway_id) {
                 // For manual gateway payments.
                 $this->add_action('the_content', 'purchase_info_content');
             } else {
                 // Something went wrong, the payment was not successful.
                 $this->add_action('the_content', 'purchase_error_content');
             }
         } catch (Exception $e) {
             MS_Helper_Debug::log($e->getMessage());
             switch ($gateway_id) {
                 case MS_Gateway_Authorize::ID:
                     $_POST['auth_error'] = $e->getMessage();
                     // call action to step back
                     do_action('ms_controller_frontend_signup_gateway_form');
                     break;
                 case MS_Gateway_Stripe::ID:
                     $_POST['error'] = sprintf(__('Error: %s', MS_TEXT_DOMAIN), $e->getMessage());
                     // Hack to send the error message back to the payment_table.
                     MS_Plugin::instance()->controller->controllers['frontend']->add_action('the_content', 'payment_table', 1);
                     break;
                 default:
                     do_action('ms_controller_gateway_form_error', $e);
                     $this->add_action('the_content', 'purchase_error_content');
                     break;
             }
         }
     } else {
         MS_Helper_Debug::log('Error Code ' . $err);
         $this->add_action('the_content', 'purchase_error_content');
     }
     // Hack to show signup page in case of errors
     $ms_page = MS_Model_Pages::get_page(MS_Model_Pages::MS_PAGE_REGISTER);
     if ($ms_page) {
         // During unit-testing the $ms_page object might be empty.
         global $wp_query;
         $wp_query->query_vars['page_id'] = $ms_page->ID;
         $wp_query->query_vars['post_type'] = 'page';
     }
     do_action('ms_controller_gateway_process_purchase_after', $this);
 }
    /**
     * Output the HTML content of a single membership box.
     * This includes the membership name, description, price and the action
     * button (Sign-up, Cancel, etc.)
     *
     * @since  1.0.0
     * @param  MS_Model_Membership $membership
     * @param  string $action
     * @param  string $msg
     * @param  MS_Model_Relationship $subscription
     */
    private function membership_box_html($membership, $action, $msg = null, $subscription = null)
    {
        $fields = $this->prepare_fields($membership->id, $action, $this->data['step'], $membership->_move_from);
        $settings = MS_Factory::load('MS_Model_Settings');
        if (0 == $membership->price) {
            $price = __('Free', MS_TEXT_DOMAIN);
        } else {
            $price = sprintf('%s %s', $settings->currency, MS_Helper_Billing::format_price($membership->total_price));
        }
        $price = apply_filters('ms_membership_price', $price, $membership);
        if (is_user_logged_in()) {
            $current = MS_Model_Pages::MS_PAGE_MEMBERSHIPS;
        } else {
            $current = MS_Model_Pages::MS_PAGE_REGISTER;
        }
        $url = MS_Model_Pages::get_page_url($current);
        $classes = array('ms-membership-details-wrapper', 'ms-signup', 'ms-membership-' . $membership->id, 'ms-type-' . $membership->type, 'ms-payment-' . $membership->payment_type, $membership->trial_period_enabled ? 'ms-with-trial' : 'ms-no-trial', 'ms-status-' . ($subscription ? $subscription->status : 'none'), 'ms-subscription-' . ($subscription ? $subscription->id : 'none'));
        ?>
		<form action="<?php 
        echo esc_url($url);
        ?>
" class="ms-membership-form" method="post">
			<div id="ms-membership-wrapper-<?php 
        echo esc_attr($membership->id);
        ?>
" class="<?php 
        echo esc_attr(implode(' ', $classes));
        ?>
">
				<div class="ms-top-bar">
					<h4><span class="ms-title"><?php 
        echo esc_html($membership->name);
        ?>
</span></h4>
				</div>
				<div class="ms-price-details">
					<div class="ms-description"><?php 
        echo '' . $membership->description;
        ?>
</div>
					<div class="ms-price price"><?php 
        echo esc_html($price);
        ?>
</div>

					<?php 
        if ($msg) {
            ?>
						<div class="ms-bottom-msg"><?php 
            echo '' . $msg;
            ?>
</div>
					<?php 
        }
        ?>
				</div>

				<div class="ms-bottom-bar">
					<?php 
        $class = apply_filters('ms_view_shortcode_membershipsignup_form_button_class', 'ms-signup-button ' . esc_attr($action));
        $button = array('id' => 'submit', 'type' => MS_Helper_Html::INPUT_TYPE_SUBMIT, 'value' => esc_html($this->data["{$action}_text"]), 'class' => $class);
        if (MS_Helper_Membership::MEMBERSHIP_ACTION_CANCEL === $action) {
            /**
             * PayPal Standard Gateway uses a special Cancel button.
             *
             * @see MS_Controller_Gateway
             */
            $button = apply_filters('ms_view_shortcode_membershipsignup_cancel_button', $button, $subscription, $this);
        } elseif (MS_Helper_Membership::MEMBERSHIP_ACTION_PAY === $action) {
            // Paid membership: Display a Cancel button
            $cancel_action = MS_Helper_Membership::MEMBERSHIP_ACTION_CANCEL;
            $url = $this->get_action_url($membership->id, $cancel_action, '');
            $link = array('url' => $url, 'class' => 'ms-cancel-button button', 'value' => esc_html($this->data["{$cancel_action}_text"]));
            MS_Helper_Html::html_link($link);
        }
        wp_nonce_field($fields['action']['value']);
        foreach ($fields as $field) {
            MS_Helper_Html::html_element($field);
        }
        MS_Helper_Html::html_element($button);
        ?>
				</div>
			</div>
		</form>
		<?php 
        do_action('ms_show_prices');
    }
 /**
  * Link to the Membership account page shortcode.
  *
  * @since  1.0.0
  *
  * @param mixed[] $atts Shortcode attributes.
  */
 public function membership_account_link($atts)
 {
     MS_Helper_Shortcode::did_shortcode(MS_Helper_Shortcode::SCODE_MS_ACCOUNT_LINK);
     $html = '';
     $data = apply_filters('ms_controller_shortcode_membership_account_link_atts', shortcode_atts(array('label' => __('Visit your account page for more information.', 'membership2')), $atts));
     $html = sprintf('<a href="%1$s">%2$s</a>', MS_Model_Pages::get_page_url(MS_Model_Pages::MS_PAGE_ACCOUNT), $data['label']);
     return apply_filters('ms_controller_shortcode_protected_content', $html, $this);
 }
 /**
  * Manages settings actions.
  *
  * Verifies GET and POST requests to manage settings.
  *
  * @since  1.0.0
  */
 public function admin_settings_manager()
 {
     MS_Helper_Settings::print_admin_message();
     $this->get_active_tab();
     $msg = 0;
     $redirect = false;
     if ($this->is_admin_user()) {
         if ($this->verify_nonce() || $this->verify_nonce(null, 'GET')) {
             /**
              * After verifying permissions those filters can be used by Add-ons
              * to process their own settings form.
              *
              * @since  1.0.1.0
              */
             do_action('ms_admin_settings_manager-' . $this->active_tab);
             do_action('ms_admin_settings_manager', $this->active_tab);
             switch ($this->active_tab) {
                 case self::TAB_GENERAL:
                     lib3()->array->equip_request('action', 'network_site');
                     $action = $_REQUEST['action'];
                     $redirect = esc_url_raw(remove_query_arg(array('msg' => $msg)));
                     // See if we change settings for the network-wide mode.
                     if (MS_Plugin::is_network_wide()) {
                         $new_site_id = intval($_REQUEST['network_site']);
                         if ('network_site' == $action && !empty($new_site_id)) {
                             $old_site_id = MS_Model_Pages::get_setting('site_id');
                             if ($old_site_id != $new_site_id) {
                                 MS_Model_Pages::set_setting('site_id', $new_site_id);
                                 $msg = MS_Helper_Settings::SETTINGS_MSG_SITE_UPDATED;
                                 $redirect = esc_url_raw(add_query_arg(array('msg' => $msg)));
                             }
                         }
                     }
                     break;
                 case self::TAB_IMPORT:
                     $tool = MS_Factory::create('MS_Controller_Import');
                     // Output is passed to the view via self::_message()
                     $tool->process();
                     break;
                 case self::TAB_PAYMENT:
                 case self::TAB_MESSAGES:
                     break;
                 default:
                     break;
             }
         }
     }
     if ($redirect) {
         wp_safe_redirect($redirect);
         exit;
     }
 }
 /**
  * Returns the height needed to display this dialog inside a popup without
  * adding scrollbars
  *
  * @since  1.0.0
  * @return int Popup height
  */
 public function dialog_height()
 {
     switch ($this->form_type) {
         case 'short':
             $height = 200;
             break;
         case 'full':
         default:
             if (MS_Model_Pages::can_edit_menus()) {
                 $height = 412;
             } else {
                 $height = 460;
             }
             break;
     }
     return $height;
 }
 /**
  * Filter returns the default contents of a Membership Page if the URL param
  * &ms-default=1 is set.
  *
  * Effectively this will display the default contents inside the Post-Editor
  * without changing the page itself. Only after the user saves the content
  * it will affect the Membership page
  *
  * @since  1.0.0
  * @param  string $content Default page content.
  * @return string Modified page content.
  */
 public function show_default_content($content)
 {
     static $Message = false;
     global $post, $post_type;
     if (!isset($_GET['ms-default'])) {
         return $content;
     }
     if ('1' != $_GET['ms-default']) {
         return $content;
     }
     if ('page' != $post_type) {
         return $content;
     }
     $ms_page = MS_Model_Pages::get_page_by('id', $post->ID);
     if (empty($ms_page)) {
         return $content;
     }
     $type = MS_Model_Pages::get_page_type($ms_page);
     if (!$Message) {
         $Message = true;
         lib3()->ui->admin_message(__('<strong>Tipp</strong>:<br />' . 'The page content is reset to the default content but is <em>not saved yet</em>!<br />' . 'You can simply close this page to keep your current page contents.', 'membership2'));
     }
     return MS_Model_Pages::get_default_content($type);
 }
 /**
  * Replace comm_vars with corresponding values.
  *
  * @since  1.0.0
  *
  * @param MS_Model_Relationship $subscription The membership relationship to send message to.
  * @param WP_User $wp_user The wordpress user object to get info from.
  * @return array {
  *     Returns array of ( $var_name => $var_replace ).
  *
  *     @type string $var_name The variable name to replace.
  *     @type string $var_replace The variable corresponding replace string.
  * }
  */
 public function get_comm_vars($subscription, $wp_user)
 {
     $currency = MS_Plugin::instance()->settings->currency . ' ';
     $membership = $subscription->get_membership();
     $invoice = null;
     // First try to fetch the current invoice.
     $invoice = $subscription->get_current_invoice(false);
     $prev_invoice = $subscription->get_previous_invoice();
     // If no current invoice exists then fetch the previous invoice.
     if (empty($invoice)) {
         $invoice = $prev_invoice;
     }
     $comm_vars = apply_filters('ms_model_communication_comm_vars', $this->comm_vars);
     foreach ($comm_vars as $key => $description) {
         switch ($key) {
             case self::COMM_VAR_BLOG_NAME:
                 $comm_vars[$key] = get_option('blogname');
                 break;
             case self::COMM_VAR_BLOG_URL:
                 $comm_vars[$key] = get_option('home');
                 break;
             case self::COMM_VAR_USERNAME:
                 $comm_vars[$key] = $wp_user->user_login;
                 break;
             case self::COMM_VAR_USER_DISPLAY_NAME:
                 $comm_vars[$key] = $wp_user->display_name;
                 break;
             case self::COMM_VAR_USER_FIRST_NAME:
                 $comm_vars[$key] = $wp_user->user_firstname;
                 break;
             case self::COMM_VAR_USER_LAST_NAME:
                 $comm_vars[$key] = $wp_user->user_lastname;
                 break;
             case self::COMM_VAR_NET_NAME:
                 $comm_vars[$key] = get_site_option('site_name');
                 break;
             case self::COMM_VAR_NET_URL:
                 $comm_vars[$key] = get_site_option('siteurl');
                 break;
             case self::COMM_VAR_MS_NAME:
                 if ($membership->name) {
                     $comm_vars[$key] = $membership->name;
                 } else {
                     $comm_vars[$key] = '';
                 }
                 break;
             case self::COMM_VAR_MS_INVOICE:
                 if (isset($invoice) && ($invoice->total > 0 || $invoice->uses_trial)) {
                     $attr = array('post_id' => $invoice->id, 'pay_button' => 0);
                     $scode = MS_Factory::load('MS_Controller_Shortcode');
                     $comm_vars[$key] = $scode->membership_invoice($attr);
                 } else {
                     $comm_vars[$key] = '';
                 }
                 break;
             case self::COMM_VAR_MS_ACCOUNT_PAGE_URL:
                 $comm_vars[$key] = sprintf('<a href="%s">%s</a>', MS_Model_Pages::get_page_url(MS_Model_Pages::MS_PAGE_ACCOUNT), __('account page', MS_TEXT_DOMAIN));
                 break;
             case self::COMM_VAR_MS_REMAINING_DAYS:
                 $days = $subscription->get_remaining_period();
                 $comm_vars[$key] = sprintf(__('%s day%s', MS_TEXT_DOMAIN), $days, abs($days) > 1 ? 's' : '');
                 break;
             case self::COMM_VAR_MS_REMAINING_TRIAL_DAYS:
                 $days = $subscription->get_remaining_trial_period();
                 $comm_vars[$key] = sprintf(__('%s day%s', MS_TEXT_DOMAIN), $days, abs($days) > 1 ? 's' : '');
                 break;
             case self::COMM_VAR_MS_EXPIRY_DATE:
                 $comm_vars[$key] = $subscription->expire_date;
                 break;
         }
         $comm_vars[$key] = apply_filters('ms_model_communication_send_message_comm_var_' . $key, $comm_vars[$key], $subscription);
     }
     return apply_filters('ms_model_communication_get_comm_vars', $comm_vars);
 }