Changeset 961284
- Timestamp:
- 08/06/2014 07:58:03 PM (12 years ago)
- Location:
- zbplayer/trunk
- Files:
-
- 3 edited
-
readme.txt (modified) (2 diffs)
-
zbPlayer.admin.php (modified) (1 diff)
-
zbPlayer.php (modified) (12 diffs)
Legend:
- Unmodified
- Added
- Removed
-
zbplayer/trunk/readme.txt
r958291 r961284 4 4 Tags: mp3, flash player, audio, easy control, noJS, small mp3 player, embed, media player, music player, mp3 player, cyrillic mp3 player, facebook share, share mp3, m4a, m4b, mp4, m4a player, m4b player, mp4 player, wav, wav player 5 5 Requires at least: 3.5 6 Tested up to: 3.9. 17 Stable tag: 2.1. 76 Tested up to: 3.9.2 7 Stable tag: 2.1.8 8 8 License: Dual Licensed under the MIT and GPLv2 or later 9 9 … … 51 51 52 52 == Changelog == 53 54 = 2.1.8 = 55 * Fix links/file name problem. Sometime flash player did not understand correctly file names to play. 53 56 54 57 = 2.1.7 = -
zbplayer/trunk/zbPlayer.admin.php
r958291 r961284 7 7 * 8 8 * zbPlayer.admin.php 9 * Release 2.1. 7 July20149 * Release 2.1.8 August 2014 10 10 */ 11 11 // connect wordpress color picker 12 12 WP_Enqueue_Script('farbtastic'); 13 13 WP_Enqueue_Style('farbtastic'); 14 WP_Enqueue_Script('zbplayer-options', get_bloginfo('wpurl').'/'. Str_Replace("\\", '/', SubStr(RealPath(DirName(__FILE__)), Strlen(ABSPATH))) . '/js/zbPlayerColors.js');14 WP_Enqueue_Script('zbplayer-options', get_bloginfo('wpurl').'/'.str_replace("\\", '/', substr(realpath(dirname(__FILE__)), strlen(ABSPATH))) . '/js/zbPlayerColors.js'); 15 15 ?> 16 16 <div class="wrap"> -
zbplayer/trunk/zbPlayer.php
r958291 r961284 4 4 Plugin URI: http://gilevich.com/portfolio/zbplayer 5 5 Description: Converts mp3 files links to a small flash player and a link to download file mp3 file. Also you can share your mp3 files with that plugin. 6 Version: 2.1. 76 Version: 2.1.8 7 7 Author: Vladimir Gilevich 8 8 Author URI: http://gilevich.com/ … … 10 10 */ 11 11 12 define('ZBPLAYER_VERSION', "2.1. 7");12 define('ZBPLAYER_VERSION', "2.1.8"); 13 13 define('ZBPLAYER_DEFAULT_WIDTH', "500"); 14 14 define('ZBPLAYER_DEFAULT_INITIALVOLUME', "60"); … … 42 42 add_action('plugins_loaded', 'zbp_init'); 43 43 44 WP_Enqueue_Style('zbplayer-style', get_bloginfo('wpurl').'/'. Str_Replace("\\", '/', SubStr(RealPath(DirName(__FILE__)), Strlen(ABSPATH))) . '/css/zbPlayer.css');45 WP_Enqueue_Script('zbplayer-flash', get_bloginfo('wpurl').'/'. Str_Replace("\\", '/', SubStr(RealPath(DirName(__FILE__)), Strlen(ABSPATH))) . '/js/zbPlayerFlash.js');44 WP_Enqueue_Style('zbplayer-style', get_bloginfo('wpurl').'/'.str_replace("\\", '/', substr(realpath(dirname(__FILE__)), strlen(ABSPATH))) . '/css/zbPlayer.css'); 45 WP_Enqueue_Script('zbplayer-flash', get_bloginfo('wpurl').'/'.str_replace("\\", '/', substr(realpath(dirname(__FILE__)), strlen(ABSPATH))) . '/js/zbPlayerFlash.js'); 46 46 47 47 function zbp_init() … … 82 82 } 83 83 84 // Replace mp3 links in content with player 84 /** 85 * Replace mp3 links in content with player 86 * 87 * @param string $content 88 * @return string 89 */ 85 90 function zbp_content($content) 86 91 { … … 98 103 preg_match_all( $patternTitle, $matches[0][$key], $matchesTitle ); 99 104 $titles[] = isset($matchesTitle[2][0]) ? $matchesTitle[2][0] : urlencode( str_replace('_', '', strip_tags($matches[0][$key])) ); 100 $links[] = zbp_urlencode($link);105 $links[] = $link; 101 106 } 102 107 } … … 112 117 . ' flashvars="loop='.$loop.'&animation='.$animation.'&playerID=zbPlayer&initialvolume='.$initialvolume . zbp_get_color_srt() 113 118 . $titles 114 . '& soundFile='.implode(',',$links)119 . '&encode=yes&soundFile='.zbp_encode_source(implode(',',$links)) 115 120 . '&autostart='.$autostart.'" type="application/x-shockwave-flash" class="player" src="'.plugin_dir_url(__FILE__).'data/player.swf" id="zbPlayer"/></div>'; 116 121 $content = str_replace(get_option('zbp_collect_field'), $player, $content); … … 141 146 } 142 147 143 // Main code - insert player into content 148 /** 149 * Main code - insert player into content 150 * 151 * @param array $matches 152 * @return string 153 */ 144 154 function zbp_insert_player($matches) 145 155 { … … 180 190 . '<embed width="'.$width.'" height="26" wmode="transparent" menu="false" quality="high"' 181 191 . ' flashvars="loop='.$loop.'&animation='.$animation.'&playerID=zbPlayer&initialvolume='.$initialvolume . zbp_get_color_srt() 182 . $titles.'& soundFile='.zbp_urlencode($link)192 . $titles.'&encode=yes&soundFile='.zbp_encode_source($link) 183 193 . '&autostart='.$autostart.'" type="application/x-shockwave-flash" class="zbPlayerFlash" src="'.plugin_dir_url(__FILE__).'data/player.swf" id="zbPlayer"/>'; 184 194 $ret .= '<audio class="zbPlayerNative" src="'.$link.'" controls preload="none"></audio>'; … … 187 197 } 188 198 189 // own ulrencode method - need to convert to utf8 filename if it is not in utf8 199 /** 200 * Encodes the given string for flash player 201 * 202 * @param string $string String to encode 203 * @return the encoded string 204 */ 205 function zbp_encode_source($string) 206 { 207 $source = utf8_decode($string); 208 $ntexto = ""; 209 $codekey = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_-"; 210 for ($i = 0; $i < strlen($string); $i++) { 211 $ntexto .= substr("0000".base_convert(ord($string{$i}), 10, 2), -8); 212 } 213 $ntexto .= substr("00000", 0, 6-strlen($ntexto)%6); 214 $string = ""; 215 for ($i = 0; $i < strlen($ntexto)-1; $i = $i + 6) { 216 $string .= $codekey{intval(substr($ntexto, $i, 6), 2)}; 217 } 218 219 return $string; 220 } 221 222 /** 223 * own ulrencode method - need to convert to utf8 filename if it is not in utf8 224 * 225 * @param string $link 226 * @return stting 227 */ 190 228 function zbp_urlencode($link) 191 229 { … … 200 238 } 201 239 202 // pathinfo with UTF-8 encoded file names too. Special thanks Pietro Baricco 240 /** 241 * pathinfo with UTF-8 encoded file names too. Special thanks Pietro Baricco 242 * 243 * @param string $filepath 244 * @return array 245 */ 203 246 function zbp_mb_pathinfo($filepath) 204 247 { 205 preg_match('%^(.*?)[\\\\/]*(([^/\\\\]*?)(\.([^\.\\\\/]+?)|))[\\\\/\.]*$%im', $filepath,$m);206 if ($m[1]) $ret['dirname']=$m[1];207 if ($m[2]) $ret['basename']=$m[2];208 if ($m[5]) $ret['extension']=$m[5];209 if ($m[3]) $ret['filename']=$m[3];248 preg_match('%^(.*?)[\\\\/]*(([^/\\\\]*?)(\.([^\.\\\\/]+?)|))[\\\\/\.]*$%im', $filepath, $m); 249 if ($m[1]) $ret['dirname'] = $m[1]; 250 if ($m[2]) $ret['basename'] = $m[2]; 251 if ($m[5]) $ret['extension'] = $m[5]; 252 if ($m[3]) $ret['filename'] = $m[3]; 210 253 return $ret; 211 254 } 212 255 213 // replace special symbols to do not destoy flash vars 256 /** 257 * replace special symbols to do not destoy flash vars 258 * 259 * @param string $string 260 * @return string 261 */ 214 262 function zbp_flash_entities($string) 215 263 { 216 return str_replace(array("%", "&","'"), array("%25","%26","%27"),$string);264 return str_replace(array("%", "&","'"), array("%25","%26","%27"), $string); 217 265 } 218 266 … … 222 270 } 223 271 224 // Add the script 272 /** 273 * Add the script 274 */ 225 275 function zbp_add_pages() 226 276 { 227 277 // Add a new submenu under options 228 add_options_page('zbPlayer','zbPlayer','manage_options','zbplayer','zbp_manage_page'); 229 } 230 231 // Management Page 278 add_options_page('zbPlayer', 'zbPlayer', 'manage_options', 'zbplayer', 'zbp_manage_page'); 279 } 280 281 /** 282 * Management Page 283 */ 232 284 function zbp_manage_page() 233 285 { … … 236 288 237 289 238 // Setup Function 290 /** 291 * Setup Function 292 * 293 * @param string $ZBPLAYER_VERSION 294 */ 239 295 function zbp_setup($ZBPLAYER_VERSION) 240 296 { 241 update_option('zbp_version',$ZBPLAYER_VERSION); 242 } 243 244 // Loads language files according to locale (only does this once per request) 297 update_option('zbp_version', $ZBPLAYER_VERSION); 298 } 299 300 /** 301 * Loads language files according to locale (only does this once per request) 302 */ 245 303 function zbp_load_language_file() 246 304 {
Note: See TracChangeset
for help on using the changeset viewer.