public function __construct($name = NULL) { if ($this->name == NULL) { $this->name = $this->id; } if ($this->name != NULL) { if (self::$modulesCache == NULL and !is_array(self::$modulesCache)) { self::$modulesCache = array(); $result = Db::getInstance()->ExecuteS('SELECT * FROM `' . pSQL(_DB_PREFIX_ . $this->table) . '`'); foreach ($result as $row) { self::$modulesCache[$row['name']] = $row; } } if (isset(self::$modulesCache[$this->name])) { $this->active = true; $this->id = self::$modulesCache[$this->name]['id_module']; foreach (self::$modulesCache[$this->name] as $key => $value) { if (key_exists($key, $this)) { $this->{$key} = $value; } } $this->_path = __PS_BASE_URI__ . 'modules/' . $this->name . '/'; } } }
public function __construct($name = null) { if ($this->name == null) { $this->name = $this->id; } if ($this->name != null) { if (self::$modulesCache === null) { self::$modulesCache = array(); $db = Db::getInstance(); $result = $db->ExecuteS('SELECT * FROM `' . bqSQL(_DB_PREFIX_ . $this->table) . '`', false); while ($row = $db->nextRow($result)) { self::$modulesCache[$row['name']] = $row; } } if (isset(self::$modulesCache[$this->name])) { $this->active = true; $this->id = self::$modulesCache[$this->name]['id_module']; foreach (self::$modulesCache[$this->name] as $key => $value) { if (property_exists($this, $key)) { $this->{$key} = $value; } } $this->_path = __PS_BASE_URI__ . 'modules/' . $this->name . '/'; } } }