summaryrefslogtreecommitdiff
path: root/classes/handler
diff options
context:
space:
mode:
authorjustauser <[email protected]>2013-06-27 11:18:23 -0400
committerjustauser <[email protected]>2013-06-27 11:18:23 -0400
commit891e36f57e2e3955a4f13019e8fdc58fce826434 (patch)
tree2610bb1f22c8807593143dcc634a8bda68be59f4 /classes/handler
parentb584460302b674c8e9c52718d0e6682e427a913a (diff)
Changes to add a new hook: HOOK_QUERY_HEADLINES. An example is provided.
Diffstat (limited to 'classes/handler')
-rw-r--r--classes/handler/public.php22
1 files changed, 17 insertions, 5 deletions
diff --git a/classes/handler/public.php b/classes/handler/public.php
index f05beafd2..825ea5e2e 100644
--- a/classes/handler/public.php
+++ b/classes/handler/public.php
@@ -87,14 +87,20 @@ class Handler_Public extends Handler {
$tpl->setVariable('SELF_URL', htmlspecialchars(get_self_url_prefix()), true);
while ($line = $this->dbh->fetch_assoc($result)) {
+ foreach (PluginHost::getInstance()->get_hooks(PluginHost::HOOK_QUERY_HEADLINES) as $p) {
+ $line = $p->hook_query_headlines($line);
+ }
$tpl->setVariable('ARTICLE_ID', htmlspecialchars($line['link']), true);
$tpl->setVariable('ARTICLE_LINK', htmlspecialchars($line['link']), true);
$tpl->setVariable('ARTICLE_TITLE', htmlspecialchars($line['title']), true);
- $tpl->setVariable('ARTICLE_EXCERPT',
- truncate_string(strip_tags($line["content_preview"]), 100, '...'), true);
+ if(isset($line["modified_preview"]))
+ $tpl->setVariable('ARTICLE_EXCERPT', strip_tags($line["content_preview"]), true);
+ else
+ $tpl->setVariable('ARTICLE_EXCERPT',
+ truncate_string(strip_tags($line["content_preview"]), 100, '...'), true);
- $content = sanitize($line["content_preview"], false, $owner_uid);
+ $content = sanitize($line["content"], false, $owner_uid);
if ($line['note']) {
$content = "<div style=\"$note_style\">Article note: " . $line['note'] . "</div>" .
@@ -164,13 +170,19 @@ class Handler_Public extends Handler {
$feed['articles'] = array();
while ($line = $this->dbh->fetch_assoc($result)) {
+ foreach (PluginHost::getInstance()->get_hooks(PluginHost::HOOK_QUERY_HEADLINES) as $p) {
+ $line = $p->hook_query_headlines($line, 100);
+ }
$article = array();
$article['id'] = $line['link'];
$article['link'] = $line['link'];
$article['title'] = $line['title'];
- $article['excerpt'] = truncate_string(strip_tags($line["content_preview"]), 100, '...');
- $article['content'] = sanitize($line["content_preview"], false, $owner_uid);
+ if(isset($line["modified_preview"]))
+ $article['excerpt'] = strip_tags($line["content_preview"]);
+ else
+ $article['excerpt'] = truncate_string(strip_tags($line["content_preview"]), 100, '...');
+ $article['content'] = sanitize($line["content"], false, $owner_uid);
$article['updated'] = date('c', strtotime($line["updated"]));
if ($line['note']) $article['note'] = $line['note'];