当前位置: 首页>>代码示例>>PHP>>正文


PHP Typecho_Widget_Helper_Form::addItem方法代码示例

本文整理汇总了PHP中Typecho_Widget_Helper_Form::addItem方法的典型用法代码示例。如果您正苦于以下问题:PHP Typecho_Widget_Helper_Form::addItem方法的具体用法?PHP Typecho_Widget_Helper_Form::addItem怎么用?PHP Typecho_Widget_Helper_Form::addItem使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Typecho_Widget_Helper_Form的用法示例。


在下文中一共展示了Typecho_Widget_Helper_Form::addItem方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: config

    /**
     * 获取插件配置面板
     *
     * @access public
     * @param Typecho_Widget_Helper_Form $form 配置面板
     * @return void
     */
    public static function config(Typecho_Widget_Helper_Form $form)
    {
        $editorThemeOptions = array('default' => '默认风格', 'simple' => '简洁风格', 'qq' => 'QQ风格');
        $editorTheme = new Typecho_Widget_Helper_Form_Element_Select('editorTheme', $editorThemeOptions, 'default', _t('皮肤'));
        $editorLangOptions = array('zh_CN' => '中文简体', 'en' => 'English');
        $editorLang = new Typecho_Widget_Helper_Form_Element_Select('editorLang', $editorLangOptions, 'zh_CN', '语言');
        $line = new Typecho_Widget_Helper_Layout('hr');
        $editorNewlineTagOptions = array('br' => '新开始行', 'p' => '新开始段落');
        $editorNewlineTag = new Typecho_Widget_Helper_Form_Element_Radio('editorNewlineTag', $editorNewlineTagOptions, 'p', _t('回车处理'));
        $editorPasteTypeOptions = array('0' => '禁止', '1' => '纯文本', '2' => 'HTML');
        $editorPasteType = new Typecho_Widget_Helper_Form_Element_Radio('editorPasteType', $editorPasteTypeOptions, '2', _t('粘贴类型'));
        $editorToolsOptions = array('source' => 'HTML代码', '|' => '分隔', 'undo' => '后退', 'redo' => '前进', '|1' => '分隔', 'preview' => '预览', 'wordpaste' => '从Word粘贴', 'print' => '打印', 'template' => '插入模板', 'code' => '插入程序代码', 'cut' => '剪切', 'copy' => ' 复制', 'paste' => '粘贴', 'plainpaste' => '粘贴为无格式文本', '|2' => '分隔', 'selectall' => '全选', 'justifyleft' => '左对齐', 'justifycenter' => '居中', 'justifyright' => '右对齐', 'justifyfull' => '两端对齐', 'insertorderedlist' => '编号', 'insertunorderedlist' => '项目符号', 'indent' => '增加缩进', 'outdent' => '减少缩进', 'subscript' => '下标', 'superscript' => '上标', 'removeformat' => '删除格式', 'quickformat' => '一键排版', '|3' => '分隔', 'formatblock' => '段落', 'fontname' => '字体', 'fontsize' => '文字大小', '|3' => '分隔', 'forecolor' => '文字颜色', 'hilitecolor' => '文字背景', 'bold' => '粗体', 'italic' => '斜体', 'underline' => '下划线', 'strikethrough' => '删除线', '|5' => '分隔', 'image' => '图片', 'flash' => 'Flash', 'media' => '视音频', 'table' => '表格', 'hr' => '插入横线', 'emoticons' => '插入表情', 'link' => '超级链接', 'unlink' => '取消超级链接', 'fullscreen' => '全屏显示', 'map' => 'Google地图', 'baidumap' => '百度地图', 'lineheight' => '行距', 'clearhtml' => '清理HTML代码', 'pagebreak' => ' 插入分页符', 'anchor' => '插入锚点', 'insertfile' => '插入文件', '|6' => '分隔', 'about' => '关于');
        $editorToolsDescription = _t('仅在默认风格有效!');
        $editorTools = new Typecho_Widget_Helper_Form_Element_Checkbox('editorTools', $editorToolsOptions, array('fontname', 'fontsize', '|', 'forecolor', 'hilitecolor', 'bold', 'italic', 'underline', 'removeformat', '|', 'justifyleft', 'justifycenter', 'justifyright', 'insertorderedlist', 'insertunorderedlist', '|', 'emoticons', 'image', 'link'), _t('工具栏'), $editorToolsDescription);
        $form->addInput($editorTheme);
        $form->addInput($editorLang);
        $form->addItem($line);
        $form->addInput($editorNewlineTag);
        $form->addInput($editorPasteType);
        $form->addItem($line);
        $form->addInput($editorTools);
        $form->addItem($line);
        echo <<<EOF
        <style>
            #typecho-option-item-editorTools-4 span{width:24%;display:inline-block;margin-right:0;}
        </style>
EOF;
    }
开发者ID:liutongju,项目名称:KindEditor,代码行数:35,代码来源:Plugin.php

