| 1 |
<?php |
| 2 |
|
| 3 |
/* |
| 4 |
* Plugin Name: StreamCast |
| 5 |
* Plugin URI: http://wpradioplayer.com/ |
| 6 |
* Description: Radio Player Plugin for WordPress, You can Play iceCast, Shoutcast, Radioco, Radionomy Live stream using this plugin. |
| 7 |
* Version: 2.0.0 |
| 8 |
* Author: bPlugins |
| 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 |
// load custom mimes |
| 63 |
require_once 'mimes/enable-mime-type.php'; |
| 64 |
function stp_load_textdomain() |
| 65 |
{ |
| 66 |
load_plugin_textdomain( 'streamcast', false, dirname( __FILE__ ) . "/languages" ); |
| 67 |
} |
| 68 |
|
| 69 |
add_action( "plugins_loaded", 'stp_load_textdomain' ); |
| 70 |
//Script and style |
| 71 |
function stp_style_and_scripts() |
| 72 |
{ |
| 73 |
wp_enqueue_style( |
| 74 |
'stp-style', |
| 75 |
plugin_dir_url( __FILE__ ) . 'public/css/radio.css', |
| 76 |
array(), |
| 77 |
STP_PLUGIN_VERSION, |
| 78 |
'all' |
| 79 |
); |
| 80 |
wp_enqueue_style( |
| 81 |
'stp-player-style', |
| 82 |
plugin_dir_url( __FILE__ ) . 'public/css/styles.css', |
| 83 |
array(), |
| 84 |
STP_PLUGIN_VERSION, |
| 85 |
'all' |
| 86 |
); |
| 87 |
wp_enqueue_script( |
| 88 |
'stp-script', |
| 89 |
plugin_dir_url( __FILE__ ) . 'public/js/streamcast-final.js', |
| 90 |
array( 'jquery' ), |
| 91 |
STP_PLUGIN_VERSION, |
| 92 |
false |
| 93 |
); |
| 94 |
wp_enqueue_script( |
| 95 |
'ultimate-script', |
| 96 |
plugin_dir_url( __FILE__ ) . 'public/js/ultimate.js', |
| 97 |
array( 'jquery' ), |
| 98 |
STP_PLUGIN_VERSION, |
| 99 |
true |
| 100 |
); |
| 101 |
} |
| 102 |
|
| 103 |
add_action( 'wp_enqueue_scripts', 'stp_style_and_scripts' ); |
| 104 |
function stp_admin_style_and_scripts( $screen ) |
| 105 |
{ |
| 106 |
if ( 'streamcast_page_help' == $screen ) { |
| 107 |
wp_enqueue_style( |
| 108 |
'stp-admin', |
| 109 |
plugin_dir_url( __FILE__ ) . 'admin/css/admin.css', |
| 110 |
array(), |
| 111 |
STP_PLUGIN_VERSION, |
| 112 |
'all' |
| 113 |
); |
| 114 |
} |
| 115 |
} |
| 116 |
|
| 117 |
add_action( 'admin_enqueue_scripts', 'stp_admin_style_and_scripts' ); |
| 118 |
// Help page and after activation redirect |
| 119 |
add_action( 'admin_menu', 'stp_howto_page' ); |
| 120 |
function stp_howto_page() |
| 121 |
{ |
| 122 |
add_submenu_page( |
| 123 |
'edit.php?post_type=streamcast', |
| 124 |
'Getting Started', |
| 125 |
'Getting Started', |
| 126 |
'manage_options', |
| 127 |
'help', |
| 128 |
'stp_help_page_callback' |
| 129 |
); |
| 130 |
} |
| 131 |
|
| 132 |
function stp_help_page_callback() |
| 133 |
{ |
| 134 |
include_once 'admin/whats-new.php'; |
| 135 |
} |
| 136 |
|
| 137 |
// Footer Review Request |
| 138 |
add_filter( 'admin_footer_text', 'stp_admin_footer' ); |
| 139 |
function stp_admin_footer( $text ) |
| 140 |
{ |
| 141 |
|
| 142 |
if ( 'streamcast' == get_post_type() ) { |
| 143 |
$url = 'https://wordpress.org/support/plugin/streamcast/reviews/?filter=5#new-post'; |
| 144 |
$text = sprintf( __( 'If you like <strong>StreamCast Radio Player</strong> plugin please leave us a <a href="%s" target="_blank">★★★★★</a> rating. Your Review is very important to us as it helps us to grow more. ', 'streamcast' ), $url ); |
| 145 |
} |
| 146 |
|
| 147 |
return $text; |
| 148 |
} |
| 149 |
|
| 150 |
//Common ShortCode |
| 151 |
function stp_stream_sc_cb( $atts ) |
| 152 |
{ |
| 153 |
extract( shortcode_atts( array( |
| 154 |
'url' => null, |
| 155 |
'background' => null, |
| 156 |
), $atts ) ); |
| 157 |
ob_start(); |
| 158 |
?> |
| 159 |
|
| 160 |
<div style="width:200px;"> |
| 161 |
<audio id="player" controls> |
| 162 |
<source src="<?php |
| 163 |
echo $url ; |
| 164 |
?>" type="audio/mp3" /> |
| 165 |
</audio> |
| 166 |
</div> |
| 167 |
<style> |
| 168 |
.plyr__control{margin-right:0 !important;} |
| 169 |
|
| 170 |
.plyr--audio .plyr__controls { |
| 171 |
<?php |
| 172 |
|
| 173 |
if ( !empty($background) ) { |
| 174 |
echo 'background:' . $background . '!important;border-radius:3px !important;' ; |
| 175 |
} else { |
| 176 |
echo 'background: transparent!important; border-radius:3px !important;' ; |
| 177 |
} |
| 178 |
|
| 179 |
?> } |
| 180 |
|
| 181 |
</style> |
| 182 |
|
| 183 |
<script> |
| 184 |
const player = new Plyr('#player', { |
| 185 |
controls: [ 'play', 'mute', 'volume'] |
| 186 |
}); |
| 187 |
</script> |
| 188 |
|
| 189 |
<?php |
| 190 |
$output = ob_get_clean(); |
| 191 |
return $output; |
| 192 |
?> |
| 193 |
|
| 194 |
<?php |
| 195 |
} |
| 196 |
|
| 197 |
add_shortcode( 'stream', 'stp_stream_sc_cb' ); |
| 198 |
//Live Demo In menu |
| 199 |
|
| 200 |
if ( str_fs()->is_free_plan() ) { |
| 201 |
add_action( 'admin_menu', 'stp_add_custom_link_into_cpt_menu' ); |
| 202 |
function stp_add_custom_link_into_cpt_menu() |
| 203 |
{ |
| 204 |
global $submenu ; |
| 205 |
$link = 'http://wpradioplayer.com/'; |
| 206 |
$submenu['edit.php?post_type=streamcast'][] = array( |
| 207 |
'PRO Version Demo', |
| 208 |
'manage_options', |
| 209 |
$link, |
| 210 |
'meta' => 'target="_blank"' |
| 211 |
); |
| 212 |
} |
| 213 |
|
| 214 |
} |
| 215 |
|
| 216 |
function stp_my_custom_script() |
| 217 |
{ |
| 218 |
?> |
| 219 |
<script type="text/javascript"> |
| 220 |
jQuery(document).ready( function($) { |
| 221 |
$( "ul#adminmenu a[href$='https://bplugins.page.link/demo']" ).attr( 'target', '_blank' ); |
| 222 |
}); |
| 223 |
</script> |
| 224 |
<?php |
| 225 |
} |
| 226 |
|
| 227 |
add_action( 'admin_head', 'stp_my_custom_script' ); |
| 228 |
/*-------------------------------------------------------------------------------*/ |
| 229 |
/* FRAMEWORK + OTHER INC |
| 230 |
/*-------------------------------------------------------------------------------*/ |
| 231 |
require_once 'inc/cpt.php'; |
| 232 |
require_once 'admin/codestar-framework/codestar-framework.php'; |
| 233 |
|
| 234 |
if ( str_fs()->is_free_plan() ) { |
| 235 |
// free version code |
| 236 |
require_once 'admin/codestar-framework/metabox-free.php'; |
| 237 |
require_once 'public/shortcode-free.php'; |
| 238 |
} |
| 239 |
|