documents
4 years ago
dynamic-tags
1 year ago
query-control
2 years ago
settings
1 year ago
theme-builder
1 year ago
column.php
1 year ago
common.php
6 months ago
container.php
1 year ago
section.php
1 year ago
templates-types-manager.php
3 years ago
common.php
1086 lines
| 1 | <?php |
| 2 | namespace Auxin\Plugin\CoreElements\Elementor\Modules; |
| 3 | |
| 4 | use Elementor\Widget_Base; |
| 5 | use Elementor\Controls_Manager; |
| 6 | use Elementor\Group_Control_Background; |
| 7 | |
| 8 | |
| 9 | class Common { |
| 10 | |
| 11 | /** |
| 12 | * Instance of this class. |
| 13 | * |
| 14 | * @var object |
| 15 | */ |
| 16 | protected static $instance = null; |
| 17 | |
| 18 | |
| 19 | public function __construct(){ |
| 20 | |
| 21 | // Add new controls to advanced tab globally |
| 22 | add_action( "elementor/element/after_section_end", array( $this, 'add_position_controls_section' ), 10, 3 ); |
| 23 | |
| 24 | // Go pro notice for parallax options |
| 25 | add_action( "elementor/element/after_section_end", array( $this, 'add_parallax_go_pro_notice' ), 15, 3 ); |
| 26 | add_action( "elementor/element/after_section_end", array( $this, 'add_transition_controls_section'), 18, 3 ); |
| 27 | |
| 28 | add_action( "elementor/element/after_section_end", array( $this, 'add_extra_controls_section' ), 19, 3 ); |
| 29 | add_action( "elementor/element/after_section_end", array( $this, 'add_pseudo_background_controls' ), 20, 3 ); |
| 30 | add_action( "elementor/element/after_section_end", array( $this, 'add_custom_css_controls_section'), 25, 3 ); |
| 31 | |
| 32 | |
| 33 | // Renders attributes for all Elementor Elements |
| 34 | // add_action( 'elementor/frontend/widget/before_render' , array( $this, 'render_widget_attributes' ) ); |
| 35 | |
| 36 | // Render the custom CSS |
| 37 | if ( ! defined('ELEMENTOR_PRO_VERSION') ) { |
| 38 | add_action( 'elementor/element/parse_css', array( $this, 'add_post_css' ), 10, 2 ); |
| 39 | } |
| 40 | } |
| 41 | |
| 42 | /** |
| 43 | * Return an instance of this class. |
| 44 | * |
| 45 | * @return object A single instance of this class. |
| 46 | */ |
| 47 | public static function get_instance() { |
| 48 | // If the single instance hasn't been set, set it now. |
| 49 | if ( null == self::$instance ) { |
| 50 | self::$instance = new self; |
| 51 | } |
| 52 | |
| 53 | return self::$instance; |
| 54 | } |
| 55 | |
| 56 | /** |
| 57 | * Add custom css control to all elements |
| 58 | * |
| 59 | * @return void |
| 60 | */ |
| 61 | public function add_custom_css_controls_section( $widget, $section_id, $args ){ |
| 62 | |
| 63 | if( 'section_custom_css_pro' !== $section_id ){ |
| 64 | return; |
| 65 | } |
| 66 | |
| 67 | if( ! defined('ELEMENTOR_PRO_VERSION') ) { |
| 68 | |
| 69 | $widget->start_controls_section( |
| 70 | 'aux_core_common_custom_css_section', |
| 71 | array( |
| 72 | 'label' => __( 'Custom CSS', 'auxin-elements' ), |
| 73 | 'tab' => Controls_Manager::TAB_ADVANCED |
| 74 | ) |
| 75 | ); |
| 76 | |
| 77 | $widget->add_control( |
| 78 | 'custom_css', |
| 79 | array( |
| 80 | 'type' => Controls_Manager::CODE, |
| 81 | 'label' => __( 'Custom CSS', 'auxin-elements' ), |
| 82 | 'label_block' => true, |
| 83 | 'language' => 'css' |
| 84 | ) |
| 85 | ); |
| 86 | ob_start();?> |
| 87 | <pre> |
| 88 | Examples: |
| 89 | // To target main element |
| 90 | selector { color: red; } |
| 91 | // For child element |
| 92 | selector .child-element{ margin: 10px; } |
| 93 | </pre> |
| 94 | <?php |
| 95 | $example = ob_get_clean(); |
| 96 | |
| 97 | $widget->add_control( |
| 98 | 'custom_css_description', |
| 99 | array( |
| 100 | 'raw' => __( 'Use "selector" keyword to target wrapper element.', 'auxin-elements' ). $example, |
| 101 | 'type' => Controls_Manager::RAW_HTML, |
| 102 | 'content_classes' => 'elementor-descriptor', |
| 103 | 'separator' => 'none' |
| 104 | ) |
| 105 | ); |
| 106 | |
| 107 | $widget->end_controls_section(); |
| 108 | } |
| 109 | |
| 110 | } |
| 111 | |
| 112 | |
| 113 | |
| 114 | /** |
| 115 | * Add controls to advanced section for adding background image to pseudo elements |
| 116 | * |
| 117 | * @return void |
| 118 | */ |
| 119 | public function add_pseudo_background_controls( $widget, $section_id, $args ){ |
| 120 | |
| 121 | $target_sections = array('section_custom_css'); |
| 122 | |
| 123 | if( ! defined('ELEMENTOR_PRO_VERSION') ) { |
| 124 | $target_sections[] = 'section_custom_css_pro'; |
| 125 | } |
| 126 | |
| 127 | if( ! in_array( $section_id, $target_sections ) ){ |
| 128 | return; |
| 129 | } |
| 130 | |
| 131 | if( in_array( $widget->get_name(), array('section') ) ){ |
| 132 | return; |
| 133 | } |
| 134 | |
| 135 | // Adds general background options to pseudo elements |
| 136 | // --------------------------------------------------------------------- |
| 137 | $widget->start_controls_section( |
| 138 | 'aux_core_common_background_pseudo', |
| 139 | array( |
| 140 | 'label' => __( 'Pseudo Background (developers)', 'auxin-elements' ), |
| 141 | 'tab' => Controls_Manager::TAB_ADVANCED |
| 142 | ) |
| 143 | ); |
| 144 | |
| 145 | $widget->add_control( |
| 146 | 'background_pseudo_description', |
| 147 | array( |
| 148 | 'raw' => __( 'Adds background to pseudo elements like ::before and ::after selectors. (developers only)', 'auxin-elements' ), |
| 149 | 'type' => Controls_Manager::RAW_HTML, |
| 150 | 'content_classes' => 'elementor-descriptor' |
| 151 | ) |
| 152 | ); |
| 153 | |
| 154 | $widget->add_control( |
| 155 | 'background_pseudo_before_heading', |
| 156 | array( |
| 157 | 'label' => __( 'Background ::before', 'auxin-elements' ), |
| 158 | 'type' => Controls_Manager::HEADING, |
| 159 | 'separator' => 'before' |
| 160 | ) |
| 161 | ); |
| 162 | |
| 163 | $widget->add_group_control( |
| 164 | Group_Control_Background::get_type(), |
| 165 | array( |
| 166 | 'name' => 'background_pseudo_before', |
| 167 | 'types' => array( 'classic', 'gradient'), |
| 168 | 'selector' => '{{WRAPPER}}:before' |
| 169 | ) |
| 170 | ); |
| 171 | |
| 172 | $widget->add_control( |
| 173 | 'background_pseudo_after_heading', |
| 174 | array( |
| 175 | 'label' => __( 'Background ::after', 'auxin-elements' ), |
| 176 | 'type' => Controls_Manager::HEADING, |
| 177 | 'separator' => 'before' |
| 178 | ) |
| 179 | ); |
| 180 | |
| 181 | $widget->add_group_control( |
| 182 | Group_Control_Background::get_type(), |
| 183 | array( |
| 184 | 'name' => 'background_pseudo_after', |
| 185 | 'types' => array( 'classic', 'gradient'), |
| 186 | 'selector' => '{{WRAPPER}}:after' |
| 187 | ) |
| 188 | ); |
| 189 | |
| 190 | $widget->end_controls_section(); |
| 191 | } |
| 192 | |
| 193 | |
| 194 | /** |
| 195 | * Add parallax pro notice to advanced section |
| 196 | * |
| 197 | * @return void |
| 198 | */ |
| 199 | public function add_parallax_go_pro_notice( $widget, $section_id, $args ){ |
| 200 | |
| 201 | if( defined('THEME_PRO') && THEME_PRO ){ |
| 202 | return; |
| 203 | } |
| 204 | |
| 205 | if( in_array( $widget->get_name(), array('section') ) ){ |
| 206 | return; |
| 207 | } |
| 208 | |
| 209 | // Anchor element sections |
| 210 | $target_sections = array('section_custom_css'); |
| 211 | |
| 212 | if( ! defined('ELEMENTOR_PRO_VERSION') ) { |
| 213 | $target_sections[] = 'section_custom_css_pro'; |
| 214 | } |
| 215 | |
| 216 | if( ! in_array( $section_id, $target_sections ) ){ |
| 217 | return; |
| 218 | } |
| 219 | |
| 220 | $widget->start_controls_section( |
| 221 | 'aux_pro_common_parallax_notice', |
| 222 | array( |
| 223 | 'label' => __( 'Parallax', 'auxin-elements' ), |
| 224 | 'tab' => Controls_Manager::TAB_ADVANCED |
| 225 | ) |
| 226 | ); |
| 227 | |
| 228 | $widget->add_control( |
| 229 | 'parallax_go_pro_notice', |
| 230 | array( |
| 231 | 'type' => Controls_Manager::RAW_HTML, |
| 232 | 'content_classes' => 'elementor-descriptor', |
| 233 | 'raw' => '<div class="auxin-elementor-panel-notice">' . |
| 234 | '<i class="auxin-elementor-upgrade-notice-icon eicon-favorite" aria-hidden="true"></i> |
| 235 | <div class="auxin-elementor-panel-notice-title">' . |
| 236 | __( 'Parallax Effect', 'auxin-elements' ) . |
| 237 | '</div> |
| 238 | <div class="auxin-elementor-panel-notice-message">' . |
| 239 | __( 'Parallax options let you add parallax effect to any widget.', 'auxin-elements' ) . |
| 240 | '</div> |
| 241 | <div class="auxin-elementor-panel-notice-message">' . |
| 242 | __( 'This feature is only available on Phlox Pro.', 'auxin-elements' ) . |
| 243 | '</div> |
| 244 | <a class="auxin-elementor-panel-notice-link elementor-button elementor-button-default auxin-elementor-go-pro-link" href="http://phlox.pro/go-pro/?utm_source=elementor-panel&utm_medium=phlox-free&utm_campaign=phlox-go-pro&utm_content=parallax" target="_blank">' . |
| 245 | __( 'Get Phlox Pro', 'auxin-elements' ) . |
| 246 | '</a> |
| 247 | </div>' |
| 248 | ) |
| 249 | ); |
| 250 | |
| 251 | $widget->end_controls_section(); |
| 252 | } |
| 253 | |
| 254 | |
| 255 | /** |
| 256 | * Add transition controls to advanced section |
| 257 | * |
| 258 | * @return void |
| 259 | */ |
| 260 | public function add_transition_controls_section( $widget, $section_id, $args ){ |
| 261 | |
| 262 | // Anchor element sections |
| 263 | $target_sections = array('section_custom_css'); |
| 264 | |
| 265 | if( ! defined('ELEMENTOR_PRO_VERSION') ) { |
| 266 | $target_sections[] = 'section_custom_css_pro'; |
| 267 | } |
| 268 | |
| 269 | if( ! in_array( $section_id, $target_sections ) ){ |
| 270 | return; |
| 271 | } |
| 272 | |
| 273 | // Adds transition options to all elements |
| 274 | // --------------------------------------------------------------------- |
| 275 | $widget->start_controls_section( |
| 276 | 'aux_core_common_inview_transition', |
| 277 | array( |
| 278 | 'label' => __( 'Entrance Animation', 'auxin-elements' ), |
| 279 | 'tab' => Controls_Manager::TAB_ADVANCED |
| 280 | ) |
| 281 | ); |
| 282 | |
| 283 | $widget->add_control( |
| 284 | 'aux_animation_name', |
| 285 | array( |
| 286 | 'label' => __( 'Animation', 'auxin-elements' ), |
| 287 | 'type' => Controls_Manager::SELECT, |
| 288 | 'options' => array( |
| 289 | '' => 'None', |
| 290 | |
| 291 | 'aux-fade-in' => 'Fade In', |
| 292 | 'aux-fade-in-down' => 'Fade In Down', |
| 293 | 'aux-fade-in-down-1' => 'Fade In Down 1', |
| 294 | 'aux-fade-in-down-2' => 'Fade In Down 2', |
| 295 | 'aux-fade-in-up' => 'Fade In Up', |
| 296 | 'aux-fade-in-up-1' => 'Fade In Up 1', |
| 297 | 'aux-fade-in-up-2' => 'Fade In Up 2', |
| 298 | 'aux-fade-in-left' => 'Fade In Left', |
| 299 | 'aux-fade-in-left-1' => 'Fade In Left 1', |
| 300 | 'aux-fade-in-left-2' => 'Fade In Left 2', |
| 301 | 'aux-fade-in-right' => 'Fade In Right', |
| 302 | 'aux-fade-in-right-1' => 'Fade In Right 1', |
| 303 | 'aux-fade-in-right-2' => 'Fade In Right 2', |
| 304 | 'aux-fade-in-custom' => 'Fade In - Custom', |
| 305 | |
| 306 | // Slide Animation |
| 307 | 'aux-slide-from-right' => 'Slide From Right', |
| 308 | 'aux-slide-from-left' => 'Slide From Left', |
| 309 | 'aux-slide-from-top' => 'Slide From Top', |
| 310 | 'aux-slide-from-bot' => 'Slide From Bottom', |
| 311 | |
| 312 | // Mask Animation |
| 313 | 'aux-mask-from-top' => 'Mask From Top', |
| 314 | 'aux-mask-from-bot' => 'Mask From Bottom', |
| 315 | 'aux-mask-from-left' => 'Mask From Left', |
| 316 | 'aux-mask-from-right' => 'Mask From Right', |
| 317 | |
| 318 | 'aux-rotate-in' => 'Rotate In', |
| 319 | 'aux-rotate-in-down-left' => 'Rotate In Down Left', |
| 320 | 'aux-rotate-in-down-left-1' => 'Rotate In Down Left 1', |
| 321 | 'aux-rotate-in-down-left-2' => 'Rotate In Down Left 2', |
| 322 | 'aux-rotate-in-down-right' => 'Rotate In Down Right', |
| 323 | 'aux-rotate-in-down-right-1' => 'Rotate In Down Right 1', |
| 324 | 'aux-rotate-in-down-right-2' => 'Rotate In Down Right 2', |
| 325 | 'aux-rotate-in-up-left' => 'Rotate In Up Left', |
| 326 | 'aux-rotate-in-up-left-1' => 'Rotate In Up Left 1', |
| 327 | 'aux-rotate-in-up-left-2' => 'Rotate In Up Left 2', |
| 328 | 'aux-rotate-in-up-right' => 'Rotate In Up Right', |
| 329 | 'aux-rotate-in-up-right-1' => 'Rotate In Up Right 1', |
| 330 | 'aux-rotate-in-up-right-2' => 'Rotate In Up Right 2', |
| 331 | 'aux-rotate-custom' => 'Rotate In - Custom', |
| 332 | |
| 333 | 'aux-zoom-in' => 'Zoom In', |
| 334 | 'aux-zoom-in-1' => 'Zoom In 1', |
| 335 | 'aux-zoom-in-2' => 'Zoom In 2', |
| 336 | 'aux-zoom-in-3' => 'Zoom In 3', |
| 337 | |
| 338 | 'aux-scale-up' => 'Scale Up', |
| 339 | 'aux-scale-up-1' => 'Scale Up 1', |
| 340 | 'aux-scale-up-2' => 'Scale Up 2', |
| 341 | |
| 342 | 'aux-scale-down' => 'Scale Down', |
| 343 | 'aux-scale-down-1' => 'Scale Down 1', |
| 344 | 'aux-scale-down-2' => 'Scale Down 2', |
| 345 | 'aux-scale-custom' => 'Scale - Custom', |
| 346 | |
| 347 | 'aux-flip-in-down' => 'Flip In Down', |
| 348 | 'aux-flip-in-down-1' => 'Flip In Down 1', |
| 349 | 'aux-flip-in-down-2' => 'Flip In Down 2', |
| 350 | 'aux-flip-in-up' => 'Flip In Up', |
| 351 | 'aux-flip-in-up-1' => 'Flip In Up 1', |
| 352 | 'aux-flip-in-up-2' => 'Flip In Up 2', |
| 353 | 'aux-flip-in-left' => 'Flip In Left', |
| 354 | 'aux-flip-in-left-1' => 'Flip In Left 1', |
| 355 | 'aux-flip-in-left-2' => 'Flip In Left 2', |
| 356 | 'aux-flip-in-left-3' => 'Flip In Left 3', |
| 357 | 'aux-flip-in-right' => 'Flip In Right', |
| 358 | 'aux-flip-in-right-1' => 'Flip In Right 1', |
| 359 | 'aux-flip-in-right-2' => 'Flip In Right 2', |
| 360 | 'aux-flip-in-right-3' => 'Flip In Right 3', |
| 361 | |
| 362 | 'aux-pulse' => 'Pulse In 1' , |
| 363 | 'aux-pulse1' => 'Pulse In 2', |
| 364 | 'aux-pulse2' => 'Pulse In 3', |
| 365 | 'aux-pulse3' => 'Pulse In 4', |
| 366 | 'aux-pulse4' => 'Pulse In 5', |
| 367 | |
| 368 | 'aux-pulse-out-1' => 'Pulse Out 1' , |
| 369 | 'aux-pulse-out-2' => 'Pulse Out 2' , |
| 370 | 'aux-pulse-out-3' => 'Pulse Out 3' , |
| 371 | 'aux-pulse-out-4' => 'Pulse Out 4' , |
| 372 | |
| 373 | // Specials |
| 374 | 'aux-shake' => 'Shake', |
| 375 | 'aux-bounce-in' => 'Bounce In', |
| 376 | 'aux-jack-in-box' => 'Jack In the Box' |
| 377 | ), |
| 378 | 'default' => '', |
| 379 | 'prefix_class' => 'aux-appear-watch-animation ', |
| 380 | 'label_block' => false |
| 381 | ) |
| 382 | ); |
| 383 | |
| 384 | $widget->add_control( |
| 385 | 'aux_fade_in_custom_x', |
| 386 | array( |
| 387 | 'label' => __( 'Fade In For X', 'auxin-elements' ) . ' (px)', |
| 388 | 'type' => Controls_Manager::NUMBER, |
| 389 | 'default' => '', |
| 390 | 'min' => -500, |
| 391 | 'max' => 500, |
| 392 | 'step' => 25, |
| 393 | 'default' => 50, |
| 394 | 'selectors' => array( |
| 395 | '{{WRAPPER}}.aux-appear-watch-animation' => '--aux-anim-fade-in-from-x:{{SIZE}}px;' |
| 396 | ), |
| 397 | 'condition' => array( |
| 398 | 'aux_animation_name' => 'aux-fade-in-custom' |
| 399 | ), |
| 400 | 'render_type' => 'template' |
| 401 | ) |
| 402 | ); |
| 403 | |
| 404 | $widget->add_control( |
| 405 | 'aux_fade_in_custom_y', |
| 406 | array( |
| 407 | 'label' => __( 'Fade In For Y', 'auxin-elements' ) . ' (px)', |
| 408 | 'type' => Controls_Manager::NUMBER, |
| 409 | 'default' => '', |
| 410 | 'min' => -500, |
| 411 | 'max' => 500, |
| 412 | 'step' => 25, |
| 413 | 'default' => 50, |
| 414 | 'selectors' => array( |
| 415 | '{{WRAPPER}}.aux-appear-watch-animation' => '--aux-anim-fade-in-from-y:{{SIZE}}px;' |
| 416 | ), |
| 417 | 'condition' => array( |
| 418 | 'aux_animation_name' => 'aux-fade-in-custom' |
| 419 | ), |
| 420 | 'render_type' => 'template' |
| 421 | ) |
| 422 | ); |
| 423 | |
| 424 | $widget->add_control( |
| 425 | 'aux_scale_custom', |
| 426 | array( |
| 427 | 'label' => __( 'Scale', 'auxin-elements' ) . '', |
| 428 | 'type' => Controls_Manager::NUMBER, |
| 429 | 'default' => '', |
| 430 | 'min' => 0.1, |
| 431 | 'max' => 3, |
| 432 | 'step' => 0.1, |
| 433 | 'selectors' => array( |
| 434 | '{{WRAPPER}}.aux-appear-watch-animation' => '--aux-scale-custom:{{SIZE}};' |
| 435 | ), |
| 436 | 'condition' => array( |
| 437 | 'aux_animation_name' => 'aux-scale-custom' |
| 438 | ), |
| 439 | 'render_type' => 'template' |
| 440 | ) |
| 441 | ); |
| 442 | |
| 443 | $widget->add_control( |
| 444 | 'aux_rotate_custom_deg', |
| 445 | array( |
| 446 | 'label' => __( 'Rotate Degree', 'auxin-elements' ) . '', |
| 447 | 'type' => Controls_Manager::NUMBER, |
| 448 | 'default' => '', |
| 449 | 'min' => -360, |
| 450 | 'max' => 360, |
| 451 | 'step' => 10, |
| 452 | 'selectors' => array( |
| 453 | '{{WRAPPER}}.aux-appear-watch-animation' => '--aux-anim-rotate-deg:{{SIZE}}deg;' |
| 454 | ), |
| 455 | 'condition' => array( |
| 456 | 'aux_animation_name' => 'aux-rotate-custom' |
| 457 | ), |
| 458 | 'render_type' => 'template' |
| 459 | ) |
| 460 | ); |
| 461 | |
| 462 | $widget->add_control( |
| 463 | 'aux_rotate_custom_origin', |
| 464 | array( |
| 465 | 'label' => __( 'Rotate Origin', 'auxin-elements' ) . '', |
| 466 | 'type' => Controls_Manager::SELECT, |
| 467 | 'default' => 'left bottom', |
| 468 | 'options' => [ |
| 469 | 'left bottom' => __( 'Left Bottom', 'auxin-elements' ), |
| 470 | 'right bottom' => __( 'Right Bottom', 'auxin-elements' ), |
| 471 | ], |
| 472 | 'selectors' => array( |
| 473 | '{{WRAPPER}}.aux-appear-watch-animation' => '--aux-anim-rotate-origin:{{VALUE}};' |
| 474 | ), |
| 475 | 'condition' => array( |
| 476 | 'aux_animation_name' => 'aux-rotate-custom' |
| 477 | ), |
| 478 | 'render_type' => 'template' |
| 479 | ) |
| 480 | ); |
| 481 | |
| 482 | $widget->add_control( |
| 483 | 'aux_animation_duration', |
| 484 | array( |
| 485 | 'label' => __( 'Duration', 'auxin-elements' ) . ' (ms)', |
| 486 | 'type' => Controls_Manager::NUMBER, |
| 487 | 'default' => '', |
| 488 | 'min' => 0, |
| 489 | 'step' => 100, |
| 490 | 'selectors' => array( |
| 491 | '{{WRAPPER}}' => 'animation-duration:{{SIZE}}ms;' |
| 492 | ), |
| 493 | 'condition' => array( |
| 494 | 'aux_animation_name!' => '' |
| 495 | ), |
| 496 | 'render_type' => 'template' |
| 497 | ) |
| 498 | ); |
| 499 | |
| 500 | $widget->add_control( |
| 501 | 'aux_animation_delay', |
| 502 | array( |
| 503 | 'label' => __( 'Delay', 'auxin-elements' ) . ' (ms)', |
| 504 | 'type' => Controls_Manager::NUMBER, |
| 505 | 'default' => '', |
| 506 | 'min' => 0, |
| 507 | 'step' => 100, |
| 508 | 'selectors' => array( |
| 509 | '{{WRAPPER}}' => 'animation-delay:{{SIZE}}ms;' |
| 510 | ), |
| 511 | 'condition' => array( |
| 512 | 'aux_animation_name!' => '' |
| 513 | ) |
| 514 | ) |
| 515 | ); |
| 516 | |
| 517 | $widget->add_control( |
| 518 | 'aux_animation_easing', |
| 519 | array( |
| 520 | 'label' => __( 'Easing', 'auxin-elements' ), |
| 521 | 'type' => Controls_Manager::SELECT, |
| 522 | 'options' => array( |
| 523 | '' => 'Default', |
| 524 | 'initial' => 'Initial', |
| 525 | |
| 526 | 'linear' => 'Linear', |
| 527 | 'ease-out' => 'Ease Out', |
| 528 | '0.19,1,0.22,1' => 'Ease In Out', |
| 529 | |
| 530 | '0.47,0,0.745,0.715' => 'Sine In', |
| 531 | '0.39,0.575,0.565,1' => 'Sine Out', |
| 532 | '0.445,0.05,0.55,0.95' => 'Sine In Out', |
| 533 | |
| 534 | '0.55,0.085,0.68,0.53' => 'Quad In', |
| 535 | '0.25,0.46,0.45,0.94' => 'Quad Out', |
| 536 | '0.455,0.03,0.515,0.955' => 'Quad In Out', |
| 537 | |
| 538 | '0.55,0.055,0.675,0.19' => 'Cubic In', |
| 539 | '0.215,0.61,0.355,1' => 'Cubic Out', |
| 540 | '0.645,0.045,0.355,1' => 'Cubic In Out', |
| 541 | |
| 542 | '0.895,0.03,0.685,0.22' => 'Quart In', |
| 543 | '0.165,0.84,0.44,1' => 'Quart Out', |
| 544 | '0.77,0,0.175,1' => 'Quart In Out', |
| 545 | |
| 546 | '0.895,0.03,0.685,0.22' => 'Quint In', |
| 547 | '0.895,0.03,0.685,0.22' => 'Quint Out', |
| 548 | '0.895,0.03,0.685,0.22' => 'Quint In Out', |
| 549 | |
| 550 | '0.95,0.05,0.795,0.035' => 'Expo In', |
| 551 | '0.19,1,0.22,1' => 'Expo Out', |
| 552 | '1,0,0,1' => 'Expo In Out', |
| 553 | |
| 554 | '0.6,0.04,0.98,0.335' => 'Circ In', |
| 555 | '0.075,0.82,0.165,1' => 'Circ Out', |
| 556 | '0.785,0.135,0.15,0.86' => 'Circ In Out', |
| 557 | |
| 558 | '0.6,-0.28,0.735,0.045' => 'Back In', |
| 559 | '0.175,0.885,0.32,1.275' => 'Back Out', |
| 560 | '0.68,-0.55,0.265,1.55' => 'Back In Out' |
| 561 | ), |
| 562 | 'selectors' => array( |
| 563 | '{{WRAPPER}}' => 'animation-timing-function:cubic-bezier({{VALUE}});' |
| 564 | ), |
| 565 | 'condition' => array( |
| 566 | 'aux_animation_name!' => '' |
| 567 | ), |
| 568 | 'default' => '', |
| 569 | 'return_value' => '' |
| 570 | ) |
| 571 | ); |
| 572 | |
| 573 | $widget->add_control( |
| 574 | 'aux_animation_count', |
| 575 | array( |
| 576 | 'label' => __( 'Repeat Count', 'auxin-elements' ), |
| 577 | 'type' => Controls_Manager::SELECT, |
| 578 | 'options' => array( |
| 579 | '' => __( 'Default', 'auxin-elements' ), |
| 580 | '1' => '1', |
| 581 | '2' => '2', |
| 582 | '3' => '3', |
| 583 | '4' => '4', |
| 584 | '5' => '5', |
| 585 | 'infinite' => __( 'Infinite', 'auxin-elements' ) |
| 586 | ), |
| 587 | 'selectors' => array( |
| 588 | '{{WRAPPER}}' => 'animation-iteration-count:{{VALUE}};opacity:1;' // opacity is required to prevent flick between repetitions |
| 589 | ), |
| 590 | 'condition' => array( |
| 591 | 'aux_animation_name!' => '' |
| 592 | ), |
| 593 | 'default' => '' |
| 594 | ) |
| 595 | ); |
| 596 | |
| 597 | $widget->end_controls_section(); |
| 598 | } |
| 599 | |
| 600 | /** |
| 601 | * Add extra controls for positioning to advanced section |
| 602 | * |
| 603 | * @return void |
| 604 | */ |
| 605 | public function add_position_controls_section( $widget, $section_id, $args ){ |
| 606 | |
| 607 | // Anchor element sections |
| 608 | $target_sections = array('section_custom_css'); |
| 609 | |
| 610 | if( ! defined('ELEMENTOR_PRO_VERSION') ) { |
| 611 | $target_sections[] = 'section_custom_css_pro'; |
| 612 | } |
| 613 | |
| 614 | if( ! in_array( $section_id, $target_sections ) ){ |
| 615 | return; |
| 616 | } |
| 617 | |
| 618 | // Adds general positioning options |
| 619 | // --------------------------------------------------------------------- |
| 620 | $widget->start_controls_section( |
| 621 | 'aux_core_common_position', |
| 622 | array( |
| 623 | 'label' => __( 'Positioning', 'auxin-elements' ), |
| 624 | 'tab' => Controls_Manager::TAB_ADVANCED |
| 625 | ) |
| 626 | ); |
| 627 | |
| 628 | $widget->add_responsive_control( |
| 629 | 'aux_position_type', |
| 630 | array( |
| 631 | 'label' => __( 'Position Type', 'auxin-elements' ), |
| 632 | 'label_block' => true, |
| 633 | 'type' => Controls_Manager::SELECT, |
| 634 | 'options' => array( |
| 635 | '' => __( 'Default', 'auxin-elements' ), |
| 636 | 'static' => __( 'Static', 'auxin-elements' ), |
| 637 | 'relative' => __( 'Relative', 'auxin-elements' ), |
| 638 | 'absolute' => __( 'Absolute', 'auxin-elements' ) |
| 639 | ), |
| 640 | 'default' => '', |
| 641 | 'selectors' => array( |
| 642 | '{{WRAPPER}}' => 'position:{{VALUE}};', |
| 643 | ) |
| 644 | ) |
| 645 | ); |
| 646 | |
| 647 | $widget->add_responsive_control( |
| 648 | 'aux_position_top', |
| 649 | array( |
| 650 | 'label' => __('Top','auxin-elements' ), |
| 651 | 'type' => Controls_Manager::SLIDER, |
| 652 | 'size_units' => array('px', 'em', '%'), |
| 653 | 'range' => array( |
| 654 | 'px' => array( |
| 655 | 'min' => -2000, |
| 656 | 'max' => 2000, |
| 657 | 'step' => 1 |
| 658 | ), |
| 659 | '%' => array( |
| 660 | 'min' => -100, |
| 661 | 'max' => 100, |
| 662 | 'step' => 1 |
| 663 | ), |
| 664 | 'em' => array( |
| 665 | 'min' => -150, |
| 666 | 'max' => 150, |
| 667 | 'step' => 1 |
| 668 | ) |
| 669 | ), |
| 670 | 'selectors' => array( |
| 671 | '{{WRAPPER}}' => 'top:{{SIZE}}{{UNIT}};' |
| 672 | ), |
| 673 | 'condition' => array( |
| 674 | 'aux_position_type' => array('relative', 'absolute') |
| 675 | ) |
| 676 | ) |
| 677 | ); |
| 678 | |
| 679 | $widget->add_responsive_control( |
| 680 | 'aux_position_right', |
| 681 | array( |
| 682 | 'label' => __('Right','auxin-elements' ), |
| 683 | 'type' => Controls_Manager::SLIDER, |
| 684 | 'size_units' => array('px', 'em', '%'), |
| 685 | 'range' => array( |
| 686 | 'px' => array( |
| 687 | 'min' => -2000, |
| 688 | 'max' => 2000, |
| 689 | 'step' => 1 |
| 690 | ), |
| 691 | '%' => array( |
| 692 | 'min' => -100, |
| 693 | 'max' => 100, |
| 694 | 'step' => 1 |
| 695 | ), |
| 696 | 'em' => array( |
| 697 | 'min' => -150, |
| 698 | 'max' => 150, |
| 699 | 'step' => 1 |
| 700 | ) |
| 701 | ), |
| 702 | 'selectors' => array( |
| 703 | '{{WRAPPER}}' => 'right:{{SIZE}}{{UNIT}};' |
| 704 | ), |
| 705 | 'condition' => array( |
| 706 | 'aux_position_type' => array('relative', 'absolute') |
| 707 | ), |
| 708 | 'return_value' => '' |
| 709 | ) |
| 710 | ); |
| 711 | |
| 712 | $widget->add_responsive_control( |
| 713 | 'aux_position_bottom', |
| 714 | array( |
| 715 | 'label' => __('Bottom','auxin-elements' ), |
| 716 | 'type' => Controls_Manager::SLIDER, |
| 717 | 'size_units' => array('px', 'em', '%'), |
| 718 | 'range' => array( |
| 719 | 'px' => array( |
| 720 | 'min' => -2000, |
| 721 | 'max' => 2000, |
| 722 | 'step' => 1 |
| 723 | ), |
| 724 | '%' => array( |
| 725 | 'min' => -100, |
| 726 | 'max' => 100, |
| 727 | 'step' => 1 |
| 728 | ), |
| 729 | 'em' => array( |
| 730 | 'min' => -150, |
| 731 | 'max' => 150, |
| 732 | 'step' => 1 |
| 733 | ) |
| 734 | ), |
| 735 | 'selectors' => array( |
| 736 | '{{WRAPPER}}' => 'bottom:{{SIZE}}{{UNIT}};' |
| 737 | ), |
| 738 | 'condition' => array( |
| 739 | 'aux_position_type' => array('relative', 'absolute') |
| 740 | ) |
| 741 | ) |
| 742 | ); |
| 743 | |
| 744 | $widget->add_responsive_control( |
| 745 | 'aux_position_left', |
| 746 | array( |
| 747 | 'label' => __('Left','auxin-elements' ), |
| 748 | 'type' => Controls_Manager::SLIDER, |
| 749 | 'size_units' => array('px', 'em', '%'), |
| 750 | 'range' => array( |
| 751 | 'px' => array( |
| 752 | 'min' => -2000, |
| 753 | 'max' => 2000, |
| 754 | 'step' => 1 |
| 755 | ), |
| 756 | '%' => array( |
| 757 | 'min' => -100, |
| 758 | 'max' => 100, |
| 759 | 'step' => 1 |
| 760 | ), |
| 761 | 'em' => array( |
| 762 | 'min' => -150, |
| 763 | 'max' => 150, |
| 764 | 'step' => 1 |
| 765 | ) |
| 766 | ), |
| 767 | 'selectors' => array( |
| 768 | '{{WRAPPER}}' => 'left:{{SIZE}}{{UNIT}};' |
| 769 | ), |
| 770 | 'condition' => array( |
| 771 | 'aux_position_type' => array('relative', 'absolute') |
| 772 | ) |
| 773 | ) |
| 774 | ); |
| 775 | |
| 776 | $widget->add_responsive_control( |
| 777 | 'aux_position_from_center', |
| 778 | array( |
| 779 | 'label' => __('From Center','auxin-elements' ), |
| 780 | 'description'=> __('Please avoid using "From Center" and "Left" options at the same time.','auxin-elements' ), |
| 781 | 'type' => Controls_Manager::SLIDER, |
| 782 | 'size_units' => array('px', 'em', '%'), |
| 783 | 'range' => array( |
| 784 | 'px' => array( |
| 785 | 'min' => -1000, |
| 786 | 'max' => 1000, |
| 787 | 'step' => 1 |
| 788 | ), |
| 789 | '%' => array( |
| 790 | 'min' => -100, |
| 791 | 'max' => 100, |
| 792 | 'step' => 1 |
| 793 | ), |
| 794 | 'em' => array( |
| 795 | 'min' => -150, |
| 796 | 'max' => 150, |
| 797 | 'step' => 1 |
| 798 | ) |
| 799 | ), |
| 800 | 'selectors' => array( |
| 801 | '{{WRAPPER}}' => 'left:calc( 50% + {{SIZE}}{{UNIT}} );' |
| 802 | ), |
| 803 | 'condition' => array( |
| 804 | 'aux_position_type' => array('relative', 'absolute') |
| 805 | ) |
| 806 | ) |
| 807 | ); |
| 808 | |
| 809 | $widget->end_controls_section(); |
| 810 | } |
| 811 | |
| 812 | |
| 813 | /** |
| 814 | * Add extra options to advanced section |
| 815 | * |
| 816 | * @return void |
| 817 | */ |
| 818 | public function add_extra_controls_section( $widget, $section_id, $args ){ |
| 819 | |
| 820 | // Anchor element sections |
| 821 | $target_sections = array('section_custom_css'); |
| 822 | |
| 823 | if( ! defined('ELEMENTOR_PRO_VERSION') ) { |
| 824 | $target_sections[] = 'section_custom_css_pro'; |
| 825 | } |
| 826 | |
| 827 | if( ! in_array( $section_id, $target_sections ) ){ |
| 828 | return; |
| 829 | } |
| 830 | |
| 831 | // Adds extra options |
| 832 | // --------------------------------------------------------------------- |
| 833 | $widget->start_controls_section( |
| 834 | 'aux_core_general_extra', |
| 835 | array( |
| 836 | 'label' => __( 'Dimensions (extra)', 'auxin-elements' ), |
| 837 | 'tab' => Controls_Manager::TAB_ADVANCED |
| 838 | ) |
| 839 | ); |
| 840 | |
| 841 | $widget->add_responsive_control( |
| 842 | 'aux_max_width', |
| 843 | [ |
| 844 | 'label' => __('Max Width','auxin-elements' ), |
| 845 | 'type' => Controls_Manager::SLIDER, |
| 846 | 'size_units' => ['px', 'em', '%', 'vw'], |
| 847 | 'range' => [ |
| 848 | 'px' => [ |
| 849 | 'min' => 0, |
| 850 | 'step' => 1 |
| 851 | ], |
| 852 | '%' => [ |
| 853 | 'min' => 0, |
| 854 | 'max' => 100, |
| 855 | 'step' => 1 |
| 856 | ], |
| 857 | 'em' => [ |
| 858 | 'min' => 0, |
| 859 | 'step' => 1 |
| 860 | ], |
| 861 | 'vw' => [ |
| 862 | 'min' => 0, |
| 863 | 'max' => 100, |
| 864 | 'step' => 1 |
| 865 | ] |
| 866 | ], |
| 867 | 'selectors' => [ |
| 868 | '{{WRAPPER}}' => 'max-width:{{SIZE}}{{UNIT}};' |
| 869 | ] |
| 870 | ] |
| 871 | ); |
| 872 | |
| 873 | $widget->add_responsive_control( |
| 874 | 'aux_max_height', |
| 875 | [ |
| 876 | 'label' => __('Max Height','auxin-elements' ), |
| 877 | 'type' => Controls_Manager::SLIDER, |
| 878 | 'size_units' => ['px', 'em', '%', 'vh'], |
| 879 | 'range' => [ |
| 880 | 'px' => [ |
| 881 | 'min' => 0, |
| 882 | 'step' => 1 |
| 883 | ], |
| 884 | '%' => [ |
| 885 | 'min' => 0, |
| 886 | 'max' => 100, |
| 887 | 'step' => 1 |
| 888 | ], |
| 889 | 'em' => [ |
| 890 | 'min' => 0, |
| 891 | 'step' => 1 |
| 892 | ], |
| 893 | 'vh' => [ |
| 894 | 'min' => 0, |
| 895 | 'max' => 100, |
| 896 | 'step' => 1 |
| 897 | ] |
| 898 | ], |
| 899 | 'selectors' => [ |
| 900 | '{{WRAPPER}}' => 'max-height:{{SIZE}}{{UNIT}};' |
| 901 | ], |
| 902 | 'separator' => 'after' |
| 903 | ] |
| 904 | ); |
| 905 | |
| 906 | $widget->add_responsive_control( |
| 907 | 'aux_min_width', |
| 908 | [ |
| 909 | 'label' => __('Min Width','auxin-elements' ), |
| 910 | 'type' => Controls_Manager::SLIDER, |
| 911 | 'size_units' => ['px', 'em', '%', 'vw'], |
| 912 | 'range' => [ |
| 913 | 'px' => [ |
| 914 | 'min' => 0, |
| 915 | 'step' => 1 |
| 916 | ], |
| 917 | '%' => [ |
| 918 | 'min' => 0, |
| 919 | 'max' => 100, |
| 920 | 'step' => 1 |
| 921 | ], |
| 922 | 'em' => [ |
| 923 | 'min' => 0, |
| 924 | 'step' => 1 |
| 925 | ], |
| 926 | 'vw' => [ |
| 927 | 'min' => 0, |
| 928 | 'max' => 100, |
| 929 | 'step' => 1 |
| 930 | ] |
| 931 | ], |
| 932 | 'selectors' => [ |
| 933 | '{{WRAPPER}}' => 'min-width:{{SIZE}}{{UNIT}};' |
| 934 | ] |
| 935 | ] |
| 936 | ); |
| 937 | |
| 938 | $widget->add_responsive_control( |
| 939 | 'aux_min_height', |
| 940 | [ |
| 941 | 'label' => __('Min Height','auxin-elements' ), |
| 942 | 'type' => Controls_Manager::SLIDER, |
| 943 | 'size_units' => ['px', 'em', '%', 'vh'], |
| 944 | 'range' => [ |
| 945 | 'px' => [ |
| 946 | 'min' => 0, |
| 947 | 'step' => 1 |
| 948 | ], |
| 949 | '%' => [ |
| 950 | 'min' => 0, |
| 951 | 'max' => 100, |
| 952 | 'step' => 1 |
| 953 | ], |
| 954 | 'em' => [ |
| 955 | 'min' => 0, |
| 956 | 'step' => 1 |
| 957 | ], |
| 958 | 'vh' => [ |
| 959 | 'min' => 0, |
| 960 | 'max' => 100, |
| 961 | 'step' => 1 |
| 962 | ] |
| 963 | ], |
| 964 | 'selectors' => [ |
| 965 | '{{WRAPPER}}' => 'min-height:{{SIZE}}{{UNIT}};' |
| 966 | ], |
| 967 | 'separator' => 'after' |
| 968 | ] |
| 969 | ); |
| 970 | |
| 971 | $widget->add_responsive_control( |
| 972 | 'aux_height', |
| 973 | [ |
| 974 | 'label' => __('Height','auxin-elements' ), |
| 975 | 'type' => Controls_Manager::SLIDER, |
| 976 | 'size_units' => ['px', 'em', '%', 'vh'], |
| 977 | 'range' => [ |
| 978 | 'px' => [ |
| 979 | 'min' => 0, |
| 980 | 'step' => 1 |
| 981 | ], |
| 982 | '%' => [ |
| 983 | 'min' => 0, |
| 984 | 'max' => 100, |
| 985 | 'step' => 1 |
| 986 | ], |
| 987 | 'em' => [ |
| 988 | 'min' => 0, |
| 989 | 'step' => 1 |
| 990 | ], |
| 991 | 'vh' => [ |
| 992 | 'min' => 0, |
| 993 | 'max' => 100, |
| 994 | 'step' => 1 |
| 995 | ] |
| 996 | ], |
| 997 | 'selectors' => [ |
| 998 | '{{WRAPPER}}' => 'height:{{SIZE}}{{UNIT}};' |
| 999 | ] |
| 1000 | ] |
| 1001 | ); |
| 1002 | |
| 1003 | $widget->add_responsive_control( |
| 1004 | 'flex_grow', |
| 1005 | [ |
| 1006 | 'label' => __( 'Grow in width', 'auxin-elements' ), |
| 1007 | 'label_block' => false, |
| 1008 | 'type' => Controls_Manager::NUMBER, |
| 1009 | 'min' => 0, |
| 1010 | 'selectors' => [ |
| 1011 | '{{WRAPPER}}' => 'flex-grow: {{VALUE}};' |
| 1012 | ], |
| 1013 | 'separator' => 'before' |
| 1014 | ] |
| 1015 | ); |
| 1016 | |
| 1017 | $widget->end_controls_section(); |
| 1018 | } |
| 1019 | |
| 1020 | |
| 1021 | /** |
| 1022 | * Modify the render of elementor elements |
| 1023 | * |
| 1024 | * @param Widget_Base $widget Instance of Elementor Widget |
| 1025 | * |
| 1026 | * @return void |
| 1027 | */ |
| 1028 | public function render_widget_attributes( $widget ){ |
| 1029 | $settings = $widget->get_settings(); |
| 1030 | } |
| 1031 | |
| 1032 | |
| 1033 | /** |
| 1034 | * Retrives the setting value or checkes whether the setting value |
| 1035 | * mathes with a value or not |
| 1036 | * |
| 1037 | * @param array $settings Settings in an array |
| 1038 | * @param string $key The setting key |
| 1039 | * @param string $value An optional value to compare with the setting value |
| 1040 | * |
| 1041 | * @return mixed Setting value or a boolean value |
| 1042 | */ |
| 1043 | private function setting_value( $settings, $key, $value = null ){ |
| 1044 | if( ! isset( $settings[ $key ] ) ){ |
| 1045 | return; |
| 1046 | } |
| 1047 | // Retrieves the setting value |
| 1048 | if( is_null( $value ) ){ |
| 1049 | return $settings[ $key ]; |
| 1050 | } |
| 1051 | // Validates the setting value |
| 1052 | return ! empty( $settings[ $key ] ) && $value == $settings[ $key ]; |
| 1053 | } |
| 1054 | |
| 1055 | /** |
| 1056 | * Render Custom CSS for an Elementor Element |
| 1057 | * |
| 1058 | * @param $post_css Post_CSS_File |
| 1059 | * @param $element Element_Base |
| 1060 | */ |
| 1061 | public function add_post_css( $post_css, $element ) { |
| 1062 | $element_settings = $element->get_settings(); |
| 1063 | |
| 1064 | if ( empty( $element_settings['custom_css'] ) ) { |
| 1065 | return; |
| 1066 | } |
| 1067 | |
| 1068 | $css = trim( $element_settings['custom_css'] ); |
| 1069 | |
| 1070 | if ( empty( $css ) ) { |
| 1071 | return; |
| 1072 | } |
| 1073 | |
| 1074 | if ( \Elementor\Plugin::$instance->experiments->is_feature_active( 'e_optimized_markup' ) ) { |
| 1075 | $css = str_replace( 'selector .elementor-widget-container', 'selector', $css ); |
| 1076 | } |
| 1077 | $css = str_replace( 'selector', $post_css->get_element_unique_selector( $element ), $css ); |
| 1078 | |
| 1079 | // Add a css comment |
| 1080 | $css = sprintf( '/* Start custom CSS for %s, class: %s */', $element->get_name(), $element->get_unique_selector() ) . $css . '/* End custom CSS */'; |
| 1081 | |
| 1082 | $post_css->get_stylesheet()->add_raw_css( $css ); |
| 1083 | } |
| 1084 | |
| 1085 | } |
| 1086 |