| @@ -1,52 +1,58 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | 3 | /* |
| 4 | 4 | * Plugin Name: StreamCast |
| 5 | - * Plugin URI: https://wordpress.org/plugins/streamcasthttps://wordpress.org/ | |
| 5 | + * Plugin URI: https://wordpress.org/plugins/streamcast | |
| 6 | 6 | * Description: Play iceCast, Shoutcast, Radioco, Radionomy Live stream in Wordpress. |
| 7 | - * Version: 2.2.3 | |
| 7 | + * Version: 2.4.0 | |
| 8 | 8 | * Author: bPlugins |
| 9 | 9 | * Author URI: http://bPlugins.com |
| 10 | 10 | * License: GPLv2 |
| 11 | + * License URI: https://www.gnu.org/licenses/gpl-2.0.html | |
| 12 | + * Requires at least: 6.2 | |
| 13 | + * Tested up to: 6.9 | |
| 11 | 14 | * Text Domain: streamcast |
| 12 | 15 | * Domain Path: /languages |
| 13 | 16 | */ |
| 14 | -if ( function_exists( 'str_fs' ) ) { | |
| 15 | - str_fs()->set_basename( false, __FILE__ ); | |
| 17 | + | |
| 18 | +// ABS PATH | |
| 19 | +if (!defined('ABSPATH')) | |
| 20 | + exit; | |
| 21 | + | |
| 22 | + | |
| 23 | +if (function_exists('str_fs')) { | |
| 24 | + str_fs()->set_basename(false, __FILE__); | |
| 16 | 25 | } 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() { | |
| 26 | + // Some Setup | |
| 27 | + define('STP_PLUGIN_DIR', plugin_dir_url(__FILE__)); | |
| 28 | + define('STP_PLUGIN_PATH', plugin_dir_path(__FILE__)); | |
| 29 | + define('STP_PLUGIN_VERSION', '2.4.0'); | |
| 30 | + define('STP_PLUGIN_FILE', __FILE__); | |
| 31 | + define('STP_HAS_PRO', 'streamcast-premium/streamcast.php' === plugin_basename(__FILE__)); | |
| 32 | + | |
| 33 | + if (!function_exists('str_fs')) { | |
| 34 | + function str_fs() | |
| 35 | + { | |
| 21 | 36 | 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 | - } | |
| 37 | + if (!isset($str_fs)) { | |
| 38 | + | |
| 27 | 39 | // 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, | |
| 40 | + require_once dirname(__FILE__) . '/vendor/freemius/start.php'; | |
| 41 | + $str_fs = fs_dynamic_init(array( | |
| 42 | + 'id' => '6433', | |
| 43 | + 'slug' => 'streamcast', | |
| 44 | + 'type' => 'plugin', | |
| 45 | + 'public_key' => 'pk_a19d159db561c020210345da466f1', | |
| 46 | + 'is_premium' => false, | |
| 47 | + 'menu' => array( | |
| 48 | + 'slug' => 'edit.php?post_type=streamcast', | |
| 49 | + 'first-path' => 'edit.php?post_type=streamcast&page=streamcast#/dashboard', | |
| 50 | + 'support' => false, | |
| 51 | + 'affiliation' => false, | |
| 41 | 52 | ), |
| 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 | - ) ); | |
| 53 | + 'is_live' => true, | |
| 54 | + )); | |
| 49 | 55 | } |
| 50 | 56 | return $str_fs; |
| 51 | 57 | } |
| 52 | 58 | |
| @@ -52,190 +58,15 @@ | ||
| 52 | 58 | |
| 53 | 59 | // Init Freemius. |
| 54 | 60 | str_fs(); |
| 55 | 61 | // 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.3' ); | |
| 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 | - } | |
| 62 | + do_action('str_fs_loaded'); | |
| 63 | + } | |
| 66 | 64 | |
| 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 | 65 | |
| 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 | 66 | |
| 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 | - } | |
| 67 | + // Load main plugin class | |
| 68 | + require_once plugin_dir_path(__FILE__) . 'inc/class-stp-main.php'; | |
| 69 | + // Initialize | |
| 70 | + new \STP\STP_Main(); | |
| 133 | 71 | |
| 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">★★★★★</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 | 72 | } |