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