Forum

JiFile per Joomla!

JIFile
JiFile è una componente per Joomla! che permette di indicizzare il contenuto dei file(PDF, DOC, ecc.) per poter effettuare delle ricerche al loro interno.

Scopri di più...  Demo

JoomPhoto Mobile

JPhotoMobile
JoomPhoto Mobile è una componente per Joomla! che ti permette di condividere le foto dal tuo dispositivo Android sul tuo portale Joomla!.

Scopri di più...  Demo

iFile Framework

IFile
IFile è un framework open source scritto interamente in PHP, permette l'indicizzazione dei contenuti testuali di un documento (DOC, PDF, EXCEL, etc) e una rapida ricerca all'interno degli stessi.

Scopri di più...  Demo

Easy Language

EasyLanguage
Easy Language è un plugin per la gestione semplice ed immediata di testi multilingua in ogni parte possibile di joomla, articoli, componenti, moduli, metadata, template, altri componenti(esempio K2) ecc.

Scopri di più...

Article Book Effect

Article Book Effect
Visualizza gli articoli di Joomla con l'effetto volta pagina di un libro. Questo plugin consente di visualizzare il contenuto di un articolo Joomla come un vero e proprio libro o una rivista, utilizzando tutti i vantaggi di HTML5

Scopri di più...  Demo

 

Fototessera

Article Book Effect
La più famosa Android App che ti permette di stampare le foto tessere per i tuoi documenti con il tuo smartphone Android, in modo semplice ed intuitivo.

Scopri di più...

 

Ombra pazza 3D

Ombra pazza 3D
Ombra Pazza è il puzzle game 3D frenetico e divertente per Android! Prova a ruotare le forme portandole nella posizione delle proprie ombre senza mai fallire! Risolvi una dopo l'altra tutte le combinazioni dei livelli di gioco.

Scopri di più...

 

Admin Countdown

Admin Countdown
Modulo per Joomla! 2.5 e 3.x visualizza nella parte di amministrazione del sito, un timer con il conto alla rovescia del tempo rimanente della tua sessione.

Scopri di più...  Demo

 
Benvenuto, Ospite
Nome utente: Password: Ricordami

ARGOMENTO: How to use in code?

How to use in code? 19/02/2013 00:45 #1009

I have my site with easy language installed and setuped. Also I have GCalendar component.
I want my event from Google Calendar shown in multilanguage. In Google Calendars I create event with {lang xx}{/lang} style. Now in GCalendar component if I open full calendar mode I see my {lang xx}{/lang}, but in upcoming event module events' titles shown normal (in few languages).
I found were title is generating for full calendar view (it is requested with ajax from option=com_gcalendar&view=jsonfeed&format=raw&gcid=2&Itemid=162&lang=...):
$eventData = array(
	'id' => $event->getGCalId(),
	'gcid' => $event->getParam('gcid'),
	'title' => htmlspecialchars_decode($event->getTitle()),
	'start' => $event->getStartDate()->format('c', true),
	'end' => $event->getEndDate()->format('c', true),
	'url' => JRoute::_('index.php?option=com_gcalendar&view=event&eventID='.$event->getGCalId().'&gcid='.$event->getParam('gcid').(empty($itemID)?'':$itemID)),
	'className' => "gcal-event_gccal_".$event->getParam('gcid'),
	'allDay' => $allDayEvent,
	'description' => $description
);
I tried to replace htmlspecialchars_decode($event->getTitle()) with JHTML::_('content.prepare', htmlspecialchars_decode($event->getTitle())) and make it like:
$obj = new stdClass;
$obj->text = htmlspecialchars_decode($event->getTitle());
JPluginHelper::importPlugin('content');
$dispatcher =& JDispatcher::getInstance();
$results = $dispatcher->trigger( 'onContentPrepare', array( 'com_filer.filer', &$obj, &$params, 0 ) );
$title = $obj->text;
But nothing helps. By the way if I include another content plugin's tag such code is working well and renders $title as needed but not {lang xx}{/lang} tag.
Can you explane what I'm doing wrong?
L\'Amministratore ha disattivato l\'accesso in scrittura al pubblico.

How to use in code? 19/02/2013 16:24 #1011

Temporary fix it with dirty hack in jsonfeed view override, just put easy language plugin onAfterRender function and call it when populate event data (/templates/xxx/html/com_gcalendar/jsonfeed/default.php):
function easylang ( $text ) {
	$buffer = $text;
 
	if ( strpos( $buffer, '{lang' ) === false ) return $buffer;
 
	$lang_codes 	= JLanguageHelper::getLanguages('lang_code');
	$lang_code 	= $lang_codes[JFactory::getLanguage()->getTag()]->sef;
 
	$regex = "#{lang ".$lang_code."}(.*?){\/lang}#is";
	$regexTextarea = "#<textarea(.*?)>(.*?)<\/textarea>#is";
	$regexInput = "#<input(.*?)>#is";
 
	$matches = array();
	preg_match_all($regexTextarea, $buffer, $matches, PREG_SET_ORDER);
	$textarea = array();
	foreach ($matches as $key => $match) {
		if(strpos( $match[0], '{lang' ) !== false) {
			$textarea[$key] = $match[0];
			$buffer = str_replace($textarea[$key], '~^t'.$key.'~', $buffer);
		}
	}
 
	$matches = array();
	preg_match_all($regexInput, $buffer, $matches, PREG_SET_ORDER);
	$input = array();
	foreach ($matches as $key => $match) {
		if(
			(strpos( $match[0], 'type="password"' ) !== false || 
			strpos( $match[0], 'type="text"' ) !== false) && 
			strpos( $match[0], '{lang' ) !== false) {
			$input[$key] = $match[0];
			$buffer = str_replace($input[$key], '~^i'.$key.'~', $buffer);
		}
	}
 
	if (strpos( $buffer, '{lang' ) !== false) {
		$buffer = preg_replace($regex,'$1', $buffer);
		$regex = "#{lang [^}]+}.*?{\/lang}#is";
		$buffer = preg_replace($regex,'', $buffer);
 
		if ($textarea) {
			foreach ($textarea as $key => $t) {
				$buffer = str_replace('~^t'.$key.'~', $t, $buffer);
			}
			unset($textarea);
		}
		if ($input) {
			foreach ($input as $key => $i) {
				$buffer = str_replace('~^i'.$key.'~', $i, $buffer);
			}
			unset($input);
		}
	}
	return $buffer;
}
//*******************************************************
'title' => easylang(htmlspecialchars_decode($event->getTitle()))
But how to fix this better?
L\'Amministratore ha disattivato l\'accesso in scrittura al pubblico.