summaryrefslogtreecommitdiff
path: root/init.php
blob: 6397b5f31439ecaadabb85ec284f70259c5d5661 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
<?php
class Random_Order 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 [
			"random_order" => "Random"
		];
	}

	function hook_headlines_custom_sort_override($order) {
		if ($order == "random_order") {
			return [ "RANDOM()", false ];
		} else {
			return [ "", false ];
		}
	}

	function about() {
		return array(null,
			"Return headlines in random order",
			"fox",
			false,
			"");
	}

	function api_version() {
		return 2;
	}

}