/** * 构造函数,设置基本属性 * * @access public * @param null $action * @param string $method * @param string $enctype */ public function __construct($action = NULL, $method = self::GET_METHOD, $enctype = self::STANDARD_ENCODE) { /** 设置表单标签 */ parent::__construct('form'); /** 关闭自闭合 */ $this->setClose(false); /** 设置表单属性 */ $this->setAction($action); $this->setMethod($method); $this->setEncodeType($enctype); }
/** * 构造函数 * * @access public * @param string $name 表单输入项名称 * @param array $options 选择项 * @param mixed $value 表单默认值 * @param string $label 表单标题 * @param string $description 表单描述 * @return void */ public function __construct($name = NULL, array $options = NULL, $value = NULL, $label = NULL, $description = NULL) { /** 创建html元素,并设置class */ parent::__construct('ul', array('class' => 'typecho-option', 'id' => 'typecho-option-item-' . $name . '-' . self::$uniqueId)); $this->name = $name; self::$uniqueId++; /** 运行自定义初始函数 */ $this->init(); /** 初始化表单标题 */ if (NULL !== $label) { $this->label($label); } /** 初始化表单项 */ $this->input = $this->input($name, $options); /** 初始化表单值 */ if (NULL !== $value) { $this->value($value); } /** 初始化表单描述 */ if (NULL !== $description) { $this->description($description); } }