init.php 831 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. <?php
  2. class Mark_Button extends Plugin {
  3. private $link;
  4. private $host;
  5. function init($host) {
  6. $this->link = $host->get_link();
  7. $this->host = $host;
  8. $host->add_hook($host::HOOK_ARTICLE_BUTTON, $this);
  9. }
  10. function about() {
  11. return array(1.0,
  12. "Bottom un/star button for the combined mode",
  13. "fox");
  14. }
  15. function hook_article_button($line) {
  16. $marked_pic = "";
  17. $id = $line["id"];
  18. if (get_pref($this->link, "COMBINED_DISPLAY_MODE")) {
  19. if (sql_bool_to_bool($line["marked"])) {
  20. $marked_pic = "<img
  21. src=\"images/mark_set.svg\"
  22. class=\"markedPic\" alt=\"Unstar article\"
  23. onclick='toggleMark($id)'>";
  24. } else {
  25. $marked_pic = "<img
  26. src=\"images/mark_unset.svg\"
  27. class=\"markedPic\" alt=\"Star article\"
  28. onclick='toggleMark($id)'>";
  29. }
  30. }
  31. return $marked_pic;
  32. }
  33. }
  34. ?>