/** * Will return an array of products that meet the SQL condition; * * This method will return the array of products that meet the passed SQL condition. This way we are certain that we will * return a limited amount of products that we can use. * * @param S $objSQLCondition The passed SQL condition; * @return array The result array; */ public function getProducts(S $objSQLCondition = NULL) { // Do return ... return $this->_Q(_QS('doSELECT')->doToken('%what', new S('t1.*'))->doToken('%table', self::$objProductsTable)->doToken('%condition', $objSQLCondition->prependString(_SP)->prependString('AS t1'))); }
/** * Will return a FilePath (a string) containing the stored cache file. This method is the core of our caching mechanism, * providing a way to avoid conflicts in cached file names, a way to make the caching mechanism URL variable or not and a way * to cache files only for a specific time; * * @param S $tpFileName Path to the executed .tp file * @param I $templateCacheTime How much time the cache file needs to be stored/compared tp * @return M Will return either a boolean or a string * @author Catalin Z. Alexandru <*****@*****.**> * @copyright Under the terms of the GNU General Public License v3 * @version $Id: 10_TPL.php 315 2009-10-11 07:11:31Z catalin.zamfir $ * @since Version 1.0 * @access private * @static */ private static function getCacheFileName(FilePath $tpFileName, I $templateCacheTime, B $tpInvariable = NULL) { // Make the CACHE sub-directory && set some requirements; $objTPLNoChange = $tpInvariable == NULL ? new B(FALSE) : new B(TRUE); // Make CACHE directory, based on variable ... if ($objTPLNoChange->toBoolean() == FALSE) { // Make the cache dir, based on _GET array (page); $objTPLCacheDir = new S('dir_cache_' . ($objSHA1 = sha1(implode(_U, $_GET->toArray())))); } else { // Invariate the cache directory ... $objTPLCacheDir = new S('dir_cache_' . ($objSHA1 = sha1($tpFileName . $templateCacheTime))); } // Get the a/b/c/d directory structure for ($i = 0; $i < strlen($objSHA1); ++$i) { // Append the DIR ... $objTPLCacheDir->prependString('cache_' . $objSHA1[$i] . _S); } // Make directories, recursive ... if (!is_dir(DOCUMENT_ROOT . CACHE_DIR . _S . $objTPLCacheDir)) { // Mkdir, recursive ... mkdir(DOCUMENT_ROOT . CACHE_DIR . _S . $objTPLCacheDir, 0777, TRUE); } // Make the cache_fname string; if ($objTPLNoChange->toBoolean() == FALSE) { // Do return variable to _GET array; return new FilePath(CACHE_DIR . _S . $objTPLCacheDir . _S . 'cache_' . sha1($tpFileName . md5($templateCacheTime . implode(_U, $_GET->toArray()) . self::$objTpEXECounter->doInc())) . _U . md5($tpFileName . $templateCacheTime . implode(_U, $_GET->toArray())), FALSE); } else { // Do return unvariable to _GET array (to page I mean); return new FilePath(CACHE_DIR . _S . $objTPLCacheDir . _S . 'cache_' . sha1($tpFileName . md5($templateCacheTime)) . _U . md5($tpFileName . $templateCacheTime), FALSE); } }
/** * Will check if a module was registered with the framework. Given a string (to the path) of the module, it will check to see * if that module was defined or not; * * @param FilePath $modNameToCheck The path of the module to check for * @return B Will return true if the module was registered with us * @author Catalin Z. Alexandru <*****@*****.**> * @copyright Under the terms of the GNU General Public License v3 * @version $Id: 15_MOD.php 314 2009-10-09 14:24:35Z catalin.zamfir $ * @since Version 1.0 * @access public * @static * @final */ public static final function checkModuleIsRegistered(S $modNameToCheck) { if (isset(self::$objRegisteredModules[$modNameToCheck->prependString(DOCUMENT_ROOT)])) { // Do return ... return new B(TRUE); } else { // Do return ... return new B(FALSE); } }
/** * Will send the email, at the specified address, using the specified subject and content; * * This method will send out the given email and subject, to the given address, while decoding the content from entities; You, * as the user, SHOULD ALWAYS remember, that the content gets decoded in this method, thus allowing you to work with your * content where you've called it, without modifying it; * * @param S $objMAILTo The email to send it to; * @param S $objMAILSubject The subject to set; * @param S $objMAILContent And the content; * @todo CLEAN THIS URGENTLY! ... */ public function doMAIL(S $objMAILTo, S $objMAILSubject, S $objMAILContent) { // First of ALL, get a CLONE ... $objMAILClone = clone $objMAILContent; $objMAILClone = $objMAILClone->entityDecode(ENT_QUOTES)->stripTags(); // #0: proper MULTIPART; $objMAILContent->prependString(new S(_N_))->prependString(_S(self::MAIL_HEADER_CONTENT_ENCODING_SEVENBIT . _N_))->prependString(_S(self::MAIL_HEADER_CONTENT_TYPE_HTML . _N_))->prependString(_S(self::MAIL_HEADER_PHP_ALTERNATIVE . _N_)->doToken('%s', self::$objHASHId))->prependString(_S(_N_))->prependString(_S($objMAILClone . _N_))->prependString(_S(_N_))->prependString(_S(self::MAIL_HEADER_CONTENT_ENCODING_SEVENBIT . _N_))->prependString(_S(self::MAIL_HEADER_CONTENT_TYPE_PLAIN . _N_))->prependString(_S(self::MAIL_HEADER_PHP_ALTERNATIVE . _N_)->doToken('%s', self::$objHASHId))->prependString(_S(_N_))->prependString(_S(self::MAIL_HEADER_MULTIPART_ALTERNATIVE . _N_)->doToken('%s', self::$objHASHId))->prependString(_S(self::MAIL_HEADER_PHP_MIXED . _N_)->doToken('%s', self::$objHASHId)); // #4: ... end PLAIN and HTML ... $objMAILContent->appendString(_S(_N_))->appendString(_S(self::MAIL_HEADER_PHP_ALTERNATIVE_END . _N_)->doToken('%s', self::$objHASHId)); // #5: ... attachments; foreach (self::$objEMLAttachment as $k => $v) { // #5.1 $objMAILContent->appendString(_S(self::MAIL_HEADER_PHP_MIXED . _N_)->doToken('%s', self::$objHASHId))->appendString(_S(self::MAIL_HEADER_ATTACHMENT_TYPE_NAME . _N_)->doToken('%t', $v['attachment_type'])->doToken('%n', $v['attachment_name']))->appendString(_S(self::MAIL_HEADER_ENCODING_BASE64 . _N_))->appendString(_S(self::MAIL_HEADER_DISPOSITION_ATTACHMENT . _N_))->appendString(_S(_N_))->appendString($v['attachment_base64'])->appendString(_S(self::MAIL_HEADER_PHP_MIXED . _N_)->doToken('%s', self::$objHASHId)); } // Finish ... $objMAILContent->appendString(_S(_N_))->appendString(_S(self::MAIL_HEADER_PHP_MIXED_END)->doToken('%s', self::$objHASHId)); // Go ... everyhing IS ok and life's grand ... MAIL($objMAILTo, $objMAILSubject, $objMAILContent->entityDecode(ENT_QUOTES), self::$objFromHeader . self::$objReceiptTo . self::$objReplyTo . self::$objMIMEHeader . self::$objTypeHTML); }