JiFile for Joomla!

JiFile is a component for Joomla! that allows you to index file contents (PDF, DOC, etc..) to perform searches in them.

Learn more...  Demo

JoomPhoto Mobile

JoomPhoto Mobile is a component for Joomla! that allows you to share the photos from your Android device to your site Joomla.

Learn more...  Demo

iFile Framework

IFile is an open source framework written entirely in PHP, allows the indexing of textual content of a document (DOC, PDF, EXCEL, etc.) and a quick search within them.

Learn more...  Demo

Easy Language

Easy Language is a plugin for easy and immediate management of multilingual texts in every possible area of joomla, articles, components, modules, metadata, template, other components(example K2) etc.

Learn more...

Article Book Effect

Article Book Effect
View Joomla articles with the effect turns the page of a book. This plugin will display the contents of an article in Joomla as a real book or magazine, using all the benefits of HTML5

Learn more...  Demo


Passport photo

Passport photo
The most popular Android app that allows you to print photos cards for your documents with your Android smartphone, in a simple and intuitive way.

Learn more...


Crazy Shadow

Crazy Shadow
Crazy Shadow is the 3D fast-paced and fun puzzle Android game! Try to rotate and drag shapes in the position of their shadows without fail! Solve in succession all combinations of levels of the game.

Learn more...


Admin Countdown

Admin Countdown
Module for Joomla! 2.5 and 3.x displays in the administration part of the site, a timer with countdown of the time remaining in your session.

Learn more...  Demo

Welcome, Guest
Username: Password: Remember me

TOPIC: How to use in code?

How to use in code? 19 Feb 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());
$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?
The administrator has disabled public write access.

How to use in code? 19 Feb 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) {
			(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);
		if ($input) {
			foreach ($input as $key => $i) {
				$buffer = str_replace('~^i'.$key.'~', $i, $buffer);
	return $buffer;
'title' => easylang(htmlspecialchars_decode($event->getTitle()))
But how to fix this better?
The administrator has disabled public write access.