提交 f57af915 编写于 作者: D Devil

插件配置读取优化

上级 8436fc75
......@@ -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);
}
}
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册