| @@ -76,9 +76,8 @@ | ||
| 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() { |
| @@ -100,19 +99,19 @@ | ||
| 100 | 99 | $this->wpstream_load_theme_notice(); |
| 101 | 100 | |
| 102 | 101 | $this->wpstream_conection(); |
| 103 | 102 | $this->wpstream_player(); |
| 104 | - $this->wpstream_init_quota_manager(); | |
| 105 | 103 | |
| 106 | 104 | } |
| 107 | 105 | |
| 108 | - | |
| 109 | - | |
| 110 | - | |
| 111 | - | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 112 | 110 | public function wpstream_convert_band($megabits){ |
| 113 | - $gigabit = $megabits * 0.001; | |
| 114 | - return floatval( sprintf( '%.1f', $gigabit ) ); | |
| 111 | + $gigabit = $megabits * 0.001; | |
| 112 | + $gigabit = floatval(sprintf('%.1f', $gigabit)); | |
| 113 | + return $gigabit; | |
| 115 | 114 | } |
| 116 | 115 | |
| 117 | 116 | |
| 118 | 117 | public $wpstream_ajax; |
| @@ -133,14 +132,9 @@ | ||
| 133 | 132 | require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wpstream-player.php'; |
| 134 | 133 | $this->wpstream_player = new Wpstream_Player($this->main); |
| 135 | 134 | } |
| 136 | 135 | |
| 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 | 136 | |
| 142 | - | |
| 143 | 137 | private function wpstream_load_page_templates() { |
| 144 | 138 | require_once WPSTREAM_PLUGIN_PATH . 'includes/class-wpstream-templates.php'; |
| 145 | 139 | new WpStream_Template_Loader(); |
| 146 | 140 | } |
| @@ -269,10 +263,8 @@ | ||
| 269 | 263 | |
| 270 | 264 | |
| 271 | 265 | $this->loader->add_action( 'wp_ajax_wpstream_on_board_login', $plugin_admin,'wpstream_on_board_login' ); |
| 272 | 266 | $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 | 267 | |
| 276 | 268 | // Register AJAX actions for multipart uploads |
| 277 | 269 | $this->loader->add_action( 'wp_ajax_wpstream_initiate_multipart_upload', $plugin_admin, 'handle_initiate_multipart_upload' ); |
| 278 | 270 | $this->loader->add_action( 'wp_ajax_wpstream_complete_multipart_upload', $plugin_admin, 'handle_complete_multipart_upload' ); |
| @@ -277,10 +269,8 @@ | ||
| 277 | 269 | $this->loader->add_action( 'wp_ajax_wpstream_initiate_multipart_upload', $plugin_admin, 'handle_initiate_multipart_upload' ); |
| 278 | 270 | $this->loader->add_action( 'wp_ajax_wpstream_complete_multipart_upload', $plugin_admin, 'handle_complete_multipart_upload' ); |
| 279 | 271 | |
| 280 | 272 | $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 | 273 | $this->loader->add_action( 'wp_ajax_wpstream_update_cache_notice', $plugin_admin,'wpstream_update_cache_notice' ); |
| 284 | 274 | // $this->loader->add_action( 'wp_ajax_wpstream_get_videos_list', $plugin_admin,'wpstream_get_videos_list' ); |
| 285 | 275 | |
| 286 | 276 | |
| @@ -458,11 +448,11 @@ | ||
| 458 | 448 | } |
| 459 | 449 | |
| 460 | 450 | print '<div class="pack_details_wrapper">' |
| 461 | 451 | . '<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> ' | |
| 452 | + . __('You have', 'wpstream') . '<strong> ' . abs( $wpstream_convert_band ) . ' GB</strong> ' | |
| 453 | + . __('available cloud data and', 'wpstream') . ' ' | |
| 454 | + . '<strong>' . $wpstream_convert_storage . ' GB</strong> ' | |
| 465 | 455 | . __('available cloud storage', 'wpstream') . '.'; |
| 466 | 456 | |
| 467 | 457 | print '<a href="https://wpstream.net/pricing/" class="wpstream_upgrade_topbar" target="_blank">'.esc_html__('Upgrade Plan','wpstream').'</a>'; |
| 468 | 458 | print '</div>'; |
| @@ -860,9 +850,9 @@ | ||
| 860 | 850 | */ |
| 861 | 851 | |
| 862 | 852 | public function wpstream_check_user_can_stream(){ |
| 863 | 853 | $current_user = wp_get_current_user(); |
| 864 | - | |
| 854 | + | |
| 865 | 855 | if( !is_user_logged_in() ){ |
| 866 | 856 | return false; |
| 867 | 857 | exit('user not logged in'); |
| 868 | 858 | } |
| @@ -872,17 +862,14 @@ | ||
| 872 | 862 | return true; |
| 873 | 863 | } |
| 874 | 864 | |
| 875 | 865 | $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 ) ) { | |
| 866 | + $user_role = $current_user->roles[0]; | |
| 867 | + | |
| 868 | + if (is_array($extra_roles) && in_array($user_role, $extra_roles)){ | |
| 882 | 869 | return true; |
| 883 | 870 | } |
| 884 | - | |
| 871 | + | |
| 885 | 872 | if(function_exists('wpstream_get_option') && intval(wpstream_get_option('allow_streaming_regular_users',''))==1 ){ |
| 886 | 873 | return true; |
| 887 | 874 | } |
| 888 | 875 | |