Browse Source

Update archives.class.php

tags/6.2.0
xushubieli 1 year ago
parent
commit
43bf4fb38d
1 changed files with 7 additions and 7 deletions
  1. +7
    -7
      src/system/archive/archives.class.php

+ 7
- 7
src/system/archive/archives.class.php View File

@@ -193,15 +193,15 @@ 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("<img","<img alt=\"".$this->Fields['title']."\" title=\"".$this->Fields['title']."\" style=\"margin:20px 0;box-shadow:0 1px 2px rgba(0,0,0,.1)\"",$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("<img","<img alt=\"".$this->Fields['title']."\" title=\"".$this->Fields['title']."\" ",$this->Fields['body']);
//图集图片注释替换为标题,利于优化
$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("<img","<img alt=\"".$this->Fields['title']."\" title=\"".$this->Fields['title']."\" ",$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("<img","<img alt=\"".$this->Fields['title']."\" title=\"".$this->Fields['title']."\"",$this->Fields['imgurls']);
//清除文章图片的宽度和高度,适配自适应网站
$this->Fields['body'] = preg_replace("/style=\"width\:(.*)\"/","",$this->Fields['body']);
}
//完成附加表信息读取


Loading…
Cancel
Save