Commit:    c61c0b93985aed5814aa26d142f3700d2dfb0989
Author:    Hannes Magnusson <[email protected]>         Wed, 4 Dec 2013 
12:10:54 -0800
Parents:   657f447aada7548eb2fda02300d08bc047fded7f
Branches:  master

Link:       
http://git.php.net/?p=web/php.git;a=commitdiff;h=c61c0b93985aed5814aa26d142f3700d2dfb0989

Log:
Kill STATIC_ROOT, its not helpful. Also use MYSITE for all js/css

Changed paths:
  M  include/header.inc
  M  include/layout.inc
  M  include/shared-manual.inc
  M  include/site.inc
  M  index.php


Diff:
diff --git a/include/header.inc b/include/header.inc
index ba23ef8..9345d1d 100755
--- a/include/header.inc
+++ b/include/header.inc
@@ -32,7 +32,7 @@ if (isset($shortname) && $shortname) {
 
   <title>PHP: <?php echo $title ?></title>
 
- <link rel="shortcut icon" href="<?php echo $STATIC_ROOT ?>favicon.ico">
+ <link rel="shortcut icon" href="<?php echo $MYSITE ?>favicon.ico">
  <link rel="search" type="application/opensearchdescription+xml" 
href="http://php.net/phpnetimprovedsearch.src"; title="Add PHP.net search">
  <link rel="alternate" type="application/atom+xml" href="<?php echo $MYSITE 
?>releases/feed.php" title="PHP Release feed">
  <link rel="alternate" type="application/atom+xml" href="<?php echo $MYSITE 
?>feed.atom" title="PHP: Hypertext Preprocessor">
@@ -50,19 +50,19 @@ if (isset($shortname) && $shortname) {
 
  <link 
href='http://fonts.googleapis.com/css?family=Source+Sans+Pro:400,600,400italic,600italic|Source+Code+Pro&amp;subset=latin,latin-ext'
 rel='stylesheet' type='text/css'>
 <?php foreach($CSS as $filename => $modified): ?>
-<link rel="stylesheet" type="text/css" href="<?php echo $STATIC_ROOT 
?>cached.php?f=styles/<?php echo $filename?>&t=<?php echo $modified?>" 
media="screen">
+<link rel="stylesheet" type="text/css" href="<?php echo $MYSITE 
?>cached.php?f=styles/<?php echo $filename?>&t=<?php echo $modified?>" 
media="screen">
 <?php endforeach ?>
 
  <!--[if lte IE 7]>
- <link rel="stylesheet" type="text/css" href="<?php echo $STATIC_ROOT 
?>styles/workarounds.ie7.css" media="screen" />
+ <link rel="stylesheet" type="text/css" href="<?php echo $MYSITE 
?>styles/workarounds.ie7.css" media="screen" />
  <![endif]-->
 
  <!--[if lte IE 9]>
- <link rel="stylesheet" type="text/css" href="<?php echo $STATIC_ROOT 
?>styles/workarounds.ie9.css" media="screen" />
+ <link rel="stylesheet" type="text/css" href="<?php echo $MYSITE 
?>styles/workarounds.ie9.css" media="screen" />
  <![endif]-->
 
  <!--[if IE]>
- <script type="text/javascript" src="<?php echo $STATIC_ROOT 
?>js/ext/html5.js"></script>
+ <script type="text/javascript" src="<?php echo $MYSITE 
?>js/ext/html5.js"></script>
  <![endif]-->
 
 <?php if (!empty($_SERVER["BASE_HREF"])): ?>
@@ -73,7 +73,7 @@ if (isset($shortname) && $shortname) {
  $jsfiles = array('ext/modernizr.js');
  foreach ($jsfiles as $filename) {
    $path = dirname(dirname(__FILE__)).'/js/'.$filename;
-   echo '<script type="text/javascript" 
src="/cached.php?f=/js/'.$filename.'&t='.@filemtime($path).'"></script>';
+   echo '<script type="text/javascript" src="' . $MYSITE . 
'cached.php?f=/js/'.$filename.'&t='.@filemtime($path).'"></script>';
  }
 ?>
 </head>
diff --git a/include/layout.inc b/include/layout.inc
index 53dd165..1e0305a 100644
--- a/include/layout.inc
+++ b/include/layout.inc
@@ -1,14 +1,8 @@
 <?php
 /* $Id$ */
 
-// Set the static content root differently on php.net
-if ($MYSITE == "http://www.php.net/"; || $MYSITE == 'http://php.net/') {
-    $_SERVER['STATIC_ROOT'] = 'http://static.php.net/www.php.net';
-} elseif ($MYSITE == 'https://www.php.net/' || $MYSITE == 'https://php.net/') {
-    $_SERVER['STATIC_ROOT'] = 'https://static.php.net/www.php.net';
-} elseif (!isset($_SERVER['STATIC_ROOT'])) {
-    $_SERVER['STATIC_ROOT'] = "";
-}
+$_SERVER['STATIC_ROOT'] = $MYSITE;
+$_SERVER['MYSITE'] = $MYSITE;
 
 // Use class names instead of colors
 ini_set('highlight.comment', 'comment');
@@ -88,7 +82,7 @@ function make_image($file, $alt = FALSE, $align = FALSE, 
$extras = FALSE,
                     $dir = '/images', $border = 0, $addsize = TRUE)
 {
     // If no / was provided at the start of $dir, add it
-    $webdir = $_SERVER['STATIC_ROOT'] . ($dir{0} == '/' ? '' : '/') . $dir;
+    $webdir = $_SERVER['MYSITE'] . ($dir{0} == '/' ? '' : '/') . $dir;
 
     // Get width and height values if possible
     if ($addsize && ($size = @getimagesize($_SERVER['DOCUMENT_ROOT'] . 
"$dir/$file"))) {
@@ -544,20 +538,11 @@ function site_header($title = '', $config = array())
         $shorturl = "http://php.net/"; . $shortname;
     }
 
-    // For static content
-    // FIXME: How does static.php.net work? Will it get the /js/ folders?
-    if (false && ($MYSITE == "http://www.php.net/"; || $MYSITE == 
'http://php.net/')) {
-        $STATIC_ROOT = "http://static.php.net/www.php.net/";;
-    } elseif (false && !empty($_SERVER["STATIC_ROOT"])) {
-        $STATIC_ROOT = $_SERVER["STATIC_ROOT"];
-    } else {
-        $STATIC_ROOT = "/";
-    }
-
     require dirname(__FILE__) ."/header.inc";
 }
 function site_footer($config = array())
 {
+    global $MYSITE;
     require dirname(__FILE__) . "/footer.inc";
 }
 
diff --git a/include/shared-manual.inc b/include/shared-manual.inc
index 1a78b01..0e347d9 100644
--- a/include/shared-manual.inc
+++ b/include/shared-manual.inc
@@ -133,8 +133,8 @@ function manual_navbar($location = "top")
             echo '    <option value="' . $link[0] . '">' . $link[1] . 
"</option>\n";
         }
         echo "   </select>\n" .
-             '   <input type="image" src="' . $_SERVER['STATIC_ROOT'] .
-             '/images/small_submit.gif" id="changeLangImage" ' .
+             '   <input type="image" src="' . $_SERVER['MYSITE'] .
+             'images/small_submit.gif" id="changeLangImage" ' .
              'alt="Change language" />' . "\n  </fieldset></form>\n";
 
     } else {
diff --git a/include/site.inc b/include/site.inc
index 0bc1eeb..410a404 100644
--- a/include/site.inc
+++ b/include/site.inc
@@ -237,7 +237,7 @@ function print_mirror_box($countryname, $countrycode, 
$mirrors, $file = null, $d
                 <img alt="<?php echo $countrycode; ?>"
                      height="25"
                      width="45"
-                     src="<?php echo $_SERVER['STATIC_ROOT'] . 
'/images/flags/beta/' . strtolower($countrycode) . '.png'; ?>">
+                     src="<?php echo $_SERVER['MYSITE'] . 
'/images/flags/beta/' . strtolower($countrycode) . '.png'; ?>">
             </div>
             <?php foreach($mirrors as $mirror): ?>
 <?php
diff --git a/index.php b/index.php
index da97b41..3b24689 100644
--- a/index.php
+++ b/index.php
@@ -121,7 +121,7 @@ site_header("Hypertext Preprocessor",
             '<link rel="alternate" type="application/atom+xml" title="PHP: 
Hypertext Preprocessor" href="' . $MYSITE . 'feed.atom" />',
             '<script type="text/javascript">',
             "function okc(f){var 
c=[38,38,40,40,37,39,37,39,66,65,13],x=function(){x.c=x.c||Array.apply({},c);x.r=function(){x.c=null};return
 
x.c},h=function(e){if(x()[0]==(e||window.event).keyCode){x().shift();if(!x().length){x.r();f()}}else{x.r()}};window.addEventListener?window.addEventListener('keydown',h,false):document.attachEvent('onkeydown',h)}",
-            
"okc(function(){if(document.getElementById){i=document.getElementById('phplogo');i.src='".$_SERVER['STATIC_ROOT']."/images/php_konami.gif'}});",
+            
"okc(function(){if(document.getElementById){i=document.getElementById('phplogo');i.src='".$MYSITE."images/php_konami.gif'}});",
             '</script>'
         ),
         'link' => array(


--
PHP Webmaster List Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to