Plugin Directory

Changeset 1507117


Ignore:
Timestamp:
10/03/2016 06:36:16 AM (9 years ago)
Author:
0xbbc
Message:

Added settings page for DPlayer

Location:
dplayer-for-wp
Files:
3 edited
2 copied

Legend:

Unmodified
Added
Removed
  • dplayer-for-wp/tags/1.0.8/dplayer.php

    r1503993 r1507117  
    33* Plugin Name: DPlayer for WordPress
    44* Description: Wow, such a lovely HTML5 danmaku video player comes to WordPress
    5 * Version: 1.0.7
     5* Version: 1.0.8
    66* Author: 0xBBC
    77* Author URI: https://blog.0xbbc.com/
    8 * License: GPLv2
    9 * License URI: http://www.gnu.org/licenses/gpl-2.0.html
     8* License: GPLv3
     9* License URI: http://www.gnu.org/licenses/gpl-3.0.html
    1010*
    1111* Acknowledgement
     
    1717*/
    1818
     19require_once( dirname( __FILE__ ) . '/dplayer-admin.php' );
     20
    1921class DPlayer {
    2022    static $add_script;
     
    2426        add_action( 'wp_footer', array( __CLASS__, 'add_script' ) );
    2527        add_shortcode( 'dplayer', array( __CLASS__, 'dplayer_load') );
     28        add_filter( 'plugin_action_links', array( __CLASS__, 'dplayer_settings_link' ), 9, 2 );
    2629    }
    2730   
     
    3033<script>var dPlayers = [];var dPlayerOptions = [];</script>
    3134<?php
     35    }
     36   
     37    // registers default options
     38    public static function dplayer_install() {
     39        add_option( 'kblog_danmaku_url', '//danmaku.daoapp.io' );
     40        add_option( 'kblog_danmaku_token', 'tokendemo' );
     41    }
     42   
     43    public static function dplayer_uninstall() {
     44        delete_option( 'kblog_danmaku_url' );
     45        delete_option( 'kblog_danmaku_token' );
    3246    }
    3347   
     
    6882        $danmaku = array(
    6983            'id' => md5($id),
    70             'token' => 'tokendemo',
    71             'api' => '//danmaku.daoapp.io/',
     84            'token' => get_option( 'kblog_danmaku_token', '' ),
     85            'api' => get_option( 'kblog_danmaku_url', '' ),
    7286        );
    7387        $data['danmaku'] = ($atts['danmu'] != 'false') ? $danmaku : null;
     
    8094    }
    8195   
     96    public static function dplayer_settings_link( $links, $file ) {
     97        if ( plugins_url('dplayer-admin.php', __FILE__) === $file && function_exists( 'admin_url' ) ) {
     98            $settings_link = '<a href="' . esc_url( admin_url( 'options-general.php?page=kblog-dplayer' ) ) . '">' . esc_html__( 'Settings' ) . '</a>';
     99            array_unshift( $links, $settings_link );
     100        }
     101        return $links;
     102    }
     103   
    82104    public static function add_script() {
    83105        if (!self::$add_script) {
    84             wp_enqueue_script( 'dplayer', plugins_url('js/DPlayer.min.js', __FILE__), false, '1.0.9', false );
     106            wp_enqueue_script( 'dplayer', plugins_url('js/DPlayer.min.js', __FILE__), false, '1.0.10', false );
    85107            wp_enqueue_script( 'init-dplayer', plugins_url('js/init-dplayer.js', __FILE__), false, '1.0.0', false );
    86108            self::$add_script = true;
  • dplayer-for-wp/tags/1.0.8/readme.txt

    r1503969 r1507117  
    44Requires at least: 3.0.1
    55Tested up to: 4.6.1
    6 Stable tag: 1.0.7
     6Stable tag: 1.0.8
    77License: GPLv2 or later
    88License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    35351. Write the shortcode manually in your editor
    36362. Save and you’ll get this lovely danmuku video player!
     373. Config Danmaku API URL and token in settings page
    3738
    3839== Changelog ==
     40
     41= 1.0.8 =
     42* Add settings page for API URL and token
    3943
    4044= 1.0.7 =
  • dplayer-for-wp/trunk/dplayer.php

    r1503993 r1507117  
    33* Plugin Name: DPlayer for WordPress
    44* Description: Wow, such a lovely HTML5 danmaku video player comes to WordPress
    5 * Version: 1.0.7
     5* Version: 1.0.8
    66* Author: 0xBBC
    77* Author URI: https://blog.0xbbc.com/
    8 * License: GPLv2
    9 * License URI: http://www.gnu.org/licenses/gpl-2.0.html
     8* License: GPLv3
     9* License URI: http://www.gnu.org/licenses/gpl-3.0.html
    1010*
    1111* Acknowledgement
     
    1717*/
    1818
     19require_once( dirname( __FILE__ ) . '/dplayer-admin.php' );
     20
    1921class DPlayer {
    2022    static $add_script;
     
    2426        add_action( 'wp_footer', array( __CLASS__, 'add_script' ) );
    2527        add_shortcode( 'dplayer', array( __CLASS__, 'dplayer_load') );
     28        add_filter( 'plugin_action_links', array( __CLASS__, 'dplayer_settings_link' ), 9, 2 );
    2629    }
    2730   
     
    3033<script>var dPlayers = [];var dPlayerOptions = [];</script>
    3134<?php
     35    }
     36   
     37    // registers default options
     38    public static function dplayer_install() {
     39        add_option( 'kblog_danmaku_url', '//danmaku.daoapp.io' );
     40        add_option( 'kblog_danmaku_token', 'tokendemo' );
     41    }
     42   
     43    public static function dplayer_uninstall() {
     44        delete_option( 'kblog_danmaku_url' );
     45        delete_option( 'kblog_danmaku_token' );
    3246    }
    3347   
     
    6882        $danmaku = array(
    6983            'id' => md5($id),
    70             'token' => 'tokendemo',
    71             'api' => '//danmaku.daoapp.io/',
     84            'token' => get_option( 'kblog_danmaku_token', '' ),
     85            'api' => get_option( 'kblog_danmaku_url', '' ),
    7286        );
    7387        $data['danmaku'] = ($atts['danmu'] != 'false') ? $danmaku : null;
     
    8094    }
    8195   
     96    public static function dplayer_settings_link( $links, $file ) {
     97        if ( plugins_url('dplayer-admin.php', __FILE__) === $file && function_exists( 'admin_url' ) ) {
     98            $settings_link = '<a href="' . esc_url( admin_url( 'options-general.php?page=kblog-dplayer' ) ) . '">' . esc_html__( 'Settings' ) . '</a>';
     99            array_unshift( $links, $settings_link );
     100        }
     101        return $links;
     102    }
     103   
    82104    public static function add_script() {
    83105        if (!self::$add_script) {
    84             wp_enqueue_script( 'dplayer', plugins_url('js/DPlayer.min.js', __FILE__), false, '1.0.9', false );
     106            wp_enqueue_script( 'dplayer', plugins_url('js/DPlayer.min.js', __FILE__), false, '1.0.10', false );
    85107            wp_enqueue_script( 'init-dplayer', plugins_url('js/init-dplayer.js', __FILE__), false, '1.0.0', false );
    86108            self::$add_script = true;
  • dplayer-for-wp/trunk/readme.txt

    r1503969 r1507117  
    44Requires at least: 3.0.1
    55Tested up to: 4.6.1
    6 Stable tag: 1.0.7
     6Stable tag: 1.0.8
    77License: GPLv2 or later
    88License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    35351. Write the shortcode manually in your editor
    36362. Save and you’ll get this lovely danmuku video player!
     373. Config Danmaku API URL and token in settings page
    3738
    3839== Changelog ==
     40
     41= 1.0.8 =
     42* Add settings page for API URL and token
    3943
    4044= 1.0.7 =
Note: See TracChangeset for help on using the changeset viewer.