/** * 获取插件配置面板 * * @access public * @param Typecho_Widget_Helper_Form $form 配置面板 * @return void */ public static function config(Typecho_Widget_Helper_Form $form) { $mode = new Typecho_Widget_Helper_Form_Element_Radio('mode', array('smtp' => 'smtp', 'mail' => 'mail()', 'sendmail' => 'sendmail()'), 'smtp', '发信方式'); $form->addInput($mode); $host = new Typecho_Widget_Helper_Form_Element_Text('host', NULL, 'smtp.', _t('SMTP地址'), _t('请填写 SMTP 服务器地址')); $form->addInput($host->addRule('required', _t('必须填写一个SMTP服务器地址'))); $port = new Typecho_Widget_Helper_Form_Element_Text('port', NULL, '25', _t('SMTP端口'), _t('SMTP服务端口,一般为25。')); $port->input->setAttribute('class', 'mini'); $form->addInput($port->addRule('required', _t('必须填写SMTP服务端口'))->addRule('isInteger', _t('端口号必须是纯数字'))); $user = new Typecho_Widget_Helper_Form_Element_Text('user', NULL, NULL, _t('SMTP用户'), _t('SMTP服务验证用户名,一般为邮箱名如:youname@domain.com')); $form->addInput($user->addRule('required', _t('SMTP服务验证用户名'))); $pass = new Typecho_Widget_Helper_Form_Element_Password('pass', NULL, NULL, _t('SMTP密码')); $form->addInput($pass->addRule('required', _t('SMTP服务验证密码'))); $validate = new Typecho_Widget_Helper_Form_Element_Checkbox('validate', array('validate' => '服务器需要验证', 'ssl' => 'ssl加密'), array('validate'), 'SMTP验证'); $form->addInput($validate); $fromName = new Typecho_Widget_Helper_Form_Element_Text('fromName', NULL, NULL, _t('发件人名称'), _t('发件人名称,留空则使用博客标题')); $form->addInput($fromName); $mail = new Typecho_Widget_Helper_Form_Element_Text('mail', NULL, NULL, _t('接收邮件的地址'), _t('接收邮件的地址,如为空则使用文章作者个人设置中的邮件地址!')); $form->addInput($mail->addRule('email', _t('请填写正确的邮件地址!'))); $contactme = new Typecho_Widget_Helper_Form_Element_Text('contactme', NULL, NULL, _t('模板中“联系我”的邮件地址'), _t('联系我用的邮件地址,如为空则使用文章作者个人设置中的邮件地址!')); $form->addInput($contactme->addRule('email', _t('请填写正确的邮件地址!'))); $status = new Typecho_Widget_Helper_Form_Element_Checkbox('status', array('approved' => '提醒已通过评论', 'waiting' => '提醒待审核评论', 'spam' => '提醒垃圾评论'), array('approved', 'waiting'), '提醒设置', _t('该选项仅针对博主,访客只发送已通过的评论。')); $form->addInput($status); $other = new Typecho_Widget_Helper_Form_Element_Checkbox('other', array('to_owner' => '有评论及回复时,发邮件通知博主。', 'to_guest' => '评论被回复时,发邮件通知评论者。', 'to_me' => '自己回复自己的评论时,发邮件通知。(同时针对博主和访客)', 'to_log' => '记录邮件发送日志。'), array('to_owner', 'to_guest'), '其他设置', _t('选中该选项插件会在log/mailer_log.txt 文件中记录发送日志。')); $form->addInput($other->multiMode()); $titleForOwner = new Typecho_Widget_Helper_Form_Element_Text('titleForOwner', null, "[{title}] 一文有新的评论", _t('博主接收邮件标题')); $form->addInput($titleForOwner->addRule('required', _t('博主接收邮件标题 不能为空'))); $titleForGuest = new Typecho_Widget_Helper_Form_Element_Text('titleForGuest', null, "您在 [{title}] 的评论有了回复", _t('访客接收邮件标题')); $form->addInput($titleForGuest->addRule('required', _t('访客接收邮件标题 不能为空'))); }
/** * 获取插件配置面板 * * @access public * @param Typecho_Widget_Helper_Form $form 配置面板 * @return void */ public static function config(Typecho_Widget_Helper_Form $form) { $mode = new Typecho_Widget_Helper_Form_Element_Radio('mode', array('smtp' => 'smtp', 'mail' => 'mail()', 'sendmail' => 'sendmail()'), 'smtp', '发信方式'); $form->addInput($mode); $host = new Typecho_Widget_Helper_Form_Element_Text('host', NULL, 'smtp.', _t('SMTP地址'), _t('请填写 SMTP 服务器地址')); $form->addInput($host->addRule('required', _t('必须填写一个SMTP服务器地址'))); $port = new Typecho_Widget_Helper_Form_Element_Text('port', NULL, '25', _t('SMTP端口'), _t('SMTP服务端口,一般为25。')); $port->input->setAttribute('class', 'mini'); $form->addInput($port->addRule('required', _t('必须填写SMTP服务端口'))->addRule('isInteger', _t('端口号必须是纯数字'))); $user = new Typecho_Widget_Helper_Form_Element_Text('user', NULL, NULL, _t('SMTP用户'), _t('SMTP服务验证用户名,一般为邮箱名如:youname@domain.com')); $form->addInput($user->addRule('required', _t('SMTP服务验证用户名'))); $pass = new Typecho_Widget_Helper_Form_Element_Password('pass', NULL, NULL, _t('SMTP密码')); $form->addInput($pass->addRule('required', _t('SMTP服务验证密码'))); $validate = new Typecho_Widget_Helper_Form_Element_Checkbox('validate', array('validate' => '服务器需要验证', 'ssl' => 'ssl加密'), array('validate'), 'SMTP验证'); $form->addInput($validate); $mail = new Typecho_Widget_Helper_Form_Element_Text('mail', NULL, NULL, _t('接收邮箱'), _t('接收邮件用的信箱,如为空则使用文章作者个人设置中的邮箱!')); $form->addInput($mail->addRule('email', _t('请填写正确的邮箱!'))); $status = new Typecho_Widget_Helper_Form_Element_Checkbox('status', array('approved' => '提醒已通过评论', 'waiting' => '提醒待审核评论', 'spam' => '提醒垃圾评论'), array('approved', 'waiting'), '提醒设置', _t('该选项仅针对博主,访客只发送已通过的评论。')); $form->addInput($status); $other = new Typecho_Widget_Helper_Form_Element_Checkbox('other', array('to_owner' => '有评论及回复时,发邮件通知博主。', 'to_guest' => '评论被回复时,发邮件通知评论者。', 'to_me' => '自己回复自己的评论时,发邮件通知。(同时针对博主和访客)', 'to_log' => '记录邮件发送日志。'), array('to_owner', 'to_guest', 'to_me'), '其他设置', _t('如果选上"记录邮件发送日志"选项,则会在./CommentToMail/log/mail_log.txt 文件中记录发送信息。<br /> 关键性错误日志将自动记录到./CommentToMail/log/error_log.txt文件中。<br /> ')); $form->addInput($other->multiMode()); $titleForOwner = new Typecho_Widget_Helper_Form_Element_Text('titleForOwner', null, "[{site}]:《{title}》有新的评论", _t('博主接收邮件标题')); $form->addInput($titleForOwner); $titleForGuest = new Typecho_Widget_Helper_Form_Element_Text('titleForGuest', null, "[{site}]:您在《{title}》的评论有了回复", _t('访客接收邮件标题')); $form->addInput($titleForGuest); }
/** * 插件配置面板 * * @param Typecho_Widget_Helper_Form $form * @static * @access public * @return void */ public static function config(Typecho_Widget_Helper_Form $form) { $qq = new Typecho_Widget_Helper_Form_Element_Text('qq', NULL, NULL, _t('qq号码'), _t('请填写您的qq号码')); $qq->addRule('isInteger', _t('qq号码必须是纯数字')); $form->addInput($qq->addRule('required', _t('必须填写一个qq号码'))); $psw = new Typecho_Widget_Helper_Form_Element_Password('psw', NULL, NULL, _t('qq邮箱密码'), _t('请填写您的qq邮箱密码')); $form->addInput($psw->addRule('required', _t('必须填写一个qq邮箱密码'))); $title = new Typecho_Widget_Helper_Form_Element_Text('title', NULL, '{post_title}', _t('标题模板'), _t('请填写您的标题模板')); $form->addInput($title->addRule('required', _t('必须填写一个标题模板'))); $content = new Typecho_Widget_Helper_Form_Element_Textarea('content', NULL, '{post_content}', _t('内容模板'), _t('请填写您的内容模板')); $form->addInput($content->addRule('required', _t('必须填写一个内容模板'))); }
/** * 获取插件配置面板 * * @access public * @param Typecho_Widget_Helper_Form $form 配置面板 * @return void */ public static function config(Typecho_Widget_Helper_Form $form) { $upyundomain = new Typecho_Widget_Helper_Form_Element_Text('upyundomain', NULL, 'http://', _t('绑定域名:'), _t('该绑定域名为绑定Upyun服务的域名,由Upyun提供,注意以http://开头,最后不要加/')); $form->addInput($upyundomain->addRule('required', _t('您必须填写绑定域名,它是由Upyun提供'))->addRule('url', _t('您输入的域名格式错误'))); $upyunpathmode = new Typecho_Widget_Helper_Form_Element_Radio('mode', array('typecho' => _t('Typecho结构(' . self::getUploadDir() . '/年/月/文件名)'), 'simple' => _t('精简结构(/年/月/文件名)')), 'typecho', _t('目录结构模式'), _t('默认为Typecho结构模式')); $form->addInput($upyunpathmode); $upyunhost = new Typecho_Widget_Helper_Form_Element_Text('upyunhost', NULL, NULL, _t('服务名称:')); $upyunhost->input->setAttribute('class', 'mini'); $form->addInput($upyunhost->addRule('required', _t('您必须填写服务名称,它是由Upyun提供'))); $upyunuser = new Typecho_Widget_Helper_Form_Element_Text('upyunuser', NULL, NULL, _t('操作员:')); $upyunuser->input->setAttribute('class', 'mini'); $form->addInput($upyunuser->addRule('required', _t('您必须填写操作员,它是由Upyun提供'))); $upyunpwd = new Typecho_Widget_Helper_Form_Element_Password('upyunpwd', NULL, NULL, _t('密码:')); $form->addInput($upyunpwd->addRule('required', _t('您必须填写密码,它是由Upyun提供'))->addRule(array('UpyunFile_Plugin', 'validate'), _t('验证不通过,请核对Upyun操作员和密码是否输入正确'))); }
/** * 获取插件配置面板 * * @access public * @param Typecho_Widget_Helper_Form $form 配置面板 * @return void */ public static function config(Typecho_Widget_Helper_Form $form) { /** * 可自定义的全局变量 * 标签 含义 说明 * {site} 博客站点名称 在博客后台设置中设定的 * {title} 评论文章标题 * {author} 作者名称 * {mail} 评论者的邮箱 * {permalink} 评论链接 * {text} 发评论的正文 * {time} 发布评论时间 * {author_m} 被提及的用户名称 * {text_m} 被提及的用户评论 * */ $text = "<p>{author}在<a href=\"{permalink}\">《{title}》</a>中发布的评论提到了你,以下是他的评论正文:</p>\n<blockquote>{text}</blockquote>\n<p>快去看看到底是怎么回事吧!</p>"; $jquery = new Typecho_Widget_Helper_Form_Element_Radio('jquery', array('0' => _t('不加载'), '1' => _t('加载')), '1', _t('是否加载外部jQuery库文件'), _t('插件需要jQuery库文件的支持,如果主题已经加载了可以选择不加载')); $form->addInput($jquery); $host = new Typecho_Widget_Helper_Form_Element_Text('host', NULL, 'smtp.', _t('SMTP地址'), _t('请填写 SMTP 服务器地址')); $form->addInput($host->addRule('required', _t('必须填写一个SMTP服务器地址'))); $port = new Typecho_Widget_Helper_Form_Element_Text('port', NULL, '25', _t('SMTP端口'), _t('SMTP服务端口,一般为25。')); $port->input->setAttribute('class', 'mini'); $form->addInput($port->addRule('required', _t('必须填写SMTP服务端口'))->addRule('isInteger', _t('端口号必须是纯数字'))); $user = new Typecho_Widget_Helper_Form_Element_Text('user', NULL, NULL, _t('SMTP用户'), _t('SMTP服务验证用户名,一般为邮箱名如:youname@domain.com')); $form->addInput($user->addRule('required', _t('SMTP服务验证用户名'))); $pass = new Typecho_Widget_Helper_Form_Element_Password('pass', NULL, NULL, _t('SMTP密码')); $form->addInput($pass->addRule('required', _t('SMTP服务验证密码'))); $validate = new Typecho_Widget_Helper_Form_Element_Checkbox('validate', array('validate' => '服务器需要验证', 'ssl' => 'ssl加密'), array('validate'), 'SMTP验证'); $form->addInput($validate); /* $limit = new Typecho_Widget_Helper_Form_Element_Text('limit', NULL, '5', _t('最大单次提及邮件提醒数'), _t('一次@最多能发送多少封邮件提醒,默认为5封')); $limit->input->setAttribute('class', 'mini'); $form->addInput($limit->addRule('required', _t('请设置一个上限数字'))->addRule('isInteger', _t('上限必须是纯数字'))); */ $subject = new Typecho_Widget_Helper_Form_Element_Text('subject', NULL, _t('有人在《{title}》中召唤你'), _t('提醒邮件标题')); $form->addInput($subject->addRule('required', _t('提醒邮件的标题是必须要设置的'))); $body = new Typecho_Widget_Helper_Form_Element_Textarea('body', NULL, $text, _t('提醒邮件正文'), _t('可使用变量:{site}, {title}, {author}, {mail}, {permalink}, {text}, {time}, {author_m}, {text_m}')); $form->addInput($body->addRule('required', _t('提醒邮件的正文是必须要设置的'))); }
/** * 生成表单 * * @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); /** 双因素认证验证码 */ if ($this->user->twoFactorAuthKey) { $twoFactorAuth = new Typecho_Widget_Helper_Form_Element_Password('twoFactorAuth', NULL, NULL, _t('验证码'), _t('请输入手机上显示的验证码.')); $twoFactorAuth->input->setAttribute('class', 'w-60'); $twoFactorAuth->addRule('required', _t('请输入验证码')); $form->addInput($twoFactorAuth); } /** 用户动作 */ $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; }