本文整理汇总了PHP中wpmem_chk_qstr函数的典型用法代码示例。如果您正苦于以下问题:PHP wpmem_chk_qstr函数的具体用法?PHP wpmem_chk_qstr怎么用?PHP wpmem_chk_qstr使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了wpmem_chk_qstr函数的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: wpmem_do_sidebar
/**
* Creates the sidebar login form and status.
*
* This function determines if the user is logged in and displays either
* a login form, or the user's login status. Typically used for a sidebar.
* You can call this directly, or with the widget.
*
* @since 2.4
*
* @param string $post_to A URL to redirect to upon login, default null.
* @global string $wpmem_regchk
* @global string $user_login
*/
function wpmem_do_sidebar($post_to = null)
{
global $wpmem, $wpmem_regchk;
// Used here and in the logout.
$url = get_bloginfo('url');
if (!$post_to) {
if (isset($_REQUEST['redirect_to'])) {
$post_to = $_REQUEST['redirect_to'];
} elseif (is_home() || is_front_page()) {
$post_to = $_SERVER['REQUEST_URI'];
} elseif (is_single() || is_page()) {
$post_to = get_permalink();
} elseif (is_category()) {
global $wp_query;
$cat_id = get_query_var('cat');
$post_to = get_category_link($cat_id);
} elseif (is_search()) {
$post_to = $url . '/?s=' . get_search_query();
} else {
$post_to = $_SERVER['REQUEST_URI'];
}
}
// Clean whatever the url is.
$post_to = esc_url($post_to);
if (!is_user_logged_in()) {
// If the user is not logged in, we need the form.
// Defaults.
$defaults = array('error_before' => '<p class="err">', 'error_after' => '</p>', 'fieldset_before' => '<fieldset>', 'fieldset_after' => '</fieldset>', 'inputs_before' => '<div class="div_texbox">', 'inputs_after' => '</div>', 'buttons_before' => '<div class="button_div">', 'buttons_after' => '</div>', 'error_msg' => __('Login Failed!<br />You entered an invalid username or password.', 'wp-members'), 'status_msg' => __('You are not logged in.', 'wp-members') . '<br />', 'strip_breaks' => true, 'wrap_inputs' => true, 'n' => "\n", 't' => "\t");
/**
* Filter arguments for the sidebar defaults.
*
* @since 2.9.0
*
* @param array An array of the defaults to be changed.
*/
$args = apply_filters('wpmem_sb_login_args', '');
// Merge $args with defaults.
$args = wp_parse_args($args, $defaults);
$form = '';
$label = '<label for="username">' . __('Username') . '</label>';
$input = '<input type="text" name="log" class="username" id="username" />';
$input = $args['wrap_inputs'] ? $args['inputs_before'] . $input . $args['inputs_after'] : $input;
$row1 = $label . $args['n'] . $input . $args['n'];
$label = '<label for="password">' . __('Password') . '</label>';
$input = '<input type="password" name="pwd" class="password" id="password" />';
$input = $args['wrap_inputs'] ? $args['inputs_before'] . $input . $args['inputs_after'] : $input;
$row2 = $label . $args['n'] . $input . $args['n'];
$form = $row1 . $row2;
$hidden = '<input type="hidden" name="rememberme" value="forever" />' . $args['n'] . '<input type="hidden" name="redirect_to" value="' . $post_to . '" />' . $args['n'] . '<input type="hidden" name="a" value="login" />' . $args['n'] . '<input type="hidden" name="slog" value="true" />';
/**
* Filter sidebar login form hidden fields.
*
* @since 2.9.0
*
* @param string $hidden The HTML for the hidden fields.
*/
$form = $form . apply_filters('wpmem_sb_hidden_fields', $hidden);
$buttons = '<input type="submit" name="Submit" class="buttons" value="' . __('log in', 'wp-members') . '" />';
if ($wpmem->user_pages['profile'] != null) {
/** This filter is documented in wp-members/inc/forms.php */
$link = apply_filters('wpmem_forgot_link', wpmem_chk_qstr($wpmem->user_pages['profile']) . 'a=pwdreset');
$link_html = ' <a href="' . $link . '">' . __('Forgot?', 'wp-members') . '</a> ';
/**
* Filter the sidebar forgot password.
*
* @since 3.0.9
*
* @param string $link_html
* @param string $link
*/
$link_html = apply_filters('wpmem_sb_forgot_link_str', $link_html, $link);
$buttons .= $link_html;
}
if ($wpmem->user_pages['register'] != null) {
/** This filter is documented in wp-members/inc/forms.php */
$link = apply_filters('wpmem_reg_link', $wpmem->user_pages['register']);
$link_html = ' <a href="' . $link . '">' . __('Register') . '</a>';
/**
* Filter the sidebar register link.
*
* @since 3.0.9
*
* @param string $link_html
* @param string $link
*/
$link_html = apply_filters('wpmem_sb_reg_link_str', $link_html, $link);
$buttons .= $link_html;
//.........这里部分代码省略.........
示例2: wpmem_login_form
//.........这里部分代码省略.........
// Put the rows from the array into $form.
$form = '';
foreach ($rows as $row_item) {
$row = $row_item['row_before'] != '' ? $row_item['row_before'] . $args['n'] . $row_item['label'] . $args['n'] : $row_item['label'] . $args['n'];
$row .= $row_item['field_before'] != '' ? $row_item['field_before'] . $args['n'] . $args['t'] . $row_item['field'] . $args['n'] . $row_item['field_after'] . $args['n'] : $row_item['field'] . $args['n'];
$row .= $row_item['row_before'] != '' ? $row_item['row_after'] . $args['n'] : '';
$form .= $row;
}
// Build hidden fields, filter, and add to the form.
$hidden = wpmem_create_formfield('redirect_to', 'hidden', $args['redirect_to']) . $args['n'];
$hidden = $hidden . wpmem_create_formfield('a', 'hidden', $arr['action']) . $args['n'];
$hidden = $arr['action'] != 'login' ? $hidden . wpmem_create_formfield('formsubmit', 'hidden', '1') : $hidden;
/**
* Filter the hidden field HTML.
*
* @since 2.9.0
*
* @param string $hidden The generated HTML of hidden fields.
* @param string $arr['action'] The action being performed by the form. login|pwdreset|pwdchange.
*/
$form = $form . apply_filters('wpmem_login_hidden_fields', $hidden, $arr['action']);
// Build the buttons, filter, and add to the form.
if ($arr['action'] == 'login') {
$args['remember_check'] = $args['remember_check'] ? $args['t'] . wpmem_create_formfield('rememberme', 'checkbox', 'forever') . ' ' . __('Remember Me') . ' ' . $args['n'] : '';
$buttons = $args['remember_check'] . $args['t'] . '<input type="submit" name="Submit" value="' . $arr['button_text'] . '" class="' . $args['button_class'] . '" />' . $args['n'];
} else {
$buttons = '<input type="submit" name="Submit" value="' . $arr['button_text'] . '" class="' . $args['button_class'] . '" />' . $args['n'];
}
/**
* Filter the HTML for form buttons.
*
* The string includes the buttons, as well as the before/after wrapper elements.
*
* @since 2.9.0
*
* @param string $buttons The generated HTML of the form buttons.
* @param string $arr['action'] The action being performed by the form. login|pwdreset|pwdchange.
*/
$form = $form . apply_filters('wpmem_login_form_buttons', $args['buttons_before'] . $args['n'] . $buttons . $args['buttons_after'] . $args['n'], $arr['action']);
if (($wpmem->user_pages['profile'] != null || $page == 'members') && $arr['action'] == 'login') {
/**
* Filter the forgot password link.
*
* @since 2.8.0
*
* @param string The forgot password link.
*/
$link = apply_filters('wpmem_forgot_link', wpmem_chk_qstr($wpmem->user_pages['profile']) . 'a=pwdreset');
$str = __('Forgot password?', 'wp-members') . ' <a href="' . $link . '">' . __('Click here to reset', 'wp-members') . '</a>';
$form = $form . $args['link_before'] . apply_filters('wpmem_forgot_link_str', $str) . $args['link_after'] . $args['n'];
}
if ($wpmem->user_pages['register'] != null && $arr['action'] == 'login') {
/**
* Filter the link to the registration page.
*
* @since 2.8.0
*
* @param string The registration page link.
*/
$link = apply_filters('wpmem_reg_link', $wpmem->user_pages['register']);
$str = __('New User?', 'wp-members') . ' <a href="' . $link . '">' . __('Click here to register', 'wp-members') . '</a>';
$form = $form . $args['link_before'] . apply_filters('wpmem_reg_link_str', $str) . $args['link_after'] . $args['n'];
}
// Apply the heading.
$form = $args['heading_before'] . $arr['heading'] . $args['heading_after'] . $args['n'] . $form;
// Apply fieldset wrapper.
$form = $args['fieldset_before'] . $args['n'] . $form . $args['fieldset_after'] . $args['n'];
// Apply form wrapper.
$form = '<form action="' . get_permalink() . '" method="POST" id="' . $args['form_id'] . '" class="' . $args['form_class'] . '">' . $args['n'] . $form . '</form>';
// Apply anchor.
$form = '<a name="' . $arr['action'] . '"></a>' . $args['n'] . $form;
// Apply main wrapper.
$form = $args['main_div_before'] . $args['n'] . $form . $args['n'] . $args['main_div_after'];
// Apply wpmem_txt wrapper.
$form = $args['txt_before'] . $form . $args['txt_after'];
// Remove line breaks.
$form = $args['strip_breaks'] ? str_replace(array("\n", "\r", "\t"), array('', '', ''), $form) : $form;
/**
* Filter the generated HTML of the entire form.
*
* @since 2.7.4
*
* @param string $form The HTML of the final generated form.
* @param string $arr['action'] The action being performed by the form. login|pwdreset|pwdchange.
*/
$form = apply_filters('wpmem_login_form', $form, $arr['action']);
/**
* Filter before the form.
*
* This rarely used filter allows you to stick any string onto the front of
* the generated form.
*
* @since 2.7.4
*
* @param string $str The HTML to add before the form. Default null.
* @param string $arr['action'] The action being performed by the form. login|pwdreset|pwdchange.
*/
$form = apply_filters('wpmem_login_form_before', '', $arr['action']) . $form;
return $form;
}
示例3: wpmem_shortcode
/**
* Executes various shortcodes
*
* This function executes shortcodes for pages (settings, register, login, user-list,
* and tos pages), as well as login status and field attributes when the wp-members tag
* is used. Also executes shortcodes for login status with the wpmem_logged_in tags
* and fields when the wpmem_field tags are used.
*
* @since 2.4
*
* @param array $attr page|url|status|msg|field|id
* @param string $content
* @param string $tag
* @return string returns the result of wpmem_do_sc_pages|wpmem_list_users|wpmem_sc_expmessage|$content
*/
function wpmem_shortcode($attr, $content = null, $tag = 'wp-members')
{
// set all default attributes to false
$defaults = array('page' => false, 'url' => false, 'status' => false, 'msg' => false, 'field' => false, 'id' => false);
// merge defaults with $attr and extract
extract(shortcode_atts($defaults, $attr, $tag));
// handles the 'page' attribute
if ($page) {
if ($page == 'user-list') {
//return ( function_exists( 'wpmem_list_users' ) ) ? do_shortcode( wpmem_list_users( $attr, $content ) ) : '';
if (function_exists('wpmem_list_users')) {
$content = do_shortcode(wpmem_list_users($attr, $content));
}
} elseif ($page == 'tos') {
return $url;
} else {
//return do_shortcode( wpmem_do_sc_pages( $page ) );
$content = do_shortcode(wpmem_do_sc_pages($page));
}
// resolve any texturize issues...
if (strstr($content, '[wpmem_txt]')) {
// fix the wptexturize
remove_filter('the_content', 'wpautop');
remove_filter('the_content', 'wptexturize');
add_filter('the_content', 'wpmem_texturize', 99);
}
return $content;
}
// handles the 'status' attribute
if ($status || $tag == 'wpmem_logged_in') {
$do_return = false;
// if using the wpmem_logged_in tag with no attributes & the user is logged in
if ($tag == 'wpmem_logged_in' && !$attr && is_user_logged_in()) {
$do_return = true;
}
// if there is a status attribute of "in" and the user is logged in
if ($status == 'in' && is_user_logged_in()) {
$do_return = true;
}
// if there is a status attribute of "out" and the user is not logged in
if ($status == 'out' && !is_user_logged_in()) {
$do_return = true;
}
// if there is a status attribute of "sub" and the user is logged in
if ($status == 'sub' && is_user_logged_in()) {
if (WPMEM_USE_EXP == 1) {
if (!wpmem_chk_exp()) {
$do_return = true;
} elseif ($msg == true) {
$do_return = true;
$content = wpmem_sc_expmessage();
}
}
}
// return content (or empty content) depending on the result of the above logic
return $do_return ? do_shortcode($content) : '';
}
// handles the wpmem_logged_out tag with no attributes & the user is not logged in
if ($tag == 'wpmem_logged_out' && !$attr && !is_user_logged_in()) {
return do_shortcode($content);
}
// handles the 'field' attribute
if ($field || $tag == 'wpmem_field') {
if ($id) {
// we are getting some other user
if ($id == 'get') {
$the_user_ID = isset($_GET['uid']) ? $_GET['uid'] : '';
} else {
$the_user_ID = $id;
}
} else {
// get the current user
$the_user_ID = get_current_user_id();
}
$user_info = get_userdata($the_user_ID);
// @todo - check this change
return $user_info ? htmlspecialchars($user_info->{$field}) . do_shortcode($content) : do_shortcode($content);
// return ( $user_info ) ? htmlspecialchars( $user_info->$field ) . do_shortcode( $content ) : '';
}
// logout link shortcode
if (is_user_logged_in() && $tag == 'wpmem_logout') {
$link = $url ? wpmem_chk_qstr($url) . 'a=logout' : wpmem_chk_qstr(get_permalink()) . 'a=logout';
$text = $content ? $content : __('Click here to log out.', 'wp-members');
return do_shortcode("<a href=\"{$link}\">{$text}</a>");
}
//.........这里部分代码省略.........
示例4: wpmem_inc_memberlinks
/**
* Member Links Dialog.
*
* Outputs the links used on the members area.
*
* @since 2.0
*
* @param string $page
* @return string $str
*/
function wpmem_inc_memberlinks($page = 'members')
{
global $user_login, $wpmem;
$link = wpmem_chk_qstr();
/**
* Filter the log out link.
*
* @since 2.8.3
*
* @param string $link The default logout link.
*/
$logout = apply_filters('wpmem_logout_link', $link . 'a=logout');
switch ($page) {
case 'members':
$str = '<ul><li><a href="' . $link . 'a=edit">' . __('Edit My Information', 'wp-members') . '</a></li>
<li><a href="' . $link . 'a=pwdchange">' . __('Change Password', 'wp-members') . '</a></li>';
if (defined('WPMEM_EXP_MODULE') && $wpmem->use_exp == 1 && function_exists('wpmem_user_page_detail')) {
$str .= wpmem_user_page_detail();
}
$str .= '</ul>';
/**
* Filter the links displayed on the User Profile page (logged in state).
*
* @since 2.8.3
*
* @param string $str The default links.
*/
$str = apply_filters('wpmem_member_links', $str);
break;
case 'register':
$str = '<p>' . sprintf(__('You are logged in as %s', 'wp-members'), $user_login) . '</p>
<ul>
<li><a href="' . $logout . '">' . __('Click to log out.', 'wp-members') . '</a></li>
<li><a href="' . get_option('home') . '">' . __('Begin using the site.', 'wp-members') . '</a></li>
</ul>';
/**
* Filter the links displayed on the Register page (logged in state).
*
* @since 2.8.3
*
* @param string $str The default links.
*/
$str = apply_filters('wpmem_register_links', $str);
break;
case 'login':
$args = array('wrapper_before' => '<p>', 'wrapper_after' => '</p>', 'user_login' => $user_login, 'welcome' => __('You are logged in as %s', 'wp-members'), 'logout_text' => __('Click to log out', 'wp-members'), 'logout_link' => '<a href="' . $logout . '">%s</a>', 'separator' => '<br />');
/**
* Filter the status message parts.
*
* @since 2.9.9
*
* @param array $args.
*/
$args = apply_filters('wpmem_login_links_args', $args);
// Assemble the message string.
$str = $args['wrapper_before'] . sprintf($args['welcome'], $args['user_login']) . $args['separator'] . sprintf($args['logout_link'], $args['logout_text']) . $args['wrapper_after'];
/**
* Filter the links displayed on the Log In page (logged in state).
*
* @since 2.8.3
*
* @param string $str The default links.
*/
$str = apply_filters('wpmem_login_links', $str);
break;
case 'status':
$args = array('wrapper_before' => '<p>', 'wrapper_after' => '</p>', 'user_login' => $user_login, 'welcome' => __('You are logged in as %s', 'wp-members'), 'logout_text' => __('click to log out', 'wp-members'), 'logout_link' => '<a href="' . $logout . '">%s</a>', 'separator' => ' | ');
/**
* Filter the status message parts.
*
* @since 2.9.9
*
* @param array $args.
*/
$args = apply_filters('wpmem_status_msg_args', $args);
// Assemble the message string.
$str = $args['wrapper_before'] . sprintf($args['welcome'], $args['user_login']) . $args['separator'] . sprintf($args['logout_link'], $args['logout_text']) . $args['wrapper_after'];
break;
}
return $str;
}
示例5: wpmem_redirect_to_login
/**
* Redirects a user to defined login page with return redirect.
*
* @since 3.0.2
*/
function wpmem_redirect_to_login()
{
global $wpmem;
if (!is_user_logged_in() && $wpmem->is_blocked()) {
global $post;
// Get the page location.
$page = urlencode("http://" . $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"]);
$url = wpmem_chk_qstr($wpmem->user_pages['login']) . 'redirect_to=' . $page;
wp_redirect($url);
exit;
}
return;
}
示例6: wpmem_shortcode
/**
* Executes various shortcodes.
*
* This function executes shortcodes for pages (settings, register, login, user-list,
* and tos pages), as well as login status and field attributes when the wp-members tag
* is used. Also executes shortcodes for login status with the wpmem_logged_in tags
* and fields when the wpmem_field tags are used.
*
* @since 2.4.0
*
* @global object $wpmem The WP_Members object.
*
* @param array $attr page|url|status|msg|field|id
* @param string $content
* @param string $tag
* @return string Returns the result of wpmem_do_sc_pages|wpmem_list_users|wpmem_sc_expmessage|$content.
*/
function wpmem_shortcode($attr, $content = null, $tag = 'wp-members')
{
global $wpmem;
// Set all default attributes to false.
$defaults = array('page' => false, 'redirect_to' => null, 'url' => false, 'status' => false, 'msg' => false, 'field' => false, 'id' => false, 'underscores' => 'off');
// Merge defaults with $attr.
$atts = shortcode_atts($defaults, $attr, $tag);
// Handles the 'page' attribute.
if ($atts['page']) {
if ($atts['page'] == 'user-list') {
if (function_exists('wpmem_list_users')) {
$content = do_shortcode(wpmem_list_users($attr, $content));
}
} elseif ($atts['page'] == 'tos') {
return $atts['url'];
} else {
$content = do_shortcode(wpmem_do_sc_pages($atts['page'], $atts['redirect_to']));
}
// Resolve any texturize issues.
if (strstr($content, '[wpmem_txt]')) {
// Fixes the wptexturize.
remove_filter('the_content', 'wpautop');
remove_filter('the_content', 'wptexturize');
add_filter('the_content', 'wpmem_texturize', 999);
}
return $content;
}
// Handles the 'status' attribute.
if ($atts['status'] || $tag == 'wpmem_logged_in') {
return do_shortcode(wpmem_sc_logged_in($atts, $content, $tag));
}
// @deprecated 3.0.0
// Handles the wpmem_logged_out tag with no attributes & the user is not logged in.
/*
if ( $tag == 'wpmem_logged_out' && ( ! $attr ) && ! is_user_logged_in() ) {
return do_shortcode( $content );
}
*/
// Handles the 'field' attribute.
if ($atts['field'] || $tag == 'wpmem_field') {
if ($atts['id']) {
// We are getting some other user.
if ($atts['id'] == 'get') {
$the_user_ID = isset($_GET['uid']) ? $_GET['uid'] : '';
} else {
$the_user_ID = $atts['id'];
}
} else {
// Get the current user.
$the_user_ID = get_current_user_id();
}
$user_info = get_userdata($the_user_ID);
if ($atts['underscores'] == 'off' && $user_info) {
$user_info->{$atts}['field'] = str_replace('_', ' ', $user_info->{$atts}['field']);
}
return $user_info ? htmlspecialchars($user_info->{$atts}['field']) . do_shortcode($content) : do_shortcode($content);
}
// Logout link shortcode.
if (is_user_logged_in() && $tag == 'wpmem_logout') {
$link = $atts['url'] ? wpmem_chk_qstr($atts['url']) . 'a=logout' : wpmem_chk_qstr(get_permalink()) . 'a=logout';
$text = $content ? $content : __('Click here to log out.', 'wp-members');
return do_shortcode("<a href=\"{$link}\">{$text}</a>");
}
}
示例7: wpmem_redirect_to_login
/**
* Redirects a user to defined login page with return redirect.
*
* @since 3.0.2
*
* @global object $wp The WordPress object.
* @global object $post The WordPress post object.
* @global object $wpmem The WP-Members object.
*/
function wpmem_redirect_to_login()
{
global $wp, $post, $wpmem;
if (!is_user_logged_in() && $wpmem->is_blocked()) {
// Get current page location.
$current_page = home_url(add_query_arg(array(), $wp->request));
$redirect_to = urlencode($current_page);
$url = wpmem_chk_qstr($wpmem->user_pages['login']) . 'redirect_to=' . $redirect_to;
wp_redirect($url);
exit;
}
return;
}
示例8: wpmem_login_form_NEW
/**
* Login Form Dialog
*
* Builds the table-less form used for
* login, change password, and reset password.
*
* @since 2.5.1
*
* @uses apply_filters Calls 'wpmem_login_form_before'
* @uses apply_filters Calls 'wpmem_forgot_link'
* @uses apply_filters Calls 'wpmem_reg_link'
* @uses apply_filters Calls 'wpmem_login_form'
*
* @param string $page
* @param array $arr
* @return string $form
*/
function wpmem_login_form_NEW($page, $arr)
{
// are we redirecting somewhere?
/*if( isset( $_REQUEST['redirect_to'] ) ) {
$redirect_to = $_REQUEST['redirect_to'];
} else {
$redirect_to = get_permalink();
}*/
$redirect_to = isset($_REQUEST['redirect_to']) ? esc_url($_REQUEST['redirect_to']) : get_permalink();
// fix the wptexturize
remove_filter('the_content', 'wpautop');
remove_filter('the_content', 'wptexturize');
add_filter('the_content', 'wpmem_texturize', 99);
$form = apply_filters('wpmem_login_form_before', '');
$form .= '[wpmem_txt]<div id="wpmem_login">
<a name="login"></a>
<form action="' . get_permalink() . '" method="POST" class="form">
<fieldset>
<legend>' . $arr[0] . '</legend>
<label for="username">' . $arr[1] . '</label>
<div class="div_text">
' . wpmem_create_formfield($arr[3], $arr[2], '', '', $arr[9]) . '
</div>
<label for="password">' . $arr[4] . '</label>
<div class="div_text">
' . wpmem_create_formfield($arr[6], $arr[5], '', '', $arr[10]) . '
</div>
<input type="hidden" name="redirect_to" value="' . $redirect_to . '" />';
if ($arr[7] != 'login') {
$form = $form . wpmem_create_formfield('formsubmit', 'hidden', '1');
}
$form = $form . wpmem_create_formfield('a', 'hidden', $arr[7]);
$form = $form . '<div class="button_div">';
if ($arr[7] == 'login') {
$form = $form . '<input name="rememberme" type="checkbox" id="rememberme" value="forever" /> ' . __('Remember me', 'wp-members') . ' <input type="submit" name="Submit" value="' . $arr[8] . '" class="buttons" />';
} else {
$form = $form . '<input type="submit" name="Submit" value="' . $arr[8] . '" class="buttons" />';
}
$form = $form . '</div>
<div class="clear"></div>
<div align="right">';
if ((WPMEM_MSURL != null || $page == 'members') && $arr[7] == 'login') {
$link = apply_filters('wpmem_forgot_link', wpmem_chk_qstr(WPMEM_MSURL) . 'a=pwdreset');
$form = $form . __('Forgot password?', 'wp-members') . ' <a href="' . $link . '">' . __('Click here to reset', 'wp-members') . '</a>';
}
$form = $form . '</div>
<div align="right">';
if (WPMEM_REGURL != null && $arr[7] == 'login') {
$link = apply_filters('wpmem_reg_link', WPMEM_REGURL);
$form = $form . __('New User?', 'wp-members') . ' <a href="' . $link . '">' . __('Click here to register', 'wp-members') . '</a>';
}
$form = $form . '</div>
<div class="clear"></div>
</fieldset></form>
</div>[/wpmem_txt]';
$form = apply_filters('wpmem_login_form', $form);
return $form;
}
示例9: wpmem_do_sidebar
/**
* Creates the sidebar login form and status
*
* This function determines if the user is logged in
* and displays either a login form, or the user's
* login status. Typically used for a sidebar.
* You can call this directly, or with the widget
*
* @since 2.4
*
* @uses apply_filters Calls 'wpmem_sidebar_form'
* @uses apply_filters Calls 'wpmem_sidebar_status'
* @uses apply_filters Calls 'wpmem_login_failed_sb'
* @uses apply_filters Calls 'wpmem_forgot_link'
* @uses apply_filters Calls 'wpmem_reg_link'
*
* @global string $wpmem_regchk
* @global string $user_login
*/
function wpmem_do_sidebar()
{
global $wpmem_regchk;
$url = get_bloginfo('url');
// used here and in the logout
//this returns us to the right place
if (isset($_REQUEST['redirect_to'])) {
$post_to = $_REQUEST['redirect_to'];
} elseif (is_home() || is_front_page()) {
$post_to = $_SERVER['PHP_SELF'];
} elseif (is_single() || is_page()) {
$post_to = get_permalink();
} elseif (is_category()) {
global $wp_query;
$cat_id = get_query_var('cat');
$post_to = get_category_link($cat_id);
} elseif (is_search()) {
$post_to = $url . '/?s=' . get_search_query();
} else {
$post_to = $_SERVER['PHP_SELF'];
}
// clean whatever the url is
$post_to = esc_url($post_to);
if (!is_user_logged_in()) {
if (WPMEM_OLD_FORMS == 1) {
include_once 'wp-members-deprecated.php';
wpmem_old_forms_sidebar($post_to);
} else {
$str = '';
if ($wpmem_regchk == 'loginfailed' && $_POST['slog'] == 'true') {
$str = '<p class="err">' . __('Login Failed!<br />You entered an invalid username or password.', 'wp-members') . '</p>';
$str = apply_filters('wpmem_login_failed_sb', $str);
}
$str .= __('You are not currently logged in.', 'wp-members') . '<br />
<fieldset>
<form name="form" method="post" action="' . $post_to . '">
<label for="username">' . __('Username', 'wp-members') . '</label>
<div class="div_texbox"><input type="text" name="log" class="username" id="username" /></div>
<label for="password">' . __('Password', 'wp-members') . '</label>
<div class="div_texbox"><input type="password" name="pwd" class="password" id="password" /></div>
<input type="hidden" name="rememberme" value="forever" />
<input type="hidden" name="redirect_to" value="' . $post_to . '" />
<input type="hidden" name="a" value="login" />
<input type="hidden" name="slog" value="true" />
<div class="button_div"><input type="submit" name="Submit" class="buttons" value="' . __('login', 'wp-members') . '" />';
if (WPMEM_MSURL != null) {
$link = apply_filters('wpmem_forgot_link', wpmem_chk_qstr(WPMEM_MSURL) . 'a=pwdreset');
$str .= ' <a href="' . $link . '">' . __('Forgot?', 'wp-members') . '</a> ';
}
if (WPMEM_REGURL != null) {
$link = apply_filters('wpmem_reg_link', WPMEM_REGURL);
$str .= ' <a href="' . $link . '">' . __('Register', 'wp-members') . '</a>';
}
$str .= '</div>
</form>
</fieldset>';
$str = apply_filters('wpmem_sidebar_form', $str);
echo $str;
}
} else {
global $user_login;
$logout = $url . '/?a=logout';
$str = '<p>' . sprintf(__('You are logged in as %s', 'wp-members'), $user_login) . '<br />
<a href="' . $logout . '">' . __('click here to logout', 'wp-members') . '</a></p>';
$str = apply_filters('wpmem_sidebar_status', $str);
echo $str;
}
}
示例10: wpmem_do_sidebar
/**
* Creates the sidebar login form and status.
*
* This function determines if the user is logged in and displays either
* a login form, or the user's login status. Typically used for a sidebar.
* You can call this directly, or with the widget.
*
* @since 2.4
*
* @param string $post_to A URL to redirect to upon login, default null.
* @global string $wpmem_regchk
* @global string $user_login
*/
function wpmem_do_sidebar($post_to = null)
{
global $wpmem_regchk;
$url = get_bloginfo('url');
// used here and in the logout
$post_to = $_SERVER['REQUEST_URI'];
// clean whatever the url is
$post_to = esc_url($post_to);
if (!is_user_logged_in()) {
// if the user is not logged in, we need the form
// defaults
$defaults = array('error_before' => '<p class="err">', 'error_after' => '</p>', 'fieldset_before' => '<fieldset>', 'fieldset_after' => '</fieldset>', 'inputs_before' => '<div class="div_texbox">', 'inputs_after' => '</div>', 'buttons_before' => '<div>', 'buttons_after' => '</div>', 'error_msg' => __('Login Failed!<br />You entered an invalid username or password.', 'wp-members'), 'status_msg' => __('You are not logged in.', 'wp-members') . '<br />', 'strip_breaks' => true, 'wrap_inputs' => true, 'n' => "\n", 't' => "\t");
/**
* Filter arguments for the sidebar defaults.
*
* @since 2.9.0
*
* @param array An array of the defaults to be changed.
*/
$args = apply_filters('wpmem_sb_login_args', '');
// merge $args with defaults and extract
extract(wp_parse_args($args, $defaults));
$form = '';
$focus1 = "if (this.value == 'VU-net-ID') {this.value = '';}";
$blur1 = "if (this.value == '') {this.value = 'VU-net-ID';}";
$focus2 = "if (this.value == 'Wachtwoord') {this.value = '';}";
$blur2 = "if (this.value == '') {this.value = 'Wachtwoord';}";
$label = '<span class="add-on" style="float: left;"><i class="icon-user"></i></span>';
$input = '<input type="text" name="log" class="username" id="username" value="VU-net-ID" style="margin-top: -10px;" onfocus="' . $focus1 . '" onblur="' . $blur1 . '" />';
$input = $wrap_inputs ? $inputs_before . $input . $inputs_after : $input;
$row1 = $label . $n . $input . $n;
$label = '<span class="add-on" style="float: left;"><i class="icon-lock"></i></span>';
$input = '<input type="password" name="pwd" class="password" id="password" value="Wachtwoord" style="margin-top: -10px;" onfocus="' . $focus2 . '" onblur="' . $blur2 . '" />';
$input = $wrap_inputs ? $inputs_before . $input . $inputs_after : $input;
$row2 = $label . $n . $input . $n;
$form = $row1 . $row2;
$hidden = '<input type="hidden" name="rememberme" value="forever" />' . $n . '<input type="hidden" name="redirect_to" value="' . $post_to . '" />' . $n . '<input type="hidden" name="a" value="login" />' . $n . '<input type="hidden" name="slog" value="true" />';
/**
* Filter sidebar login form hidden fields.
*
* @since 2.9.0
*
* @param string $hidden The HTML for the hidden fields.
*/
$form = $form . apply_filters('wpmem_sb_hidden_fields', $hidden);
$buttons = '<input type="submit" name="Submit" class="wpcf7-submit" style="margin-right: 5px;" value="' . __('log in', 'wp-members') . '" />';
if (WPMEM_MSURL != null) {
/**
* Filter the sidebar forgot password link.
*
* @since 2.8.0
*
* @param string The forgot password link.
*/
$link = apply_filters('wpmem_forgot_link', wpmem_chk_qstr(WPMEM_MSURL) . 'a=pwdreset');
$buttons .= ' <a href="' . $link . '">' . __('Forgot?', 'wp-members') . '</a> ';
}
if (WPMEM_REGURL != null) {
/**
* Filter the sidebar register link.
*
* @since 2.8.0
*
* @param string The register link.
*/
$link = apply_filters('wpmem_reg_link', WPMEM_REGURL);
$buttons .= ' <a href="' . $link . '">' . __('Register') . '</a>';
}
$form = $form . $n . $buttons_before . $buttons . $n . $buttons_after;
$form = $fieldset_before . $n . $form . $n . $fieldset_after;
$form = '<form name="form" method="post" action="' . $post_to . '">' . $n . $form . $n . '</form>';
// add status message
$form = $status_msg . $n . $form;
// strip breaks
$form = $strip_breaks ? str_replace(array("\n", "\r", "\t"), array('', '', ''), $form) : $form;
/**
* Filter the sidebar form.
*
* @since ?.?
*
* @param string $form The HTML for the sidebar login form.
*/
$form = apply_filters('wpmem_sidebar_form', $form);
$do_error_msg = '';
if (isset($_POST['slog']) && $wpmem_regchk == 'loginfailed') {
$do_error_msg = true;
$error_msg = $error_before . $error_msg . $error_after;
//.........这里部分代码省略.........
示例11: wpmem_old_forms_sidebar
/**
* Old form sidebar login
*
* @since 2.8.0
*
* @param string $post_to
*/
function wpmem_old_forms_sidebar($post_to)
{
?>
<ul>
<?php
if ($wpmem_regchk == 'loginfailed' && $_POST['slog'] == 'true') {
?>
<p><?php
_e('Login Failed!<br />You entered an invalid username or password.', 'wp-members');
?>
</p>
<?php
}
?>
<p><?php
_e('You are not currently logged in.', 'wp-members');
?>
<br />
<form name="form" method="post" action="<?php
echo $post_to;
?>
">
<?php
_e('Username', 'wp-members');
?>
<br />
<input type="text" name="log" style="font:10px verdana,sans-serif;" /><br />
<?php
_e('Password', 'wp-members');
?>
<br />
<input type="password" name="pwd" style="font:10px verdana,sans-serif;" /><br />
<input type="hidden" name="rememberme" value="forever" />
<input type="hidden" name="redirect_to" value="<?php
echo $post_to;
?>
" />
<input type="hidden" name="a" value="login" />
<input type="hidden" name="slog" value="true" />
<input type="submit" name="Submit" value="<?php
_e('login', 'wp-members');
?>
" style="font:10px verdana,sans-serif;" />
<?php
if (WPMEM_MSURL != null) {
$link = wpmem_chk_qstr(WPMEM_MSURL);
?>
<a href="<?php
echo $link;
?>
a=pwdreset"><?php
_e('Forgot?', 'wp-members');
?>
</a>
<?php
}
if (WPMEM_REGURL != null) {
?>
<a href="<?php
echo WPMEM_REGURL;
?>
"><?php
_e('Register', 'wp-members');
?>
</a>
<?php
}
?>
</form>
</p>
</ul>
<?php
}
示例12: wpmem_inc_memberlinks
/**
* Member Links Dialog
*
* Outputs the links used on the members area.
*
* @since 2.0
*
* @param string $page
* @return string $str
*/
function wpmem_inc_memberlinks($page = 'members')
{
global $user_login;
$link = wpmem_chk_qstr();
/**
* Filter the log out link.
*
* @since 2.8.3
*
* @param string $link The default logout link.
*/
$logout = apply_filters('wpmem_logout_link', $link . 'a=logout');
switch ($page) {
case 'members':
$str = '<ul><li><a href="' . $link . 'a=edit">' . __('Edit My Information', 'wp-members') . '</a></li>
<li><a href="' . $link . 'a=pwdchange">' . __('Change Password', 'wp-members') . '</a></li>';
if (WPMEM_USE_EXP == 1 && function_exists('wpmem_user_page_detail')) {
$str .= wpmem_user_page_detail();
}
$str .= '</ul>';
/**
* Filter the links displayed on the User Profile page (logged in state).
*
* @since 2.8.3
*
* @param string $str The default links.
*/
$str = apply_filters('wpmem_member_links', $str);
break;
case 'register':
$str = '<p>' . sprintf(__('You are logged in as %s', 'wp-members'), $user_login) . '</p>
<ul>
<li><a href="' . $logout . '">' . __('Click to log out.', 'wp-members') . '</a></li>
<li><a href="' . get_option('home') . '">' . __('Begin using the site.', 'wp-members') . '</a></li>
</ul>';
/**
* Filter the links displayed on the Register page (logged in state).
*
* @since 2.8.3
*
* @param string $str The default links.
*/
$str = apply_filters('wpmem_register_links', $str);
break;
case 'login':
$str = '<p>
' . sprintf(__('You are logged in as %s', 'wp-members'), $user_login) . '<br />
<a href="' . $logout . '">' . __('Click to log out', 'wp-members') . '</a>
</p>';
/**
* Filter the links displayed on the Log In page (logged in state).
*
* @since 2.8.3
*
* @param string $str The default links.
*/
$str = apply_filters('wpmem_login_links', $str);
break;
case 'status':
$str = '<p>
' . sprintf(__('You are logged in as %s', 'wp-members'), $user_login) . ' |
<a href="' . $logout . '">' . __('click to log out', 'wp-members') . '</a>
</p>';
break;
}
return $str;
}
示例13: wpmem_inc_memberlinks
/**
* Member Links Dialog
*
* Outputs the links used on the members area.
*
* @since 2.0
*
* @uses apply_filters Calls 'wpmem_member_links'
* @uses apply_filters Calls 'wpmem_register_links'
* @uses apply_filters Calls 'wpmem_login_links'
*
* @param string $page
* @return string $str
*/
function wpmem_inc_memberlinks($page = 'members')
{
global $user_login;
$link = wpmem_chk_qstr();
switch ($page) {
case 'members':
$str = '<ul><li><a href="' . $link . 'a=edit">' . __('Edit My Information', 'wp-members') . '</a></li>
<li><a href="' . $link . 'a=pwdchange">' . __('Change Password', 'wp-members') . '</a></li>';
if (WPMEM_USE_EXP == 1) {
$str .= wpmem_user_page_detail();
}
$str .= '</ul>';
$str = apply_filters('wpmem_member_links', $str);
break;
case 'register':
// $str = '<p>' . sprintf( __( 'You are logged in as %s', 'wp-members' ), $user_login ) . '</p>
// <ul>
// <li><a href="' . $link . 'a=logout">' . __( 'Click here to logout.', 'wp-members' ) . '</a></li>
// <li><a href="' . get_option('siteurl') . '">' . __( 'Begin using the site.', 'wp-members' ) . '</a></li>
// </ul>';
// $str = apply_filters( 'wpmem_register_links', $str );
wp_safe_redirect("/");
break;
case 'login':
// $str = '<p>
// ' . sprintf( __( 'You are logged in as %s', 'wp-members' ), $user_login ) . '<br />
// <a href="' . $link . 'a=logout">' . __( 'click here to logout', 'wp-members' ) . '</a>
// </p>';
// $str = apply_filters( 'wpmem_login_links', $str );
// break;
wp_safe_redirect("/");
case 'status':
$str = '<p>
' . sprintf(__('You are logged in as %s', 'wp-members'), $user_login) . ' |
<a href="' . $link . 'a=logout">' . __('click here to logout', 'wp-members') . '</a>
</p>';
break;
}
return $str;
}