PowerPress Podcasting plugin by Blubrry - Version 5.0.10

Version Description

  • Released on 12/16/2014
  • Update your copy of PowerPress to version 5.0.10 immediately
  • Due to concerns of possible security exploits, the FlowPlayer flash based player has been removed from PowerPress as of version 5.0.10. PowerPress users are strongly encouraged to update their copy of PowerPress immediately.
  • FlowPlayer will be replaced with the default WordPress MediaElement.js player.
Download this release

Release Info

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

Code changes from version 5.0.9 to 5.0.10

FlowPlayerClassic.swf DELETED
Binary file
player.js CHANGED
@@ -151,19 +151,12 @@ function powerpress_embed_html5v(id,media_url,width,height,webm_media_url)
151
  document.getElementById('powerpress_player_'+id).innerHTML = '';
152
  document.getElementById('powerpress_player_'+id).appendChild(v);
153
  v.play();
154
- } else {
155
- delete(v);
156
- pp_flashembed(
157
- 'powerpress_player_'+id,
158
- {src: powerpress_url +'FlowPlayerClassic.swf', width: width, height: height, wmode: 'transparent' },
159
- {config: { autoPlay: true, autoBuffering: true, showFullScreenButton: true, showMenu: false, videoFile: media_url, loop: false, autoRewind: true, splashImageFile: poster } }
160
- );
161
  }
162
-
163
- if( window.powerpress_resize_player )
164
- powerpress_resize_player();
165
-
166
- return false; // stop the default link from proceeding
167
  }
168
 
169
  return true; // let the default link to the media open...
@@ -213,18 +206,8 @@ function powerpress_embed_html5a(id,media_url)
213
  document.getElementById('powerpress_player_'+id).innerHTML = '';
214
  document.getElementById('powerpress_player_'+id).appendChild(a);
215
  a.play();
216
- } else {
217
- delete(a);
218
- if( contentType != 'audio/ogg') {
219
- pp_flashembed(
220
- 'powerpress_player_'+id,
221
- {src: powerpress_url +'FlowPlayerClassic.swf', width: 320, height: 24, wmode: 'transparent' },
222
- {config: { autoPlay: true, autoBuffering: true, showFullScreenButton: false, showMenu: false, videoFile: media_url, loop: false, autoRewind: true } }
223
- );
224
- } else { return true; }
225
  }
226
-
227
- return false; // stop the default link from proceeding
228
  }
229
 
230
  return true; // let the default link to the media open...
151
  document.getElementById('powerpress_player_'+id).innerHTML = '';
152
  document.getElementById('powerpress_player_'+id).appendChild(v);
153
  v.play();
154
+
155
+ if( window.powerpress_resize_player )
156
+ powerpress_resize_player();
157
+
158
+ return false; // stop the default link from proceeding
 
 
159
  }
 
 
 
 
 
160
  }
161
 
162
  return true; // let the default link to the media open...
206
  document.getElementById('powerpress_player_'+id).innerHTML = '';
207
  document.getElementById('powerpress_player_'+id).appendChild(a);
208
  a.play();
209
+ return false; // stop the default link from proceeding
 
 
 
 
 
 
 
 
210
  }
 
 
211
  }
212
 
213
  return true; // let the default link to the media open...
powerpress-player.php CHANGED
@@ -58,17 +58,17 @@ function powerpressplayer_init($GeneralSettings)
58
 
59
 
60
  $enqueue_mejs = false;
61
- if( !isset($GeneralSettings['player']) || !isset($GeneralSettings['video_player']) )
62
- {
63
  if( version_compare($GLOBALS['wp_version'], '3.6-alpha', '>') )
64
  $enqueue_mejs = true;
65
- }
66
 
67
- if( !empty($GeneralSettings['player']) && $GeneralSettings['player'] == 'mediaelement-audio' )
68
  {
69
  $enqueue_mejs = true;
70
  }
71
- else if( !empty($GeneralSettings['video_player']) && $GeneralSettings['video_player'] == 'mediaelement-video' )
72
  {
73
  $enqueue_mejs = true;
74
  }
