Elementor_Enhancer.php
3 years ago
EmbedPress_Core_Installer.php
6 years ago
EmbedPress_Notice.php
2 years ago
EmbedPress_Plugin_Usage_Tracker.php
2 years ago
Extend_CustomPlayer_Controls.php
3 years ago
Extend_Elementor_Controls.php
2 years ago
Feature_Enhancer.php
2 years ago
Helper.php
2 years ago
Extend_Elementor_Controls.php
438 lines
| 1 | <?php |
| 2 | |
| 3 | namespace EmbedPress\Includes\Classes; |
| 4 | |
| 5 | use \Elementor\Controls_Manager; |
| 6 | |
| 7 | class Extend_Elementor_Controls |
| 8 | { |
| 9 | |
| 10 | public function __construct() |
| 11 | { |
| 12 | add_action('extend_elementor_controls', [$this, 'extend_elementor_share_and_lock_controls'], 10, 4); |
| 13 | } |
| 14 | |
| 15 | public function extend_elementor_share_and_lock_controls($that, $infix = '', $pro_text = '', $pro_class = '') |
| 16 | { |
| 17 | $ad_condition = [ |
| 18 | 'adManager' => 'yes' |
| 19 | ]; |
| 20 | $ai_condition = [ |
| 21 | 'active' => false, |
| 22 | ]; |
| 23 | |
| 24 | $that->start_controls_section( |
| 25 | 'embedpress_adManager', |
| 26 | [ |
| 27 | 'label' => esc_html__('EP Ads Settings', 'embedpress'), |
| 28 | ] |
| 29 | ); |
| 30 | |
| 31 | $that->add_control( |
| 32 | 'adManager', |
| 33 | [ |
| 34 | 'label' => sprintf(__('Ads Settings %s', 'embedpress'), $pro_text), |
| 35 | 'type' => Controls_Manager::SWITCHER, |
| 36 | 'label_block' => false, |
| 37 | 'return_value' => 'yes', |
| 38 | 'default' => '', |
| 39 | 'classes' => $pro_class, |
| 40 | ] |
| 41 | ); |
| 42 | |
| 43 | $that->add_control( |
| 44 | 'adSource', |
| 45 | [ |
| 46 | 'label' => __('Ad Source', 'embedpress'), |
| 47 | 'type' => \Elementor\Controls_Manager::SELECT, |
| 48 | 'options' => [ |
| 49 | 'video' => __('Upload Video', 'embedpress'), |
| 50 | 'image' => __('Upload Image', 'embedpress'), |
| 51 | 'url' => __('URL', 'embedpress'), |
| 52 | ], |
| 53 | 'default' => 'video', |
| 54 | 'condition' => $ad_condition, |
| 55 | 'ai' => $ai_condition, |
| 56 | ] |
| 57 | ); |
| 58 | |
| 59 | $that->add_control( |
| 60 | 'adFileUrl', |
| 61 | [ |
| 62 | 'label' => __('Uploaded Video', 'embedpress'), |
| 63 | 'type' => \Elementor\Controls_Manager::MEDIA, |
| 64 | 'media_types' => [ |
| 65 | 'video' |
| 66 | ], |
| 67 | 'condition' => [ |
| 68 | 'adManager' => 'yes', |
| 69 | 'adSource' => 'video', |
| 70 | ], |
| 71 | 'ai' => $ai_condition, |
| 72 | ] |
| 73 | ); |
| 74 | $that->add_control( |
| 75 | 'adFileUrl1', |
| 76 | [ |
| 77 | 'label' => __('Uploaded Image', 'embedpress'), |
| 78 | 'type' => \Elementor\Controls_Manager::MEDIA, |
| 79 | 'media_types' => [ |
| 80 | 'image' |
| 81 | ], |
| 82 | 'condition' => [ |
| 83 | 'adManager' => 'yes', |
| 84 | 'adSource' => 'image', |
| 85 | ], |
| 86 | 'ai' => $ai_condition, |
| 87 | ] |
| 88 | ); |
| 89 | $that->add_control( |
| 90 | 'adFileUrl2', |
| 91 | [ |
| 92 | 'type' => \Elementor\Controls_Manager::URL, |
| 93 | 'condition' => [ |
| 94 | 'adManager' => 'yes', |
| 95 | 'adSource' => 'url', |
| 96 | ], |
| 97 | 'ai' => $ai_condition, |
| 98 | ] |
| 99 | ); |
| 100 | |
| 101 | // For Ad Width TextControl |
| 102 | $that->add_control( |
| 103 | 'adWidth', |
| 104 | [ |
| 105 | 'label' => __('Ad Width', 'embedpress'), |
| 106 | 'type' => \Elementor\Controls_Manager::TEXT, |
| 107 | 'condition' => [ |
| 108 | 'adManager' => 'yes', |
| 109 | 'adSource' => 'image', |
| 110 | ], |
| 111 | 'default' => '300', |
| 112 | 'ai' => $ai_condition, |
| 113 | ] |
| 114 | ); |
| 115 | |
| 116 | // For Ad Height TextControl |
| 117 | $that->add_control( |
| 118 | 'adHeight', |
| 119 | [ |
| 120 | 'label' => __('Ad Height', 'embedpress'), |
| 121 | 'type' => \Elementor\Controls_Manager::TEXT, |
| 122 | 'condition' => [ |
| 123 | 'adManager' => 'yes', |
| 124 | 'adSource' => 'image', |
| 125 | ], |
| 126 | 'default' => '200', |
| 127 | 'ai' => $ai_condition, |
| 128 | ] |
| 129 | ); |
| 130 | |
| 131 | // For Ad X Position RangeControl |
| 132 | $that->add_control( |
| 133 | 'adXPosition', |
| 134 | [ |
| 135 | 'label' => __('Ad X Position(%)', 'embedpress'), |
| 136 | 'type' => \Elementor\Controls_Manager::NUMBER, |
| 137 | 'default' => 25, // Set the default value if needed |
| 138 | 'min' => 0, |
| 139 | 'max' => 100, |
| 140 | 'condition' => [ |
| 141 | 'adManager' => 'yes', |
| 142 | 'adSource' => 'image', |
| 143 | ], |
| 144 | ] |
| 145 | ); |
| 146 | |
| 147 | // For Ad Y Position RangeControl |
| 148 | $that->add_control( |
| 149 | 'adYPosition', |
| 150 | [ |
| 151 | 'label' => __('Ad Y Position(%)', 'embedpress'), |
| 152 | 'type' => \Elementor\Controls_Manager::NUMBER, |
| 153 | 'default' => 20, // Set the default value if needed |
| 154 | 'min' => 0, |
| 155 | 'max' => 100, |
| 156 | 'condition' => [ |
| 157 | 'adManager' => 'yes', |
| 158 | 'adSource' => 'image', |
| 159 | ], |
| 160 | ] |
| 161 | ); |
| 162 | |
| 163 | $that->add_control( |
| 164 | 'adUrl', |
| 165 | [ |
| 166 | 'label' => __('Ad URL', 'embedpress'), |
| 167 | 'type' => \Elementor\Controls_Manager::TEXT, |
| 168 | 'condition' => $ad_condition, |
| 169 | 'ai' => $ai_condition, |
| 170 | |
| 171 | ] |
| 172 | ); |
| 173 | |
| 174 | $that->add_control( |
| 175 | 'adStart', |
| 176 | [ |
| 177 | 'label' => __('Ad Start After (sec)', 'embedpress'), |
| 178 | 'type' => \Elementor\Controls_Manager::TEXT, |
| 179 | 'condition' => $ad_condition, |
| 180 | 'default' => '5', |
| 181 | 'ai' => $ai_condition, |
| 182 | |
| 183 | ] |
| 184 | ); |
| 185 | |
| 186 | $that->add_control( |
| 187 | 'adSkipButton', |
| 188 | [ |
| 189 | 'label' => __('Ad Skip Button', 'embedpress'), |
| 190 | 'type' => \Elementor\Controls_Manager::SWITCHER, |
| 191 | 'label_on' => __('Yes', 'embedpress'), |
| 192 | 'label_off' => __('No', 'embedpress'), |
| 193 | 'default' => 'yes', |
| 194 | 'condition' => $ad_condition |
| 195 | ] |
| 196 | ); |
| 197 | |
| 198 | $that->add_control( |
| 199 | 'adSkipButtonAfter', |
| 200 | [ |
| 201 | 'label' => __('Skip Button After (sec)', 'embedpress'), |
| 202 | 'type' => \Elementor\Controls_Manager::TEXT, |
| 203 | 'condition' => [ |
| 204 | 'adManager' => 'yes', |
| 205 | 'adSkipButton' => 'yes', |
| 206 | ], |
| 207 | 'ai' => $ai_condition, |
| 208 | 'default' => '5' |
| 209 | ] |
| 210 | ); |
| 211 | |
| 212 | $that->end_controls_section(); |
| 213 | |
| 214 | $that->start_controls_section( |
| 215 | 'embedpress_content_protection_settings', |
| 216 | [ |
| 217 | 'label' => esc_html__('EP Content Protection', 'embedpress'), |
| 218 | ] |
| 219 | ); |
| 220 | |
| 221 | $that->add_control( |
| 222 | 'embedpress' . $infix . 'lock_content', |
| 223 | [ |
| 224 | 'label' => sprintf(__('Enable Content Protection %s', 'embedpress'), $pro_text), |
| 225 | 'type' => Controls_Manager::SWITCHER, |
| 226 | 'label_block' => false, |
| 227 | 'return_value' => 'yes', |
| 228 | 'default' => '', |
| 229 | 'classes' => $pro_class, |
| 230 | ] |
| 231 | ); |
| 232 | |
| 233 | $that->add_control( |
| 234 | 'embedpress' . $infix . 'lock_content_password', |
| 235 | [ |
| 236 | 'label' => __('Set Password', 'embedpress'), |
| 237 | 'type' => Controls_Manager::TEXT, |
| 238 | 'default' => '', |
| 239 | 'placeholder' => '••••••', |
| 240 | 'label_block' => false, |
| 241 | 'condition' => [ |
| 242 | 'embedpress' . $infix . 'lock_content' => 'yes' |
| 243 | ] |
| 244 | ] |
| 245 | ); |
| 246 | |
| 247 | |
| 248 | $that->add_control( |
| 249 | 'embedpress' . $infix . 'lock_content_error_message', |
| 250 | [ |
| 251 | 'label' => __('Error Message', 'embedpress'), |
| 252 | 'type' => Controls_Manager::TEXTAREA, |
| 253 | 'default' => 'Oops, that wasn\'t the right password. Try again.', |
| 254 | 'placeholder' => __('Oops, that wasn\'t the right password. Try again.', 'embedpress'), |
| 255 | 'label_block' => true, |
| 256 | 'condition' => [ |
| 257 | 'embedpress' . $infix . 'lock_content' => 'yes' |
| 258 | ] |
| 259 | ] |
| 260 | ); |
| 261 | $that->add_control( |
| 262 | 'embedpress' . $infix . 'password_placeholder', |
| 263 | [ |
| 264 | 'label' => __('Placeholder', 'embedpress'), |
| 265 | 'type' => Controls_Manager::TEXT, |
| 266 | 'default' => 'Password', |
| 267 | 'placeholder' => __('Password', 'embedpress'), |
| 268 | 'label_block' => false, |
| 269 | 'condition' => [ |
| 270 | 'embedpress' . $infix . 'lock_content' => 'yes' |
| 271 | ] |
| 272 | ] |
| 273 | ); |
| 274 | $that->add_control( |
| 275 | 'embedpress' . $infix . 'submit_button_text', |
| 276 | [ |
| 277 | 'label' => __('Button Text', 'embedpress'), |
| 278 | 'type' => Controls_Manager::TEXT, |
| 279 | 'default' => 'Unlock', |
| 280 | 'placeholder' => __('Unlock', 'embedpress'), |
| 281 | 'label_block' => false, |
| 282 | 'condition' => [ |
| 283 | 'embedpress' . $infix . 'lock_content' => 'yes' |
| 284 | ] |
| 285 | ] |
| 286 | ); |
| 287 | $that->add_control( |
| 288 | 'embedpress' . $infix . 'submit_Unlocking_text', |
| 289 | [ |
| 290 | 'label' => __('Loader Text', 'embedpress'), |
| 291 | 'type' => Controls_Manager::TEXT, |
| 292 | 'default' => 'Unlocking...', |
| 293 | 'placeholder' => __('Unlocking...', 'embedpress'), |
| 294 | 'label_block' => false, |
| 295 | 'condition' => [ |
| 296 | 'embedpress' . $infix . 'lock_content' => 'yes' |
| 297 | ] |
| 298 | ] |
| 299 | ); |
| 300 | |
| 301 | $that->add_control( |
| 302 | 'embedpress' . $infix . 'lock_content_heading', |
| 303 | [ |
| 304 | 'label' => __('Header', 'embedpress'), |
| 305 | 'type' => Controls_Manager::TEXT, |
| 306 | 'default' => 'Content Locked', |
| 307 | 'placeholder' => __('Content Locked', 'embedpress'), |
| 308 | 'label_block' => false, |
| 309 | 'condition' => [ |
| 310 | 'embedpress' . $infix . 'lock_content' => 'yes' |
| 311 | ] |
| 312 | ] |
| 313 | ); |
| 314 | |
| 315 | $that->add_control( |
| 316 | 'embedpress' . $infix . 'lock_content_sub_heading', |
| 317 | [ |
| 318 | 'label' => __('Description', 'embedpress'), |
| 319 | 'type' => Controls_Manager::TEXTAREA, |
| 320 | 'default' => 'Content is locked and requires password to access it.', |
| 321 | 'placeholder' => __('Content is locked and requires password to access it.', 'embedpress'), |
| 322 | 'label_block' => true, |
| 323 | 'condition' => [ |
| 324 | 'embedpress' . $infix . 'lock_content' => 'yes' |
| 325 | ] |
| 326 | ] |
| 327 | ); |
| 328 | |
| 329 | |
| 330 | $that->add_control( |
| 331 | 'embedpress' . $infix . 'enable_footer_message', |
| 332 | [ |
| 333 | 'label' => __('Footer Text', 'embedpress'), |
| 334 | 'type' => Controls_Manager::SWITCHER, |
| 335 | 'label_block' => false, |
| 336 | 'return_value' => 'yes', |
| 337 | 'default' => '', |
| 338 | 'condition' => [ |
| 339 | 'embedpress' . $infix . 'lock_content' => 'yes' |
| 340 | ], |
| 341 | |
| 342 | ] |
| 343 | ); |
| 344 | |
| 345 | $that->add_control( |
| 346 | 'embedpress' . $infix . 'lock_content_footer_message', |
| 347 | [ |
| 348 | 'label' => __('Footer', 'embedpress'), |
| 349 | 'type' => Controls_Manager::TEXTAREA, |
| 350 | 'default' => 'In case you don\'t have the password, kindly reach out to content owner or administrator to request access.', |
| 351 | 'placeholder' => __('In case you don\'t have the password, kindly reach out to content owner or administrator to request access.', 'embedpress'), |
| 352 | 'label_block' => true, |
| 353 | 'condition' => [ |
| 354 | 'embedpress' . $infix . 'enable_footer_message' => 'yes', |
| 355 | 'embedpress' . $infix . 'lock_content' => 'yes' |
| 356 | ] |
| 357 | ] |
| 358 | ); |
| 359 | |
| 360 | $that->end_controls_section(); |
| 361 | |
| 362 | |
| 363 | |
| 364 | |
| 365 | $that->start_controls_section( |
| 366 | 'embedpress_content_share_settings', |
| 367 | [ |
| 368 | 'label' => esc_html__('EP Social Share', 'embedpress'), |
| 369 | ] |
| 370 | ); |
| 371 | |
| 372 | $that->add_control( |
| 373 | 'embedpress' . $infix . 'content_share', |
| 374 | [ |
| 375 | 'label' => __('Enable Social Share', 'embedpress'), |
| 376 | 'type' => Controls_Manager::SWITCHER, |
| 377 | 'label_block' => false, |
| 378 | 'return_value' => 'yes', |
| 379 | 'default' => '', |
| 380 | ] |
| 381 | ); |
| 382 | $that->add_control( |
| 383 | 'embedpress' . $infix . 'content_share_position', |
| 384 | [ |
| 385 | 'label' => __('Position', 'embedpress'), |
| 386 | 'type' => Controls_Manager::SELECT, |
| 387 | 'default' => 'right', |
| 388 | 'options' => [ |
| 389 | 'top' => __('Top', 'embedpress'), |
| 390 | 'right' => __('Right', 'embedpress'), |
| 391 | 'bottom' => __('Bottom', 'embedpress'), |
| 392 | 'left' => __('Left', 'embedpress'), |
| 393 | ], |
| 394 | 'condition' => [ |
| 395 | 'embedpress' . $infix . 'content_share' => 'yes' |
| 396 | ] |
| 397 | ] |
| 398 | ); |
| 399 | $that->add_control( |
| 400 | 'embedpress' . $infix . 'content_title', |
| 401 | [ |
| 402 | 'label' => __('Title', 'embedpress'), |
| 403 | 'type' => Controls_Manager::TEXT, |
| 404 | 'placeholder' => __('Enter share title', 'embedpress'), |
| 405 | 'condition' => [ |
| 406 | 'embedpress' . $infix . 'content_share' => 'yes' |
| 407 | ] |
| 408 | ] |
| 409 | ); |
| 410 | $that->add_control( |
| 411 | 'embedpress' . $infix . 'content_descripiton', |
| 412 | [ |
| 413 | 'label' => __('Description', 'embedpress'), |
| 414 | 'type' => Controls_Manager::TEXTAREA, |
| 415 | 'placeholder' => __('Enter share description', 'embedpress'), |
| 416 | 'condition' => [ |
| 417 | 'embedpress' . $infix . 'content_share' => 'yes' |
| 418 | ] |
| 419 | ] |
| 420 | ); |
| 421 | |
| 422 | $that->add_control( |
| 423 | 'embedpress' . $infix . 'content_share_custom_thumbnail', |
| 424 | [ |
| 425 | 'label' => esc_html__('Thumbnail', 'textdomain'), |
| 426 | 'type' => \Elementor\Controls_Manager::MEDIA, |
| 427 | 'default' => [ |
| 428 | 'url' => \Elementor\Utils::get_placeholder_image_src(), |
| 429 | ], |
| 430 | 'condition' => [ |
| 431 | 'embedpress' . $infix . 'content_share' => 'yes' |
| 432 | ] |
| 433 | ] |
| 434 | ); |
| 435 | $that->end_controls_section(); |
| 436 | } |
| 437 | } |
| 438 |