Skip to content

Commit

Permalink
fix url null pointer error
Browse files Browse the repository at this point in the history
  • Loading branch information
Yunlong Liu authored Nov 21, 2019
1 parent df351ba commit ccda64b
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions Plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ public static function parseCallback($matches)
//[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;
Expand All @@ -142,7 +142,7 @@ public static function parseCallback($matches)
'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,
Expand All @@ -167,7 +167,7 @@ public static function parseCallback($matches)
'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;
Expand Down Expand Up @@ -312,4 +312,4 @@ private static function get_shortcode_regex($tagnames = null)
. ')'
. '(\\]?)'; // 6: Optional second closing brocket for escaping shortcodes: [[tag]]
}
}
}

0 comments on commit ccda64b

Please sign in to comment.