PluginProbe
WpStream – Live Streaming, Video on Demand, Pay Per View / 4.4
WpStream – Live Streaming, Video on Demand, Pay Per View v4.4
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 / player.php

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

182 lines 3.9 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 if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
8
9
10 class Wpstream_Player_Base extends Widget_Base {
11
12 /**
13 * Retrieve the widget name.
14 *
15 * @since 1.0.0
16 *
17 * @access public
18 *
19 * @return string Widget name.
20 */
21 public function get_name() {
22 return 'Wpstream_Player';
23 }
24
25 public function get_categories() {
26 return [ 'wpstream' ];
27 }
28
29
30 /**
31 * Retrieve the widget title.
32 *
33 * @since 1.0.0
34 *
35 * @access public
36 *
37 * @return string Widget title.
38 */
39 public function get_title() {
40 return '<div class="wpestate_elementor_widget_title">'.__( 'WpStream Player', 'wpstream' ).'</div>';
41 }
42
43 /**
44 * Retrieve the widget icon.
45 *
46 * @since 1.0.0
47 *
48 * @access public
49 *
50 * @return string Widget icon.
51 */
52 public function get_icon() {
53 return 'eicon-play-o';
54 }
55
56
57
58 /**
59 * Retrieve the list of scripts the widget depended on.
60 *
61 * Used to set scripts dependencies required to run the widget.
62 *
63 * @since 1.0.0
64 *
65 * @access public
66 *
67 * @return array Widget scripts dependencies.
68 */
69 public function get_script_depends() {
70 return [ '' ];
71 }
72
73 /**
74 * Register the widget controls.
75 *
76 * Adds different input fields to allow the user to change and customize the widget settings.
77 *
78 * @since 1.0.0
79 *
80 * @access protected
81 */
82
83 public function elementor_transform($input){
84 $output=array();
85 if( is_array($input) ){
86 foreach ($input as $key=>$tax){
87 $output[$tax['value']]=$tax['label'];
88 }
89 }
90 return $output;
91 }
92
93 protected function _register_controls() {
94 global $all_tax;
95
96 $this->start_controls_section(
97 'section_content',
98 [
99 'label' => __( 'Content', 'wpstream' ),
100 ]
101 );
102
103 $this->add_control(
104 'item_id',
105 [
106 'label' => __( 'Product/Free Product id', 'wpstream' ),
107 'label_block'=>true,
108 'type' => Controls_Manager::TEXT,
109 ]
110 );
111
112
113 $this->add_control(
114 'user_id',
115 [
116 'label' => __( 'User Id', 'wpstream' ),
117 'label_block'=>true,
118 'type' => Controls_Manager::TEXT,
119 'description' => esc_html__( "We will use the first channel of this user id(product id will be ignored.).","wpestate")
120 ]
121 );
122
123 $this->end_controls_section();
124
125
126 }
127
128 /**
129 * Render the widget output on the frontend.
130 *
131 * Written in PHP and used to generate the final HTML.
132 *
133 * @since 1.0.0
134 *
135 * @access protected
136 */
137
138 public function wpresidence_send_to_shortcode($input){
139 $output='';
140 if($input!==''){
141 $numItems = count($input);
142 $i = 0;
143
144 foreach ($input as $key=>$value){
145 $output.=$value;
146 if(++$i !== $numItems) {
147 $output.=', ';
148 }
149 }
150 }
151 return $output;
152 }
153
154 protected function render() {
155 $settings = $this->get_settings_for_display();
156
157 $attributes['id'] = $settings['item_id'] ;
158 $attributes['user_id'] = $settings['user_id'] ;
159
160
161 global $wpstream_plugin;
162 echo $wpstream_plugin->wpstream_insert_player_elementor($attributes);
163 }
164
165 /**
166 * Render the widget output in the editor.
167 *
168 * Written as a Backbone JavaScript template and used to generate the live preview.
169 *
170 * @since 1.0.0
171 *
172 * @access protected
173 */
174 protected function content_template() {
175 ?>
176 <div class="title">
177 {{{ settings.title }}}
178 </div>
179 <?php
180 }
181 }
182