Merge lp:~mthaddon/wordpress/wp-theme-xubuntu-website into lp:~canonical-sysadmins/wordpress/wp-theme-xubuntu-website

Proposed by Tom Haddon
Status: Merged
Merged at revision: 108
Proposed branch: lp:~mthaddon/wordpress/wp-theme-xubuntu-website
Merge into: lp:~canonical-sysadmins/wordpress/wp-theme-xubuntu-website
Diff against target: 770 lines (+468/-51)
13 files modified
xubuntu-fifteen/content-release.php (+49/-34)
xubuntu-fifteen/content-releases-landing.php (+40/-0)
xubuntu-fifteen/functions-features-release-links.php (+6/-3)
xubuntu-fifteen/functions-features-release-mirrors.php (+216/-0)
xubuntu-fifteen/functions-features-releases.php (+103/-10)
xubuntu-fifteen/functions.php (+1/-0)
xubuntu-fifteen/header.php (+1/-1)
xubuntu-fifteen/index.php (+3/-1)
xubuntu-fifteen/script-releases.js (+10/-1)
xubuntu-fifteen/style-admin.css (+8/-0)
xubuntu-fifteen/style-common.css (+2/-0)
xubuntu-fifteen/style.css (+27/-1)
xubuntu-fifteen/template-releases-landing.php (+2/-0)
To merge this branch: bzr merge lp:~mthaddon/wordpress/wp-theme-xubuntu-website
Reviewer Review Type Date Requested Status
Gareth Woolridge Approve
Review via email: mp+313430@code.launchpad.net

Description of the change

Merge per u#29426: Update Xubuntu.org themes

To post a comment you must log in.
Revision history for this message
Gareth Woolridge (moon127) wrote :

