Exemple #1
0
 /**
  * Activates a specified module
  *
  * @author Jonathan Davis
  * @since 1.3
  *
  * @param string $module The module file class/package name
  * @return Object The activated module object or false if it failed to load
  **/
 public function activate($module)
 {
     $ModuleFile = $this->module($module);
     if (false === $ModuleFile) {
         return false;
     }
     if ($ModuleFile->modified()) {
         unset($this->modules[$module], $this->active[$module]);
         $this->recache();
         $ModuleFile = new ModuleFile($ModuleFile->file);
         if (false === $ModuleFile) {
             return false;
         }
         $module = $ModuleFile->classname;
         $this->modules[$module] = $ModuleFile;
     }
     ShoppLoader::add($module, $ModuleFile->file);
     $Module = $ModuleFile->load();
     if (false === $Module) {
         return false;
     }
     $this->active[$module] = $Module;
     return $this->active[$module];
 }
Exemple #2
0
	/**
	 * Determine the storage engine to use
	 * 
	 * @since 1.1
	 *
	 * @return void Description...
	 **/
	function &_engine () {
		global $Ecart;
		if (!isset($Ecart->Storage)) $Ecart->Storage = new StorageEngines();

		if (!empty($this->storage)) {
			// Use the storage engine setting of the asset
			if (isset($Ecart->Storage->active[$this->storage])) {
				$Engine = $Ecart->Storage->active[$this->storage];
			} else if (isset($Ecart->Storage->modules[$this->storage])) {
				$Module = new ModuleFile(ECART_STORAGE,$Ecart->Storage->modules[$this->storage]->filename);
				$Engine = $Module->load();
			}
		} elseif (isset($Ecart->Storage->engines[$this->type])) {
			// Pick storage engine from Ecart-loaded engines by type of asset
			$engine = $Ecart->Storage->engines[$this->type];
			$this->storage = $engine;
			$Engine = $Ecart->Storage->active[$engine];
		}
		if (!empty($Engine)) $Engine->context($this->type);

		return $Engine;
	}