Ejemplo n.º 1
0
 /**
  * Tries to detect the language.
  *
  * @return	string locale
  * @since	1.5
  */
 public static function detectLanguage()
 {
     if (isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) {
         $systemLangs = JLanguage::getKnownLanguages();
         $browserLangs = explode(',', $_SERVER['HTTP_ACCEPT_LANGUAGE']);
         foreach ($browserLangs as $browserLang) {
             // slice out the part before ; on first step, the part before - on second, place into array
             $browserLang = substr($browserLang, 0, strcspn($browserLang, ';'));
             $primary_browserLang = substr($browserLang, 0, 2);
             foreach ($systemLangs as $systemLang => $metadata) {
                 // take off 3 letters iso code languages as they can't match browsers' languages and default them to en
                 $Jinstall_lang = $metadata['tag'];
                 if (strlen($Jinstall_lang) < 6) {
                     if (strtolower($browserLang) == strtolower(substr($metadata['tag'], 0, strlen($browserLang)))) {
                         return $systemLang;
                     } else {
                         if ($primary_browserLang == substr($metadata['tag'], 0, 2)) {
                             $primaryDetectedLang = $systemLang;
                         }
                     }
                 }
             }
             if (isset($primaryDetectedLang)) {
                 return $primaryDetectedLang;
             }
         }
     }
     return 'en-GB';
 }
Ejemplo n.º 2
0
 /**
  * Method to get the field input.
  *
  * @return  string    The field input.
  */
 protected function getInput()
 {
     $attributes = '';
     if ($v = (string) $this->element['onchange']) {
         $attributes .= ' onchange="' . $v . '"';
     }
     $params = JComponentHelper::getParams('com_localise');
     $reference = $params->get('reference', 'en-GB');
     $admin = JLanguage::getKnownLanguages(LOCALISEPATH_ADMINISTRATOR);
     $site = JLanguage::getKnownLanguages(LOCALISEPATH_SITE);
     if (JFolder::exists(LOCALISEPATH_INSTALLATION)) {
         $install = JLanguage::getKnownLanguages(LOCALISEPATH_INSTALLATION);
     } else {
         $install = array();
     }
     $languages = array_merge($admin, $site, $install);
     $attributes .= ' class="' . (string) $this->element['class'] . ($this->value == $reference ? ' iconlist-16-reference"' : '"');
     foreach ($languages as $i => $language) {
         $languages[$i] = JArrayHelper::toObject($language);
     }
     JArrayHelper::sortObjects($languages, 'name');
     $options = array();
     foreach ($this->element->children() as $option) {
         $options[] = JHtml::_('select.option', $option->attributes('value'), JText::_(trim($option)), array('option.attr' => 'attributes', 'attr' => ''));
     }
     foreach ($languages as $language) {
         $options[] = JHtml::_('select.option', $language->tag, $language->name, array('option.attr' => 'attributes', 'attr' => 'class="' . ($language->tag == $reference ? 'iconlist-16-reference" title="' . JText::_('COM_LOCALISE_TOOLTIP_FIELD_LANGUAGE_REFERENCE') . '"' : '"')));
     }
     $return = JHtml::_('select.genericlist', $options, $this->name, array('id' => $this->id, 'list.select' => $this->value, 'option.attr' => 'attributes', 'list.attr' => $attributes));
     return $return;
 }
Ejemplo n.º 3
0
 function getOptions()
 {
     $languages = JLanguage::getKnownLanguages();
     $fields = array();
     foreach ($languages as $language) {
         $options[] = JHtml::_('select.option', strtolower($language['tag']), $language['name'] . ' (' . strtolower($language['tag'] . ')'));
     }
     return $options;
 }
Ejemplo n.º 4
0
 public function zipLiveTemplate(&$model)
 {
     jimport('joomla.filesystem.archive');
     jimport('joomla.filesystem.file');
     jimport('joomla.filesystem.folder');
     $item =& $model->getItem();
     $item->name = strtolower($item->name);
     //Create TempFolders
     if (JFolder::exists($model->getTempPath(true))) {
         JFolder::delete($model->getTempPath(true));
     }
     JFolder::create($model->getTempPath());
     //Copy the template
     if (JFolder::exists(JPATH_SITE . DS . 'templates' . DS . $item->name)) {
         JFolder::copy(JPATH_SITE . DS . 'templates' . DS . $item->name, $model->getTempPath(), '', true);
     } elseif (JFolder::exists(JPATH_ADMINISTRATOR . DS . 'templates' . DS . $item->name)) {
         JFolder::copy(JPATH_ADMINISTRATOR . DS . 'templates' . DS . $item->name, $model->getTempPath(), '', true);
     } else {
         JFolder::delete($model->getTempPath());
         return -2;
     }
     //Create Language Folders
     if (!JFolder::exists($model->getTempPath() . DS . 'language')) {
         JFolder::create($model->getTempPath() . DS . 'language');
     }
     //Find Language Files
     $langs_site = JLanguage::getKnownLanguages(JPATH_SITE);
     $langs_admin = JLanguage::getKnownLanguages(JPATH_ADMINISTRATOR);
     $langfiles_site = array();
     $langfiles_admin = array();
     foreach ($langs_site as $lang) {
         $langfiles_site = array_merge(JFolder::files(JPATH_SITE . DS . 'language' . DS . $lang['tag'], $item->name, true, true), $langfiles_site);
     }
     foreach ($langs_admin as $lang) {
         $langfiles_admin = array_merge(JFolder::files(JPATH_ADMINISTRATOR . DS . 'language' . DS . $lang['tag'], $item->name, true, true), $langfiles_admin);
     }
     //Copy Language Files
     if (count($langfiles_site)) {
         foreach ($langfiles_site as $file) {
             JFile::copy($file, $model->getTempPath() . DS . 'language' . DS . JFile::getName($file));
         }
     }
     if (count($langfiles_admin)) {
         foreach ($langfiles_admin as $file) {
             JFile::copy($file, $model->getTempPath() . DS . 'language' . DS . JFile::getName($file));
         }
     }
     $model->readinFiles();
     $model->buildArchiveContent();
     //create archive
     $model->createArchive();
     //delete tmp folder
     if (JFolder::exists(JPATH_SITE . DS . 'tmp' . DS . 'jctmp')) {
         JFolder::delete(JPATH_SITE . DS . 'tmp' . DS . 'jctmp');
     }
 }
 public function buildComponent($component)
 {
     $sides = ['admin', 'site'];
     $languages = array_keys(\JLanguage::getKnownLanguages());
     foreach ($sides as $side) {
         $strings = $this->getStrings($side, $component);
         foreach ($languages as $lang) {
             $this->saveStrings($strings, $component, $lang, $side);
         }
     }
 }
