From f57af915796d0b144a895ac4491c3b119438d5eb Mon Sep 17 00:00:00 2001 From: Devil Date: Wed, 6 Nov 2019 21:06:01 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=92=E4=BB=B6=E9=85=8D=E7=BD=AE=E8=AF=BB?= =?UTF-8?q?=E5=8F=96=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/service/PluginsService.php | 44 ++++++++++++++------------ 1 file changed, 23 insertions(+), 21 deletions(-) diff --git a/application/service/PluginsService.php b/application/service/PluginsService.php index 7e3774b91..97e6accbd 100755 --- a/application/service/PluginsService.php +++ b/application/service/PluginsService.php @@ -51,36 +51,38 @@ class PluginsService if(!empty($ret['data'])) { $data = json_decode($ret['data'], true); - - // 是否有自定义附件需要处理 - if(!empty($attachment_field) && is_array($attachment_field)) + if(!empty($data) && is_array($data)) { - foreach($attachment_field as $field) + // 是否有自定义附件需要处理 + if(!empty($attachment_field) && is_array($attachment_field)) { - if(isset($data[$field])) + foreach($attachment_field as $field) { - $data[$field.'_old'] = $data[$field]; - $data[$field] = ResourcesService::AttachmentPathViewHandle($data[$field]); + if(isset($data[$field])) + { + $data[$field.'_old'] = $data[$field]; + $data[$field] = ResourcesService::AttachmentPathViewHandle($data[$field]); + } } - } - } else { - // 所有附件后缀名称 - $attachment_ext = config('ueditor.fileManagerAllowFiles'); + } else { + // 所有附件后缀名称 + $attachment_ext = config('ueditor.fileManagerAllowFiles'); - // 未自定义附件则自动根据内容判断处理附件,建议自定义附件字段名称处理更高效 - if(!empty($attachment_ext) && is_array($attachment_ext)) - { - foreach($data as $k=>$v) + // 未自定义附件则自动根据内容判断处理附件,建议自定义附件字段名称处理更高效 + if(!empty($attachment_ext) && is_array($attachment_ext)) { - if(!empty($v) && !is_array($v) && !is_object($v)) + foreach($data as $k=>$v) { - $ext = strrchr(substr($v, -6), '.'); - if($ext !== false) + if(!empty($v) && !is_array($v) && !is_object($v)) { - if(in_array($ext, $attachment_ext)) + $ext = strrchr(substr($v, -6), '.'); + if($ext !== false) { - $data[$k.'_old'] = $v; - $data[$k] = ResourcesService::AttachmentPathViewHandle($v); + if(in_array($ext, $attachment_ext)) + { + $data[$k.'_old'] = $v; + $data[$k] = ResourcesService::AttachmentPathViewHandle($v); + } } } } -- GitLab