diff options
author | Romain d'Alverny <rda@mageia.org> | 2012-06-30 18:05:33 +0000 |
---|---|---|
committer | Romain d'Alverny <rda@mageia.org> | 2012-06-30 18:05:33 +0000 |
commit | 012b771af9a919e6fdec0d6da5589ee6cd7075fe (patch) | |
tree | 5adc557a81b3f2773a9c1d8760edce2ebf162f3a | |
parent | 0917848490e51a7b7e15f8f2e4b88571761858da (diff) | |
download | www-012b771af9a919e6fdec0d6da5589ee6cd7075fe.tar www-012b771af9a919e6fdec0d6da5589ee6cd7075fe.tar.gz www-012b771af9a919e6fdec0d6da5589ee6cd7075fe.tar.bz2 www-012b771af9a919e6fdec0d6da5589ee6cd7075fe.tar.xz www-012b771af9a919e6fdec0d6da5589ee6cd7075fe.zip |
better output for news summary
-rw-r--r-- | en/community/index.php | 6 | ||||
-rw-r--r-- | en/community/locales.php | 2 | ||||
-rw-r--r-- | lib/news.php | 25 |
3 files changed, 25 insertions, 8 deletions
diff --git a/en/community/index.php b/en/community/index.php index 4e438f872..83b542f77 100644 --- a/en/community/index.php +++ b/en/community/index.php @@ -2,7 +2,6 @@ define('HLANG', true); require '../../langs.php'; -include 'locales.php'; $_t = array( 'de' => array( @@ -67,6 +66,7 @@ $_t = array( ); $_t = i18n::get_strings($_t, $locale, $i18n_fallback_rules); +_lang_load($locale, 'community'); include '../../lib/news.php'; ?> @@ -108,9 +108,9 @@ include '../../lib/news.php'; <h2><a href="<?php _e('blog_url')?>"><?php _e('News');?></a></h2> <?php if (_d('planet_url') != 'planet_url') { - show_feed($locale, null, _d('planet_url'), _d('planet_url') . '?type=rss10', 9); + show_feed($locale, null, _d('planet_url'), _d('planet_url') . '?type=rss10', 9, null, true); } elseif (_d('blog_url') != 'blog_url') { - show_feed($locale, null, _d('blog_url'), _d('blog_url') . '?feed=rss', 9); + show_feed($locale, null, _d('blog_url'), _d('blog_url') . '?feed=rss', 9, null, true); } // don't work: //show_feed('Mageia MLs', '', 'https://ml.mageia.org/l/rss/active_lists?count=20&for=10'); diff --git a/en/community/locales.php b/en/community/locales.php deleted file mode 100644 index a4abe2daf..000000000 --- a/en/community/locales.php +++ /dev/null @@ -1,2 +0,0 @@ -<?php - diff --git a/lib/news.php b/lib/news.php index 736af1dd2..bd11320cb 100644 --- a/lib/news.php +++ b/lib/news.php @@ -100,8 +100,18 @@ function get_feed($url, $count = 5, $cache_timeout = 5) } /** + * + * @param string $locale locale this feed is expected to be in + * @param string $title feed title + * @param string $link feed main site title + * @param string $feed feed url + * @param integer $count how many items to return + * @param string $skip url whose element we want to skip (why?) + * @param boolean split title that has been built by aggregator + * + * @return string */ -function show_feed($locale, $title, $link, $feed, $count = 5, $skip = null) { +function show_feed($locale, $title, $link, $feed, $count = 5, $skip = null, $split = false) { if (!is_null($skip)) $count += 5; @@ -117,8 +127,17 @@ function show_feed($locale, $title, $link, $feed, $count = 5, $skip = null) { if (!is_null($skip) && strpos($d['link'], $skip) !== false) continue; - $s .= sprintf('<li><a href="%s">%s</a> <span class="dt">%s</span></li>', - $d['link'], $d['title'], news_date($d['date'], $locale)); + if ($split && strpos($d['title'], ' : ') !== false) { + $title = explode(' : ', $d['title']); + $source = ' / ' . array_shift($title); + $title = implode(' : ', $title); + } else { + $title = $d['title']; + $source = null; + } + + $s .= sprintf('<li><a href="%s">%s</a> <span class="dt">%s%s</span></li>', + $d['link'], $title, news_date($d['date'], $locale), $source); } $s .= '</ul>'; echo $s; |