english/administrator/components/com_installer/models/extension.php
/**
	 * Translate a list of objects
	 *
	 * @param	array The array of objects
	 * @return	array The array of translated objects
	 */
Translate a list of objects
@param       array The array of objects
@return      array The array of translated objects
Translate a list of objects @param array The array of objects @return array The array of translated objects
private function translate(&$items)
	{
		$lang = JFactory::getLanguage();
		foreach($items as &$item) {
			if (strlen($item->manifest_cache)) {
				$data = json_decode($item->manifest_cache);
				if ($data) {
					foreach($data as $key => $value) {
						if ($key == 'type') {
							continue;
						}
						$item->$key = $value;
					}
				}
			}
			$item->author_info = @$item->authorEmail .'<br />'. @$item->authorUrl;
			$item->client = $item->client_id ? JText::_('JADMINISTRATOR') : JText::_('JSITE');
			$path = $item->client_id ? JPATH_ADMINISTRATOR : JPATH_SITE;
			switch ($item->type) {
				case 'component':
					$extension = $item->element;
					$source = JPATH_ADMINISTRATOR . '/components/' . $extension;
						$lang->load("$extension.sys", JPATH_ADMINISTRATOR, null, false, false)
					||	$lang->load("$extension.sys", $source, null, false, false)
					||	$lang->load("$extension.sys", JPATH_ADMINISTRATOR, $lang->getDefault(), false, false)
					||	$lang->load("$extension.sys", $source, $lang->getDefault(), false, false);
				break;
				case 'file':
					$extension = 'files_' . $item->element;
						$lang->load("$extension.sys", JPATH_SITE, null, false, false)
					||	$lang->load("$extension.sys", JPATH_SITE, $lang->getDefault(), false, false);
				break;
				case 'library':
					$extension = 'lib_' . $item->element;
						$lang->load("$extension.sys", JPATH_SITE, null, false, false)
					||	$lang->load("$extension.sys", JPATH_SITE, $lang->getDefault(), false, false);
				break;
				case 'module':
					$extension = $item->element;
					$source = $path . '/modules/' . $extension;
						$lang->load("$extension.sys", $path, null, false, false)
					||	$lang->load("$extension.sys", $source, null, false, false)
					||	$lang->load("$extension.sys", $path, $lang->getDefault(), false, false)
					||	$lang->load("$extension.sys", $source, $lang->getDefault(), false, false);
				break;
				case 'package':
					$extension = $item->element;
						$lang->load("$extension.sys", JPATH_SITE, null, false, false)
					||	$lang->load("$extension.sys", JPATH_SITE, $lang->getDefault(), false, false);
				break;
				case 'plugin':
					$extension = 'plg_' . $item->folder . '_' . $item->element;
					$source = JPATH_PLUGINS . '/' . $item->folder . '/' . $item->element;
						$lang->load("$extension.sys", JPATH_ADMINISTRATOR, null, false, false)
					||	$lang->load("$extension.sys", $source, null, false, false)
					||	$lang->load("$extension.sys", JPATH_ADMINISTRATOR, $lang->getDefault(), false, false)
					||	$lang->load("$extension.sys", $source, $lang->getDefault(), false, false);
				break;
				case 'template':
					$extension = 'tpl_' . $item->element;
					$source = $path . '/templates/' . $item->element;
						$lang->load("$extension.sys", $path, null, false, false)
					||	$lang->load("$extension.sys", $source, null, false, false)
					||	$lang->load("$extension.sys", $path, $lang->getDefault(), false, false)
					||	$lang->load("$extension.sys", $source, $lang->getDefault(), false, false);
				break;
			}
			$item->name = JText::_($item->name);
			$item->description = JText::_(@$item->description);
		}
	}
