contentEx = array('HighSlide_Plugin','autohighslide'); Typecho_Plugin::factory('Widget_Abstract_Contents')->excerptEx = array('HighSlide_Plugin','autohighslide'); Typecho_Plugin::factory('Widget_Upload')->deleteHandle = array('HighSlide_Plugin','deleteHandle'); Typecho_Plugin::factory('Widget_Archive')->header = array('HighSlide_Plugin','headlink'); Typecho_Plugin::factory('Widget_Archive')->footer = array('HighSlide_Plugin','footlink'); Typecho_Plugin::factory('admin/write-post.php')->bottom = array('HighSlide_Plugin','attachpanel'); Typecho_Plugin::factory('admin/write-page.php')->bottom = array('HighSlide_Plugin','attachpanel'); return self::galleryinstall(); } /** * 禁用插件方法,如果禁用失败,直接抛出异常 * * @static * @access public * @return void * @throws Typecho_Plugin_Exception */ public static function deactivate() { Helper::removePanel(3,'HighSlide/manage-gallery.php'); Helper::removeAction('gallery-edit'); } /** * 获取插件配置面板 * * @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('highslide.packed.js'=>_t('基础版 (25.2K)仅支持插图弹窗'),'highslide-full.packed.js'=>_t('全功能版 (46.8K)支持html弹窗/插图幻灯/页面相册等')),'highslide.packed.js',_t('核心选择')); $form->addInput($mode); $rpopt = new Typecho_Widget_Helper_Form_Element_Checkbox('rpopt', array('link'=>_t('链接至图片'),'img'=>_t('所有图片')),NULL,_t('弹窗模式'),_t('默认将目标为图片的超链接(包括文字)转化为弹窗效果,也可以选择将所有图片直接转化为原图弹窗')); $rpopt->input->setAttribute('disabled','true'); $form->addInput($rpopt); $rplist = new Typecho_Widget_Helper_Form_Element_Checkbox('rplist', array('index'=>_t('首页'),'post'=>_t('文章'),'page'=>_t('独立页面'),'archive'=>_t('归档页面')),array('index','post','page'),_t('应用范围'),_t('取消勾选的页面类型将不会加载插件脚本与替换效果, 归档页包括按时间/标签等索引的列表型页面')); $form->addInput($rplist); $outline= new Typecho_Widget_Helper_Form_Element_Radio('outline', array(''=>_t('无边框'),'rounded-white'=>_t('圆角白'),'rounded-black'=>_t('圆角黑'),'glossy-dark'=>_t('亮泽黑'),'outer-glow'=>_t('外发光'),'beveled'=>_t('半透明')),'',_t('边框风格')); $form->addInput($outline); $cbutton = new Typecho_Widget_Helper_Form_Element_Radio('cbutton', array(1=>_t('显示'),0=>_t('不显示')),0,_t('关闭按钮')); $form->addInput($cbutton); $ltext = new Typecho_Widget_Helper_Form_Element_Text('ltext', NULL,'© '.$_SERVER['HTTP_HOST'].'',_t('角标文字')); $ltext->input->setAttribute('class','mini'); $form->addInput($ltext); $lpos = new Typecho_Widget_Helper_Form_Element_Select('lpos', array('top left'=>_t('左上'),'top center'=>_t('中上'),'top right'=>_t('右上'),'bottom left'=>_t('左下'),'bottom center'=>_t('中下'),'bottom right'=>_t('右下')),'top left',''); $lpos->input->setAttribute('style','position:absolute;bottom:16px;left:173px;'); $lpos->setAttribute('style','position:relative'); $form->addInput($lpos); $capt = new Typecho_Widget_Helper_Form_Element_Radio('capt', array(''=>_t('不显示'),'this.a.title'=>_t('显示链接title'),'this.thumb.alt'=>_t('显示图片alt')),'',_t('图片说明'),_t('例:%s图片说明写这%s或者写这显示%s',' <a href="http://xx.jpg" title="','"><img src="http://xxx.jpg" alt="','"/></a>')); $form->addInput($capt); $lang = new Typecho_Widget_Helper_Form_Element_Radio('lang', array('en'=>_t('英文'),'cn'=>_t('中文')),'en',_t('提示语言'),'
'._t('全功能版设置').' ———————————————————————————————————————
'); $form->addInput($lang); $fullalign = new Typecho_Widget_Helper_Form_Element_Radio('fullalign', array('default'=>_t('触发位置'),'center'=>_t('页面居中')),'default',_t('弹窗定位')); $form->addInput($fullalign); $fullopac = new Typecho_Widget_Helper_Form_Element_Text('fullopac', NULL,'0.65',_t('背景遮罩'),_t('从透明至纯黑, 可填写0至1间的小数')); $fullopac->input->setAttribute('class','mini'); $form->addInput($fullopac->addRule('isFloat',_t('请填写数字'))); $fullslide = new Typecho_Widget_Helper_Form_Element_Radio('fullslide', array(1=>_t('开启'),0=>_t('关闭')),1,_t('幻灯面板')); $form->addInput($fullslide); $fullnextimg = new Typecho_Widget_Helper_Form_Element_Radio('fullnextimg', array(1=>_t('是'),0=>_t('否')),0,_t('自动翻页'),_t('点击图片不关闭弹窗而是显示下一张')); $form->addInput($fullnextimg); $fullcpos = new Typecho_Widget_Helper_Form_Element_Radio('fullcpos', array(''=>_t('不显示'),'caption'=>_t('底部显示'),'heading'=>_t('顶部显示')),'',_t('图片序数')); $form->addInput($fullcpos); $fullwrap = new Typecho_Widget_Helper_Form_Element_Checkbox('fullwrap', array('draggable-header'=>_t('显示标题栏%s如: %s标题%s',' ','<hs title="','">'),'no-footer'=>_t('禁用拉伸')),NULL,_t('html弹窗')); $form->addInput($fullwrap); //输出面板效果 ?> addInput($gallery); $thumbfix = new Typecho_Widget_Helper_Form_Element_Hidden('thumbfix', array('fixedwidth','fixedheight','fixedratio'),'fixedwidth'); $form->addInput($thumbfix); $fixedwidth = new Typecho_Widget_Helper_Form_Element_Hidden('fixedwidth',NULL,'200'); $form->addInput($fixedwidth); $fixedheight = new Typecho_Widget_Helper_Form_Element_Hidden('fixedheight',NULL,'100'); $form->addInput($fixedheight); $fixedratio = new Typecho_Widget_Helper_Form_Element_Hidden('fixedratio',NULL,'4:3'); $form->addInput($fixedratio); $thumbapi = new Typecho_Widget_Helper_Form_Element_Hidden('thumbapi', array(0,1),0); $form->addInput($thumbapi); $storage = new Typecho_Widget_Helper_Form_Element_Hidden('storage', array('local','qiniu','scs','nos','cos'),'local'); $form->addInput($storage); $path = new Typecho_Widget_Helper_Form_Element_Hidden('path',NULL,'/usr/uploads/HSgallery/'); $form->addInput($path); $cloudtoo = new Typecho_Widget_Helper_Form_Element_Hidden('cloudtoo', array(0,1),0); $form->addInput($cloudtoo); $qiniubucket = new Typecho_Widget_Helper_Form_Element_Hidden('qiniubucket',NULL,''); $form->addInput($qiniubucket); $qiniudomain = new Typecho_Widget_Helper_Form_Element_Hidden('qiniudomain',NULL,'http://'); $form->addInput($qiniudomain); $qiniuak = new Typecho_Widget_Helper_Form_Element_Hidden('qiniuak',NULL,''); $form->addInput($qiniuak); $qiniusk = new Typecho_Widget_Helper_Form_Element_Hidden('qiniusk',NULL,''); $form->addInput($qiniusk); $scsbucket = new Typecho_Widget_Helper_Form_Element_Hidden('scsbucket',NULL,''); $form->addInput($scsbucket); $scsdomain = new Typecho_Widget_Helper_Form_Element_Hidden('scsdomain',NULL,'http://'); $form->addInput($scsdomain); $scsimgx = new Typecho_Widget_Helper_Form_Element_Hidden('scsimgx',NULL,'http://*.applinzi.com|*'); $form->addInput($scsimgx); $scsak = new Typecho_Widget_Helper_Form_Element_Hidden('scsak',NULL,''); $form->addInput($scsak); $scssk = new Typecho_Widget_Helper_Form_Element_Hidden('scssk',NULL,''); $form->addInput($scssk); $nosbucket = new Typecho_Widget_Helper_Form_Element_Hidden('nosbucket',NULL,''); $form->addInput($nosbucket); $nosdomain = new Typecho_Widget_Helper_Form_Element_Hidden('nosdomain',NULL,'http://'); $form->addInput($nosdomain); $nosak = new Typecho_Widget_Helper_Form_Element_Hidden('nosak',NULL,''); $form->addInput($nosak); $nosas = new Typecho_Widget_Helper_Form_Element_Hidden('nosas',NULL,''); $form->addInput($nosas); $nosep = new Typecho_Widget_Helper_Form_Element_Hidden('nosep', array('nos-eastchina1.126.net'),'nos-eastchina1.126.net'); $form->addInput($nosep); $cosbucket = new Typecho_Widget_Helper_Form_Element_Hidden('cosbucket',NULL,''); $form->addInput($cosbucket); $cosdomain = new Typecho_Widget_Helper_Form_Element_Hidden('cosdomain',NULL,'http://*.image.myqcloud.com'); $form->addInput($cosdomain); $cosai = new Typecho_Widget_Helper_Form_Element_Hidden('cosai',NULL,''); $form->addInput($cosai); $cossi = new Typecho_Widget_Helper_Form_Element_Hidden('cossi',NULL,''); $form->addInput($cossi); $cossk = new Typecho_Widget_Helper_Form_Element_Hidden('cossk',NULL,''); $form->addInput($cossk); $cosrg = new Typecho_Widget_Helper_Form_Element_Hidden('cosrg',array('sh','gz','cd','tj','bj','sgp','hk','ca','ger'),'sh'); $form->addInput($cosrg); } /** * 个人用户的配置面板 * * @access public * @param Typecho_Widget_Helper_Form $form * @return void */ public static function personalConfig(Typecho_Widget_Helper_Form $form){} /** * 初始化数据表 * * @access public * @return string * @throws Typecho_Plugin_Exception */ public static function galleryinstall() { $installdb = Typecho_Db::get(); $type = array_pop(explode('_',$installdb->getAdapterName())); $prefix = $installdb->getPrefix(); $scripts = file_get_contents('usr/plugins/HighSlide/'.$type.'.sql'); $scripts = explode(';',str_replace('%charset%','utf8',str_replace('typecho_',$prefix,$scripts))); try { foreach ($scripts as $script) { $script = trim($script); if ($script) { $installdb->query($script,Typecho_Db::WRITE); } } return _t('建立页面相册数据表, 插件启用成功'); } catch (Typecho_Db_Exception $e) { $code = $e->getCode(); if (('Mysql'==$type && ('42S01'==$code || 1050==$code)) || ('SQLite'==$type && ('HY000'==$code || 1==$code))) { try { $script = 'SELECT `gid`,`name`,`thumb`,`sort`,`image`,`description`,`order` from `'.$prefix.'gallery`'; $installdb->query($script,Typecho_Db::READ); return _t('检测到页面相册数据表, 插件启用成功'); } catch (Typecho_Db_Exception $e) { $code = $e->getCode(); throw new Typecho_Plugin_Exception(_t('数据表检测失败, 插件启用失败. 错误号: '.$code)); } } else { throw new Typecho_Plugin_Exception(_t('数据表建立失败, 插件启用失败. 错误号: '.$code)); } } } /** * 调取七牛许可 * * @access public * @param string $key,$secret * @return Qiniu\Auth */ public static function qiniuset($key,$secret) { require_once('cloud/qiniu/autoload.php'); return new Qiniu\Auth($key,$secret); } /** * 调取新浪云SCS许可 * * @access public * @param string $key,$secret * @return SCS */ public static function scsset($key,$secret) { require_once('cloud/scs/SCS.php'); return new SCS($key,$secret); } /** * 调取网易云NOS许可 * * @access public * @param string $key,$secret,$endpoint * @return NOS\NosClient */ public static function nosset($key,$secret,$endpoint) { require_once('cloud/nos/autoload.php'); return new NOS\NosClient($key,$secret,$endpoint); } /** * 调取腾讯云COS许可 * * @access public * @param string $region * @return qcloudcos\Cosapi */ public static function cosset($region) { require_once('cloud/cos/include.php'); qcloudcos\Cosapi::setRegion($region); return new qcloudcos\Cosapi(); } /** * 输出路由参数 * * @access public * @param string $url 原图地址 * @param boolean $isatt 是否来自附件 * @return Typecho_Config */ public static function route($url=NULL,$isatt=false) { $options = Helper::options(); $settings = $options->plugin('HighSlide'); $localsite = $options->siteUrl; $qiniusite = $settings->qiniudomain; $qiniusite = $qiniusite=='http://' ? '' : $qiniusite; $scssite = $settings->scsdomain; $scssite = $scssite && $scssite!=='http://' ? $scssite : 'http://'.$settings->scsbucket.'.cdn.sinacloud.net'; $nossite = $settings->nosdomain; $nossite = $nossite=='http://' ? '' : $nossite; $cossite = $settings->cosdomain; $cossite = $cossite!=='http://*.image.myqcloud.com' && $cossite!=='http://' ? $cossite : ''; //获取路径前缀 $dname = ''; $durl = ''; if ($url) { $source = parse_url($url); $dname = dirname($url); $durl = 0===strpos($dname,$localsite) ? $localsite : $source['scheme'].'://'.$source['host']; } //按储存来源获取地址 switch (true) { case !$url && $settings->storage=='local' || 0===strpos($url,$localsite) : $site = $localsite; $from = 'local'; break; case !$url && $settings->storage=='qiniu' || $qiniusite && 0===strpos($url,$qiniusite) : $site = $qiniusite; $from = 'qiniu'; break; case !$url && $settings->storage=='scs' || 0===strpos($url,$scssite) : if ($url) { $dname = dirname(str_replace($scssite,'',$url)); //fix 子目录 } $site = $scssite; $from = 'scs'; break; case !$url && $settings->storage=='nos' || $nossite && 0===strpos($url,$nossite) : $site = $nossite; $from = 'nos'; break; case !$url && $settings->storage=='cos' || $cossite && 0===strpos($url,$cossite) : $site = $cossite; $from = 'cos'; break; default : $site = ''; $from = ''; } $filedir = $isatt ? str_replace($durl,'',$dname.'/') : $settings->path; $filedir = substr(Typecho_Common::url($filedir,''),1); //处理"/"号 $filedir = $filedir ? $filedir : ''; return new Typecho_Config(array( 'dir'=>$filedir, 'url'=>$url ? $url : Typecho_Common::url($filedir,$site), 'site'=>$site, 'from'=>$from //判断url来源 )); } /** * 构建相册表单 * * @access public * @param string $action,$render * @return Typecho_Widget_Helper_Form */ public static function form($action=NULL,$render='g') { $options = Helper::options(); $settings = $options->plugin('HighSlide'); $security = Helper::security(); //图片编辑表单 $gform = new Typecho_Widget_Helper_Form($security->getIndex('/action/gallery-edit'), Typecho_Widget_Helper_Form::POST_METHOD); $image = new Typecho_Widget_Helper_Form_Element_Text('image', NULL,NULL,_t('原图地址*')); $gform->addInput($image); $thumb = new Typecho_Widget_Helper_Form_Element_Text('thumb', NULL,NULL,_t('缩略图地址*')); $gform->addInput($thumb); $name = new Typecho_Widget_Helper_Form_Element_Text('name', NULL,NULL,_t('图片名称')); $name->input->setAttribute('class','mini'); $gform->addInput($name); $description = new Typecho_Widget_Helper_Form_Element_Textarea('description', NULL,NULL,_t('图片描述'),_t('推荐填写, 用于展示相册中图片的文字说明效果')); $gform->addInput($description); $sort = new Typecho_Widget_Helper_Form_Element_Text('sort', NULL,'1',_t('相册组*'),_t('输入数字, 对应标签[GALLERY-数字]在页面调用')); $sort->input->setAttribute('class','w-10'); $gform->addInput($sort); $do = new Typecho_Widget_Helper_Form_Element_Hidden('do'); $gform->addInput($do); $gid = new Typecho_Widget_Helper_Form_Element_Hidden('gid'); $gform->addInput($gid); $submit = new Typecho_Widget_Helper_Form_Element_Submit(); $submit->input->setAttribute('class','btn'); $gform->addItem($submit); //相册设置表单 $sform = new Typecho_Widget_Helper_Form($security->getIndex('/action/gallery-edit?do=sync'), Typecho_Widget_Helper_Form::POST_METHOD); $gallery = new Typecho_Widget_Helper_Form_Element_Select('gallery', array('gallery-horizontal-strip'=>_t('连环画册'),'gallery-thumbstrip-above'=>_t('黑色影夹'),'gallery-vertical-strip'=>_t('时光胶带'),'gallery-in-box'=>_t('纯白记忆'),'gallery-floating-thumbs'=>_t('往事片段'),'gallery-floating-caption'=>_t('沉默注脚'),'gallery-controls-in-heading'=>_t('岁月名片'),'gallery-in-page'=>_t('幻影橱窗(单相册)')),$settings->gallery,_t('相册风格')); $sform->addInput($gallery); $thumboptions = array( 'fixedwidth'=>_t('固定宽度 %s',' '), 'fixedheight'=>_t('固定高度 %s',' '), 'fixedratio'=>_t('固定比例 %s',' '), ); $thumbfix = new Typecho_Widget_Helper_Form_Element_Radio('thumbfix', $thumboptions,$settings->thumbfix,_t('缩略图规格'),_t('宽高单位px不用填写, 比例带“:”号, 同步影响正文附件缩略图')); $sform->addInput($thumbfix->multiMode()); $thumbapi = new Typecho_Widget_Helper_Form_Element_Radio('thumbapi', array(0=>_t('本地GD库渲染'),1=>_t('云端API演算')),$settings->thumbapi,_t('缩略图生成方式'),_t('API方式将按照原图url生成访问缓存, 不会占用额外储存空间')); $sform->addInput($thumbapi); $storage = new Typecho_Widget_Helper_Form_Element_Radio('storage', array('local'=>_t('本地'),'qiniu'=>_t('七牛'),'scs'=>_t('新浪云SCS'),'nos'=>_t('网易云NOS'),'cos'=>_t('腾讯云COS')),$settings->storage,_t('储存位置%s','')); $storage->setAttribute('style','position:relative;font-size:98%'); //fix IE换行 $sform->addInput($storage); $path = new Typecho_Widget_Helper_Form_Element_Text('path', NULL,$settings->path,_t('路径前缀'),_t('“/”号结尾, 本地路径请确保可写, 云端前缀将忽略开头的“/”号')); $sform->addInput($path); $qiniubucket = new Typecho_Widget_Helper_Form_Element_Text('qiniubucket', NULL,$settings->qiniubucket,_t('空间名称')); $sform->addInput($qiniubucket); $qiniudomain = new Typecho_Widget_Helper_Form_Element_Text('qiniudomain', NULL,$settings->qiniudomain,_t('访问域名')); $sform->addInput($qiniudomain); $qiniuak = new Typecho_Widget_Helper_Form_Element_Text('qiniuak', NULL,$settings->qiniuak,_t('AccessKey')); $sform->addInput($qiniuak); $qiniusk = new Typecho_Widget_Helper_Form_Element_Text('qiniusk', NULL,$settings->qiniusk,_t('SecretKey')); $sform->addInput($qiniusk); $scsbucket = new Typecho_Widget_Helper_Form_Element_Text('scsbucket', NULL,$settings->scsbucket,_t('Bucket名称')); $sform->addInput($scsbucket); $scsdomain = new Typecho_Widget_Helper_Form_Element_Text('scsdomain', NULL,$settings->scsdomain,_t('绑定域名'),_t('未申请域名绑定留空即可')); $sform->addInput($scsdomain); $scsimgx = new Typecho_Widget_Helper_Form_Element_Text('scsimgx', NULL,$settings->scsimgx,_t('图片处理服务 (新Imgxs)'),_t('填写服务实例域名和源站标识用|号隔开, 留空则使用原imgx免费子域名API')); $sform->addInput($scsimgx); $scsak = new Typecho_Widget_Helper_Form_Element_Text('scsak', NULL,$settings->scsak,_t('Access Key')); $sform->addInput($scsak); $scssk = new Typecho_Widget_Helper_Form_Element_Text('scssk', NULL,$settings->scssk,_t('Secret Key')); $sform->addInput($scssk); $nosbucket = new Typecho_Widget_Helper_Form_Element_Text('nosbucket', NULL,$settings->nosbucket,_t('桶名称')); $sform->addInput($nosbucket); $nosdomain = new Typecho_Widget_Helper_Form_Element_Text('nosdomain', NULL,$settings->nosdomain,_t('域名')); $sform->addInput($nosdomain); $nosak = new Typecho_Widget_Helper_Form_Element_Text('nosak', NULL,$settings->nosak,_t('Access Key')); $sform->addInput($nosak); $nosas = new Typecho_Widget_Helper_Form_Element_Text('nosas', NULL,$settings->nosas,_t('Access Secret')); $sform->addInput($nosas); $nosep = new Typecho_Widget_Helper_Form_Element_Radio('nosep', array('nos-eastchina1.126.net'=>_t('华东1')),$settings->nosep, _t('数据中心')); $sform->addInput($nosep); $cosbucket = new Typecho_Widget_Helper_Form_Element_Text('cosbucket', NULL,$settings->cosbucket,_t('Bucket名称')); $sform->addInput($cosbucket); $cosdomain = new Typecho_Widget_Helper_Form_Element_Text('cosdomain', NULL,$settings->cosdomain,_t('访问域名'),_t('使用API方式生成缩略图须填写%s万象优图%s的图片处理/加速域名','','')); $sform->addInput($cosdomain); $cosai = new Typecho_Widget_Helper_Form_Element_Text('cosai', NULL,$settings->cosai,_t('APPID'),_t('可通过%s腾讯云控制台%s【账号信息】查看','','')); $sform->addInput($cosai); $cossi = new Typecho_Widget_Helper_Form_Element_Text('cossi', NULL,$settings->cossi,_t('SecretId')); $sform->addInput($cossi); $cossk = new Typecho_Widget_Helper_Form_Element_Text('cossk', NULL,$settings->cossk,_t('SecretKey')); $sform->addInput($cossk); $cosrg = new Typecho_Widget_Helper_Form_Element_Select('cosrg', array('sh'=>_t('华东(上海)'),'gz'=>_t('华南(广州)'),'cd'=>_t('西南(成都)'),'tj'=>_t('华北(北京一区)'),'bj'=>_t('北京'),'sgp'=>_t('新加坡'),'hk'=>_t('香港'),'ca'=>_t('多伦多'),'ger'=>_t('法兰克福')),$settings->cosrg, _t('所属地区')); $sform->addInput($cosrg); $cloudtoo = new Typecho_Widget_Helper_Form_Element_Select('cloudtoo', array(0=>_t('否'),1=>_t('是')),$settings->cloudtoo,_t('正文附件缩略图也使用该云储存')); $cloudtoo->label->setAttribute('style','color:#999;font-weight:normal;font-size:.92857em;'); $cloudtoo->input->setAttribute('style','position:absolute;font-size:.92857em;height:24px;bottom:-2px;left:184px;'); $cloudtoo->setAttribute('style','position:relative'); $sform->addInput($cloudtoo); $sform->addItem($submit); $request = Typecho_Request::getInstance(); //修改图片模式 if (isset($request->gid) && $action!=='insert') { $db = Typecho_Db::get(); $gallery = $db->fetchRow($db->select()->from('table.gallery')->where('gid = ?',$request->filter('int')->gid)); if (!$gallery) { throw new Typecho_Widget_Exception(_t('修改图片不存在')); } $thumb->value($gallery['thumb']); $image->value($gallery['image']); $sort->value($gallery['sort']); $name->value($gallery['name']); $description->value($gallery['description']); $do->value('update'); $gid->value($gallery['gid']); $submit->value(_t('修改图片')); $_action = 'update'; //保存设置模式 } elseif ($action=='sync' && $render=='s') { $submit->value(_t('保存设置')); $_action = 'sync'; //添加图片模式 } else { $do->value('insert'); $submit->value(_t('添加图片')); $_action = 'insert'; } if (!$action) { $action = $_action; } //验证表单规则 if ($action=='insert' || $action=='update') { $thumb->addRule('required',_t('图片地址不能为空')); $image->addRule('required',_t('图片地址不能为空')); $sort->addRule('required',_t('相册组不能为空')); $thumb->addRule('url',_t('请填写合法的图片地址')); $image->addRule('url',_t('请填写合法的图片地址')); $sort->addRule('isInteger',_t('请填写整数数字')); } return $render=='g' ? $gform : $sform; } /** * 判断比例格式 * * @access public * @param string $ratio * @return boolean */ public static function ratioformat($ratio) { return preg_match('/^\d*:\d*$/',$ratio); } /** * 输出标签替换 * * @access public * @param string $content * @return string */ public static function autohighslide($content,$widget,$lastResult) { $content = empty($lastResult) ? $content : $lastResult; if ($widget instanceof Widget_Archive) { $options = Helper::options(); $settings = $options->plugin('HighSlide'); $type = self::replacelist(); //判断替换范围 if ($widget->is(''.$type['index'].'') || $widget->is(''.$type['archive'].'') || $widget->is(''.$type['post'].'') || $widget->is(''.$type['page'].'')) { $content = preg_replace('/(.*?)<\/a>/si' ,'$5',$content); //所有图片弹窗 if ($settings->rpopt) { $content = preg_replace('/(