From 97b2f07d2eba6cdd88bb960ba539d4c07f84f71f Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Sun, 18 Oct 2020 17:25:10 +0000 Subject: [PATCH] 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. git-svn-id: https://develop.svn.wordpress.org/trunk@49193 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-admin/edit-comments.php | 2 +- src/wp-admin/edit.php | 4 ++-- src/wp-admin/includes/ajax-actions.php | 2 +- .../includes/class-wp-comments-list-table.php | 2 +- src/wp-admin/includes/class-wp-importer.php | 2 +- src/wp-admin/includes/class-wp-list-table.php | 4 ++-- .../includes/class-wp-media-list-table.php | 2 +- .../includes/class-wp-posts-list-table.php | 2 +- src/wp-admin/includes/class-wp-site-health.php | 4 ++-- src/wp-admin/includes/export.php | 2 +- src/wp-admin/includes/file.php | 2 +- src/wp-admin/includes/media.php | 12 ++++++------ src/wp-admin/includes/misc.php | 2 +- src/wp-admin/includes/revision.php | 2 +- src/wp-admin/includes/taxonomy.php | 2 +- src/wp-admin/includes/upgrade.php | 2 +- src/wp-admin/link.php | 2 +- src/wp-admin/menu-header.php | 4 ++-- src/wp-admin/network/themes.php | 2 +- src/wp-admin/plugin-editor.php | 6 +++--- src/wp-admin/plugins.php | 2 +- src/wp-admin/theme-editor.php | 4 ++-- src/wp-admin/upload.php | 2 +- .../twentytwenty/inc/starter-content.php | 2 +- src/wp-includes/bookmark-template.php | 2 +- src/wp-includes/category-template.php | 6 +++--- src/wp-includes/class-walker-nav-menu.php | 4 ++-- src/wp-includes/class-wp-customize-manager.php | 2 +- src/wp-includes/class-wp-query.php | 16 ++++++++-------- .../class-wp-text-diff-renderer-table.php | 2 +- src/wp-includes/class-wp-user-query.php | 2 +- src/wp-includes/comment-template.php | 2 +- src/wp-includes/comment.php | 2 +- src/wp-includes/compat.php | 2 +- src/wp-includes/embed.php | 6 +++--- src/wp-includes/formatting.php | 8 ++++---- src/wp-includes/functions.php | 10 +++++----- src/wp-includes/general-template.php | 4 ++-- src/wp-includes/l10n.php | 2 +- src/wp-includes/media.php | 6 +++--- src/wp-includes/meta.php | 2 +- src/wp-includes/ms-network.php | 2 +- src/wp-includes/ms-site.php | 2 +- src/wp-includes/pluggable.php | 2 +- src/wp-includes/post-template.php | 4 ++-- src/wp-includes/post.php | 4 ++-- src/wp-includes/shortcodes.php | 2 +- src/wp-includes/taxonomy.php | 6 +++--- src/wp-includes/theme.php | 2 +- .../widgets/class-wp-widget-custom-html.php | 2 +- .../widgets/class-wp-widget-media-image.php | 2 +- .../widgets/class-wp-widget-media.php | 4 ++-- tests/phpunit/includes/utils.php | 6 +++--- tests/phpunit/tests/customize/manager.php | 2 +- tests/phpunit/tests/db.php | 2 +- tests/phpunit/tests/formatting/Autop.php | 18 +++++++++--------- tests/phpunit/tests/media.php | 8 ++++---- tests/phpunit/tests/post/bodyClass.php | 4 ++-- tests/phpunit/tests/post/postClass.php | 4 ++-- tests/phpunit/tests/post/template.php | 2 +- .../tests/widgets/media-gallery-widget.php | 2 +- 61 files changed, 115 insertions(+), 115 deletions(-) diff --git a/src/wp-admin/edit-comments.php b/src/wp-admin/edit-comments.php index c2a16eef0b..0dde8df01a 100644 --- a/src/wp-admin/edit-comments.php +++ b/src/wp-admin/edit-comments.php @@ -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 ); diff --git a/src/wp-admin/edit.php b/src/wp-admin/edit.php index bf54037451..40bc41c512 100644 --- a/src/wp-admin/edit.php +++ b/src/wp-admin/edit.php @@ -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 '

' . join( ' ', $messages ) . '

'; + echo '

' . implode( ' ', $messages ) . '

