From ccda64b52969c1bc6331438d0bfd9d724b9bbea8 Mon Sep 17 00:00:00 2001 From: Yunlong Liu Date: Thu, 21 Nov 2019 23:36:02 +0800 Subject: [PATCH] fix url null pointer error --- Plugin.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Plugin.php b/Plugin.php index ff7fbd6..af282dd 100644 --- a/Plugin.php +++ b/Plugin.php @@ -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; @@ -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, @@ -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; @@ -312,4 +312,4 @@ private static function get_shortcode_regex($tagnames = null) . ')' . '(\\]?)'; // 6: Optional second closing brocket for escaping shortcodes: [[tag]] } -} \ No newline at end of file +}