mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-06-28 14:20:15 +00:00
Coding Standards: Use strict type check for in_array() and array_search() where strings are involved.
This reduces the number of `WordPress.PHP.StrictInArray.MissingTrueStrict` issues from 486 to 50. Includes minor code layout fixes for better readability. See #49542. git-svn-id: https://develop.svn.wordpress.org/trunk@47550 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -75,7 +75,7 @@ function set_post_format( $post, $format ) {
|
||||
|
||||
if ( ! empty( $format ) ) {
|
||||
$format = sanitize_key( $format );
|
||||
if ( 'standard' === $format || ! in_array( $format, get_post_format_slugs() ) ) {
|
||||
if ( 'standard' === $format || ! in_array( $format, get_post_format_slugs(), true ) ) {
|
||||
$format = '';
|
||||
} else {
|
||||
$format = 'post-format-' . $format;
|
||||
@@ -231,7 +231,7 @@ function _post_format_get_term( $term ) {
|
||||
* @return array
|
||||
*/
|
||||
function _post_format_get_terms( $terms, $taxonomies, $args ) {
|
||||
if ( in_array( 'post_format', (array) $taxonomies ) ) {
|
||||
if ( in_array( 'post_format', (array) $taxonomies, true ) ) {
|
||||
if ( isset( $args['fields'] ) && 'names' == $args['fields'] ) {
|
||||
foreach ( $terms as $order => $name ) {
|
||||
$terms[ $order ] = get_post_format_string( str_replace( 'post-format-', '', $name ) );
|
||||
|
||||
Reference in New Issue
Block a user