Code Modernization: Use `dirname()` with the `$levels` parameter.

PHP 7.0 introduced the `$levels` parameter to the `dirname()` function, which means nested calls to `dirname()` are no longer needed.

Note: This is enforced by WPCS 3.0.0.

Reference: [https://www.php.net/manual/en/function.dirname.php PHP Manual: dirname()].

Follow-up to [56141].

Props jrf.
See #59161, #58831.
Built from https://develop.svn.wordpress.org/trunk@56552


git-svn-id: http://core.svn.wordpress.org/trunk@56064 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov 2023-09-11 04:53:22 +00:00
parent d399e57a1f
commit c41829ea95
3 changed files with 3 additions and 3 deletions

View File

@ -156,7 +156,7 @@ function get_page_templates( $post = null, $post_type = 'page' ) {
* @return string * @return string
*/ */
function _get_template_edit_filename( $fullpath, $containingfolder ) { function _get_template_edit_filename( $fullpath, $containingfolder ) {
return str_replace( dirname( dirname( $containingfolder ) ), '', $fullpath ); return str_replace( dirname( $containingfolder, 2 ), '', $fullpath );
} }
/** /**

View File

@ -7,7 +7,7 @@
*/ */
define( 'WP_REPAIRING', true ); define( 'WP_REPAIRING', true );
require_once dirname( dirname( __DIR__ ) ) . '/wp-load.php'; require_once dirname( __DIR__, 2 ) . '/wp-load.php';
header( 'Content-Type: text/html; charset=utf-8' ); header( 'Content-Type: text/html; charset=utf-8' );
?> ?>

View File

@ -16,7 +16,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '6.4-alpha-56551'; $wp_version = '6.4-alpha-56552';
/** /**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.