From 891e36f57e2e3955a4f13019e8fdc58fce826434 Mon Sep 17 00:00:00 2001 From: justauser Date: Thu, 27 Jun 2013 11:18:23 -0400 Subject: Changes to add a new hook: HOOK_QUERY_HEADLINES. An example is provided. --- plugins/query_headlines/init.php | 47 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 plugins/query_headlines/init.php (limited to 'plugins/query_headlines/init.php') 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 @@ +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; + } + +} +?> -- cgit v1.2.3-54-g00ecf From 48c8e72008c01513985b53135297366b80b5b1f4 Mon Sep 17 00:00:00 2001 From: justauser Date: Fri, 28 Jun 2013 10:50:30 -0400 Subject: Add some explanaiton in the example about the content_preview field --- plugins/query_headlines/init.php | 3 +++ 1 file changed, 3 insertions(+) (limited to 'plugins/query_headlines/init.php') diff --git a/plugins/query_headlines/init.php b/plugins/query_headlines/init.php index 2c8a402c2..5d71d0356 100644 --- a/plugins/query_headlines/init.php +++ b/plugins/query_headlines/init.php @@ -6,6 +6,9 @@ class Query_Headlines extends Plugin { // - 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 + // The field content_preview has been shortened and sanitized, as appropriate + // before the plugin is called. If you want to do your own preview handling + // use the content field and create the preview from that //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 -- cgit v1.2.3-54-g00ecf