From: garvinhicking Date: Tue, 4 Oct 2005 12:50:29 +0000 (+0000) Subject: Allow to (only) show trackbbacks, comments or both X-Git-Tag: 0.9~94 X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=2d11309a90756b3e1d471bafd8a78a93efe550e4;p=s9y.git Allow to (only) show trackbbacks, comments or both --- diff --git a/plugins/serendipity_plugin_comments/serendipity_plugin_comments.php b/plugins/serendipity_plugin_comments/serendipity_plugin_comments.php index 2349344..c3b20ad 100644 --- a/plugins/serendipity_plugin_comments/serendipity_plugin_comments.php +++ b/plugins/serendipity_plugin_comments/serendipity_plugin_comments.php @@ -29,7 +29,7 @@ class serendipity_plugin_comments extends serendipity_plugin $propbag->add('description', PLUGIN_COMMENTS_BLAHBLAH); $propbag->add('stackable', true); $propbag->add('author', 'Garvin Hicking'); - $propbag->add('version', '1.2'); + $propbag->add('version', '1.3'); $propbag->add('requirements', array( 'serendipity' => '0.8', 'smarty' => '2.6.7', @@ -41,12 +41,31 @@ class serendipity_plugin_comments extends serendipity_plugin 'wordwrap', 'max_chars', 'max_entries', - 'dateformat')); + 'dateformat', + 'viewmode')); } function introspect_config_item($name, &$propbag) { switch($name) { + case 'viewmode': + $types = array( + 'comments' => COMMENTS, + 'trackbacks' => TRACKBACKS, + 'all' => COMMENTS . ' + ' . TRACKBACKS + ); + $propbag->add('type', 'select'); + $propbag->add('name', TYPE); + $propbag->add('description', ''); + $propbag->add('select_values', $types); + $propbag->add('default', 'all'); + + $propbag->add('type', 'string'); + $propbag->add('name', TITLE); + $propbag->add('description', ''); + $propbag->add('default', COMMENTS); + break; + case 'title': $propbag->add('type', 'string'); $propbag->add('name', TITLE); @@ -113,6 +132,13 @@ class serendipity_plugin_comments extends serendipity_plugin $dateformat = '%a, %d.%m.%Y %H:%M'; } + $viewtype = ''; + if ($this->get_config('viewtype') == 'comments') { + $viewtype .= ' AND c.type = \'NORMAL\''; + } elseif ($this->get_config('viewtype') == 'trackbacks') { + $viewtype .= ' AND c.type = \'TRACKBACK\''; + } + $q = 'SELECT c.body AS comment, c.timestamp AS stamp, c.author AS user, @@ -129,6 +155,7 @@ class serendipity_plugin_comments extends serendipity_plugin WHERE e.id = c.entry_id AND NOT (c.type = \'TRACKBACK\' AND c.author = \'' . serendipity_db_escape_string($serendipity['blogTitle']) . '\' AND c.title != \'\') AND c.status = \'approved\' + ' . $viewtype . ' ORDER BY c.timestamp DESC LIMIT ' . $max_entries; ?>