com web/php: Put the "local" country mirrors at the top too: mirrors.php styles/mirror.css
| From: | Hannes Magnusson | Date: | Wed, 20 Nov 2013 21:16:18 +0000 |
| Subject: | com web/php: Put the "local" country mirrors at the top too: mirrors.php styles/mirror.css | ||
| Groups: | php.webmaster | ||
| Request: | Send a blank email to php-webmaster+get-17076@lists.php.net to get a copy of this message | ||
Commit: abd285c55eaaddb608b70b50165a33417402619e
Author: Hannes Magnusson <bjori@mongodb.com> Wed, 20 Nov 2013 13:15:48 -0800
Parents: 389ba1477681715c9b34b7574eba737ea27d150b
Branches: master
Link: http://git.php.net/?p=web/php.git;a=commitdiff;h=abd285c55eaaddb608b70b50165a33417402619e
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;