Ejemplo n.º 6
0
 function isFrontpage()
 {
     // get all known languages
     $languages = JLanguage::getKnownLanguages();
     $menu = JSite::getMenu();
     foreach ($languages as $lang) {
         if ($menu->getActive() == $menu->getDefault($lang['tag'])) {
             return true;
         }
     }
     return false;
 }
Ejemplo n.º 7
0
 public function getOptions()
 {
     jimport('joomla.utilities.arrayhelper');
     $languages = JLanguage::getKnownLanguages(JPATH_ROOT);
     foreach ($languages as $index => $language) {
         $language['value'] = $language['tag'];
         $language['title'] = $language['name'];
         $languages[$index] = JArrayHelper::toObject($language);
     }
     $this->options = $languages;
     return $this->options;
 }
Ejemplo n.º 8
0
 function fetchElement($name, $value, &$node, $control_name)
 {
     $languages = JLanguage::getKnownLanguages();
     $fields = array();
     $i = 0;
     foreach ($languages as $language) {
         $fields[$i]['value'] = strtolower($language['tag']);
         $fields[$i]['text'] = $language['name'] . ' (' . $fields[$i]['value'] . ')';
         $i++;
     }
     //$class = 'multiple="true" size="10"  ';
     $class = '';
     return JHTML::_('select.genericlist', $fields, $control_name . '[' . $name . ']', $class, 'value', 'text', $value, $control_name . $name);
 }
Ejemplo n.º 9
0
 /**
  * Method to get the field input markup.
  *
  * @return  string  The field input markup.
  * @since   1.6
  */
 protected function getInput()
 {
     $html = '';
     $langs = JLanguage::getKnownLanguages(JPATH_SITE);
     JFactory::getDocument()->addScript(JUri::root() . 'administrator/components/com_dzproduct/assets/js/multilang.js');
     $html .= '<div id="' . $this->id . '" class="form-horizontal field_multilang">';
     foreach ($langs as $lang) {
         $id = $this->id . '_' . $lang['tag'];
         $html .= '<div class="input-prepend">';
         $html .= '<span class="add-on">' . $lang['tag'] . '</span>';
         $html .= '<input id="' . $id . '" type="text" data-lang="' . $lang['tag'] . '" class="field_child"/>';
         $html .= '</div>';
         $html .= '<br /><br />';
     }
     $html .= '<input type="hidden" name="' . $this->name . '" class="field_root" value=\'' . $this->value . '\'/>';
     $html .= '</div>';
     return $html;
 }
