コード例 #1
0
 /**
  * Initialize the admin-side functions.
  *
  * @since  1.0.0
  */
 public function admin_init()
 {
     $hook = MS_Controller_Plugin::admin_page_hook('protection');
     $this->run_action('load-' . $hook, 'admin_page_process');
     $this->run_action('admin_print_scripts-' . $hook, 'enqueue_scripts');
     $this->run_action('admin_print_styles-' . $hook, 'enqueue_styles');
 }
コード例 #2
0
 /**
  * Prepare html fields.
  *
  * @since  1.0.0
  *
  * @return array
  */
 function prepare_fields()
 {
     $invoice = $this->data['invoice'];
     $currency = MS_Plugin::instance()->settings->currency;
     $user_name = '';
     $transaction_link = '';
     $user_id = 0;
     $user_list = array();
     if ($invoice->id) {
         $member = $invoice->get_member();
         $user_id = $member->id;
         $user_name = $member->name;
         $transaction_link = sprintf('<a href="%s" target="_blank">%s</a>', MS_Controller_Plugin::get_admin_url('billing', array('show' => 'logs', 'invoice' => $invoice->id)), __('Show Transactions', 'membership2'));
     } else {
         $user_list = MS_Model_Member::get_usernames(null, MS_Model_Member::SEARCH_ALL_USERS);
     }
     $fields = array('link_transactions' => array('id' => 'link_transactions', 'title' => $transaction_link, 'type' => MS_Helper_Html::TYPE_HTML_TEXT, 'wrapper_class' => 'ms-transactions-link'), 'txt_user' => array('id' => 'txt_user', 'title' => __('Invoice for member', 'membership2'), 'type' => MS_Helper_Html::TYPE_HTML_TEXT, 'value' => sprintf('<a href="%s">%s</a>', MS_Controller_Plugin::get_admin_url('add-member', array('user_id' => $user_id)), $user_name)), 'txt_membership' => array('id' => 'txt_membership', 'title' => __('Payment for membership', 'membership2'), 'type' => MS_Helper_Html::TYPE_HTML_TEXT), 'txt_created' => array('id' => 'txt_created', 'title' => __('Invoice created on', 'membership2'), 'type' => MS_Helper_Html::TYPE_HTML_TEXT), 'txt_separator' => array('type' => MS_Helper_Html::TYPE_HTML_SEPARATOR), 'status' => array('id' => 'status', 'title' => __('Invoice status', 'membership2'), 'type' => MS_Helper_Html::INPUT_TYPE_SELECT, 'field_options' => MS_Model_Invoice::get_status_types(true), 'value' => $invoice->status), 'user_id' => array('id' => 'user_id', 'title' => __('Invoice for member', 'membership2'), 'type' => MS_Helper_Html::INPUT_TYPE_SELECT, 'value' => $invoice->user_id, 'field_options' => $user_list), 'membership_id' => array('id' => 'membership_id', 'title' => __('Payment for membership', 'membership2'), 'type' => MS_Helper_Html::INPUT_TYPE_SELECT, 'value' => $invoice->membership_id, 'field_options' => $this->data['memberships']), 'amount' => array('id' => 'amount', 'title' => sprintf(__('Amount (%s)', 'membership2'), $currency), 'type' => MS_Helper_Html::INPUT_TYPE_NUMBER, 'value' => MS_Helper_Billing::format_price($invoice->amount), 'config' => array('step' => 'any', 'min' => 0)), 'discount' => array('id' => 'discount', 'title' => sprintf(__('Discount (%s)', 'membership2'), $currency), 'type' => MS_Helper_Html::INPUT_TYPE_NUMBER, 'value' => MS_Helper_Billing::format_price($invoice->discount), 'config' => array('step' => 'any', 'min' => 0)), 'due_date' => array('id' => 'due_date', 'title' => __('Due date', 'membership2'), 'type' => MS_Helper_Html::INPUT_TYPE_DATEPICKER, 'value' => $invoice->due_date), 'description' => array('id' => 'description', 'title' => __('Description', 'membership2'), 'type' => MS_Helper_Html::INPUT_TYPE_TEXT, 'class' => 'widefat', 'value' => $invoice->description), 'notes' => array('id' => 'notes', 'title' => __('Notes', 'membership2'), 'type' => MS_Helper_Html::INPUT_TYPE_TEXT_AREA, 'class' => 'widefat', 'value' => $invoice->get_notes_desc()), 'invoice_id' => array('id' => 'invoice_id', 'type' => MS_Helper_Html::INPUT_TYPE_HIDDEN, 'value' => $invoice->id), '_wpnonce' => array('id' => '_wpnonce', 'type' => MS_Helper_Html::INPUT_TYPE_HIDDEN, 'value' => wp_create_nonce($this->data['action'])), 'action' => array('id' => 'action', 'type' => MS_Helper_Html::INPUT_TYPE_HIDDEN, 'value' => $this->data['action']), 'separator' => array('type' => MS_Helper_Html::TYPE_HTML_SEPARATOR), 'execute' => array('id' => 'execute', 'title' => __('Execute status change actions on Save (add/remove membership)', 'membership2'), 'type' => MS_Helper_Html::INPUT_TYPE_CHECKBOX, 'value' => true), 'cancel' => array('id' => 'cancel', 'type' => MS_Helper_Html::TYPE_HTML_LINK, 'title' => __('Cancel', 'membership2'), 'value' => __('Cancel', 'membership2'), 'url' => esc_url_raw(remove_query_arg(array('action', 'invoice_id'))), 'class' => 'wpmui-field-button button'), 'submit' => array('id' => 'submit', 'type' => MS_Helper_Html::INPUT_TYPE_SUBMIT, 'value' => __('Save Changes', 'membership2')));
     if ($invoice->id > 0) {
         $fields['user_id']['type'] = MS_Helper_Html::INPUT_TYPE_HIDDEN;
         $fields['membership_id']['type'] = MS_Helper_Html::INPUT_TYPE_HIDDEN;
         $fields['txt_membership']['value'] = $this->data['memberships'][$invoice->membership_id];
         $fields['txt_created']['value'] = MS_Helper_Period::format_date($invoice->invoice_date);
     } else {
         unset($fields['txt_user']);
         unset($fields['txt_membership']);
         unset($fields['txt_created']);
         unset($fields['txt_separator']);
     }
     return apply_filters('ms_view_billing_edit_prepare_fields', $fields, $this);
 }
    /**
     * Create view output.
     *
     * @since  1.0.0
     *
     * @return string
     */
    public function to_html()
    {
        $code_list = MS_Factory::create('MS_Addon_Invitation_Helper_Listtable');
        $code_list->prepare_items();
        $title = __('Invitations', 'membership2');
        $add_new_button = array('id' => 'add_new', 'type' => MS_Helper_Html::TYPE_HTML_LINK, 'url' => MS_Controller_Plugin::get_admin_url(MS_Addon_Invitation::SLUG, array('action' => 'edit', 'invitation_id' => 0)), 'value' => __('Add New Code', 'membership2'), 'class' => 'button');
        ob_start();
        ?>
		<div class="wrap ms-wrap">
			<?php 
        MS_Helper_Html::settings_header(array('title' => $title, 'title_icon_class' => 'wpmui-fa wpmui-fa-ticket'));
        ?>
			<div>
				<?php 
        MS_Helper_Html::html_element($add_new_button);
        ?>
			</div>

			<form action="" method="post">
				<?php 
        $code_list->display();
        ?>
			</form>
			<p><em>
				<?php 
        _e('By default all Memberships are protected and require an invitation code to register.<br>You can manually change this for individual memberships via a new setting in the "Payment Options" settings of each membership.', 'membership2');
        ?>
			</em></p>
		</div>

		<?php 
        $html = ob_get_clean();
        return apply_filters('ms_addon_invitation_view_list_to_html', $html, $this);
    }
