PowerPress Podcasting plugin by Blubrry - Version 7.2

Version Description

  • Released on 12/13/2017
  • Added code to allow customization of Blubrry player style and colors.
  • Added code to set no-cache headers in AJAX calls.
  • Updated code to fixed bug where new iTunes episode title field may not save with some web hosting platforms using mod security with PHP 5.x. (Thanks @glark, Karren, and others for helping us fix the issue!)
  • Changed the menu slug name for editing PowerPress settings.
  • Removed safe mode logic for older versions of PHP. (Thanks @BrentO for reporting)
  • Added logic to support feeds with bbpress. (Thanks @mubashiriqbal for bringing to our attention!)
  • Added missing argument for get_post_type_object() in powerpress-subscribe (Thanks John for bring to our attention)
  • Added disable iOS 11 field options under tools to help diagnose issue with some websites that show a 404 page when editing settings since the iOS11 fields were introduced.
  • Changed the names of the new iOS11 fields that were getting caught by Mod Security for some users.
  • Fixed bug with Taxonomy podcasting statistics redirects not being compatible with versions of WordPress older than 4.5 (Thanks @fmnowling for bringing to our attention!)
  • iTunes Maximizer option 11+ older episodes now includes the iTunes summary by default to reflect changes with iOS11. (Thanks Daniel Lewis for the suggestion!)
  • Fixed link to powerpress translation page which was returning 404
  • Added CastFeedValidator.com links for validating podcast feeds.
  • Added Hindi and Punjabi to list of Podcast feed langauges (Thanks @blueblast for requesting the languages to be added)
Download this release

Release Info

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

Code changes from version 7.1.1 to 7.2

css/admin.css CHANGED
@@ -432,7 +432,13 @@ a.pp-expand-section:visited {
432
  content: ' \25BC';
433
  content: '-';
434
  }
435
-
 
 
 
 
 
 
436
  /* buttons */
437
  .wp-core-ui .button-blubrry {
438
  background: #1976D2;
432
  content: ' \25BC';
433
  content: '-';
434
  }
435
+ .bbplayer_settings .form-table th{
436
+ padding-bottom: 0;
437
+ }
438
+ .bbplayer_settings h3{
439
+ color: #003366;
440
+ font-weight: bold;
441
+ }
442
  /* buttons */
