From bcedbf44e8403b9a8647eb444e148185093b5f84 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8F=99=E8=BF=B0=E3=80=81=E5=88=AB=E7=A6=BB?= Date: Wed, 20 Mar 2024 11:14:02 +0800 Subject: [PATCH] =?UTF-8?q?=E7=B3=BB=E7=BB=9F=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/changelog.md | 2 ++ src/admin/inc/inc_archives_functions.php | 2 +- src/install/config.cache.inc.php | 4 ++-- src/system/archive/archives.class.php | 12 ------------ src/system/extend.func.php | 16 ++++++++++++++++ 5 files changed, 21 insertions(+), 15 deletions(-) diff --git a/docs/changelog.md b/docs/changelog.md index 54d90014..5e2a1563 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -6,6 +6,8 @@ - 优化会员账号注册和修改限制; - 优化系统一方式提示; - 优化后台链接官方资源加载超时,依然保持流畅; +- 优化自动关键词默认状态; +- 优化图片自动alt; - 重做响应式后台登录页面; - 其他常规问题修复; diff --git a/src/admin/inc/inc_archives_functions.php b/src/admin/inc/inc_archives_functions.php index eed4053a..1af81901 100644 --- a/src/admin/inc/inc_archives_functions.php +++ b/src/admin/inc/inc_archives_functions.php @@ -535,7 +535,7 @@ function AnalyseHtmlBody($body, &$description, &$litpic, &$keywords, $dtype = '' $litpic = GetDDImgFromBody($body); } //自动获取关键词 - if ($autokey == 2 && $keywords == '') { + if ($autokey == 1 && $keywords == '') { $subject = $title; $message = $body; //采用DedeBIZ Core分词组件分词 diff --git a/src/install/config.cache.inc.php b/src/install/config.cache.inc.php index ae1a7cd4..cb304a28 100755 --- a/src/install/config.cache.inc.php +++ b/src/install/config.cache.inc.php @@ -50,8 +50,8 @@ $cfg_makesign_cache = 'N'; $cfg_rm_remote = 'Y'; $cfg_arc_dellink = 'N'; $cfg_arc_autopic = 'Y'; -$cfg_arc_autokeyword = 'Y'; -$cfg_title_maxlen = 60; +$cfg_arc_autokeyword = 'N'; +$cfg_title_maxlen = 255; $cfg_album_width = 800; $cfg_album_row = 3; $cfg_album_col = 4; diff --git a/src/system/archive/archives.class.php b/src/system/archive/archives.class.php index 8eaa8d60..9d98e808 100755 --- a/src/system/archive/archives.class.php +++ b/src/system/archive/archives.class.php @@ -188,18 +188,6 @@ class Archives //设置全局环境变量 $this->Fields['typename'] = $this->TypeLink->TypeInfos['typename']; @SetSysEnv($this->Fields['typeid'], $this->Fields['typename'], $this->Fields['id'], $this->Fields['title'], 'archives'); - //文档模型正文图片注释自动为标题 - $this->Fields['body'] = str_ireplace(array('alt=""','alt=\'\''),'',$this->Fields['body']); - $this->Fields['body'] = preg_replace("@ [\s]{0,}alt[\s]{0,}=[\"'\s]{0,}[\s\S]{0,}[\"'\s] @isU","",$this->Fields['body']); - $this->Fields['body'] = str_ireplace("Fields['title']."\" title=\"".$this->Fields['title']."\" ",$this->Fields['body']); - //图片模型正文图片注释自动为标题 - if (isset($this->Fields['imgurls']) && is_array($this->Fields['imgurls'])) { - $this->Fields['imgurls'] = str_ireplace(array('alt=""','alt=\'\''),'',$this->Fields['imgurls']); - $this->Fields['imgurls'] = preg_replace("@ [\s]{0,}alt[\s]{0,}=[\"'\s]{0,}[\s\S]{0,}[\"'\s] @isU","",$this->Fields['imgurls']); - $this->Fields['imgurls'] = str_ireplace("Fields['title']."\" title=\"".$this->Fields['title']."\"",$this->Fields['imgurls']); - } - //移除文档模型正文图片宽度和高度,适配响应式网站 - $this->Fields['body'] = preg_replace("/style=\"width\:(.*)\"/","",$this->Fields['body']); } //完成附加表信息读取 unset($row); diff --git a/src/system/extend.func.php b/src/system/extend.func.php index dc0a3696..a3cc5d84 100755 --- a/src/system/extend.func.php +++ b/src/system/extend.func.php @@ -53,6 +53,22 @@ if (!function_exists('obtainimgs')) { return $result; } } +//文档图片注释自动为标题{dede:field.body function='obtainalt(@me)'/} +function obtainalt($newalt) +{ + global $dsql, $id; + $row = $dsql->GetOne("SELECT title FROM `#@__archives` WHERE id='$id'"); + //图片注释自动为标题 + $newalt = str_ireplace(array('alt=""','alt=\'\''),'',$newalt); + $newalt = preg_replace("@ [\s]{0,}alt[\s]{0,}=[\"'\s]{0,}[\s\S]{0,}[\"'\s] @isU","",$newalt); + $newalt = str_ireplace("\"".$row['title']."\"","/>", $newalt); + return $newalt; +} //联动单筛选{dede:php}obtainfilter(模型id,类型,'字段1,字段2');{/dede:php}类型表示前台展现方式对应case值 function obtainfilter($channelid, $type = 1, $fieldsnamef = '', $defaulttid = 0, $toptid = 0, $loadtype = 'autofield') {