Code Modernization: Use str_ends_with() in a few more places.
`str_ends_with()` was introduced in PHP 8.0 to perform a case-sensitive check indicating if the string to search in (haystack) ends with the given substring (needle). WordPress core includes a polyfill for `str_ends_with()` on PHP < 8.0 as of WordPress 5.9. Follow-up to [55990]. See #58220. Built from https://develop.svn.wordpress.org/trunk@56014 git-svn-id: http://core.svn.wordpress.org/trunk@55526 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
@@ -162,7 +162,7 @@ if ( ! empty( $posted_content ) ) {
|
||||
$content = file_get_contents( $real_file );
|
||||
}
|
||||
|
||||
if ( '.php' === substr( $real_file, strrpos( $real_file, '.' ) ) ) {
|
||||
if ( str_ends_with( $real_file, '.php' ) ) {
|
||||
$functions = wp_doc_link_parse( $content );
|
||||
|
||||
if ( ! empty( $functions ) ) {
|
||||
|
||||
@@ -161,7 +161,7 @@ if ( ! empty( $posted_content ) ) {
|
||||
$f = fopen( $file, 'r' );
|
||||
$content = fread( $f, filesize( $file ) );
|
||||
|
||||
if ( '.php' === substr( $file, strrpos( $file, '.' ) ) ) {
|
||||
if ( str_ends_with( $file, '.php' ) ) {
|
||||
$functions = wp_doc_link_parse( $content );
|
||||
|
||||
if ( ! empty( $functions ) ) {
|
||||
|
||||
Reference in New Issue
Block a user