/**
     * 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);
    }
    /**
     * 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(false, true);
        if (isset($gateways[$subscription->gateway_id])) {
            $gateway = $gateways[$subscription->gateway_id];
        } elseif (empty($subscription->gateway_id)) {
            $gateway = __('- No Gateway -', 'membership2');
        } else {
            $gateway = '(' . $subscription->gateway_id . ')';
        }
        $events = MS_Model_Event::get_events(array('topic' => 'membership', 'nopaging' => true, 'relationship_id' => $subscription->id));
        $sub_details = array('title' => __('Subscription Details', 'membership2'), 'type' => MS_Helper_Html::TYPE_HTML_TABLE, 'value' => array(array('Subscription ID', $subscription->id), array('Membership', $subscription->get_membership()->name), array('Payment Gateway', $gateway), array('Payment Type', $subscription->get_payment_description(null, true)), array('Subscription Start', $subscription->start_date), array('Subscription End', $subscription->expire_date), array('Status', $subscription->status)), 'field_options' => array('head_col' => true));
        $evt_details = array();
        foreach ($events as $event) {
            $evt_details[] = array('title' => __('Event Details', 'membership2'), 'type' => MS_Helper_Html::TYPE_HTML_TABLE, 'value' => array(array('Event ID', $event->id), array('Date', $event->date), array('Description', $event->description)), 'field_options' => array('head_col' => true));
        }
        ob_start();
        ?>
		<div>
			<?php 
        MS_Helper_Html::html_element($sub_details);
        MS_Helper_Html::html_separator();
        foreach ($evt_details as $detail) {
            MS_Helper_Html::html_element($detail);
        }
        ?>
		</div>
		<?php 
        $html = ob_get_clean();
        return apply_filters('ms_view_member_subscription_to_html', $html);
    }
    /**
     * Create view output.
     *
     * @since  1.0.0
     * @return string
     */
    public function to_html()
    {
        $fields = $this->prepare_fields();
        ob_start();
        ?>
		<div class="ms-membership-add ms-cols-2">
			<form method="post" id="ms-choose-type-form">
				<div class="ms-settings-row cf">
					<h3><?php 
        _e('Set the membership type:', MS_TEXT_DOMAIN);
        ?>
</h3>
					<?php 
        MS_Helper_Html::html_element($fields['type']);
        ?>
				</div>
				<div>
					<?php 
        foreach ($fields['control_fields'] as $field) {
            MS_Helper_Html::html_element($field);
        }
        ?>
				</div>
			</form>
		</div>
		<?php 
        $html = ob_get_clean();
        return $html;
    }
    /**
     * Create view output.
     *
     * @since  1.0.0
     * @return string
     */
    public function to_html()
    {
        $fields = $this->prepare_fields();
        $cols = count($fields['type']['field_options']);
        if ($cols < 2) {
            $cols = 2;
        }
        if ($cols > 3) {
            $cols = 2;
        }
        ob_start();
        ?>
		<div class="ms-wrap">
			<?php 
        MS_Helper_Html::settings_header(array('title' => __('Create New Membership', MS_TEXT_DOMAIN), 'desc' => __('First up, choose a name and a type for your membership site.', MS_TEXT_DOMAIN)));
        ?>
			<div class="ms-settings ms-membership-add ms-cols-<?php 
        echo esc_attr($cols);
        ?>
">
				<form method="post" id="ms-choose-type-form">
					<div class="ms-settings-row cf">
						<h3><?php 
        _e('Choose a membership type:', MS_TEXT_DOMAIN);
        ?>
</h3>
						<?php 
        MS_Helper_Html::html_element($fields['type']);
        ?>
					</div>
					<div class="ms-settings-row cf">
						<?php 
        MS_Helper_Html::html_element($fields['name']);
        ?>
					</div>
					<div class="ms-settings-row cf">
						<div class="ms-options-wrapper">
							<?php 
        foreach ($fields['config_fields'] as $field) {
            echo '<span class="opt">';
            MS_Helper_Html::html_element($field);
            echo '</span>';
        }
        ?>
						</div>
					</div>
					<div class="ms-control-fields-wrapper">
						<?php 
        foreach ($fields['control_fields'] as $field) {
            MS_Helper_Html::html_element($field);
        }
        ?>
					</div>
				</form>
			</div>
		</div>
		<?php 
        $html = ob_get_clean();
        return $html;
    }
    /**
     * Create view output.
     *
     * @since  1.0.0
     * @return string
     */
    public function to_html()
    {
        $list_table = MS_Factory::create('MS_Helper_ListTable_Event');
        $list_table->prepare_items();
        if (isset($_REQUEST['membership_id'])) {
            $membership = MS_Factory::load('MS_Model_Membership', $_REQUEST['membership_id']);
            $title = sprintf(__('%s News', 'membership2'), $membership->get_name_tag());
            $url = esc_url_raw(add_query_arg(array('step' => MS_Controller_Membership::STEP_OVERVIEW), remove_query_arg(array('paged', 'order', 'post_mime_type', 'detached', 'orderby', 's'))));
            $back_link = array('id' => 'back', 'type' => MS_Helper_Html::TYPE_HTML_LINK, 'value' => __('&raquo; Back to Overview', 'membership2'), 'url' => $url, 'class' => 'wpmui-field-button button');
        } else {
            $title = __('Membership News', 'membership2');
            $back_link = '';
        }
        ob_start();
        ?>

		<div class="wrap ms-wrap ms-membership-news">
			<?php 
        MS_Helper_Html::settings_header(array('title' => $title));
        MS_Helper_Html::html_element($back_link);
        $list_table->search_box();
        $list_table->views();
        ?>
			<form action="" method="post">
				<?php 
        $list_table->display();
        ?>
			</form>
		</div>

		<?php 
        $html = ob_get_clean();
        echo '' . $html;
    }
    /**
     * Create view output.
     *
     * @since  1.0.0
     * @return string
     */
    public function to_html()
    {
        $this->check_simulation();
        $membership = $this->data['membership'];
        $admin_message = MS_Helper_Membership::get_admin_message(array($membership->name), $membership);
        $title = MS_Helper_Membership::get_admin_title();
        $membership_list = MS_Factory::create('MS_Helper_ListTable_Membership');
        $membership_list->prepare_items();
        $create_new_button = array('id' => 'create_new_ms_button', 'type' => MS_Helper_Html::TYPE_HTML_LINK, 'url' => $this->data['create_new_url'], 'value' => __('Create New Membership', MS_TEXT_DOMAIN), 'class' => 'button');
        ob_start();
        ?>

		<div class="wrap ms-wrap">
			<?php 
        MS_Helper_Html::settings_header(array('title' => $title, 'desc' => array(__('Here you can view and edit all the Memberships you have created.', MS_TEXT_DOMAIN), $admin_message)));
        ?>
			<form action="" method="post">
				<div class="ms-list-table-wrapper ms-membership-list">
					<?php 
        MS_Helper_Html::html_element($create_new_button);
        $membership_list->display();
        MS_Helper_Html::html_element($create_new_button);
        ?>
				</div>
			</form>
		</div>

		<?php 
        $html = ob_get_clean();
        echo $html;
    }
    /**
     * 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);
    }
    public function to_html()
    {
        $settings = $this->data['settings'];
        $fields = array('plugin_enabled' => array('id' => 'plugin_enabled', 'type' => MS_Helper_Html::INPUT_TYPE_RADIO_SLIDER, 'title' => __('Content Protection', 'membership2'), 'desc' => __('This setting toggles the content protection on this site.', 'membership2'), 'value' => MS_Plugin::is_enabled(), 'data_ms' => array('action' => MS_Controller_Settings::AJAX_ACTION_TOGGLE_SETTINGS, 'setting' => 'plugin_enabled')), 'hide_admin_bar' => array('id' => 'hide_admin_bar', 'type' => MS_Helper_Html::INPUT_TYPE_RADIO_SLIDER, 'title' => __('Hide admin toolbar', 'membership2'), 'desc' => __('Hide the admin toolbar for non administrator users.', 'membership2'), 'value' => $settings->hide_admin_bar, 'data_ms' => array('action' => MS_Controller_Settings::AJAX_ACTION_TOGGLE_SETTINGS, 'setting' => 'hide_admin_bar')));
        $fields = apply_filters('ms_view_settings_prepare_general_fields', $fields);
        $setup = MS_Factory::create('MS_View_Settings_Page_Setup');
        $action_url = esc_url_raw(remove_query_arg(array('msg')));
        ob_start();
        MS_Helper_Html::settings_tab_header();
        ?>

		<form action="<?php 
        echo esc_url($action_url);
        ?>
" method="post" class="cf">
			<div class="cf">
				<div class="ms-half">
					<?php 
        MS_Helper_Html::html_element($fields['plugin_enabled']);
        ?>
				</div>
				<div class="ms-half">
					<?php 
        MS_Helper_Html::html_element($fields['hide_admin_bar']);
        ?>
				</div>
			</div>
			<?php 
        MS_Helper_Html::html_separator();
        MS_Helper_Html::html_element($setup->html_full_form());
        ?>
		</form>
		<?php 
        return ob_get_clean();
    }
    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();
        $classes = array();
        $classes[] = 'ms-tax-' . $fields['country_choice']['value'];
        ob_start();
        ?>
		<div class="ms-wrap <?php 
        echo esc_attr(implode(' ', $classes));
        ?>
">
			<div class="modal-header">
				<button type="button" class="close">&times;</button>
				<h4 class="modal-title"><?php 
        _e('Tax Settings', MS_TEXT_DOMAIN);
        ?>
</h4>
			</div>
			<div class="modal-body">

			<?php 
        foreach ($fields as $field) {
            MS_Helper_Html::html_element($field);
        }
        ?>

			</div>
			<div class="modal-footer">
				<button type="button" class="btn btn-default close"><?php 
        _e('Close', MS_TEXT_DOMAIN);
        ?>
</button>
				<button type="button" class="btn btn-primary save"><?php 
        _e('Save', MS_TEXT_DOMAIN);
        ?>
</button>
			</div>
			<div class="loading-message">
				<?php 
        _e('Saving data, please wait...', MS_TEXT_DOMAIN);
        ?>
			</div>
		</div>
		<div class="body-messages">
			<div class="ms-tax-loading-overlay"></div>
			<div class="ms-tax-loading-message"><?php 
        _e('Refreshing page, please wait...', MS_TEXT_DOMAIN);
        ?>
</div>
		</div>
		<?php 
        $html = ob_get_clean();
        return apply_filters('ms_addon_taxamo_userprofile', $html);
    }
    public function to_html()
    {
        $action_url = '';
        $fields = $this->prepare_fields();
        ob_start();
        ?>
			<div class='ms-wrap ms-card-info-wrapper'>
				<h2><?php 
        _e('Credit card info', MS_TEXT_DOMAIN);
        ?>
 </h2>
				<table class="ms-table">
					<tbody>
						<tr>
							<th><?php 
        _e('Card Number', MS_TEXT_DOMAIN);
        ?>
</th>
							<th><?php 
        _e('Card Expiration date', MS_TEXT_DOMAIN);
        ?>
</th>
						</tr>
						<tr>
							<td><?php 
        echo '**** **** **** ' . $this->data['authorize']['card_num'];
        ?>
</td>
							<td><?php 
        echo '' . $this->data['authorize']['card_exp'];
        ?>
</td>
						</tr>
					</tbody>
				</table>
				<form action="<?php 
        echo esc_url($action_url);
        ?>
" method="post">
					<?php 
        foreach ($fields as $field) {
            MS_Helper_Html::html_element($field);
        }
        ?>
				</form>
				<div class="clear"></div>
			</div>
		<?php 
        return ob_get_clean();
    }
    public function to_html()
    {
        $export_action = MS_Controller_Import::ACTION_EXPORT;
        $import_action = MS_Controller_Import::ACTION_PREVIEW;
        $messages = $this->data['message'];
        $preview = false;
        if (isset($messages['preview'])) {
            $preview = $messages['preview'];
        }
        $export_fields = array('export' => array('id' => 'btn_export', 'type' => MS_Helper_Html::INPUT_TYPE_SUBMIT, 'value' => __('Generate Export', 'membership2'), 'desc' => __('Generate an export file with the current membership settings. ' . '<em>Note that this is not a full backup of the plugin settings.</em>', 'membership2')), 'action' => array('id' => 'action', 'type' => MS_Helper_Html::INPUT_TYPE_HIDDEN, 'value' => $export_action), 'nonce' => array('id' => '_wpnonce', 'type' => MS_Helper_Html::INPUT_TYPE_HIDDEN, 'value' => wp_create_nonce($export_action)));
        $file_field = array('id' => 'upload', 'type' => MS_Helper_Html::INPUT_TYPE_FILE, 'title' => __('From export file', 'membership2'));
        $import_options = array('file' => array('text' => MS_Helper_Html::html_element($file_field, true), 'disabled' => !MS_Model_Import_File::present()), 'membership' => array('text' => __('Membership (WPMU DEV)', 'membership2'), 'disabled' => !MS_Model_Import_Membership::present()));
        $sel_source = 'file';
        if (isset($_POST['import_source']) && isset($import_options[$_POST['import_source']])) {
            $sel_source = $_POST['import_source'];
        }
        $import_fields = array('source' => array('id' => 'import_source', 'type' => MS_Helper_Html::INPUT_TYPE_RADIO, 'title' => __('Choose an import source', 'membership2'), 'field_options' => $import_options, 'value' => $sel_source), 'import' => array('id' => 'btn_import', 'type' => MS_Helper_Html::INPUT_TYPE_SUBMIT, 'value' => __('Preview Import', 'membership2'), 'desc' => __('Import data into this installation.', 'membership2')), 'action' => array('id' => 'action', 'type' => MS_Helper_Html::INPUT_TYPE_HIDDEN, 'value' => $import_action), 'nonce' => array('id' => '_wpnonce', 'type' => MS_Helper_Html::INPUT_TYPE_HIDDEN, 'value' => wp_create_nonce($import_action)));
        ob_start();
        MS_Helper_Html::settings_tab_header(array('title' => __('Import Tool', 'membership2')));
        ?>

		<div>
			<?php 
        if ($preview) {
            ?>
				<form action="" method="post">
					<?php 
            echo '' . $preview;
            ?>
				</form>
			<?php 
        } else {
            ?>
				<form action="" method="post" enctype="multipart/form-data">
					<?php 
            MS_Helper_Html::settings_box($import_fields, __('Import data', 'membership2'));
            ?>
				</form>
				<form action="" method="post">
					<?php 
            MS_Helper_Html::settings_box($export_fields, __('Export data', 'membership2'));
            ?>
				</form>
			<?php 
        }
        ?>
		</div>
		<?php 
        return ob_get_clean();
    }
    /**
     * Return the HTML code.
     *
     * @since  1.0.0
     * @return string
     */
    public function to_html()
    {
        $fields = $this->prepare_fields();
        $cancel = array('id' => 'cancel', 'type' => MS_Helper_Html::TYPE_HTML_LINK, 'title' => __('Cancel', MS_TEXT_DOMAIN), 'value' => __('Cancel', MS_TEXT_DOMAIN), 'url' => esc_url_raw(remove_query_arg(array('action'))), 'class' => 'wpmui-field-button button');
        $this->add_action('ms_view_frontend_profile_after_fields', 'add_scripts');
        ob_start();
        ?>
		<div class="ms-membership-form-wrapper">
			<?php 
        $this->render_errors();
        ?>
			<form id="ms-view-frontend-profile-form" class="form-membership" action="" method="post">
				<legend><?php 
        _e('Edit profile', MS_TEXT_DOMAIN);
        ?>
</legend>
				<?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 
            }
        }
        do_action('ms_view_frontend_profile_after_fields');
        do_action('ms_view_frontend_profile_extra_fields', $this->error);
        ?>
			</form>
			<div class="ms-form-element">
			<?php 
        MS_Helper_Html::html_link($cancel);
        ?>
			</div>
		</div>
		<?php 
        $html = ob_get_clean();
        $html = apply_filters('ms_compact_code', $html);
        return $html;
    }
 /**
  * Prepare fields that are displayed in the form.
  *
  * @since  1.0.1.0
  * @return array
  */
 protected function prepare_fields()
 {
     $action_save = MS_Addon_Attributes::AJAX_ACTION_SAVE_SETTING;
     $action_delete = MS_Addon_Attributes::AJAX_ACTION_DELETE_SETTING;
     $attribute_types = array('text' => __('Simple text field', MS_TEXT_DOMAIN), 'number' => __('Numeric field (integer)', MS_TEXT_DOMAIN), 'textarea' => __('Multi-line text', MS_TEXT_DOMAIN), 'bool' => __('Yes|No', MS_TEXT_DOMAIN));
     $field_def = MS_Addon_Attributes::list_field_def();
     $fieldlist = array();
     $fieldlist[] = array(__('Attribute Title', MS_TEXT_DOMAIN), __('Attribute Slug', MS_TEXT_DOMAIN), __('Attribute Type', MS_TEXT_DOMAIN), __('Attribute Infos', MS_TEXT_DOMAIN));
     foreach ($field_def as $field) {
         $fieldlist[] = array($field->title, '<code>' . $field->slug . '</code>', $field->type, $field->info);
     }
     $fields = array();
     $fields['fields'] = array('add_field' => array('id' => 'add_field', 'type' => MS_Helper_Html::INPUT_TYPE_BUTTON, 'value' => __('New Attribute', MS_TEXT_DOMAIN), 'class' => 'add_field'), 'fieldlist' => array('id' => 'fieldlist', 'type' => MS_Helper_Html::TYPE_HTML_TABLE, 'value' => $fieldlist, 'field_options' => array('head_row' => true), 'class' => 'field-list'));
     $fields['editor no-auto-init'] = array('title' => array('id' => 'title', 'class' => 'title', 'type' => MS_Helper_Html::INPUT_TYPE_TEXT, 'title' => __('Attribute Name', MS_TEXT_DOMAIN), 'desc' => __('A human readable title of the Attribute.', MS_TEXT_DOMAIN)), 'slug' => array('id' => 'slug', 'class' => 'slug', 'type' => MS_Helper_Html::INPUT_TYPE_TEXT, 'title' => __('Attribute Slug', MS_TEXT_DOMAIN), 'desc' => __('You use the slug in the attribute shortcode and in PHP code to access a value.', MS_TEXT_DOMAIN)), 'type' => array('id' => 'type', 'class' => 'type', 'type' => MS_Helper_Html::INPUT_TYPE_SELECT, 'title' => __('Attribute Type', MS_TEXT_DOMAIN), 'desc' => __('Decide what kind of data will be stored by the attribute.', MS_TEXT_DOMAIN), 'field_options' => $attribute_types), 'info' => array('id' => 'info', 'class' => 'info', 'type' => MS_Helper_Html::INPUT_TYPE_TEXT_AREA, 'title' => __('Attribute Infos', MS_TEXT_DOMAIN), 'desc' => __('Additional details displayed in the Membership editor. Only Admin users can see this value.', MS_TEXT_DOMAIN)), 'old_slug' => array('id' => 'old_slug', 'class' => 'old_slug', 'type' => MS_Helper_Html::INPUT_TYPE_HIDDEN), 'action_save' => array('id' => 'action_save', 'class' => 'action_save', 'type' => MS_Helper_Html::INPUT_TYPE_HIDDEN, 'value' => $action_save), 'nonce_save' => array('id' => 'nonce_save', 'class' => 'nonce_save', 'type' => MS_Helper_Html::INPUT_TYPE_HIDDEN, 'value' => wp_create_nonce($action_save)), 'action_delete' => array('id' => 'action_delete', 'class' => 'action_delete', 'type' => MS_Helper_Html::INPUT_TYPE_HIDDEN, 'value' => $action_delete), 'nonce_delete' => array('id' => 'nonce_delete', 'class' => 'nonce_delete', 'type' => MS_Helper_Html::INPUT_TYPE_HIDDEN, 'value' => wp_create_nonce($action_delete)), 'buttons' => array('type' => MS_Helper_Html::TYPE_HTML_TEXT, 'value' => MS_Helper_Html::html_element(array('id' => 'btn_delete', 'class' => 'btn_delete button-link danger', 'type' => MS_Helper_Html::INPUT_TYPE_BUTTON, 'value' => __('Delete', MS_TEXT_DOMAIN)), true) . MS_Helper_Html::html_element(array('id' => 'btn_cancel', 'class' => 'btn_cancel close', 'type' => MS_Helper_Html::INPUT_TYPE_BUTTON, 'value' => __('Cancel', MS_TEXT_DOMAIN)), true) . MS_Helper_Html::html_element(array('id' => 'btn_save', 'class' => 'btn_save button-primary', 'type' => MS_Helper_Html::INPUT_TYPE_BUTTON, 'value' => __('Save Attribute', MS_TEXT_DOMAIN)), true), 'class' => 'buttons'));
     return $fields;
 }
    public function render_tab()
    {
        $fields = $this->prepare_fields();
        ob_start();
        ?>
		<div class="ms-addon-wrap">
			<?php 
        MS_Helper_Html::settings_tab_header(array('title' => __('Taxamo Settings', 'membership2')));
        foreach ($fields as $field) {
            MS_Helper_Html::html_element($field);
        }
        ?>
		</div>
		<?php 
        $html = ob_get_clean();
        echo $html;
    }
    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 contens of the dialog
     *
     * @since  1.0.0
     *
     * @return object
     */
    public function to_html()
    {
        $field = $this->get_fields();
        $membership = $this->data['membership'];
        ob_start();
        ?>
		<div>
			<form class="ms-form wpmui-ajax-update ms-edit-membership" data-ajax="<?php 
        echo esc_attr('save');
        ?>
">
				<div class="ms-form wpmui-form wpmui-grid-8">
					<div class="col-5">
						<?php 
        MS_Helper_Html::html_element($field['name']);
        if (!$membership->is_system()) {
            MS_Helper_Html::html_element($field['description']);
        }
        ?>
					</div>
					<div class="col-3">
						<?php 
        MS_Helper_Html::html_element($field['active']);
        if (!$membership->is_system()) {
            MS_Helper_Html::html_element($field['public']);
            MS_Helper_Html::html_element($field['paid']);
        }
        ?>
					</div>
				</div>
				<div class="ms-form wpmui-form wpmui-grid-8">
					<div class="col-8">
					<?php 
        if (!$membership->is_system()) {
            MS_Helper_Html::html_element($field['priority']);
        }
        ?>
					</div>
				</div>
			</form>
		</div>
		<?php 
        $html = ob_get_clean();
        return apply_filters('ms_view_membership_edit_to_html', $html);
    }
    public function to_html()
    {
        $fields = $this->prepare_fields();
        $subscription = $this->data['ms_relationship'];
        $invoice = $subscription->get_current_invoice();
        $gateway = $this->data['gateway'];
        $action_url = apply_filters('ms_gateway_paypalsingle_view_button_form_action_url', $this->data['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 
        foreach ($fields as $field) {
            MS_Helper_Html::html_element($field);
        }
        ?>
			<img alt="" border="0" width="1" height="1" src="https://www.paypal.com/en_US/i/scr/pixel.gif" >
		</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()
    {
        $membership = MS_Model_Membership::get_base();
        $rule = $membership->get_rule(MS_Rule_Url::RULE_ID);
        $listtable = new MS_Rule_Url_ListTable($rule);
        $listtable->prepare_items();
        if ($listtable->list_shows_base_items()) {
            $add_fields = array('url' => array('id' => 'url_value', 'title' => __('Add new URL Address', 'membership2'), 'type' => MS_Helper_Html::INPUT_TYPE_TEXT, 'class' => 'ms-text-medium'), 'url_add' => array('id' => 'url_add', 'type' => MS_Helper_Html::INPUT_TYPE_SUBMIT, 'value' => __('Protect this URL', 'membership2'), 'button_type' => 'button'), 'url_action' => array('name' => 'rule_action', 'type' => MS_Helper_Html::INPUT_TYPE_HIDDEN, 'value' => MS_Rule_Url::ACTION_ADD), 'url_nonce' => array('name' => '_wpnonce', 'type' => MS_Helper_Html::INPUT_TYPE_HIDDEN, 'value' => wp_create_nonce(MS_Rule_Url::ACTION_ADD)));
        }
        $header_data = apply_filters('ms_view_membership_protectedcontent_header', array('title' => __('URL Restriction', 'membership2'), 'desc' => array(__('Specify URLs that you want to protect.', 'membership2'), __('e.g. <b>example.com/protectme/</b> will protect all URLs that contain <b>example.com/protectme/</b>, including any child page.', 'membership2')), 'class' => ''), MS_Rule_Url::RULE_ID, $this);
        ob_start();
        ?>
		<div class="ms-settings">
			<?php 
        MS_Helper_Html::settings_tab_header($header_data);
        ?>

			<form action="" method="post">
			<?php 
        if ($listtable->list_shows_base_items()) {
            foreach ($add_fields as $field) {
                MS_Helper_Html::html_element($field);
            }
        }
        ?>
			</form>

			<?php 
        $listtable->views();
        $listtable->search_box();
        ?>
			<form action="" method="post">
				<?php 
        $listtable->display();
        do_action('ms_view_membership_protectedcontent_footer', MS_Rule_Url::RULE_ID, $this);
        ?>
			</form>
		</div>
		<?php 
        MS_Helper_Html::settings_footer();
        return ob_get_clean();
    }
    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 
        MS_Helper_Html::settings_box_header('', '');
        foreach ($fields as $field) {
            MS_Helper_Html::html_element($field);
        }
        MS_Helper_Html::settings_box_footer();
        ?>
		</form>
		<?php 
        $html = ob_get_clean();
        return $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;
    }
Exemplo n.º 22
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();
    }
    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('%s<br>%s', __('This the a basic PayPal gateway that allows your members to easily make a single payment.', MS_TEXT_DOMAIN), __('If you use this gateway for recurring payments then your members have to confirm each recuring payment individually.', MS_TEXT_DOMAIN));
        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;
    }
    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;
    }