コード例 #4
0
    /**
     * Create view output.
     *
     * @since  1.0.0
     *
     * @return string
     */
    public function to_html()
    {
        $coupon_list = MS_Factory::create('MS_Addon_Coupon_Helper_Listtable');
        $coupon_list->prepare_items();
        $title = __('Coupons', MS_TEXT_DOMAIN);
        $add_new_button = array('id' => 'add_new', 'type' => MS_Helper_Html::TYPE_HTML_LINK, 'url' => MS_Controller_Plugin::get_admin_url('coupons', array('action' => 'edit', 'coupon_id' => 0)), 'value' => __('Add New Coupon', MS_TEXT_DOMAIN), 'class' => 'button');
        ob_start();
        ?>
		<div class="wrap ms-wrap">
			<?php 
        MS_Helper_Html::settings_header(array('title' => $title, 'title_icon_class' => 'wpmui-fa wpmui-fa-credit-card'));
        ?>
			<div>
				<?php 
        MS_Helper_Html::html_element($add_new_button);
        ?>
			</div>

			<form action="" method="post">
				<?php 
        $coupon_list->display();
        ?>
			</form>
		</div>

		<?php 
        $html = ob_get_clean();
        return apply_filters('ms_addon_coupon_view_list_to_html', $html, $this);
    }
コード例 #5
0
 /**
  * Initialize the admin-side functions.
  *
  * @since  1.0.0
  */
 public function admin_init()
 {
     $hook = MS_Controller_Plugin::admin_page_hook('billing');
     $this->run_action('load-' . $hook, 'admin_billing_manager');
     $this->run_action('admin_print_scripts-' . $hook, 'enqueue_scripts');
     $this->run_action('admin_print_styles-' . $hook, 'enqueue_styles');
 }
コード例 #6
0
    /**
     * Returns the contens of the dialog
     *
     * @since  1.0.0
     *
     * @return object
     */
    public function get_contents($data)
    {
        $subscription = $data['model'];
        $gateways = MS_Model_Gateway::get_gateway_names();
        $invoices = $subscription->get_invoices();
        $pay_details = array();
        $inv_details = array();
        foreach ($subscription->get_payments() as $payment) {
            if (isset($gateways[$payment['gateway']])) {
                $gateway = $gateways[$payment['gateway']];
            } else {
                $gateway = '(' . $payment['gateway'] . ')';
            }
            $pay_details[] = array('title' => __('Recorded Payment', 'membership2'), 'type' => MS_Helper_Html::TYPE_HTML_TABLE, 'value' => array(0 => array('Payment Date', $payment['date']), 1 => array('Payment Gateway', $gateway), 2 => array('Amount', $payment['amount']), 3 => array('External ID', $payment['external_id'])), 'field_options' => array('head_col' => true));
        }
        $invoice_list = array();
        foreach ($invoices as $invoice) {
            if (isset($gateways[$invoice->gateway_id])) {
                $gateway = $gateways[$invoice->gateway_id];
            } else {
                $gateway = '(' . $invoice->gateway_id . ')';
            }
            $transaction_log = sprintf(' <small>- <a href="%s" target="_blank">%s</a></small>', MS_Controller_Plugin::get_admin_url('billing', array('show' => 'logs', 'invoice' => $invoice->id)), __('Show Transaction', 'membership2'));
            $invoice_list[] = $invoice->id;
            $inv_details[$invoice->id] = array('title' => sprintf(__('Invoice %s', 'membership2'), $invoice->id), 'type' => MS_Helper_Html::TYPE_HTML_TABLE, 'value' => array(0 => array('Invoice ID', $invoice->id . $transaction_log), 2 => array('Create Date', $invoice->invoice_date), 1 => array('Payment Gateway', $gateway), 2 => array('Due Date', $invoice->due_date), 3 => array('Regular amount', $invoice->amount), 4 => array('Total billed', $invoice->total), 5 => array('Status', $invoice->status), 6 => array('Notes', $invoice->description), 7 => array('Checkout IP', $invoice->checkout_ip), 8 => array('Checkout Date', $invoice->checkout_date)), 'field_options' => array('head_col' => true));
            if ($invoice->amount == $invoice->total) {
                unset($inv_details[$invoice->id]['value'][3]);
                $inv_details[$invoice->id]['value'] = array_values($inv_details[$invoice->id]['value']);
            }
        }
        $transaction_url = MS_Controller_Plugin::get_admin_url('billing', array('show' => 'logs', 'invoice' => implode(',', $invoice_list)));
        $transaction_log = array('type' => MS_Helper_Html::TYPE_HTML_LINK, 'value' => __('Show all Transactions for this subscription', 'membership2'), 'url' => $transaction_url, 'target' => '_blank');
        ob_start();
        ?>
		<div class="wpmui-grid-8 ms-payment-infos">
			<div class="col-5">
				<?php 
        foreach ($inv_details as $detail) {
            MS_Helper_Html::html_element($detail);
        }
        ?>
			</div>
			<div class="col-3">
				<?php 
        MS_Helper_Html::html_element($transaction_log);
        MS_Helper_Html::html_separator();
        foreach ($pay_details as $detail) {
            MS_Helper_Html::html_element($detail);
        }
        ?>
			</div>
		</div>
		<?php 
        $html = ob_get_clean();
        return apply_filters('ms_view_member_payment_to_html', $html);
    }
 public function column_members($item, $column_name)
 {
     $html = '';
     if (!$item->is_system()) {
         $count = $item->get_members_count();
         $url = MS_Controller_Plugin::get_admin_url('members', array('membership_id' => $item->id));
         $html = sprintf('<a href="%2$s">%1$s</a>', intval($count), $url);
     }
     return $html;
 }