@@ -412,23 +412,7 @@ function powerpressplayer_build_embed($player, $media_url, $EpisodeData = array(
412
  function do_powerpressplayer_embed($player, $media_url, $EpisodeData = array())
413
  {
414
  // Includde the stuff we need...
415
- switch( $player )
416
- {
417
- case 'mejs-a':
418
- case 'mejs-v':
419
- case 'mediaelement-audio':
420
- case 'mediaelement-video': {
421
- // Enqueue stuff for mediaelements
422
-
423
- wp_enqueue_style('mediaelement');
424
- wp_enqueue_style('wp-mediaelement');
425
- wp_enqueue_script('mediaelement');
426
- //wp_enqueue_script( 'powerpress-mejs', powerpress_get_root_url() .'powerpress-mejs.js');
427
- }; break;
428
- default: {
429
- //wp_enqueue_script('jquery');
430
- }; break;
431
- }
432
  wp_enqueue_script('jquery');
433
 
434
  $content = '';
@@ -523,7 +507,7 @@ function do_powerpressplayer_embed($player, $media_url, $EpisodeData = array())
523
  if( !is_array($EpisodeData) )
524
  $EpisodeData = array();
525
 
526
- $content .= powerpressplayer_build_flowplayerclassic($media_url, $EpisodeData + array('jquery_autowidth'=>true) );
527
 
528
  // $content .= 'Video Flow Player Classic coming soon!';
529
  }; break;
@@ -1551,88 +1535,11 @@ function powerpressplayer_build_html5mobile($media_url, $EpisodeData)
1551
  /*
1552
  Flow Player Classic
1553
  */
1554
- function powerpressplayer_build_flowplayerclassic($media_url, $EpisodeData = array())
1555
  {
1556
- // Very important setting, we need to know if the media should auto play or not...
1557
- $autoplay = false; // (default)
1558
- if( !empty($EpisodeData['autoplay']) )
1559
- $autoplay = true;
1560
- $cover_image = '';
1561
- $player_width = 400;
1562
- $player_height = 225;
1563
- $Settings = get_option('powerpress_general');
1564
- // Global Settings
1565
- if( !empty($Settings['player_width']) )
1566
- $player_width = $Settings['player_width'];
1567
- if( !empty($Settings['player_height']) )
1568
- $player_height = $Settings['player_height'];
1569
- if( !empty($Settings['poster_image']) )
1570
- $cover_image = $Settings['poster_image'];
1571
- // Episode Settings
1572
- if( !empty($EpisodeData['width']) )
1573
- $player_width = $EpisodeData['width'];
1574
- if( !empty($EpisodeData['height']) )
1575
- $player_height = $EpisodeData['height'];
1576
- if( !empty($EpisodeData['image']) )
1577
- $cover_image = $EpisodeData['image'];
1578
-
1579
- $extension = powerpressplayer_get_extension($media_url, $EpisodeData);
1580
- if( ($extension == 'mp3' || $extension == 'm4a') && empty($Settings['poster_image_audio']) )
1581
- {
1582
- // FlowPlayer has differeent sizes for audio than for video
1583
- $player_width = 320;
1584
- if( !empty($Settings['player_width_audio']) )
1585
- $player_width = $Settings['player_width_audio'];
1586
-
1587
- if( !empty($EpisodeData['width']) && !empty($Settings['player_width_audio']) )
1588
- $player_width = $EpisodeData['width'];
1589
-
1590
- $cover_image = ''; // Audio should not have a cover image
1591
- $player_height = 24;
1592
- if(stristr($_SERVER['HTTP_USER_AGENT'], 'firefox') !== false )
1593
- $player_height = 22; // Firefox only
1594
- }
1595
-
1596
- // Build player...
1597
- $player_id = powerpressplayer_get_next_id();
1598
- $content = '';
1599
- $content .= '<div class="powerpress_player" id="powerpress_player_'. $player_id .'"></div>'.PHP_EOL;
1600
- $content .= '<script type="text/javascript"><!--'.PHP_EOL;
1601
- if( !empty($EpisodeData['jquery_autowidth']) )
1602
- {
1603
- $player_width = 'jQuery(window).width()';
1604
- if( preg_match('/(mp4|m4v|ogg|ogv|webm)/i', $extension) )
1605
- {
1606
- $player_height = 'jQuery(window).height()';
1607
- }
1608
- }
1609
-
1610
- if( empty($EpisodeData['type']) )
1611
- {
1612
- $EpisodeData['type'] = powerpress_get_contenttype('test.'.$extension);
1613
- }
1614
-
1615
- $content .= "pp_flashembed(\n";
1616
- $content .= " 'powerpress_player_{$player_id}',\n";
1617
-
1618
- $content .= " {src: '". powerpress_get_root_url() ."FlowPlayerClassic.swf', ";
1619
- if( preg_match('/^jQuery\(/', $player_width) ) // Only add single quotes if jQuery( ... is not in the value
1620
- $content .= "width: {$player_width}, ";
1621
- else
1622
- $content .= "width: '{$player_width}', ";
1623
- if( preg_match('/^jQuery\(/', $player_height) ) // Only add single quotes if jQuery( ... is not in the value
1624
- $content .= "height: {$player_height}, ";
1625
- else
1626
- $content .= "height: '{$player_height}', ";
1627
- $content .= "wmode: 'transparent' },\n";
1628
- if( $cover_image )
1629
- $content .= " {config: { autoPlay: ". ($autoplay?'true':'false') .", autoBuffering: false, showFullScreenButton: ". (preg_match('/audio\//', $EpisodeData['type'])?'false':'true' ) .", showMenu: false, videoFile: '{$media_url}', splashImageFile: '{$cover_image}', scaleSplash: true, loop: false, autoRewind: true } }\n";
1630
- else
1631
- $content .= " {config: { autoPlay: ". ($autoplay?'true':'false') .", autoBuffering: false, showFullScreenButton: ". (preg_match('/audio\//', $EpisodeData['type'])?'false':'true' ) .", showMenu: false, videoFile: '{$media_url}', loop: false, autoRewind: true } }\n";
1632
- $content .= ");\n";
1633
- $content .= "//-->\n";
1634
- $content .= "</script>\n";
1635
- return $content;
1636
  }
1637
 
1638
 
58
 
59
 
60
  $enqueue_mejs = false;
61
+ //if( !isset($GeneralSettings['player']) || !isset($GeneralSettings['video_player']) )
62
+ //{
63
  if( version_compare($GLOBALS['wp_version'], '3.6-alpha', '>') )
64
  $enqueue_mejs = true;
65
+ //}
66
 
67
+ if( !empty($GeneralSettings['player']) && ($GeneralSettings['player'] == 'mediaelement-audio' || $GeneralSettings['player'] == 'default') )
68
  {
69
  $enqueue_mejs = true;
70
  }
71
+ else if( !empty($GeneralSettings['video_player']) && ($GeneralSettings['video_player'] == 'mediaelement-video'|| $GeneralSettings['video_player'] == 'default') )
72
  {
73
  $enqueue_mejs = true;
74
  }
412
  function do_powerpressplayer_embed($player, $media_url, $EpisodeData = array())
413
  {
414
  // Includde the stuff we need...
415
+ wp_enqueue_style('mediaelement');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
416
  wp_enqueue_script('jquery');
417
 
418
  $content = '';
507
  if( !is_array($EpisodeData) )
508
  $EpisodeData = array();
509
 
510
+ $content .= powerpressplayer_build_flowplayerclassic($media_url, $EpisodeData + array('jquery_autowidth'=>true), true );
511
 
512
  // $content .= 'Video Flow Player Classic coming soon!';
513
  }; break;
1535
  /*
1536
  Flow Player Classic
1537
  */
1538
+ function powerpressplayer_build_flowplayerclassic($media_url, $EpisodeData = array(), $embed = false)
1539
  {
1540
+ if( preg_match('/\.(mp3|m4a|oga)/i', $media_url ) )
1541
+ return powerpressplayer_build_mediaelementaudio($media_url, $EpisodeData, $embed );
1542
+ return powerpressplayer_build_mediaelementvideo($media_url, $EpisodeData, $embed );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ PowerPress player options
4
+ */
5
+
6
+
7
+ function powerpressplayer_get_next_id()
8
+ {
9
+ if( !isset($GLOBALS['g_powerpress_player_id']) ) // Use the global unique player id variable for the surrounding div
10
+ $GLOBALS['g_powerpress_player_id'] = rand(0, 10000);
11
+ else
12
+ $GLOBALS['g_powerpress_player_id']++; // increment the player id for the next div so it is unique
13
+ return $GLOBALS['g_powerpress_player_id'];
14
+ }
15
+
16
+ function powerpressplayer_get_extension($media_url, $EpisodeData = array() )
17
+ {
18
+ $extension = 'unknown';
19
+ $parts = pathinfo($media_url);
20
+ if( !empty($parts['extension']) )
21
+ $extension = strtolower($parts['extension']);
22
+
23
+ // Hack to use the audio/mp3 content type to set extension to mp3, some folks use tinyurl.com to mp3 files which remove the file extension...
24
+ if( isset($EpisodeData['type']) && $EpisodeData['type'] == 'audio/mpeg' && $extension != 'mp3' )
25
+ $extension = 'mp3';
26
+
27
+ return $extension;
28
+ }
29
+
30
+ /*
31
+ Initialize powerpress player handling
32
+ */
33
+ function powerpressplayer_init($GeneralSettings)
34
+ {
35
+ if( isset($_GET['powerpress_pinw']) )
36
+ powerpress_do_pinw($_GET['powerpress_pinw'], !empty($GeneralSettings['process_podpress']) );
37
+
38
+ if( isset($_GET['powerpress_embed']) )
39
+ {
40
+ $player = ( !empty($_GET['powerpress_player']) ? $_GET['powerpress_player'] : 'default' );
41
+ if( empty($_GET['powerpress_player']) && version_compare($GLOBALS['wp_version'], '3.6-alpha', '>') )
42
+ $player = 'mediaelement-audio';
43
+ powerpress_do_embed($player, $_GET['powerpress_embed'], !empty($GeneralSettings['process_podpress']) );
44
+ }
45
+
46
+ // If we are to process podpress data..
47
+ if( !empty($GeneralSettings['process_podpress']) )
48
+ {
49
+ add_shortcode('display_podcast', 'powerpress_shortcode_handler');
50
+ }
51
+
52
+
53
+ // include what's needed for each plaer
54
+ if( defined('POWERPRESS_JS_DEBUG') )
55
+ wp_enqueue_script( 'powerpress-player', powerpress_get_root_url() .'player.js');
56
+ else
57
+ wp_enqueue_script( 'powerpress-player', powerpress_get_root_url() .'player.min.js');
58
+
59
+
60
+ $enqueue_mejs = false;
61
+ if( !isset($GeneralSettings['player']) || !isset($GeneralSettings['video_player']) )
62
+ {
63
+ if( version_compare($GLOBALS['wp_version'], '3.6-alpha', '>') )
64
+ $enqueue_mejs = true;
65
+ }
66
+
67
+ if( !empty($GeneralSettings['player']) && ($GeneralSettings['player'] == 'mediaelement-audio'||$GeneralSettings['player'] == 'default') )
68
+ {
69
+ $enqueue_mejs = true;
70
+ }
71
+ else if( !empty($GeneralSettings['video_player']) && ($GeneralSettings['video_player'] == 'mediaelement-video'|| ) )
72
+ {
73
+ $enqueue_mejs = true;
74
+ }
75
+
76
+ if( $enqueue_mejs )
77
+ {
78
+ wp_enqueue_style('mediaelement');
79
+ wp_enqueue_style('wp-mediaelement');
80
+ wp_enqueue_script('mediaelement');
81
+ wp_enqueue_script( 'powerpress-mejs', powerpress_get_root_url() .'powerpress-mejs.js');
82
+ }
83
+ }
84
+
85
+
86
+ function powerpress_shortcode_handler( $attributes, $content = null )
87
+ {
88
+ global $post, $g_powerpress_player_added;
89
+
90
+ // We can't add flash players to feeds
91
+ if( is_feed() )
92
+ return '';
93
+
94
+ $return = '';
95
+ $feed = '';
96
+ $channel = '';
97
+ $slug = ''; // latest and preferred way to specify the feed slug
98
+ $url = '';
99
+ $image = '';
100
+ $width = '';
101
+ $height = '';
102
+
103
+ extract( shortcode_atts( array(
104
+ 'url' => '',
105
+ 'feed' => '',
106
+ 'channel' => '',
107
+ 'slug' => '',
108
+ 'image' => '',
109
+ 'width' => '',
110
+ 'height' => ''
111
+ ), $attributes ) );
112
+
113
+ if( empty($channel) && !empty($feed) ) // Feed for backward compat.
114
+ $channel = $feed;
115
+ if( !empty($slug) ) // Foward compatibility
116
+ $channel = $slug;
117
+
118
+ if( !$url && $content )
119
+ {
120
+ $content_url = trim($content);
121
+ if( @parse_url($content_url) )
122
+ $url = $content_url;
123
+ }
124
+
125
+ if( $url )
126
+ {
127
+ $url = powerpress_add_redirect_url($url);
128
+ $content_type = '';
129
+ // Handle the URL differently...
130
+ $return = apply_filters('powerpress_player', '', powerpress_add_flag_to_redirect_url($url, 'p'), array('image'=>$image, 'type'=>$content_type,'width'=>$width, 'height'=>$height) );
131
+ }
132
+ else if( $channel )
133
+ {
134
+ $EpisodeData = powerpress_get_enclosure_data($post->ID, $channel);
135
+ if( !empty($EpisodeData['embed']) )
136
+ $return = $EpisodeData['embed'];
137
+
138
+ // Shortcode over-ride settings:
139
+ if( !empty($image) )
140
+