| @@ -1,215 +1,72 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | 3 | /* |
| 4 | - * Plugin Name: StreamCast | |
| 4 | + * Plugin Name: StreamCast – Live Radio Streaming Player | |
| 5 | 5 | * Plugin URI: https://wordpress.org/plugins/streamcast |
| 6 | 6 | * Description: Play iceCast, Shoutcast, Radioco, Radionomy Live stream in Wordpress. |
| 7 | - * Version: 1.1 | |
| 8 | - * Author: bPlugins LLC | |
| 7 | + * Version: 2.4.2 | |
| 8 | + * Author: bPlugins | |
| 9 | 9 | * Author URI: http://bPlugins.com |
| 10 | - * License: GPLv3 | |
| 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: 7.0 | |
| 11 | 14 | * Text Domain: streamcast |
| 12 | 15 | * Domain Path: /languages |
| 13 | 16 | */ |
| 14 | 17 | |
| 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 | -} | |
| 18 | +// ABS PATH | |
| 19 | +if (!defined('ABSPATH')) | |
| 20 | + exit; | |
| 58 | 21 | |
| 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 | 22 | |
| 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 | -} | |
| 23 | +if (function_exists('str_fs')) { | |
| 24 | + str_fs()->set_basename(false, __FILE__); | |
| 25 | +} else { | |
| 26 | + // Some Setup | |
| 27 | + define('STREAMCAST_PLUGIN_DIR', plugin_dir_url(__FILE__)); | |
| 28 | + define('STREAMCAST_PLUGIN_PATH', plugin_dir_path(__FILE__)); | |
| 29 | + define('STREAMCAST_PLUGIN_VERSION', '2.4.2'); | |
| 30 | + define('STREAMCAST_PLUGIN_FILE', __FILE__); | |
| 31 | + define('STREAMCAST_HAS_PRO', 'streamcast-premium/streamcast.php' === plugin_basename(__FILE__)); | |
| 93 | 32 | |
| 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 | -} | |
| 33 | + if (!function_exists('str_fs')) { | |
| 34 | + function str_fs() | |
| 35 | + { | |
| 36 | + global $str_fs; | |
| 37 | + if (!isset($str_fs)) { | |
| 108 | 38 | |
| 109 | -function stp_help_page_callback() | |
| 110 | -{ | |
| 111 | - include_once 'admin/whats-new.php'; | |
| 112 | -} | |
| 39 | + // Include Freemius SDK. | |
| 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, | |
| 52 | + ), | |
| 53 | + 'is_live' => true, | |
| 54 | + )); | |
| 55 | + } | |
| 56 | + return $str_fs; | |
| 57 | + } | |
| 113 | 58 | |
| 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">★★★★★</a> rating. Your Review is very important to us as it helps us to grow more. ', 'streamcast' ), $url ); | |
| 59 | + // Init Freemius. | |
| 60 | + str_fs(); | |
| 61 | + // Signal that SDK was initiated. | |
| 62 | + do_action('str_fs_loaded'); | |
| 122 | 63 | } |
| 123 | - | |
| 124 | - return $text; | |
| 125 | -} | |
| 126 | 64 | |
| 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 | 65 | |
| 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 | 66 | |
| 160 | -<script> | |
| 161 | -const player = new Plyr('#player', { | |
| 162 | - controls: [ 'play', 'mute', 'volume'] | |
| 163 | -}); | |
| 164 | -</script> | |
| 67 | + // Load main plugin class | |
| 68 | + require_once plugin_dir_path(__FILE__) . 'inc/class-streamcast-main.php'; | |
| 69 | + // Initialize | |
| 70 | + new \StreamCast\STREAMCAST_Main(); | |
| 165 | 71 | |
| 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 | -} | |
| 72 | +} | |