PluginProbe
StreamCast – bring live radio to your site with a sleek player / 2.2.4
StreamCast – bring live radio to your site with a sleek player v2.2.4
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 2.2.4, at streamcast.php

241 lines 9.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/streamcasthttps://wordpress.org/
6 * Description: Play iceCast, Shoutcast, Radioco, Radionomy Live stream in Wordpress.
7 * Version: 2.2.4
8 * Author: bPlugins
9 * Author URI: http://bPlugins.com
10 * License: GPLv2
11 * Text Domain: streamcast
12 * Domain Path: /languages
13 */
14 if ( function_exists( 'str_fs' ) ) {
15 str_fs()->set_basename( false, __FILE__ );
16 } else {
17 // DO NOT REMOVE THIS IF, IT IS ESSENTIAL FOR THE `function_exists` CALL ABOVE TO PROPERLY WORK.
18 if ( !function_exists( 'str_fs' ) ) {
19 // Create a helper function for easy SDK access.
20 function str_fs() {
21 global $str_fs;
22 if ( !isset( $str_fs ) ) {
23 // Activate multisite network integration.
24 if ( !defined( 'WP_FS__PRODUCT_6433_MULTISITE' ) ) {
25 define( 'WP_FS__PRODUCT_6433_MULTISITE', true );
26 }
27 // Include Freemius SDK.
28 require_once dirname( __FILE__ ) . '/freemius/start.php';
29 $str_fs = fs_dynamic_init( array(
30 'id' => '6433',
31 'slug' => 'streamcast',
32 'type' => 'plugin',
33 'public_key' => 'pk_a19d159db561c020210345da466f1',
34 'is_premium' => false,
35 'premium_suffix' => 'Pro',
36 'has_addons' => false,
37 'has_paid_plans' => true,
38 'trial' => array(
39 'days' => 7,
40 'is_require_payment' => true,
41 ),
42 'menu' => array(
43 'slug' => 'edit.php?post_type=streamcast',
44 'first-path' => 'edit.php?post_type=streamcast&page=help',
45 'support' => false,
46 ),
47 'is_live' => true,
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 /*Some Set-up*/
58 define( 'STP_PLUGIN_DIR', plugin_dir_url( __FILE__ ) );
59 define( 'STP_PLUGIN_PATH', plugin_dir_path( __FILE__ ) );
60 define( 'STP_PLUGIN_VERSION', '2.2.4' );
61 // load custom mimes
62 require_once 'mimes/enable-mime-type.php';
63 function stp_load_textdomain() {
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 wp_enqueue_style(
71 'stp-style',
72 plugin_dir_url( __FILE__ ) . 'public/css/radio.css',
73 array(),
74 STP_PLUGIN_VERSION,
75 'all'
76 );
77 wp_enqueue_style(
78 'stp-player-style',
79 plugin_dir_url( __FILE__ ) . 'public/css/styles.css',
80 array(),
81 STP_PLUGIN_VERSION,
82 'all'
83 );
84 wp_enqueue_script(
85 'ultimate-script',
86 plugin_dir_url( __FILE__ ) . 'public/js/ultimate.js',
87 array('jquery'),
88 STP_PLUGIN_VERSION,
89 true
90 );
91 wp_enqueue_script(
92 'stp-script',
93 STP_PLUGIN_DIR . 'public/js/streamcast-final.js',
94 array('jquery'),
95 STP_PLUGIN_VERSION,
96 false
97 );
98 wp_register_script(
99 'stp',
100 STP_PLUGIN_DIR . 'public/js/script.js',
101 array('jquery'),
102 STP_PLUGIN_VERSION,
103 false
104 );
105 }
106
107 add_action( 'wp_enqueue_scripts', 'stp_style_and_scripts' );
108 function stp_admin_style_and_scripts( $screen ) {
109 if ( 'streamcast_page_help' == $screen ) {
110 wp_enqueue_style(
111 'stp-admin',
112 plugin_dir_url( __FILE__ ) . 'admin/css/admin.css',
113 array(),
114 STP_PLUGIN_VERSION,
115 'all'
116 );
117 }
118 }
119
120 add_action( 'admin_enqueue_scripts', 'stp_admin_style_and_scripts' );
121 // Help page and after activation redirect
122 add_action( 'admin_menu', 'stp_howto_page' );
123 function stp_howto_page() {
124 add_submenu_page(
125 'edit.php?post_type=streamcast',
126 'Getting Started',
127 'Getting Started',
128 'manage_options',
129 'help',
130 'stp_help_page_callback'
131 );
132 }
133
134 function stp_help_page_callback() {
135 include_once 'admin/whats-new.php';
136 }
137
138 // Footer Review Request
139 add_filter( 'admin_footer_text', 'stp_admin_footer' );
140 function stp_admin_footer( $text ) {
141 if ( 'streamcast' == get_post_type() ) {
142 $url = 'https://wordpress.org/support/plugin/streamcast/reviews/?filter=5#new-post';
143 $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 );
144 }
145 return $text;
146 }
147
148 //Common ShortCode
149 function stp_stream_sc_cb( $atts ) {
150 extract( shortcode_atts( array(
151 'url' => null,
152 'background' => null,
153 ), $atts ) );
154 ob_start();
155 ?>
156
157 <div style="width:200px;">
158 <audio id="player" controls>
159 <source src="<?php
160 echo esc_url( $url );
161 ?>" type="audio/mp3" />
162 </audio>
163 </div>
164 <style>
165 .plyr__control{margin-right:0 !important;}
166
167 .plyr--audio .plyr__controls {
168 <?php
169 if ( !empty( $background ) ) {
170 echo 'background:' . esc_html( $background ) . '!important;border-radius:3px !important;';
171 } else {
172 echo 'background: transparent!important; border-radius:3px !important;';
173 }
174 ?> }
175
176 </style>
177
178 <script>
179 const player = new Plyr('#player', {
180 controls: [ 'play', 'mute', 'volume']
181 });
182 </script>
183
184 <?php
185 $output = ob_get_clean();
186 return $output;
187 ?>
188
189 <?php
190 }
191
192 add_shortcode( 'stream', 'stp_stream_sc_cb' );
193 //Live Demo In menu
194 if ( str_fs()->is_free_plan() ) {
195 add_action( 'admin_menu', 'stp_add_custom_link_into_cpt_menu' );
196 function stp_add_custom_link_into_cpt_menu() {
197 global $submenu;
198 $link = 'http://wpradioplayer.com/';
199 $submenu['edit.php?post_type=streamcast'][] = array(
200 'PRO Version Demo',
201 'manage_options',
202 $link,
203 'meta' => 'target="_blank"'
204 );
205 }
206
207 }
208 function stp_my_custom_script() {
209 ?>
210 <script type="text/javascript">
211 jQuery(document).ready( function($) {
212 $( "ul#adminmenu a[href$='https://bplugins.page.link/demo']" ).attr( 'target', '_blank' );
213 });
214 </script>
215 <?php
216 }
217
218 add_action( 'admin_head', 'stp_my_custom_script' );
219 /*-------------------------------------------------------------------------------*/
220 /* FRAMEWORK + OTHER INC
221 /*-------------------------------------------------------------------------------*/
222 require_once 'inc/cpt.php';
223 if ( !class_exists( 'CSF' ) ) {
224 require_once 'admin/codestar-framework/codestar-framework.php';
225 }
226 if ( str_fs()->is_free_plan() ) {
227 // free version code
228 require_once 'admin/inc/metabox-free.php';
229 require_once 'public/shortcode-free.php';
230 }
231 if ( str_fs()->can_use_premium_code__premium_only() && file_exists( __DIR__ . '/premium-files/metabox-pro.php' ) ) {
232 // pro version code
233 require_once 'premium-files/metabox-pro.php';
234 require_once 'premium-files/shortcode-pro.php';
235 require_once 'premium-files/widgets.php';
236 require_once 'premium-files/blocks/index.php';
237 require_once 'premium-files/assets.php';
238 }
239 }
240 // ... Your plugin's main file logic ...
241 }