PowerPress Podcasting plugin by Blubrry - Version 7.5

Version Description

  • Released on 7/23/2019
  • Added new Apple categories announced in July. The new Apple Categories will be made available on Apple Podcasts mid August, 2019.
  • Added Multi-program Blubrry Podcast Hosting, perfect for Category podcasting.
  • Added Update Google PubSubHubbub, lets Google Podcasts and other podcast directory services when your podcast publishes new episodes.
  • Added support for various languages to podcast as including "Thai" and "Vietnamese".
Download this release

Release Info

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

Code changes from version 7.4.4 to 7.5

css/admin.css CHANGED
@@ -471,4 +471,7 @@ a.pp-expand-section:visited {
471
  background: #0D87E9;
472
  border-color: #0D87E9;
473
  color: #FFFFFF;
 
 
 
474
  }
471
  background: #0D87E9;
472
  border-color: #0D87E9;
473
  color: #FFFFFF;
474
+ }
475
+ .pp-form-error {
476
+ border: red solid 1px;
477
  }
powerpress.php CHANGED
@@ -1,3683 +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.4.4
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.4.4' );
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
-
94
- // Set regular expression values for determining mobile devices
95
- if( !defined('POWERPRESS_MOBILE_REGEX') )
96
- define('POWERPRESS_MOBILE_REGEX', 'iphone|ipod|ipad|aspen|android|blackberry|opera mini|webos|incognito|webmate|silk');
97
-
98
- $powerpress_feed = NULL; // DO NOT CHANGE
99
-
100
- function powerpress_content($content)
101
- {
102
- global $post, $g_powerpress_excerpt_post_id;
103
-
104
- if( defined('PODPRESS_VERSION') || isset($GLOBALS['podcasting_player_id']) || isset($GLOBALS['podcast_channel_active']) || defined('PODCASTING_VERSION') )
105
- return $content;
106
-
107
- if( empty($post->ID) || !is_object($post) )
108
- return $content;
109
-
110
- if( defined('POWERPRESS_DO_ENCLOSE_FIX') )
111
- $content = preg_replace('/\<!--.*added by PowerPress.*-->/im', '', $content );
112
-
113
- if( is_feed() )
114
- return $content; // We don't want to do anything to the feed
115
-
116
- if( function_exists('post_password_required') )
117
- {
118
- if( post_password_required($post) )
119
- return $content;
120
- }
121
-
122
- // PowerPress settings:
123
- $GeneralSettings = get_option('powerpress_general');
124
-
125
- // No player or links to add to content...
126
- if( !empty($GeneralSettings['disable_appearance']) )
127
- return $content;
128
-
129
- // check for themes/plugins where we know we need to do this...
130
- if( empty($GeneralSettings['player_aggressive']) )
131
- {
132
- if( !empty($GLOBALS['fb_ver']) && version_compare($GLOBALS['fb_ver'], '1.0', '<=') ) {
133
- $GeneralSettings['player_aggressive'] = 1;
134
- }
135
- if( defined('JETPACK__VERSION') && version_compare(JETPACK__VERSION, '2.0', '>=') ) {
136
- $GeneralSettings['player_aggressive'] = 1; // Jet pack still doesn't behave with PowerPress the_content
137
- }
138
- if( defined('WPSEO_VERSION') ) {
139
- $GeneralSettings['player_aggressive'] = 4;
140
- }
141
- }
142
-
143
- if( !empty($GeneralSettings['player_aggressive']) )
144
- {
145
- if( $GeneralSettings['player_aggressive'] == 4 )
146
- {
147
- $in_http_head = powerpress_in_wp_head();
148
- if( $in_http_head === true )
149
- return $content;
150
- }
151
- 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
152
- {
153
- if( empty($GLOBALS['powerpress_wp_head_completed']) )
154
- return $content;
155
- }
156
- else // method 1 or 3...
157
- {
158
- if( strstr($content, '<!--powerpress_player-->') !== false )
159
- return $content; // The players were already added to the content
160
-
161
- if( $GeneralSettings['player_aggressive'] != 3 && $g_powerpress_excerpt_post_id > 0 )
162
- $g_powerpress_excerpt_post_id = 0; // Hack, set this to zero so it always goes past...
163
-
164
- if( $GeneralSettings['player_aggressive'] == 3 )
165
- $GeneralSettings['player_aggressive'] = 1; // remainder of the system will function as normal
166
- }
167
- }
168
-
169
- // Problem: If the_excerpt is used instead of the_content, both the_exerpt and the_content will be called here.
170
- // Important to note, get_the_excerpt will be called before the_content is called, so we add a simple little hack
171
- if( current_filter() == 'get_the_excerpt' )
172
- {
173
- $g_powerpress_excerpt_post_id = $post->ID;
174
- return $content; // We don't want to do anything to this content yet...
175
- }
176
- else if( current_filter() == 'the_content' && $g_powerpress_excerpt_post_id == $post->ID )
177
- {
178
- return $content; // We don't want to do anything to this excerpt content in this call either...
179
- }
180
- else if( class_exists('custom_post_widget') && powerpress_in_custom_post_widget() )
181
- {
182
- return $content; // Custom Post Widget compatibility
183
- }
184
-
185
-
186
- if( !isset($GeneralSettings['custom_feeds']) )
187
- $GeneralSettings['custom_feeds'] = array('podcast'=>'Default Podcast Feed');
188
- if( empty($GeneralSettings['custom_feeds']['podcast']) )
189
- $GeneralSettings['custom_feeds']['podcast'] = 'Default Podcast Feed';
190
-
191
- // Re-order so the default podcast episode is the top most...
192
- $Temp = $GeneralSettings['custom_feeds'];
193
- $GeneralSettings['custom_feeds'] = array();
194
- $GeneralSettings['custom_feeds']['podcast'] = 'Default Podcast Feed';
195
- foreach( $Temp as $feed_slug=> $feed_title )
196
- {
197
- if( $feed_slug == 'podcast' )
198
- continue;
199
- $GeneralSettings['custom_feeds'][ $feed_slug ] = $feed_title;
200
- }
201
-
202
- // Handle post type feeds....
203
- if( !empty($GeneralSettings['posttype_podcasting']) )
204
- {
205
- $post_type = get_query_var('post_type');
206
- if ( is_array( $post_type ) ) {
207
- $post_type = reset( $post_type ); // get first element in array
208
- }
209
-
210
- // Get the feed slugs and titles for this post type
211
- $PostTypeSettingsArray = get_option('powerpress_posttype_'.$post_type);
212
- // Loop through this array of post type settings...
213
- if( !empty($PostTypeSettingsArray) )
214
- {
215
- switch($post_type)
216
- {
217
- case 'post':
218
- case 'page': {
219
- // Do nothing!, we want the default podcast to appear in these post types
220
- }; break;
221
- default: {
222
- if( !empty($post_type) && empty($PostTypeSettingsArray['podcast']) )
223
- 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
224
- }; break;
225
- }
226
-
227
- foreach( $PostTypeSettingsArray as $feed_slug=> $postTypeSettings )
228
- {
229
- if( !empty( $postTypeSettings['title']) )
230
- $GeneralSettings['custom_feeds'][ $feed_slug ] = $postTypeSettings['title'];
231
- else
232
- $GeneralSettings['custom_feeds'][ $feed_slug ] = $feed_slug;
233
- }
234
- }
235
- }
236
-
237
- if( !isset($GeneralSettings['display_player']) )
238
- $GeneralSettings['display_player'] = 1;
239
- if( !isset($GeneralSettings['player_function']) )
240
- $GeneralSettings['player_function'] = 1;
241
- if( !isset($GeneralSettings['podcast_link']) )
242
- $GeneralSettings['podcast_link'] = 1;
243
-
244
- // The blog owner doesn't want anything displayed, so don't bother wasting anymore CPU cycles
245
- if( $GeneralSettings['display_player'] == 0 )
246
- return $content;
247
-
248
- if( current_filter() == 'the_excerpt' && empty($GeneralSettings['display_player_excerpt']) )
249
- return $content; // We didn't want to modify this since the user didn't enable it for excerpts
250
-
251
- if( !empty($GeneralSettings['hide_player_more']) && strstr($content, 'class="more-link"') )
252
- return $content; // We do not want to add players and links if the read-more class found
253
-
254
- // Figure out which players are alerady in the body of the page...
255
- $ExcludePlayers = array();
256
- if( isset($GeneralSettings['disable_player']) )
257
- $ExcludePlayers = $GeneralSettings['disable_player']; // automatically disable the players configured
258
-
259
- if( !empty($GeneralSettings['process_podpress']) && strstr($content, '[display_podcast]') )
260
- return $content;
261
-
262
- if( preg_match_all('/(.?)\[(powerpress)\b(.*?)(?:(\/))?\](?:(.+?)\[\/\2\])?(.?)/s', $content, $matches) )
263
- {
264
- if( isset($matches[3]) )
265
- {
266
- foreach( $matches[3] as $key=> $row )
267
- {
268
- $attributes = shortcode_parse_atts($row);
269
- if( isset($attributes['url']) )
270
- {
271
- // not a problem...
272
- }
273
- else if( isset($attributes['feed']) )
274
- {
275
- // we want to exclude this feed from the links aera...
276
- $ExcludePlayers[ $attributes['feed'] ] = true;
277
- }
278
- else
279
- {
280
- // we don't want to include any players below...
281
- $ExcludePlayers = $GeneralSettings['custom_feeds'];
282
- }
283
- }
284
- }
285
- }
286
-
287
- // LOOP HERE TO DISPLAY EACH MEDIA TYPE
288
- $new_content = '';
289
- foreach( $GeneralSettings['custom_feeds'] as $feed_slug=> $feed_title )
290
- {
291
- // Get the enclosure data
292
- $EpisodeData = powerpress_get_enclosure_data($post->ID, $feed_slug);
293
-
294
- if( !$EpisodeData && !empty($GeneralSettings['process_podpress']) && $feed_slug == 'podcast' )
295
- $EpisodeData = powerpress_get_enclosure_data_podpress($post->ID);
296
-
297
- if( !$EpisodeData || !$EpisodeData['url'] )
298
- continue;
299
-
300
- // Just in case, if there's no URL lets escape!
301
- if( !$EpisodeData['url'] )
302
- continue;
303
-
304
- // If the player is not already inserted in the body of the post using the shortcode...
305
- //if( preg_match('/\[powerpress(.*)\]/is', $content) == 0 )
306
- if( !isset($ExcludePlayers[ $feed_slug ]) ) // If the player is not in our exclude list because it's already in the post body somewhere...
307
- {
308
- if( isset($GeneralSettings['premium_caps']) && $GeneralSettings['premium_caps'] && !powerpress_premium_content_authorized($feed_slug) )
309
- {
310
- $new_content .= powerpress_premium_content_message($post->ID, $feed_slug, $EpisodeData);
311
- }
312
- else
313
- {
314
- if( $GeneralSettings['player_function'] != 3 && $GeneralSettings['player_function'] != 0 ) // Play in new window only or disabled
315
- {
316
- do_action('wp_powerpress_player_scripts');
317
- $AddDefaultPlayer = empty($EpisodeData['no_player']);
318
-
319
- if( $EpisodeData && !empty($EpisodeData['embed']) )
320
- {
321
- $new_content .= trim($EpisodeData['embed']);
322
- if( !empty($GeneralSettings['embed_replace_player']) )
323
- $AddDefaultPlayer = false;
324
- }
325
-
326
- if( $AddDefaultPlayer )
327
- {
328
- $image = '';
329
- if( isset($EpisodeData['image']) && $EpisodeData['image'] != '' )
330
- $image = $EpisodeData['image'];
331
-
332
- $new_content .= apply_filters('powerpress_player', '', powerpress_add_flag_to_redirect_url($EpisodeData['url'], 'p'), $EpisodeData );
333
- }
334
- }
335
-
336
- if( !isset($EpisodeData['no_links']) ) {
337
- do_action('wp_powerpress_player_scripts');
338
- $new_content .= apply_filters('powerpress_player_links', '', powerpress_add_flag_to_redirect_url($EpisodeData['url'], 'p'), $EpisodeData );
339
- $new_content .= apply_filters('powerpress_player_subscribe_links', '', powerpress_add_flag_to_redirect_url($EpisodeData['url'], 'p'), $EpisodeData );
340
- }
341
- }
342
- }
343
- }
344
-
345
- if( $new_content == '' )
346
- return $content;
347
-
348
- switch( $GeneralSettings['display_player'] )
349
- {
350
- case 1: { // Below posts
351
- return $content.$new_content.( !empty($GeneralSettings['player_aggressive']) && $GeneralSettings['player_aggressive'] == 1 ?'<!--powerpress_player-->':'');
352
- }; break;
353
- case 2: { // Above posts
354
- return ( !empty($GeneralSettings['player_aggressive']) && $GeneralSettings['player_aggressive'] == 1 ?'<!--powerpress_player-->':'').$new_content.$content;
355
- }; break;
356
- }
357
- return $content;
358
- }//end function
359
-
360
-
361
- add_filter('get_the_excerpt', 'powerpress_content', (POWERPRESS_CONTENT_ACTION_PRIORITY - 1) );
362
- add_filter('the_content', 'powerpress_content', POWERPRESS_CONTENT_ACTION_PRIORITY);
363
- if( !defined('POWERPRESS_NO_THE_EXCERPT') )
364
- add_filter('the_excerpt', 'powerpress_content', POWERPRESS_CONTENT_ACTION_PRIORITY);
365
-
366
-
367
- /* Specail case fix Yoast bug which messes up the HTML */
368
- function powerpress_yoast_gawp_fix($content)
369
- {
370
- $content= preg_replace(
371
- array('/return powerpress\_pinw\(\"/', '/return powerpress\_embed\_winplayer\(\"/', '/return powerpress\_show\_embed\(\"/', '/return powerpress\_embed\_html5v\(\"/', '/return powerpress\_embed\_html5a\(\"/', ),
372
- array('return powerpress_pinw(\'', 'return powerpress_embed_winplayer(\'', 'return powerpress_show_embed(\'', 'return powerpress_embed_html5v(\'', 'return powerpress_embed_html5a(\'' ),
373
- $content);
374
-
375
- return $content;
376
- }
377
-
378
- function powerpress_header()
379
- {
380
- // PowerPress settings:
381
- $Powerpress = get_option('powerpress_general');
382
- if( !isset($Powerpress['custom_feeds']) )
383
- $Powerpress['custom_feeds'] = array('podcast'=>'Default Podcast Feed');
384
-
385
- if( empty($Powerpress['disable_appearance']) || $Powerpress['disable_appearance'] == false )
386
- {
387
- if( !isset($Powerpress['player_function']) || $Powerpress['player_function'] > 0 ) // Don't include the player in the header if it is not needed...
388
- {
389
- $PowerpressPluginURL = powerpress_get_root_url();
390
- ?>
391
- <script type="text/javascript"><!--
392
- <?php
393
- $new_window_width = 420;
394
- $new_window_height = 240;
395
-
396
- if( isset($Powerpress['new_window_width']) && $Powerpress['new_window_width'] > 0 )
397
- $new_window_width = $Powerpress['new_window_width'];
398
- else if( isset($Powerpress['new_window_width']) )
399
- $new_window_width = 420;
400
-
401
- if( isset($Powerpress['new_window_height']) && $Powerpress['new_window_height'] > 0 )
402
- $new_window_height = $Powerpress['new_window_height'];
403
- else if( isset($Powerpress['new_window_height']) )
404
- $new_window_height = 240;
405
-
406
- if( empty($Powerpress['new_window_nofactor']) )
407
- {
408
- $new_window_width += 40;
409
- $new_window_height += 80;
410
- }
411
-
412
- ?>
413
- 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;}
414
- //-->
415
- </script>
416
- <?php
417
- }
418
- }
419
-
420
- if( !empty($Powerpress['feed_links']) )
421
- {
422
- if( is_home() ) {
423
- $feed_slug = 'podcast';
424
- $href = get_feed_link($feed_slug);
425
- // Podcast default and channel feed settings
426
- $Settings = get_option('powerpress_feed_'. $feed_slug);
427
-
428
- if( empty($Settings) && $feed_slug == 'podcast' )
429
- $Settings = get_option('powerpress_feed'); // Get the main feed settings
430
-
431
- if( empty($Settings['title']) )
432
- $Settings['title'] = get_bloginfo_rss('name'); // Get blog title
433
-
434
- // Get the default podcast feed...
435
- echo '<link rel="alternate" type="' . feed_content_type() . '" title="' . esc_attr( $Settings['title'] ) . '" href="' . esc_url( $href ) . '" />' . "\n";
436
- } else if( is_category() ) {
437
-
438
- $category_id = get_query_var('cat');
439
- if( $category_id ) {
440
- $Settings = get_option('powerpress_cat_feed_'.$category_id );
441
- if( empty($Settings['title']) ) {
442
- $Settings['title'] = get_cat_name( $category_id ); // Get category title
443
- $Settings['title'] .= ' '. apply_filters( 'document_title_separator', '-' ) .' ';
444
- $Settings['title'] .= get_bloginfo_rss('name');
445
- }
446
- if( empty($Settings['title']) ) {
447
- $Settings['title'] = get_bloginfo_rss('name'); // Get blog title, best we can do
448
- }
449
-
450
- if( !empty($Settings['feed_redirect_url']) )
451
- $Settings['feed_url'] = $Settings['feed_redirect_url'];
452
- else if( !empty($General['cat_casting_podcast_feeds']) )
453
- $Settings['feed_url'] = get_category_feed_link($category_id, 'podcast');
454
- else
455
- $Settings['feed_url'] = get_category_feed_link( $category_id ); // Get category feed URL
456
-
457
- // Get the category podcast feed...
458
- echo '<link rel="alternate" type="' . feed_content_type() . '" title="' . esc_attr( $Settings['title'] ) . '" href="' . esc_url( $Settings['feed_url'] ) . '" />' . "\n";
459
- }
460
- }
461
- }
462
- }
463
-
464
- add_action('wp_head', 'powerpress_header');
465
-
466
- function powerpress_wp_head_completed()
467
- {
468
- $GLOBALS['powerpress_wp_head_completed'] = true;
469
- }
470
-
471
- add_action('wp_head', 'powerpress_wp_head_completed', 100000);
472
-
473
- function powerpress_exit_on_http_head($return)
474
- {
475
- if( is_feed() )
476
- {
477
- // Set the content type for HTTP headers...
478
- header('Content-Type: ' . feed_content_type('rss-http') . '; charset=' . get_option('blog_charset'), true);
479
-
480
- // Needs authentication?
481
- $GeneralSettings = get_option('powerpress_general');
482
- if( !empty($GeneralSettings['premium_caps']) )
483
- {
484
- $feed_slug = get_query_var('feed');
485
- $FeedSettings = get_option('powerpress_feed_'.$feed_slug);
486
- if( !empty($FeedSettings['premium']) )
487
- {
488
- return false; // Let the logic further into PowerPress authenticate this HEAD request
489
- }
490
- }
491
- }
492
- return $return;
493
- }
494
-
495
- add_filter('exit_on_http_head', 'powerpress_exit_on_http_head' );
496
-
497
- function powerpress_rss2_ns()
498
- {
499
- if( !powerpress_is_podcast_feed() )
500
- return;
501
-
502
- // Okay, lets add the namespace
503
- echo 'xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd"'.PHP_EOL;
504
- if( !defined('POWERPRESS_RAWVOICE_RSS') || POWERPRESS_RAWVOICE_RSS != false )
505
- {
506
- echo 'xmlns:rawvoice="http://www.rawvoice.com/rawvoiceRssModule/"'.PHP_EOL;
507
- }
508
- if( !defined('POWERPRESS_GOOGLEPLAY_RSS') || POWERPRESS_GOOGLEPLAY_RSS != false )
509
- {
510
- echo 'xmlns:googleplay="http://www.google.com/schemas/play-podcasts/1.0"'.PHP_EOL;
511
- //echo 'xmlns:googleplay="http://www.google.com/schemas/play-podcasts/1.0/play-podcasts.xsd"'.PHP_EOL;
512
- }
513
- }
514
-
515
- add_action('rss2_ns', 'powerpress_rss2_ns');
516
- add_action('rss2_ns_powerpress', 'powerpress_rss2_ns');
517
-
518
- function powerpress_rss2_head()
519
- {
520
- global $powerpress_feed;
521
-
522
- if( !powerpress_is_podcast_feed() )
523
- return; // Not a feed we manage
524
-
525
- $feed_slug = get_query_var( 'feed' );
526
- $cat_ID = get_query_var('cat');
527
-
528
- $Feed = get_option('powerpress_feed'); // Get the main feed settings
529
- if( !empty($powerpress_feed['category']) )
530
- {
531
- $CustomFeed = get_option('powerpress_cat_feed_'.$powerpress_feed['category']); // Get the custom podcast feed settings saved in the database
532
- if( $CustomFeed )
533
- $Feed = powerpress_merge_empty_feed_settings($CustomFeed, $Feed);
534
- }
535
- else if( !empty($powerpress_feed['term_taxonomy_id']) )
536
- {
537
- $CustomFeed = get_option('powerpress_taxonomy_'.$powerpress_feed['term_taxonomy_id']); // Get the taxonomy podcast settings saved in the database
538
- if( $CustomFeed )
539
- $Feed = powerpress_merge_empty_feed_settings($CustomFeed, $Feed);
540
- }
541
- else if( !empty($powerpress_feed['post_type']) )
542
- {
543
- $PostTypeSettingsArray = get_option('powerpress_posttype_'.$powerpress_feed['post_type']); // Get the post type podcast feed settings saved in the database
544
- if( !empty($PostTypeSettingsArray[ $feed_slug ]) )
545
- {
546
- $CustomFeed = $PostTypeSettingsArray[ $feed_slug ];
547
- $Feed = powerpress_merge_empty_feed_settings($CustomFeed, $Feed, ($feed_slug == 'podcast') );
548
- }
549
- }
550
- else if( powerpress_is_custom_podcast_feed() ) // If we're handling a custom podcast feed...
551
- {
552
- $CustomFeed = get_option('powerpress_feed_'.$feed_slug); // Get the custom podcast feed settings saved in the database
553
- $Feed = powerpress_merge_empty_feed_settings($CustomFeed, $Feed, ($feed_slug == 'podcast') );
554
- }
555
-
556
- if( !isset($Feed['url']) || trim($Feed['url']) == '' )
557
- {
558
- if( is_category() )
559
- $Feed['url'] = get_category_link($cat_ID);
560
- else {
561
-
562
- $blogHomepage = get_option('page_for_posts');
563
- if( !empty($blogHomepage) ) {
564
- $Feed['url'] = get_permalink( $blogHomepage );
565
- }
566
-
567
- if( empty($Feed['url']) )
568
- $Feed['url'] = get_bloginfo('url');
569
- }
570
- }
571
-
572
- $General = get_option('powerpress_general');
573
-
574
- // We made it this far, lets write stuff to the feed!
575
- echo '<!-- podcast_generator="Blubrry PowerPress/'. POWERPRESS_VERSION .'" ';
576
- if( isset($General['advanced_mode_2']) && empty($General['advanced_mode_2']) )
577
- echo 'mode="simple" ';
578
- else
579
- echo 'mode="advanced" ';
580
- // Additional info for diagnostics
581
- if( !empty($powerpress_feed['category']) )
582
- echo 'category="'.$powerpress_feed['category'].'" ';
583
- if( !empty($powerpress_feed['term_taxonomy_id']) )
584
- echo 'ttid="'.$powerpress_feed['term_taxonomy_id'].'" ';
585
- if( !empty($powerpress_feed['post_type']) )
586
- echo 'posttype="'.$powerpress_feed['post_type'].'" ';
587
- if( !empty($powerpress_feed['feed-slug']) )
588
- echo 'feedslug="'.$powerpress_feed['feed-slug'].'" ';
589
-
590
- $feedComment = apply_filters('powerpress_feed_comment', '');
591
- $feedComment = str_replace( array('<!--', '-->'), array('|!~~', '~~>'), $feedComment);
592
- $feedComment = trim($feedComment);
593
- if( !empty($feedComment) )
594
- echo $feedComment.' ';
595
-
596
- echo 'Blubrry PowerPress Podcasting plugin for WordPress (https://www.blubrry.com/powerpress/) -->'.PHP_EOL;
597
-
598
- // add the itunes:new-feed-url tag to feed
599
- if( powerpress_is_custom_podcast_feed() )
600
- {
601
- if( !empty($Feed['itunes_new_feed_url']) )
602
- {
603
- $Feed['itunes_new_feed_url'] = str_replace('&amp;', '&', $Feed['itunes_new_feed_url']);
604
- echo "\t<itunes:new-feed-url>". htmlspecialchars(trim($Feed['itunes_new_feed_url'])) .'</itunes:new-feed-url>'.PHP_EOL;
605
- }
606
- }
607
- 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
608
- {
609
- $Feed['itunes_new_feed_url'] = str_replace('&amp;', '&', $Feed['itunes_new_feed_url']);
610
- echo "\t<itunes:new-feed-url>". htmlspecialchars(trim($Feed['itunes_new_feed_url'])) .'</itunes:new-feed-url>'.PHP_EOL;
611
- }
612
-
613
- if( !empty($General['itunes_cdata']) ) {
614
- if( !empty($Feed['itunes_summary']) )
615
- echo "\t".'<itunes:summary><![CDATA['. powerpress_format_itunes_value( $Feed['itunes_summary'], 'summary', true ) .']]></itunes:summary>'.PHP_EOL;
616
- else
617
- echo "\t".'<itunes:summary><![CDATA['. powerpress_format_itunes_value( get_bloginfo('description'), 'summary', true ) .']]></itunes:summary>'.PHP_EOL;
618
- } else {
619
- if( !empty($Feed['itunes_summary']) )
620
- echo "\t".'<itunes:summary>'. powerpress_format_itunes_value( $Feed['itunes_summary'], 'summary' ) .'</itunes:summary>'.PHP_EOL;
621
- else
622
- echo "\t".'<itunes:summary>'. powerpress_format_itunes_value( get_bloginfo('description'), 'summary' ) .'</itunes:summary>'.PHP_EOL;
623
- }
624
-
625
- if( !empty($powerpress_feed['itunes_talent_name']) )
626
- echo "\t<itunes:author>" . esc_html($powerpress_feed['itunes_talent_name']) . '</itunes:author>'.PHP_EOL;
627
-
628
- if( !empty($powerpress_feed['explicit']) && $powerpress_feed['explicit'] != 'no' )
629
- echo "\t".'<itunes:explicit>' . $powerpress_feed['explicit'] . '</itunes:explicit>'.PHP_EOL;
630
-
631
- if( !empty($Feed['itunes_block']) )
632
- echo "\t<itunes:block>yes</itunes:block>".PHP_EOL;
633
-
634
- if( !empty($Feed['itunes_complete']) )
635
- echo "\t<itunes:complete>yes</itunes:complete>".PHP_EOL;
636
-
637
- if( !empty($Feed['itunes_image']) )
638
- {
639
- echo "\t".'<itunes:image href="' . esc_html( powerpress_url_in_feed(str_replace(' ', '+', $Feed['itunes_image'])), 'double') . '" />'.PHP_EOL;
640
- }
641
- else
642
- {
643
- echo "\t".'<itunes:image href="' . powerpress_url_in_feed(powerpress_get_root_url()) . 'itunes_default.jpg" />'.PHP_EOL;
644
- }
645
-
646
- if( !empty($Feed['itunes_type']) ) {
647
- echo "\t".'<itunes:type>'. esc_html($Feed['itunes_type']) .'</itunes:type>'.PHP_EOL;
648
- }
649
-
650
- if( !empty($Feed['email']) )
651
- {
652
- echo "\t".'<itunes:owner>'.PHP_EOL;
653
- echo "\t\t".'<itunes:name>' . esc_html($powerpress_feed['itunes_talent_name']) . '</itunes:name>'.PHP_EOL;
654
- echo "\t\t".'<itunes:email>' . esc_html($Feed['email']) . '</itunes:email>'.PHP_EOL;
655
- echo "\t".'</itunes:owner>'.PHP_EOL;
656
- echo "\t".'<managingEditor>'. esc_html($Feed['email'] .' ('. $powerpress_feed['itunes_talent_name'] .')') .'</managingEditor>'.PHP_EOL;
657
- }
658
-
659
- if( !empty($Feed['copyright']) )
660
- {
661
- // In case the user entered the copyright html version or the copyright UTF-8 or ASCII symbol or just (c)
662
- $Feed['copyright'] = str_replace(array('&copy;', '(c)', '(C)', chr(194) . chr(169), chr(169) ), '&#xA9;', $Feed['copyright']);
663
- echo "\t".'<copyright>'. esc_html($Feed['copyright']) . '</copyright>'.PHP_EOL;
664
- }
665
-
666
- if( !empty($Feed['itunes_subtitle']) )
667
- echo "\t".'<itunes:subtitle>' . powerpress_format_itunes_value($Feed['itunes_subtitle'], 'subtitle') . '</itunes:subtitle>'.PHP_EOL;
668
- else
669
- echo "\t".'<itunes:subtitle>'. powerpress_format_itunes_value( get_bloginfo('description'), 'subtitle') .'</itunes:subtitle>'.PHP_EOL;
670
- $podcast_title_safe = '';
671
- if( version_compare($GLOBALS['wp_version'], 4.4, '<' ) ) {
672
- $podcast_title_safe .= get_bloginfo_rss('name');
673
- }
674
- $podcast_title_safe .= get_wp_title_rss();
675
- if( empty($General['disable_rss_image']) )
676
- {
677
- if( !empty($Feed['rss2_image']) || !empty($Feed['itunes_image']) )
678
- {
679
- if( !empty($Feed['rss2_image']) ) // If the RSS image is set, use it, otherwise use the iTunes image...
680
- $rss_image = $Feed['rss2_image'];
681
- else
682
- $rss_image = $Feed['itunes_image'];
683
-
684
- echo "\t". '<image>' .PHP_EOL;
685
- echo "\t\t".'<title>' . $podcast_title_safe . '</title>'.PHP_EOL;
686
- echo "\t\t".'<url>' . esc_html( str_replace(' ', '+', $rss_image)) . '</url>'.PHP_EOL;
687
- echo "\t\t".'<link>'. $Feed['url'] . '</link>' . PHP_EOL;
688
- echo "\t".'</image>' . PHP_EOL;
689
- }
690
- else // Use the default image
691
- {
692
- echo "\t". '<image>' .PHP_EOL;
693
- echo "\t\t".'<title>' . $podcast_title_safe . '</title>'.PHP_EOL;
694
- echo "\t\t".'<url>' . powerpress_get_root_url() . 'rss_default.jpg</url>'.PHP_EOL;
695
- echo "\t\t".'<link>'. $Feed['url'] . '</link>' . PHP_EOL;
696
- echo "\t".'</image>' . PHP_EOL;
697
- }
698
- }
699
-
700
- // Handle iTunes categories
701
- $Categories = powerpress_itunes_categories();
702
- $Cat1 = false; $Cat2 = false; $Cat3 = false;
703
- if( !empty($Feed['itunes_cat_1']) )
704
- list($Cat1, $SubCat1) = explode('-', $Feed['itunes_cat_1']);
705
- if( !empty($Feed['itunes_cat_2']) )
706
- list($Cat2, $SubCat2) = explode('-', $Feed['itunes_cat_2']);
707
- if( !empty($Feed['itunes_cat_3']) )
708
- list($Cat3, $SubCat3) = explode('-', $Feed['itunes_cat_3']);
709
-
710
- if( $Cat1 )
711
- {
712
- $CatDesc = $Categories[$Cat1.'-00'];
713
- $SubCatDesc = $Categories[$Cat1.'-'.$SubCat1];
714
- echo "\t".'<itunes:category text="'. esc_html($CatDesc) .'">'.PHP_EOL;
715
- if( $SubCat1 != '00' )
716
- echo "\t\t".'<itunes:category text="'. esc_html($SubCatDesc) .'"></itunes:category>'.PHP_EOL;
717
-
718
- // End this category set
719
- echo "\t".'</itunes:category>'.PHP_EOL;
720
- }
721
-
722
- if( $Cat2 )
723
- {
724
- $CatDesc = $Categories[$Cat2.'-00'];
725
- $SubCatDesc = $Categories[$Cat2.'-'.$SubCat2];
726
-
727
- echo "\t".'<itunes:category text="'. esc_html($CatDesc) .'">'.PHP_EOL;
728
- if( $SubCat2 != '00' )
729
- echo "\t\t".'<itunes:category text="'. esc_html($SubCatDesc) .'"></itunes:category>'.PHP_EOL;
730
- echo "\t".'</itunes:category>'.PHP_EOL;
731
- }
732
-
733
- if( $Cat3 )
734
- {
735
- $CatDesc = $Categories[$Cat3.'-00'];
736
- $SubCatDesc = $Categories[$Cat3.'-'.$SubCat3];
737
-
738
- echo "\t".'<itunes:category text="'. esc_html($CatDesc) .'">'.PHP_EOL;
739
- if( $SubCat3 != '00' )
740
- echo "\t\t".'<itunes:category text="'. esc_html($SubCatDesc) .'"></itunes:category>'.PHP_EOL;
741
- // End this category set
742
- echo "\t".'</itunes:category>'.PHP_EOL;
743
- }
744
- // End Handle iTunes categories
745
-
746
- if( !empty($Feed['googleplay_email']) )
747
- {
748
- echo "\t".'<googleplay:email>' . esc_html($Feed['googleplay_email']) . '</googleplay:email>'.PHP_EOL;
749
- }
750
-
751
- if( !empty($Feed['googleplay_description']) )
752
- {
753
- echo "\t".'<googleplay:description>' . esc_html($Feed['googleplay_description']) . '</googleplay:description>'.PHP_EOL;
754
- }
755
-
756
- if( !empty($Feed['googleplay_explicit']) )
757
- {
758
- echo "\t".'<googleplay:explicit>Yes</googleplay:explicit>'.PHP_EOL;
759
- }
760
-
761
- // google_play_cat // google_play_explicit
762
- if( !empty($Feed['googleplay_cat']) )
763
- {
764
- $play_cats = powerpress_googleplay_categories();
765
- if( !empty($play_cats[ $Feed['googleplay_cat'] ]) )
766
- {
767
- echo "\t".'<googleplay:category text="'. esc_html($play_cats[ $Feed['googleplay_cat'] ]) .'" />'.PHP_EOL;
768
- }
769
- }
770
-
771
- if( !empty($Feed['googleplay_image']) )
772
- {
773
- echo "\t".'<googleplay:image href="' . esc_html( str_replace(' ', '+', $Feed['googleplay_image']), 'double') . '" />'.PHP_EOL;
774
- }
775
-
776
- // RawVoice RSS Tags
777
- if( !defined('POWERPRESS_RAWVOICE_RSS') || POWERPRESS_RAWVOICE_RSS != false )
778
- {
779
- if( !empty($Feed['parental_rating']) )
780
- echo "\t<rawvoice:rating>". $Feed['parental_rating'] ."</rawvoice:rating>".PHP_EOL;
781
- if( !empty($Feed['location']) )
782
- echo "\t<rawvoice:location>". htmlspecialchars($Feed['location']) ."</rawvoice:location>".PHP_EOL;
783
- if( !empty($Feed['frequency']) )
784
- echo "\t<rawvoice:frequency>". htmlspecialchars($Feed['frequency']) ."</rawvoice:frequency>".PHP_EOL;
785
- if( !empty($Feed['donate_link']) && !empty($Feed['donate_url']) )
786
- echo "\t<rawvoice:donate href=\"". htmlspecialchars( $Feed['donate_url'] ) ."\">". htmlspecialchars( (empty($Feed['donate_label'])?'':$Feed['donate_label']) ) ."</rawvoice:donate>".PHP_EOL;
787
-
788
- if( !empty($Feed['itunes_url']) || !empty($Feed['blubrry_url']) || !empty($Feed['stitcher_url']) || !empty($Feed['tunein_url']) || !empty($Feed['spotify_url']) ) {
789
- echo "\t<rawvoice:subscribe feed=\"";
790
- self_link();
791
- echo '"';
792
-
793
- // Subscribe page // empty($FeedSettings['subscribe_page_link_href']) && empty($FeedSettings['subscribe_page_link_id'])
794
- if( !empty($Feed['subscribe_page_link_id']) ) {
795
- $link = get_page_link($Feed['subscribe_page_link_id']);
796
- if( !empty($link) ) {
797
- echo " html=\"". htmlspecialchars( $link ) .'"';
798
- }
799
- } else if( !empty($Feed['subscribe_page_link_href']) ) {
800
- echo " html=\"". htmlspecialchars( $Feed['subscribe_page_link_href'] ) .'"';
801
- }
802
-
803
- if( !empty($Feed['itunes_url']) )
804
- echo " itunes=\"". htmlspecialchars( $Feed['itunes_url'] ) .'"';
805
- if( !empty($Feed['blubrry_url']) )
806
- echo " blubrry=\"". htmlspecialchars( $Feed['blubrry_url'] ) .'"';
807
- if( !empty($Feed['stitcher_url']) )
808
- echo " stitcher=\"". htmlspecialchars( $Feed['stitcher_url'] ) .'"';
809
- if( !empty($Feed['tunein_url']) )
810
- echo " tunein=\"". htmlspecialchars( $Feed['tunein_url'] ) .'"';
811
- if( !empty($Feed['spotify_url']) )
812
- echo " spotify=\"". htmlspecialchars( $Feed['spotify_url'] ) .'"';
813
- echo "></rawvoice:subscribe>".PHP_EOL;
814
- }
815
- }
816
- }
817
-
818
- add_action('rss2_head', 'powerpress_rss2_head');
819
- add_action('rss2_head_powerpress', 'powerpress_rss2_head');
820
-
821
- function powerpress_rss2_item()
822
- {
823
- global $post, $powerpress_feed;
824
-
825
- // are we processing a feed that powerpress should handle
826
- if( !powerpress_is_podcast_feed() )
827
- return;
828
-
829
- if( function_exists('post_password_required') )
830
- {
831
- if( post_password_required($post) )
832
- return;
833
- }
834
-
835
- // Check and see if we're working with a podcast episode
836
- $custom_enclosure = false;
837
- if( powerpress_is_custom_podcast_feed() && get_query_var('feed') !== 'podcast' && !is_category() && !is_tax() && !is_tag() )
838
- {
839
- $EpisodeData = powerpress_get_enclosure_data($post->ID, get_query_var('feed') );
840
- $custom_enclosure = true;
841
- }
842
- else
843
- {
844
- $EpisodeData = powerpress_get_enclosure_data($post->ID, 'podcast');
845
- if( !$EpisodeData && !empty($powerpress_feed['process_podpress']) )
846
- {
847
- $EpisodeData = powerpress_get_enclosure_data_podpress($post->ID);
848
- $custom_enclosure = true;
849
- }
850
- }
851
-
852
- // No episode data to include
853
- if( empty($EpisodeData) || empty($EpisodeData['url']) )
854
- return;
855
-
856
- // If enclosure not added, check to see why...
857
- if( defined('POWERPRESS_ENCLOSURE_FIX') && POWERPRESS_ENCLOSURE_FIX && !$custom_enclosure && $GLOBALS['powerpress_rss_enclosure_post_id'] != $post->ID )
858
- {
859
- $enclosure_in_wp = apply_filters('rss_enclosure', '<enclosure url="' . trim(htmlspecialchars($EpisodeData['url']) . '" length="' . $EpisodeData['size'] . '" type="' . $EpisodeData['type'] . '" />' . "\n") );
860
- if( !$enclosure_in_wp )
861
- $custom_enclosure = true;
862
- }
863
-
864
- // Lets print the enclosure tag
865
- if( $custom_enclosure ) // We need to add the enclosure tag here...
866
- {
867
- if( empty($EpisodeData['size']) )
868
- $EpisodeData['size'] = 5242880; // Use the dummy 5MB size since we don't have a size to quote
869
-
870
- echo "\t". sprintf('<enclosure url="%s" length="%d" type="%s" />%s',
871
- powerpress_url_in_feed(trim($EpisodeData['url'])),
872
- trim($EpisodeData['size']),
873
- trim($EpisodeData['type']),
874
- PHP_EOL);
875
- }
876
-
877
- $author = $powerpress_feed['itunes_talent_name'];
878
- if( isset($powerpress_feed['itunes_author_post']) )
879
- $author = get_the_author();
880
-
881
- $explicit = $powerpress_feed['explicit'];
882
- $summary = '';
883
- $subtitle = '';
884
- $block = false;
885
- $cc = false;
886
-
887
- if( isset( $EpisodeData['summary'] ) && strlen($EpisodeData['summary']) > 1 )
888
- $summary = $EpisodeData['summary'];
889
- if( isset( $EpisodeData['subtitle'] ) && strlen($EpisodeData['subtitle']) > 1 )
890
- $subtitle = $EpisodeData['subtitle'];
891
- if( isset( $EpisodeData['explicit'] ) && is_numeric($EpisodeData['explicit']) )
892
- {
893
- $explicit_array = array("no", "yes", "clean");
894
- $explicit = $explicit_array[$EpisodeData['explicit']];
895
- }
896
-
897
- if( !empty( $EpisodeData['author'] ) )
898
- $author = $EpisodeData['author'];
899
- if( !empty( $EpisodeData['block'] ) )
900
- $block = 'yes';
901
- if( !empty( $EpisodeData['cc'] ) )
902
- $cc = 'yes';
903
-
904
- $General = get_option('powerpress_general');
905
- $summary_cdata = ( !empty( $General['itunes_cdata'] ) ? true : false );
906
-
907
- if( empty($subtitle) ) {
908
- $subtitle = powerpress_get_the_exerpt( false, !empty($General['feed_action_hook']) );
909
- }
910
-
911
- // If no summary specified and we have enhanced summary enabled...
912
- if( empty($summary) && !empty($powerpress_feed['enhance_itunes_summary']) ) {
913
- $summary = powerpress_enhanced_itunes_summary( !empty($General['feed_action_hook']) );
914
- if( !empty($summary) ) {
915
- $summary_cdata = true; // Always use CDATA for enhanced iTunes summary
916
- }
917
- }
918
-
919
- if( empty($summary) ) { // Backwards compatibility with PodPress, the excerpt is used as the itunes summary if set
920
- $summary = powerpress_get_the_exerpt( true, !empty($General['feed_action_hook']) ); // Will call powerpress_get_the_content(true) if the excerpt does not exist
921
- }
922
-
923
- if( !empty($subtitle) ) {
924
- echo "\t<itunes:subtitle>". powerpress_format_itunes_value($subtitle, 'subtitle') .'</itunes:subtitle>'.PHP_EOL;
925
- }
926
-
927
- if( !empty($summary) ) {
928
- if( $summary_cdata ) {
929
- echo "\t\t<itunes:summary><![CDATA[". powerpress_format_itunes_value($summary, 'summary', true) .']]></itunes:summary>'.PHP_EOL;
930
- } else {
931
- echo "\t\t<itunes:summary>". powerpress_format_itunes_value($summary, 'summary') .'</itunes:summary>'.PHP_EOL;
932
- }
933
- }
934
-
935
- if( !empty($author) ) {
936
- echo "\t\t<itunes:author>" . esc_html($author) . '</itunes:author>'.PHP_EOL;
937
- }
938
-
939
- // itunes episode image
940
- if( !empty( $EpisodeData['itunes_image']) ) {
941
- echo "\t\t".'<itunes:image href="' . esc_html( powerpress_url_in_feed(str_replace(' ', '+', $EpisodeData['itunes_image'])), 'double') . '" />'.PHP_EOL;
942
- } else if( !empty($powerpress_feed['itunes_image']) ) {
943
- echo "\t\t".'<itunes:image href="' . esc_html( powerpress_url_in_feed(str_replace(' ', '+', $powerpress_feed['itunes_image'])), 'double') . '" />'.PHP_EOL;
944
- }
945
-
946
- if( !empty($EpisodeData['season']) ) {
947
- echo "\t\t".'<itunes:season>'. esc_html($EpisodeData['season']) .'</itunes:season>'.PHP_EOL;
948
- }
949
-
950
- if( !empty($EpisodeData['episode_no']) ) {
951
- echo "\t\t".'<itunes:episode>'. esc_html($EpisodeData['episode_no']) .'</itunes:episode>'.PHP_EOL;
952
- }
953
-
954
- if( !empty($EpisodeData['episode_title']) ) {
955
- echo "\t\t".'<itunes:title>'. esc_html($EpisodeData['episode_title']) .'</itunes:title>'.PHP_EOL;
956
- }
957
-
958
- if( !empty($EpisodeData['episode_type']) ) {
959
- echo "\t\t".'<itunes:episodeType>'. esc_html($EpisodeData['episode_type']) .'</itunes:episodeType>'.PHP_EOL;
960
- }
961
-
962
- if( !empty($explicit) && $explicit != 'no' ) {
963
- echo "\t\t<itunes:explicit>" . $explicit . '</itunes:explicit>'.PHP_EOL;
964
- }
965
-
966
- 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
967
- echo "\t\t<itunes:duration>" . ltrim($EpisodeData['duration'], '0:') . '</itunes:duration>'.PHP_EOL;
968
- }
969
-
970
- if( $block && $block == 'yes' ) {
971
- echo "\t\t<itunes:block>yes</itunes:block>".PHP_EOL;
972
- }
973
-
974
- if( $cc && $cc == 'yes' ) {
975
- echo "\t\t<itunes:isClosedCaptioned>yes</itunes:isClosedCaptioned>".PHP_EOL;
976
- }
977
-
978
- if( !empty($powerpress_feed['itunes_feature']) ) { // We are using the itunes:order option to feature a specific episode.
979
- // Skip inserting the order tag
980
- } else {
981
- if( isset( $EpisodeData['order'] ) && is_numeric( $EpisodeData['order'] ) )
982
- echo "\t\t<itunes:order>". $EpisodeData['order'] ."</itunes:order>".PHP_EOL;
983
- }
984
-
985
- // Google Play tags:
986
- 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
987
- if( !empty( $EpisodeData['gp_desc'] ) ) {
988
- echo "\t\t<googleplay:description>". powerpress_format_itunes_value($EpisodeData['gp_desc'], 'summary') ."</googleplay:description>".PHP_EOL;
989
- }
990
-
991
- if( !empty( $EpisodeData['gp_explicit'] ) ) {
992
- echo "\t\t<googleplay:explicit>yes</googleplay:explicit>".PHP_EOL;
993
- }
994
- }
995
-
996
- if( !empty( $EpisodeData['gp_block'] ) ) {
997
- echo "\t\t<googleplay:block>yes</googleplay:block>".PHP_EOL;
998
- }
999
-
1000
-
1001
- // RawVoice RSS Tags
1002
- if( empty($powerpress_feed['feed_maximizer_on']) )
1003
- {
1004
- if( !defined('POWERPRESS_RAWVOICE_RSS') || POWERPRESS_RAWVOICE_RSS != false )
1005
- {
1006
- if( !empty($EpisodeData['ishd']) )
1007
- echo "\t\t<rawvoice:isHD>yes</rawvoice:isHD>".PHP_EOL;;
1008
- if( !empty($EpisodeData['image']) )
1009
- echo "\t\t<rawvoice:poster url=\"". $EpisodeData['image'] ."\" />".PHP_EOL;
1010
- if( !empty($EpisodeData['embed']) )
1011
- echo "\t\t<rawvoice:embed>". htmlspecialchars($EpisodeData['embed']) ."</rawvoice:embed>".PHP_EOL;
1012
- else if( !empty($powerpress_feed['podcast_embed_in_feed']) && function_exists('powerpress_generate_embed') )
1013
- {
1014
- $player = powerpressplayer_embedable($EpisodeData['url'], $EpisodeData);
1015
- $embed_content = '';
1016
-
1017
- if( $player )
1018
- $embed_content = powerpress_generate_embed($player, $EpisodeData);
1019
- if( $embed_content )
1020
- echo "\t\t<rawvoice:embed>". htmlspecialchars( $embed_content ) ."</rawvoice:embed>".PHP_EOL;
1021
- }
1022
-
1023
- if( !empty($EpisodeData['webm_src']) )
1024
- {
1025
- echo "\t\t<rawvoice:webm src=\"". $EpisodeData['webm_src'] ."\"";
1026
- if( $EpisodeData['webm_length'] )
1027
- echo " length=\"". $EpisodeData['webm_length'] ."\"";
1028
- echo " type=\"video/webm\" />".PHP_EOL;
1029
- }
1030
-
1031
- $GeneralSettings = get_option('powerpress_general');
1032
-
1033
- if( !empty($GeneralSettings) && !empty($GeneralSettings['metamarks']) )
1034
- {
1035
- require_once(POWERPRESS_ABSPATH .'/powerpressadmin-metamarks.php');
1036
- powerpress_metamarks_print_rss2($EpisodeData);
1037
- }
1038
- }
1039
- }
1040
- }
1041
-
1042
- add_action('rss2_item', 'powerpress_rss2_item');
1043
- add_action('rss2_item_powerpress', 'powerpress_rss2_item');
1044
-
1045
- /*
1046
- 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
1047
- */
1048
- function powerpress_filter_rss_enclosure($content)
1049
- {
1050
- if( defined('PODPRESS_VERSION') || isset($GLOBALS['podcasting_player_id']) || isset($GLOBALS['podcast_channel_active']) || defined('PODCASTING_VERSION') ) {
1051
- return $content; // Another podcasting plugin is enabled...
1052
- }
1053
-
1054
- if( powerpress_is_custom_podcast_feed() && get_query_var('feed') !== 'podcast' && !is_category() && !is_tag() && !is_tax() )
1055
- return ''; // We will handle this enclosure in the powerpress_rss2_item() function
1056
-
1057
- $match_count = preg_match('/\surl="([^"]*)"/', $content, $matches); // No URL found, weird
1058
- if( count($matches) != 2)
1059
- return $content;
1060
-
1061
- // Original Media URL
1062
- $OrigURL = $matches[1];
1063
-
1064
- if( substr($OrigURL, 0, 5) != 'http:' && substr($OrigURL, 0, 6) != 'https:' )
1065
- return ''; // The URL value is invalid
1066
-
1067
- global $post, $powerpress_rss_enclosure_post_id;
1068
- if( empty($powerpress_rss_enclosure_post_id) )
1069
- $powerpress_rss_enclosure_post_id = -1;
1070
-
1071
- if( $powerpress_rss_enclosure_post_id == $post->ID )
1072
- return ''; // we've already included one enclosure, lets not allow anymore
1073
- $powerpress_rss_enclosure_post_id = $post->ID;
1074
-
1075
- $EpisodeData = powerpress_get_enclosure_data($post->ID);
1076
-
1077
- // Modified Media URL
1078
- $ModifiedURL = powerpress_url_in_feed($EpisodeData['url']); // powerpress_add_redirect_url($OrigURL);
1079
-
1080
- // Check that the content type is a valid one...
1081
- $match_count = preg_match('/\stype="([^"]*)"/', $content, $matches);
1082
- if( count($matches) > 1 && strstr($matches[1], '/') == false )
1083
- {
1084
- $ContentType = powerpress_get_contenttype($ModifiedURL);
1085
- $content = str_replace("type=\"{$matches[1]}\"", "type=\"$ContentType\"", $content);
1086
- }
1087
-
1088
- // Check that the content length is a digit greater that zero
1089
- $match_count = preg_match('/\slength="([^"]*)"/', $content, $matches);
1090
- if( count($matches) > 1 && empty($matches[1]) )
1091
- {
1092
- $content = str_replace("length=\"{$matches[1]}\"", "length=\"5242880\"", $content);
1093
- }
1094
-
1095
- // Replace the original url with the modified one...
1096
- if( $OrigURL != $ModifiedURL )
1097
- return str_replace($OrigURL, $ModifiedURL, $content);
1098
- return $content;
1099
- }
1100
-
1101
-
1102
- add_filter('rss_enclosure', 'powerpress_filter_rss_enclosure', 11);
1103
-
1104
- function powerpress_bloginfo_rss($content, $field = '')
1105
- {
1106
- $new_value = '';
1107
- if( powerpress_is_custom_podcast_feed() )
1108
- {
1109
- if( is_category() ) {
1110
- $Feed = get_option('powerpress_cat_feed_'.get_query_var('cat') );
1111
- }
1112
- else if( is_tax() || is_tag() ) {
1113
- global $powerpress_feed;
1114
- if( !empty($powerpress_feed['term_taxonomy_id']) )
1115
- $Feed = get_option('powerpress_taxonomy_'.$powerpress_feed['term_taxonomy_id'] );
1116
- }
1117
- else
1118
- {
1119
- global $powerpress_feed;
1120
-
1121
- if( !empty($powerpress_feed['post_type']) )
1122
- {
1123
- $feed_slug = get_query_var('feed');
1124
- $PostTypeSettingsArray = get_option('powerpress_posttype_'.$powerpress_feed['post_type'] );
1125
- if( !empty($PostTypeSettingsArray[ $feed_slug ]) )
1126
- $Feed = $PostTypeSettingsArray[ $feed_slug ];
1127
- }
1128
- else
1129
- {
1130
- $Feed = get_option('powerpress_feed_'.get_query_var('feed') );
1131
- if( empty($Feed) && get_query_var('feed') === 'podcast' )
1132
- $Feed = get_option('powerpress_feed');
1133
- }
1134
- }
1135
-
1136
- if( $Feed )
1137
- {
1138
- switch( $field )
1139
- {
1140
- case 'description': {
1141
- if( !empty($Feed['description']) )
1142
- $new_value = $Feed['description'];
1143
- else if( is_category() )
1144
- {
1145
- $category = get_category( get_query_var('cat') );
1146
- if( $category->description )
1147
- $new_value = $category->description;
1148
- }
1149
- }; break;
1150
- case 'url': {
1151
- // If the website URL is set for this podcast then lets use it...
1152
- if( !empty($Feed['url']) )
1153
- return trim($Feed['url']);
1154
-
1155
- if( is_category() ) {
1156
- return get_category_link( get_query_var('cat') );
1157
- } else {
1158
- $urlTemp = '';
1159
- $blogHomepage = get_option('page_for_posts');
1160
- if( !empty($blogHomepage) ) {
1161
- $urlTemp = get_permalink( $blogHomepage );
1162
- }
1163
-
1164
- if( empty($urlTemp) )
1165
- $urlTemp = get_bloginfo('url');
1166
- if( !empty($urlTemp) )
1167
- return $urlTemp;
1168
- }
1169
- }; break;
1170
- case 'name': { // As of wp 4.4+ title is handled by get_the_title_rss completely.
1171
- if( !empty($Feed['title']) )
1172
- $new_value = $Feed['title'];
1173
- }; break;
1174
- case 'language': {
1175
- // Get the feed language
1176
- $lang = '';
1177
- if( isset($Feed['rss_language']) && $Feed['rss_language'] != '' )
1178
- $lang = $Feed['rss_language'];
1179
- if( strlen($lang) == 5 )
1180
- $lang = substr($lang,0,3) . strtoupper( substr($lang, 3) ); // Format example: en-US for English, United States
1181
- if( !empty($lang) )
1182
- return $lang;
1183
- }; break;
1184
- }
1185
- }
1186
- }
1187
-
1188
- if( !empty($new_value) )
1189
- {
1190
- $new_value = wptexturize($new_value);
1191
- $new_value = convert_chars($new_value);
1192
- $new_value = esc_html($new_value);
1193
- //$new_value = convert_chars($new_value);
1194
- return $new_value;
1195
- }
1196
-
1197
- return $content;
1198
- }
1199
-
1200
- add_filter('get_bloginfo_rss', 'powerpress_bloginfo_rss', 10, 2);
1201
-
1202
-
1203
- function powerpress_wp_title_rss($title)
1204
- {
1205
- if( version_compare($GLOBALS['wp_version'], 4.4, '>=' ) )
1206
- {
1207
- if( powerpress_is_custom_podcast_feed() )
1208
- {
1209
- if( is_category() ) {
1210
- $Feed = get_option('powerpress_cat_feed_'.get_query_var('cat') );
1211
- }
1212
- else if( is_tax() || is_tag() ) {
1213
- global $powerpress_feed;
1214
- if( !empty($powerpress_feed['term_taxonomy_id']) )
1215
- $Feed = get_option('powerpress_taxonomy_'.$powerpress_feed['term_taxonomy_id'] );
1216
- }
1217
- else
1218
- {
1219
- global $powerpress_feed;
1220
-
1221
- if( !empty($powerpress_feed['post_type']) )
1222
- {
1223
- $feed_slug = get_query_var('feed');
1224
- if( !empty($feed_slug) ) {
1225
- $PostTypeSettingsArray = get_option('powerpress_posttype_'.$powerpress_feed['post_type'] );
1226
- if( !empty($PostTypeSettingsArray[ $feed_slug ]) )
1227
- $Feed = $PostTypeSettingsArray[ $feed_slug ];
1228
- }
1229
- }
1230
- else
1231
- {
1232
- $feed_slug = get_query_var('feed');
1233
- $Feed = false;
1234
- if( !empty($feed_slug) ) {
1235
- $Feed = get_option('powerpress_feed_'.get_query_var('feed') );
1236
- }
1237
- if( empty($Feed) && get_query_var('feed') === 'podcast' )
1238
- $Feed = get_option('powerpress_feed');
1239
- }
1240
- }
1241
-
1242
- if( $Feed )
1243
- {
1244
- if( !empty($Feed['title']) )
1245
- return esc_html( $Feed['title'] );
1246
- }
1247
- }
1248
- }
1249
- else
1250
- {
1251
- if( powerpress_is_custom_podcast_feed() )
1252
- {
1253
- if( is_category() )
1254
- {
1255
- $Feed = get_option('powerpress_cat_feed_'.get_query_var('cat') );
1256
- if( $Feed && isset($Feed['title']) && $Feed['title'] != '' )
1257
- return ''; // We alrady did a custom title, lets not add the category to it...
1258
- }
1259
- else
1260
- {
1261
- return ''; // It is not a category, lets not mess with our beautiful title then
1262
- }
1263
- }
1264
- }
1265
-
1266
- return $title;
1267
- }
1268
-
1269
- add_filter('get_wp_title_rss', 'powerpress_wp_title_rss');
1270
-
1271
- function powerpress_the_title_rss($title)
1272
- {
1273
- $new_title = $title;
1274
- $GeneralSettings = get_option('powerpress_general');
1275
- // If it is a custom podcast channel...
1276
- if( !empty($GeneralSettings['seo_feed_title']) )
1277
- {
1278
- $feed_slug = 'podcast';
1279
- // IF custom post type or channel, use that feed slug...
1280
- if( get_query_var('feed') !== 'podcast' && !is_category() && !is_tax() && !is_tag() )
1281
- $feed_slug = get_query_var('feed');
1282
-
1283
- // Get the episode specific title...
1284
- $EpisodeData = powerpress_get_enclosure_data(get_the_ID(), $feed_slug);
1285
- if( !empty($EpisodeData['feed_title']) )
1286
- {
1287
- $feed_title = ent2ncr( $EpisodeData['feed_title'] );
1288
- $feed_title = strip_tags( $feed_title );
1289
- $feed_title = esc_html( $feed_title );
1290
-
1291
- //switch( $GeneralSettings['custom_feed_title'] )
1292
- switch( $GeneralSettings['seo_feed_title'] )
1293
- {
1294
- case 1: { // Replaces title
1295
- $new_title = $feed_title;
1296
- }; break;
1297
- case 2: { // Prefixes title
1298
- $new_title = $feed_title . ' ' . $title;
1299
- }; break;
1300
- case 3: { // Postfixes title
1301
- $new_title = $title . ' ' . $feed_title;
1302
- }; break;
1303
- }
1304
- }
1305
- }
1306
-
1307
- return $new_title;
1308
- }
1309
-
1310
- add_filter('the_title_rss', 'powerpress_the_title_rss', 11);
1311
-
1312
-
1313
- function powerpress_feed_content_type($content_type = '', $feedslug = '')
1314
- {
1315
- switch( $feedslug )
1316
- {
1317
- case 'rss':
1318
- case 'rss2':
1319
- case 'atom':
1320
- case 'rdf': {
1321
- // Do nothing, let WordPress take care of these
1322
- }; break;
1323
- case 'podcast': {
1324
- // This one is ours!
1325
- $content_type = 'application/rss+xml';
1326
- }; break;
1327
- default: { // Check for the custom podcast feeds
1328
- $GeneralSettings = get_option('powerpress_general');
1329
- if( !empty($GeneralSettings['custom_feeds'][ $feedslug ]) )
1330
- {
1331
- $content_type = 'application/rss+xml';
1332
- }
1333
- else if( !empty($GeneralSettings['posttype_podcasting']) )
1334
- {
1335
- // We need to look up these settings...
1336
- $FeedSlugPostTypesArray = get_option('powerpress_posttype-podcasting');
1337
- if( is_array($FeedSlugPostTypesArray) && !empty($FeedSlugPostTypesArray[ $feedslug ]) )
1338
- {
1339
- $content_type = 'application/rss+xml';
1340
- }
1341
- }
1342
- }
1343
- }
1344
-
1345
- return $content_type;
1346
- }
1347
-
1348
- add_filter( 'feed_content_type', 'powerpress_feed_content_type', 10, 2 );
1349
-
1350
- // 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.
1351
- if( version_compare($GLOBALS['wp_version'], '3.4', '<') )
1352
- {
1353
- function powerpress_rss_language($value)
1354
- {
1355
- if( powerpress_is_custom_podcast_feed() )
1356
- {
1357
- global $powerpress_feed;
1358
- if( $powerpress_feed && isset($powerpress_feed['rss_language']) && $powerpress_feed['rss_language'] != '' )
1359
- $value = $powerpress_feed['rss_language'];
1360
- }
1361
- return $value;
1362
- }
1363
-
1364
- add_filter('option_rss_language', 'powerpress_rss_language');
1365
- }
1366
-
1367
- function powerpress_do_podcast_feed($for_comments=false)
1368
- {
1369
- global $wp_query, $powerpress_feed;
1370
-
1371
- powerpress_is_podcast_feed(); // Loads the feed settings if not already loaded...
1372
-
1373
- $GeneralSettings = get_option('powerpress_general');
1374
- if( isset($GeneralSettings['premium_caps']) && $GeneralSettings['premium_caps'] )
1375
- {
1376
- $feed_slug = get_query_var('feed');
1377
-
1378
- if( $feed_slug != 'podcast' )
1379
- {
1380
- $FeedSettings = get_option('powerpress_feed_'.$feed_slug);
1381
- if( !empty($FeedSettings['premium']) )
1382
- {
1383
- require_once( POWERPRESS_ABSPATH.'/powerpress-feed-auth.php');
1384
- powerpress_feed_auth( $feed_slug );
1385
- }
1386
- }
1387
- }
1388
-
1389
- // Use the template to gurantee future WordPress behavior
1390
- if( defined('POWERPRESS_FEED_TEMPLATE') ) {
1391
- load_template( POWERPRESS_FEED_TEMPLATE );
1392
- } else {
1393
- load_template( POWERPRESS_ABSPATH . '/feed-podcast.php' );
1394
- }
1395
- }
1396
-
1397
- function powerpress_template_redirect()
1398
- {
1399
- if( is_feed() && powerpress_is_custom_podcast_feed() )
1400
- {
1401
- if ( defined('WPSEO_VERSION') && version_compare(WPSEO_VERSION, '7.7', '>=') && class_exists( 'WPSEO_Frontend' ) ) {
1402
- $wpseo_frontend = WPSEO_Frontend::get_instance();
1403
- if( !empty($wpseo_frontend) ) {
1404
- remove_action( 'template_redirect', array( $wpseo_frontend, 'noindex_feed' ) );
1405
- }
1406
- }
1407
-
1408
- remove_action('template_redirect', 'ol_feed_redirect'); // Remove this action so feedsmith doesn't redirect
1409
- global $powerpress_feed;
1410
- if( !isset($powerpress_feed['feed_redirect_url']) )
1411
- $powerpress_feed['feed_redirect_url'] = '';
1412
- $redirect_value = ( !empty($_GET['redirect'])? $_GET['redirect'] : false );
1413
- if( is_array($powerpress_feed) && trim($powerpress_feed['feed_redirect_url']) != '' && !preg_match("/feedburner|feedsqueezer|feedvalidator/i", $_SERVER['HTTP_USER_AGENT'] ) && $redirect_value != 'no' )
1414
- {
1415
- if (function_exists('status_header'))
1416
- status_header( 301 );
1417
- header("Location: " . trim($powerpress_feed['feed_redirect_url']));
1418
- header("HTTP/1.1 301 Moved Permanently");
1419
- exit();
1420
- }
1421
- }
1422
- }
1423
-
1424
- add_action('template_redirect', 'powerpress_template_redirect', 0);
1425
-
1426
-
1427
- function powerpress_rewrite_rules_array($array)
1428
- {
1429
- global $wp_rewrite;
1430
- $settings = get_option('powerpress_general');
1431
-
1432
- $podcast_feeds = array('podcast'=>true);
1433
- if( isset($settings['custom_feeds']) && is_array($settings['custom_feeds']) )
1434
- $podcast_feeds = array_merge($settings['custom_feeds'], $podcast_feeds );
1435
-
1436
- $merged_slugs = '';
1437
- foreach( $podcast_feeds as $feed_slug=> $feed_title )
1438
- {
1439
- if( $merged_slugs != '' )
1440
- $merged_slugs .= '|';
1441
- $merged_slugs .= $feed_slug;
1442
- }
1443
-
1444
- // $wp_rewrite->index most likely index.php
1445
- $new_array[ 'feed/('.$merged_slugs.')/?$' ] = $wp_rewrite->index. '?feed='. $wp_rewrite->preg_index(1);
1446
-
1447
- // If feature is not enabled, use the default permalinks
1448
- if( empty($settings['permalink_feeds_only']) )
1449
- return array_merge($new_array, $array);
1450
-
1451
- global $wpdb;
1452
- reset($podcast_feeds);
1453
- foreach( $podcast_feeds as $feed_slug=> $feed_title )
1454
- {
1455
- $page_name_id = $wpdb->get_var("SELECT ID FROM {$wpdb->posts} WHERE post_name = '".$feed_slug."'");
1456
- if( $page_name_id )
1457
- {
1458
- $new_array[ $feed_slug.'/?$' ] = $wp_rewrite->index. '?pagename='. $feed_slug.'&page_id='.$page_name_id;
1459
- unset($podcast_feeds[ $feed_slug ]);
1460
- continue;
1461
- }
1462
-
1463
- $category = get_category_by_slug($feed_slug);
1464
- if( $category )
1465
- {
1466
- $new_array[ $feed_slug.'/?$' ] = $wp_rewrite->index. '?cat='. $category->term_id; // category_name='. $feed_slug .'&
1467
- unset($podcast_feeds[ $feed_slug ]);
1468
- }
1469
- }
1470
-
1471
- if( count($podcast_feeds) > 0 )
1472
- {
1473
- reset($podcast_feeds);
1474
- $remaining_slugs = '';
1475
- foreach( $podcast_feeds as $feed_slug=> $feed_title )
1476
- {
1477
- if( $remaining_slugs != '' )
1478
- $remaining_slugs .= '|';
1479
- $remaining_slugs .= $feed_slug;
1480
- }
1481
-
1482
- $new_array[ '('.$remaining_slugs.')/?$' ] = $wp_rewrite->index. '?pagename='. $wp_rewrite->preg_index(1);
1483
- }
1484
-
1485
- return array_merge($new_array, $array);
1486
- }
1487
-
1488
- add_filter('rewrite_rules_array', 'powerpress_rewrite_rules_array');
1489
-
1490
-
1491
- function powerpress_pre_transient_rewrite_rules($return_rules)
1492
- {
1493
- global $wp_rewrite;
1494
- $GeneralSettings = get_option('powerpress_general');
1495
- if( !in_array('podcast', $wp_rewrite->feeds) )
1496
- $wp_rewrite->feeds[] = 'podcast';
1497
-
1498
- if( $GeneralSettings && isset($GeneralSettings['custom_feeds']) && is_array($GeneralSettings['custom_feeds']) )
1499
- {
1500
- foreach( $GeneralSettings['custom_feeds'] as $feed_slug=> $null )
1501
- {
1502
- if( !in_array($feed_slug, $wp_rewrite->feeds) )
1503
- $wp_rewrite->feeds[] = $feed_slug;
1504
- }
1505
- }
1506
-
1507
- return $return_rules;
1508
- }
1509
-
1510
- add_filter('pre_transient_rewrite_rules', 'powerpress_pre_transient_rewrite_rules');
1511
-
1512
- function powerpress_init()
1513
- {
1514
- $GeneralSettings = get_option('powerpress_general');
1515
-
1516
- if( !empty($GeneralSettings['powerpress-beta-features']) && file_exists(POWERPRESS_ABSPATH.'/powerpressadmin-pts.php') )
1517
- {
1518
- require_once(POWERPRESS_ABSPATH.'/powerpressadmin-pts.php');
1519
- }
1520
-
1521
- if( empty($GeneralSettings['disable_appearance']) || $GeneralSettings['disable_appearance'] == false )
1522
- {
1523
- require_once( POWERPRESS_ABSPATH.'/powerpress-player.php');
1524
- powerpressplayer_init($GeneralSettings);
1525
- }
1526
-
1527
- // Enable the playlist feature for PowerPress
1528
- if( !empty($GeneralSettings['playlist_player']) ) // Either not set or set on
1529
- {
1530
- require_once(POWERPRESS_ABSPATH.'/powerpress-playlist.php');
1531
- }
1532
-
1533
- if( defined('PODPRESS_VERSION') || isset($GLOBALS['podcasting_player_id']) || isset($GLOBALS['podcast_channel_active']) || defined('PODCASTING_VERSION') )
1534
- return false; // Another podcasting plugin is enabled...
1535
-
1536
- // If we are to process podpress data..
1537
- if( !empty($GeneralSettings['process_podpress']) )
1538
- {
1539
- powerpress_podpress_redirect_check();
1540
- }
1541
-
1542
- // Add the podcast feeds;
1543
- if( !defined('POWERPRESS_NO_PODCAST_FEED') )
1544
- {
1545
- add_feed('podcast', 'powerpress_do_podcast_feed');
1546
- }
1547
-
1548
- if( $GeneralSettings && isset($GeneralSettings['custom_feeds']) && is_array($GeneralSettings['custom_feeds']) )
1549
- {
1550
- foreach( $GeneralSettings['custom_feeds'] as $feed_slug=> $feed_title )
1551
- {
1552
- if( $feed_slug != 'podcast' )
1553
- add_feed($feed_slug, 'powerpress_do_podcast_feed');
1554
- }
1555
- }
1556
-
1557
- if( !empty($GeneralSettings['posttype_podcasting']) )
1558
- {
1559
- // Loop through the posttype podcasting settings and set the feeds for the custom post type slugs...
1560
- global $wp_rewrite;
1561
-
1562
-
1563
- $FeedSlugPostTypesArray = get_option('powerpress_posttype-podcasting'); // Changed field slightly so it does not conflict with a post type "podcasting"
1564
- if( $FeedSlugPostTypesArray === false )
1565
- {
1566
- // Simple one-time fix...
1567
- $FeedSlugPostTypesArray = get_option('powerpress_posttype_podcasting');
1568
- if( empty($FeedSlugPostTypesArray) )
1569
- $FeedSlugPostTypesArray = array();
1570
- update_option('powerpress_posttype-podcasting', $FeedSlugPostTypesArray);
1571
- if( !array_key_exists('title', $FeedSlugPostTypesArray) ) // AS long as it doesn't have post type specific settings...
1572
- delete_option('powerpress_posttype_podcasting');
1573
- }
1574
-
1575
- if( empty($FeedSlugPostTypesArray) )
1576
- {
1577
- $FeedSlugPostTypesArray = array();
1578
- }
1579
- foreach( $FeedSlugPostTypesArray as $feed_slug=> $FeedSlugPostTypes )
1580
- {
1581
- if ( !in_array($feed_slug, $wp_rewrite->feeds) ) // we need to add this feed name
1582
- {
1583
- add_feed($feed_slug, 'powerpress_do_podcast_feed');
1584
- foreach( $FeedSlugPostTypes as $post_type_slug=> $title )
1585
- {
1586
- 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
1587
- 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
1588
- }
1589
- }
1590
- }
1591
- }
1592
-
1593
- if( defined('GAWP_VERSION') )
1594
- {
1595
- add_filter('the_content', 'powerpress_yoast_gawp_fix', 120 );
1596
- }
1597
-
1598
- if( !empty($GeneralSettings['subscribe_links']) )
1599
- {
1600
- // 2 Subscribe page shortocde [powerpress_subscribe feedslug="podcast"]
1601
- // 3 Subscribe sidebar widget: iTunes, RSS
1602
- add_filter('powerpress_player_subscribe_links', 'powerpressplayer_link_subscribe_pre', 1, 3);
1603
- add_filter('powerpress_player_subscribe_links', 'powerpressplayer_link_subscribe_post', 1000, 3);
1604
- }
1605
- wp_register_style(
1606
- 'powerpress-subscribe-style',
1607
- powerpress_get_root_url() . 'css/subscribe.css',
1608
- array(),
1609
- '20141021',
1610
- 'all' );
1611
-
1612
- if( !empty($GeneralSettings['rss_emoji']) ) {
1613
- if( has_filter('the_content_feed', 'wp_staticize_emoji') ) {
1614
- remove_filter( 'the_content_feed', 'wp_staticize_emoji' ); // Remove the emoji images
1615
- remove_filter( 'comment_text_rss', 'wp_staticize_emoji' );
1616
- //add_filter( 'the_content_feed', 'wp_encode_emoji' ); // Convert an emoji to &#x1Fxxx;
1617
- //add_filter( 'get_wp_title_rss', 'wp_encode_emoji' );
1618
- }
1619
- }
1620
-
1621
- remove_action( 'wp_head', 'feed_links', 2 );
1622
- remove_action( 'wp_head', 'feed_links_extra', 3 );
1623
- }
1624
-
1625
- add_action('init', 'powerpress_init', -100); // We need to add the feeds before other plugins start screwing with them
1626
-
1627
- function powerpress_wp_print_styles()
1628
- {
1629
- $Settings = get_option('powerpress_general');
1630
-
1631
- if( !empty($Settings['audio_player_max_width']) )
1632
- {
1633
- echo '<style type="text/css">'."\n";
1634
- if( is_numeric($Settings['audio_player_max_width']) )
1635
- $Settings['audio_player_max_width'] .= 'px';
1636
- echo '.powerpress_player .wp-audio-shortcode { max-width: '.$Settings['audio_player_max_width'].'; }'."\n";
1637
- echo '</style>'."\n";
1638
- }
1639
- }
1640
-
1641
- add_action('wp_print_styles', 'powerpress_wp_print_styles');
1642
-
1643
- function powerpress_request($qv)
1644
- {
1645
- if( !empty($qv['feed']) )
1646
- {
1647
- $podcast_feed_slug = false;
1648
- if( $qv['feed'] == 'podcast' ) {
1649
- $GeneralSettings = get_option('powerpress_general');
1650
- if( empty($GeneralSettings['posttype_podcasting']) )
1651
- $podcast_feed_slug = 'podcast';
1652
- } else if( $qv['feed'] == 'rss' || $qv['feed'] == 'rss2' || $qv['feed'] == 'atom' || $qv['feed'] == 'rdf' || $qv['feed'] == 'feed' ) { // 'feed', 'rdf', 'rss', 'rss2', 'atom'
1653
- // Skip
1654
- } else {
1655
- $GeneralSettings = get_option('powerpress_general');
1656
- if( empty($GeneralSettings['posttype_podcasting']) && isset($GeneralSettings['custom_feeds']) && is_array($GeneralSettings['custom_feeds']) && !empty($GeneralSettings['custom_feeds'][ $qv['feed'] ] ) )
1657
- $podcast_feed_slug = $qv['feed'];
1658
-
1659
-
1660
- }
1661
-
1662
- if( $podcast_feed_slug )
1663
- {
1664
- if( !defined('POWERPRESS_POSTTYPE_MIXING') && $qv['feed'] == 'podcast' ) {
1665
- $qv['post_type'] = 'post';
1666
- } else {
1667
- $qv['post_type'] = get_post_types( array('public'=> true, 'capability_type'=>'post') );
1668
- if( !empty($qv['post_type']['attachment']) )
1669
- unset($qv['post_type']['attachment']);
1670
- }
1671
-
1672
- $FeedCustom = get_option('powerpress_feed_'.$podcast_feed_slug); // Get custom feed specific settings
1673
- // See if the user set a custom post type only...
1674
- if( !empty($FeedCustom) && !empty( $FeedCustom['custom_post_type']) )
1675
- $qv['post_type'] = $FeedCustom['custom_post_type'];
1676
- }
1677
- }
1678
- return $qv;
1679
- }
1680
-
1681
- add_filter('request', 'powerpress_request');
1682
-
1683
-
1684
- function powerpress_plugins_loaded()
1685
- {
1686
- // Translation support loaded:
1687
- load_plugin_textdomain('powerpress', // domain / keyword name of plugin
1688
- POWERPRESS_ABSPATH .'/languages', // Absolute path
1689
- basename(POWERPRESS_ABSPATH).'/languages' ); // relative path in plugins folder
1690
-
1691
- /*
1692
- ####
1693
- # Defines that effect translation defined now:
1694
- ####
1695
- */
1696
- // Set specific play and download labels for your installation of PowerPress
1697
- if( !defined('POWERPRESS_LINKS_TEXT') )
1698
- define('POWERPRESS_LINKS_TEXT', __('Podcast', 'powerpress') );
1699
- if( !defined('POWERPRESS_DURATION_TEXT') )
1700
- define('POWERPRESS_DURATION_TEXT', __('Duration', 'powerpress') );
1701
- if( !defined('POWERPRESS_PLAY_IN_NEW_WINDOW_TEXT') )
1702
- define('POWERPRESS_PLAY_IN_NEW_WINDOW_TEXT', __('Play in new window', 'powerpress') );
1703
- if( !defined('POWERPRESS_DOWNLOAD_TEXT') )
1704
- define('POWERPRESS_DOWNLOAD_TEXT', __('Download', 'powerpress') );
1705
- if( !defined('POWERPRESS_PLAY_TEXT') )
1706
- define('POWERPRESS_PLAY_TEXT', __('Play', 'powerpress') );
1707
- if( !defined('POWERPRESS_EMBED_TEXT') )
1708
- define('POWERPRESS_EMBED_TEXT', __('Embed', 'powerpress') );
1709
- if( !defined('POWERPRESS_READ_TEXT') )
1710
- define('POWERPRESS_READ_TEXT', __('Read', 'powerpress') );
1711
- }
1712
- add_action('plugins_loaded', 'powerpress_plugins_loaded');
1713
-
1714
-
1715
- function powerpress_w3tc_can_print_comment($settings)
1716
- {
1717
- return false;
1718
- }
1719
-
1720
- // Disable minifying if W3TC is enabled
1721
- function powerpress_w3tc_minify_enable($enable)
1722
- {
1723
- if( is_feed() )
1724
- return false;
1725
- return $enable;
1726
- }
1727
-
1728
- // Load the general feed settings for feeds handled by powerpress
1729
- function powerpress_load_general_feed_settings()
1730
- {
1731
- global $wp_query;
1732
- global $powerpress_feed;
1733
-
1734
- if( $powerpress_feed !== false ) // If it is not false (either NULL or an array) then we already looked these settings up
1735
- {
1736
- $powerpress_feed = false;
1737
-
1738
- // Get the powerpress settings
1739
- $GeneralSettings = get_option('powerpress_general');
1740
- if( !isset($GeneralSettings['custom_feeds']['podcast']) )
1741
- $GeneralSettings['custom_feeds']['podcast'] = 'Podcast Feed'; // Fixes scenario where the user never configured the custom default podcast feed.
1742
- if( empty($GeneralSettings['default_url']) )
1743
- $GeneralSettings['default_url'] = '';
1744
-
1745
- if( $GeneralSettings )
1746
- {
1747
- $FeedSettingsBasic = get_option('powerpress_feed'); // Get overall feed settings
1748
- if( is_feed() && defined( 'WPCACHEHOME' ) && empty($GeneralSettings['allow_feed_comments']) )
1749
- {
1750
- global $wp_super_cache_comments;
1751
- $wp_super_cache_comments = 0;
1752
- }
1753
-
1754
- if( is_feed() && defined('W3TC') && empty($GeneralSettings['allow_feed_comments']) )
1755
- {
1756
- add_filter( 'w3tc_can_print_comment', 'powerpress_w3tc_can_print_comment', 10, 1 );
1757
- }
1758
-
1759
- if( is_feed() && defined('W3TC') )
1760
- {
1761
- add_filter( 'w3tc_minify_enable', 'powerpress_w3tc_minify_enable');
1762
- }
1763
-
1764
- // If we're in advanced mode and we're dealing with a category feed we're extending, lets work with it...
1765
- if( is_category() && isset($GeneralSettings['custom_cat_feeds']) && is_array($GeneralSettings['custom_cat_feeds']) && in_array( get_query_var('cat'), $GeneralSettings['custom_cat_feeds']) )
1766
- {
1767
- $cat_ID = get_query_var('cat');
1768
- $FeedCustom = get_option('powerpress_cat_feed_'.$cat_ID); // Get custom feed specific settings
1769
- $Feed = powerpress_merge_empty_feed_settings($FeedCustom, $FeedSettingsBasic);
1770
-
1771
- $powerpress_feed = array();
1772
- if( !empty($GeneralSettings['feed_accel']) )
1773
- $powerpress_feed['feed_accel'] = true;
1774
- $powerpress_feed['is_custom'] = true;
1775
- $powerpress_feed['category'] = $cat_ID;
1776
- $powerpress_feed['process_podpress'] = !empty($GeneralSettings['process_podpress']); // Category feeds could originate from Podpress
1777
- $powerpress_feed['rss_language'] = ''; // default, let WordPress set the language
1778
- $powerpress_feed['default_url'] = '';
1779
- if( !empty($GeneralSettings['default_url']) )
1780
- $powerpress_feed['default_url'] = rtrim($GeneralSettings['default_url'], '/') .'/';
1781
- $explicit_array = array("no", "yes", "clean");
1782
- $powerpress_feed['explicit'] = $explicit_array[$Feed['itunes_explicit']];
1783
- if( !empty($Feed['itunes_talent_name']) )
1784
- $powerpress_feed['itunes_talent_name'] = $Feed['itunes_talent_name'];
1785
- else
1786
- $powerpress_feed['itunes_talent_name'] = get_wp_title_rss();
1787
- $powerpress_feed['enhance_itunes_summary'] = $Feed['enhance_itunes_summary'];
1788
- if( !empty($GeneralSettings['seo_itunes']) )
1789
- $powerpress_feed['enhance_itunes_summary'] = 1;
1790
- $powerpress_feed['posts_per_rss'] = false;
1791
- if( !empty($Feed['posts_per_rss']) && is_numeric($Feed['posts_per_rss']) && $Feed['posts_per_rss'] > 0 )
1792
- $powerpress_feed['posts_per_rss'] = $Feed['posts_per_rss'];
1793
- $powerpress_feed['feed_redirect_url'] = '';
1794
- if( !empty($Feed['feed_redirect_url']) )
1795
- $powerpress_feed['feed_redirect_url'] = $Feed['feed_redirect_url'];
1796
- if( $Feed['itunes_author_post'] == true )
1797
- $powerpress_feed['itunes_author_post'] = true;
1798
- if( $Feed['rss_language'] != '' )
1799
- $powerpress_feed['rss_language'] = $Feed['rss_language'];
1800
-
1801
- if( !empty($GeneralSettings['podcast_embed_in_feed']) )
1802
- $powerpress_feed['podcast_embed_in_feed'] = true;
1803
- if( !empty($Feed['maximize_feed']) )
1804
- $powerpress_feed['maximize_feed'] = true;
1805
- if( !empty($Feed['episode_itunes_image']) && !empty($Feed['itunes_image']) )
1806
- $powerpress_feed['itunes_image'] = $Feed['itunes_image'];
1807
- return;
1808
- }
1809
- else if( ( defined('POWERPRESS_TAXONOMY_PODCASTING') || !empty($GeneralSettings['taxonomy_podcasting']) ) && ( is_tag() || is_tax() ) )
1810
- {
1811
- // We need to get the term_id and the tax_id (tt_id)
1812
- $term_slug = get_query_var('term');
1813
- $taxonomy = get_query_var('taxonomy');
1814
-
1815
- if( empty($term_slug) && empty($taxonomy) ) // Handle situation where tag is the taxonomy we're working with
1816
- {
1817
- $term_slug = get_query_var('tag');
1818
- if( !empty($term_slug) )
1819
- $taxonomy = 'post_tag';
1820
- }
1821
-
1822
- $term = false;
1823
- if( !empty($term_slug) && !empty($taxonomy) )
1824
- {
1825
- $term = term_exists($term_slug, $taxonomy);
1826
- }
1827
-
1828
- if( !empty($term['term_taxonomy_id']) )
1829
- {
1830
- $FeedCustom = get_option('powerpress_taxonomy_'.$term['term_taxonomy_id'] ); // Get custom feed specific settings
1831
- if( $FeedCustom )
1832
- {
1833
- $Feed = powerpress_merge_empty_feed_settings($FeedCustom, $FeedSettingsBasic);
1834
-
1835
- $powerpress_feed = array();
1836
- if( !empty($GeneralSettings['feed_accel']) )
1837
- $powerpress_feed['feed_accel'] = true;
1838
- $powerpress_feed['is_custom'] = true;
1839
- $powerpress_feed['term_taxonomy_id'] = $term['term_taxonomy_id'];
1840
- $powerpress_feed['process_podpress'] = false; // Taxonomy feeds will not originate from Podpress
1841
- $powerpress_feed['rss_language'] = ''; // default, let WordPress set the language
1842
- $powerpress_feed['default_url'] = rtrim($GeneralSettings['default_url'], '/') .'/';
1843
- $explicit_array = array("no", "yes", "clean");
1844
- $powerpress_feed['explicit'] = $explicit_array[$Feed['itunes_explicit']];
1845
- if( !empty($Feed['itunes_talent_name']) )
1846
- $powerpress_feed['itunes_talent_name'] = $Feed['itunes_talent_name'];
1847
- else
1848
- $powerpress_feed['itunes_talent_name'] = get_wp_title_rss();
1849
- $powerpress_feed['enhance_itunes_summary'] = $Feed['enhance_itunes_summary'];
1850
- if( !empty($GeneralSettings['seo_itunes']) )
1851
- $powerpress_feed['enhance_itunes_summary'] = 1;
1852
- $powerpress_feed['posts_per_rss'] = false;
1853
- if( !empty($Feed['posts_per_rss']) && is_numeric($Feed['posts_per_rss']) && $Feed['posts_per_rss'] > 0 )
1854
- $powerpress_feed['posts_per_rss'] = $Feed['posts_per_rss'];
1855
- if( $Feed['feed_redirect_url'] != '' )
1856
- $powerpress_feed['feed_redirect_url'] = $Feed['feed_redirect_url'];
1857
- if( $Feed['itunes_author_post'] == true )
1858
- $powerpress_feed['itunes_author_post'] = true;
1859
- if( $Feed['rss_language'] != '' )
1860
- $powerpress_feed['rss_language'] = $Feed['rss_language'];
1861
-
1862
- if( !empty($GeneralSettings['podcast_embed_in_feed']) )
1863
- $powerpress_feed['podcast_embed_in_feed'] = true;
1864
- if( !empty($Feed['maximize_feed']) )
1865
- $powerpress_feed['maximize_feed'] = true;
1866
- if( !empty($Feed['episode_itunes_image']) && !empty($Feed['itunes_image']) )
1867
- $powerpress_feed['itunes_image'] = $Feed['itunes_image'];
1868
- return;
1869
- }
1870
- }
1871
- }
1872
-
1873
- $feed_slug = get_query_var('feed');
1874
- // Are we dealing with a custom podcast channel or a custom post type podcast feed...
1875
- if( !empty($GeneralSettings['posttype_podcasting']) || isset($GeneralSettings['custom_feeds'][ $feed_slug ]) )
1876
- {
1877
- $Feed = false;
1878
- if( !empty($GeneralSettings['posttype_podcasting']) )
1879
- {
1880
- $post_type = get_query_var('post_type');
1881
-
1882
- if( !empty($post_type) )
1883
- {
1884
- if ( is_array( $post_type ) ) {
1885
- $post_type = reset( $post_type ); // get first element in array
1886
- }
1887
-
1888
- // Get the settings for this podcast post type
1889
- $PostTypeSettingsArray = get_option('powerpress_posttype_'. $post_type);
1890
- if( !empty($PostTypeSettingsArray[ $feed_slug ]) )
1891
- {
1892
- $FeedCustom = $PostTypeSettingsArray[ $feed_slug ];
1893
- $Feed = powerpress_merge_empty_feed_settings($FeedCustom, $FeedSettingsBasic);
1894
- $Feed['post_type'] = $post_type;
1895
- }
1896
- }
1897
- }
1898
- if( empty($Feed) && isset($GeneralSettings['custom_feeds'][ $feed_slug ]) )
1899
- {
1900
- $FeedCustom = get_option('powerpress_feed_'.$feed_slug); // Get custom feed specific settings
1901
- $Feed = powerpress_merge_empty_feed_settings($FeedCustom, $FeedSettingsBasic, ($feed_slug == 'podcast') );
1902
- }
1903
-
1904
- if( $Feed )
1905
- {
1906
- $powerpress_feed = array();
1907
- if( !empty($GeneralSettings['feed_accel']) )
1908
- $powerpress_feed['feed_accel'] = true;
1909
- $powerpress_feed['is_custom'] = true;
1910
- $powerpress_feed['feed-slug'] = $feed_slug;
1911
- if( !empty($Feed['post_type']) )
1912
- $powerpress_feed['post_type'] = $Feed['post_type'];
1913
- $powerpress_feed['process_podpress'] = ($feed_slug=='podcast'? !empty($GeneralSettings['process_podpress']): false); // We don't touch podpress data for custom feeds
1914
- $powerpress_feed['rss_language'] = ''; // RSS language should be set by WordPress by default
1915
- $powerpress_feed['default_url'] = '';
1916
- if( !empty($powerpress_feed['default_url']) )
1917
- $powerpress_feed['default_url'] = rtrim($GeneralSettings['default_url'], '/') .'/';
1918
- $explicit = array("no", "yes", "clean");
1919
- $powerpress_feed['explicit'] ='no';
1920
- if( !empty($Feed['itunes_explicit']) )
1921
- $powerpress_feed['explicit'] = $explicit[ $Feed['itunes_explicit'] ];
1922
- if( !empty($Feed['itunes_talent_name']) )
1923
- $powerpress_feed['itunes_talent_name'] = $Feed['itunes_talent_name'];
1924
- else
1925
- $powerpress_feed['itunes_talent_name'] = get_wp_title_rss();
1926
- $powerpress_feed['enhance_itunes_summary'] = $Feed['enhance_itunes_summary'];
1927
- if( !empty($GeneralSettings['seo_itunes']) )
1928
- $powerpress_feed['enhance_itunes_summary'] = 1;
1929
- $powerpress_feed['posts_per_rss'] = false;
1930
- if( !empty($Feed['posts_per_rss']) && is_numeric($Feed['posts_per_rss']) && $Feed['posts_per_rss'] > 0 )
1931
- $powerpress_feed['posts_per_rss'] = $Feed['posts_per_rss'];
1932
- if( !empty($Feed['feed_redirect_url']) )
1933
- $powerpress_feed['feed_redirect_url'] = $Feed['feed_redirect_url'];
1934
- if( !empty($Feed['itunes_author_post'] ) )
1935
- $powerpress_feed['itunes_author_post'] = true;
1936
- if( !empty($Feed['rss_language']) )
1937
- $powerpress_feed['rss_language'] = $Feed['rss_language'];
1938
- if( !empty($GeneralSettings['podcast_embed_in_feed']) )
1939
- $powerpress_feed['podcast_embed_in_feed'] = true;
1940
- if( !empty($Feed['maximize_feed']) )
1941
- $powerpress_feed['maximize_feed'] = true;
1942
- if( !empty($Feed['episode_itunes_image']) && !empty($Feed['itunes_image']) )
1943
- $powerpress_feed['itunes_image'] = $Feed['itunes_image'];
1944
- return;
1945
- }
1946
- }
1947
-
1948
- if( !isset($FeedSettingsBasic['apply_to']) )
1949
- $FeedSettingsBasic['apply_to'] = 1;
1950
-
1951
- // We fell this far,we must be in simple mode or the user never saved customized their custom feed settings
1952
- switch( $FeedSettingsBasic['apply_to'] )
1953
- {
1954
- 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.
1955
- {
1956
- if( $feed_slug != 'podcast' )
1957
- break;
1958
- } // important: no break here!
1959
- case 2: // RSS2 Main feed and podcast feed added by PowerPress only
1960
- {
1961
- if( $feed_slug != 'feed' && $feed_slug != 'rss2' && $feed_slug != 'podcast' )
1962
- break; // We're only adding podcasts to the rss2 feed in this situation
1963
-
1964
- if( $wp_query->is_category ) // don't touch the category feeds...
1965
- break;
1966
-
1967
- if( $wp_query->is_tag ) // don't touch the tag feeds...
1968
- break;
1969
-
1970
- if( $wp_query->is_comment_feed ) // don't touch the comments feeds...
1971
- break;
1972
- } // important: no break here!
1973
- case 1: // All feeds
1974
- {
1975
- $powerpress_feed = array(); // Only store what's needed for each feed item
1976
- if( !empty($GeneralSettings['feed_accel']) )
1977
- $powerpress_feed['feed_accel'] = true;
1978
- $powerpress_feed['is_custom'] = false; // ($feed_slug == 'podcast'?true:false);
1979
- $powerpress_feed['feed-slug'] = $feed_slug;
1980
- $powerpress_feed['process_podpress'] = !empty($GeneralSettings['process_podpress']); // We don't touch podpress data for custom feeds
1981
- $powerpress_feed['default_url'] = '';
1982
- if( !empty($GeneralSettings['default_url']) )
1983
- $powerpress_feed['default_url'] = rtrim($GeneralSettings['default_url'], '/') .'/';
1984
- $explicit = array("no", "yes", "clean");
1985
- $powerpress_feed['explicit'] = 'no';
1986
- if( !empty($FeedSettingsBasic['itunes_explicit']) )
1987
- $powerpress_feed['explicit'] = $explicit[$FeedSettingsBasic['itunes_explicit']];
1988
- if( !empty($FeedSettingsBasic['itunes_talent_name']) )
1989
- $powerpress_feed['itunes_talent_name'] = $FeedSettingsBasic['itunes_talent_name'];
1990
- else
1991
- $powerpress_feed['itunes_talent_name'] = get_wp_title_rss();
1992
- $powerpress_feed['enhance_itunes_summary'] = 0;
1993
- if( isset($FeedSettingsBasic['enhance_itunes_summary']) )
1994
- $powerpress_feed['enhance_itunes_summary'] = $FeedSettingsBasic['enhance_itunes_summary'];
1995
- if( !empty($GeneralSettings['seo_itunes']) )
1996
- $powerpress_feed['enhance_itunes_summary'] = 1;
1997
- $powerpress_feed['posts_per_rss'] = false;
1998
- if( !empty($FeedSettingsBasic['posts_per_rss']) && is_numeric($FeedSettingsBasic['posts_per_rss']) && $FeedSettingsBasic['posts_per_rss'] > 0 )
1999
- $powerpress_feed['posts_per_rss'] = $FeedSettingsBasic['posts_per_rss'];
2000
- if( !empty($FeedSettingsBasic['itunes_author_post']) )
2001
- $powerpress_feed['itunes_author_post'] = true;
2002
- $powerpress_feed['rss_language'] = ''; // Cannot set the language setting in simple mode
2003
- if( !empty($GeneralSettings['podcast_embed_in_feed']) )
2004
- $powerpress_feed['podcast_embed_in_feed'] = true;
2005
- if( !empty($FeedSettingsBasic['episode_itunes_image']) && !empty($FeedSettingsBasic['itunes_image']) )
2006
- $powerpress_feed['itunes_image'] = $FeedSettingsBasic['itunes_image'];
2007
-
2008
- }; break;
2009
- // All other cases we let fall through
2010
- }
2011
- }
2012
- }
2013
- }
2014
-
2015
- // Returns true of the feed should be treated as a podcast feed
2016
- function powerpress_is_podcast_feed()
2017
- {
2018
- if( defined('PODPRESS_VERSION') || isset($GLOBALS['podcasting_player_id']) || isset($GLOBALS['podcast_channel_active']) || defined('PODCASTING_VERSION') )
2019
- return false; // Another podcasting plugin is enabled...
2020
-
2021
- global $powerpress_feed;
2022
- if( $powerpress_feed !== false && !is_array($powerpress_feed) )
2023
- powerpress_load_general_feed_settings();
2024
- if( $powerpress_feed === false )
2025
- return false;
2026
- return true;
2027
- }
2028
-
2029
- // Returns true if the feed is a custom feed added by PowerPress
2030
- function powerpress_is_custom_podcast_feed()
2031
- {
2032
- if( defined('PODPRESS_VERSION') || isset($GLOBALS['podcasting_player_id']) || isset($GLOBALS['podcast_channel_active']) || defined('PODCASTING_VERSION') )
2033
- return false; // Another podcasting plugin is enabled...
2034
-
2035
- global $powerpress_feed;
2036
- if( $powerpress_feed !== false && !is_array($powerpress_feed) )
2037
- powerpress_load_general_feed_settings();
2038
- if( $powerpress_feed === false )
2039
- return false;
2040
- return $powerpress_feed['is_custom'];
2041
- }
2042
-
2043
- function powerpress_posts_fields($cols)
2044
- {
2045
- if( !is_feed() )
2046
- return $cols;
2047
-
2048
- if( is_category() || is_tag() || is_tax() ) {
2049
- if( get_query_var('feed') !== 'podcast' )
2050
- return $cols;
2051
- }
2052
-
2053
- if( powerpress_is_custom_podcast_feed() || get_query_var('feed') === 'podcast' )
2054
- {
2055
- if( !empty($GLOBALS['powerpress_feed']['feed_accel']) )
2056
- {
2057
- $feed_slug = get_query_var('feed');
2058
- global $wpdb;
2059
- $cols .= ", pp_{$wpdb->postmeta}.meta_value AS podcast_meta_value ";
2060
- }
2061
- }
2062
-
2063
- return $cols;
2064
- }
2065
- //$fields = apply_filters_ref_array( 'posts_fields', array( $fields, &$this ) );
2066
- add_filter('posts_fields', 'powerpress_posts_fields' );
2067
-
2068
- function powerpress_posts_join($join)
2069
- {
2070
- if( !is_feed() )
2071
- return $join;
2072
-
2073
- if( is_category() || is_tag() || is_tax() ) {
2074
- if( get_query_var('feed') !== 'podcast' )
2075
- return $join;
2076
- }
2077
-
2078
- if( powerpress_is_custom_podcast_feed() || get_query_var('feed') === 'podcast' )
2079
- {
2080
- global $wpdb;
2081
- $join .= " INNER JOIN {$wpdb->postmeta} AS pp_{$wpdb->postmeta} ";
2082
- $join .= " ON {$wpdb->posts}.ID = pp_{$wpdb->postmeta}.post_id ";
2083
- }
2084
-
2085
- return $join;
2086
- }
2087
-
2088
- add_filter('posts_join', 'powerpress_posts_join' );
2089
-
2090
- function powerpress_posts_where($where)
2091
- {
2092
- if( !is_feed() )
2093
- return $where;
2094
- if( is_category() || is_tag() || is_tax() ) {
2095
- if( get_query_var('feed') !== 'podcast' )
2096
- return $where;
2097
- }
2098
-
2099
- if( powerpress_is_custom_podcast_feed() || get_query_var('feed') === 'podcast' )
2100
- {
2101
- global $wpdb, $powerpress_feed;
2102
- $where .= " AND (";
2103
-
2104
- if( powerpress_is_custom_podcast_feed() && get_query_var('feed') !== 'podcast' )
2105
- $where .= " pp_{$wpdb->postmeta}.meta_key = '_". get_query_var('feed') .":enclosure' ";
2106
- else
2107
- $where .= " pp_{$wpdb->postmeta}.meta_key = 'enclosure' ";
2108
-
2109
- // Include Podpress data if exists...
2110
- if( !empty($powerpress_feed['process_podpress']) && get_query_var('feed') === 'podcast' )
2111
- $where .= " OR pp_{$wpdb->postmeta}.meta_key = 'podPressMedia' OR pp_{$wpdb->postmeta}.meta_key = '_podPressMedia' ";
2112
-
2113
- $where .= ") ";
2114
- }
2115
- return $where;
2116
- }
2117
-
2118
- add_filter('posts_where', 'powerpress_posts_where' );
2119
-
2120
- // Add the groupby needed for enclosures only
2121
- function powerpress_posts_groupby($groupby)
2122
- {
2123
- if( !is_feed() )
2124
- return $groupby;
2125
-
2126
- if( is_category() || is_tag() || is_tax() ) {
2127
- if( get_query_var('feed') !== 'podcast' )
2128
- return $groupby;
2129
- }
2130
-
2131
- if( powerpress_is_custom_podcast_feed() || get_query_var('feed') === 'podcast' )
2132
- {
2133
- global $wpdb;
2134
- $groupby = " {$wpdb->posts}.ID ";
2135
- }
2136
- return $groupby;
2137
- }
2138
- add_filter('posts_groupby', 'powerpress_posts_groupby');
2139
-
2140
- function powerpress_post_limits($limits)
2141
- {
2142
- if( !is_feed() )
2143
- return $limits;
2144
-
2145
- if( powerpress_is_custom_podcast_feed() || get_query_var('feed') === 'podcast' )
2146
- {
2147
- global $powerpress_feed;
2148
- if( !empty($powerpress_feed['posts_per_rss']) && preg_match('/^(\d)+$/', trim($powerpress_feed['posts_per_rss'])) )
2149
- $limits = "LIMIT 0, {$powerpress_feed['posts_per_rss']}";
2150
- }
2151
- return $limits;
2152
- }
2153
- add_filter('post_limits', 'powerpress_post_limits');
2154
-
2155
-
2156
- function powerpress_do_all_pings()
2157
- {
2158
- global $wpdb;
2159
- $wpdb->query("DELETE FROM {$wpdb->postmeta} WHERE meta_key = '_encloseme' ");
2160
-
2161
- // Now call the WordPress do_all_pings()...
2162
- do_all_pings();
2163
- remove_action('do_pings', 'do_all_pings');
2164
- }
2165
-
2166
- remove_action('do_pings', 'do_all_pings');
2167
- add_action('do_pings', 'powerpress_do_all_pings', 1, 1);
2168
-
2169
- /*
2170
- Helper functions:
2171
- */
2172
- function powerpress_podpress_redirect_check()
2173
- {
2174
- if( preg_match('/podpress_trac\/([^\/]+)\/([^\/]+)\/([^\/]+)\/(.*)$/', $_SERVER['REQUEST_URI'], $matches) )
2175
- {
2176
- $post_id = $matches[2];
2177
- $mediaNum = $matches[3];
2178
- //$filename = $matches[4];
2179
- //$method = $matches[1];
2180
-
2181
- if( is_numeric($post_id) && is_numeric($mediaNum))
2182
- {
2183
- $EpisodeData = powerpress_get_enclosure_data_podpress($post_id, $mediaNum);
2184
- if( $EpisodeData && isset($EpisodeData['url']) )
2185
- {
2186
- if( strpos($EpisodeData['url'], 'http://' ) !== 0 && strpos($EpisodeData['url'], 'https://' ) !== 0 )
2187
- {
2188
- die('Error occurred obtaining the URL for the requested media file.');
2189
- exit;
2190
- }
2191
-
2192
- $EnclosureURL = str_replace(' ', '%20', $EpisodeData['url']);
2193
- header('Location: '.$EnclosureURL, true, 302);
2194
- header('Content-Length: 0');
2195
- exit;
2196
- }
2197
- // Let the WordPress 404 page load as normal
2198
- }
2199
- }
2200
- }
2201
-
2202
- function the_powerpress_content()
2203
- {
2204
- echo get_the_powerpress_content();
2205
- }
2206
-
2207
- function get_the_powerpress_content()
2208
- {
2209
- global $post;
2210
-
2211
- if( defined('PODPRESS_VERSION') || isset($GLOBALS['podcasting_player_id']) || isset($GLOBALS['podcast_channel_active']) || defined('PODCASTING_VERSION') )
2212
- return '';
2213
-
2214
- if( function_exists('post_password_required') )
2215
- {
2216
- if( post_password_required($post) )
2217
- return '';
2218
- }
2219
-
2220
- // PowerPress settings:
2221
- $GeneralSettings = get_option('powerpress_general');
2222
-
2223
- // No player or links to add to content...
2224
- if( !empty($GeneralSettings['disable_appearance']) )
2225
- return $content;
2226
-
2227
- if( !isset($GeneralSettings['custom_feeds']) )
2228
- $GeneralSettings['custom_feeds'] = array('podcast'=>'Default Podcast Feed');
2229
-
2230
- // Re-order so the default podcast episode is the top most...
2231
- $Temp = $GeneralSettings['custom_feeds'];
2232
- $GeneralSettings['custom_feeds'] = array();
2233
- $GeneralSettings['custom_feeds']['podcast'] = 'Default Podcast Feed';
2234
-
2235
- foreach( $Temp as $feed_slug=> $feed_title )
2236
- {
2237
- if( $feed_slug == 'podcast' )
2238
- continue;
2239
- $GeneralSettings['custom_feeds'][ $feed_slug ] = $feed_title;
2240
- }
2241
-
2242
- // Handle post type feeds....
2243
- if( !empty($GeneralSettings['posttype_podcasting']) )
2244
- {
2245
- $post_type = get_query_var('post_type');
2246
- if ( is_array( $post_type ) ) {
2247
- $post_type = reset( $post_type ); // get first element in array
2248
- }
2249
-
2250
- // Get the feed slugs and titles for this post type
2251
- $PostTypeSettingsArray = get_option('powerpress_posttype_'.$post_type);
2252
- // Loop through this array of post type settings...
2253
- if( !empty($PostTypeSettingsArray) )
2254
- {
2255
- switch($post_type)
2256
- {
2257
- case 'post':
2258
- case 'page': {
2259
- // Do nothing!, we want the default podcast to appear in these post types
2260
- }; break;
2261
- default: {
2262
- if( !empty($post_type) && empty($PostTypeSettingsArray['podcast']) )
2263
- 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
2264
- }; break;
2265
- }
2266
-
2267
- foreach( $PostTypeSettingsArray as $feed_slug=> $postTypeSettings )
2268
- {
2269
- if( !empty( $postTypeSettings['title']) )
2270
- $GeneralSettings['custom_feeds'][ $feed_slug ] = $postTypeSettings['title'];
2271
- else
2272
- $GeneralSettings['custom_feeds'][ $feed_slug ] = $feed_slug;
2273
- }
2274
- }
2275
- }
2276
-
2277
- if( !isset($GeneralSettings['display_player']) )
2278
- $GeneralSettings['display_player'] = 1;
2279
- if( !isset($GeneralSettings['player_function']) )
2280
- $GeneralSettings['player_function'] = 1;
2281
- if( !isset($GeneralSettings['podcast_link']) )
2282
- $GeneralSettings['podcast_link'] = 1;
2283
-
2284
- // Figure out which players are alerady in the body of the page...
2285
- $ExcludePlayers = array();
2286
- if( isset($GeneralSettings['disable_player']) )
2287
- $ExcludePlayers = $GeneralSettings['disable_player']; // automatically disable the players configured
2288
-
2289
- // LOOP HERE TO DISPLAY EACH MEDIA TYPE
2290
- $new_content = '';
2291
- foreach( $GeneralSettings['custom_feeds'] as $feed_slug=> $feed_title )
2292
- {
2293
- // Get the enclosure data
2294
- $EpisodeData = powerpress_get_enclosure_data($post->ID, $feed_slug);
2295
-
2296
- if( !$EpisodeData && !empty($GeneralSettings['process_podpress']) && $feed_slug == 'podcast' )
2297
- $EpisodeData = powerpress_get_enclosure_data_podpress($post->ID);
2298
-
2299
- if( !$EpisodeData || !$EpisodeData['url'] )
2300
- continue;
2301
-
2302
- // Just in case, if there's no URL lets escape!
2303
- if( !$EpisodeData['url'] )
2304
- continue;
2305
-
2306
- // If the player is not already inserted in the body of the post using the shortcode...
2307
- //if( preg_match('/\[powerpress(.*)\]/is', $content) == 0 )
2308
- if( !isset($ExcludePlayers[ $feed_slug ]) ) // If the player is not in our exclude list because it's already in the post body somewhere...
2309
- {
2310
- if( isset($GeneralSettings['premium_caps']) && $GeneralSettings['premium_caps'] && !powerpress_premium_content_authorized($feed_slug) )
2311
- {
2312
- $new_content .= powerpress_premium_content_message($post->ID, $feed_slug, $EpisodeData);
2313
- }
2314
- else
2315
- {
2316
- if( $GeneralSettings['player_function'] != 3 && $GeneralSettings['player_function'] != 0 ) // Play in new window only or disabled
2317
- {
2318
- do_action('wp_powerpress_player_scripts');
2319
- $AddDefaultPlayer = empty($EpisodeData['no_player']);
2320
-
2321
- if( $EpisodeData && !empty($EpisodeData['embed']) )
2322
- {
2323
- $new_content .= trim($EpisodeData['embed']);
2324
- if( !empty($GeneralSettings['embed_replace_player']) )
2325
- $AddDefaultPlayer = false;
2326
- }
2327
-
2328
- if( $AddDefaultPlayer )
2329
- {
2330
- $image = '';
2331
- $width = '';
2332
- $height = '';
2333
- if( isset($EpisodeData['image']) && $EpisodeData['image'] != '' )
2334
- $image = $EpisodeData['image'];
2335
- if( !empty($EpisodeData['width']) && is_numeric($EpisodeData['width']) )
2336
- $width = $EpisodeData['width'];
2337
- if( !empty($EpisodeData['height']) && is_numeric($EpisodeData['height']) )
2338
- $height = $EpisodeData['height'];
2339
-
2340
- $new_content .= apply_filters('powerpress_player', '', powerpress_add_flag_to_redirect_url($EpisodeData['url'], 'p'), $EpisodeData );
2341
- }
2342
- }
2343
-
2344
- if( !isset($EpisodeData['no_links']) )
2345
- {
2346
- do_action('wp_powerpress_player_scripts');
2347
- $new_content .= apply_filters('powerpress_player_links', '', powerpress_add_flag_to_redirect_url($EpisodeData['url'], 'p'), $EpisodeData );
2348
- $new_content .= apply_filters('powerpress_player_subscribe_links', '', powerpress_add_flag_to_redirect_url($EpisodeData['url'], 'p'), $EpisodeData );
2349
- }
2350
- }
2351
- }
2352
- }
2353
-
2354
- return $new_content;
2355
- }
2356
-
2357
-
2358
-
2359
- // Adds content types that are missing from the default wp_check_filetype function
2360
- function powerpress_get_contenttype($file, $use_wp_check_filetype = true)
2361
- {
2362
- $parts = pathinfo($file);
2363
- if( !empty($parts['extension']) )
2364
- {
2365
- switch( strtolower($parts['extension']) )
2366
- {
2367
- // Audio formats
2368
- case 'mp3': // most common
2369
- case 'mpga':
2370
- case 'mp2':
2371
- case 'mp2a':
2372
- case 'm2a':
2373
- case 'm3a':
2374
- return 'audio/mpeg';
2375
- case 'm4a':
2376
- return 'audio/x-m4a';
2377
- case 'm4b': // Audio book format
2378
- return 'audio/m4b';
2379
- case 'm4r': // iPhone ringtone format
2380
- return 'audio/m4r';
2381
- // OGG Internet content types as set forth by rfc5334 (http://tools.ietf.org/html/rfc5334)
2382
- case 'opus':
2383
- case 'oga':
2384
- case 'spx':
2385
- return 'audio/ogg';
2386
- case 'wma':
2387
- return 'audio/x-ms-wma';
2388
- case 'wax':
2389
- return 'audio/x-ms-wax';
2390
- case 'ra':
2391
- case 'ram':
2392
- return 'audio/x-pn-realaudio';
2393
- case 'mp4a':
2394
- return 'audio/mp4';
2395
-
2396
- // Video formats
2397
- case 'm4v':
2398
- return 'video/x-m4v';
2399
- case 'mpeg':
2400
- case 'mpg':
2401
- case 'mpe':
2402
- case 'm1v':
2403
- case 'm2v':
2404
- return 'video/mpeg';
2405
- case 'mp4':
2406
- case 'mp4v':
2407
- case 'mpg4':
2408
- return 'video/mp4';
2409
- case 'asf':
2410
- case 'asx':
2411
- return 'video/x-ms-asf';
2412
- case 'wmx':
2413
- return 'video/x-ms-wmx';
2414
- case 'avi':
2415
- return 'video/x-msvideo';
2416
- case 'wmv':
2417
- return 'video/x-ms-wmv'; // Check this
2418
- case 'flv':
2419
- return 'video/x-flv';
2420
- case 'mov':
2421
- case 'qt':
2422
- return 'video/quicktime';
2423
- case 'divx':
2424
- return 'video/divx';
2425
- case '3gp':
2426
- return 'video/3gpp';
2427
- case 'webm':
2428
- return 'video/webm';
2429
- case 'ogg': {
2430
- if( !defined('POWERPRESS_OGG_VIDEO') )
2431
- return 'audio/ogg';
2432
- } // Let this fall through as ogg/video
2433
- case 'ogv':
2434
- return 'video/ogg';
2435
-
2436
- // rarely used
2437
- case 'mid':
2438
- case 'midi':
2439
- return 'audio/midi';
2440
- case 'wav':
2441
- return 'audio/wav';
2442
- case 'aa':
2443
- return 'audio/audible';
2444
- case 'pdf':
2445
- return 'application/pdf';
2446
- case 'torrent':
2447
- return 'application/x-bittorrent';
2448
- case 'swf':
2449
- return 'application/x-shockwave-flash';
2450
- case 'ogx':
2451
- return 'application/ogg';
2452
-
2453
- // Most recently added by Apple:
2454
- case 'epub':
2455
- return 'document/x-epub';
2456
-
2457
- default: // Let it fall through
2458
- }
2459
- }
2460
-
2461
- // Last case let wordpress detect it:
2462
- if( $use_wp_check_filetype )
2463
- {
2464
- $FileType = wp_check_filetype($file);
2465
- if( $FileType && isset($FileType['type']) )
2466
- return $FileType['type'];
2467
- }
2468
- return '';
2469
- }
2470
-
2471
-
2472
- function powerpress_itunes_categories($PrefixSubCategories = false)
2473
- {
2474
- $temp = array();
2475
- $temp['01-00'] = 'Arts';
2476
- $temp['01-01'] = 'Design';
2477
- $temp['01-02'] = 'Fashion & Beauty';
2478
- $temp['01-03'] = 'Food';
2479
- $temp['01-04'] = 'Literature';
2480
- $temp['01-05'] = 'Performing Arts';
2481
- $temp['01-06'] = 'Visual Arts';
2482
-
2483
- $temp['02-00'] = 'Business';
2484
- $temp['02-01'] = 'Business News';
2485
- $temp['02-02'] = 'Careers';
2486
- $temp['02-03'] = 'Investing';
2487
- $temp['02-04'] = 'Management & Marketing';
2488
- $temp['02-05'] = 'Shopping';
2489
-
2490
- $temp['03-00'] = 'Comedy';
2491
-
2492
- $temp['04-00'] = 'Education';
2493
- $temp['04-01'] = 'Education Technology';
2494
- $temp['04-02'] = 'Higher Education';
2495
- $temp['04-03'] = 'K-12';
2496
- $temp['04-04'] = 'Language Courses';
2497
- $temp['04-05'] = 'Training';
2498
-
2499
- $temp['05-00'] = 'Games & Hobbies';
2500
- $temp['05-01'] = 'Automotive';
2501
- $temp['05-02'] = 'Aviation';
2502
- $temp['05-03'] = 'Hobbies';
2503
- $temp['05-04'] = 'Other Games';
2504
- $temp['05-05'] = 'Video Games';
2505
-
2506
- $temp['06-00'] = 'Government & Organizations';
2507
- $temp['06-01'] = 'Local';
2508
- $temp['06-02'] = 'National';
2509
- $temp['06-03'] = 'Non-Profit';
2510
- $temp['06-04'] = 'Regional';
2511
-
2512
- $temp['07-00'] = 'Health';
2513
- $temp['07-01'] = 'Alternative Health';
2514
- $temp['07-02'] = 'Fitness & Nutrition';
2515
- $temp['07-03'] = 'Self-Help';
2516
- $temp['07-04'] = 'Sexuality';
2517
-
2518
- $temp['08-00'] = 'Kids & Family';
2519
-
2520
- $temp['09-00'] = 'Music';
2521
-
2522
- $temp['10-00'] = 'News & Politics';
2523
-
2524
- $temp['11-00'] = 'Religion & Spirituality';
2525
- $temp['11-01'] = 'Buddhism';
2526
- $temp['11-02'] = 'Christianity';
2527
- $temp['11-03'] = 'Hinduism';
2528
- $temp['11-04'] = 'Islam';
2529
- $temp['11-05'] = 'Judaism';
2530
- $temp['11-06'] = 'Other';
2531
- $temp['11-07'] = 'Spirituality';
2532
-
2533
- $temp['12-00'] = 'Science & Medicine';
2534
- $temp['12-01'] = 'Medicine';
2535
- $temp['12-02'] = 'Natural Sciences';
2536
- $temp['12-03'] = 'Social Sciences';
2537
-
2538
- $temp['13-00'] = 'Society & Culture';
2539
- $temp['13-01'] = 'History';
2540
- $temp['13-02'] = 'Personal Journals';
2541
- $temp['13-03'] = 'Philosophy';
2542
- $temp['13-04'] = 'Places & Travel';
2543
-
2544
- $temp['14-00'] = 'Sports & Recreation';
2545
- $temp['14-01'] = 'Amateur';
2546
- $temp['14-02'] = 'College & High School';
2547
- $temp['14-03'] = 'Outdoor';
2548
- $temp['14-04'] = 'Professional';
2549
-
2550
- $temp['15-00'] = 'Technology';
2551
- $temp['15-01'] = 'Gadgets';
2552
- $temp['15-02'] = 'Tech News';
2553
- $temp['15-03'] = 'Podcasting';
2554
- $temp['15-04'] = 'Software How-To';
2555
-
2556
- $temp['16-00'] = 'TV & Film';
2557
-
2558
- if( $PrefixSubCategories )
2559
- {
2560
- foreach( $temp as $key=> $val )
2561
- {
2562
- $parts = explode('-', $key);
2563
- $cat = $parts[0];
2564
- $subcat = $parts[1];
2565
-
2566
- if( $subcat != '00' )
2567
- $temp[$key] = $temp[$cat.'-00'].' > '.$val;
2568
- }
2569
- reset($temp);
2570
- }
2571
-
2572
- return $temp;
2573
- }
2574
-
2575
-
2576
- function powerpress_googleplay_categories()
2577
- {
2578
- $temp = array();
2579
- $temp['01-00'] = 'Arts';
2580
- $temp['02-00'] = 'Business';
2581
- $temp['03-00'] = 'Comedy';
2582
- $temp['04-00'] = 'Education';
2583
- $temp['05-00'] = 'Games & Hobbies';
2584
- $temp['06-00'] = 'Government & Organizations';
2585
- $temp['07-00'] = 'Health';
2586
- $temp['08-00'] = 'Kids & Family';
2587
- $temp['09-00'] = 'Music';
2588
- $temp['10-00'] = 'News & Politics';
2589
- $temp['11-00'] = 'Religion & Spirituality';
2590
- $temp['12-00'] = 'Science & Medicine';
2591
- $temp['13-00'] = 'Society & Culture';
2592
- $temp['14-00'] = 'Sports & Recreation';
2593
- $temp['15-00'] = 'Technology';
2594
- $temp['16-00'] = 'TV & Film';
2595
-
2596
- return $temp;
2597
- }
2598
-
2599
- function powerpress_get_root_url()
2600
- {
2601
- /*
2602
- // OLD CODE:
2603
- $powerpress_dirname = basename( POWERPRESS_ABSPATH );
2604
- return WP_PLUGIN_URL . '/'. $powerpress_dirname .'/';
2605
- */
2606
- $local_path = __FILE__;
2607
- if( DIRECTORY_SEPARATOR == '\\' ) { // Win32 fix
2608
- $local_path = basename(dirname(__FILE__)) .'/'. basename(__FILE__);
2609
- }
2610
- $plugin_url = plugins_url('', $local_path);
2611
- return $plugin_url . '/';
2612
- }
2613
-
2614
- function powerpress_get_the_exerpt($for_summary = false, $no_filters = false, $post_id = false)
2615
- {
2616
- if( $no_filters ) {
2617
- if( $post_id > 0 ) {
2618
- $post = get_post($post_id);
2619
- $subtitle = $post->post_excerpt;
2620
- if ( $subtitle == '') {
2621
-
2622
- $subtitle = $post->post_content;
2623
- $shortcodesTemp = $GLOBALS['shortcode_tags'];
2624
- $GLOBALS['shortcode_tags']['skipto'] = 'powerpress_shortcode_skipto';
2625
- $subtitle = do_shortcode($subtitle);
2626
- $GLOBALS['shortcode_tags'] = $shortcodesTemp;
2627
-
2628
- $subtitle = strip_shortcodes( $subtitle );
2629
- $subtitle = str_replace(']]>', ']]&gt;', $subtitle);
2630
- $subtitle = strip_tags($subtitle);
2631
- }
2632
- }
2633
- else if( is_object($GLOBALS['post']) )
2634
- {
2635
- $subtitle = $GLOBALS['post']->post_excerpt;
2636
- if ( $subtitle == '') {
2637
-
2638
- $subtitle = $GLOBALS['post']->post_content;
2639
-
2640
- $shortcodesTemp = $GLOBALS['shortcode_tags'];
2641
- $GLOBALS['shortcode_tags']['skipto'] = 'powerpress_shortcode_skipto';
2642
- $subtitle = do_shortcode($subtitle);
2643
- $GLOBALS['shortcode_tags'] = $shortcodesTemp;
2644
-
2645
- $subtitle = strip_shortcodes( $subtitle );
2646
- $subtitle = str_replace(']]>', ']]&gt;', $subtitle);
2647
- $subtitle = strip_tags($subtitle);
2648
- }
2649
- }
2650
- } else {
2651
- $subtitle = get_the_excerpt();
2652
- }
2653
-
2654
- $subtitle = trim( strip_tags( $subtitle ) );
2655
- if( !empty($subtitle) )
2656
- return $subtitle;
2657
- return powerpress_get_the_content( $for_summary, $no_filters );
2658
- }
2659
-
2660
- function powerpress_get_the_content($for_summary = true, $no_filters = false, $no_strip_tags = false) {
2661
- if( $no_filters ) {
2662
- global $post;
2663
- $content_no_html = $post->post_content;
2664
-
2665
- $shortcodesTemp = $GLOBALS['shortcode_tags'];
2666
- $GLOBALS['shortcode_tags']['skipto'] = 'powerpress_shortcode_skipto';
2667
- $content_no_html = do_shortcode($content_no_html);
2668
- $GLOBALS['shortcode_tags'] = $shortcodesTemp;
2669
-
2670
- //$content_no_html = strip_shortcodes( $content_no_html );
2671
- $content_no_html = str_replace(']]>', ']]&gt;', $content_no_html);
2672
- $content_no_html = wp_staticize_emoji( _oembed_filter_feed_content( $content_no_html ) );
2673
- } else {
2674
- $content_no_html = get_the_content();
2675
- }
2676
-
2677
- $content_no_html = strip_shortcodes( $content_no_html );
2678
- if( $no_strip_tags )
2679
- return $content_no_html;
2680
-
2681
- if( $for_summary ) {
2682
- return trim( strip_tags($content_no_html, '<a><p><br><ul><li>') );
2683
- }
2684
- return trim( strip_tags($content_no_html) );
2685
- }
2686
-
2687
- function powerpress_enhanced_itunes_summary($no_filters = false)
2688
- {
2689
- if( $no_filters ) {
2690
- $summary = powerpress_get_the_content(false, true, true);
2691
- } else {
2692
- $summary = apply_filters( 'the_content', powerpress_get_the_content(false, $no_filters, true) );
2693
- }
2694
- $summary = str_replace("<li>", '<li>* ', $summary); // Make sure our bullet lists stay nicely formatted.
2695
- $summary = strip_tags($summary, '<a>'); // We can leave a tags for itunes:summary, this will also strip CDATA tags
2696
- return $summary;
2697
- }
2698
-
2699
- function powerpress_url_in_feed($url) {
2700
- if( defined('POWERPRESS_FEEDS_FORCE_HTTP') && is_feed() ) {
2701
- if( preg_match('/^https:\/\/(.*)$/', $url, $matches) ) {
2702
- return 'http://'.$matches[1];
2703
- }
2704
- }
2705
- else if( defined('POWERPRESS_FEEDS_FORCE_HTTPS') && is_feed() ) {
2706
- if( preg_match('/^http:\/\/(.*)$/', $url, $matches) ) {
2707
- return 'https://'.$matches[1];
2708
- }
2709
- }
2710
- return $url;
2711
- }
2712
-
2713
- function powerpress_format_itunes_value($value, $tag, $cdata=false)
2714
- {
2715
- if( $tag == 'summary' )
2716
- $value = nl2br($value); // Does not remove existing br tags if present.
2717
-
2718
- if( $cdata ) {
2719
- $value = str_replace(']]>', ']]&gt;', $value);
2720
- return powerpress_trim_itunes_value($value, $tag);
2721
- }
2722
-
2723
- if( !defined('POWERPRESS_DISABLE_ITUNES_UTF8') || POWERPRESS_DISABLE_ITUNES_UTF8 == false ) // If not defined or it is false
2724
- {
2725
- global $wpdb;
2726
- switch( $wpdb->charset )
2727
- {
2728
- case 'utf8': break;
2729
- case 'utf8mb3': break;
2730
- case 'utf8mb4': break;
2731
- default: {
2732
-
2733
- // preg_match fails when it encounters invalid UTF8 in $string
2734
- if ( 1 !== @preg_match( '/^./us', $value ) ) {
2735
- $value = utf8_encode($value); // If it is not, convert to UTF-8 then decode it...
2736
- }
2737
- }
2738
- }
2739
- }
2740
-
2741
- // Code added to solve issue with KimiliFlashEmbed plugin and also remove the shortcode for the WP Audio Player
2742
- // 99.9% of the time this code will not be necessary
2743
- $value = preg_replace("/\[(kml_(flash|swf)embed|audio\:)\b(.*?)(?:(\/))?(\]|$)/isu", '', $value);
2744
- $value = @html_entity_decode($value, ENT_COMPAT, 'UTF-8'); // Remove any additional entities such as &nbsp;
2745
- $value = preg_replace( '/&amp;/ui' , '&', $value); // Precaution in case it didn't get removed from function above.
2746
-
2747
- return esc_html( powerpress_trim_itunes_value($value, $tag) );
2748
- }
2749
-
2750
- function powerpress_trim_itunes_value($value, $tag = 'summary')
2751
- {
2752
- $value = trim($value); // First we need to trim the string
2753
- $length = (function_exists('mb_strlen')?mb_strlen($value):strlen($value) );
2754
- $trim_at = false;
2755
- $remove_new_lines = false;
2756
-
2757
- switch($tag)
2758
- {
2759
- case 'description':
2760
- case 'summary': {
2761
- // 4000 character limit
2762
- if( $length > 4000 )
2763
- $trim_at = 3997; // 3 less characters so we can add a dot dot dot
2764
- }; break;
2765
- case 'subtitle':
2766
- case 'author':
2767
- case 'name':
2768
- default: {
2769
- $remove_new_lines = true;
2770
- // 255 character limit
2771
- if( $length > 255 )
2772
- $trim_at = 252; // Allow 3 dots to be added after the trim
2773
- };
2774
- }
2775
-
2776
- if( $trim_at )
2777
- {
2778
- // Start trimming
2779
- $value = (function_exists('mb_substr')?mb_substr($value, 0, $trim_at):substr($value, 0, $trim_at) );
2780
- $clean_break = false;
2781
- if( preg_match('/(.*[,\n.\?!])[^,\n.\?!]/isu', $value, $matches) ) // pattern modifiers: case (i)nsensitive, entire (s)tring and (u)nicode
2782
- {
2783
- if( isset( $matches[1]) )
2784
- {
2785
- $detected_eof_pos = (function_exists('mb_strlen')?mb_strlen($matches[1]):strlen($matches[1]) );
2786
- // Look back at most 50 characters...
2787
- if( $detected_eof_pos > 3950 || ($detected_eof_pos > 205 && $detected_eof_pos < 255 ) )
2788
- {
2789
- $value = $matches[1];
2790
- $clean_break = true;
2791
- }
2792
- // Otherwise we want to continue with the same value we started with...
2793
- }
2794
- }
2795
-
2796
- if( $clean_break == false && $tag = 'subtitle' ) // Subtitle we want to add a ... at the end
2797
- {
2798
- if( $trim_at )
2799
- $value = (function_exists('mb_substr')?mb_substr($value, 0, $trim_at):substr($value, 0, $trim_at) ). '...';
2800
- }
2801
- }
2802
-
2803
- if( $remove_new_lines )
2804
- $value = str_replace( array("\r\n\r\n", "\n", "\r", "\t","- "), array(' - ',' ', '', ' ', ''), $value );
2805
-
2806
- return $value;
2807
- }
2808
-
2809
- function powerpress_add_redirect_url($MediaURL, $EpisodeData = false) // $channel = 'podcast')
2810
- {
2811
- if( preg_match('/^https?:\/\//i', $MediaURL) == 0 )
2812
- return $MediaURL; // If the user is hosting media not via http (e.g. ftp) then we can't handle the redirect
2813
-
2814
- if( !is_array($EpisodeData) )
2815
- {
2816
- $feed_slug = '';
2817
- if( is_string($EpisodeData) && !empty($EpisodeData) ) {
2818
- $feed_slug = $EpisodeData;
2819
- }
2820
-
2821
- $EpisodeData = array();
2822
- if( !empty($feed_slug) )
2823
- $EpisodeData['feed'] = $EpisodeData;
2824
- }
2825
-
2826
- if( empty($EpisodeData['feed']) )
2827
- $EpisodeData['feed'] = 'podcast';
2828
-
2829
- $NewURL = apply_filters( 'powerpress_redirect_url', $MediaURL, $EpisodeData );
2830
-
2831
- $URLScheme = ( (preg_match('/^https:\/\//i', $NewURL) != 0 ) ? 'https://':'http://');
2832
-
2833
- $GeneralSettings = get_option('powerpress_general');
2834
- $Redirects = array('redirect0'=>'', 'redirect1'=>'', 'redirect2'=>'', 'redirect3'=>'');
2835
- if( !empty($GeneralSettings['redirect1']) )
2836
- $Redirects['redirect1'] = $GeneralSettings['redirect1'];
2837
- if( !empty($GeneralSettings['redirect2']) )
2838
- $Redirects['redirect2'] = $GeneralSettings['redirect2'];
2839
- if( !empty($GeneralSettings['redirect3']) )
2840
- $Redirects['redirect3'] = $GeneralSettings['redirect3'];
2841
-
2842
- if( !empty($GeneralSettings['cat_casting']) ) { // If category podcasting...
2843
-
2844
- if( !empty($EpisodeData['category']) ) {
2845
-
2846
- $FeedCatSettings = get_option('powerpress_cat_feed_'.$EpisodeData['category'] );
2847
- if( !empty($FeedCatSettings['redirect']) ) {
2848
- $Redirects['redirect0'] = $FeedCatSettings['redirect'];
2849
- $Redirects['redirect1'] = '';
2850
- $Redirects['redirect2'] = '';
2851
- $Redirects['redirect3'] = '';
2852
- }
2853
- if( !empty($FeedCatSettings['redirect2']) ) {
2854
- $Redirects['redirect1'] = $FeedCatSettings['redirect2'];
2855
- }
2856
- } else { // Use the old way
2857
-
2858
- if( is_category() ) { // Special case where we want to track the category separately
2859
- $FeedCatSettings = get_option('powerpress_cat_feed_'.get_query_var('cat') );
2860
- if( $FeedCatSettings && !empty($FeedCatSettings['redirect']) ) {
2861
- $Redirects['redirect0'] = $FeedCatSettings['redirect'];
2862
- $Redirects['redirect1'] = '';
2863
- $Redirects['redirect2'] = '';
2864
- $Redirects['redirect3'] = '';
2865
- if( !empty($FeedCatSettings['redirect2']) ) {
2866
- $Redirects['redirect1'] = $FeedCatSettings['redirect2'];
2867
- }
2868
- }
2869
- } else if( is_single() ) {
2870
- $categories = wp_get_post_categories( get_the_ID() );
2871
- if( count($categories) == 1 ) { // See if only one category is associated with this post
2872
- foreach( $categories as $null=> $cat_id ) {
2873
- break;
2874
- }
2875
- $FeedCatSettings = get_option('powerpress_cat_feed_'.$cat_id );
2876
- if( $FeedCatSettings && !empty($FeedCatSettings['redirect']) ) {
2877
- $Redirects['redirect0'] = $FeedCatSettings['redirect'];
2878
- $Redirects['redirect1'] = '';
2879
- $Redirects['redirect2'] = '';
2880
- $Redirects['redirect3'] = '';
2881
- if( !empty($FeedCatSettings['redirect2']) ) {
2882
- $Redirects['redirect1'] = $FeedCatSettings['redirect2'];
2883
- }
2884
- }
2885
- }
2886
- }
2887
- }
2888
- }
2889
-
2890
- //custom_feeds
2891
- if( !empty($GeneralSettings['channels']) ) {
2892
-
2893
- $FeedSettings = get_option('powerpress_feed_'. $EpisodeData['feed']);
2894
- if( !empty($FeedSettings['redirect']) )
2895
- {
2896
- // Override the redirect
2897
- $Redirects['redirect0'] = $FeedSettings['redirect'];
2898
- $Redirects['redirect1'] = '';
2899
- $Redirects['redirect2'] = '';
2900
- $Redirects['redirect3'] = '';
2901
- }
2902
- if( !empty($FeedSettings['redirect2']) ) {
2903
- $Redirects['redirect1'] = $FeedSettings['redirect2'];
2904
- }
2905
- }
2906
-
2907
- if( !empty($GeneralSettings['posttype_podcasting']) ) // Post Type Podcasting
2908
- {
2909
- $post_type = get_post_type();
2910
- switch($post_type) {
2911
- case 'post':
2912
- case 'page': {
2913
- // Do nothing!, we want the default podcast and channels to appear in these post types
2914
- }; break;
2915
- default: {
2916
- $PostTypeSettingsArray = get_option('powerpress_posttype_'.$post_type);
2917
-
2918
- // We found a post type statsitics tracking
2919
- if( !empty($PostTypeSettingsArray[ $EpisodeData['feed'] ]['redirect']) )
2920
- {
2921
- $Redirects['redirect0'] = $PostTypeSettingsArray[ $EpisodeData['feed'] ]['redirect'];
2922
- $Redirects['redirect1'] = '';
2923
- $Redirects['redirect2'] = '';
2924
- $Redirects['redirect3'] = '';
2925
- }
2926
- if( !empty($PostTypeSettingsArray[ $EpisodeData['feed'] ]['redirect2']) ) {
2927
- $Redirects['redirect1'] = $PostTypeSettingsArray[ $EpisodeData['feed'] ]['redirect2'];
2928
- }
2929
- };
2930
- }
2931
- }
2932
-
2933
- if( version_compare($GLOBALS['wp_version'], 4.5, '>=' ) )
2934
- {
2935
- if( !empty($GeneralSettings['taxonomy_podcasting']) ) // Taxonomy Podcasting
2936
- {
2937
- $PowerPressTaxonomies = get_option('powerpress_taxonomy_podcasting');
2938
- if( !empty($PowerPressTaxonomies) )
2939
- {
2940
- $terms = get_terms();
2941
- $ttid_found = 0;
2942
- $TaxonomySettings = false;
2943
-
2944
- foreach( $terms as $index=> $termObj )
2945
- {
2946
- // Skip the default taxonomies
2947
- if( $termObj->taxonomy == 'category' || $termObj->taxonomy == 'link_category' || $termObj->taxonomy == 'post_tag' || $termObj->taxonomy == 'nav_menu' )
2948
- continue;
2949
-
2950
- if( !empty($PowerPressTaxonomies[ $termObj->term_taxonomy_id ]) )
2951
- {
2952
- $ttid_found = $termObj->term_taxonomy_id;
2953
-
2954
- $TaxonomySettings = get_option('powerpress_taxonomy_'.$ttid_found);
2955
- // Found it???
2956
- if( !empty($TaxonomySettings['redirect']) )
2957
- {
2958
- $Redirects['redirect0'] = $TaxonomySettings['redirect'];
2959
- $Redirects['redirect1'] = '';
2960
- $Redirects['redirect2'] = '';
2961
- $Redirects['redirect3'] = '';
2962
- break;
2963
- }
2964
- }
2965
- }
2966
- }
2967
- }
2968
- }
2969
-
2970
- // Allow other apps to update the redirects
2971
- $Redirects = apply_filters('powerpress_redirects', $Redirects, $EpisodeData);
2972
-
2973
- for( $x = 3; $x >= 0; $x-- )
2974
- {
2975
- $key = sprintf('redirect%d', $x);
2976
- if( !empty($Redirects[ $key ]) )
2977
- {
2978
- if( preg_match('/^https?:\/\/(.*)$/', trim($Redirects[ $key ]) , $matches ) == 0 )
2979
- continue;
2980
-
2981
- $RedirectClean = $matches[1];
2982
- if( substr($RedirectClean, -1, 1) != '/' ) // Rediercts need to end with a slash /.
2983
- $RedirectClean .= '/';
2984
-
2985
- if( !empty($RedirectClean) )
2986
- {
2987
- if( strpos($RedirectClean, '/') == 0 ) // Not a valid redirect URL
2988
- continue;
2989
-
2990
-
2991
- // Check that redirect is either media.blubrry.com, media.techpodcasts.com, media.rawvoice.com, or *.podtrac.com
2992
- $ValidRedirectDomains = array('media.blubrry.com', 'media.rawvoice.com', 'media.techpodcasts.com', 'www.podtrac.com', 'podtrac.com');
2993
- $ValidRedirectDomainsPattern = '/^(media\.blubrry\.com|media\.rawvoice\.com|media\.techpodcasts\.com|.*\.podtrac\.com|traffic\.cast\.plus)$/';
2994
- if( $URLScheme == 'https://' ) {
2995
- $ValidRedirectDomains = array('media.blubrry.com', 'media.rawvoice.com', 'www.podtrac.com', 'podtrac.com'); // Only URLs that support https:// to an https:// media file
2996
- $ValidRedirectDomainsPattern = '/^(media\.blubrry\.com|media\.rawvoice\.com|.*\.podtrac\.com|traffic\.cast\.plus)$/';
2997
- }
2998
-
2999
- $RedirectDomain = strtolower(substr($RedirectClean, 0, strpos($RedirectClean, '/') ));
3000
-
3001
- if( preg_match($ValidRedirectDomainsPattern, $RedirectDomain) == 0 )
3002
- continue;
3003
-
3004
- //if( !in_array($RedirectDomain, $ValidRedirectDomains) )
3005
- // continue; // Not a valid domain so lets not add it
3006
-
3007
- // Make sure we are no longer doubling up on media.blubrry.com or media.rawvoice.com redirects
3008
- //if( ($RedirectDomain == 'media.blubrry.com'||$RedirectDomain == 'media.rawvoice.com') && strstr($NewURL, '/'.$RedirectDomain.'/') )
3009
- //{
3010
- // // Strip the media.blubrry.com/XXX/x/ or media.blubrry.com/xxx/ from the URL since we will be replacing it
3011
- // if( preg_match('/^(.*\/)media\.(?:blubrry|rawvoice)\.com\/[a-zA-Z0-9_-]{2,60}\/([a-zA-Z0-9]\/)?(.*)$/', $NewURL, $matches) )
3012
- // {
3013
- // $NewURL = $matches[1].$matches[3];
3014
- // }
3015
- //}
3016
-
3017
- if( !strstr($NewURL, $RedirectClean) ) // If the redirect is not already added...
3018
- $NewURL = $URLScheme. $RedirectClean . str_replace($URLScheme, '', $NewURL);
3019
- }
3020
- }
3021
- }
3022
-
3023
- return $NewURL;
3024
- }
3025
-
3026
- function powerpress_add_flag_to_redirect_url($MediaURL, $Flag)
3027
- {
3028
- // First strip any previous flags...
3029
- $MediaURL = preg_replace('/(media\.(blubrry|techpodcasts|rawvoice|podcasternews)\.com\/[A-Za-z0-9-_]+\/)([A-Za-z0-9]\/)?/i', '$1'."", $MediaURL);
3030
- return preg_replace('/(media\.(blubrry|techpodcasts|rawvoice|podcasternews)\.com\/[A-Za-z0-9-_]+\/)('.$Flag.'\/)?/i', '$1'."$Flag/", $MediaURL);
3031
- }
3032
-
3033
- /*
3034
- Code contributed from upekshapriya on the Blubrry Forums
3035
- */
3036
- function powerpress_byte_size($ppbytes)
3037
- {
3038
- $ppbytes = intval($ppbytes);
3039
- if( empty($ppbytes) )
3040
- return '';
3041
- $ppsize = intval($ppbytes) / 1024;
3042
- if($ppsize < 1024)
3043
- {
3044
- $ppsize = number_format($ppsize, 1);
3045
- $ppsize .= 'KB';
3046
- }
3047
- else
3048
- {
3049
- if($ppsize / 1024 < 1024)
3050
- {
3051
- $ppsize = number_format($ppsize / 1024, 1);
3052
- $ppsize .= 'MB';
3053
- }
3054
- else if ($ppsize / 1024 / 1024 < 1024)
3055
- {
3056
- $ppsize = number_format($ppsize / 1024 / 1024, 1);
3057
- $ppsize .= 'GB';
3058
- }
3059
- }
3060
- return $ppsize;
3061
- }
3062
-
3063
- // Merges settings from feed settings page to empty custom feed settings
3064
- function powerpress_merge_empty_feed_settings($CustomFeedSettings, $FeedSettings, $DefaultPodcastFeed = false)
3065
- {
3066
- unset($FeedSettings['apply_to']);
3067
- // Remove settings from main $FeedSettings that should not be copied to custom feed.
3068
- if( !$DefaultPodcastFeed )
3069
- {
3070
- unset($FeedSettings['itunes_new_feed_url']);
3071
- unset($FeedSettings['feed_redirect_url']);
3072
- unset($FeedSettings['itunes_complete']);
3073
- unset($FeedSettings['itunes_block']);
3074
- unset($FeedSettings['maximize_feed']);
3075
- }
3076
-
3077
- // If the setting is not already set, set the enhnaced itunes setting if they have PHP5+ on by default
3078
- if( !isset($FeedSettings['enhance_itunes_summary']) )
3079
- $FeedSettings['enhance_itunes_summary'] = 0;
3080
-
3081
- if( !$CustomFeedSettings )
3082
- return $FeedSettings; // If the $CustomFeedSettings is false
3083
-
3084
- foreach( $CustomFeedSettings as $key=> $value )
3085
- {
3086
- if( $value !== '' || !isset($FeedSettings[$key]) )
3087
- $FeedSettings[$key] = $value;
3088
- }
3089
-
3090
- return $FeedSettings;
3091
- }
3092
-
3093
- function powerpress_readable_duration($duration, $include_hour=false)
3094
- {
3095
- $seconds = 0;
3096
- $parts = explode(':', $duration);
3097
- if( count($parts) == 3 )
3098
- $seconds = $parts[2] + ($parts[1]*60) + ($parts[0]*60*60);
3099
- else if ( count($parts) == 2 )
3100
- $seconds = $parts[1] + ($parts[0]*60);
3101
- else
3102
- $seconds = $parts[0];
3103
-
3104
- $hours = 0;
3105
- $minutes = 0;
3106
- if( $seconds >= (60*60) )
3107
- {
3108
- $hours = floor( $seconds /(60*60) );
3109
- $seconds -= (60*60*$hours);
3110
- }
3111
- if( $seconds >= (60) )
3112
- {
3113
- $minutes = floor( $seconds /(60) );
3114
- $seconds -= (60*$minutes);
3115
- }
3116
-
3117
- if( $hours || $include_hour ) // X:XX:XX (readable)
3118
- return sprintf('%d:%02d:%02d', $hours, $minutes, $seconds);
3119
-
3120
- return sprintf('%d:%02d', $minutes, $seconds); // X:XX or 0:XX (readable)
3121
- }
3122
-
3123
- // Duratoin in form of seconds (parses hh:mm:ss)
3124
- function powerpress_raw_duration($duration)
3125
- {
3126
- $duration = trim($duration);
3127
- $Parts = explode(':',$duration);
3128
- if( empty($Parts) )
3129
- return $duration;
3130
-
3131
- if( count($Parts) == 3 )
3132
- return (($Parts[0]*60*60) + ($Parts[1]*60) +$Parts[2]);
3133
- else if( count($Parts) == 2 )
3134
- return (($Parts[0]*60) +$Parts[1]);
3135
- //else if( count($Parts) == 1 )
3136
- // return ($Parts[0]);
3137
-
3138
- // We never found any colons, so we assume duration is seconds
3139
- return $duration;
3140
- }
3141
-
3142
- // For grabbing data from Podpress data stored serialized, the strings for some values can sometimes get corrupted, so we fix it...
3143
-
3144
- function powerpress_repair_serialize($string)
3145
- {
3146
- if( @unserialize($string) )
3147
- return $string; // Nothing to repair...
3148
-
3149
- $string = preg_replace_callback('/(s:(\d+):"([^"]*)")/',
3150
- 'powerpress_repair_serialize_callback',
3151
- $string);
3152
-
3153
- if( substr($string, 0, 2) == 's:' ) // Sometimes the serialized data is double serialized, so we need to re-serialize the outside string
3154
- {
3155
- $string = preg_replace_callback('/(s:(\d+):"(.*)"(;))$/',
3156
- 'powerpress_repair_serialize_callback',
3157
- $string);
3158
- }
3159
-
3160
- return $string;
3161
- }
3162
-
3163
- function powerpress_repair_serialize_callback($matches)
3164
- {
3165
- if( strlen($matches[3]) == $matches[2] )
3166
- return $matches[0];
3167
- return sprintf('s:%d:"%s"', strlen($matches[3]), $matches[3]) . (!empty($matches[4])?';':'');
3168
- }
3169
-
3170
- function powerpress_base64_encode($value)
3171
- {
3172
- return rtrim(strtr(base64_encode($value), '+/', '-_'), '=');
3173
- }
3174
- /*
3175
- powerpress_get_post_meta()
3176
- Safe function to retrieve corrupted PodPress data from the database
3177
- @post_id - post id to retrieve post meta for
3178
- @key - key to retrieve post meta for
3179
- */
3180
- function powerpress_get_post_meta($post_id, $key)
3181
- {
3182
- $pp_meta_cache = wp_cache_get($post_id, 'post_meta');
3183
- if ( !$pp_meta_cache ) {
3184
- update_postmeta_cache($post_id);
3185
- $pp_meta_cache = wp_cache_get($post_id, 'post_meta');
3186
- }
3187
-
3188
- $meta = false;
3189
- if ( isset($pp_meta_cache[$key]) )
3190
- $meta = $pp_meta_cache[$key][0];
3191
-
3192
- if ( is_serialized( $meta ) ) // Logic used up but not including WordPress 2.8, new logic doesn't make sure if unserialized failed or not
3193
- {
3194
- if ( false !== ( $gm = @unserialize( $meta ) ) )
3195
- return $meta;
3196
- }
3197
-
3198
- return $meta;
3199
- }
3200
-
3201
- function powerpress_get_enclosure($post_id, $feed_slug = 'podcast')
3202
- {
3203
- $Data = powerpress_get_enclosure_data($post_id, $feed_slug);
3204
- if( $Data )
3205
- return $Data['url'];
3206
- return false;
3207
- }
3208
-
3209
- function powerpress_get_enclosure_data($post_id, $feed_slug = 'podcast', $raw_data = false, $add_redirect=true)
3210
- {
3211
- global $post;
3212
- if( false != $raw_data )
3213
- $MetaData = $raw_data;
3214
- else
3215
- {
3216
- if( !empty($post->podcast_meta_value) && $post->ID == $post_id) // See if we got the meta data from the initial query...
3217
- {
3218
- $PodcastData = powerpress_get_enclosure_data($post_id, $feed_slug, $post->podcast_meta_value, true);
3219
- return $PodcastData;
3220
- }
3221
-
3222
- if( 'podcast' == $feed_slug || '' == $feed_slug )
3223
- $MetaData = get_post_meta($post_id, 'enclosure', true);
3224
- else
3225
- $MetaData = get_post_meta($post_id, '_'. $feed_slug .':enclosure', true);
3226
- }
3227
- if( empty($MetaData) )
3228
- return false;
3229
-
3230
- $MetaParts = explode("\n", $MetaData, 4);
3231
-
3232
- $Serialized = false;
3233
- $Data = array();
3234
- $Data['id'] = $post_id;
3235
- $Data['feed'] = $feed_slug;
3236
- $Data['url'] = '';
3237
- $Data['duration'] = '';
3238
- $Data['size'] = '';
3239
- $Data['type'] = '';
3240
- $Data['width'] = '';
3241
- $Data['height'] = '';
3242
-
3243
- if( count($MetaParts) > 0 )
3244
- $Data['url'] = trim($MetaParts[0]);
3245
- if( count($MetaParts) > 1 )
3246
- $Data['size'] = trim($MetaParts[1]);
3247
- if( count($MetaParts) > 2 )
3248
- $Data['type'] = trim($MetaParts[2]);
3249
- if( count($MetaParts) > 3 )
3250
- $Serialized = $MetaParts[3];
3251
-
3252
- if( $Serialized )
3253
- {
3254
- $ExtraData = @unserialize($Serialized);
3255
- if( $ExtraData && is_array($ExtraData) )
3256
- {
3257
- foreach( $ExtraData as $key=> $value ) {
3258
-
3259
- // Make sure specific fields are not overwritten...
3260
- switch( $key ) {
3261
- case 'id':
3262
- case 'feed':
3263
- case 'url':
3264
- case 'size':
3265
- case 'type': break;
3266
- default: $Data[ $key ] = $value;
3267
- }
3268
- }
3269
-
3270
- if( isset($Data['length']) ) // Setting from the "Podcasting" plugin...
3271
- $Data['duration'] = powerpress_readable_duration($Data['length'], true);
3272
-
3273
- if( !empty($Data['webm_src']) )
3274
- {
3275
- $Data['webm_src'] = trim($Data['webm_src']);
3276
- }
3277
-
3278
-
3279
- if( strpos($MetaParts[0], 'http://') !== 0 && !empty($Data['hosting']) ) // if the URL is not set (just file name) and we're a hosting customer...
3280
- {
3281
- $post_status = get_post_status($post_id);
3282
- switch( $post_status )
3283
- {
3284
- case 'pending':
3285
- case 'draft':
3286
- case 'auto-draft': {
3287
- // Determine if audio or video, then set the demo episode here...
3288
- $Data['url'] = 'http://media.blubrry.com/blubrry/content.blubrry.com/blubrry/preview.mp3'; // audio
3289
- if( strstr($Data['type'], 'video') )
3290
- $Data['url'] = 'http://media.blubrry.com/blubrry/content.blubrry.com/blubrry/preview.mp4'; // video
3291
- }; break;
3292
- }
3293
- }
3294
- }
3295
- }
3296
-
3297
- // If the URL is using Blubrry hosting, then lets pump it up to https...
3298
- if( is_ssl() && preg_match('/^http:\/\/(.*\/content\.blubrry\.com\/.*)$/i', $Data['url'], $matches) )
3299
- {
3300
- $Data['url'] = 'https://'. $matches[1];
3301
- }
3302
-
3303
- // Check that the content type is a valid one...
3304
- if( strstr($Data['type'], '/') == false )
3305
- $Data['type'] = powerpress_get_contenttype($Data['url']);
3306
-
3307
- // Do redirect filter here...
3308
- if( $add_redirect && !empty($Data['url']) )
3309
- $Data['url'] = powerpress_add_redirect_url( $Data['url'], $Data );
3310
-
3311
- if( $add_redirect && !empty($Data['webm_src']) )
3312
- $Data['webm_src'] = powerpress_add_redirect_url( $Data['webm_src'], $Data );
3313
-
3314
- return apply_filters('powerpress_get_enclosure_data', $Data);
3315
- }
3316
-
3317
- function powerpress_get_enclosure_data_podpress($post_id, $mediaNum = 0, $include_premium = false)
3318
- {
3319
- $podPressMedia = powerpress_get_post_meta($post_id, 'podPressMedia');
3320
- if( !$podPressMedia )
3321
- $podPressMedia = powerpress_get_post_meta($post_id, '_podPressMedia'); // handles latest verions of PodPress
3322
- if( $podPressMedia )
3323
- {
3324
-
3325
- if( !is_array($podPressMedia) )
3326
- {
3327
- // Sometimes the stored data gets messed up, we can fix it here:
3328
- $podPressMedia = powerpress_repair_serialize($podPressMedia);
3329
- $podPressMedia = @unserialize($podPressMedia);
3330
- }
3331
-
3332
- // Do it a second time in case it is double serialized
3333
- if( !is_array($podPressMedia) )
3334
- {
3335
- // Sometimes the stored data gets messed up, we can fix it here:
3336
- $podPressMedia = powerpress_repair_serialize($podPressMedia);
3337
- $podPressMedia = @unserialize($podPressMedia);
3338
- }
3339
-
3340
- if( is_array($podPressMedia) && isset($podPressMedia[$mediaNum]) && isset($podPressMedia[$mediaNum]['URI']) )
3341
- {
3342
- if( $include_premium == false && isset($podPressMedia[$mediaNum]['premium_only']) && ($podPressMedia[$mediaNum]['premium_only'] == 'on' || $podPressMedia[$mediaNum]['premium_only'] == true) )
3343
- return false;
3344
-
3345
- $Data = array();
3346
- $Data['id'] = $post_id;
3347
- $Data['feed'] = 'podcast';
3348
- $Data['duration'] = 0;
3349
- $Data['url'] = '';
3350
- $Data['size'] = 0;
3351
- $Data['type'] = '';
3352
- $Data['width'] = '';
3353
- $Data['height'] = '';
3354
-
3355
- $Data['url'] = $podPressMedia[$mediaNum]['URI'];
3356
- if( isset($podPressMedia[$mediaNum]['size']) )
3357
- $Data['size'] = $podPressMedia[$mediaNum]['size'];
3358
- if( isset($PodPressSettings[$mediaNum]['duration']) )
3359
- $Data['duration'] = $podPressMedia[$mediaNum]['duration'];
3360
- if( isset($PodPressSettings[$mediaNum]['previewImage']) )
3361
- $Data['image'] = $podPressMedia[$mediaNum]['previewImage'];
3362
-
3363
- if( strpos($Data['url'], 'http://' ) !== 0 && strpos($Data['url'], 'https://' ) !== 0 )
3364
- {
3365
- $PodPressSettings = get_option('podPress_config');
3366
- if( $PodPressSettings && isset($PodPressSettings['mediaWebPath']) )
3367
- $Data['url'] = rtrim($PodpressSettings['mediaWebPath'], '/') . '/' . ltrim($Data['url'], '/');
3368
- unset($PodPressSettings);
3369
- }
3370
-
3371
- if( strpos($Data['url'], 'http://' ) !== 0 && strpos($Data['url'], 'https://' ) !== 0 )
3372
- {
3373
- $Settings = get_option('powerpress_general');
3374
- if( $Settings && isset($Settings['default_url']) )
3375
- $Data['url'] = rtrim($Settings['default_url'], '/') . '/' . ltrim($Data['url'], '/');
3376
- }
3377
-
3378
- if( strpos($Data['url'], 'http://' ) !== 0 && strpos($Data['url'], 'https://' ) !== 0 )
3379
- return false;
3380
-
3381
- $Data['type'] = powerpress_get_contenttype($Data['url']); // Detect the content type
3382
- $Data['url'] = powerpress_add_redirect_url($Data['url'], $Data); // Add redirects to Media URL
3383
-
3384
- return apply_filters('powerpress_get_enclosure_data', $Data);
3385
- }
3386
- }
3387
- return false;
3388
- }
3389
-
3390
- function powerpress_get_apple_id($url, $strict=false)
3391
- {
3392
- if( $strict )
3393
- {
3394
- $results = preg_match('/apple\.com\/.*\/id(\d+)/i', $url, $matches);
3395
- if( !$results )
3396
- $results = preg_match('/apple\.com\/.*id\=(\d+)/i', $url, $matches);
3397
- if( $results )
3398
- return $matches[1];
3399
- return 0;
3400
- }
3401
- $results = preg_match('/\/id(\d+)/i', $url, $matches);
3402
- if( !$results )
3403
- $results = preg_match('/id\=(\d+)/i', $url, $matches);
3404
- if( $results )
3405
- return $matches[1];
3406
- return 0;
3407
- }
3408
-
3409
-
3410
- function the_powerpress_all_players($slug = false, $no_link=false)
3411
- {
3412
- echo get_the_powerpress_all_players($slug, $no_link);
3413
- }
3414
-
3415
- function get_the_powerpress_all_players($slug = false, $no_link=false)
3416
- {
3417
- $return = '';
3418
- //Use this function to insert the Powerpress player anywhere in the page.
3419
- //Made by Nicolas Bouliane (http://nicolasbouliane.com/)
3420
-
3421
- /*We're going to use the Loop to retrieve the latest post with the 'enclosure' custom key set
3422
- //then interpret it and manually launch powerpressplayer_build with the URL contained within
3423
- //that data.*/
3424
-
3425
- //Let's reset the Loop to make sure we look through all posts
3426
- rewind_posts();
3427
-
3428
- // Get the list of podcast channel slug names...
3429
- $GeneralSettings = get_option('powerpress_general');
3430
-
3431
- // No player or links to add to content...
3432
- if( !empty($GeneralSettings['disable_appearance']) )
3433
- return $return;
3434
-
3435
- $ChannelSlugs = array('podcast');
3436
- if( $slug == false )
3437
- {
3438
- if( isset($GeneralSettings['custom_feeds']['podcast']) )
3439
- $ChannelSlugs = array(); // Reset the array so it is added from the list in specified order
3440
- foreach( $GeneralSettings['custom_feeds'] as $feed_slug=> $null )
3441
- $ChannelSlugs[] = $feed_slug;
3442
- }
3443
- else if( is_array($slug) )
3444
- {
3445
- $ChannelSlugs = $slug;
3446
- }
3447
- else
3448
- {
3449
- $ChannelSlugs = array($slug);
3450
- }
3451
-
3452
- // Loop through the posts
3453
- while( have_posts() )
3454
- {
3455
- the_post();
3456
-
3457
- foreach( $ChannelSlugs as $null=> $feed_slug )
3458
- {
3459
- // Do we follow the global settings to disable a player?
3460
- if( isset($GeneralSettings['disable_player']) && isset($GeneralSettings['disable_player'][$feed_slug]) && $slug == false )
3461
- continue;
3462
-
3463
- $EpisodeData = powerpress_get_enclosure_data(get_the_ID(), $feed_slug);
3464
- if( !$EpisodeData && !empty($GeneralSettings['process_podpress']) && $feed_slug == 'podcast' )
3465
- $EpisodeData = powerpress_get_enclosure_data_podpress(get_the_ID());
3466
-
3467
- if( !$EpisodeData )
3468
- continue;
3469
-
3470
- $AddDefaultPlayer = true;
3471
- if( !empty($EpisodeData['embed']) )
3472
- {
3473
- $return .= $EpisodeData['embed'];
3474
- if( !empty($GeneralSettings['embed_replace_player']) )
3475
- $AddDefaultPlayer = false;
3476
- }
3477
-
3478
- if( isset($GeneralSettings['premium_caps']) && $GeneralSettings['premium_caps'] && !powerpress_premium_content_authorized($feed_slug) )
3479
- {
3480
- $return .= powerpress_premium_content_message(get_the_ID(), $feed_slug, $EpisodeData);
3481
- continue;
3482
- }
3483
-
3484
- if( !isset($EpisodeData['no_player']) && $AddDefaultPlayer )
3485
- {
3486
- do_action('wp_powerpress_player_scripts');
3487
- $return .= apply_filters('powerpress_player', '', powerpress_add_flag_to_redirect_url($EpisodeData['url'], 'p'), $EpisodeData );
3488
- }
3489
- if( !isset($EpisodeData['no_links']) && $no_link == false )
3490
- {
3491
- do_action('wp_powerpress_player_scripts');
3492
- $return .= apply_filters('powerpress_player_links', '', powerpress_add_flag_to_redirect_url($EpisodeData['url'], 'p'), $EpisodeData );
3493
- $return .= apply_filters('powerpress_player_subscribe_links', '', powerpress_add_flag_to_redirect_url($EpisodeData['url'], 'p'), $EpisodeData );
3494
- }
3495
- }
3496
- reset($ChannelSlugs);
3497
- }
3498
-
3499
- return $return;
3500
- }
3501
-
3502
- function powerpress_premium_content_authorized_filter($default, $feed_slug)
3503
- {
3504
- if( $feed_slug != 'podcast' )
3505
- {
3506
- $FeedSettings = get_option('powerpress_feed_'. $feed_slug);
3507
- if( isset($FeedSettings['premium']) && $FeedSettings['premium'] != '' )
3508
- return current_user_can($FeedSettings['premium']);
3509
- }
3510
-
3511
- $post_type = get_query_var('post_type');
3512
- if ( is_array( $post_type ) ) {
3513
- $post_type = reset( $post_type ); // get first element in array
3514
- }
3515
-
3516
- if( $post_type != 'post' )
3517
- {
3518
- $GeneralSettings = get_option('powerpress_general');
3519
- if( !empty($GeneralSettings['posttype_podcasting']) ) // Custom Post Types
3520
- {
3521
- // Get the feed slugs and titles for this post type
3522
- $PostTypeSettingsArray = get_option('powerpress_posttype_'.$post_type);
3523
- if( !empty($PostTypeSettingsArray[$feed_slug]['premium']) )
3524
- return current_user_can($PostTypeSettingsArray[$feed_slug]['premium']);
3525
- }
3526
- }
3527
-
3528
- return $default;
3529
- }
3530
- add_filter('powerpress_premium_content_authorized', 'powerpress_premium_content_authorized_filter', 10, 2);
3531
-
3532
- function powerpress_premium_content_authorized($feed_slug)
3533
- {
3534
- return apply_filters('powerpress_premium_content_authorized', true, $feed_slug );
3535
- }
3536
-
3537
- function powerpress_premium_content_message($post_id, $feed_slug, $EpisodeData = false)
3538
- {
3539
- if( !$EpisodeData && $post_id )
3540
- $EpisodeData = powerpress_get_enclosure_data($post_id, $feed_slug);
3541
-
3542
- if( !$EpisodeData )
3543
- return '';
3544
- $FeedSettings = get_option('powerpress_feed_'.$feed_slug);
3545
- $post_type = get_query_var('post_type');
3546
- if ( is_array( $post_type ) ) {
3547
- $post_type = reset( $post_type ); // get first element in array
3548
- }
3549
-
3550
- if( $post_type != 'post' )
3551
- {
3552
- $GeneralSettings = get_option('powerpress_general');
3553
- if( !empty($GeneralSettings['posttype_podcasting']) ) // Custom Post Types
3554
- {
3555
- // Get the feed slugs and titles for this post type
3556
- $PostTypeSettingsArray = get_option('powerpress_posttype_'.$post_type);
3557
- if( !empty($PostTypeSettingsArray[$feed_slug]['premium']) )
3558
- {
3559
- $FeedSettings = $PostTypeSettingsArray[$feed_slug];
3560
- }
3561
- }
3562
- }
3563
-
3564
- $extension = 'unknown';
3565
- $parts = pathinfo($EpisodeData['url']);
3566
- if( $parts && isset($parts['extension']) )
3567
- $extension = strtolower($parts['extension']);
3568
-
3569
- if( isset($FeedSettings['premium_label']) && $FeedSettings['premium_label'] != '' ) // User has a custom label
3570
- return '<p class="powerpress_links powerpress_links_'. $extension .'">'. $FeedSettings['premium_label'] . '</p>'.PHP_EOL_WEB;
3571
-
3572
- 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;
3573
- }
3574
-
3575
- function powerpress_is_mobile_client()
3576
- {
3577
- _deprecated_function( __FUNCTION__, '7.0' );
3578
- return false;
3579
- }
3580
-
3581
- function powerpress_get_api_array()
3582
- {
3583
- $return = array();
3584
- if( strstr(POWERPRESS_BLUBRRY_API_URL, 'http://api.blubrry.com') == false ) // If not the default
3585
- {
3586
- $return = explode(';', POWERPRESS_BLUBRRY_API_URL);
3587
- }
3588
- else
3589
- {
3590
- $return[] = 'https://api.blubrry.com/'; // Use secure URL first when possible
3591
- $return[] = 'http://api.blubrry.net/';
3592
- $return[] = 'http://api.blubrry.com/';
3593
- }
3594
-
3595
- return $return;
3596
- }
3597
-
3598
-
3599
- function powerpress_in_wp_head()
3600
- {
3601
- $e = new Exception();
3602
- $trace = $e->getTrace();
3603
-
3604
- if( !empty($trace) ) {
3605
- foreach( $trace as $index=> $call ) {
3606
- if( isset($call['function']) ) {
3607
- // Which calls should we not add the player and links...
3608
- switch( $call['function'] ) {
3609
- case 'wp_head': return true; break;
3610
- }
3611
- }
3612
- }
3613
- }
3614
- return false;
3615
- }
3616
-
3617
- function powerpress_in_custom_post_widget()
3618
- {
3619
- if( !class_exists('custom_post_widget') )
3620
- return false;
3621
-
3622
- $e = new Exception();
3623
- $trace = $e->getTrace();
3624
-
3625
- if( !empty($trace) ) {
3626
-
3627
- foreach( $trace as $index=> $call ) {
3628
- if( isset($call['function']) ) {
3629
- // Which calls should we not add the player and links...
3630
- switch( $call['function'] ) {
3631
- case 'custom_post_widget_shortcode': return true; break;
3632
- }
3633
- }
3634
- }
3635
- }
3636
- return false;
3637
- }
3638
- /*
3639
- End Helper Functions
3640
- */
3641
-
3642
- // Are we in the admin?
3643
- if( is_admin() )
3644
- {
3645
- require_once(POWERPRESS_ABSPATH.'/powerpressadmin.php');
3646
- register_activation_hook( __FILE__, 'powerpress_admin_activate' );
3647
- }
3648
-
3649
- if( defined('POWERPRESS_SUBSCRIBE') && POWERPRESS_SUBSCRIBE )
3650
- {
3651
- require_once(POWERPRESS_ABSPATH.'/powerpress-subscribe.php');
3652
- }
3653
-
3654
- // For testing purposes in development
3655
- if( defined('POWERPRESS_NEW_CODE') && POWERPRESS_NEW_CODE && file_exists(POWERPRESS_ABSPATH.'/powerpress-new-code.php') )
3656
- {
3657
- require_once(POWERPRESS_ABSPATH.'/powerpress-new-code.php');
3658
- }
3659
-
3660
- if( defined('POWERPRESS_PREMIUM_GROUPS_PLUGIN') ) {
3661
-
3662
- function powerpress_pre_get_posts($query) {
3663
- if( is_feed() && powerpress_is_custom_podcast_feed() && method_exists('Groups_Post_Access', 'posts_where') )
3664
- {
3665
- $feed_slug = get_query_var('feed');
3666
-
3667
- if( $feed_slug != 'podcast' )
3668
- {
3669
- $FeedSettings = get_option('powerpress_feed_'.$feed_slug);
3670
- if( !empty($FeedSettings['premium']) )
3671
- {
3672
- if( has_filter('posts_where', 'Groups_Post_Access::posts_where') )
3673
- {
3674
- remove_filter('posts_where', 'Groups_Post_Access::posts_where');
3675
- }
3676
- }
3677
- }
3678
- }
3679
- }
3680
- add_filter('pre_get_posts', 'powerpress_pre_get_posts');
3681
- }
3682
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3683
  // 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
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' );
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-basic.php CHANGED
@@ -1,1639 +1,1646 @@
1
- <?php
2
-
3
- function powerpress_admin_basic()
4
- {
5
- $FeedAttribs = array('type'=>'general', 'feed_slug'=>'', 'category_id'=>0, 'term_taxonomy_id'=>0, 'term_id'=>0, 'taxonomy_type'=>'', 'post_type'=>'');
6
- // feed_slug = channel
7
-
8
- $General = powerpress_get_settings('powerpress_general');
9
- $General = powerpress_default_settings($General, 'basic');
10
- if( !isset($General['advanced_mode_2']) )
11
- $General['advanced_mode_2'] = true;
12
-
13
- $FeedSettings = powerpress_get_settings('powerpress_feed');
14
- $FeedSettings = powerpress_default_settings($FeedSettings, 'editfeed');
15
-
16
- $CustomFeed = get_option('powerpress_feed_'.'podcast'); // Get the custom podcast feed settings saved in the database
17
- if( $CustomFeed ) // If they enabled custom podast channels...
18
- {
19
- $FeedSettings = powerpress_merge_empty_feed_settings($CustomFeed, $FeedSettings);
20
- $FeedAttribs['channel_podcast'] = true;
21
- }
22
-
23
- $MultiSiteServiceSettings = false;
24
- if( is_multisite() )
25
- {
26
- $MultiSiteSettings = get_site_option('powerpress_multisite');
27
- if( !empty($MultiSiteSettings['services_multisite_only']) )
28
- {
29
- $MultiSiteServiceSettings = true;
30
- }
31
- }
32
-
33
- ?>
34
- <script type="text/javascript"><!--
35
- function CheckRedirect(obj)
36
- {
37
- if( obj.value )
38
- {
39
- if( obj.value.indexOf('rawvoice') == -1 && obj.value.indexOf('techpodcasts') == -1 &&
40
- obj.value.indexOf('blubrry') == -1 && obj.value.indexOf('podtrac') == -1 )
41
- {
42
- if( !confirm('<?php echo __('The redirect entered is not recongized as a supported statistics redirect service.', 'powerpress'); ?>\n\n<?php echo __('Are you sure you wish to continue with this redirect url?', 'powerpress'); ?>') )
43
- {
44
- obj.value = '';
45
- return false;
46
- }
47
- }
48
- }
49
- return true;
50
- }
51
-
52
- function SelectEmbedField(checked)
53
- {
54
- if( checked )
55
- jQuery('#embed_replace_player').removeAttr("disabled");
56
- else
57
- jQuery('#embed_replace_player').attr("disabled","disabled");
58
- }
59
-
60
- jQuery(document).ready(function($) {
61
-
62
- jQuery('#powerpress_advanced_mode_button').click( function(event) {
63
- event.preventDefault();
64
- jQuery('#powerpress_advanced_mode').val('0');
65
- jQuery(this).closest("form").submit();
66
- });
67
-
68
- jQuery('#episode_box_player_links_options').change(function () {
69
-
70
- var objectChecked = jQuery('#episode_box_player_links_options').attr('checked');
71
- if(typeof jQuery.prop === 'function') {
72
- objectChecked = jQuery('#episode_box_player_links_options').prop('checked');
73
- }
74
-
75
- if( objectChecked == true ) {
76
- jQuery('#episode_box_player_links_options_div').css("display", 'block' );
77
- }
78
- else {
79
- jQuery('#episode_box_player_links_options_div').css("display", 'none' );
80
- jQuery('.episode_box_no_player_or_links').attr("checked", false );
81
- jQuery('#episode_box_no_player_and_links').attr("checked", false );
82
- if(typeof jQuery.prop === 'function') {
83
- jQuery('.episode_box_no_player_or_links').prop("checked", false );
84
- jQuery('#episode_box_no_player_and_links').prop("checked", false );
85
- }
86
- }
87
- } );
88
-
89
- jQuery('#episode_box_no_player_and_links').change(function () {
90
-
91
- var objectChecked = jQuery(this).attr("checked");
92
- if(typeof jQuery.prop === 'function') {
93
- objectChecked = jQuery(this).prop("checked");
94
- }
95
-
96
- if( objectChecked == true ) {
97
- jQuery('.episode_box_no_player_or_links').attr("checked", false );
98
- if(typeof jQuery.prop === 'function') {
99
- jQuery('.episode_box_no_player_or_links').prop("checked", false );
100
- }
101
- }
102
- } );
103
-
104
- jQuery('.episode_box_no_player_or_links').change(function () {
105
- var objectChecked = jQuery(this).attr("checked");
106
- if(typeof jQuery.prop === 'function') {
107
- objectChecked = jQuery(this).prop("checked");
108
- }
109
-
110
- if( objectChecked == true) {
111
- jQuery('#episode_box_no_player_and_links').attr("checked", false );
112
- if(typeof jQuery.prop === 'function') {
113
- jQuery('#episode_box_no_player_and_links').prop("checked", false );
114
- }
115
- }
116
- } );
117
-
118
- jQuery('#episode_box_feature_in_itunes').change( function() {
119
- var objectChecked = jQuery('#episode_box_feature_in_itunes').attr('checked');
120
- if(typeof jQuery.prop === 'function') {
121
- objectChecked = jQuery('#episode_box_feature_in_itunes').prop('checked');
122
- }
123
- if( objectChecked ) {
124
- $("#episode_box_order").attr("disabled", true);
125
- } else {
126
- $("#episode_box_order").removeAttr("disabled");
127
- }
128
- });
129
-
130
- } );
131
- //-->
132
- </script>
133
-
134
- <input type="hidden" name="action" value="powerpress-save-settings" />
135
-
136
-
137
- <input type="hidden" id="powerpress_advanced_mode" name="General[advanced_mode_2]" value="1" />
138
- <input type="hidden" id="save_tab_pos" name="tab" value="<?php echo (empty($_POST['tab'])?0: intval($_POST['tab']) ); ?>" />
139
-
140
- <div id="powerpress_admin_header">
141
- <h2><?php echo __('Blubrry PowerPress Settings', 'powerpress'); ?></h2>
142
- <span class="powerpress-mode"><?php echo __('Advanced Mode', 'powerpress'); ?>
143
- &nbsp; <a href="<?php echo admin_url("admin.php?page=". urlencode(powerpress_admin_get_page()) ."&amp;mode=simple"); ?>" id="powerpress_advanced_mode_button" class="button-primary button-blubrry"><?php echo __('Switch to Simple Mode', 'powerpress'); ?></a>
144
- </span>
145
- </div>
146
-
147
- <div id="powerpress_settings_page" class="powerpress_tabbed_content">
148
- <ul class="powerpress_settings_tabs">
149
- <li><a href="#tab0"><span><?php echo htmlspecialchars(__('Welcome', 'powerpress')); ?></span></a></li>
150
- <li><a href="#tab1"><span><?php echo htmlspecialchars(__('Episodes', 'powerpress')); ?></span></a></li>
151
- <li><a href="#tab2"><span><?php echo htmlspecialchars(__('Services & Stats', 'powerpress')); ?></span></a></li>
152
- <li><a href="#tab3"><span><?php echo htmlspecialchars(__('Website', 'powerpress')); ?></span></a></li>
153
- <li><a href="#tab4"><span><?php echo htmlspecialchars(__('Feeds', 'powerpress')); ?></span></a></li>
154
- <li><a href="#tab5"><span><?php echo htmlspecialchars(__('Apple', 'powerpress')); ?></span></a></li>
155
- <li><a href="#tab6"><span><?php echo htmlspecialchars(__('Google', 'powerpress')); ?></span></a></li>
156
- <li><a href="#tab7"><span><?php echo htmlspecialchars(__('Artwork', 'powerpress')); ?></span></a></li>
157
- <li><a href="#tab-dest"><span><?php echo htmlspecialchars(__('Destinations', 'powerpress')); ?></span></a></li>
158
- </ul>
159
-
160
- <div id="tab0" class="powerpress_tab">
161
- <?php powerpressadmin_welcome($General); ?>
162
- </div>
163
-
164
- <div id="tab1" class="powerpress_tab">
165
- <?php
166
- powerpressadmin_edit_entry_options($General);
167
- powerpressadmin_edit_podpress_options($General);
168
- ?>
169
- </div>
170
-
171
- <div id="tab2" class="powerpress_tab">
172
- <?php
173
- if( $MultiSiteServiceSettings && defined('POWERPRESS_MULTISITE_VERSION') )
174
- {
175
- PowerPressMultiSitePlugin::edit_blubrry_services($General);
176
- }
177
- else
178
- {
179
- powerpressadmin_edit_blubrry_services($General);
180
- powerpressadmin_edit_media_statistics($General);
181
- }
182
- ?>
183
- </div>
184
-
185
- <div id="tab3" class="powerpress_tab">
186
- <?php
187
- powerpressadmin_appearance($General, $FeedSettings);
188
- ?>
189
- </div>
190
-
191
- <div id="tab4" class="powerpress_tab">
192
- <?php
193
- powerpressadmin_edit_feed_general($FeedSettings, $General);
194
- powerpressadmin_edit_feed_settings($FeedSettings, $General, $FeedAttribs);
195
- powerpressadmin_edit_funding($FeedSettings);
196
- powerpressadmin_edit_tv($FeedSettings);
197
- ?>
198
- </div>
199
-
200
- <div id="tab5" class="powerpress_tab">
201
- <?php
202
- powerpressadmin_edit_itunes_feed($FeedSettings, $General, $FeedAttribs);
203
- ?>
204
- </div>
205
- <div id="tab6" class="powerpress_tab">
206
- <?php
207
- powerpressadmin_edit_googleplay($FeedSettings, $General, $FeedAttribs);
208
- ?>
209
- </div>
210
- <div id="tab7" class="powerpress_tab">
211
- <?php
212
- powerpressadmin_edit_artwork($FeedSettings, $General);
213
- ?>
214
- </div>
215
- <div id="tab-dest" class="powerpress_tab">
216
- <?php
217
- powerpressadmin_edit_destinations($FeedSettings, $General, $FeedAttribs);
218
- ?>
219
- </div>
220
-
221
- </div>
222
- <div class="clear"></div>
223
-
224
- <?php
225
-
226
- powerpressadmin_advanced_options($General);
227
- }
228
-
229
- function powerpressadmin_advanced_options($General)
230
- {
231
- // Break the bottom section here out into it's own function
232
- $ChannelsCheckbox = '';
233
- if( !empty($General['custom_feeds']) )
234
- $ChannelsCheckbox = ' onclick="alert(\''. __('You must delete all of the Podcast Channels to disable this option.', 'powerpress') .'\');return false;"';
235
- $CategoryCheckbox = '';
236
- //if( !empty($General['custom_cat_feeds']) ) // Decided ont to include this warning because it may imply that you have to delete the actual category, which is not true.
237
- // $CategoryCheckbox = ' onclick="alert(\'You must remove podcasting from the categories to disable this option.\');return false;"';
238
- ?>
239
- <script language="javascript"><!--
240
-
241
- jQuery(document).ready( function() {
242
-
243
- jQuery('.pp-expand-section').click( function(e) {
244
- e.preventDefault();
245
-
246
- if( jQuery(this).hasClass('pp-expand-section-expanded') ) {
247
- jQuery(this).removeClass('pp-expand-section-expanded');
248
- jQuery(this).parent().next('div').hide(400);
249
- jQuery(this).blur();
250
- } else {
251
- jQuery(this).addClass('pp-expand-section-expanded');
252
- jQuery(this).parent().next('div').show(400);
253
- jQuery(this).blur();
254
- }
255
- });
256
- });
257
-
258
- //-->
259
- </script>
260
- <div style="margin-left: 10px;">
261
- <h3><a href="#" class="pp-expand-section pp-expand-section-expanded"><?php echo __('Advanced Options', 'powerpress'); ?></a></h3>
262
- <div style="margin-left: 50px;" >
263
- <div>
264
- <input type="checkbox" name="NULL[import_podcast]" value="1" checked disabled />
265
- <strong><a href="<?php echo admin_url('admin.php?page=powerpress/powerpressadmin_import_feed.php'); ?>"><?php echo __('Import Podcast', 'powerpress'); ?></a></strong> -
266
- <?php echo __('Import podcast feed from SoundCloud, LibSyn, PodBean or other podcast service.', 'powerpress'); ?>
267
- </div>
268
- <div>
269
- <input type="checkbox" name="NULL[migrate_media]" value="1" checked disabled />
270
- <strong><a href="<?php echo admin_url('admin.php?page=powerpress/powerpressadmin_migrate.php'); ?>"><?php echo __('Migrate Media', 'powerpress'); ?></a></strong> -
271
- <?php echo __('Migrate media files to Blubrry Podcast Media Hosting with only a few clicks.', 'powerpress'); ?>
272
- </div>
273
- <div>
274
- <input type="checkbox" name="NULL[podcasting_seo]" value="1" checked disabled />
275
- <strong><a href="<?php echo admin_url('admin.php?page=powerpress/powerpressadmin_search.php'); ?>"><?php echo __('Podcasting SEO', 'powerpress'); ?></a></strong> -
276
- <?php echo __('Select from 3 different web based audio players.', 'powerpress'); ?>
277
- </div>
278
-
279
- <div>
280
- <input type="checkbox" name="NULL[player_options]" value="1" checked disabled />
281
- <strong><?php echo __('Audio Player Options', 'powerpress'); ?></strong> -
282
- <?php echo __('Select from 3 different web based audio players.', 'powerpress'); ?>
283
- <span style="font-size: 85%;">(<a href="<?php echo admin_url('admin.php?page=powerpress/powerpressadmin_player.php&sp=1'); ?>"><?php echo __('configure audio player', 'powerpress'); ?></a>)</span>
284
- </div>
285
- <div>
286
- <input type="checkbox" name="NULL[video_player_options]" value="1" checked disabled />
287
- <strong><?php echo __('Video Player Options', 'powerpress'); ?></strong> -
288
- <?php echo __('Select from 3 different web based video players.', 'powerpress'); ?>
289
- <span style="font-size: 85%;">(<a href="<?php echo admin_url('admin.php?page=powerpress/powerpressadmin_videoplayer.php&sp=1'); ?>"><?php echo __('configure video player', 'powerpress'); ?></a>)</span>
290
-
291
- </div>
292
- <div>
293
- <input type="hidden" name="General[channels]" value="0" />
294
- <input type="checkbox" name="General[channels]" value="1" <?php echo ( !empty($General['channels']) ?' checked':''); echo $ChannelsCheckbox; ?> />
295
- <strong><?php echo __('Custom Podcast Channels', 'powerpress'); ?></strong> -
296
- <?php echo __('Manage multiple media files and/or formats to one blog post.', 'powerpress'); ?>
297
- <?php if( empty($General['channels']) ) { ?>
298
- <span style="font-size: 85%;">(<?php echo __('feature will appear in left menu when enabled', 'powerpress'); ?>)</span>
299
- <?php } else { ?>
300
- <span style="font-size: 85%;">(<a href="<?php echo admin_url('admin.php?page=powerpress/powerpressadmin_customfeeds.php'); ?>"><?php echo __('configure podcast channels', 'powerpress'); ?></a>)</span>
301
- <?php } ?>
302
- </div>
303
- <div>
304
- <input type="hidden" name="General[cat_casting]" value="0" />
305
- <input type="checkbox" name="General[cat_casting]" value="1" <?php echo ( !empty($General['cat_casting']) ?' checked':''); echo $CategoryCheckbox; ?> />
306
- <strong><?php echo __('Category Podcasting', 'powerpress'); ?></strong> -
307
- <?php echo __('Manage podcasting for specific categories.', 'powerpress'); ?>
308
- <?php if( empty($General['cat_casting']) ) { ?>
309
- <span style="font-size: 85%;">(<?php echo __('feature will appear in left menu when enabled', 'powerpress'); ?>)</span>
310
- <?php } else { ?>
311
- <span style="font-size: 85%;">(<a href="<?php echo admin_url('admin.php?page=powerpress/powerpressadmin_categoryfeeds.php'); ?>"><?php echo __('configure podcast categories', 'powerpress'); ?></a>)</span>
312
- <?php } ?>
313
- </div>
314
- <div>
315
- <input type="checkbox" name="General[metamarks]" value="1" <?php echo ( !empty($General['metamarks']) ?' checked':''); ?> />
316
- <strong><?php echo __('Meta Marks', 'powerpress'); ?></strong> -
317
- <?php echo __('Add additional meta information to your media for syndication.', 'powerpress'); ?>
318
- <?php echo powerpress_help_link('http://www.powerpresspodcast.com/metamarks/'); ?>
319
- <span style="font-size: 85%;">(<?php echo __('feature will appear in episode entry box', 'powerpress'); ?>)</span>
320
- </div>
321
-
322
-
323
- <div>
324
- <input type="hidden" name="General[taxonomy_podcasting]" value="0" />
325
- <input type="checkbox" name="General[taxonomy_podcasting]" value="1" <?php echo ( !empty($General['taxonomy_podcasting']) ?' checked':''); ?> />
326
- <strong><?php echo __('Taxonomy Podcasting', 'powerpress'); ?></strong>
327
- <span style="font-size: 14px;">(<?php echo __('Feature sponsored by', 'powerpress'); ?> <a href="http://afterbuzztv.com/" target="_blank">AfterBuzzTV.com</a>)</span> -
328
- <?php echo __('Manage podcasting for specific taxonomies.', 'powerpress'); ?>
329
- <?php if( empty($General['taxonomy_podcasting']) ) { ?>
330
- <span style="font-size: 85%;">(<?php echo __('feature will appear in left menu when enabled', 'powerpress'); ?>)</span>
331
- <?php } else { ?>
332
- <span style="font-size: 85%;">(<a href="<?php echo admin_url('admin.php?page=powerpress/powerpressadmin_taxonomyfeeds.php'); ?>"><?php echo __('configure taxonomy podcasting', 'powerpress'); ?></a>)</span>
333
- <?php } ?>
334
- </div>
335
- <div>
336
- <input type="hidden" name="General[posttype_podcasting]" value="0" />
337
- <input type="checkbox" name="General[posttype_podcasting]" value="1" <?php echo ( !empty($General['posttype_podcasting']) ?' checked':''); ?> />
338
- <strong><?php echo __('Post Type Podcasting', 'powerpress'); ?></strong> -
339
- <?php echo __('Manage multiple media files and/or formats to specific post types.', 'powerpress'); ?>
340
- <?php if( empty($General['posttype_podcasting']) ) { ?>
341
- <span style="font-size: 85%;">(<?php echo __('feature will appear in left menu when enabled', 'powerpress'); ?>)</span>
342
- <?php } else { ?>
343
- <span style="font-size: 85%;">(<a href="<?php echo admin_url('admin.php?page=powerpress/powerpressadmin_posttypefeeds.php'); ?>"><?php echo __('configure post type podcasting', 'powerpress'); ?></a>)</span>
344
- <?php } ?>
345
- </div>
346
- <div>
347
- <input type="checkbox" name="General[playlist_player]" value="1" <?php echo ( !empty($General['playlist_player']) ?' checked':''); ?> />
348
- <strong><?php echo __('PowerPress Playlist Player', 'powerpress'); ?></strong> -
349
- <?php echo __('Create playlists for your podcasts.', 'powerpress'); ?>
350
- <span style="font-size: 85%;">(<a href="http://create.blubrry.com/resources/powerpress/advanced-tools-and-options/powerpress-playlist-shortcode/" target="_blank"><?php echo __('learn more', 'powerpress'); ?></a>)</span>
351
- </div>
352
- </div>
353
- </div>
354
-
355
- <?php
356
- $link_action_url = admin_url('admin.php?action=powerpress-jquery-account');
357
- $link_action = 'powerpress-jquery-account';
358
- ?>
359
- <div style="margin-left: 10px;">
360
- <h3><?php echo __('Link Blubrry Account', 'powerpress'); ?></h3>
361
- <p style="font-size: 125%;">
362
- <strong><a class="button-primary button-blubrry thickbox" title="<?php echo esc_attr(__('Blubrry Services Integration', 'powerpress')); ?>" href="<?php echo wp_nonce_url($link_action_url, $link_action); ?>&amp;KeepThis=true&amp;TB_iframe=true&amp;width=600&amp;height=400&amp;modal=false" target="_blank"><?php echo __('Click here to link Blubrry account', 'powerpress'); ?></a></strong>
363
- </p>
364
- <p>
365
- <?php echo __('Link your blubrry.com account if you have a Blubrry Podcast Hosting or Blubrry Podcast Statistics services.', 'powerpress'); ?>
366
- </p>
367
- </div>
368
-
369
- <div style="margin-left: 10px;">
370
- <h3 style="margin-bottom: 5px;"><?php echo __('Looking for Support, Consulting or Custom Development?', 'powerpress'); ?></h3>
371
- <p style="margin: 0 0 0 50px;">
372
- <?php echo __('Blubrry offers a variety of options, free and paid, to assist you with your podcasting and Internet media needs. Whether you need your theme customized for podcasting or you want consulting on what video format is best for your audience, we have the staff and knowledge to assist.', 'powerpress'); ?>
373
- </p>
374
- <p style="margin: 5px 0 0 50px;">
375
- <strong><?php echo '<a href="http://create.blubrry.com/support/" target="_blank">'. __('Learn More about Blubrry Support Options', 'powerpress') .'</a>'; ?></strong>
376
- </p>
377
- </div>
378
-
379
- <?php
380
- return;
381
-
382
- // We will not pester folks with this stuff in PowerPress 7.0+
383
-
384
- if( isset($General['timestamp']) && $General['timestamp'] > 0 && $General['timestamp'] < ( time()- (60*60*24*14) ) ) // Lets wait 14 days before we annoy them asking for support
385
- {
386
- ?>
387
- <div style="margin-left: 10px;">
388
- <h3 style="margin-bottom: 5px;"><?php echo __('Like The Plugin?', 'powerpress'); ?></h3>
389
- <p style="margin-top: 0;">
390
- <?php echo __('This plugin is great, don\'t you think? If you like the plugin we\'d be ever so grateful if you\'d give it your support. Here\'s how:', 'powerpress'); ?>
391
- </p>
392
- <ul id="powerpress_support">
393
- <li><?php echo sprintf(__('Rate this plugin 5 stars in the %s.', 'powerpress'),
394
- '<a href="http://wordpress.org/extend/plugins/powerpress/" target="_blank">'. __('WordPress Plugins Directory', 'powerpress') .'</a>');
395
-
396
- ?>
397
- </li>
398
- <li><?php echo __('Tell the world about PowerPress by writing about it on your blog', 'powerpress'); ?>,
399
- <a href="https://twitter.com/home/?status=<?php echo urlencode( __('I\'m podcasting with Blubrry PowerPress (https://blubrry.com/powerpress/) #powerpress #wordpress', 'powerpress') ); ?>" target="_blank"><?php echo __('Twitter', 'powerpress'); ?></a>,
400
- <a href="https://www.facebook.com/share.php?u=<?php echo urlencode('https://www.blubrry.com/powerpress'); ?>&amp;t=<?php echo urlencode( __('I podcast with Blubrry PowerPress', 'powerpress')); ?>" target="_blank"><?php echo __('Facebook', 'powerpress'); ?></a>,
401
- etc...</li>
402
- <li><a href="http://www.blubrry.com/contact.php" target="_blank"><?php echo __('Send us feedback', 'powerpress'); ?></a> (<?php echo __('we love getting suggestions for new features!', 'powerpress'); ?>)</li>
403
- </ul>
404
- </div>
405
- <?php
406
- }
407
- ?>
408
- <div style="margin-left: 10px;">
409
- <h3 style="margin-bottom: 5px;"><?php echo __('Become a PowerPress Patron!', 'powerpress'); ?></h3>
410
- <p style="margin: 0; padding-left: 50px;">
411
- <?php echo __('Help support your favorite podcasting plugin via Patreon.', 'powerpress'); ?>
412
- </p>
413
- <p style="margin-top: 0; padding-left: 50px;"><?php echo '<a href="https://www.patreon.com/blubrry?ty=h" target="_blank">'. __('Visit Blubrry\'s Patreon page', 'powerpress') .'</a>'; ?>
414
- </p>
415
- </div>
416
- <?php
417
- }
418
-
419
- function powerpressadmin_edit_entry_options($General)
420
- {
421
- if( !isset($General['default_url']) )
422
- $General['default_url'] = '';
423
- if( !isset($General['episode_box_mode']) )
424
- $General['episode_box_mode'] = 0; // Default not set, 1 = no duration/file size, 2 = yes duration/file size (default if not set)
425
- if( !isset($General['episode_box_embed']) )
426
- $General['episode_box_embed'] = 0;
427
- if( !isset($General['set_duration']) )
428
- $General['set_duration'] = 0;
429
- if( !isset($General['set_size']) )
430
- $General['set_size'] = 0;
431
- if( !isset($General['auto_enclose']) )
432
- $General['auto_enclose'] = 0;
433
- if( !isset($General['episode_box_player_size']) )
434
- $General['episode_box_player_size'] = 0;
435
- if( !isset($General['episode_box_closed_captioned']) )
436
- $General['episode_box_closed_captioned'] = 0;
437
- if( !isset($General['episode_box_order']) )
438
- $General['episode_box_order'] = 0;
439
- if( !isset($General['episode_box_feature_in_itunes']) )
440
- $General['episode_box_feature_in_itunes'] = 0;
441
-
442
- ?>
443
- <h3><?php echo __('Episode Entry Options', 'powerpress'); ?></h3>
444
-
445
-
446
- <table class="form-table">
447
- <tr valign="top">
448
- <th scope="row">
449
-
450
- <?php echo __('Podcast Entry Box', 'powerpress'); ?></th>
451
- <td>
452
- <p style="margin-top: 5px;">
453
- <?php echo __('Configure your podcast episode entry box with the options that fit your needs.', 'powerpress'); ?>
454
- </p>
455
- <div id="episode_box_mode_adv">
456
-
457
- <p style="margin-top: 15px;"><input class="episode_box_option" name="Null[ignore]" type="checkbox" value="1" checked onclick="return false" onkeydown="return false" /> <?php echo __('Media URL', 'powerpress'); ?>
458
- (<?php echo __('Specify URL to episode\'s media file', 'powerpress'); ?>)</p>
459
-
460
- <p style="margin-top: 15px;"><input id="episode_box_mode" class="episode_box_option" name="General[episode_box_mode]" type="checkbox" value="2" <?php if( empty($General['episode_box_mode']) || $General['episode_box_mode'] != 1 ) echo ' checked'; ?> /> <?php echo __('Media File Size and Duration', 'powerpress'); ?>
461
- (<?php echo __('Specify episode\'s media file size and duration', 'powerpress'); ?>)</p>
462
-
463
- <p style="margin-top: 15px; margin-bottom: 0;"><input id="episode_box_embed" class="episode_box_option" name="General[episode_box_embed]" type="checkbox" value="1"<?php if( !empty($General['episode_box_embed']) ) echo ' checked'; ?> onclick="SelectEmbedField(this.checked);" /> <?php echo __('Embed Field', 'powerpress'); ?>
464
- (<?php echo __('Enter embed code from sites such as YouTube', 'powerpress'); ?>)</p>
465
- <p style="margin-top: 5px; margin-left: 20px; font-size: 90%;"><input id="embed_replace_player" class="episode_box_option" name="General[embed_replace_player]" type="checkbox" value="1"<?php if( !empty($General['embed_replace_player']) ) echo ' checked'; ?> /> <?php echo __('Replace Player with Embed', 'powerpress'); ?>
466
- (<?php echo __('Do not display default player if embed present for episode.', 'powerpress'); ?>)</p>
467
-
468
- <p style="margin-top: 15px;"><input id="episode_box_player_links_options" class="episode_box_option" name="NULL[episode_box_player_links_options]" type="checkbox" value="1"<?php if( !empty($General['episode_box_no_player_and_links']) || !empty($General['episode_box_no_player']) || !empty($General['episode_box_no_links']) ) echo ' checked'; ?> /> <?php echo __('Display Player and Links Options', 'powerpress'); ?>
469
- </p>
470
- <div id="episode_box_player_links_options_div" style="margin-left: 20px;<?php if( empty($General['episode_box_no_player_and_links']) && empty($General['episode_box_no_player']) && empty($General['episode_box_no_links']) ) echo 'display:none;'; ?>">
471
-
472
- <p style="margin-top: 0px; margin-bottom: 5px;"><input id="episode_box_no_player_and_links" class="episode_box_option" name="General[episode_box_no_player_and_links]" type="checkbox" value="1"<?php if( !empty($General['episode_box_no_player_and_links']) ) echo ' checked'; ?> /> <?php echo htmlspecialchars(__('No Player & Links Option', 'powerpress')); ?>
473
- (<?php echo __('Disable media player and links on a per episode basis', 'powerpress'); ?>)</p>
474
-
475
- <p style="margin-top: 0; margin-bottom: 0; margin-left: 20px;"><?php echo __('- or -', 'powerpress'); ?></p>
476
-
477
- <p style="margin-top: 5px; margin-bottom: 10px;"><input id="episode_box_no_player" class="episode_box_option episode_box_no_player_or_links" name="General[episode_box_no_player]" type="checkbox" value="1"<?php if( !empty($General['episode_box_no_player']) ) echo ' checked'; ?> /> <?php echo __('No Player Option', 'powerpress'); ?>
478
- (<?php echo __('Disable media player on a per episode basis', 'powerpress'); ?>)</p>
479
-
480
- <p style="margin-top: 5px; margin-bottom: 20px;"><input id="episode_box_no_links" class="episode_box_option episode_box_no_player_or_links" name="General[episode_box_no_links]" type="checkbox" value="1"<?php if( !empty($General['episode_box_no_links']) ) echo ' checked'; ?> /> <?php echo __('No Links Option', 'powerpress'); ?>
481
- (<?php echo __('Disable media links on a per episode basis', 'powerpress'); ?>)</p>
482
-
483
- </div>
484
-
485
- <p style="margin-top: 15px;"><input id="episode_box_cover_image" class="episode_box_option" name="General[episode_box_cover_image]" type="checkbox" value="1"<?php if( !empty($General['episode_box_cover_image']) ) echo ' checked'; ?> /> <?php echo __('Poster Image', 'powerpress'); ?>
486
- (<?php echo __('Specify URL to poster artwork specific to each episode', 'powerpress'); ?>)</p>
487
-
488
- <p style="margin-top: 15px;"><input id="episode_box_player_size" class="episode_box_option" name="General[episode_box_player_size]" type="checkbox" value="1"<?php if( !empty($General['episode_box_player_size']) ) echo ' checked'; ?> /> <?php echo __('Player Width and Height', 'powerpress'); ?>
489
- (<?php echo __('Customize player width and height on a per episode basis', 'powerpress'); ?>)</p>
490
- <p style="margin-top: 15px;"><input id="episode_box_subtitle" class="episode_box_option" name="General[episode_box_subtitle]" type="checkbox" value="1"<?php if( !empty($General['episode_box_subtitle']) ) echo ' checked'; ?> /> <?php echo __('iTunes Subtitle Field', 'powerpress'); ?>
491
- (<?php echo __('Leave unchecked to use the first 250 characters of your blog post', 'powerpress'); ?>)</p>
492
- <p style="margin-top: 15px;"><input id="episode_box_summary" class="episode_box_option" name="General[episode_box_summary]" type="checkbox" value="1"<?php if( !empty($General['episode_box_summary']) ) echo ' checked'; ?> /> <?php echo __('iTunes Summary Field', 'powerpress'); ?>
493
- (<?php echo __('Leave unchecked to use your blog post', 'powerpress'); ?>)</p>
494
-
495
-
496
-
497
- <p style="margin-top: 15px;"><input id="episode_box_author" class="episode_box_option" name="General[episode_box_author]" type="checkbox" value="1"<?php if( !empty($General['episode_box_author']) ) echo ' checked'; ?> /> <?php echo __('iTunes Author Field', 'powerpress'); ?>
498
- (<?php echo __('Leave unchecked to the post author name', 'powerpress'); ?>)</p>
499
-
500
- <p style="margin-top: 15px;"><input id="episode_box_explicit" class="episode_box_option" name="General[episode_box_explicit]" type="checkbox" value="1"<?php if( !empty($General['episode_box_explicit']) ) echo ' checked'; ?> /> <?php echo __('iTunes Explicit Field', 'powerpress'); ?>
501
- (<?php echo __('Leave unchecked to use your feed\'s explicit setting', 'powerpress'); ?>)</p>
502
-
503
-
504
- <p style="margin-top: 15px;"><label><input id="episode_box_itunes_image" class="episode_box_option" name="General[episode_box_itunes_image]" type="checkbox" value="1"<?php if( !empty($General['episode_box_itunes_image']) ) echo ' checked'; ?> /> <?php echo __('iTunes Episode Image Field', 'powerpress'); ?></label>
505
- (<?php echo __('Leave unchecked to use the image embedded into your media files.', 'powerpress'); ?>)</p>
506
-
507
- <p style="margin-top: 15px;"><label><input id="episode_box_closed_captioned" class="episode_box_option" name="General[episode_box_closed_captioned]" type="checkbox" value="1"<?php if( !empty($General['episode_box_closed_captioned']) ) echo ' checked'; ?> /> <?php echo __('iTunes Closed Captioned', 'powerpress'); ?></label>
508
- (<?php echo __('Leave unchecked if you do not distribute closed captioned media', 'powerpress'); ?>)</p>
509
-
510
- <p style="margin-top: 15px;"><label><input id="episode_box_order" class="episode_box_option" name="General[episode_box_order]" type="checkbox" value="1"<?php if( !empty($General['episode_box_order']) ) echo ' checked'; ?> <?php if( !empty($General['episode_box_feature_in_itunes']) ) echo ' disabled'; ?> /> <?php echo __('iTunes Order', 'powerpress'); ?></label>
511
- (<?php echo __('Override the default ordering of episodes on the Apple and Google Podcast directories', 'powerpress'); ?>)</p>
512
- <em><strong><?php echo __('If conflicting values are present the directories will use the default ordering.', 'powerpress'); ?></strong></em><br />
513
- <em><strong><?php echo __('This feature only applies to the default podcast feed and Custom Podcast Channel feeds added by PowerPress.', 'powerpress'); ?></strong></em>
514
-
515
- <?php if( empty($General['ios11_fields']) || $General['ios11_fields'] == 2 ) { ?>
516
- <p><label><select name="General[ebititle]" class="bpp_input_sm">
517
- <?php
518
- $linkoptions = array('false'=>__('Hide Field', 'powerpress'),
519
- 1=>__('Show Field', 'powerpress') );
520
-
521
- foreach( $linkoptions as $value => $desc )
522
- echo "\t<option value=\"$value\"". ( !empty($General['episode_box_itunes_title']) && $General['episode_box_itunes_title'] == $value ?' selected':''). ">$desc</option>\n";
523
-
524
- ?>
525
- </select> <?php echo __('iTunes Episode Title Field', 'powerpress'); ?></label> </p>
526
- <em><strong><?php echo __('Specify iTunes episode title separate from podcast feed title.', 'powerpress'); ?></strong></em>
527
- <?php } // end episode_box_itunes_title ?>
528
-
529
- <?php if( empty($General['ios11_fields']) || $General['ios11_fields'] == 4 ) { ?>
530
- <p><label><select name="General[ebinst]" class="bpp_input_sm">
531
- <?php
532
- $linkoptions = array('false'=>__('Hide Field', 'powerpress'),
533
- 1=>__('Show Field', 'powerpress') );
534
-
535
- foreach( $linkoptions as $value => $desc )
536
- echo "\t<option value=\"$value\"". ( !empty($General['episode_box_itunes_nst']) && $General['episode_box_itunes_nst'] == $value ?' selected':''). ">$desc</option>\n";
537
-
538
- ?>
539
- </select> <?php echo __('iTunes Episode Number, Season and Type Fields', 'powerpress'); ?></label> </p>
540
- <em><strong><?php echo __('Enter specifics about episode including episode number, season number and type (full, trailer, or bonus).', 'powerpress'); ?></strong></em>
541
- <?php } // end episode_box_itunes_title ?>
542
-
543
- <p style="margin-top: 15px;"><label><input id="episode_box_feature_in_itunes" class="episode_box_option" name="General[episode_box_feature_in_itunes]" type="checkbox" value="1"<?php if( !empty($General['episode_box_feature_in_itunes']) ) echo ' checked'; ?> /> <?php echo __('Feature Episode in Apple and Google Podcasts', 'powerpress'); ?></label>
544
- (<?php echo __('Display selected episode at top of your Apple and Google Podcasts listings', 'powerpress'); ?>)</p>
545
- <em><strong><?php echo __('All other episodes will be listed following the featured episode.', 'powerpress'); ?></strong></em><br />
546
- <em><strong><?php echo __('This feature only applies to the default podcast feed and Custom Podcast Channel feeds added by PowerPress.', 'powerpress'); ?></strong></em>
547
-
548
-
549
- <p style="margin-top: 15px;"><input id="episode_box_gp_desc" class="episode_box_option" name="General[episode_box_gp_desc]" type="checkbox" value="1"<?php if( !empty($General['episode_box_gp_desc']) ) echo ' checked'; ?> /> <?php echo __('Google Play Description Field', 'powerpress'); ?>
550
- (<?php echo __('Leave unchecked to use your blog post', 'powerpress'); ?>)</p>
551
- <p style="margin-top: 15px;"><input id="episode_box_gp_explicit" class="episode_box_option" name="General[episode_box_gp_explicit]" type="checkbox" value="1"<?php if( !empty($General['episode_box_gp_explicit']) ) echo ' checked'; ?> /> <?php echo __('Google Play Explicit Field', 'powerpress'); ?>
552
- (<?php echo __('Leave unchecked to use your feed\'s explicit setting', 'powerpress'); ?>)</p>
553
-
554
- <fieldset style="border: 1px dashed #333333; margin: 10px 0 10px -20px;">
555
- <legend style="margin: 0 20px; padding: 0 5px 5px 5px; font-weight: bold;"><?php echo __('Advanced Options', 'powerpress'); ?></legend>
556
- <p style="margin: 15px 0 0 20px;"><label><input id="episode_box_block" class="episode_box_option" name="General[episode_box_block]" type="checkbox" value="1"<?php if( !empty($General['episode_box_block']) ) echo ' checked'; ?> /> <?php echo __('iTunes Block', 'powerpress'); ?> (<?php echo htmlspecialchars('<itunes:block>yes</itunes:block>'); ?>)</label></p>
557
- <div style="margin: 0 10px 10px 20px;"><em><strong><?php echo __('Prevent episodes from appearing in iTunes and other diretories that support the iTunes:block tag. Episodes may still appear in other directories and applications.', 'powerpress'); ?></strong></em></div>
558
-
559
- <p style="margin: 15px 0 0 20px;"><label><input id="episode_box_gp_block" class="episode_box_option" name="General[episode_box_gp_block]" type="checkbox" value="1"<?php if( !empty($General['episode_box_gp_block']) ) echo ' checked'; ?> /> <?php echo __('Google Play Block', 'powerpress'); ?> (<?php echo htmlspecialchars('<googleplay:block>yes</itunes:googleplay>'); ?>)</label></p>
560
- <div style="margin: 0 10px 10px 20px;"><em><strong><?php echo __('Prevent episodes from appearing in Google Play Music. Episodes may still appear in other directories and applications.', 'powerpress'); ?></strong></em></div>
561
- </fieldset>
562
-
563
- </div>
564
-
565
- </td>
566
- </tr>
567
- </table>
568
- <script language="javascript"><!--
569
- SelectEmbedField(<?php echo $General['episode_box_embed']; ?>);
570
- //-->
571
- </script>
572
-
573
- <?php
574
-
575
- $AdvanecdOptions = false;
576
- if( !empty($General['default_url']) )
577
- $AdvanecdOptions = true;
578
- if( !empty($General['set_duration']) )
579
- $AdvanecdOptions = true;
580
- if( !empty($General['set_size']) )
581
- $AdvanecdOptions = true;
582
- if( !empty($General['auto_enclose']) )
583
- $AdvanecdOptions = true;
584
- if( !empty($General['permalink_feeds_only']) )
585
- $AdvanecdOptions = true;
586
- if( !empty($General['hide_warnings']) )
587
- $AdvanecdOptions = true;
588
-
589
- $DefaultMediaURL = false;
590
-
591
- if( !empty($General['default_url']) )
592
- $DefaultMediaURL = true;
593
-
594
- if( !$AdvanecdOptions ) {
595
- ?>
596
- <div style="margin-left: 10px; font-weight: bold;" id="advanced_basic_options_show_link"><a href="#" onclick="document.getElementById('advanced_basic_options').style.display='block';document.getElementById('advanced_basic_options_show_link').style.display='none';return false;"><?php echo __('Show Advanced Episode Entry Settings', 'powerpress'); ?></a></div>
597
- <?php } ?>
598
- <!-- start advanced features -->
599
- <div id="advanced_basic_options" <?php echo ($AdvanecdOptions?'':'style="display:none;"'); ?>>
600
- <?php if( $DefaultMediaURL || defined('POWERPRESS_DEFAULT_MEDIA_URL') ) { ?>
601
- <table class="form-table">
602
- <tr valign="top">
603
- <th scope="row"><?php echo __('Default Media URL', 'powerpress'); ?></th>
604
- <td>
605
- <input type="text" style="width: 80%;" name="General[default_url]" value="<?php echo esc_attr($General['default_url']); ?>" maxlength="255" />
606
- <p><?php echo __('e.g. http://example.com/mediafolder/', 'powerpress'); ?></p>
607
- <p><?php echo __('URL above will prefix entered file names that do not start with \'http://\'. URL above must end with a trailing slash. You may leave blank if you always enter the complete URL to your media when creating podcast episodes.', 'powerpress'); ?>
608
- </p>
609
- </td>
610
- </tr>
611
- </table>
612
- <?php } ?>
613
-
614
- <div id="episode_entry_settings">
615
- <table class="form-table">
616
- <tr valign="top">
617
- <th scope="row">
618
-
619
- <?php echo __('File Size Default', 'powerpress'); ?></th>
620
- <td>
621
- <select name="General[set_size]" class="bpp_input_med">
622
- <?php
623
- $options = array(0=>__('Auto detect file size', 'powerpress'), 1=>__('User specify', 'powerpress') );
624
-
625
- foreach( $options as $value => $desc )
626
- echo "\t<option value=\"$value\"". ($General['set_size']==$value?' selected':''). ">$desc</option>\n";
627
-
628
- ?>
629
- </select> (<?php echo __('specify default file size option when creating a new episode', 'powerpress'); ?>)
630
- </td>
631
- </tr>
632
-
633
- <tr valign="top">
634
- <th scope="row">
635
- <?php echo __('Duration Default', 'powerpress'); ?></th>
636
- <td>
637
- <select name="General[set_duration]" class="bpp_input_med">
638
- <?php
639
- $options = array(0=>__('Auto detect duration', 'powerpress'), 1=>__('User specify', 'powerpress'), -1=>__('Not specified (not recommended)', 'powerpress') );
640
-
641
- foreach( $options as $value => $desc )
642
- echo "\t<option value=\"$value\"". ($General['set_duration']==$value?' selected':''). ">$desc</option>\n";
643
-
644
- ?>
645
- </select> (<?php echo __('specify default duration option when creating a new episode', 'powerpress'); ?>)
646
- </td>
647
- </tr>
648
- </table>
649
- </div>
650
-
651
- <table class="form-table">
652
- <tr valign="top">
653
- <th scope="row">
654
- <?php echo __('Auto Add Media', 'powerpress'); ?></th>
655
- <td>
656
- <select name="General[auto_enclose]" class="bpp_input_med">
657
- <?php
658
- $options = array(0=>__('Disabled (default)', 'powerpress'), 1=>__('First media link found in post content', 'powerpress'), 2=>__('Last media link found in post content', 'powerpress') );
659
-
660
- foreach( $options as $value => $desc )
661
- echo "\t<option value=\"$value\"". ($General['auto_enclose']==$value?' selected':''). ">$desc</option>\n";
662
-
663
- ?>
664
- </select>
665
- <p><?php echo __('When enabled, the first or last media link found in the post content is automatically added as your podcast episode.', 'powerpress'); ?></p>
666
- <p style="margin-bottom: 0;" class="description"><em><?php echo __('NOTE: Use this feature with caution. Links to media files could unintentionally become podcast episodes.', 'powerpress'); ?></em></p>
667
- <p><em><?php echo __('WARNING: Episodes created with this feature will <u>not</u> include Duration (total play time) information.', 'powerpress'); ?></em></p>
668
- </td>
669
- </tr>
670
- <tr valign="top">
671
- <th scope="row">
672
- <?php echo __('Disable Warnings', 'powerpress'); ?></th>
673
- <td>
674
- <select name="General[hide_warnings]" class="bpp_input_med">
675
- <?php
676
- $options = array(0=>__('No (default)', 'powerpress'), 1=>__('Yes', 'powerpress') );
677
- $current_value = (!empty($General['hide_warnings'])?$General['hide_warnings']:0);
678
- foreach( $options as $value => $desc )
679
- echo "\t<option value=\"$value\"". ($current_value==$value?' selected':''). ">$desc</option>\n";
680
-
681
- ?>
682
- </select>
683
- <p><?php echo __('Disable warning messages displayed in episode entry box. Errors are still displayed.', 'powerpress'); ?></p>
684
- </td>
685
- </tr>
686
- </table>
687
- </div>
688
- <!-- end advanced features -->
689
- <?php
690
-
691
-
692
- global $wp_rewrite;
693
- if( $wp_rewrite->permalink_structure ) // Only display if permalinks is enabled in WordPress
694
- {
695
- ?>
696
- <h3><?php echo __('Permalinks', 'powerpress'); ?></h3>
697
- <table class="form-table">
698
- <tr valign="top">
699
- <th scope="row">
700
- <?php echo __('Podcast Permalinks', 'powerpress'); ?></th>
701
- <td>
702
- <select name="General[permalink_feeds_only]" class="bpp_input_normal">
703
- <?php
704
- $options = array(0=>__('Default WordPress Behavior', 'powerpress'), 1=>__('Match Feed Name to Page/Category', 'powerpress') );
705
- $current_value = (!empty($General['permalink_feeds_only'])?$General['permalink_feeds_only']:0);
706
-
707
- foreach( $options as $value => $desc )
708
- echo "\t<option value=\"$value\"". ($current_value==$value?' selected':''). ">$desc</option>\n";
709
-
710
- ?>
711
- </select>
712
- <p><?php echo sprintf(__('When configured, %s/podcast/ is matched to page/category named \'podcast\'.', 'powerpress'), get_bloginfo('url') ); ?></p>
713
- </td>
714
- </tr>
715
- </table>
716
- <?php
717
- }
718
- ?>
719
-
720
-
721
- <?php
722
- }
723
-
724
- function powerpressadmin_edit_podpress_options($General)
725
- {
726
- if( !empty($General['process_podpress']) || powerpress_podpress_episodes_exist() )
727
- {
728
- if( !isset($General['process_podpress']) )
729
- $General['process_podpress'] = 0;
730
- if( !isset($General['podpress_stats']) )
731
- $General['podpress_stats'] = 0;
732
- ?>
733
-
734
- <h3><?php echo __('PodPress Options', 'powerpress'); ?></h3>
735
- <table class="form-table">
736
- <tr valign="top">
737
- <th scope="row">
738
-
739
- <?php echo __('PodPress Episodes', 'powerpress'); ?></th>
740
- <td>
741
- <select name="General[process_podpress]" class="bpp_input_med">
742
- <?php
743
- $options = array(0=>__('Ignore', 'powerpress'), 1=>__('Include in Posts and Feeds', 'powerpress') );
744
-
745
- foreach( $options as $value => $desc )
746
- echo "\t<option value=\"$value\"". ($General['process_podpress']==$value?' selected':''). ">$desc</option>\n";
747
-
748
- ?>
749
- </select> (<?php echo __('includes podcast episodes previously created in PodPress', 'powerpress'); ?>)
750
- </td>
751
- </tr>
752
- <?php if( !empty($General['podpress_stats']) || powerpress_podpress_stats_exist() ) { ?>
753
- <tr valign="top">
754
- <th scope="row">
755
-
756
- <?php echo __('PodPress Stats Archive', 'powerpress'); ?></th>
757
- <td>
758
- <select name="General[podpress_stats]" class="bpp_input_sm">
759
- <?php
760
- $options = array(0=>__('Hide', 'powerpress'), 1=>__('Display', 'powerpress') );
761
-
762
- foreach( $options as $value => $desc )
763
- echo "\t<option value=\"$value\"". ($General['podpress_stats']==$value?' selected':''). ">$desc</option>\n";
764
-
765
- ?>
766
- </select> (<?php echo __('display archive of old PodPress statistics', 'powerpress'); ?>)
767
- </td>
768
- </tr>
769
- <?php } ?>
770
- </table>
771
- <?php
772
- }
773
- }
774
-
775
-
776
- function powerpressadmin_edit_googleplay($FeedSettings, $General, $FeedAttribs = array() )
777
- {
778
- $feed_slug = $FeedAttribs['feed_slug'];
779
- $cat_ID = $FeedAttribs['category_id'];
780
-
781
- // Set default settings (if not set)
782
- if( empty($FeedSettings['googleplay_url']) )
783
- $FeedSettings['googleplay_url'] = '';
784
- if( empty($FeedSettings['googleplay_email']) )
785
- $FeedSettings['googleplay_email'] = '';
786
- if( empty($FeedSettings['googleplay_author']) )
787
- $FeedSettings['googleplay_author'] = '';
788
- if( empty($FeedSettings['googleplay_description']) )
789
- $FeedSettings['googleplay_description'] = '';
790
- if( empty($FeedSettings['googleplay_explicit']) )
791
- $FeedSettings['googleplay_explicit'] = '';
792
- if( empty($FeedSettings['googleplay_cat']) )
793
- $FeedSettings['googleplay_cat'] = '';
794
-
795
- $gp_feed_url = '';
796
- switch( $FeedAttribs['type'] )
797
- {
798
- case 'ttid': {
799
- $gp_feed_url = get_term_feed_link($FeedAttribs['term_taxonomy_id'], $FeedAttribs['taxonomy_type'], 'rss2' );
800
- }; break;
801
- case 'category': {
802
- if( !empty($General['cat_casting_podcast_feeds']) )
803
- $gp_feed_url = get_category_feed_link($cat_ID, 'podcast');
804
- else
805
- $gp_feed_url = get_category_feed_link($cat_ID);
806
- }; break;
807
- case 'channel': {
808
- $gp_feed_url = get_feed_link($feed_slug);
809
- }; break;
810
- case 'post_type': {
811
- $gp_feed_url = get_post_type_archive_feed_link($FeedAttribs['post_type'], $feed_slug);
812
- }; break;
813
- case 'general':
814
- default: {
815
- $gp_feed_url = get_feed_link('podcast');
816
- }
817
- }
818
-
819
- ?>
820
- <h3><?php echo __('Google Play Settings', 'powerpress'); ?> </h3>
821
- <table class="form-table">
822
- <tr valign="top">
823
- <th scope="row">
824
- <?php echo __('Google Play Email', 'powerpress'); ?>
825
- </th>
826
- <td>
827
- <input type="text" name="Feed[googleplay_email]" class="bpp_input_med" value="<?php echo esc_attr($FeedSettings['googleplay_email']); ?>" maxlength="255" />
828
- <div>(<?php echo __('Google will email this address when your podcast is accepted to the Google Play Music Podcast directory.', 'powerpress'); ?>)</div>
829
- <p><?php echo __('iTunes email setting will be used if left blank.', 'powerpress'); ?></p>
830
- </td>
831
- </tr>
832
- <tr valign="top">
833
- <th scope="row">
834
- <?php echo __('Google Play Author', 'powerpress'); ?>
835
- </th>
836
- <td>
837
- <input type="text" name="Feed[googleplay_author]" class="bpp_input_med" value="<?php echo esc_attr($FeedSettings['googleplay_author']); ?>" maxlength="255" />
838
- <p><?php echo __('iTunes Author will be used if left blank', 'powerpress'); ?></p>
839
- <?php if( !empty($General['seo_itunes']) ) { ?>
840
- <p class="description"><?php echo __('Podcasting SEO Suggestion: This field may be indexed for Google Play Music search.', 'powerpress'); ?></p>
841
- <?php } ?>
842
- </td>
843
- </tr>
844
- <tr valign="top">
845
- <th scope="row">
846
- <?php echo __('Google Play Description', 'powerpress'); ?>
847
- </th>
848
- <td>
849
- <p style="margin-top: 5px;"><?php echo __('Your description cannot exceed 4,000 characters in length.', 'powerpress'); ?></p>
850
- <textarea name="Feed[googleplay_description]" rows="5" class="bpp-input-normal"><?php echo esc_textarea($FeedSettings['googleplay_description']); ?></textarea>
851
- <p><?php echo __('iTunes Summary will be used if left blank', 'powerpress'); ?></p>
852
- <?php if( !empty($General['seo_itunes']) ) { ?>
853
- <p class="description"><?php echo __('Podcasting SEO Suggestion: This field may be indexed for Google Play Music search.', 'powerpress'); ?></p>
854
- <?php } ?>
855
- </td>
856
- </tr>
857
- <tr valign="top">
858
- <th scope="row">
859
- <?php echo __('Google Play Explicit', 'powerpress'); ?>
860
- </th>
861
- <td>
862
- <select name="Feed[googleplay_explicit]" class="bpp_input_med">
863
- <?php
864
- $explicit = array(0=> __('No - display nothing', 'powerpress'), 1=>__('Yes - explicit content', 'powerpress') );
865
-
866
- foreach( $explicit as $value => $desc )
867
- echo "\t<option value=\"$value\"". ($FeedSettings['googleplay_explicit']==$value?' selected':''). ">$desc</option>\n";
868
-
869
- ?>
870
- </select>
871
- </td>
872
- </tr>
873
- <tr valign="top">
874
- <th scope="row">
875
- <?php echo __('Google Play Category', 'powerpress'); ?>
876
- <span class="powerpress-required"><?php echo __('Required', 'powerpress'); ?></span>
877
- </th>
878
- <td>
879
- <select name="Feed[googleplay_cat]" class="bpp_input_med">
880
- <?php
881
-
882
- $MoreCategories = false;
883
-
884
-
885
- $Categories = powerpress_googleplay_categories();
886
-
887
- echo '<option value="">'. __('Select Category', 'powerpress') .'</option>';
888
- foreach( $Categories as $value => $desc )
889
- echo "\t<option value=\"$value\"". ($FeedSettings['googleplay_cat']==$value?' selected':''). ">".htmlspecialchars($desc)."</option>\n";
890
-
891
- ?>
892
- </select>
893
- </td>
894
- </tr>
895
-
896
- </table>
897
- <?php
898
- }
899
-
900
- function powerpressadmin_edit_itunes_general($FeedSettings, $General, $FeedAttribs = array() )
901
- {
902
- // Set default settings (if not set)
903
- if( !empty($FeedSettings) )
904
- {
905
- if( !isset($FeedSettings['itunes_url']) )
906
- $FeedSettings['itunes_url'] = '';
907
- }
908
- if( !isset($General['itunes_url']) )
909
- $General['itunes_url'] = '';
910
- else if( !isset($FeedSettings['itunes_url']) ) // Should almost never happen
911
- $FeedSettings['itunes_url'] = $General['itunes_url'];
912
-
913
- $feed_slug = $FeedAttribs['feed_slug'];
914
- $cat_ID = $FeedAttribs['category_id'];
915
-
916
- if( $feed_slug == 'podcast' && $FeedAttribs['type'] == 'general' )
917
- {
918
- if( empty($FeedSettings['itunes_url']) && !empty($General['itunes_url']) )
919
- $FeedSettings['itunes_url'] = $General['itunes_url'];
920
- }
921
-
922
- $itunes_feed_url = '';
923
-
924
- switch( $FeedAttribs['type'] )
925
- {
926
- case 'ttid': {
927
- $itunes_feed_url = get_term_feed_link($FeedAttribs['term_taxonomy_id'], $FeedAttribs['taxonomy_type'], 'rss2');
928
- }; break;
929
- case 'category': {
930
- if( !empty($General['cat_casting_podcast_feeds']) )
931
- $itunes_feed_url = get_category_feed_link($cat_ID, 'podcast');
932
- else
933
- $itunes_feed_url = get_category_feed_link($cat_ID);
934
- }; break;
935
- case 'channel': {
936
- $itunes_feed_url = get_feed_link($feed_slug);
937
- }; break;
938
- case 'post_type': {
939
- $itunes_feed_url = get_post_type_archive_feed_link($FeedAttribs['post_type'], $feed_slug);
940
- }; break;
941
- case 'general':
942
- default: {
943
- $itunes_feed_url = get_feed_link('podcast');
944
- }
945
- }
946
-
947
- ?>
948
- <h3><?php echo __('iTunes Listing Information', 'powerpress'); ?></h3>
949
-
950
- <?php
951
- } // end itunes general
952
-
953
- function powerpressadmin_edit_blubrry_services($General, $action_url = false, $action = false)
954
- {
955
- $DisableStatsInDashboard = false;
956
- if( !empty($General['disable_dashboard_stats']) )
957
- $DisableStatsInDashboard = true;
958
-
959
-
960
- if( $action_url == false )
961
- $action_url = admin_url('admin.php?action=powerpress-jquery-account');
962
- if( $action == false )
963
- $action = 'powerpress-jquery-account';
964
- ?>
965
- <h3><?php echo __('Integrate Blubrry Services', 'powerpress'); ?></h3>
966
- <ul><li><ul>
967
- <li style="margin-left: 30px; font-size:115%;"><?php echo sprintf(__('Track your podcast downloads with Blubrry\'s <a href="%s" target="_blank">FREE Basic Statistics</a> or <a href="%s" target="_blank">Professional Media Statistics</a>.','powerpress'), 'http://create.blubrry.com/resources/podcast-media-download-statistics/basic-statistics/', 'http://create.blubrry.com/resources/podcast-media-download-statistics/'); ?></li>
968
- <li style="margin-left: 30px; font-size:115%;"><?php echo sprintf(__('Upload and publish podcast media directly from your blog with <a href="%s" target="_blank">Blubrry Media Hosting</a>.','powerpress'), 'http://create.blubrry.com/resources/podcast-media-hosting/'); ?></li>
969
- </ul></li></ul>
970
- <div style="margin-left: 40px;">
971
- <p style="font-size: 125%;">
972
- <strong><a class="button-primary button-blubrry thickbox" title="<?php echo esc_attr(__('Blubrry Services Integration', 'powerpress')); ?>" href="<?php echo wp_nonce_url( $action_url, $action); ?>&amp;KeepThis=true&amp;TB_iframe=true&amp;width=600&amp;height=400&amp;modal=false" target="_blank"><?php echo __('Click here to configure Blubrry Statistics and Hosting services', 'powerpress'); ?></a></strong>
973
- </p>
974
- <?php
975
- if( !empty($General['blubrry_program_keyword']) )
976
- {
977
- // Check that the redirect is in the settings...
978
- $RedirectURL = 'http://media.blubrry.com/'.$General['blubrry_program_keyword'].'/';
979
- $Error = true;
980
- if( stripos($General['redirect1'], $RedirectURL ) !== false )
981
- $Error = false;
982
- else if( stripos($General['redirect2'], $RedirectURL ) !== false )
983
- $Error = false;
984
- else if( stripos($General['redirect3'], $RedirectURL ) !== false )
985
- $Error = false;
986
- if( $Error )
987
- {
988
- ?>
989
- <p style="font-weight: bold; color: #CC0000;">
990
- <?php
991
- echo __('Statistics are not implemented correctly on this blog. Please click the button above to re-configure your services.', 'powerpress');
992
- ?>
993
- </p>
994
- <?php
995
- }
996
- else
997
- {
998
- ?>
999
- <p style="font-weight: bold;">
1000
- <img src="<?php echo powerpress_get_root_url(); ?>images/Check.png" style="width: 25px; height: 20px;" alt="<?php echo __('Enabled!', 'powerpress'); ?>" />
1001
- <?php
1002
- if( empty($General['blubrry_hosting']) || $General['blubrry_hosting'] === 'false' )
1003
- echo __('Blubrry Statistics Enabled!', 'powerpress');
1004
- else
1005
- echo __('Blubrry Statistics and Media Hosting Enabled!', 'powerpress');
1006
- ?>
1007
- </p>
1008
- <?php
1009
- }
1010
-
1011
- if( empty($General['blubrry_hosting']) || $General['blubrry_hosting'] === 'false' )
1012
- {
1013
- ?>
1014
- <p>
1015
- <?php echo __('Recently upgraded to Blubrry Hosting?', 'powerpress'); ?>
1016
- <a class="thickbox" title="<?php echo esc_attr(__('Blubrry Services Integration', 'powerpress')); ?>" href="<?php echo admin_url(); echo wp_nonce_url( "admin.php?action=powerpress-jquery-account", 'powerpress-jquery-account'); ?>&amp;KeepThis=true&amp;TB_iframe=true&amp;width=600&amp;height=400&amp;modal=false" target="_blank"><?php echo __('Click here to enter your account information.', 'powerpress'); ?></a>
1017
- </p>
1018
- <?php
1019
- }
1020
- }
1021
- ?>
1022
- </div>
1023
- <?php
1024
- if( empty($General['blubrry_hosting']) || $General['blubrry_hosting'] === 'false' ) // Not signed up for hosting?
1025
- {
1026
- ?>
1027
- <div class="blubrry-services">
1028
- <div class="blubrry-hosting">
1029
- <p class="top-lines"><?php echo __('Need a reliable host for your podcast media?', 'powerpress'); ?></p>
1030
- <p><?php echo __('Blubrry Media Hosting packages start at $12.', 'powerpress'); ?></p>
1031
- <p><a href="http://create.blubrry.com/resources/podcast-media-hosting/" target="_blank"><?php echo __('Learn More', 'powerpress'); ?></a></p>
1032
- </div>
1033
- <div class="blubrry-stats">
1034
- <p class="top-lines"><?php echo __('Measure your audience for <strong>free</strong> and add more detailed', 'powerpress'); ?></p>
1035
- <p><?php echo __('reporting for only $5 per month.', 'powerpress'); ?></p>
1036
- <p>&nbsp;</p>
1037
- <p><a href="http://create.blubrry.com/resources/podcast-media-download-statistics/" target="_blank"><?php echo __('Learn More', 'powerpress'); ?></a></p>
1038
- </div>
1039
- <div class="clear"></div>
1040
- </div>
1041
- <?php
1042
- } // end not signed up for hosting
1043
-
1044
- ?>
1045
- <div style="margin-left: 40px;">
1046
- <p style="margin-top: 10px;">
1047
- <input name="DisableStatsInDashboard" type="checkbox" value="1"<?php if( $DisableStatsInDashboard == true ) echo ' checked'; ?> />
1048
- <?php echo __('Remove Statistics from WordPress Dashboard', 'powerpress'); ?></p>
1049
- </div>
1050
- <?php
1051
- }
1052
-
1053
- function powerpressadmin_edit_media_statistics($General)
1054
- {
1055
- if( !isset($General['redirect1']) )
1056
- $General['redirect1'] = '';
1057
- if( !isset($General['redirect2']) )
1058
- $General['redirect2'] = '';
1059
- if( !isset($General['redirect3']) )
1060
- $General['redirect3'] = '';
1061
-
1062
- $StatsIntegrationURL = '';
1063
- if( !empty($General['blubrry_program_keyword']) )
1064
- $StatsIntegrationURL = 'http://media.blubrry.com/'.$General['blubrry_program_keyword'].'/';
1065
- ?>
1066
- <div id="blubrry_stats_settings">
1067
- <h3><?php echo __('Media Statistics', 'powerpress'); ?></h3>
1068
- <div style="margin-left: 40px;">
1069
- <p>
1070
- <?php echo __('Enter your Redirect URL issued by your media statistics service provider below.', 'powerpress'); ?>
1071
- </p>
1072
-
1073
- <div style="position: relative; margin-left: 40px; padding-bottom: 10px;">
1074
- <table class="form-table">
1075
- <tr valign="top">
1076
- <th scope="row">
1077
- <?php echo __('Redirect URL 1', 'powerpress'); ?>
1078
- </th>
1079
- <td>
1080
- <input type="text" style="width: 60%;" name="<?php if( stripos($General['redirect1'], $StatsIntegrationURL) !== false ) echo 'NULL[redirect1]'; else echo 'General[redirect1]'; ?>" value="<?php echo esc_attr($General['redirect1']); ?>" onChange="return CheckRedirect(this);" maxlength="255" <?php if( stripos($General['redirect1'], $StatsIntegrationURL) !== false ) { echo ' readOnly="readOnly"'; $StatsIntegrationURL = false; } ?> />
1081
- </td>
1082
- </tr>
1083
- </table>
1084
- <?php if( empty($General['redirect2']) && empty($General['redirect3']) ) { ?>
1085
- <div style="position: absolute;bottom: -2px;left: -40px;" id="powerpress_redirect2_showlink">
1086
- <a href="#" onclick="javascript:document.getElementById('powerpress_redirect2_table').style.display='block';document.getElementById('powerpress_redirect2_showlink').style.display='none';return false;"><?php echo __('Add Another Redirect', 'powerpress'); ?></a>
1087
- </div>
1088
- <?php } ?>
1089
- </div>
1090
-
1091
-
1092
- <div id="powerpress_redirect2_table" style="position: relative;<?php if( empty($General['redirect2']) && empty($General['redirect3']) ) echo 'display:none;'; ?> margin-left: 40px; padding-bottom: 10px;">
1093
- <table class="form-table">
1094
- <tr valign="top">
1095
- <th scope="row">
1096
- <?php echo __('Redirect URL 2', 'powerpress'); ?>
1097
- </th>
1098
- <td>
1099
- <input type="text" style="width: 60%;" name="<?php if( stripos($General['redirect2'], $StatsIntegrationURL) !== false ) echo 'NULL[redirect2]'; else echo 'General[redirect2]'; ?>" value="<?php echo esc_attr($General['redirect2']); ?>" onblur="return CheckRedirect(this);" maxlength="255" <?php if( stripos($General['redirect2'], $StatsIntegrationURL) !== false ) { echo ' readOnly="readOnly"'; $StatsIntegrationURL = false; } ?> />
1100
- </td>
1101
- </tr>
1102
- </table>
1103
- <?php if( $General['redirect3'] == '' ) { ?>
1104
- <div style="position: absolute;bottom: -2px;left: -40px;" id="powerpress_redirect3_showlink">
1105
- <a href="#" onclick="javascript:document.getElementById('powerpress_redirect3_table').style.display='block';document.getElementById('powerpress_redirect3_showlink').style.display='none';return false;"><?php echo __('Add Another Redirect', 'powerpress'); ?></a>
1106
- </div>
1107
- <?php } ?>
1108
- </div>
1109
-
1110
- <div id="powerpress_redirect3_table" style="<?php if( empty($General['redirect3']) ) echo 'display:none;'; ?> margin-left: 40px;">
1111
- <table class="form-table">
1112
- <tr valign="top">
1113
- <th scope="row">
1114
- <?php echo __('Redirect URL 3', 'powerpress'); ?>
1115
- </th>
1116
- <td>
1117
- <input type="text" style="width: 60%;" name="<?php if( stripos($General['redirect3'], $StatsIntegrationURL) !== false ) echo 'NULL[redirect3]'; else echo 'General[redirect3]'; ?>" value="<?php echo esc_attr($General['redirect3']); ?>" onblur="return CheckRedirect(this);" maxlength="255" <?php if( stripos($General['redirect3'], $StatsIntegrationURL) !== false ) echo ' readOnly="readOnly"'; ?> />
1118
- </td>
1119
- </tr>
1120
- </table>
1121
- </div>
1122
- <style type="text/css">
1123
- #TB_window {
1124
- border: solid 1px #3D517E;
1125
- }
1126
- </style>
1127
- </div>
1128
- </div><!-- end blubrry_stats_settings -->
1129
- <?php
1130
- }
1131
-
1132
- function powerpressadmin_appearance($General=false, $Feed = false)
1133
- {
1134
- if( $General === false )
1135
- $General = powerpress_get_settings('powerpress_general');
1136
- $General = powerpress_default_settings($General, 'appearance');
1137
- if( !isset($General['player_function']) )
1138
- $General['player_function'] = 1;
1139
- if( !isset($General['player_aggressive']) )
1140
- $General['player_aggressive'] = 0;
1141
- if( !isset($General['new_window_width']) )
1142
- $General['new_window_width'] = '';
1143
- if( !isset($General['new_window_height']) )
1144
- $General['new_window_height'] = '';
1145
- if( !isset($General['player_width']) )
1146
- $General['player_width'] = '';
1147
- if( !isset($General['player_height']) )
1148
- $General['player_height'] = '';
1149
- if( !isset($General['player_width_audio']) )
1150
- $General['player_width_audio'] = '';
1151
- if( !isset($General['disable_appearance']) )
1152
- $General['disable_appearance'] = false;
1153
- if( !isset($General['subscribe_links']) )
1154
- $General['subscribe_links'] = true;
1155
- if( !isset($General['subscribe_label']) )
1156
- $General['subscribe_label'] = '';
1157
-
1158
-
1159
- /*
1160
- $Players = array('podcast'=>__('Default Podcast (podcast)', 'powerpress') );
1161
- if( isset($General['custom_feeds']) )
1162
- {
1163
- foreach( $General['custom_feeds'] as $podcast_slug => $podcast_title )
1164
- {
1165
- if( $podcast_slug == 'podcast' )
1166
- continue;
1167
- $Players[$podcast_slug] = sprintf('%s (%s)', $podcast_title, $podcast_slug);
1168
- }
1169
- }
1170
- */
1171
-
1172
- ?>
1173
-
1174
- <!-- start advanced features -->
1175
- <?php if( !empty($General['advanced_mode_2']) ) { ?>
1176
- <h3><?php echo __('Website Settings', 'powerpress'); ?></h3>
1177
- <div id="enable_presentation_settings">
1178
- <table class="form-table">
1179
- <tr valign="top">
1180
- <th scope="row">&nbsp; </th>
1181
- <td>
1182
- <ul>
1183
- <li><p><label><input type="radio" name="General[disable_appearance]" value="0" <?php if( $General['disable_appearance'] == 0 ) echo 'checked'; ?> onclick="javascript: jQuery('#presentation_settings').css('display', (this.checked?'block':'none') );" /> <?php echo __('Enable PowerPress Media Players and Links', 'powerpress'); ?></label> (<?php echo __('default', 'powerpress'); ?>)</p>
1184
- <ul><li>
1185
- <p class="description"><?php echo __('PowerPress will add media players and links to your site.', 'powerpress'); ?></p>
1186
- </li></ul>
1187
- </li>
1188
-
1189
- <li><p><label><input type="radio" name="General[disable_appearance]" value="1" <?php if( $General['disable_appearance'] == 1 ) echo 'checked'; ?> onclick="javascript: jQuery('#presentation_settings').css('display', (this.checked?'none':'block') );" /> <?php echo __('Disable PowerPress Media Players and Links', 'powerpress'); ?></label></p>
1190
- <ul><li>
1191
- <p class="description"><?php echo __('PowerPress will <u>not</u> add any media players or media links to your site. PowerPress will only be used to add podcasting support to your feeds.', 'powerpress'); ?></p>
1192
- </li></ul>
1193
- </li>
1194
- </ul>
1195
- </td>
1196
- </tr>
1197
- </table>
1198
- </div><!-- end enable_presentation_settings -->
1199
- <div id="presentation_settings"<?php if($General['disable_appearance']) echo ' style="display: none;"'; ?>>
1200
- <!-- start presentation_settings in advanced mode -->
1201
- <!-- end advanced features -->
1202
- <?php } ?>
1203
-
1204
- <h3><?php echo __('Blog Posts and Pages', 'powerpress'); ?></h3>
1205
-
1206
-
1207
- <table class="form-table">
1208
- <tr valign="top">
1209
- <th scope="row"><?php echo htmlspecialchars(__('Display Media & Links', 'powerpress')); ?></th>
1210
- <td>
1211
- <ul>
1212
- <li><p><label><input type="radio" name="General[display_player]" value="1" <?php if( $General['display_player'] == 1 ) echo 'checked'; ?> /> <?php echo __('Below page content', 'powerpress'); ?></label> (<?php echo __('default', 'powerpress'); ?>)</p>
1213
- <ul><li>
1214
- <p class="description"><?php echo __('Player and media links will appear <u>below</u> your post and page content.', 'powerpress'); ?><p>
1215
- </li></ul>
1216
- </li>
1217
- <li><p><label><input type="radio" name="General[display_player]" value="2" <?php if( $General['display_player'] == 2 ) echo 'checked'; ?> /> <?php echo __('Above page content', 'powerpress'); ?></label></p>
1218
- <ul><li>
1219
- <p class="description"><?php echo __('Player and media links will appear <u>above</u> your post and page content.', 'powerpress'); ?></p>
1220
- </li></ul>
1221
- </li>
1222
- <li>
1223
- <p><label><input type="radio" name="General[display_player]" value="0" <?php if( $General['display_player'] == 0 ) echo 'checked'; ?> /> <?php echo __('Disable', 'powerpress'); ?></label></p>
1224
- <ul><li>
1225
- <p class="description"><?php echo __('Player and media links will <u>NOT</u> appear in your post and page content. Media player and links can be added manually by using the <i>shortcode</i> below.', 'powerpress'); ?></p>
1226
- </li></ul>
1227
- </li>
1228
- </ul>
1229
- <p><input name="General[display_player_excerpt]" type="checkbox" value="1" <?php if( !empty($General['display_player_excerpt']) ) echo 'checked '; ?>/> <?php echo __('Display player / links:', 'powerpress'); ?> <a href="http://codex.wordpress.org/Template_Tags/the_excerpt" title="<?php echo __('WordPress Excerpts', 'powerpress'); ?>" target="_blank"><?php echo __('WordPress Excerpts', 'powerpress'); ?></a> (<?php echo __('e.g. search results', 'powerpress'); ?>)</p>
1230
- <input type="hidden" name="General[hide_player_more]" value="0" />
1231
- <p><input name="General[hide_player_more]" type="checkbox" value="1" <?php if( !empty($General['hide_player_more']) ) echo 'checked '; ?>/> <?php echo __('Hide player / links:', 'powerpress'); ?> <a href="https://en.support.wordpress.com/more-tag/" title="<?php echo __('Read More tagged posts', 'powerpress'); ?>" target="_blank"><?php echo __('Read More tagged posts', 'powerpress'); ?></a></p>
1232
- </td>
1233
- </tr>
1234
- </table>
1235
-
1236
- <?php if( !empty($General['advanced_mode_2']) ) { ?>
1237
- <!-- start advanced features -->
1238
- <table class="form-table">
1239
- <tr valign="top">
1240
- <th scope="row">
1241
- <?php echo __('Media Player', 'powerpress'); ?></th>
1242
- <td>
1243
-
1244
- <p><label><input type="checkbox" name="PlayerSettings[display_media_player]" value="2" <?php if( $General['player_function'] == 1 || $General['player_function'] == 2 ) echo 'checked '; ?>/> <?php echo __('Display Player', 'powerpress'); ?></label></p>
1245
- <?php /* ?>
1246
- <p style="margin-left: 35px;"><input type="checkbox" name="General[display_player_disable_mobile]" value="1" <?php if( !empty($General['display_player_disable_mobile']) ) echo 'checked '; ?>/> <?php echo __('Disable Media Player for known mobile devices.', 'powerpress'); ?></p>
1247
- <?php */ ?>
1248
- <p><?php echo __('Detected mobile and tablet devices use an HTML5 player with a fallback link to download the media.', 'powerpress'); ?></p>
1249
- </td>
1250
- </tr>
1251
- </table>
1252
-
1253
-
1254
-
1255
-
1256
- <table class="form-table">
1257
-
1258
- <tr valign="top">
1259
- <th scope="row">
1260
-
1261
- <?php echo __('Media Links', 'powerpress'); ?></th>
1262
- <td>
1263
- <p style="padding-top: 8px;"><label><input type="checkbox" name="PlayerSettings[display_pinw]" value="3" <?php if( $General['player_function'] == 3 || $General['player_function'] == 1 ) echo 'checked '; ?>/> <?php echo __('Display Play in new Window Link', 'powerpress'); ?></label></p>
1264
-
1265
- <p><label><input type="checkbox" name="PlayerSettings[display_download]" value="1" <?php if( $General['podcast_link'] != 0 ) echo 'checked '; ?>/> <?php echo __('Display Download Link', 'powerpress'); ?></label></p>
1266
-
1267
- <p style="margin-left: 35px;"><input type="checkbox" id="display_download_size" name="PlayerSettings[display_download_size]" value="1" <?php if( $General['podcast_link'] == 2 || $General['podcast_link'] == 3 ) echo 'checked'; ?> onclick="if( !this.checked ) { jQuery('#display_download_duration').removeAttr('checked'); }" /> <?php echo __('Include file size', 'powerpress'); ?>
1268
- <input type="checkbox" style="margin-left: 30px;" id="display_download_duration" name="PlayerSettings[display_download_duration]" value="1" <?php if( $General['podcast_link'] == 3 ) echo 'checked'; ?> onclick="if( this.checked ) { jQuery('#display_download_size').attr('checked','checked'); }" /> <?php echo __('Include file size and duration', 'powerpress'); ?></p>
1269
-
1270
- <p><label><input type="checkbox" name="General[podcast_embed]" value="1" <?php if( !empty($General['podcast_embed']) ) echo 'checked '; ?>/> <?php echo __('Display Player Embed Link', 'powerpress'); ?> </label></p>
1271
- <p style="margin-left: 35px;">
1272
- <input type="checkbox" name="General[podcast_embed_in_feed]" value="1" <?php if( !empty($General['podcast_embed_in_feed']) ) echo 'checked'; ?> /> <?php echo __('Include embed in feeds', 'powerpress'); ?>
1273
- </p>
1274
- <p><?php echo __('Embed option works with the MediaElement.js Media Player for audio and video, Flow Player Classic for audio and HTML5 Video player for video.', 'powerpress'); ?></p>
1275
- </td>
1276
- </tr>
1277
- </table>
1278
-
1279
- <table class="form-table">
1280
-
1281
- <tr valign="top">
1282
- <th scope="row">
1283
- <?php echo __('Subscribe Links', 'powerpress'); ?> </th>
1284
- <td>
1285
- <p style="padding-top: 8px;"><label><input type="checkbox" name="General[subscribe_links]" value="1" <?php if( $General['subscribe_links'] == 1 ) echo 'checked '; ?>/>
1286
- <?php echo __('Display subscribe links below player and media links.', 'powerpress'); ?></label></p>
1287
- <ul>
1288
- <li><label for="subscribe_label">Subscribe label: <input type="text" id="subscribe_label" value="<?php echo esc_attr($General['subscribe_label']); ?>" name="General[subscribe_label]" placeholder="Subscribe:" /></label>
1289
- <?php echo __('(leave blank for default)', 'powerpress'); ?>
1290
- </li>
1291
- </ul>
1292
-
1293
- <p style="padding-top:10px;"><input type="checkbox" name="NULL[subscribe_feature_itunes]" value="1" checked disabled /> <label><?php echo __('Subscribe on Apple Podcasts', 'powerpress'); ?></label></p>
1294
- <div style="margin-left: 24px;">
1295
- <p><a href="<?php echo 'https://linkmaker.itunes.apple.com/?q='.urlencode( get_bloginfo('name') ); ?>&amp;media=podcasts" target="_blank"><?php echo __('Find your iTunes Subscription URL', 'powerpress'); ?></a></p>
1296
- </div>
1297
-
1298
- <p><input type="checkbox" name="NULL[subscribe_feature_android]" value="1" checked disabled /> <label><?php echo __('Subscribe on Android', 'powerpress'); ?></label></p>
1299
- <div style="margin-left: 24px;">
1300
- <p><a href="http://subscribeonandroid.com/podcasters/" target="_blank"><?php echo __('Learn more about Subscribe on Android', 'powerpress'); ?></a></p>
1301
- </div>
1302
-
1303
- <p><input type="hidden" name="General[subscribe_feature_rss]" value="0" /><input type="checkbox" name="General[subscribe_feature_rss]" value="1" id="subscribe_feature_rss" <?php if( !empty($General['subscribe_feature_rss']) || !isset($General['subscribe_feature_rss']) ) echo 'checked '; ?>/> <label for="subscribe_feature_rss"><?php echo __('Subscribe via RSS', 'powerpress'); ?></label></p>
1304
-
1305
- <p><input type="checkbox" id="subscribe_feature_email" name="General[subscribe_feature_email]" value="1" <?php if( !empty($General['subscribe_feature_email']) ) echo 'checked '; ?>/> <label for="subscribe_feature_email"><?php echo __('Subscribe By Email', 'powerpress'); ?></label> </p>
1306
- <div style="margin-left: 24px;">
1307
- <p>
1308
- <?php echo __('Subscribe By Email is a service that allows listeners to subscribe to their favorite podcasts by email.', 'powerpress'); ?>
1309
- </p>
1310
- <p><a href="http://subscribebyemail.com/podcasters/" target="_blank"><?php echo __('Learn more about Subscribe by Email', 'powerpress'); ?></a></p>
1311
- <p><?php echo __('Note: Subscribe by Email does not replace newsletters or mailing lists. It is only for podcast syndication.', 'powerpress'); ?>
1312
- </p>
1313
- </div>
1314
-
1315
- <p><input type="hidden" name="General[subscribe_feature_gp]" value="0" /><input type="checkbox" id="subscribe_feature_gp" name="General[subscribe_feature_gp]" value="1" <?php if( !empty($General['subscribe_feature_gp']) ) echo 'checked '; ?>/> <label for="subscribe_feature_gp"><?php echo __('Subscribe on Google Podcasts', 'powerpress'); ?></label> <?php echo powerpressadmin_new(); ?></p>
1316
- <p><?php echo __('Note: Subscribe on Android includes Google Podcasts.', 'powerpress'); ?>
1317
-
1318
- <p><input type="hidden" name="General[subscribe_feature_stitcher]" value="0" /><input type="checkbox" id="subscribe_feature_stitcher" name="General[subscribe_feature_stitcher]" value="1" <?php if( !empty($General['subscribe_feature_stitcher']) ) echo 'checked '; ?>/> <label for="subscribe_feature_stitcher"><?php echo __('Subscribe on Stitcher', 'powerpress'); ?></label></p>
1319
-
1320
- <p><input type="hidden" name="General[subscribe_feature_tunein]" value="0" /><input type="checkbox" id="subscribe_feature_tunein" name="General[subscribe_feature_tunein]" value="1" <?php if( !empty($General['subscribe_feature_tunein']) ) echo 'checked '; ?>/> <label for="subscribe_feature_tunein"><?php echo __('Subscribe on TuneIn', 'powerpress'); ?></label></p>
1321
-
1322
- <p><input type="hidden" name="General[subscribe_feature_spotify]" value="0" /><input type="checkbox" id="subscribe_feature_spotify" name="General[subscribe_feature_spotify]" value="1" <?php if( !empty($General['subscribe_feature_spotify']) ) echo 'checked '; ?>/> <label for="subscribe_feature_spotify"><?php echo __('Subscribe on Spotify', 'powerpress'); ?></label> <?php echo powerpressadmin_new(); ?></p>
1323
-
1324
- </td>
1325
- </tr>
1326
- </table>
1327
-
1328
- <?php powerpressadmin_settings_tab_appearance($General, $Feed, false); ?>
1329
- <!-- end advanced features -->
1330
- <?php } ?>
1331
-
1332
-
1333
- <table class="form-table">
1334
- <tr valign="top">
1335
- <th scope="row" style="background-image: url(../wp-includes/images/smilies/icon_exclaim.gif); background-position: 10px 10px; background-repeat: no-repeat; ">
1336
-
1337
- <div style="margin-left: 24px;"><?php echo __('Having Issues?', 'powerpress'); ?></div></th>
1338
- <td>
1339
- <select name="General[player_aggressive]" class="bpp_input_med">
1340
- <?php
1341
- $linkoptions = array(0=>__('No, everything is working', 'powerpress'),
1342
- 1=>__('Yes, please try to fix', 'powerpress'),
1343
- 2=>__('Yes, alternative fix', 'powerpress'),
1344
- 3=>__('Yes, excluding excerpts', 'powerpress'),
1345
- 4=>__('Yes, wp_head check', 'powerpress') );
1346
-
1347
- foreach( $linkoptions as $value => $desc )
1348
- echo "\t<option value=\"$value\"". ($General['player_aggressive']==$value?' selected':''). ">$desc</option>\n";
1349
-
1350
- ?>
1351
- </select> <a href="http://create.blubrry.com/resources/powerpress/powerpress-settings/media-appearance/resolving-plugin-theme-conflict-issues/" target="_blank"><?php echo __('Learn More', 'powerpress'); ?></a>
1352
- <p style="margin-top: 5px;">
1353
- <?php echo __('Use this option if you are having problems with the players not appearing on some or all of your pages.', 'powerpress'); ?>
1354
- </p>
1355
- <?php if( !empty($General['advanced_mode_2']) ) { ?>
1356
- <p style="margin-top: 20px; margin-bottom:0;">
1357
- <?php echo __('If the above option fixes the player issues, then you most likely have a conflicting theme or plugin activated. You can verify your theme is not causing the problem by testing your site using the latest default WordPress theme (twentyfourteen). For plugins, disable them one by one until the player re-appears, which indicates the last plugin deactivated caused the conflict.', 'powerpress'); ?>
1358
- </p>
1359
- <?php } ?>
1360
- </td>
1361
- </tr>
1362
- </table>
1363
-
1364
- <?php if( !empty($General['advanced_mode_2']) ) { ?>
1365
- <!-- start advanced features -->
1366
- <div id="new_window_settings" style="display: <?php echo ( $General['player_function']==1 || $General['player_function']==3 ?'block':'none'); ?>">
1367
- <h3><?php echo __('Play in New Window Settings', 'powerpress'); ?></h3>
1368
- <table class="form-table">
1369
-
1370
- <tr valign="top">
1371
- <th scope="row">
1372
- <?php echo __('New Window Width', 'powerpress'); ?>
1373
- </th>
1374
- <td>
1375
- <input type="text" name="General[new_window_width]" style="width: 50px;" onkeyup="javascript:this.value=this.value.replace(/[^0-9]/g, '');" value="<?php echo esc_attr($General['new_window_width']); ?>" maxlength="4" />
1376
- <?php echo __('Width of new window (leave blank for 420 default)', 'powerpress'); ?>
1377
- </td>
1378
- </tr>
1379
-
1380
- <tr valign="top">
1381
- <th scope="row">
1382
- <?php echo __('New Window Height', 'powerpress'); ?>
1383
- </th>
1384
- <td>
1385
- <input type="text" name="General[new_window_height]" style="width: 50px;" onkeyup="javascript:this.value=this.value.replace(/[^0-9]/g, '');" value="<?php echo esc_attr($General['new_window_height']); ?>" maxlength="4" />
1386
- <?php echo __('Height of new window (leave blank for 240 default)', 'powerpress'); ?>
1387
- </td>
1388
- </tr>
1389
-
1390
- <tr valign="top">
1391
- <th scope="row">
1392
- &nbsp;
1393
- </th>
1394
- <td>
1395
-
1396
- <p style="margin: 8px 0 0 0;">
1397
- <label><input type="checkbox" name="General[new_window_nofactor]" value="1" <?php if( !empty($General['new_window_nofactor']) ) echo 'checked'; ?> /> <?php echo __('Do not factor in scroll bars', 'powerpress'); ?></label>
1398
- </p>
1399
- <div style="margin: 0 0 0 20px;"><?php echo __('By default, PowerPress adds to the width and height above to compensate for possible vertical and horizontal scroll bars. Check this option if you do not want PowerPress to compensate for browser scroll bars.', 'powerpress'); ?></div>
1400
- </td>
1401
-
1402
- </table>
1403
- </div><!-- end new_window_settings -->
1404
-
1405
- </div><!-- end presentation_settings in advanced mode -->
1406
- <!-- end presentation settings -->
1407
- <!-- end advanced features -->
1408
- <?php } ?>
1409
- <?php
1410
- } // End powerpress_admin_appearance()
1411
-
1412
-
1413
- function powerpressadmin_welcome($GeneralSettings)
1414
- {
1415
- ?>
1416
- <div>
1417
- <div class="powerpress-welcome-news">
1418
- <h2><?php echo __('Blubrry PowerPress and Community Podcast', 'powerpress'); ?></h2>
1419
- <?php powerpressadmin_community_news(); ?>
1420
- <p style="margin-bottom: 0; font-size: 85%;">
1421
- <input type="checkbox" name="General[disable_dashboard_news]" value="1" <?php echo (empty($GeneralSettings['disable_dashboard_news'])?'':'checked'); ?> /> <?php echo __('Remove from dashboard', 'powerpress'); ?>
1422
- </p>
1423
- </div>
1424
- <div class="powerpress-welcome-highlighted">
1425
- <div>
1426
- <h2><?php echo __('Highlighted Topics', 'powerpress'); ?></h2>
1427
- <?php powerpressadmin_community_highlighted(); ?>
1428
- </div>
1429
- </div>
1430
- <div class="clear"></div>
1431
- </div>
1432
- <?php
1433
- } // End powerpressadmin_welcome()
1434
-
1435
- function powerpressadmin_edit_funding($FeedSettings = false, $feed_slug='podcast', $cat_ID=false)
1436
- {
1437
- if( !isset($FeedSettings['donate_link']) )
1438
- $FeedSettings['donate_link'] = 0;
1439
- if( !isset($FeedSettings['donate_url']) )
1440
- $FeedSettings['donate_url'] = '';
1441
- if( !isset($FeedSettings['donate_label']) )
1442
- $FeedSettings['donate_label'] = '';
1443
- ?>
1444
- <!-- Donate link and label -->
1445
- <table class="form-table">
1446
- <tr valign="top">
1447
- <th scope="row">
1448
- <?php echo __('Donate Link', 'powerpress'); ?> </th>
1449
- <td>
1450
- <p style="padding-top: 8px;"><label for="donate_link"><input type="checkbox" id="donate_link" name="Feed[donate_link]" value="1" <?php if( $FeedSettings['donate_link'] == 1 ) echo 'checked '; ?>/>
1451
- <?php echo __('Syndicate a donate link with your podcast. Create your own croudfunding page with PayPal donate buttons, or link to a service such as Patreon.', 'powerpress'); ?></label></p>
1452
- <ul>
1453
- <li><label for="donate_url" style="width: 100px; display:inline-block; text-align: right;">Donate URL:</label> <input type="text" id="donate_url" value="<?php echo esc_attr($FeedSettings['donate_url']); ?>" name="Feed[donate_url]" style="width:50%; max-width: 300px;" />
1454
- </li>
1455
- <li><label for="donate_label" style="width: 100px; display:inline-block; text-align: right;">Donate label:</label> <input type="text" id="donate_label" value="<?php echo esc_attr($FeedSettings['donate_label']); ?>" name="Feed[donate_label]" style="width: 50%; max-width: 300px;" />
1456
- <?php echo __('(optional)', 'powerpress'); ?>
1457
- </li>
1458
- </ul>
1459
- <p><a href="http://create.blubrry.com/resources/powerpress/advanced-tools-and-options/syndicating-a-donate-link-in-your-podcast/" target="_blank"><?php echo __('Learn more about syndicating donate links for podcasting', 'powerpress'); ?></a></p>
1460
- </td>
1461
- </tr>
1462
- </table>
1463
- <?php
1464
- }
1465
-
1466
- function powerpressadmin_edit_tv($FeedSettings = false, $feed_slug='podcast', $cat_ID=false)
1467
- {
1468
- if( !isset($FeedSettings['parental_rating']) )
1469
- $FeedSettings['parental_rating'] = '';
1470
-
1471
- ?>
1472
- <h3><?php echo __('T.V. Settings', 'powerpress'); ?></h3>
1473
- <table class="form-table">
1474
- <tr valign="top">
1475
- <th scope="row">
1476
- <?php echo __('Parental Rating', 'powerpress'); ?> </th>
1477
- <td>
1478
- <p><?php echo sprintf(__('A parental rating is used to display your content on %s applications available on Internet connected TV\'s. The TV Parental Rating applies to both audio and video media.', 'powerpress'), '<strong><a href="http://www.blubrry.com/roku_blubrry/" target="_blank">Blubrry</a></strong>'); ?></p>
1479
- <?php
1480
- $Ratings = array(''=>__('No rating specified', 'powerpress'),
1481
- 'TV-Y'=>__('Children of all ages', 'powerpress'),
1482
- 'TV-Y7'=>__('Children 7 years and older', 'powerpress'),
1483
- 'TV-Y7-FV'=>__('Children 7 years and older [fantasy violence]', 'powerpress'),
1484
- 'TV-G'=>__('General audience', 'powerpress'),
1485
- 'TV-PG'=>__('Parental guidance suggested', 'powerpress'),
1486
- 'TV-14'=>__('May be unsuitable for children under 14 years of age', 'powerpress'),
1487
- 'TV-MA'=>__('Mature audience - may be unsuitable for children under 17', 'powerpress')
1488
- );
1489
- $RatingsTips = array(''=>'',
1490
- 'TV-Y'=>__('Whether animated or live-action, the themes and elements in this program are specifically designed for a very young audience, including children from ages 2-6. These programs are not expected to frighten younger children. Examples of programs issued this rating include Sesame Street, Barney & Friends, Dora the Explorer, Go, Diego, Go! and The Backyardigans.', 'powerpress'),
1491
- 'TV-Y7'=>__('These shows may or may not be appropriate for some children under the age of 7. This rating may include crude, suggestive humor, mild fantasy violence, or content considered too scary or controversial to be shown to children under seven. Examples include Foster\'s Home for Imaginary Friends, Johnny Test, and SpongeBob SquarePants.', 'powerpress'),
1492
- 'TV-Y7-FV'=>__('When a show has noticeably more fantasy violence, it is assigned the TV-Y7-FV rating. Action-adventure shows such Pokemon series and the Power Rangers series are assigned a TV-Y7-FV rating.', 'powerpress'),
1493
- 'TV-G'=>__('Although this rating does not signify a program designed specifically for children, most parents may let younger children watch this program unattended. It contains little or no violence, no strong language and little or no sexual dialogue or situation. Networks that air informational, how-to content, or generally inoffensive content.', 'powerpress'),
1494
- 'TV-PG'=>__('This rating signifies that the program may be unsuitable for younger children without the guidance of a parent. Many parents may want to watch it with their younger children. Various game shows and most reality shows are rated TV-PG for their suggestive dialog, suggestive humor, and/or coarse language. Some prime-time sitcoms such as Everybody Loves Raymond, Fresh Prince of Bel-Air, The Simpsons, Futurama, and Seinfeld usually air with a TV-PG rating.', 'powerpress'),
1495
- 'TV-14'=>__('Parents are strongly urged to exercise greater care in monitoring this program and are cautioned against letting children of any age watch unattended. This rating may be accompanied by any of the following sub-ratings:', 'powerpress'),
1496
- 'TV-MA'=>__('A TV-MA rating means the program may be unsuitable for those below 17. The program may contain extreme graphic violence, strong profanity, overtly sexual dialogue, very coarse language, nudity and/or strong sexual content. The Sopranos is a popular example.', 'powerpress')
1497
- );
1498
-
1499
-
1500
- foreach( $Ratings as $rating => $title )
1501
- {
1502
- $tip = $RatingsTips[ $rating ];
1503
- ?>
1504
- <div style="margin-bottom: 10px;"><label><input type="radio" name="Feed[parental_rating]" value="<?php echo $rating; ?>" <?php if( $FeedSettings['parental_rating'] == $rating) echo 'checked'; ?> /> <?php if( $rating ) { ?><strong><?php echo $rating; ?></strong><?php } else { ?><strong><?php echo htmlspecialchars($title); ?></strong><?php } ?></label>
1505
- <?php if( $rating ) { ?> <span style="margin-left: 8px;"><a href="#" class="powerpress-parental-rating-tip" id="rating_tip_<?php echo $rating; ?>"><?php echo htmlspecialchars($title); ?></a></span><?php } ?>
1506
- <p style="margin: 5px 50px; display: none;" id="rating_tip_<?php echo $rating; ?>_p" class="powerpress-parental-rating-tip-p"><?php echo htmlspecialchars($tip); ?></p>
1507
- </div>
1508
- <?php
1509
- }
1510
- ?>
1511
- </td>
1512
- </tr>
1513
- </table>
1514
- <?php
1515
- }
1516
-
1517
- function powerpressadmin_edit_artwork($FeedSettings, $General)
1518
- {
1519
- $SupportUploads = powerpressadmin_support_uploads();
1520
- ?>
1521
- <h3><?php echo __('Artwork and Images', 'powerpress'); ?></h3>
1522
-
1523
- <table class="form-table">
1524
- <tr valign="top">
1525
- <th scope="row">
1526
- <?php echo __('iTunes Image', 'powerpress'); ?>
1527
- <span class="powerpress-required"><?php echo __('Required', 'powerpress'); ?></span>
1528
- <?php echo powerpressadmin_updated( __('recommended size changed February, 2016', 'powerpress') ); ?>
1529
- </th>
1530
- <td>
1531
- <input type="text" id="itunes_image" name="Feed[itunes_image]" style="width: 60%; margin-top: 10px;" value="<?php echo esc_attr( !empty($FeedSettings['itunes_image'])? $FeedSettings['itunes_image']:''); ?>" maxlength="255" />
1532
- <a href="#" onclick="javascript: window.open( document.getElementById('itunes_image').value ); return false;"><?php echo __('preview', 'powerpress'); ?></a>
1533
-
1534
- <p><?php echo __('iTunes image must be at least 1400 x 1400 pixels in .jpg or .png format. iTunes image must not exceed 3000 x 3000 pixels and must use RGB color space.', 'powerpress'); ?> <?php echo __('Example', 'powerpress'); ?>: http://example.com/images/itunes.jpg
1535
- </p>
1536
-
1537
- <p><strong><?php echo __('A square 3000 x 3000 pixel image in .jpg format is recommended.', 'powerpress'); ?></strong></p>
1538
-
1539
- <p>
1540
- <?php echo __('This image is for your listing on the Apple podcasts directory and may also be used by other directories like Blubrry. It is not the artwork that is displayed during episode playback. That artwork needs to be saved into the media file in the form of tags (ID3 tags for mp3) following the production of the media file.', 'powerpress'); ?>
1541
- </p>
1542
-
1543
- <p class="description"><?php echo __('Note: If you change the iTunes image without changing the file name it may take some time (days or even months) for iTunes to update the image in the iTunes Podcast Directory.', 'powerpress'); ?>
1544
- <?php echo sprintf( __('Please contact %s if you are having issues with your image changes not appearing in iTunes.', 'powerpress'), '<a href="https://create.blubrry.com/manual/podcast-promotion/submit-podcast-to-itunes/itunes-support/">'. __('Apple Podcasts Support', 'powerpress') .'</a>'); ?></p>
1545
- <?php if( $SupportUploads ) { ?>
1546
-
1547
- <p><label class="powerpress-normal-font"><input name="itunes_image_checkbox" type="checkbox" onchange="powerpress_show_field('itunes_image_upload', this.checked)" value="1" /> <?php echo __('Upload new image', 'powerpress'); ?></label> &nbsp;
1548
- <span style="font-size:85%;">(<?php echo __('Using this option should update your image on iTunes within 24 hours', 'powerpress'); ?>)</span>
1549
- </p>
1550
- <div style="display:none" id="itunes_image_upload">
1551
- <label for="itunes_image_file"><?php echo __('Choose file', 'powerpress'); ?>:</label><input type="file" id="itunes_image_file" name="itunes_image_file" /><br />
1552
- <?php if( !empty($General['advanced_mode_2']) ) { ?>
1553
- <div style="margin-left: 85px;"><label class="powerpress-normal-font"><input name="itunes_image_checkbox_as_rss" type="checkbox" value="1" onchange="powerpress_show_field('rss_image_upload_container', !this.checked)" /> <?php echo __('Also use as RSS image', 'powerpress'); ?></label></div>
1554
- <?php } else { ?>
1555
- <input type="hidden" name="itunes_image_checkbox_as_rss" value="1" />
1556
- <?php } ?>
1557
- </div>
1558
- <?php } ?>
1559
- </td>
1560
- </tr>
1561
- </table>
1562
-
1563
-
1564
- <?php if( !empty($General['advanced_mode_2']) ) { ?>
1565
- <table class="form-table">
1566
- <tr valign="top">
1567
- <th scope="row">
1568
- <?php echo __('iTunes Episode Image', 'powerpress'); ?></th>
1569
- <td>
1570
-
1571
- <p style="padding-top: 10px;"><label><input type="checkbox" name="Feed[episode_itunes_image]" value="1" <?php if( !empty($FeedSettings['episode_itunes_image']) ) echo 'checked '; ?>/> <?php echo __('Use iTunes image above', 'powerpress'); ?></label></p>
1572
- <p><?php echo __('Use the program iTunes image above as your iTunes episode image.', 'powerpress'); ?></p>
1573
- <p class="description"><?php echo __('NOTE: You must still save artwork into your media files to guarantee your artwork is displayed during playback.', 'powerpress'); ?></p>
1574
- </td>
1575
- </tr>
1576
-
1577
- <table class="form-table">
1578
- <tr valign="top">
1579
- <th scope="row">
1580
- <?php echo __('Google Play Image', 'powerpress'); ?>
1581
- </th>
1582
- <td>
1583
- <input type="text" id="googleplay_image" name="Feed[googleplay_image]" style="width: 60%; margin-top: 10px;" value="<?php echo esc_attr( !empty($FeedSettings['googleplay_image'])? $FeedSettings['googleplay_image']:''); ?>" maxlength="255" />
1584
- <a href="#" onclick="javascript: window.open( document.getElementById('googleplay_image').value ); return false;"><?php echo __('preview', 'powerpress'); ?></a>
1585
-
1586
- <p><?php echo __('Google Play image must be at least 1200 x 1200 pixels in .jpg or .png format to be eligible for featuring. Image must not exceed 7000 x 7000 pixels.', 'powerpress'); ?> <?php echo __('Example', 'powerpress'); ?>: http://example.com/images/googleplay.jpg
1587
- </p>
1588
-
1589
- <p><strong><?php echo __('Leave this setting blank to use the iTunes image (recommended).', 'powerpress'); ?></strong></p>
1590
-
1591
- <?php if( $SupportUploads ) { ?>
1592
-
1593
- <p><label class="powerpress-normal-font"><input name="googleplay_image_checkbox" type="checkbox" onchange="powerpress_show_field('googleplay_image_upload', this.checked)" value="1" /> <?php echo __('Upload new image', 'powerpress'); ?></label> &nbsp;
1594
- <span style="font-size:85%;">(<?php echo __('Using this option should update your image on Google Play Music within 24 hours', 'powerpress'); ?>)</span>
1595
- </p>
1596
- <div style="display:none" id="googleplay_image_upload">
1597
- <label for="googleplay_image_file"><?php echo __('Choose file', 'powerpress'); ?>:</label><input type="file" id="googleplay_image_file" name="googleplay_image_file" /><br />
1598
- </div>
1599
- <?php } ?>
1600
- </td>
1601
- </tr>
1602
-
1603
- <tr valign="top">
1604
- <th scope="row">
1605
- <?php echo __('RSS2 Image', 'powerpress'); ?> <br />
1606
- <span style="font-size: 85%; margin-left: 5px;"><?php echo __('Recommendation: Use iTunes image', 'powerpress'); ?></span>
1607
- </th>
1608
- <td>
1609
- <input type="text" id="rss2_image" name="Feed[rss2_image]" style="width: 60%; margin-top: 10px;" value="<?php echo esc_attr( !empty($FeedSettings['rss2_image'])? $FeedSettings['rss2_image']:''); ?>" maxlength="255" />
1610
- <a href="#" onclick="javascript: window.open( document.getElementById('rss2_image').value ); return false;"><?php echo __('preview', 'powerpress'); ?></a>
1611
-
1612
- <p><?php echo __('Place the URL to the RSS image above.', 'powerpress'); ?> <?php echo __('Example', 'powerpress'); ?> http://mysite.com/images/rss.jpg</p>
1613
-
1614
- <!--
1615
- <p><?php echo __('RSS image should be at least 88 pixels wide and at least 31 pixels high in either .gif, .jpg and .png format.', 'powerpress'); ?></p>
1616
- <p><strong><?php echo __('A square image that is 300 x 300 pixel or larger in .jpg format is recommended.', 'powerpress'); ?></strong></p>
1617
- -->
1618
-
1619
- <?php if( $SupportUploads ) { ?>
1620
- <div id="rss_image_upload_container">
1621
- <p><input name="rss2_image_checkbox" type="checkbox" onchange="powerpress_show_field('rss_image_upload', this.checked)" value="1" /> <?php echo __('Upload new image', 'powerpress'); ?></p>
1622
- <div style="display:none" id="rss_image_upload">
1623
- <label for="rss2_image"><?php echo __('Choose file', 'powerpress'); ?>:</label><input type="file" name="rss2_image_file" />
1624
- </div>
1625
- </div>
1626
- <?php } ?>
1627
- </td>
1628
- </tr>
1629
- </table>
1630
- <?php
1631
- }
1632
- }
1633
-
1634
-
1635
- function powerpressadmin_edit_destinations($FeedSettings, $General, $FeedAttribs)
1636
- {
1637
- require_once( dirname(__FILE__).'/views/settings_tab_destinations.php' );
1638
- }
1639
-
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ function powerpress_admin_basic()
4
+ {
5
+ $FeedAttribs = array('type'=>'general', 'feed_slug'=>'', 'category_id'=>0, 'term_taxonomy_id'=>0, 'term_id'=>0, 'taxonomy_type'=>'', 'post_type'=>'');
6
+ // feed_slug = channel
7
+
8
+ $General = powerpress_get_settings('powerpress_general');
9
+ $General = powerpress_default_settings($General, 'basic');
10
+ if( !isset($General['advanced_mode_2']) )
11
+ $General['advanced_mode_2'] = true;
12
+
13
+ $FeedSettings = powerpress_get_settings('powerpress_feed');
14
+ $FeedSettings = powerpress_default_settings($FeedSettings, 'editfeed');
15
+
16
+ $CustomFeed = get_option('powerpress_feed_'.'podcast'); // Get the custom podcast feed settings saved in the database
17
+ if( $CustomFeed ) // If they enabled custom podast channels...
18
+ {
19
+ $FeedSettings = powerpress_merge_empty_feed_settings($CustomFeed, $FeedSettings);
20
+ $FeedAttribs['channel_podcast'] = true;
21
+ }
22
+
23
+ $MultiSiteServiceSettings = false;
24
+ if( is_multisite() )
25
+ {
26
+ $MultiSiteSettings = get_site_option('powerpress_multisite');
27
+ if( !empty($MultiSiteSettings['services_multisite_only']) )
28
+ {
29
+ $MultiSiteServiceSettings = true;
30
+ }
31
+ }
32
+
33
+ ?>
34
+ <script type="text/javascript"><!--
35
+ function CheckRedirect(obj)
36
+ {
37
+ if( obj.value )
38
+ {
39
+ if( obj.value.indexOf('rawvoice') == -1 && obj.value.indexOf('techpodcasts') == -1 &&
40
+ obj.value.indexOf('blubrry') == -1 && obj.value.indexOf('podtrac') == -1 )
41
+ {
42
+ if( !confirm('<?php echo __('The redirect entered is not recongized as a supported statistics redirect service.', 'powerpress'); ?>\n\n<?php echo __('Are you sure you wish to continue with this redirect url?', 'powerpress'); ?>') )
43
+ {
44
+ obj.value = '';
45
+ return false;
46
+ }
47
+ }
48
+ }
49
+ return true;
50
+ }
51
+
52
+ function SelectEmbedField(checked)
53
+ {
54
+ if( checked )
55
+ jQuery('#embed_replace_player').removeAttr("disabled");
56
+ else
57
+ jQuery('#embed_replace_player').attr("disabled","disabled");
58
+ }
59
+
60
+ jQuery(document).ready(function($) {
61
+
62
+ jQuery('#powerpress_advanced_mode_button').click( function(event) {
63
+ event.preventDefault();
64
+ jQuery('#powerpress_advanced_mode').val('0');
65
+ jQuery(this).closest("form").submit();
66
+ });
67
+
68
+ jQuery('#episode_box_player_links_options').change(function () {
69
+
70
+ var objectChecked = jQuery('#episode_box_player_links_options').attr('checked');
71
+ if(typeof jQuery.prop === 'function') {
72
+ objectChecked = jQuery('#episode_box_player_links_options').prop('checked');
73
+ }
74
+
75
+ if( objectChecked == true ) {
76
+ jQuery('#episode_box_player_links_options_div').css("display", 'block' );
77
+ }
78
+ else {
79
+ jQuery('#episode_box_player_links_options_div').css("display", 'none' );
80
+ jQuery('.episode_box_no_player_or_links').attr("checked", false );
81
+ jQuery('#episode_box_no_player_and_links').attr("checked", false );
82
+ if(typeof jQuery.prop === 'function') {
83
+ jQuery('.episode_box_no_player_or_links').prop("checked", false );
84
+ jQuery('#episode_box_no_player_and_links').prop("checked", false );
85
+ }
86
+ }
87
+ } );
88
+
89
+ jQuery('#episode_box_no_player_and_links').change(function () {
90
+
91
+ var objectChecked = jQuery(this).attr("checked");
92
+ if(typeof jQuery.prop === 'function') {
93
+ objectChecked = jQuery(this).prop("checked");
94
+ }
95
+
96
+ if( objectChecked == true ) {
97
+ jQuery('.episode_box_no_player_or_links').attr("checked", false );
98
+ if(typeof jQuery.prop === 'function') {
99
+ jQuery('.episode_box_no_player_or_links').prop("checked", false );
100
+ }
101
+ }
102
+ } );
103
+
104
+ jQuery('.episode_box_no_player_or_links').change(function () {
105
+ var objectChecked = jQuery(this).attr("checked");
106
+ if(typeof jQuery.prop === 'function') {
107
+ objectChecked = jQuery(this).prop("checked");
108
+ }
109
+
110
+ if( objectChecked == true) {
111
+ jQuery('#episode_box_no_player_and_links').attr("checked", false );
112
+ if(typeof jQuery.prop === 'function') {
113
+ jQuery('#episode_box_no_player_and_links').prop("checked", false );
114
+ }
115
+ }
116
+ } );
117
+
118
+ jQuery('#episode_box_feature_in_itunes').change( function() {
119
+ var objectChecked = jQuery('#episode_box_feature_in_itunes').attr('checked');
120
+ if(typeof jQuery.prop === 'function') {
121
+ objectChecked = jQuery('#episode_box_feature_in_itunes').prop('checked');
122
+ }
123
+ if( objectChecked ) {
124
+ $("#episode_box_order").attr("disabled", true);
125
+ } else {
126
+ $("#episode_box_order").removeAttr("disabled");
127
+ }
128
+ });
129
+
130
+ } );
131
+ //-->
132
+ </script>
133
+
134
+ <input type="hidden" name="action" value="powerpress-save-settings" />
135
+
136
+
137
+ <input type="hidden" id="powerpress_advanced_mode" name="General[advanced_mode_2]" value="1" />
138
+ <input type="hidden" id="save_tab_pos" name="tab" value="<?php echo (empty($_POST['tab'])?0: intval($_POST['tab']) ); ?>" />
139
+
140
+ <div id="powerpress_admin_header">
141
+ <h2><?php echo __('Blubrry PowerPress Settings', 'powerpress'); ?></h2>
142
+ <span class="powerpress-mode"><?php echo __('Advanced Mode', 'powerpress'); ?>
143
+ &nbsp; <a href="<?php echo admin_url("admin.php?page=". urlencode(powerpress_admin_get_page()) ."&amp;mode=simple"); ?>" id="powerpress_advanced_mode_button" class="button-primary button-blubrry"><?php echo __('Switch to Simple Mode', 'powerpress'); ?></a>
144
+ </span>
145
+ </div>
146
+
147
+ <div id="powerpress_settings_page" class="powerpress_tabbed_content">
148
+ <ul class="powerpress_settings_tabs">
149
+ <li><a href="#tab0"><span><?php echo htmlspecialchars(__('Welcome', 'powerpress')); ?></span></a></li>
150
+ <li><a href="#tab1"><span><?php echo htmlspecialchars(__('Episodes', 'powerpress')); ?></span></a></li>
151
+ <li><a href="#tab2"><span><?php echo htmlspecialchars(__('Services & Stats', 'powerpress')); ?></span></a></li>
152
+ <li><a href="#tab3"><span><?php echo htmlspecialchars(__('Website', 'powerpress')); ?></span></a></li>
153
+ <li><a href="#tab4"><span><?php echo htmlspecialchars(__('Feeds', 'powerpress')); ?></span></a></li>
154
+ <li><a href="#tab5"><span><?php echo htmlspecialchars(__('Apple', 'powerpress')); ?></span></a></li>
155
+ <li><a href="#tab6"><span><?php echo htmlspecialchars(__('Google', 'powerpress')); ?></span></a></li>
156
+ <li><a href="#tab7"><span><?php echo htmlspecialchars(__('Artwork', 'powerpress')); ?></span></a></li>
157
+ <li><a href="#tab-dest"><span><?php echo htmlspecialchars(__('Destinations', 'powerpress')); ?></span></a></li>
158
+ </ul>
159
+
160
+ <div id="tab0" class="powerpress_tab">
161
+ <?php powerpressadmin_welcome($General); ?>
162
+ </div>
163
+
164
+ <div id="tab1" class="powerpress_tab">
165
+ <?php
166
+ powerpressadmin_edit_entry_options($General);
167
+ powerpressadmin_edit_podpress_options($General);
168
+ ?>
169
+ </div>
170
+
171
+ <div id="tab2" class="powerpress_tab">
172
+ <?php
173
+ if( $MultiSiteServiceSettings && defined('POWERPRESS_MULTISITE_VERSION') )
174
+ {
175
+ PowerPressMultiSitePlugin::edit_blubrry_services($General);
176
+ }
177
+ else
178
+ {
179
+ powerpressadmin_edit_blubrry_services($General);
180
+ powerpressadmin_edit_media_statistics($General);
181
+ }
182
+ ?>
183
+ </div>
184
+
185
+ <div id="tab3" class="powerpress_tab">
186
+ <?php
187
+ powerpressadmin_appearance($General, $FeedSettings);
188
+ ?>
189
+ </div>
190
+
191
+ <div id="tab4" class="powerpress_tab">
192
+ <?php
193
+ powerpressadmin_edit_feed_general($FeedSettings, $General);
194
+ powerpressadmin_edit_feed_settings($FeedSettings, $General, $FeedAttribs);
195
+ powerpressadmin_edit_funding($FeedSettings);
196
+ powerpressadmin_edit_tv($FeedSettings);
197
+ ?>
198
+ </div>
199
+
200
+ <div id="tab5" class="powerpress_tab">
201
+ <?php
202
+ powerpressadmin_edit_itunes_feed($FeedSettings, $General, $FeedAttribs);
203
+ ?>
204
+ </div>
205
+ <div id="tab6" class="powerpress_tab">
206
+ <?php
207
+ powerpressadmin_edit_googleplay($FeedSettings, $General, $FeedAttribs);
208
+ ?>
209
+ </div>
210
+ <div id="tab7" class="powerpress_tab">
211
+ <?php
212
+ powerpressadmin_edit_artwork($FeedSettings, $General);
213
+ ?>
214
+ </div>
215
+ <div id="tab-dest" class="powerpress_tab">
216
+ <?php
217
+ powerpressadmin_edit_destinations($FeedSettings, $General, $FeedAttribs);
218
+ ?>
219
+ </div>
220
+
221
+ </div>
222
+ <div class="clear"></div>
223
+
224
+ <?php
225
+
226
+ powerpressadmin_advanced_options($General);
227
+ }
228
+
229
+ function powerpressadmin_advanced_options($General)
230
+ {
231
+ // Break the bottom section here out into it's own function
232
+ $ChannelsCheckbox = '';
233
+ if( !empty($General['custom_feeds']) )
234
+ $ChannelsCheckbox = ' onclick="alert(\''. __('You must delete all of the Podcast Channels to disable this option.', 'powerpress') .'\');return false;"';
235
+ $CategoryCheckbox = '';
236
+ //if( !empty($General['custom_cat_feeds']) ) // Decided ont to include this warning because it may imply that you have to delete the actual category, which is not true.
237
+ // $CategoryCheckbox = ' onclick="alert(\'You must remove podcasting from the categories to disable this option.\');return false;"';
238
+ ?>
239
+ <script language="javascript"><!--
240
+
241
+ jQuery(document).ready( function() {
242
+
243
+ jQuery('.pp-expand-section').click( function(e) {
244
+ e.preventDefault();
245
+
246
+ if( jQuery(this).hasClass('pp-expand-section-expanded') ) {
247
+ jQuery(this).removeClass('pp-expand-section-expanded');
248
+ jQuery(this).parent().next('div').hide(400);
249
+ jQuery(this).blur();
250
+ } else {
251
+ jQuery(this).addClass('pp-expand-section-expanded');
252
+ jQuery(this).parent().next('div').show(400);
253
+ jQuery(this).blur();
254
+ }
255
+ });
256
+ });
257
+
258
+ //-->
259
+ </script>
260
+ <div style="margin-left: 10px;">
261
+ <h3><a href="#" class="pp-expand-section pp-expand-section-expanded"><?php echo __('Advanced Options', 'powerpress'); ?></a></h3>
262
+ <div style="margin-left: 50px;" >
263
+ <div>
264
+ <input type="checkbox" name="NULL[import_podcast]" value="1" checked disabled />
265
+ <strong><a href="<?php echo admin_url('admin.php?page=powerpress/powerpressadmin_import_feed.php'); ?>"><?php echo __('Import Podcast', 'powerpress'); ?></a></strong> -
266
+ <?php echo __('Import podcast feed from SoundCloud, LibSyn, PodBean or other podcast service.', 'powerpress'); ?>
267
+ </div>
268
+ <div>
269
+ <input type="checkbox" name="NULL[migrate_media]" value="1" checked disabled />
270
+ <strong><a href="<?php echo admin_url('admin.php?page=powerpress/powerpressadmin_migrate.php'); ?>"><?php echo __('Migrate Media', 'powerpress'); ?></a></strong> -
271
+ <?php echo __('Migrate media files to Blubrry Podcast Media Hosting with only a few clicks.', 'powerpress'); ?>
272
+ </div>
273
+ <div>
274
+ <input type="checkbox" name="NULL[podcasting_seo]" value="1" checked disabled />
275
+ <strong><a href="<?php echo admin_url('admin.php?page=powerpress/powerpressadmin_search.php'); ?>"><?php echo __('Podcasting SEO', 'powerpress'); ?></a></strong> -
276
+ <?php echo __('Select from 3 different web based audio players.', 'powerpress'); ?>
277
+ </div>
278
+
279
+ <div>
280
+ <input type="checkbox" name="NULL[player_options]" value="1" checked disabled />
281
+ <strong><?php echo __('Audio Player Options', 'powerpress'); ?></strong> -
282
+ <?php echo __('Select from 3 different web based audio players.', 'powerpress'); ?>
283
+ <span style="font-size: 85%;">(<a href="<?php echo admin_url('admin.php?page=powerpress/powerpressadmin_player.php&sp=1'); ?>"><?php echo __('configure audio player', 'powerpress'); ?></a>)</span>
284
+ </div>
285
+ <div>
286
+ <input type="checkbox" name="NULL[video_player_options]" value="1" checked disabled />
287
+ <strong><?php echo __('Video Player Options', 'powerpress'); ?></strong> -
288
+ <?php echo __('Select from 3 different web based video players.', 'powerpress'); ?>
289
+ <span style="font-size: 85%;">(<a href="<?php echo admin_url('admin.php?page=powerpress/powerpressadmin_videoplayer.php&sp=1'); ?>"><?php echo __('configure video player', 'powerpress'); ?></a>)</span>
290
+
291
+ </div>
292
+ <div>
293
+ <input type="hidden" name="General[channels]" value="0" />
294
+ <input type="checkbox" name="General[channels]" value="1" <?php echo ( !empty($General['channels']) ?' checked':''); echo $ChannelsCheckbox; ?> />
295
+ <strong><?php echo __('Custom Podcast Channels', 'powerpress'); ?></strong> -
296
+ <?php echo __('Manage multiple media files and/or formats to one blog post.', 'powerpress'); ?>
297
+ <?php if( empty($General['channels']) ) { ?>
298
+ <span style="font-size: 85%;">(<?php echo __('feature will appear in left menu when enabled', 'powerpress'); ?>)</span>
299
+ <?php } else { ?>
300
+ <span style="font-size: 85%;">(<a href="<?php echo admin_url('admin.php?page=powerpress/powerpressadmin_customfeeds.php'); ?>"><?php echo __('configure podcast channels', 'powerpress'); ?></a>)</span>
301
+ <?php } ?>
302
+ </div>
303
+ <div>
304
+ <input type="hidden" name="General[cat_casting]" value="0" />
305
+ <input type="checkbox" name="General[cat_casting]" value="1" <?php echo ( !empty($General['cat_casting']) ?' checked':''); echo $CategoryCheckbox; ?> />
306
+ <strong><?php echo __('Category Podcasting', 'powerpress'); ?></strong> -
307
+ <?php echo __('Manage podcasting for specific categories.', 'powerpress'); ?>
308
+ <?php if( empty($General['cat_casting']) ) { ?>
309
+ <span style="font-size: 85%;">(<?php echo __('feature will appear in left menu when enabled', 'powerpress'); ?>)</span>
310
+ <?php } else { ?>
311
+ <span style="font-size: 85%;">(<a href="<?php echo admin_url('admin.php?page=powerpress/powerpressadmin_categoryfeeds.php'); ?>"><?php echo __('configure podcast categories', 'powerpress'); ?></a>)</span>
312
+ <?php } ?>
313
+ </div>
314
+ <div>
315
+ <input type="checkbox" name="General[metamarks]" value="1" <?php echo ( !empty($General['metamarks']) ?' checked':''); ?> />
316
+ <strong><?php echo __('Meta Marks', 'powerpress'); ?></strong> -
317
+ <?php echo __('Add additional meta information to your media for syndication.', 'powerpress'); ?>
318
+ <?php echo powerpress_help_link('http://www.powerpresspodcast.com/metamarks/'); ?>
319
+ <span style="font-size: 85%;">(<?php echo __('feature will appear in episode entry box', 'powerpress'); ?>)</span>
320
+ </div>
321
+
322
+
323
+ <div>
324
+ <input type="hidden" name="General[taxonomy_podcasting]" value="0" />
325
+ <input type="checkbox" name="General[taxonomy_podcasting]" value="1" <?php echo ( !empty($General['taxonomy_podcasting']) ?' checked':''); ?> />
326
+ <strong><?php echo __('Taxonomy Podcasting', 'powerpress'); ?></strong>
327
+ <span style="font-size: 14px;">(<?php echo __('Feature sponsored by', 'powerpress'); ?> <a href="http://afterbuzztv.com/" target="_blank">AfterBuzzTV.com</a>)</span> -
328
+ <?php echo __('Manage podcasting for specific taxonomies.', 'powerpress'); ?>
329
+ <?php if( empty($General['taxonomy_podcasting']) ) { ?>
330
+ <span style="font-size: 85%;">(<?php echo __('feature will appear in left menu when enabled', 'powerpress'); ?>)</span>
331
+ <?php } else { ?>
332
+ <span style="font-size: 85%;">(<a href="<?php echo admin_url('admin.php?page=powerpress/powerpressadmin_taxonomyfeeds.php'); ?>"><?php echo __('configure taxonomy podcasting', 'powerpress'); ?></a>)</span>
333
+ <?php } ?>
334
+ </div>
335
+ <div>
336
+ <input type="hidden" name="General[posttype_podcasting]" value="0" />
337
+ <input type="checkbox" name="General[posttype_podcasting]" value="1" <?php echo ( !empty($General['posttype_podcasting']) ?' checked':''); ?> />
338
+ <strong><?php echo __('Post Type Podcasting', 'powerpress'); ?></strong> -
339
+ <?php echo __('Manage multiple media files and/or formats to specific post types.', 'powerpress'); ?>
340
+ <?php if( empty($General['posttype_podcasting']) ) { ?>
341
+ <span style="font-size: 85%;">(<?php echo __('feature will appear in left menu when enabled', 'powerpress'); ?>)</span>
342
+ <?php } else { ?>
343
+ <span style="font-size: 85%;">(<a href="<?php echo admin_url('admin.php?page=powerpress/powerpressadmin_posttypefeeds.php'); ?>"><?php echo __('configure post type podcasting', 'powerpress'); ?></a>)</span>
344
+ <?php } ?>
345
+ </div>
346
+ <div>
347
+ <input type="checkbox" name="General[playlist_player]" value="1" <?php echo ( !empty($General['playlist_player']) ?' checked':''); ?> />
348
+ <strong><?php echo __('PowerPress Playlist Player', 'powerpress'); ?></strong> -
349
+ <?php echo __('Create playlists for your podcasts.', 'powerpress'); ?>
350
+ <span style="font-size: 85%;">(<a href="http://create.blubrry.com/resources/powerpress/advanced-tools-and-options/powerpress-playlist-shortcode/" target="_blank"><?php echo __('learn more', 'powerpress'); ?></a>)</span>
351
+ </div>
352
+ </div>
353
+ </div>
354
+
355
+ <?php
356
+ $link_action_url = admin_url('admin.php?action=powerpress-jquery-account');
357
+ $link_action = 'powerpress-jquery-account';
358
+ ?>
359
+ <div style="margin-left: 10px;">
360
+ <h3><?php echo __('Link Blubrry Account', 'powerpress'); ?></h3>
361
+ <p style="font-size: 125%;">
362
+ <strong><a class="button-primary button-blubrry thickbox" title="<?php echo esc_attr(__('Blubrry Services Integration', 'powerpress')); ?>" href="<?php echo wp_nonce_url($link_action_url, $link_action); ?>&amp;KeepThis=true&amp;TB_iframe=true&amp;width=600&amp;height=400&amp;modal=false" target="_blank"><?php echo __('Click here to link Blubrry account', 'powerpress'); ?></a></strong>
363
+ </p>
364
+ <p>
365
+ <?php echo __('Link your blubrry.com account if you have a Blubrry Podcast Hosting or Blubrry Podcast Statistics services.', 'powerpress'); ?>
366
+ </p>
367
+ </div>
368
+
369
+ <div style="margin-left: 10px;">
370
+ <h3 style="margin-bottom: 5px;"><?php echo __('Looking for Support, Consulting or Custom Development?', 'powerpress'); ?></h3>
371
+ <p style="margin: 0 0 0 50px;">
372
+ <?php echo __('Blubrry offers a variety of options, free and paid, to assist you with your podcasting and Internet media needs. Whether you need your theme customized for podcasting or you want consulting on what video format is best for your audience, we have the staff and knowledge to assist.', 'powerpress'); ?>
373
+ </p>
374
+ <p style="margin: 5px 0 0 50px;">
375
+ <strong><?php echo '<a href="http://create.blubrry.com/support/" target="_blank">'. __('Learn More about Blubrry Support Options', 'powerpress') .'</a>'; ?></strong>
376
+ </p>
377
+ </div>
378
+
379
+ <?php
380
+ return;
381
+
382
+ // We will not pester folks with this stuff in PowerPress 7.0+
383
+
384
+ if( isset($General['timestamp']) && $General['timestamp'] > 0 && $General['timestamp'] < ( time()- (60*60*24*14) ) ) // Lets wait 14 days before we annoy them asking for support
385
+ {
386
+ ?>
387
+ <div style="margin-left: 10px;">
388
+ <h3 style="margin-bottom: 5px;"><?php echo __('Like The Plugin?', 'powerpress'); ?></h3>
389
+ <p style="margin-top: 0;">
390
+ <?php echo __('This plugin is great, don\'t you think? If you like the plugin we\'d be ever so grateful if you\'d give it your support. Here\'s how:', 'powerpress'); ?>
391
+ </p>
392
+ <ul id="powerpress_support">
393
+ <li><?php echo sprintf(__('Rate this plugin 5 stars in the %s.', 'powerpress'),
394
+ '<a href="http://wordpress.org/extend/plugins/powerpress/" target="_blank">'. __('WordPress Plugins Directory', 'powerpress') .'</a>');
395
+
396
+ ?>
397
+ </li>
398
+ <li><?php echo __('Tell the world about PowerPress by writing about it on your blog', 'powerpress'); ?>,
399
+ <a href="https://twitter.com/home/?status=<?php echo urlencode( __('I\'m podcasting with Blubrry PowerPress (https://blubrry.com/powerpress/) #powerpress #wordpress', 'powerpress') ); ?>" target="_blank"><?php echo __('Twitter', 'powerpress'); ?></a>,
400
+ <a href="https://www.facebook.com/share.php?u=<?php echo urlencode('https://www.blubrry.com/powerpress'); ?>&amp;t=<?php echo urlencode( __('I podcast with Blubrry PowerPress', 'powerpress')); ?>" target="_blank"><?php echo __('Facebook', 'powerpress'); ?></a>,
401
+ etc...</li>
402
+ <li><a href="http://www.blubrry.com/contact.php" target="_blank"><?php echo __('Send us feedback', 'powerpress'); ?></a> (<?php echo __('we love getting suggestions for new features!', 'powerpress'); ?>)</li>
403
+ </ul>
404
+ </div>
405
+ <?php
406
+ }
407
+ ?>
408
+ <div style="margin-left: 10px;">
409
+ <h3 style="margin-bottom: 5px;"><?php echo __('Become a PowerPress Patron!', 'powerpress'); ?></h3>
410
+ <p style="margin: 0; padding-left: 50px;">
411
+ <?php echo __('Help support your favorite podcasting plugin via Patreon.', 'powerpress'); ?>
412
+ </p>
413
+ <p style="margin-top: 0; padding-left: 50px;"><?php echo '<a href="https://www.patreon.com/blubrry?ty=h" target="_blank">'. __('Visit Blubrry\'s Patreon page', 'powerpress') .'</a>'; ?>
414
+ </p>
415
+ </div>
416
+ <?php
417
+ }
418
+
419
+ function powerpressadmin_edit_entry_options($General)
420
+ {
421
+ if( !isset($General['default_url']) )
422
+ $General['default_url'] = '';
423
+ if( !isset($General['episode_box_mode']) )
424
+ $General['episode_box_mode'] = 0; // Default not set, 1 = no duration/file size, 2 = yes duration/file size (default if not set)
425
+ if( !isset($General['episode_box_embed']) )
426
+ $General['episode_box_embed'] = 0;
427
+ if( !isset($General['set_duration']) )
428
+ $General['set_duration'] = 0;
429
+ if( !isset($General['set_size']) )
430
+ $General['set_size'] = 0;
431
+ if( !isset($General['auto_enclose']) )
432
+ $General['auto_enclose'] = 0;
433
+ if( !isset($General['episode_box_player_size']) )
434
+ $General['episode_box_player_size'] = 0;
435
+ if( !isset($General['episode_box_closed_captioned']) )
436
+ $General['episode_box_closed_captioned'] = 0;
437
+ if( !isset($General['episode_box_order']) )
438
+ $General['episode_box_order'] = 0;
439
+ if( !isset($General['episode_box_feature_in_itunes']) )
440
+ $General['episode_box_feature_in_itunes'] = 0;
441
+
442
+ ?>
443
+ <h3><?php echo __('Episode Entry Options', 'powerpress'); ?></h3>
444
+
445
+
446
+ <table class="form-table">
447
+ <tr valign="top">
448
+ <th scope="row">
449
+
450
+ <?php echo __('Podcast Entry Box', 'powerpress'); ?></th>
451
+ <td>
452
+ <p style="margin-top: 5px;">
453
+ <?php echo __('Configure your podcast episode entry box with the options that fit your needs.', 'powerpress'); ?>
454
+ </p>
455
+ <div id="episode_box_mode_adv">
456
+
457
+ <p style="margin-top: 15px;"><input class="episode_box_option" name="Null[ignore]" type="checkbox" value="1" checked onclick="return false" onkeydown="return false" /> <?php echo __('Media URL', 'powerpress'); ?>
458
+ (<?php echo __('Specify URL to episode\'s media file', 'powerpress'); ?>)</p>
459
+
460
+ <p style="margin-top: 15px;"><input id="episode_box_mode" class="episode_box_option" name="General[episode_box_mode]" type="checkbox" value="2" <?php if( empty($General['episode_box_mode']) || $General['episode_box_mode'] != 1 ) echo ' checked'; ?> /> <?php echo __('Media File Size and Duration', 'powerpress'); ?>
461
+ (<?php echo __('Specify episode\'s media file size and duration', 'powerpress'); ?>)</p>
462
+
463
+ <p style="margin-top: 15px; margin-bottom: 0;"><input id="episode_box_embed" class="episode_box_option" name="General[episode_box_embed]" type="checkbox" value="1"<?php if( !empty($General['episode_box_embed']) ) echo ' checked'; ?> onclick="SelectEmbedField(this.checked);" /> <?php echo __('Embed Field', 'powerpress'); ?>
464
+ (<?php echo __('Enter embed code from sites such as YouTube', 'powerpress'); ?>)</p>
465
+ <p style="margin-top: 5px; margin-left: 20px; font-size: 90%;"><input id="embed_replace_player" class="episode_box_option" name="General[embed_replace_player]" type="checkbox" value="1"<?php if( !empty($General['embed_replace_player']) ) echo ' checked'; ?> /> <?php echo __('Replace Player with Embed', 'powerpress'); ?>
466
+ (<?php echo __('Do not display default player if embed present for episode.', 'powerpress'); ?>)</p>
467
+
468
+ <p style="margin-top: 15px;"><input id="episode_box_player_links_options" class="episode_box_option" name="NULL[episode_box_player_links_options]" type="checkbox" value="1"<?php if( !empty($General['episode_box_no_player_and_links']) || !empty($General['episode_box_no_player']) || !empty($General['episode_box_no_links']) ) echo ' checked'; ?> /> <?php echo __('Display Player and Links Options', 'powerpress'); ?>
469
+ </p>
470
+ <div id="episode_box_player_links_options_div" style="margin-left: 20px;<?php if( empty($General['episode_box_no_player_and_links']) && empty($General['episode_box_no_player']) && empty($General['episode_box_no_links']) ) echo 'display:none;'; ?>">
471
+
472
+ <p style="margin-top: 0px; margin-bottom: 5px;"><input id="episode_box_no_player_and_links" class="episode_box_option" name="General[episode_box_no_player_and_links]" type="checkbox" value="1"<?php if( !empty($General['episode_box_no_player_and_links']) ) echo ' checked'; ?> /> <?php echo htmlspecialchars(__('No Player & Links Option', 'powerpress')); ?>
473
+ (<?php echo __('Disable media player and links on a per episode basis', 'powerpress'); ?>)</p>
474
+
475
+ <p style="margin-top: 0; margin-bottom: 0; margin-left: 20px;"><?php echo __('- or -', 'powerpress'); ?></p>
476
+
477
+ <p style="margin-top: 5px; margin-bottom: 10px;"><input id="episode_box_no_player" class="episode_box_option episode_box_no_player_or_links" name="General[episode_box_no_player]" type="checkbox" value="1"<?php if( !empty($General['episode_box_no_player']) ) echo ' checked'; ?> /> <?php echo __('No Player Option', 'powerpress'); ?>
478
+ (<?php echo __('Disable media player on a per episode basis', 'powerpress'); ?>)</p>
479
+
480
+ <p style="margin-top: 5px; margin-bottom: 20px;"><input id="episode_box_no_links" class="episode_box_option episode_box_no_player_or_links" name="General[episode_box_no_links]" type="checkbox" value="1"<?php if( !empty($General['episode_box_no_links']) ) echo ' checked'; ?> /> <?php echo __('No Links Option', 'powerpress'); ?>
481
+ (<?php echo __('Disable media links on a per episode basis', 'powerpress'); ?>)</p>
482
+
483
+ </div>
484
+
485
+ <p style="margin-top: 15px;"><input id="episode_box_cover_image" class="episode_box_option" name="General[episode_box_cover_image]" type="checkbox" value="1"<?php if( !empty($General['episode_box_cover_image']) ) echo ' checked'; ?> /> <?php echo __('Poster Image', 'powerpress'); ?>
486
+ (<?php echo __('Specify URL to poster artwork specific to each episode', 'powerpress'); ?>)</p>
487
+
488
+ <p style="margin-top: 15px;"><input id="episode_box_player_size" class="episode_box_option" name="General[episode_box_player_size]" type="checkbox" value="1"<?php if( !empty($General['episode_box_player_size']) ) echo ' checked'; ?> /> <?php echo __('Player Width and Height', 'powerpress'); ?>
489
+ (<?php echo __('Customize player width and height on a per episode basis', 'powerpress'); ?>)</p>
490
+ <p style="margin-top: 15px;"><input id="episode_box_subtitle" class="episode_box_option" name="General[episode_box_subtitle]" type="checkbox" value="1"<?php if( !empty($General['episode_box_subtitle']) ) echo ' checked'; ?> /> <?php echo __('iTunes Subtitle Field', 'powerpress'); ?>
491
+ (<?php echo __('Leave unchecked to use the first 250 characters of your blog post', 'powerpress'); ?>)</p>
492
+ <p style="margin-top: 15px;"><input id="episode_box_summary" class="episode_box_option" name="General[episode_box_summary]" type="checkbox" value="1"<?php if( !empty($General['episode_box_summary']) ) echo ' checked'; ?> /> <?php echo __('iTunes Summary Field', 'powerpress'); ?>
493
+ (<?php echo __('Leave unchecked to use your blog post', 'powerpress'); ?>)</p>
494
+
495
+
496
+
497
+ <p style="margin-top: 15px;"><input id="episode_box_author" class="episode_box_option" name="General[episode_box_author]" type="checkbox" value="1"<?php if( !empty($General['episode_box_author']) ) echo ' checked'; ?> /> <?php echo __('iTunes Author Field', 'powerpress'); ?>
498
+ (<?php echo __('Leave unchecked to the post author name', 'powerpress'); ?>)</p>
499
+
500
+ <p style="margin-top: 15px;"><input id="episode_box_explicit" class="episode_box_option" name="General[episode_box_explicit]" type="checkbox" value="1"<?php if( !empty($General['episode_box_explicit']) ) echo ' checked'; ?> /> <?php echo __('iTunes Explicit Field', 'powerpress'); ?>
501
+ (<?php echo __('Leave unchecked to use your feed\'s explicit setting', 'powerpress'); ?>)</p>
502
+
503
+
504
+ <p style="margin-top: 15px;"><label><input id="episode_box_itunes_image" class="episode_box_option" name="General[episode_box_itunes_image]" type="checkbox" value="1"<?php if( !empty($General['episode_box_itunes_image']) ) echo ' checked'; ?> /> <?php echo __('iTunes Episode Image Field', 'powerpress'); ?></label>
505
+ (<?php echo __('Leave unchecked to use the image embedded into your media files.', 'powerpress'); ?>)</p>
506
+
507
+ <p style="margin-top: 15px;"><label><input id="episode_box_closed_captioned" class="episode_box_option" name="General[episode_box_closed_captioned]" type="checkbox" value="1"<?php if( !empty($General['episode_box_closed_captioned']) ) echo ' checked'; ?> /> <?php echo __('iTunes Closed Captioned', 'powerpress'); ?></label>
508
+ (<?php echo __('Leave unchecked if you do not distribute closed captioned media', 'powerpress'); ?>)</p>
509
+
510
+ <p style="margin-top: 15px;"><label><input id="episode_box_order" class="episode_box_option" name="General[episode_box_order]" type="checkbox" value="1"<?php if( !empty($General['episode_box_order']) ) echo ' checked'; ?> <?php if( !empty($General['episode_box_feature_in_itunes']) ) echo ' disabled'; ?> /> <?php echo __('iTunes Order', 'powerpress'); ?></label>
511
+ (<?php echo __('Override the default ordering of episodes on the Apple and Google Podcast directories', 'powerpress'); ?>)</p>
512
+ <em><strong><?php echo __('If conflicting values are present the directories will use the default ordering.', 'powerpress'); ?></strong></em><br />
513
+ <em><strong><?php echo __('This feature only applies to the default podcast feed and Custom Podcast Channel feeds added by PowerPress.', 'powerpress'); ?></strong></em>
514
+
515
+ <?php if( empty($General['ios11_fields']) || $General['ios11_fields'] == 2 ) { ?>
516
+ <p><label><select name="General[ebititle]" class="bpp_input_sm">
517
+ <?php
518
+ $linkoptions = array('false'=>__('Hide Field', 'powerpress'),
519
+ 1=>__('Show Field', 'powerpress') );
520
+
521
+ foreach( $linkoptions as $value => $desc )
522
+ echo "\t<option value=\"$value\"". ( !empty($General['episode_box_itunes_title']) && $General['episode_box_itunes_title'] == $value ?' selected':''). ">$desc</option>\n";
523
+
524
+ ?>
525
+ </select> <?php echo __('iTunes Episode Title Field', 'powerpress'); ?></label> </p>
526
+ <em><strong><?php echo __('Specify iTunes episode title separate from podcast feed title.', 'powerpress'); ?></strong></em>
527
+ <?php } // end episode_box_itunes_title ?>
528
+
529
+ <?php if( empty($General['ios11_fields']) || $General['ios11_fields'] == 4 ) { ?>
530
+ <p><label><select name="General[ebinst]" class="bpp_input_sm">
531
+ <?php
532
+ $linkoptions = array('false'=>__('Hide Field', 'powerpress'),
533
+ 1=>__('Show Field', 'powerpress') );
534
+
535
+ foreach( $linkoptions as $value => $desc )
536
+ echo "\t<option value=\"$value\"". ( !empty($General['episode_box_itunes_nst']) && $General['episode_box_itunes_nst'] == $value ?' selected':''). ">$desc</option>\n";
537
+
538
+ ?>
539
+ </select> <?php echo __('iTunes Episode Number, Season and Type Fields', 'powerpress'); ?></label> </p>
540
+ <em><strong><?php echo __('Enter specifics about episode including episode number, season number and type (full, trailer, or bonus).', 'powerpress'); ?></strong></em>
541
+ <?php } // end episode_box_itunes_title ?>
542
+
543
+ <p style="margin-top: 15px;"><label><input id="episode_box_feature_in_itunes" class="episode_box_option" name="General[episode_box_feature_in_itunes]" type="checkbox" value="1"<?php if( !empty($General['episode_box_feature_in_itunes']) ) echo ' checked'; ?> /> <?php echo __('Feature Episode in Apple and Google Podcasts', 'powerpress'); ?></label>
544
+ (<?php echo __('Display selected episode at top of your Apple and Google Podcasts listings', 'powerpress'); ?>)</p>
545
+ <em><strong><?php echo __('All other episodes will be listed following the featured episode.', 'powerpress'); ?></strong></em><br />
546
+ <em><strong><?php echo __('This feature only applies to the default podcast feed and Custom Podcast Channel feeds added by PowerPress.', 'powerpress'); ?></strong></em>
547
+
548
+
549
+ <p style="margin-top: 15px;"><input id="episode_box_gp_desc" class="episode_box_option" name="General[episode_box_gp_desc]" type="checkbox" value="1"<?php if( !empty($General['episode_box_gp_desc']) ) echo ' checked'; ?> /> <?php echo __('Google Play Description Field', 'powerpress'); ?>
550
+ (<?php echo __('Leave unchecked to use your blog post', 'powerpress'); ?>)</p>
551
+ <p style="margin-top: 15px;"><input id="episode_box_gp_explicit" class="episode_box_option" name="General[episode_box_gp_explicit]" type="checkbox" value="1"<?php if( !empty($General['episode_box_gp_explicit']) ) echo ' checked'; ?> /> <?php echo __('Google Play Explicit Field', 'powerpress'); ?>
552
+ (<?php echo __('Leave unchecked to use your feed\'s explicit setting', 'powerpress'); ?>)</p>
553
+
554
+ <fieldset style="border: 1px dashed #333333; margin: 10px 0 10px -20px;">
555
+ <legend style="margin: 0 20px; padding: 0 5px 5px 5px; font-weight: bold;"><?php echo __('Advanced Options', 'powerpress'); ?></legend>
556
+ <p style="margin: 15px 0 0 20px;"><label><input id="episode_box_block" class="episode_box_option" name="General[episode_box_block]" type="checkbox" value="1"<?php if( !empty($General['episode_box_block']) ) echo ' checked'; ?> /> <?php echo __('iTunes Block', 'powerpress'); ?> (<?php echo htmlspecialchars('<itunes:block>yes</itunes:block>'); ?>)</label></p>
557
+ <div style="margin: 0 10px 10px 20px;"><em><strong><?php echo __('Prevent episodes from appearing in iTunes and other diretories that support the iTunes:block tag. Episodes may still appear in other directories and applications.', 'powerpress'); ?></strong></em></div>
558
+
559
+ <p style="margin: 15px 0 0 20px;"><label><input id="episode_box_gp_block" class="episode_box_option" name="General[episode_box_gp_block]" type="checkbox" value="1"<?php if( !empty($General['episode_box_gp_block']) ) echo ' checked'; ?> /> <?php echo __('Google Play Block', 'powerpress'); ?> (<?php echo htmlspecialchars('<googleplay:block>yes</itunes:googleplay>'); ?>)</label></p>
560
+ <div style="margin: 0 10px 10px 20px;"><em><strong><?php echo __('Prevent episodes from appearing in Google Play Music. Episodes may still appear in other directories and applications.', 'powerpress'); ?></strong></em></div>
561
+ </fieldset>
562
+
563
+ </div>
564
+
565
+ </td>
566
+ </tr>
567
+ </table>
568
+ <script language="javascript"><!--
569
+ SelectEmbedField(<?php echo $General['episode_box_embed']; ?>);
570
+ //-->
571
+ </script>
572
+
573
+ <?php
574
+
575
+ $AdvanecdOptions = false;
576
+ if( !empty($General['default_url']) )
577
+ $AdvanecdOptions = true;
578
+ if( !empty($General['set_duration']) )
579
+ $AdvanecdOptions = true;
580
+ if( !empty($General['set_size']) )
581
+ $AdvanecdOptions = true;
582
+ if( !empty($General['auto_enclose']) )
583
+ $AdvanecdOptions = true;
584
+ if( !empty($General['permalink_feeds_only']) )
585
+ $AdvanecdOptions = true;
586
+ if( !empty($General['hide_warnings']) )
587
+ $AdvanecdOptions = true;
588
+
589
+ $DefaultMediaURL = false;
590
+
591
+ if( !empty($General['default_url']) )
592
+ $DefaultMediaURL = true;
593
+
594
+ if( !$AdvanecdOptions ) {
595
+ ?>
596
+ <div style="margin-left: 10px; font-weight: bold;" id="advanced_basic_options_show_link"><a href="#" onclick="document.getElementById('advanced_basic_options').style.display='block';document.getElementById('advanced_basic_options_show_link').style.display='none';return false;"><?php echo __('Show Advanced Episode Entry Settings', 'powerpress'); ?></a></div>
597
+ <?php } ?>
598
+ <!-- start advanced features -->
599
+ <div id="advanced_basic_options" <?php echo ($AdvanecdOptions?'':'style="display:none;"'); ?>>
600
+ <?php if( $DefaultMediaURL || defined('POWERPRESS_DEFAULT_MEDIA_URL') ) { ?>
601
+ <table class="form-table">
602
+ <tr valign="top">
603
+ <th scope="row"><?php echo __('Default Media URL', 'powerpress'); ?></th>
604
+ <td>
605
+ <input type="text" style="width: 80%;" name="General[default_url]" value="<?php echo esc_attr($General['default_url']); ?>" maxlength="255" />
606
+ <p><?php echo __('e.g. http://example.com/mediafolder/', 'powerpress'); ?></p>
607
+ <p><?php echo __('URL above will prefix entered file names that do not start with \'http://\'. URL above must end with a trailing slash. You may leave blank if you always enter the complete URL to your media when creating podcast episodes.', 'powerpress'); ?>
608
+ </p>
609
+ </td>
610
+ </tr>
611
+ </table>
612
+ <?php } ?>
613
+
614
+ <div id="episode_entry_settings">
615
+ <table class="form-table">
616
+ <tr valign="top">
617
+ <th scope="row">
618
+
619
+ <?php echo __('File Size Default', 'powerpress'); ?></th>
620
+ <td>
621
+ <select name="General[set_size]" class="bpp_input_med">
622
+ <?php
623
+ $options = array(0=>__('Auto detect file size', 'powerpress'), 1=>__('User specify', 'powerpress') );
624
+
625
+ foreach( $options as $value => $desc )
626
+ echo "\t<option value=\"$value\"". ($General['set_size']==$value?' selected':''). ">$desc</option>\n";
627
+
628
+ ?>
629
+ </select> (<?php echo __('specify default file size option when creating a new episode', 'powerpress'); ?>)
630
+ </td>
631
+ </tr>
632
+
633
+ <tr valign="top">
634
+ <th scope="row">
635
+ <?php echo __('Duration Default', 'powerpress'); ?></th>
636
+ <td>
637
+ <select name="General[set_duration]" class="bpp_input_med">
638
+ <?php
639
+ $options = array(0=>__('Auto detect duration', 'powerpress'), 1=>__('User specify', 'powerpress'), -1=>__('Not specified (not recommended)', 'powerpress') );
640
+
641
+ foreach( $options as $value => $desc )
642
+ echo "\t<option value=\"$value\"". ($General['set_duration']==$value?' selected':''). ">$desc</option>\n";
643
+
644
+ ?>
645
+ </select> (<?php echo __('specify default duration option when creating a new episode', 'powerpress'); ?>)
646
+ </td>
647
+ </tr>
648
+ </table>
649
+ </div>
650
+
651
+ <table class="form-table">
652
+ <tr valign="top">
653
+ <th scope="row">
654
+ <?php echo __('Auto Add Media', 'powerpress'); ?></th>
655
+ <td>
656
+ <select name="General[auto_enclose]" class="bpp_input_med">
657
+ <?php
658
+ $options = array(0=>__('Disabled (default)', 'powerpress'), 1=>__('First media link found in post content', 'powerpress'), 2=>__('Last media link found in post content', 'powerpress') );
659
+
660
+ foreach( $options as $value => $desc )
661
+ echo "\t<option value=\"$value\"". ($General['auto_enclose']==$value?' selected':''). ">$desc</option>\n";
662
+
663
+ ?>
664
+ </select>
665
+ <p><?php echo __('When enabled, the first or last media link found in the post content is automatically added as your podcast episode.', 'powerpress'); ?></p>
666
+ <p style="margin-bottom: 0;" class="description"><em><?php echo __('NOTE: Use this feature with caution. Links to media files could unintentionally become podcast episodes.', 'powerpress'); ?></em></p>
667
+ <p><em><?php echo __('WARNING: Episodes created with this feature will <u>not</u> include Duration (total play time) information.', 'powerpress'); ?></em></p>
668
+ </td>
669
+ </tr>
670
+ <tr valign="top">
671
+ <th scope="row">
672
+ <?php echo __('Disable Warnings', 'powerpress'); ?></th>
673
+ <td>
674
+ <select name="General[hide_warnings]" class="bpp_input_med">
675
+ <?php
676
+ $options = array(0=>__('No (default)', 'powerpress'), 1=>__('Yes', 'powerpress') );
677
+ $current_value = (!empty($General['hide_warnings'])?$General['hide_warnings']:0);
678
+ foreach( $options as $value => $desc )
679
+ echo "\t<option value=\"$value\"". ($current_value==$value?' selected':''). ">$desc</option>\n";
680
+
681
+ ?>
682
+ </select>
683
+ <p><?php echo __('Disable warning messages displayed in episode entry box. Errors are still displayed.', 'powerpress'); ?></p>
684
+ </td>
685
+ </tr>
686
+ </table>
687
+ </div>
688
+ <!-- end advanced features -->
689
+ <?php
690
+
691
+
692
+ global $wp_rewrite;
693
+ if( $wp_rewrite->permalink_structure ) // Only display if permalinks is enabled in WordPress
694
+ {
695
+ ?>
696
+ <h3><?php echo __('Permalinks', 'powerpress'); ?></h3>
697
+ <table class="form-table">
698
+ <tr valign="top">
699
+ <th scope="row">
700
+ <?php echo __('Podcast Permalinks', 'powerpress'); ?></th>
701
+ <td>
702
+ <select name="General[permalink_feeds_only]" class="bpp_input_normal">
703
+ <?php
704
+ $options = array(0=>__('Default WordPress Behavior', 'powerpress'), 1=>__('Match Feed Name to Page/Category', 'powerpress') );
705
+ $current_value = (!empty($General['permalink_feeds_only'])?$General['permalink_feeds_only']:0);
706
+
707
+ foreach( $options as $value => $desc )
708
+ echo "\t<option value=\"$value\"". ($current_value==$value?' selected':''). ">$desc</option>\n";
709
+
710
+ ?>
711
+ </select>
712
+ <p><?php echo sprintf(__('When configured, %s/podcast/ is matched to page/category named \'podcast\'.', 'powerpress'), get_bloginfo('url') ); ?></p>
713
+ </td>
714
+ </tr>
715
+ </table>
716
+ <?php
717
+ }
718
+ ?>
719
+
720
+
721
+ <?php
722
+ }
723
+
724
+ function powerpressadmin_edit_podpress_options($General)
725
+ {
726
+ if( !empty($General['process_podpress']) || powerpress_podpress_episodes_exist() )
727
+ {
728
+ if( !isset($General['process_podpress']) )
729
+ $General['process_podpress'] = 0;
730
+ if( !isset($General['podpress_stats']) )
731
+ $General['podpress_stats'] = 0;
732
+ ?>
733
+
734
+ <h3><?php echo __('PodPress Options', 'powerpress'); ?></h3>
735
+ <table class="form-table">
736
+ <tr valign="top">
737
+ <th scope="row">
738
+
739
+ <?php echo __('PodPress Episodes', 'powerpress'); ?></th>
740
+ <td>
741
+ <select name="General[process_podpress]" class="bpp_input_med">
742
+ <?php
743
+ $options = array(0=>__('Ignore', 'powerpress'), 1=>__('Include in Posts and Feeds', 'powerpress') );
744
+
745
+ foreach( $options as $value => $desc )
746
+ echo "\t<option value=\"$value\"". ($General['process_podpress']==$value?' selected':''). ">$desc</option>\n";
747
+
748
+ ?>
749
+ </select> (<?php echo __('includes podcast episodes previously created in PodPress', 'powerpress'); ?>)
750
+ </td>
751
+ </tr>
752
+ <?php if( !empty($General['podpress_stats']) || powerpress_podpress_stats_exist() ) { ?>
753
+ <tr valign="top">
754
+ <th scope="row">
755
+
756
+ <?php echo __('PodPress Stats Archive', 'powerpress'); ?></th>
757
+ <td>
758
+ <select name="General[podpress_stats]" class="bpp_input_sm">
759
+ <?php
760
+ $options = array(0=>__('Hide', 'powerpress'), 1=>__('Display', 'powerpress') );
761
+
762
+ foreach( $options as $value => $desc )
763
+ echo "\t<option value=\"$value\"". ($General['podpress_stats']==$value?' selected':''). ">$desc</option>\n";
764
+
765
+ ?>
766
+ </select> (<?php echo __('display archive of old PodPress statistics', 'powerpress'); ?>)
767
+ </td>
768
+ </tr>
769
+ <?php } ?>
770
+ </table>
771
+ <?php
772
+ }
773
+ }
774
+
775
+
776
+ function powerpressadmin_edit_googleplay($FeedSettings, $General, $FeedAttribs = array() )
777
+ {
778
+ $feed_slug = $FeedAttribs['feed_slug'];
779
+ $cat_ID = $FeedAttribs['category_id'];
780
+
781
+ // Set default settings (if not set)
782
+ if( empty($FeedSettings['googleplay_url']) )
783
+ $FeedSettings['googleplay_url'] = '';
784
+ if( empty($FeedSettings['googleplay_email']) )
785
+ $FeedSettings['googleplay_email'] = '';
786
+ if( empty($FeedSettings['googleplay_author']) )
787
+ $FeedSettings['googleplay_author'] = '';
788
+ if( empty($FeedSettings['googleplay_description']) )
789
+ $FeedSettings['googleplay_description'] = '';
790
+ if( empty($FeedSettings['googleplay_explicit']) )
791
+ $FeedSettings['googleplay_explicit'] = '';
792
+ if( empty($FeedSettings['googleplay_cat']) )
793
+ $FeedSettings['googleplay_cat'] = '';
794
+
795
+ $gp_feed_url = '';
796
+ switch( $FeedAttribs['type'] )
797
+ {
798
+ case 'ttid': {
799
+ $gp_feed_url = get_term_feed_link($FeedAttribs['term_taxonomy_id'], $FeedAttribs['taxonomy_type'], 'rss2' );
800
+ }; break;
801
+ case 'category': {
802
+ if( !empty($General['cat_casting_podcast_feeds']) )
803
+ $gp_feed_url = get_category_feed_link($cat_ID, 'podcast');
804
+ else
805
+ $gp_feed_url = get_category_feed_link($cat_ID);
806
+ }; break;
807
+ case 'channel': {
808
+ $gp_feed_url = get_feed_link($feed_slug);
809
+ }; break;
810
+ case 'post_type': {
811
+ $gp_feed_url = get_post_type_archive_feed_link($FeedAttribs['post_type'], $feed_slug);
812
+ }; break;
813
+ case 'general':
814
+ default: {
815
+ $gp_feed_url = get_feed_link('podcast');
816
+ }
817
+ }
818
+
819
+ ?>
820
+ <h3><?php echo __('Google Play Settings', 'powerpress'); ?> </h3>
821
+ <table class="form-table">
822
+ <tr valign="top">
823
+ <th scope="row">
824
+ <?php echo __('Google Play Email', 'powerpress'); ?>
825
+ </th>
826
+ <td>
827
+ <input type="text" name="Feed[googleplay_email]" class="bpp_input_med" value="<?php echo esc_attr($FeedSettings['googleplay_email']); ?>" maxlength="255" />
828
+ <div>(<?php echo __('Google will email this address when your podcast is accepted to the Google Play Music Podcast directory.', 'powerpress'); ?>)</div>
829
+ <p><?php echo __('iTunes email setting will be used if left blank.', 'powerpress'); ?></p>
830
+ </td>
831
+ </tr>
832
+ <tr valign="top">
833
+ <th scope="row">
834
+ <?php echo __('Google Play Author', 'powerpress'); ?>
835
+ </th>
836
+ <td>
837
+ <input type="text" name="Feed[googleplay_author]" class="bpp_input_med" value="<?php echo esc_attr($FeedSettings['googleplay_author']); ?>" maxlength="255" />
838
+ <p><?php echo __('iTunes Author will be used if left blank', 'powerpress'); ?></p>
839
+ <?php if( !empty($General['seo_itunes']) ) { ?>
840
+ <p class="description"><?php echo __('Podcasting SEO Suggestion: This field may be indexed for Google Play Music search.', 'powerpress'); ?></p>
841
+ <?php } ?>
842
+ </td>
843
+ </tr>
844
+ <tr valign="top">
845
+ <th scope="row">
846
+ <?php echo __('Google Play Description', 'powerpress'); ?>
847
+ </th>
848
+ <td>
849
+ <p style="margin-top: 5px;"><?php echo __('Your description cannot exceed 4,000 characters in length.', 'powerpress'); ?></p>
850
+ <textarea name="Feed[googleplay_description]" rows="5" class="bpp-input-normal"><?php echo esc_textarea($FeedSettings['googleplay_description']); ?></textarea>
851
+ <p><?php echo __('iTunes Summary will be used if left blank', 'powerpress'); ?></p>
852
+ <?php if( !empty($General['seo_itunes']) ) { ?>
853
+ <p class="description"><?php echo __('Podcasting SEO Suggestion: This field may be indexed for Google Play Music search.', 'powerpress'); ?></p>
854
+ <?php } ?>
855
+ </td>
856
+ </tr>
857
+ <tr valign="top">
858
+ <th scope="row">
859
+ <?php echo __('Google Play Explicit', 'powerpress'); ?>
860
+ </th>
861
+ <td>
862
+ <select name="Feed[googleplay_explicit]" class="bpp_input_med">
863
+ <?php
864
+ $explicit = array(0=> __('No - display nothing', 'powerpress'), 1=>__('Yes - explicit content', 'powerpress') );
865
+
866
+ foreach( $explicit as $value => $desc )
867
+ echo "\t<option value=\"$value\"". ($FeedSettings['googleplay_explicit']==$value?' selected':''). ">$desc</option>\n";
868
+
869
+ ?>
870
+ </select>
871
+ </td>
872
+ </tr>
873
+ <tr valign="top">
874
+ <th scope="row">
875
+ <?php echo __('Google Play Category', 'powerpress'); ?>
876
+ <span class="powerpress-required"><?php echo __('Required', 'powerpress'); ?></span>
877
+ </th>
878
+ <td>
879
+ <select name="Feed[googleplay_cat]" class="bpp_input_med">
880
+ <?php
881
+
882
+ $MoreCategories = false;
883
+
884
+
885
+ $Categories = powerpress_googleplay_categories();
886
+
887
+ echo '<option value="">'. __('Select Category', 'powerpress') .'</option>';
888
+ foreach( $Categories as $value => $desc )
889
+ echo "\t<option value=\"$value\"". ($FeedSettings['googleplay_cat']==$value?' selected':''). ">".htmlspecialchars($desc)."</option>\n";
890
+
891
+ ?>
892
+ </select>
893
+ </td>
894
+ </tr>
895
+
896
+ </table>
897
+ <?php
898
+ }
899
+
900
+ function powerpressadmin_edit_itunes_general($FeedSettings, $General, $FeedAttribs = array() )
901
+ {
902
+ // Set default settings (if not set)
903
+ if( !empty($FeedSettings) )
904
+ {
905
+ if( !isset($FeedSettings['itunes_url']) )
906
+ $FeedSettings['itunes_url'] = '';
907
+ }
908
+ if( !isset($General['itunes_url']) )
909
+ $General['itunes_url'] = '';
910
+ else if( !isset($FeedSettings['itunes_url']) ) // Should almost never happen
911
+ $FeedSettings['itunes_url'] = $General['itunes_url'];
912
+
913
+ $feed_slug = $FeedAttribs['feed_slug'];
914
+ $cat_ID = $FeedAttribs['category_id'];
915
+
916
+ if( $feed_slug == 'podcast' && $FeedAttribs['type'] == 'general' )
917
+ {
918
+ if( empty($FeedSettings['itunes_url']) && !empty($General['itunes_url']) )
919
+ $FeedSettings['itunes_url'] = $General['itunes_url'];
920
+ }
921
+
922
+ $itunes_feed_url = '';
923
+
924
+ switch( $FeedAttribs['type'] )
925
+ {
926
+ case 'ttid': {
927
+ $itunes_feed_url = get_term_feed_link($FeedAttribs['term_taxonomy_id'], $FeedAttribs['taxonomy_type'], 'rss2');
928
+ }; break;
929
+ case 'category': {
930
+ if( !empty($General['cat_casting_podcast_feeds']) )
931
+ $itunes_feed_url = get_category_feed_link($cat_ID, 'podcast');
932
+ else
933
+ $itunes_feed_url = get_category_feed_link($cat_ID);
934
+ }; break;
935
+ case 'channel': {
936
+ $itunes_feed_url = get_feed_link($feed_slug);
937
+ }; break;
938
+ case 'post_type': {
939
+ $itunes_feed_url = get_post_type_archive_feed_link($FeedAttribs['post_type'], $feed_slug);
940
+ }; break;
941
+ case 'general':
942
+ default: {
943
+ $itunes_feed_url = get_feed_link('podcast');
944
+ }
945
+ }
946
+
947
+ ?>
948
+ <h3><?php echo __('iTunes Listing Information', 'powerpress'); ?></h3>
949
+
950
+ <?php
951
+ } // end itunes general
952
+
953
+ function powerpressadmin_edit_blubrry_services($General, $action_url = false, $action = false)
954
+ {
955
+ $DisableStatsInDashboard = false;
956
+ if( !empty($General['disable_dashboard_stats']) )
957
+ $DisableStatsInDashboard = true;
958
+
959
+
960
+ if( $action_url == false )
961
+ $action_url = admin_url('admin.php?action=powerpress-jquery-account');
962
+ if( $action == false )
963
+ $action = 'powerpress-jquery-account';
964
+ ?>
965
+ <h3><?php echo __('Integrate Blubrry Services', 'powerpress'); ?></h3>
966
+ <ul><li><ul>
967
+ <li style="margin-left: 30px; font-size:115%;"><?php echo sprintf(__('Track your podcast downloads with Blubrry\'s <a href="%s" target="_blank">FREE Basic Statistics</a> or <a href="%s" target="_blank">Professional Media Statistics</a>.','powerpress'), 'http://create.blubrry.com/resources/podcast-media-download-statistics/basic-statistics/', 'http://create.blubrry.com/resources/podcast-media-download-statistics/'); ?></li>
968
+ <li style="margin-left: 30px; font-size:115%;"><?php echo sprintf(__('Upload and publish podcast media directly from your blog with <a href="%s" target="_blank">Blubrry Media Hosting</a>.','powerpress'), 'http://create.blubrry.com/resources/podcast-media-hosting/'); ?></li>
969
+ </ul></li></ul>
970
+ <div style="margin-left: 40px;">
971
+ <p style="font-size: 125%;">
972
+ <strong><a class="button-primary button-blubrry thickbox" title="<?php echo esc_attr(__('Blubrry Services Integration', 'powerpress')); ?>" href="<?php echo wp_nonce_url( $action_url, $action); ?>&amp;KeepThis=true&amp;TB_iframe=true&amp;width=600&amp;height=400&amp;modal=false" target="_blank"><?php echo __('Click here to configure Blubrry Statistics and Hosting services', 'powerpress'); ?></a></strong>
973
+ </p>
974
+ <?php
975
+ if( !empty($General['blubrry_program_keyword']) )
976
+ {
977
+ // Check that the redirect is in the settings...
978
+ $RedirectURL = 'http://media.blubrry.com/'.$General['blubrry_program_keyword'].'/';
979
+ $Error = true;
980
+ if( stripos($General['redirect1'], $RedirectURL ) !== false )
981
+ $Error = false;
982
+ else if( stripos($General['redirect2'], $RedirectURL ) !== false )
983
+ $Error = false;
984
+ else if( stripos($General['redirect3'], $RedirectURL ) !== false )
985
+ $Error = false;
986
+ if( $Error )
987
+ {
988
+ ?>
989
+ <p style="font-weight: bold; color: #CC0000;">
990
+ <?php
991
+ echo __('Statistics are not implemented correctly on this blog. Please click the button above to re-configure your services.', 'powerpress');
992
+ ?>
993
+ </p>
994
+ <?php
995
+ }
996
+ else
997
+ {
998
+ ?>
999
+ <p style="font-weight: bold;">
1000
+ <img src="<?php echo powerpress_get_root_url(); ?>images/Check.png" style="width: 25px; height: 20px;" alt="<?php echo __('Enabled!', 'powerpress'); ?>" />
1001
+ <?php
1002
+ if( empty($General['blubrry_hosting']) || $General['blubrry_hosting'] === 'false' )
1003
+ echo __('Blubrry Statistics Enabled!', 'powerpress');
1004
+ else
1005
+ echo __('Blubrry Statistics and Media Hosting Enabled!', 'powerpress');
1006
+ ?>
1007
+ </p>
1008
+ <?php if( !empty($General['blubrry_hosting']) && $General['blubrry_hosting'] !== 'false' && !empty($General['blubrry_program_keyword']) ) { ?>
1009
+ <p style="margin-left: 30px;"><?php echo __('Blubrry Program ID: ', 'powerpress'); ?> <i><?php echo $General['blubrry_program_keyword']; ?></i>
1010
+ </p><?php } ?>
1011
+ <?php
1012
+ }
1013
+
1014
+ if( empty($General['blubrry_hosting']) || $General['blubrry_hosting'] === 'false' )
1015
+ {
1016
+ ?>
1017
+ <p>
1018
+ <?php echo __('Recently upgraded to Blubrry Hosting?', 'powerpress'); ?>
1019
+ <a class="thickbox" title="<?php echo esc_attr(__('Blubrry Services Integration', 'powerpress')); ?>" href="<?php echo admin_url(); echo wp_nonce_url( "admin.php?action=powerpress-jquery-account", 'powerpress-jquery-account'); ?>&amp;KeepThis=true&amp;TB_iframe=true&amp;width=600&amp;height=400&amp;modal=false" target="_blank"><?php echo __('Click here to enter your account information.', 'powerpress'); ?></a>
1020
+ </p>
1021
+ <?php
1022
+ }
1023
+ }
1024
+ ?>
1025
+ </div>
1026
+ <?php
1027
+ if( empty($General['blubrry_hosting']) || $General['blubrry_hosting'] === 'false' ) // Not signed up for hosting?
1028
+ {
1029
+ ?>
1030
+ <div class="blubrry-services">
1031
+ <div class="blubrry-hosting">
1032
+ <p class="top-lines"><?php echo __('Need a reliable host for your podcast media?', 'powerpress'); ?></p>
1033
+ <p><?php echo __('Blubrry Media Hosting packages start at $12.', 'powerpress'); ?></p>
1034
+ <p><a href="http://create.blubrry.com/resources/podcast-media-hosting/" target="_blank"><?php echo __('Learn More', 'powerpress'); ?></a></p>
1035
+ </div>
1036
+ <div class="blubrry-stats">
1037
+ <p class="top-lines"><?php echo __('Measure your audience for <strong>free</strong> and add more detailed', 'powerpress'); ?></p>
1038
+ <p><?php echo __('reporting for only $5 per month.', 'powerpress'); ?></p>
1039
+ <p>&nbsp;</p>
1040
+ <p><a href="http://create.blubrry.com/resources/podcast-media-download-statistics/" target="_blank"><?php echo __('Learn More', 'powerpress'); ?></a></p>
1041
+ </div>
1042
+ <div class="clear"></div>
1043
+ </div>
1044
+ <?php
1045
+ } // end not signed up for hosting
1046
+
1047
+ ?>
1048
+ <div style="margin-left: 40px;">
1049
+ <p style="margin-top: 10px;">
1050
+ <input name="DisableStatsInDashboard" type="checkbox" value="1"<?php if( $DisableStatsInDashboard == true ) echo ' checked'; ?> />
1051
+ <?php echo __('Remove Statistics from WordPress Dashboard', 'powerpress'); ?></p>
1052
+ <p>
1053
+ <input type="checkbox" id="blubrry_network_mode" value="1" name="General[network_mode]" <?php echo $General['network_mode'] == '1' ? 'checked' : ''; ?> />
1054
+ <label for="blubrry_network_mode"><?php echo __('Network mode (publish to multiple Blubrry Hosting Accounts)', 'powerpress') ?></label>
1055
+ </p>
1056
+ </div>
1057
+ <?php
1058
+ }
1059
+
1060
+ function powerpressadmin_edit_media_statistics($General)
1061
+ {
1062
+ if( !isset($General['redirect1']) )
1063
+ $General['redirect1'] = '';
1064
+ if( !isset($General['redirect2']) )
1065
+ $General['redirect2'] = '';
1066
+ if( !isset($General['redirect3']) )
1067
+ $General['redirect3'] = '';
1068
+
1069
+ $StatsIntegrationURL = '';
1070
+ if( !empty($General['blubrry_program_keyword']) )
1071
+ $StatsIntegrationURL = 'http://media.blubrry.com/'.$General['blubrry_program_keyword'].'/';
1072
+ ?>
1073
+ <div id="blubrry_stats_settings">
1074
+ <h3><?php echo __('Media Statistics', 'powerpress'); ?></h3>
1075
+ <div style="margin-left: 40px;">
1076
+ <p>
1077
+ <?php echo __('Enter your Redirect URL issued by your media statistics service provider below.', 'powerpress'); ?>
1078
+ </p>
1079
+
1080
+ <div style="position: relative; margin-left: 40px; padding-bottom: 10px;">
1081
+ <table class="form-table">
1082
+ <tr valign="top">
1083
+ <th scope="row">
1084
+ <?php echo __('Redirect URL 1', 'powerpress'); ?>
1085
+ </th>
1086
+ <td>
1087
+ <input type="text" style="width: 60%;" name="<?php if( stripos($General['redirect1'], $StatsIntegrationURL) !== false ) echo 'NULL[redirect1]'; else echo 'General[redirect1]'; ?>" value="<?php echo esc_attr($General['redirect1']); ?>" onChange="return CheckRedirect(this);" maxlength="255" <?php if( stripos($General['redirect1'], $StatsIntegrationURL) !== false ) { echo ' readOnly="readOnly"'; $StatsIntegrationURL = false; } ?> />
1088
+ </td>
1089
+ </tr>
1090
+ </table>
1091
+ <?php if( empty($General['redirect2']) && empty($General['redirect3']) ) { ?>
1092
+ <div style="position: absolute;bottom: -2px;left: -40px;" id="powerpress_redirect2_showlink">
1093
+ <a href="#" onclick="javascript:document.getElementById('powerpress_redirect2_table').style.display='block';document.getElementById('powerpress_redirect2_showlink').style.display='none';return false;"><?php echo __('Add Another Redirect', 'powerpress'); ?></a>
1094
+ </div>
1095
+ <?php } ?>
1096
+ </div>
1097
+
1098
+
1099
+ <div id="powerpress_redirect2_table" style="position: relative;<?php if( empty($General['redirect2']) && empty($General['redirect3']) ) echo 'display:none;'; ?> margin-left: 40px; padding-bottom: 10px;">
1100
+ <table class="form-table">
1101
+ <tr valign="top">
1102
+ <th scope="row">
1103
+ <?php echo __('Redirect URL 2', 'powerpress'); ?>
1104
+ </th>
1105
+ <td>
1106
+ <input type="text" style="width: 60%;" name="<?php if( stripos($General['redirect2'], $StatsIntegrationURL) !== false ) echo 'NULL[redirect2]'; else echo 'General[redirect2]'; ?>" value="<?php echo esc_attr($General['redirect2']); ?>" onblur="return CheckRedirect(this);" maxlength="255" <?php if( stripos($General['redirect2'], $StatsIntegrationURL) !== false ) { echo ' readOnly="readOnly"'; $StatsIntegrationURL = false; } ?> />
1107
+ </td>
1108
+ </tr>
1109
+ </table>
1110
+ <?php if( $General['redirect3'] == '' ) { ?>
1111
+ <div style="position: absolute;bottom: -2px;left: -40px;" id="powerpress_redirect3_showlink">
1112
+ <a href="#" onclick="javascript:document.getElementById('powerpress_redirect3_table').style.display='block';document.getElementById('powerpress_redirect3_showlink').style.display='none';return false;"><?php echo __('Add Another Redirect', 'powerpress'); ?></a>
1113
+ </div>
1114
+ <?php } ?>
1115
+ </div>
1116
+
1117
+ <div id="powerpress_redirect3_table" style="<?php if( empty($General['redirect3']) ) echo 'display:none;'; ?> margin-left: 40px;">
1118
+ <table class="form-table">
1119
+ <tr valign="top">
1120
+ <th scope="row">
1121
+ <?php echo __('Redirect URL 3', 'powerpress'); ?>
1122
+ </th>
1123
+ <td>
1124
+ <input type="text" style="width: 60%;" name="<?php if( stripos($General['redirect3'], $StatsIntegrationURL) !== false ) echo 'NULL[redirect3]'; else echo 'General[redirect3]'; ?>" value="<?php echo esc_attr($General['redirect3']); ?>" onblur="return CheckRedirect(this);" maxlength="255" <?php if( stripos($General['redirect3'], $StatsIntegrationURL) !== false ) echo ' readOnly="readOnly"'; ?> />
1125
+ </td>
1126
+ </tr>
1127
+ </table>
1128
+ </div>
1129
+ <style type="text/css">
1130
+ #TB_window {
1131
+ border: solid 1px #3D517E;
1132
+ }
1133
+ </style>
1134
+ </div>
1135
+ </div><!-- end blubrry_stats_settings -->
1136
+ <?php
1137
+ }
1138
+
1139
+ function powerpressadmin_appearance($General=false, $Feed = false)
1140
+ {
1141
+ if( $General === false )
1142
+ $General = powerpress_get_settings('powerpress_general');
1143
+ $General = powerpress_default_settings($General, 'appearance');
1144
+ if( !isset($General['player_function']) )
1145
+ $General['player_function'] = 1;
1146
+ if( !isset($General['player_aggressive']) )
1147
+ $General['player_aggressive'] = 0;
1148
+ if( !isset($General['new_window_width']) )
1149
+ $General['new_window_width'] = '';
1150
+ if( !isset($General['new_window_height']) )
1151
+ $General['new_window_height'] = '';
1152
+ if( !isset($General['player_width']) )
1153
+ $General['player_width'] = '';
1154
+ if( !isset($General['player_height']) )
1155
+ $General['player_height'] = '';
1156
+ if( !isset($General['player_width_audio']) )
1157
+ $General['player_width_audio'] = '';
1158
+ if( !isset($General['disable_appearance']) )
1159
+ $General['disable_appearance'] = false;
1160
+ if( !isset($General['subscribe_links']) )
1161
+ $General['subscribe_links'] = true;
1162
+ if( !isset($General['subscribe_label']) )
1163
+ $General['subscribe_label'] = '';
1164
+
1165
+
1166
+ /*
1167
+ $Players = array('podcast'=>__('Default Podcast (podcast)', 'powerpress') );
1168
+ if( isset($General['custom_feeds']) )
1169
+ {
1170
+ foreach( $General['custom_feeds'] as $podcast_slug => $podcast_title )
1171
+ {
1172
+ if( $podcast_slug == 'podcast' )
1173
+ continue;
1174
+ $Players[$podcast_slug] = sprintf('%s (%s)', $podcast_title, $podcast_slug);
1175
+ }
1176
+ }
1177
+ */
1178
+
1179
+ ?>
1180
+
1181
+ <!-- start advanced features -->
1182
+ <?php if( !empty($General['advanced_mode_2']) ) { ?>
1183
+ <h3><?php echo __('Website Settings', 'powerpress'); ?></h3>
1184
+ <div id="enable_presentation_settings">
1185
+ <table class="form-table">
1186
+ <tr valign="top">
1187
+ <th scope="row">&nbsp; </th>
1188
+ <td>
1189
+ <ul>
1190
+ <li><p><label><input type="radio" name="General[disable_appearance]" value="0" <?php if( $General['disable_appearance'] == 0 ) echo 'checked'; ?> onclick="javascript: jQuery('#presentation_settings').css('display', (this.checked?'block':'none') );" /> <?php echo __('Enable PowerPress Media Players and Links', 'powerpress'); ?></label> (<?php echo __('default', 'powerpress'); ?>)</p>
1191
+ <ul><li>
1192
+ <p class="description"><?php echo __('PowerPress will add media players and links to your site.', 'powerpress'); ?></p>
1193
+ </li></ul>
1194
+ </li>
1195
+
1196
+ <li><p><label><input type="radio" name="General[disable_appearance]" value="1" <?php if( $General['disable_appearance'] == 1 ) echo 'checked'; ?> onclick="javascript: jQuery('#presentation_settings').css('display', (this.checked?'none':'block') );" /> <?php echo __('Disable PowerPress Media Players and Links', 'powerpress'); ?></label></p>
1197
+ <ul><li>
1198
+ <p class="description"><?php echo __('PowerPress will <u>not</u> add any media players or media links to your site. PowerPress will only be used to add podcasting support to your feeds.', 'powerpress'); ?></p>
1199
+ </li></ul>
1200
+ </li>
1201
+ </ul>
1202
+ </td>
1203
+ </tr>
1204
+ </table>
1205
+ </div><!-- end enable_presentation_settings -->
1206
+ <div id="presentation_settings"<?php if($General['disable_appearance']) echo ' style="display: none;"'; ?>>
1207
+ <!-- start presentation_settings in advanced mode -->
1208
+ <!-- end advanced features -->
1209
+ <?php } ?>
1210
+
1211
+ <h3><?php echo __('Blog Posts and Pages', 'powerpress'); ?></h3>
1212
+
1213
+
1214
+ <table class="form-table">
1215
+ <tr valign="top">
1216
+ <th scope="row"><?php echo htmlspecialchars(__('Display Media & Links', 'powerpress')); ?></th>
1217
+ <td>
1218
+ <ul>
1219
+ <li><p><label><input type="radio" name="General[display_player]" value="1" <?php if( $General['display_player'] == 1 ) echo 'checked'; ?> /> <?php echo __('Below page content', 'powerpress'); ?></label> (<?php echo __('default', 'powerpress'); ?>)</p>
1220
+ <ul><li>
1221
+ <p class="description"><?php echo __('Player and media links will appear <u>below</u> your post and page content.', 'powerpress'); ?><p>
1222
+ </li></ul>
1223
+ </li>
1224
+ <li><p><label><input type="radio" name="General[display_player]" value="2" <?php if( $General['display_player'] == 2 ) echo 'checked'; ?> /> <?php echo __('Above page content', 'powerpress'); ?></label></p>
1225
+ <ul><li>
1226
+ <p class="description"><?php echo __('Player and media links will appear <u>above</u> your post and page content.', 'powerpress'); ?></p>
1227
+ </li></ul>
1228
+ </li>
1229
+ <li>
1230
+ <p><label><input type="radio" name="General[display_player]" value="0" <?php if( $General['display_player'] == 0 ) echo 'checked'; ?> /> <?php echo __('Disable', 'powerpress'); ?></label></p>
1231
+ <ul><li>
1232
+ <p class="description"><?php echo __('Player and media links will <u>NOT</u> appear in your post and page content. Media player and links can be added manually by using the <i>shortcode</i> below.', 'powerpress'); ?></p>
1233
+ </li></ul>
1234
+ </li>
1235
+ </ul>
1236
+ <p><input name="General[display_player_excerpt]" type="checkbox" value="1" <?php if( !empty($General['display_player_excerpt']) ) echo 'checked '; ?>/> <?php echo __('Display player / links:', 'powerpress'); ?> <a href="http://codex.wordpress.org/Template_Tags/the_excerpt" title="<?php echo __('WordPress Excerpts', 'powerpress'); ?>" target="_blank"><?php echo __('WordPress Excerpts', 'powerpress'); ?></a> (<?php echo __('e.g. search results', 'powerpress'); ?>)</p>
1237
+ <input type="hidden" name="General[hide_player_more]" value="0" />
1238
+ <p><input name="General[hide_player_more]" type="checkbox" value="1" <?php if( !empty($General['hide_player_more']) ) echo 'checked '; ?>/> <?php echo __('Hide player / links:', 'powerpress'); ?> <a href="https://en.support.wordpress.com/more-tag/" title="<?php echo __('Read More tagged posts', 'powerpress'); ?>" target="_blank"><?php echo __('Read More tagged posts', 'powerpress'); ?></a></p>
1239
+ </td>
1240
+ </tr>
1241
+ </table>
1242
+
1243
+ <?php if( !empty($General['advanced_mode_2']) ) { ?>
1244
+ <!-- start advanced features -->
1245
+ <table class="form-table">
1246
+ <tr valign="top">
1247
+ <th scope="row">
1248
+ <?php echo __('Media Player', 'powerpress'); ?></th>
1249
+ <td>
1250
+
1251
+ <p><label><input type="checkbox" name="PlayerSettings[display_media_player]" value="2" <?php if( $General['player_function'] == 1 || $General['player_function'] == 2 ) echo 'checked '; ?>/> <?php echo __('Display Player', 'powerpress'); ?></label></p>
1252
+ <?php /* ?>
1253
+ <p style="margin-left: 35px;"><input type="checkbox" name="General[display_player_disable_mobile]" value="1" <?php if( !empty($General['display_player_disable_mobile']) ) echo 'checked '; ?>/> <?php echo __('Disable Media Player for known mobile devices.', 'powerpress'); ?></p>
1254
+ <?php */ ?>
1255
+ <p><?php echo __('Detected mobile and tablet devices use an HTML5 player with a fallback link to download the media.', 'powerpress'); ?></p>
1256
+ </td>
1257
+ </tr>
1258
+ </table>
1259
+
1260
+
1261
+
1262
+
1263
+ <table class="form-table">
1264
+
1265
+ <tr valign="top">
1266
+ <th scope="row">
1267
+
1268
+ <?php echo __('Media Links', 'powerpress'); ?></th>
1269
+ <td>
1270
+ <p style="padding-top: 8px;"><label><input type="checkbox" name="PlayerSettings[display_pinw]" value="3" <?php if( $General['player_function'] == 3 || $General['player_function'] == 1 ) echo 'checked '; ?>/> <?php echo __('Display Play in new Window Link', 'powerpress'); ?></label></p>
1271
+
1272
+ <p><label><input type="checkbox" name="PlayerSettings[display_download]" value="1" <?php if( $General['podcast_link'] != 0 ) echo 'checked '; ?>/> <?php echo __('Display Download Link', 'powerpress'); ?></label></p>
1273
+
1274
+ <p style="margin-left: 35px;"><input type="checkbox" id="display_download_size" name="PlayerSettings[display_download_size]" value="1" <?php if( $General['podcast_link'] == 2 || $General['podcast_link'] == 3 ) echo 'checked'; ?> onclick="if( !this.checked ) { jQuery('#display_download_duration').removeAttr('checked'); }" /> <?php echo __('Include file size', 'powerpress'); ?>
1275
+ <input type="checkbox" style="margin-left: 30px;" id="display_download_duration" name="PlayerSettings[display_download_duration]" value="1" <?php if( $General['podcast_link'] == 3 ) echo 'checked'; ?> onclick="if( this.checked ) { jQuery('#display_download_size').attr('checked','checked'); }" /> <?php echo __('Include file size and duration', 'powerpress'); ?></p>
1276
+
1277
+ <p><label><input type="checkbox" name="General[podcast_embed]" value="1" <?php if( !empty($General['podcast_embed']) ) echo 'checked '; ?>/> <?php echo __('Display Player Embed Link', 'powerpress'); ?> </label></p>
1278
+ <p style="margin-left: 35px;">
1279
+ <input type="checkbox" name="General[podcast_embed_in_feed]" value="1" <?php if( !empty($General['podcast_embed_in_feed']) ) echo 'checked'; ?> /> <?php echo __('Include embed in feeds', 'powerpress'); ?>
1280
+ </p>
1281
+ <p><?php echo __('Embed option works with the MediaElement.js Media Player for audio and video, Flow Player Classic for audio and HTML5 Video player for video.', 'powerpress'); ?></p>
1282
+ </td>
1283
+ </tr>
1284
+ </table>
1285
+
1286
+ <table class="form-table">
1287
+
1288
+ <tr valign="top">
1289
+ <th scope="row">
1290
+ <?php echo __('Subscribe Links', 'powerpress'); ?> </th>
1291
+ <td>
1292
+ <p style="padding-top: 8px;"><label><input type="checkbox" name="General[subscribe_links]" value="1" <?php if( $General['subscribe_links'] == 1 ) echo 'checked '; ?>/>
1293
+ <?php echo __('Display subscribe links below player and media links.', 'powerpress'); ?></label></p>
1294
+ <ul>
1295
+ <li><label for="subscribe_label">Subscribe label: <input type="text" id="subscribe_label" value="<?php echo esc_attr($General['subscribe_label']); ?>" name="General[subscribe_label]" placeholder="Subscribe:" /></label>
1296
+ <?php echo __('(leave blank for default)', 'powerpress'); ?>
1297
+ </li>
1298
+ </ul>
1299
+
1300
+ <p style="padding-top:10px;"><input type="checkbox" name="NULL[subscribe_feature_itunes]" value="1" checked disabled /> <label><?php echo __('Subscribe on Apple Podcasts', 'powerpress'); ?></label></p>
1301
+ <div style="margin-left: 24px;">
1302
+ <p><a href="<?php echo 'https://linkmaker.itunes.apple.com/?q='.urlencode( get_bloginfo('name') ); ?>&amp;media=podcasts" target="_blank"><?php echo __('Find your iTunes Subscription URL', 'powerpress'); ?></a></p>
1303
+ </div>
1304
+
1305
+ <p><input type="checkbox" name="NULL[subscribe_feature_android]" value="1" checked disabled /> <label><?php echo __('Subscribe on Android', 'powerpress'); ?></label></p>
1306
+ <div style="margin-left: 24px;">
1307
+ <p><a href="http://subscribeonandroid.com/podcasters/" target="_blank"><?php echo __('Learn more about Subscribe on Android', 'powerpress'); ?></a></p>
1308
+ </div>
1309
+
1310
+ <p><input type="hidden" name="General[subscribe_feature_rss]" value="0" /><input type="checkbox" name="General[subscribe_feature_rss]" value="1" id="subscribe_feature_rss" <?php if( !empty($General['subscribe_feature_rss']) || !isset($General['subscribe_feature_rss']) ) echo 'checked '; ?>/> <label for="subscribe_feature_rss"><?php echo __('Subscribe via RSS', 'powerpress'); ?></label></p>
1311
+
1312
+ <p><input type="checkbox" id="subscribe_feature_email" name="General[subscribe_feature_email]" value="1" <?php if( !empty($General['subscribe_feature_email']) ) echo 'checked '; ?>/> <label for="subscribe_feature_email"><?php echo __('Subscribe By Email', 'powerpress'); ?></label> </p>
1313
+ <div style="margin-left: 24px;">
1314
+ <p>
1315
+ <?php echo __('Subscribe By Email is a service that allows listeners to subscribe to their favorite podcasts by email.', 'powerpress'); ?>
1316
+ </p>
1317
+ <p><a href="http://subscribebyemail.com/podcasters/" target="_blank"><?php echo __('Learn more about Subscribe by Email', 'powerpress'); ?></a></p>
1318
+ <p><?php echo __('Note: Subscribe by Email does not replace newsletters or mailing lists. It is only for podcast syndication.', 'powerpress'); ?>
1319
+ </p>
1320
+ </div>
1321
+
1322
+ <p><input type="hidden" name="General[subscribe_feature_gp]" value="0" /><input type="checkbox" id="subscribe_feature_gp" name="General[subscribe_feature_gp]" value="1" <?php if( !empty($General['subscribe_feature_gp']) ) echo 'checked '; ?>/> <label for="subscribe_feature_gp"><?php echo __('Subscribe on Google Podcasts', 'powerpress'); ?></label> <?php echo powerpressadmin_new(); ?></p>
1323
+ <p><?php echo __('Note: Subscribe on Android includes Google Podcasts.', 'powerpress'); ?>
1324
+
1325
+ <p><input type="hidden" name="General[subscribe_feature_stitcher]" value="0" /><input type="checkbox" id="subscribe_feature_stitcher" name="General[subscribe_feature_stitcher]" value="1" <?php if( !empty($General['subscribe_feature_stitcher']) ) echo 'checked '; ?>/> <label for="subscribe_feature_stitcher"><?php echo __('Subscribe on Stitcher', 'powerpress'); ?></label></p>
1326
+
1327
+ <p><input type="hidden" name="General[subscribe_feature_tunein]" value="0" /><input type="checkbox" id="subscribe_feature_tunein" name="General[subscribe_feature_tunein]" value="1" <?php if( !empty($General['subscribe_feature_tunein']) ) echo 'checked '; ?>/> <label for="subscribe_feature_tunein"><?php echo __('Subscribe on TuneIn', 'powerpress'); ?></label></p>
1328
+
1329
+ <p><input type="hidden" name="General[subscribe_feature_spotify]" value="0" /><input type="checkbox" id="subscribe_feature_spotify" name="General[subscribe_feature_spotify]" value="1" <?php if( !empty($General['subscribe_feature_spotify']) ) echo 'checked '; ?>/> <label for="subscribe_feature_spotify"><?php echo __('Subscribe on Spotify', 'powerpress'); ?></label> <?php echo powerpressadmin_new(); ?></p>
1330
+
1331
+ </td>
1332
+ </tr>
1333
+ </table>
1334
+
1335
+ <?php powerpressadmin_settings_tab_appearance($General, $Feed, false); ?>
1336
+ <!-- end advanced features -->
1337
+ <?php } ?>
1338
+
1339
+
1340
+ <table class="form-table">
1341
+ <tr valign="top">
1342
+ <th scope="row" style="background-image: url(../wp-includes/images/smilies/icon_exclaim.gif); background-position: 10px 10px; background-repeat: no-repeat; ">
1343
+
1344
+ <div style="margin-left: 24px;"><?php echo __('Having Issues?', 'powerpress'); ?></div></th>
1345
+ <td>
1346
+ <select name="General[player_aggressive]" class="bpp_input_med">
1347
+ <?php
1348
+ $linkoptions = array(0=>__('No, everything is working', 'powerpress'),
1349
+ 1=>__('Yes, please try to fix', 'powerpress'),
1350
+ 2=>__('Yes, alternative fix', 'powerpress'),
1351
+ 3=>__('Yes, excluding excerpts', 'powerpress'),
1352
+ 4=>__('Yes, wp_head check', 'powerpress') );
1353
+
1354
+ foreach( $linkoptions as $value => $desc )
1355
+ echo "\t<option value=\"$value\"". ($General['player_aggressive']==$value?' selected':''). ">$desc</option>\n";
1356
+
1357
+ ?>
1358
+ </select> <a href="http://create.blubrry.com/resources/powerpress/powerpress-settings/media-appearance/resolving-plugin-theme-conflict-issues/" target="_blank"><?php echo __('Learn More', 'powerpress'); ?></a>
1359
+ <p style="margin-top: 5px;">
1360
+ <?php echo __('Use this option if you are having problems with the players not appearing on some or all of your pages.', 'powerpress'); ?>
1361
+ </p>
1362
+ <?php if( !empty($General['advanced_mode_2']) ) { ?>
1363
+ <p style="margin-top: 20px; margin-bottom:0;">
1364
+ <?php echo __('If the above option fixes the player issues, then you most likely have a conflicting theme or plugin activated. You can verify your theme is not causing the problem by testing your site using the latest default WordPress theme (twentyfourteen). For plugins, disable them one by one until the player re-appears, which indicates the last plugin deactivated caused the conflict.', 'powerpress'); ?>
1365
+ </p>
1366
+ <?php } ?>
1367
+ </td>
1368
+ </tr>
1369
+ </table>
1370
+
1371
+ <?php if( !empty($General['advanced_mode_2']) ) { ?>
1372
+ <!-- start advanced features -->
1373
+ <div id="new_window_settings" style="display: <?php echo ( $General['player_function']==1 || $General['player_function']==3 ?'block':'none'); ?>">
1374
+ <h3><?php echo __('Play in New Window Settings', 'powerpress'); ?></h3>
1375
+ <table class="form-table">
1376
+
1377
+ <tr valign="top">
1378
+ <th scope="row">
1379
+ <?php echo __('New Window Width', 'powerpress'); ?>
1380
+ </th>
1381
+ <td>
1382
+ <input type="text" name="General[new_window_width]" style="width: 50px;" onkeyup="javascript:this.value=this.value.replace(/[^0-9]/g, '');" value="<?php echo esc_attr($General['new_window_width']); ?>" maxlength="4" />
1383
+ <?php echo __('Width of new window (leave blank for 420 default)', 'powerpress'); ?>
1384
+ </td>
1385
+ </tr>
1386
+
1387
+ <tr valign="top">
1388
+ <th scope="row">
1389
+ <?php echo __('New Window Height', 'powerpress'); ?>
1390
+ </th>
1391
+ <td>
1392
+ <input type="text" name="General[new_window_height]" style="width: 50px;" onkeyup="javascript:this.value=this.value.replace(/[^0-9]/g, '');" value="<?php echo esc_attr($General['new_window_height']); ?>" maxlength="4" />
1393
+ <?php echo __('Height of new window (leave blank for 240 default)', 'powerpress'); ?>
1394
+ </td>
1395
+ </tr>
1396
+
1397
+ <tr valign="top">
1398
+ <th scope="row">
1399
+ &nbsp;
1400
+ </th>
1401
+ <td>
1402
+
1403
+ <p style="margin: 8px 0 0 0;">
1404
+ <label><input type="checkbox" name="General[new_window_nofactor]" value="1" <?php if( !empty($General['new_window_nofactor']) ) echo 'checked'; ?> /> <?php echo __('Do not factor in scroll bars', 'powerpress'); ?></label>
1405
+ </p>
1406
+ <div style="margin: 0 0 0 20px;"><?php echo __('By default, PowerPress adds to the width and height above to compensate for possible vertical and horizontal scroll bars. Check this option if you do not want PowerPress to compensate for browser scroll bars.', 'powerpress'); ?></div>
1407
+ </td>
1408
+
1409
+ </table>
1410
+ </div><!-- end new_window_settings -->
1411
+
1412
+ </div><!-- end presentation_settings in advanced mode -->
1413
+ <!-- end presentation settings -->
1414
+ <!-- end advanced features -->
1415
+ <?php } ?>
1416
+ <?php
1417
+ } // End powerpress_admin_appearance()
1418
+
1419
+
1420
+ function powerpressadmin_welcome($GeneralSettings)
1421
+ {
1422
+ ?>
1423
+ <div>
1424
+ <div class="powerpress-welcome-news">
1425
+ <h2><?php echo __('Blubrry PowerPress and Community Podcast', 'powerpress'); ?></h2>
1426
+ <?php powerpressadmin_community_news(); ?>
1427
+ <p style="margin-bottom: 0; font-size: 85%;">
1428
+ <input type="checkbox" name="General[disable_dashboard_news]" value="1" <?php echo (empty($GeneralSettings['disable_dashboard_news'])?'':'checked'); ?> /> <?php echo __('Remove from dashboard', 'powerpress'); ?>
1429
+ </p>
1430
+ </div>
1431
+ <div class="powerpress-welcome-highlighted">
1432
+ <div>
1433
+ <h2><?php echo __('Highlighted Topics', 'powerpress'); ?></h2>
1434
+ <?php powerpressadmin_community_highlighted(); ?>
1435
+ </div>
1436
+ </div>
1437
+ <div class="clear"></div>
1438
+ </div>
1439
+ <?php
1440
+ } // End powerpressadmin_welcome()
1441
+
1442
+ function powerpressadmin_edit_funding($FeedSettings = false, $feed_slug='podcast', $cat_ID=false)
1443
+ {
1444
+ if( !isset($FeedSettings['donate_link']) )
1445
+ $FeedSettings['donate_link'] = 0;
1446
+ if( !isset($FeedSettings['donate_url']) )
1447
+ $FeedSettings['donate_url'] = '';
1448
+ if( !isset($FeedSettings['donate_label']) )
1449
+ $FeedSettings['donate_label'] = '';
1450
+ ?>
1451
+ <!-- Donate link and label -->
1452
+ <table class="form-table">
1453
+ <tr valign="top">
1454
+ <th scope="row">
1455
+ <?php echo __('Donate Link', 'powerpress'); ?> </th>
1456
+ <td>
1457
+ <p style="padding-top: 8px;"><label for="donate_link"><input type="checkbox" id="donate_link" name="Feed[donate_link]" value="1" <?php if( $FeedSettings['donate_link'] == 1 ) echo 'checked '; ?>/>
1458
+ <?php echo __('Syndicate a donate link with your podcast. Create your own croudfunding page with PayPal donate buttons, or link to a service such as Patreon.', 'powerpress'); ?></label></p>
1459
+ <ul>
1460
+ <li><label for="donate_url" style="width: 100px; display:inline-block; text-align: right;">Donate URL:</label> <input type="text" id="donate_url" value="<?php echo esc_attr($FeedSettings['donate_url']); ?>" name="Feed[donate_url]" style="width:50%; max-width: 300px;" />
1461
+ </li>
1462
+ <li><label for="donate_label" style="width: 100px; display:inline-block; text-align: right;">Donate label:</label> <input type="text" id="donate_label" value="<?php echo esc_attr($FeedSettings['donate_label']); ?>" name="Feed[donate_label]" style="width: 50%; max-width: 300px;" />
1463
+ <?php echo __('(optional)', 'powerpress'); ?>
1464
+ </li>
1465
+ </ul>
1466
+ <p><a href="http://create.blubrry.com/resources/powerpress/advanced-tools-and-options/syndicating-a-donate-link-in-your-podcast/" target="_blank"><?php echo __('Learn more about syndicating donate links for podcasting', 'powerpress'); ?></a></p>
1467
+ </td>
1468
+ </tr>
1469
+ </table>
1470
+ <?php
1471
+ }
1472
+
1473
+ function powerpressadmin_edit_tv($FeedSettings = false, $feed_slug='podcast', $cat_ID=false)
1474
+ {
1475
+ if( !isset($FeedSettings['parental_rating']) )
1476
+ $FeedSettings['parental_rating'] = '';
1477
+
1478
+ ?>
1479
+ <h3><?php echo __('T.V. Settings', 'powerpress'); ?></h3>
1480
+ <table class="form-table">
1481
+ <tr valign="top">
1482
+ <th scope="row">
1483
+ <?php echo __('Parental Rating', 'powerpress'); ?> </th>
1484
+ <td>
1485
+ <p><?php echo sprintf(__('A parental rating is used to display your content on %s applications available on Internet connected TV\'s. The TV Parental Rating applies to both audio and video media.', 'powerpress'), '<strong><a href="http://www.blubrry.com/roku_blubrry/" target="_blank">Blubrry</a></strong>'); ?></p>
1486
+ <?php
1487
+ $Ratings = array(''=>__('No rating specified', 'powerpress'),
1488
+ 'TV-Y'=>__('Children of all ages', 'powerpress'),
1489
+ 'TV-Y7'=>__('Children 7 years and older', 'powerpress'),
1490
+ 'TV-Y7-FV'=>__('Children 7 years and older [fantasy violence]', 'powerpress'),
1491
+ 'TV-G'=>__('General audience', 'powerpress'),
1492
+ 'TV-PG'=>__('Parental guidance suggested', 'powerpress'),
1493
+ 'TV-14'=>__('May be unsuitable for children under 14 years of age', 'powerpress'),
1494
+ 'TV-MA'=>__('Mature audience - may be unsuitable for children under 17', 'powerpress')
1495
+ );
1496
+ $RatingsTips = array(''=>'',
1497
+ 'TV-Y'=>__('Whether animated or live-action, the themes and elements in this program are specifically designed for a very young audience, including children from ages 2-6. These programs are not expected to frighten younger children. Examples of programs issued this rating include Sesame Street, Barney & Friends, Dora the Explorer, Go, Diego, Go! and The Backyardigans.', 'powerpress'),
1498
+ 'TV-Y7'=>__('These shows may or may not be appropriate for some children under the age of 7. This rating may include crude, suggestive humor, mild fantasy violence, or content considered too scary or controversial to be shown to children under seven. Examples include Foster\'s Home for Imaginary Friends, Johnny Test, and SpongeBob SquarePants.', 'powerpress'),
1499
+ 'TV-Y7-FV'=>__('When a show has noticeably more fantasy violence, it is assigned the TV-Y7-FV rating. Action-adventure shows such Pokemon series and the Power Rangers series are assigned a TV-Y7-FV rating.', 'powerpress'),
1500
+ 'TV-G'=>__('Although this rating does not signify a program designed specifically for children, most parents may let younger children watch this program unattended. It contains little or no violence, no strong language and little or no sexual dialogue or situation. Networks that air informational, how-to content, or generally inoffensive content.', 'powerpress'),
1501
+ 'TV-PG'=>__('This rating signifies that the program may be unsuitable for younger children without the guidance of a parent. Many parents may want to watch it with their younger children. Various game shows and most reality shows are rated TV-PG for their suggestive dialog, suggestive humor, and/or coarse language. Some prime-time sitcoms such as Everybody Loves Raymond, Fresh Prince of Bel-Air, The Simpsons, Futurama, and Seinfeld usually air with a TV-PG rating.', 'powerpress'),
1502
+ 'TV-14'=>__('Parents are strongly urged to exercise greater care in monitoring this program and are cautioned against letting children of any age watch unattended. This rating may be accompanied by any of the following sub-ratings:', 'powerpress'),
1503
+ 'TV-MA'=>__('A TV-MA rating means the program may be unsuitable for those below 17. The program may contain extreme graphic violence, strong profanity, overtly sexual dialogue, very coarse language, nudity and/or strong sexual content. The Sopranos is a popular example.', 'powerpress')
1504
+ );
1505
+
1506
+
1507
+ foreach( $Ratings as $rating => $title )
1508
+ {
1509
+ $tip = $RatingsTips[ $rating ];
1510
+ ?>
1511
+ <div style="margin-bottom: 10px;"><label><input type="radio" name="Feed[parental_rating]" value="<?php echo $rating; ?>" <?php if( $FeedSettings['parental_rating'] == $rating) echo 'checked'; ?> /> <?php if( $rating ) { ?><strong><?php echo $rating; ?></strong><?php } else { ?><strong><?php echo htmlspecialchars($title); ?></strong><?php } ?></label>
1512
+ <?php if( $rating ) { ?> <span style="margin-left: 8px;"><a href="#" class="powerpress-parental-rating-tip" id="rating_tip_<?php echo $rating; ?>"><?php echo htmlspecialchars($title); ?></a></span><?php } ?>
1513
+ <p style="margin: 5px 50px; display: none;" id="rating_tip_<?php echo $rating; ?>_p" class="powerpress-parental-rating-tip-p"><?php echo htmlspecialchars($tip); ?></p>
1514
+ </div>
1515
+ <?php
1516
+ }
1517
+ ?>
1518
+ </td>
1519
+ </tr>
1520
+ </table>
1521
+ <?php
1522
+ }
1523
+
1524
+ function powerpressadmin_edit_artwork($FeedSettings, $General)
1525
+ {
1526
+ $SupportUploads = powerpressadmin_support_uploads();
1527
+ ?>
1528
+ <h3><?php echo __('Artwork and Images', 'powerpress'); ?></h3>
1529
+
1530
+ <table class="form-table">
1531
+ <tr valign="top">
1532
+ <th scope="row">
1533
+ <?php echo __('iTunes Image', 'powerpress'); ?>
1534
+ <span class="powerpress-required"><?php echo __('Required', 'powerpress'); ?></span>
1535
+ <?php echo powerpressadmin_updated( __('recommended size changed February, 2016', 'powerpress') ); ?>
1536
+ </th>
1537
+ <td>
1538
+ <input type="text" id="itunes_image" name="Feed[itunes_image]" style="width: 60%; margin-top: 10px;" value="<?php echo esc_attr( !empty($FeedSettings['itunes_image'])? $FeedSettings['itunes_image']:''); ?>" maxlength="255" />
1539
+ <a href="#" onclick="javascript: window.open( document.getElementById('itunes_image').value ); return false;"><?php echo __('preview', 'powerpress'); ?></a>
1540
+
1541
+ <p><?php echo __('iTunes image must be at least 1400 x 1400 pixels in .jpg or .png format. iTunes image must not exceed 3000 x 3000 pixels and must use RGB color space.', 'powerpress'); ?> <?php echo __('Example', 'powerpress'); ?>: http://example.com/images/itunes.jpg
1542
+ </p>
1543
+
1544
+ <p><strong><?php echo __('A square 3000 x 3000 pixel image in .jpg format is recommended.', 'powerpress'); ?></strong></p>
1545
+
1546
+ <p>
1547
+ <?php echo __('This image is for your listing on the Apple podcasts directory and may also be used by other directories like Blubrry. It is not the artwork that is displayed during episode playback. That artwork needs to be saved into the media file in the form of tags (ID3 tags for mp3) following the production of the media file.', 'powerpress'); ?>
1548
+ </p>
1549
+
1550
+ <p class="description"><?php echo __('Note: If you change the iTunes image without changing the file name it may take some time (days or even months) for iTunes to update the image in the iTunes Podcast Directory.', 'powerpress'); ?>
1551
+ <?php echo sprintf( __('Please contact %s if you are having issues with your image changes not appearing in iTunes.', 'powerpress'), '<a href="https://create.blubrry.com/manual/podcast-promotion/submit-podcast-to-itunes/itunes-support/">'. __('Apple Podcasts Support', 'powerpress') .'</a>'); ?></p>
1552
+ <?php if( $SupportUploads ) { ?>
1553
+
1554
+ <p><label class="powerpress-normal-font"><input name="itunes_image_checkbox" type="checkbox" onchange="powerpress_show_field('itunes_image_upload', this.checked)" value="1" /> <?php echo __('Upload new image', 'powerpress'); ?></label> &nbsp;
1555
+ <span style="font-size:85%;">(<?php echo __('Using this option should update your image on iTunes within 24 hours', 'powerpress'); ?>)</span>
1556
+ </p>
1557
+ <div style="display:none" id="itunes_image_upload">
1558
+ <label for="itunes_image_file"><?php echo __('Choose file', 'powerpress'); ?>:</label><input type="file" id="itunes_image_file" name="itunes_image_file" /><br />
1559
+ <?php if( !empty($General['advanced_mode_2']) ) { ?>
1560
+ <div style="margin-left: 85px;"><label class="powerpress-normal-font"><input name="itunes_image_checkbox_as_rss" type="checkbox" value="1" onchange="powerpress_show_field('rss_image_upload_container', !this.checked)" /> <?php echo __('Also use as RSS image', 'powerpress'); ?></label></div>
1561
+ <?php } else { ?>
1562
+ <input type="hidden" name="itunes_image_checkbox_as_rss" value="1" />
1563
+ <?php } ?>
1564
+ </div>
1565
+ <?php } ?>
1566
+ </td>
1567
+ </tr>
1568
+ </table>
1569
+
1570
+
1571
+ <?php if( !empty($General['advanced_mode_2']) ) { ?>
1572
+ <table class="form-table">
1573
+ <tr valign="top">
1574
+ <th scope="row">
1575
+ <?php echo __('iTunes Episode Image', 'powerpress'); ?></th>
1576
+ <td>
1577
+
1578
+ <p style="padding-top: 10px;"><label><input type="checkbox" name="Feed[episode_itunes_image]" value="1" <?php if( !empty($FeedSettings['episode_itunes_image']) ) echo 'checked '; ?>/> <?php echo __('Use iTunes image above', 'powerpress'); ?></label></p>
1579
+ <p><?php echo __('Use the program iTunes image above as your iTunes episode image.', 'powerpress'); ?></p>
1580
+ <p class="description"><?php echo __('NOTE: You must still save artwork into your media files to guarantee your artwork is displayed during playback.', 'powerpress'); ?></p>
1581
+ </td>
1582
+ </tr>
1583
+
1584
+ <table class="form-table">
1585
+ <tr valign="top">
1586
+ <th scope="row">
1587
+ <?php echo __('Google Play Image', 'powerpress'); ?>
1588
+ </th>
1589
+ <td>
1590
+ <input type="text" id="googleplay_image" name="Feed[googleplay_image]" style="width: 60%; margin-top: 10px;" value="<?php echo esc_attr( !empty($FeedSettings['googleplay_image'])? $FeedSettings['googleplay_image']:''); ?>" maxlength="255" />
1591
+ <a href="#" onclick="javascript: window.open( document.getElementById('googleplay_image').value ); return false;"><?php echo __('preview', 'powerpress'); ?></a>
1592
+
1593
+ <p><?php echo __('Google Play image must be at least 1200 x 1200 pixels in .jpg or .png format to be eligible for featuring. Image must not exceed 7000 x 7000 pixels.', 'powerpress'); ?> <?php echo __('Example', 'powerpress'); ?>: http://example.com/images/googleplay.jpg
1594
+ </p>
1595
+
1596
+ <p><strong><?php echo __('Leave this setting blank to use the iTunes image (recommended).', 'powerpress'); ?></strong></p>
1597
+
1598
+ <?php if( $SupportUploads ) { ?>
1599
+
1600
+ <p><label class="powerpress-normal-font"><input name="googleplay_image_checkbox" type="checkbox" onchange="powerpress_show_field('googleplay_image_upload', this.checked)" value="1" /> <?php echo __('Upload new image', 'powerpress'); ?></label> &nbsp;
1601
+ <span style="font-size:85%;">(<?php echo __('Using this option should update your image on Google Play Music within 24 hours', 'powerpress'); ?>)</span>
1602
+ </p>
1603
+ <div style="display:none" id="googleplay_image_upload">
1604
+ <label for="googleplay_image_file"><?php echo __('Choose file', 'powerpress'); ?>:</label><input type="file" id="googleplay_image_file" name="googleplay_image_file" /><br />
1605
+ </div>
1606
+ <?php } ?>
1607
+ </td>
1608
+ </tr>
1609
+
1610
+ <tr valign="top">
1611
+ <th scope="row">
1612
+ <?php echo __('RSS2 Image', 'powerpress'); ?> <br />
1613
+ <span style="font-size: 85%; margin-left: 5px;"><?php echo __('Recommendation: Use iTunes image', 'powerpress'); ?></span>
1614
+ </th>
1615
+ <td>
1616
+ <input type="text" id="rss2_image" name="Feed[rss2_image]" style="width: 60%; margin-top: 10px;" value="<?php echo esc_attr( !empty($FeedSettings['rss2_image'])? $FeedSettings['rss2_image']:''); ?>" maxlength="255" />
1617
+ <a href="#" onclick="javascript: window.open( document.getElementById('rss2_image').value ); return false;"><?php echo __('preview', 'powerpress'); ?></a>
1618
+
1619
+ <p><?php echo __('Place the URL to the RSS image above.', 'powerpress'); ?> <?php echo __('Example', 'powerpress'); ?> http://mysite.com/images/rss.jpg</p>
1620
+
1621
+ <!--
1622
+ <p><?php echo __('RSS image should be at least 88 pixels wide and at least 31 pixels high in either .gif, .jpg and .png format.', 'powerpress'); ?></p>
1623
+ <p><strong><?php echo __('A square image that is 300 x 300 pixel or larger in .jpg format is recommended.', 'powerpress'); ?></strong></p>
1624
+ -->
1625
+
1626
+ <?php if( $SupportUploads ) { ?>
1627
+ <div id="rss_image_upload_container">
1628
+ <p><input name="rss2_image_checkbox" type="checkbox" onchange="powerpress_show_field('rss_image_upload', this.checked)" value="1" /> <?php echo __('Upload new image', 'powerpress'); ?></p>
1629
+ <div style="display:none" id="rss_image_upload">
1630
+ <label for="rss2_image"><?php echo __('Choose file', 'powerpress'); ?>:</label><input type="file" name="rss2_image_file" />
1631
+ </div>
1632
+ </div>
1633
+ <?php } ?>
1634
+ </td>
1635
+ </tr>
1636
+ </table>
1637
+ <?php
1638
+ }
1639
+ }
1640
+
1641
+
1642
+ function powerpressadmin_edit_destinations($FeedSettings, $General, $FeedAttribs)
1643
+ {
1644
+ require_once( dirname(__FILE__).'/views/settings_tab_destinations.php' );
1645
+ }
1646
+
powerpressadmin-dashboard.php CHANGED
@@ -1,452 +1,455 @@
1
- <?php
2
-
3
- if( !function_exists('add_action') )
4
- die("access denied.");
5
-
6
- define('POWERPRESS_FEED_HIGHLIGHTED', 'http://www.powerpresspodcast.com/category/highlighted/feed/?order=ASC');
7
- define('POWERPRESS_FEED_NEWS', 'http://www.powerpresspodcast.com/feed/');
8
-
9
- function powerpress_get_news($feed_url, $limit=10)
10
- {
11
- include_once(ABSPATH . WPINC . '/feed.php');
12
- $rss = fetch_feed( $feed_url );
13
-
14
- // If feed doesn't work...
15
- if ( is_wp_error($rss) )
16
- {
17
- require_once( ABSPATH . WPINC . '/class-feed.php' );
18
- // Try fetching the feed using CURL directly...
19
- $content = powerpress_remote_fopen($feed_url, false, array(), 3, false, true);
20
- if( !$content ) {
21
- return false;
22
- }
23
- // Load the content in a fetch_feed object...
24
- $rss = new SimplePie();
25
-
26
- $rss->set_sanitize_class( 'WP_SimplePie_Sanitize_KSES' );
27
- // We must manually overwrite $feed->sanitize because SimplePie's
28
- // constructor sets it before we have a chance to set the sanitization class
29
- $rss->sanitize = new WP_SimplePie_Sanitize_KSES();
30
-
31
- $rss->set_cache_class( 'WP_Feed_Cache' );
32
- $rss->set_file_class( 'WP_SimplePie_File' );
33
- $rss->set_raw_data($content);
34
- $rss->set_cache_duration( apply_filters( 'wp_feed_cache_transient_lifetime', 12 * HOUR_IN_SECONDS, $feed_url ) );
35
- do_action_ref_array( 'wp_feed_options', array( &$rss, $feed_url ) );
36
- $rss->init();
37
- $rss->set_output_encoding( get_option( 'blog_charset' ) );
38
- $rss->handle_content_type();
39
-
40
- if ( $rss->error() )
41
- return false;
42
- }
43
-
44
- $rss_items = $rss->get_items( 0, $rss->get_item_quantity( $limit ) );
45
-
46
- // If the feed was erroneously
47
- if ( !$rss_items ) {
48
- $md5 = md5( $feed_url ); // This is from simple-pie, look at member variable ->cache_name_function
49
- delete_transient( 'feed_' . $md5 );
50
- delete_transient( 'feed_mod_' . $md5 );
51
- $rss->__destruct();
52
- unset($rss);
53
- $rss = fetch_feed( $feed_url );
54
- $rss_items = $rss->get_items( 0, $rss->get_item_quantity( $num ) );
55
- $rss->__destruct();
56
- unset($rss);
57
- }
58
-
59
- return $rss_items;
60
- }
61
-
62
-
63
- function powerpress_dashboard_head()
64
- {
65
- echo "<script type=\"text/javascript\" src=\"". powerpress_get_root_url() ."player.min.js\"></script>\n";
66
- ?>
67
- <style type="text/css">
68
- #blubrry_stats_summary {
69
-
70
- }
71
- #blubrry_stats_summary label {
72
- width: 40%;
73
- max-width: 150px;
74
- float: left;
75
- }
76
- #blubrry_stats_summary h2 {
77
- font-size: 14px;
78
- margin: 0;
79
- padding: 0;
80
- }
81
- .blubrry_stats_ul {
82
- padding-left: 20px;
83
- margin-top: 5px;
84
- margin-bottom: 10px;
85
- }
86
- .blubrry_stats_ul li {
87
- list-style-type: none;
88
- margin: 0px;
89
- padding: 0px;
90
- }
91
- #blubrry_stats_media {
92
- display: none;
93
- }
94
- #blubrry_stats_media_show {
95
- text-align: right;
96
- font-size: 85%;
97
- }
98
- #blubrry_stats_media h4 {
99
- margin-bottom: 10px;
100
- }
101
- .blubrry_stats_title {
102
- margin-left: 10px;
103
- }
104
- .blubrry_stats_updated {
105
- font-size: 80%;
106
- }
107
- .powerpress-news-dashboard {
108
- /* background-image:url(http://images.blubrry.com/powerpress/blubrry_logo.png);
109
- background-repeat: no-repeat;
110
- background-position: top right; */
111
- }
112
- .powerpress-news-dashboard .powerpressNewsPlayer {
113
- margin-top: 5px;
114
- }
115
- </style>
116
- <script type="text/javascript"><!--
117
- jQuery(document).ready(function($) {
118
- jQuery('.powerpress-dashboard-notice').click( function(e) {
119
- e.preventDefault();
120
- var dash_id = jQuery(this).parents('.postbox').attr('id');
121
- jQuery( '#' + dash_id + '-hide' ).prop('checked', false).triggerHandler('click');
122
-
123
- jQuery.ajax( {
124
- type: 'POST',
125
- url: '<?php echo admin_url(); ?>admin-ajax.php',
126
- data: { action: 'powerpress_dashboard_dismiss', dismiss_dash_id : dash_id },
127
- success: function(response) {
128
- }
129
- });
130
- });
131
- });
132
- // --></script>
133
- <?php
134
- }
135
-
136
- function powerpress_dashboard_stats_content()
137
- {
138
- $Settings = get_option('powerpress_general');
139
-
140
- if( !empty($Settings['disable_dashboard_stats']) )
141
- return; // Lets not do anythign to the dashboard for PowerPress Statistics
142
-
143
- // If using user capabilities...
144
- if( !empty($Settings['use_caps']) && !current_user_can('view_podcast_stats') )
145
- return;
146
-
147
- $content = '';
148
- $UserPass = ( !empty($Settings['blubrry_auth']) ? $Settings['blubrry_auth']:'');
149
- $Keyword = ( !empty($Settings['blubrry_program_keyword']) ? $Settings['blubrry_program_keyword']:'');
150
- $StatsCached = get_option('powerpress_stats');
151
- if( empty($StatsCached) )
152
- $StatsCached = array();
153
- if( !empty($StatsCached['content']) )
154
- $content = $StatsCached['content'];
155
- if( empty($StatsCached['updated']) )
156
- $StatsCached['updated'] = 1; // Some time
157
-
158
- // If no content or it's been over 3 hours...
159
- if( $UserPass && time() > ($StatsCached['updated']+(60*60*3)) )
160
- {
161
- $success = false;
162
- $api_url_array = powerpress_get_api_array();
163
- foreach( $api_url_array as $index=> $api_url )
164
- {
165
- $req_url = sprintf('%s/stats/%s/summary.html?nobody=1', rtrim($api_url, '/'), $Keyword);
166
- $req_url .= (defined('POWERPRESS_BLUBRRY_API_QSA')?'&'. POWERPRESS_BLUBRRY_API_QSA:'');
167
-
168
- $new_content = powerpress_remote_fopen($req_url, $UserPass, array(), 2); // Only give this 2 seconds to return results
169
- if( !$new_content && $api_url == 'https://api.blubrry.com/' ) { // Lets force cURL and see if that helps...
170
- $new_content = powerpress_remote_fopen($req_url, $UserPass, array(), 2, false, true); // Only give this 2 seconds to return results
171
- }
172
-
173
- if( $new_content )
174
- {
175
- update_option('powerpress_stats', array('updated'=>time(), 'content'=>$new_content) );
176
- $content = $new_content;
177
- $success = true;
178
- break;
179
- }
180
- }
181
-
182
- if( $success == false )
183
- {
184
- if( empty($StatsCached['retry_count']) )
185
- $StatsCached['retry_count'] = 1;
186
- else if( $StatsCached['retry_count'] < 24 )
187
- $StatsCached['retry_count']++;
188
-
189
- if( $StatsCached['retry_count'] > 12 ) // After 36 hours, if we keep failing to authenticate then lets clear the data and display the authentication notice.
190
- {
191
- $content = '';
192
- }
193
- // Update the updated flag so it will not try again for 3 hours...
194
- update_option('powerpress_stats', array('updated'=>time(), 'content'=>$content, 'retry_count'=>$StatsCached['retry_count'] ) );
195
- }
196
- }
197
-
198
- if( !$UserPass )
199
- {
200
- $content = sprintf('<p>'. __('Wait a sec! This feature is only available to Blubrry Podcast Community members. Join our community to get %s and access to other valuable %s.', 'powerpress') .'</p>',
201
- '<a href="http://create.blubrry.com/resources/podcast-media-download-statistics/basic-statistics/" target="_blank">'. __('Free Podcast Statistics') . '</a>',
202
- '<a href="http://create.blubrry.com/resources/" target="_blank">'. __('Services', 'powerpress') . '</a>' );
203
- $content .= ' ';
204
- $content .= sprintf('<p>'. __('Our %s integrated PowerPress makes podcast publishing simple. Check out the %s on our exciting three-step publishing system!', 'powerpress') .'</p>',
205
- '<a href="http://create.blubrry.com/resources/podcast-media-hosting/" target="_blank">'. __('Podcast Hosting', 'powerpress') .'</a>',
206
- '<a href="http://create.blubrry.com/resources/powerpress/using-powerpress/blubrry-hosting-with-powerpress/" target="_blank">'. __('Video', 'powerpress') .'</a>' );
207
- }
208
- else if( empty($content) )
209
- {
210
- $content = sprintf(__('Error: A network or authentication error occurred. To verify your account, click the link &quot;click here to configure Blubrry Statistics and Hosting services&quot; found in the %s tab.', 'powerpress'), '<a href="'. admin_url("admin.php?page=powerpressadmin_basic") .'#tab2">'.__('Services &amp; Statistics'.'</a>', 'powerpress') );
211
- }
212
-
213
- ?>
214
- <div>
215
- <?php
216
- echo $content;
217
-
218
- if( $UserPass )
219
- {
220
- ?>
221
- <div id="blubrry_stats_media_show">
222
- <a href="<?php echo admin_url('admin.php'); ?>?action=powerpress-jquery-stats&amp;KeepThis=true&amp;TB_iframe=true&amp;modal=false" title="<?php echo __('Blubrry Media statistics', 'powerpress'); ?>" class="thickbox"><?php echo __('more', 'powerpress'); ?></a>
223
- </div>
224
- <?php } ?>
225
- </div>
226
- <?php
227
- }
228
-
229
-
230
- function powerpress_dashboard_news_content()
231
- {
232
- $Settings = get_option('powerpress_general');
233
-
234
- if( isset($Settings['disable_dashboard_news']) && $Settings['disable_dashboard_news'] == 1 )
235
- return; // Lets not do anything to the dashboard for PowerPress News
236
-
237
- powerpressadmin_community_news();
238
- }
239
-
240
- function powerpress_dashboard_notice_1_content()
241
- {
242
- $DismissedNotices = get_option('powerpress_dismissed_notices');
243
-
244
- if( !empty($DismissedNotices[1]) )
245
- return; // Lets not do anything to the dashboard for PowerPress Notice
246
-
247
- $message = '<p>'. __('Apple iTunes podcast specifications for show artwork have changed! Your iTunes image should now be 1400 x 1400 in jpg format.', 'powerpress') .'</p>';
248
- $message .= '<p><a href="http://www.powerpresspodcast.com/2012/05/10/itunes-podcasting-specifications-changed-may-2012-what-that-means-for-podcasting/" target="_blank">'. __('Learn more about iTunes podcasting changes', 'powerpress') .'</a></p>';
249
-
250
- powerpress_dashboard_notice_message(1, $message );
251
- }
252
-
253
- function powerpress_dashboard_notice_2_content()
254
- {
255
- $DismissedNotices = get_option('powerpress_dismissed_notices');
256
-
257
- if( !empty($DismissedNotices[2]) )
258
- return; // Lets not do anything to the dashboard for PowerPress Notice
259
-
260
- $message = '<p>'. __('Due to concerns of possible security exploits, the 1 Pixel Out Audio Player has been removed from PowerPress.', 'powerpress') .'<br />';
261
- $message .= '<a href="http://blog.blubrry.com/?p=1163" target="_blank">'. __("Learn More", "powerpress") .'</a></p>';
262
-
263
- powerpress_dashboard_notice_message(2, $message );
264
- }
265
-
266
- function powerpress_dashboard_notice_message($notice_id, $message)
267
- {
268
- echo $message;
269
- // Add link to remove this notice.
270
- echo '<p><a href="#" id="powerpress_dashboard_notice_'. $notice_id .'_dismiss" class="powerpress-dashboard-notice">'. __('Dismiss', 'powerpress') .'</a></p>';
271
- }
272
-
273
-
274
- function powerpress_feed_text_limit( $text, $limit, $finish = '&hellip;') {
275
- if( strlen( $text ) > $limit ) {
276
- //$text = (function_exists('mb_substr')?mb_substr($text, 0, $limit):substr($text, 0, $limit) );
277
- $text = substr( $text, 0, $limit );
278
- $text = substr( $text, 0, - ( strlen( strrchr( $text,' ') ) ) );
279
- $text .= $finish;
280
- }
281
- return $text;
282
- }
283
-
284
- function powerpress_dashboard_setup()
285
- {
286
- if( !function_exists('wp_add_dashboard_widget') )
287
- return; // We are not in the dashboard!
288
-
289
- if( !empty($_GET['powerpressdash']) && $_GET['powerpressdash'] == 1 )
290
- return;
291
-
292
- $Settings = get_option('powerpress_general');
293
- $StatsDashboard = true;
294
- $NewsDashboard = true;
295
-
296
- if( !empty($Settings['disable_dashboard_stats']) )
297
- $StatsDashboard = false; // Lets not do anything to the dashboard for PowerPress Statistics
298
-
299
- if( !empty($Settings['disable_dashboard_news']) )
300
- $NewsDashboard = false; // Lets not do anything to the dashboard for PowerPress News
301
-
302
- if( !empty($Settings['use_caps']) && !current_user_can('view_podcast_stats') )
303
- $StatsDashboard = false;
304
-
305
- $user = wp_get_current_user();
306
-
307
- if( !empty($_GET['powerpressdash']) && $_GET['powerpressdash'] == 2 ) {
308
- return;
309
- }
310
-
311
- if( $NewsDashboard )
312
- wp_add_dashboard_widget( 'powerpress_dashboard_news', __( 'Blubrry PowerPress & Community Podcast', 'powerpress'), 'powerpress_dashboard_news_content' );
313
-
314
- if( !empty($_GET['powerpressdash']) && $_GET['powerpressdash'] == 3 ) {
315
- return;
316
- }
317
-
318
- if( $StatsDashboard )
319
- wp_add_dashboard_widget( 'powerpress_dashboard_stats', __( 'Blubrry Podcast Statistics', 'powerpress'), 'powerpress_dashboard_stats_content' );
320
-
321
- if( !empty($_GET['powerpressdash']) && $_GET['powerpressdash'] == 4 ) {
322
- return;
323
- }
324
-
325
- if( !empty( $user ) ) {
326
- $user_options = get_user_option('powerpress_user');
327
- if( empty($user_options) || empty($user_options['dashboard_installed']) || $user_options['dashboard_installed'] < 2 )
328
- {
329
- if( !is_array($user_options) )
330
- $user_options = array();
331
-
332
- if( !empty($_GET['powerpressdash']) && $_GET['powerpressdash'] == 5 ) {
333
- return;
334
- }
335
-
336
- // First time we've seen this setting, so must be first time we've added the widgets, lets stack them at the top for convenience.
337
- powerpressadmin_add_dashboard_widgets($user->ID);
338
- $user_options['dashboard_installed'] = 2; // version of PowerPress
339
- update_user_option($user->ID, "powerpress_user", $user_options, true);
340
- }
341
- else
342
- {
343
- if( !empty($_GET['powerpressdash']) && $_GET['powerpressdash'] == 6 ) {
344
- return;
345
- }
346
-
347
- powerpressadmin_add_dashboard_widgets(false);
348
- }
349
- }
350
- }
351
-
352
- function powerpressadmin_add_dashboard_notice_widget($user_id, $notice_id)
353
- {
354
- $user_options = get_user_option('meta-box-order_dashboard', $user_id);
355
- if( $user_options )
356
- {
357
- $save = false;
358
- if( !preg_match('/powerpress_dashboard_notice_'.$notice_id.'/', $user_options['normal']) && !preg_match('/powerpress_dashboard_notice_'.$notice_id.'/', $user_options['side']) && !preg_match('/powerpress_dashboard_notice_'.$notice_id.'/', $user_options['column3']) && !preg_match('/powerpress_dashboard_notice_'.$notice_id.'/', $user_options['column4']) )
359
- {
360
- $save = true;
361
- $user_options['normal'] = 'powerpress_dashboard_notice_'.$notice_id.','.$user_options['normal'];
362
- }
363
-
364
- if( $save )
365
- {
366
- update_user_option($user_id, "meta-box-order_dashboard", $user_options, true);
367
- }
368
- }
369
- }
370
-
371
- function powerpressadmin_add_dashboard_widgets( $check_user_id = false)
372
- {
373
- // Only re-order the powerpress widgets if they aren't already on the dashboard:
374
- if( $check_user_id )
375
- {
376
- $user_options = get_user_option('meta-box-order_dashboard', $check_user_id);
377
- if( $user_options )
378
- {
379
- $save = false;
380
- if( !preg_match('/powerpress_dashboard_stats/', $user_options['normal']) && !preg_match('/powerpress_dashboard_stats/', $user_options['side']) && !preg_match('/powerpress_dashboard_stats/', $user_options['column3']) && !preg_match('/powerpress_dashboard_stats/', $user_options['column4']) )
381
- {
382
- $save = true;
383
- if( !empty($user_options['side']) )
384
- $user_options['side'] = 'powerpress_dashboard_stats,'.$user_options['side'];
385
- else
386
- $user_options['normal'] = 'powerpress_dashboard_stats,'.$user_options['normal'];
387
- }
388
-
389
- if( !preg_match('/powerpress_dashboard_news/', $user_options['normal']) && !preg_match('/powerpress_dashboard_news/', $user_options['side']) && !preg_match('/powerpress_dashboard_news/', $user_options['column3']) && !preg_match('/powerpress_dashboard_news/', $user_options['column4']) )
390
- {
391
- $save = true;
392
- $user_options['normal'] = 'powerpress_dashboard_news,'.$user_options['normal'];
393
- }
394
-
395
- if( $save )
396
- {
397
- update_user_option($check_user_id, "meta-box-order_dashboard", $user_options, true);
398
- }
399
- }
400
- }
401
-
402
- // Reorder for all future users
403
- global $wp_meta_boxes;
404
- $dashboard_current = $wp_meta_boxes['dashboard']['normal']['core'];
405
-
406
- $dashboard_powerpress = array();
407
- for( $i = 0; $i < 20; $i++ )
408
- {
409
- if( isset( $dashboard_current['powerpress_dashboard_notice_' . $i] ) )
410
- {
411
- $dashboard_powerpress['powerpress_dashboard_notice_' . $i] = $dashboard_current['powerpress_dashboard_notice_' . $i];
412
- unset($dashboard_current['powerpress_dashboard_notice_' . $i]);
413
- }
414
- }
415
-
416
- if( isset( $dashboard_current['powerpress_dashboard_news'] ) )
417
- {
418
- $dashboard_powerpress['powerpress_dashboard_news'] = $dashboard_current['powerpress_dashboard_news'];
419
- unset($dashboard_current['powerpress_dashboard_news']);
420
- }
421
-
422
- if( isset( $dashboard_current['powerpress_dashboard_stats'] ) )
423
- {
424
- $dashboard_powerpress['powerpress_dashboard_stats'] = $dashboard_current['powerpress_dashboard_stats'];
425
- unset($dashboard_current['powerpress_dashboard_stats']);
426
- }
427
-
428
- if( count($dashboard_powerpress) > 0 )
429
- {
430
- $wp_meta_boxes['dashboard']['normal']['core'] = array_merge($dashboard_powerpress, $dashboard_current);
431
- }
432
- }
433
-
434
- add_action('admin_head-index.php', 'powerpress_dashboard_head');
435
- add_action('wp_dashboard_setup', 'powerpress_dashboard_setup');
436
-
437
- function powerpress_dashboard_dismiss() // Called by AJAX call
438
- {
439
- $dismiss_dash_id = $_POST['dismiss_dash_id'];
440
- preg_match('/^powerpress_dashboard_notice_(.*)$/i', $dismiss_dash_id, $match );
441
- if( empty($match[1]) )
442
- exit;
443
- $DismissedNotices = get_option('powerpress_dismissed_notices');
444
- if( !is_array($DismissedNotices) )
445
- $DismissedNotices = array();
446
- $DismissedNotices[ $match[1] ] = 1;
447
- update_option('powerpress_dismissed_notices', $DismissedNotices);
448
- echo 'ok';
449
- exit;
450
- }
451
-
 
 
 
452
  ?>
1
+ <?php
2
+
3
+ if( !function_exists('add_action') )
4
+ die("access denied.");
5
+
6
+ define('POWERPRESS_FEED_HIGHLIGHTED', 'http://www.powerpresspodcast.com/category/highlighted/feed/?order=ASC');
7
+ define('POWERPRESS_FEED_NEWS', 'http://www.powerpresspodcast.com/feed/');
8
+
9
+ function powerpress_get_news($feed_url, $limit=10)
10
+ {
11
+ include_once(ABSPATH . WPINC . '/feed.php');
12
+ $rss = fetch_feed( $feed_url );
13
+
14
+ // If feed doesn't work...
15
+ if ( is_wp_error($rss) )
16
+ {
17
+ require_once( ABSPATH . WPINC . '/class-feed.php' );
18
+ // Try fetching the feed using CURL directly...
19
+ $content = powerpress_remote_fopen($feed_url, false, array(), 3, false, true);
20
+ if( !$content ) {
21
+ return false;
22
+ }
23
+ // Load the content in a fetch_feed object...
24
+ $rss = new SimplePie();
25
+
26
+ $rss->set_sanitize_class( 'WP_SimplePie_Sanitize_KSES' );
27
+ // We must manually overwrite $feed->sanitize because SimplePie's
28
+ // constructor sets it before we have a chance to set the sanitization class
29
+ $rss->sanitize = new WP_SimplePie_Sanitize_KSES();
30
+
31
+ $rss->set_cache_class( 'WP_Feed_Cache' );
32
+ $rss->set_file_class( 'WP_SimplePie_File' );
33
+ $rss->set_raw_data($content);
34
+ $rss->set_cache_duration( apply_filters( 'wp_feed_cache_transient_lifetime', 12 * HOUR_IN_SECONDS, $feed_url ) );
35
+ do_action_ref_array( 'wp_feed_options', array( &$rss, $feed_url ) );
36
+ $rss->init();
37
+ $rss->set_output_encoding( get_option( 'blog_charset' ) );
38
+ $rss->handle_content_type();
39
+
40
+ if ( $rss->error() )
41
+ return false;
42
+ }
43
+
44
+ $rss_items = $rss->get_items( 0, $rss->get_item_quantity( $limit ) );
45
+
46
+ // If the feed was erroneously
47
+ if ( !$rss_items ) {
48
+ $md5 = md5( $feed_url ); // This is from simple-pie, look at member variable ->cache_name_function
49
+ delete_transient( 'feed_' . $md5 );
50
+ delete_transient( 'feed_mod_' . $md5 );
51
+ $rss->__destruct();
52
+ unset($rss);
53
+ $rss = fetch_feed( $feed_url );
54
+ $rss_items = $rss->get_items( 0, $rss->get_item_quantity( $num ) );
55
+ $rss->__destruct();
56
+ unset($rss);
57
+ }
58
+
59
+ return $rss_items;
60
+ }
61
+
62
+
63
+ function powerpress_dashboard_head()
64
+ {
65
+ echo "<script type=\"text/javascript\" src=\"". powerpress_get_root_url() ."player.min.js\"></script>\n";
66
+ ?>
67
+ <style type="text/css">
68
+ #blubrry_stats_summary {
69
+
70
+ }
71
+ #blubrry_stats_summary label {
72
+ width: 40%;
73
+ max-width: 150px;
74
+ float: left;
75
+ }
76
+ #blubrry_stats_summary h2 {
77
+ font-size: 14px;
78
+ margin: 0;
79
+ padding: 0;
80
+ }
81
+ .blubrry_stats_ul {
82
+ padding-left: 20px;
83
+ margin-top: 5px;
84
+ margin-bottom: 10px;
85
+ }
86
+ .blubrry_stats_ul li {
87
+ list-style-type: none;
88
+ margin: 0px;
89
+ padding: 0px;
90
+ }
91
+ #blubrry_stats_media {
92
+ display: none;
93
+ }
94
+ #blubrry_stats_media_show {
95
+ text-align: right;
96
+ font-size: 85%;
97
+ }
98
+ #blubrry_stats_media h4 {
99
+ margin-bottom: 10px;
100
+ }
101
+ .blubrry_stats_title {
102
+ margin-left: 10px;
103
+ }
104
+ .blubrry_stats_updated {
105
+ font-size: 80%;
106
+ }
107
+ .powerpress-news-dashboard {
108
+ /* background-image:url(http://images.blubrry.com/powerpress/blubrry_logo.png);
109
+ background-repeat: no-repeat;
110
+ background-position: top right; */
111
+ }
112
+ .powerpress-news-dashboard .powerpressNewsPlayer {
113
+ margin-top: 5px;
114
+ }
115
+ </style>
116
+ <script type="text/javascript"><!--
117
+ jQuery(document).ready(function($) {
118
+ jQuery('.powerpress-dashboard-notice').click( function(e) {
119
+ e.preventDefault();
120
+ var dash_id = jQuery(this).parents('.postbox').attr('id');
121
+ jQuery( '#' + dash_id + '-hide' ).prop('checked', false).triggerHandler('click');
122
+
123
+ jQuery.ajax( {
124
+ type: 'POST',
125
+ url: '<?php echo admin_url(); ?>admin-ajax.php',
126
+ data: { action: 'powerpress_dashboard_dismiss', dismiss_dash_id : dash_id },
127
+ success: function(response) {
128
+ }
129
+ });
130
+ });
131
+ });
132
+ // --></script>
133
+ <?php
134
+ }
135
+
136
+ function powerpress_dashboard_stats_content()
137
+ {
138
+ $Settings = get_option('powerpress_general');
139
+
140
+ if( !empty($Settings['disable_dashboard_stats']) )
141
+ return; // Lets not do anythign to the dashboard for PowerPress Statistics
142
+
143
+ // If using user capabilities...
144
+ if( !empty($Settings['use_caps']) && !current_user_can('view_podcast_stats') )
145
+ return;
146
+
147
+ $content = '';
148
+ $UserPass = ( !empty($Settings['blubrry_auth']) ? $Settings['blubrry_auth']:'');
149
+ $Keyword = ( !empty($Settings['blubrry_program_keyword']) ? $Settings['blubrry_program_keyword']:'');
150
+ $StatsCached = get_option('powerpress_stats');
151
+ if( empty($StatsCached) )
152
+ $StatsCached = array();
153
+ if( !empty($StatsCached['content']) )
154
+ $content = $StatsCached['content'];
155
+ if( empty($StatsCached['updated']) )
156
+ $StatsCached['updated'] = 1; // Some time
157
+
158
+ // If no content or it's been over 3 hours...
159
+ if( !empty($Settings['network_mode']) ) {
160
+ $content = 'Network mode is enabled, please visit the <a href="https://stats.blubrry.com/" target="_blank">Blubrry.com</a> to see your statistics';
161
+ }
162
+ else if( $UserPass && time() > ($StatsCached['updated']+(60*60*3)) )
163
+ {
164
+ $success = false;
165
+ $api_url_array = powerpress_get_api_array();
166
+ foreach( $api_url_array as $index=> $api_url )
167
+ {
168
+ $req_url = sprintf('%s/stats/%s/summary.html?nobody=1', rtrim($api_url, '/'), $Keyword);
169
+ $req_url .= (defined('POWERPRESS_BLUBRRY_API_QSA')?'&'. POWERPRESS_BLUBRRY_API_QSA:'');
170
+
171
+ $new_content = powerpress_remote_fopen($req_url, $UserPass, array(), 2); // Only give this 2 seconds to return results
172
+ if( !$new_content && $api_url == 'https://api.blubrry.com/' ) { // Lets force cURL and see if that helps...
173
+ $new_content = powerpress_remote_fopen($req_url, $UserPass, array(), 2, false, true); // Only give this 2 seconds to return results
174
+ }
175
+
176
+ if( $new_content )
177
+ {
178
+ update_option('powerpress_stats', array('updated'=>time(), 'content'=>$new_content) );
179
+ $content = $new_content;
180
+ $success = true;
181
+ break;
182
+ }
183
+ }
184
+
185
+ if( $success == false )
186
+ {
187
+ if( empty($StatsCached['retry_count']) )
188
+ $StatsCached['retry_count'] = 1;
189
+ else if( $StatsCached['retry_count'] < 24 )
190
+ $StatsCached['retry_count']++;
191
+
192
+ if( $StatsCached['retry_count'] > 12 ) // After 36 hours, if we keep failing to authenticate then lets clear the data and display the authentication notice.
193
+ {
194
+ $content = '';
195
+ }
196
+ // Update the updated flag so it will not try again for 3 hours...
197
+ update_option('powerpress_stats', array('updated'=>time(), 'content'=>$content, 'retry_count'=>$StatsCached['retry_count'] ) );
198
+ }
199
+ }
200
+
201
+ if( !$UserPass )
202
+ {
203
+ $content = sprintf('<p>'. __('Wait a sec! This feature is only available to Blubrry Podcast Community members. Join our community to get %s and access to other valuable %s.', 'powerpress') .'</p>',
204
+ '<a href="http://create.blubrry.com/resources/podcast-media-download-statistics/basic-statistics/" target="_blank">'. __('Free Podcast Statistics') . '</a>',
205
+ '<a href="http://create.blubrry.com/resources/" target="_blank">'. __('Services', 'powerpress') . '</a>' );
206
+ $content .= ' ';
207
+ $content .= sprintf('<p>'. __('Our %s integrated PowerPress makes podcast publishing simple. Check out the %s on our exciting three-step publishing system!', 'powerpress') .'</p>',
208
+ '<a href="http://create.blubrry.com/resources/podcast-media-hosting/" target="_blank">'. __('Podcast Hosting', 'powerpress') .'</a>',
209
+ '<a href="http://create.blubrry.com/resources/powerpress/using-powerpress/blubrry-hosting-with-powerpress/" target="_blank">'. __('Video', 'powerpress') .'</a>' );
210
+ }
211
+ else if( empty($content) )
212
+ {
213
+ $content = sprintf(__('Error: A network or authentication error occurred. To verify your account, click the link &quot;click here to configure Blubrry Statistics and Hosting services&quot; found in the %s tab.', 'powerpress'), '<a href="'. admin_url("admin.php?page=powerpressadmin_basic") .'#tab2">'.__('Services &amp; Statistics'.'</a>', 'powerpress') );
214
+ }
215
+
216
+ ?>
217
+ <div>
218
+ <?php
219
+ echo $content;
220
+
221
+ if( $UserPass && empty($Settings['network_mode']) )
222
+ {
223
+ ?>
224
+ <div id="blubrry_stats_media_show">
225
+ <a href="<?php echo admin_url('admin.php'); ?>?action=powerpress-jquery-stats&amp;KeepThis=true&amp;TB_iframe=true&amp;modal=false" title="<?php echo __('Blubrry Media statistics', 'powerpress'); ?>" class="thickbox"><?php echo __('more', 'powerpress'); ?></a>
226
+ </div>
227
+ <?php } ?>
228
+ </div>
229
+ <?php
230
+ }
231
+
232
+
233
+ function powerpress_dashboard_news_content()
234
+ {
235
+ $Settings = get_option('powerpress_general');
236
+
237
+ if( isset($Settings['disable_dashboard_news']) && $Settings['disable_dashboard_news'] == 1 )
238
+ return; // Lets not do anything to the dashboard for PowerPress News
239
+
240
+ powerpressadmin_community_news();
241
+ }
242
+
243
+ function powerpress_dashboard_notice_1_content()
244
+ {
245
+ $DismissedNotices = get_option('powerpress_dismissed_notices');
246
+
247
+ if( !empty($DismissedNotices[1]) )
248
+ return; // Lets not do anything to the dashboard for PowerPress Notice
249
+
250
+ $message = '<p>'. __('Apple iTunes podcast specifications for show artwork have changed! Your iTunes image should now be 1400 x 1400 in jpg format.', 'powerpress') .'</p>';
251
+ $message .= '<p><a href="http://www.powerpresspodcast.com/2012/05/10/itunes-podcasting-specifications-changed-may-2012-what-that-means-for-podcasting/" target="_blank">'. __('Learn more about iTunes podcasting changes', 'powerpress') .'</a></p>';
252
+
253
+ powerpress_dashboard_notice_message(1, $message );
254
+ }
255
+
256
+ function powerpress_dashboard_notice_2_content()
257
+ {
258
+ $DismissedNotices = get_option('powerpress_dismissed_notices');
259
+
260
+ if( !empty($DismissedNotices[2]) )
261
+ return; // Lets not do anything to the dashboard for PowerPress Notice
262
+
263
+ $message = '<p>'. __('Due to concerns of possible security exploits, the 1 Pixel Out Audio Player has been removed from PowerPress.', 'powerpress') .'<br />';
264
+ $message .= '<a href="http://blog.blubrry.com/?p=1163" target="_blank">'. __("Learn More", "powerpress") .'</a></p>';
265
+
266
+ powerpress_dashboard_notice_message(2, $message );
267
+ }
268
+
269
+ function powerpress_dashboard_notice_message($notice_id, $message)
270
+ {
271
+ echo $message;
272
+ // Add link to remove this notice.
273
+ echo '<p><a href="#" id="powerpress_dashboard_notice_'. $notice_id .'_dismiss" class="powerpress-dashboard-notice">'. __('Dismiss', 'powerpress') .'</a></p>';
274
+ }
275
+
276
+
277
+ function powerpress_feed_text_limit( $text, $limit, $finish = '&hellip;') {
278
+ if( strlen( $text ) > $limit ) {
279
+ //$text = (function_exists('mb_substr')?mb_substr($text, 0, $limit):substr($text, 0, $limit) );
280
+ $text = substr( $text, 0, $limit );
281
+ $text = substr( $text, 0, - ( strlen( strrchr( $text,' ') ) ) );
282
+ $text .= $finish;
283
+ }
284
+ return $text;
285
+ }
286
+
287
+ function powerpress_dashboard_setup()
288
+ {
289
+ if( !function_exists('wp_add_dashboard_widget') )
290
+ return; // We are not in the dashboard!
291
+
292
+ if( !empty($_GET['powerpressdash']) && $_GET['powerpressdash'] == 1 )
293
+ return;
294
+
295
+ $Settings = get_option('powerpress_general');
296
+ $StatsDashboard = true;
297
+ $NewsDashboard = true;
298
+
299
+ if( !empty($Settings['disable_dashboard_stats']) )
300
+ $StatsDashboard = false; // Lets not do anything to the dashboard for PowerPress Statistics
301
+
302
+ if( !empty($Settings['disable_dashboard_news']) )
303
+ $NewsDashboard = false; // Lets not do anything to the dashboard for PowerPress News
304
+
305
+ if( !empty($Settings['use_caps']) && !current_user_can('view_podcast_stats') )
306
+ $StatsDashboard = false;
307
+
308
+ $user = wp_get_current_user();
309
+
310
+ if( !empty($_GET['powerpressdash']) && $_GET['powerpressdash'] == 2 ) {
311
+ return;
312
+ }
313
+
314
+ if( $NewsDashboard )
315
+ wp_add_dashboard_widget( 'powerpress_dashboard_news', __( 'Blubrry PowerPress & Community Podcast', 'powerpress'), 'powerpress_dashboard_news_content' );
316
+
317
+ if( !empty($_GET['powerpressdash']) && $_GET['powerpressdash'] == 3 ) {
318
+ return;
319
+ }
320
+
321
+ if( $StatsDashboard )
322
+ wp_add_dashboard_widget( 'powerpress_dashboard_stats', __( 'Blubrry Podcast Statistics', 'powerpress'), 'powerpress_dashboard_stats_content' );
323
+
324
+ if( !empty($_GET['powerpressdash']) && $_GET['powerpressdash'] == 4 ) {
325
+ return;
326
+ }
327
+
328
+ if( !empty( $user ) ) {
329
+ $user_options = get_user_option('powerpress_user');
330
+ if( empty($user_options) || empty($user_options['dashboard_installed']) || $user_options['dashboard_installed'] < 2 )
331
+ {
332
+ if( !is_array($user_options) )
333
+ $user_options = array();
334
+
335
+ if( !empty($_GET['powerpressdash']) && $_GET['powerpressdash'] == 5 ) {
336
+ return;
337
+ }
338
+
339
+ // First time we've seen this setting, so must be first time we've added the widgets, lets stack them at the top for convenience.
340
+ powerpressadmin_add_dashboard_widgets($user->ID);
341
+ $user_options['dashboard_installed'] = 2; // version of PowerPress
342
+ update_user_option($user->ID, "powerpress_user", $user_options, true);
343
+ }
344
+ else
345
+ {
346
+ if( !empty($_GET['powerpressdash']) && $_GET['powerpressdash'] == 6 ) {
347
+ return;
348
+ }
349
+
350
+ powerpressadmin_add_dashboard_widgets(false);
351
+ }
352
+ }
353
+ }
354
+
355
+ function powerpressadmin_add_dashboard_notice_widget($user_id, $notice_id)
356
+ {
357
+ $user_options = get_user_option('meta-box-order_dashboard', $user_id);
358
+ if( $user_options )
359
+ {
360
+ $save = false;
361
+ if( !preg_match('/powerpress_dashboard_notice_'.$notice_id.'/', $user_options['normal']) && !preg_match('/powerpress_dashboard_notice_'.$notice_id.'/', $user_options['side']) && !preg_match('/powerpress_dashboard_notice_'.$notice_id.'/', $user_options['column3']) && !preg_match('/powerpress_dashboard_notice_'.$notice_id.'/', $user_options['column4']) )
362
+ {
363
+ $save = true;
364
+ $user_options['normal'] = 'powerpress_dashboard_notice_'.$notice_id.','.$user_options['normal'];
365
+ }
366
+
367
+ if( $save )
368
+ {
369
+ update_user_option($user_id, "meta-box-order_dashboard", $user_options, true);
370
+ }
371
+ }
372
+ }
373
+
374
+ function powerpressadmin_add_dashboard_widgets( $check_user_id = false)
375
+ {
376
+ // Only re-order the powerpress widgets if they aren't already on the dashboard:
377
+ if( $check_user_id )
378
+ {
379
+ $user_options = get_user_option('meta-box-order_dashboard', $check_user_id);
380
+ if( $user_options )
381
+ {
382
+ $save = false;
383
+ if( !preg_match('/powerpress_dashboard_stats/', $user_options['normal']) && !preg_match('/powerpress_dashboard_stats/', $user_options['side']) && !preg_match('/powerpress_dashboard_stats/', $user_options['column3']) && !preg_match('/powerpress_dashboard_stats/', $user_options['column4']) )
384
+ {
385
+ $save = true;
386
+ if( !empty($user_options['side']) )
387
+ $user_options['side'] = 'powerpress_dashboard_stats,'.$user_options['side'];
388
+ else
389
+ $user_options['normal'] = 'powerpress_dashboard_stats,'.$user_options['normal'];
390
+ }
391
+
392
+ if( !preg_match('/powerpress_dashboard_news/', $user_options['normal']) && !preg_match('/powerpress_dashboard_news/', $user_options['side']) && !preg_match('/powerpress_dashboard_news/', $user_options['column3']) && !preg_match('/powerpress_dashboard_news/', $user_options['column4']) )
393
+ {
394
+ $save = true;
395
+ $user_options['normal'] = 'powerpress_dashboard_news,'.$user_options['normal'];
396
+ }
397
+
398
+ if( $save )
399
+ {
400
+ update_user_option($check_user_id, "meta-box-order_dashboard", $user_options, true);
401
+ }
402
+ }
403
+ }
404
+
405
+ // Reorder for all future users
406
+ global $wp_meta_boxes;
407
+ $dashboard_current = $wp_meta_boxes['dashboard']['normal']['core'];
408
+
409
+ $dashboard_powerpress = array();
410
+ for( $i = 0; $i < 20; $i++ )
411
+ {
412
+ if( isset( $dashboard_current['powerpress_dashboard_notice_' . $i] ) )
413
+ {
414
+ $dashboard_powerpress['powerpress_dashboard_notice_' . $i] = $dashboard_current['powerpress_dashboard_notice_' . $i];
415
+ unset($dashboard_current['powerpress_dashboard_notice_' . $i]);
416
+ }
417
+ }
418
+
419
+ if( isset( $dashboard_current['powerpress_dashboard_news'] ) )
420
+ {
421
+ $dashboard_powerpress['powerpress_dashboard_news'] = $dashboard_current['powerpress_dashboard_news'];
422
+ unset($dashboard_current['powerpress_dashboard_news']);
423
+ }
424
+
425
+ if( isset( $dashboard_current['powerpress_dashboard_stats'] ) )
426
+ {
427
+ $dashboard_powerpress['powerpress_dashboard_stats'] = $dashboard_current['powerpress_dashboard_stats'];
428
+ unset($dashboard_current['powerpress_dashboard_stats']);
429
+ }
430
+
431
+ if( count($dashboard_powerpress) > 0 )
432
+ {
433
+ $wp_meta_boxes['dashboard']['normal']['core'] = array_merge($dashboard_powerpress, $dashboard_current);
434
+ }
435
+ }
436
+
437
+ add_action('admin_head-index.php', 'powerpress_dashboard_head');
438
+ add_action('wp_dashboard_setup', 'powerpress_dashboard_setup');
439
+
440
+ function powerpress_dashboard_dismiss() // Called by AJAX call
441
+ {
442
+ $dismiss_dash_id = $_POST['dismiss_dash_id'];
443
+ preg_match('/^powerpress_dashboard_notice_(.*)$/i', $dismiss_dash_id, $match );
444
+ if( empty($match[1]) )
445
+ exit;
446
+ $DismissedNotices = get_option('powerpress_dismissed_notices');
447
+ if( !is_array($DismissedNotices) )
448
+ $DismissedNotices = array();
449
+ $DismissedNotices[ $match[1] ] = 1;
450
+ update_option('powerpress_dismissed_notices', $DismissedNotices);
451
+ echo 'ok';
452
+ exit;
453
+ }
454
+
455
  ?>
powerpressadmin-editfeed.php CHANGED
@@ -1,1198 +1,1378 @@
1
- <?php
2
-
3
- if( !function_exists('add_action') )
4
- die("access denied.");
5
-
6
- function powerpress_languages()
7
- {
8
- // List copied from PodPress:
9
- $langs = array();
10
- $langs['af'] = __('Afrikaans', 'powerpress');
11
- $langs['sq'] = __('Albanian', 'powerpress');
12
- $langs['ar'] = __('Arabic', 'powerpress');
13
- $langs['ar-sa'] = __('Arabic (Saudi Arabia)', 'powerpress');
14
- $langs['ar-eg'] = __('Arabic (Egypt)', 'powerpress');
15
- $langs['ar-dz'] = __('Arabic (Algeria)', 'powerpress');
16
- $langs['ar-tn'] = __('Arabic (Tunisia)', 'powerpress');
17
- $langs['ar-ye'] = __('Arabic (Yemen)', 'powerpress');
18
- $langs['ar-jo'] = __('Arabic (Jordan)', 'powerpress');
19
- $langs['ar-kw'] = __('Arabic (Kuwait)', 'powerpress');
20
- $langs['ar-bh'] = __('Arabic (Bahrain)', 'powerpress');
21
- $langs['eu'] = __('Basque', 'powerpress');
22
- $langs['be'] = __('Belarusian', 'powerpress');
23
- $langs['bg'] = __('Bulgarian', 'powerpress');
24
- $langs['ca'] = __('Catalan', 'powerpress');
25
- $langs['zh-cn'] = __('Chinese (Simplified)', 'powerpress');
26
- $langs['zh-tw'] = __('Chinese (Traditional)', 'powerpress');
27
- $langs['hr'] = __('Croatian', 'powerpress');
28
- $langs['cs'] = __('Czech', 'powerpress');
29
- $langs['da'] = __('Danish', 'powerpress');
30
- $langs['nl'] = __('Dutch', 'powerpress');
31
- $langs['nl-be'] = __('Dutch (Belgium)', 'powerpress');
32
- $langs['nl-nl'] = __('Dutch (Netherlands)', 'powerpress');
33
- $langs['en'] = __('English', 'powerpress');
34
- $langs['en-au'] = __('English (Australia)', 'powerpress');
35
- $langs['en-bz'] = __('English (Belize)', 'powerpress');
36
- $langs['en-ca'] = __('English (Canada)', 'powerpress');
37
- $langs['en-ie'] = __('English (Ireland)', 'powerpress');
38
- $langs['en-jm'] = __('English (Jamaica)', 'powerpress');
39
- $langs['en-nz'] = __('English (New Zealand)', 'powerpress');
40
- $langs['en-ph'] = __('English (Phillipines)', 'powerpress');
41
- $langs['en-za'] = __('English (South Africa)', 'powerpress');
42
- $langs['en-tt'] = __('English (Trinidad)', 'powerpress');
43
- $langs['en-gb'] = __('English (United Kingdom)', 'powerpress');
44
- $langs['en-us'] = __('English (United States)', 'powerpress');
45
- $langs['en-zw'] = __('English (Zimbabwe)', 'powerpress');
46
- $langs['et'] = __('Estonian', 'powerpress');
47
- $langs['fo'] = __('Faeroese', 'powerpress');
48
- $langs['fi'] = __('Finnish', 'powerpress');
49
- $langs['fr'] = __('French', 'powerpress');
50
- $langs['fr-be'] = __('French (Belgium)', 'powerpress');
51
- $langs['fr-ca'] = __('French (Canada)', 'powerpress');
52
- $langs['fr-fr'] = __('French (France)', 'powerpress');
53
- $langs['fr-lu'] = __('French (Luxembourg)', 'powerpress');
54
- $langs['fr-mc'] = __('French (Monaco)', 'powerpress');
55
- $langs['fr-ch'] = __('French (Switzerland)', 'powerpress');
56
- $langs['gl'] = __('Galician', 'powerpress');
57
- $langs['gd'] = __('Gaelic', 'powerpress');
58
- $langs['de'] = __('German', 'powerpress');
59
- $langs['de-at'] = __('German (Austria)', 'powerpress');
60
- $langs['de-de'] = __('German (Germany)', 'powerpress');
61
- $langs['de-li'] = __('German (Liechtenstein)', 'powerpress');
62
- $langs['de-lu'] = __('German (Luxembourg)', 'powerpress');
63
- $langs['de-ch'] = __('German (Switzerland)', 'powerpress');
64
- $langs['el'] = __('Greek', 'powerpress');
65
- $langs['haw'] = __('Hawaiian', 'powerpress');
66
- $langs['he_IL'] = __('Hebrew', 'powerpress');
67
- $langs['hu'] = __('Hungarian', 'powerpress');
68
- $langs['is'] = __('Icelandic', 'powerpress');
69
- $langs['in'] = __('Indonesian', 'powerpress');
70
- $langs['ga'] = __('Irish', 'powerpress');
71
- $langs['it'] = __('Italian', 'powerpress');
72
- $langs['hi'] = __('Hindi', 'powerpress');
73
- $langs['it-it'] = __('Italian (Italy)', 'powerpress');
74
- $langs['it-ch'] = __('Italian (Switzerland)', 'powerpress');
75
- $langs['ja'] = __('Japanese', 'powerpress');
76
- $langs['ko'] = __('Korean', 'powerpress');
77
- $langs['mk'] = __('Macedonian', 'powerpress');
78
- $langs['no'] = __('Norwegian', 'powerpress');
79
- $langs['pa'] = __('Punjabi', 'powerpress');
80
- $langs['pl'] = __('Polish', 'powerpress');
81
- $langs['pt'] = __('Portuguese', 'powerpress');
82
- $langs['pt-br'] = __('Portuguese (Brazil)', 'powerpress');
83
- $langs['pt-pt'] = __('Portuguese (Portugal)', 'powerpress');
84
- $langs['ro'] = __('Romanian', 'powerpress');
85
- $langs['ro-mo'] = __('Romanian (Moldova)', 'powerpress');
86
- $langs['ro-ro'] = __('Romanian (Romania)', 'powerpress');
87
- $langs['ru'] = __('Russian', 'powerpress');
88
- $langs['ru-mo'] = __('Russian (Moldova)', 'powerpress');
89
- $langs['ru-ru'] = __('Russian (Russia)', 'powerpress');
90
- $langs['sr'] = __('Serbian', 'powerpress');
91
- $langs['sk'] = __('Slovak', 'powerpress');
92
- $langs['sl'] = __('Slovenian', 'powerpress');
93
- $langs['es'] = __('Spanish', 'powerpress');
94
- $langs['es-ar'] = __('Spanish (Argentina)', 'powerpress');
95
- $langs['es-bo'] = __('Spanish (Bolivia)', 'powerpress');
96
- $langs['es-cl'] = __('Spanish (Chile)', 'powerpress');
97
- $langs['es-co'] = __('Spanish (Colombia)', 'powerpress');
98
- $langs['es-cr'] = __('Spanish (Costa Rica)', 'powerpress');
99
- $langs['es-do'] = __('Spanish (Dominican Republic)', 'powerpress');
100
- $langs['es-ec'] = __('Spanish (Ecuador)', 'powerpress');
101
- $langs['es-sv'] = __('Spanish (El Salvador)', 'powerpress');
102
- $langs['es-gt'] = __('Spanish (Guatemala)', 'powerpress');
103
- $langs['es-hn'] = __('Spanish (Honduras)', 'powerpress');
104
- $langs['es-mx'] = __('Spanish (Mexico)', 'powerpress');
105
- $langs['es-ni'] = __('Spanish (Nicaragua)', 'powerpress');
106
- $langs['es-pa'] = __('Spanish (Panama)', 'powerpress');
107
- $langs['es-py'] = __('Spanish (Paraguay)', 'powerpress');
108
- $langs['es-pe'] = __('Spanish (Peru)', 'powerpress');
109
- $langs['es-pr'] = __('Spanish (Puerto Rico)', 'powerpress');
110
- $langs['es-es'] = __('Spanish (Spain)', 'powerpress');
111
- $langs['es-uy'] = __('Spanish (Uruguay)', 'powerpress');
112
- $langs['es-ve'] = __('Spanish (Venezuela)', 'powerpress');
113
- $langs['sv'] = __('Swedish', 'powerpress');
114
- $langs['sv-fi'] = __('Swedish (Finland)', 'powerpress');
115
- $langs['sv-se'] = __('Swedish (Sweden)', 'powerpress');
116
- $langs['ta'] = __('Tamil', 'powerpress');
117
- $langs['tr'] = __('Turkish', 'powerpress');
118
- $langs['uk'] = __('Ukranian', 'powerpress');
119
- return $langs;
120
- }
121
-
122
- function powerpress_admin_capabilities()
123
- {
124
- global $wp_roles;
125
-
126
- $capnames = array();
127
- // Get Role List
128
- foreach($wp_roles->role_objects as $key => $role) {
129
- foreach($role->capabilities as $cap => $grant) {
130
- $capnames[$cap] = ucwords( str_replace('_', ' ', $cap) );
131
- }
132
- }
133
-
134
- $capnames = apply_filters( 'powerpress_admin_capabilities', array_unique($capnames) );
135
-
136
- $remove_keys = array('level_0', 'level_1', 'level_2', 'level_3', 'level_4', 'level_5', 'level_6', 'level_7', 'level_8', 'level_9', 'level_10');
137
- foreach( $remove_keys as $null=> $key )
138
- unset($capnames[ $key ]);
139
- asort($capnames);
140
- return $capnames;
141
- }
142
-
143
-
144
- // powerpressadmin_editfeed.php
145
- function powerpress_admin_editfeed($type='', $type_value = '', $feed_slug = false)
146
- {
147
- $SupportUploads = powerpressadmin_support_uploads();
148
- $General = powerpress_get_settings('powerpress_general');
149
- $FeedAttribs = array('type'=>$type, 'feed_slug'=>'', 'category_id'=>0, 'term_taxonomy_id'=>0, 'term_id'=>0, 'taxonomy_type'=>'', 'post_type'=>'');
150
- $cat_ID = false; $term_taxonomy_id = false;
151
-
152
-
153
- $FeedTitle = __('Feed Settings', 'powerpress');
154
-
155
- switch( $type )
156
- {
157
- case 'channel': {
158
- $feed_slug = $type_value;
159
- $FeedAttribs['feed_slug'] = $type_value;
160
- $FeedSettings = powerpress_get_settings('powerpress_feed_'.$feed_slug);
161
- if( !$FeedSettings && $type_value == 'podcast' ) // We are editing the default podcast channel
162
- {
163
- $FeedSettings = powerpress_get_settings('powerpress_feed');
164
- }
165
-
166
- if( !$FeedSettings )
167
- {
168
- $FeedSettings = array();
169
- $FeedSettings['title'] = '';
170
- if( !empty($General['custom_feeds'][$feed_slug]) )
171
- $FeedSettings['title'] = $General['custom_feeds'][$feed_slug];
172
- }
173
- $FeedSettings = powerpress_default_settings($FeedSettings, 'editfeed_custom');
174
-
175
- if( !isset($General['custom_feeds'][$feed_slug]) )
176
- $General['custom_feeds'][$feed_slug] = __('Podcast (default)', 'powerpress');
177
-
178
- $FeedTitle = sprintf( 'Podcast Settings for Channel: %s', htmlspecialchars($General['custom_feeds'][$feed_slug]) );
179
- echo sprintf('<input type="hidden" name="feed_slug" value="%s" />', $feed_slug);
180
- echo '<input type="hidden" name="action" value="powerpress-save-channel" />';
181
-
182
- }; break;
183
- case 'category': {
184
- $cat_ID = $type_value;
185
- $FeedAttribs['category_id'] = $type_value;
186
- $FeedSettings = powerpress_get_settings('powerpress_cat_feed_'.$cat_ID);
187
- $FeedSettings = powerpress_default_settings($FeedSettings, 'editfeed_custom');
188
-
189
- $category = get_category_to_edit($cat_ID);
190
- $FeedTitle = sprintf( __('Podcast Settings for Category: %s', 'powerpress'), htmlspecialchars($category->name) );
191
- echo sprintf('<input type="hidden" name="cat" value="%s" />', $cat_ID);
192
- echo '<input type="hidden" name="action" value="powerpress-save-category" />';
193
-
194
- }; break;
195
- case 'ttid': {
196
- $term_taxonomy_id = $type_value;
197
- $FeedAttribs['term_taxonomy_id'] = $type_value;
198
- $FeedSettings = powerpress_get_settings('powerpress_taxonomy_'.$term_taxonomy_id);
199
- $FeedSettings = powerpress_default_settings($FeedSettings, 'editfeed_custom');
200
-
201
- global $wpdb;
202
- $term_info = $wpdb->get_results("SELECT term_id, taxonomy FROM $wpdb->term_taxonomy WHERE term_taxonomy_id = $term_taxonomy_id", ARRAY_A);
203
- if( !empty( $term_info[0]['term_id']) ) {
204
- $term_ID = $term_info[0]['term_id'];
205
- $taxonomy_type = $term_info[0]['taxonomy'];
206
- $FeedAttribs['term_id'] = $term_ID;
207
- $FeedAttribs['taxonomy_type'] = $taxonomy_type;
208
-
209
- $term_object = get_term_to_edit($term_ID, $taxonomy_type);
210
- $FeedTitle = sprintf( __('Podcast Settings for Taxonomy Term: %s', 'powerpress'), htmlspecialchars($term_object->name));
211
- }
212
- else
213
- {
214
- $FeedTitle = sprintf( __('Podcast Settings for Taxonomy Term: %s', 'powerpress'), 'Term ID '.htmlspecialchars($term_taxonomy_id));
215
- }
216
- echo sprintf('<input type="hidden" name="ttid" value="%s" />', $term_taxonomy_id);
217
- echo '<input type="hidden" name="action" value="powerpress-save-ttid" />';
218
-
219
- }; break;
220
- case 'post_type': {
221
-
222
- $FeedAttribs['post_type'] = $type_value;
223
- $FeedAttribs['feed_slug'] = $feed_slug;
224
- $FeedSettingsArray = powerpress_get_settings('powerpress_posttype_'.$FeedAttribs['post_type']);
225
- if( !is_array($FeedSettingsArray[ $feed_slug ]) )
226
- $FeedSettingsArray[ $feed_slug ] = array();
227
- $FeedSettings = powerpress_default_settings($FeedSettingsArray[ $feed_slug ], 'editfeed_custom');
228
-
229
- //$category = get_category_to_edit($cat_ID);
230
- $PostTypeTitle = $FeedAttribs['post_type']; // TODO: Get readable title of post type
231
- $FeedTitle = sprintf( __('Podcast Settings for Post Type %s with slug %s', 'powerpress'), htmlspecialchars($PostTypeTitle) , htmlspecialchars($feed_slug));
232
- echo sprintf('<input type="hidden" name="podcast_post_type" value="%s" />', $FeedAttribs['post_type']);
233
- echo sprintf('<input type="hidden" name="feed_slug" value="%s" />', $feed_slug);
234
- echo '<input type="hidden" name="action" value="powerpress-save-post_type" />';
235
-
236
- }; break;
237
- default: {
238
- $FeedSettings = powerpress_get_settings('powerpress_feed');
239
- $FeedSettings = powerpress_default_settings($FeedSettings, 'editfeed');
240
- echo '<input type="hidden" name="action" value="powerpress-save-settings" />';
241
- }; break;
242
- }
243
-
244
-
245
- echo '<h2>'. $FeedTitle .'</h2>';
246
-
247
- if( $cat_ID && (isset($_GET['from_categories']) || isset($_POST['from_categories'])) )
248
- {
249
- echo '<input type="hidden" name="from_categories" value="1" />';
250
- }
251
-
252
- ?>
253
- <div id="powerpress_settings_page" class="powerpress_tabbed_content">
254
- <ul class="powerpress_settings_tabs">
255
- <li><a href="#feed_tab_feed"><span><?php echo htmlspecialchars(__('Feed', 'powerpress')); ?></span></a></li>
256
- <li><a href="#feed_tab_itunes"><span><?php echo htmlspecialchars(__('Apple', 'powerpress')); ?></span></a></li>
257
- <li><a href="#feed_tab_googleplay"><span><?php echo htmlspecialchars(__('Google', 'powerpress')); ?></span></a></li>
258
- <li><a href="#feed_tab_artwork"><span><?php echo htmlspecialchars(__('Artwork', 'powerpress')); ?></span></a></li>
259
- <?php if( in_array($FeedAttribs['type'], array('category', 'ttid', 'post_type', 'channel') ) ) { ?>
260
- <li><a href="#feed_tab_appearance"><span><?php echo htmlspecialchars(__('Website', 'powerpress')); ?></span></a></li>
261
- <?php } ?>
262
- <li><a href="#feed_tab_destinations"><span><?php echo htmlspecialchars(__('Destinations', 'powerpress')); ?></span></a></li>
263
-
264
- <?php if( in_array($FeedAttribs['type'], array('category', 'ttid', 'post_type', 'channel') ) ) { ?>
265
- <li><a href="#feed_tab_other"><span><?php echo htmlspecialchars(__('Other Settings', 'powerpress')); ?></span></a></li>
266
- <?php } ?>
267
- </ul>
268
-
269
-
270
- <div id="feed_tab_feed" class="powerpress_tab">
271
- <?php
272
- powerpressadmin_edit_feed_settings($FeedSettings, $General, $FeedAttribs );
273
- if( !empty($General['advanced_mode_2']) ) {
274
- powerpressadmin_edit_funding($FeedSettings, $feed_slug);
275
- powerpressadmin_edit_tv($FeedSettings, $feed_slug);
276
- }
277
- ?>
278
- </div>
279
-
280
- <div id="feed_tab_itunes" class="powerpress_tab">
281
- <?php
282
- powerpressadmin_edit_itunes_feed($FeedSettings, $General, $FeedAttribs);
283
- ?>
284
- </div>
285
-
286
- <div id="feed_tab_googleplay" class="powerpress_tab">
287
- <?php
288
- powerpressadmin_edit_googleplay($FeedSettings, $General, $FeedAttribs);
289
- ?>
290
- </div>
291
-
292
- <div id="feed_tab_artwork" class="powerpress_tab">
293
- <?php
294
- powerpressadmin_edit_artwork($FeedSettings, $General);
295
- ?>
296
- </div>
297
-
298
- <?php if( $feed_slug || $FeedAttribs['type'] == 'category' || $FeedAttribs['type'] == 'ttid' ) { ?>
299
- <div id="feed_tab_appearance" class="powerpress_tab">
300
- <?php
301
- //powerpressadmin_appearance($General);
302
- //if( $feed_slug )
303
- // powerpressadmin_edit_appearance_feed($General, $FeedSettings, $feed_slug, $FeedAttribs);
304
-
305
- powerpressadmin_settings_tab_appearance($General, $FeedSettings, $FeedAttribs);
306
- ?>
307
- </div>
308
-
309
- <div id="feed_tab_destinations" class="powerpress_tab">
310
- <?php
311
- powerpressadmin_edit_destinations($FeedSettings, $General, $FeedAttribs);
312
- ?>
313
- </div>
314
-
315
- <div id="feed_tab_other" class="powerpress_tab">
316
- <?php
317
- powerpressadmin_settings_tab_other($General, $FeedSettings, $feed_slug, $cat_ID, $FeedAttribs)
318
- ?>
319
- </div>
320
- <?php } ?>
321
-
322
- </div>
323
- <div class="clear"></div>
324
- <?php
325
-
326
-
327
- }
328
-
329
- function powerpressadmin_edit_podcast_channel($FeedSettings, $General)
330
- {
331
- // TODO
332
- ?>
333
- <input type="hidden" name="action" value="powerpress-save-customfeed" />
334
- <p style="margin-bottom: 0;">
335
- <?php echo __('Configure your custom podcast feed.', 'powerpress'); ?>
336
- </p>
337
- <?php
338
- }
339
-
340
- function powerpressadmin_edit_category_feed($FeedSettings, $General)
341
- {
342
- ?>
343
- <input type="hidden" name="action" value="powerpress-save-categoryfeedsettings" />
344
- <p style="margin-bottom: 0;">
345
- <?php echo __('Configure your category feed to support podcasting.', 'powerpress'); ?>
346
- </p>
347
- <?php
348
- }
349
-
350
- function powerpressadmin_edit_feed_general($FeedSettings, $General)
351
- {
352
- $warning = '';
353
- $episode_count = powerpress_get_episode_count('podcast');
354
- if( $episode_count == 0 )
355
- {
356
- $warning = __('WARNING: You must create at least one podcast episode for your podcast feed to be valid.', 'powerpress');
357
- }
358
-
359
- if( !isset($FeedSettings['apply_to']) )
360
- $FeedSettings['apply_to'] = 1;
361
- ?>
362
- <h3><?php echo __('Podcast Feeds', 'powerpress'); ?></h3>
363
- <table class="form-table">
364
-
365
- <tr valign="top">
366
- <th scope="row">
367
-
368
- <?php echo __('Enhance Feeds', 'powerpress'); ?></th>
369
- <td>
370
- <ul>
371
- <li><p><label><input type="radio" name="Feed[apply_to]" value="1" <?php if( $FeedSettings['apply_to'] == 1 ) echo 'checked'; ?> /> <?php echo __('Enhance All Feeds', 'powerpress'); ?></label> (<?php echo __('Recommended', 'powerpress'); ?>)</p>
372
- <p style="font-size: 100%; margin: 0 0 0 30px;"><?php echo __('Adds podcasting support to all feeds', 'powerpress'); ?></p>
373
- </li>
374
- <li><p><label><input type="radio" name="Feed[apply_to]" value="2" <?php if( $FeedSettings['apply_to'] == 2 ) echo 'checked'; ?> /> <?php echo __('Enhance Main Feed Only', 'powerpress'); ?></label></p>
375
- <p style="font-size: 100%; margin: 0 0 0 30px;"><?php echo __('Adds podcasting support to your main feed only', 'powerpress'); ?></p></li>
376
- <li><p><label><input type="radio" name="Feed[apply_to]" value="0" <?php if( $FeedSettings['apply_to'] == 0 ) echo 'checked'; ?> /> <?php echo __('Do Not Enhance Feeds', 'powerpress'); ?></label></p>
377
- <p style="font-size: 100%; margin: 0 0 0 30px;"><?php echo __('Feed Settings below will only apply to your podcast channel feeds', 'powerpress'); ?></p></li>
378
- </ul>
379
- </td>
380
- </tr>
381
- <tr valign="top">
382
- <th scope="row">
383
-
384
- <?php echo __('Podcast Feeds', 'powerpress'); ?></th>
385
- <td>
386
- <?php if( $warning ) { ?>
387
- <span class="powerpress-error" style="background-color: #FFEBE8; border-color: #CC0000; padding: 6px 10px;"><?php echo $warning; ?></span>
388
- <?php } ?>
389
- <?php
390
-
391
- //$General = get_option('powerpress_general');
392
- $Feeds = array('podcast'=> __('Special Podcast only Feed', 'powerpress') );
393
- if( isset($General['custom_feeds']['podcast']) )
394
- $Feeds = $General['custom_feeds'];
395
- else if( isset($General['custom_feeds'])&& is_array($General['custom_feeds']) )
396
- $Feeds += $General['custom_feeds'];
397
-
398
- foreach( $Feeds as $feed_slug=> $feed_title )
399
- {
400
- if( empty($feed_title) )
401
- $feed_title = $feed_slug;
402
- $edit_link = admin_url( 'admin.php?page=powerpress/powerpressadmin_customfeeds.php&amp;action=powerpress-editfeed&amp;feed_slug=') . $feed_slug;
403
- ?>
404
- <p><?php echo $feed_title; ?>: <a href="<?php echo get_feed_link($feed_slug); ?>" title="<?php echo $feed_title; ?>" target="_blank"><?php echo get_feed_link($feed_slug); ?></a>
405
- <?php if( defined('POWERPRESS_FEEDVALIDATOR_URL') ) { ?>
406
- | <a href="<?php echo POWERPRESS_FEEDVALIDATOR_URL. urlencode(get_feed_link($feed_slug)); ?>" target="_blank"><?php echo __('validate', 'powerpress'); ?></a>
407
- <?php } ?>
408
- <?php if( false && $feed_slug != 'podcast' ) { ?>
409
- | <a href="<?php echo $edit_link; ?>" title="<?php echo __('Edit Podcast Channel', 'powerpress'); ?>"><?php echo __('edit', 'powerpress'); ?></a>
410
- <?php } ?>
411
- </p>
412
- <?php } ?>
413
- <p><?php echo __('These are podcast only feeds suitable for submission podcast directories such as iTunes.', 'powerpress'); ?></p>
414
- <p class="description"><?php echo __('Note: We do not recommend submitting your main site feed to podcast directories such as iTunes. iTunes and many other podcast directories work best with feeds that do not have regular blog posts mixed in.', 'powerpress'); ?></p>
415
-
416
- <input type="hidden" name="General[feed_action_hook]" value="0" />
417
- <p><label><input type="checkbox" name="General[feed_action_hook]" value="1" <?php if( !empty($General['feed_action_hook']) && $General['feed_action_hook'] == 1 ) echo 'checked '; ?>/> <?php echo __('Do not allow other plugins to modify podcast feeds.', 'powerpress'); ?></label></p>
418
- <input type="hidden" name="General[feed_accel]" value="0" />
419
- <p><label><input type="checkbox" name="General[feed_accel]" value="1" <?php if( !empty($General['feed_accel']) && $General['feed_accel'] == 1 ) echo 'checked '; ?>/> <?php echo __('Accelerate feed', 'powerpress'); ?></label></p>
420
-
421
- </td>
422
- </tr>
423
-
424
- <tr valign="top">
425
- <th scope="row">
426
- <?php echo __('Feed Discovery', 'powerpress'); ?></th>
427
- <td>
428
- <p style="margin-top: 10px;"><label><input type="checkbox" name="General[feed_links]" value="1" <?php if( !empty($General['feed_links']) && $General['feed_links'] == 1 ) echo 'checked '; ?>/> <?php echo __('Include podcast feed links in HTML headers.', 'powerpress'); ?></label></p>
429
- <p><?php echo __('Adds "feed discovery" links to your web site\'s headers allowing web browsers and feed readers to auto-detect your podcast feeds.', 'powerpress'); ?></p>
430
- </td>
431
- </tr>
432
-
433
- <tr valign="top">
434
- <th scope="row">
435
- <?php echo __('RSS2 Image', 'powerpress'); ?></th>
436
- <td>
437
- <input type="hidden" name="General[disable_rss_image]" value="1" />
438
- <p><label><input type="checkbox" name="General[disable_rss_image]" value="0" <?php if( empty($General['disable_rss_image']) ) echo 'checked '; ?>/> <?php echo __('Include RSS Image in feeds.', 'powerpress'); ?></label></p>
439
- </td>
440
- </tr>
441
-
442
- <tr valign="top">
443
- <th scope="row">
444
- <?php echo __('Emoji', 'powerpress'); ?> <?php echo powerpressadmin_new(); ?></th>
445
- <td>
446
- <?php
447
- if( 'utf8mb4' != $GLOBALS['wpdb']->charset )
448
- {
449
- ?>
450
- <p style="font-weight: bold; color: #CC0000;">
451
- <?php
452
- echo __('Emoji may not be supported with your WordPress installation. Please upgrade your database to support utf8mb4 available in WordPress 4.2 and newer.', 'powerpress');
453
- ?>
454
- </p>
455
- <?php } ?>
456
- <input type="hidden" name="General[rss_emoji]" value="0" />
457
- <p><label><input type="checkbox" name="General[rss_emoji]" value="1" <?php if( !empty($General['rss_emoji']) ) echo 'checked '; ?>/> <?php echo __('Include Emoji in feeds.', 'powerpress'); ?></label>
458
- <a href="https://create.blubrry.com/resources/powerpress/powerpress-settings/feeds/#emoji" target="_blank"><?php echo __('Learn more', 'powerpress'); ?></p>
459
- </p>
460
- </td>
461
- </tr>
462
-
463
- </table>
464
- <?php
465
- }
466
-
467
- function powerpressadmin_edit_feed_settings($FeedSettings, $General, $FeedAttribs = array() )
468
- {
469
- $SupportUploads = powerpressadmin_support_uploads();
470
- if( !isset($FeedSettings['posts_per_rss']) )
471
- $FeedSettings['posts_per_rss'] = '';
472
- if( !isset($FeedSettings['rss2_image']) )
473
- $FeedSettings['rss2_image'] = '';
474
- if( !isset($FeedSettings['copyright']) )
475
- $FeedSettings['copyright'] = '';
476
- if( !isset($FeedSettings['title']) )
477
- $FeedSettings['title'] = '';
478
- if( !isset($FeedSettings['rss_language']) )
479
- $FeedSettings['rss_language'] = '';
480
-
481
- $feed_link = '';
482
- switch( $FeedAttribs['type'])
483
- {
484
- case 'category': {
485
- if( !empty($General['cat_casting_podcast_feeds']) )
486
- $feed_link = get_category_feed_link($FeedAttribs['category_id'], 'podcast');
487
- else // Use the old link
488
- $feed_link = get_category_feed_link($FeedAttribs['category_id']);
489
- }; break;
490
- case 'ttid': {
491
- $feed_link = get_term_feed_link($FeedAttribs['term_taxonomy_id'], $FeedAttribs['taxonomy_type'], 'rss2');
492
- }; break;
493
- case 'post_type': {
494
- $feed_link = get_post_type_archive_feed_link($FeedAttribs['post_type'], $FeedAttribs['feed_slug']);
495
- }; break;
496
- case 'channel': {
497
- $feed_link = get_feed_link($FeedAttribs['feed_slug']);
498
- }; break;
499
- default: {
500
- $feed_link = get_feed_link('podcast');
501
- }; break;
502
- }
503
-
504
- $cat_ID = $FeedAttribs['category_id'];
505
-
506
- if( !empty($FeedAttribs['type']) && ( in_array($FeedAttribs['type'], array('category', 'ttid', 'post_type', 'channel') ) ) )
507
- {
508
- ?>
509
- <h3><?php echo __('Feed Information', 'powerpress'); ?></h3>
510
- <table class="form-table">
511
- <tr valign="top">
512
- <th scope="row">
513
- <?php echo __('Feed URL', 'powerpress'); ?>
514
- </th>
515
- <td>
516
- <p style="margin-top: 0;" class="description"><a href="<?php echo $feed_link; ?>" target="_blank"><?php echo $feed_link; ?></a>
517
- <?php if( defined('POWERPRESS_FEEDVALIDATOR_URL') ) { ?>| <a href="<?php echo POWERPRESS_FEEDVALIDATOR_URL. urlencode( str_replace('&amp;', '&', $feed_link)); ?>" target="_blank"><?php echo __('validate', 'powerpress'); ?></a><?php } ?></p>
518
- <?php
519
- if( !empty($FeedSettings['premium']) )
520
- {
521
- echo __('WARNING: This feed is password protected, it cannot be accessed publicly by the iTunes podcast directory or other podcast services.', 'powerpress');
522
- } ?>
523
- </td>
524
- </tr>
525
- </table>
526
- <?php
527
- }
528
- ?>
529
- <h3><?php echo __('Feed Settings', 'powerpress'); ?></h3>
530
- <p class="description"><?php echo sprintf(__('Feed settings below apply to feed: %s', 'powerpress'), esc_html($feed_link) ); ?></p>
531
- <table class="form-table">
532
-
533
-
534
- <tr valign="top">
535
- <th scope="row">
536
- <?php echo __('Feed Title (Show Title)', 'powerpress'); ?>
537
- </th>
538
- <td>
539
- <input type="text" name="Feed[title]" style="width: 60%;" value="<?php echo esc_attr($FeedSettings['title']); ?>" maxlength="255" />
540
- <?php if( $cat_ID ) { ?>
541
- (<?php echo __('leave blank to use default category title', 'powerpress'); ?>)
542
- <?php } else { ?>
543
- (<?php echo __('leave blank to use blog title', 'powerpress'); ?>)
544
- <?php } ?>
545
- <?php if( $FeedAttribs['type'] == 'ttid' ) { } else if( $cat_ID ) {
546
- ?>
547
- <p class="description"><?php echo esc_html(__('Default Category title:', 'powerpress') .' '. get_cat_name($cat_ID) . ' '. apply_filters( 'document_title_separator', '-' ) .' '. get_bloginfo_rss('name') ); ?></p>
548
- <?php } else { ?>
549
- <p class="description"><?php echo __('Blog title:', 'powerpress') .' '. get_bloginfo_rss('name'); ?></p>
550
- <?php } ?>
551
- <?php if( !empty($General['seo_itunes']) ) { ?>
552
- <p>
553
- <em><?php echo __('Podcasting SEO Suggestion: The show title is very important.', 'powerpress'); ?></em>
554
- </p>
555
- <?php } ?>
556
- </td>
557
- </tr>
558
-
559
- <?php if( !empty($General['advanced_mode_2']) ) { ?>
560
- <!-- start advanced features -->
561
- <tr valign="top">
562
- <th scope="row">
563
- <?php echo __('Feed Description', 'powerpress'); ?>
564
- </th>
565
- <td>
566
- <input type="text" name="Feed[description]" style="width: 60%;" value="<?php echo esc_attr( !empty($FeedSettings['description'])? $FeedSettings['description']:''); ?>" maxlength="1000" />
567
- <?php if( $cat_ID ) { ?>
568
- (<?php echo __('leave blank to use category description', 'powerpress'); ?>)
569
- <?php } else { ?>
570
- (<?php echo __('leave blank to use blog description', 'powerpress'); ?>)
571
- <?php } ?>
572
- </td>
573
- </tr>
574
-
575
- <?php
576
- if( $FeedAttribs['type'] != 'general' ) // All types exept general settings
577
- {
578
- ?>
579
- <tr valign="top">
580
- <th scope="row">
581
- <?php echo __('Feed Landing Page URL', 'powerpress'); ?> <br />
582
- </th>
583
- <td>
584
- <input type="text" name="Feed[url]" style="width: 60%;" value="<?php echo esc_attr( !empty($FeedSettings['url'])? $FeedSettings['url']:''); ?>" maxlength="255" />
585
- <?php if( $cat_ID ) { ?>
586
- (<?php echo __('leave blank to use category page', 'powerpress'); ?>)
587
- <?php } else { ?>
588
- (<?php echo __('leave blank to use home page', 'powerpress'); ?>)
589
- <?php } ?>
590
- <?php if( $cat_ID ) { ?>
591
- <p class="description"><?php echo __('Category page URL', 'powerpress'); ?>: <?php echo get_category_link($cat_ID); ?></p>
592
- <?php } else { ?>
593
- <p class="description">e.g. <?php echo get_bloginfo('url'); ?>/custom-page/</p>
594
- <?php } ?>
595
- </td>
596
- </tr>
597
- <?php } // End not general settings ?>
598
-
599
- <tr valign="top">
600
- <th scope="row">
601
- <?php echo __('PodcastMirror Feed URL', 'powerpress'); ?> <?php echo powerpressadmin_new(); ?><br />
602
- <span style="font-size: 85%; margin-left: 5px;"><a href="https://podcastmirror.com" target="_blank"><?php echo __('learn more', 'powerpress'); ?></a></span>
603
- </th>
604
- <td>
605
- <input type="text" name="Feed[feed_redirect_url]" style="width: 60%;" value="<?php echo esc_attr(!empty($FeedSettings['feed_redirect_url'])? $FeedSettings['feed_redirect_url']:''); ?>" maxlength="100" /> (<?php echo __('leave blank to use built-in feed', 'powerpress'); ?>)
606
- <p><?php echo __('Use this option to mirror your podcast feed to provide fast, scalable subscriptions to your show. Service is FeedBurner compatible.', 'powerpress'); ?></p>
607
- <?php
608
- $link = $feed_link;
609
- if( strstr($link, '?') )
610
- $link .= "&redirect=no";
611
- else
612
- $link .= "?redirect=no";
613
- ?>
614
- <p class="description"><?php echo __('Bypass Redirect URL', 'powerpress'); ?>: <a href="<?php echo $link; ?>" target="_blank"><?php echo $link; ?></a></p>
615
- </td>
616
- </tr>
617
-
618
- <tr valign="top">
619
- <th scope="row">
620
- <?php echo __('Show the most recent', 'powerpress'); ?>
621
- </th>
622
- <td>
623
- <p><input type="text" name="Feed[posts_per_rss]" style="width: 50px;" value="<?php echo ( !empty($FeedSettings['posts_per_rss'])? $FeedSettings['posts_per_rss']:''); ?>" maxlength="5" /> <?php echo sprintf(__('episodes / posts per feed (site default: %d, maximum: %d)', 'powerpress'), get_option('posts_per_rss'), 300); ?></p>
624
- <p style="margin-top: 5px; margin-bottom: 0; font-weight: bold;"><?php echo __('Please enable the <i>Feed Episode Maximizer</i> option to optimize your feed for more than 10 episodes.', 'powerpress'); ?></p>
625
- </td>
626
- </tr>
627
-
628
- <?php
629
- if( in_array($FeedAttribs['type'], array('channel', 'category', 'post_types', 'general')) )
630
- {
631
- ?>
632
- <tr valign="top">
633
- <th scope="row">
634
- <?php echo __('Feed Episode Maximizer', 'powerpress'); ?>
635
- </th>
636
- <td>
637
- <p><input type="checkbox" name="Feed[maximize_feed]" value="1" <?php if( !empty($FeedSettings['maximize_feed']) ) echo 'checked'; ?> />
638
- <?php echo __('Maximize the number of episodes while maintaining an optimal feed size.', 'powerpress'); ?> <a href="https://create.blubrry.com/resources/powerpress/powerpress-settings/feeds/#maximizer" target="_blank"><?php echo __('Learn more', 'powerpress'); ?></p>
639
- <p></a></p>
640
- </td>
641
- </tr>
642
- <?php
643
- }
644
- ?>
645
-
646
- <tr valign="top">
647
- <th scope="row">
648
-
649
- <?php echo __('Feed Language', 'powerpress'); ?></th>
650
- <td>
651
- <select name="Feed[rss_language]" class="bpp_input_med">
652
- <?php
653
- $Languages = powerpress_languages();
654
-
655
- echo '<option value="">'. __('Blog Default Language', 'powerpress') .'</option>';
656
- foreach( $Languages as $value=> $desc )
657
- echo "\t<option value=\"$value\"". ($FeedSettings['rss_language']==$value?' selected':''). ">". esc_attr($desc)."</option>\n";
658
- ?>
659
- </select>
660
- <?php
661
- $rss_language = get_bloginfo_rss('language');
662
- $rss_language = strtolower($rss_language);
663
- if( isset($Languages[ $rss_language ]) )
664
- {
665
- ?>
666
- <?php echo __('Blog Default', 'powerpress'); ?>: <?php echo $Languages[ $rss_language ]; ?>
667
- <?php } else { ?>
668
- <?php echo __('Blog Default', 'powerpress'); ?>: <?php echo $rss_language; ?>
669
- <?php } ?>
670
- </td>
671
- </tr>
672
-
673
- <tr valign="top">
674
- <th scope="row">
675
- <?php echo __('Copyright', 'powerpress'); ?>
676
- </th>
677
- <td>
678
- <input type="text" name="Feed[copyright]" style="width: 60%;" value="<?php echo esc_attr($FeedSettings['copyright']); ?>" maxlength="255" />
679
- </td>
680
- </tr>
681
- <tr valign="top">
682
- <th scope="row">
683
- <?php echo __('Caching Debug Comments', 'powerpress'); ?>
684
- </th>
685
- <td>
686
- <label><input type="checkbox" name="General[allow_feed_comments]" value="1" <?php if( !empty($General['allow_feed_comments']) ) echo 'checked'; ?> />
687
- <?php echo __('Allow WP Super Cache or W3 Total Cache to add HTML Comments to the bottom of your feeds', 'powerpress'); ?></label>
688
- (<?php echo __('Recommended unchecked', 'powerpress'); ?>)
689
- <p><?php echo __('iTunes is known to have issues with feeds that have HTML comments at the bottom.', 'powerpress'); ?></p>
690
- <p style="margin-bottom: 0;" class="description"><?php echo __('NOTE: This setting should only be enabled for debugging purposes.', 'powerpress'); ?></p>
691
- </td>
692
- </tr>
693
-
694
- <!-- end advanced features -->
695
- <?php } ?>
696
- </table>
697
-
698
- <!-- Location and frequency information -->
699
- <?php
700
- if( !isset($FeedSettings['location']) )
701
- $FeedSettings['location'] = '';
702
- if( !isset($FeedSettings['frequency']) )
703
- $FeedSettings['frequency'] = '';
704
- ?>
705
- <?php if( !empty($General['advanced_mode_2']) ) { ?>
706
- <!-- start advanced features -->
707
- <h3><?php echo __('Basic Show Information', 'powerpress'); ?></h3>
708
- <div id="rawvoice_basic_options">
709
- <table class="form-table">
710
- <tr valign="top">
711
- <th scope="row"><?php echo __('Location', 'powerpress'); ?></th>
712
- <td>
713
- <input type="text" style="width: 300px;" name="Feed[location]" value="<?php echo esc_attr($FeedSettings['location']); ?>" maxlength="50" /> (<?php echo __('optional', 'powerpress'); ?>)
714
- <p><?php echo __('e.g. Cleveland, Ohio', 'powerpress'); ?></p>
715
- </td>
716
- </tr>
717
- <tr valign="top">
718
- <th scope="row"><?php echo __('Episode Frequency', 'powerpress'); ?></th>
719
- <td>
720
- <input type="text" style="width: 300px;" name="Feed[frequency]" value="<?php echo esc_attr($FeedSettings['frequency']); ?>" maxlength="50" /> (<?php echo __('optional', 'powerpress'); ?>)
721
- <p><?php echo __('e.g. Weekly', 'powerpress'); ?></p>
722
- </td>
723
- </tr>
724
- </table>
725
- </div>
726
- <!-- end advanced features -->
727
- <?php
728
- }
729
- }
730
-
731
-
732
- function powerpressadmin_settings_tab_other($General, $FeedSettings, $feed_slug, $cat_ID = false, $FeedAttribs = array() ) {
733
- require_once( dirname(__FILE__).'/views/settings_tab_other.php' );
734
- }
735
-
736
- function powerpressadmin_settings_tab_appearance($General, $FeedSettings, $FeedAttribs = array()) {
737
- require_once( dirname(__FILE__).'/views/settings_tab_appearance.php' );
738
- }
739
-
740
- function powerpressadmin_edit_appearance_feed($General, $FeedSettings, $feed_slug)
741
- {
742
- // Appearance Settings
743
- ?>
744
- <h3><?php echo __('Website Settings', 'powerpress'); ?></h3>
745
- <table class="form-table">
746
- <tr valign="top">
747
- <th scope="row">
748
- <?php echo __('Disable Player', 'powerpress'); ?>
749
- </th>
750
- <td>
751
- <input name="DisablePlayerFor" type="checkbox" <?php if( isset($General['disable_player'][$feed_slug]) ) echo 'checked '; ?> value="1" /> <?php echo __('Do not display web player or links for this podcast.', 'powerpress'); ?>
752
- <input type="hidden" name="UpdateDisablePlayer" value="<?php echo $feed_slug; ?>" />
753
- </td>
754
- </tr>
755
- </table>
756
- <?php
757
-
758
- }
759
-
760
- function powerpressadmin_edit_itunes_feed($FeedSettings, $General, $FeedAttribs = array() )
761
- {
762
- $feed_slug = $FeedAttribs['feed_slug'];
763
- $cat_ID = $FeedAttribs['category_id'];
764
-
765
- $SupportUploads = powerpressadmin_support_uploads();
766
- if( !isset($FeedSettings['itunes_subtitle']) )
767
- $FeedSettings['itunes_subtitle'] = '';
768
- if( !isset($FeedSettings['itunes_summary']) )
769
- $FeedSettings['itunes_summary'] = '';
770
- if( !isset($FeedSettings['itunes_keywords']) )
771
- $FeedSettings['itunes_keywords'] = '';
772
- if( !isset($FeedSettings['itunes_cat_1']) )
773
- $FeedSettings['itunes_cat_1'] = '';
774
- if( !isset($FeedSettings['itunes_cat_2']) )
775
- $FeedSettings['itunes_cat_2'] = '';
776
- if( !isset($FeedSettings['itunes_cat_3']) )
777
- $FeedSettings['itunes_cat_3'] = '';
778
- if( !isset($FeedSettings['itunes_explicit']) )
779
- $FeedSettings['itunes_explicit'] = 0;
780
- if( !isset($FeedSettings['itunes_talent_name']) )
781
- $FeedSettings['itunes_talent_name'] = '';
782
- if( !isset($FeedSettings['email']) )
783
- $FeedSettings['email'] = '';
784
- if( !isset($FeedSettings['itunes_new_feed_url_podcast']) )
785
- $FeedSettings['itunes_new_feed_url_podcast'] = '';
786
- if( !isset($FeedSettings['itunes_new_feed_url']) )
787
- $FeedSettings['itunes_new_feed_url'] = '';
788
- if( !isset($FeedSettings['itunes_type']) )
789
- $FeedSettings['itunes_type'] = '';
790
-
791
- $AdvancediTunesSettings = !empty($FeedSettings['itunes_summary']);
792
- if( !empty($FeedSettings['itunes_subtitle']) )
793
- $AdvancediTunesSettings = true;
794
-
795
- ?>
796
-
797
- <h3><?php echo __('Apple Settings', 'powerpress'); ?></h3>
798
- <table class="form-table">
799
- <tr valign="top">
800
- <th scope="row">
801
- <?php echo __('iTunes Program Subtitle', 'powerpress'); ?> <br />
802
- </th>
803
- <td>
804
- <input type="text" name="Feed[itunes_subtitle]" style="width: 60%;" value="<?php echo esc_attr($FeedSettings['itunes_subtitle']); ?>" maxlength="255" />
805
- </td>
806
- </tr>
807
-
808
- <tr valign="top">
809
- <th scope="row">
810
-
811
- <?php echo __('iTunes Program Summary', 'powerpress'); ?></th>
812
- <td>
813
- <p style="margin-top: 5px;"><?php echo __('Your summary cannot exceed 4,000 characters in length and should not include HTML, except for hyperlinks', 'powerpress'); ?></p>
814
-
815
- <textarea name="Feed[itunes_summary]" rows="5" style="width:80%;" ><?php echo esc_textarea($FeedSettings['itunes_summary']); ?></textarea>
816
- <div>
817
- <input type="hidden" name="General[itunes_cdata]" value="0" />
818
- <input type="checkbox" name="General[itunes_cdata]" value="1" <?php echo ( !empty($General['itunes_cdata'])?'checked ':''); ?>/> <?php echo __('Wrap summary values with &lt;![CDATA[ ... ]]&gt; tags', 'powerpress'); ?>
819
- </div>
820
- </td>
821
- </tr>
822
-
823
- <?php
824
- if( !empty($General['advanced_mode_2']) )
825
- {
826
- ?>
827
- <tr valign="top">
828
- <th scope="row">
829
-
830
- <?php echo __('iTunes Episode Summary', 'powerpress'); ?></th>
831
- <td>
832
- <div style="margin-top: 15px;"><input type="checkbox" name="Feed[enhance_itunes_summary]" value="1" <?php echo ( !empty($FeedSettings['enhance_itunes_summary'])?'checked ':''); ?>/> <?php echo __('Optimize iTunes Summary from Blog Posts', 'powerpress'); ?>
833
- </div>
834
- <p>
835
- <?php echo __('Creates a friendlier view of your post/episode content.', 'powerpress'); ?>
836
- </p>
837
- </td>
838
- </tr>
839
- </table>
840
-
841
-
842
- <table class="form-table">
843
- <?php
844
- if( !empty($FeedSettings['itunes_keywords']) )
845
- {
846
- ?>
847
- <tr valign="top">
848
- <th scope="row">
849
- <?php echo __('iTunes Program Keywords', 'powerpress'); ?> <br />
850
- </th>
851
- <td>
852
- <input type="text" name="Feed[itunes_keywords]" style="width: 60%;" value="<?php echo esc_attr($FeedSettings['itunes_keywords']); ?>" maxlength="255" />
853
- <p><?php echo __('Feature Deprecated by Apple. Keywords above are for your reference only.', 'powerpress'); ?></p>
854
- </td>
855
- </tr>
856
- <?php
857
- } // End iTunes keywords
858
- } // end advanced mode
859
- ?>
860
-
861
- <tr valign="top">
862
- <th scope="row">
863
- <?php echo __('iTunes Category', 'powerpress'); ?>
864
- <span class="powerpress-required"><?php echo __('Required', 'powerpress'); ?></span>
865
- </th>
866
- <td>
867
- <select name="Feed[itunes_cat_1]" class="bpp_input_med">
868
- <?php
869
-
870
- $MoreCategories = false;
871
- if( !empty($FeedSettings['itunes_cat_2']) )
872
- $MoreCategories = true;
873
- else if( !empty($FeedSettings['itunes_cat_3']) )
874
- $MoreCategories = true;
875
-
876
- $Categories = powerpress_itunes_categories(true);
877
-
878
- echo '<option value="">'. __('Select Category', 'powerpress') .'</option>';
879
-
880
- foreach( $Categories as $value=> $desc )
881
- echo "\t<option value=\"$value\"". ($FeedSettings['itunes_cat_1']==$value?' selected':''). ">".htmlspecialchars($desc)."</option>\n";
882
-
883
- reset($Categories);
884
- ?>
885
- </select>
886
- <?php
887
- if( !$MoreCategories && empty($General['seo_itunes']) ) { ?>
888
- <a href="#" onclick="document.getElementById('more_itunes_cats').style.display='block';return false;"><?php echo __('more', 'powerpress'); ?></a>
889
- <?php } ?>
890
- <p>
891
- <?php echo __('The category above is where you will appear when browsing iTunes.', 'powerpress'); ?>
892
- </p>
893
- </td>
894
- </tr>
895
- </table>
896
-
897
-
898
- <!-- start advanced features -->
899
- <div id="more_itunes_cats" style="display: <?php echo ( ($MoreCategories||!empty($General['seo_itunes']) )?'block':'none'); ?>;">
900
- <table class="form-table">
901
- <tr valign="top">
902
- <th scope="row">
903
- <?php echo __('iTunes Category 2', 'powerpress'); ?>
904
- </th>
905
- <td>
906
- <select name="Feed[itunes_cat_2]" class="bpp_input_med">
907
- <?php
908
-
909
-
910
- echo '<option value="">'. __('Select Category', 'powerpress') .'</option>';
911
- foreach( $Categories as $value=> $desc )
912
- echo "\t<option value=\"$value\"". ($FeedSettings['itunes_cat_2']==$value?' selected':''). ">".htmlspecialchars($desc)."</option>\n";
913
-
914
- reset($Categories);
915
-
916
- ?>
917
- </select>
918
- <?php if( !empty($General['seo_itunes']) ) { ?>
919
- <p>
920
- <em><?php echo __('Podcasting SEO Suggestion: Select a second category.', 'powerpress'); ?></em>
921
- </p>
922
- <?php } ?>
923
-
924
- </td>
925
- </tr>
926
-
927
- <tr valign="top">
928
- <th scope="row">
929
- <?php echo __('iTunes Category 3', 'powerpress'); ?>
930
- </th>
931
- <td>
932
- <select name="Feed[itunes_cat_3]" class="bpp_input_med">
933
- <?php
934
-
935
- echo '<option value="">'. __('Select Category', 'powerpress') .'</option>';
936
- foreach( $Categories as $value=> $desc )
937
- echo "\t<option value=\"$value\"". ($FeedSettings['itunes_cat_3']==$value?' selected':''). ">".htmlspecialchars($desc)."</option>\n";
938
-
939
- reset($Categories);
940
- ?>
941
- </select>
942
- <?php if( !empty($General['seo_itunes']) ) { ?>
943
- <p>
944
- <em><?php echo __('Podcasting SEO Suggestion: Select a third category.', 'powerpress'); ?></em>
945
- </p>
946
- <?php } ?>
947
- </td>
948
- </tr>
949
- </table>
950
- </div>
951
- <!-- end advanced features -->
952
-
953
-
954
- <table class="form-table">
955
- <tr valign="top">
956
- <th scope="row">
957
- <?php echo __('iTunes Explicit', 'powerpress'); ?>
958
- <span class="powerpress-required"><?php echo __('Required', 'powerpress'); ?></span>
959
- </th>
960
- <td>
961
- <select name="Feed[itunes_explicit]" style="width: 70%;">
962
- <?php
963
- $explicit = array(0=> __('No option selected', 'powerpress'), 1=>__('Yes - explicit content', 'powerpress'), 2=>__('Clean - no explicit content', 'powerpress'));
964
-
965
- foreach( $explicit as $value=> $desc )
966
- echo "\t<option value=\"$value\"". ($FeedSettings['itunes_explicit']==$value?' selected':''). (($FeedSettings['itunes_explicit']!=0&&$value==0)?'disabled':''). ">$desc</option>\n";
967
-
968
- ?>
969
- </select>
970
- <p>
971
- <em><?php echo __('Note: As of February, 2016, you must select either Yes or Clean.', 'powerpress'); ?></em>
972
- </p>
973
- </td>
974
- </tr>
975
- <?php if( !empty($General['advanced_mode_2']) ) { ?>
976
- <!-- start advanced features -->
977
- <tr valign="top">
978
- <th scope="row">
979
- <?php echo __('iTunes Author Name', 'powerpress'); ?>
980
- </th>
981
- <td>
982
- <input type="text" name="Feed[itunes_talent_name]" class="bpp_input_med" value="<?php echo esc_attr($FeedSettings['itunes_talent_name']); ?>" maxlength="255" /><br />
983
- <div><input type="checkbox" name="Feed[itunes_author_post]" value="1" <?php echo ( !empty($FeedSettings['itunes_author_post'])?'checked ':''); ?>/> <?php echo __('Use blog post author\'s name for individual episodes.', 'powerpress'); ?></div>
984
-
985
- <?php if( !empty($General['seo_itunes']) ) { ?>
986
- <p>
987
- <em><?php echo __('Podcasting SEO Suggestion: Include talent names and nicknames not mentioned in the show title.', 'powerpress'); ?></em>
988
- </p>
989
- <?php } ?>
990
- </td>
991
- </tr>
992
- <!-- end advanced features -->
993
- <?php } ?>
994
-
995
- <tr valign="top">
996
- <th scope="row">
997
- <?php echo __('iTunes Email', 'powerpress'); ?>
998
- <span class="powerpress-required"><?php echo __('Required', 'powerpress'); ?></span>
999
- </th>
1000
- <td>
1001
- <input type="text" name="Feed[email]" class="bpp_input_med" value="<?php echo esc_attr($FeedSettings['email']); ?>" maxlength="255" />
1002
- <div>(<?php echo __('iTunes will email this address when your podcast is accepted into the iTunes Directory.', 'powerpress'); ?>)</div>
1003
- </td>
1004
- </tr>
1005
-
1006
- <?php if( empty($General['ios11_fields']) || $General['ios11_fields'] == 1 ) { ?>
1007
- <tr valign="top">
1008
- <th scope="row">
1009
- <?php echo __('iTunes Type', 'powerpress'); ?>
1010
- </th>
1011
- <td>
1012
- <select name="Feed[itunes_type]" class="bpp_input_med">
1013
- <?php
1014
- $types = array(''=> __('No option selected', 'powerpress'), 'episodic'=>__('Episodic (default)', 'powerpress'), 'serial'=>__('Serial', 'powerpress'));
1015
-
1016
- foreach( $types as $value=> $desc )
1017
- echo "\t<option value=\"$value\"". ($FeedSettings['itunes_type']==$value?' selected':''). ">$desc</option>\n";
1018
-
1019
- ?>
1020
- </select>
1021
- <p>
1022
- <em><?php echo __('Episodic: displays latest episode first.', 'powerpress'); ?></em>
1023
- </p>
1024
- <p>
1025
- <em><?php echo __('Serial: displays latest episode last.', 'powerpress'); ?></em>
1026
- </p>
1027
- </td>
1028
- </tr>
1029
- <?php } // end type ?>
1030
- </table>
1031
-
1032
- <?php if( !empty($General['advanced_mode_2']) ) { ?>
1033
- <!-- start advanced features -->
1034
- <table class="form-table">
1035
- <tr valign="top">
1036
- <th scope="row" >
1037
-
1038
- <?php echo __('iTunes New Feed URL', 'powerpress'); ?></th>
1039
- <td>
1040
- <div id="new_feed_url_step_1" style="display: <?php echo ( !empty($FeedSettings['itunes_new_feed_url']) || !empty($FeedSettings['itunes_new_feed_url_podcast']) ?'none':'block'); ?>;">
1041
- <p style="margin-top: 5px;"><strong><a href="#" onclick="return powerpress_new_feed_url_prompt();"><?php echo __('Set iTunes New Feed URL', 'powerpress'); ?></a></strong></p>
1042
- <p><strong>
1043
- <?php echo __('The iTunes New Feed URL option works primarily for Apple\'s iTunes application only, and should only be used if you are unable to implement a HTTP 301 redirect.', 'powerpress'); ?>
1044
- <?php echo __('A 301 redirect will route <u>all podcast clients including iTunes</u> to your new feed address.', 'powerpress'); ?>
1045
- </strong>
1046
- </p>
1047
- <p>
1048
- <?php echo __('Learn more:', 'powerpress'); ?> <a href="https://create.blubrry.com/manual/syndicating-your-podcast-rss-feeds/changing-your-podcast-rss-feed-address-url/" target="_blank"><?php echo __('Changing Your Podcast RSS Feed Address (URL)', 'powerpress'); ?></a>
1049
- </p>
1050
- </div>
1051
- <div id="new_feed_url_step_2" style="display: <?php echo ( !empty($FeedSettings['itunes_new_feed_url']) || !empty($FeedSettings['itunes_new_feed_url_podcast']) ?'block':'none'); ?>;">
1052
- <p style="margin-top: 5px;"><strong><?php echo __('WARNING: Changes made here are permanent. If the New Feed URL entered is incorrect, you will lose subscribers and will no longer be able to update your listing in the iTunes Store.', 'powerpress'); ?></strong></p>
1053
- <p><strong><?php echo __('DO NOT MODIFY THIS SETTING UNLESS YOU ABSOLUTELY KNOW WHAT YOU ARE DOING.', 'powerpress'); ?></strong></p>
1054
- <p>
1055
- <?php echo htmlspecialchars( sprintf(__('Apple recommends you maintain the %s tag in your feed for at least two weeks to ensure that most subscribers will receive the new New Feed URL.', 'powerpress'), '<itunes:new-feed-url>' ) ); ?>
1056
- </p>
1057
- <p>
1058
- <?php
1059
- $FeedName = __('Main RSS2 feed', 'powerpress');
1060
- $FeedURL = get_feed_link('rss2');
1061
- if( $cat_ID )
1062
- {
1063
- $category = get_category_to_edit($cat_ID);
1064
- $FeedName = sprintf( __('%s category feed', 'powerpress'), htmlspecialchars($category->name) );
1065
- if( !empty($General['cat_casting_podcast_feeds']) )
1066
- $FeedURL = get_category_feed_link($cat_ID, 'podcast');
1067
- else
1068
- $FeedURL = get_category_feed_link($cat_ID);
1069
- }
1070
- else if( $feed_slug )
1071
- {
1072
- if( !empty($General['custom_feeds'][ $feed_slug ]) )
1073
- $FeedName = $General['custom_feeds'][ $feed_slug ];
1074
- else
1075
- $FeedName = __('Podcast', 'powerpress');
1076
- $FeedName = trim($FeedName).' '.__('feed', 'powerpress');
1077
- $FeedURL = get_feed_link($feed_slug);
1078
- }
1079
- else if( $FeedAttribs['type'] == 'ttid' )
1080
- {
1081
- $term_object = get_term_to_edit($FeedAttribs['term_id'],$FeedAttribs['taxonomy_type']);
1082
- $FeedName = sprintf( __('%s taxonomy term feed', 'powerpress'), htmlspecialchars($term_object->name) );
1083
- $FeedURL = get_term_feed_link($FeedAttribs['term_id'],$FeedAttribs['taxonomy_type'], 'rss2');
1084
- }
1085
-
1086
- echo sprintf(__('The New Feed URL value below will be applied to the %s (%s).', 'powerpress'), $FeedName, $FeedURL);
1087
- ?>
1088
- </p>
1089
- <p style="margin-bottom: 0;">
1090
- <label style="width: 25%; float:left; display:block; font-weight: bold;"><?php echo __('New Feed URL', 'powerpress'); ?></label>
1091
- <input type="text" name="Feed[itunes_new_feed_url]" style="width: 55%;" value="<?php echo esc_attr($FeedSettings['itunes_new_feed_url']); ?>" maxlength="255" />
1092
- </p>
1093
- <p style="margin-left: 25%;margin-top: 0;font-size: 90%;">(<?php echo __('Leave blank for no New Feed URL', 'powerpress'); ?>)</p>
1094
-
1095
- <p><a href="https://create.blubrry.com/manual/syndicating-your-podcast-rss-feeds/changing-your-podcast-rss-feed-address-url/" target="_blank"><?php echo __('More information regarding the iTunes New Feed URL is available here.', 'powerpress'); ?></a></p>
1096
- <p>
1097
- <?php
1098
- if( !$cat_ID && !$feed_slug )
1099
- {
1100
- if( empty($General['channels']) )
1101
- echo sprintf(__('Please activate the \'Custom Podcast Channels\' Advanced Option to set the new-feed-url for your podcast only feed (%s)', 'powerpress'), get_feed_link('podcast') );
1102
- else
1103
- echo sprintf(__('Please navigate to the \'Custom Podcast Channels\' section to set the new-feed-url for your podcast only feed (%s)', 'powerpress'), get_feed_link('podcast') );
1104
- }
1105
- ?>
1106
- </p>
1107
- </div>
1108
- </td>
1109
- </tr>
1110
- </table>
1111
-
1112
- <fieldset style="border: 1px dashed #333333;">
1113
- <legend style="margin: 0 20px; padding: 0 5px; font-weight: bold;"><?php echo __('Advanced Options', 'powerpress'); ?></legend>
1114
-
1115
- <div style="margin-left: 230px; margin-bottom: 10px;">
1116
- <p>
1117
- <strong style="color: #CC0000; font-weight: bold;"><?php echo __('SETTINGS BELOW HAVE PERMANENT CONSEQUENCES.', 'powerpress'); ?></strong>
1118
- </p>
1119
- <p style="margin-bottom: 0;">
1120
- <?php echo __('Feeds affected', 'powerpress'); ?>:
1121
- </p>
1122
- <div style="margin-left: 20px;">
1123
- <?php
1124
- // $General, $feed_slug=false, $cat_ID=false
1125
-
1126
- if( $feed_slug )
1127
- {
1128
- echo '<a href="';
1129
- echo esc_attr( get_feed_link($feed_slug) );
1130
- echo '" target="_blank">';
1131
- echo esc_html( get_feed_link($feed_slug) );
1132
- echo '</a>';
1133
- }
1134
- else if( $cat_ID )
1135
- {
1136
- if( !empty($General['cat_casting_podcast_feeds']) )
1137
- $feed_url = get_category_feed_link($cat_ID, 'podcast');
1138
- else
1139
- $feed_url = get_category_feed_link($cat_ID);
1140
- echo '<a href="';
1141
- echo esc_attr( $feed_url );
1142
- echo '" target="_blank">';
1143
- echo esc_html( $feed_url );
1144
- echo '</a>';
1145
- }
1146
- else
1147
- {
1148
- echo '<a href="';
1149
- echo esc_attr( get_feed_link('feed') );
1150
- echo '" target="_blank">';
1151
- echo esc_html( get_feed_link('feed') );
1152
- echo '</a>';
1153
-
1154
- if( empty($General['custom_feeds']['podcast']) )
1155
- {
1156
- echo '<br /><a href="';
1157
- echo esc_attr( get_feed_link('podcast') );
1158
- echo '" target="_blank">';
1159
- echo esc_html( get_feed_link('podcast') );
1160
- echo '</a>';
1161
- }
1162
- }
1163
-
1164
- ?>
1165
- </div>
1166
-
1167
- </div>
1168
- <div id="permanent_itunes_settings">
1169
- <table class="form-table">
1170
-
1171
- <tr valign="top">
1172
- <th scope="row" >
1173
-
1174
- <span style="margin-left: 10px;"><?php echo __('iTunes Block', 'powerpress'); ?></span></th>
1175
- <td>
1176
- <input type="checkbox" name="Feed[itunes_block]" value="1" <?php if( !empty($FeedSettings['itunes_block']) ) echo 'checked'; ?> />
1177
- <?php echo __('Prevent the entire podcast from appearing in the iTunes Podcast directory.', 'powerpress'); ?>
1178
- </td>
1179
- </tr>
1180
-
1181
- <tr valign="top">
1182
- <th scope="row" >
1183
-
1184
- <span style="margin-left: 10px;"><?php echo __('iTunes Complete', 'powerpress'); ?></span></th>
1185
- <td>
1186
- <input type="checkbox" name="Feed[itunes_complete]" value="1" <?php if( !empty($FeedSettings['itunes_complete']) ) echo 'checked'; ?> />
1187
- <?php echo __('Indicate the completion of a podcast. iTunes will no longer update your listing in the iTunes Podcast directory.', 'powerpress'); ?>
1188
- </td>
1189
- </tr>
1190
- </table>
1191
- </div>
1192
- </fieldset>
1193
- <!-- end advanced features -->
1194
- <?php } // end other advanced options ?>
1195
- <?php
1196
- }
1197
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1198
  ?>
1
+ <?php
2
+
3
+ if( !function_exists('add_action') )
4
+ die("access denied.");
5
+
6
+ function powerpress_languages()
7
+ {
8
+ // List copied from PodPress:
9
+ $langs = array();
10
+ $langs['af'] = __('Afrikaans', 'powerpress');
11
+ $langs['sq'] = __('Albanian', 'powerpress');
12
+ $langs['ar'] = __('Arabic', 'powerpress');
13
+ $langs['ar-sa'] = __('Arabic (Saudi Arabia)', 'powerpress');
14
+ $langs['ar-eg'] = __('Arabic (Egypt)', 'powerpress');
15
+ $langs['ar-dz'] = __('Arabic (Algeria)', 'powerpress');
16
+ $langs['ar-tn'] = __('Arabic (Tunisia)', 'powerpress');
17
+ $langs['ar-ye'] = __('Arabic (Yemen)', 'powerpress');
18
+ $langs['ar-jo'] = __('Arabic (Jordan)', 'powerpress');
19
+ $langs['ar-kw'] = __('Arabic (Kuwait)', 'powerpress');
20
+ $langs['ar-bh'] = __('Arabic (Bahrain)', 'powerpress');
21
+ $langs['eu'] = __('Basque', 'powerpress');
22
+ $langs['be'] = __('Belarusian', 'powerpress');
23
+ $langs['bg'] = __('Bulgarian', 'powerpress');
24
+ $langs['ca'] = __('Catalan', 'powerpress');
25
+ $langs['zh-cn'] = __('Chinese (Simplified)', 'powerpress');
26
+ $langs['zh-tw'] = __('Chinese (Traditional)', 'powerpress');
27
+ $langs['hr'] = __('Croatian', 'powerpress');
28
+ $langs['cs'] = __('Czech', 'powerpress');
29
+ $langs['cr'] = __('Cree', 'powerpress');
30
+ $langs['da'] = __('Danish', 'powerpress');
31
+ $langs['nl'] = __('Dutch', 'powerpress');
32
+ $langs['nl-be'] = __('Dutch (Belgium)', 'powerpress');
33
+ $langs['nl-nl'] = __('Dutch (Netherlands)', 'powerpress');
34
+ $langs['en'] = __('English', 'powerpress');
35
+ $langs['en-au'] = __('English (Australia)', 'powerpress');
36
+ $langs['en-bz'] = __('English (Belize)', 'powerpress');
37
+ $langs['en-ca'] = __('English (Canada)', 'powerpress');
38
+ $langs['en-ie'] = __('English (Ireland)', 'powerpress');
39
+ $langs['en-jm'] = __('English (Jamaica)', 'powerpress');
40
+ $langs['en-nz'] = __('English (New Zealand)', 'powerpress');
41
+ $langs['en-ph'] = __('English (Phillipines)', 'powerpress');
42
+ $langs['en-za'] = __('English (South Africa)', 'powerpress');
43
+ $langs['en-tt'] = __('English (Trinidad)', 'powerpress');
44
+ $langs['en-gb'] = __('English (United Kingdom)', 'powerpress');
45
+ $langs['en-us'] = __('English (United States)', 'powerpress');
46
+ $langs['en-zw'] = __('English (Zimbabwe)', 'powerpress');
47
+ $langs['et'] = __('Estonian', 'powerpress');
48
+ $langs['fo'] = __('Faeroese', 'powerpress');
49
+ $langs['fi'] = __('Finnish', 'powerpress');
50
+ $langs['fr'] = __('French', 'powerpress');
51
+ $langs['fr-be'] = __('French (Belgium)', 'powerpress');
52
+ $langs['fr-ca'] = __('French (Canada)', 'powerpress');
53
+ $langs['fr-fr'] = __('French (France)', 'powerpress');
54
+ $langs['fr-lu'] = __('French (Luxembourg)', 'powerpress');
55
+ $langs['fr-mc'] = __('French (Monaco)', 'powerpress');
56
+ $langs['fr-ch'] = __('French (Switzerland)', 'powerpress');
57
+ $langs['gl'] = __('Galician', 'powerpress');
58
+ $langs['gd'] = __('Gaelic', 'powerpress');
59
+ $langs['de'] = __('German', 'powerpress');
60
+ $langs['de-at'] = __('German (Austria)', 'powerpress');
61
+ $langs['de-de'] = __('German (Germany)', 'powerpress');
62
+ $langs['de-li'] = __('German (Liechtenstein)', 'powerpress');
63
+ $langs['de-lu'] = __('German (Luxembourg)', 'powerpress');
64
+ $langs['de-ch'] = __('German (Switzerland)', 'powerpress');
65
+ $langs['el'] = __('Greek', 'powerpress');
66
+ $langs['haw'] = __('Hawaiian', 'powerpress');
67
+ $langs['he_IL'] = __('Hebrew', 'powerpress');
68
+ $langs['hu'] = __('Hungarian', 'powerpress');
69
+ $langs['is'] = __('Icelandic', 'powerpress');
70
+ $langs['in'] = __('Indonesian', 'powerpress');
71
+ $langs['ga'] = __('Irish', 'powerpress');
72
+ $langs['it'] = __('Italian', 'powerpress');
73
+ $langs['hi'] = __('Hindi', 'powerpress');
74
+ $langs['it-it'] = __('Italian (Italy)', 'powerpress');
75
+ $langs['it-ch'] = __('Italian (Switzerland)', 'powerpress');
76
+ $langs['ja'] = __('Japanese', 'powerpress');
77
+ $langs['ko'] = __('Korean', 'powerpress');
78
+ $langs['mk'] = __('Macedonian', 'powerpress');
79
+ $langs['no'] = __('Norwegian', 'powerpress');
80
+ $langs['pa'] = __('Punjabi', 'powerpress');
81
+ $langs['pl'] = __('Polish', 'powerpress');
82
+ $langs['pt'] = __('Portuguese', 'powerpress');
83
+ $langs['pt-br'] = __('Portuguese (Brazil)', 'powerpress');
84
+ $langs['pt-pt'] = __('Portuguese (Portugal)', 'powerpress');
85
+ $langs['ro'] = __('Romanian', 'powerpress');
86
+ $langs['ro-mo'] = __('Romanian (Moldova)', 'powerpress');
87
+ $langs['ro-ro'] = __('Romanian (Romania)', 'powerpress');
88
+ $langs['ru'] = __('Russian', 'powerpress');
89
+ $langs['ru-mo'] = __('Russian (Moldova)', 'powerpress');
90
+ $langs['ru-ru'] = __('Russian (Russia)', 'powerpress');
91
+ $langs['sr'] = __('Serbian', 'powerpress');
92
+ $langs['sk'] = __('Slovak', 'powerpress');
93
+ $langs['sl'] = __('Slovenian', 'powerpress');
94
+ $langs['es'] = __('Spanish', 'powerpress');
95
+ $langs['es-ar'] = __('Spanish (Argentina)', 'powerpress');
96
+ $langs['es-bo'] = __('Spanish (Bolivia)', 'powerpress');
97
+ $langs['es-cl'] = __('Spanish (Chile)', 'powerpress');
98
+ $langs['es-co'] = __('Spanish (Colombia)', 'powerpress');
99
+ $langs['es-cr'] = __('Spanish (Costa Rica)', 'powerpress');
100
+ $langs['es-do'] = __('Spanish (Dominican Republic)', 'powerpress');
101
+ $langs['es-ec'] = __('Spanish (Ecuador)', 'powerpress');
102
+ $langs['es-sv'] = __('Spanish (El Salvador)', 'powerpress');
103
+ $langs['es-gt'] = __('Spanish (Guatemala)', 'powerpress');
104
+ $langs['es-hn'] = __('Spanish (Honduras)', 'powerpress');
105
+ $langs['es-mx'] = __('Spanish (Mexico)', 'powerpress');
106
+ $langs['es-ni'] = __('Spanish (Nicaragua)', 'powerpress');
107
+ $langs['es-pa'] = __('Spanish (Panama)', 'powerpress');
108
+ $langs['es-py'] = __('Spanish (Paraguay)', 'powerpress');
109
+ $langs['es-pe'] = __('Spanish (Peru)', 'powerpress');
110
+ $langs['es-pr'] = __('Spanish (Puerto Rico)', 'powerpress');
111
+ $langs['es-es'] = __('Spanish (Spain)', 'powerpress');
112
+ $langs['es-uy'] = __('Spanish (Uruguay)', 'powerpress');
113
+ $langs['es-ve'] = __('Spanish (Venezuela)', 'powerpress');
114
+ $langs['sv'] = __('Swedish', 'powerpress');
115
+ $langs['sv-fi'] = __('Swedish (Finland)', 'powerpress');
116
+ $langs['sv-se'] = __('Swedish (Sweden)', 'powerpress');
117
+ $langs['ta'] = __('Tamil', 'powerpress');
118
+ $langs['th'] = __('Thai', 'powerpress');
119
+ $langs['bo'] = __('Tibetan', 'powerpress');
120
+ $langs['tr'] = __('Turkish', 'powerpress');
121
+ $langs['uk'] = __('Ukranian', 'powerpress');
122
+ $langs['ve'] = __('Venda', 'powerpress');
123
+ $langs['vi'] = __('Vietnamese', 'powerpress');
124
+ $langs['zu'] = __('Zulu', 'powerpress');
125
+
126
+ return $langs;
127
+ }
128
+
129
+ function powerpress_admin_capabilities()
130
+ {
131
+ global $wp_roles;
132
+
133
+ $capnames = array();
134
+ // Get Role List
135
+ foreach($wp_roles->role_objects as $key => $role) {
136
+ foreach($role->capabilities as $cap => $grant) {
137
+ $capnames[$cap] = ucwords( str_replace('_', ' ', $cap) );
138
+ }
139
+ }
140
+
141
+ $capnames = apply_filters( 'powerpress_admin_capabilities', array_unique($capnames) );
142
+
143
+ $remove_keys = array('level_0', 'level_1', 'level_2', 'level_3', 'level_4', 'level_5', 'level_6', 'level_7', 'level_8', 'level_9', 'level_10');
144
+ foreach( $remove_keys as $null=> $key )
145
+ unset($capnames[ $key ]);
146
+ asort($capnames);
147
+ return $capnames;
148
+ }
149
+
150
+
151
+ // powerpressadmin_editfeed.php
152
+ function powerpress_admin_editfeed($type='', $type_value = '', $feed_slug = false)
153
+ {
154
+ $SupportUploads = powerpressadmin_support_uploads();
155
+ $General = powerpress_get_settings('powerpress_general');
156
+ $FeedAttribs = array('type'=>$type, 'feed_slug'=>'', 'category_id'=>0, 'term_taxonomy_id'=>0, 'term_id'=>0, 'taxonomy_type'=>'', 'post_type'=>'');
157
+ $cat_ID = false; $term_taxonomy_id = false;
158
+
159
+
160
+ $FeedTitle = __('Feed Settings', 'powerpress');
161
+
162
+ switch( $type )
163
+ {
164
+ case 'channel': {
165
+ $feed_slug = $type_value;
166
+ $FeedAttribs['feed_slug'] = $type_value;
167
+ $FeedSettings = powerpress_get_settings('powerpress_feed_'.$feed_slug);
168
+ if( !$FeedSettings && $type_value == 'podcast' ) // We are editing the default podcast channel
169
+ {
170
+ $FeedSettings = powerpress_get_settings('powerpress_feed');
171
+ }
172
+
173
+ if( !$FeedSettings )
174
+ {
175
+ $FeedSettings = array();
176
+ $FeedSettings['title'] = '';
177
+ if( !empty($General['custom_feeds'][$feed_slug]) )
178
+ $FeedSettings['title'] = $General['custom_feeds'][$feed_slug];
179
+ }
180
+ $FeedSettings = powerpress_default_settings($FeedSettings, 'editfeed_custom');
181
+
182
+ if( !isset($General['custom_feeds'][$feed_slug]) )
183
+ $General['custom_feeds'][$feed_slug] = __('Podcast (default)', 'powerpress');
184
+
185
+ $FeedTitle = sprintf( 'Podcast Settings for Channel: %s', htmlspecialchars($General['custom_feeds'][$feed_slug]) );
186
+ echo sprintf('<input type="hidden" name="feed_slug" value="%s" />', $feed_slug);
187
+ echo '<input type="hidden" name="action" value="powerpress-save-channel" />';
188
+
189
+ }; break;
190
+ case 'category': {
191
+ $cat_ID = $type_value;
192
+ $FeedAttribs['category_id'] = $type_value;
193
+ $FeedSettings = powerpress_get_settings('powerpress_cat_feed_'.$cat_ID);
194
+ $FeedSettings = powerpress_default_settings($FeedSettings, 'editfeed_custom');
195
+
196
+ $category = get_category_to_edit($cat_ID);
197
+ $FeedTitle = sprintf( __('Podcast Settings for Category: %s', 'powerpress'), htmlspecialchars($category->name) );
198
+ echo sprintf('<input type="hidden" name="cat" value="%s" />', $cat_ID);
199
+ echo '<input type="hidden" name="action" value="powerpress-save-category" />';
200
+
201
+ }; break;
202
+ case 'ttid': {
203
+ $term_taxonomy_id = $type_value;
204
+ $FeedAttribs['term_taxonomy_id'] = $type_value;
205
+ $FeedSettings = powerpress_get_settings('powerpress_taxonomy_'.$term_taxonomy_id);
206
+ $FeedSettings = powerpress_default_settings($FeedSettings, 'editfeed_custom');
207
+
208
+ global $wpdb;
209
+ $term_info = $wpdb->get_results("SELECT term_id, taxonomy FROM $wpdb->term_taxonomy WHERE term_taxonomy_id = $term_taxonomy_id", ARRAY_A);
210
+ if( !empty( $term_info[0]['term_id']) ) {
211
+ $term_ID = $term_info[0]['term_id'];
212
+ $taxonomy_type = $term_info[0]['taxonomy'];
213
+ $FeedAttribs['term_id'] = $term_ID;
214
+ $FeedAttribs['taxonomy_type'] = $taxonomy_type;
215
+
216
+ $term_object = get_term_to_edit($term_ID, $taxonomy_type);
217
+ $FeedTitle = sprintf( __('Podcast Settings for Taxonomy Term: %s', 'powerpress'), htmlspecialchars($term_object->name));
218
+ }
219
+ else
220
+ {
221
+ $FeedTitle = sprintf( __('Podcast Settings for Taxonomy Term: %s', 'powerpress'), 'Term ID '.htmlspecialchars($term_taxonomy_id));
222
+ }
223
+ echo sprintf('<input type="hidden" name="ttid" value="%s" />', $term_taxonomy_id);
224
+ echo '<input type="hidden" name="action" value="powerpress-save-ttid" />';
225
+
226
+ }; break;
227
+ case 'post_type': {
228
+
229
+ $FeedAttribs['post_type'] = $type_value;
230
+ $FeedAttribs['feed_slug'] = $feed_slug;
231
+ $FeedSettingsArray = powerpress_get_settings('powerpress_posttype_'.$FeedAttribs['post_type']);
232
+ if( !is_array($FeedSettingsArray[ $feed_slug ]) )
233
+ $FeedSettingsArray[ $feed_slug ] = array();
234
+ $FeedSettings = powerpress_default_settings($FeedSettingsArray[ $feed_slug ], 'editfeed_custom');
235
+
236
+ //$category = get_category_to_edit($cat_ID);
237
+ $PostTypeTitle = $FeedAttribs['post_type']; // TODO: Get readable title of post type
238
+ $FeedTitle = sprintf( __('Podcast Settings for Post Type %s with slug %s', 'powerpress'), htmlspecialchars($PostTypeTitle) , htmlspecialchars($feed_slug));
239
+ echo sprintf('<input type="hidden" name="podcast_post_type" value="%s" />', $FeedAttribs['post_type']);
240
+ echo sprintf('<input type="hidden" name="feed_slug" value="%s" />', $feed_slug);
241
+ echo '<input type="hidden" name="action" value="powerpress-save-post_type" />';
242
+
243
+ }; break;
244
+ default: {
245
+ $FeedSettings = powerpress_get_settings('powerpress_feed');
246
+ $FeedSettings = powerpress_default_settings($FeedSettings, 'editfeed');
247
+ echo '<input type="hidden" name="action" value="powerpress-save-settings" />';
248
+ }; break;
249
+ }
250
+
251
+
252
+ echo '<h2>'. $FeedTitle .'</h2>';
253
+
254
+ if( $cat_ID && (isset($_GET['from_categories']) || isset($_POST['from_categories'])) )
255
+ {
256
+ echo '<input type="hidden" name="from_categories" value="1" />';
257
+ }
258
+
259
+ ?>
260
+ <div id="powerpress_settings_page" class="powerpress_tabbed_content">
261
+ <ul class="powerpress_settings_tabs">
262
+ <li><a href="#feed_tab_feed"><span><?php echo htmlspecialchars(__('Feed', 'powerpress')); ?></span></a></li>
263
+ <li><a href="#feed_tab_itunes"><span><?php echo htmlspecialchars(__('Apple', 'powerpress')); ?></span></a></li>
264
+ <li><a href="#feed_tab_googleplay"><span><?php echo htmlspecialchars(__('Google', 'powerpress')); ?></span></a></li>
265
+ <li><a href="#feed_tab_artwork"><span><?php echo htmlspecialchars(__('Artwork', 'powerpress')); ?></span></a></li>
266
+ <?php if( in_array($FeedAttribs['type'], array('category', 'ttid', 'post_type', 'channel') ) ) { ?>
267
+ <li><a href="#feed_tab_appearance"><span><?php echo htmlspecialchars(__('Website', 'powerpress')); ?></span></a></li>
268
+ <?php } ?>
269
+ <li><a href="#feed_tab_destinations"><span><?php echo htmlspecialchars(__('Destinations', 'powerpress')); ?></span></a></li>
270
+
271
+ <?php if( in_array($FeedAttribs['type'], array('category', 'ttid', 'post_type', 'channel') ) ) { ?>
272
+ <li><a href="#feed_tab_other"><span><?php echo htmlspecialchars(__('Other Settings', 'powerpress')); ?></span></a></li>
273
+ <?php } ?>
274
+ </ul>
275
+
276
+
277
+ <div id="feed_tab_feed" class="powerpress_tab">
278
+ <?php
279
+ powerpressadmin_edit_feed_settings($FeedSettings, $General, $FeedAttribs );
280
+ if( !empty($General['advanced_mode_2']) ) {
281
+ powerpressadmin_edit_funding($FeedSettings, $feed_slug);
282
+ powerpressadmin_edit_tv($FeedSettings, $feed_slug);
283
+ }
284
+ ?>
285
+ </div>
286
+
287
+ <div id="feed_tab_itunes" class="powerpress_tab">
288
+ <?php
289
+ powerpressadmin_edit_itunes_feed($FeedSettings, $General, $FeedAttribs);
290
+ ?>
291
+ </div>
292
+
293
+ <div id="feed_tab_googleplay" class="powerpress_tab">
294
+ <?php
295
+ powerpressadmin_edit_googleplay($FeedSettings, $General, $FeedAttribs);
296
+ ?>
297
+ </div>
298
+
299
+ <div id="feed_tab_artwork" class="powerpress_tab">
300
+ <?php
301
+ powerpressadmin_edit_artwork($FeedSettings, $General);
302
+ ?>
303
+ </div>
304
+
305
+ <?php if( $feed_slug || $FeedAttribs['type'] == 'category' || $FeedAttribs['type'] == 'ttid' ) { ?>
306
+ <div id="feed_tab_appearance" class="powerpress_tab">
307
+ <?php
308
+ //powerpressadmin_appearance($General);
309
+ //if( $feed_slug )
310
+ // powerpressadmin_edit_appearance_feed($General, $FeedSettings, $feed_slug, $FeedAttribs);
311
+
312
+ powerpressadmin_settings_tab_appearance($General, $FeedSettings, $FeedAttribs);
313
+ ?>
314
+ </div>
315
+
316
+ <div id="feed_tab_destinations" class="powerpress_tab">
317
+ <?php
318
+ powerpressadmin_edit_destinations($FeedSettings, $General, $FeedAttribs);
319
+ ?>
320
+ </div>
321
+
322
+ <div id="feed_tab_other" class="powerpress_tab">
323
+ <?php
324
+ powerpressadmin_settings_tab_other($General, $FeedSettings, $feed_slug, $cat_ID, $FeedAttribs)
325
+ ?>
326
+ </div>
327
+ <?php } ?>
328
+
329
+ </div>
330
+ <div class="clear"></div>
331
+ <?php
332
+
333
+
334
+ }
335
+
336
+ function powerpressadmin_edit_podcast_channel($FeedSettings, $General)
337
+ {
338
+ // TODO
339
+ ?>
340
+ <input type="hidden" name="action" value="powerpress-save-customfeed" />
341
+ <p style="margin-bottom: 0;">
342
+ <?php echo __('Configure your custom podcast feed.', 'powerpress'); ?>
343
+ </p>
344
+ <?php
345
+ }
346
+
347
+ function powerpressadmin_edit_category_feed($FeedSettings, $General)
348
+ {
349
+ ?>
350
+ <input type="hidden" name="action" value="powerpress-save-categoryfeedsettings" />
351
+ <p style="margin-bottom: 0;">
352
+ <?php echo __('Configure your category feed to support podcasting.', 'powerpress'); ?>
353
+ </p>
354
+ <?php
355
+ }
356
+
357
+ function powerpressadmin_edit_feed_general($FeedSettings, $General)
358
+ {
359
+ $warning = '';
360
+ $episode_count = powerpress_get_episode_count('podcast');
361
+ if( $episode_count == 0 )
362
+ {
363
+ $warning = __('WARNING: You must create at least one podcast episode for your podcast feed to be valid.', 'powerpress');
364
+ }
365
+
366
+ if( !isset($FeedSettings['apply_to']) )
367
+ $FeedSettings['apply_to'] = 1;
368
+ ?>
369
+ <h3><?php echo __('Podcast Feeds', 'powerpress'); ?></h3>
370
+ <table class="form-table">
371
+
372
+ <tr valign="top">
373
+ <th scope="row">
374
+
375
+ <?php echo __('Enhance Feeds', 'powerpress'); ?></th>
376
+ <td>
377
+ <ul>
378
+ <li><p><label><input type="radio" name="Feed[apply_to]" value="1" <?php if( $FeedSettings['apply_to'] == 1 ) echo 'checked'; ?> /> <?php echo __('Enhance All Feeds', 'powerpress'); ?></label> (<?php echo __('Recommended', 'powerpress'); ?>)</p>
379
+ <p style="font-size: 100%; margin: 0 0 0 30px;"><?php echo __('Adds podcasting support to all feeds', 'powerpress'); ?></p>
380
+ </li>
381
+ <li><p><label><input type="radio" name="Feed[apply_to]" value="2" <?php if( $FeedSettings['apply_to'] == 2 ) echo 'checked'; ?> /> <?php echo __('Enhance Main Feed Only', 'powerpress'); ?></label></p>
382
+ <p style="font-size: 100%; margin: 0 0 0 30px;"><?php echo __('Adds podcasting support to your main feed only', 'powerpress'); ?></p></li>
383
+ <li><p><label><input type="radio" name="Feed[apply_to]" value="0" <?php if( $FeedSettings['apply_to'] == 0 ) echo 'checked'; ?> /> <?php echo __('Do Not Enhance Feeds', 'powerpress'); ?></label></p>
384
+ <p style="font-size: 100%; margin: 0 0 0 30px;"><?php echo __('Feed Settings below will only apply to your podcast channel feeds', 'powerpress'); ?></p></li>
385
+ </ul>
386
+ </td>
387
+ </tr>
388
+ <tr valign="top">
389
+ <th scope="row">
390
+
391
+ <?php echo __('Podcast Feeds', 'powerpress'); ?></th>
392
+ <td>
393
+ <?php if( $warning ) { ?>
394
+ <span class="powerpress-error" style="background-color: #FFEBE8; border-color: #CC0000; padding: 6px 10px;"><?php echo $warning; ?></span>
395
+ <?php } ?>
396
+ <?php
397
+
398
+ //$General = get_option('powerpress_general');
399
+ $Feeds = array('podcast'=> __('Special Podcast only Feed', 'powerpress') );
400
+ if( isset($General['custom_feeds']['podcast']) )
401
+ $Feeds = $General['custom_feeds'];
402
+ else if( isset($General['custom_feeds'])&& is_array($General['custom_feeds']) )
403
+ $Feeds += $General['custom_feeds'];
404
+
405
+ foreach( $Feeds as $feed_slug=> $feed_title )
406
+ {
407
+ if( empty($feed_title) )
408
+ $feed_title = $feed_slug;
409
+ $edit_link = admin_url( 'admin.php?page=powerpress/powerpressadmin_customfeeds.php&amp;action=powerpress-editfeed&amp;feed_slug=') . $feed_slug;
410
+ ?>
411
+ <p><?php echo $feed_title; ?>: <a href="<?php echo get_feed_link($feed_slug); ?>" title="<?php echo $feed_title; ?>" target="_blank"><?php echo get_feed_link($feed_slug); ?></a>
412
+ <?php if( defined('POWERPRESS_FEEDVALIDATOR_URL') ) { ?>
413
+ | <a href="<?php echo POWERPRESS_FEEDVALIDATOR_URL. urlencode(get_feed_link($feed_slug)); ?>" target="_blank"><?php echo __('validate', 'powerpress'); ?></a>
414
+ <?php } ?>
415
+ <?php if( false && $feed_slug != 'podcast' ) { ?>
416
+ | <a href="<?php echo $edit_link; ?>" title="<?php echo __('Edit Podcast Channel', 'powerpress'); ?>"><?php echo __('edit', 'powerpress'); ?></a>
417
+ <?php } ?>
418
+ </p>
419
+ <?php } ?>
420
+ <p><?php echo __('These are podcast only feeds suitable for submission podcast directories such as iTunes.', 'powerpress'); ?></p>
421
+ <p class="description"><?php echo __('Note: We do not recommend submitting your main site feed to podcast directories such as iTunes. iTunes and many other podcast directories work best with feeds that do not have regular blog posts mixed in.', 'powerpress'); ?></p>
422
+
423
+ <input type="hidden" name="General[feed_action_hook]" value="0" />
424
+ <p><label><input type="checkbox" name="General[feed_action_hook]" value="1" <?php if( !empty($General['feed_action_hook']) && $General['feed_action_hook'] == 1 ) echo 'checked '; ?>/> <?php echo __('Do not allow other plugins to modify podcast feeds.', 'powerpress'); ?></label></p>
425
+ <input type="hidden" name="General[feed_accel]" value="0" />
426
+ <p><label><input type="checkbox" name="General[feed_accel]" value="1" <?php if( !empty($General['feed_accel']) && $General['feed_accel'] == 1 ) echo 'checked '; ?>/> <?php echo __('Accelerate feed', 'powerpress'); ?></label></p>
427
+
428
+ </td>
429
+ </tr>
430
+
431
+ <tr valign="top">
432
+ <th scope="row">
433
+ <?php echo __('Feed Discovery', 'powerpress'); ?></th>
434
+ <td>
435
+ <p style="margin-top: 10px;"><label><input type="checkbox" name="General[feed_links]" value="1" <?php if( !empty($General['feed_links']) && $General['feed_links'] == 1 ) echo 'checked '; ?>/> <?php echo __('Include podcast feed links in HTML headers.', 'powerpress'); ?></label></p>
436
+ <p><?php echo __('Adds "feed discovery" links to your web site\'s headers allowing web browsers and feed readers to auto-detect your podcast feeds.', 'powerpress'); ?></p>
437
+ </td>
438
+ </tr>
439
+
440
+ <tr valign="top">
441
+ <th scope="row">
442
+ <?php echo __('WebSub', 'powerpress'); ?> <?php echo powerpressadmin_new(); ?></th>
443
+ <td>
444
+ <p style="margin-top: 10px;"><label><input type="checkbox" name="General[websub_enabled]" value="1" <?php if( !empty($General['websub_enabled']) && $General['websub_enabled'] == 1 ) echo 'checked '; ?>/> <?php echo __('Enable WebSub', 'powerpress'); ?></label></p>
445
+ <p><?php echo __('Notifies web subscription hub to push notifications to subscribers. Currently supported by the Blubrry Podcast Directory and Google Podcasts.', 'powerpress'); ?></p>
446
+ </td>
447
+ </tr>
448
+
449
+ <tr valign="top">
450
+ <th scope="row">
451
+ <?php echo __('RSS2 Image', 'powerpress'); ?></th>
452
+ <td>
453
+ <input type="hidden" name="General[disable_rss_image]" value="1" />
454
+ <p><label><input type="checkbox" name="General[disable_rss_image]" value="0" <?php if( empty($General['disable_rss_image']) ) echo 'checked '; ?>/> <?php echo __('Include RSS Image in feeds.', 'powerpress'); ?></label></p>
455
+ </td>
456
+ </tr>
457
+
458
+ <tr valign="top">
459
+ <th scope="row">
460
+ <?php echo __('Emoji', 'powerpress'); ?> <?php echo powerpressadmin_new(); ?></th>
461
+ <td>
462
+ <?php
463
+ if( 'utf8mb4' != $GLOBALS['wpdb']->charset )
464
+ {
465
+ ?>
466
+ <p style="font-weight: bold; color: #CC0000;">
467
+ <?php
468
+ echo __('Emoji may not be supported with your WordPress installation. Please upgrade your database to support utf8mb4 available in WordPress 4.2 and newer.', 'powerpress');
469
+ ?>
470
+ </p>
471
+ <?php } ?>
472
+ <input type="hidden" name="General[rss_emoji]" value="0" />
473
+ <p><label><input type="checkbox" name="General[rss_emoji]" value="1" <?php if( !empty($General['rss_emoji']) ) echo 'checked '; ?>/> <?php echo __('Include Emoji in feeds.', 'powerpress'); ?></label>
474
+ <a href="https://create.blubrry.com/resources/powerpress/powerpress-settings/feeds/#emoji" target="_blank"><?php echo __('Learn more', 'powerpress'); ?></p>
475
+ </p>
476
+ </td>
477
+ </tr>
478
+
479
+ </table>
480
+ <?php
481
+ }
482
+
483
+ function powerpressadmin_edit_feed_settings($FeedSettings, $General, $FeedAttribs = array() )
484
+ {
485
+ $SupportUploads = powerpressadmin_support_uploads();
486
+ if( !isset($FeedSettings['posts_per_rss']) )
487
+ $FeedSettings['posts_per_rss'] = '';
488
+ if( !isset($FeedSettings['rss2_image']) )
489
+ $FeedSettings['rss2_image'] = '';
490
+ if( !isset($FeedSettings['copyright']) )
491
+ $FeedSettings['copyright'] = '';
492
+ if( !isset($FeedSettings['title']) )
493
+ $FeedSettings['title'] = '';
494
+ if( !isset($FeedSettings['rss_language']) )
495
+ $FeedSettings['rss_language'] = '';
496
+
497
+ $feed_link = '';
498
+ switch( $FeedAttribs['type'])
499
+ {
500
+ case 'category': {
501
+ if( !empty($General['cat_casting_podcast_feeds']) )
502
+ $feed_link = get_category_feed_link($FeedAttribs['category_id'], 'podcast');
503
+ else // Use the old link
504
+ $feed_link = get_category_feed_link($FeedAttribs['category_id']);
505
+ }; break;
506
+ case 'ttid': {
507
+ $feed_link = get_term_feed_link($FeedAttribs['term_taxonomy_id'], $FeedAttribs['taxonomy_type'], 'rss2');
508
+ }; break;
509
+ case 'post_type': {
510
+ $feed_link = get_post_type_archive_feed_link($FeedAttribs['post_type'], $FeedAttribs['feed_slug']);
511
+ }; break;
512
+ case 'channel': {
513
+ $feed_link = get_feed_link($FeedAttribs['feed_slug']);
514
+ }; break;
515
+ default: {
516
+ $feed_link = get_feed_link('podcast');
517
+ }; break;
518
+ }
519
+
520
+ $cat_ID = $FeedAttribs['category_id'];
521
+
522
+ if( !empty($FeedAttribs['type']) && ( in_array($FeedAttribs['type'], array('category', 'ttid', 'post_type', 'channel') ) ) )
523
+ {
524
+ ?>
525
+ <h3><?php echo __('Feed Information', 'powerpress'); ?></h3>
526
+ <table class="form-table">
527
+ <tr valign="top">
528
+ <th scope="row">
529
+ <?php echo __('Feed URL', 'powerpress'); ?>
530
+ </th>
531
+ <td>
532
+ <p style="margin-top: 0;" class="description"><a href="<?php echo $feed_link; ?>" target="_blank"><?php echo $feed_link; ?></a>
533
+ <?php if( defined('POWERPRESS_FEEDVALIDATOR_URL') ) { ?>| <a href="<?php echo POWERPRESS_FEEDVALIDATOR_URL. urlencode( str_replace('&amp;', '&', $feed_link)); ?>" target="_blank"><?php echo __('validate', 'powerpress'); ?></a><?php } ?></p>
534
+ <?php
535
+ if( !empty($FeedSettings['premium']) )
536
+ {
537
+ echo __('WARNING: This feed is password protected, it cannot be accessed publicly by the iTunes podcast directory or other podcast services.', 'powerpress');
538
+ } ?>
539
+ </td>
540
+ </tr>
541
+ </table>
542
+ <?php
543
+ }
544
+ ?>
545
+ <h3><?php echo __('Feed Settings', 'powerpress'); ?></h3>
546
+ <p class="description"><?php echo sprintf(__('Feed settings below apply to feed: %s', 'powerpress'), esc_html($feed_link) ); ?></p>
547
+ <table class="form-table">
548
+
549
+
550
+ <tr valign="top">
551
+ <th scope="row">
552
+ <?php echo __('Feed Title (Show Title)', 'powerpress'); ?>
553
+ </th>
554
+ <td>
555
+ <input type="text" name="Feed[title]" style="width: 60%;" value="<?php echo esc_attr($FeedSettings['title']); ?>" maxlength="255" />
556
+ <?php if( $cat_ID ) { ?>
557
+ (<?php echo __('leave blank to use default category title', 'powerpress'); ?>)
558
+ <?php } else { ?>
559
+ (<?php echo __('leave blank to use blog title', 'powerpress'); ?>)
560
+ <?php } ?>
561
+ <?php if( $FeedAttribs['type'] == 'ttid' ) { } else if( $cat_ID ) {
562
+ ?>
563
+ <p class="description"><?php echo esc_html(__('Default Category title:', 'powerpress') .' '. get_cat_name($cat_ID) . ' '. apply_filters( 'document_title_separator', '-' ) .' '. get_bloginfo_rss('name') ); ?></p>
564
+ <?php } else { ?>
565
+ <p class="description"><?php echo __('Blog title:', 'powerpress') .' '. get_bloginfo_rss('name'); ?></p>
566
+ <?php } ?>
567
+ <?php if( !empty($General['seo_itunes']) ) { ?>
568
+ <p>
569
+ <em><?php echo __('Podcasting SEO Suggestion: The show title is very important.', 'powerpress'); ?></em>
570
+ </p>
571
+ <?php } ?>
572
+ </td>
573
+ </tr>
574
+
575
+ <?php if( !empty($General['advanced_mode_2']) ) { ?>
576
+ <!-- start advanced features -->
577
+ <tr valign="top">
578
+ <th scope="row">
579
+ <?php echo __('Feed Description', 'powerpress'); ?>
580
+ </th>
581
+ <td>
582
+ <input type="text" name="Feed[description]" style="width: 60%;" value="<?php echo esc_attr( !empty($FeedSettings['description'])? $FeedSettings['description']:''); ?>" maxlength="1000" />
583
+ <?php if( $cat_ID ) { ?>
584
+ (<?php echo __('leave blank to use category description', 'powerpress'); ?>)
585
+ <?php } else { ?>
586
+ (<?php echo __('leave blank to use blog description', 'powerpress'); ?>)
587
+ <?php } ?>
588
+ </td>
589
+ </tr>
590
+
591
+ <?php
592
+ if( $FeedAttribs['type'] != 'general' ) // All types exept general settings
593
+ {
594
+ ?>
595
+ <tr valign="top">
596
+ <th scope="row">
597
+ <?php echo __('Feed Landing Page URL', 'powerpress'); ?> <br />
598
+ </th>
599
+ <td>
600
+ <input type="text" name="Feed[url]" style="width: 60%;" value="<?php echo esc_attr( !empty($FeedSettings['url'])? $FeedSettings['url']:''); ?>" maxlength="255" />
601
+ <?php if( $cat_ID ) { ?>
602
+ (<?php echo __('leave blank to use category page', 'powerpress'); ?>)
603
+ <?php } else { ?>
604
+ (<?php echo __('leave blank to use home page', 'powerpress'); ?>)
605
+ <?php } ?>
606
+ <?php if( $cat_ID ) { ?>
607
+ <p class="description"><?php echo __('Category page URL', 'powerpress'); ?>: <?php echo get_category_link($cat_ID); ?></p>
608
+ <?php } else { ?>
609
+ <p class="description">e.g. <?php echo get_bloginfo('url'); ?>/custom-page/</p>
610
+ <?php } ?>
611
+ </td>
612
+ </tr>
613
+ <?php } // End not general settings ?>
614
+
615
+ <tr valign="top">
616
+ <th scope="row">
617
+ <?php echo __('PodcastMirror Feed URL', 'powerpress'); ?> <?php echo powerpressadmin_new(); ?><br />
618
+ <span style="font-size: 85%; margin-left: 5px;"><a href="https://podcastmirror.com" target="_blank"><?php echo __('learn more', 'powerpress'); ?></a></span>
619
+ </th>
620
+ <td>
621
+ <input type="text" name="Feed[feed_redirect_url]" style="width: 60%;" value="<?php echo esc_attr(!empty($FeedSettings['feed_redirect_url'])? $FeedSettings['feed_redirect_url']:''); ?>" maxlength="100" /> (<?php echo __('leave blank to use built-in feed', 'powerpress'); ?>)
622
+ <p><?php echo __('Use this option to mirror your podcast feed to provide fast, scalable subscriptions to your show. Service is FeedBurner compatible.', 'powerpress'); ?></p>
623
+ <?php
624
+ $link = $feed_link;
625
+ if( strstr($link, '?') )
626
+ $link .= "&redirect=no";
627
+ else
628
+ $link .= "?redirect=no";
629
+ ?>
630
+ <p class="description"><?php echo __('Bypass Redirect URL', 'powerpress'); ?>: <a href="<?php echo $link; ?>" target="_blank"><?php echo $link; ?></a></p>
631
+ </td>
632
+ </tr>
633
+
634
+ <tr valign="top">
635
+ <th scope="row">
636
+ <?php echo __('Show the most recent', 'powerpress'); ?>
637
+ </th>
638
+ <td>
639
+ <p><input type="text" name="Feed[posts_per_rss]" style="width: 50px;" value="<?php echo ( !empty($FeedSettings['posts_per_rss'])? $FeedSettings['posts_per_rss']:''); ?>" maxlength="5" /> <?php echo sprintf(__('episodes / posts per feed (site default: %d, maximum: %d)', 'powerpress'), get_option('posts_per_rss'), 300); ?></p>
640
+ <p style="margin-top: 5px; margin-bottom: 0; font-weight: bold;"><?php echo __('Please enable the <i>Feed Episode Maximizer</i> option to optimize your feed for more than 10 episodes.', 'powerpress'); ?></p>
641
+ </td>
642
+ </tr>
643
+
644
+ <?php
645
+ if( in_array($FeedAttribs['type'], array('channel', 'category', 'post_types', 'general')) )
646
+ {
647
+ ?>
648
+ <tr valign="top">
649
+ <th scope="row">
650
+ <?php echo __('Feed Episode Maximizer', 'powerpress'); ?>
651
+ </th>
652
+ <td>
653
+ <p><input type="checkbox" name="Feed[maximize_feed]" value="1" <?php if( !empty($FeedSettings['maximize_feed']) ) echo 'checked'; ?> />
654
+ <?php echo __('Maximize the number of episodes while maintaining an optimal feed size.', 'powerpress'); ?> <a href="https://create.blubrry.com/resources/powerpress/powerpress-settings/feeds/#maximizer" target="_blank"><?php echo __('Learn more', 'powerpress'); ?></p>
655
+ <p></a></p>
656
+ </td>
657
+ </tr>
658
+ <?php
659
+ }
660
+ ?>
661
+
662
+ <tr valign="top">
663
+ <th scope="row">
664
+
665
+ <?php echo __('Feed Language', 'powerpress'); ?></th>
666
+ <td>
667
+ <select name="Feed[rss_language]" class="bpp_input_med">
668
+ <?php
669
+ $Languages = powerpress_languages();
670
+
671
+ echo '<option value="">'. __('Blog Default Language', 'powerpress') .'</option>';
672
+ foreach( $Languages as $value=> $desc )
673
+ echo "\t<option value=\"$value\"". ($FeedSettings['rss_language']==$value?' selected':''). ">". esc_attr($desc)."</option>\n";
674
+ ?>
675
+ </select>
676
+ <?php
677
+ $rss_language = get_bloginfo_rss('language');
678
+ $rss_language = strtolower($rss_language);
679
+ if( isset($Languages[ $rss_language ]) )
680
+ {
681
+ ?>
682
+ <?php echo __('Blog Default', 'powerpress'); ?>: <?php echo $Languages[ $rss_language ]; ?>
683
+ <?php } else { ?>
684
+ <?php echo __('Blog Default', 'powerpress'); ?>: <?php echo $rss_language; ?>
685
+ <?php } ?>
686
+ </td>
687
+ </tr>
688
+
689
+ <tr valign="top">
690
+ <th scope="row">
691
+ <?php echo __('Copyright', 'powerpress'); ?>
692
+ </th>
693
+ <td>
694
+ <input type="text" name="Feed[copyright]" style="width: 60%;" value="<?php echo esc_attr($FeedSettings['copyright']); ?>" maxlength="255" />
695
+ </td>
696
+ </tr>
697
+ <tr valign="top">
698
+ <th scope="row">
699
+ <?php echo __('Caching Debug Comments', 'powerpress'); ?>
700
+ </th>
701
+ <td>
702
+ <label><input type="checkbox" name="General[allow_feed_comments]" value="1" <?php if( !empty($General['allow_feed_comments']) ) echo 'checked'; ?> />
703
+ <?php echo __('Allow WP Super Cache or W3 Total Cache to add HTML Comments to the bottom of your feeds', 'powerpress'); ?></label>
704
+ (<?php echo __('Recommended unchecked', 'powerpress'); ?>)
705
+ <p><?php echo __('iTunes is known to have issues with feeds that have HTML comments at the bottom.', 'powerpress'); ?></p>
706
+ <p style="margin-bottom: 0;" class="description"><?php echo __('NOTE: This setting should only be enabled for debugging purposes.', 'powerpress'); ?></p>
707
+ </td>
708
+ </tr>
709
+
710
+ <!-- end advanced features -->
711
+ <?php } ?>
712
+ </table>
713
+
714
+ <!-- Location and frequency information -->
715
+ <?php
716
+ if( !isset($FeedSettings['location']) )
717
+ $FeedSettings['location'] = '';
718
+ if( !isset($FeedSettings['frequency']) )
719
+ $FeedSettings['frequency'] = '';
720
+ ?>
721
+ <?php if( !empty($General['advanced_mode_2']) ) { ?>
722
+ <!-- start advanced features -->
723
+ <h3><?php echo __('Basic Show Information', 'powerpress'); ?></h3>
724
+ <div id="rawvoice_basic_options">
725
+ <table class="form-table">
726
+ <tr valign="top">
727
+ <th scope="row"><?php echo __('Location', 'powerpress'); ?></th>
728
+ <td>
729
+ <input type="text" style="width: 300px;" name="Feed[location]" value="<?php echo esc_attr($FeedSettings['location']); ?>" maxlength="50" /> (<?php echo __('optional', 'powerpress'); ?>)
730
+ <p><?php echo __('e.g. Cleveland, Ohio', 'powerpress'); ?></p>
731
+ </td>
732
+ </tr>
733
+ <tr valign="top">
734
+ <th scope="row"><?php echo __('Episode Frequency', 'powerpress'); ?></th>
735
+ <td>
736
+ <input type="text" style="width: 300px;" name="Feed[frequency]" value="<?php echo esc_attr($FeedSettings['frequency']); ?>" maxlength="50" /> (<?php echo __('optional', 'powerpress'); ?>)
737
+ <p><?php echo __('e.g. Weekly', 'powerpress'); ?></p>
738
+ </td>
739
+ </tr>
740
+ </table>
741
+ </div>
742
+ <!-- end advanced features -->
743
+ <?php
744
+ }
745
+ }
746
+
747
+
748
+ function powerpressadmin_settings_tab_other($General, $FeedSettings, $feed_slug, $cat_ID = false, $FeedAttribs = array() ) {
749
+ require_once( dirname(__FILE__).'/views/settings_tab_other.php' );
750
+ }
751
+
752
+ function powerpressadmin_settings_tab_appearance($General, $FeedSettings, $FeedAttribs = array()) {
753
+ require_once( dirname(__FILE__).'/views/settings_tab_appearance.php' );
754
+ }
755
+
756
+ function powerpressadmin_edit_appearance_feed($General, $FeedSettings, $feed_slug)
757
+ {
758
+ // Appearance Settings
759
+ ?>
760
+ <h3><?php echo __('Website Settings', 'powerpress'); ?></h3>
761
+ <table class="form-table">
762
+ <tr valign="top">
763
+ <th scope="row">
764
+ <?php echo __('Disable Player', 'powerpress'); ?>
765
+ </th>
766
+ <td>
767
+ <input name="DisablePlayerFor" type="checkbox" <?php if( isset($General['disable_player'][$feed_slug]) ) echo 'checked '; ?> value="1" /> <?php echo __('Do not display web player or links for this podcast.', 'powerpress'); ?>
768
+ <input type="hidden" name="UpdateDisablePlayer" value="<?php echo $feed_slug; ?>" />
769
+ </td>
770
+ </tr>
771
+ </table>
772
+ <?php
773
+
774
+ }
775
+
776
+ function powerpressadmin_edit_itunes_feed($FeedSettings, $General, $FeedAttribs = array() )
777
+ {
778
+ $feed_slug = $FeedAttribs['feed_slug'];
779
+ $cat_ID = $FeedAttribs['category_id'];
780
+
781
+ $SupportUploads = powerpressadmin_support_uploads();
782
+ if( !isset($FeedSettings['itunes_subtitle']) )
783
+ $FeedSettings['itunes_subtitle'] = '';
784
+ if( !isset($FeedSettings['itunes_summary']) )
785
+ $FeedSettings['itunes_summary'] = '';
786
+ if( !isset($FeedSettings['itunes_keywords']) )
787
+ $FeedSettings['itunes_keywords'] = '';
788
+ if( !isset($FeedSettings['itunes_cat_1']) )
789
+ $FeedSettings['itunes_cat_1'] = '';
790
+ if( !isset($FeedSettings['itunes_cat_2']) )
791
+ $FeedSettings['itunes_cat_2'] = '';
792
+ if( !isset($FeedSettings['itunes_cat_3']) )
793
+ $FeedSettings['itunes_cat_3'] = '';
794
+ if( !isset($FeedSettings['apple_cat_1']) )
795
+ $FeedSettings['apple_cat_1'] = '';
796
+ if( !isset($FeedSettings['apple_cat_2']) )
797
+ $FeedSettings['apple_cat_2'] = '';
798
+ if( !isset($FeedSettings['apple_cat_3']) )
799
+ $FeedSettings['apple_cat_3'] = '';
800
+ if( !isset($FeedSettings['itunes_explicit']) )
801
+ $FeedSettings['itunes_explicit'] = 0;
802
+ if( !isset($FeedSettings['itunes_talent_name']) )
803
+ $FeedSettings['itunes_talent_name'] = '';
804
+ if( !isset($FeedSettings['email']) )
805
+ $FeedSettings['email'] = '';
806
+ if( !isset($FeedSettings['itunes_new_feed_url_podcast']) )
807
+ $FeedSettings['itunes_new_feed_url_podcast'] = '';
808
+ if( !isset($FeedSettings['itunes_new_feed_url']) )
809
+ $FeedSettings['itunes_new_feed_url'] = '';
810
+ if( !isset($FeedSettings['itunes_type']) )
811
+ $FeedSettings['itunes_type'] = '';
812
+
813
+ $AdvancediTunesSettings = !empty($FeedSettings['itunes_summary']);
814
+ if( !empty($FeedSettings['itunes_subtitle']) )
815
+ $AdvancediTunesSettings = true;
816
+ //Logic to convert old iTunes categories to 2019 ones.
817
+ $CatArray = array('cat_1' => $FeedSettings['itunes_cat_1'], 'cat_2' => $FeedSettings['itunes_cat_2'], 'cat_3' => $FeedSettings['itunes_cat_3']);
818
+ $mappings = array('01-00' => '01-00', '01-01' => '01-02', '01-02' => '01-03', '01-03' => '01-04', '01-04' => '01-01',
819
+ '01-05' => '01-05', '01-06' => '01-06', '02-00' => '02-00', '02-02' => '02-01', '02-03' => '02-03',
820
+ '03-00' => '03-00', '04-00' => '04-00', '04-04' => '04-03', '07-00' => '07-00', '07-01' => '07-01', '07-04' => '07-06',
821
+ '08-00' => '09-00', '09-00' => '11-00', '11-00' => '13-00', '11-01' => '13-01', '11-02' => '13-02',
822
+ '11-03' => '13-03', '11-04' => '13-04', '11-05' => '13-05', '11-07' => '13-07', '12-02' => '14-06',
823
+ '12-03' => '14-09', '13-00' => '15-00', '13-02' => '15-02', '13-03' => '15-03', '13-04' => '15-04','14-03' => '16-15',
824
+ '15-00' => '17-00', '16-00' => '19-00');
825
+ foreach($CatArray as $key => $value) {
826
+ if(empty($FeedSettings['apple_'.$key])) {
827
+ if ($value === '02-01') {
828
+ // Business > Business News (02-01) to News > Business News (11-01)
829
+ $FeedSettings['apple_' . $key] = '12-01';
830
+ } else if ($value === '15-02') {
831
+ // Technology > Tech News (15-02) to News > Tech News (11-07)
832
+ $FeedSettings['apple_' . $key] = '12-07';
833
+ } else if ($value === '13-01') {
834
+ // Society & Culture > History (13-01) to History (08-00)
835
+ $FeedSettings['apple_' . $key] = '08-00';
836
+ } else if ($value === '12-01') {
837
+ // Science & Medicine > Medicine (12-01) to Health > Medicine (07-03)
838
+ $FeedSettings['apple_' . $key] = '07-03';
839
+ } else if($value === '05-01') {
840
+ // Games & Hobbies > Automotive (05-01) to Leisure > Automotive (10-02)
841
+ $FeedSettings['apple_'. $key] = '10-02';
842
+ } else if($value === '05-02') {
843
+ // Games & Hobbies > Aviation (05-02) to Leisure > Aviation (10-03)
844
+ $FeedSettings['apple_'. $key] = '10-03';
845
+ } else if($value == '05-03') {
846
+ // Games & Hobbies > Hobbies (05-03) to Leisure > Hobbies (10-06)
847
+ $FeedSettings['apple_'. $key] = '10-06';
848
+ } else if($value == '05-05') {
849
+ // Games & Hobbies > Video Games (05-05) to Leisure > Video Games (10-08)
850
+ $FeedSettings['apple_'. $key] = '10-08';
851
+ } else if (array_key_exists($value, $mappings)) {
852
+ //Category has a 1:1 mapping
853
+ $FeedSettings['apple_'. $key] = $mappings[$value];
854
+ }
855
+ }
856
+ }
857
+ ?>
858
+
859
+ <h3><?php echo __('Apple Settings', 'powerpress'); ?></h3>
860
+ <table class="form-table">
861
+ <tr valign="top">
862
+ <th scope="row">
863
+ <?php echo __('iTunes Program Subtitle', 'powerpress'); ?> <br />
864
+ </th>
865
+ <td>
866
+ <input type="text" name="Feed[itunes_subtitle]" style="width: 60%;" value="<?php echo esc_attr($FeedSettings['itunes_subtitle']); ?>" maxlength="255" />
867
+ </td>
868
+ </tr>
869
+
870
+ <tr valign="top">
871
+ <th scope="row">
872
+
873
+ <?php echo __('iTunes Program Summary', 'powerpress'); ?></th>
874
+ <td>
875
+ <p style="margin-top: 5px;"><?php echo __('Your summary cannot exceed 4,000 characters in length and should not include HTML, except for hyperlinks', 'powerpress'); ?></p>
876
+
877
+ <textarea name="Feed[itunes_summary]" rows="5" style="width:80%;" ><?php echo esc_textarea($FeedSettings['itunes_summary']); ?></textarea>
878
+ <div>
879
+ <input type="hidden" name="General[itunes_cdata]" value="0" />
880
+ <input type="checkbox" name="General[itunes_cdata]" value="1" <?php echo ( !empty($General['itunes_cdata'])?'checked ':''); ?>/> <?php echo __('Wrap summary values with &lt;![CDATA[ ... ]]&gt; tags', 'powerpress'); ?>
881
+ </div>
882
+ </td>
883
+ </tr>
884
+
885
+ <?php
886
+ if( !empty($General['advanced_mode_2']) )
887
+ {
888
+ ?>
889
+ <tr valign="top">
890
+ <th scope="row">
891
+
892
+ <?php echo __('iTunes Episode Summary', 'powerpress'); ?></th>
893
+ <td>
894
+ <div style="margin-top: 15px;"><input type="checkbox" name="Feed[enhance_itunes_summary]" value="1" <?php echo ( !empty($FeedSettings['enhance_itunes_summary'])?'checked ':''); ?>/> <?php echo __('Optimize iTunes Summary from Blog Posts', 'powerpress'); ?>
895
+ </div>
896
+ <p>
897
+ <?php echo __('Creates a friendlier view of your post/episode content.', 'powerpress'); ?>
898
+ </p>
899
+ </td>
900
+ </tr>
901
+ </table>
902
+
903
+
904
+ <table class="form-table">
905
+ <?php
906
+ if( !empty($FeedSettings['itunes_keywords']) )
907
+ {
908
+ ?>
909
+ <tr valign="top">
910
+ <th scope="row">
911
+ <?php echo __('iTunes Program Keywords', 'powerpress'); ?> <br />
912
+ </th>
913
+ <td>
914
+ <input type="text" name="Feed[itunes_keywords]" style="width: 60%;" value="<?php echo esc_attr($FeedSettings['itunes_keywords']); ?>" maxlength="255" />
915
+ <p><?php echo __('Feature Deprecated by Apple. Keywords above are for your reference only.', 'powerpress'); ?></p>
916
+ </td>
917
+ </tr>
918
+ <?php
919
+ } // End iTunes keywords
920
+ } // end advanced mode
921
+ ?>
922
+
923
+ <tr valign="top">
924
+ <fieldset style="border: 1px dashed #333333;">
925
+ <legend style="margin: 0 20px; padding: 0 5px; font-weight: bold;"><?php echo __('Notice', 'powerpress'); ?></legend>
926
+ <div style="margin-left: 218px; margin-bottom: 10px;">
927
+ <strong>Apple Categories are changing in August, 2019. Please verify your primary and secondary categories are correct.</strong>
928
+ </div>
929
+ </fieldset>
930
+ <th scope="row">
931
+ <?php echo __('iTunes Category', 'powerpress'); ?>
932
+ <span class="powerpress-required"><?php echo __('Required', 'powerpress'); ?></span>
933
+ </th>
934
+ <td style="width: 30%;">
935
+ <p><?php echo __('Up to July, 2019', 'powerpress') ?></p>
936
+ <select name="Feed[itunes_cat_1]" class="bpp_input_med">
937
+ <?php
938
+
939
+ $MoreCategories = false;
940
+ if( !empty($FeedSettings['itunes_cat_2']) )
941
+ $MoreCategories = true;
942
+ else if( !empty($FeedSettings['itunes_cat_3']) )
943
+ $MoreCategories = true;
944
+
945
+ $Categories = powerpress_itunes_categories(true);
946
+ $AppleCategories = powerpress_apple_categories(true);
947
+
948
+ echo '<option value="">'. __('Select Category', 'powerpress') .'</option>';
949
+
950
+ foreach( $Categories as $value=> $desc )
951
+ echo "\t<option value=\"$value\"". ($FeedSettings['itunes_cat_1']==$value?' selected':''). ">".htmlspecialchars($desc)."</option>\n";
952
+
953
+ reset($Categories);
954
+ ?>
955
+ </select>
956
+ <?php
957
+ if( !$MoreCategories && empty($General['seo_itunes']) ) { ?>
958
+ <a href="#" onclick="document.getElementById('more_itunes_cats').style.display='block';return false;"><?php echo __('more', 'powerpress'); ?></a>
959
+ <?php } ?>
960
+ <p style="width: 250px;">
961
+ <?php echo __('The category above is where you will appear when browsing iTunes.', 'powerpress'); ?>
962
+ </p>
963
+ </td>
964
+ <td>
965
+ <p><?php echo __('August, 2019 +', 'powerpress') ?></p>
966
+ <?php
967
+ $errorClass = null;
968
+ if(empty($FeedSettings['itunes_cat_1'])) {
969
+ //don't show an error if there isn't a corresponding itunes category
970
+ }
971
+ else if(empty($FeedSettings['apple_cat_1'])) {
972
+ $errorClass = "class='pp-form-error'";
973
+ }
974
+ ?>
975
+ <select <?php echo $errorClass ?> name="Feed[apple_cat_1]" class="bpp_input_med">
976
+ <?php
977
+
978
+ echo '<option value="">'. __('Select Category', 'powerpress') .'</option>';
979
+
980
+ foreach( $AppleCategories as $value=> $desc ) {
981
+ echo "\t<option value=\"$value\"" . ($FeedSettings['apple_cat_1'] == $value ? ' selected' : '') . ">" . htmlspecialchars($desc) . "</option>\n";
982
+ }
983
+ reset($Categories);
984
+ ?>
985
+ </select>
986
+ <?php
987
+ if($errorClass == "class='pp-form-error'") {
988
+ echo '<p style="width: 250px;">';
989
+ echo __('Please enter an Apple Podcasts category to prepare yourself for the new 2019 categories', 'powerpress');
990
+ echo '</p>'; }
991
+ else {
992
+ echo '<p style="height: 42px;">&puncsp;</p>';
993
+ }
994
+ ?>
995
+ </td>
996
+ </tr>
997
+ </table>
998
+
999
+
1000
+ <!-- start advanced features -->
1001
+ <div id="more_itunes_cats" style="display: <?php echo ( ($MoreCategories||!empty($General['seo_itunes']) )?'block':'none'); ?>;">
1002
+ <table class="form-table">
1003
+ <tr valign="top">
1004
+ <th scope="row">
1005
+ <?php echo __('iTunes Category 2', 'powerpress'); ?>
1006
+ </th>
1007
+ <td style="width: 30%;">
1008
+ <p><?php echo __('Up to July, 2019', 'powerpress') ?></p>
1009
+ <select name="Feed[itunes_cat_2]" class="bpp_input_med">
1010
+ <?php
1011
+
1012
+
1013
+ echo '<option value="">'. __('Select Category', 'powerpress') .'</option>';
1014
+ foreach( $Categories as $value=> $desc )
1015
+ echo "\t<option value=\"$value\"". ($FeedSettings['itunes_cat_2']==$value?' selected':''). ">".htmlspecialchars($desc)."</option>\n";
1016
+
1017
+ reset($Categories);
1018
+
1019
+ ?>
1020
+ </select>
1021
+ <p style="height: 42px;">&puncsp;</p>
1022
+ <?php if( !empty($General['seo_itunes']) ) { ?>
1023
+ <p>
1024
+ <em><?php echo __('Podcasting SEO Suggestion: Select a second category.', 'powerpress'); ?></em>
1025
+ </p>
1026
+ <?php } ?>
1027
+
1028
+ </td>
1029
+ <td>
1030
+ <?php
1031
+ $errorClass = null;
1032
+ if(empty($FeedSettings['itunes_cat_2'])) {
1033
+ //don't show an error if there isn't a corresponding itunes caregory
1034
+ }
1035
+ else if(empty($FeedSettings['apple_cat_2'])) {
1036
+ $errorClass = "class='pp-form-error'";
1037
+ }
1038
+ ?>
1039
+ <p><?php echo __('August, 2019 +', 'powerpress') ?></p>
1040
+ <select <?php echo $errorClass ?> name="Feed[apple_cat_2]" class="bpp_input_med">
1041
+ <?php
1042
+
1043
+ echo '<option value="">'. __('Select Category', 'powerpress') .'</option>';
1044
+
1045
+ foreach( $AppleCategories as $value=> $desc ) {
1046
+
1047
+ echo "\t<option value=\"$value\"" . ($FeedSettings['apple_cat_2'] == $value ? ' selected' : '') . ">" . htmlspecialchars($desc) . "</option>\n";
1048
+ }
1049
+
1050
+ reset($Categories);
1051
+ ?>
1052
+ </select>
1053
+ <?php
1054
+ if($errorClass == "class='pp-form-error'") {
1055
+ echo '<p style="width: 250px;">';
1056
+ echo __('Please enter an Apple Podcasts category to prepare yourself for the new 2019 categories', 'powerpress');
1057
+ echo '</p>'; }
1058
+ else {
1059
+ echo '<p style="height: 42px;">&puncsp;</p>';
1060
+ }
1061
+ ?>
1062
+ <?php if( !empty($General['seo_itunes']) ) { ?>
1063
+ <p style="height: 42px;">&puncsp;</p>
1064
+ <?php } ?>
1065
+
1066
+ </td>
1067
+
1068
+ </tr>
1069
+
1070
+ <tr valign="top">
1071
+ <th scope="row">
1072
+ <?php echo __('iTunes Category 3', 'powerpress'); ?>
1073
+ </th>
1074
+ <td>
1075
+ <p><?php echo __('Up to July, 2019', 'powerpress') ?></p>
1076
+ <select name="Feed[itunes_cat_3]" class="bpp_input_med">
1077
+ <?php
1078
+
1079
+ echo '<option value="">'. __('Select Category', 'powerpress') .'</option>';
1080
+ foreach( $Categories as $value=> $desc )
1081
+ echo "\t<option value=\"$value\"". ($FeedSettings['itunes_cat_3']==$value?' selected':''). ">".htmlspecialchars($desc)."</option>\n";
1082
+
1083
+ reset($Categories);
1084
+ ?>
1085
+ </select>
1086
+ <p style="height: 42px;">&puncsp;</p>
1087
+ <?php if( !empty($General['seo_itunes']) ) { ?>
1088
+ <p>
1089
+ <em><?php echo __('Podcasting SEO Suggestion: Select a third category.', 'powerpress'); ?></em>
1090
+ </p>
1091
+ <?php } ?>
1092
+ </td>
1093
+ <td>
1094
+ <?php
1095
+ $errorClass = null;
1096
+ if(empty($FeedSettings['itunes_cat_3'])) {
1097
+ //don't show an error if there isn't a corresponding itunes caregory
1098
+ }
1099
+ else if(empty($FeedSettings['apple_cat_3'])) {
1100
+ $errorClass = "class='pp-form-error'";
1101
+ }
1102
+ ?>
1103
+ <p><?php echo __('August, 2019 +', 'powerpress') ?></p>
1104
+ <select <?php echo $errorClass ?> name="Feed[apple_cat_3]" class="bpp_input_med">
1105
+ <?php
1106
+ echo '<option value="">'. __('Select Category', 'powerpress') .'</option>';
1107
+ foreach( $AppleCategories as $value=> $desc ) {
1108
+ echo "\t<option value=\"$value\"" . ($FeedSettings['apple_cat_3'] == $value ? ' selected' : '') . ">" . htmlspecialchars($desc) . "</option>\n";
1109
+ }
1110
+
1111
+ reset($Categories);
1112
+ ?>
1113
+ </select>
1114
+ <?php
1115
+ if($errorClass == "class='pp-form-error'") {
1116
+ echo '<p style="width: 250px;">';
1117
+ echo __('Please enter an Apple Podcasts category to prepare yourself for the new 2019 categories', 'powerpress');
1118
+ echo '</p>';
1119
+ }
1120
+ else {
1121
+ echo '<p style="height: 42px;">&puncsp;</p>';
1122
+ }
1123
+ ?>
1124
+ <?php if( !empty($General['seo_itunes']) ) { ?>
1125
+ <p style="height: 42px;">&puncsp;</p>
1126
+ <?php } ?>
1127
+ </td>
1128
+ </tr>
1129
+ </table>
1130
+ </div>
1131
+ <!-- end advanced features -->
1132
+
1133
+
1134
+ <table class="form-table">
1135
+ <tr valign="top">
1136
+ <th scope="row">
1137
+ <?php echo __('iTunes Explicit', 'powerpress'); ?>
1138
+ <span class="powerpress-required"><?php echo __('Required', 'powerpress'); ?></span>
1139
+ </th>
1140
+ <td>
1141
+ <select name="Feed[itunes_explicit]" style="width: 70%;">
1142
+ <?php
1143
+ $explicit = array(0=> __('No option selected', 'powerpress'), 1=>__('Yes - explicit content', 'powerpress'), 2=>__('Clean - no explicit content', 'powerpress'));
1144
+
1145
+ foreach( $explicit as $value=> $desc )
1146
+ echo "\t<option value=\"$value\"". ($FeedSettings['itunes_explicit']==$value?' selected':''). (($FeedSettings['itunes_explicit']!=0&&$value==0)?'disabled':''). ">$desc</option>\n";
1147
+
1148
+ ?>
1149
+ </select>
1150
+ <p>
1151
+ <em><?php echo __('Note: As of February, 2016, you must select either Yes or Clean.', 'powerpress'); ?></em>
1152
+ </p>
1153
+ </td>
1154
+ </tr>
1155
+ <?php if( !empty($General['advanced_mode_2']) ) { ?>
1156
+ <!-- start advanced features -->
1157
+ <tr valign="top">
1158
+ <th scope="row">
1159
+ <?php echo __('iTunes Author Name', 'powerpress'); ?>
1160
+ </th>
1161
+ <td>
1162
+ <input type="text" name="Feed[itunes_talent_name]" class="bpp_input_med" value="<?php echo esc_attr($FeedSettings['itunes_talent_name']); ?>" maxlength="255" /><br />
1163
+ <div><input type="checkbox" name="Feed[itunes_author_post]" value="1" <?php echo ( !empty($FeedSettings['itunes_author_post'])?'checked ':''); ?>/> <?php echo __('Use blog post author\'s name for individual episodes.', 'powerpress'); ?></div>
1164
+
1165
+ <?php if( !empty($General['seo_itunes']) ) { ?>
1166
+ <p>
1167
+ <em><?php echo __('Podcasting SEO Suggestion: Include talent names and nicknames not mentioned in the show title.', 'powerpress'); ?></em>
1168
+ </p>
1169
+ <?php } ?>
1170
+ </td>
1171
+ </tr>
1172
+ <!-- end advanced features -->
1173
+ <?php } ?>
1174
+
1175
+ <tr valign="top">
1176
+ <th scope="row">
1177
+ <?php echo __('iTunes Email', 'powerpress'); ?>
1178
+ <span class="powerpress-required"><?php echo __('Required', 'powerpress'); ?></span>
1179
+ </th>
1180
+ <td>
1181
+ <input type="text" name="Feed[email]" class="bpp_input_med" value="<?php echo esc_attr($FeedSettings['email']); ?>" maxlength="255" />
1182
+ <div>(<?php echo __('iTunes will email this address when your podcast is accepted into the iTunes Directory.', 'powerpress'); ?>)</div>
1183
+ </td>
1184
+ </tr>
1185
+
1186
+ <?php if( empty($General['ios11_fields']) || $General['ios11_fields'] == 1 ) { ?>
1187
+ <tr valign="top">
1188
+ <th scope="row">
1189
+ <?php echo __('iTunes Type', 'powerpress'); ?>
1190
+ </th>
1191
+ <td>
1192
+ <select name="Feed[itunes_type]" class="bpp_input_med">
1193
+ <?php
1194
+ $types = array(''=> __('No option selected', 'powerpress'), 'episodic'=>__('Episodic (default)', 'powerpress'), 'serial'=>__('Serial', 'powerpress'));
1195
+
1196
+ foreach( $types as $value=> $desc )
1197
+ echo "\t<option value=\"$value\"". ($FeedSettings['itunes_type']==$value?' selected':''). ">$desc</option>\n";
1198
+
1199
+ ?>
1200
+ </select>
1201
+ <p>
1202
+ <em><?php echo __('Episodic: displays latest episode first.', 'powerpress'); ?></em>
1203
+ </p>
1204
+ <p>
1205
+ <em><?php echo __('Serial: displays latest episode last.', 'powerpress'); ?></em>
1206
+ </p>
1207
+ </td>
1208
+ </tr>
1209
+ <?php } // end type ?>
1210
+ </table>
1211
+
1212
+ <?php if( !empty($General['advanced_mode_2']) ) { ?>
1213
+ <!-- start advanced features -->
1214
+ <table class="form-table">
1215
+ <tr valign="top">
1216
+ <th scope="row" >
1217
+
1218
+ <?php echo __('iTunes New Feed URL', 'powerpress'); ?></th>
1219
+ <td>
1220
+ <div id="new_feed_url_step_1" style="display: <?php echo ( !empty($FeedSettings['itunes_new_feed_url']) || !empty($FeedSettings['itunes_new_feed_url_podcast']) ?'none':'block'); ?>;">
1221
+ <p style="margin-top: 5px;"><strong><a href="#" onclick="return powerpress_new_feed_url_prompt();"><?php echo __('Set iTunes New Feed URL', 'powerpress'); ?></a></strong></p>
1222
+ <p><strong>
1223
+ <?php echo __('The iTunes New Feed URL option works primarily for Apple\'s iTunes application only, and should only be used if you are unable to implement a HTTP 301 redirect.', 'powerpress'); ?>
1224
+ <?php echo __('A 301 redirect will route <u>all podcast clients including iTunes</u> to your new feed address.', 'powerpress'); ?>
1225
+ </strong>
1226
+ </p>
1227
+ <p>
1228
+ <?php echo __('Learn more:', 'powerpress'); ?> <a href="https://create.blubrry.com/manual/syndicating-your-podcast-rss-feeds/changing-your-podcast-rss-feed-address-url/" target="_blank"><?php echo __('Changing Your Podcast RSS Feed Address (URL)', 'powerpress'); ?></a>
1229
+ </p>
1230
+ </div>
1231
+ <div id="new_feed_url_step_2" style="display: <?php echo ( !empty($FeedSettings['itunes_new_feed_url']) || !empty($FeedSettings['itunes_new_feed_url_podcast']) ?'block':'none'); ?>;">
1232
+ <p style="margin-top: 5px;"><strong><?php echo __('WARNING: Changes made here are permanent. If the New Feed URL entered is incorrect, you will lose subscribers and will no longer be able to update your listing in the iTunes Store.', 'powerpress'); ?></strong></p>
1233
+ <p><strong><?php echo __('DO NOT MODIFY THIS SETTING UNLESS YOU ABSOLUTELY KNOW WHAT YOU ARE DOING.', 'powerpress'); ?></strong></p>
1234
+ <p>
1235
+ <?php echo htmlspecialchars( sprintf(__('Apple recommends you maintain the %s tag in your feed for at least two weeks to ensure that most subscribers will receive the new New Feed URL.', 'powerpress'), '<itunes:new-feed-url>' ) ); ?>
1236
+ </p>
1237
+ <p>
1238
+ <?php
1239
+ $FeedName = __('Main RSS2 feed', 'powerpress');
1240
+ $FeedURL = get_feed_link('rss2');
1241
+ if( $cat_ID )
1242
+ {
1243
+ $category = get_category_to_edit($cat_ID);
1244
+ $FeedName = sprintf( __('%s category feed', 'powerpress'), htmlspecialchars($category->name) );
1245
+ if( !empty($General['cat_casting_podcast_feeds']) )
1246
+ $FeedURL = get_category_feed_link($cat_ID, 'podcast');
1247
+ else
1248
+ $FeedURL = get_category_feed_link($cat_ID);
1249
+ }
1250
+ else if( $feed_slug )
1251
+ {
1252
+ if( !empty($General['custom_feeds'][ $feed_slug ]) )
1253
+ $FeedName = $General['custom_feeds'][ $feed_slug ];
1254
+ else
1255
+ $FeedName = __('Podcast', 'powerpress');
1256
+ $FeedName = trim($FeedName).' '.__('feed', 'powerpress');
1257
+ $FeedURL = get_feed_link($feed_slug);
1258
+ }
1259
+ else if( $FeedAttribs['type'] == 'ttid' )
1260
+ {
1261
+ $term_object = get_term_to_edit($FeedAttribs['term_id'],$FeedAttribs['taxonomy_type']);
1262
+ $FeedName = sprintf( __('%s taxonomy term feed', 'powerpress'), htmlspecialchars($term_object->name) );
1263
+ $FeedURL = get_term_feed_link($FeedAttribs['term_id'],$FeedAttribs['taxonomy_type'], 'rss2');
1264
+ }
1265
+
1266
+ echo sprintf(__('The New Feed URL value below will be applied to the %s (%s).', 'powerpress'), $FeedName, $FeedURL);
1267
+ ?>
1268
+ </p>
1269
+ <p style="margin-bottom: 0;">
1270
+ <label style="width: 25%; float:left; display:block; font-weight: bold;"><?php echo __('New Feed URL', 'powerpress'); ?></label>
1271
+ <input type="text" name="Feed[itunes_new_feed_url]" style="width: 55%;" value="<?php echo esc_attr($FeedSettings['itunes_new_feed_url']); ?>" maxlength="255" />
1272
+ </p>
1273
+ <p style="margin-left: 25%;margin-top: 0;font-size: 90%;">(<?php echo __('Leave blank for no New Feed URL', 'powerpress'); ?>)</p>
1274
+
1275
+ <p><a href="https://create.blubrry.com/manual/syndicating-your-podcast-rss-feeds/changing-your-podcast-rss-feed-address-url/" target="_blank"><?php echo __('More information regarding the iTunes New Feed URL is available here.', 'powerpress'); ?></a></p>
1276
+ <p>
1277
+ <?php
1278
+ if( !$cat_ID && !$feed_slug )
1279
+ {
1280
+ if( empty($General['channels']) )
1281
+ echo sprintf(__('Please activate the \'Custom Podcast Channels\' Advanced Option to set the new-feed-url for your podcast only feed (%s)', 'powerpress'), get_feed_link('podcast') );
1282
+ else
1283
+ echo sprintf(__('Please navigate to the \'Custom Podcast Channels\' section to set the new-feed-url for your podcast only feed (%s)', 'powerpress'), get_feed_link('podcast') );
1284
+ }
1285
+ ?>
1286
+ </p>
1287
+ </div>
1288
+ </td>
1289
+ </tr>
1290
+ </table>
1291
+
1292
+ <fieldset style="border: 1px dashed #333333;">
1293
+ <legend style="margin: 0 20px; padding: 0 5px; font-weight: bold;"><?php echo __('Advanced Options', 'powerpress'); ?></legend>
1294
+
1295
+ <div style="margin-left: 230px; margin-bottom: 10px;">
1296
+ <p>
1297
+ <strong style="color: #CC0000; font-weight: bold;"><?php echo __('SETTINGS BELOW HAVE PERMANENT CONSEQUENCES.', 'powerpress'); ?></strong>
1298
+ </p>
1299
+ <p style="margin-bottom: 0;">
1300
+ <?php echo __('Feeds affected', 'powerpress'); ?>:
1301
+ </p>
1302
+ <div style="margin-left: 20px;">
1303
+ <?php
1304
+ // $General, $feed_slug=false, $cat_ID=false
1305
+
1306
+ if( $feed_slug )
1307
+ {
1308
+ echo '<a href="';
1309
+ echo esc_attr( get_feed_link($feed_slug) );
1310
+ echo '" target="_blank">';
1311
+ echo esc_html( get_feed_link($feed_slug) );
1312
+ echo '</a>';
1313
+ }
1314
+ else if( $cat_ID )
1315
+ {
1316
+ if( !empty($General['cat_casting_podcast_feeds']) )
1317
+ $feed_url = get_category_feed_link($cat_ID, 'podcast');
1318
+ else
1319
+ $feed_url = get_category_feed_link($cat_ID);
1320
+ echo '<a href="';
1321
+ echo esc_attr( $feed_url );
1322
+ echo '" target="_blank">';
1323
+ echo esc_html( $feed_url );
1324
+ echo '</a>';
1325
+ }
1326
+ else
1327
+ {
1328
+ echo '<a href="';
1329
+ echo esc_attr( get_feed_link('feed') );
1330
+ echo '" target="_blank">';
1331
+ echo esc_html( get_feed_link('feed') );
1332
+ echo '</a>';
1333
+
1334
+ if( empty($General['custom_feeds']['podcast']) )
1335
+ {
1336
+ echo '<br /><a href="';
1337
+ echo esc_attr( get_feed_link('podcast') );
1338
+ echo '" target="_blank">';
1339
+ echo esc_html( get_feed_link('podcast') );
1340
+ echo '</a>';
1341
+ }
1342
+ }
1343
+
1344
+ ?>
1345
+ </div>
1346
+
1347
+ </div>
1348
+ <div id="permanent_itunes_settings">
1349
+ <table class="form-table">
1350
+
1351
+ <tr valign="top">
1352
+ <th scope="row" >
1353
+
1354
+ <span style="margin-left: 10px;"><?php echo __('iTunes Block', 'powerpress'); ?></span></th>
1355
+ <td>
1356
+ <input type="checkbox" name="Feed[itunes_block]" value="1" <?php if( !empty($FeedSettings['itunes_block']) ) echo 'checked'; ?> />
1357
+ <?php echo __('Prevent the entire podcast from appearing in the iTunes Podcast directory.', 'powerpress'); ?>
1358
+ </td>
1359
+ </tr>
1360
+
1361
+ <tr valign="top">
1362
+ <th scope="row" >
1363
+
1364
+ <span style="margin-left: 10px;"><?php echo __('iTunes Complete', 'powerpress'); ?></span></th>
1365
+ <td>
1366
+ <input type="checkbox" name="Feed[itunes_complete]" value="1" <?php if( !empty($FeedSettings['itunes_complete']) ) echo 'checked'; ?> />
1367
+ <?php echo __('Indicate the completion of a podcast. iTunes will no longer update your listing in the iTunes Podcast directory.', 'powerpress'); ?>
1368
+ </td>
1369
+ </tr>
1370
+ </table>
1371
+ </div>
1372
+ </fieldset>
1373
+ <!-- end advanced features -->
1374
+ <?php } // end other advanced options ?>
1375
+ <?php
1376
+ }
1377
+
1378
  ?>
powerpressadmin-jquery.php CHANGED
@@ -1,948 +1,1090 @@
1
- <?php
2
- // jQuery specific functions and code go here..
3
-
4
- function powerpress_add_blubrry_redirect($program_keyword)
5
- {
6
- $Settings = powerpress_get_settings('powerpress_general');
7
- $RedirectURL = 'http://media.blubrry.com/'.$program_keyword;
8
- $NewSettings = array();
9
-
10
- // redirect1
11
- // redirect2
12
- // redirect3
13
- for( $x = 1; $x <= 3; $x++ )
14
- {
15
- $field = sprintf('redirect%d', $x);
16
- if( !empty($Settings[$field]) && stripos($Settings[$field], 'podtrac.com') === false )
17
- $NewSettings[$field] = '';
18
- }
19
- $NewSettings['redirect1'] = $RedirectURL.'/';
20
-
21
- if( count($NewSettings) > 0 )
22
- powerpress_save_settings($NewSettings);
23
- }
24
-
25
- function powerpress_strip_redirect_urls($url)
26
- {
27
- $Settings = powerpress_get_settings('powerpress_general');
28
- for( $x = 1; $x <= 3; $x++ )
29
- {
30
- $field = sprintf('redirect%d', $x);
31
- if( !empty($Settings[$field]) )
32
- {
33
- $redirect_no_http = str_replace('http://', '', $Settings[$field]);
34
- if( substr($redirect_no_http, -1, 1) != '/' )
35
- $redirect_no_http .= '/';
36
- $url = str_replace($redirect_no_http, '', $url);
37
- }
38
- }
39
-
40
- return $url;
41
- }
42
-
43
- function powerpress_admin_jquery_init()
44
- {
45
- $Settings = false; // Important, never remove this
46
- $Settings = get_option('powerpress_general');
47
-
48
- $Error = false;
49
-
50
- $Programs = false;
51
- $Step = 1;
52
-
53
- $action = (isset($_GET['action'])?$_GET['action']: (isset($_POST['action'])?$_POST['action']:false) );
54
- if( !$action )
55
- return;
56
-
57
- $DeleteFile = false;
58
- switch($action)
59
- {
60
- case 'powerpress-jquery-stats': {
61
-
62
- // Make sure users have permission to access this
63
- if( !empty($Settings['use_caps']) && !current_user_can('view_podcast_stats') )
64
- {
65
- powerpress_admin_jquery_header( __('Blubrry Media Statistics', 'powerpress') );
66
- ?>
67
- <h2><?php echo __('Blubrry Media Statistics', 'powerpress'); ?></h2>
68
- <p><?php echo __('You do not have sufficient permission to manage options.', 'powerpress'); ?></p>
69
- <p style="text-align: center;"><a href="#" onclick="self.parent.tb_remove();"><?php echo __('Close', 'powerpress'); ?></a></p>
70
- <?php
71
- powerpress_admin_jquery_footer();
72
- exit;
73
- }
74
- else if( !current_user_can('edit_posts') )
75
- {
76
- powerpress_admin_jquery_header( __('Blubrry Media Statistics', 'powerpress') );
77
- powerpress_page_message_add_notice( __('You do not have sufficient permission to view media statistics.', 'powerpress') );
78
- powerpress_page_message_print();
79
- powerpress_admin_jquery_footer();
80
- exit;
81
- }
82
-
83
- $StatsCached = get_option('powerpress_stats');
84
-
85
- powerpress_admin_jquery_header( __('Blubrry Media Statistics', 'powerpress') );
86
- ?>
87
- <h2><?php echo __('Blubrry Media Statistics', 'powerpress'); ?></h2>
88
- <?php
89
- echo $StatsCached['content'];
90
- powerpress_admin_jquery_footer();
91
- exit;
92
- }; break;
93
- case 'powerpress-jquery-media-disable': {
94
-
95
- if( !current_user_can('edit_posts') )
96
- {
97
- powerpress_admin_jquery_header('Uploader');
98
- powerpress_page_message_add_notice( __('You do not have sufficient permission to disable this option.', 'powerpress') );
99
- powerpress_page_message_print();
100
- powerpress_admin_jquery_footer();
101
- exit;
102
- }
103
-
104
- check_admin_referer('powerpress-jquery-media-disable');
105
-
106
- $DisableSetting = array();
107
- $DisableSetting['no_media_url_folder'] = 1;
108
- powerpress_save_settings($DisableSetting);
109
-
110
- powerpress_admin_jquery_header( __('Select Media', 'powerpress') );
111
- ?>
112
- <h2><?php echo __('Select Media', 'powerpress'); ?></h2>
113
- <p><?php echo __('Blubrry Media Hosting icon will no longer be displayed when editing posts and pages.', 'powerpress'); ?></p>
114
- <p style="text-align: center;"><a href="#" onclick="self.parent.tb_remove();"><?php echo __('Close', 'powerpress'); ?></a></p>
115
- <?php
116
- powerpress_admin_jquery_footer();
117
- exit;
118
-
119
- }; // No break here, let this fall thru..
120
-
121
- case 'powerpress-jquery-hosting': {
122
-
123
- powerpress_admin_jquery_header( __('Blubrry Podcast Media Hosting', 'powerpress') );
124
-
125
- // Congratulations you aleady have hosting!
126
- ?>
127
- <div style="line-height: 32px; height: 32px;">&nbsp;</div>
128
- <iframe src="//www.blubrry.com/pp/" frameborder="0" style="overflow:hidden; overflow-y: hidden;" width="100%" height="480" scrolling="no" seamless="seamless"></iframe>
129
- <p><?php echo __('Already have a blubrry hosting account?', 'powerpress'); ?>
130
- <strong><a class="button-primary button-blubrry thickbox" title="<?php echo esc_attr(__('Blubrry Services Integration', 'powerpress')); ?>" href="<?php echo wp_nonce_url(admin_url('admin.php?action=powerpress-jquery-account'), 'powerpress-jquery-account'); ?>"><?php echo __('Click here to link Blubrry account', 'powerpress'); ?></a></strong>
131
- </p>
132
- <p style="text-align: center;"><a href="#" onclick="self.parent.tb_remove();"><?php echo __('Close', 'powerpress'); ?></a></p>
133
- <?php
134
- powerpress_admin_jquery_footer();
135
- exit;
136
-
137
- }; break;
138
-
139
- case 'powerpress-jquery-media-delete': {
140
-
141
- if( !current_user_can('edit_posts') )
142
- {
143
- powerpress_admin_jquery_header('Uploader');
144
- powerpress_page_message_add_notice( __('You do not have sufficient permission to upload media.', 'powerpress') );
145
- powerpress_page_message_print();
146
- powerpress_admin_jquery_footer();
147
- exit;
148
- }
149
-
150
- check_admin_referer('powerpress-jquery-media-delete');
151
- $DeleteFile = $_GET['delete'];
152
-
153
- }; // No break here, let this fall thru..
154
-
155
- case 'powerpress-jquery-media': {
156
-
157
- if( !current_user_can('edit_posts') )
158
- {
159
- powerpress_admin_jquery_header( __('Select Media', 'powerpress') );
160
- ?>
161
- <h2><?php echo __('Select Media', 'powerpress'); ?></h2>
162
- <p><?php echo __('You do not have sufficient permission to manage options.', 'powerpress'); ?></p>
163
- <p style="text-align: center;"><a href="#" onclick="self.parent.tb_remove();"><?php echo __('Close', 'powerpress'); ?></a></p>
164
- <?php
165
- powerpress_admin_jquery_footer();
166
- exit;
167
- }
168
-
169
- if( empty($Settings['blubrry_auth']) || empty($Settings['blubrry_hosting']) || $Settings['blubrry_hosting'] === 'false' )
170
- {
171
- powerpress_admin_jquery_header( __('Select Media', 'powerpress') );
172
- ?>
173
- <h2><?php echo __('Select Media', 'powerpress'); ?></h2>
174
- <p><?php echo __('Wait a sec! This feature is only available to Blubrry Media Podcast Hosting customers.', 'powerpress'); ?></p>
175
- <iframe src="//www.blubrry.com/pp/" frameborder="0" style="overflow:hidden; overflow-y: hidden;" width="100%" height="480" scrolling="no" seamless="seamless"></iframe>
176
- <p><?php echo __('Already have a blubrry hosting account?', 'powerpress'); ?>
177
- <strong><a class="button-primary button-blubrry thickbox" title="<?php echo esc_attr(__('Blubrry Services Integration', 'powerpress')); ?>" href="<?php echo wp_nonce_url(admin_url('admin.php?action=powerpress-jquery-account'), 'powerpress-jquery-account'); ?>"><?php echo __('Click here to link Blubrry account', 'powerpress'); ?></a></strong>
178
- </p>
179
- <p style="text-align: center;"><a href="#" onclick="self.parent.tb_remove();"><?php echo __('Close', 'powerpress'); ?></a></p>
180
- <?php
181
- powerpress_admin_jquery_footer();
182
- exit;
183
- }
184
-
185
- $Msg = false;
186
- if( $DeleteFile )
187
- {
188
- $json_data = false;
189
- $api_url_array = powerpress_get_api_array();
190
- foreach( $api_url_array as $index => $api_url )
191
- {
192
- $req_url = sprintf('%s/media/%s/%s?format=json', rtrim($api_url, '/'), $Settings['blubrry_program_keyword'], $DeleteFile );
193
- $req_url .= (defined('POWERPRESS_BLUBRRY_API_QSA')?'&'. POWERPRESS_BLUBRRY_API_QSA:'');
194
- $json_data = powerpress_remote_fopen($req_url, $Settings['blubrry_auth'], array(), 10, 'DELETE');
195
- if( !$json_data && $api_url == 'https://api.blubrry.com/' ) { // Lets force cURL and see if that helps...
196
- $json_data = powerpress_remote_fopen($req_url, $Settings['blubrry_auth'], array(), 10, 'DELETE', true); // Only give this 2 seconds to return results
197
- }
198
- if( $json_data != false )
199
- break;
200
- }
201
- $results = powerpress_json_decode($json_data);
202
-
203
- if( isset($results['text']) )
204
- $Msg = $results['text'];
205
- else if( isset($results['error']) )
206
- $Msg = $results['error'];
207
- else
208
- $Msg = __('An unknown error occurred deleting media file.', 'powerpress');
209
- }
210
-
211
- $json_data = false;
212
- $api_url_array = powerpress_get_api_array();
213
- foreach( $api_url_array as $index => $api_url )
214
- {
215
- $req_url = sprintf('%s/media/%s/index.json?quota=true&published=true', rtrim($api_url, '/'), $Settings['blubrry_program_keyword'] );
216
- $req_url .= (defined('POWERPRESS_BLUBRRY_API_QSA')?'&'. POWERPRESS_BLUBRRY_API_QSA:'');
217
- $json_data = powerpress_remote_fopen($req_url, $Settings['blubrry_auth']);
218
- if( !$json_data && $api_url == 'https://api.blubrry.com/' ) { // Lets force cURL and see if that helps...
219
- $json_data = powerpress_remote_fopen($req_url, $Settings['blubrry_auth'], array(), 15, false, true);
220
- }
221
- if( $json_data != false )
222
- break;
223
- }
224
-
225
- $results = powerpress_json_decode($json_data);
226
-
227
- $FeedSlug = sanitize_title($_GET['podcast-feed']);
228
- powerpress_admin_jquery_header( __('Select Media', 'powerpress'), true );
229
- ?>
230
- <style>
231
- .error {
232
- padding: 6px 10px;
233
- border 1px solid #ffc599;
234
- background-color: #ff9800;
235
- color: #fff;
236
- font-weight: bold;
237
- }
238
- </style>
239
- <script language="JavaScript" type="text/javascript"><!--
240
-
241
- function SelectMedia(File)
242
- {
243
- self.parent.document.getElementById('powerpress_url_<?php echo $FeedSlug; ?>').value=File;
244
- self.parent.document.getElementById('powerpress_hosting_<?php echo $FeedSlug; ?>').value='1';
245
- self.parent.document.getElementById('powerpress_url_<?php echo $FeedSlug; ?>').readOnly=true;
246
- self.parent.document.getElementById('powerpress_hosting_note_<?php echo $FeedSlug; ?>').style.display='block';
247
- if( self.parent.powerpress_update_for_video )
248
- self.parent.powerpress_update_for_video(File, '<?php echo $FeedSlug; ?>');
249
- self.parent.tb_remove();
250
- }
251
- function SelectURL(url)
252
- {
253
- self.parent.document.getElementById('powerpress_url_<?php echo $FeedSlug; ?>').value=url;
254
- self.parent.document.getElementById('powerpress_hosting_<?php echo $FeedSlug; ?>').value='0';
255
- self.parent.document.getElementById('powerpress_url_<?php echo $FeedSlug; ?>').readOnly=false;
256
- self.parent.document.getElementById('powerpress_hosting_note_<?php echo $FeedSlug; ?>').style.display='none';
257
- if( self.parent.powerpress_update_for_video )
258
- self.parent.powerpress_update_for_video(url, '<?php echo $FeedSlug; ?>');
259
- self.parent.tb_remove();
260
- }
261
- function DeleteMedia(File)
262
- {
263
- return confirm('<?php echo __('Delete', 'powerpress'); ?>: '+File+'\n\n<?php echo __('Are you sure you want to delete this media file?', 'powerpress'); ?>');
264
- }
265
- //-->
266
- </script>
267
- <div id="media-header">
268
- <h2><?php echo __('Select Media', 'powerpress'); ?></h2>
269
- <?php
270
-
271
- if( !empty($results['quota']['expires'] ) )
272
- {
273
- $message = '';
274
- if( !empty($results['quota']['expires']['expired']) )
275
- {
276
- $message = '<p>'. sprintf( __('Media hosting service expired on %s.', 'powerpress'), esc_attr($results['quota']['expires']['readable_date'])) . '</p>';
277
- }
278
- else
279
- {
280
- $message = '<p>'. sprintf( __('Media hosting service will expire on %s.', 'powerpress'), esc_attr($results['quota']['expires']['readable_date'])) . '</p>';
281
- }
282
-
283
- $message .= '<p style="text-align: center;"><strong><a href="'. $results['quota']['expires']['renew_link'] .'" target="_blank" style="text-decoration: underline;">'. __('Renew Media Hosting Service', 'powerpress') . '</a></strong></p>';
284
- powerpress_page_message_add_notice( $message, 'inline', false );
285
- powerpress_page_message_print();
286
- }
287
- else if( empty($results) )
288
- {
289
- // Handle the error here.
290
- $message = '<h3>'.__('Error', 'powerpress') . '</h3>';
291
- global $g_powerpress_remote_error, $g_powerpress_remote_errorno;
292
- if( !empty($g_powerpress_remote_errorno) && $g_powerpress_remote_errorno == 401 )
293
- $message .= '<p>'. __('Incorrect sign-in email address or password.', 'powerpress').'</p><p>'.__('Verify your account entered under Services and Statistics settings then try again.', 'powerpress') .'</p>';
294
- else if( !empty($g_powerpress_remote_error) )
295
- $message .= '<p>'.$g_powerpress_remote_error.'</p>';
296
- else
297
- $message .= '<p>'.__('Unable to connect to service.','powerpress').'</p>';
298
-
299
- // Print an erro here
300
- powerpress_page_message_add_notice( $message, 'inline', false );
301
- powerpress_page_message_print();
302
- }
303
-
304
- if( $Msg )
305
- echo '<p>'. $Msg . '</p>';
306
- ?>
307
- <div class="media-upload-link"><a title="<?php echo esc_attr(__('Blubrry Podcast Hosting', 'powerpress')); ?>" href="<?php echo admin_url() . wp_nonce_url("admin.php?action=powerpress-jquery-upload", 'powerpress-jquery-upload'); ?>&podcast-feed=<?php echo $FeedSlug; ?>&keepThis=true&TB_iframe=true&height=350&width=530&modal=false" class="thickbox"><?php echo __('Upload Media File', 'powerpress'); ?></a></div>
308
- <p><?php echo __('Select from media files uploaded to blubrry.com', 'powerpress'); ?>:</p>
309
- </div>
310
- <div id="media-items-container">
311
- <div id="media-items">
312
- <?php
313
- $QuotaData = false;
314
- if( isset($results['error']) )
315
- {
316
- echo '<p class="error">'.$results['error'].'</p>';
317
- echo '<p><a href="https://publish.blubrry.com/services/" target="_blank">'. __('Manage your blubrry.com Account', 'powerpress') .'</a></p>';
318
- }
319
- else if( is_array($results) )
320
- {
321
- $PublishedList = false;
322
- foreach( $results as $index => $data )
323
- {
324
- if( $index === 'quota' )
325
- {
326
- $QuotaData = $data;
327
- continue;
328
- }
329
-
330
- if( $PublishedList == false && !empty($data['published']) )
331
- {
332
- ?>
333
- <div id="media-published-title">
334
- <?php echo __('Last 20 Published media files', 'powerpress'); ?>:
335
- </div>
336
- <?php
337
- $PublishedList = true;
338
- }
339
-
340
- ?>
341
- <div class="media-item <?php echo (empty($data['published'])?'media-unpublished':'media-published'); ?>">
342
- <strong class="media-name"><?php echo htmlspecialchars($data['name']); ?></strong>
343
- <cite><?php echo powerpress_byte_size($data['length']); ?></cite>
344
- <?php if( !empty($data['published']) ) { ?>
345
- <div class="media-published-date">&middot; <?php echo __('Published on', 'powerpress'); ?> <?php echo date(get_option('date_format'), $data['last_modified']); ?></div>
346
- <?php } ?>
347
- <div class="media-item-links">
348
- <?php if( !empty($data['published']) && !empty($data['url']) ) { ?>
349
- <a href="#" onclick="SelectURL('<?php echo $data['url']; ?>'); return false;"><?php echo __('Select', 'powerpress'); ?></a>
350
- <?php } else { ?>
351
- <?php if (function_exists('curl_init')) { ?>
352
- <a href="<?php echo admin_url() . wp_nonce_url("admin.php?action=powerpress-jquery-media-delete", 'powerpress-jquery-media-delete'); ?>&amp;podcast-feed=<?php echo $FeedSlug; ?>&amp;delete=<?php echo urlencode($data['name']); ?>" onclick="return DeleteMedia('<?php echo $data['name']; ?>');"><?php echo __('Delete', 'powerpress'); ?></a> |
353
- <?php } ?>
354
- <a href="#" onclick="SelectMedia('<?php echo $data['name']; ?>'); return false;"><?php echo __('Select', 'powerpress'); ?></a>
355
- <?php } ?>
356
- </div>
357
- </div>
358
- <?php
359
- }
360
- }
361
- ?>
362
- </div><!-- end media-items -->
363
- </div><!-- end media-items-container -->
364
- <div id="media-footer">
365
- <div class="media-upload-link"><a title="<?php echo esc_attr(__('Blubrry Podcast Hosting', 'powerpress')); ?>" href="<?php echo admin_url() . wp_nonce_url("admin.php?action=powerpress-jquery-upload", 'powerpress-jquery-upload'); ?>&podcast-feed=<?php echo $FeedSlug; ?>&keepThis=true&TB_iframe=true&height=350&width=530&modal=false" class="thickbox"><?php echo __('Upload Media File', 'powerpress'); ?></a></div>
366
- <?php
367
- if( $QuotaData ) {
368
-
369
- $NextDate = strtotime( $QuotaData['published']['next_date']);
370
- ?>
371
- <?php
372
- if( $QuotaData['unpublished']['available'] != $QuotaData['unpublished']['total'] )
373
- {
374
- //echo '<p>';
375
- //echo sprintf( __('You have uploaded %s (%s available) of your %s upload limit.', 'powerpress'),
376
- // '<em>'. powerpress_byte_size($QuotaData['unpublished']['used']) .'</em>',
377
- // '<em>'. powerpress_byte_size($QuotaData['unpublished']['available']) .'</em>',
378
- // '<em>'. powerpress_byte_size($QuotaData['unpublished']['total']) .'</em>' );
379
- //echo '</p>';
380
- }
381
-
382
- if( $QuotaData['published']['status'] == 'OK' )
383
- {
384
- ?>
385
- <p><?php
386
-
387
- if( $QuotaData['published']['available'] > 0 ) // != $QuotaData['published']['total'] )
388
- {
389
- echo sprintf( __('Publishing space available: %s of (%s %%) of %s/month quota.', 'powerpress'),
390
- '<em>'. powerpress_byte_size($QuotaData['published']['available']) .'</em>',
391
- //'<em>'. powerpress_byte_size($QuotaData['published']['total']-$QuotaData['published']['available']) .'</em>',
392
- '<em>'. round( ($QuotaData['published']['available']/$QuotaData['published']['total'])*100 ) .'</em>',
393
- '<em>'. str_replace('.0', '', powerpress_byte_size($QuotaData['published']['total'])) .'</em>' );
394
- //echo sprintf( __('You have %s available (%s published in the last 30 days) of your %s publish limit.', 'powerpress'),
395
- // '<em>'. powerpress_byte_size($QuotaData['published']['available']) .'</em>',
396
- // '<em>'. powerpress_byte_size($QuotaData['published']['total']-$QuotaData['published']['available']) .'</em>',
397
- // '<em>'. powerpress_byte_size($QuotaData['published']['total']) .'</em>' );
398
- }
399
- else if( $QuotaData['published']['available'] == 0 ) // Hosting account frozen
400
- {
401
-
402
- }
403
- else
404
- {
405
- echo sprintf( __('You have %s publish space available.', 'powerpress'),
406
- '<em>'. powerpress_byte_size($QuotaData['published']['total']) .'</em>' );
407
- }
408
- ?>
409
- </p>
410
- <p>
411
- <?php
412
- echo sprintf( __('No-Fault Hosting: You may upload a media file up to %s in size and be within the No-Fault maximum (25%% more than your %s quota).', 'powerpress'),
413
- powerpress_byte_size($QuotaData['published']['no_fault_maximum']),
414
- str_replace('.0', '', powerpress_byte_size($QuotaData['published']['total'])));
415
- echo ' ';
416
- echo '<a href="http://create.blubrry.com/resources/podcast-media-hosting/no-fault/" target="_blank">'. __('Learn More', 'powerpress') .'</a>';
417
- ?>
418
- </p>
419
- <p><?php
420
- if( $QuotaData['published']['available'] != $QuotaData['published']['total'] )
421
- {
422
- echo sprintf( __('Your quota will reset on %s.', 'powerpress'),
423
- date('m/d/Y', $NextDate) );
424
- }
425
- ?>
426
- </p>
427
- <?php
428
- }
429
- else if( $QuotaData['published']['status'] == 'UNLIMITED' )
430
- {
431
- echo '<p>';
432
- echo __('Publishing Space Available: Unlimited (Professional Hosting)', 'powerpress');
433
- echo '<p>';
434
- }
435
- else
436
- {
437
- echo '<p>';
438
- echo __('Publishing Space Available: Account has expired', 'powerpress');
439
- echo '<p>';
440
- }
441
- ?>
442
- <?php } ?>
443
- <p style="text-align: center;"><a href="#" onclick="self.parent.tb_remove();"><?php echo __('Close', 'powerpress'); ?></a></p>
444
- </div>
445
-
446
- <?php
447
- powerpress_admin_jquery_footer(true);
448
- exit;
449
- }; break;
450
- case 'powerpress-jquery-account-save': {
451
-
452
- if( !current_user_can(POWERPRESS_CAPABILITY_MANAGE_OPTIONS) )
453
- {
454
- powerpress_admin_jquery_header('Blubrry Services', 'powerpress');
455
- powerpress_page_message_add_notice( __('You do not have sufficient permission to manage options.', 'powerpress') );
456
- powerpress_page_message_print();
457
- powerpress_admin_jquery_footer();
458
- exit;
459
- }
460
-
461
- check_admin_referer('powerpress-jquery-account');
462
-
463
- $Password = $_POST['Password'];
464
- $SaveSettings = $_POST['Settings'];
465
- $Password = powerpress_stripslashes($Password);
466
- $SaveSettings = powerpress_stripslashes($SaveSettings);
467
-
468
- $Save = false;
469
- $Close = false;
470
-
471
-
472
- if( !empty($_POST['Remove']) )
473
- {
474
- $SaveSettings['blubrry_username'] = '';
475
- $SaveSettings['blubrry_auth'] = '';
476
- $SaveSettings['blubrry_program_keyword'] = '';
477
- $SaveSettings['blubrry_hosting'] = false;
478
- $Close = true;
479
- $Save = true;
480
- }
481
- else
482
- {
483
- $Programs = array();
484
- $ProgramHosting = array();
485
-
486
- // Anytime we change the password we need to test it...
487
- $auth = base64_encode( $SaveSettings['blubrry_username'] . ':' . $Password );
488
- $json_data = false;
489
- $api_url_array = powerpress_get_api_array();
490
- foreach( $api_url_array as $index => $api_url )
491
- {
492
- $req_url = sprintf('%s/service/index.json', rtrim($api_url, '/') );
493
- $req_url .= (defined('POWERPRESS_BLUBRRY_API_QSA')?'?'. POWERPRESS_BLUBRRY_API_QSA:'');
494
- $json_data = powerpress_remote_fopen($req_url, $auth);
495
- if( !$json_data && $api_url == 'https://api.blubrry.com/' ) { // Lets force cURL and see if that helps...
496
- $json_data = powerpress_remote_fopen($req_url, $auth, array(), 15, false, true);
497
- }
498
- if( $json_data != false )
499
- break;
500
- }
501
-
502
- if( $json_data )
503
- {
504
- $results = powerpress_json_decode($json_data);
505
-
506
- if( isset($results['error']) )
507
- {
508
- $Error = $results['error'];
509
- if( strstr($Error, __('currently not available', 'powerpress') ) )
510
- {
511
- $Error = __('Unable to find podcasts for this account.', 'powerpress');
512
- $Error .= '<br /><span style="font-weight: normal; font-size: 12px;">';
513
- $Error .= 'Verify that the email address you enter here matches the email address you used when you listed your podcast on blubrry.com.</span>';
514
- }
515
- else if( preg_match('/No programs found.*media hosting/i', $results['error']) )
516
- {
517
- $Error .= '<br/><span style="font-weight: normal; font-size: 12px;">';
518
- $Error .= 'Service may take a few minutes to activate.</span>';
519
- }
520
- }
521
- else if( !is_array($results) )
522
- {
523
- $Error = $json_data;
524
- }
525
- else
526
- {
527
- // Get all the programs for this user...
528
- foreach( $results as $null => $row )
529
- {
530
- $Programs[ $row['program_keyword'] ] = $row['program_title'];
531
- if( $row['hosting'] === true || $row['hosting'] == 'true' )
532
- $ProgramHosting[ $row['program_keyword'] ] = true;
533
- else
534
- $ProgramHosting[ $row['program_keyword'] ] = false;
535
- }
536
-
537
- if( count($Programs) > 0 )
538
- {
539
- $SaveSettings['blubrry_auth'] = $auth;
540
-
541
- if( !empty($SaveSettings['blubrry_program_keyword']) )
542
- {
543
- powerpress_add_blubrry_redirect($SaveSettings['blubrry_program_keyword']);
544
- $SaveSettings['blubrry_hosting'] = $ProgramHosting[ $SaveSettings['blubrry_program_keyword'] ];
545
- if( !is_bool($SaveSettings['blubrry_hosting']) )
546
- {
547
- if( $SaveSettings['blubrry_hosting'] === 'false' || empty($SaveSettings['blubrry_hosting']) )
548
- $SaveSettings['blubrry_hosting'] = false;
549
- }
550
-
551
- $Save = true;
552
- $Close = true;
553
- }
554
- else if( isset($SaveSettings['blubrry_program_keyword']) ) // Present but empty
555
- {
556
- $Error = __('You must select a program to continue.', 'powerpress');
557
- }
558
- else if( count($Programs) == 1 )
559
- {
560
- foreach( $Programs as $keyword => $title ) {
561
- break;
562
- }
563
-
564
- $SaveSettings['blubrry_program_keyword'] = $keyword;
565
- $SaveSettings['blubrry_hosting'] = $ProgramHosting[ $keyword ];
566
- if( !is_bool($SaveSettings['blubrry_hosting']) )
567
- {
568
- if( $SaveSettings['blubrry_hosting'] === 'false' || empty($SaveSettings['blubrry_hosting']) )
569
- $SaveSettings['blubrry_hosting'] = false;
570
- }
571
- powerpress_add_blubrry_redirect($keyword);
572
- $Close = true;
573
- $Save = true;
574
- }
575
- else
576
- {
577
- $Error = __('Please select your podcast program to continue.', 'powerpress');
578
- $Step = 2;
579
- $Settings['blubrry_username'] = $SaveSettings['blubrry_username'];
580
- }
581
- }
582
- else
583
- {
584
- $Error = __('No podcasts for this account are listed on blubrry.com.', 'powerpress');
585
- }
586
- }
587
- }
588
- else
589
- {
590
- global $g_powerpress_remote_error, $g_powerpress_remote_errorno;
591
- //$Error = '<h3>'. __('Error', 'powerpress') .'</h3>';
592
- if( !empty($g_powerpress_remote_errorno) && $g_powerpress_remote_errorno == 401 )
593
- $Error .= '<p>'. __('Incorrect sign-in email address or password.', 'powerpress') .'</p><p>'. __('Verify your account settings then try again.', 'powerpress') .'</p>';
594
- else if( !empty($g_powerpress_remote_error) )
595
- $Error .= '<p>'.$g_powerpress_remote_error .'</p>';
596
- else
597
- $Error .= '<p>'.__('Authentication failed.', 'powerpress') .'</p>';
598
- }
599
-
600
- if( $Error )
601
- {
602
- $Error .= '<p style="text-align: center;"><a href="http://create.blubrry.com/resources/powerpress/powerpress-settings/services-stats/" target="_blank">'. __('Click Here For Help','powerpress') .'</a></p>';
603
- }
604
- }
605
-
606
- if( $Save )
607
- powerpress_save_settings($SaveSettings);
608
-
609
- // Clear cached statistics
610
- delete_option('powerpress_stats');
611
-
612
- if( $Error )
613
- powerpress_page_message_add_notice( $Error, 'inline', false );
614
-
615
- if( $Close )
616
- {
617
- powerpress_admin_jquery_header( __('Blubrry Services', 'powerpress') );
618
- powerpress_page_message_print();
619
- ?>
620
- <p style="display: none; text-align: right; position: absolute; top: 5px; right: 5px; margin: 0; padding:0;"><a href="#" onclick="self.parent.tb_remove(); return false;" title="<?php echo __('Close', 'powerpress'); ?>"><img src="<?php echo admin_url(); ?>/images/no.png" alt="<?php echo __('Close', 'powerpress'); ?>" /></a></p>
621
- <h2><?php echo __('Blubrry Services', 'powerpress'); ?></h2>
622
- <p style="text-align: center;"><strong><?php echo __('Settings Saved Successfully!', 'powerpress'); ?></strong></p>
623
- <p style="text-align: center;">
624
- <a href="<?php echo admin_url("admin.php?page=powerpressadmin_basic"); ?>" onclick="self.parent.tb_remove(); return false;" target="_top"><?php echo __('Close', 'powerpress'); ?></a>
625
- </p>
626
- <script type="text/javascript"><!--
627
-
628
- jQuery(document).ready(function($) {
629
- // Upload loading, check the parent window for #blubrry_stats_settings div
630
- if( jQuery('#blubrry_stats_settings',parent.document).length )
631
- {
632
- jQuery('#blubrry_stats_settings',parent.document).html('');
633
- }
634
- });
635
-
636
- // --></script>
637
- <?php
638
- powerpress_admin_jquery_footer();
639
- exit;
640
- }
641
-
642
-
643
- } // no break here, let the next case catch it...
644
- case 'powerpress-jquery-account':
645
- {
646
- if( !current_user_can(POWERPRESS_CAPABILITY_MANAGE_OPTIONS) )
647
- {
648
- powerpress_admin_jquery_header( __('Blubrry Services', 'powerpress') );
649
- powerpress_page_message_add_notice( __('You do not have sufficient permission to manage options.', 'powerpress') );
650
- powerpress_page_message_print();
651
- powerpress_admin_jquery_footer();
652
- exit;
653
- }
654
-
655
- if( !ini_get( 'allow_url_fopen' ) && !function_exists( 'curl_init' ) )
656
- {
657
- powerpress_admin_jquery_header( __('Blubrry Services', 'powerpress') );
658
- powerpress_page_message_add_notice( __('Your server must either have the php.ini setting \'allow_url_fopen\' enabled or have the PHP cURL library installed in order to continue.', 'powerpress') );
659
- powerpress_page_message_print();
660
- powerpress_admin_jquery_footer();
661
- exit;
662
- }
663
-
664
- check_admin_referer('powerpress-jquery-account');
665
-
666
- if( !$Settings )
667
- $Settings = get_option('powerpress_general');
668
-
669
- if( empty($Settings['blubrry_username']) )
670
- $Settings['blubrry_username'] = '';
671
- if( empty($Settings['blubrry_hosting']) || $Settings['blubrry_hosting'] === 'false' )
672
- $Settings['blubrry_hosting'] = false;
673
- if( empty($Settings['blubrry_program_keyword']) )
674
- $Settings['blubrry_program_keyword'] = '';
675
-
676
- if( $Programs == false )
677
- $Programs = array();
678
-
679
- powerpress_admin_jquery_header( __('Blubrry Services', 'powerpress') );
680
- powerpress_page_message_print();
681
- ?>
682
- <form action="<?php echo admin_url('admin.php'); ?>" enctype="multipart/form-data" method="post">
683
- <?php wp_nonce_field('powerpress-jquery-account'); ?>
684
- <input type="hidden" name="action" value="powerpress-jquery-account-save" />
685
- <div id="accountinfo">
686
- <h2><?php echo __('Blubrry Services', 'powerpress'); ?></h2>
687
- <?php if( $Step == 1 ) { ?>
688
- <p>
689
- <label for="blubrry_username"><?php echo __('Blubrry User Name (Email)', 'powerpress'); ?></label>
690
- <input type="text" id="blubrry_username" name="Settings[blubrry_username]" value="<?php echo esc_attr($Settings['blubrry_username']); ?>" />
691
- </p>
692
- <p id="password_row">
693
- <label for="password_password"><?php echo __('Blubrry Password', 'powerpress'); ?></label>
694
- <input type="password" id="password_password" name="Password" value="" />
695
- </p>
696
- <?php } else { ?>
697
- <input type="hidden" name="Settings[blubrry_username]" value="<?php echo esc_attr($Settings['blubrry_username']); ?>" />
698
- <input type="hidden" name="Password" value="<?php echo esc_attr($Password); ?>" />
699
- <!-- <input type="hidden" name="Settings[blubrry_hosting]" value="<?php echo $Settings['blubrry_hosting']; ?>" /> -->
700
- <p>
701
- <label for="blubrry_program_keyword"><?php echo __('Select Blubrry Program', 'powerpress'); ?></label>
702
- <select id="blubrry_program_keyword" name="Settings[blubrry_program_keyword]">
703
- <option value=""><?php echo __('Select Program', 'powerpress'); ?></option>
704
- <?php
705
- foreach( $Programs as $value => $desc )
706
- echo "\t<option value=\"$value\"". ($Settings['blubrry_program_keyword']==$value?' selected':''). ">$desc</option>\n";
707
- ?>
708
- </select>
709
- </p>
710
- <?php } ?>
711
- <p>
712
- <input type="submit" name="Save" value="<?php echo __('Save', 'powerpress'); ?>" />
713
- <input type="button" name="Cancel" value="<?php echo __('Cancel', 'powerpress'); ?>" onclick="self.parent.tb_remove();" />
714
- <input type="submit" name="Remove" value="Remove" style="float: right;" onclick="return confirm('<?php echo __('Remove Blubrry Services Integration, are you sure?', 'powerpress'); ?>');" />
715
- </p>
716
- </div>
717
- </form>
718
- <?php
719
- powerpress_admin_jquery_footer();
720
- exit;
721
- }; break;
722
- case 'powerpress-jquery-upload': {
723
-
724
- if( !current_user_can('edit_posts') )
725
- {
726
- powerpress_admin_jquery_header( __('Uploader', 'powerpress') );
727
- powerpress_page_message_add_notice( __('You do not have sufficient permission to upload media.','powerpress') );
728
- powerpress_page_message_print();
729
- powerpress_admin_jquery_footer();
730
- exit;
731
- }
732
-
733
- check_admin_referer('powerpress-jquery-upload');
734
-
735
- $RedirectURL = false;
736
- $Error = false;
737
-
738
- if( !$Settings )
739
- $Settings = get_option('powerpress_general');
740
-
741
- if( empty($Settings['blubrry_hosting']) || $Settings['blubrry_hosting'] === 'false' )
742
- $Settings['blubrry_hosting'] = false;
743
- if( empty($Settings['blubrry_program_keyword']) )
744
- $Settings['blubrry_program_keyword'] = '';
745
- if( empty($Settings['blubrry_auth']) )
746
- $Settings['blubrry_auth'] = '';
747
-
748
- if( empty($Settings['blubrry_hosting']) )
749
- {
750
- $Error = __('This feature is available to Blubrry Hosting users only.','powerpress');
751
- }
752
-
753
- if( $Error == false )
754
- {
755
- $json_data = false;
756
- $api_url_array = powerpress_get_api_array();
757
- foreach( $api_url_array as $index => $api_url )
758
- {
759
- $req_url = sprintf('%s/media/%s/upload_session.json', rtrim($api_url, '/'), $Settings['blubrry_program_keyword'] );
760
- $req_url .= (defined('POWERPRESS_BLUBRRY_API_QSA')?'?'. POWERPRESS_BLUBRRY_API_QSA:'');
761
- $json_data = powerpress_remote_fopen($req_url, $Settings['blubrry_auth']);
762
- if( !$json_data && $api_url == 'https://api.blubrry.com/' ) { // Lets force cURL and see if that helps...
763
- $json_data = powerpress_remote_fopen($req_url, $Settings['blubrry_auth'], array(), 15, false, true);
764
- }
765
- if( $json_data != false )
766
- break;
767
- }
768
-
769
-
770
- $results = powerpress_json_decode($json_data);
771
-
772
- // We need to obtain an upload session for this user...
773
- if( isset($results['error']) && strlen($results['error']) > 1 )
774
- {
775
- $Error = $results['error'];
776
- if( strstr($Error, 'currently not available') )
777
- $Error = __('Unable to find podcasts for this account.','powerpress');
778
- }
779
- else if( $results === $json_data )
780
- {
781
- $Error = $json_data;
782
- }
783
- else if( !is_array($results) || $results == false )
784
- {
785
- $Error = $json_data;
786
- }
787
- else
788
- {
789
- if( isset($results['url']) && !empty($results['url']) )
790
- $RedirectURL = $results['url'];
791
- }
792
- }
793
-
794
- if( $Error == false && $RedirectURL )
795
- {
796
- $RedirectURL .= '&ReturnURL=';
797
- $RedirectURL .= urlencode( admin_url("admin.php?action=powerpress-jquery-upload-complete") );
798
- header("Location: $RedirectURL");
799
- exit;
800
- }
801
- else if( $Error == false )
802
- {
803
- global $g_powerpress_remote_error, $g_powerpress_remote_errorno;
804
- if( !empty($g_powerpress_remote_errorno) && $g_powerpress_remote_errorno == 401 )
805
- $Error = '<p>'. __('Incorrect sign-in email address or password.', 'powerpress').'</p><p>'.__('Verify your account entered under Services and Statistics settings then try again.', 'powerpress') .'</p>';
806
- else if( !empty($g_powerpress_remote_error) )
807
- $Error = '<p>'.$g_powerpress_remote_error .'</p>';
808
- else
809
- $Error = '<p>'.__('Unable to obtain upload session.','powerpress') .'</p>';
810
- }
811
-
812
- powerpress_admin_jquery_header( __('Uploader','powerpress') );
813
- echo '<h2>'. __('Uploader','powerpress') .'</h2>';
814
- echo '<p>';
815
- echo $Error;
816
- echo '</p>';
817
- ?>
818
- <p style="text-align: center;"><a href="#" onclick="self.parent.tb_remove();"><?php echo __('Close', 'powerpress'); ?></a></p>
819
- <?php
820
- powerpress_admin_jquery_footer();
821
- exit;
822
- }; break;
823
- case 'powerpress-jquery-upload-complete': {
824
-
825
- if( !current_user_can('edit_posts') )
826
- {
827
- powerpress_admin_jquery_header('Uploader');
828
- powerpress_page_message_add_notice( __('You do not have sufficient permission to upload media.', 'powerpress') );
829
- powerpress_page_message_print();
830
- powerpress_admin_jquery_footer();
831
- exit;
832
- }
833
- // sanitize_title esc_attr esc_html powerpress_esc_html
834
- $File = (isset($_GET['File'])? htmlspecialchars($_GET['File']):false);
835
- $Message = (isset($_GET['Message'])? htmlspecialchars($_GET['Message']):'');
836
-
837
- powerpress_admin_jquery_header( __('Upload Complete', 'powerpress') );
838
- echo '<h2>'. __('Uploader', 'powerpress') .'</h2>';
839
- echo '<p>';
840
- if( $File )
841
- {
842
- echo __('File', 'powerpress') .': ';
843
- echo $File;
844
- echo ' - ';
845
- }
846
- echo $Message;
847
- echo '</p>';
848
- ?>
849
- <p style="text-align: center;"><a href="#" onclick="self.parent.tb_remove();"><?php echo __('Close', 'powerpress'); ?></a></p>
850
- <?php
851
-
852
- if( empty($Message) )
853
- {
854
- ?>
855
- <script language="JavaScript" type="text/javascript"><!--
856
- <?php if( $File != '' ) { ?>
857
- self.parent.SelectMedia('<?php echo $File ; ?>'); <?php } ?>
858
- self.parent.tb_remove();
859
- //-->
860
- </script>
861
- <?php
862
- }
863
- powerpress_admin_jquery_footer();
864
- exit;
865
- }; break;
866
- case 'powerpress-jquery-pts': {
867
- if( function_exists('powerpress_ajax_pts') )
868
- powerpress_ajax_pts($Settings);
869
- else
870
- echo "Error";
871
- exit;
872
- }; break;
873
- case 'powerpress-jquery-pts-post': {
874
- if( function_exists('powerpress_ajax_pts_post') )
875
- powerpress_ajax_pts_post($Settings);
876
- else
877
- echo "Error";
878
- }; break;
879
- }
880
-
881
- }
882
-
883
- function powerpress_admin_jquery_header($title, $jquery = false)
884
- {
885
- if( function_exists('get_current_screen') ) {
886
- $current_screen = get_current_screen();
887
- if( !empty($current_screen) && is_object($current_screen) && $current_screen->is_block_editor() ) {
888
- return;
889
- }
890
- }
891
-
892
- header( "Expires: Mon, 26 Jul 1997 05:00:00 GMT" );
893
- header( "Last-Modified: " . gmdate( "D, d M Y H:i:s" ) . "GMT" );
894
- header( 'Cache-Control: no-store, no-cache, must-revalidate' );
895
- header( 'Cache-Control: post-check=0, pre-check=0', false );
896
- header( 'Pragma: no-cache' );
897
-
898
- $other = false;
899
- if( $jquery )
900
- add_thickbox(); // we use the thckbox for some settings
901
- ?>
902
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
903
- <html xmlns="http://www.w3.org/1999/xhtml" <?php do_action('admin_xml_ns'); ?> <?php language_attributes(); ?>>
904
- <head>
905
- <meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php bloginfo('charset'); ?>" />
906
- <title><?php bloginfo('name') ?> &rsaquo; <?php echo $title; ?> &#8212; <?php echo __('WordPress', 'powerpress'); ?></title>
907
- <?php
908
-
909
- // In case these functions haven't been included yet...
910
- if( !defined('WP_ADMIN') )
911
- require_once(ABSPATH . 'wp-admin/includes/admin.php');
912
-
913
- wp_admin_css( 'css/global' );
914
- wp_admin_css();
915
- if( $jquery )
916
- wp_enqueue_script('utils');
917
-
918
- do_action('admin_print_styles');
919
- do_action('admin_print_scripts');
920
- do_action('admin_head');
921
-
922
- echo '<!-- done adding extra stuff -->';
923
-
924
- ?>
925
- <link rel="stylesheet" href="<?php echo powerpress_get_root_url(); ?>css/jquery.css" type="text/css" media="screen" />
926
- <?php if( $other ) echo $other; ?>
927
- </head>
928
- <body>
929
- <div id="container">
930
- <p style="display: none; text-align: right; position: absolute; top: 5px; right: 5px; margin: 0; padding: 0;"><a href="#" onclick="self.parent.tb_remove();" title="<?php echo __('Cancel', 'powerpress'); ?>"><img src="<?php echo admin_url(); ?>/images/no.png" /></a></p>
931
- <?php
932
- }
933
-
934
-
935
- function powerpress_admin_jquery_footer($jquery = false)
936
- {
937
- if( $jquery )
938
- do_action('admin_print_footer_scripts');
939
-
940
- ?>
941
- </div><!-- end container -->
942
- </body>
943
- </html>
944
- <?php
945
- exit();
946
- }
947
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
948
  ?>
1
+ <?php
2
+ // jQuery specific functions and code go here..
3
+
4
+ function powerpress_add_blubrry_redirect($program_keyword)
5
+ {
6
+ $Settings = powerpress_get_settings('powerpress_general');
7
+ $RedirectURL = 'http://media.blubrry.com/'.$program_keyword;
8
+ $NewSettings = array();
9
+
10
+ // redirect1
11
+ // redirect2
12
+ // redirect3
13
+ for( $x = 1; $x <= 3; $x++ )
14
+ {
15
+ $field = sprintf('redirect%d', $x);
16
+ if( !empty($Settings[$field]) && stripos($Settings[$field], 'podtrac.com') === false )
17
+ $NewSettings[$field] = '';
18
+ }
19
+ $NewSettings['redirect1'] = $RedirectURL.'/';
20
+
21
+ if( count($NewSettings) > 0 )
22
+ powerpress_save_settings($NewSettings);
23
+ }
24
+
25
+ function powerpress_strip_redirect_urls($url)
26
+ {
27
+ $Settings = powerpress_get_settings('powerpress_general');
28
+ for( $x = 1; $x <= 3; $x++ )
29
+ {
30
+ $field = sprintf('redirect%d', $x);
31
+ if( !empty($Settings[$field]) )
32
+ {
33
+ $redirect_no_http = str_replace('http://', '', $Settings[$field]);
34
+ if( substr($redirect_no_http, -1, 1) != '/' )
35
+ $redirect_no_http .= '/';
36
+ $url = str_replace($redirect_no_http, '', $url);
37
+ }
38
+ }
39
+
40
+ return $url;
41
+ }
42
+
43
+ function powerpress_admin_jquery_init()
44
+ {
45
+ $Settings = false; // Important, never remove this
46
+ $Settings = get_option('powerpress_general');
47
+
48
+ $Error = false;
49
+
50
+ $Programs = false;
51
+ $Step = 1;
52
+
53
+ $action = (isset($_GET['action'])?$_GET['action']: (isset($_POST['action'])?$_POST['action']:false) );
54
+ if( !$action )
55
+ return;
56
+
57
+ $DeleteFile = false;
58
+ switch($action)
59
+ {
60
+ case 'powerpress-jquery-stats': {
61
+
62
+ // Make sure users have permission to access this
63
+ if( !empty($Settings['use_caps']) && !current_user_can('view_podcast_stats') )
64
+ {
65
+ powerpress_admin_jquery_header( __('Blubrry Media Statistics', 'powerpress') );
66
+ ?>
67
+ <h2><?php echo __('Blubrry Media Statistics', 'powerpress'); ?></h2>
68
+ <p><?php echo __('You do not have sufficient permission to manage options.', 'powerpress'); ?></p>
69
+ <p style="text-align: center;"><a href="#" onclick="self.parent.tb_remove();"><?php echo __('Close', 'powerpress'); ?></a></p>
70
+ <?php
71
+ powerpress_admin_jquery_footer();
72
+ exit;
73
+ }
74
+ else if( !current_user_can('edit_posts') )
75
+ {
76
+ powerpress_admin_jquery_header( __('Blubrry Media Statistics', 'powerpress') );
77
+ powerpress_page_message_add_notice( __('You do not have sufficient permission to view media statistics.', 'powerpress') );
78
+ powerpress_page_message_print();
79
+ powerpress_admin_jquery_footer();
80
+ exit;
81
+ }
82
+
83
+ $StatsCached = get_option('powerpress_stats');
84
+
85
+ powerpress_admin_jquery_header( __('Blubrry Media Statistics', 'powerpress') );
86
+ ?>
87
+ <h2><?php echo __('Blubrry Media Statistics', 'powerpress'); ?></h2>
88
+ <?php
89
+ echo $StatsCached['content'];
90
+ powerpress_admin_jquery_footer();
91
+ exit;
92
+ }; break;
93
+ case 'powerpress-jquery-media-disable': {
94
+
95
+ if( !current_user_can('edit_posts') )
96
+ {
97
+ powerpress_admin_jquery_header('Uploader');
98
+ powerpress_page_message_add_notice( __('You do not have sufficient permission to disable this option.', 'powerpress') );
99
+ powerpress_page_message_print();
100
+ powerpress_admin_jquery_footer();
101
+ exit;
102
+ }
103
+
104
+ check_admin_referer('powerpress-jquery-media-disable');
105
+
106
+ $DisableSetting = array();
107
+ $DisableSetting['no_media_url_folder'] = 1;
108
+ powerpress_save_settings($DisableSetting);
109
+
110
+ powerpress_admin_jquery_header( __('Select Media', 'powerpress') );
111
+ ?>
112
+ <h2><?php echo __('Select Media', 'powerpress'); ?></h2>
113
+ <p><?php echo __('Blubrry Media Hosting icon will no longer be displayed when editing posts and pages.', 'powerpress'); ?></p>
114
+ <p style="text-align: center;"><a href="#" onclick="self.parent.tb_remove();"><?php echo __('Close', 'powerpress'); ?></a></p>
115
+ <?php
116
+ powerpress_admin_jquery_footer();
117
+ exit;
118
+
119
+ }; // No break here, let this fall thru..
120
+
121
+ case 'powerpress-jquery-hosting': {
122
+
123
+ powerpress_admin_jquery_header( __('Blubrry Podcast Media Hosting', 'powerpress') );
124
+
125
+ // Congratulations you aleady have hosting!
126
+ ?>
127
+ <div style="line-height: 32px; height: 32px;">&nbsp;</div>
128
+ <iframe src="//www.blubrry.com/pp/" frameborder="0" style="overflow:hidden; overflow-y: hidden;" width="100%" height="480" scrolling="no" seamless="seamless"></iframe>
129
+ <p><?php echo __('Already have a blubrry hosting account?', 'powerpress'); ?>
130
+ <strong><a class="button-primary button-blubrry thickbox" title="<?php echo esc_attr(__('Blubrry Services Integration', 'powerpress')); ?>" href="<?php echo wp_nonce_url(admin_url('admin.php?action=powerpress-jquery-account'), 'powerpress-jquery-account'); ?>"><?php echo __('Click here to link Blubrry account', 'powerpress'); ?></a></strong>
131
+ </p>
132
+ <p style="text-align: center;"><a href="#" onclick="self.parent.tb_remove();"><?php echo __('Close', 'powerpress'); ?></a></p>
133
+ <?php
134
+ powerpress_admin_jquery_footer();
135
+ exit;
136
+
137
+ }; break;
138
+
139
+ case 'powerpress-jquery-media-delete': {
140
+
141
+ if( !current_user_can('edit_posts') )
142
+ {
143
+ powerpress_admin_jquery_header('Uploader');
144
+ powerpress_page_message_add_notice( __('You do not have sufficient permission to upload media.', 'powerpress') );
145
+ powerpress_page_message_print();
146
+ powerpress_admin_jquery_footer();
147
+ exit;
148
+ }
149
+
150
+ check_admin_referer('powerpress-jquery-media-delete');
151
+ $DeleteFile = $_GET['delete'];
152
+
153
+ }; // No break here, let this fall thru..
154
+
155
+ case 'powerpress-jquery-media': {
156
+
157
+ $QuotaData = false;
158
+
159
+ if( !current_user_can('edit_posts') )
160
+ {
161
+ powerpress_admin_jquery_header( __('Select Media', 'powerpress') );
162
+ ?>
163
+ <h2><?php echo __('Select Media', 'powerpress'); ?></h2>
164
+ <p><?php echo __('You do not have sufficient permission to manage options.', 'powerpress'); ?></p>
165
+ <p style="text-align: center;"><a href="#" onclick="self.parent.tb_remove();"><?php echo __('Close', 'powerpress'); ?></a></p>
166
+ <?php
167
+ powerpress_admin_jquery_footer();
168
+ exit;
169
+ }
170
+
171
+ if( empty($Settings['blubrry_auth']) || empty($Settings['blubrry_hosting']) || $Settings['blubrry_hosting'] === 'false' )
172
+ {
173
+ powerpress_admin_jquery_header( __('Select Media', 'powerpress') );
174
+ ?>
175
+ <h2><?php echo __('Select Media', 'powerpress'); ?></h2>
176
+ <p><?php echo __('Wait a sec! This feature is only available to Blubrry Media Podcast Hosting customers.', 'powerpress'); ?></p>
177
+ <iframe src="//www.blubrry.com/pp/" frameborder="0" style="overflow:hidden; overflow-y: hidden;" width="100%" height="480" scrolling="no" seamless="seamless"></iframe>
178
+ <p><?php echo __('Already have a blubrry hosting account?', 'powerpress'); ?>
179
+ <strong><a class="button-primary button-blubrry thickbox" title="<?php echo esc_attr(__('Blubrry Services Integration', 'powerpress')); ?>" href="<?php echo wp_nonce_url(admin_url('admin.php?action=powerpress-jquery-account'), 'powerpress-jquery-account'); ?>"><?php echo __('Click here to link Blubrry account', 'powerpress'); ?></a></strong>
180
+ </p>
181
+ <p style="text-align: center;"><a href="#" onclick="self.parent.tb_remove();"><?php echo __('Close', 'powerpress'); ?></a></p>
182
+ <?php
183
+ powerpress_admin_jquery_footer();
184
+ exit;
185
+ }
186
+ if(empty($Settings['network_mode'])) {
187
+ $Settings['network_mode'] = '0';
188
+ }
189
+ $Msg = false;
190
+ $blubrryProgramKeyword = $Settings['blubrry_program_keyword'];
191
+ $userLastPodcast = get_user_meta(get_current_user_id(), 'pp_default_podcast', true);
192
+ if(!empty($Settings['cat_casting']) && !empty($Settings['custom_cat_feeds']) && count($Settings['custom_cat_feeds']) > 0 && (empty($userLastPodcast) || $userLastPodcast == '!nodefault') && $Settings['network_mode'] == '1') {
193
+ $blubrryProgramKeyword = '!selectPodcast';
194
+ }
195
+ if(!empty($userLastPodcast) && $userLastPodcast != '!nodefault' && $Settings['network_mode'] == '1') {
196
+ $blubrryProgramKeyword = $userLastPodcast;
197
+ }
198
+ if(!empty($_GET['blubrryProgramKeyword'])) {
199
+ $blubrryProgramKeyword = $_GET['blubrryProgramKeyword'];
200
+ }
201
+ if( !empty($_GET['blubrryProgramKeyword']) && !empty($_GET['remSel']) && $_GET['remSel'] == 'true' ) {
202
+ update_user_meta(get_current_user_id(), 'pp_default_podcast', $blubrryProgramKeyword);
203
+ $userLastPodcast = $blubrryProgramKeyword;
204
+ }
205
+ if( isset($_GET['remSel']) && $_GET['remSel'] == 'false') {
206
+ update_user_meta(get_current_user_id(), 'pp_default_podcast', '!nodefault');
207
+ $userLastPodcast = '!nodefault';
208
+ }
209
+ if( $DeleteFile )
210
+ {
211
+ $json_data = false;
212
+ $api_url_array = powerpress_get_api_array();
213
+ foreach( $api_url_array as $index => $api_url )
214
+ {
215
+ $req_url = sprintf('%s/media/%s/%s?format=json', rtrim($api_url, '/'), $Settings['blubrry_program_keyword'], $DeleteFile );
216
+ $req_url = sprintf('%s/media/%s/%s?format=json', rtrim($api_url, '/'), $blubrryProgramKeyword , $DeleteFile );
217
+ $req_url .= (defined('POWERPRESS_BLUBRRY_API_QSA')?'&'. POWERPRESS_BLUBRRY_API_QSA:'');
218
+ $json_data = powerpress_remote_fopen($req_url, $Settings['blubrry_auth'], array(), 10, 'DELETE');
219
+ if( !$json_data && $api_url == 'https://api.blubrry.com/' ) { // Lets force cURL and see if that helps...
220
+ $json_data = powerpress_remote_fopen($req_url, $Settings['blubrry_auth'], array(), 10, 'DELETE', true); // Only give this 2 seconds to return results
221
+ }
222
+ if( $json_data != false )
223
+ break;
224
+ }
225
+ $results = powerpress_json_decode($json_data);
226
+
227
+ if( isset($results['text']) )
228
+ $Msg = $results['text'];
229
+ else if( isset($results['error']) )
230
+ $Msg = $results['error'];
231
+ else
232
+ $Msg = __('An unknown error occurred deleting media file.', 'powerpress');
233
+ }
234
+
235
+ $json_data = false;
236
+ $json_data_programs = false;
237
+ $api_url_array = powerpress_get_api_array();
238
+ foreach( $api_url_array as $index => $api_url )
239
+ {
240
+ $req_url = sprintf('%s/media/%s/index.json?quota=true&published=true', rtrim($api_url, '/'), $blubrryProgramKeyword );
241
+ $req_url .= (defined('POWERPRESS_BLUBRRY_API_QSA')?'&'. POWERPRESS_BLUBRRY_API_QSA:'');
242
+ $req_url_programs = sprintf('%s/service/index.json', rtrim($api_url, '/') );
243
+ $req_url_programs .= (defined('POWERPRESS_BLUBRRY_API_QSA')?'?'. POWERPRESS_BLUBRRY_API_QSA:'');
244
+ $json_data = powerpress_remote_fopen($req_url, $Settings['blubrry_auth']);
245
+ $json_data_programs = powerpress_remote_fopen($req_url_programs, $Settings['blubrry_auth']);
246
+ if( !$json_data && $api_url == 'https://api.blubrry.com/' ) { // Lets force cURL and see if that helps...
247
+ $json_data = powerpress_remote_fopen($req_url, $Settings['blubrry_auth'], array(), 15, false, true);
248
+ }
249
+ else if(!$json_data_programs && $api_url == 'https://api.blubrry.com/') {
250
+ $json_data_programs = powerpress_remote_fopen($req_url, $Settings['blubrry_auth'], array(), 15, false, true);
251
+ }
252
+ if( $json_data != false )
253
+ break;
254
+ }
255
+
256
+ $results = powerpress_json_decode($json_data);
257
+ $results_programs = powerpress_json_decode($json_data_programs);
258
+ if( isset($results_programs['error']) )
259
+ {
260
+ $Error = $results_programs['error'];
261
+ if( strstr($Error, __('currently not available', 'powerpress') ) )
262
+ {
263
+ $Error = __('Unable to find podcasts for this account.', 'powerpress');
264
+ $Error .= '<br /><span style="font-weight: normal; font-size: 12px;">';
265
+
266
+
267
+ $Error .= 'Verify that the email address you enter here matches the email address you used when you listed your podcast on blubrry.com.</span>';
268
+ }
269
+ else if( preg_match('/No programs found.*media hosting/i', $results_programs['error']) )
270
+ {
271
+ $Error .= '<br/><span style="font-weight: normal; font-size: 12px;">';
272
+ $Error .= 'Service may take a few minutes to activate.</span>';
273
+ }
274
+ }
275
+ else if( !is_array($results_programs) )
276
+ {
277
+ $Error = $json_data_programs;
278
+ }
279
+ else {
280
+ // Get all the programs for this user...
281
+ foreach ($results_programs as $null => $row) {
282
+ $Programs[$row['program_keyword']] = $row['program_title'];
283
+ }
284
+ }
285
+ if( $Error ) {
286
+ powerpress_page_message_add_notice($Error, 'inline', false);
287
+ }
288
+ $FeedSlug = sanitize_title($_GET['podcast-feed']);
289
+ powerpress_admin_jquery_header( __('Select Media', 'powerpress'), true );
290
+ ?>
291
+ <style>
292
+ .error {
293
+ padding: 6px 10px;
294
+ border 1px solid #ffc599;
295
+ background-color: #ff9800;
296
+ color: #fff;
297
+ font-weight: bold;
298
+ }
299
+ </style>
300
+ <script language="JavaScript" type="text/javascript"><!--
301
+
302
+ function SelectMedia(File)
303
+ {
304
+ self.parent.document.getElementById('powerpress_url_<?php echo $FeedSlug; ?>').value=File;
305
+ self.parent.document.getElementById('powerpress_hosting_<?php echo $FeedSlug; ?>').value='1';
306
+ self.parent.document.getElementById('powerpress_url_<?php echo $FeedSlug; ?>').readOnly=true;
307
+ self.parent.document.getElementById('powerpress_hosting_note_<?php echo $FeedSlug; ?>').style.display='block';
308
+ self.parent.document.getElementById('powerpress_program_keyword_<?php echo $FeedSlug; ?>').value= document.querySelector('#blubrry_program_keyword').value;
309
+ if( self.parent.powerpress_update_for_video )
310
+ self.parent.powerpress_update_for_video(File, '<?php echo $FeedSlug; ?>');
311
+ self.parent.tb_remove();
312
+ }
313
+ function SelectURL(url)
314
+ {
315
+ self.parent.document.getElementById('powerpress_url_<?php echo $FeedSlug; ?>').value=url;
316
+ self.parent.document.getElementById('powerpress_hosting_<?php echo $FeedSlug; ?>').value='0';
317
+ self.parent.document.getElementById('powerpress_url_<?php echo $FeedSlug; ?>').readOnly=false;
318
+ self.parent.document.getElementById('powerpress_hosting_note_<?php echo $FeedSlug; ?>').style.display='none';
319
+ if( self.parent.powerpress_update_for_video )
320
+ self.parent.powerpress_update_for_video(url, '<?php echo $FeedSlug; ?>');
321
+ self.parent.tb_remove();
322
+ }
323
+ function DeleteMedia(File)
324
+ {
325
+ return confirm('<?php echo __('Delete', 'powerpress'); ?>: '+File+'\n\n<?php echo __('Are you sure you want to delete this media file?', 'powerpress'); ?>');
326
+ }
327
+
328
+ window.onload = function() {
329
+ const program = document.querySelector('#blubrry_program_keyword');
330
+ const remember = document.querySelector('#remember_selection');
331
+ function reloadFrame() {
332
+ window.location = "<?php echo admin_url('admin.php'); ?>?action=powerpress-jquery-media&blubrryProgramKeyword="+ program.value +"&podcast-feed=<?php echo $FeedSlug; ?>&KeepThis=true&TB_iframe=true&modal=false&remSel=" + remember.checked;
333
+ }
334
+ program.addEventListener('change', function() {
335
+ reloadFrame();
336
+ });
337
+ remember.addEventListener('change', function() {
338
+ reloadFrame();
339
+ });
340
+ }
341
+ //-->
342
+ </script>
343
+ <div id="media-header">
344
+ <?php
345
+ if (count($Programs) > 1 && $Settings['network_mode'] == '1') {
346
+ ?>
347
+ <h2><?php echo __('Select Program', 'powerpress'); ?></h2>
348
+ <span>
349
+ <select id="blubrry_program_keyword" name="Settings[blubrry_program_keyword]">
350
+ <option value="!selectPodcast"><?php echo __('Select Program', 'powerpress'); ?></option>
351
+ <?php
352
+ foreach ($Programs as $value => $desc)
353
+ echo "\t<option value=\"$value\"" . ($blubrryProgramKeyword == $value ? ' selected' : '') . ">$desc</option>\n";
354
+ ?>
355
+ </select>
356
+ <span <?php echo $blubrryProgramKeyword == '!selectPodcast' ? 'style="visibility: hidden;"' : null ?>>
357
+ <input type="checkbox" id="remember_selection"
358
+ name="remember_selection" <?php echo ($userLastPodcast == '!nodefault') ? null : 'checked'; ?>>
359
+ <label for="remember_selection">Remember Selection</label>
360
+ </span>
361
+ </span>
362
+ <?php
363
+ } else {
364
+ ?>
365
+ <input type="hidden" name="Settings[blubrry_program_keyword]" id="blubrry_program_keyword" value="<?php echo htmlspecialchars($blubrryProgramKeyword); ?>" />
366
+ <?php
367
+ }
368
+ ?>
369
+ <h2><?php echo __('Select Media', 'powerpress') ?> <?php echo $blubrryProgramKeyword != '!selectPodcast' ? '- '. $Programs[$blubrryProgramKeyword] : null ?></h2>
370
+ <?php
371
+ if( !empty($results['quota']['expires'] ) )
372
+ {
373
+ $message = '';
374
+ if( !empty($results['quota']['expires']['expired']) )
375
+ {
376
+ $message = '<p>'. sprintf( __('Media hosting service expired on %s.', 'powerpress'), esc_attr($results['quota']['expires']['readable_date'])) . '</p>';
377
+ }
378
+ else
379
+ {
380
+ $message = '<p>'. sprintf( __('Media hosting service will expire on %s.', 'powerpress'), esc_attr($results['quota']['expires']['readable_date'])) . '</p>';
381
+ }
382
+
383
+ $message .= '<p style="text-align: center;"><strong><a href="'. $results['quota']['expires']['renew_link'] .'" target="_blank" style="text-decoration: underline;">'. __('Renew Media Hosting Service', 'powerpress') . '</a></strong></p>';
384
+ powerpress_page_message_add_notice( $message, 'inline', false );
385
+ powerpress_page_message_print();
386
+ }
387
+ else if($blubrryProgramKeyword == '!selectPodcast') {
388
+ $message = '<p style="text-align: center;"><strong>Please Select A Program</strong></p>';
389
+ powerpress_page_message_add_notice( $message, 'inline', false );
390
+ powerpress_page_message_print();
391
+ }
392
+ else if( empty($results) )
393
+ {
394
+ // Handle the error here.
395
+ $message = '<h3>'.__('Error', 'powerpress') . '</h3>';
396
+ global $g_powerpress_remote_error, $g_powerpress_remote_errorno;
397
+ if( !empty($g_powerpress_remote_errorno) && $g_powerpress_remote_errorno == 401 )
398
+ $message .= '<p>'. __('Incorrect sign-in email address or password.', 'powerpress').'</p><p>'.__('Verify your account entered under Services and Statistics settings then try again.', 'powerpress') .'</p>';
399
+ else if( !empty($g_powerpress_remote_error) )
400
+ $message .= '<p>'.$g_powerpress_remote_error.'</p>';
401
+ else
402
+ $message .= '<p>'.__('Unable to connect to service.','powerpress').'</p>';
403
+
404
+ // Print an erro here
405
+ powerpress_page_message_add_notice( $message, 'inline', false );
406
+ powerpress_page_message_print();
407
+ }
408
+
409
+ if( $Msg )
410
+ echo '<p>'. $Msg . '</p>';
411
+ if($blubrryProgramKeyword != '!selectPodcast') {
412
+ ?>
413
+ <div class="media-upload-link"><a
414
+ title="<?php echo esc_attr(__('Blubrry Podcast Hosting', 'powerpress')); ?>"
415
+ href="<?php echo admin_url() . wp_nonce_url("admin.php?action=powerpress-jquery-upload", 'powerpress-jquery-upload'); ?>&blubrryProgramKeyword=<?php echo $blubrryProgramKeyword ?>&podcast-feed=<?php echo $FeedSlug; ?>&keepThis=true&TB_iframe=true&height=350&width=530&modal=false"
416
+ class="thickbox"><?php echo __('Upload Media File', 'powerpress'); ?></a></div>
417
+ <p><?php echo __('Select from media files uploaded to blubrry.com', 'powerpress'); ?>:</p>
418
+ </div>
419
+ <div id="media-items-container">
420
+ <div id="media-items">
421
+ <?php
422
+
423
+ if (isset($results['error'])) {
424
+ echo '<p class="error">' . $results['error'] . '</p>';
425
+ echo '<p><a href="https://publish.blubrry.com/services/" target="_blank">' . __('Manage your blubrry.com Account', 'powerpress') . '</a></p>';
426
+ } else if (is_array($results)) {
427
+ $PublishedList = false;
428
+ foreach ($results as $index => $data) {
429
+ if ($index === 'quota') {
430
+ $QuotaData = $data;
431
+ continue;
432
+ }
433
+
434
+ if ($PublishedList == false && !empty($data['published'])) {
435
+ ?>
436
+ <div id="media-published-title">
437
+ <?php echo __('Last 20 Published media files', 'powerpress'); ?>:
438
+ </div>
439
+ <?php
440
+ $PublishedList = true;
441
+ }
442
+
443
+ ?>
444
+ <div class="media-item <?php echo(empty($data['published']) ? 'media-unpublished' : 'media-published'); ?>">
445
+ <strong class="media-name"><?php echo htmlspecialchars($data['name']); ?></strong>
446
+ <cite><?php echo powerpress_byte_size($data['length']); ?></cite>
447
+ <?php if (!empty($data['published'])) { ?>
448
+ <div class="media-published-date">
449
+ &middot; <?php echo __('Published on', 'powerpress'); ?> <?php echo date(get_option('date_format'), $data['last_modified']); ?></div>
450
+ <?php } ?>
451
+ <div class="media-item-links">
452
+ <?php if (!empty($data['published']) && !empty($data['url'])) { ?>
453
+ <a href="#"
454
+ onclick="SelectURL('<?php echo $data['url']; ?>'); return false;"><?php echo __('Select', 'powerpress'); ?></a>
455
+ <?php } else { ?>
456
+ <?php if (function_exists('curl_init')) { ?>
457
+ <a href="<?php echo admin_url() . wp_nonce_url("admin.php?action=powerpress-jquery-media-delete", 'powerpress-jquery-media-delete'); ?>&amp;podcast-feed=<?php echo $FeedSlug; ?>&amp;blubrryProgramKeyword=<?php echo urlencode($blubrryProgramKeyword); ?>&amp;delete=<?php echo urlencode($data['name']); ?>"
458
+ onclick="return DeleteMedia('<?php echo $data['name']; ?>');"><?php echo __('Delete', 'powerpress'); ?></a> |
459
+ <?php } ?>
460
+ <a href="#"
461
+ onclick="SelectMedia('<?php echo $data['name']; ?>'); return false;"><?php echo __('Select', 'powerpress'); ?></a>
462
+ <?php } ?>
463
+ </div>
464
+ </div>
465
+ <?php
466
+ }
467
+ }
468
+ ?>
469
+ </div><!-- end media-items -->
470
+ </div><!-- end media-items-container -->
471
+ <div id="media-footer">
472
+ <div class="media-upload-link"><a
473
+ title="<?php echo esc_attr(__('Blubrry Podcast Hosting', 'powerpress')); ?>"
474
+ href="<?php echo admin_url() . wp_nonce_url("admin.php?action=powerpress-jquery-upload", 'powerpress-jquery-upload'); ?>&blubrryProgramKeyword=<?php echo $blubrryProgramKeyword ?>&podcast-feed=<?php echo $FeedSlug; ?>&keepThis=true&TB_iframe=true&height=350&width=530&modal=false"
475
+ class="thickbox"><?php echo __('Upload Media File', 'powerpress'); ?></a></div>
476
+ <?php
477
+ }
478
+ if( $QuotaData ) {
479
+
480
+ $NextDate = strtotime( $QuotaData['published']['next_date']);
481
+ ?>
482
+ <?php
483
+ if( $QuotaData['unpublished']['available'] != $QuotaData['unpublished']['total'] )
484
+ {
485
+ //echo '<p>';
486
+ //echo sprintf( __('You have uploaded %s (%s available) of your %s upload limit.', 'powerpress'),
487
+ // '<em>'. powerpress_byte_size($QuotaData['unpublished']['used']) .'</em>',
488
+ // '<em>'. powerpress_byte_size($QuotaData['unpublished']['available']) .'</em>',
489
+ // '<em>'. powerpress_byte_size($QuotaData['unpublished']['total']) .'</em>' );
490
+ //echo '</p>';
491
+ }
492
+
493
+ if( $QuotaData['published']['status'] == 'OK' )
494
+ {
495
+ ?>
496
+ <p><?php
497
+
498
+ if( $QuotaData['published']['available'] > 0 ) // != $QuotaData['published']['total'] )
499
+ {
500
+ echo sprintf( __('Publishing space available: %s of (%s %%) of %s/month quota.', 'powerpress'),
501
+ '<em>'. powerpress_byte_size($QuotaData['published']['available']) .'</em>',
502
+ //'<em>'. powerpress_byte_size($QuotaData['published']['total']-$QuotaData['published']['available']) .'</em>',
503
+ '<em>'. round( ($QuotaData['published']['available']/$QuotaData['published']['total'])*100 ) .'</em>',
504
+ '<em>'. str_replace('.0', '', powerpress_byte_size($QuotaData['published']['total'])) .'</em>' );
505
+ //echo sprintf( __('You have %s available (%s published in the last 30 days) of your %s publish limit.', 'powerpress'),
506
+ // '<em>'. powerpress_byte_size($QuotaData['published']['available']) .'</em>',
507
+ // '<em>'. powerpress_byte_size($QuotaData['published']['total']-$QuotaData['published']['available']) .'</em>',
508
+ // '<em>'. powerpress_byte_size($QuotaData['published']['total']) .'</em>' );
509
+ }
510
+ else if( $QuotaData['published']['available'] == 0 ) // Hosting account frozen
511
+ {
512
+
513
+ }
514
+ else
515
+ {
516
+ echo sprintf( __('You have %s publish space available.', 'powerpress'),
517
+ '<em>'. powerpress_byte_size($QuotaData['published']['total']) .'</em>' );
518
+ }
519
+ ?>
520
+ </p>
521
+ <p>
522
+ <?php
523
+ echo sprintf( __('No-Fault Hosting: You may upload a media file up to %s in size and be within the No-Fault maximum (25%% more than your %s quota).', 'powerpress'),
524
+ powerpress_byte_size($QuotaData['published']['no_fault_maximum']),
525
+ str_replace('.0', '', powerpress_byte_size($QuotaData['published']['total'])));
526
+ echo ' ';
527
+ echo '<a href="http://create.blubrry.com/resources/podcast-media-hosting/no-fault/" target="_blank">'. __('Learn More', 'powerpress') .'</a>';
528
+ ?>
529
+ </p>
530
+ <p><?php
531
+ if( $QuotaData['published']['available'] != $QuotaData['published']['total'] )
532
+ {
533
+ echo sprintf( __('Your quota will reset on %s.', 'powerpress'),
534
+ date('m/d/Y', $NextDate) );
535
+ }
536
+ ?>
537
+ </p>
538
+ <?php
539
+ }
540
+ else if( $QuotaData['published']['status'] == 'UNLIMITED' )
541
+ {
542
+ echo '<p>';
543
+ echo __('Publishing Space Available: Unlimited (Professional Hosting)', 'powerpress');
544
+ echo '<p>';
545
+ }
546
+ else
547
+ {
548
+ echo '<p>';
549
+ echo __('Publishing Space Available: Account has expired', 'powerpress');
550
+ echo '<p>';
551
+ }
552
+ ?>
553
+ <?php } ?>
554
+ <p style="text-align: center;"><a href="#" onclick="self.parent.tb_remove();"><?php echo __('Close', 'powerpress'); ?></a></p>
555
+ </div>
556
+
557
+ <?php
558
+ powerpress_admin_jquery_footer(true);
559
+ exit;
560
+ }; break;
561
+ case 'powerpress-jquery-account-save': {
562
+
563
+ if( !current_user_can(POWERPRESS_CAPABILITY_MANAGE_OPTIONS) )
564
+ {
565
+ powerpress_admin_jquery_header('Blubrry Services', 'powerpress');
566
+ powerpress_page_message_add_notice( __('You do not have sufficient permission to manage options.', 'powerpress') );
567
+ powerpress_page_message_print();
568
+ powerpress_admin_jquery_footer();
569
+ exit;
570
+ }
571
+
572
+ check_admin_referer('powerpress-jquery-account');
573
+
574
+ $Password = $_POST['Password'];
575
+ $SaveSettings = $_POST['Settings'];
576
+ $Password = powerpress_stripslashes($Password);
577
+ $SaveSettings = powerpress_stripslashes($SaveSettings);
578
+
579
+ $Save = false;
580
+ $Close = false;
581
+
582
+
583
+ if( !empty($_POST['Remove']) )
584
+ {
585
+ $SaveSettings['blubrry_username'] = '';
586
+ $SaveSettings['blubrry_auth'] = '';
587
+ $SaveSettings['blubrry_program_keyword'] = '';
588
+ $SaveSettings['blubrry_hosting'] = false;
589
+ $Close = true;
590
+ $Save = true;
591
+ }
592
+ else
593
+ {
594
+ $Programs = array();
595
+ $ProgramHosting = array();
596
+
597
+ // Anytime we change the password we need to test it...
598
+ $auth = base64_encode( $SaveSettings['blubrry_username'] . ':' . $Password );
599
+ $json_data = false;
600
+ $api_url_array = powerpress_get_api_array();
601
+ foreach( $api_url_array as $index => $api_url )
602
+ {
603
+ $req_url = sprintf('%s/service/index.json', rtrim($api_url, '/') );
604
+ $req_url .= (defined('POWERPRESS_BLUBRRY_API_QSA')?'?'. POWERPRESS_BLUBRRY_API_QSA:'');
605
+ $json_data = powerpress_remote_fopen($req_url, $auth);
606
+ if( !$json_data && $api_url == 'https://api.blubrry.com/' ) { // Lets force cURL and see if that helps...
607
+ $json_data = powerpress_remote_fopen($req_url, $auth, array(), 15, false, true);
608
+ }
609
+ if( $json_data != false )
610
+ break;
611
+ }
612
+
613
+ if( $json_data )
614
+ {
615
+ $results = powerpress_json_decode($json_data);
616
+
617
+ if( isset($results['error']) )
618
+ {
619
+ $Error = $results['error'];
620
+ if( strstr($Error, __('currently not available', 'powerpress') ) )
621
+ {
622
+ $Error = __('Unable to find podcasts for this account.', 'powerpress');
623
+ $Error .= '<br /><span style="font-weight: normal; font-size: 12px;">';
624
+ $Error .= 'Verify that the email address you enter here matches the email address you used when you listed your podcast on blubrry.com.</span>';
625
+ }
626
+ else if( preg_match('/No programs found.*media hosting/i', $results['error']) )
627
+ {
628
+ $Error .= '<br/><span style="font-weight: normal; font-size: 12px;">';
629
+ $Error .= 'Service may take a few minutes to activate.</span>';
630
+ }
631
+ }
632
+ else if( !is_array($results) )
633
+ {
634
+ $Error = $json_data;
635
+ }
636
+ else
637
+ {
638
+ // Get all the programs for this user...
639
+ foreach( $results as $null => $row )
640
+ {
641
+ $Programs[ $row['program_keyword'] ] = $row['program_title'];
642
+ if( $row['hosting'] === true || $row['hosting'] == 'true' )
643
+ $ProgramHosting[ $row['program_keyword'] ] = true;
644
+ else
645
+ $ProgramHosting[ $row['program_keyword'] ] = false;
646
+ }
647
+
648
+ if( count($Programs) > 0 )
649
+ {
650
+ $SaveSettings['blubrry_auth'] = $auth;
651
+
652
+ if( !empty($SaveSettings['blubrry_program_keyword']) )
653
+ {
654
+ powerpress_add_blubrry_redirect($SaveSettings['blubrry_program_keyword']);
655
+ $SaveSettings['blubrry_hosting'] = $ProgramHosting[ $SaveSettings['blubrry_program_keyword'] ];
656
+ if( !is_bool($SaveSettings['blubrry_hosting']) )
657
+ {
658
+ if( $SaveSettings['blubrry_hosting'] === 'false' || empty($SaveSettings['blubrry_hosting']) )
659
+ $SaveSettings['blubrry_hosting'] = false;
660
+ }
661
+
662
+ $Save = true;
663
+ $Close = true;
664
+ }
665
+ else if( isset($SaveSettings['blubrry_program_keyword']) ) // Present but empty
666
+ {
667
+ $Error = __('You must select a program to continue.', 'powerpress');
668
+ }
669
+ else if( count($Programs) == 1 )
670
+ {
671
+ foreach( $Programs as $keyword => $title ) {
672
+ break;
673
+ }
674
+
675
+ $SaveSettings['blubrry_program_keyword'] = $keyword;
676
+ $SaveSettings['blubrry_hosting'] = $ProgramHosting[ $keyword ];
677
+ if( !is_bool($SaveSettings['blubrry_hosting']) )
678
+ {
679
+ if( $SaveSettings['blubrry_hosting'] === 'false' || empty($SaveSettings['blubrry_hosting']) )
680
+ $SaveSettings['blubrry_hosting'] = false;
681
+ }
682
+ powerpress_add_blubrry_redirect($keyword);
683
+ $Close = true;
684
+ $Save = true;
685
+ }
686
+ else
687
+ {
688
+ $Error = __('Please select your podcast program to continue.', 'powerpress');
689
+ $Step = 2;
690
+ $Settings['blubrry_username'] = $SaveSettings['blubrry_username'];
691
+ }
692
+ }
693
+ else
694
+ {
695
+ $Error = __('No podcasts for this account are listed on blubrry.com.', 'powerpress');
696
+ }
697
+ }
698
+ }
699
+ else
700
+ {
701
+ global $g_powerpress_remote_error, $g_powerpress_remote_errorno;
702
+ //$Error = '<h3>'. __('Error', 'powerpress') .'</h3>';
703
+ if( !empty($g_powerpress_remote_errorno) && $g_powerpress_remote_errorno == 401 )
704
+ $Error .= '<p>'. __('Incorrect sign-in email address or password.', 'powerpress') .'</p><p>'. __('Verify your account settings then try again.', 'powerpress') .'</p>';
705
+ else if( !empty($g_powerpress_remote_error) )
706
+ $Error .= '<p>'.$g_powerpress_remote_error .'</p>';
707
+ else
708
+ $Error .= '<p>'.__('Authentication failed.', 'powerpress') .'</p>';
709
+ }
710
+
711
+ if( $Error )
712
+ {
713
+ $Error .= '<p style="text-align: center;"><a href="http://create.blubrry.com/resources/powerpress/powerpress-settings/services-stats/" target="_blank">'. __('Click Here For Help','powerpress') .'</a></p>';
714
+ }
715
+ }
716
+
717
+ if( $Save )
718
+ $SaveSettings['network_mode'] = (isset($SaveSettings['network_mode'])) ? 1 : 0;
719
+ powerpress_save_settings($SaveSettings);
720
+
721
+ // Clear cached statistics
722
+ delete_option('powerpress_stats');
723
+
724
+ if( $Error )
725
+ powerpress_page_message_add_notice( $Error, 'inline', false );
726
+
727
+ if( $Close )
728
+ {
729
+ powerpress_admin_jquery_header( __('Blubrry Services', 'powerpress') );
730
+ powerpress_page_message_print();
731
+ ?>
732
+ <p style="display: none; text-align: right; position: absolute; top: 5px; right: 5px; margin: 0; padding:0;"><a href="#" onclick="self.parent.tb_remove(); return false;" title="<?php echo __('Close', 'powerpress'); ?>"><img src="<?php echo admin_url(); ?>/images/no.png" alt="<?php echo __('Close', 'powerpress'); ?>" /></a></p>
733
+ <h2><?php echo __('Blubrry Services', 'powerpress'); ?></h2>
734
+ <p style="text-align: center;"><strong><?php echo __('Settings Saved Successfully!', 'powerpress'); ?></strong></p>
735
+ <p style="text-align: center;">
736
+ <a href="<?php echo admin_url("admin.php?page=powerpressadmin_basic"); ?>" onclick="self.parent.tb_remove(); return false;" target="_top"><?php echo __('Close', 'powerpress'); ?></a>
737
+ </p>
738
+ <script type="text/javascript"><!--
739
+
740
+ jQuery(document).ready(function($) {
741
+ // Upload loading, check the parent window for #blubrry_stats_settings div
742
+ if( jQuery('#blubrry_stats_settings',parent.document).length )
743
+ {
744
+ jQuery('#blubrry_stats_settings',parent.document).html('');
745
+ }
746
+ });
747
+
748
+ // --></script>
749
+ <?php
750
+ powerpress_admin_jquery_footer();
751
+ exit;
752
+ }
753
+
754
+
755
+ } // no break here, let the next case catch it...
756
+ case 'powerpress-jquery-account':
757
+ {
758
+ if( !current_user_can(POWERPRESS_CAPABILITY_MANAGE_OPTIONS) )
759
+ {
760
+ powerpress_admin_jquery_header( __('Blubrry Services', 'powerpress') );
761
+ powerpress_page_message_add_notice( __('You do not have sufficient permission to manage options.', 'powerpress') );
762
+ powerpress_page_message_print();
763
+ powerpress_admin_jquery_footer();
764
+ exit;
765
+ }
766
+
767
+ if( !ini_get( 'allow_url_fopen' ) && !function_exists( 'curl_init' ) )
768
+ {
769
+ powerpress_admin_jquery_header( __('Blubrry Services', 'powerpress') );
770
+ powerpress_page_message_add_notice( __('Your server must either have the php.ini setting \'allow_url_fopen\' enabled or have the PHP cURL library installed in order to continue.', 'powerpress') );
771
+ powerpress_page_message_print();
772
+ powerpress_admin_jquery_footer();
773
+ exit;
774
+ }
775
+
776
+ check_admin_referer('powerpress-jquery-account');
777
+
778
+ if( !$Settings )
779
+ $Settings = get_option('powerpress_general');
780
+
781
+ if( empty($Settings['blubrry_username']) )
782
+ $Settings['blubrry_username'] = '';
783
+ if( empty($Settings['blubrry_hosting']) || $Settings['blubrry_hosting'] === 'false' )
784
+ $Settings['blubrry_hosting'] = false;
785
+ if( empty($Settings['blubrry_program_keyword']) )
786
+ $Settings['blubrry_program_keyword'] = '';
787
+ if(empty($Settings['network_mode'])) {
788
+ $Settings['network_mode'] = '0';
789
+ }
790
+
791
+ if( $Programs == false )
792
+ $Programs = array();
793
+
794
+ powerpress_admin_jquery_header( __('Blubrry Services', 'powerpress') );
795
+ powerpress_page_message_print();
796
+ ?>
797
+ <form action="<?php echo admin_url('admin.php'); ?>" enctype="multipart/form-data" method="post">
798
+ <?php wp_nonce_field('powerpress-jquery-account'); ?>
799
+ <input type="hidden" name="action" value="powerpress-jquery-account-save" />
800
+ <div id="accountinfo">
801
+ <h2><?php echo __('Blubrry Services', 'powerpress'); ?></h2>
802
+ <?php if( $Step == 1 ) { ?>
803
+ <p>
804
+ <label for="blubrry_username"><?php echo __('Blubrry User Name (Email)', 'powerpress'); ?></label>
805
+ <input type="text" id="blubrry_username" name="Settings[blubrry_username]" value="<?php echo esc_attr($Settings['blubrry_username']); ?>" />
806
+ </p>
807
+ <p id="password_row">
808
+ <label for="password_password"><?php echo __('Blubrry Password', 'powerpress'); ?></label>
809
+ <input type="password" id="password_password" name="Password" value="" />
810
+ </p>
811
+ <?php } else { ?>
812
+ <input type="hidden" name="Settings[blubrry_username]" value="<?php echo esc_attr($Settings['blubrry_username']); ?>" />
813
+ <input type="hidden" name="Password" value="<?php echo esc_attr($Password); ?>" />
814
+ <!-- <input type="hidden" name="Settings[blubrry_hosting]" value="<?php echo $Settings['blubrry_hosting']; ?>" /> -->
815
+ <p>
816
+ <label for="blubrry_program_keyword"><?php echo __('Select Default Program', 'powerpress'); ?></label>
817
+ <select id="blubrry_program_keyword" name="Settings[blubrry_program_keyword]">
818
+ <?php
819
+ if (count($Programs) > 1 && $Settings['network_mode'] == '1') {
820
+ ?>
821
+ <option value="no_default"><?php echo __('No Default', 'powerpress'); ?></option>
822
+ <?php
823
+ }
824
+ foreach( $Programs as $value => $desc )
825
+ echo "\t<option value=\"$value\"". ($Settings['blubrry_program_keyword']==$value?' selected':''). ">$desc</option>\n";
826
+ ?>
827
+ </select>
828
+ </p>
829
+ <p>
830
+ <label for="blubrry_network_mode"><?php echo __('Network mode (publish to multiple Blubrry Hosting Accounts)', 'powerpress') ?></label>
831
+ <input type="checkbox" id="blubrry_network_mode" value="1" name="Settings[network_mode]" <?php echo $Settings['network_mode'] == '1' ? 'checked' : ''; ?> />
832
+ </p>
833
+ <?php } ?>
834
+ <p>
835
+ <input type="submit" name="Save" value="<?php echo __('Save', 'powerpress'); ?>" />
836
+ <input type="button" name="Cancel" value="<?php echo __('Cancel', 'powerpress'); ?>" onclick="self.parent.tb_remove();" />
837
+ <input type="submit" name="Remove" value="Remove" style="float: right;" onclick="return confirm('<?php echo __('Remove Blubrry Services Integration, are you sure?', 'powerpress'); ?>');" />
838
+ </p>
839
+ </div>
840
+ </form>
841
+ <script type="text/javascript"><!--
842
+
843
+
844
+ jQuery(document).ready(function($) {
845
+ jQuery('#blubrry_network_mode').change( function(event) {
846
+ if(this.checked) {
847
+ jQuery("#blubrry_program_keyword").prepend('<option value="no_default"><?php echo __("No Default", "powerpress"); ?></option>');
848
+ }
849
+ else {
850
+ jQuery('#blubrry_program_keyword option[value="no_default"').remove();
851
+ }
852
+
853
+ } );
854
+ } );
855
+ //-->
856
+ </script>
857
+ <?php
858
+ powerpress_admin_jquery_footer();
859
+ exit;
860
+ }; break;
861
+ case 'powerpress-jquery-upload': {
862
+
863
+ if( !current_user_can('edit_posts') )
864
+ {
865
+ powerpress_admin_jquery_header( __('Uploader', 'powerpress') );
866
+ powerpress_page_message_add_notice( __('You do not have sufficient permission to upload media.','powerpress') );
867
+ powerpress_page_message_print();
868
+ powerpress_admin_jquery_footer();
869
+ exit;
870
+ }
871
+
872
+ check_admin_referer('powerpress-jquery-upload');
873
+
874
+ $RedirectURL = false;
875
+ $Error = false;
876
+
877
+ if( !$Settings )
878
+ $Settings = get_option('powerpress_general');
879
+
880
+ if( empty($Settings['blubrry_hosting']) || $Settings['blubrry_hosting'] === 'false' )
881
+ $Settings['blubrry_hosting'] = false;
882
+ if( empty($Settings['blubrry_program_keyword']) )
883
+ $Settings['blubrry_program_keyword'] = '';
884
+ if( empty($Settings['blubrry_auth']) )
885
+ $Settings['blubrry_auth'] = '';
886
+
887
+ if( empty($Settings['blubrry_hosting']) )
888
+ {
889
+ $Error = __('This feature is available to Blubrry Hosting users only.','powerpress');
890
+ }
891
+ $blubrryProgramKeyword = $Settings['blubrry_program_keyword'];
892
+ if( !empty($_GET['blubrryProgramKeyword']) ) {
893
+ $blubrryProgramKeyword = $_GET['blubrryProgramKeyword'];
894
+ }
895
+ if( $Error == false )
896
+ {
897
+ $json_data = false;
898
+ $api_url_array = powerpress_get_api_array();
899
+ foreach( $api_url_array as $index => $api_url )
900
+ {
901
+ $req_url = sprintf('%s/media/%s/upload_session.json', rtrim($api_url, '/'), $blubrryProgramKeyword );
902
+ $req_url .= (defined('POWERPRESS_BLUBRRY_API_QSA')?'?'. POWERPRESS_BLUBRRY_API_QSA:'');
903
+ $json_data = powerpress_remote_fopen($req_url, $Settings['blubrry_auth']);
904
+ if( !$json_data && $api_url == 'https://api.blubrry.com/' ) { // Lets force cURL and see if that helps...
905
+ $json_data = powerpress_remote_fopen($req_url, $Settings['blubrry_auth'], array(), 15, false, true);
906
+ }
907
+ if( $json_data != false )
908
+ break;
909
+ }
910
+
911
+
912
+ $results = powerpress_json_decode($json_data);
913
+
914
+ // We need to obtain an upload session for this user...
915
+ if( isset($results['error']) && strlen($results['error']) > 1 )
916
+ {
917
+ $Error = $results['error'];
918
+ if( strstr($Error, 'currently not available') )
919
+ $Error = __('Unable to find podcasts for this account.','powerpress');
920
+ }
921
+ else if( $results === $json_data )
922
+ {
923
+ $Error = $json_data;
924
+ }
925
+ else if( !is_array($results) || $results == false )
926
+ {
927
+ $Error = $json_data;
928
+ }
929
+ else
930
+ {
931
+ if( isset($results['url']) && !empty($results['url']) )
932
+ $RedirectURL = $results['url'];
933
+ }
934
+ }
935
+
936
+ if( $Error == false && $RedirectURL )
937
+ {
938
+ $RedirectURL .= '&ReturnURL=';
939
+ $RedirectURL .= urlencode( admin_url("admin.php?action=powerpress-jquery-upload-complete") );
940
+ header("Location: $RedirectURL");
941
+ exit;
942
+ }
943
+ else if( $Error == false )
944
+ {
945
+ global $g_powerpress_remote_error, $g_powerpress_remote_errorno;
946
+ if( !empty($g_powerpress_remote_errorno) && $g_powerpress_remote_errorno == 401 )
947
+ $Error = '<p>'. __('Incorrect sign-in email address or password.', 'powerpress').'</p><p>'.__('Verify your account entered under Services and Statistics settings then try again.', 'powerpress') .'</p>';
948
+ else if( !empty($g_powerpress_remote_error) )
949
+ $Error = '<p>'.$g_powerpress_remote_error .'</p>';
950
+ else
951
+ $Error = '<p>'.__('Unable to obtain upload session.','powerpress') .'</p>';
952
+ }
953
+
954
+ powerpress_admin_jquery_header( __('Uploader','powerpress') );
955
+ echo '<h2>'. __('Uploader','powerpress') .'</h2>';
956
+ echo '<p>';
957
+ echo $Error;
958
+ echo '</p>';
959
+ ?>
960
+ <p style="text-align: center;"><a href="#" onclick="self.parent.tb_remove();"><?php echo __('Close', 'powerpress'); ?></a></p>
961
+ <?php
962
+ powerpress_admin_jquery_footer();
963
+ exit;
964
+ }; break;
965
+ case 'powerpress-jquery-upload-complete': {
966
+
967
+ if( !current_user_can('edit_posts') )
968
+ {
969
+ powerpress_admin_jquery_header('Uploader');
970
+ powerpress_page_message_add_notice( __('You do not have sufficient permission to upload media.', 'powerpress') );
971
+ powerpress_page_message_print();
972
+ powerpress_admin_jquery_footer();
973
+ exit;
974
+ }
975
+ // sanitize_title esc_attr esc_html powerpress_esc_html
976
+ $File = (isset($_GET['File'])? htmlspecialchars($_GET['File']):false);
977
+ $Message = (isset($_GET['Message'])? htmlspecialchars($_GET['Message']):'');
978
+
979
+ powerpress_admin_jquery_header( __('Upload Complete', 'powerpress') );
980
+ echo '<h2>'. __('Uploader', 'powerpress') .'</h2>';
981
+ echo '<p>';
982
+ if( $File )
983
+ {
984
+ echo __('File', 'powerpress') .': ';
985
+ echo $File;
986
+ echo ' - ';
987
+ }
988
+ echo $Message;
989
+ echo '</p>';
990
+ ?>
991
+ <p style="text-align: center;"><a href="#" onclick="self.parent.tb_remove();"><?php echo __('Close', 'powerpress'); ?></a></p>
992
+ <?php
993
+
994
+ if( empty($Message) )
995
+ {
996
+ ?>
997
+ <script language="JavaScript" type="text/javascript"><!--
998
+ <?php if( $File != '' ) { ?>
999
+ self.parent.SelectMedia('<?php echo $File ; ?>'); <?php } ?>
1000
+ self.parent.tb_remove();
1001
+ //-->
1002
+ </script>
1003
+ <?php
1004
+ }
1005
+ powerpress_admin_jquery_footer();
1006
+ exit;
1007
+ }; break;
1008
+ case 'powerpress-jquery-pts': {
1009
+ if( function_exists('powerpress_ajax_pts') )
1010
+ powerpress_ajax_pts($Settings);
1011
+ else
1012
+ echo "Error";
1013
+ exit;
1014
+ }; break;
1015
+ case 'powerpress-jquery-pts-post': {
1016
+ if( function_exists('powerpress_ajax_pts_post') )
1017
+ powerpress_ajax_pts_post($Settings);
1018
+ else
1019
+ echo "Error";
1020
+ }; break;
1021
+ }
1022
+
1023
+ }
1024
+
1025
+ function powerpress_admin_jquery_header($title, $jquery = false)
1026
+ {
1027
+ if( function_exists('get_current_screen') ) {
1028
+ $current_screen = get_current_screen();
1029
+ if( !empty($current_screen) && is_object($current_screen) && $current_screen->is_block_editor() ) {
1030
+ return;
1031
+ }
1032
+ }
1033
+
1034
+ header( "Expires: Mon, 26 Jul 1997 05:00:00 GMT" );
1035
+ header( "Last-Modified: " . gmdate( "D, d M Y H:i:s" ) . "GMT" );
1036
+ header( 'Cache-Control: no-store, no-cache, must-revalidate' );
1037
+ header( 'Cache-Control: post-check=0, pre-check=0', false );
1038
+ header( 'Pragma: no-cache' );
1039
+
1040
+ $other = false;
1041
+ if( $jquery )
1042
+ add_thickbox(); // we use the thckbox for some settings
1043
+ ?>
1044
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
1045
+ <html xmlns="http://www.w3.org/1999/xhtml" <?php do_action('admin_xml_ns'); ?> <?php language_attributes(); ?>>
1046
+ <head>
1047
+ <meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php bloginfo('charset'); ?>" />
1048
+ <title><?php bloginfo('name') ?> &rsaquo; <?php echo $title; ?> &#8212; <?php echo __('WordPress', 'powerpress'); ?></title>
1049
+ <?php
1050
+
1051
+ // In case these functions haven't been included yet...
1052
+ if( !defined('WP_ADMIN') )
1053
+ require_once(ABSPATH . 'wp-admin/includes/admin.php');
1054
+
1055
+ wp_admin_css( 'css/global' );
1056
+ wp_admin_css();
1057
+ if( $jquery )
1058
+ wp_enqueue_script('utils');
1059
+
1060
+ do_action('admin_print_styles');
1061
+ do_action('admin_print_scripts');
1062
+ do_action('admin_head');
1063
+
1064
+ echo '<!-- done adding extra stuff -->';
1065
+
1066
+ ?>
1067
+ <link rel="stylesheet" href="<?php echo powerpress_get_root_url(); ?>css/jquery.css" type="text/css" media="screen" />
1068
+ <?php if( $other ) echo $other; ?>
1069
+ </head>
1070
+ <body>
1071
+ <div id="container">
1072
+ <p style="display: none; text-align: right; position: absolute; top: 5px; right: 5px; margin: 0; padding: 0;"><a href="#" onclick="self.parent.tb_remove();" title="<?php echo __('Cancel', 'powerpress'); ?>"><img src="<?php echo admin_url(); ?>/images/no.png" /></a></p>
1073
+ <?php
1074
+ }
1075
+
1076
+
1077
+ function powerpress_admin_jquery_footer($jquery = false)
1078
+ {
1079
+ if( $jquery )
1080
+ do_action('admin_print_footer_scripts');
1081
+
1082
+ ?>
1083
+ </div><!-- end container -->
1084
+ </body>
1085
+ </html>
1086
+ <?php
1087
+ exit();
1088
+ }
1089
+
1090
  ?>
powerpressadmin-metabox.php CHANGED
@@ -208,6 +208,7 @@ function powerpress_meta_box($object, $box)
208
  <div id="powerpress_hosting_note_<?php echo $FeedSlug; ?>" style="margin-left: 2px; padding-bottom: 2px; padding-top: 2px; display: <?php echo ( !empty($ExtraData['hosting'])?'block':'none'); ?>"><em><?php echo __('Media file hosted by blubrry.com.', 'powerpress'); ?>
209
  (<a href="#" title="<?php echo __('Remove Blubrry.com hosted media file', 'powerpress'); ?>" onclick="powerpress_remove_hosting('<?php echo $FeedSlug; ?>');return false;"><?php echo __('remove', 'powerpress'); ?></a>)
210
  </em></div>
 
211
 
212
  <div class="powerpress-hosting-buttons">
213
  <a class="powerpress-hosting-button powerpress-button thickbox" href="<?php echo admin_url('admin.php'); ?>?action=powerpress-jquery-media&podcast-feed=<?php echo $FeedSlug; ?>&KeepThis=true&TB_iframe=true&modal=false" title="<?php echo esc_attr(__('Blubrry Podcast Hosting', 'powerpress')); ?>" class="thickbox">
208
  <div id="powerpress_hosting_note_<?php echo $FeedSlug; ?>" style="margin-left: 2px; padding-bottom: 2px; padding-top: 2px; display: <?php echo ( !empty($ExtraData['hosting'])?'block':'none'); ?>"><em><?php echo __('Media file hosted by blubrry.com.', 'powerpress'); ?>
209
  (<a href="#" title="<?php echo __('Remove Blubrry.com hosted media file', 'powerpress'); ?>" onclick="powerpress_remove_hosting('<?php echo $FeedSlug; ?>');return false;"><?php echo __('remove', 'powerpress'); ?></a>)
210
  </em></div>
211
+ <input type="hidden" id="powerpress_program_keyword_<?php echo $FeedSlug; ?>" name="Powerpress[<?php echo $FeedSlug; ?>][program_keyword]" value="<?php echo !empty($ExtraData['program_keyword']) ? $ExtraData['program_keyword']: '' ; ?>" />
212
 
213
  <div class="powerpress-hosting-buttons">
214
  <a class="powerpress-hosting-button powerpress-button thickbox" href="<?php echo admin_url('admin.php'); ?>?action=powerpress-jquery-media&podcast-feed=<?php echo $FeedSlug; ?>&KeepThis=true&TB_iframe=true&modal=false" title="<?php echo esc_attr(__('Blubrry Podcast Hosting', 'powerpress')); ?>" class="thickbox">
powerpressadmin-notifications.php CHANGED
@@ -167,35 +167,37 @@ if( powerpressadmin_notifications_appropriate() ) {
167
  $PowerPressNotificationManager = new PowerPress_Notification_Manager(); // Uncomment when we have notices to display
168
 
169
  // e.g. usage
170
-
171
- if( !$PowerPressNotificationManager->dismissed_status('spotify-201807') ) {
172
 
173
  $message = '';
174
  $message .= '<h2 style="margin: 0; padding; 0; font-size: 115%;">';
175
- $message .= __('Spotify Submissions and Google Podcasts Announcement, July 2018 - Blubrry PowerPress', 'powerpress');
176
  $message .= '</h2>';
177
 
178
- $message .= '<a href="https://create.blubrry.com/manual/podcast-promotion/submit-podcast-to-spotify/" target="_blank" class="powerpress-admin-heading">';
179
- $message .= 'Submit Your Podcasts to Spotify';
180
- $message .= '</a> ';
181
- $message .= powerpressadmin_new();
182
- $message .= '<p>PowerPress users who also use <a href="https://create.blubrry.com/resources/podcast-media-hosting/" target="_blank">Blubrry media hosting</a> can now submit their podcast to Spotify. Not a Blubrry hosting customer? Migration is free and easy, and includes free email, phone, and scheduled screen sharing support. Get started with the <a href="https://create.blubrry.com/resources/podcast-media-hosting/migrating-to-blubrry/powerpress-podcasting-plugin-wordpress/" target="_blank">Media Migration Tool</a> built into PowerPress.</p>';
183
-
184
- $message .= '<a href="https://create.blubrry.com/manual/podcast-promotion/submit-podcast-google-podcasts/" target="_blank" class="powerpress-admin-heading">';
185
- $message .= 'Google Podcasts';
186
- $message .= '</a> ';
187
- $message .= powerpressadmin_new();
188
- $message .= '<p>Google has launched a new podcast directory that is available through Google search, Google Home smart speakers and the new <a href="https://powerpresspodcast.com/2018/06/25/google-podcasts-app-is-here-yp34/" target="_blank">Google Podcasts</a> app for Android. As long as your podcast website is discoverable by Google search, your podcast will be included in this directory.</p>';
189
- //$message .= '<p>Google has launched a new Podcast directory built into Google search. No submission is necessary. As long as your website is discoverable by Google search your podcast will be indexed by Google.</p>';
190
- $message .= "\n\n";
191
 
 
192
 
193
- $message .= '<div class="powerpress-admin-heading">';
194
- $message .= 'Destinations Tab and Subscribe Page (Shortcode) and Sidebar Widget Updated';
195
- $message .= '</div> ';
196
- $message .= '<p>Destinations settings in PowerPress have been updated to include Google Podcasts and Spotify. The subscribe pages and sidebar will update with your new destinations.</p>';
 
 
 
 
 
 
 
 
 
 
 
 
197
  //$message .= '<p>Google has launched a new Podcast directory built into Google search. No submission is necessary. As long as your website is discoverable by Google search your podcast will be indexed by Google.</p>';
198
- $message .= "\n\n";
199
 
200
  //$message .= '<p>Do not forget to update the <a href="'. admin_url("admin.php?page=powerpressadmin_basic#tab-dest") .'">Destinations</a> settings in PowerPress to maximize your podcast distribution.</p>'. "\n\n";
201
 
@@ -211,9 +213,9 @@ if( powerpressadmin_notifications_appropriate() ) {
211
  $message .= ' &mdash; <a href="http://www.powerpresspodcast.com/2016/02/19/new-itunes-podcast-directory-recommendations-february-2016/" target="_blank">'. __('Learn More', 'powerpress') .'</a>';
212
  */
213
  $message .= "\n\n";
214
- $message .= '<div style="text-align: center; margin: 5px 0; font-weight: bold;"><i>'. powerpress_review_message() .'</i></div>';
215
 
216
- $PowerPressNotificationManager->add('spotify-201807', $message);
217
  }
218
 
219
  }
167
  $PowerPressNotificationManager = new PowerPress_Notification_Manager(); // Uncomment when we have notices to display
168
 
169
  // e.g. usage
170
+ if( !$PowerPressNotificationManager->dismissed_status('apple-categories-201907') ) {
 
171
 
172
  $message = '';
173
  $message .= '<h2 style="margin: 0; padding; 0; font-size: 115%;">';
174
+ $message .= __('Apple Podcasts Category Changes, July 2019 - Blubrry PowerPress', 'powerpress');
175
  $message .= '</h2>';
176
 
177
+ $message .= '<p>Apple has changed podcast categories! In mid-August the new categories will be available in the Apple Podcasts directory. For podcasters worried about what will happen to your category listing on Apple podcasts, breathe easy: Apple will map removed subcategories to their top-level category. That means that if you do nothing and your category is affected, you will still, at the very least, be in a top-level category.</p>';
178
+
179
+ $message .= '<p><strong class="powerpress-admin-heading">Take advantage of this opportunity!</strong> If your show can take advantage of the new categories, update your categories in PowerPress settings immediately. This change is an opportunity for your show to be of the first in these new categories. ';
 
 
 
 
 
 
 
 
 
 
180
 
181
+ $message .= 'Please update your <a href="'. admin_url("admin.php?page=powerpressadmin_basic#tab5") .'" class="powerpress-admin-heading">Apple Podcasts</a> settings in PowerPress to take advantage of the new categories.</p>'. "\n\n";
182
 
183
+ $message .= '<p><a href="https://powerpresspodcast.com/2019/07/17/how-the-2019-apple-podcast-category-changes-affect-for-your-podcast/" target="_blank" class="powerpress-admin-heading">';
184
+ $message .= 'Learn more about the new Apple Podcast Categories';
185
+ $message .= '</a></p>';
186
+ $message .= "\n<style>
187
+ .powerpress-admin-heading {
188
+ font-weight: bold;
189
+ }
190
+ .powerpress-notice a {
191
+ text-decoration: underline;
192
+ }
193
+ </style>\n";
194
+
195
+ //$message .= '<div class="powerpress-admin-heading">';
196
+ //$message .= 'Destinations Tab and Subscribe Page (Shortcode) and Sidebar Widget Updated';
197
+ //$message .= '</div> ';
198
+ //$message .= '<p>Destinations settings in PowerPress have been updated to include Google Podcasts and Spotify. The subscribe pages and sidebar will update with your new destinations.</p>';
199
  //$message .= '<p>Google has launched a new Podcast directory built into Google search. No submission is necessary. As long as your website is discoverable by Google search your podcast will be indexed by Google.</p>';
200
+ //$message .= "\n\n";
201
 
202
  //$message .= '<p>Do not forget to update the <a href="'. admin_url("admin.php?page=powerpressadmin_basic#tab-dest") .'">Destinations</a> settings in PowerPress to maximize your podcast distribution.</p>'. "\n\n";
203
 
213
  $message .= ' &mdash; <a href="http://www.powerpresspodcast.com/2016/02/19/new-itunes-podcast-directory-recommendations-february-2016/" target="_blank">'. __('Learn More', 'powerpress') .'</a>';
214
  */
215
  $message .= "\n\n";
216
+ $message .= '<div style="text-align: center; margin: 5px 0; font-weight: bold;"><i>'. powerpress_review_message(1) .'</i></div>';
217
 
218
+ $PowerPressNotificationManager->add('apple-categories-201907', $message);
219
  }
220
 
221
  }
powerpressadmin-ping-sites.php CHANGED
@@ -1,6 +1,5 @@
1
  <?php
2
  // powerpressadmin-ping-sites.php
3
-
4
  function powerpressadmin_ping_sites_process()
5
  {
6
  $PingSites = false;
@@ -21,11 +20,37 @@
21
  {
22
  powerpress_page_message_add_notice( __('No update services selected to add.', 'powerpress') );
23
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
24
  }
25
 
26
  function powerpress_admin_ping_sites()
27
  {
28
  $ping_sites = get_option('ping_sites');
 
 
 
 
 
 
 
29
  $BlogSites = array('http://rpc.pingomatic.com/'=> __('Ping-o-Matic!', 'powerpress'),
30
  'http://blogsearch.google.com/ping/RPC2'=> __('Google Blog Search', 'powerpress'),
31
  'http://rssrpc.weblogs.com/RPC2'=> __('WebLogs', 'powerpress') );
@@ -87,6 +112,18 @@
87
  ?>
88
  </td>
89
  </tr>
 
 
 
 
 
 
 
 
 
 
 
 
90
 
91
  </table>
92
  <p>
1
  <?php
2
  // powerpressadmin-ping-sites.php
 
3
  function powerpressadmin_ping_sites_process()
4
  {
5
  $PingSites = false;
20
  {
21
  powerpress_page_message_add_notice( __('No update services selected to add.', 'powerpress') );
22
  }
23
+ if(!empty($_POST['PowerPressWebsub']['enable']) && $_POST['PowerPressWebsub']['enable'] == '1') {
24
+ powerpress_save_settings(array('websub_enabled' => 1), 'powerpress_general');
25
+ }
26
+ else {
27
+ powerpress_save_settings(array('websub_enabled' => 0), 'powerpress_general');
28
+ }
29
+ if( !empty($_POST['PowerPressWebsub']['feed']) ) {
30
+ require_once( 'class.powerpresswebsub.php' );
31
+ $Websub = new PowerPressWebSub();
32
+ $success = false;
33
+ try {
34
+ $success = $Websub->publish($_POST['PowerPressWebsub']['feed']);
35
+ } catch (Exception $e) {
36
+ powerpress_page_message_add_error( $e->getMessage() );
37
+ }
38
+ if( $success ) {
39
+ powerpress_page_message_add_notice( __('Google PubSubHubbub test successful.', 'powerpress') );
40
+ }
41
+ }
42
  }
43
 
44
  function powerpress_admin_ping_sites()
45
  {
46
  $ping_sites = get_option('ping_sites');
47
+ $GeneralSettings = powerpress_get_settings('powerpress_general');
48
+ if(!empty($GeneralSettings['websub_enabled']) && $GeneralSettings['websub_enabled'] == 1) {
49
+ $websub_enabled = true;
50
+ }
51
+ else {
52
+ $websub_enabled = false;
53
+ }
54
  $BlogSites = array('http://rpc.pingomatic.com/'=> __('Ping-o-Matic!', 'powerpress'),
55
  'http://blogsearch.google.com/ping/RPC2'=> __('Google Blog Search', 'powerpress'),
56
  'http://rssrpc.weblogs.com/RPC2'=> __('WebLogs', 'powerpress') );
112
  ?>
113
  </td>
114
  </tr>
115
+ <tr valign="top">
116
+ <th scope="row"><?php echo __('Websub', 'powerpress'); ?></th>
117
+ <td>
118
+ <p><?php echo __('Websub allows you to notify podcast directories such as Google Podcasts immediately when you post a new episode', 'powerpress'); ?></p>
119
+ <p><input name="PowerPressWebsub[enable]" id="PowerPressWebsub[enable]" type="checkbox" value="1" <?php echo $websub_enabled ? 'checked' : '' ?> /><label for="PowerPressWebsub[enable]">Enable? </label></p>
120
+ <p><?php echo __('You can also update the hub manually below. This is useful for testing purposes.', 'powerpress'); ?></p>
121
+ <p><label for="PowerPressWebsub[feed]">Feed URL: <input name="PowerPressWebsub[feed]" type="text" /></label><input type="submit" name="testWebsub" class="button-primary button-blubrry" value="Send Test"></p>
122
+ <?php
123
+
124
+ ?>
125
+ </td>
126
+ </tr>
127
 
128
  </table>
129
  <p>
powerpressadmin.php CHANGED
@@ -595,6 +595,8 @@ function powerpress_admin_init()
595
  $General['playlist_player'] = 0;
596
  if( !isset($General['metamarks'] ) )
597
  $General['metamarks'] = 0;
 
 
598
 
599
 
600
  // Media Presentation Settings
@@ -1840,7 +1842,6 @@ function powerpress_edit_post($post_ID, $post)
1840
  }
1841
 
1842
  $Episodes = ( isset($_POST['Powerpress'])? $_POST['Powerpress'] : false);
1843
-
1844
  if( $Episodes )
1845
  {
1846
  foreach( $Episodes as $feed_slug => $Powerpress )
@@ -1912,7 +1913,7 @@ function powerpress_edit_post($post_ID, $post)
1912
  {
1913
  if( $Powerpress['set_size'] == 0 || $Powerpress['set_duration'] == 0 )
1914
  {
1915
- $MediaInfo = powerpress_get_media_info($Powerpress['url']);
1916
  if( !isset($MediaInfo['error']) )
1917
  {
1918
  if( $Powerpress['set_size'] == 0 )
@@ -1963,7 +1964,6 @@ function powerpress_edit_post($post_ID, $post)
1963
  // If we made if this far, we have the content type and file size...
1964
  $EnclosureData = $MediaURL . "\n" . $FileSize . "\n". $ContentType;
1965
  $ToSerialize = array();
1966
-
1967
  if( !empty($Powerpress['hosting']) )
1968
  $ToSerialize['hosting'] = 1;
1969
 
@@ -2030,6 +2030,8 @@ function powerpress_edit_post($post_ID, $post)
2030
  $ToSerialize['no_links'] = 1;
2031
  if( isset($Powerpress['ishd']) && $Powerpress['ishd'] )
2032
  $ToSerialize['ishd'] = 1;
 
 
2033
  if( isset($Powerpress['width']) && trim($Powerpress['width']) )
2034
  $ToSerialize['width'] =stripslashes( trim($Powerpress['width']));
2035
  if( isset($Powerpress['height']) && trim($Powerpress['height']) )
@@ -2123,14 +2125,57 @@ function powerpress_edit_post($post_ID, $post)
2123
  powerpress_metabox_save($post_ID);
2124
  }
2125
  }
2126
-
2127
  // Anytime the post is marked published, private or scheduled for the future we need to make sure we're making the media available for hosting
2128
  if( $post->post_status == 'publish' || $post->post_status == 'private' || $post->post_status == 'future' )
2129
  {
2130
  if( !empty($GeneralSettings['blubrry_hosting']) && $GeneralSettings['blubrry_hosting'] !== 'false' )
2131
  powerpress_process_hosting($post_ID, $post->post_title); // Call anytime blog post is in the published state
2132
  }
2133
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2134
  // And we're done!
2135
  return $post_ID;
2136
  }
@@ -2515,6 +2560,7 @@ function powerpress_get_media_info(FeedSlug)
2515
 
2516
  var Value = jQuery('#powerpress_url_'+FeedSlug).val();
2517
  var Hosting = jQuery('#powerpress_hosting_'+FeedSlug).val();
 
2518
  if( Value )
2519
  {
2520
  if( powerpress_check_url(Value, 'powerpress_warning_'+FeedSlug ) )
@@ -2523,7 +2569,7 @@ function powerpress_get_media_info(FeedSlug)
2523
  jQuery.ajax( {
2524
  type: 'POST',
2525
  url: '<?php echo admin_url(); ?>admin-ajax.php',
2526
- data: { action: 'powerpress_media_info', media_url : Value, feed_slug : encodeURIComponent(FeedSlug), hosting: Hosting },
2527
  timeout: (30 * 1000),
2528
  success: function(response) {
2529
 
@@ -2822,6 +2868,13 @@ function powerpress_media_info_ajax()
2822
  $size = 0;
2823
  $duration = '';
2824
  $GeneralSettings = get_option('powerpress_general');
 
 
 
 
 
 
 
2825
 
2826
  if( strpos($media_url, 'http://') !== 0 && strpos($media_url, 'https://') !== 0 && $hosting != 1 ) // If the url entered does not start with a http:// or https://
2827
  {
@@ -2846,7 +2899,7 @@ function powerpress_media_info_ajax()
2846
 
2847
  // Get media info here...
2848
  if( $hosting )
2849
- $MediaInfo = powerpress_get_media_info($media_url);
2850
  else
2851
  $MediaInfo = powerpress_get_media_info_local($media_url, '', 0, '', true);
2852
 
@@ -3513,6 +3566,10 @@ function powerpress_remote_fopen($url, $basic_auth = false, $post_args = array()
3513
  $options['body'] = $post_args;
3514
  $response = wp_remote_post( $url, $options );
3515
  }
 
 
 
 
3516
  else
3517
  {
3518
  $response = wp_remote_get( $url, $options );
@@ -3606,18 +3663,18 @@ function powerpress_process_hosting($post_ID, $post_title)
3606
 
3607
  if( strtolower(substr($EnclosureURL, 0, 7) ) != 'http://' && $EpisodeData && !empty($EpisodeData['hosting']) )
3608
  {
3609
-
3610
  $error = false;
3611
  // First we need to get media information...
3612
 
3613
  // If we are working with an Mp3, we can write id3 tags and get the info returned...
3614
  if( ($EnclosureType == 'audio/mpg' || $EnclosureType == 'audio/mpeg') && !empty($Settings['write_tags']) )
3615
  {
3616
- $results = powerpress_write_tags($EnclosureURL, $post_title);
3617
  }
3618
  else
3619
  {
3620
- $results = powerpress_get_media_info($EnclosureURL);
3621
  }
3622
 
3623
  if( is_array($results) && !isset($results['error']) )
@@ -3651,7 +3708,7 @@ function powerpress_process_hosting($post_ID, $post_title)
3651
  $api_url_array = powerpress_get_api_array();
3652
  foreach( $api_url_array as $index => $api_url )
3653
  {
3654
- $req_url = sprintf('%s/media/%s/%s?format=json&publish=true', rtrim($api_url, '/'), urlencode($Settings['blubrry_program_keyword']), urlencode($EnclosureURL) );
3655
  $req_url .= (defined('POWERPRESS_BLUBRRY_API_QSA')?'&'. POWERPRESS_BLUBRRY_API_QSA:'');
3656
  $req_url .= (defined('POWERPRESS_PUBLISH_PROTECTED')?'&protected=true':'');
3657
  $json_data = powerpress_remote_fopen($req_url, $Settings['blubrry_auth'], array(), 60*30); // give this up to 30 minutes, though 3 seocnds to 20 seconds is all one should need.
@@ -4031,11 +4088,14 @@ function powerpress_default_settings($Settings, $Section='basic')
4031
  return $Settings;
4032
  }
4033
 
4034
- function powerpress_write_tags($file, $post_title)
4035
  {
4036
  // Use the Blubrry API to write ID3 tags. to the media...
4037
 
4038
  $Settings = get_option('powerpress_general');
 
 
 
4039
 
4040
  $PostArgs = array();
4041
  $Fields = array('title','artist','album','genre','year','track','composer','copyright','url');
@@ -4092,7 +4152,7 @@ function powerpress_write_tags($file, $post_title)
4092
  $api_url_array = powerpress_get_api_array();
4093
  foreach( $api_url_array as $index => $api_url )
4094
  {
4095
- $req_url = sprintf('%s/media/%s/%s?format=json&id3=true', rtrim($api_url, '/'), urlencode($Settings['blubrry_program_keyword']), urlencode($file) );
4096
  $req_url .= (defined('POWERPRESS_BLUBRRY_API_QSA')?'&'. POWERPRESS_BLUBRRY_API_QSA:'');
4097
  $content = powerpress_remote_fopen($req_url, $Settings['blubrry_auth'], $PostArgs );
4098
  if( !$content && $api_url == 'https://api.blubrry.com/' ) { // Lets force cURL and see if that helps...
@@ -4112,14 +4172,17 @@ function powerpress_write_tags($file, $post_title)
4112
  return array('error'=>__('Error occurred writing MP3 ID3 Tags.', 'powerpress') );
4113
  }
4114
 
4115
- function powerpress_get_media_info($file)
4116
  {
4117
  $Settings = get_option('powerpress_general');
 
 
 
4118
  $content = false;
4119
  $api_url_array = powerpress_get_api_array();
4120
  foreach( $api_url_array as $index => $api_url )
4121
  {
4122
- $req_url = sprintf('%s/media/%s/%s?format=json&info=true', rtrim($api_url, '/'), urlencode($Settings['blubrry_program_keyword']), urlencode($file) );
4123
  $req_url .= (defined('POWERPRESS_BLUBRRY_API_QSA')?'&'. POWERPRESS_BLUBRRY_API_QSA:'');
4124
  $content = powerpress_remote_fopen($req_url, $Settings['blubrry_auth']);
4125
  if( !$content && $api_url == 'https://api.blubrry.com/' ) { // Lets force cURL and see if that helps...
@@ -4615,9 +4678,12 @@ function powerpress_admin_get_page()
4615
  return 'powerpressadmin_basic';
4616
  }
4617
 
4618
- function powerpress_review_message()
4619
  {
4620
- return sprintf(__('Fan of PowerPress? Please show your appreciation by <a href="%s" target="_blank">leaving a review</a>.', 'powerpress'), 'https://wordpress.org/support/view/plugin-reviews/powerpress?rate=5#postform');
 
 
 
4621
  }
4622
 
4623
  function powerpress_get_review_link()
595
  $General['playlist_player'] = 0;
596
  if( !isset($General['metamarks'] ) )
597
  $General['metamarks'] = 0;
598
+ if(!isset($General['network_mode']))
599
+ $General['network_mode'] = 0;
600
 
601
 
602
  // Media Presentation Settings
1842
  }
1843
 
1844
  $Episodes = ( isset($_POST['Powerpress'])? $_POST['Powerpress'] : false);
 
1845
  if( $Episodes )
1846
  {
1847
  foreach( $Episodes as $feed_slug => $Powerpress )
1913
  {
1914
  if( $Powerpress['set_size'] == 0 || $Powerpress['set_duration'] == 0 )
1915
  {
1916
+ $MediaInfo = powerpress_get_media_info($Powerpress['url'], $Powerpress['program_keyword']);
1917
  if( !isset($MediaInfo['error']) )
1918
  {
1919
  if( $Powerpress['set_size'] == 0 )
1964
  // If we made if this far, we have the content type and file size...
1965
  $EnclosureData = $MediaURL . "\n" . $FileSize . "\n". $ContentType;
1966
  $ToSerialize = array();
 
1967
  if( !empty($Powerpress['hosting']) )
1968
  $ToSerialize['hosting'] = 1;
1969
 
2030
  $ToSerialize['no_links'] = 1;
2031
  if( isset($Powerpress['ishd']) && $Powerpress['ishd'] )
2032
  $ToSerialize['ishd'] = 1;
2033
+ if( isset($Powerpress['program_keyword']) && !empty($Powerpress['program_keyword']) )
2034
+ $ToSerialize['program_keyword'] = $Powerpress['program_keyword'];
2035
  if( isset($Powerpress['width']) && trim($Powerpress['width']) )
2036
  $ToSerialize['width'] =stripslashes( trim($Powerpress['width']));
2037
  if( isset($Powerpress['height']) && trim($Powerpress['height']) )
2125
  powerpress_metabox_save($post_ID);
2126
  }
2127
  }
 
2128
  // Anytime the post is marked published, private or scheduled for the future we need to make sure we're making the media available for hosting
2129
  if( $post->post_status == 'publish' || $post->post_status == 'private' || $post->post_status == 'future' )
2130
  {
2131
  if( !empty($GeneralSettings['blubrry_hosting']) && $GeneralSettings['blubrry_hosting'] !== 'false' )
2132
  powerpress_process_hosting($post_ID, $post->post_title); // Call anytime blog post is in the published state
2133
  }
2134
+ //WebSub implantation
2135
+ if($post->post_status == 'publish') {
2136
+ require_once( 'class.powerpresswebsub.php' );
2137
+ $Websub = new PowerPressWebSub();
2138
+ $feedUrls = array(); //feed urls that have been updated by this post and that the hub should be notified about.
2139
+ $postType = get_post_type($post_ID);
2140
+
2141
+ if (!empty($GeneralSettings['cat_casting'])) {
2142
+ foreach (wp_get_post_categories($post_ID) as $id) {
2143
+ if (!empty($GeneralSettings['cat_casting_podcast_feeds'])) {
2144
+ array_push($feedUrls, get_category_feed_link($id, 'podcast'));
2145
+ } else {
2146
+ array_push($feedUrls, get_category_feed_link($id));
2147
+ }
2148
+ }
2149
+ }
2150
+ foreach (get_post_meta($post_ID) as $key => $value) {
2151
+ if ($key === 'enclosure') {
2152
+ //main feed updated
2153
+ array_push($feedUrls, get_feed_link('podcast'));
2154
+ }
2155
+ else if (!empty($GeneralSettings['channels']) && $postType == 'post' && preg_match("/_(\w{1,}):enclosure/i", $key, $matches) == 1) {
2156
+ array_push($feedUrls, get_feed_link($matches[1]));
2157
+ }
2158
+ }
2159
+ if (!empty($GeneralSettings['posttype_podcasting'])) {
2160
+ if ($postType != "page" || $postType != "post") {
2161
+ $PostTypeSettings = get_option('powerpress_posttype_' . $postType);
2162
+ if (!empty($PostTypeSettings)) {
2163
+ foreach ($PostTypeSettings as $feed_slug => $setting) {
2164
+ array_push($feedUrls, get_post_type_archive_feed_link($postType, $feed_slug));
2165
+ }
2166
+ }
2167
+ }
2168
+ }
2169
+ foreach ($feedUrls as $url) {
2170
+ try {
2171
+ $Websub->publish($url);
2172
+ } catch (Exception $e) {
2173
+ if( defined('WP_DEBUG') && WP_DEBUG ) {
2174
+ powerpress_page_message_add_error( $e->getMessage() );
2175
+ }
2176
+ }
2177
+ }
2178
+ }
2179
  // And we're done!
2180
  return $post_ID;
2181
  }
2560
 
2561
  var Value = jQuery('#powerpress_url_'+FeedSlug).val();
2562
  var Hosting = jQuery('#powerpress_hosting_'+FeedSlug).val();
2563
+ var program_keyword = jQuery('#powerpress_program_keyword_'+FeedSlug).val();
2564
  if( Value )
2565
  {
2566
  if( powerpress_check_url(Value, 'powerpress_warning_'+FeedSlug ) )
2569
  jQuery.ajax( {
2570
  type: 'POST',
2571
  url: '<?php echo admin_url(); ?>admin-ajax.php',
2572
+ data: { action: 'powerpress_media_info', media_url : Value, feed_slug : encodeURIComponent(FeedSlug), hosting: Hosting, program_keyword: program_keyword },
2573
  timeout: (30 * 1000),
2574
  success: function(response) {
2575
 
2868
  $size = 0;
2869
  $duration = '';
2870
  $GeneralSettings = get_option('powerpress_general');
2871
+ $program_keyword = false;
2872
+ if( !empty($_POST['program_keyword']) ) {
2873
+ $program_keyword = $_POST['program_keyword'];
2874
+ }
2875
+ if( !empty($GeneralSettings['blubrry_program_keyword']) ) {
2876
+ $program_keyword = $GeneralSettings['blubrry_program_keyword'];
2877
+ }
2878
 
2879
  if( strpos($media_url, 'http://') !== 0 && strpos($media_url, 'https://') !== 0 && $hosting != 1 ) // If the url entered does not start with a http:// or https://
2880
  {
2899
 
2900
  // Get media info here...
2901
  if( $hosting )
2902
+ $MediaInfo = powerpress_get_media_info($media_url, $program_keyword );
2903
  else
2904
  $MediaInfo = powerpress_get_media_info_local($media_url, '', 0, '', true);
2905
 
3566
  $options['body'] = $post_args;
3567
  $response = wp_remote_post( $url, $options );
3568
  }
3569
+ else if($custom_request) {
3570
+ $options['method'] = $custom_request;
3571
+ $response = wp_remote_request($url,$options);
3572
+ }
3573
  else
3574
  {
3575
  $response = wp_remote_get( $url, $options );
3663
 
3664
  if( strtolower(substr($EnclosureURL, 0, 7) ) != 'http://' && $EpisodeData && !empty($EpisodeData['hosting']) )
3665
  {
3666
+ $program_keyword = (!empty($EpisodeData['program_keyword']) ? $EpisodeData['program_keyword'] : $Settings['blubrry_program_keyword'] );
3667
  $error = false;
3668
  // First we need to get media information...
3669
 
3670
  // If we are working with an Mp3, we can write id3 tags and get the info returned...
3671
  if( ($EnclosureType == 'audio/mpg' || $EnclosureType == 'audio/mpeg') && !empty($Settings['write_tags']) )
3672
  {
3673
+ $results = powerpress_write_tags($EnclosureURL, $post_title, $program_keyword);
3674
  }
3675
  else
3676
  {
3677
+ $results = powerpress_get_media_info($EnclosureURL, $program_keyword);
3678
  }
3679
 
3680
  if( is_array($results) && !isset($results['error']) )
3708
  $api_url_array = powerpress_get_api_array();
3709
  foreach( $api_url_array as $index => $api_url )
3710
  {
3711
+ $req_url = sprintf('%s/media/%s/%s?format=json&publish=true', rtrim($api_url, '/'), urlencode($program_keyword), urlencode($EnclosureURL) );
3712
  $req_url .= (defined('POWERPRESS_BLUBRRY_API_QSA')?'&'. POWERPRESS_BLUBRRY_API_QSA:'');
3713
  $req_url .= (defined('POWERPRESS_PUBLISH_PROTECTED')?'&protected=true':'');
3714
  $json_data = powerpress_remote_fopen($req_url, $Settings['blubrry_auth'], array(), 60*30); // give this up to 30 minutes, though 3 seocnds to 20 seconds is all one should need.
4088
  return $Settings;
4089
  }
4090
 
4091
+ function powerpress_write_tags($file, $post_title, $program_keyword = false)
4092
  {
4093
  // Use the Blubrry API to write ID3 tags. to the media...
4094
 
4095
  $Settings = get_option('powerpress_general');
4096
+ if( empty($program_keyword) && !empty($Settings['blubrry_program_keyword']) ) {
4097
+ $program_keyword = $Settings['blubrry_program_keyword'];
4098
+ }
4099
 
4100
  $PostArgs = array();
4101
  $Fields = array('title','artist','album','genre','year','track','composer','copyright','url');
4152
  $api_url_array = powerpress_get_api_array();
4153
  foreach( $api_url_array as $index => $api_url )
4154
  {
4155
+ $req_url = sprintf('%s/media/%s/%s?format=json&id3=true', rtrim($api_url, '/'), urlencode($program_keyword), urlencode($file) );
4156
  $req_url .= (defined('POWERPRESS_BLUBRRY_API_QSA')?'&'. POWERPRESS_BLUBRRY_API_QSA:'');
4157
  $content = powerpress_remote_fopen($req_url, $Settings['blubrry_auth'], $PostArgs );
4158
  if( !$content && $api_url == 'https://api.blubrry.com/' ) { // Lets force cURL and see if that helps...
4172
  return array('error'=>__('Error occurred writing MP3 ID3 Tags.', 'powerpress') );
4173
  }
4174
 
4175
+ function powerpress_get_media_info($file, $program_Keyword = false)
4176
  {
4177
  $Settings = get_option('powerpress_general');
4178
+ if( empty($program_Keyword) && !empty($Settings['blubrry_program_keyword']) ) {
4179
+ $program_Keyword = $Settings['blubrry_program_keyword'];
4180
+ }
4181
  $content = false;
4182
  $api_url_array = powerpress_get_api_array();
4183
  foreach( $api_url_array as $index => $api_url )
4184
  {
4185
+ $req_url = sprintf('%s/media/%s/%s?format=json&info=true', rtrim($api_url, '/'), urlencode($program_Keyword), urlencode($file) );
4186
  $req_url .= (defined('POWERPRESS_BLUBRRY_API_QSA')?'&'. POWERPRESS_BLUBRRY_API_QSA:'');
4187
  $content = powerpress_remote_fopen($req_url, $Settings['blubrry_auth']);
4188
  if( !$content && $api_url == 'https://api.blubrry.com/' ) { // Lets force cURL and see if that helps...
4678
  return 'powerpressadmin_basic';
4679
  }
4680
 
4681
+ function powerpress_review_message($type=0)
4682
  {
4683
+ if( $type == 1 )
4684
+ return sprintf(__('If you appreciate PowerPress and the features provided, we would greatly appreciate it if you could <a href="%s" target="_blank">leave a review on WordPress.org</a>.', 'powerpress'), 'https://wordpress.org/support/plugin/powerpress/reviews/?rate=5#new-post');
4685
+
4686
+ return sprintf(__('Fan of PowerPress? Please show your appreciation by <a href="%s" target="_blank">leaving a review</a>.', 'powerpress'), 'https://wordpress.org/support/plugin/powerpress/reviews/?rate=5#new-post');
4687
  }
4688
 
4689
  function powerpress_get_review_link()
readme.txt CHANGED
@@ -1,483 +1,490 @@
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.4.4
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.4.4 =
239
- * Releasd on 6/21/2019
240
- * 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!)
241
- * Removed all mentions of Google+. (Thanks @k_abel for bringing to our attention!)
242
- * Fixed notice message getting cut off for the "Clear Plugins Update Cache" option under "Tools". (Thanks @k_abel for bringing to our attention!)
243
- * Added option `archive`="true" for the `powerpress_subscribe` shortcode to allow for the shortcode to be added to archive/category pages.
244
-
245
-
246
- = 7.4.3 =
247
- * Released on 6/12/2019
248
- * Updated labels for Subscribe buttons and links in admin.
249
- * 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.
250
- * 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!)
251
- * Force feed discovery on homepage only to use default podcast feed for Google Search.
252
- * Fixed bug with deleting media files hosted on Blubrry Podcast hosting.
253
- * Fixed bug with posts with revisions being part of the total number of episodes when viewing podcast feeds in PowerPress settings.
254
- * Fixed bug with skipto position time not getting included in feed show notes. (Thanks @tszt for bringing to our attention!)
255
-
256
-
257
- = 7.4.2 =
258
- * Released on 4/26/2019
259
- * Fixed `T_FUNCTION` bug for PHP 5.2 (not an issue if you have PHP 5.3 or newer)
260
-
261
-
262
- = 7.4.1 =
263
- * Released on 4/10/2019
264
- * Added logic to authentication email addresses differently for premium password protected podcasts.
265
- * Added support for YoastSEO and Google Podcasts (Thanks @sunkast for bringing to our attention!)
266
- * 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!)
267
- * Fixed `esc_attr()`bug with podpress import.
268
- * 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!
269
- * Changed feed join query to solve conflict with the Affiliate Disclosure Pro plugin. (Thanks @ndnakashima for bringing to our attention!)
270
- * New functionality for Taxonomy podcasting and the `powerpress_subscribe` shortcode (Thanks @tristanmason for testing!)
271
- * Fixed taxonomy bugs with the playlist player shortcodes (Thanks @tristanmason for the code and helping us test!)
272
- * PowerPress playlist player can now be ordered in ascending order with attribute order="asc" (Thanks @tristanmason for the code and helping us test!)
273
- * Fixed bug with skipto shortcode leaving a blank value in feeds. (Thanks @tszt for bringing to our attention!)
274
- * 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.
275
- * 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!)
276
-
277
-
278
- = 7.4 =
279
- * Released on 10/03/2018
280
- * 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/)
281
- * 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)
282
- * Added option to override the Google Podcasts subscribe URL.
283
- * Enhanced VideoObject, a feature in Podcasting SEO.
284
- * Improved base64 encoding Google Podcasts Subscribe URLs. (Thanks Daniel Lewis for the heads up!)
285
- * Removed option `Append show title to episode titles` per request from Apple.
286
-
287
-
288
- = 7.3 =
289
- * Released on 07/10/2018
290
- * Spotify and Google Podcasts subscribe links added to Destinations.
291
- * PowerPress users using [Blubrry Podcast Hosting](https://create.blubrry.com/resources/podcast-media-hosting/) may now submit shows to Spotify!
292
- * Added PodcastMirror setting, a modern alternative to FeedBurner. Learn more about [PodcastMirror](https://podcastmirror.com/) at [podcastmirror.com](https://podcastmirror.com/)
293
- * Converted loop logic from each() to foreach() for PHP 7.3+ / 8.0+ compatibility.
294
- * Improved logic for playlist player to appear better when certain settings are not set.
295
- * Moved the enqueue script ('jquery-ui-tabs') logic so it only loads in the powerpress admin pages. (Thanks @keenanpayne for the code change!)
296
- * 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)
297
- * Fixed bug with translation and javascript alert messages. (Thanks Enrico for reporting the bug!)
298
-
299
-
300
- = 7.2 =
301
- * Released on 12/13/2017
302
- * Added code to allow customization of Blubrry player style and colors.
303
- * Added code to set no-cache headers in AJAX calls.
304
- * 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!)
305
- * Changed the menu slug name for editing PowerPress settings.
306
- * Removed safe mode logic for older versions of PHP. (Thanks @BrentO for reporting)
307
- * Added logic to support feeds with bbpress. (Thanks @mubashiriqbal for bringing to our attention!)
308
- * Added missing argument for get_post_type_object() in powerpress-subscribe (Thanks John for bring to our attention)
309
- * 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.
310
- * Changed the names of the new iOS11 fields that were getting caught by Mod Security for some users.
311
- * 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!)
312
- * iTunes Maximizer option 11+ older episodes now includes the iTunes summary by default to reflect changes with iOS11. (Thanks Daniel Lewis for the suggestion!)
313
- * Fixed link to powerpress translation page which was returning 404
314
- * Added CastFeedValidator.com links for validating podcast feeds.
315
- * Added Hindi and Punjabi to list of Podcast feed langauges (Thanks @blueblast for requesting the languages to be added)
316
-
317
-
318
- = 7.1.1 =
319
- * Released on 08/24/2017
320
- * NOTE: There is no urgency to update to this version unless you can benefit from bug fixes listed.
321
- * 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.
322
- * Added logic to prevent the W3 Total Cache plugin from minifying podcast feeds. (Thanks @allimaple for bringing to our attention)
323
- * Fixed warning messages in the getid3 library so they comply with PHP 7.1+. (Thanks @mahe for letting us know about the problem)
324
- * Fixed error verifying URLs for file formats not supported by iTunes.
325
- * Feed import now compatible with Spreaker podcast feeds.
326
- * 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!)
327
- * Added checkbox in Blubrry Player configuration for making iTunes Episode image use optional with player. Unchecked by default.
328
-
329
-
330
- = 7.1 =
331
- * Released on 7/11/2017
332
- * Added support for iOS 11!
333
- * iTunes type added, specify episodic or serial for your podcast program (for iOS 11).
334
- * iTunes episode title, number, season and type added for your episodes (for iOS 11).
335
- * Subscribe on iTunes changed to Subscribe on Apple Podcasts, links have been enhanced to highlight episodes.
336
- * Blubrry Podcast Media Hosting and HTTPS: Media URLs are now automatically converted to HTTPS.
337
- * 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!)
338
- * Fixed error with creating the subscribe page in some languages (Thanks @edithmayerhofer for bringing to our attention).
339
- * Better error reporting when importing podcast feed images.
340
- * Verify media option improvements, mp3 duration is now detected even faster in most cases!
341
- * Added logic to prevent notice messages with the subscribe_shortcode and newest versions of PHP. (Thanks @mahe for bringing to our attention)
342
- * 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!)
343
- * Google play schema URL updated.
344
- * Added "redirect_rule" list of post types not used for podcasting. For compatibility with the "Safe Redirect Manager" plugin.
345
- * 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.
346
- * Windows Media Player in browser support has been removed. Microsoft Edge browser does not support Windows Media Player in the browser.
347
- * New logic added for dealing with Internet Explorer / Edge browser preloading media when using the MediaElement.js player.
348
- * Fixed PHP warning message if media size in bytes is zero when displaying file size with player links.
349
- * No longer using self closing XML for iTunes Categories.
350
- * iTunes subscribe itpc:// links are no longer supported.
351
- * Editing default podcast channel now imports global settings by default if blank. (Thanks Robin for bringing to our attention!)
352
- * RSS Podcast feed Import error message added when the PHP XML library is not available. (Thanks @hgetrost for bringing to our attention!)
353
-
354
-
355
- = 7.0.4 =
356
- * Released on 2/18/2017
357
- * 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.
358
- * 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!)
359
- * 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.
360
- * Changed import feed code to use the current author ID rather than hard coded to 1. (Thanks @tund3r for the bug fix!)
361
- * Import feed for libsyn updated. (Thanks @tund3r for the code fix!)
362
- * Import feed advanced option "Remove query strings from media URLs" added. (Thanks @tund3r!)
363
- * 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!)
364
- * Added colon ":" to list of characters that can be in a valid media URL. (Thanks AfterBuzzTV.com! for the heads up!)
365
- * Fixed notice message that can appear when using the media objects with the powerpress shortcode. (Thanks @srumery for reporting the problem!)
366
- * 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!)
367
- * 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.
368
- * Added ability to import a podcast feed to a post type podcast feed or to a podcast channel.
369
- * Added ability to set the post status when importing a podcast feed. (Thanks @hgetrost for the feature suggestion!)
370
- * Added compatibility with the [Custom Post Widget](https://wordpress.org/plugins/custom-post-widget/) plugin. (Thanks @aparentdesign for letting us know about the problem)
371
- * Fixed bug where ogg audio was not using the correct audio player. (Thanks @joeress for letting us know about the bug)
372
- * Fixed bug with import not matching episode media URLs correctly. (Thanks @hgetrost for bringing to our attention)
373
-
374
-
375
- = 7.0.3 =
376
- * Released 9/13/2016
377
- * Fixed issue when editing channel/category/post type podcast settings double escaping & character. (Thanks Robin Brinkler for bringing to our attention!)
378
- * Added checks for OpenSSL and cURL SSL support to the Diagnostics page.
379
- * PowerPress "Verify" option now works with MemberPress. (Thanks MemberPress for the code!)
380
- * Added new debugging define `POWERPRESS_DEBUG_QUERIES`, displays SQL queries at the bottom of the feed for diagnostic purposes.
381
- * Feed option to not allow other plugins from modyfing podcast feeds now bypasses the `the_content` and `the_excerpt` filters.
382
- * 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)
383
- * `define('POWERPRESS_FEEDS_FORCE_HTTPS', true);` when added to wp-config.php forces all media links and iTunes images to use HTTPS.
384
- * `define('POWERPRESS_FEEDS_FORCE_HTTP', true);` when added to wp-config.php forces all media links and iTunes images to use HTTP.
385
-
386
-
387
- = 7.0.2 =
388
- * Released on 7/22/2016
389
- * Fixed bug with new Blubrry Player not displaying show notes button.
390
- * Added TuneIn subscribe URL option. (Thanks @kgagne for bringing to our attention!)
391
- * Removed the PHP 5.2 or older error message in the getid3 library. (Thanks davidpmariano for the heads up!)
392
- * 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!)
393
- * 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!)
394
- * Added additional logic to better handle category podcasting when strict category podcasting is not enabled.
395
- * 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.
396
-
397
-
398
- = 7.0.1 =
399
- * Released on 6/20/2016
400
- * 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!)
401
- * 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.
402
- * Statistics redirects that do not end with a / will now work. We add a slash if no slash is present.
403
- * Removed February 2016 iTunes notice message.
404
- * Subscribe by Email, on Google Play and Stitcher options removed for premium podcast feeds.
405
- * Subscribe links will no longer appear when episode no links option checked. (Thanks @360woodworking for bringing to our attention)
406
-
407
-
408
- = 7.0 =
409
- * Released on 6/6/2016
410
- * Added Google Play Music to subscribe page shortcode embed and sidebar widget.
411
- * Added Stitcher to subscribe page shortcode embed and sidebar widget.
412
- * New: Strict Category Podcasting. Select a specific category to each episode for statistics tracking and subscription links.
413
- * New: Podcast only category feeds. You can now mix blog posts with podcast episodes in your podast categories.
414
- * New: Blubrry Audio Player. Modern podcast audio player complete with subscribe and share tools. For Blubrry Hosting customers only.
415
- * Updated the getid3 library to latest version.
416
- * 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.
417
- * 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).
418
- * Fixed bug with WP 4.5 dropping the `rss-http` content type "text/xml".
419
- * Added shortcode attribute `ids=""` so you can specify post IDs for the playlist player to display exclusively. (Thanks John Haspel for the feature suggestion!)
420
- * 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)
421
- * 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!)
422
- * Import to podcast category option added.
423
- * Added audio ac3 and dts to media detection getid3 library (these are not podcast safe formats though we can detect their meta information).
424
- * 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.
425
- * Improved feed logic to minimize SQL queries
426
- * Feed Maximizer option now applies to category podcast only feeds.
427
- * Renamed "Appearance" settings to "Website" settings
428
- * Added "Destination" settings for podcast directories and apps
429
- * You can now select from pages when setting your Subscribe Page.
430
- * Changed labels for Podcasting SEO guidance to include word "Podcasting" so not to confuse with "Web SEO".
431
- * Updated Podcasting SEO guidance to reflect how search works in Google Play Music (Thanks Daniel Lewis for confirming what is indexed!)
432
- * 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.
433
- * Removed logic to fallback to the HTML5 player for mobile devices. This was only needed when Flash based players were used.
434
- * Quicktime Embed option for m4a audio removed due to security concerns with Quicktime.
435
- * SWF embed support dropped.
436
- * Embed link now toggles embed box when clicked multiple times.
437
- * ATTENTION: The 1 pixel out audio player will be removed from PowerPress 7.1.
438
-
439
- = Additional PowerPress Version History =
440
- 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.
441
-
442
- == Upgrade Notice ==
443
- ATTENTION: The 1 pixel out audio player will be removed from PowerPress 7.1.
444
-
445
- == Contributors ==
446
- Angelo Mandato, CIO [Blubrry](http://www.blubrry.com) - Plugin founder, architect and lead developer
447
-
448
- Pat McSweeny, PHP Developer - Developed initial version (v0.1.0) of plugin
449
-
450
- 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.
451
-
452
- Darcy Fiander, [Rooty Radio](http://rootyradio.com) - Fixed bug with category links to FeedValidator.org and category title warning when validating category feeds.
453
-
454
- Joel Haasnoot, [Personal Blog](http://waarisdetrein.nl/joelhaasnoot/) - Developed PodPress archive statistics.
455
-
456
- Nicolas Bouliane, [Personal Blog](http://nicolasbouliane.com/) - contributed code for `get_the_powerpress_all_players()` function.
457
-
458
-
459
- == Translators ==
460
- * 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)
461
- * 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.
462
- * 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.
463
- * Italian translation for v2.0.4+ by [Umberto Sartori](http://veneziadoc.net/)
464
- * Romanian translation for v2.0.4+ by Alexander Ovsov (Web Geek Sciense: http://webhostinggeeks.com/science/)
465
- * Russian translation for v4.0.5+ by [Igor Mercury](http://www.nightdiary.ru/)
466
- * Brazilian Portuguese translation for v6.0+ by [Leo Lopes from Radiofobia](http://radiofobia.com.br/)
467
-
468
-
469
- == Tips and Tutorials ==
470
- * [Using PowerPress outside the Loop](http://blog.nicolasbouliane.com/?p=1695) - by [Nicolas Bouliane](http://blog.nicolasbouliane.com/)
471
- * [The PowerPress Podcast](http://www.powerpresspodcast.com/) - by [Blubrry](http://www.blubrry.com/)
472
-
473
- 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.
474
-
475
- == Feedback ==
476
- [http://create.blubrry.com/resources/powerpress/](http://create.blubrry.com/resources/powerpress/)
477
-
478
- == Support ==
479
- [http://create.blubrry.com/support/](http://create.blubrry.com/support/)
480
-
481
- == Blubrry Social ==
482
-
483
- [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
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 =
238
+ * Released on 7/23/2019
239
+ * Added new Apple categories announced in July. The new Apple Categories will be made available on Apple Podcasts mid August, 2019.
240
+ * Added Multi-program Blubrry Podcast Hosting, perfect for Category podcasting.
241
+ * Added *Update Google PubSubHubbub*, lets Google Podcasts and other podcast directory services when your podcast publishes new episodes.
242
+ * Added support for various languages to podcast as including "Thai" and "Vietnamese".
243
+
244
+
245
+ = 7.4.4 =
246
+ * Releasd on 6/21/2019
247
+ * 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!)
248
+ * Removed all mentions of Google+. (Thanks @k_abel for bringing to our attention!)
249
+ * Fixed notice message getting cut off for the "Clear Plugins Update Cache" option under "Tools". (Thanks @k_abel for bringing to our attention!)
250
+ * Added option `archive`="true" for the `powerpress_subscribe` shortcode to allow for the shortcode to be added to archive/category pages.
251
+
252
+
253
+ = 7.4.3 =
254
+ * Released on 6/12/2019
255
+ * Updated labels for Subscribe buttons and links in admin.
256
+ * 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.
257
+ * 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!)
258
+ * Force feed discovery on homepage only to use default podcast feed for Google Search.
259
+ * Fixed bug with deleting media files hosted on Blubrry Podcast hosting.
260
+ * Fixed bug with posts with revisions being part of the total number of episodes when viewing podcast feeds in PowerPress settings.
261
+ * Fixed bug with skipto position time not getting included in feed show notes. (Thanks @tszt for bringing to our attention!)
262
+
263
+
264
+ = 7.4.2 =
265
+ * Released on 4/26/2019
266
+ * Fixed `T_FUNCTION` bug for PHP 5.2 (not an issue if you have PHP 5.3 or newer)
267
+
268
+
269
+ = 7.4.1 =
270
+ * Released on 4/10/2019
271
+ * Added logic to authentication email addresses differently for premium password protected podcasts.
272
+ * Added support for YoastSEO and Google Podcasts (Thanks @sunkast for bringing to our attention!)
273
+ * 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!)
274
+ * Fixed `esc_attr()`bug with podpress import.
275
+ * 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!
276
+ * Changed feed join query to solve conflict with the Affiliate Disclosure Pro plugin. (Thanks @ndnakashima for bringing to our attention!)
277
+ * New functionality for Taxonomy podcasting and the `powerpress_subscribe` shortcode (Thanks @tristanmason for testing!)
278
+ * Fixed taxonomy bugs with the playlist player shortcodes (Thanks @tristanmason for the code and helping us test!)
279
+ * PowerPress playlist player can now be ordered in ascending order with attribute order="asc" (Thanks @tristanmason for the code and helping us test!)
280
+ * Fixed bug with skipto shortcode leaving a blank value in feeds. (Thanks @tszt for bringing to our attention!)
281
+ * 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.
282
+ * 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!)
283
+
284
+
285
+ = 7.4 =
286
+ * Released on 10/03/2018
287
+ * 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/)
288
+ * 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)
289
+ * Added option to override the Google Podcasts subscribe URL.
290
+ * Enhanced VideoObject, a feature in Podcasting SEO.
291
+ * Improved base64 encoding Google Podcasts Subscribe URLs. (Thanks Daniel Lewis for the heads up!)
292
+ * Removed option `Append show title to episode titles` per request from Apple.
293
+
294
+
295
+ = 7.3 =
296
+ * Released on 07/10/2018
297
+ * Spotify and Google Podcasts subscribe links added to Destinations.
298
+ * PowerPress users using [Blubrry Podcast Hosting](https://create.blubrry.com/resources/podcast-media-hosting/) may now submit shows to Spotify!
299
+ * Added PodcastMirror setting, a modern alternative to FeedBurner. Learn more about [PodcastMirror](https://podcastmirror.com/) at [podcastmirror.com](https://podcastmirror.com/)
300
+ * Converted loop logic from each() to foreach() for PHP 7.3+ / 8.0+ compatibility.
301
+ * Improved logic for playlist player to appear better when certain settings are not set.
302
+ * Moved the enqueue script ('jquery-ui-tabs') logic so it only loads in the powerpress admin pages. (Thanks @keenanpayne for the code change!)
303
+ * 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)
304
+ * Fixed bug with translation and javascript alert messages. (Thanks Enrico for reporting the bug!)
305
+
306
+
307
+ = 7.2 =
308
+ * Released on 12/13/2017
309
+ * Added code to allow customization of Blubrry player style and colors.
310
+ * Added code to set no-cache headers in AJAX calls.
311
+ * 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!)
312
+ * Changed the menu slug name for editing PowerPress settings.
313
+ * Removed safe mode logic for older versions of PHP. (Thanks @BrentO for reporting)
314
+ * Added logic to support feeds with bbpress. (Thanks @mubashiriqbal for bringing to our attention!)
315
+ * Added missing argument for get_post_type_object() in powerpress-subscribe (Thanks John for bring to our attention)
316
+ * 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.
317
+ * Changed the names of the new iOS11 fields that were getting caught by Mod Security for some users.
318
+ * 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!)
319
+ * iTunes Maximizer option 11+ older episodes now includes the iTunes summary by default to reflect changes with iOS11. (Thanks Daniel Lewis for the suggestion!)
320
+ * Fixed link to powerpress translation page which was returning 404
321
+ * Added CastFeedValidator.com links for validating podcast feeds.
322
+ * Added Hindi and Punjabi to list of Podcast feed langauges (Thanks @blueblast for requesting the languages to be added)
323
+
324
+
325
+ = 7.1.1 =
326
+ * Released on 08/24/2017
327
+ * NOTE: There is no urgency to update to this version unless you can benefit from bug fixes listed.
328
+ * 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.
329
+ * Added logic to prevent the W3 Total Cache plugin from minifying podcast feeds. (Thanks @allimaple for bringing to our attention)
330
+ * Fixed warning messages in the getid3 library so they comply with PHP 7.1+. (Thanks @mahe for letting us know about the problem)
331
+ * Fixed error verifying URLs for file formats not supported by iTunes.
332
+ * Feed import now compatible with Spreaker podcast feeds.
333
+ * 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!)
334
+ * Added checkbox in Blubrry Player configuration for making iTunes Episode image use optional with player. Unchecked by default.
335
+
336
+
337
+ = 7.1 =
338
+ * Released on 7/11/2017
339
+ * Added support for iOS 11!
340
+ * iTunes type added, specify episodic or serial for your podcast program (for iOS 11).
341
+ * iTunes episode title, number, season and type added for your episodes (for iOS 11).
342
+ * Subscribe on iTunes changed to Subscribe on Apple Podcasts, links have been enhanced to highlight episodes.
343
+ * Blubrry Podcast Media Hosting and HTTPS: Media URLs are now automatically converted to HTTPS.
344
+ * 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!)
345
+ * Fixed error with creating the subscribe page in some languages (Thanks @edithmayerhofer for bringing to our attention).
346
+ * Better error reporting when importing podcast feed images.
347
+ * Verify media option improvements, mp3 duration is now detected even faster in most cases!
348
+ * Added logic to prevent notice messages with the subscribe_shortcode and newest versions of PHP. (Thanks @mahe for bringing to our attention)
349
+ * 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!)
350
+ * Google play schema URL updated.
351
+ * Added "redirect_rule" list of post types not used for podcasting. For compatibility with the "Safe Redirect Manager" plugin.
352
+ * 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.
353
+ * Windows Media Player in browser support has been removed. Microsoft Edge browser does not support Windows Media Player in the browser.
354
+ * New logic added for dealing with Internet Explorer / Edge browser preloading media when using the MediaElement.js player.
355
+ * Fixed PHP warning message if media size in bytes is zero when displaying file size with player links.
356
+ * No longer using self closing XML for iTunes Categories.
357
+ * iTunes subscribe itpc:// links are no longer supported.
358
+ * Editing default podcast channel now imports global settings by default if blank. (Thanks Robin for bringing to our attention!)
359
+ * RSS Podcast feed Import error message added when the PHP XML library is not available. (Thanks @hgetrost for bringing to our attention!)
360
+
361
+
362
+ = 7.0.4 =
363
+ * Released on 2/18/2017
364
+ * 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.
365
+ * 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!)
366
+ * 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.
367
+ * Changed import feed code to use the current author ID rather than hard coded to 1. (Thanks @tund3r for the bug fix!)
368
+ * Import feed for libsyn updated. (Thanks @tund3r for the code fix!)
369
+ * Import feed advanced option "Remove query strings from media URLs" added. (Thanks @tund3r!)
370
+ * 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!)
371
+ * Added colon ":" to list of characters that can be in a valid media URL. (Thanks AfterBuzzTV.com! for the heads up!)
372
+ * Fixed notice message that can appear when using the media objects with the powerpress shortcode. (Thanks @srumery for reporting the problem!)
373
+ * 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!)
374
+ * 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.
375
+ * Added ability to import a podcast feed to a post type podcast feed or to a podcast channel.
376
+ * Added ability to set the post status when importing a podcast feed. (Thanks @hgetrost for the feature suggestion!)
377
+ * Added compatibility with the [Custom Post Widget](https://wordpress.org/plugins/custom-post-widget/) plugin. (Thanks @aparentdesign for letting us know about the problem)
378
+ * Fixed bug where ogg audio was not using the correct audio player. (Thanks @joeress for letting us know about the bug)
379
+ * Fixed bug with import not matching episode media URLs correctly. (Thanks @hgetrost for bringing to our attention)
380
+
381
+
382
+ = 7.0.3 =
383
+ * Released 9/13/2016
384
+ * Fixed issue when editing channel/category/post type podcast settings double escaping & character. (Thanks Robin Brinkler for bringing to our attention!)
385
+ * Added checks for OpenSSL and cURL SSL support to the Diagnostics page.
386
+ * PowerPress "Verify" option now works with MemberPress. (Thanks MemberPress for the code!)
387
+ * Added new debugging define `POWERPRESS_DEBUG_QUERIES`, displays SQL queries at the bottom of the feed for diagnostic purposes.
388
+ * Feed option to not allow other plugins from modyfing podcast feeds now bypasses the `the_content` and `the_excerpt` filters.
389
+ * 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)
390
+ * `define('POWERPRESS_FEEDS_FORCE_HTTPS', true);` when added to wp-config.php forces all media links and iTunes images to use HTTPS.
391
+ * `define('POWERPRESS_FEEDS_FORCE_HTTP', true);` when added to wp-config.php forces all media links and iTunes images to use HTTP.
392
+
393
+
394
+ = 7.0.2 =
395
+ * Released on 7/22/2016
396
+ * Fixed bug with new Blubrry Player not displaying show notes button.
397
+ * Added TuneIn subscribe URL option. (Thanks @kgagne for bringing to our attention!)
398
+ * Removed the PHP 5.2 or older error message in the getid3 library. (Thanks davidpmariano for the heads up!)
399
+ * 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!)
400
+ * 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!)
401
+ * Added additional logic to better handle category podcasting when strict category podcasting is not enabled.
402
+ * 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.
403
+
404
+
405
+ = 7.0.1 =
406
+ * Released on 6/20/2016
407
+ * 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!)
408
+ * 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.
409
+ * Statistics redirects that do not end with a / will now work. We add a slash if no slash is present.
410
+ * Removed February 2016 iTunes notice message.
411
+ * Subscribe by Email, on Google Play and Stitcher options removed for premium podcast feeds.
412
+ * Subscribe links will no longer appear when episode no links option checked. (Thanks @360woodworking for bringing to our attention)
413
+
414
+
415
+ = 7.0 =
416
+ * Released on 6/6/2016
417
+ * Added Google Play Music to subscribe page shortcode embed and sidebar widget.
418
+ * Added Stitcher to subscribe page shortcode embed and sidebar widget.
419
+ * New: Strict Category Podcasting. Select a specific category to each episode for statistics tracking and subscription links.
420
+ * New: Podcast only category feeds. You can now mix blog posts with podcast episodes in your podast categories.
421
+ * New: Blubrry Audio Player. Modern podcast audio player complete with subscribe and share tools. For Blubrry Hosting customers only.
422
+ * Updated the getid3 library to latest version.
423
+ * 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.
424
+ * 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).
425
+ * Fixed bug with WP 4.5 dropping the `rss-http` content type "text/xml".
426
+ * Added shortcode attribute `ids=""` so you can specify post IDs for the playlist player to display exclusively. (Thanks John Haspel for the feature suggestion!)
427
+ * 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)
428
+ * 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!)
429
+ * Import to podcast category option added.
430
+ * Added audio ac3 and dts to media detection getid3 library (these are not podcast safe formats though we can detect their meta information).
431
+ * 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.
432
+ * Improved feed logic to minimize SQL queries
433
+ * Feed Maximizer option now applies to category podcast only feeds.
434
+ * Renamed "Appearance" settings to "Website" settings
435
+ * Added "Destination" settings for podcast directories and apps
436
+ * You can now select from pages when setting your Subscribe Page.
437
+ * Changed labels for Podcasting SEO guidance to include word "Podcasting" so not to confuse with "Web SEO".
438
+ * Updated Podcasting SEO guidance to reflect how search works in Google Play Music (Thanks Daniel Lewis for confirming what is indexed!)
439
+ * 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.
440
+ * Removed logic to fallback to the HTML5 player for mobile devices. This was only needed when Flash based players were used.
441
+ * Quicktime Embed option for m4a audio removed due to security concerns with Quicktime.
442
+ * SWF embed support dropped.
443
+ * Embed link now toggles embed box when clicked multiple times.
444
+ * ATTENTION: The 1 pixel out audio player will be removed from PowerPress 7.1.
445
+
446
+ = Additional PowerPress Version History =
447
+ 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.
448
+
449
+ == Upgrade Notice ==
450
+ ATTENTION: The 1 pixel out audio player will be removed from PowerPress 7.1.
451
+
452
+ == Contributors ==
453
+ Angelo Mandato, CIO [Blubrry](http://www.blubrry.com) - Plugin founder, architect and lead developer
454
+
455
+ Pat McSweeny, PHP Developer - Developed initial version (v0.1.0) of plugin
456
+
457
+ 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.
458
+
459
+ Darcy Fiander, [Rooty Radio](http://rootyradio.com) - Fixed bug with category links to FeedValidator.org and category title warning when validating category feeds.
460
+
461
+ Joel Haasnoot, [Personal Blog](http://waarisdetrein.nl/joelhaasnoot/) - Developed PodPress archive statistics.
462
+
463
+ Nicolas Bouliane, [Personal Blog](http://nicolasbouliane.com/) - contributed code for `get_the_powerpress_all_players()` function.
464
+
465
+
466
+ == Translators ==
467
+ * 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)
468
+ * 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.
469
+ * 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.
470
+ * Italian translation for v2.0.4+ by [Umberto Sartori](http://veneziadoc.net/)
471
+ * Romanian translation for v2.0.4+ by Alexander Ovsov (Web Geek Sciense: http://webhostinggeeks.com/science/)
472
+ * Russian translation for v4.0.5+ by [Igor Mercury](http://www.nightdiary.ru/)
473
+ * Brazilian Portuguese translation for v6.0+ by [Leo Lopes from Radiofobia](http://radiofobia.com.br/)
474
+
475
+
476
+ == Tips and Tutorials ==
477
+ * [Using PowerPress outside the Loop](http://blog.nicolasbouliane.com/?p=1695) - by [Nicolas Bouliane](http://blog.nicolasbouliane.com/)
478
+ * [The PowerPress Podcast](http://www.powerpresspodcast.com/) - by [Blubrry](http://www.blubrry.com/)
479
+
480
+ 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.
481
+
482
+ == Feedback ==
483
+ [http://create.blubrry.com/resources/powerpress/](http://create.blubrry.com/resources/powerpress/)
484
+
485
+ == Support ==
486
+ [http://create.blubrry.com/support/](http://create.blubrry.com/support/)
487
+
488
+ == Blubrry Social ==
489
+
490
+ [Twitter](https://twitter.com/blubrry) - [Facebook](https://www.facebook.com/blubrry) - [YouTube](https://www.youtube.com/channel/UC9sE1Yz2deZiGAP67xYx9Xg)