Commit:    509bc1b650b995ffe6f7c561a5d68b86aecad053
Author:    Hannes Magnusson <[email protected]>         Wed, 20 Nov 2013 
13:15:48 -0800
Parents:   5d52f5e2860535b21957969c17247b89b89ae1ce
Branches:  master

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

Log:
Put the "local" country mirrors at the top too

Changed paths:
  M  mirrors.php
  M  styles/mirror.css


Diff:
diff --git a/mirrors.php b/mirrors.php
index 66ef3af..f307380 100644
--- a/mirrors.php
+++ b/mirrors.php
@@ -10,6 +10,25 @@ $header_config = array(
 );
 site_header("Mirror Sites", $header_config);
 
+function print_mirror_box($countryname, $countrycode, $country, $homecountry = 
false) {
+?>
+    <div class="mirror <?php echo $homecountry ? "homecountry" : ""?>">
+            <div class="title"><?php echo $countryname; ?>
+                <img alt="<?php echo $countrycode; ?>"
+                     height="25"
+                     width="45"
+                     src="<?php echo $_SERVER['STATIC_ROOT'] . 
'/images/flags/beta/' . strtolower($countrycode) . '.png'; ?>">
+            </div>
+            <?php foreach($country as $mirror): ?>
+            <div class="entry">
+                <div class="url"><a href="<?php echo $mirror['url']; ?>" 
title="<?php echo clean($mirror['url']); ?>"><?php echo clean($mirror['url']); 
?></a></div>
+                <div class="provider"><a href="<?php echo 
$mirror['provider_url']; ?>" title="<?php echo 
clean($mirror['provider_title']); ?>"><?php echo 
clean($mirror['provider_title']); ?></a></div>
+            </div>
+            <?php endforeach; ?>
+        </div>
+<?php
+}
+
 // Lets group the mirrors by country code, for easy output on the page.
 $grouped_mirrors = array();
 foreach($MIRRORS as $key => $mirror) {
@@ -29,6 +48,7 @@ foreach($MIRRORS as $key => $mirror) {
     );
 }
 
+$close = count_mirrors($COUNTRY);
 ?>
 <div id="mirrors-container">
 
@@ -54,22 +74,19 @@ foreach($MIRRORS as $key => $mirror) {
     </div>
 
     <div class="mirrors-list">
+<?php if ($close) {
+    $mnum = (($close > 1) ? "mirrors" : "mirror");
+    echo "<p>We have automatically detected the following $mnum to be close to 
you</p>";
+
+    if (isset($grouped_mirrors[$COUNTRY])) {
+        print_mirror_box($COUNTRIES[$COUNTRY], $COUNTRY, 
$grouped_mirrors[$COUNTRY], 1);
+        echo "<br />";
+    }
+}
+?>
 
     <?php foreach($grouped_mirrors as $mirrorcode => $country): ?>
-        <div class="mirror">
-            <div class="title"><?php echo $COUNTRIES[$mirrorcode]; ?>
-                <img alt="<?php echo $mirrorcode; ?>"
-                     height="25"
-                     width="45"
-                     src="<?php echo $_SERVER['STATIC_ROOT'] . 
'/images/flags/beta/' . strtolower($mirrorcode) . '.png'; ?>">
-            </div>
-            <?php foreach($country as $mirror): ?>
-            <div class="entry ">
-                <div class="url"><a href="<?php echo $mirror['url']; ?>" 
title="<?php echo clean($mirror['url']); ?>"><?php echo clean($mirror['url']); 
?></a></div>
-                <div class="provider"><a href="<?php echo 
$mirror['provider_url']; ?>" title="<?php echo 
clean($mirror['provider_title']); ?>"><?php echo 
clean($mirror['provider_title']); ?></a></div>
-            </div>
-            <?php endforeach; ?>
-        </div>
+        <?php print_mirror_box($COUNTRIES[$mirrorcode], $mirrorcode, $country) 
?>
     <?php endforeach ?>
 
     </div>
diff --git a/styles/mirror.css b/styles/mirror.css
index 1ac768e..0b8ffc8 100644
--- a/styles/mirror.css
+++ b/styles/mirror.css
@@ -55,6 +55,11 @@ div#usernotes a.usernotes-voted:hover {
        padding: 20px;
        margin: 5px;
 }
+#mirrors-container .mirrors-list .homecountry {
+       display: block;
+       margin: 5px auto;
+       height: 100%;
+}
 
 #mirrors-container .mirrors-list .mirror:hover {
        background-color: #EEE;


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

Reply via email to