Make WordPress Core

Ticket #28351: 28351~5.diff

File 28351~5.diff, 7.8 KB (added by UmeshSingla, 9 years ago)

Updated docs for filters

  • wp-signup.php

     
    105105                echo '<input name="blogname" type="text" id="blogname" value="'.esc_attr($blogname).'" maxlength="60" /><span class="suffix_address">.' . ( $site_domain = preg_replace( '|^www\.|', '', $current_site->domain ) ) . '</span><br />';
    106106
    107107        if ( !is_user_logged_in() ) {
    108                 if ( !is_subdomain_install() )
     108                if ( ! is_subdomain_install() ) {
    109109                        $site = $current_site->domain . $current_site->path . __( 'sitename' );
    110                 else
     110                } else {
    111111                        $site = __( 'domain' ) . '.' . $site_domain . $current_site->path;
    112                 echo '<p>(<strong>' . sprintf( __('Your address will be %s.'), $site ) . '</strong>) ' . __( 'Must be at least 4 characters, letters and numbers only. It cannot be changed, so choose carefully!' ) . '</p>';
     112                }
     113
     114                $blogname_text = __( 'Must be at least 4 characters, letters and numbers only. It cannot be changed, so choose carefully!' );
     115                /**
     116                 * Filter the default blogname text.
     117                 *
     118                 * @since 4.4.0
     119                 *
     120                 * @param string $blogname_text Blogname help text for new blog signup
     121                 */
     122                $blogname_text = apply_filters( 'signup_blogname_text', $blogname_text );
     123                echo '<p>(<strong>' . sprintf( __( 'Your address will be %s.' ), $site ) . '</strong>) ' . $blogname_text . '</p>';
    113124        }
    114125
    115126        // Blog Title
     
    179190                echo '<p class="error">'.$errmsg.'</p>';
    180191        }
    181192        echo '<input name="user_name" type="text" id="user_name" value="'. esc_attr($user_name) .'" maxlength="60" /><br />';
    182         _e( '(Must be at least 4 characters, letters and numbers only.)' );
     193
     194        $username_text = __( '(Must be at least 4 characters, letters and numbers only.)' );
     195        /**
     196         * Filter the username text.
     197         *
     198         * @since 4.4.0
     199         *
     200         * @param string $username_text Username help text, printed on the screen
     201         */
     202        echo apply_filters( 'signup_username_text', $username_text );
    183203        ?>
    184204
    185205        <label for="user_email"><?php _e( 'Email&nbsp;Address:' ) ?></label>
    186         <?php if ( $errmsg = $errors->get_error_message('user_email') ) { ?>
     206        <?php if ( $errmsg = $errors->get_error_message( 'user_email' ) ) { ?>
    187207                <p class="error"><?php echo $errmsg ?></p>
    188         <?php } ?>
    189         <input name="user_email" type="email" id="user_email" value="<?php  echo esc_attr($user_email) ?>" maxlength="200" /><br /><?php _e('We send your registration email to this address. (Double-check your email address before continuing.)') ?>
     208        <?php }
     209
     210        $email_text = __( 'We send your registration email to this address. (Double-check your email address before continuing.)' );
     211        /**
     212         * Filter the registration email text.
     213         *
     214         * @since 4.4.0
     215         *
     216         * @param string $email_text Registration email content sent to the user.
     217         */
     218        $email_text = apply_filters( 'signup_email_text', $email_text ); ?>
     219        <input name="user_email" type="email" id="user_email" value="<?php echo esc_attr( $user_email ) ?>" maxlength="200"/>
     220        <br/><?php echo $email_text; ?>
    190221        <?php
    191         if ( $errmsg = $errors->get_error_message('generic') ) {
     222        if ( $errmsg = $errors->get_error_message( 'generic' ) ) {
    192223                echo '<p class="error">' . $errmsg . '</p>';
    193224        }
    194225        /**
     
    493524 * @param string $user_name The username
    494525 * @param string $user_email The user's email address
    495526 */
    496 function confirm_user_signup($user_name, $user_email) {
    497         ?>
    498         <h2><?php printf( __( '%s is your new username' ), $user_name) ?></h2>
    499         <p><?php _e( 'But, before you can start using your new username, <strong>you must activate it</strong>.' ) ?></p>
    500         <p><?php printf( __( 'Check your inbox at <strong>%s</strong> and click the link given.' ), $user_email ); ?></p>
    501         <p><?php _e( 'If you do not activate your username within two days, you will have to sign up again.' ); ?></p>
    502         <?php
     527function confirm_user_signup( $user_name, $user_email ) {
     528        $message =
     529        "<h2>" . sprintf( __( '%s is your new username' ), $user_name ) . "</h2>
     530        <p>" . _( 'But, before you can start using your new username, <strong>you must activate it</strong>.' ) . "</p>
     531        <p>" . sprintf( __( 'Check your inbox at <strong>%s</strong> and click the link given.' ), $user_email ) . "</p>
     532        <p>" . _( 'If you do not activate your username within two days, you will have to sign up again.' ) . "</p>";
     533       
     534        /**
     535         * Filter the user signup confirmation message
     536         *
     537         * @since 4.2
     538         *
     539         * @param string $message The default message
     540         * @param string $user_name The username
     541         * @param string $user_email The user's email address
     542         */
     543        echo apply_filters( 'confirm_user_signup', $message, $user_name, $user_email );
     544
    503545        /** This action is documented in wp-signup.php */
    504546        do_action( 'signup_finished' );
    505547}
     
    622664 * @param array $meta Any additional meta from the 'add_signup_meta' filter in validate_blog_signup()
    623665 */
    624666function confirm_blog_signup( $domain, $path, $blog_title, $user_name = '', $user_email = '', $meta = array() ) {
    625         ?>
    626         <h2><?php printf( __( 'Congratulations! Your new site, %s, is almost ready.' ), "<a href='http://{$domain}{$path}'>{$blog_title}</a>" ) ?></h2>
     667        $message =
     668        "<h2>" . sprintf( __( 'Congratulations! Your new site, %s, is almost ready.' ), "<a href='http://{$domain}{$path}'>{$blog_title}</a>" ) . "</h2>
     669        <p>" . _( 'But, before you can start using your site, <strong>you must activate it</strong>.' ) . "</p>
     670        <p>" . sprintf( __( 'Check your inbox at <strong>%s</strong> and click the link given.' ),  $user_email ) . "</p>
     671        <p>" . _( 'If you do not activate your site within two days, you will have to sign up again.' ) . "</p>
     672        <h2>" . _( 'Still waiting for your email?' ) . "</h2>
     673        <p>" .
     674                _( 'If you haven&#8217;t received your email yet, there are a number of things you can do:' )
     675                . "<ul id='noemail-tips'>
     676                        <li><p><strong>" . _( 'Wait a little longer. Sometimes delivery of email can be delayed by processes outside of our control.' ) . "</strong></p></li>
     677                        <li><p>" . _( 'Check the junk or spam folder of your email client. Sometime emails wind up there by mistake.' ) . "</p></li>
     678                        <li>" . sprintf( __( 'Have you entered your email correctly? You have entered %s, if it&#8217;s incorrect, you will not receive your email.' ), $user_email ) . "</li>
     679                </ul>
     680        </p>";
    627681
    628         <p><?php _e( 'But, before you can start using your site, <strong>you must activate it</strong>.' ) ?></p>
    629         <p><?php printf( __( 'Check your inbox at <strong>%s</strong> and click the link given.' ),  $user_email) ?></p>
    630         <p><?php _e( 'If you do not activate your site within two days, you will have to sign up again.' ); ?></p>
    631         <h2><?php _e( 'Still waiting for your email?' ); ?></h2>
    632         <p>
    633                 <?php _e( 'If you haven&#8217;t received your email yet, there are a number of things you can do:' ) ?>
    634                 <ul id="noemail-tips">
    635                         <li><p><strong><?php _e( 'Wait a little longer. Sometimes delivery of email can be delayed by processes outside of our control.' ) ?></strong></p></li>
    636                         <li><p><?php _e( 'Check the junk or spam folder of your email client. Sometime emails wind up there by mistake.' ) ?></p></li>
    637                         <li><?php printf( __( 'Have you entered your email correctly? You have entered %s, if it&#8217;s incorrect, you will not receive your email.' ), $user_email ) ?></li>
    638                 </ul>
    639         </p>
    640         <?php
     682        /**
     683         * Filter the blog signup confirmation message
     684         *
     685         * @since 4.2
     686         *
     687         * @param string $message The domain URL
     688         * @param string $domain The domain URL
     689         * @param string $path The site root path
     690         * @param string $blog_title The new site title
     691         * @param string $user_name, The username
     692         * @param string $user_email The user's email address
     693         * @param array $meta Any additional meta from the 'add_signup_meta' filter in validate_blog_signup()
     694         */
     695        echo apply_filters( 'confirm_blog_signup', $message, $domain, $path, $blog_title, $user_name, $user_email, $meta );
    641696        /** This action is documented in wp-signup.php */
    642697        do_action( 'signup_finished' );
    643698}