示例2: config

 /**
  * 获取插件配置面板
  * 
  * @access public
  * @param Typecho_Widget_Helper_Form $form 配置面板
  * @return void
  */
 public static function config(Typecho_Widget_Helper_Form $form)
 {
     if (isset($_GET['action']) && $_GET['action'] == 'deletefile') {
         self::deletefile();
     }
     $listexpire = new Typecho_Widget_Helper_Form_Element_Text('listexpire', null, '43200', _t('歌单更新周期'), _t('设置歌单的缓存时间(单位:秒),超过设定时间后歌单将自动更新'));
     $form->addInput($listexpire);
     $maintheme = new Typecho_Widget_Helper_Form_Element_Text('maintheme', null, '#e6d0b2', _t('默认主题颜色'), _t('播放器默认的主题颜色,如 #372e21、#75c、red、blue,该设定会被[player]标签中的theme属性覆盖,默认为 #e6d0b2'));
     $form->addInput($maintheme);
     $nolyric = new Typecho_Widget_Helper_Form_Element_Text('nolyric', null, '找不到歌词', _t('找不到歌词时显示的文字'), _t('找不到歌词时显示的文字'));
     $form->addInput($nolyric);
     $mutex = new Typecho_Widget_Helper_Form_Element_Radio('mutex', array('false' => _t('是'), 'true' => _t('否')), 'true', _t('是否允许在一个页面中多个播放器同时播放'), _t('若选择否,当页面中存在多个播放器时,点击其中一个播放器的播放按钮,其它播放器将自动暂停'));
     $form->addInput($mutex);
     $preload = new Typecho_Widget_Helper_Form_Element_Radio('preload', array('false' => _t('自动'), 'none' => _t('none'), 'metadata' => _t('metadata'), 'auto' => _t('auto')), 'false', _t('音频预加载(preload)属性'), '自动:移动端为none,桌面端为metadata; none:页面加载后不预加载音频; metadata:当页面加载后仅加载音频的元数据; auto:一旦页面加载,则开始加载音频。');
     $form->addInput($preload);
     $cache = new Typecho_Widget_Helper_Form_Element_Radio('cache', array('false' => _t('否')), 'false', _t('清空缓存'), _t('清空插件生成的缓存文件,必要时可以使用'));
     $form->addInput($cache);
     $submit = new Typecho_Widget_Helper_Form_Element_Submit();
     $submit->value(_t('清空歌词,专辑图片链接,在线歌曲缓存'));
     $submit->setAttribute('style', 'position:relative;');
     $submit->input->setAttribute('style', 'position:absolute;bottom:37px;');
     $submit->input->setAttribute('class', 'btn btn-s btn-warn btn-operate');
     $submit->input->setAttribute('formaction', Typecho_Common::url('/options-plugin.php?config=APlayer&action=deletefile', Helper::options()->adminUrl));
     $form->addItem($submit);
 }
开发者ID:zgq354,项目名称:APlayer-Typecho-Plugin,代码行数:32,代码来源:Plugin.php

示例3: config

    /**
     * 获取插件配置面板
     * 
     * @access public
     * @param Typecho_Widget_Helper_Form $form 配置面板
     * @return void
     */
    public static function config(Typecho_Widget_Helper_Form $form)
    {
        $introduce = new Typecho_Widget_Helper_Layout("div");
        $introduce->html(<<<EOI
<p>在 Typecho 正式显示 404 之前,此插件会遍历列表并作出跳转。</p>
<p>规则列表一行一个,格式为: Pattern   Rewrite结果  [flags]</p>
<p>比如【 <code class="success">^\\/(\\d+)\\/?\$  /archives/\$1   T</code> 】可以把 /12 以302重定向跳转到 /archivers/12 </p>
<p><a href="https://github.com/laobubu/Typecho_rewriterule">详细说明看这里</a></p>
EOI
);
        $rules = new Typecho_Widget_Helper_Form_Element_Textarea('rules', NULL, '不符合书写规范的行可以当注释哦', _t('规则列表'));
        $form->addInput($rules);
        $form->addItem($introduce);
    }
开发者ID:duxiangfei,项目名称:plugins,代码行数:21,代码来源:Plugin.php

示例4: form

 public function form()
 {
     /** 构建表格 */
     $form = new Typecho_Widget_Helper_Form($this->security->getIndex('/action/options-forum'), Typecho_Widget_Helper_Form::POST_METHOD);
     $siteIcp = new Typecho_Widget_Helper_Form_Element_Text('siteIcp', NULL, $this->options->siteIcp, _t('网站备案号'), _t('在这里填入网站备案号'));
     $siteIcp->input->setAttribute('class', 'w-60');
     $form->addInput($siteIcp);
     $siteStat = new Typecho_Widget_Helper_Form_Element_Textarea('siteStat', NULL, $this->options->siteStat, _t('统计代码'), _t('在这里填入网站统计代码'));
     $form->addInput($siteStat);
     $smtp_host = new Typecho_Widget_Helper_Form_Element_Text('smtpHost', NULL, $this->options->smtpHost, _t('SMTP地址'), _t('请填写 SMTP 服务器地址'));
     $smtp_host->input->setAttribute('class', 'w-60');
     $form->addInput($smtp_host);
     $smtp_port = new Typecho_Widget_Helper_Form_Element_Text('smtpPort', NULL, $this->options->smtpPort, _t('SMTP端口'), _t('SMTP服务端口,一般为25。'));
     $smtp_port->input->setAttribute('class', 'w-60');
     $form->addInput($smtp_port);
     $smtp_user = new Typecho_Widget_Helper_Form_Element_Text('smtpUser', NULL, $this->options->smtpUser, _t('SMTP用户'), _t('SMTP服务验证用户名,一般为邮箱名如:youname@domain.com'));
     $smtp_user->input->setAttribute('class', 'w-60');
     $form->addInput($smtp_user);
     $smtp_pass = new Typecho_Widget_Helper_Form_Element_Password('smtpPass', NULL, $this->options->smtpPass, _t('SMTP密码'));
     $smtp_pass->input->setAttribute('class', 'w-60');
     $form->addInput($smtp_pass);
     $from_mail = new Typecho_Widget_Helper_Form_Element_Text('smtpMail', NULL, $this->options->smtpMail, _t('发件人EMAIL'));
     $from_mail->input->setAttribute('class', 'w-60');
     $form->addInput($from_mail->addRule('email', _t('电子邮箱格式错误')));
     $from_name = new Typecho_Widget_Helper_Form_Element_Text('smtpName', NULL, $this->options->smtpName, _t('发件人名称'));
     $from_name->input->setAttribute('class', 'w-60');
     $form->addInput($from_name);
     //用户积分
     $credits_register = new Typecho_Widget_Helper_Form_Element_Text('creditsRegister', NULL, $this->options->creditsRegister, _t('注册积分'), _t('用户注册后默认的积分'));
     $credits_register->input->setAttribute('class', 'w-60');
     $form->addInput($credits_register);
     $credits_login = new Typecho_Widget_Helper_Form_Element_Text('creditsLogin', NULL, $this->options->creditsLogin, _t('登录积分'), _t('每日登录获取的积分'));
     $credits_login->input->setAttribute('class', 'w-60');
     $form->addInput($credits_login);
     $credits_publish = new Typecho_Widget_Helper_Form_Element_Text('creditsPublish', NULL, $this->options->creditsPublish, _t('发布主题'), _t('用户发布主题加上或减少的积分'));
     $credits_publish->input->setAttribute('class', 'w-60');
     $form->addInput($credits_publish);
     $credits_reply = new Typecho_Widget_Helper_Form_Element_Text('creditsReply', NULL, $this->options->creditsReply, _t('发表回复'), _t('用户发表回复加上或减少的积分'));
     $credits_reply->input->setAttribute('class', 'w-60');
     $form->addInput($credits_reply);
     $credits_invite = new Typecho_Widget_Helper_Form_Element_Text('creditsInvite', NULL, $this->options->creditsInvite, _t('邀请注册'), _t('邀请者和被邀请者所奖励的积分'));
     $credits_invite->input->setAttribute('class', 'w-60');
     $form->addInput($credits_invite);
     /** 提交按钮 */
     $submit = new Typecho_Widget_Helper_Form_Element_Submit('submit', NULL, _t('保存设置'));
     $submit->input->setAttribute('class', 'btn primary');
     $form->addItem($submit);
     return $form;
 }
