www: 0e68f08c: Add the metadata about each type of down...

markdoliner at pidgin.im markdoliner at pidgin.im
Thu May 3 02:02:07 EDT 2012


----------------------------------------------------------------------
Revision: 0e68f08c10cd204a1cb163b92eebd329b235b4c7
Parent:   ae7c2b94814b36a2cf7c4e91bbb2225f4608b862
Author:   markdoliner at pidgin.im
Date:     05/03/12 01:56:07
Branch:   im.pidgin.www
URL: http://d.pidgin.im/viewmtn/revision/info/0e68f08c10cd204a1cb163b92eebd329b235b4c7

Changelog: 

Add the metadata about each type of download to a php array and just
reference the array.  This kind of separates model from view... but
more importantly it will allow /download/ to
show identical content to what's on /download/<whatever>/

Changes against parent ae7c2b94814b36a2cf7c4e91bbb2225f4608b862

  added    inc/downloads.inc
  patched  htdocs/download/linux/index.php
  patched  htdocs/download/mac/index.php
  patched  htdocs/download/source/index.php
  patched  htdocs/download/ubuntu/index.php
  patched  htdocs/download/windows/index.php

-------------- next part --------------
============================================================
--- htdocs/download/source/index.php	2261c5cd1340cc6c818e8355e83e72b149b116dc
+++ htdocs/download/source/index.php	f47d39bab7c7bd1f34a43cc8c723a7a019a047e8
@@ -1,9 +1,13 @@
 <?php
-  // Update these to match the current page.
-  $page['title'] =   "Download Pidgin Source";
+  include($_SERVER['DOCUMENT_ROOT'] . "/../inc/downloads.inc");
+
+  $exploded_uri = explode('/', $_SERVER['DOCUMENT_URI']);
+  $me = $exploded_uri[2];
+
+  $page['title'] = $download_types[$me]['title'];
   $page['section'] = "Download";
-  $page['subsect'] = "Source";
-  $page['description'] = "Download the source code for the free Pidgin universal chat client";
+  $page['subsect'] = $download_types[$me]['subsect'];
+  $page['description'] = $download_types[$me]['description'];
 
   include($_SERVER['DOCUMENT_ROOT'] . "/../inc/header.inc");
   include($_SERVER['DOCUMENT_ROOT'] . "/../inc/version.inc");
@@ -20,23 +24,8 @@
 
 <div class="box_download">
 
-<p class="download_button">
-<a class="sourceforge_accelerator_link" href="http://sourceforge.net/projects/pidgin/files/Pidgin/<?php echo $pidgin_version; ?>/pidgin-<?php echo $pidgin_version; ?>.tar.bz2/download">Download Now</a>
-<script>
-(function() {
-	var script = document.createElement('script');
-	script.src = '//sourceforge.net/accelerator/js?partner_id=62&button_size=large';
-	script.defer = true;
-	var s = document.getElementsByTagName('script')[0];
-	s.parentNode.insertBefore(script, s);
-})();
-</script>
-</p>
+<?php echo $download_types[$me]['body'] ?>
 
-<p>This download is for the source code of Pidgin <?php echo $pidgin_version; ?>.</p>
-<p>If you want to <b>use</b> Pidgin, you should first look for pre-built packages from us (see the links on the left) or your operating system distribution.</p>
-<p>If you are looking to <b>modify</b> Pidgin, you may want to look at our <a href="http://developer.pidgin.im/wiki/UsingPidginMonotone">instructions for checking out the code from our repository</a>.</p>
-
 </div>
 
 </div>
============================================================
--- htdocs/download/windows/index.php	7639c0c3c2ea643684bbc08943a4181251321f40
+++ htdocs/download/windows/index.php	f47d39bab7c7bd1f34a43cc8c723a7a019a047e8
@@ -1,9 +1,13 @@
 <?php
