WordPress.org

Ready to get started?Download WordPress

Forums

Twitter Blackbird Pie
[resolved] Using non standard function mb_strlen (5 posts)

  1. Joost de Valk
    Member
    Posted 3 years ago #

    Hey,

    You're using mb_strlen and mb_convert_encoding in your plugin, which is not a default function in WordPress installs. I had to change unicode.php's first two function to the following to get it to work:

    public function UTF8entities($content) {
        $contents = $this->unicode_string_to_array($content);
        $swap = "";
        $iCount = count($contents);
        for ($o=0;$o<$iCount;$o++) {
            $contents[$o] = $this->unicode_entity_replace($contents[$o]);
            $swap .= $contents[$o];
        }
    	if ( function_exists('mb_convert_encoding') )
        	return mb_convert_encoding($swap,"UTF-8"); //not really necessary, but why not.
    	else
    		return $swap;
    }
    
    public function unicode_string_to_array( $string ) { //adjwilli
    	if ( function_exists('mb_strlen') )
        	$strlen = mb_strlen($string);
    	else
    		$strlen = strlen($string);
        while ($strlen) {
            $array[] = mb_substr( $string, 0, 1, "UTF-8" );
            $string = mb_substr( $string, 1, $strlen, "UTF-8" );
    		if ( function_exists('mb_strlen') )
            	$strlen = mb_strlen( $string );
    		else
    			$strlen = strlen( $string );
        }
        return $array;
    }

    Hope that helps :)

    Cheers,
    Joost

    http://wordpress.org/extend/plugins/twitter-blackbird-pie/

  2. bradvin
    Member
    Plugin Author

    Posted 3 years ago #

    Hey Joost,

    Yikes! I have only just seen this and you posted it over 3 weeks ago!
    Thanks for letting me know :) I will include this code in the next release.

    thanks,
    Brad

  3. Joost de Valk
    Member
    Posted 3 years ago #

    Bump, this still needs fixing, and it's been a few updates...

  4. bradvin
    Member
    Plugin Author

    Posted 3 years ago #

    Thanks for the reminder Joost, it should be going out with the next release

  5. bradvin
    Member
    Plugin Author

    Posted 3 years ago #

    Hi Joost,

    this code has been included in v0.5

    cheers
    Brad

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic