public function init() { parent::init(); \OWeb\manage\Extensions::getInstance()->getExtension('bbcode\\JBBCode'); $this->applyTemplateController('Controller\\programs\\Template'); $this->categories = \Model\programs\Categories::getInstance(); $this->programs = Programs::getInstance(); }
/** * The Setting array for you, in the default file or the file you asked it to check * * @param String $asker The namen or Object of the one who asks for the settings * * @return \OWeb\types\Language() */ public function getLanguage($asker, $explodedName = null) { if (is_string($asker)) { $name = $asker; } else { if (is_object($asker)) { $name = get_class($asker); } } if (!isset($this->class_languages[$name])) { $settings = \OWeb\manage\Settings::getInstance()->getSetting($this); self::$default_language = $settings['default_language']; //ToDO : Remove \OWeb\types\Language::$default_language = self::$default_language; $ext = \OWeb\manage\Extensions::getInstance()->tryGetExtension('user\\connection\\TypeConnection'); if ($explodedName == null) { if ($asker instanceof \OWeb\types\NamedClass) { $cname = \OWeb\types\NamedClass::get_exploded_nameOf($name); $path = '/' . $cname[0]; $path .= str_replace(".php", "", \OWeb\types\NamedClass::get_relative_pathOf($name)); } else { $explodedName = explode('\\', $name); for ($i = 0; $i < sizeof($explodedName); $i++) { $path .= '/' . $explodedName[$i]; } } } else { for ($i = 0; $i < sizeof($explodedName); $i++) { $path .= '/' . $explodedName[$i]; } } $langObj = new \OWeb\types\Language(); $this->class_languages[$name] = $langObj; $langObj->addDefLanguageText($this->loadFile(OWEB_DEFAULT_LANG_DIR . $path . '/' . self::$default_language . '.php', self::$default_language)); $langObj->addDefLanguageText($this->loadFile(OWEB_DEFAULT_LANG_DIR . '/' . self::$default_language . '.php', self::$default_language)); if ($ext != null && $ext->getlang() != self::$default_language) { $this->c_lang = $ext->getlang(); \OWeb\types\Language::$user_language = $this->c_lang; $langObj->addUserLanguageText($this->loadFile(OWEB_DEFAULT_LANG_DIR . $path . '/' . $this->c_lang . '.php', $this->c_lang)); $langObj->addUserLanguageText($this->loadFile(OWEB_DEFAULT_LANG_DIR . '/' . $this->c_lang . '.php', $this->c_lang)); } else { $this->c_lang = self::$default_language; \OWeb\types\Language::$user_language = $this->c_lang; } } return $this->class_languages[$name]; }
public function initMode() { $ext_man = \OWeb\manage\Extensions::getInstance(); //On va voir quel extension on doit charger $get = \OWeb\OWeb::getInstance()->get_get(); if (isset($get['ext'])) { $ext = $get['ext']; } else { } try { $ext = str_replace("\\\\", "\\", $ext); $ext = str_replace(".", "\\", $ext); $this->extension = $ext_man->getExtension($ext); $this->extension->loadParams(); } catch (\Exception $ex) { } }
protected function addDependance($extension_name) { try { if (is_object($extension_name)) { $ext = $extension_name; $extension_name = get_class($extension_name); } else { $ext = Extensions::getInstance()->getExtension($extension_name); } if (!$ext) { throw new \OWeb\Exception(""); } else { $this->dependence->push($ext); } } catch (\OWeb\Exception $exception) { throw new \OWeb\Exception("The extension: " . $extension_name . " Couldn't be loaded. L'The controller " . get_class($this) . " needs it to work", 0, $exception); } }
public function OWeb_Init() { if (!empty($this->dependence)) { foreach ($this->dependence as $dep) { try { $ext = Extensions::getInstance()->getExtension($dep->name); if (!$ext) { throw new \OWeb\Exception(""); } else { $name2 = \str_replace('\\', '_', $dep->name); $name = "ext_" . $name2; $this->{$name} = $ext; } } catch (\OWeb\Exception $exception) { throw new \OWeb\Exception("Impossible de charger l'extension : " . $dep->name . ". L'extention " . get_class($this) . " en a basoin pour fonctionner", 0, $exception); } } } $this->init(); }
function __construct($id) { $this->ext_connection = \OWeb\manage\Extensions::getInstance()->getExtension('db\\Connection'); $connection = $this->ext_connection->get_Connection(); $prefix = $this->ext_connection->get_prefix(); $sql = $connection->prepare("SELECT * \n\t\t\t\t\t\tFROM " . $prefix . "downloads\n\t\t\t\t\t\tWHERE id_download = :id"); if ($sql->execute(array(':id' => $id))) { if ($result = $sql->fetchObject()) { $this->id = $id; $this->name = $result->name; $this->url = $result->url; $this->isLocal = $result->isLocal; $this->nbDownload = $result->nbDownload; } else { throw new \Model\downloads\exception\DownloadCantBeFind("Download with id : {$id} doesen't exist SQL ERROR2"); } } else { throw new \Model\downloads\exception\DownloadCantBeFind("Couldn't get Download with id : {$id} . SQL ERROR2"); } }
public function __construct(&$get, &$post, &$files, &$cookies, &$server, $adr) { $this->get_runTime(); //Checking if There is an older instance. If yes Exception. if (self::$instance != null) { throw new Exception("Only 1 instance of OWeb can run."); } else { self::$instance = $this; } error_reporting(E_ALL ^ E_NOTICE ^ E_STRICT); //Variables d'environement $this->_get = $get; $this->_post = $post; $this->_files = $files; $this->_cookies = $cookies; $this->_server = $server; $this->_adresse = $adr; //Initializing AutoLoader. $this->autoLoader = new autoLoader(); //Initialize Events manager $this->manage_events = \OWeb\manage\Events::getInstance(); //Initialize headers manager $this->manage_headers = \OWeb\manage\Headers::getInstance(); //Initialize Extension manager $this->manage_extensions = \OWeb\manage\Extensions::getInstance(); //Initialize Controller manager $this->manage_controllers = \OWeb\manage\Controller::getInstance(); //Initialize SubView manager $this->manage_subViews = \OWeb\manage\SubViews::getInstance(); //Initialize Setting Manager $this->manage_settings = \OWeb\manage\Settings::getInstance(); }
function __construct() { $this->ext_connection = \OWeb\manage\Extensions::getInstance()->getExtension('db\\Connection'); }
function __construct(Categories $cat) { $this->ext_connection = \OWeb\manage\Extensions::getInstance()->getExtension('db\\Connection'); $this->categories = $cat; }
/** * * @param Categories $cat * @param Artciles $art */ function __construct(Categories $cat, Artciles $art) { $this->ext_connection = Extensions::getInstance()->getExtension('db\\Connection'); $this->categories = $cat; $this->articles = $art; }