$propbag->add('description', PLUGIN_COMMENTS_BLAHBLAH);
$propbag->add('stackable', true);
$propbag->add('author', 'Garvin Hicking/Tadashi Jokagi/Judebert');
- $propbag->add('version', '1.8');
+ $propbag->add('version', '1.10');
$propbag->add('requirements', array(
'serendipity' => '0.8',
'smarty' => '2.6.7',
}
$viewtype = '';
- if ($this->get_config('viewtype') == 'comments') {
+ if ($this->get_config('viewmode') == 'comments') {
$viewtype .= ' AND c.type = \'NORMAL\'';
- } elseif ($this->get_config('viewtype') == 'trackbacks') {
+ } elseif ($this->get_config('viewmode') == 'trackbacks') {
$viewtype .= ' AND c.type = \'TRACKBACK\'';
}
if ($sql && is_array($sql)) {
foreach($sql AS $key => $row) {
- if ( $serendipity['lang'] == "ja" && function_exists( 'mb_strimwidth')) {
- $comment = mb_strimwidth( strip_tags($row['comment']), 0, $max_chars, " [...]");
+ if (function_exists('mb_strimwidth')) {
+ $comment = mb_strimwidth(strip_tags($row['comment']), 0, $max_chars, " [...]", LANG_CHARSET);
} else {
$comments = wordwrap(strip_tags($row['comment']), $max_chars, '@@@', 1);
$aComment = explode('@@@', $comments);
$user = PLUGIN_COMMENTS_ANONYMOUS;
}
- if ( $serendipity['lang'] == "ja" && function_exists( 'mb_strimwidth')) {
+ if (function_exists('mb_strimwidth')) {
$pos = 0;
$parts = array();
- $comment_len = mb_strlen( $comment);
- while ( $pos < $comment_len) {
- $part = mb_strimwidth( $comment, $pos, $wordwrap);
- $pos += mb_strlen( $part);
+ $enc = LANG_CHARSET;
+ $comment_len = mb_strlen($comment, $enc);
+ while ($pos < $comment_len) {
+ $part = mb_strimwidth($comment, $pos, $wordwrap, '', $enc);
+ $pos += mb_strlen($part, $enc);
$parts[] = $part;
}
- $comment = implode( "\n", $parts);
+ $comment = implode("\n", $parts);
} else {
$comment = wordwrap($comment, $wordwrap, "\n", 1);
}
$entry = array('comment' => $comment,
'email' => $row['comment_email']);
+
+ // Let's help the BBCOde plugin a bit:
+ if (class_exists('serendipity_event_bbcode')) {
+ $entry['comment'] = preg_replace('@((\[.*)[\n\r]+(.*\]))+@imsU', '\2\3', $entry['comment']);
+ $entry['comment'] = preg_replace('@((\[.+\].*)[\r\n]+(.*\[/.+\]))+@imsU', '\2\3', $entry['comment']);
+ }
serendipity_plugin_api::hook_event('frontend_display', $entry);
+
printf(
'<div class="plugin_comment_wrap">' . PLUGIN_COMMENTS_ABOUT . '</div>',
. htmlspecialchars($row['subject'])
. '</a><br />' . "\n"
. '<span class="plugin_comment_date">' . htmlspecialchars(serendipity_strftime($dateformat, $row['stamp'])) . '</span><br />' . "\n"
- . '<span class="plugin_comment_body">' . strip_tags($entry['comment'], '<br /><img>') . '</span>'
+ . '<span class="plugin_comment_body">' . strip_tags($entry['comment'], '<br /><img><a>') . '</span>'
. '<br /><br /><br />' . "\n\n"
);
}