PluginProbe
WpStream – Live Streaming, Video on Demand, Pay Per View / 1.2
WpStream – Live Streaming, Video on Demand, Pay Per View v1.2
4.14.0 4.13.2 4.13.1 4.13 4.12.5 4.12.4 4.12.3 4.12.2 4.12.1 4.12 4.4.4 4.4.5 4.4.6 4.4.7 4.4.8 4.4.9 4.5 4.5.1 4.5.11 4.5.11.1 4.5.11.2 4.5.11.4 4.5.11.5 4.5.11.6 4.5.12 All 180 releases
wpstream / libs / plugin-admin.php

plugin-admin.php in WpStream – Live Streaming, Video on Demand, Pay Per View 1.2, at libs/plugin-admin.php

319 lines 11.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 function wpstream_new_general_set() {
4
5 if($_SERVER['REQUEST_METHOD'] === 'POST'){
6 $allowed_html = array();
7 $exclude_array = array();
8 $allowed_html = array();
9
10 foreach($_POST as $variable=>$value){
11
12 if ($variable!='submit'){
13 if (!in_array($variable, $exclude_array) ){
14 update_option( sanitize_key('wpstream_'.$variable), wp_kses ($value,$allowed_html) );
15 }
16 }
17 }
18
19
20 update_option('wp_estate_token_expire',0);
21 update_option('wp_estate_curent_token',' ');
22
23
24 }
25
26
27
28 $allowed_html = array();
29 $api_key = esc_html( get_option('wpstream_api_key','') );
30
31
32 $wpstream_options_array =array(
33 0 => array(
34 'label' => 'api key',
35 'name' => 'api_key',
36 'type' => 'text',
37 ),
38 1 => array(
39 'label' => 'api secret key',
40 'name' => 'api_secret_key',
41 'type' => 'text',
42 ),
43 2 => array(
44 'label' => 'api username',
45 'name' => 'api_username',
46 'type' => 'text',
47 ),
48 3 => array(
49 'label' => 'api password',
50 'name' => 'api_password',
51 'type' => 'password',
52 )
53 );
54
55
56
57
58
59
60 print '<form method="post" action="" >';
61 print '<div class="theme_options_tab" >
62 <h1>'.__('General Settings','wpstream').'</h1>';
63
64 if( wpstream_client_check_api_status() ){
65 echo '<div class="api_conected">'.__('Conected to WP Stream API!','wpstream').'</div>';
66 }else{
67 echo '<div class="api_not_conected">'.__('No Connection to WP Stream API. Go ','wpstream').'<a href="https://wpstream.net/my-account" target="_blank">here</a>'.__(' to get your API credentials','wpstream').'</div>';
68 }
69 print '<div class="wpstream_option_wrapper">';
70 foreach ($wpstream_options_array as $key=>$option){
71 print '<div class="wpstream_option">';
72
73 $options_value = esc_html( get_option('wpstream_'.$option['name'],'') );
74 print '<label for="'.$option['name'].'">'.$option['label'].'</label>';
75 print '<input id="'.$option['name'].'" type="'.$option['type'].'" size="36" name="'.$option['name'].'" value="'.esc_html($options_value).'" />';
76
77 print '</div>';
78 }
79 print '</div>';
80
81
82 print '<input type="submit" name="submit" class="wpstream_button" value="'.__('Save Changes','wpstream').'" />';
83
84 print '</div>';
85 print '</form>';
86
87
88 $no_channel=1;
89
90 if(class_exists ('WC_Subscription')){
91
92 }
93
94 //event_passed
95 $args = array(
96 'posts_per_page' => -1,
97 'post_type' => 'product',
98 'post_status' => 'publish',
99 'meta_query' => array(
100 array(
101 'key' => 'event_passed',
102 'value' => 1,
103 'compare' => '!=',
104 )
105 ),
106
107 'tax_query' => array(
108 'relation' => 'AND',
109 array(
110 'taxonomy' => 'product_type',
111 'field' => 'slug',
112 'terms' => array('live_stream','subscription')
113 )
114 ),
115 );
116
117
118
119 $event_list = new WP_Query($args);
120 global $live_event_for_user;
121
122 $live_event_for_user = wpstream_get_live_event_for_user();
123
124
125
126 $pack_details = wpstream_get_pack_details_user();
127
128 if( isset($pack_details['band']) && isset( $pack_details['storage']) ){
129 print '<div class="pack_details_wrapper"><strong>'.__('Your account information: ','wpstream').'</strong> '.__('You have','wpstream').'<strong> '.wpstream_convert_band($pack_details['band']).' Gb</strong> '.__('available streaming bandwidth and','wpstream').' <strong>'.wpstream_convert_band($pack_details['storage']).' Gb</strong> '.__('available media storage','wpstream').'.</div>';
130 }
131
132
133 print '<div class="pack_details_wrapper">
134 <h3>'.__('How to Broadcast','wpestate').'</h3>
135 <ul>
136 <li>1. Start your broadcast. Click on the "Start Broadcast" button and wait for your streaming url to become available(about 1 min.)</li>
137 <li>2. Copy paste it and use it with <a href="https://obsproject.com/download" target="_blank">"Open Brodcaster Software"</a>. </li>
138 <li>3. Look up video tutorials on WpStream website for detailed instructions on OBS usage.</li>
139
140 <ul>
141 <img class="how_to" src="'.plugins_url().'/wpstream/img/how_to_obs.jpg" alt="show_imagge">
142 </div>';
143
144 if($event_list->have_posts()){
145 print '<div class="pack_details_wrapper_transparent">
146 <h3>'.__('Your Paid Channel List','wpestate').'</h3>
147 </div>';
148
149 print '<div style="clear: both;"></div><div class="event_list_wrapper">';
150
151 while ($event_list->have_posts()): $event_list->the_post();
152
153 $the_id = get_the_ID();
154 $is_subscription_live_event = esc_html(get_post_meta($the_id,'_subscript_live_event',true));
155 $term_list = wp_get_post_terms($the_id, 'product_type');
156
157 if( $term_list[0]->name=='subscription' && $is_subscription_live_event=='no'){
158 continue;
159 }
160
161 wpstream_live_stream_unit($the_id);
162
163 endwhile;
164
165 print'</div>';
166 $no_channel=1;
167 }else{
168 $no_channel=0;
169 }
170
171
172 $ajax_nonce = wp_create_nonce( "wpstream_start_event_nonce" );
173 print '<input type="hidden" id="wpstream_start_event_nonce" value="'.$ajax_nonce.'">';
174 $current_user = wp_get_current_user();
175 $allowded_html = array();
176 $userID = $current_user->ID;
177 $user_live_streams = get_user_meta($userID,'live_shows');
178
179
180 wp_reset_postdata();
181
182
183
184
185
186
187
188
189 // free
190
191 $args_free = array(
192 'posts_per_page' => -1,
193 'post_type' => 'wpstream_product',
194 'post_status' => 'publish',
195 'meta_query' => array(
196 array(
197 'key' => 'wpstream_product_type',
198 'value' => 1,
199 'compare' => '==',
200 )
201 ),
202
203
204 );
205 $event_list_free = new WP_Query($args_free);
206
207
208 if($event_list_free->have_posts()){
209 print '<div class="pack_details_wrapper_transparent">
210 <h3>'.__('Your Free Channel List','wpestate').'</h3>
211 </div>';
212
213 print '<div style="clear: both;"></div><div class="event_list_wrapper">';
214
215 while ($event_list_free->have_posts()): $event_list_free->the_post();
216
217 $the_id = get_the_ID();
218 wpstream_live_stream_unit($the_id);
219
220 endwhile;
221
222 print'</div>';
223 $no_channel=1;
224 }else{
225 $no_channel=0;
226 }
227
228
229
230 if($no_channel==0){
231 print '<div class="no_events_warning"> '.__('* You don\'t have live chanels.Please add on in your Free Products /Woocomerce Products menu!','wpstream').'</div>';
232 }
233
234
235
236
237 }
238 // end wpstream_new_general_set
239
240
241
242
243
244
245
246 function wpstream_live_stream_unit($the_id){
247 global $live_event_for_user;
248
249
250
251
252 print '<div class="event_list_unit">';
253 $ip= get_post_meta($the_id,'ip',true);
254 $thumb = get_the_post_thumbnail_url($the_id,'thumbnail');
255 print '<div class="event_thumb_wrapper"><img class="event_thumb" src="'.$thumb.'" alt="show_imagge"></div>';
256 print '<h3 data-prodid="'.$the_id.'">'.$the_id.'. '.get_the_title($the_id).'</h3>';
257
258 $live_event_stream_name = get_post_meta($the_id,'live_event_stream_name',true);
259 $live_event_array = get_post_meta($the_id,'live_event_uri',true);
260 $live_event_uri = '';
261
262
263
264 print '<div class="event_list_unit_notification"></div>';
265 if(isset($live_event_for_user[$the_id])) {
266
267 $explode = explode('wpstream.net/', $live_event_for_user[$the_id]['live_uri']);
268 $uri = $explode[0].'wpstream.net/wpstream/';
269
270 $stream_name = get_post_meta($the_id,'live_event_stream_name',true);
271 print '<div class="event_list_unit_notificationx"><strong>'.__('Url:').' </strong> ' . $uri;
272 print '</br><strong>'.__('Stream Key:').'</strong> '. $live_event_for_user[$the_id]['carnat1'].'?auth='.$live_event_for_user[$the_id]['carnat2'].'</br>';
273 print '</div>';
274
275 }else{
276 print '<div class="event_list_unit_notificationx"><span class="server_notification">'.__('There is no active streaming server for this event!','wpestream').'</span><img class="server_loading" src="'.plugins_url().'/wpstream/img/loading.gif" alt="loading" /></div>';
277 print '<div class="record_wrapper">Record ? <input type="checkbox" name="record_event" class="record_event"/>Yes</div>';
278 print '<input class="start_event wpstream_button" type="button" data-show-id="'.$the_id.'" value="Start Broadcasting">';
279 print '<input class="close_event wpstream_button" type="button" data-show-id="'.$the_id.'" value="Delete Channel">';
280 }
281
282
283 // if(isset($live_event_for_user[$the_id])) {
284 // print '</br>';
285 // $live_event_host= explode('wpstream/',$live_event_for_user[$the_id]['live_uri']);
286 // print wpstream_check_open_port($live_event_host[0]);
287 // }
288 print '<div> '.__('* You can do multiple live events on a single channel. **Once you delete, you cannot do a live event again on the same channel.','wpstream').'</div>';
289 print '</div>';
290 }
291
292
293
294
295
296 function wpstream_convert_band($megabits){
297 $gigabit = $megabits * 0.001;
298 $gigabit = number_format($gigabit,2);
299 return $gigabit;
300 }
301
302
303
304
305 function wpstream_check_open_port($host){
306 $host= str_replace("rtmp://", "",$host);
307 $host= str_replace("/", "",$host);
308
309 $port='1935';
310 $connection = fsockopen($host, $port);
311 if (is_resource($connection)){
312 print '<div class="server_ready_live">'.__('Ready for Live Streaming','wpstream').'</div>';
313 fclose($connection);
314 }else{
315 print '<div class="server_not_ready_live">'.__('Not Ready Yet!','wpstream').'</div>';
316 }
317
318 }
319