init.php 549 B

12345678910111213141516171819202122232425262728293031323334
  1. <?php
  2. class Example_Article extends Plugin {
  3. private $host;
  4. function about() {
  5. return array(1.0,
  6. "Example plugin for HOOK_RENDER_ARTICLE",
  7. "fox",
  8. true);
  9. }
  10. function init($host) {
  11. $this->host = $host;
  12. $host->add_hook($host::HOOK_RENDER_ARTICLE, $this);
  13. }
  14. function get_prefs_js() {
  15. return file_get_contents(dirname(__FILE__) . "/init.js");
  16. }
  17. function hook_render_article($article) {
  18. $article["content"] = "Content changed: " . $article["content"];
  19. return $article;
  20. }
  21. function api_version() {
  22. return 2;
  23. }
  24. }
  25. ?>