| [ PHPXref.com ] | [ Generated: Sun Sep 13 08:17:58 2009 ] | [ WordPress 2.8.4 ] |
| [ Index ] [ Variables ] [ Functions ] [ Classes ] [ Constants ] [ Statistics ] | ||
[Summary view] [Print] [Text view]
1 <?php 2 /** 3 * Creates common globals for the rest of WordPress 4 * 5 * Sets $pagenow global which is the current page. Checks 6 * for the browser to set which one is currently being used. 7 * 8 * Detects which user environment WordPress is being used on. 9 * Only attempts to check for Apache and IIS. Two web servers 10 * with known permalink capability. 11 * 12 * @package WordPress 13 */ 14 15 // On which page are we ? 16 if ( is_admin() ) { 17 // wp-admin pages are checked more carefully 18 preg_match('#/wp-admin/?(.*?)$#i', $PHP_SELF, $self_matches); 19 $pagenow = $self_matches[1]; 20 $pagenow = trim($pagenow, '/'); 21 $pagenow = preg_replace('#\?.*?$#', '', $pagenow); 22 if ( '' === $pagenow || 'index' === $pagenow || 'index.php' === $pagenow ) { 23 $pagenow = 'index.php'; 24 } else { 25 preg_match('#(.*?)(/|$)#', $pagenow, $self_matches); 26 $pagenow = strtolower($self_matches[1]); 27 if ( '.php' !== substr($pagenow, -4, 4) ) 28 $pagenow .= '.php'; // for Options +Multiviews: /wp-admin/themes/index.php (themes.php is queried) 29 } 30 } else { 31 if ( preg_match('#([^/]+\.php)([?/].*?)?$#i', $PHP_SELF, $self_matches) ) 32 $pagenow = strtolower($self_matches[1]); 33 else 34 $pagenow = 'index.php'; 35 } 36 37 // Simple browser detection 38 $is_lynx = $is_gecko = $is_winIE = $is_macIE = $is_opera = $is_NS4 = $is_safari = $is_chrome = $is_iphone = false; 39 40 if (strpos($_SERVER['HTTP_USER_AGENT'], 'Lynx') !== false) { 41 $is_lynx = true; 42 } elseif ( strpos(strtolower($_SERVER['HTTP_USER_AGENT']), 'chrome') !== false ) { 43 $is_chrome = true; 44 } elseif ( strpos(strtolower($_SERVER['HTTP_USER_AGENT']), 'safari') !== false ) { 45 $is_safari = true; 46 } elseif (strpos($_SERVER['HTTP_USER_AGENT'], 'Gecko') !== false) { 47 $is_gecko = true; 48 } elseif (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== false && strpos($_SERVER['HTTP_USER_AGENT'], 'Win') !== false) { 49 $is_winIE = true; 50 } elseif (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== false && strpos($_SERVER['HTTP_USER_AGENT'], 'Mac') !== false) { 51 $is_macIE = true; 52 } elseif (strpos($_SERVER['HTTP_USER_AGENT'], 'Opera') !== false) { 53 $is_opera = true; 54 } elseif (strpos($_SERVER['HTTP_USER_AGENT'], 'Nav') !== false && strpos($_SERVER['HTTP_USER_AGENT'], 'Mozilla/4.') !== false) { 55 $is_NS4 = true; 56 } 57 58 if ( $is_safari && strpos(strtolower($_SERVER['HTTP_USER_AGENT']), 'mobile') !== false ) 59 $is_iphone = true; 60 61 $is_IE = ( $is_macIE || $is_winIE ); 62 63 // Server detection 64 65 /** 66 * Whether the server software is Apache or something else 67 * @global bool $is_apache 68 */ 69 $is_apache = (strpos($_SERVER['SERVER_SOFTWARE'], 'Apache') !== false || strpos($_SERVER['SERVER_SOFTWARE'], 'LiteSpeed') !== false); 70 71 /** 72 * Whether the server software is IIS or something else 73 * @global bool $is_IIS 74 */ 75 $is_IIS = (strpos($_SERVER['SERVER_SOFTWARE'], 'Microsoft-IIS') !== false || strpos($_SERVER['SERVER_SOFTWARE'], 'ExpressionDevServer') !== false); 76 77 /** 78 * Whether the server software is IIS 7.X 79 * @global bool $is_iis7 80 */ 81 $is_iis7 = (strpos($_SERVER['SERVER_SOFTWARE'], 'Microsoft-IIS/7.') !== false); 82 83 84 ?>
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| [ Powered by PHPXref - Served by Debian GNU/Linux ] |