mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-04-06 05:34:26 +00:00
Coding Standards: Use strict type check for in_array() and array_search() where strings are involved.
This reduces the number of `WordPress.PHP.StrictInArray.MissingTrueStrict` issues from 486 to 50. Includes minor code layout fixes for better readability. See #49542. git-svn-id: https://develop.svn.wordpress.org/trunk@47550 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -112,7 +112,7 @@ if ( ! is_file( $real_file ) ) {
|
||||
if ( preg_match( '/\.([^.]+)$/', $real_file, $matches ) ) {
|
||||
$ext = strtolower( $matches[1] );
|
||||
// If extension is not in the acceptable list, skip it.
|
||||
if ( ! in_array( $ext, $editable_extensions ) ) {
|
||||
if ( ! in_array( $ext, $editable_extensions, true ) ) {
|
||||
wp_die( sprintf( '<p>%s</p>', __( 'Files of this type are not editable.' ) ) );
|
||||
}
|
||||
}
|
||||
@@ -244,7 +244,7 @@ $content = esc_textarea( $content );
|
||||
<?php
|
||||
$plugin_editable_files = array();
|
||||
foreach ( $plugin_files as $plugin_file ) {
|
||||
if ( preg_match( '/\.([^.]+)$/', $plugin_file, $matches ) && in_array( $matches[1], $editable_extensions ) ) {
|
||||
if ( preg_match( '/\.([^.]+)$/', $plugin_file, $matches ) && in_array( $matches[1], $editable_extensions, true ) ) {
|
||||
$plugin_editable_files[] = $plugin_file;
|
||||
}
|
||||
}
|
||||
@@ -277,7 +277,7 @@ $content = esc_textarea( $content );
|
||||
|
||||
<?php if ( is_writeable( $real_file ) ) : ?>
|
||||
<div class="editor-notices">
|
||||
<?php if ( in_array( $plugin, (array) get_option( 'active_plugins', array() ) ) ) { ?>
|
||||
<?php if ( in_array( $plugin, (array) get_option( 'active_plugins', array() ), true ) ) { ?>
|
||||
<div class="notice notice-warning inline active-plugin-edit-warning">
|
||||
<p><?php _e( '<strong>Warning:</strong> Making changes to active plugins is not recommended.' ); ?></p>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user