PowerPress Podcasting plugin by Blubrry - Version 0.9.0

Version Description

Download this release

Release Info

Developer amandato
Plugin Icon 128x128 PowerPress Podcasting plugin by Blubrry
Version 0.9.0
Comparing to
See all releases

Code changes from version 0.8.3 to 0.9.0

images/blubrry_folder.png ADDED
Binary file
player.js CHANGED
@@ -1,13 +1,14 @@
1
  /**
2
- * jsMediaPlayer 1.1.1 for Blubrry PowerPress
3
  *
4
  * http://www.blubrry.com/powepress/
5
  *
6
- * Copyright (c) 2008 Angelo Mandato (angelo [at] mandato {period} com)
7
  *
8
  * Released under Aoache 2 license:
9
  * http://www.apache.org/licenses/LICENSE-2.0
10
  *
 
11
  * versoin 1.1.3 - 03/23/2009 - Added code to support FlowPlayer v3.
12
  * versoin 1.1.2 - 03/04/2009 - Added options to set the width for audio, width and height for video.
13
  * versoin 1.1.1 - 12/22/20008 - Minor change to support Windows Media in Firefox. Includes link to preferred Firefox Windows Media Player plugin.
@@ -18,463 +19,65 @@
18
  * version 1.0.0 - 07/26/2008 - initial release
19
  */
20
 
21
- var g_bpPlayer = false;
22
 
23
  /**
24
- Initialize function for javascript based player
25
 
26
- @PluginURL - where plugin files are located
27
- @QuicktimeImage - image displayed in place of quicktime media types
28
- @OnlyOnePlayer - pass 'true' if only one player should appear in the current page.
 
29
  */
30
- function powerpress_player_init(PluginURL, QuicktimeImage)
31
  {
32
- var FlowPlayerVer = 2;
33
- if( powerpress_player_init.arguments.length > 3 )
34
- FlowPlayerVer = powerpress_player_init.arguments[3];
35
-
36
- if( g_bpPlayer == false && FlowPlayerVer == 3 )
37
- {
38
- g_bpPlayer = new jsMediaPlayer(PluginURL +'flowplayer-3.0.7.swf');
39
- g_bpPlayer.FlashSrcPlugin( PluginURL + 'flowplayer.audio-3.0.4.swf');
40
- }
41
- else
42
  {
43
- g_bpPlayer = new jsMediaPlayer(PluginURL +'FlowPlayerClassic.swf');
44
- }
45
-
46
- g_bpPlayer.PlayImage(QuicktimeImage);
47
- if( powerpress_player_init.arguments.length > 2 )
48
- g_bpPlayer.OnePlayerOnly(powerpress_player_init.arguments[2]);
49
- }
50
-
51
- /**
52
- Initialize function for javascript based player
53
-
54
- @Width - width of player
55
- @Height - height of player
56
- @WidthAudio - width of player (mp3 audio only)
57
- */
58
- function powerpress_player_size(Width, Height, WidthAudio)
59
- {
60
- if( g_bpPlayer )
61
- {
62
- if( Width >= 100 )
63
- g_bpPlayer.SetWidth(Width);
64
- if( Height >= 24 )
65
- g_bpPlayer.SetHeight(Height);
66
- if( WidthAudio >= 100 )
67
- g_bpPlayer.SetWidthAudio(WidthAudio);
68
  }
69
- }
70
-
71
- /**
72
- play media in page function
73
-
74
- @MediaURL - complete url to media file
75
- @PlayerDiv - Destiniation div id for player
76
- @AutoPlay - Automatically start playing media file
77
- */
78
- function powerpress_play_page()
79
- {
80
- if( !g_bpPlayer )
81
- return true; // Let the link handle itself
82
-
83
- var media_url = powerpress_play_page.arguments[0];
84
- var player_div = powerpress_play_page.arguments[1];
85
- var auto_play = false;
86
- if( powerpress_play_page.arguments.length > 2 && powerpress_play_page.arguments[2] )
87
- auto_play = true;
88
 
89
- return g_bpPlayer.PlayInPage(media_url, player_div, auto_play);
90
  }
91
 
92
  /**
93
- play media in new window function
94
 
95
- @MediaURL - complete url to media file
96
- @AutoPlay - Automatically start playing media file
 
 
97
  */
