]> git.wh0rd.org Git - tt-rss.git/commitdiff
changes to add hook_query_headlines
authorjustauser <justausr@hotmail.com>
Sun, 7 Jul 2013 17:53:23 +0000 (13:53 -0400)
committerjustauser <justausr@hotmail.com>
Sun, 7 Jul 2013 17:53:23 +0000 (13:53 -0400)
classes/pluginhost.php
include/functions.php
plugins/query_headlines/init.js [new file with mode: 0644]
plugins/query_headlines/init.php [new file with mode: 0644]

index 53adf01f9ff8b098c32602c474c732ee37eb0061..a1bd1b36400a195c341e3399be5c7ba5fe8907fd 100644 (file)
@@ -37,6 +37,7 @@ class PluginHost {
        const HOOK_PREFS_EDIT_FEED = 20;
        const HOOK_PREFS_SAVE_FEED = 21;
        const HOOK_FETCH_FEED = 22;
+       const HOOK_QUERY_HEADLINES = 23;
 
        const KIND_ALL = 1;
        const KIND_SYSTEM = 2;
index 355eec2cd09fd16123a6c47e136d2b42f1583f3f..397605c5a0570fbebfe23b796db52c7c389e500f 100644 (file)
                                }
                        }
 
-                       $content_query_part = "content as content_preview, cached_content, ";
+                       $content_query_part = "content, content as content_preview, cached_content, ";
 
                        if (is_numeric($feed)) {
 
diff --git a/plugins/query_headlines/init.js b/plugins/query_headlines/init.js
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/plugins/query_headlines/init.php b/plugins/query_headlines/init.php
new file mode 100644 (file)
index 0000000..5d71d03
--- /dev/null
@@ -0,0 +1,50 @@
+<?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
+       // 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
+       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;
+       }
+
+}
+?>