'; } unset( $messages ); diff --git a/src/wp-admin/includes/ajax-actions.php b/src/wp-admin/includes/ajax-actions.php index f359732b15..6ff2d2d9fd 100644 --- a/src/wp-admin/includes/ajax-actions.php +++ b/src/wp-admin/includes/ajax-actions.php @@ -162,7 +162,7 @@ function wp_ajax_ajax_tag_search() { ) ); - echo join( "\n", $results ); + echo implode( "\n", $results ); wp_die(); } diff --git a/src/wp-admin/includes/class-wp-comments-list-table.php b/src/wp-admin/includes/class-wp-comments-list-table.php index 1c7ac384ae..563187ffe4 100644 --- a/src/wp-admin/includes/class-wp-comments-list-table.php +++ b/src/wp-admin/includes/class-wp-comments-list-table.php @@ -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 ); diff --git a/src/wp-admin/includes/class-wp-importer.php b/src/wp-admin/includes/class-wp-importer.php index b60c783c90..d189061d5b 100644 --- a/src/wp-admin/includes/class-wp-importer.php +++ b/src/wp-admin/includes/class-wp-importer.php @@ -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 ) ) { diff --git a/src/wp-admin/includes/class-wp-list-table.php b/src/wp-admin/includes/class-wp-list-table.php index 2ef5f8d1b9..58d1cf9889 100644 --- a/src/wp-admin/includes/class-wp-list-table.php +++ b/src/wp-admin/includes/class-wp-list-table.php @@ -976,7 +976,7 @@ class WP_List_Table { if ( ! empty( $infinite_scroll ) ) { $pagination_links_class .= ' hide-if-js'; } - $output .= "\n" . join( "\n", $page_links ) . ''; + $output .= "\n" . implode( "\n", $page_links ) . ''; 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"; diff --git a/src/wp-admin/includes/class-wp-media-list-table.php b/src/wp-admin/includes/class-wp-media-list-table.php index e5988ed3c9..031f306987 100644 --- a/src/wp-admin/includes/class-wp-media-list-table.php +++ b/src/wp-admin/includes/class-wp-media-list-table.php @@ -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 '' . get_taxonomy( $taxonomy )->labels->no_terms . ''; } diff --git a/src/wp-admin/includes/class-wp-posts-list-table.php b/src/wp-admin/includes/class-wp-posts-list-table.php index 08e2ff58ec..67e7a279d4 100644 --- a/src/wp-admin/includes/class-wp-posts-list-table.php +++ b/src/wp-admin/includes/class-wp-posts-list-table.php @@ -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 '' . $taxonomy_object->labels->no_terms . ''; } diff --git a/src/wp-admin/includes/class-wp-site-health.php b/src/wp-admin/includes/class-wp-site-health.php index 6070a57b9b..aa9d794095 100644 --- a/src/wp-admin/includes/class-wp-site-health.php +++ b/src/wp-admin/includes/class-wp-site-health.php @@ -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' ); diff --git a/src/wp-admin/includes/export.php b/src/wp-admin/includes/export.php index 03b7f4ccfa..74d7c5f823 100644 --- a/src/wp-admin/includes/export.php +++ b/src/wp-admin/includes/export.php @@ -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. diff --git a/src/wp-admin/includes/file.php b/src/wp-admin/includes/file.php index 88ac0cae2f..cfb40529a6 100644 --- a/src/wp-admin/includes/file.php +++ b/src/wp-admin/includes/file.php @@ -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' ); } diff --git a/src/wp-admin/includes/media.php b/src/wp-admin/includes/media.php index b23900961a..e2f21426dd 100644 --- a/src/wp-admin/includes/media.php +++ b/src/wp-admin/includes/media.php @@ -1118,7 +1118,7 @@ function image_align_input_fields( $post, $checked = '' ) { " />"; } - 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 .= "

" . join( "

\n

", array_unique( (array) $field['helps'] ) ) . '

'; + $item .= "

" . implode( "

\n

", array_unique( (array) $field['helps'] ) ) . '

'; } $item .= "\n\t\t\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 .= "

" . join( "

\n

", array_unique( (array) $field['helps'] ) ) . '

'; + $item .= "

" . implode( "

\n

", array_unique( (array) $field['helps'] ) ) . '