98
- function powerpress_play_window()
99
  {
100
- if( !g_bpPlayer )
101
- return true; // Let the link handle itself
102
-
103
- var media_url = powerpress_play_window.arguments[0];
104
- var auto_play = true; // Always auto play new window plays
105
-
106
- return g_bpPlayer.PlayNewWindow(media_url);
107
- }
108
-
109
- function jsMediaPlayer(FlashSrc) {
110
- // Member variables
111
- this.m_flash_src = FlashSrc;
112
- this.m_width = 320;
113
- this.m_height = 240;
114
- this.m_widthAudio = 320;
115
- this.m_player_div = false;
116
- this.m_player_wnd = false;
117
- this.m_one_player_only = false;
118
- this.m_media_url = false;
119
- this.m_play_image = false;
120
- this.m_FlowPlayerVer = 2;
121
- this.m_flash_src_plugin = '';
122
-
123
-
124
- this.FlashSrc=function(Src) {
125
- this.m_flash_src = Src;
126
- }
127
-
128
- this.SetWidth=function(Width) {
129
- this.m_width = Width;
130
- }
131
-
132
- this.SetHeight=function(Height) {
133
- this.m_height = Height;
134
- }
135
-
136
- this.SetWidthAudio=function(Width) {
137
- this.m_widthAudio = Width;
138
- }
139
-
140
- this.OnePlayerOnly=function(Setting) {
141
- this.m_one_player_only = Setting;
142
- }
143
-
144
- this.FlashSrcPlugin=function(Src) {
145
- this.m_FlowPlayerVer = (Src==''?2:3);
146
- this.m_flash_src_plugin = Src;
147
- }
148
-
149
- this.PlayImage=function(URL) {
150
- this.m_play_image = URL;
151
- }
152
-
153
- this.PlayInPage = function() {
154
-
155
- // Check if we should even use javascript based player
156
- if( this._passthru() )
157
- return true;
158
-
159
- // Make sure we're not already playing this div...
160
- if( this.m_player_div == this.PlayInPage.arguments[1] )
161
- return false;
162
-
163
- // Close the last opened player
164
- if( this.m_one_player_only )
165
- this._closePrevPlayer();
166
-
167
- // Set the proeprties:
168
- this.m_media_url = this.PlayInPage.arguments[0];
169
- this.m_player_div = this.PlayInPage.arguments[1];
170
- var auto_play = false;
171
- if( this.PlayInPage.arguments.length > 2 && this.PlayInPage.arguments[2] )
172
- auto_play = true;
173
-
174
- var ext = this._getExt(this.m_media_url);
175
- switch( ext )
176
- {
177
- case 'm4v':
178
- case 'm4a':
179
- case 'avi':
180
- case 'mpg':
181
- case 'mpeg':
182
- case 'mp4':
183
- case 'qt':
184
- case 'mov': {
185
-
186
- if( this.m_play_image && auto_play == false )
187
- {
188
- document.getElementById( this.m_player_div ).innerHTML = '<a href="'+ this.m_media_url +'" onclick="return powerpress_play_page(\''+ this.m_media_url +'\', \''+ this.m_player_div +'\',\'true\');" title="Play on page"><img src="'+ this.m_play_image +'" alt="Play on page" /></a>';
189
- this.m_player_div = false; // Let this player be used again on the page
190
- return false;
191
- }
192
-
193
- var contentType = 'video/mpeg'; // Default content type
194
- if( ext == 'm4v' )
195
- contentType = 'video/x-m4v';
196
- else if( ext == 'm4a' )
197
- contentType = 'audio/x-m4a';
198
- else if( ext == 'avi' )
199
- contentType = 'video/avi';
200
- else if( ext == 'qt' || ext == 'mov' )
201
- contentType = 'video/quicktime';
202
-
203
- document.getElementById( this.m_player_div ).innerHTML = this._getQuickTime(contentType, auto_play);
204
- }; break;
205
- case 'wma':
206
- case 'wmv':
207
- case 'asf': {
208
-
209
- if( navigator.userAgent.indexOf("Firefox") !=-1 && this.m_play_image && auto_play == false )
210
- {
211
- document.getElementById( this.m_player_div ).innerHTML = '<a href="'+ this.m_media_url +'" onclick="return powerpress_play_page(\''+ this.m_media_url +'\', \''+ this.m_player_div +'\',\'true\');" title="Play on page"><img src="'+ this.m_play_image +'" alt="Play on page" /></a>';
212
- this.m_player_div = false; // Let this player be used again on the page
213
- return false;
214
- }
215
-
216
- if( navigator.userAgent.indexOf("Firefox") !=-1 ) // Firefox:
217
- document.getElementById( this.m_player_div ).innerHTML = this._getWinPlayerFirefox(auto_play);
218
- else
219
- document.getElementById( this.m_player_div ).innerHTML = this._getWinPlayer(auto_play);
220
- }; break;
221
- case 'rm': {
222
- document.getElementById( this.m_player_div ).innerHTML = this._getRealPlayer(auto_play);
223
- }
224
- case 'swf': {
225
- document.getElementById( this.m_player_div ).innerHTML = this._getFlash(auto_play);
226
- }
227
- case 'flv': {
228
- this._doFlowPlayer(0, auto_play);
229
- }; break;
230
- case 'mp3': {
231
- this._doFlowPlayer(24, auto_play);
232
-
233
- }; break;
234
- default: {
235
- return true; // We didn't handle this, so lets let the click to the media handle itself.
236
- };
237
- }
238
-
239
- // Display the div
240
- document.getElementById( this.m_player_div ).style.display = 'block';
241
- return false; // Don't let the href go
242
- }
243
-
244
- this.PlayNewWindow=function() {
245
-
246
- // Check if we should even use javascript based player
247
- if( this._passthru() )
248
- return true;
249
-
250
- if( this.m_one_player_only )
251
- this._closePrevPlayer();
252
-
253
- // Get the media file and extension
254
- this.m_media_url = this.PlayNewWindow.arguments[0];
255
- var ext = this._getExt(this.m_media_url);
256
-
257
- // Calculate the window height
258
- height = this.m_height;
259
- if( ext == 'mp3' )
260
- {
261
- height = 24;
262
- // Adjust the height for Opera web browser, only needed for mp3s
263
- if( navigator.userAgent.indexOf("Opera") != -1 )
264
- height += 40;
265
- }
266
- else
267
- height += 40; // Add area for menu navigation
268
-
269
- this.m_player_wnd = window.open(null,"jsPlayer", 'toolbar=0,status=0,resizable=1,width='+ (this.m_width +40).toString() +',height='+ height.toString() )
270
- var Html = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">';
271
- Html += '<html xmlns="http://www.w3.org/1999/xhtml">';
272
- Html += '<head>';
273
- Html += '<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />';
274
- Html += '<title>Media Player</title>';
275
- if( ext == 'mp3' || ext == 'flv' || ext == 'mp4' )
276
- {
277
- Html += '<script type="text/javascript">\n';
278
- Html += 'function flashembed(root,userParams,flashvars){function getHTML(){var html="";if(typeof flashvars==\'function\'){flashvars=flashvars();}if(navigator.plugins&&navigator.mimeTypes&&navigator.mimeTypes.length){html=\'<embed type="application/x-shockwave-flash" \';if(params.id){extend(params,{name:params.id});}for(var key in params){if(params[key]!==null){html+=[key]+\'="\'+params[key]+\'"\\n\\t\';}}if(flashvars){html+=\'flashvars=\\\'\'+concatVars(flashvars)+\'\\\'\';}html+=\'/>\';}else{html=\'<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" \';html+=\'width="\'+params.width+\'" height="\'+params.height+\'"\';if(!params.id&&document.all){params.id="_"+(""+Math.random()).substring(5);}if(params.id){html+=\' id="\'+params.id+\'"\';}html+=\'>\';html+=\'\\n\\t<param name="movie" value="\'+params.src+\'" />\';params.id=params.src=params.width=params.height=null;for(var k in params){if(params[k]!==null){html+=\'\\n\\t<param name="\'+k+\'" value="\'+params[k]+\'" />\';}}if(flashvars){html+=\'\\n\\t<param name="flashvars" value=\\\'\'+concatVars(flashvars)+\'\\\' />\';}html+="</object>";if(debug){alert(html);}}return html;}function init(name){var timer=setInterval(function(){var doc=document;var el=doc.getElementById(name);if(el){flashembed(el,userParams,flashvars);clearInterval(timer);}else if(doc&&doc.getElementsByTagName&&doc.getElementById&&doc.body){clearInterval(timer);}},13);return true;}function extend(to,from){if(from){for(key in from){if(from.hasOwnProperty(key)){to[key]=from[key];}}}}var params={src:\'#\',width:\'100%\',height:\'100%\',version:null,onFail:null,expressInstall:null,debug:false,bgcolor:\'#ffffff\',allowfullscreen:true,allowscriptaccess:\'always\',quality:\'high\',type:\'application/x-shockwave-flash\',pluginspage:\'http://www.adobe.com/go/getflashplayer\'};if(typeof userParams==\'string\'){userParams={src:userParams};}extend(params,userParams);var version=flashembed.getVersion();var required=params.version;var express=params.expressInstall;var debug=params.debug;if(typeof root==\'string\'){var el=document.getElementById(root);if(el){root=el;}else{return init(root);}}if(!root){return;}if(!required||flashembed.isSupported(required)){params.onFail=params.version=params.expressInstall=params.debug=null;root.innerHTML=getHTML();return root.firstChild;}else if(params.onFail){var ret=params.onFail.call(params,flashembed.getVersion(),flashvars);if(ret){root.innerHTML=ret;}}else if(required&&express&&flashembed.isSupported([6,65])){extend(params,{src:express});flashvars={MMredirectURL:location.href,MMplayerType:\'PlugIn\',MMdoctitle:document.title};root.innerHTML=getHTML();}else{if(root.innerHTML.replace(/\\s/g,\'\')!==\'\'){}else{root.innerHTML="<h2>Flash version "+required+" or greater is required</h2>"+"<h3>"+(version[0]>0?"Your version is "+version:"You have no flash plugin installed")+"</h3>"+"<p>Download latest version from <a href=\'"+params.pluginspage+"\'>here</a></p>";}}function concatVars(vars){var out="";for(var key in vars){if(vars[key]){out+=[key]+\'=\'+asString(vars[key])+\'&\';}}return out.substring(0,out.length-1);}function asString(obj){switch(typeOf(obj)){case\'string\':return\'"\'+obj.replace(new RegExp(\'(["\\\\\\\\])\',\'g\'),\'\\\\$1\')+\'"\';case\'array\':return\'[\'+map(obj,function(el){return asString(el);}).join(\',\')+\']\';case\'function\':return\'"function()"\';case\'object\':var str=[];for(var prop in obj){if(obj.hasOwnProperty(prop)){str.push(\'"\'+prop+\'":\'+asString(obj[prop]));}}return\'{\'+str.join(\',\')+\'}\';}return String(obj).replace(/\\s/g," ").replace(/\\\'/g,"\\"");}function typeOf(obj){if(obj===null||obj===undefined){return false;}var type=typeof obj;return(type==\'object\'&&obj.push)?\'array\':type;}if(window.attachEvent){window.attachEvent("onbeforeunload",function(){__flash_unloadHandler=function(){};__flash_savedUnloadHandler=function(){};});}function map(arr,func){var newArr=[];for(var i in arr){if(arr.hasOwnProperty(i)){newArr[i]=func(arr[i]);}}return newArr;}return root;}if(typeof jQuery==\'function\'){(function($){$.fn.extend({flashembed:function(params,flashvars){return this.each(function(){flashembed(this,params,flashvars);});}});})(jQuery);}flashembed=flashembed||{};flashembed.getVersion=function(){var version=[0,0];if(navigator.plugins&&typeof navigator.plugins["Shockwave Flash"]=="object"){var _d=navigator.plugins["Shockwave Flash"].description;if(typeof _d!="undefined"){_d=_d.replace(/^.*\\s+(\\S+\\s+\\S+$)/,"$1");var _m=parseInt(_d.replace(/^(.*)\\..*$/,"$1"),10);var _r=/r/.test(_d)?parseInt(_d.replace(/^.*r(.*)$/,"$1"),10):0;version=[_m,_r];}}else if(window.ActiveXObject){try{var _a=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");}catch(e){try{_a=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");version=[6,0];_a.AllowScriptAccess="always";}catch(ee){if(version[0]==6){return;}}try{_a=new ActiveXObject("ShockwaveFlash.ShockwaveFlash");}catch(eee){}}if(typeof _a=="object"){_d=_a.GetVariable("$version");if(typeof _d!="undefined"){_d=_d.replace(/^\\S+\\s+(.*)$/,"$1").split(",");version=[parseInt(_d[0],10),parseInt(_d[2],10)];}}}return version;};flashembed.isSupported=function(version){var now=flashembed.getVersion();var ret=(now[0]>version[0])||(now[0]==version[0]&&now[1]>=version[1]);return ret;};\n';
279
- Html += '</script>\n';
280
- }
281
- Html += '</head>';
282
- Html += '<body>';
283
-
284
- Html += '<div id="player" style="margin-top: 20px; margin-left: 10px;">';
285
- if( ext != 'mp3' && ext != 'flv' && ext != 'mp4' )
286
- {
287
- switch( ext )
288
- {
289
- case 'm4v':
290
- case 'm4a':
291
- case 'avi':
292
- case 'mpg':
293
- case 'mpeg':
294
- case 'qt':
295
- case 'mov': {
296
-
297
- var contentType = 'video/mpeg'; // Default content type
298
- if( ext == 'm4v' )
299
- contentType = 'video/x-m4v';
300
- else if( ext == 'm4a' )
301
- contentType = 'audio/x-m4a';
302
- else if( ext == 'avi' )
303
- contentType = 'video/avi';
304
- else if( ext == 'qt' || ext == 'mov' )
305
- contentType = 'video/quicktime';
306
-
307
- Html += this._getQuickTime(contentType, true);
308
- }; break;
309
- case 'wma':
310
- case 'wmv':
311
- case 'asf': {
312
-
313
- if( navigator.userAgent.indexOf("Firefox") !=-1 ) // Firefox:
314
- {
315
- Html += '<style>body { font-family: Arial, Helvetica, Sans-Serif; font-size: 90%;}</style>';
316
- Html += this._getWinPlayerFirefox(true);
317
- }
318
- else
319
- {
320
- Html += this._getWinPlayer(true);
321
- }
322
- }; break;
323
- case 'rm': {
324
- Html += this._getRealPlayer(true);
325
- }; break;
326
- case 'swf': {
327
- Html += this._getFlash(true);
328
- }; break;
329
- }
330
- }
331
- Html += '</div>';
332
- if( ext == 'mp3' || ext == 'flv' || ext == 'mp4' )
333
- {
334
- Html += '<script type="text/javascript">\n';
335
- if( ext == 'mp3' )
336
- Html += this._getFlowPlayer('player', 24, true);
337
- else
338
- Html += this._getFlowPlayer('player', this.m_height, true);
339
- Html += '</script>\n';
340
- }
341
- Html += '</body>';
342
- Html += '</html>';
343
- this.m_player_wnd.document.write( Html );
344
- this.m_player_wnd.document.close();
345
- this.m_player_wnd.focus();
346
- return false;
347
- }
348
-
349
- /*
350
- Private functions:
351
- */
352
- this._doFlowPlayer = function() {
353
-
354
- var height = this.m_height;
355
- var width = this.m_width;
356
- var auto_play = false;
357
- if( this._doFlowPlayer.arguments.length > 0 && this._doFlowPlayer.arguments[0] > 0 )
358
- height = this._doFlowPlayer.arguments[0];
359
- if( this._doFlowPlayer.arguments.length > 1 )
360
- auto_play = this._doFlowPlayer.arguments[1];
361
- if( height == 24 )
362
- width = this.m_widthAudio;
363
- if( this.m_FlowPlayerVer == 3 )
364
- {
365
- flashembed(
366
- this.m_player_div,
367
- {src: this.m_flash_src, width: width, height: height },
368
- {
369
- config: {
370
- plugins: {
371
- controls: {
372
- borderRadius: '0',
373
- durationColor: '#000000',
374
- timeColor: '#ECECEC',
375
- sliderColor: '#6F6F6F',
376
- sliderGradient: 'low',
377
- progressColor: '#6F6F6F',
378
- progressGradient: 'low',
379
- bufferColor: '#CCCCCC',
380
- bufferGradient: 'low',
381
- buttonColor: '#6F6F6F',
382
- buttonOverColor: '#7F7F7F',
383
- backgroundColor: '#9F9F9F',
384
- backgroundGradient: 'low',
385
- fullscreen: false,
386
- opacity:1.0
387
- },
388
- audio: {
389
- url: this.m_flash_src_plugin
390
- }
391
- },
392
- clip: {
393
- autoPlay: false,
394
- autoBuffering: false,
395
- url: this.m_media_url
396
- }
397
- }
398
- }
399
- );
400
- // {config: { autoPlay: auto_play?true:false, autoBuffering: false, initialScale: 'scale', showFullScreenButton: false, showMenu: false, videoFile: this.m_media_url, loop: false, autoRewind: true } }
401
- }
402
- else
403
- {
404
- flashembed(
405
- this.m_player_div,
406
- {src: this.m_flash_src, width: width, height: height },
407
- {config: { autoPlay: auto_play?true:false, autoBuffering: false, initialScale: 'scale', showFullScreenButton: false, showMenu: false, videoFile: this.m_media_url, loop: false, autoRewind: true } }
408
- );
409
- }
410
-
411
- return false;
412
- }
413
-
414
- this._getFlowPlayer = function(destDiv) {
415
-
416
- var height = this.m_height;
417
- if( this._getFlowPlayer.arguments.length > 1 )
418
- height = this._getFlowPlayer.arguments[1];
419
-
420
- var width = this.m_width;
421
- if( height == 24 ) // Player height
422
- width = this.m_widthAudio;
423
-
424
- var auto_play = false;
425
- if( this._getFlowPlayer.arguments.length > 2 )
426
- auto_play = this._getFlowPlayer.arguments[2];
427
-
428
- var Html = '';
429
- Html += "flashembed(\n";
430
- Html += " '"+ destDiv +"', \n";
431
- Html += " {src: '"+ this.m_flash_src +"', width: "+ width +", height: "+ height +"}, \n";
432
- Html += " {config: { autoPlay: "+ (auto_play?'true':'false') +", duration: 633, autoBuffering: false, initialScale: 'scale', showFullScreenButton: false, showMenu: false, videoFile: '"+ this.m_media_url +"', loop: false, autoRewind: true } } \n";
433
- Html += " ); \n";
434
- return Html;
435
- }
436
-
437
- this._getFlash = function() {
438
- var auto_play = false;
439
- if( this._getFlash.arguments.length > 0 )
440
- auto_play = this._getFlash.arguments[0];
441
-
442
- var Html = '';
443
- Html += '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0"'+ (auto_play?'':' play="false"') +' width="'+ this.m_width +'" height="'+ this.m_height +'" menu="true">\n';
444
- Html += ' <param name="movie" value="'+ this.m_media_url +'" />\n';
445
- Html += ' <param name="quality" value="high" />\n';
446
- Html += ' <param name="menu" value="true" />\n';
447
- Html += ' <param name="scale" value="noorder" />\n';
448
- Html += ' <param name="quality" value="high" />\n';
449
- Html += ' <embed src="'+ this.m_media_url +'" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash"'+ (auto_play?'':' play="false"') +' width="'+ this.m_width +'" height="'+ this.m_height +'" menu="true"></embed>';
450
- Html += '</object>\n';
451
- return Html;
452
- }
453
-
454
- this._getRealPlayer = function() {
455
- var auto_play = false;
456
- if( this._getRealPlayer.arguments.length > 0 )
457
- auto_play = this._getRealPlayer.arguments[0];
458
-
459
- var Html = '';
460
- Html += '<object id="realplayer" classid="clsid:cfcdaa03-8be4-11cf-b84b-0020afbbccfa" width="'+ this.m_width +'" height="'+ this.m_height +'">\n';
461
- Html += ' <param name="src" value="'+ this.m_media_url +'" />\n';
462
- Html += ' <param name="autostart" value="'+ (auto_play?'true':'false') +'" />\n';
463
- Html += ' <param name="controls" value="imagewindow,controlpanel" />\n';
464
- Html += ' <embed src="'+ this.m_media_url +'" width="'+ this.m_width +'" height="'+ this.m_height +'" autostart="'+(auto_play?'true':'false')+'" controls="imagewindow,controlpanel" type="audio/x-pn-realaudio-plugin"></embed>';
465
- Html += '</object>\n';
466
- return Html;
467
- }
468
-
469
- this._getWinPlayer = function() {
470
- var auto_play = false;
471
- if( this._getWinPlayer.arguments.length > 0 )
472
- auto_play = this._getWinPlayer.arguments[0];
473
-
474
  var Html = '';
475
- Html += '<object id="winplayer" classid="clsid:6BF52A52-394A-11d3-B153-00C04F79FAA6" width="'+ this.m_width +'" height="'+ this.m_height +'" standby="Media is loading..." type="application/x-oleobject">\n';
476
- Html += ' <param name="url" value="'+ this.m_media_url +'" />\n';
477
- Html += ' <param name="AutoStart" value="'+ (auto_play?'true':'false') +'" />\n';
478
  Html += ' <param name="AutoSize" value="true" />\n';
479
  Html += ' <param name="AllowChangeDisplaySize" value="true" />\n';
480
  Html += ' <param name="standby" value="Media is loading..." />\n';
@@ -484,146 +87,41 @@ function jsMediaPlayer(FlashSrc) {
484
  Html += ' <param name="ShowCaptioning" value="false" />\n';
485
  Html += ' <param name="ShowDisplay" value="false" />\n';
486
  Html += ' <param name="ShowStatusBar" value="false" />\n';
487
- Html += ' <embed type="application/x-mplayer2" src="'+ this.m_media_url +'" width="'+ this.m_width +'" height="'+ this.m_height +'" scale="aspect" AutoStart="'+ (auto_play?'true':'false') +'" ShowDisplay="0" ShowStatusBar="0" AutoSize="1" AnimationAtStart="1" AllowChangeDisplaySize="1" ShowControls="1"></embed>\n';
488
  Html += '</object>\n';
489
- return Html;
 
490
  }
491
-
492
- this._getWinPlayerFirefox = function() {
493
- var auto_play = false;
494
- if( this._getWinPlayerFirefox.arguments.length > 0 )
495
- auto_play = this._getWinPlayerFirefox.arguments[0];
496
 
497
- var Html = '';
498
- Html += '<object id="winplayer" data="' + this.m_media_url +'" width="'+ this.m_width +'" height="'+ this.m_height +'" type="application/x-ms-wmp">\n';
499
- Html += ' <param name="url" value="'+ this.m_media_url +'" />\n';
500
- Html += ' <param name="AutoStart" value="'+ (auto_play?'true':'false') +'" />\n';
501
- Html += ' <param name="AutoSize" value="true" />\n';
502
- Html += ' <param name="AllowChangeDisplaySize" value="true" />\n';
503
- Html += ' <param name="standby" value="Media is loading..." />\n';
504
- Html += ' <param name="AnimationAtStart" value="true" />\n';
505
- Html += ' <param name="scale" value="aspect" />\n';
506
- Html += ' <param name="ShowControls" value="true" />\n';
507
- Html += ' <param name="ShowCaptioning" value="false" />\n';
508
- Html += ' <param name="ShowDisplay" value="false" />\n';
509
- Html += ' <param name="ShowStatusBar" value="false" />\n';
510
- Html += '</object>\n';
511
- Html += '<p style="font-size: 85%;margin-top:0;">Best viewed with <a href="http://support.mozilla.com/en-US/kb/Using+the+Windows+Media+Player+plugin+with+Firefox#Installing_the_plugin" target="_blank">';
512
- Html += 'Windows Media Player plugin for Firefox</a></p>\n';
513
- return Html;
514
- }
515
 
516
- this._getQuickTime = function() {
517
-
518
- var contentType = 'video/mpeg';
519
- var auto_play = false;
520
- if( this._getQuickTime.arguments.length > 0 )
521
- contentType = this._getQuickTime.arguments[0];
522
- if( this._getQuickTime.arguments.length > 1 )
523
- auto_play = this._getQuickTime.arguments[1];
524
-
525
  var Html = '';
526
- Html += '<object classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" width="'+ this.m_width +'" height="'+ this.m_height +'" codebase="http://www.apple.com/qtactivex/qtplugin.cab">\n';
527
- Html += ' <param name="src" value="'+ this.m_media_url +'" />\n';
528
- Html += ' <param name="href" value="'+ this.m_media_url +'" />\n';
529
- Html += ' <param name="scale" value="aspect" />\n';
530
- Html += ' <param name="controller" value="true" />\n';
531
- Html += ' <param name="autoplay" value="'+ (auto_play?'true':'false') +'" />\n';
532
- Html += ' <param name="bgcolor" value="000000" />\n';
533
- Html += ' <param name="pluginspage" value="http://www.apple.com/quicktime/download/" />\n';
534
- Html += ' <embed src="'+ this.m_media_url +'" type="'+ contentType +'" width="'+ this.m_width +'" height="'+ this.m_height +'" scale="aspect" cache="true" bgcolor="000000" autoplay="'+ (auto_play?'true':'false') +'" controller="true" pluginspage="http://www.apple.com/quicktime/download/"></embed>';
535
  Html += '</object>\n';
536
- return Html;
 
537
  }
538
-
539
- this._getExt = function(File) {
540
- // First remove any anchor if any
541
- var anchor = File.indexOf('#');
542
- if( anchor > -1 )
543
- File = File.substring(0, anchor);
544
- // Next, get rid of the query string if exists..
545
- var question = File.indexOf('?');
546
- if( question > -1 )
547
- File = File.substring(0, question);
548
- // Find the last dot at the end of the file
549
- var dot = File.lastIndexOf('.');
550
- if( dot > -1 )
551
- return File.substring(dot+1).toLowerCase();
552
- return false; // Unable to find a file extension
553
- }
554
-
555
- this._passthru = function() {
556
-
557
- // If we have ourselves an iPhone, let the media passtru when clicked
558
- if( navigator.userAgent.indexOf("iPhone") != -1 )
559
- return true; // Let this client download and play the content itself.
560
-
561
- // Add additional user agents which cannot handle embed, object or flash code here:
562
-
563
- return false;
564
- }
565
-
566
- this._closePrevPlayer = function() {
567
- if( this.m_player_div )
568
- {
569
- document.getElementById( this.m_player_div ).innerHTML = '';
570
- document.getElementById( this.m_player_div ).style.display = 'none';
571
- this.m_player_div = false;
572
- }
573
- if( this.m_player_wnd )
574
- {
575
- this.m_player_wnd.close();
576
- this.m_player_wnd = false;
577
- }
578
- }
579
- }
580
-
581
-
582
- function powerpress_onload()
583
- {
584
- if( g_bpLoadDelay )
585
- setTimeout('powerpress_load_delay()', g_bpLoadDelay);
586
- else
587
- powerpress_load_delay();
588
- }
589
-
590
- function powerpress_load_delay()
591
- {
592
- for( var x = 0; x < g_pbPlayerArray.length; x++ )
593
- powerpress_play_page( g_pbPlayerArray[x][0], g_pbPlayerArray[x][1] );
594
  }
595
 
596
- var g_pbPlayerArray = new Array();
597
- function powerpress_queue_player(media, div )
598
- {
599
- //alert('test');
600
- var pos = g_pbPlayerArray.length;
601
- g_pbPlayerArray[pos] = new Array();
602
- g_pbPlayerArray[pos][0] = media;
603
- g_pbPlayerArray[pos][1] = div;
604
- }
605
-
606
- function powerpress_addLoadEvent(func)
607
- {
608
- var oldonload = window.onload;
609
- if (typeof window.onload != 'function')
610
- {
611
- window.onload = func;
612
- }
613
- else
614
- {
615
- window.onload = function()
616
- {
617
- if (oldonload)
618
- {
619
- oldonload();
620
- }
621
- func();
622
- }
623
- }
624
- }
625
-
626
-
627
  /**
628
  * flashembed 0.31. Adobe Flash embedding script
629
  *
@@ -640,4 +138,4 @@ function powerpress_addLoadEvent(func)
640
  * version 0.31 - Tue Jul 22 2008 06:30:31 GMT+0200 (GMT+02:00)
641
  */
642
 
643
- function flashembed(root,userParams,flashvars){function getHTML(){var html="";if(typeof flashvars=='function'){flashvars=flashvars();}if(navigator.plugins&&navigator.mimeTypes&&navigator.mimeTypes.length){html='<embed type="application/x-shockwave-flash" ';if(params.id){extend(params,{name:params.id});}for(var key in params){if(params[key]!==null){html+=[key]+'="'+params[key]+'"\n\t';}}if(flashvars){html+='flashvars=\''+concatVars(flashvars)+'\'';}html+='/>';}else{html='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" ';html+='width="'+params.width+'" height="'+params.height+'"';if(!params.id&&document.all){params.id="_"+(""+Math.random()).substring(5);}if(params.id){html+=' id="'+params.id+'"';}html+='>';html+='\n\t<param name="movie" value="'+params.src+'" />';params.id=params.src=params.width=params.height=null;for(var k in params){if(params[k]!==null){html+='\n\t<param name="'+k+'" value="'+params[k]+'" />';}}if(flashvars){html+='\n\t<param name="flashvars" value=\''+concatVars(flashvars)+'\' />';}html+="</object>";if(debug){alert(html);}}return html;}function init(name){var timer=setInterval(function(){var doc=document;var el=doc.getElementById(name);if(el){flashembed(el,userParams,flashvars);clearInterval(timer);}else if(doc&&doc.getElementsByTagName&&doc.getElementById&&doc.body){clearInterval(timer);}},13);return true;}function extend(to,from){if(from){for(key in from){if(from.hasOwnProperty(key)){to[key]=from[key];}}}}var params={src:'#',width:'100%',height:'100%',version:null,onFail:null,expressInstall:null,debug:false,bgcolor:'#ffffff',allowfullscreen:true,allowscriptaccess:'always',quality:'high',type:'application/x-shockwave-flash',pluginspage:'http://www.adobe.com/go/getflashplayer'};if(typeof userParams=='string'){userParams={src:userParams};}extend(params,userParams);var version=flashembed.getVersion();var required=params.version;var express=params.expressInstall;var debug=params.debug;if(typeof root=='string'){var el=document.getElementById(root);if(el){root=el;}else{return init(root);}}if(!root){return;}if(!required||flashembed.isSupported(required)){params.onFail=params.version=params.expressInstall=params.debug=null;root.innerHTML=getHTML();return root.firstChild;}else if(params.onFail){var ret=params.onFail.call(params,flashembed.getVersion(),flashvars);if(ret){root.innerHTML=ret;}}else if(required&&express&&flashembed.isSupported([6,65])){extend(params,{src:express});flashvars={MMredirectURL:location.href,MMplayerType:'PlugIn',MMdoctitle:document.title};root.innerHTML=getHTML();}else{if(root.innerHTML.replace(/\s/g,'')!==''){}else{root.innerHTML="<h2>Flash version "+required+" or greater is required</h2>"+"<h3>"+(version[0]>0?"Your version is "+version:"You have no flash plugin installed")+"</h3>"+"<p>Download latest version from <a href='"+params.pluginspage+"'>here</a></p>";}}function concatVars(vars){var out="";for(var key in vars){if(vars[key]){out+=[key]+'='+asString(vars[key])+'&';}}return out.substring(0,out.length-1);}function asString(obj){switch(typeOf(obj)){case'string':return'"'+obj.replace(new RegExp('(["\\\\])','g'),'\\$1')+'"';case'array':return'['+map(obj,function(el){return asString(el);}).join(',')+']';case'function':return'"function()"';case'object':var str=[];for(var prop in obj){if(obj.hasOwnProperty(prop)){str.push('"'+prop+'":'+asString(obj[prop]));}}return'{'+str.join(',')+'}';}return String(obj).replace(/\s/g," ").replace(/\'/g,"\"");}function typeOf(obj){if(obj===null||obj===undefined){return false;}var type=typeof obj;return(type=='object'&&obj.push)?'array':type;}if(window.attachEvent){window.attachEvent("onbeforeunload",function(){__flash_unloadHandler=function(){};__flash_savedUnloadHandler=function(){};});}function map(arr,func){var newArr=[];for(var i in arr){if(arr.hasOwnProperty(i)){newArr[i]=func(arr[i]);}}return newArr;}return root;}if(typeof jQuery=='function'){(function($){$.fn.extend({flashembed:function(params,flashvars){return this.each(function(){flashembed(this,params,flashvars);});}});})(jQuery);}flashembed=flashembed||{};flashembed.getVersion=function(){var version=[0,0];if(navigator.plugins&&typeof navigator.plugins["Shockwave Flash"]=="object"){var _d=navigator.plugins["Shockwave Flash"].description;if(typeof _d!="undefined"){_d=_d.replace(/^.*\s+(\S+\s+\S+$)/,"$1");var _m=parseInt(_d.replace(/^(.*)\..*$/,"$1"),10);var _r=/r/.test(_d)?parseInt(_d.replace(/^.*r(.*)$/,"$1"),10):0;version=[_m,_r];}}else if(window.ActiveXObject){try{var _a=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");}catch(e){try{_a=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");version=[6,0];_a.AllowScriptAccess="always";}catch(ee){if(version[0]==6){return;}}try{_a=new ActiveXObject("ShockwaveFlash.ShockwaveFlash");}catch(eee){}}if(typeof _a=="object"){_d=_a.GetVariable("$version");if(typeof _d!="undefined"){_d=_d.replace(/^\S+\s+(.*)$/,"$1").split(",");version=[parseInt(_d[0],10),parseInt(_d[2],10)];}}}return version;};flashembed.isSupported=function(version){var now=flashembed.getVersion();var ret=(now[0]>version[0])||(now[0]==version[0]&&now[1]>=version[1]);return ret;};
1
  /**
2
+ * jsMediaPlayer 1.2.0 for Blubrry PowerPress
3
  *
4
  * http://www.blubrry.com/powepress/
5
  *
6
+ * Copyright (c) 2008-2009 Angelo Mandato (angelo [at] mandato {period} com)
7
  *
8
  * Released under Aoache 2 license:
9
  * http://www.apache.org/licenses/LICENSE-2.0
10
  *
11
+ * versoin 1.2.0 - 07/20/2009 - Major rewrite, we're now replying less upon this javascript to make way for flexibility for adding future players.
12
  * versoin 1.1.3 - 03/23/2009 - Added code to support FlowPlayer v3.
13
  * versoin 1.1.2 - 03/04/2009 - Added options to set the width for audio, width and height for video.
14
  * versoin 1.1.1 - 12/22/20008 - Minor change to support Windows Media in Firefox. Includes link to preferred Firefox Windows Media Player plugin.
19
  * version 1.0.0 - 07/26/2008 - initial release
20
  */
21
 
 
22
 
23
  /**
24
+ Insert embed for quicktime within specified div
25
 
26
+ @div - specific div to insert embed into
27
+ @media_url - URL of media file to play
28
+ @width - width of player
29
+ @height - height of player
30
  */
31
+ function powerpress_embed_quicktime(div,media_url,width,height)
32
  {
33
+ if( document.getElementById(div) )
 
 
 
 
 
 
 
 
 
34
  {
35
+ var contentType = 'video/mpeg'; // Default content type
36
+ if( media_url.indexOf('.m4v') > -1 )
37
+ contentType = 'video/x-m4v';
38
+ else if( media_url.indexOf('.m4a') > -1 )
39
+ contentType = 'audio/x-m4a';
40
+ else if( media_url.indexOf('.avi') > -1 )
41
+ contentType = 'video/avi';
42
+ else if( media_url.indexOf('.qt') > -1 )
43
+ contentType = 'video/quicktime';
44
+ else if( media_url.indexOf('.mov') > -1 )
45
+ contentType = 'video/quicktime';
46
+
47
+ var Html = '';
48
+ Html += '<object classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" width="'+ width +'" height="'+ height +'" codebase="http://www.apple.com/qtactivex/qtplugin.cab">\n';
49
+ Html += ' <param name="src" value="'+ media_url +'" />\n';
50
+ Html += ' <param name="href" value="'+ media_url +'" />\n';
51
+ Html += ' <param name="scale" value="aspect" />\n';
52
+ Html += ' <param name="controller" value="true" />\n';
53
+ Html += ' <param name="autoplay" value="true" />\n';
54
+ Html += ' <param name="bgcolor" value="000000" />\n';
55
+ Html += ' <param name="pluginspage" value="http://www.apple.com/quicktime/download/" />\n';
56
+ Html += ' <embed src="'+ media_url +'" type="'+ contentType +'" width="'+ width +'" height="'+ height +'" scale="aspect" cache="true" bgcolor="000000" autoplay="true" controller="true" pluginspage="http://www.apple.com/quicktime/download/"></embed>';
57
+ Html += '</object>\n';
58
+ document.getElementById(div).innerHTML = Html;
59
+ return false; // stop the default link from proceeding
60
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
61
 
62
+ return true; // let the default link to the media open...
63
  }
64
 
65
  /**
66
+ Insert embed for windows media within specified div
67
 
68
+ @div - specific div to insert embed into
69
+ @media_url - URL of media file to play
70
+ @width - width of player
71
+ @height - height of player
72
  */
73
+ function powerpress_embed_winplayer(div,media_url,width,height)
74
  {
75
+ if( document.getElementById(div) )
76
+ {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
77
  var Html = '';
78
+ Html += '<object id="winplayer" classid="clsid:6BF52A52-394A-11d3-B153-00C04F79FAA6" width="'+ width +'" height="'+ height +'" standby="loading..." type="application/x-oleobject">\n';
79
+ Html += ' <param name="url" value="'+ media_url +'" />\n';
80
+ Html += ' <param name="AutoStart" value="true" />\n';
81
  Html += ' <param name="AutoSize" value="true" />\n';
82
  Html += ' <param name="AllowChangeDisplaySize" value="true" />\n';
83
  Html += ' <param name="standby" value="Media is loading..." />\n';
87
  Html += ' <param name="ShowCaptioning" value="false" />\n';
88
  Html += ' <param name="ShowDisplay" value="false" />\n';
89
  Html += ' <param name="ShowStatusBar" value="false" />\n';
90
+ Html += ' <embed type="application/x-mplayer2" src="'+ media_url +'" width="'+ width +'" height="'+ height +'" scale="aspect" AutoStart="true" ShowDisplay="0" ShowStatusBar="0" AutoSize="1" AnimationAtStart="1" AllowChangeDisplaySize="1" ShowControls="1"></embed>\n';
91
  Html += '</object>\n';
92
+ document.getElementById(div).innerHTML = Html;
93
+ return false; // stop the default link from proceeding
94
  }
95
+ return true; // let the default link to the media open...
96
+ }
 
 
 
97
 
98
+ /**
99
+ Insert embed for swf flash within specified div
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
100
 
101
+ @div - specific div to insert embed into
102
+ @media_url - URL of media file to play
103
+ @width - width of player
104
+ @height - height of player
105
+ */
106
+ function powerpress_embed_swf(div,media_url,width,height)
107
+ {
108
+ if( document.getElementById(div) )
109
+ {
110
  var Html = '';
111
+ Html += '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="'+ width +'" height="'+ height +'" menu="true">\n';
112
+ Html += ' <param name="movie" value="'+ media_url +'" />\n';
113
+ Html += ' <param name="quality" value="high" />\n';
114
+ Html += ' <param name="menu" value="true" />\n';
115
+ Html += ' <param name="scale" value="noorder" />\n';
116
+ Html += ' <param name="quality" value="high" />\n';
117
+ Html += ' <embed src="'+ media_url +'" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="'+ width +'" height="'+ height +'" menu="true"></embed>';
 
 
118
  Html += '</object>\n';
119
+ document.getElementById(div).innerHTML = Html;
120
+ return false; // stop the default link from proceeding
121
  }
122
+ return true; // let the default link to the media open...
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
123
  }
124
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
125
  /**
126
  * flashembed 0.31. Adobe Flash embedding script
127
  *
138
  * version 0.31 - Tue Jul 22 2008 06:30:31 GMT+0200 (GMT+02:00)
139
  */
140
 
141
+ function pp_flashembed(root,userParams,flashvars){function getHTML(){var html="";if(typeof flashvars=='function'){flashvars=flashvars();}if(navigator.plugins&&navigator.mimeTypes&&navigator.mimeTypes.length){html='<embed type="application/x-shockwave-flash" ';if(params.id){extend(params,{name:params.id});}for(var key in params){if(params[key]!==null){html+=[key]+'="'+params[key]+'"\n\t';}}if(flashvars){html+='flashvars=\''+concatVars(flashvars)+'\'';}html+='/>';}else{html='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" ';html+='width="'+params.width+'" height="'+params.height+'"';if(!params.id&&document.all){params.id="_"+(""+Math.random()).substring(5);}if(params.id){html+=' id="'+params.id+'"';}html+='>';html+='\n\t<param name="movie" value="'+params.src+'" />';params.id=params.src=params.width=params.height=null;for(var k in params){if(params[k]!==null){html+='\n\t<param name="'+k+'" value="'+params[k]+'" />';}}if(flashvars){html+='\n\t<param name="flashvars" value=\''+concatVars(flashvars)+'\' />';}html+="</object>";if(debug){alert(html);}}return html;}function init(name){var timer=setInterval(function(){var doc=document;var el=doc.getElementById(name);if(el){pp_flashembed(el,userParams,flashvars);clearInterval(timer);}else if(doc&&doc.getElementsByTagName&&doc.getElementById&&doc.body){clearInterval(timer);}},13);return true;}function extend(to,from){if(from){for(key in from){if(from.hasOwnProperty(key)){to[key]=from[key];}}}}var params={src:'#',width:'100%',height:'100%',version:null,onFail:null,expressInstall:null,debug:false,bgcolor:'#ffffff',allowfullscreen:true,allowscriptaccess:'always',quality:'high',type:'application/x-shockwave-flash',pluginspage:'http://www.adobe.com/go/getflashplayer'};if(typeof userParams=='string'){userParams={src:userParams};}extend(params,userParams);var version=pp_flashembed.getVersion();var required=params.version;var express=params.expressInstall;var debug=params.debug;if(typeof root=='string'){var el=document.getElementById(root);if(el){root=el;}else{return init(root);}}if(!root){return;}if(!required||pp_flashembed.isSupported(required)){params.onFail=params.version=params.expressInstall=params.debug=null;root.innerHTML=getHTML();return root.firstChild;}else if(params.onFail){var ret=params.onFail.call(params,pp_flashembed.getVersion(),flashvars);if(ret){root.innerHTML=ret;}}else if(required&&express&&pp_flashembed.isSupported([6,65])){extend(params,{src:express});flashvars={MMredirectURL:location.href,MMplayerType:'PlugIn',MMdoctitle:document.title};root.innerHTML=getHTML();}else{if(root.innerHTML.replace(/\s/g,'')!==''){}else{root.innerHTML="<h2>Flash version "+required+" or greater is required</h2>"+"<h3>"+(version[0]>0?"Your version is "+version:"You have no flash plugin installed")+"</h3>"+"<p>Download latest version from <a href='"+params.pluginspage+"'>here</a></p>";}}function concatVars(vars){var out="";for(var key in vars){if(vars[key]){out+=[key]+'='+asString(vars[key])+'&';}}return out.substring(0,out.length-1);}function asString(obj){switch(typeOf(obj)){case'string':return'"'+obj.replace(new RegExp('(["\\\\])','g'),'\\$1')+'"';case'array':return'['+map(obj,function(el){return asString(el);}).join(',')+']';case'function':return'"function()"';case'object':var str=[];for(var prop in obj){if(obj.hasOwnProperty(prop)){str.push('"'+prop+'":'+asString(obj[prop]));}}return'{'+str.join(',')+'}';}return String(obj).replace(/\s/g," ").replace(/\'/g,"\"");}function typeOf(obj){if(obj===null||obj===undefined){return false;}var type=typeof obj;return(type=='object'&&obj.push)?'array':type;}if(window.attachEvent){window.attachEvent("onbeforeunload",function(){__flash_unloadHandler=function(){};__flash_savedUnloadHandler=function(){};});}function map(arr,func){var newArr=[];for(var i in arr){if(arr.hasOwnProperty(i)){newArr[i]=func(arr[i]);}}return newArr;}return root;}if(typeof jQuery=='function'){(function($){$.fn.extend({pp_flashembed:function(params,flashvars){return this.each(function(){pp_flashembed(this,params,flashvars);});}});})(jQuery);}pp_flashembed=pp_flashembed||{};pp_flashembed.getVersion=function(){var version=[0,0];if(navigator.plugins&&typeof navigator.plugins["Shockwave Flash"]=="object"){var _d=navigator.plugins["Shockwave Flash"].description;if(typeof _d!="undefined"){_d=_d.replace(/^.*\s+(\S+\s+\S+$)/,"$1");var _m=parseInt(_d.replace(/^(.*)\..*$/,"$1"),10);var _r=/r/.test(_d)?parseInt(_d.replace(/^.*r(.*)$/,"$1"),10):0;version=[_m,_r];}}else if(window.ActiveXObject){try{var _a=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");}catch(e){try{_a=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");version=[6,0];_a.AllowScriptAccess="always";}catch(ee){if(version[0]==6){return;}}try{_a=new ActiveXObject("ShockwaveFlash.ShockwaveFlash");}catch(eee){}}if(typeof _a=="object"){_d=_a.GetVariable("$version");if(typeof _d!="undefined"){_d=_d.replace(/^\S+\s+(.*)$/,"$1").split(",");version=[parseInt(_d[0],10),parseInt(_d[2],10)];}}}return version;};pp_flashembed.isSupported=function(version){var now=pp_flashembed.getVersion();var ret=(now[0]>version[0])||(now[0]==version[0]&&now[1]>=version[1]);return ret;};
powerpress.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Blubrry PowerPress
4
  Plugin URI: http://www.blubrry.com/powerpress/
5
  Description: <a href="http://www.blubrry.com/powerpress/" target="_blank">Blubrry PowerPress</a> adds podcasting support to your blog. Features include: media player, 3rd party statistics and iTunes integration.
6
- Version: 0.8.3
7
  Author: Blubrry
8
  Author URI: http://www.blubrry.com/
9
  Change Log:
@@ -29,7 +29,7 @@ License: GPL (http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt)
29
  */
30
 
31
  // WP_PLUGIN_DIR (REMEMBER TO USE THIS DEFINE IF NEEDED)
32
- define('POWERPRESS_VERSION', '0.8.3' );
33
 
34
  /////////////////////////////////////////////////////
35
  // The following define options should be placed in your
@@ -44,25 +44,12 @@ if( !defined('POWERPRESS_DURATION_TEXT') )
44
  define('POWERPRESS_DURATION_TEXT', __('Duration') );
45
  if( !defined('POWERPRESS_PLAY_IN_NEW_WINDOW_TEXT') )
46
  define('POWERPRESS_PLAY_IN_NEW_WINDOW_TEXT', __('Play in new window') );
47
- if( !defined('POWERPRESS_PLAY_ON_PAGE_TEXT') )
48
- define('POWERPRESS_PLAY_ON_PAGE_TEXT', __('Play on page') );
49
  if( !defined('POWERPRESS_DOWNLOAD_TEXT') )
50
  define('POWERPRESS_DOWNLOAD_TEXT', __('Download') );
 
 
51
 
52
- // Load players in the footer of the page, improves page load times but requires wp_footer() function to be included in WP Theme.
53
- //define('POWERPRESS_USE_FOOTER', true);
54
- // You can also define the delay.
55
- //define('POWERPRESS_USE_FOOTER_DELAY', 300); // Milliseconds delay should occur, e.g. 500 is 1/2 of a second, 2000 is 2 seconds.
56
-
57
- // Set whether players should be loaded using the page onload event
58
- if( !defined('POWERPRESS_USE_ONLOAD') ) // Add define('POWERPRESS_USE_ONLOAD', false); to your wp-config.php to turn this feature off
59
- define('POWERPRESS_USE_ONLOAD', false);
60
-
61
- // define how much of a delay should exist when media players are loaded
62
- if( !defined('POWERPRESS_USE_ONLOAD_DELAY') ) // Add define('POWERPRESS_USE_ONLOAD_DELAY', 1000); to your wp-config.php to set a full 1 second delay.
63
- define('POWERPRESS_USE_ONLOAD_DELAY', 500);
64
-
65
- if( !defined('POWERPRESS_BLUBRRY_API_URL') ) // Add define('POWERPRESS_USE_ONLOAD_DELAY', 1000); to your wp-config.php to set a full 1 second delay.
66
  define('POWERPRESS_BLUBRRY_API_URL', 'http://api.blubrry.com/');
67
 
68
  // Display custom play image for quicktime media. Applies to on page player only.
@@ -70,6 +57,8 @@ if( !defined('POWERPRESS_BLUBRRY_API_URL') ) // Add define('POWERPRESS_USE_ONLO
70
 
71
  if( !defined('POWERPRESS_CONTENT_ACTION_PRIORITY') )
72
  define('POWERPRESS_CONTENT_ACTION_PRIORITY', 10 );
 
 
73
 
74
  // Define variables, advanced users could define these in their own wp-config.php so lets not try to re-define
75
  if( !defined('POWERPRESS_LINK_SEPARATOR') )
@@ -85,7 +74,11 @@ function powerpress_content($content)
85
  {
86
  global $post, $g_powerpress_excerpt_post_id;
87
 
88
- if( defined('PODPRESS_VERSION') || isset($GLOBALS['podcasting_player_id']) || isset($GLOBALS['podcast_channel_active']) )
 
 
 
 
89
  return;
90
 
91
  if( is_feed() )
@@ -96,7 +89,7 @@ function powerpress_content($content)
96
  if( post_password_required($post) )
97
  return $content;
98
  }
99
-
100
  // Problem: If the_excerpt is used instead of the_content, both the_exerpt and the_content will be called here.
101
  // Important to note, get_the_excerpt will be called before the_content is called, so we add a simple little hack
102
  if( current_filter() == 'get_the_excerpt' )
@@ -110,164 +103,177 @@ function powerpress_content($content)
110
  }
111
 
112
  // PowerPress settings:
113
- $Powerpress = get_option('powerpress_general');
 
 
 
 
 
 
 
 
 
114
 
115
- if( current_filter() == 'the_excerpt' && !$Powerpress['display_player_excerpt'] )
116
- {
 
 
 
117
  return $content; // We didn't want to modify this since the user didn't enable it for excerpts
118
- }
119
-
120
- // Get the enclosure data
121
- $enclosureData = get_post_meta($post->ID, 'enclosure', true);
122
- $duration = false;
123
-
124
- if( !$enclosureData )
125
  {
126
- $EnclosureURL = '';
127
- if( $Powerpress['process_podpress'] )
128
  {
129
- //$Settings = get_option('powerpress_general');
130
- $podPressMedia = get_post_meta($post->ID, 'podPressMedia', true);
131
- if( $podPressMedia )
132
  {
133
- if( !is_array($podPressMedia) )
 
134
  {
135
- // Sometimes the stored data gets messed up, we can fix it here:
136
- $podPressMedia = powerpress_repair_serialize($podPressMedia);
137
- $podPressMedia = @unserialize($podPressMedia);
138
  }
139
-
140
- if( is_array($podPressMedia) )
141
  {
142
- $EnclosureURL = $podPressMedia[0]['URI'];
143
- $EnclosureSize = $podPressMedia[0]['size'];
144
- $EnclosureType = '';
 
 
 
 
145
  }
146
  }
147
- if( !$EnclosureURL )
148
- return $content;
149
- if( strpos($EnclosureURL, 'http://' ) !== 0 )
150
- $EnclosureURL = rtrim($Powerpress['default_url'], '/') .'/'. $EnclosureURL;
151
  }
152
  }
153
- else
154
- {
155
- list($EnclosureURL, $EnclosureSize, $EnclosureType, $Serialized) = split("\n", $enclosureData);
156
- $EnclosureURL = trim($EnclosureURL);
157
- if( $Serialized )
158
- {
159
- $ExtraData = unserialize($Serialized);
160
- if( isset($ExtraData['duration']) )
161
- $duration = $ExtraData['duration'];
162
- }
163
- }
164
-
165
- // Just in case, if there's no URL lets escape!
166
- if( !$EnclosureURL )
167
- return $content;
168
-
169
 
170
- if( !isset($Powerpress['display_player']) )
171
- $Powerpress['display_player'] = 1;
172
- if( !isset($Powerpress['player_function']) )
173
- $Powerpress['player_function'] = 1;
174
- if( !isset($Powerpress['podcast_link']) )
175
- $Powerpress['podcast_link'] = 1;
176
-
177
- // The blog owner doesn't want anything displayed, so don't bother wasting anymore CPU cycles
178
- if( $Powerpress['display_player'] == 0 )
179
- return $content;
180
-
181
- // Add redirects to Media URL
182
- $EnclosureURL = powerpress_add_redirect_url($EnclosureURL, $Powerpress);
183
 
184
- // Build links for player
185
- $player_links = '';
186
- switch( $Powerpress['player_function'] )
187
- {
188
- case 1: { // On page and new window
189
- $player_links .= "<a href=\"$EnclosureURL\" class=\"powerpress_link_pinw\" target=\"_blank\" title=\"". POWERPRESS_PLAY_IN_NEW_WINDOW_TEXT ."\" onclick=\"return powerpress_play_window(this.href);\">". POWERPRESS_PLAY_IN_NEW_WINDOW_TEXT ."</a>".PHP_EOL;
190
- }; break;
191
- case 2: { // Play in page only
192
- }; break;
193
- case 3: { //Play in new window only
194
- $player_links .= "<a href=\"$EnclosureURL\" class=\"powerpress_link_pinw\" target=\"_blank\" title=\"". POWERPRESS_PLAY_IN_NEW_WINDOW_TEXT ."\" onclick=\"return powerpress_play_window(this.href);\">". POWERPRESS_PLAY_IN_NEW_WINDOW_TEXT ."</a>".PHP_EOL;
195
- }; break;
196
- case 4: { // Play on page link only
197
- $player_links .= "<a href=\"$EnclosureURL\" class=\"powerpress_link_pop\" title=\"". POWERPRESS_PLAY_ON_PAGE_TEXT ."\" onclick=\"return powerpress_play_page(this.href, 'powerpress_player_{$post->ID}','true');\">". POWERPRESS_PLAY_ON_PAGE_TEXT ."</a>".PHP_EOL;
198
- }; break;
199
- case 5: { //Play on page link and new window
200
- $player_links .= "<a href=\"$EnclosureURL\" class=\"powerpress_link_pop\" title=\"". POWERPRESS_PLAY_ON_PAGE_TEXT ."\" onclick=\"return powerpress_play_page(this.href, 'powerpress_player_{$post->ID}','true');\">". POWERPRESS_PLAY_ON_PAGE_TEXT ."</a>".PHP_EOL;
201
- $player_links .= ' '. POWERPRESS_LINK_SEPARATOR .' ';
202
- $player_links .= "<a href=\"$EnclosureURL\" class=\"powerpress_link_pinw\" target=\"_blank\" title=\"". POWERPRESS_PLAY_IN_NEW_WINDOW_TEXT ."\" onclick=\"return powerpress_play_window(this.href);\">". POWERPRESS_PLAY_IN_NEW_WINDOW_TEXT ."</a>".PHP_EOL;
203
- }; break;
204
- }//end switch
205
-
206
- if( $Powerpress['podcast_link'] == 1 )
207
- {
208
- if( $player_links )
209
- $player_links .= ' '. POWERPRESS_LINK_SEPARATOR .' ';
210
- $player_links .= "<a href=\"$EnclosureURL\" class=\"powerpress_link_d\" title=\"". POWERPRESS_DOWNLOAD_TEXT ."\">". POWERPRESS_DOWNLOAD_TEXT ."</a>".PHP_EOL;
211
- }
212
- else if( $Powerpress['podcast_link'] == 2 )
213
- {
214
- if( $player_links )
215
- $player_links .= ' '. POWERPRESS_LINK_SEPARATOR .' ';
216
- $player_links .= "<a href=\"$EnclosureURL\" class=\"powerpress_link_d\" title=\"". POWERPRESS_DOWNLOAD_TEXT ."\">". POWERPRESS_DOWNLOAD_TEXT ."</a> (".powerpress_byte_size($EnclosureSize).") ".PHP_EOL;
217
- }
218
- else if( $Powerpress['podcast_link'] == 3 )
219
- {
220
- if( $duration == false )
221
- $duration = get_post_meta($post->ID, 'itunes:duration', true);
222
- if( $player_links )
223
- $player_links .= ' '. POWERPRESS_LINK_SEPARATOR .' ';
224
- if( $duration && ltrim($duration, '0:') != '' )
225
- $player_links .= "<a href=\"$EnclosureURL\" class=\"powerpress_link_d\" title=\"". POWERPRESS_DOWNLOAD_TEXT ."\">". POWERPRESS_DOWNLOAD_TEXT ."</a> (". htmlspecialchars(POWERPRESS_DURATION_TEXT) .": " . powerpress_readable_duration($duration) ." &#8212; ".powerpress_byte_size($EnclosureSize).")".PHP_EOL;
226
- else
227
- $player_links .= "<a href=\"$EnclosureURL\" class=\"powerpress_link_d\" title=\"". POWERPRESS_DOWNLOAD_TEXT ."\">". POWERPRESS_DOWNLOAD_TEXT ."</a> (".powerpress_byte_size($EnclosureSize).")".PHP_EOL;
228
- }
229
 
 
230
  $new_content = '';
231
- if( $Powerpress['player_function'] == 1 || $Powerpress['player_function'] == 2 ) // We have some kind of on-line player
232
  {
233
- $new_content .= '<div class="powerpress_player" id="powerpress_player_'. $post->ID .'"></div>'.PHP_EOL;
234
- if( defined('POWERPRESS_USE_ONLOAD') && POWERPRESS_USE_ONLOAD )
 
 
 
 
 
 
 
 
235
  {
236
- if( defined('POWERPRESS_USE_FOOTER') && POWERPRESS_USE_FOOTER )
237
  {
238
- global $g_powerpress_footer;
239
- $g_powerpress_footer['player_js'] .= "powerpress_queue_player('$EnclosureURL', 'powerpress_player_{$post->ID}');\n";
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
240
  }
241
- else
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
242
  {
243
- $new_content .= '<script type="text/javascript">'.PHP_EOL;
244
- $new_content .= "powerpress_queue_player('$EnclosureURL', 'powerpress_player_{$post->ID}');\n";
245
- $new_content .= '</script>'.PHP_EOL;
 
246
  }
247
  }
248
- else if( defined('POWERPRESS_USE_FOOTER') && POWERPRESS_USE_FOOTER ) // $g_powerpress_footer['player_js']
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
249
  {
250
- global $g_powerpress_footer;
251
- $g_powerpress_footer['player_js'] .= "powerpress_play_page('$EnclosureURL', 'powerpress_player_{$post->ID}');\n";
 
252
  }
253
- else
254
  {
255
- $new_content .= '<script type="text/javascript">'.PHP_EOL;
256
- $new_content .= "powerpress_play_page('$EnclosureURL', 'powerpress_player_{$post->ID}');\n";
257
- $new_content .= '</script>'.PHP_EOL;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
258
  }
259
  }
260
- else if( $Powerpress['player_function'] == 4 || $Powerpress['player_function'] == 5 )
261
- {
262
- $new_content .= '<div class="powerpress_player" id="powerpress_player_'. $post->ID .'"></div>'.PHP_EOL;
263
- }
264
- if( $player_links )
265
- $new_content .= '<p class="powerpress_links">'. htmlspecialchars(POWERPRESS_LINKS_TEXT) .': '. $player_links . '</p>'.PHP_EOL;
266
 
267
  if( $new_content == '' )
268
  return $content;
269
 
270
- switch( $Powerpress['display_player'] )
271
  {
272
  case 1: { // Below posts
273
  return $content.$new_content;
@@ -285,7 +291,7 @@ add_filter('the_excerpt', 'powerpress_content', POWERPRESS_CONTENT_ACTION_PRIORI
285
 
286
  function powerpress_header()
287
  {
288
- if( defined('PODPRESS_VERSION') || isset($GLOBALS['podcasting_player_id']) || isset($GLOBALS['podcast_channel_active']) )
289
  return;
290
  // PowerPress settings:
291
  $Powerpress = get_option('powerpress_general');
@@ -294,34 +300,19 @@ function powerpress_header()
294
  {
295
  $PowerpressPluginURL = powerpress_get_root_url();
296
  ?>
297
- <script type="text/javascript" src="<?php echo $PowerpressPluginURL; ?>player.js"></script>
298
  <script type="text/javascript">
299
  <?php
300
- $player_image_url = POWERPRESS_PLAY_IMAGE;
301
- if( strstr($player_image_url, 'http://') !== $player_image_url )
302
- $player_image_url = powerpress_get_root_url().$player_image_url;
303
 
304
- if( $Powerpress['player_function'] == 4 || $Powerpress['player_function'] == 5 ) // Links would imply only one player in the page
305
- echo 'powerpress_player_init(\''. $PowerpressPluginURL .'\',\''. $player_image_url .'\',true);'.PHP_EOL;
306
- else
307
- echo 'powerpress_player_init(\''. $PowerpressPluginURL .'\',\''. $player_image_url .'\');'.PHP_EOL;
308
-
309
- if( isset($Powerpress['player_width']) && isset($Powerpress['player_height']) && isset($Powerpress['player_width_audio']) )
310
- echo 'powerpress_player_size('. (int)trim($Powerpress['player_width']) .','. (int)trim($Powerpress['player_height']) .','. (int)trim($Powerpress['player_width_audio']) .');'.PHP_EOL;
311
-
312
- if( defined('POWERPRESS_USE_ONLOAD') && POWERPRESS_USE_ONLOAD )
313
- {
314
- echo 'powerpress_addLoadEvent(powerpress_onload);'.PHP_EOL;
315
- echo "var g_bpLoadDelay = ".POWERPRESS_USE_ONLOAD_DELAY.";\n";
316
- }
317
  ?>
 
318
  </script>
319
- <style type="text/css">
320
- .powerpress_player_old {
321
- margin-bottom: 3px;
322
- margin-top: 10px;
323
- }
324
- </style>
325
  <?php
326
  }
327
  }
@@ -371,11 +362,22 @@ function powerpress_rss2_head()
371
  }
372
 
373
  $General = get_option('powerpress_general');
 
374
  // We made it this far, lets write stuff to the feed!
 
375
  if( $General['advanced_mode'] == 0 )
376
- echo '<!-- podcast_generator="Blubrry PowerPress/'. POWERPRESS_VERSION .'" mode="simple" -->'.PHP_EOL;
 
 
 
 
 
 
 
377
  else
378
- echo '<!-- podcast_generator="Blubrry PowerPress/'. POWERPRESS_VERSION .'" mode="advanced" -->'.PHP_EOL;
 
 
379
 
380
  // add the itunes:new-feed-url tag to feed
381
  if( powerpress_is_custom_podcast_feed() )
@@ -622,11 +624,11 @@ function powerpress_rss2_item()
622
  }
623
 
624
  // Split the episode information into parts...
625
- list($EnclosureURL, $EnclosureSize, $EnclosureType, $Serialized) = split("\n", $enclosureData);
626
  $EnclosureURL = trim($EnclosureURL);
627
  $EnclosureType = trim($EnclosureType);
628
  $EnclosureSize = trim($EnclosureSize);
629
- $author = $powerpress_feed['itunes_talent_name'];
630
  $explicit = $powerpress_feed['explicit'];
631
  $summary = false;
632
  $subtitle = false;
@@ -638,18 +640,22 @@ function powerpress_rss2_item()
638
  $EpisodeData = unserialize($Serialized);
639
  if( isset( $EpisodeData['duration'] ) )
640
  $duration = $EpisodeData['duration'];
641
- if( isset( $EpisodeData['author'] ) )
642
- $author = $EpisodeData['author'];
643
- if( isset( $EpisodeData['explicit'] ) )
644
- $explicit = $EpisodeData['explicit'];
645
- if( isset( $EpisodeData['summary'] ) )
646
- $summary = $EpisodeData['summary'];
647
- if( isset( $EpisodeData['subtitle'] ) )
648
- $subtitle = $EpisodeData['subtitle'];
649
- if( isset( $EpisodeData['keywords'] ) )
650
- $keywords = $EpisodeData['keywords'];
651
- if( isset( $EpisodeData['block'] ) )
652
- $block = $EpisodeData['block'];
 
 
 
 
653
  }
654
 
655
  if( !$duration && !$custom_enclosure )
@@ -699,10 +705,11 @@ function powerpress_rss2_item()
699
  else
700
  echo "\t\t<itunes:subtitle>". powerpress_format_itunes_value($content_no_html, 'subtitle', true) .'</itunes:subtitle>'.PHP_EOL;
701
 
702
- if( $powerpress_feed['enhance_itunes_summary'] )
703
- echo "\t\t<itunes:summary>". powerpress_itunes_summary($post->post_content) .'</itunes:summary>'.PHP_EOL;
704
- else if( $summary )
705
  echo "\t\t<itunes:summary>". powerpress_format_itunes_value($summary, 'summary') .'</itunes:summary>'.PHP_EOL;
 
 
706
  else if( $excerpt_no_html )
707
  echo "\t\t<itunes:summary>". powerpress_format_itunes_value($excerpt_no_html, 'summary') .'</itunes:summary>'.PHP_EOL;
708
  else
@@ -725,7 +732,7 @@ add_action('rss2_item', 'powerpress_rss2_item');
725
 
726
  function powerpress_filter_rss_enclosure($content)
727
  {
728
- if( defined('PODPRESS_VERSION') || isset($GLOBALS['podcasting_player_id']) || isset($GLOBALS['podcast_channel_active']) )
729
  return $content; // Another podcasting plugin is enabled...
730
 
731
 
@@ -876,9 +883,12 @@ add_action('template_redirect', 'powerpress_template_redirect', 0);
876
 
877
  function powerpress_init()
878
  {
879
- if( defined('PODPRESS_VERSION') || isset($GLOBALS['podcasting_player_id']) || isset($GLOBALS['podcast_channel_active']) )
880
  return false; // Another podcasting plugin is enabled...
881
 
 
 
 
882
  add_feed('podcast', 'powerpress_do_podcast_feed');
883
 
884
  $GeneralSettings = get_option('powerpress_general');
@@ -936,6 +946,7 @@ function powerpress_load_general_feed_settings()
936
 
937
  $powerpress_feed = array();
938
  $powerpress_feed['is_custom'] = true;
 
939
  $powerpress_feed['category'] = $cat_ID;
940
  $powerpress_feed['process_podpress'] = true; // Category feeds could originate from Podpress
941
  $powerpress_feed['default_url'] = rtrim($GeneralSettings['default_url'], '/') .'/';
@@ -949,6 +960,8 @@ function powerpress_load_general_feed_settings()
949
  $powerpress_feed['posts_per_rss'] = $Feed['posts_per_rss'];
950
  if( $Feed['feed_redirect_url'] != '' )
951
  $powerpress_feed['feed_redirect_url'] = $Feed['feed_redirect_url'];
 
 
952
  return;
953
  }
954
 
@@ -962,6 +975,7 @@ function powerpress_load_general_feed_settings()
962
 
963
  $powerpress_feed = array();
964
  $powerpress_feed['is_custom'] = true;
 
965
  $powerpress_feed['feed-slug'] = $feed_slug;
966
  $powerpress_feed['process_podpress'] = false; // We don't touch podpress data for custom feeds
967
  $powerpress_feed['default_url'] = rtrim($GeneralSettings['default_url'], '/') .'/';
@@ -1007,6 +1021,7 @@ function powerpress_load_general_feed_settings()
1007
  {
1008
  $powerpress_feed = array(); // Only store what's needed for each feed item
1009
  $powerpress_feed['is_custom'] = false; // ($feed_slug == 'podcast'?true:false);
 
1010
  $powerpress_feed['feed-slug'] = $feed_slug;
1011
  $powerpress_feed['process_podpress'] = $GeneralSettings['process_podpress']; // We don't touch podpress data for custom feeds
1012
  $powerpress_feed['default_url'] = rtrim($GeneralSettings['default_url'], '/') .'/';
@@ -1032,7 +1047,7 @@ function powerpress_load_general_feed_settings()
1032
  // Returns true of the feed should be treated as a podcast feed
1033
  function powerpress_is_podcast_feed()
1034
  {
1035
- if( defined('PODPRESS_VERSION') || isset($GLOBALS['podcasting_player_id']) || isset($GLOBALS['podcast_channel_active']) )
1036
  return false; // Another podcasting plugin is enabled...
1037
 
1038
  global $powerpress_feed;
@@ -1046,7 +1061,7 @@ function powerpress_is_podcast_feed()
1046
  // Returns true if the feed is a custom feed added by PowerPress
1047
  function powerpress_is_custom_podcast_feed()
1048
  {
1049
- if( defined('PODPRESS_VERSION') || isset($GLOBALS['podcasting_player_id']) || isset($GLOBALS['podcast_channel_active']) )
1050
  return false; // Another podcasting plugin is enabled...
1051
 
1052
  global $powerpress_feed;
@@ -1126,38 +1141,305 @@ function powerpress_post_limits($limits)
1126
  }
1127
  add_filter('post_limits', 'powerpress_post_limits');
1128
 
1129
- function powerpress_wp_footer()
 
1130
  {
1131
- global $g_powerpress_footer;
 
1132
 
1133
- if( is_array($g_powerpress_footer) )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1134
  {
1135
- if( isset($g_powerpress_footer['player_js']) )
1136
- {
1137
- echo '<script type="text/javascript">'.PHP_EOL;
1138
- if( POWERPRESS_USE_ONLOAD == false && defined('POWERPRESS_USE_FOOTER_DELAY') && POWERPRESS_USE_FOOTER_DELAY && is_numeric(POWERPRESS_USE_FOOTER_DELAY) )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1139
  {
1140
- echo 'function powerpress_onload_delay() {'.PHP_EOL;
1141
- echo $g_powerpress_footer['player_js'];
1142
- echo '}'.PHP_EOL;
1143
- echo "setTimeout('powerpress_onload_delay()', ".POWERPRESS_USE_FOOTER_DELAY.");\n";
 
 
 
 
 
 
 
 
 
 
1144
  }
1145
  else
1146
  {
1147
- echo $g_powerpress_footer['player_js'];
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1148
  }
1149
- echo '</script>'.PHP_EOL;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1150
  }
1151
  }
 
 
1152
  }
1153
 
1154
- if( defined('POWERPRESS_USE_FOOTER') && POWERPRESS_USE_FOOTER ) // $g_powerpress_footer['player_js']
1155
- add_action('wp_footer', 'powerpress_wp_footer');
1156
 
1157
  /*
1158
  Helper functions:
1159
  */
1160
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1161
  // Add types that are missing from the default wp_check_filetype function
1162
  function powerpress_check_filetype($file)
1163
  {
@@ -1174,6 +1456,10 @@ function powerpress_check_filetype($file)
1174
  return 'audio/mpeg';
1175
  case 'm4a':
1176
  return 'audio/x-m4a';
 
 
 
 
1177
  case 'ogg':
1178
  return 'audio/ogg';
1179
  case 'wma':
@@ -1604,12 +1890,52 @@ function powerpress_repair_serialize($string)
1604
  ),
1605
  $string);
1606
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1607
  /*
1608
  End Helper Functions
1609
  */
1610
 
1611
  // Are we in the admin?
1612
  if( is_admin() )
1613
- require_once('powerpressadmin.php');
 
 
 
 
1614
 
1615
  ?>
3
  Plugin Name: Blubrry PowerPress
4
  Plugin URI: http://www.blubrry.com/powerpress/
5
  Description: <a href="http://www.blubrry.com/powerpress/" target="_blank">Blubrry PowerPress</a> adds podcasting support to your blog. Features include: media player, 3rd party statistics and iTunes integration.
6
+ Version: 0.9.0
7
  Author: Blubrry
8
  Author URI: http://www.blubrry.com/
9
  Change Log:
29
  */
30
 
31
  // WP_PLUGIN_DIR (REMEMBER TO USE THIS DEFINE IF NEEDED)
32
+ define('POWERPRESS_VERSION', '0.9.0' );
33
 
34
  /////////////////////////////////////////////////////
35
  // The following define options should be placed in your
44
  define('POWERPRESS_DURATION_TEXT', __('Duration') );
45
  if( !defined('POWERPRESS_PLAY_IN_NEW_WINDOW_TEXT') )
46
  define('POWERPRESS_PLAY_IN_NEW_WINDOW_TEXT', __('Play in new window') );
 
 
47
  if( !defined('POWERPRESS_DOWNLOAD_TEXT') )
48
  define('POWERPRESS_DOWNLOAD_TEXT', __('Download') );
49
+ if( !defined('POWERPRESS_PLAY_TEXT') )
50
+ define('POWERPRESS_PLAY_TEXT', __('Play') );
51
 
52
+ if( !defined('POWERPRESS_BLUBRRY_API_URL') )
 
 
 
 
 
 
 
 
 
 
 
 
 
53
  define('POWERPRESS_BLUBRRY_API_URL', 'http://api.blubrry.com/');
54
 
55
  // Display custom play image for quicktime media. Applies to on page player only.
57
 
58
  if( !defined('POWERPRESS_CONTENT_ACTION_PRIORITY') )
59
  define('POWERPRESS_CONTENT_ACTION_PRIORITY', 10 );
60
+
61
+ //define('POWERPRESS_IN_THE_LOOP_CHECK', true); // Add this define if you are using a theme such as the Hybrid Theme that improperly calls the_content() and the_excerpt() filters incorrectly.
62
 
63
  // Define variables, advanced users could define these in their own wp-config.php so lets not try to re-define
64
  if( !defined('POWERPRESS_LINK_SEPARATOR') )
74
  {
75
  global $post, $g_powerpress_excerpt_post_id;
76
 
77
+ // For those poorly written themes that call in_the_loop only functions such as the_content() and the_excerpt() outside of the loop, such as in the wp_head action.
78
+ if( in_the_loop() == false )
79
+ return $content;
80
+
81
+ if( defined('PODPRESS_VERSION') || isset($GLOBALS['podcasting_player_id']) || isset($GLOBALS['podcast_channel_active']) || defined('PODCASTING_VERSION') )
82
  return;
83
 
84
  if( is_feed() )
89
  if( post_password_required($post) )
90
  return $content;
91
  }
92
+
93
  // Problem: If the_excerpt is used instead of the_content, both the_exerpt and the_content will be called here.
94
  // Important to note, get_the_excerpt will be called before the_content is called, so we add a simple little hack
95
  if( current_filter() == 'get_the_excerpt' )
103
  }
104
 
105
  // PowerPress settings:
106
+ $GeneralSettings = get_option('powerpress_general');
107
+ // Lets set some default settings, if not already set...
108
+ if( !isset($GeneralSettings['custom_feeds']['podcast']) )
109
+ $GeneralSettings['custom_feeds']['podcast'] = 'Podcast Feed'; // Fixes scenario where the user never configured the custom default podcast feed.
110
+ if( !isset($GeneralSettings['display_player']) )
111
+ $GeneralSettings['display_player'] = 1;
112
+ if( !isset($GeneralSettings['player_function']) )
113
+ $GeneralSettings['player_function'] = 1;
114
+ if( !isset($GeneralSettings['podcast_link']) )
115
+ $GeneralSettings['podcast_link'] = 1;
116
 
117
+ // The blog owner doesn't want anything displayed, so don't bother wasting anymore CPU cycles
118
+ if( $GeneralSettings['display_player'] == 0 )
119
+ return $content;
120
+
121
+ if( current_filter() == 'the_excerpt' && !$GeneralSettings['display_player_excerpt'] )
122
  return $content; // We didn't want to modify this since the user didn't enable it for excerpts
123
+
124
+ // Figure out which players are alerady in the body of the page...
125
+ $ExcludePlayers = array();
126
+ if( preg_match_all('/(.?)\[(powerpress)\b(.*?)(?:(\/))?\](?:(.+?)\[\/\2\])?(.?)/s', $content, $matches) )
 
 
 
127
  {
128
+ if( isset($matches[3]) )
 
129
  {
130
+ while( list($key,$row) = each($matches[3]) )
 
 
131
  {
132
+ $attributes = shortcode_parse_atts($row);
133
+ if( isset($attributes['url']) )
134
  {
135
+ // not a problem...
 
 
136
  }
137
+ else if( isset($attributes['feed']) )
 
138
  {
139
+ // we want to exclude this feed from the links aera...
140
+ $ExcludePlayers[ $attributes['feed'] ] = true;
141
+ }
142
+ else
143
+ {
144
+ // we don't want to include any players below...
145
+ $ExcludePlayers = $GeneralSettings['custom_feeds'];
146
  }
147
  }
 
 
 
 
148
  }
149
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
150
 
 
 
 
 
 
 
 
 
 
 
 
 
 
151
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
152
 
153
+ // TODO: START LOOP HERE TO DISPLAY EACH MEDIA TYPE
154
  $new_content = '';
155
+ while( list($feed_slug,$feed_title) = each($GeneralSettings['custom_feeds']) )
156
  {
157
+ // Get the enclosure data
158
+ $EpisodeData = powerpress_get_enclosure_data($post->ID, $feed_slug);
159
+
160
+ //$enclosureData = get_post_meta($post->ID, 'enclosure', true);
161
+ $duration = false;
162
+ $EnclosureURL = '';
163
+ $EnclosureSize = '';
164
+ $EnclosureType = '';
165
+
166
+ if( !$EpisodeData )
167
  {
168
+ if( $GeneralSettings['process_podpress'] && $feed_slug == 'podcast' )
169
  {
170
+ //$Settings = get_option('powerpress_general');
171
+ $podPressMedia = get_post_meta($post->ID, 'podPressMedia', true);
172
+ if( $podPressMedia )
173
+ {
174
+ if( !is_array($podPressMedia) )
175
+ {
176
+ // Sometimes the stored data gets messed up, we can fix it here:
177
+ $podPressMedia = powerpress_repair_serialize($podPressMedia);
178
+ $podPressMedia = @unserialize($podPressMedia);
179
+ }
180
+
181
+ if( is_array($podPressMedia) )
182
+ {
183
+ $EnclosureURL = $podPressMedia[0]['URI'];
184
+ $EnclosureSize = $podPressMedia[0]['size'];
185
+ $EnclosureType = '';
186
+ }
187
+ }
188
+ if( !$EnclosureURL )
189
+ continue;
190
+ if( strpos($EnclosureURL, 'http://' ) !== 0 )
191
+ $EnclosureURL = rtrim($GeneralSettings['default_url'], '/') .'/'. $EnclosureURL;
192
+
193
+ // Add redirects to Media URL
194
+ $EnclosureURL = powerpress_add_redirect_url($EnclosureURL, $GeneralSettings);
195
  }
196
+ }
197
+ else
198
+ {
199
+ $EnclosureURL = $EpisodeData['url']; // Already includes redirect
200
+ $EnclosureSize = $EpisodeData['size'];
201
+ $EnclosureType = $EpisodeData['type'];
202
+ $duration = $EpisodeData['duration']; // Always set, though may be set to false
203
+ }
204
+
205
+ // Just in case, if there's no URL lets escape!
206
+ if( !$EnclosureURL )
207
+ continue;
208
+
209
+ // If the player is not already inserted in the body of the post using the shortcode...
210
+ //if( preg_match('/\[powerpress(.*)\]/is', $content) == 0 )
211
+ if( !isset($ExcludePlayers[ $feed_slug ]) ) // If the player is not in our exclude list because it's already in the post body somewhere...
212
+ {
213
+ if( $GeneralSettings['player_function'] != 3 && $GeneralSettings['player_function'] != 0 ) // Play in new window only or disabled
214
  {
215
+ if( $EpisodeData && isset($EpisodeData['embed']) )
216
+ $new_content .= $EpisodeData['embed'];
217
+ if( !isset($EpisodeData['no_player']) )
218
+ $new_content .= apply_filters('powerpress_player', '', $EnclosureURL, array('feed'=>$feed_slug) );
219
  }
220
  }
221
+
222
+ // Build links for player
223
+ $player_links = '';
224
+ switch( $GeneralSettings['player_function'] )
225
+ {
226
+ case 1: // Play on page and new window
227
+ case 3: // Play in new window only
228
+ case 5: { // Play in page and new window
229
+ $player_links .= "<a href=\"$EnclosureURL\" class=\"powerpress_link_pinw\" target=\"_blank\" title=\"". POWERPRESS_PLAY_IN_NEW_WINDOW_TEXT ."\" onclick=\"return powerpress_pinw('{$post->ID}-{$feed_slug}');\">". POWERPRESS_PLAY_IN_NEW_WINDOW_TEXT ."</a>".PHP_EOL;
230
+ }; break;
231
+ case 2:
232
+ case 4:{ // Play in/on page only
233
+ }; break;
234
+ }//end switch
235
+
236
+ if( $GeneralSettings['podcast_link'] == 1 )
237
+ {
238
+ if( $player_links )
239
+ $player_links .= ' '. POWERPRESS_LINK_SEPARATOR .' ';
240
+ $player_links .= "<a href=\"$EnclosureURL\" class=\"powerpress_link_d\" title=\"". POWERPRESS_DOWNLOAD_TEXT ."\">". POWERPRESS_DOWNLOAD_TEXT ."</a>".PHP_EOL;
241
+ }
242
+ else if( $GeneralSettings['podcast_link'] == 2 )
243
  {
244
+ if( $player_links )
245
+ $player_links .= ' '. POWERPRESS_LINK_SEPARATOR .' ';
246
+ $player_links .= "<a href=\"$EnclosureURL\" class=\"powerpress_link_d\" title=\"". POWERPRESS_DOWNLOAD_TEXT ."\">". POWERPRESS_DOWNLOAD_TEXT ."</a> (".powerpress_byte_size($EnclosureSize).") ".PHP_EOL;
247
  }
248
+ else if( $GeneralSettings['podcast_link'] == 3 )
249
  {
250
+ if( $duration == false )
251
+ $duration = get_post_meta($post->ID, 'itunes:duration', true);
252
+ if( $player_links )
253
+ $player_links .= ' '. POWERPRESS_LINK_SEPARATOR .' ';
254
+ if( $duration && ltrim($duration, '0:') != '' )
255
+ $player_links .= "<a href=\"$EnclosureURL\" class=\"powerpress_link_d\" title=\"". POWERPRESS_DOWNLOAD_TEXT ."\">". POWERPRESS_DOWNLOAD_TEXT ."</a> (". htmlspecialchars(POWERPRESS_DURATION_TEXT) .": " . powerpress_readable_duration($duration) ." &#8212; ".powerpress_byte_size($EnclosureSize).")".PHP_EOL;
256
+ else
257
+ $player_links .= "<a href=\"$EnclosureURL\" class=\"powerpress_link_d\" title=\"". POWERPRESS_DOWNLOAD_TEXT ."\">". POWERPRESS_DOWNLOAD_TEXT ."</a> (".powerpress_byte_size($EnclosureSize).")".PHP_EOL;
258
+ }
259
+
260
+ if( $player_links )
261
+ {
262
+ if( count($GeneralSettings['custom_feeds']) > 1 && $feed_slug != 'podcast' )
263
+ {
264
+ $new_content .= '<p class="powerpress_links">'. htmlspecialchars(POWERPRESS_LINKS_TEXT) .' ('. htmlspecialchars($feed_slug) .'): '. $player_links . '</p>'.PHP_EOL;
265
+ }
266
+ else
267
+ {
268
+ $new_content .= '<p class="powerpress_links">'. htmlspecialchars(POWERPRESS_LINKS_TEXT) .': '. $player_links . '</p>'.PHP_EOL;
269
+ }
270
  }
271
  }
 
 
 
 
 
 
272
 
273
  if( $new_content == '' )
274
  return $content;
275
 
276
+ switch( $GeneralSettings['display_player'] )
277
  {
278
  case 1: { // Below posts
279
  return $content.$new_content;
291
 
292
  function powerpress_header()
293
  {
294
+ if( defined('PODPRESS_VERSION') || isset($GLOBALS['podcasting_player_id']) || isset($GLOBALS['podcast_channel_active']) || defined('PODCASTING_VERSION') )
295
  return;
296
  // PowerPress settings:
297
  $Powerpress = get_option('powerpress_general');
300
  {
301
  $PowerpressPluginURL = powerpress_get_root_url();
302
  ?>
303
+ <script type="text/javascript" src="<?php echo powerpress_get_root_url(); ?>player.js"></script>
304
  <script type="text/javascript">
305
  <?php
306
+ $new_window_width = 320;
307
+ $new_window_height = 240;
 
308
 
309
+ if( isset($Powerpress['new_window_width']) && $Powerpress['new_window_width'] > 100 )
310
+ $new_window_width = $Powerpress['new_window_width'];
311
+ if( isset($Powerpress['new_window_height']) && $Powerpress['new_window_height'] > 40 )
312
+ $new_window_height = $Powerpress['new_window_height'];
 
 
 
 
 
 
 
 
 
313
  ?>
314
+ function powerpress_pinw(pinw){window.open('<?php echo get_bloginfo('url'); ?>/?powerpress_pinw='+pinw, 'PowerPressPlayer','toolbar=0,status=0,resizable=1,width=<?php echo ($new_window_width + 40); ?>,height=<?php echo ($new_window_height + 80); ?>'); return false;}
315
  </script>
 
 
 
 
 
 
316
  <?php
317
  }
318
  }
362
  }
363
 
364
  $General = get_option('powerpress_general');
365
+
366
  // We made it this far, lets write stuff to the feed!
367
+ echo '<!-- podcast_generator="Blubrry PowerPress/'. POWERPRESS_VERSION .'" ';
368
  if( $General['advanced_mode'] == 0 )
369
+ echo 'mode="simple" ';
370
+ else
371
+ echo 'mode="advanced" ';
372
+
373
+ if( $General['episode_box_mode'] == 0 )
374
+ echo 'entry="normal" ';
375
+ else if( $General['episode_box_mode'] == 1)
376
+ echo 'entry="simple" ';
377
  else
378
+ echo 'entry="advanced" ';
379
+
380
+ echo '-->'.PHP_EOL;
381
 
382
  // add the itunes:new-feed-url tag to feed
383
  if( powerpress_is_custom_podcast_feed() )
624
  }
625
 
626
  // Split the episode information into parts...
627
+ list($EnclosureURL, $EnclosureSize, $EnclosureType, $Serialized) = explode("\n", $enclosureData, 4);
628
  $EnclosureURL = trim($EnclosureURL);
629
  $EnclosureType = trim($EnclosureType);
630
  $EnclosureSize = trim($EnclosureSize);
631
+ $author = (isset($powerpress_feed['itunes_author_post'])?get_the_author() :$powerpress_feed['itunes_talent_name']);
632
  $explicit = $powerpress_feed['explicit'];
633
  $summary = false;
634
  $subtitle = false;
640
  $EpisodeData = unserialize($Serialized);
641
  if( isset( $EpisodeData['duration'] ) )
642
  $duration = $EpisodeData['duration'];
643
+ if( $powerpress_feed['itunes_custom'] )
644
+ {
645
+ if( isset( $EpisodeData['summary'] ) )
646
+ $summary = $EpisodeData['summary'];
647
+ if( isset( $EpisodeData['subtitle'] ) )
648
+ $subtitle = $EpisodeData['subtitle'];
649
+ if( isset( $EpisodeData['keywords'] ) )
650
+ $keywords = $EpisodeData['keywords'];
651
+ // Code for future use:
652
+ if( isset( $EpisodeData['author'] ) )
653
+ $author = $EpisodeData['author'];
654
+ if( isset( $EpisodeData['explicit'] ) )
655
+ $explicit = $EpisodeData['explicit'];
656
+ if( isset( $EpisodeData['block'] ) )
657
+ $block = $EpisodeData['block'];
658
+ }
659
  }
660
 
661
  if( !$duration && !$custom_enclosure )
705
  else
706
  echo "\t\t<itunes:subtitle>". powerpress_format_itunes_value($content_no_html, 'subtitle', true) .'</itunes:subtitle>'.PHP_EOL;
707
 
708
+
709
+ if( $summary )
 
710
  echo "\t\t<itunes:summary>". powerpress_format_itunes_value($summary, 'summary') .'</itunes:summary>'.PHP_EOL;
711
+ else if( $powerpress_feed['enhance_itunes_summary'] )
712
+ echo "\t\t<itunes:summary>". powerpress_itunes_summary($post->post_content) .'</itunes:summary>'.PHP_EOL;
713
  else if( $excerpt_no_html )
714
  echo "\t\t<itunes:summary>". powerpress_format_itunes_value($excerpt_no_html, 'summary') .'</itunes:summary>'.PHP_EOL;
715
  else
732
 
733
  function powerpress_filter_rss_enclosure($content)
734
  {
735
+ if( defined('PODPRESS_VERSION') || isset($GLOBALS['podcasting_player_id']) || isset($GLOBALS['podcast_channel_active']) || defined('PODCASTING_VERSION') )
736
  return $content; // Another podcasting plugin is enabled...
737
 
738
 
883
 
884
  function powerpress_init()
885
  {
886
+ if( defined('PODPRESS_VERSION') || isset($GLOBALS['podcasting_player_id']) || isset($GLOBALS['podcast_channel_active']) || defined('PODCASTING_VERSION') )
887
  return false; // Another podcasting plugin is enabled...
888
 
889
+ if( isset($_GET['powerpress_pinw']) )
890
+ powerpress_do_pinw($_GET['powerpress_pinw']);
891
+
892
  add_feed('podcast', 'powerpress_do_podcast_feed');
893
 
894
  $GeneralSettings = get_option('powerpress_general');
946
 
947
  $powerpress_feed = array();
948
  $powerpress_feed['is_custom'] = true;
949
+ $powerpress_feed['itunes_custom'] = ($GeneralSettings['episode_box_mode'] == 2);
950
  $powerpress_feed['category'] = $cat_ID;
951
  $powerpress_feed['process_podpress'] = true; // Category feeds could originate from Podpress
952
  $powerpress_feed['default_url'] = rtrim($GeneralSettings['default_url'], '/') .'/';
960
  $powerpress_feed['posts_per_rss'] = $Feed['posts_per_rss'];
961
  if( $Feed['feed_redirect_url'] != '' )
962
  $powerpress_feed['feed_redirect_url'] = $Feed['feed_redirect_url'];
963
+ if( $Feed['itunes_author_post'] == true )
964
+ $powerpress_feed['itunes_author_post'] = true;
965
  return;
966
  }
967
 
975
 
976
  $powerpress_feed = array();
977
  $powerpress_feed['is_custom'] = true;
978
+ $powerpress_feed['itunes_custom'] = ($GeneralSettings['episode_box_mode'] == 2);
979
  $powerpress_feed['feed-slug'] = $feed_slug;
980
  $powerpress_feed['process_podpress'] = false; // We don't touch podpress data for custom feeds
981
  $powerpress_feed['default_url'] = rtrim($GeneralSettings['default_url'], '/') .'/';
1021
  {
1022
  $powerpress_feed = array(); // Only store what's needed for each feed item
1023
  $powerpress_feed['is_custom'] = false; // ($feed_slug == 'podcast'?true:false);
1024
+ $powerpress_feed['itunes_custom'] = ($GeneralSettings['episode_box_mode'] == 2);
1025
  $powerpress_feed['feed-slug'] = $feed_slug;
1026
  $powerpress_feed['process_podpress'] = $GeneralSettings['process_podpress']; // We don't touch podpress data for custom feeds
1027
  $powerpress_feed['default_url'] = rtrim($GeneralSettings['default_url'], '/') .'/';
1047
  // Returns true of the feed should be treated as a podcast feed
1048
  function powerpress_is_podcast_feed()
1049
  {
1050
+ if( defined('PODPRESS_VERSION') || isset($GLOBALS['podcasting_player_id']) || isset($GLOBALS['podcast_channel_active']) || defined('PODCASTING_VERSION') )
1051
  return false; // Another podcasting plugin is enabled...
1052
 
1053
  global $powerpress_feed;
1061
  // Returns true if the feed is a custom feed added by PowerPress
1062
  function powerpress_is_custom_podcast_feed()
1063
  {
1064
+ if( defined('PODPRESS_VERSION') || isset($GLOBALS['podcasting_player_id']) || isset($GLOBALS['podcast_channel_active']) || defined('PODCASTING_VERSION') )
1065
  return false; // Another podcasting plugin is enabled...
1066
 
1067
  global $powerpress_feed;
1141
  }
1142
  add_filter('post_limits', 'powerpress_post_limits');
1143
 
1144
+
1145
+ function powerpress_do_all_pings()
1146
  {
1147
+ global $wpdb;
1148
+ $wpdb->query("DELETE FROM {$wpdb->postmeta} WHERE meta_key = '_encloseme' ");
1149
 
1150
+ // Now call the WordPress do_all_pings()...
1151
+ do_all_pings();
1152
+ }
1153
+
1154
+ remove_action('do_pings', 'do_all_pings');
1155
+ add_action('do_pings', 'powerpress_do_all_pings');
1156
+
1157
+ function powerpress_player_filter($content, $media_url, $ExtraData = array() )
1158
+ {
1159
+ global $g_powerpress_player_id;
1160
+ if( !isset($g_powerpress_player_id) )
1161
+ $g_powerpress_player_id = rand(0, 10000);
1162
+ else
1163
+ $g_powerpress_player_id++;
1164
+
1165
+ // Very important setting, we need to know if the media should auto play or not...
1166
+ $autoplay = false; // (default)
1167
+ if( isset($ExtraData['autoplay']) && $ExtraData['autoplay'] )
1168
+ $autoplay = true;
1169
+ $cover_image = '';
1170
+ if( $ExtraData['image'] )
1171
+ $cover_image = $ExtraData['image'];
1172
+
1173
+ // Based on $ExtraData, we can determine which type of player to handle here...
1174
+ $Settings = get_option('powerpress_general');
1175
+ if( !isset($Settings['player_function']) )
1176
+ $Settings['player_function'] = 1;
1177
+ $player_width = 320;
1178
+ $player_height = 240;
1179
+ if( isset($Settings['player_width']) && $Settings['player_width'] )
1180
+ $player_width = 340;
1181
+ if( isset($Settings['player_height']) && $Settings['player_height'] )
1182
+ $player_height = $Settings['player_height'];
1183
+
1184
+ // Used with some types
1185
+ $content_type = powerpress_check_filetype($media_url);
1186
+
1187
+ $parts = pathinfo($media_url);
1188
+ switch( strtolower($parts['extension']) )
1189
  {
1190
+ // Flash Player:
1191
+ case 'mp3':
1192
+
1193
+ // FlowPlayer has differeent sizes for audio than for video
1194
+ if( isset($Settings['player_width_audio']) && $Settings['player_width_audio'] )
1195
+ $player_width = $Settings['player_width_audio'];
1196
+ if( $cover_image == '' )
1197
+ $player_height = 24;
1198
+
1199
+ case 'flv': {
1200
+
1201
+ // Check if we are using a custom flash player...
1202
+ if( isset($Settings['player']) && $Settings['player'] != 'default' ) // If we are using some other flash player than the default flash player
1203
+ return $content;
1204
+
1205
+ // Okay we are supposed to use FlowPlayerClassic...
1206
+ $content .= '<div class="powerpress_player" id="powerpress_player_'. $g_powerpress_player_id .'"></div>'.PHP_EOL;
1207
+ $content .= '<script type="text/javascript">'.PHP_EOL;
1208
+ $content .= "pp_flashembed(\n";
1209
+ $content .= " 'powerpress_player_{$g_powerpress_player_id}',\n";
1210
+ $content .= " {src: '". powerpress_get_root_url() ."FlowPlayerClassic.swf', width: {$player_width}, height: {$player_height} },\n";
1211
+ if( $cover_image ) //
1212
+ $content .= " {config: { autoPlay: ". ($autoplay?'true':'false') .", autoBuffering: false, initialScale: 'scale', showFullScreenButton: false, showMenu: false, videoFile: '{$media_url}', splashImageFile: '{$cover_image}', scaleSplash: true, loop: false, autoRewind: true } }\n";
1213
+ else
1214
+ $content .= " {config: { autoPlay: ". ($autoplay?'true':'false') .", autoBuffering: false, initialScale: 'scale', showFullScreenButton: false, showMenu: false, videoFile: '{$media_url}', loop: false, autoRewind: true } }\n";
1215
+ $content .= ");\n";
1216
+ $content .= "</script>\n";
1217
+
1218
+ }; break;
1219
+
1220
+ // Quicktime:
1221
+ case 'm4v':
1222
+ case 'm4a':
1223
+ case 'avi':
1224
+ case 'mpg':
1225
+ case 'mpeg':
1226
+ case 'mp4':
1227
+ case 'm4b':
1228
+ case 'm4r':
1229
+ case 'qt':
1230
+ case 'mov': {
1231
+
1232
+ // If there is no cover image specified, lets use the default...
1233
+ if( $cover_image == '' )
1234
+ $cover_image = powerpress_get_root_url() . 'play_video_default.jpg';
1235
+
1236
+ if( $autoplay )
1237
+ {
1238
+ $content .= '<div class="powerpress_player" id="powerpress_player_'. $g_powerpress_player_id .'"></div>'.PHP_EOL;
1239
+ $content .= '<script type="text/javascript">'.PHP_EOL;
1240
+ $content .= "powerpress_embed_quicktime('powerpress_player_{$g_powerpress_player_id}', '{$media_url}', {$player_width}, {$player_height} );\n";
1241
+ $content .= "</script>\n";
1242
+ }
1243
+ else
1244
+ {
1245
+ $content .= '<div class="powerpress_player" id="powerpress_player_'. $g_powerpress_player_id .'">'.PHP_EOL;
1246
+ $content .= '<a href="'. $media_url .'" title="'. htmlspecialchars(POWERPRESS_PLAY_TEXT) .'" onclick="';
1247
+ $content .= "return powerpress_embed_quicktime('powerpress_player_{$g_powerpress_player_id}', '{$media_url}', {$player_width}, {$player_height} );";
1248
+ $content .= '">';
1249
+ $content .= '<img src="'. $cover_image .'" title="'. htmlspecialchars(POWERPRESS_PLAY_TEXT) .'" />';
1250
+ $content .= '</a>';
1251
+ $content .= "</div>\n";
1252
+ }
1253
+
1254
+ }; break;
1255
+
1256
+ // Windows Media:
1257
+ case 'wma':
1258
+ case 'wmv':
1259
+ case 'asf': {
1260
+
1261
+ $content .= '<div class="powerpress_player" id="powerpress_player_'. $g_powerpress_player_id .'">';
1262
+ if( !$cover_image || $autoplay ) // if we don't have a cover image or we're supposed to auto play the media anyway...
1263
  {
1264
+ $content .= '<object id="winplayer" classid="clsid:6BF52A52-394A-11d3-B153-00C04F79FAA6" width="'. $player_width .'" height="'. $player_height .'" standby="..." type="application/x-oleobject">';
1265
+ $content .= ' <param name="url" value="'. $media_url .'" />';
1266
+ $content .= ' <param name="AutoStart" value="'. ($autoplay?'true':'false') .'" />';
1267
+ $content .= ' <param name="AutoSize" value="true" />';
1268
+ $content .= ' <param name="AllowChangeDisplaySize" value="true" />';
1269
+ $content .= ' <param name="standby" value="Media is loading..." />';
1270
+ $content .= ' <param name="AnimationAtStart" value="true" />';
1271
+ $content .= ' <param name="scale" value="aspect" />';
1272
+ $content .= ' <param name="ShowControls" value="true" />';
1273
+ $content .= ' <param name="ShowCaptioning" value="false" />';
1274
+ $content .= ' <param name="ShowDisplay" value="false" />';
1275
+ $content .= ' <param name="ShowStatusBar" value="false" />';
1276
+ $content .= ' <embed type="application/x-mplayer2" src="'. $media_url .'" width="'. $player_width .'" height="'. $player_height .'" scale="aspect" AutoStart="'. ($autoplay?'true':'false') .'" ShowDisplay="0" ShowStatusBar="0" AutoSize="1" AnimationAtStart="1" AllowChangeDisplaySize="1" ShowControls="1"></embed>';
1277
+ $content .= '</object>';
1278
  }
1279
  else
1280
  {
1281
+ $content .= '<div class="powerpress_player" id="powerpress_player_'. $g_powerpress_player_id .'">'.PHP_EOL;
1282
+ $content .= '<a href="'. $media_url .'" title="'. htmlspecialchars(POWERPRESS_PLAY_TEXT) .'" onclick="';
1283
+ $content .= "return powerpress_embed_winplayer('powerpress_player_{$g_powerpress_player_id}', '{$media_url}', {$player_width}, {$player_height} );";
1284
+ $content .= '">';
1285
+ $content .= '<img src="'. $cover_image .'" title="'. htmlspecialchars(POWERPRESS_PLAY_TEXT) .'" />';
1286
+ $content .= '</a>';
1287
+ $content .= "</div>\n";
1288
+ }
1289
+ $content .= "</div>\n";
1290
+
1291
+ }; break;
1292
+
1293
+ // Flash:
1294
+ case 'swf': {
1295
+
1296
+ // If there is no cover image specified, lets use the default...
1297
+ if( $cover_image == '' )
1298
+ $cover_image = powerpress_get_root_url() . 'play_video_default.jpg';
1299
+
1300
+ $content .= '<div class="powerpress_player" id="powerpress_player_'. $g_powerpress_player_id .'">';
1301
+ if( !$autoplay )
1302
+ {
1303
+ $content .= '<a href="'. $media_url .'" title="'. htmlspecialchars(POWERPRESS_PLAY_TEXT) .'" onclick="';
1304
+ $content .= "return powerpress_embed_swf('powerpress_player_{$g_powerpress_player_id}', '{$media_url}', {$player_width}, {$player_height} );";
1305
+ $content .= '">';
1306
+ $content .= '<img src="'. $cover_image .'" title="'. htmlspecialchars(POWERPRESS_PLAY_TEXT) .'" />';
1307
+ $content .= '</a>';
1308
  }
1309
+ $content .= "</div>\n";
1310
+ if( $autoplay )
1311
+ {
1312
+ $content .= '<script type="text/javascript">'.PHP_EOL;
1313
+ $content .= "powerpress_embed_swf('powerpress_player_{$g_powerpress_player_id}', '{$media_url}', {$player_width}, {$player_height} );\n";
1314
+ $content .= "</script>\n";
1315
+ }
1316
+
1317
+ }; break;
1318
+
1319
+ // Default, just display the play image. If it is set for auto play, then we don't wnat to open a new window, otherwise we want to open this in a new window..
1320
+ default: {
1321
+
1322
+ if( $cover_image == '' )
1323
+ $cover_image = powerpress_get_root_url() . 'play_video_default.jpg';
1324
+
1325
+ $content .= '<div class="powerpress_player" id="powerpress_player_'. $g_powerpress_player_id .'">';
1326
+ $content .= '<a href="'. $media_url .'" title="'. htmlspecialchars(POWERPRESS_PLAY_TEXT) .'"'. ($autoplay?'':' target="_blank"') .'>';
1327
+ $content .= '<img src="'. $cover_image .'" title="'. htmlspecialchars(POWERPRESS_PLAY_TEXT) .'" border="0" />';
1328
+ $content .= '</a>';
1329
+ $content .= "</div>\n";
1330
+
1331
+ }; break;
1332
+ }
1333
+
1334
+ return $content;
1335
+ }
1336
+
1337
+ add_filter('powerpress_player', 'powerpress_player_filter', 10, 3);
1338
+
1339
+ function powerpress_shortcode_handler( $attributes, $content = null )
1340
+ {
1341
+ global $post, $g_powerpress_player_added;
1342
+
1343
+ // For those poorly written themes that call in_the_loop only functions such as the_content() and the_excerpt() outside of the loop, such as in the wp_head action.
1344
+ if( in_the_loop() == false )
1345
+ return '';
1346
+
1347
+ // We can't add flash players to feeds
1348
+ if( is_feed() )
1349
+ return '';
1350
+
1351
+ $return = '';
1352
+ $feed = '';
1353
+ $url = '';
1354
+ $image = '';
1355
+
1356
+ extract( shortcode_atts( array(
1357
+ 'url' => '',
1358
+ 'feed' => '',
1359
+ 'image' => ''
1360
+ ), $attributes ) );
1361
+
1362
+ if( $url )
1363
+ {
1364
+ $url = powerpress_add_redirect_url($url);
1365
+ // Handle the URL differently...
1366
+ $return = apply_filters('powerpress_player', '', $url, array('image'=>$image) );
1367
+ }
1368
+ else if( $feed )
1369
+ {
1370
+ $EpisdoeData = powerpress_get_enclosure_data($post->ID, $feed);
1371
+ if( isset($EpisdoeData['embed']) && $EpisdoeData['embed'] )
1372
+ $return = $EpisdoeData['embed'];
1373
+ if( !isset($EpisdoeData['no_player']) )
1374
+ $return = apply_filters('powerpress_player', '', $EpisdoeData['url'], array('feed'=>$feed, 'image'=>$image) );
1375
+ }
1376
+ else
1377
+ {
1378
+ $GeneralSettings = get_option('powerpress_general');
1379
+ if( !isset($GeneralSettings['custom_feeds']['podcast']) )
1380
+ $GeneralSettings['custom_feeds']['podcast'] = 'Podcast Feed'; // Fixes scenario where the user never configured the custom default podcast feed.
1381
+
1382
+ while( list($feed_slug,$feed_title) = each($GeneralSettings['custom_feeds']) )
1383
+ {
1384
+ $EpisdoeData = powerpress_get_enclosure_data($post->ID, $feed_slug);
1385
+ if( isset($EpisdoeData['embed']) && $EpisdoeData['embed'] )
1386
+ $return .= $EpisdoeData['embed'];
1387
+
1388
+ if( !isset($EpisdoeData['no_player']) )
1389
+ $return .= apply_filters('powerpress_player', '', $EpisdoeData['url'], array('feed'=>$feed_slug, 'image'=>$image) );
1390
  }
1391
  }
1392
+
1393
+ return $return;
1394
  }
1395
 
1396
+ add_shortcode('powerpress', 'powerpress_shortcode_handler');
1397
+
1398
 
1399
  /*
1400
  Helper functions:
1401
  */
1402
 
1403
+ function the_powerpress_content()
1404
+ {
1405
+ echo get_the_powerpress_content();
1406
+ }
1407
+
1408
+ function get_the_powerpress_content()
1409
+ {
1410
+ return powerpress_content('');
1411
+ }
1412
+
1413
+ function powerpress_do_pinw($pinw)
1414
+ {
1415
+ list($post_id, $feed_slug) = split('-', $pinw, 2);
1416
+ $EpisdoeData = powerpress_get_enclosure_data($post_id, $feed_slug);
1417
+
1418
+ echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">';
1419
+ ?>
1420
+ <html xmlns="http://www.w3.org/1999/xhtml">
1421
+ <head>
1422
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
1423
+ <title>Blubrry PowerPress Player</title>
1424
+ <?php wp_head(); ?>
1425
+ </head>
1426
+ <body>
1427
+ <?php
1428
+
1429
+ if( !$EpisdoeData )
1430
+ echo '<p>Unable to retrieve media information.</p>';
1431
+ else if( isset($EpisdoeData['embed']) && $EpisdoeData['embed'] )
1432
+ echo $EpisdoeData['embed'];
1433
+ if( !isset($EpisdoeData['no_player']) )
1434
+ echo apply_filters('powerpress_player', '', $EpisdoeData['url'], array('feed'=>$feed_slug, 'autoplay'=>true) );
1435
+
1436
+ ?>
1437
+ </body>
1438
+ </html>
1439
+ <?php
1440
+ exit;
1441
+ }
1442
+
1443
  // Add types that are missing from the default wp_check_filetype function
1444
  function powerpress_check_filetype($file)
1445
  {
1456
  return 'audio/mpeg';
1457
  case 'm4a':
1458
  return 'audio/x-m4a';
1459
+ case 'm4b': // Audio book format
1460
+ return 'audio/m4b';
1461
+ case 'm4r': // iPhone ringtone format
1462
+ return 'audio/m4r';
1463
  case 'ogg':
1464
  return 'audio/ogg';
1465
  case 'wma':
1890
  ),
1891
  $string);
1892
  }
1893
+
1894
+ function powerpress_get_enclosure($post_id, $feed_slug = 'podcast')
1895
+ {
1896
+ $Data = powerpress_get_enclosure_data($post_id, $feed_slug);
1897
+ if( $Data )
1898
+ return $Data['url'];
1899
+ return false;
1900
+ }
1901
+
1902
+ function powerpress_get_enclosure_data($post_id, $feed_slug = 'podcast')
1903
+ {
1904
+ if( $feed_slug == 'podcast' || $feed_slug == '' )
1905
+ $MetaData = get_post_meta($post_id, 'enclosure', true);
1906
+ else
1907
+ $MetaData = get_post_meta($post_id, '_'. $feed_slug .':enclosure', true);
1908
+
1909
+ if( !$MetaData )
1910
+ return false;
1911
+
1912
+ $Data = array();
1913
+ $Data['duration'] = 0;
1914
+ list($Data['url'], $Data['size'], $Data['type'], $Serialized) = explode("\n", $MetaData, 4);
1915
+ $Data['url'] = powerpress_add_redirect_url( trim($Data['url']) );
1916
+ if( $Serialized )
1917
+ {
1918
+ $ExtraData = unserialize($Serialized);
1919
+ if( isset($ExtraData['duration']) )
1920
+ $Data['duration'] = $ExtraData['duration'];
1921
+ if( isset($ExtraData['embed']) )
1922
+ $Data['embed'] = $ExtraData['embed'];
1923
+ if( isset($ExtraData['no_player']) )
1924
+ $Data['no_player'] = 1;
1925
+ }
1926
+
1927
+ return $Data;
1928
+ }
1929
  /*
1930
  End Helper Functions
1931
  */
1932
 
1933
  // Are we in the admin?
1934
  if( is_admin() )
1935
+ require_once(dirname(__FILE__).'/powerpressadmin.php');
1936
+
1937
+
1938
+ if( defined('POWERPRESS_PLAYERS') && POWERPRESS_PLAYERS )
1939
+ require_once(dirname(__FILE__).'/player.php');
1940
 
1941
  ?>
powerpressadmin-appearance.php CHANGED
@@ -30,19 +30,16 @@ while( list($value,$desc) = each($displayoptions) )
30
 
31
  <tr valign="top">
32
  <th scope="row">
33
- <?php _e("Player Function"); ?></th>
34
  <td><select name="General[player_function]" class="bpp_input_med">
35
  <?php
36
- $playeroptions = array(1=>'On Page & New Window', 2=>'On Page Only', 3=>'New Window Only', 4=>'On Page Link', 5=>'On Page Link & New Window', 0=>'Disable');
37
 
38
  while( list($value,$desc) = each($playeroptions) )
39
  echo "\t<option value=\"$value\"". ($General['player_function']==$value?' selected':''). ">".htmlspecialchars($desc)."</option>\n";
40
 
41
  ?>
42
  </select>
43
- <p style="margin-top: 0;">
44
- Note: "On Page Link" is a link to "play on page", the player is not displayed until link is clicked.
45
- </p>
46
  <?php
47
  global $wp_version;
48
  if( version_compare($wp_version, '2.7') < 0 ) // Wordpress before version 2.7
@@ -71,7 +68,44 @@ while( list($value,$desc) = each($linkoptions) )
71
  </select>
72
  </td>
73
  </tr>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
74
 
 
 
 
 
75
  <tr valign="top">
76
  <th scope="row">
77
  <?php echo __("Player Width"); ?>
30
 
31
  <tr valign="top">
32
  <th scope="row">
33
+ <?php _e("Display Media Player"); ?></th>
34
  <td><select name="General[player_function]" class="bpp_input_med">
35
  <?php
36
+ $playeroptions = array(1=>'On Page & New Window', 2=>'On Page Only', 3=>'New Window Only', /* 4=>'On Page Link', 5=>'On Page Link & New Window', */ 0=>'Disable');
37
 
38
  while( list($value,$desc) = each($playeroptions) )
39
  echo "\t<option value=\"$value\"". ($General['player_function']==$value?' selected':''). ">".htmlspecialchars($desc)."</option>\n";
40
 
41
  ?>
42
  </select>
 
 
 
43
  <?php
44
  global $wp_version;
45
  if( version_compare($wp_version, '2.7') < 0 ) // Wordpress before version 2.7
68
  </select>
69
  </td>
70
  </tr>
71
+ </table>
72
+
73
+
74
+ <h2><?php echo __("Play in New Window Settings"); ?></h2>
75
+
76
+ <p style="margin-bottom: 0;">Configure the width and height of the new window.</p>
77
+
78
+
79
+ <table class="form-table">
80
+
81
+ <tr valign="top">
82
+ <th scope="row">
83
+ <?php echo __("New Window Width"); ?>
84
+ </th>
85
+ <td>
86
+ <input type="text" name="General[new_window_width]" style="width: 50px;" onkeyup="javascript:this.value=this.value.replace(/[^0-9]/g, '');" value="<?php echo $General['new_window_width']; ?>" maxlength="4" />
87
+ Width of new window (leave blank for 320 default)
88
+ </td>
89
+ </tr>
90
+
91
+ <tr valign="top">
92
+ <th scope="row">
93
+ <?php echo __("New Window Height"); ?>
94
+ </th>
95
+ <td>
96
+ <input type="text" name="General[new_window_height]" style="width: 50px;" onkeyup="javascript:this.value=this.value.replace(/[^0-9]/g, '');" value="<?php echo $General['new_window_height']; ?>" maxlength="4" />
97
+ Height of new window (leave blank for 240 default)
98
+ </td>
99
+ </tr>
100
+ </table>
101
+
102
+
103
+ <h2><?php echo __("Default Player Settings"); ?></h2>
104
 
105
+ <p style="margin-bottom: 0;">Configure the width and height of the default media player.</p>
106
+
107
+
108
+ <table class="form-table">
109
  <tr valign="top">
110
  <th scope="row">
111
  <?php echo __("Player Width"); ?>
powerpressadmin-basic.php CHANGED
@@ -5,6 +5,18 @@ function powerpress_admin_basic()
5
  $General = powerpress_get_settings('powerpress_general');
6
  $AdvancedMode = $General['advanced_mode'];
7
  $General = powerpress_default_settings($General, 'basic');
 
 
 
 
 
 
 
 
 
 
 
 
8
  ?>
9
  <script type="text/javascript">
10
  function CheckRedirect(obj)
@@ -23,6 +35,16 @@ function CheckRedirect(obj)
23
  }
24
  return true;
25
  }
 
 
 
 
 
 
 
 
 
 
26
  </script>
27
  <input type="hidden" name="action" value="powerpress-save-basic" />
28
  <h2><?php echo __("Basic Settings"); ?></h2>
@@ -155,16 +177,34 @@ while( list($value,$desc) = each($options) )
155
  <td>
156
 
157
  <ul>
158
- <li><label><input type="radio" name="General[episode_box_mode]" value="0" <?php if( $General['episode_box_mode'] == 0 ) echo 'checked'; ?> onclick="javascript:document.getElementById('episode_entry_settings').style.display='block';" /> Normal</label> (default)</li>
 
 
 
 
 
 
 
159
  <li>
160
  <ul>
161
  <li>Episode entry box includes Media URL, File Size and Duration fields.</li>
162
  </ul>
163
  </li>
164
- <li><label><input type="radio" name="General[episode_box_mode]" value="1" <?php if( $General['episode_box_mode'] == 1 ) echo 'checked'; ?> onclick="javascript:document.getElementById('episode_entry_settings').style.display='none';" /> Simple</label></li>
 
165
  <li>
166
  <ul>
167
- <li>Episode entry box includes Media URL field only. File Size and Duration will be auto detected.</li>
 
 
 
 
 
 
 
 
 
 
168
  </ul>
169
  </li>
170
  </ul>
@@ -214,6 +254,7 @@ while( list($value,$desc) = each($options) )
214
  ?>
215
  </div>
216
 
 
217
  <?php
218
 
219
  $ModeDesc = 'None';
@@ -265,7 +306,6 @@ Enter your Redirect URL issued by your media statistics service provider below.
265
  </th>
266
  <td>
267
  <input type="text" style="width: 60%;" name="General[redirect1]" value="<?php echo $General['redirect1']; ?>" onChange="return CheckRedirect(this);" maxlength="250" />
268
- <!-- <div style="margin-left: 2px;margin-top: 0;">Enter your issued Blubrry Statistics Redirect URL above.</div> -->
269
  </td>
270
  </tr>
271
  </table>
5
  $General = powerpress_get_settings('powerpress_general');
6
  $AdvancedMode = $General['advanced_mode'];
7
  $General = powerpress_default_settings($General, 'basic');
8
+
9
+ // Default setings for advanced mode:
10
+ if( $General['episode_box_mode'] != 2 )
11
+ {
12
+ $General['episode_box_embed'] = 1;
13
+ $General['episode_box_no_player'] = 1;
14
+ $General['episode_box_keywords'] = 0;
15
+ $General['episode_box_subtitle'] = 0;
16
+ $General['episode_box_summary'] = 0;
17
+ }
18
+
19
+
20
  ?>
21
  <script type="text/javascript">
22
  function CheckRedirect(obj)
35
  }
36
  return true;
37
  }
38
+ function SelectEntryBox(mode)
39
+ {
40
+ document.getElementById('episode_entry_settings').style.display= (mode==1?'none':'block');
41
+ document.getElementById('episode_box_embed').disabled = (mode!=2);
42
+ document.getElementById('episode_box_no_player').disabled = (mode!=2);
43
+ document.getElementById('episode_box_keywords').disabled = (mode!=2);
44
+ document.getElementById('episode_box_subtitle').disabled = (mode!=2);
45
+ document.getElementById('episode_box_summary').disabled = (mode!=2);
46
+ }
47
+
48
  </script>
49
  <input type="hidden" name="action" value="powerpress-save-basic" />
50
  <h2><?php echo __("Basic Settings"); ?></h2>
177
  <td>
178
 
179
  <ul>
180
+ <li><label><input type="radio" name="General[episode_box_mode]" value="1" <?php if( $General['episode_box_mode'] == 1 ) echo 'checked'; ?> onclick="SelectEntryBox(1);" /> Simple</label></li>
181
+ <li>
182
+ <ul>
183
+ <li>Episode entry box includes Media URL field only. File Size and Duration will be auto detected.</li>
184
+ </ul>
185
+ </li>
186
+
187
+ <li><label><input type="radio" name="General[episode_box_mode]" value="0" <?php if( $General['episode_box_mode'] == 0 ) echo 'checked'; ?> onclick="SelectEntryBox(0);" /> Normal</label> (default)</li>
188
  <li>
189
  <ul>
190
  <li>Episode entry box includes Media URL, File Size and Duration fields.</li>
191
  </ul>
192
  </li>
193
+
194
+ <li><label><input type="radio" name="General[episode_box_mode]" value="2" <?php if( $General['episode_box_mode'] == 2 ) echo 'checked'; ?> onclick="SelectEntryBox(2);" /> Advanced</label></li>
195
  <li>
196
  <ul>
197
+ <li>Episode entry box includes Media URL, File Size and Duration plus:
198
+ <p style="margin-top: 15px;"><input id="episode_box_embed" name="General[episode_box_embed]" <?php if( $General['episode_box_mode'] != 2 ) echo 'disabled'; ?> type="checkbox" value="1"<?php if( $General['episode_box_embed'] ) echo ' checked'; ?> /> Embed Field (enter embed code from sites such as YouTube, Viddler and Blip.tv)</p>
199
+ <p style="margin-top: 15px;"><input id="episode_box_no_player" name="General[episode_box_no_player]" <?php if( $General['episode_box_mode'] != 2 ) echo 'disabled'; ?> type="checkbox" value="1"<?php if( $General['episode_box_no_player'] ) echo ' checked'; ?> /> No Player Option (disable player on a per episode basis)</p>
200
+
201
+ <p style="margin-top: 15px;"><input id="episode_box_keywords" name="General[episode_box_keywords]" <?php if( $General['episode_box_mode'] != 2 ) echo 'disabled'; ?> type="checkbox" value="1"<?php if( $General['episode_box_keywords'] ) echo ' checked'; ?> /> iTunes Keywords Field</p>
202
+ <p style="margin-top: 15px;"><input id="episode_box_subtitle" name="General[episode_box_subtitle]" <?php if( $General['episode_box_mode'] != 2 ) echo 'disabled'; ?> type="checkbox" value="1"<?php if( $General['episode_box_subtitle'] ) echo ' checked'; ?> /> iTunes Subtitle Field</p>
203
+ <p style="margin-top: 15px;"><input id="episode_box_summary" name="General[episode_box_summary]" <?php if( $General['episode_box_mode'] != 2 ) echo 'disabled'; ?> type="checkbox" value="1"<?php if( $General['episode_box_summary'] ) echo ' checked'; ?> /> iTunes Summary Field</p>
204
+ <em>NOTE: An invalid entry into any of the iTunes fields may cause problems with your iTunes listing.
205
+ It is highly recommended that you validate your feed using feedvalidator.org everytime you modify any of the iTunes fields listed above.</em><br />
206
+ <em><strong>USE THE ITUNES FIELDS ABOVE AT YOUR OWN RISK.</strong></em>
207
+ </li>
208
  </ul>
209
  </li>
210
  </ul>
254
  ?>
255
  </div>
256
 
257
+
258
  <?php
259
 
260
  $ModeDesc = 'None';
306
  </th>
307
  <td>
308
  <input type="text" style="width: 60%;" name="General[redirect1]" value="<?php echo $General['redirect1']; ?>" onChange="return CheckRedirect(this);" maxlength="250" />
 
309
  </td>
310
  </tr>
311
  </table>
powerpressadmin-editfeed.php CHANGED
@@ -315,7 +315,7 @@ while( list($value,$desc) = each($applyoptions) )
315
 
316
  <tr valign="top">
317
  <th scope="row">
318
- <?php _e("Redirect Feed URL"); ?>
319
  </th>
320
  <td>
321
  <input type="text" name="Feed[feed_redirect_url]"style="width: 60%;" value="<?php echo $FeedSettings['feed_redirect_url']; ?>" maxlength="100" /> (leave blank to use current feed)
@@ -572,9 +572,14 @@ if( isset($Languages[ $rss_language ]) )
572
  <?php _e("Talent Name"); ?> <br />
573
  </th>
574
  <td>
575
- <input type="text" name="Feed[itunes_talent_name]"style="width: 60%;" value="<?php echo $FeedSettings['itunes_talent_name']; ?>" maxlength="250" />
 
 
576
  </td>
577
  </tr>
 
 
 
578
  <?php } // End AdvancedMode ?>
579
 
580
  <tr valign="top">
315
 
316
  <tr valign="top">
317
  <th scope="row">
318
+ <?php _e("FeedBurner Feed URL"); ?>
319
  </th>
320
  <td>
321
  <input type="text" name="Feed[feed_redirect_url]"style="width: 60%;" value="<?php echo $FeedSettings['feed_redirect_url']; ?>" maxlength="100" /> (leave blank to use current feed)
572
  <?php _e("Talent Name"); ?> <br />
573
  </th>
574
  <td>
575
+ <input type="text" name="Feed[itunes_talent_name]"style="width: 60%;" value="<?php echo $FeedSettings['itunes_talent_name']; ?>" maxlength="250" /><br />
576
+ <div><input type="checkbox" name="Feed[itunes_author_post]" value="1" <?php echo ($FeedSettings['itunes_author_post']?'checked ':''); ?>/> Use blog post author's name for individual episodes.
577
+
578
  </td>
579
  </tr>
580
+
581
+
582
+
583
  <?php } // End AdvancedMode ?>
584
 
585
  <tr valign="top">
powerpressadmin-metabox.php CHANGED
@@ -11,27 +11,46 @@ function powerpress_meta_box($object, $box)
11
  $DurationSS = '';
12
  $EnclosureURL = '';
13
  $EnclosureLength = '';
 
 
 
 
 
14
  $GeneralSettings = get_option('powerpress_general');
15
  if( !isset($GeneralSettings['set_size']) )
16
  $GeneralSettings['set_size'] = 0;
17
  if( !isset($GeneralSettings['set_duration']) )
18
  $GeneralSettings['set_duration'] = 0;
 
 
19
 
20
  if( $object->ID )
21
  {
 
22
  if( $FeedSlug == 'podcast' )
23
  $enclosureArray = get_post_meta($object->ID, 'enclosure', true);
24
  else
25
  $enclosureArray = get_post_meta($object->ID, '_'.$FeedSlug.':enclosure', true);
26
 
27
- list($EnclosureURL, $EnclosureLength, $EnclosureType, $EnclosureSerialized) = explode("\n", $enclosureArray);
28
  if( $EnclosureSerialized )
29
  {
30
  $ExtraData = @unserialize($EnclosureSerialized);
31
  if( $ExtraData && isset($ExtraData['duration']) )
32
  $iTunesDuration = $ExtraData['duration'];
 
 
 
 
 
 
 
 
 
 
33
  }
34
 
 
35
  if( $FeedSlug == 'podcast' && !$iTunesDuration )
36
  $iTunesDuration = get_post_meta($object->ID, 'itunes:duration', true);
37
 
@@ -83,8 +102,17 @@ function powerpress_meta_box($object, $box)
83
  <label for "Powerpress[<?php echo $FeedSlug; ?>][url]">Media URL</label>
84
  <div class="powerpress_row_content">
85
  <input id="powerpress_url_<?php echo $FeedSlug; ?>" name="Powerpress[<?php echo $FeedSlug; ?>][url]" value="<?php echo $EnclosureURL; ?>" onblur="powerpress_check_url(this.value,'powerpress_warning_<?php echo $FeedSlug; ?>')" style="width: 70%; font-size: 90%;" />
86
- <a href="<?php echo admin_url(); ?>?action=powerpress-jquery-media&podcast-feed=<?php echo $FeedSlug; ?>&KeepThis=true&TB_iframe=true" title="Select Media File" class="thickbox"><img src="<?php echo powerpress_get_root_url(); ?>/images/folder.png" alt="Browse Media Files" /></a>
87
  <input type="hidden" id="powerpress_hosting_<?php echo $FeedSlug; ?>" name="Powerpress[<?php echo $FeedSlug; ?>][hosting]" value="0" />
 
 
 
 
 
 
 
 
 
88
  </div>
89
  </div>
90
  <?php
@@ -129,6 +157,70 @@ function powerpress_meta_box($object, $box)
129
  <input id="powerpress_set_duration_<?php echo $FeedSlug; ?>" name="Powerpress[<?php echo $FeedSlug; ?>][set_duration]" value="0" type="hidden" />
130
  <?php
131
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
132
  ?>
133
  </div>
134
  </div>
11
  $DurationSS = '';
12
  $EnclosureURL = '';
13
  $EnclosureLength = '';
14
+ $Embed = '';
15
+ $iTunesKeywords = '';
16
+ $iTunesSubtitle = '';
17
+ $iTunesSummary = '';
18
+ $NoPlayer = false;
19
  $GeneralSettings = get_option('powerpress_general');
20
  if( !isset($GeneralSettings['set_size']) )
21
  $GeneralSettings['set_size'] = 0;
22
  if( !isset($GeneralSettings['set_duration']) )
23
  $GeneralSettings['set_duration'] = 0;
24
+ if( !isset($GeneralSettings['episode_box_embed']) )
25
+ $GeneralSettings['episode_box_embed'] = 0;
26
 
27
  if( $object->ID )
28
  {
29
+
30
  if( $FeedSlug == 'podcast' )
31
  $enclosureArray = get_post_meta($object->ID, 'enclosure', true);
32
  else
33
  $enclosureArray = get_post_meta($object->ID, '_'.$FeedSlug.':enclosure', true);
34
 
35
+ list($EnclosureURL, $EnclosureLength, $EnclosureType, $EnclosureSerialized) = explode("\n", $enclosureArray, 4);
36
  if( $EnclosureSerialized )
37
  {
38
  $ExtraData = @unserialize($EnclosureSerialized);
39
  if( $ExtraData && isset($ExtraData['duration']) )
40
  $iTunesDuration = $ExtraData['duration'];
41
+ if( $ExtraData && isset($ExtraData['embed']) )
42
+ $Embed = $ExtraData['embed'];
43
+ if( $ExtraData && isset($ExtraData['keywords']) )
44
+ $iTunesKeywords = $ExtraData['keywords'];
45
+ if( $ExtraData && isset($ExtraData['subtitle']) )
46
+ $iTunesSubtitle = $ExtraData['subtitle'];
47
+ if( $ExtraData && isset($ExtraData['summary']) )
48
+ $iTunesSummary = $ExtraData['summary'];
49
+ if( $ExtraData && isset($ExtraData['no_player']) )
50
+ $NoPlayer = $ExtraData['no_player'];
51
  }
52
 
53
+
54
  if( $FeedSlug == 'podcast' && !$iTunesDuration )
55
  $iTunesDuration = get_post_meta($object->ID, 'itunes:duration', true);
56
 
102
  <label for "Powerpress[<?php echo $FeedSlug; ?>][url]">Media URL</label>
103
  <div class="powerpress_row_content">
104
  <input id="powerpress_url_<?php echo $FeedSlug; ?>" name="Powerpress[<?php echo $FeedSlug; ?>][url]" value="<?php echo $EnclosureURL; ?>" onblur="powerpress_check_url(this.value,'powerpress_warning_<?php echo $FeedSlug; ?>')" style="width: 70%; font-size: 90%;" />
105
+ <a href="<?php echo admin_url(); ?>?action=powerpress-jquery-media&podcast-feed=<?php echo $FeedSlug; ?>&KeepThis=true&TB_iframe=true" title="Select Media File" class="thickbox"><img src="<?php echo powerpress_get_root_url(); ?>/images/blubrry_folder.png" alt="Browse Media Files" /></a>
106
  <input type="hidden" id="powerpress_hosting_<?php echo $FeedSlug; ?>" name="Powerpress[<?php echo $FeedSlug; ?>][hosting]" value="0" />
107
+ <?php
108
+
109
+ if( $GeneralSettings['episode_box_mode'] == 2 && $GeneralSettings['episode_box_no_player'] )
110
+ {
111
+ ?>
112
+ <div style="margin-left: 2px; padding-bottom: 2px; padding-top: 2px;"><input id="powerpress_no_player_<?php echo $FeedSlug; ?>" name="Powerpress[<?php echo $FeedSlug; ?>][no_player]" value="1" type="checkbox" <?php echo ($NoPlayer==1?'checked':''); ?> /> Do not display player for media above</div>
113
+ <?php
114
+ }
115
+ ?>
116
  </div>
117
  </div>
118
  <?php
157
  <input id="powerpress_set_duration_<?php echo $FeedSlug; ?>" name="Powerpress[<?php echo $FeedSlug; ?>][set_duration]" value="0" type="hidden" />
158
  <?php
159
  }
160
+
161
+
162
+ if( $GeneralSettings['episode_box_mode'] == 2 )
163
+ {
164
+ // Embed option, enter your own embed code provided by sites such as YouTube, Viddler and Blip.tv
165
+ if( $GeneralSettings['episode_box_embed'] )
166
+ {
167
+ ?>
168
+ <div class="powerpress_row">
169
+ <label for "Powerpress[<?php echo $FeedSlug; ?>][embed]">Media Embed</label>
170
+ <div class="powerpress_row_content">
171
+ <textarea id="powerpress_embed_<?php echo $FeedSlug; ?>" name="Powerpress[<?php echo $FeedSlug; ?>][embed]" style="width: 90%; height: 80px; font-size: 90%;" onfocus="this.select();"><?php echo htmlspecialchars($Embed); ?></textarea>
172
+ </div>
173
+ </div>
174
+ <?php
175
+ }
176
+
177
+ if( $GeneralSettings['episode_box_keywords'] )
178
+ {
179
+ ?>
180
+ <div class="powerpress_row">
181
+ <label for "Powerpress[<?php echo $FeedSlug; ?>][keywords]">iTunes Keywords</label>
182
+ <div class="powerpress_row_content">
183
+ <input id="powerpress_keywords_<?php echo $FeedSlug; ?>" name="Powerpress[<?php echo $FeedSlug; ?>][keywords]" value="<?php echo htmlspecialchars($iTunesKeywords); ?>" style="width: 90%; font-size: 90%;" size="250" />
184
+ </div>
185
+ <div class="powerpress_row_content">
186
+ <em>Enter up to 12 keywords separated by commas. Leave blank to use your blog post tags.</em>
187
+ </div>
188
+ </div>
189
+ <?php
190
+ }
191
+
192
+ if( $GeneralSettings['episode_box_subtitle'] )
193
+ {
194
+ ?>
195
+ <div class="powerpress_row">
196
+ <label for "Powerpress[<?php echo $FeedSlug; ?>][subtitle]">iTunes Subtitle</label>
197
+ <div class="powerpress_row_content">
198
+ <input id="powerpress_subtitle_<?php echo $FeedSlug; ?>" name="Powerpress[<?php echo $FeedSlug; ?>][subtitle]" value="<?php echo htmlspecialchars($iTunesSubtitle); ?>" style="width: 90%; font-size: 90%;" size="250" />
199
+ </div>
200
+ <div class="powerpress_row_content">
201
+ <em>Your subtitle may not contain HTML and cannot exceed 250 characters in length.
202
+ Leave blank to use the first 250 characters of your blog post.</em>
203
+ </div>
204
+ </div>
205
+ <?php
206
+ }
207
+
208
+ if( $GeneralSettings['episode_box_summary'] )
209
+ {
210
+ ?>
211
+ <div class="powerpress_row">
212
+ <label for "Powerpress[<?php echo $FeedSlug; ?>][summary]">iTunes Summary</label>
213
+ <div class="powerpress_row_content">
214
+ <textarea id="powerpress_summary_<?php echo $FeedSlug; ?>" name="Powerpress[<?php echo $FeedSlug; ?>][summary]" style="width: 90%; height: 80px; font-size: 90%;"><?php echo htmlspecialchars($iTunesSummary); ?></textarea>
215
+ </div>
216
+ <div class="powerpress_row_content">
217
+ <em>Your summary may not contain HTML and cannot exceed 4,000 characters in length.
218
+ Leave blank to use your blog post.</em>
219
+ </div>
220
+ </div>
221
+ <?php
222
+ }
223
+ }
224
  ?>
225
  </div>
226
  </div>
powerpressadmin-mt.php CHANGED
@@ -145,7 +145,7 @@
145
 
146
  if( $DetectDuration )
147
  {
148
- require_once('mp3info.class.php');
149
  $Mp3Info = new Mp3Info();
150
  }
151
 
145
 
146
  if( $DetectDuration )
147
  {
148
+ require_once(dirname(__FILE__).'/mp3info.class.php');
149
  $Mp3Info = new Mp3Info();
150
  }
151
 
powerpressadmin.php CHANGED
@@ -42,7 +42,7 @@ function powerpress_admin_init()
42
  }
43
 
44
  // Check for other podcasting plugin
45
- if( defined('PODPRESS_VERSION') || isset($GLOBALS['podcasting_player_id']) || isset($GLOBALS['podcast_channel_active']) )
46
  powerpress_page_message_add_error( __('Another podcasting plugin has been detected, PowerPress is currently disabled.') );
47
 
48
  global $wp_version;
@@ -174,6 +174,17 @@ function powerpress_admin_init()
174
  $General['disable_dashboard_widget'] = 0;
175
  if( !isset($_POST['StatsInDashboard'] ) )
176
  $General['disable_dashboard_widget'] = 1;
 
 
 
 
 
 
 
 
 
 
 
177
  }
178
 
179
  if( $_POST['action'] == 'powerpress-save-tags' )
@@ -234,6 +245,9 @@ function powerpress_admin_init()
234
  {
235
  if( !isset($Feed['enhance_itunes_summary']) )
236
  $Feed['enhance_itunes_summary'] = false;
 
 
 
237
  $Feed = powerpress_stripslashes($Feed);
238
  if( $Category )
239
  powerpress_save_settings($Feed, 'powerpress_cat_feed_'.$Category);
@@ -524,6 +538,9 @@ function powerpress_admin_init()
524
 
525
  if( function_exists('powerpress_admin_jquery_init') )
526
  powerpress_admin_jquery_init();
 
 
 
527
  }
528
 
529
  add_action('init', 'powerpress_admin_init');
@@ -609,7 +626,7 @@ function powerpress_admin_menu()
609
  {
610
  $Powerpress = get_option('powerpress_general');
611
 
612
- if( defined('PODPRESS_VERSION') || isset($GLOBALS['podcasting_player_id']) || isset($GLOBALS['podcast_channel_active']) )
613
  {
614
  // CRAP
615
  }
@@ -652,6 +669,9 @@ function powerpress_admin_menu()
652
  add_menu_page(__('PowerPress'), __('PowerPress'), 1, 'powerpress/powerpressadmin_basic.php', 'powerpress_admin_page_basic', powerpress_get_root_url() . 'powerpress_ico.png');
653
  add_submenu_page('powerpress/powerpressadmin_basic.php', __('PowerPress Basic Settings'), __('Basic Settings'), 1, 'powerpress/powerpressadmin_basic.php', 'powerpress_admin_page_basic' );
654
  add_submenu_page('powerpress/powerpressadmin_basic.php', __('PowerPress Appearance Settings'), __('Appearance'), 1, 'powerpress/powerpressadmin_appearance.php', 'powerpress_admin_page_appearance' );
 
 
 
655
  add_submenu_page('powerpress/powerpressadmin_basic.php', __('PowerPress General Feed Settings'), __('Feeds General'), 1, 'powerpress/powerpressadmin_feedsettings.php', 'powerpress_admin_page_feedsettings');
656
  add_submenu_page('powerpress/powerpressadmin_basic.php', __('PowerPress Custom Podcast Feeds'), __('Custom Feeds'), 1, 'powerpress/powerpressadmin_customfeeds.php', 'powerpress_admin_page_customfeeds');
657
  add_submenu_page('powerpress/powerpressadmin_basic.php', __('PowerPress Category Podcast Feeds'), __('Category Feeds'), 1, 'powerpress/powerpressadmin_categoryfeeds.php', 'powerpress_admin_page_categoryfeeds');
@@ -711,6 +731,7 @@ function powerpress_edit_post($post_ID, $post)
711
  $FileSize = '';
712
  $ContentType = '';
713
  $Duration = false;
 
714
 
715
  // Get the content type based on the file extension, first we have to remove query string if it exists
716
  $UrlParts = parse_url($Powerpress['url']);
@@ -768,7 +789,7 @@ function powerpress_edit_post($post_ID, $post)
768
  else
769
  {
770
  // Lets use the mp3info class:
771
- require_once('mp3info.class.php');
772
 
773
  $Mp3Info = new Mp3Info();
774
  if( $Powerpress['set_duration'] == 0 && $ContentType == 'audio/mpeg' )
@@ -813,25 +834,27 @@ function powerpress_edit_post($post_ID, $post)
813
  $ToSerialize['duration'] = $Duration; // regular expression '/^(\d{1,2}\:)?\d{1,2}\:\d\d$/i' (examples: 1:23, 12:34, 1:23:45, 12:34:56)
814
  // iTunes Subtitle (FUTURE USE)
815
  if( isset($Powerpress['subtitle']) && trim($Powerpress['subtitle']) != '' )
816
- $ToSerialize['subtitle'] = $Powerpress['subtitle'];
817
  // iTunes Summary (FUTURE USE)
818
  if( isset($Powerpress['summary']) && trim($Powerpress['summary']) != '' )
819
- $ToSerialize['summary'] = $Powerpress['summary'];
820
  // iTunes keywords (FUTURE USE)
821
  if( isset($Powerpress['keywords']) && trim($Powerpress['keywords']) != '' )
822
- $ToSerialize['keywords'] = $Powerpress['keywords'];
823
  // iTunes Author (FUTURE USE)
824
  if( isset($Powerpress['author']) && trim($Powerpress['author']) != '' )
825
- $ToSerialize['author'] = $Powerpress['author'];
826
  // iTunes Explicit (FUTURE USE)
827
  if( isset($Powerpress['explicit']) && trim($Powerpress['explicit']) != '' )
828
  $ToSerialize['explicit'] = $Powerpress['explicit'];
829
  // iTunes Block (FUTURE USE)
830
  if( isset($Powerpress['block']) && (trim($Powerpress['block']) == 'yes' || trim($Powerpress['block']) == 'no') )
831
  $ToSerialize['block'] = ($Powerpress['block']=='yes'?'yes':'');
832
- // Player Embed (FUTURE USE)
833
- if( isset($Powerpress['player_embed']) && trim($Powerpress['player_embed']) != '' )
834
- $ToSerialize['player_embed'] = $Powerpress['player_embed'];
 
 
835
  if( $Powerpress['set_duration'] == -1 )
836
  unset($ToSerialize['duration']);
837
  if( count($ToSerialize) > 0 ) // Lets add the serialized data
@@ -1074,7 +1097,9 @@ function powerpress_admin_page_footer($SaveButton=true)
1074
  <?php } ?>
1075
  <p style="font-size: 85%; text-align: center; padding-bottom: 25px;">
1076
  <a href="http://www.blubrry.com/powerpress/" title="Blubrry PowerPress" target="_blank">Blubrry PowerPress</a> <?php echo POWERPRESS_VERSION; ?>
1077
- &#8212; <a href="http://help.blubrry.com/blubrry-powerpress/" target="_blank" title="Blubrry PowerPress Documentation">Documentation</a> | <a href="http://twitter.com/blubrry" target="_blank" title="Follow Blubrry on Twitter">Follow Blubrry on Twitter</a>
 
 
1078
  </p>
1079
  </form>
1080
  </div>
@@ -1090,6 +1115,15 @@ function powerpress_admin_page_basic()
1090
  powerpress_admin_page_footer(true);
1091
  }
1092
 
 
 
 
 
 
 
 
 
 
1093
  // Admin page, advanced mode: appearance settings
1094
  function powerpress_admin_page_appearance()
1095
  {
@@ -1228,15 +1262,7 @@ function powerpress_admin_page()
1228
  powerpress_admin_page_footer(true);
1229
  }
1230
  }
1231
-
1232
- function powerpress_shutdown()
1233
- {
1234
- global $wpdb;
1235
- $wpdb->query("DELETE FROM {$wpdb->postmeta} WHERE meta_key = '_encloseme' ");
1236
- }
1237
 
1238
- add_action('shutdown','powerpress_shutdown'); // disable the auto enclosure process
1239
-
1240
  /*
1241
  // Helper functions:
1242
  */
@@ -1668,6 +1694,12 @@ function powerpress_default_settings($Settings, $Section='basic')
1668
  $Settings['podcast_link'] = 1;
1669
  if( !isset($Settings['display_player_excerpt']) )
1670
  $Settings['display_player_excerpt'] = 0;
 
 
 
 
 
 
1671
  }; break;