Ejemplo n.º 10
0
    /**
     * @param	JForm	$form	The form to be altered.
     * @param	array	$data	The associated data for the form.
     *
     * @return	boolean
     * @since	2.5
     */
    public function onContentPrepareForm($form, $data)
    {
        // Check we have a form
        if (!$form instanceof JForm) {
            $this->_subject->setError('JERROR_NOT_A_FORM');
            return false;
        }
        // Check we are manipulating a valid form.
        $app = JFactory::getApplication();
        if ($form->getName() != 'com_plugins.plugin' || isset($data->name) && $data->name != 'plg_system_languagecode' || empty($data) && !$app->getUserState('plg_system_language_code.edit')) {
            return true;
        }
        // Mark the plugin as being edited
        $app->setUserState('plg_system_language_code.edit', $data->name == 'plg_system_languagecode');
        // Get site languages
        $languages = JLanguage::getKnownLanguages(JPATH_SITE);
        // Inject fields into the form
        foreach ($languages as $tag => $language) {
            $form->load('
<form>
	<fields name="params">
		<fieldset
			name="languagecode"
			label="PLG_SYSTEM_LANGUAGECODE_FIELDSET_LABEL"
			description="PLG_SYSTEM_LANGUAGECODE_FIELDSET_DESC"
		>
			<field
				name="' . strtolower($tag) . '"
				type="text"
				description="' . htmlspecialchars(JText::sprintf('PLG_SYSTEM_LANGUAGECODE_FIELD_DESC', $language['name']), ENT_COMPAT, 'UTF-8') . '"
				translate_description="false"
				label="' . $tag . '"
				translate_label="false"
				size="7"
				filter="cmd"
			/>
		</fieldset>
	</fields>
</form>
			');
        }
        return true;
    }
Ejemplo n.º 11
0
 /**
  * Method to get the field input.
  *
  * @return  string    The field input.
  */
 protected function getOptions()
 {
     $admin = JLanguage::getKnownLanguages(LOCALISEPATH_ADMINISTRATOR);
     $site = JLanguage::getKnownLanguages(LOCALISEPATH_SITE);
     if (JFolder::exists(LOCALISEPATH_INSTALLATION)) {
         $installation = JLanguage::getKnownLanguages(LOCALISEPATH_INSTALLATION);
         $languages = array_intersect_key($admin, $site, $installation);
     } else {
         $languages = array_intersect_key($admin, $site);
     }
     foreach ($languages as $i => $language) {
         $languages[$i] = JArrayHelper::toObject($language);
     }
     JArrayHelper::sortObjects($languages, 'name');
     $options = parent::getOptions();
     foreach ($languages as $language) {
         $options[] = JHtml::_('select.option', $language->tag, $language->name);
     }
     return $options;
 }
Ejemplo n.º 12
0
 /**
  * Get the necessary data for our stats report
  *
  * @return array
  */
 public function getData()
 {
     $data = array();
     $db = JFactory::getDbo();
     $data['php'] = phpversion();
     $data['mysql'] = $db->getVersion() . ' ' . $db->name;
     $data['domain'] = Juri::root();
     $data['joomla'] = JVERSION;
     $data['os'] = php_uname();
     $data['server'] = $_SERVER['SERVER_SOFTWARE'] . ' ' . (function_exists('php_sapi_name') ? php_sapi_name() : '');
     $data['language'] = implode(',', array_keys(JLanguage::getKnownLanguages(JPATH_BASE)));
     $data['timezone'] = JFactory::getConfig()->get('offset');
     $data['extension'] = $this->extension;
     $data['version'] = CompojoomComponentHelper::getManifest($this->extension)->get('version');
     $data['config'] = $this->getConfig();
     $customData = $this->getCustomExtensionData();
     if ($customData) {
         $data = array_merge($data, $customData);
     }
     return $data;
 }
Ejemplo n.º 13
0
 /**
  * Tries to detect the language
  *
  * @access	public
  * @return	string locale
  * @since	1.5
  */
 function detectLanguage()
 {
     if (isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) {
         $systemLangs = JLanguage::getKnownLanguages();
         $browserLangs = explode(',', $_SERVER['HTTP_ACCEPT_LANGUAGE']);
         foreach ($browserLangs as $browserLang) {
             // slice out the part before ; on first step, the part before - on second, place into array
             $browserLang = substr($browserLang, 0, strcspn($browserLang, ';'));
             $primary_browserLang = substr($browserLang, 0, 2);
             foreach ($systemLangs as $systemLang => $metadata) {
                 if (strtolower($browserLang) == strtolower(substr($metadata['tag'], 0, strlen($browserLang)))) {
                     return $systemLang;
                 } elseif ($primary_browserLang == substr($metadata['tag'], 0, 2)) {
                     $primaryDetectedLang = $systemLang;
                 }
             }
             if (isset($primaryDetectedLang)) {
                 return $primaryDetectedLang;
             }
         }
     }
     return 'en-GB';
 }
Ejemplo n.º 14
0
 /**
  * Test...
  *
  * @covers JLanguage::getKnownLanguages
  *
  * @return void
  */
 public function testGetKnownLanguages()
 {
     // This method returns a list of known languages
     $basePath = __DIR__ . '/data';
     $option1 = array('name' => 'English (United Kingdom)', 'tag' => 'en-GB', 'rtl' => '0', 'locale' => 'en_GB.utf8, en_GB.UTF-8, en_GB, eng_GB, en, english, english-uk, uk, gbr, britain, england, great britain, uk, united kingdom, united-kingdom', 'firstDay' => '0');
     $listCompareEqual1 = array('en-GB' => $option1);
     $list = JLanguage::getKnownLanguages($basePath);
     $this->assertEquals($listCompareEqual1, $list, 'Line: ' . __LINE__);
 }
Ejemplo n.º 15
0
 /**
  * Build the configuration options.
  * @return array	The Configuration in an array
  */
 function _buildoptions()
 {
     // initialise configuration variables
     global $mainframe, $task, $option;
     //$task	= strtolower($this->_task);
     $options['config'] = JComponentHelper::getParams($option . '1');
     $options['autoCorrect'] = $options['config']->get('autoCorrect', 'a^=�');
     $options['backticks'] = $options['config']->get('backticks', 0);
     $options['cid'] = JRequest::getVar('cid', array(''), '', 'array');
     $options['client_lang'] = $mainframe->getUserStateFromRequest($option . '.client_lang', 'client_lang', '');
     $options['globalChanges'] = $options['config']->get('globalChanges', 0);
     $options['limitstart'] = $mainframe->getUserStateFromRequest($option . '.limitstart', 'limitstart', '');
     $options['newprocess'] = JRequest::getVar('newprocess', 0, '', 'integer');
     $options['refLang'] = $options['config']->get('refLanguage', 'en-GB');
     $options['refLangMissing'] = false;
     $options['searchStyle'] = $options['config']->get('searchStyle', 'background-color:yellow;');
     $options['task'] = strtolower($task);
     // initialise a list of available languages
     $options['languages'] = array();
     $options['clients'] = array();
     $options['clients']['S'] = JText::_('Site');
     foreach (JLanguage::getKnownLanguages(JPATH_SITE) as $k => $v) {
         $options['languages']['S_' . $k] = $options['clients']['S'] . ' - ' . $v['name'];
     }
     $options['clients']['A'] = JText::_('Administrator');
     foreach (JLanguage::getKnownLanguages(JPATH_ADMINISTRATOR) as $k => $v) {
         $options['languages']['A_' . $k] = $options['clients']['A'] . ' - ' . $v['name'];
     }
     if (JFolder::exists(JPATH_INSTALLATION)) {
         $options['clients']['I'] = JText::_('Installation');
         foreach (JLanguage::getKnownLanguages(JPATH_INSTALLATION) as $k => $v) {
             $options['languages']['I_' . $k] = $options['clients']['I'] . ' - ' . $v['name'];
         }
     }
     // validate client_lang (split, reassemble with cases, check against allowed values, on failure default to first allowed value)
     $cl_split = preg_split("/[^a-z]/i", $options['client_lang']);
     if ($options['client_lang']) {
         $options['client_lang'] = strtoupper($cl_split[0]) . '_' . strtolower($cl_split[1]) . '-' . strtoupper($cl_split[2]);
     }
     if (!isset($options['languages'][$options['client_lang']])) {
         $options['client_lang'] = key($options['languages']);
     }
     // set client variables
     $options['client'] = $options['client_lang'][0];
     if ($options['client'] == 'A') {
         $options['basePath'] = JPATH_ADMINISTRATOR;
         $options['clientKey'] = 'administrator';
     } else {
         if ($options['client'] == 'I') {
             $options['basePath'] = JPATH_INSTALLATION;
             $options['clientKey'] = 'installation';
         } else {
             $options['basePath'] = JPATH_SITE;
             $options['clientKey'] = 'site';
         }
     }
     $options['clientName'] = JText::_($options['clientKey']);
     // validate that the reference language exists on this client
     if (!isset($options['languages'][$options['client'] . '_' . $options['refLang']])) {
         // initialise to en-GB
         $use = 'en-GB';
         // look for the first key index containing the reference language string
         foreach ($options['languages'] as $k => $v) {
             if ($k[0] == $options['client']) {
                 $use = substr($k, -4);
                 break;
             }
         }
         // set back to $options key
         $options['refLang'] = $use;
     }
     // set language variables
     $options['lang'] = substr($options['client_lang'], 2);
     $options['langLen'] = strlen($options['lang']);
     $options['langName'] = $options['languages'][$options['client_lang']];
     $options['langPath'] = JLanguage::getLanguagePath($options['basePath'], $options['lang']);
     $options['refLangLen'] = strlen($options['refLang']);
     $options['refLangPath'] = JLanguage::getLanguagePath($options['basePath'], $options['refLang']);
     // set reference language variables
     $options['isReference'] = intval($options['lang'] == $options['refLang']);
     // validate the cid array
     if (!is_array($options['cid'])) {
         if (!empty($options['cid'])) {
             $options['cid'] = array($options['cid']);
         } else {
             $options['cid'] = array('');
         }
     }
     // process the cid array to validate filenames
     foreach ($options['cid'] as $k => $v) {
         if ($v) {
             // strip unpublished prefix
             if (substr($v, 0, 3) == 'xx.') {
                 $v = substr($v, 3);
             }
             // strip files that don't match the selected language
             if (substr($v, 0, $options['langLen']) != $options['lang']) {
                 unset($options['cid'][$k]);
             } else {
                 $options['cid'][$k] = $v;
             }
         }
     }
     // set the filename
     $options['filename'] = $options['cid'][0];
     // build the autocorrect array
     $autoCorrect = array();
     if ($options['autoCorrect']) {
         foreach (explode(';', $options['autoCorrect']) as $v) {
             list($k2, $v2) = explode('=', $v);
             $k2 = trim($k2);
             $v2 = trim($v2);
             if ($k2 && $v2) {
                 $autoCorrect[$k2] = $v2;
             }
         }
     }
     $options['autoCorrect'] = $autoCorrect;
     // return the options array
     return $options;
 }
Ejemplo n.º 16
0
 /**
  * @todo Implement testGetKnownLanguages().
  */
 public function testGetKnownLanguages()
 {
     // This method returns a list of known languages
     $basePath = '../../administrator/';
     $option1 = array('name' => 'English (United Kingdom)', 'tag' => 'en-GB', 'rtl' => 0, 'locale' => 'en_GB.utf8, en_GB.UTF-8, en_GB, eng_GB, en, english, english-uk, uk, gbr, britain, england, great britain, uk, united kingdom, united-kingdom', 'firstDay' => 0);
     $option2 = array('name' => 'XXTestLang', 'tag' => 'xx-XX', 'rtl' => 0, 'locale' => 'en_GB.utf8, en_GB.UTF-8, en_GB, eng_GB, en, english, english-uk, uk, gbr, britain, england, great britain, uk, united kingdom, united-kingdom', 'firstDay' => 0);
     $listCompareEqual1 = array('en-GB' => $option1, 'xx-XX' => $option2);
     $lang = new JLanguage('');
     // for administrator directory, returns know languages (default)
     $list = $lang->getKnownLanguages($basePath);
     $this->assertThat($listCompareEqual1, $this->equalTo($list), 'Line: ' . __LINE__);
     $this->assertNotEquals($listCompareEqual1['xx-XX']['name'], $list['en-GB']['name'], 'Line: ' . __LINE__);
 }
Ejemplo n.º 17
0
    /**
     * Prepare form.
     *
     * @param   JForm  $form  The form to be altered.
     * @param   mixed  $data  The associated data for the form.
     *
     * @return  boolean
     *
     * @since	2.5
     */
    public function onContentPrepareForm($form, $data)
    {
        // Check we have a form.
        if (!$form instanceof JForm) {
            $this->_subject->setError('JERROR_NOT_A_FORM');
            return false;
        }
        // Check we are manipulating the languagecode plugin.
        if ($form->getName() != 'com_plugins.plugin' || !$form->getField('languagecodeplugin', 'params')) {
            return true;
        }
        // Get site languages.
        if ($languages = JLanguage::getKnownLanguages(JPATH_SITE)) {
            // Inject fields into the form.
            foreach ($languages as $tag => $language) {
                $form->load('
					<form>
						<fields name="params">
							<fieldset
								name="languagecode"
								label="PLG_SYSTEM_LANGUAGECODE_FIELDSET_LABEL"
								description="PLG_SYSTEM_LANGUAGECODE_FIELDSET_DESC"
							>
								<field
									name="' . strtolower($tag) . '"
									type="text"
									description="' . htmlspecialchars(JText::sprintf('PLG_SYSTEM_LANGUAGECODE_FIELD_DESC', $language['name']), ENT_COMPAT, 'UTF-8') . '"
									translate_description="false"
									label="' . $tag . '"
									translate_label="false"
									size="7"
									filter="cmd"
								/>
							</fieldset>
						</fields>
					</form>
				');
            }
        }
        return true;
    }
        $ag_XML_captions =& $ag_XML_xml->document->captions[0];
    }
}
$ag_matchCheck = array("default");
// GET DEFAULT LABEL
$ag_XML_caption_content = "";
if (!empty($ag_XML_captions->caption)) {
    foreach ($ag_XML_captions->caption as $ag_imgXML_caption) {
        if (strtolower($ag_imgXML_caption->attributes('lang')) == "default") {
            $ag_XML_caption_content = $ag_imgXML_caption->data();
        }
    }
}
$ag_preview_content .= ag_render_caption("Default", "default", $ag_XML_caption_content);
// GET LABELS ON SITE LANGUAGES
$ag_lang_available = JLanguage::getKnownLanguages(JPATH_SITE);
if (!empty($ag_lang_available)) {
    foreach ($ag_lang_available as $ag_lang) {
        $ag_XML_caption_content = "";
        if (!empty($ag_XML_captions->caption)) {
            foreach ($ag_XML_captions->caption as $ag_imgXML_caption) {
                if (strtolower($ag_imgXML_caption->attributes('lang')) == strtolower($ag_lang["tag"])) {
                    $ag_XML_caption_content = $ag_imgXML_caption->data();
                    $ag_matchCheck[] = strtolower($ag_lang["tag"]);
                }
            }
        }
        $ag_preview_content .= ag_render_caption($ag_lang["name"], $ag_lang["tag"], $ag_XML_caption_content);
    }
}
if (!empty($ag_XML_captions->caption)) {
Ejemplo n.º 19
0
 function display($tpl = null)
 {
     $this->data = json_decode(JRequest::getVar('data'), true);
     $this->langs = JLanguage::getKnownLanguages();
     parent::display($tpl);
 }
Ejemplo n.º 20
0
 /**
  * Method to get all found languages of frontend and backend.
  *
  * The resulting array has entries of the following style:
  * <Language Tag>0|1 => <Language Name> - <Client Name>
  *
  * @return	array	Sorted associative array of languages
  *
  * @since		2.5
  */
 public function getLanguages()
 {
     // Try to load the data from internal storage
     if (!empty($this->cache['languages'])) {
         return $this->cache['languages'];
     }
     // Get all languages of frontend and backend
     $languages = array();
     $site_languages = JLanguage::getKnownLanguages(JPATH_SITE);
     $admin_languages = JLanguage::getKnownLanguages(JPATH_ADMINISTRATOR);
     // Create a single array of them
     foreach ($site_languages as $tag => $language) {
         $languages[$tag . '0'] = JText::sprintf('COM_LANGUAGES_VIEW_OVERRIDES_LANGUAGES_BOX_ITEM', $language['name'], JText::_('JSITE'));
     }
     foreach ($admin_languages as $tag => $language) {
         $languages[$tag . '1'] = JText::sprintf('COM_LANGUAGES_VIEW_OVERRIDES_LANGUAGES_BOX_ITEM', $language['name'], JText::_('JADMINISTRATOR'));
     }
     // Sort it by language tag and by client after that
     ksort($languages);
     // Add the languages to the internal cache
     $this->cache['languages'] = $languages;
     return $this->cache['languages'];
 }
Ejemplo n.º 21
0
 private function checkLanguagePackages()
 {
     $languages = JLanguage::getKnownLanguages();
     foreach ($languages as $language) {
         $oldPackage = false;
         if (!in_array($language['tag'], array("en-GB"))) {
             if (is_file(JPATH_SITE . "/language/" . $language['tag'] . "/" . $language['tag'] . ".com_jevents.ini") || is_file(JPATH_ADMINISTRATOR . "/language/" . $language['tag'] . "/" . $language['tag'] . ".com_jevents.ini")) {
                 $oldPackage = true;
                 $db = JFactory::getDBO();
                 // Add one category by default if none exist already
                 $sql = "SELECT element from #__extensions WHERE type = 'file'";
                 $db->setQuery($sql);
                 $elements = $db->loadObjectList();
                 foreach ($elements as $element) {
                     if ($element->element === $language['tag'] . "_JEvents") {
                         $oldPackage = false;
                     }
                 }
             }
             if ($oldPackage) {
                 if (JText::_("JEV_UPDATE_LANGUAGE_PACKAGE") == "JEV_UPDATE_LANGUAGE_PACKAGE") {
                     $updateLanguagePackMessage = JText::sprintf('Your JEvents language package for %s is not the latest official release from JEvents. Please go to <a href="http://www.jevents.net/translations">JEvents site</a> and get the latest version to enable live update system for JEvents languages.', $language['name']);
                 } else {
                     $updateLanguagePackMessage = JText::sprintf('JEV_UPDATE_LANGUAGE_PACKAGE', $language['name']);
                 }
                 JError::raiseNotice("100", $updateLanguagePackMessage);
             }
         }
     }
 }
Ejemplo n.º 22
0
 protected function getInput()
 {
     $app = JFactory::getApplication();
     $doc = JFactory::getDocument();
     $html = $params = null;
     if (version_compare(JVERSION, '2.5.5') == -1) {
         // Joomla minimal version
         $app->enqueueMessage(JText::sprintf('MOD_PWEBCONTACT_CONFIG_MSG_JOOMLA_VERSION', '2.5.5', '<a href="index.php?option=com_joomlaupdate" target="_blank">', '</a>'), 'error');
     } else {
         JHtml::_('stylesheet', 'jui/icomoon.css', array(), true);
         // check Joomla Global Mailer configuration
         $this->checkMailer();
         // Module ID
         $module_id = $app->input->getInt('id', 0);
         // check module configuration
         if ($module_id > 0) {
             // get params
             require_once JPATH_ROOT . '/modules/mod_pwebcontact/helper.php';
             $params = modPwebcontactHelper::getParams($module_id);
             if ($params->get('rtl', 2) == 2) {
                 // warn about auto RTL
                 $langs = JLanguage::getKnownLanguages(JPATH_ROOT);
                 foreach ($langs as $lang) {
                     if ((bool) $lang['rtl']) {
                         $app->enqueueMessage(JText::_('MOD_PWEBCONTACT_CONFIG_RTL_TIP'), 'notice');
                         break;
                     }
                 }
             }
             // check if debug mode is enabled
             if ($params->get('debug', 0)) {
                 $app->enqueueMessage(JText::_('MOD_PWEBCONTACT_CONFIG_MSG_DISABLE_DEBUG'), 'notice');
             }
             // check if demo mode is enabled
             if ($params->get('demo', 0)) {
                 $app->enqueueMessage(JText::_('MOD_PWEBCONTACT_CONFIG_MSG_DEMO'), 'warning');
             }
             // check if upload directory is writable
             if ($params->get('show_upload', 0)) {
                 $this->checkUploadPath('/media/mod_pwebcontact/upload/' . $module_id . '/');
             }
             // check Admin Tools Pro exception
             if (is_file(JPATH_ROOT . '/components/com_ajax/ajax.php')) {
                 $this->checkAdminToolsPro();
             } elseif ($params->get('root_path', 0)) {
                 $this->checkAdminToolsPro('mod_pwebcontact_ajax.php');
             } else {
                 $this->checkAdminToolsPro('modules/mod_pwebcontact/ajax.php');
             }
             // check JoomlArt T3 Framework templates
             $this->checkJAT3v2CacheExclude('mod_pwebcontact');
             // check module details configuration
             $this->checkModuleDetails($module_id);
         }
         // check if Ajax Interface is installed and enabled
         if ($this->checkAjaxComponent() === true or version_compare(JVERSION, '3.2.0') >= 0) {
             // Hide root path option
             $doc->addScriptDeclaration('jQuery(document).ready(function($){' . '$("#' . $this->formControl . '_' . $this->group . '_root_path").closest("li,div.control-group").hide();' . '});');
         }
         // check if Bootstrap is updated to version 2.3.1
         if (version_compare(JVERSION, '3.0.0') >= 0 and version_compare(JVERSION, '3.1.4') == -1) {
             $this->checkBootstrap();
         }
         // check functions for image creation
         $this->checkImageTextCreation();
         // check if cache directory is writable
         // check if direct access to files in cache directory is allowed
         $this->checkCacheDir();
     }
     // add documentation toolbar button
     if (version_compare(JVERSION, '3.0.0') == -1) {
         $button = '<a href="' . $this->documentation . '" style="font-weight:bold;border-color:#025A8D;background-color:#DBE4E9;" target="_blank"><span class="icon-32-help"> </span> ' . JText::_('MOD_PWEBCONTACT_DOCUMENTATION') . '</a>';
     } else {
         $button = '<a href="' . $this->documentation . '" class="btn btn-small btn-info" target="_blank"><i class="icon-support"></i> ' . JText::_('MOD_PWEBCONTACT_DOCUMENTATION') . '</a>';
     }
     $bar = JToolBar::getInstance();
     $bar->appendButton('Custom', $button, $this->extension . '-docs');
     JText::script('MOD_PWEBCONTACT_PREVIEW_BUTTON');
     JText::script('MOD_PWEBCONTACT_COPY_BUTTON');
     JText::script('MOD_PWEBCONTACT_INTEGRATION_COMPONENT_VIEW');
     // add admin styles and script
     $doc->addStyleSheet(JUri::root(true) . '/media/mod_pwebcontact/css/admin.css');
     if (class_exists('JHtmlJquery')) {
         JHtml::_('jquery.framework');
         $doc->addScript(JUri::root(true) . '/media/mod_pwebcontact/js/jquery.admin.js');
     }
     // disable Joomla Form Validator which slows down saving big forms
     $doc->addScriptDeclaration('window.addEvent("domready", function(){' . 'document.forms.adminForm.className = document.forms.adminForm.className.replace("form-validate", "");' . 'document.formvalidator = {' . 'setHandler: function(name, fn, en){},' . 'attachToForm: function(form){},' . 'validate: function(el){return true},' . 'isValid: function(form){return true},' . 'handleResponse: function(state, el){}' . '};' . '});');
     // check if user is authorized to manage extensions
     if (JFactory::getUser()->authorise('core.manage', 'com_installer')) {
         // add feeds script
         if ($this->value == 1 or $this->value == 3) {
             require_once JPATH_ROOT . '/modules/mod_pwebcontact/helpers/updateserver.php';
             $updateServer = new modPWebContactUpdateServer();
             $doc->addScriptDeclaration($updateServer->getFeedScript());
         }
     } else {
         $doc->addScriptDeclaration('if(typeof jQuery!=="undefined"){' . 'jQuery(document).ready(function($){' . '$("#' . $this->formControl . '_' . $this->group . '_feed").closest("li,div.control-group").hide();' . '})}');
     }
     return parent::getInput() . $html;
 }
Ejemplo n.º 23
0
 function isFrontpage()
 {
     if ($this->globalMenuActive == null) {
         // get all known languages
         $languages = JLanguage::getKnownLanguages();
         $menu = JSite::getMenu();
         foreach ($languages as $lang) {
             $menuActive = $menu->getActive();
             $menuLanguage = $menu->getDefault($lang['tag']);
             if ($menuActive == $menuLanguage) {
                 $this->globalMenuActive = $menuActive;
                 $this->globalMenuLanguage = $menuLanguage;
                 return true;
             }
         }
     }
     if ($this->globalMenuActive == $this->globalMenuLanguage) {
         return true;
     }
     return false;
 }
Ejemplo n.º 24
0
        return false;
    }
}
/**
 * ---------------------------------------------------------------------------------------------
 * Verify installed languages in the system and update language table
 * ---------------------------------------------------------------------------------------------
 */
