PowerPress Podcasting plugin by Blubrry - Version 9.3

Version Description

  • Released on 08/22/2022
  • Support for transcripts thru Blubrry
Download this release

Release Info

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

Code changes from version 9.2.1 to 9.3

css/admin.css CHANGED
@@ -8,6 +8,7 @@
8
  border-radius: 4px;
9
  border: none;
10
  padding: 1ch 1em;
 
11
  }
12
 
13
  #powerpress_settings .form-table th {
8
  border-radius: 4px;
9
  border: none;
10
  padding: 1ch 1em;
11
+ cursor: pointer;
12
  }
13
 
14
  #powerpress_settings .form-table th {
js/admin.js CHANGED
@@ -560,6 +560,65 @@ function powerpress_epboxPCIToggle(el){
560
  }
561
  }
562
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
563
  function unlinkAccount(idForm)
564
  {
565
  let unlinkInput = jQuery('<input name="unlinkAccount" hidden>');
560
  }
561
  }
562
 
563
+ function setTranscriptCheckboxes(id, feed_slug){
564
+ let noTranscript = jQuery('#powerpress_transcript_none_' + feed_slug);
565
+ let generateTranscript = jQuery('#powerpress_transcript_generate_' + feed_slug);
566
+ let uploadTranscript = jQuery('#powerpress_pci_transcript_' + feed_slug);
567
+ let uploadTranscriptInput = jQuery('#powerpress_pci_transcript_container_' + feed_slug);
568
+
569
+ switch(id){
570
+ case 'powerpress_transcript_none_' + feed_slug:
571
+ generateTranscript.attr("checked", false);
572
+ uploadTranscript.attr("checked", false);
573
+ if(typeof jQuery.prop === 'function') {
574
+ generateTranscript.prop("checked", false);
575
+ uploadTranscript.prop("checked", false);
576
+ }
577
+ uploadTranscriptInput.removeAttr("style");
578
+ uploadTranscriptInput.attr("style", "display: none");
579
+ break;
580
+
581
+ case 'powerpress_transcript_generate_' + feed_slug:
582
+ noTranscript.attr("checked", false);
583
+ uploadTranscript.attr("checked", false);
584
+ if(typeof jQuery.prop === 'function') {
585
+ noTranscript.prop("checked", false);
586
+ uploadTranscript.prop("checked", false);
587
+ }
588
+ uploadTranscriptInput.removeAttr("style");
589
+ uploadTranscriptInput.attr("style", "display: none");
590
+ break;
591
+
592
+ case 'powerpress_pci_transcript_' + feed_slug:
593
+
594
+ noTranscript.attr("checked", false);
595
+ generateTranscript.attr("checked", false);
596
+ if(typeof jQuery.prop === 'function') {
597
+ noTranscript.prop("checked", false);
598
+ generateTranscript.prop("checked", false);
599
+ }
600
+ uploadTranscriptInput.removeAttr("style");
601
+ uploadTranscriptInput.attr("style", "display: block");
602
+ break;
603
+ }
604
+ }
605
+
606
+ function showHideTranscriptBox(id, value, hasHosting, feed_slug){
607
+ id = '#' + id;
608
+ let showHideCheckbox = jQuery(id);
609
+ let optionsBox = jQuery('#transcript-box-options-' + feed_slug);
610
+
611
+ if(value === '0'){
612
+ optionsBox.prop('style', 'margin-top: 1.5em;display: block;');
613
+ showHideCheckbox.val('1');
614
+ } else {
615
+ optionsBox.prop('style', 'display: none;');
616
+ showHideCheckbox.val('0');
617
+ }
618
+
619
+
620
+ }
621
+
622
  function unlinkAccount(idForm)
