Bug(?) + Xhtml 1.0 Validation Plugins: remoterss, bbcode

Creating and modifying plugins.
Post Reply
wese
Regular
Posts: 8
Joined: Mon Nov 08, 2004 2:01 pm
Contact:

Bug(?) + Xhtml 1.0 Validation Plugins: remoterss, bbcode

Post by wese » Mon Nov 08, 2004 4:33 pm

Im using the "remotess" Plugin to fetch some rss feeds and noticed that umlauts dont display right.

That function looks interessting:

Code: Select all

    function rss_utf8_decode($string) {
        if (strtolower(LANG_CHARSET) != 'utf-8') { # shouldnt this be ==
            return utf8_decode($string);
        } else {
            return $string;
        }
    }


May im mistaken but it fixed my problem and works well now.

Xhtml 1.0 valid
To make this thingy Xhtml valid i needet to change the link encoding:

Find those Lines(they dont appear as pasted):

Code: Select all

$content .= '<a href="' . $this->rss_utf8_decode($item['link']) . '" target="'.$target.'">';
to
$content .= '<a href="' . htmlentities($this->rss_utf8_decode($item['link'])) . '" target="'.$target.'">';

$content .= '&bull; <a href="' . $url . '" target="' . $target . '" title="' . $text . '">' . htmlspecialchars($text) . "</a>";
to
$content .= '&bull; <a href="' . htmlentities($url) . '" target="' . $target . '" title="' . $text . '">' . htmlspecialchars($text) . "</a>";

$content .= '&bull; <a href="' . htmlentities($url) . '" target="' . $target . '" title="' . $text . '">' . $text . "</a>";
to
$content .= '&bull; <a href="' .$url . '" target="' . $target . '" title="' . $text . '">' . $text . "</a>";


Im sorry for my crappy code. But it works. :P

bbcode:

To make the Htmlcode Xhtml 1.0 valid i had to change some linebreaks:

Code: Select all

          '/(?<!\\\\)(?:\s*<br\s*\/?>\s*)?\[\*(?::\w+)?\](.*?)(?=(?:\s*<br\s*\/?>\s*)?\[\*|(?:\s*<br\s*\/?>\s*)?\[\/?list)/si' => "\n<li class=\"bb-listitem\">\\1</li>",
          '/(?<!\\\\)(?:\s*<br\s*\/?>\s*)?\[\/list(:(?!u|o)\w+)?\](?:<br\s*\/?>)?/si'    => "\n</ul>",
          '/(?<!\\\\)(?:\s*<br\s*\/?>\s*)?\[\/list:u(:\w+)?\](?:<br\s*\/?>)?/si'         => "\n</ul>",
          '/(?<!\\\\)(?:\s*<br\s*\/?>\s*)?\[\/list:o(:\w+)?\](?:<br\s*\/?>)?/si'         => "\n</ol>",


to: (just remove the leading \n)

Code: Select all

          '/(?<!\\\\)(?:\s*<br\s*\/?>\s*)?\[\*(?::\w+)?\](.*?)(?=(?:\s*<br\s*\/?>\s*)?\[\*|(?:\s*<br\s*\/?>\s*)?\[\/?list)/si' => "<li class=\"bb-listitem\">\\1</li>",
          '/(?<!\\\\)(?:\s*<br\s*\/?>\s*)?\[\/list(:(?!u|o)\w+)?\](?:<br\s*\/?>)?/si'    => "</ul>",
          '/(?<!\\\\)(?:\s*<br\s*\/?>\s*)?\[\/list:u(:\w+)?\](?:<br\s*\/?>)?/si'         => "</ul>",
          '/(?<!\\\\)(?:\s*<br\s*\/?>\s*)?\[\/list:o(:\w+)?\](?:<br\s*\/?>)?/si'         => "</ol>",
ImageDo your Part! Join now.

Post Reply