Version 1.0-beta2 ()
------------------------------------------------------------------------
+ * Made categories plugin default HTML output more XHTML compliant.
+ (garvinhicking)
+
+ * Added option "stronger captchas" in spamblock plugin.
+
+ * Transcode incoming trackbacks from the given charset to your blog's
+ charset. Reliably only works with the two most common formats,
+ ISO-8859-1 <-> UTF-8. (garvinhicking)
+
* Change karma plugin and search results to output more HTML span
classes for better styling (garvinhicking)
// We can't accept a trackback if we don't get any URL
// This is a protocol rule.
- if ( empty($url) ) {
+ if (empty($url)) {
return 0;
}
// If title is not provided, the value for url will be set as the title
// This is a protocol rule.
- if ( empty($title) ) {
+ if (empty($title)) {
$title = $url;
}
- $comment['title'] = $title;
- $comment['url'] = $url;
- $comment['name'] = $name;
- $comment['comment'] = $excerpt;
+
+ $comment = array(
+ 'title' => $title,
+ 'url' => $url,
+ 'name' => $name,
+ 'comment' => $excerpt
+ );
+
+ $is_utf8 = strtolower(LANG_CHARSET) == 'utf-8';
+
+ if ($GLOBALS['tb_logging']) {
+ $fp = fopen('trackback2.log', 'a');
+ fwrite($fp, '[' . date('d.m.Y H:i') . '] TRACKBACK TRANSCODING CHECK' . "\n");
+ }
+
+ foreach($comment AS $idx => $field) {
+ if (is_utf8($field)) {
+ // Trackback is in UTF-8. Check if our blog also is UTF-8.
+ if (!$is_utf8) {
+ if ($GLOBALS['tb_logging']) {
+ fwrite($fp, '[' . date('d.m.Y H:i') . '] Transcoding ' . $idx . ' from UTF-8 to ISO' . "\n");
+ }
+ $comment[$idx] = utf8_decode($field);
+ }
+ } else {
+ // Trackback is in some native format. We assume ISO-8859-1. Check if our blog is also ISO.
+ if ($is_utf8) {
+ if ($GLOBALS['tb_logging']) {
+ fwrite($fp, '[' . date('d.m.Y H:i') . '] Transcoding ' . $idx . ' from ISO to UTF-8' . "\n");
+ }
+ $comment[$idx] = utf8_encode($field);
+ }
+ }
+ }
+
+ if ($GLOBALS['tb_logging']) {
+ fwrite($fp, '[' . date('d.m.Y H:i') . '] TRACKBACK DATA: ' . print_r($comment, true) . '...' . "\n");
+ fwrite($fp, '[' . date('d.m.Y H:i') . '] TRACKBACK STORING...' . "\n");
+ fclose($fp);
+ }
serendipity_saveComment($id, $comment, 'TRACKBACK');
serendipity_db_query($query);
}
}
+
+/**
+ * Check if a string is in UTF-8 format.
+ *
+ * @access public
+ * @param string The string to check
+ * @return bool
+ */
+function is_utf8($string) {
+ // From http://w3.org/International/questions/qa-forms-utf-8.html
+ return preg_match('%^(?:'
+ . '[\x09\x0A\x0D\x20-\x7E]' # ASCII
+ . '|[\xC2-\xDF][\x80-\xBF]' # non-overlong 2-byte
+ . '|\xE0[\xA0-\xBF][\x80-\xBF]' # excluding overlongs
+ . '|[\xE1-\xEC\xEE\xEF][\x80-\xBF]{2}' # straight 3-byte
+ . '|\xED[\x80-\x9F][\x80-\xBF]' # excluding surrogates
+ . '|\xF0[\x90-\xBF][\x80-\xBF]{2}' # planes 1-3
+ . '|[\xF1-\xF3][\x80-\xBF]{3}' # planes 4-15
+ . '|\xF4[\x80-\x8F][\x80-\xBF]{2}' # plane 16
+ . ')*$%xs', $string);
+}
\ No newline at end of file
$html = '';
if (!$smarty && $is_form) {
- $html .= '<form action="' . $serendipity['baseURL'] . $serendipity['indexFile'] . '" method="post"><div>';
+ $html .= '<form action="' . $serendipity['baseURL'] . $serendipity['indexFile'] . '" method="post">
+ <div id="serendipity_category_form_content">
+ <ul id="serendipity_categories_list" style="list-style: none; margin: 0px; padding: 0px">';
}
$image = $this->get_config('image', serendipity_getTemplateFile('img/xml.gif'));
}
if (!$smarty) {
- $html .= '<div style="padding-bottom: 2px;">';
+ $html .= '<li style="display: block;">';
if ($is_form) {
$html .= '<input style="width: 15px" type="checkbox" name="serendipity[multiCat][]" value="' . $cat['categoryid'] . '" />';
}
if ( !empty($image) ) {
- $html .= '<a href="'. $categories[$cid]['feedCategoryURL'] .'"><img src="'. $image .'" alt="XML" style="border: 0px" /></a> ';
+ $html .= '<a class="serendipity_xml_icon" href="'. $categories[$cid]['feedCategoryURL'] .'"><img src="'. $image .'" alt="XML" style="border: 0px" /></a> ';
}
$html .= '<a href="'. $categories[$cid]['categoryURL'] .'" title="'. htmlspecialchars($cat['category_description']) .'" style="padding-left: '. $categories[$cid]['paddingPx'] .'px">'. htmlspecialchars($categories[$cid]['category_name']) .'</a>';
- $html .= '</div>' . "\n";
+ $html .= '</li>' . "\n";
}
}
}
+ if (!$smarty) {
+ $html .= '</ul>';
+ }
+
if (!$smarty && $is_form) {
- $html .= '<br /><input type="submit" name="serendipity[isMultiCat]" value="' . GO . '" /><br />';
+ $html .= '<div class="category_submit"><br /><input type="submit" name="serendipity[isMultiCat]" value="' . GO . '" /></div>';
}
if (!$smarty) {
$html .= sprintf(
- '<br /><a href="%s" title="%s">%s</a>',
+ '<div class="category_link_all"><br /><a href="%s" title="%s">%s</a></div>',
$serendipity['serendipityHTTPPath'] . $serendipity['indexFile'],
ALL_CATEGORIES,