From cfa428b8d294cb8d6d57b21823c9930640b61ee3 Mon Sep 17 00:00:00 2001 From: nacin Date: Sun, 14 Feb 2010 02:27:19 +0000 Subject: [PATCH] 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 --- wp-admin/admin-ajax.php | 4 ++-- wp-admin/includes/class-wp-filesystem-ftpext.php | 2 +- wp-admin/includes/media.php | 2 +- wp-includes/general-template.php | 2 +- wp-includes/vars.php | 6 +++--- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/wp-admin/admin-ajax.php b/wp-admin/admin-ajax.php index 1c03ba8de4..fc4731a98c 100644 --- a/wp-admin/admin-ajax.php +++ b/wp-admin/admin-ajax.php @@ -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 { diff --git a/wp-admin/includes/class-wp-filesystem-ftpext.php b/wp-admin/includes/class-wp-filesystem-ftpext.php index 795242b0ad..d68d9eaac6 100644 --- a/wp-admin/includes/class-wp-filesystem-ftpext.php +++ b/wp-admin/includes/class-wp-filesystem-ftpext.php @@ -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]+|) +(.+)/', $line, $lucifer) ) { $b = array(); diff --git a/wp-admin/includes/media.php b/wp-admin/includes/media.php index 32eae42237..cdac6fde99 100644 --- a/wp-admin/includes/media.php +++ b/wp-admin/includes/media.php @@ -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); diff --git a/wp-includes/general-template.php b/wp-includes/general-template.php index 545c780bdf..279da70333 100644 --- a/wp-includes/general-template.php +++ b/wp-includes/general-template.php @@ -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 = ', '; diff --git a/wp-includes/vars.php b/wp-includes/vars.php index ec2be5e445..7a62c892ad 100644 --- a/wp-includes/vars.php +++ b/wp-includes/vars.php @@ -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 );