Skip to content

Commit 97b2f07

Browse files
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
1 parent f124a65 commit 97b2f07

61 files changed

Lines changed: 115 additions & 115 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

src/wp-admin/edit-comments.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@
120120
$redirect_to = add_query_arg( 'deleted', $deleted, $redirect_to );
121121
}
122122
if ( $trashed || $spammed ) {
123-
$redirect_to = add_query_arg( 'ids', join( ',', $comment_ids ), $redirect_to );
123+
$redirect_to = add_query_arg( 'ids', implode( ',', $comment_ids ), $redirect_to );
124124
}
125125

126126
wp_safe_redirect( $redirect_to );

src/wp-admin/edit.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@
126126
$sendback = add_query_arg(
127127
array(
128128
'trashed' => $trashed,
129-
'ids' => join( ',', $post_ids ),
129+
'ids' => implode( ',', $post_ids ),
130130
'locked' => $locked,
131131
),
132132
$sendback
@@ -442,7 +442,7 @@
442442
}
443443

444444
if ( $messages ) {
445-
echo '<div id="message" class="updated notice is-dismissible"><p>' . join( ' ', $messages ) . '</p></div>';
445+
echo '<div id="message" class="updated notice is-dismissible"><p>' . implode( ' ', $messages ) . '</p></div>';
446446
}
447447
unset( $messages );
448448

src/wp-admin/includes/ajax-actions.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ function wp_ajax_ajax_tag_search() {
162162
)
163163
);
164164

165-
echo join( "\n", $results );
165+
echo implode( "\n", $results );
166166
wp_die();
167167
}
168168

src/wp-admin/includes/class-wp-comments-list-table.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -615,7 +615,7 @@ public function single_row( $item ) {
615615
if ( ! $the_comment_class ) {
616616
$the_comment_class = '';
617617
}
618-
$the_comment_class = join( ' ', get_comment_class( $the_comment_class, $comment, $comment->comment_post_ID ) );
618+
$the_comment_class = implode( ' ', get_comment_class( $the_comment_class, $comment, $comment->comment_post_ID ) );
619619

620620
if ( $comment->comment_post_ID > 0 ) {
621621
$post = get_post( $comment->comment_post_ID );

src/wp-admin/includes/class-wp-importer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,7 @@ function get_cli_args( $param, $required = false ) {
291291
$last_arg = null;
292292
$return = null;
293293

294-
$il = sizeof( $args );
294+
$il = count( $args );
295295

296296
for ( $i = 1, $il; $i < $il; $i++ ) {
297297
if ( (bool) preg_match( '/^--(.+)/', $args[ $i ], $match ) ) {

src/wp-admin/includes/class-wp-list-table.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -976,7 +976,7 @@ protected function pagination( $which ) {
976976
if ( ! empty( $infinite_scroll ) ) {
977977
$pagination_links_class .= ' hide-if-js';
978978
}
979-
$output .= "\n<span class='$pagination_links_class'>" . join( "\n", $page_links ) . '</span>';
979+
$output .= "\n<span class='$pagination_links_class'>" . implode( "\n", $page_links ) . '</span>';
980980

981981
if ( $total_pages ) {
982982
$page_class = $total_pages < 2 ? ' one-page' : '';
@@ -1242,7 +1242,7 @@ public function print_column_headers( $with_id = true ) {
12421242
$id = $with_id ? "id='$column_key'" : '';
12431243

12441244
if ( ! empty( $class ) ) {
1245-
$class = "class='" . join( ' ', $class ) . "'";
1245+
$class = "class='" . implode( ' ', $class ) . "'";
12461246
}
12471247

12481248
echo "<$tag $scope $id $class>$column_display_name</$tag>";

src/wp-admin/includes/class-wp-media-list-table.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -614,7 +614,7 @@ public function column_default( $post, $column_name ) {
614614
);
615615
}
616616
/* translators: Used between list items, there is a space after the comma. */
617-
echo join( __( ', ' ), $out );
617+
echo implode( __( ', ' ), $out );
618618
} else {
619619
echo '<span aria-hidden="true">&#8212;</span><span class="screen-reader-text">' . get_taxonomy( $taxonomy )->labels->no_terms . '</span>';
620620
}

src/wp-admin/includes/class-wp-posts-list-table.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1219,7 +1219,7 @@ public function column_default( $post, $column_name ) {
12191219
$term_links = apply_filters( 'post_column_taxonomy_links', $term_links, $taxonomy, $terms );
12201220

12211221
/* translators: Used between list items, there is a space after the comma. */
1222-
echo join( __( ', ' ), $term_links );
1222+
echo implode( __( ', ' ), $term_links );
12231223
} else {
12241224
echo '<span aria-hidden="true">&#8212;</span><span class="screen-reader-text">' . $taxonomy_object->labels->no_terms . '</span>';
12251225
}

src/wp-admin/includes/class-wp-site-health.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1855,7 +1855,7 @@ public function get_test_http_requests() {
18551855
$hosts = explode( ',', WP_ACCESSIBLE_HOSTS );
18561856
}
18571857

1858-
if ( $blocked && 0 === sizeof( $hosts ) ) {
1858+
if ( $blocked && 0 === count( $hosts ) ) {
18591859
$result['status'] = 'critical';
18601860

18611861
$result['label'] = __( 'HTTP requests are blocked' );
@@ -1870,7 +1870,7 @@ public function get_test_http_requests() {
18701870
);
18711871
}
18721872

1873-
if ( $blocked && 0 < sizeof( $hosts ) ) {
1873+
if ( $blocked && 0 < count( $hosts ) ) {
18741874
$result['status'] = 'recommended';
18751875

18761876
$result['label'] = __( 'HTTP requests are partially blocked' );

src/wp-admin/includes/export.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -534,7 +534,7 @@ function wxr_filter_postmeta( $return_me, $meta_key ) {
534534

535535
// Fetch 20 posts at a time rather than loading the entire table into memory.
536536
while ( $next_posts = array_splice( $post_ids, 0, 20 ) ) {
537-
$where = 'WHERE ID IN (' . join( ',', $next_posts ) . ')';
537+
$where = 'WHERE ID IN (' . implode( ',', $next_posts ) . ')';
538538
$posts = $wpdb->get_results( "SELECT * FROM {$wpdb->posts} $where" );
539539

540540
// Begin Loop.

0 commit comments

Comments
 (0)