Skip to content

Commit

Permalink
Merge branch 'release/1.1.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
nylen committed Sep 25, 2019
2 parents ac4bdf0 + f727b29 commit 71e5303
Show file tree
Hide file tree
Showing 14 changed files with 50 additions and 171 deletions.
9 changes: 0 additions & 9 deletions wp-admin/css/login-rtl.css
Original file line number Diff line number Diff line change
Expand Up @@ -167,15 +167,6 @@ p {
margin: auto;
}

.login .custom-logo-link img {
display: block;
margin: 10px auto;
max-width: 100px;
height: 100px;
-o-object-fit: contain;
object-fit: contain;
}

.login #nav,
.login #backtoblog {
font-size: 13px;
Expand Down
2 changes: 1 addition & 1 deletion wp-admin/css/login-rtl.min.css

Large diffs are not rendered by default.

9 changes: 0 additions & 9 deletions wp-admin/css/login.css
Original file line number Diff line number Diff line change
Expand Up @@ -167,15 +167,6 @@ p {
margin: auto;
}

.login .custom-logo-link img {
display: block;
margin: 10px auto;
max-width: 100px;
height: 100px;
-o-object-fit: contain;
object-fit: contain;
}

.login #nav,
.login #backtoblog {
font-size: 13px;
Expand Down
2 changes: 1 addition & 1 deletion wp-admin/css/login.min.css

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion wp-admin/includes/schema.php
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,6 @@ function populate_options() {
/* translators: site tagline */
'blogdescription' => __('Another great website powered by ClassicPress'),
'users_can_register' => 0,
'login_custom_logo' => 0,
'admin_email' => '[email protected]',
/* translators: default start of the week. 0 = Sunday, 1 = Monday */
'start_of_week' => _x( '1', 'start of week' ),
Expand Down
19 changes: 0 additions & 19 deletions wp-admin/options-general.php
Original file line number Diff line number Diff line change
Expand Up @@ -117,25 +117,6 @@
</td>
</tr>

<tr>
<th scope="row"><?php _e('Custom Login Image') ?></th>
<td> <fieldset><legend class="screen-reader-text"><span><?php _e('Custom Login Image') ?></span></legend><label for="login_custom_logo">
<input name="login_custom_logo" type="checkbox" id="login_custom_logo" aria-describedby="custom-login-image-description" value="1" <?php checked('1', get_option('login_custom_logo')); ?> />
<?php _e('Use the site logo as the login image') ?></label>
<p class="description" id="custom-login-image-description">
<?php
// From src/wp-admin/menu.php
$customize_url = add_query_arg( 'return', urlencode( remove_query_arg( wp_removable_query_args(), wp_unslash( $_SERVER['REQUEST_URI'] ) ) ), 'customize.php' );
printf(
/* translators: link to the Customizer */
__( 'If you set a logo image in the <a href="%s">Customizer</a> and enable this option, then the logo image will be shown at the top of the login page instead of the ClassicPress logo.' ),
esc_attr( $customize_url )
);
?>
</p>
</fieldset></td>
</tr>

<?php if ( ! is_multisite() ) { ?>

<tr>
Expand Down
3 changes: 0 additions & 3 deletions wp-admin/options.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@
'general' => array(
'blogname',
'blogdescription',
'login_custom_logo',
'gmt_offset',
'date_format',
'time_format',
Expand Down Expand Up @@ -159,8 +158,6 @@
$whitelist_options['writing'][] = 'use_balanceTags';
}

$whitelist_options['general'][] = 'login_custom_logo';

if ( !is_multisite() ) {
if ( !defined( 'WP_SITEURL' ) )
$whitelist_options['general'][] = 'siteurl';
Expand Down
5 changes: 0 additions & 5 deletions wp-includes/class-wp-xmlrpc-server.php
Original file line number Diff line number Diff line change
Expand Up @@ -561,11 +561,6 @@ public function initialise_blog_option_info() {
'readonly' => false,
'option' => 'users_can_register'
),
'login_custom_logo' => array(
'desc' => __( 'Use the site logo as the login image' ),
'readonly' => false,
'option' => 'login_custom_logo'
),
'thumbnail_size_w' => array(
'desc' => __( 'Thumbnail Width' ),
'readonly' => false,
Expand Down
1 change: 0 additions & 1 deletion wp-includes/formatting.php
Original file line number Diff line number Diff line change
Expand Up @@ -4108,7 +4108,6 @@ function sanitize_option( $option, $value ) {
case 'comments_per_page':
case 'thread_comments_depth':
case 'users_can_register':
case 'login_custom_logo':
case 'start_of_week':
case 'site_icon':
$value = absint( $value );
Expand Down
116 changes: 8 additions & 108 deletions wp-includes/general-template.php
Original file line number Diff line number Diff line change
Expand Up @@ -860,16 +860,10 @@ function has_custom_logo( $blog_id = 0 ) {
*
* @since WP-4.5.0
*
* @since 1.1.0 Added the $args parameter.
*
* @param int $blog_id Optional. ID of the blog in question. Default or 0 is
* the ID of the current blog.
* @param array $args Optional. May include 'title' key to set a link title
* and/or 'href' key to override the link URL.
*
* @param int $blog_id Optional. ID of the blog in question. Default is the ID of the current blog.
* @return string Custom logo markup.
*/
function get_custom_logo( $blog_id = 0, $args = array() ) {
function get_custom_logo( $blog_id = 0 ) {
$html = '';
$switched_blog = false;

Expand All @@ -890,30 +884,18 @@ function get_custom_logo( $blog_id = 0, $args = array() ) {
/*
* If the logo alt attribute is empty, get the site title and explicitly
* pass it to the attributes used by wp_get_attachment_image().
*
* If the alt attribute is not empty, there's no need to explicitly pass
* it because wp_get_attachment_image() already adds the alt attribute.
*/
$image_alt = get_post_meta( $custom_logo_id, '_wp_attachment_image_alt', true );
if ( empty( $image_alt ) ) {
$custom_logo_attr['alt'] = get_bloginfo( 'name', 'display' );
}

// Determine the link URL.
if ( ! isset( $args['href'] ) ) {
$args['href'] = home_url( '/' );
}

// Set a link title attribute if requested.
$title_attr = '';
if ( isset( $args['title'] ) ) {
$title_attr = ' title="' . esc_attr( $args['title'] ) . '"';
}

// Generate the custom logo HTML.
$html = sprintf( '<a href="%1$s" class="custom-logo-link" rel="home" itemprop="url"%2$s>%3$s</a>',
esc_url( $args['href'] ),
$title_attr,
/*
* If the alt attribute is not empty, there's no need to explicitly pass
* it because wp_get_attachment_image() already adds the alt attribute.
*/
$html = sprintf( '<a href="%1$s" class="custom-logo-link" rel="home" itemprop="url">%2$s</a>',
esc_url( home_url( '/' ) ),
wp_get_attachment_image( $custom_logo_id, 'full', false, $custom_logo_attr )
);
}
Expand All @@ -934,11 +916,9 @@ function get_custom_logo( $blog_id = 0, $args = array() ) {
*
* @since WP-4.5.0
* @since WP-4.6.0 Added the `$blog_id` parameter.
* @since 1.1.0 Added the $args parameter.
*
* @param string $html Custom logo HTML output.
* @param int $blog_id ID of the blog to get the custom logo for.
* @param array $args Other arguments to get_custom_logo(), if any.
*/
return apply_filters( 'get_custom_logo', $html, $blog_id );
}
Expand Down Expand Up @@ -4306,83 +4286,3 @@ function wp_heartbeat_settings( $settings ) {

return $settings;
}

/**
* Return the HTML for the image on the login screen. This is either a link
* showing the ClassicPress logo (the default) or the site's custom logo image
* (if a logo image is set and the `login_custom_logo` option is enabled).
*
* @since 1.1.0
*/
function get_login_image_html() {
/**
* Determine whether a site admin has enabled the `login_custom_logo`
* option and set a custom logo. If so, we can use it on the login page.
*/
$login_custom_logo = get_option( 'login_custom_logo' );
$login_custom_logo = ! empty( $login_custom_logo ) && has_custom_logo();

if ( $login_custom_logo ) {
$login_header_url = home_url( '/' );
$login_header_title = get_bloginfo( 'name', 'display' );
} elseif ( is_multisite() ) {
$login_header_url = network_home_url();
$login_header_title = get_network()->site_name;
} else {
$login_header_url = 'https://www.classicpress.net/';
$login_header_title = __( 'Powered by ClassicPress' );
}

/**
* Filters link URL of the header logo above login form.
*
* @since WP-2.1.0
*
* @param string $login_header_url Login header logo URL.
*/
$login_header_url = apply_filters( 'login_headerurl', $login_header_url );

/**
* Filters the title attribute of the header logo above login form.
*
* @since WP-2.1.0
*
* @param string $login_header_title Login header logo title attribute.
*/
$login_header_title = apply_filters( 'login_headertitle', $login_header_title );

/**
* If the user has enabled the `login_custom_logo` option and set a
* custom logo, then use the custom logo.
*/
if ( $login_custom_logo ) {
return get_custom_logo( 0, array(
'href' => $login_header_url,
'title' => $login_header_title,
) );
}

// Otherwise use the ClassicPress logo.

/**
* Set the link text (not displayed, but kept for compatibility).
*
* To match the URL/title set above, Multisite sites have the blog name,
* while single sites get the header title.
*/
if ( is_multisite() ) {
$login_header_text = get_bloginfo( 'name', 'display' );
} else {
$login_header_text = $login_header_title;
}

return (
'<h1>'
. '<a href="' . esc_url( $login_header_url ) . '"'
. ' title="' . esc_attr( $login_header_title ) . '"'
. ' tabindex="-1">'
. $login_header_text
. '</a>'
. '</h1>'
);
}
9 changes: 0 additions & 9 deletions wp-includes/option.php
Original file line number Diff line number Diff line change
Expand Up @@ -1847,15 +1847,6 @@ function register_initial_settings() {
) );
}

register_setting( 'general', 'login_custom_logo', array(
'show_in_rest' => array(
'name' => 'login_custom_logo',
),
'type' => 'boolean',
'default' => false,
'description' => __( 'Use the site logo as the login image' ),
) );

if ( ! is_multisite() ) {
register_setting( 'general', 'admin_email', array(
'show_in_rest' => array(
Expand Down
2 changes: 1 addition & 1 deletion wp-includes/script-loader.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ function classicpress_asset_version( $type = 'script', $handle = null ) {
static $default_version;

if ( empty( $default_version ) ) {
$default_version = 'cp_67658639';
$default_version = 'cp_01d38c46';
}

/**
Expand Down
2 changes: 1 addition & 1 deletion wp-includes/version.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
*
* @global string $cp_version
*/
$cp_version = '1.1.0-rc1';
$cp_version = '1.1.0';

/**
* The WordPress version string
Expand Down
41 changes: 38 additions & 3 deletions wp-login.php
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,42 @@ function login_header( $title = 'Log In', $message = '', $wp_error = null ) {
*/
do_action( 'login_head' );

if ( is_multisite() ) {
$login_header_url = network_home_url();
$login_header_title = get_network()->site_name;
} else {
$login_header_url = 'https://www.classicpress.net/';
$login_header_title = __( 'Powered by ClassicPress' );
}

/**
* Filters link URL of the header logo above login form.
*
* @since WP-2.1.0
*
* @param string $login_header_url Login header logo URL.
*/
$login_header_url = apply_filters( 'login_headerurl', $login_header_url );

/**
* Filters the title attribute of the header logo above login form.
*
* @since WP-2.1.0
*
* @param string $login_header_title Login header logo title attribute.
*/
$login_header_title = apply_filters( 'login_headertitle', $login_header_title );

/*
* To match the URL/title set above, Multisite sites have the blog name,
* while single sites get the header title.
*/
if ( is_multisite() ) {
$login_header_text = get_bloginfo( 'name', 'display' );
} else {
$login_header_text = $login_header_title;
}

$classes = array( 'login-action-' . $action, 'wp-core-ui' );
if ( is_rtl() )
$classes[] = 'rtl';
Expand Down Expand Up @@ -144,13 +180,12 @@ function login_header( $title = 'Log In', $message = '', $wp_error = null ) {
* @since WP-4.6.0
*/
do_action( 'login_header' );

?>
<div id="login">
<h1><a href="<?php echo esc_url( $login_header_url ); ?>" title="<?php echo esc_attr( $login_header_title ); ?>" tabindex="-1"><?php echo $login_header_text; ?></a></h1>
<?php

// @since 1.1.0 Moved to a testable function and enabled logo image option.
echo get_login_image_html();
unset( $login_header_url, $login_header_title );

/**
* Filters the message to display above the login form.
Expand Down

0 comments on commit 71e5303

Please sign in to comment.