$query = "SELECT * FROM #__languages";
$db->setQuery($query);
$cols = $db->loadResultArray();
if (!is_null($cols) && count($cols) == 0) {
    // No languages installed at all - let's use all exisiting frontend languages as default
    // Read the languages dir to find new installed languages
    // This method returns a list of JLanguage objects with the related inforamtion
    $systemLanguages = JLanguage::getKnownLanguages(JPATH_SITE);
    $lang = JFactory::getLanguage();
    foreach ($systemLanguages as $jLanguage) {
        jimport('joomla.database.table');
        JLoader::register('TableJFLanguage', JOOMFISH_ADMINPATH . DS . 'tables' . DS . 'JFLanguage.php');
        $jfLanguage =& JTable::getInstance('JFLanguage', 'Table');
        $jfLanguage->bindFromJLanguage($jLanguage);
        if ($jfLanguage->get('lang_code') == $lang->getTag()) {
            $jfLanguage->set('published', true);
        }
        if (!$jfLanguage->store()) {
            $status->upgrade[] = array('table' => JText::_('JF_FAILED_STORE_NEW_LANGUAGES'), 'status' => 'failed');
        }
    }
}
/***********************************************************************************************
Ejemplo n.º 25
0
 * @copyright   Copyright © 2011 NoNumber! All Rights Reserved
 * @license     http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
 */
