PowerPress Podcasting plugin by Blubrry - Version 6.0.4

Version Description

  • Released on 8/27/2015
  • Added new Subscribe by Email option to Subscribe Links feature. By default this new feature is not enabled. Go to "PowerPress Settings" > "Media Appearance" to enable Subscribe by Email.
  • Enhanced iTunes Summary feature now maintains links.
  • Added check for null values returned from get_role function.
  • HTTPS URL warnings have been removed. The past year usage of podcast applications that do not support https is now negligible.
  • Added support for https:// media URLs for Blubrry and RawVoice statistics services.
  • Verify media URL option now verifies SSL certificates and hostnames for https URLs.
  • Added Podcast subscribe link support to post type podcasting.
  • Links to Feed Validator have been temporarily removed, service does not correctly validate secure podcast feeds. We are working on an alternative.
  • Moved defines for customizing links within the plugins_loaded action after translations are loaded.
  • Fixed bug with linking blubrry account displayed HTML syntax for sign-in errors.
  • Added logic to the Subscribe to Podcast sidebar widget to only display category, feed slug and post type settings when appropriate.
  • Added new define option POWERPRESS_NO_THE_EXCERPT, allows you to remove PowerPress's the_excerpt filter for special situations that warrant it. (Thanks Avi for the code)
  • Changed logic for the powerpress_get_the_excerpt_rss function. (Thanks Avi for the code)
  • Added 'mov' file extensions to the list of migrate-able media files.
  • Updated migrate media logic to allow for resetting of migration.
  • Improved error reporting for blubrry.com API calls.
  • Tweaked how Blubrry account linking is presented in plugin to make it easier.
Download this release

Release Info

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

Code changes from version 6.0.3 to 6.0.4

class.powerpress-subscribe-widget.php CHANGED
@@ -16,6 +16,18 @@ class PowerPressSubscribe_Widget extends WP_Widget {
16
  if ( is_active_widget( false, false, $this->id_base ) ) {
17
  add_action( 'wp_head', array( $this, 'css' ) );
18
  }
 
 
 
 
 
 
 
 
 
 
 
 
19
  }
20
 
21
  function css() {
@@ -143,17 +155,24 @@ body .pp-ssb-widget a.pp-ssb-btn:hover {
143
  $instance['subscribe_category_id'] = '';
144
  }
145
 
146
-
147
  ?>
148
  <p>
149
  <label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php esc_html_e( 'Title:' , 'powerpress'); ?></label>
150
  <input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" type="text" value="<?php echo esc_attr( $instance['title'] ); ?>" />
151
  </p>
152
- <p>
153
  <label for="<?php echo $this->get_field_id('subscribe_type'); ?>"><?php _e( 'Select Podcast Type:', 'powerpress' ); ?></label>
154
- <select class="widefat" id="<?php echo $this->get_field_id('subscribe_type'); ?>" name="<?php echo $this->get_field_name('subscribe_type'); ?>">
155
  <?php
156
- $types = array(''=>__('Default Podcast','powerpress'), 'channel'=>__('Podcast Channel','powerpress'), 'category'=>__('Category Podcasting','powerpress') ); //, 'post_type'=>__('Post Type Podcasting','powerpress'), 'ttid'=>__('Taxonomy Podcasting','powerpress'));
 
 
 
 
 
 
 
157
  while( list($type, $label) = each($types) ) {
158
  echo '<option value="' . $type . '"'
159
  . selected( $instance['subscribe_type'], $type, false )
@@ -163,9 +182,11 @@ body .pp-ssb-widget a.pp-ssb-btn:hover {
163
  </select>
164
  </p>
165
  <?php
166
- /*
 
 
167
  ?>
168
- <p id="<?php echo $this->get_field_id('subscribe_post_type_section'); ?>">
169
  <label for="<?php echo $this->get_field_id('subscribe_post_type'); ?>"><?php _e( 'Select Post Type:', 'powerpress' ); ?></label>
170
  <select class="widefat" id="<?php echo $this->get_field_id('subscribe_post_type'); ?>" name="<?php echo $this->get_field_name('subscribe_post_type'); ?>">
171
  <option value=""><?php echo __('Select Post Type', 'powerpress'); ?></option>
@@ -179,18 +200,19 @@ body .pp-ssb-widget a.pp-ssb-btn:hover {
179
  ?>
180
  </select>
181
  </p>
182
- <?php */ ?>
183
 
184
- <p id="<?php echo $this->get_field_id('subscribe_feed_slug_section'); ?>">
185
  <label for="<?php echo $this->get_field_id( 'subscribe_feed_slug' ); ?>"><?php esc_html_e( 'Feed Slug:' , 'powerpress'); ?></label>
186
  <input class="widefat" id="<?php echo $this->get_field_id( 'subscribe_feed_slug' ); ?>" name="<?php echo $this->get_field_name( 'subscribe_feed_slug' ); ?>" type="text" value="<?php echo esc_attr( $instance['subscribe_feed_slug'] ); ?>" />
187
  </p>
188
-
189
- <p id="<?php echo $this->get_field_id('subscribe_category_id_section'); ?>">
 
190
  <label for="<?php echo $this->get_field_id( 'subscribe_category_id' ); ?>"><?php esc_html_e( 'Category ID:' , 'powerpress'); ?></label>
191
  <input class="widefat" id="<?php echo $this->get_field_id( 'subscribe_category_id' ); ?>" name="<?php echo $this->get_field_name( 'subscribe_category_id' ); ?>" type="text" value="<?php echo esc_attr( $instance['subscribe_category_id'] ); ?>" />
192
  </p>
193
-
194
  <?php
195
  }
196
 
@@ -213,9 +235,11 @@ body .pp-ssb-widget a.pp-ssb-btn:hover {
213
  switch( $instance['subscribe_type'] )
214
  {
215
  case 'post_type': {
216
- if( empty($instance['subscribe_post_type']) )
 
217
  return;
218
  $ExtraData['post_type'] = $instance['subscribe_post_type'];
 
219
  };
220
  case 'channel': {
221
  if( empty($instance['subscribe_feed_slug']) )
16
  if ( is_active_widget( false, false, $this->id_base ) ) {
17
  add_action( 'wp_head', array( $this, 'css' ) );
18
  }
19
+
20
+ add_action('admin_enqueue_scripts', array( $this, 'load_scripts' ));
21
+ }
22
+
23
+ function load_scripts($hook) {
24
+
25
+ // taken from: https://pippinsplugins.com/loading-scripts-correctly-in-the-wordpress-admin/
26
+ if( $hook == 'widgets.php' )
27
+ {
28
+ //echo "<!-- $hook -->";
29
+ wp_enqueue_script( 'powerpress-subscribe-widget', plugins_url( 'js/powerpress-subscribe-widget.js' , __FILE__ ) );
30
+ }
31
  }
32
 
33
  function css() {
155
  $instance['subscribe_category_id'] = '';
156
  }
157
 
158
+ $GeneralSettings = get_option('powerpress_general');
159
  ?>
160
  <p>
161
  <label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php esc_html_e( 'Title:' , 'powerpress'); ?></label>
162
  <input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" type="text" value="<?php echo esc_attr( $instance['title'] ); ?>" />
163
  </p>
164
+ <p class="pp-sub-widget-p-subscribe_type">
165
  <label for="<?php echo $this->get_field_id('subscribe_type'); ?>"><?php _e( 'Select Podcast Type:', 'powerpress' ); ?></label>
166
+ <select class="widefat powerpress-subscribe-type" onchange="javascript: powerpress_subscribe_widget_change(this)" id="<?php echo $this->get_field_id('subscribe_type'); ?>" name="<?php echo $this->get_field_name('subscribe_type'); ?>">
167
  <?php
168
+ $types = array(''=>__('Default Podcast','powerpress'), 'channel'=>__('Podcast Channel','powerpress')); //, 'ttid'=>__('Taxonomy Podcasting','powerpress'));
169
+
170
+ if( !empty($GeneralSettings['cat_casting']) || $instance['subscribe_type'] == 'category' ) // If category podcasting enabled
171
+ $types['category'] = __('Category Podcasting','powerpress');
172
+
173
+ if( !empty($GeneralSettings['posttype_podcasting']) || $instance['subscribe_type'] == 'post_type' ) // If post type podcasting enabled
174
+ $types['post_type'] = __('Post Type Podcasting','powerpress');
175
+
176
  while( list($type, $label) = each($types) ) {
177
  echo '<option value="' . $type . '"'
178
  . selected( $instance['subscribe_type'], $type, false )
182
  </select>
183
  </p>
184
  <?php
185
+ // If Post type podcasting enabled...
186
+ if( !empty($GeneralSettings['posttype_podcasting']) || $instance['subscribe_type'] == 'post_type' )
187
+ {
188
  ?>
189
+ <p id="<?php echo $this->get_field_id('subscribe_post_type_section'); ?>" class="pp-sub-widget-p-post_type"<?php if( $instance['subscribe_type'] != 'post_type' ) echo " style=\"display: none;\""; ?>>
190
  <label for="<?php echo $this->get_field_id('subscribe_post_type'); ?>"><?php _e( 'Select Post Type:', 'powerpress' ); ?></label>
191
  <select class="widefat" id="<?php echo $this->get_field_id('subscribe_post_type'); ?>" name="<?php echo $this->get_field_name('subscribe_post_type'); ?>">
192
  <option value=""><?php echo __('Select Post Type', 'powerpress'); ?></option>
200
  ?>
201
  </select>
202
  </p>
203
+ <?php } ?>
204
 
205
+ <p id="<?php echo $this->get_field_id('subscribe_feed_slug_section'); ?>" class="pp-sub-widget-p-channel"<?php if( $instance['subscribe_type'] != 'post_type' && $instance['subscribe_type'] != 'channel' ) echo " style=\"display: none;\""; ?>>
206
  <label for="<?php echo $this->get_field_id( 'subscribe_feed_slug' ); ?>"><?php esc_html_e( 'Feed Slug:' , 'powerpress'); ?></label>
207
  <input class="widefat" id="<?php echo $this->get_field_id( 'subscribe_feed_slug' ); ?>" name="<?php echo $this->get_field_name( 'subscribe_feed_slug' ); ?>" type="text" value="<?php echo esc_attr( $instance['subscribe_feed_slug'] ); ?>" />
208
  </p>
209
+ <?php // If category podcasting...
210
+ if( !empty($GeneralSettings['cat_casting']) || $instance['subscribe_type'] == 'category' ) { ?>
211
+ <p id="<?php echo $this->get_field_id('subscribe_category_id_section'); ?>" class="pp-sub-widget-p-category"<?php if( $instance['subscribe_type'] != 'category' ) echo " style=\"display: none;\""; ?>>
212
  <label for="<?php echo $this->get_field_id( 'subscribe_category_id' ); ?>"><?php esc_html_e( 'Category ID:' , 'powerpress'); ?></label>
213
  <input class="widefat" id="<?php echo $this->get_field_id( 'subscribe_category_id' ); ?>" name="<?php echo $this->get_field_name( 'subscribe_category_id' ); ?>" type="text" value="<?php echo esc_attr( $instance['subscribe_category_id'] ); ?>" />
214
  </p>
215
+ <?php } ?>
216
  <?php
217
  }
218
 
235
  switch( $instance['subscribe_type'] )
236
  {
237
  case 'post_type': {
238
+
239
+ if( empty($instance['subscribe_post_type']) || empty($instance['subscribe_feed_slug']) )
240
  return;
241
  $ExtraData['post_type'] = $instance['subscribe_post_type'];
242
+ $ExtraData['feed'] = $instance['subscribe_feed_slug'];
243
  };
244
  case 'channel': {
245
  if( empty($instance['subscribe_feed_slug']) )
feed-podcast.php CHANGED
@@ -7,7 +7,18 @@
7
 
8
  function powerpress_get_the_excerpt_rss()
9
  {
10
- $output = get_the_excerpt();
 
 
 
 
 
 
 
 
 
 
 
11
  return apply_filters('the_excerpt_rss', $output);
12
  }
13
 
7
 
8
  function powerpress_get_the_excerpt_rss()
9
  {
10
+ global $post;
11
+
12
+ if ( post_password_required() ) {
13
+ return __( 'There is no excerpt because this is a protected post.' );
14
+ }
15
+ $output = strip_tags($post->post_excerpt);
16
+ if ( $output == '') {
17
+ $output = strip_shortcodes( $post->post_content );
18
+ $output = str_replace(']]>', ']]&gt;', $output);
19
+ $output = strip_tags($output);
20
+ }
21
+
22
  return apply_filters('the_excerpt_rss', $output);
23
  }
24
 
js/powerpress-subscribe-widget.js ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // powerpress-subscribe-widget.js
2
+
3
+ function powerpress_subscribe_widget_change(event) {
4
+ switch( jQuery(event).val() )
5
+ {
6
+ case 'channel': {
7
+ jQuery(event).closest('.widget-content').find('.pp-sub-widget-p-post_type').hide();
8
+ jQuery(event).closest('.widget-content').find('.pp-sub-widget-p-channel').show();
9
+ jQuery(event).closest('.widget-content').find('.pp-sub-widget-p-category').hide();
10
+ }; break;
11
+ case 'post_type': {
12
+ jQuery(event).closest('.widget-content').find('.pp-sub-widget-p-post_type').show();
13
+ jQuery(event).closest('.widget-content').find('.pp-sub-widget-p-channel').show();
14
+ jQuery(event).closest('.widget-content').find('.pp-sub-widget-p-category').hide();
15
+ }; break;
16
+ case 'category': {
17
+ jQuery(event).closest('.widget-content').find('.pp-sub-widget-p-post_type').hide();
18
+ jQuery(event).closest('.widget-content').find('.pp-sub-widget-p-channel').hide();
19
+ jQuery(event).closest('.widget-content').find('.pp-sub-widget-p-category').show();
20
+ }; break;
21
+ default: {
22
+ jQuery(event).closest('.widget-content').find('.pp-sub-widget-p-post_type').hide();
23
+ jQuery(event).closest('.widget-content').find('.pp-sub-widget-p-channel').hide();
24
+ jQuery(event).closest('.widget-content').find('.pp-sub-widget-p-category').hide();
25
+ }; break;
26
+ }
27
+ }
mp3info.class.php CHANGED
@@ -298,6 +298,13 @@
298
  curl_setopt($curl, CURLOPT_CUSTOMREQUEST, 'HEAD'); // HTTP request
299
  curl_setopt($curl, CURLOPT_NOBODY, true );
300
  curl_setopt($curl, CURLOPT_FAILONERROR, true);
 
 
 
 
 
 
 
301
  if ( !ini_get('safe_mode') && !ini_get('open_basedir') )
302
  {
303
  curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);
@@ -401,6 +408,13 @@
401
  curl_setopt($curl, CURLOPT_HEADER, false); // header will be at output
402
  curl_setopt($curl, CURLOPT_CUSTOMREQUEST, 'GET'); // HTTP request
403
  curl_setopt($curl, CURLOPT_NOBODY, false );
 
 
 
 
 
 
 
404
  if ( !ini_get('safe_mode') && !ini_get('open_basedir') )
405
  {
406
  curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);
@@ -482,7 +496,7 @@
482
  $this->m_file_size_only = $file_size_only;
483
 
484
  $DeleteFile = false;
485
- if( strtolower( substr($File, 0, 7) ) == 'http://' )
486
  {
487
  $LocalFile = $this->Download($File);
488
  if( $LocalFile === false )
298
  curl_setopt($curl, CURLOPT_CUSTOMREQUEST, 'HEAD'); // HTTP request
299
  curl_setopt($curl, CURLOPT_NOBODY, true );
300
  curl_setopt($curl, CURLOPT_FAILONERROR, true);
301
+ if( preg_match('/^https:\/\//', $url) !== false )
302
+ {
303
+ curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 2 );
304
+ curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, true );
305
+ curl_setopt($curl, CURLOPT_CAINFO, ABSPATH . WPINC . '/certificates/ca-bundle.crt');
306
+ }
307
+
308
  if ( !ini_get('safe_mode') && !ini_get('open_basedir') )
309
  {
310
  curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);
408
  curl_setopt($curl, CURLOPT_HEADER, false); // header will be at output
409
  curl_setopt($curl, CURLOPT_CUSTOMREQUEST, 'GET'); // HTTP request
410
  curl_setopt($curl, CURLOPT_NOBODY, false );
411
+ if( preg_match('/^https:\/\//', $url) !== false )
412
+ {
413
+ curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 2 );
414
+ curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, true );
415
+ curl_setopt($curl, CURLOPT_CAINFO, ABSPATH . WPINC . '/certificates/ca-bundle.crt');
416
+ }
417
+
418
  if ( !ini_get('safe_mode') && !ini_get('open_basedir') )
419
  {
420
  curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);
496
  $this->m_file_size_only = $file_size_only;
497
 
498
  $DeleteFile = false;
499
+ if( preg_match('/^https?:\/\//i', $File) !== false )
500
  {
501
  $LocalFile = $this->Download($File);
502
  if( $LocalFile === false )
powerpress-subscribe.php CHANGED
@@ -40,22 +40,23 @@ function powerpresssubscribe_get_settings($ExtraData)
40
  case 'post_type': {
41
  $category_id = 0;
42
  $taxonomy_term_id = 0;
43
- };
44
  case 'category': {
45
  $feed_slug = 'podcast';
46
  $taxonomy_term_id = 0;
47
- $post_type = 0;
48
  }; break;
49
  case 'ttid': {
50
  $feed_slug = 'podcast';
51
  $category_id = 0;
52
- $post_type = 0;
 
53
  }; break;
54
  case 'channel':
55
  case 'general':
56
  default: {
57
  $category_id = 0;
58
- $post_type = 0;
59
  $taxonomy_term_id = 0;
60
  }; break;
61
  }
@@ -90,6 +91,7 @@ function powerpresssubscribe_get_settings($ExtraData)
90
  $Settings['subscribe_page_url'] = powerpresssubscribe_get_subscribe_page($Settings);
91
  $Settings['itunes_url'] = powerpresssubscribe_get_itunes_url($Settings);
92
  $Settings['image_url'] = $Settings['itunes_image'];
 
93
  return $Settings;
94
  }
95
  }
@@ -127,9 +129,26 @@ function powerpresssubscribe_get_settings($ExtraData)
127
  // SWEET, CARRY ON!
128
  }; break;
129
  default: {
130
- // TODO
131
- // $url = get_post_type_archive_feed_link($post_type, $feed_slug);
132
- return false; // Not suported for now
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
133
  }; break;
134
  }
135
  }
@@ -156,6 +175,7 @@ function powerpresssubscribe_get_settings($ExtraData)
156
  $FeedSettings['subscribe_page_url'] = powerpresssubscribe_get_subscribe_page($FeedSettings);
157
  $FeedSettings['itunes_url'] = powerpresssubscribe_get_itunes_url($FeedSettings);
158
  $FeedSettings['image_url'] = $FeedSettings['itunes_image'];
 
159
  return $FeedSettings;
160
  }
161
  return false;
@@ -181,6 +201,12 @@ case 'ttid':
181
  // 1: Subscribe widget added to the links...
182
  function powerpressplayer_link_subscribe_pre($content, $media_url, $ExtraData = array() )
183
  {
 
 
 
 
 
 
184
  $SubscribeSettings = powerpresssubscribe_get_settings( $ExtraData );
185
  if( empty($SubscribeSettings) )
186
  return $content;
@@ -210,7 +236,14 @@ function powerpressplayer_link_subscribe_pre($content, $media_url, $ExtraData =
210
  $separator = true;
211
 
212
  $android_url = $matches[1] . 'subscribeonandroid.com/' . $matches[2];
213
- $player_links .= "<a href=\"". htmlspecialchars($android_url) ."\" class=\"powerpress_link_subscribe powerpress_link_subscribe_rss\" title=\"". __('Subscribe on Android', 'powerpress') ."\" rel=\"nofollow\">". __('Android','powerpress') ."</a>".PHP_EOL;
 
 
 
 
 
 
 
214
  }
215
 
216
  if( $separator )
@@ -368,7 +401,7 @@ function powerpress_subscribe_shortcode( $attr ) {
368
  $html .= '';
369
  $html .='<a href="';
370
  $html .= esc_url($Settings['itunes_url']);
371
- $html .= '" target="itunes_store" style="display:inline-block;overflow:hidden;background:url(https://linkmaker.itunes.apple.com/htmlResources/assets/en_us//images/web/linkmaker/badge_subscribe-lrg.png) no-repeat;width:135px;height:40px;}"></a>';
372
  $html .= '</div>';
373
  return $html;
374
  }
@@ -423,6 +456,8 @@ function powerpress_do_subscribe_widget($settings)
423
  $settings['image_url'] = powerpress_get_root_url() . 'itunes_default.jpg'; // Default PowerPress image used in this case.
424
  }
425
 
 
 
426
  $htmlX = '';
427
  $html = '';
428
  $html .= '<div class="pp-sub-widget pp-sub-widget-'. esc_attr($settings['style']) .'">';
@@ -443,15 +478,19 @@ function powerpress_do_subscribe_widget($settings)
443
  $html .= '<img class="pp-sub-l" src="'. esc_url( $settings['image_url'] ) .'" '. (!empty($settings['title'])?' title="'. esc_attr($settings['title']).'" ':'') .'/>';
444
  $html .= '<div class="pp-sub-btns">';
445
  if( !empty($settings['itunes_url']) ) {
446
- $html .= '<a href="'. esc_url( $settings['itunes_url'] ) .'" class="pp-sub-btn pp-sub-itunes"><span class="pp-sub-ic"></span>'. esc_html( __('on iTunes', 'powerpress') ) .'</a>';
447
  }
448
 
449
  if( preg_match('/^(https?:\/\/)(.*)$/i', $settings['feed_url'], $matches ) ) {
450
  $android_url = $matches[1] . 'subscribeonandroid.com/' . $matches[2];
451
- $html .= '<a href="'. esc_url( $android_url ) .'" class="pp-sub-btn pp-sub-android"><span class="pp-sub-ic"></span>'. esc_html( __('on Android', 'powerpress') ) .'</a>';
 
 
 
 
452
  }
453
 
454
- $html .= '<a href="'. esc_url( $settings['feed_url'] ) .'" class="pp-sub-btn pp-sub-rss"><span class="pp-sub-ic"></span>'. esc_html( __('via RSS', 'powerpress') ) .'</a>';
455
 
456
  // May want these back, not sure.
457
  //$html .= '<a href="'. esc_url( $settings['feed_url'] ) .'" class="pp-sub-btn pp-sub-bp"><span class="pp-sub-ic"></span>'. esc_html( __('BeyondPod for Android', 'powerpress') ) .'</a>';
@@ -494,18 +533,23 @@ function powerpress_do_subscribe_sidebar_widget($settings)
494
 
495
  $html .= '<div class="pp-ssb-widget pp-ssb-widget-'. esc_attr($settings['style']) .'">';
496
  if( !empty($settings['itunes_url']) ) {
497
- $html .= '<a href="'. esc_url( $settings['itunes_url'] ) .'" class="pp-ssb-btn pp-ssb-itunes"><span class="pp-ssb-ic"></span>'. esc_html( __('on iTunes', 'powerpress') ) .'</a>';
498
  }
499
 
500
  if( preg_match('/^(https?:\/\/)(.*)$/i', $settings['feed_url'], $matches ) ) {
501
  $android_url = $matches[1] . 'subscribeonandroid.com/' . $matches[2];
502
- $html .= '<a href="'. esc_url( $android_url ) .'" class="pp-ssb-btn pp-ssb-android"><span class="pp-ssb-ic"></span>'. esc_html( __('on Android', 'powerpress') ) .'</a>';
 
 
 
 
 
503
  }
504
 
505
- $html .= '<a href="'. esc_url( $settings['feed_url'] ) .'" class="pp-ssb-btn pp-ssb-rss"><span class="pp-ssb-ic"></span>'. esc_html( __('via RSS', 'powerpress') ) .'</a>';
506
  $htmlX .= '<a href="" class="pp-ssb-btn pp-ssb-email"><span class="pp--ic"></span>'. esc_html( __('via Email', 'powerpress') ) .'</a>';
507
  if( !empty($settings['subscribe_page_url']) )
508
- $html .= '<a href="'. esc_url( $settings['subscribe_page_url'] ) .'" class="pp-ssb-btn pp-ssb-more"><span class="pp-ssb-ic"></span>'. esc_html( __('More Subscribe Options', 'powerpress') ) .'</a>';
509
  $html .= '</div>';
510
 
511
  return $html;
40
  case 'post_type': {
41
  $category_id = 0;
42
  $taxonomy_term_id = 0;
43
+ }; break;
44
  case 'category': {
45
  $feed_slug = 'podcast';
46
  $taxonomy_term_id = 0;
47
+ $post_type = '';
48
  }; break;
49
  case 'ttid': {
50
  $feed_slug = 'podcast';
51
  $category_id = 0;
52
+ if( empty($post_type) )
53
+ $post_type = get_post_type();
54
  }; break;
55
  case 'channel':
56
  case 'general':
57
  default: {
58
  $category_id = 0;
59
+ $post_type = '';
60
  $taxonomy_term_id = 0;
61
  }; break;
62
  }
91
  $Settings['subscribe_page_url'] = powerpresssubscribe_get_subscribe_page($Settings);
92
  $Settings['itunes_url'] = powerpresssubscribe_get_itunes_url($Settings);
93
  $Settings['image_url'] = $Settings['itunes_image'];
94
+ $Settings['subscribe_feature_email'] = (!empty($GeneralSettings['subscribe_feature_email']) );
95
  return $Settings;
96
  }
97
  }
129
  // SWEET, CARRY ON!
130
  }; break;
131
  default: {
132
+ $SettingsArray = get_option('powerpress_posttype_'.$post_type);
133
+ $Settings = false;
134
+ if( !empty($SettingsArray[ $feed_slug ]) )
135
+ $Settings = $SettingsArray[ $feed_slug ];
136
+
137
+ if( !empty($Settings) )
138
+ {
139
+ $Settings['title'] = $Settings['title'];
140
+ if( empty($Settings['title']) )
141
+ $Settings['title'] = get_bloginfo('name') . get_wp_title_rss(); // Get category title
142
+ if( !empty($Settings['feed_redirect_url']) )
143
+ $Settings['feed_url'] = $Settings['feed_redirect_url'];
144
+ else
145
+ $Settings['feed_url'] = get_post_type_archive_feed_link($post_type, $feed_slug); // Get category feed URL
146
+ $Settings['subscribe_page_url'] = powerpresssubscribe_get_subscribe_page($Settings);
147
+ $Settings['itunes_url'] = powerpresssubscribe_get_itunes_url($Settings);
148
+ $Settings['image_url'] = $Settings['itunes_image'];
149
+ $Settings['subscribe_feature_email'] = (!empty($GeneralSettings['subscribe_feature_email']) );
150
+ return $Settings;
151
+ }
152
  }; break;
153
  }
154
  }
175
  $FeedSettings['subscribe_page_url'] = powerpresssubscribe_get_subscribe_page($FeedSettings);
176
  $FeedSettings['itunes_url'] = powerpresssubscribe_get_itunes_url($FeedSettings);
177
  $FeedSettings['image_url'] = $FeedSettings['itunes_image'];
178
+ $FeedSettings['subscribe_feature_email'] = (!empty($GeneralSettings['subscribe_feature_email']) );
179
  return $FeedSettings;
180
  }
181
  return false;
201
  // 1: Subscribe widget added to the links...
202
  function powerpressplayer_link_subscribe_pre($content, $media_url, $ExtraData = array() )
203
  {
204
+ if( get_post_type() != 'post' && empty($ExtraData['subscribe_type']) )
205
+ {
206
+ $post_type = get_post_type();
207
+ $ExtraData['subscribe_type'] = 'post_type';
208
+ }
209
+
210
  $SubscribeSettings = powerpresssubscribe_get_settings( $ExtraData );
211
  if( empty($SubscribeSettings) )
212
  return $content;
236
  $separator = true;
237
 
238
  $android_url = $matches[1] . 'subscribeonandroid.com/' . $matches[2];
239
+ $player_links .= "<a href=\"". htmlspecialchars($android_url) ."\" class=\"powerpress_link_subscribe powerpress_link_subscribe_android\" title=\"". __('Subscribe on Android', 'powerpress') ."\" rel=\"nofollow\">". __('Android','powerpress') ."</a>".PHP_EOL;
240
+ if( !empty($SubscribeSettings['subscribe_feature_email']) )
241
+ {
242
+ $player_links .= ' '.POWERPRESS_LINK_SEPARATOR .' ';
243
+ $email_url = $matches[1] . 'subscribebyemail.com/' . $matches[2];
244
+ $player_links .= "<a href=\"". htmlspecialchars($email_url) ."\" class=\"powerpress_link_subscribe powerpress_link_subscribe_email\" title=\"". __('Subscribe by Email', 'powerpress') ."\" rel=\"nofollow\">". __('Email','powerpress') ."</a>".PHP_EOL;
245
+ }
246
+
247
  }
248
 
249
  if( $separator )
401
  $html .= '';
402
  $html .='<a href="';
403
  $html .= esc_url($Settings['itunes_url']);
404
+ $html .= '" target="itunes_store" style="display:inline-block;overflow:hidden;background:url(https://linkmaker.itunes.apple.com/htmlResources/assets/en_us/images/web/linkmaker/badge_subscribe-lrg.png) no-repeat;width:135px;height:40px;}"></a>';
405
  $html .= '</div>';
406
  return $html;
407
  }
456
  $settings['image_url'] = powerpress_get_root_url() . 'itunes_default.jpg'; // Default PowerPress image used in this case.
457
  }
458
 
459
+ $PowerPressSettings = get_option('powerpress_general');
460
+
461
  $htmlX = '';
462
  $html = '';
463
  $html .= '<div class="pp-sub-widget pp-sub-widget-'. esc_attr($settings['style']) .'">';
478
  $html .= '<img class="pp-sub-l" src="'. esc_url( $settings['image_url'] ) .'" '. (!empty($settings['title'])?' title="'. esc_attr($settings['title']).'" ':'') .'/>';
479
  $html .= '<div class="pp-sub-btns">';
480
  if( !empty($settings['itunes_url']) ) {
481
+ $html .= '<a href="'. esc_url( $settings['itunes_url'] ) .'" class="pp-sub-btn pp-sub-itunes" title="'. esc_attr( __('Subscribe on iTunes', 'powerpress') ) .'"><span class="pp-sub-ic"></span>'. esc_html( __('on iTunes', 'powerpress') ) .'</a>';
482
  }
483
 
484
  if( preg_match('/^(https?:\/\/)(.*)$/i', $settings['feed_url'], $matches ) ) {
485
  $android_url = $matches[1] . 'subscribeonandroid.com/' . $matches[2];
486
+ $html .= '<a href="'. esc_url( $android_url ) .'" class="pp-sub-btn pp-sub-android" title="'. esc_attr( __('Subscribe on Android', 'powerpress') ) .'"><span class="pp-sub-ic"></span>'. esc_html( __('on Android', 'powerpress') ) .'</a>';
487
+ if( !empty($PowerPressSettings['subscribe_feature_email']) ) {
488
+ $email_url = $matches[1] . 'subscribebyemail.com/' . $matches[2];
489
+ $html .= '<a href="'. esc_url( $email_url ) .'" class="pp-sub-btn pp-sub-email" title="'. esc_attr( __('Subscribe by Email', 'powerpress') ) .'"><span class="pp-sub-ic"></span>'. esc_html( __('by Email', 'powerpress') ) .'</a>';
490
+ }
491
  }
492
 
493
+ $html .= '<a href="'. esc_url( $settings['feed_url'] ) .'" class="pp-sub-btn pp-sub-rss" title="'. esc_attr( __('Subscribe via RSS', 'powerpress') ) .'"><span class="pp-sub-ic"></span>'. esc_html( __('via RSS', 'powerpress') ) .'</a>';
494
 
495
  // May want these back, not sure.
496
  //$html .= '<a href="'. esc_url( $settings['feed_url'] ) .'" class="pp-sub-btn pp-sub-bp"><span class="pp-sub-ic"></span>'. esc_html( __('BeyondPod for Android', 'powerpress') ) .'</a>';
533
 
534
  $html .= '<div class="pp-ssb-widget pp-ssb-widget-'. esc_attr($settings['style']) .'">';
535
  if( !empty($settings['itunes_url']) ) {
536
+ $html .= '<a href="'. esc_url( $settings['itunes_url'] ) .'" class="pp-ssb-btn pp-ssb-itunes" title="'. esc_attr( __('Subscribe on iTunes', 'powerpress') ) .'"><span class="pp-ssb-ic"></span>'. esc_html( __('on iTunes', 'powerpress') ) .'</a>';
537
  }
538
 
539
  if( preg_match('/^(https?:\/\/)(.*)$/i', $settings['feed_url'], $matches ) ) {
540
  $android_url = $matches[1] . 'subscribeonandroid.com/' . $matches[2];
541
+ $html .= '<a href="'. esc_url( $android_url ) .'" class="pp-ssb-btn pp-ssb-android" title="'. esc_attr( __('Subscribe on Android', 'powerpress') ) .'"><span class="pp-ssb-ic"></span>'. esc_html( __('on Android', 'powerpress') ) .'</a>';
542
+ if( !empty($settings['subscribe_feature_email']) ) {
543
+ $email_url = $matches[1] . 'subscribebyemail.com/' . $matches[2];
544
+ $html .= '<a href="'. esc_url( $email_url ) .'" class="pp-ssb-btn pp-ssb-email" title="'. esc_attr( __('Subscribe by Email', 'powerpress') ) .'"><span class="pp-ssb-ic"></span>'. esc_html( __('by Email', 'powerpress') ) .'</a>';
545
+ }
546
+
547
  }
548
 
