From 9ea84c37a1d9e3cd6597edd71e1c227b6461edd0 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 12:19:29 +0800 Subject: [PATCH] Update extend.func.php --- src/system/extend.func.php | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/system/extend.func.php b/src/system/extend.func.php index a3cc5d84..3aa60124 100755 --- a/src/system/extend.func.php +++ b/src/system/extend.func.php @@ -28,7 +28,7 @@ if (!function_exists('obtaintags')) { global $dsql; $tags = ''; $query = "SELECT * FROM `#@__taglist` WHERE aid='$aid' LIMIT $num"; - $dsql->Execute('tag',$query); + $dsql->Execute('tag', $query); while($row = $dsql->GetArray('tag')) { $link = "/apps/tags.php?/{$row['tid']}"; $tags .= ($tags == '' ? "{$row['tag']}" : "{$row['tag']}"); @@ -56,17 +56,17 @@ if (!function_exists('obtainimgs')) { //文档图片注释自动为标题{dede:field.body function='obtainalt(@me)'/} function obtainalt($newalt) { - global $dsql, $id; - $row = $dsql->GetOne("SELECT title FROM `#@__archives` WHERE id='$id'"); + global $dsql, $id, $aid; + $myid = isset($id) ? $id : $aid; + $row = $dsql->GetOne("SELECT title FROM `#@__archives` WHERE id='$myid'"); //图片注释自动为标题 - $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(array('alt=""', 'alt=\'\'', 'title=""', 'title=\'\''), "", $newalt); $newalt = str_ireplace("\"".$row['title']."\"","/>", $newalt); + $newalt = preg_replace("/style=\"width\:(.*)\"/", "", $newalt); + //去掉结尾 + $newalt = str_ireplace(" /", "/", $newalt); + $newalt = str_ireplace(" />", ">", $newalt); return $newalt; } //联动单筛选{dede:php}obtainfilter(模型id,类型,'字段1,字段2');{/dede:php}类型表示前台展现方式对应case值