Coding Standards: Replace alias PHP functions with the canonical names.

Using the canonical function name for PHP functions is strongly recommended, as aliases may be deprecated or removed without (much) warning.

This replaces all uses of the following:
* `join()` with `implode()`
* `sizeof()` with `count()`
* `is_writeable()` with `is_writable()`
* `doubleval()` with a `(float)` cast

In part, this is a follow-up to #47746.

Props jrf.
See #50767.
Built from https://develop.svn.wordpress.org/trunk@49193


git-svn-id: http://core.svn.wordpress.org/trunk@48955 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov 2020-10-18 17:27:06 +00:00
parent b6f0882ddd
commit 0e3147c40e
53 changed files with 92 additions and 92 deletions

View File

@ -120,7 +120,7 @@ if ( $doaction ) {
$redirect_to = add_query_arg( 'deleted', $deleted, $redirect_to );
}
if ( $trashed || $spammed ) {
$redirect_to = add_query_arg( 'ids', join( ',', $comment_ids ), $redirect_to );
$redirect_to = add_query_arg( 'ids', implode( ',', $comment_ids ), $redirect_to );
}
wp_safe_redirect( $redirect_to );

View File

@ -126,7 +126,7 @@ if ( $doaction ) {
$sendback = add_query_arg(
array(
'trashed' => $trashed,
'ids' => join( ',', $post_ids ),
'ids' => implode( ',', $post_ids ),
'locked' => $locked,
),
$sendback
@ -442,7 +442,7 @@ foreach ( $bulk_counts as $message => $count ) {
}
if ( $messages ) {
echo '<div id="message" class="updated notice is-dismissible"><p>' . join( ' ', $messages ) . '</p></div>';
echo '<div id="message" class="updated notice is-dismissible"><p>' . implode( ' ', $messages ) . '</p></div>';
}
unset( $messages );

View File

@ -162,7 +162,7 @@ function wp_ajax_ajax_tag_search() {
)
);
echo join( "\n", $results );
echo implode( "\n", $results );
wp_die();
}

View File

