fix url null pointer error

This commit is contained in:
Yunlong Liu 2019-11-21 23:36:02 +08:00 committed by GitHub
parent df351ba7c2
commit ccda64b529
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -116,7 +116,7 @@ EOF;
//[dplayer]标签的属性类型为array
$atts = self::shortcode_parse_atts($attr);
//播放器id
$id = md5($_SERVER['HTTP_HOST'] . $atts['url']);
$id = md5(isset($atts['url']) ? $atts['url'] : 'default id');
//播放器设置
$theme = Typecho_Widget::widget('Widget_Options')->plugin('DPlayer')->theme;
@ -142,7 +142,7 @@ EOF;
'color' => isset($atts['subtitlecolor']) ? $atts['subtitlecolor'] : '#b7daff',
);
$danmaku = array(
'id' => md5($id),
'id' => $id,
'api' => $api,
'maximum' => isset($atts['maximum']) ? $atts['maximum'] : 1000,
'addition' => isset($atts['addition']) ? array($atts['addition']) : null,
@ -167,7 +167,7 @@ EOF;
'mutex' => true,
);
$data['video'] = $video;
$data['danmaku'] = (isset($atts['danmu']) && $atts['danmu'] != 'false') ? $danmaku : null;
$data['danmaku'] = (isset($atts['danmu']) && $atts['danmu'] == 'true') ? $danmaku : null;
$data['subtitle'] = isset($atts['subtitleurl']) ? $subtitle : null;
$data['autoplay'] = (isset($atts['autoplay']) && $atts['autoplay'] == 'true') ? true : false;
$data['theme'] = isset($atts['theme']) ? $atts['theme'] : $theme;
@ -312,4 +312,4 @@ EOF;
. ')'
. '(\\]?)'; // 6: Optional second closing brocket for escaping shortcodes: [[tag]]
}
}
}