开发者ID:dccecc,项目名称:typecho,代码行数:49,代码来源:Forum.php

示例5: config

 /**
  * 获取插件配置面板
  * 
  * @access public
  * @param Typecho_Widget_Helper_Form $form 配置面板
  * @return void
  */
 public static function config(Typecho_Widget_Helper_Form $form)
 {
     if (isset($_GET['action']) && $_GET['action'] == 'deletefile') {
         self::deletefile();
     }
     $cache = new Typecho_Widget_Helper_Form_Element_Radio('cache', array('false' => _t('否')), 'false', _t('清空缓存'), _t('必要时可以使用'));
     $form->addInput($cache);
     $submit = new Typecho_Widget_Helper_Form_Element_Submit();
     $submit->value(_t('清空歌词缓存'));
     $submit->setAttribute('style', 'position:relative;');
     $submit->input->setAttribute('style', 'position:absolute;bottom:37px;');
     $submit->input->setAttribute('class', 'btn btn-s btn-warn btn-operate');
     $submit->input->setAttribute('formaction', Typecho_Common::url('/options-plugin.php?config=cPlayer&action=deletefile', Helper::options()->adminUrl));
     $form->addItem($submit);
 }
开发者ID:journey-ad,项目名称:cPlayer-Typecho-Plugin,代码行数:22,代码来源:Plugin.php

示例6: config

 public static function config(Typecho_Widget_Helper_Form $form)
 {
     $help = new Typecho_Widget_Helper_Layout('div', array('style' => 'color: #999; background-color: #eee; border-radius: 10px; padding: 10px;'));
     $help->html("<strong>使用方法</strong><pre><small>```c#\nConsole.Write(\"Hello World!\");\n```\n或行内代码\n`js console.log(\"Hi!\");`</small></pre>");
     $form->addItem($help);
     $themes = array_map('basename', glob(dirname(__FILE__) . '/themes/*.css'));
     $themes = array_combine($themes, $themes);
     $theme = new Typecho_Widget_Helper_Form_Element_Select('theme', $themes, 'prism-coy.css', _t('代码样式'));
     $form->addInput($theme->addRule('enum', _t('必须选择样式'), $themes));
     $showLineNumber = new Typecho_Widget_Helper_Form_Element_Checkbox('showln', array('showln' => _t('显示行号')), array('showln'), _t('是否在大段代码左侧显示行号'));
     $form->addInput($showLineNumber);
     $forceWrap = new Typecho_Widget_Helper_Form_Element_Checkbox('forceWrap', array('forceWrap' => _t('强制换行')), array('forceWrap'), _t('是否强制换行'));
     $form->addInput($forceWrap);
     $showLang = new Typecho_Widget_Helper_Form_Element_Checkbox('showlang', array('showlang' => _t('显示语言标签')), array('showlang'), _t('是否在大段代码右上角显示语言'));
     $form->addInput($showLang);
 }
开发者ID:WiseClock,项目名称:Prismjs,代码行数:16,代码来源:Plugin.php

