Summary:
Supress date ordering: patch
Detailed Description:
I recently needed to use a feed that is deliberately ordered (by popularity of
article) and CMSSimple overrode this order and re-ordered it by date. The
following patch overcomes this problem by introducing a new optional parameter,
dateorder. Setting this to 0 suppresses date ordering.
--- action.default.php.orig 2011-11-22 20:41:02.000000000 +0000
+++ action.default.php 2011-11-22 21:16:38.000000000 +0000
@@ -45,6 +45,7 @@
$is_cache = $this->GetPreference('is_cache', true);
$cache_lifetime = $this->GetPreference('cache_lifetime', 1800);
$length_in_pref = $this->GetPreference('limit', '0');
+ //$dateorder = $this->GetPreference('dateorder', '1');
//grab the feed
$feed = new SimplePie();
@@ -59,6 +60,13 @@
$feed->set_cache_location(TMP_CACHE_LOCATION);
$feed->enable_cache($is_cache);
$feed->set_cache_duration($cache_lifetime);
+
+ $dateorder = true;
+ if (isset($params['dateorder'])) {
+ $dateorder = empty($params['dateorder'])?false:true;
+ }
+ $feed->enable_order_by_date($dateorder);
+
//init the process
$feed->init();
$feed->handle_content_type();
--- CMSSimplepie.module.php.orig 2011-11-22 20:41:18.000000000 +0000
+++ CMSSimplepie.module.php 2011-11-22 21:19:16.000000000 +0000
@@ -158,6 +158,8 @@
$this->SetParameterType('limit', CLEAN_INT);
$this->CreateParameter('template', '',
$this->Lang('help_template'));
$this->SetParameterType('template',
CLEAN_STRING);
+ $this->CreateParameter('dateorder', '1',
$this->Lang('help_dateorder'));
+ $this->SetParameterType('dateorder', CLEAN_INT);
}
--- lang/en_US.php.orig 2011-11-22 21:18:40.000000000 +0000
+++ lang/en_US.php 2011-11-22 21:20:31.000000000 +0000
@@ -49,6 +49,7 @@
$lang['help_limit'] = 'Default is "0" this means display all. Or limit="10"
include just 10 items feeds.';
$lang['help_feed'] = 'This is your feed Name (must be created in General feeds
tab), this means that param name is unique. {CMSSimplepie feed="youtube"}';
$lang['help_template'] = 'Set your template template="youtube" ';
+$lang['help_dateorder'] = 'By default, entries are reordered chronologically.
Set dateorder="0" to disable this.';
$lang['title_mod_prefs'] = 'Module Preferences';