<!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>[45710] trunk/src/wp-includes/taxonomy.php: Coding Standards: Use strict comparison in `wp-includes/taxonomy.php`.</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/45710">45710</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/45710","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>2019-08-01 13:44:04 +0000 (Thu, 01 Aug 2019)</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: Use strict comparison in `wp-includes/taxonomy.php`.
Props andizer, SergeyBiryukov.
Fixes <a href="https://core.trac.wordpress.org/ticket/47573">#47573</a>.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunksrcwpincludestaxonomyphp">trunk/src/wp-includes/taxonomy.php</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunksrcwpincludestaxonomyphp"></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/taxonomy.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/taxonomy.php 2019-08-01 12:02:30 UTC (rev 45709)
+++ trunk/src/wp-includes/taxonomy.php 2019-08-01 13:44:04 UTC (rev 45710)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -193,7 +193,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> function get_taxonomies( $args = array(), $output = 'names', $operator = 'and' ) {
</span><span class="cx" style="display: block; padding: 0 10px"> global $wp_taxonomies;
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $field = ( 'names' == $output ) ? 'name' : false;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $field = ( 'names' === $output ) ? 'name' : false;
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> return wp_filter_object_list( $wp_taxonomies, $args, $operator, $field );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -223,7 +223,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> global $wp_taxonomies;
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> if ( is_object( $object ) ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( $object->post_type == 'attachment' ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( $object->post_type === 'attachment' ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> return get_attachment_taxonomies( $object, $output );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> $object = $object->post_type;
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -234,7 +234,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $taxonomies = array();
</span><span class="cx" style="display: block; padding: 0 10px"> foreach ( (array) $wp_taxonomies as $tax_name => $tax_obj ) {
</span><span class="cx" style="display: block; padding: 0 10px"> if ( array_intersect( $object, (array) $tax_obj->object_type ) ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( 'names' == $output ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( 'names' === $output ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> $taxonomies[] = $tax_name;
</span><span class="cx" style="display: block; padding: 0 10px"> } else {
</span><span class="cx" style="display: block; padding: 0 10px"> $taxonomies[ $tax_name ] = $tax_obj;
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -725,7 +725,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $defaults = array( 'order' => 'ASC' );
</span><span class="cx" style="display: block; padding: 0 10px"> $args = wp_parse_args( $args, $defaults );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $order = ( 'desc' == strtolower( $args['order'] ) ) ? 'DESC' : 'ASC';
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $order = ( 'desc' === strtolower( $args['order'] ) ) ? 'DESC' : 'ASC';
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $term_ids = array_map( 'intval', $term_ids );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -876,9 +876,9 @@
</span><span class="cx" style="display: block; padding: 0 10px"> // Sanitize term, according to the specified filter.
</span><span class="cx" style="display: block; padding: 0 10px"> $_term->filter( $filter );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( $output == ARRAY_A ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( $output === ARRAY_A ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> return $_term->to_array();
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- } elseif ( $output == ARRAY_N ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ } elseif ( $output === ARRAY_N ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> return array_values( $_term->to_array() );
</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">@@ -1014,7 +1014,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $children = $terms[ $term_id ];
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> foreach ( (array) $terms[ $term_id ] as $child ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( $term_id == $child ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( $term_id === $child ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> continue;
</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">@@ -1371,7 +1371,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $tax_select = "SELECT tt.term_id, tt.term_taxonomy_id FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy as tt ON tt.term_id = t.term_id WHERE ";
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> if ( is_int( $term ) ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( 0 == $term ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( 0 === $term ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> return 0;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> $where = 't.term_id = %d';
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1445,7 +1445,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> if ( empty( $term1->term_id ) || empty( $term2->parent ) ) {
</span><span class="cx" style="display: block; padding: 0 10px"> return false;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( $term2->parent == $term1->term_id ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( $term2->parent === $term1->term_id ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> return true;
</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">@@ -1529,11 +1529,13 @@
</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">- if ( 'raw' == $context ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $context = strtolower( $context );
+
+ if ( 'raw' === $context ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> return $value;
</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">- if ( 'edit' == $context ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( 'edit' === $context ) {
</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"> * Filters a term field to edit before it is sanitized.
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1561,12 +1563,12 @@
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> $value = apply_filters( "edit_{$taxonomy}_{$field}", $value, $term_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">- if ( 'description' == $field ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( 'description' === $field ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> $value = esc_html( $value ); // textarea_escaped
</span><span class="cx" style="display: block; padding: 0 10px"> } else {
</span><span class="cx" style="display: block; padding: 0 10px"> $value = esc_attr( $value );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- } elseif ( 'db' == $context ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ } elseif ( 'db' === $context ) {
</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"> * Filters a term field value before it is sanitized.
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1593,7 +1595,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $value = apply_filters( "pre_{$taxonomy}_{$field}", $value );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> // Back compat filters
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( 'slug' == $field ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( 'slug' === $field ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="cx" style="display: block; padding: 0 10px"> * Filters the category nicename before it is sanitized.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1605,7 +1607,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> $value = apply_filters( 'pre_category_nicename', $value );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- } elseif ( 'rss' == $context ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ } elseif ( 'rss' === $context ) {
</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"> * Filters the term field for use in RSS.
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1662,9 +1664,9 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $value = apply_filters( "{$taxonomy}_{$field}", $value, $term_id, $context );
</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">- if ( 'attribute' == $context ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( 'attribute' === $context ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> $value = esc_attr( $value );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- } elseif ( 'js' == $context ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ } elseif ( 'js' === $context ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> $value = esc_js( $value );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> return $value;
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1767,9 +1769,9 @@
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $defaults = array();
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( 'category' == $taxonomy ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( 'category' === $taxonomy ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> $defaults['default'] = get_option( 'default_category' );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( $defaults['default'] == $term ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( $defaults['default'] === $term ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> return 0; // Don't delete the default category
</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">@@ -1847,7 +1849,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> 'orderby' => 'none',
</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">- if ( 1 == count( $terms ) && isset( $default ) ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( 1 === count( $terms ) && isset( $default ) ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> $terms = array( $default );
</span><span class="cx" style="display: block; padding: 0 10px"> } else {
</span><span class="cx" style="display: block; padding: 0 10px"> $terms = array_diff( $terms, array( $term ) );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -2123,10 +2125,10 @@
</span><span class="cx" style="display: block; padding: 0 10px"> if ( is_wp_error( $term ) ) {
</span><span class="cx" style="display: block; padding: 0 10px"> return $term;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( is_int( $term ) && 0 == $term ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( is_int( $term ) && 0 === $term ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> return new WP_Error( 'invalid_term_id', __( 'Invalid term 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">- if ( '' == trim( $term ) ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( '' === trim( $term ) ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> return new WP_Error( 'empty_term_name', __( 'A name is required for this term.' ) );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> $defaults = array(
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -2450,7 +2452,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $new_tt_ids = array();
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> foreach ( (array) $terms as $term ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( ! strlen( trim( $term ) ) ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( '' === trim( $term ) ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> continue;
</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">@@ -2610,7 +2612,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $tt_ids = array();
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> foreach ( (array) $terms as $term ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( ! strlen( trim( $term ) ) ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( '' === trim( $term ) ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> continue;
</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">@@ -2846,7 +2848,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $parsed_args['name'] = $name;
</span><span class="cx" style="display: block; padding: 0 10px"> $parsed_args['description'] = $description;
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( '' == trim( $name ) ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( '' === trim( $name ) ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> return new WP_Error( 'empty_term_name', __( 'A name is required for this term.' ) );
</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">@@ -2902,14 +2904,14 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * @param array $parsed_args An array of potentially altered update arguments for the given term.
</span><span class="cx" style="display: block; padding: 0 10px"> * @param array $args An array of update arguments for the given term.
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $parent = apply_filters( 'wp_update_term_parent', $args['parent'], $term_id, $taxonomy, $parsed_args, $args );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $parent = (int) apply_filters( 'wp_update_term_parent', $args['parent'], $term_id, $taxonomy, $parsed_args, $args );
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> // Check for duplicate slug
</span><span class="cx" style="display: block; padding: 0 10px"> $duplicate = get_term_by( 'slug', $slug, $taxonomy );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( $duplicate && $duplicate->term_id != $term_id ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( $duplicate && $duplicate->term_id !== $term_id ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> // If an empty slug was passed or the parent changed, reset the slug to something unique.
</span><span class="cx" style="display: block; padding: 0 10px"> // Otherwise, bail.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( $empty_slug || ( $parent != $term['parent'] ) ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( $empty_slug || ( $parent !== (int) $term['parent'] ) ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> $slug = wp_unique_term_slug( $slug, (object) $args );
</span><span class="cx" style="display: block; padding: 0 10px"> } else {
</span><span class="cx" style="display: block; padding: 0 10px"> /* translators: %s: taxonomy term slug */
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -3511,10 +3513,11 @@
</span><span class="cx" style="display: block; padding: 0 10px"> return $empty_array;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $term_id = (int) $term_id;
</ins><span class="cx" style="display: block; padding: 0 10px"> $term_list = array();
</span><span class="cx" style="display: block; padding: 0 10px"> $has_children = _get_term_hierarchy( $taxonomy );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( ( 0 != $term_id ) && ! isset( $has_children[ $term_id ] ) ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( $term_id && ! isset( $has_children[ $term_id ] ) ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> return $empty_array;
</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">@@ -3538,7 +3541,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> continue;
</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">- if ( $term->parent == $term_id ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( $term->parent === $term_id ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> if ( $use_id ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $term_list[] = $term->term_id;
</span><span class="cx" style="display: block; padding: 0 10px"> } else {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -3785,7 +3788,7 @@
</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 there are no shared term_taxonomy rows, there's nothing to do here.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $shared_tt_count = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM $wpdb->term_taxonomy tt WHERE tt.term_id = %d AND tt.term_taxonomy_id != %d", $term_id, $term_taxonomy_id ) );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $shared_tt_count = (int) $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM $wpdb->term_taxonomy tt WHERE tt.term_id = %d AND tt.term_taxonomy_id != %d", $term_id, $term_taxonomy_id ) );
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> if ( ! $shared_tt_count ) {
</span><span class="cx" style="display: block; padding: 0 10px"> return $term_id;
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -3795,8 +3798,8 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * Verify that the term_taxonomy_id passed to the function is actually associated with the term_id.
</span><span class="cx" style="display: block; padding: 0 10px"> * If there's a mismatch, it may mean that the term is already split. Return the actual term_id from the db.
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $check_term_id = $wpdb->get_var( $wpdb->prepare( "SELECT term_id FROM $wpdb->term_taxonomy WHERE term_taxonomy_id = %d", $term_taxonomy_id ) );
- if ( $check_term_id != $term_id ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $check_term_id = (int) $wpdb->get_var( $wpdb->prepare( "SELECT term_id FROM $wpdb->term_taxonomy WHERE term_taxonomy_id = %d", $term_taxonomy_id ) );
+ if ( $check_term_id !== $term_id ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> return $check_term_id;
</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">@@ -4019,12 +4022,12 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * @param string $taxonomy Taxonomy for the split term.
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> function _wp_check_split_default_terms( $term_id, $new_term_id, $term_taxonomy_id, $taxonomy ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( 'category' != $taxonomy ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( 'category' !== $taxonomy ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> return;
</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"> foreach ( array( 'default_category', 'default_link_category', 'default_email_category' ) as $option ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( $term_id == get_option( $option, -1 ) ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( $term_id === (int) get_option( $option, -1 ) ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> update_option( $option, $new_term_id );
</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">@@ -4085,7 +4088,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> // Update menu locations.
</span><span class="cx" style="display: block; padding: 0 10px"> $locations = get_nav_menu_locations();
</span><span class="cx" style="display: block; padding: 0 10px"> foreach ( $locations as $location => $menu_id ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( $term_id == $menu_id ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( $term_id === $menu_id ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> $locations[ $location ] = $new_term_id;
</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">@@ -4205,7 +4208,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $t = get_taxonomy( $taxonomy );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> if ( empty( $termlink ) ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( 'category' == $taxonomy ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( 'category' === $taxonomy ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> $termlink = '?cat=' . $term->term_id;
</span><span class="cx" style="display: block; padding: 0 10px"> } elseif ( $t->query_var ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $termlink = "?$t->query_var=$slug";
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -4230,7 +4233,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $termlink = home_url( user_trailingslashit( $termlink, 'category' ) );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> // Back Compat filters.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( 'post_tag' == $taxonomy ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( 'post_tag' === $taxonomy ) {
</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"> * Filters the tag link.
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -4242,7 +4245,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * @param int $term_id Term ID.
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> $termlink = apply_filters( 'tag_link', $termlink, $term->term_id );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- } elseif ( 'category' == $taxonomy ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ } elseif ( 'category' === $taxonomy ) {
</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"> * Filters the category link.
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -4567,7 +4570,7 @@
</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"> // Can't be its own parent.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( $parent == $term_id ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( $parent === $term_id ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> return 0;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span></span></pre>
</div>
</div>
</body>
</html>