1672
  }
1673
 
@@ -1752,8 +1784,11 @@ function powerpress_get_media_info($file)
1752
  return array('error'=>'Error occurred obtaining media information.');
1753
  }
1754
 
1755
- require_once('powerpressadmin-jquery.php');
1756
  // Only include the dashboard when appropriate.
1757
- require_once('powerpressadmin-dashboard.php');
 
 
 
1758
 
1759
  ?>
42
  }
43
 
44
  // Check for other podcasting plugin
45
+ if( defined('PODPRESS_VERSION') || isset($GLOBALS['podcasting_player_id']) || isset($GLOBALS['podcast_channel_active']) || defined('PODCASTING_VERSION') )
46
  powerpress_page_message_add_error( __('Another podcasting plugin has been detected, PowerPress is currently disabled.') );
47
 
48
  global $wp_version;
174
  $General['disable_dashboard_widget'] = 0;
175
  if( !isset($_POST['StatsInDashboard'] ) )
176
  $General['disable_dashboard_widget'] = 1;
177
+
178
+ if( !isset($General['episode_box_embed'] ) )
179
+ $General['episode_box_embed'] = 0;
180
+ if( !isset($General['episode_box_no_player'] ) )
181
+ $General['episode_box_no_player'] = 0;
182
+ if( !isset($General['episode_box_keywords'] ) )
183
+ $General['episode_box_keywords'] = 0;
184
+ if( !isset($General['episode_box_subtitle'] ) )
185
+ $General['episode_box_subtitle'] = 0;
186
+ if( !isset($General['episode_box_summary'] ) )
187
+ $General['episode_box_summary'] = 0;
188
  }
