mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-07 23:22:48 +08:00
Think\Parser类调整
代码规范调整
This commit is contained in:
@@ -35,7 +35,7 @@ class Cache {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function __callStatic($method, $params){
|
static public function __callStatic($method, $params){
|
||||||
return call_user_func_array(array(self::$handler, $method), $params);
|
return call_user_func_array(array(self::$handler, $method), $params);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,26 +0,0 @@
|
|||||||
<?php
|
|
||||||
// +----------------------------------------------------------------------
|
|
||||||
// | TOPThink [ WE CAN DO IT JUST THINK ]
|
|
||||||
// +----------------------------------------------------------------------
|
|
||||||
// | Copyright (c) 2011 http://topthink.com All rights reserved.
|
|
||||||
// +----------------------------------------------------------------------
|
|
||||||
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
|
|
||||||
// +----------------------------------------------------------------------
|
|
||||||
// | Author: liu21st <liu21st@gmail.com>
|
|
||||||
// +----------------------------------------------------------------------
|
|
||||||
// $Id$
|
|
||||||
|
|
||||||
namespace Think;
|
|
||||||
// 配置文件解析类 解析成php数组
|
|
||||||
class ConfigParser {
|
|
||||||
public function __construct($content,$type){
|
|
||||||
$class = '\Think\ConfigParser\Driver\\'.ucwords($type);
|
|
||||||
$parse = new $class();
|
|
||||||
return $parse->parse($content);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 解析内容
|
|
||||||
static public function parse($content,$type){
|
|
||||||
return new static($content,$type);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -26,7 +26,7 @@ class Db {
|
|||||||
* @param boolean $lite 是否lite方式
|
* @param boolean $lite 是否lite方式
|
||||||
* @return Object 返回数据库驱动类
|
* @return Object 返回数据库驱动类
|
||||||
*/
|
*/
|
||||||
public static function instance($config=[],$lite=false) {
|
static public function instance($config=[],$lite=false) {
|
||||||
$md5 = md5(serialize($config));
|
$md5 = md5(serialize($config));
|
||||||
if(!isset(self::$instance[$md5])) {
|
if(!isset(self::$instance[$md5])) {
|
||||||
// 解析连接参数 支持数组和字符串
|
// 解析连接参数 支持数组和字符串
|
||||||
@@ -36,7 +36,7 @@ class Db {
|
|||||||
if(class_exists($class)) {
|
if(class_exists($class)) {
|
||||||
self::$instance[$md5] = new $class($options);
|
self::$instance[$md5] = new $class($options);
|
||||||
}else{
|
}else{
|
||||||
Error::halt('_DB_TYPE_INVALID_:'.$options['dbms']);
|
E('_DB_TYPE_INVALID_:'.$options['dbms']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
self::$_instance = self::$instance[$md5];
|
self::$_instance = self::$instance[$md5];
|
||||||
@@ -107,7 +107,7 @@ class Db {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 调用驱动类的方法
|
// 调用驱动类的方法
|
||||||
public static function __callStatic($method, $params){
|
static public function __callStatic($method, $params){
|
||||||
return call_user_func_array(array(self::$_instance, $method), $params);
|
return call_user_func_array(array(self::$_instance, $method), $params);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -12,7 +12,7 @@
|
|||||||
namespace Think;
|
namespace Think;
|
||||||
class Filter {
|
class Filter {
|
||||||
//html标签设置
|
//html标签设置
|
||||||
public static $htmlTags = array(
|
static public $htmlTags = array(
|
||||||
'allow' => 'table|td|th|tr|i|b|u|strong|img|p|br|div|strong|em|ul|ol|li|dl|dd|dt|a',
|
'allow' => 'table|td|th|tr|i|b|u|strong|img|p|br|div|strong|em|ul|ol|li|dl|dd|dt|a',
|
||||||
'ban' => 'html|head|meta|link|base|basefont|body|bgsound|title|style|script|form|iframe|frame|frameset|applet|id|ilayer|layer|name|script|style|xml',
|
'ban' => 'html|head|meta|link|base|basefont|body|bgsound|title|style|script|form|iframe|frame|frameset|applet|id|ilayer|layer|name|script|style|xml',
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ class Image {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 调用驱动类的方法
|
// 调用驱动类的方法
|
||||||
public static function __callStatic($method, $params){
|
static public function __callStatic($method, $params){
|
||||||
if(empty(self::$im)) {
|
if(empty(self::$im)) {
|
||||||
self::init();
|
self::init();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ class Log {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 调用驱动类的方法
|
// 调用驱动类的方法
|
||||||
public static function __callStatic($method, $params){
|
static public function __callStatic($method, $params){dump($params);
|
||||||
return call_user_func_array(array(self::$handler, $method), $params);
|
return call_user_func_array(array(self::$handler, $method), $params);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -14,15 +14,19 @@ namespace Think;
|
|||||||
// 内容解析类
|
// 内容解析类
|
||||||
class Parser {
|
class Parser {
|
||||||
|
|
||||||
public function __construct($content,$type){
|
|
||||||
$class = '\Think\Parser\Driver\\'.ucwords($type);
|
|
||||||
$parse = new $class();
|
|
||||||
return $parse->parse($content);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 解析内容
|
// 解析内容
|
||||||
static public function parse($content,$type){
|
static public function parse($content,$type){
|
||||||
return new static($content,$type);
|
$class = '\Think\Parser\Driver\\'.ucwords($type);
|
||||||
|
if(class_exists($class)) {
|
||||||
|
$parse = new $class();
|
||||||
|
return $parse->parse($content);
|
||||||
|
}else{
|
||||||
|
E(L('_CLASS_NOT_EXIST_').': ' . $class);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 调用驱动类的方法
|
||||||
|
static public function __callStatic($method, $params){
|
||||||
|
return self::parse($params[0],$method);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -20,7 +20,7 @@ class Tag {
|
|||||||
* @param array $behaviors 行为集
|
* @param array $behaviors 行为集
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public static function register($tag,$behaviors) {
|
static public function register($tag,$behaviors) {
|
||||||
if(isset(self::$tags[$tag])) {
|
if(isset(self::$tags[$tag])) {
|
||||||
self::$tags[$tag] = array_merge(self::$tags[$tag],$behaviors);
|
self::$tags[$tag] = array_merge(self::$tags[$tag],$behaviors);
|
||||||
}else{
|
}else{
|
||||||
@@ -34,7 +34,7 @@ class Tag {
|
|||||||
* @param mixed $behavior 行为名称
|
* @param mixed $behavior 行为名称
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public static function add($tag,$behavior,$range='') {
|
static public function add($tag,$behavior,$range='') {
|
||||||
$range = $range?$range:ucwords(MODULE_NAME);
|
$range = $range?$range:ucwords(MODULE_NAME);
|
||||||
self::$tags[$tag][] = [$behavior,$range];
|
self::$tags[$tag][] = [$behavior,$range];
|
||||||
}
|
}
|
||||||
@@ -44,7 +44,7 @@ class Tag {
|
|||||||
* @param array $tags 标签行为
|
* @param array $tags 标签行为
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public static function import($tags) {
|
static public function import($tags) {
|
||||||
self::$tags = array_merge(self::$tags,$tags);
|
self::$tags = array_merge(self::$tags,$tags);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -54,7 +54,7 @@ class Tag {
|
|||||||
* @param mixed $params 传入参数
|
* @param mixed $params 传入参数
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public static function listen($tag, &$params=NULL) {
|
static public function listen($tag, &$params=NULL) {
|
||||||
Log::record($tag,'INFO');
|
Log::record($tag,'INFO');
|
||||||
Debug::remark($tag,'time');
|
Debug::remark($tag,'time');
|
||||||
if(isset(self::$tags[$tag])) {
|
if(isset(self::$tags[$tag])) {
|
||||||
@@ -78,7 +78,7 @@ class Tag {
|
|||||||
* @param Mixed $params 传人的参数
|
* @param Mixed $params 传人的参数
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public static function exec($name, &$params=NULL,$range='') {
|
static public function exec($name, &$params=NULL,$range='') {
|
||||||
$class = '\\'.$range.'\Behavior\\'.$name;
|
$class = '\\'.$range.'\Behavior\\'.$name;
|
||||||
if(class_exists($class)) {
|
if(class_exists($class)) {
|
||||||
$behavior = new $class();
|
$behavior = new $class();
|
||||||
|
|||||||
Reference in New Issue
Block a user