From a5f26121ca28eb0bf2867ccaa0b01c1623871cb2 Mon Sep 17 00:00:00 2001 From: brockhaus Date: Sat, 12 Jan 2008 13:47:16 +0000 Subject: [PATCH] plugin_comments: URLs of writers may now be shown in the sitebar. This only worked for trackbacks formaly, now it works for trackbacks, pingbacks and human writers. You may configure, in what type of comment the URLs should be added. --- docs/NEWS | 5 ++++ .../UTF-8/lang_de.inc.php | 2 ++ .../lang_de.inc.php | 2 ++ .../lang_en.inc.php | 4 +++- .../serendipity_plugin_comments.php | 24 ++++++++++++++++--- 5 files changed, 33 insertions(+), 4 deletions(-) diff --git a/docs/NEWS b/docs/NEWS index baf4044..58c91ca 100644 --- a/docs/NEWS +++ b/docs/NEWS @@ -3,6 +3,11 @@ Version 1.3 () ------------------------------------------------------------------------ + * Sitebar plugin comments: URLs of writers now are shown for all + entries not only for trackbacks. You may configure if they should + be shown for all, none, normal writers or trackback/pingbacks. + (brockhaus) + * Pingback/Trackback textfetching: HTML Entities are now converted to characters. Character encoding defaults to UTF-8 but can be configured via $serendipity['pingbackEntityEncoding'] = "UTF-8" diff --git a/plugins/serendipity_plugin_comments/UTF-8/lang_de.inc.php b/plugins/serendipity_plugin_comments/UTF-8/lang_de.inc.php index 66a02e5..8e6a1f4 100644 --- a/plugins/serendipity_plugin_comments/UTF-8/lang_de.inc.php +++ b/plugins/serendipity_plugin_comments/UTF-8/lang_de.inc.php @@ -8,3 +8,5 @@ @define('PLUGIN_COMMENTS_MAXENTRIES', 'Anzahl an Kommentaren'); @define('PLUGIN_COMMENTS_MAXENTRIES_BLAHBLAH', 'Wieviele Kommentare sollen gezeigt werden? (Standard: 15)'); @define('PLUGIN_COMMENTS_ABOUT', '%s zu%s'); + + @define('PLUGIN_COMMENTS_ADDURL', 'Kommentatoren URL anzeigen bei'); diff --git a/plugins/serendipity_plugin_comments/lang_de.inc.php b/plugins/serendipity_plugin_comments/lang_de.inc.php index fa26558..2265eef 100644 --- a/plugins/serendipity_plugin_comments/lang_de.inc.php +++ b/plugins/serendipity_plugin_comments/lang_de.inc.php @@ -8,3 +8,5 @@ @define('PLUGIN_COMMENTS_MAXENTRIES', 'Anzahl an Kommentaren'); @define('PLUGIN_COMMENTS_MAXENTRIES_BLAHBLAH', 'Wieviele Kommentare sollen gezeigt werden? (Standard: 15)'); @define('PLUGIN_COMMENTS_ABOUT', '%s zu%s'); + + @define('PLUGIN_COMMENTS_ADDURL', 'Kommentatoren URL anzeigen bei'); diff --git a/plugins/serendipity_plugin_comments/lang_en.inc.php b/plugins/serendipity_plugin_comments/lang_en.inc.php index 4bc8e07..fc24901 100644 --- a/plugins/serendipity_plugin_comments/lang_en.inc.php +++ b/plugins/serendipity_plugin_comments/lang_en.inc.php @@ -15,4 +15,6 @@ @define('PLUGIN_COMMENTS_MAXENTRIES_BLAHBLAH', 'How many comments will be shown? (Default: 15)'); @define('PLUGIN_COMMENTS_ABOUT', '%s about%s'); @define('PLUGIN_COMMENTS_ANONYMOUS', 'anon'); -?> + +@define('PLUGIN_COMMENTS_ADDURL', 'Add writers URL to'); + diff --git a/plugins/serendipity_plugin_comments/serendipity_plugin_comments.php b/plugins/serendipity_plugin_comments/serendipity_plugin_comments.php index fb1218a..589b086 100644 --- a/plugins/serendipity_plugin_comments/serendipity_plugin_comments.php +++ b/plugins/serendipity_plugin_comments/serendipity_plugin_comments.php @@ -35,12 +35,27 @@ class serendipity_plugin_comments extends serendipity_plugin 'max_chars', 'max_entries', 'dateformat', - 'viewmode')); + 'viewmode', + 'showurls')); } function introspect_config_item($name, &$propbag) { switch($name) { + case 'showurls': + $urltypes = array( + 'none' => NONE, + 'comments' => COMMENTS, + 'trackbacks' => TRACKBACKS, + 'all' => COMMENTS . ' + ' . TRACKBACKS + ); + $propbag->add('type', 'select'); + $propbag->add('name', PLUGIN_COMMENTS_ADDURL); + $propbag->add('description', ''); + $propbag->add('select_values', $urltypes); + $propbag->add('default', 'trackbacks'); + break; + case 'viewmode': $types = array( 'comments' => COMMENTS, @@ -160,8 +175,11 @@ class serendipity_plugin_comments extends serendipity_plugin $comment .= ' [...]'; } } - - if ($row['comment_type'] == 'TRACKBACK' && $row['comment_url'] != '') { + + $showurls = $this->get_config('showurls','trackbacks'); + $isTrackBack = $row['comment_type'] == 'TRACKBACK' || $row['comment_type'] == 'PINGBACK'; + + if ($row['comment_url'] != '' && ( ($isTrackBack && ($showurls =='trackbacks' || $showurls =='all') || !$isTrackBack && ($showurls =='comments' || $showurls =='all')))) { $user = '' . htmlspecialchars(strip_tags($row['user'])) . ''; } else { $user = htmlspecialchars(strip_tags($row['user'])); -- 2.39.5