WordPress.org

Support

Support » Plugins and Hacks » Simple Tags » [Plugin: Simple Tags] and again the problem with Russian character set

[Plugin: Simple Tags] and again the problem with Russian character set

  • [ Moderator note: please use backticks or the code button for any post code snippets. ]

    The solution is to use character classes Unicode (what they know, alas, very few programmers).

    In fact, it was necessary to check on the presence of non-letters before the label after label, like so:

    View Code PHP
    $match = "/(\PL)(" . preg_quote($term_name, "/") . ")(\PL)/u".$case;

    Even better, but does not always work. In particular, it will not work if the label is immediately after the start tag or immediately before the closing tag (does not work condition (\ PL) at the beginning or the end). The correct solution is as follows:

    [-]
    View Code PHP
    $ match = "/ (\ PL | \ A) (". preg_quote ($ term_name, "/"). ") (\ PL | \ Z) / u". $ case;

    The complete solution is more complicated, but the point should be clear.

    --- simple-tags.client.php.orig 2008-11-22 06:15:22.000000000 +0200
    +++ simple-tags.client.php      2008-11-22 07:53:15.000000000 +0200
    @@ -262,8 +262,9 @@
    
                            foreach ( (array) $this->link_tags as $term_name => $term_link ) {
                                    $filtered = ""; // will filter text token by token
    -                               $match = "/\b" . preg_quote($term_name, "/") . "\b/".$case;
    -                               $substitute = '<a href="'.$term_link.'">$0</a>";
                    $quoted = preg_quote($term_name, "/");
                    $match = "/(\PL|\A)(" . preg_quote($term_name, "/") . ")(\PL|\Z)/u".$case;
                    $substitute = '$1<a href="'.$term_link.'">$2</a>$3";
    
                                    // for efficiency only tokenize if forced to do so
                                    if ( $must_tokenize ) {

    I really hope that you understand the problem and fix it soon.

    http://wordpress.org/extend/plugins/simple-tags/

  • The topic ‘[Plugin: Simple Tags] and again the problem with Russian character set’ is closed to new replies.
Skip to toolbar