-  // Update these to match the current page.
-  $page['title'] =   "Download Pidgin for Windows";
+  include($_SERVER['DOCUMENT_ROOT'] . "/../inc/downloads.inc");
+
+  $exploded_uri = explode('/', $_SERVER['DOCUMENT_URI']);
+  $me = $exploded_uri[2];
+
+  $page['title'] = $download_types[$me]['title'];
   $page['section'] = "Download";
-  $page['subsect'] = "Windows";
-  $page['description'] = "Download the free Pidgin universal chat client for Windows";
+  $page['subsect'] = $download_types[$me]['subsect'];
+  $page['description'] = $download_types[$me]['description'];
 
   include($_SERVER['DOCUMENT_ROOT'] . "/../inc/header.inc");
   include($_SERVER['DOCUMENT_ROOT'] . "/../inc/version.inc");
@@ -20,25 +24,10 @@
 
 <div class="box_download">
 
-<p class="download_button">
-<a class="sourceforge_accelerator_link" href="http://sourceforge.net/projects/pidgin/files/Pidgin/<?php echo $pidgin_win32_version; ?>/pidgin-<?php echo $pidgin_win32_version; ?>.exe/download">Download Now</a>
-<script>
-(function() {
-	var script = document.createElement('script');
-	script.src = '//sourceforge.net/accelerator/js?partner_id=62&button_size=large';
-	script.defer = true;
-	var s = document.getElementsByTagName('script')[0];
-	s.parentNode.insertBefore(script, s);
-})();
-</script>
-</p>
+<?php echo $download_types[$me]['body'] ?>
 
-<p>This version of Pidgin downloads an appropriate version of GTK+.  GTK+ is now installed locally for Pidgin, and not system-wide, thus Pidgin will not interfere with other GTK+ apps on your system.</p>
-<p>If you would like to have GTK+ included in the installer, we have an <a href="http://sourceforge.net/projects/pidgin/files/Pidgin/<?php echo $pidgin_win32_version; ?>/pidgin-<?php echo $pidgin_win32_version; ?>-offline.exe/download">offline installer</a> that bundles everything except spell-checking dictionaries. </p>
-
 </div>
 
-
 </div>
 </div>
 
============================================================
--- htdocs/download/mac/index.php	91c658fbd08685ecf0815afdb265fbe2b238801f
+++ htdocs/download/mac/index.php	f47d39bab7c7bd1f34a43cc8c723a7a019a047e8
@@ -1,9 +1,13 @@
 <?php
-  // Update these to match the current page.
-  $page['title'] =   "Download Pidgin for Mac OS X";
+  include($_SERVER['DOCUMENT_ROOT'] . "/../inc/downloads.inc");
+
+  $exploded_uri = explode('/', $_SERVER['DOCUMENT_URI']);
+  $me = $exploded_uri[2];
+
+  $page['title'] = $download_types[$me]['title'];
   $page['section'] = "Download";
-  $page['subsect'] = "Mac OS X";
-  $page['description'] = "Download the free Pidgin universal chat client for Mac OS X";
+  $page['subsect'] = $download_types[$me]['subsect'];
+  $page['description'] = $download_types[$me]['description'];
 
   include($_SERVER['DOCUMENT_ROOT'] . "/../inc/header.inc");
   include($_SERVER['DOCUMENT_ROOT'] . "/../inc/version.inc");
@@ -20,9 +24,7 @@
 
 <div class="box_download">
 
-<p>For a native Mac OS X experience we recommend <a href="http://adium.im" onClick="javascript:pageTracker._trackPageview('/external/adium.im');">Adium</a>, which uses libpurple (the core of Pidgin) for much of its protocol support.</p>
-<p>If you're sure you want to use Pidgin on OS X, you may find the packages provided through <a href="http://finkproject.org/download/" onClick="javascript:pageTracker._trackPageview('/external/finkproject.org');">Fink</a> or <a href="http://www.macports.org/install.php" onClick="javascript:pageTracker._trackPageview('/external/macports.org');">Macports</a> more convenient than compiling from source.  Please note, <i>we do not provide support for issues related to installing Fink, Macports, or their packages of Pidgin</i>. Contact those projects directly with questions or concerns.</p>
-<p>If you're sure you want to use Pidgin on OS X and you don't want to use Fink or Macports, you can <a href="/download/source/">download the Pidgin source</a> and compile.</p>
+<?php echo $download_types[$me]['body'] ?>
 
 </div>
 
