File: init.php

package info (click to toggle)
tt-rss 21~git20210204.b4cbc79%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 12,436 kB
  • sloc: php: 29,355; javascript: 13,884; sql: 2,341; sh: 315; makefile: 81; perl: 9
file content (35 lines) | stat: -rw-r--r-- 695 bytes parent folder | download | duplicates (3)
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 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 (with score)"
		];
	}

	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;
	}

}