コード例 #8
0
    /**
     * Show manual purchase/payment information.
     *
     * Returns a default messsage if gateway is not configured.
     *
     * @hook ms_controller_gateway_purchase_info_content
     *
     * @since  1.0.0
     * @return string The payment info.
     */
    public function purchase_info_content()
    {
        static $Processed = false;
        /**
         * If some plugin calls `the_content()` multiple times then this
         * function will also run multiple times.
         * We want to process the details only once, so we have this condition!
         */
        if (!$Processed) {
            $Processed = true;
            do_action('ms_gateway_manual_purchase_info_content_before', $this);
            if (empty($this->payment_info)) {
                $link = MS_Controller_Plugin::get_admin_url('settings');
                ob_start();
                ?>
					<?php 
                _e('This is only an example of manual payment gateway instructions', 'membership2');
                ?>
					<br />
					<?php 
                printf(__('Edit it %shere%s', 'membership2'), '<a href="' . $link . '">', '</a>');
                ?>
					<br /><br />
					<?php 
                _e('Name: Example name.', 'membership2');
                ?>
					<br />
					<?php 
                _e('Bank: Example bank.', 'membership2');
                ?>
					<br />
					<?php 
                _e('Bank account: Example bank account 1234.', 'membership2');
                ?>
					<br />
				<?php 
                $this->payment_info = ob_get_clean();
            }
            $this->payment_info = wpautop($this->payment_info);
            if (!empty($_POST['ms_relationship_id'])) {
                $subscription = MS_Factory::load('MS_Model_Relationship', $_POST['ms_relationship_id']);
                $invoice = $subscription->get_current_invoice();
                $this->payment_info .= sprintf('<div class="ms-manual-price">%s: <span class="ms-price">%s%s</span></div>', __('Total value', 'membership2'), $invoice->currency, $invoice->total);
                // The user did make his intention to pay the invoice. Set status
                // to billed.
                $invoice->status = MS_Model_Invoice::STATUS_BILLED;
                $invoice->save();
            }
        }
        return apply_filters('ms_gateway_manual_purchase_info_content', $this->payment_info);
    }
コード例 #9
0
 /**
  * Hook to add custom transaction status.
  *
  * @since  1.0.0
  */
 public function after_load()
 {
     parent::after_load();
     $this->id = self::ID;
     $this->name = __('PayPal Standard Gateway', MS_TEXT_DOMAIN);
     $this->group = 'PayPal';
     $this->manual_payment = false;
     // Recurring charged automatically
     $this->pro_rate = false;
     if ($this->active && $this->is_live_mode() && strpos($this->merchant_id, '@')) {
         $settings_url = MS_Controller_Plugin::get_admin_url('settings', array('tab' => MS_Controller_Settings::TAB_PAYMENT));
         lib2()->ui->admin_message(sprintf(__('Warning: You use your email address for the PayPal Standard gateway instead of your Merchant ID. Please check %syour payment settings%s and enter the Merchant ID instead', MS_TEXT_DOMAIN), '<a href="' . $settings_url . '">', '</a>'), 'err');
     }
 }
