Skip to content

Commit ccda64b

Browse files
author
Yunlong Liu
authored
fix url null pointer error
1 parent df351ba commit ccda64b

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

Plugin.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ public static function parseCallback($matches)
116116
//[dplayer]标签的属性,类型为array
117117
$atts = self::shortcode_parse_atts($attr);
118118
//播放器id
119-
$id = md5($_SERVER['HTTP_HOST'] . $atts['url']);
119+
$id = md5(isset($atts['url']) ? $atts['url'] : 'default id');
120120

121121
//播放器设置
122122
$theme = Typecho_Widget::widget('Widget_Options')->plugin('DPlayer')->theme;
@@ -142,7 +142,7 @@ public static function parseCallback($matches)
142142
'color' => isset($atts['subtitlecolor']) ? $atts['subtitlecolor'] : '#b7daff',
143143
);
144144
$danmaku = array(
145-
'id' => md5($id),
145+
'id' => $id,
146146
'api' => $api,
147147
'maximum' => isset($atts['maximum']) ? $atts['maximum'] : 1000,
148148
'addition' => isset($atts['addition']) ? array($atts['addition']) : null,
@@ -167,7 +167,7 @@ public static function parseCallback($matches)
167167
'mutex' => true,
168168
);
169169
$data['video'] = $video;
170-
$data['danmaku'] = (isset($atts['danmu']) && $atts['danmu'] != 'false') ? $danmaku : null;
170+
$data['danmaku'] = (isset($atts['danmu']) && $atts['danmu'] == 'true') ? $danmaku : null;
171171
$data['subtitle'] = isset($atts['subtitleurl']) ? $subtitle : null;
172172
$data['autoplay'] = (isset($atts['autoplay']) && $atts['autoplay'] == 'true') ? true : false;
173173
$data['theme'] = isset($atts['theme']) ? $atts['theme'] : $theme;
@@ -312,4 +312,4 @@ private static function get_shortcode_regex($tagnames = null)
312312
. ')'
313313
. '(\\]?)'; // 6: Optional second closing brocket for escaping shortcodes: [[tag]]
314314
}
315-
}
315+
}

0 commit comments

Comments
 (0)