aboutsummaryrefslogtreecommitdiffstats
path: root/en/community
diff options
context:
space:
mode:
authorfilip <filip.komar@gmail.com>2018-04-27 20:03:03 +0200
committerfilip <filip.komar@gmail.com>2018-04-27 20:03:03 +0200
commit1e35475cee83c4e19f7c165011064ae77231924b (patch)
treeddc16f0c90d25f72faccc997c92fd435b3cfe13c /en/community
parentb379ed46dd9bf2ef5b7e8dd29a4c7b8b8259101b (diff)
downloadwww-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/community')
-rw-r--r--en/community/index.php19
1 files changed, 15 insertions, 4 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');