Skip to content

Commit 7fd6eb0

Browse files
Coding Standards: Use more meaningful variable names in Plugin Editor.
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 [10879], [41721]. Props costdev, mukesh27. See #63168. git-svn-id: https://develop.svn.wordpress.org/trunk@60928 602fd350-edb4-49c9-b593-d223f7449a82
1 parent 9a74d70 commit 7fd6eb0

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

src/wp-admin/plugin-editor.php

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -93,9 +93,11 @@
9393
$posted_content = null;
9494

9595
if ( 'POST' === $_SERVER['REQUEST_METHOD'] ) {
96-
$r = wp_edit_theme_plugin_file( wp_unslash( $_POST ) );
97-
if ( is_wp_error( $r ) ) {
98-
$edit_error = $r;
96+
$edit_result = wp_edit_theme_plugin_file( wp_unslash( $_POST ) );
97+
98+
if ( is_wp_error( $edit_result ) ) {
99+
$edit_error = $edit_result;
100+
99101
if ( check_ajax_referer( 'edit-plugin_' . $file, 'nonce', false ) && isset( $_POST['newcontent'] ) ) {
100102
$posted_content = wp_unslash( $_POST['newcontent'] );
101103
}
@@ -122,9 +124,10 @@
122124
} else {
123125
// Get the extension of the file.
124126
if ( preg_match( '/\.([^.]+)$/', $real_file, $matches ) ) {
125-
$ext = strtolower( $matches[1] );
127+
$extension = strtolower( $matches[1] );
128+
126129
// If extension is not in the acceptable list, skip it.
127-
if ( ! in_array( $ext, $editable_extensions, true ) ) {
130+
if ( ! in_array( $extension, $editable_extensions, true ) ) {
128131
wp_die( sprintf( '<p>%s</p>', __( 'Files of this type are not editable.' ) ) );
129132
}
130133
}

0 commit comments

Comments
 (0)