PluginProbe
PowerPress Podcasting plugin by Blubrry / 11.17.2
PowerPress Podcasting plugin by Blubrry v11.17.2
11.17.9 11.17.8 11.17.7 11.17.6 11.17.4 11.17.3 11.17.2 11.17.1 11.17 11.16.11 11.16.10 11.16.9 11.16.8 11.16.7 11.16.6 11.16.5 11.16.4 11.16.3 11.16.2 11.16.1 11.9.13 11.9.14 11.9.15 11.9.16 11.9.17 All 383 releases
powerpress / shortcodes / Program.php

Program.php in PowerPress Podcasting plugin by Blubrry 11.17.2, at shortcodes/Program.php

70 lines 2.9 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 class PowerPressNetworkProgram extends PowerPressNetworkShortCode
4 {
5 function __construct()
6 {
7 parent::__construct('ppn-program');
8 }
9
10 function ppn_shortcode($attr, $contents)
11 {
12 require_once(WP_PLUGIN_DIR . '/powerpress/powerpressadmin.php');
13
14 $ctx = $this->getNetworkContext();
15 if (is_string($ctx)) return $ctx;
16
17 $program_id = $attr['id'];
18 $props = [];
19 $props['program_id'] = $program_id;
20 $props['style'] = $attr['style'] ?? 'full';
21 $props['ssb-style'] = $attr['ssb-style'] ?? 'modern';
22 $props['ssb-shape'] = $attr['ssb-shape'] ?? 'circle';
23 $props['limit'] = $attr['limit'] ?? '20';
24 $props['network_general'] = $ctx['general'];
25
26 $networkInfo = $ctx['networkInfo'];
27 $networkInfo['program_id'] = $program_id;
28
29 $results = PowerpressNetworkDataBus::getSpecificProgramInNetwork($ctx['apiUrl'], false, $networkInfo, false);
30
31 if ( !$results || !is_array($results) ) {
32 return '<p>' . esc_html__('This show is currently unavailable.', 'powerpress') . '</p>';
33 }
34
35
36 if (isset($results['error'])) {
37 if ($results['error'] == 'Fail To Find Your Program In This Network') {
38 return PowerPressNetwork::getHTML('no-program-results.php', $props, null, null);
39 } else if ($results['error'] == 'Your account does not have the network with specified id') {
40 return PowerPressNetwork::getHTML('invalid-network.php', $props, null, null);
41 }
42 return $results['error'];
43 }
44
45 $props['episodes'] = $results['episodes'];
46 $props['artwork_url'] = $results['program_info']['artwork_url'];
47 $props['program_title'] = $results['program_info']['program_title'];
48 $props['program_desc'] = $results['program_info']['program_desc'];
49 $props['talent_name'] = $results['program_info']['talent_name'];
50 $props['program_url'] = $results['program_info']['program_htmlurl'];
51 $props['program_rssurl'] = $results['program_info']['program_rssurl'];
52 $props['program_itunesurl'] = $results['program_info']['program_itunesurl'] ?? false;
53
54 // subscribe links
55 $subscribeKeys = [
56 'subscribe_googleplay', 'subscribe_html', 'subscribe_tunein',
57 'subscribe_itunes', 'subscribe_deezer', 'subscribe_iheart',
58 'subscribe_pandora', 'subscribe_radio_com', 'subscribe_spotify',
59 'subscribe_blubrry', 'subscribe_podchaser', 'subscribe_jiosaavn',
60 'subscribe_gaana', 'subscribe_pcindex', 'subscribe_amazon_music',
61 'subscribe_anghami',
62 ];
63 foreach ($subscribeKeys as $key) {
64 $props[$key] = $results['program_info'][$key] ?? false;
65 }
66
67 return PowerPressNetwork::getHTML('program-result.php', $props, null, null);
68 }
69 }
70 $GLOBALS['ppn_program'] = new PowerPressNetworkProgram();