549
+ $html .= '<a href="'. esc_url( $settings['feed_url'] ) .'" class="pp-ssb-btn pp-ssb-rss" title="'. esc_attr( __('Subscribe via RSS', 'powerpress') ) .'"><span class="pp-ssb-ic"></span>'. esc_html( __('via RSS', 'powerpress') ) .'</a>';
550
  $htmlX .= '<a href="" class="pp-ssb-btn pp-ssb-email"><span class="pp--ic"></span>'. esc_html( __('via Email', 'powerpress') ) .'</a>';
551
  if( !empty($settings['subscribe_page_url']) )
552
+ $html .= '<a href="'. esc_url( $settings['subscribe_page_url'] ) .'" class="pp-ssb-btn pp-ssb-more" title="'. esc_attr( __('More Subscribe Options', 'powerpress') ) .'"><span class="pp-ssb-ic"></span>'. esc_html( __('More Subscribe Options', 'powerpress') ) .'</a>';
553
  $html .= '</div>';
554
 
555
  return $html;
powerpress.php CHANGED
@@ -3,7 +3,7 @@
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> adds podcasting support to your blog. Features include: media player, 3rd party statistics, iTunes integration, Blubrry Services (Media Statistics and Hosting) integration and a lot more.
6
- Version: 6.0.3
7
  Author: Blubrry
8
  Author URI: http://www.blubrry.com/
9
  Change Log:
@@ -32,7 +32,7 @@ if( !function_exists('add_action') )
32
  die("access denied.");
33
 
34
  // WP_PLUGIN_DIR (REMEMBER TO USE THIS DEFINE IF NEEDED)
35
- define('POWERPRESS_VERSION', '6.0.3' );
36
 
37
  // Translation support:
38
  if ( !defined('POWERPRESS_ABSPATH') )
@@ -46,25 +46,14 @@ if ( !defined('POWERPRESS_ABSPATH') )
46
  // you upgrade the plugin.
47
  /////////////////////////////////////////////////////
48
 
49
- // Set specific play and download labels for your installation of PowerPress
50
- if( !defined('POWERPRESS_LINKS_TEXT') )
51
- define('POWERPRESS_LINKS_TEXT', __('Podcast', 'powerpress') );
52
- if( !defined('POWERPRESS_DURATION_TEXT') )
53
- define('POWERPRESS_DURATION_TEXT', __('Duration', 'powerpress') );
54
- if( !defined('POWERPRESS_PLAY_IN_NEW_WINDOW_TEXT') )
55
- define('POWERPRESS_PLAY_IN_NEW_WINDOW_TEXT', __('Play in new window', 'powerpress') );
56
- if( !defined('POWERPRESS_DOWNLOAD_TEXT') )
57
- define('POWERPRESS_DOWNLOAD_TEXT', __('Download', 'powerpress') );
58
- if( !defined('POWERPRESS_PLAY_TEXT') )
59
- define('POWERPRESS_PLAY_TEXT', __('Play', 'powerpress') );
60
- if( !defined('POWERPRESS_EMBED_TEXT') )
61
- define('POWERPRESS_EMBED_TEXT', __('Embed', 'powerpress') );
62
- if( !defined('POWERPRESS_READ_TEXT') )
63
- define('POWERPRESS_READ_TEXT', __('Read', 'powerpress') );
64
 
65
  if( !defined('POWERPRESS_BLUBRRY_API_URL') )
66
  define('POWERPRESS_BLUBRRY_API_URL', 'http://api.blubrry.com/');
67
 
 
 
 
68
  // Display custom play image for quicktime media. Applies to on page player only.
69
  //define('POWERPRESS_PLAY_IMAGE', 'http://www.blubrry.com/themes/blubrry/images/player/PlayerBadge150x50NoBorder.jpg');
70
 
@@ -133,7 +122,7 @@ function powerpress_content($content)
133
  $GeneralSettings['player_aggressive'] = 1;
134
  }
135
  if( defined('JETPACK__VERSION') && version_compare(JETPACK__VERSION, '2.0', '>=') ) {
136
- $GeneralSettings['player_aggressive'] = 3;
137
  }
138
  }
139
 
@@ -337,9 +326,11 @@ function powerpress_content($content)
337
  return $content;
338
  }//end function
339
 
 
340
  add_filter('get_the_excerpt', 'powerpress_content', (POWERPRESS_CONTENT_ACTION_PRIORITY - 1) );
341
  add_filter('the_content', 'powerpress_content', POWERPRESS_CONTENT_ACTION_PRIORITY);
342
- add_filter('the_excerpt', 'powerpress_content', POWERPRESS_CONTENT_ACTION_PRIORITY);
 
343
 
344
 
345
  /* Specail case fix Yoast bug which messes up the HTML */
@@ -814,14 +805,20 @@ function powerpress_rss2_item()
814
 
815
  $excerpt_no_html = '';
816
  $content_no_html = '';
 
817
  if( !$subtitle || !$summary )
 
 
818
  $excerpt_no_html = strip_tags($post->post_excerpt);
 
 
819
  if( (!$subtitle && !$excerpt_no_html) || (!$summary && !$powerpress_feed['enhance_itunes_summary'] && !$excerpt_no_html ) )
820
  {
821
  // Strip and format the wordpress way, but don't apply any other filters for these itunes tags
822
  $content_no_html = $post->post_content;
823
  $content_no_html = strip_shortcodes( $content_no_html );
824
  $content_no_html = str_replace(']]>', ']]&gt;', $content_no_html);
 
825
  $content_no_html = strip_tags($content_no_html);
826
  }
827
 
@@ -837,11 +834,11 @@ function powerpress_rss2_item()
837
  if( $summary )
838
  echo "\t\t<itunes:summary>". powerpress_format_itunes_value($summary, 'summary') .'</itunes:summary>'.PHP_EOL;
839
  else if( $powerpress_feed['enhance_itunes_summary'] )
840
- echo "\t\t<itunes:summary>". powerpress_itunes_summary($post->post_content) .'</itunes:summary>'.PHP_EOL;
841
- else if( $excerpt_no_html )
842
  echo "\t\t<itunes:summary>". powerpress_format_itunes_value($excerpt_no_html, 'summary') .'</itunes:summary>'.PHP_EOL;
843
  else
844
- echo "\t\t<itunes:summary>". powerpress_format_itunes_value($content_no_html, 'summary') .'</itunes:summary>'.PHP_EOL;
845
 
846
  if( $author )
847
  echo "\t\t<itunes:author>" . esc_html($author) . '</itunes:author>'.PHP_EOL;
@@ -1179,7 +1176,7 @@ function powerpress_do_podcast_feed($for_comments=false)
1179
  }
1180
  else
1181
  {
1182
- do_feed_rss2($for_comments);
1183
  }
1184
 
1185
  }
@@ -1448,6 +1445,27 @@ function powerpress_plugins_loaded()
1448
  load_plugin_textdomain('powerpress', // domain / keyword name of plugin
1449
  POWERPRESS_ABSPATH .'/languages', // Absolute path
1450
  basename(POWERPRESS_ABSPATH).'/languages' ); // relative path in plugins folder
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1451
  }
1452
  add_action('plugins_loaded', 'powerpress_plugins_loaded');
1453
 
@@ -1503,7 +1521,7 @@ function powerpress_load_general_feed_settings()
1503
  $powerpress_feed['default_url'] = rtrim($GeneralSettings['default_url'], '/') .'/';
1504
  $explicit_array = array("no", "yes", "clean");
1505
  $powerpress_feed['explicit'] = $explicit_array[$Feed['itunes_explicit']];
1506
- if( $Feed['itunes_talent_name'] )
1507
  $powerpress_feed['itunes_talent_name'] = $Feed['itunes_talent_name'];
1508
  else
1509
  $powerpress_feed['itunes_talent_name'] = get_bloginfo_rss('name');
@@ -1532,7 +1550,19 @@ function powerpress_load_general_feed_settings()
1532
  // We need to get the term_id and the tax_id (tt_id)
1533
  $term_slug = get_query_var('term');
1534
  $taxonomy = get_query_var('taxonomy');
1535
- $term = term_exists($term_slug, $taxonomy);
 
 
 
 
 
 
 
 
 
 
 
 
1536
 
1537
  if( !empty($term['term_taxonomy_id']) )
1538
  {
@@ -1549,7 +1579,7 @@ function powerpress_load_general_feed_settings()
1549
  $powerpress_feed['default_url'] = rtrim($GeneralSettings['default_url'], '/') .'/';
1550
  $explicit_array = array("no", "yes", "clean");
1551
  $powerpress_feed['explicit'] = $explicit_array[$Feed['itunes_explicit']];
1552
- if( $Feed['itunes_talent_name'] )
1553
  $powerpress_feed['itunes_talent_name'] = $Feed['itunes_talent_name'];
1554
  else
1555
  $powerpress_feed['itunes_talent_name'] = get_bloginfo_rss('name');
@@ -2120,7 +2150,7 @@ function powerpress_get_contenttype($file, $use_wp_check_filetype = true)
2120
  function powerpress_itunes_summary($html)
2121
  {
2122
  // Do some smart conversion of the post html to readable text without HTML.
2123
-
2124
  // First, convert: <a href="link"...>label</a>
2125
  // to: label (link)
2126
  $html = preg_replace_callback('/(\<a[^\>]*href="([^"]*)"[^\>]*>([^\<]*)<\/a\>)/i',
@@ -2138,6 +2168,7 @@ function powerpress_itunes_summary($html)
2138
  'return "({$matches[2]})";'
2139
  ),
2140
  $html);
 
2141
 
2142
  // For now make them bullet points...
2143
  $html = str_replace('<li>', '<li>* ', $html);
@@ -2145,9 +2176,9 @@ function powerpress_itunes_summary($html)
2145
  // Now do all the other regular conversions...
2146
  $html = strip_shortcodes( $html );
2147
  $html = str_replace(']]>', ']]&gt;', $html);
2148
- $content_no_html = strip_tags($html);
2149
- $content_no_html = powerpress_format_itunes_value($content_no_html, 'summary');
2150
- $content_no_html = preg_replace('/(\(http:\/\/[^\)\s]*)$/i', '', $content_no_html);
2151
  return $content_no_html;
2152
  }
2153
 
@@ -2283,6 +2314,8 @@ function powerpress_format_itunes_value($value, $tag)
2283
  $value = @html_entity_decode($value, ENT_COMPAT, 'UTF-8'); // Remove any additional entities such as &nbsp;
2284
  $value = preg_replace( '/&amp;/ui' , '&', $value); // Precaution in case it didn't get removed from function above.
2285
 
 
 
2286
  return esc_html( powerpress_trim_itunes_value($value, $tag) );
2287
  }
2288
 
@@ -2296,6 +2329,7 @@ function powerpress_trim_itunes_value($value, $tag = 'summary')
2296
  switch($tag)
2297
  {
2298
  case 'description':
 
2299
  case 'summary': {
2300
  // 4000 character limit
2301
  if( $length > 4000 )
@@ -2338,17 +2372,22 @@ function powerpress_trim_itunes_value($value, $tag = 'summary')
2338
 
2339
  if( $remove_new_lines )
2340
  $value = str_replace( array("\r\n\r\n", "\n", "\r", "\t","- "), array(' - ',' ', '', ' ', ''), $value );
 
 
 
2341
 
2342
  return $value;
2343
  }
2344
 
2345
  function powerpress_add_redirect_url($MediaURL, $channel = 'podcast')
2346
  {
2347
- if( preg_match('/^http\:/i', $MediaURL) === false )
2348
- return $MediaURL; // If the user is hosting media not via http (e.g. https or ftp) then we can't handle the redirect
2349
 
2350
  $NewURL = apply_filters('powerpress_redirect_url', $MediaURL);
2351
 
 
 
2352
  $GeneralSettings = false;
2353
  if( !$GeneralSettings ) // Get the general settings if not passed to this function, maintain the settings globally for further use
2354
  {
@@ -2424,19 +2463,26 @@ function powerpress_add_redirect_url($MediaURL, $channel = 'podcast')
2424
  $key = sprintf('redirect%d', $x);
2425
  if( !empty($GeneralSettings[ $key ]) )
2426
  {
2427
- $RedirectClean = str_replace('http://', '', trim($GeneralSettings[ $key ]) );
 
 
 
2428
  if( !empty($RedirectClean) )
2429
  {
2430
  if( strpos($RedirectClean, '/') == 0 ) // Not a valid redirect URL
2431
  continue;
2432
  // Check that redirect is either media..blubrry.com, media.techpodcasts.com, media.rawvoice.com, or www.podtrac.com
2433
  $ValidRedirectDomains = array('media.blubrry.com', 'media.rawvoice.com', 'media.techpodcasts.com', 'www.podtrac.com', 'podtrac.com');
 
 
 
2434
  $RedirectDomain = strtolower(substr($RedirectClean, 0, strpos($RedirectClean, '/') ));
 
2435
  if( !in_array($RedirectDomain, $ValidRedirectDomains) )
2436
  continue; // Not a valid domain so lets not add it
2437
 
2438
  if( !strstr($NewURL, $RedirectClean) )
2439
- $NewURL = 'http://'. $RedirectClean . str_replace('http://', '', $NewURL);
2440
  }
2441
  }
2442
  }
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> adds podcasting support to your blog. Features include: media player, 3rd party statistics, iTunes integration, Blubrry Services (Media Statistics and Hosting) integration and a lot more.
6
+ Version: 6.0.4
7
  Author: Blubrry
8
  Author URI: http://www.blubrry.com/
9
  Change Log:
32
  die("access denied.");
33
 
34
  // WP_PLUGIN_DIR (REMEMBER TO USE THIS DEFINE IF NEEDED)
35
+ define('POWERPRESS_VERSION', '6.0.4' );
36
 
37
  // Translation support:
38
  if ( !defined('POWERPRESS_ABSPATH') )
46
  // you upgrade the plugin.
47
  /////////////////////////////////////////////////////
48
 
49
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
50
 
51
  if( !defined('POWERPRESS_BLUBRRY_API_URL') )
52
  define('POWERPRESS_BLUBRRY_API_URL', 'http://api.blubrry.com/');
53
 
54
+ // Replace validator service with one that is more reliable here:
55
+ // define('POWERPRESS_FEEDVALIDATOR_URL', 'http://www.feedvalidator.org/check.cgi?url=');
56
+
57
  // Display custom play image for quicktime media. Applies to on page player only.
58
  //define('POWERPRESS_PLAY_IMAGE', 'http://www.blubrry.com/themes/blubrry/images/player/PlayerBadge150x50NoBorder.jpg');
59
 
122
  $GeneralSettings['player_aggressive'] = 1;
123
  }
124
  if( defined('JETPACK__VERSION') && version_compare(JETPACK__VERSION, '2.0', '>=') ) {
125
+ $GeneralSettings['player_aggressive'] = 1; // Jet pack still doesn't behave with PowerPress the_content
126
  }
127
  }
128
 
326
  return $content;
327
  }//end function
328
 
329
+
330
  add_filter('get_the_excerpt', 'powerpress_content', (POWERPRESS_CONTENT_ACTION_PRIORITY - 1) );
331
  add_filter('the_content', 'powerpress_content', POWERPRESS_CONTENT_ACTION_PRIORITY);
332
+ if( !defined('POWERPRESS_NO_THE_EXCERPT') )
333
+ add_filter('the_excerpt', 'powerpress_content', POWERPRESS_CONTENT_ACTION_PRIORITY);
334
 
335
 
336
  /* Specail case fix Yoast bug which messes up the HTML */
805
 
806
  $excerpt_no_html = '';
807
  $content_no_html = '';
808
+ $content_no_html_a = '';
809
  if( !$subtitle || !$summary )
810
+ {
811
+ $excerpt_no_html_a = strip_tags($post->post_excerpt , '<a>');
812
  $excerpt_no_html = strip_tags($post->post_excerpt);
813
+ }
814
+
815
  if( (!$subtitle && !$excerpt_no_html) || (!$summary && !$powerpress_feed['enhance_itunes_summary'] && !$excerpt_no_html ) )
816
  {
817
  // Strip and format the wordpress way, but don't apply any other filters for these itunes tags
818
  $content_no_html = $post->post_content;
819
  $content_no_html = strip_shortcodes( $content_no_html );
820
  $content_no_html = str_replace(']]>', ']]&gt;', $content_no_html);
821
+ $content_no_html_a = strip_tags($content_no_html, '<a>');
822
  $content_no_html = strip_tags($content_no_html);
823
  }
824
 
834
  if( $summary )
835
  echo "\t\t<itunes:summary>". powerpress_format_itunes_value($summary, 'summary') .'</itunes:summary>'.PHP_EOL;
836
  else if( $powerpress_feed['enhance_itunes_summary'] )
837
+ echo "\t\t<itunes:summary><![CDATA[". powerpress_itunes_summary($post->post_content) .']]></itunes:summary>'.PHP_EOL;
838
+ else if( $excerpt_no_html ) // $content_no_html_a
839
  echo "\t\t<itunes:summary>". powerpress_format_itunes_value($excerpt_no_html, 'summary') .'</itunes:summary>'.PHP_EOL;
840
  else
841
+ echo "\t\t<itunes:summary>". powerpress_format_itunes_value($content_no_html_a, 'summary') .'</itunes:summary>'.PHP_EOL;
842
 
843
  if( $author )
844
  echo "\t\t<itunes:author>" . esc_html($author) . '</itunes:author>'.PHP_EOL;
1176
  }
1177
  else
1178
  {
1179
+ do_feed_rss2(false);
1180
  }
1181
 
1182
  }
1445
  load_plugin_textdomain('powerpress', // domain / keyword name of plugin
1446
  POWERPRESS_ABSPATH .'/languages', // Absolute path
1447
  basename(POWERPRESS_ABSPATH).'/languages' ); // relative path in plugins folder
1448
+
1449
+ /*
1450
+ ####
1451
+ # Defines that effect translation defined now:
1452
+ ####
1453
+ */
1454
+ // Set specific play and download labels for your installation of PowerPress
1455
+ if( !defined('POWERPRESS_LINKS_TEXT') )
1456
+ define('POWERPRESS_LINKS_TEXT', __('Podcast', 'powerpress') );
1457
+ if( !defined('POWERPRESS_DURATION_TEXT') )
1458
+ define('POWERPRESS_DURATION_TEXT', __('Duration', 'powerpress') );
1459
+ if( !defined('POWERPRESS_PLAY_IN_NEW_WINDOW_TEXT') )
1460
+ define('POWERPRESS_PLAY_IN_NEW_WINDOW_TEXT', __('Play in new window', 'powerpress') );
1461
+ if( !defined('POWERPRESS_DOWNLOAD_TEXT') )
1462
+ define('POWERPRESS_DOWNLOAD_TEXT', __('Download', 'powerpress') );
1463
+ if( !defined('POWERPRESS_PLAY_TEXT') )
1464
+ define('POWERPRESS_PLAY_TEXT', __('Play', 'powerpress') );
1465
+ if( !defined('POWERPRESS_EMBED_TEXT') )
1466
+ define('POWERPRESS_EMBED_TEXT', __('Embed', 'powerpress') );
1467
+ if( !defined('POWERPRESS_READ_TEXT') )
1468
+ define('POWERPRESS_READ_TEXT', __('Read', 'powerpress') );
1469
  }
1470
  add_action('plugins_loaded', 'powerpress_plugins_loaded');
1471
 
1521
  $powerpress_feed['default_url'] = rtrim($GeneralSettings['default_url'], '/') .'/';
1522
  $explicit_array = array("no", "yes", "clean");
1523
  $powerpress_feed['explicit'] = $explicit_array[$Feed['itunes_explicit']];
1524
+ if( !empty($Feed['itunes_talent_name']) )
1525
  $powerpress_feed['itunes_talent_name'] = $Feed['itunes_talent_name'];
1526
  else
1527
  $powerpress_feed['itunes_talent_name'] = get_bloginfo_rss('name');
1550
  // We need to get the term_id and the tax_id (tt_id)
1551
  $term_slug = get_query_var('term');
1552
  $taxonomy = get_query_var('taxonomy');
1553
+
1554
+ if( empty($term_slug) && empty($taxonomy) ) // Handle situation where tag is the taxonomy we're working with
1555
+ {
1556
+ $term_slug = get_query_var('tag');
1557
+ if( !empty($term_slug) )
1558
+ $taxonomy = 'post_tag';
1559
+ }
1560
+
1561
+ $term = false;
1562
+ if( !empty($term_slug) && !empty($taxonomy) )
1563
+ {
1564
+ $term = term_exists($term_slug, $taxonomy);
1565
+ }
1566
 
1567
  if( !empty($term['term_taxonomy_id']) )
1568
  {
1579
  $powerpress_feed['default_url'] = rtrim($GeneralSettings['default_url'], '/') .'/';
1580
  $explicit_array = array("no", "yes", "clean");
1581
  $powerpress_feed['explicit'] = $explicit_array[$Feed['itunes_explicit']];
1582
+ if( !empty($Feed['itunes_talent_name']) )
1583
  $powerpress_feed['itunes_talent_name'] = $Feed['itunes_talent_name'];
1584
  else
1585
  $powerpress_feed['itunes_talent_name'] = get_bloginfo_rss('name');
2150
  function powerpress_itunes_summary($html)
2151
  {
2152
  // Do some smart conversion of the post html to readable text without HTML.
2153
+ /*
2154
  // First, convert: <a href="link"...>label</a>
2155
  // to: label (link)
2156
  $html = preg_replace_callback('/(\<a[^\>]*href="([^"]*)"[^\>]*>([^\<]*)<\/a\>)/i',
2168
  'return "({$matches[2]})";'
2169
  ),
2170
  $html);
2171
+ */
2172
 
2173
  // For now make them bullet points...
2174
  $html = str_replace('<li>', '<li>* ', $html);
2176
  // Now do all the other regular conversions...
2177
  $html = strip_shortcodes( $html );
2178
  $html = str_replace(']]>', ']]&gt;', $html);
2179
+ $content_no_html = strip_tags($html, '<a>'); // We can leave a tags
2180
+ $content_no_html = powerpress_format_itunes_value($content_no_html, 'summary-enhanced');
2181
+ //$content_no_html = preg_replace('/(\(http:\/\/[^\)\s]*)$/i', '', $content_no_html);
2182
  return $content_no_html;
2183
  }
2184
 
2314
  $value = @html_entity_decode($value, ENT_COMPAT, 'UTF-8'); // Remove any additional entities such as &nbsp;
2315
  $value = preg_replace( '/&amp;/ui' , '&', $value); // Precaution in case it didn't get removed from function above.
2316
 
2317
+ if( $tag == 'summary-enhanced' )
2318
+ return powerpress_trim_itunes_value($value, $tag);
2319
  return esc_html( powerpress_trim_itunes_value($value, $tag) );
2320
  }
2321
 
2329
  switch($tag)
