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
=== modified file 'xubuntu-fifteen/content-release.php'
--- xubuntu-fifteen/content-release.php 2016-12-14 23:41:34 +0000
+++ xubuntu-fifteen/content-release.php 2016-12-16 13:23:31 +0000
@@ -1,58 +1,71 @@
1<?php1<?php
2 // Get release information
2 $release = get_term_by( 'slug', get_query_var( 'release' ), 'release', OBJECT );3 $release = get_term_by( 'slug', get_query_var( 'release' ), 'release', OBJECT );
3 $release_meta = get_option( 'taxonomy_term_' . $release->term_id );4 $release_meta = get_option( 'taxonomy_term_' . $release->term_id );
45
6 // Get release timestamp
5 if( isset( $release_meta['release_date'] ) && $release_meta['release_date'] > 0 ) {7 if( isset( $release_meta['release_date'] ) && $release_meta['release_date'] > 0 ) {
6 list( $year, $month, $day ) = explode( '-', $release_meta['release_date'] );8 list( $year, $month, $day ) = explode( '-', $release_meta['release_date'] );
7 $release_time = gmmktime( 0, 0, 0, $month, $day, $year );9 $release_time = gmmktime( 0, 0, 0, $month, $day, $year );
8 }10 }
11 // Get EOL timestamp
9 if( isset( $release_meta['release_eol'] ) && $release_meta['release_eol'] > 0 ) {12 if( isset( $release_meta['release_eol'] ) && $release_meta['release_eol'] > 0 ) {
10 list( $year, $month, $day ) = explode( '-', $release_meta['release_eol'] );13 list( $year, $month, $day ) = explode( '-', $release_meta['release_eol'] );
11 $eol_time = gmmktime( 0, 0, 1, $month, $day, $year );14 $eol_time = gmmktime( 0, 0, 1, $month, $day, $year );
12 }15 }
1316?>
14 echo '<h1 class="post-title">Xubuntu ' . single_term_title( '', false ) . '</h1>';17
15 if( strlen( $release_meta['release_codename'] ) > 0 || isset( $release_time ) || isset( $eol_time ) ) {18<h1 class="post-title">Xubuntu <?php echo single_term_title( '', false ); ?></h1>
19<?php echo wpautop( $release->description ); ?>
20
21<?php
22 // Release information
23 $info = '';
24 if( strlen( $release_meta['release_codename'] ) > 0 ) {
25 $info .= '<dt>' . __( 'Codename', 'xubuntu' ) . '</dt><dd>' . $release_meta['release_codename'] . '</dd>';
26 }
27 if( isset( $release_time ) ) {
28 $info .= '<dt>' . __( 'Release Date', 'xubuntu' ) . '</dt><dd>' . gmdate( 'F j, Y', $release_time ) . '</dd>';
29 }
30 if( isset( $eol_time ) ) {
31 $info .= '<dt>' . __( 'End of Life', 'xubuntu' ) . '</dt><dd>' . gmdate( 'F j, Y', $eol_time ) . '</dd>';
32 }
33
34 // Release links
35 if( isset( $release_meta['release_torrent_64bit'] ) ) {
36 $info_links[] = '<strong><a href="' . $release_meta['release_torrent_64bit'] . '">' . __( 'Torrent download for 64-bit systems', 'xubuntu' ) . '</a></strong>';
37 }
38 if( isset( $release_meta['release_torrent_32bit'] ) ) {
39 $info_links[] = '<strong><a href="' . $release_meta['release_torrent_32bit'] . '">' . __( 'Torrent download for 32-bit systems', 'xubuntu' ) . '</a></strong>';
40 }
41 if( isset( $release_meta['release_documentation_link'] ) ) {
42 $info_links[] = '<a href="' . $release_meta['release_documentation_link'] . '">' . __( 'Online Documentation', 'xubuntu' ) . '</a>';
43 }
44 if( isset( $info_links ) ) {
45 $info .= '<dt>' . __( 'Release Links', 'xubuntu' ) . '</dt><dd>' . implode( $info_links, '<br />' ) . '</dd>';
46 }
47
48 if( strlen( $info ) > 0 ) {
16 echo '<dl class="release-info group">';49 echo '<dl class="release-info group">';
17 if( strlen( $release_meta['release_codename'] ) > 0 ) {50 echo $info;
18 echo '<dt>' . __( 'Codename', 'xubuntu' ) . '</dt><dd>' . $release_meta['release_codename'] . '</dd>';
19 }
20 if( isset( $release_time ) ) {
21 echo '<dt>' . __( 'Release Date', 'xubuntu' ) . '</dt><dd>' . gmdate( 'F j, Y', $release_time ) . '</dd>';
22 }
23 if( isset( $eol_time ) ) {
24 echo '<dt>' . __( 'End of Life', 'xubuntu' ) . '</dt><dd>' . gmdate( 'F j, Y', $eol_time ) . '</dd>';
25 }
26 echo '</dl>';51 echo '</dl>';
27 }52 }
28
29 echo wpautop( $release->description );
30?>53?>
3154
32<?php55<?php
33 $official_links = release_link_list( array( 'official', 'official-expiring' ), $release->term_id );56 // Direct download links
3457 if( $eol_time > time( ) ) {
35 if( $official_links ) {58 if( shortcode_exists( 'mirrors' ) ) {
36 $output_links = array( );59 $mirrors = do_shortcode( '[mirrors release=' . $release->name . ']' );
3760 if( isset( $mirrors ) ) {
38 foreach( $official_links as $official_link ) {61 echo '<h2>' . __( 'Direct Downloads', 'xubuntu' ) . '</h2>';
39 $meta = get_post_meta( $official_link->ID );62 echo $mirrors;
40 if( ( $meta['link_type'][0] == 'official-expiring' && time( ) <= $eol_time ) || $meta['link_type'][0] == 'official' ) {63 }
41 $output_links[] = '<li><strong><a href="' . $meta['link_url'][0] . '">' . $official_link->post_title . '</a></strong></li>';
42 }
43 }
44
45 if( count( $output_links ) > 0 ) {
46 echo '<h2>' . __( 'Official Links', 'xubuntu' ) . '</h2>';
47 echo '<ul class="link-list">';
48 foreach( $output_links as $link ) {
49 echo $link;
50 }
51 echo '</ul>';
52 }64 }
53 }65 }
54?>66?>
5567
68<?php // Articles ?>
56<?php if( have_posts( ) ) { ?>69<?php if( have_posts( ) ) { ?>
57 <h2><?php _e( 'Articles', 'xubuntu' ); ?></h2>70 <h2><?php _e( 'Articles', 'xubuntu' ); ?></h2>
58 <ul class="posts-list">71 <ul class="posts-list">
@@ -69,6 +82,7 @@
69<?php } ?>82<?php } ?>
7083
71<?php84<?php
85 // Press links
72 $press_links = release_link_list( 'press', $release->term_id );86 $press_links = release_link_list( 'press', $release->term_id );
73 if( $press_links ) {87 if( $press_links ) {
74 echo '<h2>' . __( 'In the Press', 'xubuntu' ) . '</h2>';88 echo '<h2>' . __( 'In the Press', 'xubuntu' ) . '</h2>';
@@ -77,6 +91,7 @@
77?>91?>
7892
79<?php93<?php
94 // Attachments, usually screenshots
80 $attachments = get_posts( array(95 $attachments = get_posts( array(
81 'post_type' => 'attachment',96 'post_type' => 'attachment',
82 'posts_per_page' => -1,97 'posts_per_page' => -1,
@@ -99,4 +114,4 @@
99 echo '<h2>' . __( 'Screenshots', 'xubuntu' ) . '</h2>';114 echo '<h2>' . __( 'Screenshots', 'xubuntu' ) . '</h2>';
100 echo do_shortcode( '[gallery size="xubuntu_split_to_3" link="file" ids="' . $gallery_ids . '"]' );115 echo do_shortcode( '[gallery size="xubuntu_split_to_3" link="file" ids="' . $gallery_ids . '"]' );
101 }116 }
102?>117?>
103\ No newline at end of file118\ No newline at end of file
104119
=== added file 'xubuntu-fifteen/content-releases-landing.php'
--- xubuntu-fifteen/content-releases-landing.php 1970-01-01 00:00:00 +0000
+++ xubuntu-fifteen/content-releases-landing.php 2016-12-16 13:23:31 +0000
@@ -0,0 +1,40 @@
1<?php while( have_posts( ) ) { ?>
2 <?php the_post( ); ?>
3 <div <?php post_class( 'group' ) ?> id="post-<?php the_ID( ); ?>">
4 <?php if( !is_front_page( ) ) { ?>
5 <?php if( !is_page( ) ) { ?>
6 <h1 class="post-title"><a href="<?php the_permalink( ); ?>"><?php the_title( ); ?></a></h1>
7 <?php } else { ?>
8 <h1 class="post-title"><?php the_title( ); ?></h1>
9 <?php } ?>
10 <?php } ?>
11
12 <div class="post-post">
13 <div class="post-entry entry">
14 <?php the_content( __( 'Read the rest of this entry ยป', 'xubuntu' ) ); ?>
15 </div>
16 </div>
17 </div>
18<?php } ?>
19
20<?php
21 $releases = release_taxonomy_get_releases_sorted( );
22
23 if( is_array( $releases ) ) {
24 $date_now = new DateTime( 'now' );
25 foreach( $releases as $release ) {
26 $release_meta = get_option( 'taxonomy_term_' . $release->term_id );
27 $date_release = new DateTime( $release_meta['release_date'] );
28
29 if( strlen( $release_meta['release_codename'] ) > 0 ) {
30 $release->name .= ' (' . $release_meta['release_codename'] . ')';
31 }
32 if( $release->release_is_eol == 0 && $date_release->format( 'Ymd' ) <= $date_now->format( 'Ymd' ) ) {
33 $date_eol = new DateTime( $release_meta['release_eol'] );
34 echo '<h2>Xubuntu ' . $release->name . '</h2>';
35 echo wpautop( $release->description );
36 echo '<p><a class="button primary" href="' . get_term_link( $release ) . '">' . __( 'Visit the release page', 'xubuntu' ) . '</a></p>';
37 }
38 }
39 }
40?>
0\ No newline at end of file41\ No newline at end of file
142
=== modified file 'xubuntu-fifteen/functions-features-release-links.php'
--- xubuntu-fifteen/functions-features-release-links.php 2016-12-14 23:41:34 +0000
+++ xubuntu-fifteen/functions-features-release-links.php 2016-12-16 13:23:31 +0000
@@ -49,7 +49,6 @@
49 add_meta_box( 'release_link_type', _x( 'Link Type', 'meta box title', 'xubuntu' ), 'release_link_meta_box_link_type', 'release_link', 'normal', 'high' ); 49 add_meta_box( 'release_link_type', _x( 'Link Type', 'meta box title', 'xubuntu' ), 'release_link_meta_box_link_type', 'release_link', 'normal', 'high' );
50 add_meta_box( 'release_link_link', _x( 'Link', 'meta box title', 'xubuntu' ), 'release_link_meta_box_link', 'release_link', 'normal', 'high' );50 add_meta_box( 'release_link_link', _x( 'Link', 'meta box title', 'xubuntu' ), 'release_link_meta_box_link', 'release_link', 'normal', 'high' );
51 add_meta_box( 'release_link_author', _x( 'Author', 'meta box title', 'xubuntu' ), 'release_link_meta_box_author', 'release_link', 'normal' );51 add_meta_box( 'release_link_author', _x( 'Author', 'meta box title', 'xubuntu' ), 'release_link_meta_box_author', 'release_link', 'normal' );
52
53}52}
5453
55function release_link_meta_box_link_type( $post, $box ) {54function release_link_meta_box_link_type( $post, $box ) {
@@ -74,7 +73,6 @@
7473
75 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>';74 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>';
76 echo '<p><input type="text" class="widefat" name="link_url" placeholder="' . _x( 'http://example.com/xubuntu-review/', 'placeholder text', 'xubuntu' ) . '" value="' . $link_url . '" /></p>';75 echo '<p><input type="text" class="widefat" name="link_url" placeholder="' . _x( 'http://example.com/xubuntu-review/', 'placeholder text', 'xubuntu' ) . '" value="' . $link_url . '" /></p>';
77 echo '</label></p>';
78}76}
7977
80function release_link_meta_box_author( $post, $box ) {78function release_link_meta_box_author( $post, $box ) {
@@ -237,6 +235,7 @@
237 }235 }
238236
239 $releases = get_terms( 'release', $args );237 $releases = get_terms( 'release', $args );
238 usort( $releases, 'release_taxonomy_release_usort' );
240 $navi = '';239 $navi = '';
241 $links_out = '';240 $links_out = '';
242241
@@ -245,7 +244,11 @@
245 if( count( $links ) > 0 ) {244 if( count( $links ) > 0 ) {
246 $release_meta = get_option( 'taxonomy_term_' . $release->term_id );245 $release_meta = get_option( 'taxonomy_term_' . $release->term_id );
247 $navi .= '<a class="button" href="#' . $release->slug . '">' . $release->name . '</a>';246 $navi .= '<a class="button" href="#' . $release->slug . '">' . $release->name . '</a>';
248 $links_out .= '<h2 id="' . $release->slug . '">' . $release->name . ' (' . $release_meta['release_codename'] . ')</h2>' . release_link_press_output( $links );247 $links_out .= '<h2 id="' . $release->slug . '">' . $release->name;
248 if( strlen( $release_meta['release_codename'] ) > 0 ) {
249 $links_out .= ' (' . $release_meta['release_codename'] . ')';
250 }
251 $links_out .= '</h2>' . release_link_press_output( $links );
249 }252 }
250 }253 }
251254
252255
=== added file 'xubuntu-fifteen/functions-features-release-mirrors.php'
--- xubuntu-fifteen/functions-features-release-mirrors.php 1970-01-01 00:00:00 +0000
+++ xubuntu-fifteen/functions-features-release-mirrors.php 2016-12-16 13:23:31 +0000
@@ -0,0 +1,216 @@
1<?php
2
3/*
4 * Register the release download mirror post type
5 *
6 */
7
8add_action( 'init', 'release_download_mirror_register' );
9
10function release_download_mirror_register( ) {
11 register_post_type(
12 'download_mirror',
13 array(
14 'label' => _x( 'Download Mirrors', 'post type label', 'xubuntu' ),
15 'labels' => array(
16 'name' => _x( 'Download Mirrors', 'post type label: name', 'xubuntu' ),
17 'singular_name' => _x( 'Download Mirror', 'post type label: singular_name', 'xubuntu' ),
18 'add_new_item' => _x( 'Add New Download Mirror', 'post type label: add_new_item', 'xubuntu' ),
19 'edit_item' => _x( 'Edit Download Mirror', 'post type label: edit_item', 'xubuntu' ),
20 'view_item' => _x( 'View Download Mirror', 'post type label: view_item', 'xubuntu' ),
21 'search_items' => _x( 'Search Download Mirrors', 'post type label: search_items', 'xubuntu' ),
22 'not_found' => _x( 'No download mirrors found.', 'post type label: not_found', 'xubuntu' ),
23 'all_items' => _x( 'All Download Mirrors', 'post type label: all_items', 'xubuntu' ),
24 'menu_name' => _x( 'DL Mirrors', 'post type label: menu_name', 'xubuntu' ),
25 ),
26 'description' => _x( 'Xubuntu Download Mirrors', 'post type description', 'xubuntu' ),
27 'public' => false,
28 'show_ui' => true,
29 'show_in_menu' => true,
30 'menu_position' => 21,
31 'menu_icon' => 'dashicons-download',
32 'supports' => false,
33 /* 'taxonomies' => array(
34 'release'
35 ), */
36 'rewrite' => false,
37 'query_var' => false
38 )
39 );
40}
41
42/*
43 * Add meta boxes for the post type
44 *
45 */
46
47add_action( 'add_meta_boxes', 'release_download_mirror_add_meta_boxes' );
48
49function release_download_mirror_add_meta_boxes( ) {
50 add_meta_box( 'release_download_mirror_info', _x( 'Mirror Information', 'meta box title', 'xubuntu' ), 'release_download_mirror_meta_box_info', 'download_mirror', 'normal', 'high' );
51 add_meta_box( 'release_download_mirror_location', _x( 'Mirror Location', 'meta box title', 'xubuntu' ), 'release_download_mirror_meta_box_location', 'download_mirror', 'normal' );
52 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' );
53 add_meta_box( 'release_download_mirror_activity', _x( 'Activity', 'meta box title', 'xubuntu' ), 'release_download_mirror_meta_box_activity', 'download_mirror', 'side' );
54}
55
56function release_download_mirror_meta_box_info( $post, $box ) {
57 $mirror_name = get_post_meta( $post->ID, 'mirror_name', true );
58 $mirror_lp_url = get_post_meta( $post->ID, 'mirror_lp_url', true );
59
60 echo '<p><input type="text" class="widefat" name="mirror_name" placeholder="' . _x( 'University of Mirrors', 'placeholder text', 'xubuntu' ) . '" value="' . $mirror_name . '" /></p>';
61 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>';
62}
63
64function release_download_mirror_meta_box_location( $post, $box ) {
65 $mirror_area = get_post_meta( $post->ID, 'mirror_area', true );
66 $mirror_country = get_post_meta( $post->ID, 'mirror_country', true );
67
68 $mirror_areas = array(
69 'unknown' => __( 'Unknown or Other', 'xubuntu' ),
70 'africa' => __( 'Africa', 'xubuntu' ),
71 'americas' => __( 'Americas', 'xubuntu' ),
72 'asia' => __( 'Asia', 'xubuntu' ),
73 'europe' => __( 'Europe', 'xubuntu' ),
74 'oceania' => __( 'Oceania', 'xubuntu' ),
75 );
76
77 echo '<select class="widefat" name="mirror_area">';
78 foreach( $mirror_areas as $value => $name ) {
79 echo '<option value="' . $value . '" ' . selected( $mirror_area, $value, false ) . '>' . $name . '</option>';
80 }
81 echo '</select>';
82
83 echo '<p><input type="text" class="widefat" name="mirror_country" placeholder="' . _x( 'Finland', 'placeholder text', 'xubuntu' ) . '" value="' . $mirror_country . '" /></p>';
84}
85
86function release_download_mirror_meta_box_link_template( $post, $box ) {
87 $mirror_http_template = get_post_meta( $post->ID, 'mirror_http_template', true );
88
89 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>';
90 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>';
91}
92
93function release_download_mirror_meta_box_activity( $post, $box ) {
94 $mirror_main = get_post_meta( $post->ID, 'mirror_main', true );
95 $mirror_active = get_post_meta( $post->ID, 'mirror_active', true );
96
97 echo '<ul>';
98 echo '<li><label class="selectit">';
99 echo '<input type="checkbox" name="mirror_active" ' . checked( $mirror_active, 1, false ) . '/>';
100 echo _x( 'Is active?', 'release mirror activity', 'xubuntu' );
101 echo '</label></li>';
102 echo '<li><label class="selectit">';
103 echo '<input type="checkbox" name="mirror_main" ' . checked( $mirror_main, 1, false ) . '/>';
104 echo __( 'Is a main download mirror?', 'release mirror status', 'xubuntu' );
105 echo '</label></li>';
106 echo '</ul>';
107}
108
109/*
110 * Handle saving the link data
111 *
112 */
113
114add_action( 'save_post_download_mirror', 'release_download_mirror_save_post' );
115
116function release_download_mirror_save_post( $post_id ) {
117 global $wpdb;
118
119 $fields_to_save = array(
120 'mirror_name',
121 'mirror_lp_url',
122 'mirror_area',
123 'mirror_country',
124 'mirror_http_template',
125 );
126
127 foreach( $fields_to_save as $field ) {
128 if( isset( $_POST[$field] ) ) {
129 update_post_meta( $post_id, $field, sanitize_text_field( $_POST[$field] ) );
130 }
131 }
132
133 $bool_fields_to_save = array(
134 'mirror_active',
135 'mirror_main',
136 );
137
138 foreach( $bool_fields_to_save as $field ) {
139 if( $_POST[$field] != 'on' ) { // TODO
140 update_post_meta( $post_id, $field, 0 );
141 } else {
142 update_post_meta( $post_id, $field, 1 );
143 }
144 }
145
146 if( isset( $_POST['mirror_name'] ) ) {
147 $wpdb->update( $wpdb->posts, array( 'post_title' => $_POST['mirror_name'] ), array( 'ID' => $post_id ) );
148 }
149}
150
151/*
152 * Add a shortcode to print the list of mirrors
153 *
154 */
155
156add_shortcode( 'mirrors', 'release_download_mirror_shortcode_downloads' );
157
158function release_download_mirror_shortcode_downloads( $atts ) {
159 $atts = shortcode_atts(
160 array(
161 'release' => false,
162 ),
163 $atts,
164 'mirrors'
165 );
166
167 if( strlen( $atts['release'] ) < 1 ) {
168 return;
169 }
170
171 $args = array(
172 'post_type' => 'download_mirror',
173 'posts_per_page' => -1,
174 'orderby' => 'meta_value',
175 'order' => 'ASC',
176 'meta_key' => 'mirror_country',
177 'meta_query' => array(
178 array(
179 'key' => 'mirror_active',
180 'value' => 1,
181 'compare' => '='
182 ),
183 ),
184 );
185 $mirrors = get_posts( $args );
186
187 if( count( $mirrors ) > 0 ) {
188 $out = '<ul class="columnlist mirrors">';
189 foreach( $mirrors as $mirror ) {
190 $mirror_meta = get_post_meta( $mirror->ID );
191 if( $mirror_meta['mirror_main'][0] == 1 ) {
192 $class = 'main';
193 } else {
194 $class = 'secondary';
195 }
196
197 $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>';
198 if( strlen( $mirror_meta['mirror_lp_url'][0] ) > 0 ) {
199 $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>';
200 }
201 $out .= '</li>';
202 }
203 $out .= '<li class="nobullet show-on-js"><a class="show-all" href="#show-all">' . __( 'Show all mirrors with full information', 'xubuntu' ) . '</a></li>';
204 $out .= '</ul>';
205
206 return $out;
207 }
208}
209
210function release_download_url( $template, $release_slug ) {
211 $release = get_term_by( 'slug', $release_slug, 'release' );
212
213 return str_replace( 'VERSION', $release->name, $template );
214}
215
216?>
0\ No newline at end of file217\ No newline at end of file
1218
=== modified file 'xubuntu-fifteen/functions-features-releases.php'
--- xubuntu-fifteen/functions-features-releases.php 2016-08-29 12:39:20 +0000
+++ xubuntu-fifteen/functions-features-releases.php 2016-12-16 13:23:31 +0000
@@ -58,12 +58,29 @@
58 ),58 ),
59 'release_date' => array(59 'release_date' => array(
60 'label' => __( 'Release Date', 'xubuntu' ),60 'label' => __( 'Release Date', 'xubuntu' ),
61 'type' => 'date'61 'type' => 'date',
62 'description' => __( 'Date in YYYY-MM-DD format.', 'xubuntu' )
62 ),63 ),
63 'release_eol' => array(64 'release_eol' => array(
64 'label' => __( 'Release End of Life', 'xubuntu' ),65 'label' => __( 'Release End of Life', 'xubuntu' ),
65 'type' => 'date'66 'type' => 'date',
66 )67 'description' => __( 'Date in YYYY-MM-DD format.', 'xubuntu' )
68 ),
69 'release_torrent_32bit' => array(
70 'label' => __( 'Torrent download link (32-bit)', 'xubuntu' ),
71 'type' => 'url',
72 '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' )
73 ),
74 'release_torrent_64bit' => array(
75 'label' => __( 'Torrent download link (64-bit)', 'xubuntu' ),
76 'type' => 'url',
77 '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' )
78 ),
79 'release_documentation_link' => array(
80 'label' => __( 'Online Documentation', 'xubuntu' ),
81 'type' => 'url',
82 'description' => __( 'URL for the online documentation for the release. Will be hidden after the release goes EOL.', 'xubuntu' )
83 ),
67);84);
6885
69add_action( 'release_edit_form_fields', 'release_taxonomy_custom_fields_edit', 10, 2 );86add_action( 'release_edit_form_fields', 'release_taxonomy_custom_fields_edit', 10, 2 );
@@ -81,9 +98,13 @@
81 echo '<label for="' . $id . '">' . $field['label'] . '</label>';98 echo '<label for="' . $id . '">' . $field['label'] . '</label>';
82 echo '</th>';99 echo '</th>';
83 echo '<td>';100 echo '<td>';
84 echo '<input name="term_meta[' . $id . ']" id="' . $id . '" value="' . $term_meta[$id] . '" type="' . $field['type'] . '" />';101 if( isset( $term_meta[$id] ) ) {
85 if( 'date' == $field['type'] ) {102 echo '<input name="term_meta[' . $id . ']" id="' . $id . '" value="' . $term_meta[$id] . '" type="' . $field['type'] . '" />';
86 echo '<p class="description">Date in YYYY-MM-DD format.</p>';103 } else {
104 echo '<input name="term_meta[' . $id . ']" id="' . $id . '" value="" type="' . $field['type'] . '" />';
105 }
106 if( isset( $field['description'] ) ) {
107 echo '<p class="description">' . $field['description'] . '</p>';
87 }108 }
88 echo '</td>';109 echo '</td>';
89 echo '</tr>';110 echo '</tr>';
@@ -130,7 +151,7 @@
130 } 151 }
131152
132 update_option( 'taxonomy_term_' . $term_id, $term_meta );153 update_option( 'taxonomy_term_' . $term_id, $term_meta );
133 } 154 }
134}155}
135156
136/*157/*
@@ -147,7 +168,7 @@
147 foreach( $releases as $release ) {168 foreach( $releases as $release ) {
148 $release_meta = get_option( 'taxonomy_term_' . $release->term_id );169 $release_meta = get_option( 'taxonomy_term_' . $release->term_id );
149 if( $class != 'eol' && $release->release_is_eol == 1 ) {170 if( $class != 'eol' && $release->release_is_eol == 1 ) {
150 echo '<li class="nobullet show-on-js"><a class="show-eol" href="#show-eol">Show EOL releases</a></li>';171 echo '<li class="nobullet show-on-js"><a class="show-eol" href="#show-eol">' . __( 'Show EOL releases', 'xubuntu' ) . '</a></li>';
151 $class = 'eol';172 $class = 'eol';
152 }173 }
153174
@@ -293,11 +314,11 @@
293 }314 }
294 }315 }
295316
296 usort( $releases, 'release_taxonomy_release_usort' );317 usort( $releases, 'release_taxonomy_release_usort_eol_last' );
297 return $releases;318 return $releases;
298}319}
299320
300function release_taxonomy_release_usort( $a, $b ) {321function release_taxonomy_release_usort_eol_last( $a, $b ) {
301 $eolcmp = strnatcmp( $a->release_is_eol, $b->release_is_eol );322 $eolcmp = strnatcmp( $a->release_is_eol, $b->release_is_eol );
302323
303 if( $eolcmp != 0 ) {324 if( $eolcmp != 0 ) {
@@ -307,4 +328,76 @@
307 }328 }
308}329}
309330
331function release_taxonomy_release_usort( $a, $b ) {
332 return strnatcmp( $b->name, $a->name );
333}
334
335/*
336 * Add a shortcode to print the torrent link buttons
337 *
338 */
339
340add_shortcode( 'torrents', 'release_torrent_links' );
341
342function release_torrent_links( $atts ) {
343 $atts = shortcode_atts(
344 array(
345 'release' => false,
346 ),
347 $atts,
348 'torrents'
349 );
350
351 if( strlen( $atts['release'] ) < 1 ) {
352 return;
353 }
354
355 $release = get_term_by( 'slug', $atts['release'], 'release' );
356 $release_meta = get_option( 'taxonomy_term_' . $release->term_id );
357 $out = '';
358
359 if( isset( $release_meta['release_torrent_64bit'] ) ) {
360 $out .= '<a class="button primary" href="' . $release_meta['release_torrent_64bit'] . '">' . _x( '<strong>64-bit</strong> systems', 'torrent download link', 'xubuntu' ) . '</a>';
361 }
362 if( isset( $release_meta['release_torrent_32bit'] ) ) {
363 $out .= '<a class="button" href="' . $release_meta['release_torrent_32bit'] . '">' . __( '<strong>32-bit</strong> systems', 'torrent download link', 'xubuntu' ) . '</a>';
364 }
365
366 if( strlen( $out ) > 0 ) {
367 return '<p>' . $out . '</p>';
368 }
369}
370
371/*
372 * Add a shortcode to list all online documentation links for released, non-EOL releases
373 *
374 */
375
376add_shortcode( 'documentation_links', 'release_documentation_links' );
377
378function release_documentation_links( $atts ) {
379 $releases = release_taxonomy_get_releases_sorted( );
380
381 if( is_array( $releases ) ) {
382 $date_now = new DateTime( 'now' );
383 $out = '<ul>';
384 foreach( $releases as $release ) {
385 $release_meta = get_option( 'taxonomy_term_' . $release->term_id );
386 $date_release = new DateTime( $release_meta['release_date'] );
387
388 if( strlen( $release_meta['release_codename'] ) > 0 ) {
389 $release->name .= ' (' . $release_meta['release_codename'] . ')';
390 }
391 if( $release->release_is_eol == 0 && $date_release->format( 'Ymd' ) <= $date_now->format( 'Ymd' ) ) {
392 $date_eol = new DateTime( $release_meta['release_eol'] );
393 $out .= '<li><strong><a href="' . $release_meta['release_documentation_link'] . '">Xubuntu ' . $release->name . '</a></strong>, supported until ' . $date_eol->format( 'F Y' ) . '</li>';
394 }
395 }
396 $out .= '</ul>';
397
398 return $out;
399 }
400}
401
402
310?>403?>
311\ No newline at end of file404\ No newline at end of file
312405
=== modified file 'xubuntu-fifteen/functions.php'
--- xubuntu-fifteen/functions.php 2016-09-02 20:08:49 +0000
+++ xubuntu-fifteen/functions.php 2016-12-16 13:23:31 +0000
@@ -15,6 +15,7 @@
15include 'functions-features-articles.php';15include 'functions-features-articles.php';
16include 'functions-features-releases.php';16include 'functions-features-releases.php';
17include 'functions-features-release-links.php';17include 'functions-features-release-links.php';
18include 'functions-features-release-mirrors.php';
1819
19/*20/*
20 * Configuration options21 * Configuration options
2122
=== modified file 'xubuntu-fifteen/header.php'
--- xubuntu-fifteen/header.php 2016-09-02 20:08:49 +0000
+++ xubuntu-fifteen/header.php 2016-12-16 13:23:31 +0000
@@ -18,7 +18,7 @@
1818
19<header>19<header>
20 <div id="logo">20 <div id="logo">
21 <a href="<?php echo home_url( '/' ); ?>"><img src="<?php bloginfo( 'stylesheet_directory' ); ?>/images/xubuntu-logo-45.png" alt="Xubuntu" /></a>21 <a href="<?php echo home_url( '/' ); ?>"><img src="<?php echo get_stylesheet_directory_uri( ); ?>/images/xubuntu-logo-45.png" alt="Xubuntu" /></a>
22 </div>22 </div>
2323
24 <div id="navi">24 <div id="navi">
2525
=== modified file 'xubuntu-fifteen/index.php'
--- xubuntu-fifteen/index.php 2016-09-02 20:08:49 +0000
+++ xubuntu-fifteen/index.php 2016-12-16 13:23:31 +0000
@@ -10,6 +10,8 @@
10 get_template_part( 'content', 'release' );10 get_template_part( 'content', 'release' );
11 } elseif( is_attachment( ) ) {11 } elseif( is_attachment( ) ) {
12 get_template_part( 'content', 'attachment' );12 get_template_part( 'content', 'attachment' );
13 } elseif( is_page_template( 'template-releases-landing.php' ) ) {
14 get_template_part( 'content', 'releases-landing' );
13 } elseif( have_posts( ) && !is_404( ) ) {15 } elseif( have_posts( ) && !is_404( ) ) {
14 if( is_archive( ) ) {16 if( is_archive( ) ) {
15 get_template_part( 'content', 'archive' );17 get_template_part( 'content', 'archive' );
@@ -27,7 +29,7 @@
27 ?>29 ?>
28 </main>30 </main>
29 <?php31 <?php
30 if( is_tax( 'release' ) ) {32 if( is_tax( 'release' ) || is_page_template( 'template-releases-landing.php' ) ) {
31 get_template_part( 'widgets', 'release' );33 get_template_part( 'widgets', 'release' );
32 } elseif( is_blog( ) || is_search( ) ) {34 } elseif( is_blog( ) || is_search( ) ) {
33 get_template_part( 'widgets', 'blog' );35 get_template_part( 'widgets', 'blog' );
3436
=== modified file 'xubuntu-fifteen/script-releases.js'
--- xubuntu-fifteen/script-releases.js 2016-08-29 12:39:20 +0000
+++ xubuntu-fifteen/script-releases.js 2016-12-16 13:23:31 +0000
@@ -1,12 +1,21 @@
1jQuery( function( ) {1jQuery( function( ) {
2 jQuery( '.show-on-js' ).show( );2 jQuery( '.show-on-js' ).show( );
33
4 /* Release list */
4 jQuery( '.releases .eol' ).hide( );5 jQuery( '.releases .eol' ).hide( );
5 jQuery( '.releases .show-eol' ).click( function( ) {6 jQuery( '.releases .show-eol' ).click( function( ) {
6 jQuery( this ).hide( );7 jQuery( this ).hide( );
7 jQuery( '.releases .eol' ).fadeIn( );8 jQuery( '.releases .eol' ).fadeIn( );
8 } );9 } );
910
10 /* Admin */11 /* Release list (admin) */
11 jQuery( '.releases .eol input:checked' ).closest( '.eol' ).show( );12 jQuery( '.releases .eol input:checked' ).closest( '.eol' ).show( );
13
14 /* Mirror list */
15 jQuery( '.mirrors .secondary' ).hide( );
16 jQuery( '.mirrors .show-all' ).click( function( ) {
17 jQuery( this ).hide( );
18 jQuery( this ).closest( '.mirrors' ).addClass( 'expanded' );
19 jQuery( this ).closest( '.mirrors' ).children( '.secondary' ).fadeIn( );
20 } );
12} );21} );
13\ No newline at end of file22\ No newline at end of file
1423
=== modified file 'xubuntu-fifteen/style-admin.css'
--- xubuntu-fifteen/style-admin.css 2016-08-28 23:39:44 +0000
+++ xubuntu-fifteen/style-admin.css 2016-12-16 13:23:31 +0000
@@ -8,4 +8,12 @@
8body.post-type-release_link .misc-pub-post-status,8body.post-type-release_link .misc-pub-post-status,
9body.post-type-release_link .misc-pub-visibility {9body.post-type-release_link .misc-pub-visibility {
10 display: none;10 display: none;
11}
12
13body.post-type-download_mirror #post-body-content,
14body.post-type-download_mirror #save-action,
15body.post-type-download_mirror #preview-action,
16body.post-type-download_mirror .misc-pub-post-status,
17body.post-type-download_mirror .misc-pub-visibility {
18 display: none;
11}19}
12\ No newline at end of file20\ No newline at end of file
1321
=== modified file 'xubuntu-fifteen/style-common.css'
--- xubuntu-fifteen/style-common.css 2016-09-02 20:08:49 +0000
+++ xubuntu-fifteen/style-common.css 2016-12-16 13:23:31 +0000
@@ -146,12 +146,14 @@
146li { list-style-position: inside; }146li { list-style-position: inside; }
147 main li { margin-bottom: 0.2em; list-style-position: outside; margin-left: 1.2em; }147 main li { margin-bottom: 0.2em; list-style-position: outside; margin-left: 1.2em; }
148 main ul li { list-style-type: disc; }148 main ul li { list-style-type: disc; }
149 main ul.mirrors li,
149 main ul.link-list li,150 main ul.link-list li,
150 main .post-list ul li,151 main .post-list ul li,
151 main .post-post ul li {152 main .post-post ul li {
152 list-style-type: none;153 list-style-type: none;
153 margin-left: 1em;154 margin-left: 1em;
154 }155 }
156 main ul.mirrors li:before,
155 main ul.link-list li:before,157 main ul.link-list li:before,
156 main .post-list ul li:before,158 main .post-list ul li:before,
157 main .post-post ul li:before {159 main .post-post ul li:before {
158160
=== modified file 'xubuntu-fifteen/style.css'
--- xubuntu-fifteen/style.css 2016-09-02 20:26:40 +0000
+++ xubuntu-fifteen/style.css 2016-12-16 13:23:31 +0000
@@ -6,7 +6,7 @@
6 * Author: Pasi Lallinaho6 * Author: Pasi Lallinaho
7 * Author URI: http://open.knome.fi/7 * Author URI: http://open.knome.fi/
8 *8 *
9 * Version: 2016-sept (r118)9 * Version: 2016-dec (r120)
10 *10 *
11 */11 */
1212
@@ -542,6 +542,32 @@
542 color: rgba( 0, 0, 0, 0.5 );542 color: rgba( 0, 0, 0, 0.5 );
543}543}
544544
545/* Mirror lists (code) */
546
547.mirrors .main {
548 font-weight: 600;
549}
550
551.mirrors .mirror-lp-url {
552 display: none;
553 margin-right: 1em;
554 float: right;
555}
556 .mirrors.expanded .mirror-lp-url {
557 display: inline-block;
558 }
559 .mirrors .mirror-lp-url a {
560 font-size: 80%;
561 color: rgba( 0, 0, 0, 0.5 );
562 }
563
564.mirrors .nobullet a {
565 font-size: 90%;
566}
567 .mirrors .nobullet::before {
568 content: " " !important;
569 }
570
545/* Search form */571/* Search form */
546572
547.search-form {573.search-form {
548574
=== added file 'xubuntu-fifteen/template-releases-landing.php'
--- xubuntu-fifteen/template-releases-landing.php 1970-01-01 00:00:00 +0000
+++ xubuntu-fifteen/template-releases-landing.php 2016-12-16 13:23:31 +0000
@@ -0,0 +1,2 @@
1<?php /* Template Name: Releases landing page */ ?>
2<?php include get_stylesheet_directory( ) . '/index.php'; ?>
0\ No newline at end of file3\ No newline at end of file

Subscribers

People subscribed via source and target branches