<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[52348] trunk/src/wp-includes/theme.php: Coding Standards: Simplify or wrap some long conditions in `wp-includes/theme.php` for better readability.</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { white-space: pre-line; overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta" style="font-size: 105%">
<dt style="float: left; width: 6em; font-weight: bold">Revision</dt> <dd><a style="font-weight: bold" href="https://core.trac.wordpress.org/changeset/52348">52348</a><script type="application/ld+json">{"@context":"http://schema.org","@type":"EmailMessage","description":"Review this Commit","action":{"@type":"ViewAction","url":"https://core.trac.wordpress.org/changeset/52348","name":"Review Commit"}}</script></dd>
<dt style="float: left; width: 6em; font-weight: bold">Author</dt> <dd>SergeyBiryukov</dd>
<dt style="float: left; width: 6em; font-weight: bold">Date</dt> <dd>2021-12-09 15:11:17 +0000 (Thu, 09 Dec 2021)</dd>
</dl>
<pre style='padding-left: 1em; margin: 2em 0; border-left: 2px solid #ccc; line-height: 1.25; font-size: 105%; font-family: sans-serif'>Coding Standards: Simplify or wrap some long conditions in `wp-includes/theme.php` for better readability.
Includes adjusting some DocBlocks per the documentation standards.
Follow-up to <a href="https://core.trac.wordpress.org/changeset/35595">[35595]</a>, <a href="https://core.trac.wordpress.org/changeset/41937">[41937]</a>, <a href="https://core.trac.wordpress.org/changeset/52256">[52256]</a>.
See <a href="https://core.trac.wordpress.org/ticket/53359">#53359</a>, <a href="https://core.trac.wordpress.org/ticket/53399">#53399</a>.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunksrcwpincludesthemephp">trunk/src/wp-includes/theme.php</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunksrcwpincludesthemephp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-includes/theme.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/theme.php 2021-12-09 09:54:13 UTC (rev 52347)
+++ trunk/src/wp-includes/theme.php 2021-12-09 15:11:17 UTC (rev 52348)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1193,12 +1193,15 @@
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $width = absint( $header->width );
</span><span class="cx" style="display: block; padding: 0 10px"> $height = absint( $header->height );
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $alt = '';
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> // Use alternative text assigned to the image, if available. Otherwise, leave it empty.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( ! empty( $header->attachment_id ) && is_string( get_post_meta( $header->attachment_id, '_wp_attachment_image_alt', true ) ) ) {
- $alt = get_post_meta( $header->attachment_id, '_wp_attachment_image_alt', true );
- } else {
- $alt = '';
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( ! empty( $header->attachment_id ) ) {
+ $image_alt = get_post_meta( $header->attachment_id, '_wp_attachment_image_alt', true );
+
+ if ( is_string( $image_alt ) ) {
+ $alt = $image_alt;
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $attr = wp_parse_args(
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1218,8 +1221,13 @@
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> if ( is_array( $image_meta ) ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $srcset = wp_calculate_image_srcset( $size_array, $header->url, $image_meta, $header->attachment_id );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $sizes = ! empty( $attr['sizes'] ) ? $attr['sizes'] : wp_calculate_image_sizes( $size_array, $header->url, $image_meta, $header->attachment_id );
</del><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( ! empty( $attr['sizes'] ) ) {
+ $sizes = $attr['sizes'];
+ } else {
+ $sizes = wp_calculate_image_sizes( $size_array, $header->url, $image_meta, $header->attachment_id );
+ }
+
</ins><span class="cx" style="display: block; padding: 0 10px"> if ( $srcset && $sizes ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $attr['srcset'] = $srcset;
</span><span class="cx" style="display: block; padding: 0 10px"> $attr['sizes'] = $sizes;
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1281,10 +1289,10 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * @return object
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> function _get_random_header_data() {
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ global $_wp_default_headers;
</ins><span class="cx" style="display: block; padding: 0 10px"> static $_wp_random_header = null;
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> if ( empty( $_wp_random_header ) ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- global $_wp_default_headers;
</del><span class="cx" style="display: block; padding: 0 10px"> $header_image_mod = get_theme_mod( 'header_image', '' );
</span><span class="cx" style="display: block; padding: 0 10px"> $headers = array();
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1306,8 +1314,17 @@
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $_wp_random_header = (object) $headers[ array_rand( $headers ) ];
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $_wp_random_header->url = sprintf( $_wp_random_header->url, get_template_directory_uri(), get_stylesheet_directory_uri() );
- $_wp_random_header->thumbnail_url = sprintf( $_wp_random_header->thumbnail_url, get_template_directory_uri(), get_stylesheet_directory_uri() );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $_wp_random_header->url = sprintf(
+ $_wp_random_header->url,
+ get_template_directory_uri(),
+ get_stylesheet_directory_uri()
+ );
+
+ $_wp_random_header->thumbnail_url = sprintf(
+ $_wp_random_header->thumbnail_url,
+ get_template_directory_uri(),
+ get_stylesheet_directory_uri()
+ );
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> return $_wp_random_header;
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1407,13 +1424,18 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $header_data = wp_get_attachment_metadata( $header->ID );
</span><span class="cx" style="display: block; padding: 0 10px"> $header_index = $header->ID;
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $header_images[ $header_index ] = array();
- $header_images[ $header_index ]['attachment_id'] = $header->ID;
- $header_images[ $header_index ]['url'] = $url;
- $header_images[ $header_index ]['thumbnail_url'] = $url;
- $header_images[ $header_index ]['alt_text'] = get_post_meta( $header->ID, '_wp_attachment_image_alt', true );
- $header_images[ $header_index ]['attachment_parent'] = isset( $header_data['attachment_parent'] ) ? $header_data['attachment_parent'] : '';
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $header_images[ $header_index ] = array();
+ $header_images[ $header_index ]['attachment_id'] = $header->ID;
+ $header_images[ $header_index ]['url'] = $url;
+ $header_images[ $header_index ]['thumbnail_url'] = $url;
+ $header_images[ $header_index ]['alt_text'] = get_post_meta( $header->ID, '_wp_attachment_image_alt', true );
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( isset( $header_data['attachment_parent'] ) ) {
+ $header_images[ $header_index ]['attachment_parent'] = $header_data['attachment_parent'];
+ } else {
+ $header_images[ $header_index ]['attachment_parent'] = '';
+ }
+
</ins><span class="cx" style="display: block; padding: 0 10px"> if ( isset( $header_data['width'] ) ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $header_images[ $header_index ]['width'] = $header_data['width'];
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1503,6 +1525,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> function unregister_default_headers( $header ) {
</span><span class="cx" style="display: block; padding: 0 10px"> global $_wp_default_headers;
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
</ins><span class="cx" style="display: block; padding: 0 10px"> if ( is_array( $header ) ) {
</span><span class="cx" style="display: block; padding: 0 10px"> array_map( 'unregister_default_headers', $header );
</span><span class="cx" style="display: block; padding: 0 10px"> } elseif ( isset( $_wp_default_headers[ $header ] ) ) {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1838,7 +1861,10 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $type_attr = current_theme_supports( 'html5', 'style' ) ? '' : ' type="text/css"';
</span><span class="cx" style="display: block; padding: 0 10px"> ?>
</span><span class="cx" style="display: block; padding: 0 10px"> <style<?php echo $type_attr; ?> id="wp-custom-css">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- <?php echo strip_tags( $styles ); // Note that esc_html() cannot be used because `div > span` is not interpreted properly. ?>
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ <?php
+ // Note that esc_html() cannot be used because `div > span` is not interpreted properly.
+ echo strip_tags( $styles );
+ ?>
</ins><span class="cx" style="display: block; padding: 0 10px"> </style>
</span><span class="cx" style="display: block; padding: 0 10px"> <?php
</span><span class="cx" style="display: block; padding: 0 10px"> endif;
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1939,8 +1965,10 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * @param array $args {
</span><span class="cx" style="display: block; padding: 0 10px"> * Args.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @type string $preprocessed Pre-processed CSS, stored in `post_content_filtered`. Normally empty string. Optional.
- * @type string $stylesheet Stylesheet (child theme) to update. Optional, defaults to current theme/stylesheet.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @type string $preprocessed Optional. Pre-processed CSS, stored in `post_content_filtered`.
+ * Normally empty string.
+ * @type string $stylesheet Optional. Stylesheet (child theme) to update.
+ * Defaults to current theme/stylesheet.
</ins><span class="cx" style="display: block; padding: 0 10px"> * }
</span><span class="cx" style="display: block; padding: 0 10px"> * @return WP_Post|WP_Error Post on success, error on failure.
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1959,7 +1987,8 @@
</span><span class="cx" style="display: block; padding: 0 10px"> );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * Filters the `css` (`post_content`) and `preprocessed` (`post_content_filtered`) args for a `custom_css` post being updated.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Filters the `css` (`post_content`) and `preprocessed` (`post_content_filtered`) args
+ * for a `custom_css` post being updated.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * This filter can be used by plugin that offer CSS pre-processors, to store the original
</span><span class="cx" style="display: block; padding: 0 10px"> * pre-processed CSS in `post_content_filtered` and then store processed CSS in `post_content`.
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1981,7 +2010,8 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * Custom CSS data.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @type string $css CSS stored in `post_content`.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @type string $preprocessed Pre-processed CSS stored in `post_content_filtered`. Normally empty string.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @type string $preprocessed Pre-processed CSS stored in `post_content_filtered`.
+ * Normally empty string.
</ins><span class="cx" style="display: block; padding: 0 10px"> * }
</span><span class="cx" style="display: block; padding: 0 10px"> * @param array $args {
</span><span class="cx" style="display: block; padding: 0 10px"> * The args passed into `wp_update_custom_css_post()` merged with defaults.
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -2167,9 +2197,11 @@
</span><span class="cx" style="display: block; padding: 0 10px"> '',
</span><span class="cx" style="display: block; padding: 0 10px"> array(
</span><span class="cx" style="display: block; padding: 0 10px"> '<strong>' . _x( 'Address', 'Theme starter content' ) . "</strong>\n",
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- _x( '123 Main Street', 'Theme starter content' ) . "\n" . _x( 'New York, NY 10001', 'Theme starter content' ) . "\n\n",
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ _x( '123 Main Street', 'Theme starter content' ) . "\n",
+ _x( 'New York, NY 10001', 'Theme starter content' ) . "\n\n",
</ins><span class="cx" style="display: block; padding: 0 10px"> '<strong>' . _x( 'Hours', 'Theme starter content' ) . "</strong>\n",
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- _x( 'Monday–Friday: 9:00AM–5:00PM', 'Theme starter content' ) . "\n" . _x( 'Saturday & Sunday: 11:00AM–3:00PM', 'Theme starter content' ),
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ _x( 'Monday–Friday: 9:00AM–5:00PM', 'Theme starter content' ) . "\n",
+ _x( 'Saturday & Sunday: 11:00AM–3:00PM', 'Theme starter content' ),
</ins><span class="cx" style="display: block; padding: 0 10px"> )
</span><span class="cx" style="display: block; padding: 0 10px"> ),
</span><span class="cx" style="display: block; padding: 0 10px"> 'filter' => true,
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -2371,7 +2403,10 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $content[ $type ][ $sidebar_id ][] = $widget;
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- } elseif ( is_string( $widget ) && ! empty( $core_content[ $type ] ) && ! empty( $core_content[ $type ][ $widget ] ) ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ } elseif ( is_string( $widget )
+ && ! empty( $core_content[ $type ] )
+ && ! empty( $core_content[ $type ][ $widget ] )
+ ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> $content[ $type ][ $sidebar_id ][] = $core_content[ $type ][ $widget ];
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -2398,7 +2433,10 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $content[ $type ][ $nav_menu_location ]['items'][] = $nav_menu_item;
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- } elseif ( is_string( $nav_menu_item ) && ! empty( $core_content[ $type ] ) && ! empty( $core_content[ $type ][ $nav_menu_item ] ) ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ } elseif ( is_string( $nav_menu_item )
+ && ! empty( $core_content[ $type ] )
+ && ! empty( $core_content[ $type ][ $nav_menu_item ] )
+ ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> $content[ $type ][ $nav_menu_location ]['items'][] = $core_content[ $type ][ $nav_menu_item ];
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -2558,7 +2596,11 @@
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $args[0] = array_intersect( $args[0], array_keys( $post_formats ) );
</span><span class="cx" style="display: block; padding: 0 10px"> } else {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- _doing_it_wrong( "add_theme_support( 'post-formats' )", __( 'You need to pass an array of post formats.' ), '5.6.0' );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ _doing_it_wrong(
+ "add_theme_support( 'post-formats' )",
+ __( 'You need to pass an array of post formats.' ),
+ '5.6.0'
+ );
</ins><span class="cx" style="display: block; padding: 0 10px"> return false;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> break;
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -2569,7 +2611,11 @@
</span><span class="cx" style="display: block; padding: 0 10px"> // Build an array of types for back-compat.
</span><span class="cx" style="display: block; padding: 0 10px"> $args = array( 0 => array( 'comment-list', 'comment-form', 'search-form' ) );
</span><span class="cx" style="display: block; padding: 0 10px"> } elseif ( ! isset( $args[0] ) || ! is_array( $args[0] ) ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- _doing_it_wrong( "add_theme_support( 'html5' )", __( 'You need to pass an array of types.' ), '3.6.1' );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ _doing_it_wrong(
+ "add_theme_support( 'html5' )",
+ __( 'You need to pass an array of types.' ),
+ '3.6.1'
+ );
</ins><span class="cx" style="display: block; padding: 0 10px"> return false;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -2810,7 +2856,10 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * @access private
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> function _custom_logo_header_styles() {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( ! current_theme_supports( 'custom-header', 'header-text' ) && get_theme_support( 'custom-logo', 'header-text' ) && ! get_theme_mod( 'header_text', true ) ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( ! current_theme_supports( 'custom-header', 'header-text' )
+ && get_theme_support( 'custom-logo', 'header-text' )
+ && ! get_theme_mod( 'header_text', true )
+ ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> $classes = (array) get_theme_support( 'custom-logo', 'header-text' );
</span><span class="cx" style="display: block; padding: 0 10px"> $classes = array_map( 'sanitize_html_class', $classes );
</span><span class="cx" style="display: block; padding: 0 10px"> $classes = '.' . implode( ', .', $classes );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -2849,6 +2898,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> function get_theme_support( $feature, ...$args ) {
</span><span class="cx" style="display: block; padding: 0 10px"> global $_wp_theme_features;
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
</ins><span class="cx" style="display: block; padding: 0 10px"> if ( ! isset( $_wp_theme_features[ $feature ] ) ) {
</span><span class="cx" style="display: block; padding: 0 10px"> return false;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -3166,7 +3216,9 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> if ( is_array( $args['show_in_rest'] ) ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( isset( $args['show_in_rest']['prepare_callback'] ) && ! is_callable( $args['show_in_rest']['prepare_callback'] ) ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( isset( $args['show_in_rest']['prepare_callback'] )
+ && ! is_callable( $args['show_in_rest']['prepare_callback'] )
+ ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> return new WP_Error(
</span><span class="cx" style="display: block; padding: 0 10px"> 'invalid_rest_prepare_callback',
</span><span class="cx" style="display: block; padding: 0 10px"> sprintf(
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -3285,6 +3337,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> function check_theme_switched() {
</span><span class="cx" style="display: block; padding: 0 10px"> $stylesheet = get_option( 'theme_switched' );
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
</ins><span class="cx" style="display: block; padding: 0 10px"> if ( $stylesheet ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $old_theme = wp_get_theme( $stylesheet );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -3314,6 +3367,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> /** This action is documented in wp-includes/theme.php */
</span><span class="cx" style="display: block; padding: 0 10px"> do_action( 'after_switch_theme', $stylesheet, $old_theme );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
</ins><span class="cx" style="display: block; padding: 0 10px"> flush_rewrite_rules();
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> update_option( 'theme_switched', false );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -3353,7 +3407,14 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * called before wp_magic_quotes() gets called. Besides this fact, none of
</span><span class="cx" style="display: block; padding: 0 10px"> * the values should contain any characters needing slashes anyway.
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $keys = array( 'changeset_uuid', 'customize_changeset_uuid', 'customize_theme', 'theme', 'customize_messenger_channel', 'customize_autosaved' );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $keys = array(
+ 'changeset_uuid',
+ 'customize_changeset_uuid',
+ 'customize_theme',
+ 'theme',
+ 'customize_messenger_channel',
+ 'customize_autosaved',
+ );
</ins><span class="cx" style="display: block; padding: 0 10px"> $input_vars = array_merge(
</span><span class="cx" style="display: block; padding: 0 10px"> wp_array_slice_assoc( $_GET, $keys ),
</span><span class="cx" style="display: block; padding: 0 10px"> wp_array_slice_assoc( $_POST, $keys )
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -3409,7 +3470,16 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $settings_previewed = ! $is_customize_save_action;
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> require_once ABSPATH . WPINC . '/class-wp-customize-manager.php';
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $GLOBALS['wp_customize'] = new WP_Customize_Manager( compact( 'changeset_uuid', 'theme', 'messenger_channel', 'settings_previewed', 'autosaved', 'branching' ) );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $GLOBALS['wp_customize'] = new WP_Customize_Manager(
+ compact(
+ 'changeset_uuid',
+ 'theme',
+ 'messenger_channel',
+ 'settings_previewed',
+ 'autosaved',
+ 'branching',
+ )
+ );
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -3621,7 +3691,8 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * Makes sure that auto-draft posts get their post_date bumped or status changed to draft to prevent premature garbage-collection.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Makes sure that auto-draft posts get their post_date bumped or status changed
+ * to draft to prevent premature garbage-collection.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * When a changeset is updated but remains an auto-draft, ensure the post_date
</span><span class="cx" style="display: block; padding: 0 10px"> * for the auto-draft posts remains the same so that it will be
</span></span></pre>
</div>
</div>
</body>
</html>