* @since 2.1.0
* @since 2.8.0 $name parameter added.
*
- * @param string $name Name of the specific header file to use.
+ * @param string|null $name Name of the specific header file to use. null for the default header.
*/
do_action( 'get_header', $name );
* @since 2.1.0
* @since 2.8.0 $name parameter added.
*
- * @param string $name Name of the specific footer file to use.
+ * @param string|null $name Name of the specific footer file to use. null for the default footer.
*/
do_action( 'get_footer', $name );
* @since 2.2.0
* @since 2.8.0 $name parameter added.
*
- * @param string $name Name of the specific sidebar file to use.
+ * @param string|null $name Name of the specific sidebar file to use. null for the default sidebar.
*/
do_action( 'get_sidebar', $name );
*
* @since 3.0.0
*
- * @param string $slug The slug name for the generic template.
- * @param string $name The name of the specialized template.
+ * @param string $slug The slug name for the generic template.
+ * @param string|null $name The name of the specialized template.
*/
do_action( "get_template_part_{$slug}", $slug, $name );
* @type string $redirect URL to redirect to. Must be absolute, as in "https://example.com/mypage/".
* Default is to redirect back to the request URI.
* @type string $form_id ID attribute value for the form. Default 'loginform'.
- * @type string $label_username Label for the username or email address field. Default 'Username or Email'.
+ * @type string $label_username Label for the username or email address field. Default 'Username or Email Address'.
* @type string $label_password Label for the password field. Default 'Password'.
* @type string $label_remember Label for the remember field. Default 'Remember Me'.
* @type string $label_log_in Label for the submit button. Default 'Log In'.
// Default 'redirect' value takes the user back to the request URI.
'redirect' => ( is_ssl() ? 'https://' : 'http://' ) . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'],
'form_id' => 'loginform',
- 'label_username' => __( 'Username or Email' ),
+ 'label_username' => __( 'Username or Email Address' ),
'label_password' => __( 'Password' ),
'label_remember' => __( 'Remember Me' ),
'label_log_in' => __( 'Log In' ),
' . $login_form_middle . '
' . ( $args['remember'] ? '<p class="login-remember"><label><input name="rememberme" type="checkbox" id="' . esc_attr( $args['id_remember'] ) . '" value="forever"' . ( $args['value_remember'] ? ' checked="checked"' : '' ) . ' /> ' . esc_html( $args['label_remember'] ) . '</label></p>' : '' ) . '
<p class="login-submit">
- <input type="submit" name="wp-submit" id="' . esc_attr( $args['id_submit'] ) . '" class="button-primary" value="' . esc_attr( $args['label_log_in'] ) . '" />
+ <input type="submit" name="wp-submit" id="' . esc_attr( $args['id_submit'] ) . '" class="button button-primary" value="' . esc_attr( $args['label_log_in'] ) . '" />
<input type="hidden" name="redirect_to" value="' . esc_url( $args['redirect'] ) . '" />
</p>
' . $login_form_bottom . '
* @return string Site Icon URL.
*/
function get_site_icon_url( $size = 512, $url = '', $blog_id = 0 ) {
- if ( is_multisite() && (int) $blog_id !== get_current_blog_id() ) {
+ $switched_blog = false;
+
+ if ( is_multisite() && ! empty( $blog_id ) && (int) $blog_id !== get_current_blog_id() ) {
switch_to_blog( $blog_id );
+ $switched_blog = true;
}
$site_icon_id = get_option( 'site_icon' );
$url = wp_get_attachment_image_url( $site_icon_id, $size_data );
}
- if ( is_multisite() && ms_is_switched() ) {
+ if ( $switched_blog ) {
restore_current_blog();
}
* @return bool Whether the site has a custom logo or not.
*/
function has_custom_logo( $blog_id = 0 ) {
- if ( is_multisite() && (int) $blog_id !== get_current_blog_id() ) {
+ $switched_blog = false;
+
+ if ( is_multisite() && ! empty( $blog_id ) && (int) $blog_id !== get_current_blog_id() ) {
switch_to_blog( $blog_id );
+ $switched_blog = true;
}
$custom_logo_id = get_theme_mod( 'custom_logo' );
- if ( is_multisite() && ms_is_switched() ) {
+ if ( $switched_blog ) {
restore_current_blog();
}
*/
function get_custom_logo( $blog_id = 0 ) {
$html = '';
+ $switched_blog = false;
- if ( is_multisite() && (int) $blog_id !== get_current_blog_id() ) {
+ if ( is_multisite() && ! empty( $blog_id ) && (int) $blog_id !== get_current_blog_id() ) {
switch_to_blog( $blog_id );
+ $switched_blog = true;
}
$custom_logo_id = get_theme_mod( 'custom_logo' );
);
}
- if ( is_multisite() && ms_is_switched() ) {
+ if ( $switched_blog ) {
restore_current_blog();
}
*/
function get_the_archive_title() {
if ( is_category() ) {
+ /* translators: Category archive title. 1: Category name */
$title = sprintf( __( 'Category: %s' ), single_cat_title( '', false ) );
} elseif ( is_tag() ) {
+ /* translators: Tag archive title. 1: Tag name */
$title = sprintf( __( 'Tag: %s' ), single_tag_title( '', false ) );
} elseif ( is_author() ) {
+ /* translators: Author archive title. 1: Author name */
$title = sprintf( __( 'Author: %s' ), '<span class="vcard">' . get_the_author() . '</span>' );
} elseif ( is_year() ) {
+ /* translators: Yearly archive title. 1: Year */
$title = sprintf( __( 'Year: %s' ), get_the_date( _x( 'Y', 'yearly archives date format' ) ) );
} elseif ( is_month() ) {
+ /* translators: Monthly archive title. 1: Month name and year */
$title = sprintf( __( 'Month: %s' ), get_the_date( _x( 'F Y', 'monthly archives date format' ) ) );
} elseif ( is_day() ) {
+ /* translators: Daily archive title. 1: Date */
$title = sprintf( __( 'Day: %s' ), get_the_date( _x( 'F j, Y', 'daily archives date format' ) ) );
} elseif ( is_tax( 'post_format' ) ) {
if ( is_tax( 'post_format', 'post-format-aside' ) ) {
$title = _x( 'Chats', 'post format archive title' );
}
} elseif ( is_post_type_archive() ) {
+ /* translators: Post type archive title. 1: Post type name */
$title = sprintf( __( 'Archives: %s' ), post_type_archive_title( '', false ) );
} elseif ( is_tax() ) {
$tax = get_taxonomy( get_queried_object()->taxonomy );
- /* translators: 1: Taxonomy singular name, 2: Current taxonomy term */
+ /* translators: Taxonomy term archive title. 1: Taxonomy singular name, 2: Current taxonomy term */
$title = sprintf( __( '%1$s: %2$s' ), $tax->labels->singular_name, single_term_title( '', false ) );
} else {
$title = __( 'Archives' );
}
/**
- * Display category, tag, or term description.
+ * Display category, tag, term, or author description.
*
* @since 4.1.0
*
}
/**
- * Retrieve category, tag, or term description.
+ * Retrieve category, tag, term, or author description.
*
* @since 4.1.0
+ * @since 4.7.0 Added support for author archives.
+ *
+ * @see term_description()
*
* @return string Archive description.
*/
function get_the_archive_description() {
+ if ( is_author() ) {
+ $description = get_the_author_meta( 'description' );
+ } else {
+ $description = term_description();
+ }
+
/**
* Filters the archive description.
*
* @since 4.1.0
*
- * @see term_description()
- *
* @param string $description Archive description to be displayed.
*/
- return apply_filters( 'get_the_archive_description', term_description() );
+ return apply_filters( 'get_the_archive_description', $description );
}
/**
$output = '';
- $last_changed = wp_cache_get( 'last_changed', 'posts' );
- if ( ! $last_changed ) {
- $last_changed = microtime();
- wp_cache_set( 'last_changed', $last_changed, 'posts' );
- }
+ $last_changed = wp_cache_get_last_changed( 'posts' );
$limit = $r['limit'];
if ( in_array( $day, $daywithpost ) ) {
// any posts today?
$date_format = date( _x( 'F j, Y', 'daily archives date format' ), strtotime( "{$thisyear}-{$thismonth}-{$day}" ) );
+ /* translators: Post calendar label. 1: Date */
$label = sprintf( __( 'Posts published on %s' ), $date_format );
$calendar_output .= sprintf(
'<a href="%s" aria-label="%s">%s</a>',
return;
}
- $meta_tags = array(
- sprintf( '<link rel="icon" href="%s" sizes="32x32" />', esc_url( get_site_icon_url( 32 ) ) ),
- sprintf( '<link rel="icon" href="%s" sizes="192x192" />', esc_url( get_site_icon_url( 192 ) ) ),
- sprintf( '<link rel="apple-touch-icon-precomposed" href="%s" />', esc_url( get_site_icon_url( 180 ) ) ),
- sprintf( '<meta name="msapplication-TileImage" content="%s" />', esc_url( get_site_icon_url( 270 ) ) ),
- );
+ $meta_tags = array();
+ $icon_32 = get_site_icon_url( 32 );
+ if ( empty( $icon_32 ) && is_customize_preview() ) {
+ $icon_32 = '/favicon.ico'; // Serve default favicon URL in customizer so element can be updated for preview.
+ }
+ if ( $icon_32 ) {
+ $meta_tags[] = sprintf( '<link rel="icon" href="%s" sizes="32x32" />', esc_url( $icon_32 ) );
+ }
+ $icon_192 = get_site_icon_url( 192 );
+ if ( $icon_192 ) {
+ $meta_tags[] = sprintf( '<link rel="icon" href="%s" sizes="192x192" />', esc_url( $icon_192 ) );
+ }
+ $icon_180 = get_site_icon_url( 180 );
+ if ( $icon_180 ) {
+ $meta_tags[] = sprintf( '<link rel="apple-touch-icon-precomposed" href="%s" />', esc_url( $icon_180 ) );
+ }
+ $icon_270 = get_site_icon_url( 270 );
+ if ( $icon_270 ) {
+ $meta_tags[] = sprintf( '<meta name="msapplication-TileImage" content="%s" />', esc_url( $icon_270 ) );
+ }
/**
* Filters the site icon meta tags, so Plugins can add their own.
* The path is removed in the foreach loop below.
*/
/** This filter is documented in wp-includes/formatting.php */
- $hints['dns-prefetch'][] = apply_filters( 'emoji_svg_url', 'https://s.w.org/images/core/emoji/2/svg/' );
+ $hints['dns-prefetch'][] = apply_filters( 'emoji_svg_url', 'https://s.w.org/images/core/emoji/2.2.1/svg/' );
foreach ( $hints as $relation_type => $urls ) {
+ $unique_urls = array();
+
/**
* Filters domains and URLs for resource hints of relation type.
*
$urls = apply_filters( 'wp_resource_hints', $urls, $relation_type );
foreach ( $urls as $key => $url ) {
+ $atts = array();
+
+ if ( is_array( $url ) ) {
+ if ( isset( $url['href'] ) ) {
+ $atts = $url;
+ $url = $url['href'];
+ } else {
+ continue;
+ }
+ }
+
$url = esc_url( $url, array( 'http', 'https' ) );
+
if ( ! $url ) {
- unset( $urls[ $key ] );
+ continue;
+ }
+
+ if ( isset( $unique_urls[ $url ] ) ) {
continue;
}
if ( in_array( $relation_type, array( 'preconnect', 'dns-prefetch' ) ) ) {
$parsed = wp_parse_url( $url );
+
if ( empty( $parsed['host'] ) ) {
- unset( $urls[ $key ] );
continue;
}
}
}
- $urls[ $key ] = $url;
+ $atts['rel'] = $relation_type;
+ $atts['href'] = $url;
+
+ $unique_urls[ $url ] = $atts;
}
- $urls = array_unique( $urls );
+ foreach ( $unique_urls as $atts ) {
+ $html = '';
+
+ foreach ( $atts as $attr => $value ) {
+ if ( ! is_scalar( $value ) ||
+ ( ! in_array( $attr, array( 'as', 'crossorigin', 'href', 'pr', 'rel', 'type' ), true ) && ! is_numeric( $attr ))
+ ) {
+ continue;
+ }
+
+ $value = ( 'href' === $attr ) ? esc_url( $value ) : esc_attr( $value );
+
+ if ( ! is_string( $attr ) ) {
+ $html .= " $value";
+ } else {
+ $html .= " $attr='$value'";
+ }
+ }
+
+ $html = trim( $html );
- foreach ( $urls as $url ) {
- printf( "<link rel='%s' href='%s' />\n", $relation_type, $url );
+ echo "<link $html />\n";
}
}
}
}
/**
- * Whether the user should have a WYSIWIG editor.
+ * Whether the user can access the visual editor.
*
- * Checks that the user requires a WYSIWIG editor and that the editor is
- * supported in the users browser.
+ * Checks if the user can access the visual editor and that it's supported by the user's browser.
*
* @since 2.0.0
*
- * @global bool $wp_rich_edit
- * @global bool $is_gecko
- * @global bool $is_opera
- * @global bool $is_safari
- * @global bool $is_chrome
- * @global bool $is_IE
+ * @global bool $wp_rich_edit Whether the user can access the visual editor.
+ * @global bool $is_gecko Whether the browser is Gecko-based.
+ * @global bool $is_opera Whether the browser is Opera.
+ * @global bool $is_safari Whether the browser is Safari.
+ * @global bool $is_chrome Whether the browser is Chrome.
+ * @global bool $is_IE Whether the browser is Internet Explorer.
+ * @global bool $is_edge Whether the browser is Microsoft Edge.
*
- * @return bool
+ * @return bool True if the user can access the visual editor, false otherwise.
*/
function user_can_richedit() {
global $wp_rich_edit, $is_gecko, $is_opera, $is_safari, $is_chrome, $is_IE, $is_edge;
}
/**
- * Filters whether the user can access the rich (Visual) editor.
+ * Filters whether the user can access the visual editor.
*
* @since 2.1.0
*
- * @param bool $wp_rich_edit Whether the user can access to the rich (Visual) editor.
+ * @param bool $wp_rich_edit Whether the user can access the visual editor.
*/
return apply_filters( 'user_can_richedit', $wp_rich_edit );
}
*
* @since 2.5.0
*
- * @param array $r An array of editors. Accepts 'tinymce', 'html', 'test'.
+ * @param string $r Which editor should be displayed by default. Either 'tinymce', 'html', or 'test'.
*/
return apply_filters( 'wp_default_editor', $r );
}
function wp_editor( $content, $editor_id, $settings = array() ) {
if ( ! class_exists( '_WP_Editors', false ) )
require( ABSPATH . WPINC . '/class-wp-editor.php' );
-
_WP_Editors::editor($content, $editor_id, $settings);
}
* Default 1.
* @type int $mid_size How many numbers to either side of the current pages. Default 2.
* @type bool $prev_next Whether to include the previous and next links in the list. Default true.
- * @type bool $prev_text The previous page text. Default '« Previous'.
- * @type bool $next_text The next page text. Default '« Previous'.
+ * @type bool $prev_text The previous page text. Default '« Previous'.
+ * @type bool $next_text The next page text. Default 'Next »'.
* @type string $type Controls format of the returned value. Possible values are 'plain',
* 'array' and 'list'. Default is 'plain'.
* @type array $add_args An array of query args to add. Default false.
endif;
endif;
endfor;
- if ( $args['prev_next'] && $current && ( $current < $total || -1 == $total ) ) :
+ if ( $args['prev_next'] && $current && $current < $total ) :
$link = str_replace( '%_%', $args['format'], $args['base'] );
$link = str_replace( '%#%', $current + 1, $link );
if ( $add_args )
* Registers the default Admin color schemes
*
* @since 3.0.0
- *
- * @global string $wp_version
*/
function register_admin_color_schemes() {
$suffix = is_rtl() ? '-rtl' : '';
);
// Other color schemes are not available when running out of src
- if ( false !== strpos( $GLOBALS['wp_version'], '-src' ) )
+ if ( false !== strpos( get_bloginfo( 'version' ), '-src' ) ) {
return;
+ }
wp_admin_css_color( 'light', _x( 'Light', 'admin color scheme' ),
admin_url( "css/colors/light/colors$suffix.css" ),