本文整理匯總了PHP中think\Storage類的典型用法代碼示例。如果您正苦於以下問題:PHP Storage類的具體用法?PHP Storage怎麽用?PHP Storage使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了Storage類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: run
public function run(&$content)
{
if (C('TMPL_STRIP_SPACE')) {
preg_match_all("/<script[\\s\\S]*?>([\\s\\S]*?)<\\/script>/i", $content, $scripta);
preg_match_all("/<style[\\s\\S]*?>([\\s\\S]*?)<\\/style>/i", $content, $stylea);
$comhtml = $this->delHtml($content);
preg_match_all("/<script[\\s\\S]*?>([\\s\\S]*?)<\\/script>/i", $comhtml, $scriptb);
preg_match_all("/<style[\\s\\S]*?>([\\s\\S]*?)<\\/style>/i", $comhtml, $styleb);
foreach ($stylea[0] as $k => $v) {
$cssmin[$k] = Cssmin::minify($v);
}
foreach ($scripta[0] as $key => $value) {
if (empty(Jsmin::minify($scripta[1][$key]))) {
$jsmin[$key] = $scriptb[0][$key];
} else {
$jsmin[$key] = Jsmin::minify($value);
}
}
$content = str_replace($scriptb[0], $jsmin, $comhtml);
$content = str_replace($styleb[0], $cssmin, $content);
if (C('HTML_CACHE_ON') && defined('HTML_FILE_NAME') && !preg_match('/Status.*[345]{1}\\d{2}/i', implode(' ', headers_list())) && !preg_match('/(-[a-z0-9]{2}){3,}/i', HTML_FILE_NAME)) {
//靜態文件寫入
Storage::put(HTML_FILE_NAME, $content, 'html');
}
}
}
示例2: run
public function run(&$params)
{
// 開啟靜態緩存
if (IS_GET && C('HTML_CACHE_ON')) {
$cacheTime = $this->requireHtmlCache();
if (false !== $cacheTime && $this->checkHTMLCache(HTML_FILE_NAME, $cacheTime)) {
$mtime = self::fileMTime(HTML_FILE_NAME);
if (!empty($_SERVER['HTTP_IF_NONE_MATCH'])) {
if ($_SERVER['HTTP_IF_NONE_MATCH'] >= $mtime) {
header('Etag:' . $_SERVER['HTTP_IF_NONE_MATCH'], true, 304);
exit;
}
self::httpCached($mtime, false);
} else {
self::httpCached($mtime);
}
header('Etag:' . $mtime, true, 200);
//靜態頁麵有效
// 讀取靜態頁麵輸出
echo Storage::read(HTML_FILE_NAME, 'html');
exit;
}
$mtime = NOW_TIME + 5;
header('Etag:' . $mtime, true, 200);
self::httpCached($mtime, false);
}
}
示例3: run
public function run(&$content)
{
if (C('HTML_CACHE_ON') && defined('HTML_FILE_NAME')) {
//靜態文件寫入
Storage::put(HTML_FILE_NAME, $content, 'html');
}
}
示例4: C
$layoutFile = THEME_PATH . C('LAYOUT_NAME') . C('TMPL_TEMPLATE_SUFFIX');
if (filemtime($layoutFile) > Storage::get($tmplCacheFile, 'mtime')) {
return false;
}
}
// 緩存有效
return true;
}
/**
示例5: _initialize
protected function _initialize()
{
if (Storage::has('./Conf/install.lock')) {
$this->error('已經成功安裝了本係統,請不要重複安裝!', U('Home/Index/index'));
} elseif ($_SERVER[ENV_PRE . 'DEV_MODE'] == true) {
$this->error('係統處於開發模式,無需安裝!', U('Home/Index/index'));
}
}
示例6: Update
public function Update()
{
$return = \Think\Storage::put(APP_PATH . 'Common/Conf/Temp.php', '<?php return ' . var_export($_POST, true) . ';', 'F');
if ($return == true) {
$this->success('<p>' . L('success') . '</p>');
} else {
$this->error('<p>更新失敗,請檢查這個目錄下的0777權限</p>');
}
}
示例7: _initialize
protected function _initialize()
{
if (session('step') === null) {
session('step', 0);
}
if (Storage::has(MODULE_PATH . 'Data/install.lock')) {
$this->error('已經成功安裝了係統,請不要重複安裝!', U('Home/Index/index'));
}
}
示例8: _initialize
protected function _initialize()
{
if (session('step') === null) {
$this->redirect('Index/index');
}
if (Storage::has(MODULE_PATH . 'Data/install.lock')) {
$this->error('已經成功安裝了Zcms,請不要重複安裝!');
}
}
示例9: Update
public function Update() {
$confpath = \Think\Storage::put(APP_PATH.'Common/Conf/Settings.php', '<?php return '.var_export($_POST,true).';', 'F');
if ($confpath==true){
$this->success('<p>修改配置成功!</p>');
} else {
$this->error('<p>修改配置失敗,請檢查這個目錄下的0777權限</p>');
}
}
示例10: Update
public function Update()
{
$Picture = \Think\Storage::put(APP_PATH.'Common/Conf/Picture.php', '<?php return '.var_export($_POST,true).';', 'F');
if ($Picture == true) {
$this->success('<p>設置成功!</p>');
} else {
$this->error('<p>設置失敗,請檢查這個目錄下的0777權限</p>');
}
}
示例11: run
{
// 行為擴展的執行入口必須是run
public function run(&$content)
{
//2014-11-28 修改 如果有HTTP 4xx 3xx 5xx 頭部,禁止存儲
//2014-12-1 修改 對注入的網址 防止生成,例如 /game/lst/SortType/hot/-e8-90-8c-e5-85-94-e7-88-b1-e6-b6-88-e9-99-a4/-e8-bf-9b-e5-87-bb-e7-9a-84-e9-83-a8-e8-90-bd/-e9-a3-8e-e4-ba-91-e5-a4-a9-e4-b8-8b/index.shtml
if (C('HTML_CACHE_ON') && defined('HTML_FILE_NAME') && !preg_match('/Status.*[345]{1}\\d{2}/i', implode(' ', headers_list())) && !preg_match('/(-[a-z0-9]{2}){3,}/i', HTML_FILE_NAME)) {
//靜態文件寫入
Storage::put(HTML_FILE_NAME, $content, 'html');
示例12: Update
public function Update()
{
$return = \Think\Storage::put(APP_PATH . 'Common/Conf/Lang.php', '<?php return ' . var_export($_POST, true) . ';', 'F');
if ($return == true) {
$this->success('<p>' . L('lang_success') . '</p>', __ROOT__ . '/Admin/Lang?l=' . C('LANG_LIST'));
} else {
$this->error('<p>' . L('lang_error') . '</p>');
}
}
示例13: index
public function index()
{
if (Storage::has(APP_PATH . 'Common/Conf/install.lock')) {
$this->error('已經成功安裝了Gms管理係統,請不要重複安裝!');
}
session_destroy();
session_start();
session('step', 0);
session('error', false);
$this->display();
}
示例14: getAll
/**
* 獲取模塊列表
* @param string $addon_dir
* @author jry <598821125@qq.com>
*/
public function getAll()
{
//獲取除了Common等係統模塊外的用戶模塊(文件夾下必須有$install_file定義的安裝描述文件)
$dirs = array_map('basename', glob(APP_PATH . '*', GLOB_ONLYDIR));
foreach ($dirs as $dir) {
$config_file = realpath(APP_PATH . $dir) . '/' . $this->install_file();
if (Storage::has($config_file)) {
$module_dir_list[] = $dir;
$temp_arr = (include $config_file);
$temp_arr['info']['status'] = -1;
//未安裝
$module_list[$temp_arr['info']['name']] = $temp_arr['info'];
}
}
//獲取係統已經安裝的模塊信息
$installed_module_list = $this->field(true)->order('sort asc,id desc')->select();
if ($installed_module_list) {
foreach ($installed_module_list as &$module) {
$module_list[$module['name']] = $module;
}
//係統已經安裝的模塊信息與文件夾下模塊信息合並
$module_list = array_merge($module_list, $module_list);
}
foreach ($module_list as &$val) {
switch ($val['status']) {
case '-2':
//損壞
$val['status'] = '<span class="text-danger">損壞</span>';
$val['right_button'] = '<a class="label label-danger ajax-get" href="' . U('setStatus', array('status' => 'delete', 'ids' => $val['id'])) . '">刪除記錄</a>';
break;
case '-1':
//未安裝
$val['status'] = '<i class="fa fa-download text-success"></i>';
$val['right_button'] = '<a class="label label-success ajax-get" href="' . U('install?name=' . $val['name']) . '">安裝</a>';
break;
case '0':
//禁用
$val['status'] = '<i class="fa fa-ban text-danger"></i>';
$val['right_button'] .= '<a class="label label-info ajax-get" href="' . U('updateInfo?id=' . $val['id']) . '">更新菜單</a> ';
$val['right_button'] .= '<a class="label label-success ajax-get" href="' . U('setStatus', array('status' => 'resume', 'ids' => $val['id'])) . '">啟用</a> ';
$val['right_button'] .= '<a class="label label-danger ajax-get" href="' . U('uninstall', array('id' => $val['id'])) . '">卸載</a> ';
break;
case '1':
//正常
$val['status'] = '<i class="fa fa-check text-success"></i>';
$val['right_button'] .= '<a class="label label-info ajax-get" href="' . U('updateInfo?id=' . $val['id']) . '">更新菜單</a> ';
$val['right_button'] .= '<a class="label label-warning ajax-get" href="' . U('setStatus', array('status' => 'forbid', 'ids' => $val['id'])) . '">禁用</a> ';
$val['right_button'] .= '<a class="label label-danger ajax-get" href="' . U('uninstall', array('id' => $val['id'])) . '">卸載</a> ';
break;
}
}
return $module_list;
}
示例15: getAllModule
/**
* 獲取模塊列表
* @param string $addon_dir
*/
public function getAllModule()
{
//獲取除了Common等係統模塊外的用戶模塊(文件夾下必須有oneshop.php)
$dirs = array_map('basename', glob(APP_PATH . '*', GLOB_ONLYDIR));
foreach ($dirs as $dir) {
$config_file = realpath(APP_PATH . $dir) . '/oneshop.php';
if (Storage::has($config_file)) {
$module_dir_list[] = $dir;
$temp_arr = (include $config_file);
$temp_arr['info']['status'] = -1;
//未安裝
$module_list[$temp_arr['info']['name']] = $temp_arr['info'];
}
}
//獲取係統已經安裝的模塊信息
if ($module_dir_list) {
$map['name'] = array('in', $module_dir_list);
}
$installed_module_list = $this->where($map)->field(true)->order('sort asc,id desc')->select();
if ($installed_module_list) {
foreach ($installed_module_list as $module) {
$module_list[$module['name']] = $module;
}
//係統已經安裝的模塊信息與文件夾下模塊信息合並
$module_list = array_merge($module_list, $module_list);
}
foreach ($module_list as &$val) {
switch ($val['status']) {
case '-1':
//未安裝
$val['status'] = '<i class="glyphicon glyphicon-download-alt" style="color:green"></i>';
$val['right_button'] = '<a class="ajax-get" href="' . U('install?name=' . $val['name']) . '">安裝</a>';
break;
case '0':
//禁用
$val['status'] = '<i class="glyphicon glyphicon-ban-circle" style="color:red"></i>';
$val['right_button'] .= '<a class="ajax-get" href="' . U('updateModuleInfo?id=' . $val['id']) . '">更新菜單</a> ';
$val['right_button'] .= '<a class="ajax-get" href="' . U('setStatus', array('status' => 'resume', 'ids' => $val['id'])) . '">啟用</a> ';
$val['right_button'] .= '<a class="ajax-get" href="' . U('setStatus', array('status' => 'uninstall', 'ids' => $val['id'])) . '">卸載</a> ';
break;
case '1':
//正常
$val['status'] = '<i class="glyphicon glyphicon-ok" style="color:green"></i>';
$val['right_button'] .= '<a class="ajax-get" href="' . U('updateModuleInfo?id=' . $val['id']) . '">更新菜單</a> ';
$val['right_button'] .= '<a class="ajax-get" href="' . U('setStatus', array('status' => 'forbid', 'ids' => $val['id'])) . '">禁用</a> ';
$val['right_button'] .= '<a class="ajax-get" href="' . U('setStatus', array('status' => 'uninstall', 'ids' => $val['id'])) . '">卸載</a> ';
break;
}
}
return $module_list;
}