+1

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'xubuntu-fifteen/content-release.php'
2--- xubuntu-fifteen/content-release.php 2016-12-14 23:41:34 +0000
3+++ xubuntu-fifteen/content-release.php 2016-12-16 13:23:31 +0000
4@@ -1,58 +1,71 @@
5 <?php
6+ // Get release information
7 $release = get_term_by( 'slug', get_query_var( 'release' ), 'release', OBJECT );
8 $release_meta = get_option( 'taxonomy_term_' . $release->term_id );
9
10+ // Get release timestamp
11 if( isset( $release_meta['release_date'] ) && $release_meta['release_date'] > 0 ) {
12 list( $year, $month, $day ) = explode( '-', $release_meta['release_date'] );
13 $release_time = gmmktime( 0, 0, 0, $month, $day, $year );
14 }
15+ // Get EOL timestamp
16 if( isset( $release_meta['release_eol'] ) && $release_meta['release_eol'] > 0 ) {
17 list( $year, $month, $day ) = explode( '-', $release_meta['release_eol'] );
18 $eol_time = gmmktime( 0, 0, 1, $month, $day, $year );
19 }
20-
21- echo '<h1 class="post-title">Xubuntu ' . single_term_title( '', false ) . '</h1>';
22- if( strlen( $release_meta['release_codename'] ) > 0 || isset( $release_time ) || isset( $eol_time ) ) {
23+?>
24+
25+<h1 class="post-title">Xubuntu <?php echo single_term_title( '', false ); ?></h1>
26+<?php echo wpautop( $release->description ); ?>
27+
28+<?php
29+ // Release information
30+ $info = '';
31+ if( strlen( $release_meta['release_codename'] ) > 0 ) {
32+ $info .= '<dt>' . __( 'Codename', 'xubuntu' ) . '</dt><dd>' . $release_meta['release_codename'] . '</dd>';
33+ }
34+ if( isset( $release_time ) ) {
35+ $info .= '<dt>' . __( 'Release Date', 'xubuntu' ) . '</dt><dd>' . gmdate( 'F j, Y', $release_time ) . '</dd>';
36+ }
37+ if( isset( $eol_time ) ) {
38+ $info .= '<dt>' . __( 'End of Life', 'xubuntu' ) . '</dt><dd>' . gmdate( 'F j, Y', $eol_time ) . '</dd>';
39+ }
40+
41+ // Release links
42+ if( isset( $release_meta['release_torrent_64bit'] ) ) {
43+ $info_links[] = '<strong><a href="' . $release_meta['release_torrent_64bit'] . '">' . __( 'Torrent download for 64-bit systems', 'xubuntu' ) . '</a></strong>';
44+ }
45+ if( isset( $release_meta['release_torrent_32bit'] ) ) {
46+ $info_links[] = '<strong><a href="' . $release_meta['release_torrent_32bit'] . '">' . __( 'Torrent download for 32-bit systems', 'xubuntu' ) . '</a></strong>';
47+ }
48+ if( isset( $release_meta['release_documentation_link'] ) ) {
49+ $info_links[] = '<a href="' . $release_meta['release_documentation_link'] . '">' . __( 'Online Documentation', 'xubuntu' ) . '</a>';
50+ }
51+ if( isset( $info_links ) ) {
52+ $info .= '<dt>' . __( 'Release Links', 'xubuntu' ) . '</dt><dd>' . implode( $info_links, '<br />' ) . '</dd>';
53+ }
54+
55+ if( strlen( $info ) > 0 ) {
56 echo '<dl class="release-info group">';
57- if( strlen( $release_meta['release_codename'] ) > 0 ) {
58- echo '<dt>' . __( 'Codename', 'xubuntu' ) . '</dt><dd>' . $release_meta['release_codename'] . '</dd>';
59- }
60- if( isset( $release_time ) ) {
61- echo '<dt>' . __( 'Release Date', 'xubuntu' ) . '</dt><dd>' . gmdate( 'F j, Y', $release_time ) . '</dd>';
62- }
63- if( isset( $eol_time ) ) {
64- echo '<dt>' . __( 'End of Life', 'xubuntu' ) . '</dt><dd>' . gmdate( 'F j, Y', $eol_time ) . '</dd>';
65- }
66+ echo $info;
67 echo '</dl>';
68 }
69-
70- echo wpautop( $release->description );
71 ?>
72
73 <?php
74- $official_links = release_link_list( array( 'official', 'official-expiring' ), $release->term_id );
75-
76- if( $official_links ) {
77- $output_links = array( );
78-
79- foreach( $official_links as $official_link ) {
80- $meta = get_post_meta( $official_link->ID );
81- if( ( $meta['link_type'][0] == 'official-expiring' && time( ) <= $eol_time ) || $meta['link_type'][0] == 'official' ) {
82- $output_links[] = '<li><strong><a href="' . $meta['link_url'][0] . '">' . $official_link->post_title . '</a></strong></li>';
83- }
84- }
85-
86- if( count( $output_links ) > 0 ) {
87- echo '<h2>' . __( 'Official Links', 'xubuntu' ) . '</h2>';
88- echo '<ul class="link-list">';
89- foreach( $output_links as $link ) {
90- echo $link;
91- }
92- echo '</ul>';
93+ // Direct download links
94+ if( $eol_time > time( ) ) {
95+ if( shortcode_exists( 'mirrors' ) ) {
96+ $mirrors = do_shortcode( '[mirrors release=' . $release->name . ']' );
97+ if( isset( $mirrors ) ) {
98+ echo '<h2>' . __( 'Direct Downloads', 'xubuntu' ) . '</h2>';
99+ echo $mirrors;
100+ }
101 }
102 }
103 ?>
104
105+<?php // Articles ?>
106 <?php if( have_posts( ) ) { ?>
107 <h2><?php _e( 'Articles', 'xubuntu' ); ?></h2>
108 <ul class="posts-list">
109@@ -69,6 +82,7 @@
110 <?php } ?>
111
112 <?php
113+ // Press links
114 $press_links = release_link_list( 'press', $release->term_id );
115 if( $press_links ) {
116 echo '<h2>' . __( 'In the Press', 'xubuntu' ) . '</h2>';
117@@ -77,6 +91,7 @@
118 ?>
119
120 <?php
121+ // Attachments, usually screenshots
122 $attachments = get_posts( array(
123 'post_type' => 'attachment',
124 'posts_per_page' => -1,
125@@ -99,4 +114,4 @@
126 echo '<h2>' . __( 'Screenshots', 'xubuntu' ) . '</h2>';
127 echo do_shortcode( '[gallery size="xubuntu_split_to_3" link="file" ids="' . $gallery_ids . '"]' );
128 }
129-?>
130+?>
131\ No newline at end of file
132
133=== added file 'xubuntu-fifteen/content-releases-landing.php'
134--- xubuntu-fifteen/content-releases-landing.php 1970-01-01 00:00:00 +0000
135+++ xubuntu-fifteen/content-releases-landing.php 2016-12-16 13:23:31 +0000
136@@ -0,0 +1,40 @@
137+<?php while( have_posts( ) ) { ?>
138+ <?php the_post( ); ?>
139+ <div <?php post_class( 'group' ) ?> id="post-<?php the_ID( ); ?>">
140+ <?php if( !is_front_page( ) ) { ?>
141+ <?php if( !is_page( ) ) { ?>
142+ <h1 class="post-title"><a href="<?php the_permalink( ); ?>"><?php the_title( ); ?></a></h1>
143+ <?php } else { ?>
144+ <h1 class="post-title"><?php the_title( ); ?></h1>
145+ <?php } ?>
146+ <?php } ?>
147+
148+ <div class="post-post">
149+ <div class="post-entry entry">
150+ <?php the_content( __( 'Read the rest of this entry »', 'xubuntu' ) ); ?>
151+ </div>
152+ </div>
153+ </div>
154+<?php } ?>
155+
156+<?php
157+ $releases = release_taxonomy_get_releases_sorted( );
158+
159+ if( is_array( $releases ) ) {
160+ $date_now = new DateTime( 'now' );
161+ foreach( $releases as $release ) {
162+ $release_meta = get_option( 'taxonomy_term_' . $release->term_id );
163+ $date_release = new DateTime( $release_meta['release_date'] );
164+
165+ if( strlen( $release_meta['release_codename'] ) > 0 ) {
166+ $release->name .= ' (' . $release_meta['release_codename'] . ')';
167+ }
168+ if( $release->release_is_eol == 0 && $date_release->format( 'Ymd' ) <= $date_now->format( 'Ymd' ) ) {
169+ $date_eol = new DateTime( $release_meta['release_eol'] );
170+ echo '<h2>Xubuntu ' . $release->name . '</h2>';
171+ echo wpautop( $release->description );
172+ echo '<p><a class="button primary" href="' . get_term_link( $release ) . '">' . __( 'Visit the release page', 'xubuntu' ) . '</a></p>';
173+ }
174+ }
175+ }
176+?>
177\ No newline at end of file
178
179=== modified file 'xubuntu-fifteen/functions-features-release-links.php'
180--- xubuntu-fifteen/functions-features-release-links.php 2016-12-14 23:41:34 +0000
181+++ xubuntu-fifteen/functions-features-release-links.php 2016-12-16 13:23:31 +0000
182@@ -49,7 +49,6 @@
183 add_meta_box( 'release_link_type', _x( 'Link Type', 'meta box title', 'xubuntu' ), 'release_link_meta_box_link_type', 'release_link', 'normal', 'high' );
184 add_meta_box( 'release_link_link', _x( 'Link', 'meta box title', 'xubuntu' ), 'release_link_meta_box_link', 'release_link', 'normal', 'high' );
185 add_meta_box( 'release_link_author', _x( 'Author', 'meta box title', 'xubuntu' ), 'release_link_meta_box_author', 'release_link', 'normal' );
186-
187 }
188
189 function release_link_meta_box_link_type( $post, $box ) {
190@@ -74,7 +73,6 @@
191
192 echo '<p><input type="text" class="widefat" name="link_title" placeholder="' . _x( 'Review of the latest Xubuntu release – awesome!', 'placeholder text', 'xubuntu' ) . '" value="' . $link_title . '" /></p>';
193 echo '<p><input type="text" class="widefat" name="link_url" placeholder="' . _x( 'http://example.com/xubuntu-review/', 'placeholder text', 'xubuntu' ) . '" value="' . $link_url . '" /></p>';
194- echo '</label></p>';
195 }
196
197 function release_link_meta_box_author( $post, $box ) {
198@@ -237,6 +235,7 @@
199 }
200
201 $releases = get_terms( 'release', $args );
202+ usort( $releases, 'release_taxonomy_release_usort' );
203 $navi = '';
204 $links_out = '';
205
206@@ -245,7 +244,11 @@
207 if( count( $links ) > 0 ) {
208 $release_meta = get_option( 'taxonomy_term_' . $release->term_id );
209 $navi .= '<a class="button" href="#' . $release->slug . '">' . $release->name . '</a>';
210- $links_out .= '<h2 id="' . $release->slug . '">' . $release->name . ' (' . $release_meta['release_codename'] . ')</h2>' . release_link_press_output( $links );
211+ $links_out .= '<h2 id="' . $release->slug . '">' . $release->name;
212+ if( strlen( $release_meta['release_codename'] ) > 0 ) {
213+ $links_out .= ' (' . $release_meta['release_codename'] . ')';
214+ }
215+ $links_out .= '</h2>' . release_link_press_output( $links );
216 }
217 }
218
219
220=== added file 'xubuntu-fifteen/functions-features-release-mirrors.php'
221--- xubuntu-fifteen/functions-features-release-mirrors.php 1970-01-01 00:00:00 +0000
222+++ xubuntu-fifteen/functions-features-release-mirrors.php 2016-12-16 13:23:31 +0000
223@@ -0,0 +1,216 @@
224+<?php
225+
226+/*
227+ * Register the release download mirror post type
228+ *
229+ */
230+
231+add_action( 'init', 'release_download_mirror_register' );
232+
233+function release_download_mirror_register( ) {
234+ register_post_type(
235+ 'download_mirror',
236+ array(
237+ 'label' => _x( 'Download Mirrors', 'post type label', 'xubuntu' ),
238+ 'labels' => array(
239+ 'name' => _x( 'Download Mirrors', 'post type label: name', 'xubuntu' ),
240+ 'singular_name' => _x( 'Download Mirror', 'post type label: singular_name', 'xubuntu' ),
241+ 'add_new_item' => _x( 'Add New Download Mirror', 'post type label: add_new_item', 'xubuntu' ),
242+ 'edit_item' => _x( 'Edit Download Mirror', 'post type label: edit_item', 'xubuntu' ),
243+ 'view_item' => _x( 'View Download Mirror', 'post type label: view_item', 'xubuntu' ),
244+ 'search_items' => _x( 'Search Download Mirrors', 'post type label: search_items', 'xubuntu' ),
245+ 'not_found' => _x( 'No download mirrors found.', 'post type label: not_found', 'xubuntu' ),
246+ 'all_items' => _x( 'All Download Mirrors', 'post type label: all_items', 'xubuntu' ),
247+ 'menu_name' => _x( 'DL Mirrors', 'post type label: menu_name', 'xubuntu' ),
248+ ),
249+ 'description' => _x( 'Xubuntu Download Mirrors', 'post type description', 'xubuntu' ),
250+ 'public' => false,
251+ 'show_ui' => true,
252+ 'show_in_menu' => true,
253+ 'menu_position' => 21,
254+ 'menu_icon' => 'dashicons-download',
255+ 'supports' => false,
256+ /* 'taxonomies' => array(
257+ 'release'
258+ ), */
259+ 'rewrite' => false,
260+ 'query_var' => false
261+ )
262+ );
263+}
264+
265+/*
266+ * Add meta boxes for the post type
267+ *
268+ */
269+
270+add_action( 'add_meta_boxes', 'release_download_mirror_add_meta_boxes' );
271+
272+function release_download_mirror_add_meta_boxes( ) {
273+ add_meta_box( 'release_download_mirror_info', _x( 'Mirror Information', 'meta box title', 'xubuntu' ), 'release_download_mirror_meta_box_info', 'download_mirror', 'normal', 'high' );
274+ add_meta_box( 'release_download_mirror_location', _x( 'Mirror Location', 'meta box title', 'xubuntu' ), 'release_download_mirror_meta_box_location', 'download_mirror', 'normal' );
275+ add_meta_box( 'release_download_mirror_link_template', _x( 'Mirror Link Template', 'meta box title', 'xubuntu' ), 'release_download_mirror_meta_box_link_template', 'download_mirror', 'normal' );
276+ add_meta_box( 'release_download_mirror_activity', _x( 'Activity', 'meta box title', 'xubuntu' ), 'release_download_mirror_meta_box_activity', 'download_mirror', 'side' );
277+}
278+
279+function release_download_mirror_meta_box_info( $post, $box ) {
280+ $mirror_name = get_post_meta( $post->ID, 'mirror_name', true );
281+ $mirror_lp_url = get_post_meta( $post->ID, 'mirror_lp_url', true );
282+
283+ echo '<p><input type="text" class="widefat" name="mirror_name" placeholder="' . _x( 'University of Mirrors', 'placeholder text', 'xubuntu' ) . '" value="' . $mirror_name . '" /></p>';
284+ echo '<p><input type="text" class="widefat" name="mirror_lp_url" placeholder="' . _x( 'https://launchpad.net/ubuntu/+mirror/ubuntu.mirror.university-release', 'placeholder text', 'xubuntu' ) . '" value="' . $mirror_lp_url . '" /></p>';
285+}
286+
287+function release_download_mirror_meta_box_location( $post, $box ) {
288+ $mirror_area = get_post_meta( $post->ID, 'mirror_area', true );
289+ $mirror_country = get_post_meta( $post->ID, 'mirror_country', true );
290+
291+ $mirror_areas = array(
292+ 'unknown' => __( 'Unknown or Other', 'xubuntu' ),
293+ 'africa' => __( 'Africa', 'xubuntu' ),
294+ 'americas' => __( 'Americas', 'xubuntu' ),
295+ 'asia' => __( 'Asia', 'xubuntu' ),
296+ 'europe' => __( 'Europe', 'xubuntu' ),
297+ 'oceania' => __( 'Oceania', 'xubuntu' ),
298+ );
299+
300+ echo '<select class="widefat" name="mirror_area">';
301+ foreach( $mirror_areas as $value => $name ) {
302+ echo '<option value="' . $value . '" ' . selected( $mirror_area, $value, false ) . '>' . $name . '</option>';
303+ }
304+ echo '</select>';
305+
306+ echo '<p><input type="text" class="widefat" name="mirror_country" placeholder="' . _x( 'Finland', 'placeholder text', 'xubuntu' ) . '" value="' . $mirror_country . '" /></p>';
307+}
308+
309+function release_download_mirror_meta_box_link_template( $post, $box ) {
310+ $mirror_http_template = get_post_meta( $post->ID, 'mirror_http_template', true );
311+
312+ echo '<p><input type="text" class="widefat" name="mirror_http_template" placeholder="' . _x( 'http://ubuntu.mirror.university/releases/VERSION/', 'placeholder text', 'xubuntu' ) . '" value="' . $mirror_http_template . '" /></p>';
313+ echo '<p>' . __( 'The tag <code>VERSION</code> in the mirror template will be replaced by the appropriate version number (eg. <em>16.04</em>)', 'xubuntu' ) . '</p>';
314+}
315+
316+function release_download_mirror_meta_box_activity( $post, $box ) {
317+ $mirror_main = get_post_meta( $post->ID, 'mirror_main', true );
318+ $mirror_active = get_post_meta( $post->ID, 'mirror_active', true );
319+
320+ echo '<ul>';
321+ echo '<li><label class="selectit">';
322+ echo '<input type="checkbox" name="mirror_active" ' . checked( $mirror_active, 1, false ) . '/>';
323+ echo _x( 'Is active?', 'release mirror activity', 'xubuntu' );
324+ echo '</label></li>';
325+ echo '<li><label class="selectit">';
326+ echo '<input type="checkbox" name="mirror_main" ' . checked( $mirror_main, 1, false ) . '/>';
327+ echo __( 'Is a main download mirror?', 'release mirror status', 'xubuntu' );
328+ echo '</label></li>';
329+ echo '</ul>';
330+}
331+
332+/*
333+ * Handle saving the link data
334+ *
335+ */
336+
337+add_action( 'save_post_download_mirror', 'release_download_mirror_save_post' );
338+
339+function release_download_mirror_save_post( $post_id ) {
340+ global $wpdb;
341+
342+ $fields_to_save = array(
343+ 'mirror_name',
344+ 'mirror_lp_url',
345+ 'mirror_area',
346+ 'mirror_country',
347+ 'mirror_http_template',
348+ );
349+
350+ foreach( $fields_to_save as $field ) {
351+ if( isset( $_POST[$field] ) ) {
352+ update_post_meta( $post_id, $field, sanitize_text_field( $_POST[$field] ) );
353+ }
354+ }
355+
356+ $bool_fields_to_save = array(
357+ 'mirror_active',
358+ 'mirror_main',
359+ );
360+
361+ foreach( $bool_fields_to_save as $field ) {
362+ if( $_POST[$field] != 'on' ) { // TODO
363+ update_post_meta( $post_id, $field, 0 );
364+ } else {
365+ update_post_meta( $post_id, $field, 1 );
366+ }
367+ }
368+
369+ if( isset( $_POST['mirror_name'] ) ) {
370+ $wpdb->update( $wpdb->posts, array( 'post_title' => $_POST['mirror_name'] ), array( 'ID' => $post_id ) );
371+ }
372+}
373+
374+/*
375+ * Add a shortcode to print the list of mirrors
376+ *
377+ */
378+
379+add_shortcode( 'mirrors', 'release_download_mirror_shortcode_downloads' );
380+
381+function release_download_mirror_shortcode_downloads( $atts ) {
382+ $atts = shortcode_atts(
383+ array(
384+ 'release' => false,
385+ ),
386+ $atts,
387+ 'mirrors'
388+ );
389+
390+ if( strlen( $atts['release'] ) < 1 ) {
391+ return;
392+ }
393+
394+ $args = array(
395+ 'post_type' => 'download_mirror',
396+ 'posts_per_page' => -1,
397+ 'orderby' => 'meta_value',
398+ 'order' => 'ASC',
399+ 'meta_key' => 'mirror_country',
400+ 'meta_query' => array(
401+ array(
402+ 'key' => 'mirror_active',
403+ 'value' => 1,
404+ 'compare' => '='
405+ ),
406+ ),
407+ );
408+ $mirrors = get_posts( $args );
409+
410+ if( count( $mirrors ) > 0 ) {
411+ $out = '<ul class="columnlist mirrors">';
412+ foreach( $mirrors as $mirror ) {
413+ $mirror_meta = get_post_meta( $mirror->ID );
414+ if( $mirror_meta['mirror_main'][0] == 1 ) {
415+ $class = 'main';
416+ } else {
417+ $class = 'secondary';
418+ }
419+
420+ $out .= '<li class="' . $class . '"><a href="' . release_download_url( $mirror_meta['mirror_http_template'][0], $atts['release'] ) . '" title="' . $mirror->post_title . ', ' . $mirror_meta['mirror_country'][0] . '">' . $mirror_meta['mirror_country'][0] . '</a>';
421+ if( strlen( $mirror_meta['mirror_lp_url'][0] ) > 0 ) {
422+ $out .= '<span class="mirror-lp-url"><a href="' . $mirror_meta['mirror_lp_url'][0] . '">' . _x( 'Info', 'Link to download mirror information on Launchpad', 'xubuntu' ) . '</a></span>';
423+ }
424+ $out .= '</li>';
425+ }
426+ $out .= '<li class="nobullet show-on-js"><a class="show-all" href="#show-all">' . __( 'Show all mirrors with full information', 'xubuntu' ) . '</a></li>';
427+ $out .= '</ul>';
428+
429+ return $out;
430+ }
431+}
432+
433+function release_download_url( $template, $release_slug ) {
434+ $release = get_term_by( 'slug', $release_slug, 'release' );
435+
436+ return str_replace( 'VERSION', $release->name, $template );
437+}
438+
439+?>
440\ No newline at end of file
441
442=== modified file 'xubuntu-fifteen/functions-features-releases.php'
443--- xubuntu-fifteen/functions-features-releases.php 2016-08-29 12:39:20 +0000
444+++ xubuntu-fifteen/functions-features-releases.php 2016-12-16 13:23:31 +0000
445@@ -58,12 +58,29 @@
446 ),
447 'release_date' => array(
448 'label' => __( 'Release Date', 'xubuntu' ),
449- 'type' => 'date'
450+ 'type' => 'date',
451+ 'description' => __( 'Date in YYYY-MM-DD format.', 'xubuntu' )
452 ),
453 'release_eol' => array(
454 'label' => __( 'Release End of Life', 'xubuntu' ),
455- 'type' => 'date'
456- )
457+ 'type' => 'date',
458+ 'description' => __( 'Date in YYYY-MM-DD format.', 'xubuntu' )
459+ ),
460+ 'release_torrent_32bit' => array(
461+ 'label' => __( 'Torrent download link (32-bit)', 'xubuntu' ),
462+ 'type' => 'url',
463+ 'description' => __( 'The download link for the 32-bit image; for LTS, always use the latest point release link. Will be hidden after the release goes EOL.', 'xubuntu' )
464+ ),
465+ 'release_torrent_64bit' => array(
466+ 'label' => __( 'Torrent download link (64-bit)', 'xubuntu' ),
467+ 'type' => 'url',
468+ 'description' => __( 'The download link for the 64-bit image; for LTS, always use the latest point release link. Will be hidden after the release goes EOL.', 'xubuntu' )
469+ ),
470+ 'release_documentation_link' => array(
471+ 'label' => __( 'Online Documentation', 'xubuntu' ),
472+ 'type' => 'url',
473+ 'description' => __( 'URL for the online documentation for the release. Will be hidden after the release goes EOL.', 'xubuntu' )
474+ ),
475 );
476
477 add_action( 'release_edit_form_fields', 'release_taxonomy_custom_fields_edit', 10, 2 );
478@@ -81,9 +98,13 @@
479 echo '<label for="' . $id . '">' . $field['label'] . '</label>';
480 echo '</th>';
481 echo '<td>';
482- echo '<input name="term_meta[' . $id . ']" id="' . $id . '" value="' . $term_meta[$id] . '" type="' . $field['type'] . '" />';
483- if( 'date' == $field['type'] ) {
484- echo '<p class="description">Date in YYYY-MM-DD format.</p>';
485+ if( isset( $term_meta[$id] ) ) {
486+ echo '<input name="term_meta[' . $id . ']" id="' . $id . '" value="' . $term_meta[$id] . '" type="' . $field['type'] . '" />';
487+ } else {
488+ echo '<input name="term_meta[' . $id . ']" id="' . $id . '" value="" type="' . $field['type'] . '" />';
489+ }
490+ if( isset( $field['description'] ) ) {
491+ echo '<p class="description">' . $field['description'] . '</p>';
492 }
493 echo '</td>';
494 echo '</tr>';
495@@ -130,7 +151,7 @@
496 }
497
498 update_option( 'taxonomy_term_' . $term_id, $term_meta );
499- }
500+ }
501 }
502
503 /*
504@@ -147,7 +168,7 @@
505 foreach( $releases as $release ) {
506 $release_meta = get_option( 'taxonomy_term_' . $release->term_id );
507 if( $class != 'eol' && $release->release_is_eol == 1 ) {
508- echo '<li class="nobullet show-on-js"><a class="show-eol" href="#show-eol">Show EOL releases</a></li>';
509+ echo '<li class="nobullet show-on-js"><a class="show-eol" href="#show-eol">' . __( 'Show EOL releases', 'xubuntu' ) . '</a></li>';
510 $class = 'eol';
511 }
512
513@@ -293,11 +314,11 @@
514 }
515 }
516
517- usort( $releases, 'release_taxonomy_release_usort' );
518+ usort( $releases, 'release_taxonomy_release_usort_eol_last' );
519 return $releases;
520 }
521
522-function release_taxonomy_release_usort( $a, $b ) {
523+function release_taxonomy_release_usort_eol_last( $a, $b ) {
524 $eolcmp = strnatcmp( $a->release_is_eol, $b->release_is_eol );
525
526 if( $eolcmp != 0 ) {
527@@ -307,4 +328,76 @@
528 }
529 }
530
531+function release_taxonomy_release_usort( $a, $b ) {
532+ return strnatcmp( $b->name, $a->name );
533+}
534+
535+/*
536+ * Add a shortcode to print the torrent link buttons
537+ *
538+ */
539+
540+add_shortcode( 'torrents', 'release_torrent_links' );
541+
542+function release_torrent_links( $atts ) {
543+ $atts = shortcode_atts(
544+ array(
545+ 'release' => false,
546+ ),
547+ $atts,
548+ 'torrents'
549+ );
550+
551+ if( strlen( $atts['release'] ) < 1 ) {
552+ return;
553+ }
554+
555+ $release = get_term_by( 'slug', $atts['release'], 'release' );
556+ $release_meta = get_option( 'taxonomy_term_' . $release->term_id );
557+ $out = '';
558+
559+ if( isset( $release_meta['release_torrent_64bit'] ) ) {
560+ $out .= '<a class="button primary" href="' . $release_meta['release_torrent_64bit'] . '">' . _x( '<strong>64-bit</strong> systems', 'torrent download link', 'xubuntu' ) . '</a>';
561+ }
562+ if( isset( $release_meta['release_torrent_32bit'] ) ) {
563+ $out .= '<a class="button" href="' . $release_meta['release_torrent_32bit'] . '">' . __( '<strong>32-bit</strong> systems', 'torrent download link', 'xubuntu' ) . '</a>';
564+ }
565+
566+ if( strlen( $out ) > 0 ) {
567+ return '<p>' . $out . '</p>';
568+ }
569+}
570+
571+/*
572+ * Add a shortcode to list all online documentation links for released, non-EOL releases
573+ *
574+ */
575+
576+add_shortcode( 'documentation_links', 'release_documentation_links' );
577+
578+function release_documentation_links( $atts ) {
579+ $releases = release_taxonomy_get_releases_sorted( );
580+
581+ if( is_array( $releases ) ) {
582+ $date_now = new DateTime( 'now' );
583+ $out = '<ul>';
584+ foreach( $releases as $release ) {
585+ $release_meta = get_option( 'taxonomy_term_' . $release->term_id );
586+ $date_release = new DateTime( $release_meta['release_date'] );
587+
588+ if( strlen( $release_meta['release_codename'] ) > 0 ) {
589+ $release->name .= ' (' . $release_meta['release_codename'] . ')';
590+ }
591+ if( $release->release_is_eol == 0 && $date_release->format( 'Ymd' ) <= $date_now->format( 'Ymd' ) ) {
592+ $date_eol = new DateTime( $release_meta['release_eol'] );
593+ $out .= '<li><strong><a href="' . $release_meta['release_documentation_link'] . '">Xubuntu ' . $release->name . '</a></strong>, supported until ' . $date_eol->format( 'F Y' ) . '</li>';
594+ }
595+ }
596+ $out .= '</ul>';
597+
598+ return $out;
599+ }
600+}
601+
602+
603 ?>
604\ No newline at end of file
605
606=== modified file 'xubuntu-fifteen/functions.php'
607--- xubuntu-fifteen/functions.php 2016-09-02 20:08:49 +0000
608+++ xubuntu-fifteen/functions.php 2016-12-16 13:23:31 +0000
609@@ -15,6 +15,7 @@
610 include 'functions-features-articles.php';
611 include 'functions-features-releases.php';
612 include 'functions-features-release-links.php';
613+include 'functions-features-release-mirrors.php';
614
615 /*
616 * Configuration options
617
618=== modified file 'xubuntu-fifteen/header.php'
619--- xubuntu-fifteen/header.php 2016-09-02 20:08:49 +0000
620+++ xubuntu-fifteen/header.php 2016-12-16 13:23:31 +0000
621@@ -18,7 +18,7 @@
622
623 <header>
624 <div id="logo">
625- <a href="<?php echo home_url( '/' ); ?>"><img src="<?php bloginfo( 'stylesheet_directory' ); ?>/images/xubuntu-logo-45.png" alt="Xubuntu" /></a>
626+ <a href="<?php echo home_url( '/' ); ?>"><img src="<?php echo get_stylesheet_directory_uri( ); ?>/images/xubuntu-logo-45.png" alt="Xubuntu" /></a>
627 </div>
628
629 <div id="navi">
630
631=== modified file 'xubuntu-fifteen/index.php'
632--- xubuntu-fifteen/index.php 2016-09-02 20:08:49 +0000
633+++ xubuntu-fifteen/index.php 2016-12-16 13:23:31 +0000
634@@ -10,6 +10,8 @@
635 get_template_part( 'content', 'release' );
636 } elseif( is_attachment( ) ) {
637 get_template_part( 'content', 'attachment' );
638+ } elseif( is_page_template( 'template-releases-landing.php' ) ) {
639+ get_template_part( 'content', 'releases-landing' );
640 } elseif( have_posts( ) && !is_404( ) ) {
641 if( is_archive( ) ) {
642 get_template_part( 'content', 'archive' );
643@@ -27,7 +29,7 @@
644 ?>
645 </main>
646 <?php
647- if( is_tax( 'release' ) ) {
648+ if( is_tax( 'release' ) || is_page_template( 'template-releases-landing.php' ) ) {
649 get_template_part( 'widgets', 'release' );
650 } elseif( is_blog( ) || is_search( ) ) {
651 get_template_part( 'widgets', 'blog' );
652
653=== modified file 'xubuntu-fifteen/script-releases.js'
654--- xubuntu-fifteen/script-releases.js 2016-08-29 12:39:20 +0000
655+++ xubuntu-fifteen/script-releases.js 2016-12-16 13:23:31 +0000
656@@ -1,12 +1,21 @@
657 jQuery( function( ) {
658 jQuery( '.show-on-js' ).show( );
659
660+ /* Release list */
661 jQuery( '.releases .eol' ).hide( );
662 jQuery( '.releases .show-eol' ).click( function( ) {
663 jQuery( this ).hide( );
664 jQuery( '.releases .eol' ).fadeIn( );
665 } );
666
667- /* Admin */
668+ /* Release list (admin) */
669 jQuery( '.releases .eol input:checked' ).closest( '.eol' ).show( );
670+
671+ /* Mirror list */
672+ jQuery( '.mirrors .secondary' ).hide( );
673+ jQuery( '.mirrors .show-all' ).click( function( ) {
674+ jQuery( this ).hide( );
675+ jQuery( this ).closest( '.mirrors' ).addClass( 'expanded' );
676+ jQuery( this ).closest( '.mirrors' ).children( '.secondary' ).fadeIn( );
677+ } );
678 } );
679\ No newline at end of file
680
681=== modified file 'xubuntu-fifteen/style-admin.css'
682--- xubuntu-fifteen/style-admin.css 2016-08-28 23:39:44 +0000
683+++ xubuntu-fifteen/style-admin.css 2016-12-16 13:23:31 +0000
684@@ -8,4 +8,12 @@
685 body.post-type-release_link .misc-pub-post-status,
686 body.post-type-release_link .misc-pub-visibility {
687 display: none;
688+}
689+
690+body.post-type-download_mirror #post-body-content,
691+body.post-type-download_mirror #save-action,
692+body.post-type-download_mirror #preview-action,
693+body.post-type-download_mirror .misc-pub-post-status,
694+body.post-type-download_mirror .misc-pub-visibility {
695+ display: none;
696 }
697\ No newline at end of file
698
699=== modified file 'xubuntu-fifteen/style-common.css'
700--- xubuntu-fifteen/style-common.css 2016-09-02 20:08:49 +0000
701+++ xubuntu-fifteen/style-common.css 2016-12-16 13:23:31 +0000
702@@ -146,12 +146,14 @@
703 li { list-style-position: inside; }
704 main li { margin-bottom: 0.2em; list-style-position: outside; margin-left: 1.2em; }
705 main ul li { list-style-type: disc; }
706+ main ul.mirrors li,
707 main ul.link-list li,
708 main .post-list ul li,
709 main .post-post ul li {
710 list-style-type: none;
711 margin-left: 1em;
712 }
713+ main ul.mirrors li:before,
714 main ul.link-list li:before,
715 main .post-list ul li:before,
716 main .post-post ul li:before {
717
718=== modified file 'xubuntu-fifteen/style.css'
719--- xubuntu-fifteen/style.css 2016-09-02 20:26:40 +0000
720+++ xubuntu-fifteen/style.css 2016-12-16 13:23:31 +0000
721@@ -6,7 +6,7 @@
722 * Author: Pasi Lallinaho
723 * Author URI: http://open.knome.fi/
724 *
725- * Version: 2016-sept (r118)
726+ * Version: 2016-dec (r120)
727 *
728 */
729
730@@ -542,6 +542,32 @@
731 color: rgba( 0, 0, 0, 0.5 );
732 }
733
734+/* Mirror lists (code) */
735+
736+.mirrors .main {
737+ font-weight: 600;
738+}
739+
740+.mirrors .mirror-lp-url {
741+ display: none;
742+ margin-right: 1em;
743+ float: right;
744+}
745+ .mirrors.expanded .mirror-lp-url {
746+ display: inline-block;
747+ }
748+ .mirrors .mirror-lp-url a {
749+ font-size: 80%;
750+ color: rgba( 0, 0, 0, 0.5 );
751+ }
752+
753+.mirrors .nobullet a {
754+ font-size: 90%;
755+}
756+ .mirrors .nobullet::before {
757+ content: " " !important;
758+ }
759+
760 /* Search form */
761
762 .search-form {
763
764=== added file 'xubuntu-fifteen/template-releases-landing.php'
765--- xubuntu-fifteen/template-releases-landing.php 1970-01-01 00:00:00 +0000
766+++ xubuntu-fifteen/template-releases-landing.php 2016-12-16 13:23:31 +0000
767@@ -0,0 +1,2 @@
768+<?php /* Template Name: Releases landing page */ ?>
769+<?php include get_stylesheet_directory( ) . '/index.php'; ?>
770\ No newline at end of file

Subscribers

People subscribed via source and target branches