Skip to content

Commit f96fa7d

Browse files
Coding Standards: Rename $s to $search_term in wp-admin/plugins.php.
Per the [https://developer.wordpress.org/coding-standards/wordpress-coding-standards/php/#naming-conventions Naming Conventions]: > Don’t abbreviate variable names unnecessarily; let the code be unambiguous and self-documenting. Follow-up to [15697]. Props costdev, mukesh27. See #63168. git-svn-id: https://develop.svn.wordpress.org/trunk@60924 602fd350-edb4-49c9-b593-d223f7449a82
1 parent e1008a3 commit f96fa7d

File tree

1 file changed

+21
-21
lines changed

1 file changed

+21
-21
lines changed

src/wp-admin/plugins.php

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@
1818

1919
$action = $wp_list_table->current_action();
2020

21-
$plugin = isset( $_REQUEST['plugin'] ) ? wp_unslash( $_REQUEST['plugin'] ) : '';
22-
$s = isset( $_REQUEST['s'] ) ? urlencode( wp_unslash( $_REQUEST['s'] ) ) : '';
21+
$plugin = isset( $_REQUEST['plugin'] ) ? wp_unslash( $_REQUEST['plugin'] ) : '';
22+
$search_term = isset( $_REQUEST['s'] ) ? urlencode( wp_unslash( $_REQUEST['s'] ) ) : '';
2323

2424
// Clean up request URI from temporary args for screen options/paging uri's to work as expected.
2525
$query_args_to_remove = array(
@@ -51,7 +51,7 @@
5151
}
5252

5353
if ( is_multisite() && ! is_network_admin() && is_network_only_plugin( $plugin ) ) {
54-
wp_redirect( self_admin_url( "plugins.php?plugin_status=$status&paged=$page&s=$s" ) );
54+
wp_redirect( self_admin_url( "plugins.php?plugin_status=$status&paged=$page&s=$search_term" ) );
5555
exit;
5656
}
5757

@@ -60,7 +60,7 @@
6060
$result = activate_plugin( $plugin, self_admin_url( 'plugins.php?error=true&plugin=' . urlencode( $plugin ) ), is_network_admin() );
6161
if ( is_wp_error( $result ) ) {
6262
if ( 'unexpected_output' === $result->get_error_code() ) {
63-
$redirect = self_admin_url( 'plugins.php?error=true&charsout=' . strlen( $result->get_error_data() ) . '&plugin=' . urlencode( $plugin ) . "&plugin_status=$status&paged=$page&s=$s" );
63+
$redirect = self_admin_url( 'plugins.php?error=true&charsout=' . strlen( $result->get_error_data() ) . '&plugin=' . urlencode( $plugin ) . "&plugin_status=$status&paged=$page&s=$search_term" );
6464
wp_redirect( add_query_arg( '_error_nonce', wp_create_nonce( 'plugin-activation-error_' . $plugin ), $redirect ) );
6565
exit;
6666
} else {
@@ -85,7 +85,7 @@
8585
wp_redirect( self_admin_url( 'press-this.php' ) );
8686
} else {
8787
// Overrides the ?error=true one above.
88-
wp_redirect( self_admin_url( "plugins.php?activate=true&plugin_status=$status&paged=$page&s=$s" ) );
88+
wp_redirect( self_admin_url( "plugins.php?activate=true&plugin_status=$status&paged=$page&s=$search_term" ) );
8989
}
9090
exit;
9191

@@ -119,7 +119,7 @@
119119
}
120120

121121
if ( empty( $plugins ) ) {
122-
wp_redirect( self_admin_url( "plugins.php?plugin_status=$status&paged=$page&s=$s" ) );
122+
wp_redirect( self_admin_url( "plugins.php?plugin_status=$status&paged=$page&s=$search_term" ) );
123123
exit;
124124
}
125125

@@ -141,7 +141,7 @@
141141
update_site_option( 'recently_activated', $recent );
142142
}
143143

144-
wp_redirect( self_admin_url( "plugins.php?activate-multi=true&plugin_status=$status&paged=$page&s=$s" ) );
144+
wp_redirect( self_admin_url( "plugins.php?activate-multi=true&plugin_status=$status&paged=$page&s=$search_term" ) );
145145
exit;
146146

147147
case 'update-selected':
@@ -204,7 +204,7 @@
204204
check_admin_referer( 'deactivate-plugin_' . $plugin );
205205

206206
if ( ! is_network_admin() && is_plugin_active_for_network( $plugin ) ) {
207-
wp_redirect( self_admin_url( "plugins.php?plugin_status=$status&paged=$page&s=$s" ) );
207+
wp_redirect( self_admin_url( "plugins.php?plugin_status=$status&paged=$page&s=$search_term" ) );
208208
exit;
209209
}
210210

@@ -217,9 +217,9 @@
217217
}
218218

219219
if ( headers_sent() ) {
220-
echo "<meta http-equiv='refresh' content='" . esc_attr( "0;url=plugins.php?deactivate=true&plugin_status=$status&paged=$page&s=$s" ) . "' />";
220+
echo "<meta http-equiv='refresh' content='" . esc_attr( "0;url=plugins.php?deactivate=true&plugin_status=$status&paged=$page&s=$search_term" ) . "' />";
221221
} else {
222-
wp_redirect( self_admin_url( "plugins.php?deactivate=true&plugin_status=$status&paged=$page&s=$s" ) );
222+
wp_redirect( self_admin_url( "plugins.php?deactivate=true&plugin_status=$status&paged=$page&s=$search_term" ) );
223223
}
224224
exit;
225225

