diff options
author | filip <filip.komar@gmail.com> | 2018-04-27 20:03:03 +0200 |
---|---|---|
committer | filip <filip.komar@gmail.com> | 2018-04-27 20:03:03 +0200 |
commit | 1e35475cee83c4e19f7c165011064ae77231924b (patch) | |
tree | ddc16f0c90d25f72faccc997c92fd435b3cfe13c /en | |
parent | b379ed46dd9bf2ef5b7e8dd29a4c7b8b8259101b (diff) | |
download | www-1e35475cee83c4e19f7c165011064ae77231924b.tar www-1e35475cee83c4e19f7c165011064ae77231924b.tar.gz www-1e35475cee83c4e19f7c165011064ae77231924b.tar.bz2 www-1e35475cee83c4e19f7c165011064ae77231924b.tar.xz www-1e35475cee83c4e19f7c165011064ae77231924b.zip |
show only recent planet&blog post
show localized planet if exists otherwise localized blog
if number of localized titles is less then required add
English planet and English blog as fallback
Diffstat (limited to 'en')
-rw-r--r-- | en/community/index.php | 19 | ||||
-rwxr-xr-x | en/index.php | 16 |
2 files changed, 27 insertions, 8 deletions
diff --git a/en/community/index.php b/en/community/index.php index d2d84b7af..994597015 100644 --- a/en/community/index.php +++ b/en/community/index.php @@ -47,10 +47,21 @@ include '../../lib/news.php'; <div class="col"> <section> <?php - if ((strpos($locale, 'en') === 0) || (_r('https://planet.mageia.org/en/') != 'https://planet.mageia.org/en/')) { - show_feed($locale, _r('News') . ' (' . _r('Planet') . ')', _r('https://planet.mageia.org/en/'), _r('https://planet.mageia.org/en/') . '?type=rss10', 9, null, true); - } else { - show_feed($locale, _r('News') . ' (' . _r('Blog') . ')', _r('https://blog.mageia.org/en/'), _r('https://blog.mageia.org/en/') . '?feed=rss', 9, null, true); + $loc_planet_url = _r('https://planet.mageia.org/en/'); + $loc_blog_url = _r('https://blog.mageia.org/en/'); + $fresh_blog_post_titles = prepare_fresh_blog_post_titles('https://planet.mageia.org/en/', 'https://blog.mageia.org/en/', $loc_planet_url, $loc_blog_url); + $loc_posts_title = $fresh_blog_post_titles[0]; + $fresh_loc_posts = $fresh_blog_post_titles[1]; + $num_fresh_loc_posts = $fresh_blog_post_titles[2]; + $eng_posts_title = $fresh_blog_post_titles[3]; + $fresh_eng_posts = $fresh_blog_post_titles[4]; + $num_fresh_eng_posts = count($fresh_eng_posts); + + if(0 != $num_fresh_loc_posts) { + show_feed($locale, _r('Localised news') . " ($loc_posts_title)", '', '', 0, null, true, null, $fresh_loc_posts); + } + if(0 != $num_fresh_eng_posts) { + show_feed($locale, _r('News in English') . " ($eng_posts_title)", '', '', 0, null, true, null, $fresh_eng_posts); } // don't work: //show_feed('Mageia MLs', '', 'https://ml.mageia.org/l/rss/active_lists?count=20&for=10'); diff --git a/en/index.php b/en/index.php index 8f4e2f130..3015df71b 100755 --- a/en/index.php +++ b/en/index.php @@ -233,10 +233,18 @@ $dictionary = read_translation_file($locale, array('index', 'news', 'common_foot $prefix = '<span style="font-weight: bold;">'; $prefix .= sprintf(_r('Latest news from our <a href="%s">blog</a>:'), _r('https://blog.mageia.org/en/')); $prefix .= '</span> '; - if (_r('https://planet.mageia.org/en/') != 'https://planet.mageia.org/en/') { - show_feed($locale, null, _r('https://planet.mageia.org/en/'), _r('https://planet.mageia.org/en/') . '?type=rss10', 1, null, true, $prefix); - } else { - show_feed($locale, null, _r('https://blog.mageia.org/en/'), _r('https://blog.mageia.org/en/') . '?feed=rss', 1, null, true, $prefix); + $loc_planet_url = _r('https://planet.mageia.org/en/'); + $loc_blog_url = _r('https://blog.mageia.org/en/'); + $fresh_blog_post_titles = prepare_fresh_blog_post_titles('https://planet.mageia.org/en/', 'https://blog.mageia.org/en/', $loc_planet_url, $loc_blog_url, 1, 1); + $fresh_loc_posts = $fresh_blog_post_titles[1]; + $num_fresh_loc_posts = $fresh_blog_post_titles[2]; + $fresh_eng_posts = $fresh_blog_post_titles[4]; + $num_fresh_eng_posts = count($fresh_eng_posts); + if(0 != $num_fresh_loc_posts) { + show_feed($locale, null, '', '', 0, null, true, $prefix, $fresh_loc_posts); + } + if(0 != $num_fresh_eng_posts) { + show_feed($locale, null, '', '', 0, null, true, $prefix, $fresh_eng_posts); } ?> </div> |