diff options
author | justauser <[email protected]> | 2013-06-27 11:18:23 -0400 |
---|---|---|
committer | justauser <[email protected]> | 2013-06-27 11:18:23 -0400 |
commit | 891e36f57e2e3955a4f13019e8fdc58fce826434 (patch) | |
tree | 2610bb1f22c8807593143dcc634a8bda68be59f4 /plugins/query_headlines | |
parent | b584460302b674c8e9c52718d0e6682e427a913a (diff) |
Changes to add a new hook: HOOK_QUERY_HEADLINES. An example is provided.
Diffstat (limited to 'plugins/query_headlines')
-rw-r--r-- | plugins/query_headlines/init.js | 0 | ||||
-rw-r--r-- | plugins/query_headlines/init.php | 47 |
2 files changed, 47 insertions, 0 deletions
diff --git a/plugins/query_headlines/init.js b/plugins/query_headlines/init.js new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/plugins/query_headlines/init.js diff --git a/plugins/query_headlines/init.php b/plugins/query_headlines/init.php new file mode 100644 index 000000000..2c8a402c2 --- /dev/null +++ b/plugins/query_headlines/init.php @@ -0,0 +1,47 @@ +<?php +class Query_Headlines extends Plugin { + // example of the use of the HOOK_QUERY_HEADLINES + // this example will change the author and tags to be empty string so they don't display + // the arguements are: + // - the array of elements that are returned by queryFeedHeadlines + // - the length that the caller wants to truncate the content preview to + // - a boolean that indicates if the caller is from an API call + //NOTE:**** You have to make this a system plugin if you want it to also work + // on API calls. If you just make it a user plugin it will work on web page output + // but not on API calls + private $host; + + function about() { + return array(1.0, + "Example of use of HOOK_QUERY_HEADLINES", + "justauser" ); + } + + function init($host) { + $this->host = $host; + $host->add_hook($host::HOOK_QUERY_HEADLINES, $this); + } + + // passes in the array for an item + // second argument is the length of the preview the caller is using + // create a key called "modified_preview" if you change the preview and don't want + // caller to override with their default + + function hook_query_headlines($line, $preview_length = 100,$api_call=false) { + //make the author field empty + $line["author"] = ""; + + // and toss tags, since I don't use + $line["tag_cache"] = ""; + return $line; + + + } + + + function api_version() { + return 2; + } + +} +?> |