@ -615,7 +615,7 @@ class WP_Comments_List_Table extends WP_List_Table {
if ( ! $the_comment_class ) {
$the_comment_class = '';
}
$the_comment_class = join( ' ', get_comment_class( $the_comment_class, $comment, $comment->comment_post_ID ) );
$the_comment_class = implode( ' ', get_comment_class( $the_comment_class, $comment, $comment->comment_post_ID ) );
if ( $comment->comment_post_ID > 0 ) {
$post = get_post( $comment->comment_post_ID );

View File

@ -291,7 +291,7 @@ function get_cli_args( $param, $required = false ) {
$last_arg = null;
$return = null;
$il = sizeof( $args );
$il = count( $args );
for ( $i = 1, $il; $i < $il; $i++ ) {
if ( (bool) preg_match( '/^--(.+)/', $args[ $i ], $match ) ) {

View File

@ -976,7 +976,7 @@ class WP_List_Table {
if ( ! empty( $infinite_scroll ) ) {
$pagination_links_class .= ' hide-if-js';
}
$output .= "\n<span class='$pagination_links_class'>" . join( "\n", $page_links ) . '</span>';
$output .= "\n<span class='$pagination_links_class'>" . implode( "\n", $page_links ) . '</span>';
if ( $total_pages ) {
$page_class = $total_pages < 2 ? ' one-page' : '';
@ -1242,7 +1242,7 @@ class WP_List_Table {
$id = $with_id ? "id='$column_key'" : '';
if ( ! empty( $class ) ) {
$class = "class='" . join( ' ', $class ) . "'";
$class = "class='" . implode( ' ', $class ) . "'";
}
echo "<$tag $scope $id $class>$column_display_name</$tag>";

View File

@ -614,7 +614,7 @@ class WP_Media_List_Table extends WP_List_Table {
);
}
/* translators: Used between list items, there is a space after the comma. */
echo join( __( ', ' ), $out );
echo implode( __( ', ' ), $out );
} else {
echo '<span aria-hidden="true">&#8212;</span><span class="screen-reader-text">' . get_taxonomy( $taxonomy )->labels->no_terms . '</span>';
}

View File

@ -1219,7 +1219,7 @@ class WP_Posts_List_Table extends WP_List_Table {
$term_links = apply_filters( 'post_column_taxonomy_links', $term_links, $taxonomy, $terms );
/* translators: Used between list items, there is a space after the comma. */
echo join( __( ', ' ), $term_links );
echo implode( __( ', ' ), $term_links );
} else {
echo '<span aria-hidden="true">&#8212;</span><span class="screen-reader-text">' . $taxonomy_object->labels->no_terms . '</span>';
}

View File

@ -1855,7 +1855,7 @@ class WP_Site_Health {
$hosts = explode( ',', WP_ACCESSIBLE_HOSTS );
}
if ( $blocked && 0 === sizeof( $hosts ) ) {
if ( $blocked && 0 === count( $hosts ) ) {
$result['status'] = 'critical';
$result['label'] = __( 'HTTP requests are blocked' );
@ -1870,7 +1870,7 @@ class WP_Site_Health {
);
}
if ( $blocked && 0 < sizeof( $hosts ) ) {
if ( $blocked && 0 < count( $hosts ) ) {
$result['status'] = 'recommended';
$result['label'] = __( 'HTTP requests are partially blocked' );

View File

@ -534,7 +534,7 @@ function export_wp( $args = array() ) {
// Fetch 20 posts at a time rather than loading the entire table into memory.
while ( $next_posts = array_splice( $post_ids, 0, 20 ) ) {
$where = 'WHERE ID IN (' . join( ',', $next_posts ) . ')';
$where = 'WHERE ID IN (' . implode( ',', $next_posts ) . ')';
$posts = $wpdb->get_results( "SELECT * FROM {$wpdb->posts} $where" );
// Begin Loop.

View File

@ -489,7 +489,7 @@ function wp_edit_theme_plugin_file( $args ) {
$previous_content = file_get_contents( $real_file );
if ( ! is_writeable( $real_file ) ) {
if ( ! is_writable( $real_file ) ) {
return new WP_Error( 'file_not_writable' );
}

View File

@ -1118,7 +1118,7 @@ function image_align_input_fields( $post, $checked = '' ) {
" /><label for='image-align-{$name}-{$post->ID}' class='align image-align-{$name}-label'>$label</label>";
}
return join( "\n", $out );
return implode( "\n", $out );
}
/**
@ -1195,7 +1195,7 @@ function image_size_input_fields( $post, $check = '' ) {
return array(
'label' => __( 'Size' ),
'input' => 'html',
'html' => join( "\n", $out ),
'html' => implode( "\n", $out ),
);
}
@ -1424,7 +1424,7 @@ function get_attachment_fields_to_edit( $post, $errors = null ) {
$values[] = $term->slug;
}
$t['value'] = join( ', ', $values );
$t['value'] = implode( ', ', $values );
$form_fields[ $taxonomy ] = $t;
}
@ -1784,7 +1784,7 @@ function get_media_item( $attachment_id, $args = null ) {
}
if ( ! empty( $field['helps'] ) ) {
$item .= "<p class='help'>" . join( "</p>\n<p class='help'>", array_unique( (array) $field['helps'] ) ) . '</p>';
$item .= "<p class='help'>" . implode( "</p>\n<p class='help'>", array_unique( (array) $field['helps'] ) ) . '</p>';
}
$item .= "</td>\n\t\t</tr>\n";
@ -1883,7 +1883,7 @@ function get_compat_media_markup( $attachment_id, $args = null ) {
$values[] = $term->slug;
}
$t['value'] = join( ', ', $values );
$t['value'] = implode( ', ', $values );
$t['taxonomy'] = true;
$form_fields[ $taxonomy ] = $t;
@ -1976,7 +1976,7 @@ function get_compat_media_markup( $attachment_id, $args = null ) {
}
if ( ! empty( $field['helps'] ) ) {
$item .= "<p class='help'>" . join( "</p>\n<p class='help'>", array_unique( (array) $field['helps'] ) ) . '</p>';
$item .= "<p class='help'>" . implode( "</p>\n<p class='help'>", array_unique( (array) $field['helps'] ) ) . '</p>';
}
$item .= "</td>\n\t\t</tr>\n";

View File

@ -121,7 +121,7 @@ function insert_with_markers( $filename, $marker, $insertion ) {
if ( $perms ) {
chmod( $filename, $perms | 0644 );
}
} elseif ( ! is_writeable( $filename ) ) {
} elseif ( ! is_writable( $filename ) ) {
return false;
}

View File

@ -275,7 +275,7 @@ function wp_prepare_revisions_for_js( $post, $selected_revision_id, $from = null
* If we only have one revision, the initial revision is missing; This happens
* when we have an autsosave and the user has clicked 'View the Autosave'
*/
if ( 1 === sizeof( $revisions ) ) {
if ( 1 === count( $revisions ) ) {
$revisions[ $post->ID ] = array(
'id' => $post->ID,
'title' => get_the_title( $post->ID ),

View File

@ -278,7 +278,7 @@ function get_terms_to_edit( $post_id, $taxonomy = 'post_tag' ) {
$term_names[] = $term->name;
}
$terms_to_edit = esc_attr( join( ',', $term_names ) );
$terms_to_edit = esc_attr( implode( ',', $term_names ) );
/**
* Filters the comma-separated list of terms available to edit.

View File

@ -1112,7 +1112,7 @@ function upgrade_130() {
$limit = $option->dupes - 1;
$dupe_ids = $wpdb->get_col( $wpdb->prepare( "SELECT option_id FROM $wpdb->options WHERE option_name = %s LIMIT %d", $option->option_name, $limit ) );
if ( $dupe_ids ) {
$dupe_ids = join( ',', $dupe_ids );
$dupe_ids = implode( ',', $dupe_ids );
$wpdb->query( "DELETE FROM $wpdb->options WHERE option_id IN ($dupe_ids)" );
}
}

View File

@ -60,7 +60,7 @@ switch ( $action ) {
wp_redirect( $this_file );
exit;
}
$all_links = join( ',', $linkcheck );
$all_links = implode( ',', $linkcheck );
/*
* Should now have an array of links we can change:
* $q = $wpdb->query("update $wpdb->links SET link_category='$category' WHERE link_id IN ($all_links)");

View File

@ -106,7 +106,7 @@ function _wp_menu_output( $menu, $submenu, $submenu_as_parent = true ) {
$class[] = esc_attr( $item[4] );
}
$class = $class ? ' class="' . join( ' ', $class ) . '"' : '';
$class = $class ? ' class="' . implode( ' ', $class ) . '"' : '';
$id = ! empty( $item[5] ) ? ' id="' . preg_replace( '|[^a-zA-Z0-9_:.]|', '-', $item[5] ) . '"' : '';
$img = '';
$img_style = '';
@ -240,7 +240,7 @@ function _wp_menu_output( $menu, $submenu, $submenu_as_parent = true ) {
$class[] = esc_attr( $sub_item[4] );
}
$class = $class ? ' class="' . join( ' ', $class ) . '"' : '';
$class = $class ? ' class="' . implode( ' ', $class ) . '"' : '';
$menu_hook = get_plugin_page_hook( $sub_item[2], $item[2] );
$sub_file = $sub_item[2];

View File

@ -89,7 +89,7 @@ if ( $action ) {
echo '<div class="wrap">';
echo '<h1>' . esc_html( $title ) . '</h1>';
$url = self_admin_url( 'update.php?action=update-selected-themes&amp;themes=' . urlencode( join( ',', $themes ) ) );
$url = self_admin_url( 'update.php?action=update-selected-themes&amp;themes=' . urlencode( implode( ',', $themes ) ) );
$url = wp_nonce_url( $url, 'bulk-update-themes' );
echo "<iframe src='$url' style='width: 100%; height:100%; min-height:850px;'></iframe>";

View File

@ -195,7 +195,7 @@ $content = esc_textarea( $content );
<h2>
<?php
if ( is_plugin_active( $plugin ) ) {
if ( is_writeable( $real_file ) ) {
if ( is_writable( $real_file ) ) {
/* translators: %s: Plugin file name. */
printf( __( 'Editing %s (active)' ), '<strong>' . esc_html( $file ) . '</strong>' );
} else {
@ -203,7 +203,7 @@ $content = esc_textarea( $content );
printf( __( 'Browsing %s (active)' ), '<strong>' . esc_html( $file ) . '</strong>' );
}
} else {
if ( is_writeable( $real_file ) ) {
if ( is_writable( $real_file ) ) {
/* translators: %s: Plugin file name. */
printf( __( 'Editing %s (inactive)' ), '<strong>' . esc_html( $file ) . '</strong>' );
} else {
@ -275,7 +275,7 @@ $content = esc_textarea( $content );
</div>
<?php endif; ?>
<?php if ( is_writeable( $real_file ) ) : ?>
<?php if ( is_writable( $real_file ) ) : ?>
<div class="editor-notices">
<?php if ( in_array( $plugin, (array) get_option( 'active_plugins', array() ), true ) ) { ?>
<div class="notice notice-warning inline active-plugin-edit-warning">

View File

@ -162,7 +162,7 @@ if ( $action ) {
echo '<div class="wrap">';
echo '<h1>' . esc_html( $title ) . '</h1>';
$url = self_admin_url( 'update.php?action=update-selected&amp;plugins=' . urlencode( join( ',', $plugins ) ) );
$url = self_admin_url( 'update.php?action=update-selected&amp;plugins=' . urlencode( implode( ',', $plugins ) ) );
$url = wp_nonce_url( $url, 'bulk-update-plugins' );
echo "<iframe src='$url' style='width: 100%; height:100%; min-height:850px;'></iframe>";

View File

@ -301,7 +301,7 @@ else :
<?php if ( is_child_theme() && $theme->get_stylesheet() === get_template() ) : ?>
<div class="notice notice-warning inline">
<p>
<?php if ( is_writeable( $file ) ) : ?>
<?php if ( is_writable( $file ) ) : ?>
<strong><?php _e( 'Caution:' ); ?></strong>
<?php endif; ?>
<?php _e( 'This is a file in your current parent theme.' ); ?>
@ -309,7 +309,7 @@ else :
</div>
<?php endif; ?>
</div>
<?php if ( is_writeable( $file ) ) : ?>
<?php if ( is_writable( $file ) ) : ?>
<p class="submit">
<?php submit_button( __( 'Update File' ), 'primary', 'submit', false ); ?>
<span class="spinner"></span>

View File

@ -162,7 +162,7 @@ if ( $doaction ) {
$location = add_query_arg(
array(
'trashed' => count( $post_ids ),
'ids' => join( ',', $post_ids ),
'ids' => implode( ',', $post_ids ),
),
$location
);

View File

@ -48,7 +48,7 @@ function twentytwenty_get_starter_content() {
'post_title' => __( 'The New UMoMA Opens its Doors', 'twentytwenty' ),
// Use the above featured image with the predefined about page.
'thumbnail' => '{{image-opening}}',
'post_content' => join(
'post_content' => implode(
'',
array(
'<!-- wp:group {"align":"wide"} -->',

View File

@ -234,7 +234,7 @@ function wp_list_bookmarks( $args = '' ) {
$parsed_args['class'] = explode( ' ', $parsed_args['class'] );
}
$parsed_args['class'] = array_map( 'sanitize_html_class', $parsed_args['class'] );
$parsed_args['class'] = trim( join( ' ', $parsed_args['class'] ) );
$parsed_args['class'] = trim( implode( ' ', $parsed_args['class'] ) );
if ( $parsed_args['categorize'] ) {
$cats = get_terms(

View File

@ -1010,11 +1010,11 @@ function wp_generate_tag_cloud( $tags, $args = '' ) {
* Note: this is redundant but doesn't harm.
*/
$return = "<ul class='wp-tag-cloud' role='list'>\n\t<li>";
$return .= join( "</li>\n\t<li>", $a );
$return .= implode( "</li>\n\t<li>", $a );
$return .= "</li>\n</ul>\n";
break;
default:
$return = join( $args['separator'], $a );
$return = implode( $args['separator'], $a );
break;
}
@ -1349,7 +1349,7 @@ function get_the_term_list( $post_id, $taxonomy, $before = '', $sep = '', $after
*/
$term_links = apply_filters( "term_links-{$taxonomy}", $links ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores
return $before . join( $sep, $term_links ) . $after;
return $before . implode( $sep, $term_links ) . $after;
}
/**

View File

@ -72,7 +72,7 @@ class Walker_Nav_Menu extends Walker {
* @param stdClass $args An object of `wp_nav_menu()` arguments.
* @param int $depth Depth of menu item. Used for padding.
*/
$class_names = join( ' ', apply_filters( 'nav_menu_submenu_css_class', $classes, $args, $depth ) );
$class_names = implode( ' ', apply_filters( 'nav_menu_submenu_css_class', $classes, $args, $depth ) );
$class_names = $class_names ? ' class="' . esc_attr( $class_names ) . '"' : '';
$output .= "{$n}{$indent}<ul$class_names>{$n}";
@ -150,7 +150,7 @@ class Walker_Nav_Menu extends Walker {
* @param stdClass $args An object of wp_nav_menu() arguments.
* @param int $depth Depth of menu item. Used for padding.
*/
$class_names = join( ' ', apply_filters( 'nav_menu_css_class', array_filter( $classes ), $item, $args, $depth ) );
$class_names = implode( ' ', apply_filters( 'nav_menu_css_class', array_filter( $classes ), $item, $args, $depth ) );
$class_names = $class_names ? ' class="' . esc_attr( $class_names ) . '"' : '';
/**

View File

@ -2397,7 +2397,7 @@ final class WP_Customize_Manager {
$notification = array();
foreach ( $validity->errors as $error_code => $error_messages ) {
$notification[ $error_code ] = array(
'message' => join( ' ', $error_messages ),
'message' => implode( ' ', $error_messages ),
'data' => $validity->get_error_data( $error_code ),
);
}

View File

@ -2420,10 +2420,10 @@ class WP_Query {
if ( empty( $in_search_post_types ) ) {
$where .= ' AND 1=0 ';
} else {
$where .= " AND {$wpdb->posts}.post_type IN ('" . join( "', '", array_map( 'esc_sql', $in_search_post_types ) ) . "')";
$where .= " AND {$wpdb->posts}.post_type IN ('" . implode( "', '", array_map( 'esc_sql', $in_search_post_types ) ) . "')";
}
} elseif ( ! empty( $post_type ) && is_array( $post_type ) ) {
$where .= " AND {$wpdb->posts}.post_type IN ('" . join( "', '", esc_sql( $post_type ) ) . "')";
$where .= " AND {$wpdb->posts}.post_type IN ('" . implode( "', '", esc_sql( $post_type ) ) . "')";
} elseif ( ! empty( $post_type ) ) {
$where .= $wpdb->prepare( " AND {$wpdb->posts}.post_type = %s", $post_type );
$post_type_object = get_post_type_object( $post_type );
@ -2485,20 +2485,20 @@ class WP_Query {
}
if ( ! empty( $e_status ) ) {
$statuswheres[] = '(' . join( ' AND ', $e_status ) . ')';
$statuswheres[] = '(' . implode( ' AND ', $e_status ) . ')';
}
if ( ! empty( $r_status ) ) {
if ( ! empty( $q['perm'] ) && 'editable' === $q['perm'] && ! current_user_can( $edit_others_cap ) ) {
$statuswheres[] = "({$wpdb->posts}.post_author = $user_id " . 'AND (' . join( ' OR ', $r_status ) . '))';
$statuswheres[] = "({$wpdb->posts}.post_author = $user_id " . 'AND (' . implode( ' OR ', $r_status ) . '))';
} else {
$statuswheres[] = '(' . join( ' OR ', $r_status ) . ')';
$statuswheres[] = '(' . implode( ' OR ', $r_status ) . ')';
}
}
if ( ! empty( $p_status ) ) {
if ( ! empty( $q['perm'] ) && 'readable' === $q['perm'] && ! current_user_can( $read_private_cap ) ) {
$statuswheres[] = "({$wpdb->posts}.post_author = $user_id " . 'AND (' . join( ' OR ', $p_status ) . '))';
$statuswheres[] = "({$wpdb->posts}.post_author = $user_id " . 'AND (' . implode( ' OR ', $p_status ) . '))';
} else {
$statuswheres[] = '(' . join( ' OR ', $p_status ) . ')';
$statuswheres[] = '(' . implode( ' OR ', $p_status ) . ')';
}
}
if ( $post_status_join ) {
@ -2669,7 +2669,7 @@ class WP_Query {
$post_ids[] = (int) $comment->comment_post_ID;
}
$post_ids = join( ',', $post_ids );
$post_ids = implode( ',', $post_ids );
$join = '';
if ( $post_ids ) {
$where = "AND {$wpdb->posts}.ID IN ($post_ids) ";

View File

@ -274,7 +274,7 @@ class WP_Text_Diff_Renderer_Table extends Text_Diff_Renderer {
// If they're too different, don't include any <ins> or <del>'s.
if ( preg_match_all( '!(<ins>.*?</ins>|<del>.*?</del>)!', $diff, $diff_matches ) ) {
// Length of all text between <ins> or <del>.
$stripped_matches = strlen( strip_tags( join( ' ', $diff_matches[0] ) ) );
$stripped_matches = strlen( strip_tags( implode( ' ', $diff_matches[0] ) ) );
// Since we count length of text between <ins> or <del> (instead of picking just one),
// we double the length of chars not in those tags.
$stripped_diff = strlen( strip_tags( $diff ) ) * 2 - $stripped_matches;

View File

@ -279,7 +279,7 @@ class WP_User_Query {
}
$posts_table = $wpdb->get_blog_prefix( $blog_id ) . 'posts';
$this->query_where .= " AND $wpdb->users.ID IN ( SELECT DISTINCT $posts_table.post_author FROM $posts_table WHERE $posts_table.post_status = 'publish' AND $posts_table.post_type IN ( " . join( ', ', $post_types ) . ' ) )';
$this->query_where .= " AND $wpdb->users.ID IN ( SELECT DISTINCT $posts_table.post_author FROM $posts_table WHERE $posts_table.post_status = 'publish' AND $posts_table.post_type IN ( " . implode( ', ', $post_types ) . ' ) )';
}
// nicename

View File

@ -432,7 +432,7 @@ function comment_author_url_link( $linktext = '', $before = '', $after = '', $co
*/
function comment_class( $class = '', $comment = null, $post_id = null, $echo = true ) {
// Separates classes with a single space, collates classes for comment DIV.
$class = 'class="' . join( ' ', get_comment_class( $class, $comment, $post_id ) ) . '"';
$class = 'class="' . implode( ' ', get_comment_class( $class, $comment, $post_id ) ) . '"';
if ( $echo ) {
echo $class;

View File

@ -3235,7 +3235,7 @@ function _prime_comment_caches( $comment_ids, $update_meta_cache = true ) {
$non_cached_ids = _get_non_cached_ids( $comment_ids, 'comment' );
if ( ! empty( $non_cached_ids ) ) {
$fresh_comments = $wpdb->get_results( sprintf( "SELECT $wpdb->comments.* FROM $wpdb->comments WHERE comment_ID IN (%s)", join( ',', array_map( 'intval', $non_cached_ids ) ) ) );
$fresh_comments = $wpdb->get_results( sprintf( "SELECT $wpdb->comments.* FROM $wpdb->comments WHERE comment_ID IN (%s)", implode( ',', array_map( 'intval', $non_cached_ids ) ) ) );
update_comment_cache( $fresh_comments, $update_meta_cache );
}

View File

@ -127,7 +127,7 @@ function _mb_substr( $str, $start, $length = null, $encoding = null ) {
// If there's anything left over, repeat the loop.
} while ( count( $pieces ) > 1 && $str = array_pop( $pieces ) );
return join( '', array_slice( $chars, $start, $length ) );
return implode( '', array_slice( $chars, $start, $length ) );
}
if ( ! function_exists( 'mb_strlen' ) ) :

View File

@ -204,7 +204,7 @@ function wp_maybe_load_embeds() {
*
* @param callable $handler Audio embed handler callback function.
*/
wp_embed_register_handler( 'audio', '#^https?://.+?\.(' . join( '|', wp_get_audio_extensions() ) . ')$#i', apply_filters( 'wp_audio_embed_handler', 'wp_embed_handler_audio' ), 9999 );
wp_embed_register_handler( 'audio', '#^https?://.+?\.(' . implode( '|', wp_get_audio_extensions() ) . ')$#i', apply_filters( 'wp_audio_embed_handler', 'wp_embed_handler_audio' ), 9999 );
/**
* Filters the video embed handler callback.
@ -213,7 +213,7 @@ function wp_maybe_load_embeds() {
*
* @param callable $handler Video embed handler callback function.
*/
wp_embed_register_handler( 'video', '#^https?://.+?\.(' . join( '|', wp_get_video_extensions() ) . ')$#i', apply_filters( 'wp_video_embed_handler', 'wp_embed_handler_video' ), 9999 );
wp_embed_register_handler( 'video', '#^https?://.+?\.(' . implode( '|', wp_get_video_extensions() ) . ')$#i', apply_filters( 'wp_video_embed_handler', 'wp_embed_handler_video' ), 9999 );
}
/**
@ -842,7 +842,7 @@ function wp_filter_oembed_iframe_title_attribute( $result, $data, $url ) {
if ( isset( $attrs['title'] ) ) {
unset( $attrs['title'] );
$attr_string = join( ' ', wp_list_pluck( $attrs, 'whole' ) );
$attr_string = implode( ' ', wp_list_pluck( $attrs, 'whole' ) );
$result = str_replace( $matches[0], '<iframe ' . trim( $attr_string ) . '>', $result );
}
return str_ireplace( '<iframe ', sprintf( '<iframe title="%s" ', esc_attr( $title ) ), $result );

View File

@ -722,7 +722,7 @@ function _get_wptexturize_split_regex( $shortcode_regex = '' ) {
* @return string The regular expression
*/
function _get_wptexturize_shortcode_regex( $tagnames ) {
$tagregexp = join( '|', array_map( 'preg_quote', $tagnames ) );
$tagregexp = implode( '|', array_map( 'preg_quote', $tagnames ) );
$tagregexp = "(?:$tagregexp)(?=[\\s\\]\\/])"; // Excerpt of get_shortcode_regex().
// phpcs:disable Squiz.Strings.ConcatenationSpacing.PaddingFound -- don't remove regex indentation
$regex =
@ -824,7 +824,7 @@ function shortcode_unautop( $pee ) {
return $pee;
}
$tagregexp = join( '|', array_map( 'preg_quote', array_keys( $shortcode_tags ) ) );
$tagregexp = implode( '|', array_map( 'preg_quote', array_keys( $shortcode_tags ) ) );
$spaces = wp_spaces_regexp();
// phpcs:disable Squiz.Strings.ConcatenationSpacing.PaddingFound,WordPress.WhiteSpace.PrecisionAlignment.Found -- don't remove regex indentation
@ -3232,7 +3232,7 @@ function wp_targeted_link_rel_callback( $matches ) {
}
$atts['rel']['whole'] = 'rel="' . esc_attr( $rel ) . '"';
$link_html = join( ' ', array_column( $atts, 'whole' ) );
$link_html = implode( ' ', array_column( $atts, 'whole' ) );
if ( $is_escaped ) {
$link_html = preg_replace( '/[\'"]/', '\\\\$0', $link_html );
@ -3696,7 +3696,7 @@ function sanitize_email( $email ) {
}
// Join valid subs into the new domain.
$domain = join( '.', $new_subs );
$domain = implode( '.', $new_subs );
// Put the email back together.
$sanitized_email = $local . '@' . $domain;

View File

@ -467,7 +467,7 @@ function size_format( $bytes, $decimals = 0 ) {
}
foreach ( $quant as $unit => $mag ) {
if ( doubleval( $bytes ) >= $mag ) {
if ( (float) $bytes >= $mag ) {
return number_format_i18n( $bytes / $mag, $decimals ) . ' ' . $unit;
}
}
@ -3431,7 +3431,7 @@ function _default_wp_die_handler( $message, $title = '', $args = array() ) {
array( $message ),
wp_list_pluck( $parsed_args['additional_errors'], 'message' )
);
$message = "<ul>\n\t\t<li>" . join( "</li>\n\t\t<li>", $message ) . "</li>\n\t</ul>";
$message = "<ul>\n\t\t<li>" . implode( "</li>\n\t\t<li>", $message ) . "</li>\n\t</ul>";
}
$message = sprintf(
@ -5880,7 +5880,7 @@ function wp_timezone_choice( $selected_zone, $locale = null ) {
}
// Build the value.
$value = join( '/', $value );
$value = implode( '/', $value );
$selected = '';
if ( $value === $selected_zone ) {
$selected = 'selected="selected" ';
@ -5981,7 +5981,7 @@ function wp_timezone_choice( $selected_zone, $locale = null ) {
}
$structure[] = '</optgroup>';
return join( "\n", $structure );
return implode( "\n", $structure );
}
/**
@ -6419,7 +6419,7 @@ function wp_debug_backtrace_summary( $ignore_class = null, $skip_frames = 0, $pr
}
}
if ( $pretty ) {
return join( ', ', array_reverse( $caller ) );
return implode( ', ', array_reverse( $caller ) );
} else {
return $caller;
}

View File

@ -4345,12 +4345,12 @@ function paginate_links( $args = '' ) {
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;
}

View File

@ -1617,7 +1617,7 @@ function wp_dropdown_languages( $args = array() ) {
// Combine the output string.
$output = sprintf( '<select name="%s" id="%s">', esc_attr( $parsed_args['name'] ), esc_attr( $parsed_args['id'] ) );
$output .= join( "\n", $structure );
$output .= implode( "\n", $structure );
$output .= '</select>';
if ( $parsed_args['echo'] ) {

View File

@ -1035,7 +1035,7 @@ function wp_get_attachment_image( $attachment_id, $size = 'thumbnail', $icon = f
$size_class = $size;
if ( is_array( $size_class ) ) {
$size_class = join( 'x', $size_class );
$size_class = implode( 'x', $size_class );
}
$default_attr = array(
@ -2950,7 +2950,7 @@ function wp_audio_shortcode( $attr, $content = '' ) {
$html .= "<!--[if lt IE 9]><script>document.createElement('audio');</script><![endif]-->\n";
}
$html .= sprintf( '<audio %s controls="controls">', join( ' ', $attr_strings ) );
$html .= sprintf( '<audio %s controls="controls">', implode( ' ', $attr_strings ) );
$fileurl = '';
$source = '<source type="%s" src="%s" />';
@ -3218,7 +3218,7 @@ function wp_video_shortcode( $attr, $content = '' ) {
$html .= "<!--[if lt IE 9]><script>document.createElement('video');</script><![endif]-->\n";
}
$html .= sprintf( '<video %s controls="controls">', join( ' ', $attr_strings ) );
$html .= sprintf( '<video %s controls="controls">', implode( ' ', $attr_strings ) );
$fileurl = '';
$source = '<source type="%s" src="%s" />';

View File

@ -1055,7 +1055,7 @@ function update_meta_cache( $meta_type, $object_ids ) {
}
// Get meta info.
$id_list = join( ',', $non_cached_ids );
$id_list = implode( ',', $non_cached_ids );
$id_column = ( 'user' === $meta_type ) ? 'umeta_id' : 'meta_id';
$meta_list = $wpdb->get_results( "SELECT $column, meta_key, meta_value FROM $table WHERE $column IN ($id_list) ORDER BY $id_column ASC", ARRAY_A );

View File

@ -131,7 +131,7 @@ function _prime_network_caches( $network_ids ) {
$non_cached_ids = _get_non_cached_ids( $network_ids, 'networks' );
if ( ! empty( $non_cached_ids ) ) {
$fresh_networks = $wpdb->get_results( sprintf( "SELECT $wpdb->site.* FROM $wpdb->site WHERE id IN (%s)", join( ',', array_map( 'intval', $non_cached_ids ) ) ) ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared
$fresh_networks = $wpdb->get_results( sprintf( "SELECT $wpdb->site.* FROM $wpdb->site WHERE id IN (%s)", implode( ',', array_map( 'intval', $non_cached_ids ) ) ) ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared
update_network_cache( $fresh_networks );
}

View File

@ -352,7 +352,7 @@ function _prime_site_caches( $ids, $update_meta_cache = true ) {
$non_cached_ids = _get_non_cached_ids( $ids, 'sites' );
if ( ! empty( $non_cached_ids ) ) {
$fresh_sites = $wpdb->get_results( sprintf( "SELECT * FROM $wpdb->blogs WHERE blog_id IN (%s)", join( ',', array_map( 'intval', $non_cached_ids ) ) ) ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared
$fresh_sites = $wpdb->get_results( sprintf( "SELECT * FROM $wpdb->blogs WHERE blog_id IN (%s)", implode( ',', array_map( 'intval', $non_cached_ids ) ) ) ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared
update_site_cache( $fresh_sites, $update_meta_cache );
}

View File

@ -2723,7 +2723,7 @@ if ( ! function_exists( 'get_avatar' ) ) :
esc_attr( $args['alt'] ),
esc_url( $url ),
esc_url( $url2x ) . ' 2x',
esc_attr( join( ' ', $class ) ),
esc_attr( implode( ' ', $class ) ),
(int) $args['height'],
(int) $args['width'],
$extra_attr

View File

@ -456,7 +456,7 @@ function has_excerpt( $post = 0 ) {
*/
function post_class( $class = '', $post_id = null ) {
// Separates classes with a single space, collates classes for post DIV.
echo 'class="' . esc_attr( join( ' ', get_post_class( $class, $post_id ) ) ) . '"';
echo 'class="' . esc_attr( implode( ' ', get_post_class( $class, $post_id ) ) ) . '"';
}
/**
@ -592,7 +592,7 @@ function get_post_class( $class = '', $post_id = null ) {
*/
function body_class( $class = '' ) {
// Separates class names with a single space, collates class names for body element.
echo 'class="' . esc_attr( join( ' ', get_body_class( $class ) ) ) . '"';
echo 'class="' . esc_attr( implode( ' ', get_body_class( $class ) ) ) . '"';
}
/**

View File

@ -2955,7 +2955,7 @@ function wp_post_mime_type_where( $post_mime_types, $table_alias = '' ) {
}
if ( ! empty( $wheres ) ) {
$where = ' AND (' . join( ' OR ', $wheres ) . ') ';
$where = ' AND (' . implode( ' OR ', $wheres ) . ') ';
}
return $where;
@ -7466,7 +7466,7 @@ function _prime_post_caches( $ids, $update_term_cache = true, $update_meta_cache
$non_cached_ids = _get_non_cached_ids( $ids, 'posts' );
if ( ! empty( $non_cached_ids ) ) {
$fresh_posts = $wpdb->get_results( sprintf( "SELECT $wpdb->posts.* FROM $wpdb->posts WHERE ID IN (%s)", join( ',', $non_cached_ids ) ) );
$fresh_posts = $wpdb->get_results( sprintf( "SELECT $wpdb->posts.* FROM $wpdb->posts WHERE ID IN (%s)", implode( ',', $non_cached_ids ) ) );
update_post_caches( $fresh_posts, 'any', $update_term_cache, $update_meta_cache );
}

View File

@ -252,7 +252,7 @@ function get_shortcode_regex( $tagnames = null ) {
if ( empty( $tagnames ) ) {
$tagnames = array_keys( $shortcode_tags );
}
$tagregexp = join( '|', array_map( 'preg_quote', $tagnames ) );
$tagregexp = implode( '|', array_map( 'preg_quote', $tagnames ) );
// WARNING! Do not change this regex without changing do_shortcode_tag() and strip_shortcode_tag().
// Also, see shortcode_unautop() and shortcode.js.

View File

@ -2708,7 +2708,7 @@ function wp_set_object_terms( $object_id, $terms, $taxonomy, $append = false ) {
}
if ( $values ) {
if ( false === $wpdb->query( "INSERT INTO $wpdb->term_relationships (object_id, term_taxonomy_id, term_order) VALUES " . join( ',', $values ) . ' ON DUPLICATE KEY UPDATE term_order = VALUES(term_order)' ) ) {
if ( false === $wpdb->query( "INSERT INTO $wpdb->term_relationships (object_id, term_taxonomy_id, term_order) VALUES " . implode( ',', $values ) . ' ON DUPLICATE KEY UPDATE term_order = VALUES(term_order)' ) ) {
return new WP_Error( 'db_insert_error', __( 'Could not insert term relationship into the database.' ), $wpdb->last_error );
}
}
@ -4058,7 +4058,7 @@ function _prime_term_caches( $term_ids, $update_meta_cache = true ) {
$non_cached_ids = _get_non_cached_ids( $term_ids, 'terms' );
if ( ! empty( $non_cached_ids ) ) {
$fresh_terms = $wpdb->get_results( sprintf( "SELECT t.*, tt.* FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy AS tt ON t.term_id = tt.term_id WHERE t.term_id IN (%s)", join( ',', array_map( 'intval', $non_cached_ids ) ) ) );
$fresh_terms = $wpdb->get_results( sprintf( "SELECT t.*, tt.* FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy AS tt ON t.term_id = tt.term_id WHERE t.term_id IN (%s)", implode( ',', array_map( 'intval', $non_cached_ids ) ) ) );
update_term_cache( $fresh_terms, $update_meta_cache );
@ -4708,7 +4708,7 @@ function the_taxonomies( $args = array() ) {
$parsed_args = wp_parse_args( $args, $defaults );
echo $parsed_args['before'] . join( $parsed_args['sep'], get_the_taxonomies( $parsed_args['post'], $parsed_args ) ) . $parsed_args['after'];
echo $parsed_args['before'] . implode( $parsed_args['sep'], get_the_taxonomies( $parsed_args['post'], $parsed_args ) ) . $parsed_args['after'];
}
/**

View File

@ -2149,7 +2149,7 @@ function get_theme_starter_content() {
'text',
array(
'title' => _x( 'Find Us', 'Theme starter content' ),
'text' => join(
'text' => implode(
'',
array(
'<strong>' . _x( 'Address', 'Theme starter content' ) . "</strong>\n",

View File

@ -13,7 +13,7 @@
*
* @global string $wp_version
*/
$wp_version = '5.6-alpha-49192';
$wp_version = '5.6-alpha-49193';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.

View File

@ -281,7 +281,7 @@ class WP_Widget_Custom_HTML extends WP_Widget {
<# if ( data.codeEditorDisabled ) { #>
<p>
<?php _e( 'Some HTML tags are not permitted, including:' ); ?>
<code><?php echo join( '</code>, <code>', $disallowed_html ); ?></code>
<code><?php echo implode( '</code>, <code>', $disallowed_html ); ?></code>
</p>
<# } #>
<?php endif; ?>

View File

@ -219,7 +219,7 @@ class WP_Widget_Media_Image extends WP_Widget_Media {
$width = empty( $caption_size[0] ) ? 0 : $caption_size[0];
}
$image_attributes['class'] .= sprintf( ' attachment-%1$s size-%1$s', is_array( $size ) ? join( 'x', $size ) : $size );
$image_attributes['class'] .= sprintf( ' attachment-%1$s size-%1$s', is_array( $size ) ? implode( 'x', $size ) : $size );
$image = wp_get_attachment_image( $attachment->ID, $size, false, $image_attributes );

View File

@ -208,7 +208,7 @@ abstract class WP_Widget_Media extends WP_Widget {
}
$tokens = array_map( 'sanitize_html_class', $tokens );
$tokens = array_filter( $tokens );
return join( ' ', $tokens );
return implode( ' ', $tokens );
}
/**
@ -343,7 +343,7 @@ abstract class WP_Widget_Media extends WP_Widget {
class="media-widget-instance-property"
name="<?php echo esc_attr( $this->get_field_name( $name ) ); ?>"
id="<?php echo esc_attr( $this->get_field_id( $name ) ); // Needed specifically by wpWidgets.appendTitle(). ?>"
value="<?php echo esc_attr( is_array( $value ) ? join( ',', $value ) : (string) $value ); ?>"
value="<?php echo esc_attr( is_array( $value ) ? implode( ',', $value ) : (string) $value ); ?>"
/>
<?php
endforeach;