本文整理匯總了PHP中MS_Helper_Html::html_link方法的典型用法代碼示例。如果您正苦於以下問題:PHP MS_Helper_Html::html_link方法的具體用法?PHP MS_Helper_Html::html_link怎麽用?PHP MS_Helper_Html::html_link使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類MS_Helper_Html
的用法示例。
在下文中一共展示了MS_Helper_Html::html_link方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: to_html
/**
* 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;
}
示例2: membership_box_html
/**
* Output the HTML content of a single membership box.
* This includes the membership name, description, price and the action
* button (Sign-up, Cancel, etc.)
*
* @since 1.0.0
* @param MS_Model_Membership $membership
* @param string $action
* @param string $msg
* @param MS_Model_Relationship $subscription
*/
private function membership_box_html($membership, $action, $msg = null, $subscription = null)
{
$fields = $this->prepare_fields($membership->id, $action, $this->data['step'], $membership->_move_from);
$settings = MS_Factory::load('MS_Model_Settings');
if (0 == $membership->price) {
$price = __('Free', MS_TEXT_DOMAIN);
} else {
$price = sprintf('%s %s', $settings->currency, MS_Helper_Billing::format_price($membership->total_price));
}
$price = apply_filters('ms_membership_price', $price, $membership);
if (is_user_logged_in()) {
$current = MS_Model_Pages::MS_PAGE_MEMBERSHIPS;
} else {
$current = MS_Model_Pages::MS_PAGE_REGISTER;
}
$url = MS_Model_Pages::get_page_url($current);
$classes = array('ms-membership-details-wrapper', 'ms-signup', 'ms-membership-' . $membership->id, 'ms-type-' . $membership->type, 'ms-payment-' . $membership->payment_type, $membership->trial_period_enabled ? 'ms-with-trial' : 'ms-no-trial', 'ms-status-' . ($subscription ? $subscription->status : 'none'), 'ms-subscription-' . ($subscription ? $subscription->id : 'none'));
?>
<form action="<?php
echo esc_url($url);
?>
" class="ms-membership-form" method="post">
<div id="ms-membership-wrapper-<?php
echo esc_attr($membership->id);
?>
" class="<?php
echo esc_attr(implode(' ', $classes));
?>
">
<div class="ms-top-bar">
<h4><span class="ms-title"><?php
echo esc_html($membership->name);
?>
</span></h4>
</div>
<div class="ms-price-details">
<div class="ms-description"><?php
echo '' . $membership->description;
?>
</div>
<div class="ms-price price"><?php
echo esc_html($price);
?>
</div>
<?php
if ($msg) {
?>
<div class="ms-bottom-msg"><?php
echo '' . $msg;
?>
</div>
<?php
}
?>
</div>
<div class="ms-bottom-bar">
<?php
$class = apply_filters('ms_view_shortcode_membershipsignup_form_button_class', 'ms-signup-button ' . esc_attr($action));
$button = array('id' => 'submit', 'type' => MS_Helper_Html::INPUT_TYPE_SUBMIT, 'value' => esc_html($this->data["{$action}_text"]), 'class' => $class);
if (MS_Helper_Membership::MEMBERSHIP_ACTION_CANCEL === $action) {
/**
* PayPal Standard Gateway uses a special Cancel button.
*
* @see MS_Controller_Gateway
*/
$button = apply_filters('ms_view_shortcode_membershipsignup_cancel_button', $button, $subscription, $this);
} elseif (MS_Helper_Membership::MEMBERSHIP_ACTION_PAY === $action) {
// Paid membership: Display a Cancel button
$cancel_action = MS_Helper_Membership::MEMBERSHIP_ACTION_CANCEL;
$url = $this->get_action_url($membership->id, $cancel_action, '');
$link = array('url' => $url, 'class' => 'ms-cancel-button button', 'value' => esc_html($this->data["{$cancel_action}_text"]));
MS_Helper_Html::html_link($link);
}
wp_nonce_field($fields['action']['value']);
foreach ($fields as $field) {
MS_Helper_Html::html_element($field);
}
MS_Helper_Html::html_element($button);
?>
</div>
</div>
</form>
<?php
do_action('ms_show_prices');
}
示例3: to_html
/**
* Returns the HTML code.
*
* @since 1.0.0
* @return string
*/
public function to_html()
{
$fields = $this->prepare_fields();
$this->add_action('ms_shortcode_register_form_end', 'add_scripts');
// When redirecting to login form we want to keep the previously submitted form data.
$url_data = $_POST;
$url_data['do-login'] = '1';
$login_url = esc_url_raw(add_query_arg($url_data));
if (!empty($_REQUEST['do-login'])) {
$register_url = esc_url_raw(remove_query_arg('do-login'));
$back_link = array('url' => $register_url, 'class' => 'alignleft', 'value' => __('Cancel', MS_TEXT_DOMAIN));
$html = do_shortcode(sprintf('[%s show_note=false title="%s"]', MS_Helper_Shortcode::SCODE_LOGIN, __('Login', MS_TEXT_DOMAIN)));
$html .= MS_Helper_Html::html_link($back_link, true);
return $html;
}
$login_link = array('title' => __('Login', MS_TEXT_DOMAIN), 'url' => $login_url, 'class' => 'alignleft', 'value' => __('Already have a user account?', MS_TEXT_DOMAIN));
$register_button = array('id' => 'register', 'type' => MS_Helper_Html::INPUT_TYPE_SUBMIT, 'value' => $this->data['label_register']);
$title = $this->data['title'];
ob_start();
$reg_url = MS_Model_Pages::get_page_url(MS_Model_Pages::MS_PAGE_REGISTER);
$reg_url = esc_url_raw(add_query_arg('action', 'register_user', $reg_url));
// Default WP action hook
do_action('before_signup_form');
?>
<div class="ms-membership-form-wrapper">
<?php
$this->render_errors();
?>
<form
id="ms-shortcode-register-user-form"
class="form-membership"
action="<?php
echo esc_url($reg_url);
?>
"
method="post">
<?php
wp_nonce_field($this->data['action']);
?>
<?php
if (!empty($title)) {
?>
<legend>
<?php
echo $title;
?>
</legend>
<?php
}
?>
<?php
foreach ($fields as $field) {
if (is_string($field)) {
MS_Helper_Html::html_element($field);
} elseif (MS_Helper_Html::INPUT_TYPE_HIDDEN == $field['type']) {
MS_Helper_Html::html_element($field);
} else {
?>
<div class="ms-form-element ms-form-element-<?php
echo esc_attr($field['id']);
?>
">
<?php
MS_Helper_Html::html_element($field);
?>
</div>
<?php
}
}
echo '<div class="ms-extra-fields">';
/**
* Trigger default WordPress action to allow other plugins
* to add custom fields to the registration form.
*
* signup_extra_fields Defined in wp-signup.php which is used
* for Multisite signup process.
*
* register_form Defined in wp-login.php which is only used for
* Single site registration process.
*
* @since 1.0.0
*/
if (is_multisite()) {
$empty_error = new WP_Error();
do_action('signup_extra_fields', $empty_error);
} else {
do_action('register_form');
// Always on the register form.
}
echo '</div>';
MS_Helper_Html::html_element($register_button);
if (is_wp_error($this->error)) {
//.........這裏部分代碼省略.........
示例4: html_full_form
/**
* Display the full settings form, used either by first membership
* "completed" popup and also by the general settings tab.
*
* @since 1.0.0
* @return string HTML code
*/
public function html_full_form()
{
$fields = $this->prepare_fields();
ob_start();
?>
<div class="ms-setup-form">
<?php
if (!MS_Plugin::is_network_wide()) {
?>
<div class="ms-setup-nav">
<div class="ms-title">
<i class="ms-icon dashicons dashicons-menu"></i>
<?php
_e('Please select pages you want to appear in your Navigation', MS_TEXT_DOMAIN);
?>
</div>
<div class="ms-description">
<?php
printf(__('You can always change those later by going to %1$s in your admin sidebar.', MS_TEXT_DOMAIN), sprintf('<a href="%1$s" target="_blank">%2$s</a>', admin_url('nav-menus.php'), __('Appearance') . ' » ' . __('Menus')));
?>
</div>
<?php
echo $this->show_menu_controls();
?>
</div>
<?php
}
?>
<div class="ms-setup-pages">
<div class="ms-title">
<i class="ms-icon dashicons dashicons-admin-page"></i>
<?php
_e('Membership 2 Pages', MS_TEXT_DOMAIN);
?>
</div>
<div class="ms-description">
<?php
_e('Set Up Membership 2 Pages that will be displayed on your website.', MS_TEXT_DOMAIN);
?>
</div>
<?php
if (is_array($fields['pages'])) {
$page_types = array_keys($fields['pages']);
$page_types_menu = array('memberships', 'register', 'account');
$page_types_rest = array_diff($page_types, $page_types_menu);
$groups = array('in-menu' => $page_types_menu, 'no-menu' => $page_types_rest);
$pages_site_id = MS_Model_Pages::get_site_info('id');
MS_Factory::select_blog($pages_site_id);
foreach ($groups as $group_key => $group_items) {
printf('<div class="ms-pages-group %1$s">', esc_attr($group_key));
foreach ($group_items as $key) {
$field = $fields['pages'][$key];
?>
<div class="ms-settings-page-wrapper">
<?php
MS_Helper_Html::html_element($field);
?>
<div class="ms-action">
<?php
MS_Helper_Html::html_link(array('id' => 'url_page_' . $field['value'], 'url' => '', 'value' => __('View Page', MS_TEXT_DOMAIN), 'target' => '_blank', 'data_ms' => array('base' => get_home_url($pages_site_id, 'index.php?page_id='))));
?>
<span> | </span>
<?php
MS_Helper_Html::html_link(array('id' => 'edit_url_page_' . $field['value'], 'url' => '', 'value' => __('Edit Page', MS_TEXT_DOMAIN), 'target' => '_blank', 'data_ms' => array('base' => get_admin_url($pages_site_id, 'post.php?action=edit&post='))));
?>
</div>
</div>
<?php
}
echo '</div>';
}
} else {
echo $fields['pages'];
}
MS_Factory::revert_blog();
?>
</div>
</div>
<?php
$html = ob_get_clean();
return apply_filters('ms_view_settings_page_setup_to_html', $html);
}
示例5: html_full_form
//.........這裏部分代碼省略.........
printf(__('You can always change those later by going to %1$s in your admin sidebar.', MS_TEXT_DOMAIN), sprintf('<a href="%1$s" target="_blank">%2$s</a>', admin_url('nav-menus.php'), __('Appearance') . ' » ' . __('Menus')));
?>
</div>
<?php
echo '' . $this->show_menu_controls();
?>
</div>
<?php
} else {
?>
<div class="ms-setup-site">
<div class="ms-title">
<i class="ms-icon dashicons dashicons-admin-network"></i>
<?php
_e('Select the Site that hosts Membership 2 Pages', MS_TEXT_DOMAIN);
?>
</div>
<div class="ms-description">
<?php
_e('When you change the site new Membership 2 Pages are created on the selected site. You can customize or replace these pages at any time.', MS_TEXT_DOMAIN);
?>
</div>
<?php
$site_options = MS_Helper_Settings::get_blogs();
$site_fields = array(array('type' => MS_Helper_Html::INPUT_TYPE_SELECT, 'id' => 'network_site', 'title' => __('Select the site that hosts the Membership 2 Pages', MS_TEXT_DOMAIN), 'value' => MS_Model_Pages::get_site_info('id'), 'field_options' => $site_options, 'class' => 'ms-site-options'), array('type' => MS_Helper_Html::INPUT_TYPE_HIDDEN, 'name' => 'action', 'value' => 'network_site'), array('type' => MS_Helper_Html::INPUT_TYPE_HIDDEN, 'name' => '_wpnonce', 'value' => wp_create_nonce('network_site')), array('type' => MS_Helper_Html::INPUT_TYPE_SUBMIT, 'value' => __('Save', MS_TEXT_DOMAIN)), array('type' => MS_Helper_Html::INPUT_TYPE_BUTTON, 'class' => 'ms-setup-pages-cancel', 'value' => __('Cancel', MS_TEXT_DOMAIN)));
?>
<div class="ms-setup-pages-site">
<div class="ms-setup-pages-site-info"><?php
printf(__('Membership pages are located on site %s', MS_TEXT_DOMAIN), '<strong>' . MS_Model_Pages::get_site_info('title') . '</strong>');
?>
<a href="#change-site" class="ms-setup-pages-change-site"><?php
_e('Change site...', MS_TEXT_DOMAIN);
?>
</a></div>
<div class="ms-setup-pages-site-form cf" style="display:none;">
<?php
foreach ($site_fields as $field) {
MS_Helper_Html::html_element($field);
}
?>
</div>
</div>
</div>
<?php
}
?>
<div class="ms-setup-pages">
<div class="ms-title">
<i class="ms-icon dashicons dashicons-admin-page"></i>
<?php
_e('Membership 2 Pages', MS_TEXT_DOMAIN);
?>
</div>
<div class="ms-description">
<?php
_e('Set Up Membership 2 Pages that will be displayed on your website.', MS_TEXT_DOMAIN);
?>
</div>
<?php
if (is_array($fields['pages'])) {
$page_types = array_keys($fields['pages']);
$page_types_menu = array('memberships', 'register', 'account');
$page_types_rest = array_diff($page_types, $page_types_menu);
$groups = array('in-menu' => $page_types_menu, 'no-menu' => $page_types_rest);
$pages_site_id = MS_Model_Pages::get_site_info('id');
MS_Factory::select_blog($pages_site_id);
foreach ($groups as $group_key => $group_items) {
printf('<div class="ms-pages-group %1$s">', esc_attr($group_key));
foreach ($group_items as $key) {
$field = $fields['pages'][$key];
?>
<div class="ms-settings-page-wrapper">
<?php
MS_Helper_Html::html_element($field);
?>
<div class="ms-action">
<?php
MS_Helper_Html::html_link(array('id' => 'url_page_' . $field['value'], 'url' => '', 'value' => __('View Page', MS_TEXT_DOMAIN), 'target' => '_blank', 'data_ms' => array('base' => get_home_url($pages_site_id, 'index.php?page_id='))));
?>
<span> | </span>
<?php
MS_Helper_Html::html_link(array('id' => 'edit_url_page_' . $field['value'], 'url' => '', 'value' => __('Edit Page', MS_TEXT_DOMAIN), 'target' => '_blank', 'data_ms' => array('base' => get_admin_url($pages_site_id, 'post.php?action=edit&post='))));
?>
</div>
</div>
<?php
}
echo '</div>';
}
} else {
echo $fields['pages'];
}
MS_Factory::revert_blog();
?>
</div>
</div>
<?php
$html = ob_get_clean();
return apply_filters('ms_view_settings_page_setup_to_html', $html);
}