mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-07-01 15:50:09 +00:00
Code Modernization: Use str_contains() in a few more places.
`str_contains()` was introduced in PHP 8.0 to perform a case-sensitive check indicating if the string to search in (haystack) contains the given substring (needle). WordPress core includes a polyfill for `str_contains()` on PHP < 8.0 as of WordPress 5.9. This commit replaces `false !== strpos( ... )` with `str_contains()` in core files, making the code more readable and consistent, as well as better aligned with modern development practices. Follow-up to [55988], [56021]. See #58206. git-svn-id: https://develop.svn.wordpress.org/trunk@56031 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -907,9 +907,11 @@ function get_bloginfo( $show = '', $filter = 'raw' ) {
|
||||
}
|
||||
|
||||
$url = true;
|
||||
if ( strpos( $show, 'url' ) === false &&
|
||||
strpos( $show, 'directory' ) === false &&
|
||||
strpos( $show, 'home' ) === false ) {
|
||||
|
||||
if ( ! str_contains( $show, 'url' )
|
||||
&& ! str_contains( $show, 'directory' )
|
||||
&& ! str_contains( $show, 'home' )
|
||||
) {
|
||||
$url = false;
|
||||
}
|
||||
|
||||
@@ -3738,7 +3740,7 @@ function user_can_richedit() {
|
||||
if ( $is_safari ) {
|
||||
$wp_rich_edit = ! wp_is_mobile() || ( preg_match( '!AppleWebKit/(\d+)!', $_SERVER['HTTP_USER_AGENT'], $match ) && (int) $match[1] >= 534 );
|
||||
} elseif ( $is_IE ) {
|
||||
$wp_rich_edit = ( strpos( $_SERVER['HTTP_USER_AGENT'], 'Trident/7.0;' ) !== false );
|
||||
$wp_rich_edit = str_contains( $_SERVER['HTTP_USER_AGENT'], 'Trident/7.0;' );
|
||||
} elseif ( $is_gecko || $is_chrome || $is_edge || ( $is_opera && ! wp_is_mobile() ) ) {
|
||||
$wp_rich_edit = true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user