189
 
190
  if( $_POST['action'] == 'powerpress-save-tags' )
245
  {
246
  if( !isset($Feed['enhance_itunes_summary']) )
247
  $Feed['enhance_itunes_summary'] = false;
248
+ if( !isset($Feed['itunes_author_post']) )
249
+ $Feed['itunes_author_post'] = false;
250
+
251
  $Feed = powerpress_stripslashes($Feed);
252
  if( $Category )
253
  powerpress_save_settings($Feed, 'powerpress_cat_feed_'.$Category);
538
 
539
  if( function_exists('powerpress_admin_jquery_init') )
540
  powerpress_admin_jquery_init();
541
+
542
+ if( defined('POWERPRESS_PLAYERS') && POWERPRESS_PLAYERS )
543
+ powerpress_admin_players_init();
544
  }
545
 
546
  add_action('init', 'powerpress_admin_init');
626
  {
627
  $Powerpress = get_option('powerpress_general');
628
 
629
+ if( defined('PODPRESS_VERSION') || isset($GLOBALS['podcasting_player_id']) || isset($GLOBALS['podcast_channel_active']) || defined('PODCASTING_VERSION') )
630
  {
631
  // CRAP
632
  }
669
  add_menu_page(__('PowerPress'), __('PowerPress'), 1, 'powerpress/powerpressadmin_basic.php', 'powerpress_admin_page_basic', powerpress_get_root_url() . 'powerpress_ico.png');
670
  add_submenu_page('powerpress/powerpressadmin_basic.php', __('PowerPress Basic Settings'), __('Basic Settings'), 1, 'powerpress/powerpressadmin_basic.php', 'powerpress_admin_page_basic' );
671
  add_submenu_page('powerpress/powerpressadmin_basic.php', __('PowerPress Appearance Settings'), __('Appearance'), 1, 'powerpress/powerpressadmin_appearance.php', 'powerpress_admin_page_appearance' );
672
+ if( defined('POWERPRESS_PLAYERS') && POWERPRESS_PLAYERS )
673
+ add_submenu_page('powerpress/powerpressadmin_basic.php', __('PowerPress Flash Player'), __('Flash Player'), 1, 'powerpress/powerpressadmin_player.php', 'powerpress_admin_page_players');
674
+
675
  add_submenu_page('powerpress/powerpressadmin_basic.php', __('PowerPress General Feed Settings'), __('Feeds General'), 1, 'powerpress/powerpressadmin_feedsettings.php', 'powerpress_admin_page_feedsettings');
676
  add_submenu_page('powerpress/powerpressadmin_basic.php', __('PowerPress Custom Podcast Feeds'), __('Custom Feeds'), 1, 'powerpress/powerpressadmin_customfeeds.php', 'powerpress_admin_page_customfeeds');
677
  add_submenu_page('powerpress/powerpressadmin_basic.php', __('PowerPress Category Podcast Feeds'), __('Category Feeds'), 1, 'powerpress/powerpressadmin_categoryfeeds.php', 'powerpress_admin_page_categoryfeeds');
731
  $FileSize = '';
732
  $ContentType = '';
733
  $Duration = false;
734
+ $Embed = false;
735
 
736
  // Get the content type based on the file extension, first we have to remove query string if it exists
737
  $UrlParts = parse_url($Powerpress['url']);
789
  else
790
  {
791
  // Lets use the mp3info class:
792
+ require_once(dirname(__FILE__).'/mp3info.class.php');
793
 
794
  $Mp3Info = new Mp3Info();
795
  if( $Powerpress['set_duration'] == 0 && $ContentType == 'audio/mpeg' )
834
  $ToSerialize['duration'] = $Duration; // regular expression '/^(\d{1,2}\:)?\d{1,2}\:\d\d$/i' (examples: 1:23, 12:34, 1:23:45, 12:34:56)
835
  // iTunes Subtitle (FUTURE USE)
836
  if( isset($Powerpress['subtitle']) && trim($Powerpress['subtitle']) != '' )
837
+ $ToSerialize['subtitle'] = stripslashes($Powerpress['subtitle']);
838
  // iTunes Summary (FUTURE USE)
839
  if( isset($Powerpress['summary']) && trim($Powerpress['summary']) != '' )
840
+ $ToSerialize['summary'] = stripslashes($Powerpress['summary']);
841
  // iTunes keywords (FUTURE USE)
842
  if( isset($Powerpress['keywords']) && trim($Powerpress['keywords']) != '' )
843
+ $ToSerialize['keywords'] = stripslashes($Powerpress['keywords']);
844
  // iTunes Author (FUTURE USE)
845
  if( isset($Powerpress['author']) && trim($Powerpress['author']) != '' )
846
+ $ToSerialize['author'] = stripslashes($Powerpress['author']);
847
  // iTunes Explicit (FUTURE USE)
848
  if( isset($Powerpress['explicit']) && trim($Powerpress['explicit']) != '' )
849
  $ToSerialize['explicit'] = $Powerpress['explicit'];
850
  // iTunes Block (FUTURE USE)
851
  if( isset($Powerpress['block']) && (trim($Powerpress['block']) == 'yes' || trim($Powerpress['block']) == 'no') )
852
  $ToSerialize['block'] = ($Powerpress['block']=='yes'?'yes':'');
853
+ // Player Embed
854
+ if( isset($Powerpress['embed']) && trim($Powerpress['embed']) != '' )
855
+ $ToSerialize['embed'] = stripslashes($Powerpress['embed']); // we have to strip slahes if they are present befure we serialize the data
856
+ if( isset($Powerpress['no_player']) && $Powerpress['no_player'] )
857
+ $ToSerialize['no_player'] = 1;
858
  if( $Powerpress['set_duration'] == -1 )
859
  unset($ToSerialize['duration']);
860
  if( count($ToSerialize) > 0 ) // Lets add the serialized data
1097
  <?php } ?>
1098
  <p style="font-size: 85%; text-align: center; padding-bottom: 25px;">
1099
  <a href="http://www.blubrry.com/powerpress/" title="Blubrry PowerPress" target="_blank">Blubrry PowerPress</a> <?php echo POWERPRESS_VERSION; ?>
1100
+ &#8212; <a href="http://help.blubrry.com/blubrry-powerpress/" target="_blank" title="Blubrry PowerPress Documentation">Documentation</a> |
1101
+ <a href="http://forum.blubrry.com/" target="_blank" title="Blubrry Forum">Forum</a> |
1102
+ <a href="http://twitter.com/blubrry" target="_blank" title="Follow Blubrry on Twitter">Follow Blubrry on Twitter</a>
1103
  </p>
1104
  </form>
1105
  </div>
1115
  powerpress_admin_page_footer(true);
1116
  }
