--- a/wp/wp-includes/general-template.php Tue Dec 15 15:52:01 2020 +0100
+++ b/wp/wp-includes/general-template.php Wed Sep 21 18:19:35 2022 +0200
@@ -247,6 +247,7 @@
* @link https://core.trac.wordpress.org/ticket/19321
*
* @param array $args The array of arguments for building the search form.
+ * See get_search_form() for information on accepted arguments.
*/
do_action( 'pre_get_search_form', $args );
@@ -278,9 +279,13 @@
* @since 5.2.0
*
* @param array $args The array of arguments for building the search form.
+ * See get_search_form() for information on accepted arguments.
*/
$args = apply_filters( 'search_form_args', $args );
+ // Ensure that the filtered arguments contain all required default values.
+ $args = array_merge( $defaults, $args );
+
$format = current_theme_supports( 'html5', 'search-form' ) ? 'html5' : 'xhtml';
/**
@@ -292,6 +297,7 @@
* @param string $format The type of markup to use in the search form.
* Accepts 'html5', 'xhtml'.
* @param array $args The array of arguments for building the search form.
+ * See get_search_form() for information on accepted arguments.
*/
$format = apply_filters( 'search_form_format', $format, $args );
@@ -303,7 +309,7 @@
$form = ob_get_clean();
} else {
// Build a string containing an aria-label to use for the search form.
- if ( isset( $args['aria_label'] ) && $args['aria_label'] ) {
+ if ( $args['aria_label'] ) {
$aria_label = 'aria-label="' . esc_attr( $args['aria_label'] ) . '" ';
} else {
/*
@@ -340,6 +346,7 @@
*
* @param string $form The search form HTML output.
* @param array $args The array of arguments for building the search form.
+ * See get_search_form() for information on accepted arguments.
*/
$result = apply_filters( 'get_search_form', $form, $args );
@@ -999,7 +1006,8 @@
* Returns a custom logo, linked to home unless the theme supports removing the link on the home page.
*
* @since 4.5.0
- * @since 5.5.0 Added option to remove the link on the home page with `unlink-homepage-logo` theme support.
+ * @since 5.5.0 Added option to remove the link on the home page with `unlink-homepage-logo` theme support
+ * for the `custom-logo` theme feature.
* @since 5.5.1 Disabled lazy-loading by default.
*
* @param int $blog_id Optional. ID of the blog in question. Default is the ID of the current blog.
@@ -1078,7 +1086,7 @@
} elseif ( is_customize_preview() ) {
// If no logo is set but we're in the Customizer, leave a placeholder (needed for the live preview).
$html = sprintf(
- '<a href="%1$s" class="custom-logo-link" style="display:none;"><img class="custom-logo"/></a>',
+ '<a href="%1$s" class="custom-logo-link" style="display:none;"><img class="custom-logo" alt="" /></a>',
esc_url( home_url( '/' ) )
);
}
@@ -1230,10 +1238,15 @@
$title = apply_filters( 'document_title_parts', $title );
$title = implode( " $sep ", array_filter( $title ) );
- $title = wptexturize( $title );
- $title = convert_chars( $title );
- $title = esc_html( $title );
- $title = capital_P_dangit( $title );
+
+ /**
+ * Filters the document title.
+ *
+ * @since 5.8.0
+ *
+ * @param string $title Document title.
+ */
+ $title = apply_filters( 'document_title', $title );
return $title;
}
@@ -1339,7 +1352,7 @@
if ( is_archive() && ! empty( $m ) ) {
$my_year = substr( $m, 0, 4 );
$my_month = $wp_locale->get_month( substr( $m, 4, 2 ) );
- $my_day = intval( substr( $m, 6, 2 ) );
+ $my_day = (int) substr( $m, 6, 2 );
$title = $my_year . ( $my_month ? $t_sep . $my_month : '' ) . ( $my_day ? $t_sep . $my_day : '' );
}
@@ -2223,7 +2236,7 @@
// Let's figure out when we are.
if ( ! empty( $monthnum ) && ! empty( $year ) ) {
- $thismonth = zeroise( intval( $monthnum ), 2 );
+ $thismonth = zeroise( (int) $monthnum, 2 );
$thisyear = (int) $year;
} elseif ( ! empty( $w ) ) {
// We need to get the month from MySQL.
@@ -2408,7 +2421,7 @@
/**
* Purge the cached results of get_calendar.
*
- * @see get_calendar
+ * @see get_calendar()
* @since 2.1.0
*/
function delete_get_calendar_cache() {
@@ -2470,9 +2483,9 @@
* @global string $currentday The day of the current post in the loop.
* @global string $previousday The day of the previous post in the loop.
*
- * @param string $format Optional. PHP date format defaults to the date_format option if not specified.
- * @param string $before Optional. Output before the date.
- * @param string $after Optional. Output after the date.
+ * @param string $format Optional. PHP date format. Defaults to the 'date_format' option.
+ * @param string $before Optional. Output before the date. Default empty.
+ * @param string $after Optional. Output after the date. Default empty.
* @param bool $echo Optional. Whether to echo the date or return it. Default true.
* @return string|void String if retrieving.
*/
@@ -2492,8 +2505,7 @@
* @since 0.71
*
* @param string $the_date The formatted date string.
- * @param string $format PHP date format. Defaults to 'date_format' option
- * if not specified.
+ * @param string $format PHP date format.
* @param string $before HTML output before the date.
* @param string $after HTML output after the date.
*/
@@ -2514,7 +2526,7 @@
*
* @since 3.0.0
*
- * @param string $format Optional. PHP date format defaults to the date_format option if not specified.
+ * @param string $format Optional. PHP date format. Defaults to the 'date_format' option.
* @param int|WP_Post $post Optional. Post ID or WP_Post object. Default current post.
* @return string|false Date the current post was written. False on failure.
*/
@@ -2535,8 +2547,7 @@
* @since 3.0.0
*
* @param string $the_date The formatted date.
- * @param string $format PHP date format. Defaults to 'date_format' option
- * if not specified.
+ * @param string $format PHP date format.
* @param int|WP_Post $post The post object or ID.
*/
return apply_filters( 'get_the_date', $the_date, $format, $post );
@@ -2547,9 +2558,9 @@
*
* @since 2.1.0
*
- * @param string $format Optional. PHP date format defaults to the date_format option if not specified.
- * @param string $before Optional. Output before the date.
- * @param string $after Optional. Output after the date.
+ * @param string $format Optional. PHP date format. Defaults to the 'date_format' option.
+ * @param string $before Optional. Output before the date. Default empty.
+ * @param string $after Optional. Output after the date. Default empty.
* @param bool $echo Optional. Whether to echo the date or return it. Default true.
* @return string|void String if retrieving.
*/
@@ -2561,11 +2572,10 @@
*
* @since 2.1.0
*
- * @param string $the_modified_date The last modified date.
- * @param string $format PHP date format. Defaults to 'date_format' option
- * if not specified.
- * @param string $before HTML output before the date.
- * @param string $after HTML output after the date.
+ * @param string|false $the_modified_date The last modified date or false if no post is found.
+ * @param string $format PHP date format.
+ * @param string $before HTML output before the date.
+ * @param string $after HTML output after the date.
*/
$the_modified_date = apply_filters( 'the_modified_date', $the_modified_date, $format, $before, $after );
@@ -2583,9 +2593,9 @@
* @since 2.1.0
* @since 4.6.0 Added the `$post` parameter.
*
- * @param string $format Optional. PHP date format defaults to the date_format option if not specified.
+ * @param string $format Optional. PHP date format. Defaults to the 'date_format' option.
* @param int|WP_Post $post Optional. Post ID or WP_Post object. Default current post.
- * @return string|false Date the current post was modified. False on failure.
+ * @return string|int|false Date the current post was modified. False on failure.
*/
function get_the_modified_date( $format = '', $post = null ) {
$post = get_post( $post );
@@ -2605,10 +2615,9 @@
* @since 2.1.0
* @since 4.6.0 Added the `$post` parameter.
*
- * @param string|bool $the_time The formatted date or false if no post is found.
- * @param string $format PHP date format. Defaults to value specified in
- * 'date_format' option.
- * @param WP_Post|null $post WP_Post object or null if no post is found.
+ * @param string|int|false $the_time The formatted date or false if no post is found.
+ * @param string $format PHP date format.
+ * @param WP_Post|null $post WP_Post object or null if no post is found.
*/
return apply_filters( 'get_the_modified_date', $the_time, $format, $post );
}
@@ -2618,7 +2627,9 @@
*
* @since 0.71
*
- * @param string $format Either 'G', 'U', or PHP date format.
+ * @param string $format Optional. Format to use for retrieving the time the post
+ * was written. Accepts 'G', 'U', or PHP date format.
+ * Defaults to the 'time_format' option.
*/
function the_time( $format = '' ) {
/**
@@ -2627,8 +2638,8 @@
* @since 0.71
*
* @param string $get_the_time The formatted time.
- * @param string $format The time format. Accepts 'G', 'U',
- * or PHP date format.
+ * @param string $format Format to use for retrieving the time the post
+ * was written. Accepts 'G', 'U', or PHP date format.
*/
echo apply_filters( 'the_time', get_the_time( $format ), $format );
}
@@ -2639,8 +2650,8 @@
* @since 1.5.0
*
* @param string $format Optional. Format to use for retrieving the time the post
- * was written. Either 'G', 'U', or PHP date format defaults
- * to the value specified in the time_format option. Default empty.
+ * was written. Accepts 'G', 'U', or PHP date format.
+ * Defaults to the 'time_format' option.
* @param int|WP_Post $post WP_Post object or ID. Default is global `$post` object.
* @return string|int|false Formatted date string or Unix timestamp if `$format` is 'U' or 'G'.
* False on failure.
@@ -2662,9 +2673,8 @@
* @since 1.5.0
*
* @param string $the_time The formatted time.
- * @param string $format Format to use for retrieving the time the post was written.
- * Accepts 'G', 'U', or PHP date format value specified
- * in 'time_format' option. Default empty.
+ * @param string $format Format to use for retrieving the time the post
+ * was written. Accepts 'G', 'U', or PHP date format.
* @param int|WP_Post $post WP_Post object or ID.
*/
return apply_filters( 'get_the_time', $the_time, $format, $post );
@@ -2676,7 +2686,7 @@
* @since 2.0.0
*
* @param string $format Optional. Format to use for retrieving the time the post
- * was written. Either 'G', 'U', or PHP date format. Default 'U'.
+ * was written. Accepts 'G', 'U', or PHP date format. Default 'U'.
* @param bool $gmt Optional. Whether to retrieve the GMT time. Default false.
* @param int|WP_Post $post WP_Post object or ID. Default is global `$post` object.
* @param bool $translate Whether to translate the time string. Default false.
@@ -2804,8 +2814,9 @@
*
* @since 2.0.0
*
- * @param string $format Optional. Either 'G', 'U', or PHP date format defaults
- * to the value specified in the time_format option.
+ * @param string $format Optional. Format to use for retrieving the time the post
+ * was modified. Accepts 'G', 'U', or PHP date format.
+ * Defaults to the 'time_format' option.
*/
function the_modified_time( $format = '' ) {
/**
@@ -2813,10 +2824,9 @@
*
* @since 2.0.0
*
- * @param string $get_the_modified_time The formatted time.
- * @param string $format The time format. Accepts 'G', 'U',
- * or PHP date format. Defaults to value
- * specified in 'time_format' option.
+ * @param string|false $get_the_modified_time The formatted time or false if no post is found.
+ * @param string $format Format to use for retrieving the time the post
+ * was modified. Accepts 'G', 'U', or PHP date format.
*/
echo apply_filters( 'the_modified_time', get_the_modified_time( $format ), $format );
}
@@ -2828,10 +2838,10 @@
* @since 4.6.0 Added the `$post` parameter.
*
* @param string $format Optional. Format to use for retrieving the time the post
- * was modified. Either 'G', 'U', or PHP date format defaults
- * to the value specified in the time_format option. Default empty.
+ * was modified. Accepts 'G', 'U', or PHP date format.
+ * Defaults to the 'time_format' option.
* @param int|WP_Post $post Optional. Post ID or WP_Post object. Default current post.
- * @return string|false Formatted date string or Unix timestamp. False on failure.
+ * @return string|int|false Formatted date string or Unix timestamp. False on failure.
*/
function get_the_modified_time( $format = '', $post = null ) {
$post = get_post( $post );
@@ -2851,11 +2861,10 @@
* @since 2.0.0
* @since 4.6.0 Added the `$post` parameter.
*
- * @param string|bool $the_time The formatted time or false if no post is found.
- * @param string $format Format to use for retrieving the time the post was
- * written. Accepts 'G', 'U', or PHP date format. Defaults
- * to value specified in 'time_format' option.
- * @param WP_Post|null $post WP_Post object or null if no post is found.
+ * @param string|int|false $the_time The formatted time or false if no post is found.
+ * @param string $format Format to use for retrieving the time the post
+ * was modified. Accepts 'G', 'U', or PHP date format.
+ * @param WP_Post|null $post WP_Post object or null if no post is found.
*/
return apply_filters( 'get_the_modified_time', $the_time, $format, $post );
}
@@ -2866,7 +2875,7 @@
* @since 2.0.0
*
* @param string $format Optional. Format to use for retrieving the time the post
- * was modified. Either 'G', 'U', or PHP date format. Default 'U'.
+ * was modified. Accepts 'G', 'U', or PHP date format. Default 'U'.
* @param bool $gmt Optional. Whether to retrieve the GMT time. Default false.
* @param int|WP_Post $post WP_Post object or ID. Default is global `$post` object.
* @param bool $translate Whether to translate the time string. Default false.
@@ -2909,10 +2918,10 @@
*
* @since 2.8.0
*
- * @param string $time The formatted time.
- * @param string $format Format to use for retrieving the time the post was modified.
- * Accepts 'G', 'U', or PHP date format. Default 'U'.
- * @param bool $gmt Whether to retrieve the GMT time. Default false.
+ * @param string|int $time Formatted date string or Unix timestamp if `$format` is 'U' or 'G'.
+ * @param string $format Format to use for retrieving the time the post was modified.
+ * Accepts 'G', 'U', or PHP date format. Default 'U'.
+ * @param bool $gmt Whether to retrieve the GMT time. Default false.
*/
return apply_filters( 'get_post_modified_time', $time, $format, $gmt );
}
@@ -2957,8 +2966,8 @@
* @global string $currentday The day of the current post in the loop.
* @global string $previousweekday The day of the previous post in the loop.
*
- * @param string $before Optional. Output before the date.
- * @param string $after Optional. Output after the date.
+ * @param string $before Optional. Output before the date. Default empty.
+ * @param string $after Optional. Output after the date. Default empty.
*/
function the_weekday_date( $before = '', $after = '' ) {
global $wp_locale, $currentday, $previousweekday;
@@ -3153,7 +3162,7 @@
$href = get_term_feed_link( $term->term_id, $term->taxonomy );
}
} elseif ( is_author() ) {
- $author_id = intval( get_query_var( 'author' ) );
+ $author_id = (int) get_query_var( 'author' );
$title = sprintf( $args['authortitle'], get_bloginfo( 'name' ), $args['separator'], get_the_author_meta( 'display_name', $author_id ) );
$href = get_author_feed_link( $author_id );
@@ -3188,59 +3197,17 @@
}
/**
- * Displays a noindex meta tag if required by the blog configuration.
- *
- * If a blog is marked as not being public then the noindex meta tag will be
- * output to tell web robots not to index the page content. Add this to the
- * {@see 'wp_head'} action.
- *
- * Typical usage is as a {@see 'wp_head'} callback:
- *
- * add_action( 'wp_head', 'noindex' );
- *
- * @see wp_no_robots
- *
- * @since 2.1.0
- */
-function noindex() {
- // If the blog is not public, tell robots to go away.
- if ( '0' == get_option( 'blog_public' ) ) {
- wp_no_robots();
- }
-}
-
-/**
- * Display a noindex meta tag.
- *
- * Outputs a noindex meta tag that tells web robots not to index the page content.
- * Typical usage is as a {@see 'wp_head'} callback. add_action( 'wp_head', 'wp_no_robots' );
- *
- * @since 3.3.0
- * @since 5.3.0 Echo "noindex,nofollow" if search engine visibility is discouraged.
- */
-function wp_no_robots() {
- if ( get_option( 'blog_public' ) ) {
- echo "<meta name='robots' content='noindex,follow' />\n";
- return;
- }
-
- echo "<meta name='robots' content='noindex,nofollow' />\n";
-}
-
-/**
- * Display a noindex,noarchive meta tag and referrer origin-when-cross-origin meta tag.
- *
- * Outputs a noindex,noarchive meta tag that tells web robots not to index or cache the page content.
+ * Displays a referrer strict-origin-when-cross-origin meta tag.
+ *
* Outputs a referrer origin-when-cross-origin meta tag that tells the browser not to send the full
* url as a referrer to other sites when cross-origin assets are loaded.
*
- * Typical usage is as a wp_head callback. add_action( 'wp_head', 'wp_sensitive_page_meta' );
- *
- * @since 5.0.1
+ * Typical usage is as a wp_head callback. add_action( 'wp_head', 'wp_strict_cross_origin_referrer' );
+ *
+ * @since 5.7.0
*/
-function wp_sensitive_page_meta() {
+function wp_strict_cross_origin_referrer() {
?>
- <meta name='robots' content='noindex,noarchive' />
<meta name='referrer' content='strict-origin-when-cross-origin' />
<?php
}
@@ -3327,9 +3294,25 @@
* Filters domains and URLs for resource hints of relation type.
*
* @since 4.6.0
+ * @since 4.7.0 The `$urls` parameter accepts arrays of specific HTML attributes
+ * as its child elements.
*
- * @param array $urls URLs to print for resource hints.
- * @param string $relation_type The relation type the URLs are printed for, e.g. 'preconnect' or 'prerender'.
+ * @param array $urls {
+ * Array of resources and their attributes, or URLs to print for resource hints.
+ *
+ * @type array|string ...$0 {
+ * Array of resource attributes, or a URL string.
+ *
+ * @type string $href URL to include in resource hints. Required.
+ * @type string $as How the browser should treat the resource
+ * (`script`, `style`, `image`, `document`, etc).
+ * @type string $crossorigin Indicates the CORS policy of the specified resource.
+ * @type float $pr Expected probability that the resource hint will be used.
+ * @type string $type Type of the resource (`text/html`, `text/css`, etc).
+ * }
+ * }
+ * @param string $relation_type The relation type the URLs are printed for,
+ * e.g. 'preconnect' or 'prerender'.
*/
$urls = apply_filters( 'wp_resource_hints', $urls, $relation_type );
@@ -3463,7 +3446,7 @@
if ( 'true' === get_user_option( 'rich_editing' ) || ! is_user_logged_in() ) { // Default to 'true' for logged out users.
if ( $is_safari ) {
- $wp_rich_edit = ! wp_is_mobile() || ( preg_match( '!AppleWebKit/(\d+)!', $_SERVER['HTTP_USER_AGENT'], $match ) && intval( $match[1] ) >= 534 );
+ $wp_rich_edit = ! wp_is_mobile() || ( preg_match( '!AppleWebKit/(\d+)!', $_SERVER['HTTP_USER_AGENT'], $match ) && (int) $match[1] >= 534 );
} elseif ( $is_IE ) {
$wp_rich_edit = ( strpos( $_SERVER['HTTP_USER_AGENT'], 'Trident/7.0;' ) !== false );
} elseif ( $is_gecko || $is_chrome || $is_edge || ( $is_opera && ! wp_is_mobile() ) ) {
@@ -3573,7 +3556,7 @@
* @type array $codemirror Additional CodeMirror setting overrides.
* @type array $csslint CSSLint rule overrides.
* @type array $jshint JSHint rule overrides.
- * @type array $htmlhint JSHint rule overrides.
+ * @type array $htmlhint HTMLHint rule overrides.
* }
* @return array|false Settings for the enqueued code editor, or false if the editor was not enqueued.
*/
@@ -3664,7 +3647,7 @@
* @type array $codemirror Additional CodeMirror setting overrides.
* @type array $csslint CSSLint rule overrides.
* @type array $jshint JSHint rule overrides.
- * @type array $htmlhint JSHint rule overrides.
+ * @type array $htmlhint HTMLHint rule overrides.
* }
* @return array|false Settings for the code editor.
*/
@@ -4001,7 +3984,7 @@
* @type array $codemirror Additional CodeMirror setting overrides.
* @type array $csslint CSSLint rule overrides.
* @type array $jshint JSHint rule overrides.
- * @type array $htmlhint JSHint rule overrides.
+ * @type array $htmlhint HTMLHint rule overrides.
* }
*/
return apply_filters( 'wp_code_editor_settings', $settings, $args );
@@ -4112,7 +4095,7 @@
}
/**
- * Retrieve paginated link for archive post pages.
+ * Retrieves paginated links for archive post pages.
*
* Technically, the function can be used to create paginated link list for any
* area. The 'base' argument is used to reference the url, which will be used to
@@ -4199,7 +4182,7 @@
// Get max pages and current page out of the current query, if available.
$total = isset( $wp_query->max_num_pages ) ? $wp_query->max_num_pages : 1;
- $current = get_query_var( 'paged' ) ? intval( get_query_var( 'paged' ) ) : 1;
+ $current = get_query_var( 'paged' ) ? (int) get_query_var( 'paged' ) : 1;
// Append the format placeholder to the base URL.
$pagenum_link = trailingslashit( $url_parts[0] ) . '%_%';
@@ -4349,15 +4332,26 @@
case 'list':
$r .= "<ul class='page-numbers'>\n\t<li>";
- $r .= join( "</li>\n\t<li>", $page_links );
+ $r .= implode( "</li>\n\t<li>", $page_links );
$r .= "</li>\n</ul>\n";
break;
default:
- $r = join( "\n", $page_links );
+ $r = implode( "\n", $page_links );
break;
}
+ /**
+ * Filters the HTML output of paginated links for archives.
+ *
+ * @since 5.7.0
+ *
+ * @param string $r HTML output.
+ * @param array $args An array of arguments. See paginate_links()
+ * for information on accepted arguments.
+ */
+ $r = apply_filters( 'paginate_links_output', $r, $args );
+
return $r;
}
@@ -4420,10 +4414,10 @@
'fresh',
_x( 'Default', 'admin color scheme' ),
false,
- array( '#222', '#333', '#0073aa', '#00a0d2' ),
+ array( '#1d2327', '#2c3338', '#2271b1', '#72aee6' ),
array(
- 'base' => '#a0a5aa',
- 'focus' => '#00a0d2',
+ 'base' => '#a7aaad',
+ 'focus' => '#72aee6',
'current' => '#fff',
)
);
@@ -4747,6 +4741,16 @@
*
* The dynamic portion of the hook name, `$type`, refers to the generator type.
*
+ * Possible hook names include:
+ *
+ * - `get_the_generator_atom`
+ * - `get_the_generator_comment`
+ * - `get_the_generator_export`
+ * - `get_the_generator_html`
+ * - `get_the_generator_rdf`
+ * - `get_the_generator_rss2`
+ * - `get_the_generator_xhtml`
+ *
* @since 2.5.0
*
* @param string $gen The HTML markup output to wp_head().