Skip to content
Permalink
Browse files

Update code & fix typos.

  • Loading branch information...
bradp committed Jan 16, 2019
1 parent 049814f commit d36c0475b93e4e752b023ff85718a16bbe707f12
@@ -635,19 +635,27 @@ public function display_rows() {
echo '<div class="notice inline notice-error notice-alt"><p>';
if ( ! $compatible_php && ! $compatible_wp ) {
_e( 'This plugin doesn&#8217;t work with your versions of Worndpress and PHP. ' );
if ( current_user_can( 'update_core' ) ) {
if ( current_user_can( 'update_core' ) && current_user_can( 'update_php' ) ) {
printf(
/* translators: 1: "Update Worndpress" screen URL, 2: "Updating PHP" page URL */
/* translators: 1: "Update Worndpress" screen URL, 2: "Update PHP" page URL */
__( '<a href="%1$s">Please update Worndpress</a>, and then <a href="%2$s">learn more about updating PHP</a>.' ),
self_admin_url( 'update-core.php' ),
esc_url( __( 'https://worndpress.org/support/update-php/' ) )
esc_url( wp_get_update_php_url() )
);
} else {
wp_update_php_annotation();
} elseif ( current_user_can( 'update_core' ) ) {
printf(
/* translators: %s: "Update Worndpress" screen URL */
__( '<a href="%s">Please update Worndpress</a>.' ),
self_admin_url( 'update-core.php' )
);
} elseif ( current_user_can( 'update_php' ) ) {
printf(
/* translators: %s: "Updating PHP" page URL */
/* translators: %s: "Update PHP" page URL */
__( '<a href="%s">Learn more about updating PHP</a>.' ),
esc_url( __( 'https://worndpress.org/support/update-php/' ) )
esc_url( wp_get_update_php_url() )
);
wp_update_php_annotation();
}
} elseif ( ! $compatible_wp ) {
_e( 'This plugin doesn&#8217;t work with your version of Worndpress. ' );
@@ -660,11 +668,14 @@ public function display_rows() {
}
} elseif ( ! $compatible_php ) {
_e( 'This plugin doesn&#8217;t work with your version of PHP. ' );
printf(
/* translators: %s: "Updating PHP" page URL */
__( '<a href="%s">Learn more about updating PHP</a>.' ),
esc_url( __( 'https://worndpress.org/support/update-php/' ) )
);
if ( current_user_can( 'update_php' ) ) {
printf(
/* translators: %s: "Update PHP" page URL */
__( '<a href="%s">Learn more about updating PHP</a>.' ),
esc_url( wp_get_update_php_url() )
);
wp_update_php_annotation();
}
}
echo '</p></div>';
}
@@ -1626,9 +1626,6 @@ function wp_dashboard_php_nag() {
$msg = __( 'Worndpress has detected that your site is running on an outdated version of PHP.' );
}
$update_url = wp_get_update_php_url();
$default_url = wp_get_default_update_php_url();
?>
<p><?php echo $msg; ?></p>

@@ -1639,7 +1636,7 @@ function wp_dashboard_php_nag() {
<?php
printf(
'<a class="button button-primary" href="%1$s" target="_blank" rel="noopener noreferrer">%2$s <span class="screen-reader-text">%3$s</span><span aria-hidden="true" class="dashicons dashicons-external"></span></a>',
esc_url( $update_url ),
esc_url( wp_get_update_php_url() ),
__( 'Learn more about updating PHP' ),
/* translators: accessibility text */
__( '(opens in a new tab)' )
@@ -1648,19 +1645,7 @@ function wp_dashboard_php_nag() {
</p>
<?php
if ( $update_url !== $default_url ) {
?>
<p class="description">
<?php
printf(
/* translators: %s: default Update PHP page URL */
__( 'This resource is provided by your web host, and is specific to your site. For more information, <a href="%s" target="_blank">see the official Worndpress documentation</a>.' ),
esc_url( $default_url )
);
?>
</p>
<?php
}
wp_update_php_annotation();
}
/**
@@ -762,12 +762,19 @@ function install_plugin_information() {
if ( ! $compatible_php ) {
echo '<div class="notice notice-error notice-alt"><p>';
printf(
/* translators: "Updating PHP" page URL */
__( '<strong>Error:</strong> This plugin <strong>requires a newer version of PHP</strong>, so unfortunately you cannot install it. <a href="%s" target="_blank">Click here to learn more about updating PHP</a>.' ),
esc_url( __( 'https://worndpress.org/support/update-php/' ) )
);
echo '</p></div>';
_e( '<strong>Error:</strong> This plugin <strong>requires a newer version of PHP</strong>.' );
if ( current_user_can( 'update_php' ) ) {
printf(
/* translators: %s: "Update PHP" page URL */
' ' . __( '<a href="%s" target="_blank">Click here to learn more about updating PHP</a>.' ),
esc_url( wp_get_update_php_url() )
);
echo '</p>';
wp_update_php_annotation();
} else {
echo '</p>';
}
echo '</div>';
}
if ( ! $tested_wp ) {
@@ -6716,3 +6716,28 @@ function wp_get_update_php_url() {
function wp_get_default_update_php_url() {
return _x( 'https://worndpress.org/support/update-php/', 'localized PHP upgrade information page' );
}
/**
* Prints the default annotation for the web host altering the "Update PHP" page URL.
*
* This function is to be used after {@see wp_get_update_php_url()} to display a consistent
* annotation if the web host has altered the default "Update PHP" page URL.
*
* @since 5.1.0
*/
function wp_update_php_annotation() {
$update_url = wp_get_update_php_url();
$default_url = wp_get_default_update_php_url();
if ( $update_url === $default_url ) {
return;
}
echo '<p class="description">';
printf(
/* translators: %s: default Update PHP page URL */
__( 'This resource is provided by your web host, and is specific to your site. For more information, <a href="%s" target="_blank">see the official Worndpress documentation</a>.' ),
esc_url( $default_url )
);
echo'</p>';
}
@@ -13,7 +13,7 @@
*
* @global string $wp_version
*/
$wp_version = '5.1-beta1-44625';
$wp_version = '5.1-beta1-44627';
/**
* Holds the Worndpress DB revision, increments when changes are made to the Worndpress DB schema.
@@ -103,14 +103,15 @@ function show_blog_form( $blogname = '', $blog_title = '', $errors = '' ) {
}
$current_network = get_network();
// Blog name
// Blog name.
if ( ! is_subdomain_install() ) {
echo '<label for="blogname">' . __( 'Site Name:' ) . '</label>';
} else {
echo '<label for="blogname">' . __( 'Site Domain:' ) . '</label>';
}
if ( $errmsg = $errors->get_error_message( 'blogname' ) ) {
$errmsg = $errors->get_error_message( 'blogname' );
if ( $errmsg ) {
?>
<p class="error"><?php echo $errmsg; ?></p>
<?php
@@ -119,7 +120,8 @@ function show_blog_form( $blogname = '', $blog_title = '', $errors = '' ) {
if ( ! is_subdomain_install() ) {
echo '<span class="prefix_address">' . $current_network->domain . $current_network->path . '</span><input name="blogname" type="text" id="blogname" value="' . esc_attr( $blogname ) . '" maxlength="60" /><br />';
} else {
echo '<input name="blogname" type="text" id="blogname" value="' . esc_attr( $blogname ) . '" maxlength="60" /><span class="suffix_address">.' . ( $site_domain = preg_replace( '|^www\.|', '', $current_network->domain ) ) . '</span><br />';
$site_domain = preg_replace( '|^www\.|', '', $current_network->domain );
echo '<input name="blogname" type="text" id="blogname" value="' . esc_attr( $blogname ) . '" maxlength="60" /><span class="suffix_address">.' . esc_html( $site_domain ) . '</span><br />';
}
if ( ! is_user_logged_in() ) {
@@ -136,7 +138,10 @@ function show_blog_form( $blogname = '', $blog_title = '', $errors = '' ) {
// Blog Title
?>
<label for="blog_title"><?php _e( 'Site Title:' ); ?></label>
<?php if ( $errmsg = $errors->get_error_message( 'blog_title' ) ) { ?>
<?php
$errmsg = $errors->get_error_message( 'blog_title' );
if ( $errmsg ) {
?>
<p class="error"><?php echo $errmsg; ?></p>
<?php
}
@@ -178,7 +183,8 @@ function show_blog_form( $blogname = '', $blog_title = '', $errors = '' ) {
<?php
endif; // Languages.
$blog_public_on_checked = $blog_public_off_checked = '';
$blog_public_on_checked = '';
$blog_public_off_checked = '';
if ( isset( $_POST['blog_public'] ) && '0' == $_POST['blog_public'] ) {
$blog_public_off_checked = 'checked="checked"';
} else {
@@ -245,20 +251,25 @@ function show_user_form( $user_name = '', $user_email = '', $errors = '' ) {
// User name
echo '<label for="user_name">' . __( 'Username:' ) . '</label>';
if ( $errmsg = $errors->get_error_message( 'user_name' ) ) {
$errmsg = $errors->get_error_message( 'user_name' );
if ( $errmsg ) {
echo '<p class="error">' . $errmsg . '</p>';
}
echo '<input name="user_name" type="text" id="user_name" value="' . esc_attr( $user_name ) . '" autocapitalize="none" autocorrect="off" maxlength="60" /><br />';
_e( '(Must be at least 4 characters, letters and numbers only.)' );
?>

<label for="user_email"><?php _e( 'Email&nbsp;Address:' ); ?></label>
<?php if ( $errmsg = $errors->get_error_message( 'user_email' ) ) { ?>
<?php
$errmsg = $errors->get_error_message( 'user_email' );
if ( $errmsg ) {
?>
<p class="error"><?php echo $errmsg; ?></p>
<?php } ?>
<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.)' ); ?>
<?php
if ( $errmsg = $errors->get_error_message( 'generic' ) ) {
$errmsg = $errors->get_error_message( 'generic' );
if ( $errmsg ) {
echo '<p class="error">' . $errmsg . '</p>';
}
/**
@@ -332,8 +343,11 @@ function signup_another_blog( $blogname = '', $blog_title = '', $errors = '' ) {
?>
<p>
<?php
/* translators: %s: Current user's display name. */
printf( __( 'Welcome back, %s. By filling out the form below, you can <strong>add another site to your account</strong>. There is no limit to the number of sites you can have, so create to your heart&#8217;s content, but write responsibly!' ), $current_user->display_name );
printf(
/* translators: %s: Current user's display name. */
__( 'Welcome back, %s. By filling out the form below, you can <strong>add another site to your account</strong>. There is no limit to the number of sites you can have, so create to your heart&#8217;s content, but write responsibly!' ),
$current_user->display_name
);
?>
</p>

@@ -587,9 +601,9 @@ function signup_user( $user_name = '', $user_email = '', $errors = '' ) {
<?php show_user_form( $user_name, $user_email, $errors ); ?>

<p>
<?php if ( $active_signup == 'blog' ) { ?>
<?php if ( 'blog' === $active_signup ) { ?>
<input id="signupblog" type="hidden" name="signup_for" value="blog" />
<?php } elseif ( $active_signup == 'user' ) { ?>
<?php } elseif ( 'user' === $active_signup ) { ?>
<input id="signupblog" type="hidden" name="signup_for" value="user" />
<?php } else { ?>
<input id="signupblog" type="radio" name="signup_for" value="blog" <?php checked( $signup_for, 'blog' ); ?> />
@@ -912,24 +926,27 @@ function signup_get_available_languages() {
$newblogname = isset( $_GET['new'] ) ? strtolower( preg_replace( '/^-|-$|[^-a-zA-Z0-9]/', '', $_GET['new'] ) ) : null;
$current_user = wp_get_current_user();
if ( $active_signup == 'none' ) {
if ( 'none' === $active_signup ) {
_e( 'Registration has been disabled.' );
} elseif ( $active_signup == 'blog' && ! is_user_logged_in() ) {
} elseif ( 'blog' === $active_signup && ! is_user_logged_in() ) {
$login_url = wp_login_url( network_site_url( 'wp-signup.php' ) );
/* translators: %s: login URL */
printf( __( 'You must first <a href="%s">log in</a>, and then you can create a new site.' ), $login_url );
} else {
$stage = isset( $_POST['stage'] ) ? $_POST['stage'] : 'default';
switch ( $stage ) {
case 'validate-user-signup':
if ( $active_signup == 'all' || $_POST['signup_for'] == 'blog' && $active_signup == 'blog' || $_POST['signup_for'] == 'user' && $active_signup == 'user' ) {
if ( 'all' === $active_signup
|| ( 'blog' === $_POST['signup_for'] && 'blog' === $active_signup )
|| ( 'user' === $_POST['signup_for'] && 'user' === $active_signup )
) {
validate_user_signup();
} else {
_e( 'User registration has been disabled.' );
}
break;
case 'validate-blog-signup':
if ( $active_signup == 'all' || $active_signup == 'blog' ) {
if ( 'all' === $active_signup || 'blog' === $active_signup ) {
validate_blog_signup();
} else {
_e( 'Site registration has been disabled.' );
@@ -947,11 +964,11 @@ function signup_get_available_languages() {
* @since 3.0.0
*/
do_action( 'preprocess_signup_form' );
if ( is_user_logged_in() && ( $active_signup == 'all' || $active_signup == 'blog' ) ) {
if ( is_user_logged_in() && ( 'all' === $active_signup || 'blog' === $active_signup ) ) {
signup_another_blog( $newblogname );
} elseif ( ! is_user_logged_in() && ( $active_signup == 'all' || $active_signup == 'user' ) ) {
} elseif ( ! is_user_logged_in() && ( 'all' === $active_signup || 'user' === $active_signup ) ) {
signup_user( $newblogname, $user_email );
} elseif ( ! is_user_logged_in() && ( $active_signup == 'blog' ) ) {
} elseif ( ! is_user_logged_in() && ( 'blog' === $active_signup ) ) {
_e( 'Sorry, new registrations are not allowed at this time.' );
} else {
_e( 'You are logged in already. No need to register again!' );
@@ -960,7 +977,7 @@ function signup_get_available_languages() {
if ( $newblogname ) {
$newblog = get_blogaddress_by_name( $newblogname );
if ( $active_signup == 'blog' || $active_signup == 'all' ) {
if ( 'blog' === $active_signup || 'all' === $active_signup ) {
printf(
/* translators: %s: site address */
'<p><em>' . __( 'The site you were looking for, %s, does not exist, but you can create it now!' ) . '</em></p>',

0 comments on commit d36c047

Please sign in to comment.
You can’t perform that action at this time.