From b06244fb1672bf1bcb274bf8d26d4e39d67525fd Mon Sep 17 00:00:00 2001
From: FGHRSH <1070816008@qq.com>
Date: Fri, 3 Jun 2016 23:46:07 +0800
Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=B7=B2=E7=9F=A5bug?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
function.php | 69 ++++++++++++++++++++++++++++------------------------
1 file changed, 37 insertions(+), 32 deletions(-)
diff --git a/function.php b/function.php
index f634303..55cae06 100644
--- a/function.php
+++ b/function.php
@@ -5,41 +5,46 @@ function parseCallback($post,$siteurl,$dmserver,$theme) {
$pattern = self::get_shortcode_regex(array('dplayer'));
preg_match_all("/$pattern/",$post,$matches);
if (empty($matches[0])) {
- return $post;
- }
- if ($matches[1] == '[' && $matches[6] == ']') {
- return substr($matches[0], 1, -1);
+ return $post."";
}
for ($i=0;$i $atts['url'] ? $atts['url'] : '',
- 'pic' => $atts['pic'] ? $atts['pic'] : '');
- if (empty($result)) return '';
- if (empty($theme)) $theme = '#FADFA3';
- $data = array(
- 'id' => $id,
- 'autoplay' => false,
- 'theme' => $theme);
- $data['autoplay'] = ($atts['autoplay'] == 'true') ? true : false;
- $data['theme'] = $atts['theme'] ? $atts['theme'] : $theme;
- $data['video'] = $result;
- $danmaku = array(
- 'id' => md5($id),
- 'token' => md5(md5($id) . date('YmdH', time())),
- 'api' => $dmserver,);
- $data['danmaku'] = ($atts['danmu'] != 'false') ? $danmaku : null;
- if (empty($dmserver)) $data['danmaku'] = null;
- $js = json_encode($data);
- $src = "";
- if (empty($out)) {
- $out = str_replace($matches[0][$i], $src, $post);
- $jssrc = "dPlayerOptions.push(".$js.");";
+ if ($matches[1][$i] == '[' && $matches[6][$i] == ']') {
+ if (empty($out)) {
+ $out = str_replace($matches[0][$i], substr($matches[0][$i], 1, -1), $post);
+ } else {
+ $out = str_replace($matches[0][$i], substr($matches[0][$i], 1, -1), $out);
+ }
} else {
- $out = str_replace($matches[0][$i], $src, $out);
- $jssrc .= "dPlayerOptions.push(".$js.");";
+ $attr = htmlspecialchars_decode($matches[3][$i]);
+ $atts = self::shortcode_parse_atts($attr);
+ $id = md5($siteurl.$atts['url']);
+ $result = array(
+ 'url' => $atts['url'] ? $atts['url'] : '',
+ 'pic' => $atts['pic'] ? $atts['pic'] : '');
+ if (empty($result)) return '';
+ if (empty($theme)) $theme = '#FADFA3';
+ $data = array(
+ 'id' => $id,
+ 'autoplay' => false,
+ 'theme' => $theme);
+ $data['autoplay'] = ($atts['autoplay'] == 'true') ? true : false;
+ $data['theme'] = $atts['theme'] ? $atts['theme'] : $theme;
+ $data['video'] = $result;
+ $danmaku = array(
+ 'id' => md5($id),
+ 'token' => md5(md5($id) . date('YmdH', time())),
+ 'api' => $dmserver,);
+ $data['danmaku'] = ($atts['danmu'] != 'false') ? $danmaku : null;
+ if (empty($dmserver)) $data['danmaku'] = null;
+ $js = json_encode($data);
+ $src = "";
+ if (empty($out)) {
+ $out = str_replace($matches[0][$i], $src, $post);
+ $jssrc = "dPlayerOptions.push(".$js.");";
+ } else {
+ $out = str_replace($matches[0][$i], $src, $out);
+ $jssrc .= "dPlayerOptions.push(".$js.");";
+ }
}
}
$out .= "".$jssrc."";