============================================================
--- htdocs/download/ubuntu/index.php	e155e870c5ad50a9a89315fda0840612710dc3f0
+++ htdocs/download/ubuntu/index.php	f47d39bab7c7bd1f34a43cc8c723a7a019a047e8
@@ -1,9 +1,13 @@
 <?php
-  // Update these to match the current page.
-  $page['title'] =   "Download Pidgin for Ubuntu";
+  include($_SERVER['DOCUMENT_ROOT'] . "/../inc/downloads.inc");
+
+  $exploded_uri = explode('/', $_SERVER['DOCUMENT_URI']);
+  $me = $exploded_uri[2];
+
+  $page['title'] = $download_types[$me]['title'];
   $page['section'] = "Download";
-  $page['subsect'] = "Ubuntu";
-  $page['description'] = "Download the free Pidgin universal chat client for Ubuntu";
+  $page['subsect'] = $download_types[$me]['subsect'];
+  $page['description'] = $download_types[$me]['description'];
 
   include($_SERVER['DOCUMENT_ROOT'] . "/../inc/header.inc");
   include($_SERVER['DOCUMENT_ROOT'] . "/../inc/version.inc");
@@ -20,25 +24,8 @@
 
 <div class="box_download">
 
-<p>Ubuntu ships Pidgin but does not update it after a release (except for security issues and high-severity bugs). For those users who desire new releases of Pidgin, we have packaged Pidgin in <a href="https://launchpad.net/~pidgin-developers/+archive/ppa/">a PPA</a>. If you encounter problems with these packages, try <a href="../source">building from source</a> and <a href="/support">report the bug</a>.</p>
-<p>To setup <a href="https://launchpad.net/~pidgin-developers/+archive/ppa/">the PPA</a>, follow these steps: <br />
-  1. Click to download the <a href="https://launchpad.net/~pidgin-developers/+archive/ppa/+files/pidgin-ppa_0.0.7_all.deb">Pidgin PPA package</a>.<br />
-  2. Select <em>Open with:</em> and <em>GDebi Package Installer</em>. Click <em>OK</em>.<br />
-  3. Click <em>Install Package</em>.<br />
-  4. Click <em>Close</em>. Then close GDebi.
-</p>
+<?php echo $download_types[$me]['body'] ?>
 
-<p>After doing this, check for and apply updates: <br />
-  1. Click <em>System</em>, point to <em>Administration</em>, and click <em>Update Manager</em>.<br />
-  2. Click <em>Check</em>.<br />
-  3. Click <em>Install Updates</em>.<br />
-</p>
-
-<p>Future Pidgin updates will show up in Update Manager along with the usual Ubuntu updates.</p>
-
-<p>This PPA often lags behind the source releases a couple of days, so please be patient.</p>
-
-<p><b>This PPA supports Ubuntu Lucid (10.04) and newer.</b></p>
 </div>
 
 </div>
============================================================
--- htdocs/download/linux/index.php	bddda5c1910249e0bc3e53de0674c049756134eb
+++ htdocs/download/linux/index.php	f47d39bab7c7bd1f34a43cc8c723a7a019a047e8
@@ -1,9 +1,13 @@
 <?php
-  // Update these to match the current page.
-  $page['title'] =   "Download Pidgin for Linux";
+  include($_SERVER['DOCUMENT_ROOT'] . "/../inc/downloads.inc");
+
+  $exploded_uri = explode('/', $_SERVER['DOCUMENT_URI']);
+  $me = $exploded_uri[2];
+
+  $page['title'] = $download_types[$me]['title'];
   $page['section'] = "Download";
