X-Git-Url: https://scripts.mit.edu/gitweb/autoinstalls/wordpress.git/blobdiff_plain/ff81ee6e8304a1982a3ec4f5b134764a29d502cf..61343b82c4f0da4c68e4c6373daafff4a81efdd1:/wp-includes/vars.php diff --git a/wp-includes/vars.php b/wp-includes/vars.php index 705d8b25..f55cdbd9 100644 --- a/wp-includes/vars.php +++ b/wp-includes/vars.php @@ -1,113 +1,127 @@ 'icon_smile.gif', - ' :D' => 'icon_biggrin.gif', - ' :-D' => 'icon_biggrin.gif', - ':grin:' => 'icon_biggrin.gif', - ' :)' => 'icon_smile.gif', - ' :-)' => 'icon_smile.gif', - ':smile:' => 'icon_smile.gif', - ' :(' => 'icon_sad.gif', - ' :-(' => 'icon_sad.gif', - ':sad:' => 'icon_sad.gif', - ' :o' => 'icon_surprised.gif', - ' :-o' => 'icon_surprised.gif', - ':eek:' => 'icon_surprised.gif', - ' 8O' => 'icon_eek.gif', - ' 8-O' => 'icon_eek.gif', - ':shock:' => 'icon_eek.gif', - ' :?' => 'icon_confused.gif', - ' :-?' => 'icon_confused.gif', - ' :???:' => 'icon_confused.gif', - ' 8)' => 'icon_cool.gif', - ' 8-)' => 'icon_cool.gif', - ':cool:' => 'icon_cool.gif', - ':lol:' => 'icon_lol.gif', - ' :x' => 'icon_mad.gif', - ' :-x' => 'icon_mad.gif', - ':mad:' => 'icon_mad.gif', - ' :P' => 'icon_razz.gif', - ' :-P' => 'icon_razz.gif', - ':razz:' => 'icon_razz.gif', - ':oops:' => 'icon_redface.gif', - ':cry:' => 'icon_cry.gif', - ':evil:' => 'icon_evil.gif', - ':twisted:' => 'icon_twisted.gif', - ':roll:' => 'icon_rolleyes.gif', - ':wink:' => 'icon_wink.gif', - ' ;)' => 'icon_wink.gif', - ' ;-)' => 'icon_wink.gif', - ':!:' => 'icon_exclaim.gif', - ':?:' => 'icon_question.gif', - ':idea:' => 'icon_idea.gif', - ':arrow:' => 'icon_arrow.gif', - ' :|' => 'icon_neutral.gif', - ' :-|' => 'icon_neutral.gif', - ':neutral:' => 'icon_neutral.gif', - ':mrgreen:' => 'icon_mrgreen.gif', - ); -} +/** + * Whether the server software is IIS or something else + * @global bool $is_IIS + */ +$is_IIS = !$is_apache && (strpos($_SERVER['SERVER_SOFTWARE'], 'Microsoft-IIS') !== false || strpos($_SERVER['SERVER_SOFTWARE'], 'ExpressionDevServer') !== false); -// sorts the smilies' array -if (!function_exists('smiliescmp')) { -function smiliescmp ($a, $b) { - if (strlen($a) == strlen($b)) { - return strcmp($a, $b); - } - return (strlen($a) > strlen($b)) ? -1 : 1; +/** + * Whether the server software is IIS 7.X or greater + * @global bool $is_iis7 + */ +$is_iis7 = $is_IIS && intval( substr( $_SERVER['SERVER_SOFTWARE'], strpos( $_SERVER['SERVER_SOFTWARE'], 'Microsoft-IIS/' ) + 14 ) ) >= 7; + +/** + * Test if the current browser runs on a mobile device (smart phone, tablet, etc.) + * + * @return bool true|false + */ +function wp_is_mobile() { + static $is_mobile; + + if ( isset($is_mobile) ) + return $is_mobile; + + if ( empty($_SERVER['HTTP_USER_AGENT']) ) { + $is_mobile = false; + } elseif ( strpos($_SERVER['HTTP_USER_AGENT'], 'Mobile') !== false // many mobile devices (all iPhone, iPad, etc.) + || strpos($_SERVER['HTTP_USER_AGENT'], 'Android') !== false + || strpos($_SERVER['HTTP_USER_AGENT'], 'Silk/') !== false + || strpos($_SERVER['HTTP_USER_AGENT'], 'Kindle') !== false + || strpos($_SERVER['HTTP_USER_AGENT'], 'BlackBerry') !== false + || strpos($_SERVER['HTTP_USER_AGENT'], 'Opera Mini') !== false + || strpos($_SERVER['HTTP_USER_AGENT'], 'Opera Mobi') !== false ) { + $is_mobile = true; + } else { + $is_mobile = false; } -} -uksort($wpsmiliestrans, 'smiliescmp'); -// generates smilies' search & replace arrays -foreach($wpsmiliestrans as $smiley => $img) { - $wp_smiliessearch[] = $smiley; - $smiley_masked = htmlspecialchars( trim($smiley) , ENT_QUOTES); - $wp_smiliesreplace[] = " $smiley_masked "; + return $is_mobile; } - -?>