Commit:    0c461e0a6a39e3ca4704b6306ce95af09363035c
Author:    Peter Cowburn <[email protected]>         Mon, 18 Aug 2014 21:35:28 
+0100
Parents:   635dbd4bb1a94f9fe10908e615150c464005a6a0
Branches:  master

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

Log:
Add mirror sponsor logo back to homepage sidebar

Changed paths:
  M  index.php
  M  styles/home.css


Diff:
diff --git a/index.php b/index.php
index 2a92f97..80b0669 100644
--- a/index.php
+++ b/index.php
@@ -165,12 +165,57 @@ if (is_array($CONF_TEASER)) {
     $announcements = '';
 }
 
+$MIRROR_IMAGE = '';
+
+// Try to find a sponsor image in case this is an official mirror
+if (is_official_mirror()) {
+
+    // Iterate through possible mirror provider logo types in priority order
+    $types = array("gif", "jpg", "png");
+    while (list(,$ext) = each($types)) {
+
+        // Check if file exists for this type
+        if (file_exists("backend/mirror." . $ext)) {
+
+            // Add text to rigth sidebar
+            $MIRROR_IMAGE = "<div class='panel mirror-sponsor'>"
+                          . '<a href="' . mirror_provider_url() . '">'
+                          . "This mirror sponsored by</a><div 
class=\"body\">\n";
+
+            // Create image HTML code
+            $img = make_image(
+                'mirror.' . $ext,
+                htmlspecialchars(mirror_provider()),
+                FALSE,
+                FALSE,
+                'backend',
+                0
+            );
+
+            // Add size information depending on mirror type
+            if (is_primary_site() || is_backup_primary()) {
+                $img = resize_image($img, 125, 125);
+            } else {
+                $img = resize_image($img, 120, 60);
+            }
+
+            // End mirror specific part
+            $MIRROR_IMAGE .= '<a class="mirror-logo" href="' . 
mirror_provider_url() . '" title="'.htmlspecialchars(mirror_provider()).'">' .
+                             $img . "</a></div></div>\n";
+
+            // We have found an image
+            break;
+        }
+    }
+}
+
 $SIDEBAR = <<< SIDEBAR_DATA
 
     <p class='panel'><a href='/migration55' title='Upgrading to PHP 5.5' 
class='headline'>Upgrading to PHP 5.5</a></p>
 $announcements
     <p class='panel'><a href='/cal.php'>User Group Events</a></p>
     <p class='panel'><a href='/thanks.php'>Special Thanks</a></p>
+$MIRROR_IMAGE
     <p class='panel social-media'>
       <a class='headline' href="https://twitter.com/official_php";>
         <i class="icon-twitter"></i>
diff --git a/styles/home.css b/styles/home.css
index ffb0b02..ea7c8d1 100644
--- a/styles/home.css
+++ b/styles/home.css
@@ -122,6 +122,11 @@ p.archive {
     }
 }
 
+/* Homepage mirror sponsor */
+aside.tips .mirror-sponsor {
+    padding-top: 1.5rem;
+}
+
 /* Social media buttons. */
 aside.tips .social-media {
     padding-top: 2em;


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

Reply via email to