3 * Template Name: Nightly Downloads
6 define('WEBKIT_NIGHTLY_ARCHIVE_URL', "http://nightly.webkit.org/builds/trunk/%s/all");
8 function get_nightly_build() {
9 return get_nightly_download_details('mac');
12 function get_nightly_source() {
13 return get_nightly_download_details('src');
16 function get_nightly_download_details( $type = 'mac' ) {
17 $types = array('mac', 'src');
18 if ( ! in_array($type, $types) )
21 $cachekey = 'nightly_download_' . $type;
22 if ( false !== ( $cached = get_transient($cachekey) ) )
23 return json_decode($cached);
25 $url = sprintf(WEBKIT_NIGHTLY_ARCHIVE_URL, $type);
26 $resource = fopen($url, 'r');
27 $rawdata = fread($resource, 128);
28 list($data,) = explode("\n", $rawdata);
31 if ( ! empty($data) ) {
32 $record = explode(',', $data);
33 set_transient($cachekey, json_encode($record), HOUR_IN_SECONDS * 6); // Expire every 6 hours
41 add_filter('the_content', function ($content) {
43 $build = get_nightly_build();
44 $source = get_nightly_source();
46 $content = sprintf($content,
49 date(get_option( 'date_format' ), $build[1]),
53 date(get_option( 'date_format' ), $source[1]),
69 /*background: #333333;*/
70 background: linear-gradient(black, #333333 66%);
95 #nightly blockquote:first-child {
107 #nightly blockquote:first-child p {
119 #nightly a.download {
124 .page-template-nightly hr {
127 .page-template-nightly #footer-nav a {
132 <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
134 <article class="page" id="nightly">
135 <h1><a href="<?php echo get_permalink() ?>" rel="bookmark" title="Permanent Link: <?php the_title(); ?>"><?php the_title(); ?></a></h1>
137 <div class="bodycopy">
138 <?php the_content(''); ?>
143 <?php endwhile; endif; ?>
145 <?php get_footer(); ?>