home *** CD-ROM | disk | FTP | other *** search
/ Cricao de Sites - 650 Layouts Prontos / WebMasters.iso / Blogs / wordpress2.6.exe / wordpress2.6 / wp-includes / vars.php < prev    next >
Encoding:
PHP Script  |  2008-07-23  |  2.5 KB  |  72 lines

  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 = preg_replace('#\?.*?$#', '', $pagenow);
  21.     if ( '' === $pagenow || 'index' === $pagenow || 'index.php' === $pagenow ) {
  22.         $pagenow = 'index.php';
  23.     } else {
  24.         preg_match('#(.*?)(/|$)#', $pagenow, $self_matches);
  25.         $pagenow = strtolower($self_matches[1]);
  26.         if ( '.php' !== substr($pagenow, -4, 4) )
  27.             $pagenow .= '.php'; // for Options +Multiviews: /wp-admin/themes/index.php (themes.php is queried)
  28.     }
  29. } else {
  30.     if ( preg_match('#([^/]+\.php)([?/].*?)?$#i', $PHP_SELF, $self_matches) )
  31.         $pagenow = strtolower($self_matches[1]);
  32.     else
  33.         $pagenow = 'index.php';
  34. }
  35.  
  36. // Simple browser detection
  37. $is_lynx = $is_gecko = $is_winIE = $is_macIE = $is_opera = $is_NS4 = $is_safari = false;
  38.  
  39. if (strpos($_SERVER['HTTP_USER_AGENT'], 'Lynx') !== false) {
  40.     $is_lynx = true;
  41. } elseif ( strpos(strtolower($_SERVER['HTTP_USER_AGENT']), 'webkit') !== false ) {
  42.     $is_safari = true;
  43. } elseif (strpos($_SERVER['HTTP_USER_AGENT'], 'Gecko') !== false) {
  44.     $is_gecko = true;
  45. } elseif (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== false && strpos($_SERVER['HTTP_USER_AGENT'], 'Win') !== false) {
  46.     $is_winIE = true;
  47. } elseif (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== false && strpos($_SERVER['HTTP_USER_AGENT'], 'Mac') !== false) {
  48.     $is_macIE = true;
  49. } elseif (strpos($_SERVER['HTTP_USER_AGENT'], 'Opera') !== false) {
  50.     $is_opera = true;
  51. } elseif (strpos($_SERVER['HTTP_USER_AGENT'], 'Nav') !== false && strpos($_SERVER['HTTP_USER_AGENT'], 'Mozilla/4.') !== false) {
  52.     $is_NS4 = true;
  53. }
  54.  
  55. $is_IE = ( $is_macIE || $is_winIE );
  56.  
  57. // Server detection
  58.  
  59. /**
  60.  * Whether the server software is Apache or something else
  61.  * @global bool $is_apache
  62.  */
  63. $is_apache = ((strpos($_SERVER['SERVER_SOFTWARE'], 'Apache') !== false) || (strpos($_SERVER['SERVER_SOFTWARE'], 'LiteSpeed') !== false)) ? true : false;
  64.  
  65. /**
  66.  * Whether the server software is IIS or something else
  67.  * @global bool $is_IIS
  68.  */
  69. $is_IIS = (strpos($_SERVER['SERVER_SOFTWARE'], 'Microsoft-IIS') !== false) ? true : false;
  70.  
  71. ?>
  72.