summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2023-05-06 14:09:52 +0300
committerAndrew Dolgov <[email protected]>2023-05-06 14:09:52 +0300
commit505c8155e25ac7b4cccdd2fd5bb8f5e073ee4198 (patch)
treec2acd23b419d701e74c0f06db3552a28a164d99c
parentc47c28bbe8f271b0d399aba62c520c314639da00 (diff)
initial for random_orderHEADmaster
-rw-r--r--init.php10
1 files changed, 5 insertions, 5 deletions
diff --git a/init.php b/init.php
index 6312651..6397b5f 100644
--- a/init.php
+++ b/init.php
@@ -1,5 +1,5 @@
<?php
-class Scored_Oldest_First extends Plugin {
+class Random_Order extends Plugin {
function init($host) {
$host->add_hook($host::HOOK_HEADLINES_CUSTOM_SORT_MAP, $this);
@@ -8,13 +8,13 @@ class Scored_Oldest_First extends Plugin {
function hook_headlines_custom_sort_map() {
return [
- "dates_reverse_scored" => "Oldest first (with score)"
+ "random_order" => "Random"
];
}
function hook_headlines_custom_sort_override($order) {
- if ($order == "dates_reverse_scored") {
- return [ "score DESC, updated", false ];
+ if ($order == "random_order") {
+ return [ "RANDOM()", false ];
} else {
return [ "", false ];
}
@@ -22,7 +22,7 @@ class Scored_Oldest_First extends Plugin {
function about() {
return array(null,
- "Consider article score while sorting by oldest first",
+ "Return headlines in random order",
"fox",
false,
"");