diff options
author | Heckyel <heckyel@openmailbox.org> | 2017-02-08 11:42:04 -0500 |
---|---|---|
committer | Heckyel <heckyel@openmailbox.org> | 2017-02-08 11:42:04 -0500 |
commit | 1b6a7f73aeb1b664cb7d2dc54dfd2a2758c2631f (patch) | |
tree | 78719a22ccf140e79a39fdb062cc4b2db123a185 | |
parent | 03542d373a016a9388f56a0616975ed39f755f00 (diff) | |
download | librevideojs-html5-player-1b6a7f73aeb1b664cb7d2dc54dfd2a2758c2631f.tar.lz librevideojs-html5-player-1b6a7f73aeb1b664cb7d2dc54dfd2a2758c2631f.tar.xz librevideojs-html5-player-1b6a7f73aeb1b664cb7d2dc54dfd2a2758c2631f.zip |
order source code
-rw-r--r-- | librevideojs-html5-player.php | 160 |
1 files changed, 80 insertions, 80 deletions
diff --git a/librevideojs-html5-player.php b/librevideojs-html5-player.php index 0232548..f1108c1 100644 --- a/librevideojs-html5-player.php +++ b/librevideojs-html5-player.php @@ -10,25 +10,25 @@ License: GPLv3 or later Domain Path: /languages */ -if (!defined('ABSPATH')) { +if (!defined('ABSPATH')){ exit; } include_once 'GWP_bs3_panel_shortcode.php'; -if (!class_exists('LIBREVIDEOJS_HTML5_PLAYER')) { +if (!class_exists('LIBREVIDEOJS_HTML5_PLAYER')){ - class LIBREVIDEOJS_HTML5_PLAYER { + class LIBREVIDEOJS_HTML5_PLAYER{ var $plugin_version = '1.1.2'; - function __construct() { + function __construct(){ define('L_VERSION', $this->plugin_version); $this->plugin_includes(); } - function plugin_includes() { - if (is_admin()) { + function plugin_includes(){ + if (is_admin()){ add_filter('plugin_action_links', array($this, 'plugin_action_links'), 10, 2); } add_action('plugins_loaded', array($this, 'plugins_loaded_handler')); @@ -39,17 +39,16 @@ if (!class_exists('LIBREVIDEOJS_HTML5_PLAYER')) { add_filter('widget_text', 'do_shortcode'); add_filter('the_excerpt', 'do_shortcode', 11); add_filter('the_content', 'do_shortcode', 11); - } - function plugin_url() { + function plugin_url(){ if ($this->plugin_url) return $this->plugin_url; return $this->plugin_url = plugins_url(basename(plugin_dir_path(__FILE__)), basename(__FILE__)); } - function plugin_action_links($links, $file) { - if ($file == plugin_basename(dirname(__FILE__) . '/librevideojs-html5-player.php')) { + function plugin_action_links($links, $file){ + if ($file == plugin_basename(dirname(__FILE__) . '/librevideojs-html5-player.php')){ $links[] = '<a href="options-general.php?page=librevideojs-html5-player-settings">'.__('Settings', 'librevideojs-html5-player').'</a>'; } return $links; @@ -57,16 +56,16 @@ if (!class_exists('LIBREVIDEOJS_HTML5_PLAYER')) { function plugins_loaded_handler() { - load_plugin_textdomain('librevideojs-html5-player', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/'); + load_plugin_textdomain('librevideojs-html5-player', false, dirname( plugin_basename( __FILE__ )) . '/languages/'); } - function add_options_menu() { - if (is_admin()) { + function add_options_menu(){ + if (is_admin()){ add_options_page(__('LibreVideoJS Settings', 'librevideojs-html5-player'), __('LibreVideoJS HTML5 Player', 'librevideojs-html5-player'), 'manage_options', 'librevideojs-html5-player-settings', array($this, 'options_page')); } } - function options_page() { + function options_page(){ $url = "https://wordpress.org/plugins/librevideojs-html5-player"; $link_text = sprintf(wp_kses(__('For detailed documentation please visit the plugin homepage <a target="_blank" href="%s">here</a>.', 'librevideojs-html5-player'), array('a' => array('href' => array(), 'target' => array()))), esc_url($url)); ?> @@ -82,7 +81,7 @@ if (!class_exists('LIBREVIDEOJS_HTML5_PLAYER')) { } -function librevideojs_html5_player_enqueue_scripts() { +function librevideojs_html5_player_enqueue_scripts(){ global $post, $plugin_url; $plugin_url = plugins_url('', __FILE__); if (is_home() || is_single() && strpos($post->post_content, '[librevideojs_video') !== false){ @@ -98,11 +97,11 @@ function librevideojs_html5_player_enqueue_scripts() { wp_enqueue_script('lvjs', $plugin_url . '/librevideojs/js/cliplibrejs.dev.js', array(), L_VERSION); wp_enqueue_script('lvjs-selector', $plugin_url . '/librevideojs/selector/video-quality-selector.js', array(), L_VERSION); } else { - return false; - } + return false; + } } -function librevideojs_html5_video_embed_handler($atts, $content=null) { +function librevideojs_html5_video_embed_handler($atts, $content=null){ extract(shortcode_atts(array( 'url' => '', 'url_calidad' => '', @@ -126,7 +125,7 @@ function librevideojs_html5_video_embed_handler($atts, $content=null) { $src = '<source data-res="'.$url_calidad.'" src="'.$url.'" type="video/'.$code.'"/>'; //resolution selector - if (!empty($selector)) { + if(!empty($selector)){ $resolution = "$selector"; } else { @@ -134,7 +133,7 @@ function librevideojs_html5_video_embed_handler($atts, $content=null) { } //controls - if($controls == "false") { + if($controls == "false"){ $controls = ""; } else{ @@ -142,10 +141,10 @@ function librevideojs_html5_video_embed_handler($atts, $content=null) { } //preload - if($preload == "metadata") { + if($preload == "metadata"){ $preload = ' preload="metadata"'; } - else if($preload == "none") { + else if($preload == "none"){ $preload = ' preload="none"'; } else{ @@ -178,30 +177,30 @@ function librevideojs_html5_video_embed_handler($atts, $content=null) { //Tracks if(!is_null( $content )){ - $track = do_shortcode($content); + $track = do_shortcode($content); } else{ - $track = ""; + $track = ""; } //Qualities if(!is_null( $content = '' )){ - $calidades = do_shortcode($content); + $calidades = do_shortcode($content); } else{ - $calidades = ""; + $calidades = ""; } //skin theme - if (!empty($skin)) { - $_skin = "$skin"; + if(!empty($skin)){ + $_skin = "$skin"; } else{ - $_skin= "materialteal"; + $_skin= "materialteal"; } //poster - if(!empty($poster)) { + if(!empty($poster)){ $poster = " poster='$poster'"; } $player = "librevideojs" . uniqid(); @@ -237,61 +236,62 @@ EOT; /*Adding subtitles using... [track]*/ function track_shortcode($atts, $content=null){ - extract(shortcode_atts(array( - 'kind' => '', - 'subt' => '', - 'srclang' => '', - 'label' => '', - 'default' => '', - ), $atts)); - - if($kind){ - $kind = " kind='$kind'"; - } - - if($subt){ - $subt = " src='$subt'"; - } - - if($srclang){ - $srclang = " srclang='$srclang'"; - } - - if($label){ - $label = " label='$label'"; - } - - if($default == "true" || $default == "default"){ - $default = " default"; - } - else{ - $default = ""; - } - - $track = "<track" . $kind . $subt . $srclang . $label . $default . "/>\n\t\t"; - - return $track; + extract(shortcode_atts(array( + 'kind' => '', + 'subt' => '', + 'srclang' => '', + 'label' => '', + 'default' => '', + ), $atts)); + + if($kind){ + $kind = " kind='$kind'"; + } + + if($subt){ + $subt = " src='$subt'"; + } + + if($srclang){ + $srclang = " srclang='$srclang'"; + } + + if($label){ + $label = " label='$label'"; + } + + if($default == "true" || $default == "default"){ + $default = " default"; + } + else{ + $default = ""; + } + + $track = "<track" . $kind . $subt . $srclang . $label . $default . "/>\n\t\t"; + + return $track; } add_shortcode('track', 'track_shortcode'); /*Adding qualities*/ function calidades_shortcode($atts, $content=null){ - extract(shortcode_atts(array( - 'lvjs_calidad' => '', - 'src_video' => '', - 'lvjs_code' => '', - ), $atts)); - - if ($lvjs_calidad) { - $lvjs_calidad = " data-res='$lvjs_calidad'"; - } - if ($src_video) { - $src_video = " src='$src_video'"; - } - - $calidades = "<source" . $lvjs_calidad . $src_video . " type='video/".$lvjs_code."'/>\n\t\t"; - - return $calidades; + extract(shortcode_atts(array( + 'lvjs_calidad' => '', + 'src_video' => '', + 'lvjs_code' => '', + ), $atts)); + + if($lvjs_calidad){ + $lvjs_calidad = " data-res='$lvjs_calidad'"; + } + + if($src_video){ + $src_video = " src='$src_video'"; + } + + $calidades = "<source" . $lvjs_calidad . $src_video . " type='video/".$lvjs_code."'/>\n\t\t"; + + return $calidades; } add_shortcode('calidades', 'calidades_shortcode'); |