@@ -246,7 +246,7 @@
246246
}
247247
}
248248
if ( empty( $plugins ) ) {
249-
wp_redirect( self_admin_url( "plugins.php?plugin_status=$status&paged=$page&s=$s" ) );
249+
wp_redirect( self_admin_url( "plugins.php?plugin_status=$status&paged=$page&s=$search_term" ) );
250250
exit;
251251
}
252252

@@ -263,7 +263,7 @@
263263
update_site_option( 'recently_activated', $deactivated + (array) get_site_option( 'recently_activated' ) );
264264
}
265265

266-
wp_redirect( self_admin_url( "plugins.php?deactivate-multi=true&plugin_status=$status&paged=$page&s=$s" ) );
266+
wp_redirect( self_admin_url( "plugins.php?deactivate-multi=true&plugin_status=$status&paged=$page&s=$search_term" ) );
267267
exit;
268268

269269
case 'delete-selected':
@@ -276,21 +276,21 @@
276276
// $_POST = from the plugin form; $_GET = from the FTP details screen.
277277
$plugins = isset( $_REQUEST['checked'] ) ? (array) wp_unslash( $_REQUEST['checked'] ) : array();
278278
if ( empty( $plugins ) ) {
279-
wp_redirect( self_admin_url( "plugins.php?plugin_status=$status&paged=$page&s=$s" ) );
279+
wp_redirect( self_admin_url( "plugins.php?plugin_status=$status&paged=$page&s=$search_term" ) );
280280
exit;
281281
}
282282

283283
$plugins = array_filter( $plugins, 'is_plugin_inactive' ); // Do not allow to delete activated plugins.
284284
if ( empty( $plugins ) ) {
285-
wp_redirect( self_admin_url( "plugins.php?error=true&main=true&plugin_status=$status&paged=$page&s=$s" ) );
285+
wp_redirect( self_admin_url( "plugins.php?error=true&main=true&plugin_status=$status&paged=$page&s=$search_term" ) );
286286
exit;
287287
}
288288

289289
// Bail on all if any paths are invalid.
290290
// validate_file() returns truthy for invalid files.
291291
$invalid_plugin_files = array_filter( $plugins, 'validate_file' );
292292
if ( $invalid_plugin_files ) {
293-
wp_redirect( self_admin_url( "plugins.php?plugin_status=$status&paged=$page&s=$s" ) );
293+
wp_redirect( self_admin_url( "plugins.php?plugin_status=$status&paged=$page&s=$search_term" ) );
294294
exit;
295295
}
296296

@@ -432,7 +432,7 @@
432432
// Store the result in an option rather than a URL param due to object type & length.
433433
// Cannot use transient/cache, as that could get flushed if any plugin flushes data on uninstall/delete.
434434
update_option( 'plugins_delete_result_' . $user_ID, $delete_result, false );
435-
wp_redirect( self_admin_url( "plugins.php?deleted=$plugins_to_delete&plugin_status=$status&paged=$page&s=$s" ) );
435+
wp_redirect( self_admin_url( "plugins.php?deleted=$plugins_to_delete&plugin_status=$status&paged=$page&s=$search_term" ) );
436436
exit;
437437
case 'clear-recent-list':
438438
if ( ! is_network_admin() ) {
@@ -453,13 +453,13 @@
453453

454454
check_admin_referer( 'resume-plugin_' . $plugin );
455455

456-
$result = resume_plugin( $plugin, self_admin_url( "plugins.php?error=resuming&plugin_status=$status&paged=$page&s=$s" ) );
456+
$result = resume_plugin( $plugin, self_admin_url( "plugins.php?error=resuming&plugin_status=$status&paged=$page&s=$search_term" ) );
457457

458458
if ( is_wp_error( $result ) ) {
459459
wp_die( $result );
460460
}
461461

462-
wp_redirect( self_admin_url( "plugins.php?resume=true&plugin_status=$status&paged=$page&s=$s" ) );
462+
wp_redirect( self_admin_url( "plugins.php?resume=true&plugin_status=$status&paged=$page&s=$search_term" ) );
463463
exit;
464464
case 'enable-auto-update':
465465
case 'disable-auto-update':
@@ -473,7 +473,7 @@
473473
wp_die( __( 'Please connect to your network admin to manage plugins automatic updates.' ) );
474474
}
475475

476-
$redirect = self_admin_url( "plugins.php?plugin_status={$status}&paged={$page}&s={$s}" );
476+
$redirect = self_admin_url( "plugins.php?plugin_status={$status}&paged={$page}&s={$search_term}" );
477477

478478
if ( 'enable-auto-update' === $action || 'disable-auto-update' === $action ) {
479479
if ( empty( $plugin ) ) {
@@ -771,12 +771,12 @@
771771
<?php
772772
}
773773

774-
if ( strlen( $s ) ) {
774+
if ( strlen( $search_term ) ) {
775775
echo '<span class="subtitle">';
776776
printf(
777777
/* translators: %s: Search query. */
778778
__( 'Search results for: %s' ),
779-
'<strong>' . esc_html( urldecode( $s ) ) . '</strong>'
779+
'<strong>' . esc_html( urldecode( $search_term ) ) . '</strong>'
780780
);
781781
echo '</span>';
782782
}

0 commit comments

Comments
 (0)