<?php
/**
 * @package     Joomla.Administrator
 * @subpackage  com_userxtd
 *
 * @copyright   Copyright (C) 2012 Asikart. All rights reserved.
 * @license     GNU General Public License version 2 or later; see LICENSE.txt
 * @author      Generated by AKHelper - http://asikart.com
 */

// No direct access
defined('_JEXEC') or die;

/**
 * Class UXFactory
 *
 * @since 1.0
 */
class UXFactory
{
	/**
	 * Property instances.
	 *
	 * @var  array
	 */
	protected $instances = array();

	/**
	 * getUser
	 *
	 * @param integer $id
	 *
	 * @return  JUser
	 */
	public static function getUser($id = null)
	{
		$user = JFactory::getUser($id) ;
		
		if(!$user->guest)
		{
			$app = JFactory::getApplication() ;
			
			$data = new JObject;
			$data->id = $user->get('id');
			
			$app->triggerEvent('onContentPrepareData', array('com_userxtd.profile', &$data)) ;
			
			$user->setProperties((array)$data->profile);
			$user->set('profiles', (array)$data->profile);
		}
		
		return $user;
	}
}