From c056ba70fa15543ec9a036c90f1ee2f7d91b27b4 Mon Sep 17 00:00:00 2001 From: joyqi Date: Wed, 12 Feb 2014 17:51:47 +0800 Subject: [PATCH] =?UTF-8?q?fix=20#188=20=E5=8E=BB=E6=8E=89=E6=89=80?= =?UTF-8?q?=E6=9C=89=E4=B8=8D=E5=BF=85=E8=A6=81=E7=9A=84require=5Fonce?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- var/Typecho/Common.php | 3 - var/Typecho/Common/Paragraph.php | 3 - var/Typecho/Cookie.php | 3 - var/Typecho/Date.php | 3 - var/Typecho/Db.php | 9 -- var/Typecho/Db/Adapter/Exception.php | 3 - var/Typecho/Db/Adapter/Mysql.php | 5 -- var/Typecho/Db/Adapter/Pdo.php | 5 -- var/Typecho/Db/Adapter/Pdo/Mysql.php | 3 - var/Typecho/Db/Adapter/Pdo/Pgsql.php | 3 - var/Typecho/Db/Adapter/Pdo/SQLite.php | 3 - var/Typecho/Db/Adapter/Pgsql.php | 5 -- var/Typecho/Db/Adapter/SQLite.php | 5 -- var/Typecho/Db/Exception.php | 3 - var/Typecho/Db/Query.php | 3 - var/Typecho/Db/Query/Exception.php | 3 - var/Typecho/Http/Client.php | 4 - var/Typecho/Http/Client/Adapter.php | 5 -- var/Typecho/Http/Client/Adapter/Curl.php | 5 -- var/Typecho/Http/Client/Adapter/Socket.php | 3 - var/Typecho/Http/Client/Exception.php | 3 - var/Typecho/I18n.php | 1 - var/Typecho/I18n/GetTextMulti.php | 3 - var/Typecho/Plugin/Exception.php | 3 - var/Typecho/Request.php | 3 - var/Typecho/Response.php | 4 - var/Typecho/Router.php | 13 --- var/Typecho/Router/Exception.php | 3 - var/Typecho/Validate.php | 3 - var/Typecho/Widget.php | 10 --- var/Typecho/Widget/Exception.php | 3 - var/Typecho/Widget/Helper/Form.php | 6 -- var/Typecho/Widget/Helper/Form/Element.php | 3 - .../Widget/Helper/Form/Element/Checkbox.php | 3 - .../Widget/Helper/Form/Element/Fake.php | 83 +++++++++++++++++++ .../Widget/Helper/Form/Element/Hidden.php | 3 - .../Widget/Helper/Form/Element/Password.php | 3 - .../Widget/Helper/Form/Element/Radio.php | 3 - .../Widget/Helper/Form/Element/Select.php | 3 - .../Widget/Helper/Form/Element/Submit.php | 3 - .../Widget/Helper/Form/Element/Text.php | 3 - .../Widget/Helper/Form/Element/Textarea.php | 3 - var/Typecho/Widget/Helper/PageNavigator.php | 2 - .../Widget/Helper/PageNavigator/Box.php | 3 - .../Widget/Helper/PageNavigator/Classic.php | 3 - 45 files changed, 83 insertions(+), 169 deletions(-) create mode 100644 var/Typecho/Widget/Helper/Form/Element/Fake.php diff --git a/var/Typecho/Common.php b/var/Typecho/Common.php index 05e33aaa..91898c88 100644 --- a/var/Typecho/Common.php +++ b/var/Typecho/Common.php @@ -295,7 +295,6 @@ class Typecho_Common $code = $exception; } - require_once 'Typecho/Response.php'; $charset = self::$charset; if ($isException && $exception instanceof Typecho_Db_Exception) { @@ -330,7 +329,6 @@ class Typecho_Common /** 设置http code */ if (is_numeric($code) && $code > 200) { - require_once 'Typecho/Response.php'; Typecho_Response::setStatus($code); } @@ -876,7 +874,6 @@ EOF; { static $loaded; if (!$loaded) { - require_once 'Typecho/Common/Paragraph.php'; $loaded = true; } diff --git a/var/Typecho/Common/Paragraph.php b/var/Typecho/Common/Paragraph.php index f1094c9f..f750adbd 100644 --- a/var/Typecho/Common/Paragraph.php +++ b/var/Typecho/Common/Paragraph.php @@ -8,9 +8,6 @@ * @license GNU General Public License 2.0 * @version $Id$ */ - -/** 载入api支持 */ -require_once 'Typecho/Common.php'; /** * 用于对自动分段做处理 diff --git a/var/Typecho/Cookie.php b/var/Typecho/Cookie.php index fa9fa8fc..d6284120 100644 --- a/var/Typecho/Cookie.php +++ b/var/Typecho/Cookie.php @@ -9,9 +9,6 @@ * @version $Id$ */ -/** 载入api支持 */ -require_once 'Typecho/Common.php'; - /** * cookie支持 * diff --git a/var/Typecho/Date.php b/var/Typecho/Date.php index fd36c1f9..e14bd0e8 100644 --- a/var/Typecho/Date.php +++ b/var/Typecho/Date.php @@ -1,8 +1,5 @@ _adapterName = $adapterName; /** 数据库适配器 */ - require_once 'Typecho/Db/Adapter/' . str_replace('_', '/', $adapterName) . '.php'; $adapterName = 'Typecho_Db_Adapter_' . $adapterName; if (!call_user_func(array($adapterName, 'isAvailable'))) { @@ -233,7 +226,6 @@ class Typecho_Db { if (empty(self::$_instance)) { /** Typecho_Db_Exception */ - require_once 'Typecho/Db/Exception.php'; throw new Typecho_Db_Exception('Missing Database Object'); } @@ -310,7 +302,6 @@ class Typecho_Db if (!isset($this->_connectedPool[$op])) { if (empty($this->_pool[$op])) { /** Typecho_Db_Exception */ - require_once 'Typecho/Db/Exception.php'; throw new Typecho_Db_Exception('Missing Database Connection'); } diff --git a/var/Typecho/Db/Adapter/Exception.php b/var/Typecho/Db/Adapter/Exception.php index cb01f65d..fc628e2a 100644 --- a/var/Typecho/Db/Adapter/Exception.php +++ b/var/Typecho/Db/Adapter/Exception.php @@ -7,9 +7,6 @@ * @version $Id: DbException.php 52 2008-03-18 08:04:01Z magike.net $ */ -/** 数据库异常基类 */ -require_once 'Typecho/Db/Exception.php'; - /** * 数据库连接异常类 * diff --git a/var/Typecho/Db/Adapter/Mysql.php b/var/Typecho/Db/Adapter/Mysql.php index a842b97f..e2cff0fb 100644 --- a/var/Typecho/Db/Adapter/Mysql.php +++ b/var/Typecho/Db/Adapter/Mysql.php @@ -7,9 +7,6 @@ * @version $Id: Mysql.php 103 2008-04-09 16:22:43Z magike.net $ */ -/** 数据库适配器接口 */ -require_once 'Typecho/Db/Adapter.php'; - /** * 数据库Mysql适配器 * @@ -56,7 +53,6 @@ class Typecho_Db_Adapter_Mysql implements Typecho_Db_Adapter } /** 数据库异常 */ - require_once 'Typecho/Db/Adapter/Exception.php'; throw new Typecho_Db_Adapter_Exception(@mysql_error($this->_dbLink)); } @@ -77,7 +73,6 @@ class Typecho_Db_Adapter_Mysql implements Typecho_Db_Adapter } /** 数据库异常 */ - require_once 'Typecho/Db/Query/Exception.php'; throw new Typecho_Db_Query_Exception(@mysql_error($this->_dbLink), mysql_errno($this->_dbLink)); } diff --git a/var/Typecho/Db/Adapter/Pdo.php b/var/Typecho/Db/Adapter/Pdo.php index 3bdcd2f6..b9261cce 100644 --- a/var/Typecho/Db/Adapter/Pdo.php +++ b/var/Typecho/Db/Adapter/Pdo.php @@ -7,9 +7,6 @@ * @version $Id: Mysql.php 89 2008-03-31 00:10:57Z magike.net $ */ -/** 数据库适配器接口 */ -require_once 'Typecho/Db/Adapter.php'; - /** * 数据库PDOMysql适配器 * @@ -59,7 +56,6 @@ abstract class Typecho_Db_Adapter_Pdo implements Typecho_Db_Adapter return $this->_object; } catch (PDOException $e) { /** 数据库异常 */ - require_once 'Typecho/Db/Adapter/Exception.php'; throw new Typecho_Db_Adapter_Exception($e->getMessage()); } } @@ -93,7 +89,6 @@ abstract class Typecho_Db_Adapter_Pdo implements Typecho_Db_Adapter $resource->execute(); } catch (PDOException $e) { /** 数据库异常 */ - require_once 'Typecho/Db/Query/Exception.php'; throw new Typecho_Db_Query_Exception($e->getMessage(), $e->getCode()); } diff --git a/var/Typecho/Db/Adapter/Pdo/Mysql.php b/var/Typecho/Db/Adapter/Pdo/Mysql.php index d2528956..65376d8e 100644 --- a/var/Typecho/Db/Adapter/Pdo/Mysql.php +++ b/var/Typecho/Db/Adapter/Pdo/Mysql.php @@ -7,9 +7,6 @@ * @version $Id: Mysql.php 89 2008-03-31 00:10:57Z magike.net $ */ -/** 数据库适配器接口 */ -require_once 'Typecho/Db/Adapter/Pdo.php'; - /** * 数据库Pdo_Mysql适配器 * diff --git a/var/Typecho/Db/Adapter/Pdo/Pgsql.php b/var/Typecho/Db/Adapter/Pdo/Pgsql.php index 48e4e258..d34a9cac 100644 --- a/var/Typecho/Db/Adapter/Pdo/Pgsql.php +++ b/var/Typecho/Db/Adapter/Pdo/Pgsql.php @@ -7,9 +7,6 @@ * @version $Id$ */ -/** 数据库适配器接口 */ -require_once 'Typecho/Db/Adapter/Pdo.php'; - /** * 数据库Pdo_Pgsql适配器 * diff --git a/var/Typecho/Db/Adapter/Pdo/SQLite.php b/var/Typecho/Db/Adapter/Pdo/SQLite.php index a7b3584c..bcfc3554 100644 --- a/var/Typecho/Db/Adapter/Pdo/SQLite.php +++ b/var/Typecho/Db/Adapter/Pdo/SQLite.php @@ -7,9 +7,6 @@ * @version $Id$ */ -/** 数据库适配器接口 */ -require_once 'Typecho/Db/Adapter/Pdo.php'; - /** * 数据库Pdo_SQLite适配器 * diff --git a/var/Typecho/Db/Adapter/Pgsql.php b/var/Typecho/Db/Adapter/Pgsql.php index 750fc6f9..b759986c 100644 --- a/var/Typecho/Db/Adapter/Pgsql.php +++ b/var/Typecho/Db/Adapter/Pgsql.php @@ -7,9 +7,6 @@ * @version $Id$ */ -/** 数据库适配器接口 */ -require_once 'Typecho/Db/Adapter.php'; - /** * 数据库Pgsql适配器 * @@ -61,7 +58,6 @@ class Typecho_Db_Adapter_Pgsql implements Typecho_Db_Adapter } /** 数据库异常 */ - require_once 'Typecho/Db/Adapter/Exception.php'; throw new Typecho_Db_Adapter_Exception(@pg_last_error($this->_dbLink)); } @@ -84,7 +80,6 @@ class Typecho_Db_Adapter_Pgsql implements Typecho_Db_Adapter } /** 数据库异常 */ - require_once 'Typecho/Db/Query/Exception.php'; throw new Typecho_Db_Query_Exception(@pg_last_error($this->_dbLink), pg_result_error_field(pg_get_result($this->_dbLink), PGSQL_DIAG_SQLSTATE)); } diff --git a/var/Typecho/Db/Adapter/SQLite.php b/var/Typecho/Db/Adapter/SQLite.php index 9142c1d8..9856161e 100644 --- a/var/Typecho/Db/Adapter/SQLite.php +++ b/var/Typecho/Db/Adapter/SQLite.php @@ -7,9 +7,6 @@ * @version $Id: Mysql.php 103 2008-04-09 16:22:43Z magike.net $ */ -/** 数据库适配器接口 */ -require_once 'Typecho/Db/Adapter.php'; - /** * 数据库SQLite适配器 * @@ -84,7 +81,6 @@ class Typecho_Db_Adapter_SQLite implements Typecho_Db_Adapter } /** 数据库异常 */ - require_once 'Typecho/Db/Adapter/Exception.php'; throw new Typecho_Db_Adapter_Exception($error); } @@ -104,7 +100,6 @@ class Typecho_Db_Adapter_SQLite implements Typecho_Db_Adapter } /** 数据库异常 */ - require_once 'Typecho/Db/Query/Exception.php'; $errorCode = sqlite_last_error($this->_dbHandle); throw new Typecho_Db_Query_Exception(sqlite_error_string($errorCode), $errorCode); } diff --git a/var/Typecho/Db/Exception.php b/var/Typecho/Db/Exception.php index 8899ea2f..e16954aa 100644 --- a/var/Typecho/Db/Exception.php +++ b/var/Typecho/Db/Exception.php @@ -7,9 +7,6 @@ * @version $Id: DbException.php 52 2008-03-18 08:04:01Z magike.net $ */ -/** 异常基类 */ -require_once 'Typecho/Exception.php'; - /** * 数据库异常类 * diff --git a/var/Typecho/Db/Query.php b/var/Typecho/Db/Query.php index 76dc2e86..7fca2fe6 100644 --- a/var/Typecho/Db/Query.php +++ b/var/Typecho/Db/Query.php @@ -7,9 +7,6 @@ * @version $Id: DbQuery.php 97 2008-04-04 04:39:54Z magike.net $ */ -/** Typecho_Config */ -require_once 'Typecho/Config.php'; - /** * Typecho数据库查询语句构建类 * 使用方法: diff --git a/var/Typecho/Db/Query/Exception.php b/var/Typecho/Db/Query/Exception.php index 5336367c..57a97512 100644 --- a/var/Typecho/Db/Query/Exception.php +++ b/var/Typecho/Db/Query/Exception.php @@ -7,9 +7,6 @@ * @version $Id: DbException.php 52 2008-03-18 08:04:01Z magike.net $ */ -/** 数据库异常基类 */ -require_once 'Typecho/Db/Exception.php'; - /** * 数据库查询异常类 * diff --git a/var/Typecho/Http/Client.php b/var/Typecho/Http/Client.php index 827f9f7e..4d4a7cf9 100644 --- a/var/Typecho/Http/Client.php +++ b/var/Typecho/Http/Client.php @@ -10,9 +10,6 @@ * @version $Id$ */ -/** Typecho_Common */ -require_once 'Typecho/Common.php'; - /** * Http客户端 * @@ -50,7 +47,6 @@ class Typecho_Http_Client } foreach ($adapters as $adapter) { - require_once 'Typecho/Http/Client/Adapter/' . $adapter . '.php'; $adapterName = 'Typecho_Http_Client_Adapter_' . $adapter; if (Typecho_Common::isAvailableClass($adapterName) && call_user_func(array($adapterName, 'isAvailable'))) { return new $adapterName(); diff --git a/var/Typecho/Http/Client/Adapter.php b/var/Typecho/Http/Client/Adapter.php index 23ec0152..7923b32f 100644 --- a/var/Typecho/Http/Client/Adapter.php +++ b/var/Typecho/Http/Client/Adapter.php @@ -10,9 +10,6 @@ * @version $Id$ */ -/** Typecho_Http_Client */ -require_once 'Typecho/Http/Client.php'; - /** * 客户端适配器 * @@ -307,8 +304,6 @@ abstract class Typecho_Http_Client_Adapter if (!empty($params['host'])) { $this->host = $params['host']; } else { - /** Typecho_Http_Client_Exception */ - require_once 'Typecho/Http/Client/Exception.php'; throw new Typecho_Http_Client_Exception('Unknown Host', 500); } diff --git a/var/Typecho/Http/Client/Adapter/Curl.php b/var/Typecho/Http/Client/Adapter/Curl.php index 40b94327..5fda3906 100644 --- a/var/Typecho/Http/Client/Adapter/Curl.php +++ b/var/Typecho/Http/Client/Adapter/Curl.php @@ -10,9 +10,6 @@ * @version $Id$ */ -/** Typecho_Http_Client_Adapter */ -require_once 'Typecho/Http/Client/Adapter.php'; - /** * CURL适配器 * @@ -111,8 +108,6 @@ class Typecho_Http_Client_Adapter_Curl extends Typecho_Http_Client_Adapter $response = curl_exec($ch); if (false === $response) { - /** Typecho_Http_Client_Exception */ - require_once 'Typecho/Http/Client/Exception.php'; throw new Typecho_Http_Client_Exception(curl_error($ch), 500); } diff --git a/var/Typecho/Http/Client/Adapter/Socket.php b/var/Typecho/Http/Client/Adapter/Socket.php index ff5ba500..2406f608 100644 --- a/var/Typecho/Http/Client/Adapter/Socket.php +++ b/var/Typecho/Http/Client/Adapter/Socket.php @@ -10,9 +10,6 @@ * @version $Id$ */ -/** Typecho_Http_Client_Adapter */ -require_once 'Typecho/Http/Client/Adapter.php'; - /** * Socket适配器 * diff --git a/var/Typecho/Http/Client/Exception.php b/var/Typecho/Http/Client/Exception.php index 984fdd50..98a896ff 100644 --- a/var/Typecho/Http/Client/Exception.php +++ b/var/Typecho/Http/Client/Exception.php @@ -7,9 +7,6 @@ * @version $Id: DbException.php 52 2008-03-18 08:04:01Z magike.net $ */ -/** 异常基类 */ -require_once 'Typecho/Exception.php'; - /** * Http客户端异常类 * diff --git a/var/Typecho/I18n.php b/var/Typecho/I18n.php index e50e7b92..6a69324c 100644 --- a/var/Typecho/I18n.php +++ b/var/Typecho/I18n.php @@ -78,7 +78,6 @@ class Typecho_I18n private static function init() { /** GetText支持 */ - require_once 'Typecho/I18n/GetTextMulti.php'; self::$_loaded = new Typecho_I18n_GetTextMulti(self::$_lang); return true; } diff --git a/var/Typecho/I18n/GetTextMulti.php b/var/Typecho/I18n/GetTextMulti.php index 717c4c45..0f246c5b 100644 --- a/var/Typecho/I18n/GetTextMulti.php +++ b/var/Typecho/I18n/GetTextMulti.php @@ -7,9 +7,6 @@ * @version $Id$ */ -/** Typecho_I18n_GetText */ -require_once 'Typecho/I18n/GetText.php'; - /** * 用于解决一个多个mo文件带来的读写问题 * 我们重写了一个文件读取类 diff --git a/var/Typecho/Plugin/Exception.php b/var/Typecho/Plugin/Exception.php index 3a430ddc..fc3c4ff5 100644 --- a/var/Typecho/Plugin/Exception.php +++ b/var/Typecho/Plugin/Exception.php @@ -7,9 +7,6 @@ * @version $Id: WidgetException.php 46 2008-03-10 13:59:36Z magike.net $ */ -/** 异常基类 */ -require_once 'Typecho/Exception.php'; - /** * 插件异常 * diff --git a/var/Typecho/Request.php b/var/Typecho/Request.php index 35a7fe70..88b39146 100644 --- a/var/Typecho/Request.php +++ b/var/Typecho/Request.php @@ -494,9 +494,6 @@ class Typecho_Request } $parts['query'] = http_build_query($args); - /** Typecho_Common */ - require_once 'Typecho/Common.php'; - /** 返回地址 */ return Typecho_Common::buildUrl($parts); } diff --git a/var/Typecho/Response.php b/var/Typecho/Response.php index 4633ff36..540f9391 100644 --- a/var/Typecho/Response.php +++ b/var/Typecho/Response.php @@ -9,9 +9,6 @@ * @version $Id$ */ -/** 载入api支持 */ -require_once 'Typecho/Common.php'; - /** * Typecho公用方法 * @@ -246,7 +243,6 @@ class Typecho_Response public function redirect($location, $isPermanently = false) { /** Typecho_Common */ - require_once 'Typecho/Common.php'; $location = Typecho_Common::safeUrl($location); if ($isPermanently) { diff --git a/var/Typecho/Router.php b/var/Typecho/Router.php index 012d2a16..483ee820 100644 --- a/var/Typecho/Router.php +++ b/var/Typecho/Router.php @@ -7,15 +7,6 @@ * @version $Id: Route.php 107 2008-04-11 07:14:43Z magike.net $ */ -/** 载入api支持 */ -require_once 'Typecho/Common.php'; - -/** Typecho_Ruquest */ -require_once 'Typecho/Request.php'; - -/** Typecho_Widget */ -require_once 'Typecho/Widget.php'; - /** * Typecho组件基类 * @@ -161,7 +152,6 @@ class Typecho_Router } /** 载入路由异常支持 */ - require_once 'Typecho/Router/Exception.php'; throw new Typecho_Router_Exception("Path '{$pathInfo}' not found", 404); } @@ -195,9 +185,6 @@ class Typecho_Router */ public static function setRoutes($routes) { - /** 载入路由解析支持 */ - require_once 'Typecho/Router/Parser.php'; - if (isset($routes[0])) { self::$_routingTable = $routes[0]; } else { diff --git a/var/Typecho/Router/Exception.php b/var/Typecho/Router/Exception.php index 8a7e05ff..7ba8aaf5 100644 --- a/var/Typecho/Router/Exception.php +++ b/var/Typecho/Router/Exception.php @@ -7,9 +7,6 @@ * @version $Id: RouteException.php 104 2008-04-10 07:58:09Z magike.net $ */ -/** 异常基类 */ -require_once 'Typecho/Exception.php'; - /** * 路由异常类 * diff --git a/var/Typecho/Validate.php b/var/Typecho/Validate.php index f5e8fab0..8bf2dc02 100644 --- a/var/Typecho/Validate.php +++ b/var/Typecho/Validate.php @@ -16,9 +16,6 @@ * @version $Id: Validation.php 106 2008-04-11 02:23:54Z magike.net $ */ -/** Typecho_Common */ -require_once 'Typecho/Common.php'; - /** * 验证类 * diff --git a/var/Typecho/Widget.php b/var/Typecho/Widget.php index 3b4feb01..0673bd22 100644 --- a/var/Typecho/Widget.php +++ b/var/Typecho/Widget.php @@ -7,12 +7,6 @@ * @version $Id: Widget.php 107 2008-04-11 07:14:43Z magike.net $ */ -/** Typecho_Config */ -require_once 'Typecho/Config.php'; - -/** Typecho_Plugin */ -require_once 'Typecho/Plugin.php'; - /** * Typecho组件基类 * @@ -132,8 +126,6 @@ abstract class Typecho_Widget if ($condition) { return $this; } else { - /** Typecho_Widget_Helper_Null */ - require_once 'Typecho/Widget/Helper/Empty.php'; return new Typecho_Widget_Helper_Empty(); } } @@ -171,8 +163,6 @@ abstract class Typecho_Widget /** 如果类不存在 */ if (!class_exists($className)) { - /** Typecho_Exception */ - require_once 'Typecho/Widget/Exception.php'; throw new Typecho_Widget_Exception($className); } diff --git a/var/Typecho/Widget/Exception.php b/var/Typecho/Widget/Exception.php index ccdeea14..2746c2f8 100644 --- a/var/Typecho/Widget/Exception.php +++ b/var/Typecho/Widget/Exception.php @@ -7,9 +7,6 @@ * @version $Id: WidgetException.php 46 2008-03-10 13:59:36Z magike.net $ */ -/** 异常基类 */ -require_once 'Typecho/Exception.php'; - /** * 组件异常类 * diff --git a/var/Typecho/Widget/Helper/Form.php b/var/Typecho/Widget/Helper/Form.php index 3f8e990a..99102b74 100644 --- a/var/Typecho/Widget/Helper/Form.php +++ b/var/Typecho/Widget/Helper/Form.php @@ -9,12 +9,6 @@ * @version $Id$ */ -/** Typecho_Widget_Helper_Layout */ -require_once 'Typecho/Widget/Helper/Layout.php'; - -/** Typecho_Validate */ -require_once 'Typecho/Validate.php'; - /** * 表单处理帮手 * diff --git a/var/Typecho/Widget/Helper/Form/Element.php b/var/Typecho/Widget/Helper/Form/Element.php index 97e5c00a..7e631240 100644 --- a/var/Typecho/Widget/Helper/Form/Element.php +++ b/var/Typecho/Widget/Helper/Form/Element.php @@ -9,9 +9,6 @@ * @version $Id$ */ -/** Typecho_Widget_Helper_Layout */ -require_once 'Typecho/Widget/Helper/Layout.php'; - /** * 表单元素抽象类 * diff --git a/var/Typecho/Widget/Helper/Form/Element/Checkbox.php b/var/Typecho/Widget/Helper/Form/Element/Checkbox.php index e2b8af59..e3eceb18 100644 --- a/var/Typecho/Widget/Helper/Form/Element/Checkbox.php +++ b/var/Typecho/Widget/Helper/Form/Element/Checkbox.php @@ -9,9 +9,6 @@ * @version $Id$ */ -/** Typecho_Widget_Helper_Form_Element */ -require_once 'Typecho/Widget/Helper/Form/Element.php'; - /** * 多选框帮手类 * diff --git a/var/Typecho/Widget/Helper/Form/Element/Fake.php b/var/Typecho/Widget/Helper/Form/Element/Fake.php new file mode 100644 index 00000000..c9fef6e9 --- /dev/null +++ b/var/Typecho/Widget/Helper/Form/Element/Fake.php @@ -0,0 +1,83 @@ +name = $name; + self::$uniqueId ++; + + /** 运行自定义初始函数 */ + $this->init(); + + /** 初始化表单项 */ + $this->input = $this->input($name, $options); + + /** 初始化表单值 */ + if (NULL !== $value) { + $this->value($value); + } + } + + /** + * 自定义初始函数 + * + * @access public + * @return void + */ + public function init() + {} + + /** + * 初始化当前输入项 + * + * @access public + * @param string $name 表单元素名称 + * @param array $options 选择项 + * @return Typecho_Widget_Helper_Layout + */ + public function input($name = NULL, array $options = NULL) + { + $input = new Typecho_Widget_Helper_Layout('input'); + $this->inputs[] = $input; + return $input; + } + + /** + * 设置表单项默认值 + * + * @access protected + * @param string $value 表单项默认值 + * @return void + */ + protected function _value($value) + { + $this->input->setAttribute('value', $value); + } +} + diff --git a/var/Typecho/Widget/Helper/Form/Element/Hidden.php b/var/Typecho/Widget/Helper/Form/Element/Hidden.php index 889bc7e7..e4b051dd 100644 --- a/var/Typecho/Widget/Helper/Form/Element/Hidden.php +++ b/var/Typecho/Widget/Helper/Form/Element/Hidden.php @@ -9,9 +9,6 @@ * @version $Id$ */ -/** Typecho_Widget_Helper_Form_Element */ -require_once 'Typecho/Widget/Helper/Form/Element.php'; - /** * 隐藏域帮手类 * diff --git a/var/Typecho/Widget/Helper/Form/Element/Password.php b/var/Typecho/Widget/Helper/Form/Element/Password.php index 811f28c8..cfa50adf 100644 --- a/var/Typecho/Widget/Helper/Form/Element/Password.php +++ b/var/Typecho/Widget/Helper/Form/Element/Password.php @@ -9,9 +9,6 @@ * @version $Id$ */ -/** Typecho_Widget_Helper_Form_Element */ -require_once 'Typecho/Widget/Helper/Form/Element.php'; - /** * 密码输入表单项帮手类 * diff --git a/var/Typecho/Widget/Helper/Form/Element/Radio.php b/var/Typecho/Widget/Helper/Form/Element/Radio.php index 2b1a5396..a97c9699 100644 --- a/var/Typecho/Widget/Helper/Form/Element/Radio.php +++ b/var/Typecho/Widget/Helper/Form/Element/Radio.php @@ -9,9 +9,6 @@ * @version $Id$ */ -/** Typecho_Widget_Helper_Form_Element */ -require_once 'Typecho/Widget/Helper/Form/Element.php'; - /** * 单选框帮手类 * diff --git a/var/Typecho/Widget/Helper/Form/Element/Select.php b/var/Typecho/Widget/Helper/Form/Element/Select.php index f09e2f66..ea8dd942 100644 --- a/var/Typecho/Widget/Helper/Form/Element/Select.php +++ b/var/Typecho/Widget/Helper/Form/Element/Select.php @@ -9,9 +9,6 @@ * @version $Id$ */ -/** Typecho_Widget_Helper_Form_Element */ -require_once 'Typecho/Widget/Helper/Form/Element.php'; - /** * 下拉选择框帮手类 * diff --git a/var/Typecho/Widget/Helper/Form/Element/Submit.php b/var/Typecho/Widget/Helper/Form/Element/Submit.php index 1d88f513..cb110e9e 100644 --- a/var/Typecho/Widget/Helper/Form/Element/Submit.php +++ b/var/Typecho/Widget/Helper/Form/Element/Submit.php @@ -9,9 +9,6 @@ * @version $Id$ */ -/** Typecho_Widget_Helper_Form_Element */ -require_once 'Typecho/Widget/Helper/Form/Element.php'; - /** * 提交按钮表单项帮手类 * diff --git a/var/Typecho/Widget/Helper/Form/Element/Text.php b/var/Typecho/Widget/Helper/Form/Element/Text.php index df5b1e9c..ddd221c5 100644 --- a/var/Typecho/Widget/Helper/Form/Element/Text.php +++ b/var/Typecho/Widget/Helper/Form/Element/Text.php @@ -9,9 +9,6 @@ * @version $Id$ */ -/** Typecho_Widget_Helper_Form_Element */ -require_once 'Typecho/Widget/Helper/Form/Element.php'; - /** * 文字输入表单项帮手类 * diff --git a/var/Typecho/Widget/Helper/Form/Element/Textarea.php b/var/Typecho/Widget/Helper/Form/Element/Textarea.php index 43d0e497..0d4a7ac4 100644 --- a/var/Typecho/Widget/Helper/Form/Element/Textarea.php +++ b/var/Typecho/Widget/Helper/Form/Element/Textarea.php @@ -9,9 +9,6 @@ * @version $Id$ */ -/** Typecho_Widget_Helper_Form_Element */ -require_once 'Typecho/Widget/Helper/Form/Element.php'; - /** * 多行文字域帮手类 * diff --git a/var/Typecho/Widget/Helper/PageNavigator.php b/var/Typecho/Widget/Helper/PageNavigator.php index 600d241d..12d5b96b 100644 --- a/var/Typecho/Widget/Helper/PageNavigator.php +++ b/var/Typecho/Widget/Helper/PageNavigator.php @@ -126,8 +126,6 @@ abstract class Typecho_Widget_Helper_PageNavigator */ public function render() { - /** 载入异常支持 */ - require_once 'Typecho/Widget/Exception.php'; throw new Typecho_Widget_Exception(get_class($this) . ':' . __METHOD__, 500); } } diff --git a/var/Typecho/Widget/Helper/PageNavigator/Box.php b/var/Typecho/Widget/Helper/PageNavigator/Box.php index 29c3496d..f152a992 100644 --- a/var/Typecho/Widget/Helper/PageNavigator/Box.php +++ b/var/Typecho/Widget/Helper/PageNavigator/Box.php @@ -7,9 +7,6 @@ * @version $Id$ */ -/** Typecho_Widget_Helper_PageNavigator */ -require_once 'Typecho/Widget/Helper/PageNavigator.php'; - /** * 盒状分页样式 * diff --git a/var/Typecho/Widget/Helper/PageNavigator/Classic.php b/var/Typecho/Widget/Helper/PageNavigator/Classic.php index 0b0246b0..c416d5d7 100644 --- a/var/Typecho/Widget/Helper/PageNavigator/Classic.php +++ b/var/Typecho/Widget/Helper/PageNavigator/Classic.php @@ -7,9 +7,6 @@ * @version $Id$ */ -/** Typecho_Widget_Helper_PageNavigator */ -require_once 'Typecho/Widget/Helper/PageNavigator.php'; - /** * 经典分页样式 *