PluginProbe
WpStream – Live Streaming, Video on Demand, Pay Per View / 4.8
WpStream – Live Streaming, Video on Demand, Pay Per View v4.8
4.14.1 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 All 181 releases
wpstream / widgets / media_list_channels.php

media_list_channels.php in WpStream – Live Streaming, Video on Demand, Pay Per View 4.8, at widgets/media_list_channels.php

261 lines 7.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 namespace ElementorWpStream\Widgets;
3
4 use Elementor\Widget_Base;
5 use Elementor\Controls_Manager;
6
7
8 if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
9
10
11 class Wpstream_Media_List_Channel extends Widget_Base {
12
13 /**
14 * Retrieve the widget name.
15 *
16 * @since 1.0.0
17 *
18 * @access public
19 *
20 * @return string Widget name.
21 */
22 public function get_name() {
23 return 'Wpstream_Media_List_Channel';
24 }
25
26 public function get_categories() {
27 return [ 'wpstream' ];
28 }
29
30
31 /**
32 * Retrieve the widget title.
33 *
34 * @since 1.0.0
35 *
36 * @access public
37 *
38 * @return string Widget title.
39 */
40 public function get_title() {
41 return '<div class="wpestate_elementor_widget_title">'.__( 'WpStream - Channel List', 'wpstream' ).'</div>';
42 }
43
44 /**
45 * Retrieve the widget icon.
46 *
47 * @since 1.0.0
48 *
49 * @access public
50 *
51 * @return string Widget icon.
52 */
53 public function get_icon() {
54 return 'eicon-play-o';
55 }
56
57
58
59 /**
60 * Retrieve the list of scripts the widget depended on.
61 *
62 * Used to set scripts dependencies required to run the widget.
63 *
64 * @since 1.0.0
65 *
66 * @access public
67 *
68 * @return array Widget scripts dependencies.
69 */
70 public function get_script_depends() {
71 return [ '' ];
72 }
73
74 /**
75 * Register the widget controls.
76 *
77 * Adds different input fields to allow the user to change and customize the widget settings.
78 *
79 * @since 1.0.0
80 *
81 * @access protected
82 */
83
84 public function elementor_transform($input){
85 $output=array();
86 if( is_array($input) ){
87 foreach ($input as $key=>$tax){
88 $output[$tax['value']]=$tax['label'];
89 }
90 }
91 return $output;
92 }
93
94 protected function _register_controls() {
95 global $all_tax;
96
97 $product_type=array(
98 0 => __('Both','wpstream'),
99 1 => __('Live Event','wpstream'),
100 2 => __('Video on demand','wpstream')
101 );
102
103 $free_paid_type=array(
104 0 => esc_html__('Free','wpstream'),
105 1 => esc_html__('Paid','wpstream')
106 );
107
108
109 $order_by_id=array(
110 0=>esc_html('By date - ASC','wpstream'),
111 1=>esc_html('By date - DESC','wpstream'),
112 2=>esc_html('By title - ASC','wpstream'),
113 3=>esc_html('By title - DESC','wpstream'),
114 );
115
116
117 $live_settings=array(
118 'no'=>esc_html__('no','wpstream'),
119 'yes'=>esc_html__('yes','wpstream'),
120 );
121
122 $this->start_controls_section(
123 'section_content',
124 [
125 'label' => __( 'Content', 'wpstream' ),
126 ]
127 );
128
129 // $this->add_control(
130 // 'product_type',
131 // [
132 // 'label' => __( 'What type of media', 'wpstream' ),
133 // 'type' => \Elementor\Controls_Manager::SELECT,
134 // 'default' => $product_type[0],
135 // 'options' => $product_type
136 // ]
137 // );
138
139 $this->add_control(
140 'product_type_free_paid',
141 [
142 'label' => __( 'Show Free or Paid Media ?', 'wpstream' ),
143 'type' => \Elementor\Controls_Manager::SELECT,
144 'default' => $free_paid_type[0],
145 'options' => $free_paid_type
146 ]
147 );
148
149
150 $this->add_control(
151 'product_show_live',
152 [
153 'label' => __( 'Only show active channels', 'wpstream' ),
154 'type' => \Elementor\Controls_Manager::SWITCHER,
155 'label_on' => __( 'Yes', 'your-plugin' ),
156 'label_off' => __( 'No', 'your-plugin' ),
157 'default' => 'no',
158 'return_value' => 'yes',
159 'description'=>__('Only show channels that are live streaming right now.','wpstream'),
160
161 ]
162 );
163
164 $this->add_control(
165 'row_number',
166 [
167 'label' => __( 'Number of Items per row', 'wpstream' ),
168 'label_block'=>true,
169 'type' => Controls_Manager::TEXT,
170 'description'=>__('How many items will be displayed per row. Maximum no is 4','wpstream'),
171 'default'=>3
172 ]
173 );
174
175
176 $this->add_control(
177 'media_number',
178 [
179 'label' => __( 'Number of Items per Page', 'wpstream' ),
180 'label_block'=>true,
181 'type' => Controls_Manager::TEXT,
182 'description'=>__('How many items will be displayed per page','wpstream'),
183 'default'=>3
184 ]
185 );
186
187 $this->add_control(
188 'free_label',
189 [
190 'label' => __( 'Link Label for free items', 'wpstream' ),
191 'label_block'=>true,
192 'type' => Controls_Manager::TEXT,
193 'default'=>esc_html__('Watch now!','wpstream'),
194 'description'=>__('Link Label for free items','wpstream')
195 ]
196 );
197
198
199
200 $this->add_control(
201 'order_by',
202 [
203 'label' => __( 'Order by', 'wpstream' ),
204 'type' => \Elementor\Controls_Manager::SELECT,
205 'default' => 0,
206 'options' => $order_by_id
207 ]
208 );
209
210 $this->end_controls_section();
211
212
213 }
214
215 /**
216 * Render the widget output on the frontend.
217 *
218 * Written in PHP and used to generate the final HTML.
219 *
220 * @since 1.0.0
221 *
222 * @access protected
223 */
224
225 public function wpresidence_send_to_shortcode($input){
226 $output='';
227 if($input!==''){
228 $numItems = count($input);
229 $i = 0;
230
231 foreach ($input as $key=>$value){
232 $output.=$value;
233 if(++$i !== $numItems) {
234 $output.=', ';
235 }
236 }
237 }
238 return $output;
239 }
240
241 protected function render() {
242 $settings = $this->get_settings_for_display();
243
244 $attributes['product_type'] = 1;
245 $attributes['product_type_free_paid'] = $settings['product_type_free_paid'] ;
246 $attributes['media_number'] = $settings['media_number'] ;
247 $attributes['row_number'] = $settings['row_number'] ;
248 $attributes['free_label'] = $settings['free_label'] ;
249 $attributes['order_by'] = $settings['order_by'] ;
250 $attributes['product_show_live'] = $settings['product_show_live'];
251 global $wpstream_plugin;
252
253
254
255 // echo $wpstream_plugin->admin->wpstream_live_stream_unit( $attributes['id'],'front' );
256 echo $wpstream_plugin->wpstream_media_list_elementor_function( $attributes );
257 }
258
259
260 }
261