コード例 #10
0
    public function render_tab()
    {
        $fields = $this->prepare_fields();
        ob_start();
        ?>
		<div class="ms-addon-wrap">
			<?php 
        MS_Helper_Html::settings_tab_header(array('title' => __('Redirect Settings', 'membership2'), 'desc' => array(__('Specify your custom URLs here. You can use either an absolute URL (starting with "http://") or an site-relative path (like "/some-page/")', 'membership2'), sprintf(__('The URLs you specify here can always be overwritten in the %slogin shortcode%s using the redirect-attributes. Example: <code>[%s redirect_login="******" redirect_logout="/good-bye/"]</code>.', 'membership2'), sprintf('<a href="%s#ms-membership-login" target="_blank">', MS_Controller_Plugin::get_admin_url('help', array('tab' => 'shortcodes'))), '</a>', MS_Helper_Shortcode::SCODE_LOGIN))));
        foreach ($fields as $field) {
            MS_Helper_Html::html_element($field);
        }
        ?>
		</div>
		<?php 
        $html = ob_get_clean();
        echo $html;
    }
    /**
     * Returns the HTML code of the Settings form.
     *
     * @since  1.0.0
     * @return string
     */
    public function render_tab()
    {
        $fields = $this->prepare_fields();
        $manage_url = MS_Controller_Plugin::get_admin_url('settings', array('tab' => MS_Addon_Attributes::ID));
        ob_start();
        ?>
		<div class="ms-addon-wrap">
			<?php 
        MS_Helper_Html::settings_tab_header(array('title' => __('Custom Membership Attributes', 'membership2'), 'desc' => sprintf(__('You can manage custom attributes in %sthe plugin settings%s.', 'membership2'), '<a href="' . $manage_url . '">', '</a>')));
        echo '<div class="ms-attributes">';
        foreach ($fields as $field) {
            MS_Helper_Html::html_element($field);
        }
        echo '</div>';
        ?>
		</div>
		<?php 
        $html = ob_get_clean();
        echo $html;
    }
コード例 #12
0
    /**
     * Show manual purchase/payment information.
     *
     * Returns a default messsage if gateway is not configured.
     *
     * * Hooks Actions: *
     * * ms_controller_gateway_purchase_info_content
     *
     * @since  1.0.0
     * @return string The payment info.
     */
    public function purchase_info_content()
    {
        do_action('ms_gateway_manual_purchase_info_content_before', $this);
        if (empty($this->payment_info)) {
            $link = MS_Controller_Plugin::get_admin_url('settings');
            ob_start();
            ?>
				<?php 
            _e('This is only an example of manual payment gateway instructions', MS_TEXT_DOMAIN);
            ?>
				<br />
				<?php 
            printf(__('Edit it %shere%s', MS_TEXT_DOMAIN), '<a href="' . $link . '">', '</a>');
            ?>
				<br /><br />
				<?php 
            _e('Name: Example name.', MS_TEXT_DOMAIN);
            ?>
				<br />
				<?php 
            _e('Bank: Example bank.', MS_TEXT_DOMAIN);
            ?>
				<br />
				<?php 
            _e('Bank account: Example bank account 1234.', MS_TEXT_DOMAIN);
            ?>
				<br />
			<?php 
            $this->payment_info = ob_get_clean();
        }
        if (!empty($_POST['ms_relationship_id'])) {
            $subscription = MS_Factory::load('MS_Model_Relationship', $_POST['ms_relationship_id']);
            $invoice = $subscription->get_current_invoice();
            $this->payment_info .= sprintf('<br />%s: %s%s', __('Total value', MS_TEXT_DOMAIN), $invoice->currency, $invoice->total);
            // The user did make his intention to pay the invoice. Set status
            // to billed.
            $invoice->status = MS_Model_Invoice::STATUS_BILLED;
            $invoice->save();
        }
        return apply_filters('ms_gateway_manual_purchase_info_content', wpautop($this->payment_info));
    }
コード例 #13
0
    /**
     * Overrides parent's to_html() method.
     *
     * Creates an output buffer, outputs the HTML and grabs the buffer content before releasing it.
     * Creates a wrapper 'ms-wrap' HTML element to contain content and navigation. The content inside
     * the navigation gets loaded with dynamic method calls.
     * e.g. if key is 'settings' then render_settings() gets called, if 'bob' then render_bob().
     *
     * @since  1.0.0
     * @api
     *
     * @return string
     */
    public function to_html()
    {
        $form_fields = $this->prepare_fields();
        $setup_url = MS_Controller_Plugin::get_admin_url('setup');
        ob_start();
        // Render tabbed interface.
        ?>
		<div class="ms-wrap wrap">
			<form class="ms-welcome-box" action="<?php 
        echo esc_url($setup_url);
        ?>
" method="POST">
				<h2 class="ms-welcome-title">
					<?php 
        _e('Welcome!', MS_TEXT_DOMAIN);
        ?>
				</h2>

				<div class="ms-welcome-text">
					<?php 
        _e('Hello and welcome to <strong>Membership2</strong> by WPMU DEV. Please follow this simple set-up<br />wizard to help us determine the settings that are most relevant to your needs. Don\'t worry, you<br />can always change these settings in the future.', MS_TEXT_DOMAIN);
        ?>
				</div>

				<div class="ms-welcome-image-box">
					<img src="<?php 
        echo esc_attr(MS_Plugin::instance()->url);
        ?>
app/assets/images/welcome.png" class="ms-welcome-image" />
				</div>

				<?php 
        foreach ($form_fields as $field) {
            MS_Helper_Html::html_element($field);
        }
        ?>
			</form>
		</div>
		<?php 
        return ob_get_clean();
    }
コード例 #14
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);
 }
    /**
     * Returns the HTML code of the Settings form.
     *
     * @since  1.0.0
     * @return string
     */
    public function render_tab()
    {
        $groups = $this->prepare_fields();
        ob_start();
        ?>
		<div class="ms-addon-wrap">
			<?php 
        MS_Helper_Html::settings_tab_header(array('title' => __('Custom Membership Attributes', MS_TEXT_DOMAIN), 'desc' => __('Define custom fields that are available in the Memberships Edit-Page.', MS_TEXT_DOMAIN)));
        foreach ($groups as $key => $fields) {
            echo '<div class="ms-group ms-group-' . esc_attr($key) . '">';
            foreach ($fields as $field) {
                MS_Helper_Html::html_element($field);
            }
            echo '</div>';
        }
        MS_Helper_Html::html_separator();
        $help_link = MS_Controller_Plugin::get_admin_url('help', array('tab' => 'shortcodes'));
        printf('<p>%s</p><ul><li>%s</li><li>%s</li><li>%s</li><li>%s</li></ul>', __('How to use custom attribute values:', MS_TEXT_DOMAIN), sprintf(__('Via the %sshortcode%s %s', MS_TEXT_DOMAIN), '<a href="' . $help_link . '#ms-membership-buy">', '</a>', '<code>[<b>' . MS_Addon_Attributes::SHORTCODE . '</b> slug="slug" id="..."]</code>'), sprintf(__('Via WordPress filter %s', MS_TEXT_DOMAIN), '<code>$val = apply_filters( "<b>ms_membership_attr</b>", "", "slug", $membership_id );</code>'), sprintf(__('Get via php function %s', MS_TEXT_DOMAIN), '<code>$val = <b>ms_membership_attr</b>( "slug", $membership_id );</code>'), sprintf(__('Set via php function %s', MS_TEXT_DOMAIN), '<code><b>ms_membership_attr_set</b>( "slug", $val, $membership_id );</code>'));
        ?>
		</div>
		<?php 
        $html = ob_get_clean();
        echo $html;
    }
