Location: PHPKode > projects > Anahita Social Engine > dependencies/plg_system_socialengine/socialengine/util/storage/storage.php
<?php
/**
 * @version		1.0.0
 * @category	Anahita Social Engine™
 * @copyright	Copyright (C) 2008 - 2010 rmdStudio Inc. and Peerglobe Technology Inc. All rights reserved.
 * @license		GNU GPLv2 <http://www.gnu.org/licenses/old-licenses/gpl-2.0.html>
 * @link     	http://www.anahitapolis.com
 */

class AnUtilStorage extends KObject
{
	/**
	 * storage adapter
	 * 
	 * @var AnUtilStorageAdapterAbstract
	 */
	static protected $_storage = null;
	
	static public function factory($options=array())
	{
				
		if ( !self::$_storage )
		{ 
			//@TODO should be moved out of here
			$params		= JComponentHelper::getParams('com_socialengine');
			
			$classname  = 'AnUtilStorageAdapter'.ucfirst($params->get('storage', 'Local'));
			
			if (!class_exists($classname)) 
			{
				throw new Exception("filesystem $classname doesnt exists");
				return;
			}
			
			$options 			= $params->toArray();
			self::$_storage 	= new $classname($options);
		}

		return self::$_storage;
	}
	
	/**
	 * @param $storage Object
	 * @return
	 */
	static function setStorage(AnUtilStorageAdapterAbstract $storage)
	{
		self::$_storage =  $storage;
	}
	
//end class	
}

Return current item: Anahita Social Engine