示例7: form

 /**
  * 输出表单结构
  *
  * @access public
  * @return Typecho_Widget_Helper_Form
  */
 public function form()
 {
     /** 构建表格 */
     $form = new Typecho_Widget_Helper_Form(Typecho_Common::url('/action/options-general', $this->options->index), Typecho_Widget_Helper_Form::POST_METHOD);
     /** 站点名称 */
     $title = new Typecho_Widget_Helper_Form_Element_Text('title', NULL, $this->options->title, _t('站点名称'), _t('站点的名称将显示在网页的标题处.'));
     $form->addInput($title);
     /** 站点描述 */
     $description = new Typecho_Widget_Helper_Form_Element_Textarea('description', NULL, $this->options->description, _t('站点描述'), _t('站点描述将显示在网页代码的头部.'));
     $form->addInput($description);
     /** 关键词 */
     $keywords = new Typecho_Widget_Helper_Form_Element_Text('keywords', NULL, $this->options->keywords, _t('关键词'), _t('请以半角逗号 "," 分割多个关键字.'));
     $form->addInput($keywords);
     /** 注册 */
     $allowRegister = new Typecho_Widget_Helper_Form_Element_Radio('allowRegister', array('0' => _t('不允许'), '1' => _t('允许')), $this->options->allowRegister, _t('是否允许注册'), _t('允许访问者注册到你的网站, 默认的注册用户不享有任何写入权限.'));
     $form->addInput($allowRegister);
     /** 时区 */
     $timezoneList = array("0" => _t('格林威治(子午线)标准时间 (GMT)'), "3600" => _t('中欧标准时间 阿姆斯特丹,荷兰,法国 (GMT +1)'), "7200" => _t('东欧标准时间 布加勒斯特,塞浦路斯,希腊 (GMT +2)'), "10800" => _t('莫斯科时间 伊拉克,埃塞俄比亚,马达加斯加 (GMT +3)'), "14400" => _t('第比利斯时间 阿曼,毛里塔尼亚,留尼汪岛 (GMT +4)'), "18000" => _t('新德里时间 巴基斯坦,马尔代夫 (GMT +5)'), "21600" => _t('科伦坡时间 孟加拉 (GMT +6)'), "25200" => _t('曼谷雅加达 柬埔寨,苏门答腊,老挝 (GMT +7)'), "28800" => _t('北京时间 香港,新加坡,越南 (GMT +8)'), "32400" => _t('东京平壤时间 西伊里安,摩鹿加群岛 (GMT +9)'), "36000" => _t('悉尼关岛时间 塔斯马尼亚岛,新几内亚 (GMT +10)'), "39600" => _t('所罗门群岛 库页岛 (GMT +11)'), "43200" => _t('惠灵顿时间 新西兰,斐济群岛 (GMT +12)'), "-3600" => _t('佛德尔群岛 亚速尔群岛,葡属几内亚 (GMT -1)'), "-7200" => _t('大西洋中部时间 格陵兰 (GMT -2)'), "-10800" => _t('布宜诺斯艾利斯 乌拉圭,法属圭亚那 (GMT -3)'), "-14400" => _t('智利巴西 委内瑞拉,玻利维亚 (GMT -4)'), "-18000" => _t('纽约渥太华 古巴,哥伦比亚,牙买加 (GMT -5)'), "-21600" => _t('墨西哥城时间 洪都拉斯,危地马拉,哥斯达黎加 (GMT -6)'), "-25200" => _t('美国丹佛时间 (GMT -7)'), "-28800" => _t('美国旧金山时间 (GMT -8)'), "-32400" => _t('阿拉斯加时间 (GMT -9)'), "-36000" => _t('夏威夷群岛 (GMT -10)'), "-39600" => _t('东萨摩亚群岛 (GMT -11)'), "-43200" => _t('艾尼威托克岛 (GMT -12)'));
     $timezone = new Typecho_Widget_Helper_Form_Element_Select('timezone', $timezoneList, $this->options->timezone, _t('时区'));
     $form->addInput($timezone);
     /** 扩展名 */
     $attachmentTypesOptionsResult = NULL != trim($this->options->attachmentTypes) ? array_map('trim', explode(',', $this->options->attachmentTypes)) : array();
     $attachmentTypesOptionsValue = array();
     if (in_array('@image@', $attachmentTypesOptionsResult)) {
         $attachmentTypesOptionsValue[] = '@image@';
     }
     if (in_array('@media@', $attachmentTypesOptionsResult)) {
         $attachmentTypesOptionsValue[] = '@media@';
     }
     if (in_array('@doc@', $attachmentTypesOptionsResult)) {
         $attachmentTypesOptionsValue[] = '@doc@';
     }
     $attachmentTypesOther = array_diff($attachmentTypesOptionsResult, $attachmentTypesOptionsValue);
     $attachmentTypesOtherValue = '';
     if (!empty($attachmentTypesOther)) {
         $attachmentTypesOptionsValue[] = '@other@';
         $attachmentTypesOtherValue = implode(',', $attachmentTypesOther);
     }
     $attachmentTypesOptions = array('@image@' => _t('图片文件') . ' <code>(gif jpg png tiff bmp)</code>', '@media@' => _t('多媒体文件') . ' <code>(mp3 wmv wma rmvb rm avi flv)</code>', '@doc@' => _t('常用档案文件') . ' <code>(txt doc docx xls xlsx ppt pptx zip rar pdf)</code>', '@other@' => _t('其他格式 %s', ' <input type="text" class="w-50 text-s mono" name="attachmentTypesOther" value="' . htmlspecialchars($attachmentTypesOtherValue) . '" />'));
     $attachmentTypes = new Typecho_Widget_Helper_Form_Element_Checkbox('attachmentTypes', $attachmentTypesOptions, $attachmentTypesOptionsValue, _t('允许上传的文件类型'), _t('用逗号 "," 将后缀名隔开, 例如: <code>cpp, h, mak</code>'));
     $form->addInput($attachmentTypes->multiMode());
     /** 提交按钮 */
     $submit = new Typecho_Widget_Helper_Form_Element_Submit('submit', NULL, _t('保存设置'));
     $submit->input->setAttribute('class', 'primary');
     $form->addItem($submit);
     return $form;
 }
开发者ID:menmenweiwei,项目名称:blog,代码行数:53,代码来源:General.php

