From 00583d64eb0750ecb44a6a67682413894060af7d Mon Sep 17 00:00:00 2001 From: westi Date: Wed, 27 Aug 2008 20:47:01 +0000 Subject: [PATCH] Performance improvements using strpos. Fixes #7611 and #7610 props johnbillion. git-svn-id: http://svn.automattic.com/wordpress/trunk@8754 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/admin-ajax.php | 2 +- wp-includes/query.php | 2 +- wp-login.php | 2 +- wp-mail.php | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/wp-admin/admin-ajax.php b/wp-admin/admin-ajax.php index 294bb49bc6..06df8afb45 100644 --- a/wp-admin/admin-ajax.php +++ b/wp-admin/admin-ajax.php @@ -25,7 +25,7 @@ if ( isset($_GET['action']) && 'ajax-tag-search' == $_GET['action'] ) { $s = $_GET['q']; // is this slashed already? - if ( strstr( $s, ',' ) ) { + if ( false !== strpos( $s, ',' ) ) { $s = explode( ',', $s ); $s = $s[count( $s ) - 1]; } diff --git a/wp-includes/query.php b/wp-includes/query.php index 9756f6c049..872f987db6 100644 --- a/wp-includes/query.php +++ b/wp-includes/query.php @@ -1752,7 +1752,7 @@ function setup_postdata($post) { if ( is_single() || is_page() || is_feed() ) $more = 1; $content = $post->post_content; - if ( preg_match('//', $content) ) { + if ( strpos( $content, '' ) ) { if ( $page > 1 ) $more = 1; $multipage = 1; diff --git a/wp-login.php b/wp-login.php index b258c82138..f610b8cfcf 100644 --- a/wp-login.php +++ b/wp-login.php @@ -103,7 +103,7 @@ function retrieve_password() { if ( empty( $_POST['user_login'] ) && empty( $_POST['user_email'] ) ) $errors->add('empty_username', __('ERROR: Enter a username or e-mail address.')); - if ( strstr($_POST['user_login'], '@') ) { + if ( strpos($_POST['user_login'], '@') ) { $user_data = get_user_by_email(trim($_POST['user_login'])); if ( empty($user_data) ) $errors->add('invalid_email', __('ERROR: There is no user registered with that email address.')); diff --git a/wp-mail.php b/wp-mail.php index d3d9e00ac8..620201c7b0 100644 --- a/wp-mail.php +++ b/wp-mail.php @@ -60,7 +60,7 @@ for ($i=1; $i <= $count; $i++) : $content_transfer_encoding = explode(';', $content_transfer_encoding); $content_transfer_encoding = $content_transfer_encoding[0]; } - if (($content_type == 'multipart/alternative') && (preg_match('/boundary="/', $line)) && ($boundary == '')) { + if (($content_type == 'multipart/alternative') && (false !== strpos($line, 'boundary="')) && ($boundary == '')) { $boundary = trim($line); $boundary = explode('"', $boundary); $boundary = $boundary[1];