コード例 #16
0
    /**
     * Return the HTML form.
     *
     * @since  1.0.0
     * @return string
     */
    public function to_html()
    {
        $fields = $this->get_fields();
        // TODO: Fix that condition again.
        $has_more = true;
        $title = __('Protection Messages', MS_TEXT_DOMAIN);
        if (isset($this->data['membership'])) {
            $membership = $this->data['membership'];
        } else {
            $membership = false;
        }
        if ($membership instanceof MS_Model_Membership) {
            $settings_url = MS_Controller_Plugin::get_admin_url('settings', array('tab' => MS_Controller_Settings::TAB_MESSAGES));
            $desc = sprintf(__('Here you can override %sdefault settings%s for this membership.', MS_TEXT_DOMAIN), '<a href="' . $settings_url . '">', '</a>');
        } else {
            $desc = '';
        }
        ob_start();
        MS_Helper_Html::settings_tab_header(array('title' => $title, 'desc' => $desc));
        ?>
		<form class="ms-form" action="" method="post">
			<?php 
        $subtitle = apply_filters('ms_translation_flag', __('Content protection message', MS_TEXT_DOMAIN), 'message-protected');
        MS_Helper_Html::settings_box($fields['content'], $subtitle, '', 'open');
        $subtitle = apply_filters('ms_translation_flag', __('Shortcode protection message', MS_TEXT_DOMAIN), 'message-shortcode');
        MS_Helper_Html::settings_box($fields['shortcode'], $subtitle, '', 'open');
        if ($has_more) {
            $subtitle = apply_filters('ms_translation_flag', __('More tag protection message', MS_TEXT_DOMAIN), 'message-more_tag');
            MS_Helper_Html::settings_box($fields['more_tag'], $subtitle, '', 'open');
        }
        ?>
		</form>
		<?php 
        $html = ob_get_clean();
        return $html;
    }
コード例 #17
0
 public function column_user($item, $column_name)
 {
     $member = MS_Factory::load('MS_Model_Member', $item->user_id);
     $html = sprintf('<a href="%s">%s</a>', MS_Controller_Plugin::get_admin_url('add-member', array('user_id' => $item->user_id)), $member->username);
     return $html;
 }
コード例 #18
0
 /**
  * Display Username column.
  *
  * @since  1.0.0
  *
  * @param mixed $member The table item to display.
  */
 public function column_username($member)
 {
     $actions = array();
     $actions['edit'] = sprintf('<a href="%s">%s</a>', MS_Controller_Plugin::get_admin_url('add-member', array('user_id' => $member->id)), __('Subscription Details', MS_TEXT_DOMAIN));
     $actions['profile'] = sprintf('<a href="%s">%s</a>', admin_url('user-edit.php?user_id=' . $member->id), __('Edit Profile', MS_TEXT_DOMAIN));
     $html = sprintf('%1$s %2$s', $member->username, $this->row_actions($actions));
     return $html;
 }
コード例 #19
0
 /**
  * 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');
     }
 }
コード例 #20
0
 /**
  * Initialize the admin-side functions.
  *
  * @since  1.0.0
  */
 public function admin_init()
 {
     $hook = MS_Controller_Plugin::admin_page_hook('help');
     $this->run_action('admin_print_scripts-' . $hook, 'enqueue_scripts');
 }
コード例 #21
0
 /**
  * Add redirect settings tab in settings page.
  *
  * @since  1.0.0
  *
  * @param array $tabs The current tabs.
  * @return array The filtered tabs.
  */
 public function settings_tabs($tabs)
 {
     $tabs[self::ID] = array('title' => __('Redirect', MS_TEXT_DOMAIN), 'url' => MS_Controller_Plugin::get_admin_url('settings', array('tab' => self::ID)));
     return $tabs;
 }
コード例 #22
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);
     }
 }