'; } $item .= "\n\t\t\n"; diff --git a/src/wp-admin/includes/misc.php b/src/wp-admin/includes/misc.php index 74ac6cec27..e13a46bc91 100644 --- a/src/wp-admin/includes/misc.php +++ b/src/wp-admin/includes/misc.php @@ -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; } diff --git a/src/wp-admin/includes/revision.php b/src/wp-admin/includes/revision.php index 52600dce06..7718a831e4 100644 --- a/src/wp-admin/includes/revision.php +++ b/src/wp-admin/includes/revision.php @@ -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 ), diff --git a/src/wp-admin/includes/taxonomy.php b/src/wp-admin/includes/taxonomy.php index 7f7e60952c..de76917cd0 100644 --- a/src/wp-admin/includes/taxonomy.php +++ b/src/wp-admin/includes/taxonomy.php @@ -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. diff --git a/src/wp-admin/includes/upgrade.php b/src/wp-admin/includes/upgrade.php index 0a65659492..f68ee0b9ff 100644 --- a/src/wp-admin/includes/upgrade.php +++ b/src/wp-admin/includes/upgrade.php @@ -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)" ); } } diff --git a/src/wp-admin/link.php b/src/wp-admin/link.php index 1824f80144..5494f9f15f 100644 --- a/src/wp-admin/link.php +++ b/src/wp-admin/link.php @@ -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)"); diff --git a/src/wp-admin/menu-header.php b/src/wp-admin/menu-header.php index 3e81e0bea7..1f481f8634 100644 --- a/src/wp-admin/menu-header.php +++ b/src/wp-admin/menu-header.php @@ -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]; diff --git a/src/wp-admin/network/themes.php b/src/wp-admin/network/themes.php index 730ab906b1..84fbdf3106 100644 --- a/src/wp-admin/network/themes.php +++ b/src/wp-admin/network/themes.php @@ -89,7 +89,7 @@ if ( $action ) { echo '
'; echo '

' . esc_html( $title ) . '

'; - $url = self_admin_url( 'update.php?action=update-selected-themes&themes=' . urlencode( join( ',', $themes ) ) ); + $url = self_admin_url( 'update.php?action=update-selected-themes&themes=' . urlencode( implode( ',', $themes ) ) ); $url = wp_nonce_url( $url, 'bulk-update-themes' ); echo ""; diff --git a/src/wp-admin/plugin-editor.php b/src/wp-admin/plugin-editor.php index 50d5acee4f..7467ace6aa 100644 --- a/src/wp-admin/plugin-editor.php +++ b/src/wp-admin/plugin-editor.php @@ -195,7 +195,7 @@ $content = esc_textarea( $content );

' . esc_html( $file ) . '' ); } else { @@ -203,7 +203,7 @@ $content = esc_textarea( $content ); printf( __( 'Browsing %s (active)' ), '' . esc_html( $file ) . '' ); } } else { - if ( is_writeable( $real_file ) ) { + if ( is_writable( $real_file ) ) { /* translators: %s: Plugin file name. */ printf( __( 'Editing %s (inactive)' ), '' . esc_html( $file ) . '' ); } else { @@ -275,7 +275,7 @@ $content = esc_textarea( $content );

