Plugin Directory

Changeset 1956902


Ignore:
Timestamp:
10/15/2018 01:42:58 PM (7 years ago)
Author:
0xbbc
Message:

boost to DPlayer 1.25.0

Location:
dplayer-for-wp
Files:
9 added
3 edited

Legend:

Unmodified
Added
Removed
  • dplayer-for-wp/trunk/dplayer.php

    r1718543 r1956902  
    33* Plugin Name: DPlayer for WordPress
    44* Description: Wow, such a lovely HTML5 danmaku video player comes to WordPress
    5 * Version: 1.2.2
     5* Version: 1.2.3
    66* Author: 0xBBC
    77* Author URI: https://blog.0xbbc.com/
     
    4141        add_option( 'kblog_danmaku_url', '//danmaku.daoapp.io' );
    4242        add_option( 'kblog_danmaku_token', 'tokendemo' );
    43         add_option( 'kblog_danmaku_dplayer_version', '1.6.1' );
     43        add_option( 'kblog_danmaku_dplayer_version', '1.25.0' );
    4444        add_option( 'kblog_danmaku_dplayer_version_check', '0' );
    4545    }
     
    105105        $bilibili_param = $atts['bilibili'] ? $atts['bilibili'] : '';
    106106        $id = md5($_SERVER['HTTP_HOST'] . $atts['url'] . $bilibili_param);
    107         $result = array(
    108             'url' => $atts['url'] ? $atts['url'] : '',
    109             'pic' => $atts['pic'] ? $atts['pic'] : '',
    110             'type' => $atts['type'] ? $atts['type'] : 'auto',
    111         );
    112107       
    113         $theme = $atts['theme'];
    114         if (!$theme) $theme = '#FADFA3';
    115 
    116108        $data = array(
    117109            'id' => $id,
    118110            'autoplay' => false,
    119             'theme' => $theme,
     111            'theme' => $atts['theme'] ? $atts['theme'] : '#FADFA3',
    120112            'loop' => false,
    121113            'screenshot' => false,
    122114            'hotkey' => true,
    123             'preload' => 'metadata'
    124         );
    125 
     115            'preload' => 'metadata',
     116            'lang' => $atts['lang'] ? $atts['lang'] : 'zh-cn',
     117            'logo' => $atts['logo'] ? $atts['logo'] : null,
     118            'volume' => $atts['volume'] ? $atts['volume'] : 0.7,
     119            'mutex' => true,
     120        );
    126121        if ($atts['autoplay']) $data['autoplay'] = ($atts['autoplay'] == 'true') ? true : false;
    127122        if ($atts['loop']) $data['loop'] = ($atts['loop'] == 'true') ? true : false;
     
    129124        if ($atts['hotkey']) $data['hotkey'] = ($atts['hotkey'] == 'true') ? true : false;
    130125        if ($atts['preload']) $data['preload'] = (in_array($atts['preload'], array('auto', 'metadata', 'none')) == true) ? $atts['preload'] : 'metadata';
    131        
    132 
     126        if ($atts['mutex']) $data['mutex'] = ($atts['mutex'] == 'true') ? true : false;
     127       
     128        $video = array(
     129            'url' => $atts['url'] ? $atts['url'] : '',
     130            'pic' => $atts['pic'] ? $atts['pic'] : '',
     131            'type' => $atts['type'] ? $atts['type'] : 'auto',
     132            'thumbnails' => $atts['thumbnails'] ? $atts['thumbnails'] : '',
     133        );
     134
     135        $subtitle = array(
     136            'url' => $atts['subtitleurl'] ? $atts['subtitleurl'] : '',
     137            'type' => $atts['subtitletype'] ? $atts['subtitletype'] : 'webvtt',
     138            'fontSize' => $atts['subtitlefontSize'] ? $atts['subtitlefontSize'] : '25px',
     139            'bottom' => $atts['subtitlebottom'] ? $atts['subtitlebottom'] : '10%',
     140            'color' => $atts['subtitlecolor'] ? $atts['subtitlecolor'] : '#b7daff',
     141        );
     142
     143        $danmaku = array(
     144            'id' => md5($id),
     145            'api' => get_option( 'kblog_danmaku_url', '' ),
     146            'token' => get_option( 'kblog_danmaku_token', '' ),
     147            'maximum' => $atts['maximum'] ? $atts['maximum'] : 1000,
     148            'addition' => $atts['addition'] ? explode('-A-', $atts['addition']) : [],
     149            'user' => $atts['user'] ? $atts['user'] : 'DIYgod',
     150            'bottom' => $atts['bottom'] ? $atts['bottom'] : '15%',
     151            'unlimited' => true,
     152        );
     153        if ($atts['unlimited']) $data['unlimited'] = ($atts['unlimited'] == 'true') ? true : false;
     154       
    133155        $playerCode = '<div id="player'.$id.'" class="dplayer">';
    134156        $playerCode .= "</div>\n";
    135157
    136         $danmaku = array(
    137             'id' => md5($id),
    138             'token' => get_option( 'kblog_danmaku_token', '' ),
    139             'api' => get_option( 'kblog_danmaku_url', '' ),
    140         );
    141        
    142158        if ($bilibili_param) {
    143159            $bilibili_parsed = DPlayer::dplayer_bilibili_url_handler($bilibili_param);
    144160            $danmaku['addition'] = array($bilibili_parsed['danma']);
    145161            if ($danmaku['addition'] && empty($atts['url'])) {
    146                 $result['url'] = $bilibili_parsed['video'];
     162                $video['url'] = $bilibili_parsed['video'];
    147163            }
    148164        }
    149165       
    150         $data['video'] = $result;
     166        $data['video'] = $video;
     167        $data['subtitle'] = $subtitle;
    151168        $data['danmaku'] = ($atts['danmu'] != 'false') ? $danmaku : null;
    152169
     
    177194            $current_time = time();
    178195            $last_check = (int)get_option( 'kblog_danmaku_dplayer_version_check', '0' );
    179             $dplayer_version = get_option( 'kblog_danmaku_dplayer_version', '1.6.1' );
     196            $dplayer_version = get_option( 'kblog_danmaku_dplayer_version', '1.25.0' );
    180197           
    181198            if ($current_time - $last_check > 86400 /* 86400 = 60 * 60 * 24 i.e 24hrs */) {
  • dplayer-for-wp/trunk/dplayer/init-dplayer.js

    r1694437 r1956902  
    11var len = dPlayerOptions.length;
    2 for(var i=0;i<len;i++){
     2for (var i = 0; i < len; i++) {
    33    dPlayers[i] = new DPlayer({
    4         element: document.getElementById('player' + dPlayerOptions[i]['id']),
    5             autoplay: dPlayerOptions[i]['autoplay'],
    6             video: dPlayerOptions[i]['video'],
    7             theme: dPlayerOptions[i]['theme'],
    8             danmaku: dPlayerOptions[i]['danmaku'],
     4        container: document.getElementById('player' + dPlayerOptions[i]['id']),
     5        autoplay: dPlayerOptions[i]['autoplay'],
     6        theme: dPlayerOptions[i]['theme'],
     7        loop: dPlayerOptions[i]['loop'],
     8        lang: dPlayerOptions[i]['lang'],
     9        screenshot: dPlayerOptions[i]['screenshot'],
     10        hotkey: dPlayerOptions[i]['hotkey'],
     11        preload: dPlayerOptions[i]['preload'],
     12        logo: dPlayerOptions[i]['logo'],
     13        volume: dPlayerOptions[i]['volume'],
     14        mutex: dPlayerOptions[i]['mutex'],
     15        video: dPlayerOptions[i]['video'],
     16        subtitle: dPlayerOptions[i]['subtitle'],
     17        danmaku: dPlayerOptions[i]['danmaku'],
    918    });
    1019}
    11 
  • dplayer-for-wp/trunk/readme.txt

    r1718543 r1956902  
    33Tags: video, player, shortcode
    44Requires at least: 3.0.1
    5 Tested up to: 4.8.1
    6 Stable tag: 1.2.2
     5Tested up to: 4.9.8
     6Stable tag: 1.2.3
    77License: GPLv3
    88License URI: http://www.gnu.org/licenses/gpl-3.0.html
     
    3939
    4040== Changelog ==
     41
     42= 1.2.3 =
     43boost to DPlayer 1.25.0
    4144
    4245= 1.2.2 =
Note: See TracChangeset for help on using the changeset viewer.