Exemplo n.º 25
0
    protected function to_html()
    {
        $this->gateway = $this->data['model'];
        $fields = $this->prepare_ajax_fields();
        ob_start();
        ?>

		<form class="ms-gateway-settings-form ms-form">
			<?php 
        MS_Helper_Html::settings_box_header();
        foreach ($fields as $field) {
            MS_Helper_Html::html_element($field);
        }
        MS_Helper_Html::settings_box_footer();
        ?>
		</form>

		<?php 
        $html = ob_get_clean();
        return $html;
    }
    /**
     * Extra controls to be displayed between bulk actions and pagination
     *
     * @param  string $which Either 'top' or 'bottom'
     * @param  bool $echo Output or return the HTML code? Default is output.
     */
    public function extra_tablenav($which, $echo = true)
    {
        if ('top' != $which) {
            return;
        }
        $filter_button = array('id' => 'filter_button', 'type' => MS_Helper_Html::INPUT_TYPE_SUBMIT, 'value' => __('Filter', 'membership2'), 'class' => 'button');
        if (!$echo) {
            ob_start();
        }
        ?>
		<div class="alignleft actions">
			<?php 
        $this->months_dropdown('page');
        MS_Helper_Html::html_element($filter_button);
        ?>
		</div>
		<?php 
        if (!$echo) {
            return ob_get_clean();
        }
    }
    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 />%2$s', __('Best used for recurring payments.', 'membership2'), sprintf(__('You can find your Stripe API Keys in your %sAccount Settings%s.', 'membership2'), '<a href="https://dashboard.stripe.com/account/apikeys" target="_blank">', '</a>'));
        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;
    }
    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('%s<br />&nbsp;<br />%s<br />&nbsp;<br />%s <strong>%s</strong><br /><a href="%s" target="_blank">%s</a>', __('This advanced PayPal gateway will handle all payment types, including trial periods and recurring payments. However, it should not be used for permanent type meberships, as here it will display "pay again after 5 years" during checkout.', 'membership2'), __('In order for Membership 2 to function correctly you must setup an IPN listening URL with PayPal. Make sure to complete this step, otherwise we are not notified when a member cancels their subscription.', 'membership2'), __('Your IPN listening URL is:', 'membership2'), $this->data['model']->get_return_url(), 'https://developer.paypal.com/docs/classic/ipn/integration-guide/IPNSetup/', __('Instructions &raquo;', 'membership2'));
        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;
    }
    public function to_html()
    {
        $fields = $this->prepare_fields();
        $gateway = $this->data['model'];
        $msg = __('Instruct your users how to proceed with manual payments. This might include things like your bank account number and an email address where the payment confirmation should be sent.', MS_TEXT_DOMAIN) . '<br />&nbsp;<br /><em>' . __('When using this payment method the user will see the following payment instructions. Since the payment cannot be confirmed automatically his membership will <b>not</b> be activated instantly! You have to manually check if the payment was made and set the members bill to "paid" to complete the payment.', MS_TEXT_DOMAIN) . '</em>';
        ob_start();
        // Render tabbed interface.
        ?>
		<form class="ms-gateway-settings-form ms-form">
			<?php 
        MS_Helper_Html::settings_box_header('', $msg);
        foreach ($fields as $field) {
            MS_Helper_Html::html_element($field);
        }
        MS_Helper_Html::settings_box_footer();
        ?>
		</form>
		<?php 
        $html = ob_get_clean();
        return $html;
    }
    public function to_html()
    {
        $membership = MS_Model_Membership::get_base();
        $menus = $membership->get_rule(MS_Rule_MenuItem::RULE_ID)->get_menu_array();
        $menu_ids = array_keys($menus);
        $menu_id = reset($menu_ids);
        if (isset($_REQUEST['menu_id'])) {
            $menu_id = $_REQUEST['menu_id'];
        }
        // This fixes the list-title generated by MS_Helper_ListTable_Rule.
        unset($_GET['status']);
        $rule_menu = $membership->get_rule(MS_Rule_MenuItem::RULE_ID);
        $rule_listtable = new MS_Rule_MenuItem_ListTable($rule_menu, $menus, $menu_id);
        $fields['rule_menu'] = array('id' => 'rule_menu', 'name' => 'rule', 'value' => 'menu', 'type' => MS_Helper_Html::INPUT_TYPE_HIDDEN);
        $menu_url = esc_url_raw(add_query_arg(array('menu_id' => $menu_id)));
        $rule_listtable->prepare_items();
        $header_data = apply_filters('ms_view_membership_protectedcontent_header', array('title' => __('Menu Items', MS_TEXT_DOMAIN), 'desc' => __('Protect individual menu items.', MS_TEXT_DOMAIN)), MS_Rule_MenuItem::RULE_ID, $this);
        ob_start();
        ?>
		<div class="ms-settings">
			<?php 
        MS_Helper_Html::settings_tab_header($header_data);
        ?>

			<form id="ms-menu-form" method="post" action="<?php 
        echo '' . $menu_url;
        ?>
">
				<?php 
        MS_Helper_Html::html_element($fields['rule_menu']);
        $rule_listtable->views();
        $rule_listtable->display();
        do_action('ms_view_membership_protectedcontent_footer', MS_Rule_MenuItem::RULE_ID, $this);
        ?>
			</form>
		</div>
		<?php 
        MS_Helper_Html::settings_footer();
        return ob_get_clean();
    }