623
  {
624
  let unlinkInput = jQuery('<input name="unlinkAccount" hidden>');
powerpress-player.php CHANGED
@@ -288,8 +288,8 @@ function powerpress_generate_embed($player, $EpisodeData) // $post_id, $feed_slu
288
  {
289
  if( empty($EpisodeData['id']) && empty($EpisodeData['feed']) )
290
  return '';
291
-
292
- if( $player == 'blubrryaudio' )
293
  {
294
  $extension = powerpressplayer_get_extension($EpisodeData['url']);
295
  if( $extension == 'mp3' || $extension == 'm4a' )
@@ -495,7 +495,8 @@ function powerpressplayer_player_audio($content, $media_url, $EpisodeData = arra
495
 
496
  switch( $Settings['player'] )
497
  {
498
- case 'blubrryaudio': {
 
499
  $content .= powerpressplayer_build_blubrryaudio($media_url, $EpisodeData);
500
  }; break;
501
  case 'html5audio': {
@@ -516,7 +517,8 @@ function powerpressplayer_player_audio($content, $media_url, $EpisodeData = arra
516
 
517
  switch( $Settings['player'] )
518
  {
519
- case 'blubrryaudio': {
 
520
  $content .= powerpressplayer_build_blubrryaudio($media_url, $EpisodeData);
521
  }; break;
522
  case 'html5audio': {
@@ -1364,10 +1366,17 @@ function powerpressplayer_build_blubrryaudio($media_url, $EpisodeData=array(), $
1364
  $hash = str_replace('#','',$hash); //remove # symbol from hex colors
1365
  $hash = '#'.$hash;
1366
  }
 
1367
  if( !empty($EpisodeData['episode_id']) ) {
1368
- $url = 'https://player.blubrry.com/?podcast_id='. intval($EpisodeData['episode_id']);
 
 
 
1369
  } else {
1370
  $url = 'https://player.blubrry.com/?media_url='. urlencode($media_url);
 
 
 
1371
  if( !empty($EpisodeData['id']) ) {
1372
  // Get permalink URL
1373
  $permalink = get_permalink( $EpisodeData['id'] );
@@ -1375,7 +1384,6 @@ function powerpressplayer_build_blubrryaudio($media_url, $EpisodeData=array(), $
1375
  $url.= '&amp;podcast_link='. urlencode($permalink);
1376
  }
1377
  if( !empty($EpisodeData['itunes_image']) ) {
1378
- $GeneralSettings = get_option('powerpress_general');
1379
  if(isset($GeneralSettings['bp_episode_image']) && $GeneralSettings['bp_episode_image'] != false)
1380
  $url.= '&amp;artwork_url='. urlencode($EpisodeData['itunes_image']);
1381
  }
@@ -1392,17 +1400,28 @@ function powerpressplayer_build_blubrryaudio($media_url, $EpisodeData=array(), $
1392
  $GLOBALS['powerpress_skipto_player'][ get_the_ID() ][ $feedSlug ] = $playerID;
1393
 
1394
  $iframeTitle = esc_attr( __('Blubrry Podcast Player', 'powerpress') );
1395
-
1396
- return '<iframe src="'. $url .'" scrolling="no" width="100%" height="138px" frameborder="0" id="'. $playerID .'" class="blubrryplayer" title="' . $iframeTitle . '"></iframe>';
 
 
 
1397
  }
1398
 
1399
  return powerpressplayer_build_mediaelementaudio($media_url, $EpisodeData, $embed);
1400
  }
1401
 
1402
- function powerpressplayer_build_blubrryaudio_by_id($directory_episode_id)
1403
  {
1404
- $iframeTitle = esc_attr( __('Blubrry Podcast Player', 'powerpress') );
1405
- return '<iframe src="https://player.blubrry.com?podcast_id='. $directory_episode_id .'" id="playeriframe" class="blubrryplayer" scrolling="no" width="100%" height="138px" frameborder="0" title="' . $iframeTitle . '"></iframe>';
 
 
 
 
 
 
 
 
1406
  }
1407
 
1408
  /*
288
  {
289
  if( empty($EpisodeData['id']) && empty($EpisodeData['feed']) )
290
  return '';
291
+
292
+ if( $player == 'blubrryaudio' || $player == 'blubrrymodern')
293
  {
294
  $extension = powerpressplayer_get_extension($EpisodeData['url']);
295
  if( $extension == 'mp3' || $extension == 'm4a' )
495
 
496
  switch( $Settings['player'] )
497
  {
498
+ case 'blubrryaudio':
499
+ case 'blubrrymodern': {
500
  $content .= powerpressplayer_build_blubrryaudio($media_url, $EpisodeData);
501
  }; break;
502
  case 'html5audio': {
517
 
518
  switch( $Settings['player'] )
519
  {
520
+ case 'blubrryaudio':
521
+ case 'blubrrymodern': {
522
  $content .= powerpressplayer_build_blubrryaudio($media_url, $EpisodeData);
523
  }; break;
524
  case 'html5audio': {
1366
  $hash = str_replace('#','',$hash); //remove # symbol from hex colors
1367
  $hash = '#'.$hash;
1368
  }
1369
+ $GeneralSettings = get_option('powerpress_general');
1370
  if( !empty($EpisodeData['episode_id']) ) {
1371
+ $url = 'https://player.blubrry.com/?podcast_id='. intval($EpisodeData['episode_id']);
1372
+ if ($GeneralSettings['player'] == 'blubrrymodern') {
1373
+ $url .= '&amp;modern=1';
1374
+ }
1375
  } else {
1376
  $url = 'https://player.blubrry.com/?media_url='. urlencode($media_url);
1377
+ if ($GeneralSettings['player'] == 'blubrrymodern') {
1378
+ $url .= '&amp;modern=1';
1379
+ }
1380
  if( !empty($EpisodeData['id']) ) {
1381
  // Get permalink URL
1382
  $permalink = get_permalink( $EpisodeData['id'] );
1384
  $url.= '&amp;podcast_link='. urlencode($permalink);
1385
  }
1386
  if( !empty($EpisodeData['itunes_image']) ) {
 
1387
  if(isset($GeneralSettings['bp_episode_image']) && $GeneralSettings['bp_episode_image'] != false)
1388
  $url.= '&amp;artwork_url='. urlencode($EpisodeData['itunes_image']);
1389
  }
1400
  $GLOBALS['powerpress_skipto_player'][ get_the_ID() ][ $feedSlug ] = $playerID;
1401
 
1402
  $iframeTitle = esc_attr( __('Blubrry Podcast Player', 'powerpress') );
1403
+ if ($GeneralSettings['player'] == 'blubrrymodern') {
1404
+ return '<iframe src="' . $url . '" scrolling="yes" width="100%" height="230px" frameborder="0" id="' . $playerID . '" class="blubrryplayer" title="' . $iframeTitle . '"></iframe>';
1405
+ } else {
1406
+ return '<iframe src="' . $url . '" scrolling="no" width="100%" height="138px" frameborder="0" id="' . $playerID . '" class="blubrryplayer" title="' . $iframeTitle . '"></iframe>';
1407
+ }
1408
  }
1409
 
1410
  return powerpressplayer_build_mediaelementaudio($media_url, $EpisodeData, $embed);
1411
  }
1412
 
1413
+ function powerpressplayer_build_blubrryaudio_by_id($directory_episode_id, $modern = false)
1414
  {
1415
+ $local = (strpos($_SERVER['HTTP_HOST'], '.local') !== false);
1416
+ $playerUrl = ($local ? 'http://player.blubrry.local' : 'https://player.blubrry.com');
1417
+
1418
+ if($modern){
1419
+ $iframeTitle = esc_attr( __('Modern Blubrry Player', 'powerpress') );
1420
+ return '<iframe src="' . $playerUrl . '?id='. $directory_episode_id .'&amp;modern=1&amp;cache=' . time() . '" id="playeriframe" class="" scrolling="yes" width="100%" height="230px" frameborder="0" title="' . $iframeTitle . '"></iframe>';
1421
+ } else {
1422
+ $iframeTitle = esc_attr( __('Blubrry Podcast Player', 'powerpress') );
1423
+ return '<iframe src="' . $playerUrl . '?podcast_id='. $directory_episode_id .'" id="playeriframe" class="blubrryplayer" scrolling="no" width="100%" height="138px" frameborder="0" title="' . $iframeTitle . '"></iframe>';
1424
+ }
1425
  }
1426
 
1427
  /*
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="https://create.blubrry.com/resources/powerpress/" target="_blank">Blubrry PowerPress</a> is the No. 1 Podcasting plugin for WordPress. Developed by podcasters for podcasters; features include Simple and Advanced modes, multiple audio/video player options, subscribe to podcast tools, podcast SEO features, and more! Fully supports Apple Podcasts (previously iTunes), Google Podcasts, Spotify, Stitcher, and Blubrry Podcasting directories, as well as all podcast applications and clients.
6
- Version: 9.2.1
7
  Author: Blubrry
8
  Author URI: https://blubrry.com/
9
  Requires at least: 3.6
@@ -35,7 +35,7 @@ if( !function_exists('add_action') ) {
35
  }
36
 
37
  // WP_PLUGIN_DIR (REMEMBER TO USE THIS DEFINE IF NEEDED)
38
- define('POWERPRESS_VERSION', '9.2.1' );
39
 
40
  // Translation support:
41
  if ( !defined('POWERPRESS_ABSPATH') )
@@ -3371,8 +3371,7 @@ function powerpress_add_redirect_url($MediaURL, $EpisodeData = false) // $channe
3371
  function powerpress_add_flag_to_redirect_url($MediaURL, $Flag)
3372
  {
3373
  // First strip any previous flags...
3374
- $MediaURL = preg_replace('/(media\.(blubrry|techpodcasts|rawvoice|podcasternews)\.com\/[A-Za-z0-9-_]+\/)([A-Za-z0-9]\/)?/i', '$1'."", $MediaURL);
3375
- return preg_replace('/(media\.(blubrry|techpodcasts|rawvoice|podcasternews)\.com\/[A-Za-z0-9-_]+\/)('.$Flag.'\/)?/i', '$1'."$Flag/", $MediaURL);
3376
  }
3377
 
3378
  /*
3
  Plugin Name: Blubrry PowerPress
4
  Plugin URI: http://create.blubrry.com/resources/powerpress/
5
  Description: <a href="https://create.blubrry.com/resources/powerpress/" target="_blank">Blubrry PowerPress</a> is the No. 1 Podcasting plugin for WordPress. Developed by podcasters for podcasters; features include Simple and Advanced modes, multiple audio/video player options, subscribe to podcast tools, podcast SEO features, and more! Fully supports Apple Podcasts (previously iTunes), Google Podcasts, Spotify, Stitcher, and Blubrry Podcasting directories, as well as all podcast applications and clients.
6
+ Version: 9.3
7
  Author: Blubrry
8
  Author URI: https://blubrry.com/
9
  Requires at least: 3.6
35
  }
36
 
37
  // WP_PLUGIN_DIR (REMEMBER TO USE THIS DEFINE IF NEEDED)
38
+ define('POWERPRESS_VERSION', '9.3' );
39
 
40
  // Translation support:
41
  if ( !defined('POWERPRESS_ABSPATH') )
3371
  function powerpress_add_flag_to_redirect_url($MediaURL, $Flag)
3372
  {
3373
  // First strip any previous flags...
3374
+ return $MediaURL;
 
3375
  }
3376
 
3377
  /*
powerpressadmin-jquery.php CHANGED
@@ -480,10 +480,12 @@ window.onload = function() {
480
  &middot; <?php echo __('Published on', 'powerpress'); ?> <?php echo date(get_option('date_format'), $data['last_modified']); ?></div>
481
  <?php } ?>
482
  <div class="media-item-links">
 
483
  <?php if (!empty($data['published']) && !empty($data['url'])) { ?>
484
  <a href="#"
485
  onclick="SelectURL('<?php echo $data['url']; ?>'); return false;"><?php echo __('Select', 'powerpress'); ?></a>
486
  <?php } else { ?>
 
487
  <?php if (function_exists('curl_init')) { ?>
488
  <a href="<?php echo admin_url() . wp_nonce_url("admin.php?action=powerpress-jquery-media-delete", 'powerpress-jquery-media-delete'); ?>&amp;podcast-feed=<?php echo $FeedSlug; ?>&amp;blubrryProgramKeyword=<?php echo urlencode($blubrryProgramKeyword); ?>&amp;delete=<?php echo !empty($data['name']) ? urlencode($data['name']) : ''; ?>"
489
  onclick="return DeleteMedia('<?php echo !empty($data['name']) ? htmlspecialchars($data['name']) : ''; ?>');"><?php echo __('Delete', 'powerpress'); ?></a> |
480
  &middot; <?php echo __('Published on', 'powerpress'); ?> <?php echo date(get_option('date_format'), $data['last_modified']); ?></div>
481
  <?php } ?>
482
  <div class="media-item-links">
483
+ <!-- Published Media -->
484
  <?php if (!empty($data['published']) && !empty($data['url'])) { ?>
485
  <a href="#"
486
  onclick="SelectURL('<?php echo $data['url']; ?>'); return false;"><?php echo __('Select', 'powerpress'); ?></a>
487
  <?php } else { ?>
488
+ <!-- Unpublished Media -->
489
  <?php if (function_exists('curl_init')) { ?>
490
  <a href="<?php echo admin_url() . wp_nonce_url("admin.php?action=powerpress-jquery-media-delete", 'powerpress-jquery-media-delete'); ?>&amp;podcast-feed=<?php echo $FeedSlug; ?>&amp;blubrryProgramKeyword=<?php echo urlencode($blubrryProgramKeyword); ?>&amp;delete=<?php echo !empty($data['name']) ? urlencode($data['name']) : ''; ?>"
491
  onclick="return DeleteMedia('<?php echo !empty($data['name']) ? htmlspecialchars($data['name']) : ''; ?>');"><?php echo __('Delete', 'powerpress'); ?></a> |
powerpressadmin-metabox.php CHANGED
@@ -1,6 +1,6 @@
1
  <?php
2
 
3
- function episode_box_top($EnclosureURL, $FeedSlug, $ExtraData, $GeneralSettings, $EnclosureLength, $DurationHH, $DurationMM, $DurationSS) {
4
 
5
  if ($EnclosureURL) {
6
  $style1 = "display: none";
@@ -223,6 +223,86 @@ function episode_box_top($EnclosureURL, $FeedSlug, $ExtraData, $GeneralSettings,
223
  </div>
224
  </div>
225
  </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
226
  <?php
227
  if( !empty($GeneralSettings['cat_casting_strict']) && !empty($GeneralSettings['custom_cat_feeds']) )
228
  {
@@ -279,7 +359,6 @@ function episode_box_top($EnclosureURL, $FeedSlug, $ExtraData, $GeneralSettings,
279
  <?php }
280
  }
281
 
282
-
283
  function seo_tab($FeedSlug, $ExtraData, $iTunesExplicit, $seo_feed_title, $GeneralSettings, $iTunesSubtitle, $iTunesSummary, $iTunesAuthor, $iTunesOrder, $iTunesBlock, $object)
284
  {
285
  ?>
@@ -812,24 +891,6 @@ function notes_tab($FeedSlug, $object, $GeneralSettings, $PCITranscript, $PCITra
812
  <?php if( !isset($GeneralSettings['new_episode_box_pci']) || $GeneralSettings['new_episode_box_pci'] == 1) {?>
813
  <div class="pp-section-container">
814
  <h4 class="pp-section-title-block"> <?php echo esc_html(__('Podcast Index Settings', 'powerpress')); ?> </h4>
815
- <p style="font-size: 14px;" class="pp-ep-box-text">
816
- <input id="powerpress_pci_transcript_<?php echo $FeedSlug; ?>" title="<?php echo esc_attr(__("Add a transcript","powerpress")); ?>"
817
- class="ep-box-checkbox" onclick="powerpress_epboxPCIToggle(this);"
818
- name="Powerpress[<?php echo $FeedSlug; ?>][pci_transcript]" value="1"
819
- type="checkbox" <?php echo($PCITranscript == 1 ? 'checked' : ''); ?> />
820
- <?php echo esc_html(__('Add a transcript', 'powerpress')); ?>
821
- </p>
822
- <div class="powerpress_row" id="powerpress_pci_transcript_container_<?php echo $FeedSlug; ?>" <?php if (empty($PCITranscript)) { echo "style=\"display: none;\""; } ?>>
823
- <div class="powerpress_row_content">
824
- <input type="text" id="powerpress_transcript_url_<?php echo $FeedSlug; ?>" title="<?php echo esc_attr(__("URL to transcript file","powerpress")); ?>"
825
- class="pp-ep-box-input"
826
- name="Powerpress[<?php echo $FeedSlug; ?>][pci_transcript_url]"
827
- value="<?php echo esc_attr($PCITranscriptURL); ?>"
828
- placeholder="<?php echo 'https://' . $_SERVER['SERVER_NAME'] . '/wp-content/uploads/' . date('Y') . '/' . date('m') . '/' . 'transcript.txt'; ?>"
829
- style="width: 96%; margin: 1em 4% 0 0;"/>
830
- <label class="pp-ep-box-label-under"><?php echo esc_html(__("Can be added later by editing this post", 'powerpress')); ?></label>
831
- </div>
832
- </div>
833
  <p style="font-size: 14px;" class="pp-ep-box-text">
834
  <input id="powerpress_pci_chapters_<?php echo $FeedSlug; ?>" title="<?php echo esc_attr(__("Add chapters","powerpress")); ?>"
835
  class="ep-box-checkbox" onclick="powerpress_epboxPCIToggle(this);"
@@ -864,7 +925,6 @@ function notes_tab($FeedSlug, $object, $GeneralSettings, $PCITranscript, $PCITra
864
  <?php
865
  }
866
 
867
-
868
  function get_filename_from_path($path) {
869
  if (strpos($path, '/') !== false) {
870
  $pieces = explode('/', $path);
1
  <?php
2
 
3
+ function episode_box_top($EnclosureURL, $FeedSlug, $ExtraData, $GeneralSettings, $EnclosureLength, $DurationHH, $DurationMM, $DurationSS, $PCITranscriptURL) {
4
 
5
  if ($EnclosureURL) {
6
  $style1 = "display: none";
223
  </div>
224
  </div>
225
  </div>
226
+
227
+ <div id="transcript-box" style="margin-top: 25px; background-color: #f1f4f9; padding: 2ch;">
228
+ <?php
229
+ $transcript_box_style = '';
230
+ if($EnclosureURL){
231
+ $transcript_box_style = ' display: none;';
232
+ ?>
233
+ <p style="font-size: 14px; margin-top: 0; margin-bottom: 0;" class="pp-ep-box-text">
234
+ <input id="powerpress_transcript_edit" title="<?php echo esc_attr(__("Edit transcript","powerpress")); ?>"
235
+ class="ep-box-checkbox"
236
+ name="Powerpress[<?php echo $FeedSlug; ?>][transcript][edit]" value="0"
237
+ type="checkbox"
238
+ onclick="showHideTranscriptBox(this.id, this.value, <?php echo $GeneralSettings['blubrry_hosting']; ?>, '<?php echo $FeedSlug; ?>');"/>
239
+ <?php echo esc_html(__('Edit transcript', 'powerpress')); ?>
240
+ <?php if (!empty($PCITranscriptURL)) { ?>
241
+ - <a href="<?php echo $PCITranscriptURL ?>" title="Transcript Link" target="_blank"><?php echo $PCITranscriptURL; ?></a>
242
+ <?php } ?>
243
+ </p>
244
+ <?php } ?>
245
+ <div id="transcript-box-options-<?php echo $FeedSlug; ?>" style="margin-top: 1.5em;<?php echo $transcript_box_style; ?>">
246
+
247
+ <h3 style="margin-top: 0;">Transcription (optional)</h3>
248
+
249
+ <p style="font-size: 14px;" class="pp-ep-box-text">
250
+ <input id="powerpress_transcript_none_<?php echo $FeedSlug ?>" title="<?php echo esc_attr(__("No transcript","powerpress")); ?>"
251
+ class="media-details-radio"
252
+ name="Powerpress[<?php echo $FeedSlug; ?>][transcript][none]" value="1"
253
+ type="radio"
254
+ onclick="setTranscriptCheckboxes(this.id, '<?php echo $FeedSlug; ?>');" <?php echo empty($PCITranscriptURL) ? 'checked' : ''; ?> />
255
+ <?php echo esc_html(__('No transcript', 'powerpress')); ?>
256
+ </p>
257
+
258
+ <hr style="margin: 1em 0 1em 0;">
259
+
260
+ <?php if(!$EnclosureURL && $GeneralSettings['blubrry_hosting']){ ?>
261
+ <p style="font-size: 14px; display: inline;" class="pp-ep-box-text">
262
+ <input id="powerpress_transcript_generate_<?php echo $FeedSlug ?>" title="<?php echo esc_attr(__("Generate transcript for me","powerpress")); ?>"
263
+ class="media-details-radio"
264
+ name="Powerpress[<?php echo $FeedSlug; ?>][transcript][generate]" value="1"
265
+ type="radio"
266
+ onclick="setTranscriptCheckboxes(this.id, '<?php echo $FeedSlug; ?>');"/>
267
+ <?php echo esc_html(__('Generate transcript for me', 'powerpress')); ?>
268
+ </p>
269
+
270
+ <div style="margin-left: 30px; margin-top: 5px; display: <?php echo ($GeneralSettings['blubrry_hosting'] ? 'inline-flex' : 'none'); ?>; background-color: #FFFEF3; border-left: 4px solid #FFCA28;">
271
+ <p style="font-size: 14px; margin: 8px;">Generated transcripts are free until September 15th. Transcripts are used for displaying closed captions in the new Blubrry podcast player, as well as in podcast apps that support transcripts.</p>
272
+ </div>
273
+
274
+ <div style="margin-left: 5px; display: <?php echo (!$GeneralSettings['blubrry_hosting'] ? 'inline-flex' : 'none'); ?>; background-color: #FFFEF3; border-left: 4px solid #FFCA28;">
275
+ <p style="font-size: 14px; margin: 8px;">
276
+ Generated transcripts are only available for Blubrry Hosting customers.
277
+ Learn more about hosting with Blubrry <a href="">here</a>.
278
+ </p>
279
+ </div>
280
+
281
+ <hr style="margin: 1em 0 1em 0;">
282
+ <?php } ?>
283
+
284
+ <p style="font-size: 14px;" class="pp-ep-box-text">
285
+ <input id="powerpress_pci_transcript_<?php echo $FeedSlug; ?>" title="<?php echo esc_attr(__("Add a transcript","powerpress")); ?>"
286
+ class="media-details-radio" onclick="setTranscriptCheckboxes(this.id, '<?php echo $FeedSlug; ?>');"
287
+ name="Powerpress[<?php echo $FeedSlug; ?>][transcript][upload]" value="1"
288
+ type="radio"/>
289
+ <?php echo esc_html(__('Add a transcript', 'powerpress')); ?>
290
+ </p>
291
+ <div class="powerpress_row" id="powerpress_pci_transcript_container_<?php echo $FeedSlug; ?>" <?php if (empty($PCITranscript)) { echo "style=\"display: none;\""; } ?>>
292
+ <div class="powerpress_row_content">
293
+ <input type="text" id="powerpress_transcript_url_<?php echo $FeedSlug; ?>" title="<?php echo esc_attr(__("URL to transcript file","powerpress")); ?>"
294
+ class="pp-ep-box-input"
295
+ name="Powerpress[<?php echo $FeedSlug; ?>][pci_transcript_url]"
296
+ value="<?php echo esc_attr($PCITranscriptURL); ?>"
297
+ placeholder="<?php echo 'https://' . $_SERVER['SERVER_NAME'] . '/wp-content/uploads/' . date('Y') . '/' . date('m') . '/' . 'transcript.txt'; ?>"
298
+ style="width: 96%; margin: 1em 4% 0 0;" <?php echo !empty($PCITranscriptURL) ? 'checked' : ''; ?>/>
299
+ <!-- <label class="pp-ep-box-label-under">--><?php //echo esc_html(__("Can be added later by editing this post", 'powerpress')); ?><!--</label>-->
300
+ </div>
301
+ </div>
302
+ </div>
303
+
304
+ </div>
305
+
306
  <?php
307
  if( !empty($GeneralSettings['cat_casting_strict']) && !empty($GeneralSettings['custom_cat_feeds']) )
308
  {
359
  <?php }
360
  }
361
 
 
362
  function seo_tab($FeedSlug, $ExtraData, $iTunesExplicit, $seo_feed_title, $GeneralSettings, $iTunesSubtitle, $iTunesSummary, $iTunesAuthor, $iTunesOrder, $iTunesBlock, $object)
363
  {
364
  ?>
891
  <?php if( !isset($GeneralSettings['new_episode_box_pci']) || $GeneralSettings['new_episode_box_pci'] == 1) {?>
892
  <div class="pp-section-container">
893
  <h4 class="pp-section-title-block"> <?php echo esc_html(__('Podcast Index Settings', 'powerpress')); ?> </h4>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
894
  <p style="font-size: 14px;" class="pp-ep-box-text">
895
  <input id="powerpress_pci_chapters_<?php echo $FeedSlug; ?>" title="<?php echo esc_attr(__("Add chapters","powerpress")); ?>"
896
  class="ep-box-checkbox" onclick="powerpress_epboxPCIToggle(this);"
925
  <?php
926
  }
927
 
 
928
  function get_filename_from_path($path) {
929
  if (strpos($path, '/') !== false) {
930
  $pieces = explode('/', $path);
powerpressadmin-player-page.php CHANGED
@@ -158,7 +158,9 @@ function UpdatePlayerPreview(name, value)
158
  }
159
 
160
  jQuery(document).ready(function($) {
161
- generatePlayerHash();
 
 
162
 
163
  function generatePlayerHash(){
164
  var time = jQuery("input.time-form").val();
@@ -380,6 +382,13 @@ table.html5formats tr > td:first-child {
380
  <th scope="row">&nbsp;</th>
381
  <td>
382
  <ul>
 
 
 
 
 
 
 
383
  <li><label><input type="radio" name="Player[player]" id="player_blubrryaudio" value="blubrryaudio" <?php if( $General['player'] == 'blubrryaudio' ) echo 'checked'; ?> /> <?php echo __('Blubrry Audio Player', 'powerpress'); ?> </label>
384
  <strong style="padding-top: 8px; margin-left: 20px;"><a href="<?php echo admin_url('admin.php?page=powerpress/powerpressadmin_player.php&ep=1'); ?>" id="activate_blubrryaudio" class="activate-player"><?php echo __('Activate and Configure Now', 'powerpress'); ?></a></strong>
385
  </li>
@@ -1017,4 +1026,13 @@ function print_blubrry_player_demo()
1017
  <?php
1018
  }
1019
 
1020
- // eof
 
 
 
 
 
 
 
 
 
158
  }
159
 
160
  jQuery(document).ready(function($) {
161
+ if(!jQuery('#player_blubrrymodern').prop('checked')){
162
+ generatePlayerHash();
163
+ }
164
 
165
  function generatePlayerHash(){
166
  var time = jQuery("input.time-form").val();
382
  <th scope="row">&nbsp;</th>
383
  <td>
384
  <ul>
385
+ <li><label><input type="radio" name="Player[player]" id="player_blubrrymodern" value="blubrrymodern" <?php if( $General['player'] == 'blubrrymodern' ) echo 'checked'; ?> /> <?php echo __('Modern Blubrry Player', 'powerpress'); ?> </label>
386
+ <strong style="padding-top: 8px; margin-left: 20px;"><a href="<?php echo admin_url('admin.php?page=powerpress/powerpressadmin_player.php&ep=1'); ?>" id="activate_blubrrymodern" class="activate-player"><?php echo __('Activate Now', 'powerpress'); ?></a></strong>
387
+ </li>
388
+ <li style="margin-left: 30px; margin-bottom:16px;">
389
+ <?php print_modern_player_demo(); ?>
390
+ </li>
391
+
392
  <li><label><input type="radio" name="Player[player]" id="player_blubrryaudio" value="blubrryaudio" <?php if( $General['player'] == 'blubrryaudio' ) echo 'checked'; ?> /> <?php echo __('Blubrry Audio Player', 'powerpress'); ?> </label>
393
  <strong style="padding-top: 8px; margin-left: 20px;"><a href="<?php echo admin_url('admin.php?page=powerpress/powerpressadmin_player.php&ep=1'); ?>" id="activate_blubrryaudio" class="activate-player"><?php echo __('Activate and Configure Now', 'powerpress'); ?></a></strong>
394
  </li>
1026
  <?php
1027
  }
1028
 
1029
+ function print_modern_player_demo(){ ?>
1030
+ <p><?php echo __('Note: The Modern Blubrry Player is only available to Blubrry Hosting Customers. Player customization will be coming soon.', 'powerpress'); ?></p>
1031
+
1032
+ <div style="margin: 25px 0;">
1033
+ <?php echo powerpressplayer_build_blubrryaudio_by_id(88601519, true); // Special episode where we talk about the new player ?>
1034
+ </div>
1035
+
1036
+ <?php } ?>
1037
+
1038
+ <?php // eof ?>
powerpressadmin.php CHANGED
@@ -2000,7 +2000,7 @@ function powerpress_edit_post($post_ID, $post)
2000
  $error .= ini_get('max_input_vars') . " <a href='https://blubrry.com/support/powerpress-documentation/warning-messages-explained/'>Learn more</a>";
2001
  powerpress_add_error($error);
2002
  }
2003
-
2004
  $Episodes = ( isset($_POST['Powerpress'])? $_POST['Powerpress'] : false);
2005
  if( $Episodes )
2006
  {
@@ -3980,7 +3980,8 @@ function powerpress_process_hosting($post_ID, $post_title)
3980
  $CustomFeeds[$feed_slug] = $feed_slug;
3981
  }
3982
  }
3983
-
 
3984
  foreach( $CustomFeeds as $feed_slug => $null )
3985
  {
3986
  $field = 'enclosure';
@@ -4021,127 +4022,233 @@ function powerpress_process_hosting($post_ID, $post_title)
4021
  powerpress_add_error($error);
4022
  }
4023
 
4024
- if( $EpisodeData && !empty($EpisodeData['hosting']) )
4025
  {
4026
  $program_keyword = (!empty($EpisodeData['program_keyword']) ? $EpisodeData['program_keyword'] : $Settings['blubrry_program_keyword'] );
4027
  $error = false;
4028
- // First we need to get media information...
4029
- // If we are working with an Mp3, we can write id3 tags and get the info returned...
4030
- if( ($EnclosureType == 'audio/mpg' || $EnclosureType == 'audio/mpeg') && !empty($Settings['write_tags']) )
4031
- {
4032
- $results = powerpress_write_tags($EnclosureURL, $post_title, $program_keyword);
4033
- // if error, try inputting just the file name in case it's unpublished
4034
- if ( ( strpos($EnclosureURL, 'ins.blubrry.com') || strpos($EnclosureURL, 'content.blubrry.com') || strpos($EnclosureURL, 'protected.blubrry.com') || strpos($EnclosureURL, 'mc.blubrry.com')) && (isset($results['error']) || !is_array($results) || !$results) ) {
4035
- $EnclosureUrLArray = explode('/', $EnclosureURL);
4036
- $EnclosureURL = end($EnclosureUrLArray);
 
 
 
 
 
 
 
 
 
 
4037
  $EnclosureUrlQSArray = explode('?', $EnclosureURL);
4038
  $EnclosureURL = $EnclosureUrlQSArray[0];
4039
- $results = powerpress_write_tags($EnclosureURL, $post_title, $program_keyword);
4040
- }
4041
- }
4042
- else
4043
- {
4044
- // order of logic below is reversed due to changes in powerpress_get_media_info to properly verify media in drafts
4045
- // first, try as if the file is unpublished
4046
- $EnclosureFullURL = $EnclosureURL;
4047
- $EnclosureUrLArray = explode('/', $EnclosureURL);
4048
- $EnclosureURL = end($EnclosureUrLArray);
4049
- $EnclosureUrlQSArray = explode('?', $EnclosureURL);
4050
- $EnclosureURL = $EnclosureUrlQSArray[0];
4051
- $results = powerpress_get_media_info($EnclosureURL, $program_keyword);
4052
-
4053
- // if error, try the full URL
4054
- if ( (isset($results['error']) || !is_array($results)) ) {
4055
- $EnclosureURL = $EnclosureFullURL;
4056
  $results = powerpress_get_media_info($EnclosureURL, $program_keyword);
 
 
 
 
 
 
4057
  }
4058
- }
4059
-
4060
- if( is_array($results) && !isset($results['error']) )
4061
- {
4062
- if( isset($results['duration']) && $results['duration'] )
4063
- $EpisodeData['duration'] = $results['duration'];
4064
- if( isset($results['content-type']) && $results['content-type'] )
4065
- $EnclosureType = $results['content-type'];
4066
- if( isset($results['length']) && $results['length'] )
4067
- $EnclosureSize = $results['length'];
4068
- }
4069
- else if( isset($results['error']) )
4070
- {
4071
- $error = __('Blubrry Hosting Error (media info)', 'powerpress') .': '. $results['error'];
4072
- powerpress_add_error($error);
4073
- }
4074
- else
4075
- {
4076
- $error = sprintf( __('Blubrry Hosting Error (media info): An error occurred publishing media %s.', 'powerpress'), $EnclosureURL);
4077
- $error .= ' ';
4078
- $error .= '<a href="#" onclick="document.getElementById(\'powerpress_error_'. $rand_id .'\');this.style.display=\'none\';return false;">'. __('Display Error', 'powerpress') .'</a>';
4079
- $error .= '<div id="powerpress_error_'. $rand_id .'" style="display: none;">'. $json_data .'</div>';
4080
- powerpress_add_error($error);
4081
- }
4082
-
4083
- if( $error == false )
4084
- {
4085
- $post_vars = array('podcast_guid' => $post_guid, 'podcast_post_date' => $post_time, 'podcast_title' => $post_title, 'podcast_subtitle' => isset($EpisodeData['subtitle']) ? $EpisodeData['subtitle'] : '');
4086
- // Extend the max execution time here
4087
- set_time_limit(60*20); // give it 20 minutes just in case
4088
- $json_data = false;
4089
- $api_url_array = powerpress_get_api_array();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4090
  if ($creds) {
4091
  $accessToken = powerpress_getAccessToken();
4092
- $req_url = sprintf('/2/media/%s/%s?format=json&publish=true&cache=' . md5( rand(0, 999) . time() ), urlencode($program_keyword), urlencode($EnclosureURL));
4093
  $req_url .= (defined('POWERPRESS_BLUBRRY_API_QSA')?'?'. POWERPRESS_BLUBRRY_API_QSA:'');
4094
  $req_url .= (defined('POWERPRESS_PUBLISH_PROTECTED') ? '&protected=true' : '');
4095
- $results = $auth->api($accessToken, $req_url, $post_vars, false, 60 * 30);
 
4096
  } else {
4097
  foreach ($api_url_array as $index => $api_url) {
4098
- $req_url = sprintf('%s/media/%s/%s?format=json&publish=true&cache=' . md5( rand(0, 999) . time() ), rtrim($api_url, '/'), urlencode($program_keyword), urlencode($EnclosureURL));
4099
  $req_url .= (defined('POWERPRESS_BLUBRRY_API_QSA') ? '&' . POWERPRESS_BLUBRRY_API_QSA : '');
4100
  $req_url .= (defined('POWERPRESS_PUBLISH_PROTECTED') ? '&protected=true' : '');
4101
- $json_data = powerpress_remote_fopen($req_url, $Settings['blubrry_auth'], $post_vars, 60 * 30); // give this up to 30 minutes, though 3 seocnds to 20 seconds is all one should need.
4102
- if (!$json_data && $api_url == 'https://api.blubrry.com/') { // Lets force cURL and see if that helps...
4103
- $json_data = powerpress_remote_fopen($req_url, $Settings['blubrry_auth'], $post_vars, 60 * 30, false, true);
4104
  }
4105
  if ($json_data != false)
4106
  break;
4107
  }
 
 
4108
 
4109
- $results = powerpress_json_decode($json_data);
 
 
 
 
 
 
 
 
 
4110
  }
4111
 
4112
- if( is_array($results) && !isset($results['error']) )
4113
- {
4114
- $EnclosureURL = $results['media_url'];
4115
- if (strtolower(substr($results['media_url'], 0, 4) ) != 'http') {
4116
- $error = __('Blubrry Hosting Error (publish): Please re-upload media file and re-publish post', 'powerpress');
4117
- powerpress_add_error($error);
 
 
 
 
 
 
 
 
 
 
 
4118
  }
4119
- unset($EpisodeData['hosting']); // we need to remove the flag since we're now using the correct FULL url
4120
- $EnclosureData = $EnclosureURL . "\n" . $EnclosureSize . "\n". $EnclosureType . "\n" . serialize($EpisodeData);
4121
- update_post_meta($post_ID, $field, $EnclosureData);
4122
- }
4123
- else if( isset($results['error']) )
4124
- {
4125
- $error = __('Blubrry Hosting Error (publish)', 'powerpress') .': '. $results['error'];
4126
- powerpress_add_error($error);
4127
- }
4128
- else
4129
- {
4130
- $rand_id = rand(100,2000);
4131
- $error = __('Blubrry Hosting Error (publish)', 'powerpress') .': '. sprintf( __('An error occurred publishing media \'%s\'.','powerpress'), $EnclosureURL);
4132
- $error .= ' <a href="#" onclick="document.getElementById(\'powerpress_error_'. $rand_id .'\').style.display=\'block\';this.style.display=\'none\';return false;">'. __('Display Error', 'powerpress') .'</a>';
4133
- $error .= '<div id="powerpress_error_'. $rand_id .'" style="display: none;">';
4134
- if( !empty($json_data) )
4135
- $error .= $json_data;
4136
- else if( !empty($GLOBALS['g_powerpress_remote_error']) )
4137
- $error .= htmlspecialchars($GLOBALS['g_powerpress_remote_error']);
4138
- else
4139
- $error .= __('Unknown error occurred.', 'powerpress');
4140
- $error .= '</div>';
4141
- powerpress_add_error($error);
4142
- }
4143
- }
4144
- }
 
 
 
 
 
 
 
 
4145
  }
4146
  }
4147
  }
2000
  $error .= ini_get('max_input_vars') . " <a href='https://blubrry.com/support/powerpress-documentation/warning-messages-explained/'>Learn more</a>";
2001
  powerpress_add_error($error);
2002
  }
2003
+
2004
  $Episodes = ( isset($_POST['Powerpress'])? $_POST['Powerpress'] : false);
2005
  if( $Episodes )
2006
  {
3980
  $CustomFeeds[$feed_slug] = $feed_slug;
3981
  }
3982
  }
3983
+
3984
+ $api_url_array = powerpress_get_api_array();
3985
  foreach( $CustomFeeds as $feed_slug => $null )
3986
  {
3987
  $field = 'enclosure';
4022
  powerpress_add_error($error);
4023
  }
4024
 
4025
+ if( $EpisodeData && (!empty($EpisodeData['hosting']) || !empty($_POST['Powerpress'][$feed_slug]['transcript']['edit'])))
4026
  {
4027
  $program_keyword = (!empty($EpisodeData['program_keyword']) ? $EpisodeData['program_keyword'] : $Settings['blubrry_program_keyword'] );
4028
  $error = false;
4029
+ if (!empty($EpisodeData['hosting'])) {
4030
+ // First we need to get media information...
4031
+ // If we are working with an Mp3, we can write id3 tags and get the info returned...
4032
+ if (($EnclosureType == 'audio/mpg' || $EnclosureType == 'audio/mpeg') && !empty($Settings['write_tags'])) {
4033
+ $results = powerpress_write_tags($EnclosureURL, $post_title, $program_keyword);
4034
+ // if error, try inputting just the file name in case it's unpublished
4035
+ if ((strpos($EnclosureURL, 'ins.blubrry.com') || strpos($EnclosureURL, 'content.blubrry.com') || strpos($EnclosureURL, 'protected.blubrry.com') || strpos($EnclosureURL, 'mc.blubrry.com')) && (isset($results['error']) || !is_array($results) || !$results)) {
4036
+ $EnclosureUrLArray = explode('/', $EnclosureURL);
4037
+ $EnclosureURL = end($EnclosureUrLArray);
4038
+ $EnclosureUrlQSArray = explode('?', $EnclosureURL);
4039
+ $EnclosureURL = $EnclosureUrlQSArray[0];
4040
+ $results = powerpress_write_tags($EnclosureURL, $post_title, $program_keyword);
4041
+ }
4042
+ } else {
4043
+ // order of logic below is reversed due to changes in powerpress_get_media_info to properly verify media in drafts
4044
+ // first, try as if the file is unpublished
4045
+ $EnclosureFullURL = $EnclosureURL;
4046
+ $EnclosureUrLArray = explode('/', $EnclosureURL);
4047
+ $EnclosureURL = end($EnclosureUrLArray);
4048
  $EnclosureUrlQSArray = explode('?', $EnclosureURL);
4049
  $EnclosureURL = $EnclosureUrlQSArray[0];
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4050
  $results = powerpress_get_media_info($EnclosureURL, $program_keyword);
4051
+
4052
+ // if error, try the full URL
4053
+ if ((isset($results['error']) || !is_array($results))) {
4054
+ $EnclosureURL = $EnclosureFullURL;
4055
+ $results = powerpress_get_media_info($EnclosureURL, $program_keyword);
4056
+ }
4057
  }
4058
+
4059
+ if (is_array($results) && !isset($results['error'])) {
4060
+ if (isset($results['duration']) && $results['duration'])
4061
+ $EpisodeData['duration'] = $results['duration'];
4062
+ if (isset($results['content-type']) && $results['content-type'])
4063
+ $EnclosureType = $results['content-type'];
4064
+ if (isset($results['length']) && $results['length'])
4065
+ $EnclosureSize = $results['length'];
4066
+ } else if (isset($results['error'])) {
4067
+ $error = __('Blubrry Hosting Error (media info)', 'powerpress') . ': ' . $results['error'];
4068
+ powerpress_add_error($error);
4069
+ } else {
4070
+ $error = sprintf(__('Blubrry Hosting Error (media info): An error occurred publishing media %s.', 'powerpress'), $EnclosureURL);
4071
+ $error .= ' ';
4072
+ $error .= '<a href="#" onclick="document.getElementById(\'powerpress_error_' . $rand_id . '\');this.style.display=\'none\';return false;">' . __('Display Error', 'powerpress') . '</a>';
4073
+ $error .= '<div id="powerpress_error_' . $rand_id . '" style="display: none;">' . $json_data . '</div>';
4074
+ powerpress_add_error($error);
4075
+ }
4076
+
4077
+ if ($error == false) {
4078
+ $post_vars = array('podcast_guid' => $post_guid, 'podcast_post_date' => $post_time, 'podcast_title' => $post_title, 'podcast_subtitle' => isset($EpisodeData['subtitle']) ? $EpisodeData['subtitle'] : '');
4079
+ // Extend the max execution time here
4080
+ set_time_limit(60 * 20); // give it 20 minutes just in case
4081
+ $json_data = false;
4082
+ if ($creds) {
4083
+ $accessToken = powerpress_getAccessToken();
4084
+ $req_url = sprintf('/2/media/%s/%s?format=json&publish=true&cache=' . md5(rand(0, 999) . time()), urlencode($program_keyword), urlencode($EnclosureURL));
4085
+ $req_url .= (defined('POWERPRESS_BLUBRRY_API_QSA') ? '?' . POWERPRESS_BLUBRRY_API_QSA : '');
4086
+ $req_url .= (defined('POWERPRESS_PUBLISH_PROTECTED') ? '&protected=true' : '');
4087
+ $results = $auth->api($accessToken, $req_url, $post_vars, false, 60 * 30);
4088
+ } else {
4089
+ foreach ($api_url_array as $index => $api_url) {
4090
+ $req_url = sprintf('%s/media/%s/%s?format=json&publish=true&cache=' . md5(rand(0, 999) . time()), rtrim($api_url, '/'), urlencode($program_keyword), urlencode($EnclosureURL));
4091
+ $req_url .= (defined('POWERPRESS_BLUBRRY_API_QSA') ? '&' . POWERPRESS_BLUBRRY_API_QSA : '');
4092
+ $req_url .= (defined('POWERPRESS_PUBLISH_PROTECTED') ? '&protected=true' : '');
4093
+ $json_data = powerpress_remote_fopen($req_url, $Settings['blubrry_auth'], $post_vars, 60 * 30); // give this up to 30 minutes, though 3 seocnds to 20 seconds is all one should need.
4094
+ if (!$json_data && $api_url == 'https://api.blubrry.com/') { // Lets force cURL and see if that helps...
4095
+ $json_data = powerpress_remote_fopen($req_url, $Settings['blubrry_auth'], $post_vars, 60 * 30, false, true);
4096
+ }
4097
+ if ($json_data != false)
4098
+ break;
4099
+ }
4100
+
4101
+ $results = powerpress_json_decode($json_data);
4102
+ }
4103
+
4104
+ if (is_array($results) && !isset($results['error'])) {
4105
+ $EnclosureURL = $results['media_url'];
4106
+ if (strtolower(substr($results['media_url'], 0, 4)) != 'http') {
4107
+ $error = __('Blubrry Hosting Error (publish): Please re-upload media file and re-publish post', 'powerpress');
4108
+ powerpress_add_error($error);
4109
+ }
4110
+ unset($EpisodeData['hosting']); // we need to remove the flag since we're now using the correct FULL url
4111
+
4112
+ // save podcast id
4113
+ if (!empty($results['podcast_id'])) {
4114
+ $EpisodeData['podcast_id'] = $results['podcast_id'];
4115
+ }
4116
+
4117
+ $EnclosureData = $EnclosureURL . "\n" . $EnclosureSize . "\n" . $EnclosureType . "\n" . serialize($EpisodeData);
4118
+ update_post_meta($post_ID, $field, $EnclosureData);
4119
+ } else if (isset($results['error'])) {
4120
+ $error = __('Blubrry Hosting Error (publish)', 'powerpress') . ': ' . $results['error'];
4121
+ powerpress_add_error($error);
4122
+ } else {
4123
+ $rand_id = rand(100, 2000);
4124
+ $error = __('Blubrry Hosting Error (publish)', 'powerpress') . ': ' . sprintf(__('An error occurred publishing media \'%s\'.', 'powerpress'), $EnclosureURL);
4125
+ $error .= ' <a href="#" onclick="document.getElementById(\'powerpress_error_' . $rand_id . '\').style.display=\'block\';this.style.display=\'none\';return false;">' . __('Display Error', 'powerpress') . '</a>';
4126
+ $error .= '<div id="powerpress_error_' . $rand_id . '" style="display: none;">';
4127
+ if (!empty($json_data))
4128
+ $error .= $json_data;
4129
+ else if (!empty($GLOBALS['g_powerpress_remote_error']))
4130
+ $error .= htmlspecialchars($GLOBALS['g_powerpress_remote_error']);
4131
+ else
4132
+ $error .= __('Unknown error occurred.', 'powerpress');
4133
+ $error .= '</div>';
4134
+ powerpress_add_error($error);
4135
+ }
4136
+ }
4137
+ }
4138
+ // new transcript call here
4139
+ $podcastId = false;
4140
+ if (!empty($results['podcast_id'])) {
4141
+ $EpisodeData['episode_id'] = $results['podcast_id'];
4142
+ $podcastId = $results['podcast_id'];
4143
+ } else {
4144
+ // try using one saved in the postmeta
4145
+ $postmeta = get_post_meta($post_ID, $field, true);
4146
+ if (!empty($postmeta['episode_id'])) {
4147
+ $podcastId = $postmeta['episode_id'];
4148
+ }
4149
+ }
4150
+
4151
+ if ($podcastId) {
4152
+ $podcastSearchAnd = "&podcast_id=" . intval($podcastId);
4153
+ } else {
4154
+ // pass in a media_url if we don't have a podcast id
4155
+ $podcastSearchAnd = "&media_url=" . urlencode($EnclosureURL);
4156
+ }
4157
+
4158
+ $EnclosureUrLArray = explode('/', $EnclosureURL);
4159
+ $EnclosureURLQS = end($EnclosureUrLArray);
4160
+ $EnclosureUrlQSArray = explode('?', $EnclosureURLQS);
4161
+ $EnclosureFilename = $EnclosureUrlQSArray[0];
4162
+ if((!empty($_POST['Powerpress'][$feed_slug]['transcript']['generate']) || (!empty($_POST['Powerpress'][$feed_slug]['transcript']['upload']) && !empty($_POST['Powerpress'][$feed_slug]['pci_transcript_url'])))){
4163
+ if(!empty($_POST['Powerpress'][$feed_slug]['pci_transcript_url']) && !empty($_POST['Powerpress'][$feed_slug]['transcript']['upload']))
4164
+ $podcastSearchAnd .= '&transcript_url='. urlencode($_POST['Powerpress'][$feed_slug]['pci_transcript_url']);
4165
+
4166
  if ($creds) {
4167
  $accessToken = powerpress_getAccessToken();
4168
+ $req_url = sprintf('/2/media/%s/%s?format=json&transcript=true%s&cache=' . md5( rand(0, 999) . time() ), urlencode($program_keyword), urlencode($EnclosureFilename), $podcastSearchAnd);
4169
  $req_url .= (defined('POWERPRESS_BLUBRRY_API_QSA')?'?'. POWERPRESS_BLUBRRY_API_QSA:'');
4170
  $req_url .= (defined('POWERPRESS_PUBLISH_PROTECTED') ? '&protected=true' : '');
4171
+ $transcriptResults = $auth->api($accessToken, $req_url, false, false, 60 * 30);
4172
+
4173
  } else {
4174
  foreach ($api_url_array as $index => $api_url) {
4175
+ $req_url = sprintf('/media/%s/%s?format=json&transcript=true%s&cache=' . md5( rand(0, 999) . time() ), urlencode($program_keyword), urlencode($EnclosureFilename), $podcastSearchAnd);
4176
  $req_url .= (defined('POWERPRESS_BLUBRRY_API_QSA') ? '&' . POWERPRESS_BLUBRRY_API_QSA : '');
4177
  $req_url .= (defined('POWERPRESS_PUBLISH_PROTECTED') ? '&protected=true' : '');
4178
+ $json_data = powerpress_remote_fopen(rtrim($api_url, '/') . $req_url, $Settings['blubrry_auth'], array(), 60 * 30); // give this up to 30 minutes, though 3 seocnds to 20 seconds is all one should need.
4179
+ if (!$json_data && $api_url == 'https://api.blubrry.com/') { // Let's force cURL and see if that helps...
4180
+ $json_data = powerpress_remote_fopen(rtrim($api_url, '/') . $req_url, $Settings['blubrry_auth'], array(), 60 * 30, false, true);
4181
  }
4182
  if ($json_data != false)
4183
  break;
4184
  }
4185
+ $transcriptResults = powerpress_json_decode($json_data);
4186
+ }
4187
 
4188
+ // Check for transcription error
4189
+ if($transcriptResults['insufficient_transcription_storage']){
4190
+ $error = 'Your episode was published without a transcript because you have reached your transcription limit.
4191
+ Limits are calculated based on transcripts generated for your total media published/replaced for the month.';
4192
+
4193
+ // Once free trial is over, we will add:
4194
+ // To increase your transcription limit, upgrade to a hosting plan with more storage. <a href="">Change Plan</a>
4195
+
4196
+ $error = __($error, 'powerpress');
4197
+ powerpress_add_error($error);
4198
  }
4199
 
4200
+ if (isset($transcriptResults['error'])) {
4201
+ powerpress_add_error(__('Error generating transcript: ', 'powerpress') . $transcriptResults['error']);
4202
+ }
4203
+ if (empty($transcriptResults) || !is_array($transcriptResults) || empty($transcriptResults['temp_transcription_file'])) {
4204
+ powerpress_add_error(__('Error generating transcript', 'powerpress'));
4205
+ }
4206
+
4207
+ // Take the temp transcription file and add to the feed
4208
+ if (!empty($transcriptResults['temp_transcription_file'])) {
4209
+ $EpisodeData["pci_transcript_url"] = $transcriptResults['temp_transcription_file'];
4210
+ $EpisodeData["pci_transcript"] = 1;
4211
+ $EnclosureData = $EnclosureURL . "\n" . $EnclosureSize . "\n" . $EnclosureType . "\n" . serialize($EpisodeData);
4212
+ update_post_meta($post_ID, $field, $EnclosureData);
4213
+
4214
+ // check for notices from api call
4215
+ if (!empty($transcriptResults['message'])) {
4216
+ powerpress_add_error($transcriptResults['message']);
4217
  }
4218
+ }
4219
+
4220
+ }
4221
+
4222
+ }
4223
+ if (empty($program_keyword)) {
4224
+ $program_keyword = (!empty($EpisodeData['program_keyword']) ? $EpisodeData['program_keyword'] : $Settings['blubrry_program_keyword'] );
4225
+ }
4226
+ // Push the title to Blubrry
4227
+ $post_array = array('title' => $post_title, 'media_url' => $EnclosureURL);
4228
+ if (!empty($podcastId)) {
4229
+ $post_array = array('title' => $post_title, 'podcast_id' => $podcastId, 'media_url' => $EnclosureURL);
4230
+ }
4231
+ if ($creds) {
4232
+ $accessToken = powerpress_getAccessToken();
4233
+ $req_url = sprintf('/2/episode/%s/update-title/?format=json&cache=' . md5(rand(0, 999) . time()), urlencode($program_keyword));
4234
+ $req_url .= (defined('POWERPRESS_BLUBRRY_API_QSA') ? '?' . POWERPRESS_BLUBRRY_API_QSA : '');
4235
+ $req_url .= (defined('POWERPRESS_PUBLISH_PROTECTED') ? '&protected=true' : '');
4236
+ $title_results = $auth->api($accessToken, $req_url, $post_array, false, 60 * 30);
4237
+
4238
+ } else {
4239
+ foreach ($api_url_array as $index => $api_url) {
4240
+ $req_url = sprintf('/episode/%s/update-title/?format=json&cache=' . md5(rand(0, 999) . time()), urlencode($program_keyword));
4241
+ $req_url .= (defined('POWERPRESS_BLUBRRY_API_QSA') ? '&' . POWERPRESS_BLUBRRY_API_QSA : '');
4242
+ $req_url .= (defined('POWERPRESS_PUBLISH_PROTECTED') ? '&protected=true' : '');
4243
+ $json_data = powerpress_remote_fopen(rtrim($api_url, '/') . $req_url, $Settings['blubrry_auth'], $post_array, 60 * 30); // give this up to 30 minutes, though 3 seocnds to 20 seconds is all one should need.
4244
+ if (!$json_data && $api_url == 'https://api.blubrry.com/') { // Let's force cURL and see if that helps...
4245
+ $json_data = powerpress_remote_fopen(rtrim($api_url, '/') . $req_url, $Settings['blubrry_auth'], $post_array, 60 * 30, false, true);
4246
+ }
4247
+ if ($json_data != false)
4248
+ break;
4249
+ }
4250
+ $title_results = powerpress_json_decode($json_data);
4251
+ }
4252
  }
4253
  }
4254
  }
readme.txt CHANGED
@@ -4,7 +4,7 @@ Tags: podcasting, podcast, podcaster, powerpress, itunes, apple, apple podcasts,
4
  Requires at least: 3.6
5
  Requires PHP: 5.2
6
  Tested up to: 6.0
7
- Stable tag: 9.2.1
8
  Donate link: https://create.blubrry.com/resources/podcast-media-hosting/
9
  License: GPLv2 or later
10
 
@@ -186,6 +186,10 @@ If you are a fan of PowerPress, we would greatly appreciate it if you could take
186
 
187
  == Changelog ==
188
 
 
 
 
 
189
  = 9.2.1 =
190
  * Released on 08/23/2022
191
  * Bugfix for Blubrry Programmatic Ads
4
  Requires at least: 3.6
5
  Requires PHP: 5.2
6
  Tested up to: 6.0
7
+ Stable tag: 9.3
8
  Donate link: https://create.blubrry.com/resources/podcast-media-hosting/
9
  License: GPLv2 or later
10
 
186
 
187
  == Changelog ==
188
 
189
+ = 9.3 =
190
+ * Released on 08/22/2022
191
+ * Support for transcripts thru Blubrry
192
+
193
  = 9.2.1 =
194
  * Released on 08/23/2022
195
  * Bugfix for Blubrry Programmatic Ads
views/episode-box.php CHANGED
@@ -234,7 +234,7 @@ function powerpress_meta_box($object, $box)
234
  echo "id=\"powerpress_change_$FeedSlug\" value=\"1\" checked/>";
235
  echo "</div>";
236
  }
237
- episode_box_top($EnclosureURL, $FeedSlug, $ExtraData, $GeneralSettings, $EnclosureLength, $DurationHH, $DurationMM, $DurationSS);
238
  echo "<div id=\"tab-container-$FeedSlug\" style=\"$style\">";
239
  echo "<div class=\"pp-tab\">";
240
  $titles = array("info" => esc_attr(__("Episode Info", "powerpress")), "artwork" => esc_attr(__("Episode Artwork", "powerpress")), "website" => esc_attr(__("Website Display", "powerpress")), "advanced" => esc_attr(__("Advanced", "powerpress")));
234
  echo "id=\"powerpress_change_$FeedSlug\" value=\"1\" checked/>";
235
  echo "</div>";
236
  }
237
+ episode_box_top($EnclosureURL, $FeedSlug, $ExtraData, $GeneralSettings, $EnclosureLength, $DurationHH, $DurationMM, $DurationSS, $PCITranscriptURL);
238
  echo "<div id=\"tab-container-$FeedSlug\" style=\"$style\">";
239
  echo "<div class=\"pp-tab\">";
240
  $titles = array("info" => esc_attr(__("Episode Info", "powerpress")), "artwork" => esc_attr(__("Episode Artwork", "powerpress")), "website" => esc_attr(__("Website Display", "powerpress")), "advanced" => esc_attr(__("Advanced", "powerpress")));