示例8: form

 public static function form($action = NULL)
 {
     /** 构建表格 */
     $options = Typecho_Widget::widget('Widget_Options');
     $form = new Typecho_Widget_Helper_Form(Typecho_Common::url('/action/links-edit', $options->index), Typecho_Widget_Helper_Form::POST_METHOD);
     /** 链接名称 */
     $name = new Typecho_Widget_Helper_Form_Element_Text('name', NULL, NULL, _t('链接名称*'));
     $form->addInput($name);
     /** 链接地址 */
     $url = new Typecho_Widget_Helper_Form_Element_Text('url', NULL, "http://", _t('链接地址*'));
     $form->addInput($url);
     /** 链接分类 */
     $sort = new Typecho_Widget_Helper_Form_Element_Text('sort', NULL, NULL, _t('链接分类'), _t('建议以英文字母开头,只包含字母与数字'));
     $form->addInput($sort);
     /** 链接图片 */
     $image = new Typecho_Widget_Helper_Form_Element_Text('image', NULL, NULL, _t('链接图片'), _t('需要以http://开头,留空表示没有链接图片'));
     $form->addInput($image);
     /** 链接描述 */
     $description = new Typecho_Widget_Helper_Form_Element_Textarea('description', NULL, NULL, _t('链接描述'));
     $form->addInput($description);
     /** 自定义数据 */
     $user = new Typecho_Widget_Helper_Form_Element_Text('user', NULL, NULL, _t('自定义数据'), _t('该项用于用户自定义数据扩展'));
     $form->addInput($user);
     /** 链接动作 */
     $do = new Typecho_Widget_Helper_Form_Element_Hidden('do');
     $form->addInput($do);
     /** 链接主键 */
     $lid = new Typecho_Widget_Helper_Form_Element_Hidden('lid');
     $form->addInput($lid);
     /** 提交按钮 */
     $submit = new Typecho_Widget_Helper_Form_Element_Submit();
     $form->addItem($submit);
     $request = Typecho_Request::getInstance();
     if (isset($request->lid) && 'insert' != $action) {
         /** 更新模式 */
         $db = Typecho_Db::get();
         $prefix = $db->getPrefix();
         $link = $db->fetchRow($db->select()->from($prefix . 'links')->where('lid = ?', $request->lid));
         if (!$link) {
             throw new Typecho_Widget_Exception(_t('链接不存在'), 404);
         }
         $name->value($link['name']);
         $url->value($link['url']);
         $sort->value($link['sort']);
         $image->value($link['image']);
         $description->value($link['description']);
         $user->value($link['user']);
         $do->value('update');
         $lid->value($link['lid']);
         $submit->value(_t('编辑链接'));
         $_action = 'update';
     } else {
         $do->value('insert');
         $submit->value(_t('增加链接'));
         $_action = 'insert';
     }
     if (empty($action)) {
         $action = $_action;
     }
     /** 给表单增加规则 */
     if ('insert' == $action || 'update' == $action) {
         $name->addRule('required', _t('必须填写链接名称'));
         $url->addRule('required', _t('必须填写链接地址'));
         $url->addRule('url', _t('不是一个合法的链接地址'));
         $image->addRule('url', _t('不是一个合法的图片地址'));
     }
     if ('update' == $action) {
         $lid->addRule('required', _t('链接主键不存在'));
         $lid->addRule(array(new Links_Plugin(), 'LinkExists'), _t('链接不存在'));
     }
     return $form;
 }
开发者ID:kirileec,项目名称:usr,代码行数:72,代码来源:Plugin.php

示例9: form

 /**
  * 生成表单
  *
  * @access public
  * @param string $action 表单动作
  * @return Typecho_Widget_Helper_Form
  */
 public function form($action = NULL)
 {
     /** 构建表格 */
     $form = new Typecho_Widget_Helper_Form($this->security->getIndex('/action/metas-tag-edit'), Typecho_Widget_Helper_Form::POST_METHOD);
     /** 标签名称 */
     $name = new Typecho_Widget_Helper_Form_Element_Text('name', NULL, NULL, _t('标签名称 *'), _t('这是标签在站点中显示的名称.可以使用中文,如 "地球".'));
     $form->addInput($name);
     /** 标签缩略名 */
     $slug = new Typecho_Widget_Helper_Form_Element_Text('slug', NULL, NULL, _t('标签缩略名'), _t('标签缩略名用于创建友好的链接形式, 如果留空则默认使用标签名称.'));
     $form->addInput($slug);
     // modified_by_jiangmuzi 2015.09.25
     /** 父级分类 */
     $options = array(0 => _t('不选择'));
     $parents = $this->widget('Widget_Metas_Category_List@options', isset($this->request->mid) ? 'ignore=' . $this->request->mid : '');
     while ($parents->next()) {
         $options[$parents->mid] = str_repeat('&nbsp;&nbsp;&nbsp;&nbsp;', $parents->levels) . $parents->name;
     }
     $parent = new Typecho_Widget_Helper_Form_Element_Select('parent', $options, $this->request->parent, _t('父级分类'), _t('此标签将归档在您选择的父级分类下.'));
     $form->addInput($parent);
     /** 标签描述 */
     $description = new Typecho_Widget_Helper_Form_Element_Textarea('description', NULL, NULL, _t('标签描述'), _t('此文字用于描述标签, 在有的主题中它会被显示.'));
     $form->addInput($description);
     // end modified
     /** 标签动作 */
     $do = new Typecho_Widget_Helper_Form_Element_Hidden('do');
     $form->addInput($do);
     /** 标签主键 */
     $mid = new Typecho_Widget_Helper_Form_Element_Hidden('mid');
     $form->addInput($mid);
     /** 提交按钮 */
     $submit = new Typecho_Widget_Helper_Form_Element_Submit();
     $submit->input->setAttribute('class', 'btn primary');
     $form->addItem($submit);
     if (isset($this->request->mid) && 'insert' != $action) {
         /** 更新模式 */
         $meta = $this->db->fetchRow($this->select()->where('mid = ?', $this->request->mid)->where('type = ?', 'tag')->limit(1));
         if (!$meta) {
             $this->response->redirect(Typecho_Common::url('manage-tags.php', $this->options->adminUrl));
         }
         $name->value($meta['name']);
         $slug->value($meta['slug']);
         $do->value('update');
         $mid->value($meta['mid']);
         $submit->value(_t('编辑标签'));
         $_action = 'update';
     } else {
         $do->value('insert');
         $submit->value(_t('增加标签'));
         $_action = 'insert';
     }
     if (empty($action)) {
         $action = $_action;
     }
     /** 给表单增加规则 */
     if ('insert' == $action || 'update' == $action) {
         $name->addRule('required', _t('必须填写标签名称'));
         $name->addRule(array($this, 'nameExists'), _t('标签名称已经存在'));
         $name->addRule(array($this, 'nameToSlug'), _t('标签名称无法被转换为缩略名'));
         $name->addRule('xssCheck', _t('请不要标签名称中使用特殊字符'));
         $slug->addRule(array($this, 'slugExists'), _t('缩略名已经存在'));
         $slug->addRule('xssCheck', _t('请不要在缩略名中使用特殊字符'));
     }
     if ('update' == $action) {
         $mid->addRule('required', _t('标签主键不存在'));
         $mid->addRule(array($this, 'tagExists'), _t('标签不存在'));
     }
     return $form;
 }
开发者ID:Jsechoo,项目名称:sisome,代码行数:75,代码来源:Edit.php