コード例 #23
0
 /**
  * Load Membership manager specific scripts.
  *
  * @since  1.0.0
  */
 public function enqueue_scripts()
 {
     $data = array('ms_init' => array(), 'lang' => array('msg_delete' => __('Do you want to completely delete the membership <strong>%s</strong> including all subscriptions?', 'membership2'), 'btn_delete' => __('Delete', 'membership2'), 'btn_cancel' => __('Cancel', 'membership2'), 'quickedit_error' => __('Error while saving changes.', 'membership2')));
     $step = $this->get_step();
     switch ($step) {
         case self::STEP_WELCOME_SCREEN:
             break;
         case self::STEP_ADD_NEW:
             $data['ms_init'][] = 'view_membership_add';
             $data['initial_url'] = MS_Controller_Plugin::get_admin_url();
             break;
         case self::STEP_OVERVIEW:
             $data['ms_init'][] = 'view_membership_overview';
             break;
         case self::STEP_PAYMENT:
             $data['ms_init'][] = 'view_membership_payment';
             $data['ms_init'][] = 'view_settings_payment';
             break;
         case self::STEP_EDIT:
             $data['ms_init'][] = 'view_membership_payment';
             $tab = $this->get_active_edit_tab();
             switch ($tab) {
                 case self::TAB_TYPE:
                     add_thickbox();
                     $data['ms_init'][] = 'view_membership_add';
                     break;
                 case self::TAB_UPGRADE:
                     $data['ms_init'][] = 'view_membership_upgrade';
                     break;
                 case self::TAB_MESSAGES:
                     $data['ms_init'][] = 'view_settings_protection';
                     break;
                 case self::TAB_EMAILS:
                     $data['ms_init'][] = 'view_settings_automated_msg';
                     break;
             }
             do_action('ms_controller_membership_enqueue_scripts_tab-' . $tab, $this);
             break;
         case self::STEP_MS_LIST:
             $data['ms_init'][] = 'view_membership_list';
             $data['ms_init'][] = 'view_settings_setup';
             break;
     }
     lib3()->ui->data('ms_data', $data);
     wp_enqueue_script('ms-admin');
     wp_enqueue_script('jquery-validate');
     do_action('ms_controller_membership_enqueue_scripts', $this);
     do_action('ms_controller_membership_enqueue_scripts-' . $step, $this);
 }
 /**
  * Output column content
  *
  * @since  1.0.0
  * @param  object $item The item that is displayed.
  * @return string The HTML code to output.
  */
 public function column_invoice($item, $column_name)
 {
     if ($item->invoice_id) {
         $invoice_url = MS_Controller_Plugin::get_admin_url('billing', array('action' => 'edit', 'invoice_id' => $item->invoice_id));
         $html = sprintf('<a href="%1$s">%2$s</a>', $invoice_url, $item->invoice_id);
     } else {
         $html = '-';
     }
     return $html;
 }
コード例 #25
0
 /**
  * Load Membership admin scripts.
  *
  * @since  1.0.0
  */
 public function enqueue_scripts()
 {
     $active_tab = $this->get_active_tab();
     do_action('ms_controller_settings_enqueue_scripts_' . $active_tab);
     $plugin_url = MS_Plugin::instance()->url;
     $version = MS_Plugin::instance()->version;
     $initial_url = MS_Controller_Plugin::get_admin_url();
     $data = array('ms_init' => array(), 'initial_url' => $initial_url);
     $data['ms_init'][] = 'view_settings';
     switch ($active_tab) {
         case self::TAB_PAYMENT:
             add_thickbox();
             $data['ms_init'][] = 'view_settings_payment';
             break;
         case self::TAB_MESSAGES:
             $data['ms_init'][] = 'view_settings_protection';
             break;
         case self::TAB_EMAILS:
             $data['ms_init'][] = 'view_settings_automated_msg';
             break;
         case self::TAB_GENERAL:
             $data['ms_init'][] = 'view_settings_setup';
             break;
     }
     lib3()->ui->data('ms_data', $data);
     wp_enqueue_script('ms-admin');
 }
コード例 #26
0
 /**
  * Add 'Unprotected' node.
  *
  * @since  1.0.0
  *
  */
 private function add_unprotected_node()
 {
     global $wp_admin_bar;
     if (MS_Plugin::is_enabled()) {
         return;
     }
     if (MS_Plugin::is_wizard()) {
         return;
     }
     $link_url = MS_Controller_Plugin::get_admin_url('settings');
     $wp_admin_bar->add_node(apply_filters('ms_controller_adminbar_add_unprotected_node', array('id' => 'ms-unprotected', 'title' => __('Content Protection is disabled', 'membership2'), 'href' => $link_url, 'meta' => array('class' => 'ms-unprotected', 'title' => __('Content of this site is unprotected', 'membership2'), 'tabindex' => '1'))));
 }
コード例 #27
0
 /**
  * Adds Dashboard navigation menus.
  *
  * @since  1.0.0
  */
 public function add_menu_pages()
 {
     global $submenu;
     $limited_mode = false;
     $view = MS_Model_Settings::get_special_view();
     if ($view) {
         // A special view is displayed. Do not display other menu items.
         $pages = array();
         $limited_mode = true;
     } elseif (MS_Plugin::is_wizard()) {
         // Submenus definition: Wizard mode
         $pages = $this->get_setup_menu_pages();
         $limited_mode = true;
     } else {
         // Submenus definition: Normal mode
         $pages = $this->get_default_menu_pages();
         if (MS_Plugin::is_network_wide() && !is_network_admin()) {
             $limited_mode = true;
         }
     }
     /**
      * Allow Add-ons and other plugins to add menu pages.
      *
      * A menu item is defined by an array containing the following members:
      *   'title' => '...',
      *   'slug' => '...',
      *   'function' => callback
      *
      * @var array
      */
     $pages = apply_filters('ms_plugin_menu_pages', $pages, $limited_mode, $this);
     $page_keys = array_keys($pages);
     $slug = '';
     if (isset($page_keys[0]) && $pages[$page_keys[0]]) {
         $slug = $pages[$page_keys[0]]['slug'];
     }
     if (empty($slug)) {
         self::$base_slug = self::MENU_SLUG;
     } else {
         self::$base_slug = self::MENU_SLUG . '-' . $slug;
     }
     /*
      * Create primary menu item: Membership.
      *
      * The menu title is not translatable because of a bug in WordPress core
      * https://core.trac.wordpress.org/ticket/18857
      * Until this bug is closed the title (2nd argument) can't be translated
      */
     add_menu_page('Membership 2', 'Membership 2', $this->capability, self::$base_slug, null, 'dashicons-lock');
     // Create submenus
     foreach ($pages as $page) {
         if (!is_array($page)) {
             continue;
         }
         if (empty($page['link'])) {
             $menu_link = false;
         } else {
             $menu_link = $page['link'];
         }
         $slug = self::MENU_SLUG;
         if (!empty($page['slug'])) {
             $slug .= '-' . $page['slug'];
         }
         add_submenu_page(self::$base_slug, strip_tags($page['title']), $page['title'], $this->capability, $slug, array($this, 'handle_submenu_request'));
         /*
          * WordPress does not support absolute URLs in the admin-menu.
          * So we have to manny modify the menu-link href value if our slug
          * is an absolute URL.
          */
         if ($menu_link) {
             $item = end($submenu[self::$base_slug]);
             $key = key($submenu[self::$base_slug]);
             $submenu[self::$base_slug][$key][2] = $menu_link;
         }
     }
     do_action('ms_controller_plugin_add_menu_pages', $this);
     // Setup the rest of the plugin after the menu was registered.
     do_action('ms_plugin_admin_setup');
 }
