注释规范

This commit is contained in:
huangdijia
2015-12-07 18:07:38 +08:00
parent e98345d1e4
commit 0e2186cb6b
4 changed files with 44 additions and 26 deletions

View File

@@ -35,10 +35,10 @@ class ContentReplace
{
if(IS_CGI) {
//CGI/FASTCGI模式下
$_temp = explode('.php',$_SERVER['PHP_SELF']);
$script_name = rtrim(str_replace($_SERVER['HTTP_HOST'],'',$_temp[0].'.php'),'/');
$_temp = explode('.php',$_SERVER['PHP_SELF']);
$script_name = rtrim(str_replace($_SERVER['HTTP_HOST'],'',$_temp[0].'.php'),'/');
} else {
$script_name = rtrim($_SERVER['SCRIPT_NAME'],'/');
$script_name = rtrim($_SERVER['SCRIPT_NAME'],'/');
}
define('ROOT_URL', rtrim(dirname(str_replace("\\","\/",$script_name)),'/'));
define('MODULE_URL', ROOT_URL.'/'.(defined('MODULE_ALIAS')?MODULE_ALIAS:MODULE_NAME));
@@ -47,13 +47,19 @@ class ContentReplace
// 系统默认的特殊变量替换
$replace = [
'__ROOT__' => ROOT_URL, // 当前网站地址
'__APP__' => MODULE_URL, // 当前项目地址
'__CONTROLL__' => CONTROLLER_URL, // 当前操作地址
'__URL__' => CONTROLLER_URL,
'__ACTION__' => ACTION_URL, // 当前操作地址
'__SELF__' => $_SERVER['PHP_SELF'], // 当前页面地址
'__PUBLIC__' => ROOT_URL.'/Public',// 站点公共目录
// 当前网站地址
'__ROOT__' => ROOT_URL,
// 当前项目地址
'__APP__' => MODULE_URL,
// 当前操作地址
'__CONTROLL__' => CONTROLLER_URL,
'__URL__' => CONTROLLER_URL,
// 当前操作地址
'__ACTION__' => ACTION_URL,
// 当前页面地址
'__SELF__' => $_SERVER['PHP_SELF'],
// 站点公共目录
'__PUBLIC__' => ROOT_URL.'/Public',
];
// 允许用户自定义模板的字符串替换
if(is_array(Config::get('tmpl_parse_string')) ){

View File

@@ -55,18 +55,23 @@ class ReadHtmlCache
$moduleName = strtolower(MODULE_NAME);
$actionName = strtolower(ACTION_NAME);
if (isset($htmls[$moduleName . ':' . $actionName])) {
$html = $htmls[$moduleName . ':' . $actionName]; // 某个模块的操作的静态规则
// 某个模块的操作的静态规则
$html = $htmls[$moduleName . ':' . $actionName];
} elseif (isset($htmls[$moduleName . ':'])) {
// 某个模块的静态规则
// 某个模块的静态规则
$html = $htmls[$moduleName . ':'];
} elseif (isset($htmls[$actionName])) {
$html = $htmls[$actionName]; // 所有操作的静态规则
// 所有操作的静态规则
$html = $htmls[$actionName];
} elseif (isset($htmls['*'])) {
$html = $htmls['*']; // 全局静态规则
// 全局静态规则
$html = $htmls['*'];
} elseif (isset($htmls['empty:index']) && !class_exists(MODULE_NAME . 'Action')) {
$html = $htmls['empty:index']; // 空模块静态规则
// 空模块静态规则
$html = $htmls['empty:index'];
} elseif (isset($htmls[$moduleName . ':_empty']) && self::isEmptyAction(MODULE_NAME, ACTION_NAME)) {
$html = $htmls[$moduleName . ':_empty']; // 空操作静态规则
// 空操作静态规则
$html = $htmls[$moduleName . ':_empty'];
}
if (!empty($html)) {
// 解读静态规则
@@ -88,7 +93,8 @@ class ReadHtmlCache
$rule = $html[2]($rule);
}
// 应用附加函数
$cacheTime = isset($html[1]) ? $html[1] : C('HTML_CACHE_TIME'); // 缓存有效期
// 缓存有效期
$cacheTime = isset($html[1]) ? $html[1] : C('HTML_CACHE_TIME');
// 当前缓存文件
define('HTML_FILE_NAME', HTML_PATH . $rule . C('HTML_FILE_SUFFIX'));
return $cacheTime;
@@ -130,5 +136,4 @@ class ReadHtmlCache
$class = new $className;
return !method_exists($class, $action);
}
}

View File

@@ -65,16 +65,19 @@ class ShowPageTrace
$tabs = Config::get('trace_page_tabs');
foreach ($tabs as $name => $title) {
switch (strtoupper($name)) {
case 'BASE': // 基本信息
// 基本信息
case 'BASE':
$trace[$title] = $base;
break;
case 'FILE': // 文件信息
// 文件信息
case 'FILE':
$trace[$title] = $info;
break;
default: // 调试信息
// 调试信息
default:
$name = strtoupper($name);
if (strpos($name, '|')) {
// 多组信息
// 多组信息
$array = explode('|', $name);
$result = [];
foreach ($array as $name) {

View File

@@ -23,10 +23,14 @@ class TokenBuild extends Behavior
{
// 行为参数定义
protected $options = [
'TOKEN_ON' => false, // 开启令牌验证
'TOKEN_NAME' => '__hash__', // 令牌验证的表单隐藏字段名称
'TOKEN_TYPE' => 'md5', // 令牌验证哈希规则
'TOKEN_RESET' => true, // 令牌错误后是否重置
// 开启令牌验证
'TOKEN_ON' => false,
// 令牌验证的表单隐藏字段名称
'TOKEN_NAME' => '__hash__',
// 令牌验证哈希规则
'TOKEN_TYPE' => 'md5',
// 令牌错误后是否重置
'TOKEN_RESET' => true,
];
public function run(&$content)