1117
 
1118
+ // Admin page, advanced mode: basic settings
1119
+ function powerpress_admin_page_players()
1120
+ {
1121
+ powerpress_admin_page_header();
1122
+ require_once( dirname(__FILE__).'/powerpressadmin-basic.php');
1123
+ powerpress_admin_players();
1124
+ powerpress_admin_page_footer(true);
1125
+ }
1126
+
1127
  // Admin page, advanced mode: appearance settings
1128
  function powerpress_admin_page_appearance()
1129
  {
1262
  powerpress_admin_page_footer(true);
1263
  }
1264
  }
 
 
 
 
 
 
1265
 
 
 
1266
  /*
1267
  // Helper functions:
1268
  */
1694
  $Settings['podcast_link'] = 1;
1695
  if( !isset($Settings['display_player_excerpt']) )
1696
  $Settings['display_player_excerpt'] = 0;
1697
+ // Play in page obsolete, switching here:
1698
+ if( $Settings['player_function'] == 5 )
1699
+ $Settings['player_function'] = 1;
1700
+ else if( $Settings['player_function'] == 4 )
1701
+ $Settings['player_function'] = 2;
1702
+
1703
  }; break;
1704
  }
1705
 
1784
  return array('error'=>'Error occurred obtaining media information.');
1785
  }