private function translate ( & $ items ) { $ lang = JFactory :: getLanguage ( ) ; foreach ( $ items as & $ item ) { if ( strlen ( $ item -> manifest_cache ) ) { $ data = json_decode ( $ item -> manifest_cache ) ; if ( $ data ) { foreach ( $ data as $ key => $ value ) { if ( $ key == 'type' ) { continue ; } $ item -> $ key = $ value ; } } } $ item -> author_info = @ $ item -> authorEmail . '<br />' . @ $ item -> authorUrl ; $ item -> client = $ item -> client_id ? JText :: _ ( 'JADMINISTRATOR' ) : JText :: _ ( 'JSITE' ) ; $ path = $ item -> client_id ? JPATH_ADMINISTRATOR : JPATH_SITE ; switch ( $ item -> type ) { case 'component' : $ extension = $ item -> element ; $ source = JPATH_ADMINISTRATOR . '/components/' . $ extension ; $ lang -> load ( " $ extension .sys " , JPATH_ADMINISTRATOR , null , false , false ) || $ lang -> load ( " $ extension .sys " , $ source , null , false , false ) || $ lang -> load ( " $ extension .sys " , JPATH_ADMINISTRATOR , $ lang -> getDefault ( ) , false , false ) || $ lang -> load ( " $ extension .sys " , $ source , $ lang -> getDefault ( ) , false , false ) ; break ; case 'file' : $ extension = 'files_' . $ item -> element ; $ lang -> load ( " $ extension .sys " , JPATH_SITE , null , false , false ) || $ lang -> load ( " $ extension .sys " , JPATH_SITE , $ lang -> getDefault ( ) , false , false ) ; break ; case 'library' : $ extension = 'lib_' . $ item -> element ; $ lang -> load ( " $ extension .sys " , JPATH_SITE , null , false , false ) || $ lang -> load ( " $ extension .sys " , JPATH_SITE , $ lang -> getDefault ( ) , false , false ) ; break ; case 'module' : $ extension = $ item -> element ; $ source = $ path . '/modules/' . $ extension ; $ lang -> load ( " $ extension .sys " , $ path , null , false , false ) || $ lang -> load ( " $ extension .sys " , $ source , null , false , false ) || $ lang -> load ( " $ extension .sys " , $ path , $ lang -> getDefault ( ) , false , false ) || $ lang -> load ( " $ extension .sys " , $ source , $ lang -> getDefault ( ) , false , false ) ; break ; case 'package' : $ extension = $ item -> element ; $ lang -> load ( " $ extension .sys " , JPATH_SITE , null , false , false ) || $ lang -> load ( " $ extension .sys " , JPATH_SITE , $ lang -> getDefault ( ) , false , false ) ; break ; case 'plugin' : $ extension = 'plg_' . $ item -> folder . '_' . $ item -> element ; $ source = JPATH_PLUGINS . '/' . $ item -> folder . '/' . $ item -> element ; $ lang -> load ( " $ extension .sys " , JPATH_ADMINISTRATOR , null , false , false ) || $ lang -> load ( " $ extension .sys " , $ source , null , false , false ) || $ lang -> load ( " $ extension .sys " , JPATH_ADMINISTRATOR , $ lang -> getDefault ( ) , false , false ) || $ lang -> load ( " $ extension .sys " , $ source , $ lang -> getDefault ( ) , false , false ) ; break ; case 'template' : $ extension = 'tpl_' . $ item -> element ; $ source = $ path . '/templates/' . $ item -> element ; $ lang -> load ( " $ extension .sys " , $ path , null , false , false ) || $ lang -> load ( " $ extension .sys " , $ source , null , false , false ) || $ lang -> load ( " $ extension .sys " , $ path , $ lang -> getDefault ( ) , false , false ) || $ lang -> load ( " $ extension .sys " , $ source , $ lang -> getDefault ( ) , false , false ) ; break ; } $ item -> name = JText :: _ ( $ item -> name ) ; $ item -> description = JText :: _ ( @ $ item -> description ) ; } }
Translate a list of objects
 @param       array The array of objects
 @return      array The array of translated objects
Translate a list of objects @param array The array of objects @return array The array of translated objects
// ignore the type field