PluginProbe
StreamCast – bring live radio to your site with a sleek player / 1.1
StreamCast – bring live radio to your site with a sleek player v1.1
2.4.5 2.4.4 trunk 1.0 1.1 2.0.0 2.1.10 2.1.2 2.1.4 2.1.5 2.1.8 2.2.1 2.2.3 2.2.4 2.2.5 2.3.0 2.3.1 2.3.2 2.3.3 2.3.4 2.3.5 2.3.6 2.3.7 2.3.8 2.3.9 All 29 releases
streamcast / streamcast.php

streamcast.php in StreamCast – bring live radio to your site with a sleek player 1.1, at streamcast.php

216 lines 6.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 /*
4 * Plugin Name: StreamCast
5 * Plugin URI: https://wordpress.org/plugins/streamcast
6 * Description: Play iceCast, Shoutcast, Radioco, Radionomy Live stream in Wordpress.
7 * Version: 1.1
8 * Author: bPlugins LLC
9 * Author URI: http://bPlugins.com
10 * License: GPLv3
11 * Text Domain: streamcast
12 * Domain Path: /languages
13 */
14
15 if ( !function_exists( 'str_fs' ) ) {
16 // Create a helper function for easy SDK access.
17 function str_fs()
18 {
19 global $str_fs ;
20
21 if ( !isset( $str_fs ) ) {
22 // Activate multisite network integration.
23 if ( !defined( 'WP_FS__PRODUCT_6433_MULTISITE' ) ) {
24 define( 'WP_FS__PRODUCT_6433_MULTISITE', true );
25 }
26 // Include Freemius SDK.
27 require_once dirname( __FILE__ ) . '/freemius/start.php';
28 $str_fs = fs_dynamic_init( array(
29 'id' => '6433',
30 'slug' => 'streamcast',
31 'type' => 'plugin',
32 'public_key' => 'pk_a19d159db561c020210345da466f1',
33 'is_premium' => false,
34 'premium_suffix' => 'Pro',
35 'has_addons' => false,
36 'has_paid_plans' => true,
37 'trial' => array(
38 'days' => 7,
39 'is_require_payment' => true,
40 ),
41 'menu' => array(
42 'slug' => 'edit.php?post_type=streamcast',
43 'first-path' => 'edit.php?post_type=streamcast&page=help',
44 'support' => false,
45 ),
46 'is_live' => true,
47 ) );
48 }
49
50 return $str_fs;
51 }
52
53 // Init Freemius.
54 str_fs();
55 // Signal that SDK was initiated.
56 do_action( 'str_fs_loaded' );
57 }
58
59 /*Some Set-up*/
60 define( 'STP_PLUGIN_DIR', WP_PLUGIN_URL . '/' . plugin_basename( dirname( __FILE__ ) ) . '/' );
61 define( 'STP_PLUGIN_VERSION', '1.1' );
62 function stp_load_textdomain()
63 {
64 load_plugin_textdomain( 'streamcast', false, dirname( __FILE__ ) . "/languages" );
65 }
66
67 add_action( "plugins_loaded", 'stp_load_textdomain' );
68 //Script and style
69 function stp_style_and_scripts()
70 {
71 wp_enqueue_style(
72 'stp-style',
73 plugin_dir_url( __FILE__ ) . 'public/css/radio.css',
74 array(),
75 STP_PLUGIN_VERSION,
76 'all'
77 );
78 wp_enqueue_style(
79 'stp-player-style',
80 plugin_dir_url( __FILE__ ) . 'public/css/styles.css',
81 array(),
82 STP_PLUGIN_VERSION,
83 'all'
84 );
85 wp_enqueue_script(
86 'stp-script',
87 plugin_dir_url( __FILE__ ) . 'public/js/streamcast-final.js',
88 array( 'jquery' ),
89 STP_PLUGIN_VERSION,
90 false
91 );
92 }
93
94 add_action( 'wp_enqueue_scripts', 'stp_style_and_scripts' );
95 // Help page and after activation redirect
96 add_action( 'admin_menu', 'stp_howto_page' );
97 function stp_howto_page()
98 {
99 add_submenu_page(
100 'edit.php?post_type=streamcast',
101 'Getting Started',
102 'Getting Started',
103 'manage_options',
104 'help',
105 'stp_help_page_callback'
106 );
107 }
108
109 function stp_help_page_callback()
110 {
111 include_once 'admin/whats-new.php';
112 }
113
114 // Footer Review Request
115 add_filter( 'admin_footer_text', 'stp_admin_footer' );
116 function stp_admin_footer( $text )
117 {
118
119 if ( 'streamcast' == get_post_type() ) {
120 $url = 'https://wordpress.org/support/plugin/streamcast/reviews/?filter=5#new-post';
121 $text = sprintf( __( 'If you like <strong>StreamCast Radio Player</strong> plugin please leave us a <a href="%s" target="_blank">&#9733;&#9733;&#9733;&#9733;&#9733;</a> rating. Your Review is very important to us as it helps us to grow more. ', 'streamcast' ), $url );
122 }
123
124 return $text;
125 }
126
127 //Common ShortCode
128 function stp_stream_sc_cb( $atts )
129 {
130 extract( shortcode_atts( array(
131 'url' => null,
132 'background' => null,
133 ), $atts ) );
134 ob_start();
135 ?>
136
137 <div style="width:200px;">
138 <audio id="player" controls>
139 <source src="<?php
140 echo $url ;
141 ?>" type="audio/mp3" />
142 </audio>
143 </div>
144 <style>
145 .plyr__control{margin-right:0 !important;}
146
147 .plyr--audio .plyr__controls {
148 <?php
149
150 if ( !empty($background) ) {
151 echo 'background:' . $background . '!important;border-radius:3px !important;' ;
152 } else {
153 echo 'background: transparent!important; border-radius:3px !important;' ;
154 }
155
156 ?> }
157
158 </style>
159
160 <script>
161 const player = new Plyr('#player', {
162 controls: [ 'play', 'mute', 'volume']
163 });
164 </script>
165
166 <?php
167 $output = ob_get_clean();
168 return $output;
169 ?>
170
171 <?php
172 }
173
174 add_shortcode( 'stream', 'stp_stream_sc_cb' );
175 //Live Demo In menu
176
177 if ( str_fs()->is_free_plan() ) {
178 add_action( 'admin_menu', 'stp_add_custom_link_into_cpt_menu' );
179 function stp_add_custom_link_into_cpt_menu()
180 {
181 global $submenu ;
182 $link = 'https://bplugins.page.link/demo';
183 $submenu['edit.php?post_type=streamcast'][] = array(
184 'PRO Version Demo',
185 'manage_options',
186 $link,
187 'meta' => 'target="_blank"'
188 );
189 }
190
191 }
192
193 function stp_my_custom_script()
194 {
195 ?>
196 <script type="text/javascript">
197 jQuery(document).ready( function($) {
198 $( "ul#adminmenu a[href$='https://bplugins.page.link/demo']" ).attr( 'target', '_blank' );
199 });
200 </script>
201 <?php
202 }
203
204 add_action( 'admin_head', 'stp_my_custom_script' );
205 /*-------------------------------------------------------------------------------*/
206 /* FRAMEWORK + OTHER INC
207 /*-------------------------------------------------------------------------------*/
208 require_once 'inc/cpt.php';
209 require_once 'admin/codestar-framework/codestar-framework.php';
210
211 if ( str_fs()->is_free_plan() ) {
212 // free version code
213 require_once 'admin/codestar-framework/metabox-free.php';
214 require_once 'public/shortcode-free.php';
215 }
216