-  $page['subsect'] = "Linux";
-  $page['description'] = "Download the free Pidgin universal chat client for Linux";
+  $page['subsect'] = $download_types[$me]['subsect'];
+  $page['description'] = $download_types[$me]['description'];
 
   include($_SERVER['DOCUMENT_ROOT'] . "/../inc/header.inc");
   include($_SERVER['DOCUMENT_ROOT'] . "/../inc/version.inc");
@@ -20,10 +24,8 @@
 
 <div class="box_download">
 
-<p>We do not provide pre-built packages for most Linux and Unix distributions.  We recommend installing Pidgin using your operating system's standard package management tool.</p>
+<?php echo $download_types[$me]['body'] ?>
 
-<p>If your operating system doesn't provide a pre-built package, or if their pre-built package is out of date and you want to upgrade, then you can try <a href="/download/source/">building from source</a>.</p>
-
 </div>
 
 </div>
============================================================
--- /dev/null	
+++ inc/downloads.inc	4c9553481bc31f235fa558166e7cd0bf70a9a220
@@ -0,0 +1,97 @@
+<?php
+
+// The keys in this array are available download types.  They should
+// match the piece of the URL following "/download/"  For example,
+// "source" or "windows"
+// The values in this array are arrays containing info about the
+// download type.  The keys in these arrays are things like "name"
+// and "description."
+$download_types = array(
+	'windows' => array(
+		'title' => 'Download Pidgin for Windows',
+		'subsect' => 'Windows',
+		'description' => 'Download the free Pidgin universal chat client for Windows',
+		'body' => '<p class="download_button">
+<a class="sourceforge_accelerator_link" href="http://sourceforge.net/projects/pidgin/files/Pidgin/<?php echo $pidgin_win32_version; ?>/pidgin-<?php echo $pidgin_win32_version; ?>.exe/download">Download Now</a>
+<script>
+(function() {
+	var script = document.createElement("script");
+	script.src = "//sourceforge.net/accelerator/js?partner_id=62&button_size=large";
+	script.defer = true;
+	var s = document.getElementsByTagName("script")[0];
+	s.parentNode.insertBefore(script, s);
+})();
+</script>
+</p>
+
+<p>This version of Pidgin downloads an appropriate version of GTK+.  GTK+ is now installed locally for Pidgin, and not system-wide, thus Pidgin will not interfere with other GTK+ apps on your system.</p>
+<p>If you would like to have GTK+ included in the installer, we have an <a href="http://sourceforge.net/projects/pidgin/files/Pidgin/<?php echo $pidgin_win32_version; ?>/pidgin-<?php echo $pidgin_win32_version; ?>-offline.exe/download">offline installer</a> that bundles everything except spell-checking dictionaries. </p>',
+	),
+
+	'ubuntu' => array(
+		'title' => 'Download Pidgin for Ubuntu Linux',
+		'subsect' => 'Ubuntu',
+		'description' => 'Download the free Pidgin universal chat client for Ubuntu Linux',
+		'body' => '<p>Ubuntu ships Pidgin but does not update it after a release (except for security issues and high-severity bugs). For those users who desire new releases of Pidgin, we have packaged Pidgin in <a href="https://launchpad.net/~pidgin-developers/+archive/ppa/">a PPA</a>. If you encounter problems with these packages, try <a href="../source">building from source</a> and <a href="/support">report the bug</a>.</p>
+<p>To setup <a href="https://launchpad.net/~pidgin-developers/+archive/ppa/">the PPA</a>, follow these steps: <br />
+  1. Click to download the <a href="https://launchpad.net/~pidgin-developers/+archive/ppa/+files/pidgin-ppa_0.0.7_all.deb">Pidgin PPA package</a>.<br />
+  2. Select <em>Open with:</em> and <em>GDebi Package Installer</em>. Click <em>OK</em>.<br />
+  3. Click <em>Install Package</em>.<br />
+  4. Click <em>Close</em>. Then close GDebi.
+</p>
+
+<p>After doing this, check for and apply updates: <br />
+  1. Click <em>System</em>, point to <em>Administration</em>, and click <em>Update Manager</em>.<br />
+  2. Click <em>Check</em>.<br />
+  3. Click <em>Install Updates</em>.<br />
+</p>
+
+<p>Future Pidgin updates will show up in Update Manager along with the usual Ubuntu updates.</p>
+
+<p>This PPA often lags behind the source releases a couple of days, so please be patient.</p>
+
+<p><b>This PPA supports Ubuntu Lucid (10.04) and newer.</b></p>',
+	),
+
+	'linux' => array(
+		'title' => 'Download Pidgin for Linux',
+		'subsect' => 'Linux',
+		'description' => 'Download the free Pidgin universal chat client for Linux',
+		'body' => '<p>We do not provide pre-built packages for most Linux and Unix distributions.  We recommend installing Pidgin using your operating system\'s standard package management tool.</p>
+
+<p>If your operating system doesn\'t provide a pre-built package, or if their pre-built package is out of date and you want to upgrade, then you can try <a href="/download/source/">building from source</a>.</p>',
+	),
+
+	'mac' => array(
+		'title' => 'Download Pidgin for Mac OS X',
+		'subsect' => 'Mac OS X',
+		'description' => 'Download the free Pidgin universal chat client for Mac OS X',
+		'body' => '<p>For a native Mac OS X experience we recommend <a href="http://adium.im" onClick="javascript:pageTracker._trackPageview("/external/adium.im");">Adium</a>, which uses libpurple (the core of Pidgin) for much of its protocol support.</p>
+<p>If you\'re sure you want to use Pidgin on OS X, you may find the packages provided through <a href="http://finkproject.org/download/" onClick="javascript:pageTracker._trackPageview("/external/finkproject.org");">Fink</a> or <a href="http://www.macports.org/install.php" onClick="javascript:pageTracker._trackPageview("/external/macports.org");">Macports</a> more convenient than compiling from source.  Please note, <i>we do not provide support for issues related to installing Fink, Macports, or their packages of Pidgin</i>. Contact those projects directly with questions or concerns.</p>
+<p>If you\'re sure you want to use Pidgin on OS X and you don\'t want to use Fink or Macports, you can <a href="/download/source/">download the Pidgin source</a> and compile.</p>',
+	),
+
+	'source' => array(
+		'title' => 'Download Pidgin Source',
+		'subsect' => 'Source',
+		'description' => 'Download the source code for the free Pidgin universal chat client',
+		'body' => '<p class="download_button">
+<a class="sourceforge_accelerator_link" href="http://sourceforge.net/projects/pidgin/files/Pidgin/<?php echo $pidgin_version; ?>/pidgin-<?php echo $pidgin_version; ?>.tar.bz2/download">Download Now</a>
+<script>
+(function() {
+	var script = document.createElement("script");
+	script.src = "//sourceforge.net/accelerator/js?partner_id=62&button_size=large";
+	script.defer = true;
+	var s = document.getElementsByTagName("script")[0];
+	s.parentNode.insertBefore(script, s);
+})();
+</script>
+</p>
+
+<p>This download is for the source code of Pidgin <?php echo $pidgin_version; ?>.</p>
+<p>If you want to <b>use</b> Pidgin, you should first look for pre-built packages from us (see the links on the left) or your operating system distribution.</p>
+<p>If you are looking to <b>modify</b> Pidgin, you may want to look at our <a href="http://developer.pidgin.im/wiki/UsingPidginMonotone">instructions for checking out the code from our repository</a>.</p>',
+	),
+);
+
+?>


More information about the Commits mailing list