- +
diff --git a/src/wp-admin/plugins.php b/src/wp-admin/plugins.php index fe8ea41fb2..96d0b2cba9 100644 --- a/src/wp-admin/plugins.php +++ b/src/wp-admin/plugins.php @@ -162,7 +162,7 @@ if ( $action ) { echo '
'; echo '

' . esc_html( $title ) . '

'; - $url = self_admin_url( 'update.php?action=update-selected&plugins=' . urlencode( join( ',', $plugins ) ) ); + $url = self_admin_url( 'update.php?action=update-selected&plugins=' . urlencode( implode( ',', $plugins ) ) ); $url = wp_nonce_url( $url, 'bulk-update-plugins' ); echo ""; diff --git a/src/wp-admin/theme-editor.php b/src/wp-admin/theme-editor.php index 61e15e4bcd..3cf24cc77e 100644 --- a/src/wp-admin/theme-editor.php +++ b/src/wp-admin/theme-editor.php @@ -301,7 +301,7 @@ else : get_stylesheet() === get_template() ) : ?>

- + @@ -309,7 +309,7 @@ else :

- +

diff --git a/src/wp-admin/upload.php b/src/wp-admin/upload.php index 3917ece191..2eb29da17d 100644 --- a/src/wp-admin/upload.php +++ b/src/wp-admin/upload.php @@ -162,7 +162,7 @@ if ( $doaction ) { $location = add_query_arg( array( 'trashed' => count( $post_ids ), - 'ids' => join( ',', $post_ids ), + 'ids' => implode( ',', $post_ids ), ), $location ); diff --git a/src/wp-content/themes/twentytwenty/inc/starter-content.php b/src/wp-content/themes/twentytwenty/inc/starter-content.php index 95f7bc57aa..89be38bbe8 100644 --- a/src/wp-content/themes/twentytwenty/inc/starter-content.php +++ b/src/wp-content/themes/twentytwenty/inc/starter-content.php @@ -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( '', diff --git a/src/wp-includes/bookmark-template.php b/src/wp-includes/bookmark-template.php index 2db315b034..0a3840502a 100644 --- a/src/wp-includes/bookmark-template.php +++ b/src/wp-includes/bookmark-template.php @@ -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( diff --git a/src/wp-includes/category-template.php b/src/wp-includes/category-template.php index df4ee350a9..e2f0cb0115 100644 --- a/src/wp-includes/category-template.php +++ b/src/wp-includes/category-template.php @@ -1010,11 +1010,11 @@ function wp_generate_tag_cloud( $tags, $args = '' ) { * Note: this is redundant but doesn't harm. */ $return = "

    \n\t
  • "; - $return .= join( "
  • \n\t
  • ", $a ); + $return .= implode( "
  • \n\t
  • ", $a ); $return .= "
  • \n
\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; } /** diff --git a/src/wp-includes/class-walker-nav-menu.php b/src/wp-includes/class-walker-nav-menu.php index 5f4a53691c..66ba424da4 100644 --- a/src/wp-includes/class-walker-nav-menu.php +++ b/src/wp-includes/class-walker-nav-menu.php @@ -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}{$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 ) . '"' : ''; /** diff --git a/src/wp-includes/class-wp-customize-manager.php b/src/wp-includes/class-wp-customize-manager.php index 88a8128acd..a46b97fa5a 100644 --- a/src/wp-includes/class-wp-customize-manager.php +++ b/src/wp-includes/class-wp-customize-manager.php @@ -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 ), ); } diff --git a/src/wp-includes/class-wp-query.php b/src/wp-includes/class-wp-query.php index 34d0a5de96..98f5c3c25b 100644 --- a/src/wp-includes/class-wp-query.php +++ b/src/wp-includes/class-wp-query.php @@ -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) "; diff --git a/src/wp-includes/class-wp-text-diff-renderer-table.php b/src/wp-includes/class-wp-text-diff-renderer-table.php index 4bc02d3750..c55add4885 100644 --- a/src/wp-includes/class-wp-text-diff-renderer-table.php +++ b/src/wp-includes/class-wp-text-diff-renderer-table.php @@ -274,7 +274,7 @@ class WP_Text_Diff_Renderer_Table extends Text_Diff_Renderer { // If they're too different, don't include any or 's. if ( preg_match_all( '!(.*?|.*?)!', $diff, $diff_matches ) ) { // Length of all text between or . - $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 or (instead of picking just one), // we double the length of chars not in those tags. $stripped_diff = strlen( strip_tags( $diff ) ) * 2 - $stripped_matches; diff --git a/src/wp-includes/class-wp-user-query.php b/src/wp-includes/class-wp-user-query.php index d33f6fb624..967c6b6b05 100644 --- a/src/wp-includes/class-wp-user-query.php +++ b/src/wp-includes/class-wp-user-query.php @@ -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 diff --git a/src/wp-includes/comment-template.php b/src/wp-includes/comment-template.php index 89be475034..e3cfdef312 100644 --- a/src/wp-includes/comment-template.php +++ b/src/wp-includes/comment-template.php @@ -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; diff --git a/src/wp-includes/comment.php b/src/wp-includes/comment.php index cde13af806..71471eed12 100644 --- a/src/wp-includes/comment.php +++ b/src/wp-includes/comment.php @@ -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 ); } diff --git a/src/wp-includes/compat.php b/src/wp-includes/compat.php index e322dd26de..7f6c59f03c 100644 --- a/src/wp-includes/compat.php +++ b/src/wp-includes/compat.php @@ -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' ) ) : diff --git a/src/wp-includes/embed.php b/src/wp-includes/embed.php index 449c08bf5d..a9704b7872 100644 --- a/src/wp-includes/embed.php +++ b/src/wp-includes/embed.php @@ -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 ); } /** @@ -841,7 +841,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], '