WordPress.org

Support

Support » Plugins and Hacks » Twitter Blackbird Pie » [Resolved] [Plugin: Twitter Blackbird Pie] Using non standard function mb_strlen

[Resolved] [Plugin: Twitter Blackbird Pie] Using non standard function mb_strlen

  • Joost de Valk

    @joostdevalk

    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/

Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘[Resolved] [Plugin: Twitter Blackbird Pie] Using non standard function mb_strlen’ is closed to new replies.
Skip to toolbar