init.php 647 B

123456789101112131415161718192021222324252627282930313233
  1. <?php
  2. class Example_Filter extends Plugin {
  3. private $host;
  4. function about() {
  5. return array(1.0,
  6. "Example Filter plugin",
  7. "fox");
  8. }
  9. function init($host) {
  10. $this->host = $host;
  11. $host->add_hook($host::HOOK_ARTICLE_FILTER_ACTION, $this);
  12. $host->add_filter_action($this, "action_example", "Example action");
  13. $host->add_filter_action($this, "action_another", "Another action");
  14. }
  15. function hook_article_filter_action($article, $action) {
  16. // if ($action == "...") { .... }
  17. $article["title"] = "[EXAMPLE FILTER WAS HERE: $action] " . $article["title"];
  18. return $article;
  19. }
  20. function api_version() {
  21. return 2;
  22. }
  23. }
  24. ?>