Use stripos() instead of strpos() with strtolower(). For PHP < 5 we have stripos() in compat.php. Fixes #11176

git-svn-id: http://svn.automattic.com/wordpress/trunk@13132 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
nacin 2010-02-14 02:27:19 +00:00
parent b43bb4330f
commit cfa428b8d2
5 changed files with 8 additions and 8 deletions

View File

@ -93,10 +93,10 @@ case 'wp-compression-test' :
} elseif ( 2 == $_GET['test'] ) {
if ( !isset($_SERVER['HTTP_ACCEPT_ENCODING']) )
die('-1');
if ( false !== strpos( strtolower($_SERVER['HTTP_ACCEPT_ENCODING']), 'deflate') && function_exists('gzdeflate') && ! $force_gzip ) {
if ( false !== stripos( $_SERVER['HTTP_ACCEPT_ENCODING'], 'deflate') && function_exists('gzdeflate') && ! $force_gzip ) {
header('Content-Encoding: deflate');
$out = gzdeflate( $test_str, 1 );
} elseif ( false !== strpos( strtolower($_SERVER['HTTP_ACCEPT_ENCODING']), 'gzip') && function_exists('gzencode') ) {
} elseif ( false !== stripos( $_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip') && function_exists('gzencode') ) {
header('Content-Encoding: gzip');
$out = gzencode( $test_str, 1 );
} else {

View File

@ -258,7 +258,7 @@ class WP_Filesystem_FTPext extends WP_Filesystem_Base {
function parselisting($line) {
static $is_windows;
if ( is_null($is_windows) )
$is_windows = strpos( strtolower( ftp_systype($this->link) ), 'win') !== false;
$is_windows = stripos( ftp_systype($this->link), 'win') !== false;
if ( $is_windows && preg_match('/([0-9]{2})-([0-9]{2})-([0-9]{2}) +([0-9]{2}):([0-9]{2})(AM|PM) +([0-9]+|<DIR>) +(.+)/', $line, $lucifer) ) {
$b = array();

View File

@ -1382,7 +1382,7 @@ function media_upload_form( $errors = null ) {
// If Mac and mod_security, no Flash. :(
$flash = true;
if ( false !== strpos(strtolower($_SERVER['HTTP_USER_AGENT']), 'mac') && apache_mod_loaded('mod_security') )
if ( false !== stripos($_SERVER['HTTP_USER_AGENT'], 'mac') && apache_mod_loaded('mod_security') )
$flash = false;
$flash = apply_filters('flash_uploader', $flash);

View File

@ -1146,7 +1146,7 @@ function get_calendar($initial = true, $echo = true) {
$daywithpost = array();
}
if (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== false || strpos(strtolower($_SERVER['HTTP_USER_AGENT']), 'camino') !== false || strpos(strtolower($_SERVER['HTTP_USER_AGENT']), 'safari') !== false)
if (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== false || stripos($_SERVER['HTTP_USER_AGENT'], 'camino') !== false || stripos($_SERVER['HTTP_USER_AGENT'], 'safari') !== false)
$ak_title_separator = "\n";
else
$ak_title_separator = ', ';

View File

@ -40,9 +40,9 @@ $is_lynx = $is_gecko = $is_winIE = $is_macIE = $is_opera = $is_NS4 = $is_safari
if ( isset($_SERVER['HTTP_USER_AGENT']) ) {
if ( strpos($_SERVER['HTTP_USER_AGENT'], 'Lynx') !== false ) {
$is_lynx = true;
} elseif ( strpos(strtolower($_SERVER['HTTP_USER_AGENT']), 'chrome') !== false ) {
} elseif ( stripos($_SERVER['HTTP_USER_AGENT'], 'chrome') !== false ) {
$is_chrome = true;
} elseif ( strpos(strtolower($_SERVER['HTTP_USER_AGENT']), 'safari') !== false ) {
} elseif ( stripos($_SERVER['HTTP_USER_AGENT'], 'safari') !== false ) {
$is_safari = true;
} elseif ( strpos($_SERVER['HTTP_USER_AGENT'], 'Gecko') !== false ) {
$is_gecko = true;
@ -57,7 +57,7 @@ if ( isset($_SERVER['HTTP_USER_AGENT']) ) {
}
}
if ( $is_safari && strpos(strtolower($_SERVER['HTTP_USER_AGENT']), 'mobile') !== false )
if ( $is_safari && stripos($_SERVER['HTTP_USER_AGENT'], 'mobile') !== false )
$is_iphone = true;
$is_IE = ( $is_macIE || $is_winIE );