示例10: passwordForm

 /**
  * 生成表单
  *
  * @access public
  * @return Typecho_Widget_Helper_Form
  */
 public function passwordForm()
 {
     /** 构建表格 */
     $form = new Typecho_Widget_Helper_Form(Typecho_Common::url('/action/users-profile', $this->options->index), Typecho_Widget_Helper_Form::POST_METHOD);
     /** 用户密码 */
     $password = new Typecho_Widget_Helper_Form_Element_Password('password', NULL, NULL, _t('用户密码'), _t('为此用户分配一个密码.<br />
     建议使用特殊字符与字母的混编样式,以增加系统安全性.'));
     $form->addInput($password);
     /** 用户密码确认 */
     $confirm = new Typecho_Widget_Helper_Form_Element_Password('confirm', NULL, NULL, _t('用户密码确认'), _t('请确认你的密码, 与上面输入的密码保持一致.'));
     $form->addInput($confirm);
     /** 用户动作 */
     $do = new Typecho_Widget_Helper_Form_Element_Hidden('do', NULL, 'password');
     $form->addInput($do);
     /** 提交按钮 */
     $submit = new Typecho_Widget_Helper_Form_Element_Submit('submit', NULL, _t('更新密码'));
     $form->addItem($submit);
     $password->addRule('required', _t('必须填写密码'));
     $password->addRule('minLength', _t('为了保证账户安全, 请输入至少六位的密码'), 6);
     $confirm->addRule('confirm', _t('两次输入的密码不一致'), 'password');
     return $form;
 }
开发者ID:raindali,项目名称:express,代码行数:28,代码来源:Profile.php

示例11: form

    /**
     * 输出表单结构
     *
     * @access public
     * @return Typecho_Widget_Helper_Form
     */
    public function form()
    {
        /** 构建表格 */
        $form = new Typecho_Widget_Helper_Form($this->security->getIndex('/action/options-reading'), Typecho_Widget_Helper_Form::POST_METHOD);
        /** 文章日期格式 */
        $postDateFormat = new Typecho_Widget_Helper_Form_Element_Text('postDateFormat', NULL, $this->options->postDateFormat, _t('文章日期格式'), _t('此格式用于指定显示在文章归档中的日期默认显示格式.') . '<br />' . _t('在某些主题中这个格式可能不会生效, 因为主题作者可以自定义日期格式.') . '<br />' . _t('请参考 <a href="http://www.php.net/manual/zh/function.date.php">PHP 日期格式写法</a>.'));
        $postDateFormat->input->setAttribute('class', 'w-40 mono');
        $form->addInput($postDateFormat->addRule('xssCheck', _t('请不要在日期格式中使用特殊字符')));
        //首页显示
        $frontPageParts = explode(':', $this->options->frontPage);
        $frontPageType = $frontPageParts[0];
        $frontPageValue = count($frontPageParts) > 1 ? $frontPageParts[1] : '';
        $frontPageOptions = array('recent' => _t('显示最新发布的文章'));
        $frontPattern = '</label></span><span class="multiline front-archive%class%">' . '<input type="checkbox" id="frontArchive" name="frontArchive" value="1"' . ($this->options->frontArchive && 'recent' != $frontPageType ? ' checked' : '') . ' />
<label for="frontArchive">' . _t('同时将文章列表页路径更改为 %s', '<input type="text" name="archivePattern" class="w-20 mono" value="' . htmlspecialchars($this->decodeRule($this->options->routingTable['archive']['url'])) . '" />') . '</label>';
        // 页面列表
        $pages = $this->db->fetchAll($this->db->select('cid', 'title')->from('table.contents')->where('type = ?', 'page')->where('status = ?', 'publish')->where('created < ?', $this->options->gmtTime));
        if (!empty($pages)) {
            $pagesSelect = '<select name="frontPagePage" id="frontPage-frontPagePage">';
            foreach ($pages as $page) {
                $selected = '';
                if ('page' == $frontPageType && $page['cid'] == $frontPageValue) {
                    $selected = ' selected="true"';
                }
                $pagesSelect .= '<option value="' . $page['cid'] . '"' . $selected . '>' . $page['title'] . '</option>';
            }
            $pagesSelect .= '</select>';
            $frontPageOptions['page'] = _t('使用 %s 页面作为首页', '</label>' . $pagesSelect . '<label for="frontPage-frontPagePage">');
            $selectedFrontPageType = 'page';
        }
        // 自定义文件列表
        $files = glob($this->options->themeFile($this->options->theme, '*.php'));
        $filesSelect = '';
        foreach ($files as $file) {
            $info = Typecho_Plugin::parseInfo($file);
            $file = basename($file);
            if ('index.php' != $file && 'index' == $info['title']) {
                $selected = '';
                if ('file' == $frontPageType && $file == $frontPageValue) {
                    $selected = ' selected="true"';
                }
                $filesSelect .= '<option value="' . $file . '"' . $selected . '>' . $file . '</option>';
            }
        }
        if (!empty($filesSelect)) {
            $frontPageOptions['file'] = _t('直接调用 %s 模板文件', '</label><select name="frontPageFile" id="frontPage-frontPageFile">' . $filesSelect . '</select><label for="frontPage-frontPageFile">');
            $selectedFrontPageType = 'file';
        }
        if (isset($frontPageOptions[$frontPageType]) && 'recent' != $frontPageType && isset($selectedFrontPageType)) {
            $selectedFrontPageType = $frontPageType;
            $frontPattern = str_replace('%class%', '', $frontPattern);
        }
        if (isset($selectedFrontPageType)) {
            $frontPattern = str_replace('%class%', ' hidden', $frontPattern);
            $frontPageOptions[$selectedFrontPageType] .= $frontPattern;
        }
        $frontPage = new Typecho_Widget_Helper_Form_Element_Radio('frontPage', $frontPageOptions, $frontPageType, _t('站点首页'));
        $form->addInput($frontPage->multiMode());
        /** 文章列表数目 */
        $postsListSize = new Typecho_Widget_Helper_Form_Element_Text('postsListSize', NULL, $this->options->postsListSize, _t('文章列表数目'), _t('此数目用于指定显示在侧边栏中的文章列表数目.'));
        $postsListSize->input->setAttribute('class', 'w-20');
        $form->addInput($postsListSize->addRule('isInteger', _t('请填入一个数字')));
        /** 每页文章数目 */
        $pageSize = new Typecho_Widget_Helper_Form_Element_Text('pageSize', NULL, $this->options->pageSize, _t('每页文章数目'), _t('此数目用于指定文章归档输出时每页显示的文章数目.'));
        $pageSize->input->setAttribute('class', 'w-20');
        $form->addInput($pageSize->addRule('isInteger', _t('请填入一个数字')));
        /** FEED全文输出 */
        $feedFullText = new Typecho_Widget_Helper_Form_Element_Radio('feedFullText', array('0' => _t('仅输出摘要'), '1' => _t('全文输出')), $this->options->feedFullText, _t('聚合全文输出'), _t('如果你不希望在聚合中输出文章全文,请使用仅输出摘要选项.') . '<br />' . _t('摘要的文字取决于你在文章中使用分隔符的位置.'));
        $form->addInput($feedFullText);
        /** 提交按钮 */
        $submit = new Typecho_Widget_Helper_Form_Element_Submit('submit', NULL, _t('保存设置'));
        $submit->input->setAttribute('class', 'btn primary');
        $form->addItem($submit);
        return $form;
    }
开发者ID:r0ker,项目名称:hctf2015-all-problems,代码行数:81,代码来源:Reading.php

示例12: passwordForm

 /**
  * 生成表单
  *
  * @access public
  * @return Typecho_Widget_Helper_Form
  */
 public function passwordForm()
 {
     /** 构建表格 */
     $form = new Typecho_Widget_Helper_Form($this->security->getIndex('/action/users-profile'), Typecho_Widget_Helper_Form::POST_METHOD);
     /** 用户密码 */
     $password = new Typecho_Widget_Helper_Form_Element_Password('password', NULL, NULL, _t('用户密码'), _t('为此用户分配一个密码.') . '<br />' . _t('建议使用特殊字符与字母、数字的混编样式,以增加系统安全性.'));
     $password->input->setAttribute('class', 'w-60');
     $form->addInput($password);
     /** 用户密码确认 */
     $confirm = new Typecho_Widget_Helper_Form_Element_Password('confirm', NULL, NULL, _t('用户密码确认'), _t('请确认你的密码, 与上面输入的密码保持一致.'));
     $confirm->input->setAttribute('class', 'w-60');
     $form->addInput($confirm);
     /** 用户动作 */
     $do = new Typecho_Widget_Helper_Form_Element_Hidden('do', NULL, 'password');
     $form->addInput($do);
     /** 提交按钮 */
     $submit = new Typecho_Widget_Helper_Form_Element_Submit('submit', NULL, _t('更新密码'));
     $submit->input->setAttribute('class', 'btn primary');
     $form->addItem($submit);
     $password->addRule('required', _t('必须填写密码'));
     $password->addRule('minLength', _t('为了保证账户安全, 请输入至少六位的密码'), 6);
     $confirm->addRule('confirm', _t('两次输入的密码不一致'), 'password');
     return $form;
 }
开发者ID:dccecc,项目名称:typecho,代码行数:30,代码来源:Profile.php

示例13: resetForm

 /**
  * 生成重置密码表单
  *
  * @access public
  * @return Typecho_Widget_Helper_Form
  */
 public function resetForm()
 {
     $form = new Typecho_Widget_Helper_Form(NULL, Typecho_Widget_Helper_Form::POST_METHOD);
     /** 新密码 */
     $password = new Typecho_Widget_Helper_Form_Element_Password('password', NULL, NULL, _t('新密码'), _t('建议使用特殊字符与字母、数字的混编样式,以增加系统安全性.'));
     $password->input->setAttribute('class', 'w-100');
     $form->addInput($password);
     /** 新密码确认 */
     $confirm = new Typecho_Widget_Helper_Form_Element_Password('confirm', NULL, NULL, _t('密码确认'), _t('请确认你的密码, 与上面输入的密码保持一致.'));
     $confirm->input->setAttribute('class', 'w-100');
     $form->addInput($confirm);
     /** 用户动作 */
     $do = new Typecho_Widget_Helper_Form_Element_Hidden('do', NULL, 'password');
     $form->addInput($do);
     /** 提交按钮 */
     $submit = new Typecho_Widget_Helper_Form_Element_Submit('submit', NULL, _t('更新密码'));
     $submit->input->setAttribute('class', 'btn primary');
     $form->addItem($submit);
     $password->addRule('required', _t('必须填写密码'));
     $password->addRule('minLength', _t('为了保证账户安全, 请输入至少六位的密码'), 6);
     $confirm->addRule('confirm', _t('两次输入的密码不一致'), 'password');
     return $form;
 }
开发者ID:TPlugin,项目名称:Passport,代码行数:29,代码来源:Widget.php

示例14: array

        }
    }
    $submit = new Typecho_Widget_Helper_Form_Element_Submit(NULL, NULL, _t('保存设置'));
    $submit->input->setAttribute('class', 'btn primary');
    $form->addItem($submit);
    $form->render();
} else {
    $form = new Typecho_Widget_Helper_Form(Helper::url('ThemeShow/config.php'), Typecho_Widget_Helper_Form::POST_METHOD);
    Typecho_Widget::widget('Widget_Themes_List')->to($themes);
    $availableThemes = array();
    while ($themes->next()) {
        $availableThemes[$themes->name] = $themes->title;
    }
    $themeSel = new Typecho_Widget_Helper_Form_Element_Select('theme', $availableThemes, $options->theme, '主题名称');
    $form->addInput($themeSel);
    $submit = new Typecho_Widget_Helper_Form_Element_Submit(NULL, NULL, _t('配置此主题'));
    $submit->input->setAttribute('class', 'btn primary');
    $form->addItem($submit);
    $form->render();
}
?>
            </div>
        </div>
    </div>
