PowerPress Podcasting plugin by Blubrry - Version 7.5.2

Version Description

  • Released on 7/25/2019
  • Fixed logic bug introduced in 7.5 for sites using versions of PHP 5.4 or older.
  • Added code changes to Blubrry Hosting's Post to Social from PowerPress feature. (Last beta release of this feature!)
Download this release

Release Info

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

Code changes from version 7.5.1 to 7.5.2

Files changed (3) hide show
  1. powerpress.php +3867 -3867
  2. powerpressadmin-pts.php +59 -39
  3. readme.txt +500 -496
powerpress.php CHANGED
@@ -1,3868 +1,3868 @@
1
- <?php
2
- /*
3
- Plugin Name: Blubrry PowerPress
4
- Plugin URI: http://create.blubrry.com/resources/powerpress/
5
- Description: <a href="http://create.blubrry.com/resources/powerpress/" target="_blank">Blubrry PowerPress</a> is the No. 1 Podcasting plugin for WordPress. Developed by podcasters for podcasters; features include Simple and Advanced modes, multiple audio/video player options, subscribe to podcast tools, podcast SEO features, and more! Fully supports Apple Podcasts (previously iTunes), Google Podcasts, Spotify, Stitcher, and Blubrry Podcasting directories, as well as all podcast applications and clients.
6
- Version: 7.5.1
7
- Author: Blubrry
8
- Author URI: http://www.blubrry.com/
9
- Requires at least: 3.6
10
- Tested up to: 5.2.2
11
- Text Domain: powerpress
12
- Change Log:
13
- Please see readme.txt for detailed change log.
14
-
15
- Contributors:
16
- Angelo Mandato, CIO Blubrry - Plugin founder, architect and lead developer
17
- See readme.txt for full list of contributors.
18
-
19
- Credits:
20
- getID3(), License: GPL 2.0+ by James Heinrich <info [at] getid3.org> http://www.getid3.org
21
- Note: getid3.php analyze() function modified to prevent redundant filesize() function call.
22
-
23
- Copyright 2008-2019 Blubrry (http://www.blubrry.com)
24
-
25
- License: GPL (http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt)
26
-
27
- This project uses source that is GPL licensed.
28
- */
29
-
30
-
31
- if( !function_exists('add_action') ) {
32
- header( 'Status: 403 Forbidden' );
33
- header( 'HTTP/1.1 403 Forbidden' );
34
- exit();
35
- }
36
-
37
- // WP_PLUGIN_DIR (REMEMBER TO USE THIS DEFINE IF NEEDED)
38
- define('POWERPRESS_VERSION', '7.5.1' );
39
-
40
- // Translation support:
41
- if ( !defined('POWERPRESS_ABSPATH') )
42
- define('POWERPRESS_ABSPATH', dirname(__FILE__) );
43
-
44
-
45
-
46
- /////////////////////////////////////////////////////
47
- // The following define options should be placed in your
48
- // wp-config.php file so the setting is not disrupted when
49
- // you upgrade the plugin.
50
- /////////////////////////////////////////////////////
51
-
52
- if( !defined('POWERPRESS_BLUBRRY_API_URL') )
53
- define('POWERPRESS_BLUBRRY_API_URL', 'http://api.blubrry.com/');
54
-
55
- // Replace validator service with one that is more reliable here:
56
- define('POWERPRESS_FEEDVALIDATOR_URL', 'http://castfeedvalidator.com/?url=');
57
-
58
- // Display custom play image for quicktime media. Applies to on page player only.
59
- //define('POWERPRESS_PLAY_IMAGE', 'http://www.blubrry.com/themes/blubrry/images/player/PlayerBadge150x50NoBorder.jpg');
60
-
61
- if( !defined('POWERPRESS_CONTENT_ACTION_PRIORITY') )
62
- define('POWERPRESS_CONTENT_ACTION_PRIORITY', 10 );
63
-
64
- // Added so administrators can customize what capability is needed for PowerPress
65
- if( !defined('POWERPRESS_CAPABILITY_MANAGE_OPTIONS') )
66
- define('POWERPRESS_CAPABILITY_MANAGE_OPTIONS', 'manage_options');
67
- if( !defined('POWERPRESS_CAPABILITY_EDIT_PAGES') )
68
- define('POWERPRESS_CAPABILITY_EDIT_PAGES', 'edit_pages');
69
-
70
- //define('POWERPRESS_ENABLE_HTTPS_MEDIA', true); // Add this define to your wp-config.php if you wnat to allow media URLs that begin with https://
71
-
72
- // Define variables, advanced users could define these in their own wp-config.php so lets not try to re-define
73
- if( !defined('POWERPRESS_LINK_SEPARATOR') )
74
- define('POWERPRESS_LINK_SEPARATOR', '|');
75
- if( !defined('POWERPRESS_TEXT_SEPARATOR') )
76
- define('POWERPRESS_TEXT_SEPARATOR', ':');
77
- if( !defined('POWERPRESS_PLAY_IMAGE') )
78
- define('POWERPRESS_PLAY_IMAGE', 'play_video_default.jpg');
79
- if( !defined('PHP_EOL') )
80
- define('PHP_EOL', "\n"); // We need this variable defined for new lines.
81
- if( defined('POWERPRESS_DEBUG') ) {
82
- if( !defined('PHP_EOL_WEB') ) {
83
- define('PHP_EOL_WEB', "\n"); // Helps with readability
84
- }
85
- } else {
86
- if( !defined('PHP_EOL_WEB') ) {
87
- define('PHP_EOL_WEB', ''); // We don't necessarily need new lines for web output
88
- }
89
- }
90
-
91
- if( !defined('POWERPRESS_SUBSCRIBE') )
92
- define('POWERPRESS_SUBSCRIBE', true);
93
- if(!defined('POWERPRESS_NEW_APPLE_CATEGORIES')) {
94
- define('POWERPRESS_NEW_APPLE_CATEGORIES', true);
95
- }
96
- // Set regular expression values for determining mobile devices
97
- if( !defined('POWERPRESS_MOBILE_REGEX') )
98
- define('POWERPRESS_MOBILE_REGEX', 'iphone|ipod|ipad|aspen|android|blackberry|opera mini|webos|incognito|webmate|silk');
99
-
100
- $powerpress_feed = NULL; // DO NOT CHANGE
101
-
102
- function powerpress_content($content)
103
- {
104
- global $post, $g_powerpress_excerpt_post_id;
105
-
106
- if( defined('PODPRESS_VERSION') || isset($GLOBALS['podcasting_player_id']) || isset($GLOBALS['podcast_channel_active']) || defined('PODCASTING_VERSION') )
107
- return $content;
108
-
109
- if( empty($post->ID) || !is_object($post) )
110
- return $content;
111
-
112
- if( defined('POWERPRESS_DO_ENCLOSE_FIX') )
113
- $content = preg_replace('/\<!--.*added by PowerPress.*-->/im', '', $content );
114
-
115
- if( is_feed() )
116
- return $content; // We don't want to do anything to the feed
117
-
118
- if( function_exists('post_password_required') )
119
- {
120
- if( post_password_required($post) )
121
- return $content;
122
- }
123
-
124
- // PowerPress settings:
125
- $GeneralSettings = get_option('powerpress_general');
126
-
127
- // No player or links to add to content...
128
- if( !empty($GeneralSettings['disable_appearance']) )
129
- return $content;
130
-
131
- // check for themes/plugins where we know we need to do this...
132
- if( empty($GeneralSettings['player_aggressive']) )
133
- {
134
- if( !empty($GLOBALS['fb_ver']) && version_compare($GLOBALS['fb_ver'], '1.0', '<=') ) {
135
- $GeneralSettings['player_aggressive'] = 1;
136
- }
137
- if( defined('JETPACK__VERSION') && version_compare(JETPACK__VERSION, '2.0', '>=') ) {
138
- $GeneralSettings['player_aggressive'] = 1; // Jet pack still doesn't behave with PowerPress the_content
139
- }
140
- if( defined('WPSEO_VERSION') ) {
141
- $GeneralSettings['player_aggressive'] = 4;
142
- }
143
- }
144
-
145
- if( !empty($GeneralSettings['player_aggressive']) )
146
- {
147
- if( $GeneralSettings['player_aggressive'] == 4 )
148
- {
149
- $in_http_head = powerpress_in_wp_head();
150
- if( $in_http_head === true )
151
- return $content;
152
- }
153
- else if( $GeneralSettings['player_aggressive'] == 2 ) // If we do not have theme issues then lets keep this logic clean. and only display playes after the wp_head only
154
- {
155
- if( empty($GLOBALS['powerpress_wp_head_completed']) )
156
- return $content;
157
- }
158
- else // method 1 or 3...
159
- {
160
- if( strstr($content, '<!--powerpress_player-->') !== false )
161
- return $content; // The players were already added to the content
162
-
163
- if( $GeneralSettings['player_aggressive'] != 3 && $g_powerpress_excerpt_post_id > 0 )
164
- $g_powerpress_excerpt_post_id = 0; // Hack, set this to zero so it always goes past...
165
-
166
- if( $GeneralSettings['player_aggressive'] == 3 )
167
- $GeneralSettings['player_aggressive'] = 1; // remainder of the system will function as normal
168
- }
169
- }
170
-
171
- // Problem: If the_excerpt is used instead of the_content, both the_exerpt and the_content will be called here.
172
- // Important to note, get_the_excerpt will be called before the_content is called, so we add a simple little hack
173
- if( current_filter() == 'get_the_excerpt' )
174
- {
175
- $g_powerpress_excerpt_post_id = $post->ID;
176
- return $content; // We don't want to do anything to this content yet...
177
- }
178
- else if( current_filter() == 'the_content' && $g_powerpress_excerpt_post_id == $post->ID )
179
- {
180
- return $content; // We don't want to do anything to this excerpt content in this call either...
181
- }
182
- else if( class_exists('custom_post_widget') && powerpress_in_custom_post_widget() )
183
- {
184
- return $content; // Custom Post Widget compatibility
185
- }
186
-
187
-
188
- if( !isset($GeneralSettings['custom_feeds']) )
189
- $GeneralSettings['custom_feeds'] = array('podcast'=>'Default Podcast Feed');
190
- if( empty($GeneralSettings['custom_feeds']['podcast']) )
191
- $GeneralSettings['custom_feeds']['podcast'] = 'Default Podcast Feed';
192
-
193
- // Re-order so the default podcast episode is the top most...
194
- $Temp = $GeneralSettings['custom_feeds'];
195
- $GeneralSettings['custom_feeds'] = array();
196
- $GeneralSettings['custom_feeds']['podcast'] = 'Default Podcast Feed';
197
- foreach( $Temp as $feed_slug=> $feed_title )
198
- {
199
- if( $feed_slug == 'podcast' )
200
- continue;
201
- $GeneralSettings['custom_feeds'][ $feed_slug ] = $feed_title;
202
- }
203
-
204
- // Handle post type feeds....
205
- if( !empty($GeneralSettings['posttype_podcasting']) )
206
- {
207
- $post_type = get_query_var('post_type');
208
- if ( is_array( $post_type ) ) {
209
- $post_type = reset( $post_type ); // get first element in array
210
- }
211
-
212
- // Get the feed slugs and titles for this post type
213
- $PostTypeSettingsArray = get_option('powerpress_posttype_'.$post_type);
214
- // Loop through this array of post type settings...
215
- if( !empty($PostTypeSettingsArray) )
216
- {
217
- switch($post_type)
218
- {
219
- case 'post':
220
- case 'page': {
221
- // Do nothing!, we want the default podcast to appear in these post types
222
- }; break;
223
- default: {
224
- if( !empty($post_type) && empty($PostTypeSettingsArray['podcast']) )
225
- unset($GeneralSettings['custom_feeds']['podcast']); // special case, we do not want an accidental podcast episode to appear in a custom post type if the feature is enabled
226
- }; break;
227
- }
228
-
229
- foreach( $PostTypeSettingsArray as $feed_slug=> $postTypeSettings )
230
- {
231
- if( !empty( $postTypeSettings['title']) )
232
- $GeneralSettings['custom_feeds'][ $feed_slug ] = $postTypeSettings['title'];
233
- else
234
- $GeneralSettings['custom_feeds'][ $feed_slug ] = $feed_slug;
235
- }
236
- }
237
- }
238
-
239
- if( !isset($GeneralSettings['display_player']) )
240
- $GeneralSettings['display_player'] = 1;
241
- if( !isset($GeneralSettings['player_function']) )
242
- $GeneralSettings['player_function'] = 1;
243
- if( !isset($GeneralSettings['podcast_link']) )
244
- $GeneralSettings['podcast_link'] = 1;
245
-
246
- // The blog owner doesn't want anything displayed, so don't bother wasting anymore CPU cycles
247
- if( $GeneralSettings['display_player'] == 0 )
248
- return $content;
249
-
250
- if( current_filter() == 'the_excerpt' && empty($GeneralSettings['display_player_excerpt']) )
251
- return $content; // We didn't want to modify this since the user didn't enable it for excerpts
252
-
253
- if( !empty($GeneralSettings['hide_player_more']) && strstr($content, 'class="more-link"') )
254
- return $content; // We do not want to add players and links if the read-more class found
255
-
256
- // Figure out which players are alerady in the body of the page...
257
- $ExcludePlayers = array();
258
- if( isset($GeneralSettings['disable_player']) )
259
- $ExcludePlayers = $GeneralSettings['disable_player']; // automatically disable the players configured
260
-
261
- if( !empty($GeneralSettings['process_podpress']) && strstr($content, '[display_podcast]') )
262
- return $content;
263
-
264
- if( preg_match_all('/(.?)\[(powerpress)\b(.*?)(?:(\/))?\](?:(.+?)\[\/\2\])?(.?)/s', $content, $matches) )
265
- {
266
- if( isset($matches[3]) )
267
- {
268
- foreach( $matches[3] as $key=> $row )
269
- {
270
- $attributes = shortcode_parse_atts($row);
271
- if( isset($attributes['url']) )
272
- {
273
- // not a problem...
274
- }
275
- else if( isset($attributes['feed']) )
276
- {
277
- // we want to exclude this feed from the links aera...
278
- $ExcludePlayers[ $attributes['feed'] ] = true;
279
- }
280
- else
281
- {
282
- // we don't want to include any players below...
283
- $ExcludePlayers = $GeneralSettings['custom_feeds'];
284
- }
285
- }
286
- }
287
- }
288
-
289
- // LOOP HERE TO DISPLAY EACH MEDIA TYPE
290
- $new_content = '';
291
- foreach( $GeneralSettings['custom_feeds'] as $feed_slug=> $feed_title )
292
- {
293
- // Get the enclosure data
294
- $EpisodeData = powerpress_get_enclosure_data($post->ID, $feed_slug);
295
-
296
- if( !$EpisodeData && !empty($GeneralSettings['process_podpress']) && $feed_slug == 'podcast' )
297
- $EpisodeData = powerpress_get_enclosure_data_podpress($post->ID);
298
-
299
- if( !$EpisodeData || !$EpisodeData['url'] )
300
- continue;
301
-
302
- // Just in case, if there's no URL lets escape!
303
- if( !$EpisodeData['url'] )
304
- continue;
305
-
306
- // If the player is not already inserted in the body of the post using the shortcode...
307
- //if( preg_match('/\[powerpress(.*)\]/is', $content) == 0 )
308
- if( !isset($ExcludePlayers[ $feed_slug ]) ) // If the player is not in our exclude list because it's already in the post body somewhere...
309
- {
310
- if( isset($GeneralSettings['premium_caps']) && $GeneralSettings['premium_caps'] && !powerpress_premium_content_authorized($feed_slug) )
311
- {
312
- $new_content .= powerpress_premium_content_message($post->ID, $feed_slug, $EpisodeData);
313
- }
314
- else
315
- {
316
- if( $GeneralSettings['player_function'] != 3 && $GeneralSettings['player_function'] != 0 ) // Play in new window only or disabled
317
- {
318
- do_action('wp_powerpress_player_scripts');
319
- $AddDefaultPlayer = empty($EpisodeData['no_player']);
320
-
321
- if( $EpisodeData && !empty($EpisodeData['embed']) )
322
- {
323
- $new_content .= trim($EpisodeData['embed']);
324
- if( !empty($GeneralSettings['embed_replace_player']) )
325
- $AddDefaultPlayer = false;
326
- }
327
-
328
- if( $AddDefaultPlayer )
329
- {
330
- $image = '';
331
- if( isset($EpisodeData['image']) && $EpisodeData['image'] != '' )
332
- $image = $EpisodeData['image'];
333
-
334
- $new_content .= apply_filters('powerpress_player', '', powerpress_add_flag_to_redirect_url($EpisodeData['url'], 'p'), $EpisodeData );
335
- }
336
- }
337
-
338
- if( !isset($EpisodeData['no_links']) ) {
339
- do_action('wp_powerpress_player_scripts');
340
- $new_content .= apply_filters('powerpress_player_links', '', powerpress_add_flag_to_redirect_url($EpisodeData['url'], 'p'), $EpisodeData );
341
- $new_content .= apply_filters('powerpress_player_subscribe_links', '', powerpress_add_flag_to_redirect_url($EpisodeData['url'], 'p'), $EpisodeData );
342
- }
343
- }
344
- }
345
- }
346
-
347
- if( $new_content == '' )
348
- return $content;
349
-
350
- switch( $GeneralSettings['display_player'] )
351
- {
352
- case 1: { // Below posts
353
- return $content.$new_content.( !empty($GeneralSettings['player_aggressive']) && $GeneralSettings['player_aggressive'] == 1 ?'<!--powerpress_player-->':'');
354
- }; break;
355
- case 2: { // Above posts
356
- return ( !empty($GeneralSettings['player_aggressive']) && $GeneralSettings['player_aggressive'] == 1 ?'<!--powerpress_player-->':'').$new_content.$content;
357
- }; break;
358
- }
359
- return $content;
360
- }//end function
361
-
362
-
363
- add_filter('get_the_excerpt', 'powerpress_content', (POWERPRESS_CONTENT_ACTION_PRIORITY - 1) );
364
- add_filter('the_content', 'powerpress_content', POWERPRESS_CONTENT_ACTION_PRIORITY);
365
- if( !defined('POWERPRESS_NO_THE_EXCERPT') )
366
- add_filter('the_excerpt', 'powerpress_content', POWERPRESS_CONTENT_ACTION_PRIORITY);
367
-
368
-
369
- /* Specail case fix Yoast bug which messes up the HTML */
370
- function powerpress_yoast_gawp_fix($content)
371
- {
372
- $content= preg_replace(
373
- array('/return powerpress\_pinw\(\"/', '/return powerpress\_embed\_winplayer\(\"/', '/return powerpress\_show\_embed\(\"/', '/return powerpress\_embed\_html5v\(\"/', '/return powerpress\_embed\_html5a\(\"/', ),
374
- array('return powerpress_pinw(\'', 'return powerpress_embed_winplayer(\'', 'return powerpress_show_embed(\'', 'return powerpress_embed_html5v(\'', 'return powerpress_embed_html5a(\'' ),
375
- $content);
376
-
377
- return $content;
378
- }
379
-
380
- function powerpress_header()
381
- {
382
- // PowerPress settings:
383
- $Powerpress = get_option('powerpress_general');
384
- if( !isset($Powerpress['custom_feeds']) )
385
- $Powerpress['custom_feeds'] = array('podcast'=>'Default Podcast Feed');
386
-
387
- if( empty($Powerpress['disable_appearance']) || $Powerpress['disable_appearance'] == false )
388
- {
389
- if( !isset($Powerpress['player_function']) || $Powerpress['player_function'] > 0 ) // Don't include the player in the header if it is not needed...
390
- {
391
- $PowerpressPluginURL = powerpress_get_root_url();
392
- ?>
393
- <script type="text/javascript"><!--
394
- <?php
395
- $new_window_width = 420;
396
- $new_window_height = 240;
397
-
398
- if( isset($Powerpress['new_window_width']) && $Powerpress['new_window_width'] > 0 )
399
- $new_window_width = $Powerpress['new_window_width'];
400
- else if( isset($Powerpress['new_window_width']) )
401
- $new_window_width = 420;
402
-
403
- if( isset($Powerpress['new_window_height']) && $Powerpress['new_window_height'] > 0 )
404
- $new_window_height = $Powerpress['new_window_height'];
405
- else if( isset($Powerpress['new_window_height']) )
406
- $new_window_height = 240;
407
-
408
- if( empty($Powerpress['new_window_nofactor']) )
409
- {
410
- $new_window_width += 40;
411
- $new_window_height += 80;
412
- }
413
-
414
- ?>
415
- function powerpress_pinw(pinw_url){window.open(pinw_url, 'PowerPressPlayer','toolbar=0,status=0,resizable=1,width=<?php echo ($new_window_width); ?>,height=<?php echo ($new_window_height); ?>'); return false;}
416
- //-->
417
- </script>
418
- <?php
419
- }
420
- }
421
-
422
- if( !empty($Powerpress['feed_links']) )
423
- {
424
- if( is_home() ) {
425
- $feed_slug = 'podcast';
426
- $href = get_feed_link($feed_slug);
427
- // Podcast default and channel feed settings
428
- $Settings = get_option('powerpress_feed_'. $feed_slug);
429
-
430
- if( empty($Settings) && $feed_slug == 'podcast' )
431
- $Settings = get_option('powerpress_feed'); // Get the main feed settings
432
-
433
- if( empty($Settings['title']) )
434
- $Settings['title'] = get_bloginfo_rss('name'); // Get blog title
435
-
436
- // Get the default podcast feed...
437
- echo '<link rel="alternate" type="' . feed_content_type() . '" title="' . esc_attr( $Settings['title'] ) . '" href="' . esc_url( $href ) . '" />' . "\n";
438
- } else if( is_category() ) {
439
-
440
- $category_id = get_query_var('cat');
441
- if( $category_id ) {
442
- $Settings = get_option('powerpress_cat_feed_'.$category_id );
443
- if( empty($Settings['title']) ) {
444
- $Settings['title'] = get_cat_name( $category_id ); // Get category title
445
- $Settings['title'] .= ' '. apply_filters( 'document_title_separator', '-' ) .' ';
446
- $Settings['title'] .= get_bloginfo_rss('name');
447
- }
448
- if( empty($Settings['title']) ) {
449
- $Settings['title'] = get_bloginfo_rss('name'); // Get blog title, best we can do
450
- }
451
-
452
- if( !empty($Settings['feed_redirect_url']) )
453
- $Settings['feed_url'] = $Settings['feed_redirect_url'];
454
- else if( !empty($General['cat_casting_podcast_feeds']) )
455
- $Settings['feed_url'] = get_category_feed_link($category_id, 'podcast');
456
- else
457
- $Settings['feed_url'] = get_category_feed_link( $category_id ); // Get category feed URL
458
-
459
- // Get the category podcast feed...
460
- echo '<link rel="alternate" type="' . feed_content_type() . '" title="' . esc_attr( $Settings['title'] ) . '" href="' . esc_url( $Settings['feed_url'] ) . '" />' . "\n";
461
- }
462
- }
463
- }
464
- }
465
-
466
- add_action('wp_head', 'powerpress_header');
467
-
468
- function powerpress_wp_head_completed()
469
- {
470
- $GLOBALS['powerpress_wp_head_completed'] = true;
471
- }
472
-
473
- add_action('wp_head', 'powerpress_wp_head_completed', 100000);
474
-
475
- function powerpress_exit_on_http_head($return)
476
- {
477
- if( is_feed() )
478
- {
479
- // Set the content type for HTTP headers...
480
- header('Content-Type: ' . feed_content_type('rss-http') . '; charset=' . get_option('blog_charset'), true);
481
-
482
- // Needs authentication?
483
- $GeneralSettings = get_option('powerpress_general');
484
- if( !empty($GeneralSettings['premium_caps']) )
485
- {
486
- $feed_slug = get_query_var('feed');
487
- $FeedSettings = get_option('powerpress_feed_'.$feed_slug);
488
- if( !empty($FeedSettings['premium']) )
489
- {
490
- return false; // Let the logic further into PowerPress authenticate this HEAD request
491
- }
492
- }
493
- }
494
- return $return;
495
- }
496
-
497
- add_filter('exit_on_http_head', 'powerpress_exit_on_http_head' );
498
-
499
- function powerpress_rss2_ns()
500
- {
501
- if( !powerpress_is_podcast_feed() )
502
- return;
503
-
504
- // Okay, lets add the namespace
505
- echo 'xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd"'.PHP_EOL;
506
- if( !defined('POWERPRESS_RAWVOICE_RSS') || POWERPRESS_RAWVOICE_RSS != false )
507
- {
508
- echo 'xmlns:rawvoice="http://www.rawvoice.com/rawvoiceRssModule/"'.PHP_EOL;
509
- }
510
- if( !defined('POWERPRESS_GOOGLEPLAY_RSS') || POWERPRESS_GOOGLEPLAY_RSS != false )
511
- {
512
- echo 'xmlns:googleplay="http://www.google.com/schemas/play-podcasts/1.0"'.PHP_EOL;
513
- //echo 'xmlns:googleplay="http://www.google.com/schemas/play-podcasts/1.0/play-podcasts.xsd"'.PHP_EOL;
514
- }
515
- }
516
-
517
- add_action('rss2_ns', 'powerpress_rss2_ns');
518
- add_action('rss2_ns_powerpress', 'powerpress_rss2_ns');
519
-
520
- function powerpress_rss2_head()
521
- {
522
- global $powerpress_feed;
523
-
524
- if( !powerpress_is_podcast_feed() )
525
- return; // Not a feed we manage
526
-
527
- $feed_slug = get_query_var( 'feed' );
528
- $cat_ID = get_query_var('cat');
529
-
530
- $Feed = get_option('powerpress_feed'); // Get the main feed settings
531
- if( !empty($powerpress_feed['category']) )
532
- {
533
- $CustomFeed = get_option('powerpress_cat_feed_'.$powerpress_feed['category']); // Get the custom podcast feed settings saved in the database
534
- if( $CustomFeed )
535
- $Feed = powerpress_merge_empty_feed_settings($CustomFeed, $Feed);
536
- }
537
- else if( !empty($powerpress_feed['term_taxonomy_id']) )
538
- {
539
- $CustomFeed = get_option('powerpress_taxonomy_'.$powerpress_feed['term_taxonomy_id']); // Get the taxonomy podcast settings saved in the database
540
- if( $CustomFeed )
541
- $Feed = powerpress_merge_empty_feed_settings($CustomFeed, $Feed);
542
- }
543
- else if( !empty($powerpress_feed['post_type']) )
544
- {
545
- $PostTypeSettingsArray = get_option('powerpress_posttype_'.$powerpress_feed['post_type']); // Get the post type podcast feed settings saved in the database
546
- if( !empty($PostTypeSettingsArray[ $feed_slug ]) )
547
- {
548
- $CustomFeed = $PostTypeSettingsArray[ $feed_slug ];
549
- $Feed = powerpress_merge_empty_feed_settings($CustomFeed, $Feed, ($feed_slug == 'podcast') );
550
- }
551
- }
552
- else if( powerpress_is_custom_podcast_feed() ) // If we're handling a custom podcast feed...
553
- {
554
- $CustomFeed = get_option('powerpress_feed_'.$feed_slug); // Get the custom podcast feed settings saved in the database
555
- $Feed = powerpress_merge_empty_feed_settings($CustomFeed, $Feed, ($feed_slug == 'podcast') );
556
- }
557
-
558
- if( !isset($Feed['url']) || trim($Feed['url']) == '' )
559
- {
560
- if( is_category() )
561
- $Feed['url'] = get_category_link($cat_ID);
562
- else {
563
-
564
- $blogHomepage = get_option('page_for_posts');
565
- if( !empty($blogHomepage) ) {
566
- $Feed['url'] = get_permalink( $blogHomepage );
567
- }
568
-
569
- if( empty($Feed['url']) )
570
- $Feed['url'] = get_bloginfo('url');
571
- }
572
- }
573
-
574
- $General = get_option('powerpress_general');
575
-
576
- // We made it this far, lets write stuff to the feed!
577
- echo '<!-- podcast_generator="Blubrry PowerPress/'. POWERPRESS_VERSION .'" ';
578
- if( isset($General['advanced_mode_2']) && empty($General['advanced_mode_2']) )
579
- echo 'mode="simple" ';
580
- else
581
- echo 'mode="advanced" ';
582
- // Additional info for diagnostics
583
- if( !empty($powerpress_feed['category']) )
584
- echo 'category="'.$powerpress_feed['category'].'" ';
585
- if( !empty($powerpress_feed['term_taxonomy_id']) )
586
- echo 'ttid="'.$powerpress_feed['term_taxonomy_id'].'" ';
587
- if( !empty($powerpress_feed['post_type']) )
588
- echo 'posttype="'.$powerpress_feed['post_type'].'" ';
589
- if( !empty($powerpress_feed['feed-slug']) )
590
- echo 'feedslug="'.$powerpress_feed['feed-slug'].'" ';
591
-
592
- $feedComment = apply_filters('powerpress_feed_comment', '');
593
- $feedComment = str_replace( array('<!--', '-->'), array('|!~~', '~~>'), $feedComment);
594
- $feedComment = trim($feedComment);
595
- if( !empty($feedComment) )
596
- echo $feedComment.' ';
597
-
598
- echo 'Blubrry PowerPress Podcasting plugin for WordPress (https://www.blubrry.com/powerpress/) -->'.PHP_EOL;
599
-
600
- // Websub!
601
- if(!empty($General['websub_enabled']) && $General['websub_enabled'] == 1) {
602
- echo "\t<atom:link rel=\"hub\" href=\"https://pubsubhubbub.appspot.com/\" />" . PHP_EOL;
603
- }
604
-
605
- // add the itunes:new-feed-url tag to feed
606
- if( powerpress_is_custom_podcast_feed() )
607
- {
608
- if( !empty($Feed['itunes_new_feed_url']) )
609
- {
610
- $Feed['itunes_new_feed_url'] = str_replace('&amp;', '&', $Feed['itunes_new_feed_url']);
611
- echo "\t<itunes:new-feed-url>". htmlspecialchars(trim($Feed['itunes_new_feed_url'])) .'</itunes:new-feed-url>'.PHP_EOL;
612
- }
613
- }
614
- else if( !empty($Feed['itunes_new_feed_url']) && ($feed_slug == 'feed' || $feed_slug == 'rss2') ) // If it is the default feed (We don't wnat to apply this to category or tag feeds
615
- {
616
- $Feed['itunes_new_feed_url'] = str_replace('&amp;', '&', $Feed['itunes_new_feed_url']);
617
- echo "\t<itunes:new-feed-url>". htmlspecialchars(trim($Feed['itunes_new_feed_url'])) .'</itunes:new-feed-url>'.PHP_EOL;
618
- }
619
-
620
- if( !empty($General['itunes_cdata']) ) {
621
- if( !empty($Feed['itunes_summary']) )
622
- echo "\t".'<itunes:summary><![CDATA['. powerpress_format_itunes_value( $Feed['itunes_summary'], 'summary', true ) .']]></itunes:summary>'.PHP_EOL;
623
- else
624
- echo "\t".'<itunes:summary><![CDATA['. powerpress_format_itunes_value( get_bloginfo('description'), 'summary', true ) .']]></itunes:summary>'.PHP_EOL;
625
- } else {
626
- if( !empty($Feed['itunes_summary']) )
627
- echo "\t".'<itunes:summary>'. powerpress_format_itunes_value( $Feed['itunes_summary'], 'summary' ) .'</itunes:summary>'.PHP_EOL;
628
- else
629
- echo "\t".'<itunes:summary>'. powerpress_format_itunes_value( get_bloginfo('description'), 'summary' ) .'</itunes:summary>'.PHP_EOL;
630
- }
631
-
632
- if( !empty($powerpress_feed['itunes_talent_name']) )
633
- echo "\t<itunes:author>" . esc_html($powerpress_feed['itunes_talent_name']) . '</itunes:author>'.PHP_EOL;
634
-
635
- if( !empty($powerpress_feed['explicit']) && $powerpress_feed['explicit'] != 'no' )
636
- echo "\t".'<itunes:explicit>' . $powerpress_feed['explicit'] . '</itunes:explicit>'.PHP_EOL;
637
-
638
- if( !empty($Feed['itunes_block']) )
639
- echo "\t<itunes:block>yes</itunes:block>".PHP_EOL;
640
-
641
- if( !empty($Feed['itunes_complete']) )
642
- echo "\t<itunes:complete>yes</itunes:complete>".PHP_EOL;
643
-
644
- if( !empty($Feed['itunes_image']) )
645
- {
646
- echo "\t".'<itunes:image href="' . esc_html( powerpress_url_in_feed(str_replace(' ', '+', $Feed['itunes_image'])), 'double') . '" />'.PHP_EOL;
647
- }
648
- else
649
- {
650
- echo "\t".'<itunes:image href="' . powerpress_url_in_feed(powerpress_get_root_url()) . 'itunes_default.jpg" />'.PHP_EOL;
651
- }
652
-
653
- if( !empty($Feed['itunes_type']) ) {
654
- echo "\t".'<itunes:type>'. esc_html($Feed['itunes_type']) .'</itunes:type>'.PHP_EOL;
655
- }
656
-
657
- if( !empty($Feed['email']) )
658
- {
659
- echo "\t".'<itunes:owner>'.PHP_EOL;
660
- echo "\t\t".'<itunes:name>' . esc_html($powerpress_feed['itunes_talent_name']) . '</itunes:name>'.PHP_EOL;
661
- echo "\t\t".'<itunes:email>' . esc_html($Feed['email']) . '</itunes:email>'.PHP_EOL;
662
- echo "\t".'</itunes:owner>'.PHP_EOL;
663
- echo "\t".'<managingEditor>'. esc_html($Feed['email'] .' ('. $powerpress_feed['itunes_talent_name'] .')') .'</managingEditor>'.PHP_EOL;
664
- }
665
-
666
- if( !empty($Feed['copyright']) )
667
- {
668
- // In case the user entered the copyright html version or the copyright UTF-8 or ASCII symbol or just (c)
669
- $Feed['copyright'] = str_replace(array('&copy;', '(c)', '(C)', chr(194) . chr(169), chr(169) ), '&#xA9;', $Feed['copyright']);
670
- echo "\t".'<copyright>'. esc_html($Feed['copyright']) . '</copyright>'.PHP_EOL;
671
- }
672
-
673
- if( !empty($Feed['itunes_subtitle']) )
674
- echo "\t".'<itunes:subtitle>' . powerpress_format_itunes_value($Feed['itunes_subtitle'], 'subtitle') . '</itunes:subtitle>'.PHP_EOL;
675
- else
676
- echo "\t".'<itunes:subtitle>'. powerpress_format_itunes_value( get_bloginfo('description'), 'subtitle') .'</itunes:subtitle>'.PHP_EOL;
677
- $podcast_title_safe = '';
678
- if( version_compare($GLOBALS['wp_version'], 4.4, '<' ) ) {
679
- $podcast_title_safe .= get_bloginfo_rss('name');
680
- }
681
- $podcast_title_safe .= get_wp_title_rss();
682
- if( empty($General['disable_rss_image']) )
683
- {
684
- if( !empty($Feed['rss2_image']) || !empty($Feed['itunes_image']) )
685
- {
686
- if( !empty($Feed['rss2_image']) ) // If the RSS image is set, use it, otherwise use the iTunes image...
687
- $rss_image = $Feed['rss2_image'];
688
- else
689
- $rss_image = $Feed['itunes_image'];
690
-
691
- echo "\t". '<image>' .PHP_EOL;
692
- echo "\t\t".'<title>' . $podcast_title_safe . '</title>'.PHP_EOL;
693
- echo "\t\t".'<url>' . esc_html( str_replace(' ', '+', $rss_image)) . '</url>'.PHP_EOL;
694
- echo "\t\t".'<link>'. $Feed['url'] . '</link>' . PHP_EOL;
695
- echo "\t".'</image>' . PHP_EOL;
696
- }
697
- else // Use the default image
698
- {
699
- echo "\t". '<image>' .PHP_EOL;
700
- echo "\t\t".'<title>' . $podcast_title_safe . '</title>'.PHP_EOL;
701
- echo "\t\t".'<url>' . powerpress_get_root_url() . 'rss_default.jpg</url>'.PHP_EOL;
702
- echo "\t\t".'<link>'. $Feed['url'] . '</link>' . PHP_EOL;
703
- echo "\t".'</image>' . PHP_EOL;
704
- }
705
- }
706
-
707
- // Handle iTunes categories
708
- $Cat1 = false; $Cat2 = false; $Cat3 = false; $SubCat1 = false; $SubCat2 = false; $SubCat3 = false;
709
- if(defined('POWERPRESS_NEW_APPLE_CATEGORIES') && POWERPRESS_NEW_APPLE_CATEGORIES == true) {
710
- $Categories = powerpress_apple_categories();
711
- for ($i = 1; $i <= 3; $i++) {
712
- if(!empty($Feed['itunes_cat_'.$i] && empty($Feed['apple_cat_'.$i]))) {
713
- $mappings = array('01-00' => '01-00', '01-01' => '01-02', '01-02' => '01-03', '01-03' => '01-04', '01-04' => '01-01',
714
- '01-05' => '01-05', '01-06' => '01-06', '02-00' => '02-00', '02-01' => '12-01', '02-02' => '02-01', '02-03' => '02-03',
715
- '02-04' => '02-00', '02-05' => '02-00', '03-00' => '03-00', '04-00' => '04-00', '04-01' => '04-00', '04-02' => '04-00',
716
- '04-03' => '09-01', '04-04' => '04-03', '04-05' => '04-00', '05-00' => '10-00', '05-01' => '10-02', '05-02' => '10-03',
717
- '05-03' => '10-06', '05-04' => '10-05', '05-05' => '10-05', '06-00' => '06-00', '06-01' => '06-00', '06-02' => '06-00',
718
- '06-03' => '06-00', '06-04' => '06-00', '07-00' => '07-00', '07-01' => '07-01', '07-02' => '07-00', '07-03' => '04-04',
719
- '07-04' => '07-06', '08-00' => '09-00', '09-00' => '11-00', '11-00' => '13-00', '11-01' => '13-01', '11-02' => '13-02',
720
- '11-03' => '13-03', '11-04' => '13-04', '11-05' => '13-05', '11-06' => '13-06', '11-07' => '13-07', '12-00' => '14-00',
721
- '12-01' => '07-03', '12-02' => '14-06', '12-03' => '14-09', '13-00' => '15-00', '13-01' => '08-00', '13-02' => '15-02',
722
- '13-03' => '15-03', '13-04' => '15-04', '14-00' => '16-00', '14-01' => '16-00', '14-02' => '16-00', '14-03' => '16-15',
723
- '14-04' => '16-00', '15-00' => '17-00', '15-01' => '17-00', '15-02' => '12-07', '15-03' => '17-00', '15-04' => '17-00', '16-00' => '19-00');
724
- $Feed['apple_cat_'. $i] = $mappings[$Feed['itunes_cat_'.$i]];
725
-
726
- }
727
- }
728
- if (!empty($Feed['apple_cat_1']))
729
- list($Cat1, $SubCat1) = explode('-', $Feed['apple_cat_1']);
730
- if (!empty($Feed['apple_cat_2']))
731
- list($Cat2, $SubCat2) = explode('-', $Feed['apple_cat_2']);
732
- if (!empty($Feed['apple_cat_3']))
733
- list($Cat3, $SubCat3) = explode('-', $Feed['apple_cat_3']);
734
- }
735
- else {
736
- $Categories = powerpress_itunes_categories();
737
- if (!empty($Feed['itunes_cat_1']))
738
- list($Cat1, $SubCat1) = explode('-', $Feed['itunes_cat_1']);
739
- if (!empty($Feed['itunes_cat_2']))
740
- list($Cat2, $SubCat2) = explode('-', $Feed['itunes_cat_2']);
741
- if (!empty($Feed['itunes_cat_3']))
742
- list($Cat3, $SubCat3) = explode('-', $Feed['itunes_cat_3']);
743
- }
744
-
745
- if( $Cat1 )
746
- {
747
- $CatDesc = $Categories[$Cat1.'-00'];
748
- $SubCatDesc = $Categories[$Cat1.'-'.$SubCat1];
749
- echo "\t".'<itunes:category text="'. esc_html($CatDesc) .'">'.PHP_EOL;
750
- if( $SubCat1 != '00' )
751
- echo "\t\t".'<itunes:category text="'. esc_html($SubCatDesc) .'"></itunes:category>'.PHP_EOL;
752
-
753
- // End this category set
754
- echo "\t".'</itunes:category>'.PHP_EOL;
755
- }
756
-
757
- if( $Cat2 )
758
- {
759
- $CatDesc = $Categories[$Cat2.'-00'];
760
- $SubCatDesc = $Categories[$Cat2.'-'.$SubCat2];
761
-
762
- echo "\t".'<itunes:category text="'. esc_html($CatDesc) .'">'.PHP_EOL;
763
- if( $SubCat2 != '00' )
764
- echo "\t\t".'<itunes:category text="'. esc_html($SubCatDesc) .'"></itunes:category>'.PHP_EOL;
765
- echo "\t".'</itunes:category>'.PHP_EOL;
766
- }
767
-
768
- if( $Cat3 )
769
- {
770
- $CatDesc = $Categories[$Cat3.'-00'];
771
- $SubCatDesc = $Categories[$Cat3.'-'.$SubCat3];
772
-
773
- echo "\t".'<itunes:category text="'. esc_html($CatDesc) .'">'.PHP_EOL;
774
- if( $SubCat3 != '00' )
775
- echo "\t\t".'<itunes:category text="'. esc_html($SubCatDesc) .'"></itunes:category>'.PHP_EOL;
776
- // End this category set
777
- echo "\t".'</itunes:category>'.PHP_EOL;
778
- }
779
- // End Handle iTunes categories
780
-
781
- if( !empty($Feed['googleplay_email']) )
782
- {
783
- echo "\t".'<googleplay:email>' . esc_html($Feed['googleplay_email']) . '</googleplay:email>'.PHP_EOL;
784
- }
785
-
786
- if( !empty($Feed['googleplay_description']) )
787
- {
788
- echo "\t".'<googleplay:description>' . esc_html($Feed['googleplay_description']) . '</googleplay:description>'.PHP_EOL;
789
- }
790
-
791
- if( !empty($Feed['googleplay_explicit']) )
792
- {
793
- echo "\t".'<googleplay:explicit>Yes</googleplay:explicit>'.PHP_EOL;
794
- }
795
-
796
- // google_play_cat // google_play_explicit
797
- if( !empty($Feed['googleplay_cat']) )
798
- {
799
- $play_cats = powerpress_googleplay_categories();
800
- if( !empty($play_cats[ $Feed['googleplay_cat'] ]) )
801
- {
802
- echo "\t".'<googleplay:category text="'. esc_html($play_cats[ $Feed['googleplay_cat'] ]) .'" />'.PHP_EOL;
803
- }
804
- }
805
-
806
- if( !empty($Feed['googleplay_image']) )
807
- {
808
- echo "\t".'<googleplay:image href="' . esc_html( str_replace(' ', '+', $Feed['googleplay_image']), 'double') . '" />'.PHP_EOL;
809
- }
810
-
811
- // RawVoice RSS Tags
812
- if( !defined('POWERPRESS_RAWVOICE_RSS') || POWERPRESS_RAWVOICE_RSS != false )
813
- {
814
- if( !empty($Feed['parental_rating']) )
815
- echo "\t<rawvoice:rating>". $Feed['parental_rating'] ."</rawvoice:rating>".PHP_EOL;
816
- if( !empty($Feed['location']) )
817
- echo "\t<rawvoice:location>". htmlspecialchars($Feed['location']) ."</rawvoice:location>".PHP_EOL;
818
- if( !empty($Feed['frequency']) )
819
- echo "\t<rawvoice:frequency>". htmlspecialchars($Feed['frequency']) ."</rawvoice:frequency>".PHP_EOL;
820
- if( !empty($Feed['donate_link']) && !empty($Feed['donate_url']) )
821
- echo "\t<rawvoice:donate href=\"". htmlspecialchars( $Feed['donate_url'] ) ."\">". htmlspecialchars( (empty($Feed['donate_label'])?'':$Feed['donate_label']) ) ."</rawvoice:donate>".PHP_EOL;
822
-
823
- if( !empty($Feed['itunes_url']) || !empty($Feed['blubrry_url']) || !empty($Feed['stitcher_url']) || !empty($Feed['tunein_url']) || !empty($Feed['spotify_url']) ) {
824
- echo "\t<rawvoice:subscribe feed=\"";
825
- self_link();
826
- echo '"';
827
-
828
- // Subscribe page // empty($FeedSettings['subscribe_page_link_href']) && empty($FeedSettings['subscribe_page_link_id'])
829
- if( !empty($Feed['subscribe_page_link_id']) ) {
830
- $link = get_page_link($Feed['subscribe_page_link_id']);
831
- if( !empty($link) ) {
832
- echo " html=\"". htmlspecialchars( $link ) .'"';
833
- }
834
- } else if( !empty($Feed['subscribe_page_link_href']) ) {
835
- echo " html=\"". htmlspecialchars( $Feed['subscribe_page_link_href'] ) .'"';
836
- }
837
-
838
- if( !empty($Feed['itunes_url']) )
839
- echo " itunes=\"". htmlspecialchars( $Feed['itunes_url'] ) .'"';
840
- if( !empty($Feed['blubrry_url']) )
841
- echo " blubrry=\"". htmlspecialchars( $Feed['blubrry_url'] ) .'"';
842
- if( !empty($Feed['stitcher_url']) )
843
- echo " stitcher=\"". htmlspecialchars( $Feed['stitcher_url'] ) .'"';
844
- if( !empty($Feed['tunein_url']) )
845
- echo " tunein=\"". htmlspecialchars( $Feed['tunein_url'] ) .'"';
846
- if( !empty($Feed['spotify_url']) )
847
- echo " spotify=\"". htmlspecialchars( $Feed['spotify_url'] ) .'"';
848
- echo "></rawvoice:subscribe>".PHP_EOL;
849
- }
850
- }
851
- }
852
-
853
- add_action('rss2_head', 'powerpress_rss2_head');
854
- add_action('rss2_head_powerpress', 'powerpress_rss2_head');
855
-
856
- function powerpress_rss2_item()
857
- {
858
- global $post, $powerpress_feed;
859
-
860
- // are we processing a feed that powerpress should handle
861
- if( !powerpress_is_podcast_feed() )
862
- return;
863
-
864
- if( function_exists('post_password_required') )
865
- {
866
- if( post_password_required($post) )
867
- return;
868
- }
869
-
870
- // Check and see if we're working with a podcast episode
871
- $custom_enclosure = false;
872
- if( powerpress_is_custom_podcast_feed() && get_query_var('feed') !== 'podcast' && !is_category() && !is_tax() && !is_tag() )
873
- {
874
- $EpisodeData = powerpress_get_enclosure_data($post->ID, get_query_var('feed') );
875
- $custom_enclosure = true;
876
- }
877
- else
878
- {
879
- $EpisodeData = powerpress_get_enclosure_data($post->ID, 'podcast');
880
- if( !$EpisodeData && !empty($powerpress_feed['process_podpress']) )
881
- {
882
- $EpisodeData = powerpress_get_enclosure_data_podpress($post->ID);
883
- $custom_enclosure = true;
884
- }
885
- }
886
-
887
- // No episode data to include
888
- if( empty($EpisodeData) || empty($EpisodeData['url']) )
889
- return;
890
-
891
- // If enclosure not added, check to see why...
892
- if( defined('POWERPRESS_ENCLOSURE_FIX') && POWERPRESS_ENCLOSURE_FIX && !$custom_enclosure && $GLOBALS['powerpress_rss_enclosure_post_id'] != $post->ID )
893
- {
894
- $enclosure_in_wp = apply_filters('rss_enclosure', '<enclosure url="' . trim(htmlspecialchars($EpisodeData['url']) . '" length="' . $EpisodeData['size'] . '" type="' . $EpisodeData['type'] . '" />' . "\n") );
895
- if( !$enclosure_in_wp )
896
- $custom_enclosure = true;
897
- }
898
-
899
- // Lets print the enclosure tag
900
- if( $custom_enclosure ) // We need to add the enclosure tag here...
901
- {
902
- if( empty($EpisodeData['size']) )
903
- $EpisodeData['size'] = 5242880; // Use the dummy 5MB size since we don't have a size to quote
904
-
905
- echo "\t". sprintf('<enclosure url="%s" length="%d" type="%s" />%s',
906
- powerpress_url_in_feed(trim($EpisodeData['url'])),
907
- trim($EpisodeData['size']),
908
- trim($EpisodeData['type']),
909
- PHP_EOL);
910
- }
911
-
912
- $author = $powerpress_feed['itunes_talent_name'];
913
- if( isset($powerpress_feed['itunes_author_post']) )
914
- $author = get_the_author();
915
-
916
- $explicit = $powerpress_feed['explicit'];
917
- $summary = '';
918
- $subtitle = '';
919
- $block = false;
920
- $cc = false;
921
-
922
- if( isset( $EpisodeData['summary'] ) && strlen($EpisodeData['summary']) > 1 )
923
- $summary = $EpisodeData['summary'];
924
- if( isset( $EpisodeData['subtitle'] ) && strlen($EpisodeData['subtitle']) > 1 )
925
- $subtitle = $EpisodeData['subtitle'];
926
- if( isset( $EpisodeData['explicit'] ) && is_numeric($EpisodeData['explicit']) )
927
- {
928
- $explicit_array = array("no", "yes", "clean");
929
- $explicit = $explicit_array[$EpisodeData['explicit']];
930
- }
931
-
932
- if( !empty( $EpisodeData['author'] ) )
933
- $author = $EpisodeData['author'];
934
- if( !empty( $EpisodeData['block'] ) )
935
- $block = 'yes';
936
- if( !empty( $EpisodeData['cc'] ) )
937
- $cc = 'yes';
938
-
939
- $General = get_option('powerpress_general');
940
- $summary_cdata = ( !empty( $General['itunes_cdata'] ) ? true : false );
941
-
942
- if( empty($subtitle) ) {
943
- $subtitle = powerpress_get_the_exerpt( false, !empty($General['feed_action_hook']) );
944
- }
945
-
946
- // If no summary specified and we have enhanced summary enabled...
947
- if( empty($summary) && !empty($powerpress_feed['enhance_itunes_summary']) ) {
948
- $summary = powerpress_enhanced_itunes_summary( !empty($General['feed_action_hook']) );
949
- if( !empty($summary) ) {
950
- $summary_cdata = true; // Always use CDATA for enhanced iTunes summary
951
- }
952
- }
953
-
954
- if( empty($summary) ) { // Backwards compatibility with PodPress, the excerpt is used as the itunes summary if set
955
- $summary = powerpress_get_the_exerpt( true, !empty($General['feed_action_hook']) ); // Will call powerpress_get_the_content(true) if the excerpt does not exist
956
- }
957
-
958
- if( !empty($subtitle) ) {
959
- echo "\t<itunes:subtitle>". powerpress_format_itunes_value($subtitle, 'subtitle') .'</itunes:subtitle>'.PHP_EOL;
960
- }
961
-
962
- if( !empty($summary) ) {
963
- if( $summary_cdata ) {
964
- echo "\t\t<itunes:summary><![CDATA[". powerpress_format_itunes_value($summary, 'summary', true) .']]></itunes:summary>'.PHP_EOL;
965
- } else {
966
- echo "\t\t<itunes:summary>". powerpress_format_itunes_value($summary, 'summary') .'</itunes:summary>'.PHP_EOL;
967
- }
968
- }
969
-
970
- if( !empty($author) ) {
971
- echo "\t\t<itunes:author>" . esc_html($author) . '</itunes:author>'.PHP_EOL;
972
- }
973
-
974
- // itunes episode image
975
- if( !empty( $EpisodeData['itunes_image']) ) {
976
- echo "\t\t".'<itunes:image href="' . esc_html( powerpress_url_in_feed(str_replace(' ', '+', $EpisodeData['itunes_image'])), 'double') . '" />'.PHP_EOL;
977
- } else if( !empty($powerpress_feed['itunes_image']) ) {
978
- echo "\t\t".'<itunes:image href="' . esc_html( powerpress_url_in_feed(str_replace(' ', '+', $powerpress_feed['itunes_image'])), 'double') . '" />'.PHP_EOL;
979
- }
980
-
981
- if( !empty($EpisodeData['season']) ) {
982
- echo "\t\t".'<itunes:season>'. esc_html($EpisodeData['season']) .'</itunes:season>'.PHP_EOL;
983
- }
984
-
985
- if( !empty($EpisodeData['episode_no']) ) {
986
- echo "\t\t".'<itunes:episode>'. esc_html($EpisodeData['episode_no']) .'</itunes:episode>'.PHP_EOL;
987
- }
988
-
989
- if( !empty($EpisodeData['episode_title']) ) {
990
- echo "\t\t".'<itunes:title>'. esc_html($EpisodeData['episode_title']) .'</itunes:title>'.PHP_EOL;
991
- }
992
-
993
- if( !empty($EpisodeData['episode_type']) ) {
994
- echo "\t\t".'<itunes:episodeType>'. esc_html($EpisodeData['episode_type']) .'</itunes:episodeType>'.PHP_EOL;
995
- }
996
-
997
- if( !empty($explicit) && $explicit != 'no' ) {
998
- echo "\t\t<itunes:explicit>" . $explicit . '</itunes:explicit>'.PHP_EOL;
999
- }
1000
-
1001
- if( !empty($EpisodeData['duration']) && preg_match('/^(\d{1,2}:){0,2}\d{1,2}$/i', ltrim($EpisodeData['duration'], '0:') ) ) { // Include duration if it is valid
1002
- echo "\t\t<itunes:duration>" . ltrim($EpisodeData['duration'], '0:') . '</itunes:duration>'.PHP_EOL;
1003
- }
1004
-
1005
- if( $block && $block == 'yes' ) {
1006
- echo "\t\t<itunes:block>yes</itunes:block>".PHP_EOL;
1007
- }
1008
-
1009
- if( $cc && $cc == 'yes' ) {
1010
- echo "\t\t<itunes:isClosedCaptioned>yes</itunes:isClosedCaptioned>".PHP_EOL;
1011
- }
1012
-
1013
- if( !empty($powerpress_feed['itunes_feature']) ) { // We are using the itunes:order option to feature a specific episode.
1014
- // Skip inserting the order tag
1015
- } else {
1016
- if( isset( $EpisodeData['order'] ) && is_numeric( $EpisodeData['order'] ) )
1017
- echo "\t\t<itunes:order>". $EpisodeData['order'] ."</itunes:order>".PHP_EOL;
1018
- }
1019
-
1020
- // Google Play tags:
1021
- if( empty($powerpress_feed['feed_maximizer_on']) ) { // These tags for the most part replicate what is in the itunes tags, so lets not include them when we want to maximize the feed
1022
- if( !empty( $EpisodeData['gp_desc'] ) ) {
1023
- echo "\t\t<googleplay:description>". powerpress_format_itunes_value($EpisodeData['gp_desc'], 'summary') ."</googleplay:description>".PHP_EOL;
1024
- }
1025
-
1026
- if( !empty( $EpisodeData['gp_explicit'] ) ) {
1027
- echo "\t\t<googleplay:explicit>yes</googleplay:explicit>".PHP_EOL;
1028
- }
1029
- }
1030
-
1031
- if( !empty( $EpisodeData['gp_block'] ) ) {
1032
- echo "\t\t<googleplay:block>yes</googleplay:block>".PHP_EOL;
1033
- }
1034
-
1035
-
1036
- // RawVoice RSS Tags
1037
- if( empty($powerpress_feed['feed_maximizer_on']) )
1038
- {
1039
- if( !defined('POWERPRESS_RAWVOICE_RSS') || POWERPRESS_RAWVOICE_RSS != false )
1040
- {
1041
- if( !empty($EpisodeData['ishd']) )
1042
- echo "\t\t<rawvoice:isHD>yes</rawvoice:isHD>".PHP_EOL;;
1043
- if( !empty($EpisodeData['image']) )
1044
- echo "\t\t<rawvoice:poster url=\"". $EpisodeData['image'] ."\" />".PHP_EOL;
1045
- if( !empty($EpisodeData['embed']) )
1046
- echo "\t\t<rawvoice:embed>". htmlspecialchars($EpisodeData['embed']) ."</rawvoice:embed>".PHP_EOL;
1047
- else if( !empty($powerpress_feed['podcast_embed_in_feed']) && function_exists('powerpress_generate_embed') )
1048
- {
1049
- $player = powerpressplayer_embedable($EpisodeData['url'], $EpisodeData);
1050
- $embed_content = '';
1051
-
1052
- if( $player )
1053
- $embed_content = powerpress_generate_embed($player, $EpisodeData);
1054
- if( $embed_content )
1055
- echo "\t\t<rawvoice:embed>". htmlspecialchars( $embed_content ) ."</rawvoice:embed>".PHP_EOL;
1056
- }
1057
-
1058
- if( !empty($EpisodeData['webm_src']) )
1059
- {
1060
- echo "\t\t<rawvoice:webm src=\"". $EpisodeData['webm_src'] ."\"";
1061
- if( $EpisodeData['webm_length'] )
1062
- echo " length=\"". $EpisodeData['webm_length'] ."\"";
1063
- echo " type=\"video/webm\" />".PHP_EOL;
1064
- }
1065
-
1066
- $GeneralSettings = get_option('powerpress_general');
1067
-
1068
- if( !empty($GeneralSettings) && !empty($GeneralSettings['metamarks']) )
1069
- {
1070
- require_once(POWERPRESS_ABSPATH .'/powerpressadmin-metamarks.php');
1071
- powerpress_metamarks_print_rss2($EpisodeData);
1072
- }
1073
- }
1074
- }
1075
- }
1076
-
1077
- add_action('rss2_item', 'powerpress_rss2_item');
1078
- add_action('rss2_item_powerpress', 'powerpress_rss2_item');
1079
-
1080
- /*
1081
- This filter is only necessary for feeds that are not specifically for podcasting, e.g. a category feed that did not have category podcasting added to it
1082
- */
1083
- function powerpress_filter_rss_enclosure($content)
1084
- {
1085
- if( defined('PODPRESS_VERSION') || isset($GLOBALS['podcasting_player_id']) || isset($GLOBALS['podcast_channel_active']) || defined('PODCASTING_VERSION') ) {
1086
- return $content; // Another podcasting plugin is enabled...
1087
- }
1088
-
1089
- if( powerpress_is_custom_podcast_feed() && get_query_var('feed') !== 'podcast' && !is_category() && !is_tag() && !is_tax() )
1090
- return ''; // We will handle this enclosure in the powerpress_rss2_item() function
1091
-
1092
- $match_count = preg_match('/\surl="([^"]*)"/', $content, $matches); // No URL found, weird
1093
- if( count($matches) != 2)
1094
- return $content;
1095
-
1096
- // Original Media URL
1097
- $OrigURL = $matches[1];
1098
-
1099
- if( substr($OrigURL, 0, 5) != 'http:' && substr($OrigURL, 0, 6) != 'https:' )
1100
- return ''; // The URL value is invalid
1101
-
1102
- global $post, $powerpress_rss_enclosure_post_id;
1103
- if( empty($powerpress_rss_enclosure_post_id) )
1104
- $powerpress_rss_enclosure_post_id = -1;
1105
-
1106
- if( $powerpress_rss_enclosure_post_id == $post->ID )
1107
- return ''; // we've already included one enclosure, lets not allow anymore
1108
- $powerpress_rss_enclosure_post_id = $post->ID;
1109
-
1110
- $EpisodeData = powerpress_get_enclosure_data($post->ID);
1111
-
1112
- // Modified Media URL
1113
- $ModifiedURL = powerpress_url_in_feed($EpisodeData['url']); // powerpress_add_redirect_url($OrigURL);
1114
-
1115
- // Check that the content type is a valid one...
1116
- $match_count = preg_match('/\stype="([^"]*)"/', $content, $matches);
1117
- if( count($matches) > 1 && strstr($matches[1], '/') == false )
1118
- {
1119
- $ContentType = powerpress_get_contenttype($ModifiedURL);
1120
- $content = str_replace("type=\"{$matches[1]}\"", "type=\"$ContentType\"", $content);
1121
- }
1122
-
1123
- // Check that the content length is a digit greater that zero
1124
- $match_count = preg_match('/\slength="([^"]*)"/', $content, $matches);
1125
- if( count($matches) > 1 && empty($matches[1]) )
1126
- {
1127
- $content = str_replace("length=\"{$matches[1]}\"", "length=\"5242880\"", $content);
1128
- }
1129
-
1130
- // Replace the original url with the modified one...
1131
- if( $OrigURL != $ModifiedURL )
1132
- return str_replace($OrigURL, $ModifiedURL, $content);
1133
- return $content;
1134
- }
1135
-
1136
-
1137
- add_filter('rss_enclosure', 'powerpress_filter_rss_enclosure', 11);
1138
-
1139
- function powerpress_bloginfo_rss($content, $field = '')
1140
- {
1141
- $new_value = '';
1142
- if( powerpress_is_custom_podcast_feed() )
1143
- {
1144
- if( is_category() ) {
1145
- $Feed = get_option('powerpress_cat_feed_'.get_query_var('cat') );
1146
- }
1147
- else if( is_tax() || is_tag() ) {
1148
- global $powerpress_feed;
1149
- if( !empty($powerpress_feed['term_taxonomy_id']) )
1150
- $Feed = get_option('powerpress_taxonomy_'.$powerpress_feed['term_taxonomy_id'] );
1151
- }
1152
- else
1153
- {
1154
- global $powerpress_feed;
1155
-
1156
- if( !empty($powerpress_feed['post_type']) )
1157
- {
1158
- $feed_slug = get_query_var('feed');
1159
- $PostTypeSettingsArray = get_option('powerpress_posttype_'.$powerpress_feed['post_type'] );
1160
- if( !empty($PostTypeSettingsArray[ $feed_slug ]) )
1161
- $Feed = $PostTypeSettingsArray[ $feed_slug ];
1162
- }
1163
- else
1164
- {
1165
- $Feed = get_option('powerpress_feed_'.get_query_var('feed') );
1166
- if( empty($Feed) && get_query_var('feed') === 'podcast' )
1167
- $Feed = get_option('powerpress_feed');
1168
- }
1169
- }
1170
-
1171
- if( $Feed )
1172
- {
1173
- switch( $field )
1174
- {
1175
- case 'description': {
1176
- if( !empty($Feed['description']) )
1177
- $new_value = $Feed['description'];
1178
- else if( is_category() )
1179
- {
1180
- $category = get_category( get_query_var('cat') );
1181
- if( $category->description )
1182
- $new_value = $category->description;
1183
- }
1184
- }; break;
1185
- case 'url': {
1186
- // If the website URL is set for this podcast then lets use it...
1187
- if( !empty($Feed['url']) )
1188
- return trim($Feed['url']);
1189
-
1190
- if( is_category() ) {
1191
- return get_category_link( get_query_var('cat') );
1192
- } else {
1193
- $urlTemp = '';
1194
- $blogHomepage = get_option('page_for_posts');
1195
- if( !empty($blogHomepage) ) {
1196
- $urlTemp = get_permalink( $blogHomepage );
1197
- }
1198
-
1199
- if( empty($urlTemp) )
1200
- $urlTemp = get_bloginfo('url');
1201
- if( !empty($urlTemp) )
1202
- return $urlTemp;
1203
- }
1204
- }; break;
1205
- case 'name': { // As of wp 4.4+ title is handled by get_the_title_rss completely.
1206
- if( !empty($Feed['title']) )
1207
- $new_value = $Feed['title'];
1208
- }; break;
1209
- case 'language': {
1210
- // Get the feed language
1211
- $lang = '';
1212
- if( isset($Feed['rss_language']) && $Feed['rss_language'] != '' )
1213
- $lang = $Feed['rss_language'];
1214
- if( strlen($lang) == 5 )
1215
- $lang = substr($lang,0,3) . strtoupper( substr($lang, 3) ); // Format example: en-US for English, United States
1216
- if( !empty($lang) )
1217
- return $lang;
1218
- }; break;
1219
- }
1220
- }
1221
- }
1222
-
1223
- if( !empty($new_value) )
1224
- {
1225
- $new_value = wptexturize($new_value);
1226
- $new_value = convert_chars($new_value);
1227
- $new_value = esc_html($new_value);
1228
- //$new_value = convert_chars($new_value);
1229
- return $new_value;
1230
- }
1231
-
1232
- return $content;
1233
- }
1234
-
1235
- add_filter('get_bloginfo_rss', 'powerpress_bloginfo_rss', 10, 2);
1236
-
1237
-
1238
- function powerpress_wp_title_rss($title)
1239
- {
1240
- if( version_compare($GLOBALS['wp_version'], 4.4, '>=' ) )
1241
- {
1242
- if( powerpress_is_custom_podcast_feed() )
1243
- {
1244
- if( is_category() ) {
1245
- $Feed = get_option('powerpress_cat_feed_'.get_query_var('cat') );
1246
- }
1247
- else if( is_tax() || is_tag() ) {
1248
- global $powerpress_feed;
1249
- if( !empty($powerpress_feed['term_taxonomy_id']) )
1250
- $Feed = get_option('powerpress_taxonomy_'.$powerpress_feed['term_taxonomy_id'] );
1251
- }
1252
- else
1253
- {
1254
- global $powerpress_feed;
1255
-
1256
- if( !empty($powerpress_feed['post_type']) )
1257
- {
1258
- $feed_slug = get_query_var('feed');
1259
- if( !empty($feed_slug) ) {
1260
- $PostTypeSettingsArray = get_option('powerpress_posttype_'.$powerpress_feed['post_type'] );
1261
- if( !empty($PostTypeSettingsArray[ $feed_slug ]) )
1262
- $Feed = $PostTypeSettingsArray[ $feed_slug ];
1263
- }
1264
- }
1265
- else
1266
- {
1267
- $feed_slug = get_query_var('feed');
1268
- $Feed = false;
1269
- if( !empty($feed_slug) ) {
1270
- $Feed = get_option('powerpress_feed_'.get_query_var('feed') );
1271
- }
1272
- if( empty($Feed) && get_query_var('feed') === 'podcast' )
1273
- $Feed = get_option('powerpress_feed');
1274
- }
1275
- }
1276
-
1277
- if( $Feed )
1278
- {
1279
- if( !empty($Feed['title']) )
1280
- return esc_html( $Feed['title'] );
1281
- }
1282
- }
1283
- }
1284
- else
1285
- {
1286
- if( powerpress_is_custom_podcast_feed() )
1287
- {
1288
- if( is_category() )
1289
- {
1290
- $Feed = get_option('powerpress_cat_feed_'.get_query_var('cat') );
1291
- if( $Feed && isset($Feed['title']) && $Feed['title'] != '' )
1292
- return ''; // We alrady did a custom title, lets not add the category to it...
1293
- }
1294
- else
1295
- {
1296
- return ''; // It is not a category, lets not mess with our beautiful title then
1297
- }
1298
- }
1299
- }
1300
-
1301
- return $title;
1302
- }
1303
-
1304
- add_filter('get_wp_title_rss', 'powerpress_wp_title_rss');
1305
-
1306
- function powerpress_the_title_rss($title)
1307
- {
1308
- $new_title = $title;
1309
- $GeneralSettings = get_option('powerpress_general');
1310
- // If it is a custom podcast channel...
1311
- if( !empty($GeneralSettings['seo_feed_title']) )
1312
- {
1313
- $feed_slug = 'podcast';
1314
- // IF custom post type or channel, use that feed slug...
1315
- if( get_query_var('feed') !== 'podcast' && !is_category() && !is_tax() && !is_tag() )
1316
- $feed_slug = get_query_var('feed');
1317
-
1318
- // Get the episode specific title...
1319
- $EpisodeData = powerpress_get_enclosure_data(get_the_ID(), $feed_slug);
1320
- if( !empty($EpisodeData['feed_title']) )
1321
- {
1322
- $feed_title = ent2ncr( $EpisodeData['feed_title'] );
1323
- $feed_title = strip_tags( $feed_title );
1324
- $feed_title = esc_html( $feed_title );
1325
-
1326
- //switch( $GeneralSettings['custom_feed_title'] )
1327
- switch( $GeneralSettings['seo_feed_title'] )
1328
- {
1329
- case 1: { // Replaces title
1330
- $new_title = $feed_title;
1331
- }; break;
1332
- case 2: { // Prefixes title
1333
- $new_title = $feed_title . ' ' . $title;
1334
- }; break;
1335
- case 3: { // Postfixes title
1336
- $new_title = $title . ' ' . $feed_title;
1337
- }; break;
1338
- }
1339
- }
1340
- }
1341
-
1342
- return $new_title;
1343
- }
1344
-
1345
- add_filter('the_title_rss', 'powerpress_the_title_rss', 11);
1346
-
1347
-
1348
- function powerpress_feed_content_type($content_type = '', $feedslug = '')
1349
- {
1350
- switch( $feedslug )
1351
- {
1352
- case 'rss':
1353
- case 'rss2':
1354
- case 'atom':
1355
- case 'rdf': {
1356
- // Do nothing, let WordPress take care of these
1357
- }; break;
1358
- case 'podcast': {
1359
- // This one is ours!
1360
- $content_type = 'application/rss+xml';
1361
- }; break;
1362
- default: { // Check for the custom podcast feeds
1363
- $GeneralSettings = get_option('powerpress_general');
1364
- if( !empty($GeneralSettings['custom_feeds'][ $feedslug ]) )
1365
- {
1366
- $content_type = 'application/rss+xml';
1367
- }
1368
- else if( !empty($GeneralSettings['posttype_podcasting']) )
1369
- {
1370
- // We need to look up these settings...
1371
- $FeedSlugPostTypesArray = get_option('powerpress_posttype-podcasting');
1372
- if( is_array($FeedSlugPostTypesArray) && !empty($FeedSlugPostTypesArray[ $feedslug ]) )
1373
- {
1374
- $content_type = 'application/rss+xml';
1375
- }
1376
- }
1377
- }
1378
- }
1379
-
1380
- return $content_type;
1381
- }
1382
-
1383
- add_filter( 'feed_content_type', 'powerpress_feed_content_type', 10, 2 );
1384
-
1385
- // Following code only works for WP 3.3 or older. WP 3.4+ now uses the get_locale setting, so we have to override directly in the get_bloginfo_rss functoin.
1386
- if( version_compare($GLOBALS['wp_version'], '3.4', '<') )
1387
- {
1388
- function powerpress_rss_language($value)
1389
- {
1390
- if( powerpress_is_custom_podcast_feed() )
1391
- {
1392
- global $powerpress_feed;
1393
- if( $powerpress_feed && isset($powerpress_feed['rss_language']) && $powerpress_feed['rss_language'] != '' )
1394
- $value = $powerpress_feed['rss_language'];
1395
- }
1396
- return $value;
1397
- }
1398
-
1399
- add_filter('option_rss_language', 'powerpress_rss_language');
1400
- }
1401
-
1402
- function powerpress_do_podcast_feed($for_comments=false)
1403
- {
1404
- global $wp_query, $powerpress_feed;
1405
-
1406
- powerpress_is_podcast_feed(); // Loads the feed settings if not already loaded...
1407
-
1408
- $GeneralSettings = get_option('powerpress_general');
1409
- if( isset($GeneralSettings['premium_caps']) && $GeneralSettings['premium_caps'] )
1410
- {
1411
- $feed_slug = get_query_var('feed');
1412
-
1413
- if( $feed_slug != 'podcast' )
1414
- {
1415
- $FeedSettings = get_option('powerpress_feed_'.$feed_slug);
1416
- if( !empty($FeedSettings['premium']) )
1417
- {
1418
- require_once( POWERPRESS_ABSPATH.'/powerpress-feed-auth.php');
1419
- powerpress_feed_auth( $feed_slug );
1420
- }
1421
- }
1422
- }
1423
-
1424
- // Use the template to gurantee future WordPress behavior
1425
- if( defined('POWERPRESS_FEED_TEMPLATE') ) {
1426
- load_template( POWERPRESS_FEED_TEMPLATE );
1427
- } else {
1428
- load_template( POWERPRESS_ABSPATH . '/feed-podcast.php' );
1429
- }
1430
- }
1431
-
1432
- function powerpress_template_redirect()
1433
- {
1434
- if( is_feed() && powerpress_is_custom_podcast_feed() )
1435
- {
1436
- if ( defined('WPSEO_VERSION') && version_compare(WPSEO_VERSION, '7.7', '>=') && class_exists( 'WPSEO_Frontend' ) ) {
1437
- $wpseo_frontend = WPSEO_Frontend::get_instance();
1438
- if( !empty($wpseo_frontend) ) {
1439
- remove_action( 'template_redirect', array( $wpseo_frontend, 'noindex_feed' ) );
1440
- }
1441
- }
1442
-
1443
- remove_action('template_redirect', 'ol_feed_redirect'); // Remove this action so feedsmith doesn't redirect
1444
- global $powerpress_feed;
1445
- if( !isset($powerpress_feed['feed_redirect_url']) )
1446
- $powerpress_feed['feed_redirect_url'] = '';
1447
- $redirect_value = ( !empty($_GET['redirect'])? $_GET['redirect'] : false );
1448
- if( is_array($powerpress_feed) && trim($powerpress_feed['feed_redirect_url']) != '' && !preg_match("/feedburner|feedsqueezer|feedvalidator/i", $_SERVER['HTTP_USER_AGENT'] ) && $redirect_value != 'no' )
1449
- {
1450
- if (function_exists('status_header'))
1451
- status_header( 301 );
1452
- header("Location: " . trim($powerpress_feed['feed_redirect_url']));
1453
- header("HTTP/1.1 301 Moved Permanently");
1454
- exit();
1455
- }
1456
- }
1457
- }
1458
-
1459
- add_action('template_redirect', 'powerpress_template_redirect', 0);
1460
-
1461
-
1462
- function powerpress_rewrite_rules_array($array)
1463
- {
1464
- global $wp_rewrite;
1465
- $settings = get_option('powerpress_general');
1466
-
1467
- $podcast_feeds = array('podcast'=>true);
1468
- if( isset($settings['custom_feeds']) && is_array($settings['custom_feeds']) )
1469
- $podcast_feeds = array_merge($settings['custom_feeds'], $podcast_feeds );
1470
-
1471
- $merged_slugs = '';
1472
- foreach( $podcast_feeds as $feed_slug=> $feed_title )
1473
- {
1474
- if( $merged_slugs != '' )
1475
- $merged_slugs .= '|';
1476
- $merged_slugs .= $feed_slug;
1477
- }
1478
-
1479
- // $wp_rewrite->index most likely index.php
1480
- $new_array[ 'feed/('.$merged_slugs.')/?$' ] = $wp_rewrite->index. '?feed='. $wp_rewrite->preg_index(1);
1481
-
1482
- // If feature is not enabled, use the default permalinks
1483
- if( empty($settings['permalink_feeds_only']) )
1484
- return array_merge($new_array, $array);
1485
-
1486
- global $wpdb;
1487
- reset($podcast_feeds);
1488
- foreach( $podcast_feeds as $feed_slug=> $feed_title )
1489
- {
1490
- $page_name_id = $wpdb->get_var("SELECT ID FROM {$wpdb->posts} WHERE post_name = '".$feed_slug."'");
1491
- if( $page_name_id )
1492
- {
1493
- $new_array[ $feed_slug.'/?$' ] = $wp_rewrite->index. '?pagename='. $feed_slug.'&page_id='.$page_name_id;
1494
- unset($podcast_feeds[ $feed_slug ]);
1495
- continue;
1496
- }
1497
-
1498
- $category = get_category_by_slug($feed_slug);
1499
- if( $category )
1500
- {
1501
- $new_array[ $feed_slug.'/?$' ] = $wp_rewrite->index. '?cat='. $category->term_id; // category_name='. $feed_slug .'&
1502
- unset($podcast_feeds[ $feed_slug ]);
1503
- }
1504
- }
1505
-
1506
- if( count($podcast_feeds) > 0 )
1507
- {
1508
- reset($podcast_feeds);
1509
- $remaining_slugs = '';
1510
- foreach( $podcast_feeds as $feed_slug=> $feed_title )
1511
- {
1512
- if( $remaining_slugs != '' )
1513
- $remaining_slugs .= '|';
1514
- $remaining_slugs .= $feed_slug;
1515
- }
1516
-
1517
- $new_array[ '('.$remaining_slugs.')/?$' ] = $wp_rewrite->index. '?pagename='. $wp_rewrite->preg_index(1);
1518
- }
1519
-
1520
- return array_merge($new_array, $array);
1521
- }
1522
-
1523
- add_filter('rewrite_rules_array', 'powerpress_rewrite_rules_array');
1524
-
1525
-
1526
- function powerpress_pre_transient_rewrite_rules($return_rules)
1527
- {
1528
- global $wp_rewrite;
1529
- $GeneralSettings = get_option('powerpress_general');
1530
- if( !in_array('podcast', $wp_rewrite->feeds) )
1531
- $wp_rewrite->feeds[] = 'podcast';
1532
-
1533
- if( $GeneralSettings && isset($GeneralSettings['custom_feeds']) && is_array($GeneralSettings['custom_feeds']) )
1534
- {
1535
- foreach( $GeneralSettings['custom_feeds'] as $feed_slug=> $null )
1536
- {
1537
- if( !in_array($feed_slug, $wp_rewrite->feeds) )
1538
- $wp_rewrite->feeds[] = $feed_slug;
1539
- }
1540
- }
1541
-
1542
- return $return_rules;
1543
- }
1544
-
1545
- add_filter('pre_transient_rewrite_rules', 'powerpress_pre_transient_rewrite_rules');
1546
-
1547
- function powerpress_init()
1548
- {
1549
- $GeneralSettings = get_option('powerpress_general');
1550
-
1551
- if( !empty($GeneralSettings['powerpress-beta-features']) && file_exists(POWERPRESS_ABSPATH.'/powerpressadmin-pts.php') )
1552
- {
1553
- require_once(POWERPRESS_ABSPATH.'/powerpressadmin-pts.php');
1554
- }
1555
-
1556
- if( empty($GeneralSettings['disable_appearance']) || $GeneralSettings['disable_appearance'] == false )
1557
- {
1558
- require_once( POWERPRESS_ABSPATH.'/powerpress-player.php');
1559
- powerpressplayer_init($GeneralSettings);
1560
- }
1561
-
1562
- // Enable the playlist feature for PowerPress
1563
- if( !empty($GeneralSettings['playlist_player']) ) // Either not set or set on
1564
- {
1565
- require_once(POWERPRESS_ABSPATH.'/powerpress-playlist.php');
1566
- }
1567
-
1568
- if( defined('PODPRESS_VERSION') || isset($GLOBALS['podcasting_player_id']) || isset($GLOBALS['podcast_channel_active']) || defined('PODCASTING_VERSION') )
1569
- return false; // Another podcasting plugin is enabled...
1570
-
1571
- // If we are to process podpress data..
1572
- if( !empty($GeneralSettings['process_podpress']) )
1573
- {
1574
- powerpress_podpress_redirect_check();
1575
- }
1576
-
1577
- // Add the podcast feeds;
1578
- if( !defined('POWERPRESS_NO_PODCAST_FEED') )
1579
- {
1580
- add_feed('podcast', 'powerpress_do_podcast_feed');
1581
- }
1582
-
1583
- if( $GeneralSettings && isset($GeneralSettings['custom_feeds']) && is_array($GeneralSettings['custom_feeds']) )
1584
- {
1585
- foreach( $GeneralSettings['custom_feeds'] as $feed_slug=> $feed_title )
1586
- {
1587
- if( $feed_slug != 'podcast' )
1588
- add_feed($feed_slug, 'powerpress_do_podcast_feed');
1589
- }
1590
- }
1591
-
1592
- if( !empty($GeneralSettings['posttype_podcasting']) )
1593
- {
1594
- // Loop through the posttype podcasting settings and set the feeds for the custom post type slugs...
1595
- global $wp_rewrite;
1596
-
1597
-
1598
- $FeedSlugPostTypesArray = get_option('powerpress_posttype-podcasting'); // Changed field slightly so it does not conflict with a post type "podcasting"
1599
- if( $FeedSlugPostTypesArray === false )
1600
- {
1601
- // Simple one-time fix...
1602
- $FeedSlugPostTypesArray = get_option('powerpress_posttype_podcasting');
1603
- if( empty($FeedSlugPostTypesArray) )
1604
- $FeedSlugPostTypesArray = array();
1605
- update_option('powerpress_posttype-podcasting', $FeedSlugPostTypesArray);
1606
- if( !array_key_exists('title', $FeedSlugPostTypesArray) ) // AS long as it doesn't have post type specific settings...
1607
- delete_option('powerpress_posttype_podcasting');
1608
- }
1609
-
1610
- if( empty($FeedSlugPostTypesArray) )
1611
- {
1612
- $FeedSlugPostTypesArray = array();
1613
- }
1614
- foreach( $FeedSlugPostTypesArray as $feed_slug=> $FeedSlugPostTypes )
1615
- {
1616
- if ( !in_array($feed_slug, $wp_rewrite->feeds) ) // we need to add this feed name
1617
- {
1618
- add_feed($feed_slug, 'powerpress_do_podcast_feed');
1619
- foreach( $FeedSlugPostTypes as $post_type_slug=> $title )
1620
- {
1621
- add_rewrite_rule( '/'. $post_type_slug .'/feed/'. $feed_slug .'/?$', 'index.php?post_type='. $post_type_slug .'&feed='.$feed_slug, 'top' ); // capture the post type feeds
1622
- add_rewrite_rule( '/'. $post_type_slug .'/feed/'. $feed_slug .'/?$', 'index.php?post_type='. $post_type_slug .'&feed='.$feed_slug, 'bottom' ); // capture the post type feeds
1623
- }
1624
- }
1625
- }
1626
- }
1627
-
1628
- if( defined('GAWP_VERSION') )
1629
- {
1630
- add_filter('the_content', 'powerpress_yoast_gawp_fix', 120 );
1631
- }
1632
-
1633
- if( !empty($GeneralSettings['subscribe_links']) )
1634
- {
1635
- // 2 Subscribe page shortocde [powerpress_subscribe feedslug="podcast"]
1636
- // 3 Subscribe sidebar widget: iTunes, RSS
1637
- add_filter('powerpress_player_subscribe_links', 'powerpressplayer_link_subscribe_pre', 1, 3);
1638
- add_filter('powerpress_player_subscribe_links', 'powerpressplayer_link_subscribe_post', 1000, 3);
1639
- }
1640
- wp_register_style(
1641
- 'powerpress-subscribe-style',
1642
- powerpress_get_root_url() . 'css/subscribe.css',
1643
- array(),
1644
- '20141021',
1645
- 'all' );
1646
-
1647
- if( !empty($GeneralSettings['rss_emoji']) ) {
1648
- if( has_filter('the_content_feed', 'wp_staticize_emoji') ) {
1649
- remove_filter( 'the_content_feed', 'wp_staticize_emoji' ); // Remove the emoji images
1650
- remove_filter( 'comment_text_rss', 'wp_staticize_emoji' );
1651
- //add_filter( 'the_content_feed', 'wp_encode_emoji' ); // Convert an emoji to &#x1Fxxx;
1652
- //add_filter( 'get_wp_title_rss', 'wp_encode_emoji' );
1653
- }
1654
- }
1655
-
1656
- remove_action( 'wp_head', 'feed_links', 2 );
1657
- remove_action( 'wp_head', 'feed_links_extra', 3 );
1658
- }
1659
-
1660
- add_action('init', 'powerpress_init', -100); // We need to add the feeds before other plugins start screwing with them
1661
-
1662
- function powerpress_wp_print_styles()
1663
- {
1664
- $Settings = get_option('powerpress_general');
1665
-
1666
- if( !empty($Settings['audio_player_max_width']) )
1667
- {
1668
- echo '<style type="text/css">'."\n";
1669
- if( is_numeric($Settings['audio_player_max_width']) )
1670
- $Settings['audio_player_max_width'] .= 'px';
1671
- echo '.powerpress_player .wp-audio-shortcode { max-width: '.$Settings['audio_player_max_width'].'; }'."\n";
1672
- echo '</style>'."\n";
1673
- }
1674
- }
1675
-
1676
- add_action('wp_print_styles', 'powerpress_wp_print_styles');
1677
-
1678
- function powerpress_request($qv)
1679
- {
1680
- if( !empty($qv['feed']) )
1681
- {
1682
- $podcast_feed_slug = false;
1683
- if( $qv['feed'] == 'podcast' ) {
1684
- $GeneralSettings = get_option('powerpress_general');
1685
- if( empty($GeneralSettings['posttype_podcasting']) )
1686
- $podcast_feed_slug = 'podcast';
1687
- } else if( $qv['feed'] == 'rss' || $qv['feed'] == 'rss2' || $qv['feed'] == 'atom' || $qv['feed'] == 'rdf' || $qv['feed'] == 'feed' ) { // 'feed', 'rdf', 'rss', 'rss2', 'atom'
1688
- // Skip
1689
- } else {
1690
- $GeneralSettings = get_option('powerpress_general');
1691
- if( empty($GeneralSettings['posttype_podcasting']) && isset($GeneralSettings['custom_feeds']) && is_array($GeneralSettings['custom_feeds']) && !empty($GeneralSettings['custom_feeds'][ $qv['feed'] ] ) )
1692
- $podcast_feed_slug = $qv['feed'];
1693
-
1694
-
1695
- }
1696
-
1697
- if( $podcast_feed_slug )
1698
- {
1699
- if( !defined('POWERPRESS_POSTTYPE_MIXING') && $qv['feed'] == 'podcast' ) {
1700
- $qv['post_type'] = 'post';
1701
- } else {
1702
- $qv['post_type'] = get_post_types( array('public'=> true, 'capability_type'=>'post') );
1703
- if( !empty($qv['post_type']['attachment']) )
1704
- unset($qv['post_type']['attachment']);
1705
- }
1706
-
1707
- $FeedCustom = get_option('powerpress_feed_'.$podcast_feed_slug); // Get custom feed specific settings
1708
- // See if the user set a custom post type only...
1709
- if( !empty($FeedCustom) && !empty( $FeedCustom['custom_post_type']) )
1710
- $qv['post_type'] = $FeedCustom['custom_post_type'];
1711
- }
1712
- }
1713
- return $qv;
1714
- }
1715
-
1716
- add_filter('request', 'powerpress_request');
1717
-
1718
-
1719
- function powerpress_plugins_loaded()
1720
- {
1721
- // Translation support loaded:
1722
- load_plugin_textdomain('powerpress', // domain / keyword name of plugin
1723
- POWERPRESS_ABSPATH .'/languages', // Absolute path
1724
- basename(POWERPRESS_ABSPATH).'/languages' ); // relative path in plugins folder
1725
-
1726
- /*
1727
- ####
1728
- # Defines that effect translation defined now:
1729
- ####
1730
- */
1731
- // Set specific play and download labels for your installation of PowerPress
1732
- if( !defined('POWERPRESS_LINKS_TEXT') )
1733
- define('POWERPRESS_LINKS_TEXT', __('Podcast', 'powerpress') );
1734
- if( !defined('POWERPRESS_DURATION_TEXT') )
1735
- define('POWERPRESS_DURATION_TEXT', __('Duration', 'powerpress') );
1736
- if( !defined('POWERPRESS_PLAY_IN_NEW_WINDOW_TEXT') )
1737
- define('POWERPRESS_PLAY_IN_NEW_WINDOW_TEXT', __('Play in new window', 'powerpress') );
1738
- if( !defined('POWERPRESS_DOWNLOAD_TEXT') )
1739
- define('POWERPRESS_DOWNLOAD_TEXT', __('Download', 'powerpress') );
1740
- if( !defined('POWERPRESS_PLAY_TEXT') )
1741
- define('POWERPRESS_PLAY_TEXT', __('Play', 'powerpress') );
1742
- if( !defined('POWERPRESS_EMBED_TEXT') )
1743
- define('POWERPRESS_EMBED_TEXT', __('Embed', 'powerpress') );
1744
- if( !defined('POWERPRESS_READ_TEXT') )
1745
- define('POWERPRESS_READ_TEXT', __('Read', 'powerpress') );
1746
- }
1747
- add_action('plugins_loaded', 'powerpress_plugins_loaded');
1748
-
1749
-
1750
- function powerpress_w3tc_can_print_comment($settings)
1751
- {
1752
- return false;
1753
- }
1754
-
1755
- // Disable minifying if W3TC is enabled
1756
- function powerpress_w3tc_minify_enable($enable)
1757
- {
1758
- if( is_feed() )
1759
- return false;
1760
- return $enable;
1761
- }
1762
-
1763
- // Load the general feed settings for feeds handled by powerpress
1764
- function powerpress_load_general_feed_settings()
1765
- {
1766
- global $wp_query;
1767
- global $powerpress_feed;
1768
-
1769
- if( $powerpress_feed !== false ) // If it is not false (either NULL or an array) then we already looked these settings up
1770
- {
1771
- $powerpress_feed = false;
1772
-
1773
- // Get the powerpress settings
1774
- $GeneralSettings = get_option('powerpress_general');
1775
- if( !isset($GeneralSettings['custom_feeds']['podcast']) )
1776
- $GeneralSettings['custom_feeds']['podcast'] = 'Podcast Feed'; // Fixes scenario where the user never configured the custom default podcast feed.
1777
- if( empty($GeneralSettings['default_url']) )
1778
- $GeneralSettings['default_url'] = '';
1779
-
1780
- if( $GeneralSettings )
1781
- {
1782
- $FeedSettingsBasic = get_option('powerpress_feed'); // Get overall feed settings
1783
- if( is_feed() && defined( 'WPCACHEHOME' ) && empty($GeneralSettings['allow_feed_comments']) )
1784
- {
1785
- global $wp_super_cache_comments;
1786
- $wp_super_cache_comments = 0;
1787
- }
1788
-
1789
- if( is_feed() && defined('W3TC') && empty($GeneralSettings['allow_feed_comments']) )
1790
- {
1791
- add_filter( 'w3tc_can_print_comment', 'powerpress_w3tc_can_print_comment', 10, 1 );
1792
- }
1793
-
1794
- if( is_feed() && defined('W3TC') )
1795
- {
1796
- add_filter( 'w3tc_minify_enable', 'powerpress_w3tc_minify_enable');
1797
- }
1798
-
1799
- // If we're in advanced mode and we're dealing with a category feed we're extending, lets work with it...
1800
- if( is_category() && isset($GeneralSettings['custom_cat_feeds']) && is_array($GeneralSettings['custom_cat_feeds']) && in_array( get_query_var('cat'), $GeneralSettings['custom_cat_feeds']) )
1801
- {
1802
- $cat_ID = get_query_var('cat');
1803
- $FeedCustom = get_option('powerpress_cat_feed_'.$cat_ID); // Get custom feed specific settings
1804
- $Feed = powerpress_merge_empty_feed_settings($FeedCustom, $FeedSettingsBasic);
1805
-
1806
- $powerpress_feed = array();
1807
- if( !empty($GeneralSettings['feed_accel']) )
1808
- $powerpress_feed['feed_accel'] = true;
1809
- $powerpress_feed['is_custom'] = true;
1810
- $powerpress_feed['category'] = $cat_ID;
1811
- $powerpress_feed['process_podpress'] = !empty($GeneralSettings['process_podpress']); // Category feeds could originate from Podpress
1812
- $powerpress_feed['rss_language'] = ''; // default, let WordPress set the language
1813
- $powerpress_feed['default_url'] = '';
1814
- if( !empty($GeneralSettings['default_url']) )
1815
- $powerpress_feed['default_url'] = rtrim($GeneralSettings['default_url'], '/') .'/';
1816
- $explicit_array = array("no", "yes", "clean");
1817
- $powerpress_feed['explicit'] = $explicit_array[$Feed['itunes_explicit']];
1818
- if( !empty($Feed['itunes_talent_name']) )
1819
- $powerpress_feed['itunes_talent_name'] = $Feed['itunes_talent_name'];
1820
- else
1821
- $powerpress_feed['itunes_talent_name'] = get_wp_title_rss();
1822
- $powerpress_feed['enhance_itunes_summary'] = $Feed['enhance_itunes_summary'];
1823
- if( !empty($GeneralSettings['seo_itunes']) )
1824
- $powerpress_feed['enhance_itunes_summary'] = 1;
1825
- $powerpress_feed['posts_per_rss'] = false;
1826
- if( !empty($Feed['posts_per_rss']) && is_numeric($Feed['posts_per_rss']) && $Feed['posts_per_rss'] > 0 )
1827
- $powerpress_feed['posts_per_rss'] = $Feed['posts_per_rss'];
1828
- $powerpress_feed['feed_redirect_url'] = '';
1829
- if( !empty($Feed['feed_redirect_url']) )
1830
- $powerpress_feed['feed_redirect_url'] = $Feed['feed_redirect_url'];
1831
- if( $Feed['itunes_author_post'] == true )
1832
- $powerpress_feed['itunes_author_post'] = true;
1833
- if( $Feed['rss_language'] != '' )
1834
- $powerpress_feed['rss_language'] = $Feed['rss_language'];
1835
-
1836
- if( !empty($GeneralSettings['podcast_embed_in_feed']) )
1837
- $powerpress_feed['podcast_embed_in_feed'] = true;
1838
- if( !empty($Feed['maximize_feed']) )
1839
- $powerpress_feed['maximize_feed'] = true;
1840
- if( !empty($Feed['episode_itunes_image']) && !empty($Feed['itunes_image']) )
1841
- $powerpress_feed['itunes_image'] = $Feed['itunes_image'];
1842
- return;
1843
- }
1844
- else if( ( defined('POWERPRESS_TAXONOMY_PODCASTING') || !empty($GeneralSettings['taxonomy_podcasting']) ) && ( is_tag() || is_tax() ) )
1845
- {
1846
- // We need to get the term_id and the tax_id (tt_id)
1847
- $term_slug = get_query_var('term');
1848
- $taxonomy = get_query_var('taxonomy');
1849
-
1850
- if( empty($term_slug) && empty($taxonomy) ) // Handle situation where tag is the taxonomy we're working with
1851
- {
1852
- $term_slug = get_query_var('tag');
1853
- if( !empty($term_slug) )
1854
- $taxonomy = 'post_tag';
1855
- }
1856
-
1857
- $term = false;
1858
- if( !empty($term_slug) && !empty($taxonomy) )
1859
- {
1860
- $term = term_exists($term_slug, $taxonomy);
1861
- }
1862
-
1863
- if( !empty($term['term_taxonomy_id']) )
1864
- {
1865
- $FeedCustom = get_option('powerpress_taxonomy_'.$term['term_taxonomy_id'] ); // Get custom feed specific settings
1866
- if( $FeedCustom )
1867
- {
1868
- $Feed = powerpress_merge_empty_feed_settings($FeedCustom, $FeedSettingsBasic);
1869
-
1870
- $powerpress_feed = array();
1871
- if( !empty($GeneralSettings['feed_accel']) )
1872
- $powerpress_feed['feed_accel'] = true;
1873
- $powerpress_feed['is_custom'] = true;
1874
- $powerpress_feed['term_taxonomy_id'] = $term['term_taxonomy_id'];
1875
- $powerpress_feed['process_podpress'] = false; // Taxonomy feeds will not originate from Podpress
1876
- $powerpress_feed['rss_language'] = ''; // default, let WordPress set the language
1877
- $powerpress_feed['default_url'] = rtrim($GeneralSettings['default_url'], '/') .'/';
1878
- $explicit_array = array("no", "yes", "clean");
1879
- $powerpress_feed['explicit'] = $explicit_array[$Feed['itunes_explicit']];
1880
- if( !empty($Feed['itunes_talent_name']) )
1881
- $powerpress_feed['itunes_talent_name'] = $Feed['itunes_talent_name'];
1882
- else
1883
- $powerpress_feed['itunes_talent_name'] = get_wp_title_rss();
1884
- $powerpress_feed['enhance_itunes_summary'] = $Feed['enhance_itunes_summary'];
1885
- if( !empty($GeneralSettings['seo_itunes']) )
1886
- $powerpress_feed['enhance_itunes_summary'] = 1;
1887
- $powerpress_feed['posts_per_rss'] = false;
1888
- if( !empty($Feed['posts_per_rss']) && is_numeric($Feed['posts_per_rss']) && $Feed['posts_per_rss'] > 0 )
1889
- $powerpress_feed['posts_per_rss'] = $Feed['posts_per_rss'];
1890
- if( $Feed['feed_redirect_url'] != '' )
1891
- $powerpress_feed['feed_redirect_url'] = $Feed['feed_redirect_url'];
1892
- if( $Feed['itunes_author_post'] == true )
1893
- $powerpress_feed['itunes_author_post'] = true;
1894
- if( $Feed['rss_language'] != '' )
1895
- $powerpress_feed['rss_language'] = $Feed['rss_language'];
1896
-
1897
- if( !empty($GeneralSettings['podcast_embed_in_feed']) )
1898
- $powerpress_feed['podcast_embed_in_feed'] = true;
1899
- if( !empty($Feed['maximize_feed']) )
1900
- $powerpress_feed['maximize_feed'] = true;
1901
- if( !empty($Feed['episode_itunes_image']) && !empty($Feed['itunes_image']) )
1902
- $powerpress_feed['itunes_image'] = $Feed['itunes_image'];
1903
- return;
1904
- }
1905
- }
1906
- }
1907
-
1908
- $feed_slug = get_query_var('feed');
1909
- // Are we dealing with a custom podcast channel or a custom post type podcast feed...
1910
- if( !empty($GeneralSettings['posttype_podcasting']) || isset($GeneralSettings['custom_feeds'][ $feed_slug ]) )
1911
- {
1912
- $Feed = false;
1913
- if( !empty($GeneralSettings['posttype_podcasting']) )
1914
- {
1915
- $post_type = get_query_var('post_type');
1916
-
1917
- if( !empty($post_type) )
1918
- {
1919
- if ( is_array( $post_type ) ) {
1920
- $post_type = reset( $post_type ); // get first element in array
1921
- }
1922
-
1923
- // Get the settings for this podcast post type
1924
- $PostTypeSettingsArray = get_option('powerpress_posttype_'. $post_type);
1925
- if( !empty($PostTypeSettingsArray[ $feed_slug ]) )
1926
- {
1927
- $FeedCustom = $PostTypeSettingsArray[ $feed_slug ];
1928
- $Feed = powerpress_merge_empty_feed_settings($FeedCustom, $FeedSettingsBasic);
1929
- $Feed['post_type'] = $post_type;
1930
- }
1931
- }
1932
- }
1933
- if( empty($Feed) && isset($GeneralSettings['custom_feeds'][ $feed_slug ]) )
1934
- {
1935
- $FeedCustom = get_option('powerpress_feed_'.$feed_slug); // Get custom feed specific settings
1936
- $Feed = powerpress_merge_empty_feed_settings($FeedCustom, $FeedSettingsBasic, ($feed_slug == 'podcast') );
1937
- }
1938
-
1939
- if( $Feed )
1940
- {
1941
- $powerpress_feed = array();
1942
- if( !empty($GeneralSettings['feed_accel']) )
1943
- $powerpress_feed['feed_accel'] = true;
1944
- $powerpress_feed['is_custom'] = true;
1945
- $powerpress_feed['feed-slug'] = $feed_slug;
1946
- if( !empty($Feed['post_type']) )
1947
- $powerpress_feed['post_type'] = $Feed['post_type'];
1948
- $powerpress_feed['process_podpress'] = ($feed_slug=='podcast'? !empty($GeneralSettings['process_podpress']): false); // We don't touch podpress data for custom feeds
1949
- $powerpress_feed['rss_language'] = ''; // RSS language should be set by WordPress by default
1950
- $powerpress_feed['default_url'] = '';
1951
- if( !empty($powerpress_feed['default_url']) )
1952
- $powerpress_feed['default_url'] = rtrim($GeneralSettings['default_url'], '/') .'/';
1953
- $explicit = array("no", "yes", "clean");
1954
- $powerpress_feed['explicit'] ='no';
1955
- if( !empty($Feed['itunes_explicit']) )
1956
- $powerpress_feed['explicit'] = $explicit[ $Feed['itunes_explicit'] ];
1957
- if( !empty($Feed['itunes_talent_name']) )
1958
- $powerpress_feed['itunes_talent_name'] = $Feed['itunes_talent_name'];
1959
- else
1960
- $powerpress_feed['itunes_talent_name'] = get_wp_title_rss();
1961
- $powerpress_feed['enhance_itunes_summary'] = $Feed['enhance_itunes_summary'];
1962
- if( !empty($GeneralSettings['seo_itunes']) )
1963
- $powerpress_feed['enhance_itunes_summary'] = 1;
1964
- $powerpress_feed['posts_per_rss'] = false;
1965
- if( !empty($Feed['posts_per_rss']) && is_numeric($Feed['posts_per_rss']) && $Feed['posts_per_rss'] > 0 )
1966
- $powerpress_feed['posts_per_rss'] = $Feed['posts_per_rss'];
1967
- if( !empty($Feed['feed_redirect_url']) )
1968
- $powerpress_feed['feed_redirect_url'] = $Feed['feed_redirect_url'];
1969
- if( !empty($Feed['itunes_author_post'] ) )
1970
- $powerpress_feed['itunes_author_post'] = true;
1971
- if( !empty($Feed['rss_language']) )
1972
- $powerpress_feed['rss_language'] = $Feed['rss_language'];
1973
- if( !empty($GeneralSettings['podcast_embed_in_feed']) )
1974
- $powerpress_feed['podcast_embed_in_feed'] = true;
1975
- if( !empty($Feed['maximize_feed']) )
1976
- $powerpress_feed['maximize_feed'] = true;
1977
- if( !empty($Feed['episode_itunes_image']) && !empty($Feed['itunes_image']) )
1978
- $powerpress_feed['itunes_image'] = $Feed['itunes_image'];
1979
- return;
1980
- }
1981
- }
1982
-
1983
- if( !isset($FeedSettingsBasic['apply_to']) )
1984
- $FeedSettingsBasic['apply_to'] = 1;
1985
-
1986
- // We fell this far,we must be in simple mode or the user never saved customized their custom feed settings
1987
- switch( $FeedSettingsBasic['apply_to'] )
1988
- {
1989
- case 0: // enhance only the podcast feed added by PowerPress, with the logic above this code should never be reached but it is added for readability.
1990
- {
1991
- if( $feed_slug != 'podcast' )
1992
- break;
1993
- } // important: no break here!
1994
- case 2: // RSS2 Main feed and podcast feed added by PowerPress only
1995
- {
1996
- if( $feed_slug != 'feed' && $feed_slug != 'rss2' && $feed_slug != 'podcast' )
1997
- break; // We're only adding podcasts to the rss2 feed in this situation
1998
-
1999
- if( $wp_query->is_category ) // don't touch the category feeds...
2000
- break;
2001
-
2002
- if( $wp_query->is_tag ) // don't touch the tag feeds...
2003
- break;
2004
-
2005
- if( $wp_query->is_comment_feed ) // don't touch the comments feeds...
2006
- break;
2007
- } // important: no break here!
2008
- case 1: // All feeds
2009
- {
2010
- $powerpress_feed = array(); // Only store what's needed for each feed item
2011
- if( !empty($GeneralSettings['feed_accel']) )
2012
- $powerpress_feed['feed_accel'] = true;
2013
- $powerpress_feed['is_custom'] = false; // ($feed_slug == 'podcast'?true:false);
2014
- $powerpress_feed['feed-slug'] = $feed_slug;
2015
- $powerpress_feed['process_podpress'] = !empty($GeneralSettings['process_podpress']); // We don't touch podpress data for custom feeds
2016
- $powerpress_feed['default_url'] = '';
2017
- if( !empty($GeneralSettings['default_url']) )
2018
- $powerpress_feed['default_url'] = rtrim($GeneralSettings['default_url'], '/') .'/';
2019
- $explicit = array("no", "yes", "clean");
2020
- $powerpress_feed['explicit'] = 'no';
2021
- if( !empty($FeedSettingsBasic['itunes_explicit']) )
2022
- $powerpress_feed['explicit'] = $explicit[$FeedSettingsBasic['itunes_explicit']];
2023
- if( !empty($FeedSettingsBasic['itunes_talent_name']) )
2024
- $powerpress_feed['itunes_talent_name'] = $FeedSettingsBasic['itunes_talent_name'];
2025
- else
2026
- $powerpress_feed['itunes_talent_name'] = get_wp_title_rss();
2027
- $powerpress_feed['enhance_itunes_summary'] = 0;
2028
- if( isset($FeedSettingsBasic['enhance_itunes_summary']) )
2029
- $powerpress_feed['enhance_itunes_summary'] = $FeedSettingsBasic['enhance_itunes_summary'];
2030
- if( !empty($GeneralSettings['seo_itunes']) )
2031
- $powerpress_feed['enhance_itunes_summary'] = 1;
2032
- $powerpress_feed['posts_per_rss'] = false;
2033
- if( !empty($FeedSettingsBasic['posts_per_rss']) && is_numeric($FeedSettingsBasic['posts_per_rss']) && $FeedSettingsBasic['posts_per_rss'] > 0 )
2034
- $powerpress_feed['posts_per_rss'] = $FeedSettingsBasic['posts_per_rss'];
2035
- if( !empty($FeedSettingsBasic['itunes_author_post']) )
2036
- $powerpress_feed['itunes_author_post'] = true;
2037
- $powerpress_feed['rss_language'] = ''; // Cannot set the language setting in simple mode
2038
- if( !empty($GeneralSettings['podcast_embed_in_feed']) )
2039
- $powerpress_feed['podcast_embed_in_feed'] = true;
2040
- if( !empty($FeedSettingsBasic['episode_itunes_image']) && !empty($FeedSettingsBasic['itunes_image']) )
2041
- $powerpress_feed['itunes_image'] = $FeedSettingsBasic['itunes_image'];
2042
-
2043
- }; break;
2044
- // All other cases we let fall through
2045
- }
2046
- }
2047
- }
2048
- }
2049
-
2050
- // Returns true of the feed should be treated as a podcast feed
2051
- function powerpress_is_podcast_feed()
2052
- {
2053
- if( defined('PODPRESS_VERSION') || isset($GLOBALS['podcasting_player_id']) || isset($GLOBALS['podcast_channel_active']) || defined('PODCASTING_VERSION') )
2054
- return false; // Another podcasting plugin is enabled...
2055
-
2056
- global $powerpress_feed;
2057
- if( $powerpress_feed !== false && !is_array($powerpress_feed) )
2058
- powerpress_load_general_feed_settings();
2059
- if( $powerpress_feed === false )
2060
- return false;
2061
- return true;
2062
- }
2063
-
2064
- // Returns true if the feed is a custom feed added by PowerPress
2065
- function powerpress_is_custom_podcast_feed()
2066
- {
2067
- if( defined('PODPRESS_VERSION') || isset($GLOBALS['podcasting_player_id']) || isset($GLOBALS['podcast_channel_active']) || defined('PODCASTING_VERSION') )
2068
- return false; // Another podcasting plugin is enabled...
2069
-
2070
- global $powerpress_feed;
2071
- if( $powerpress_feed !== false && !is_array($powerpress_feed) )
2072
- powerpress_load_general_feed_settings();
2073
- if( $powerpress_feed === false )
2074
- return false;
2075
- return $powerpress_feed['is_custom'];
2076
- }
2077
-
2078
- function powerpress_posts_fields($cols)
2079
- {
2080
- if( !is_feed() )
2081
- return $cols;
2082
-
2083
- if( is_category() || is_tag() || is_tax() ) {
2084
- if( get_query_var('feed') !== 'podcast' )
2085
- return $cols;
2086
- }
2087
-
2088
- if( powerpress_is_custom_podcast_feed() || get_query_var('feed') === 'podcast' )
2089
- {
2090
- if( !empty($GLOBALS['powerpress_feed']['feed_accel']) )
2091
- {
2092
- $feed_slug = get_query_var('feed');
2093
- global $wpdb;
2094
- $cols .= ", pp_{$wpdb->postmeta}.meta_value AS podcast_meta_value ";
2095
- }
2096
- }
2097
-
2098
- return $cols;
2099
- }
2100
- //$fields = apply_filters_ref_array( 'posts_fields', array( $fields, &$this ) );
2101
- add_filter('posts_fields', 'powerpress_posts_fields' );
2102
-
2103
- function powerpress_posts_join($join)
2104
- {
2105
- if( !is_feed() )
2106
- return $join;
2107
-
2108
- if( is_category() || is_tag() || is_tax() ) {
2109
- if( get_query_var('feed') !== 'podcast' )
2110
- return $join;
2111
- }
2112
-
2113
- if( powerpress_is_custom_podcast_feed() || get_query_var('feed') === 'podcast' )
2114
- {
2115
- global $wpdb;
2116
- $join .= " INNER JOIN {$wpdb->postmeta} AS pp_{$wpdb->postmeta} ";
2117
- $join .= " ON {$wpdb->posts}.ID = pp_{$wpdb->postmeta}.post_id ";
2118
- }
2119
-
2120
- return $join;
2121
- }
2122
-
2123
- add_filter('posts_join', 'powerpress_posts_join' );
2124
-
2125
- function powerpress_posts_where($where)
2126
- {
2127
- if( !is_feed() )
2128
- return $where;
2129
- if( is_category() || is_tag() || is_tax() ) {
2130
- if( get_query_var('feed') !== 'podcast' )
2131
- return $where;
2132
- }
2133
-
2134
- if( powerpress_is_custom_podcast_feed() || get_query_var('feed') === 'podcast' )
2135
- {
2136
- global $wpdb, $powerpress_feed;
2137
- $where .= " AND (";
2138
-
2139
- if( powerpress_is_custom_podcast_feed() && get_query_var('feed') !== 'podcast' )
2140
- $where .= " pp_{$wpdb->postmeta}.meta_key = '_". get_query_var('feed') .":enclosure' ";
2141
- else
2142
- $where .= " pp_{$wpdb->postmeta}.meta_key = 'enclosure' ";
2143
-
2144
- // Include Podpress data if exists...
2145
- if( !empty($powerpress_feed['process_podpress']) && get_query_var('feed') === 'podcast' )
2146
- $where .= " OR pp_{$wpdb->postmeta}.meta_key = 'podPressMedia' OR pp_{$wpdb->postmeta}.meta_key = '_podPressMedia' ";
2147
-
2148
- $where .= ") ";
2149
- }
2150
- return $where;
2151
- }
2152
-
2153
- add_filter('posts_where', 'powerpress_posts_where' );
2154
-
2155
- // Add the groupby needed for enclosures only
2156
- function powerpress_posts_groupby($groupby)
2157
- {
2158
- if( !is_feed() )
2159
- return $groupby;
2160
-
2161
- if( is_category() || is_tag() || is_tax() ) {
2162
- if( get_query_var('feed') !== 'podcast' )
2163
- return $groupby;
2164
- }
2165
-
2166
- if( powerpress_is_custom_podcast_feed() || get_query_var('feed') === 'podcast' )
2167
- {
2168
- global $wpdb;
2169
- $groupby = " {$wpdb->posts}.ID ";
2170
- }
2171
- return $groupby;
2172
- }
2173
- add_filter('posts_groupby', 'powerpress_posts_groupby');
2174
-
2175
- function powerpress_post_limits($limits)
2176
- {
2177
- if( !is_feed() )
2178
- return $limits;
2179
-
2180
- if( powerpress_is_custom_podcast_feed() || get_query_var('feed') === 'podcast' )
2181
- {
2182
- global $powerpress_feed;
2183
- if( !empty($powerpress_feed['posts_per_rss']) && preg_match('/^(\d)+$/', trim($powerpress_feed['posts_per_rss'])) )
2184
- $limits = "LIMIT 0, {$powerpress_feed['posts_per_rss']}";
2185
- }
2186
- return $limits;
2187
- }
2188
- add_filter('post_limits', 'powerpress_post_limits');
2189
-
2190
-
2191
- function powerpress_do_all_pings()
2192
- {
2193
- global $wpdb;
2194
- $wpdb->query("DELETE FROM {$wpdb->postmeta} WHERE meta_key = '_encloseme' ");
2195
-
2196
- // Now call the WordPress do_all_pings()...
2197
- do_all_pings();
2198
- remove_action('do_pings', 'do_all_pings');
2199
- }
2200
-
2201
- remove_action('do_pings', 'do_all_pings');
2202
- add_action('do_pings', 'powerpress_do_all_pings', 1, 1);
2203
-
2204
- /*
2205
- Helper functions:
2206
- */
2207
- function powerpress_podpress_redirect_check()
2208
- {
2209
- if( preg_match('/podpress_trac\/([^\/]+)\/([^\/]+)\/([^\/]+)\/(.*)$/', $_SERVER['REQUEST_URI'], $matches) )
2210
- {
2211
- $post_id = $matches[2];
2212
- $mediaNum = $matches[3];
2213
- //$filename = $matches[4];
2214
- //$method = $matches[1];
2215
-
2216
- if( is_numeric($post_id) && is_numeric($mediaNum))
2217
- {
2218
- $EpisodeData = powerpress_get_enclosure_data_podpress($post_id, $mediaNum);
2219
- if( $EpisodeData && isset($EpisodeData['url']) )
2220
- {
2221
- if( strpos($EpisodeData['url'], 'http://' ) !== 0 && strpos($EpisodeData['url'], 'https://' ) !== 0 )
2222
- {
2223
- die('Error occurred obtaining the URL for the requested media file.');
2224
- exit;
2225
- }
2226
-
2227
- $EnclosureURL = str_replace(' ', '%20', $EpisodeData['url']);
2228
- header('Location: '.$EnclosureURL, true, 302);
2229
- header('Content-Length: 0');
2230
- exit;
2231
- }
2232
- // Let the WordPress 404 page load as normal
2233
- }
2234
- }
2235
- }
2236
-
2237
- function the_powerpress_content()
2238
- {
2239
- echo get_the_powerpress_content();
2240
- }
2241
-
2242
- function get_the_powerpress_content()
2243
- {
2244
- global $post;
2245
-
2246
- if( defined('PODPRESS_VERSION') || isset($GLOBALS['podcasting_player_id']) || isset($GLOBALS['podcast_channel_active']) || defined('PODCASTING_VERSION') )
2247
- return '';
2248
-
2249
- if( function_exists('post_password_required') )
2250
- {
2251
- if( post_password_required($post) )
2252
- return '';
2253
- }
2254
-
2255
- // PowerPress settings:
2256
- $GeneralSettings = get_option('powerpress_general');
2257
-
2258
- // No player or links to add to content...
2259
- if( !empty($GeneralSettings['disable_appearance']) )
2260
- return $content;
2261
-
2262
- if( !isset($GeneralSettings['custom_feeds']) )
2263
- $GeneralSettings['custom_feeds'] = array('podcast'=>'Default Podcast Feed');
2264
-
2265
- // Re-order so the default podcast episode is the top most...
2266
- $Temp = $GeneralSettings['custom_feeds'];
2267
- $GeneralSettings['custom_feeds'] = array();
2268
- $GeneralSettings['custom_feeds']['podcast'] = 'Default Podcast Feed';
2269
-
2270
- foreach( $Temp as $feed_slug=> $feed_title )
2271
- {
2272
- if( $feed_slug == 'podcast' )
2273
- continue;
2274
- $GeneralSettings['custom_feeds'][ $feed_slug ] = $feed_title;
2275
- }
2276
-
2277
- // Handle post type feeds....
2278
- if( !empty($GeneralSettings['posttype_podcasting']) )
2279
- {
2280
- $post_type = get_query_var('post_type');
2281
- if ( is_array( $post_type ) ) {
2282
- $post_type = reset( $post_type ); // get first element in array
2283
- }
2284
-
2285
- // Get the feed slugs and titles for this post type
2286
- $PostTypeSettingsArray = get_option('powerpress_posttype_'.$post_type);
2287
- // Loop through this array of post type settings...
2288
- if( !empty($PostTypeSettingsArray) )
2289
- {
2290
- switch($post_type)
2291
- {
2292
- case 'post':
2293
- case 'page': {
2294
- // Do nothing!, we want the default podcast to appear in these post types
2295
- }; break;
2296
- default: {
2297
- if( !empty($post_type) && empty($PostTypeSettingsArray['podcast']) )
2298
- unset($GeneralSettings['custom_feeds']['podcast']); // special case, we do not want an accidental podcast episode to appear in a custom post type if the feature is enabled
2299
- }; break;
2300
- }
2301
-
2302
- foreach( $PostTypeSettingsArray as $feed_slug=> $postTypeSettings )
2303
- {
2304
- if( !empty( $postTypeSettings['title']) )
2305
- $GeneralSettings['custom_feeds'][ $feed_slug ] = $postTypeSettings['title'];
2306
- else
2307
- $GeneralSettings['custom_feeds'][ $feed_slug ] = $feed_slug;
2308
- }
2309
- }
2310
- }
2311
-
2312
- if( !isset($GeneralSettings['display_player']) )
2313
- $GeneralSettings['display_player'] = 1;
2314
- if( !isset($GeneralSettings['player_function']) )
2315
- $GeneralSettings['player_function'] = 1;
2316
- if( !isset($GeneralSettings['podcast_link']) )
2317
- $GeneralSettings['podcast_link'] = 1;
2318
-
2319
- // Figure out which players are alerady in the body of the page...
2320
- $ExcludePlayers = array();
2321
- if( isset($GeneralSettings['disable_player']) )
2322
- $ExcludePlayers = $GeneralSettings['disable_player']; // automatically disable the players configured
2323
-
2324
- // LOOP HERE TO DISPLAY EACH MEDIA TYPE
2325
- $new_content = '';
2326
- foreach( $GeneralSettings['custom_feeds'] as $feed_slug=> $feed_title )
2327
- {
2328
- // Get the enclosure data
2329
- $EpisodeData = powerpress_get_enclosure_data($post->ID, $feed_slug);
2330
-
2331
- if( !$EpisodeData && !empty($GeneralSettings['process_podpress']) && $feed_slug == 'podcast' )
2332
- $EpisodeData = powerpress_get_enclosure_data_podpress($post->ID);
2333
-
2334
- if( !$EpisodeData || !$EpisodeData['url'] )
2335
- continue;
2336
-
2337
- // Just in case, if there's no URL lets escape!
2338
- if( !$EpisodeData['url'] )
2339
- continue;
2340
-
2341
- // If the player is not already inserted in the body of the post using the shortcode...
2342
- //if( preg_match('/\[powerpress(.*)\]/is', $content) == 0 )
2343
- if( !isset($ExcludePlayers[ $feed_slug ]) ) // If the player is not in our exclude list because it's already in the post body somewhere...
2344
- {
2345
- if( isset($GeneralSettings['premium_caps']) && $GeneralSettings['premium_caps'] && !powerpress_premium_content_authorized($feed_slug) )
2346
- {
2347
- $new_content .= powerpress_premium_content_message($post->ID, $feed_slug, $EpisodeData);
2348
- }
2349
- else
2350
- {
2351
- if( $GeneralSettings['player_function'] != 3 && $GeneralSettings['player_function'] != 0 ) // Play in new window only or disabled
2352
- {
2353
- do_action('wp_powerpress_player_scripts');
2354
- $AddDefaultPlayer = empty($EpisodeData['no_player']);
2355
-
2356
- if( $EpisodeData && !empty($EpisodeData['embed']) )
2357
- {
2358
- $new_content .= trim($EpisodeData['embed']);
2359
- if( !empty($GeneralSettings['embed_replace_player']) )
2360
- $AddDefaultPlayer = false;
2361
- }
2362
-
2363
- if( $AddDefaultPlayer )
2364
- {
2365
- $image = '';
2366
- $width = '';
2367
- $height = '';
2368
- if( isset($EpisodeData['image']) && $EpisodeData['image'] != '' )
2369
- $image = $EpisodeData['image'];
2370
- if( !empty($EpisodeData['width']) && is_numeric($EpisodeData['width']) )
2371
- $width = $EpisodeData['width'];
2372
- if( !empty($EpisodeData['height']) && is_numeric($EpisodeData['height']) )
2373
- $height = $EpisodeData['height'];
2374
-
2375
- $new_content .= apply_filters('powerpress_player', '', powerpress_add_flag_to_redirect_url($EpisodeData['url'], 'p'), $EpisodeData );
2376
- }
2377
- }
2378
-
2379
- if( !isset($EpisodeData['no_links']) )
2380
- {
2381
- do_action('wp_powerpress_player_scripts');
2382
- $new_content .= apply_filters('powerpress_player_links', '', powerpress_add_flag_to_redirect_url($EpisodeData['url'], 'p'), $EpisodeData );
2383
- $new_content .= apply_filters('powerpress_player_subscribe_links', '', powerpress_add_flag_to_redirect_url($EpisodeData['url'], 'p'), $EpisodeData );
2384
- }
2385
- }
2386
- }
2387
- }
2388
-
2389
- return $new_content;
2390
- }
2391
-
2392
-
2393
-
2394
- // Adds content types that are missing from the default wp_check_filetype function
2395
- function powerpress_get_contenttype($file, $use_wp_check_filetype = true)
2396
- {
2397
- $parts = pathinfo($file);
2398
- if( !empty($parts['extension']) )
2399
- {
2400
- switch( strtolower($parts['extension']) )
2401
- {
2402
- // Audio formats
2403
- case 'mp3': // most common
2404
- case 'mpga':
2405
- case 'mp2':
2406
- case 'mp2a':
2407
- case 'm2a':
2408
- case 'm3a':
2409
- return 'audio/mpeg';
2410
- case 'm4a':
2411
- return 'audio/x-m4a';
2412
- case 'm4b': // Audio book format
2413
- return 'audio/m4b';
2414
- case 'm4r': // iPhone ringtone format
2415
- return 'audio/m4r';
2416
- // OGG Internet content types as set forth by rfc5334 (http://tools.ietf.org/html/rfc5334)
2417
- case 'opus':
2418
- case 'oga':
2419
- case 'spx':
2420
- return 'audio/ogg';
2421
- case 'wma':
2422
- return 'audio/x-ms-wma';
2423
- case 'wax':
2424
- return 'audio/x-ms-wax';
2425
- case 'ra':
2426
- case 'ram':
2427
- return 'audio/x-pn-realaudio';
2428
- case 'mp4a':
2429
- return 'audio/mp4';
2430
-
2431
- // Video formats
2432
- case 'm4v':
2433
- return 'video/x-m4v';
2434
- case 'mpeg':
2435
- case 'mpg':
2436
- case 'mpe':
2437
- case 'm1v':
2438
- case 'm2v':
2439
- return 'video/mpeg';
2440
- case 'mp4':
2441
- case 'mp4v':
2442
- case 'mpg4':
2443
- return 'video/mp4';
2444
- case 'asf':
2445
- case 'asx':
2446
- return 'video/x-ms-asf';
2447
- case 'wmx':
2448
- return 'video/x-ms-wmx';
2449
- case 'avi':
2450
- return 'video/x-msvideo';
2451
- case 'wmv':
2452
- return 'video/x-ms-wmv'; // Check this
2453
- case 'flv':
2454
- return 'video/x-flv';
2455
- case 'mov':
2456
- case 'qt':
2457
- return 'video/quicktime';
2458
- case 'divx':
2459
- return 'video/divx';
2460
- case '3gp':
2461
- return 'video/3gpp';
2462
- case 'webm':
2463
- return 'video/webm';
2464
- case 'ogg': {
2465
- if( !defined('POWERPRESS_OGG_VIDEO') )
2466
- return 'audio/ogg';
2467
- } // Let this fall through as ogg/video
2468
- case 'ogv':
2469
- return 'video/ogg';
2470
-
2471
- // rarely used
2472
- case 'mid':
2473
- case 'midi':
2474
- return 'audio/midi';
2475
- case 'wav':
2476
- return 'audio/wav';
2477
- case 'aa':
2478
- return 'audio/audible';
2479
- case 'pdf':
2480
- return 'application/pdf';
2481
- case 'torrent':
2482
- return 'application/x-bittorrent';
2483
- case 'swf':
2484
- return 'application/x-shockwave-flash';
2485
- case 'ogx':
2486
- return 'application/ogg';
2487
-
2488
- // Most recently added by Apple:
2489
- case 'epub':
2490
- return 'document/x-epub';
2491
-
2492
- default: // Let it fall through
2493
- }
2494
- }
2495
-
2496
- // Last case let wordpress detect it:
2497
- if( $use_wp_check_filetype )
2498
- {
2499
- $FileType = wp_check_filetype($file);
2500
- if( $FileType && isset($FileType['type']) )
2501
- return $FileType['type'];
2502
- }
2503
- return '';
2504
- }
2505
-
2506
-
2507
- function powerpress_itunes_categories($PrefixSubCategories = false)
2508
- {
2509
- $temp = array();
2510
- $temp['01-00'] = 'Arts';
2511
- $temp['01-01'] = 'Design';
2512
- $temp['01-02'] = 'Fashion & Beauty';
2513
- $temp['01-03'] = 'Food';
2514
- $temp['01-04'] = 'Literature';
2515
- $temp['01-05'] = 'Performing Arts';
2516
- $temp['01-06'] = 'Visual Arts';
2517
-
2518
- $temp['02-00'] = 'Business';
2519
- $temp['02-01'] = 'Business News';
2520
- $temp['02-02'] = 'Careers';
2521
- $temp['02-03'] = 'Investing';
2522
- $temp['02-04'] = 'Management & Marketing';
2523
- $temp['02-05'] = 'Shopping';
2524
-
2525
- $temp['03-00'] = 'Comedy';
2526
-
2527
- $temp['04-00'] = 'Education';
2528
- $temp['04-01'] = 'Education Technology';
2529
- $temp['04-02'] = 'Higher Education';
2530
- $temp['04-03'] = 'K-12';
2531
- $temp['04-04'] = 'Language Courses';
2532
- $temp['04-05'] = 'Training';
2533
-
2534
- $temp['05-00'] = 'Games & Hobbies';
2535
- $temp['05-01'] = 'Automotive';
2536
- $temp['05-02'] = 'Aviation';
2537
- $temp['05-03'] = 'Hobbies';
2538
- $temp['05-04'] = 'Other Games';
2539
- $temp['05-05'] = 'Video Games';
2540
-
2541
- $temp['06-00'] = 'Government & Organizations';
2542
- $temp['06-01'] = 'Local';
2543
- $temp['06-02'] = 'National';
2544
- $temp['06-03'] = 'Non-Profit';
2545
- $temp['06-04'] = 'Regional';
2546
-
2547
- $temp['07-00'] = 'Health';
2548
- $temp['07-01'] = 'Alternative Health';
2549
- $temp['07-02'] = 'Fitness & Nutrition';
2550
- $temp['07-03'] = 'Self-Help';
2551
- $temp['07-04'] = 'Sexuality';
2552
-
2553
- $temp['08-00'] = 'Kids & Family';
2554
-
2555
- $temp['09-00'] = 'Music';
2556
-
2557
- $temp['10-00'] = 'News & Politics';
2558
-
2559
- $temp['11-00'] = 'Religion & Spirituality';
2560
- $temp['11-01'] = 'Buddhism';
2561
- $temp['11-02'] = 'Christianity';
2562
- $temp['11-03'] = 'Hinduism';
2563
- $temp['11-04'] = 'Islam';
2564
- $temp['11-05'] = 'Judaism';
2565
- $temp['11-06'] = 'Other';
2566
- $temp['11-07'] = 'Spirituality';
2567
-
2568
- $temp['12-00'] = 'Science & Medicine';
2569
- $temp['12-01'] = 'Medicine';
2570
- $temp['12-02'] = 'Natural Sciences';
2571
- $temp['12-03'] = 'Social Sciences';
2572
-
2573
- $temp['13-00'] = 'Society & Culture';
2574
- $temp['13-01'] = 'History';
2575
- $temp['13-02'] = 'Personal Journals';
2576
- $temp['13-03'] = 'Philosophy';
2577
- $temp['13-04'] = 'Places & Travel';
2578
-
2579
- $temp['14-00'] = 'Sports & Recreation';
2580
- $temp['14-01'] = 'Amateur';
2581
- $temp['14-02'] = 'College & High School';
2582
- $temp['14-03'] = 'Outdoor';
2583
- $temp['14-04'] = 'Professional';
2584
-
2585
- $temp['15-00'] = 'Technology';
2586
- $temp['15-01'] = 'Gadgets';
2587
- $temp['15-02'] = 'Tech News';
2588
- $temp['15-03'] = 'Podcasting';
2589
- $temp['15-04'] = 'Software How-To';
2590
-
2591
- $temp['16-00'] = 'TV & Film';
2592
-
2593
- if( $PrefixSubCategories )
2594
- {
2595
- foreach( $temp as $key=> $val )
2596
- {
2597
- $parts = explode('-', $key);
2598
- $cat = $parts[0];
2599
- $subcat = $parts[1];
2600
-
2601
- if( $subcat != '00' )
2602
- $temp[$key] = $temp[$cat.'-00'].' > '.$val;
2603
- }
2604
- reset($temp);
2605
- }
2606
-
2607
- return $temp;
2608
- }
2609
-
2610
- /**
2611
- * Categories for 2019+ Apple Podcast directory
2612
- */
2613
- function powerpress_apple_categories($PrefixSubCategories = false) {
2614
- $temp = array();
2615
- $temp['01-00'] = 'Arts';
2616
- $temp['01-01'] = 'Books';
2617
- $temp['01-02'] = 'Design';
2618
- $temp['01-03'] = 'Fashion & Beauty';
2619
- $temp['01-04'] = 'Food';
2620
- $temp['01-05'] = 'Performing Arts';
2621
- $temp['01-06'] = 'Visual Arts';
2622
-
2623
- $temp['02-00'] = 'Business';
2624
- $temp['02-01'] = 'Careers';
2625
- $temp['02-02'] = 'Entrepreneurship';
2626
- $temp['02-03'] = 'Investing';
2627
- $temp['02-04'] = 'Management';
2628
- $temp['02-05'] = 'Marketing';
2629
- $temp['02-06'] = 'Non-profit';
2630
-
2631
- $temp['03-00'] = 'Comedy';
2632
- $temp['03-01'] = 'Comedy Interviews';
2633
- $temp['03-02'] = 'Improv';
2634
- $temp['03-03'] = 'Stand-Up';
2635
-
2636
- $temp['04-00'] = 'Education';
2637
- $temp['04-01'] = 'Courses';
2638
- $temp['04-02'] = 'How To';
2639
- $temp['04-03'] = 'Language Learning';
2640
- $temp['04-04'] = 'Self-Improvement';
2641
-
2642
- $temp['05-00'] = 'Fiction';
2643
- $temp['05-01'] = 'Comedy Fiction';
2644
- $temp['05-02'] = 'Drama';
2645
- $temp['05-03'] = 'Science Fiction';
2646
-
2647
- $temp['06-00'] = 'Government';
2648
-
2649
- $temp['07-00'] = 'Health & Fitness';
2650
- $temp['07-01'] = 'Alternative Health';
2651
- $temp['07-02'] = 'Fitness';
2652
- $temp['07-03'] = 'Medicine';
2653
- $temp['07-04'] = 'Mental Health';
2654
- $temp['07-05'] = 'Nutrition';
2655
- $temp['07-06'] = 'Sexuality';
2656
-
2657
- $temp['08-00'] = 'History';
2658
-
2659
- $temp['09-00'] = 'Kids & Family';
2660
- $temp['09-01'] = 'Education for Kids';
2661
- $temp['09-02'] = 'Parenting';
2662
- $temp['09-03'] = 'Pets & Animals';
2663
- $temp['09-04'] = 'Stories for Kids';
2664
-
2665
- $temp['10-00'] = 'Leisure';
2666
- $temp['10-01'] = 'Animation & Manga';
2667
- $temp['10-02'] = 'Automotive';
2668
- $temp['10-03'] = 'Aviation';
2669
- $temp['10-04'] = 'Crafts';
2670
- $temp['10-05'] = 'Games';
2671
- $temp['10-06'] = 'Hobbies';
2672
- $temp['10-07'] = 'Home & Garden';
2673
- $temp['10-08'] = 'Video Games';
2674
-
2675
- $temp['11-00'] = 'Music';
2676
- $temp['11-01'] = 'Music Commentary';
2677
- $temp['11-02'] = 'Music History';
2678
- $temp['11-03'] = 'Music Interviews';
2679
-
2680
- $temp['12-00'] = 'News';
2681
- $temp['12-01'] = 'Business News';
2682
- $temp['12-02'] = 'Daily News';
2683
- $temp['12-03'] = 'Entertainment News';
2684
- $temp['12-04'] = 'News Commentary';
2685
- $temp['12-05'] = 'Politics';
2686
- $temp['12-06'] = 'Sports News';
2687
- $temp['12-07'] = 'Tech News';
2688
-
2689
- $temp['13-00'] = 'Religion & Spirituality';
2690
- $temp['13-01'] = 'Buddhism';
2691
- $temp['13-02'] = 'Christianity';
2692
- $temp['13-03'] = 'Hinduism';
2693
- $temp['13-04'] = 'Islam';
2694
- $temp['13-05'] = 'Judaism';
2695
- $temp['13-06'] = 'Religion';
2696
- $temp['13-07'] = 'Spirituality';
2697
-
2698
- $temp['14-00'] = 'Science';
2699
- $temp['14-01'] = 'Astronomy';
2700
- $temp['14-02'] = 'Chemistry';
2701
- $temp['14-03'] = 'Earth Sciences';
2702
- $temp['14-04'] = 'Life Sciences';
2703
- $temp['14-05'] = 'Mathematics';
2704
- $temp['14-06'] = 'Natural Sciences';
2705
- $temp['14-07'] = 'Nature';
2706
- $temp['14-08'] = 'Physics';
2707
- $temp['14-09'] = 'Social Sciences';
2708
-
2709
- $temp['15-00'] = 'Society & Culture';
2710
- $temp['15-01'] = 'Documentary';
2711
- $temp['15-02'] = 'Personal Journals';
2712
- $temp['15-03'] = 'Philosophy';
2713
- $temp['15-04'] = 'Places & Travel';
2714
- $temp['15-06'] = 'Relationships';
2715
-
2716
- $temp['16-00'] = 'Sports';
2717
- $temp['16-01'] = 'Baseball';
2718
- $temp['16-02'] = 'Basketball';
2719
- $temp['16-03'] = 'Cricket';
2720
- $temp['16-04'] = 'Fantasy Sports';
2721
- $temp['16-05'] = 'Football';
2722
- $temp['16-06'] = 'Golf';
2723
- $temp['16-07'] = 'Hockey';
2724
- $temp['16-08'] = 'Rugby';
2725
- $temp['16-09'] = 'Running';
2726
- $temp['16-10'] = 'Soccer';
2727
- $temp['16-11'] = 'Swimming';
2728
- $temp['16-12'] = 'Tennis';
2729
- $temp['16-13'] = 'Volleyball';
2730
- $temp['16-15'] = 'Wilderness';
2731
- $temp['16-16'] = 'Wrestling';
2732
-
2733
- $temp['17-00'] = 'Technology';
2734
-
2735
- $temp['18-00'] = 'True Crime';
2736
-
2737
- $temp['19-00'] = 'TV & Film';
2738
- $temp['19-01'] = 'After shows';
2739
- $temp['19-02'] = 'Film History';
2740
- $temp['19-03'] = 'Film Interviews';
2741
- $temp['19-04'] = 'Film Reviews';
2742
- $temp['19-05'] = 'TV Reviews';
2743
-
2744
- if( $PrefixSubCategories )
2745
- {
2746
- foreach( $temp as $key=> $val )
2747
- {
2748
- $parts = explode('-', $key);
2749
- $cat = $parts[0];
2750
- $subcat = $parts[1];
2751
-
2752
- if( $subcat != '00' )
2753
- $temp[$key] = $temp[$cat.'-00'].' > '.$val;
2754
- }
2755
- reset($temp);
2756
- }
2757
-
2758
- return $temp;
2759
- }
2760
-
2761
- function powerpress_googleplay_categories()
2762
- {
2763
- $temp = array();
2764
- $temp['01-00'] = 'Arts';
2765
- $temp['02-00'] = 'Business';
2766
- $temp['03-00'] = 'Comedy';
2767
- $temp['04-00'] = 'Education';
2768
- $temp['05-00'] = 'Games & Hobbies';
2769
- $temp['06-00'] = 'Government & Organizations';
2770
- $temp['07-00'] = 'Health';
2771
- $temp['08-00'] = 'Kids & Family';
2772
- $temp['09-00'] = 'Music';
2773
- $temp['10-00'] = 'News & Politics';
2774
- $temp['11-00'] = 'Religion & Spirituality';
2775
- $temp['12-00'] = 'Science & Medicine';
2776
- $temp['13-00'] = 'Society & Culture';
2777
- $temp['14-00'] = 'Sports & Recreation';
2778
- $temp['15-00'] = 'Technology';
2779
- $temp['16-00'] = 'TV & Film';
2780
-
2781
- return $temp;
2782
- }
2783
-
2784
- function powerpress_get_root_url()
2785
- {
2786
- /*
2787
- // OLD CODE:
2788
- $powerpress_dirname = basename( POWERPRESS_ABSPATH );
2789
- return WP_PLUGIN_URL . '/'. $powerpress_dirname .'/';
2790
- */
2791
- $local_path = __FILE__;
2792
- if( DIRECTORY_SEPARATOR == '\\' ) { // Win32 fix
2793
- $local_path = basename(dirname(__FILE__)) .'/'. basename(__FILE__);
2794
- }
2795
- $plugin_url = plugins_url('', $local_path);
2796
- return $plugin_url . '/';
2797
- }
2798
-
2799
- function powerpress_get_the_exerpt($for_summary = false, $no_filters = false, $post_id = false)
2800
- {
2801
- if( $no_filters ) {
2802
- if( $post_id > 0 ) {
2803
- $post = get_post($post_id);
2804
- $subtitle = $post->post_excerpt;
2805
- if ( $subtitle == '') {
2806
-
2807
- $subtitle = $post->post_content;
2808
- $shortcodesTemp = $GLOBALS['shortcode_tags'];
2809
- $GLOBALS['shortcode_tags']['skipto'] = 'powerpress_shortcode_skipto';
2810
- $subtitle = do_shortcode($subtitle);
2811
- $GLOBALS['shortcode_tags'] = $shortcodesTemp;
2812
-
2813
- $subtitle = strip_shortcodes( $subtitle );
2814
- $subtitle = str_replace(']]>', ']]&gt;', $subtitle);
2815
- $subtitle = strip_tags($subtitle);
2816
- }
2817
- }
2818
- else if( is_object($GLOBALS['post']) )
2819
- {
2820
- $subtitle = $GLOBALS['post']->post_excerpt;
2821
- if ( $subtitle == '') {
2822
-
2823
- $subtitle = $GLOBALS['post']->post_content;
2824
-
2825
- $shortcodesTemp = $GLOBALS['shortcode_tags'];
2826
- $GLOBALS['shortcode_tags']['skipto'] = 'powerpress_shortcode_skipto';
2827
- $subtitle = do_shortcode($subtitle);
2828
- $GLOBALS['shortcode_tags'] = $shortcodesTemp;
2829
-
2830
- $subtitle = strip_shortcodes( $subtitle );
2831
- $subtitle = str_replace(']]>', ']]&gt;', $subtitle);
2832
- $subtitle = strip_tags($subtitle);
2833
- }
2834
- }
2835
- } else {
2836
- $subtitle = get_the_excerpt();
2837
- }
2838
-
2839
- $subtitle = trim( strip_tags( $subtitle ) );
2840
- if( !empty($subtitle) )
2841
- return $subtitle;
2842
- return powerpress_get_the_content( $for_summary, $no_filters );
2843
- }
2844
-
2845
- function powerpress_get_the_content($for_summary = true, $no_filters = false, $no_strip_tags = false) {
2846
- if( $no_filters ) {
2847
- global $post;
2848
- $content_no_html = $post->post_content;
2849
-
2850
- $shortcodesTemp = $GLOBALS['shortcode_tags'];
2851
- $GLOBALS['shortcode_tags']['skipto'] = 'powerpress_shortcode_skipto';
2852
- $content_no_html = do_shortcode($content_no_html);
2853
- $GLOBALS['shortcode_tags'] = $shortcodesTemp;
2854
-
2855
- //$content_no_html = strip_shortcodes( $content_no_html );
2856
- $content_no_html = str_replace(']]>', ']]&gt;', $content_no_html);
2857
- $content_no_html = wp_staticize_emoji( _oembed_filter_feed_content( $content_no_html ) );
2858
- } else {
2859
- $content_no_html = get_the_content();
2860
- }
2861
-
2862
- $content_no_html = strip_shortcodes( $content_no_html );
2863
- if( $no_strip_tags )
2864
- return $content_no_html;
2865
-
2866
- if( $for_summary ) {
2867
- return trim( strip_tags($content_no_html, '<a><p><br><ul><li>') );
2868
- }
2869
- return trim( strip_tags($content_no_html) );
2870
- }
2871
-
2872
- function powerpress_enhanced_itunes_summary($no_filters = false)
2873
- {
2874
- if( $no_filters ) {
2875
- $summary = powerpress_get_the_content(false, true, true);
2876
- } else {
2877
- $summary = apply_filters( 'the_content', powerpress_get_the_content(false, $no_filters, true) );
2878
- }
2879
- $summary = str_replace("<li>", '<li>* ', $summary); // Make sure our bullet lists stay nicely formatted.
2880
- $summary = strip_tags($summary, '<a>'); // We can leave a tags for itunes:summary, this will also strip CDATA tags
2881
- return $summary;
2882
- }
2883
-
2884
- function powerpress_url_in_feed($url) {
2885
- if( defined('POWERPRESS_FEEDS_FORCE_HTTP') && is_feed() ) {
2886
- if( preg_match('/^https:\/\/(.*)$/', $url, $matches) ) {
2887
- return 'http://'.$matches[1];
2888
- }
2889
- }
2890
- else if( defined('POWERPRESS_FEEDS_FORCE_HTTPS') && is_feed() ) {
2891
- if( preg_match('/^http:\/\/(.*)$/', $url, $matches) ) {
2892
- return 'https://'.$matches[1];
2893
- }
2894
- }
2895
- return $url;
2896
- }
2897
-
2898
- function powerpress_format_itunes_value($value, $tag, $cdata=false)
2899
- {
2900
- if( $tag == 'summary' )
2901
- $value = nl2br($value); // Does not remove existing br tags if present.
2902
-
2903
- if( $cdata ) {
2904
- $value = str_replace(']]>', ']]&gt;', $value);
2905
- return powerpress_trim_itunes_value($value, $tag);
2906
- }
2907
-
2908
- if( !defined('POWERPRESS_DISABLE_ITUNES_UTF8') || POWERPRESS_DISABLE_ITUNES_UTF8 == false ) // If not defined or it is false
2909
- {
2910
- global $wpdb;
2911
- switch( $wpdb->charset )
2912
- {
2913
- case 'utf8': break;
2914
- case 'utf8mb3': break;
2915
- case 'utf8mb4': break;
2916
- default: {
2917
-
2918
- // preg_match fails when it encounters invalid UTF8 in $string
2919
- if ( 1 !== @preg_match( '/^./us', $value ) ) {
2920
- $value = utf8_encode($value); // If it is not, convert to UTF-8 then decode it...
2921
- }
2922
- }
2923
- }
2924
- }
2925
-
2926
- // Code added to solve issue with KimiliFlashEmbed plugin and also remove the shortcode for the WP Audio Player
2927
- // 99.9% of the time this code will not be necessary
2928
- $value = preg_replace("/\[(kml_(flash|swf)embed|audio\:)\b(.*?)(?:(\/))?(\]|$)/isu", '', $value);
2929
- $value = @html_entity_decode($value, ENT_COMPAT, 'UTF-8'); // Remove any additional entities such as &nbsp;
2930
- $value = preg_replace( '/&amp;/ui' , '&', $value); // Precaution in case it didn't get removed from function above.
2931
-
2932
- return esc_html( powerpress_trim_itunes_value($value, $tag) );
2933
- }
2934
-
2935
- function powerpress_trim_itunes_value($value, $tag = 'summary')
2936
- {
2937
- $value = trim($value); // First we need to trim the string
2938
- $length = (function_exists('mb_strlen')?mb_strlen($value):strlen($value) );
2939
- $trim_at = false;
2940
- $remove_new_lines = false;
2941
-
2942
- switch($tag)
2943
- {
2944
- case 'description':
2945
- case 'summary': {
2946
- // 4000 character limit
2947
- if( $length > 4000 )
2948
- $trim_at = 3997; // 3 less characters so we can add a dot dot dot
2949
- }; break;
2950
- case 'subtitle':
2951
- case 'author':
2952
- case 'name':
2953
- default: {
2954
- $remove_new_lines = true;
2955
- // 255 character limit
2956
- if( $length > 255 )
2957
- $trim_at = 252; // Allow 3 dots to be added after the trim
2958
- };
2959
- }
2960
-
2961
- if( $trim_at )
2962
- {
2963
- // Start trimming
2964
- $value = (function_exists('mb_substr')?mb_substr($value, 0, $trim_at):substr($value, 0, $trim_at) );
2965
- $clean_break = false;
2966
- if( preg_match('/(.*[,\n.\?!])[^,\n.\?!]/isu', $value, $matches) ) // pattern modifiers: case (i)nsensitive, entire (s)tring and (u)nicode
2967
- {
2968
- if( isset( $matches[1]) )
2969
- {
2970
- $detected_eof_pos = (function_exists('mb_strlen')?mb_strlen($matches[1]):strlen($matches[1]) );
2971
- // Look back at most 50 characters...
2972
- if( $detected_eof_pos > 3950 || ($detected_eof_pos > 205 && $detected_eof_pos < 255 ) )
2973
- {
2974
- $value = $matches[1];
2975
- $clean_break = true;
2976
- }
2977
- // Otherwise we want to continue with the same value we started with...
2978
- }
2979
- }
2980
-
2981
- if( $clean_break == false && $tag = 'subtitle' ) // Subtitle we want to add a ... at the end
2982
- {
2983
- if( $trim_at )
2984
- $value = (function_exists('mb_substr')?mb_substr($value, 0, $trim_at):substr($value, 0, $trim_at) ). '...';
2985
- }
2986
- }
2987
-
2988
- if( $remove_new_lines )
2989
- $value = str_replace( array("\r\n\r\n", "\n", "\r", "\t","- "), array(' - ',' ', '', ' ', ''), $value );
2990
-
2991
- return $value;
2992
- }
2993
-
2994
- function powerpress_add_redirect_url($MediaURL, $EpisodeData = false) // $channel = 'podcast')
2995
- {
2996
- if( preg_match('/^https?:\/\//i', $MediaURL) == 0 )
2997
- return $MediaURL; // If the user is hosting media not via http (e.g. ftp) then we can't handle the redirect
2998
-
2999
- if( !is_array($EpisodeData) )
3000
- {
3001
- $feed_slug = '';
3002
- if( is_string($EpisodeData) && !empty($EpisodeData) ) {
3003
- $feed_slug = $EpisodeData;
3004
- }
3005
-
3006
- $EpisodeData = array();
3007
- if( !empty($feed_slug) )
3008
- $EpisodeData['feed'] = $EpisodeData;
3009
- }
3010
-
3011
- if( empty($EpisodeData['feed']) )
3012
- $EpisodeData['feed'] = 'podcast';
3013
-
3014
- $NewURL = apply_filters( 'powerpress_redirect_url', $MediaURL, $EpisodeData );
3015
-
3016
- $URLScheme = ( (preg_match('/^https:\/\//i', $NewURL) != 0 ) ? 'https://':'http://');
3017
-
3018
- $GeneralSettings = get_option('powerpress_general');
3019
- $Redirects = array('redirect0'=>'', 'redirect1'=>'', 'redirect2'=>'', 'redirect3'=>'');
3020
- if( !empty($GeneralSettings['redirect1']) )
3021
- $Redirects['redirect1'] = $GeneralSettings['redirect1'];
3022
- if( !empty($GeneralSettings['redirect2']) )
3023
- $Redirects['redirect2'] = $GeneralSettings['redirect2'];
3024
- if( !empty($GeneralSettings['redirect3']) )
3025
- $Redirects['redirect3'] = $GeneralSettings['redirect3'];
3026
-
3027
- if( !empty($GeneralSettings['cat_casting']) ) { // If category podcasting...
3028
-
3029
- if( !empty($EpisodeData['category']) ) {
3030
-
3031
- $FeedCatSettings = get_option('powerpress_cat_feed_'.$EpisodeData['category'] );
3032
- if( !empty($FeedCatSettings['redirect']) ) {
3033
- $Redirects['redirect0'] = $FeedCatSettings['redirect'];
3034
- $Redirects['redirect1'] = '';
3035
- $Redirects['redirect2'] = '';
3036
- $Redirects['redirect3'] = '';
3037
- }
3038
- if( !empty($FeedCatSettings['redirect2']) ) {
3039
- $Redirects['redirect1'] = $FeedCatSettings['redirect2'];
3040
- }
3041
- } else { // Use the old way
3042
-
3043
- if( is_category() ) { // Special case where we want to track the category separately
3044
- $FeedCatSettings = get_option('powerpress_cat_feed_'.get_query_var('cat') );
3045
- if( $FeedCatSettings && !empty($FeedCatSettings['redirect']) ) {
3046
- $Redirects['redirect0'] = $FeedCatSettings['redirect'];
3047
- $Redirects['redirect1'] = '';
3048
- $Redirects['redirect2'] = '';
3049
- $Redirects['redirect3'] = '';
3050
- if( !empty($FeedCatSettings['redirect2']) ) {
3051
- $Redirects['redirect1'] = $FeedCatSettings['redirect2'];
3052
- }
3053
- }
3054
- } else if( is_single() ) {
3055
- $categories = wp_get_post_categories( get_the_ID() );
3056
- if( count($categories) == 1 ) { // See if only one category is associated with this post
3057
- foreach( $categories as $null=> $cat_id ) {
3058
- break;
3059
- }
3060
- $FeedCatSettings = get_option('powerpress_cat_feed_'.$cat_id );
3061
- if( $FeedCatSettings && !empty($FeedCatSettings['redirect']) ) {
3062
- $Redirects['redirect0'] = $FeedCatSettings['redirect'];
3063
- $Redirects['redirect1'] = '';
3064
- $Redirects['redirect2'] = '';
3065
- $Redirects['redirect3'] = '';
3066
- if( !empty($FeedCatSettings['redirect2']) ) {
3067
- $Redirects['redirect1'] = $FeedCatSettings['redirect2'];
3068
- }
3069
- }
3070
- }
3071
- }
3072
- }
3073
- }
3074
-
3075
- //custom_feeds
3076
- if( !empty($GeneralSettings['channels']) ) {
3077
-
3078
- $FeedSettings = get_option('powerpress_feed_'. $EpisodeData['feed']);
3079
- if( !empty($FeedSettings['redirect']) )
3080
- {
3081
- // Override the redirect
3082
- $Redirects['redirect0'] = $FeedSettings['redirect'];
3083
- $Redirects['redirect1'] = '';
3084
- $Redirects['redirect2'] = '';
3085
- $Redirects['redirect3'] = '';
3086
- }
3087
- if( !empty($FeedSettings['redirect2']) ) {
3088
- $Redirects['redirect1'] = $FeedSettings['redirect2'];
3089
- }
3090
- }
3091
-
3092
- if( !empty($GeneralSettings['posttype_podcasting']) ) // Post Type Podcasting
3093
- {
3094
- $post_type = get_post_type();
3095
- switch($post_type) {
3096
- case 'post':
3097
- case 'page': {
3098
- // Do nothing!, we want the default podcast and channels to appear in these post types
3099
- }; break;
3100
- default: {
3101
- $PostTypeSettingsArray = get_option('powerpress_posttype_'.$post_type);
3102
-
3103
- // We found a post type statsitics tracking
3104
- if( !empty($PostTypeSettingsArray[ $EpisodeData['feed'] ]['redirect']) )
3105
- {
3106
- $Redirects['redirect0'] = $PostTypeSettingsArray[ $EpisodeData['feed'] ]['redirect'];
3107
- $Redirects['redirect1'] = '';
3108
- $Redirects['redirect2'] = '';
3109
- $Redirects['redirect3'] = '';
3110
- }
3111
- if( !empty($PostTypeSettingsArray[ $EpisodeData['feed'] ]['redirect2']) ) {
3112
- $Redirects['redirect1'] = $PostTypeSettingsArray[ $EpisodeData['feed'] ]['redirect2'];
3113
- }
3114
- };
3115
- }
3116
- }
3117
-
3118
- if( version_compare($GLOBALS['wp_version'], 4.5, '>=' ) )
3119
- {
3120
- if( !empty($GeneralSettings['taxonomy_podcasting']) ) // Taxonomy Podcasting
3121
- {
3122
- $PowerPressTaxonomies = get_option('powerpress_taxonomy_podcasting');
3123
- if( !empty($PowerPressTaxonomies) )
3124
- {
3125
- $terms = get_terms();
3126
- $ttid_found = 0;
3127
- $TaxonomySettings = false;
3128
-
3129
- foreach( $terms as $index=> $termObj )
3130
- {
3131
- // Skip the default taxonomies
3132
- if( $termObj->taxonomy == 'category' || $termObj->taxonomy == 'link_category' || $termObj->taxonomy == 'post_tag' || $termObj->taxonomy == 'nav_menu' )
3133
- continue;
3134
-
3135
- if( !empty($PowerPressTaxonomies[ $termObj->term_taxonomy_id ]) )
3136
- {
3137
- $ttid_found = $termObj->term_taxonomy_id;
3138
-
3139
- $TaxonomySettings = get_option('powerpress_taxonomy_'.$ttid_found);
3140
- // Found it???
3141
- if( !empty($TaxonomySettings['redirect']) )
3142
- {
3143
- $Redirects['redirect0'] = $TaxonomySettings['redirect'];
3144
- $Redirects['redirect1'] = '';
3145
- $Redirects['redirect2'] = '';
3146
- $Redirects['redirect3'] = '';
3147
- break;
3148
- }
3149
- }
3150
- }
3151
- }
3152
- }
3153
- }
3154
-
3155
- // Allow other apps to update the redirects
3156
- $Redirects = apply_filters('powerpress_redirects', $Redirects, $EpisodeData);
3157
-
3158
- for( $x = 3; $x >= 0; $x-- )
3159
- {
3160
- $key = sprintf('redirect%d', $x);
3161
- if( !empty($Redirects[ $key ]) )
3162
- {
3163
- if( preg_match('/^https?:\/\/(.*)$/', trim($Redirects[ $key ]) , $matches ) == 0 )
3164
- continue;
3165
-
3166
- $RedirectClean = $matches[1];
3167
- if( substr($RedirectClean, -1, 1) != '/' ) // Rediercts need to end with a slash /.
3168
- $RedirectClean .= '/';
3169
-
3170
- if( !empty($RedirectClean) )
3171
- {
3172
- if( strpos($RedirectClean, '/') == 0 ) // Not a valid redirect URL
3173
- continue;
3174
-
3175
-
3176
- // Check that redirect is either media.blubrry.com, media.techpodcasts.com, media.rawvoice.com, or *.podtrac.com
3177
- $ValidRedirectDomains = array('media.blubrry.com', 'media.rawvoice.com', 'media.techpodcasts.com', 'www.podtrac.com', 'podtrac.com');
3178
- $ValidRedirectDomainsPattern = '/^(media\.blubrry\.com|media\.rawvoice\.com|media\.techpodcasts\.com|.*\.podtrac\.com|traffic\.cast\.plus)$/';
3179
- if( $URLScheme == 'https://' ) {
3180
- $ValidRedirectDomains = array('media.blubrry.com', 'media.rawvoice.com', 'www.podtrac.com', 'podtrac.com'); // Only URLs that support https:// to an https:// media file
3181
- $ValidRedirectDomainsPattern = '/^(media\.blubrry\.com|media\.rawvoice\.com|.*\.podtrac\.com|traffic\.cast\.plus)$/';
3182
- }
3183
-
3184
- $RedirectDomain = strtolower(substr($RedirectClean, 0, strpos($RedirectClean, '/') ));
3185
-
3186
- if( preg_match($ValidRedirectDomainsPattern, $RedirectDomain) == 0 )
3187
- continue;
3188
-
3189
- //if( !in_array($RedirectDomain, $ValidRedirectDomains) )
3190
- // continue; // Not a valid domain so lets not add it
3191
-
3192
- // Make sure we are no longer doubling up on media.blubrry.com or media.rawvoice.com redirects
3193
- //if( ($RedirectDomain == 'media.blubrry.com'||$RedirectDomain == 'media.rawvoice.com') && strstr($NewURL, '/'.$RedirectDomain.'/') )
3194
- //{
3195
- // // Strip the media.blubrry.com/XXX/x/ or media.blubrry.com/xxx/ from the URL since we will be replacing it
3196
- // if( preg_match('/^(.*\/)media\.(?:blubrry|rawvoice)\.com\/[a-zA-Z0-9_-]{2,60}\/([a-zA-Z0-9]\/)?(.*)$/', $NewURL, $matches) )
3197
- // {
3198
- // $NewURL = $matches[1].$matches[3];
3199
- // }
3200
- //}
3201
-
3202
- if( !strstr($NewURL, $RedirectClean) ) // If the redirect is not already added...
3203
- $NewURL = $URLScheme. $RedirectClean . str_replace($URLScheme, '', $NewURL);
3204
- }
3205
- }
3206
- }
3207
-
3208
- return $NewURL;
3209
- }
3210
-
3211
- function powerpress_add_flag_to_redirect_url($MediaURL, $Flag)
3212
- {
3213
- // First strip any previous flags...
3214
- $MediaURL = preg_replace('/(media\.(blubrry|techpodcasts|rawvoice|podcasternews)\.com\/[A-Za-z0-9-_]+\/)([A-Za-z0-9]\/)?/i', '$1'."", $MediaURL);
3215
- return preg_replace('/(media\.(blubrry|techpodcasts|rawvoice|podcasternews)\.com\/[A-Za-z0-9-_]+\/)('.$Flag.'\/)?/i', '$1'."$Flag/", $MediaURL);
3216
- }
3217
-
3218
- /*
3219
- Code contributed from upekshapriya on the Blubrry Forums
3220
- */
3221
- function powerpress_byte_size($ppbytes)
3222
- {
3223
- $ppbytes = intval($ppbytes);
3224
- if( empty($ppbytes) )
3225
- return '';
3226
- $ppsize = intval($ppbytes) / 1024;
3227
- if($ppsize < 1024)
3228
- {
3229
- $ppsize = number_format($ppsize, 1);
3230
- $ppsize .= 'KB';
3231
- }
3232
- else
3233
- {
3234
- if($ppsize / 1024 < 1024)
3235
- {
3236
- $ppsize = number_format($ppsize / 1024, 1);
3237
- $ppsize .= 'MB';
3238
- }
3239
- else if ($ppsize / 1024 / 1024 < 1024)
3240
- {
3241
- $ppsize = number_format($ppsize / 1024 / 1024, 1);
3242
- $ppsize .= 'GB';
3243
- }
3244
- }
3245
- return $ppsize;
3246
- }
3247
-
3248
- // Merges settings from feed settings page to empty custom feed settings
3249
- function powerpress_merge_empty_feed_settings($CustomFeedSettings, $FeedSettings, $DefaultPodcastFeed = false)
3250
- {
3251
- unset($FeedSettings['apply_to']);
3252
- // Remove settings from main $FeedSettings that should not be copied to custom feed.
3253
- if( !$DefaultPodcastFeed )
3254
- {
3255
- unset($FeedSettings['itunes_new_feed_url']);
3256
- unset($FeedSettings['feed_redirect_url']);
3257
- unset($FeedSettings['itunes_complete']);
3258
- unset($FeedSettings['itunes_block']);
3259
- unset($FeedSettings['maximize_feed']);
3260
- }
3261
-
3262
- // If the setting is not already set, set the enhnaced itunes setting if they have PHP5+ on by default
3263
- if( !isset($FeedSettings['enhance_itunes_summary']) )
3264
- $FeedSettings['enhance_itunes_summary'] = 0;
3265
-
3266
- if( !$CustomFeedSettings )
3267
- return $FeedSettings; // If the $CustomFeedSettings is false
3268
-
3269
- foreach( $CustomFeedSettings as $key=> $value )
3270
- {
3271
- if( $value !== '' || !isset($FeedSettings[$key]) )
3272
- $FeedSettings[$key] = $value;
3273
- }
3274
-
3275
- return $FeedSettings;
3276
- }
3277
-
3278
- function powerpress_readable_duration($duration, $include_hour=false)
3279
- {
3280
- $seconds = 0;
3281
- $parts = explode(':', $duration);
3282
- if( count($parts) == 3 )
3283
- $seconds = $parts[2] + ($parts[1]*60) + ($parts[0]*60*60);
3284
- else if ( count($parts) == 2 )
3285
- $seconds = $parts[1] + ($parts[0]*60);
3286
- else
3287
- $seconds = $parts[0];
3288
-
3289
- $hours = 0;
3290
- $minutes = 0;
3291
- if( $seconds >= (60*60) )
3292
- {
3293
- $hours = floor( $seconds /(60*60) );
3294
- $seconds -= (60*60*$hours);
3295
- }
3296
- if( $seconds >= (60) )
3297
- {
3298
- $minutes = floor( $seconds /(60) );
3299
- $seconds -= (60*$minutes);
3300
- }
3301
-
3302
- if( $hours || $include_hour ) // X:XX:XX (readable)
3303
- return sprintf('%d:%02d:%02d', $hours, $minutes, $seconds);
3304
-
3305
- return sprintf('%d:%02d', $minutes, $seconds); // X:XX or 0:XX (readable)
3306
- }
3307
-
3308
- // Duratoin in form of seconds (parses hh:mm:ss)
3309
- function powerpress_raw_duration($duration)
3310
- {
3311
- $duration = trim($duration);
3312
- $Parts = explode(':',$duration);
3313
- if( empty($Parts) )
3314
- return $duration;
3315
-
3316
- if( count($Parts) == 3 )
3317
- return (($Parts[0]*60*60) + ($Parts[1]*60) +$Parts[2]);
3318
- else if( count($Parts) == 2 )
3319
- return (($Parts[0]*60) +$Parts[1]);
3320
- //else if( count($Parts) == 1 )
3321
- // return ($Parts[0]);
3322
-
3323
- // We never found any colons, so we assume duration is seconds
3324
- return $duration;
3325
- }
3326
-
3327
- // For grabbing data from Podpress data stored serialized, the strings for some values can sometimes get corrupted, so we fix it...
3328
-
3329
- function powerpress_repair_serialize($string)
3330
- {
3331
- if( @unserialize($string) )
3332
- return $string; // Nothing to repair...
3333
-
3334
- $string = preg_replace_callback('/(s:(\d+):"([^"]*)")/',
3335
- 'powerpress_repair_serialize_callback',
3336
- $string);
3337
-
3338
- if( substr($string, 0, 2) == 's:' ) // Sometimes the serialized data is double serialized, so we need to re-serialize the outside string
3339
- {
3340
- $string = preg_replace_callback('/(s:(\d+):"(.*)"(;))$/',
3341
- 'powerpress_repair_serialize_callback',
3342
- $string);
3343
- }
3344
-
3345
- return $string;
3346
- }
3347
-
3348
- function powerpress_repair_serialize_callback($matches)
3349
- {
3350
- if( strlen($matches[3]) == $matches[2] )
3351
- return $matches[0];
3352
- return sprintf('s:%d:"%s"', strlen($matches[3]), $matches[3]) . (!empty($matches[4])?';':'');
3353
- }
3354
-
3355
- function powerpress_base64_encode($value)
3356
- {
3357
- return rtrim(strtr(base64_encode($value), '+/', '-_'), '=');
3358
- }
3359
- /*
3360
- powerpress_get_post_meta()
3361
- Safe function to retrieve corrupted PodPress data from the database
3362
- @post_id - post id to retrieve post meta for
3363
- @key - key to retrieve post meta for
3364
- */
3365
- function powerpress_get_post_meta($post_id, $key)
3366
- {
3367
- $pp_meta_cache = wp_cache_get($post_id, 'post_meta');
3368
- if ( !$pp_meta_cache ) {
3369
- update_postmeta_cache($post_id);
3370
- $pp_meta_cache = wp_cache_get($post_id, 'post_meta');
3371
- }
3372
-
3373
- $meta = false;
3374
- if ( isset($pp_meta_cache[$key]) )
3375
- $meta = $pp_meta_cache[$key][0];
3376
-
3377
- if ( is_serialized( $meta ) ) // Logic used up but not including WordPress 2.8, new logic doesn't make sure if unserialized failed or not
3378
- {
3379
- if ( false !== ( $gm = @unserialize( $meta ) ) )
3380
- return $meta;
3381
- }
3382
-
3383
- return $meta;
3384
- }
3385
-
3386
- function powerpress_get_enclosure($post_id, $feed_slug = 'podcast')
3387
- {
3388
- $Data = powerpress_get_enclosure_data($post_id, $feed_slug);
3389
- if( $Data )
3390
- return $Data['url'];
3391
- return false;
3392
- }
3393
-
3394
- function powerpress_get_enclosure_data($post_id, $feed_slug = 'podcast', $raw_data = false, $add_redirect=true)
3395
- {
3396
- global $post;
3397
- if( false != $raw_data )
3398
- $MetaData = $raw_data;
3399
- else
3400
- {
3401
- if( !empty($post->podcast_meta_value) && $post->ID == $post_id) // See if we got the meta data from the initial query...
3402
- {
3403
- $PodcastData = powerpress_get_enclosure_data($post_id, $feed_slug, $post->podcast_meta_value, true);
3404
- return $PodcastData;
3405
- }
3406
-
3407
- if( 'podcast' == $feed_slug || '' == $feed_slug )
3408
- $MetaData = get_post_meta($post_id, 'enclosure', true);
3409
- else
3410
- $MetaData = get_post_meta($post_id, '_'. $feed_slug .':enclosure', true);
3411
- }
3412
- if( empty($MetaData) )
3413
- return false;
3414
-
3415
- $MetaParts = explode("\n", $MetaData, 4);
3416
-
3417
- $Serialized = false;
3418
- $Data = array();
3419
- $Data['id'] = $post_id;
3420
- $Data['feed'] = $feed_slug;
3421
- $Data['url'] = '';
3422
- $Data['duration'] = '';
3423
- $Data['size'] = '';
3424
- $Data['type'] = '';
3425
- $Data['width'] = '';
3426
- $Data['height'] = '';
3427
-
3428
- if( count($MetaParts) > 0 )
3429
- $Data['url'] = trim($MetaParts[0]);
3430
- if( count($MetaParts) > 1 )
3431
- $Data['size'] = trim($MetaParts[1]);
3432
- if( count($MetaParts) > 2 )
3433
- $Data['type'] = trim($MetaParts[2]);
3434
- if( count($MetaParts) > 3 )
3435
- $Serialized = $MetaParts[3];
3436
-
3437
- if( $Serialized )
3438
- {
3439
- $ExtraData = @unserialize($Serialized);
3440
- if( $ExtraData && is_array($ExtraData) )
3441
- {
3442
- foreach( $ExtraData as $key=> $value ) {
3443
-
3444
- // Make sure specific fields are not overwritten...
3445
- switch( $key ) {
3446
- case 'id':
3447
- case 'feed':
3448
- case 'url':
3449
- case 'size':
3450
- case 'type': break;
3451
- default: $Data[ $key ] = $value;
3452
- }
3453
- }
3454
-
3455
- if( isset($Data['length']) ) // Setting from the "Podcasting" plugin...
3456
- $Data['duration'] = powerpress_readable_duration($Data['length'], true);
3457
-
3458
- if( !empty($Data['webm_src']) )
3459
- {
3460
- $Data['webm_src'] = trim($Data['webm_src']);
3461
- }
3462
-
3463
-
3464
- if( strpos($MetaParts[0], 'http://') !== 0 && !empty($Data['hosting']) ) // if the URL is not set (just file name) and we're a hosting customer...
3465
- {
3466
- $post_status = get_post_status($post_id);
3467
- switch( $post_status )
3468
- {
3469
- case 'pending':
3470
- case 'draft':
3471
- case 'auto-draft': {
3472
- // Determine if audio or video, then set the demo episode here...
3473
- $Data['url'] = 'http://media.blubrry.com/blubrry/content.blubrry.com/blubrry/preview.mp3'; // audio
3474
- if( strstr($Data['type'], 'video') )
3475
- $Data['url'] = 'http://media.blubrry.com/blubrry/content.blubrry.com/blubrry/preview.mp4'; // video
3476
- }; break;
3477
- }
3478
- }
3479
- }
3480
- }
3481
-
3482
- // If the URL is using Blubrry hosting, then lets pump it up to https...
3483
- if( is_ssl() && preg_match('/^http:\/\/(.*\/content\.blubrry\.com\/.*)$/i', $Data['url'], $matches) )
3484
- {
3485
- $Data['url'] = 'https://'. $matches[1];
3486
- }
3487
-
3488
- // Check that the content type is a valid one...
3489
- if( strstr($Data['type'], '/') == false )
3490
- $Data['type'] = powerpress_get_contenttype($Data['url']);
3491
-
3492
- // Do redirect filter here...
3493
- if( $add_redirect && !empty($Data['url']) )
3494
- $Data['url'] = powerpress_add_redirect_url( $Data['url'], $Data );
3495
-
3496
- if( $add_redirect && !empty($Data['webm_src']) )
3497
- $Data['webm_src'] = powerpress_add_redirect_url( $Data['webm_src'], $Data );
3498
-
3499
- return apply_filters('powerpress_get_enclosure_data', $Data);
3500
- }
3501
-
3502
- function powerpress_get_enclosure_data_podpress($post_id, $mediaNum = 0, $include_premium = false)
3503
- {
3504
- $podPressMedia = powerpress_get_post_meta($post_id, 'podPressMedia');
3505
- if( !$podPressMedia )
3506
- $podPressMedia = powerpress_get_post_meta($post_id, '_podPressMedia'); // handles latest verions of PodPress
3507
- if( $podPressMedia )
3508
- {
3509
-
3510
- if( !is_array($podPressMedia) )
3511
- {
3512
- // Sometimes the stored data gets messed up, we can fix it here:
3513
- $podPressMedia = powerpress_repair_serialize($podPressMedia);
3514
- $podPressMedia = @unserialize($podPressMedia);
3515
- }
3516
-
3517
- // Do it a second time in case it is double serialized
3518
- if( !is_array($podPressMedia) )
3519
- {
3520
- // Sometimes the stored data gets messed up, we can fix it here:
3521
- $podPressMedia = powerpress_repair_serialize($podPressMedia);
3522
- $podPressMedia = @unserialize($podPressMedia);
3523
- }
3524
-
3525
- if( is_array($podPressMedia) && isset($podPressMedia[$mediaNum]) && isset($podPressMedia[$mediaNum]['URI']) )
3526
- {
3527
- if( $include_premium == false && isset($podPressMedia[$mediaNum]['premium_only']) && ($podPressMedia[$mediaNum]['premium_only'] == 'on' || $podPressMedia[$mediaNum]['premium_only'] == true) )
3528
- return false;
3529
-
3530
- $Data = array();
3531
- $Data['id'] = $post_id;
3532
- $Data['feed'] = 'podcast';
3533
- $Data['duration'] = 0;
3534
- $Data['url'] = '';
3535
- $Data['size'] = 0;
3536
- $Data['type'] = '';
3537
- $Data['width'] = '';
3538
- $Data['height'] = '';
3539
-
3540
- $Data['url'] = $podPressMedia[$mediaNum]['URI'];
3541
- if( isset($podPressMedia[$mediaNum]['size']) )
3542
- $Data['size'] = $podPressMedia[$mediaNum]['size'];
3543
- if( isset($PodPressSettings[$mediaNum]['duration']) )
3544
- $Data['duration'] = $podPressMedia[$mediaNum]['duration'];
3545
- if( isset($PodPressSettings[$mediaNum]['previewImage']) )
3546
- $Data['image'] = $podPressMedia[$mediaNum]['previewImage'];
3547
-
3548
- if( strpos($Data['url'], 'http://' ) !== 0 && strpos($Data['url'], 'https://' ) !== 0 )
3549
- {
3550
- $PodPressSettings = get_option('podPress_config');
3551
- if( $PodPressSettings && isset($PodPressSettings['mediaWebPath']) )
3552
- $Data['url'] = rtrim($PodpressSettings['mediaWebPath'], '/') . '/' . ltrim($Data['url'], '/');
3553
- unset($PodPressSettings);
3554
- }
3555
-
3556
- if( strpos($Data['url'], 'http://' ) !== 0 && strpos($Data['url'], 'https://' ) !== 0 )
3557
- {
3558
- $Settings = get_option('powerpress_general');
3559
- if( $Settings && isset($Settings['default_url']) )
3560
- $Data['url'] = rtrim($Settings['default_url'], '/') . '/' . ltrim($Data['url'], '/');
3561
- }
3562
-
3563
- if( strpos($Data['url'], 'http://' ) !== 0 && strpos($Data['url'], 'https://' ) !== 0 )
3564
- return false;
3565
-
3566
- $Data['type'] = powerpress_get_contenttype($Data['url']); // Detect the content type
3567
- $Data['url'] = powerpress_add_redirect_url($Data['url'], $Data); // Add redirects to Media URL
3568
-
3569
- return apply_filters('powerpress_get_enclosure_data', $Data);
3570
- }
3571
- }
3572
- return false;
3573
- }
3574
-
3575
- function powerpress_get_apple_id($url, $strict=false)
3576
- {
3577
- if( $strict )
3578
- {
3579
- $results = preg_match('/apple\.com\/.*\/id(\d+)/i', $url, $matches);
3580
- if( !$results )
3581
- $results = preg_match('/apple\.com\/.*id\=(\d+)/i', $url, $matches);
3582
- if( $results )
3583
- return $matches[1];
3584
- return 0;
3585
- }
3586
- $results = preg_match('/\/id(\d+)/i', $url, $matches);
3587
- if( !$results )
3588
- $results = preg_match('/id\=(\d+)/i', $url, $matches);
3589
- if( $results )
3590
- return $matches[1];
3591
- return 0;
3592
- }
3593
-
3594
-
3595
- function the_powerpress_all_players($slug = false, $no_link=false)
3596
- {
3597
- echo get_the_powerpress_all_players($slug, $no_link);
3598
- }
3599
-
3600
- function get_the_powerpress_all_players($slug = false, $no_link=false)
3601
- {
3602
- $return = '';
3603
- //Use this function to insert the Powerpress player anywhere in the page.
3604
- //Made by Nicolas Bouliane (http://nicolasbouliane.com/)
3605
-
3606
- /*We're going to use the Loop to retrieve the latest post with the 'enclosure' custom key set
3607
- //then interpret it and manually launch powerpressplayer_build with the URL contained within
3608
- //that data.*/
3609
-
3610
- //Let's reset the Loop to make sure we look through all posts
3611
- rewind_posts();
3612
-
3613
- // Get the list of podcast channel slug names...
3614
- $GeneralSettings = get_option('powerpress_general');
3615
-
3616
- // No player or links to add to content...
3617
- if( !empty($GeneralSettings['disable_appearance']) )
3618
- return $return;
3619
-
3620
- $ChannelSlugs = array('podcast');
3621
- if( $slug == false )
3622
- {
3623
- if( isset($GeneralSettings['custom_feeds']['podcast']) )
3624
- $ChannelSlugs = array(); // Reset the array so it is added from the list in specified order
3625
- foreach( $GeneralSettings['custom_feeds'] as $feed_slug=> $null )
3626
- $ChannelSlugs[] = $feed_slug;
3627
- }
3628
- else if( is_array($slug) )
3629
- {
3630
- $ChannelSlugs = $slug;
3631
- }
3632
- else
3633
- {
3634
- $ChannelSlugs = array($slug);
3635
- }
3636
-
3637
- // Loop through the posts
3638
- while( have_posts() )
3639
- {
3640
- the_post();
3641
-
3642
- foreach( $ChannelSlugs as $null=> $feed_slug )
3643
- {
3644
- // Do we follow the global settings to disable a player?
3645
- if( isset($GeneralSettings['disable_player']) && isset($GeneralSettings['disable_player'][$feed_slug]) && $slug == false )
3646
- continue;
3647
-
3648
- $EpisodeData = powerpress_get_enclosure_data(get_the_ID(), $feed_slug);
3649
- if( !$EpisodeData && !empty($GeneralSettings['process_podpress']) && $feed_slug == 'podcast' )
3650
- $EpisodeData = powerpress_get_enclosure_data_podpress(get_the_ID());
3651
-
3652
- if( !$EpisodeData )
3653
- continue;
3654
-
3655
- $AddDefaultPlayer = true;
3656
- if( !empty($EpisodeData['embed']) )
3657
- {
3658
- $return .= $EpisodeData['embed'];
3659
- if( !empty($GeneralSettings['embed_replace_player']) )
3660
- $AddDefaultPlayer = false;
3661
- }
3662
-
3663
- if( isset($GeneralSettings['premium_caps']) && $GeneralSettings['premium_caps'] && !powerpress_premium_content_authorized($feed_slug) )
3664
- {
3665
- $return .= powerpress_premium_content_message(get_the_ID(), $feed_slug, $EpisodeData);
3666
- continue;
3667
- }
3668
-
3669
- if( !isset($EpisodeData['no_player']) && $AddDefaultPlayer )
3670
- {
3671
- do_action('wp_powerpress_player_scripts');
3672
- $return .= apply_filters('powerpress_player', '', powerpress_add_flag_to_redirect_url($EpisodeData['url'], 'p'), $EpisodeData );
3673
- }
3674
- if( !isset($EpisodeData['no_links']) && $no_link == false )
3675
- {
3676
- do_action('wp_powerpress_player_scripts');
3677
- $return .= apply_filters('powerpress_player_links', '', powerpress_add_flag_to_redirect_url($EpisodeData['url'], 'p'), $EpisodeData );
3678
- $return .= apply_filters('powerpress_player_subscribe_links', '', powerpress_add_flag_to_redirect_url($EpisodeData['url'], 'p'), $EpisodeData );
3679
- }
3680
- }
3681
- reset($ChannelSlugs);
3682
- }
3683
-
3684
- return $return;
3685
- }
3686
-
3687
- function powerpress_premium_content_authorized_filter($default, $feed_slug)
3688
- {
3689
- if( $feed_slug != 'podcast' )
3690
- {
3691
- $FeedSettings = get_option('powerpress_feed_'. $feed_slug);
3692
- if( isset($FeedSettings['premium']) && $FeedSettings['premium'] != '' )
3693
- return current_user_can($FeedSettings['premium']);
3694
- }
3695
-
3696
- $post_type = get_query_var('post_type');
3697
- if ( is_array( $post_type ) ) {
3698
- $post_type = reset( $post_type ); // get first element in array
3699
- }
3700
-
3701
- if( $post_type != 'post' )
3702
- {
3703
- $GeneralSettings = get_option('powerpress_general');
3704
- if( !empty($GeneralSettings['posttype_podcasting']) ) // Custom Post Types
3705
- {
3706
- // Get the feed slugs and titles for this post type
3707
- $PostTypeSettingsArray = get_option('powerpress_posttype_'.$post_type);
3708
- if( !empty($PostTypeSettingsArray[$feed_slug]['premium']) )
3709
- return current_user_can($PostTypeSettingsArray[$feed_slug]['premium']);
3710
- }
3711
- }
3712
-
3713
- return $default;
3714
- }
3715
- add_filter('powerpress_premium_content_authorized', 'powerpress_premium_content_authorized_filter', 10, 2);
3716
-
3717
- function powerpress_premium_content_authorized($feed_slug)
3718
- {
3719
- return apply_filters('powerpress_premium_content_authorized', true, $feed_slug );
3720
- }
3721
-
3722
- function powerpress_premium_content_message($post_id, $feed_slug, $EpisodeData = false)
3723
- {
3724
- if( !$EpisodeData && $post_id )
3725
- $EpisodeData = powerpress_get_enclosure_data($post_id, $feed_slug);
3726
-
3727
- if( !$EpisodeData )
3728
- return '';
3729
- $FeedSettings = get_option('powerpress_feed_'.$feed_slug);
3730
- $post_type = get_query_var('post_type');
3731
- if ( is_array( $post_type ) ) {
3732
- $post_type = reset( $post_type ); // get first element in array
3733
- }
3734
-
3735
- if( $post_type != 'post' )
3736
- {
3737
- $GeneralSettings = get_option('powerpress_general');
3738
- if( !empty($GeneralSettings['posttype_podcasting']) ) // Custom Post Types
3739
- {
3740
- // Get the feed slugs and titles for this post type
3741
- $PostTypeSettingsArray = get_option('powerpress_posttype_'.$post_type);
3742
- if( !empty($PostTypeSettingsArray[$feed_slug]['premium']) )
3743
- {
3744
- $FeedSettings = $PostTypeSettingsArray[$feed_slug];
3745
- }
3746
- }
3747
- }
3748
-
3749
- $extension = 'unknown';
3750
- $parts = pathinfo($EpisodeData['url']);
3751
- if( $parts && isset($parts['extension']) )
3752
- $extension = strtolower($parts['extension']);
3753
-
3754
- if( isset($FeedSettings['premium_label']) && $FeedSettings['premium_label'] != '' ) // User has a custom label
3755
- return '<p class="powerpress_links powerpress_links_'. $extension .'">'. $FeedSettings['premium_label'] . '</p>'.PHP_EOL_WEB;
3756
-
3757
- return '<p class="powerpress_links powerpress_links_'. $extension .'">'. htmlspecialchars($FeedSettings['title']) .': <a href="'. get_bloginfo('url') .'/wp-login.php" title="Protected Content">(Protected Content)</a></p>'.PHP_EOL_WEB;
3758
- }
3759
-
3760
- function powerpress_is_mobile_client()
3761
- {
3762
- _deprecated_function( __FUNCTION__, '7.0' );
3763
- return false;
3764
- }
3765
-
3766
- function powerpress_get_api_array()
3767
- {
3768
- $return = array();
3769
- if( strstr(POWERPRESS_BLUBRRY_API_URL, 'http://api.blubrry.com') == false ) // If not the default
3770
- {
3771
- $return = explode(';', POWERPRESS_BLUBRRY_API_URL);
3772
- }
3773
- else
3774
- {
3775
- $return[] = 'https://api.blubrry.com/'; // Use secure URL first when possible
3776
- $return[] = 'http://api.blubrry.net/';
3777
- $return[] = 'http://api.blubrry.com/';
3778
- }
3779
-
3780
- return $return;
3781
- }
3782
-
3783
-
3784
- function powerpress_in_wp_head()
3785
- {
3786
- $e = new Exception();
3787
- $trace = $e->getTrace();
3788
-
3789
- if( !empty($trace) ) {
3790
- foreach( $trace as $index=> $call ) {
3791
- if( isset($call['function']) ) {
3792
- // Which calls should we not add the player and links...
3793
- switch( $call['function'] ) {
3794
- case 'wp_head': return true; break;
3795
- }
3796
- }
3797
- }
3798
- }
3799
- return false;
3800
- }
3801
-
3802
- function powerpress_in_custom_post_widget()
3803
- {
3804
- if( !class_exists('custom_post_widget') )
3805
- return false;
3806
-
3807
- $e = new Exception();
3808
- $trace = $e->getTrace();
3809
-
3810
- if( !empty($trace) ) {
3811
-
3812
- foreach( $trace as $index=> $call ) {
3813
- if( isset($call['function']) ) {
3814
- // Which calls should we not add the player and links...
3815
- switch( $call['function'] ) {
3816
- case 'custom_post_widget_shortcode': return true; break;
3817
- }
3818
- }
3819
- }
3820
- }
3821
- return false;
3822
- }
3823
- /*
3824
- End Helper Functions
3825
- */
3826
-
3827
- // Are we in the admin?
3828
- if( is_admin() )
3829
- {
3830
- require_once(POWERPRESS_ABSPATH.'/powerpressadmin.php');
3831
- register_activation_hook( __FILE__, 'powerpress_admin_activate' );
3832
- }
3833
-
3834
- if( defined('POWERPRESS_SUBSCRIBE') && POWERPRESS_SUBSCRIBE )
3835
- {
3836
- require_once(POWERPRESS_ABSPATH.'/powerpress-subscribe.php');
3837
- }
3838
-
3839
- // For testing purposes in development
3840
- if( defined('POWERPRESS_NEW_CODE') && POWERPRESS_NEW_CODE && file_exists(POWERPRESS_ABSPATH.'/powerpress-new-code.php') )
3841
- {
3842
- require_once(POWERPRESS_ABSPATH.'/powerpress-new-code.php');
3843
- }
3844
-
3845
- if( defined('POWERPRESS_PREMIUM_GROUPS_PLUGIN') ) {
3846
-
3847
- function powerpress_pre_get_posts($query) {
3848
- if( is_feed() && powerpress_is_custom_podcast_feed() && method_exists('Groups_Post_Access', 'posts_where') )
3849
- {
3850
- $feed_slug = get_query_var('feed');
3851
-
3852
- if( $feed_slug != 'podcast' )
3853
- {
3854
- $FeedSettings = get_option('powerpress_feed_'.$feed_slug);
3855
- if( !empty($FeedSettings['premium']) )
3856
- {
3857
- if( has_filter('posts_where', 'Groups_Post_Access::posts_where') )
3858
- {
3859
- remove_filter('posts_where', 'Groups_Post_Access::posts_where');
3860
- }
3861
- }
3862
- }
3863
- }
3864
- }
3865
- add_filter('pre_get_posts', 'powerpress_pre_get_posts');
3866
- }
3867
-
3868
  // eof
1
+ <?php
2
+ /*
3
+ Plugin Name: Blubrry PowerPress
4
+ Plugin URI: http://create.blubrry.com/resources/powerpress/
5
+ Description: <a href="http://create.blubrry.com/resources/powerpress/" target="_blank">Blubrry PowerPress</a> is the No. 1 Podcasting plugin for WordPress. Developed by podcasters for podcasters; features include Simple and Advanced modes, multiple audio/video player options, subscribe to podcast tools, podcast SEO features, and more! Fully supports Apple Podcasts (previously iTunes), Google Podcasts, Spotify, Stitcher, and Blubrry Podcasting directories, as well as all podcast applications and clients.
6
+ Version: 7.5.2
7
+ Author: Blubrry
8
+ Author URI: http://www.blubrry.com/
9
+ Requires at least: 3.6
10
+ Tested up to: 5.2.2
11
+ Text Domain: powerpress
12
+ Change Log:
13
+ Please see readme.txt for detailed change log.
14
+
15
+ Contributors:
16
+ Angelo Mandato, CIO Blubrry - Plugin founder, architect and lead developer
17
+ See readme.txt for full list of contributors.
18
+
19
+ Credits:
20
+ getID3(), License: GPL 2.0+ by James Heinrich <info [at] getid3.org> http://www.getid3.org
21
+ Note: getid3.php analyze() function modified to prevent redundant filesize() function call.
22
+
23
+ Copyright 2008-2019 Blubrry (http://www.blubrry.com)
24
+
25
+ License: GPL (http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt)
26
+
27
+ This project uses source that is GPL licensed.
28
+ */
29
+
30
+
31
+ if( !function_exists('add_action') ) {
32
+ header( 'Status: 403 Forbidden' );
33
+ header( 'HTTP/1.1 403 Forbidden' );
34
+ exit();
35
+ }
36
+
37
+ // WP_PLUGIN_DIR (REMEMBER TO USE THIS DEFINE IF NEEDED)
38
+ define('POWERPRESS_VERSION', '7.5.2' );
39
+
40
+ // Translation support:
41
+ if ( !defined('POWERPRESS_ABSPATH') )
42
+ define('POWERPRESS_ABSPATH', dirname(__FILE__) );
43
+
44
+
45
+
46
+ /////////////////////////////////////////////////////
47
+ // The following define options should be placed in your
48
+ // wp-config.php file so the setting is not disrupted when
49
+ // you upgrade the plugin.
50
+ /////////////////////////////////////////////////////
51
+
52
+ if( !defined('POWERPRESS_BLUBRRY_API_URL') )
53
+ define('POWERPRESS_BLUBRRY_API_URL', 'http://api.blubrry.com/');
54
+
55
+ // Replace validator service with one that is more reliable here:
56
+ define('POWERPRESS_FEEDVALIDATOR_URL', 'http://castfeedvalidator.com/?url=');
57
+
58
+ // Display custom play image for quicktime media. Applies to on page player only.
59
+ //define('POWERPRESS_PLAY_IMAGE', 'http://www.blubrry.com/themes/blubrry/images/player/PlayerBadge150x50NoBorder.jpg');
60
+
61
+ if( !defined('POWERPRESS_CONTENT_ACTION_PRIORITY') )
62
+ define('POWERPRESS_CONTENT_ACTION_PRIORITY', 10 );
63
+
64
+ // Added so administrators can customize what capability is needed for PowerPress
65
+ if( !defined('POWERPRESS_CAPABILITY_MANAGE_OPTIONS') )
66
+ define('POWERPRESS_CAPABILITY_MANAGE_OPTIONS', 'manage_options');
67
+ if( !defined('POWERPRESS_CAPABILITY_EDIT_PAGES') )
68
+ define('POWERPRESS_CAPABILITY_EDIT_PAGES', 'edit_pages');
69
+
70
+ //define('POWERPRESS_ENABLE_HTTPS_MEDIA', true); // Add this define to your wp-config.php if you wnat to allow media URLs that begin with https://
71
+
72
+ // Define variables, advanced users could define these in their own wp-config.php so lets not try to re-define
73
+ if( !defined('POWERPRESS_LINK_SEPARATOR') )
74
+ define('POWERPRESS_LINK_SEPARATOR', '|');
75
+ if( !defined('POWERPRESS_TEXT_SEPARATOR') )
76
+ define('POWERPRESS_TEXT_SEPARATOR', ':');
77
+ if( !defined('POWERPRESS_PLAY_IMAGE') )
78
+ define('POWERPRESS_PLAY_IMAGE', 'play_video_default.jpg');
79
+ if( !defined('PHP_EOL') )
80
+ define('PHP_EOL', "\n"); // We need this variable defined for new lines.
81
+ if( defined('POWERPRESS_DEBUG') ) {
82
+ if( !defined('PHP_EOL_WEB') ) {
83
+ define('PHP_EOL_WEB', "\n"); // Helps with readability
84
+ }
85
+ } else {
86
+ if( !defined('PHP_EOL_WEB') ) {
87
+ define('PHP_EOL_WEB', ''); // We don't necessarily need new lines for web output
88
+ }
89
+ }
90
+
91
+ if( !defined('POWERPRESS_SUBSCRIBE') )
92
+ define('POWERPRESS_SUBSCRIBE', true);
93
+ if(!defined('POWERPRESS_NEW_APPLE_CATEGORIES')) {
94
+ define('POWERPRESS_NEW_APPLE_CATEGORIES', true);
95
+ }
96
+ // Set regular expression values for determining mobile devices
97
+ if( !defined('POWERPRESS_MOBILE_REGEX') )
98
+ define('POWERPRESS_MOBILE_REGEX', 'iphone|ipod|ipad|aspen|android|blackberry|opera mini|webos|incognito|webmate|silk');
99
+
100
+ $powerpress_feed = NULL; // DO NOT CHANGE
101
+
102
+ function powerpress_content($content)
103
+ {
104
+ global $post, $g_powerpress_excerpt_post_id;
105
+
106
+ if( defined('PODPRESS_VERSION') || isset($GLOBALS['podcasting_player_id']) || isset($GLOBALS['podcast_channel_active']) || defined('PODCASTING_VERSION') )
107
+ return $content;
108
+
109
+ if( empty($post->ID) || !is_object($post) )
110
+ return $content;
111
+
112
+ if( defined('POWERPRESS_DO_ENCLOSE_FIX') )
113
+ $content = preg_replace('/\<!--.*added by PowerPress.*-->/im', '', $content );
114
+
115
+ if( is_feed() )
116
+ return $content; // We don't want to do anything to the feed
117
+
118
+ if( function_exists('post_password_required') )
119
+ {
120
+ if( post_password_required($post) )
121
+ return $content;
122
+ }
123
+
124
+ // PowerPress settings:
125
+ $GeneralSettings = get_option('powerpress_general');
126
+
127
+ // No player or links to add to content...
128
+ if( !empty($GeneralSettings['disable_appearance']) )
129
+ return $content;
130
+
131
+ // check for themes/plugins where we know we need to do this...
132
+ if( empty($GeneralSettings['player_aggressive']) )
133
+ {
134
+ if( !empty($GLOBALS['fb_ver']) && version_compare($GLOBALS['fb_ver'], '1.0', '<=') ) {
135
+ $GeneralSettings['player_aggressive'] = 1;
136
+ }
137
+ if( defined('JETPACK__VERSION') && version_compare(JETPACK__VERSION, '2.0', '>=') ) {
138
+ $GeneralSettings['player_aggressive'] = 1; // Jet pack still doesn't behave with PowerPress the_content
139
+ }
140
+ if( defined('WPSEO_VERSION') ) {
141
+ $GeneralSettings['player_aggressive'] = 4;
142
+ }
143
+ }
144
+
145
+ if( !empty($GeneralSettings['player_aggressive']) )
146
+ {
147
+ if( $GeneralSettings['player_aggressive'] == 4 )
148
+ {
149
+ $in_http_head = powerpress_in_wp_head();
150
+ if( $in_http_head === true )
151
+ return $content;
152
+ }
153
+ else if( $GeneralSettings['player_aggressive'] == 2 ) // If we do not have theme issues then lets keep this logic clean. and only display playes after the wp_head only
154
+ {
155
+ if( empty($GLOBALS['powerpress_wp_head_completed']) )
156
+ return $content;
157
+ }
158
+ else // method 1 or 3...
159
+ {
160
+ if( strstr($content, '<!--powerpress_player-->') !== false )
161
+ return $content; // The players were already added to the content
162
+
163
+ if( $GeneralSettings['player_aggressive'] != 3 && $g_powerpress_excerpt_post_id > 0 )
164
+ $g_powerpress_excerpt_post_id = 0; // Hack, set this to zero so it always goes past...
165
+
166
+ if( $GeneralSettings['player_aggressive'] == 3 )
167
+ $GeneralSettings['player_aggressive'] = 1; // remainder of the system will function as normal
168
+ }
169
+ }
170
+
171
+ // Problem: If the_excerpt is used instead of the_content, both the_exerpt and the_content will be called here.
172
+ // Important to note, get_the_excerpt will be called before the_content is called, so we add a simple little hack
173
+ if( current_filter() == 'get_the_excerpt' )
174
+ {
175
+ $g_powerpress_excerpt_post_id = $post->ID;
176
+ return $content; // We don't want to do anything to this content yet...
177
+ }
178
+ else if( current_filter() == 'the_content' && $g_powerpress_excerpt_post_id == $post->ID )
179
+ {
180
+ return $content; // We don't want to do anything to this excerpt content in this call either...
181
+ }
182
+ else if( class_exists('custom_post_widget') && powerpress_in_custom_post_widget() )
183
+ {
184
+ return $content; // Custom Post Widget compatibility
185
+ }
186
+
187
+
188
+ if( !isset($GeneralSettings['custom_feeds']) )
189
+ $GeneralSettings['custom_feeds'] = array('podcast'=>'Default Podcast Feed');
190
+ if( empty($GeneralSettings['custom_feeds']['podcast']) )
191
+ $GeneralSettings['custom_feeds']['podcast'] = 'Default Podcast Feed';
192
+
193
+ // Re-order so the default podcast episode is the top most...
194
+ $Temp = $GeneralSettings['custom_feeds'];
195
+ $GeneralSettings['custom_feeds'] = array();
196
+ $GeneralSettings['custom_feeds']['podcast'] = 'Default Podcast Feed';
197
+ foreach( $Temp as $feed_slug=> $feed_title )
198
+ {
199
+ if( $feed_slug == 'podcast' )
200
+ continue;
201
+ $GeneralSettings['custom_feeds'][ $feed_slug ] = $feed_title;
202
+ }
203
+
204
+ // Handle post type feeds....
205
+ if( !empty($GeneralSettings['posttype_podcasting']) )
206
+ {
207
+ $post_type = get_query_var('post_type');
208
+ if ( is_array( $post_type ) ) {
209
+ $post_type = reset( $post_type ); // get first element in array
210
+ }
211
+
212
+ // Get the feed slugs and titles for this post type
213
+ $PostTypeSettingsArray = get_option('powerpress_posttype_'.$post_type);
214
+ // Loop through this array of post type settings...
215
+ if( !empty($PostTypeSettingsArray) )
216
+ {
217
+ switch($post_type)
218
+ {
219
+ case 'post':
220
+ case 'page': {
221
+ // Do nothing!, we want the default podcast to appear in these post types
222
+ }; break;
223
+ default: {
224
+ if( !empty($post_type) && empty($PostTypeSettingsArray['podcast']) )
225
+ unset($GeneralSettings['custom_feeds']['podcast']); // special case, we do not want an accidental podcast episode to appear in a custom post type if the feature is enabled
226
+ }; break;
227
+ }
228
+
229
+ foreach( $PostTypeSettingsArray as $feed_slug=> $postTypeSettings )
230
+ {
231
+ if( !empty( $postTypeSettings['title']) )
232
+ $GeneralSettings['custom_feeds'][ $feed_slug ] = $postTypeSettings['title'];
233
+ else
234
+ $GeneralSettings['custom_feeds'][ $feed_slug ] = $feed_slug;
235
+ }
236
+ }
237
+ }
238
+
239
+ if( !isset($GeneralSettings['display_player']) )
240
+ $GeneralSettings['display_player'] = 1;
241
+ if( !isset($GeneralSettings['player_function']) )
242
+ $GeneralSettings['player_function'] = 1;
243
+ if( !isset($GeneralSettings['podcast_link']) )
244
+ $GeneralSettings['podcast_link'] = 1;
245
+
246
+ // The blog owner doesn't want anything displayed, so don't bother wasting anymore CPU cycles
247
+ if( $GeneralSettings['display_player'] == 0 )
248
+ return $content;
249
+
250
+ if( current_filter() == 'the_excerpt' && empty($GeneralSettings['display_player_excerpt']) )
251
+ return $content; // We didn't want to modify this since the user didn't enable it for excerpts
252
+
253
+ if( !empty($GeneralSettings['hide_player_more']) && strstr($content, 'class="more-link"') )
254
+ return $content; // We do not want to add players and links if the read-more class found
255
+
256
+ // Figure out which players are alerady in the body of the page...
257
+ $ExcludePlayers = array();
258
+ if( isset($GeneralSettings['disable_player']) )
259
+ $ExcludePlayers = $GeneralSettings['disable_player']; // automatically disable the players configured
260
+
261
+ if( !empty($GeneralSettings['process_podpress']) && strstr($content, '[display_podcast]') )
262
+ return $content;
263
+
264
+ if( preg_match_all('/(.?)\[(powerpress)\b(.*?)(?:(\/))?\](?:(.+?)\[\/\2\])?(.?)/s', $content, $matches) )
265
+ {
266
+ if( isset($matches[3]) )
267
+ {
268
+ foreach( $matches[3] as $key=> $row )
269
+ {
270
+ $attributes = shortcode_parse_atts($row);
271
+ if( isset($attributes['url']) )
272
+ {
273
+ // not a problem...
274
+ }
275
+ else if( isset($attributes['feed']) )
276
+ {
277
+ // we want to exclude this feed from the links aera...
278
+ $ExcludePlayers[ $attributes['feed'] ] = true;
279
+ }
280
+ else
281
+ {
282
+ // we don't want to include any players below...
283
+ $ExcludePlayers = $GeneralSettings['custom_feeds'];
284
+ }
285
+ }
286
+ }
287
+ }
288
+
289
+ // LOOP HERE TO DISPLAY EACH MEDIA TYPE
290
+ $new_content = '';
291
+ foreach( $GeneralSettings['custom_feeds'] as $feed_slug=> $feed_title )
292
+ {
293
+ // Get the enclosure data
294
+ $EpisodeData = powerpress_get_enclosure_data($post->ID, $feed_slug);
295
+
296
+ if( !$EpisodeData && !empty($GeneralSettings['process_podpress']) && $feed_slug == 'podcast' )
297
+ $EpisodeData = powerpress_get_enclosure_data_podpress($post->ID);
298
+
299
+ if( !$EpisodeData || !$EpisodeData['url'] )
300
+ continue;
301
+
302
+ // Just in case, if there's no URL lets escape!
303
+ if( !$EpisodeData['url'] )
304
+ continue;
305
+
306
+ // If the player is not already inserted in the body of the post using the shortcode...
307
+ //if( preg_match('/\[powerpress(.*)\]/is', $content) == 0 )
308
+ if( !isset($ExcludePlayers[ $feed_slug ]) ) // If the player is not in our exclude list because it's already in the post body somewhere...
309
+ {
310
+ if( isset($GeneralSettings['premium_caps']) && $GeneralSettings['premium_caps'] && !powerpress_premium_content_authorized($feed_slug) )
311
+ {
312
+ $new_content .= powerpress_premium_content_message($post->ID, $feed_slug, $EpisodeData);
313
+ }
314
+ else
315
+ {
316
+ if( $GeneralSettings['player_function'] != 3 && $GeneralSettings['player_function'] != 0 ) // Play in new window only or disabled
317
+ {
318
+ do_action('wp_powerpress_player_scripts');
319
+ $AddDefaultPlayer = empty($EpisodeData['no_player']);
320
+
321
+ if( $EpisodeData && !empty($EpisodeData['embed']) )
322
+ {
323
+ $new_content .= trim($EpisodeData['embed']);
324
+ if( !empty($GeneralSettings['embed_replace_player']) )
325
+ $AddDefaultPlayer = false;
326
+ }
327
+
328
+ if( $AddDefaultPlayer )
329
+ {
330
+ $image = '';
331
+ if( isset($EpisodeData['image']) && $EpisodeData['image'] != '' )
332
+ $image = $EpisodeData['image'];
333
+
334
+ $new_content .= apply_filters('powerpress_player', '', powerpress_add_flag_to_redirect_url($EpisodeData['url'], 'p'), $EpisodeData );
335
+ }
336
+ }
337
+
338
+ if( !isset($EpisodeData['no_links']) ) {
339
+ do_action('wp_powerpress_player_scripts');
340
+ $new_content .= apply_filters('powerpress_player_links', '', powerpress_add_flag_to_redirect_url($EpisodeData['url'], 'p'), $EpisodeData );
341
+ $new_content .= apply_filters('powerpress_player_subscribe_links', '', powerpress_add_flag_to_redirect_url($EpisodeData['url'], 'p'), $EpisodeData );
342
+ }
343
+ }
344
+ }
345
+ }
346
+
347
+ if( $new_content == '' )
348
+ return $content;
349
+
350
+ switch( $GeneralSettings['display_player'] )
351
+ {
352
+ case 1: { // Below posts
353
+ return $content.$new_content.( !empty($GeneralSettings['player_aggressive']) && $GeneralSettings['player_aggressive'] == 1 ?'<!--powerpress_player-->':'');
354
+ }; break;
355
+ case 2: { // Above posts
356
+ return ( !empty($GeneralSettings['player_aggressive']) && $GeneralSettings['player_aggressive'] == 1 ?'<!--powerpress_player-->':'').$new_content.$content;
357
+ }; break;
358
+ }
359
+ return $content;
360
+ }//end function
361
+
362
+
363
+ add_filter('get_the_excerpt', 'powerpress_content', (POWERPRESS_CONTENT_ACTION_PRIORITY - 1) );
364
+ add_filter('the_content', 'powerpress_content', POWERPRESS_CONTENT_ACTION_PRIORITY);
365
+ if( !defined('POWERPRESS_NO_THE_EXCERPT') )
366
+ add_filter('the_excerpt', 'powerpress_content', POWERPRESS_CONTENT_ACTION_PRIORITY);
367
+
368
+
369
+ /* Specail case fix Yoast bug which messes up the HTML */
370
+ function powerpress_yoast_gawp_fix($content)
371
+ {
372
+ $content= preg_replace(
373
+ array('/return powerpress\_pinw\(\"/', '/return powerpress\_embed\_winplayer\(\"/', '/return powerpress\_show\_embed\(\"/', '/return powerpress\_embed\_html5v\(\"/', '/return powerpress\_embed\_html5a\(\"/', ),
374
+ array('return powerpress_pinw(\'', 'return powerpress_embed_winplayer(\'', 'return powerpress_show_embed(\'', 'return powerpress_embed_html5v(\'', 'return powerpress_embed_html5a(\'' ),
375
+ $content);
376
+
377
+ return $content;
378
+ }
379
+
380
+ function powerpress_header()
381
+ {
382
+ // PowerPress settings:
383
+ $Powerpress = get_option('powerpress_general');
384
+ if( !isset($Powerpress['custom_feeds']) )
385
+ $Powerpress['custom_feeds'] = array('podcast'=>'Default Podcast Feed');
386
+
387
+ if( empty($Powerpress['disable_appearance']) || $Powerpress['disable_appearance'] == false )
388
+ {
389
+ if( !isset($Powerpress['player_function']) || $Powerpress['player_function'] > 0 ) // Don't include the player in the header if it is not needed...
390
+ {
391
+ $PowerpressPluginURL = powerpress_get_root_url();
392
+ ?>
393
+ <script type="text/javascript"><!--
394
+ <?php
395
+ $new_window_width = 420;
396
+ $new_window_height = 240;
397
+
398
+ if( isset($Powerpress['new_window_width']) && $Powerpress['new_window_width'] > 0 )
399
+ $new_window_width = $Powerpress['new_window_width'];
400
+ else if( isset($Powerpress['new_window_width']) )
401
+ $new_window_width = 420;
402
+
403
+ if( isset($Powerpress['new_window_height']) && $Powerpress['new_window_height'] > 0 )
404
+ $new_window_height = $Powerpress['new_window_height'];
405
+ else if( isset($Powerpress['new_window_height']) )
406
+ $new_window_height = 240;
407
+
408
+ if( empty($Powerpress['new_window_nofactor']) )
409
+ {
410
+ $new_window_width += 40;
411
+ $new_window_height += 80;
412
+ }
413
+
414
+ ?>
415
+ function powerpress_pinw(pinw_url){window.open(pinw_url, 'PowerPressPlayer','toolbar=0,status=0,resizable=1,width=<?php echo ($new_window_width); ?>,height=<?php echo ($new_window_height); ?>'); return false;}
416
+ //-->
417
+ </script>
418
+ <?php
419
+ }
420
+ }
421
+
422
+ if( !empty($Powerpress['feed_links']) )
423
+ {
424
+ if( is_home() ) {
425
+ $feed_slug = 'podcast';
426
+ $href = get_feed_link($feed_slug);
427
+ // Podcast default and channel feed settings
428
+ $Settings = get_option('powerpress_feed_'. $feed_slug);
429
+
430
+ if( empty($Settings) && $feed_slug == 'podcast' )
431
+ $Settings = get_option('powerpress_feed'); // Get the main feed settings
432
+
433
+ if( empty($Settings['title']) )
434
+ $Settings['title'] = get_bloginfo_rss('name'); // Get blog title
435
+
436
+ // Get the default podcast feed...
437
+ echo '<link rel="alternate" type="' . feed_content_type() . '" title="' . esc_attr( $Settings['title'] ) . '" href="' . esc_url( $href ) . '" />' . "\n";
438
+ } else if( is_category() ) {
439
+
440
+ $category_id = get_query_var('cat');
441
+ if( $category_id ) {
442
+ $Settings = get_option('powerpress_cat_feed_'.$category_id );
443
+ if( empty($Settings['title']) ) {
444
+ $Settings['title'] = get_cat_name( $category_id ); // Get category title
445
+ $Settings['title'] .= ' '. apply_filters( 'document_title_separator', '-' ) .' ';
446
+ $Settings['title'] .= get_bloginfo_rss('name');
447
+ }
448
+ if( empty($Settings['title']) ) {
449
+ $Settings['title'] = get_bloginfo_rss('name'); // Get blog title, best we can do
450
+ }
451
+
452
+ if( !empty($Settings['feed_redirect_url']) )
453
+ $Settings['feed_url'] = $Settings['feed_redirect_url'];
454
+ else if( !empty($General['cat_casting_podcast_feeds']) )
455
+ $Settings['feed_url'] = get_category_feed_link($category_id, 'podcast');
456
+ else
457
+ $Settings['feed_url'] = get_category_feed_link( $category_id ); // Get category feed URL
458
+
459
+ // Get the category podcast feed...
460
+ echo '<link rel="alternate" type="' . feed_content_type() . '" title="' . esc_attr( $Settings['title'] ) . '" href="' . esc_url( $Settings['feed_url'] ) . '" />' . "\n";
461
+ }
462
+ }
463
+ }
464
+ }
465
+
466
+ add_action('wp_head', 'powerpress_header');
467
+
468
+ function powerpress_wp_head_completed()
469
+ {
470
+ $GLOBALS['powerpress_wp_head_completed'] = true;
471
+ }
472
+
473
+ add_action('wp_head', 'powerpress_wp_head_completed', 100000);
474
+
475
+ function powerpress_exit_on_http_head($return)
476
+ {
477
+ if( is_feed() )
478
+ {
479
+ // Set the content type for HTTP headers...
480
+ header('Content-Type: ' . feed_content_type('rss-http') . '; charset=' . get_option('blog_charset'), true);
481
+
482
+ // Needs authentication?
483
+ $GeneralSettings = get_option('powerpress_general');
484
+ if( !empty($GeneralSettings['premium_caps']) )
485
+ {
486
+ $feed_slug = get_query_var('feed');
487
+ $FeedSettings = get_option('powerpress_feed_'.$feed_slug);
488
+ if( !empty($FeedSettings['premium']) )
489
+ {
490
+ return false; // Let the logic further into PowerPress authenticate this HEAD request
491
+ }
492
+ }
493
+ }
494
+ return $return;
495
+ }
496
+
497
+ add_filter('exit_on_http_head', 'powerpress_exit_on_http_head' );
498
+
499
+ function powerpress_rss2_ns()
500
+ {
501
+ if( !powerpress_is_podcast_feed() )
502
+ return;
503
+
504
+ // Okay, lets add the namespace
505
+ echo 'xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd"'.PHP_EOL;
506
+ if( !defined('POWERPRESS_RAWVOICE_RSS') || POWERPRESS_RAWVOICE_RSS != false )
507
+ {
508
+ echo 'xmlns:rawvoice="http://www.rawvoice.com/rawvoiceRssModule/"'.PHP_EOL;
509
+ }
510
+ if( !defined('POWERPRESS_GOOGLEPLAY_RSS') || POWERPRESS_GOOGLEPLAY_RSS != false )
511
+ {
512
+ echo 'xmlns:googleplay="http://www.google.com/schemas/play-podcasts/1.0"'.PHP_EOL;
513
+ //echo 'xmlns:googleplay="http://www.google.com/schemas/play-podcasts/1.0/play-podcasts.xsd"'.PHP_EOL;
514
+ }
515
+ }
516
+
517
+ add_action('rss2_ns', 'powerpress_rss2_ns');
518
+ add_action('rss2_ns_powerpress', 'powerpress_rss2_ns');
519
+
520
+ function powerpress_rss2_head()
521
+ {
522
+ global $powerpress_feed;
523
+
524
+ if( !powerpress_is_podcast_feed() )
525
+ return; // Not a feed we manage
526
+
527
+ $feed_slug = get_query_var( 'feed' );
528
+ $cat_ID = get_query_var('cat');
529
+
530
+ $Feed = get_option('powerpress_feed'); // Get the main feed settings
531
+ if( !empty($powerpress_feed['category']) )
532
+ {
533
+ $CustomFeed = get_option('powerpress_cat_feed_'.$powerpress_feed['category']); // Get the custom podcast feed settings saved in the database
534
+ if( $CustomFeed )
535
+ $Feed = powerpress_merge_empty_feed_settings($CustomFeed, $Feed);
536
+ }
537
+ else if( !empty($powerpress_feed['term_taxonomy_id']) )
538
+ {
539
+ $CustomFeed = get_option('powerpress_taxonomy_'.$powerpress_feed['term_taxonomy_id']); // Get the taxonomy podcast settings saved in the database
540
+ if( $CustomFeed )
541
+ $Feed = powerpress_merge_empty_feed_settings($CustomFeed, $Feed);
542
+ }
543
+ else if( !empty($powerpress_feed['post_type']) )
544
+ {
545
+ $PostTypeSettingsArray = get_option('powerpress_posttype_'.$powerpress_feed['post_type']); // Get the post type podcast feed settings saved in the database
546
+ if( !empty($PostTypeSettingsArray[ $feed_slug ]) )
547
+ {
548
+ $CustomFeed = $PostTypeSettingsArray[ $feed_slug ];
549
+ $Feed = powerpress_merge_empty_feed_settings($CustomFeed, $Feed, ($feed_slug == 'podcast') );
550
+ }
551
+ }
552
+ else if( powerpress_is_custom_podcast_feed() ) // If we're handling a custom podcast feed...
553
+ {
554
+ $CustomFeed = get_option('powerpress_feed_'.$feed_slug); // Get the custom podcast feed settings saved in the database
555
+ $Feed = powerpress_merge_empty_feed_settings($CustomFeed, $Feed, ($feed_slug == 'podcast') );
556
+ }
557
+
558
+ if( !isset($Feed['url']) || trim($Feed['url']) == '' )
559
+ {
560
+ if( is_category() )
561
+ $Feed['url'] = get_category_link($cat_ID);
562
+ else {
563
+
564
+ $blogHomepage = get_option('page_for_posts');
565
+ if( !empty($blogHomepage) ) {
566
+ $Feed['url'] = get_permalink( $blogHomepage );
567
+ }
568
+
569
+ if( empty($Feed['url']) )
570
+ $Feed['url'] = get_bloginfo('url');
571
+ }
572
+ }
573
+
574
+ $General = get_option('powerpress_general');
575
+
576
+ // We made it this far, lets write stuff to the feed!
577
+ echo '<!-- podcast_generator="Blubrry PowerPress/'. POWERPRESS_VERSION .'" ';
578
+ if( isset($General['advanced_mode_2']) && empty($General['advanced_mode_2']) )
579
+ echo 'mode="simple" ';
580
+ else
581
+ echo 'mode="advanced" ';
582
+ // Additional info for diagnostics
583
+ if( !empty($powerpress_feed['category']) )
584
+ echo 'category="'.$powerpress_feed['category'].'" ';
585
+ if( !empty($powerpress_feed['term_taxonomy_id']) )
586
+ echo 'ttid="'.$powerpress_feed['term_taxonomy_id'].'" ';
587
+ if( !empty($powerpress_feed['post_type']) )
588
+ echo 'posttype="'.$powerpress_feed['post_type'].'" ';
589
+ if( !empty($powerpress_feed['feed-slug']) )
590
+ echo 'feedslug="'.$powerpress_feed['feed-slug'].'" ';
591
+
592
+ $feedComment = apply_filters('powerpress_feed_comment', '');
593
+ $feedComment = str_replace( array('<!--', '-->'), array('|!~~', '~~>'), $feedComment);
594
+ $feedComment = trim($feedComment);
595
+ if( !empty($feedComment) )
596
+ echo $feedComment.' ';
597
+
598
+ echo 'Blubrry PowerPress Podcasting plugin for WordPress (https://www.blubrry.com/powerpress/) -->'.PHP_EOL;
599
+
600
+ // Websub!
601
+ if(!empty($General['websub_enabled']) && $General['websub_enabled'] == 1) {
602
+ echo "\t<atom:link rel=\"hub\" href=\"https://pubsubhubbub.appspot.com/\" />" . PHP_EOL;
603
+ }
604
+
605
+ // add the itunes:new-feed-url tag to feed
606
+ if( powerpress_is_custom_podcast_feed() )
607
+ {
608
+ if( !empty($Feed['itunes_new_feed_url']) )
609
+ {
610
+ $Feed['itunes_new_feed_url'] = str_replace('&amp;', '&', $Feed['itunes_new_feed_url']);
611
+ echo "\t<itunes:new-feed-url>". htmlspecialchars(trim($Feed['itunes_new_feed_url'])) .'</itunes:new-feed-url>'.PHP_EOL;
612
+ }
613
+ }
614
+ else if( !empty($Feed['itunes_new_feed_url']) && ($feed_slug == 'feed' || $feed_slug == 'rss2') ) // If it is the default feed (We don't wnat to apply this to category or tag feeds
615
+ {
616
+ $Feed['itunes_new_feed_url'] = str_replace('&amp;', '&', $Feed['itunes_new_feed_url']);
617
+ echo "\t<itunes:new-feed-url>". htmlspecialchars(trim($Feed['itunes_new_feed_url'])) .'</itunes:new-feed-url>'.PHP_EOL;
618
+ }
619
+
620
+ if( !empty($General['itunes_cdata']) ) {
621
+ if( !empty($Feed['itunes_summary']) )
622
+ echo "\t".'<itunes:summary><![CDATA['. powerpress_format_itunes_value( $Feed['itunes_summary'], 'summary', true ) .']]></itunes:summary>'.PHP_EOL;
623
+ else
624
+ echo "\t".'<itunes:summary><![CDATA['. powerpress_format_itunes_value( get_bloginfo('description'), 'summary', true ) .']]></itunes:summary>'.PHP_EOL;
625
+ } else {
626
+ if( !empty($Feed['itunes_summary']) )
627
+ echo "\t".'<itunes:summary>'. powerpress_format_itunes_value( $Feed['itunes_summary'], 'summary' ) .'</itunes:summary>'.PHP_EOL;
628
+ else
629
+ echo "\t".'<itunes:summary>'. powerpress_format_itunes_value( get_bloginfo('description'), 'summary' ) .'</itunes:summary>'.PHP_EOL;
630
+ }
631
+
632
+ if( !empty($powerpress_feed['itunes_talent_name']) )
633
+ echo "\t<itunes:author>" . esc_html($powerpress_feed['itunes_talent_name']) . '</itunes:author>'.PHP_EOL;
634
+
635
+ if( !empty($powerpress_feed['explicit']) && $powerpress_feed['explicit'] != 'no' )
636
+ echo "\t".'<itunes:explicit>' . $powerpress_feed['explicit'] . '</itunes:explicit>'.PHP_EOL;
637
+
638
+ if( !empty($Feed['itunes_block']) )
639
+ echo "\t<itunes:block>yes</itunes:block>".PHP_EOL;
640
+
641
+ if( !empty($Feed['itunes_complete']) )
642
+ echo "\t<itunes:complete>yes</itunes:complete>".PHP_EOL;
643
+
644
+ if( !empty($Feed['itunes_image']) )
645
+ {
646
+ echo "\t".'<itunes:image href="' . esc_html( powerpress_url_in_feed(str_replace(' ', '+', $Feed['itunes_image'])), 'double') . '" />'.PHP_EOL;
647
+ }
648
+ else
649
+ {
650
+ echo "\t".'<itunes:image href="' . powerpress_url_in_feed(powerpress_get_root_url()) . 'itunes_default.jpg" />'.PHP_EOL;
651
+ }
652
+
653
+ if( !empty($Feed['itunes_type']) ) {
654
+ echo "\t".'<itunes:type>'. esc_html($Feed['itunes_type']) .'</itunes:type>'.PHP_EOL;
655
+ }
656
+
657
+ if( !empty($Feed['email']) )
658
+ {
659
+ echo "\t".'<itunes:owner>'.PHP_EOL;
660
+ echo "\t\t".'<itunes:name>' . esc_html($powerpress_feed['itunes_talent_name']) . '</itunes:name>'.PHP_EOL;
661
+ echo "\t\t".'<itunes:email>' . esc_html($Feed['email']) . '</itunes:email>'.PHP_EOL;
662
+ echo "\t".'</itunes:owner>'.PHP_EOL;
663
+ echo "\t".'<managingEditor>'. esc_html($Feed['email'] .' ('. $powerpress_feed['itunes_talent_name'] .')') .'</managingEditor>'.PHP_EOL;
664
+ }
665
+
666
+ if( !empty($Feed['copyright']) )
667
+ {
668
+ // In case the user entered the copyright html version or the copyright UTF-8 or ASCII symbol or just (c)
669
+ $Feed['copyright'] = str_replace(array('&copy;', '(c)', '(C)', chr(194) . chr(169), chr(169) ), '&#xA9;', $Feed['copyright']);
670
+ echo "\t".'<copyright>'. esc_html($Feed['copyright']) . '</copyright>'.PHP_EOL;
671
+ }
672
+
673
+ if( !empty($Feed['itunes_subtitle']) )
674
+ echo "\t".'<itunes:subtitle>' . powerpress_format_itunes_value($Feed['itunes_subtitle'], 'subtitle') . '</itunes:subtitle>'.PHP_EOL;
675
+ else
676
+ echo "\t".'<itunes:subtitle>'. powerpress_format_itunes_value( get_bloginfo('description'), 'subtitle') .'</itunes:subtitle>'.PHP_EOL;
677
+ $podcast_title_safe = '';
678
+ if( version_compare($GLOBALS['wp_version'], 4.4, '<' ) ) {
679
+ $podcast_title_safe .= get_bloginfo_rss('name');
680
+ }
681
+ $podcast_title_safe .= get_wp_title_rss();
682
+ if( empty($General['disable_rss_image']) )
683
+ {
684
+ if( !empty($Feed['rss2_image']) || !empty($Feed['itunes_image']) )
685
+ {
686
+ if( !empty($Feed['rss2_image']) ) // If the RSS image is set, use it, otherwise use the iTunes image...
687
+ $rss_image = $Feed['rss2_image'];
688
+ else
689
+ $rss_image = $Feed['itunes_image'];
690
+
691
+ echo "\t". '<image>' .PHP_EOL;
692
+ echo "\t\t".'<title>' . $podcast_title_safe . '</title>'.PHP_EOL;
693
+ echo "\t\t".'<url>' . esc_html( str_replace(' ', '+', $rss_image)) . '</url>'.PHP_EOL;
694
+ echo "\t\t".'<link>'. $Feed['url'] . '</link>' . PHP_EOL;
695
+ echo "\t".'</image>' . PHP_EOL;
696
+ }
697
+ else // Use the default image
698
+ {
699
+ echo "\t". '<image>' .PHP_EOL;
700
+ echo "\t\t".'<title>' . $podcast_title_safe . '</title>'.PHP_EOL;
701
+ echo "\t\t".'<url>' . powerpress_get_root_url() . 'rss_default.jpg</url>'.PHP_EOL;
702
+ echo "\t\t".'<link>'. $Feed['url'] . '</link>' . PHP_EOL;
703
+ echo "\t".'</image>' . PHP_EOL;
704
+ }
705
+ }
706
+
707
+ // Handle iTunes categories
708
+ $Cat1 = false; $Cat2 = false; $Cat3 = false; $SubCat1 = false; $SubCat2 = false; $SubCat3 = false;
709
+ if(defined('POWERPRESS_NEW_APPLE_CATEGORIES') && POWERPRESS_NEW_APPLE_CATEGORIES == true) {
710
+ $Categories = powerpress_apple_categories();
711
+ for ($i = 1; $i <= 3; $i++) {
712
+ if(!empty($Feed['itunes_cat_'.$i]) && empty($Feed['apple_cat_'.$i])) {
713
+ $mappings = array('01-00' => '01-00', '01-01' => '01-02', '01-02' => '01-03', '01-03' => '01-04', '01-04' => '01-01',
714
+ '01-05' => '01-05', '01-06' => '01-06', '02-00' => '02-00', '02-01' => '12-01', '02-02' => '02-01', '02-03' => '02-03',
715
+ '02-04' => '02-00', '02-05' => '02-00', '03-00' => '03-00', '04-00' => '04-00', '04-01' => '04-00', '04-02' => '04-00',
716
+ '04-03' => '09-01', '04-04' => '04-03', '04-05' => '04-00', '05-00' => '10-00', '05-01' => '10-02', '05-02' => '10-03',
717
+ '05-03' => '10-06', '05-04' => '10-05', '05-05' => '10-05', '06-00' => '06-00', '06-01' => '06-00', '06-02' => '06-00',
718
+ '06-03' => '06-00', '06-04' => '06-00', '07-00' => '07-00', '07-01' => '07-01', '07-02' => '07-00', '07-03' => '04-04',
719
+ '07-04' => '07-06', '08-00' => '09-00', '09-00' => '11-00', '11-00' => '13-00', '11-01' => '13-01', '11-02' => '13-02',
720
+ '11-03' => '13-03', '11-04' => '13-04', '11-05' => '13-05', '11-06' => '13-06', '11-07' => '13-07', '12-00' => '14-00',
721
+ '12-01' => '07-03', '12-02' => '14-06', '12-03' => '14-09', '13-00' => '15-00', '13-01' => '08-00', '13-02' => '15-02',
722
+ '13-03' => '15-03', '13-04' => '15-04', '14-00' => '16-00', '14-01' => '16-00', '14-02' => '16-00', '14-03' => '16-15',
723
+ '14-04' => '16-00', '15-00' => '17-00', '15-01' => '17-00', '15-02' => '12-07', '15-03' => '17-00', '15-04' => '17-00', '16-00' => '19-00');
724
+ $Feed['apple_cat_'. $i] = $mappings[$Feed['itunes_cat_'.$i]];
725
+
726
+ }
727
+ }
728
+ if (!empty($Feed['apple_cat_1']))
729
+ list($Cat1, $SubCat1) = explode('-', $Feed['apple_cat_1']);
730
+ if (!empty($Feed['apple_cat_2']))
731
+ list($Cat2, $SubCat2) = explode('-', $Feed['apple_cat_2']);
732
+ if (!empty($Feed['apple_cat_3']))
733
+ list($Cat3, $SubCat3) = explode('-', $Feed['apple_cat_3']);
734
+ }
735
+ else {
736
+ $Categories = powerpress_itunes_categories();
737
+ if (!empty($Feed['itunes_cat_1']))
738
+ list($Cat1, $SubCat1) = explode('-', $Feed['itunes_cat_1']);
739
+ if (!empty($Feed['itunes_cat_2']))
740
+ list($Cat2, $SubCat2) = explode('-', $Feed['itunes_cat_2']);
741
+ if (!empty($Feed['itunes_cat_3']))
742
+ list($Cat3, $SubCat3) = explode('-', $Feed['itunes_cat_3']);
743
+ }
744
+
745
+ if( $Cat1 )
746
+ {
747
+ $CatDesc = $Categories[$Cat1.'-00'];
748
+ $SubCatDesc = $Categories[$Cat1.'-'.$SubCat1];
749
+ echo "\t".'<itunes:category text="'. esc_html($CatDesc) .'">'.PHP_EOL;
750
+ if( $SubCat1 != '00' )
751
+ echo "\t\t".'<itunes:category text="'. esc_html($SubCatDesc) .'"></itunes:category>'.PHP_EOL;
752
+
753
+ // End this category set
754
+ echo "\t".'</itunes:category>'.PHP_EOL;
755
+ }
756
+
757
+ if( $Cat2 )
758
+ {
759
+ $CatDesc = $Categories[$Cat2.'-00'];
760
+ $SubCatDesc = $Categories[$Cat2.'-'.$SubCat2];
761
+
762
+ echo "\t".'<itunes:category text="'. esc_html($CatDesc) .'">'.PHP_EOL;
763
+ if( $SubCat2 != '00' )
764
+ echo "\t\t".'<itunes:category text="'. esc_html($SubCatDesc) .'"></itunes:category>'.PHP_EOL;
765
+ echo "\t".'</itunes:category>'.PHP_EOL;
766
+ }
767
+
768
+ if( $Cat3 )
769
+ {
770
+ $CatDesc = $Categories[$Cat3.'-00'];
771
+ $SubCatDesc = $Categories[$Cat3.'-'.$SubCat3];
772
+
773
+ echo "\t".'<itunes:category text="'. esc_html($CatDesc) .'">'.PHP_EOL;
774
+ if( $SubCat3 != '00' )
775
+ echo "\t\t".'<itunes:category text="'. esc_html($SubCatDesc) .'"></itunes:category>'.PHP_EOL;
776
+ // End this category set
777
+ echo "\t".'</itunes:category>'.PHP_EOL;
778
+ }
779
+ // End Handle iTunes categories
780
+
781
+ if( !empty($Feed['googleplay_email']) )
782
+ {
783
+ echo "\t".'<googleplay:email>' . esc_html($Feed['googleplay_email']) . '</googleplay:email>'.PHP_EOL;
784
+ }
785
+
786
+ if( !empty($Feed['googleplay_description']) )
787
+ {
788
+ echo "\t".'<googleplay:description>' . esc_html($Feed['googleplay_description']) . '</googleplay:description>'.PHP_EOL;
789
+ }
790
+
791
+ if( !empty($Feed['googleplay_explicit']) )
792
+ {
793
+ echo "\t".'<googleplay:explicit>Yes</googleplay:explicit>'.PHP_EOL;
794
+ }
795
+
796
+ // google_play_cat // google_play_explicit
797
+ if( !empty($Feed['googleplay_cat']) )
798
+ {
799
+ $play_cats = powerpress_googleplay_categories();
800
+ if( !empty($play_cats[ $Feed['googleplay_cat'] ]) )
801
+ {
802
+ echo "\t".'<googleplay:category text="'. esc_html($play_cats[ $Feed['googleplay_cat'] ]) .'" />'.PHP_EOL;
803
+ }
804
+ }
805
+
806
+ if( !empty($Feed['googleplay_image']) )
807
+ {
808
+ echo "\t".'<googleplay:image href="' . esc_html( str_replace(' ', '+', $Feed['googleplay_image']), 'double') . '" />'.PHP_EOL;
809
+ }
810
+
811
+ // RawVoice RSS Tags
812
+ if( !defined('POWERPRESS_RAWVOICE_RSS') || POWERPRESS_RAWVOICE_RSS != false )
813
+ {
814
+ if( !empty($Feed['parental_rating']) )
815
+ echo "\t<rawvoice:rating>". $Feed['parental_rating'] ."</rawvoice:rating>".PHP_EOL;
816
+ if( !empty($Feed['location']) )
817
+ echo "\t<rawvoice:location>". htmlspecialchars($Feed['location']) ."</rawvoice:location>".PHP_EOL;
818
+ if( !empty($Feed['frequency']) )
819
+ echo "\t<rawvoice:frequency>". htmlspecialchars($Feed['frequency']) ."</rawvoice:frequency>".PHP_EOL;
820
+ if( !empty($Feed['donate_link']) && !empty($Feed['donate_url']) )
821
+ echo "\t<rawvoice:donate href=\"". htmlspecialchars( $Feed['donate_url'] ) ."\">". htmlspecialchars( (empty($Feed['donate_label'])?'':$Feed['donate_label']) ) ."</rawvoice:donate>".PHP_EOL;
822
+
823
+ if( !empty($Feed['itunes_url']) || !empty($Feed['blubrry_url']) || !empty($Feed['stitcher_url']) || !empty($Feed['tunein_url']) || !empty($Feed['spotify_url']) ) {
824
+ echo "\t<rawvoice:subscribe feed=\"";
825
+ self_link();
826
+ echo '"';
827
+
828
+ // Subscribe page // empty($FeedSettings['subscribe_page_link_href']) && empty($FeedSettings['subscribe_page_link_id'])
829
+ if( !empty($Feed['subscribe_page_link_id']) ) {
830
+ $link = get_page_link($Feed['subscribe_page_link_id']);
831
+ if( !empty($link) ) {
832
+ echo " html=\"". htmlspecialchars( $link ) .'"';
833
+ }
834
+ } else if( !empty($Feed['subscribe_page_link_href']) ) {
835
+ echo " html=\"". htmlspecialchars( $Feed['subscribe_page_link_href'] ) .'"';
836
+ }
837
+
838
+ if( !empty($Feed['itunes_url']) )
839
+ echo " itunes=\"". htmlspecialchars( $Feed['itunes_url'] ) .'"';
840
+ if( !empty($Feed['blubrry_url']) )
841
+ echo " blubrry=\"". htmlspecialchars( $Feed['blubrry_url'] ) .'"';
842
+ if( !empty($Feed['stitcher_url']) )
843
+ echo " stitcher=\"". htmlspecialchars( $Feed['stitcher_url'] ) .'"';
844
+ if( !empty($Feed['tunein_url']) )
845
+ echo " tunein=\"". htmlspecialchars( $Feed['tunein_url'] ) .'"';
846
+ if( !empty($Feed['spotify_url']) )
847
+ echo " spotify=\"". htmlspecialchars( $Feed['spotify_url'] ) .'"';
848
+ echo "></rawvoice:subscribe>".PHP_EOL;
849
+ }
850
+ }
851
+ }
852
+
853
+ add_action('rss2_head', 'powerpress_rss2_head');
854
+ add_action('rss2_head_powerpress', 'powerpress_rss2_head');
855
+
856
+ function powerpress_rss2_item()
857
+ {
858
+ global $post, $powerpress_feed;
859
+
860
+ // are we processing a feed that powerpress should handle
861
+ if( !powerpress_is_podcast_feed() )
862
+ return;
863
+
864
+ if( function_exists('post_password_required') )
865
+ {
866
+ if( post_password_required($post) )
867
+ return;
868
+ }
869
+
870
+ // Check and see if we're working with a podcast episode
871
+ $custom_enclosure = false;
872
+ if( powerpress_is_custom_podcast_feed() && get_query_var('feed') !== 'podcast' && !is_category() && !is_tax() && !is_tag() )
873
+ {
874
+ $EpisodeData = powerpress_get_enclosure_data($post->ID, get_query_var('feed') );
875
+ $custom_enclosure = true;
876
+ }
877
+ else
878
+ {
879
+ $EpisodeData = powerpress_get_enclosure_data($post->ID, 'podcast');
880
+ if( !$EpisodeData && !empty($powerpress_feed['process_podpress']) )
881
+ {
882
+ $EpisodeData = powerpress_get_enclosure_data_podpress($post->ID);
883
+ $custom_enclosure = true;
884
+ }
885
+ }
886
+
887
+ // No episode data to include
888
+ if( empty($EpisodeData) || empty($EpisodeData['url']) )
889
+ return;
890
+
891
+ // If enclosure not added, check to see why...
892
+ if( defined('POWERPRESS_ENCLOSURE_FIX') && POWERPRESS_ENCLOSURE_FIX && !$custom_enclosure && $GLOBALS['powerpress_rss_enclosure_post_id'] != $post->ID )
893
+ {
894
+ $enclosure_in_wp = apply_filters('rss_enclosure', '<enclosure url="' . trim(htmlspecialchars($EpisodeData['url']) . '" length="' . $EpisodeData['size'] . '" type="' . $EpisodeData['type'] . '" />' . "\n") );
895
+ if( !$enclosure_in_wp )
896
+ $custom_enclosure = true;
897
+ }
898
+
899
+ // Lets print the enclosure tag
900
+ if( $custom_enclosure ) // We need to add the enclosure tag here...
901
+ {
902
+ if( empty($EpisodeData['size']) )
903
+ $EpisodeData['size'] = 5242880; // Use the dummy 5MB size since we don't have a size to quote
904
+
905
+ echo "\t". sprintf('<enclosure url="%s" length="%d" type="%s" />%s',
906
+ powerpress_url_in_feed(trim($EpisodeData['url'])),
907
+ trim($EpisodeData['size']),
908
+ trim($EpisodeData['type']),
909
+ PHP_EOL);
910
+ }
911
+
912
+ $author = $powerpress_feed['itunes_talent_name'];
913
+ if( isset($powerpress_feed['itunes_author_post']) )
914
+ $author = get_the_author();
915
+
916
+ $explicit = $powerpress_feed['explicit'];
917
+ $summary = '';
918
+ $subtitle = '';
919
+ $block = false;
920
+ $cc = false;
921
+
922
+ if( isset( $EpisodeData['summary'] ) && strlen($EpisodeData['summary']) > 1 )
923
+ $summary = $EpisodeData['summary'];
924
+ if( isset( $EpisodeData['subtitle'] ) && strlen($EpisodeData['subtitle']) > 1 )
925
+ $subtitle = $EpisodeData['subtitle'];
926
+ if( isset( $EpisodeData['explicit'] ) && is_numeric($EpisodeData['explicit']) )
927
+ {
928
+ $explicit_array = array("no", "yes", "clean");
929
+ $explicit = $explicit_array[$EpisodeData['explicit']];
930
+ }
931
+
932
+ if( !empty( $EpisodeData['author'] ) )
933
+ $author = $EpisodeData['author'];
934
+ if( !empty( $EpisodeData['block'] ) )
935
+ $block = 'yes';
936
+ if( !empty( $EpisodeData['cc'] ) )
937
+ $cc = 'yes';
938
+
939
+ $General = get_option('powerpress_general');
940
+ $summary_cdata = ( !empty( $General['itunes_cdata'] ) ? true : false );
941
+
942
+ if( empty($subtitle) ) {
943
+ $subtitle = powerpress_get_the_exerpt( false, !empty($General['feed_action_hook']) );
944
+ }
945
+
946
+ // If no summary specified and we have enhanced summary enabled...
947
+ if( empty($summary) && !empty($powerpress_feed['enhance_itunes_summary']) ) {
948
+ $summary = powerpress_enhanced_itunes_summary( !empty($General['feed_action_hook']) );
949
+ if( !empty($summary) ) {
950
+ $summary_cdata = true; // Always use CDATA for enhanced iTunes summary
951
+ }
952
+ }
953
+
954
+ if( empty($summary) ) { // Backwards compatibility with PodPress, the excerpt is used as the itunes summary if set
955
+ $summary = powerpress_get_the_exerpt( true, !empty($General['feed_action_hook']) ); // Will call powerpress_get_the_content(true) if the excerpt does not exist
956
+ }
957
+
958
+ if( !empty($subtitle) ) {
959
+ echo "\t<itunes:subtitle>". powerpress_format_itunes_value($subtitle, 'subtitle') .'</itunes:subtitle>'.PHP_EOL;
960
+ }
961
+
962
+ if( !empty($summary) ) {
963
+ if( $summary_cdata ) {
964
+ echo "\t\t<itunes:summary><![CDATA[". powerpress_format_itunes_value($summary, 'summary', true) .']]></itunes:summary>'.PHP_EOL;
965
+ } else {
966
+ echo "\t\t<itunes:summary>". powerpress_format_itunes_value($summary, 'summary') .'</itunes:summary>'.PHP_EOL;
967
+ }
968
+ }
969
+
970
+ if( !empty($author) ) {
971
+ echo "\t\t<itunes:author>" . esc_html($author) . '</itunes:author>'.PHP_EOL;
972
+ }
973
+
974
+ // itunes episode image
975
+ if( !empty( $EpisodeData['itunes_image']) ) {
976
+ echo "\t\t".'<itunes:image href="' . esc_html( powerpress_url_in_feed(str_replace(' ', '+', $EpisodeData['itunes_image'])), 'double') . '" />'.PHP_EOL;
977
+ } else if( !empty($powerpress_feed['itunes_image']) ) {
978
+ echo "\t\t".'<itunes:image href="' . esc_html( powerpress_url_in_feed(str_replace(' ', '+', $powerpress_feed['itunes_image'])), 'double') . '" />'.PHP_EOL;
979
+ }
980
+
981
+ if( !empty($EpisodeData['season']) ) {
982
+ echo "\t\t".'<itunes:season>'. esc_html($EpisodeData['season']) .'</itunes:season>'.PHP_EOL;
983
+ }
984
+
985
+ if( !empty($EpisodeData['episode_no']) ) {
986
+ echo "\t\t".'<itunes:episode>'. esc_html($EpisodeData['episode_no']) .'</itunes:episode>'.PHP_EOL;
987
+ }
988
+
989
+ if( !empty($EpisodeData['episode_title']) ) {
990
+ echo "\t\t".'<itunes:title>'. esc_html($EpisodeData['episode_title']) .'</itunes:title>'.PHP_EOL;
991
+ }
992
+
993
+ if( !empty($EpisodeData['episode_type']) ) {
994
+ echo "\t\t".'<itunes:episodeType>'. esc_html($EpisodeData['episode_type']) .'</itunes:episodeType>'.PHP_EOL;
995
+ }
996
+
997
+ if( !empty($explicit) && $explicit != 'no' ) {
998
+ echo "\t\t<itunes:explicit>" . $explicit . '</itunes:explicit>'.PHP_EOL;
999
+ }
1000
+
1001
+ if( !empty($EpisodeData['duration']) && preg_match('/^(\d{1,2}:){0,2}\d{1,2}$/i', ltrim($EpisodeData['duration'], '0:') ) ) { // Include duration if it is valid
1002
+ echo "\t\t<itunes:duration>" . ltrim($EpisodeData['duration'], '0:') . '</itunes:duration>'.PHP_EOL;
1003
+ }
1004
+
1005
+ if( $block && $block == 'yes' ) {
1006
+ echo "\t\t<itunes:block>yes</itunes:block>".PHP_EOL;
1007
+ }
1008
+
1009
+ if( $cc && $cc == 'yes' ) {
1010
+ echo "\t\t<itunes:isClosedCaptioned>yes</itunes:isClosedCaptioned>".PHP_EOL;
1011
+ }
1012
+
1013
+ if( !empty($powerpress_feed['itunes_feature']) ) { // We are using the itunes:order option to feature a specific episode.
1014
+ // Skip inserting the order tag
1015
+ } else {
1016
+ if( isset( $EpisodeData['order'] ) && is_numeric( $EpisodeData['order'] ) )
1017
+ echo "\t\t<itunes:order>". $EpisodeData['order'] ."</itunes:order>".PHP_EOL;
1018
+ }
1019
+
1020
+ // Google Play tags:
1021
+ if( empty($powerpress_feed['feed_maximizer_on']) ) { // These tags for the most part replicate what is in the itunes tags, so lets not include them when we want to maximize the feed
1022
+ if( !empty( $EpisodeData['gp_desc'] ) ) {
1023
+ echo "\t\t<googleplay:description>". powerpress_format_itunes_value($EpisodeData['gp_desc'], 'summary') ."</googleplay:description>".PHP_EOL;
1024
+ }
1025
+
1026
+ if( !empty( $EpisodeData['gp_explicit'] ) ) {
1027
+ echo "\t\t<googleplay:explicit>yes</googleplay:explicit>".PHP_EOL;
1028
+ }
1029
+ }
1030
+
1031
+ if( !empty( $EpisodeData['gp_block'] ) ) {
1032
+ echo "\t\t<googleplay:block>yes</googleplay:block>".PHP_EOL;
1033
+ }
1034
+
1035
+
1036
+ // RawVoice RSS Tags
1037
+ if( empty($powerpress_feed['feed_maximizer_on']) )
1038
+ {
1039
+ if( !defined('POWERPRESS_RAWVOICE_RSS') || POWERPRESS_RAWVOICE_RSS != false )
1040
+ {
1041
+ if( !empty($EpisodeData['ishd']) )
1042
+ echo "\t\t<rawvoice:isHD>yes</rawvoice:isHD>".PHP_EOL;;
1043
+ if( !empty($EpisodeData['image']) )
1044
+ echo "\t\t<rawvoice:poster url=\"". $EpisodeData['image'] ."\" />".PHP_EOL;
1045
+ if( !empty($EpisodeData['embed']) )
1046
+ echo "\t\t<rawvoice:embed>". htmlspecialchars($EpisodeData['embed']) ."</rawvoice:embed>".PHP_EOL;
1047
+ else if( !empty($powerpress_feed['podcast_embed_in_feed']) && function_exists('powerpress_generate_embed') )
1048
+ {
1049
+ $player = powerpressplayer_embedable($EpisodeData['url'], $EpisodeData);
1050
+ $embed_content = '';
1051
+
1052
+ if( $player )
1053
+ $embed_content = powerpress_generate_embed($player, $EpisodeData);
1054
+ if( $embed_content )
1055
+ echo "\t\t<rawvoice:embed>". htmlspecialchars( $embed_content ) ."</rawvoice:embed>".PHP_EOL;
1056
+ }
1057
+
1058
+ if( !empty($EpisodeData['webm_src']) )
1059
+ {
1060
+ echo "\t\t<rawvoice:webm src=\"". $EpisodeData['webm_src'] ."\"";
1061
+ if( $EpisodeData['webm_length'] )
1062
+ echo " length=\"". $EpisodeData['webm_length'] ."\"";
1063
+ echo " type=\"video/webm\" />".PHP_EOL;
1064
+ }
1065
+
1066
+ $GeneralSettings = get_option('powerpress_general');
1067
+
1068
+ if( !empty($GeneralSettings) && !empty($GeneralSettings['metamarks']) )
1069
+ {
1070
+ require_once(POWERPRESS_ABSPATH .'/powerpressadmin-metamarks.php');
1071
+ powerpress_metamarks_print_rss2($EpisodeData);
1072
+ }
1073
+ }
1074
+ }
1075
+ }
1076
+
1077
+ add_action('rss2_item', 'powerpress_rss2_item');
1078
+ add_action('rss2_item_powerpress', 'powerpress_rss2_item');
1079
+
1080
+ /*
1081
+ This filter is only necessary for feeds that are not specifically for podcasting, e.g. a category feed that did not have category podcasting added to it
1082
+ */
1083
+ function powerpress_filter_rss_enclosure($content)
1084
+ {
1085
+ if( defined('PODPRESS_VERSION') || isset($GLOBALS['podcasting_player_id']) || isset($GLOBALS['podcast_channel_active']) || defined('PODCASTING_VERSION') ) {
1086
+ return $content; // Another podcasting plugin is enabled...
1087
+ }
1088
+
1089
+ if( powerpress_is_custom_podcast_feed() && get_query_var('feed') !== 'podcast' && !is_category() && !is_tag() && !is_tax() )
1090
+ return ''; // We will handle this enclosure in the powerpress_rss2_item() function
1091
+
1092
+ $match_count = preg_match('/\surl="([^"]*)"/', $content, $matches); // No URL found, weird
1093
+ if( count($matches) != 2)
1094
+ return $content;
1095
+
1096
+ // Original Media URL
1097
+ $OrigURL = $matches[1];
1098
+
1099
+ if( substr($OrigURL, 0, 5) != 'http:' && substr($OrigURL, 0, 6) != 'https:' )
1100
+ return ''; // The URL value is invalid
1101
+
1102
+ global $post, $powerpress_rss_enclosure_post_id;
1103
+ if( empty($powerpress_rss_enclosure_post_id) )
1104
+ $powerpress_rss_enclosure_post_id = -1;
1105
+
1106
+ if( $powerpress_rss_enclosure_post_id == $post->ID )
1107
+ return ''; // we've already included one enclosure, lets not allow anymore
1108
+ $powerpress_rss_enclosure_post_id = $post->ID;
1109
+
1110
+ $EpisodeData = powerpress_get_enclosure_data($post->ID);
1111
+
1112
+ // Modified Media URL
1113
+ $ModifiedURL = powerpress_url_in_feed($EpisodeData['url']); // powerpress_add_redirect_url($OrigURL);
1114
+
1115
+ // Check that the content type is a valid one...
1116
+ $match_count = preg_match('/\stype="([^"]*)"/', $content, $matches);
1117
+ if( count($matches) > 1 && strstr($matches[1], '/') == false )
1118
+ {
1119
+ $ContentType = powerpress_get_contenttype($ModifiedURL);
1120
+ $content = str_replace("type=\"{$matches[1]}\"", "type=\"$ContentType\"", $content);
1121
+ }
1122
+
1123
+ // Check that the content length is a digit greater that zero
1124
+ $match_count = preg_match('/\slength="([^"]*)"/', $content, $matches);
1125
+ if( count($matches) > 1 && empty($matches[1]) )
1126
+ {
1127
+ $content = str_replace("length=\"{$matches[1]}\"", "length=\"5242880\"", $content);
1128
+ }
1129
+
1130
+ // Replace the original url with the modified one...
1131
+ if( $OrigURL != $ModifiedURL )
1132
+ return str_replace($OrigURL, $ModifiedURL, $content);
1133
+ return $content;
1134
+ }
1135
+
1136
+
1137
+ add_filter('rss_enclosure', 'powerpress_filter_rss_enclosure', 11);
1138
+
1139
+ function powerpress_bloginfo_rss($content, $field = '')
1140
+ {
1141
+ $new_value = '';
1142
+ if( powerpress_is_custom_podcast_feed() )
1143
+ {
1144
+ if( is_category() ) {
1145
+ $Feed = get_option('powerpress_cat_feed_'.get_query_var('cat') );
1146
+ }
1147
+ else if( is_tax() || is_tag() ) {
1148
+ global $powerpress_feed;
1149
+ if( !empty($powerpress_feed['term_taxonomy_id']) )
1150
+ $Feed = get_option('powerpress_taxonomy_'.$powerpress_feed['term_taxonomy_id'] );
1151
+ }
1152
+ else
1153
+ {
1154
+ global $powerpress_feed;
1155
+
1156
+ if( !empty($powerpress_feed['post_type']) )
1157
+ {
1158
+ $feed_slug = get_query_var('feed');
1159
+ $PostTypeSettingsArray = get_option('powerpress_posttype_'.$powerpress_feed['post_type'] );
1160
+ if( !empty($PostTypeSettingsArray[ $feed_slug ]) )
1161
+ $Feed = $PostTypeSettingsArray[ $feed_slug ];
1162
+ }
1163
+ else
1164
+ {
1165
+ $Feed = get_option('powerpress_feed_'.get_query_var('feed') );
1166
+ if( empty($Feed) && get_query_var('feed') === 'podcast' )
1167
+ $Feed = get_option('powerpress_feed');
1168
+ }
1169
+ }
1170
+
1171
+ if( $Feed )
1172
+ {
1173
+ switch( $field )
1174
+ {
1175
+ case 'description': {
1176
+ if( !empty($Feed['description']) )
1177
+ $new_value = $Feed['description'];
1178
+ else if( is_category() )
1179
+ {
1180
+ $category = get_category( get_query_var('cat') );
1181
+ if( $category->description )
1182
+ $new_value = $category->description;
1183
+ }
1184
+ }; break;
1185
+ case 'url': {
1186
+ // If the website URL is set for this podcast then lets use it...
1187
+ if( !empty($Feed['url']) )
1188
+ return trim($Feed['url']);
1189
+
1190
+ if( is_category() ) {
1191
+ return get_category_link( get_query_var('cat') );
1192
+ } else {
1193
+ $urlTemp = '';
1194
+ $blogHomepage = get_option('page_for_posts');
1195
+ if( !empty($blogHomepage) ) {
1196
+ $urlTemp = get_permalink( $blogHomepage );
1197
+ }
1198
+
1199
+ if( empty($urlTemp) )
1200
+ $urlTemp = get_bloginfo('url');
1201
+ if( !empty($urlTemp) )
1202
+ return $urlTemp;
1203
+ }
1204
+ }; break;
1205
+ case 'name': { // As of wp 4.4+ title is handled by get_the_title_rss completely.
1206
+ if( !empty($Feed['title']) )
1207
+ $new_value = $Feed['title'];
1208
+ }; break;
1209
+ case 'language': {
1210
+ // Get the feed language
1211
+ $lang = '';
1212
+ if( isset($Feed['rss_language']) && $Feed['rss_language'] != '' )
1213
+ $lang = $Feed['rss_language'];
1214
+ if( strlen($lang) == 5 )
1215
+ $lang = substr($lang,0,3) . strtoupper( substr($lang, 3) ); // Format example: en-US for English, United States
1216
+ if( !empty($lang) )
1217
+ return $lang;
1218
+ }; break;
1219
+ }
1220
+ }
1221
+ }
1222
+
1223
+ if( !empty($new_value) )
1224
+ {
1225
+ $new_value = wptexturize($new_value);
1226
+ $new_value = convert_chars($new_value);
1227
+ $new_value = esc_html($new_value);
1228
+ //$new_value = convert_chars($new_value);
1229
+ return $new_value;
1230
+ }
1231
+
1232
+ return $content;
1233
+ }
1234
+
1235
+ add_filter('get_bloginfo_rss', 'powerpress_bloginfo_rss', 10, 2);
1236
+
1237
+
1238
+ function powerpress_wp_title_rss($title)
1239
+ {
1240
+ if( version_compare($GLOBALS['wp_version'], 4.4, '>=' ) )
1241
+ {
1242
+ if( powerpress_is_custom_podcast_feed() )
1243
+ {
1244
+ if( is_category() ) {
1245
+ $Feed = get_option('powerpress_cat_feed_'.get_query_var('cat') );
1246
+ }
1247
+ else if( is_tax() || is_tag() ) {
1248
+ global $powerpress_feed;
1249
+ if( !empty($powerpress_feed['term_taxonomy_id']) )
1250
+ $Feed = get_option('powerpress_taxonomy_'.$powerpress_feed['term_taxonomy_id'] );
1251
+ }
1252
+ else
1253
+ {
1254
+ global $powerpress_feed;
1255
+
1256
+ if( !empty($powerpress_feed['post_type']) )
1257
+ {
1258
+ $feed_slug = get_query_var('feed');
1259
+ if( !empty($feed_slug) ) {
1260
+ $PostTypeSettingsArray = get_option('powerpress_posttype_'.$powerpress_feed['post_type'] );
1261
+ if( !empty($PostTypeSettingsArray[ $feed_slug ]) )
1262
+ $Feed = $PostTypeSettingsArray[ $feed_slug ];
1263
+ }
1264
+ }
1265
+ else
1266
+ {
1267
+ $feed_slug = get_query_var('feed');
1268
+ $Feed = false;
1269
+ if( !empty($feed_slug) ) {
1270
+ $Feed = get_option('powerpress_feed_'.get_query_var('feed') );
1271
+ }
1272
+ if( empty($Feed) && get_query_var('feed') === 'podcast' )
1273
+ $Feed = get_option('powerpress_feed');
1274
+ }
1275
+ }
1276
+
1277
+ if( $Feed )
1278
+ {
1279
+ if( !empty($Feed['title']) )
1280
+ return esc_html( $Feed['title'] );
1281
+ }
1282
+ }
1283
+ }
1284
+ else
1285
+ {
1286
+ if( powerpress_is_custom_podcast_feed() )
1287
+ {
1288
+ if( is_category() )
1289
+ {
1290
+ $Feed = get_option('powerpress_cat_feed_'.get_query_var('cat') );
1291
+ if( $Feed && isset($Feed['title']) && $Feed['title'] != '' )
1292
+ return ''; // We alrady did a custom title, lets not add the category to it...
1293
+ }
1294
+ else
1295
+ {
1296
+ return ''; // It is not a category, lets not mess with our beautiful title then
1297
+ }
1298
+ }
1299
+ }
1300
+
1301
+ return $title;
1302
+ }
1303
+
1304
+ add_filter('get_wp_title_rss', 'powerpress_wp_title_rss');
1305
+
1306
+ function powerpress_the_title_rss($title)
1307
+ {
1308
+ $new_title = $title;
1309
+ $GeneralSettings = get_option('powerpress_general');
1310
+ // If it is a custom podcast channel...
1311
+ if( !empty($GeneralSettings['seo_feed_title']) )
1312
+ {
1313
+ $feed_slug = 'podcast';
1314
+ // IF custom post type or channel, use that feed slug...
1315
+ if( get_query_var('feed') !== 'podcast' && !is_category() && !is_tax() && !is_tag() )
1316
+ $feed_slug = get_query_var('feed');
1317
+
1318
+ // Get the episode specific title...
1319
+ $EpisodeData = powerpress_get_enclosure_data(get_the_ID(), $feed_slug);
1320
+ if( !empty($EpisodeData['feed_title']) )
1321
+ {
1322
+ $feed_title = ent2ncr( $EpisodeData['feed_title'] );
1323
+ $feed_title = strip_tags( $feed_title );
1324
+ $feed_title = esc_html( $feed_title );
1325
+
1326
+ //switch( $GeneralSettings['custom_feed_title'] )
1327
+ switch( $GeneralSettings['seo_feed_title'] )
1328
+ {
1329
+ case 1: { // Replaces title
1330
+ $new_title = $feed_title;
1331
+ }; break;
1332
+ case 2: { // Prefixes title
1333
+ $new_title = $feed_title . ' ' . $title;
1334
+ }; break;
1335
+ case 3: { // Postfixes title
1336
+ $new_title = $title . ' ' . $feed_title;
1337
+ }; break;
1338
+ }
1339
+ }
1340
+ }
1341
+
1342
+ return $new_title;
1343
+ }
1344
+
1345
+ add_filter('the_title_rss', 'powerpress_the_title_rss', 11);
1346
+
1347
+
1348
+ function powerpress_feed_content_type($content_type = '', $feedslug = '')
1349
+ {
1350
+ switch( $feedslug )
1351
+ {
1352
+ case 'rss':
1353
+ case 'rss2':
1354
+ case 'atom':
1355
+ case 'rdf': {
1356
+ // Do nothing, let WordPress take care of these
1357
+ }; break;
1358
+ case 'podcast': {
1359
+ // This one is ours!
1360
+ $content_type = 'application/rss+xml';
1361
+ }; break;
1362
+ default: { // Check for the custom podcast feeds
1363
+ $GeneralSettings = get_option('powerpress_general');
1364
+ if( !empty($GeneralSettings['custom_feeds'][ $feedslug ]) )
1365
+ {
1366
+ $content_type = 'application/rss+xml';
1367
+ }
1368
+ else if( !empty($GeneralSettings['posttype_podcasting']) )
1369
+ {
1370
+ // We need to look up these settings...
1371
+ $FeedSlugPostTypesArray = get_option('powerpress_posttype-podcasting');
1372
+ if( is_array($FeedSlugPostTypesArray) && !empty($FeedSlugPostTypesArray[ $feedslug ]) )
1373
+ {
1374
+ $content_type = 'application/rss+xml';
1375
+ }
1376
+ }
1377
+ }
1378
+ }
1379
+
1380
+ return $content_type;
1381
+ }
1382
+
1383
+ add_filter( 'feed_content_type', 'powerpress_feed_content_type', 10, 2 );
1384
+
1385
+ // Following code only works for WP 3.3 or older. WP 3.4+ now uses the get_locale setting, so we have to override directly in the get_bloginfo_rss functoin.
1386
+ if( version_compare($GLOBALS['wp_version'], '3.4', '<') )
1387
+ {
1388
+ function powerpress_rss_language($value)
1389
+ {
1390
+ if( powerpress_is_custom_podcast_feed() )
1391
+ {
1392
+ global $powerpress_feed;
1393
+ if( $powerpress_feed && isset($powerpress_feed['rss_language']) && $powerpress_feed['rss_language'] != '' )
1394
+ $value = $powerpress_feed['rss_language'];
1395
+ }
1396
+ return $value;
1397
+ }
1398
+
1399
+ add_filter('option_rss_language', 'powerpress_rss_language');
1400
+ }
1401
+
1402
+ function powerpress_do_podcast_feed($for_comments=false)
1403
+ {
1404
+ global $wp_query, $powerpress_feed;
1405
+
1406
+ powerpress_is_podcast_feed(); // Loads the feed settings if not already loaded...
1407
+
1408
+ $GeneralSettings = get_option('powerpress_general');
1409
+ if( isset($GeneralSettings['premium_caps']) && $GeneralSettings['premium_caps'] )
1410
+ {
1411
+ $feed_slug = get_query_var('feed');
1412
+
1413
+ if( $feed_slug != 'podcast' )
1414
+ {
1415
+ $FeedSettings = get_option('powerpress_feed_'.$feed_slug);
1416
+ if( !empty($FeedSettings['premium']) )
1417
+ {
1418
+ require_once( POWERPRESS_ABSPATH.'/powerpress-feed-auth.php');
1419
+ powerpress_feed_auth( $feed_slug );
1420
+ }
1421
+ }
1422
+ }
1423
+
1424
+ // Use the template to gurantee future WordPress behavior
1425
+ if( defined('POWERPRESS_FEED_TEMPLATE') ) {
1426
+ load_template( POWERPRESS_FEED_TEMPLATE );
1427
+ } else {
1428
+ load_template( POWERPRESS_ABSPATH . '/feed-podcast.php' );
1429
+ }
1430
+ }
1431
+
1432
+ function powerpress_template_redirect()
1433
+ {
1434
+ if( is_feed() && powerpress_is_custom_podcast_feed() )
1435
+ {
1436
+ if ( defined('WPSEO_VERSION') && version_compare(WPSEO_VERSION, '7.7', '>=') && class_exists( 'WPSEO_Frontend' ) ) {
1437
+ $wpseo_frontend = WPSEO_Frontend::get_instance();
1438
+ if( !empty($wpseo_frontend) ) {
1439
+ remove_action( 'template_redirect', array( $wpseo_frontend, 'noindex_feed' ) );
1440
+ }
1441
+ }
1442
+
1443
+ remove_action('template_redirect', 'ol_feed_redirect'); // Remove this action so feedsmith doesn't redirect
1444
+ global $powerpress_feed;
1445
+ if( !isset($powerpress_feed['feed_redirect_url']) )
1446
+ $powerpress_feed['feed_redirect_url'] = '';
1447
+ $redirect_value = ( !empty($_GET['redirect'])? $_GET['redirect'] : false );
1448
+ if( is_array($powerpress_feed) && trim($powerpress_feed['feed_redirect_url']) != '' && !preg_match("/feedburner|feedsqueezer|feedvalidator/i", $_SERVER['HTTP_USER_AGENT'] ) && $redirect_value != 'no' )
1449
+ {
1450
+ if (function_exists('status_header'))
1451
+ status_header( 301 );
1452
+ header("Location: " . trim($powerpress_feed['feed_redirect_url']));
1453
+ header("HTTP/1.1 301 Moved Permanently");
1454
+ exit();
1455
+ }
1456
+ }
1457
+ }
1458
+
1459
+ add_action('template_redirect', 'powerpress_template_redirect', 0);
1460
+
1461
+
1462
+ function powerpress_rewrite_rules_array($array)
1463
+ {
1464
+ global $wp_rewrite;
1465
+ $settings = get_option('powerpress_general');
1466
+
1467
+ $podcast_feeds = array('podcast'=>true);
1468
+ if( isset($settings['custom_feeds']) && is_array($settings['custom_feeds']) )
1469
+ $podcast_feeds = array_merge($settings['custom_feeds'], $podcast_feeds );
1470
+
1471
+ $merged_slugs = '';
1472
+ foreach( $podcast_feeds as $feed_slug=> $feed_title )
1473
+ {
1474
+ if( $merged_slugs != '' )
1475
+ $merged_slugs .= '|';
1476
+ $merged_slugs .= $feed_slug;
1477
+ }
1478
+
1479
+ // $wp_rewrite->index most likely index.php
1480
+ $new_array[ 'feed/('.$merged_slugs.')/?$' ] = $wp_rewrite->index. '?feed='. $wp_rewrite->preg_index(1);
1481
+
1482
+ // If feature is not enabled, use the default permalinks
1483
+ if( empty($settings['permalink_feeds_only']) )
1484
+ return array_merge($new_array, $array);
1485
+
1486
+ global $wpdb;
1487
+ reset($podcast_feeds);
1488
+ foreach( $podcast_feeds as $feed_slug=> $feed_title )
1489
+ {
1490
+ $page_name_id = $wpdb->get_var("SELECT ID FROM {$wpdb->posts} WHERE post_name = '".$feed_slug."'");
1491
+ if( $page_name_id )
1492
+ {
1493
+ $new_array[ $feed_slug.'/?$' ] = $wp_rewrite->index. '?pagename='. $feed_slug.'&page_id='.$page_name_id;
1494
+ unset($podcast_feeds[ $feed_slug ]);
1495
+ continue;
1496
+ }
1497
+
1498
+ $category = get_category_by_slug($feed_slug);
1499
+ if( $category )
1500
+ {
1501
+ $new_array[ $feed_slug.'/?$' ] = $wp_rewrite->index. '?cat='. $category->term_id; // category_name='. $feed_slug .'&
1502
+ unset($podcast_feeds[ $feed_slug ]);
1503
+ }
1504
+ }
1505
+
1506
+ if( count($podcast_feeds) > 0 )
1507
+ {
1508
+ reset($podcast_feeds);
1509
+ $remaining_slugs = '';
1510
+ foreach( $podcast_feeds as $feed_slug=> $feed_title )
1511
+ {
1512
+ if( $remaining_slugs != '' )
1513
+ $remaining_slugs .= '|';
1514
+ $remaining_slugs .= $feed_slug;
1515
+ }
1516
+
1517
+ $new_array[ '('.$remaining_slugs.')/?$' ] = $wp_rewrite->index. '?pagename='. $wp_rewrite->preg_index(1);
1518
+ }
1519
+
1520
+ return array_merge($new_array, $array);
1521
+ }
1522
+
1523
+ add_filter('rewrite_rules_array', 'powerpress_rewrite_rules_array');
1524
+
1525
+
1526
+ function powerpress_pre_transient_rewrite_rules($return_rules)
1527
+ {
1528
+ global $wp_rewrite;
1529
+ $GeneralSettings = get_option('powerpress_general');
1530
+ if( !in_array('podcast', $wp_rewrite->feeds) )
1531
+ $wp_rewrite->feeds[] = 'podcast';
1532
+
1533
+ if( $GeneralSettings && isset($GeneralSettings['custom_feeds']) && is_array($GeneralSettings['custom_feeds']) )
1534
+ {
1535
+ foreach( $GeneralSettings['custom_feeds'] as $feed_slug=> $null )
1536
+ {
1537
+ if( !in_array($feed_slug, $wp_rewrite->feeds) )
1538
+ $wp_rewrite->feeds[] = $feed_slug;
1539
+ }
1540
+ }
1541
+
1542
+ return $return_rules;
1543
+ }
1544
+
1545
+ add_filter('pre_transient_rewrite_rules', 'powerpress_pre_transient_rewrite_rules');
1546
+
1547
+ function powerpress_init()
1548
+ {
1549
+ $GeneralSettings = get_option('powerpress_general');
1550
+
1551
+ if( !empty($GeneralSettings['powerpress-beta-features']) && file_exists(POWERPRESS_ABSPATH.'/powerpressadmin-pts.php') )
1552
+ {
1553
+ require_once(POWERPRESS_ABSPATH.'/powerpressadmin-pts.php');
1554
+ }
1555
+
1556
+ if( empty($GeneralSettings['disable_appearance']) || $GeneralSettings['disable_appearance'] == false )
1557
+ {
1558
+ require_once( POWERPRESS_ABSPATH.'/powerpress-player.php');
1559
+ powerpressplayer_init($GeneralSettings);
1560
+ }
1561
+
1562
+ // Enable the playlist feature for PowerPress
1563
+ if( !empty($GeneralSettings['playlist_player']) ) // Either not set or set on
1564
+ {
1565
+ require_once(POWERPRESS_ABSPATH.'/powerpress-playlist.php');
1566
+ }
1567
+
1568
+ if( defined('PODPRESS_VERSION') || isset($GLOBALS['podcasting_player_id']) || isset($GLOBALS['podcast_channel_active']) || defined('PODCASTING_VERSION') )
1569
+ return false; // Another podcasting plugin is enabled...
1570
+
1571
+ // If we are to process podpress data..
1572
+ if( !empty($GeneralSettings['process_podpress']) )
1573
+ {
1574
+ powerpress_podpress_redirect_check();
1575
+ }
1576
+
1577
+ // Add the podcast feeds;
1578
+ if( !defined('POWERPRESS_NO_PODCAST_FEED') )
1579
+ {
1580
+ add_feed('podcast', 'powerpress_do_podcast_feed');
1581
+ }
1582
+
1583
+ if( $GeneralSettings && isset($GeneralSettings['custom_feeds']) && is_array($GeneralSettings['custom_feeds']) )
1584
+ {
1585
+ foreach( $GeneralSettings['custom_feeds'] as $feed_slug=> $feed_title )
1586
+ {
1587
+ if( $feed_slug != 'podcast' )
1588
+ add_feed($feed_slug, 'powerpress_do_podcast_feed');
1589
+ }
1590
+ }
1591
+
1592
+ if( !empty($GeneralSettings['posttype_podcasting']) )
1593
+ {
1594
+ // Loop through the posttype podcasting settings and set the feeds for the custom post type slugs...
1595
+ global $wp_rewrite;
1596
+
1597
+
1598
+ $FeedSlugPostTypesArray = get_option('powerpress_posttype-podcasting'); // Changed field slightly so it does not conflict with a post type "podcasting"
1599
+ if( $FeedSlugPostTypesArray === false )
1600
+ {
1601
+ // Simple one-time fix...
1602
+ $FeedSlugPostTypesArray = get_option('powerpress_posttype_podcasting');
1603
+ if( empty($FeedSlugPostTypesArray) )
1604
+ $FeedSlugPostTypesArray = array();
1605
+ update_option('powerpress_posttype-podcasting', $FeedSlugPostTypesArray);
1606
+ if( !array_key_exists('title', $FeedSlugPostTypesArray) ) // AS long as it doesn't have post type specific settings...
1607
+ delete_option('powerpress_posttype_podcasting');
1608
+ }
1609
+
1610
+ if( empty($FeedSlugPostTypesArray) )
1611
+ {
1612
+ $FeedSlugPostTypesArray = array();
1613
+ }
1614
+ foreach( $FeedSlugPostTypesArray as $feed_slug=> $FeedSlugPostTypes )
1615
+ {
1616
+ if ( !in_array($feed_slug, $wp_rewrite->feeds) ) // we need to add this feed name
1617
+ {
1618
+ add_feed($feed_slug, 'powerpress_do_podcast_feed');
1619
+ foreach( $FeedSlugPostTypes as $post_type_slug=> $title )
1620
+ {
1621
+ add_rewrite_rule( '/'. $post_type_slug .'/feed/'. $feed_slug .'/?$', 'index.php?post_type='. $post_type_slug .'&feed='.$feed_slug, 'top' ); // capture the post type feeds
1622
+ add_rewrite_rule( '/'. $post_type_slug .'/feed/'. $feed_slug .'/?$', 'index.php?post_type='. $post_type_slug .'&feed='.$feed_slug, 'bottom' ); // capture the post type feeds
1623
+ }
1624
+ }
1625
+ }
1626
+ }
1627
+
1628
+ if( defined('GAWP_VERSION') )
1629
+ {
1630
+ add_filter('the_content', 'powerpress_yoast_gawp_fix', 120 );
1631
+ }
1632
+
1633
+ if( !empty($GeneralSettings['subscribe_links']) )
1634
+ {
1635
+ // 2 Subscribe page shortocde [powerpress_subscribe feedslug="podcast"]
1636
+ // 3 Subscribe sidebar widget: iTunes, RSS
1637
+ add_filter('powerpress_player_subscribe_links', 'powerpressplayer_link_subscribe_pre', 1, 3);
1638
+ add_filter('powerpress_player_subscribe_links', 'powerpressplayer_link_subscribe_post', 1000, 3);
1639
+ }
1640
+ wp_register_style(
1641
+ 'powerpress-subscribe-style',
1642
+ powerpress_get_root_url() . 'css/subscribe.css',
1643
+ array(),
1644
+ '20141021',
1645
+ 'all' );
1646
+
1647
+ if( !empty($GeneralSettings['rss_emoji']) ) {
1648
+ if( has_filter('the_content_feed', 'wp_staticize_emoji') ) {
1649
+ remove_filter( 'the_content_feed', 'wp_staticize_emoji' ); // Remove the emoji images
1650
+ remove_filter( 'comment_text_rss', 'wp_staticize_emoji' );
1651
+ //add_filter( 'the_content_feed', 'wp_encode_emoji' ); // Convert an emoji to &#x1Fxxx;
1652
+ //add_filter( 'get_wp_title_rss', 'wp_encode_emoji' );
1653
+ }
1654
+ }
1655
+
1656
+ remove_action( 'wp_head', 'feed_links', 2 );
1657
+ remove_action( 'wp_head', 'feed_links_extra', 3 );
1658
+ }
1659
+
1660
+ add_action('init', 'powerpress_init', -100); // We need to add the feeds before other plugins start screwing with them
1661
+
1662
+ function powerpress_wp_print_styles()
1663
+ {
1664
+ $Settings = get_option('powerpress_general');
1665
+
1666
+ if( !empty($Settings['audio_player_max_width']) )
1667
+ {
1668
+ echo '<style type="text/css">'."\n";
1669
+ if( is_numeric($Settings['audio_player_max_width']) )
1670
+ $Settings['audio_player_max_width'] .= 'px';
1671
+ echo '.powerpress_player .wp-audio-shortcode { max-width: '.$Settings['audio_player_max_width'].'; }'."\n";
1672
+ echo '</style>'."\n";
1673
+ }
1674
+ }
1675
+
1676
+ add_action('wp_print_styles', 'powerpress_wp_print_styles');
1677
+
1678
+ function powerpress_request($qv)
1679
+ {
1680
+ if( !empty($qv['feed']) )
1681
+ {
1682
+ $podcast_feed_slug = false;
1683
+ if( $qv['feed'] == 'podcast' ) {
1684
+ $GeneralSettings = get_option('powerpress_general');
1685
+ if( empty($GeneralSettings['posttype_podcasting']) )
1686
+ $podcast_feed_slug = 'podcast';
1687
+ } else if( $qv['feed'] == 'rss' || $qv['feed'] == 'rss2' || $qv['feed'] == 'atom' || $qv['feed'] == 'rdf' || $qv['feed'] == 'feed' ) { // 'feed', 'rdf', 'rss', 'rss2', 'atom'
1688
+ // Skip
1689
+ } else {
1690
+ $GeneralSettings = get_option('powerpress_general');
1691
+ if( empty($GeneralSettings['posttype_podcasting']) && isset($GeneralSettings['custom_feeds']) && is_array($GeneralSettings['custom_feeds']) && !empty($GeneralSettings['custom_feeds'][ $qv['feed'] ] ) )
1692
+ $podcast_feed_slug = $qv['feed'];
1693
+
1694
+
1695
+ }
1696
+
1697
+ if( $podcast_feed_slug )
1698
+ {
1699
+ if( !defined('POWERPRESS_POSTTYPE_MIXING') && $qv['feed'] == 'podcast' ) {
1700
+ $qv['post_type'] = 'post';
1701
+ } else {
1702
+ $qv['post_type'] = get_post_types( array('public'=> true, 'capability_type'=>'post') );
1703
+ if( !empty($qv['post_type']['attachment']) )
1704
+ unset($qv['post_type']['attachment']);
1705
+ }
1706
+
1707
+ $FeedCustom = get_option('powerpress_feed_'.$podcast_feed_slug); // Get custom feed specific settings
1708
+ // See if the user set a custom post type only...
1709
+ if( !empty($FeedCustom) && !empty( $FeedCustom['custom_post_type']) )
1710
+ $qv['post_type'] = $FeedCustom['custom_post_type'];
1711
+ }
1712
+ }
1713
+ return $qv;
1714
+ }
1715
+
1716
+ add_filter('request', 'powerpress_request');
1717
+
1718
+
1719
+ function powerpress_plugins_loaded()
1720
+ {
1721
+ // Translation support loaded:
1722
+ load_plugin_textdomain('powerpress', // domain / keyword name of plugin
1723
+ POWERPRESS_ABSPATH .'/languages', // Absolute path
1724
+ basename(POWERPRESS_ABSPATH).'/languages' ); // relative path in plugins folder
1725
+
1726
+ /*
1727
+ ####
1728
+ # Defines that effect translation defined now:
1729
+ ####
1730
+ */
1731
+ // Set specific play and download labels for your installation of PowerPress
1732
+ if( !defined('POWERPRESS_LINKS_TEXT') )
1733
+ define('POWERPRESS_LINKS_TEXT', __('Podcast', 'powerpress') );
1734
+ if( !defined('POWERPRESS_DURATION_TEXT') )
1735
+ define('POWERPRESS_DURATION_TEXT', __('Duration', 'powerpress') );
1736
+ if( !defined('POWERPRESS_PLAY_IN_NEW_WINDOW_TEXT') )
1737
+ define('POWERPRESS_PLAY_IN_NEW_WINDOW_TEXT', __('Play in new window', 'powerpress') );
1738
+ if( !defined('POWERPRESS_DOWNLOAD_TEXT') )
1739
+ define('POWERPRESS_DOWNLOAD_TEXT', __('Download', 'powerpress') );
1740
+ if( !defined('POWERPRESS_PLAY_TEXT') )
1741
+ define('POWERPRESS_PLAY_TEXT', __('Play', 'powerpress') );
1742
+ if( !defined('POWERPRESS_EMBED_TEXT') )
1743
+ define('POWERPRESS_EMBED_TEXT', __('Embed', 'powerpress') );
1744
+ if( !defined('POWERPRESS_READ_TEXT') )
1745
+ define('POWERPRESS_READ_TEXT', __('Read', 'powerpress') );
1746
+ }
1747
+ add_action('plugins_loaded', 'powerpress_plugins_loaded');
1748
+
1749
+
1750
+ function powerpress_w3tc_can_print_comment($settings)
1751
+ {
1752
+ return false;
1753
+ }
1754
+
1755
+ // Disable minifying if W3TC is enabled
1756
+ function powerpress_w3tc_minify_enable($enable)
1757
+ {
1758
+ if( is_feed() )
1759
+ return false;
1760
+ return $enable;
1761
+ }
1762
+
1763
+ // Load the general feed settings for feeds handled by powerpress
1764
+ function powerpress_load_general_feed_settings()
1765
+ {
1766
+ global $wp_query;
1767
+ global $powerpress_feed;
1768
+
1769
+ if( $powerpress_feed !== false ) // If it is not false (either NULL or an array) then we already looked these settings up
1770
+ {
1771
+ $powerpress_feed = false;
1772
+
1773
+ // Get the powerpress settings
1774
+ $GeneralSettings = get_option('powerpress_general');
1775
+ if( !isset($GeneralSettings['custom_feeds']['podcast']) )
1776
+ $GeneralSettings['custom_feeds']['podcast'] = 'Podcast Feed'; // Fixes scenario where the user never configured the custom default podcast feed.
1777
+ if( empty($GeneralSettings['default_url']) )
1778
+ $GeneralSettings['default_url'] = '';
1779
+
1780
+ if( $GeneralSettings )
1781
+ {
1782
+ $FeedSettingsBasic = get_option('powerpress_feed'); // Get overall feed settings
1783
+ if( is_feed() && defined( 'WPCACHEHOME' ) && empty($GeneralSettings['allow_feed_comments']) )
1784
+ {
1785
+ global $wp_super_cache_comments;
1786
+ $wp_super_cache_comments = 0;
1787
+ }
1788
+
1789
+ if( is_feed() && defined('W3TC') && empty($GeneralSettings['allow_feed_comments']) )
1790
+ {
1791
+ add_filter( 'w3tc_can_print_comment', 'powerpress_w3tc_can_print_comment', 10, 1 );
1792
+ }
1793
+
1794
+ if( is_feed() && defined('W3TC') )
1795
+ {
1796
+ add_filter( 'w3tc_minify_enable', 'powerpress_w3tc_minify_enable');
1797
+ }
1798
+
1799
+ // If we're in advanced mode and we're dealing with a category feed we're extending, lets work with it...
1800
+ if( is_category() && isset($GeneralSettings['custom_cat_feeds']) && is_array($GeneralSettings['custom_cat_feeds']) && in_array( get_query_var('cat'), $GeneralSettings['custom_cat_feeds']) )
1801
+ {
1802
+ $cat_ID = get_query_var('cat');
1803
+ $FeedCustom = get_option('powerpress_cat_feed_'.$cat_ID); // Get custom feed specific settings
1804
+ $Feed = powerpress_merge_empty_feed_settings($FeedCustom, $FeedSettingsBasic);
1805
+
1806
+ $powerpress_feed = array();
1807
+ if( !empty($GeneralSettings['feed_accel']) )
1808
+ $powerpress_feed['feed_accel'] = true;
1809
+ $powerpress_feed['is_custom'] = true;
1810
+ $powerpress_feed['category'] = $cat_ID;
1811
+ $powerpress_feed['process_podpress'] = !empty($GeneralSettings['process_podpress']); // Category feeds could originate from Podpress
1812
+ $powerpress_feed['rss_language'] = ''; // default, let WordPress set the language
1813
+ $powerpress_feed['default_url'] = '';
1814
+ if( !empty($GeneralSettings['default_url']) )
1815
+ $powerpress_feed['default_url'] = rtrim($GeneralSettings['default_url'], '/') .'/';
1816
+ $explicit_array = array("no", "yes", "clean");
1817
+ $powerpress_feed['explicit'] = $explicit_array[$Feed['itunes_explicit']];
1818
+ if( !empty($Feed['itunes_talent_name']) )
1819
+ $powerpress_feed['itunes_talent_name'] = $Feed['itunes_talent_name'];
1820
+ else
1821
+ $powerpress_feed['itunes_talent_name'] = get_wp_title_rss();
1822
+ $powerpress_feed['enhance_itunes_summary'] = $Feed['enhance_itunes_summary'];
1823
+ if( !empty($GeneralSettings['seo_itunes']) )
1824
+ $powerpress_feed['enhance_itunes_summary'] = 1;
1825
+ $powerpress_feed['posts_per_rss'] = false;
1826
+ if( !empty($Feed['posts_per_rss']) && is_numeric($Feed['posts_per_rss']) && $Feed['posts_per_rss'] > 0 )
1827
+ $powerpress_feed['posts_per_rss'] = $Feed['posts_per_rss'];
1828
+ $powerpress_feed['feed_redirect_url'] = '';
1829
+ if( !empty($Feed['feed_redirect_url']) )
1830
+ $powerpress_feed['feed_redirect_url'] = $Feed['feed_redirect_url'];
1831
+ if( $Feed['itunes_author_post'] == true )
1832
+ $powerpress_feed['itunes_author_post'] = true;
1833
+ if( $Feed['rss_language'] != '' )
1834
+ $powerpress_feed['rss_language'] = $Feed['rss_language'];
1835
+
1836
+ if( !empty($GeneralSettings['podcast_embed_in_feed']) )
1837
+ $powerpress_feed['podcast_embed_in_feed'] = true;
1838
+ if( !empty($Feed['maximize_feed']) )
1839
+ $powerpress_feed['maximize_feed'] = true;
1840
+ if( !empty($Feed['episode_itunes_image']) && !empty($Feed['itunes_image']) )
1841
+ $powerpress_feed['itunes_image'] = $Feed['itunes_image'];
1842
+ return;
1843
+ }
1844
+ else if( ( defined('POWERPRESS_TAXONOMY_PODCASTING') || !empty($GeneralSettings['taxonomy_podcasting']) ) && ( is_tag() || is_tax() ) )
1845
+ {
1846
+ // We need to get the term_id and the tax_id (tt_id)
1847
+ $term_slug = get_query_var('term');
1848
+ $taxonomy = get_query_var('taxonomy');
1849
+
1850
+ if( empty($term_slug) && empty($taxonomy) ) // Handle situation where tag is the taxonomy we're working with
1851
+ {
1852
+ $term_slug = get_query_var('tag');
1853
+ if( !empty($term_slug) )
1854
+ $taxonomy = 'post_tag';
1855
+ }
1856
+
1857
+ $term = false;
1858
+ if( !empty($term_slug) && !empty($taxonomy) )
1859
+ {
1860
+ $term = term_exists($term_slug, $taxonomy);
1861
+ }
1862
+
1863
+ if( !empty($term['term_taxonomy_id']) )
1864
+ {
1865
+ $FeedCustom = get_option('powerpress_taxonomy_'.$term['term_taxonomy_id'] ); // Get custom feed specific settings
1866
+ if( $FeedCustom )
1867
+ {
1868
+ $Feed = powerpress_merge_empty_feed_settings($FeedCustom, $FeedSettingsBasic);
1869
+
1870
+ $powerpress_feed = array();
1871
+ if( !empty($GeneralSettings['feed_accel']) )
1872
+ $powerpress_feed['feed_accel'] = true;
1873
+ $powerpress_feed['is_custom'] = true;
1874
+ $powerpress_feed['term_taxonomy_id'] = $term['term_taxonomy_id'];
1875
+ $powerpress_feed['process_podpress'] = false; // Taxonomy feeds will not originate from Podpress
1876
+ $powerpress_feed['rss_language'] = ''; // default, let WordPress set the language
1877
+ $powerpress_feed['default_url'] = rtrim($GeneralSettings['default_url'], '/') .'/';
1878
+ $explicit_array = array("no", "yes", "clean");
1879
+ $powerpress_feed['explicit'] = $explicit_array[$Feed['itunes_explicit']];
1880
+ if( !empty($Feed['itunes_talent_name']) )
1881
+ $powerpress_feed['itunes_talent_name'] = $Feed['itunes_talent_name'];
1882
+ else
1883
+ $powerpress_feed['itunes_talent_name'] = get_wp_title_rss();
1884
+ $powerpress_feed['enhance_itunes_summary'] = $Feed['enhance_itunes_summary'];
1885
+ if( !empty($GeneralSettings['seo_itunes']) )
1886
+ $powerpress_feed['enhance_itunes_summary'] = 1;
1887
+ $powerpress_feed['posts_per_rss'] = false;
1888
+ if( !empty($Feed['posts_per_rss']) && is_numeric($Feed['posts_per_rss']) && $Feed['posts_per_rss'] > 0 )
1889
+ $powerpress_feed['posts_per_rss'] = $Feed['posts_per_rss'];
1890
+ if( $Feed['feed_redirect_url'] != '' )
1891
+ $powerpress_feed['feed_redirect_url'] = $Feed['feed_redirect_url'];
1892
+ if( $Feed['itunes_author_post'] == true )
1893
+ $powerpress_feed['itunes_author_post'] = true;
1894
+ if( $Feed['rss_language'] != '' )
1895
+ $powerpress_feed['rss_language'] = $Feed['rss_language'];
1896
+
1897
+ if( !empty($GeneralSettings['podcast_embed_in_feed']) )
1898
+ $powerpress_feed['podcast_embed_in_feed'] = true;
1899
+ if( !empty($Feed['maximize_feed']) )
1900
+ $powerpress_feed['maximize_feed'] = true;
1901
+ if( !empty($Feed['episode_itunes_image']) && !empty($Feed['itunes_image']) )
1902
+ $powerpress_feed['itunes_image'] = $Feed['itunes_image'];
1903
+ return;
1904
+ }
1905
+ }
1906
+ }
1907
+
1908
+ $feed_slug = get_query_var('feed');
1909
+ // Are we dealing with a custom podcast channel or a custom post type podcast feed...
1910
+ if( !empty($GeneralSettings['posttype_podcasting']) || isset($GeneralSettings['custom_feeds'][ $feed_slug ]) )
1911
+ {
1912
+ $Feed = false;
1913
+ if( !empty($GeneralSettings['posttype_podcasting']) )
1914
+ {
1915
+ $post_type = get_query_var('post_type');
1916
+
1917
+ if( !empty($post_type) )
1918
+ {
1919
+ if ( is_array( $post_type ) ) {
1920
+ $post_type = reset( $post_type ); // get first element in array
1921
+ }
1922
+
1923
+ // Get the settings for this podcast post type
1924
+ $PostTypeSettingsArray = get_option('powerpress_posttype_'. $post_type);
1925
+ if( !empty($PostTypeSettingsArray[ $feed_slug ]) )
1926
+ {
1927
+ $FeedCustom = $PostTypeSettingsArray[ $feed_slug ];
1928
+ $Feed = powerpress_merge_empty_feed_settings($FeedCustom, $FeedSettingsBasic);
1929
+ $Feed['post_type'] = $post_type;
1930
+ }
1931
+ }
1932
+ }
1933
+ if( empty($Feed) && isset($GeneralSettings['custom_feeds'][ $feed_slug ]) )
1934
+ {
1935
+ $FeedCustom = get_option('powerpress_feed_'.$feed_slug); // Get custom feed specific settings
1936
+ $Feed = powerpress_merge_empty_feed_settings($FeedCustom, $FeedSettingsBasic, ($feed_slug == 'podcast') );
1937
+ }
1938
+
1939
+ if( $Feed )
1940
+ {
1941
+ $powerpress_feed = array();
1942
+ if( !empty($GeneralSettings['feed_accel']) )
1943
+ $powerpress_feed['feed_accel'] = true;
1944
+ $powerpress_feed['is_custom'] = true;
1945
+ $powerpress_feed['feed-slug'] = $feed_slug;
1946
+ if( !empty($Feed['post_type']) )
1947
+ $powerpress_feed['post_type'] = $Feed['post_type'];
1948
+ $powerpress_feed['process_podpress'] = ($feed_slug=='podcast'? !empty($GeneralSettings['process_podpress']): false); // We don't touch podpress data for custom feeds
1949
+ $powerpress_feed['rss_language'] = ''; // RSS language should be set by WordPress by default
1950
+ $powerpress_feed['default_url'] = '';
1951
+ if( !empty($powerpress_feed['default_url']) )
1952
+ $powerpress_feed['default_url'] = rtrim($GeneralSettings['default_url'], '/') .'/';
1953
+ $explicit = array("no", "yes", "clean");
1954
+ $powerpress_feed['explicit'] ='no';
1955
+ if( !empty($Feed['itunes_explicit']) )
1956
+ $powerpress_feed['explicit'] = $explicit[ $Feed['itunes_explicit'] ];
1957
+ if( !empty($Feed['itunes_talent_name']) )
1958
+ $powerpress_feed['itunes_talent_name'] = $Feed['itunes_talent_name'];
1959
+ else
1960
+ $powerpress_feed['itunes_talent_name'] = get_wp_title_rss();
1961
+ $powerpress_feed['enhance_itunes_summary'] = $Feed['enhance_itunes_summary'];
1962
+ if( !empty($GeneralSettings['seo_itunes']) )
1963
+ $powerpress_feed['enhance_itunes_summary'] = 1;
1964
+ $powerpress_feed['posts_per_rss'] = false;
1965
+ if( !empty($Feed['posts_per_rss']) && is_numeric($Feed['posts_per_rss']) && $Feed['posts_per_rss'] > 0 )
1966
+ $powerpress_feed['posts_per_rss'] = $Feed['posts_per_rss'];
1967
+ if( !empty($Feed['feed_redirect_url']) )
1968
+ $powerpress_feed['feed_redirect_url'] = $Feed['feed_redirect_url'];
1969
+ if( !empty($Feed['itunes_author_post'] ) )
1970
+ $powerpress_feed['itunes_author_post'] = true;
1971
+ if( !empty($Feed['rss_language']) )
1972
+ $powerpress_feed['rss_language'] = $Feed['rss_language'];
1973
+ if( !empty($GeneralSettings['podcast_embed_in_feed']) )
1974
+ $powerpress_feed['podcast_embed_in_feed'] = true;
1975
+ if( !empty($Feed['maximize_feed']) )
1976
+ $powerpress_feed['maximize_feed'] = true;
1977
+ if( !empty($Feed['episode_itunes_image']) && !empty($Feed['itunes_image']) )
1978
+ $powerpress_feed['itunes_image'] = $Feed['itunes_image'];
1979
+ return;
1980
+ }
1981
+ }
1982
+
1983
+ if( !isset($FeedSettingsBasic['apply_to']) )
1984
+ $FeedSettingsBasic['apply_to'] = 1;
1985
+
1986
+ // We fell this far,we must be in simple mode or the user never saved customized their custom feed settings
1987
+ switch( $FeedSettingsBasic['apply_to'] )
1988
+ {
1989
+ case 0: // enhance only the podcast feed added by PowerPress, with the logic above this code should never be reached but it is added for readability.
1990
+ {
1991
+ if( $feed_slug != 'podcast' )
1992
+ break;
1993
+ } // important: no break here!
1994
+ case 2: // RSS2 Main feed and podcast feed added by PowerPress only
1995
+ {
1996
+ if( $feed_slug != 'feed' && $feed_slug != 'rss2' && $feed_slug != 'podcast' )
1997
+ break; // We're only adding podcasts to the rss2 feed in this situation
1998
+
1999
+ if( $wp_query->is_category ) // don't touch the category feeds...
2000
+ break;
2001
+
2002
+ if( $wp_query->is_tag ) // don't touch the tag feeds...
2003
+ break;
2004
+
2005
+ if( $wp_query->is_comment_feed ) // don't touch the comments feeds...
2006
+ break;
2007
+ } // important: no break here!
2008
+ case 1: // All feeds
2009
+ {
2010
+ $powerpress_feed = array(); // Only store what's needed for each feed item
2011
+ if( !empty($GeneralSettings['feed_accel']) )
2012
+ $powerpress_feed['feed_accel'] = true;
2013
+ $powerpress_feed['is_custom'] = false; // ($feed_slug == 'podcast'?true:false);
2014
+ $powerpress_feed['feed-slug'] = $feed_slug;
2015
+ $powerpress_feed['process_podpress'] = !empty($GeneralSettings['process_podpress']); // We don't touch podpress data for custom feeds
2016
+ $powerpress_feed['default_url'] = '';
2017
+ if( !empty($GeneralSettings['default_url']) )
2018
+ $powerpress_feed['default_url'] = rtrim($GeneralSettings['default_url'], '/') .'/';
2019
+ $explicit = array("no", "yes", "clean");
2020
+ $powerpress_feed['explicit'] = 'no';
2021
+ if( !empty($FeedSettingsBasic['itunes_explicit']) )
2022
+ $powerpress_feed['explicit'] = $explicit[$FeedSettingsBasic['itunes_explicit']];
2023
+ if( !empty($FeedSettingsBasic['itunes_talent_name']) )
2024
+ $powerpress_feed['itunes_talent_name'] = $FeedSettingsBasic['itunes_talent_name'];
2025
+ else
2026
+ $powerpress_feed['itunes_talent_name'] = get_wp_title_rss();
2027
+ $powerpress_feed['enhance_itunes_summary'] = 0;
2028
+ if( isset($FeedSettingsBasic['enhance_itunes_summary']) )
2029
+ $powerpress_feed['enhance_itunes_summary'] = $FeedSettingsBasic['enhance_itunes_summary'];
2030
+ if( !empty($GeneralSettings['seo_itunes']) )
2031
+ $powerpress_feed['enhance_itunes_summary'] = 1;
2032
+ $powerpress_feed['posts_per_rss'] = false;
2033
+ if( !empty($FeedSettingsBasic['posts_per_rss']) && is_numeric($FeedSettingsBasic['posts_per_rss']) && $FeedSettingsBasic['posts_per_rss'] > 0 )
2034
+ $powerpress_feed['posts_per_rss'] = $FeedSettingsBasic['posts_per_rss'];
2035
+ if( !empty($FeedSettingsBasic['itunes_author_post']) )
2036
+ $powerpress_feed['itunes_author_post'] = true;
2037
+ $powerpress_feed['rss_language'] = ''; // Cannot set the language setting in simple mode
2038
+ if( !empty($GeneralSettings['podcast_embed_in_feed']) )
2039
+ $powerpress_feed['podcast_embed_in_feed'] = true;
2040
+ if( !empty($FeedSettingsBasic['episode_itunes_image']) && !empty($FeedSettingsBasic['itunes_image']) )
2041
+ $powerpress_feed['itunes_image'] = $FeedSettingsBasic['itunes_image'];
2042
+
2043
+ }; break;
2044
+ // All other cases we let fall through
2045
+ }
2046
+ }
2047
+ }
2048
+ }
2049
+
2050
+ // Returns true of the feed should be treated as a podcast feed
2051
+ function powerpress_is_podcast_feed()
2052
+ {
2053
+ if( defined('PODPRESS_VERSION') || isset($GLOBALS['podcasting_player_id']) || isset($GLOBALS['podcast_channel_active']) || defined('PODCASTING_VERSION') )
2054
+ return false; // Another podcasting plugin is enabled...
2055
+
2056
+ global $powerpress_feed;
2057
+ if( $powerpress_feed !== false && !is_array($powerpress_feed) )
2058
+ powerpress_load_general_feed_settings();
2059
+ if( $powerpress_feed === false )
2060
+ return false;
2061
+ return true;
2062
+ }
2063
+
2064
+ // Returns true if the feed is a custom feed added by PowerPress
2065
+ function powerpress_is_custom_podcast_feed()
2066
+ {
2067
+ if( defined('PODPRESS_VERSION') || isset($GLOBALS['podcasting_player_id']) || isset($GLOBALS['podcast_channel_active']) || defined('PODCASTING_VERSION') )
2068
+ return false; // Another podcasting plugin is enabled...
2069
+
2070
+ global $powerpress_feed;
2071
+ if( $powerpress_feed !== false && !is_array($powerpress_feed) )
2072
+ powerpress_load_general_feed_settings();
2073
+ if( $powerpress_feed === false )
2074
+ return false;
2075
+ return $powerpress_feed['is_custom'];
2076
+ }
2077
+
2078
+ function powerpress_posts_fields($cols)
2079
+ {
2080
+ if( !is_feed() )
2081
+ return $cols;
2082
+
2083
+ if( is_category() || is_tag() || is_tax() ) {
2084
+ if( get_query_var('feed') !== 'podcast' )
2085
+ return $cols;
2086
+ }
2087
+
2088
+ if( powerpress_is_custom_podcast_feed() || get_query_var('feed') === 'podcast' )
2089
+ {
2090
+ if( !empty($GLOBALS['powerpress_feed']['feed_accel']) )
2091
+ {
2092
+ $feed_slug = get_query_var('feed');
2093
+ global $wpdb;
2094
+ $cols .= ", pp_{$wpdb->postmeta}.meta_value AS podcast_meta_value ";
2095
+ }
2096
+ }
2097
+
2098
+ return $cols;
2099
+ }
2100
+ //$fields = apply_filters_ref_array( 'posts_fields', array( $fields, &$this ) );
2101
+ add_filter('posts_fields', 'powerpress_posts_fields' );
2102
+
2103
+ function powerpress_posts_join($join)
2104
+ {
2105
+ if( !is_feed() )
2106
+ return $join;
2107
+
2108
+ if( is_category() || is_tag() || is_tax() ) {
2109
+ if( get_query_var('feed') !== 'podcast' )
2110
+ return $join;
2111
+ }
2112
+
2113
+ if( powerpress_is_custom_podcast_feed() || get_query_var('feed') === 'podcast' )
2114
+ {
2115
+ global $wpdb;
2116
+ $join .= " INNER JOIN {$wpdb->postmeta} AS pp_{$wpdb->postmeta} ";
2117
+ $join .= " ON {$wpdb->posts}.ID = pp_{$wpdb->postmeta}.post_id ";
2118
+ }
2119
+
2120
+ return $join;
2121
+ }
2122
+
2123
+ add_filter('posts_join', 'powerpress_posts_join' );
2124
+
2125
+ function powerpress_posts_where($where)
2126
+ {
2127
+ if( !is_feed() )
2128
+ return $where;
2129
+ if( is_category() || is_tag() || is_tax() ) {
2130
+ if( get_query_var('feed') !== 'podcast' )
2131
+ return $where;
2132
+ }
2133
+
2134
+ if( powerpress_is_custom_podcast_feed() || get_query_var('feed') === 'podcast' )
2135
+ {
2136
+ global $wpdb, $powerpress_feed;
2137
+ $where .= " AND (";
2138
+
2139
+ if( powerpress_is_custom_podcast_feed() && get_query_var('feed') !== 'podcast' )
2140
+ $where .= " pp_{$wpdb->postmeta}.meta_key = '_". get_query_var('feed') .":enclosure' ";
2141
+ else
2142
+ $where .= " pp_{$wpdb->postmeta}.meta_key = 'enclosure' ";
2143
+
2144
+ // Include Podpress data if exists...
2145
+ if( !empty($powerpress_feed['process_podpress']) && get_query_var('feed') === 'podcast' )
2146
+ $where .= " OR pp_{$wpdb->postmeta}.meta_key = 'podPressMedia' OR pp_{$wpdb->postmeta}.meta_key = '_podPressMedia' ";
2147
+
2148
+ $where .= ") ";
2149
+ }
2150
+ return $where;
2151
+ }
2152
+
2153
+ add_filter('posts_where', 'powerpress_posts_where' );
2154
+
2155
+ // Add the groupby needed for enclosures only
2156
+ function powerpress_posts_groupby($groupby)
2157
+ {
2158
+ if( !is_feed() )
2159
+ return $groupby;
2160
+
2161
+ if( is_category() || is_tag() || is_tax() ) {
2162
+ if( get_query_var('feed') !== 'podcast' )
2163
+ return $groupby;
2164
+ }
2165
+
2166
+ if( powerpress_is_custom_podcast_feed() || get_query_var('feed') === 'podcast' )
2167
+ {
2168
+ global $wpdb;
2169
+ $groupby = " {$wpdb->posts}.ID ";
2170
+ }
2171
+ return $groupby;
2172
+ }
2173
+ add_filter('posts_groupby', 'powerpress_posts_groupby');
2174
+
2175
+ function powerpress_post_limits($limits)
2176
+ {
2177
+ if( !is_feed() )
2178
+ return $limits;
2179
+
2180
+ if( powerpress_is_custom_podcast_feed() || get_query_var('feed') === 'podcast' )
2181
+ {
2182
+ global $powerpress_feed;
2183
+ if( !empty($powerpress_feed['posts_per_rss']) && preg_match('/^(\d)+$/', trim($powerpress_feed['posts_per_rss'])) )
2184
+ $limits = "LIMIT 0, {$powerpress_feed['posts_per_rss']}";
2185
+ }
2186
+ return $limits;
2187
+ }
2188
+ add_filter('post_limits', 'powerpress_post_limits');
2189
+
2190
+
2191
+ function powerpress_do_all_pings()
2192
+ {
2193
+ global $wpdb;
2194
+ $wpdb->query("DELETE FROM {$wpdb->postmeta} WHERE meta_key = '_encloseme' ");
2195
+
2196
+ // Now call the WordPress do_all_pings()...
2197
+ do_all_pings();
2198
+ remove_action('do_pings', 'do_all_pings');
2199
+ }
2200
+
2201
+ remove_action('do_pings', 'do_all_pings');
2202
+ add_action('do_pings', 'powerpress_do_all_pings', 1, 1);
2203
+
2204
+ /*
2205
+ Helper functions:
2206
+ */
2207
+ function powerpress_podpress_redirect_check()
2208
+ {
2209
+ if( preg_match('/podpress_trac\/([^\/]+)\/([^\/]+)\/([^\/]+)\/(.*)$/', $_SERVER['REQUEST_URI'], $matches) )
2210
+ {
2211
+ $post_id = $matches[2];
2212
+ $mediaNum = $matches[3];
2213
+ //$filename = $matches[4];
2214
+ //$method = $matches[1];
2215
+
2216
+ if( is_numeric($post_id) && is_numeric($mediaNum))
2217
+ {
2218
+ $EpisodeData = powerpress_get_enclosure_data_podpress($post_id, $mediaNum);
2219
+ if( $EpisodeData && isset($EpisodeData['url']) )
2220
+ {
2221
+ if( strpos($EpisodeData['url'], 'http://' ) !== 0 && strpos($EpisodeData['url'], 'https://' ) !== 0 )
2222
+ {
2223
+ die('Error occurred obtaining the URL for the requested media file.');
2224
+ exit;
2225
+ }
2226
+
2227
+ $EnclosureURL = str_replace(' ', '%20', $EpisodeData['url']);
2228
+ header('Location: '.$EnclosureURL, true, 302);
2229
+ header('Content-Length: 0');
2230
+ exit;
2231
+ }
2232
+ // Let the WordPress 404 page load as normal
2233
+ }
2234
+ }
2235
+ }
2236
+
2237
+ function the_powerpress_content()
2238
+ {
2239
+ echo get_the_powerpress_content();
2240
+ }
2241
+
2242
+ function get_the_powerpress_content()
2243
+ {
2244
+ global $post;
2245
+
2246
+ if( defined('PODPRESS_VERSION') || isset($GLOBALS['podcasting_player_id']) || isset($GLOBALS['podcast_channel_active']) || defined('PODCASTING_VERSION') )
2247
+ return '';
2248
+
2249
+ if( function_exists('post_password_required') )
2250
+ {
2251
+ if( post_password_required($post) )
2252
+ return '';
2253
+ }
2254
+
2255
+ // PowerPress settings:
2256
+ $GeneralSettings = get_option('powerpress_general');
2257
+
2258
+ // No player or links to add to content...
2259
+ if( !empty($GeneralSettings['disable_appearance']) )
2260
+ return $content;
2261
+
2262
+ if( !isset($GeneralSettings['custom_feeds']) )
2263
+ $GeneralSettings['custom_feeds'] = array('podcast'=>'Default Podcast Feed');
2264
+
2265
+ // Re-order so the default podcast episode is the top most...
2266
+ $Temp = $GeneralSettings['custom_feeds'];
2267
+ $GeneralSettings['custom_feeds'] = array();
2268
+ $GeneralSettings['custom_feeds']['podcast'] = 'Default Podcast Feed';
2269
+
2270
+ foreach( $Temp as $feed_slug=> $feed_title )
2271
+ {
2272
+ if( $feed_slug == 'podcast' )
2273
+ continue;
2274
+ $GeneralSettings['custom_feeds'][ $feed_slug ] = $feed_title;
2275
+ }
2276
+
2277
+ // Handle post type feeds....
2278
+ if( !empty($GeneralSettings['posttype_podcasting']) )
2279
+ {
2280
+ $post_type = get_query_var('post_type');
2281
+ if ( is_array( $post_type ) ) {
2282
+ $post_type = reset( $post_type ); // get first element in array
2283
+ }
2284
+
2285
+ // Get the feed slugs and titles for this post type
2286
+ $PostTypeSettingsArray = get_option('powerpress_posttype_'.$post_type);
2287
+ // Loop through this array of post type settings...
2288
+ if( !empty($PostTypeSettingsArray) )
2289
+ {
2290
+ switch($post_type)
2291
+ {
2292
+ case 'post':
2293
+ case 'page': {
2294
+ // Do nothing!, we want the default podcast to appear in these post types
2295
+ }; break;
2296
+ default: {
2297
+ if( !empty($post_type) && empty($PostTypeSettingsArray['podcast']) )
2298
+ unset($GeneralSettings['custom_feeds']['podcast']); // special case, we do not want an accidental podcast episode to appear in a custom post type if the feature is enabled
2299
+ }; break;
2300
+ }
2301
+
2302
+ foreach( $PostTypeSettingsArray as $feed_slug=> $postTypeSettings )
2303
+ {
2304
+ if( !empty( $postTypeSettings['title']) )
2305
+ $GeneralSettings['custom_feeds'][ $feed_slug ] = $postTypeSettings['title'];
2306
+ else
2307
+ $GeneralSettings['custom_feeds'][ $feed_slug ] = $feed_slug;
2308
+ }
2309
+ }
2310
+ }
2311
+
2312
+ if( !isset($GeneralSettings['display_player']) )
2313
+ $GeneralSettings['display_player'] = 1;
2314
+ if( !isset($GeneralSettings['player_function']) )
2315
+ $GeneralSettings['player_function'] = 1;
2316
+ if( !isset($GeneralSettings['podcast_link']) )
2317
+ $GeneralSettings['podcast_link'] = 1;
2318
+
2319
+ // Figure out which players are alerady in the body of the page...
2320
+ $ExcludePlayers = array();
2321
+ if( isset($GeneralSettings['disable_player']) )
2322
+ $ExcludePlayers = $GeneralSettings['disable_player']; // automatically disable the players configured
2323
+
2324
+ // LOOP HERE TO DISPLAY EACH MEDIA TYPE
2325
+ $new_content = '';
2326
+ foreach( $GeneralSettings['custom_feeds'] as $feed_slug=> $feed_title )
2327
+ {
2328
+ // Get the enclosure data
2329
+ $EpisodeData = powerpress_get_enclosure_data($post->ID, $feed_slug);
2330
+
2331
+ if( !$EpisodeData && !empty($GeneralSettings['process_podpress']) && $feed_slug == 'podcast' )
2332
+ $EpisodeData = powerpress_get_enclosure_data_podpress($post->ID);
2333
+
2334
+ if( !$EpisodeData || !$EpisodeData['url'] )
2335
+ continue;
2336
+
2337
+ // Just in case, if there's no URL lets escape!
2338
+ if( !$EpisodeData['url'] )
2339
+ continue;
2340
+
2341
+ // If the player is not already inserted in the body of the post using the shortcode...
2342
+ //if( preg_match('/\[powerpress(.*)\]/is', $content) == 0 )
2343
+ if( !isset($ExcludePlayers[ $feed_slug ]) ) // If the player is not in our exclude list because it's already in the post body somewhere...
2344
+ {
2345
+ if( isset($GeneralSettings['premium_caps']) && $GeneralSettings['premium_caps'] && !powerpress_premium_content_authorized($feed_slug) )
2346
+ {
2347
+ $new_content .= powerpress_premium_content_message($post->ID, $feed_slug, $EpisodeData);
2348
+ }
2349
+ else
2350
+ {
2351
+ if( $GeneralSettings['player_function'] != 3 && $GeneralSettings['player_function'] != 0 ) // Play in new window only or disabled
2352
+ {
2353
+ do_action('wp_powerpress_player_scripts');
2354
+ $AddDefaultPlayer = empty($EpisodeData['no_player']);
2355
+
2356
+ if( $EpisodeData && !empty($EpisodeData['embed']) )
2357
+ {
2358
+ $new_content .= trim($EpisodeData['embed']);
2359
+ if( !empty($GeneralSettings['embed_replace_player']) )
2360
+ $AddDefaultPlayer = false;
2361
+ }
2362
+
2363
+ if( $AddDefaultPlayer )
2364
+ {
2365
+ $image = '';
2366
+ $width = '';
2367
+ $height = '';
2368
+ if( isset($EpisodeData['image']) && $EpisodeData['image'] != '' )
2369
+ $image = $EpisodeData['image'];
2370
+ if( !empty($EpisodeData['width']) && is_numeric($EpisodeData['width']) )
2371
+ $width = $EpisodeData['width'];
2372
+ if( !empty($EpisodeData['height']) && is_numeric($EpisodeData['height']) )
2373
+ $height = $EpisodeData['height'];
2374
+
2375
+ $new_content .= apply_filters('powerpress_player', '', powerpress_add_flag_to_redirect_url($EpisodeData['url'], 'p'), $EpisodeData );
2376
+ }
2377
+ }
2378
+
2379
+ if( !isset($EpisodeData['no_links']) )
2380
+ {
2381
+ do_action('wp_powerpress_player_scripts');
2382
+ $new_content .= apply_filters('powerpress_player_links', '', powerpress_add_flag_to_redirect_url($EpisodeData['url'], 'p'), $EpisodeData );
2383
+ $new_content .= apply_filters('powerpress_player_subscribe_links', '', powerpress_add_flag_to_redirect_url($EpisodeData['url'], 'p'), $EpisodeData );
2384
+ }
2385
+ }
2386
+ }
2387
+ }
2388
+
2389
+ return $new_content;
2390
+ }
2391
+
2392
+
2393
+
2394
+ // Adds content types that are missing from the default wp_check_filetype function
2395
+ function powerpress_get_contenttype($file, $use_wp_check_filetype = true)
2396
+ {
2397
+ $parts = pathinfo($file);
2398
+ if( !empty($parts['extension']) )
2399
+ {
2400
+ switch( strtolower($parts['extension']) )
2401
+ {
2402
+ // Audio formats
2403
+ case 'mp3': // most common
2404
+ case 'mpga':
2405
+ case 'mp2':
2406
+ case 'mp2a':
2407
+ case 'm2a':
2408
+ case 'm3a':
2409
+ return 'audio/mpeg';
2410
+ case 'm4a':
2411
+ return 'audio/x-m4a';
2412
+ case 'm4b': // Audio book format
2413
+ return 'audio/m4b';
2414
+ case 'm4r': // iPhone ringtone format
2415
+ return 'audio/m4r';
2416
+ // OGG Internet content types as set forth by rfc5334 (http://tools.ietf.org/html/rfc5334)
2417
+ case 'opus':
2418
+ case 'oga':
2419
+ case 'spx':
2420
+ return 'audio/ogg';
2421
+ case 'wma':
2422
+ return 'audio/x-ms-wma';
2423
+ case 'wax':
2424
+ return 'audio/x-ms-wax';
2425
+ case 'ra':
2426
+ case 'ram':
2427
+ return 'audio/x-pn-realaudio';
2428
+ case 'mp4a':
2429
+ return 'audio/mp4';
2430
+
2431
+ // Video formats
2432
+ case 'm4v':
2433
+ return 'video/x-m4v';
2434
+ case 'mpeg':
2435
+ case 'mpg':
2436
+ case 'mpe':
2437
+ case 'm1v':
2438
+ case 'm2v':
2439
+ return 'video/mpeg';
2440
+ case 'mp4':
2441
+ case 'mp4v':
2442
+ case 'mpg4':
2443
+ return 'video/mp4';
2444
+ case 'asf':
2445
+ case 'asx':
2446
+ return 'video/x-ms-asf';
2447
+ case 'wmx':
2448
+ return 'video/x-ms-wmx';
2449
+ case 'avi':
2450
+ return 'video/x-msvideo';
2451
+ case 'wmv':
2452
+ return 'video/x-ms-wmv'; // Check this
2453
+ case 'flv':
2454
+ return 'video/x-flv';
2455
+ case 'mov':
2456
+ case 'qt':
2457
+ return 'video/quicktime';
2458
+ case 'divx':
2459
+ return 'video/divx';
2460
+ case '3gp':
2461
+ return 'video/3gpp';
2462
+ case 'webm':
2463
+ return 'video/webm';
2464
+ case 'ogg': {
2465
+ if( !defined('POWERPRESS_OGG_VIDEO') )
2466
+ return 'audio/ogg';
2467
+ } // Let this fall through as ogg/video
2468
+ case 'ogv':
2469
+ return 'video/ogg';
2470
+
2471
+ // rarely used
2472
+ case 'mid':
2473
+ case 'midi':
2474
+ return 'audio/midi';
2475
+ case 'wav':
2476
+ return 'audio/wav';
2477
+ case 'aa':
2478
+ return 'audio/audible';
2479
+ case 'pdf':
2480
+ return 'application/pdf';
2481
+ case 'torrent':
2482
+ return 'application/x-bittorrent';
2483
+ case 'swf':
2484
+ return 'application/x-shockwave-flash';
2485
+ case 'ogx':
2486
+ return 'application/ogg';
2487
+
2488
+ // Most recently added by Apple:
2489
+ case 'epub':
2490
+ return 'document/x-epub';
2491
+
2492
+ default: // Let it fall through
2493
+ }
2494
+ }
2495
+
2496
+ // Last case let wordpress detect it:
2497
+ if( $use_wp_check_filetype )
2498
+ {
2499
+ $FileType = wp_check_filetype($file);
2500
+ if( $FileType && isset($FileType['type']) )
2501
+ return $FileType['type'];
2502
+ }
2503
+ return '';
2504
+ }
2505
+
2506
+
2507
+ function powerpress_itunes_categories($PrefixSubCategories = false)
2508
+ {
2509
+ $temp = array();
2510
+ $temp['01-00'] = 'Arts';
2511
+ $temp['01-01'] = 'Design';
2512
+ $temp['01-02'] = 'Fashion & Beauty';
2513
+ $temp['01-03'] = 'Food';
2514
+ $temp['01-04'] = 'Literature';
2515
+ $temp['01-05'] = 'Performing Arts';
2516
+ $temp['01-06'] = 'Visual Arts';
2517
+
2518
+ $temp['02-00'] = 'Business';
2519
+ $temp['02-01'] = 'Business News';
2520
+ $temp['02-02'] = 'Careers';
2521
+ $temp['02-03'] = 'Investing';
2522
+ $temp['02-04'] = 'Management & Marketing';
2523
+ $temp['02-05'] = 'Shopping';
2524
+
2525
+ $temp['03-00'] = 'Comedy';
2526
+
2527
+ $temp['04-00'] = 'Education';
2528
+ $temp['04-01'] = 'Education Technology';
2529
+ $temp['04-02'] = 'Higher Education';
2530
+ $temp['04-03'] = 'K-12';
2531
+ $temp['04-04'] = 'Language Courses';
2532
+ $temp['04-05'] = 'Training';
2533
+
2534
+ $temp['05-00'] = 'Games & Hobbies';
2535
+ $temp['05-01'] = 'Automotive';
2536
+ $temp['05-02'] = 'Aviation';
2537
+ $temp['05-03'] = 'Hobbies';
2538
+ $temp['05-04'] = 'Other Games';
2539
+ $temp['05-05'] = 'Video Games';
2540
+
2541
+ $temp['06-00'] = 'Government & Organizations';
2542
+ $temp['06-01'] = 'Local';
2543
+ $temp['06-02'] = 'National';
2544
+ $temp['06-03'] = 'Non-Profit';
2545
+ $temp['06-04'] = 'Regional';
2546
+
2547
+ $temp['07-00'] = 'Health';
2548
+ $temp['07-01'] = 'Alternative Health';
2549
+ $temp['07-02'] = 'Fitness & Nutrition';
2550
+ $temp['07-03'] = 'Self-Help';
2551
+ $temp['07-04'] = 'Sexuality';
2552
+
2553
+ $temp['08-00'] = 'Kids & Family';
2554
+
2555
+ $temp['09-00'] = 'Music';
2556
+
2557
+ $temp['10-00'] = 'News & Politics';
2558
+
2559
+ $temp['11-00'] = 'Religion & Spirituality';
2560
+ $temp['11-01'] = 'Buddhism';
2561
+ $temp['11-02'] = 'Christianity';
2562
+ $temp['11-03'] = 'Hinduism';
2563
+ $temp['11-04'] = 'Islam';
2564
+ $temp['11-05'] = 'Judaism';
2565
+ $temp['11-06'] = 'Other';
2566
+ $temp['11-07'] = 'Spirituality';
2567
+
2568
+ $temp['12-00'] = 'Science & Medicine';
2569
+ $temp['12-01'] = 'Medicine';
2570
+ $temp['12-02'] = 'Natural Sciences';
2571
+ $temp['12-03'] = 'Social Sciences';
2572
+
2573
+ $temp['13-00'] = 'Society & Culture';
2574
+ $temp['13-01'] = 'History';
2575
+ $temp['13-02'] = 'Personal Journals';
2576
+ $temp['13-03'] = 'Philosophy';
2577
+ $temp['13-04'] = 'Places & Travel';
2578
+
2579
+ $temp['14-00'] = 'Sports & Recreation';
2580
+ $temp['14-01'] = 'Amateur';
2581
+ $temp['14-02'] = 'College & High School';
2582
+ $temp['14-03'] = 'Outdoor';
2583
+ $temp['14-04'] = 'Professional';
2584
+
2585
+ $temp['15-00'] = 'Technology';
2586
+ $temp['15-01'] = 'Gadgets';
2587
+ $temp['15-02'] = 'Tech News';
2588
+ $temp['15-03'] = 'Podcasting';
2589
+ $temp['15-04'] = 'Software How-To';
2590
+
2591
+ $temp['16-00'] = 'TV & Film';
2592
+
2593
+ if( $PrefixSubCategories )
2594
+ {
2595
+ foreach( $temp as $key=> $val )
2596
+ {
2597
+ $parts = explode('-', $key);
2598
+ $cat = $parts[0];
2599
+ $subcat = $parts[1];
2600
+
2601
+ if( $subcat != '00' )
2602
+ $temp[$key] = $temp[$cat.'-00'].' > '.$val;
2603
+ }
2604
+ reset($temp);
2605
+ }
2606
+
2607
+ return $temp;
2608
+ }
2609
+
2610
+ /**
2611
+ * Categories for 2019+ Apple Podcast directory
2612
+ */
2613
+ function powerpress_apple_categories($PrefixSubCategories = false) {
2614
+ $temp = array();
2615
+ $temp['01-00'] = 'Arts';
2616
+ $temp['01-01'] = 'Books';
2617
+ $temp['01-02'] = 'Design';
2618
+ $temp['01-03'] = 'Fashion & Beauty';
2619
+ $temp['01-04'] = 'Food';
2620
+ $temp['01-05'] = 'Performing Arts';
2621
+ $temp['01-06'] = 'Visual Arts';
2622
+
2623
+ $temp['02-00'] = 'Business';
2624
+ $temp['02-01'] = 'Careers';
2625
+ $temp['02-02'] = 'Entrepreneurship';
2626
+ $temp['02-03'] = 'Investing';
2627
+ $temp['02-04'] = 'Management';
2628
+ $temp['02-05'] = 'Marketing';
2629
+ $temp['02-06'] = 'Non-profit';
2630
+
2631
+ $temp['03-00'] = 'Comedy';
2632
+ $temp['03-01'] = 'Comedy Interviews';
2633
+ $temp['03-02'] = 'Improv';
2634
+ $temp['03-03'] = 'Stand-Up';
2635
+
2636
+ $temp['04-00'] = 'Education';
2637
+ $temp['04-01'] = 'Courses';
2638
+ $temp['04-02'] = 'How To';
2639
+ $temp['04-03'] = 'Language Learning';
2640
+ $temp['04-04'] = 'Self-Improvement';
2641
+
2642
+ $temp['05-00'] = 'Fiction';
2643
+ $temp['05-01'] = 'Comedy Fiction';
2644
+ $temp['05-02'] = 'Drama';
2645
+ $temp['05-03'] = 'Science Fiction';
2646
+
2647
+ $temp['06-00'] = 'Government';
2648
+
2649
+ $temp['07-00'] = 'Health & Fitness';
2650
+ $temp['07-01'] = 'Alternative Health';
2651
+ $temp['07-02'] = 'Fitness';
2652
+ $temp['07-03'] = 'Medicine';
2653
+ $temp['07-04'] = 'Mental Health';
2654
+ $temp['07-05'] = 'Nutrition';
2655
+ $temp['07-06'] = 'Sexuality';
2656
+
2657
+ $temp['08-00'] = 'History';
2658
+
2659
+ $temp['09-00'] = 'Kids & Family';
2660
+ $temp['09-01'] = 'Education for Kids';
2661
+ $temp['09-02'] = 'Parenting';
2662
+ $temp['09-03'] = 'Pets & Animals';
2663
+ $temp['09-04'] = 'Stories for Kids';
2664
+
2665
+ $temp['10-00'] = 'Leisure';
2666
+ $temp['10-01'] = 'Animation & Manga';
2667
+ $temp['10-02'] = 'Automotive';
2668
+ $temp['10-03'] = 'Aviation';
2669
+ $temp['10-04'] = 'Crafts';
2670
+ $temp['10-05'] = 'Games';
2671
+ $temp['10-06'] = 'Hobbies';
2672
+ $temp['10-07'] = 'Home & Garden';
2673
+ $temp['10-08'] = 'Video Games';
2674
+
2675
+ $temp['11-00'] = 'Music';
2676
+ $temp['11-01'] = 'Music Commentary';
2677
+ $temp['11-02'] = 'Music History';
2678
+ $temp['11-03'] = 'Music Interviews';
2679
+
2680
+ $temp['12-00'] = 'News';
2681
+ $temp['12-01'] = 'Business News';
2682
+ $temp['12-02'] = 'Daily News';
2683
+ $temp['12-03'] = 'Entertainment News';
2684
+ $temp['12-04'] = 'News Commentary';
2685
+ $temp['12-05'] = 'Politics';
2686
+ $temp['12-06'] = 'Sports News';
2687
+ $temp['12-07'] = 'Tech News';
2688
+
2689
+ $temp['13-00'] = 'Religion & Spirituality';
2690
+ $temp['13-01'] = 'Buddhism';
2691
+ $temp['13-02'] = 'Christianity';
2692
+ $temp['13-03'] = 'Hinduism';
2693
+ $temp['13-04'] = 'Islam';
2694
+ $temp['13-05'] = 'Judaism';
2695
+ $temp['13-06'] = 'Religion';
2696
+ $temp['13-07'] = 'Spirituality';
2697
+
2698
+ $temp['14-00'] = 'Science';
2699
+ $temp['14-01'] = 'Astronomy';
2700
+ $temp['14-02'] = 'Chemistry';
2701
+ $temp['14-03'] = 'Earth Sciences';
2702
+ $temp['14-04'] = 'Life Sciences';
2703
+ $temp['14-05'] = 'Mathematics';
2704
+ $temp['14-06'] = 'Natural Sciences';
2705
+ $temp['14-07'] = 'Nature';
2706
+ $temp['14-08'] = 'Physics';
2707
+ $temp['14-09'] = 'Social Sciences';
2708
+
2709
+ $temp['15-00'] = 'Society & Culture';
2710
+ $temp['15-01'] = 'Documentary';
2711
+ $temp['15-02'] = 'Personal Journals';
2712
+ $temp['15-03'] = 'Philosophy';
2713
+ $temp['15-04'] = 'Places & Travel';
2714
+ $temp['15-06'] = 'Relationships';
2715
+
2716
+ $temp['16-00'] = 'Sports';
2717
+ $temp['16-01'] = 'Baseball';
2718
+ $temp['16-02'] = 'Basketball';
2719
+ $temp['16-03'] = 'Cricket';
2720
+ $temp['16-04'] = 'Fantasy Sports';
2721
+ $temp['16-05'] = 'Football';
2722
+ $temp['16-06'] = 'Golf';
2723
+ $temp['16-07'] = 'Hockey';
2724
+ $temp['16-08'] = 'Rugby';
2725
+ $temp['16-09'] = 'Running';
2726
+ $temp['16-10'] = 'Soccer';
2727
+ $temp['16-11'] = 'Swimming';
2728
+ $temp['16-12'] = 'Tennis';
2729
+ $temp['16-13'] = 'Volleyball';
2730
+ $temp['16-15'] = 'Wilderness';
2731
+ $temp['16-16'] = 'Wrestling';
2732
+
2733
+ $temp['17-00'] = 'Technology';
2734
+
2735
+ $temp['18-00'] = 'True Crime';
2736
+
2737
+ $temp['19-00'] = 'TV & Film';
2738
+ $temp['19-01'] = 'After shows';
2739
+ $temp['19-02'] = 'Film History';
2740
+ $temp['19-03'] = 'Film Interviews';
2741
+ $temp['19-04'] = 'Film Reviews';
2742
+ $temp['19-05'] = 'TV Reviews';
2743
+
2744
+ if( $PrefixSubCategories )
2745
+ {
2746
+ foreach( $temp as $key=> $val )
2747
+ {
2748
+ $parts = explode('-', $key);
2749
+ $cat = $parts[0];
2750
+ $subcat = $parts[1];
2751
+
2752
+ if( $subcat != '00' )
2753
+ $temp[$key] = $temp[$cat.'-00'].' > '.$val;
2754
+ }
2755
+ reset($temp);
2756
+ }
2757
+
2758
+ return $temp;
2759
+ }
2760
+
2761
+ function powerpress_googleplay_categories()
2762
+ {
2763
+ $temp = array();
2764
+ $temp['01-00'] = 'Arts';
2765
+ $temp['02-00'] = 'Business';
2766
+ $temp['03-00'] = 'Comedy';
2767
+ $temp['04-00'] = 'Education';
2768
+ $temp['05-00'] = 'Games & Hobbies';
2769
+ $temp['06-00'] = 'Government & Organizations';
2770
+ $temp['07-00'] = 'Health';
2771
+ $temp['08-00'] = 'Kids & Family';
2772
+ $temp['09-00'] = 'Music';
2773
+ $temp['10-00'] = 'News & Politics';
2774
+ $temp['11-00'] = 'Religion & Spirituality';
2775
+ $temp['12-00'] = 'Science & Medicine';
2776
+ $temp['13-00'] = 'Society & Culture';
2777
+ $temp['14-00'] = 'Sports & Recreation';
2778
+ $temp['15-00'] = 'Technology';
2779
+ $temp['16-00'] = 'TV & Film';
2780
+
2781
+ return $temp;
2782
+ }
2783
+
2784
+ function powerpress_get_root_url()
2785
+ {
2786
+ /*
2787
+ // OLD CODE:
2788
+ $powerpress_dirname = basename( POWERPRESS_ABSPATH );
2789
+ return WP_PLUGIN_URL . '/'. $powerpress_dirname .'/';
2790
+ */
2791
+ $local_path = __FILE__;
2792
+ if( DIRECTORY_SEPARATOR == '\\' ) { // Win32 fix
2793
+ $local_path = basename(dirname(__FILE__)) .'/'. basename(__FILE__);
2794
+ }
2795
+ $plugin_url = plugins_url('', $local_path);
2796
+ return $plugin_url . '/';
2797
+ }
2798
+
2799
+ function powerpress_get_the_exerpt($for_summary = false, $no_filters = false, $post_id = false)
2800
+ {
2801
+ if( $no_filters ) {
2802
+ if( $post_id > 0 ) {
2803
+ $post = get_post($post_id);
2804
+ $subtitle = $post->post_excerpt;
2805
+ if ( $subtitle == '') {
2806
+
2807
+ $subtitle = $post->post_content;
2808
+ $shortcodesTemp = $GLOBALS['shortcode_tags'];
2809
+ $GLOBALS['shortcode_tags']['skipto'] = 'powerpress_shortcode_skipto';
2810
+ $subtitle = do_shortcode($subtitle);
2811
+ $GLOBALS['shortcode_tags'] = $shortcodesTemp;
2812
+
2813
+ $subtitle = strip_shortcodes( $subtitle );
2814
+ $subtitle = str_replace(']]>', ']]&gt;', $subtitle);
2815
+ $subtitle = strip_tags($subtitle);
2816
+ }
2817
+ }
2818
+ else if( is_object($GLOBALS['post']) )
2819
+ {
2820
+ $subtitle = $GLOBALS['post']->post_excerpt;
2821
+ if ( $subtitle == '') {
2822
+
2823
+ $subtitle = $GLOBALS['post']->post_content;
2824
+
2825
+ $shortcodesTemp = $GLOBALS['shortcode_tags'];
2826
+ $GLOBALS['shortcode_tags']['skipto'] = 'powerpress_shortcode_skipto';
2827
+ $subtitle = do_shortcode($subtitle);
2828
+ $GLOBALS['shortcode_tags'] = $shortcodesTemp;
2829
+
2830
+ $subtitle = strip_shortcodes( $subtitle );
2831
+ $subtitle = str_replace(']]>', ']]&gt;', $subtitle);
2832
+ $subtitle = strip_tags($subtitle);
2833
+ }
2834
+ }
2835
+ } else {
2836
+ $subtitle = get_the_excerpt();
2837
+ }
2838
+
2839
+ $subtitle = trim( strip_tags( $subtitle ) );
2840
+ if( !empty($subtitle) )
2841
+ return $subtitle;
2842
+ return powerpress_get_the_content( $for_summary, $no_filters );
2843
+ }
2844
+
2845
+ function powerpress_get_the_content($for_summary = true, $no_filters = false, $no_strip_tags = false) {
2846
+ if( $no_filters ) {
2847
+ global $post;
2848
+ $content_no_html = $post->post_content;
2849
+
2850
+ $shortcodesTemp = $GLOBALS['shortcode_tags'];
2851
+ $GLOBALS['shortcode_tags']['skipto'] = 'powerpress_shortcode_skipto';
2852
+ $content_no_html = do_shortcode($content_no_html);
2853
+ $GLOBALS['shortcode_tags'] = $shortcodesTemp;
2854
+
2855
+ //$content_no_html = strip_shortcodes( $content_no_html );
2856
+ $content_no_html = str_replace(']]>', ']]&gt;', $content_no_html);
2857
+ $content_no_html = wp_staticize_emoji( _oembed_filter_feed_content( $content_no_html ) );
2858
+ } else {
2859
+ $content_no_html = get_the_content();
2860
+ }
2861
+
2862
+ $content_no_html = strip_shortcodes( $content_no_html );
2863
+ if( $no_strip_tags )
2864
+ return $content_no_html;
2865
+
2866
+ if( $for_summary ) {
2867
+ return trim( strip_tags($content_no_html, '<a><p><br><ul><li>') );
2868
+ }
2869
+ return trim( strip_tags($content_no_html) );
2870
+ }
2871
+
2872
+ function powerpress_enhanced_itunes_summary($no_filters = false)
2873
+ {
2874
+ if( $no_filters ) {
2875
+ $summary = powerpress_get_the_content(false, true, true);
2876
+ } else {
2877
+ $summary = apply_filters( 'the_content', powerpress_get_the_content(false, $no_filters, true) );
2878
+ }
2879
+ $summary = str_replace("<li>", '<li>* ', $summary); // Make sure our bullet lists stay nicely formatted.
2880
+ $summary = strip_tags($summary, '<a>'); // We can leave a tags for itunes:summary, this will also strip CDATA tags
2881
+ return $summary;
2882
+ }
2883
+
2884
+ function powerpress_url_in_feed($url) {
2885
+ if( defined('POWERPRESS_FEEDS_FORCE_HTTP') && is_feed() ) {
2886
+ if( preg_match('/^https:\/\/(.*)$/', $url, $matches) ) {
2887
+ return 'http://'.$matches[1];
2888
+ }
2889
+ }
2890
+ else if( defined('POWERPRESS_FEEDS_FORCE_HTTPS') && is_feed() ) {
2891
+ if( preg_match('/^http:\/\/(.*)$/', $url, $matches) ) {
2892
+ return 'https://'.$matches[1];
2893
+ }
2894
+ }
2895
+ return $url;
2896
+ }
2897
+
2898
+ function powerpress_format_itunes_value($value, $tag, $cdata=false)
2899
+ {
2900
+ if( $tag == 'summary' )
2901
+ $value = nl2br($value); // Does not remove existing br tags if present.
2902
+
2903
+ if( $cdata ) {
2904
+ $value = str_replace(']]>', ']]&gt;', $value);
2905
+ return powerpress_trim_itunes_value($value, $tag);
2906
+ }
2907
+
2908
+ if( !defined('POWERPRESS_DISABLE_ITUNES_UTF8') || POWERPRESS_DISABLE_ITUNES_UTF8 == false ) // If not defined or it is false
2909
+ {
2910
+ global $wpdb;
2911
+ switch( $wpdb->charset )
2912
+ {
2913
+ case 'utf8': break;
2914
+ case 'utf8mb3': break;
2915
+ case 'utf8mb4': break;
2916
+ default: {
2917
+
2918
+ // preg_match fails when it encounters invalid UTF8 in $string
2919
+ if ( 1 !== @preg_match( '/^./us', $value ) ) {
2920
+ $value = utf8_encode($value); // If it is not, convert to UTF-8 then decode it...
2921
+ }
2922
+ }
2923
+ }
2924
+ }
2925
+
2926
+ // Code added to solve issue with KimiliFlashEmbed plugin and also remove the shortcode for the WP Audio Player
2927
+ // 99.9% of the time this code will not be necessary
2928
+ $value = preg_replace("/\[(kml_(flash|swf)embed|audio\:)\b(.*?)(?:(\/))?(\]|$)/isu", '', $value);
2929
+ $value = @html_entity_decode($value, ENT_COMPAT, 'UTF-8'); // Remove any additional entities such as &nbsp;
2930
+ $value = preg_replace( '/&amp;/ui' , '&', $value); // Precaution in case it didn't get removed from function above.
2931
+
2932
+ return esc_html( powerpress_trim_itunes_value($value, $tag) );
2933
+ }
2934
+
2935
+ function powerpress_trim_itunes_value($value, $tag = 'summary')
2936
+ {
2937
+ $value = trim($value); // First we need to trim the string
2938
+ $length = (function_exists('mb_strlen')?mb_strlen($value):strlen($value) );
2939
+ $trim_at = false;
2940
+ $remove_new_lines = false;
2941
+
2942
+ switch($tag)
2943
+ {
2944
+ case 'description':
2945
+ case 'summary': {
2946
+ // 4000 character limit
2947
+ if( $length > 4000 )
2948
+ $trim_at = 3997; // 3 less characters so we can add a dot dot dot
2949
+ }; break;
2950
+ case 'subtitle':
2951
+ case 'author':
2952
+ case 'name':
2953
+ default: {
2954
+ $remove_new_lines = true;
2955
+ // 255 character limit
2956
+ if( $length > 255 )
2957
+ $trim_at = 252; // Allow 3 dots to be added after the trim
2958
+ };
2959
+ }
2960
+
2961
+ if( $trim_at )
2962
+ {
2963
+ // Start trimming
2964
+ $value = (function_exists('mb_substr')?mb_substr($value, 0, $trim_at):substr($value, 0, $trim_at) );
2965
+ $clean_break = false;
2966
+ if( preg_match('/(.*[,\n.\?!])[^,\n.\?!]/isu', $value, $matches) ) // pattern modifiers: case (i)nsensitive, entire (s)tring and (u)nicode
2967
+ {
2968
+ if( isset( $matches[1]) )
2969
+ {
2970
+ $detected_eof_pos = (function_exists('mb_strlen')?mb_strlen($matches[1]):strlen($matches[1]) );
2971
+ // Look back at most 50 characters...
2972
+ if( $detected_eof_pos > 3950 || ($detected_eof_pos > 205 && $detected_eof_pos < 255 ) )
2973
+ {
2974
+ $value = $matches[1];
2975
+ $clean_break = true;
2976
+ }
2977
+ // Otherwise we want to continue with the same value we started with...
2978
+ }
2979
+ }
2980
+
2981
+ if( $clean_break == false && $tag = 'subtitle' ) // Subtitle we want to add a ... at the end
2982
+ {
2983
+ if( $trim_at )
2984
+ $value = (function_exists('mb_substr')?mb_substr($value, 0, $trim_at):substr($value, 0, $trim_at) ). '...';
2985
+ }
2986
+ }
2987
+
2988
+ if( $remove_new_lines )
2989
+ $value = str_replace( array("\r\n\r\n", "\n", "\r", "\t","- "), array(' - ',' ', '', ' ', ''), $value );
2990
+
2991
+ return $value;
2992
+ }
2993
+
2994
+ function powerpress_add_redirect_url($MediaURL, $EpisodeData = false) // $channel = 'podcast')
2995
+ {
2996
+ if( preg_match('/^https?:\/\//i', $MediaURL) == 0 )
2997
+ return $MediaURL; // If the user is hosting media not via http (e.g. ftp) then we can't handle the redirect
2998
+
2999
+ if( !is_array($EpisodeData) )
3000
+ {
3001
+ $feed_slug = '';
3002
+ if( is_string($EpisodeData) && !empty($EpisodeData) ) {
3003
+ $feed_slug = $EpisodeData;
3004
+ }
3005
+
3006
+ $EpisodeData = array();
3007
+ if( !empty($feed_slug) )
3008
+ $EpisodeData['feed'] = $EpisodeData;
3009
+ }
3010
+
3011
+ if( empty($EpisodeData['feed']) )
3012
+ $EpisodeData['feed'] = 'podcast';
3013
+
3014
+ $NewURL = apply_filters( 'powerpress_redirect_url', $MediaURL, $EpisodeData );
3015
+
3016
+ $URLScheme = ( (preg_match('/^https:\/\//i', $NewURL) != 0 ) ? 'https://':'http://');
3017
+
3018
+ $GeneralSettings = get_option('powerpress_general');
3019
+ $Redirects = array('redirect0'=>'', 'redirect1'=>'', 'redirect2'=>'', 'redirect3'=>'');
3020
+ if( !empty($GeneralSettings['redirect1']) )
3021
+ $Redirects['redirect1'] = $GeneralSettings['redirect1'];
3022
+ if( !empty($GeneralSettings['redirect2']) )
3023
+ $Redirects['redirect2'] = $GeneralSettings['redirect2'];
3024
+ if( !empty($GeneralSettings['redirect3']) )
3025
+ $Redirects['redirect3'] = $GeneralSettings['redirect3'];
3026
+
3027
+ if( !empty($GeneralSettings['cat_casting']) ) { // If category podcasting...
3028
+
3029
+ if( !empty($EpisodeData['category']) ) {
3030
+
3031
+ $FeedCatSettings = get_option('powerpress_cat_feed_'.$EpisodeData['category'] );
3032
+ if( !empty($FeedCatSettings['redirect']) ) {
3033
+ $Redirects['redirect0'] = $FeedCatSettings['redirect'];
3034
+ $Redirects['redirect1'] = '';
3035
+ $Redirects['redirect2'] = '';
3036
+ $Redirects['redirect3'] = '';
3037
+ }
3038
+ if( !empty($FeedCatSettings['redirect2']) ) {
3039
+ $Redirects['redirect1'] = $FeedCatSettings['redirect2'];
3040
+ }
3041
+ } else { // Use the old way
3042
+
3043
+ if( is_category() ) { // Special case where we want to track the category separately
3044
+ $FeedCatSettings = get_option('powerpress_cat_feed_'.get_query_var('cat') );
3045
+ if( $FeedCatSettings && !empty($FeedCatSettings['redirect']) ) {
3046
+ $Redirects['redirect0'] = $FeedCatSettings['redirect'];
3047
+ $Redirects['redirect1'] = '';
3048
+ $Redirects['redirect2'] = '';
3049
+ $Redirects['redirect3'] = '';
3050
+ if( !empty($FeedCatSettings['redirect2']) ) {
3051
+ $Redirects['redirect1'] = $FeedCatSettings['redirect2'];
3052
+ }
3053
+ }
3054
+ } else if( is_single() ) {
3055
+ $categories = wp_get_post_categories( get_the_ID() );
3056
+ if( count($categories) == 1 ) { // See if only one category is associated with this post
3057
+ foreach( $categories as $null=> $cat_id ) {
3058
+ break;
3059
+ }
3060
+ $FeedCatSettings = get_option('powerpress_cat_feed_'.$cat_id );
3061
+ if( $FeedCatSettings && !empty($FeedCatSettings['redirect']) ) {
3062
+ $Redirects['redirect0'] = $FeedCatSettings['redirect'];
3063
+ $Redirects['redirect1'] = '';
3064
+ $Redirects['redirect2'] = '';
3065
+ $Redirects['redirect3'] = '';
3066
+ if( !empty($FeedCatSettings['redirect2']) ) {
3067
+ $Redirects['redirect1'] = $FeedCatSettings['redirect2'];
3068
+ }
3069
+ }
3070
+ }
3071
+ }
3072
+ }
3073
+ }
3074
+
3075
+ //custom_feeds
3076
+ if( !empty($GeneralSettings['channels']) ) {
3077
+
3078
+ $FeedSettings = get_option('powerpress_feed_'. $EpisodeData['feed']);
3079
+ if( !empty($FeedSettings['redirect']) )
3080
+ {
3081
+ // Override the redirect
3082
+ $Redirects['redirect0'] = $FeedSettings['redirect'];
3083
+ $Redirects['redirect1'] = '';
3084
+ $Redirects['redirect2'] = '';
3085
+ $Redirects['redirect3'] = '';
3086
+ }
3087
+ if( !empty($FeedSettings['redirect2']) ) {
3088
+ $Redirects['redirect1'] = $FeedSettings['redirect2'];
3089
+ }
3090
+ }
3091
+
3092
+ if( !empty($GeneralSettings['posttype_podcasting']) ) // Post Type Podcasting
3093
+ {
3094
+ $post_type = get_post_type();
3095
+ switch($post_type) {
3096
+ case 'post':
3097
+ case 'page': {
3098
+ // Do nothing!, we want the default podcast and channels to appear in these post types
3099
+ }; break;
3100
+ default: {
3101
+ $PostTypeSettingsArray = get_option('powerpress_posttype_'.$post_type);
3102
+
3103
+ // We found a post type statsitics tracking
3104
+ if( !empty($PostTypeSettingsArray[ $EpisodeData['feed'] ]['redirect']) )
3105
+ {
3106
+ $Redirects['redirect0'] = $PostTypeSettingsArray[ $EpisodeData['feed'] ]['redirect'];
3107
+ $Redirects['redirect1'] = '';
3108
+ $Redirects['redirect2'] = '';
3109
+ $Redirects['redirect3'] = '';
3110
+ }
3111
+ if( !empty($PostTypeSettingsArray[ $EpisodeData['feed'] ]['redirect2']) ) {
3112
+ $Redirects['redirect1'] = $PostTypeSettingsArray[ $EpisodeData['feed'] ]['redirect2'];
3113
+ }
3114
+ };
3115
+ }
3116
+ }
3117
+
3118
+ if( version_compare($GLOBALS['wp_version'], 4.5, '>=' ) )
3119
+ {
3120
+ if( !empty($GeneralSettings['taxonomy_podcasting']) ) // Taxonomy Podcasting
3121
+ {
3122
+ $PowerPressTaxonomies = get_option('powerpress_taxonomy_podcasting');
3123
+ if( !empty($PowerPressTaxonomies) )
3124
+ {
3125
+ $terms = get_terms();
3126
+ $ttid_found = 0;
3127
+ $TaxonomySettings = false;
3128
+
3129
+ foreach( $terms as $index=> $termObj )
3130
+ {
3131
+ // Skip the default taxonomies
3132
+ if( $termObj->taxonomy == 'category' || $termObj->taxonomy == 'link_category' || $termObj->taxonomy == 'post_tag' || $termObj->taxonomy == 'nav_menu' )
3133
+ continue;
3134
+
3135
+ if( !empty($PowerPressTaxonomies[ $termObj->term_taxonomy_id ]) )
3136
+ {
3137
+ $ttid_found = $termObj->term_taxonomy_id;
3138
+
3139
+ $TaxonomySettings = get_option('powerpress_taxonomy_'.$ttid_found);
3140
+ // Found it???
3141
+ if( !empty($TaxonomySettings['redirect']) )
3142
+ {
3143
+ $Redirects['redirect0'] = $TaxonomySettings['redirect'];
3144
+ $Redirects['redirect1'] = '';
3145
+ $Redirects['redirect2'] = '';
3146
+ $Redirects['redirect3'] = '';
3147
+ break;
3148
+ }
3149
+ }
3150
+ }
3151
+ }
3152
+ }
3153
+ }
3154
+
3155
+ // Allow other apps to update the redirects
3156
+ $Redirects = apply_filters('powerpress_redirects', $Redirects, $EpisodeData);
3157
+
3158
+ for( $x = 3; $x >= 0; $x-- )
3159
+ {
3160
+ $key = sprintf('redirect%d', $x);
3161
+ if( !empty($Redirects[ $key ]) )
3162
+ {
3163
+ if( preg_match('/^https?:\/\/(.*)$/', trim($Redirects[ $key ]) , $matches ) == 0 )
3164
+ continue;
3165
+
3166
+ $RedirectClean = $matches[1];
3167
+ if( substr($RedirectClean, -1, 1) != '/' ) // Rediercts need to end with a slash /.
3168
+ $RedirectClean .= '/';
3169
+
3170
+ if( !empty($RedirectClean) )
3171
+ {
3172
+ if( strpos($RedirectClean, '/') == 0 ) // Not a valid redirect URL
3173
+ continue;
3174
+
3175
+
3176
+ // Check that redirect is either media.blubrry.com, media.techpodcasts.com, media.rawvoice.com, or *.podtrac.com
3177
+ $ValidRedirectDomains = array('media.blubrry.com', 'media.rawvoice.com', 'media.techpodcasts.com', 'www.podtrac.com', 'podtrac.com');
3178
+ $ValidRedirectDomainsPattern = '/^(media\.blubrry\.com|media\.rawvoice\.com|media\.techpodcasts\.com|.*\.podtrac\.com|traffic\.cast\.plus)$/';
3179
+ if( $URLScheme == 'https://' ) {
3180
+ $ValidRedirectDomains = array('media.blubrry.com', 'media.rawvoice.com', 'www.podtrac.com', 'podtrac.com'); // Only URLs that support https:// to an https:// media file
3181
+ $ValidRedirectDomainsPattern = '/^(media\.blubrry\.com|media\.rawvoice\.com|.*\.podtrac\.com|traffic\.cast\.plus)$/';
3182
+ }
3183
+
3184
+ $RedirectDomain = strtolower(substr($RedirectClean, 0, strpos($RedirectClean, '/') ));
3185
+
3186
+ if( preg_match($ValidRedirectDomainsPattern, $RedirectDomain) == 0 )
3187
+ continue;
3188
+
3189
+ //if( !in_array($RedirectDomain, $ValidRedirectDomains) )
3190
+ // continue; // Not a valid domain so lets not add it
3191
+
3192
+ // Make sure we are no longer doubling up on media.blubrry.com or media.rawvoice.com redirects
3193
+ //if( ($RedirectDomain == 'media.blubrry.com'||$RedirectDomain == 'media.rawvoice.com') && strstr($NewURL, '/'.$RedirectDomain.'/') )
3194
+ //{
3195
+ // // Strip the media.blubrry.com/XXX/x/ or media.blubrry.com/xxx/ from the URL since we will be replacing it
3196
+ // if( preg_match('/^(.*\/)media\.(?:blubrry|rawvoice)\.com\/[a-zA-Z0-9_-]{2,60}\/([a-zA-Z0-9]\/)?(.*)$/', $NewURL, $matches) )
3197
+ // {
3198
+ // $NewURL = $matches[1].$matches[3];
3199
+ // }
3200
+ //}
3201
+
3202
+ if( !strstr($NewURL, $RedirectClean) ) // If the redirect is not already added...
3203
+ $NewURL = $URLScheme. $RedirectClean . str_replace($URLScheme, '', $NewURL);
3204
+ }
3205
+ }
3206
+ }
3207
+
3208
+ return $NewURL;
3209
+ }
3210
+
3211
+ function powerpress_add_flag_to_redirect_url($MediaURL, $Flag)
3212
+ {
3213
+ // First strip any previous flags...
3214
+ $MediaURL = preg_replace('/(media\.(blubrry|techpodcasts|rawvoice|podcasternews)\.com\/[A-Za-z0-9-_]+\/)([A-Za-z0-9]\/)?/i', '$1'."", $MediaURL);
3215
+ return preg_replace('/(media\.(blubrry|techpodcasts|rawvoice|podcasternews)\.com\/[A-Za-z0-9-_]+\/)('.$Flag.'\/)?/i', '$1'."$Flag/", $MediaURL);
3216
+ }
3217
+
3218
+ /*
3219
+ Code contributed from upekshapriya on the Blubrry Forums
3220
+ */
3221
+ function powerpress_byte_size($ppbytes)
3222
+ {
3223
+ $ppbytes = intval($ppbytes);
3224
+ if( empty($ppbytes) )
3225
+ return '';
3226
+ $ppsize = intval($ppbytes) / 1024;
3227
+ if($ppsize < 1024)
3228
+ {
3229
+ $ppsize = number_format($ppsize, 1);
3230
+ $ppsize .= 'KB';
3231
+ }
3232
+ else
3233
+ {
3234
+ if($ppsize / 1024 < 1024)
3235
+ {
3236
+ $ppsize = number_format($ppsize / 1024, 1);
3237
+ $ppsize .= 'MB';
3238
+ }
3239
+ else if ($ppsize / 1024 / 1024 < 1024)
3240
+ {
3241
+ $ppsize = number_format($ppsize / 1024 / 1024, 1);
3242
+ $ppsize .= 'GB';
3243
+ }
3244
+ }
3245
+ return $ppsize;
3246
+ }
3247
+
3248
+ // Merges settings from feed settings page to empty custom feed settings
3249
+ function powerpress_merge_empty_feed_settings($CustomFeedSettings, $FeedSettings, $DefaultPodcastFeed = false)
3250
+ {
3251
+ unset($FeedSettings['apply_to']);
3252
+ // Remove settings from main $FeedSettings that should not be copied to custom feed.
3253
+ if( !$DefaultPodcastFeed )
3254
+ {
3255
+ unset($FeedSettings['itunes_new_feed_url']);
3256
+ unset($FeedSettings['feed_redirect_url']);
3257
+ unset($FeedSettings['itunes_complete']);
3258
+ unset($FeedSettings['itunes_block']);
3259
+ unset($FeedSettings['maximize_feed']);
3260
+ }
3261
+
3262
+ // If the setting is not already set, set the enhnaced itunes setting if they have PHP5+ on by default
3263
+ if( !isset($FeedSettings['enhance_itunes_summary']) )
3264
+ $FeedSettings['enhance_itunes_summary'] = 0;
3265
+
3266
+ if( !$CustomFeedSettings )
3267
+ return $FeedSettings; // If the $CustomFeedSettings is false
3268
+
3269
+ foreach( $CustomFeedSettings as $key=> $value )
3270
+ {
3271
+ if( $value !== '' || !isset($FeedSettings[$key]) )
3272
+ $FeedSettings[$key] = $value;
3273
+ }
3274
+
3275
+ return $FeedSettings;
3276
+ }
3277
+
3278
+ function powerpress_readable_duration($duration, $include_hour=false)
3279
+ {
3280
+ $seconds = 0;
3281
+ $parts = explode(':', $duration);
3282
+ if( count($parts) == 3 )
3283
+ $seconds = $parts[2] + ($parts[1]*60) + ($parts[0]*60*60);
3284
+ else if ( count($parts) == 2 )
3285
+ $seconds = $parts[1] + ($parts[0]*60);
3286
+ else
3287
+ $seconds = $parts[0];
3288
+
3289
+ $hours = 0;
3290
+ $minutes = 0;
3291
+ if( $seconds >= (60*60) )
3292
+ {
3293
+ $hours = floor( $seconds /(60*60) );
3294
+ $seconds -= (60*60*$hours);
3295
+ }
3296
+ if( $seconds >= (60) )
3297
+ {
3298
+ $minutes = floor( $seconds /(60) );
3299
+ $seconds -= (60*$minutes);
3300
+ }
3301
+
3302
+ if( $hours || $include_hour ) // X:XX:XX (readable)
3303
+ return sprintf('%d:%02d:%02d', $hours, $minutes, $seconds);
3304
+
3305
+ return sprintf('%d:%02d', $minutes, $seconds); // X:XX or 0:XX (readable)
3306
+ }
3307
+
3308
+ // Duratoin in form of seconds (parses hh:mm:ss)
3309
+ function powerpress_raw_duration($duration)
3310
+ {
3311
+ $duration = trim($duration);
3312
+ $Parts = explode(':',$duration);
3313
+ if( empty($Parts) )
3314
+ return $duration;
3315
+
3316
+ if( count($Parts) == 3 )
3317
+ return (($Parts[0]*60*60) + ($Parts[1]*60) +$Parts[2]);
3318
+ else if( count($Parts) == 2 )
3319
+ return (($Parts[0]*60) +$Parts[1]);
3320
+ //else if( count($Parts) == 1 )
3321
+ // return ($Parts[0]);
3322
+
3323
+ // We never found any colons, so we assume duration is seconds
3324
+ return $duration;
3325
+ }
3326
+
3327
+ // For grabbing data from Podpress data stored serialized, the strings for some values can sometimes get corrupted, so we fix it...
3328
+
3329
+ function powerpress_repair_serialize($string)
3330
+ {
3331
+ if( @unserialize($string) )
3332
+ return $string; // Nothing to repair...
3333
+
3334
+ $string = preg_replace_callback('/(s:(\d+):"([^"]*)")/',
3335
+ 'powerpress_repair_serialize_callback',
3336
+ $string);
3337
+
3338
+ if( substr($string, 0, 2) == 's:' ) // Sometimes the serialized data is double serialized, so we need to re-serialize the outside string
3339
+ {
3340
+ $string = preg_replace_callback('/(s:(\d+):"(.*)"(;))$/',
3341
+ 'powerpress_repair_serialize_callback',
3342
+ $string);
3343
+ }
3344
+
3345
+ return $string;
3346
+ }
3347
+
3348
+ function powerpress_repair_serialize_callback($matches)
3349
+ {
3350
+ if( strlen($matches[3]) == $matches[2] )
3351
+ return $matches[0];
3352
+ return sprintf('s:%d:"%s"', strlen($matches[3]), $matches[3]) . (!empty($matches[4])?';':'');
3353
+ }
3354
+
3355
+ function powerpress_base64_encode($value)
3356
+ {
3357
+ return rtrim(strtr(base64_encode($value), '+/', '-_'), '=');
3358
+ }
3359
+ /*
3360
+ powerpress_get_post_meta()
3361
+ Safe function to retrieve corrupted PodPress data from the database
3362
+ @post_id - post id to retrieve post meta for
3363
+ @key - key to retrieve post meta for
3364
+ */
3365
+ function powerpress_get_post_meta($post_id, $key)
3366
+ {
3367
+ $pp_meta_cache = wp_cache_get($post_id, 'post_meta');
3368
+ if ( !$pp_meta_cache ) {
3369
+ update_postmeta_cache($post_id);
3370
+ $pp_meta_cache = wp_cache_get($post_id, 'post_meta');
3371
+ }
3372
+
3373
+ $meta = false;
3374
+ if ( isset($pp_meta_cache[$key]) )
3375
+ $meta = $pp_meta_cache[$key][0];
3376
+
3377
+ if ( is_serialized( $meta ) ) // Logic used up but not including WordPress 2.8, new logic doesn't make sure if unserialized failed or not
3378
+ {
3379
+ if ( false !== ( $gm = @unserialize( $meta ) ) )
3380
+ return $meta;
3381
+ }
3382
+
3383
+ return $meta;
3384
+ }
3385
+
3386
+ function powerpress_get_enclosure($post_id, $feed_slug = 'podcast')
3387
+ {
3388
+ $Data = powerpress_get_enclosure_data($post_id, $feed_slug);
3389
+ if( $Data )
3390
+ return $Data['url'];
3391
+ return false;
3392
+ }
3393
+
3394
+ function powerpress_get_enclosure_data($post_id, $feed_slug = 'podcast', $raw_data = false, $add_redirect=true)
3395
+ {
3396
+ global $post;
3397
+ if( false != $raw_data )
3398
+ $MetaData = $raw_data;
3399
+ else
3400
+ {
3401
+ if( !empty($post->podcast_meta_value) && $post->ID == $post_id) // See if we got the meta data from the initial query...
3402
+ {
3403
+ $PodcastData = powerpress_get_enclosure_data($post_id, $feed_slug, $post->podcast_meta_value, true);
3404
+ return $PodcastData;
3405
+ }
3406
+
3407
+ if( 'podcast' == $feed_slug || '' == $feed_slug )
3408
+ $MetaData = get_post_meta($post_id, 'enclosure', true);
3409
+ else
3410
+ $MetaData = get_post_meta($post_id, '_'. $feed_slug .':enclosure', true);
3411
+ }
3412
+ if( empty($MetaData) )
3413
+ return false;
3414
+
3415
+ $MetaParts = explode("\n", $MetaData, 4);
3416
+
3417
+ $Serialized = false;
3418
+ $Data = array();
3419
+ $Data['id'] = $post_id;
3420
+ $Data['feed'] = $feed_slug;
3421
+ $Data['url'] = '';
3422
+ $Data['duration'] = '';
3423
+ $Data['size'] = '';
3424
+ $Data['type'] = '';
3425
+ $Data['width'] = '';
3426
+ $Data['height'] = '';
3427
+
3428
+ if( count($MetaParts) > 0 )
3429
+ $Data['url'] = trim($MetaParts[0]);
3430
+ if( count($MetaParts) > 1 )
3431
+ $Data['size'] = trim($MetaParts[1]);
3432
+ if( count($MetaParts) > 2 )
3433
+ $Data['type'] = trim($MetaParts[2]);
3434
+ if( count($MetaParts) > 3 )
3435
+ $Serialized = $MetaParts[3];
3436
+
3437
+ if( $Serialized )
3438
+ {
3439
+ $ExtraData = @unserialize($Serialized);
3440
+ if( $ExtraData && is_array($ExtraData) )
3441
+ {
3442
+ foreach( $ExtraData as $key=> $value ) {
3443
+
3444
+ // Make sure specific fields are not overwritten...
3445
+ switch( $key ) {
3446
+ case 'id':
3447
+ case 'feed':
3448
+ case 'url':
3449
+ case 'size':
3450
+ case 'type': break;
3451
+ default: $Data[ $key ] = $value;
3452
+ }
3453
+ }
3454
+
3455
+ if( isset($Data['length']) ) // Setting from the "Podcasting" plugin...
3456
+ $Data['duration'] = powerpress_readable_duration($Data['length'], true);
3457
+
3458
+ if( !empty($Data['webm_src']) )
3459
+ {
3460
+ $Data['webm_src'] = trim($Data['webm_src']);
3461
+ }
3462
+
3463
+
3464
+ if( strpos($MetaParts[0], 'http://') !== 0 && !empty($Data['hosting']) ) // if the URL is not set (just file name) and we're a hosting customer...
3465
+ {
3466
+ $post_status = get_post_status($post_id);
3467
+ switch( $post_status )
3468
+ {
3469
+ case 'pending':
3470
+ case 'draft':
3471
+ case 'auto-draft': {
3472
+ // Determine if audio or video, then set the demo episode here...
3473
+ $Data['url'] = 'http://media.blubrry.com/blubrry/content.blubrry.com/blubrry/preview.mp3'; // audio
3474
+ if( strstr($Data['type'], 'video') )
3475
+ $Data['url'] = 'http://media.blubrry.com/blubrry/content.blubrry.com/blubrry/preview.mp4'; // video
3476
+ }; break;
3477
+ }
3478
+ }
3479
+ }
3480
+ }
3481
+
3482
+ // If the URL is using Blubrry hosting, then lets pump it up to https...
3483
+ if( is_ssl() && preg_match('/^http:\/\/(.*\/content\.blubrry\.com\/.*)$/i', $Data['url'], $matches) )
3484
+ {
3485
+ $Data['url'] = 'https://'. $matches[1];
3486
+ }
3487
+
3488
+ // Check that the content type is a valid one...
3489
+ if( strstr($Data['type'], '/') == false )
3490
+ $Data['type'] = powerpress_get_contenttype($Data['url']);
3491
+
3492
+ // Do redirect filter here...
3493
+ if( $add_redirect && !empty($Data['url']) )
3494
+ $Data['url'] = powerpress_add_redirect_url( $Data['url'], $Data );
3495
+
3496
+ if( $add_redirect && !empty($Data['webm_src']) )
3497
+ $Data['webm_src'] = powerpress_add_redirect_url( $Data['webm_src'], $Data );
3498
+
3499
+ return apply_filters('powerpress_get_enclosure_data', $Data);
3500
+ }
3501
+
3502
+ function powerpress_get_enclosure_data_podpress($post_id, $mediaNum = 0, $include_premium = false)
3503
+ {
3504
+ $podPressMedia = powerpress_get_post_meta($post_id, 'podPressMedia');
3505
+ if( !$podPressMedia )
3506
+ $podPressMedia = powerpress_get_post_meta($post_id, '_podPressMedia'); // handles latest verions of PodPress
3507
+ if( $podPressMedia )
3508
+ {
3509
+
3510
+ if( !is_array($podPressMedia) )
3511
+ {
3512
+ // Sometimes the stored data gets messed up, we can fix it here:
3513
+ $podPressMedia = powerpress_repair_serialize($podPressMedia);
3514
+ $podPressMedia = @unserialize($podPressMedia);
3515
+ }
3516
+
3517
+ // Do it a second time in case it is double serialized
3518
+ if( !is_array($podPressMedia) )
3519
+ {
3520
+ // Sometimes the stored data gets messed up, we can fix it here:
3521
+ $podPressMedia = powerpress_repair_serialize($podPressMedia);
3522
+ $podPressMedia = @unserialize($podPressMedia);
3523
+ }
3524
+
3525
+ if( is_array($podPressMedia) && isset($podPressMedia[$mediaNum]) && isset($podPressMedia[$mediaNum]['URI']) )
3526
+ {
3527
+ if( $include_premium == false && isset($podPressMedia[$mediaNum]['premium_only']) && ($podPressMedia[$mediaNum]['premium_only'] == 'on' || $podPressMedia[$mediaNum]['premium_only'] == true) )
3528
+ return false;
3529
+
3530
+ $Data = array();
3531
+ $Data['id'] = $post_id;
3532
+ $Data['feed'] = 'podcast';
3533
+ $Data['duration'] = 0;
3534
+ $Data['url'] = '';
3535
+ $Data['size'] = 0;
3536
+ $Data['type'] = '';
3537
+ $Data['width'] = '';
3538
+ $Data['height'] = '';
3539
+
3540
+ $Data['url'] = $podPressMedia[$mediaNum]['URI'];
3541
+ if( isset($podPressMedia[$mediaNum]['size']) )
3542
+ $Data['size'] = $podPressMedia[$mediaNum]['size'];
3543
+ if( isset($PodPressSettings[$mediaNum]['duration']) )
3544
+ $Data['duration'] = $podPressMedia[$mediaNum]['duration'];
3545
+ if( isset($PodPressSettings[$mediaNum]['previewImage']) )
3546
+ $Data['image'] = $podPressMedia[$mediaNum]['previewImage'];
3547
+
3548
+ if( strpos($Data['url'], 'http://' ) !== 0 && strpos($Data['url'], 'https://' ) !== 0 )
3549
+ {
3550
+ $PodPressSettings = get_option('podPress_config');
3551
+ if( $PodPressSettings && isset($PodPressSettings['mediaWebPath']) )
3552
+ $Data['url'] = rtrim($PodpressSettings['mediaWebPath'], '/') . '/' . ltrim($Data['url'], '/');
3553
+ unset($PodPressSettings);
3554
+ }
3555
+
3556
+ if( strpos($Data['url'], 'http://' ) !== 0 && strpos($Data['url'], 'https://' ) !== 0 )
3557
+ {
3558
+ $Settings = get_option('powerpress_general');
3559
+ if( $Settings && isset($Settings['default_url']) )
3560
+ $Data['url'] = rtrim($Settings['default_url'], '/') . '/' . ltrim($Data['url'], '/');
3561
+ }
3562
+
3563
+ if( strpos($Data['url'], 'http://' ) !== 0 && strpos($Data['url'], 'https://' ) !== 0 )
3564
+ return false;
3565
+
3566
+ $Data['type'] = powerpress_get_contenttype($Data['url']); // Detect the content type
3567
+ $Data['url'] = powerpress_add_redirect_url($Data['url'], $Data); // Add redirects to Media URL
3568
+
3569
+ return apply_filters('powerpress_get_enclosure_data', $Data);
3570
+ }
3571
+ }
3572
+ return false;
3573
+ }
3574
+
3575
+ function powerpress_get_apple_id($url, $strict=false)
3576
+ {
3577
+ if( $strict )
3578
+ {
3579
+ $results = preg_match('/apple\.com\/.*\/id(\d+)/i', $url, $matches);
3580
+ if( !$results )
3581
+ $results = preg_match('/apple\.com\/.*id\=(\d+)/i', $url, $matches);
3582
+ if( $results )
3583
+ return $matches[1];
3584
+ return 0;
3585
+ }
3586
+ $results = preg_match('/\/id(\d+)/i', $url, $matches);
3587
+ if( !$results )
3588
+ $results = preg_match('/id\=(\d+)/i', $url, $matches);
3589
+ if( $results )
3590
+ return $matches[1];
3591
+ return 0;
3592
+ }
3593
+
3594
+
3595
+ function the_powerpress_all_players($slug = false, $no_link=false)
3596
+ {
3597
+ echo get_the_powerpress_all_players($slug, $no_link);
3598
+ }
3599
+
3600
+ function get_the_powerpress_all_players($slug = false, $no_link=false)
3601
+ {
3602
+ $return = '';
3603
+ //Use this function to insert the Powerpress player anywhere in the page.
3604
+ //Made by Nicolas Bouliane (http://nicolasbouliane.com/)
3605
+
3606
+ /*We're going to use the Loop to retrieve the latest post with the 'enclosure' custom key set
3607
+ //then interpret it and manually launch powerpressplayer_build with the URL contained within
3608
+ //that data.*/
3609
+
3610
+ //Let's reset the Loop to make sure we look through all posts
3611
+ rewind_posts();
3612
+
3613
+ // Get the list of podcast channel slug names...
3614
+ $GeneralSettings = get_option('powerpress_general');
3615
+
3616
+ // No player or links to add to content...
3617
+ if( !empty($GeneralSettings['disable_appearance']) )
3618
+ return $return;
3619
+
3620
+ $ChannelSlugs = array('podcast');
3621
+ if( $slug == false )
3622
+ {
3623
+ if( isset($GeneralSettings['custom_feeds']['podcast']) )
3624
+ $ChannelSlugs = array(); // Reset the array so it is added from the list in specified order
3625
+ foreach( $GeneralSettings['custom_feeds'] as $feed_slug=> $null )
3626
+ $ChannelSlugs[] = $feed_slug;
3627
+ }
3628
+ else if( is_array($slug) )
3629
+ {
3630
+ $ChannelSlugs = $slug;
3631
+ }
3632
+ else
3633
+ {
3634
+ $ChannelSlugs = array($slug);
3635
+ }
3636
+
3637
+ // Loop through the posts
3638
+ while( have_posts() )
3639
+ {
3640
+ the_post();
3641
+
3642
+ foreach( $ChannelSlugs as $null=> $feed_slug )
3643
+ {
3644
+ // Do we follow the global settings to disable a player?
3645
+ if( isset($GeneralSettings['disable_player']) && isset($GeneralSettings['disable_player'][$feed_slug]) && $slug == false )
3646
+ continue;
3647
+
3648
+ $EpisodeData = powerpress_get_enclosure_data(get_the_ID(), $feed_slug);
3649
+ if( !$EpisodeData && !empty($GeneralSettings['process_podpress']) && $feed_slug == 'podcast' )
3650
+ $EpisodeData = powerpress_get_enclosure_data_podpress(get_the_ID());
3651
+
3652
+ if( !$EpisodeData )
3653
+ continue;
3654
+
3655
+ $AddDefaultPlayer = true;
3656
+ if( !empty($EpisodeData['embed']) )
3657
+ {
3658
+ $return .= $EpisodeData['embed'];
3659
+ if( !empty($GeneralSettings['embed_replace_player']) )
3660
+ $AddDefaultPlayer = false;
3661
+ }
3662
+
3663
+ if( isset($GeneralSettings['premium_caps']) && $GeneralSettings['premium_caps'] && !powerpress_premium_content_authorized($feed_slug) )
3664
+ {
3665
+ $return .= powerpress_premium_content_message(get_the_ID(), $feed_slug, $EpisodeData);
3666
+ continue;
3667
+ }
3668
+
3669
+ if( !isset($EpisodeData['no_player']) && $AddDefaultPlayer )
3670
+ {
3671
+ do_action('wp_powerpress_player_scripts');
3672
+ $return .= apply_filters('powerpress_player', '', powerpress_add_flag_to_redirect_url($EpisodeData['url'], 'p'), $EpisodeData );
3673
+ }
3674
+ if( !isset($EpisodeData['no_links']) && $no_link == false )
3675
+ {
3676
+ do_action('wp_powerpress_player_scripts');
3677
+ $return .= apply_filters('powerpress_player_links', '', powerpress_add_flag_to_redirect_url($EpisodeData['url'], 'p'), $EpisodeData );
3678
+ $return .= apply_filters('powerpress_player_subscribe_links', '', powerpress_add_flag_to_redirect_url($EpisodeData['url'], 'p'), $EpisodeData );
3679
+ }
3680
+ }
3681
+ reset($ChannelSlugs);
3682
+ }
3683
+
3684
+ return $return;
3685
+ }
3686
+
3687
+ function powerpress_premium_content_authorized_filter($default, $feed_slug)
3688
+ {
3689
+ if( $feed_slug != 'podcast' )
3690
+ {
3691
+ $FeedSettings = get_option('powerpress_feed_'. $feed_slug);
3692
+ if( isset($FeedSettings['premium']) && $FeedSettings['premium'] != '' )
3693
+ return current_user_can($FeedSettings['premium']);
3694
+ }
3695
+
3696
+ $post_type = get_query_var('post_type');
3697
+ if ( is_array( $post_type ) ) {
3698
+ $post_type = reset( $post_type ); // get first element in array
3699
+ }
3700
+
3701
+ if( $post_type != 'post' )
3702
+ {
3703
+ $GeneralSettings = get_option('powerpress_general');
3704
+ if( !empty($GeneralSettings['posttype_podcasting']) ) // Custom Post Types
3705
+ {
3706
+ // Get the feed slugs and titles for this post type
3707
+ $PostTypeSettingsArray = get_option('powerpress_posttype_'.$post_type);
3708
+ if( !empty($PostTypeSettingsArray[$feed_slug]['premium']) )
3709
+ return current_user_can($PostTypeSettingsArray[$feed_slug]['premium']);
3710
+ }
3711
+ }
3712
+
3713
+ return $default;
3714
+ }
3715
+ add_filter('powerpress_premium_content_authorized', 'powerpress_premium_content_authorized_filter', 10, 2);
3716
+
3717
+ function powerpress_premium_content_authorized($feed_slug)
3718
+ {
3719
+ return apply_filters('powerpress_premium_content_authorized', true, $feed_slug );
3720
+ }
3721
+
3722
+ function powerpress_premium_content_message($post_id, $feed_slug, $EpisodeData = false)
3723
+ {
3724
+ if( !$EpisodeData && $post_id )
3725
+ $EpisodeData = powerpress_get_enclosure_data($post_id, $feed_slug);
3726
+
3727
+ if( !$EpisodeData )
3728
+ return '';
3729
+ $FeedSettings = get_option('powerpress_feed_'.$feed_slug);
3730
+ $post_type = get_query_var('post_type');
3731
+ if ( is_array( $post_type ) ) {
3732
+ $post_type = reset( $post_type ); // get first element in array
3733
+ }
3734
+
3735
+ if( $post_type != 'post' )
3736
+ {
3737
+ $GeneralSettings = get_option('powerpress_general');
3738
+ if( !empty($GeneralSettings['posttype_podcasting']) ) // Custom Post Types
3739
+ {
3740
+ // Get the feed slugs and titles for this post type
3741
+ $PostTypeSettingsArray = get_option('powerpress_posttype_'.$post_type);
3742
+ if( !empty($PostTypeSettingsArray[$feed_slug]['premium']) )
3743
+ {
3744
+ $FeedSettings = $PostTypeSettingsArray[$feed_slug];
3745
+ }
3746
+ }
3747
+ }
3748
+
3749
+ $extension = 'unknown';
3750
+ $parts = pathinfo($EpisodeData['url']);
3751
+ if( $parts && isset($parts['extension']) )
3752
+ $extension = strtolower($parts['extension']);
3753
+
3754
+ if( isset($FeedSettings['premium_label']) && $FeedSettings['premium_label'] != '' ) // User has a custom label
3755
+ return '<p class="powerpress_links powerpress_links_'. $extension .'">'. $FeedSettings['premium_label'] . '</p>'.PHP_EOL_WEB;
3756
+
3757
+ return '<p class="powerpress_links powerpress_links_'. $extension .'">'. htmlspecialchars($FeedSettings['title']) .': <a href="'. get_bloginfo('url') .'/wp-login.php" title="Protected Content">(Protected Content)</a></p>'.PHP_EOL_WEB;
3758
+ }
3759
+
3760
+ function powerpress_is_mobile_client()
3761
+ {
3762
+ _deprecated_function( __FUNCTION__, '7.0' );
3763
+ return false;
3764
+ }
3765
+
3766
+ function powerpress_get_api_array()
3767
+ {
3768
+ $return = array();
3769
+ if( strstr(POWERPRESS_BLUBRRY_API_URL, 'http://api.blubrry.com') == false ) // If not the default
3770
+ {
3771
+ $return = explode(';', POWERPRESS_BLUBRRY_API_URL);
3772
+ }
3773
+ else
3774
+ {
3775
+ $return[] = 'https://api.blubrry.com/'; // Use secure URL first when possible
3776
+ $return[] = 'http://api.blubrry.net/';
3777
+ $return[] = 'http://api.blubrry.com/';
3778
+ }
3779
+
3780
+ return $return;
3781
+ }
3782
+
3783
+
3784
+ function powerpress_in_wp_head()
3785
+ {
3786
+ $e = new Exception();
3787
+ $trace = $e->getTrace();
3788
+
3789
+ if( !empty($trace) ) {
3790
+ foreach( $trace as $index=> $call ) {
3791
+ if( isset($call['function']) ) {
3792
+ // Which calls should we not add the player and links...
3793
+ switch( $call['function'] ) {
3794
+ case 'wp_head': return true; break;
3795
+ }
3796
+ }
3797
+ }
3798
+ }
3799
+ return false;
3800
+ }
3801
+
3802
+ function powerpress_in_custom_post_widget()
3803
+ {
3804
+ if( !class_exists('custom_post_widget') )
3805
+ return false;
3806
+
3807
+ $e = new Exception();
3808
+ $trace = $e->getTrace();
3809
+
3810
+ if( !empty($trace) ) {
3811
+
3812
+ foreach( $trace as $index=> $call ) {
3813
+ if( isset($call['function']) ) {
3814
+ // Which calls should we not add the player and links...
3815
+ switch( $call['function'] ) {
3816
+ case 'custom_post_widget_shortcode': return true; break;
3817
+ }
3818
+ }
3819
+ }
3820
+ }
3821
+ return false;
3822
+ }
3823
+ /*
3824
+ End Helper Functions
3825
+ */
3826
+
3827
+ // Are we in the admin?
3828
+ if( is_admin() )
3829
+ {
3830
+ require_once(POWERPRESS_ABSPATH.'/powerpressadmin.php');
3831
+ register_activation_hook( __FILE__, 'powerpress_admin_activate' );
3832
+ }
3833
+
3834
+ if( defined('POWERPRESS_SUBSCRIBE') && POWERPRESS_SUBSCRIBE )
3835
+ {
3836
+ require_once(POWERPRESS_ABSPATH.'/powerpress-subscribe.php');
3837
+ }
3838
+
3839
+ // For testing purposes in development
3840
+ if( defined('POWERPRESS_NEW_CODE') && POWERPRESS_NEW_CODE && file_exists(POWERPRESS_ABSPATH.'/powerpress-new-code.php') )
3841
+ {
3842
+ require_once(POWERPRESS_ABSPATH.'/powerpress-new-code.php');
3843
+ }
3844
+
3845
+ if( defined('POWERPRESS_PREMIUM_GROUPS_PLUGIN') ) {
3846
+
3847
+ function powerpress_pre_get_posts($query) {
3848
+ if( is_feed() && powerpress_is_custom_podcast_feed() && method_exists('Groups_Post_Access', 'posts_where') )
3849
+ {
3850
+ $feed_slug = get_query_var('feed');
3851
+
3852
+ if( $feed_slug != 'podcast' )
3853
+ {
3854
+ $FeedSettings = get_option('powerpress_feed_'.$feed_slug);
3855
+ if( !empty($FeedSettings['premium']) )
3856
+ {
3857
+ if( has_filter('posts_where', 'Groups_Post_Access::posts_where') )
3858
+ {
3859
+ remove_filter('posts_where', 'Groups_Post_Access::posts_where');
3860
+ }
3861
+ }
3862
+ }
3863
+ }
3864
+ }
3865
+ add_filter('pre_get_posts', 'powerpress_pre_get_posts');
3866
+ }
3867
+
3868
  // eof
powerpressadmin-pts.php CHANGED
@@ -64,7 +64,7 @@ class PowerPressPostToSocial {
64
  $guid = urlencode( get_the_guid() );
65
 
66
  $EpisodeData = powerpress_get_enclosure_data($post_id);
67
- if( !empty($EpisodeData) ) {
68
  add_thickbox();
69
  echo "<strong styleX='font-size: 115%; display: block; text-align: center;'><a class='thickbox button button-primary button-large' href='admin.php?action=powerpress-jquery-pts&width=600&height=550&post_id={$post_id}&guid={$guid}&TB_iframe=true' target='blank' title='Post to Social'>Post to Social</a></strong>";
70
  $can_post = true;
@@ -83,11 +83,14 @@ class PowerPressPostToSocial {
83
  else if( $can_post == false ) {
84
 
85
  _e( 'No podcast episode available in this post to send to social sites.', 'powerpress' );
86
- } else {
87
  _e( 'Nothing posted yet.', 'powerpress' );
88
  echo ' ';
89
  echo "<a class='thickbox' href='admin.php?action=powerpress-jquery-pts&width=600&height=550&post_id={$post_id}&guid={$guid}&TB_iframe=true' target='blank'>Post Now!</a>";
90
  }
 
 
 
91
  }
92
  else {
93
  echo "This post must be published before you can post to social sharing sites.";
@@ -102,12 +105,11 @@ class PowerPressPostToSocial {
102
  $Settings = get_option( 'powerpress_general' );
103
 
104
  $post_id = get_the_ID();
105
- $program_keyword = $Settings['blubrry_program_keyword'];
106
  $guid = get_the_guid();
107
 
108
  $enclosure_data = powerpress_get_enclosure_data( $post_id );
109
  if ( !empty( $enclosure_data ) ) {
110
- $results = callUpdateListing($post_id, $program_keyword, $guid);
111
  $podcast_id = $results['podcast-id'];
112
 
113
  add_post_meta( $post_id, 'podcast-id', $podcast_id, true );
@@ -121,9 +123,16 @@ class PowerPressPostToSocial {
121
  * @param string $guid
122
  * @return array|mixed|object|string
123
  */
124
- function callUpdateListing( $post_id, $program_keyword, $guid ) {
125
- $Settings = get_option( 'powerpress_general' );
126
  $episodeData = powerpress_get_enclosure_data( $post_id );
 
 
 
 
 
 
 
127
  if( empty($episodeData['duration']) )
128
  $episodeData['duration'] = '';
129
 
@@ -161,7 +170,7 @@ function callUpdateListing( $post_id, $program_keyword, $guid ) {
161
 
162
  foreach ( $api_url_array as $api_url ) {
163
  $response = powerpress_remote_fopen( "{$api_url}social/{$program_keyword}/update-listing.json", $Settings['blubrry_auth'], json_encode( $post_params ) );
164
-
165
  if ( $response ) {
166
  break;
167
  }
@@ -187,10 +196,8 @@ function callGetSocialOptions( $program_keyword, $podcast_id ) {
187
  $Settings = get_option( 'powerpress_general' );
188
 
189
  $api_url_array = powerpress_get_api_array();
190
-
191
  foreach ( $api_url_array as $api_url ) {
192
- $response = powerpress_remote_fopen("{$api_url}social/{$program_keyword}/get-social-options.json", $Settings['blubrry_auth'] );
193
-
194
  if ( $response ) {
195
  break;
196
  }
@@ -355,7 +362,7 @@ function powerpress_ajax_pts($Settings)
355
  }
356
 
357
  // Make API calls here //
358
- $program_keyword = $Settings['blubrry_program_keyword'];
359
  $post_id = (int) $_GET['post_id'];
360
  $guid = urldecode( $_GET['guid'] );
361
 
@@ -364,9 +371,8 @@ function powerpress_ajax_pts($Settings)
364
  $response = array( 'podcast-id' => get_post_meta( $post_id, 'podcast-id', true ) );
365
  }
366
  else {
367
- $response = callUpdateListing( $post_id, $program_keyword, $guid );
368
  }
369
-
370
  if ( !is_array( $response ) ) { // an error occurred\
371
  echo "<br /><br />";
372
  echo $response;
@@ -392,12 +398,18 @@ function powerpress_ajax_pts($Settings)
392
  }
393
 
394
  $podcast_id = $response['podcast-id'];
395
- add_post_meta( $post_id, 'podcast-id', $podcast_id, true );
396
-
 
 
 
 
 
 
397
  // get the info necessary to create the post to social form using the `get-social-options` api call
398
  $response = callGetSocialOptions( $program_keyword, $podcast_id );
399
 
400
- if ( !is_array( $response ) ) { // a cURL error occurred
401
  echo $response;
402
  exit;
403
  }
@@ -444,7 +456,10 @@ function powerpress_ajax_pts($Settings)
444
  <input type="hidden" name="podcast-id" value="<?php echo $podcast_id; ?>">
445
  <input type="hidden" name="post-id" value="<?php echo $post_id; ?>">
446
  <?php
447
-
 
 
 
448
  if (!empty($response['accounts']['Twitter'])){
449
  echo '<h2>' ."<img src='{$response['settings']['twitter_image']}'>" ." Twitter" .'</h2>'; ?>
450
 
@@ -516,7 +531,7 @@ function powerpress_ajax_pts($Settings)
516
  id="post_button" />
517
  <a href="#" class="btn btn-sm btn-default"
518
  onclick="self.parent.tb_remove();"><?php echo __( 'Cancel', 'powerpress' ); ?></a>
519
- </form>
520
  <?php
521
  powerpress_admin_jquery_footer();
522
  }
@@ -529,9 +544,15 @@ function powerpress_ajax_pts_post($Settings)
529
 
530
  $api_url_array = powerpress_get_api_array();
531
 
532
- $program_keyword = $Settings['blubrry_program_keyword'];
533
  $podcast_id = $_POST['podcast-id'];
534
  $post_id = $_POST['post-id'];
 
 
 
 
 
 
 
535
 
536
  unset( $_POST['podcast-id'] );
537
  unset( $_POST['post-id'] );
@@ -539,29 +560,29 @@ function powerpress_ajax_pts_post($Settings)
539
  $post_data = array();
540
 
541
  /*foreach ( $_POST as $key => $value ) {
542
- if ( $value ) { // we don't allow empty messages to be posted to social media
543
 
544
- preg_match("/-(\d+)-?/", $key, $matches);
545
- $social_id = $matches[1];
546
 
547
- preg_match("/^(\w+)-/i", $key, $matches);
548
- $social_type = strtolower($matches[1]);
549
 
550
- if ( !isset( $post_data[ $social_id ] ) ) {
551
- $post_data[ $social_id ] = array(
552
- 'social-id' => $social_id,
553
- 'social-type' => $social_type,
554
- );
555
- }
556
 
557
- if ( !isset( $post_data[ $social_id ]['social-data'] ) ) {
558
- $post_data[ $social_id ]['social-data'] = array();
559
- }
560
 
561
- $field_name = preg_replace( "/^\w+-/i", "", $key );
562
 
563
- $post_data[ $social_id ]['social-data'][ $field_name ] = $value;
564
- }
565
 
566
  }*/
567
 
@@ -587,14 +608,13 @@ function powerpress_ajax_pts_post($Settings)
587
  $post_data['youtube']['accounts'] = $_POST['youtube_meta'];
588
  $post_data['youtube']['description'] = $_POST['youtube_description'];
589
  $post_data['youtube']['title'] = $_POST['youtube_title'];
590
- }
591
 
592
 
593
  $post_params = array( 'podcast-id' => $podcast_id, 'post-data' => $post_data, '' );
594
 
595
  foreach ( $api_url_array as $api_url ) {
596
  $response = powerpress_remote_fopen( "{$api_url}social/{$program_keyword}/post.json", $Settings['blubrry_auth'], json_encode( $post_params ) );
597
-
598
  if ( $response ) {
599
  break;
600
  }
@@ -603,7 +623,7 @@ function powerpress_ajax_pts_post($Settings)
603
  $response = json_decode( $response, true );
604
 
605
  if ( $response['status'] == 'success' ) {
606
- powerpress_page_message_add_notice( __( 'Post to social has been scheduled.', 'powerpress' ) );
607
  powerpress_page_message_print();
608
 
609
  add_post_meta( $post_id, 'pts_scheduled', 1, true );
64
  $guid = urlencode( get_the_guid() );
65
 
66
  $EpisodeData = powerpress_get_enclosure_data($post_id);
67
+ if( !empty($EpisodeData) && parse_url($EpisodeData['url'], PHP_URL_HOST) == 'media.blubrry.com' ) {
68
  add_thickbox();
69
  echo "<strong styleX='font-size: 115%; display: block; text-align: center;'><a class='thickbox button button-primary button-large' href='admin.php?action=powerpress-jquery-pts&width=600&height=550&post_id={$post_id}&guid={$guid}&TB_iframe=true' target='blank' title='Post to Social'>Post to Social</a></strong>";
70
  $can_post = true;
83
  else if( $can_post == false ) {
84
 
85
  _e( 'No podcast episode available in this post to send to social sites.', 'powerpress' );
86
+ } else if (parse_url($EpisodeData['url'], PHP_URL_HOST) == 'media.blubrry.com') {
87
  _e( 'Nothing posted yet.', 'powerpress' );
88
  echo ' ';
89
  echo "<a class='thickbox' href='admin.php?action=powerpress-jquery-pts&width=600&height=550&post_id={$post_id}&guid={$guid}&TB_iframe=true' target='blank'>Post Now!</a>";
90
  }
91
+ else {
92
+ _e('The media file must be hosted on Blubrry to post to social sites.', 'powerpress');
93
+ }
94
  }
95
  else {
96
  echo "This post must be published before you can post to social sharing sites.";
105
  $Settings = get_option( 'powerpress_general' );
106
 
107
  $post_id = get_the_ID();
 
108
  $guid = get_the_guid();
109
 
110
  $enclosure_data = powerpress_get_enclosure_data( $post_id );
111
  if ( !empty( $enclosure_data ) ) {
112
+ $results = callUpdateListing($post_id, $guid);
113
  $podcast_id = $results['podcast-id'];
114
 
115
  add_post_meta( $post_id, 'podcast-id', $podcast_id, true );
123
  * @param string $guid
124
  * @return array|mixed|object|string
125
  */
126
+ function callUpdateListing( $post_id, $guid ) {
127
+ $Settings = get_option('powerpress_general');
128
  $episodeData = powerpress_get_enclosure_data( $post_id );
129
+ if(!empty($episodeData['program_keyword'])) {
130
+ //for multi account support, if empty then fallback to
131
+ $program_keyword = $episodeData['program_keyword'];
132
+ }
133
+ else {
134
+ $program_keyword = $Settings['blubrry_program_keyword'];
135
+ }
136
  if( empty($episodeData['duration']) )
137
  $episodeData['duration'] = '';
138
 
170
 
171
  foreach ( $api_url_array as $api_url ) {
172
  $response = powerpress_remote_fopen( "{$api_url}social/{$program_keyword}/update-listing.json", $Settings['blubrry_auth'], json_encode( $post_params ) );
173
+
174
  if ( $response ) {
175
  break;
176
  }
196
  $Settings = get_option( 'powerpress_general' );
197
 
198
  $api_url_array = powerpress_get_api_array();
 
199
  foreach ( $api_url_array as $api_url ) {
200
+ $response = powerpress_remote_fopen("{$api_url}social/{$program_keyword}/get-social-options.json?podcast_id={$podcast_id}", $Settings['blubrry_auth'] );
 
201
  if ( $response ) {
202
  break;
203
  }
362
  }
363
 
364
  // Make API calls here //
365
+
366
  $post_id = (int) $_GET['post_id'];
367
  $guid = urldecode( $_GET['guid'] );
368
 
371
  $response = array( 'podcast-id' => get_post_meta( $post_id, 'podcast-id', true ) );
372
  }
373
  else {
374
+ $response = callUpdateListing( $post_id, $guid );
375
  }
 
376
  if ( !is_array( $response ) ) { // an error occurred\
377
  echo "<br /><br />";
378
  echo $response;
398
  }
399
 
400
  $podcast_id = $response['podcast-id'];
401
+ $EpisodeData = powerpress_get_enclosure_data($post_id);
402
+ if(!empty($EpisodeData['program_keyword'])) {
403
+ $program_keyword = $EpisodeData['program_keyword'];
404
+ }
405
+ else {
406
+ $program_keyword = $Settings['blubrry_program_keyword'];
407
+ }
408
+ add_post_meta( $post_id, 'podcast-id', $podcast_id, true );
409
  // get the info necessary to create the post to social form using the `get-social-options` api call
410
  $response = callGetSocialOptions( $program_keyword, $podcast_id );
411
 
412
+ if ( !is_array( $response ) ) { // a cURL error occurred
413
  echo $response;
414
  exit;
415
  }
456
  <input type="hidden" name="podcast-id" value="<?php echo $podcast_id; ?>">
457
  <input type="hidden" name="post-id" value="<?php echo $post_id; ?>">
458
  <?php
459
+ if (empty($response['accounts'])) {
460
+ echo '<h2>No social accounts linked</h2>';
461
+ echo '<p>Visit the <a href="https://publish.blubrry.com/social/" target="_blank">Podcaster Dashboard</a> to link your social accounts</p>';
462
+ }
463
  if (!empty($response['accounts']['Twitter'])){
464
  echo '<h2>' ."<img src='{$response['settings']['twitter_image']}'>" ." Twitter" .'</h2>'; ?>
465
 
531
  id="post_button" />
532
  <a href="#" class="btn btn-sm btn-default"
533
  onclick="self.parent.tb_remove();"><?php echo __( 'Cancel', 'powerpress' ); ?></a>
534
+ </form>
535
  <?php
536
  powerpress_admin_jquery_footer();
537
  }
544
 
545
  $api_url_array = powerpress_get_api_array();
546
 
 
547
  $podcast_id = $_POST['podcast-id'];
548
  $post_id = $_POST['post-id'];
549
+ $EpisodeData = powerpress_get_enclosure_data($post_id);
550
+ if(!empty($EpisodeData['program_keyword'])) {
551
+ $program_keyword = $EpisodeData['program_keyword'];
552
+ }
553
+ else {
554
+ $program_keyword = $Settings['blubrry_program_keyword'];
555
+ }
556
 
557
  unset( $_POST['podcast-id'] );
558
  unset( $_POST['post-id'] );
560
  $post_data = array();
561
 
562
  /*foreach ( $_POST as $key => $value ) {
563
+ if ( $value ) { // we don't allow empty messages to be posted to social media
564
 
565
+ preg_match("/-(\d+)-?/", $key, $matches);
566
+ $social_id = $matches[1];
567
 
568
+ preg_match("/^(\w+)-/i", $key, $matches);
569
+ $social_type = strtolower($matches[1]);
570
 
571
+ if ( !isset( $post_data[ $social_id ] ) ) {
572
+ $post_data[ $social_id ] = array(
573
+ 'social-id' => $social_id,
574
+ 'social-type' => $social_type,
575
+ );
576
+ }
577
 
578
+ if ( !isset( $post_data[ $social_id ]['social-data'] ) ) {
579
+ $post_data[ $social_id ]['social-data'] = array();
580
+ }
581
 
582
+ $field_name = preg_replace( "/^\w+-/i", "", $key );
583
 
584
+ $post_data[ $social_id ]['social-data'][ $field_name ] = $value;
585
+ }
586
 
587
  }*/
588
 
608
  $post_data['youtube']['accounts'] = $_POST['youtube_meta'];
609
  $post_data['youtube']['description'] = $_POST['youtube_description'];
610
  $post_data['youtube']['title'] = $_POST['youtube_title'];
611
+ }
612
 
613
 
614
  $post_params = array( 'podcast-id' => $podcast_id, 'post-data' => $post_data, '' );
615
 
616
  foreach ( $api_url_array as $api_url ) {
617
  $response = powerpress_remote_fopen( "{$api_url}social/{$program_keyword}/post.json", $Settings['blubrry_auth'], json_encode( $post_params ) );
 
618
  if ( $response ) {
619
  break;
620
  }
623
  $response = json_decode( $response, true );
624
 
625
  if ( $response['status'] == 'success' ) {
626
+ powerpress_page_message_add_notice( __( 'Posting to social been scheduled! Please allow up to an hour to post.', 'powerpress' ) );
627
  powerpress_page_message_print();
628
 
629
  add_post_meta( $post_id, 'pts_scheduled', 1, true );
readme.txt CHANGED
@@ -1,496 +1,500 @@
1
- === PowerPress Podcasting plugin by Blubrry ===
2
- Contributors: amandato, blubrry
3
- Tags: podcasting, podcast, podcaster, powerpress, itunes, apple, apple podcasts, google podcasts, google play, enclosure, professional, apple, apple tv, ipad, iphone, soundcloud, squarespace, youtube, viddler, ustream, podcasting, audio, video, rss2, feed, player, media, rss, mp3, music, embed, feedburner, statistics, stats, flv, flash, id3, episodes, blubrry, mp4, m4v, wordpressmu, mu, wordpress mu, multisite, multi site, mediacaster, post, plugin, posts, simple, social, dashboard, TSG, Buzzsprout, MTR, WP-boxCast, CastMyBlog, tgs podcasting, simple podcasting, seriously simple podcasting, seriously-simple-podcasting, serious, seriously, ssp, podlove, podcast.de, clammr, clammr radio, audio player, stitcher, tunein, show, shows, series, docs, documentation, support, free, add-ons, extensions, addons, libsyn, libsyn-podcasting, podbean, podomatic, spreaker
4
- Requires at least: 3.6
5
- Requires PHP: 5.2
6
- Tested up to: 5.2.2
7
- Stable tag: 7.5.1
8
- Donate link: https://create.blubrry.com/resources/podcast-media-hosting/
9
- License: GPLv2 or later
10
-
11
- No. 1 Podcasting plugin for WordPress, with simple & advanced modes, players, subscribe tools, and more! Supports Apple Podcasts, Google, Spotify,..
12
-
13
- == Description ==
14
-
15
- No. 1 Podcasting plugin for WordPress, with simple & advanced modes, players, subscribe tools, and more!
16
-
17
- [youtube https://www.youtube.com/watch?v=twqKrVehY3o]
18
-
19
- Developed by podcasters for podcasters; features include Simple and Advanced modes, multiple audio/video player options, subscribe to podcast page embeds and sidebar widgets, podcasting SEO features, and more! Fully supports Apple Podcasts, Google Podcasts, Stitcher, TuneIn and Blubrry Podcasting directories, as well as all podcast applications and clients. PowerPress users who use Blubrry Podcast Hosting may also [submit their shows to Spotify](https://create.blubrry.com/manual/podcast-promotion/submit-podcast-to-spotify/).
20
-
21
- = Simple Mode =
22
- If you are just getting started or feel overwelmed with all the settings and options, switch to Simple mode! PowerPress's Simple Mode will walk you through getting started in 3 easy steps.
23
-
24
- 1. Setup your Podcast quickly with only the essential settings
25
- 1. Create your first Episode
26
- 1. Submit your podcast to Apple Podcasts (previously iTunes Podcasts)
27
-
28
- When you're ready you can switch to Advanced mode to tap into all the options professionals would want.
29
-
30
- = PowerPress Key Features =
31
- - Full Apple Podcasts (previously iTunes Podcasts) & Google Podcasts support: Adds Apple Podcast compliant podcast feeds to your WordPress site.
32
- - Integrated HTML5 Media Players: Audio/video Web players with embed support from sites such as YouTube.
33
- - NEW: [Skip to Position in Player](https://create.blubrry.com/resources/powerpress/advanced-tools-and-options/skip-to-position-in-player/) shortcode
34
- - Subscribe tools: Create subscribe page with our exclusive subscribe shortcode embed and subscribe sidebar widget optimized for responsive websites, high-resolution screens and Apple Retina displays.
35
- - Podcasting SEO: Improve discovery of your podcast on search engines such as Google, and with the Apple Podcasts directory.
36
- - Podcast Importing: Import your podcast from SoundCloud, LibSyn, PodBean, Squarespace, or other podcast RSS feed.
37
- - Migration tools: Quickly migrate from PodPress, TGS Podcasting, Seriously Simple Podcasting, Blogger, or Movable Type without losing episodes.
38
- - Multi-podcast support: Create separate podcasts by category (Category Podcasting) or by media format (Podcast Channels).
39
- - Post type and taxonomy podcasting: Create podcasts from custom post types and taxonomies.
40
- - *Media Statistics: Get FREE Blubrry Media Statistics from your WordPress dashboard.
41
- - Multi-languages, locales and emoji support: See [PowerPress in your language](http://create.blubrry.com/resources/powerpress/powerpress-language/) and [Enable Emoji in podcast feeds](https://create.blubrry.com/resources/powerpress/powerpress-settings/feeds/#emoji) for details.
42
-
43
- = Includes Full Apple Podcasts Support! =
44
- Blubrry PowerPress fully supports Apple Podcasts (previously iTunes podcasts), which is required for podcasting. PowerPress comes with the following Apple Podcasts specific features:
45
-
46
- * Apple Podcasts compliant podcast feeds: The appropriate tags are added to your feeds so your Apple Podcasts listing looks great.
47
- * Optimized Apple Podcasts summary: Converts your blog-post content to a format suited for viewing in Apple Podcasts ([learn more](http://create.blubrry.com/resources/powerpress/powerpress-settings/itunes/)).
48
- * Tunes artwork: Upload and manage your Apple Podcasts artwork directly from within PowerPress settings.
49
- * Apple Podcasts: Fully supported, including the latest [Apple Podcasts specifications](http://www.powerpresspodcast.com/2012/05/10/itunes-podcasting-specifications-changed-may-2012-what-that-means-for-podcasting/).
50
- * Feed Episode Maximizer: Increase the number of episodes viewed on Apple Podcasts while decreasing the byte size of your feeds.
51
-
52
- = Includes Full Google Podcasts Support! =
53
- Blubrry PowerPress fully supports the newly launched Google Podcasts directory built into Google search, Google Home smart speakers and Google Podcasts Android app.
54
-
55
- = Integrated Media Players =
56
- Blubrry PowerPress includes extensive Web player options to display your podcast audio and video in your Web pages.
57
-
58
- * Audio players: Pick from Blubrry's Media Player, MediaElement.js, or the native HTML5 audio player.
59
- * Video players: Pick from MediaElement.js, VideoJS, or the native HTML5 video player.
60
- * Positioning: Position player above or below your content.
61
- * [Player shortcode](http://create.blubrry.com/resources/powerpress/advanced-tools-and-options/shortcode/): Place the player exactly where you want by adding the `[powerpress]` shortcode directly into your post content.
62
- * [Playlist player shortcode](http://create.blubrry.com/resources/powerpress/advanced-tools-and-options/powerpress-playlist-shortcode/): Include a playlist of your latest podcast episodes utilizing the `[powerpress_playlist]` shortcode in any page or post.
63
- * Embeds: Add embeds from sites such as YouTube.
64
- * Links: Provide download, play in new window and embed links.
65
- * Audio formats supported: mp3, m4a, oga (ogg audio), opus.
66
- * Video formats supported: m4v, mp4, webm, ogv (ogg video).
67
-
68
- = Integrated Subscribe Tools =
69
- A Blubrry PowerPress exclusive, podcast subscribe tools help you convert Web visitors into podcast subscribers. Subscribe options include:
70
-
71
- * [Subscribe page](http://create.blubrry.com/resources/powerpress/advanced-tools-and-options/subscribe-page/): Instantly create a subscribe page with simplified instructions on how to subscribe to your podcast using the PowerPress subscribe page shortcode.
72
- * [Subscribe page shortcode](http://create.blubrry.com/resources/powerpress/advanced-tools-and-options/powerpress-subscribe-shortcode/): Add the `[powerpress_subscribe]` shortcode to include a mobile-device optimized subscribe embed in any post or page that includes buttons to subscribe on Apple Podcasts, [Subscribe on Android](http://www.subscribeonandroid.com), [Subscribe by Email](http://www.subscribebyemail.com), Stitcher, tuneIn, Spotify, Google Podcasts, via RSS, and an special textbox to easily copy and paste your podcast feed into any podcast application.
73
- * Subscribe sidebar widget: Mobile device optimized sidebar buttons to subscribe on Apple Podcasts, [Subscribe on Android](http://www.subscribeonandroid.com), Stitcher, tuneIn, Spotify, Google Podcasts, subscribe by RSS, and a "more subscribe options" button linked to your podcast's subscribe page.
74
- * Subscribe links: Subscribe on Apple Podcasts, [Subscribe on Android](http://www.subscribeonandroid.com), [Subscribe by Email](https://www.subscribebyemail.com), subscribe by RSS and a link to your custom subscribe page below every player.
75
- * Retina enabled: Subscribe button images optimized for high resolution displays including Apple Retina displays.
76
- * Responsive: Subscribe tools are designed for any screen and optimized for touch screens by providing custom buttons that are indrustry standard 48 pixels in height optimized for touch screen use.
77
-
78
- = Integrates with Blubrry's Services =
79
- Make your life easier by adding our FREE or paid media hosting and statistics services to streamline your podcast productivity.
80
-
81
- * Quickly access your Blubrry media download statistics from your WordPress dashboard.
82
- * Publish Blubrry hosted media directly from your blog.
83
- * View Blubrry hosting usage quota from your blog.
84
- * Configure how Blubrry writes media (ID3) tags within PowerPress settings.
85
- * Post your podcast to Twitter, Facebook, and YouTube.
86
- * Migrate all of your media at no additional cost to your Blubrry [Podcast Media Hosting](http://create.blubrry.com/resources/podcast-media-hosting/) account with just a couple clicks.
87
-
88
- The Blubrry basic statistics service is FREE. Our [Premium Statistics Service](https://secure.blubrry.com/podcast-statistics-premium/), which includes [Blubrry Certified Statistics](http://create.blubrry.com/resources/podcast-media-download-statistics/rawvoice-certified/), U.S. downloads, trending and exporting, is available for $5 month. Blubrry [Media Hosting](https://secure.blubrry.com/podcast-publishing-premium-with-hosting/) packages start at $12.
89
-
90
-
91
- = Advanced Features for those who need more =
92
- Want more? We've got more! With a simple click you can enable advanced features and options. Check out some of the advanced features:
93
-
94
- * [Podcasting SEO settings](http://create.blubrry.com/resources/powerpress/advanced-tools-and-options/podcasting-seo-settings/): Utilize the Apple and Google feed and HTML tags to improve the discovery of your podcasts and include the necessary meta data in your blog pages for search engines to discover.
95
- * Embeds: Provide embeds your audience can take with them (just like YouTube embeds)
96
- * Media size and duration detection: Enter your media URL and let the PowerPress do the rest.
97
- * Category Casting: Add podcast support to your WordPress category feeds.
98
- * Custom Podcast Channels: Distribute multiple formats (audio/video) and versions (short/full length).
99
- * Taxonomy Podcasting: Create podcasts for your custom taxonomy tag names including WordPress Tags. (feature sponsored by [AfterBuzzTV.com](http://afterbuzztv.com/))
100
- * Post Type Podcasting: Create podcasts for your custom post types.
101
- * Premium Podcasting (Requires a membership plugin and/or roles and capabilities plugin to manage)
102
- * User Role Management: Control which users in your blog can podcast. (Requires a roles and capabilities plugin to manage)
103
- * Diagnostics: Check to see if your server is configured to support all of the available features in PowerPress.
104
- * WordPress MultiSite: Blubrry PowerPress is compatible with WordPress MultiSite and can be extended using the [Blubrry PowerPress MultiSite add-on plugin](https://wordpress.org/plugins/powerpress-multisite/).
105
- * *Supported syndication formats: mp3, m4a, mp4, m4v, webm, ogg, oga, ogv, wma, ra, mp4a, m4v, mp4v, mpg, asf, avi, wmv, flv, swf, mov, divx, 3gp, midi, wav, aa, pdf, torrent, m4b, m4r, epub.
106
-
107
- *Apple Podcasts only supports mp3, m4a, mp4, m4v, pdf and epub.
108
-
109
- = Migrating from PodPress or other podcasting plugin? =
110
- Switching to from PodPress to PowerPress is seamless. Simply enable PowerPress then disable PodPress and you're done! PowerPress will continue where plugin your old plugin left off by including your previously created episodes in your feeds and Web pages.
111
-
112
- Please see detailed instructions for migrating from [PodPress](http://create.blubrry.com/resources/powerpress/advanced-tools-and-options/migrating-from-podpress-to-powerpress/), [TGS Podcasting Plugin](http://create.blubrry.com/resources/powerpress/advanced-tools-and-options/migrating-from-tgs-podcasting-plugin/) and [Seriously Simple Podcasting](http://create.blubrry.com/resources/powerpress/advanced-tools-and-options/migrating-from-seriously-simple-podcasting-plugin/).
113
-
114
- Note: Advanced settings such as settings for podcast categories will need to be recreated in PowerPress.
115
-
116
- = Migrating from another service such as LibSyn, PodBeam, SoundCloud, or Squarespace? =
117
- Importing your podcast feed into PowerPress is super easy! Simply paste in your RSS feed URL into the PowerPress feed import tool and click import. RSS feed import works with any podcast service and includes additional options for importing from LibSyn, PodBeam, SoundCloud, and Squarespace. You can optionally migrate your media to your Blubrry Podcast Hosting account with only a couple simple clicks.
118
-
119
- = PowerPress in your Language =
120
-
121
- [PowerPress is available in a number of languages](http://create.blubrry.com/resources/powerpress/powerpress-language/). Starting with PowerPress 7.0, translations will be managed through [translate.wordpress.org](https://translate.wordpress.org/projects/wp-plugins/powerpress/) making translations easier to setup and update.
122
-
123
- = PowerPress is looking for translators! =
124
-
125
- [Anyone can help translate PowerPress!](http://create.blubrry.com/resources/powerpress/powerpress-language/translate-powerpress/) If you are intersted in translating PowerPress, please [contact us](https://www.blubrry.com/contact/#translate).
126
-
127
- **Translators will receive the following from us as a thank you for contributing:**
128
-
129
- * Free [Blubrry Professional podcast statistics](http://create.blubrry.com/resources/podcast-media-download-statistics/) account for your podcast.
130
- * Name or nickname in the PowerPress readme.txt and in the [PowerPress WordPress.org Translators list](https://wordpress.org/plugins/powerpress/other_notes/) (will give you credit for your contribution)
131
- * Website URL (optional, we will link to your website)
132
-
133
- Interested translators please [contact us](https://www.blubrry.com/contact/#translate), include your WordPress.org account name, blubrry account login (if you have one), your name, desired URL, and the language locale(s) you would like to translate.
134
-
135
- = Need Help? =
136
- . . . or have some ideas that could improve the plugin?
137
-
138
- * Visit the Blubrry [PowerPress Forum](https://wordpress.org/support/plugin/powerpress) and [Blubrry Resources](http://create.blubrry.com/resources/)
139
- * Use the Blubrry [Contact Us](http://www.blubrry.com/contact.php) form
140
- * Blubrry [PowerPress Documentation](http://create.blubrry.com/resources/powerpress/)
141
- * Check out [The Podcasting Manual](http://create.blubrry.com/manual/) - everything you need to know about podcasting
142
-
143
- = Need More Help? =
144
- We now offer one-on-one consulting via GoToMeeting, Skype or phone.
145
- [Learn more about Blubrry Consulting Services](http://create.blubrry.com/support/podcast-consulting-services/)
146
-
147
- *PowerPress is developed and maintained by [Blubrry](http://www.blubrry.com), a podcasting company and community owned and operated by podcasters providing tools and resources for podcasters to measure, monetize, publish and host podcasts. Although we'd like you to become a member of [Blubrry](http://www.blubrry.com/createaccount.php), **no membership is required** to use this free open source podcasting plugin.*
148
-
149
-
150
- == Frequently Asked Questions ==
151
-
152
- = Compatible Themes and Plugins =
153
- Most themes and plugins are compatible with PowerPress. PowerPress is developed and tested using the default themes packaged with WordPress including twentyten, twentytwelve, twentythirteen, twentyfourteen, twentyfifteen, and all future versions. These themes use WordPress best practices and adhere to theme rules set by WordPress.org. Any child theme based on these themes should also work without issue.
154
-
155
- If you are having a problem, try [Diagnosing Feed and/or Player Issues](http://create.blubrry.com/resources/powerpress/using-powerpress/diagnosing-feed-andor-player-issues-with-powerpress/).
156
-
157
- If you are having a problem specifically with the player and links, try the "Having issues?" option under PowerPress Settings > Appearance tab. Visit [Resolving Plugin or Theme Conflicts](http://create.blubrry.com/resources/powerpress/powerpress-settings/media-appearance/plugin-theme-conflict-issues/) for details.
158
-
159
- = Premium podcasting themes compatible with PowerPress =
160
- [Appendipity Podcast Pro theme](https://www.appendipity.com/themes/podcast-pro-theme/?aid=13) is is designed specifically to take advantage of built-in features, settings and podcast episode meta data in PowerPress. The Blubrry team works with the Appendipity team during beta testing and major WordPress releases to make sure the Podcast Pro theme and PowerPress work together seamlessly.
161
-
162
-
163
- = Related Plugins =
164
- The following plugins may be used in conjunction with PowerPress.
165
-
166
- * [Message Flow](http://wordpress.org/extend/plugins/message-flow/) - generates a CoverFlow-like interface for your blog posts with podcast episodes. For podcasts, use shortocde `[message-flow podcasts_only="true"]`.
167
- * [Eli's PowerPress Addon Widget](http://wordpress.org/extend/plugins/podpress-addons/) - Adds a sidebar widget that lists your podcast episodes linked to the play in a new window PowerPress player.
168
- * [PowerPress Posts From MySQL](http://wordpress.org/extend/plugins/powerpress-posts-from-mysql/developers/) - Creates blog posts with PowerPress podcast episode information from a MySQL table.
169
- * [Featured Podcast Widget](http://wordpress.org/plugins/featured-podcast-widget/), [Home Page](http://www.richardfarrar.com/featured-podcast-widget-for-wordpress/) - A widget that enables you to display your latest podcast from a category or featured podcast utilising the PowerPress plugin's default player.
170
- * [Skip to Timestamp](https://wordpress.org/plugins/skip-to-timestamp/) - Skip to Timestamp allows for generating links in your posts that automatically skip to a given time in an audio, video or youtube embed.
171
-
172
-
173
- = Why doesn't Blubrry PowerPress support multiple enclosures in one feed item/post? =
174
- Blubrry PowerPress does not allow you to include multiple media files for one feed item (blog post). This is because each podcatcher handles multiple enclosures in feeds differently. Apple Podcasts will download the first enclosure that it sees in the feed ignoring the rest. Other podcatchers and podcasting directories either pick up the first enclosure or the last in each post item. This inconsistency combined with the fact that [Dave Winer does not recommend multiple enclosures](http://www.reallysimplesyndication.com/2004/12/21) and the [FeedValidator.org recommendation against it](http://www.feedvalidator.org/docs/warning/DuplicateEnclosure.html) is why the Blubrry PowerPress does not support them.
175
-
176
- As a alternative, PowerPress allows you to create additional Custom Podcast Feeds to associate any magnitude of media format and/or length in a blog post to specific custom feeds. For example, you can create one blog post associated to separate video and audio podcast feeds saving you time from entering your show notes twice.
177
-
178
- = Why doesn't Blubrry PowerPress include media statistics built-in? =
179
- 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 efficient WordPress podcasting plugin. We recommend using your media hosting's web statistics to give you basic download numbers and, if you are seeking more grandular measurements such as client and geographical information for each episode, you're more than welcome to use the [Blubrry Statistics service](http://create.blubrry.com/resources/podcast-media-download-statistics/) as well.
180
-
181
- You may however access your Blubrry Statistics from within your WordPress dashboard.
182
-
183
- = How do you insert the player within a blog post? =
184
- You can insert the media player within your blog posts by using the WordPress shortcode feature. The shortcode for PowerPress is `[powerpress]` (all lowercase)
185
-
186
- 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"]
187
-
188
- 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"]
189
-
190
- 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*
191
-
192
- = Why can't you upload large media files? =
193
- File uploads are tricky to handle because there are so many web hosting variations with different upload size limits. We recommend using an FTP application to upload large media files. FTP is much more efficient than web based uploads and is typically provided by nearly all web hosting providers.
194
-
195
- = The Media Player does not appear on my site? =
196
- . . . or the RSS feed is invalid?
197
-
198
- This can happen when there is a theme or plugin conflict. Please visit our [Diagnosing Feed and/or Player Issues](http://create.blubrry.com/resources/powerpress/using-powerpress/diagnosing-feed-andor-player-issues-with-powerpress/) for instructions how to resolve such issues.
199
-
200
-
201
- == Installation ==
202
- = Point and Click Installation =
203
- 1. Sign into your blog, go to the plugins section and click 'Add New'.
204
- 2. In the search box enter "PowerPress", then click 'Search'.
205
- 3. Click the 'Install Now' link and proceed to install the plugin.
206
- 4. Once installed, click 'Activate'.
207
- 5. Configure your Blubrry PowerPress by going to the **Settings** > **Blubrry PowerPress** page.
208
-
209
- = Manual Installation =
210
- To install Blubrry PowerPress manually, follow these steps:
211
-
212
- 1. Download [PowerPress from WordPress.org](http://wordpress.org/plugins/powerpress/).
213
- 2. Extract the downloaded zip file to a temporary folder.
214
- 3. Copy the entire powerpress folder from the downloaded zip file into the /wp-content/plugins/ folder on your server.
215
- 4. Activate the "Blubrry PowerPress" plugin in your blog's Plugin Management page.
216
- 5. Configure your Blubrry PowerPress by going to the **Settings** > **Blubrry PowerPress** page.
217
-
218
-
219
- == Screenshots ==
220
- 1. PowerPress's Simple Mode will walk you through setting up your podcast in 3 easy steps.
221
- 2. Just like blogging, podcasting utilizes blog posting features with the addition of a podcast episode box. Yes, podcasting is that simple!
222
- 3. PowerPress integrates seamlessly with Blubrry Podcast Hosting's exclusive player.
223
- 4. PowerPress comes with a built-in subscribe sidebar widget to help your audience subscribe to your podcast.
224
- 5. PowerPress comes with an editable subscribe page builder with a subscribe embed tool to help your web visitors subscribe.
225
- 6. PowerPress's Advanced Mode settings let you dig in as deep as you want to with every possible setting for podcasting at your fingertips.
226
- 7. PowerPress incorporates the built-in WordPress media players into your blog posts and pages.
227
-
228
-
229
- == Changelog ==
230
-
231
- = Next Major Release Announcements =
232
- * We are looking for beta testers! If you would like to beta test future versions of PowerPress, please [contact us](http://www.blubrry.com/contact.php#feedback) with your name and email.
233
-
234
- = Fan of PowerPress and want to show your support? =
235
- If you are a fan of PowerPress, we would greatly appreciate it if you could take a moment and [leave us a review on WordPress.org](https://wordpress.org/support/plugin/powerpress/reviews/?rate=5#new-post). Your support is greatly appreciated!
236
-
237
-
238
- = 7.5.1 =
239
- * Released on 7/23/2019
240
- * Added library for PubSubHubbub. Missed it when merging latest git release into wordpress.org svn. Sorry about that!
241
-
242
-
243
- = 7.5 =
244
- * Released on 7/23/2019
245
- * Added new Apple categories announced in July. The new Apple Categories will be made available on Apple Podcasts mid August, 2019.
246
- * Added Multi-program Blubrry Podcast Hosting, perfect for Category podcasting.
247
- * Added *Update Google PubSubHubbub*, lets Google Podcasts and other podcast directory services when your podcast publishes new episodes.
248
- * Added support for various languages to podcast as including "Thai" and "Vietnamese".
249
-
250
-
251
- = 7.4.4 =
252
- * Releasd on 6/21/2019
253
- * Fixed bug introduced in last update that calculated the total number of episodes when viewing podcasts in channels and post types in PowerPress admin. (Thanks @edzila60610 for bringing to our attention!)
254
- * Removed all mentions of Google+. (Thanks @k_abel for bringing to our attention!)
255
- * Fixed notice message getting cut off for the "Clear Plugins Update Cache" option under "Tools". (Thanks @k_abel for bringing to our attention!)
256
- * Added option `archive`="true" for the `powerpress_subscribe` shortcode to allow for the shortcode to be added to archive/category pages.
257
-
258
-
259
- = 7.4.3 =
260
- * Released on 6/12/2019
261
- * Updated labels for Subscribe buttons and links in admin.
262
- * Note: Apple has announced the end of life for iTunes desktop (except for Windows). PowerPress will be removing iTunes desktop specific features where they conflict with the Apple Podcasts iOS app.
263
- * Enhanced iTunes summary updated, optimized for latest iOS podcasts app. It is now designed for Apple Podcasts iOS app rather than for iTunes desktop. (Thanks Robin for your assistance!)
264
- * Force feed discovery on homepage only to use default podcast feed for Google Search.
265
- * Fixed bug with deleting media files hosted on Blubrry Podcast hosting.
266
- * Fixed bug with posts with revisions being part of the total number of episodes when viewing podcast feeds in PowerPress settings.
267
- * Fixed bug with skipto position time not getting included in feed show notes. (Thanks @tszt for bringing to our attention!)
268
-
269
-
270
- = 7.4.2 =
271
- * Released on 4/26/2019
272
- * Fixed `T_FUNCTION` bug for PHP 5.2 (not an issue if you have PHP 5.3 or newer)
273
-
274
-
275
- = 7.4.1 =
276
- * Released on 4/10/2019
277
- * Added logic to authentication email addresses differently for premium password protected podcasts.
278
- * Added support for YoastSEO and Google Podcasts (Thanks @sunkast for bringing to our attention!)
279
- * Removed use of `create_function` to fix damaged serialized data created by the old PodPress plugin. (Thanks @oilmanmag and Dimitris for bringing to our attention!)
280
- * Fixed `esc_attr()`bug with podpress import.
281
- * Added Tamil (ta) as a podcast feed language option. Thanks KT for requesting! If you do not see your language pelase contact us we will add it!
282
- * Changed feed join query to solve conflict with the Affiliate Disclosure Pro plugin. (Thanks @ndnakashima for bringing to our attention!)
283
- * New functionality for Taxonomy podcasting and the `powerpress_subscribe` shortcode (Thanks @tristanmason for testing!)
284
- * Fixed taxonomy bugs with the playlist player shortcodes (Thanks @tristanmason for the code and helping us test!)
285
- * PowerPress playlist player can now be ordered in ascending order with attribute order="asc" (Thanks @tristanmason for the code and helping us test!)
286
- * Fixed bug with skipto shortcode leaving a blank value in feeds. (Thanks @tszt for bringing to our attention!)
287
- * Skipto timestamp now uses the timestamp exactly as you entered it as the label as long as it has at least one colon to separate minutes from seconds.
288
- * Fixed bug for post type podcasting in the situation where there can be multiple post types for blog posts or pages. (Thanks @shawnogordo for the bug fix!)
289
-
290
-
291
- = 7.4 =
292
- * Released on 10/03/2018
293
- * NEW: [Skip to Position in Player](https://create.blubrry.com/resources/powerpress/advanced-tools-and-options/skip-to-position-in-player/) shortcode, quickly skip to a position in your audio episodes from your show notes. e.g. `[skipto time="2:34"]` [Learn more](https://create.blubrry.com/resources/powerpress/advanced-tools-and-options/skip-to-position-in-player/)
294
- * MEW: Emoji in show notes! You can now enter Emoji characters into the show notes to appear in podcast apps. Enable option in Feed settings tab. Previously WordPress converst Emoji to images which are not displayed in podcast apps. [Learn more](https://create.blubrry.com/resources/powerpress/powerpress-settings/feeds/#emoji)
295
- * Added option to override the Google Podcasts subscribe URL.
296
- * Enhanced VideoObject, a feature in Podcasting SEO.
297
- * Improved base64 encoding Google Podcasts Subscribe URLs. (Thanks Daniel Lewis for the heads up!)
298
- * Removed option `Append show title to episode titles` per request from Apple.
299
-
300
-
301
- = 7.3 =
302
- * Released on 07/10/2018
303
- * Spotify and Google Podcasts subscribe links added to Destinations.
304
- * PowerPress users using [Blubrry Podcast Hosting](https://create.blubrry.com/resources/podcast-media-hosting/) may now submit shows to Spotify!
305
- * Added PodcastMirror setting, a modern alternative to FeedBurner. Learn more about [PodcastMirror](https://podcastmirror.com/) at [podcastmirror.com](https://podcastmirror.com/)
306
- * Converted loop logic from each() to foreach() for PHP 7.3+ / 8.0+ compatibility.
307
- * Improved logic for playlist player to appear better when certain settings are not set.
308
- * Moved the enqueue script ('jquery-ui-tabs') logic so it only loads in the powerpress admin pages. (Thanks @keenanpayne for the code change!)
309
- * Added define option `POWERPRESS_POSTTYPE_MIXING`, when set to true podcast channels for the default podcast feed will mix all post types of type post with the default podcast feed. (Thanks @eos-rose for bringing to our attention)
310
- * Fixed bug with translation and javascript alert messages. (Thanks Enrico for reporting the bug!)
311
-
312
-
313
- = 7.2 =
314
- * Released on 12/13/2017
315
- * Added code to allow customization of Blubrry player style and colors.
316
- * Added code to set no-cache headers in AJAX calls.
317
- * Updated code to fixed bug where new iTunes episode title field may not save with some web hosting platforms using mod security with PHP 5.x. (Thanks @glark, Karren, and others for helping us fix the issue!)
318
- * Changed the menu slug name for editing PowerPress settings.
319
- * Removed safe mode logic for older versions of PHP. (Thanks @BrentO for reporting)
320
- * Added logic to support feeds with bbpress. (Thanks @mubashiriqbal for bringing to our attention!)
321
- * Added missing argument for get_post_type_object() in powerpress-subscribe (Thanks John for bring to our attention)
322
- * Added disable iOS 11 field options under tools to help diagnose issue with some websites that show a 404 page when editing settings since the iOS11 fields were introduced.
323
- * Changed the names of the new iOS11 fields that were getting caught by Mod Security for some users.
324
- * Fixed bug with Taxonomy podcasting statistics redirects not being compatible with versions of WordPress older than 4.5 (Thanks @fmnowling for bringing to our attention!)
325
- * iTunes Maximizer option 11+ older episodes now includes the iTunes summary by default to reflect changes with iOS11. (Thanks Daniel Lewis for the suggestion!)
326
- * Fixed link to powerpress translation page which was returning 404
327
- * Added CastFeedValidator.com links for validating podcast feeds.
328
- * Added Hindi and Punjabi to list of Podcast feed langauges (Thanks @blueblast for requesting the languages to be added)
329
-
330
-
331
- = 7.1.1 =
332
- * Released on 08/24/2017
333
- * NOTE: There is no urgency to update to this version unless you can benefit from bug fixes listed.
334
- * BETA COMING SOON: PowerPress 7.2 Beta will be available within 24-72 hours. Please visit https://create.blubrry.com/resources/powerpress/powerpress-beta/ for more details.
335
- * Added logic to prevent the W3 Total Cache plugin from minifying podcast feeds. (Thanks @allimaple for bringing to our attention)
336
- * Fixed warning messages in the getid3 library so they comply with PHP 7.1+. (Thanks @mahe for letting us know about the problem)
337
- * Fixed error verifying URLs for file formats not supported by iTunes.
338
- * Feed import now compatible with Spreaker podcast feeds.
339
- * Added code when including the subscribe CSS file to make sure it's always included with various WordPress updates (Thanks Tim for the code fix!)
340
- * Added checkbox in Blubrry Player configuration for making iTunes Episode image use optional with player. Unchecked by default.
341
-
342
-
343
- = 7.1 =
344
- * Released on 7/11/2017
345
- * Added support for iOS 11!
346
- * iTunes type added, specify episodic or serial for your podcast program (for iOS 11).
347
- * iTunes episode title, number, season and type added for your episodes (for iOS 11).
348
- * Subscribe on iTunes changed to Subscribe on Apple Podcasts, links have been enhanced to highlight episodes.
349
- * Blubrry Podcast Media Hosting and HTTPS: Media URLs are now automatically converted to HTTPS.
350
- * Added compatibility for the SG CachePress plugin. PowerPress will clear the cache if there was an error. (Thanks @grudesky for getting us in touch with developers!)
351
- * Fixed error with creating the subscribe page in some languages (Thanks @edithmayerhofer for bringing to our attention).
352
- * Better error reporting when importing podcast feed images.
353
- * Verify media option improvements, mp3 duration is now detected even faster in most cases!
354
- * Added logic to prevent notice messages with the subscribe_shortcode and newest versions of PHP. (Thanks @mahe for bringing to our attention)
355
- * Added "Hide player / links: Read more tagged posts" option, hides the player and links on pages with the read more link. (Thanks @calebsg0 for the suggestion!)
356
- * Google play schema URL updated.
357
- * Added "redirect_rule" list of post types not used for podcasting. For compatibility with the "Safe Redirect Manager" plugin.
358
- * Blubrry Player now uses the episode itunes image if set. The URLs to the images must be https:// in order to appear on social networking sites.
359
- * Windows Media Player in browser support has been removed. Microsoft Edge browser does not support Windows Media Player in the browser.
360
- * New logic added for dealing with Internet Explorer / Edge browser preloading media when using the MediaElement.js player.
361
- * Fixed PHP warning message if media size in bytes is zero when displaying file size with player links.
362
- * No longer using self closing XML for iTunes Categories.
363
- * iTunes subscribe itpc:// links are no longer supported.
364
- * Editing default podcast channel now imports global settings by default if blank. (Thanks Robin for bringing to our attention!)
365
- * RSS Podcast feed Import error message added when the PHP XML library is not available. (Thanks @hgetrost for bringing to our attention!)
366
-
367
-
368
- = 7.0.4 =
369
- * Released on 2/18/2017
370
- * NOTE: There is no urgency to update to this version unless you can benefit from the new import options, top level iTunes category options, or bug fixes listed.
371
- * Playlist player bug fix: When ids="" are specified, episodes are now listed in the order entered rather than by date. (Thanks Zach Herbert for bringing to our attention!)
372
- * Updated the `powerpress_subscribe` shortcode to include the latest iTunes button in svg format and added the iTunes small badge. Use attribute itunes_badge="true" to display iTunes badge.
373
- * Changed import feed code to use the current author ID rather than hard coded to 1. (Thanks @tund3r for the bug fix!)
374
- * Import feed for libsyn updated. (Thanks @tund3r for the code fix!)
375
- * Import feed advanced option "Remove query strings from media URLs" added. (Thanks @tund3r!)
376
- * Fixed rare PHP Notice unserialize() on line 3094 error that may happen if the podcast episode serialized data is not present. (Thanks @hmseb for pointing out the notice to us!)
377
- * Added colon ":" to list of characters that can be in a valid media URL. (Thanks AfterBuzzTV.com! for the heads up!)
378
- * Fixed notice message that can appear when using the media objects with the powerpress shortcode. (Thanks @srumery for reporting the problem!)
379
- * Fixed issue with dashboard failing to load in some cases due to news feed being blocked by web server. (Thanks Jacob K. for helping us debug the problem!)
380
- * iTunes categories with subcategories are no longer strictly enforced. If you want to select "Art" without selecting a sub category you now can. Selecting a category with a sub category is still optimal.
381
- * Added ability to import a podcast feed to a post type podcast feed or to a podcast channel.
382
- * Added ability to set the post status when importing a podcast feed. (Thanks @hgetrost for the feature suggestion!)
383
- * Added compatibility with the [Custom Post Widget](https://wordpress.org/plugins/custom-post-widget/) plugin. (Thanks @aparentdesign for letting us know about the problem)
384
- * Fixed bug where ogg audio was not using the correct audio player. (Thanks @joeress for letting us know about the bug)
385
- * Fixed bug with import not matching episode media URLs correctly. (Thanks @hgetrost for bringing to our attention)
386
-
387
-
388
- = 7.0.3 =
389
- * Released 9/13/2016
390
- * Fixed issue when editing channel/category/post type podcast settings double escaping & character. (Thanks Robin Brinkler for bringing to our attention!)
391
- * Added checks for OpenSSL and cURL SSL support to the Diagnostics page.
392
- * PowerPress "Verify" option now works with MemberPress. (Thanks MemberPress for the code!)
393
- * Added new debugging define `POWERPRESS_DEBUG_QUERIES`, displays SQL queries at the bottom of the feed for diagnostic purposes.
394
- * Feed option to not allow other plugins from modyfing podcast feeds now bypasses the `the_content` and `the_excerpt` filters.
395
- * Added 2 new define options for podcast feeds and HTTPS. For example, it is possible to host your website via HTTPS but serve the feed via HTTP. (Thanks @Fastmover for the patch that inspired this option)
396
- * `define('POWERPRESS_FEEDS_FORCE_HTTPS', true);` when added to wp-config.php forces all media links and iTunes images to use HTTPS.
397
- * `define('POWERPRESS_FEEDS_FORCE_HTTP', true);` when added to wp-config.php forces all media links and iTunes images to use HTTP.
398
-
399
-
400
- = 7.0.2 =
401
- * Released on 7/22/2016
402
- * Fixed bug with new Blubrry Player not displaying show notes button.
403
- * Added TuneIn subscribe URL option. (Thanks @kgagne for bringing to our attention!)
404
- * Removed the PHP 5.2 or older error message in the getid3 library. (Thanks davidpmariano for the heads up!)
405
- * Fixed bug where podcast channels with a blank feed title do not apply specific channel settings like the website link. (Thanks Robin Brinkler for bringing to our attention!)
406
- * Fixed bug where category episodes were not using the category settings like they used to if only one category is selected. (Thanks Jason Bryant for explaining the situation for us to reproduce the problem!)
407
- * Added additional logic to better handle category podcasting when strict category podcasting is not enabled.
408
- * Removed itunes:summary when Feed Maximizer on (this was the behavior before 7.0). iTunes summary is a duplicate of the RSS description. To include itunes summary in maximizer mode, please add `define('POWERPRESS_MAXIMIZER_INCLUDE_ITUNES_SUMMARY', true);` in your wp-config.php.
409
-
410
-
411
- = 7.0.1 =
412
- * Released on 6/20/2016
413
- * Fixed bug where verify media could fail with "unable to determine file format" caused by getid3 library update. (Thanks @budgetnerd for bringing to our attention!)
414
- * Re-added the itpc links for subscribe on iTunes when no iTunes subscribe URL provided. For those who wanted this, please notice itpc does not work on iOS devices.
415
- * Statistics redirects that do not end with a / will now work. We add a slash if no slash is present.
416
- * Removed February 2016 iTunes notice message.
417
- * Subscribe by Email, on Google Play and Stitcher options removed for premium podcast feeds.
418
- * Subscribe links will no longer appear when episode no links option checked. (Thanks @360woodworking for bringing to our attention)
419
-
420
-
421
- = 7.0 =
422
- * Released on 6/6/2016
423
- * Added Google Play Music to subscribe page shortcode embed and sidebar widget.
424
- * Added Stitcher to subscribe page shortcode embed and sidebar widget.
425
- * New: Strict Category Podcasting. Select a specific category to each episode for statistics tracking and subscription links.
426
- * New: Podcast only category feeds. You can now mix blog posts with podcast episodes in your podast categories.
427
- * New: Blubrry Audio Player. Modern podcast audio player complete with subscribe and share tools. For Blubrry Hosting customers only.
428
- * Updated the getid3 library to latest version.
429
- * Embed link enhanced to use provided embed. If an embed is placed into an episode, the embed link below the player will use that embed as well.
430
- * Fixed bug where post type podcast feed with slug 'podcast' will also get the default podcast feed settings (Thanks steveportigal for bringing to our attention).
431
- * Fixed bug with WP 4.5 dropping the `rss-http` content type "text/xml".
432
- * Added shortcode attribute `ids=""` so you can specify post IDs for the playlist player to display exclusively. (Thanks John Haspel for the feature suggestion!)
433
- * RSS import now sets the blog post content from the iTunes summary if no description or content:encoded was found in the feed. (Thanks @synthtony for letting us know about the situation)
434
- * RSS import function calls to `mb_stripos()` will fallback to `stripos()` if the PHP mb (Multibyte String) library not available. (Thanks Glen Donohu for bringing to our attention!)
435
- * Import to podcast category option added.
436
- * Added audio ac3 and dts to media detection getid3 library (these are not podcast safe formats though we can detect their meta information).
437
- * Improved logic for setting the iTunes subtitle and iTunes summary from blog post excerpts and blog post content if no custom iTunes summary and/or subtitle is set.
438
- * Improved feed logic to minimize SQL queries
439
- * Feed Maximizer option now applies to category podcast only feeds.
440
- * Renamed "Appearance" settings to "Website" settings
441
- * Added "Destination" settings for podcast directories and apps
442
- * You can now select from pages when setting your Subscribe Page.
443
- * Changed labels for Podcasting SEO guidance to include word "Podcasting" so not to confuse with "Web SEO".
444
- * Updated Podcasting SEO guidance to reflect how search works in Google Play Music (Thanks Daniel Lewis for confirming what is indexed!)
445
- * Changed wording for Podcasting SEO guidance with Author field, replaced "slogans" with "nicknames" so it is more clear that we mean slogans for talent on the show.
446
- * Removed logic to fallback to the HTML5 player for mobile devices. This was only needed when Flash based players were used.
447
- * Quicktime Embed option for m4a audio removed due to security concerns with Quicktime.
448
- * SWF embed support dropped.
449
- * Embed link now toggles embed box when clicked multiple times.
450
- * ATTENTION: The 1 pixel out audio player will be removed from PowerPress 7.1.
451
-
452
- = Additional PowerPress Version History =
453
- Please visit the [PowerPress Version History](http://create.blubrry.com/resources/powerpress/advanced-tools-and-options/powerpress-version-history/) page for history prior to version 6.0.
454
-
455
- == Upgrade Notice ==
456
- ATTENTION: The 1 pixel out audio player will be removed from PowerPress 7.1.
457
-
458
- == Contributors ==
459
- Angelo Mandato, CIO [Blubrry](http://www.blubrry.com) - Plugin founder, architect and lead developer
460
-
461
- Pat McSweeny, PHP Developer - Developed initial version (v0.1.0) of plugin
462
-
463
- Jerry Stephens, [Way of the Geek](http://wayofthegeek.org) - Contributed initial code fix for excerpt bug resolved in v0.6.1, wrote initial code for the 4 new flash players.
464
-
465
- Darcy Fiander, [Rooty Radio](http://rootyradio.com) - Fixed bug with category links to FeedValidator.org and category title warning when validating category feeds.
466
-
467
- Joel Haasnoot, [Personal Blog](http://waarisdetrein.nl/joelhaasnoot/) - Developed PodPress archive statistics.
468
-
469
- Nicolas Bouliane, [Personal Blog](http://nicolasbouliane.com/) - contributed code for `get_the_powerpress_all_players()` function.
470
-
471
-
472
- == Translators ==
473
- * Danish translation for v1.0.11+ by [Team Blogos](http://wordpress.blogos.dk/s%C3%B8g-efter-downloads/?did=280) - Latest translation available [here](http://wordpress.blogos.dk/s%C3%B8g-efter-downloads/?did=280)
474
- * French translation for v1.0.11+ by [Aur�lien Denis](http://wpchannel.com/) - Aur�lien is looking for assistance maintaining the French translation, email wpchannel [at] gmail.com if interested.
475
- * Simplified Chinese for v1.0.12+ by [webmote](http://codeex.cn) - From webmote: Welcome to use the plugin. Very good! and then hope you to access my site.
476
- * Italian translation for v2.0.4+ by [Umberto Sartori](http://veneziadoc.net/)
477
- * Romanian translation for v2.0.4+ by Alexander Ovsov (Web Geek Sciense: http://webhostinggeeks.com/science/)
478
- * Russian translation for v4.0.5+ by [Igor Mercury](http://www.nightdiary.ru/)
479
- * Brazilian Portuguese translation for v6.0+ by [Leo Lopes from Radiofobia](http://radiofobia.com.br/)
480
-
481
-
482
- == Tips and Tutorials ==
483
- * [Using PowerPress outside the Loop](http://blog.nicolasbouliane.com/?p=1695) - by [Nicolas Bouliane](http://blog.nicolasbouliane.com/)
484
- * [The PowerPress Podcast](http://www.powerpresspodcast.com/) - by [Blubrry](http://www.blubrry.com/)
485
-
486
- Please [contact blubrry](http://www.blubrry.com/contact.php) with the link to your tips or tutorial for PowerPress and we'll add them to the list above.
487
-
488
- == Feedback ==
489
- [http://create.blubrry.com/resources/powerpress/](http://create.blubrry.com/resources/powerpress/)
490
-
491
- == Support ==
492
- [http://create.blubrry.com/support/](http://create.blubrry.com/support/)
493
-
494
- == Blubrry Social ==
495
-
496
- [Twitter](https://twitter.com/blubrry) - [Facebook](https://www.facebook.com/blubrry) - [YouTube](https://www.youtube.com/channel/UC9sE1Yz2deZiGAP67xYx9Xg)
 
 
 
 
1
+ === PowerPress Podcasting plugin by Blubrry ===
2
+ Contributors: amandato, blubrry
3
+ Tags: podcasting, podcast, podcaster, powerpress, itunes, apple, apple podcasts, google podcasts, google play, enclosure, professional, apple, apple tv, ipad, iphone, soundcloud, squarespace, youtube, viddler, ustream, podcasting, audio, video, rss2, feed, player, media, rss, mp3, music, embed, feedburner, statistics, stats, flv, flash, id3, episodes, blubrry, mp4, m4v, wordpressmu, mu, wordpress mu, multisite, multi site, mediacaster, post, plugin, posts, simple, social, dashboard, TSG, Buzzsprout, MTR, WP-boxCast, CastMyBlog, tgs podcasting, simple podcasting, seriously simple podcasting, seriously-simple-podcasting, serious, seriously, ssp, podlove, podcast.de, clammr, clammr radio, audio player, stitcher, tunein, show, shows, series, docs, documentation, support, free, add-ons, extensions, addons, libsyn, libsyn-podcasting, podbean, podomatic, spreaker
4
+ Requires at least: 3.6
5
+ Requires PHP: 5.2
6
+ Tested up to: 5.2.2
7
+ Stable tag: 7.5.2
8
+ Donate link: https://create.blubrry.com/resources/podcast-media-hosting/
9
+ License: GPLv2 or later
10
+
11
+ No. 1 Podcasting plugin for WordPress, with simple & advanced modes, players, subscribe tools, and more! Supports Apple Podcasts, Google, Spotify,..
12
+
13
+ == Description ==
14
+
15
+ No. 1 Podcasting plugin for WordPress, with simple & advanced modes, players, subscribe tools, and more!
16
+
17
+ [youtube https://www.youtube.com/watch?v=twqKrVehY3o]
18
+
19
+ Developed by podcasters for podcasters; features include Simple and Advanced modes, multiple audio/video player options, subscribe to podcast page embeds and sidebar widgets, podcasting SEO features, and more! Fully supports Apple Podcasts, Google Podcasts, Stitcher, TuneIn and Blubrry Podcasting directories, as well as all podcast applications and clients. PowerPress users who use Blubrry Podcast Hosting may also [submit their shows to Spotify](https://create.blubrry.com/manual/podcast-promotion/submit-podcast-to-spotify/).
20
+
21
+ = Simple Mode =
22
+ If you are just getting started or feel overwelmed with all the settings and options, switch to Simple mode! PowerPress's Simple Mode will walk you through getting started in 3 easy steps.
23
+
24
+ 1. Setup your Podcast quickly with only the essential settings
25
+ 1. Create your first Episode
26
+ 1. Submit your podcast to Apple Podcasts (previously iTunes Podcasts)
27
+
28
+ When you're ready you can switch to Advanced mode to tap into all the options professionals would want.
29
+
30
+ = PowerPress Key Features =
31
+ - Full Apple Podcasts (previously iTunes Podcasts) & Google Podcasts support: Adds Apple Podcast compliant podcast feeds to your WordPress site.
32
+ - Integrated HTML5 Media Players: Audio/video Web players with embed support from sites such as YouTube.
33
+ - NEW: [Skip to Position in Player](https://create.blubrry.com/resources/powerpress/advanced-tools-and-options/skip-to-position-in-player/) shortcode
34
+ - Subscribe tools: Create subscribe page with our exclusive subscribe shortcode embed and subscribe sidebar widget optimized for responsive websites, high-resolution screens and Apple Retina displays.
35
+ - Podcasting SEO: Improve discovery of your podcast on search engines such as Google, and with the Apple Podcasts directory.
36
+ - Podcast Importing: Import your podcast from SoundCloud, LibSyn, PodBean, Squarespace, or other podcast RSS feed.
37
+ - Migration tools: Quickly migrate from PodPress, TGS Podcasting, Seriously Simple Podcasting, Blogger, or Movable Type without losing episodes.
38
+ - Multi-podcast support: Create separate podcasts by category (Category Podcasting) or by media format (Podcast Channels).
39
+ - Post type and taxonomy podcasting: Create podcasts from custom post types and taxonomies.
40
+ - *Media Statistics: Get FREE Blubrry Media Statistics from your WordPress dashboard.
41
+ - Multi-languages, locales and emoji support: See [PowerPress in your language](http://create.blubrry.com/resources/powerpress/powerpress-language/) and [Enable Emoji in podcast feeds](https://create.blubrry.com/resources/powerpress/powerpress-settings/feeds/#emoji) for details.
42
+
43
+ = Includes Full Apple Podcasts Support! =
44
+ Blubrry PowerPress fully supports Apple Podcasts (previously iTunes podcasts), which is required for podcasting. PowerPress comes with the following Apple Podcasts specific features:
45
+
46
+ * Apple Podcasts compliant podcast feeds: The appropriate tags are added to your feeds so your Apple Podcasts listing looks great.
47
+ * Optimized Apple Podcasts summary: Converts your blog-post content to a format suited for viewing in Apple Podcasts ([learn more](http://create.blubrry.com/resources/powerpress/powerpress-settings/itunes/)).
48
+ * Tunes artwork: Upload and manage your Apple Podcasts artwork directly from within PowerPress settings.
49
+ * Apple Podcasts: Fully supported, including the latest [Apple Podcasts specifications](http://www.powerpresspodcast.com/2012/05/10/itunes-podcasting-specifications-changed-may-2012-what-that-means-for-podcasting/).
50
+ * Feed Episode Maximizer: Increase the number of episodes viewed on Apple Podcasts while decreasing the byte size of your feeds.
51
+
52
+ = Includes Full Google Podcasts Support! =
53
+ Blubrry PowerPress fully supports the newly launched Google Podcasts directory built into Google search, Google Home smart speakers and Google Podcasts Android app.
54
+
55
+ = Integrated Media Players =
56
+ Blubrry PowerPress includes extensive Web player options to display your podcast audio and video in your Web pages.
57
+
58
+ * Audio players: Pick from Blubrry's Media Player, MediaElement.js, or the native HTML5 audio player.
59
+ * Video players: Pick from MediaElement.js, VideoJS, or the native HTML5 video player.
60
+ * Positioning: Position player above or below your content.
61
+ * [Player shortcode](http://create.blubrry.com/resources/powerpress/advanced-tools-and-options/shortcode/): Place the player exactly where you want by adding the `[powerpress]` shortcode directly into your post content.
62
+ * [Playlist player shortcode](http://create.blubrry.com/resources/powerpress/advanced-tools-and-options/powerpress-playlist-shortcode/): Include a playlist of your latest podcast episodes utilizing the `[powerpress_playlist]` shortcode in any page or post.
63
+ * Embeds: Add embeds from sites such as YouTube.
64
+ * Links: Provide download, play in new window and embed links.
65
+ * Audio formats supported: mp3, m4a, oga (ogg audio), opus.
66
+ * Video formats supported: m4v, mp4, webm, ogv (ogg video).
67
+
68
+ = Integrated Subscribe Tools =
69
+ A Blubrry PowerPress exclusive, podcast subscribe tools help you convert Web visitors into podcast subscribers. Subscribe options include:
70
+
71
+ * [Subscribe page](http://create.blubrry.com/resources/powerpress/advanced-tools-and-options/subscribe-page/): Instantly create a subscribe page with simplified instructions on how to subscribe to your podcast using the PowerPress subscribe page shortcode.
72
+ * [Subscribe page shortcode](http://create.blubrry.com/resources/powerpress/advanced-tools-and-options/powerpress-subscribe-shortcode/): Add the `[powerpress_subscribe]` shortcode to include a mobile-device optimized subscribe embed in any post or page that includes buttons to subscribe on Apple Podcasts, [Subscribe on Android](http://www.subscribeonandroid.com), [Subscribe by Email](http://www.subscribebyemail.com), Stitcher, tuneIn, Spotify, Google Podcasts, via RSS, and an special textbox to easily copy and paste your podcast feed into any podcast application.
73
+ * Subscribe sidebar widget: Mobile device optimized sidebar buttons to subscribe on Apple Podcasts, [Subscribe on Android](http://www.subscribeonandroid.com), Stitcher, tuneIn, Spotify, Google Podcasts, subscribe by RSS, and a "more subscribe options" button linked to your podcast's subscribe page.
74
+ * Subscribe links: Subscribe on Apple Podcasts, [Subscribe on Android](http://www.subscribeonandroid.com), [Subscribe by Email](https://www.subscribebyemail.com), subscribe by RSS and a link to your custom subscribe page below every player.
75
+ * Retina enabled: Subscribe button images optimized for high resolution displays including Apple Retina displays.
76
+ * Responsive: Subscribe tools are designed for any screen and optimized for touch screens by providing custom buttons that are indrustry standard 48 pixels in height optimized for touch screen use.
77
+
78
+ = Integrates with Blubrry's Services =
79
+ Make your life easier by adding our FREE or paid media hosting and statistics services to streamline your podcast productivity.
80
+
81
+ * Quickly access your Blubrry media download statistics from your WordPress dashboard.
82
+ * Publish Blubrry hosted media directly from your blog.
83
+ * View Blubrry hosting usage quota from your blog.
84
+ * Configure how Blubrry writes media (ID3) tags within PowerPress settings.
85
+ * Post your podcast to Twitter, Facebook, and YouTube.
86
+ * Migrate all of your media at no additional cost to your Blubrry [Podcast Media Hosting](http://create.blubrry.com/resources/podcast-media-hosting/) account with just a couple clicks.
87
+
88
+ The Blubrry basic statistics service is FREE. Our [Premium Statistics Service](https://secure.blubrry.com/podcast-statistics-premium/), which includes [Blubrry Certified Statistics](http://create.blubrry.com/resources/podcast-media-download-statistics/rawvoice-certified/), U.S. downloads, trending and exporting, is available for $5 month. Blubrry [Media Hosting](https://secure.blubrry.com/podcast-publishing-premium-with-hosting/) packages start at $12.
89
+
90
+
91
+ = Advanced Features for those who need more =
92
+ Want more? We've got more! With a simple click you can enable advanced features and options. Check out some of the advanced features:
93
+
94
+ * [Podcasting SEO settings](http://create.blubrry.com/resources/powerpress/advanced-tools-and-options/podcasting-seo-settings/): Utilize the Apple and Google feed and HTML tags to improve the discovery of your podcasts and include the necessary meta data in your blog pages for search engines to discover.
95
+ * Embeds: Provide embeds your audience can take with them (just like YouTube embeds)
96
+ * Media size and duration detection: Enter your media URL and let the PowerPress do the rest.
97
+ * Category Casting: Add podcast support to your WordPress category feeds.
98
+ * Custom Podcast Channels: Distribute multiple formats (audio/video) and versions (short/full length).
99
+ * Taxonomy Podcasting: Create podcasts for your custom taxonomy tag names including WordPress Tags. (feature sponsored by [AfterBuzzTV.com](http://afterbuzztv.com/))
100
+ * Post Type Podcasting: Create podcasts for your custom post types.
101
+ * Premium Podcasting (Requires a membership plugin and/or roles and capabilities plugin to manage)
102
+ * User Role Management: Control which users in your blog can podcast. (Requires a roles and capabilities plugin to manage)
103
+ * Diagnostics: Check to see if your server is configured to support all of the available features in PowerPress.
104
+ * WordPress MultiSite: Blubrry PowerPress is compatible with WordPress MultiSite and can be extended using the [Blubrry PowerPress MultiSite add-on plugin](https://wordpress.org/plugins/powerpress-multisite/).
105
+ * *Supported syndication formats: mp3, m4a, mp4, m4v, webm, ogg, oga, ogv, wma, ra, mp4a, m4v, mp4v, mpg, asf, avi, wmv, flv, swf, mov, divx, 3gp, midi, wav, aa, pdf, torrent, m4b, m4r, epub.
106
+
107
+ *Apple Podcasts only supports mp3, m4a, mp4, m4v, pdf and epub.
108
+
109
+ = Migrating from PodPress or other podcasting plugin? =
110
+ Switching to from PodPress to PowerPress is seamless. Simply enable PowerPress then disable PodPress and you're done! PowerPress will continue where plugin your old plugin left off by including your previously created episodes in your feeds and Web pages.
111
+
112
+ Please see detailed instructions for migrating from [PodPress](http://create.blubrry.com/resources/powerpress/advanced-tools-and-options/migrating-from-podpress-to-powerpress/), [TGS Podcasting Plugin](http://create.blubrry.com/resources/powerpress/advanced-tools-and-options/migrating-from-tgs-podcasting-plugin/) and [Seriously Simple Podcasting](http://create.blubrry.com/resources/powerpress/advanced-tools-and-options/migrating-from-seriously-simple-podcasting-plugin/).
113
+
114
+ Note: Advanced settings such as settings for podcast categories will need to be recreated in PowerPress.
115
+
116
+ = Migrating from another service such as LibSyn, PodBeam, SoundCloud, or Squarespace? =
117
+ Importing your podcast feed into PowerPress is super easy! Simply paste in your RSS feed URL into the PowerPress feed import tool and click import. RSS feed import works with any podcast service and includes additional options for importing from LibSyn, PodBeam, SoundCloud, and Squarespace. You can optionally migrate your media to your Blubrry Podcast Hosting account with only a couple simple clicks.
118
+
119
+ = PowerPress in your Language =
120
+
121
+ [PowerPress is available in a number of languages](http://create.blubrry.com/resources/powerpress/powerpress-language/). Starting with PowerPress 7.0, translations will be managed through [translate.wordpress.org](https://translate.wordpress.org/projects/wp-plugins/powerpress/) making translations easier to setup and update.
122
+
123
+ = PowerPress is looking for translators! =
124
+
125
+ [Anyone can help translate PowerPress!](http://create.blubrry.com/resources/powerpress/powerpress-language/translate-powerpress/) If you are intersted in translating PowerPress, please [contact us](https://www.blubrry.com/contact/#translate).
126
+
127
+ **Translators will receive the following from us as a thank you for contributing:**
128
+
129
+ * Free [Blubrry Professional podcast statistics](http://create.blubrry.com/resources/podcast-media-download-statistics/) account for your podcast.
130
+ * Name or nickname in the PowerPress readme.txt and in the [PowerPress WordPress.org Translators list](https://wordpress.org/plugins/powerpress/other_notes/) (will give you credit for your contribution)
131
+ * Website URL (optional, we will link to your website)
132
+
133
+ Interested translators please [contact us](https://www.blubrry.com/contact/#translate), include your WordPress.org account name, blubrry account login (if you have one), your name, desired URL, and the language locale(s) you would like to translate.
134
+
135
+ = Need Help? =
136
+ . . . or have some ideas that could improve the plugin?
137
+
138
+ * Visit the Blubrry [PowerPress Forum](https://wordpress.org/support/plugin/powerpress) and [Blubrry Resources](http://create.blubrry.com/resources/)
139
+ * Use the Blubrry [Contact Us](http://www.blubrry.com/contact.php) form
140
+ * Blubrry [PowerPress Documentation](http://create.blubrry.com/resources/powerpress/)
141
+ * Check out [The Podcasting Manual](http://create.blubrry.com/manual/) - everything you need to know about podcasting
142
+
143
+ = Need More Help? =
144
+ We now offer one-on-one consulting via GoToMeeting, Skype or phone.
145
+ [Learn more about Blubrry Consulting Services](http://create.blubrry.com/support/podcast-consulting-services/)
146
+
147
+ *PowerPress is developed and maintained by [Blubrry](http://www.blubrry.com), a podcasting company and community owned and operated by podcasters providing tools and resources for podcasters to measure, monetize, publish and host podcasts. Although we'd like you to become a member of [Blubrry](http://www.blubrry.com/createaccount.php), **no membership is required** to use this free open source podcasting plugin.*
148
+
149
+
150
+ == Frequently Asked Questions ==
151
+
152
+ = Compatible Themes and Plugins =
153
+ Most themes and plugins are compatible with PowerPress. PowerPress is developed and tested using the default themes packaged with WordPress including twentyten, twentytwelve, twentythirteen, twentyfourteen, twentyfifteen, and all future versions. These themes use WordPress best practices and adhere to theme rules set by WordPress.org. Any child theme based on these themes should also work without issue.
154
+
155
+ If you are having a problem, try [Diagnosing Feed and/or Player Issues](http://create.blubrry.com/resources/powerpress/using-powerpress/diagnosing-feed-andor-player-issues-with-powerpress/).
156
+
157
+ If you are having a problem specifically with the player and links, try the "Having issues?" option under PowerPress Settings > Appearance tab. Visit [Resolving Plugin or Theme Conflicts](http://create.blubrry.com/resources/powerpress/powerpress-settings/media-appearance/plugin-theme-conflict-issues/) for details.
158
+
159
+ = Premium podcasting themes compatible with PowerPress =
160
+ [Appendipity Podcast Pro theme](https://www.appendipity.com/themes/podcast-pro-theme/?aid=13) is is designed specifically to take advantage of built-in features, settings and podcast episode meta data in PowerPress. The Blubrry team works with the Appendipity team during beta testing and major WordPress releases to make sure the Podcast Pro theme and PowerPress work together seamlessly.
161
+
162
+
163
+ = Related Plugins =
164
+ The following plugins may be used in conjunction with PowerPress.
165
+
166
+ * [Message Flow](http://wordpress.org/extend/plugins/message-flow/) - generates a CoverFlow-like interface for your blog posts with podcast episodes. For podcasts, use shortocde `[message-flow podcasts_only="true"]`.
167
+ * [Eli's PowerPress Addon Widget](http://wordpress.org/extend/plugins/podpress-addons/) - Adds a sidebar widget that lists your podcast episodes linked to the play in a new window PowerPress player.
168
+ * [PowerPress Posts From MySQL](http://wordpress.org/extend/plugins/powerpress-posts-from-mysql/developers/) - Creates blog posts with PowerPress podcast episode information from a MySQL table.
169
+ * [Featured Podcast Widget](http://wordpress.org/plugins/featured-podcast-widget/), [Home Page](http://www.richardfarrar.com/featured-podcast-widget-for-wordpress/) - A widget that enables you to display your latest podcast from a category or featured podcast utilising the PowerPress plugin's default player.
170
+ * [Skip to Timestamp](https://wordpress.org/plugins/skip-to-timestamp/) - Skip to Timestamp allows for generating links in your posts that automatically skip to a given time in an audio, video or youtube embed.
171
+
172
+
173
+ = Why doesn't Blubrry PowerPress support multiple enclosures in one feed item/post? =
174
+ Blubrry PowerPress does not allow you to include multiple media files for one feed item (blog post). This is because each podcatcher handles multiple enclosures in feeds differently. Apple Podcasts will download the first enclosure that it sees in the feed ignoring the rest. Other podcatchers and podcasting directories either pick up the first enclosure or the last in each post item. This inconsistency combined with the fact that [Dave Winer does not recommend multiple enclosures](http://www.reallysimplesyndication.com/2004/12/21) and the [FeedValidator.org recommendation against it](http://www.feedvalidator.org/docs/warning/DuplicateEnclosure.html) is why the Blubrry PowerPress does not support them.
175
+
176
+ As a alternative, PowerPress allows you to create additional Custom Podcast Feeds to associate any magnitude of media format and/or length in a blog post to specific custom feeds. For example, you can create one blog post associated to separate video and audio podcast feeds saving you time from entering your show notes twice.
177
+
178
+ = Why doesn't Blubrry PowerPress include media statistics built-in? =
179
+ 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 efficient WordPress podcasting plugin. We recommend using your media hosting's web statistics to give you basic download numbers and, if you are seeking more grandular measurements such as client and geographical information for each episode, you're more than welcome to use the [Blubrry Statistics service](http://create.blubrry.com/resources/podcast-media-download-statistics/) as well.
180
+
181
+ You may however access your Blubrry Statistics from within your WordPress dashboard.
182
+
183
+ = How do you insert the player within a blog post? =
184
+ You can insert the media player within your blog posts by using the WordPress shortcode feature. The shortcode for PowerPress is `[powerpress]` (all lowercase)
185
+
186
+ 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"]
187
+
188
+ 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"]
189
+
190
+ 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*
191
+
192
+ = Why can't you upload large media files? =
193
+ File uploads are tricky to handle because there are so many web hosting variations with different upload size limits. We recommend using an FTP application to upload large media files. FTP is much more efficient than web based uploads and is typically provided by nearly all web hosting providers.
194
+
195
+ = The Media Player does not appear on my site? =
196
+ . . . or the RSS feed is invalid?
197
+
198
+ This can happen when there is a theme or plugin conflict. Please visit our [Diagnosing Feed and/or Player Issues](http://create.blubrry.com/resources/powerpress/using-powerpress/diagnosing-feed-andor-player-issues-with-powerpress/) for instructions how to resolve such issues.
199
+
200
+
201
+ == Installation ==
202
+ = Point and Click Installation =
203
+ 1. Sign into your blog, go to the plugins section and click 'Add New'.
204
+ 2. In the search box enter "PowerPress", then click 'Search'.
205
+ 3. Click the 'Install Now' link and proceed to install the plugin.
206
+ 4. Once installed, click 'Activate'.
207
+ 5. Configure your Blubrry PowerPress by going to the **Settings** > **Blubrry PowerPress** page.
208
+
209
+ = Manual Installation =
210
+ To install Blubrry PowerPress manually, follow these steps:
211
+
212
+ 1. Download [PowerPress from WordPress.org](http://wordpress.org/plugins/powerpress/).
213
+ 2. Extract the downloaded zip file to a temporary folder.
214
+ 3. Copy the entire powerpress folder from the downloaded zip file into the /wp-content/plugins/ folder on your server.
215
+ 4. Activate the "Blubrry PowerPress" plugin in your blog's Plugin Management page.
216
+ 5. Configure your Blubrry PowerPress by going to the **Settings** > **Blubrry PowerPress** page.
217
+
218
+
219
+ == Screenshots ==
220
+ 1. PowerPress's Simple Mode will walk you through setting up your podcast in 3 easy steps.
221
+ 2. Just like blogging, podcasting utilizes blog posting features with the addition of a podcast episode box. Yes, podcasting is that simple!
222
+ 3. PowerPress integrates seamlessly with Blubrry Podcast Hosting's exclusive player.
223
+ 4. PowerPress comes with a built-in subscribe sidebar widget to help your audience subscribe to your podcast.
224
+ 5. PowerPress comes with an editable subscribe page builder with a subscribe embed tool to help your web visitors subscribe.
225
+ 6. PowerPress's Advanced Mode settings let you dig in as deep as you want to with every possible setting for podcasting at your fingertips.
226
+ 7. PowerPress incorporates the built-in WordPress media players into your blog posts and pages.
227
+
228
+
229
+ == Changelog ==
230
+
231
+ = Next Major Release Announcements =
232
+ * We are looking for beta testers! If you would like to beta test future versions of PowerPress, please [contact us](http://www.blubrry.com/contact.php#feedback) with your name and email.
233
+
234
+ = Fan of PowerPress and want to show your support? =
235
+ If you are a fan of PowerPress, we would greatly appreciate it if you could take a moment and [leave us a review on WordPress.org](https://wordpress.org/support/plugin/powerpress/reviews/?rate=5#new-post). Your support is greatly appreciated!
236
+
237
+ = 7.5.2 =
238
+ * Released on 7/25/2019
239
+ * Fixed logic bug introduced in 7.5 for sites using versions of PHP 5.4 or older.
240
+ * Added code changes to Blubrry Hosting's Post to Social from PowerPress feature. (Last beta release of this feature!)
241
+
242
+ = 7.5.1 =
243
+ * Released on 7/23/2019
244
+ * Added library for PubSubHubbub. Missed it when merging latest git release into wordpress.org svn. Sorry about that!
245
+
246
+
247
+ = 7.5 =
248
+ * Released on 7/23/2019
249
+ * Added new Apple categories announced in July. The new Apple Categories will be made available on Apple Podcasts mid August, 2019.
250
+ * Added Multi-program Blubrry Podcast Hosting, perfect for Category podcasting.
251
+ * Added *Update Google PubSubHubbub*, lets Google Podcasts and other podcast directory services when your podcast publishes new episodes.
252
+ * Added support for various languages to podcast as including "Thai" and "Vietnamese".
253
+
254
+
255
+ = 7.4.4 =
256
+ * Releasd on 6/21/2019
257
+ * Fixed bug introduced in last update that calculated the total number of episodes when viewing podcasts in channels and post types in PowerPress admin. (Thanks @edzila60610 for bringing to our attention!)
258
+ * Removed all mentions of Google+. (Thanks @k_abel for bringing to our attention!)
259
+ * Fixed notice message getting cut off for the "Clear Plugins Update Cache" option under "Tools". (Thanks @k_abel for bringing to our attention!)
260
+ * Added option `archive`="true" for the `powerpress_subscribe` shortcode to allow for the shortcode to be added to archive/category pages.
261
+
262
+
263
+ = 7.4.3 =
264
+ * Released on 6/12/2019
265
+ * Updated labels for Subscribe buttons and links in admin.
266
+ * Note: Apple has announced the end of life for iTunes desktop (except for Windows). PowerPress will be removing iTunes desktop specific features where they conflict with the Apple Podcasts iOS app.
267
+ * Enhanced iTunes summary updated, optimized for latest iOS podcasts app. It is now designed for Apple Podcasts iOS app rather than for iTunes desktop. (Thanks Robin for your assistance!)
268
+ * Force feed discovery on homepage only to use default podcast feed for Google Search.
269
+ * Fixed bug with deleting media files hosted on Blubrry Podcast hosting.
270
+ * Fixed bug with posts with revisions being part of the total number of episodes when viewing podcast feeds in PowerPress settings.
271
+ * Fixed bug with skipto position time not getting included in feed show notes. (Thanks @tszt for bringing to our attention!)
272
+
273
+
274
+ = 7.4.2 =
275
+ * Released on 4/26/2019
276
+ * Fixed `T_FUNCTION` bug for PHP 5.2 (not an issue if you have PHP 5.3 or newer)
277
+
278
+
279
+ = 7.4.1 =
280
+ * Released on 4/10/2019
281
+ * Added logic to authentication email addresses differently for premium password protected podcasts.
282
+ * Added support for YoastSEO and Google Podcasts (Thanks @sunkast for bringing to our attention!)
283
+ * Removed use of `create_function` to fix damaged serialized data created by the old PodPress plugin. (Thanks @oilmanmag and Dimitris for bringing to our attention!)
284
+ * Fixed `esc_attr()`bug with podpress import.
285
+ * Added Tamil (ta) as a podcast feed language option. Thanks KT for requesting! If you do not see your language pelase contact us we will add it!
286
+ * Changed feed join query to solve conflict with the Affiliate Disclosure Pro plugin. (Thanks @ndnakashima for bringing to our attention!)
287
+ * New functionality for Taxonomy podcasting and the `powerpress_subscribe` shortcode (Thanks @tristanmason for testing!)
288
+ * Fixed taxonomy bugs with the playlist player shortcodes (Thanks @tristanmason for the code and helping us test!)
289
+ * PowerPress playlist player can now be ordered in ascending order with attribute order="asc" (Thanks @tristanmason for the code and helping us test!)
290
+ * Fixed bug with skipto shortcode leaving a blank value in feeds. (Thanks @tszt for bringing to our attention!)
291
+ * Skipto timestamp now uses the timestamp exactly as you entered it as the label as long as it has at least one colon to separate minutes from seconds.
292
+ * Fixed bug for post type podcasting in the situation where there can be multiple post types for blog posts or pages. (Thanks @shawnogordo for the bug fix!)
293
+
294
+
295
+ = 7.4 =
296
+ * Released on 10/03/2018
297
+ * NEW: [Skip to Position in Player](https://create.blubrry.com/resources/powerpress/advanced-tools-and-options/skip-to-position-in-player/) shortcode, quickly skip to a position in your audio episodes from your show notes. e.g. `[skipto time="2:34"]` [Learn more](https://create.blubrry.com/resources/powerpress/advanced-tools-and-options/skip-to-position-in-player/)
298
+ * MEW: Emoji in show notes! You can now enter Emoji characters into the show notes to appear in podcast apps. Enable option in Feed settings tab. Previously WordPress converst Emoji to images which are not displayed in podcast apps. [Learn more](https://create.blubrry.com/resources/powerpress/powerpress-settings/feeds/#emoji)
299
+ * Added option to override the Google Podcasts subscribe URL.
300
+ * Enhanced VideoObject, a feature in Podcasting SEO.
301
+ * Improved base64 encoding Google Podcasts Subscribe URLs. (Thanks Daniel Lewis for the heads up!)
302
+ * Removed option `Append show title to episode titles` per request from Apple.
303
+
304
+
305
+ = 7.3 =
306
+ * Released on 07/10/2018
307
+ * Spotify and Google Podcasts subscribe links added to Destinations.
308
+ * PowerPress users using [Blubrry Podcast Hosting](https://create.blubrry.com/resources/podcast-media-hosting/) may now submit shows to Spotify!
309
+ * Added PodcastMirror setting, a modern alternative to FeedBurner. Learn more about [PodcastMirror](https://podcastmirror.com/) at [podcastmirror.com](https://podcastmirror.com/)
310
+ * Converted loop logic from each() to foreach() for PHP 7.3+ / 8.0+ compatibility.
311
+ * Improved logic for playlist player to appear better when certain settings are not set.
312
+ * Moved the enqueue script ('jquery-ui-tabs') logic so it only loads in the powerpress admin pages. (Thanks @keenanpayne for the code change!)
313
+ * Added define option `POWERPRESS_POSTTYPE_MIXING`, when set to true podcast channels for the default podcast feed will mix all post types of type post with the default podcast feed. (Thanks @eos-rose for bringing to our attention)
314
+ * Fixed bug with translation and javascript alert messages. (Thanks Enrico for reporting the bug!)
315
+
316
+
317
+ = 7.2 =
318
+ * Released on 12/13/2017
319
+ * Added code to allow customization of Blubrry player style and colors.
320
+ * Added code to set no-cache headers in AJAX calls.
321
+ * Updated code to fixed bug where new iTunes episode title field may not save with some web hosting platforms using mod security with PHP 5.x. (Thanks @glark, Karren, and others for helping us fix the issue!)
322
+ * Changed the menu slug name for editing PowerPress settings.
323
+ * Removed safe mode logic for older versions of PHP. (Thanks @BrentO for reporting)
324
+ * Added logic to support feeds with bbpress. (Thanks @mubashiriqbal for bringing to our attention!)
325
+ * Added missing argument for get_post_type_object() in powerpress-subscribe (Thanks John for bring to our attention)
326
+ * Added disable iOS 11 field options under tools to help diagnose issue with some websites that show a 404 page when editing settings since the iOS11 fields were introduced.
327
+ * Changed the names of the new iOS11 fields that were getting caught by Mod Security for some users.
328
+ * Fixed bug with Taxonomy podcasting statistics redirects not being compatible with versions of WordPress older than 4.5 (Thanks @fmnowling for bringing to our attention!)
329
+ * iTunes Maximizer option 11+ older episodes now includes the iTunes summary by default to reflect changes with iOS11. (Thanks Daniel Lewis for the suggestion!)
330
+ * Fixed link to powerpress translation page which was returning 404
331
+ * Added CastFeedValidator.com links for validating podcast feeds.
332
+ * Added Hindi and Punjabi to list of Podcast feed langauges (Thanks @blueblast for requesting the languages to be added)
333
+
334
+
335
+ = 7.1.1 =
336
+ * Released on 08/24/2017
337
+ * NOTE: There is no urgency to update to this version unless you can benefit from bug fixes listed.
338
+ * BETA COMING SOON: PowerPress 7.2 Beta will be available within 24-72 hours. Please visit https://create.blubrry.com/resources/powerpress/powerpress-beta/ for more details.
339
+ * Added logic to prevent the W3 Total Cache plugin from minifying podcast feeds. (Thanks @allimaple for bringing to our attention)
340
+ * Fixed warning messages in the getid3 library so they comply with PHP 7.1+. (Thanks @mahe for letting us know about the problem)
341
+ * Fixed error verifying URLs for file formats not supported by iTunes.
342
+ * Feed import now compatible with Spreaker podcast feeds.
343
+ * Added code when including the subscribe CSS file to make sure it's always included with various WordPress updates (Thanks Tim for the code fix!)
344
+ * Added checkbox in Blubrry Player configuration for making iTunes Episode image use optional with player. Unchecked by default.
345
+
346
+
347
+ = 7.1 =
348
+ * Released on 7/11/2017
349
+ * Added support for iOS 11!
350
+ * iTunes type added, specify episodic or serial for your podcast program (for iOS 11).
351
+ * iTunes episode title, number, season and type added for your episodes (for iOS 11).
352
+ * Subscribe on iTunes changed to Subscribe on Apple Podcasts, links have been enhanced to highlight episodes.
353
+ * Blubrry Podcast Media Hosting and HTTPS: Media URLs are now automatically converted to HTTPS.
354
+ * Added compatibility for the SG CachePress plugin. PowerPress will clear the cache if there was an error. (Thanks @grudesky for getting us in touch with developers!)
355
+ * Fixed error with creating the subscribe page in some languages (Thanks @edithmayerhofer for bringing to our attention).
356
+ * Better error reporting when importing podcast feed images.
357
+ * Verify media option improvements, mp3 duration is now detected even faster in most cases!
358
+ * Added logic to prevent notice messages with the subscribe_shortcode and newest versions of PHP. (Thanks @mahe for bringing to our attention)
359
+ * Added "Hide player / links: Read more tagged posts" option, hides the player and links on pages with the read more link. (Thanks @calebsg0 for the suggestion!)
360
+ * Google play schema URL updated.
361
+ * Added "redirect_rule" list of post types not used for podcasting. For compatibility with the "Safe Redirect Manager" plugin.
362
+ * Blubrry Player now uses the episode itunes image if set. The URLs to the images must be https:// in order to appear on social networking sites.
363
+ * Windows Media Player in browser support has been removed. Microsoft Edge browser does not support Windows Media Player in the browser.
364
+ * New logic added for dealing with Internet Explorer / Edge browser preloading media when using the MediaElement.js player.
365
+ * Fixed PHP warning message if media size in bytes is zero when displaying file size with player links.
366
+ * No longer using self closing XML for iTunes Categories.
367
+ * iTunes subscribe itpc:// links are no longer supported.
368
+ * Editing default podcast channel now imports global settings by default if blank. (Thanks Robin for bringing to our attention!)
369
+ * RSS Podcast feed Import error message added when the PHP XML library is not available. (Thanks @hgetrost for bringing to our attention!)
370
+
371
+
372
+ = 7.0.4 =
373
+ * Released on 2/18/2017
374
+ * NOTE: There is no urgency to update to this version unless you can benefit from the new import options, top level iTunes category options, or bug fixes listed.
375
+ * Playlist player bug fix: When ids="" are specified, episodes are now listed in the order entered rather than by date. (Thanks Zach Herbert for bringing to our attention!)
376
+ * Updated the `powerpress_subscribe` shortcode to include the latest iTunes button in svg format and added the iTunes small badge. Use attribute itunes_badge="true" to display iTunes badge.
377
+ * Changed import feed code to use the current author ID rather than hard coded to 1. (Thanks @tund3r for the bug fix!)
378
+ * Import feed for libsyn updated. (Thanks @tund3r for the code fix!)
379
+ * Import feed advanced option "Remove query strings from media URLs" added. (Thanks @tund3r!)
380
+ * Fixed rare PHP Notice unserialize() on line 3094 error that may happen if the podcast episode serialized data is not present. (Thanks @hmseb for pointing out the notice to us!)
381
+ * Added colon ":" to list of characters that can be in a valid media URL. (Thanks AfterBuzzTV.com! for the heads up!)
382
+ * Fixed notice message that can appear when using the media objects with the powerpress shortcode. (Thanks @srumery for reporting the problem!)
383
+ * Fixed issue with dashboard failing to load in some cases due to news feed being blocked by web server. (Thanks Jacob K. for helping us debug the problem!)
384
+ * iTunes categories with subcategories are no longer strictly enforced. If you want to select "Art" without selecting a sub category you now can. Selecting a category with a sub category is still optimal.
385
+ * Added ability to import a podcast feed to a post type podcast feed or to a podcast channel.
386
+ * Added ability to set the post status when importing a podcast feed. (Thanks @hgetrost for the feature suggestion!)
387
+ * Added compatibility with the [Custom Post Widget](https://wordpress.org/plugins/custom-post-widget/) plugin. (Thanks @aparentdesign for letting us know about the problem)
388
+ * Fixed bug where ogg audio was not using the correct audio player. (Thanks @joeress for letting us know about the bug)
389
+ * Fixed bug with import not matching episode media URLs correctly. (Thanks @hgetrost for bringing to our attention)
390
+
391
+
392
+ = 7.0.3 =
393
+ * Released 9/13/2016
394
+ * Fixed issue when editing channel/category/post type podcast settings double escaping & character. (Thanks Robin Brinkler for bringing to our attention!)
395
+ * Added checks for OpenSSL and cURL SSL support to the Diagnostics page.
396
+ * PowerPress "Verify" option now works with MemberPress. (Thanks MemberPress for the code!)
397
+ * Added new debugging define `POWERPRESS_DEBUG_QUERIES`, displays SQL queries at the bottom of the feed for diagnostic purposes.
398
+ * Feed option to not allow other plugins from modyfing podcast feeds now bypasses the `the_content` and `the_excerpt` filters.
399
+ * Added 2 new define options for podcast feeds and HTTPS. For example, it is possible to host your website via HTTPS but serve the feed via HTTP. (Thanks @Fastmover for the patch that inspired this option)
400
+ * `define('POWERPRESS_FEEDS_FORCE_HTTPS', true);` when added to wp-config.php forces all media links and iTunes images to use HTTPS.
401
+ * `define('POWERPRESS_FEEDS_FORCE_HTTP', true);` when added to wp-config.php forces all media links and iTunes images to use HTTP.
402
+
403
+
404
+ = 7.0.2 =
405
+ * Released on 7/22/2016
406
+ * Fixed bug with new Blubrry Player not displaying show notes button.
407
+ * Added TuneIn subscribe URL option. (Thanks @kgagne for bringing to our attention!)
408
+ * Removed the PHP 5.2 or older error message in the getid3 library. (Thanks davidpmariano for the heads up!)
409
+ * Fixed bug where podcast channels with a blank feed title do not apply specific channel settings like the website link. (Thanks Robin Brinkler for bringing to our attention!)
410
+ * Fixed bug where category episodes were not using the category settings like they used to if only one category is selected. (Thanks Jason Bryant for explaining the situation for us to reproduce the problem!)
411
+ * Added additional logic to better handle category podcasting when strict category podcasting is not enabled.
412
+ * Removed itunes:summary when Feed Maximizer on (this was the behavior before 7.0). iTunes summary is a duplicate of the RSS description. To include itunes summary in maximizer mode, please add `define('POWERPRESS_MAXIMIZER_INCLUDE_ITUNES_SUMMARY', true);` in your wp-config.php.
413
+
414
+
415
+ = 7.0.1 =
416
+ * Released on 6/20/2016
417
+ * Fixed bug where verify media could fail with "unable to determine file format" caused by getid3 library update. (Thanks @budgetnerd for bringing to our attention!)
418
+ * Re-added the itpc links for subscribe on iTunes when no iTunes subscribe URL provided. For those who wanted this, please notice itpc does not work on iOS devices.
419
+ * Statistics redirects that do not end with a / will now work. We add a slash if no slash is present.
420
+ * Removed February 2016 iTunes notice message.
421
+ * Subscribe by Email, on Google Play and Stitcher options removed for premium podcast feeds.
422
+ * Subscribe links will no longer appear when episode no links option checked. (Thanks @360woodworking for bringing to our attention)
423
+
424
+
425
+ = 7.0 =
426
+ * Released on 6/6/2016
427
+ * Added Google Play Music to subscribe page shortcode embed and sidebar widget.
428
+ * Added Stitcher to subscribe page shortcode embed and sidebar widget.
429
+ * New: Strict Category Podcasting. Select a specific category to each episode for statistics tracking and subscription links.
430
+ * New: Podcast only category feeds. You can now mix blog posts with podcast episodes in your podast categories.
431
+ * New: Blubrry Audio Player. Modern podcast audio player complete with subscribe and share tools. For Blubrry Hosting customers only.
432
+ * Updated the getid3 library to latest version.
433
+ * Embed link enhanced to use provided embed. If an embed is placed into an episode, the embed link below the player will use that embed as well.
434
+ * Fixed bug where post type podcast feed with slug 'podcast' will also get the default podcast feed settings (Thanks steveportigal for bringing to our attention).
435
+ * Fixed bug with WP 4.5 dropping the `rss-http` content type "text/xml".
436
+ * Added shortcode attribute `ids=""` so you can specify post IDs for the playlist player to display exclusively. (Thanks John Haspel for the feature suggestion!)
437
+ * RSS import now sets the blog post content from the iTunes summary if no description or content:encoded was found in the feed. (Thanks @synthtony for letting us know about the situation)
438
+ * RSS import function calls to `mb_stripos()` will fallback to `stripos()` if the PHP mb (Multibyte String) library not available. (Thanks Glen Donohu for bringing to our attention!)
439
+ * Import to podcast category option added.
440
+ * Added audio ac3 and dts to media detection getid3 library (these are not podcast safe formats though we can detect their meta information).
441
+ * Improved logic for setting the iTunes subtitle and iTunes summary from blog post excerpts and blog post content if no custom iTunes summary and/or subtitle is set.
442
+ * Improved feed logic to minimize SQL queries
443
+ * Feed Maximizer option now applies to category podcast only feeds.
444
+ * Renamed "Appearance" settings to "Website" settings
445
+ * Added "Destination" settings for podcast directories and apps
446
+ * You can now select from pages when setting your Subscribe Page.
447
+ * Changed labels for Podcasting SEO guidance to include word "Podcasting" so not to confuse with "Web SEO".
448
+ * Updated Podcasting SEO guidance to reflect how search works in Google Play Music (Thanks Daniel Lewis for confirming what is indexed!)
449
+ * Changed wording for Podcasting SEO guidance with Author field, replaced "slogans" with "nicknames" so it is more clear that we mean slogans for talent on the show.
450
+ * Removed logic to fallback to the HTML5 player for mobile devices. This was only needed when Flash based players were used.
451
+ * Quicktime Embed option for m4a audio removed due to security concerns with Quicktime.
452
+ * SWF embed support dropped.
453
+ * Embed link now toggles embed box when clicked multiple times.
454
+ * ATTENTION: The 1 pixel out audio player will be removed from PowerPress 7.1.
455
+
456
+ = Additional PowerPress Version History =
457
+ Please visit the [PowerPress Version History](http://create.blubrry.com/resources/powerpress/advanced-tools-and-options/powerpress-version-history/) page for history prior to version 6.0.
458
+
459
+ == Upgrade Notice ==
460
+ ATTENTION: The 1 pixel out audio player will be removed from PowerPress 7.1.
461
+
462
+ == Contributors ==
463
+ Angelo Mandato, CIO [Blubrry](http://www.blubrry.com) - Plugin founder, architect and lead developer
464
+
465
+ Pat McSweeny, PHP Developer - Developed initial version (v0.1.0) of plugin
466
+
467
+ Jerry Stephens, [Way of the Geek](http://wayofthegeek.org) - Contributed initial code fix for excerpt bug resolved in v0.6.1, wrote initial code for the 4 new flash players.
468
+
469
+ Darcy Fiander, [Rooty Radio](http://rootyradio.com) - Fixed bug with category links to FeedValidator.org and category title warning when validating category feeds.
470
+
471
+ Joel Haasnoot, [Personal Blog](http://waarisdetrein.nl/joelhaasnoot/) - Developed PodPress archive statistics.
472
+
473
+ Nicolas Bouliane, [Personal Blog](http://nicolasbouliane.com/) - contributed code for `get_the_powerpress_all_players()` function.
474
+
475
+
476
+ == Translators ==
477
+ * Danish translation for v1.0.11+ by [Team Blogos](http://wordpress.blogos.dk/s%C3%B8g-efter-downloads/?did=280) - Latest translation available [here](http://wordpress.blogos.dk/s%C3%B8g-efter-downloads/?did=280)
478
+ * French translation for v1.0.11+ by [Aur�lien Denis](http://wpchannel.com/) - Aur�lien is looking for assistance maintaining the French translation, email wpchannel [at] gmail.com if interested.
479
+ * Simplified Chinese for v1.0.12+ by [webmote](http://codeex.cn) - From webmote: Welcome to use the plugin. Very good! and then hope you to access my site.
480
+ * Italian translation for v2.0.4+ by [Umberto Sartori](http://veneziadoc.net/)
481
+ * Romanian translation for v2.0.4+ by Alexander Ovsov (Web Geek Sciense: http://webhostinggeeks.com/science/)
482
+ * Russian translation for v4.0.5+ by [Igor Mercury](http://www.nightdiary.ru/)
483
+ * Brazilian Portuguese translation for v6.0+ by [Leo Lopes from Radiofobia](http://radiofobia.com.br/)
484
+
485
+
486
+ == Tips and Tutorials ==
487
+ * [Using PowerPress outside the Loop](http://blog.nicolasbouliane.com/?p=1695) - by [Nicolas Bouliane](http://blog.nicolasbouliane.com/)
488
+ * [The PowerPress Podcast](http://www.powerpresspodcast.com/) - by [Blubrry](http://www.blubrry.com/)
489
+
490
+ Please [contact blubrry](http://www.blubrry.com/contact.php) with the link to your tips or tutorial for PowerPress and we'll add them to the list above.
491
+
492
+ == Feedback ==
493
+ [http://create.blubrry.com/resources/powerpress/](http://create.blubrry.com/resources/powerpress/)
494
+
495
+ == Support ==
496
+ [http://create.blubrry.com/support/](http://create.blubrry.com/support/)
497
+
498
+ == Blubrry Social ==
499
+
500
+ [Twitter](https://twitter.com/blubrry) - [Facebook](https://www.facebook.com/blubrry) - [YouTube](https://www.youtube.com/channel/UC9sE1Yz2deZiGAP67xYx9Xg)