本文整理汇总了PHP中Storage::Get方法的典型用法代码示例。如果您正苦于以下问题:PHP Storage::Get方法的具体用法?PHP Storage::Get怎么用?PHP Storage::Get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Storage
的用法示例。
在下文中一共展示了Storage::Get方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Cache
/**
* Função para definir uso de cache na Query
*
* @access public
* @return \MySQLTableCached
*/
public function Cache($iTimeout = 3600)
{
Storage::Set("cachedb.timeout", $iTimeout);
Events::Set("BeforeQuery", function ($sSQL, $fCallback) {
if (Storage::Get("cachedb.enabled", false)) {
$mCache = @CacheDB::Get(sha1($sSQL));
if ($mCache !== false && !is_null($mCache)) {
if ($fCallback) {
$fCallback(json_decode($mCache, true), null);
}
return true;
} else {
return false;
}
} else {
return false;
}
});
Events::Set("AfterQuery", function ($sSQL, $aResult) {
if (Storage::Get("cachedb.enabled", false)) {
@CacheDB::Set(sha1($sSQL), json_encode($aResult), Storage::Get("cachedb.timeout", 3600));
}
});
return $this;
}
示例2: Call
/**
* Function to call the event
*
* @static
* @access public
* @param string $sName
* @param array $aParams
* @return mixed
*/
public static function Call($sName, $aParams = null)
{
$oThis = self::CreateInstanceIfNotExists();
$sName = strtolower(str_replace(array("/", "\\", "--"), "-", $sName));
//Bugfix
if (array_key_exists($sName, $oThis->aEvents)) {
switch ($oThis->aEvents[$sName]["type"]) {
case "perroute":
$sCurrentRoute = strtolower(str_replace(array("/", "\\", "--"), "-", Storage::Get("route")));
//Bugfix
$sRoute = strtolower($oThis->aEvents[$sName]["method"] . "_" . $oThis->aEvents[$sName]["route"]);
if ($sRoute == $sCurrentRoute) {
return call_user_func($oThis->aEvents[$sName]["func"], $aParams);
}
break;
case "default":
return call_user_func($oThis->aEvents[$sName]["func"], $aParams);
break;
}
} else {
return false;
}
}
示例3: LoadApp
/**
* Function to load modules
*
* @static
* @access public
* @return void
*/
public static function LoadApp()
{
//If the module exists Express should be loaded first
if (is_dir(Storage::Join("dir.app", "express"))) {
if (file_exists(Storage::Join("dir.app", "express" . SP . "settings.php"))) {
require_once Storage::Join("dir.app", "express" . SP . "settings.php");
}
if (file_exists(Storage::Join("dir.app", "express" . SP . "include.php"))) {
require_once Storage::Join("dir.app", "express" . SP . "include.php");
}
if (file_exists(Storage::Join("dir.app", "express" . SP . "routes.php"))) {
require_once Storage::Join("dir.app", "express" . SP . "routes.php");
}
if (file_exists(Storage::Join("dir.app", "express" . SP . "events.php"))) {
require_once Storage::Join("dir.app", "express" . SP . "events.php");
}
}
//Load Modules
$aModulesDirectories = glob(Storage::Get("dir.app") . "*", GLOB_ONLYDIR);
foreach ($aModulesDirectories as $sModuleDiretory) {
$bStatus = file_exists($sModuleDiretory . SP . "status.txt") ? intval(file_get_contents($sModuleDiretory . SP . "status.txt")) == 1 : false;
$bInstaled = file_exists($sModuleDiretory . SP . "settings.php");
if ($bStatus && $bInstaled && basename($sModuleDiretory) != "express") {
if (file_exists($sModuleDiretory . SP . "settings.php") && $bStatus) {
require_once $sModuleDiretory . SP . "settings.php";
}
if (file_exists($sModuleDiretory . SP . "include.php") && $bStatus) {
require_once $sModuleDiretory . SP . "include.php";
}
if (file_exists($sModuleDiretory . SP . "routes.php") && $bStatus) {
require_once $sModuleDiretory . SP . "routes.php";
}
if (file_exists($sModuleDiretory . SP . "events.php") && $bStatus) {
require_once $sModuleDiretory . SP . "events.php";
}
}
}
}
示例4: Send
/**
* Function to send output
*
* @access public
* @return void
*/
public static function Send()
{
$oThis = self::CreateInstanceIfNotExists();
if (is_object($oThis->oSmarty)) {
$oThis->CreateCacheCSS();
$oThis->CreateCacheJS();
Storage::AssignSmarty($oThis->oSmarty);
Events::Call("BeforeSendingOutput");
$oThis->oSmarty->display($oThis->sTemplateFilename);
} else {
$oThis = self::CreateInstanceIfNotExists();
$oThis->CreateCacheCSS();
$oThis->CreateCacheJS();
$oThis->IncludeTemplate();
$oThis->ReplaceVars();
$oThis->RemoveUndefinedVars();
$oThis->CheckConditions();
//$oThis->ClearList();
Events::Call("BeforeSendingOutput");
@header('HTTP/1.1 200 OK');
@header("Content-Type: text/html; charset=" . strtoupper(Storage::Get("app.charset", "UTF-8")), true);
try {
//var_dump($oThis->sBuffer); die();
eval('?> ' . $oThis->sBuffer);
die;
} catch (Exception $e) {
die($e->getMessage());
}
}
}