summaryrefslogtreecommitdiff
path: root/plugins/mark_button/init.php
blob: 4cf1c5949db0b7a1c4c7adf3dc407ed9ec6f3451 (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
36
37
38
39
40
<?php
class Mark_Button extends Plugin {
	private $link;
	private $host;

	function init($host) {
		$this->link = $host->get_link();
		$this->host = $host;

		$host->add_hook($host::HOOK_ARTICLE_BUTTON, $this);
	}

	function about() {
		return array(1.0,
			"Bottom un/star button for the combined mode",
			"fox");
	}

	function hook_article_button($line) {
		$marked_pic = "";
		$id = $line["id"];

		if (get_pref($this->link, "COMBINED_DISPLAY_MODE")) {
			if (sql_bool_to_bool($line["marked"])) {
				$marked_pic = "<img
					src=\"images/mark_set.svg\"
					class=\"markedPic\" alt=\"Unstar article\"
					onclick='toggleMark($id)'>";
			} else {
				$marked_pic = "<img
					src=\"images/mark_unset.svg\"
					class=\"markedPic\" alt=\"Star article\"
					onclick='toggleMark($id)'>";
			}
		}

		return $marked_pic;
	}
}
?>