1786
 
1787
+ require_once( dirname(__FILE__).'/powerpressadmin-jquery.php');
1788
  // Only include the dashboard when appropriate.
1789
+ require_once(dirname(__FILE__).'/powerpressadmin-dashboard.php');
1790
+ if( defined('POWERPRESS_PLAYERS') && POWERPRESS_PLAYERS )
1791
+ require_once(dirname(__FILE__).'/powerpressadmin-player.php');
1792
+
1793
 
1794
  ?>
readme.txt CHANGED
@@ -1,9 +1,9 @@
1
  === Blubrry PowerPress Podcasting plugin ===
2
  Contributors: Angelo Mandato, Blubrry.com
3
- Tags: podcast, podcasting, itunes, enclosure, zune, iphone, audio, video, rss2, feed, player, media, rss, mp3, music, embed, feedburner, statistics, stats
4
  Requires at least: 2.6.0
5
- Tested up to: 2.8.1
6
- Stable tag: 0.8.3
7
 
8
  Add podcasting support to your blog.
9
 
@@ -16,9 +16,11 @@ Features:
16
 
17
  * Easily add/modify/remove podcast episodes from blog posts and pages
18
  * Integrated audio/video media player
 
 
19
  * Podcast Only Feed
20
  * Custom Podcast Feeds (no limit)