</div>

<?php 
include 'copyright.php';
include 'common-js.php';
include 'form-js.php';
include 'footer.php';
开发者ID:nbdarling,项目名称:typechoi7-master,代码行数:31,代码来源:config.php

示例15: form

 /**
  * 输出表单结构
  *
  * @access public
  * @return Typecho_Widget_Helper_Form
  */
 public function form()
 {
     /** 构建表格 */
     $form = new Typecho_Widget_Helper_Form($this->security->getRootUrl('index.php/action/options-permalink'), Typecho_Widget_Helper_Form::POST_METHOD);
     if (!defined('__TYPECHO_REWRITE__')) {
         /** 是否使用地址重写功能 */
         $rewrite = new Typecho_Widget_Helper_Form_Element_Radio('rewrite', array('0' => _t('不启用'), '1' => _t('启用')), $this->options->rewrite, _t('是否使用地址重写功能'), _t('地址重写即 rewrite 功能是某些服务器软件提供的优化内部连接的功能.') . '<br />' . _t('打开此功能可以让你的链接看上去完全是静态地址.'));
         // disable rewrite check when rewrite opened
         if (!$this->options->rewrite && !$this->request->is('enableRewriteAnyway=1')) {
             $errorStr = _t('重写功能检测失败, 请检查你的服务器设置');
             /** 如果是apache服务器, 可能存在无法写入.htaccess文件的现象 */
             if ((isset($_SERVER['SERVER_SOFTWARE']) && false !== strpos(strtolower($_SERVER['SERVER_SOFTWARE']), 'apache') || function_exists('apache_get_version')) && !file_exists(__TYPECHO_ROOT_DIR__ . '/.htaccess') && !is_writeable(__TYPECHO_ROOT_DIR__)) {
                 $errorStr .= '<br /><strong>' . _t('我们检测到你使用了apache服务器, 但是程序无法在根目录创建.htaccess文件, 这可能是产生这个错误的原因.') . _t('请调整你的目录权限, 或者手动创建一个.htaccess文件.') . '</strong>';
             }
             $errorStr .= '<br /><input type="checkbox" name="enableRewriteAnyway" id="enableRewriteAnyway" value="1" />' . ' <label for="enableRewriteAnyway">' . _t('如果你仍然想启用此功能, 请勾选这里') . '</label>';
             $rewrite->addRule(array($this, 'checkRewrite'), $errorStr);
         }
         $form->addInput($rewrite);
     }
     $patterns = array('/archives/[cid:digital]/' => _t('默认风格') . ' <code>/archives/{cid}/</code>', '/archives/[slug].html' => _t('wordpress风格') . ' <code>/archives/{slug}.html</code>', '/[year:digital:4]/[month:digital:2]/[day:digital:2]/[slug].html' => _t('按日期归档') . ' <code>/archives/{year}/{month}/{day}/{slug}.html</code>', '/[category]/[slug].html' => _t('按分类归档') . ' <code>/{category}/{slug}.html</code>');
     /** 自定义文章路径 */
     $postPatternValue = $this->options->routingTable['post']['url'];
     /** 增加个性化路径 */
     $customPatternValue = NULL;
     if (isset($this->request->__typecho_form_item_postPattern)) {
         $customPatternValue = $this->request->__typecho_form_item_postPattern;
         Typecho_Cookie::delete('__typecho_form_item_postPattern');
     } else {
         if (!isset($patterns[$postPatternValue])) {
             $customPatternValue = $this->decodeRule($postPatternValue);
         }
     }
     $patterns['custom'] = _t('个性化定义') . ' <input type="text" class="w-50 text-s mono" name="customPattern" value="' . $customPatternValue . '" />';
     $postPattern = new Typecho_Widget_Helper_Form_Element_Radio('postPattern', $patterns, $postPatternValue, _t('自定义文章路径'), _t('可用参数: <code>{cid}</code> 日志 ID, <code>{slug}</code> 日志缩略名, <code>{category}</code> 分类, <code>{directory}</code> 多级分类, <code>{year}</code> 年, <code>{month}</code> 月, <code>{day}</code> 日') . '<br />' . _t('选择一种合适的文章静态路径风格, 使得你的网站链接更加友好.') . '<br />' . _t('一旦你选择了某种链接风格请不要轻易修改它.'));
     if ($customPatternValue) {
         $postPattern->value('custom');
     }
     $form->addInput($postPattern->multiMode());
     /** 独立页面后缀名 */
     $pagePattern = new Typecho_Widget_Helper_Form_Element_Text('pagePattern', NULL, $this->decodeRule($this->options->routingTable['page']['url']), _t('独立页面路径'), _t('可用参数: <code>{cid}</code> 页面 ID, <code>{slug}</code> 页面缩略名') . '<br />' . _t('请在路径中至少包含上述的一项参数.'));
     $pagePattern->input->setAttribute('class', 'mono w-60');
     $form->addInput($pagePattern->addRule(array($this, 'checkPagePattern'), _t('独立页面路径中没有包含 {cid} 或者 {slug} ')));
     /** 分类页面 */
     $categoryPattern = new Typecho_Widget_Helper_Form_Element_Text('categoryPattern', NULL, $this->decodeRule($this->options->routingTable['category']['url']), _t('分类路径'), _t('可用参数: <code>{mid}</code> 分类 ID, <code>{slug}</code> 分类缩略名, <code>{directory}</code> 多级分类') . '<br />' . _t('请在路径中至少包含上述的一项参数.'));
     $categoryPattern->input->setAttribute('class', 'mono w-60');
     $form->addInput($categoryPattern->addRule(array($this, 'checkCategoryPattern'), _t('分类路径中没有包含 {mid} 或者 {slug} ')));
     /** 提交按钮 */
     $submit = new Typecho_Widget_Helper_Form_Element_Submit('submit', NULL, _t('保存设置'));
     $submit->input->setAttribute('class', 'btn primary');
     $form->addItem($submit);
     return $form;
 }
开发者ID:hongweipeng,项目名称:typecho,代码行数:58,代码来源:Permalink.php


注:本文中的Typecho_Widget_Helper_Form::addItem方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。