Make WordPress Core


Ignore:
Timestamp:
06/24/2023 09:50:34 AM (12 months ago)
Author:
SergeyBiryukov
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/class-wp-rewrite.php

    r55988 r56014  
    19081908        unset( $this->comment_feed_structure );
    19091909
    1910         $this->use_trailing_slashes = ( '/' === substr( $this->permalink_structure, -1, 1 ) );
     1910        $this->use_trailing_slashes = str_ends_with( $this->permalink_structure, '/' );
    19111911
    19121912        // Enable generic rules for pages if permalink structure doesn't begin with a wildcard.
Note: See TracChangeset for help on using the changeset viewer.