]> gitweb.fluxo.info Git - lorea/elgg.git/commitdiff
Added phpdoc header to index.php
authorbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>
Tue, 12 Jan 2010 02:37:17 +0000 (02:37 +0000)
committerbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>
Tue, 12 Jan 2010 02:37:17 +0000 (02:37 +0000)
Added RSS support to search. Nifty.

git-svn-id: http://code.elgg.org/elgg/trunk@3800 36083f99-b078-4883-b0ff-0f9b5a30f544

mod/search/index.php
mod/search/views/rss/search/entity.php [new file with mode: 0644]
mod/search/views/rss/search/listing.php [new file with mode: 0644]

index adf514cafc9878682814457921bcfc8bac4dc05e..4f1aa3dbf91674bf3dc7bb4ca9fc4a5e5d4a04fc 100644 (file)
@@ -1,4 +1,12 @@
 <?php
+/**
+ * Elgg core search.
+ *
+ * @package Elgg
+ * @subpackage Core
+ * @author Curverider Ltd <info@elgg.com>, The MITRE Corporation <http://www.mitre.org>
+ * @link http://elgg.org/
+ */
 
 // $search_type == all || entities || trigger plugin hook
 $search_type = get_input('search_type', 'all');
diff --git a/mod/search/views/rss/search/entity.php b/mod/search/views/rss/search/entity.php
new file mode 100644 (file)
index 0000000..8c3609f
--- /dev/null
@@ -0,0 +1,32 @@
+<?php
+/**
+ * Elgg core search.
+ * Search entity view for RSS feeds.
+ *
+ * @package Elgg
+ * @subpackage Core
+ * @author Curverider Ltd <info@elgg.com>, The MITRE Corporation <http://www.mitre.org>
+ * @link http://elgg.org/
+ */
+
+$title = $vars['entity']->title;
+if (empty($title)) {
+       $title = substr($vars['entity']->description, 0, 32);
+       if (strlen($vars['entity']->description) > 32) {
+               $title .= " ...";
+       }
+}
+
+?>
+
+<item>
+<guid isPermaLink='true'><?php echo htmlspecialchars($vars['entity']->getURL()); ?></guid>
+<pubDate><?php echo date("r", $vars['entity']->time_created) ?></pubDate>
+<link><?php echo htmlspecialchars($vars['entity']->getURL()); ?></link>
+<title><![CDATA[<?php echo $title; ?>]]></title>
+<description><![CDATA[<?php
+       $summary = $vars['entity']->summary;
+       if (!empty($summary)) echo wpautop($summary);
+       echo (autop($vars['entity']->description));
+?>]]></description>
+</item>
diff --git a/mod/search/views/rss/search/listing.php b/mod/search/views/rss/search/listing.php
new file mode 100644 (file)
index 0000000..40aae01
--- /dev/null
@@ -0,0 +1,28 @@
+<?php
+/**
+ * Elgg core search.
+ * Search listing view for RSS feeds.
+ *
+ * @package Elgg
+ * @subpackage Core
+ * @author Curverider Ltd <info@elgg.com>, The MITRE Corporation <http://www.mitre.org>
+ * @link http://elgg.org/
+ */
+
+$entities = $vars['results']['entities'];
+
+if (!is_array($entities) || !count($entities)) {
+       return FALSE;
+}
+
+foreach ($entities as $entity) {
+       if ($view = search_get_search_view($vars['params'], 'entity')) {
+               $body .= elgg_view($view, array(
+                       'entity' => $entity,
+                       'params' => $vars['params'],
+                       'results' => $vars['results']
+               ));
+       }
+}
+
+echo $body;
\ No newline at end of file