コード例 #28
0
 /**
  * Prepare the HTML fields that can be displayed
  *
  * @since  1.0.0
  *
  * @return array
  */
 protected function prepare_fields($data)
 {
     // List of known Membership types; used to display the nice-name
     $ms_types = MS_Model_Membership::get_types();
     $ms_paytypes = MS_Model_Membership::get_payment_types();
     // Prepare the "Memberships" table
     $memberships = array(array(__('Membership name', 'membership2'), __('Membership Type', 'membership2'), __('Payment Type', 'membership2'), __('Description', 'membership2')));
     foreach ($data->memberships as $item) {
         if (!isset($ms_types[$item->type])) {
             $item->type = MS_Model_Membership::TYPE_STANDARD;
         }
         switch ($item->pay_type) {
             case 'recurring':
                 $payment_type = MS_Model_Membership::PAYMENT_TYPE_RECURRING;
                 break;
             case 'finite':
                 $payment_type = MS_Model_Membership::PAYMENT_TYPE_FINITE;
                 break;
             case 'date':
                 $payment_type = MS_Model_Membership::PAYMENT_TYPE_DATE_RANGE;
                 break;
             default:
                 $payment_type = MS_Model_Membership::PAYMENT_TYPE_PERMANENT;
                 break;
         }
         $memberships[] = array($item->name, $ms_types[$item->type], $ms_paytypes[$payment_type], $item->description);
     }
     // Prepare the "Members" table
     $members = array(array(__('Username', 'membership2'), __('Email', 'membership2'), __('Subscriptions', 'membership2'), __('Invoices', 'membership2')));
     foreach ($data->members as $item) {
         $inv_count = 0;
         if (isset($item->subscriptions) && is_array($item->subscriptions)) {
             foreach ($item->subscriptions as $registration) {
                 $inv_count += count($registration->invoices);
             }
         }
         $members[] = array($item->username, $item->email, count($item->subscriptions), $inv_count);
     }
     $settings = array();
     foreach ($data->settings as $setting => $value) {
         switch ($setting) {
             case 'addons':
                 $model = MS_Factory::load('MS_Model_Addon');
                 $list = $model->get_addon_list();
                 $code = '';
                 foreach ($value as $addon => $state) {
                     if ($state) {
                         $code .= __('Activate: ', 'membership2');
                     } else {
                         $code .= __('Dectivate: ', 'membership2');
                     }
                     $code .= $list[$addon]->name . '<br/>';
                 }
                 $settings[] = array(__('Add-Ons', 'membership2'), $code);
                 break;
         }
     }
     if (empty($settings)) {
         $settings[] = array('', __('(No settings are changed)', 'membership2'));
     }
     // Prepare the return value.
     $fields = array();
     // Export-Notes
     $notes = '';
     if (isset($data->notes)) {
         if (is_scalar($data->notes)) {
             $notes = array($data->notes);
         }
         $in_sub = false;
         $notes = '<ul class="ms-import-notes">';
         foreach ($data->notes as $line => $text) {
             $is_sub = strpos($text, '- ') === 0;
             if ($in_sub != $is_sub) {
                 $in_sub = $is_sub;
                 if ($is_sub) {
                     $notes .= '<ul>';
                 } else {
                     $notes .= '</ul>';
                 }
             }
             if ($in_sub) {
                 $text = substr($text, 2);
             }
             $notes .= '<li>' . $text;
         }
         $notes .= '</ul>';
     }
     $fields['details'] = array('type' => MS_Helper_Html::TYPE_HTML_TABLE, 'class' => 'ms-import-preview', 'value' => array(array(__('Data source', 'membership2'), $data->source . ' &emsp; <small>' . sprintf(__('exported on %1$s', 'membership2'), $data->export_time) . '</small>'), array(__('Content', 'membership2'), sprintf(_n('%1$s Membership', '%1$s Memberships', count($data->memberships), 'membership2'), '<b>' . count($data->memberships) . '</b>') . ' / ' . sprintf(_n('%1$s Member', '%1$s Members', count($data->members), 'membership2'), '<b>' . count($data->members) . '</b>'))), 'field_options' => array('head_col' => true, 'head_row' => false, 'col_class' => array('preview-label', 'preview-data')));
     if (!empty($notes)) {
         $fields['details']['value'][] = array(__('Please note', 'membership2'), $notes);
     }
     $batchsizes = array(10 => __('Small (10 items)'), 30 => __('Normal (30 items)'), 100 => __('Big (100 items)'));
     $fields['batchsize'] = array('id' => 'batchsize', 'type' => MS_Helper_Html::INPUT_TYPE_SELECT, 'title' => __('Batch size for import', 'membership2'), 'desc' => __('Big batches will be processed faster but may result in PHP Memory errors.', 'membership2'), 'value' => 30, 'field_options' => $batchsizes, 'class' => 'sel-batchsize');
     $fields['clear_all'] = array('id' => 'clear_all', 'type' => MS_Helper_Html::INPUT_TYPE_CHECKBOX, 'title' => __('Replace current content with import data (removes existing Memberships/Members before importing data)', 'membership2'), 'class' => 'widefat');
     $fields['memberships'] = array('type' => MS_Helper_Html::TYPE_HTML_TABLE, 'class' => 'ms-import-preview', 'value' => $memberships, 'field_options' => array('head_col' => false, 'head_row' => true, 'col_class' => array('preview-name', 'preview-type', 'preview-pay-type', 'preview-desc')));
     $fields['members'] = array('type' => MS_Helper_Html::TYPE_HTML_TABLE, 'class' => 'ms-import-preview', 'value' => $members, 'field_options' => array('head_col' => false, 'head_row' => true, 'col_class' => array('preview-name', 'preview-email', 'preview-count', 'preview-count')));
     $fields['settings'] = array('type' => MS_Helper_Html::TYPE_HTML_TABLE, 'class' => 'ms-import-preview', 'value' => $settings, 'field_options' => array('head_col' => true, 'head_row' => false));
     $fields['sep'] = array('type' => MS_Helper_Html::TYPE_HTML_SEPARATOR);
     $fields['back'] = array('type' => MS_Helper_Html::TYPE_HTML_LINK, 'class' => 'wpmui-field-button button', 'value' => __('Cancel', 'membership2'), 'url' => $_SERVER['REQUEST_URI']);
     $fields['skip'] = array('type' => MS_Helper_Html::TYPE_HTML_LINK, 'class' => 'wpmui-field-button button', 'value' => __('Skip', 'membership2'), 'url' => MS_Controller_Plugin::get_admin_url(false, array('skip_import' => 1)));
     $fields['import'] = array('id' => 'btn-import', 'type' => MS_Helper_Html::INPUT_TYPE_BUTTON, 'value' => __('Import', 'membership2'), 'button_value' => MS_Controller_Import::AJAX_ACTION_IMPORT, 'button_type' => 'submit');
     $fields['download'] = array('id' => 'btn-download', 'type' => MS_Helper_Html::INPUT_TYPE_BUTTON, 'value' => __('Download as Export File', 'membership2'), 'class' => 'button-link');
     return $fields;
 }
    /**
     * Return the HTML form.
     *
     * @since  1.0.0
     * @return string
     */
    public function to_html()
    {
        $comm = $this->data['comm'];
        $fields = $this->get_fields();
        $this->add_action('admin_footer', 'wp_footer');
        $title = __('Automated Email Responses', MS_TEXT_DOMAIN);
        if (isset($this->data['membership'])) {
            $membership = $this->data['membership'];
        } else {
            $membership = false;
        }
        if ($membership instanceof MS_Model_Membership) {
            $settings_url = MS_Controller_Plugin::get_admin_url('settings', array('tab' => MS_Controller_Settings::TAB_EMAILS));
            $desc = sprintf(__('Here you can override %sdefault messages%s for this membership.', MS_TEXT_DOMAIN), '<a href="' . $settings_url . '">', '</a>');
        } else {
            $desc = '';
        }
        ob_start();
        MS_Helper_Html::settings_tab_header(array('title' => $title, 'desc' => $desc));
        ?>

		<form id="ms-comm-type-form" action="" method="post">
			<?php 
        MS_Helper_Html::html_element($fields['load_action']);
        MS_Helper_Html::html_element($fields['load_nonce']);
        MS_Helper_Html::html_element($fields['comm_type']);
        MS_Helper_Html::html_element($fields['switch_comm_type']);
        ?>
		</form>

		<?php 
        MS_Helper_Html::html_separator();
        if (!empty($fields['override'])) {
            MS_Helper_Html::html_element($fields['override']);
        }
        ?>

		<form action="" method="post" class="ms-editor-form">
			<?php 
        if (!empty($fields['membership_id'])) {
            MS_Helper_Html::html_separator();
            MS_Helper_Html::html_element($fields['membership_id']);
        }
        MS_Helper_Html::html_element($fields['action']);
        MS_Helper_Html::html_element($fields['nonce']);
        MS_Helper_Html::html_element($fields['type']);
        if (is_a($comm, 'MS_Model_Communication')) {
            printf('<h3>%1$s %2$s: %3$s</h3><div class="ms-description" style="margin-bottom:20px;">%4$s</div>', $comm->get_title(), __('Message', MS_TEXT_DOMAIN), MS_Helper_Html::html_element($fields['enabled'], true), $comm->get_description());
            if ($comm->period_enabled) {
                echo '<div class="ms-period-wrapper clear">';
                $fields['period_unit'] = $comm->set_period_name($fields['period_unit']);
                MS_Helper_Html::html_element($fields['period_unit']);
                MS_Helper_Html::html_element($fields['period_type']);
                echo '</div>';
            }
        }
        MS_Helper_Html::html_element($fields['subject']);
        MS_Helper_Html::html_element($fields['email_body']);
        MS_Helper_Html::html_element($fields['cc_enabled']);
        echo ' &nbsp; ';
        MS_Helper_Html::html_element($fields['cc_email']);
        MS_Helper_Html::html_separator();
        MS_Helper_Html::html_element($fields['save_email']);
        ?>
		</form>
		<?php 
        return ob_get_clean();
    }
コード例 #30
0
ファイル: membership.php プロジェクト: oshabaeva/project-s-v2
 /**
  * Add link to settings page in plugins page.
  *
  * @since  1.0.0
  *
  * @param array $links WordPress default array of links.
  * @return array Array of links with settings page links added.
  */
 public function plugin_settings_link($links)
 {
     if (!is_network_admin()) {
         $text = __('Settings', 'membership2');
         $url = MS_Controller_Plugin::get_admin_url('settings');
         if ($this->settings->initial_setup) {
             $url = MS_Controller_Plugin::get_admin_url();
         }
         /**
          * Filter the plugin settings link.
          *
          * @since  1.0.0
          * @param object $this The MS_Plugin object.
          */
         $settings_link = apply_filters('ms_plugin_settings_link', sprintf('<a href="%s">%s</a>', $url, $text), $this);
         array_unshift($links, $settings_link);
     }
     return $links;
 }