regchk != "success" ) { $dialogs = get_option( 'wpmembers_dialogs' ); // This shown above blocked content. $msg = $wpmem->get_text( 'restricted_msg' ); $msg = ( $dialogs['restricted_msg'] == $msg ) ? $msg : __( stripslashes( $dialogs['restricted_msg'] ), 'wp-members' ); $str = '

' . $msg . '

'; /** * Filter the post restricted message. * * @since 2.7.3 * * @param string $str The post restricted message. */ $str = apply_filters( 'wpmem_restricted_msg', $str ); } } // Create the default inputs. $default_inputs = array( array( 'name' => $wpmem->get_text( 'login_username' ), 'type' => 'text', 'tag' => 'log', 'class' => 'username', 'div' => 'div_text', ), array( 'name' => $wpmem->get_text( 'login_password' ), 'type' => 'password', 'tag' => 'pwd', 'class' => 'password', 'div' => 'div_text', ), ); /** * Filter the array of login form fields. * * @since 2.9.0 * * @param array $default_inputs An array matching the elements used by default. */ $default_inputs = apply_filters( 'wpmem_inc_login_inputs', $default_inputs ); $defaults = array( 'heading' => $wpmem->get_text( 'login_heading' ), 'action' => 'login', 'button_text' => $wpmem->get_text( 'login_button' ), 'inputs' => $default_inputs, 'redirect_to' => $redirect_to, ); /** * Filter the arguments to override login form defaults. * * @since 2.9.0 * * @param array $args An array of arguments to use. Default null. */ $args = apply_filters( 'wpmem_inc_login_args', '' ); $arr = wp_parse_args( $args, $defaults ); $str = ( $show == 'show' ) ? $str . wpmem_login_form( $page, $arr ) : $str; return $str; } endif; if ( ! function_exists( 'wpmem_inc_changepassword' ) ): /** * Change Password Dialog. * * Loads the form for changing password. * * @since 2.0.0 * * @global object $wpmem The WP_Members object. * @return string $str The generated html for the change password form. */ function wpmem_inc_changepassword() { global $wpmem; // create the default inputs $default_inputs = array( array( 'name' => $wpmem->get_text( 'pwdchg_password1' ), 'type' => 'password', 'tag' => 'pass1', 'class' => 'password', 'div' => 'div_text', ), array( 'name' => $wpmem->get_text( 'pwdchg_password2' ), 'type' => 'password', 'tag' => 'pass2', 'class' => 'password', 'div' => 'div_text', ), ); /** * Filter the array of change password form fields. * * @since 2.9.0 * * @param array $default_inputs An array matching the elements used by default. */ $default_inputs = apply_filters( 'wpmem_inc_changepassword_inputs', $default_inputs ); $defaults = array( 'heading' => $wpmem->get_text( 'pwdchg_heading' ), 'action' => 'pwdchange', 'button_text' => $wpmem->get_text( 'pwdchg_button' ), 'inputs' => $default_inputs, ); /** * Filter the arguments to override change password form defaults. * * @since 2.9.0 * * @param array $args An array of arguments to use. Default null. */ $args = apply_filters( 'wpmem_inc_changepassword_args', '' ); $arr = wp_parse_args( $args, $defaults ); $str = wpmem_login_form( 'page', $arr ); return $str; } endif; if ( ! function_exists( 'wpmem_inc_resetpassword' ) ): /** * Reset Password Dialog. * * Loads the form for resetting password. * * @since 2.1.0 * * @global object $wpmem The WP_Members object. * @return string $str The generated html fo the reset password form. */ function wpmem_inc_resetpassword() { global $wpmem; // Create the default inputs. $default_inputs = array( array( 'name' => $wpmem->get_text( 'pwdreset_username' ), 'type' => 'text', 'tag' => 'user', 'class' => 'username', 'div' => 'div_text', ), array( 'name' => $wpmem->get_text( 'pwdreset_email' ), 'type' => 'text', 'tag' => 'email', 'class' => 'password', 'div' => 'div_text', ), ); /** * Filter the array of reset password form fields. * * @since 2.9.0 * * @param array $default_inputs An array matching the elements used by default. */ $default_inputs = apply_filters( 'wpmem_inc_resetpassword_inputs', $default_inputs ); $defaults = array( 'heading' => $wpmem->get_text( 'pwdreset_heading' ), 'action' => 'pwdreset', 'button_text' => $wpmem->get_text( 'pwdreset_button' ), 'inputs' => $default_inputs, ); /** * Filter the arguments to override reset password form defaults. * * @since 2.9.0 * * @param array $args An array of arguments to use. Default null. */ $args = apply_filters( 'wpmem_inc_resetpassword_args', '' ); $arr = wp_parse_args( $args, $defaults ); $str = wpmem_login_form( 'page', $arr ); return $str; } endif; if ( ! function_exists( 'wpmem_login_form' ) ): /** * Login Form Dialog. * * Builds the form used for login, change password, and reset password. * * @since 2.5.1 * @since 3.1.7 Now a wrapper for $wpmem->forms->login_form() * * @param string $page * @param array $arr { * The elements needed to generate the form (login|reset password|forgotten password). * * @type string $heading Form heading text. * @type string $action The form action (login|pwdchange|pwdreset). * @type string $button_text Form submit button text. * @type array $inputs { * The form input values. * * @type array { * * @type string $name The field label. * @type string $type Input type. * @type string $tag Input tag name. * @type string $class Input tag class. * @type string $div Div wrapper class. * } * } * @type string $redirect_to Optional. URL to redirect to. * } * @return string $form The HTML for the form as a string. */ function wpmem_login_form( $page, $arr ) { global $wpmem; return $wpmem->forms->login_form( $page, $arr ); } endif; if ( ! function_exists( 'wpmem_inc_registration' ) ): /** * Registration Form Dialog. * * Outputs the form for new user registration and existing user edits. * * @since 2.5.1 * @since 3.1.7 Now a wrapper for $wpmem->forms->register_form() * * @global object $wpmem The WP_Members object. * @param string $tag (optional) Toggles between new registration ('new') and user profile edit ('edit'). * @param string $heading (optional) The heading text for the form, null (default) for new registration. * @return string $form The HTML for the entire form as a string. */ function wpmem_inc_registration( $tag = 'new', $heading = '', $redirect_to = null ) { global $wpmem; return $wpmem->forms->register_form( $tag, $heading, $redirect_to ); } // End wpmem_inc_registration. endif; if ( ! function_exists( 'wpmem_inc_recaptcha' ) ): /** * Create reCAPTCHA form. * * @since 2.6.0 * * @param array $arr * @return string $str HTML for reCAPTCHA display. */ function wpmem_inc_recaptcha( $arr ) { // Determine if reCAPTCHA should be another language. $allowed_langs = array( 'nl', 'fr', 'de', 'pt', 'ru', 'es', 'tr' ); /** This filter is documented in wp-includes/l10n.php */ $locale = apply_filters( 'plugin_locale', get_locale(), 'wp-members' ); $compare_lang = strtolower( substr( $locale, -2 ) ); $use_the_lang = ( in_array( $compare_lang, $allowed_langs ) ) ? $compare_lang : false; $lang = ( $use_the_lang ) ? ' lang : \'' . $use_the_lang . '\'' : ''; // Determine if we need ssl. $http = wpmem_use_ssl(); global $wpmem; if ( $wpmem->captcha == 1 ) { $str = ' '; } elseif ( $wpmem->captcha == 3 ) { $str = '
'; } /** * Filter the reCAPTCHA HTML. * * @since 2.7.4 * * @param string $str A string of HTML for the reCAPTCHA. */ $str = apply_filters( 'wpmem_recaptcha', $str ); return $str; } endif; /** * Create an attribution link in the form. * * @since 2.6.0 * @since 3.1.1 Updated to use new object setting. * * @global object $wpmem * @return string $str */ function wpmem_inc_attribution() { global $wpmem; $http = ( is_ssl() ) ? 'https://' : 'http://'; $str = '
Powered by WP-Members
'; return ( 1 == $wpmem->attrib ) ? $str : ''; } /** * Create Really Simple CAPTCHA. * * @since 2.9.5 * * @global object $wpmem The WP_Members object. * @return array { * HTML Form elements for Really Simple CAPTCHA. * * @type string label_text The raw text used for the label. * @type string label The HTML for the label. * @type string field The input tag and the CAPTCHA image. * } */ function wpmem_build_rs_captcha() { global $wpmem; if ( defined( 'REALLYSIMPLECAPTCHA_VERSION' ) ) { // setup defaults $defaults = array( 'characters' => 'ABCDEFGHJKLMNPQRSTUVWXYZ23456789', 'num_char' => '4', 'dim_w' => '72', 'dim_h' => '30', 'font_color' => '0,0,0', 'bg_color' => '255,255,255', 'font_size' => '12', 'kerning' => '14', 'img_type' => 'png', ); $wpmem_captcha = get_option( 'wpmembers_captcha' ); $args = ( isset( $wpmem_captcha['really_simple'] ) && is_array( $wpmem_captcha['really_simple'] ) ) ? $wpmem_captcha['really_simple'] : array(); $args = wp_parse_args( $args, $defaults ); $img_size = array( $args['dim_w'], $args['dim_h'] ); $fg = explode( ",", $args['font_color'] ); $bg = explode( ",", $args['bg_color'] ); $wpmem_captcha = new ReallySimpleCaptcha(); $wpmem_captcha->chars = $args['characters']; $wpmem_captcha->char_length = $args['num_char']; $wpmem_captcha->img_size = $img_size; $wpmem_captcha->fg = $fg; $wpmem_captcha->bg = $bg; $wpmem_captcha->font_size = $args['font_size']; $wpmem_captcha->font_char_width = $args['kerning']; $wpmem_captcha->img_type = $args['img_type']; $wpmem_captcha_word = $wpmem_captcha->generate_random_word(); $wpmem_captcha_prefix = mt_rand(); $wpmem_captcha_image_name = $wpmem_captcha->generate_image( $wpmem_captcha_prefix, $wpmem_captcha_word ); /** * Filters the default Really Simple Captcha folder location. * * @since 3.0 * * @param string The default location of RS Captcha. */ $wpmem_captcha_image_url = apply_filters( 'wpmem_rs_captcha_folder', get_bloginfo('wpurl') . '/wp-content/plugins/really-simple-captcha/tmp/' ); $img_w = $wpmem_captcha->img_size[0]; $img_h = $wpmem_captcha->img_size[1]; $src = $wpmem_captcha_image_url . $wpmem_captcha_image_name; $size = $wpmem_captcha->char_length; $pre = $wpmem_captcha_prefix; return array( 'label_text' => $wpmem->get_text( 'register_rscaptcha' ), 'label' => '', 'field' => ' captcha' ); } else { return; } } // End of file.