From: garvinhicking Date: Sat, 5 Aug 2006 20:47:49 +0000 (+0000) Subject: fix wrong variable name, thanks to stm! X-Git-Tag: 1.1~152 X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=305f07f316b77fa93b141f35a6f037d35df4c91f;p=s9y.git fix wrong variable name, thanks to stm! --- diff --git a/plugins/serendipity_plugin_comments/serendipity_plugin_comments.php b/plugins/serendipity_plugin_comments/serendipity_plugin_comments.php index 03c6808..59fb696 100644 --- a/plugins/serendipity_plugin_comments/serendipity_plugin_comments.php +++ b/plugins/serendipity_plugin_comments/serendipity_plugin_comments.php @@ -22,7 +22,7 @@ class serendipity_plugin_comments extends serendipity_plugin $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', @@ -121,9 +121,9 @@ class serendipity_plugin_comments extends serendipity_plugin } $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\''; } @@ -150,8 +150,8 @@ class serendipity_plugin_comments extends serendipity_plugin 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); @@ -173,22 +173,30 @@ class serendipity_plugin_comments extends serendipity_plugin $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( '
' . PLUGIN_COMMENTS_ABOUT . '
', @@ -197,7 +205,7 @@ class serendipity_plugin_comments extends serendipity_plugin . htmlspecialchars($row['subject']) . '
' . "\n" . '' . htmlspecialchars(serendipity_strftime($dateformat, $row['stamp'])) . '
' . "\n" - . '' . strip_tags($entry['comment'], '
') . '
' + . '' . strip_tags($entry['comment'], '
') . '
' . '


' . "\n\n" ); }