[gnome-web-www] previous-donors: Initial attempt to implement more dynamic loading
- From: Tobias Mueller <tobiasmue src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-web-www] previous-donors: Initial attempt to implement more dynamic loading
- Date: Fri, 25 Jan 2013 17:27:57 +0000 (UTC)
commit 2398ad0499e514d01b8bb7f24c96fce600fc4c6b
Author: Tobias Mueller <tobiasmue gnome org>
Date: Fri Jan 25 18:18:21 2013 +0100
previous-donors: Initial attempt to implement more dynamic loading
I basically copied the stuff from the membership page and implemented the
necessary login in PHP.
In my tests it works reasoably well. Let's see whether the caching and all
works, too.
theme/page-previous-donors.php | 78 ++++++++++++++++++++++++++++++++++++++++
1 files changed, 78 insertions(+), 0 deletions(-)
---
diff --git a/theme/page-previous-donors.php b/theme/page-previous-donors.php
new file mode 100644
index 0000000..761a8cc
--- /dev/null
+++ b/theme/page-previous-donors.php
@@ -0,0 +1,78 @@
+<?php
+
+$donors = array();
+
+foreach (array(
+ 2012,
+ 2011,
+ 2010,
+ ) as $year) {
+
+ $donors[$year] = array();
+
+ foreach (array('philanthropist', 'sponsor', 'associate') as $level) {
+ if (false === ($donor_file = get_transient("friends_of_gnome_{$year}_{$level}"))) {
+ $url = "http://people.gnome.org/~tobiasmue/fog/{$year}-{$level}.txt";
+ $donors_file = file_get_contents($url);
+ }
+ $donors[$year][$level] = array();
+
+ $donors[$year][$level] = explode("\n", $donors_file);
+
+ // keeps a 24-hour cache until another HTTP request
+ // to get the members list
+ set_transient("friends_of_gnome_{$year}_{$level}", $donors, 60*60*24);
+ }
+}
+
+
+
+
+require_once("header.php"); ?>
+
+ <!-- container -->
+ <div id="container" class="two_columns">
+ <div class="container_12">
+
+ <?php require_once('inc/page-title.php'); ?>
+
+ <div class="content without_sidebar">
+ <?php while ( have_posts() ) : the_post(); ?>
+ <?php the_content(); ?>
+
+ <?php
+
+ if (isset($donors)) {
+ foreach ($donors as $year => $level_array) {
+ echo "<h3>{$year}</h3>\n";
+ foreach ($level_array as $level => $donor_array) {
+ $level_count = count($donor_array);
+ if ($level_count > 1) { // The count behaves weirdly for me. Always +1.
+ echo "<h4>$level</h4>\n";
+ echo '<ul style="list-style-type: disc;">\n';
+ foreach ($donor_array as $donor_line) {
+ $donor = trim($donor_line, "\x00..\x20");
+ if (strlen($donor) > 0)
+ echo "<li>".htmlspecialchars($donor)."</li>\n";
+ }
+ echo "</ul>\n";
+ }
+ }
+ }
+ }
+ ?>
+
+ <?php endwhile; // End the loop. Whew. ?>
+ <br />
+ <div class="clear"></div>
+ </div>
+
+ <?php require_once("footer_art.php"); ?>
+ </div>
+ </div>
+
+ <div class="clearfix"></div>
+
+ <?php require_once("footer.php"); ?>
+</body>
+</html>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]