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.

git-svn-id: https://develop.svn.wordpress.org/trunk@56552 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Sergey Biryukov
2023-09-11 04:51:09 +00:00
parent 858bd4b25f
commit aeba9d183d
5 changed files with 6 additions and 6 deletions
+1 -1
View File
@@ -156,7 +156,7 @@ function get_page_templates( $post = null, $post_type = 'page' ) {
* @return string
*/
function _get_template_edit_filename( $fullpath, $containingfolder ) {
return str_replace( dirname( dirname( $containingfolder ) ), '', $fullpath );
return str_replace( dirname( $containingfolder, 2 ), '', $fullpath );
}
/**
+1 -1
View File
@@ -7,7 +7,7 @@
*/
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' );
?>