21
- * Category Podcast Feeds
22
  * Integrated Media Hosting via Blubrry Services
23
  * Integrated Media Statistics via Blubrry Services
24
  * Mp3 ID3 Tagging via Blubrry Services
@@ -32,7 +34,6 @@ Features:
32
  * 3rd party statistics integration
33
  * Import PodPress settings and media episodes
34
  * Import Blogger/Movable Type media episodes
35
- * Category Podcast Feeds (Category Casting)
36
  * Tag/Keyword Podcast Feeds (Tag Casting)
37
  * Hosted Feed Support (FeedBurner.com)
38
  * User Role Management (Control which users on blog can Podcast)
@@ -54,11 +55,19 @@ Blubrry PowerPress does not allow you to include multiple media files for one fe
54
 
55
  As a alternative, PowerPress allows you to create additional Custom Podcast Feeds to associate additional media files in a blog post to specific feeds.
56
 
57
- = Why doesn't Blubrry PowerPress include media statistics? =
58
- Blubrry PowerPress does not include media statistics. This is not because Blubrry has its own statistics service, although that's a good reason by itself. Maintaining and calculating statistics is a resource and server intensive task that would add bloat to an otherwise lightweight Wordpress podcasting plugin. We recommend you use your media hosting's statistics and you're more than welcome to use the [Blubrry Statistics service](http://www.blubrry.com/podcast_statistics/) as well.
 
 
 
 
 