2330
  {
2331
  case 'description':
2332
+ case 'summary-enhanced':
2333
  case 'summary': {
2334
  // 4000 character limit
2335
  if( $length > 4000 )
2372
 
2373
  if( $remove_new_lines )
2374
  $value = str_replace( array("\r\n\r\n", "\n", "\r", "\t","- "), array(' - ',' ', '', ' ', ''), $value );
2375
+
2376
+ if( $tag == 'summary-enhanced' )
2377
+ $value = str_replace(']]>', ']]&gt;', $value); // Make sure there's no ]]> in the value
2378
 
2379
  return $value;
2380
  }
2381
 
2382
  function powerpress_add_redirect_url($MediaURL, $channel = 'podcast')
2383
  {
2384
+ if( preg_match('/^https?:\/\//i', $MediaURL) == 0 )
2385
+ return $MediaURL; // If the user is hosting media not via http (e.g. ftp) then we can't handle the redirect
2386
 
2387
  $NewURL = apply_filters('powerpress_redirect_url', $MediaURL);
2388
 
2389
+ $URLScheme = ( (preg_match('/^https:\/\//i', $NewURL) != 0 ) ? 'https://':'http://');
2390
+
2391
  $GeneralSettings = false;
2392
  if( !$GeneralSettings ) // Get the general settings if not passed to this function, maintain the settings globally for further use
2393
  {
2463
  $key = sprintf('redirect%d', $x);
2464
  if( !empty($GeneralSettings[ $key ]) )
2465
  {
2466
+ if( preg_match('/^https?:\/\/(.*)$/', trim($GeneralSettings[ $key ]) , $matches ) == 0 )
2467
+ continue;
2468
+
2469
+ $RedirectClean = $matches[1];
2470
  if( !empty($RedirectClean) )
2471
  {
2472
  if( strpos($RedirectClean, '/') == 0 ) // Not a valid redirect URL
2473
  continue;
2474
  // Check that redirect is either media..blubrry.com, media.techpodcasts.com, media.rawvoice.com, or www.podtrac.com
2475
  $ValidRedirectDomains = array('media.blubrry.com', 'media.rawvoice.com', 'media.techpodcasts.com', 'www.podtrac.com', 'podtrac.com');
2476
+ if( $URLScheme == 'https://' )
2477
+ $ValidRedirectDomains = array('media.blubrry.com', 'media.rawvoice.com'); // Only URLs that support https:// to an https:// media file
2478
+
2479
  $RedirectDomain = strtolower(substr($RedirectClean, 0, strpos($RedirectClean, '/') ));
2480
+
2481
  if( !in_array($RedirectDomain, $ValidRedirectDomains) )
2482
  continue; // Not a valid domain so lets not add it
2483
 
2484
  if( !strstr($NewURL, $RedirectClean) )
2485
+ $NewURL = $URLScheme. $RedirectClean . str_replace($URLScheme, '', $NewURL);
2486
  }
2487
  }
2488
  }
powerpressadmin-basic.php CHANGED
@@ -306,6 +306,20 @@ function powerpressadmin_advanced_options($General)
306
  </div>
307
  </div>
308
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
309
  <div style="margin-left: 10px;">
310
  <h3 style="margin-bottom: 5px;"><?php echo __('Looking for Support, Consulting or Custom Development?', 'powerpress'); ?></h3>
311
  <p style="margin: 0 0 0 50px; font-size: 115%;">
@@ -316,6 +330,16 @@ function powerpressadmin_advanced_options($General)
316
  </p>
317
  </div>
318
 
 
 
 
 
 
 
 
 
 
 
319
  <?php
320
  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
321
  {
@@ -333,14 +357,24 @@ function powerpressadmin_advanced_options($General)
333
  </li>
334
  <li><?php echo __('Tell the world about PowerPress by writing about it on your blog', 'powerpress'); ?>,
335
  <a href="http://twitter.com/home/?status=<?php echo urlencode( __('I\'m podcasting with Blubrry PowerPress (http://blubrry.com/powerpress/) #powerpress #wordpress', 'powerpress') ); ?>" target="_blank"><?php echo __('Twitter', 'powerpress'); ?></a>,
336
- <a href="http://www.facebook.com/share.php?u=<?php echo urlencode('http://create.blubrry.com/resources/powerpress/'); ?>&amp;t=<?php echo urlencode( __('I podcast with Blubrry PowerPress', 'powerpress')); ?>" target="_blank"><?php echo __('Facebook', 'powerpress'); ?></a>,
337
- <a href="http://digg.com/submit?phase=2&amp;url=<?php echo urlencode('http://www.blubrry.com/powerpress'); ?>&amp;title=<?php echo urlencode( __('Blubrry PowerPress Podcasting Plugin for WordPress', 'powerpress') ); ?>" target="_blank"><?php echo __('Digg', 'powerpress'); ?></a>,
338
  etc...</li>
339
  <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>
340
  </ul>
341
  </div>
342
  <?php
343
  }
 
 
 
 
 
 
 
 
 
 
344
  }
345
 
346
  function powerpressadmin_edit_entry_options($General)
@@ -712,7 +746,8 @@ function powerpressadmin_edit_itunes_general($FeedSettings, $General, $FeedAttri
712
  echo get_feed_link($feed_slug);
713
  }; break;
714
  case 'post_type': {
715
- $url = get_post_type_archive_feed_link($post_type, $feed_slug);
 
716
  }; break;
717
  case 'general':
718
  default: {
@@ -747,7 +782,7 @@ function powerpressadmin_edit_blubrry_services($General, $action_url = false, $a
747
  </ul></li></ul>
748
  <div style="margin-left: 40px;">
749
  <p style="font-size: 125%;">
750
- <strong><a class="button-primary thickbox" href="<?php echo wp_nonce_url( $action_url, $action); ?>&amp;KeepThis=true&amp;TB_iframe=true&amp;width=600&amp;height=400&amp;modal=true" target="_blank"><?php echo __('Click here to configure Blubrry Statistics and Hosting services', 'powerpress'); ?></a></strong>
751
  </p>
752
  <?php
753
  if( !empty($General['blubrry_program_keyword']) )
@@ -791,7 +826,7 @@ function powerpressadmin_edit_blubrry_services($General, $action_url = false, $a
791
  ?>
792
  <p>
793
  <?php echo __('Recently upgraded to Blubrry Hosting?', 'powerpress'); ?>
794
- <a class="thickbox" 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=true" target="_blank"><?php echo __('Click here to enter your account information.', 'powerpress'); ?></a>
795
  </p>
796
  <?php
797
  }
@@ -1036,7 +1071,7 @@ function powerpressadmin_appearance($General=false, $Feed = false)
1036
 
1037
  <?php echo __('Media Links', 'powerpress'); ?></th>
1038
  <td>
1039
- <p><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>
1040
 
1041
  <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>
1042
 
@@ -1058,13 +1093,42 @@ function powerpressadmin_appearance($General=false, $Feed = false)
1058
  <th scope="row">
1059
  <?php echo __('Subscribe Links', 'powerpress'); ?> <?php echo powerpressadmin_new(); ?></th>
1060
  <td>
1061
- <p><label><input type="checkbox" name="General[subscribe_links]" value="1" <?php if( $General['subscribe_links'] == 1 ) echo 'checked '; ?>/>
1062
  <?php echo __('Display subscribe links below player and media links.', 'powerpress'); ?></label></p>
1063
  <ul>
1064
  <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>
1065
  <?php echo __('(leave blank for default)', 'powerpress'); ?>
1066
  </li>
1067
  </ul>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1068
  </td>
1069
  </tr>
1070
  </table>
@@ -1192,9 +1256,9 @@ function powerpress_admin_appearance_common($Feed, $FeedAttribs = array())
1192
  if( !empty($FeedAttribs['feed_slug']) )
1193
  $feed_slug = $FeedAttribs['feed_slug'];
1194
 
1195
- if( $FeedAttribs['type'] == 'post_type' || $FeedAttribs['type'] == 'ttid' )
1196
  {
1197
- echo "<br /><br />";
1198
  return;
1199
  }
1200
  ?>
306
  </div>
307
  </div>
308
 
309
+ <?php
310
+ $link_action_url = admin_url('admin.php?action=powerpress-jquery-account');
311
+ $link_action = 'powerpress-jquery-account';
312
+ ?>
313
+ <div style="margin-left: 10px;">
314
+ <h3><?php echo __('Link Blubrry Account', 'powerpress'); ?></h3>
315
+ <p style="font-size: 125%;">
316
+ <strong><a class="button-primary 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>
317
+ </p>
318
+ <p>
319
+ <?php echo __('Link your blubrry.com account if you have a Blubrry Podcast Hosting or Blubrry Podcast Statistics services.', 'powerpress'); ?>
320
+ </p>
321
+ </div>
322
+
323
  <div style="margin-left: 10px;">
324
  <h3 style="margin-bottom: 5px;"><?php echo __('Looking for Support, Consulting or Custom Development?', 'powerpress'); ?></h3>
325
  <p style="margin: 0 0 0 50px; font-size: 115%;">
330
  </p>
331
  </div>
332
 
333
+ <div style="margin-left: 10px;">
334
+ <h3 style="margin-bottom: 5px;"><?php echo __('Want your own iOS and Android podcast apps?', 'powerpress'); ?></h3>
335
+ <p style="margin: 0 0 0 50px; font-size: 115%;">
336
+ <?php echo __('Blubrry has partnered with Reactor by AppPresser to provide iOS and Android apps for PowerPress powered podcasts. With Reactor, you are able to build, design and retain control of your app to highlight your podcast content, and provide access to value-add content from your website.', 'powerpress'); ?>
337
+ </p>
338
+ <p style="margin: 5px 0 0 50px; font-size: 115%;">
339
+ <strong><?php echo '<a href="http://create.blubrry.com/resources/partners/reactor-ios-android-podcast-apps-powerpress/" target="_blank">'. __('Learn More about Reactor iOS and Android podcast apps for PowerPress', 'powerpress') .'</a>'; ?></strong>
340
+ </p>
341
+ </div>
342
+
343
  <?php
344
  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
345
  {
357
  </li>
358
  <li><?php echo __('Tell the world about PowerPress by writing about it on your blog', 'powerpress'); ?>,
359
  <a href="http://twitter.com/home/?status=<?php echo urlencode( __('I\'m podcasting with Blubrry PowerPress (http://blubrry.com/powerpress/) #powerpress #wordpress', 'powerpress') ); ?>" target="_blank"><?php echo __('Twitter', 'powerpress'); ?></a>,
360
+ <a href="http://www.facebook.com/share.php?u=<?php echo urlencode('http://www.blubrry.com/powerpress'); ?>&amp;t=<?php echo urlencode( __('I podcast with Blubrry PowerPress', 'powerpress')); ?>" target="_blank"><?php echo __('Facebook', 'powerpress'); ?></a>,
361
+ <a href="https://plus.google.com/share?url==<?php echo urlencode('http://www.blubrry.com/powerpress'); ?>" target="_blank"><?php echo __('Google+', 'powerpress'); ?></a>,
362
  etc...</li>
363
  <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>
364
  </ul>
365
  </div>
366
  <?php
367
  }
368
+ ?>
369
+ <div style="margin-left: 10px;">
370
+ <h3 style="margin-bottom: 5px;"><?php echo __('Become a PowerPress Patron!', 'powerpress'); ?></h3>
371
+ <p style="margin: 0; padding-left: 50px;">
372
+ <?php echo __('Help support your favorite podcasting plugin via Patreon.', 'powerpress'); ?>
373
+ </p>
374
+ <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>'; ?>
375
+ </p>
376
+ </div>
377
+ <?php
378
  }
379
 
380
  function powerpressadmin_edit_entry_options($General)
746
  echo get_feed_link($feed_slug);
747
  }; break;
748
  case 'post_type': {
749
+ $url = get_post_type_archive_feed_link($FeedAttribs['post_type'], $feed_slug);
750
+ echo $url;
751
  }; break;
752
  case 'general':
753
  default: {
782
  </ul></li></ul>
783
  <div style="margin-left: 40px;">
784
  <p style="font-size: 125%;">
785
+ <strong><a class="button-primary 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>
786
  </p>
787
  <?php
788
  if( !empty($General['blubrry_program_keyword']) )
826
  ?>
827
  <p>
828
  <?php echo __('Recently upgraded to Blubrry Hosting?', 'powerpress'); ?>
829
+ <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>
830
  </p>
831
  <?php
832
  }
1071
 
1072
  <?php echo __('Media Links', 'powerpress'); ?></th>
1073
  <td>
1074
+ <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>
1075
 
1076
  <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>
1077
 
1093
  <th scope="row">
1094
  <?php echo __('Subscribe Links', 'powerpress'); ?> <?php echo powerpressadmin_new(); ?></th>
1095
  <td>
1096
+ <p style="padding-top: 8px;"><label><input type="checkbox" name="General[subscribe_links]" value="1" <?php if( $General['subscribe_links'] == 1 ) echo 'checked '; ?>/>
1097
  <?php echo __('Display subscribe links below player and media links.', 'powerpress'); ?></label></p>
1098
  <ul>
1099
  <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>
1100
  <?php echo __('(leave blank for default)', 'powerpress'); ?>
1101
  </li>
1102
  </ul>
1103
+
1104
+ <p style="padding-top:10px;"><input type="checkbox" name="NULL[subscribe_feature_itunes]" value="1" checked disabled /> <label><?php echo __('Subscribe on iTunes', 'powerpress'); ?></label></p>
1105
+ <div style="margin-left: 24px;">
1106
+ <p><?php echo __('Link to your one click iTunes Subscription URL.', 'powerpress'); ?></p>
1107
+
1108
+ <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>
1109
+ </div>
1110
+
1111
+ <p><input type="checkbox" name="NULL[subscribe_feature_android]" value="1" checked disabled /> <label><?php echo __('Subscribe on Android', 'powerpress'); ?></label> <?php echo powerpressadmin_new(); ?></p>
1112
+ <div style="margin-left: 24px;">
1113
+ <p><?php echo __('Link to your one click Subscribe on Android URL.', 'powerpress'); ?></p>
1114
+ <p><a href="http://subscribeonandroid.com/podcasters/" target="_blank"><?php echo __('Learn more about Subscribe on Android', 'powerpress'); ?></a></p>
1115
+ </div>
1116
+
1117
+ <p><input type="checkbox" name="NULL[subscribe_feature_rss]" value="1" checked disabled /> <label><?php echo __('Subscribe via RSS', 'powerpress'); ?></label></p>
1118
+ <div style="margin-left: 24px;">
1119
+ <p><?php echo __('Link to your podcast RSS feed.', 'powerpress'); ?></p>
1120
+ </div>
1121
+
1122
+ <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> <?php echo powerpressadmin_new(); ?></p>
1123
+ <div style="margin-left: 24px;">
1124
+ <p><?php echo __('Link to your one click Subscribe by Email URL.', 'powerpress'); ?></p>
1125
+ <p>
1126
+ <?php echo __('Subscribe By Email is a service that allows listeners to subscribe to their favorite podcasts by email.', 'powerpress'); ?>
1127
+ </p>
1128
+ <p><a href="http://subscribebyemail.com/podcasters/" target="_blank"><?php echo __('Learn more about Subscribe by Email', 'powerpress'); ?></a></p>
1129
+ <p><?php echo __('Note: Subscribe by Email does not replace newsletters or mailing lists. It is only for podcast syndication.', 'powerpress'); ?>
1130
+ </p>
1131
+ </div>
1132
  </td>
1133
  </tr>
1134
  </table>
1256
  if( !empty($FeedAttribs['feed_slug']) )
1257
  $feed_slug = $FeedAttribs['feed_slug'];
1258
 
1259
+ if( $FeedAttribs['type'] == 'ttid' )
1260
  {
1261
+ //echo "<br /><br />";
1262
  return;
1263
  }
1264
  ?>
powerpressadmin-categoryfeeds.php CHANGED
@@ -136,7 +136,9 @@ function powerpress_admin_categoryfeeds()
136
 
137
  echo "<td $class><a href='$url' title='". esc_attr(sprintf(__('Visit %s', 'powerpress'), $feed_title))."' target=\"_blank\">$short_url</a>";
138
  echo '<div class="row-actions">';
139
- echo '<span class="'.$action .'"><a href="http://www.feedvalidator.org/check.cgi?url='. urlencode( str_replace('&amp;', '&', $url) ) .'" target="_blank">' . __('Validate Feed', 'powerpress') . '</a></span>';
 
 
140
  echo '</div>';
141
  echo "</td>";
142
 
136
 
137
  echo "<td $class><a href='$url' title='". esc_attr(sprintf(__('Visit %s', 'powerpress'), $feed_title))."' target=\"_blank\">$short_url</a>";
138
  echo '<div class="row-actions">';
139
+ if( defined('POWERPRESS_FEEDVALIDATOR_URL') ) {
140
+ echo '<span class="'.$action .'"><a href="'. POWERPRESS_FEEDVALIDATOR_URL . urlencode( str_replace('&amp;', '&', $url) ) .'" target="_blank">' . __('Validate Feed', 'powerpress') . '</a></span>';
141
+ }
142
  echo '</div>';
143
  echo "</td>";
144
 
powerpressadmin-customfeeds.php CHANGED
@@ -138,7 +138,9 @@ function powerpress_admin_customfeeds()
138
 
139
  echo "<td $class><a href='$url' title='". esc_attr(sprintf(__('Visit %s', 'powerpress'), $feed_title))."' target=\"_blank\">". esc_html($short_url) ."</a>";
140
  echo '<div class="row-actions">';
141
- echo '<span class="'.$action .'"><a href="http://www.feedvalidator.org/check.cgi?url='. urlencode($url) .'" target="_blank">' . __('Validate Feed', 'powerpress') . '</a></span>';
 
 
142
  echo '</div>';
143
  echo "</td>";
144
 
138
 
139
  echo "<td $class><a href='$url' title='". esc_attr(sprintf(__('Visit %s', 'powerpress'), $feed_title))."' target=\"_blank\">". esc_html($short_url) ."</a>";
140
  echo '<div class="row-actions">';
141
+ if( defined('POWERPRESS_FEEDVALIDATOR_URL') ) {
142
+ echo '<span class="'.$action .'"><a href="'. POWERPRESS_FEEDVALIDATOR_URL . urlencode($url) .'" target="_blank">' . __('Validate Feed', 'powerpress') . '</a></span>';
143
+ }
144
  echo '</div>';
145
  echo "</td>";
146
 
powerpressadmin-dashboard.php CHANGED
@@ -186,7 +186,7 @@ function powerpress_dashboard_stats_content()
186
  {
187
  ?>
188
  <div id="blubrry_stats_media_show">
189
- <a href="<?php echo admin_url('admin.php'); ?>?action=powerpress-jquery-stats&amp;KeepThis=true&amp;TB_iframe=true&amp;modal=true" title="<?php echo __('Blubrry Media statistics', 'powerpress'); ?>" class="thickbox"><?php echo __('more', 'powerpress'); ?></a>
190
  </div>
191
  <?php } ?>
192
  </div>
186
  {
187
  ?>
188
  <div id="blubrry_stats_media_show">
189
+ <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>
190
  </div>
191
  <?php } ?>
192
  </div>
powerpressadmin-editfeed.php CHANGED
@@ -280,7 +280,7 @@ function powerpress_admin_editfeed($type='', $type_value = '', $feed_slug = fals
280
 
281
  <div id="feed_tab_itunes" class="powerpress_tab">
282
  <?php
283
- if( $feed_slug != 'podcast' )
284
  powerpressadmin_edit_itunes_general($FeedSettings, $General, $FeedAttribs);
285
  powerpressadmin_edit_itunes_feed($FeedSettings, $General, $FeedAttribs);
286
  ?>
@@ -378,18 +378,6 @@ function powerpressadmin_edit_feed_general($FeedSettings, $General)
378
  </ul>
379
  </td>
380
  </tr>
381
-
382
- <?php /* ?>
383
- <tr valign="top">
384
- <th scope="row">
385
- <?php echo __('Main Site Feed', 'powerpress'); ?></th>
386
- <td>
387
- <p style="margin-top: 5px; margin-bottom: 0;"><?php echo __('Main RSS2 Feed', 'powerpress'); ?>: <a href="<?php echo get_bloginfo('rss2_url'); ?>" title="<?php echo __('Main RSS 2 Feed', 'powerpress'); ?>" target="_blank"><?php echo get_bloginfo('rss2_url'); ?></a> | <a href="http://www.feedvalidator.org/check.cgi?url=<?php echo urlencode(get_bloginfo('rss2_url')); ?>" target="_blank"><?php echo __('validate', 'powerpress'); ?></a></p>
388
- <p><?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>
389
- </td>
390
- </tr>
391
- <?php */ ?>
392
-
393
  <tr valign="top">
394
  <th scope="row">
395
 
@@ -412,7 +400,9 @@ function powerpressadmin_edit_feed_general($FeedSettings, $General)
412
  $edit_link = admin_url( 'admin.php?page=powerpress/powerpressadmin_customfeeds.php&amp;action=powerpress-editfeed&amp;feed_slug=') . $feed_slug;
413
  ?>
414
  <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>
415
- | <a href="http://www.feedvalidator.org/check.cgi?url=<?php echo urlencode(get_feed_link($feed_slug)); ?>" target="_blank"><?php echo __('validate', 'powerpress'); ?></a>
 
 
416
  <?php if( false && $feed_slug != 'podcast' ) { ?>
417
  | <a href="<?php echo $edit_link; ?>" title="<?php echo __('Edit Podcast Channel', 'powerpress'); ?>"><?php echo __('edit', 'powerpress'); ?></a>
418
  <?php } ?>
@@ -475,7 +465,7 @@ function powerpressadmin_edit_feed_settings($FeedSettings, $General, $FeedAttrib
475
 
476
  $cat_ID = $FeedAttribs['category_id'];
477
 
478
- if( $FeedAttribs['type'] == 'channel' && !empty($FeedAttribs['type']) )
479
  {
480
  ?>
481
  <h3><?php echo __('Feed Information', 'powerpress'); ?></h3>
@@ -485,11 +475,12 @@ function powerpressadmin_edit_feed_settings($FeedSettings, $General, $FeedAttrib
485
  <?php echo __('Feed URL', 'powerpress'); ?>
486
  </th>
487
  <td>
488
- <p style="margin-top: 0;" class="description"><a href="<?php echo $feed_link; ?>" target="_blank"><?php echo $feed_link; ?></a> | <a href="http://www.feedvalidator.org/check.cgi?url=<?php echo urlencode( str_replace('&amp;', '&', $feed_link)); ?>" target="_blank"><?php echo __('validate', 'powerpress'); ?></a></p>
 
489
  <?php
490
  if( !empty($FeedSettings['premium']) )
491
  {
492
- echo __('WARNING: This feed is password protected, it cannot be accessed by public services such as feedvalidator.org or the iTunes podcast directory.', 'powerpress');
493
  } ?>
494
  </td>
495
  </tr>
@@ -722,7 +713,7 @@ function powerpressadmin_edit_basics_feed($General, $FeedSettings, $feed_slug, $
722
  if( !isset($FeedSettings['premium_label']) )
723
  $FeedSettings['premium_label'] = '';
724
 
725
- if( !empty($FeedAttribs['type']) && ($FeedAttribs['type'] == 'ttid' || $FeedAttribs['type'] == 'category' || ($FeedAttribs['type'] == 'channel' && defined('CHANNEL_STATS_REDIRECT') ) || ($FeedAttribs['type'] == 'post_type' && defined('POST_TYPE_STATS_REDIRECT')) ) )
726
  {
727
  ?>
728
  <h3><?php echo __('Media Statistics', 'powerpress'); ?></h3>
@@ -1033,7 +1024,7 @@ function powerpressadmin_edit_itunes_feed($FeedSettings, $General, $FeedAttribs
1033
  <div><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'); ?>
1034
  </div>
1035
  <p>
1036
- <?php echo __('Creates a friendlier view of your post/episode content by converting web links and images to clickable links in the iTunes application.', 'powerpress'); ?>
1037
  </p>
1038
  </td>
1039
  </tr>
280
 
281
  <div id="feed_tab_itunes" class="powerpress_tab">
282
  <?php
283
+ if( $feed_slug != 'podcast' || $FeedAttribs['type'] == 'post_type' ) // Custom post type
284
  powerpressadmin_edit_itunes_general($FeedSettings, $General, $FeedAttribs);
285
  powerpressadmin_edit_itunes_feed($FeedSettings, $General, $FeedAttribs);
286
  ?>
378
  </ul>
379
  </td>
380
  </tr>
 
 
 
 
 
 
 
 
 
 
 
 
381
  <tr valign="top">
382
  <th scope="row">
383
 
400
  $edit_link = admin_url( 'admin.php?page=powerpress/powerpressadmin_customfeeds.php&amp;action=powerpress-editfeed&amp;feed_slug=') . $feed_slug;
401
  ?>
402
  <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>
403
+ <?php if( defined('POWERPRESS_FEEDVALIDATOR_URL') ) { ?>
404
+ | <a href="<?php echo POWERPRESS_FEEDVALIDATOR_URL. urlencode(get_feed_link($feed_slug)); ?>" target="_blank"><?php echo __('validate', 'powerpress'); ?></a>
405
+ <?php } ?>
406
  <?php if( false && $feed_slug != 'podcast' ) { ?>
407
  | <a href="<?php echo $edit_link; ?>" title="<?php echo __('Edit Podcast Channel', 'powerpress'); ?>"><?php echo __('edit', 'powerpress'); ?></a>
408
  <?php } ?>
465
 
466
  $cat_ID = $FeedAttribs['category_id'];
467
 
468
+ if( !empty($FeedAttribs['type']) && ( in_array($FeedAttribs['type'], array('category', 'ttid', 'post_type', 'channel') ) ) )
469
  {
470
  ?>
471
  <h3><?php echo __('Feed Information', 'powerpress'); ?></h3>
475
  <?php echo __('Feed URL', 'powerpress'); ?>
476
  </th>
477
  <td>
478
+ <p style="margin-top: 0;" class="description"><a href="<?php echo $feed_link; ?>" target="_blank"><?php echo $feed_link; ?></a>
479
+ <?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>
480
  <?php
481
  if( !empty($FeedSettings['premium']) )
482
  {
483
+ echo __('WARNING: This feed is password protected, it cannot be accessed publicly by the iTunes podcast directory or other podcast services.', 'powerpress');
484
  } ?>
485
  </td>
486
  </tr>
713
  if( !isset($FeedSettings['premium_label']) )
714
  $FeedSettings['premium_label'] = '';
715
 
716
+ if( !empty($FeedAttribs['type']) && ($FeedAttribs['type'] == 'ttid' || $FeedAttribs['type'] == 'category' || ($FeedAttribs['type'] == 'channel') || ($FeedAttribs['type'] == 'post_type') ) )
717
  {
718
  ?>
719
  <h3><?php echo __('Media Statistics', 'powerpress'); ?></h3>
1024
  <div><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'); ?>
1025
  </div>
1026
  <p>
1027
+ <?php echo __('Creates a friendlier view of your post/episode content.', 'powerpress'); ?>
1028
  </p>
1029
  </td>
1030
  </tr>
powerpressadmin-find-replace.php CHANGED
@@ -29,6 +29,10 @@
29
 
30
  function powerpressadmin_find_replace_process()
31
  {
 
 
 
 
32
  global $g_FindReplaceResults;
33
  if( isset($_POST['FindReplace']) )
34
  {
@@ -68,34 +72,34 @@
68
  $good = true;
69
  if( !empty($FindReplace['verify']) )
70
  {
71
- $response = wp_remote_head( $new_url, array('httpversion' => 1.1) );
72
  // Redirect 1
73
  if( !is_wp_error( $response ) && ($response['response']['code'] == 301 || $response['response']['code'] == 302) )
74
  {
75
  $headers = wp_remote_retrieve_headers( $response );
76
- $response = wp_remote_head( $headers['location'], array('httpversion' => 1.1) );
77
  }
78
  // Redirect 2
79
  if( !is_wp_error( $response ) && ($response['response']['code'] == 301 || $response['response']['code'] == 302) )
80
  {
81
  $headers = wp_remote_retrieve_headers( $response );
82
- $response = wp_remote_head( $headers['location'], array('httpversion' => 1.1) );
83
  }
84
  // Redirect 3
85
  if( !is_wp_error( $response ) && ($response['response']['code'] == 301 || $response['response']['code'] == 302) )
86
  {
87
  $headers = wp_remote_retrieve_headers( $response );
88
- $response = wp_remote_head( $headers['location'], array('httpversion' => 1.1) );
89
  }
90
  // Redirect 4
91
  if( !is_wp_error( $response ) && ($response['response']['code'] == 301 || $response['response']['code'] == 302) )
92
  {
93
  $headers = wp_remote_retrieve_headers( $response );
94
- $response = wp_remote_head( $headers['location'], array('httpversion' => 1.1) );
95
  }
96
  //$headers = wp_remote_retrieve_headers( $response );
97
 
98
- //$response = @wp_remote_head( $new_url, array('httpversion' => 1.1) );
99
  if ( is_wp_error( $response ) )
100
  {
101
  $g_FindReplaceResults[ $meta_id ]['error'] = $response->get_error_message();
29
 
30
  function powerpressadmin_find_replace_process()
31
  {
32
+ $wp_remote_options = array();
33
+ $wp_remote_options['user-agent'] = 'Blubrry PowerPress/'.POWERPRESS_VERSION;
34
+ $wp_remote_options['httpversion'] = '1.1';
35
+
36
  global $g_FindReplaceResults;
37
  if( isset($_POST['FindReplace']) )
38
  {
72
  $good = true;
73
  if( !empty($FindReplace['verify']) )
74
  {
75
+ $response = wp_remote_head( $new_url, $wp_remote_options );
76
  // Redirect 1
77
  if( !is_wp_error( $response ) && ($response['response']['code'] == 301 || $response['response']['code'] == 302) )
78
  {
79
  $headers = wp_remote_retrieve_headers( $response );
80
+ $response = wp_remote_head( $headers['location'], $wp_remote_options );
81
  }
82
  // Redirect 2
83
  if( !is_wp_error( $response ) && ($response['response']['code'] == 301 || $response['response']['code'] == 302) )
84
  {
85
  $headers = wp_remote_retrieve_headers( $response );
86
+ $response = wp_remote_head( $headers['location'], $wp_remote_options );
87
  }
88
  // Redirect 3
89
  if( !is_wp_error( $response ) && ($response['response']['code'] == 301 || $response['response']['code'] == 302) )
90
  {
91
  $headers = wp_remote_retrieve_headers( $response );
92
+ $response = wp_remote_head( $headers['location'], $wp_remote_options );
93
  }
94
  // Redirect 4
95
  if( !is_wp_error( $response ) && ($response['response']['code'] == 301 || $response['response']['code'] == 302) )
96
  {
97
  $headers = wp_remote_retrieve_headers( $response );
98
+ $response = wp_remote_head( $headers['location'], $wp_remote_options );
99
  }
100
  //$headers = wp_remote_retrieve_headers( $response );
101
 
102
+ //$response = @wp_remote_head( $new_url, $wp_remote_options );
103
  if ( is_wp_error( $response ) )
104
  {
105
  $g_FindReplaceResults[ $meta_id ]['error'] = $response->get_error_message();
powerpressadmin-jquery.php CHANGED
@@ -257,7 +257,7 @@ function DeleteMedia(File)
257
  }
258
 
259
  $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>';
260
- powerpress_page_message_add_notice( $message );
261
  powerpress_page_message_print();
262
  }
263
  else if( empty($results) )
@@ -273,14 +273,14 @@ function DeleteMedia(File)
273
  $message .= '<p>'.__('Unable to connect to service.','powerpress').'</p>';
274
 
275
  // Print an erro here
276
- powerpress_page_message_add_notice( $message );
277
  powerpress_page_message_print();
278
  }
279
 
280
  if( $Msg )
281
  echo '<p>'. $Msg . '</p>';
282
  ?>
283
- <div class="media-upload-link"><a 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=true" class="thickbox"><?php echo __('Upload Media File', 'powerpress'); ?></a></div>
284
  <p><?php echo __('Select from media files uploaded to blubrry.com', 'powerpress'); ?>:</p>
285
  </div>
286
  <div id="media-items-container">
@@ -337,7 +337,7 @@ function DeleteMedia(File)
337
  </div>
338
  </div>
339
  <div id="media-footer">
340
- <div class="media-upload-link"><a 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=true" class="thickbox"><?php echo __('Upload Media File', 'powerpress'); ?></a></div>
341
  <?php
342
  if( $QuotaData ) {
343
 
@@ -426,7 +426,7 @@ function DeleteMedia(File)
426
 
427
  if( !current_user_can(POWERPRESS_CAPABILITY_MANAGE_OPTIONS) )
428
  {
429
- powerpress_admin_jquery_header('Blubrry Services Integration', 'powerpress');
430
  powerpress_page_message_add_notice( __('You do not have sufficient permission to manage options.', 'powerpress') );
431
  powerpress_page_message_print();
432
  powerpress_admin_jquery_footer();
@@ -579,15 +579,15 @@ function DeleteMedia(File)
579
  delete_option('powerpress_stats');
580
 
581
  if( $Error )
582
- powerpress_page_message_add_notice( $Error );
583
 
584
  if( $Close )
585
  {
586
- powerpress_admin_jquery_header( __('Blubrry Services Integration', 'powerpress') );
587
  powerpress_page_message_print();
588
  ?>
589
- <p style="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>
590
- <h2><?php echo __('Blubrry Services Integration', 'powerpress'); ?></h2>
591
  <p style="text-align: center;"><strong><?php echo __('Settings Saved Successfully!', 'powerpress'); ?></strong></p>
592
  <p style="text-align: center;">
593
  <a href="<?php echo admin_url("admin.php?page=powerpress/powerpressadmin_basic.php"); ?>" onclick="self.parent.tb_remove(); return false;" target="_top"><?php echo __('Close', 'powerpress'); ?></a>
@@ -614,7 +614,7 @@ jQuery(document).ready(function($) {
614
  {
615
  if( !current_user_can(POWERPRESS_CAPABILITY_MANAGE_OPTIONS) )
616
  {
617
- powerpress_admin_jquery_header( __('Blubrry Services Integration', 'powerpress') );
618
  powerpress_page_message_add_notice( __('You do not have sufficient permission to manage options.', 'powerpress') );
619
  powerpress_page_message_print();
620
  powerpress_admin_jquery_footer();
@@ -623,7 +623,7 @@ jQuery(document).ready(function($) {
623
 
624
  if( !ini_get( 'allow_url_fopen' ) && !function_exists( 'curl_init' ) )
625
  {
626
- powerpress_admin_jquery_header( __('Blubrry Services Integration', 'powerpress') );
627
  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') );
628
  powerpress_page_message_print();
629
  powerpress_admin_jquery_footer();
@@ -645,14 +645,14 @@ jQuery(document).ready(function($) {
645
  if( $Programs == false )
646
  $Programs = array();
647
 
648
- powerpress_admin_jquery_header( __('Blubrry Services Integration', 'powerpress') );
649
  powerpress_page_message_print();
650
  ?>
651
  <form action="<?php echo admin_url('admin.php'); ?>" enctype="multipart/form-data" method="post">
652
  <?php wp_nonce_field('powerpress-jquery-account'); ?>
653
  <input type="hidden" name="action" value="powerpress-jquery-account-save" />
654
  <div id="accountinfo">
655
- <h2><?php echo __('Blubrry Services Integration', 'powerpress'); ?></h2>
656
  <?php if( $Step == 1 ) { ?>
657
  <p>
658
  <label for="blubrry_username"><?php echo __('Blubrry User Name (Email)', 'powerpress'); ?></label>
@@ -866,7 +866,7 @@ echo '<!-- done adding extra stuff -->';
866
  </head>
867
  <body>
868
  <div id="container">
869
- <p style="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>
870
  <?php
871
  }
872
 
257
  }
258
 
259
  $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>';
260
+ powerpress_page_message_add_notice( $message, 'inline', false );
261
  powerpress_page_message_print();
262
  }
263
  else if( empty($results) )
273
  $message .= '<p>'.__('Unable to connect to service.','powerpress').'</p>';
274
 
275
  // Print an erro here
276
+ powerpress_page_message_add_notice( $message, 'inline', false );
277
  powerpress_page_message_print();
278
  }
279
 
280
  if( $Msg )
281
  echo '<p>'. $Msg . '</p>';
282
  ?>
283
+ <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>
284
  <p><?php echo __('Select from media files uploaded to blubrry.com', 'powerpress'); ?>:</p>
285
  </div>
286
  <div id="media-items-container">
337
  </div>
338
  </div>
339
  <div id="media-footer">
340
+ <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>
341
  <?php
342
  if( $QuotaData ) {
343
 
426
 
427
  if( !current_user_can(POWERPRESS_CAPABILITY_MANAGE_OPTIONS) )
428
  {
429
+ powerpress_admin_jquery_header('Blubrry Services', 'powerpress');
430
  powerpress_page_message_add_notice( __('You do not have sufficient permission to manage options.', 'powerpress') );
431
  powerpress_page_message_print();
432
  powerpress_admin_jquery_footer();
579
  delete_option('powerpress_stats');
580
 
581
  if( $Error )
582
+ powerpress_page_message_add_notice( $Error, 'inline', false );
583
 
584
  if( $Close )
585
  {
586
+ powerpress_admin_jquery_header( __('Blubrry Services', 'powerpress') );
587
  powerpress_page_message_print();
588
  ?>
589
+ <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>
590
+ <h2><?php echo __('Blubrry Services', 'powerpress'); ?></h2>
591
  <p style="text-align: center;"><strong><?php echo __('Settings Saved Successfully!', 'powerpress'); ?></strong></p>
592
  <p style="text-align: center;">
593
  <a href="<?php echo admin_url("admin.php?page=powerpress/powerpressadmin_basic.php"); ?>" onclick="self.parent.tb_remove(); return false;" target="_top"><?php echo __('Close', 'powerpress'); ?></a>
614
  {
615
  if( !current_user_can(POWERPRESS_CAPABILITY_MANAGE_OPTIONS) )
616
  {
617
+ powerpress_admin_jquery_header( __('Blubrry Services', 'powerpress') );
618
  powerpress_page_message_add_notice( __('You do not have sufficient permission to manage options.', 'powerpress') );
619
  powerpress_page_message_print();
620
  powerpress_admin_jquery_footer();
623
 
624
  if( !ini_get( 'allow_url_fopen' ) && !function_exists( 'curl_init' ) )
625
  {
626
+ powerpress_admin_jquery_header( __('Blubrry Services', 'powerpress') );
627
  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') );
628
  powerpress_page_message_print();
629
  powerpress_admin_jquery_footer();
645
  if( $Programs == false )
646
  $Programs = array();
647
 
648
+ powerpress_admin_jquery_header( __('Blubrry Services', 'powerpress') );
649
  powerpress_page_message_print();
650
  ?>
651
  <form action="<?php echo admin_url('admin.php'); ?>" enctype="multipart/form-data" method="post">
652
  <?php wp_nonce_field('powerpress-jquery-account'); ?>
653
  <input type="hidden" name="action" value="powerpress-jquery-account-save" />
654
  <div id="accountinfo">
655
+ <h2><?php echo __('Blubrry Services', 'powerpress'); ?></h2>
656
  <?php if( $Step == 1 ) { ?>
657
  <p>
658
  <label for="blubrry_username"><?php echo __('Blubrry User Name (Email)', 'powerpress'); ?></label>
866
  </head>
867
  <body>
868
  <div id="container">
869
+ <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>
870
  <?php
871
  }
872
 
powerpressadmin-metabox.php CHANGED
@@ -188,8 +188,8 @@ function powerpress_meta_box($object, $box)
188
  <label for="Powerpress[<?php echo $FeedSlug; ?>][url]"><?php echo __('Media URL', 'powerpress'); ?></label>
189
  <div class="powerpress_row_content">
190
  <input type="text" id="powerpress_url_<?php echo $FeedSlug; ?>" class="powerpress-url" name="Powerpress[<?php echo $FeedSlug; ?>][url]" value="<?php echo esc_attr($EnclosureURL); ?>" <?php echo ( !empty($ExtraData['hosting']) ?'readOnly':''); ?> style="width: 70%;" />
191
- <?php if( !empty($GeneralSettings['blubrry_hosting']) && $GeneralSettings['blubrry_hosting']!=='false' && !empty($GeneralSettings['timestamp']) && $GeneralSettings['timestamp'] < 1414627200 ) { // display the folder icon for folks before october 30, 2014 ?>
192
- <a href="<?php echo admin_url('admin.php'); ?>?action=powerpress-jquery-media&podcast-feed=<?php echo $FeedSlug; ?>&KeepThis=true&TB_iframe=true&modal=true" title="<?php echo __('Browse Media File', 'powerpress'); ?>" class="thickbox"><img src="<?php echo powerpress_get_root_url(); ?>/images/blubrry_folder.png" alt="<?php echo __('Browse Media Files', 'powerpress'); ?>" /></a>
193
  <?php } ?>
194
  <input type="button" id="powerpress_check_<?php echo $FeedSlug; ?>_button" name="powerpress_check_<?php echo $FeedSlug; ?>_button" value="<?php echo __('Verify URL', 'powerpress'); ?>" onclick="powerpress_get_media_info('<?php echo $FeedSlug; ?>');" alt="<?php echo __('Verify Media', 'powerpress'); ?>" class="button" />
195
  <img id="powerpress_check_<?php echo $FeedSlug; ?>" src="<?php echo admin_url(); ?>images/loading.gif" style="vertical-align:text-top; display: none;" alt="<?php echo __('Checking Media', 'powerpress'); ?>" />
@@ -200,10 +200,10 @@ function powerpress_meta_box($object, $box)
200
  </em></div>
201
 
202
  <div class="powerpress-hosting-buttons">
203
- <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=true" title="<?php echo __('Link to Media hosted on Blubrry.com', 'powerpress'); ?>" class="thickbox">
204
  <img src="<?php echo powerpress_get_root_url(); ?>/images/button_icon_blubrry.png" class="powerpress-button-icon" alt="" />
205
  <?php echo __('Link to Media hosted on Blubrry.com', 'powerpress'); ?></a>
206
- <!-- <a href="<?php echo admin_url('admin.php'); ?>?action=powerpress-jquery-media&podcast-feed=<?php echo $FeedSlug; ?>&KeepThis=true&TB_iframe=true&modal=true" title="<?php echo __('Upload Media File to your Blubrry.com account', 'powerpress'); ?>" class="thickbox"><?php echo __('Upload Media File', 'powerpress'); ?></a> -->
207
  <?php if( empty($GeneralSettings['blubrry_hosting']) || $GeneralSettings['blubrry_hosting']==='false' ) { ?>
208
  &nbsp; <?php echo __('Don\'t have Blubrry Podcast Media Hosting?', 'powerpress'); ?> <a href="http://create.blubrry.com/resources/podcast-media-hosting/" target="_blank"><?php echo __('Learn More', 'powerpress'); ?></a>
209
  <?php } ?>
188
  <label for="Powerpress[<?php echo $FeedSlug; ?>][url]"><?php echo __('Media URL', 'powerpress'); ?></label>
189
  <div class="powerpress_row_content">
190
  <input type="text" id="powerpress_url_<?php echo $FeedSlug; ?>" class="powerpress-url" name="Powerpress[<?php echo $FeedSlug; ?>][url]" value="<?php echo esc_attr($EnclosureURL); ?>" <?php echo ( !empty($ExtraData['hosting']) ?'readOnly':''); ?> style="width: 70%;" />
191
+ <?php if( true ) { // NOW ALWAYS SHOW FOLDER, PREVIOUS: if( !empty($GeneralSettings['blubrry_hosting']) && $GeneralSettings['blubrry_hosting']!=='false' && !empty($GeneralSettings['timestamp']) && $GeneralSettings['timestamp'] < 1414627200 ) { // display the folder icon for folks before october 30, 2014 ?>
192
+ <a title="<?php echo esc_attr(__('Blubrry Podcast Hosting', 'powerpress')); ?>" 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 __('Browse Media File', 'powerpress'); ?>" class="thickbox"><img src="<?php echo powerpress_get_root_url(); ?>/images/blubrry_folder.png" alt="<?php echo __('Browse Media Files', 'powerpress'); ?>" /></a>
193
  <?php } ?>
194
  <input type="button" id="powerpress_check_<?php echo $FeedSlug; ?>_button" name="powerpress_check_<?php echo $FeedSlug; ?>_button" value="<?php echo __('Verify URL', 'powerpress'); ?>" onclick="powerpress_get_media_info('<?php echo $FeedSlug; ?>');" alt="<?php echo __('Verify Media', 'powerpress'); ?>" class="button" />
195
  <img id="powerpress_check_<?php echo $FeedSlug; ?>" src="<?php echo admin_url(); ?>images/loading.gif" style="vertical-align:text-top; display: none;" alt="<?php echo __('Checking Media', 'powerpress'); ?>" />
200
  </em></div>
201
 
202
  <div class="powerpress-hosting-buttons">
203
+ <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">
204
  <img src="<?php echo powerpress_get_root_url(); ?>/images/button_icon_blubrry.png" class="powerpress-button-icon" alt="" />
205
  <?php echo __('Link to Media hosted on Blubrry.com', 'powerpress'); ?></a>
206
+ <!-- <a 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 __('Upload Media File to your Blubrry.com account', 'powerpress'); ?>" class="thickbox"><?php echo __('Upload Media File', 'powerpress'); ?></a> -->
207
  <?php if( empty($GeneralSettings['blubrry_hosting']) || $GeneralSettings['blubrry_hosting']==='false' ) { ?>
208
  &nbsp; <?php echo __('Don\'t have Blubrry Podcast Media Hosting?', 'powerpress'); ?> <a href="http://create.blubrry.com/resources/podcast-media-hosting/" target="_blank"><?php echo __('Learn More', 'powerpress'); ?></a>
209
  <?php } ?>
powerpressadmin-migrate.php CHANGED
@@ -3,7 +3,10 @@
3
 
4
  function powerpress_admin_verify_url($url)
5
  {
6
- $response = wp_remote_head( $url, array('httpversion' => 1.1) );
 
 
 
7
 
8
  for( $x = 0; $x < 5; $x++ )
9
  {
@@ -11,7 +14,7 @@ function powerpress_admin_verify_url($url)
11
  if( !is_wp_error( $response ) && ($response['response']['code'] == 301 || $response['response']['code'] == 302) )
12
  {
13
  $headers = wp_remote_retrieve_headers( $response );
14
- $response = wp_remote_head( $headers['location'], array('httpversion' => 1.1) );
15
  }
16
  else
17
  {
@@ -73,7 +76,7 @@ function powepress_admin_migrate_add_urls($urls)
73
  $Settings = get_option('powerpress_general');
74
  if( empty($Settings['blubrry_auth']) )
75
  {
76
- powerpress_page_message_add_error( sprintf(__('You must have a blubrry Podcast Hosting account to continue.', 'powerpress')) .' '. '<a href="http://create.blubrry.com/resources/podcast-media-hosting/" target="_blank">'. __('Learn More', 'powerpress') .'</a>' );
77
  return false;
78
  }
79
 
@@ -85,6 +88,7 @@ function powepress_admin_migrate_add_urls($urls)
85
  {
86
  $req_url = sprintf('%s/media/%s/migrate_add.json', rtrim($api_url, '/'), urlencode($Settings['blubrry_program_keyword']) );
87
  $req_url .= (defined('POWERPRESS_BLUBRRY_API_QSA')?'&'. POWERPRESS_BLUBRRY_API_QSA:'');
 
88
  $json_data = powerpress_remote_fopen($req_url, $Settings['blubrry_auth'], $PostArgs );
89
  if( $json_data != false )
90
  break;
@@ -95,7 +99,7 @@ function powepress_admin_migrate_add_urls($urls)
95
  if( !empty($GLOBALS['g_powerpress_remote_errorno']) && $GLOBALS['g_powerpress_remote_errorno'] == 401 )
96
  $error .= __('Incorrect sign-in email address or password.', 'powerpress') .' '. __('Verify your account settings then try again.', 'powerpress');
97
  else if( !empty($GLOBALS['g_powerpress_remote_error']) )
98
- $error .= '<p>'. $GLOBALS['g_powerpress_remote_error'];
99
  else
100
  $error .= __('Authentication failed.', 'powerpress');
101
  powerpress_page_message_add_error($error);
@@ -125,7 +129,7 @@ function powerpress_admin_migrate_get_status()
125
  $Settings = get_option('powerpress_general');
126
  if( empty($Settings['blubrry_auth']) )
127
  {
128
- powerpress_page_message_add_error( sprintf(__('You must have a blubrry Podcast Hosting account to continue.', 'powerpress')) );
129
  return false;
130
  }
131
 
@@ -146,7 +150,7 @@ function powerpress_admin_migrate_get_status()
146
  if( !empty($GLOBALS['g_powerpress_remote_errorno']) && $GLOBALS['g_powerpress_remote_errorno'] == 401 )
147
  $error .= __('Incorrect sign-in email address or password.', 'powerpress') .' '. __('Verify your account settings then try again.', 'powerpress');
148
  else if( !empty($GLOBALS['g_powerpress_remote_error']) )
149
- $error .= '<p>'. $GLOBALS['g_powerpress_remote_error'];
150
  else
151
  $error .= __('Authentication failed.', 'powerpress');
152
  powerpress_page_message_add_error($error);
@@ -176,7 +180,7 @@ function powerpress_admin_migrate_get_migrated_by_status($status='migrated')
176
  $Settings = get_option('powerpress_general');
177
  if( empty($Settings['blubrry_auth']) )
178
  {
179
- powerpress_page_message_add_error( sprintf(__('You must have a blubrry Podcast Hosting account to continue.', 'powerpress')) );
180
  return false;
181
  }
182
 
@@ -207,8 +211,9 @@ function powerpress_admin_migrate_get_migrated_by_status($status='migrated')
207
  $results = powerpress_json_decode($json_data);
208
  if( empty($results) )
209
  {
210
- $results = array();
211
- $results['error'] = __('Unknown error occurred decoding results from server.', 'powerpress');
 
212
  }
213
 
214
  if( !empty($results['error']) )
@@ -261,118 +266,146 @@ function powerpress_admin_migrate_request()
261
 
262
  //$URLs = powerpress_admin_migrate_get_migrated_by_status('completed');
263
  $URLs = powerpress_admin_migrate_get_migrated_by_status('all');
264
- $URLs['updated_timestamp'] = current_time( 'timestamp' );
265
-
266
- if( $add_option )
267
- add_option('powerpress_migrate_results', $URLs, '', 'no'); // Make sure it is not auto loaded
268
- else
269
- update_option('powerpress_migrate_results', $URLs);
270
-
271
- if( !empty($URLs['results']) )
272
  {
273
- $update_option = true;
274
- $CompletedResults = get_option('powerpress_migrate_completed');
275
- if( $CompletedResults == false )
276
- $update_option = false;
277
- if( empty($CompletedResults['completed_count']) )
278
- $CompletedResults['completed_count'] = 0;
279
- if( empty($CompletedResults['error_count']) )
280
- $CompletedResults['error_count'] = 0;
281
- if( empty($GLOBALS['g_powerprss_verify_failed_count']) )
282
- $GLOBALS['g_powerprss_verify_failed_count'] = 0;
283
- if( empty($GLOBALS['g_powerpress_already_migrated']) )
284
- $GLOBALS['g_powerpress_already_migrated'] = 0;
285
- if( empty($GLOBALS['g_powerpress_total_migrated']) )
286
- $GLOBALS['g_powerpress_total_migrated'] = 0;
287
- $QueuedEpisodes = get_option('powerpress_migrate_queued'); // Array of key meta_id => URL value pairs
288
 
289
- $FoundCount = 0;
290
- if( !empty($QueuedEpisodes) )
291
  {
292
- while( list($index,$row) = each($URLs['results']) )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
293
  {
294
- if( $row['status'] != 'completed' ) // Not migrated
295
- continue;
296
-
297
- $source_url = $row['source_url'];
298
- $new_url = $row['new_url'];
299
- $found = array_keys($QueuedEpisodes, $source_url);
300
-
301
- if( empty($found) )
302
- {
303
- continue; // Nothing found here
304
- }
305
-
306
- $FoundCount++;
307
- $GLOBALS['g_powerpress_total_migrated']++;
308
-
309
- while( list($null,$meta_id) = each($found) )
310
  {
311
- // Get the post meta
312
- $meta_object = get_metadata_by_mid('post', $meta_id);
313
- if( !is_object($meta_object) )
314
- continue; // Weird
315
-
316
- $meta_data = $meta_object->meta_value;
317
-
318
- $parts = explode("\n", $meta_data, 2);
319
- $other_meta_data = false;
320
- if( count($parts) == 2 )
321
- list($current_url, $other_meta_data) = $parts;
322
- else
323
- $current_url = trim($meta_data);
324
 
325
- $current_url = trim($current_url);
 
 
326
 
327
- // We already migrated this one, or it was modified anyway
328
- if( $source_url != $current_url )
329
  {
330
- //echo "$source_url != $current_url ";
331
- $GLOBALS['g_powerpress_already_migrated']++;
332
- continue;
333
  }
334
 
335
- // Verify the URL:
336
- if( !empty($_POST['PowerPressVerifyURLs']) )
 
 
337
  {
338
- $verified= powerpress_admin_verify_url($new_url);
339
- if( !empty($verified['error']) )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
340
  {
341
- // TODO: Handle the error here...
342
- $GLOBALS['g_powerprss_verify_failed_count']++;
343
  continue;
344
  }
345
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
346
 
347
- $new_meta_data = $new_url;
348
- if( $other_meta_data )
349
- $new_meta_data .= "\n". $other_meta_data;
350
-
351
- // save the new URL
352
- if( update_metadata_by_mid( 'post', $meta_id, $new_meta_data) )
353
- {
354
- $CompletedResults['completed_count']++;
355
- $CompletedResults['results'][ $meta_id ] = $new_url;
 
 
356
  }
 
 
 
 
 
 
357
  else
358
- {
359
- $CompletedResults['error_count']++;
360
- }
361
  }
362
- }
363
-
364
- if( $CompletedResults['completed_count'] > 0 )
365
- {
366
- if( $update_option )
367
- update_option('powerpress_migrate_completed', $CompletedResults);
368
- else
369
- add_option('powerpress_migrate_completed', $CompletedResults, '', 'no'); // Make sure we are not preloading
370
- powerpress_page_message_add_notice( sprintf(__('Episodes updated successfully.', 'powerpress')) );
371
  return;
372
  }
373
  }
 
 
 
 
374
  }
375
- powerpress_page_message_add_notice( sprintf(__('No episoded updated.', 'powerpress')) );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
376
  }; break;
377
  }
378
  }
@@ -387,7 +420,7 @@ function powerpress_admin_extension_counts()
387
  $extension = '*';
388
 
389
  $parts = pathinfo($row['src_url']);
390
- if( preg_match('/(mp3|m4a|mp4|m4v)/i', $parts['extension']) )
391
  $extension = strtolower($parts['extension']);
392
 
393
  if( !empty($row['on_blubrry']) )
@@ -424,6 +457,7 @@ function powerpress_admin_queue_files($extensions=array() )
424
  }
425
 
426
  $files = powerpress_admin_migrate_get_files(true, true); // Keep the URLs clean, excude blubrry media URLs
 
427
  $QueuedFiles = array();
428
  $Update = false;
429
  $update_option = true;
@@ -459,6 +493,7 @@ function powerpress_admin_queue_files($extensions=array() )
459
  {
460
  // Make API CALL to add files to queue here!
461
  $UpdateResults = powepress_admin_migrate_add_urls( $add_urls );
 
462
  if( empty($UpdateResults) )
463
  $Update = false;
464
  }
@@ -504,7 +539,7 @@ function powerpress_admin_migrate_step1()
504
  </li>
505
  <?php
506
  }
507
- $types = array('mp3', 'm4a', 'mp4', 'm4v', '*', 'blubrry');
508
  while (list($null, $extension) = each($types) )
509
  {
510
  if( empty($GLOBALS['powerpress_migrate_stats'][$extension]) )
@@ -517,6 +552,7 @@ function powerpress_admin_migrate_step1()
517
  case 'm4a': $label = __('m4a audio files', 'powerpress'); break;
518
  case 'mp4': $label = __('mp4 video files', 'powerpress'); break;
519
  case 'm4v': $label = __('m4v video files', 'powerpress'); break;
 
520
  case 'blubrry': $label = __('media hosted by Blubrry', 'powerpress'); break;
521
  default: $label = __('Other media formats', 'powerpress'); $checked = '';
522
  }
@@ -801,10 +837,10 @@ function powerpress_admin_migrate()
801
  echo '</p>';
802
  }
803
 
804
- if( !empty($GLOBALS['g_powerpress_total_migrated']) )
805
  {
806
  echo '<p>';
807
- echo sprintf(__('%d migrated files found on this site.', 'powerpress'), $GLOBALS['g_powerpress_total_migrated']);
808
  echo '</p>';
809
  }
810
 
@@ -814,13 +850,20 @@ function powerpress_admin_migrate()
814
  echo sprintf(__('%d episodes already updated with new URLs.', 'powerpress'), $GLOBALS['g_powerpress_already_migrated']);
815
  echo '</p>';
816
  }
 
 
 
 
 
 
 
817
  ?>
818
 
819
  <h2><?php echo __('Migrate Media to your Blubrry Podcast Media Hosting Account', 'powerpress'); ?></h2>
820
 
821
  <p><?php echo __('Migrate all of your media to Blubrry with only a few clicks.', 'powerpress'); ?></p>
822
 
823
- <p><a href="<?php echo admin_url('admin.php'); ?>?action=powerpress-jquery-hosting&amp;KeepThis=true&amp;TB_iframe=true&amp;modal=true&amp;width=800&amp;height=400" target="_blank" class="thickbox"><?php echo __('Don\'t have a blubrry podcast hosting account?', 'powerpress'); ?></a></p>
824
 
825
 
826
 
@@ -892,6 +935,9 @@ function powerpress_admin_migrate()
892
  <p>
893
  <?php echo __('Migration can take a while, please be patient. Please contact support if you do not see results within 48 hours. You may repeat these steps if additional episdoes have been added after to starting migration.', 'powepress'); ?>
894
  </p>
 
 
 
895
  <br /><br />
896
  <?php } ?>
897
  <?php
3
 
4
  function powerpress_admin_verify_url($url)
5
  {
6
+ $wp_remote_options = array();
7
+ $wp_remote_options['user-agent'] = 'Blubrry PowerPress/'.POWERPRESS_VERSION;
8
+ $wp_remote_options['httpversion'] = '1.1';
9
+ $response = wp_remote_head( $url, $wp_remote_options );
10
 
11
  for( $x = 0; $x < 5; $x++ )
12
  {
14
  if( !is_wp_error( $response ) && ($response['response']['code'] == 301 || $response['response']['code'] == 302) )
15
  {
16
  $headers = wp_remote_retrieve_headers( $response );
17
+ $response = wp_remote_head( $headers['location'], $wp_remote_options );
18
  }
19
  else
20
  {
76
  $Settings = get_option('powerpress_general');
77
  if( empty($Settings['blubrry_auth']) )
78
  {
79
+ powerpress_page_message_add_error( sprintf(__('You must have a blubrry Podcast Hosting account to continue.', 'powerpress')) .' '. '<a href="http://create.blubrry.com/resources/podcast-media-hosting/" target="_blank">'. __('Learn More', 'powerpress') .'</a>', 'inline', false );
80
  return false;
81
  }
82
 
88
  {
89
  $req_url = sprintf('%s/media/%s/migrate_add.json', rtrim($api_url, '/'), urlencode($Settings['blubrry_program_keyword']) );
90
  $req_url .= (defined('POWERPRESS_BLUBRRY_API_QSA')?'&'. POWERPRESS_BLUBRRY_API_QSA:'');
91
+
92
  $json_data = powerpress_remote_fopen($req_url, $Settings['blubrry_auth'], $PostArgs );
93
  if( $json_data != false )
94
  break;
99
  if( !empty($GLOBALS['g_powerpress_remote_errorno']) && $GLOBALS['g_powerpress_remote_errorno'] == 401 )
100
  $error .= __('Incorrect sign-in email address or password.', 'powerpress') .' '. __('Verify your account settings then try again.', 'powerpress');
101
  else if( !empty($GLOBALS['g_powerpress_remote_error']) )
102
+ $error .= $GLOBALS['g_powerpress_remote_error'];
103
  else
104
  $error .= __('Authentication failed.', 'powerpress');
105
  powerpress_page_message_add_error($error);
129
  $Settings = get_option('powerpress_general');
130
  if( empty($Settings['blubrry_auth']) )
131
  {
132
+ powerpress_page_message_add_error( sprintf(__('You must have a blubrry Podcast Hosting account to continue.', 'powerpress')), 'inline', false );
133
  return false;
134
  }
135
 
150
  if( !empty($GLOBALS['g_powerpress_remote_errorno']) && $GLOBALS['g_powerpress_remote_errorno'] == 401 )
151
  $error .= __('Incorrect sign-in email address or password.', 'powerpress') .' '. __('Verify your account settings then try again.', 'powerpress');
152
  else if( !empty($GLOBALS['g_powerpress_remote_error']) )
153
+ $error .= $GLOBALS['g_powerpress_remote_error'];
154
  else
155
  $error .= __('Authentication failed.', 'powerpress');
156
  powerpress_page_message_add_error($error);
180
  $Settings = get_option('powerpress_general');
181
  if( empty($Settings['blubrry_auth']) )
182
  {
183
+ powerpress_page_message_add_error( sprintf(__('You must have a blubrry Podcast Hosting account to continue.', 'powerpress')), 'inline', false );
184
  return false;
185
  }
186
 
211
  $results = powerpress_json_decode($json_data);
212
  if( empty($results) )
213
  {
214
+ $error = __('Unknown error occurred decoding results from server.', 'powerpress');
215
+ powerpress_page_message_add_error($error);
216
+ return false;
217
  }
218
 
219
  if( !empty($results['error']) )
266
 
267
  //$URLs = powerpress_admin_migrate_get_migrated_by_status('completed');
268
  $URLs = powerpress_admin_migrate_get_migrated_by_status('all');
269
+ if( !empty($URLs) )
 
 
 
 
 
 
 
270
  {
271
+ $URLs['updated_timestamp'] = current_time( 'timestamp' );
272
+
273
+ if( $add_option )
274
+ add_option('powerpress_migrate_results', $URLs, '', 'no'); // Make sure it is not auto loaded
275
+ else
276
+ update_option('powerpress_migrate_results', $URLs);
 
 
 
 
 
 
 
 
 
277
 
278
+ if( !empty($URLs['results']) )
 
279
  {
280
+ $update_option = true;
281
+ $CompletedResults = get_option('powerpress_migrate_completed');
282
+ if( $CompletedResults == false )
283
+ $update_option = false;
284
+ if( empty($CompletedResults['completed_count']) )
285
+ $CompletedResults['completed_count'] = 0;
286
+ if( empty($CompletedResults['error_count']) )
287
+ $CompletedResults['error_count'] = 0;
288
+ if( empty($GLOBALS['g_powerprss_verify_failed_count']) )
289
+ $GLOBALS['g_powerprss_verify_failed_count'] = 0;
290
+ if( empty($GLOBALS['g_powerpress_already_migrated']) )
291
+ $GLOBALS['g_powerpress_already_migrated'] = 0;
292
+ if( empty($GLOBALS['g_powerpress_total_files_found']) )
293
+ $GLOBALS['g_powerpress_total_files_found'] = 0;
294
+ if( empty($GLOBALS['g_powerpress_update_errors']) )
295
+ $GLOBALS['g_powerpress_update_errors'] = 0;
296
+ $QueuedEpisodes = get_option('powerpress_migrate_queued'); // Array of key meta_id => URL value pairs
297
+
298
+ $FoundCount = 0;
299
+ if( !empty($QueuedEpisodes) )
300
  {
301
+ while( list($index,$row) = each($URLs['results']) )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
302
  {
303
+ if( $row['status'] != 'completed' ) // Not migrated
304
+ continue;
 
 
 
 
 
 
 
 
 
 
 
305
 
306
+ $source_url = $row['source_url'];
307
+ $new_url = $row['new_url'];
308
+ $found = array_keys($QueuedEpisodes, $source_url);
309
 
310
+ if( empty($found) )
 
311
  {
312
+ continue; // Nothing found here
 
 
313
  }
314
 
315
+ $FoundCount++;
316
+ $GLOBALS['g_powerpress_total_files_found']++;
317
+
318
+ while( list($null,$meta_id) = each($found) )
319
  {
320
+ // Get the post meta
321
+ $meta_object = get_metadata_by_mid('post', $meta_id);
322
+ if( !is_object($meta_object) )
323
+ continue; // Weird
324
+
325
+ $meta_data = $meta_object->meta_value;
326
+
327
+ $parts = explode("\n", $meta_data, 2);
328
+ $other_meta_data = false;
329
+ if( count($parts) == 2 )
330
+ list($current_url, $other_meta_data) = $parts;
331
+ else
332
+ $current_url = trim($meta_data);
333
+
334
+ $current_url = trim($current_url);
335
+
336
+ // We already migrated this one, or it was modified anyway
337
+ if( $source_url != $current_url )
338
  {
339
+ //echo "$source_url != $current_url ";
340
+ $GLOBALS['g_powerpress_already_migrated']++;
341
  continue;
342
  }
343
+
344
+ // Verify the URL:
345
+ if( !empty($_POST['PowerPressVerifyURLs']) )
346
+ {
347
+ $verified= powerpress_admin_verify_url($new_url);
348
+ if( !empty($verified['error']) )
349
+ {
350
+ // TODO: Handle the error here...
351
+ $GLOBALS['g_powerprss_verify_failed_count']++;
352
+ continue;
353
+ }
354
+ }
355
+
356
+ $new_meta_data = $new_url;
357
+ if( $other_meta_data )
358
+ $new_meta_data .= "\n". $other_meta_data;
359
 
360
+ // save the new URL
361
+ if( update_metadata_by_mid( 'post', $meta_id, $new_meta_data) )
362
+ {
363
+ $CompletedResults['completed_count']++;
364
+ $CompletedResults['results'][ $meta_id ] = $new_url;
365
+ }
366
+ else
367
+ {
368
+ $CompletedResults['error_count']++;
369
+ $GLOBALS['g_powerpress_update_errors']++;
370
+ }
371
  }
372
+ }
373
+
374
+ if( $CompletedResults['completed_count'] > 0 )
375
+ {
376
+ if( $update_option )
377
+ update_option('powerpress_migrate_completed', $CompletedResults);
378
  else
379
+ add_option('powerpress_migrate_completed', $CompletedResults, '', 'no'); // Make sure we are not preloading
380
+ powerpress_page_message_add_notice( sprintf(__('Episodes updated successfully.', 'powerpress')) );
381
+ return;
382
  }
383
+
384
+ powerpress_page_message_add_notice( sprintf(__('No Episodes updated. Please see results.', 'powerpress')) );
 
 
 
 
 
 
 
385
  return;
386
  }
387
  }
388
+ else
389
+ {
390
+ powerpress_page_message_add_notice( sprintf(__('No episodes updated.', 'powerpress')) );
391
+ }
392
  }
393
+ }; break;
394
+ }
395
+ }
396
+
397
+ if( !empty($_GET['migrate_action']) )
398
+ {
399
+ check_admin_referer('powerpress-migrate-media');
400
+
401
+ switch($_GET['migrate_action'])
402
+ {
403
+ case 'reset_migrate_media': {
404
+ delete_option('powerpress_migrate_completed');
405
+ delete_option('powerpress_migrate_queued');
406
+ delete_option('powerpress_migrate_status');
407
+ delete_option('powerpress_migrate_results');
408
+ powerpress_page_message_add_notice( sprintf(__('Media migration reset successfully.', 'powerpress')) );
409
  }; break;
410
  }
411
  }
420
  $extension = '*';
421
 
422
  $parts = pathinfo($row['src_url']);
423
+ if( preg_match('/(mp3|m4a|mp4|m4v|mov)/i', $parts['extension']) )
424
  $extension = strtolower($parts['extension']);
425
 
426
  if( !empty($row['on_blubrry']) )
457
  }
458
 
459
  $files = powerpress_admin_migrate_get_files(true, true); // Keep the URLs clean, excude blubrry media URLs
460
+
461
  $QueuedFiles = array();
462
  $Update = false;
463
  $update_option = true;
493
  {
494
  // Make API CALL to add files to queue here!
495
  $UpdateResults = powepress_admin_migrate_add_urls( $add_urls );
496
+
497
  if( empty($UpdateResults) )
498
  $Update = false;
499
  }
539
  </li>
540
  <?php
541
  }
542
+ $types = array('mp3', 'm4a', 'mp4', 'm4v', 'mov', '*', 'blubrry');
543
  while (list($null, $extension) = each($types) )
544
  {
545
  if( empty($GLOBALS['powerpress_migrate_stats'][$extension]) )
552
  case 'm4a': $label = __('m4a audio files', 'powerpress'); break;
553
  case 'mp4': $label = __('mp4 video files', 'powerpress'); break;
554
  case 'm4v': $label = __('m4v video files', 'powerpress'); break;
555
+ case 'mov': $label = __('mov video files', 'powerpress'); break;
556
  case 'blubrry': $label = __('media hosted by Blubrry', 'powerpress'); break;
557
  default: $label = __('Other media formats', 'powerpress'); $checked = '';
558
  }
837
  echo '</p>';
838
  }
839
 
840
+ if( !empty($GLOBALS['g_powerpress_total_files_found']) )
841
  {
842
  echo '<p>';
843
+ echo sprintf(__('%d migrated files found on this site.', 'powerpress'), $GLOBALS['g_powerpress_total_files_found']);
844
  echo '</p>';
845
  }
846
 
850
  echo sprintf(__('%d episodes already updated with new URLs.', 'powerpress'), $GLOBALS['g_powerpress_already_migrated']);
851
  echo '</p>';
852
  }
853
+
854
+ if( !empty($GLOBALS['g_powerpress_update_errors']) )
855
+ {
856
+ echo '<p>';
857
+ echo sprintf(__('%d update errors.', 'powerpress'), $GLOBALS['g_powerpress_update_errors']);
858
+ echo '</p>';
859
+ }
860
  ?>
861
 
862
  <h2><?php echo __('Migrate Media to your Blubrry Podcast Media Hosting Account', 'powerpress'); ?></h2>
863
 
864
  <p><?php echo __('Migrate all of your media to Blubrry with only a few clicks.', 'powerpress'); ?></p>
865
 
866
+ <p><a title="<?php echo esc_attr(__('Blubrry Podcast Hosting', 'powerpress')); ?>" href="<?php echo admin_url('admin.php'); ?>?action=powerpress-jquery-hosting&amp;KeepThis=true&amp;TB_iframe=true&amp;modal=false&amp;width=800&amp;height=400" target="_blank" class="thickbox"><?php echo __('Don\'t have a blubrry podcast hosting account?', 'powerpress'); ?></a></p>
867
 
868
 
869
 
935
  <p>
936
  <?php echo __('Migration can take a while, please be patient. Please contact support if you do not see results within 48 hours. You may repeat these steps if additional episdoes have been added after to starting migration.', 'powepress'); ?>
937
  </p>
938
+ <p><a href="<?php echo admin_url(); echo wp_nonce_url( "admin.php?page=powerpress/powerpressadmin_migrate.php&amp;migrate_action=reset_migrate_media&amp;action=powerpress-migrate-media", 'powerpress-migrate-media'); ?>" onclick="return confirm('<?php echo esc_js(__('Reset migration, are you sure?','powerpress')); ?>');"><?php echo __('Reset Migration', 'powerpress'); ?></a>
939
+ <?php ?>
940
+ </p>
941
  <br /><br />
942
  <?php } ?>
943
  <?php
powerpressadmin-mt.php CHANGED
@@ -142,6 +142,10 @@ if( !function_exists('add_action') )
142
 
143
  function powerpressadmin_mt_do_import()
144
  {
 
 
 
 
145
  $Import = ( isset($_POST['Import']) ? $_POST['Import'] : array() );
146
  $Media = ( isset($_POST['Media']) ? $_POST['Media'] : array() );
147
  $Titles = ( isset($_POST['Titles']) ? $_POST['Titles'] : array() );
@@ -171,25 +175,25 @@ if( !function_exists('add_action') )
171
  if( !is_wp_error( $response ) && ($response['response']['code'] == 301 || $response['response']['code'] == 302) )
172
  {
173
  $headers = wp_remote_retrieve_headers( $response );
174
- $response = wp_remote_head( $headers['location'], array('httpversion' => 1.1) );
175
  }
176
  // Redirect 2
177
  if( !is_wp_error( $response ) && ($response['response']['code'] == 301 || $response['response']['code'] == 302) )
178
  {
179
  $headers = wp_remote_retrieve_headers( $response );
180
- $response = wp_remote_head( $headers['location'], array('httpversion' => 1.1) );
181
  }
182
  // Redirect 3
183
  if( !is_wp_error( $response ) && ($response['response']['code'] == 301 || $response['response']['code'] == 302) )
184
  {
185
  $headers = wp_remote_retrieve_headers( $response );
186
- $response = wp_remote_head( $headers['location'], array('httpversion' => 1.1) );
187
  }
188
  // Redirect 4
189
  if( !is_wp_error( $response ) && ($response['response']['code'] == 301 || $response['response']['code'] == 302) )
190
  {
191
  $headers = wp_remote_retrieve_headers( $response );
192
- $response = wp_remote_head( $headers['location'], array('httpversion' => 1.1) );
193
  }
194
  $headers = wp_remote_retrieve_headers( $response );
195
 
142
 
143
  function powerpressadmin_mt_do_import()
144
  {
145
+ $wp_remote_options = array();
146
+ $wp_remote_options['user-agent'] = 'Blubrry PowerPress/'.POWERPRESS_VERSION;
147
+ $wp_remote_options['httpversion'] = '1.1';
148
+
149
  $Import = ( isset($_POST['Import']) ? $_POST['Import'] : array() );
150
  $Media = ( isset($_POST['Media']) ? $_POST['Media'] : array() );
151
  $Titles = ( isset($_POST['Titles']) ? $_POST['Titles'] : array() );
175
  if( !is_wp_error( $response ) && ($response['response']['code'] == 301 || $response['response']['code'] == 302) )
176
  {
177
  $headers = wp_remote_retrieve_headers( $response );
178
+ $response = wp_remote_head( $headers['location'], $wp_remote_options );
179
  }
180
  // Redirect 2
181
  if( !is_wp_error( $response ) && ($response['response']['code'] == 301 || $response['response']['code'] == 302) )
182
  {
183
  $headers = wp_remote_retrieve_headers( $response );
184
+ $response = wp_remote_head( $headers['location'], $wp_remote_options );
185
  }
186
  // Redirect 3
187
  if( !is_wp_error( $response ) && ($response['response']['code'] == 301 || $response['response']['code'] == 302) )
188
  {
189
  $headers = wp_remote_retrieve_headers( $response );
190
+ $response = wp_remote_head( $headers['location'], $wp_remote_options );
191
  }
192
  // Redirect 4
193
  if( !is_wp_error( $response ) && ($response['response']['code'] == 301 || $response['response']['code'] == 302) )
194
  {
195
  $headers = wp_remote_retrieve_headers( $response );
196
+ $response = wp_remote_head( $headers['location'], $wp_remote_options );
197
  }
198
  $headers = wp_remote_retrieve_headers( $response );
199
 
powerpressadmin-posttypefeeds.php CHANGED
@@ -139,7 +139,9 @@ function powerpress_admin_posttypefeeds()
139
 
140
  echo "<td $class><a href='$url' title='". esc_attr(sprintf(__('Visit %s', 'powerpress'), $feed_title))."' target=\"_blank\">$short_url</a>";
141
  echo '<div class="row-actions">';
142
- echo '<span class="'.$action .'"><a href="http://www.feedvalidator.org/check.cgi?url='. urlencode( str_replace('&amp;', '&', $url) ) .'" target="_blank">' . __('Validate Feed', 'powerpress') . '</a></span>';
 
 
143
  echo '</div>';
144
  echo "</td>";
145
 
139
 
140
  echo "<td $class><a href='$url' title='". esc_attr(sprintf(__('Visit %s', 'powerpress'), $feed_title))."' target=\"_blank\">$short_url</a>";
141
  echo '<div class="row-actions">';
142
+ if( defined('POWERPRESS_FEEDVALIDATOR_URL') ) { // http://www.feedvalidator.org/check.cgi?url=
143
+ echo '<span class="'.$action .'"><a href="'. POWERPRESS_FEEDVALIDATOR_URL . urlencode( str_replace('&amp;', '&', $url) ) .'" target="_blank">' . __('Validate Feed', 'powerpress') . '</a></span>';
144
+ }
145
  echo '</div>';
146
  echo "</td>";
147
 
powerpressadmin-taxonomyfeeds.php CHANGED
@@ -146,7 +146,9 @@ function powerpress_admin_taxonomyfeeds()
146
 
147
  echo "<td $class><a href='$url' title='". esc_attr(sprintf(__('Visit %s', 'powerpress'), $feed_title))."' target=\"_blank\">$short_url</a>";
148
  echo '<div class="row-actions">';
149
- echo '<span class="'.$action .'"><a href="http://www.feedvalidator.org/check.cgi?url='. urlencode( str_replace('&amp;', '&', $url) ) .'" target="_blank">' . __('Validate Feed', 'powerpress') . '</a></span>';
 
 
150
  echo '</div>';
151
  echo "</td>";
152
 
146
 
147
  echo "<td $class><a href='$url' title='". esc_attr(sprintf(__('Visit %s', 'powerpress'), $feed_title))."' target=\"_blank\">$short_url</a>";
148
  echo '<div class="row-actions">';
149
+ if( defined('POWERPRESS_FEEDVALIDATOR_URL') ) {
150
+ echo '<span class="'.$action .'"><a href="'. POWERPRESS_FEEDVALIDATOR_URL . urlencode( str_replace('&amp;', '&', $url) ) .'" target="_blank">' . __('Validate Feed', 'powerpress') . '</a></span>';
151
+ }
152
  echo '</div>';
153
  echo "</td>";
154
 
powerpressadmin.php CHANGED
@@ -13,17 +13,23 @@ function powerpress_esc_html($escape)
13
  return esc_html($escape);
14
  }
15
 
16
- function powerpress_page_message_add_error($msg, $classes='inline')
17
  {
18
  global $g_powerpress_page_message;
19
- $g_powerpress_page_message .= '<div class="error powerpress-error '.$classes.'">'. esc_html($msg) . '</div>';
 
 
 
20
  }
21
 
22
- function powerpress_page_message_add_notice($msg, $classes='inline')
23
  {
24
  global $g_powerpress_page_message;
25
  // Always pre-pend, since jQuery will re-order with first as last.
26
- $g_powerpress_page_message = '<div class="updated fade powerpress-notice '.$classes.'">'. esc_html($msg) . '</div>' . $g_powerpress_page_message;
 
 
 
27
  }
28
 
29
 
@@ -106,1107 +112,1121 @@ function powerpress_admin_init()
106
  if( isset($GLOBALS['objWPOSFLV']) && is_object($GLOBALS['objWPOSFLV']) )
107
  powerpress_page_message_add_error( __('The WP OS FLV plugin is not compatible with Blubrry PowerPress.', 'powerpress') );
108
 
109
- // Save settings here
110
- if( isset($_POST[ 'Feed' ]) || isset($_POST[ 'General' ]) )
111
  {
112
- check_admin_referer('powerpress-edit');
113
-
114
- $upload_path = false;
115
- $upload_url = false;
116
- $UploadArray = wp_upload_dir();
117
- if( false === $UploadArray['error'] )
118
  {
119
- $upload_path = $UploadArray['basedir'].'/powerpress/';
120
- $upload_url = $UploadArray['baseurl'].'/powerpress/';
121
- }
122
-
123
- // Save the posted value in the database
124
- $Feed = (isset($_POST['Feed'])?$_POST['Feed']:false);
125
- $General = (isset($_POST['General'])?$_POST['General']:false);
126
- $FeedSlug = (isset($_POST['feed_slug'])?esc_attr($_POST['feed_slug']):false);
127
- $Category = (isset($_POST['cat'])?intval($_POST['cat']):false);
128
- $term_taxonomy_id = (isset($_POST['ttid'])?intval($_POST['ttid']):false);
129
- $podcast_post_type = (isset($_POST['podcast_post_type'])?esc_attr($_POST['podcast_post_type']):false);
130
-
131
- // New iTunes image
132
- if( !empty($_POST['itunes_image_checkbox']) )
133
- {
134
- $filename = str_replace(" ", "_", basename($_FILES['itunes_image_file']['name']) );
135
- $temp = $_FILES['itunes_image_file']['tmp_name'];
136
 
137
- if( file_exists($upload_path . $filename ) )
 
 
 
138
  {
139
- $filenameParts = pathinfo($filename);
140
- if( !empty($filenameParts['extension']) ) {
141
- do {
142
- $filename_no_ext = substr($filenameParts['basename'], 0, (strlen($filenameParts['extension'])+1) * -1 );
143
- $filename = sprintf('%s-%03d.%s', $filename_no_ext, rand(0, 999), $filenameParts['extension'] );
144
- } while( file_exists($upload_path . $filename ) );
145
- }
146
  }
 
 
 
 
 
 
 
 
147
 
148
- // Check the image...
149
- if( file_exists($temp) )
150
  {
151
- $ImageData = @getimagesize($temp);
 
152
 
153
- $rgb = true; // We assume it is RGB
154
- if( defined('POWERPRESS_IMAGICK') && POWERPRESS_IMAGICK )
155
  {
156
- if( $ImageData[2] == IMAGETYPE_PNG && extension_loaded('imagick') )
157
- {
158
- $image = new Imagick( $temp );
159
- if( $image->getImageColorspace() != imagick::COLORSPACE_RGB )
160
- {
161
- $rgb = false;
162
- }
163
  }
164
  }
165
 
166
- if( empty($ImageData['channels']) )
167
- $ImageData['channels'] = 3; // Assume it's ok if we cannot detect it.
168
-
169
- if( $ImageData )
170
  {
171
- if( $rgb && ( $ImageData[2] == IMAGETYPE_JPEG || $ImageData[2] == IMAGETYPE_PNG ) && $ImageData[0] == $ImageData[1] && $ImageData[0] >= 1400 && $ImageData[0] <= 3000 && $ImageData['channels'] == 3 ) // Just check that it is an image, the correct image type and that the image is square
 
 
 
172
  {
173
- if( !move_uploaded_file($temp, $upload_path . $filename) )
174
  {
175
- powerpress_page_message_add_error( __('Error saving iTunes image', 'powerpress') .': ' . htmlspecialchars($_FILES['itunes_image_file']['name']) .' - '. __('An error occurred saving the iTunes image on the server.', 'powerprss'). ' '. sprintf(__('Local folder: %s; File name: %s', 'powerpress'), $upload_path, $filename) );
176
- }
177
- else
178
- {
179
- $Feed['itunes_image'] = $upload_url . $filename;
180
- if( !empty($_POST['itunes_image_checkbox_as_rss']) )
181
  {
182
- $Feed['rss2_image'] = $upload_url . $filename;
183
  }
184
-
185
- //if( $ImageData[0] < 1400 || $ImageData[1] < 1400 )
186
- //{
187
- // powerpress_page_message_add_error( __('iTunes image warning', 'powerpress') .': '. htmlspecialchars($_FILES['itunes_image_file']['name']) . __(' is', 'powerpress') .' '. $ImageData[0] .' x '.$ImageData[0] .' - '. __('Image must be square 1400 x 1400 pixels or larger.', 'powerprss') );
188
- //}
189
  }
190
  }
191
- else if( $ImageData['channels'] != 3 || $rgb == false )
 
 
 
 
192
  {
193
- powerpress_page_message_add_error( __('Invalid iTunes image', 'powerpress') .': ' . htmlspecialchars($_FILES['itunes_image_file']['name']) .' - '. __('Image must be in RGB color space (CMYK is not supported).', 'powerprss') );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
194
  }
195
- else if( $ImageData[0] != $ImageData[1] )
196
  {
197
- powerpress_page_message_add_error( __('Invalid iTunes image', 'powerpress') .': ' . htmlspecialchars($_FILES['itunes_image_file']['name']) .' - '. __('Image must be square, 1400 x 1400 is the required minimum size.', 'powerprss') );
198
  }
199
- else if( $ImageData[0] != $ImageData[1] || $ImageData[0] < 1400 )
 
 
 
 
 
 
 
 
 
 
 
 
200
  {
201
- powerpress_page_message_add_error( __('Invalid iTunes image', 'powerpress') .': ' . htmlspecialchars($_FILES['itunes_image_file']['name']) .' - '. __('Image is too small, 1400 x 1400 is the required minimum size.', 'powerprss') );
 
 
 
202
  }
203
- else if( $ImageData[0] != $ImageData[1] || $ImageData[0] > 3000 )
 
 
 
 
204
  {
205
- powerpress_page_message_add_error( __('Invalid iTunes image', 'powerpress') .': ' . htmlspecialchars($_FILES['itunes_image_file']['name']) .' - '. __('Image is too large, 3000 x 3000 is the maximum size allowed.', 'powerprss') );
206
  }
207
  else
208
  {
209
- powerpress_page_message_add_error( __('Invalid iTunes image', 'powerpress') .': ' . htmlspecialchars($_FILES['itunes_image_file']['name']) );
210
  }
211
  }
212
  else
213
  {
214
- powerpress_page_message_add_error( __('Invalid iTunes image', 'powerpress') .': ' . htmlspecialchars($_FILES['itunes_image_file']['name']) );
215
  }
216
  }
217
- }
218
-
219
- // New RSS2 image
220
- if( !empty($_POST['rss2_image_checkbox']) )
221
- {
222
- $filename = str_replace(" ", "_", basename($_FILES['rss2_image_file']['name']) );
223
- $temp = $_FILES['rss2_image_file']['tmp_name'];
224
 
225
- if( file_exists($upload_path . $filename ) )
 
226
  {
227
- $filenameParts = pathinfo($filename);
228
- if( !empty($filenameParts['basename']) && !empty($filenameParts['extension']) )
 
 
229
  {
 
230
  do {
231
  $filename_no_ext = substr($filenameParts['basename'], 0, (strlen($filenameParts['extension'])+1) * -1 );
232
  $filename = sprintf('%s-%03d.%s', $filename_no_ext, rand(0, 999), $filenameParts['extension'] );
233
  } while( file_exists($upload_path . $filename ) );
234
  }
235
- }
236
-
237
- if( @getimagesize($temp) ) // Just check that it is an image, we may add more to this later
238
- {
239
- if( !move_uploaded_file($temp, $upload_path . $filename) )
240
  {
241
- powerpress_page_message_add_error( __('Error saving RSS image', 'powerpress') .': ' . htmlspecialchars($_FILES['itunes_image_file']['name']) .' - '. __('An error occurred saving the RSS image on the server.', 'powerprss'). ' '. sprintf(__('Local folder: %s; File name: %s', 'powerpress'), $upload_path, $filename) );
 
 
 
 
 
 
 
 
242
  }
243
  else
244
  {
245
- $Feed['rss2_image'] = $upload_url . $filename;
246
  }
247
  }
248
- else
249
- {
250
- powerpress_page_message_add_error( __('Invalid RSS image', 'powerpress') .': '. htmlspecialchars($_FILES['rss2_image_file']['name']) );
251
- }
252
- }
253
-
254
- // New mp3 coverart image
255
- if( !empty($_POST['coverart_image_checkbox']) )
256
- {
257
- $filename = str_replace(" ", "_", basename($_FILES['coverart_image_file']['name']) );
258
- $temp = $_FILES['coverart_image_file']['tmp_name'];
259
 
260
- if( file_exists($upload_path . $filename ) )
 
261
  {
262
- $filenameParts = pathinfo($filename);
263
- do {
264
- $filename_no_ext = substr($filenameParts['basename'], 0, (strlen($filenameParts['extension'])+1) * -1 );
265
- $filename = sprintf('%s-%03d.%s', $filename_no_ext, rand(0, 999), $filenameParts['extension'] );
266
- } while( file_exists($upload_path . $filename ) );
267
- }
268
-
269
- if( @getimagesize($temp) ) // Just check that it is an image, we may add more to this later
270
- {
271
- if( !move_uploaded_file($temp, $upload_path . $filename) )
272
  {
273
- powerpress_page_message_add_error( __('Error saving Coverart image', 'powerpress') .': ' . htmlspecialchars($_FILES['itunes_image_file']['name']) .' - '. __('An error occurred saving the coverart image on the server.', 'powerprss'). ' '. sprintf(__('Local folder: %s; File name: %s', 'powerpress'), $upload_path, $filename) );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
274
  }
275
  else
276
  {
277
- $_POST['TagValues']['tag_coverart'] = $upload_url . $filename;
278
- $General['tag_coverart'] = $upload_url . $filename;
279
  }
280
  }
281
- else
282
- {
283
- powerpress_page_message_add_error( __('Invalid Coverat image', 'powerpress') .': ' . htmlspecialchars($_FILES['coverart_image_file']['name']) );
284
- }
285
- }
286
-
287
- // New poster image
288
- if( !empty($_POST['poster_image_checkbox']) )
289
- {
290
- $filename = str_replace(" ", "_", basename($_FILES['poster_image_file']['name']) );
291
- $temp = $_FILES['poster_image_file']['tmp_name'];
292
 
293
- if( file_exists($upload_path . $filename ) )
294
- {
295
- $filenameParts = pathinfo($filename);
296
- do {
297
- $filename_no_ext = substr($filenameParts['basename'], 0, (strlen($filenameParts['extension'])+1) * -1 );
298
- $filename = sprintf('%s-%03d.%s', $filename_no_ext, rand(0, 999), $filenameParts['extension'] );
299
- } while( file_exists($upload_path . $filename ) );
300
- }
301
 
302
- if( @getimagesize($temp) ) // Just check that it is an image, we may add more to this later
 
303
  {
304
- if( !move_uploaded_file($temp, $upload_path . $filename) )
 
 
 
 
 
 
 
 
 
 
 
 
305
  {
306
- powerpress_page_message_add_error( __('Error saving Poster image', 'powerpress') .': ' . htmlspecialchars($_FILES['itunes_image_file']['name']) .' - '. __('An error occurred saving the poster image on the server.', 'powerprss'). ' '. sprintf(__('Local folder: %s; File name: %s', 'powerpress'), $upload_path, $filename) );
 
 
 
 
 
 
 
307
  }
308
  else
309
  {
310
- $General['poster_image'] = $upload_url . $filename;
311
  }
312
  }
313
- else
314
- {
315
- powerpress_page_message_add_error( __('Invalid poster image', 'powerpress') .': ' . htmlspecialchars($_FILES['poster_image_file']['name']) );
316
- }
317
- }
318
-
319
-
320
- // New audio play icon image
321
- if( !empty($_POST['audio_custom_play_button_checkbox']) )
322
- {
323
- $filename = str_replace(" ", "_", basename($_FILES['audio_custom_play_button_file']['name']) );
324
- $temp = $_FILES['audio_custom_play_button_file']['tmp_name'];
325
 
326
- if( file_exists($upload_path . $filename ) )
 
327
  {
328
- $filenameParts = pathinfo($filename);
329
- do {
330
- $filename_no_ext = substr($filenameParts['basename'], 0, (strlen($filenameParts['extension'])+1) * -1 );
331
- $filename = sprintf('%s-%03d.%s', $filename_no_ext, rand(0, 999), $filenameParts['extension'] );
332
- } while( file_exists($upload_path . $filename ) );
333
- }
334
-
335
- if( @getimagesize($temp) ) // Just check that it is an image, we may add more to this later
336
- {
337
- if( !move_uploaded_file($temp, $upload_path . $filename) )
338
  {
339
- powerpress_page_message_add_error( __('Error saving Play image', 'powerpress') .': ' . htmlspecialchars($_FILES['itunes_image_file']['name']) .' - '. __('An error occurred saving the play image on the server.', 'powerprss'). ' '. sprintf(__('Local folder: %s; File name: %s', 'powerpress'), $upload_path, $filename) );
 
 
 
 
340
  }
341
- else
 
 
342
  {
343
- $General['audio_custom_play_button'] = $upload_url . $filename;
 
 
 
 
 
 
 
344
  }
345
- }
346
- else
347
- {
348
- powerpress_page_message_add_error( __('Invalid play icon image', 'powerpress') .': ' . htmlspecialchars($_FILES['audio_custom_play_button_file']['name']) );
349
- }
350
- }
351
-
352
- // New video play icon image
353
- if( !empty($_POST['video_custom_play_button_checkbox']) )
354
- {
355
- $filename = str_replace(" ", "_", basename($_FILES['video_custom_play_button_file']['name']) );
356
- $temp = $_FILES['video_custom_play_button_file']['tmp_name'];
357
-
358
- if( file_exists($upload_path . $filename ) )
359
- {
360
- $filenameParts = pathinfo($filename);
361
- do {
362
- $filename_no_ext = substr($filenameParts['basename'], 0, (strlen($filenameParts['extension'])+1) * -1 );
363
- $filename = sprintf('%s-%03d.%s', $filename_no_ext, rand(0, 999), $filenameParts['extension'] );
364
- } while( file_exists($upload_path . $filename ) );
365
- }
366
-
367
- $imageInfo = @getimagesize($temp);
368
- if( $imageInfo && $imageInfo[0] == $imageInfo[1] && $imageInfo[0] == 60 ) // Just check that it is an image, we may add more to this later
369
- {
370
- if( !move_uploaded_file($temp, $upload_path . $filename) )
371
  {
372
- powerpress_page_message_add_error( __('Error saving Video Play icon image', 'powerpress') .': ' . htmlspecialchars($_FILES['itunes_image_file']['name']) .' - '. __('An error occurred saving the Video Play icon image on the server.', 'powerprss'). ' '. sprintf(__('Local folder: %s; File name: %s', 'powerpress'), $upload_path, $filename) );
373
  }
374
  else
375
  {
376
- $General['video_custom_play_button'] = $upload_url . $filename;
377
  }
378
  }
379
- else if( $imageInfo )
380
- {
381
- powerpress_page_message_add_error( __('Invalid play icon image size', 'powerpress') .': ' . htmlspecialchars($_FILES['video_custom_play_button_file']['name']) );
382
- }
383
- else
384
  {
385
- powerpress_page_message_add_error( __('Invalid play icon image', 'powerpress') .': ' . htmlspecialchars($_FILES['video_custom_play_button_file']['name']) );
 
 
 
 
 
 
 
 
386
  }
387
- }
388
-
389
- if( isset($_POST['UpdateDisablePlayer']) )
390
- {
391
- $player_feed_slug = $_POST['UpdateDisablePlayer'];
392
- $General['disable_player'] = array();
393
- $GeneralPrev = get_option('powerpress_general');
394
- if( isset($GeneralPrev['disable_player']) )
395
- $General['disable_player'] = $GeneralPrev['disable_player'];
396
- if( isset($_POST['DisablePlayerFor']) )
397
- $General['disable_player'][ $player_feed_slug ] = 1;
398
- else
399
- unset($General['disable_player'][ $player_feed_slug ]);
400
- }
401
-
402
- // Check to see if we need to update the feed title
403
- if( $FeedSlug && !$podcast_post_type )
404
- {
405
- $GeneralSettingsTemp = powerpress_get_settings('powerpress_general', false);
406
- if( !isset($GeneralSettingsTemp['custom_feeds'][$FeedSlug]) || $GeneralSettingsTemp['custom_feeds'][$FeedSlug] != $Feed['title'] )
407
  {
408
- if( !$General )
409
- $General = array();
410
- if( !empty($GeneralSettingsTemp['custom_feeds']) )
411
- $General['custom_feeds'] = $GeneralSettingsTemp['custom_feeds'];
412
- else
413
- $General['custom_feeds'] = array();
414
- $General['custom_feeds'][$FeedSlug] = $Feed['title'];
 
 
 
 
415
  }
416
- }
417
-
418
- // Update the settings in the database:
419
- if( $General )
420
- {
421
- if( !empty($_POST['action']) && $_POST['action'] == 'powerpress-save-settings' )
422
  {
423
- if( !isset($General['display_player_excerpt']) ) // If we are modifying appearance settings but this option was not checked...
424
- $General['display_player_excerpt'] = 0; // Set it to zero.
425
-
426
- //if( !isset($General['display_player_disable_mobile']) )
427
- // $General['display_player_disable_mobile'] = 0;
428
-
429
- $General['disable_dashboard_stats'] = 0;
430
- if( !empty($_POST['DisableStatsInDashboard'] ) )
431
- $General['disable_dashboard_stats'] = 1;
432
- if( !isset($General['disable_dashboard_news'] ) )
433
- $General['disable_dashboard_news'] = 0;
434
 
435
- if( !isset($General['episode_box_mode']) ) // Default not set, 1 = no duration/file size, 2 = yes duration/file size (default if not set)
436
- $General['episode_box_mode'] = 1; // 1 = no duration/file size (unchecked)
437
- if( !isset($General['episode_box_embed'] ) )
438
- $General['episode_box_embed'] = 0;
439
- if( !isset($General['embed_replace_player'] ) )
440
- $General['embed_replace_player'] = 0;
441
- if( !isset($General['episode_box_no_player'] ) )
442
- $General['episode_box_no_player'] = 0;
443
- if( !isset($General['episode_box_no_links'] ) )
444
- $General['episode_box_no_links'] = 0;
445
- if( !isset($General['episode_box_no_player_and_links'] ) )
446
- $General['episode_box_no_player_and_links'] = 0;
447
- if( !isset($General['episode_box_cover_image'] ) )
448
- $General['episode_box_cover_image'] = 0;
449
- if( !isset($General['episode_box_player_size'] ) )
450
- $General['episode_box_player_size'] = 0;
451
- if( !isset($General['episode_box_subtitle'] ) )
452
- $General['episode_box_subtitle'] = 0;
453
- if( !isset($General['episode_box_summary'] ) )
454
- $General['episode_box_summary'] = 0;
455
- if( !isset($General['episode_box_author'] ) )
456
- $General['episode_box_author'] = 0;
457
- if( !isset($General['episode_box_explicit'] ) )
458
- $General['episode_box_explicit'] = 0;
459
- if( !isset($General['episode_box_closed_captioned'] ) )
460
- $General['episode_box_closed_captioned'] = 0;
461
- if( !isset($General['episode_box_itunes_image'] ) )
462
- $General['episode_box_itunes_image'] = 0;
463
 
464
- if( !isset($General['episode_box_order'] ) )
465
- $General['episode_box_order'] = 0;
466
-
467
- if( !isset($General['episode_box_feature_in_itunes'] ) )
468
- $General['episode_box_feature_in_itunes'] = 0;
469
- else
470
- $General['episode_box_order'] = 0;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
471
 
472
- if( !isset($General['allow_feed_comments'] ) )
473
- $General['allow_feed_comments'] = 0;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
474
 
475
- if( !isset($General['feed_links']) )
476
- $General['feed_links'] = 0;
477
-
478
- // Advanced Features
479
- if( !isset($General['player_options'] ) )
480
- $General['player_options'] = 0;
481
- if( !isset($General['cat_casting'] ) )
482
- $General['cat_casting'] = 0;
483
- if( !isset($General['channels'] ) )
484
- $General['channels'] = 0;
485
- if( !isset($General['taxonomy_podcasting'] ) )
486
- $General['taxonomy_podcasting'] = 0;
487
- if( !isset($General['posttype_podcasting'] ) )
488
- $General['posttype_podcasting'] = 0;
489
- if( !isset($General['playlist_player'] ) )
490
- $General['playlist_player'] = 0;
491
- if( !isset($General['metamarks'] ) )
492
- $General['metamarks'] = 0;
493
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
494
 
495
- // Media Presentation Settings
496
- $PlayerSettings = array();
497
- if( !empty($_POST['PlayerSettings']) )
498
- $PlayerSettings = $_POST['PlayerSettings'];
499
- if( empty($PlayerSettings['display_pinw']) )
500
- $PlayerSettings['display_pinw'] = 0;
501
- if( empty($PlayerSettings['display_media_player']) )
502
- $PlayerSettings['display_media_player'] = 0;
503
- if( empty($PlayerSettings['display_pinw']) ) $PlayerSettings['display_pinw'] = 0;
504
- if( empty($PlayerSettings['display_media_player']) ) $PlayerSettings['display_media_player'] = 0;
 
 
 
 
 
 
 
 
 
 
505
 
506
- $General['player_function'] = abs( $PlayerSettings['display_pinw'] - $PlayerSettings['display_media_player'] );
507
- $General['podcast_link'] = 0;
508
- if( !empty($PlayerSettings['display_download']) )
509
  {
510
- $General['podcast_link'] = 1;
511
- if( !empty($PlayerSettings['display_download_size']) )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
512
  {
513
- $General['podcast_link'] = 2;
514
- if( !empty($PlayerSettings['display_download_duration']) )
515
- $General['podcast_link'] = 3;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
516
  }
517
  }
518
 
519
- if( !isset($General['podcast_embed'] ) )
520
- $General['podcast_embed'] = 0;
521
- if( !isset($General['podcast_embed_in_feed'] ) )
522
- $General['podcast_embed_in_feed'] = 0;
523
- if( !isset($General['m4a'] ) )
524
- $General['m4a'] = '';
525
- if( !isset($General['new_window_nofactor'] ) )
526
- $General['new_window_nofactor'] = '';
 
 
 
 
 
 
 
 
 
 
 
 
 
527
 
528
- if( !isset($General['subscribe_links'] ) )
529
- $General['subscribe_links'] = false;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
530
 
 
 
531
  }
532
- else if( !empty($_POST['action']) && $_POST['action'] == 'powerpress-save-defaults' )
 
533
  {
534
- if( !isset($General['display_player_excerpt']) ) // If we are modifying appearance settings but this option was not checked...
535
- $General['display_player_excerpt'] = 0; // Set it to zero.
536
- $General['disable_dashboard_stats'] = 0;
537
- if( !empty($_POST['DisableStatsInDashboard'] ) )
538
- $General['disable_dashboard_stats'] = 1;
539
 
540
- // Advanced Mode options
541
- if( !isset($General['cat_casting'] ) )
542
- $General['cat_casting'] = 0;
543
- if( !isset($General['channels'] ) )
544
- $General['channels'] = 0;
545
- if( !isset($General['taxonomy_podcasting'] ) )
546
- $General['taxonomy_podcasting'] = 0;
547
- if( !isset($General['posttype_podcasting'] ) )
548
- $General['posttype_podcasting'] = 0;
549
- if( !isset($General['metamarks'] ) )
550
- $General['metamarks'] = 0;
551
  }
552
 
553
- if( !empty($_POST['action']) && $_POST['action'] == 'powerpress-save-search' )
 
 
 
 
554
  {
555
- //$PowerPressSearch = $_POST['PowerPressSearch'];
556
- $PowerPressSearchToggle = $_POST['PowerPressSearchToggle'];
557
- if( empty($PowerPressSearchToggle['seo_feed_title']) )
558
- $General['seo_feed_title'] = 0;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
559
  }
560
-
561
- if( !empty($_POST['action']) && $_POST['action'] == 'powerpress-save-tags' )
 
 
 
 
562
  {
563
- if( !isset($General['write_tags']) ) // If we are modifying appearance settings but this option was not checked...
564
- $General['write_tags'] = 0; // Set it to zero.
565
 
566
- $TagValues = $_POST['TagValues'];
567
- $GeneralPosted = $_POST['General'];
568
-
569
- if( !empty($_POST['PowerPressTrackNumber']) ) {
570
- update_option('powerpress_track_number', $_POST['PowerPressTrackNumber']);
571
- }
572
- // Set all the tag values...
573
- while( list($key,$value) = each($GeneralPosted) )
574
- {
575
- if( substr($key, 0, 4) == 'tag_' )
576
  {
577
- // Special case, we are uploading new coverart image
578
- if( !empty($_POST['coverart_image_checkbox']) && $key == 'tag_coverart' )
579
- continue;
580
-
581
- // Specail case, the track is saved in a separate column in the database.
582
- if( $key == 'tag_track' )
583
- continue;
 
 
 
 
 
 
 
584
 
585
- if( !empty($value) )
586
- $General[$key] = $TagValues[$key];
587
- else
588
- $General[$key] = '';
 
 
589
  }
 
 
 
 
 
 
 
590
  }
 
591
 
592
- if( !empty($General['tag_coverart']) ) // $TagValues['tag_coverart'] != '' )
593
- {
594
- $GeneralSettingsTemp = powerpress_get_settings('powerpress_general', false);
595
- if( !empty($GeneralSettingsTemp['blubrry_hosting']) && $GeneralSettingsTemp['blubrry_hosting'] !== 'false' )
 
 
 
 
 
 
 
 
596
  {
597
- $json_data = false;
598
- $api_url_array = powerpress_get_api_array();
599
- while( list($index,$api_url) = each($api_url_array) )
600
- {
601
- $req_url = sprintf('%s/media/%s/coverart.json?url=%s', rtrim($api_url, '/'), $GeneralSettingsTemp['blubrry_program_keyword'], urlencode($TagValues['tag_coverart']) );
602
- $req_url .= (defined('POWERPRESS_BLUBRRY_API_QSA')?'&'. POWERPRESS_BLUBRRY_API_QSA:'');
603
- $json_data = powerpress_remote_fopen($req_url, $GeneralSettingsTemp['blubrry_auth']);
604
- if( $json_data != false )
605
- break;
606
- }
607
- // Lets try to cache the image onto Blubrry's Server...
608
- $results = powerpress_json_decode($json_data);
609
-
610
- if( is_array($results) && !isset($results['error']) )
 
 
611
  {
612
- // Good!
613
- powerpress_page_message_add_notice( __('Coverart image updated successfully.', 'powerpress') );
614
  }
615
- else if( isset($results['error']) )
 
 
 
 
 
 
 
 
 
 
 
 
 
616
  {
617
- $error = __('Blubrry Hosting Error (updating coverart)', 'powerpress') .': '. $results['error'];
618
- powerpress_page_message_add_error($error);
619
  }
620
  else
621
  {
622
- $error = __('An error occurred updating the coverart with your Blubrry Services Account.', 'powerpress');
623
- powerpress_page_message_add_error($error);
 
 
 
 
 
 
 
 
 
 
 
624
  }
625
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
626
  else
627
  {
628
- powerpress_page_message_add_error( __('Coverart Image was not uploaded to your Blubrry Services Account. It will NOT be added to your mp3s.', 'powerpress') );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
629
  }
630
- }
631
- }
632
-
633
- if( !empty($_POST['action']) && $_POST['action'] == 'powerpress-save-videocommon' )
634
- {
635
- if( !isset($General['poster_play_image'] ) )
636
- $General['poster_play_image'] = 0;
637
- if( !isset($General['poster_image_audio'] ) )
638
- $General['poster_image_audio'] = 0;
639
- }
640
-
641
- // Wordpress adds slashes to everything, but since we're storing everything serialized, lets remove them...
642
- $General = powerpress_stripslashes($General);
643
- powerpress_save_settings($General);
644
- }
645
-
646
- if( $Feed )
647
- {
648
- if( !isset($_POST['ProtectContent']) && isset($Feed['premium']) )
649
- $Feed['premium'] = false;
650
- if( !isset($Feed['enhance_itunes_summary']) )
651
- $Feed['enhance_itunes_summary'] = false;
652
- if( !isset($Feed['itunes_author_post']) )
653
- $Feed['itunes_author_post'] = false;
654
-
655
- if( !isset($Feed['itunes_block']) )
656
- $Feed['itunes_block'] = false;
657
- if( !isset($Feed['itunes_complete']) )
658
- $Feed['itunes_complete'] = false;
659
- if( !isset($Feed['maximize_feed']) )
660
- $Feed['maximize_feed'] = false;
661
- if( !isset($Feed['episode_itunes_image']) )
662
- $Feed['episode_itunes_image'] = false;
663
-
664
-
665
- $Feed = powerpress_stripslashes($Feed);
666
- if( $Category )
667
- {
668
- powerpress_save_settings($Feed, 'powerpress_cat_feed_'.$Category);
669
- }
670
- else if ( $term_taxonomy_id )
671
- {
672
- powerpress_save_settings($Feed, 'powerpress_taxonomy_'.$term_taxonomy_id);
673
- }
674
- else if( $podcast_post_type )
675
- {
676
- $PostTypeSettings = array();
677
- $PostTypeSettings[ $FeedSlug ] = $Feed;
678
- powerpress_save_settings($PostTypeSettings, 'powerpress_posttype_'.$podcast_post_type);
679
- powerpress_rebuild_posttype_podcasting();
680
- }
681
- else // otherwise treat as a podcast channel
682
- {
683
- if( $FeedSlug == false && get_option('powerpress_feed_podcast') ) // If the settings were moved to the podcast channels feature...
684
- powerpress_save_settings($Feed, 'powerpress_feed_podcast' ); // save a copy here if that is the case.
685
-
686
- powerpress_save_settings($Feed, 'powerpress_feed'.($FeedSlug?'_'.$FeedSlug:'') );
687
- }
688
- }
689
-
690
- if( isset($_POST['EpisodeBoxBGColor']) )
691
- {
692
- $GeneralSettingsTemp = get_option('powerpress_general');
693
- $SaveEpisdoeBoxBGColor['episode_box_background_color'] = array();
694
- if( isset($GeneralSettingsTemp['episode_box_background_color']) )
695
- $SaveEpisdoeBoxBGColor['episode_box_background_color'] = $GeneralSettingsTemp['episode_box_background_color']; // copy previous settings
696
-
697
- list($feed_slug_temp, $background_color) = each($_POST['EpisodeBoxBGColor']);
698
- $SaveEpisdoeBoxBGColor['episode_box_background_color'][ $feed_slug_temp ] = $background_color;
699
- powerpress_save_settings($SaveEpisdoeBoxBGColor);
700
- }
701
-
702
- // Anytime settings are saved lets flush the rewrite rules
703
- $wp_rewrite->flush_rules();
704
-
705
- // Settings saved successfully
706
- if( !empty($_POST['action']) )
707
- {
708
- switch( $_POST['action'] )
709
- {
710
- case 'powerpress-save-settings':
711
- case 'powerpress-save-defaults': {
712
- powerpress_page_message_add_notice( __('Blubrry PowerPress settings saved.', 'powerpress') );
713
  }; break;
714
- case 'powerpress-save-channel': {
715
- powerpress_page_message_add_notice( __('Blubrry PowerPress Channel settings saved.', 'powerpress') );
 
 
 
 
 
716
  }; break;
717
- case 'powerpress-save-category': {
718
- powerpress_page_message_add_notice( __('Blubrry PowerPress Category Podcasting settings saved.', 'powerpress') );
 
 
 
 
 
719
  }; break;
720
- case 'powerpress-save-ttid': {
721
- powerpress_page_message_add_notice( __('Blubrry PowerPress Taxonomy Podcasting settings saved.', 'powerpress') );
 
 
 
 
 
722
  }; break;
723
- case 'powerpress-save-post_type': {
724
- powerpress_page_message_add_notice( __('Blubrry PowerPress Post Type Podcasting settings saved.', 'powerpress') );
 
 
 
 
 
725
  }; break;
726
- case 'powerpress-save-tags': {
727
- $General = get_option('powerpress_general');
728
- if( empty($General['blubrry_hosting']) || $General['blubrry_hosting'] === 'false' )
729
- powerpress_page_message_add_notice( __('ATTENTION: You must configure your Blubrry Services in the Blubrry PowerPress &gt; Basic Settings page in order to utilize this feature.', 'powerpress') );
730
- else
731
- powerpress_page_message_add_notice( __('Blubrry PowerPress MP3 Tag settings saved.', 'powerpress') );
732
  }; break;
733
- default: {
734
- powerpress_page_message_add_notice( __('Blubrry PowerPress settings saved.', 'powerpress') );
 
 
 
735
  }; break;
736
  }
737
  }
738
- }
739
-
740
- // Handle POST actions...
741
- if( isset($_POST['action'] ) )
742
- {
743
- switch($_POST['action'])
744
  {
745
- case 'powerpress-addfeed': {
746
- check_admin_referer('powerpress-add-feed');
747
-
748
- $Settings = get_option('powerpress_general');
749
- $key = sanitize_title($_POST['feed_slug']);
750
- $value = $_POST['feed_name'];
751
- $value = powerpress_stripslashes($value);
752
-
753
- /*
754
- if( isset($Settings['custom_feeds'][ $key ]) && empty($_POST['overwrite']) )
755
- {
756
- powerpress_page_message_add_error( sprintf(__('Feed slug "%s" already exists.'), $key) );
757
- } else */
758
- if( $key == '' )
759
- {
760
- powerpress_page_message_add_error( sprintf(__('Feed slug "%s" is not valid.', 'powerpress'), esc_html($_POST['feed_slug']) ) );
761
- }
762
- else if( in_array($key, $wp_rewrite->feeds) && !isset($Settings['custom_feeds'][ $key ]) ) // If it is a system feed or feed created by something else
763
- {
764
- powerpress_page_message_add_error( sprintf(__('Feed slug "%s" is not available.', 'powerpress'), esc_html($key) ) );
765
- }
766
- else
767
- {
768
- $Settings['custom_feeds'][ $key ] = $value;
769
- powerpress_save_settings($Settings);
770
-
771
- add_feed($key, 'powerpress_do_podcast_feed'); // Before we flush the rewrite rules we need to add the new custom feed...
772
- $wp_rewrite->flush_rules();
773
 
774
- powerpress_page_message_add_notice( sprintf(__('Podcast Feed "%s" added, please configure your new feed now.', 'powerpress'), esc_html($value) ) );
775
- $_GET['action'] = 'powerpress-editfeed';
776
- $_GET['feed_slug'] = $key;
777
- }
778
- }; break;
779
- case 'powerpress-addtaxonomyfeed': {
780
- if( !empty($_POST['cancel']) )
781
- unset($_POST['taxonomy']);
782
-
783
- if( empty($_POST['add_podcasting']) )
784
- break; // We do not handle this situation
785
- }
786
- case 'powerpress-addcategoryfeed': {
787
-
788
- check_admin_referer('powerpress-add-taxonomy-feed');
789
-
790
-
791
-
792
-
793
- $taxonomy_type = ( isset($_POST['taxonomy'])? $_POST['taxonomy'] : $_GET['taxonomy'] );
794
- $term_ID = intval( isset($_POST['term'])? $_POST['term'] : $_GET['term'] );
795
-
796
-
797
- $term_object = get_term( $term_ID, $taxonomy_type, OBJECT, 'edit');
798
-
799
- if( empty($term_ID) )
800
- {
801
- if( $taxonomy_type == 'category' )
802
- powerpress_page_message_add_error( __('You must select a category to continue.', 'powerpress') );
803
- else
804
- powerpress_page_message_add_error( __('You must select a term to continue.', 'powerpress') );
805
- }
806
- else if( $term_object == false )
807
- {
808
- powerpress_page_message_add_error( __('Error obtaining term information.', 'powerpress') );
809
- }
810
- else if( $taxonomy_type == 'category' )
811
- {
812
  $Settings = get_option('powerpress_general');
813
- if( empty($Settings['custom_cat_feeds']) )
814
- $Settings['custom_cat_feeds'] = array();
815
-
816
- if( !in_array($term_ID, $Settings['custom_cat_feeds']) )
817
- {
818
- $Settings['custom_cat_feeds'][] = $term_ID;
819
- powerpress_save_settings($Settings);
820
- }
821
-
822
- powerpress_page_message_add_notice( __('Please configure your category podcast feed now.', 'powerpress') );
823
 
824
- $_GET['action'] = 'powerpress-editcategoryfeed';
825
- $_GET['cat'] = $term_ID;
826
- }
827
- else
828
- {
829
 
830
-
831
- //$term_info = term_exists($term_ID, $taxonomy_type);
832
- $tt_id = $term_object->term_taxonomy_id;
 
833
 
834
- if( !$tt_id )
 
 
835
  {
836
-
837
  }
838
  else
839
  {
840
- $Settings = get_option('powerpress_taxonomy_podcasting');
841
-
842
- if( !isset($Settings[ $tt_id ]) )
 
843
  {
844
- $Settings[ $tt_id ] = true;
845
- powerpress_save_settings($Settings, 'powerpress_taxonomy_podcasting'); // add the feed to the taxonomy podcasting list
846
  }
847
 
848
- powerpress_page_message_add_notice( __('Please configure your taxonomy podcast now.', 'powerpress') );
849
 
850
- $_GET['action'] = 'powerpress-edittaxonomyfeed';
851
- $_GET['term'] = $term_ID;
852
- $_GET['ttid'] = $tt_id;
853
  }
854
- }
855
- }; break;
856
- case 'powerpress-addposttypefeed': {
857
-
858
-
859
- check_admin_referer('powerpress-add-posttype-feed');
860
- //die('ok 2');
861
-
862
- $Settings = get_option('powerpress_general');
863
- $feed_slug = sanitize_title($_POST['feed_slug']);
864
- $post_type = $_POST['podcast_post_type'];
865
- $post_type = powerpress_stripslashes($post_type);
866
- $feed_title = $_POST['feed_title'];
867
- $feed_title = powerpress_stripslashes($feed_title);
868
-
869
-
870
-
871
- /*
872
- if( isset($Settings['custom_feeds'][ $key ]) && empty($_POST['overwrite']) )
873
- {
874
- powerpress_page_message_add_error( sprintf(__('Feed slug "%s" already exists.'), $key) );
875
- } else */
876
- if( empty($feed_slug) )
877
- {
878
- powerpress_page_message_add_error( sprintf(__('Feed slug "%s" is not valid.', 'powerpress'), esc_html($_POST['feed_slug']) ) );
879
- }
880
- else if( empty($post_type) )
881
- {
882
- powerpress_page_message_add_error( __('Post Type is invalid.', 'powerpress') );
883
- }
884
- // TODO:
885
- //else if( in_array($feed_slug, $wp_rewrite->feeds) && !isset($Settings['custom_feeds'][ $key ]) ) // If it is a system feed or feed created by something else
886
- //{
887
- // powerpress_page_message_add_error( sprintf(__('Feed slug "%s" is not available.', 'powerpress'), $key) );
888
- //}
889
- else
890
- {
891
- $ExistingSettings = powerpress_get_settings('powerpress_posttype_'. $post_type);
892
- if( !empty($ExistingSettings[ $feed_slug ]) )
893
  {
894
- powerpress_page_message_add_error( sprintf(__('Feed slug "%s" already exists.', 'powerpress'), $_POST['feed_slug']) );
895
  }
896
  else
897
  {
898
- $NewSettings = array();
899
- $NewSettings[ $feed_slug ]['title'] = $feed_title;
900
- powerpress_save_settings($NewSettings, 'powerpress_posttype_'. $post_type);
 
901
 
 
 
 
 
 
 
 
 
 
 
 
 
902
 
903
- add_feed($feed_slug, 'powerpress_do_podcast_feed'); // Before we flush the rewrite rules we need to add the new custom feed...
904
- $wp_rewrite->flush_rules();
905
-
906
- powerpress_page_message_add_notice( sprintf(__('Podcast "%s" added, please configure your new podcast.', 'powerpress'), $feed_title) );
907
- $_GET['action'] = 'powerpress-editposttypefeed';
908
- $_GET['feed_slug'] = $feed_slug;
909
- $_GET['podcast_post_type'] = $post_type;
910
  }
911
- }
912
- }; break;
913
- case 'powerpress-ping-sites': {
914
- check_admin_referer('powerpress-ping-sites');
915
-
916
- require_once( POWERPRESS_ABSPATH . '/powerpressadmin-ping-sites.php');
917
- powerpressadmin_ping_sites_process();
918
-
919
- $_GET['action'] = 'powerpress-ping-sites';
920
- }; break;
921
- case 'powerpress-find-replace': {
922
- check_admin_referer('powerpress-find-replace');
923
-
924
- require_once( POWERPRESS_ABSPATH . '/powerpressadmin-find-replace.php');
925
- powerpressadmin_find_replace_process();
926
-
927
- $_GET['action'] = 'powerpress-find-replace';
928
- }; break;
929
- case 'powerpress-importpodpress': {
930
- check_admin_referer('powerpress-import-podpress');
931
-
932
- require_once( POWERPRESS_ABSPATH . '/powerpressadmin-podpress.php');
933
- powerpressadmin_podpress_do_import();
934
-
935
- $_GET['action'] = 'powerpress-podpress-epiosdes';
936
- }; break;
937
- case 'powerpress-importmt': {
938
- check_admin_referer('powerpress-import-mt');
939
-
940
- require_once( POWERPRESS_ABSPATH . '/powerpressadmin-mt.php');
941
- powerpressadmin_mt_do_import();
942
-
943
- $_GET['action'] = 'powerpress-mt-epiosdes';
944
- }; break;
945
- case 'deletepodpressdata': {
946
- check_admin_referer('powerpress-delete-podpress-data');
947
-
948
- require_once( POWERPRESS_ABSPATH . '/powerpressadmin-podpress.php');
949
- powerpressadmin_podpress_delete_data();
950
-
951
- }; break;
952
- case 'powerpress-save-mode': {
953
-
954
- //if( !isset($_POST['General']['advanced_mode']) )
955
- // powerpress_page_message_add_notice( __('You must select a Mode to continue.', 'powerpress') );
956
-
957
- }; break;
958
- }
959
- }
960
-
961
- // Handle GET actions...
962
- if( isset($_GET['action'] ) )
963
- {
964
- switch( $_GET['action'] )
965
- {
966
- case 'powerpress-enable-categorypodcasting': {
967
- check_admin_referer('powerpress-enable-categorypodcasting');
968
-
969
- $Settings = get_option('powerpress_general');
970
- $Settings['cat_casting'] = 1;
971
- powerpress_save_settings($Settings);
972
-
973
- wp_redirect('edit-tags.php?taxonomy=category&message=3');
974
- exit;
975
-
976
- }; break;
977
- case 'powerpress-addcategoryfeed': {
978
- check_admin_referer('powerpress-add-taxonomy-feed');
979
- $cat_ID = intval($_GET['cat']);
980
-
981
- $Settings = get_option('powerpress_general');
982
- $category = get_category($cat_ID);
983
- if( $category == false )
984
- {
985
- powerpress_page_message_add_error( __('Error obtaining category information.', 'powerpress') );
986
- }
987
- else
988
- {
989
- if( empty($Settings['custom_cat_feeds']) || !is_array($Settings['custom_cat_feeds']) )
990
- $Settings['custom_cat_feeds'] = array();
991
 
992
- if( !in_array($cat_ID, $Settings['custom_cat_feeds']) )
 
 
993
  {
994
- $Settings['custom_cat_feeds'][] = $cat_ID;
995
- powerpress_save_settings($Settings);
996
  }
997
-
998
- powerpress_page_message_add_notice( __('Please configure your category podcast feed now.', 'powerpress') );
999
 
1000
- $_GET['action'] = 'powerpress-editcategoryfeed';
1001
- $_GET['cat'] = $cat_ID;
1002
- }
1003
- }; break;
1004
- case 'powerpress-delete-feed': {
1005
- $delete_slug = $_GET['feed_slug'];
1006
- $force_deletion = !empty($_GET['force']);
1007
- check_admin_referer('powerpress-delete-feed-'.$delete_slug);
1008
-
1009
- $Episodes = powerpress_admin_episodes_per_feed($delete_slug);
1010
-
1011
- if( false && $delete_slug == 'podcast' && $force_deletion == false ) // Feature disabled, you can now delete podcast specific settings
1012
- {
1013
- powerpress_page_message_add_error( __('Cannot delete default podcast feed.', 'powerpress') );
1014
- }
1015
- else if( $delete_slug != 'podcast' && $Episodes > 0 && $force_deletion == false )
1016
- {
1017
- powerpress_page_message_add_error( sprintf(__('Cannot delete feed. Feed contains %d episode(s).', 'powerpress'), $Episodes) );
1018
- }
1019
- else
1020
- {
1021
- $Settings = get_option('powerpress_general');
1022
- unset($Settings['custom_feeds'][ $delete_slug ]);
1023
- powerpress_save_settings($Settings); // Delete the feed from the general settings
1024
- delete_option('powerpress_feed_'.$delete_slug); // Delete the actual feed settings
1025
 
1026
- // Now we need to update the rewrite cso the cached rules are up to date
1027
- if ( in_array($delete_slug, $wp_rewrite->feeds))
1028
  {
1029
- $index = array_search($delete_slug, $wp_rewrite->feeds);
1030
- if( $index !== false )
1031
- unset($wp_rewrite->feeds[$index]); // Remove the old feed
1032
  }
1033
-
1034
- // Remove feed function hook
1035
- $hook = 'do_feed_' . $delete_slug;
1036
- remove_action($hook, $hook, 10, 1); // This may not be necessary
1037
- $wp_rewrite->flush_rules(); // This is definitely necessary
1038
 
1039
- powerpress_page_message_add_notice( __('Feed deleted successfully.', 'powerpress') );
1040
- }
1041
- }; break;
1042
- case 'powerpress-delete-category-feed': {
1043
- $cat_ID = intval($_GET['cat']);
1044
- check_admin_referer('powerpress-delete-category-feed-'.$cat_ID);
1045
-
1046
- $Settings = get_option('powerpress_general');
1047
- $key = array_search($cat_ID, $Settings['custom_cat_feeds']);
1048
- if( $key !== false )
1049
- {
1050
- unset( $Settings['custom_cat_feeds'][$key] );
1051
- powerpress_save_settings($Settings); // Delete the feed from the general settings
1052
- }
1053
- delete_option('powerpress_cat_feed_'.$cat_ID); // Delete the actual feed settings
1054
-
1055
- powerpress_page_message_add_notice( __('Removed podcast settings for category feed successfully.', 'powerpress') );
1056
- }; break;
1057
- case 'powerpress-delete-taxonomy-feed': {
1058
- $tt_ID = intval($_GET['ttid']);
1059
- check_admin_referer('powerpress-delete-taxonomy-feed-'.$tt_ID);
1060
-
1061
- $Settings = get_option('powerpress_taxonomy_podcasting');
1062
- if( !empty($Settings[ $tt_ID ]) )
1063
- {
1064
- unset( $Settings[ $tt_ID ] );
1065
- powerpress_save_settings($Settings, 'powerpress_taxonomy_podcasting'); // Delete the feed from the general settings
1066
- }
1067
- delete_option('powerpress_taxonomy_'.$tt_ID); // Delete the actual feed settings
1068
 
1069
- powerpress_page_message_add_notice( __('Removed podcast settings for term successfully.', 'powerpress') );
1070
- }; break;
1071
- case 'powerpress-delete-posttype-feed': {
 
1072
 
1073
- // check admin referer prevents xss
1074
- $feed_slug = esc_attr($_GET['feed_slug']);
1075
- $post_type = esc_attr($_GET['podcast_post_type']);
1076
- check_admin_referer('powerpress-delete-posttype-feed-'.$post_type .'_'.$feed_slug);
1077
-
1078
- $Settings = get_option('powerpress_posttype_'.$post_type);
1079
- if( !empty($Settings[ $feed_slug ]) )
1080
- {
1081
- unset( $Settings[ $feed_slug ] );
1082
- update_option('powerpress_posttype_'.$post_type, $Settings);
1083
- //powerpress_save_settings($Settings, 'powerpress_posttype_'.$post_type); // Delete the feed from the general settings
1084
- }
1085
-
1086
- powerpress_page_message_add_notice( __('Removed podcast settings for post type successfully.', 'powerpress') );
1087
- }; break;
1088
- case 'powerpress-podpress-settings': {
1089
- check_admin_referer('powerpress-podpress-settings');
1090
-
1091
- // Import settings here..
1092
- if( powerpress_admin_import_podpress_settings() )
1093
- powerpress_page_message_add_notice( __('Podpress settings imported successfully.', 'powerpress') );
1094
- else
1095
- powerpress_page_message_add_error( __('No Podpress settings found.', 'powerpress') );
1096
-
1097
- }; break;
1098
- case 'powerpress-podcasting-settings': {
1099
- check_admin_referer('powerpress-podcasting-settings');
1100
-
1101
- // Import settings here..
1102
- if( powerpress_admin_import_podcasting_settings() )
1103
- powerpress_page_message_add_notice( __('Settings imported from the plugin "Podcasting" successfully.', 'powerpress') );
1104
- else
1105
- powerpress_page_message_add_error( __('No settings found for the plugin "Podcasting".', 'powerpress') );
1106
-
1107
- }; break;
1108
- case 'powerpress-add-caps': {
1109
- check_admin_referer('powerpress-add-caps');
1110
-
1111
- $users = array('administrator','editor', 'author'); // , 'contributor', 'subscriber');
1112
- while( list($null,$user) = each($users) )
1113
- {
1114
- $role = get_role($user);
1115
- if( !$role->has_cap('edit_podcast') )
1116
- $role->add_cap('edit_podcast');
1117
- if( $user == 'administrator' && !$role->has_cap('view_podcast_stats') )
1118
- $role->add_cap('view_podcast_stats');
1119
- }
1120
-
1121
- $General = array('use_caps'=>true);
1122
- powerpress_save_settings($General);
1123
- powerpress_page_message_add_notice( __('PowerPress Roles and Capabilities added to WordPress Blog.', 'powerpress') );
1124
-
1125
- }; break;
1126
- case 'powerpress-remove-caps': {
1127
- check_admin_referer('powerpress-remove-caps');
1128
-
1129
- $users = array('administrator','editor', 'author', 'contributor', 'subscriber');
1130
- while( list($null,$user) = each($users) )
1131
- {
1132
- $role = get_role($user);
1133
- if( $role->has_cap('edit_podcast') )
1134
- $role->remove_cap('edit_podcast');
1135
- if( $role->has_cap('view_podcast_stats') )
1136
- $role->remove_cap('view_podcast_stats');
1137
- }
1138
- $General = array('use_caps'=>false);
1139
- powerpress_save_settings($General);
1140
- powerpress_page_message_add_notice( __('PowerPress Roles and Capabilities removed from WordPress Blog', 'powerpress') );
1141
-
1142
- }; break;
1143
- case 'powerpress-add-feed-caps': {
1144
- check_admin_referer('powerpress-add-feed-caps');
1145
-
1146
- $ps_role = get_role('premium_subscriber');
1147
- if(!$ps_role)
1148
- {
1149
- add_role('premium_subscriber', __('Premium Subscriber', 'powerpress'));
1150
  $ps_role = get_role('premium_subscriber');
1151
- $ps_role->add_cap('read');
1152
- $ps_role->add_cap('premium_content');
1153
- }
1154
-
1155
- $users = array('administrator','editor', 'author'); // , 'contributor', 'subscriber');
1156
- while( list($null,$user) = each($users) )
1157
- {
1158
- $role = get_role($user);
1159
- if( !$role->has_cap('premium_content') )
1160
- $role->add_cap('premium_content');
1161
- }
1162
-
1163
- $General = array('premium_caps'=>true);
1164
- powerpress_save_settings($General);
1165
- powerpress_page_message_add_notice( __('Podcast Password Protection Capabilities for Custom Channel Feeds added successfully.', 'powerpress') );
1166
-
1167
- }; break;
1168
- case 'powerpress-remove-feed-caps': {
1169
- check_admin_referer('powerpress-remove-feed-caps');
1170
-
1171
- $users = array('administrator','editor', 'author', 'contributor', 'subscriber', 'premium_subscriber', 'powerpress');
1172
- while( list($null,$user) = each($users) )
1173
- {
1174
- $role = get_role($user);
1175
- if( !empty($role) )
1176
  {
1177
- if( $role->has_cap('premium_content') )
1178
- $role->remove_cap('premium_content');
 
 
1179
  }
1180
- }
1181
-
1182
- remove_role('premium_subscriber');
1183
-
1184
- $General = array('premium_caps'=>false);
1185
- powerpress_save_settings($General);
1186
- powerpress_page_message_add_notice( __('Podcast Password Protection Capabilities for Custom Channel Feeds removed successfully.', 'powerpress') );
1187
-
1188
- }; break;
1189
- case 'powerpress-clear-update_plugins': {
1190
- check_admin_referer('powerpress-clear-update_plugins');
1191
-
1192
- delete_option('update_plugins'); // OLD method
1193
- delete_option('_site_transient_update_plugins'); // New method
1194
- powerpress_page_message_add_notice( sprintf( __('Plugins Update Cache cleared successfully. You may now to go the %s page to see the latest plugin versions.', 'powerpress'), '<a href="'. admin_url() .'plugins.php" title="'. __('Manage Plugins', 'powerpress') .'">'. __('Manage Plugins', 'powerpress') .'</a>') );
1195
-
1196
- }; break;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1197
  }
1198
- }
1199
-
1200
- if( isset($_REQUEST['action']) )
1201
- {
1202
- switch( $_REQUEST['action'] )
1203
  {
1204
- case 'powerpress-migrate-media': {
 
 
 
 
 
1205
 
1206
- require_once( POWERPRESS_ABSPATH . '/powerpressadmin-migrate.php');
1207
- powerpress_admin_migrate_request();
1208
-
1209
- }; break;
1210
  }
1211
  }
1212
 
@@ -1312,6 +1332,8 @@ function powerpress_save_settings($SettingsNew=false, $field = 'powerpress_gener
1312
  unset($Settings['playlist_player']);
1313
  if( isset($Settings['seo_feed_title']) && empty($Settings['seo_feed_title']) )
1314
  unset($Settings['seo_feed_title']);
 
 
1315
  }
1316
  else // Feed or player settings...
1317
  {
@@ -1658,20 +1680,13 @@ function powerpress_edit_post($post_ID, $post)
1658
 
1659
  // Initialize the important variables:
1660
  $MediaURL = $Powerpress['url'];
1661
- if( defined('POWERPRESS_ENABLE_HTTPS_MEDIA') )
1662
- {
1663
- if( !empty($GeneralSettings['default_url']) && strpos($MediaURL, 'http://') !== 0 && strpos($MediaURL, 'https://') !== 0 && empty($Powerpress['hosting']) ) // If the url entered does not start with a http:// or https://
1664
- {
1665
- $MediaURL = rtrim($GeneralSettings['default_url'], '/') .'/'. ltrim($MediaURL, '/');
1666
- }
1667
- }
1668
- else
1669
  {
1670
- if( !empty($GeneralSettings['default_url']) && strpos($MediaURL, 'http://') !== 0 && empty($Powerpress['hosting']) ) // If the url entered does not start with a http://
1671
- {
1672
- $MediaURL = rtrim($GeneralSettings['default_url'], '/') .'/'. ltrim($MediaURL, '/');
1673
- }
1674
  }
 
 
1675
 
1676
  $FileSize = '';
1677
  $ContentType = '';
@@ -2263,29 +2278,6 @@ function powerpress_check_url(url)
2263
  if( x == 5 )
2264
  validChars = validChars.substring(1); // remove the colon, should no longer appear in URLs
2265
  }
2266
-
2267
- <?php
2268
- if( !defined('POWERPRESS_ENABLE_HTTPS_MEDIA') )
2269
- {
2270
- ?>
2271
- if( url.charAt(0) == 'h' && url.charAt(1) == 't' && url.charAt(2) == 't' && url.charAt(3) == 'p' && url.charAt(4) == 's' )
2272
- {
2273
- jQuery( '#'+DestDiv ).html('<?php echo __('PowerPress will not accept media URLs starting with https://.<br />Not all podcatching (podcast downloading) applications support secure http.<br />Please enter a different URL beginning with http://.', 'powerpress'); ?>');
2274
- jQuery( '#'+DestDiv ).css('display', 'block');
2275
- return false;
2276
- }
2277
- <?php
2278
- } else if( POWERPRESS_ENABLE_HTTPS_MEDIA === 'warning' ) {
2279
- ?>
2280
- if( url.charAt(0) == 'h' && url.charAt(1) == 't' && url.charAt(2) == 't' && url.charAt(3) == 'p' && url.charAt(4) == 's' )
2281
- {
2282
- jQuery( '#'+DestDiv ).html('<?php echo __('Media URL should not start with https://.<br />Not all podcatching (podcast downloading) applications support secure http.<br />By using https://, you may limit the size of your audience.', 'powerpress'); ?>');
2283
- jQuery( '#'+DestDiv ).css('display', 'block');
2284
- return false;
2285
- }
2286
- <?php
2287
- }
2288
- ?>
2289
 
2290
  jQuery( '#'+DestDiv ).css('display', 'none');
2291
  return true;
@@ -2580,19 +2572,9 @@ function powerpress_media_info_ajax()
2580
  $duration = '';
2581
  $GeneralSettings = get_option('powerpress_general');
2582
 
2583
- if( !empty($GeneralSettings['default_url']) && defined('POWERPRESS_ENABLE_HTTPS_MEDIA') )
2584
- {
2585
- 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://
2586
- {
2587
- $media_url = rtrim($GeneralSettings['default_url'], '/') .'/'. $media_url;
2588
- }
2589
- }
2590
- else if( !empty($GeneralSettings['default_url']) )
2591
  {
2592
- if( strpos($media_url, 'http://') !== 0 && $hosting != 1 ) // If the url entered does not start with a http://
2593
- {
2594
- $media_url = rtrim($GeneralSettings['default_url'], '/') .'/'. $media_url;
2595
- }
2596
  }
2597
 
2598
  $ContentType = false;
@@ -3137,7 +3119,7 @@ function powerpress_remote_fopen($url, $basic_auth = false, $post_args = array()
3137
  unset($GLOBALS['g_powerpress_remote_error']);
3138
  unset($GLOBALS['g_powerpress_remote_errorno']);
3139
 
3140
- if( function_exists( 'curl_init' ) ) // Preferred method of connecting
3141
  {
3142
  $curl = curl_init();
3143
  curl_setopt($curl, CURLOPT_URL, $url);
@@ -3158,10 +3140,11 @@ function powerpress_remote_fopen($url, $basic_auth = false, $post_args = array()
3158
  curl_setopt($curl, CURLOPT_TIMEOUT, $timeout); // The maximum number of seconds to execute.
3159
  curl_setopt($curl, CURLOPT_USERAGENT, 'Blubrry PowerPress/'.POWERPRESS_VERSION);
3160
  curl_setopt($curl, CURLOPT_FAILONERROR, true);
3161
- if( strtolower(substr($url, 0, 5)) == 'https' )
3162
  {
3163
- curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 2);
3164
- curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0);
 
3165
  }
3166
  // HTTP Authentication
3167
  if( $basic_auth )
@@ -3199,11 +3182,16 @@ function powerpress_remote_fopen($url, $basic_auth = false, $post_args = array()
3199
  {
3200
  $GLOBALS['g_powerpress_remote_error'] = $error_msg;
3201
  $GLOBALS['g_powerpress_remote_errorno'] = $http_code;
 
 
 
 
 
3202
  return false;
3203
  }
3204
  else if( $http_code > 399 )
3205
  {
3206
-
3207
  $GLOBALS['g_powerpress_remote_error'] = "HTTP $http_code";
3208
  $GLOBALS['g_powerpress_remote_errorno'] = $http_code;
3209
  switch( $http_code )
@@ -3215,7 +3203,9 @@ function powerpress_remote_fopen($url, $basic_auth = false, $post_args = array()
3215
  case 404: $GLOBALS['g_powerpress_remote_error'] .= ' '. __("Not Found", 'powerpress'); break;
3216
  }
3217
 
3218
-
 
 
3219
  return false;
3220
  }
3221
  return $content;
@@ -4027,6 +4017,10 @@ function powerpress_get_media_info_local($media_file, $content_type='', $file_si
4027
  }
4028
  }
4029
 
 
 
 
 
4030
  if( $content_type != '' && $file_size == 0 )
4031
  {
4032
  $response = wp_remote_head( $media_file, array('httpversion' => 1.1) );
@@ -4034,25 +4028,25 @@ function powerpress_get_media_info_local($media_file, $content_type='', $file_si
4034
  if( !is_wp_error( $response ) && ($response['response']['code'] == 301 || $response['response']['code'] == 302) )
4035
  {
4036
  $headers = wp_remote_retrieve_headers( $response );
4037
- $response = wp_remote_head( $headers['location'], array('httpversion' => 1.1) );
4038
  }
4039
  // Redirect 2
4040
  if( !is_wp_error( $response ) && ($response['response']['code'] == 301 || $response['response']['code'] == 302) )
4041
  {
4042
  $headers = wp_remote_retrieve_headers( $response );
4043
- $response = wp_remote_head( $headers['location'], array('httpversion' => 1.1) );
4044
  }
4045
  // Redirect 3
4046
  if( !is_wp_error( $response ) && ($response['response']['code'] == 301 || $response['response']['code'] == 302) )
4047
  {
4048
  $headers = wp_remote_retrieve_headers( $response );
4049
- $response = wp_remote_head( $headers['location'], array('httpversion' => 1.1) );
4050
  }
4051
  // Redirect 4
4052
  if( !is_wp_error( $response ) && ($response['response']['code'] == 301 || $response['response']['code'] == 302) )
4053
  {
4054
  $headers = wp_remote_retrieve_headers( $response );
4055
- $response = wp_remote_head( $headers['location'], array('httpversion' => 1.1) );
4056
  }
4057
 
4058
  if ( is_wp_error( $response ) )
13
  return esc_html($escape);
14
  }
15
 
16
+ function powerpress_page_message_add_error($msg, $classes='inline', $escape=true)
17
  {
18
  global $g_powerpress_page_message;
19
+ if( $escape )
20
+ $g_powerpress_page_message .= '<div class="error powerpress-error '.$classes.'">'. esc_html($msg) . '</div>';
21
+ else
22
+ $g_powerpress_page_message .= '<div class="error powerpress-error '.$classes.'">'. ($msg) . '</div>';
23
  }
24
 
25
+ function powerpress_page_message_add_notice($msg, $classes='inline', $escape=true)
26
  {
27
  global $g_powerpress_page_message;
28
  // Always pre-pend, since jQuery will re-order with first as last.
29
+ if( $escape )
30
+ $g_powerpress_page_message = '<div class="updated fade powerpress-notice '.$classes.'">'. esc_html($msg) . '</div>' . $g_powerpress_page_message;
31
+ else
32
+ $g_powerpress_page_message = '<div class="updated fade powerpress-notice '.$classes.'">'. ($msg) . '</div>' . $g_powerpress_page_message;
33
  }
34
 
35
 
112
  if( isset($GLOBALS['objWPOSFLV']) && is_object($GLOBALS['objWPOSFLV']) )
113
  powerpress_page_message_add_error( __('The WP OS FLV plugin is not compatible with Blubrry PowerPress.', 'powerpress') );
114
 
115
+ // Security step, we must be in a powerpress/* page...
116
+ if( isset($_GET['page']) && strstr($_GET['page'], 'powerpress/' ) !== false )
117
  {
118
+ // Save settings here
119
+ if( isset($_POST[ 'Feed' ]) || isset($_POST[ 'General' ]) )
 
 
 
 
120
  {
121
+ check_admin_referer('powerpress-edit');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
122
 
123
+ $upload_path = false;
124
+ $upload_url = false;
125
+ $UploadArray = wp_upload_dir();
126
+ if( false === $UploadArray['error'] )
127
  {
128
+ $upload_path = $UploadArray['basedir'].'/powerpress/';
129
+ $upload_url = $UploadArray['baseurl'].'/powerpress/';
 
 
 
 
 
130
  }
131
+
132
+ // Save the posted value in the database
133
+ $Feed = (isset($_POST['Feed'])?$_POST['Feed']:false);
134
+ $General = (isset($_POST['General'])?$_POST['General']:false);
135
+ $FeedSlug = (isset($_POST['feed_slug'])?esc_attr($_POST['feed_slug']):false);
136
+ $Category = (isset($_POST['cat'])?intval($_POST['cat']):false);
137
+ $term_taxonomy_id = (isset($_POST['ttid'])?intval($_POST['ttid']):false);
138
+ $podcast_post_type = (isset($_POST['podcast_post_type'])?esc_attr($_POST['podcast_post_type']):false);
139
 
140
+ // New iTunes image
141
+ if( !empty($_POST['itunes_image_checkbox']) )
142
  {
143
+ $filename = str_replace(" ", "_", basename($_FILES['itunes_image_file']['name']) );
144
+ $temp = $_FILES['itunes_image_file']['tmp_name'];
145
 
146
+ if( file_exists($upload_path . $filename ) )
 
147
  {
148
+ $filenameParts = pathinfo($filename);
149
+ if( !empty($filenameParts['extension']) ) {
150
+ do {
151
+ $filename_no_ext = substr($filenameParts['basename'], 0, (strlen($filenameParts['extension'])+1) * -1 );
152
+ $filename = sprintf('%s-%03d.%s', $filename_no_ext, rand(0, 999), $filenameParts['extension'] );
153
+ } while( file_exists($upload_path . $filename ) );
 
154
  }
155
  }
156
 
157
+ // Check the image...
158
+ if( file_exists($temp) )
 
 
159
  {
160
+ $ImageData = @getimagesize($temp);
161
+
162
+ $rgb = true; // We assume it is RGB
163
+ if( defined('POWERPRESS_IMAGICK') && POWERPRESS_IMAGICK )
164
  {
165
+ if( $ImageData[2] == IMAGETYPE_PNG && extension_loaded('imagick') )
166
  {
167
+ $image = new Imagick( $temp );
168
+ if( $image->getImageColorspace() != imagick::COLORSPACE_RGB )
 
 
 
 
169
  {
170
+ $rgb = false;
171
  }
 
 
 
 
 
172
  }
173
  }
174
+
175
+ if( empty($ImageData['channels']) )
176
+ $ImageData['channels'] = 3; // Assume it's ok if we cannot detect it.
177
+
178
+ if( $ImageData )
179
  {
180
+ if( $rgb && ( $ImageData[2] == IMAGETYPE_JPEG || $ImageData[2] == IMAGETYPE_PNG ) && $ImageData[0] == $ImageData[1] && $ImageData[0] >= 1400 && $ImageData[0] <= 3000 && $ImageData['channels'] == 3 ) // Just check that it is an image, the correct image type and that the image is square
181
+ {
182
+ if( !move_uploaded_file($temp, $upload_path . $filename) )
183
+ {
184
+ powerpress_page_message_add_error( __('Error saving iTunes image', 'powerpress') .': ' . htmlspecialchars($_FILES['itunes_image_file']['name']) .' - '. __('An error occurred saving the iTunes image on the server.', 'powerprss'). ' '. sprintf(__('Local folder: %s; File name: %s', 'powerpress'), $upload_path, $filename) );
185
+ }
186
+ else
187
+ {
188
+ $Feed['itunes_image'] = $upload_url . $filename;
189
+ if( !empty($_POST['itunes_image_checkbox_as_rss']) )
190
+ {
191
+ $Feed['rss2_image'] = $upload_url . $filename;
192
+ }
193
+
194
+ //if( $ImageData[0] < 1400 || $ImageData[1] < 1400 )
195
+ //{
196
+ // powerpress_page_message_add_error( __('iTunes image warning', 'powerpress') .': '. htmlspecialchars($_FILES['itunes_image_file']['name']) . __(' is', 'powerpress') .' '. $ImageData[0] .' x '.$ImageData[0] .' - '. __('Image must be square 1400 x 1400 pixels or larger.', 'powerprss') );
197
+ //}
198
+ }
199
+ }
200
+ else if( $ImageData['channels'] != 3 || $rgb == false )
201
+ {
202
+ powerpress_page_message_add_error( __('Invalid iTunes image', 'powerpress') .': ' . htmlspecialchars($_FILES['itunes_image_file']['name']) .' - '. __('Image must be in RGB color space (CMYK is not supported).', 'powerprss') );
203
+ }
204
+ else if( $ImageData[0] != $ImageData[1] )
205
+ {
206
+ powerpress_page_message_add_error( __('Invalid iTunes image', 'powerpress') .': ' . htmlspecialchars($_FILES['itunes_image_file']['name']) .' - '. __('Image must be square, 1400 x 1400 is the required minimum size.', 'powerprss') );
207
+ }
208
+ else if( $ImageData[0] != $ImageData[1] || $ImageData[0] < 1400 )
209
+ {
210
+ powerpress_page_message_add_error( __('Invalid iTunes image', 'powerpress') .': ' . htmlspecialchars($_FILES['itunes_image_file']['name']) .' - '. __('Image is too small, 1400 x 1400 is the required minimum size.', 'powerprss') );
211
+ }
212
+ else if( $ImageData[0] != $ImageData[1] || $ImageData[0] > 3000 )
213
+ {
214
+ powerpress_page_message_add_error( __('Invalid iTunes image', 'powerpress') .': ' . htmlspecialchars($_FILES['itunes_image_file']['name']) .' - '. __('Image is too large, 3000 x 3000 is the maximum size allowed.', 'powerprss') );
215
+ }
216
+ else
217
+ {
218
+ powerpress_page_message_add_error( __('Invalid iTunes image', 'powerpress') .': ' . htmlspecialchars($_FILES['itunes_image_file']['name']) );
219
+ }
220
  }
221
+ else
222
  {
223
+ powerpress_page_message_add_error( __('Invalid iTunes image', 'powerpress') .': ' . htmlspecialchars($_FILES['itunes_image_file']['name']) );
224
  }
225
+ }
226
+ }
227
+
228
+ // New RSS2 image
229
+ if( !empty($_POST['rss2_image_checkbox']) )
230
+ {
231
+ $filename = str_replace(" ", "_", basename($_FILES['rss2_image_file']['name']) );
232
+ $temp = $_FILES['rss2_image_file']['tmp_name'];
233
+
234
+ if( file_exists($upload_path . $filename ) )
235
+ {
236
+ $filenameParts = pathinfo($filename);
237
+ if( !empty($filenameParts['basename']) && !empty($filenameParts['extension']) )
238
  {
239
+ do {
240
+ $filename_no_ext = substr($filenameParts['basename'], 0, (strlen($filenameParts['extension'])+1) * -1 );
241
+ $filename = sprintf('%s-%03d.%s', $filename_no_ext, rand(0, 999), $filenameParts['extension'] );
242
+ } while( file_exists($upload_path . $filename ) );
243
  }
244
+ }
245
+
246
+ if( @getimagesize($temp) ) // Just check that it is an image, we may add more to this later
247
+ {
248
+ if( !move_uploaded_file($temp, $upload_path . $filename) )
249
  {
250
+ powerpress_page_message_add_error( __('Error saving RSS image', 'powerpress') .': ' . htmlspecialchars($_FILES['itunes_image_file']['name']) .' - '. __('An error occurred saving the RSS image on the server.', 'powerprss'). ' '. sprintf(__('Local folder: %s; File name: %s', 'powerpress'), $upload_path, $filename) );
251
  }
252
  else
253
  {
254
+ $Feed['rss2_image'] = $upload_url . $filename;
255
  }
256
  }
257
  else
258
  {
259
+ powerpress_page_message_add_error( __('Invalid RSS image', 'powerpress') .': '. htmlspecialchars($_FILES['rss2_image_file']['name']) );
260
  }
261
  }
 
 
 
 
 
 
 
262
 
263
+ // New mp3 coverart image
264
+ if( !empty($_POST['coverart_image_checkbox']) )
265
  {
266
+ $filename = str_replace(" ", "_", basename($_FILES['coverart_image_file']['name']) );
267
+ $temp = $_FILES['coverart_image_file']['tmp_name'];
268
+
269
+ if( file_exists($upload_path . $filename ) )
270
  {
271
+ $filenameParts = pathinfo($filename);
272
  do {
273
  $filename_no_ext = substr($filenameParts['basename'], 0, (strlen($filenameParts['extension'])+1) * -1 );
274
  $filename = sprintf('%s-%03d.%s', $filename_no_ext, rand(0, 999), $filenameParts['extension'] );
275
  } while( file_exists($upload_path . $filename ) );
276
  }
277
+
278
+ if( @getimagesize($temp) ) // Just check that it is an image, we may add more to this later
 
 
 
279
  {
280
+ if( !move_uploaded_file($temp, $upload_path . $filename) )
281
+ {
282
+ powerpress_page_message_add_error( __('Error saving Coverart image', 'powerpress') .': ' . htmlspecialchars($_FILES['itunes_image_file']['name']) .' - '. __('An error occurred saving the coverart image on the server.', 'powerprss'). ' '. sprintf(__('Local folder: %s; File name: %s', 'powerpress'), $upload_path, $filename) );
283
+ }
284
+ else
285
+ {
286
+ $_POST['TagValues']['tag_coverart'] = $upload_url . $filename;
287
+ $General['tag_coverart'] = $upload_url . $filename;
288
+ }
289
  }
290
  else
291
  {
292
+ powerpress_page_message_add_error( __('Invalid Coverat image', 'powerpress') .': ' . htmlspecialchars($_FILES['coverart_image_file']['name']) );
293
  }
294
  }
 
 
 
 
 
 
 
 
 
 
 
295
 
296
+ // New poster image
297
+ if( !empty($_POST['poster_image_checkbox']) )
298
  {
299
+ $filename = str_replace(" ", "_", basename($_FILES['poster_image_file']['name']) );
300
+ $temp = $_FILES['poster_image_file']['tmp_name'];
301
+
302
+ if( file_exists($upload_path . $filename ) )
 
 
 
 
 
 
303
  {
304
+ $filenameParts = pathinfo($filename);
305
+ do {
306
+ $filename_no_ext = substr($filenameParts['basename'], 0, (strlen($filenameParts['extension'])+1) * -1 );
307
+ $filename = sprintf('%s-%03d.%s', $filename_no_ext, rand(0, 999), $filenameParts['extension'] );
308
+ } while( file_exists($upload_path . $filename ) );
309
+ }
310
+
311
+ if( @getimagesize($temp) ) // Just check that it is an image, we may add more to this later
312
+ {
313
+ if( !move_uploaded_file($temp, $upload_path . $filename) )
314
+ {
315
+ powerpress_page_message_add_error( __('Error saving Poster image', 'powerpress') .': ' . htmlspecialchars($_FILES['itunes_image_file']['name']) .' - '. __('An error occurred saving the poster image on the server.', 'powerprss'). ' '. sprintf(__('Local folder: %s; File name: %s', 'powerpress'), $upload_path, $filename) );
316
+ }
317
+ else
318
+ {
319
+ $General['poster_image'] = $upload_url . $filename;
320
+ }
321
  }
322
  else
323
  {
324
+ powerpress_page_message_add_error( __('Invalid poster image', 'powerpress') .': ' . htmlspecialchars($_FILES['poster_image_file']['name']) );
 
325
  }
326
  }
 
 
 
 
 
 
 
 
 
 
 
327
 
 
 
 
 
 
 
 
 
328
 
329
+ // New audio play icon image
330
+ if( !empty($_POST['audio_custom_play_button_checkbox']) )
331
  {
332
+ $filename = str_replace(" ", "_", basename($_FILES['audio_custom_play_button_file']['name']) );
333
+ $temp = $_FILES['audio_custom_play_button_file']['tmp_name'];
334
+
335
+ if( file_exists($upload_path . $filename ) )
336
+ {
337
+ $filenameParts = pathinfo($filename);
338
+ do {
339
+ $filename_no_ext = substr($filenameParts['basename'], 0, (strlen($filenameParts['extension'])+1) * -1 );
340
+ $filename = sprintf('%s-%03d.%s', $filename_no_ext, rand(0, 999), $filenameParts['extension'] );
341
+ } while( file_exists($upload_path . $filename ) );
342
+ }
343
+
344
+ if( @getimagesize($temp) ) // Just check that it is an image, we may add more to this later
345
  {
346
+ if( !move_uploaded_file($temp, $upload_path . $filename) )
347
+ {
348
+ powerpress_page_message_add_error( __('Error saving Play image', 'powerpress') .': ' . htmlspecialchars($_FILES['itunes_image_file']['name']) .' - '. __('An error occurred saving the play image on the server.', 'powerprss'). ' '. sprintf(__('Local folder: %s; File name: %s', 'powerpress'), $upload_path, $filename) );
349
+ }
350
+ else
351
+ {
352
+ $General['audio_custom_play_button'] = $upload_url . $filename;
353
+ }
354
  }
355
  else
356
  {
357
+ powerpress_page_message_add_error( __('Invalid play icon image', 'powerpress') .': ' . htmlspecialchars($_FILES['audio_custom_play_button_file']['name']) );
358
  }
359
  }
 
 
 
 
 
 
 
 
 
 
 
 
360
 
361
+ // New video play icon image
362
+ if( !empty($_POST['video_custom_play_button_checkbox']) )
363
  {
364
+ $filename = str_replace(" ", "_", basename($_FILES['video_custom_play_button_file']['name']) );
365
+ $temp = $_FILES['video_custom_play_button_file']['tmp_name'];
366
+
367
+ if( file_exists($upload_path . $filename ) )
 
 
 
 
 
 
368
  {
369
+ $filenameParts = pathinfo($filename);
370
+ do {
371
+ $filename_no_ext = substr($filenameParts['basename'], 0, (strlen($filenameParts['extension'])+1) * -1 );
372
+ $filename = sprintf('%s-%03d.%s', $filename_no_ext, rand(0, 999), $filenameParts['extension'] );
373
+ } while( file_exists($upload_path . $filename ) );
374
  }
375
+
376
+ $imageInfo = @getimagesize($temp);
377
+ if( $imageInfo && $imageInfo[0] == $imageInfo[1] && $imageInfo[0] == 60 ) // Just check that it is an image, we may add more to this later
378
  {
379
+ if( !move_uploaded_file($temp, $upload_path . $filename) )
380
+ {
381
+ powerpress_page_message_add_error( __('Error saving Video Play icon image', 'powerpress') .': ' . htmlspecialchars($_FILES['itunes_image_file']['name']) .' - '. __('An error occurred saving the Video Play icon image on the server.', 'powerprss'). ' '. sprintf(__('Local folder: %s; File name: %s', 'powerpress'), $upload_path, $filename) );
382
+ }
383
+ else
384
+ {
385
+ $General['video_custom_play_button'] = $upload_url . $filename;
386
+ }
387
  }
388
+ else if( $imageInfo )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
389
  {
390
+ powerpress_page_message_add_error( __('Invalid play icon image size', 'powerpress') .': ' . htmlspecialchars($_FILES['video_custom_play_button_file']['name']) );
391
  }
392
  else
393
  {
394
+ powerpress_page_message_add_error( __('Invalid play icon image', 'powerpress') .': ' . htmlspecialchars($_FILES['video_custom_play_button_file']['name']) );
395
  }
396
  }
397
+
398
+ if( isset($_POST['UpdateDisablePlayer']) )
 
 
 
399
  {
400
+ $player_feed_slug = $_POST['UpdateDisablePlayer'];
401
+ $General['disable_player'] = array();
402
+ $GeneralPrev = get_option('powerpress_general');
403
+ if( isset($GeneralPrev['disable_player']) )
404
+ $General['disable_player'] = $GeneralPrev['disable_player'];
405
+ if( isset($_POST['DisablePlayerFor']) )
406
+ $General['disable_player'][ $player_feed_slug ] = 1;
407
+ else
408
+ unset($General['disable_player'][ $player_feed_slug ]);
409
  }
410
+
411
+ // Check to see if we need to update the feed title
412
+ if( $FeedSlug && !$podcast_post_type )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
413
  {
414
+ $GeneralSettingsTemp = powerpress_get_settings('powerpress_general', false);
415
+ if( !isset($GeneralSettingsTemp['custom_feeds'][$FeedSlug]) || $GeneralSettingsTemp['custom_feeds'][$FeedSlug] != $Feed['title'] )
416
+ {
417
+ if( !$General )
418
+ $General = array();
419
+ if( !empty($GeneralSettingsTemp['custom_feeds']) )
420
+ $General['custom_feeds'] = $GeneralSettingsTemp['custom_feeds'];
421
+ else
422
+ $General['custom_feeds'] = array();
423
+ $General['custom_feeds'][$FeedSlug] = $Feed['title'];
424
+ }
425
  }
426
+
427
+ // Update the settings in the database:
428
+ if( $General )
 
 
 
429
  {
430
+ if( !empty($_POST['action']) && $_POST['action'] == 'powerpress-save-settings' )
431
+ {
432
+ if( !isset($General['display_player_excerpt']) ) // If we are modifying appearance settings but this option was not checked...
433
+ $General['display_player_excerpt'] = 0; // Set it to zero.
 
 
 
 
 
 
 
434
 
435
+ //if( !isset($General['display_player_disable_mobile']) )
436
+ // $General['display_player_disable_mobile'] = 0;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
437
 
438
+ $General['disable_dashboard_stats'] = 0;
439
+ if( !empty($_POST['DisableStatsInDashboard'] ) )
440
+ $General['disable_dashboard_stats'] = 1;
441
+ if( !isset($General['disable_dashboard_news'] ) )
442
+ $General['disable_dashboard_news'] = 0;
443
+
444
+ if( !isset($General['episode_box_mode']) ) // Default not set, 1 = no duration/file size, 2 = yes duration/file size (default if not set)
445
+ $General['episode_box_mode'] = 1; // 1 = no duration/file size (unchecked)
446
+ if( !isset($General['episode_box_embed'] ) )
447
+ $General['episode_box_embed'] = 0;
448
+ if( !isset($General['embed_replace_player'] ) )
449
+ $General['embed_replace_player'] = 0;
450
+ if( !isset($General['episode_box_no_player'] ) )
451
+ $General['episode_box_no_player'] = 0;
452
+ if( !isset($General['episode_box_no_links'] ) )
453
+ $General['episode_box_no_links'] = 0;
454
+ if( !isset($General['episode_box_no_player_and_links'] ) )
455
+ $General['episode_box_no_player_and_links'] = 0;
456
+ if( !isset($General['episode_box_cover_image'] ) )
457
+ $General['episode_box_cover_image'] = 0;
458
+ if( !isset($General['episode_box_player_size'] ) )
459
+ $General['episode_box_player_size'] = 0;
460
+ if( !isset($General['episode_box_subtitle'] ) )
461
+ $General['episode_box_subtitle'] = 0;
462
+ if( !isset($General['episode_box_summary'] ) )
463
+ $General['episode_box_summary'] = 0;
464
+ if( !isset($General['episode_box_author'] ) )
465
+ $General['episode_box_author'] = 0;
466
+ if( !isset($General['episode_box_explicit'] ) )
467
+ $General['episode_box_explicit'] = 0;
468
+ if( !isset($General['episode_box_closed_captioned'] ) )
469
+ $General['episode_box_closed_captioned'] = 0;
470
+ if( !isset($General['episode_box_itunes_image'] ) )
471
+ $General['episode_box_itunes_image'] = 0;
472
+
473
+ if( !isset($General['episode_box_order'] ) )
474
+ $General['episode_box_order'] = 0;
475
+
476
+ if( !isset($General['episode_box_feature_in_itunes'] ) )
477
+ $General['episode_box_feature_in_itunes'] = 0;
478
+ else
479
+ $General['episode_box_order'] = 0;
480
+
481
+ if( !isset($General['allow_feed_comments'] ) )
482
+ $General['allow_feed_comments'] = 0;
483
+
484
+ if( !isset($General['feed_links']) )
485
+ $General['feed_links'] = 0;
486
 
487
+ // Advanced Features
488
+ if( !isset($General['player_options'] ) )
489
+ $General['player_options'] = 0;
490
+ if( !isset($General['cat_casting'] ) )
491
+ $General['cat_casting'] = 0;
492
+ if( !isset($General['channels'] ) )
493
+ $General['channels'] = 0;
494
+ if( !isset($General['taxonomy_podcasting'] ) )
495
+ $General['taxonomy_podcasting'] = 0;
496
+ if( !isset($General['posttype_podcasting'] ) )
497
+ $General['posttype_podcasting'] = 0;
498
+ if( !isset($General['playlist_player'] ) )
499
+ $General['playlist_player'] = 0;
500
+ if( !isset($General['metamarks'] ) )
501
+ $General['metamarks'] = 0;
502
+
503
+
504
+ // Media Presentation Settings
505
+ $PlayerSettings = array();
506
+ if( !empty($_POST['PlayerSettings']) )
507
+ $PlayerSettings = $_POST['PlayerSettings'];
508
+ if( empty($PlayerSettings['display_pinw']) )
509
+ $PlayerSettings['display_pinw'] = 0;
510
+ if( empty($PlayerSettings['display_media_player']) )
511
+ $PlayerSettings['display_media_player'] = 0;
512
+ if( empty($PlayerSettings['display_pinw']) ) $PlayerSettings['display_pinw'] = 0;
513
+ if( empty($PlayerSettings['display_media_player']) ) $PlayerSettings['display_media_player'] = 0;
514
 
515
+ $General['player_function'] = abs( $PlayerSettings['display_pinw'] - $PlayerSettings['display_media_player'] );
516
+ $General['podcast_link'] = 0;
517
+ if( !empty($PlayerSettings['display_download']) )
518
+ {
519
+ $General['podcast_link'] = 1;
520
+ if( !empty($PlayerSettings['display_download_size']) )
521
+ {
522
+ $General['podcast_link'] = 2;
523
+ if( !empty($PlayerSettings['display_download_duration']) )
524
+ $General['podcast_link'] = 3;
525
+ }
526
+ }
 
 
 
 
 
 
527
 
528
+ if( !isset($General['podcast_embed'] ) )
529
+ $General['podcast_embed'] = 0;
530
+ if( !isset($General['podcast_embed_in_feed'] ) )
531
+ $General['podcast_embed_in_feed'] = 0;
532
+ if( !isset($General['m4a'] ) )
533
+ $General['m4a'] = '';
534
+ if( !isset($General['new_window_nofactor'] ) )
535
+ $General['new_window_nofactor'] = '';
536
+
537
+ if( !isset($General['subscribe_links'] ) )
538
+ $General['subscribe_links'] = false;
539
+ if( !isset($General['subscribe_feature_email'] ) )
540
+ $General['subscribe_feature_email'] = false;
541
+ }
542
+ else if( !empty($_POST['action']) && $_POST['action'] == 'powerpress-save-defaults' )
543
+ {
544
+ if( !isset($General['display_player_excerpt']) ) // If we are modifying appearance settings but this option was not checked...
545
+ $General['display_player_excerpt'] = 0; // Set it to zero.
546
+ $General['disable_dashboard_stats'] = 0;
547
+ if( !empty($_POST['DisableStatsInDashboard'] ) )
548
+ $General['disable_dashboard_stats'] = 1;
549
 
550
+ // Advanced Mode options
551
+ if( !isset($General['cat_casting'] ) )
552
+ $General['cat_casting'] = 0;
553
+ if( !isset($General['channels'] ) )
554
+ $General['channels'] = 0;
555
+ if( !isset($General['taxonomy_podcasting'] ) )
556
+ $General['taxonomy_podcasting'] = 0;
557
+ if( !isset($General['posttype_podcasting'] ) )
558
+ $General['posttype_podcasting'] = 0;
559
+ if( !isset($General['metamarks'] ) )
560
+ $General['metamarks'] = 0;
561
+ }
562
+
563
+ if( !empty($_POST['action']) && $_POST['action'] == 'powerpress-save-search' )
564
+ {
565
+ //$PowerPressSearch = $_POST['PowerPressSearch'];
566
+ $PowerPressSearchToggle = $_POST['PowerPressSearchToggle'];
567
+ if( empty($PowerPressSearchToggle['seo_feed_title']) )
568
+ $General['seo_feed_title'] = 0;
569
+ }
570
 
571
+ if( !empty($_POST['action']) && $_POST['action'] == 'powerpress-save-tags' )
 
 
572
  {
573
+ if( !isset($General['write_tags']) ) // If we are modifying appearance settings but this option was not checked...
574
+ $General['write_tags'] = 0; // Set it to zero.
575
+
576
+ $TagValues = $_POST['TagValues'];
577
+ $GeneralPosted = $_POST['General'];
578
+
579
+ if( !empty($_POST['PowerPressTrackNumber']) ) {
580
+ update_option('powerpress_track_number', $_POST['PowerPressTrackNumber']);
581
+ }
582
+ // Set all the tag values...
583
+ while( list($key,$value) = each($GeneralPosted) )
584
+ {
585
+ if( substr($key, 0, 4) == 'tag_' )
586
+ {
587
+ // Special case, we are uploading new coverart image
588
+ if( !empty($_POST['coverart_image_checkbox']) && $key == 'tag_coverart' )
589
+ continue;
590
+
591
+ // Specail case, the track is saved in a separate column in the database.
592
+ if( $key == 'tag_track' )
593
+ continue;
594
+
595
+ if( !empty($value) )
596
+ $General[$key] = $TagValues[$key];
597
+ else
598
+ $General[$key] = '';
599
+ }
600
+ }
601
+
602
+ if( !empty($General['tag_coverart']) ) // $TagValues['tag_coverart'] != '' )
603
  {
604
+ $GeneralSettingsTemp = powerpress_get_settings('powerpress_general', false);
605
+ if( !empty($GeneralSettingsTemp['blubrry_hosting']) && $GeneralSettingsTemp['blubrry_hosting'] !== 'false' )
606
+ {
607
+ $json_data = false;
608
+ $api_url_array = powerpress_get_api_array();
609
+ while( list($index,$api_url) = each($api_url_array) )
610
+ {
611
+ $req_url = sprintf('%s/media/%s/coverart.json?url=%s', rtrim($api_url, '/'), $GeneralSettingsTemp['blubrry_program_keyword'], urlencode($TagValues['tag_coverart']) );
612
+ $req_url .= (defined('POWERPRESS_BLUBRRY_API_QSA')?'&'. POWERPRESS_BLUBRRY_API_QSA:'');
613
+ $json_data = powerpress_remote_fopen($req_url, $GeneralSettingsTemp['blubrry_auth']);
614
+ if( $json_data != false )
615
+ break;
616
+ }
617
+ // Lets try to cache the image onto Blubrry's Server...
618
+ $results = powerpress_json_decode($json_data);
619
+
620
+ if( is_array($results) && !isset($results['error']) )
621
+ {
622
+ // Good!
623
+ powerpress_page_message_add_notice( __('Coverart image updated successfully.', 'powerpress') );
624
+ }
625
+ else if( isset($results['error']) )
626
+ {
627
+ $error = __('Blubrry Hosting Error (updating coverart)', 'powerpress') .': '. $results['error'];
628
+ powerpress_page_message_add_error($error);
629
+ }
630
+ else
631
+ {
632
+ $error = __('An error occurred updating the coverart with your Blubrry Services Account.', 'powerpress');
633
+ powerpress_page_message_add_error($error);
634
+ }
635
+ }
636
+ else
637
+ {
638
+ powerpress_page_message_add_error( __('Coverart Image was not uploaded to your Blubrry Services Account. It will NOT be added to your mp3s.', 'powerpress') );
639
+ }
640
  }
641
  }
642
 
643
+ if( !empty($_POST['action']) && $_POST['action'] == 'powerpress-save-videocommon' )
644
+ {
645
+ if( !isset($General['poster_play_image'] ) )
646
+ $General['poster_play_image'] = 0;
647
+ if( !isset($General['poster_image_audio'] ) )
648
+ $General['poster_image_audio'] = 0;
649
+ }
650
+
651
+ // Wordpress adds slashes to everything, but since we're storing everything serialized, lets remove them...
652
+ $General = powerpress_stripslashes($General);
653
+ powerpress_save_settings($General);
654
+ }
655
+
656
+ if( $Feed )
657
+ {
658
+ if( !isset($_POST['ProtectContent']) && isset($Feed['premium']) )
659
+ $Feed['premium'] = false;
660
+ if( !isset($Feed['enhance_itunes_summary']) )
661
+ $Feed['enhance_itunes_summary'] = false;
662
+ if( !isset($Feed['itunes_author_post']) )
663
+ $Feed['itunes_author_post'] = false;
664
 
665
+ if( !isset($Feed['itunes_block']) )
666
+ $Feed['itunes_block'] = false;
667
+ if( !isset($Feed['itunes_complete']) )
668
+ $Feed['itunes_complete'] = false;
669
+ if( !isset($Feed['maximize_feed']) )
670
+ $Feed['maximize_feed'] = false;
671
+ if( !isset($Feed['episode_itunes_image']) )
672
+ $Feed['episode_itunes_image'] = false;
673
+
674
+
675
+ $Feed = powerpress_stripslashes($Feed);
676
+ if( $Category )
677
+ {
678
+ powerpress_save_settings($Feed, 'powerpress_cat_feed_'.$Category);
679
+ }
680
+ else if ( $term_taxonomy_id )
681
+ {
682
+ powerpress_save_settings($Feed, 'powerpress_taxonomy_'.$term_taxonomy_id);
683
+ }
684
+ else if( $podcast_post_type )
685
+ {
686
+ $PostTypeSettings = array();
687
+ $PostTypeSettings[ $FeedSlug ] = $Feed;
688
+ powerpress_save_settings($PostTypeSettings, 'powerpress_posttype_'.$podcast_post_type);
689
+ powerpress_rebuild_posttype_podcasting();
690
+ }
691
+ else // otherwise treat as a podcast channel
692
+ {
693
+ if( $FeedSlug == false && get_option('powerpress_feed_podcast') ) // If the settings were moved to the podcast channels feature...
694
+ powerpress_save_settings($Feed, 'powerpress_feed_podcast' ); // save a copy here if that is the case.
695
 
696
+ powerpress_save_settings($Feed, 'powerpress_feed'.($FeedSlug?'_'.$FeedSlug:'') );
697
+ }
698
  }
699
+
700
+ if( isset($_POST['EpisodeBoxBGColor']) )
701
  {
702
+ $GeneralSettingsTemp = get_option('powerpress_general');
703
+ $SaveEpisdoeBoxBGColor['episode_box_background_color'] = array();
704
+ if( isset($GeneralSettingsTemp['episode_box_background_color']) )
705
+ $SaveEpisdoeBoxBGColor['episode_box_background_color'] = $GeneralSettingsTemp['episode_box_background_color']; // copy previous settings
 
706
 
707
+ list($feed_slug_temp, $background_color) = each($_POST['EpisodeBoxBGColor']);
708
+ $SaveEpisdoeBoxBGColor['episode_box_background_color'][ $feed_slug_temp ] = $background_color;
709
+ powerpress_save_settings($SaveEpisdoeBoxBGColor);
 
 
 
 
 
 
 
 
710
  }
711
 
712
+ // Anytime settings are saved lets flush the rewrite rules
713
+ $wp_rewrite->flush_rules();
714
+
715
+ // Settings saved successfully
716
+ if( !empty($_POST['action']) )
717
  {
718
+ switch( $_POST['action'] )
719
+ {
720
+ case 'powerpress-save-settings':
721
+ case 'powerpress-save-defaults': {
722
+ powerpress_page_message_add_notice( __('Blubrry PowerPress settings saved.', 'powerpress') );
723
+ }; break;
724
+ case 'powerpress-save-channel': {
725
+ powerpress_page_message_add_notice( __('Blubrry PowerPress Channel settings saved.', 'powerpress') );
726
+ }; break;
727
+ case 'powerpress-save-category': {
728
+ powerpress_page_message_add_notice( __('Blubrry PowerPress Category Podcasting settings saved.', 'powerpress') );
729
+ }; break;
730
+ case 'powerpress-save-ttid': {
731
+ powerpress_page_message_add_notice( __('Blubrry PowerPress Taxonomy Podcasting settings saved.', 'powerpress') );
732
+ }; break;
733
+ case 'powerpress-save-post_type': {
734
+ powerpress_page_message_add_notice( __('Blubrry PowerPress Post Type Podcasting settings saved.', 'powerpress') );
735
+ }; break;
736
+ case 'powerpress-save-tags': {
737
+ $General = get_option('powerpress_general');
738
+ if( empty($General['blubrry_hosting']) || $General['blubrry_hosting'] === 'false' )
739
+ powerpress_page_message_add_notice( __('ATTENTION: You must configure your Blubrry Services in the Blubrry PowerPress &gt; Basic Settings page in order to utilize this feature.', 'powerpress') );
740
+ else
741
+ powerpress_page_message_add_notice( __('Blubrry PowerPress MP3 Tag settings saved.', 'powerpress') );
742
+ }; break;
743
+ default: {
744
+ powerpress_page_message_add_notice( __('Blubrry PowerPress settings saved.', 'powerpress') );
745
+ }; break;
746
+ }
747
  }
748
+ }
749
+
750
+ // Handle POST actions...
751
+ if( isset($_POST['action'] ) )
752
+ {
753
+ switch($_POST['action'])
754
  {
755
+ case 'powerpress-addfeed': {
756
+ check_admin_referer('powerpress-add-feed');
757
 
758
+ $Settings = get_option('powerpress_general');
759
+ $key = sanitize_title($_POST['feed_slug']);
760
+ $value = $_POST['feed_name'];
761
+ $value = powerpress_stripslashes($value);
762
+
763
+ /*
764
+ if( isset($Settings['custom_feeds'][ $key ]) && empty($_POST['overwrite']) )
 
 
 
765
  {
766
+ powerpress_page_message_add_error( sprintf(__('Feed slug "%s" already exists.'), $key) );
767
+ } else */
768
+ if( $key == '' )
769
+ {
770
+ powerpress_page_message_add_error( sprintf(__('Feed slug "%s" is not valid.', 'powerpress'), esc_html($_POST['feed_slug']) ) );
771
+ }
772
+ else if( in_array($key, $wp_rewrite->feeds) && !isset($Settings['custom_feeds'][ $key ]) ) // If it is a system feed or feed created by something else
773
+ {
774
+ powerpress_page_message_add_error( sprintf(__('Feed slug "%s" is not available.', 'powerpress'), esc_html($key) ) );
775
+ }
776
+ else
777
+ {
778
+ $Settings['custom_feeds'][ $key ] = $value;
779
+ powerpress_save_settings($Settings);
780
 
781
+ add_feed($key, 'powerpress_do_podcast_feed'); // Before we flush the rewrite rules we need to add the new custom feed...
782
+ $wp_rewrite->flush_rules();
783
+
784
+ powerpress_page_message_add_notice( sprintf(__('Podcast Feed "%s" added, please configure your new feed now.', 'powerpress'), esc_html($value) ) );
785
+ $_GET['action'] = 'powerpress-editfeed';
786
+ $_GET['feed_slug'] = $key;
787
  }
788
+ }; break;
789
+ case 'powerpress-addtaxonomyfeed': {
790
+ if( !empty($_POST['cancel']) )
791
+ unset($_POST['taxonomy']);
792
+
793
+ if( empty($_POST['add_podcasting']) )
794
+ break; // We do not handle this situation
795
  }
796
+ case 'powerpress-addcategoryfeed': {
797
 
798
+ check_admin_referer('powerpress-add-taxonomy-feed');
799
+
800
+
801
+
802
+
803
+ $taxonomy_type = ( isset($_POST['taxonomy'])? $_POST['taxonomy'] : $_GET['taxonomy'] );
804
+ $term_ID = intval( isset($_POST['term'])? $_POST['term'] : $_GET['term'] );
805
+
806
+
807
+ $term_object = get_term( $term_ID, $taxonomy_type, OBJECT, 'edit');
808
+
809
+ if( empty($term_ID) )
810
  {
811
+ if( $taxonomy_type == 'category' )
812
+ powerpress_page_message_add_error( __('You must select a category to continue.', 'powerpress') );
813
+ else
814
+ powerpress_page_message_add_error( __('You must select a term to continue.', 'powerpress') );
815
+ }
816
+ else if( $term_object == false )
817
+ {
818
+ powerpress_page_message_add_error( __('Error obtaining term information.', 'powerpress') );
819
+ }
820
+ else if( $taxonomy_type == 'category' )
821
+ {
822
+ $Settings = get_option('powerpress_general');
823
+ if( empty($Settings['custom_cat_feeds']) )
824
+ $Settings['custom_cat_feeds'] = array();
825
+
826
+ if( !in_array($term_ID, $Settings['custom_cat_feeds']) )
827
  {
828
+ $Settings['custom_cat_feeds'][] = $term_ID;
829
+ powerpress_save_settings($Settings);
830
  }
831
+
832
+ powerpress_page_message_add_notice( __('Please configure your category podcast feed now.', 'powerpress') );
833
+
834
+ $_GET['action'] = 'powerpress-editcategoryfeed';
835
+ $_GET['cat'] = $term_ID;
836
+ }
837
+ else
838
+ {
839
+
840
+
841
+ //$term_info = term_exists($term_ID, $taxonomy_type);
842
+ $tt_id = $term_object->term_taxonomy_id;
843
+
844
+ if( !$tt_id )
845
  {
846
+
 
847
  }
848
  else
849
  {
850
+ $Settings = get_option('powerpress_taxonomy_podcasting');
851
+
852
+ if( !isset($Settings[ $tt_id ]) )
853
+ {
854
+ $Settings[ $tt_id ] = true;
855
+ powerpress_save_settings($Settings, 'powerpress_taxonomy_podcasting'); // add the feed to the taxonomy podcasting list
856
+ }
857
+
858
+ powerpress_page_message_add_notice( __('Please configure your taxonomy podcast now.', 'powerpress') );
859
+
860
+ $_GET['action'] = 'powerpress-edittaxonomyfeed';
861
+ $_GET['term'] = $term_ID;
862
+ $_GET['ttid'] = $tt_id;
863
  }
864
  }
865
+ }; break;
866
+ case 'powerpress-addposttypefeed': {
867
+
868
+
869
+ check_admin_referer('powerpress-add-posttype-feed');
870
+ //die('ok 2');
871
+
872
+ $Settings = get_option('powerpress_general');
873
+ $feed_slug = sanitize_title($_POST['feed_slug']);
874
+ $post_type = $_POST['podcast_post_type'];
875
+ $post_type = powerpress_stripslashes($post_type);
876
+ $feed_title = $_POST['feed_title'];
877
+ $feed_title = powerpress_stripslashes($feed_title);
878
+
879
+
880
+
881
+ /*
882
+ if( isset($Settings['custom_feeds'][ $key ]) && empty($_POST['overwrite']) )
883
+ {
884
+ powerpress_page_message_add_error( sprintf(__('Feed slug "%s" already exists.'), $key) );
885
+ } else */
886
+ if( empty($feed_slug) )
887
+ {
888
+ powerpress_page_message_add_error( sprintf(__('Feed slug "%s" is not valid.', 'powerpress'), esc_html($_POST['feed_slug']) ) );
889
+ }
890
+ else if( empty($post_type) )
891
+ {
892
+ powerpress_page_message_add_error( __('Post Type is invalid.', 'powerpress') );
893
+ }
894
+ // TODO:
895
+ //else if( in_array($feed_slug, $wp_rewrite->feeds) && !isset($Settings['custom_feeds'][ $key ]) ) // If it is a system feed or feed created by something else
896
+ //{
897
+ // powerpress_page_message_add_error( sprintf(__('Feed slug "%s" is not available.', 'powerpress'), $key) );
898
+ //}
899
  else
900
  {
901
+ $ExistingSettings = powerpress_get_settings('powerpress_posttype_'. $post_type);
902
+ if( !empty($ExistingSettings[ $feed_slug ]) )
903
+ {
904
+ powerpress_page_message_add_error( sprintf(__('Feed slug "%s" already exists.', 'powerpress'), $_POST['feed_slug']) );
905
+ }
906
+ else
907
+ {
908
+ $NewSettings = array();
909
+ $NewSettings[ $feed_slug ]['title'] = $feed_title;
910
+ powerpress_save_settings($NewSettings, 'powerpress_posttype_'. $post_type);
911
+
912
+
913
+ add_feed($feed_slug, 'powerpress_do_podcast_feed'); // Before we flush the rewrite rules we need to add the new custom feed...
914
+ $wp_rewrite->flush_rules();
915
+
916
+ powerpress_page_message_add_notice( sprintf(__('Podcast "%s" added, please configure your new podcast.', 'powerpress'), $feed_title) );
917
+ $_GET['action'] = 'powerpress-editposttypefeed';
918
+ $_GET['feed_slug'] = $feed_slug;
919
+ $_GET['podcast_post_type'] = $post_type;
920
+ }
921
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
922
  }; break;
923
+ case 'powerpress-ping-sites': {
924
+ check_admin_referer('powerpress-ping-sites');
925
+
926
+ require_once( POWERPRESS_ABSPATH . '/powerpressadmin-ping-sites.php');
927
+ powerpressadmin_ping_sites_process();
928
+
929
+ $_GET['action'] = 'powerpress-ping-sites';
930
  }; break;
931
+ case 'powerpress-find-replace': {
932
+ check_admin_referer('powerpress-find-replace');
933
+
934
+ require_once( POWERPRESS_ABSPATH . '/powerpressadmin-find-replace.php');
935
+ powerpressadmin_find_replace_process();
936
+
937
+ $_GET['action'] = 'powerpress-find-replace';
938
  }; break;
939
+ case 'powerpress-importpodpress': {
940
+ check_admin_referer('powerpress-import-podpress');
941
+
942
+ require_once( POWERPRESS_ABSPATH . '/powerpressadmin-podpress.php');
943
+ powerpressadmin_podpress_do_import();
944
+
945
+ $_GET['action'] = 'powerpress-podpress-epiosdes';
946
  }; break;
947
+ case 'powerpress-importmt': {
948
+ check_admin_referer('powerpress-import-mt');
949
+
950
+ require_once( POWERPRESS_ABSPATH . '/powerpressadmin-mt.php');
951
+ powerpressadmin_mt_do_import();
952
+
953
+ $_GET['action'] = 'powerpress-mt-epiosdes';
954
  }; break;
955
+ case 'deletepodpressdata': {
956
+ check_admin_referer('powerpress-delete-podpress-data');
957
+
958
+ require_once( POWERPRESS_ABSPATH . '/powerpressadmin-podpress.php');
959
+ powerpressadmin_podpress_delete_data();
960
+
961
  }; break;
962
+ case 'powerpress-save-mode': {
963
+
964
+ //if( !isset($_POST['General']['advanced_mode']) )
965
+ // powerpress_page_message_add_notice( __('You must select a Mode to continue.', 'powerpress') );
966
+
967
  }; break;
968
  }
969
  }
970
+
971
+ // Handle GET actions...
972
+ if( isset($_GET['action'] ) )
 
 
 
973
  {
974
+ switch( $_GET['action'] )
975
+ {
976
+ case 'powerpress-enable-categorypodcasting': {
977
+ check_admin_referer('powerpress-enable-categorypodcasting');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
978
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
979
  $Settings = get_option('powerpress_general');
980
+ $Settings['cat_casting'] = 1;
981
+ powerpress_save_settings($Settings);
 
 
 
 
 
 
 
 
982
 
983
+ wp_redirect('edit-tags.php?taxonomy=category&message=3');
984
+ exit;
 
 
 
985
 
986
+ }; break;
987
+ case 'powerpress-addcategoryfeed': {
988
+ check_admin_referer('powerpress-add-taxonomy-feed');
989
+ $cat_ID = intval($_GET['cat']);
990
 
991
+ $Settings = get_option('powerpress_general');
992
+ $category = get_category($cat_ID);
993
+ if( $category == false )
994
  {
995
+ powerpress_page_message_add_error( __('Error obtaining category information.', 'powerpress') );
996
  }
997
  else
998
  {
999
+ if( empty($Settings['custom_cat_feeds']) || !is_array($Settings['custom_cat_feeds']) )
1000
+ $Settings['custom_cat_feeds'] = array();
1001
+
1002
+ if( !in_array($cat_ID, $Settings['custom_cat_feeds']) )
1003
  {
1004
+ $Settings['custom_cat_feeds'][] = $cat_ID;
1005
+ powerpress_save_settings($Settings);
1006
  }
1007
 
1008
+ powerpress_page_message_add_notice( __('Please configure your category podcast feed now.', 'powerpress') );
1009
 
1010
+ $_GET['action'] = 'powerpress-editcategoryfeed';
1011
+ $_GET['cat'] = $cat_ID;
 
1012
  }
1013
+ }; break;
1014
+ case 'powerpress-delete-feed': {
1015
+ $delete_slug = $_GET['feed_slug'];
1016
+ $force_deletion = !empty($_GET['force']);
1017
+ check_admin_referer('powerpress-delete-feed-'.$delete_slug);
1018
+
1019
+ $Episodes = powerpress_admin_episodes_per_feed($delete_slug);
1020
+
1021
+ if( false && $delete_slug == 'podcast' && $force_deletion == false ) // Feature disabled, you can now delete podcast specific settings
1022
+ {
1023
+ powerpress_page_message_add_error( __('Cannot delete default podcast feed.', 'powerpress') );
1024
+ }
1025
+ else if( $delete_slug != 'podcast' && $Episodes > 0 && $force_deletion == false )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1026
  {
1027
+ powerpress_page_message_add_error( sprintf(__('Cannot delete feed. Feed contains %d episode(s).', 'powerpress'), $Episodes) );
1028
  }
1029
  else
1030
  {
1031
+ $Settings = get_option('powerpress_general');
1032
+ unset($Settings['custom_feeds'][ $delete_slug ]);
1033
+ powerpress_save_settings($Settings); // Delete the feed from the general settings
1034
+ delete_option('powerpress_feed_'.$delete_slug); // Delete the actual feed settings
1035
 
1036
+ // Now we need to update the rewrite cso the cached rules are up to date
1037
+ if ( in_array($delete_slug, $wp_rewrite->feeds))
1038
+ {
1039
+ $index = array_search($delete_slug, $wp_rewrite->feeds);
1040
+ if( $index !== false )
1041
+ unset($wp_rewrite->feeds[$index]); // Remove the old feed
1042
+ }
1043
+
1044
+ // Remove feed function hook
1045
+ $hook = 'do_feed_' . $delete_slug;
1046
+ remove_action($hook, $hook, 10, 1); // This may not be necessary
1047
+ $wp_rewrite->flush_rules(); // This is definitely necessary
1048
 
1049
+ powerpress_page_message_add_notice( __('Feed deleted successfully.', 'powerpress') );
 
 
 
 
 
 
1050
  }
1051
+ }; break;
1052
+ case 'powerpress-delete-category-feed': {
1053
+ $cat_ID = intval($_GET['cat']);
1054
+ check_admin_referer('powerpress-delete-category-feed-'.$cat_ID);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1055
 
1056
+ $Settings = get_option('powerpress_general');
1057
+ $key = array_search($cat_ID, $Settings['custom_cat_feeds']);
1058
+ if( $key !== false )
1059
  {
1060
+ unset( $Settings['custom_cat_feeds'][$key] );
1061
+ powerpress_save_settings($Settings); // Delete the feed from the general settings
1062
  }
1063
+ delete_option('powerpress_cat_feed_'.$cat_ID); // Delete the actual feed settings
 
1064
 
1065
+ powerpress_page_message_add_notice( __('Removed podcast settings for category feed successfully.', 'powerpress') );
1066
+ }; break;
1067
+ case 'powerpress-delete-taxonomy-feed': {
1068
+ $tt_ID = intval($_GET['ttid']);
1069
+ check_admin_referer('powerpress-delete-taxonomy-feed-'.$tt_ID);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1070
 
1071
+ $Settings = get_option('powerpress_taxonomy_podcasting');
1072
+ if( !empty($Settings[ $tt_ID ]) )
1073
  {
1074
+ unset( $Settings[ $tt_ID ] );
1075
+ powerpress_save_settings($Settings, 'powerpress_taxonomy_podcasting'); // Delete the feed from the general settings
 
1076
  }
1077
+ delete_option('powerpress_taxonomy_'.$tt_ID); // Delete the actual feed settings
 
 
 
 
1078
 
1079
+ powerpress_page_message_add_notice( __('Removed podcast settings for term successfully.', 'powerpress') );
1080
+ }; break;
1081
+ case 'powerpress-delete-posttype-feed': {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1082
 
1083
+ // check admin referer prevents xss
1084
+ $feed_slug = esc_attr($_GET['feed_slug']);
1085
+ $post_type = esc_attr($_GET['podcast_post_type']);
1086
+ check_admin_referer('powerpress-delete-posttype-feed-'.$post_type .'_'.$feed_slug);
1087
 
1088
+ $Settings = get_option('powerpress_posttype_'.$post_type);
1089
+ if( !empty($Settings[ $feed_slug ]) )
1090
+ {
1091
+ unset( $Settings[ $feed_slug ] );
1092
+ update_option('powerpress_posttype_'.$post_type, $Settings);
1093
+ //powerpress_save_settings($Settings, 'powerpress_posttype_'.$post_type); // Delete the feed from the general settings
1094
+ }
1095
+
1096
+ powerpress_page_message_add_notice( __('Removed podcast settings for post type successfully.', 'powerpress') );
1097
+ }; break;
1098
+ case 'powerpress-podpress-settings': {
1099
+ check_admin_referer('powerpress-podpress-settings');
1100
+
1101
+ // Import settings here..
1102
+ if( powerpress_admin_import_podpress_settings() )
1103
+ powerpress_page_message_add_notice( __('Podpress settings imported successfully.', 'powerpress') );
1104
+ else
1105
+ powerpress_page_message_add_error( __('No Podpress settings found.', 'powerpress') );
1106
+
1107
+ }; break;
1108
+ case 'powerpress-podcasting-settings': {
1109
+ check_admin_referer('powerpress-podcasting-settings');
1110
+
1111
+ // Import settings here..
1112
+ if( powerpress_admin_import_podcasting_settings() )
1113
+ powerpress_page_message_add_notice( __('Settings imported from the plugin "Podcasting" successfully.', 'powerpress') );
1114
+ else
1115
+ powerpress_page_message_add_error( __('No settings found for the plugin "Podcasting".', 'powerpress') );
1116
+
1117
+ }; break;
1118
+ case 'powerpress-add-caps': {
1119
+ check_admin_referer('powerpress-add-caps');
1120
+
1121
+ $users = array('administrator','editor', 'author'); // , 'contributor', 'subscriber');
1122
+ while( list($null,$user) = each($users) )
1123
+ {
1124
+ $role = get_role($user);
1125
+ if( !empty($role) )
1126
+ {
1127
+ if( !$role->has_cap('edit_podcast') )
1128
+ $role->add_cap('edit_podcast');
1129
+ if( $user == 'administrator' && !$role->has_cap('view_podcast_stats') )
1130
+ $role->add_cap('view_podcast_stats');
1131
+ }
1132
+ }
1133
+
1134
+ $General = array('use_caps'=>true);
1135
+ powerpress_save_settings($General);
1136
+ powerpress_page_message_add_notice( __('PowerPress Roles and Capabilities added to WordPress Blog.', 'powerpress') );
1137
+
1138
+ }; break;
1139
+ case 'powerpress-remove-caps': {
1140
+ check_admin_referer('powerpress-remove-caps');
1141
+
1142
+ $users = array('administrator','editor', 'author', 'contributor', 'subscriber');
1143
+ while( list($null,$user) = each($users) )
1144
+ {
1145
+ $role = get_role($user);
1146
+ if( !empty($role) )
1147
+ {
1148
+ if( $role->has_cap('edit_podcast') )
1149
+ $role->remove_cap('edit_podcast');
1150
+ if( $role->has_cap('view_podcast_stats') )
1151
+ $role->remove_cap('view_podcast_stats');
1152
+ }
1153
+ }
1154
+ $General = array('use_caps'=>false);
1155
+ powerpress_save_settings($General);
1156
+ powerpress_page_message_add_notice( __('PowerPress Roles and Capabilities removed from WordPress Blog', 'powerpress') );
1157
+
1158
+ }; break;
1159
+ case 'powerpress-add-feed-caps': {
1160
+ check_admin_referer('powerpress-add-feed-caps');
1161
+
 
 
 
1162
  $ps_role = get_role('premium_subscriber');
1163
+ if( empty($ps_role) )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1164
  {
1165
+ add_role('premium_subscriber', __('Premium Subscriber', 'powerpress'));
1166
+ $ps_role = get_role('premium_subscriber');
1167
+ $ps_role->add_cap('read');
1168
+ $ps_role->add_cap('premium_content');
1169
  }
1170
+
1171
+ $users = array('administrator','editor', 'author'); // , 'contributor', 'subscriber');
1172
+ while( list($null,$user) = each($users) )
1173
+ {
1174
+ $role = get_role($user);
1175
+ if( !empty($role) )
1176
+ {
1177
+ if( !$role->has_cap('premium_content') )
1178
+ $role->add_cap('premium_content');
1179
+ }
1180
+ }
1181
+
1182
+ $General = array('premium_caps'=>true);
1183
+ powerpress_save_settings($General);
1184
+ powerpress_page_message_add_notice( __('Podcast Password Protection Capabilities for Custom Channel Feeds added successfully.', 'powerpress') );
1185
+
1186
+ }; break;
1187
+ case 'powerpress-remove-feed-caps': {
1188
+ check_admin_referer('powerpress-remove-feed-caps');
1189
+
1190
+ $users = array('administrator','editor', 'author', 'contributor', 'subscriber', 'premium_subscriber', 'powerpress');
1191
+ while( list($null,$user) = each($users) )
1192
+ {
1193
+ $role = get_role($user);
1194
+ if( !empty($role) )
1195
+ {
1196
+ if( $role->has_cap('premium_content') )
1197
+ $role->remove_cap('premium_content');
1198
+ }
1199
+ }
1200
+
1201
+ remove_role('premium_subscriber');
1202
+
1203
+ $General = array('premium_caps'=>false);
1204
+ powerpress_save_settings($General);
1205
+ powerpress_page_message_add_notice( __('Podcast Password Protection Capabilities for Custom Channel Feeds removed successfully.', 'powerpress') );
1206
+
1207
+ }; break;
1208
+ case 'powerpress-clear-update_plugins': {
1209
+ check_admin_referer('powerpress-clear-update_plugins');
1210
+
1211
+ delete_option('update_plugins'); // OLD method
1212
+ delete_option('_site_transient_update_plugins'); // New method
1213
+ powerpress_page_message_add_notice( sprintf( __('Plugins Update Cache cleared successfully. You may now to go the %s page to see the latest plugin versions.', 'powerpress'), '<a href="'. admin_url() .'plugins.php" title="'. __('Manage Plugins', 'powerpress') .'">'. __('Manage Plugins', 'powerpress') .'</a>') );
1214
+
1215
+ }; break;
1216
+ }
1217
  }
1218
+
1219
+ if( isset($_REQUEST['action']) )
 
 
 
1220
  {
1221
+ switch( $_REQUEST['action'] )
1222
+ {
1223
+ case 'powerpress-migrate-media': {
1224
+
1225
+ require_once( POWERPRESS_ABSPATH . '/powerpressadmin-migrate.php');
1226
+ powerpress_admin_migrate_request();
1227
 
1228
+ }; break;
1229
+ }
 
 
1230
  }
1231
  }
1232
 
1332
  unset($Settings['playlist_player']);
1333
  if( isset($Settings['seo_feed_title']) && empty($Settings['seo_feed_title']) )
1334
  unset($Settings['seo_feed_title']);
1335
+ if( isset($Settings['subscribe_feature_email']) && empty($Settings['subscribe_feature_email']) )
1336
+ unset($Settings['subscribe_feature_email']);
1337
  }
1338
  else // Feed or player settings...
1339
  {
1680
 
1681
  // Initialize the important variables:
1682
  $MediaURL = $Powerpress['url'];
1683
+
1684
+ if( !empty($GeneralSettings['default_url']) && strpos($MediaURL, 'http://') !== 0 && strpos($MediaURL, 'https://') !== 0 && empty($Powerpress['hosting']) ) // If the url entered does not start with a http:// or https://
 
 
 
 
 
 
1685
  {
1686
+ $MediaURL = rtrim($GeneralSettings['default_url'], '/') .'/'. ltrim($MediaURL, '/');
 
 
 
1687
  }
1688
+
1689
+
1690
 
1691
  $FileSize = '';
1692
  $ContentType = '';
2278
  if( x == 5 )
2279
  validChars = validChars.substring(1); // remove the colon, should no longer appear in URLs
2280
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2281
 
2282
  jQuery( '#'+DestDiv ).css('display', 'none');
2283
  return true;
2572
  $duration = '';
2573
  $GeneralSettings = get_option('powerpress_general');
2574
 
2575
+ 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://
 
 
 
 
 
 
 
2576
  {
2577
+ $media_url = rtrim($GeneralSettings['default_url'], '/') .'/'. $media_url;
 
 
 
2578
  }
2579
 
2580
  $ContentType = false;
3119
  unset($GLOBALS['g_powerpress_remote_error']);
3120
  unset($GLOBALS['g_powerpress_remote_errorno']);
3121
 
3122
+ if( false && function_exists( 'curl_init' ) ) // Preferred method of connecting
3123
  {
3124
  $curl = curl_init();
3125
  curl_setopt($curl, CURLOPT_URL, $url);
3140
  curl_setopt($curl, CURLOPT_TIMEOUT, $timeout); // The maximum number of seconds to execute.
3141
  curl_setopt($curl, CURLOPT_USERAGENT, 'Blubrry PowerPress/'.POWERPRESS_VERSION);
3142
  curl_setopt($curl, CURLOPT_FAILONERROR, true);
3143
+ if( preg_match('/^https:\/\//i', $url) != 0 )
3144
  {
3145
+ curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 2 );
3146
+ curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, true );
3147
+ curl_setopt($curl, CURLOPT_CAINFO, ABSPATH . WPINC . '/certificates/ca-bundle.crt');
3148
  }
3149
  // HTTP Authentication
3150
  if( $basic_auth )
3182
  {
3183
  $GLOBALS['g_powerpress_remote_error'] = $error_msg;
3184
  $GLOBALS['g_powerpress_remote_errorno'] = $http_code;
3185
+ echo 'error: '.$content;
3186
+
3187
+ $decoded = json_decode($content);
3188
+ if( !empty($decoded) )
3189
+ return $content; // We can still return the error from the server at least
3190
  return false;
3191
  }
3192
  else if( $http_code > 399 )
3193
  {
3194
+ echo '40x';
3195
  $GLOBALS['g_powerpress_remote_error'] = "HTTP $http_code";
3196
  $GLOBALS['g_powerpress_remote_errorno'] = $http_code;
3197
  switch( $http_code )
3203
  case 404: $GLOBALS['g_powerpress_remote_error'] .= ' '. __("Not Found", 'powerpress'); break;
3204
  }
3205
 
3206
+ $decoded = json_decode($content);
3207
+ if( !empty($decoded) )
3208
+ return $content; // We can still return the error from the server at least
3209
  return false;
3210
  }
3211
  return $content;
4017
  }
4018
  }
4019
 
4020
+ $wp_remote_options = array();
4021
+ $wp_remote_options['user-agent'] = 'Blubrry PowerPress/'.POWERPRESS_VERSION;
4022
+ $wp_remote_options['httpversion'] = '1.1';
4023
+
4024
  if( $content_type != '' && $file_size == 0 )
4025
  {
4026
  $response = wp_remote_head( $media_file, array('httpversion' => 1.1) );
4028
  if( !is_wp_error( $response ) && ($response['response']['code'] == 301 || $response['response']['code'] == 302) )
4029
  {
4030
  $headers = wp_remote_retrieve_headers( $response );
4031
+ $response = wp_remote_head( $headers['location'], $wp_remote_options );
4032
  }
4033
  // Redirect 2
4034
  if( !is_wp_error( $response ) && ($response['response']['code'] == 301 || $response['response']['code'] == 302) )
4035
  {
4036
  $headers = wp_remote_retrieve_headers( $response );
4037
+ $response = wp_remote_head( $headers['location'], $wp_remote_options );
4038
  }
4039
  // Redirect 3
4040
  if( !is_wp_error( $response ) && ($response['response']['code'] == 301 || $response['response']['code'] == 302) )
4041
  {
4042
  $headers = wp_remote_retrieve_headers( $response );
4043
+ $response = wp_remote_head( $headers['location'], $wp_remote_options );
4044
  }
4045
  // Redirect 4
4046
  if( !is_wp_error( $response ) && ($response['response']['code'] == 301 || $response['response']['code'] == 302) )
4047
  {
4048
  $headers = wp_remote_retrieve_headers( $response );
4049
+ $response = wp_remote_head( $headers['location'], $wp_remote_options );
4050
  }
4051
 
4052
  if ( is_wp_error( $response ) )
readme.txt CHANGED
@@ -2,9 +2,9 @@
2
  Contributors: amandato, blubrry
3
  Tags: podcasting, podcast, podcaster, itunes, enclosure, zune, iphone, youtube, viddler, blip.tv, ustream, podcasting, audio, video, rss2, feed, player, media, rss, mp3, music, embed, feedburner, statistics, stats, flv, flash, id3, episodes, blubrry, webm, mp4, m4v, wordpressmu, mu, wordpress mu, multisite, multi site, mediacaster, post, plugin, posts, simple, social, dashboard, TSG, Buzzsprout, MTR, WP-boxCast, CastMyBlog, simple podcasting, seriously simple podcasting, seriously-simple-podcasting, podlove, podcast.de
4
  Requires at least: 3.6
5
- Tested up to: 4.2.2
6
- Stable tag: 6.0.3
7
- Donate link: http://create.blubrry.com/
8
  License: GPLv2 or later
9
 
10
 
@@ -29,7 +29,10 @@ Blubrry PowerPress brings the essential features for podcasting to WordPress. De
29
 
30
  *The Blubrry basic statistics service is FREE. Our [Premium Statistics Service](https://secure.blubrry.com/podcast-statistics-premium/), which includes [RawVoice Certified Statistics](http://create.blubrry.com/resources/podcast-media-download-statistics/rawvoice-certified/), U.S. downloads, trending and exporting, is available for $5 month.
31
 
32
- = Full iTunes Support! =
 
 
 
33
  Blubrry PowerPress fully supports iTunes, which set the standard and is required for podcasting. PowerPress comes with the following iTunes specific features:
34
 
35
  * iTunes compliant podcast feeds: The appropriate tags are added to your feeds so your iTunes listing looks great.
@@ -63,7 +66,7 @@ Make your life easier by adding our FREE or paid media hosting and statistics se
63
 
64
  The Blubrry basic statistics service is FREE. Our [Premium Statistics Service](https://secure.blubrry.com/podcast-statistics-premium/), which includes [RawVoice 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.
65
 
66
- = Subscribe Tools =
67
  A Blubrry PowerPress exclusive, podcasting subscribe tools help you convert Web visitors into podcast subscribers.
68
 
69
  * [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.
@@ -73,7 +76,7 @@ A Blubrry PowerPress exclusive, podcasting subscribe tools help you convert Web
73
  * Retina enabled: Subscribe button images optimized for high resolution displays including Apple Retina displays.
74
  * Responsive: Subscribe tools are designed for any screen and optimized for touch screens by providing custom buttons that are at minimum 48 pixels in height.
75
 
76
- = Advanced Features =
77
  Want more? We've got more! Check out some of the advanced features:
78
 
79
  * [Podcasting SEO settings](http://create.blubrry.com/resources/powerpress/advanced-tools-and-options/podcasting-seo-settings/): Utilize the iTunes features that improve the discovery of your podcasts and include the necessary meta data in your blog pages for search engines to discover.
@@ -116,7 +119,6 @@ We now offer one-on-one consulting via GoToMeeting, Skype or phone.
116
 
117
  *PowerPress is developed and maintained by [Blubrry](http://www.blubrry.com), a podcasting company and community 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.*
118
 
119
-
120
  == Frequently Asked Questions ==
121
 
122
  = Compatible Themes and Plugins =
@@ -197,9 +199,32 @@ To install Blubrry PowerPress manually, follow these steps:
197
  == Changelog ==
198
 
199
  = Next Major Release Announcements =
200
- * PowerPress 6.0+ is no longer be compatible with WordPress 3.0.x through 3.5.x. Please upgrade to the latest version of WordPress to install future versions of PowerPress.
201
  * 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) with your name and email.
202
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
203
 
204
  = 6.0.3 =
205
  * Released on 5/7/2015
@@ -456,6 +481,6 @@ Please [contact blubrry](http://www.blubrry.com/contact.php) with the link to yo
456
  == Support ==
457
  [http://create.blubrry.com/support/](http://create.blubrry.com/support/)
458
 
459
- == Twitter ==
460
 
461
- [http://twitter.com/blubrry](http://twitter.com/blubrry)
2
  Contributors: amandato, blubrry
3
  Tags: podcasting, podcast, podcaster, itunes, enclosure, zune, iphone, youtube, viddler, blip.tv, ustream, podcasting, audio, video, rss2, feed, player, media, rss, mp3, music, embed, feedburner, statistics, stats, flv, flash, id3, episodes, blubrry, webm, mp4, m4v, wordpressmu, mu, wordpress mu, multisite, multi site, mediacaster, post, plugin, posts, simple, social, dashboard, TSG, Buzzsprout, MTR, WP-boxCast, CastMyBlog, simple podcasting, seriously simple podcasting, seriously-simple-podcasting, podlove, podcast.de
4
  Requires at least: 3.6
5
+ Tested up to: 4.3
6
+ Stable tag: 6.0.4
7
+ Donate link: https://www.patreon.com/blubrry?ty=h
8
  License: GPLv2 or later
9
 
10
 
29
 
30
  *The Blubrry basic statistics service is FREE. Our [Premium Statistics Service](https://secure.blubrry.com/podcast-statistics-premium/), which includes [RawVoice Certified Statistics](http://create.blubrry.com/resources/podcast-media-download-statistics/rawvoice-certified/), U.S. downloads, trending and exporting, is available for $5 month.
31
 
32
+ = Become a PowerPress Patron! =
33
+ Help support your favorite podcasting plugin via Patreon. [Visit Blubrry's Patreon page](https://www.patreon.com/blubrry?ty=h)
34
+
35
+ = Includes Full iTunes Support! =
36
  Blubrry PowerPress fully supports iTunes, which set the standard and is required for podcasting. PowerPress comes with the following iTunes specific features:
37
 
38
  * iTunes compliant podcast feeds: The appropriate tags are added to your feeds so your iTunes listing looks great.
66
 
67
  The Blubrry basic statistics service is FREE. Our [Premium Statistics Service](https://secure.blubrry.com/podcast-statistics-premium/), which includes [RawVoice 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.
68
 
69
+ = Subscribe Tools Baked In =
70
  A Blubrry PowerPress exclusive, podcasting subscribe tools help you convert Web visitors into podcast subscribers.
71
 
72
  * [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.
76
  * Retina enabled: Subscribe button images optimized for high resolution displays including Apple Retina displays.
77
  * Responsive: Subscribe tools are designed for any screen and optimized for touch screens by providing custom buttons that are at minimum 48 pixels in height.
78
 
79
+ = Advanced Features for those who need more =
80
  Want more? We've got more! Check out some of the advanced features:
81
 
82
  * [Podcasting SEO settings](http://create.blubrry.com/resources/powerpress/advanced-tools-and-options/podcasting-seo-settings/): Utilize the iTunes features that improve the discovery of your podcasts and include the necessary meta data in your blog pages for search engines to discover.
119
 
120
  *PowerPress is developed and maintained by [Blubrry](http://www.blubrry.com), a podcasting company and community 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.*
121
 
 
122
  == Frequently Asked Questions ==
123
 
124
  = Compatible Themes and Plugins =
199
  == Changelog ==
200
 
201
  = Next Major Release Announcements =
202
+ * PowerPress 7.0 is coming in 2-4 weeks!!!
203
  * 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) with your name and email.
204
 
205
+ = Become a PowerPress Patron! =
206
+ Help support your favorite podcasting plugin via Patreon. [Visit Blubrry's Patreon page](https://www.patreon.com/blubrry?ty=h)
207
+
208
+ = 6.0.4 =
209
+ * Released on 8/27/2015
210
+ * Added new Subscribe by Email option to Subscribe Links feature. By default this new feature is not enabled. Go to "PowerPress Settings" > "Media Appearance" to enable Subscribe by Email.
211
+ * Enhanced iTunes Summary feature now maintains <a> links.
212
+ * Added check for null values returned from `get_role` function.
213
+ * HTTPS URL warnings have been removed. The past year usage of podcast applications that do not support https is now negligible.
214
+ * Added support for https:// media URLs for Blubrry and RawVoice statistics services.
215
+ * Verify media URL option now verifies SSL certificates and hostnames for https URLs.
216
+ * Added Podcast subscribe link support to post type podcasting.
217
+ * Links to Feed Validator have been temporarily removed, service does not correctly validate secure podcast feeds. We are working on an alternative.
218
+ * Moved defines for customizing links within the `plugins_loaded` action after translations are loaded.
219
+ * Fixed bug with linking blubrry account displayed HTML syntax for sign-in errors.
220
+ * Added logic to the Subscribe to Podcast sidebar widget to only display category, feed slug and post type settings when appropriate.
221
+ * Added new define option `POWERPRESS_NO_THE_EXCERPT`, allows you to remove PowerPress's the_excerpt filter for special situations that warrant it. (Thanks Avi for the code)
222
+ * Changed logic for the `powerpress_get_the_excerpt_rss` function. (Thanks Avi for the code)
223
+ * Added 'mov' file extensions to the list of migrate-able media files.
224
+ * Updated migrate media logic to allow for resetting of migration.
225
+ * Improved error reporting for blubrry.com API calls.
226
+ * Tweaked how Blubrry account linking is presented in plugin to make it easier.
227
+
228
 
229
  = 6.0.3 =
230
  * Released on 5/7/2015
481
  == Support ==
482
  [http://create.blubrry.com/support/](http://create.blubrry.com/support/)
483
 
484
+ == Blubrry Social ==
485
 
486
+ [Twitter](https://twitter.com/blubrry) - [Facebook](https://www.facebook.com/blubrry) - [Google+](https://plus.google.com/u/0/104806426850567631953/posts)