description , ""))){
$item->description = '
' . $item->description . '
';
}else{
$item->description = '' . $item->description . '
';
}
/*
At the moment, title layout change does not work very well.
if (__bidi_is_ltr_language(kses($item->title , ""))){
$item->title = '' . $item->title . '
';
}
*/
return $item;
}
function __bidi_is_ltr_language($text)
{
$unicode=__bidi_utf8_to_unicode($text);
$unilen=count($unicode);
// Finds the first character in the text which is not a number,punct mark or space,
// if its hebrew or arabic the text firection is set to ltr.
$isLeftToRight=false;
foreach( $unicode as $cc){
$c=chr($cc);
if (!ctype_punct($c) && !ctype_digit($c) && !ctype_space($c)){
if (($cc >= 1424 && $cc <= 1535) || // hebrew
($cc >= 1536 && $cc <= 1791)){ // arabic
$isLeftToRight=true;
}
break;
}
}
return $isLeftToRight;
}
// A generic utf8 to unicode converter from
// http://www.randomchaos.com/documents/?source=php_and_unicode
function __bidi_utf8_to_unicode( $str ) {
$unicode = array();
$values = array();
$lookingFor = 1;
for ($i = 0; $i < strlen( $str ); $i++ ) {
$thisValue = ord( $str[ $i ] );
if ( $thisValue < 128 ) {
$unicode[] = $thisValue;
}
else {
if ( count( $values ) == 0 ) $lookingFor = ( $thisValue < 224 ) ? 2 : 3;
$values[] = $thisValue;
if ( count( $values ) == $lookingFor ) {
$number = ( $lookingFor == 3 ) ?
( ( $values[0] % 16 ) * 4096 ) + ( ( $values[1] % 64 ) * 64 ) + ( $values[2] % 64 ):
( ( $values[0] % 32 ) * 64 ) + ( $values[1] % 64 );
$unicode[] = $number;
$values = array();
$lookingFor = 1;
} // if
} // if
} // for
return $unicode;
} // utf8_to_unicode
// Injects RTL style to the CSS
function __bidi_rtl_css()
{
echo "\n\n";
}
rss_set_hook('rss.plugins.stylesheets','__bidi_rtl_css');
rss_set_hook('rss.plugins.items.beforerender','__bidi_filter');
?>