PluginProbe ʕ •ᴥ•ʔ
EmbedPress – PDF Embedder, 3D PDF FlipBook, Google Reviews, YouTube Videos, Upload & Embed PDF documents / 2.7.4
EmbedPress – PDF Embedder, 3D PDF FlipBook, Google Reviews, YouTube Videos, Upload & Embed PDF documents v2.7.4
4.6.0 4.5.6 4.5.5 4.5.4 4.5.3 4.5.2 trunk 1.0.0 1.1.0 1.1.1 1.1.2 1.1.3 1.2.0 1.3.0 1.3.1 1.4.0 1.4.1 1.4.2 1.4.3 1.4.4 1.5.0 1.6.0 1.6.1 1.6.2 1.6.3 1.7.0 1.7.1 1.7.2 1.7.3 1.7.4 1.7.5 2.0.0 2.0.1 2.0.2 2.0.3 2.1.0 2.1.1 2.1.2 2.1.3 2.1.4 2.1.5 2.1.6 2.2.0 2.2.1 2.2.2 2.3.0 2.3.1 2.3.2 2.3.3 2.4.0 2.4.1 2.5.0 2.5.1 2.5.2 2.5.3 2.5.4 2.5.5 2.6.0 2.6.1 2.6.2 2.7.0 2.7.1 2.7.2 2.7.3 2.7.4 2.7.5 2.7.6 2.7.7 3.0.0 3.0.1 3.0.2 3.0.3 3.0.4 3.1.0 3.1.1 3.1.2 3.1.3 3.2.0 3.2.1 3.3.0 3.3.1 3.3.2 3.3.3 3.3.4 3.3.5 3.3.6 3.3.7 3.4.0 3.4.1 3.4.2 3.4.3 3.5.0 3.5.1 3.5.2 3.5.3 3.6.0 3.6.1 3.6.2 3.6.3 3.6.4 3.6.5 3.6.6 3.6.7 3.6.8 3.7.0 3.7.1 3.7.2 3.7.3 3.8.0 3.8.1 3.8.2 3.8.3 3.8.4 3.8.5 3.9.0 3.9.1 3.9.10 3.9.11 3.9.12 3.9.13 3.9.14 3.9.15 3.9.16 3.9.17 3.9.2 3.9.3 3.9.4 3.9.5 3.9.6 3.9.7 3.9.8 3.9.9 4.0.0 4.0.1 4.0.10 4.0.11 4.0.12 4.0.13 4.0.14 4.0.2 4.0.3 4.0.4 4.0.5 4.0.6 4.0.7 4.0.8 4.0.9 4.1.0 4.1.1 4.1.10 4.1.2 4.1.3 4.1.4 4.1.5 4.1.6 4.1.7 4.1.8 4.1.9 4.2.0 4.2.1 4.2.2 4.2.3 4.2.4 4.2.5 4.2.6 4.2.7 4.2.8 4.2.9 4.3.0 4.3.1 4.4.0 4.4.1 4.4.10 4.4.11 4.4.2 4.4.3 4.4.4 4.4.5 4.4.6 4.4.7 4.4.8 4.4.9 4.5.0 4.5.1
embedpress / EmbedPress / Elementor / Widgets / Embedpress_Elementor.php
embedpress / EmbedPress / Elementor / Widgets Last commit date
Embedpress_Document.php 5 years ago Embedpress_Elementor.php 5 years ago
Embedpress_Elementor.php
237 lines
1 <?php
2
3 namespace EmbedPress\Elementor\Widgets;
4
5
6 use \Elementor\Controls_Manager as Controls_Manager;
7 use Elementor\Group_Control_Background;
8 use \Elementor\Group_Control_Css_Filter;
9 use \Elementor\Widget_Base as Widget_Base;
10 use \EmbedPress\Shortcode;
11
12 (defined( 'ABSPATH' )) or die( "No direct script access allowed." );
13
14 class Embedpress_Elementor extends Widget_Base {
15
16 public function get_name() {
17 return 'embedpres_elementor';
18 }
19
20 public function get_title() {
21 return esc_html__( 'EmbedPress', 'embedoress' );
22 }
23
24 public function get_categories() {
25 return [ 'embedpress' ];
26 }
27
28 public function get_custom_help_url() {
29 return 'https://embedpress.com/documentation';
30 }
31
32 public function get_icon() {
33 return 'icon-embedpress';
34 }
35
36 /**
37 * Get widget keywords.
38 *
39 * Retrieve the list of keywords the widget belongs to.
40 *
41 * @return array Widget keywords.
42 * @since 2.4.1
43 * @access public
44 *
45 */
46 public function get_keywords() {
47 return [
48 'embedpress',
49 'audio',
50 'video',
51 'map',
52 'youtube',
53 'vimeo',
54 'wistia',
55 'twitch',
56 'soundcloud',
57 'giphy gifs',
58 'spotify',
59 'smugmug',
60 'meetup',
61 'dailymotion',
62 'instagram',
63 'slideshare',
64 'flickr',
65 'ted',
66 'google docs',
67 'google slides',
68 'google drawings'
69 ];
70 }
71
72 protected function _register_controls() {
73
74 /**
75 * EmbedPress Content Settings
76 */
77 $this->start_controls_section(
78 'embedpress_elementor_content_settings',
79 [
80 'label' => esc_html__( 'Content Settings', 'embedpress' ),
81 ]
82 );
83
84 do_action( 'embedpress/embeded/extend', $this );
85
86 $this->add_control(
87 'embedpress_embeded_link',
88 [
89
90 'label' => __( 'Embeded Link', 'embedpress' ),
91 'type' => Controls_Manager::TEXT,
92 'dynamic' => [
93 'active' => true,
94 ],
95 'placeholder' => __( 'Enter your Link', 'embedpress' ),
96 'label_block' => true
97
98 ]
99 );
100
101 do_action( 'embedpress/control/extend', $this );
102
103 $this->end_controls_section();
104
105 $this->start_controls_section(
106 'embedpress_style_section',
107 [
108 'label' => __( 'Style', 'elementor' ),
109 'tab' => Controls_Manager::TAB_STYLE,
110 ]
111 );
112
113
114 $this->add_control(
115 'embedpress_elementor_aspect_ratio',
116 [
117 'label' => __( 'Aspect Ratio', 'embedpress' ),
118 'description' => __( 'Good for any video. You may turn it off for other embed type.', 'embedpress' ),
119 'type' => Controls_Manager::SELECT,
120 'options' => [
121 0 => __('None'),
122 '169' => '16:9',
123 '219' => '21:9',
124 '43' => '4:3',
125 '32' => '3:2',
126 '11' => '1:1',
127 '916' => '9:16',
128 ],
129 'default' => 0,
130 'prefix_class' => 'embedpress-aspect-ratio-',
131 'frontend_available' => true,
132 ]
133 );
134
135 $this->add_control(
136 'width',
137 [
138 'label' => __( 'Width', 'embedpress' ),
139 'type' => Controls_Manager::SLIDER,
140 'size_units' => [ 'px' ],
141 'range' => [
142 'px' => [
143 'min' => 0,
144 'max' => 1500,
145 'step' => 5,
146 ],
147 ],
148 'default' => [
149 'unit' => 'px',
150 'size' => 600,
151 ]
152 ]
153 );
154 $this->add_control(
155 'height',
156 [
157 'label' => __( 'Height', 'embedpress' ),
158 'type' => Controls_Manager::SLIDER,
159 'size_units' => [ 'px' ],
160 'range' => [
161 'px' => [
162 'min' => 0,
163 'max' => 1500,
164 'step' => 5,
165 ],
166 ],
167 'default' => [
168 'unit' => 'px',
169 'size' => 400,
170 ]
171 ]
172 );
173
174 $this->add_responsive_control(
175 'margin',
176 [
177 'label' => __( 'Margin', 'embedpress' ),
178 'type' => Controls_Manager::DIMENSIONS,
179 'size_units' => [ 'px', '%', 'em' ],
180 'selectors' => [
181 '{{WRAPPER}} .embedpress-elements-wrapper .embedpress-wrapper' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
182 ],
183 ]
184 );
185 $this->add_responsive_control(
186 'padding',
187 [
188 'label' => __( 'Padding', 'embedpress' ),
189 'type' => Controls_Manager::DIMENSIONS,
190 'size_units' => [ 'px', '%', 'em' ],
191 'selectors' => [
192 '{{WRAPPER}} .embedpress-elements-wrapper .embedpress-wrapper' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
193 ],
194 ]
195 );
196 $this->add_group_control(
197 Group_Control_Background::get_type(),
198 [
199 'name' => 'background',
200 'label' => __( 'Background', 'embedpress' ),
201 'types' => [ 'classic', 'gradient' ],
202 'selector' => '{{WRAPPER}} .embedpress-elements-wrapper .embedpress-wrapper, {{WRAPPER}} .embedpress-fit-aspect-ratio .embedpress-wrapper iframe',
203 ]
204 );
205 $this->add_group_control(
206 Group_Control_Css_Filter::get_type(),
207 [
208 'name' => 'embedpress_elementor_css_filters',
209 'selector' => '{{WRAPPER}} .embedpress-elements-wrapper .embedpress-wrapper',
210 ]
211 );
212 $this->end_controls_section();
213
214
215 }
216
217 protected function render() {
218 $settings = $this->get_settings_for_display();
219 $height = (!empty( $settings['height']) && !empty( $settings['height']['size'] ))
220 ? $settings['height']['size'] : null;
221 $width = (!empty( $settings['width']) && !empty( $settings['width']['size'] ))
222 ? $settings['width']['size'] : null;
223
224 $embed_content = Shortcode::parseContent( $settings['embedpress_embeded_link'], true, [ 'height'=> $height, 'width'=>$width ] );
225 $embed = apply_filters( 'embedpress_elementor_embed', $embed_content, $settings );
226 $content = is_object( $embed ) ? $embed->embed : $embed;
227
228 ?>
229 <div class="embedpress-elements-wrapper <?php echo !empty( $settings['embedpress_elementor_aspect_ratio']) ? 'embedpress-fit-aspect-ratio': ''; ?>">
230 <?php echo $content; ?>
231 </div>
232 <?php
233 }
234
235
236 }
237