ConvertFinglishToFarsi.php
/**
	 * ConvertFinglishToFarsi::correctUnknownWordsInText
	 *
	 * Description of function
	 *
	 * @param $farsiText string Farsi text containing english words
	 * @param $finglishWords array English Words
	 * @return string Blah Blah Blah
     */


Description of function

@param $farsiText string Farsi text containing english words
@param $finglishWords array English Words
@return string Blah Blah Blah
Description of function @param $farsiText string Farsi text containing english words @param $finglishWords array English Words @return string Blah Blah Blah
private function correctUnknownWordsInText($farsiText, $finglishWords)
	{
		$ch = curl_init();
		curl_setopt($ch, CURLOPT_URL, 'http://www.behnevis.com/php/convert.php');
		curl_setopt($ch, CURLOPT_USERAGENT, 'TweetIt.mobi / Thank you Behnevis');
		curl_setopt($ch, CURLOPT_HEADER, 0);
		curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
		curl_setopt($ch, CURLOPT_POST, 1);
		curl_setopt($ch, CURLOPT_POSTFIELDS, 'farsi='.urlencode(implode(' ', $finglishWords)).'&responsetime=-1&resulttype=json');
		$result = strstr(curl_exec($ch), '{');
		curl_close($ch);
		$array = json_decode($result, true);
		if ($array === NULL)
			return $farsiText;
		uasort($array, array($this, 'SizeSort'));
		return str_replace(array_keys($array), array_values($array), $farsiText);
	}
private function correctUnknownWordsInText ( $ farsiText , $ finglishWords ) { $ ch = curl_init ( ) ; curl_setopt ( $ ch , CURLOPT_URL , 'http://www.behnevis.com/php/convert.php' ) ; curl_setopt ( $ ch , CURLOPT_USERAGENT , 'TweetIt.mobi / Thank you Behnevis' ) ; curl_setopt ( $ ch , CURLOPT_HEADER , 0 ) ; curl_setopt ( $ ch , CURLOPT_RETURNTRANSFER , 1 ) ; curl_setopt ( $ ch , CURLOPT_POST , 1 ) ; curl_setopt ( $ ch , CURLOPT_POSTFIELDS , 'farsi=' . urlencode ( implode ( ' ' , $ finglishWords ) ) . '&responsetime=-1&resulttype=json' ) ; $ result = strstr ( curl_exec ( $ ch ) , '{' ) ; curl_close ( $ ch ) ; $ array = json_decode ( $ result , true ) ; if ( $ array === NULL ) return $ farsiText ; uasort ( $ array , array ( $ this , 'SizeSort' ) ) ; return str_replace ( array_keys ( $ array ) , array_values ( $ array ) , $ farsiText ) ; }
ConvertFinglishToFarsi::correctUnknownWordsInText
ConvertFinglishToFarsi :: correctUnknownWordsInText