public function __construct() { parent::__construct(); // Set the module configuration file, based on the CLASS name, adding a .cfg; $this->setModuleConfigFile($this->getObjectCLASS()->appendString('.cfg')); if (!TheFactoryMethodOfSingleton::checkHasInstance(__CLASS__)) { self::setExeTime(new S(__CLASS__)); if ($this->objIdentificationString == __CLASS__) { // Instantiate some types; self::$objRegisteredModules = new A(); self::$objRegisteredClasses = new A(); // Scan for module directory, in the MOD_DIR dir; if (!isset($_SESSION[PROJECT_NAME]['RA_mod_reg'])) { $scannedModuleDirectory = new FileDirectory(MOD_DIR); $_SESSION[PROJECT_NAME]['RA_mod_reg']['scandir'] = $scannedModuleDirectory->scanDirectory($_SESSION[PROJECT_NAME]['RA_mod_reg']['f_count']); } // Do the FOR; for ($i = 0; $i < $_SESSION[PROJECT_NAME]['RA_mod_reg']['f_count']; ++$i) { // Register new module; $this->registerModule(new FileDirectory(MOD_DIR . _S . $_SESSION[PROJECT_NAME]['RA_mod_reg']['scandir'][$i])); } } } else { // Return the instantiated object; return TheFactoryMethodOfSingleton::getInstance(__CLASS__); } }
public function __construct(S $databaseIndex = NULL) { parent::__construct(); // Do the rest ... if (!TheFactoryMethodOfSingleton::checkHasInstance(__CLASS__)) { // Set execution time for SQLHandler; self::setExeTime(new S(__CLASS__)); // Make a default databaseIndex ... switch ($databaseIndex == NULL) { case TRUE: // Yes, we set the default ... $databaseIndex = new S('db_0'); break; } # Set ALL object properties to some defaults ... self::$objSQLH = new S($GLOBALS['H'][$databaseIndex->toString()]); self::$objSQLU = new S($GLOBALS['U'][$databaseIndex->toString()]); self::$objSQLP = new S($GLOBALS['P'][$databaseIndex->toString()]); self::$objSQLD = new S($GLOBALS['D'][$databaseIndex->toString()]); self::$objSQLR = new S($GLOBALS['R'][$databaseIndex->toString()]); // Use a switch, to clean the code; if (SQL_PERSISTENT_CONNECTION == 1) { // Do return ... return (mysql_pconnect(self::$objSQLH, self::$objSQLU, self::$objSQLP) or self::renderSQLScreenOfDeath()) && (mysql_select_db(self::$objSQLD) or self::renderSQLScreenOfDeath()); } else { // Do return ... return (mysql_connect(self::$objSQLH, self::$objSQLU, self::$objSQLP) or self::renderSQLScreenOfDeath()) && (mysql_select_db(self::$objSQLD) or self::renderSQLScreenOfDeath()); } } else { // Return the instantiated object; return TheFactoryMethodOfSingleton::getInstance(__CLASS__); } }
public function __construct() { parent::__construct(); if (!TheFactoryMethodOfSingleton::checkHasInstance(__CLASS__)) { self::setExeTime(new S(__CLASS__)); // Make required containers; self::$objFormErrorField = new A(); self::$objUpdateTableFields = new A(); self::$objOtherSQLData = new A(); // Make the data container; self::$objDataContainer = new A(); self::$objFormDataContainer = new A(); self::$objDataToForm = new I(0); self::$objDataCountInput = new I(0); self::$objPostPassedToSession = new I(0); self::$objFormInFieldSet = new I(0); self::$objFormStarted = new I(0); self::$objFormPassedExecution = new I(1); self::$objOptGroupOpen = new I(0); self::$objUpdateTableName = new S(_NONE); self::$objUpdateUpdateField = new S(_NONE); self::$objUpdateUpdateId = new S(_NONE); self::$objUpdateWhere = new S(_NONE); self::$objUpdateSELECTData = new A(); self::$objRegisteredFunctionArray = new A(); // Set POST to SESSION['POST']; if (!empty($_POST)) { // Convert _POST to an A, get ALL HTML processed; $_SESSION['POST'] = new A(); foreach ($_POST as $k => $v) { // Do the samba ... $v = new S($v); $_SESSION['POST'][$k] = $v->entityEncode(ENT_QUOTES)->doToken("\r\n", new S()); $_SESSION['POST'][$k] = $_SESSION['POST'][$k]->trimLeft(); $_SESSION['POST'][$k] = $_SESSION['POST'][$k]->trimRight(); } // Yes, we did; self::$objPostPassedToSession = new I(1); } else { if (self::checkPOST()->toBoolean() == TRUE && count($_SESSION['POST']) > 0) { self::$objPostPassedToSession = new I(1); } else { self::$objPostPassedToSession = new I(0); } } } else { // Return the instantiated object; return TheFactoryMethodOfSingleton::getInstance(__CLASS__); } }
/** * Sets anything that's needed to make the RA PHP Framework work as expected. Usually we don't document __constructors as the name * of the method says it all, but in this case we need to document that the 'ERR' __constructor is called to initialize the RA * PHP Framework as it's the first non-abstract inherited CLASS. For this purpose only, it will set the default configuration * options, the Ouput Buffering mechanis, the Error Handling mechanism and other properties; * * @return B Returns true if the object has been constructed properly * @author Catalin Z. Alexandru <*****@*****.**> * @copyright Under the terms of the GNU General Public License v3 * @version $Id: 08_ERR.php 313 2009-10-09 13:27:52Z catalin.zamfir $ * @since Version 1.0 * @access public */ public function __construct() { if (!TheFactoryMethodOfSingleton::checkHasInstance(__CLASS__)) { self::$objErrorHappened = new I(0); self::$objHT = new A(); self::$objExecutionTime = new A(); self::$objTokensReplace = new A(); self::$objStringReplace = new A(); self::$objOutputBuffer = new A(); self::$objOutputBufferCount = new I(0); if (self::setRAPHPFrameworkINIObjectProps()->toBoolean()) { self::setExeTime(new S(__CLASS__)); self::setOutputStreamCallbackWorker(new S(__CLASS__ . _DC . 'executionStreamedOutput')); self::setOutputErrorCatcherCallback(new S(__CLASS__ . _DC . 'executionCatchPHPErrors')); self::executeOutputStream(); self::setCacheHeaderKeys(); self::setHTAutoPHP(); // If the LOAD is ok, go on! if (self::getRAPHPFrameworkAverageLoading()->toInt() > SYSTEM_LOAD_MAX) { // SYSTEM_LOAD_TO_HIGH, show an error screen; self::renderScreenOfDeath(new S(__CLASS__), new S(SYSTEM_LOAD_TOO_HIGH), new S(SYSTEM_LOAD_TOO_HIGH_FIX)); } else { // If an attempt to re-open the session is made, output an error; if (!self::checkSessionVar(new S('in_session'), new O(TRUE))->toBoolean()) { if (self::openSession()) { // Set _SESSION variables; if (self::setSessionVar(new S('in_session'), new O(TRUE)) && self::setSessionVar(new S('skin'), new O(SKIN)) && self::setSessionVar(new S('language'), new O(LANGUAGE)) && self::setSessionVar(new S('default_timezone'), new O(DATE_TIMEZONE))) { // Do return; return new B(TRUE); } else { // Error me proudly; self::renderScreenOfDeath(new S(__CLASS__), new S(CANNOT_START_SESSION), new S(CANNOT_START_SESSION_FIX)); } } } else { // Error me proudly; self::renderScreenOfDeath(new S(__CLASS__), new S(CANNOT_START_SESSION), new S(CANNOT_START_SESSION_FIX)); } } } } else { // Return the object instance, from the array; return TheFactoryMethodOfSingleton::getInstance(__CLASS__); } }
public function __construct() { parent::__construct(); // Register this object with the chain; ChainOfCommand::registerExecutor($this); // Do the Factory-Singleton method; if (!TheFactoryMethodOfSingleton::checkHasInstance(__CLASS__)) { // Set specific TPL object properties; self::setExeTime(new S(__CLASS__)); self::$objPageTitle = new A(); self::$objPageCSS = new A(); self::$objPageJSS = new A(); self::$objMetaTAG = new A(); self::$objMetaEQV = new A(); self::$objMetaLNK = new A(); self::$objUserAgentCapability = new A(); self::$objPageTitleBackward = new I(0); self::$objContainerHTML = new I(1); self::$objTPLLoaded = new B(TRUE); self::$objRequestIsPHP = new I(1); self::$objTpEXECounter = new I(0); // If this is a CSS File, then setupCSSEnvironmentIfCSSFile for it; self::setupCSSEnvironmentIfCSSFile(); self::setupJSSEnvironmentIfJSSFile(); self::activateDeactiveAjax(); // Output Gzipped content, if that's the case for it; self::setGzippedOutputRequest(new S('set_header_information')); // Set document type, UserAgent stats and more ... if (self::$objRequestIsPHP->toInt() == 1) { // Set the document type to a default; self::setDocumentType(new S('xhtml_strict')); // Set an array of 'f_path' (file path); self::$objFilePathArray = new A(); self::getUserAgentStats(); } } else { // Return the instantiated object; return TheFactoryMethodOfSingleton::getInstance(__CLASS__); } }