| @@ -1,6 +1,5 @@ | ||
| 1 | 1 | <?php |
| 2 | - | |
| 3 | 2 | /** |
| 4 | 3 | * The file that defines the core plugin class |
| 5 | 4 | * |
| 6 | 5 | * A class definition that includes attributes and functions used across both the |
| @@ -35,8 +34,9 @@ | ||
| 35 | 34 | * @since 3.0.1 |
| 36 | 35 | * @var object The main class. |
| 37 | 36 | */ |
| 38 | 37 | 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. |
| @@ -80,25 +80,28 @@ | ||
| 80 | 80 | public $xtest; |
| 81 | 81 | public $plugin_admin; |
| 82 | 82 | |
| 83 | 83 | public function __construct() { |
| 84 | - $this->main = $this; | |
| 84 | + $this->main = $this; | |
| 85 | + | |
| 85 | 86 | if ( defined( 'WPSTREAM_PLUGIN_VERSION' ) ) { |
| 86 | - $this->version = WPSTREAM_PLUGIN_VERSION; | |
| 87 | + $this->version = WPSTREAM_PLUGIN_VERSION; | |
| 87 | 88 | } else { |
| 88 | - $this->version = '3.0.1'; | |
| 89 | + $this->version = '3.0.1'; | |
| 89 | 90 | } |
| 91 | + | |
| 90 | 92 | $this->plugin_name = 'wpstream'; |
| 91 | 93 | |
| 92 | 94 | $this->load_dependencies(); |
| 93 | - $this->set_locale(); | |
| 94 | 95 | $this->define_admin_hooks(); |
| 95 | 96 | $this->define_public_hooks(); |
| 96 | - | |
| 97 | - | |
| 98 | - $this->wpstream_conection(); | |
| 99 | - $this->wpstream_player(); | |
| 97 | + $this->define_ajax_hooks(); | |
| 98 | + $this->wpstream_load_page_templates(); | |
| 99 | + $this->wpstream_load_theme_notice(); | |
| 100 | 100 | |
| 101 | + $this->wpstream_conection(); | |
| 102 | + $this->wpstream_player(); | |
| 103 | + | |
| 101 | 104 | } |
| 102 | 105 | |
| 103 | 106 | |
| 104 | 107 | |
| @@ -105,16 +108,21 @@ | ||
| 105 | 108 | |
| 106 | 109 | |
| 107 | 110 | public function wpstream_convert_band($megabits){ |
| 108 | 111 | $gigabit = $megabits * 0.001; |
| 109 | - $gigabit = number_format($gigabit,2); | |
| 112 | + $gigabit = floatval(sprintf('%.1f', $gigabit)); | |
| 110 | 113 | return $gigabit; |
| 111 | 114 | } |
| 112 | 115 | |
| 116 | + | |
| 117 | + public $wpstream_ajax; | |
| 118 | + | |
| 119 | + private function define_ajax_hooks() { | |
| 120 | + require_once plugin_dir_path(dirname(__FILE__)) . 'includes/class-wpstream-ajax.php'; | |
| 121 | + $this->wpstream_ajax = new WpStream_Ajax( $this->main ); | |
| 122 | + } | |
| 113 | 123 | |
| 114 | 124 | |
| 115 | - | |
| 116 | - | |
| 117 | 125 | private function wpstream_conection(){ |
| 118 | 126 | require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wpstream-live-api-connection.php'; |
| 119 | 127 | $this->wpstream_live_connection = new Wpstream_Live_Api_Connection(); |
| 120 | 128 | } |
| @@ -123,12 +131,21 @@ | ||
| 123 | 131 | private function wpstream_player(){ |
| 124 | 132 | require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wpstream-player.php'; |
| 125 | 133 | $this->wpstream_player = new Wpstream_Player($this->main); |
| 126 | 134 | } |
| 135 | + | |
| 136 | + | |
| 137 | + private function wpstream_load_page_templates() { | |
| 138 | + require_once WPSTREAM_PLUGIN_PATH . 'includes/class-wpstream-templates.php'; | |
| 139 | + new WpStream_Template_Loader(); | |
| 140 | + } | |
| 141 | + | |
| 142 | + private function wpstream_load_theme_notice() { | |
| 143 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wpstream-theme-notice.php'; | |
| 144 | + new WPStream_Theme_Notice(); | |
| 145 | + } | |
| 127 | 146 | |
| 128 | 147 | |
| 129 | - | |
| 130 | - | |
| 131 | 148 | /** |
| 132 | 149 | * Load the required dependencies for this plugin. |
| 133 | 150 | * |
| 134 | 151 | * Include the following files that make up the plugin: |
| @@ -167,19 +184,21 @@ | ||
| 167 | 184 | * The class responsible for defining all actions that occur in the public-facing |
| 168 | 185 | * side of the site. |
| 169 | 186 | */ |
| 170 | 187 | require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wpstream-public.php'; |
| 171 | - | |
| 172 | - /** | |
| 188 | + /** | |
| 173 | 189 | * The class responsible for custom post type |
| 174 | 190 | |
| 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 | - } | |
| 191 | + */ | |
| 192 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wpstream_product.php'; | |
| 193 | + if( class_exists( 'WooCommerce' ) ){ | |
| 194 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wc_product_live_stream.php'; | |
| 195 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wc_product_video_on_demand.php'; | |
| 196 | + } | |
| 181 | 197 | |
| 198 | + require_once plugin_dir_path(__FILE__) . 'Helpers/class-wpstream-log-entry.php'; | |
| 199 | + require_once plugin_dir_path(__FILE__) . 'Logger/class-wpstream-logger.php'; | |
| 200 | + | |
| 182 | 201 | $this->loader = new Wpstream_Loader(); |
| 183 | 202 | |
| 184 | 203 | } |
| 185 | 204 | |
| @@ -195,9 +214,9 @@ | ||
| 195 | 214 | private function set_locale() { |
| 196 | 215 | |
| 197 | 216 | $plugin_i18n = new Wpstream_i18n(); |
| 198 | 217 | |
| 199 | - $this->loader->add_action( 'plugins_loaded', $plugin_i18n, 'load_plugin_textdomain' ); | |
| 218 | + $this->loader->add_action( 'plugins_loaded', $plugin_i18n, 'load_plugin_textdomain', 1 ); | |
| 200 | 219 | |
| 201 | 220 | } |
| 202 | 221 | |
| 203 | 222 | /** |
| @@ -208,24 +227,26 @@ | ||
| 208 | 227 | * @access private |
| 209 | 228 | */ |
| 210 | 229 | private function define_admin_hooks() { |
| 211 | 230 | |
| 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' ); | |
| 231 | + $plugin_admin = new Wpstream_Admin( $this->get_plugin_name(), $this->get_version(), $this->main ); | |
| 232 | + | |
| 233 | + $this->admin = $plugin_admin; | |
| 234 | + | |
| 235 | + $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_styles' ); | |
| 215 | 236 | $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_scripts' ); |
| 216 | 237 | $this->loader->add_action( 'admin_menu', $plugin_admin, 'wpstream_manage_admin_menu',999); |
| 217 | - | |
| 238 | + | |
| 218 | 239 | $plugin_post_types = new Wpstream_Product(); |
| 219 | 240 | $this->loader->add_action( 'init', $plugin_post_types, 'create_custom_post_type', 999 ); |
| 220 | - | |
| 241 | + | |
| 221 | 242 | // save and render metaboxed |
| 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 | - | |
| 243 | + $this->loader->add_action( 'add_meta_boxes', $plugin_admin, 'add_wpstream_product_metaboxes' ); | |
| 244 | + $this->loader->add_action( 'save_post', $plugin_admin, 'wpstream_free_product_update_post',1,2 ); | |
| 245 | + $this->loader->add_action( 'publish_wpstream_product', $plugin_admin, 'wpstream_publish_wpstream_product',1,2 ); | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 228 | 249 | // make product virtual |
| 229 | 250 | $this->loader->add_action( 'save_post', $plugin_admin, 'wpstream_make_product_virtual', 99999, 2 ); |
| 230 | 251 | |
| 231 | 252 | |
| @@ -235,57 +256,61 @@ | ||
| 235 | 256 | |
| 236 | 257 | // on boarding actions |
| 237 | 258 | $this->loader->add_action('admin_footer',$plugin_admin, 'wpstream_admin_footer_onboarding'); |
| 238 | 259 | $this->loader->add_action( 'wp_ajax_wpstream_on_board_create_channel', $plugin_admin,'wpstream_on_board_create_channel' ); |
| 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 | - | |
| 260 | + $this->loader->add_action( 'wp_ajax_wpstream_on_board_create_channel_ppv', $plugin_admin,'wpstream_on_board_create_channel_ppv' ); | |
| 261 | + $this->loader->add_action( 'wp_ajax_wpstream_on_board_create_free_vod', $plugin_admin,'wpstream_on_board_create_free_vod' ); | |
| 262 | + $this->loader->add_action( 'wp_ajax_wpstream_on_board_create_ppv_vod', $plugin_admin,'wpstream_on_board_create_ppv_vod' ); | |
| 243 | 263 | |
| 264 | + | |
| 244 | 265 | $this->loader->add_action( 'wp_ajax_wpstream_on_board_login', $plugin_admin,'wpstream_on_board_login' ); |
| 245 | 266 | $this->loader->add_action( 'wp_ajax_wpstream_on_board_register', $plugin_admin,'wpstream_on_board_register' ); |
| 246 | 267 | |
| 268 | + // Register AJAX actions for multipart uploads | |
| 269 | + $this->loader->add_action( 'wp_ajax_wpstream_initiate_multipart_upload', $plugin_admin, 'handle_initiate_multipart_upload' ); | |
| 270 | + $this->loader->add_action( 'wp_ajax_wpstream_complete_multipart_upload', $plugin_admin, 'handle_complete_multipart_upload' ); | |
| 247 | 271 | |
| 248 | 272 | $this->loader->add_action( 'admin_notices', $plugin_admin,'wpstream_admin_notice' ); |
| 249 | 273 | $this->loader->add_action( 'wp_ajax_wpstream_update_cache_notice', $plugin_admin,'wpstream_update_cache_notice' ); |
| 250 | - | |
| 274 | +// $this->loader->add_action( 'wp_ajax_wpstream_get_videos_list', $plugin_admin,'wpstream_get_videos_list' ); | |
| 251 | 275 | |
| 252 | 276 | |
| 253 | - | |
| 277 | + $this->loader->add_action( 'wp_ajax_wpstream_settings_tab_update_plugin', $plugin_admin, 'wpstream_settings_tab_update_plugin' ); | |
| 278 | + | |
| 254 | 279 | // add and save category extra fields |
| 255 | 280 | $this->loader->add_action( 'category_edit_form_fields', $plugin_post_types, 'wpstream_category_callback_function', 10, 2); |
| 256 | - $this->loader->add_action( 'category_add_form_fields', $plugin_post_types, 'wpstream_category_callback_add_function', 10, 2 ); | |
| 281 | + $this->loader->add_action( 'category_add_form_fields', $plugin_post_types, 'wpstream_category_callback_add_function' ); | |
| 257 | 282 | $this->loader->add_action( 'created_category', $plugin_post_types, 'wpstream_category_save_extra_fields_callback', 10, 2); |
| 258 | 283 | $this->loader->add_action( 'edited_category', $plugin_post_types, 'wpstream_category_save_extra_fields_callback', 10, 2); |
| 259 | 284 | |
| 260 | 285 | $this->loader->add_action( 'product_cat_edit_form_fields', $plugin_post_types, 'wpstream_category_callback_function', 10, 2); |
| 261 | - $this->loader->add_action( 'product_cat_add_form_fields', $plugin_post_types, 'wpstream_category_callback_add_function', 10, 2 ); | |
| 286 | + $this->loader->add_action( 'product_cat_add_form_fields', $plugin_post_types, 'wpstream_category_callback_add_function' ); | |
| 262 | 287 | $this->loader->add_action( 'created_product_cat', $plugin_post_types, 'wpstream_category_save_extra_fields_callback', 10, 2); |
| 263 | 288 | $this->loader->add_action( 'edited_product_cat', $plugin_post_types, 'wpstream_category_save_extra_fields_callback', 10, 2); |
| 264 | 289 | |
| 265 | 290 | |
| 266 | 291 | $this->loader->add_action( 'wpstream_category_edit_form_fields', $plugin_post_types, 'wpstream_category_callback_function', 10, 2); |
| 267 | - $this->loader->add_action( 'wpstream_category_add_form_fields', $plugin_post_types, 'wpstream_category_callback_add_function', 10, 2 ); | |
| 292 | + $this->loader->add_action( 'wpstream_category_add_form_fields', $plugin_post_types, 'wpstream_category_callback_add_function' ); | |
| 268 | 293 | $this->loader->add_action( 'created_wpstream_category', $plugin_post_types, 'wpstream_category_save_extra_fields_callback', 10, 2); |
| 269 | 294 | $this->loader->add_action( 'edited_wpstream_category', $plugin_post_types, 'wpstream_category_save_extra_fields_callback', 10, 2); |
| 270 | 295 | |
| 271 | 296 | |
| 272 | 297 | $this->loader->add_action( 'wpstream_actors_edit_form_fields', $plugin_post_types, 'wpstream_category_callback_function', 10, 2); |
| 273 | - $this->loader->add_action( 'wpstream_actors_add_form_fields', $plugin_post_types, 'wpstream_category_callback_add_function', 10, 2 ); | |
| 298 | + $this->loader->add_action( 'wpstream_actors_add_form_fields', $plugin_post_types, 'wpstream_category_callback_add_function' ); | |
| 274 | 299 | $this->loader->add_action( 'created_wpstream_actors', $plugin_post_types, 'wpstream_category_save_extra_fields_callback', 10, 2); |
| 275 | 300 | $this->loader->add_action( 'edited_wpstream_actors', $plugin_post_types, 'wpstream_category_save_extra_fields_callback', 10, 2); |
| 276 | 301 | |
| 277 | 302 | $this->loader->add_action( 'wpstream_movie_rating_edit_form_fields', $plugin_post_types, 'wpstream_category_callback_function', 10, 2); |
| 278 | - $this->loader->add_action( 'wpstream_movie_rating_add_form_fields', $plugin_post_types, 'wpstream_category_callback_add_function', 10, 2 ); | |
| 303 | + $this->loader->add_action( 'wpstream_movie_rating_add_form_fields', $plugin_post_types, 'wpstream_category_callback_add_function' ); | |
| 279 | 304 | $this->loader->add_action( 'created_wpstream_movie_rating', $plugin_post_types, 'wpstream_category_save_extra_fields_callback', 10, 2); |
| 280 | 305 | $this->loader->add_action( 'edited_wpstream_movie_rating', $plugin_post_types, 'wpstream_category_save_extra_fields_callback', 10, 2); |
| 281 | - | |
| 282 | - | |
| 283 | 306 | |
| 284 | 307 | |
| 285 | 308 | if ( in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) ) { |
| 286 | - | |
| 309 | + | |
| 310 | + $this->loader->add_action( 'init', $plugin_admin, 'wpstream_add_custom_wc_products' ); | |
| 287 | 311 | $this->loader->add_filter( 'product_type_selector', $plugin_admin, 'wpstream_add_products' ); |
| 312 | + $this->loader->add_filter( 'woocommerce_product_class', $plugin_admin, 'wpstream_add_products_class', 10, 2 ); | |
| 288 | 313 | $this->loader->add_action( 'admin_footer', $plugin_admin, 'wpstream_products_custom_js' ); |
| 289 | 314 | $this->loader->add_filter( 'woocommerce_product_data_tabs', $plugin_admin, 'wpstream_hide_attributes_data_panel',10,1 ); |
| 290 | 315 | $this->loader->add_filter( 'woocommerce_is_purchasable', $plugin_admin, 'wpstream_hide_buy_now_subscription_mode',10,2); |
| 291 | 316 | |
| @@ -294,14 +319,8 @@ | ||
| 294 | 319 | $this->loader->add_action( 'woocommerce_live_stream_add_to_cart', $plugin_admin, 'wpstream_add_to_cart',10,1); |
| 295 | 320 | $this->loader->add_action( 'woocommerce_video_on_demand_add_to_cart', $plugin_admin, 'wpstream_add_to_cart',10,1); |
| 296 | 321 | $this->loader->add_filter( 'woocommerce_loop_add_to_cart_link', $plugin_admin,'replacing_add_to_cart_button', 10, 2 ); |
| 297 | 322 | } |
| 298 | - | |
| 299 | - | |
| 300 | - | |
| 301 | - | |
| 302 | - | |
| 303 | - | |
| 304 | 323 | } |
| 305 | 324 | |
| 306 | 325 | |
| 307 | 326 | |
| @@ -319,38 +338,49 @@ | ||
| 319 | 338 | $plugin_public = new Wpstream_Public( $this->get_plugin_name(), $this->get_version(), $this->main ); |
| 320 | 339 | |
| 321 | 340 | $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_styles' ); |
| 322 | 341 | $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 | - | |
| 343 | 342 | |
| 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 | - | |
| 343 | + $this->loader->add_action( 'init', $plugin_public,'wpstream_my_custom_endpoints' ); | |
| 344 | + $this->loader->add_filter( 'query_vars',$plugin_public, 'wpstream_my_custom_query_vars', 0 ); | |
| 345 | + | |
| 346 | + //live stream action | |
| 347 | + $this->loader->add_action('init',$plugin_public,'wpstream_set_cookies',0); | |
| 348 | + $this->loader->add_action('init',$plugin_public,'wpstream_live_streaming_key'); | |
| 349 | + $this->loader->add_action('init',$plugin_public,'wpstream_live_streaming_key_for_3rdparty'); | |
| 350 | + $this->loader->add_action('init',$plugin_public,'wpstream_live_streaming_key_vod',10); | |
| 351 | + | |
| 352 | + // woo action | |
| 353 | + $this->loader->add_action( 'woocommerce_before_single_product', $plugin_public,'wpstream_non_image_content_wrapper_start', 20 ); | |
| 354 | + $this->loader->add_action( 'woocommerce_after_single_product', $plugin_public,'wpstream_non_image_content_wrapper_end', 20 ); | |
| 355 | + $this->loader->add_action( 'woocommerce_thankyou_order_received_text', $plugin_public,'wpstream_thankyou_extra', 20,2 ); | |
| 356 | + $this->loader->add_action( 'woocommerce_email_order_details', $plugin_public,'wpstream_email_order_details', 20,4 ); | |
| 357 | + | |
| 358 | + $this->loader->add_filter( 'woocommerce_account_menu_items', $plugin_public,'wpstream_custom_my_account_menu_items' ); | |
| 359 | + $this->loader->add_action( 'woocommerce_account_event-list_endpoint', $plugin_public,'wpstream_custom_endpoint_content_event_list' ); | |
| 360 | + $this->loader->add_action( 'woocommerce_account_video-list_endpoint', $plugin_public,'wpstream_custom_endpoint_video_list' ); | |
| 361 | + | |
| 362 | + $this->loader->add_action( 'after_switch_theme', $plugin_public,'wpstream_custom_flush_rewrite_rules' ); | |
| 363 | + $this->loader->add_action('init', $plugin_public,'wpstream_shortcodes'); | |
| 364 | + $this->loader->add_action('vc_before_init', $plugin_public,'wpstream_bakery_shortcodes'); | |
| 365 | + | |
| 366 | + $this->loader->add_action('wo_before_api', 'wpstream_cors_check_and_response',10,1); | |
| 367 | + | |
| 368 | + $this->loader->add_filter( 'wpstream_search_template_item_post_type', $plugin_public, 'wpstream_search_template_add_item_post_type' ); | |
| 369 | + $this->loader->add_filter( 'wpstream_sidebar_id_by_post_type', $plugin_public, 'wpstream_sidebar_id_by_post_type' ); | |
| 370 | + $this->loader->add_filter( 'wpstream_header_search_values', $plugin_public, 'wpstream_header_search_values' ); | |
| 371 | + $this->loader->add_filter( 'wpstream_extend_category_archive_query_filter', $plugin_public, 'wpstream_extend_category_archive_query_filter_callback' ); | |
| 372 | + $this->loader->add_filter( 'wpstream_archives_lists_taxonomy_labels', $plugin_public, 'wpstream_archives_lists_taxonomy_labels_callback' ); | |
| 373 | + $this->loader->add_filter( 'wpstream_author_archive_list_taxonomy_labels', $plugin_public, 'wpstream_author_archive_list_taxonomy_labels_callback' ); | |
| 374 | + $this->loader->add_action( 'wpstream_vod_attached_to_channel', $plugin_public, 'wpstream_vod_attached_to_channel' ); | |
| 375 | + $this->loader->add_action( 'wpstream_additional_content_post_type', $plugin_public, 'wpstream_additional_content_post_type_callback' ); | |
| 376 | + $this->loader->add_action( 'wpstream_post_author_content_post_type_list', $plugin_public, 'wpstream_post_author_content_post_type_list_callback' ); | |
| 377 | + $this->loader->add_action( 'wpstream_author_content_simple_post_type_message', $plugin_public, 'wpstream_author_content_simple_post_type_message_callback', 10, 2 ); | |
| 378 | + $this->loader->add_action( 'wpstream_author_content_post_type_message', $plugin_public, 'wpstream_author_content_post_type_message_callback', 10, 2 ); | |
| 379 | + $this->loader->add_action( 'wpstream_show_sidebar_for_post_type', $plugin_public, 'wpstream_show_sidebar_for_post_type_callback', 10, 2 ); | |
| 380 | + $this->loader->add_action( 'wpstream_video_episodes_post_type', $plugin_public, 'wpstream_video_episodes_post_type_callback' ); | |
| 381 | + $this->loader->add_action( 'wpstream_video_past_broadcast_post_type', $plugin_public, 'wpstream_video_past_broadcast_post_type_callback' ); | |
| 382 | + $this->loader->add_action( 'wpstream_additional_content_post_type_label', $plugin_public, 'wpstream_additional_content_post_type_label_callback', 10, 2 ); | |
| 353 | 383 | } |
| 354 | 384 | |
| 355 | 385 | /** |
| 356 | 386 | * Run the loader to execute all of the hooks with WordPress. |
| @@ -390,21 +420,42 @@ | ||
| 390 | 420 | */ |
| 391 | 421 | public function get_version() { |
| 392 | 422 | return $this->version; |
| 393 | 423 | } |
| 394 | - | |
| 395 | - | |
| 424 | + | |
| 425 | + public function is_plugin_outdated(){ | |
| 426 | + $update_data = get_site_transient('update_plugins'); | |
| 427 | + $plugin_path = 'wpstream/wpstream.php'; | |
| 428 | + | |
| 429 | + if (isset($update_data->response[$plugin_path])) { | |
| 430 | + return true; | |
| 431 | + } | |
| 432 | + | |
| 433 | + return false; | |
| 434 | + } | |
| 435 | + | |
| 436 | + | |
| 396 | 437 | |
| 397 | 438 | public function show_user_data($pack_details){ |
| 398 | 439 | if( isset($pack_details['available_data_mb']) && isset( $pack_details['available_storage_mb']) ){ |
| 399 | - $wpstream_convert_band = $this->wpstream_convert_band($pack_details['available_data_mb']); | |
| 400 | - if($wpstream_convert_band<0)$wpstream_convert_band=0; | |
| 401 | - // print_r($pack_details); | |
| 402 | - $wpstream_convert_storage = $this->wpstream_convert_band($pack_details['available_storage_mb']); | |
| 403 | - if($wpstream_convert_storage<0)$wpstream_convert_storage=0; | |
| 440 | + $wpstream_convert_band = $this->wpstream_convert_band($pack_details['available_data_mb']); | |
| 441 | + if( $wpstream_convert_band < 0 ) { | |
| 442 | + $wpstream_convert_band = 0; | |
| 443 | + } | |
| 444 | + | |
| 445 | + $wpstream_convert_storage = $this->wpstream_convert_band($pack_details['available_storage_mb']); | |
| 446 | + if( $wpstream_convert_storage < 0 ) { | |
| 447 | + $wpstream_convert_storage = 0; | |
| 448 | + } | |
| 404 | 449 | |
| 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>'; | |
| 450 | + print '<div class="pack_details_wrapper">' | |
| 451 | + . '<strong>' . __('Your account information: ', 'wpstream') . '</strong> ' | |
| 452 | + . __('You have', 'wpstream') . '<strong> ' . abs( $wpstream_convert_band ) . ' GB</strong> ' | |
| 453 | + . __('available cloud data and', 'wpstream') . ' ' | |
| 454 | + . '<strong>' . $wpstream_convert_storage . ' GB</strong> ' | |
| 455 | + . __('available cloud storage', 'wpstream') . '.'; | |
| 456 | + | |
| 457 | + print '<a href="https://wpstream.net/pricing/" class="wpstream_upgrade_topbar" target="_blank">'.esc_html__('Upgrade Plan','wpstream').'</a>'; | |
| 407 | 458 | print '</div>'; |
| 408 | 459 | print'<input type="hidden" id="wpstream_band" value="'.$pack_details['available_data_mb'].'">'; |
| 409 | 460 | print'<input type="hidden" id="wpstream_storage" value="'.$pack_details['available_storage_mb'].'">'; |
| 410 | 461 | |
| @@ -421,16 +472,25 @@ | ||
| 421 | 472 | |
| 422 | 473 | public function wpstream_media_list_elementor_function($attributes, $content = null){ |
| 423 | 474 | |
| 424 | 475 | |
| 425 | - | |
| 426 | - ob_start(); | |
| 427 | - | |
| 428 | 476 | $media_number=3; |
| 429 | 477 | if ( isset($attributes['media_number']) ){ |
| 430 | 478 | $media_number=$attributes['media_number']; |
| 431 | 479 | } |
| 480 | + | |
| 432 | 481 | |
| 482 | + $row_number=3; | |
| 483 | + if ( isset($attributes['row_number']) ){ | |
| 484 | + $row_number=$attributes['row_number']; | |
| 485 | + } | |
| 486 | + if($row_number>4){ | |
| 487 | + $row_number=4; | |
| 488 | + } | |
| 489 | + | |
| 490 | + | |
| 491 | + ob_start(); | |
| 492 | + | |
| 433 | 493 | // check if is vod or live stream |
| 434 | 494 | $meta_query = array(); |
| 435 | 495 | $tax_query_array= array(); |
| 436 | 496 | $tax_query = array(); |
| @@ -445,15 +505,10 @@ | ||
| 445 | 505 | $event_types=array('wpstream_product'); |
| 446 | 506 | |
| 447 | 507 | if ( isset($attributes['product_type']) && intval($attributes['product_type'])==2){ |
| 448 | 508 | $event_types=array('wpstream_product_vod'); |
| 449 | - | |
| 450 | - | |
| 451 | - | |
| 452 | 509 | } |
| 453 | 510 | |
| 454 | - | |
| 455 | - | |
| 456 | 511 | }else{ |
| 457 | 512 | $event_types=array('product'); |
| 458 | 513 | if ( isset($attributes['product_type']) ){ |
| 459 | 514 | $product_type = $attributes['product_type']; |
| @@ -544,9 +599,9 @@ | ||
| 544 | 599 | |
| 545 | 600 | |
| 546 | 601 | $media_list= new WP_Query($args); |
| 547 | 602 | if($media_list->have_posts()){ |
| 548 | - print '<ul class="wpstream_media_list_wrapper products columns-3" >'; | |
| 603 | + print '<ul class="wpstream_media_list_wrapper products columns-'.esc_attr($row_number).'" >'; | |
| 549 | 604 | while($media_list->have_posts()):$media_list->the_post(); |
| 550 | 605 | if($product_type_free_paid==0 ){ |
| 551 | 606 | |
| 552 | 607 | $thumb=wp_get_attachment_image_src(get_post_thumbnail_id(),'medium'); |
| @@ -692,9 +747,15 @@ | ||
| 692 | 747 | |
| 693 | 748 | |
| 694 | 749 | |
| 695 | 750 | ob_start(); |
| 696 | - $this->main->wpstream_player->wpstream_video_player_shortcode($product_id); | |
| 751 | + ?> | |
| 752 | + <div class="wpstream_insert_player_elementor_wrapper"> | |
| 753 | + <?php | |
| 754 | + $this->main->wpstream_player->wpstream_video_player_shortcode($product_id); | |
| 755 | + ?> | |
| 756 | + </div> | |
| 757 | + <?php | |
| 697 | 758 | $return_string= ob_get_contents(); |
| 698 | 759 | ob_end_clean(); |
| 699 | 760 | |
| 700 | 761 | return $return_string; |
| @@ -828,9 +889,9 @@ | ||
| 828 | 889 | if($item_id == 0){ |
| 829 | 890 | //retrive or create channel for front end streamers |
| 830 | 891 | $item_id=$this->wpstream_retrive_front_end_channel(); |
| 831 | 892 | } |
| 832 | - print'</div><div class="wpstream_modal_background"></div>'; | |
| 893 | + print'<div class="wpstream_modal_background"></div>'; | |
| 833 | 894 | print '<div class="wpstream_error_modal_notification"><div class="wpstream_error_content">er2</div> |
| 834 | 895 | <div class="wpstream_error_ok wpstream_button" type="button">'.esc_html__('Close','wpstream').'</div> |
| 835 | 896 | </div>'; |
| 836 | 897 | $this->admin->wpstream_live_stream_unit( $item_id,$type ); |
| @@ -836,9 +897,27 @@ | ||
| 836 | 897 | $this->admin->wpstream_live_stream_unit( $item_id,$type ); |
| 837 | 898 | } |
| 838 | 899 | |
| 839 | 900 | |
| 901 | + /** | |
| 902 | + * Start Streaming wrapper for wpstream theme | |
| 903 | + * | |
| 904 | + * @since 3.7 | |
| 905 | + */ | |
| 840 | 906 | |
| 907 | + public function wpstream_live_stream_unit_wrapper_for_theme($item_id,$type){ | |
| 908 | + $item_id = intval($item_id); | |
| 909 | + | |
| 910 | + if($item_id == 0){ | |
| 911 | + //retrive or create channel for front end streamers | |
| 912 | + $item_id=$this->wpstream_retrive_front_end_channel(); | |
| 913 | + } | |
| 914 | + print'<div class="wpstream_modal_background"></div>'; | |
| 915 | + print '<div class="wpstream_error_modal_notification"><div class="wpstream_error_content">er2</div> | |
| 916 | + <div class="wpstream_error_ok wpstream_button" type="button">'.esc_html__('Close','wpstream').'</div> | |
| 917 | + </div>'; | |
| 918 | + $this->admin->wpstream_live_stream_unit_for_theme( $item_id,$type ); | |
| 919 | + } | |
| 841 | 920 | |
| 842 | 921 | |
| 843 | 922 | /** |
| 844 | 923 | * retrive channel for front end streaming |
| @@ -920,14 +999,22 @@ | ||
| 920 | 999 | ; |
| 921 | 1000 | $author_posts = new WP_Query( $args ); |
| 922 | 1001 | if( $author_posts->have_posts() ) { |
| 923 | 1002 | $author_posts->the_post(); |
| 924 | - return get_the_ID(); | |
| 1003 | + $the_id= get_the_ID(); | |
| 925 | 1004 | }else{ |
| 926 | - return 0; | |
| 1005 | + $the_id= 0; | |
| 927 | 1006 | } |
| 928 | 1007 | |
| 929 | 1008 | wp_reset_query(); |
| 930 | 1009 | wp_reset_postdata(); |
| 1010 | + return $the_id; | |
| 931 | 1011 | } |
| 932 | - | |
| 1012 | + | |
| 1013 | + /** | |
| 1014 | + * Cleanup old logs | |
| 1015 | + */ | |
| 1016 | + public function cleanup_logs() { | |
| 1017 | + $logger = new WPStream_Logger(); | |
| 1018 | + $logger->clear_old_logs(); | |
| 1019 | + } | |
| 933 | 1020 | } |