]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - actions/noticesearch.php
add notice search rss ("tracking")
[quix0rs-gnu-social.git] / actions / noticesearch.php
index 721c843eed749cf2fb004cd60c50476aa18bf729..0a9f4c37fe9ae423ca13a99e57a336124fec6f82 100644 (file)
@@ -51,7 +51,7 @@ class NoticesearchAction extends SearchAction {
 
                if ($cnt > 0) {
                        $terms = preg_split('/[\s,]+/', $q);
-                       common_element_start('ul', array('id' => 'notice'));
+                       common_element_start('ul', array('id' => 'notices'));
                        for ($i = 0; $i < min($cnt, NOTICES_PER_PAGE); $i++) {
                                if ($notice->fetch()) {
                                        $this->show_notice($notice, $terms);
@@ -69,6 +69,19 @@ class NoticesearchAction extends SearchAction {
                                                  $page, 'noticesearch', array('q' => $q));
        }
 
+       function show_header($arr) {
+               if ($arr) {
+                       $q = $arr[0];
+               }
+               if ($q) {
+                       common_element('link', array('rel' => 'alternate',
+                                                                                'href' => common_local_url('noticesearchrss',
+                                                                                                                                       array('q' => $q)),
+                                                                                'type' => 'application/rss+xml',
+                                                                                'title' => _t('Search Stream Feed')));
+               }
+       }
+       
        # XXX: refactor and combine with StreamAction::show_notice()
        
        function show_notice($notice, $terms) {
@@ -92,12 +105,12 @@ class NoticesearchAction extends SearchAction {
                # FIXME: URL, image, video, audio
                common_element_start('p', array('class' => 'content'));
                if ($notice->rendered) {
-                       common_raw($this->highlight($notice->rendered));
+                       common_raw($this->highlight($notice->rendered, $terms));
                } else {
                        # XXX: may be some uncooked notices in the DB,
                        # we cook them right now. This should probably disappear in future
                        # versions (>> 0.4.x)
-                       common_raw($this->highlight(common_render_content($notice->content, $notice)));
+                       common_raw($this->highlight(common_render_content($notice->content, $notice), $terms));
                }
                common_element_end('p');
                $noticeurl = common_local_url('shownotice', array('notice' => $notice->id));