| @@ -1,5 +1,6 @@ | ||
| 1 | 1 | <?php |
| 2 | + | |
| 2 | 3 | /** |
| 3 | 4 | * The file that defines the core plugin class |
| 4 | 5 | * |
| 5 | 6 | * A class definition that includes attributes and functions used across both the |
| @@ -34,9 +35,8 @@ | ||
| 34 | 35 | * @since 3.0.1 |
| 35 | 36 | * @var object The main class. |
| 36 | 37 | */ |
| 37 | 38 | public $main; |
| 38 | - public $admin; | |
| 39 | 39 | |
| 40 | 40 | /** |
| 41 | 41 | * The loader that's responsible for maintaining and registering all hooks that power |
| 42 | 42 | * the plugin. |
| @@ -76,54 +76,45 @@ | ||
| 76 | 76 | */ |
| 77 | 77 | |
| 78 | 78 | public $wpstream_live_connection; |
| 79 | 79 | public $wpstream_player; |
| 80 | - public $quota_manager; | |
| 81 | 80 | public $xtest; |
| 82 | 81 | public $plugin_admin; |
| 83 | 82 | |
| 84 | 83 | public function __construct() { |
| 85 | - $this->main = $this; | |
| 86 | - | |
| 84 | + $this->main = $this; | |
| 87 | 85 | if ( defined( 'WPSTREAM_PLUGIN_VERSION' ) ) { |
| 88 | - $this->version = WPSTREAM_PLUGIN_VERSION; | |
| 86 | + $this->version = WPSTREAM_PLUGIN_VERSION; | |
| 89 | 87 | } else { |
| 90 | - $this->version = '3.0.1'; | |
| 88 | + $this->version = '3.0.1'; | |
| 91 | 89 | } |
| 92 | - | |
| 93 | 90 | $this->plugin_name = 'wpstream'; |
| 94 | 91 | |
| 95 | 92 | $this->load_dependencies(); |
| 93 | + $this->set_locale(); | |
| 96 | 94 | $this->define_admin_hooks(); |
| 97 | 95 | $this->define_public_hooks(); |
| 98 | - $this->define_ajax_hooks(); | |
| 99 | - $this->wpstream_load_page_templates(); | |
| 100 | - $this->wpstream_load_theme_notice(); | |
| 96 | + | |
| 97 | + | |
| 98 | + $this->wpstream_conection(); | |
| 99 | + $this->wpstream_player(); | |
| 101 | 100 | |
| 102 | - $this->wpstream_conection(); | |
| 103 | - $this->wpstream_player(); | |
| 104 | - $this->wpstream_init_quota_manager(); | |
| 105 | - | |
| 106 | 101 | } |
| 107 | 102 | |
| 108 | - | |
| 109 | - | |
| 110 | - | |
| 111 | - | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 112 | 107 | public function wpstream_convert_band($megabits){ |
| 113 | - $gigabit = $megabits * 0.001; | |
| 114 | - return floatval( sprintf( '%.1f', $gigabit ) ); | |
| 108 | + $gigabit = $megabits * 0.001; | |
| 109 | + $gigabit = number_format($gigabit,2); | |
| 110 | + return $gigabit; | |
| 115 | 111 | } |
| 116 | 112 | |
| 117 | - | |
| 118 | - public $wpstream_ajax; | |
| 119 | - | |
| 120 | - private function define_ajax_hooks() { | |
| 121 | - require_once plugin_dir_path(dirname(__FILE__)) . 'includes/class-wpstream-ajax.php'; | |
| 122 | - $this->wpstream_ajax = new WpStream_Ajax( $this->main ); | |
| 123 | - } | |
| 124 | 113 | |
| 125 | 114 | |
| 115 | + | |
| 116 | + | |
| 126 | 117 | private function wpstream_conection(){ |
| 127 | 118 | require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wpstream-live-api-connection.php'; |
| 128 | 119 | $this->wpstream_live_connection = new Wpstream_Live_Api_Connection(); |
| 129 | 120 | } |
| @@ -132,26 +123,12 @@ | ||
| 132 | 123 | private function wpstream_player(){ |
| 133 | 124 | require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wpstream-player.php'; |
| 134 | 125 | $this->wpstream_player = new Wpstream_Player($this->main); |
| 135 | 126 | } |
| 136 | - | |
| 137 | - private function wpstream_init_quota_manager() { | |
| 138 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wpstream-quota-manager.php'; | |
| 139 | - $this->quota_manager = new Wpstream_Quota_Manager( $this ); | |
| 140 | - } | |
| 141 | - | |
| 142 | - | |
| 143 | - private function wpstream_load_page_templates() { | |
| 144 | - require_once WPSTREAM_PLUGIN_PATH . 'includes/class-wpstream-templates.php'; | |
| 145 | - new WpStream_Template_Loader(); | |
| 146 | - } | |
| 147 | - | |
| 148 | - private function wpstream_load_theme_notice() { | |
| 149 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wpstream-theme-notice.php'; | |
| 150 | - new WPStream_Theme_Notice(); | |
| 151 | - } | |
| 152 | 127 | |
| 153 | 128 | |
| 129 | + | |
| 130 | + | |
| 154 | 131 | /** |
| 155 | 132 | * Load the required dependencies for this plugin. |
| 156 | 133 | * |
| 157 | 134 | * Include the following files that make up the plugin: |
| @@ -190,21 +167,19 @@ | ||
| 190 | 167 | * The class responsible for defining all actions that occur in the public-facing |
| 191 | 168 | * side of the site. |
| 192 | 169 | */ |
| 193 | 170 | require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wpstream-public.php'; |
| 194 | - /** | |
| 171 | + | |
| 172 | + /** | |
| 195 | 173 | * The class responsible for custom post type |
| 196 | 174 | |
| 197 | - */ | |
| 198 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wpstream_product.php'; | |
| 199 | - if( class_exists( 'WooCommerce' ) ){ | |
| 200 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wc_product_live_stream.php'; | |
| 201 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wc_product_video_on_demand.php'; | |
| 202 | - } | |
| 175 | + */ | |
| 176 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wpstream_product.php'; | |
| 177 | + if( class_exists( 'WooCommerce' ) ){ | |
| 178 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wc_product_live_stream.php'; | |
| 179 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wc_product_video_on_demand.php'; | |
| 180 | + } | |
| 203 | 181 | |
| 204 | - require_once plugin_dir_path(__FILE__) . 'Helpers/class-wpstream-log-entry.php'; | |
| 205 | - require_once plugin_dir_path(__FILE__) . 'Logger/class-wpstream-logger.php'; | |
| 206 | - | |
| 207 | 182 | $this->loader = new Wpstream_Loader(); |
| 208 | 183 | |
| 209 | 184 | } |
| 210 | 185 | |
| @@ -220,9 +195,9 @@ | ||
| 220 | 195 | private function set_locale() { |
| 221 | 196 | |
| 222 | 197 | $plugin_i18n = new Wpstream_i18n(); |
| 223 | 198 | |
| 224 | - $this->loader->add_action( 'plugins_loaded', $plugin_i18n, 'load_plugin_textdomain', 1 ); | |
| 199 | + $this->loader->add_action( 'plugins_loaded', $plugin_i18n, 'load_plugin_textdomain' ); | |
| 225 | 200 | |
| 226 | 201 | } |
| 227 | 202 | |
| 228 | 203 | /** |
| @@ -233,26 +208,24 @@ | ||
| 233 | 208 | * @access private |
| 234 | 209 | */ |
| 235 | 210 | private function define_admin_hooks() { |
| 236 | 211 | |
| 237 | - $plugin_admin = new Wpstream_Admin( $this->get_plugin_name(), $this->get_version(), $this->main ); | |
| 238 | - | |
| 239 | - $this->admin = $plugin_admin; | |
| 240 | - | |
| 241 | - $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_styles' ); | |
| 212 | + $this->admin= $plugin_admin = new Wpstream_Admin( $this->get_plugin_name(), $this->get_version(), $this->main ); | |
| 213 | + | |
| 214 | + $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_styles' ); | |
| 242 | 215 | $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_scripts' ); |
| 243 | 216 | $this->loader->add_action( 'admin_menu', $plugin_admin, 'wpstream_manage_admin_menu',999); |
| 244 | - | |
| 217 | + | |
| 245 | 218 | $plugin_post_types = new Wpstream_Product(); |
| 246 | 219 | $this->loader->add_action( 'init', $plugin_post_types, 'create_custom_post_type', 999 ); |
| 247 | - | |
| 220 | + | |
| 248 | 221 | // save and render metaboxed |
| 249 | - $this->loader->add_action( 'add_meta_boxes', $plugin_admin, 'add_wpstream_product_metaboxes' ); | |
| 250 | - $this->loader->add_action( 'save_post', $plugin_admin, 'wpstream_free_product_update_post',1,2 ); | |
| 251 | - $this->loader->add_action( 'publish_wpstream_product', $plugin_admin, 'wpstream_publish_wpstream_product',1,2 ); | |
| 252 | - | |
| 253 | - | |
| 254 | - | |
| 222 | + $this->loader->add_action( 'admin_init', $plugin_admin, 'add_wpstream_product_metaboxes' ); | |
| 223 | + $this->loader->add_action( 'save_post', $plugin_admin, 'wpstream_free_product_update_post',1,2 ); | |
| 224 | + $this->loader->add_action( 'publish_wpstream_product', $plugin_admin, 'wpstream_publish_wpstream_product',1,2 ); | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 255 | 228 | // make product virtual |
| 256 | 229 | $this->loader->add_action( 'save_post', $plugin_admin, 'wpstream_make_product_virtual', 99999, 2 ); |
| 257 | 230 | |
| 258 | 231 | |
| @@ -262,65 +235,57 @@ | ||
| 262 | 235 | |
| 263 | 236 | // on boarding actions |
| 264 | 237 | $this->loader->add_action('admin_footer',$plugin_admin, 'wpstream_admin_footer_onboarding'); |
| 265 | 238 | $this->loader->add_action( 'wp_ajax_wpstream_on_board_create_channel', $plugin_admin,'wpstream_on_board_create_channel' ); |
| 266 | - $this->loader->add_action( 'wp_ajax_wpstream_on_board_create_channel_ppv', $plugin_admin,'wpstream_on_board_create_channel_ppv' ); | |
| 267 | - $this->loader->add_action( 'wp_ajax_wpstream_on_board_create_free_vod', $plugin_admin,'wpstream_on_board_create_free_vod' ); | |
| 268 | - $this->loader->add_action( 'wp_ajax_wpstream_on_board_create_ppv_vod', $plugin_admin,'wpstream_on_board_create_ppv_vod' ); | |
| 239 | + $this->loader->add_action( 'wp_ajax_wpstream_on_board_create_channel_ppv', $plugin_admin,'wpstream_on_board_create_channel_ppv' ); | |
| 240 | + $this->loader->add_action( 'wp_ajax_wpstream_on_board_create_free_vod', $plugin_admin,'wpstream_on_board_create_free_vod' ); | |
| 241 | + $this->loader->add_action( 'wp_ajax_wpstream_on_board_create_ppv_vod', $plugin_admin,'wpstream_on_board_create_ppv_vod' ); | |
| 242 | + | |
| 269 | 243 | |
| 270 | - | |
| 271 | 244 | $this->loader->add_action( 'wp_ajax_wpstream_on_board_login', $plugin_admin,'wpstream_on_board_login' ); |
| 272 | 245 | $this->loader->add_action( 'wp_ajax_wpstream_on_board_register', $plugin_admin,'wpstream_on_board_register' ); |
| 273 | - $this->loader->add_action( 'wp_ajax_wpstream_get_captcha_challenge', $plugin_admin, 'wpstream_get_captcha_challenge' ); | |
| 274 | - $this->loader->add_action( 'wp_ajax_nopriv_wpstream_get_captcha_challenge', $plugin_admin, 'wpstream_get_captcha_challenge' ); | |
| 275 | 246 | |
| 276 | - // Register AJAX actions for multipart uploads | |
| 277 | - $this->loader->add_action( 'wp_ajax_wpstream_initiate_multipart_upload', $plugin_admin, 'handle_initiate_multipart_upload' ); | |
| 278 | - $this->loader->add_action( 'wp_ajax_wpstream_complete_multipart_upload', $plugin_admin, 'handle_complete_multipart_upload' ); | |
| 279 | 247 | |
| 280 | 248 | $this->loader->add_action( 'admin_notices', $plugin_admin,'wpstream_admin_notice' ); |
| 281 | - $this->loader->add_action( 'admin_notices', $plugin_admin,'wpstream_plugin_update_available_notice' ); | |
| 282 | - | |
| 283 | 249 | $this->loader->add_action( 'wp_ajax_wpstream_update_cache_notice', $plugin_admin,'wpstream_update_cache_notice' ); |
| 284 | -// $this->loader->add_action( 'wp_ajax_wpstream_get_videos_list', $plugin_admin,'wpstream_get_videos_list' ); | |
| 250 | + | |
| 285 | 251 | |
| 286 | 252 | |
| 287 | - $this->loader->add_action( 'wp_ajax_wpstream_settings_tab_update_plugin', $plugin_admin, 'wpstream_settings_tab_update_plugin' ); | |
| 288 | - | |
| 253 | + | |
| 289 | 254 | // add and save category extra fields |
| 290 | 255 | $this->loader->add_action( 'category_edit_form_fields', $plugin_post_types, 'wpstream_category_callback_function', 10, 2); |
| 291 | - $this->loader->add_action( 'category_add_form_fields', $plugin_post_types, 'wpstream_category_callback_add_function' ); | |
| 256 | + $this->loader->add_action( 'category_add_form_fields', $plugin_post_types, 'wpstream_category_callback_add_function', 10, 2 ); | |
| 292 | 257 | $this->loader->add_action( 'created_category', $plugin_post_types, 'wpstream_category_save_extra_fields_callback', 10, 2); |
| 293 | 258 | $this->loader->add_action( 'edited_category', $plugin_post_types, 'wpstream_category_save_extra_fields_callback', 10, 2); |
| 294 | 259 | |
| 295 | 260 | $this->loader->add_action( 'product_cat_edit_form_fields', $plugin_post_types, 'wpstream_category_callback_function', 10, 2); |
| 296 | - $this->loader->add_action( 'product_cat_add_form_fields', $plugin_post_types, 'wpstream_category_callback_add_function' ); | |
| 261 | + $this->loader->add_action( 'product_cat_add_form_fields', $plugin_post_types, 'wpstream_category_callback_add_function', 10, 2 ); | |
| 297 | 262 | $this->loader->add_action( 'created_product_cat', $plugin_post_types, 'wpstream_category_save_extra_fields_callback', 10, 2); |
| 298 | 263 | $this->loader->add_action( 'edited_product_cat', $plugin_post_types, 'wpstream_category_save_extra_fields_callback', 10, 2); |
| 299 | 264 | |
| 300 | 265 | |
| 301 | 266 | $this->loader->add_action( 'wpstream_category_edit_form_fields', $plugin_post_types, 'wpstream_category_callback_function', 10, 2); |
| 302 | - $this->loader->add_action( 'wpstream_category_add_form_fields', $plugin_post_types, 'wpstream_category_callback_add_function' ); | |
| 267 | + $this->loader->add_action( 'wpstream_category_add_form_fields', $plugin_post_types, 'wpstream_category_callback_add_function', 10, 2 ); | |
| 303 | 268 | $this->loader->add_action( 'created_wpstream_category', $plugin_post_types, 'wpstream_category_save_extra_fields_callback', 10, 2); |
| 304 | 269 | $this->loader->add_action( 'edited_wpstream_category', $plugin_post_types, 'wpstream_category_save_extra_fields_callback', 10, 2); |
| 305 | 270 | |
| 306 | 271 | |
| 307 | 272 | $this->loader->add_action( 'wpstream_actors_edit_form_fields', $plugin_post_types, 'wpstream_category_callback_function', 10, 2); |
| 308 | - $this->loader->add_action( 'wpstream_actors_add_form_fields', $plugin_post_types, 'wpstream_category_callback_add_function' ); | |
| 273 | + $this->loader->add_action( 'wpstream_actors_add_form_fields', $plugin_post_types, 'wpstream_category_callback_add_function', 10, 2 ); | |
| 309 | 274 | $this->loader->add_action( 'created_wpstream_actors', $plugin_post_types, 'wpstream_category_save_extra_fields_callback', 10, 2); |
| 310 | 275 | $this->loader->add_action( 'edited_wpstream_actors', $plugin_post_types, 'wpstream_category_save_extra_fields_callback', 10, 2); |
| 311 | 276 | |
| 312 | 277 | $this->loader->add_action( 'wpstream_movie_rating_edit_form_fields', $plugin_post_types, 'wpstream_category_callback_function', 10, 2); |
| 313 | - $this->loader->add_action( 'wpstream_movie_rating_add_form_fields', $plugin_post_types, 'wpstream_category_callback_add_function' ); | |
| 278 | + $this->loader->add_action( 'wpstream_movie_rating_add_form_fields', $plugin_post_types, 'wpstream_category_callback_add_function', 10, 2 ); | |
| 314 | 279 | $this->loader->add_action( 'created_wpstream_movie_rating', $plugin_post_types, 'wpstream_category_save_extra_fields_callback', 10, 2); |
| 315 | 280 | $this->loader->add_action( 'edited_wpstream_movie_rating', $plugin_post_types, 'wpstream_category_save_extra_fields_callback', 10, 2); |
| 281 | + | |
| 282 | + | |
| 316 | 283 | |
| 317 | 284 | |
| 318 | 285 | if ( in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) ) { |
| 319 | - | |
| 320 | - $this->loader->add_action( 'init', $plugin_admin, 'wpstream_add_custom_wc_products' ); | |
| 286 | + | |
| 321 | 287 | $this->loader->add_filter( 'product_type_selector', $plugin_admin, 'wpstream_add_products' ); |
| 322 | - $this->loader->add_filter( 'woocommerce_product_class', $plugin_admin, 'wpstream_add_products_class', 10, 2 ); | |
| 323 | 288 | $this->loader->add_action( 'admin_footer', $plugin_admin, 'wpstream_products_custom_js' ); |
| 324 | 289 | $this->loader->add_filter( 'woocommerce_product_data_tabs', $plugin_admin, 'wpstream_hide_attributes_data_panel',10,1 ); |
| 325 | 290 | $this->loader->add_filter( 'woocommerce_is_purchasable', $plugin_admin, 'wpstream_hide_buy_now_subscription_mode',10,2); |
| 326 | 291 | |
| @@ -329,8 +294,14 @@ | ||
| 329 | 294 | $this->loader->add_action( 'woocommerce_live_stream_add_to_cart', $plugin_admin, 'wpstream_add_to_cart',10,1); |
| 330 | 295 | $this->loader->add_action( 'woocommerce_video_on_demand_add_to_cart', $plugin_admin, 'wpstream_add_to_cart',10,1); |
| 331 | 296 | $this->loader->add_filter( 'woocommerce_loop_add_to_cart_link', $plugin_admin,'replacing_add_to_cart_button', 10, 2 ); |
| 332 | 297 | } |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 333 | 304 | } |
| 334 | 305 | |
| 335 | 306 | |
| 336 | 307 | |
| @@ -348,49 +319,38 @@ | ||
| 348 | 319 | $plugin_public = new Wpstream_Public( $this->get_plugin_name(), $this->get_version(), $this->main ); |
| 349 | 320 | |
| 350 | 321 | $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_styles' ); |
| 351 | 322 | $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_scripts' ); |
| 323 | + | |
| 324 | + $this->loader->add_action( 'init', $plugin_public,'wpstream_my_custom_endpoints' ); | |
| 325 | + $this->loader->add_filter( 'query_vars',$plugin_public, 'wpstream_my_custom_query_vars', 0 ); | |
| 326 | + | |
| 327 | + //live stream action | |
| 328 | + $this->loader->add_action('init',$plugin_public,'wpstream_set_cookies',0); | |
| 329 | + $this->loader->add_action('init',$plugin_public,'wpstream_live_streaming_key'); | |
| 330 | + $this->loader->add_action('init',$plugin_public,'wpstream_live_streaming_key_for_3rdparty'); | |
| 331 | + $this->loader->add_action('init',$plugin_public,'wpstream_live_streaming_key_vod',10); | |
| 332 | + // woo action | |
| 333 | + | |
| 334 | + $this->loader->add_action( 'woocommerce_before_single_product', $plugin_public,'wpstream_non_image_content_wrapper_start', 20 ); | |
| 335 | + $this->loader->add_action( 'woocommerce_after_single_product', $plugin_public,'wpstream_non_image_content_wrapper_end', 20 ); | |
| 336 | + $this->loader->add_action( 'woocommerce_thankyou_order_received_text', $plugin_public,'wpstream_thankyou_extra', 20,2 ); | |
| 337 | + $this->loader->add_action( 'woocommerce_email_order_details', $plugin_public,'wpstream_email_order_details', 20,4 ); | |
| 338 | + | |
| 339 | + $this->loader->add_filter( 'woocommerce_account_menu_items', $plugin_public,'wpstream_custom_my_account_menu_items' ); | |
| 340 | + $this->loader->add_action( 'woocommerce_account_event-list_endpoint', $plugin_public,'wpstream_custom_endpoint_content_event_list' ); | |
| 341 | + $this->loader->add_action( 'woocommerce_account_video-list_endpoint', $plugin_public,'wpstream_custom_endpoint_video_list' ); | |
| 342 | + | |
| 352 | 343 | |
| 353 | - $this->loader->add_action( 'init', $plugin_public,'wpstream_my_custom_endpoints' ); | |
| 354 | - $this->loader->add_filter( 'query_vars',$plugin_public, 'wpstream_my_custom_query_vars', 0 ); | |
| 355 | - | |
| 356 | - //live stream action | |
| 357 | - $this->loader->add_action('init',$plugin_public,'wpstream_set_cookies',0); | |
| 358 | - $this->loader->add_action('init',$plugin_public,'wpstream_live_streaming_key'); | |
| 359 | - $this->loader->add_action('init',$plugin_public,'wpstream_live_streaming_key_for_3rdparty'); | |
| 360 | - $this->loader->add_action('init',$plugin_public,'wpstream_live_streaming_key_vod',10); | |
| 361 | - | |
| 362 | - // woo action | |
| 363 | - $this->loader->add_action( 'woocommerce_before_single_product', $plugin_public,'wpstream_non_image_content_wrapper_start', 20 ); | |
| 364 | - $this->loader->add_action( 'woocommerce_after_single_product', $plugin_public,'wpstream_non_image_content_wrapper_end', 20 ); | |
| 365 | - $this->loader->add_action( 'woocommerce_thankyou_order_received_text', $plugin_public,'wpstream_thankyou_extra', 20,2 ); | |
| 366 | - $this->loader->add_action( 'woocommerce_email_order_details', $plugin_public,'wpstream_email_order_details', 20,4 ); | |
| 367 | - | |
| 368 | - $this->loader->add_filter( 'woocommerce_account_menu_items', $plugin_public,'wpstream_custom_my_account_menu_items' ); | |
| 369 | - $this->loader->add_action( 'woocommerce_account_event-list_endpoint', $plugin_public,'wpstream_custom_endpoint_content_event_list' ); | |
| 370 | - $this->loader->add_action( 'woocommerce_account_video-list_endpoint', $plugin_public,'wpstream_custom_endpoint_video_list' ); | |
| 371 | - | |
| 372 | - $this->loader->add_action( 'after_switch_theme', $plugin_public,'wpstream_custom_flush_rewrite_rules' ); | |
| 373 | - $this->loader->add_action('init', $plugin_public,'wpstream_shortcodes'); | |
| 374 | - $this->loader->add_action('vc_before_init', $plugin_public,'wpstream_bakery_shortcodes'); | |
| 375 | - | |
| 376 | - $this->loader->add_action('wo_before_api', 'wpstream_cors_check_and_response',10,1); | |
| 377 | - | |
| 378 | - $this->loader->add_filter( 'wpstream_search_template_item_post_type', $plugin_public, 'wpstream_search_template_add_item_post_type' ); | |
| 379 | - $this->loader->add_filter( 'wpstream_sidebar_id_by_post_type', $plugin_public, 'wpstream_sidebar_id_by_post_type' ); | |
| 380 | - $this->loader->add_filter( 'wpstream_header_search_values', $plugin_public, 'wpstream_header_search_values' ); | |
| 381 | - $this->loader->add_filter( 'wpstream_extend_category_archive_query_filter', $plugin_public, 'wpstream_extend_category_archive_query_filter_callback' ); | |
| 382 | - $this->loader->add_filter( 'wpstream_archives_lists_taxonomy_labels', $plugin_public, 'wpstream_archives_lists_taxonomy_labels_callback' ); | |
| 383 | - $this->loader->add_filter( 'wpstream_author_archive_list_taxonomy_labels', $plugin_public, 'wpstream_author_archive_list_taxonomy_labels_callback' ); | |
| 384 | - $this->loader->add_action( 'wpstream_vod_attached_to_channel', $plugin_public, 'wpstream_vod_attached_to_channel' ); | |
| 385 | - $this->loader->add_action( 'wpstream_additional_content_post_type', $plugin_public, 'wpstream_additional_content_post_type_callback' ); | |
| 386 | - $this->loader->add_action( 'wpstream_post_author_content_post_type_list', $plugin_public, 'wpstream_post_author_content_post_type_list_callback' ); | |
| 387 | - $this->loader->add_action( 'wpstream_author_content_simple_post_type_message', $plugin_public, 'wpstream_author_content_simple_post_type_message_callback', 10, 2 ); | |
| 388 | - $this->loader->add_action( 'wpstream_author_content_post_type_message', $plugin_public, 'wpstream_author_content_post_type_message_callback', 10, 2 ); | |
| 389 | - $this->loader->add_action( 'wpstream_show_sidebar_for_post_type', $plugin_public, 'wpstream_show_sidebar_for_post_type_callback', 10, 2 ); | |
| 390 | - $this->loader->add_action( 'wpstream_video_episodes_post_type', $plugin_public, 'wpstream_video_episodes_post_type_callback' ); | |
| 391 | - $this->loader->add_action( 'wpstream_video_past_broadcast_post_type', $plugin_public, 'wpstream_video_past_broadcast_post_type_callback' ); | |
| 392 | - $this->loader->add_action( 'wpstream_additional_content_post_type_label', $plugin_public, 'wpstream_additional_content_post_type_label_callback', 10, 2 ); | |
| 344 | + $this->loader->add_action( 'after_switch_theme', $plugin_public,'wpstream_custom_flush_rewrite_rules' ); | |
| 345 | + $this->loader->add_action('init', $plugin_public,'wpstream_shortcodes'); | |
| 346 | + $this->loader->add_action('vc_before_init', $plugin_public,'wpstream_bakery_shortcodes'); | |
| 347 | + | |
| 348 | + | |
| 349 | + $this->loader->add_action('wo_before_api', 'wpstream_cors_check_and_response',10,1); | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 393 | 353 | } |
| 394 | 354 | |
| 395 | 355 | /** |
| 396 | 356 | * Run the loader to execute all of the hooks with WordPress. |
| @@ -430,42 +390,21 @@ | ||
| 430 | 390 | */ |
| 431 | 391 | public function get_version() { |
| 432 | 392 | return $this->version; |
| 433 | 393 | } |
| 434 | - | |
| 435 | - public function is_plugin_outdated(){ | |
| 436 | - $update_data = get_site_transient('update_plugins'); | |
| 437 | - $plugin_path = 'wpstream/wpstream.php'; | |
| 438 | - | |
| 439 | - if (isset($update_data->response[$plugin_path])) { | |
| 440 | - return true; | |
| 441 | - } | |
| 442 | - | |
| 443 | - return false; | |
| 444 | - } | |
| 445 | - | |
| 446 | - | |
| 394 | + | |
| 395 | + | |
| 447 | 396 | |
| 448 | 397 | public function show_user_data($pack_details){ |
| 449 | 398 | if( isset($pack_details['available_data_mb']) && isset( $pack_details['available_storage_mb']) ){ |
| 450 | - $wpstream_convert_band = $this->wpstream_convert_band($pack_details['available_data_mb']); | |
| 451 | - if( $wpstream_convert_band < 0 ) { | |
| 452 | - $wpstream_convert_band = 0; | |
| 453 | - } | |
| 454 | - | |
| 455 | - $wpstream_convert_storage = $this->wpstream_convert_band($pack_details['available_storage_mb']); | |
| 456 | - if( $wpstream_convert_storage < 0 ) { | |
| 457 | - $wpstream_convert_storage = 0; | |
| 458 | - } | |
| 399 | + $wpstream_convert_band = $this->wpstream_convert_band($pack_details['available_data_mb']); | |
| 400 | + if($wpstream_convert_band<0)$wpstream_convert_band=0; | |
| 401 | + | |
| 402 | + $wpstream_convert_storage = $this->wpstream_convert_band($pack_details['available_storage_mb']); | |
| 403 | + if($wpstream_convert_storage<0)$wpstream_convert_storage=0; | |
| 459 | 404 | |
| 460 | - print '<div class="pack_details_wrapper">' | |
| 461 | - . '<strong>' . __('Your account information: ', 'wpstream') . '</strong> ' | |
| 462 | - . __('You have ', 'wpstream') . '<strong id="wpstream_available_data">' . abs( $wpstream_convert_band ) . ' GB</strong> ' | |
| 463 | - . __('available cloud data and ', 'wpstream') | |
| 464 | - . '<strong id="wpstream_available_storage">' . abs( $wpstream_convert_storage ) . ' GB</strong> ' | |
| 465 | - . __('available cloud storage', 'wpstream') . '.'; | |
| 466 | - | |
| 467 | - print '<a href="https://wpstream.net/pricing/" class="wpstream_upgrade_topbar" target="_blank">'.esc_html__('Upgrade Plan','wpstream').'</a>'; | |
| 405 | + print '<div class="pack_details_wrapper"><strong>'.__('Your account information: ','wpstream').'</strong> '.__('You have','wpstream').'<strong> '.$wpstream_convert_band.' Gb</strong> '.__('available streaming data and','wpstream').' <strong>'.$wpstream_convert_storage.' Gb</strong> '.__('available recording storage','wpstream'); | |
| 406 | + print '<a href="https://wpstream.net/pricing/" class="wpstream_upgrade_topbar" target="_blank">'.esc_html__('Upgrade Subscription','wpstream').'</a>'; | |
| 468 | 407 | print '</div>'; |
| 469 | 408 | print'<input type="hidden" id="wpstream_band" value="'.$pack_details['available_data_mb'].'">'; |
| 470 | 409 | print'<input type="hidden" id="wpstream_storage" value="'.$pack_details['available_storage_mb'].'">'; |
| 471 | 410 | |
| @@ -757,15 +696,9 @@ | ||
| 757 | 696 | |
| 758 | 697 | |
| 759 | 698 | |
| 760 | 699 | ob_start(); |
| 761 | - ?> | |
| 762 | - <div class="wpstream_insert_player_elementor_wrapper"> | |
| 763 | - <?php | |
| 764 | - $this->main->wpstream_player->wpstream_video_player_shortcode($product_id); | |
| 765 | - ?> | |
| 766 | - </div> | |
| 767 | - <?php | |
| 700 | + $this->main->wpstream_player->wpstream_video_player_shortcode($product_id); | |
| 768 | 701 | $return_string= ob_get_contents(); |
| 769 | 702 | ob_end_clean(); |
| 770 | 703 | |
| 771 | 704 | return $return_string; |
| @@ -860,9 +793,9 @@ | ||
| 860 | 793 | */ |
| 861 | 794 | |
| 862 | 795 | public function wpstream_check_user_can_stream(){ |
| 863 | 796 | $current_user = wp_get_current_user(); |
| 864 | - | |
| 797 | + | |
| 865 | 798 | if( !is_user_logged_in() ){ |
| 866 | 799 | return false; |
| 867 | 800 | exit('user not logged in'); |
| 868 | 801 | } |
| @@ -872,17 +805,14 @@ | ||
| 872 | 805 | return true; |
| 873 | 806 | } |
| 874 | 807 | |
| 875 | 808 | $extra_roles = get_option( 'wpstream_stream_role', true ); |
| 876 | - $user_role = ''; | |
| 877 | - if( is_array( $current_user->roles) && count( $current_user->roles ) > 0 ){ | |
| 878 | - $user_role = $current_user->roles[0]; | |
| 879 | - } | |
| 880 | - | |
| 881 | - if ( is_array($extra_roles) && in_array( $user_role, $extra_roles ) ) { | |
| 809 | + $user_role = $current_user->roles[0]; | |
| 810 | + | |
| 811 | + if (is_array($extra_roles) && in_array($user_role, $extra_roles)){ | |
| 882 | 812 | return true; |
| 883 | 813 | } |
| 884 | - | |
| 814 | + | |
| 885 | 815 | if(function_exists('wpstream_get_option') && intval(wpstream_get_option('allow_streaming_regular_users',''))==1 ){ |
| 886 | 816 | return true; |
| 887 | 817 | } |
| 888 | 818 | |
| @@ -910,27 +840,9 @@ | ||
| 910 | 840 | $this->admin->wpstream_live_stream_unit( $item_id,$type ); |
| 911 | 841 | } |
| 912 | 842 | |
| 913 | 843 | |
| 914 | - /** | |
| 915 | - * Start Streaming wrapper for wpstream theme | |
| 916 | - * | |
| 917 | - * @since 3.7 | |
| 918 | - */ | |
| 919 | 844 | |
| 920 | - public function wpstream_live_stream_unit_wrapper_for_theme($item_id,$type){ | |
| 921 | - $item_id = intval($item_id); | |
| 922 | - | |
| 923 | - if($item_id == 0){ | |
| 924 | - //retrive or create channel for front end streamers | |
| 925 | - $item_id=$this->wpstream_retrive_front_end_channel(); | |
| 926 | - } | |
| 927 | - print'<div class="wpstream_modal_background"></div>'; | |
| 928 | - print '<div class="wpstream_error_modal_notification"><div class="wpstream_error_content">er2</div> | |
| 929 | - <div class="wpstream_error_ok wpstream_button" type="button">'.esc_html__('Close','wpstream').'</div> | |
| 930 | - </div>'; | |
| 931 | - $this->admin->wpstream_live_stream_unit_for_theme( $item_id,$type ); | |
| 932 | - } | |
| 933 | 845 | |
| 934 | 846 | |
| 935 | 847 | /** |
| 936 | 848 | * retrive channel for front end streaming |
| @@ -1021,13 +933,6 @@ | ||
| 1021 | 933 | wp_reset_query(); |
| 1022 | 934 | wp_reset_postdata(); |
| 1023 | 935 | return $the_id; |
| 1024 | 936 | } |
| 1025 | - | |
| 1026 | - /** | |
| 1027 | - * Cleanup old logs | |
| 1028 | - */ | |
| 1029 | - public function cleanup_logs() { | |
| 1030 | - $logger = new WPStream_Logger(); | |
| 1031 | - $logger->clear_old_logs(); | |
| 1032 | - } | |
| 937 | + | |
| 1033 | 938 | } |