59
 
60
- = Looking for a better Audio Player? =
61
- Check out the <a href="http://wpaudioplayer.com" target="_blank" title="WP Audio Player 2.0">WP Audio Player 2.0</a>. The WP Audio Player 2.0 options include theme colors, initial volume, player width and more.
 
 
 
62
 
63
  == Installation ==
64
  1. Copy the entire directory from the downloaded zip file into the /wp-content/plugins/ folder.
@@ -72,6 +81,17 @@ As a alternative, PowerPress allows you to create additional Custom Podcast Feed
72
 
73
  == Changelog ==
74
 
 
 
 
 
 
 
 
 
 
 
 
75
  0.8.3 released on 6/27/2009
76
  Fixed bug with feed redirect URL setting for custom feeds, added option to disable the dashboard statistics widget, fixed 2 bugs with Blubrry hosting integration: media URL field no longer read-only after publishing and ID3 write tags bug fixed.
77
 
1
  === Blubrry PowerPress Podcasting plugin ===
2
  Contributors: Angelo Mandato, Blubrry.com
3
+ Tags: podcast, podcasting, itunes, enclosure, zune, iphone, youtube, viddler, blip.tv, audio, video, rss2, feed, player, media, rss, mp3, music, embed, feedburner, statistics, stats, flv, flash, id3, episodes, blubrry
4
  Requires at least: 2.6.0
5
+ Tested up to: 2.8.2
6
+ Stable tag: 0.9.0
7
 
8
  Add podcasting support to your blog.
9
 
16
 
17
  * Easily add/modify/remove podcast episodes from blog posts and pages
18
  * Integrated audio/video media player
19
+ * Embed player within blog posts with [powerpress] shortcode
20
+ * Supports embeds from sites such as YouTube, Viddler and Blip.tv
21
  * Podcast Only Feed
22
  * Custom Podcast Feeds (no limit)
23
+ * Category Podcast Feeds (Category Casting)
24
  * Integrated Media Hosting via Blubrry Services
25
  * Integrated Media Statistics via Blubrry Services
26
  * Mp3 ID3 Tagging via Blubrry Services
34
  * 3rd party statistics integration
35
  * Import PodPress settings and media episodes
36
  * Import Blogger/Movable Type media episodes
 
37
  * Tag/Keyword Podcast Feeds (Tag Casting)
38
  * Hosted Feed Support (FeedBurner.com)
39
  * User Role Management (Control which users on blog can Podcast)
55
 
56
  As a alternative, PowerPress allows you to create additional Custom Podcast Feeds to associate additional media files in a blog post to specific feeds.
57
 
58
+ = Why doesn't Blubrry PowerPress include media statistics built-in? =
59
+ Blubrry PowerPress does not include media statistics built-in. This is not because Blubrry has its own statistics service, although that's a good reason by itself. Maintaining and calculating statistics is a resource and server intensive task that would add bloat to an otherwise lightweight Wordpress podcasting plugin. We recommend you use your media hosting's statistics and you're more than welcome to use the [Blubrry Statistics service](http://www.blubrry.com/podcast_statistics/) as well.
60
+
61
+ As of Blubrry PowerPress version 0.8, you may now access your Blubrry Statistics from within your WordPress dashboard.
62
+
63
+ = How do you insert the player within a blog post? =
64
+ As of PowerPress 0.9, you can insert the media player within yoru blog posts by using the WordPress shortcode feature. The shortcode for PowerPress is [powerpress] (all lowercase)
65
 
66
+ You may use the shortcode to add a player to other media files (non episode files) by specifying the media url in the shortcode: [powerpress url="http://example.com/path/to/media.mp3"]
67
+
68
+ For advanced users with multiple podcast feeds, you may insert the player for a specific feed by specifying the feed slug in the shortcode: [powerpress feed="podcast"]
69
+
70
+ If you want to specify a cover image, add an image attribute which points to the specific image url: [powerpress image="http://example.com/path/to/cover_image.jpg"] *Experimental*
71
 
72
  == Installation ==
73
  1. Copy the entire directory from the downloaded zip file into the /wp-content/plugins/ folder.
81
 
82
  == Changelog ==
83
 
84
+ 0.9.0 released on 7/20/2009
85
+ Added `powerpress_get_enclosure_data()` and `powerpress_get_enclosure()` courtesy functions for theme developers to obtain enclosure data, changed the icon used for selecting blubrry hosted media, added m4b and m4r to list of detected audio formats, relabled Redirect Feed URL to FeedBurner Feed URL to clear up confusion.
86
+
87
+ Completely revamped the on page and new window players, removed the "play in page" options as they were a source of confusion for some users, Added code to support poorly written themes that capture post content incorrectly,
88
+
89
+ New powerpress shortcode added, enter [powerpress] within your post and the player will be inserted at that location, player. New embed option added to episode entry box, displayed just above the built-in player. New option to remove the player on a per episode basis. New optional episode entry fields for iTunes Keywords, iTunes Subtitle and iTunes Summary.
90
+
91
+ Added courtesy functions `the_powerpress_content()` and `get_the_powerpress_content()` for theme developers to use for special themes. Example usage: `<?php if( function_exists('the_powerpress_content') ) the_powerpress_content(); ?>`
92
+
93
+ Bugs: Fixed bug with `require_once()` calls on some servers displaying a fatal error, fixed scheduled posts bug with WordPress 2.8+.
94
+
95
  0.8.3 released on 6/27/2009
96
  Fixed bug with feed redirect URL setting for custom feeds, added option to disable the dashboard statistics widget, fixed 2 bugs with Blubrry hosting integration: media URL field no longer read-only after publishing and ID3 write tags bug fixed.
97