Skip to content
Snippets Groups Projects
Commit c82457e5 authored by Andrew Dolgov's avatar Andrew Dolgov
Browse files

add plugins/scored_oldest_first

parent bc0d50e8
No related branches found
No related tags found
No related merge requests found
<?php
class Scored_Oldest_First extends Plugin {
function init($host) {
$host->add_hook($host::HOOK_HEADLINES_CUSTOM_SORT_MAP, $this);
$host->add_hook($host::HOOK_HEADLINES_CUSTOM_SORT_OVERRIDE, $this);
}
function hook_headlines_custom_sort_map() {
return [
"dates_reverse_scored" => "Oldest first (legacy)"
];
}
function hook_headlines_custom_sort_override($order) {
if ($order == "dates_reverse_scored") {
return [ "score DESC, updated", true ];
} else {
return [ "", false ];
}
}
function about() {
return array(1.0,
"Consider article score while sorting by oldest first",
"fox",
false,
"");
}
function api_version() {
return 2;
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment