PluginProbe
WpStream – Live Streaming, Video on Demand, Pay Per View / 4.8.2
WpStream – Live Streaming, Video on Demand, Pay Per View v4.8.2
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
← All changes | widgets/player.php +54 -50 4.14.14.8.2 View file →
@@ -1,15 +1,5 @@
1 1 <?php
2 -/**
3 - * Elementor widget: WpStream Player.
4 - *
5 - * Registers the "WpStream Player" Elementor widget under the plugin's own
6 - * widget category. It exposes a product/free-product id plus an optional user
7 - * id and, on render, delegates to the main plugin object to print the player.
8 - *
9 - * @package Wpstream
10 - * @subpackage Wpstream/widgets
11 - */
12 2 namespace ElementorWpStream\Widgets;
13 3
14 4 use Elementor\Widget_Base;
15 5 use Elementor\Controls_Manager;
@@ -16,14 +6,8 @@
16 6
17 7 if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
18 8
19 9
20 -/**
21 - * Elementor widget class for the WpStream player.
22 - *
23 - * Implements the standard Elementor widget contract: identity (name/title/icon),
24 - * editor controls, frontend render, and the editor preview template.
25 - */
26 10 class Wpstream_Player_Base extends Widget_Base {
27 11
28 12 /**
29 13 * Retrieve the widget name.
@@ -34,19 +18,12 @@
34 18 *
35 19 * @return string Widget name.
36 20 */
37 21 public function get_name() {
38 - // Internal identifier Elementor uses to reference this widget.
39 22 return 'Wpstream_Player';
40 23 }
41 24
42 - /**
43 - * Retrieve the widget categories.
44 - *
45 - * @return array List of Elementor category slugs this widget belongs to.
46 - */
47 25 public function get_categories() {
48 - // Group this widget under the plugin's own "wpstream" category.
49 26 return [ 'wpstream' ];
50 27 }
51 28
52 29
@@ -59,10 +36,9 @@
59 36 *
60 37 * @return string Widget title.
61 38 */
62 39 public function get_title() {
63 - // Wrap the translated label in the theme's widget-title markup.
64 - return '<div class="wpstream_elementor_widget_title">'.__( 'WpStream Player', 'wpstream' ).'</div>';
40 + return '<div class="wpestate_elementor_widget_title">'.__( 'WpStream Player', 'wpstream' ).'</div>';
65 41 }
66 42
67 43 /**
68 44 * Retrieve the widget icon.
@@ -73,24 +49,51 @@
73 49 *
74 50 * @return string Widget icon.
75 51 */
76 52 public function get_icon() {
77 - // Elementor icon-font class shown for this widget in the panel.
78 53 return 'eicon-play-o';
79 54 }
80 55
81 56
82 57
83 - /**
84 - * Register the widget's editor controls.
85 - *
86 - * @access protected
87 - */
88 - protected function register_controls() {
89 - // Theme-wide taxonomy list kept in scope (unused by this widget).
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() {
90 94 global $all_tax;
91 95
92 - // Open the "Content" settings section.
93 96 $this->start_controls_section(
94 97 'section_content',
95 98 [
96 99 'label' => __( 'Content', 'wpstream' ),
@@ -96,9 +99,8 @@
96 99 'label' => __( 'Content', 'wpstream' ),
97 100 ]
98 101 );
99 102
100 - // Text field: product / free-product id to build the player for.
101 103 $this->add_control(
102 104 'item_id',
103 105 [
104 106 'label' => __( 'Product/Free Product id', 'wpstream' ),
@@ -107,9 +109,8 @@
107 109 ]
108 110 );
109 111
110 112
111 - // Text field: optional user id; its first channel overrides the product id.
112 113 $this->add_control(
113 114 'user_id',
114 115 [
115 116 'label' => __( 'User Id', 'wpstream' ),
@@ -114,13 +115,12 @@
114 115 [
115 116 'label' => __( 'User Id', 'wpstream' ),
116 117 'label_block'=>true,
117 118 'type' => Controls_Manager::TEXT,
118 - 'description' => esc_html__( "We will use the first channel of this user id(product id will be ignored.).","wpstream")
119 + 'description' => esc_html__( "We will use the first channel of this user id(product id will be ignored.).","wpestate")
119 120 ]
120 121 );
121 122
122 - // Close the "Content" settings section.
123 123 $this->end_controls_section();
124 124
125 125
126 126 }
@@ -134,27 +134,32 @@
134 134 *
135 135 * @access protected
136 136 */
137 137
138 - /**
139 - * Render the widget on the frontend.
140 - *
141 - * Collects the control values and delegates to the plugin to echo the player.
142 - *
143 - * @access protected
144 - */
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 +
145 154 protected function render() {
146 - // Pull the saved control values for this widget instance.
147 155 $settings = $this->get_settings_for_display();
148 156
149 - // Map the control values onto the attribute array the player expects.
150 157 $attributes['id'] = $settings['item_id'] ;
151 158 $attributes['user_id'] = $settings['user_id'] ;
152 159
153 160
154 - // Main plugin instance that knows how to build the player markup.
155 161 global $wpstream_plugin;
156 - // Echo the assembled player for the chosen product/user.
157 162 echo $wpstream_plugin->wpstream_insert_player_elementor($attributes);
158 163 }
159 164
160 165 /**
@@ -168,9 +173,8 @@
168 173 */
169 174 protected function content_template() {
170 175 ?>
171 176 <div class="title">
172 - <!-- Backbone/Underscore template token echoed as the live editor preview. -->
173 177 {{{ settings.title }}}
174 178 </div>
175 179 <?php
176 180 }