Changeset 2981712
- Timestamp:
- 10/20/2023 01:32:52 PM (2 years ago)
- Location:
- playerjs
- Files:
-
- 3 edited
-
tags/2.2/playerjs.php (modified) (8 diffs)
-
trunk/playerjs.php (modified) (5 diffs)
-
trunk/readme.txt (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
playerjs/tags/2.2/playerjs.php
r1979095 r2981712 3 3 * Plugin Name: PlayerJS 4 4 * Plugin URI: https://playerjs.com/docs/q=wordpress 5 * Description: Embed your player fromPlayerJS Builder and play HTML5 Video, Audio, HLS, DASH, YouTube, Vimeo6 * Version: 2.2 5 * Description: Embed your created player in PlayerJS Builder and play HTML5 Video, Audio, HLS, DASH, YouTube, Vimeo 6 * Version: 2.21 7 7 * Author: Playerjs.com 8 8 * Author URI: https://playerjs.com … … 29 29 class PLAYERJS_HTML5 { 30 30 31 var $plugin_version = '2. 1';31 var $plugin_version = '2.21'; 32 32 33 33 function __construct() { 34 34 define('PLAYERJS_VERSION', $this->plugin_version); 35 add_action('wp_enqueue_scripts',array($this, 'plugin_script')); 35 36 $this->plugin_includes(); 36 37 } 37 38 38 function plugin_ includes() {39 function plugin_script() { 39 40 $path = get_option('playerjs_com_script_path'); 40 41 $path = $path ? $path['input'] : ''; … … 42 43 $path = plugins_url('').'/playerjs/playerjs_default.js'; 43 44 } 44 45 45 wp_enqueue_script('playerjs-js', $path); 46 46 } 47 48 function plugin_includes() { 47 49 add_filter('the_content', 'playerjs_content' ); 48 50 add_shortcode('playerjs', 'playerjs_com_handler'); 49 50 51 51 add_filter('widget_text', 'do_shortcode'); 52 52 add_filter('the_excerpt', 'do_shortcode', 11); … … 66 66 } 67 67 68 function playerjs_content($str){ 69 $stack = array(); 70 $out = ''; 71 for ($i = 0, $l = strlen($str); $i < $l; ++$i) { 72 if ($str[$i] == "[") { 73 $stack[] = true; 74 75 if (count($stack) % 2) { // alternate between ( and [ 76 $out .= "["; 77 } else { 78 $out .= "["; 79 } 80 } else if ($str[$i] == "]") { 81 if (count($stack) % 2) { 82 $out .= "]"; 83 } else { 84 $out .= "]"; 85 } 86 array_pop($stack); 87 } else { 88 $out .= $str[$i]; 89 } 90 } 91 return $out; 68 function playerjs_content($x){ 69 $y = strpos($x,'[playerjs'); 70 if($y!==FALSE){ 71 $z = explode('[playerjs',$x); 72 for ($i = ($y===0?0:1); $i < count($z); $i++) { 73 $open=0; 74 $x1 = 'playerjs'; 75 for ($j = 0; $j < strlen($z[$i]); $j++) { 76 77 if ($z[$i][$j] == "]" && $open==0) { 78 break; 79 }else{ 80 if($z[$i][$j] == "["){ 81 $open++; 82 } 83 if($z[$i][$j] == "]"){ 84 $open--; 85 } 86 $x1.= $z[$i][$j]; 87 } 88 } 89 if($x1!=''){ 90 $x2 = str_replace('[','[',$x1); 91 $x2 = str_replace(']',']',$x2); 92 $x2 = str_replace("'",'‘',$x2); 93 $x = str_replace("[".$x1."]","[".$x2."]",$x); 94 } 95 } 96 } 97 return $x; 92 98 } 93 99 94 100 function playerjs_com_handler($atts) { 95 $x=''; 96 97 if(isset($atts['file'])){ 101 $x = ''; 102 $u = wp_get_current_user(); 103 104 if(isset($atts['file'])||isset($atts['replace'])){ 98 105 99 106 $r = rand(10000,20000); … … 101 108 $style = ''; 102 109 103 $vars = '';104 110 foreach ($atts as $k => $v){ 105 111 if(gettype($k) == "integer" && isset($k0)){ … … 111 117 } 112 118 foreach ($atts as $k => $v){ 119 $vars = ''; 113 120 $v = str_replace("[","[",$v); 114 121 $v = str_replace("]","]",$v); 115 122 $v = str_replace("»","",$v); 116 123 $v = str_replace("″","",$v); 117 118 if($k!='align' && $k!='margin' && $k!='width' && $k!='height'){ 124 $v = str_replace("”","",$v); 125 126 if(strpos($v,"[")!==false && strpos($v,"{")!==false){ 127 $v = str_replace("‘","pjs'qt",$v); 128 $v = str_replace("’","pjs'qt",$v); 129 $v = str_replace("′","pjs'qt",$v); 130 } 131 132 if($k=="file"){ 133 $r = md5($v); 134 $base = dirname( __FILE__ ) . '/admin/playerjs_base64.php'; 135 if(file_exists($base)){ 136 include_once($base); 137 $v = pjsBase64Encrypt($v); 138 } 139 } 140 141 142 143 $dont = false; 144 if($k=="watermark" && $v==1){ 145 if($u){ 146 if($u->data->ID>0){ 147 $vars.=',wid:"'.$u->data->user_login.'"'; 148 $dont = true; 149 } 150 } 151 } 152 153 if(!$dont && $k!='align' && $k!='margin' && $k!='width' && $k!='height'){ 119 154 $vars .= ','.$k.':"'.$v.'"'; 120 155 } 156 } 157 158 if(!isset($atts['replace'])){ 159 $vars.= ',id:"playerjs'.$r.'"'; 121 160 } 122 161 … … 134 173 // width 135 174 136 $width = playerjs_com_get_option('width',0 );175 $width = playerjs_com_get_option('width',0,''); 137 176 138 177 isset($atts['width'])?$width = $atts['width']:''; … … 159 198 } 160 199 161 162 163 $x = $height.($align=='center'?'<center>':'').'<div id="playerjs'.$r.'" '.($style!=''?'style="'.$style.'"':'').'></div>'.($align=='center'?'</center>':'').'<script>var player'.$r.' = new Playerjs({id:"playerjs'.$r.'"'.$vars.'});</script>'; 200 if(!isset($atts['replace'])){ 201 $x = ($align=='center'?'<center>':'').'<div id="playerjs'.$r.'" '.($style!=''?'style="'.$style.'"':'').'></div>'.($align=='center'?'</center>':''); 202 }else{ 203 $x = ''; 204 } 205 206 if(substr($vars,0,1)==","){ 207 $vars = substr($vars,1); 208 } 209 210 $x.='<script>var player'.$r.' = new Playerjs({'.$vars.'});</script>'; 164 211 165 212 } -
playerjs/trunk/playerjs.php
r2979265 r2981712 4 4 * Plugin URI: https://playerjs.com/docs/q=wordpress 5 5 * Description: Embed your created player in PlayerJS Builder and play HTML5 Video, Audio, HLS, DASH, YouTube, Vimeo 6 * Version: 2.2 16 * Version: 2.22 7 7 * Author: Playerjs.com 8 8 * Author URI: https://playerjs.com … … 29 29 class PLAYERJS_HTML5 { 30 30 31 var $plugin_version = '2.2 1';31 var $plugin_version = '2.22'; 32 32 33 33 function __construct() { … … 47 47 48 48 function plugin_includes() { 49 add_filter('the_content', 'playerjs_content' );49 add_filter('the_content', 'playerjs_content'); 50 50 add_shortcode('playerjs', 'playerjs_com_handler'); 51 51 add_filter('widget_text', 'do_shortcode'); 52 52 add_filter('the_excerpt', 'do_shortcode', 11); 53 53 add_filter('the_content', 'do_shortcode', 11); 54 } 55 56 } 57 54 add_filter('the_content', 'playerjs_content2',12); 55 add_filter( 'script_loader_tag', 'playerjs_async', 11, 2); 56 } 57 58 } 59 $GLOBALS['playerjs_configs'] = new stdClass(); 58 60 $GLOBALS['playerjs_player'] = new PLAYERJS_HTML5(); 59 61 60 62 } 61 63 64 } 65 66 function playerjs_async( $tag, $handle ) { 67 if ( 'playerjs-js' !== $handle ) { 68 return $tag; 69 } 70 return str_replace( ' src', ' async="async" src', $tag ); 62 71 } 63 72 … … 98 107 } 99 108 109 function playerjs_content2($x){ 110 $p = $GLOBALS['playerjs_configs']; 111 if(isset($p)){ 112 $x.= '<script>function PlayerjsAsync(){'; 113 foreach ($p as $k => $v){ 114 $x.='var '.$k.' = new Playerjs({'.$v.'});'; 115 } 116 } 117 return $x.'} if(window["Playerjs"]){PlayerjsAsync();}</script>'; 118 } 119 100 120 function playerjs_com_handler($atts) { 101 121 $x = ''; … … 207 227 $vars = substr($vars,1); 208 228 } 209 210 $x.='<script>var player'.$r.' = new Playerjs({'.$vars.'});</script>'; 211 229 $GLOBALS['playerjs_configs']->{'player'.$r} = $vars; 212 230 } 213 231 return $x; -
playerjs/trunk/readme.txt
r2979249 r2981712 146 146 = 2.20-2.21 = 147 147 * Bug fixed 148 149 = 2.22 = 150 * Asynchronous script loading
Note: See TracChangeset
for help on using the changeset viewer.