443
  .wp-core-ui .button-blubrry {
444
  background: #1976D2;
mp3info.class.php CHANGED
@@ -166,7 +166,7 @@
166
  */
167
  function Download($url, $RedirectCount = 0)
168
  {
169
- if( !ini_get( 'allow_url_fopen' ) && !function_exists( 'curl_init' ) )
170
  {
171
  $this->SetError( __('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') );
172
  return false;
@@ -336,7 +336,7 @@
336
  function DownloadCurl($url, $RedirectCount = 0)
337
  {
338
  // In case we are dealing with a restriction with a server that does not allow cURL to do redirects itself...
339
- if ( ini_get('safe_mode') || ini_get('open_basedir') )
340
  {
341
  if( $RedirectCount > $this->m_RedirectLimit )
342
  {
@@ -366,7 +366,7 @@
366
  curl_setopt($curl, CURLOPT_CAINFO, ABSPATH . WPINC . '/certificates/ca-bundle.crt');
367
  }
368
 
369
- if ( !ini_get('safe_mode') && !ini_get('open_basedir') )
370
  {
371
  curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);
372
  curl_setopt($curl, CURLOPT_MAXREDIRS, $this->m_RedirectLimit);
@@ -382,7 +382,7 @@
382
  $HttpCode = curl_getinfo($curl, CURLINFO_HTTP_CODE);
383
  $ContentType = curl_getinfo($curl, CURLINFO_CONTENT_TYPE);
384
  $ErrorMsg = curl_error($curl);
385
- if ( !ini_get('safe_mode') && !ini_get('open_basedir') )
386
  $this->m_RedirectCount = curl_getinfo($curl, CURLINFO_REDIRECT_COUNT);
387
 
388
  if( $HttpCode < 200 || $HttpCode > 250 )
@@ -392,7 +392,7 @@
392
  case 301:
393
  case 302:
394
  case 307: {
395
- if ( !ini_get('safe_mode') && !ini_get('open_basedir') )
396
  {
397
  $this->SetError( sprintf( __('Media URL exceeded redirect limit of %d (cURL).', 'powerpress'), $this->m_RedirectLimit) );
398
  }
@@ -477,7 +477,7 @@
477
  curl_setopt($curl, CURLOPT_CAINFO, ABSPATH . WPINC . '/certificates/ca-bundle.crt');
478
  }
479
 
480
- if ( !ini_get('safe_mode') && !ini_get('open_basedir') )
481
  {
482
  curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);
483
  curl_setopt($curl, CURLOPT_MAXREDIRS, $this->m_RedirectLimit);
@@ -504,7 +504,7 @@
504
  curl_setopt($curl, CURLOPT_HEADER, false); // header will be at output
505
  curl_setopt($curl, CURLOPT_NOBODY, false );
506
  curl_setopt($curl, CURLOPT_WRITEFUNCTION, array($this, 'remoteread_curl_writefunc') );
507
- if ( !ini_get('safe_mode') && !ini_get('open_basedir') )
508
  {
509
  curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);
510
  curl_setopt($curl, CURLOPT_MAXREDIRS, $this->m_RedirectLimit);
@@ -720,6 +720,18 @@
720
  return false;
721
  }
722
 
 
 
 
 
 
 
 
 
 
 
 
 
723
  private function _load_id3lib()
724
  {
725
  if( defined('POWERPRESS_GETID3_LOADED') )
166
  */
167
  function Download($url, $RedirectCount = 0)
168
  {
169
+ if( !$this->ini_get( 'allow_url_fopen' ) && !function_exists( 'curl_init' ) )
170
  {
171
  $this->SetError( __('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') );
172
  return false;
336
  function DownloadCurl($url, $RedirectCount = 0)
337
  {
338
  // In case we are dealing with a restriction with a server that does not allow cURL to do redirects itself...
339
+ if ( $this->ini_get('safe_mode') || $this->ini_get('open_basedir') )
340
  {
341
  if( $RedirectCount > $this->m_RedirectLimit )
342
  {
366
  curl_setopt($curl, CURLOPT_CAINFO, ABSPATH . WPINC . '/certificates/ca-bundle.crt');
367
  }
368
 
369
+ if ( !$this->ini_get('safe_mode') && !$this->ini_get('open_basedir') )
370
  {
371
  curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);
372
  curl_setopt($curl, CURLOPT_MAXREDIRS, $this->m_RedirectLimit);
382
  $HttpCode = curl_getinfo($curl, CURLINFO_HTTP_CODE);
383
  $ContentType = curl_getinfo($curl, CURLINFO_CONTENT_TYPE);
384
  $ErrorMsg = curl_error($curl);
385
+ if ( !$this->ini_get('safe_mode') && !$this->ini_get('open_basedir') )
386
  $this->m_RedirectCount = curl_getinfo($curl, CURLINFO_REDIRECT_COUNT);
387
 
388
  if( $HttpCode < 200 || $HttpCode > 250 )
392
  case 301:
393
  case 302:
394
  case 307: {
395
+ if ( !$this->ini_get('safe_mode') && !$this->ini_get('open_basedir') )
396
  {
397
  $this->SetError( sprintf( __('Media URL exceeded redirect limit of %d (cURL).', 'powerpress'), $this->m_RedirectLimit) );
398
  }
477
  curl_setopt($curl, CURLOPT_CAINFO, ABSPATH . WPINC . '/certificates/ca-bundle.crt');
478
  }
479
 
480
+ if ( !$this->ini_get('safe_mode') && !$this->ini_get('open_basedir') )
481
  {
482
  curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);
483
  curl_setopt($curl, CURLOPT_MAXREDIRS, $this->m_RedirectLimit);
504
  curl_setopt($curl, CURLOPT_HEADER, false); // header will be at output
505
  curl_setopt($curl, CURLOPT_NOBODY, false );
506
  curl_setopt($curl, CURLOPT_WRITEFUNCTION, array($this, 'remoteread_curl_writefunc') );
507
+ if ( !$this->ini_get('safe_mode') && !$this->ini_get('open_basedir') )
508
  {
509
  curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);
510
  curl_setopt($curl, CURLOPT_MAXREDIRS, $this->m_RedirectLimit);
720
  return false;
721
  }
722
 
723
+ private function ini_get($field)
724
+ {
725
+ switch( $field ) {
726
+ case 'safe_mode': {
727
+ if( version_compare( PHP_VERSION, '5.3.0') >= 0 ) { // If php 5.3+
728
+ return false;
729
+ }
730
+ }; break;
731
+ }
732
+ return ini_get($field);
733
+ }
734
+
735
  private function _load_id3lib()
736
  {
737
  if( defined('POWERPRESS_GETID3_LOADED') )
powerpress-player.php CHANGED
@@ -1337,6 +1337,15 @@ function powerpressplayer_build_blubrryaudio($media_url, $EpisodeData=array(), $
1337
  // media URL is all we need., as long as it's hosted at blubrry.com...
1338
  if( preg_match('/content\.blubrry\.com/', $media_url) )
1339
  {
 
 
 
 
 
 
 
 
 
1340
  if( !empty($EpisodeData['episode_id']) ) {
1341
  $url = '//player.blubrry.com/?podcast_id='. intval($EpisodeData['episode_id']);
1342
  } else {
@@ -1354,6 +1363,7 @@ function powerpressplayer_build_blubrryaudio($media_url, $EpisodeData=array(), $
1354
  }
1355
 
1356
  }
 
1357
  return '<iframe src="'. $url .'" scrolling="no" width="100%" height="138px" frameborder="0"></iframe>';
1358
  }
1359
 
@@ -1362,7 +1372,7 @@ function powerpressplayer_build_blubrryaudio($media_url, $EpisodeData=array(), $
1362
 
1363
  function powerpressplayer_build_blubrryaudio_by_id($directory_episode_id)
1364
  {
1365
- return '<iframe src="//player.blubrry.com?podcast_id='. $directory_episode_id .'" scrolling="no" width="100%" height="138px" frameborder="0"></iframe>';
1366
  }
1367
 
1368
  /*
1337
  // media URL is all we need., as long as it's hosted at blubrry.com...
1338
  if( preg_match('/content\.blubrry\.com/', $media_url) )
1339
  {
1340
+ $playerSettings = get_option('powerpress_bplayer');
1341
+ $hash = '';
1342
+ if(!empty($playerSettings)) {
1343
+ $hash = 'darkOrLight-'.$playerSettings['playerstyle']."&shownotes-".$playerSettings['showtext']."&shownotesBackground-".$playerSettings['showbg'];
1344
+ $hash .= "&download-".$playerSettings['downloadcolortext']."&downloadBackground-".$playerSettings['downloadbgcolor'];
1345
+ $hash .= "&subscribe-".$playerSettings['textsubscribe']."&subscribeBackground-".$playerSettings['subscribebg']."&share-".$playerSettings['textshare']."&shareBackground-".$playerSettings['bgshare'];
1346
+ $hash = str_replace('#','',$hash); //remove # symbol from hex colors
1347
+ $hash = '#'.$hash;
1348
+ }
1349
  if( !empty($EpisodeData['episode_id']) ) {
1350
  $url = '//player.blubrry.com/?podcast_id='. intval($EpisodeData['episode_id']);
1351
  } else {
1363
  }
1364
 
1365
  }
1366
+ $url = $url.$hash;
1367
  return '<iframe src="'. $url .'" scrolling="no" width="100%" height="138px" frameborder="0"></iframe>';
1368
  }
1369
 
1372
 
1373
  function powerpressplayer_build_blubrryaudio_by_id($directory_episode_id)
1374
  {
1375
+ return '<iframe src="//player.blubrry.com?podcast_id='. $directory_episode_id .'" id="playeriframe" scrolling="no" width="100%" height="138px" frameborder="0"></iframe>';
1376
  }
1377
 
1378
  /*
powerpress-subscribe.php CHANGED
@@ -170,7 +170,7 @@ function powerpresssubscribe_get_settings($ExtraData, $detect_category=true)
170
  {
171
  $Settings['title'] = $Settings['title'];
172
  if( empty($Settings['title']) ) {
173
- $obj = get_post_type_object( );
174
  if( !empty($obj->labels->singular_name) )
175
  $Settings['title'] = $obj->labels->singular_name;
176
  }
170
  {
171
  $Settings['title'] = $Settings['title'];
172
  if( empty($Settings['title']) ) {
173
+ $obj = get_post_type_object($post_type);
174
  if( !empty($obj->labels->singular_name) )
175
  $Settings['title'] = $obj->labels->singular_name;
176
  }
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> is the No. 1 Podcasting plugin for WordPress. Developed by podcasters for podcasters; features include Simple and Advanced modes, multiple audio/video player options, subscribe to podcast tools, podcast SEO features, and more! Fully supports iTunes, Google Play, Stitcher, and Blubrry Podcasting directories, as well as all podcast applications and clients.
6
- Version: 7.1.1
7
  Author: Blubrry
8
  Author URI: http://www.blubrry.com/
9
  Requires at least: 3.6
@@ -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', '7.1.1' );
36
 
37
  // Translation support:
38
  if ( !defined('POWERPRESS_ABSPATH') )
@@ -50,7 +50,7 @@ if( !defined('POWERPRESS_BLUBRRY_API_URL') )
50
  define('POWERPRESS_BLUBRRY_API_URL', 'http://api.blubrry.com/');
51
 
52
  // Replace validator service with one that is more reliable here:
53
- // define('POWERPRESS_FEEDVALIDATOR_URL', 'http://www.feedvalidator.org/check.cgi?url=');
54
 
55
  // Display custom play image for quicktime media. Applies to on page player only.
56
  //define('POWERPRESS_PLAY_IMAGE', 'http://www.blubrry.com/themes/blubrry/images/player/PlayerBadge150x50NoBorder.jpg');
@@ -547,7 +547,14 @@ function powerpress_rss2_head()
547
  echo 'posttype="'.$powerpress_feed['post_type'].'" ';
548
  if( !empty($powerpress_feed['feed-slug']) )
549
  echo 'feedslug="'.$powerpress_feed['feed-slug'].'" ';
550
- echo '-->'.PHP_EOL;
 
 
 
 
 
 
 
551
 
552
  // add the itunes:new-feed-url tag to feed
553
  if( powerpress_is_custom_podcast_feed() )
@@ -788,7 +795,7 @@ function powerpress_rss2_item()
788
 
789
  // Check and see if we're working with a podcast episode
790
  $custom_enclosure = false;
791
- if( powerpress_is_custom_podcast_feed() && get_query_var('feed') != 'podcast' && !is_category() && !is_tax() && !is_tag() )
792
  {
793
  $EpisodeData = powerpress_get_enclosure_data($post->ID, get_query_var('feed') );
794
  $custom_enclosure = true;
@@ -878,13 +885,11 @@ function powerpress_rss2_item()
878
  echo "\t<itunes:subtitle>". powerpress_format_itunes_value($subtitle, 'subtitle') .'</itunes:subtitle>'.PHP_EOL;
879
  }
880
 
881
- if( empty($powerpress_feed['feed_maximizer_on']) || defined('POWERPRESS_MAXIMIZER_INCLUDE_ITUNES_SUMMARY') ) {
882
- if( !empty($summary) ) {
883
- if( $summary_cdata ) {
884
- echo "\t\t<itunes:summary><![CDATA[". powerpress_format_itunes_value($summary, 'summary', true) .']]></itunes:summary>'.PHP_EOL;
885
- } else {
886
- echo "\t\t<itunes:summary>". powerpress_format_itunes_value($summary, 'summary') .'</itunes:summary>'.PHP_EOL;
887
- }
888
  }
889
  }
890
 
@@ -1007,7 +1012,7 @@ function powerpress_filter_rss_enclosure($content)
1007
  return $content; // Another podcasting plugin is enabled...
1008
  }
1009
 
1010
- if( powerpress_is_custom_podcast_feed() && get_query_var('feed') != 'podcast' && !is_category() && !is_tag() && !is_tax() )
1011
  return ''; // We will handle this enclosure in the powerpress_rss2_item() function
1012
 
1013
  $match_count = preg_match('/\surl="([^"]*)"/', $content, $matches); // No URL found, weird
@@ -1219,7 +1224,7 @@ function powerpress_the_title_rss($title)
1219
  {
1220
  $feed_slug = 'podcast';
1221
  // IF custom post type or channel, use that feed slug...
1222
- if( get_query_var('feed') != 'podcast' && !is_category() && !is_tax() && !is_tag() )
1223
  $feed_slug = get_query_var('feed');
1224
 
1225
  // Get the episode specific title...
@@ -1460,6 +1465,11 @@ function powerpress_init()
1460
  {
1461
  $GeneralSettings = get_option('powerpress_general');
1462
 
 
 
 
 
 
1463
  if( empty($GeneralSettings['disable_appearance']) || $GeneralSettings['disable_appearance'] == false )
1464
  {
1465
  require_once( POWERPRESS_ABSPATH.'/powerpress-player.php');
@@ -1970,11 +1980,11 @@ function powerpress_posts_fields($cols)
1970
  return $cols;
1971
 
1972
  if( is_category() || is_tag() || is_tax() ) {
1973
- if( get_query_var('feed') != 'podcast' )
1974
  return $cols;
1975
  }
1976
 
1977
- if( powerpress_is_custom_podcast_feed() || get_query_var('feed') == 'podcast' )
1978
  {
1979
  if( !empty($GLOBALS['powerpress_feed']['feed_accel']) )
1980
  {
@@ -1995,11 +2005,11 @@ function powerpress_posts_join($join)
1995
  return $join;
1996
 
1997
  if( is_category() || is_tag() || is_tax() ) {
1998
- if( get_query_var('feed') != 'podcast' )
1999
  return $join;
2000
  }
2001
-
2002
- if( powerpress_is_custom_podcast_feed() || get_query_var('feed') == 'podcast' )
2003
  {
2004
  global $wpdb;
2005
  $join .= " INNER JOIN {$wpdb->postmeta} ";
@@ -2016,22 +2026,22 @@ function powerpress_posts_where($where)
2016
  if( !is_feed() )
2017
  return $where;
2018
  if( is_category() || is_tag() || is_tax() ) {
2019
- if( get_query_var('feed') != 'podcast' )
2020
  return $where;
2021
  }
2022
 
2023
- if( powerpress_is_custom_podcast_feed() || get_query_var('feed') == 'podcast' )
2024
  {
2025
  global $wpdb, $powerpress_feed;
2026
  $where .= " AND (";
2027
 
2028
- if( powerpress_is_custom_podcast_feed() && get_query_var('feed') != 'podcast' )
2029
  $where .= " {$wpdb->postmeta}.meta_key = '_". get_query_var('feed') .":enclosure' ";
2030
  else
2031
  $where .= " {$wpdb->postmeta}.meta_key = 'enclosure' ";
2032
 
2033
  // Include Podpress data if exists...
2034
- if( !empty($powerpress_feed['process_podpress']) && get_query_var('feed') == 'podcast' )
2035
  $where .= " OR {$wpdb->postmeta}.meta_key = 'podPressMedia' OR {$wpdb->postmeta}.meta_key = '_podPressMedia' ";
2036
 
2037
  $where .= ") ";
@@ -2048,11 +2058,11 @@ function powerpress_posts_groupby($groupby)
2048
  return $groupby;
2049
 
2050
  if( is_category() || is_tag() || is_tax() ) {
2051
- if( get_query_var('feed') != 'podcast' )
2052
  return $groupby;
2053
  }
2054
 
2055
- if( powerpress_is_custom_podcast_feed() || get_query_var('feed') == 'podcast' )
2056
  {
2057
  global $wpdb;
2058
  $groupby = " {$wpdb->posts}.ID ";
@@ -2066,7 +2076,7 @@ function powerpress_post_limits($limits)
2066
  if( !is_feed() )
2067
  return $limits;
2068
 
2069
- if( powerpress_is_custom_podcast_feed() || get_query_var('feed') == 'podcast' )
2070
  {
2071
  global $powerpress_feed;
2072
  if( !empty($powerpress_feed['posts_per_rss']) && preg_match('/^(\d)+$/', trim($powerpress_feed['posts_per_rss'])) )
@@ -2830,35 +2840,38 @@ function powerpress_add_redirect_url($MediaURL, $EpisodeData = false) // $channe
2830
  };
2831
  }
2832
  }
2833
-
2834
- if( !empty($GeneralSettings['taxonomy_podcasting']) ) // Taxonomy Podcasting
2835
  {
2836
- $PowerPressTaxonomies = get_option('powerpress_taxonomy_podcasting');
2837
- if( !empty($PowerPressTaxonomies) )
2838
  {
2839
- $terms = get_terms();
2840
- $ttid_found = 0;
2841
- $TaxonomySettings = false;
2842
-
2843
- while( list($index,$termObj) = each($terms) )
2844
  {
2845
- // Skip the default taxonomies
2846
- if( $termObj->taxonomy == 'category' || $termObj->taxonomy == 'link_category' || $termObj->taxonomy == 'post_tag' || $termObj->taxonomy == 'nav_menu' )
2847
- continue;
2848
 
2849
- if( !empty($PowerPressTaxonomies[ $termObj->term_taxonomy_id ]) )
2850
  {
2851
- $ttid_found = $termObj->term_taxonomy_id;
 
 
2852
 
2853
- $TaxonomySettings = get_option('powerpress_taxonomy_'.$ttid_found);
2854
- // Found it???
2855
- if( !empty($TaxonomySettings['redirect']) )
2856
  {
2857
- $Redirects['redirect0'] = $TaxonomySettings['redirect'];
2858
- $Redirects['redirect1'] = '';
2859
- $Redirects['redirect2'] = '';
2860
- $Redirects['redirect3'] = '';
2861
- break;
 
 
 
 
 
 
 
2862
  }
2863
  }
2864
  }
@@ -2890,8 +2903,8 @@ function powerpress_add_redirect_url($MediaURL, $EpisodeData = false) // $channe
2890
  $ValidRedirectDomains = array('media.blubrry.com', 'media.rawvoice.com', 'media.techpodcasts.com', 'www.podtrac.com', 'podtrac.com');
2891
  $ValidRedirectDomainsPattern = '/^(media\.blubrry\.com|media\.rawvoice\.com|media\.techpodcasts\.com|.*\.podtrac\.com|traffic\.cast\.plus)$/';
2892
  if( $URLScheme == 'https://' ) {
2893
- $ValidRedirectDomains = array('media.blubrry.com', 'media.rawvoice.com'); // Only URLs that support https:// to an https:// media file
2894
- $ValidRedirectDomainsPattern = '/^(media\.blubrry\.com|media\.rawvoice\.com)$/';
2895
  }
2896
 
2897
  $RedirectDomain = strtolower(substr($RedirectClean, 0, strpos($RedirectClean, '/') ));
@@ -3543,11 +3556,6 @@ if( defined('POWERPRESS_NEW_CODE') && POWERPRESS_NEW_CODE && file_exists(POWERPR
3543
  require_once(POWERPRESS_ABSPATH.'/powerpress-new-code.php');
3544
  }
3545
 
3546
- if( defined('POWERPRESS_PTS') && POWERPRESS_PTS && file_exists(POWERPRESS_ABSPATH.'/powerpressadmin-pts.php') )
3547
- {
3548
- require_once(POWERPRESS_ABSPATH.'/powerpressadmin-pts.php');
3549
- }
3550
-
3551
  if( defined('POWERPRESS_PREMIUM_GROUPS_PLUGIN') ) {
3552
 
3553
  function powerpress_pre_get_posts($query) {
3
  Plugin Name: Blubrry PowerPress
4
  Plugin URI: http://create.blubrry.com/resources/powerpress/
5
  Description: <a href="http://create.blubrry.com/resources/powerpress/" target="_blank">Blubrry PowerPress</a> is the No. 1 Podcasting plugin for WordPress. Developed by podcasters for podcasters; features include Simple and Advanced modes, multiple audio/video player options, subscribe to podcast tools, podcast SEO features, and more! Fully supports iTunes, Google Play, Stitcher, and Blubrry Podcasting directories, as well as all podcast applications and clients.
6
+ Version: 7.2
7
  Author: Blubrry
8
  Author URI: http://www.blubrry.com/
9
  Requires at least: 3.6
32
  die("access denied.");
33
 
34
  // WP_PLUGIN_DIR (REMEMBER TO USE THIS DEFINE IF NEEDED)
35
+ define('POWERPRESS_VERSION', '7.2' );
36
 
37
  // Translation support:
38
  if ( !defined('POWERPRESS_ABSPATH') )
50
  define('POWERPRESS_BLUBRRY_API_URL', 'http://api.blubrry.com/');
51
 
52
  // Replace validator service with one that is more reliable here:
53
+ define('POWERPRESS_FEEDVALIDATOR_URL', 'http://castfeedvalidator.com/?url=');
54
 
55
  // Display custom play image for quicktime media. Applies to on page player only.
56
  //define('POWERPRESS_PLAY_IMAGE', 'http://www.blubrry.com/themes/blubrry/images/player/PlayerBadge150x50NoBorder.jpg');
547
  echo 'posttype="'.$powerpress_feed['post_type'].'" ';
548
  if( !empty($powerpress_feed['feed-slug']) )
549
  echo 'feedslug="'.$powerpress_feed['feed-slug'].'" ';
550
+
551
+ $feedComment = apply_filters('powerpress_feed_comment', '');
552
+ $feedComment = str_replace( array('<!--', '-->'), array('|!~~', '~~>'), $feedComment);
553
+ $feedComment = trim($feedComment);
554
+ if( !empty($feedComment) )
555
+ echo $feedComment.' ';
556
+
557
+ echo 'Blubrry PowerPress Podcasting plugin for WordPress (https://www.blubrry.com/powerpress/) -->'.PHP_EOL;
558
 
559
  // add the itunes:new-feed-url tag to feed
560
  if( powerpress_is_custom_podcast_feed() )
795
 
796
  // Check and see if we're working with a podcast episode
797
  $custom_enclosure = false;
798
+ if( powerpress_is_custom_podcast_feed() && get_query_var('feed') !== 'podcast' && !is_category() && !is_tax() && !is_tag() )
799
  {
800
  $EpisodeData = powerpress_get_enclosure_data($post->ID, get_query_var('feed') );
801
  $custom_enclosure = true;
885
  echo "\t<itunes:subtitle>". powerpress_format_itunes_value($subtitle, 'subtitle') .'</itunes:subtitle>'.PHP_EOL;
886
  }
887
 
888
+ if( !empty($summary) ) {
889
+ if( $summary_cdata ) {
890
+ echo "\t\t<itunes:summary><![CDATA[". powerpress_format_itunes_value($summary, 'summary', true) .']]></itunes:summary>'.PHP_EOL;
891
+ } else {
892
+ echo "\t\t<itunes:summary>". powerpress_format_itunes_value($summary, 'summary') .'</itunes:summary>'.PHP_EOL;
 
 
893
  }
894
  }
895
 
1012
  return $content; // Another podcasting plugin is enabled...
1013
  }
1014
 
1015
+ if( powerpress_is_custom_podcast_feed() && get_query_var('feed') !== 'podcast' && !is_category() && !is_tag() && !is_tax() )
1016
  return ''; // We will handle this enclosure in the powerpress_rss2_item() function
1017
 
1018
  $match_count = preg_match('/\surl="([^"]*)"/', $content, $matches); // No URL found, weird
1224
  {
1225
  $feed_slug = 'podcast';
1226
  // IF custom post type or channel, use that feed slug...
1227
+ if( get_query_var('feed') !== 'podcast' && !is_category() && !is_tax() && !is_tag() )
1228
  $feed_slug = get_query_var('feed');
1229
 
1230
  // Get the episode specific title...
1465
  {
1466
  $GeneralSettings = get_option('powerpress_general');
1467
 
1468
+ if( !empty($GeneralSettings['powerpress-beta-features']) && file_exists(POWERPRESS_ABSPATH.'/powerpressadmin-pts.php') )
1469
+ {
1470
+ require_once(POWERPRESS_ABSPATH.'/powerpressadmin-pts.php');
1471
+ }
1472
+
1473
  if( empty($GeneralSettings['disable_appearance']) || $GeneralSettings['disable_appearance'] == false )
1474
  {
1475
  require_once( POWERPRESS_ABSPATH.'/powerpress-player.php');
1980
  return $cols;
1981
 
1982
  if( is_category() || is_tag() || is_tax() ) {
1983
+ if( get_query_var('feed') !== 'podcast' )
1984
  return $cols;
1985
  }
1986
 
1987
+ if( powerpress_is_custom_podcast_feed() || get_query_var('feed') === 'podcast' )
1988
  {
1989
  if( !empty($GLOBALS['powerpress_feed']['feed_accel']) )
1990
  {
2005
  return $join;
2006
 
2007
  if( is_category() || is_tag() || is_tax() ) {
2008
+ if( get_query_var('feed') !== 'podcast' )
2009
  return $join;
2010
  }
2011
+
2012
+ if( powerpress_is_custom_podcast_feed() || get_query_var('feed') === 'podcast' )
2013
  {
2014
  global $wpdb;
2015
  $join .= " INNER JOIN {$wpdb->postmeta} ";
2026
  if( !is_feed() )
2027
  return $where;
2028
  if( is_category() || is_tag() || is_tax() ) {
2029
+ if( get_query_var('feed') !== 'podcast' )
2030
  return $where;
2031
  }
2032
 
2033
+ if( powerpress_is_custom_podcast_feed() || get_query_var('feed') === 'podcast' )
2034
  {
2035
  global $wpdb, $powerpress_feed;
2036
  $where .= " AND (";
2037
 
2038
+ if( powerpress_is_custom_podcast_feed() && get_query_var('feed') !== 'podcast' )
2039
  $where .= " {$wpdb->postmeta}.meta_key = '_". get_query_var('feed') .":enclosure' ";
2040
  else
2041
  $where .= " {$wpdb->postmeta}.meta_key = 'enclosure' ";
2042
 
2043
  // Include Podpress data if exists...
2044
+ if( !empty($powerpress_feed['process_podpress']) && get_query_var('feed') === 'podcast' )
2045
  $where .= " OR {$wpdb->postmeta}.meta_key = 'podPressMedia' OR {$wpdb->postmeta}.meta_key = '_podPressMedia' ";
2046
 
2047
  $where .= ") ";
2058
  return $groupby;
2059
 
2060
  if( is_category() || is_tag() || is_tax() ) {
2061
+ if( get_query_var('feed') !== 'podcast' )
2062
  return $groupby;
2063
  }
2064
 
2065
+ if( powerpress_is_custom_podcast_feed() || get_query_var('feed') === 'podcast' )
2066
  {
2067
  global $wpdb;
2068
  $groupby = " {$wpdb->posts}.ID ";
2076
  if( !is_feed() )
2077
  return $limits;
2078
 
2079
+ if( powerpress_is_custom_podcast_feed() || get_query_var('feed') === 'podcast' )
2080
  {
2081
  global $powerpress_feed;
2082
  if( !empty($powerpress_feed['posts_per_rss']) && preg_match('/^(\d)+$/', trim($powerpress_feed['posts_per_rss'])) )
2840
  };
2841
  }
2842
  }
2843
+
2844
+ if( version_compare($GLOBALS['wp_version'], 4.5, '>=' ) )
2845
  {
2846
+ if( !empty($GeneralSettings['taxonomy_podcasting']) ) // Taxonomy Podcasting
 
2847
  {
2848
+ $PowerPressTaxonomies = get_option('powerpress_taxonomy_podcasting');
2849
+ if( !empty($PowerPressTaxonomies) )
 
 
 
2850
  {
2851
+ $terms = get_terms();
2852
+ $ttid_found = 0;
2853
+ $TaxonomySettings = false;
2854
 
2855
+ while( list($index,$termObj) = each($terms) )
2856
  {
2857
+ // Skip the default taxonomies
2858
+ if( $termObj->taxonomy == 'category' || $termObj->taxonomy == 'link_category' || $termObj->taxonomy == 'post_tag' || $termObj->taxonomy == 'nav_menu' )
2859
+ continue;
2860
 
2861
+ if( !empty($PowerPressTaxonomies[ $termObj->term_taxonomy_id ]) )
 
 
2862
  {
2863
+ $ttid_found = $termObj->term_taxonomy_id;
2864
+
2865
+ $TaxonomySettings = get_option('powerpress_taxonomy_'.$ttid_found);
2866
+ // Found it???
2867
+ if( !empty($TaxonomySettings['redirect']) )
2868
+ {
2869
+ $Redirects['redirect0'] = $TaxonomySettings['redirect'];
2870
+ $Redirects['redirect1'] = '';
2871
+ $Redirects['redirect2'] = '';
2872
+ $Redirects['redirect3'] = '';
2873
+ break;
2874
+ }
2875
  }
2876
  }
2877
  }
2903
  $ValidRedirectDomains = array('media.blubrry.com', 'media.rawvoice.com', 'media.techpodcasts.com', 'www.podtrac.com', 'podtrac.com');
2904
  $ValidRedirectDomainsPattern = '/^(media\.blubrry\.com|media\.rawvoice\.com|media\.techpodcasts\.com|.*\.podtrac\.com|traffic\.cast\.plus)$/';
2905
  if( $URLScheme == 'https://' ) {
2906
+ $ValidRedirectDomains = array('media.blubrry.com', 'media.rawvoice.com', 'www.podtrac.com', 'podtrac.com'); // Only URLs that support https:// to an https:// media file
2907
+ $ValidRedirectDomainsPattern = '/^(media\.blubrry\.com|media\.rawvoice\.com|.*\.podtrac\.com)$/';
2908
  }
2909
 
2910
  $RedirectDomain = strtolower(substr($RedirectClean, 0, strpos($RedirectClean, '/') ));
3556
  require_once(POWERPRESS_ABSPATH.'/powerpress-new-code.php');
3557
  }
3558
 
 
 
 
 
 
3559
  if( defined('POWERPRESS_PREMIUM_GROUPS_PLUGIN') ) {
3560
 
3561
  function powerpress_pre_get_posts($query) {
powerpressadmin-basic.php CHANGED
@@ -140,7 +140,7 @@ jQuery(document).ready(function($) {
140
  <div id="powerpress_admin_header">
141
  <h2><?php echo __('Blubrry PowerPress Settings', 'powerpress'); ?></h2>
142
  <span class="powerpress-mode"><?php echo __('Advanced Mode', 'powerpress'); ?>
143
- &nbsp; <a href="<?php echo admin_url("admin.php?page=". powerpress_admin_get_page() ."&amp;mode=simple"); ?>" id="powerpress_advanced_mode_button" class="button-primary button-blubrry"><?php echo __('Switch to Simple Mode', 'powerpress'); ?></a>
144
  </span>
145
  </div>
146
 
@@ -513,13 +513,33 @@ function powerpressadmin_edit_entry_options($General)
513
  <em><strong><?php echo __('If conflicting values are present the directories will use the default ordering.', 'powerpress'); ?></strong></em><br />
514
  <em><strong><?php echo __('This feature only applies to the default podcast feed and Custom Podcast Channel feeds added by PowerPress.', 'powerpress'); ?></strong></em>
515
 
516
- <input type="hidden" name="General[episode_box_itunes_title]' value="0" />
517
- <p style="margin-top: 15px;"><label><input id="episode_box_itunes_title" class="episode_box_option" name="General[episode_box_itunes_title]" type="checkbox" value="1"<?php if( !empty($General['episode_box_itunes_title']) ) echo ' checked'; ?> /> <?php echo __('iTunes Episode Title Field', 'powerpress'); ?></label> <?php echo powerpressadmin_new(); ?></p>
 
 
 
 
 
 
 
 
 
518
  <em><strong><?php echo __('Specify iTunes episode title separate from podcast feed title.', 'powerpress'); ?></strong></em>
 
519
 
520
- <input type="hidden" name="General[episode_box_itunes_nst]' value="0" />
521
- <p style="margin-top: 15px;"><label><input id="episode_box_itunes_nst" class="episode_box_option" name="General[episode_box_itunes_nst]" type="checkbox" value="1"<?php if( !empty($General['episode_box_itunes_nst']) ) echo ' checked'; ?> /> <?php echo __('iTunes Episode Number, Season and Type Fields', 'powerpress'); ?></label> <?php echo powerpressadmin_new(); ?></p>
 
 
 
 
 
 
 
 
 
522
  <em><strong><?php echo __('Enter specifics about episode including episode number, season number and type (full, trailer, or bonus).', 'powerpress'); ?></strong></em>
 
523
 
524
  <p style="margin-top: 15px;"><label><input id="episode_box_feature_in_itunes" class="episode_box_option" name="General[episode_box_feature_in_itunes]" type="checkbox" value="1"<?php if( !empty($General['episode_box_feature_in_itunes']) ) echo ' checked'; ?> /> <?php echo __('Feature Episode in iTunes and Google Play Music', 'powerpress'); ?></label>
525
  (<?php echo __('Display selected episode at top of your iTunes and Google Play Music directory listings', 'powerpress'); ?>)</p>
@@ -1208,10 +1228,8 @@ function powerpressadmin_appearance($General=false, $Feed = false)
1208
  </li>
1209
  </ul>
1210
  <p><input name="General[display_player_excerpt]" type="checkbox" value="1" <?php if( !empty($General['display_player_excerpt']) ) echo 'checked '; ?>/> <?php echo __('Display player / links:', 'powerpress'); ?> <a href="http://codex.wordpress.org/Template_Tags/the_excerpt" title="<?php echo __('WordPress Excerpts', 'powerpress'); ?>" target="_blank"><?php echo __('WordPress Excerpts', 'powerpress'); ?></a> (<?php echo __('e.g. search results', 'powerpress'); ?>)</p>
1211
-
1212
  <input type="hidden" name="General[hide_player_more]" value="0" />
1213
  <p><input name="General[hide_player_more]" type="checkbox" value="1" <?php if( !empty($General['hide_player_more']) ) echo 'checked '; ?>/> <?php echo __('Hide player / links:', 'powerpress'); ?> <a href="https://en.support.wordpress.com/more-tag/" title="<?php echo __('Read More tagged posts', 'powerpress'); ?>" target="_blank"><?php echo __('Read More tagged posts', 'powerpress'); ?></a></p>
1214
-
1215
  </td>
1216
  </tr>
1217
  </table>
140
  <div id="powerpress_admin_header">
141
  <h2><?php echo __('Blubrry PowerPress Settings', 'powerpress'); ?></h2>
142
  <span class="powerpress-mode"><?php echo __('Advanced Mode', 'powerpress'); ?>
143
+ &nbsp; <a href="<?php echo admin_url("admin.php?page=". urlencode(powerpress_admin_get_page()) ."&amp;mode=simple"); ?>" id="powerpress_advanced_mode_button" class="button-primary button-blubrry"><?php echo __('Switch to Simple Mode', 'powerpress'); ?></a>
144
  </span>
145
  </div>
146
 
513
  <em><strong><?php echo __('If conflicting values are present the directories will use the default ordering.', 'powerpress'); ?></strong></em><br />
514
  <em><strong><?php echo __('This feature only applies to the default podcast feed and Custom Podcast Channel feeds added by PowerPress.', 'powerpress'); ?></strong></em>
515
 
516
+ <?php if( empty($General['ios11_fields']) || $General['ios11_fields'] == 2 ) { ?>
517
+ <p><label><select name="General[ebititle]" class="bpp_input_sm">
518
+ <?php
519
+ $linkoptions = array('false'=>__('Hide Field', 'powerpress'),
520
+ 1=>__('Show Field', 'powerpress') );
521
+
522
+ while( list($value,$desc) = each($linkoptions) )
523
+ echo "\t<option value=\"$value\"". ( !empty($General['episode_box_itunes_title']) && $General['episode_box_itunes_title'] == $value ?' selected':''). ">$desc</option>\n";
524
+
525
+ ?>
526
+ </select> <?php echo __('iTunes Episode Title Field', 'powerpress'); ?></label> <?php echo powerpressadmin_new(); ?></p>
527
  <em><strong><?php echo __('Specify iTunes episode title separate from podcast feed title.', 'powerpress'); ?></strong></em>
528
+ <?php } // end episode_box_itunes_title ?>
529
 
530
+ <?php if( empty($General['ios11_fields']) || $General['ios11_fields'] == 4 ) { ?>
531
+ <p><label><select name="General[ebinst]" class="bpp_input_sm">
532
+ <?php
533
+ $linkoptions = array('false'=>__('Hide Field', 'powerpress'),
534
+ 1=>__('Show Field', 'powerpress') );
535
+
536
+ while( list($value,$desc) = each($linkoptions) )
537
+ echo "\t<option value=\"$value\"". ( !empty($General['episode_box_itunes_nst']) && $General['episode_box_itunes_nst'] == $value ?' selected':''). ">$desc</option>\n";
538
+
539
+ ?>
540
+ </select> <?php echo __('iTunes Episode Number, Season and Type Fields', 'powerpress'); ?></label> <?php echo powerpressadmin_new(); ?></p>
541
  <em><strong><?php echo __('Enter specifics about episode including episode number, season number and type (full, trailer, or bonus).', 'powerpress'); ?></strong></em>
542
+ <?php } // end episode_box_itunes_title ?>
543
 
544
  <p style="margin-top: 15px;"><label><input id="episode_box_feature_in_itunes" class="episode_box_option" name="General[episode_box_feature_in_itunes]" type="checkbox" value="1"<?php if( !empty($General['episode_box_feature_in_itunes']) ) echo ' checked'; ?> /> <?php echo __('Feature Episode in iTunes and Google Play Music', 'powerpress'); ?></label>
545
  (<?php echo __('Display selected episode at top of your iTunes and Google Play Music directory listings', 'powerpress'); ?>)</p>
1228
  </li>
1229
  </ul>
1230
  <p><input name="General[display_player_excerpt]" type="checkbox" value="1" <?php if( !empty($General['display_player_excerpt']) ) echo 'checked '; ?>/> <?php echo __('Display player / links:', 'powerpress'); ?> <a href="http://codex.wordpress.org/Template_Tags/the_excerpt" title="<?php echo __('WordPress Excerpts', 'powerpress'); ?>" target="_blank"><?php echo __('WordPress Excerpts', 'powerpress'); ?></a> (<?php echo __('e.g. search results', 'powerpress'); ?>)</p>
 
1231
  <input type="hidden" name="General[hide_player_more]" value="0" />
1232
  <p><input name="General[hide_player_more]" type="checkbox" value="1" <?php if( !empty($General['hide_player_more']) ) echo 'checked '; ?>/> <?php echo __('Hide player / links:', 'powerpress'); ?> <a href="https://en.support.wordpress.com/more-tag/" title="<?php echo __('Read More tagged posts', 'powerpress'); ?>" target="_blank"><?php echo __('Read More tagged posts', 'powerpress'); ?></a></p>
 
1233
  </td>
1234
  </tr>
1235
  </table>
powerpressadmin-dashboard.php CHANGED
@@ -207,7 +207,7 @@ function powerpress_dashboard_stats_content()
207
  }
208
  else if( empty($content) )
209
  {
210
- $content = sprintf(__('Error: A network or authentication error occurred. To verify your account, click the link &quot;click here to configure Blubrry Statistics and Hosting services&quot; found in the %s tab.', 'powerpress'), '<a href="'. admin_url("admin.php?page=powerpress/powerpressadmin_basic.php") .'#tab2">'.__('Services &amp; Statistics'.'</a>', 'powerpress') );
211
  }
212
 
213
  ?>
207
  }
208
  else if( empty($content) )
209
  {
210
+ $content = sprintf(__('Error: A network or authentication error occurred. To verify your account, click the link &quot;click here to configure Blubrry Statistics and Hosting services&quot; found in the %s tab.', 'powerpress'), '<a href="'. admin_url("admin.php?page=powerpressadmin_basic") .'#tab2">'.__('Services &amp; Statistics'.'</a>', 'powerpress') );
211
  }
212
 
213
  ?>
powerpressadmin-defaults.php CHANGED
@@ -83,7 +83,7 @@ jQuery(document).ready(function($) {
83
  <div id="powerpress_admin_header">
84
  <h2><?php echo __('Blubrry PowerPress Settings', 'powerpress'); ?></h2>
85
  <span class="powerpress-mode"><?php echo __('Simple Mode', 'powerpress'); ?>
86
- &nbsp; <a href="<?php echo admin_url("admin.php?page=powerpress/powerpressadmin_basic.php&amp;mode=advanced"); ?>" id="powerpress_advanced_mode_button" class="button-primary button-blubrry"><?php echo __('Switch to Advanced Mode', 'powerpress'); ?></a>
87
  </span>
88
  </div>
89
 
83
  <div id="powerpress_admin_header">
84
  <h2><?php echo __('Blubrry PowerPress Settings', 'powerpress'); ?></h2>
85
  <span class="powerpress-mode"><?php echo __('Simple Mode', 'powerpress'); ?>
86
+ &nbsp; <a href="<?php echo admin_url("admin.php?page=". urlencode(powerpress_admin_get_page()) ."&amp;mode=advanced"); ?>" id="powerpress_advanced_mode_button" class="button-primary button-blubrry"><?php echo __('Switch to Advanced Mode', 'powerpress'); ?></a>
87
  </span>
88
  </div>
89
 
powerpressadmin-diagnostics.php CHANGED
@@ -12,7 +12,7 @@
12
  $powerpress_diags['detecting_media']['warning'] = false;
13
  $powerpress_diags['detecting_media']['allow_url_fopen'] = (ini_get( 'allow_url_fopen' ) != false); // fopen
14
  $powerpress_diags['detecting_media']['curl'] = function_exists( 'curl_init' ); // cURL
15
- $powerpress_diags['detecting_media']['message2'] = ''; // if ( !ini_get('safe_mode') && !ini_get('open_basedir') )
16
  $powerpress_diags['detecting_media']['message3'] = ''; // ssl checks
17
 
18
  // Testing:
@@ -25,17 +25,7 @@
25
  if( $powerpress_diags['detecting_media']['allow_url_fopen'] )
26
  $powerpress_diags['detecting_media']['message'] .= ' '. __('Your web server is also configured with the php.ini setting \'allow_url_fopen\' enabled, but the cURL library takes precedence.', 'powerpress');
27
 
28
- if( ini_get('safe_mode') && ini_get('open_basedir') )
29
- {
30
- $powerpress_diags['detecting_media']['warning'] = true;
31
- $powerpress_diags['detecting_media']['message2'] = __('Warning: Both php.ini settings \'safe_mode\' and \'open_basedir\' will prevent the cURL library from following redirects in URLs.', 'powerpress');
32
- }
33
- else if( ini_get('safe_mode') )
34
- {
35
- $powerpress_diags['detecting_media']['warning'] = true;
36
- $powerpress_diags['detecting_media']['message2'] = __('Warning: The php.ini setting \'safe_mode\' will prevent the cURL library from following redirects in URLs.', 'powerpress');
37
- }
38
- else if( ini_get('open_basedir') )
39
  {
40
  $powerpress_diags['detecting_media']['warning'] = true;
41
  $powerpress_diags['detecting_media']['message2'] = __('Warning: The php.ini setting \'open_basedir\' will prevent the cURL library from following redirects in URLs.', 'powerpress');
@@ -143,17 +133,17 @@
143
  }
144
  $powerpress_diags['system_info']['memory_used'] = 0;
145
 
146
- if( version_compare($powerpress_diags['system_info']['php_version'], '5.4') > -1 )
147
  {
148
  $powerpress_diags['system_info']['message'] = sprintf( __('Your version of PHP (%s) is OK!', 'powerpress'), $powerpress_diags['system_info']['php_version'] );
149
  }
150
- else if( version_compare($powerpress_diags['system_info']['php_version'], '5.3') > -1 )
151
  {
152
- $powerpress_diags['system_info']['message'] = sprintf( __('Your version of PHP (%s) is OK, though PHP 5.4 or newer is recommended.', 'powerpress'), $powerpress_diags['system_info']['php_version'] );
153
  }
154
  else
155
  {
156
- $powerpress_diags['system_info']['message'] = sprintf( __('Your version of PHP (%s) will work, but PHP 5.4 or newer is recommended.', 'powerpress'), $powerpress_diags['system_info']['php_version'] );
157
  }
158
 
159
  $used = 0;
@@ -238,7 +228,6 @@
238
  if( !empty($wpmu_version) )
239
  $message .= __('WordPress MU Version:', 'powerpress') .' '. $wpmu_version . "<br />\n";
240
  $message .= __('System:', 'powerpress') .' '. $_SERVER['SERVER_SOFTWARE'] . "<br />\n";
241
- $message .= __('Safe node:', 'powerpress') .' '. ( ini_get('safe_mode')?'true':'false') ."<br />\n";
242
  $message .= __('Open basedir:', 'powerpress') .' '. ini_get('open_basedir') ."<br />\n";
243
 
244
  // Crutial PowerPress Settings
12
  $powerpress_diags['detecting_media']['warning'] = false;
13
  $powerpress_diags['detecting_media']['allow_url_fopen'] = (ini_get( 'allow_url_fopen' ) != false); // fopen
14
  $powerpress_diags['detecting_media']['curl'] = function_exists( 'curl_init' ); // cURL
15
+ $powerpress_diags['detecting_media']['message2'] = ''; // if ( !ini_get('open_basedir') )
16
  $powerpress_diags['detecting_media']['message3'] = ''; // ssl checks
17
 
18
  // Testing:
25
  if( $powerpress_diags['detecting_media']['allow_url_fopen'] )
26
  $powerpress_diags['detecting_media']['message'] .= ' '. __('Your web server is also configured with the php.ini setting \'allow_url_fopen\' enabled, but the cURL library takes precedence.', 'powerpress');
27
 
28
+ if( ini_get('open_basedir') )
 
 
 
 
 
 
 
 
 
 
29
  {
30
  $powerpress_diags['detecting_media']['warning'] = true;
31
  $powerpress_diags['detecting_media']['message2'] = __('Warning: The php.ini setting \'open_basedir\' will prevent the cURL library from following redirects in URLs.', 'powerpress');
133
  }
134
  $powerpress_diags['system_info']['memory_used'] = 0;
135
 
136
+ if( version_compare($powerpress_diags['system_info']['php_version'], '7.0') > -1 )
137
  {
138
  $powerpress_diags['system_info']['message'] = sprintf( __('Your version of PHP (%s) is OK!', 'powerpress'), $powerpress_diags['system_info']['php_version'] );
139
  }
140
+ else if( version_compare($powerpress_diags['system_info']['php_version'], '5.4') > -1 )
141
  {
142
+ $powerpress_diags['system_info']['message'] = sprintf( __('Your version of PHP (%s) is OK, though PHP 7.0 or newer is recommended.', 'powerpress'), $powerpress_diags['system_info']['php_version'] );
143
  }
144
  else
145
  {
146
+ $powerpress_diags['system_info']['message'] = sprintf( __('Your version of PHP (%s) will work, but PHP 7.0 or newer is recommended.', 'powerpress'), $powerpress_diags['system_info']['php_version'] );
147
  }
148
 
149
  $used = 0;
228
  if( !empty($wpmu_version) )
229
  $message .= __('WordPress MU Version:', 'powerpress') .' '. $wpmu_version . "<br />\n";
230
  $message .= __('System:', 'powerpress') .' '. $_SERVER['SERVER_SOFTWARE'] . "<br />\n";
 
231
  $message .= __('Open basedir:', 'powerpress') .' '. ini_get('open_basedir') ."<br />\n";
232
 
233
  // Crutial PowerPress Settings
powerpressadmin-editfeed.php CHANGED
@@ -69,12 +69,14 @@ function powerpress_languages()
69
  $langs['in'] = __('Indonesian', 'powerpress');
70
  $langs['ga'] = __('Irish', 'powerpress');
71
  $langs['it'] = __('Italian', 'powerpress');
 
72
  $langs['it-it'] = __('Italian (Italy)', 'powerpress');
73
  $langs['it-ch'] = __('Italian (Switzerland)', 'powerpress');
74
  $langs['ja'] = __('Japanese', 'powerpress');
75
  $langs['ko'] = __('Korean', 'powerpress');
76
  $langs['mk'] = __('Macedonian', 'powerpress');
77
  $langs['no'] = __('Norwegian', 'powerpress');
 
78
  $langs['pl'] = __('Polish', 'powerpress');
79
  $langs['pt'] = __('Portuguese', 'powerpress');
80
  $langs['pt-br'] = __('Portuguese (Brazil)', 'powerpress');
@@ -391,6 +393,8 @@ function powerpressadmin_edit_feed_general($FeedSettings, $General)
391
 
392
  while( list($feed_slug, $feed_title) = each($Feeds) )
393
  {
 
 
394
  $edit_link = admin_url( 'admin.php?page=powerpress/powerpressadmin_customfeeds.php&amp;action=powerpress-editfeed&amp;feed_slug=') . $feed_slug;
395
  ?>
396
  <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>
@@ -417,7 +421,7 @@ function powerpressadmin_edit_feed_general($FeedSettings, $General)
417
  <th scope="row">
418
  <?php echo __('Feed Discovery', 'powerpress'); ?></th>
419
  <td>
420
- <p style="margin-top: 10px;"><label><input type="checkbox" name="General[feed_links]" value="1" <?php if( !empty($General['feed_links']) && $General['feed_links'] == 1 ) echo 'checked '; ?>/> <?php echo __('Include podcast feed links in HTML headers.', 'powerpress'); ?></label></p>
421
  <p><?php echo __('Adds "feed discovery" links to your web site\'s headers allowing web browsers and feed readers to auto-detect your podcast feeds.', 'powerpress'); ?></p>
422
  </td>
423
  </tr>
@@ -983,6 +987,7 @@ while( list($value,$desc) = each($explicit) )
983
  </td>
984
  </tr>
985
 
 
986
  <tr valign="top">
987
  <th scope="row">
988
  <?php echo __('iTunes Type', 'powerpress'); ?>
@@ -1006,6 +1011,7 @@ while( list($value,$desc) = each($types) )
1006
  </p>
1007
  </td>
1008
  </tr>
 
1009
  </table>
1010
 
1011
  <?php if( !empty($General['advanced_mode_2']) ) { ?>
69
  $langs['in'] = __('Indonesian', 'powerpress');
70
  $langs['ga'] = __('Irish', 'powerpress');
71
  $langs['it'] = __('Italian', 'powerpress');
72
+ $langs['hi'] = __('Hindi', 'powerpress');
73
  $langs['it-it'] = __('Italian (Italy)', 'powerpress');
74
  $langs['it-ch'] = __('Italian (Switzerland)', 'powerpress');
75
  $langs['ja'] = __('Japanese', 'powerpress');
76
  $langs['ko'] = __('Korean', 'powerpress');
77
  $langs['mk'] = __('Macedonian', 'powerpress');
78
  $langs['no'] = __('Norwegian', 'powerpress');
79
+ $langs['pa'] = __('Punjabi', 'powerpress');
80
  $langs['pl'] = __('Polish', 'powerpress');
81
  $langs['pt'] = __('Portuguese', 'powerpress');
82
  $langs['pt-br'] = __('Portuguese (Brazil)', 'powerpress');
393
 
394
  while( list($feed_slug, $feed_title) = each($Feeds) )
395
  {
396
+ if( empty($feed_title) )
397
+ $feed_title = $feed_slug;
398
  $edit_link = admin_url( 'admin.php?page=powerpress/powerpressadmin_customfeeds.php&amp;action=powerpress-editfeed&amp;feed_slug=') . $feed_slug;
399
  ?>
400
  <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>
421
  <th scope="row">
422
  <?php echo __('Feed Discovery', 'powerpress'); ?></th>
423
  <td>
424
+ <p style="margin-top: 10px;"><label><input type="checkbox" name="General[feed_links]" value="1" <?php if( !empty($General['feed_links']) && $General['feed_links'] == 1 ) echo 'checked '; ?>/> <?php echo __('Exclude podcast feed links in HTML headers.', 'powerpress'); ?></label></p>
425
  <p><?php echo __('Adds "feed discovery" links to your web site\'s headers allowing web browsers and feed readers to auto-detect your podcast feeds.', 'powerpress'); ?></p>
426
  </td>
427
  </tr>
987
  </td>
988
  </tr>
989
 
990
+ <?php if( empty($General['ios11_fields']) || $General['ios11_fields'] == 1 ) { ?>
991
  <tr valign="top">
992
  <th scope="row">
993
  <?php echo __('iTunes Type', 'powerpress'); ?>
1011
  </p>
1012
  </td>
1013
  </tr>
1014
+ <?php } // end type ?>
1015
  </table>
1016
 
1017
  <?php if( !empty($General['advanced_mode_2']) ) { ?>
powerpressadmin-jquery.php CHANGED
@@ -617,7 +617,7 @@ function DeleteMedia(File)
617
  <h2><?php echo __('Blubrry Services', 'powerpress'); ?></h2>
618
  <p style="text-align: center;"><strong><?php echo __('Settings Saved Successfully!', 'powerpress'); ?></strong></p>
619
  <p style="text-align: center;">
620
- <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>
621
  </p>
622
  <script type="text/javascript"><!--
623
 
@@ -878,6 +878,12 @@ self.parent.tb_remove();
878
 
879
  function powerpress_admin_jquery_header($title, $jquery = false)
880
  {
 
 
 
 
 
 
881
  $other = false;
882
  if( $jquery )
883
  add_thickbox(); // we use the thckbox for some settings
617
  <h2><?php echo __('Blubrry Services', 'powerpress'); ?></h2>
618
  <p style="text-align: center;"><strong><?php echo __('Settings Saved Successfully!', 'powerpress'); ?></strong></p>
619
  <p style="text-align: center;">
620
+ <a href="<?php echo admin_url("admin.php?page=powerpressadmin_basic"); ?>" onclick="self.parent.tb_remove(); return false;" target="_top"><?php echo __('Close', 'powerpress'); ?></a>
621
  </p>
622
  <script type="text/javascript"><!--
623
 
878
 
879
  function powerpress_admin_jquery_header($title, $jquery = false)
880
  {
881
+ header( "Expires: Mon, 26 Jul 1997 05:00:00 GMT" );
882
+ header( "Last-Modified: " . gmdate( "D, d M Y H:i:s" ) . "GMT" );
883
+ header( 'Cache-Control: no-store, no-cache, must-revalidate' );
884
+ header( 'Cache-Control: post-check=0, pre-check=0', false );
885
+ header( 'Pragma: no-cache' );
886
+
887
  $other = false;
888
  if( $jquery )
889
  add_thickbox(); // we use the thckbox for some settings
powerpressadmin-metabox.php CHANGED
@@ -370,7 +370,7 @@ function powerpress_meta_box($object, $box)
370
  <?php
371
  }
372
 
373
- $DoNST = ( !empty($ExtraData['episode_no']) || !empty($ExtraData['episode_season']) || !empty($ExtraData['episode_type']) || !empty($GeneralSettings['episode_box_itunes_nst']) );
374
  if( $DoNST ) {
375
  echo '<div class="powerpress_row">';
376
  echo '<label>'. __('iTunes Episode', 'powerpress') .'</label>';
@@ -379,8 +379,8 @@ function powerpress_meta_box($object, $box)
379
  if( empty($ExtraData['episode_no']) ) {
380
  $ExtraData['episode_no'] = '';
381
  }
382
- if( empty($ExtraData['episode_season']) ) {
383
- $ExtraData['episode_season'] = '';
384
  }
385
  if( empty($ExtraData['episode_type']) ) {
386
  $ExtraData['episode_type'] = '';
370
  <?php
371
  }
372
 
373
+ $DoNST = ( !empty($ExtraData['episode_no']) || !empty($ExtraData['season']) || !empty($ExtraData['episode_type']) || !empty($GeneralSettings['episode_box_itunes_nst']) );
374
  if( $DoNST ) {
375
  echo '<div class="powerpress_row">';
376
  echo '<label>'. __('iTunes Episode', 'powerpress') .'</label>';
379
  if( empty($ExtraData['episode_no']) ) {
380
  $ExtraData['episode_no'] = '';
381
  }
382
+ if( empty($ExtraData['season']) ) {
383
+ $ExtraData['season'] = '';
384
  }
385
  if( empty($ExtraData['episode_type']) ) {
386
  $ExtraData['episode_type'] = '';
powerpressadmin-notifications.php CHANGED
@@ -175,11 +175,11 @@ if( powerpressadmin_notifications_appropriate() ) {
175
  $message .= __('iTunes Update, February, 2016 - Blubrry PowerPress', 'powerpress');
176
  $message .= '</h3>';
177
  $message .= __('Apple now recommends using a 3000 x 3000 pixel JPG or PNG in the RGB color space in a compressed format. Saving your image as a JPG with your favorite image editing software should automatically compress your image to optimize for mobile devices.', 'powerpress');
178
- $message .= ' &mdash; <a href="'. admin_url("admin.php?page=powerpress/powerpressadmin_basic.php#tab7") .'">'. __('Update Now', 'powerpress') .'</a>';
179
  $message .= ' | <a href="http://www.powerpresspodcast.com/2016/02/19/new-itunes-podcast-directory-recommendations-february-2016/" target="_blank">'. __('Learn More', 'powerpress') .'</a>';
180
  $message .= "\n\n";
181
  $message .= __('Apple has changed the iTunes explicit setting. <strong>You <i>must</i> now select "clean" or "explicit"</strong> - the \'no\' option is no longer available', 'powerpress');
182
- $message .= ' &mdash; <a href="'. admin_url("admin.php?page=powerpress/powerpressadmin_basic.php#tab5") .'">'. __('Update Now', 'powerpress') .'</a>';
183
  $message .= ' | <a href="http://www.powerpresspodcast.com/2016/02/19/new-itunes-podcast-directory-recommendations-february-2016/" target="_blank">'. __('Learn More', 'powerpress') .'</a>';
184
  $message .= "\n\n";
185
  $message .= __('Podcast submissions to the iTunes podcast directory are now managed by the new <a href="https://podcastsconnect.apple.com/" target="_blank">Podcast Connect</a> website. The new website allows you to submit new podcasts, as well as refresh, hide and delete your current podcast listings.', 'powerpress');
175
  $message .= __('iTunes Update, February, 2016 - Blubrry PowerPress', 'powerpress');
176
  $message .= '</h3>';
177
  $message .= __('Apple now recommends using a 3000 x 3000 pixel JPG or PNG in the RGB color space in a compressed format. Saving your image as a JPG with your favorite image editing software should automatically compress your image to optimize for mobile devices.', 'powerpress');
178
+ $message .= ' &mdash; <a href="'. admin_url("admin.php?page=powerpressadmin_basic#tab7") .'">'. __('Update Now', 'powerpress') .'</a>';
179
  $message .= ' | <a href="http://www.powerpresspodcast.com/2016/02/19/new-itunes-podcast-directory-recommendations-february-2016/" target="_blank">'. __('Learn More', 'powerpress') .'</a>';
180
  $message .= "\n\n";
181
  $message .= __('Apple has changed the iTunes explicit setting. <strong>You <i>must</i> now select "clean" or "explicit"</strong> - the \'no\' option is no longer available', 'powerpress');
182
+ $message .= ' &mdash; <a href="'. admin_url("admin.php?page=powerpressadmin_basic#tab5") .'">'. __('Update Now', 'powerpress') .'</a>';
183
  $message .= ' | <a href="http://www.powerpresspodcast.com/2016/02/19/new-itunes-podcast-directory-recommendations-february-2016/" target="_blank">'. __('Learn More', 'powerpress') .'</a>';
184
  $message .= "\n\n";
185
  $message .= __('Podcast submissions to the iTunes podcast directory are now managed by the new <a href="https://podcastsconnect.apple.com/" target="_blank">Podcast Connect</a> website. The new website allows you to submit new podcasts, as well as refresh, hide and delete your current podcast listings.', 'powerpress');
powerpressadmin-player-page.php CHANGED
@@ -124,8 +124,9 @@ function powerpress_admin_players($type='audio')
124
  $Video['mediaelement-video'] = 'http://media.blubrry.com/blubrry/content.blubrry.com/blubrry/MediaElement_video.mp4';
125
 
126
  wp_enqueue_style( 'wp-color-picker' );
127
-
128
- if( $type == 'video' && function_exists('add_videojs_header') )
 
129
  add_videojs_header();
130
  ?>
131
  <link rel="stylesheet" href="<?php echo powerpress_get_root_url(); ?>3rdparty/colorpicker/css/colorpicker.css" type="text/css" />
@@ -157,10 +158,55 @@ function UpdatePlayerPreview(name, value)
157
  if( typeof(update_audio_player) != "undefined" ) // Update the 1 px out player...
158
  update_audio_player();
159
  }
160
-
161
  jQuery(document).ready(function($) {
162
-
163
- jQuery('.color_preview').ColorPicker({
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
164
  onSubmit: function(hsb, hex, rgb, el) {
165
  jQuery(el).css({ 'background-color' : '#' + hex });
166
  jQuery(el).ColorPickerHide();
@@ -409,7 +455,7 @@ table.html5formats tr > td:first-child {
409
  switch( $General['player'] )
410
  {
411
  case 'audio-player': {
412
-
413
  $PlayerSettings = powerpress_get_settings('powerpress_audio-player');
414
  if($PlayerSettings == ""):
415
  $PlayerSettings = array(
@@ -965,35 +1011,197 @@ function audio_player_defaults()
965
 
966
  <?php
967
  }; break;
968
-
969
- case 'blubrryaudio' : {
970
-
971
- ?>
972
- <p><?php echo __('Configure Blubrry Audio Player', 'powerpress'); ?></p>
973
- <table class="form-table">
974
- <tr valign="top">
975
- <th scope="row">
976
- <?php echo __('Preview of Player', 'powerpress'); ?>
977
- </th>
978
- <td>
979
- <?php print_blubrry_player_demo(); ?>
980
-
981
- <!-- <p><input name="General[itunes_image_audio]" type="hidden" value="0"/><input name="General[itunes_image_audio]" type="checkbox" value="1" <?php echo ( !empty($General['itunes_image_audio'])?'checked':''); ?> /> <?php echo __('Use episode iTunes image if set', 'powerpress'); ?> </p> -->
982
-
983
- <p>
984
- <?php echo __('Episode level iTunes image if set will be displayed in the player. The URLs to the images must be https:// in order to appear on social networking sites.', 'powerpress'); ?>
985
- </p>
986
-
987
- <p><input name="General[episode_box_itunes_image]" type="hidden" value="0" /><input name="General[episode_box_itunes_image]" type="checkbox" value="1" <?php echo ( !empty($General['episode_box_itunes_image']) ?'checked':''); ?> /> <?php echo __('Display iTunes episode image field', 'powerpress'); ?> </p>
988
- <p><input name="General[bp_episode_image]" type="hidden" value="0" /><input name="General[bp_episode_image]" type="checkbox" value="1" <?php echo ( !empty($General['bp_episode_image']) ?'checked':''); ?> /> <?php echo __('Use iTunes episode image with player', 'powerpress'); ?> </p>
989
- </td>
990
- </tr>
991
 
992
- </table>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
993
 
994
- <?php
995
 
996
- }; break;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
997
  case 'mediaelement-audio': {
998
  $SupportUploads = powerpressadmin_support_uploads();
999
 
124
  $Video['mediaelement-video'] = 'http://media.blubrry.com/blubrry/content.blubrry.com/blubrry/MediaElement_video.mp4';
125
 
126
  wp_enqueue_style( 'wp-color-picker' );
127
+ wp_enqueue_script( 'wp-color-picker');
128
+
129
+ if( $type == 'video' && function_exists('add_videojs_header') )
130
  add_videojs_header();
131
  ?>
132
  <link rel="stylesheet" href="<?php echo powerpress_get_root_url(); ?>3rdparty/colorpicker/css/colorpicker.css" type="text/css" />
158
  if( typeof(update_audio_player) != "undefined" ) // Update the 1 px out player...
159
  update_audio_player();
160
  }
161
+
162
  jQuery(document).ready(function($) {
163
+ generatePlayerHash();
164
+
165
+ function generatePlayerHash(){
166
+ var time = $("input.time-form").val();
167
+ if(time==='') {
168
+ time = '0';
169
+ }
170
+ var darkorlightval = $("input[name='BBPlayer[playerstyle]']:checked").val();
171
+ var color1=$('input[name="BBPlayer[showbg]"]').val();
172
+ var color2=$('input[name="BBPlayer[downloadbgcolor]"]').val();
173
+ var color3=$('input[name="BBPlayer[subscribebg]"]').val();
174
+ var color4=$('input[name="BBPlayer[bgshare]"]').val();
175
+ var fontcolor1 = $('input[name="BBPlayer[showtext]"]').val();
176
+ var fontcolor2 = $('input[name="BBPlayer[downloadcolortext]"]').val();
177
+ var fontcolor3 = $('input[name="BBPlayer[textsubscribe]"]').val();
178
+ var fontcolor4 = $('input[name="BBPlayer[textshare]"]').val();
179
+ var addition = '#time-'+time+"&darkOrLight-"+darkorlightval+"&shownotes-"+fontcolor1.substring(1)+"&shownotesBackground-"+color1.substring(1)+
180
+ "&download-"+fontcolor2.substring(1)+"&downloadBackground-"+color2.substring(1)+"&subscribe-"+fontcolor3.substring(1)+"&subscribeBackground-"+color3.substring(1)+
181
+ "&share-"+fontcolor4.substring(1)+"&shareBackground-"+color4.substring(1);
182
+
183
+ document.getElementById('player_iframe_div').innerHTML ='<iframe src="//player.blubrry.com?podcast_id=12559710' + addition + '" id="playeriframe" scrolling="no" width="100%" height="138px" frameborder="0"></iframe>';
184
+ }
185
+
186
+ function restoreDefaultColors(){
187
+ document.getElementById('player_iframe_div').innerHTML ='<iframe src="//player.blubrry.com?podcast_id=12559710" id="playeriframe" scrolling="no" width="100%" height="138px" frameborder="0"></iframe>';
188
+
189
+ $('input[name="BBPlayer[downloadbgcolor]"]').wpColorPicker('color',"#003366");
190
+ $('input[name="BBPlayer[downloadcolortext]"]').wpColorPicker('color',"#ffffff");
191
+ $('input[name="BBPlayer[subscribebg]"]').wpColorPicker('color',"#fb8c00");
192
+ $('input[name="BBPlayer[textsubscribe]"]').wpColorPicker('color',"#ffffff");
193
+ $('input[name="BBPlayer[bgshare]"]').wpColorPicker('color', "#1976d2");
194
+ $('input[name="BBPlayer[textshare]"]').wpColorPicker('color',"#ffffff");
195
+ $('input[name="BBPlayer[showbg]"]').wpColorPicker('color',"#444444");
196
+ $('input[name="BBPlayer[showtext]"]').wpColorPicker('color',"#ffffff");
197
+
198
+ $("input:radio[name='BBPlayer[playerstyle]'][value='light']").prop('checked', true);
199
+ }
200
+
201
+ jQuery('.color-field').wpColorPicker({
202
+ // change: function(){
203
+ // }
204
+ });
205
+
206
+ document.getElementById("previewButton").addEventListener ("click", generatePlayerHash);
207
+ document.getElementById("restoreDefaultsButton").addEventListener ("click", restoreDefaultColors);
208
+
209
+ jQuery('.color_preview').ColorPicker({
210
  onSubmit: function(hsb, hex, rgb, el) {
211
  jQuery(el).css({ 'background-color' : '#' + hex });
212
  jQuery(el).ColorPickerHide();
455
  switch( $General['player'] )
456
  {
457
  case 'audio-player': {
458
+
459
  $PlayerSettings = powerpress_get_settings('powerpress_audio-player');
460
  if($PlayerSettings == ""):
461
  $PlayerSettings = array(
1011
 
1012
  <?php
1013
  }; break;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1014
 
1015
+ case 'blubrryaudio' : { //TODO
1016
+ $BBplayerSettings = powerpress_get_settings('powerpress_bplayer');
1017
+ if (empty($BBplayerSettings)) {
1018
+ $BBplayerSettings = array(
1019
+ 'showbg' => '#444444',
1020
+ 'showtext' => '#ffffff',
1021
+ 'downloadbgcolor' => '#003366',
1022
+ 'downloadcolortext' => '#ffffff',
1023
+ 'subscribebg' => '#fb8c00',
1024
+ 'textsubscribe' => '#ffffff',
1025
+ 'bgshare' => '#1976d2',
1026
+ 'textshare' => '#ffffff',
1027
+ 'playerstyle' => 'light'
1028
+ );
1029
+ }
1030
+ ?>
1031
 
 
1032
 
1033
+ <div id="tab_play" class="powerpress_tab bbplayer_settings" style="padding-left: 3%; padding-right: 3%">
1034
+ <h2 style="font-size: 2em;"> <?php echo __('Blubrry Player', 'powerpress'); ?> </h2>
1035
+ <p>
1036
+ <?php echo __('Note: The Blubrry Audio Player is only available to Blubrry Hosting Customers.', 'powerpress'); ?>
1037
+ </p>
1038
+ <p>
1039
+ <?php echo __('Shownotes and Download options are not displayed initially.', 'powerpress'); ?>
1040
+ </p>
1041
+ <div id="player_iframe_div"
1042
+ style="border: 1px solid #000000; height: 138px; box-shadow: inset 0 0 10px black, 0 0 6px black; margin: 20px 0;">
1043
+ <?php //print_blubrry_player_demo(); ?>
1044
+ </div>
1045
+ <br>
1046
+
1047
+ <table class="form-table">
1048
+ <tr>
1049
+ <td>
1050
+ <a href="#" id="previewButton"
1051
+ style="font-weight: bold; color: #1976d2; font-size: 12px"><?php echo __('Preview Changes', 'powerpress'); ?></a>
1052
+
1053
+ </td>
1054
+ <td>
1055
+ <a href="#" id="restoreDefaultsButton"
1056
+ style="font-weight: bold; color: #1976d2; font-size: 12px"><?php echo __('Restore Default Colors', 'powerpress'); ?></a>
1057
+
1058
+ </td>
1059
+ </tr>
1060
+ <h3 style="font-size: 2em; margin-bottom: 5px; color: #23282d; font-weight: 500"><?php echo __('Player Customization Settings', 'powerpress'); ?></h3>
1061
+
1062
+ <tr valign="top" style="margin-bottom: -15px;">
1063
+ <th scope="row">
1064
+ <h3> <?php echo __('Buttons', 'powerpress'); ?> </h3>
1065
+ </th>
1066
+
1067
+ <th scope="row">
1068
+ <h3> <?php echo __('Background Color', 'powerpress'); ?> </h3>
1069
+ </th>
1070
+
1071
+ <th scope="row">
1072
+ <h3> <?php echo __('Font Color', 'powerpress'); ?> </h3>
1073
+ </th>
1074
+
1075
+ </tr>
1076
+ <tr valign="top">
1077
+ <th scope="row">
1078
+ <?php echo __('Shownotes/Embed Button', 'powerpress'); ?>
1079
+ </th>
1080
+ <td>
1081
+
1082
+ <div class="color_control">
1083
+ <input type="text" style="width: 100px;" id="shownotesbg" name="BBPlayer[showbg]"
1084
+ class="color-field"
1085
+ value="<?php echo esc_attr($BBplayerSettings['showbg']); ?>"
1086
+ maxlength="20"/>
1087
+ </div>
1088
+ </td>
1089
+ <td>
1090
+ <div class="color_control">
1091
+ <input type="text" style="width: 100px;" id="showtext"
1092
+ name="BBPlayer[showtext]" class="color-field"
1093
+ value="<?php echo esc_attr($BBplayerSettings['showtext']); ?>"
1094
+ maxlength="20"/>
1095
+ </div>
1096
+ </td>
1097
+ </tr>
1098
+ <tr valign="top">
1099
+ <th scope="row">
1100
+ <?php echo __('Download Button', 'powerpress'); ?>
1101
+ </th>
1102
+ <td>
1103
+ <div class="color_control">
1104
+ <input type="text" style="width: 100px;" id="downloadbgcolor"
1105
+ name="BBPlayer[downloadbgcolor]"
1106
+ class="color-field"
1107
+ value="<?php echo esc_attr($BBplayerSettings['downloadbgcolor']); ?>"
1108
+ maxlength="20"/>
1109
+ </div>
1110
+ </td>
1111
+ <td>
1112
+ <div class="color_control">
1113
+ <input type="text" style="width: 100px;" id="downloadcolortext"
1114
+ name="BBPlayer[downloadcolortext]"
1115
+ class="color-field"
1116
+ value="<?php echo esc_attr($BBplayerSettings['downloadcolortext']); ?>"
1117
+ maxlength="20"/>
1118
+ </div>
1119
+ </td>
1120
+ </tr>
1121
+ <tr valign="top">
1122
+ <th scope="row">
1123
+ <?php echo __('Subscribe Button', 'powerpress'); ?>
1124
+ </th>
1125
+ <td>
1126
+ <div class="color_control">
1127
+ <input type="text" style="width: 100px;" id="subscribebg" name="BBPlayer[subscribebg]"
1128
+ class="color-field"
1129
+ value="<?php echo esc_attr($BBplayerSettings['subscribebg']); ?>"
1130
+ maxlength="20"/>
1131
+ </div>
1132
+ </td>
1133
+ <td>
1134
+ <div class="color_control">
1135
+ <input type="text" style="width: 100px;" id="textsubscribe"
1136
+ name="BBPlayer[textsubscribe]" class="color-field"
1137
+ value="<?php echo esc_attr($BBplayerSettings['textsubscribe']); ?>"
1138
+ maxlength="20"/>
1139
+ </div>
1140
+ </td>
1141
+ </tr>
1142
+ <tr valign="top">
1143
+ <th scope="row">
1144
+ <?php echo __('Share Button', 'powerpress'); ?>
1145
+ </th>
1146
+ <td>
1147
+ <div class="color_control">
1148
+ <input type="text" style="width: 100px;" id="bgshare" name="BBPlayer[bgshare]"
1149
+ class="color-field"
1150
+ value="<?php echo esc_attr($BBplayerSettings['bgshare']); ?>"
1151
+ maxlength="20"/>
1152
+ </div>
1153
+ </td>
1154
+ <td>
1155
+ <div class="color_control">
1156
+ <input type="text" style="width: 100px;" id="textshare" name="BBPlayer[textshare]"
1157
+ class="color-field"
1158
+ value="<?php echo esc_attr($BBplayerSettings['textshare']); ?>"
1159
+ maxlength="20"/>
1160
+ </div>
1161
+ </td>
1162
+
1163
+ </tr>
1164
+
1165
+ <tr valign="top">
1166
+ <br>
1167
+
1168
+ <th scope="row">
1169
+ <h3><?php echo __('Player Style', 'powerpress'); ?> </h3>
1170
+ </th>
1171
+ <td>
1172
+ <input type="radio" name="BBPlayer[playerstyle]" id="selectlight"
1173
+ value="light" <?php echo ($BBplayerSettings['playerstyle'] == 'light') ? 'checked = true' : ''; ?>>
1174
+ <label for="selectlight" style="font-size:14px;">Light (default)</label>
1175
+ </td>
1176
+ <td>
1177
+ <input type="radio" name="BBPlayer[playerstyle]" id="selectdark"
1178
+ value="dark" <?php echo ($BBplayerSettings['playerstyle'] == 'dark') ? 'checked = true' : ''; ?> >
1179
+ <label for="selectdark" style="font-size:14px;">Dark</label>
1180
+ </td>
1181
+ </tr>
1182
+
1183
+ <!-- <p><input name="General[itunes_image_audio]" type="hidden" value="0"/><input name="General[itunes_image_audio]" type="checkbox" value="1" <?php echo(!empty($General['itunes_image_audio']) ? 'checked' : ''); ?> /> <?php echo __('Use episode iTunes image if set', 'powerpress'); ?> </p> -->
1184
+ </table>
1185
+ <h3><?php echo __('Episode Image', 'powerpress'); ?></h3>
1186
+
1187
+ <p>
1188
+ <?php echo __('If the option is checked and an episode level iTunes image is set, it will be used for the player instead of the coverart. The URLs to the images must be https:// in order to appear on social networking sites.', 'powerpress'); ?>
1189
+ </p>
1190
+
1191
+ <p><input name="General[episode_box_itunes_image]" type="hidden" value="0"/><input
1192
+ name="General[episode_box_itunes_image]" type="checkbox"
1193
+ value="1" <?php echo(!empty($General['episode_box_itunes_image']) ? 'checked' : ''); ?> /> <?php echo __('Display field for entering iTunes episode image ', 'powerpress'); ?>
1194
+ </p>
1195
+ <p><input name="General[bp_episode_image]" type="hidden" value="0"/><input
1196
+ name="General[bp_episode_image]" type="checkbox"
1197
+ value="1" <?php echo(!empty($General['bp_episode_image']) ? 'checked' : ''); ?> /> <?php echo __('Use iTunes episode image with player', 'powerpress'); ?>
1198
+ </p>
1199
+ </div>
1200
+ <input type="hidden" name="action" value="powerpress_bplayer"/>
1201
+
1202
+ <?php
1203
+ };break;
1204
+
1205
  case 'mediaelement-audio': {
1206
  $SupportUploads = powerpressadmin_support_uploads();
1207
 
powerpressadmin-player.php CHANGED
@@ -38,5 +38,10 @@ function powerpress_admin_players_init()
38
  powerpress_page_message_add_notice( __('Audio Player settings saved successfully.', 'powerpress') );
39
 
40
  }; break;
 
 
 
 
 
41
  }
42
  }
38
  powerpress_page_message_add_notice( __('Audio Player settings saved successfully.', 'powerpress') );
39
 
40
  }; break;
41
+ case 'powerpress_bplayer':{ //blubrry player
42
+ $SaveSettings = $_POST['BBPlayer'];
43
+ powerpress_save_settings($SaveSettings, 'powerpress_bplayer');
44
+ powerpress_page_message_add_notice( __('Blubrry Player settings saved successfully.', 'powerpress') );
45
+ }; break;
46
  }
47
  }
powerpressadmin-pts.php ADDED
@@ -0,0 +1,482 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Class PowerPressPostToSocial
4
+ */
5
+ class PowerPressPostToSocial {
6
+ // member variables
7
+
8
+
9
+ // constructor
10
+ /**
11
+ * PowerPressPostToSocial constructor.
12
+ */
13
+ function __construct() {
14
+ // WordPress hooks go here
15
+ add_action( 'load-post.php', array( $this, 'my_add_metabox_setup' ) );
16
+ add_action( 'load-post-new.php', array( $this, 'my_add_metabox_setup' ) );
17
+ add_action( 'do_pings', array( $this , 'do_pings' ), 11, 0 );
18
+ }
19
+
20
+ // destructor
21
+ /**
22
+ *
23
+ */
24
+ function __destruct() {
25
+
26
+ }
27
+
28
+ // other functions //
29
+
30
+ /**
31
+ *
32
+ */
33
+ function my_add_metabox_setup() {
34
+ add_action( 'add_meta_boxes', array($this, 'my_add_metabox') );
35
+ }
36
+
37
+ /**
38
+ *
39
+ */
40
+ function my_add_metabox() {
41
+ add_meta_box( 'pps_pts', __( 'PowerPress Post to Social', 'powerpress' ), array($this, 'display_my_metabox'), 'post', 'side', 'default' );
42
+ }
43
+
44
+ /**
45
+ *
46
+ */
47
+ function display_my_metabox() {
48
+
49
+
50
+ $can_post = false;
51
+ if ( get_post_status( get_the_ID() ) == 'publish' ) {
52
+ $post_id = get_the_ID();
53
+ $guid = urlencode( get_the_guid() );
54
+
55
+ $EpisodeData = powerpress_get_enclosure_data($post_id);
56
+ if( !empty($EpisodeData) ) {
57
+ add_thickbox();
58
+ echo "<strong styleX='font-size: 115%; display: block; text-align: center;'><a class='thickbox button button-primary button-large' href='admin.php?action=powerpress-jquery-pts&width=600&height=550&post_id={$post_id}&guid={$guid}&TB_iframe=true' target='blank' title='Post to Social'>Post to Social</a></strong>";
59
+ $can_post = true;
60
+ echo "<br><br>\n";
61
+ }
62
+ }
63
+ else {
64
+ echo "Post to Social";
65
+ }
66
+ echo " ";
67
+ echo "Status: "; // What is the status of the posting to social?
68
+ if ( get_post_status( get_the_ID() ) == 'publish' ) {
69
+ if ( get_post_meta( get_the_ID(), 'pts_scheduled', true ) ) {
70
+ _e( 'Episode posted to social sites.', 'powerpress' );
71
+ }
72
+ else if( $can_post == false ) {
73
+
74
+ _e( 'No podcast episode available in this post to send to social sites.', 'powerpress' );
75
+ } else {
76
+ _e( 'Nothing posted yet.', 'powerpress' );
77
+ echo ' ';
78
+ echo "<a class='thickbox' href='admin.php?action=powerpress-jquery-pts&width=600&height=550&post_id={$post_id}&guid={$guid}&TB_iframe=true' target='blank'>Post Now!</a>";
79
+ }
80
+ }
81
+ else {
82
+ echo "This post must be published before you can post to social sharing sites.";
83
+ }
84
+
85
+ echo "<p style=\"font-size: 85%; margin-top: 20px;\">";
86
+ echo 'About: Post podcast episodes to Twitter, YouTube and Facebook using Blubrry\'s <a href="https://create.blubrry.com/resources/podcast-media-hosting/post-to-social/" target="_blank">Post to Social</a> service.';
87
+ echo "</p>";
88
+ }
89
+
90
+ function do_pings() {
91
+ $Settings = powerpress_get_settings( 'powerpress_general' );
92
+
93
+ $post_id = get_the_ID();
94
+ $program_keyword = $Settings['blubrry_program_keyword'];
95
+ $guid = get_the_guid();
96
+
97
+ $enclosure_data = powerpress_get_enclosure_data( $post_id );
98
+ if ( !empty( $enclosure_data ) ) {
99
+ $results = callUpdateListing($post_id, $program_keyword, $guid);
100
+ $podcast_id = $results['podcast-id'];
101
+
102
+ add_post_meta( $post_id, 'podcast-id', $podcast_id, true );
103
+ }
104
+ }
105
+ }
106
+
107
+ /**
108
+ * @param int $post_id
109
+ * @param string $program_keyword
110
+ * @param string $guid
111
+ * @return array|mixed|object|string
112
+ */
113
+ function callUpdateListing( $post_id, $program_keyword, $guid ) {
114
+ $Settings = powerpress_get_settings('powerpress_general');
115
+ $episodeData = powerpress_get_enclosure_data( $post_id );
116
+ if( empty($episodeData['duration']) )
117
+ $episodeData['duration'] = '';
118
+
119
+ $subtitle = '';
120
+ if( !empty($episodeData['subtitle']) )
121
+ $subtitle = $episodeData['subtitle'];
122
+
123
+ if ( empty( $subtitle ) && !empty($episodeData['summary']) ) {
124
+ $subtitle = substr( $episodeData['summary'], 0, 255 );
125
+ }
126
+ if ( empty( $subtitle ) ) {
127
+ $subtitle = powerpress_get_the_exerpt( false, true, $post_id );
128
+ }
129
+ if ( empty( $subtitle ) ) {
130
+ $subtitle = substr( get_the_content( $post_id ), 0, 255 );
131
+ }
132
+
133
+ $FeedSettings = powerpress_get_settings( 'powerpress_feed' );
134
+
135
+ $post_params = array(
136
+ 'feed-url' => '', // required
137
+ 'title' => get_the_title( $post_id ), // required
138
+ 'date' => get_the_date( 'r', $post_id ), // required
139
+ 'guid' => $guid,
140
+ 'media-url' => $episodeData['url'], // required
141
+ 'subtitle' => $subtitle,
142
+ 'duration' => $episodeData['duration'], // hh:mm:ss format; we assume no podcast episode will exceed 24 hours
143
+ 'filesize' => $episodeData['size'], // required
144
+ 'explicit' => $FeedSettings['itunes_explicit'],
145
+ 'link' => get_the_permalink( $post_id ),
146
+ 'image' => $FeedSettings['itunes_image'],
147
+ );
148
+
149
+ $api_url_array = powerpress_get_api_array();
150
+
151
+ foreach ( $api_url_array as $api_url ) {
152
+ $response = powerpress_remote_fopen( "{$api_url}social/{$program_keyword}/update-listing.json", $Settings['blubrry_auth'], json_encode( $post_params ) );
153
+
154
+ mail('cio@rawvoice.com', 'update listing response', $response);
155
+ if ( $response ) {
156
+ break;
157
+ }
158
+ }
159
+
160
+ if ( $response ) {
161
+ $result = json_decode( $response, true );
162
+ if( !empty($result) )
163
+ return $result;
164
+
165
+ return $response;
166
+ }
167
+ else {
168
+ return false;
169
+ }
170
+ }
171
+
172
+ /**
173
+ * @param string $program_keyword
174
+ * @return array|mixed|object|string
175
+ */
176
+ function callGetSocialOptions( $program_keyword ) {
177
+ $Settings = powerpress_get_settings( 'powerpress_general' );
178
+
179
+ $api_url_array = powerpress_get_api_array();
180
+
181
+ foreach ( $api_url_array as $api_url ) {
182
+ $response = powerpress_remote_fopen("{$api_url}social/{$program_keyword}/get-social-options.json", $Settings['blubrry_auth'] );
183
+
184
+ if ( $response ) {
185
+ break;
186
+ }
187
+ }
188
+
189
+ if ( $response ) {
190
+ return json_decode( $response, true );
191
+ }
192
+ }
193
+
194
+ /**
195
+ * Generates an HTML text input
196
+ *
197
+ * @param $label
198
+ * @param string $name
199
+ * @param string $value
200
+ *
201
+ * @param string $placeholder
202
+ * @param string $help_text
203
+ * @param int $rows
204
+ * @param int $maxlength
205
+ *
206
+ * @return string
207
+ */
208
+ function generate_text_field( $label, $name, $value='', $placeholder='', $help_text='', $rows=1, $maxlength=4000 ) {
209
+ $text_field = '<div class="form-group">' ."\n";
210
+ $text_field .= "<label for='{$name}'>{$label}</label>\n";
211
+
212
+ if ( $rows === 1 ) {
213
+ $text_field .= '<input type="text" ';
214
+ }
215
+ else {
216
+ $text_field .= "<textarea rows='{$rows}'";
217
+ }
218
+
219
+ $text_field .= "name='{$name}' ";
220
+ $text_field .= "id='{$name}' ";
221
+ $text_field .= "placeholder='{$placeholder}' ";
222
+ $text_field .= "maxlength='{$maxlength}' ";
223
+
224
+ if ( $rows === 1 ) {
225
+ $text_field .= "value='{$value}' ";
226
+ }
227
+
228
+ $text_field .= "class='form-control' aria-describedby='{$name}-help'>";
229
+ if ( $rows > 1 ) {
230
+ $text_field .= $value;
231
+ $text_field .= '</textarea>';
232
+ }
233
+
234
+ $text_field .= "\n<span id='{$name}-help' class='help-block'>{$help_text}</span>";
235
+ $text_field .= "\n</div>";
236
+ return $text_field;
237
+ }
238
+
239
+ /**
240
+ * Generates an HTML checkbox input
241
+ *
242
+ * @param string $label
243
+ * @param string $name
244
+ * @param string $value
245
+ * @param string $checked 'checked' to have the box checked, '' otherwise
246
+ *
247
+ * @return string
248
+ */
249
+ function generate_checkbox( $label, $name, $value, $checked='' ) {
250
+ $checkbox = '<label>' ."\n";
251
+ $checkbox .= "<input type='checkbox' name='{$name}' value='{$value}' {$checked}> {$label}\n";
252
+ $checkbox .= '</label>' ."\n";
253
+
254
+ return $checkbox;
255
+ }
256
+
257
+ /**
258
+ * Generates an HTML radio input
259
+ *
260
+ * @param string $label
261
+ * @param string $name
262
+ * @param string $value
263
+ * @param string $checked 'checked' to have the radio selected, '' otherwise
264
+ *
265
+ * @return string
266
+ */
267
+ function generate_radio( $label, $name, $value, $checked='' ) {
268
+ $checkbox = '<label>' ."\n";
269
+ $checkbox .= "<input type='radio' name='{$name}' value='{$value}' {$checked}> {$label}\n";
270
+ $checkbox .= '</label>' ."\n";
271
+
272
+ return $checkbox;
273
+ }
274
+
275
+ function powerpress_ajax_pts($Settings)
276
+ {
277
+ //$Settings = powerpress_get_settings('powerpress_general');
278
+ powerpress_admin_jquery_header( __( 'Post to Social', 'powerpress' ) );
279
+
280
+ if ( !current_user_can('publish_posts' ) ) {
281
+ powerpress_page_message_add_notice( __( 'You do not have sufficient permission to do this.', 'powerpress' ) );
282
+ powerpress_page_message_print();
283
+ ?>
284
+ <p style="text-align: center;"><a href="#" onclick="self.parent.tb_remove();"><?php echo __( 'Close', 'powerpress' ); ?></a></p>
285
+ <?php
286
+ powerpress_admin_jquery_footer();
287
+ exit;
288
+ }
289
+
290
+ if ( empty( $Settings['blubrry_program_keyword'] ) ) {
291
+ powerpress_page_message_add_notice( __( 'You must connect your Blubrry account and set up a program.', 'powerpress' ) );
292
+ powerpress_page_message_print();
293
+ ?>
294
+ <p style="text-align: center;"><a href="#" onclick="self.parent.tb_remove();"><?php echo __( 'Close', 'powerpress' ); ?></a></p>
295
+ <?php
296
+ powerpress_admin_jquery_footer();
297
+ exit;
298
+ }
299
+
300
+ // Make API calls here //
301
+ $program_keyword = $Settings['blubrry_program_keyword'];
302
+ $post_id = (int) $_GET['post_id'];
303
+ $guid = urldecode( $_GET['guid'] );
304
+
305
+ // make sure the podcast episode is in the Blubrry directory using the `update-listing` api call
306
+ if ( get_post_meta( $post_id, 'podcast-id', true ) ) {
307
+ $response = array( 'podcast-id' => get_post_meta( $post_id, 'podcast-id', true ) );
308
+ }
309
+ else {
310
+ $response = callUpdateListing( $post_id, $program_keyword, $guid );
311
+ }
312
+
313
+ if ( !is_array( $response ) ) { // an error occurred\
314
+ echo "<br /><br />";
315
+ echo $response;
316
+ //var_dump($response);
317
+ exit;
318
+ }
319
+
320
+ //die('ok2');
321
+
322
+ if ( isset( $response['error'] ) ) {
323
+ powerpress_page_message_add_notice( $response['error'] );
324
+ powerpress_page_message_print();
325
+ ?>
326
+ <p style="text-align: center;"><a href="#" onclick="self.parent.tb_remove();"><?php echo __( 'Close', 'powerpress' ); ?></a></p>
327
+ <?php
328
+ powerpress_admin_jquery_footer();
329
+ exit;
330
+ }
331
+
332
+ if ( isset( $response['warnings'] ) ) {
333
+ powerpress_page_message_add_notice( $response['warnings'] );
334
+ powerpress_page_message_print();
335
+ }
336
+
337
+ $podcast_id = $response['podcast-id'];
338
+ add_post_meta( $post_id, 'podcast-id', $podcast_id, true );
339
+
340
+ // get the info necessary to create the post to social form using the `get-social-options` api call
341
+ $response = callGetSocialOptions( $program_keyword );
342
+
343
+ if ( !is_array( $response ) ) { // a cURL error occurred
344
+ echo $response;
345
+ exit;
346
+ }
347
+
348
+ if ( isset( $response['error'] ) ) {
349
+ powerpress_page_message_add_notice( __( 'There was a problem fetching your post to social settings. ', 'powerpress' ) .$response['error'] );
350
+ powerpress_page_message_print();
351
+ ?>
352
+ <p style="text-align: center;"><a href="#" onclick="self.parent.tb_remove();"><?php echo __( 'Close', 'powerpress' ); ?></a></p>
353
+ <?php
354
+ powerpress_admin_jquery_footer();
355
+ exit;
356
+ }
357
+
358
+ // build the post to social form
359
+ if( !empty($response['success']) )
360
+ echo "<h3>{$response['success']}</h3>";
361
+ //else
362
+ //var_dump($response);
363
+ ?>
364
+ <script>var linkel = document.createElement('link'); linkel.rel = 'stylesheet'; linkel.href = 'https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css'; document.head.appendChild(linkel);</script>
365
+ <script src="https://code.jquery.com/jquery-3.2.1.min.js" integrity="sha256-hwg4gsxgFZhOsEEamdOYGBf13FyQuiTwlAQgxVSNgt4=" crossorigin="anonymous"></script>
366
+
367
+ <form action="admin.php?action=powerpress-jquery-pts-post" method="POST">
368
+ <input type="hidden" name="podcast-id" value="<?php echo $podcast_id; ?>">
369
+ <input type="hidden" name="post-id" value="<?php echo $post_id; ?>">
370
+ <?php
371
+ foreach ( $response['social-options'] as $option ) {
372
+ echo '<h4>' ."<img src='{$option['social-image']}'>" .$option['social-title'] .'</h4>';
373
+
374
+ foreach ( $option['form-data'] as $form_field ) {
375
+ if( !isset($form_field['value']) )
376
+ $form_field['value'] = '';
377
+ if( !isset($form_field['placeholder']) )
378
+ $form_field['placeholder'] = '';
379
+ if( !isset($form_field['help-text']) )
380
+ $form_field['help-text'] = '';
381
+ if( !isset($form_field['maxlength']) )
382
+ $form_field['maxlength'] = '';
383
+ if( !isset($form_field['checked']) )
384
+ $form_field['checked'] = '';
385
+
386
+ $label = htmlspecialchars( $form_field['label'] );
387
+
388
+ if ( $form_field['field-type'] == 'input-text' ) {
389
+ $rows = (!empty($form_field['rows']) ? $form_field['rows'] : 1);
390
+ echo generate_text_field( $label, $option['social-type'] . '-' . $form_field['name'], $form_field['value'], htmlspecialchars( $form_field['placeholder'] ), htmlspecialchars( $form_field['help-text'] ), $rows, $form_field['maxlength'] );
391
+ }
392
+ elseif ( $form_field['field-type'] == 'input-checkbox' ) {
393
+ echo generate_checkbox( $label, $option['social-type'] . '-' . $form_field['name'], $form_field['value'], $form_field['checked'] );
394
+ }
395
+ elseif ( $form_field['field-type'] == 'input-radio' ) {
396
+ echo generate_radio( $label, $option['social-type'] . '-' . $form_field['name'], $form_field['value'], $form_field['checked'] );
397
+ }
398
+ }
399
+ }
400
+ ?>
401
+ <br>
402
+ <button type="submit">Submit</button>
403
+ </form>
404
+ <p style="text-align: center;"><a href="#" onclick="self.parent.tb_remove();"><?php echo __( 'Close', 'powerpress' ); ?></a></p>
405
+ <?php
406
+ powerpress_admin_jquery_footer();
407
+ }
408
+
409
+ function powerpress_ajax_pts_post($Settings)
410
+ {
411
+ powerpress_admin_jquery_header( __( 'Post to Social', 'powerpress' ) );
412
+
413
+ //$Settings = powerpress_get_settings('powerpress_general');
414
+
415
+ $api_url_array = powerpress_get_api_array();
416
+
417
+ $program_keyword = $Settings['blubrry_program_keyword'];
418
+ $podcast_id = $_POST['podcast-id'];
419
+ $post_id = $_POST['post-id'];
420
+
421
+ unset( $_POST['podcast-id'] );
422
+ unset( $_POST['post-id'] );
423
+
424
+ $post_data = array();
425
+
426
+ foreach ( $_POST as $key => $value ) {
427
+ if ( $value ) { // we don't allow empty messages to be posted to social media
428
+
429
+ preg_match("/-(\d+)-?/", $key, $matches);
430
+ $social_id = $matches[1];
431
+
432
+ preg_match("/^(\w+)-/i", $key, $matches);
433
+ $social_type = strtolower($matches[1]);
434
+
435
+ if ( !isset( $post_data[ $social_id ] ) ) {
436
+ $post_data[ $social_id ] = array(
437
+ 'social-id' => $social_id,
438
+ 'social-type' => $social_type,
439
+ );
440
+ }
441
+
442
+ if ( !isset( $post_data[ $social_id ]['social-data'] ) ) {
443
+ $post_data[ $social_id ]['social-data'] = array();
444
+ }
445
+
446
+ $field_name = preg_replace( "/^\w+-/i", "", $key );
447
+
448
+ $post_data[ $social_id ]['social-data'][ $field_name ] = $value;
449
+ }
450
+ }
451
+
452
+ $post_params = array( 'podcast-id' => $podcast_id, 'post-data' => $post_data );
453
+
454
+ foreach ( $api_url_array as $api_url ) {
455
+ $response = powerpress_remote_fopen( "{$api_url}social/{$program_keyword}/post.json", $Settings['blubrry_auth'], json_encode( $post_params ) );
456
+
457
+ if ( $response ) {
458
+ break;
459
+ }
460
+ }
461
+
462
+ $response = json_decode( $response, true );
463
+
464
+ if ( $response['status'] == 'success' ) {
465
+ powerpress_page_message_add_notice( __( 'Post to social has been scheduled.', 'powerpress' ) );
466
+ powerpress_page_message_print();
467
+
468
+ add_post_meta( $post_id, 'pts_scheduled', 1, true );
469
+ }
470
+ else {
471
+ powerpress_page_message_add_notice( $response['error'] );
472
+ powerpress_page_message_print();
473
+ }
474
+ ?>
475
+ <p style="text-align: center;"><a href="#" onclick="self.parent.tb_remove();"><?php echo __( 'Close', 'powerpress' ); ?></a></p>
476
+ <?php
477
+ powerpress_admin_jquery_footer();
478
+ }
479
+
480
+ $powerpress_PTS = new PowerPressPostToSocial();
481
+
482
+
powerpressadmin-tools.php CHANGED