rebase on oct-10-2023

This commit is contained in:
Rachit Bhargava
2023-10-10 17:23:21 -04:00
parent d37566ffb6
commit d096058d7d
4789 changed files with 254611 additions and 307223 deletions

View File

@@ -102,7 +102,7 @@ function get_plugin_data( $plugin_file, $markup = true, $translate = true ) {
// If no text domain is defined fall back to the plugin slug.
if ( ! $plugin_data['TextDomain'] ) {
$plugin_slug = dirname( plugin_basename( $plugin_file ) );
if ( '.' !== $plugin_slug && false === strpos( $plugin_slug, '/' ) ) {
if ( '.' !== $plugin_slug && ! str_contains( $plugin_slug, '/' ) ) {
$plugin_data['TextDomain'] = $plugin_slug;
}
}
@@ -178,8 +178,10 @@ function _get_plugin_data_markup_translate( $plugin_file, $plugin_data, $markup
'title' => true,
);
// Name is marked up inside <a> tags. Don't allow these.
// Author is too, but some plugins have used <a> here (omitting Author URI).
/*
* Name is marked up inside <a> tags. Don't allow these.
* Author is too, but some plugins have used <a> here (omitting Author URI).
*/
$plugin_data['Name'] = wp_kses( $plugin_data['Name'], $allowed_tags_in_links );
$plugin_data['Author'] = wp_kses( $plugin_data['Author'], $allowed_tags );
@@ -294,7 +296,7 @@ function get_plugins( $plugin_folder = '' ) {
if ( $plugins_dir ) {
while ( ( $file = readdir( $plugins_dir ) ) !== false ) {
if ( '.' === substr( $file, 0, 1 ) ) {
if ( str_starts_with( $file, '.' ) ) {
continue;
}
@@ -303,11 +305,11 @@ function get_plugins( $plugin_folder = '' ) {
if ( $plugins_subdir ) {
while ( ( $subfile = readdir( $plugins_subdir ) ) !== false ) {
if ( '.' === substr( $subfile, 0, 1 ) ) {
if ( str_starts_with( $subfile, '.' ) ) {
continue;
}
if ( '.php' === substr( $subfile, -4 ) ) {
if ( str_ends_with( $subfile, '.php' ) ) {
$plugin_files[] = "$file/$subfile";
}
}
@@ -315,7 +317,7 @@ function get_plugins( $plugin_folder = '' ) {
closedir( $plugins_subdir );
}
} else {
if ( '.php' === substr( $file, -4 ) ) {
if ( str_ends_with( $file, '.php' ) ) {
$plugin_files[] = $file;
}
}
@@ -371,7 +373,7 @@ function get_mu_plugins() {
$plugins_dir = @opendir( WPMU_PLUGIN_DIR );
if ( $plugins_dir ) {
while ( ( $file = readdir( $plugins_dir ) ) !== false ) {
if ( '.php' === substr( $file, -4 ) ) {
if ( str_ends_with( $file, '.php' ) ) {
$plugin_files[] = $file;
}
}
@@ -969,8 +971,10 @@ function delete_plugins( $plugins, $deprecated = '' ) {
$this_plugin_dir = trailingslashit( dirname( $plugins_dir . $plugin_file ) );
// If plugin is in its own directory, recursively delete the directory.
// Base check on if plugin includes directory separator AND that it's not the root plugin folder.
/*
* If plugin is in its own directory, recursively delete the directory.
* Base check on if plugin includes directory separator AND that it's not the root plugin folder.
*/
if ( strpos( $plugin_file, '/' ) && $this_plugin_dir !== $plugins_dir ) {
$deleted = $wp_filesystem->delete( $this_plugin_dir, true );
} else {
@@ -1935,7 +1939,7 @@ function get_admin_page_parent( $parent_page = '' ) {
$parent_file = $parent_page;
return $parent_page;
} elseif ( empty( $typenow ) && $pagenow === $submenu_array[2]
&& ( empty( $parent_file ) || false === strpos( $parent_file, '?' ) )
&& ( empty( $parent_file ) || ! str_contains( $parent_file, '?' ) )
) {
$parent_file = $parent_page;
return $parent_page;