// No direct access
defined('_JEXEC') or die;
$ext = JRequest::getCmd('ext');
$types = explode(',', JRequest::getString('types'));
jimport('joomla.filesystem.file');
$file = '';
$xml = '';
$missing = '';
if (in_array('langs', $types)) {
    jimport('joomla.filesystem.folder');
    $list = array();
    for ($i = 0; $i <= 1; $i++) {
        $langs = JLanguage::getKnownLanguages($i ? JPATH_SITE : JPATH_ADMINISTRATOR);
        foreach ($langs as $lang) {
            $folder = ($i ? JPATH_SITE : JPATH_ADMINISTRATOR) . DS . 'language' . DS . $lang['tag'];
            if ($lang['tag'] != 'en-GB' && JFolder::exists($folder) && (!isset($list[$lang['tag']]) || !$list[$lang['tag']])) {
                $list[$lang['tag']] = '';
                $files = JFolder::files($folder, '[_\\.]' . $ext . '\\.ini');
                if (!empty($files)) {
                    $file = JFile::read($folder . DS . $files['0'], 0, 200);
                    preg_match('#@version\\s*([a-z0-9\\.]*)#si', $file, $match);
                    if ($match && isset($match['1'])) {
                        $list[$lang['tag']] = $match['1'];
                    }
                }
            }
        }
    }
 protected static function changeModules($old_module, $new_module)
 {
     $db = JFactory::getDbo();
     // change name modules in table extensions
     $query = $db->getQuery(true)->select('*')->from($db->quoteName('#__extensions'))->where(array($db->quoteName('type') . ' = ' . $db->quote('module'), $db->quoteName('element') . ' = ' . $db->quote($old_module)));
     $modules = (array) $db->setQuery($query)->loadObjectList();
     while ($module = array_shift($modules)) {
         $module->name = $new_module;
         $module->element = $new_module;
         $db->updateObject('#__extensions', $module, 'extension_id');
     }
     $query->clear();
     // change name modules in table modules
     $query->update($db->quoteName('#__modules'))->set($db->quoteName('module') . ' = ' . $db->quote($new_module))->where($db->quotename('module') . ' = ' . $db->quote($old_module));
     $db->setQuery($query)->execute();
     $langs = JLanguage::getKnownLanguages(JPATH_SITE);
     // change language name files to lower case
     foreach ($langs as $lang) {
         $path = JPATH_SITE . '/language/' . $lang['tag'] . '/';
         $filter = '^' . $lang['tag'] . '\\.' . $old_module . '\\.(sys.ini|ini)$';
         $files = JFolder::files($path, $filter);
         foreach ($files as $file) {
             $newFile = str_replace($old_module, $new_module, $file);
             @rename(JPath::clean($path . $file), JPath::clean($path . $newFile));
         }
     }
     // change plugin folder name to lower case
     $path = JPath::clean(JPATH_SITE . '/modules/' . $old_module . '/');
     if (is_dir($path)) {
         $filter = '^' . $old_module . '\\.(php|xml)$';
         $files = JFolder::files($path, $filter);
         foreach ($files as $file) {
             $newFile = str_replace($old_module, $new_module, $file);
             @rename($path . $file, $path . $newFile);
         }
         $newPath = JPath::clean(JPATH_SITE . '/modules/' . $new_module);
         @rename($path, $newPath);
     }
     // change plugin folder ane to lowe case in templates
     $templates = self::getTempaltes();
     if (!empty($templates)) {
         foreach ($templates as $template) {
             $path = JPath::clean(JPATH_SITE . '/templates/' . $template->element . '/html/' . $old_module);
             // change plugin folder name to lower case
             if (is_dir($path)) {
                 $newPath = JPath::clean(JPATH_SITE . '/templates/' . $template->element . '/html/' . $new_module);
                 @rename($path, $newPath);
             }
         }
     }
 }
 /**
  * Get available languages
  *
  * @param   string  $key  Array key
  *
  * @return  array  An array of published languages
  *
  * @since   11.1
  */
 public static function getLanguages($key = 'default')
 {
     static $languages;
     if (empty($languages)) {
         // Installation uses available languages
         if (JFactory::getApplication()->getClientId() == 2) {
             $languages[$key] = array();
             $knownLangs = JLanguage::getKnownLanguages(JPATH_BASE);
             foreach ($knownLangs as $metadata) {
                 // Take off 3 letters iso code languages as they can't match browsers' languages and default them to en
                 $obj = new stdClass();
                 $obj->lang_code = $metadata['tag'];
                 $languages[$key][] = $obj;
             }
         } else {
             $cache = JFactory::getCache('com_languages', '');
             if (!($languages = $cache->get('languages'))) {
                 $db = JFactory::getDbo();
                 $query = $db->getQuery(true)->select('*')->from('#__languages')->where('published=1')->order('ordering ASC');
                 $db->setQuery($query);
                 $languages['default'] = $db->loadObjectList();
                 $languages['sef'] = array();
                 $languages['lang_code'] = array();
                 if (isset($languages['default'][0])) {
                     foreach ($languages['default'] as $lang) {
                         $languages['sef'][$lang->sef] = $lang;
                         $languages['lang_code'][$lang->lang_code] = $lang;
                     }
                 }
                 $cache->store($languages, 'languages');
             }
         }
     }
     return $languages[$key];
 }
Ejemplo n.º 28
0
 /**
  * Method to allow derived classes to preprocess the form.
  *
  * @param  object  A form object.
  * @param  mixed  The data expected for the form.
  * @param  string  The name of the plugin group to import (defaults to "content").
  * @throws  Exception if there is an error in the form event.
  * @since  1.6
  */
 protected function preprocessForm(JForm $form, $item, $group = 'content')
 {
     // Initialize variables.
     $filename = $this->getState('translation.filename');
     $client = $this->getState('translation.client');
     $tag = $this->getState('translation.tag');
     $origin = LocaliseHelper::getOrigin($filename, $client);
     $app = JFactory::getApplication();
     $false = false;
     // Compute all known languages
     static $languages = array();
     jimport('joomla.language.language');
     if (!array_key_exists($client, $languages)) {
         $languages[$client] = JLanguage::getKnownLanguages(constant('LOCALISEPATH_' . strtoupper($client)));
     }
     if (is_object($item)) {
         $form->setFieldAttribute('legend', 'unchanged', $item->unchanged, 'legend');
         $form->setFieldAttribute('legend', 'translated', $item->translated, 'legend');
         $form->setFieldAttribute('legend', 'untranslated', $item->total - $item->translated - $item->unchanged, 'legend');
         $form->setFieldAttribute('legend', 'extra', $item->extra, 'legend');
     }
     if ($this->getState('translation.layout') != 'raw') {
         $path = $this->getState('translation.path');
         $refpath = $this->getState('translation.refpath');
         $sections = LocaliseHelper::parseSections($path);
         $refsections = LocaliseHelper::parseSections($refpath);
         $addform = new JXMLElement('<form />');
         $group = $addform->addChild('fields');
         $group->addAttribute('name', 'strings');
         $fieldset = $group->addChild('fieldset');
         $fieldset->addAttribute('name', 'Default');
         $fieldset->addAttribute('label', 'Default');
         if (JFile::exists($refpath)) {
             $stream = new JStream();
             $stream->open($refpath);
             $header = true;
             $lineNumber = 0;
             while (!$stream->eof()) {
                 $line = $stream->gets();
                 $lineNumber++;
                 // Blank lines
                 if (preg_match('/^\\s*$/', $line)) {
                     $header = true;
                     $field = $fieldset->addChild('field');
                     $field->addAttribute('label', '');
                     $field->addAttribute('type', 'spacer');
                     $field->addAttribute('class', 'text');
                     continue;
                 } elseif (preg_match('/^\\[([^\\]]*)\\]\\s*$/', $line, $matches)) {
                     $header = false;
                     $form->load($addform, false);
                     $section = $matches[1];
                     $addform = new JXMLElement('<form />');
                     $group = $addform->addChild('fields');
                     $group->addAttribute('name', 'strings');
                     $fieldset = $group->addChild('fieldset');
                     $fieldset->addAttribute('name', $section);
                     $fieldset->addAttribute('label', $section);
                     continue;
                 } elseif (!$header && preg_match('/^;(.*)$/', $line, $matches)) {
                     $key = $matches[1];
                     $field = $fieldset->addChild('field');
                     $field->addAttribute('label', $key);
                     $field->addAttribute('type', 'spacer');
                     $field->addAttribute('class', 'text');
                     continue;
                 } elseif (preg_match('/^([A-Z][A-Z0-9_\\-\\.]*)\\s*=/', $line, $matches)) {
                     $header = false;
                     $key = $matches[1];
                     $field = $fieldset->addChild('field');
                     $string = $refsections['keys'][$key];
                     $translated = isset($sections['keys'][$key]);
                     $modified = $translated && $sections['keys'][$key] != $refsections['keys'][$key];
                     $status = $modified ? 'translated' : ($translated ? 'unchanged' : 'untranslated');
                     $default = $translated ? $sections['keys'][$key] : '';
                     $label = '<b>' . $key . '</b><br />' . htmlspecialchars($string, ENT_COMPAT, 'UTF-8');
                     $field->addAttribute('status', $status);
                     $field->addAttribute('description', $string);
                     if ($default) {
                         $field->addAttribute('default', $default);
                     } else {
                         $field->addAttribute('default', $string);
                     }
                     $field->addAttribute('label', $label);
                     $field->addAttribute('name', $key);
                     $field->addAttribute('type', 'key');
                     $field->addAttribute('filter', 'raw');
                     continue;
                 } elseif (!preg_match('/^(|(\\[[^\\]]*\\])|([A-Z][A-Z0-9_\\-\\.]*\\s*=(\\s*(("[^"]*")|(_QQ_)))+))\\s*(;.*)?$/', $line)) {
                     $this->item->error[] = $lineNumber;
                 }
             }
             $stream->close();
             $newstrings = false;
             if (!empty($sections['keys'])) {
                 foreach ($sections['keys'] as $key => $string) {
                     if (!isset($refsections['keys'][$key])) {
                         if (!$newstrings) {
                             $newstrings = true;
                             $form->load($addform, false);
                             $section = 'New Strings';
                             $addform = new JXMLElement('<form />');
                             $group = $addform->addChild('fields');
                             $group->addAttribute('name', 'strings');
                             $fieldset = $group->addChild('fieldset');
                             $fieldset->addAttribute('name', $section);
                             $fieldset->addAttribute('label', $section);
                         }
                         $field = $fieldset->addChild('field');
                         $status = 'extra';
                         $default = $string;
                         $label = '<b>' . $key . '</b>';
                         $field->addAttribute('status', $status);
                         $field->addAttribute('description', $string);
                         if ($default) {
                             $field->addAttribute('default', $default);
                         } else {
                             $field->addAttribute('default', $string);
                         }
                         $field->addAttribute('label', $label);
                         $field->addAttribute('name', $key);
                         $field->addAttribute('type', 'key');
                         $field->addAttribute('filter', 'raw');
                     }
                 }
             }
         }
         $form->load($addform, false);
     }
     // Check the session for previously entered form data.
     $data = $app->getUserState('com_localise.edit.translation.data', array());
     // Bind the form data if present.
     if (!empty($data)) {
         $form->bind($data);
     }
     if ($origin != '_thirdparty' && $origin != '_override') {
         $packages = LocaliseHelper::getPackages();
         $package = $packages[$origin];
         if (!empty($package->author)) {
             $form->setValue('author', $package->author);
             $form->setFieldAttribute('author', 'readonly', 'true');
         }
         if (!empty($package->copyright)) {
             $form->setValue('maincopyright', $package->copyright);
             $form->setFieldAttribute('maincopyright', 'readonly', 'true');
         }
         if (!empty($package->license)) {
             $form->setValue('license', $package->license);
             $form->setFieldAttribute('license', 'readonly', 'true');
         }
     }
     if ($form->getValue('description') == '' && array_key_exists($tag, $languages[$client])) {
         $form->setValue('description', $filename . ' ' . $languages[$client][$tag]['name']);
     }
     return $form;
 }
Ejemplo n.º 29
0
 /**
  * Method to load the languages in the system
  * This is based on the languages currently configured in the Joom!Fish and all frontend languages installed in the system<br />
  * Loaded languages will be stored in the private variable _languages
  *
  * @return void
  */
 function _loadLanguages()
 {
     //sbou TODO change this method to load joomla site language
     global $option;
     $db = JFactory::getDBO();
     $filter_order = $this->getUserStateFromRequest($option . 'filter_order', 'filter_order', 'l.ordering', 'cmd');
     $filter_order_Dir = $this->getUserStateFromRequest($option . 'filter_order_Dir', 'filter_order_Dir', '', 'word');
     // 1. read all known languages from the database
     $sql = "SELECT l.*" . "\nFROM #__languages AS l";
     if ($filter_order != '') {
         $sql .= ' ORDER BY ' . $filter_order . ' ' . $filter_order_Dir;
     }
     $db->setQuery($sql);
     $languages = $db->loadObjectList();
     if ($db->getErrorNum()) {
         JError::raiseWarning(400, $db->getErrorMsg());
     }
     // Read the languages dir to find new installed languages
     // This method returns a list of JLanguage objects with the related inforamtion
     $systemLanguages = JLanguage::getKnownLanguages(JPATH_SITE);
     // Generate a compability list of known languages
     $backwardLanguages = array();
     foreach ($systemLanguages as $jLanguage) {
         $backwardLanguages[$jLanguage['backwardlang']] = $jLanguage;
     }
     // We convert any language of the table into a JFLanguage object. As within the language list the key will be the language code
     // All Joomla! system languages not known will be added to the result list
     $this->_languages = array();
     foreach ($languages as $language) {
         $jfLanguage = $this->getTable('JFLanguage');
         $jfLanguage->bind($language);
         // solving [12658] language codes might be determint and maped also using the compability field!
         foreach (array_keys($backwardLanguages) as $backwardlang) {
             if ($backwardlang == substr($jfLanguage->code, 0, strlen($backwardlang))) {
                 $jLanguage = $backwardLanguages[$backwardlang];
                 $jfLanguage->set('code', $jLanguage['tag']);
                 $jfLanguage->set('iso', $jLanguage['locale']);
             }
         }
         $this->_languages[$jfLanguage->code] = $jfLanguage;
     }
     foreach ($systemLanguages as $jLanguage) {
         if ($jLanguage != null && !array_key_exists($jLanguage['tag'], $this->_languages)) {
             $jfLanguage = $this->getTable('JFLanguage');
             $jfLanguage->bindFromJLanguage($jLanguage);
             $this->_languages[$jfLanguage->code] = $jfLanguage;
         }
     }
 }
Ejemplo n.º 30
0
	message: {
		title: "<?php 
echo JText::_("Message");
?>
",
		type: 'html'
		}
}

jQuery(document).ready( function () {
	displayTranslations();
});

<?php 
$langs = array();
$jl = JLanguage::getKnownLanguages();
foreach ($jl as $key => $language) {
    $langs[] = str_replace("-", "", $language['tag']) . ": '" . $language['name'] . "'";
}
?>

var tr_langs = { <?php 
echo implode(", ", $langs);
?>
 };

function doTranslate()
{
	var url = '<?php 
echo JRoute::_('index.php?option=com_fss&view=translate&tmpl=component', false);
?>