first commit

This commit is contained in:
2024-07-15 11:28:08 +02:00
commit f52d538ea5
21891 changed files with 6161164 additions and 0 deletions

View File

@@ -0,0 +1,179 @@
<?php
namespace Elementor;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
/**
* Elementor animation control.
*
* A base control for creating entrance animation control. Displays a select box
* with the available entrance animation effects @see Control_Animation::get_animations() .
*
* @since 1.0.0
*/
class Control_Animation extends Base_Data_Control {
/**
* Get control type.
*
* Retrieve the animation control type.
*
* @since 1.0.0
* @access public
*
* @return string Control type.
*/
public function get_type() {
return 'animation';
}
/**
* Retrieve default control settings.
*
* Get the default settings of the control. Used to return the default
* settings while initializing the control.
*
* @since 2.5.0
* @access protected
*
* @return array Control default settings.
*/
protected function get_default_settings() {
$default_settings['label_block'] = true;
$default_settings['render_type'] = 'none';
return $default_settings;
}
/**
* Get animations list.
*
* Retrieve the list of all the available animations.
*
* @since 1.0.0
* @access public
* @static
*
* @return array Control type.
*/
public static function get_animations() {
$animations = [
'Fading' => [
'fadeIn' => 'Fade In',
'fadeInDown' => 'Fade In Down',
'fadeInLeft' => 'Fade In Left',
'fadeInRight' => 'Fade In Right',
'fadeInUp' => 'Fade In Up',
],
'Zooming' => [
'zoomIn' => 'Zoom In',
'zoomInDown' => 'Zoom In Down',
'zoomInLeft' => 'Zoom In Left',
'zoomInRight' => 'Zoom In Right',
'zoomInUp' => 'Zoom In Up',
],
'Bouncing' => [
'bounceIn' => 'Bounce In',
'bounceInDown' => 'Bounce In Down',
'bounceInLeft' => 'Bounce In Left',
'bounceInRight' => 'Bounce In Right',
'bounceInUp' => 'Bounce In Up',
],
'Sliding' => [
'slideInDown' => 'Slide In Down',
'slideInLeft' => 'Slide In Left',
'slideInRight' => 'Slide In Right',
'slideInUp' => 'Slide In Up',
],
'Rotating' => [
'rotateIn' => 'Rotate In',
'rotateInDownLeft' => 'Rotate In Down Left',
'rotateInDownRight' => 'Rotate In Down Right',
'rotateInUpLeft' => 'Rotate In Up Left',
'rotateInUpRight' => 'Rotate In Up Right',
],
'Attention Seekers' => [
'bounce' => 'Bounce',
'flash' => 'Flash',
'pulse' => 'Pulse',
'rubberBand' => 'Rubber Band',
'shake' => 'Shake',
'headShake' => 'Head Shake',
'swing' => 'Swing',
'tada' => 'Tada',
'wobble' => 'Wobble',
'jello' => 'Jello',
],
'Light Speed' => [
'lightSpeedIn' => 'Light Speed In',
],
'Specials' => [
'rollIn' => 'Roll In',
],
];
$additional_animations = [];
/**
* Entrance animations.
*
* Filters the animations list displayed in the animations control.
*
* This hook can be used to register animations in addition to the
* basic Elementor animations.
*
* @since 2.4.0
*
* @param array $additional_animations Additional animations array.
*/
$additional_animations = apply_filters( 'elementor/controls/animations/additional_animations', $additional_animations );
return array_merge( $animations, $additional_animations );
}
/**
* Render animations control template.
*
* Used to generate the control HTML in the editor using Underscore JS
* template. The variables for the class are available using `data` JS
* object.
*
* @since 1.0.0
* @access public
*/
public function content_template() {
?>
<div class="elementor-control-field">
<label for="<?php $this->print_control_uid(); ?>" class="elementor-control-title">{{{ data.label }}}</label>
<div class="elementor-control-input-wrapper">
<select id="<?php $this->print_control_uid(); ?>" data-setting="{{ data.name }}">
<option value=""><?php echo esc_html__( 'Default', 'elementor' ); ?></option>
<option value="none"><?php echo esc_html__( 'None', 'elementor' ); ?></option>
<?php foreach ( static::get_animations() as $animations_group_name => $animations_group ) : ?>
<optgroup label="<?php echo esc_attr( $animations_group_name ); ?>">
<?php foreach ( $animations_group as $animation_name => $animation_title ) : ?>
<option value="<?php echo esc_attr( $animation_name ); ?>"><?php echo esc_html( $animation_title ); ?></option>
<?php endforeach; ?>
</optgroup>
<?php endforeach; ?>
</select>
</div>
</div>
<# if ( data.description ) { #>
<div class="elementor-control-field-description">{{{ data.description }}}</div>
<# } #>
<?php
}
public static function get_assets( $setting ) {
if ( ! $setting || 'none' === $setting ) {
return [];
}
return [
'styles' => [ 'e-animations' ],
];
}
}

View File

@@ -0,0 +1,148 @@
<?php
namespace Elementor;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
/**
* Elementor base data control.
*
* An abstract class for creating new data controls in the panel.
*
* @since 1.5.0
* @abstract
*/
abstract class Base_Data_Control extends Base_Control {
public function __construct() {
parent::__construct();
$default_value = $this->get_default_value();
if ( '' !== $default_value ) {
$this->set_settings( 'default_value', $default_value );
}
}
/**
* Get data control default value.
*
* Retrieve the default value of the data control. Used to return the default
* values while initializing the data control.
*
* @since 1.5.0
* @access public
*
* @return string Control default value.
*/
public function get_default_value() {
return '';
}
/**
* Get data control value.
*
* Retrieve the value of the data control from a specific Controls_Stack settings.
*
* @since 1.5.0
* @access public
*
* @param array $control Control
* @param array $settings Element settings
*
* @return mixed Control values.
*/
public function get_value( $control, $settings ) {
if ( ! isset( $control['default'] ) ) {
$control['default'] = $this->get_default_value();
}
if ( isset( $settings[ $control['name'] ] ) ) {
$value = $settings[ $control['name'] ];
} else {
$value = $control['default'];
}
return $value;
}
/**
* Parse dynamic tags.
*
* Iterates through all the controls and renders all the dynamic tags.
*
* @since 2.0.0
* @access public
*
* @param string $dynamic_value The dynamic tag text.
* @param array $dynamic_settings The dynamic tag settings.
*
* @return string|string[]|mixed A string or an array of strings with the
* return value from each tag callback function.
*/
public function parse_tags( $dynamic_value, $dynamic_settings ) {
$current_dynamic_settings = $this->get_settings( 'dynamic' );
if ( is_array( $current_dynamic_settings ) ) {
$dynamic_settings = array_merge( $current_dynamic_settings, $dynamic_settings );
}
return Plugin::$instance->dynamic_tags->parse_tags_text( $dynamic_value, $dynamic_settings, [ Plugin::$instance->dynamic_tags, 'get_tag_data_content' ] );
}
/**
* Get data control style value.
*
* Retrieve the style of the control. Used when adding CSS rules to the control
* while extracting CSS from the `selectors` data argument.
*
* @since 1.5.0
* @since 2.3.3 New `$control_data` parameter added.
* @access public
*
* @param string $css_property CSS property.
* @param string $control_value Control value.
* @param array $control_data Control Data.
*
* @return string Control style value.
*/
public function get_style_value( $css_property, $control_value, array $control_data ) {
if ( 'DEFAULT' === $css_property ) {
return $control_data['default'];
}
return $control_value;
}
/**
* Get data control unique ID.
*
* Retrieve the unique ID of the control. Used to set a uniq CSS ID for the
* element.
*
* @since 1.5.0
* @access protected
*
* @param string $input_type Input type. Default is 'default'.
*
* @return string Unique ID.
*/
protected function get_control_uid( $input_type = 'default' ) {
return 'elementor-control-' . $input_type . '-{{{ data._cid }}}';
}
/**
* Safe Print data control unique ID.
*
* Retrieve the unique ID of the control. Used to set a unique CSS ID for the
* element.
*
* @access protected
*
* @param string $input_type Input type. Default is 'default'.
*/
protected function print_control_uid( $input_type = 'default' ) {
echo esc_attr( $this->get_control_uid( $input_type ) );
}
}

View File

@@ -0,0 +1,38 @@
<?php
namespace Elementor;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
abstract class Base_Icon_Font {
/**
* Get Icon type.
*
* Retrieve the icon type.
*
* @access public
* @abstract
*/
abstract public function get_type();
/**
* Enqueue Icon scripts and styles.
*
* Used to register and enqueue custom scripts and styles used by the Icon.
*
* @access public
*/
abstract public function enqueue();
/**
* get_css_prefix
* @return string
*/
abstract public function get_css_prefix();
abstract public function get_icons();
public function __construct() {}
}

View File

@@ -0,0 +1,89 @@
<?php
namespace Elementor;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
/**
* Elementor control base multiple.
*
* An abstract class for creating new controls in the panel that return
* more than a single value. Each value of the multi-value control will
* be returned as an item in a `key => value` array.
*
* @since 1.0.0
* @abstract
*/
abstract class Control_Base_Multiple extends Base_Data_Control {
/**
* Get multiple control default value.
*
* Retrieve the default value of the multiple control. Used to return the default
* values while initializing the multiple control.
*
* @since 1.0.0
* @access public
*
* @return array Control default value.
*/
public function get_default_value() {
return [];
}
/**
* Get multiple control value.
*
* Retrieve the value of the multiple control from a specific Controls_Stack settings.
*
* @since 1.0.0
* @access public
*
* @param array $control Control
* @param array $settings Settings
*
* @return mixed Control values.
*/
public function get_value( $control, $settings ) {
$value = parent::get_value( $control, $settings );
if ( empty( $control['default'] ) ) {
$control['default'] = [];
}
if ( ! is_array( $value ) ) {
$value = [];
}
$control['default'] = array_merge(
$this->get_default_value(),
$control['default']
);
return array_merge(
$control['default'],
$value
);
}
/**
* Get multiple control style value.
*
* Retrieve the style of the control. Used when adding CSS rules to the control
* while extracting CSS from the `selectors` data argument.
*
* @since 1.0.5
* @since 2.3.3 New `$control_data` parameter added.
* @access public
*
* @param string $css_property CSS property.
* @param array $control_value Control value.
* @param array $control_data Control Data.
*
* @return array Control style value.
*/
public function get_style_value( $css_property, $control_value, array $control_data ) {
return $control_value[ strtolower( $css_property ) ];
}
}

View File

@@ -0,0 +1,31 @@
<?php
namespace Elementor;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
/**
* Elementor base UI control.
*
* An abstract class for creating new UI controls in the panel.
*
* @abstract
*/
abstract class Base_UI_Control extends Base_Control {
/**
* Get features.
*
* Retrieve the list of all the available features.
*
* @since 1.5.0
* @access public
* @static
*
* @return array Features array.
*/
public static function get_features() {
return [ 'ui' ];
}
}

View File

@@ -0,0 +1,109 @@
<?php
namespace Elementor;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
/**
* Elementor control base units.
*
* An abstract class for creating new unit controls in the panel.
*
* @since 1.0.0
* @abstract
*/
abstract class Control_Base_Units extends Control_Base_Multiple {
/**
* Get units control default value.
*
* Retrieve the default value of the units control. Used to return the default
* values while initializing the units control.
*
* @since 1.0.0
* @access public
*
* @return array Control default value.
*/
public function get_default_value() {
return [
'unit' => 'px',
];
}
/**
* Get units control default settings.
*
* Retrieve the default settings of the units control. Used to return the default
* settings while initializing the units control.
*
* @since 1.0.0
* @access protected
*
* @return array Control default settings.
*/
protected function get_default_settings() {
return [
'size_units' => [ 'px' ],
'range' => [
'px' => [
'min' => 0,
'max' => 100,
'step' => 1,
],
'em' => [
'min' => 0.1,
'max' => 10,
'step' => 0.1,
],
'rem' => [
'min' => 0.1,
'max' => 10,
'step' => 0.1,
],
'%' => [
'min' => 0,
'max' => 100,
'step' => 1,
],
'deg' => [
'min' => 0,
'max' => 360,
'step' => 1,
],
'vh' => [
'min' => 0,
'max' => 100,
'step' => 1,
],
'vw' => [
'min' => 0,
'max' => 100,
'step' => 1,
],
],
];
}
/**
* Print units control settings.
*
* Used to generate the units control template in the editor.
*
* @since 1.0.0
* @access protected
*/
protected function print_units_template() {
?>
<# if ( data.size_units && data.size_units.length > 1 ) { #>
<div class="elementor-units-choices">
<# _.each( data.size_units, function( unit ) { #>
<input id="elementor-choose-{{ data._cid + data.name + unit }}" type="radio" name="elementor-choose-{{ data.name + data._cid }}" data-setting="unit" value="{{ unit }}">
<label class="elementor-units-choices-label" for="elementor-choose-{{ data._cid + data.name + unit }}">{{{ unit }}}</label>
<# } ); #>
</div>
<# } #>
<?php
}
}

View File

@@ -0,0 +1,143 @@
<?php
namespace Elementor;
use Elementor\Core\Base\Base_Object;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
/**
* Elementor base control.
*
* An abstract class for creating new controls in the panel.
*
* @since 1.0.0
* @abstract
*/
abstract class Base_Control extends Base_Object {
/**
* Base settings.
*
* Holds all the base settings of the control.
*
* @access private
*
* @var array
*/
private $_base_settings = [
'label' => '',
'description' => '',
'show_label' => true,
'label_block' => false,
'separator' => 'default',
];
/**
* Get features.
*
* Retrieve the list of all the available features. Currently Elementor uses only
* the `UI` feature.
*
* @since 1.5.0
* @access public
* @static
*
* @return array Features array.
*/
public static function get_features() {
return [];
}
/**
* Get control type.
*
* Retrieve the control type.
*
* @since 1.5.0
* @access public
* @abstract
*/
abstract public function get_type();
/**
* Control base constructor.
*
* Initializing the control base class.
*
* @since 1.5.0
* @access public
*/
public function __construct() {
$this->set_settings( array_merge( $this->_base_settings, $this->get_default_settings() ) );
$this->set_settings( 'features', static::get_features() );
}
/**
* Enqueue control scripts and styles.
*
* Used to register and enqueue custom scripts and styles used by the control.
*
* @since 1.5.0
* @access public
*/
public function enqueue() {}
/**
* Control content template.
*
* Used to generate the control HTML in the editor using Underscore JS
* template. The variables for the class are available using `data` JS
* object.
*
* Note that the content template is wrapped by Base_Control::print_template().
*
* @since 1.5.0
* @access public
* @abstract
*/
abstract public function content_template();
/**
* Print control template.
*
* Used to generate the control HTML in the editor using Underscore JS
* template. The variables for the class are available using `data` JS
* object.
*
* @since 1.5.0
* @access public
*/
final public function print_template() {
?>
<script type="text/html" id="tmpl-elementor-control-<?php echo esc_attr( $this->get_type() ); ?>-content">
<div class="elementor-control-content">
<?php
$this->content_template();
?>
</div>
</script>
<?php
}
/**
* Get default control settings.
*
* Retrieve the default settings of the control. Used to return the default
* settings while initializing the control.
*
* @since 1.5.0
* @access protected
*
* @return array Control default settings.
*/
protected function get_default_settings() {
return [];
}
public static function get_assets( $setting ) {
return [];
}
}

View File

@@ -0,0 +1,128 @@
<?php
namespace Elementor;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
/**
* Elementor box shadow control.
*
* A base control for creating box shadows control. Displays input fields for
* horizontal shadow, vertical shadow, shadow blur, shadow spread and shadow
* color.
*
* @since 1.0.0
*/
class Control_Box_Shadow extends Control_Base_Multiple {
/**
* Get box shadow control type.
*
* Retrieve the control type, in this case `box_shadow`.
*
* @since 1.0.0
* @access public
*
* @return string Control type.
*/
public function get_type() {
return 'box_shadow';
}
/**
* Get box shadow control default value.
*
* Retrieve the default value of the box shadow control. Used to return the
* default values while initializing the box shadow control.
*
* @since 1.0.0
* @access public
*
* @return array Control default value.
*/
public function get_default_value() {
return [
'horizontal' => 0,
'vertical' => 0,
'blur' => 10,
'spread' => 0,
'color' => 'rgba(0,0,0,0.5)',
];
}
/**
* Get box shadow control sliders.
*
* Retrieve the sliders of the box shadow control. Sliders are used while
* rendering the control output in the editor.
*
* @since 1.0.0
* @access public
*
* @return array Control sliders.
*/
public function get_sliders() {
return [
'horizontal' => [
'label' => esc_html__( 'Horizontal', 'elementor' ),
'min' => -100,
'max' => 100,
],
'vertical' => [
'label' => esc_html__( 'Vertical', 'elementor' ),
'min' => -100,
'max' => 100,
],
'blur' => [
'label' => esc_html__( 'Blur', 'elementor' ),
'min' => 0,
'max' => 100,
],
'spread' => [
'label' => esc_html__( 'Spread', 'elementor' ),
'min' => -100,
'max' => 100,
],
];
}
/**
* Render box shadow control output in the editor.
*
* Used to generate the control HTML in the editor using Underscore JS
* template. The variables for the class are available using `data` JS
* object.
*
* @since 1.0.0
* @access public
*/
public function content_template() {
?>
<div class="elementor-shadow-box">
<div class="elementor-control-field elementor-color-picker-wrapper">
<label class="elementor-control-title"><?php echo esc_html__( 'Color', 'elementor' ); ?></label>
<div class="elementor-control-input-wrapper elementor-control-unit-1">
<div class="elementor-color-picker-placeholder"></div>
</div>
</div>
<?php
foreach ( $this->get_sliders() as $slider_name => $slider ) :
?>
<div class="elementor-shadow-slider elementor-control-type-slider">
<label for="<?php $this->print_control_uid( $slider_name ); ?>" class="elementor-control-title"><?php
// PHPCS - the value of $slider['label'] is already escaped.
echo $slider['label']; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
?></label>
<div class="elementor-control-input-wrapper">
<div class="elementor-slider" data-input="<?php echo esc_attr( $slider_name ); ?>"></div>
<div class="elementor-slider-input elementor-control-unit-2">
<input id="<?php $this->print_control_uid( $slider_name ); ?>" type="number" min="<?php echo esc_attr( $slider['min'] ); ?>" max="<?php echo esc_attr( $slider['max'] ); ?>" data-setting="<?php echo esc_attr( $slider_name ); ?>"/>
</div>
</div>
</div>
<?php endforeach; ?>
</div>
<?php
}
}

View File

@@ -0,0 +1,75 @@
<?php
namespace Elementor;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
/**
* Elementor button control.
*
* A base control for creating a button control. Displays a button that can
* trigger an event.
*
* @since 1.9.0
*/
class Control_Button extends Base_UI_Control {
/**
* Get button control type.
*
* Retrieve the control type, in this case `button`.
*
* @since 1.9.0
* @access public
*
* @return string Control type.
*/
public function get_type() {
return 'button';
}
/**
* Get button control default settings.
*
* Retrieve the default settings of the button control. Used to
* return the default settings while initializing the button
* control.
*
* @since 1.9.0
* @access protected
*
* @return array Control default settings.
*/
protected function get_default_settings() {
return [
'text' => '',
'event' => '',
'button_type' => 'default',
];
}
/**
* Render button control output in the editor.
*
* Used to generate the control HTML in the editor using Underscore JS
* template. The variables for the class are available using `data` JS
* object.
*
* @since 1.9.0
* @access public
*/
public function content_template() {
?>
<div class="elementor-control-field">
<label class="elementor-control-title">{{{ data.label }}}</label>
<div class="elementor-control-input-wrapper">
<button type="button" class="elementor-button elementor-button-{{{ data.button_type }}}" data-event="{{{ data.event }}}">{{{ data.text }}}</button>
</div>
</div>
<# if ( data.description ) { #>
<div class="elementor-control-field-description">{{{ data.description }}}</div>
<# } #>
<?php
}
}

View File

@@ -0,0 +1,83 @@
<?php
namespace Elementor;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
/**
* Elementor choose control.
*
* A base control for creating choose control. Displays radio buttons styled as
* groups of buttons with icons for each option.
*
* @since 1.0.0
*/
class Control_Choose extends Base_Data_Control {
/**
* Get choose control type.
*
* Retrieve the control type, in this case `choose`.
*
* @since 1.0.0
* @access public
*
* @return string Control type.
*/
public function get_type() {
return 'choose';
}
/**
* Render choose control output in the editor.
*
* Used to generate the control HTML in the editor using Underscore JS
* template. The variables for the class are available using `data` JS
* object.
*
* @since 1.0.0
* @access public
*/
public function content_template() {
$control_uid_input_type = '{{value}}';
?>
<div class="elementor-control-field">
<label class="elementor-control-title">{{{ data.label }}}</label>
<div class="elementor-control-input-wrapper">
<div class="elementor-choices">
<# _.each( data.options, function( options, value ) { #>
<input id="<?php $this->print_control_uid( $control_uid_input_type ); ?>" type="radio" name="elementor-choose-{{ data.name }}-{{ data._cid }}" value="{{ value }}">
<label class="elementor-choices-label elementor-control-unit-1 tooltip-target" for="<?php $this->print_control_uid( $control_uid_input_type ); ?>" data-tooltip="{{ options.title }}" title="{{ options.title }}">
<i class="{{ options.icon }}" aria-hidden="true"></i>
<span class="elementor-screen-only">{{{ options.title }}}</span>
</label>
<# } ); #>
</div>
</div>
</div>
<# if ( data.description ) { #>
<div class="elementor-control-field-description">{{{ data.description }}}</div>
<# } #>
<?php
}
/**
* Get choose control default settings.
*
* Retrieve the default settings of the choose control. Used to return the
* default settings while initializing the choose control.
*
* @since 1.0.0
* @access protected
*
* @return array Control default settings.
*/
protected function get_default_settings() {
return [
'options' => [],
'toggle' => true,
];
}
}

View File

@@ -0,0 +1,79 @@
<?php
namespace Elementor;
use Elementor\Modules\DynamicTags\Module as TagsModule;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
/**
* Elementor code control.
*
* A base control for creating code control. Displays a code editor textarea.
* Based on Ace editor (@see https://ace.c9.io/).
*
* @since 1.0.0
*/
class Control_Code extends Base_Data_Control {
/**
* Get code control type.
*
* Retrieve the control type, in this case `code`.
*
* @since 1.0.0
* @access public
*
* @return string Control type.
*/
public function get_type() {
return 'code';
}
/**
* Get code control default settings.
*
* Retrieve the default settings of the code control. Used to return the default
* settings while initializing the code control.
*
* @since 1.0.0
* @access protected
*
* @return array Control default settings.
*/
protected function get_default_settings() {
return [
'label_block' => true,
'language' => 'html', // html/css
'rows' => 10,
'dynamic' => [
'categories' => [ TagsModule::TEXT_CATEGORY ],
],
];
}
/**
* Render code control output in the editor.
*
* Used to generate the control HTML in the editor using Underscore JS
* template. The variables for the class are available using `data` JS
* object.
*
* @since 1.0.0
* @access public
*/
public function content_template() {
?>
<div class="elementor-control-field">
<label for="<?php $this->print_control_uid(); ?>" class="elementor-control-title">{{{ data.label }}}</label>
<div class="elementor-control-input-wrapper elementor-control-dynamic-switcher-wrapper">
<textarea id="<?php $this->print_control_uid(); ?>" rows="{{ data.rows }}" class="elementor-input-style elementor-code-editor" data-setting="{{ data.name }}"></textarea>
</div>
</div>
<# if ( data.description ) { #>
<div class="elementor-control-field-description">{{{ data.description }}}</div>
<# } #>
<?php
}
}

View File

@@ -0,0 +1,86 @@
<?php
namespace Elementor;
use Elementor\Modules\DynamicTags\Module as TagsModule;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
/**
* Elementor color control.
*
* A base control for creating color control. Displays a color picker field with
* an alpha slider. Includes a customizable color palette that can be preset by
* the user. Accepts a `scheme` argument that allows you to set a value from the
* active color scheme as the default value returned by the control.
*
* @since 1.0.0
*/
class Control_Color extends Base_Data_Control {
/**
* Get color control type.
*
* Retrieve the control type, in this case `color`.
*
* @since 1.0.0
* @access public
*
* @return string Control type.
*/
public function get_type() {
return 'color';
}
/**
* Render color control output in the editor.
*
* Used to generate the control HTML in the editor using Underscore JS
* template. The variables for the class are available using `data` JS
* object.
*
* @since 1.0.0
* @access public
*/
public function content_template() {
?>
<div class="elementor-control-field">
<label class="elementor-control-title">{{{ data.label || '' }}}</label>
<div class="elementor-control-input-wrapper elementor-control-dynamic-switcher-wrapper elementor-control-unit-5">
<div class="elementor-color-picker-placeholder"></div>
</div>
</div>
<# if ( data.description ) { #>
<div class="elementor-control-field-description">{{{ data.description }}}</div>
<# } #>
<?php
}
/**
* Get color control default settings.
*
* Retrieve the default settings of the color control. Used to return the default
* settings while initializing the color control.
*
* @since 1.0.0
* @access protected
*
* @return array Control default settings.
*/
protected function get_default_settings() {
return [
'alpha' => true,
'scheme' => '',
'dynamic' => [
'categories' => [
TagsModule::COLOR_CATEGORY,
],
'active' => true,
],
'global' => [
'active' => true,
],
];
}
}

View File

@@ -0,0 +1,73 @@
<?php
namespace Elementor;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
/**
* Elementor date/time control.
*
* A base control for creating date time control. Displays a date/time picker
* based on the Flatpickr library @see https://chmln.github.io/flatpickr/ .
*
* @since 1.0.0
*/
class Control_Date_Time extends Base_Data_Control {
/**
* Get date time control type.
*
* Retrieve the control type, in this case `date_time`.
*
* @since 1.0.0
* @access public
*
* @return string Control type.
*/
public function get_type() {
return 'date_time';
}
/**
* Get date time control default settings.
*
* Retrieve the default settings of the date time control. Used to return the
* default settings while initializing the date time control.
*
* @since 1.8.0
* @access protected
*
* @return array Control default settings.
*/
protected function get_default_settings() {
return [
'label_block' => true,
'picker_options' => [],
];
}
/**
* Render date time control output in the editor.
*
* Used to generate the control HTML in the editor using Underscore JS
* template. The variables for the class are available using `data` JS
* object.
*
* @since 1.0.0
* @access public
*/
public function content_template() {
?>
<div class="elementor-control-field">
<label for="<?php $this->print_control_uid(); ?>" class="elementor-control-title">{{{ data.label }}}</label>
<div class="elementor-control-input-wrapper">
<input id="<?php $this->print_control_uid(); ?>" placeholder="{{ view.getControlPlaceholder() }}" class="elementor-date-time-picker flatpickr" type="text" data-setting="{{ data.name }}">
</div>
</div>
<# if ( data.description ) { #>
<div class="elementor-control-field-description">{{{ data.description }}}</div>
<# } #>
<?php
}
}

View File

@@ -0,0 +1,80 @@
<?php
namespace Elementor;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
/**
* Elementor Deprecated Notice control.
*
* A base control specific for creating Deprecation Notices control.
* Displays a warning notice in the panel.
*
* @since 2.6.0
*/
class Control_Deprecated_Notice extends Base_UI_Control {
/**
* Get deprecated-notice control type.
*
* Retrieve the control type, in this case `deprecated_notice`.
*
* @since 2.6.0
* @access public
*
* @return string Control type.
*/
public function get_type() {
return 'deprecated_notice';
}
/**
* Render deprecated notice control output in the editor.
*
* Used to generate the control HTML in the editor using Underscore JS
* template. The variables for the class are available using `data` JS
* object.
*
* @since 2.6.0
* @access public
*/
public function content_template() {
?>
<# if ( data.label ) { #>
<span class="elementor-control-title">{{{ data.label }}}</span>
<#
}
let notice = wp.i18n.sprintf( wp.i18n.__( 'The <strong>%1$s</strong> widget has been deprecated since %2$s %3$s.', 'elementor' ), data.widget, data.plugin, data.since );
if ( data.replacement ) {
notice += '<br>' + wp.i18n.sprintf( wp.i18n.__( 'It has been replaced by <strong>%1$s</strong>.', 'elementor' ), data.replacement );
}
if ( data.last ) {
notice += '<br>' + wp.i18n.sprintf( wp.i18n.__( 'Note that %1$s will be completely removed once %2$s %3$s is released.', 'elementor' ), data.widget, data.plugin, data.last );
}
#>
<div class="elementor-control-deprecated-notice elementor-panel-alert elementor-panel-alert-warning">{{{ notice }}}</div>
<?php
}
/**
* Get deprecated-notice control default settings.
*
* Retrieve the default settings of the deprecated notice control. Used to return the
* default settings while initializing the deprecated notice control.
*
* @since 2.6.0
* @access protected
*
* @return array Control default settings.
*/
protected function get_default_settings() {
return [
'widget' => '', // Widgets name
'since' => '', // Plugin version widget was deprecated
'last' => '', // Plugin version in which the widget will be removed
'plugin' => '', // Plugin's title
'replacement' => '', // Widget replacement
];
}
}

View File

@@ -0,0 +1,154 @@
<?php
namespace Elementor;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
/**
* Elementor dimension control.
*
* A base control for creating dimension control. Displays input fields for top,
* right, bottom, left and the option to link them together.
*
* @since 1.0.0
*/
class Control_Dimensions extends Control_Base_Units {
/**
* Get dimensions control type.
*
* Retrieve the control type, in this case `dimensions`.
*
* @since 1.0.0
* @access public
*
* @return string Control type.
*/
public function get_type() {
return 'dimensions';
}
/**
* Get dimensions control default values.
*
* Retrieve the default value of the dimensions control. Used to return the
* default values while initializing the dimensions control.
*
* @since 1.0.0
* @access public
*
* @return array Control default value.
*/
public function get_default_value() {
return array_merge(
parent::get_default_value(), [
'top' => '',
'right' => '',
'bottom' => '',
'left' => '',
'isLinked' => true,
]
);
}
/**
* Get dimensions control default settings.
*
* Retrieve the default settings of the dimensions control. Used to return the
* default settings while initializing the dimensions control.
*
* @since 1.0.0
* @access protected
*
* @return array Control default settings.
*/
protected function get_default_settings() {
return array_merge(
parent::get_default_settings(), [
'label_block' => true,
'allowed_dimensions' => 'all',
'placeholder' => '',
]
);
}
/**
* Render dimensions control output in the editor.
*
* Used to generate the control HTML in the editor using Underscore JS
* template. The variables for the class are available using `data` JS
* object.
*
* @since 1.0.0
* @access public
*/
public function content_template() {
$dimensions = [
'top' => esc_html__( 'Top', 'elementor' ),
'right' => esc_html__( 'Right', 'elementor' ),
'bottom' => esc_html__( 'Bottom', 'elementor' ),
'left' => esc_html__( 'Left', 'elementor' ),
];
?>
<div class="elementor-control-field">
<label class="elementor-control-title">{{{ data.label }}}</label>
<?php $this->print_units_template(); ?>
<div class="elementor-control-input-wrapper">
<ul class="elementor-control-dimensions">
<?php
foreach ( $dimensions as $dimension_key => $dimension_title ) :
?>
<li class="elementor-control-dimension">
<input id="<?php $this->print_control_uid( $dimension_key ); ?>" type="number" data-setting="<?php
// PHPCS - the variable $dimension_key is a plain text.
echo $dimension_key; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
?>" placeholder="<#
placeholder = view.getControlPlaceholder();
if ( _.isObject( placeholder ) ) {
if ( ! _.isUndefined( placeholder.<?php
// PHPCS - the variable $dimension_key is a plain text.
echo $dimension_key; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
?> ) ) {
print( placeholder.<?php
// PHPCS - the variable $dimension_key is a plain text.
echo $dimension_key; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
?> );
}
} else {
print( placeholder );
} #>"
<# if ( -1 === _.indexOf( allowed_dimensions, '<?php
// PHPCS - the variable $dimension_key is a plain text.
echo $dimension_key; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
?>' ) ) { #>
disabled
<# } #>
/>
<label for="<?php $this->print_control_uid( $dimension_key ); ?>" class="elementor-control-dimension-label"><?php
// PHPCS - the variable $dimension_title holds an escaped translated value.
echo $dimension_title; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
?></label>
</li>
<?php endforeach; ?>
<li>
<button class="elementor-link-dimensions tooltip-target" data-tooltip="<?php echo esc_attr__( 'Link values together', 'elementor' ); ?>">
<span class="elementor-linked">
<i class="eicon-link" aria-hidden="true"></i>
<span class="elementor-screen-only"><?php echo esc_html__( 'Link values together', 'elementor' ); ?></span>
</span>
<span class="elementor-unlinked">
<i class="eicon-chain-broken" aria-hidden="true"></i>
<span class="elementor-screen-only"><?php echo esc_html__( 'Unlinked values', 'elementor' ); ?></span>
</span>
</button>
</li>
</ul>
</div>
</div>
<# if ( data.description ) { #>
<div class="elementor-control-field-description">{{{ data.description }}}</div>
<# } #>
<?php
}
}

View File

@@ -0,0 +1,61 @@
<?php
namespace Elementor;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
/**
* Elementor divider control.
*
* A base control for creating divider control. Displays horizontal line in
* the panel.
*
* @since 2.0.0
*/
class Control_Divider extends Base_UI_Control {
/**
* Get divider control type.
*
* Retrieve the control type, in this case `divider`.
*
* @since 2.0.0
* @access public
*
* @return string Control type.
*/
public function get_type() {
return 'divider';
}
/**
* Get divider control default settings.
*
* Retrieve the default settings of the divider control. Used to
* return the default settings while initializing the divider
* control.
*
* @since 2.0.0
* @access protected
*
* @return array Control default settings.
*/
protected function get_default_settings() {
return [
'separator' => 'none',
];
}
/**
* Render divider control output in the editor.
*
* Used to generate the control HTML in the editor using Underscore JS
* template. The variables for the class are available using `data` JS
* object.
*
* @since 2.0.0
* @access public
*/
public function content_template() {}
}

View File

@@ -0,0 +1,108 @@
<?php
namespace Elementor;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
/**
* Elementor exit animation control.
*
* A control for creating exit animation. Displays a select box
* with the available exit animation effects @see Control_Exit_Animation::get_animations() .
*
* @since 2.5.0
*/
class Control_Exit_Animation extends Control_Animation {
/**
* Get control type.
*
* Retrieve the animation control type.
*
* @since 2.5.0
* @access public
*
* @return string Control type.
*/
public function get_type() {
return 'exit_animation';
}
/**
* Get animations list.
*
* Retrieve the list of all the available animations.
*
* @since 1.0.0
* @access public
* @static
*
* @return array Control type.
*/
public static function get_animations() {
$animations = [
'Fading' => [
'fadeIn' => 'Fade Out',
'fadeInDown' => 'Fade Out Up',
'fadeInLeft' => 'Fade Out Left',
'fadeInRight' => 'Fade Out Right',
'fadeInUp' => 'Fade Out Down',
],
'Zooming' => [
'zoomIn' => 'Zoom Out',
'zoomInDown' => 'Zoom Out Up',
'zoomInLeft' => 'Zoom Out Left',
'zoomInRight' => 'Zoom Out Right',
'zoomInUp' => 'Zoom Out Down',
],
'Sliding' => [
'slideInDown' => 'Slide Out Up',
'slideInLeft' => 'Slide Out Left',
'slideInRight' => 'Slide Out Right',
'slideInUp' => 'Slide Out Down',
],
'Rotating' => [
'rotateIn' => 'Rotate Out',
'rotateInDownLeft' => 'Rotate Out Up Left',
'rotateInDownRight' => 'Rotate Out Up Right',
'rotateInUpRight' => 'Rotate Out Down Left',
'rotateInUpLeft' => 'Rotate Out Down Right',
],
'Light Speed' => [
'lightSpeedIn' => 'Light Speed Out',
],
'Specials' => [
'rollIn' => 'Roll Out',
],
];
$additional_animations = [];
/**
* Exit animations.
*
* Filters the animations list displayed in the exit animations control.
*
* This hook can be used to register new animations in addition to the
* basic Elementor exit animations.
*
* @since 2.5.0
*
* @param array $additional_animations Additional animations array.
*/
$additional_animations = apply_filters( 'elementor/controls/exit-animations/additional_animations', $additional_animations );
return array_merge( $animations, $additional_animations );
}
public static function get_assets( $setting ) {
if ( ! $setting || 'none' === $setting ) {
return [];
}
return [
'styles' => [ 'e-animations' ],
];
}
}

View File

@@ -0,0 +1,85 @@
<?php
namespace Elementor;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
/**
* Elementor font control.
*
* A base control for creating font control. Displays font select box. The
* control allows you to set a list of fonts.
*
* @since 1.0.0
*/
class Control_Font extends Base_Data_Control {
/**
* Get font control type.
*
* Retrieve the control type, in this case `font`.
*
* @since 1.0.0
* @access public
*
* @return string Control type.
*/
public function get_type() {
return 'font';
}
/**
* Get font control default settings.
*
* Retrieve the default settings of the font control. Used to return the default
* settings while initializing the font control.
*
* @since 1.0.0
* @access protected
*
* @return array Control default settings.
*/
protected function get_default_settings() {
return [
'groups' => Fonts::get_font_groups(),
'options' => Fonts::get_fonts(),
];
}
/**
* Render font control output in the editor.
*
* Used to generate the control HTML in the editor using Underscore JS
* template. The variables for the class are available using `data` JS
* object.
*
* @since 1.0.0
* @access public
*/
public function content_template() {
?>
<div class="elementor-control-field">
<label for="<?php $this->print_control_uid(); ?>" class="elementor-control-title">{{{ data.label }}}</label>
<div class="elementor-control-input-wrapper elementor-control-unit-5">
<select id="<?php $this->print_control_uid(); ?>" class="elementor-control-font-family" data-setting="{{ data.name }}">
<option value=""><?php echo esc_html__( 'Default', 'elementor' ); ?></option>
<# _.each( data.groups, function( group_label, group_name ) {
var groupFonts = getFontsByGroups( group_name );
if ( ! _.isEmpty( groupFonts ) ) { #>
<optgroup label="{{ group_label }}">
<# _.each( groupFonts, function( fontType, fontName ) { #>
<option value="{{ fontName }}">{{{ fontName }}}</option>
<# } ); #>
</optgroup>
<# }
}); #>
</select>
</div>
</div>
<# if ( data.description ) { #>
<div class="elementor-control-field-description">{{{ data.description }}}</div>
<# } #>
<?php
}
}

View File

@@ -0,0 +1,132 @@
<?php
namespace Elementor;
use Elementor\Modules\DynamicTags\Module as TagsModule;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
/**
* Elementor gallery control.
*
* A base control for creating gallery chooser control. Based on the WordPress
* media library galleries. Used to select images from the WordPress media library.
*
* @since 1.0.0
*/
class Control_Gallery extends Base_Data_Control {
/**
* Get gallery control type.
*
* Retrieve the control type, in this case `gallery`.
*
* @since 1.0.0
* @access public
*
* @return string Control type.
*/
public function get_type() {
return 'gallery';
}
/**
* Import gallery images.
*
* Used to import gallery control files from external sites while importing
* Elementor template JSON file, and replacing the old data.
*
* @since 1.0.0
* @access public
*
* @param array $settings Control settings
*
* @return array Control settings.
*/
public function on_import( $settings ) {
foreach ( $settings as &$attachment ) {
if ( empty( $attachment['url'] ) ) {
continue;
}
$attachment = Plugin::$instance->templates_manager->get_import_images_instance()->import( $attachment );
}
// Filter out attachments that don't exist
$settings = array_filter( $settings );
return $settings;
}
/**
* Render gallery control output in the editor.
*
* Used to generate the control HTML in the editor using Underscore JS
* template. The variables for the class are available using `data` JS
* object.
*
* @since 1.0.0
* @access public
*/
public function content_template() {
?>
<div class="elementor-control-field">
<div class="elementor-control-title">{{{ data.label }}}</div>
<div class="elementor-control-input-wrapper">
<# if ( data.description ) { #>
<div class="elementor-control-field-description">{{{ data.description }}}</div>
<# } #>
<div class="elementor-control-media__content elementor-control-tag-area">
<div class="elementor-control-gallery-status elementor-control-dynamic-switcher-wrapper">
<span class="elementor-control-gallery-status-title"></span>
<span class="elementor-control-gallery-clear elementor-control-unit-1"><i class="eicon-trash-o" aria-hidden="true"></i></span>
</div>
<div class="elementor-control-gallery-content">
<div class="elementor-control-gallery-thumbnails"></div>
<div class="elementor-control-gallery-edit"><span><i class="eicon-pencil" aria-hidden="true"></i></span></div>
<button class="elementor-button elementor-control-gallery-add" aria-label="<?php echo esc_html__( 'Add Images', 'elementor' ); ?>"><i class="eicon-plus-circle" aria-hidden="true"></i></button>
</div>
</div>
</div>
</div>
<?php
}
/**
* Get gallery control default settings.
*
* Retrieve the default settings of the gallery control. Used to return the
* default settings while initializing the gallery control.
*
* @since 1.0.0
* @access protected
*
* @return array Control default settings.
*/
protected function get_default_settings() {
return [
'label_block' => true,
'separator' => 'none',
'dynamic' => [
'categories' => [ TagsModule::GALLERY_CATEGORY ],
'returnType' => 'object',
],
];
}
/**
* Get gallery control default values.
*
* Retrieve the default value of the gallery control. Used to return the default
* values while initializing the gallery control.
*
* @since 1.0.0
* @access public
*
* @return array Control default value.
*/
public function get_default_value() {
return [];
}
}

View File

@@ -0,0 +1,872 @@
<?php
namespace Elementor;
use Elementor\Core\Breakpoints\Manager as Breakpoints_Manager;
use Elementor\Modules\DynamicTags\Module as TagsModule;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
/**
* Elementor background control.
*
* A base control for creating background control. Displays input fields to define
* the background color, background image, background gradient or background video.
*
* @since 1.2.2
*/
class Group_Control_Background extends Group_Control_Base {
/**
* Fields.
*
* Holds all the background control fields.
*
* @since 1.2.2
* @access protected
* @static
*
* @var array Background control fields.
*/
protected static $fields;
/**
* Background Types.
*
* Holds all the available background types.
*
* @since 1.2.2
* @access private
* @static
*
* @var array
*/
private static $background_types;
/**
* Get background control type.
*
* Retrieve the control type, in this case `background`.
*
* @since 1.0.0
* @access public
* @static
*
* @return string Control type.
*/
public static function get_type() {
return 'background';
}
/**
* Get background control types.
*
* Retrieve available background types.
*
* @since 1.2.2
* @access public
* @static
*
* @return array Available background types.
*/
public static function get_background_types() {
if ( null === self::$background_types ) {
self::$background_types = self::get_default_background_types();
}
return self::$background_types;
}
/**
* Get Default background types.
*
* Retrieve background control initial types.
*
* @since 2.0.0
* @access private
* @static
*
* @return array Default background types.
*/
private static function get_default_background_types() {
return [
'classic' => [
'title' => _x( 'Classic', 'Background Control', 'elementor' ),
'icon' => 'eicon-paint-brush',
],
'gradient' => [
'title' => _x( 'Gradient', 'Background Control', 'elementor' ),
'icon' => 'eicon-barcode',
],
'video' => [
'title' => _x( 'Video', 'Background Control', 'elementor' ),
'icon' => 'eicon-video-camera',
],
'slideshow' => [
'title' => _x( 'Slideshow', 'Background Control', 'elementor' ),
'icon' => 'eicon-slideshow',
],
];
}
/**
* Init fields.
*
* Initialize background control fields.
*
* @since 1.2.2
* @access public
*
* @return array Control fields.
*/
public function init_fields() {
$fields = [];
$fields['background'] = [
'label' => _x( 'Background Type', 'Background Control', 'elementor' ),
'type' => Controls_Manager::CHOOSE,
'render_type' => 'ui',
];
$fields['color'] = [
'label' => _x( 'Color', 'Background Control', 'elementor' ),
'type' => Controls_Manager::COLOR,
'default' => '',
'title' => _x( 'Background Color', 'Background Control', 'elementor' ),
'selectors' => [
'{{SELECTOR}}' => 'background-color: {{VALUE}};',
],
'condition' => [
'background' => [ 'classic', 'gradient' ],
],
];
$fields['color_stop'] = [
'label' => _x( 'Location', 'Background Control', 'elementor' ),
'type' => Controls_Manager::SLIDER,
'size_units' => [ '%' ],
'default' => [
'unit' => '%',
'size' => 0,
],
'render_type' => 'ui',
'condition' => [
'background' => [ 'gradient' ],
],
'of_type' => 'gradient',
];
$fields['color_b'] = [
'label' => _x( 'Second Color', 'Background Control', 'elementor' ),
'type' => Controls_Manager::COLOR,
'default' => '#f2295b',
'render_type' => 'ui',
'condition' => [
'background' => [ 'gradient' ],
],
'of_type' => 'gradient',
];
$fields['color_b_stop'] = [
'label' => _x( 'Location', 'Background Control', 'elementor' ),
'type' => Controls_Manager::SLIDER,
'size_units' => [ '%' ],
'default' => [
'unit' => '%',
'size' => 100,
],
'render_type' => 'ui',
'condition' => [
'background' => [ 'gradient' ],
],
'of_type' => 'gradient',
];
$fields['gradient_type'] = [
'label' => _x( 'Type', 'Background Control', 'elementor' ),
'type' => Controls_Manager::SELECT,
'options' => [
'linear' => _x( 'Linear', 'Background Control', 'elementor' ),
'radial' => _x( 'Radial', 'Background Control', 'elementor' ),
],
'default' => 'linear',
'render_type' => 'ui',
'condition' => [
'background' => [ 'gradient' ],
],
'of_type' => 'gradient',
];
$fields['gradient_angle'] = [
'label' => _x( 'Angle', 'Background Control', 'elementor' ),
'type' => Controls_Manager::SLIDER,
'size_units' => [ 'deg' ],
'default' => [
'unit' => 'deg',
'size' => 180,
],
'range' => [
'deg' => [
'step' => 10,
],
],
'selectors' => [
'{{SELECTOR}}' => 'background-color: transparent; background-image: linear-gradient({{SIZE}}{{UNIT}}, {{color.VALUE}} {{color_stop.SIZE}}{{color_stop.UNIT}}, {{color_b.VALUE}} {{color_b_stop.SIZE}}{{color_b_stop.UNIT}})',
],
'condition' => [
'background' => [ 'gradient' ],
'gradient_type' => 'linear',
],
'of_type' => 'gradient',
];
$fields['gradient_position'] = [
'label' => _x( 'Position', 'Background Control', 'elementor' ),
'type' => Controls_Manager::SELECT,
'options' => [
'center center' => _x( 'Center Center', 'Background Control', 'elementor' ),
'center left' => _x( 'Center Left', 'Background Control', 'elementor' ),
'center right' => _x( 'Center Right', 'Background Control', 'elementor' ),
'top center' => _x( 'Top Center', 'Background Control', 'elementor' ),
'top left' => _x( 'Top Left', 'Background Control', 'elementor' ),
'top right' => _x( 'Top Right', 'Background Control', 'elementor' ),
'bottom center' => _x( 'Bottom Center', 'Background Control', 'elementor' ),
'bottom left' => _x( 'Bottom Left', 'Background Control', 'elementor' ),
'bottom right' => _x( 'Bottom Right', 'Background Control', 'elementor' ),
],
'default' => 'center center',
'selectors' => [
'{{SELECTOR}}' => 'background-color: transparent; background-image: radial-gradient(at {{VALUE}}, {{color.VALUE}} {{color_stop.SIZE}}{{color_stop.UNIT}}, {{color_b.VALUE}} {{color_b_stop.SIZE}}{{color_b_stop.UNIT}})',
],
'condition' => [
'background' => [ 'gradient' ],
'gradient_type' => 'radial',
],
'of_type' => 'gradient',
];
$fields['image'] = [
'label' => _x( 'Image', 'Background Control', 'elementor' ),
'type' => Controls_Manager::MEDIA,
'dynamic' => [
'active' => true,
],
'responsive' => true,
'title' => _x( 'Background Image', 'Background Control', 'elementor' ),
'selectors' => [
'{{SELECTOR}}' => 'background-image: url("{{URL}}");',
],
'render_type' => 'template',
'condition' => [
'background' => [ 'classic' ],
],
];
$fields['position'] = [
'label' => _x( 'Position', 'Background Control', 'elementor' ),
'type' => Controls_Manager::SELECT,
'default' => '',
'responsive' => true,
'options' => [
'' => _x( 'Default', 'Background Control', 'elementor' ),
'center center' => _x( 'Center Center', 'Background Control', 'elementor' ),
'center left' => _x( 'Center Left', 'Background Control', 'elementor' ),
'center right' => _x( 'Center Right', 'Background Control', 'elementor' ),
'top center' => _x( 'Top Center', 'Background Control', 'elementor' ),
'top left' => _x( 'Top Left', 'Background Control', 'elementor' ),
'top right' => _x( 'Top Right', 'Background Control', 'elementor' ),
'bottom center' => _x( 'Bottom Center', 'Background Control', 'elementor' ),
'bottom left' => _x( 'Bottom Left', 'Background Control', 'elementor' ),
'bottom right' => _x( 'Bottom Right', 'Background Control', 'elementor' ),
'initial' => _x( 'Custom', 'Background Control', 'elementor' ),
],
'selectors' => [
'{{SELECTOR}}' => 'background-position: {{VALUE}};',
],
'condition' => [
'background' => [ 'classic' ],
'image[url]!' => '',
],
];
$fields['xpos'] = [
'label' => _x( 'X Position', 'Background Control', 'elementor' ),
'type' => Controls_Manager::SLIDER,
'responsive' => true,
'size_units' => [ 'px', 'em', '%', 'vw' ],
'default' => [
'unit' => 'px',
'size' => 0,
],
'tablet_default' => [
'unit' => 'px',
'size' => 0,
],
'mobile_default' => [
'unit' => 'px',
'size' => 0,
],
'range' => [
'px' => [
'min' => -800,
'max' => 800,
],
'em' => [
'min' => -100,
'max' => 100,
],
'%' => [
'min' => -100,
'max' => 100,
],
'vw' => [
'min' => -100,
'max' => 100,
],
],
'selectors' => [
'{{SELECTOR}}' => 'background-position: {{SIZE}}{{UNIT}} {{ypos.SIZE}}{{ypos.UNIT}}',
],
'condition' => [
'background' => [ 'classic' ],
'position' => [ 'initial' ],
'image[url]!' => '',
],
'required' => true,
'device_args' => [
Breakpoints_Manager::BREAKPOINT_KEY_TABLET => [
'selectors' => [
'{{SELECTOR}}' => 'background-position: {{SIZE}}{{UNIT}} {{ypos_tablet.SIZE}}{{ypos_tablet.UNIT}}',
],
'condition' => [
'background' => [ 'classic' ],
'position_tablet' => [ 'initial' ],
],
],
Breakpoints_Manager::BREAKPOINT_KEY_MOBILE => [
'selectors' => [
'{{SELECTOR}}' => 'background-position: {{SIZE}}{{UNIT}} {{ypos_mobile.SIZE}}{{ypos_mobile.UNIT}}',
],
'condition' => [
'background' => [ 'classic' ],
'position_mobile' => [ 'initial' ],
],
],
],
];
$fields['ypos'] = [
'label' => _x( 'Y Position', 'Background Control', 'elementor' ),
'type' => Controls_Manager::SLIDER,
'responsive' => true,
'size_units' => [ 'px', 'em', '%', 'vh' ],
'default' => [
'unit' => 'px',
'size' => 0,
],
'tablet_default' => [
'unit' => 'px',
'size' => 0,
],
'mobile_default' => [
'unit' => 'px',
'size' => 0,
],
'range' => [
'px' => [
'min' => -800,
'max' => 800,
],
'em' => [
'min' => -100,
'max' => 100,
],
'%' => [
'min' => -100,
'max' => 100,
],
'vh' => [
'min' => -100,
'max' => 100,
],
],
'selectors' => [
'{{SELECTOR}}' => 'background-position: {{xpos.SIZE}}{{xpos.UNIT}} {{SIZE}}{{UNIT}}',
],
'condition' => [
'background' => [ 'classic' ],
'position' => [ 'initial' ],
'image[url]!' => '',
],
'required' => true,
'device_args' => [
Breakpoints_Manager::BREAKPOINT_KEY_TABLET => [
'selectors' => [
'{{SELECTOR}}' => 'background-position: {{xpos_tablet.SIZE}}{{xpos_tablet.UNIT}} {{SIZE}}{{UNIT}}',
],
'condition' => [
'background' => [ 'classic' ],
'position_tablet' => [ 'initial' ],
],
],
Breakpoints_Manager::BREAKPOINT_KEY_MOBILE => [
'selectors' => [
'{{SELECTOR}}' => 'background-position: {{xpos_mobile.SIZE}}{{xpos_mobile.UNIT}} {{SIZE}}{{UNIT}}',
],
'condition' => [
'background' => [ 'classic' ],
'position_mobile' => [ 'initial' ],
],
],
],
];
$fields['attachment'] = [
'label' => _x( 'Attachment', 'Background Control', 'elementor' ),
'type' => Controls_Manager::SELECT,
'default' => '',
'options' => [
'' => _x( 'Default', 'Background Control', 'elementor' ),
'scroll' => _x( 'Scroll', 'Background Control', 'elementor' ),
'fixed' => _x( 'Fixed', 'Background Control', 'elementor' ),
],
'selectors' => [
'(desktop+){{SELECTOR}}' => 'background-attachment: {{VALUE}};',
],
'condition' => [
'background' => [ 'classic' ],
'image[url]!' => '',
],
];
$fields['attachment_alert'] = [
'type' => Controls_Manager::RAW_HTML,
'content_classes' => 'elementor-control-field-description',
'raw' => esc_html__( 'Note: Attachment Fixed works only on desktop.', 'elementor' ),
'separator' => 'none',
'condition' => [
'background' => [ 'classic' ],
'image[url]!' => '',
'attachment' => 'fixed',
],
];
$fields['repeat'] = [
'label' => _x( 'Repeat', 'Background Control', 'elementor' ),
'type' => Controls_Manager::SELECT,
'default' => '',
'responsive' => true,
'options' => [
'' => _x( 'Default', 'Background Control', 'elementor' ),
'no-repeat' => _x( 'No-repeat', 'Background Control', 'elementor' ),
'repeat' => _x( 'Repeat', 'Background Control', 'elementor' ),
'repeat-x' => _x( 'Repeat-x', 'Background Control', 'elementor' ),
'repeat-y' => _x( 'Repeat-y', 'Background Control', 'elementor' ),
],
'selectors' => [
'{{SELECTOR}}' => 'background-repeat: {{VALUE}};',
],
'condition' => [
'background' => [ 'classic' ],
'image[url]!' => '',
],
];
$fields['size'] = [
'label' => _x( 'Size', 'Background Control', 'elementor' ),
'type' => Controls_Manager::SELECT,
'responsive' => true,
'default' => '',
'options' => [
'' => _x( 'Default', 'Background Control', 'elementor' ),
'auto' => _x( 'Auto', 'Background Control', 'elementor' ),
'cover' => _x( 'Cover', 'Background Control', 'elementor' ),
'contain' => _x( 'Contain', 'Background Control', 'elementor' ),
'initial' => _x( 'Custom', 'Background Control', 'elementor' ),
],
'selectors' => [
'{{SELECTOR}}' => 'background-size: {{VALUE}};',
],
'condition' => [
'background' => [ 'classic' ],
'image[url]!' => '',
],
];
$fields['bg_width'] = [
'label' => _x( 'Width', 'Background Control', 'elementor' ),
'type' => Controls_Manager::SLIDER,
'responsive' => true,
'size_units' => [ 'px', 'em', '%', 'vw' ],
'range' => [
'px' => [
'min' => 0,
'max' => 1000,
],
'%' => [
'min' => 0,
'max' => 100,
],
'vw' => [
'min' => 0,
'max' => 100,
],
],
'default' => [
'size' => 100,
'unit' => '%',
],
'required' => true,
'selectors' => [
'{{SELECTOR}}' => 'background-size: {{SIZE}}{{UNIT}} auto',
],
'condition' => [
'background' => [ 'classic' ],
'size' => [ 'initial' ],
'image[url]!' => '',
],
'device_args' => [
Breakpoints_Manager::BREAKPOINT_KEY_TABLET => [
'selectors' => [
'{{SELECTOR}}' => 'background-size: {{SIZE}}{{UNIT}} auto',
],
'condition' => [
'background' => [ 'classic' ],
'size_tablet' => [ 'initial' ],
],
],
Breakpoints_Manager::BREAKPOINT_KEY_MOBILE => [
'selectors' => [
'{{SELECTOR}}' => 'background-size: {{SIZE}}{{UNIT}} auto',
],
'condition' => [
'background' => [ 'classic' ],
'size_mobile' => [ 'initial' ],
],
],
],
];
$fields['video_link'] = [
'label' => _x( 'Video Link', 'Background Control', 'elementor' ),
'type' => Controls_Manager::TEXT,
'placeholder' => 'https://www.youtube.com/watch?v=XHOmBV4js_E',
'description' => esc_html__( 'YouTube/Vimeo link, or link to video file (mp4 is recommended).', 'elementor' ),
'label_block' => true,
'default' => '',
'dynamic' => [
'active' => true,
'categories' => [
TagsModule::POST_META_CATEGORY,
TagsModule::URL_CATEGORY,
],
],
'condition' => [
'background' => [ 'video' ],
],
'of_type' => 'video',
'frontend_available' => true,
];
$fields['video_start'] = [
'label' => esc_html__( 'Start Time', 'elementor' ),
'type' => Controls_Manager::NUMBER,
'description' => esc_html__( 'Specify a start time (in seconds)', 'elementor' ),
'placeholder' => 10,
'condition' => [
'background' => [ 'video' ],
],
'of_type' => 'video',
'frontend_available' => true,
];
$fields['video_end'] = [
'label' => esc_html__( 'End Time', 'elementor' ),
'type' => Controls_Manager::NUMBER,
'description' => esc_html__( 'Specify an end time (in seconds)', 'elementor' ),
'placeholder' => 70,
'condition' => [
'background' => [ 'video' ],
],
'of_type' => 'video',
'frontend_available' => true,
];
$fields['play_once'] = [
'label' => esc_html__( 'Play Once', 'elementor' ),
'type' => Controls_Manager::SWITCHER,
'condition' => [
'background' => [ 'video' ],
],
'of_type' => 'video',
'frontend_available' => true,
];
$fields['play_on_mobile'] = [
'label' => esc_html__( 'Play On Mobile', 'elementor' ),
'type' => Controls_Manager::SWITCHER,
'condition' => [
'background' => [ 'video' ],
],
'of_type' => 'video',
'frontend_available' => true,
];
// This control was added to handle a bug with the Youtube Embed API. The bug: If there is a video with Privacy
// Mode on, and at the same time the page contains another video WITHOUT privacy mode on, one of the videos
// will not run properly. This added control allows users to align all their videos to one host (either
// youtube.com or youtube-nocookie.com, depending on whether the user wants privacy mode on or not).
$fields['privacy_mode'] = [
'label' => esc_html__( 'Privacy mode', 'elementor' ),
'type' => Controls_Manager::SWITCHER,
'description' => esc_html__( 'Only works for YouTube videos.', 'elementor' ),
'condition' => [
'background' => [ 'video' ],
],
'of_type' => 'video',
'frontend_available' => true,
];
$fields['video_fallback'] = [
'label' => _x( 'Background Fallback', 'Background Control', 'elementor' ),
'description' => esc_html__( 'This cover image will replace the background video in case that the video could not be loaded.', 'elementor' ),
'type' => Controls_Manager::MEDIA,
'dynamic' => [
'active' => true,
],
'condition' => [
'background' => [ 'video' ],
],
'selectors' => [
'{{SELECTOR}}' => 'background: url("{{URL}}") 50% 50%; background-size: cover;',
],
'of_type' => 'video',
];
$fields['slideshow_gallery'] = [
'label' => _x( 'Images', 'Background Control', 'elementor' ),
'type' => Controls_Manager::GALLERY,
'condition' => [
'background' => [ 'slideshow' ],
],
'show_label' => false,
'of_type' => 'slideshow',
'frontend_available' => true,
];
$fields['slideshow_loop'] = [
'label' => esc_html__( 'Infinite Loop', 'elementor' ),
'type' => Controls_Manager::SWITCHER,
'default' => 'yes',
'condition' => [
'background' => [ 'slideshow' ],
],
'of_type' => 'slideshow',
'frontend_available' => true,
];
$fields['slideshow_slide_duration'] = [
'label' => esc_html__( 'Duration', 'elementor' ) . ' (ms)',
'type' => Controls_Manager::NUMBER,
'default' => 5000,
'condition' => [
'background' => [ 'slideshow' ],
],
'frontend_available' => true,
];
$fields['slideshow_slide_transition'] = [
'label' => esc_html__( 'Transition', 'elementor' ),
'type' => Controls_Manager::SELECT,
'default' => 'fade',
'options' => [
'fade' => 'Fade',
'slide_right' => 'Slide Right',
'slide_left' => 'Slide Left',
'slide_up' => 'Slide Up',
'slide_down' => 'Slide Down',
],
'condition' => [
'background' => [ 'slideshow' ],
],
'of_type' => 'slideshow',
'frontend_available' => true,
];
$fields['slideshow_transition_duration'] = [
'label' => esc_html__( 'Transition Duration', 'elementor' ) . ' (ms)',
'type' => Controls_Manager::NUMBER,
'default' => 500,
'condition' => [
'background' => [ 'slideshow' ],
],
'frontend_available' => true,
];
$fields['slideshow_background_size'] = [
'label' => esc_html__( 'Background Size', 'elementor' ),
'type' => Controls_Manager::SELECT,
'responsive' => true,
'default' => '',
'options' => [
'' => esc_html__( 'Default', 'elementor' ),
'auto' => esc_html__( 'Auto', 'elementor' ),
'cover' => esc_html__( 'Cover', 'elementor' ),
'contain' => esc_html__( 'Contain', 'elementor' ),
],
'selectors' => [
'{{WRAPPER}} .elementor-background-slideshow__slide__image' => 'background-size: {{VALUE}};',
],
'condition' => [
'background' => [ 'slideshow' ],
],
];
$fields['slideshow_background_position'] = [
'label' => esc_html__( 'Background Position', 'elementor' ),
'type' => Controls_Manager::SELECT,
'default' => '',
'responsive' => true,
'options' => [
'' => esc_html__( 'Default', 'elementor' ),
'center center' => _x( 'Center Center', 'Background Control', 'elementor' ),
'center left' => _x( 'Center Left', 'Background Control', 'elementor' ),
'center right' => _x( 'Center Right', 'Background Control', 'elementor' ),
'top center' => _x( 'Top Center', 'Background Control', 'elementor' ),
'top left' => _x( 'Top Left', 'Background Control', 'elementor' ),
'top right' => _x( 'Top Right', 'Background Control', 'elementor' ),
'bottom center' => _x( 'Bottom Center', 'Background Control', 'elementor' ),
'bottom left' => _x( 'Bottom Left', 'Background Control', 'elementor' ),
'bottom right' => _x( 'Bottom Right', 'Background Control', 'elementor' ),
],
'selectors' => [
'{{WRAPPER}} .elementor-background-slideshow__slide__image' => 'background-position: {{VALUE}};',
],
'condition' => [
'background' => [ 'slideshow' ],
],
];
$fields['slideshow_ken_burns'] = [
'label' => esc_html__( 'Ken Burns Effect', 'elementor' ),
'type' => Controls_Manager::SWITCHER,
'separator' => 'before',
'condition' => [
'background' => [ 'slideshow' ],
],
'of_type' => 'slideshow',
'frontend_available' => true,
];
$fields['slideshow_ken_burns_zoom_direction'] = [
'label' => esc_html__( 'Direction', 'elementor' ),
'type' => Controls_Manager::SELECT,
'default' => 'in',
'options' => [
'in' => esc_html__( 'In', 'elementor' ),
'out' => esc_html__( 'Out', 'elementor' ),
],
'condition' => [
'background' => [ 'slideshow' ],
'slideshow_ken_burns!' => '',
],
'of_type' => 'slideshow',
'frontend_available' => true,
];
return $fields;
}
/**
* Get child default args.
*
* Retrieve the default arguments for all the child controls for a specific group
* control.
*
* @since 1.2.2
* @access protected
*
* @return array Default arguments for all the child controls.
*/
protected function get_child_default_args() {
return [
'types' => [ 'classic', 'gradient' ],
'selector' => '{{WRAPPER}}:not(.elementor-motion-effects-element-type-background), {{WRAPPER}} > .elementor-motion-effects-container > .elementor-motion-effects-layer',
];
}
/**
* Filter fields.
*
* Filter which controls to display, using `include`, `exclude`, `condition`
* and `of_type` arguments.
*
* @since 1.2.2
* @access protected
*
* @return array Control fields.
*/
protected function filter_fields() {
$fields = parent::filter_fields();
$args = $this->get_args();
foreach ( $fields as &$field ) {
if ( isset( $field['of_type'] ) && ! in_array( $field['of_type'], $args['types'] ) ) {
unset( $field );
}
}
return $fields;
}
/**
* Prepare fields.
*
* Process background control fields before adding them to `add_control()`.
*
* @since 1.2.2
* @access protected
*
* @param array $fields Background control fields.
*
* @return array Processed fields.
*/
protected function prepare_fields( $fields ) {
$args = $this->get_args();
$background_types = self::get_background_types();
$choose_types = [];
foreach ( $args['types'] as $type ) {
if ( isset( $background_types[ $type ] ) ) {
$choose_types[ $type ] = $background_types[ $type ];
}
}
$fields['background']['options'] = $choose_types;
return parent::prepare_fields( $fields );
}
/**
* Get default options.
*
* Retrieve the default options of the background control. Used to return the
* default options while initializing the background control.
*
* @since 1.9.0
* @access protected
*
* @return array Default background control options.
*/
protected function get_default_options() {
return [
'popover' => false,
];
}
}

View File

@@ -0,0 +1,592 @@
<?php
namespace Elementor;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
/**
* Elementor group control base.
*
* An abstract class for creating new group controls in the panel.
*
* @since 1.0.0
* @abstract
*/
abstract class Group_Control_Base implements Group_Control_Interface {
/**
* Arguments.
*
* Holds all the group control arguments.
*
* @access private
*
* @var array Group control arguments.
*/
private $args = [];
/**
* Options.
*
* Holds all the group control options.
*
* Currently supports only the popover options.
*
* @access private
*
* @var array Group control options.
*/
private $options;
/**
* Get options.
*
* Retrieve group control options. If options are not set, it will initialize default options.
*
* @since 1.9.0
* @access public
*
* @param array $option Optional. Single option.
*
* @return mixed Group control options. If option parameter was not specified, it will
* return an array of all the options. If single option specified, it will
* return the option value or `null` if option does not exists.
*/
final public function get_options( $option = null ) {
if ( null === $this->options ) {
$this->init_options();
}
if ( $option ) {
if ( isset( $this->options[ $option ] ) ) {
return $this->options[ $option ];
}
return null;
}
return $this->options;
}
/**
* Add new controls to stack.
*
* Register multiple controls to allow the user to set/update data.
*
* @since 1.0.0
* @access public
*
* @param Controls_Stack $element The element stack.
* @param array $user_args The control arguments defined by the user.
* @param array $options Optional. The element options. Default is
* an empty array.
*/
final public function add_controls( Controls_Stack $element, array $user_args, array $options = [] ) {
$this->init_args( $user_args );
// Filter which controls to display
$filtered_fields = $this->filter_fields();
$filtered_fields = $this->prepare_fields( $filtered_fields );
// For php < 7
reset( $filtered_fields );
if ( isset( $this->args['separator'] ) ) {
$filtered_fields[ key( $filtered_fields ) ]['separator'] = $this->args['separator'];
}
$has_injection = false;
if ( ! empty( $options['position'] ) ) {
$has_injection = true;
$element->start_injection( $options['position'] );
unset( $options['position'] );
}
if ( $this->get_options( 'popover' ) ) {
$this->start_popover( $element );
}
foreach ( $filtered_fields as $field_id => $field_args ) {
// Add the global group args to the control
$field_args = $this->add_group_args_to_field( $field_id, $field_args );
// Register the control
$id = $this->get_controls_prefix() . $field_id;
if ( ! empty( $field_args['responsive'] ) ) {
unset( $field_args['responsive'] );
$element->add_responsive_control( $id, $field_args, $options );
} else {
$element->add_control( $id, $field_args, $options );
}
}
if ( $this->get_options( 'popover' ) ) {
$element->end_popover();
}
if ( $has_injection ) {
$element->end_injection();
}
}
/**
* Get arguments.
*
* Retrieve group control arguments.
*
* @since 1.0.0
* @access public
*
* @return array Group control arguments.
*/
final public function get_args() {
return $this->args;
}
/**
* Get fields.
*
* Retrieve group control fields.
*
* @since 1.2.2
* @access public
*
* @return array Control fields.
*/
final public function get_fields() {
if ( null === static::$fields ) {
static::$fields = $this->init_fields();
}
return static::$fields;
}
/**
* Get controls prefix.
*
* Retrieve the prefix of the group control, which is `{{ControlName}}_`.
*
* @since 1.0.0
* @access public
*
* @return string Control prefix.
*/
public function get_controls_prefix() {
return $this->args['name'] . '_';
}
/**
* Get group control classes.
*
* Retrieve the classes of the group control.
*
* @since 1.0.0
* @access public
*
* @return string Group control classes.
*/
public function get_base_group_classes() {
return 'elementor-group-control-' . static::get_type() . ' elementor-group-control';
}
/**
* Init fields.
*
* Initialize group control fields.
*
* @abstract
* @since 1.2.2
* @access protected
*/
abstract protected function init_fields();
/**
* Get default options.
*
* Retrieve the default options of the group control. Used to return the
* default options while initializing the group control.
*
* @since 1.9.0
* @access protected
*
* @return array Default group control options.
*/
protected function get_default_options() {
return [];
}
/**
* Get child default arguments.
*
* Retrieve the default arguments for all the child controls for a specific group
* control.
*
* @since 1.2.2
* @access protected
*
* @return array Default arguments for all the child controls.
*/
protected function get_child_default_args() {
return [];
}
/**
* Filter fields.
*
* Filter which controls to display, using `include`, `exclude` and the
* `condition` arguments.
*
* @since 1.2.2
* @access protected
*
* @return array Control fields.
*/
protected function filter_fields() {
$args = $this->get_args();
$fields = $this->get_fields();
if ( ! empty( $args['include'] ) ) {
$fields = array_intersect_key( $fields, array_flip( $args['include'] ) );
}
if ( ! empty( $args['exclude'] ) ) {
$fields = array_diff_key( $fields, array_flip( $args['exclude'] ) );
}
return $fields;
}
/**
* Add group arguments to field.
*
* Register field arguments to group control.
*
* @since 1.2.2
* @access protected
*
* @param string $control_id Group control id.
* @param array $field_args Group control field arguments.
*
* @return array
*/
protected function add_group_args_to_field( $control_id, $field_args ) {
$args = $this->get_args();
if ( ! empty( $args['tab'] ) ) {
$field_args['tab'] = $args['tab'];
}
if ( ! empty( $args['section'] ) ) {
$field_args['section'] = $args['section'];
}
$field_args['classes'] = $this->get_base_group_classes() . ' elementor-group-control-' . $control_id;
foreach ( [ 'condition', 'conditions' ] as $condition_type ) {
if ( ! empty( $args[ $condition_type ] ) ) {
if ( empty( $field_args[ $condition_type ] ) ) {
$field_args[ $condition_type ] = [];
}
$field_args[ $condition_type ] += $args[ $condition_type ];
}
}
return $field_args;
}
/**
* Prepare fields.
*
* Process group control fields before adding them to `add_control()`.
*
* @since 1.2.2
* @access protected
*
* @param array $fields Group control fields.
*
* @return array Processed fields.
*/
protected function prepare_fields( $fields ) {
$popover_options = $this->get_options( 'popover' );
$popover_name = ! $popover_options ? null : $popover_options['starter_name'];
foreach ( $fields as $field_key => &$field ) {
if ( $popover_name ) {
$field['condition'][ $popover_name . '!' ] = '';
}
if ( isset( $this->args['fields_options']['__all'] ) ) {
$field = array_merge( $field, $this->args['fields_options']['__all'] );
}
if ( isset( $this->args['fields_options'][ $field_key ] ) ) {
$field = array_merge( $field, $this->args['fields_options'][ $field_key ] );
}
if ( ! empty( $field['condition'] ) ) {
$field = $this->add_condition_prefix( $field );
}
if ( ! empty( $field['conditions'] ) ) {
$field['conditions'] = $this->add_conditions_prefix( $field['conditions'] );
}
if ( ! empty( $field['selectors'] ) ) {
$field['selectors'] = $this->handle_selectors( $field['selectors'] );
}
if ( ! empty( $field['device_args'] ) ) {
foreach ( $field['device_args'] as $device => $device_arg ) {
if ( ! empty( $field['device_args'][ $device ]['condition'] ) ) {
$field['device_args'][ $device ] = $this->add_condition_prefix( $field['device_args'][ $device ] );
}
if ( ! empty( $field['device_args'][ $device ]['conditions'] ) ) {
$field['device_args'][ $device ]['conditions'] = $this->add_conditions_prefix( $field['device_args'][ $device ]['conditions'] );
}
if ( ! empty( $device_arg['selectors'] ) ) {
$field['device_args'][ $device ]['selectors'] = $this->handle_selectors( $device_arg['selectors'] );
}
}
}
}
return $fields;
}
/**
* Init options.
*
* Initializing group control options.
*
* @since 1.9.0
* @access private
*/
private function init_options() {
$default_options = [
'popover' => [
'starter_name' => 'popover_toggle',
'starter_value' => 'custom',
'starter_title' => '',
],
];
$this->options = array_replace_recursive( $default_options, $this->get_default_options() );
}
/**
* Init arguments.
*
* Initializing group control base class.
*
* @since 1.2.2
* @access protected
*
* @param array $args Group control settings value.
*/
protected function init_args( $args ) {
$this->args = array_merge( $this->get_default_args(), $this->get_child_default_args(), $args );
if ( isset( $this->args['scheme'] ) ) {
$this->args['global']['default'] = Plugin::$instance->kits_manager->convert_scheme_to_global( $this->args['scheme'] );
}
}
/**
* Get default arguments.
*
* Retrieve the default arguments of the group control. Used to return the
* default arguments while initializing the group control.
*
* @since 1.2.2
* @access private
*
* @return array Control default arguments.
*/
private function get_default_args() {
return [
'default' => '',
'selector' => '{{WRAPPER}}',
'fields_options' => [],
];
}
/**
* Add condition prefix.
*
* Used to add the group prefix to controls with conditions, to
* distinguish them from other controls with the same name.
*
* This way Elementor can apply condition logic to a specific control in a
* group control.
*
* @since 1.2.0
* @access private
*
* @param array $field Group control field.
*
* @return array Group control field.
*/
private function add_condition_prefix( $field ) {
$controls_prefix = $this->get_controls_prefix();
$prefixed_condition_keys = array_map(
function( $key ) use ( $controls_prefix ) {
return $controls_prefix . $key;
},
array_keys( $field['condition'] )
);
$field['condition'] = array_combine(
$prefixed_condition_keys,
$field['condition']
);
return $field;
}
private function add_conditions_prefix( $conditions ) {
$controls_prefix = $this->get_controls_prefix();
foreach ( $conditions['terms'] as & $condition ) {
if ( isset( $condition['terms'] ) ) {
$condition = $this->add_conditions_prefix( $condition );
continue;
}
$condition['name'] = $controls_prefix . $condition['name'];
}
return $conditions;
}
/**
* Handle selectors.
*
* Used to process the CSS selector of group control fields. When using
* group control, Elementor needs to apply the selector to different fields.
* This method handles the process.
*
* In addition, it handles selector values from other fields and process the
* css.
*
* @since 1.2.2
* @access private
*
* @param array $selectors An array of selectors to process.
*
* @return array Processed selectors.
*/
private function handle_selectors( $selectors ) {
$args = $this->get_args();
$selectors = array_combine(
array_map(
function( $key ) use ( $args ) {
return str_replace( '{{SELECTOR}}', $args['selector'], $key );
}, array_keys( $selectors )
),
$selectors
);
if ( ! $selectors ) {
return $selectors;
}
$controls_prefix = $this->get_controls_prefix();
foreach ( $selectors as &$selector ) {
$selector = preg_replace_callback( '/{{\K(.*?)(?=}})/', function( $matches ) use ( $controls_prefix ) {
$is_external_reference = false;
return preg_replace_callback( '/[^ ]+?(?=\.)\./', function( $sub_matches ) use ( $controls_prefix, &$is_external_reference ) {
$placeholder = $sub_matches[0];
if ( 'external.' === $placeholder ) {
$is_external_reference = true;
return '';
}
if ( $is_external_reference ) {
$is_external_reference = false;
return $placeholder;
}
return $controls_prefix . $placeholder;
}, $matches[1] );
}, $selector );
}
return $selectors;
}
/**
* Start popover.
*
* Starts a group controls popover.
*
* @since 1.9.1
* @access private
* @param Controls_Stack $element Element.
*/
private function start_popover( Controls_Stack $element ) {
$popover_options = $this->get_options( 'popover' );
$settings = $this->get_args();
if ( isset( $settings['global'] ) ) {
if ( ! isset( $popover_options['settings']['global'] ) ) {
$popover_options['settings']['global'] = [];
}
$popover_options['settings']['global'] = array_replace_recursive( $popover_options['settings']['global'], $settings['global'] );
}
if ( isset( $settings['label'] ) ) {
$label = $settings['label'];
} else {
$label = $popover_options['starter_title'];
}
$control_params = [
'type' => Controls_Manager::POPOVER_TOGGLE,
'label' => $label,
'return_value' => $popover_options['starter_value'],
];
if ( ! empty( $popover_options['settings'] ) ) {
$control_params = array_replace_recursive( $control_params, $popover_options['settings'] );
}
foreach ( [ 'condition', 'conditions' ] as $key ) {
if ( ! empty( $settings[ $key ] ) ) {
$control_params[ $key ] = $settings[ $key ];
}
}
$starter_name = $popover_options['starter_name'];
if ( isset( $this->args['fields_options'][ $starter_name ] ) ) {
$control_params = array_merge( $control_params, $this->args['fields_options'][ $starter_name ] );
}
$control_params['groupPrefix'] = $this->get_controls_prefix();
$element->add_control( $this->get_controls_prefix() . $starter_name, $control_params );
$element->start_popover();
}
}

View File

@@ -0,0 +1,118 @@
<?php
namespace Elementor;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
/**
* Elementor border control.
*
* A base control for creating border control. Displays input fields to define
* border type, border width and border color.
*
* @since 1.0.0
*/
class Group_Control_Border extends Group_Control_Base {
/**
* Fields.
*
* Holds all the border control fields.
*
* @since 1.0.0
* @access protected
* @static
*
* @var array Border control fields.
*/
protected static $fields;
/**
* Get border control type.
*
* Retrieve the control type, in this case `border`.
*
* @since 1.0.0
* @access public
* @static
*
* @return string Control type.
*/
public static function get_type() {
return 'border';
}
/**
* Init fields.
*
* Initialize border control fields.
*
* @since 1.2.2
* @access protected
*
* @return array Control fields.
*/
protected function init_fields() {
$fields = [];
$fields['border'] = [
'label' => _x( 'Border Type', 'Border Control', 'elementor' ),
'type' => Controls_Manager::SELECT,
'options' => [
'' => esc_html__( 'None', 'elementor' ),
'solid' => _x( 'Solid', 'Border Control', 'elementor' ),
'double' => _x( 'Double', 'Border Control', 'elementor' ),
'dotted' => _x( 'Dotted', 'Border Control', 'elementor' ),
'dashed' => _x( 'Dashed', 'Border Control', 'elementor' ),
'groove' => _x( 'Groove', 'Border Control', 'elementor' ),
],
'selectors' => [
'{{SELECTOR}}' => 'border-style: {{VALUE}};',
],
];
$fields['width'] = [
'label' => _x( 'Width', 'Border Control', 'elementor' ),
'type' => Controls_Manager::DIMENSIONS,
'selectors' => [
'{{SELECTOR}}' => 'border-width: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
],
'condition' => [
'border!' => '',
],
'responsive' => true,
];
$fields['color'] = [
'label' => _x( 'Color', 'Border Control', 'elementor' ),
'type' => Controls_Manager::COLOR,
'default' => '',
'selectors' => [
'{{SELECTOR}}' => 'border-color: {{VALUE}};',
],
'condition' => [
'border!' => '',
],
];
return $fields;
}
/**
* Get default options.
*
* Retrieve the default options of the border control. Used to return the
* default options while initializing the border control.
*
* @since 1.9.0
* @access protected
*
* @return array Default border control options.
*/
protected function get_default_options() {
return [
'popover' => false,
];
}
}

View File

@@ -0,0 +1,105 @@
<?php
namespace Elementor;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
/**
* Elementor box shadow control.
*
* A base control for creating box shadow control. Displays input fields to define
* the box shadow including the horizontal shadow, vertical shadow, shadow blur,
* shadow spread, shadow color and the position.
*
* @since 1.2.2
*/
class Group_Control_Box_Shadow extends Group_Control_Base {
/**
* Fields.
*
* Holds all the box shadow control fields.
*
* @since 1.2.2
* @access protected
* @static
*
* @var array Box shadow control fields.
*/
protected static $fields;
/**
* Get box shadow control type.
*
* Retrieve the control type, in this case `box-shadow`.
*
* @since 1.0.0
* @access public
* @static
*
* @return string Control type.
*/
public static function get_type() {
return 'box-shadow';
}
/**
* Init fields.
*
* Initialize box shadow control fields.
*
* @since 1.2.2
* @access protected
*
* @return array Control fields.
*/
protected function init_fields() {
$controls = [];
$controls['box_shadow'] = [
'label' => _x( 'Box Shadow', 'Box Shadow Control', 'elementor' ),
'type' => Controls_Manager::BOX_SHADOW,
'selectors' => [
'{{SELECTOR}}' => 'box-shadow: {{HORIZONTAL}}px {{VERTICAL}}px {{BLUR}}px {{SPREAD}}px {{COLOR}} {{box_shadow_position.VALUE}};',
],
];
$controls['box_shadow_position'] = [
'label' => _x( 'Position', 'Box Shadow Control', 'elementor' ),
'type' => Controls_Manager::SELECT,
'options' => [
' ' => _x( 'Outline', 'Box Shadow Control', 'elementor' ),
'inset' => _x( 'Inset', 'Box Shadow Control', 'elementor' ),
],
'default' => ' ',
'render_type' => 'ui',
];
return $controls;
}
/**
* Get default options.
*
* Retrieve the default options of the box shadow control. Used to return the
* default options while initializing the box shadow control.
*
* @since 1.9.0
* @access protected
*
* @return array Default box shadow control options.
*/
protected function get_default_options() {
return [
'popover' => [
'starter_title' => _x( 'Box Shadow', 'Box Shadow Control', 'elementor' ),
'starter_name' => 'box_shadow_type',
'starter_value' => 'yes',
'settings' => [
'render_type' => 'ui',
],
],
];
}
}

View File

@@ -0,0 +1,173 @@
<?php
namespace Elementor;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
/**
* Elementor CSS Filter control.
*
* A base control for applying css filters. Displays sliders to define the
* values of different CSS filters including blur, brightens, contrast,
* saturation and hue.
*
* @since 2.1.0
*/
class Group_Control_Css_Filter extends Group_Control_Base {
/**
* Prepare fields.
*
* Process css_filter control fields before adding them to `add_control()`.
*
* @since 2.1.0
* @access protected
*
* @param array $fields CSS filter control fields.
*
* @return array Processed fields.
*/
protected static $fields;
/**
* Get CSS filter control type.
*
* Retrieve the control type, in this case `css-filter`.
*
* @since 2.1.0
* @access public
* @static
*
* @return string Control type.
*/
public static function get_type() {
return 'css-filter';
}
/**
* Init fields.
*
* Initialize CSS filter control fields.
*
* @since 2.1.0
* @access protected
*
* @return array Control fields.
*/
protected function init_fields() {
$controls = [];
$controls['blur'] = [
'label' => _x( 'Blur', 'Filter Control', 'elementor' ),
'type' => Controls_Manager::SLIDER,
'required' => 'true',
'range' => [
'px' => [
'min' => 0,
'max' => 10,
'step' => 0.1,
],
],
'default' => [
'size' => 0,
],
'selectors' => [
'{{SELECTOR}}' => 'filter: brightness( {{brightness.SIZE}}% ) contrast( {{contrast.SIZE}}% ) saturate( {{saturate.SIZE}}% ) blur( {{blur.SIZE}}px ) hue-rotate( {{hue.SIZE}}deg )',
],
];
$controls['brightness'] = [
'label' => _x( 'Brightness', 'Filter Control', 'elementor' ),
'type' => Controls_Manager::SLIDER,
'render_type' => 'ui',
'required' => 'true',
'default' => [
'size' => 100,
],
'range' => [
'px' => [
'min' => 0,
'max' => 200,
],
],
'separator' => 'none',
];
$controls['contrast'] = [
'label' => _x( 'Contrast', 'Filter Control', 'elementor' ),
'type' => Controls_Manager::SLIDER,
'render_type' => 'ui',
'required' => 'true',
'default' => [
'size' => 100,
],
'range' => [
'px' => [
'min' => 0,
'max' => 200,
],
],
'separator' => 'none',
];
$controls['saturate'] = [
'label' => _x( 'Saturation', 'Filter Control', 'elementor' ),
'type' => Controls_Manager::SLIDER,
'render_type' => 'ui',
'required' => 'true',
'default' => [
'size' => 100,
],
'range' => [
'px' => [
'min' => 0,
'max' => 200,
],
],
'separator' => 'none',
];
$controls['hue'] = [
'label' => _x( 'Hue', 'Filter Control', 'elementor' ),
'type' => Controls_Manager::SLIDER,
'render_type' => 'ui',
'required' => 'true',
'default' => [
'size' => 0,
],
'range' => [
'px' => [
'min' => 0,
'max' => 360,
],
],
'separator' => 'none',
];
return $controls;
}
/**
* Get default options.
*
* Retrieve the default options of the CSS filter control. Used to return the
* default options while initializing the CSS filter control.
*
* @since 2.1.0
* @access protected
*
* @return array Default CSS filter control options.
*/
protected function get_default_options() {
return [
'popover' => [
'starter_name' => 'css_filter',
'starter_title' => _x( 'CSS Filters', 'Filter Control', 'elementor' ),
'settings' => [
'render_type' => 'ui',
],
],
];
}
}

View File

@@ -0,0 +1,400 @@
<?php
namespace Elementor;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
/**
* Elementor image size control.
*
* A base control for creating image size control. Displays input fields to define
* one of the default image sizes (thumbnail, medium, medium_large, large) or custom
* image dimensions.
*
* @since 1.0.0
*/
class Group_Control_Image_Size extends Group_Control_Base {
/**
* Fields.
*
* Holds all the image size control fields.
*
* @since 1.2.2
* @access protected
* @static
*
* @var array Image size control fields.
*/
protected static $fields;
/**
* Get image size control type.
*
* Retrieve the control type, in this case `image-size`.
*
* @since 1.0.0
* @access public
* @static
*
* @return string Control type.
*/
public static function get_type() {
return 'image-size';
}
/**
* Get attachment image HTML.
*
* Retrieve the attachment image HTML code.
*
* Note that some widgets use the same key for the media control that allows
* the image selection and for the image size control that allows the user
* to select the image size, in this case the third parameter should be null
* or the same as the second parameter. But when the widget uses different
* keys for the media control and the image size control, when calling this
* method you should pass the keys.
*
* @since 1.0.0
* @access public
* @static
*
* @param array $settings Control settings.
* @param string $image_size_key Optional. Settings key for image size.
* Default is `image`.
* @param string $image_key Optional. Settings key for image. Default
* is null. If not defined uses image size key
* as the image key.
*
* @return string Image HTML.
*/
public static function get_attachment_image_html( $settings, $image_size_key = 'image', $image_key = null ) {
if ( ! $image_key ) {
$image_key = $image_size_key;
}
$image = $settings[ $image_key ];
// Old version of image settings.
if ( ! isset( $settings[ $image_size_key . '_size' ] ) ) {
$settings[ $image_size_key . '_size' ] = '';
}
$size = $settings[ $image_size_key . '_size' ];
$image_class = ! empty( $settings['hover_animation'] ) ? 'elementor-animation-' . $settings['hover_animation'] : '';
$html = '';
// If is the new version - with image size.
$image_sizes = get_intermediate_image_sizes();
$image_sizes[] = 'full';
if ( ! empty( $image['id'] ) && ! wp_attachment_is_image( $image['id'] ) ) {
$image['id'] = '';
}
$is_static_render_mode = Plugin::$instance->frontend->is_static_render_mode();
// On static mode don't use WP responsive images.
if ( ! empty( $image['id'] ) && in_array( $size, $image_sizes ) && ! $is_static_render_mode ) {
$image_class .= " attachment-$size size-$size";
$image_attr = [
'class' => trim( $image_class ),
];
$html .= wp_get_attachment_image( $image['id'], $size, false, $image_attr );
} else {
$image_src = self::get_attachment_image_src( $image['id'], $image_size_key, $settings );
if ( ! $image_src && isset( $image['url'] ) ) {
$image_src = $image['url'];
}
if ( ! empty( $image_src ) ) {
$image_class_html = ! empty( $image_class ) ? ' class="' . $image_class . '"' : '';
$html .= sprintf( '<img src="%s" title="%s" alt="%s"%s />', esc_attr( $image_src ), Control_Media::get_image_title( $image ), Control_Media::get_image_alt( $image ), $image_class_html );
}
}
/**
* Get Attachment Image HTML
*
* Filters the Attachment Image HTML
*
* @since 2.4.0
* @param string $html the attachment image HTML string
* @param array $settings Control settings.
* @param string $image_size_key Optional. Settings key for image size.
* Default is `image`.
* @param string $image_key Optional. Settings key for image. Default
* is null. If not defined uses image size key
* as the image key.
*/
return apply_filters( 'elementor/image_size/get_attachment_image_html', $html, $settings, $image_size_key, $image_key );
}
/**
* Safe print attachment image HTML.
*
* @uses get_attachment_image_html.
*
* @access public
* @static
*
* @param array $settings Control settings.
* @param string $image_size_key Optional. Settings key for image size.
* Default is `image`.
* @param string $image_key Optional. Settings key for image. Default
* is null. If not defined uses image size key
* as the image key.
*/
public static function print_attachment_image_html( array $settings, $image_size_key = 'image', $image_key = null ) {
Utils::print_wp_kses_extended( self::get_attachment_image_html( $settings, $image_size_key, $image_key ), [ 'image' ] );
}
/**
* Get all image sizes.
*
* Retrieve available image sizes with data like `width`, `height` and `crop`.
*
* @since 1.0.0
* @access public
* @static
*
* @return array An array of available image sizes.
*/
public static function get_all_image_sizes() {
global $_wp_additional_image_sizes;
$default_image_sizes = [ 'thumbnail', 'medium', 'medium_large', 'large' ];
$image_sizes = [];
foreach ( $default_image_sizes as $size ) {
$image_sizes[ $size ] = [
'width' => (int) get_option( $size . '_size_w' ),
'height' => (int) get_option( $size . '_size_h' ),
'crop' => (bool) get_option( $size . '_crop' ),
];
}
if ( $_wp_additional_image_sizes ) {
$image_sizes = array_merge( $image_sizes, $_wp_additional_image_sizes );
}
/** This filter is documented in wp-admin/includes/media.php */
return apply_filters( 'image_size_names_choose', $image_sizes );
}
/**
* Get attachment image src.
*
* Retrieve the attachment image source URL.
*
* @since 1.0.0
* @access public
* @static
*
* @param string $attachment_id The attachment ID.
* @param string $image_size_key Settings key for image size.
* @param array $settings Control settings.
*
* @return string Attachment image source URL.
*/
public static function get_attachment_image_src( $attachment_id, $image_size_key, array $settings ) {
if ( empty( $attachment_id ) ) {
return false;
}
$size = $settings[ $image_size_key . '_size' ];
if ( 'custom' !== $size ) {
$attachment_size = $size;
} else {
// Use BFI_Thumb script
// TODO: Please rewrite this code.
require_once ELEMENTOR_PATH . 'includes/libraries/bfi-thumb/bfi-thumb.php';
$custom_dimension = $settings[ $image_size_key . '_custom_dimension' ];
$attachment_size = [
// Defaults sizes
0 => null, // Width.
1 => null, // Height.
'bfi_thumb' => true,
'crop' => true,
];
$has_custom_size = false;
if ( ! empty( $custom_dimension['width'] ) ) {
$has_custom_size = true;
$attachment_size[0] = $custom_dimension['width'];
}
if ( ! empty( $custom_dimension['height'] ) ) {
$has_custom_size = true;
$attachment_size[1] = $custom_dimension['height'];
}
if ( ! $has_custom_size ) {
$attachment_size = 'full';
}
}
$image_src = wp_get_attachment_image_src( $attachment_id, $attachment_size );
if ( empty( $image_src[0] ) && 'thumbnail' !== $attachment_size ) {
$image_src = wp_get_attachment_image_src( $attachment_id );
}
return ! empty( $image_src[0] ) ? $image_src[0] : '';
}
/**
* Get child default arguments.
*
* Retrieve the default arguments for all the child controls for a specific group
* control.
*
* @since 1.2.2
* @access protected
*
* @return array Default arguments for all the child controls.
*/
protected function get_child_default_args() {
return [
'include' => [],
'exclude' => [],
];
}
/**
* Init fields.
*
* Initialize image size control fields.
*
* @since 1.2.2
* @access protected
*
* @return array Control fields.
*/
protected function init_fields() {
$fields = [];
$fields['size'] = [
'label' => _x( 'Image Size', 'Image Size Control', 'elementor' ),
'type' => Controls_Manager::SELECT,
];
$fields['custom_dimension'] = [
'label' => _x( 'Image Dimension', 'Image Size Control', 'elementor' ),
'type' => Controls_Manager::IMAGE_DIMENSIONS,
'description' => esc_html__( 'You can crop the original image size to any custom size. You can also set a single value for height or width in order to keep the original size ratio.', 'elementor' ),
'condition' => [
'size' => 'custom',
],
'separator' => 'none',
];
return $fields;
}
/**
* Prepare fields.
*
* Process image size control fields before adding them to `add_control()`.
*
* @since 1.2.2
* @access protected
*
* @param array $fields Image size control fields.
*
* @return array Processed fields.
*/
protected function prepare_fields( $fields ) {
$image_sizes = $this->get_image_sizes();
$args = $this->get_args();
if ( ! empty( $args['default'] ) && isset( $image_sizes[ $args['default'] ] ) ) {
$default_value = $args['default'];
} else {
// Get the first item for default value.
$default_value = array_keys( $image_sizes );
$default_value = array_shift( $default_value );
}
$fields['size']['options'] = $image_sizes;
$fields['size']['default'] = $default_value;
if ( ! isset( $image_sizes['custom'] ) ) {
unset( $fields['custom_dimension'] );
}
return parent::prepare_fields( $fields );
}
/**
* Get image sizes.
*
* Retrieve available image sizes after filtering `include` and `exclude` arguments.
*
* @since 2.0.0
* @access private
*
* @return array Filtered image sizes.
*/
private function get_image_sizes() {
$wp_image_sizes = self::get_all_image_sizes();
$args = $this->get_args();
if ( $args['include'] ) {
$wp_image_sizes = array_intersect_key( $wp_image_sizes, array_flip( $args['include'] ) );
} elseif ( $args['exclude'] ) {
$wp_image_sizes = array_diff_key( $wp_image_sizes, array_flip( $args['exclude'] ) );
}
$image_sizes = [];
foreach ( $wp_image_sizes as $size_key => $size_attributes ) {
$control_title = ucwords( str_replace( '_', ' ', $size_key ) );
if ( is_array( $size_attributes ) ) {
$control_title .= sprintf( ' - %d x %d', $size_attributes['width'], $size_attributes['height'] );
}
$image_sizes[ $size_key ] = $control_title;
}
$image_sizes['full'] = _x( 'Full', 'Image Size Control', 'elementor' );
if ( ! empty( $args['include']['custom'] ) || ! in_array( 'custom', $args['exclude'] ) ) {
$image_sizes['custom'] = _x( 'Custom', 'Image Size Control', 'elementor' );
}
return $image_sizes;
}
/**
* Get default options.
*
* Retrieve the default options of the image size control. Used to return the
* default options while initializing the image size control.
*
* @since 1.9.0
* @access protected
*
* @return array Default image size control options.
*/
protected function get_default_options() {
return [
'popover' => false,
];
}
}

View File

@@ -0,0 +1,94 @@
<?php
namespace Elementor;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
/**
* Elementor text shadow control.
*
* A base control for creating text shadow control. Displays input fields to define
* the text shadow including the horizontal shadow, vertical shadow, shadow blur and
* shadow color.
*
* @since 1.6.0
*/
class Group_Control_Text_Shadow extends Group_Control_Base {
/**
* Fields.
*
* Holds all the text shadow control fields.
*
* @since 1.6.0
* @access protected
* @static
*
* @var array Text shadow control fields.
*/
protected static $fields;
/**
* Get text shadow control type.
*
* Retrieve the control type, in this case `text-shadow`.
*
* @since 1.6.0
* @access public
* @static
*
* @return string Control type.
*/
public static function get_type() {
return 'text-shadow';
}
/**
* Init fields.
*
* Initialize text shadow control fields.
*
* @since 1.6.0
* @access protected
*
* @return array Control fields.
*/
protected function init_fields() {
$controls = [];
$controls['text_shadow'] = [
'label' => _x( 'Text Shadow', 'Text Shadow Control', 'elementor' ),
'type' => Controls_Manager::TEXT_SHADOW,
'selectors' => [
'{{SELECTOR}}' => 'text-shadow: {{HORIZONTAL}}px {{VERTICAL}}px {{BLUR}}px {{COLOR}};',
],
];
return $controls;
}
/**
* Get default options.
*
* Retrieve the default options of the text shadow control. Used to return the
* default options while initializing the text shadow control.
*
* @since 1.9.0
* @access protected
*
* @return array Default text shadow control options.
*/
protected function get_default_options() {
return [
'popover' => [
'starter_title' => _x( 'Text Shadow', 'Text Shadow Control', 'elementor' ),
'starter_name' => 'text_shadow_type',
'starter_value' => 'yes',
'settings' => [
'render_type' => 'ui',
],
],
];
}
}

View File

@@ -0,0 +1,121 @@
<?php
namespace Elementor;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
/**
* Elementor text stroke control.
*
* A group control for creating a stroke effect on text. Displays input fields to define
* the text stroke and color stroke.
*
* @since 3.5.0
*/
class Group_Control_Text_Stroke extends Group_Control_Base {
/**
* Fields.
*
* Holds all the text stroke control fields.
*
* @since 3.5.0
* @access protected
* @static
*
* @var array Text Stroke control fields.
*/
protected static $fields;
/**
* Get text stroke control type.
*
* Retrieve the control type, in this case `text-stroke`.
*
* @since 3.5.0
* @access public
* @static
*
* @return string Control type.
*/
public static function get_type() {
return 'text-stroke';
}
/**
* Init fields.
*
* Initialize text stroke control fields.
*
* @since 3.5.0
* @access protected
*
* @return array Control fields.
*/
protected function init_fields() {
$controls = [];
$controls['text_stroke'] = [
'label' => esc_html__( 'Text Stroke', 'elementor' ),
'type' => Controls_Manager::SLIDER,
'size_units' => [ 'px', 'em', 'rem' ],
'range' => [
'px' => [
'min' => 0,
'max' => 10,
],
'em' => [
'min' => 0,
'max' => 1,
'step' => 0.01,
],
'rem' => [
'min' => 0,
'max' => 1,
'step' => 0.01,
],
],
'selector' => '{{WRAPPER}}',
'selectors' => [
'{{SELECTOR}}' => '-webkit-text-stroke: {{SIZE}}{{UNIT}}; stroke-width: {{SIZE}}{{UNIT}}',
],
];
$controls['stroke_color'] = [
'label' => esc_html__( 'Stroke Color', 'elementor' ),
'type' => Controls_Manager::COLOR,
'default' => '#000',
'selector' => '{{WRAPPER}}',
'selectors' => [
'{{SELECTOR}}' => '-webkit-text-stroke-color: {{VALUE}}; stroke: {{VALUE}};',
],
];
return $controls;
}
/**
* Get default options.
*
* Retrieve the default options of the text stroke control. Used to return the
* default options while initializing the text stroke control.
*
* @since 3.5.0
* @access protected
*
* @return array Default text stroke control options.
*/
protected function get_default_options() {
return [
'popover' => [
'starter_title' => _x( 'Text Stroke', 'Text Stroke Control', 'elementor' ),
'starter_name' => 'text_stroke_type',
'starter_value' => 'yes',
'settings' => [
'render_type' => 'ui',
],
],
];
}
}

View File

@@ -0,0 +1,337 @@
<?php
namespace Elementor;
use Elementor\Core\Settings\Page\Manager as PageManager;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
/**
* Elementor typography control.
*
* A base control for creating typography control. Displays input fields to define
* the content typography including font size, font family, font weight, text
* transform, font style, line height and letter spacing.
*
* @since 1.0.0
*/
class Group_Control_Typography extends Group_Control_Base {
/**
* Fields.
*
* Holds all the typography control fields.
*
* @since 1.0.0
* @access protected
* @static
*
* @var array Typography control fields.
*/
protected static $fields;
/**
* Scheme fields keys.
*
* Holds all the typography control scheme fields keys.
* Default is an array containing `font_family` and `font_weight`.
*
* @since 1.0.0
* @access private
* @static
*
* @var array Typography control scheme fields keys.
*/
private static $_scheme_fields_keys = [ 'font_family', 'font_weight' ];
/**
* Get scheme fields keys.
*
* Retrieve all the available typography control scheme fields keys.
*
* @since 1.0.0
* @access public
* @static
*
* @return array Scheme fields keys.
*/
public static function get_scheme_fields_keys() {
return self::$_scheme_fields_keys;
}
/**
* Get typography control type.
*
* Retrieve the control type, in this case `typography`.
*
* @since 1.0.0
* @access public
* @static
*
* @return string Control type.
*/
public static function get_type() {
return 'typography';
}
/**
* Init fields.
*
* Initialize typography control fields.
*
* @since 1.2.2
* @access protected
*
* @return array Control fields.
*/
protected function init_fields() {
$fields = [];
$kit = Plugin::$instance->kits_manager->get_active_kit_for_frontend();
/**
* Retrieve the settings directly from DB, because of an open issue when a controls group is being initialized
* from within another group
*/
$kit_settings = $kit->get_meta( PageManager::META_KEY );
$default_fonts = isset( $kit_settings['default_generic_fonts'] ) ? $kit_settings['default_generic_fonts'] : 'Sans-serif';
if ( $default_fonts ) {
$default_fonts = ', ' . $default_fonts;
}
$fields['font_family'] = [
'label' => _x( 'Family', 'Typography Control', 'elementor' ),
'type' => Controls_Manager::FONT,
'default' => '',
'selector_value' => 'font-family: "{{VALUE}}"' . $default_fonts . ';',
];
$fields['font_size'] = [
'label' => _x( 'Size', 'Typography Control', 'elementor' ),
'type' => Controls_Manager::SLIDER,
'size_units' => [ 'px', 'em', 'rem', 'vw' ],
'range' => [
'px' => [
'min' => 1,
'max' => 200,
],
'vw' => [
'min' => 0.1,
'max' => 10,
'step' => 0.1,
],
],
'responsive' => true,
'selector_value' => 'font-size: {{SIZE}}{{UNIT}}',
];
$typo_weight_options = [
'' => esc_html__( 'Default', 'elementor' ),
];
foreach ( array_merge( [ 'normal', 'bold' ], range( 100, 900, 100 ) ) as $weight ) {
$typo_weight_options[ $weight ] = ucfirst( $weight );
}
$fields['font_weight'] = [
'label' => _x( 'Weight', 'Typography Control', 'elementor' ),
'type' => Controls_Manager::SELECT,
'default' => '',
'options' => $typo_weight_options,
];
$fields['text_transform'] = [
'label' => _x( 'Transform', 'Typography Control', 'elementor' ),
'type' => Controls_Manager::SELECT,
'default' => '',
'options' => [
'' => esc_html__( 'Default', 'elementor' ),
'uppercase' => _x( 'Uppercase', 'Typography Control', 'elementor' ),
'lowercase' => _x( 'Lowercase', 'Typography Control', 'elementor' ),
'capitalize' => _x( 'Capitalize', 'Typography Control', 'elementor' ),
'none' => _x( 'Normal', 'Typography Control', 'elementor' ),
],
];
$fields['font_style'] = [
'label' => _x( 'Style', 'Typography Control', 'elementor' ),
'type' => Controls_Manager::SELECT,
'default' => '',
'options' => [
'' => esc_html__( 'Default', 'elementor' ),
'normal' => _x( 'Normal', 'Typography Control', 'elementor' ),
'italic' => _x( 'Italic', 'Typography Control', 'elementor' ),
'oblique' => _x( 'Oblique', 'Typography Control', 'elementor' ),
],
];
$fields['text_decoration'] = [
'label' => _x( 'Decoration', 'Typography Control', 'elementor' ),
'type' => Controls_Manager::SELECT,
'default' => '',
'options' => [
'' => esc_html__( 'Default', 'elementor' ),
'underline' => _x( 'Underline', 'Typography Control', 'elementor' ),
'overline' => _x( 'Overline', 'Typography Control', 'elementor' ),
'line-through' => _x( 'Line Through', 'Typography Control', 'elementor' ),
'none' => _x( 'None', 'Typography Control', 'elementor' ),
],
];
$fields['line_height'] = [
'label' => _x( 'Line-Height', 'Typography Control', 'elementor' ),
'type' => Controls_Manager::SLIDER,
'desktop_default' => [
'unit' => 'em',
],
'tablet_default' => [
'unit' => 'em',
],
'mobile_default' => [
'unit' => 'em',
],
'range' => [
'px' => [
'min' => 1,
],
],
'responsive' => true,
'size_units' => [ 'px', 'em' ],
'selector_value' => 'line-height: {{SIZE}}{{UNIT}}',
];
$fields['letter_spacing'] = [
'label' => _x( 'Letter Spacing', 'Typography Control', 'elementor' ),
'type' => Controls_Manager::SLIDER,
'range' => [
'px' => [
'min' => -5,
'max' => 10,
'step' => 0.1,
],
],
'responsive' => true,
'selector_value' => 'letter-spacing: {{SIZE}}{{UNIT}}',
];
$fields['word_spacing'] = [
'label' => _x( 'Word Spacing', 'Typography Control', 'elementor' ),
'type' => Controls_Manager::SLIDER,
'desktop_default' => [
'unit' => 'em',
],
'tablet_default' => [
'unit' => 'em',
],
'mobile_default' => [
'unit' => 'em',
],
'size_units' => [ 'px', 'em' ],
'range' => [
'px' => [
'step' => 1,
],
'em' => [
'step' => 0.1,
],
],
'responsive' => true,
'selector_value' => 'word-spacing: {{SIZE}}{{UNIT}}',
];
return $fields;
}
/**
* Prepare fields.
*
* Process typography control fields before adding them to `add_control()`.
*
* @since 1.2.3
* @access protected
*
* @param array $fields Typography control fields.
*
* @return array Processed fields.
*/
protected function prepare_fields( $fields ) {
array_walk(
$fields, function( &$field, $field_name ) {
if ( in_array( $field_name, [ 'typography', 'popover_toggle' ] ) ) {
return;
}
$selector_value = ! empty( $field['selector_value'] ) ? $field['selector_value'] : str_replace( '_', '-', $field_name ) . ': {{VALUE}};';
$field['selectors'] = [
'{{SELECTOR}}' => $selector_value,
];
}
);
return parent::prepare_fields( $fields );
}
/**
* Add group arguments to field.
*
* Register field arguments to typography control.
*
* @since 1.2.2
* @access protected
*
* @param string $control_id Typography control id.
* @param array $field_args Typography control field arguments.
*
* @return array Field arguments.
*/
protected function add_group_args_to_field( $control_id, $field_args ) {
$field_args = parent::add_group_args_to_field( $control_id, $field_args );
$field_args['groupPrefix'] = $this->get_controls_prefix();
$field_args['groupType'] = 'typography';
$args = $this->get_args();
if ( in_array( $control_id, self::get_scheme_fields_keys() ) && ! empty( $args['scheme'] ) ) {
$field_args['scheme'] = [
'type' => self::get_type(),
'value' => $args['scheme'],
'key' => $control_id,
];
}
return $field_args;
}
/**
* Get default options.
*
* Retrieve the default options of the typography control. Used to return the
* default options while initializing the typography control.
*
* @since 1.9.0
* @access protected
*
* @return array Default typography control options.
*/
protected function get_default_options() {
return [
'popover' => [
'starter_name' => 'typography',
'starter_title' => _x( 'Typography', 'Typography Control', 'elementor' ),
'settings' => [
'render_type' => 'ui',
'groupType' => 'typography',
'global' => [
'active' => true,
],
],
],
];
}
}

View File

@@ -0,0 +1,66 @@
<?php
namespace Elementor;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
/**
* Elementor heading control.
*
* A base control for creating heading control. Displays a text heading between
* controls in the panel.
*
* @since 1.0.0
*/
class Control_Heading extends Base_UI_Control {
/**
* Get heading control type.
*
* Retrieve the control type, in this case `heading`.
*
* @since 1.0.0
* @access public
*
* @return string Control type.
*/
public function get_type() {
return 'heading';
}
/**
* Get heading control default settings.
*
* Retrieve the default settings of the heading control. Used to return the
* default settings while initializing the heading control.
*
* @since 1.0.0
* @access protected
*
* @return array Control default settings.
*/
protected function get_default_settings() {
return [
'label_block' => true,
];
}
/**
* Render heading control output in the editor.
*
* Used to generate the control HTML in the editor using Underscore JS
* template. The variables for the class are available using `data` JS
* object.
*
* @since 1.0.0
* @access public
*/
public function content_template() {
?>
<div class="elementor-control-field">
<h3 class="elementor-control-title">{{{ data.label }}}</h3>
</div>
<?php
}
}

View File

@@ -0,0 +1,47 @@
<?php
namespace Elementor;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
/**
* Elementor hidden control.
*
* A base control for creating hidden control. Used to save additional data in
* the database without a visual presentation in the panel.
*
* @since 1.0.0
*/
class Control_Hidden extends Base_Data_Control {
/**
* Get hidden control type.
*
* Retrieve the control type, in this case `hidden`.
*
* @since 1.0.0
* @access public
*
* @return string Control type.
*/
public function get_type() {
return 'hidden';
}
/**
* Render hidden control output in the editor.
*
* Used to generate the control HTML in the editor using Underscore JS
* template. The variables for the class are available using `data` JS
* object.
*
* @since 1.0.0
* @access public
*/
public function content_template() {
?>
<input type="hidden" data-setting="{{{ data.name }}}" />
<?php
}
}

View File

@@ -0,0 +1,164 @@
<?php
namespace Elementor;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
/**
* Elementor hover animation control.
*
* A base control for creating hover animation control. Displays a select box
* with the available hover animation effects @see Control_Hover_Animation::get_animations()
*
* @since 1.0.0
*/
class Control_Hover_Animation extends Base_Data_Control {
/**
* Animations.
*
* Holds all the available hover animation effects of the control.
*
* @access private
* @static
*
* @var array
*/
private static $_animations;
/**
* Get hover animation control type.
*
* Retrieve the control type, in this case `hover_animation`.
*
* @since 1.0.0
* @access public
*
* @return string Control type.
*/
public function get_type() {
return 'hover_animation';
}
/**
* Get animations.
*
* Retrieve the available hover animation effects.
*
* @since 1.0.0
* @access public
* @static
*
* @return array Available hover animation.
*/
public static function get_animations() {
if ( is_null( self::$_animations ) ) {
self::$_animations = [
'grow' => 'Grow',
'shrink' => 'Shrink',
'pulse' => 'Pulse',
'pulse-grow' => 'Pulse Grow',
'pulse-shrink' => 'Pulse Shrink',
'push' => 'Push',
'pop' => 'Pop',
'bounce-in' => 'Bounce In',
'bounce-out' => 'Bounce Out',
'rotate' => 'Rotate',
'grow-rotate' => 'Grow Rotate',
'float' => 'Float',
'sink' => 'Sink',
'bob' => 'Bob',
'hang' => 'Hang',
'skew' => 'Skew',
'skew-forward' => 'Skew Forward',
'skew-backward' => 'Skew Backward',
'wobble-vertical' => 'Wobble Vertical',
'wobble-horizontal' => 'Wobble Horizontal',
'wobble-to-bottom-right' => 'Wobble To Bottom Right',
'wobble-to-top-right' => 'Wobble To Top Right',
'wobble-top' => 'Wobble Top',
'wobble-bottom' => 'Wobble Bottom',
'wobble-skew' => 'Wobble Skew',
'buzz' => 'Buzz',
'buzz-out' => 'Buzz Out',
];
$additional_animations = [];
/**
* Hover animations.
*
* Filters the animations list displayed in the hover animations control.
*
* This hook can be used to register new animations in addition to the
* basic Elementor hover animations.
*
* @since 2.4.0
*
* @param array $additional_animations Additional animations array.
*/
$additional_animations = apply_filters( 'elementor/controls/hover_animations/additional_animations', $additional_animations );
self::$_animations = array_merge( self::$_animations, $additional_animations );
}
return self::$_animations;
}
/**
* Render hover animation control output in the editor.
*
* Used to generate the control HTML in the editor using Underscore JS
* template. The variables for the class are available using `data` JS
* object.
*
* @since 1.0.0
* @access public
*/
public function content_template() {
?>
<div class="elementor-control-field">
<label for="<?php $this->print_control_uid(); ?>" class="elementor-control-title">{{{ data.label }}}</label>
<div class="elementor-control-input-wrapper">
<select id="<?php $this->print_control_uid(); ?>" data-setting="{{ data.name }}">
<option value=""><?php echo esc_html__( 'None', 'elementor' ); ?></option>
<?php foreach ( self::get_animations() as $animation_name => $animation_title ) : ?>
<option value="<?php Utils::print_unescaped_internal_string( $animation_name ); ?>"><?php Utils::print_unescaped_internal_string( $animation_title ); ?></option>
<?php endforeach; ?>
</select>
</div>
</div>
<# if ( data.description ) { #>
<div class="elementor-control-field-description">{{{ data.description }}}</div>
<# } #>
<?php
}
/**
* Get hover animation control default settings.
*
* Retrieve the default settings of the hover animation control. Used to return
* the default settings while initializing the hover animation control.
*
* @since 1.0.0
* @access protected
*
* @return array Control default settings.
*/
protected function get_default_settings() {
return [
'label_block' => true,
];
}
public static function get_assets( $setting ) {
if ( ! $setting || 'none' === $setting ) {
return [];
}
return [
'styles' => [ 'e-animations' ],
];
}
}

View File

@@ -0,0 +1,884 @@
<?php
namespace Elementor;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
/**
* Elementor icon control.
*
* A base control for creating an icon control. Displays a font icon select box
* field. The control accepts `include` or `exclude` arguments to set a partial
* list of icons.
*
* @since 1.0.0
*/
class Control_Icon extends Base_Data_Control {
/**
* Get icon control type.
*
* Retrieve the control type, in this case `icon`.
*
* @since 1.0.0
* @access public
*
* @return string Control type.
*/
public function get_type() {
return 'icon';
}
/**
* Get icons.
*
* Retrieve all the available icons.
*
* @since 1.0.0
* @access public
* @static
*
* @return array Available icons.
*/
public static function get_icons() {
return [
'fa fa-500px' => '500px',
'fa fa-address-book' => 'address-book',
'fa fa-address-book-o' => 'address-book-o',
'fa fa-address-card' => 'address-card',
'fa fa-address-card-o' => 'address-card-o',
'fa fa-adjust' => 'adjust',
'fa fa-adn' => 'adn',
'fa fa-align-center' => 'align-center',
'fa fa-align-justify' => 'align-justify',
'fa fa-align-left' => 'align-left',
'fa fa-align-right' => 'align-right',
'fa fa-amazon' => 'amazon',
'fa fa-ambulance' => 'ambulance',
'fa fa-american-sign-language-interpreting' => 'american-sign-language-interpreting',
'fa fa-anchor' => 'anchor',
'fa fa-android' => 'android',
'fa fa-angellist' => 'angellist',
'fa fa-angle-double-down' => 'angle-double-down',
'fa fa-angle-double-left' => 'angle-double-left',
'fa fa-angle-double-right' => 'angle-double-right',
'fa fa-angle-double-up' => 'angle-double-up',
'fa fa-angle-down' => 'angle-down',
'fa fa-angle-left' => 'angle-left',
'fa fa-angle-right' => 'angle-right',
'fa fa-angle-up' => 'angle-up',
'fa fa-apple' => 'apple',
'fa fa-archive' => 'archive',
'fa fa-area-chart' => 'area-chart',
'fa fa-arrow-circle-down' => 'arrow-circle-down',
'fa fa-arrow-circle-left' => 'arrow-circle-left',
'fa fa-arrow-circle-o-down' => 'arrow-circle-o-down',
'fa fa-arrow-circle-o-left' => 'arrow-circle-o-left',
'fa fa-arrow-circle-o-right' => 'arrow-circle-o-right',
'fa fa-arrow-circle-o-up' => 'arrow-circle-o-up',
'fa fa-arrow-circle-right' => 'arrow-circle-right',
'fa fa-arrow-circle-up' => 'arrow-circle-up',
'fa fa-arrow-down' => 'arrow-down',
'fa fa-arrow-left' => 'arrow-left',
'fa fa-arrow-right' => 'arrow-right',
'fa fa-arrow-up' => 'arrow-up',
'fa fa-arrows' => 'arrows',
'fa fa-arrows-alt' => 'arrows-alt',
'fa fa-arrows-h' => 'arrows-h',
'fa fa-arrows-v' => 'arrows-v',
'fa fa-asl-interpreting' => 'asl-interpreting',
'fa fa-assistive-listening-systems' => 'assistive-listening-systems',
'fa fa-asterisk' => 'asterisk',
'fa fa-at' => 'at',
'fa fa-audio-description' => 'audio-description',
'fa fa-automobile' => 'automobile',
'fa fa-backward' => 'backward',
'fa fa-balance-scale' => 'balance-scale',
'fa fa-ban' => 'ban',
'fa fa-bandcamp' => 'bandcamp',
'fa fa-bank' => 'bank',
'fa fa-bar-chart' => 'bar-chart',
'fa fa-bar-chart-o' => 'bar-chart-o',
'fa fa-barcode' => 'barcode',
'fa fa-bars' => 'bars',
'fa fa-bath' => 'bath',
'fa fa-bathtub' => 'bathtub',
'fa fa-battery' => 'battery',
'fa fa-battery-0' => 'battery-0',
'fa fa-battery-1' => 'battery-1',
'fa fa-battery-2' => 'battery-2',
'fa fa-battery-3' => 'battery-3',
'fa fa-battery-4' => 'battery-4',
'fa fa-battery-empty' => 'battery-empty',
'fa fa-battery-full' => 'battery-full',
'fa fa-battery-half' => 'battery-half',
'fa fa-battery-quarter' => 'battery-quarter',
'fa fa-battery-three-quarters' => 'battery-three-quarters',
'fa fa-bed' => 'bed',
'fa fa-beer' => 'beer',
'fa fa-behance' => 'behance',
'fa fa-behance-square' => 'behance-square',
'fa fa-bell' => 'bell',
'fa fa-bell-o' => 'bell-o',
'fa fa-bell-slash' => 'bell-slash',
'fa fa-bell-slash-o' => 'bell-slash-o',
'fa fa-bicycle' => 'bicycle',
'fa fa-binoculars' => 'binoculars',
'fa fa-birthday-cake' => 'birthday-cake',
'fa fa-bitbucket' => 'bitbucket',
'fa fa-bitbucket-square' => 'bitbucket-square',
'fa fa-bitcoin' => 'bitcoin',
'fa fa-black-tie' => 'black-tie',
'fa fa-blind' => 'blind',
'fa fa-bluetooth' => 'bluetooth',
'fa fa-bluetooth-b' => 'bluetooth-b',
'fa fa-bold' => 'bold',
'fa fa-bolt' => 'bolt',
'fa fa-bomb' => 'bomb',
'fa fa-book' => 'book',
'fa fa-bookmark' => 'bookmark',
'fa fa-bookmark-o' => 'bookmark-o',
'fa fa-braille' => 'braille',
'fa fa-briefcase' => 'briefcase',
'fa fa-btc' => 'btc',
'fa fa-bug' => 'bug',
'fa fa-building' => 'building',
'fa fa-building-o' => 'building-o',
'fa fa-bullhorn' => 'bullhorn',
'fa fa-bullseye' => 'bullseye',
'fa fa-bus' => 'bus',
'fa fa-buysellads' => 'buysellads',
'fa fa-cab' => 'cab',
'fa fa-calculator' => 'calculator',
'fa fa-calendar' => 'calendar',
'fa fa-calendar-check-o' => 'calendar-check-o',
'fa fa-calendar-minus-o' => 'calendar-minus-o',
'fa fa-calendar-o' => 'calendar-o',
'fa fa-calendar-plus-o' => 'calendar-plus-o',
'fa fa-calendar-times-o' => 'calendar-times-o',
'fa fa-camera' => 'camera',
'fa fa-camera-retro' => 'camera-retro',
'fa fa-car' => 'car',
'fa fa-caret-down' => 'caret-down',
'fa fa-caret-left' => 'caret-left',
'fa fa-caret-right' => 'caret-right',
'fa fa-caret-square-o-down' => 'caret-square-o-down',
'fa fa-caret-square-o-left' => 'caret-square-o-left',
'fa fa-caret-square-o-right' => 'caret-square-o-right',
'fa fa-caret-square-o-up' => 'caret-square-o-up',
'fa fa-caret-up' => 'caret-up',
'fa fa-cart-arrow-down' => 'cart-arrow-down',
'fa fa-cart-plus' => 'cart-plus',
'fa fa-cc' => 'cc',
'fa fa-cc-amex' => 'cc-amex',
'fa fa-cc-diners-club' => 'cc-diners-club',
'fa fa-cc-discover' => 'cc-discover',
'fa fa-cc-jcb' => 'cc-jcb',
'fa fa-cc-mastercard' => 'cc-mastercard',
'fa fa-cc-paypal' => 'cc-paypal',
'fa fa-cc-stripe' => 'cc-stripe',
'fa fa-cc-visa' => 'cc-visa',
'fa fa-certificate' => 'certificate',
'fa fa-chain' => 'chain',
'fa fa-chain-broken' => 'chain-broken',
'fa fa-check' => 'check',
'fa fa-check-circle' => 'check-circle',
'fa fa-check-circle-o' => 'check-circle-o',
'fa fa-check-square' => 'check-square',
'fa fa-check-square-o' => 'check-square-o',
'fa fa-chevron-circle-down' => 'chevron-circle-down',
'fa fa-chevron-circle-left' => 'chevron-circle-left',
'fa fa-chevron-circle-right' => 'chevron-circle-right',
'fa fa-chevron-circle-up' => 'chevron-circle-up',
'fa fa-chevron-down' => 'chevron-down',
'fa fa-chevron-left' => 'chevron-left',
'fa fa-chevron-right' => 'chevron-right',
'fa fa-chevron-up' => 'chevron-up',
'fa fa-child' => 'child',
'fa fa-chrome' => 'chrome',
'fa fa-circle' => 'circle',
'fa fa-circle-o' => 'circle-o',
'fa fa-circle-o-notch' => 'circle-o-notch',
'fa fa-circle-thin' => 'circle-thin',
'fa fa-clipboard' => 'clipboard',
'fa fa-clock-o' => 'clock-o',
'fa fa-clone' => 'clone',
'fa fa-close' => 'close',
'fa fa-cloud' => 'cloud',
'fa fa-cloud-download' => 'cloud-download',
'fa fa-cloud-upload' => 'cloud-upload',
'fa fa-cny' => 'cny',
'fa fa-code' => 'code',
'fa fa-code-fork' => 'code-fork',
'fa fa-codepen' => 'codepen',
'fa fa-codiepie' => 'codiepie',
'fa fa-coffee' => 'coffee',
'fa fa-cog' => 'cog',
'fa fa-cogs' => 'cogs',
'fa fa-columns' => 'columns',
'fa fa-comment' => 'comment',
'fa fa-comment-o' => 'comment-o',
'fa fa-commenting' => 'commenting',
'fa fa-commenting-o' => 'commenting-o',
'fa fa-comments' => 'comments',
'fa fa-comments-o' => 'comments-o',
'fa fa-compass' => 'compass',
'fa fa-compress' => 'compress',
'fa fa-connectdevelop' => 'connectdevelop',
'fa fa-contao' => 'contao',
'fa fa-copy' => 'copy',
'fa fa-copyright' => 'copyright',
'fa fa-creative-commons' => 'creative-commons',
'fa fa-credit-card' => 'credit-card',
'fa fa-credit-card-alt' => 'credit-card-alt',
'fa fa-crop' => 'crop',
'fa fa-crosshairs' => 'crosshairs',
'fa fa-css3' => 'css3',
'fa fa-cube' => 'cube',
'fa fa-cubes' => 'cubes',
'fa fa-cut' => 'cut',
'fa fa-cutlery' => 'cutlery',
'fa fa-dashboard' => 'dashboard',
'fa fa-dashcube' => 'dashcube',
'fa fa-database' => 'database',
'fa fa-deaf' => 'deaf',
'fa fa-deafness' => 'deafness',
'fa fa-dedent' => 'dedent',
'fa fa-delicious' => 'delicious',
'fa fa-desktop' => 'desktop',
'fa fa-deviantart' => 'deviantart',
'fa fa-diamond' => 'diamond',
'fa fa-digg' => 'digg',
'fa fa-dollar' => 'dollar',
'fa fa-dot-circle-o' => 'dot-circle-o',
'fa fa-download' => 'download',
'fa fa-dribbble' => 'dribbble',
'fa fa-drivers-license' => 'drivers-license',
'fa fa-drivers-license-o' => 'drivers-license-o',
'fa fa-dropbox' => 'dropbox',
'fa fa-drupal' => 'drupal',
'fa fa-edge' => 'edge',
'fa fa-edit' => 'edit',
'fa fa-eercast' => 'eercast',
'fa fa-eject' => 'eject',
'fa fa-ellipsis-h' => 'ellipsis-h',
'fa fa-ellipsis-v' => 'ellipsis-v',
'fa fa-empire' => 'empire',
'fa fa-envelope' => 'envelope',
'fa fa-envelope-o' => 'envelope-o',
'fa fa-envelope-open' => 'envelope-open',
'fa fa-envelope-open-o' => 'envelope-open-o',
'fa fa-envelope-square' => 'envelope-square',
'fa fa-envira' => 'envira',
'fa fa-eraser' => 'eraser',
'fa fa-etsy' => 'etsy',
'fa fa-eur' => 'eur',
'fa fa-euro' => 'euro',
'fa fa-exchange' => 'exchange',
'fa fa-exclamation' => 'exclamation',
'fa fa-exclamation-circle' => 'exclamation-circle',
'fa fa-exclamation-triangle' => 'exclamation-triangle',
'fa fa-expand' => 'expand',
'fa fa-expeditedssl' => 'expeditedssl',
'fa fa-external-link' => 'external-link',
'fa fa-external-link-square' => 'external-link-square',
'fa fa-eye' => 'eye',
'fa fa-eye-slash' => 'eye-slash',
'fa fa-eyedropper' => 'eyedropper',
'fa fa-fa' => 'fa',
'fa fa-facebook' => 'facebook',
'fa fa-facebook-f' => 'facebook-f',
'fa fa-facebook-official' => 'facebook-official',
'fa fa-facebook-square' => 'facebook-square',
'fa fa-fast-backward' => 'fast-backward',
'fa fa-fast-forward' => 'fast-forward',
'fa fa-fax' => 'fax',
'fa fa-feed' => 'feed',
'fa fa-female' => 'female',
'fa fa-fighter-jet' => 'fighter-jet',
'fa fa-file' => 'file',
'fa fa-file-archive-o' => 'file-archive-o',
'fa fa-file-audio-o' => 'file-audio-o',
'fa fa-file-code-o' => 'file-code-o',
'fa fa-file-excel-o' => 'file-excel-o',
'fa fa-file-image-o' => 'file-image-o',
'fa fa-file-movie-o' => 'file-movie-o',
'fa fa-file-o' => 'file-o',
'fa fa-file-pdf-o' => 'file-pdf-o',
'fa fa-file-photo-o' => 'file-photo-o',
'fa fa-file-picture-o' => 'file-picture-o',
'fa fa-file-powerpoint-o' => 'file-powerpoint-o',
'fa fa-file-sound-o' => 'file-sound-o',
'fa fa-file-text' => 'file-text',
'fa fa-file-text-o' => 'file-text-o',
'fa fa-file-video-o' => 'file-video-o',
'fa fa-file-word-o' => 'file-word-o',
'fa fa-file-zip-o' => 'file-zip-o',
'fa fa-files-o' => 'files-o',
'fa fa-film' => 'film',
'fa fa-filter' => 'filter',
'fa fa-fire' => 'fire',
'fa fa-fire-extinguisher' => 'fire-extinguisher',
'fa fa-firefox' => 'firefox',
'fa fa-first-order' => 'first-order',
'fa fa-flag' => 'flag',
'fa fa-flag-checkered' => 'flag-checkered',
'fa fa-flag-o' => 'flag-o',
'fa fa-flash' => 'flash',
'fa fa-flask' => 'flask',
'fa fa-flickr' => 'flickr',
'fa fa-floppy-o' => 'floppy-o',
'fa fa-folder' => 'folder',
'fa fa-folder-o' => 'folder-o',
'fa fa-folder-open' => 'folder-open',
'fa fa-folder-open-o' => 'folder-open-o',
'fa fa-font' => 'font',
'fa fa-font-awesome' => 'font-awesome',
'fa fa-fonticons' => 'fonticons',
'fa fa-fort-awesome' => 'fort-awesome',
'fa fa-forumbee' => 'forumbee',
'fa fa-forward' => 'forward',
'fa fa-foursquare' => 'foursquare',
'fa fa-free-code-camp' => 'free-code-camp',
'fa fa-frown-o' => 'frown-o',
'fa fa-futbol-o' => 'futbol-o',
'fa fa-gamepad' => 'gamepad',
'fa fa-gavel' => 'gavel',
'fa fa-gbp' => 'gbp',
'fa fa-ge' => 'ge',
'fa fa-gear' => 'gear',
'fa fa-gears' => 'gears',
'fa fa-genderless' => 'genderless',
'fa fa-get-pocket' => 'get-pocket',
'fa fa-gg' => 'gg',
'fa fa-gg-circle' => 'gg-circle',
'fa fa-gift' => 'gift',
'fa fa-git' => 'git',
'fa fa-git-square' => 'git-square',
'fa fa-github' => 'github',
'fa fa-github-alt' => 'github-alt',
'fa fa-github-square' => 'github-square',
'fa fa-gitlab' => 'gitlab',
'fa fa-gittip' => 'gittip',
'fa fa-glass' => 'glass',
'fa fa-glide' => 'glide',
'fa fa-glide-g' => 'glide-g',
'fa fa-globe' => 'globe',
'fa fa-google' => 'google',
'fa fa-google-plus' => 'google-plus',
'fa fa-google-plus-circle' => 'google-plus-circle',
'fa fa-google-plus-official' => 'google-plus-official',
'fa fa-google-plus-square' => 'google-plus-square',
'fa fa-google-wallet' => 'google-wallet',
'fa fa-graduation-cap' => 'graduation-cap',
'fa fa-gratipay' => 'gratipay',
'fa fa-grav' => 'grav',
'fa fa-group' => 'group',
'fa fa-h-square' => 'h-square',
'fa fa-hacker-news' => 'hacker-news',
'fa fa-hand-grab-o' => 'hand-grab-o',
'fa fa-hand-lizard-o' => 'hand-lizard-o',
'fa fa-hand-o-down' => 'hand-o-down',
'fa fa-hand-o-left' => 'hand-o-left',
'fa fa-hand-o-right' => 'hand-o-right',
'fa fa-hand-o-up' => 'hand-o-up',
'fa fa-hand-paper-o' => 'hand-paper-o',
'fa fa-hand-peace-o' => 'hand-peace-o',
'fa fa-hand-pointer-o' => 'hand-pointer-o',
'fa fa-hand-rock-o' => 'hand-rock-o',
'fa fa-hand-scissors-o' => 'hand-scissors-o',
'fa fa-hand-spock-o' => 'hand-spock-o',
'fa fa-hand-stop-o' => 'hand-stop-o',
'fa fa-handshake-o' => 'handshake-o',
'fa fa-hard-of-hearing' => 'hard-of-hearing',
'fa fa-hashtag' => 'hashtag',
'fa fa-hdd-o' => 'hdd-o',
'fa fa-header' => 'header',
'fa fa-headphones' => 'headphones',
'fa fa-heart' => 'heart',
'fa fa-heart-o' => 'heart-o',
'fa fa-heartbeat' => 'heartbeat',
'fa fa-history' => 'history',
'fa fa-home' => 'home',
'fa fa-hospital-o' => 'hospital-o',
'fa fa-hotel' => 'hotel',
'fa fa-hourglass' => 'hourglass',
'fa fa-hourglass-1' => 'hourglass-1',
'fa fa-hourglass-2' => 'hourglass-2',
'fa fa-hourglass-3' => 'hourglass-3',
'fa fa-hourglass-end' => 'hourglass-end',
'fa fa-hourglass-half' => 'hourglass-half',
'fa fa-hourglass-o' => 'hourglass-o',
'fa fa-hourglass-start' => 'hourglass-start',
'fa fa-houzz' => 'houzz',
'fa fa-html5' => 'html5',
'fa fa-i-cursor' => 'i-cursor',
'fa fa-id-badge' => 'id-badge',
'fa fa-id-card' => 'id-card',
'fa fa-id-card-o' => 'id-card-o',
'fa fa-ils' => 'ils',
'fa fa-image' => 'image',
'fa fa-imdb' => 'imdb',
'fa fa-inbox' => 'inbox',
'fa fa-indent' => 'indent',
'fa fa-industry' => 'industry',
'fa fa-info' => 'info',
'fa fa-info-circle' => 'info-circle',
'fa fa-inr' => 'inr',
'fa fa-instagram' => 'instagram',
'fa fa-institution' => 'institution',
'fa fa-internet-explorer' => 'internet-explorer',
'fa fa-intersex' => 'intersex',
'fa fa-ioxhost' => 'ioxhost',
'fa fa-italic' => 'italic',
'fa fa-joomla' => 'joomla',
'fa fa-jpy' => 'jpy',
'fa fa-jsfiddle' => 'jsfiddle',
'fa fa-key' => 'key',
'fa fa-keyboard-o' => 'keyboard-o',
'fa fa-krw' => 'krw',
'fa fa-language' => 'language',
'fa fa-laptop' => 'laptop',
'fa fa-lastfm' => 'lastfm',
'fa fa-lastfm-square' => 'lastfm-square',
'fa fa-leaf' => 'leaf',
'fa fa-leanpub' => 'leanpub',
'fa fa-legal' => 'legal',
'fa fa-lemon-o' => 'lemon-o',
'fa fa-level-down' => 'level-down',
'fa fa-level-up' => 'level-up',
'fa fa-life-bouy' => 'life-bouy',
'fa fa-life-buoy' => 'life-buoy',
'fa fa-life-ring' => 'life-ring',
'fa fa-life-saver' => 'life-saver',
'fa fa-lightbulb-o' => 'lightbulb-o',
'fa fa-line-chart' => 'line-chart',
'fa fa-link' => 'link',
'fa fa-linkedin' => 'linkedin',
'fa fa-linkedin-square' => 'linkedin-square',
'fa fa-linode' => 'linode',
'fa fa-linux' => 'linux',
'fa fa-list' => 'list',
'fa fa-list-alt' => 'list-alt',
'fa fa-list-ol' => 'list-ol',
'fa fa-list-ul' => 'list-ul',
'fa fa-location-arrow' => 'location-arrow',
'fa fa-lock' => 'lock',
'fa fa-long-arrow-down' => 'long-arrow-down',
'fa fa-long-arrow-left' => 'long-arrow-left',
'fa fa-long-arrow-right' => 'long-arrow-right',
'fa fa-long-arrow-up' => 'long-arrow-up',
'fa fa-low-vision' => 'low-vision',
'fa fa-magic' => 'magic',
'fa fa-magnet' => 'magnet',
'fa fa-mail-forward' => 'mail-forward',
'fa fa-mail-reply' => 'mail-reply',
'fa fa-mail-reply-all' => 'mail-reply-all',
'fa fa-male' => 'male',
'fa fa-map' => 'map',
'fa fa-map-marker' => 'map-marker',
'fa fa-map-o' => 'map-o',
'fa fa-map-pin' => 'map-pin',
'fa fa-map-signs' => 'map-signs',
'fa fa-mars' => 'mars',
'fa fa-mars-double' => 'mars-double',
'fa fa-mars-stroke' => 'mars-stroke',
'fa fa-mars-stroke-h' => 'mars-stroke-h',
'fa fa-mars-stroke-v' => 'mars-stroke-v',
'fa fa-maxcdn' => 'maxcdn',
'fa fa-meanpath' => 'meanpath',
'fa fa-medium' => 'medium',
'fa fa-medkit' => 'medkit',
'fa fa-meetup' => 'meetup',
'fa fa-meh-o' => 'meh-o',
'fa fa-mercury' => 'mercury',
'fa fa-microchip' => 'microchip',
'fa fa-microphone' => 'microphone',
'fa fa-microphone-slash' => 'microphone-slash',
'fa fa-minus' => 'minus',
'fa fa-minus-circle' => 'minus-circle',
'fa fa-minus-square' => 'minus-square',
'fa fa-minus-square-o' => 'minus-square-o',
'fa fa-mixcloud' => 'mixcloud',
'fa fa-mobile' => 'mobile',
'fa fa-mobile-phone' => 'mobile-phone',
'fa fa-modx' => 'modx',
'fa fa-money' => 'money',
'fa fa-moon-o' => 'moon-o',
'fa fa-mortar-board' => 'mortar-board',
'fa fa-motorcycle' => 'motorcycle',
'fa fa-mouse-pointer' => 'mouse-pointer',
'fa fa-music' => 'music',
'fa fa-navicon' => 'navicon',
'fa fa-neuter' => 'neuter',
'fa fa-newspaper-o' => 'newspaper-o',
'fa fa-object-group' => 'object-group',
'fa fa-object-ungroup' => 'object-ungroup',
'fa fa-odnoklassniki' => 'odnoklassniki',
'fa fa-odnoklassniki-square' => 'odnoklassniki-square',
'fa fa-opencart' => 'opencart',
'fa fa-openid' => 'openid',
'fa fa-opera' => 'opera',
'fa fa-optin-monster' => 'optin-monster',
'fa fa-outdent' => 'outdent',
'fa fa-pagelines' => 'pagelines',
'fa fa-paint-brush' => 'paint-brush',
'fa fa-paper-plane' => 'paper-plane',
'fa fa-paper-plane-o' => 'paper-plane-o',
'fa fa-paperclip' => 'paperclip',
'fa fa-paragraph' => 'paragraph',
'fa fa-paste' => 'paste',
'fa fa-pause' => 'pause',
'fa fa-pause-circle' => 'pause-circle',
'fa fa-pause-circle-o' => 'pause-circle-o',
'fa fa-paw' => 'paw',
'fa fa-paypal' => 'paypal',
'fa fa-pencil' => 'pencil',
'fa fa-pencil-square' => 'pencil-square',
'fa fa-pencil-square-o' => 'pencil-square-o',
'fa fa-percent' => 'percent',
'fa fa-phone' => 'phone',
'fa fa-phone-square' => 'phone-square',
'fa fa-photo' => 'photo',
'fa fa-picture-o' => 'picture-o',
'fa fa-pie-chart' => 'pie-chart',
'fa fa-pied-piper' => 'pied-piper',
'fa fa-pied-piper-alt' => 'pied-piper-alt',
'fa fa-pied-piper-pp' => 'pied-piper-pp',
'fa fa-pinterest' => 'pinterest',
'fa fa-pinterest-p' => 'pinterest-p',
'fa fa-pinterest-square' => 'pinterest-square',
'fa fa-plane' => 'plane',
'fa fa-play' => 'play',
'fa fa-play-circle' => 'play-circle',
'fa fa-play-circle-o' => 'play-circle-o',
'fa fa-plug' => 'plug',
'fa fa-plus' => 'plus',
'fa fa-plus-circle' => 'plus-circle',
'fa fa-plus-square' => 'plus-square',
'fa fa-plus-square-o' => 'plus-square-o',
'fa fa-podcast' => 'podcast',
'fa fa-power-off' => 'power-off',
'fa fa-print' => 'print',
'fa fa-product-hunt' => 'product-hunt',
'fa fa-pull-left' => 'pull-left',
'fa fa-pull-right' => 'pull-right',
'fa fa-puzzle-piece' => 'puzzle-piece',
'fa fa-qq' => 'qq',
'fa fa-qrcode' => 'qrcode',
'fa fa-question' => 'question',
'fa fa-question-circle' => 'question-circle',
'fa fa-question-circle-o' => 'question-circle-o',
'fa fa-quora' => 'quora',
'fa fa-quote-left' => 'quote-left',
'fa fa-quote-right' => 'quote-right',
'fa fa-ra' => 'ra',
'fa fa-random' => 'random',
'fa fa-ravelry' => 'ravelry',
'fa fa-rebel' => 'rebel',
'fa fa-recycle' => 'recycle',
'fa fa-reddit' => 'reddit',
'fa fa-reddit-alien' => 'reddit-alien',
'fa fa-reddit-square' => 'reddit-square',
'fa fa-refresh' => 'refresh',
'fa fa-registered' => 'registered',
'fa fa-remove' => 'remove',
'fa fa-renren' => 'renren',
'fa fa-reorder' => 'reorder',
'fa fa-repeat' => 'repeat',
'fa fa-reply' => 'reply',
'fa fa-reply-all' => 'reply-all',
'fa fa-resistance' => 'resistance',
'fa fa-retweet' => 'retweet',
'fa fa-rmb' => 'rmb',
'fa fa-road' => 'road',
'fa fa-rocket' => 'rocket',
'fa fa-rotate-left' => 'rotate-left',
'fa fa-rotate-right' => 'rotate-right',
'fa fa-rouble' => 'rouble',
'fa fa-rss' => 'rss',
'fa fa-rss-square' => 'rss-square',
'fa fa-rub' => 'rub',
'fa fa-ruble' => 'ruble',
'fa fa-rupee' => 'rupee',
'fa fa-s15' => 's15',
'fa fa-safari' => 'safari',
'fa fa-save' => 'save',
'fa fa-scissors' => 'scissors',
'fa fa-scribd' => 'scribd',
'fa fa-search' => 'search',
'fa fa-search-minus' => 'search-minus',
'fa fa-search-plus' => 'search-plus',
'fa fa-sellsy' => 'sellsy',
'fa fa-send' => 'send',
'fa fa-send-o' => 'send-o',
'fa fa-server' => 'server',
'fa fa-share' => 'share',
'fa fa-share-alt' => 'share-alt',
'fa fa-share-alt-square' => 'share-alt-square',
'fa fa-share-square' => 'share-square',
'fa fa-share-square-o' => 'share-square-o',
'fa fa-shekel' => 'shekel',
'fa fa-sheqel' => 'sheqel',
'fa fa-shield' => 'shield',
'fa fa-ship' => 'ship',
'fa fa-shirtsinbulk' => 'shirtsinbulk',
'fa fa-shopping-bag' => 'shopping-bag',
'fa fa-shopping-basket' => 'shopping-basket',
'fa fa-shopping-cart' => 'shopping-cart',
'fa fa-shower' => 'shower',
'fa fa-sign-in' => 'sign-in',
'fa fa-sign-language' => 'sign-language',
'fa fa-sign-out' => 'sign-out',
'fa fa-signal' => 'signal',
'fa fa-signing' => 'signing',
'fa fa-simplybuilt' => 'simplybuilt',
'fa fa-sitemap' => 'sitemap',
'fa fa-skyatlas' => 'skyatlas',
'fa fa-skype' => 'skype',
'fa fa-slack' => 'slack',
'fa fa-sliders' => 'sliders',
'fa fa-slideshare' => 'slideshare',
'fa fa-smile-o' => 'smile-o',
'fa fa-snapchat' => 'snapchat',
'fa fa-snapchat-ghost' => 'snapchat-ghost',
'fa fa-snapchat-square' => 'snapchat-square',
'fa fa-snowflake-o' => 'snowflake-o',
'fa fa-soccer-ball-o' => 'soccer-ball-o',
'fa fa-sort' => 'sort',
'fa fa-sort-alpha-asc' => 'sort-alpha-asc',
'fa fa-sort-alpha-desc' => 'sort-alpha-desc',
'fa fa-sort-amount-asc' => 'sort-amount-asc',
'fa fa-sort-amount-desc' => 'sort-amount-desc',
'fa fa-sort-asc' => 'sort-asc',
'fa fa-sort-desc' => 'sort-desc',
'fa fa-sort-down' => 'sort-down',
'fa fa-sort-numeric-asc' => 'sort-numeric-asc',
'fa fa-sort-numeric-desc' => 'sort-numeric-desc',
'fa fa-sort-up' => 'sort-up',
'fa fa-soundcloud' => 'soundcloud',
'fa fa-space-shuttle' => 'space-shuttle',
'fa fa-spinner' => 'spinner',
'fa fa-spoon' => 'spoon',
'fa fa-spotify' => 'spotify',
'fa fa-square' => 'square',
'fa fa-square-o' => 'square-o',
'fa fa-stack-exchange' => 'stack-exchange',
'fa fa-stack-overflow' => 'stack-overflow',
'fa fa-star' => 'star',
'fa fa-star-half' => 'star-half',
'fa fa-star-half-empty' => 'star-half-empty',
'fa fa-star-half-full' => 'star-half-full',
'fa fa-star-half-o' => 'star-half-o',
'fa fa-star-o' => 'star-o',
'fa fa-steam' => 'steam',
'fa fa-steam-square' => 'steam-square',
'fa fa-step-backward' => 'step-backward',
'fa fa-step-forward' => 'step-forward',
'fa fa-stethoscope' => 'stethoscope',
'fa fa-sticky-note' => 'sticky-note',
'fa fa-sticky-note-o' => 'sticky-note-o',
'fa fa-stop' => 'stop',
'fa fa-stop-circle' => 'stop-circle',
'fa fa-stop-circle-o' => 'stop-circle-o',
'fa fa-street-view' => 'street-view',
'fa fa-strikethrough' => 'strikethrough',
'fa fa-stumbleupon' => 'stumbleupon',
'fa fa-stumbleupon-circle' => 'stumbleupon-circle',
'fa fa-subscript' => 'subscript',
'fa fa-subway' => 'subway',
'fa fa-suitcase' => 'suitcase',
'fa fa-sun-o' => 'sun-o',
'fa fa-superpowers' => 'superpowers',
'fa fa-superscript' => 'superscript',
'fa fa-support' => 'support',
'fa fa-table' => 'table',
'fa fa-tablet' => 'tablet',
'fa fa-tachometer' => 'tachometer',
'fa fa-tag' => 'tag',
'fa fa-tags' => 'tags',
'fa fa-tasks' => 'tasks',
'fa fa-taxi' => 'taxi',
'fa fa-telegram' => 'telegram',
'fa fa-television' => 'television',
'fa fa-tencent-weibo' => 'tencent-weibo',
'fa fa-terminal' => 'terminal',
'fa fa-text-height' => 'text-height',
'fa fa-text-width' => 'text-width',
'fa fa-th' => 'th',
'fa fa-th-large' => 'th-large',
'fa fa-th-list' => 'th-list',
'fa fa-themeisle' => 'themeisle',
'fa fa-thermometer' => 'thermometer',
'fa fa-thermometer-0' => 'thermometer-0',
'fa fa-thermometer-1' => 'thermometer-1',
'fa fa-thermometer-2' => 'thermometer-2',
'fa fa-thermometer-3' => 'thermometer-3',
'fa fa-thermometer-4' => 'thermometer-4',
'fa fa-thermometer-empty' => 'thermometer-empty',
'fa fa-thermometer-full' => 'thermometer-full',
'fa fa-thermometer-half' => 'thermometer-half',
'fa fa-thermometer-quarter' => 'thermometer-quarter',
'fa fa-thermometer-three-quarters' => 'thermometer-three-quarters',
'fa fa-thumb-tack' => 'thumb-tack',
'fa fa-thumbs-down' => 'thumbs-down',
'fa fa-thumbs-o-down' => 'thumbs-o-down',
'fa fa-thumbs-o-up' => 'thumbs-o-up',
'fa fa-thumbs-up' => 'thumbs-up',
'fa fa-ticket' => 'ticket',
'fa fa-times' => 'times',
'fa fa-times-circle' => 'times-circle',
'fa fa-times-circle-o' => 'times-circle-o',
'fa fa-times-rectangle' => 'times-rectangle',
'fa fa-times-rectangle-o' => 'times-rectangle-o',
'fa fa-tint' => 'tint',
'fa fa-toggle-down' => 'toggle-down',
'fa fa-toggle-left' => 'toggle-left',
'fa fa-toggle-off' => 'toggle-off',
'fa fa-toggle-on' => 'toggle-on',
'fa fa-toggle-right' => 'toggle-right',
'fa fa-toggle-up' => 'toggle-up',
'fa fa-trademark' => 'trademark',
'fa fa-train' => 'train',
'fa fa-transgender' => 'transgender',
'fa fa-transgender-alt' => 'transgender-alt',
'fa fa-trash' => 'trash',
'fa fa-trash-o' => 'trash-o',
'fa fa-tree' => 'tree',
'fa fa-trello' => 'trello',
'fa fa-tripadvisor' => 'tripadvisor',
'fa fa-trophy' => 'trophy',
'fa fa-truck' => 'truck',
'fa fa-try' => 'try',
'fa fa-tty' => 'tty',
'fa fa-tumblr' => 'tumblr',
'fa fa-tumblr-square' => 'tumblr-square',
'fa fa-turkish-lira' => 'turkish-lira',
'fa fa-tv' => 'tv',
'fa fa-twitch' => 'twitch',
'fa fa-twitter' => 'twitter',
'fa fa-twitter-square' => 'twitter-square',
'fa fa-umbrella' => 'umbrella',
'fa fa-underline' => 'underline',
'fa fa-undo' => 'undo',
'fa fa-universal-access' => 'universal-access',
'fa fa-university' => 'university',
'fa fa-unlink' => 'unlink',
'fa fa-unlock' => 'unlock',
'fa fa-unlock-alt' => 'unlock-alt',
'fa fa-unsorted' => 'unsorted',
'fa fa-upload' => 'upload',
'fa fa-usb' => 'usb',
'fa fa-usd' => 'usd',
'fa fa-user' => 'user',
'fa fa-user-circle' => 'user-circle',
'fa fa-user-circle-o' => 'user-circle-o',
'fa fa-user-md' => 'user-md',
'fa fa-user-o' => 'user-o',
'fa fa-user-plus' => 'user-plus',
'fa fa-user-secret' => 'user-secret',
'fa fa-user-times' => 'user-times',
'fa fa-users' => 'users',
'fa fa-vcard' => 'vcard',
'fa fa-vcard-o' => 'vcard-o',
'fa fa-venus' => 'venus',
'fa fa-venus-double' => 'venus-double',
'fa fa-venus-mars' => 'venus-mars',
'fa fa-viacoin' => 'viacoin',
'fa fa-viadeo' => 'viadeo',
'fa fa-viadeo-square' => 'viadeo-square',
'fa fa-video-camera' => 'video-camera',
'fa fa-vimeo' => 'vimeo',
'fa fa-vimeo-square' => 'vimeo-square',
'fa fa-vine' => 'vine',
'fa fa-vk' => 'vk',
'fa fa-volume-control-phone' => 'volume-control-phone',
'fa fa-volume-down' => 'volume-down',
'fa fa-volume-off' => 'volume-off',
'fa fa-volume-up' => 'volume-up',
'fa fa-warning' => 'warning',
'fa fa-wechat' => 'wechat',
'fa fa-weibo' => 'weibo',
'fa fa-weixin' => 'weixin',
'fa fa-whatsapp' => 'whatsapp',
'fa fa-wheelchair' => 'wheelchair',
'fa fa-wheelchair-alt' => 'wheelchair-alt',
'fa fa-wifi' => 'wifi',
'fa fa-wikipedia-w' => 'wikipedia-w',
'fa fa-window-close' => 'window-close',
'fa fa-window-close-o' => 'window-close-o',
'fa fa-window-maximize' => 'window-maximize',
'fa fa-window-minimize' => 'window-minimize',
'fa fa-window-restore' => 'window-restore',
'fa fa-windows' => 'windows',
'fa fa-won' => 'won',
'fa fa-wordpress' => 'wordpress',
'fa fa-wpbeginner' => 'wpbeginner',
'fa fa-wpexplorer' => 'wpexplorer',
'fa fa-wpforms' => 'wpforms',
'fa fa-wrench' => 'wrench',
'fa fa-xing' => 'xing',
'fa fa-xing-square' => 'xing-square',
'fa fa-y-combinator' => 'y-combinator',
'fa fa-y-combinator-square' => 'y-combinator-square',
'fa fa-yahoo' => 'yahoo',
'fa fa-yc' => 'yc',
'fa fa-yc-square' => 'yc-square',
'fa fa-yelp' => 'yelp',
'fa fa-yen' => 'yen',
'fa fa-yoast' => 'yoast',
'fa fa-youtube' => 'youtube',
'fa fa-youtube-play' => 'youtube-play',
'fa fa-youtube-square' => 'youtube-square',
];
}
/**
* Get icons control default settings.
*
* Retrieve the default settings of the icons control. Used to return the default
* settings while initializing the icons control.
*
* @since 1.0.0
* @access protected
*
* @return array Control default settings.
*/
protected function get_default_settings() {
return [
'options' => self::get_icons(),
'include' => '',
'exclude' => '',
];
}
/**
* Render icons control output in the editor.
*
* Used to generate the control HTML in the editor using Underscore JS
* template. The variables for the class are available using `data` JS
* object.
*
* @since 1.0.0
* @access public
*/
public function content_template() {
?>
<div class="elementor-control-field">
<label for="<?php $this->print_control_uid(); ?>" class="elementor-control-title">{{{ data.label }}}</label>
<div class="elementor-control-input-wrapper">
<select id="<?php $this->print_control_uid(); ?>" class="elementor-control-icon" data-setting="{{ data.name }}" data-placeholder="<?php echo esc_html__( 'Select Icon', 'elementor' ); ?>">
<option value=""><?php echo esc_html__( 'Select Icon', 'elementor' ); ?></option>
<# _.each( data.options, function( option_title, option_value ) { #>
<option value="{{ option_value }}">{{{ option_title }}}</option>
<# } ); #>
</select>
</div>
</div>
<# if ( data.description ) { #>
<div class="elementor-control-field-description">{{ data.description }}</div>
<# } #>
<?php
}
}

View File

@@ -0,0 +1,193 @@
<?php
namespace Elementor;
use Elementor\Modules\DynamicTags\Module as TagsModule;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
/**
* Elementor Icons control.
*
* A base control for creating a Icons chooser control.
* Used to select an Icon.
*
* Usage: @see https://developers.elementor.com/elementor-controls/icons-control
*
* @since 2.6.0
*/
class Control_Icons extends Control_Base_Multiple {
/**
* Get media control type.
*
* Retrieve the control type, in this case `media`.
*
* @access public
* @since 2.6.0
* @return string Control type.
*/
public function get_type() {
return 'icons';
}
/**
* Get Icons control default values.
*
* Retrieve the default value of the Icons control. Used to return the default
* values while initializing the Icons control.
*
* @access public
* @since 2.6.0
* @return array Control default value.
*/
public function get_default_value() {
return [
'value' => '',
'library' => '',
];
}
/**
* Render Icons control output in the editor.
*
* Used to generate the control HTML in the editor using Underscore JS
* template. The variables for the class are available using `data` JS
* object.
*
* @since 2.6.0
* @access public
*/
public function content_template() {
?>
<# if ( 'inline' === data.skin ) { #>
<?php $this->render_inline_skin(); ?>
<# } else { #>
<?php $this->render_media_skin(); ?>
<# } #>
<?php
}
public function render_media_skin() {
?>
<div class="elementor-control-field elementor-control-media">
<label class="elementor-control-title">{{{ data.label }}}</label>
<div class="elementor-control-input-wrapper elementor-aspect-ratio-219">
<div class="elementor-control-media__content elementor-control-tag-area elementor-control-preview-area elementor-fit-aspect-ratio">
<div class="elementor-control-media-upload-button elementor-control-media__content__upload-button elementor-fit-aspect-ratio">
<i class="eicon-plus-circle" aria-hidden="true"></i>
</div>
<div class="elementor-control-media-area elementor-fit-aspect-ratio">
<div class="elementor-control-media__remove elementor-control-media__content__remove" title="<?php echo esc_html__( 'Remove', 'elementor' ); ?>">
<i class="eicon-trash-o"></i>
</div>
<div class="elementor-control-media__preview elementor-fit-aspect-ratio"></div>
</div>
<div class="elementor-control-media__tools elementor-control-dynamic-switcher-wrapper">
<div class="elementor-control-icon-picker elementor-control-media__tool"><?php echo esc_html__( 'Icon Library', 'elementor' ); ?></div>
<div class="elementor-control-svg-uploader elementor-control-media__tool"><?php echo esc_html__( 'Upload SVG', 'elementor' ); ?></div>
</div>
</div>
</div>
<# if ( data.description ) { #>
<div class="elementor-control-field-description">{{{ data.description }}}</div>
<# } #>
<input type="hidden" data-setting="{{ data.name }}"/>
</div>
<?php
}
public function render_inline_skin() {
?>
<div class="elementor-control-field elementor-control-inline-icon">
<label class="elementor-control-title">{{{ data.label }}}</label>
<div class="elementor-control-input-wrapper">
<div class="elementor-choices">
<input id="<?php $this->print_control_uid(); ?>-none" type="radio" value="none">
<label class="elementor-choices-label elementor-control-unit-1 tooltip-target elementor-control-icons--inline__none" for="<?php $this->print_control_uid(); ?>-none" data-tooltip="<?php echo esc_html__( 'None', 'elementor' ); ?>" title="<?php echo esc_html__( 'None', 'elementor' ); ?>">
<i class="eicon-ban" aria-hidden="true"></i>
<span class="elementor-screen-only"><?php echo esc_html__( 'None', 'elementor' ); ?></span>
</label>
<# if ( ! data.exclude_inline_options.includes( 'svg' ) ) { #>
<input id="<?php $this->print_control_uid(); ?>-svg" type="radio" value="svg">
<label class="elementor-choices-label elementor-control-unit-1 tooltip-target elementor-control-icons--inline__svg" for="<?php $this->print_control_uid(); ?>-svg" data-tooltip="<?php echo esc_html__( 'Upload SVG', 'elementor' ); ?>" title="<?php echo esc_html__( 'Upload SVG', 'elementor' ); ?>">
<i class="eicon-upload" aria-hidden="true"></i>
<span class="elementor-screen-only"><?php echo esc_html__( 'Upload SVG', 'elementor' ); ?></span>
</label>
<# }
if ( ! data.exclude_inline_options.includes( 'icon' ) ) { #>
<input id="<?php $this->print_control_uid(); ?>-icon" type="radio" value="icon">
<label class="elementor-choices-label elementor-control-unit-1 tooltip-target elementor-control-icons--inline__icon" for="<?php $this->print_control_uid(); ?>-icon" data-tooltip="<?php echo esc_html__( 'Icon Library', 'elementor' ); ?>" title="<?php echo esc_html__( 'Icon Library', 'elementor' ); ?>">
<span class="elementor-control-icons--inline__displayed-icon">
<i class="eicon-circle" aria-hidden="true"></i>
</span>
<span class="elementor-screen-only"><?php echo esc_html__( 'Icon Library', 'elementor' ); ?></span>
</label>
<# } #>
</div>
</div>
</div>
<# if ( data.description ) { #>
<div class="elementor-control-field-description">{{{ data.description }}}</div>
<# } #>
<?php
}
/**
* Get Icons control default settings.
*
* Retrieve the default settings of the Icons control. Used to return the default
* settings while initializing the Icons control.
*
* @since 2.6.0
* @access protected
*
* @return array Control default settings.
*/
protected function get_default_settings() {
return [
'label_block' => true,
'dynamic' => [
'categories' => [ TagsModule::IMAGE_CATEGORY ],
'returnType' => 'object',
],
'search_bar' => true,
'recommended' => false,
'skin' => 'media',
'exclude_inline_options' => [],
];
}
/**
* Support SVG Import
*
* @deprecated 3.5.0
*
* @param $mimes
* @return mixed
*/
public function support_svg_import( $mimes ) {
Plugin::$instance->modules_manager->get_modules( 'dev-tools' )->deprecation->deprecated_function( __METHOD__, '3.5.0' );
$mimes['svg'] = 'image/svg+xml';
return $mimes;
}
public function on_import( $settings ) {
if ( empty( $settings['library'] ) || 'svg' !== $settings['library'] || empty( $settings['value']['url'] ) ) {
return $settings;
}
$imported = Plugin::$instance->templates_manager->get_import_images_instance()->import( $settings['value'] );
if ( ! $imported ) {
$settings['value'] = '';
$settings['library'] = '';
} else {
$settings['value'] = $imported;
}
return $settings;
}
}

View File

@@ -0,0 +1,124 @@
<?php
namespace Elementor;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
/**
* Elementor image dimensions control.
*
* A base control for creating image dimension control. Displays image width
* input, image height input and an apply button.
*
* @since 1.0.0
*/
class Control_Image_Dimensions extends Control_Base_Multiple {
/**
* Get image dimensions control type.
*
* Retrieve the control type, in this case `image_dimensions`.
*
* @since 1.0.0
* @access public
*
* @return string Control type.
*/
public function get_type() {
return 'image_dimensions';
}
/**
* Get image dimensions control default values.
*
* Retrieve the default value of the image dimensions control. Used to return the
* default values while initializing the image dimensions control.
*
* @since 1.0.0
* @access public
*
* @return array Control default value.
*/
public function get_default_value() {
return [
'width' => '',
'height' => '',
];
}
/**
* Get image dimensions control default settings.
*
* Retrieve the default settings of the image dimensions control. Used to return
* the default settings while initializing the image dimensions control.
*
* @since 1.0.0
* @access protected
*
* @return array Control default settings.
*/
protected function get_default_settings() {
return [
'show_label' => false,
'label_block' => true,
];
}
/**
* Render image dimensions control output in the editor.
*
* Used to generate the control HTML in the editor using Underscore JS
* template. The variables for the class are available using `data` JS
* object.
*
* @since 1.0.0
* @access public
*/
public function content_template() {
if ( ! $this->is_image_editor_supports() ) : ?>
<div class="elementor-panel-alert elementor-panel-alert-danger">
<?php echo esc_html__( 'The server does not have ImageMagick or GD installed and/or enabled! Any of these libraries are required for WordPress to be able to resize images. Please contact your server administrator to enable this before continuing.', 'elementor' ); ?>
</div>
<?php
return;
endif;
?>
<# if ( data.description ) { #>
<div class="elementor-control-field-description">{{{ data.description }}}</div>
<# } #>
<div class="elementor-control-field">
<label class="elementor-control-title">{{{ data.label }}}</label>
<div class="elementor-control-input-wrapper">
<div class="elementor-image-dimensions-field elementor-control-unit-2">
<input id="<?php $this->print_control_uid( 'width' ); ?>" type="text" data-setting="width" />
<label for="<?php $this->print_control_uid( 'width' ); ?>" class="elementor-image-dimensions-field-description"><?php echo esc_html__( 'Width', 'elementor' ); ?></label>
</div>
<div class="elementor-image-dimensions-separator">x</div>
<div class="elementor-image-dimensions-field elementor-control-unit-2">
<input id="<?php $this->print_control_uid( 'height' ); ?>" type="text" data-setting="height" />
<label for="<?php $this->print_control_uid( 'height' ); ?>" class="elementor-image-dimensions-field-description"><?php echo esc_html__( 'Height', 'elementor' ); ?></label>
</div>
<button class="elementor-button elementor-button-success elementor-image-dimensions-apply-button"><?php echo esc_html__( 'Apply', 'elementor' ); ?></button>
</div>
</div>
<?php
}
/**
* Image editor support.
*
* Used to determine whether the editor supports a given image mime-type.
*
* @since 2.0.0
* @access private
*
* @return bool Whether the editor supports the given mime-type.
*/
private function is_image_editor_supports() {
$arg = [
'mime_type' => 'image/jpeg',
];
return ( wp_image_editor_supports( $arg ) );
}
}

View File

@@ -0,0 +1,360 @@
<?php
namespace Elementor;
use Elementor\Core\Files\Uploads_Manager;
use Elementor\Modules\DynamicTags\Module as TagsModule;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
/**
* Elementor media control.
*
* A base control for creating a media chooser control. Based on the WordPress
* media library. Used to select an image from the WordPress media library.
*
* @since 1.0.0
*/
class Control_Media extends Control_Base_Multiple {
/**
* Get media control type.
*
* Retrieve the control type, in this case `media`.
*
* @since 1.0.0
* @access public
*
* @return string Control type.
*/
public function get_type() {
return 'media';
}
/**
* Get media control default values.
*
* Retrieve the default value of the media control. Used to return the default
* values while initializing the media control.
*
* @since 1.0.0
* @access public
*
* @return array Control default value.
*/
public function get_default_value() {
return [
'url' => '',
'id' => '',
];
}
/**
* Import media images.
*
* Used to import media control files from external sites while importing
* Elementor template JSON file, and replacing the old data.
*
* @since 1.0.0
* @access public
*
* @param array $settings Control settings
*
* @return array Control settings.
*/
public function on_import( $settings ) {
if ( empty( $settings['url'] ) ) {
return $settings;
}
$settings = Plugin::$instance->templates_manager->get_import_images_instance()->import( $settings );
if ( ! $settings ) {
$settings = [
'id' => '',
'url' => Utils::get_placeholder_image_src(),
];
}
return $settings;
}
/**
* Support SVG and JSON Import
*
* Called by the 'upload_mimes' filter. Adds SVG and JSON mime types to the list of WordPress' allowed mime types.
*
* @since 3.4.6
* @deprecated 3.5.0
*
* @param $mimes
* @return mixed
*/
public function support_svg_and_json_import( $mimes ) {
Plugin::$instance->modules_manager->get_modules( 'dev-tools' )->deprecation->deprecated_function( __METHOD__, '3.5.0' );
return $mimes;
}
/**
* Enqueue media control scripts and styles.
*
* Used to register and enqueue custom scripts and styles used by the media
* control.
*
* @since 1.0.0
* @access public
*/
public function enqueue() {
global $wp_version;
$suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
wp_enqueue_media();
wp_enqueue_style(
'media',
admin_url( '/css/media' . $suffix . '.css' ),
[],
$wp_version
);
wp_register_script(
'image-edit',
'/wp-admin/js/image-edit' . $suffix . '.js',
[
'jquery',
'json2',
'imgareaselect',
],
$wp_version,
true
);
wp_enqueue_script( 'image-edit' );
}
/**
* Render media control output in the editor.
*
* Used to generate the control HTML in the editor using Underscore JS
* template. The variables for the class are available using `data` JS
* object.
*
* @since 1.0.0
* @access public
*/
public function content_template() {
?>
<#
// For BC.
if ( data.media_type ) {
data.media_types = [ data.media_type ];
}
if ( data.should_include_svg_inline_option ) {
data.media_types.push( 'svg' );
}
// Determine if the current media type is viewable.
const isViewable = () => {
const viewable = [
'image',
'video',
'svg',
];
// Make sure that all media types are viewable.
return data.media_types.every( ( type ) => viewable.includes( type ) );
};
// Get the preview type for the current media type.
const getPreviewType = () => {
if ( data.media_types.includes( 'video' ) ) {
return 'video';
}
if ( data.media_types.includes( 'image' ) || data.media_types.includes( 'svg' ) ) {
return 'image';
}
return 'none';
}
// Retrieve a button label by media type.
const getButtonLabel = ( mediaType ) => {
switch( mediaType ) {
case 'image':
return '<?php esc_html_e( 'Choose Image', 'elementor' ); ?>';
case 'video':
return '<?php esc_html_e( 'Choose Video', 'elementor' ); ?>';
case 'svg':
return '<?php esc_html_e( 'Choose SVG', 'elementor' ); ?>';
default:
return '<?php esc_html_e( 'Choose File', 'elementor' ); ?>';
}
}
#>
<div class="elementor-control-field elementor-control-media">
<label class="elementor-control-title">{{{ data.label }}}</label>
<#
if ( isViewable() ) {
let inputWrapperClasses = 'elementor-control-input-wrapper elementor-aspect-ratio-219';
if ( ! data.label_block ) {
inputWrapperClasses += ' elementor-control-unit-5';
}
#>
<div class="{{{ inputWrapperClasses }}}">
<div class="elementor-control-media__content elementor-control-tag-area elementor-control-preview-area elementor-fit-aspect-ratio">
<div class="elementor-control-media-area elementor-fit-aspect-ratio">
<div class="elementor-control-media__remove elementor-control-media__content__remove" title="<?php echo esc_html__( 'Remove', 'elementor' ); ?>">
<i class="eicon-trash-o"></i>
</div>
<#
switch( getPreviewType() ) {
case 'image':
#>
<div class="elementor-control-media__preview elementor-fit-aspect-ratio"></div>
<#
break;
case 'video':
#>
<video class="elementor-control-media-video" preload="metadata"></video>
<i class="eicon-video-camera"></i>
<#
break;
}
#>
</div>
<div class="elementor-control-media-upload-button elementor-control-media__content__upload-button">
<i class="eicon-plus-circle" aria-hidden="true"></i>
</div>
<div class="elementor-control-media__tools elementor-control-dynamic-switcher-wrapper">
<#
data.media_types.forEach( ( type ) => {
#>
<div class="elementor-control-media__tool elementor-control-media__replace" data-media-type="{{{ type }}}">{{{ getButtonLabel( type ) }}}</div>
<#
} );
#>
</div>
</div>
</div>
<# } /* endif isViewable() */ else { #>
<div class="elementor-control-media__file elementor-control-preview-area">
<div class="elementor-control-media__file__content">
<div class="elementor-control-media__file__content__label"><?php echo esc_html__( 'Click the media icon to upload file', 'elementor' ); ?></div>
<div class="elementor-control-media__file__content__info">
<div class="elementor-control-media__file__content__info__icon">
<i class="eicon-document-file"></i>
</div>
<div class="elementor-control-media__file__content__info__name"></div>
</div>
</div>
<div class="elementor-control-media__file__controls">
<div class="elementor-control-media__remove elementor-control-media__file__controls__remove" title="<?php echo esc_html__( 'Remove', 'elementor' ); ?>">
<i class="eicon-trash-o"></i>
</div>
<div class="elementor-control-media__file__controls__upload-button elementor-control-media-upload-button" title="<?php echo esc_html__( 'Upload', 'elementor' ); ?>">
<i class="eicon-upload"></i>
</div>
</div>
</div>
<# } #>
<# if ( data.description ) { #>
<div class="elementor-control-field-description">{{{ data.description }}}</div>
<# } #>
<input type="hidden" data-setting="{{ data.name }}"/>
</div>
<?php
}
/**
* Get media control default settings.
*
* Retrieve the default settings of the media control. Used to return the default
* settings while initializing the media control.
*
* @since 1.0.0
* @access protected
*
* @return array Control default settings.
*/
protected function get_default_settings() {
return [
'label_block' => true,
'media_types' => [
'image',
],
'dynamic' => [
'categories' => [ TagsModule::IMAGE_CATEGORY ],
'returnType' => 'object',
],
];
}
/**
* Get media control image title.
*
* Retrieve the `title` of the image selected by the media control.
*
* @since 1.0.0
* @access public
* @static
*
* @param array $attachment Media attachment.
*
* @return string Image title.
*/
public static function get_image_title( $attachment ) {
if ( empty( $attachment['id'] ) ) {
return '';
}
return get_the_title( $attachment['id'] );
}
/**
* Get media control image alt.
*
* Retrieve the `alt` value of the image selected by the media control.
*
* @since 1.0.0
* @access public
* @static
*
* @param array $instance Media attachment.
*
* @return string Image alt.
*/
public static function get_image_alt( $instance ) {
if ( empty( $instance['id'] ) ) {
// For `Insert From URL` images.
return isset( $instance['alt'] ) ? trim( strip_tags( $instance['alt'] ) ) : '';
}
$attachment_id = $instance['id'];
if ( ! $attachment_id ) {
return '';
}
$attachment = get_post( $attachment_id );
if ( ! $attachment ) {
return '';
}
$alt = get_post_meta( $attachment_id, '_wp_attachment_image_alt', true );
if ( ! $alt ) {
$alt = $attachment->post_excerpt;
if ( ! $alt ) {
$alt = $attachment->post_title;
}
}
return trim( strip_tags( $alt ) );
}
}

View File

@@ -0,0 +1,80 @@
<?php
namespace Elementor;
use Elementor\Modules\DynamicTags\Module as TagsModule;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
/**
* Elementor number control.
*
* A base control for creating a number control. Displays a simple number input.
*
* @since 1.0.0
*/
class Control_Number extends Base_Data_Control {
/**
* Get number control type.
*
* Retrieve the control type, in this case `number`.
*
* @since 1.0.0
* @access public
*
* @return string Control type.
*/
public function get_type() {
return 'number';
}
/**
* Get number control default settings.
*
* Retrieve the default settings of the number control. Used to return the
* default settings while initializing the number control.
*
* @since 1.5.0
* @access protected
*
* @return array Control default settings.
*/
protected function get_default_settings() {
return [
'min' => '',
'max' => '',
'step' => '',
'placeholder' => '',
'title' => '',
'dynamic' => [
'categories' => [ TagsModule::NUMBER_CATEGORY ],
],
];
}
/**
* Render number control output in the editor.
*
* Used to generate the control HTML in the editor using Underscore JS
* template. The variables for the class are available using `data` JS
* object.
*
* @since 1.0.0
* @access public
*/
public function content_template() {
?>
<div class="elementor-control-field">
<label for="<?php $this->print_control_uid(); ?>" class="elementor-control-title">{{{ data.label }}}</label>
<div class="elementor-control-input-wrapper elementor-control-dynamic-switcher-wrapper">
<input id="<?php $this->print_control_uid(); ?>" type="number" min="{{ data.min }}" max="{{ data.max }}" step="{{ data.step }}" class="tooltip-target elementor-control-tag-area elementor-control-unit-2" data-tooltip="{{ data.title }}" title="{{ data.title }}" data-setting="{{ data.name }}" placeholder="{{ view.getControlPlaceholder() }}" />
</div>
</div>
<# if ( data.description ) { #>
<div class="elementor-control-field-description">{{{ data.description }}}</div>
<# } #>
<?php
}
}

View File

@@ -0,0 +1,79 @@
<?php
namespace Elementor;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
/**
* Elementor popover toggle control.
*
* A base control for creating a popover toggle control. By default displays a toggle
* button to open and close a popover.
*
* @since 1.9.0
*/
class Control_Popover_Toggle extends Base_Data_Control {
/**
* Get popover toggle control type.
*
* Retrieve the control type, in this case `popover_toggle`.
*
* @since 1.9.0
* @access public
*
* @return string Control type.
*/
public function get_type() {
return 'popover_toggle';
}
/**
* Get popover toggle control default settings.
*
* Retrieve the default settings of the popover toggle control. Used to
* return the default settings while initializing the popover toggle
* control.
*
* @since 1.9.0
* @access protected
*
* @return array Control default settings.
*/
protected function get_default_settings() {
return [
'return_value' => 'yes',
];
}
/**
* Render popover toggle control output in the editor.
*
* Used to generate the control HTML in the editor using Underscore JS
* template. The variables for the class are available using `data` JS
* object.
*
* @since 1.9.0
* @access public
*/
public function content_template() {
?>
<div class="elementor-control-field">
<label class="elementor-control-title">{{{ data.label }}}</label>
<div class="elementor-control-input-wrapper">
<input id="<?php $this->print_control_uid(); ?>-custom" class="elementor-control-popover-toggle-toggle" type="radio" name="elementor-choose-{{ data.name }}-{{ data._cid }}" value="{{ data.return_value }}">
<label class="elementor-control-popover-toggle-toggle-label elementor-control-unit-1" for="<?php $this->print_control_uid(); ?>-custom">
<i class="eicon-edit" aria-hidden="true"></i>
<span class="elementor-screen-only"><?php echo esc_html__( 'Edit', 'elementor' ); ?></span>
</label>
<input id="<?php $this->print_control_uid(); ?>-default" class="elementor-control-popover-toggle-reset" type="radio" name="elementor-choose-{{ data.name }}-{{ data._cid }}" value="">
<label class="elementor-control-popover-toggle-reset-label tooltip-target" for="<?php $this->print_control_uid(); ?>-default" data-tooltip="<?php echo esc_html__( 'Back to default', 'elementor' ); ?>" data-tooltip-pos="s">
<i class="eicon-undo" aria-hidden="true"></i>
<span class="elementor-screen-only"><?php echo esc_html__( 'Back to default', 'elementor' ); ?></span>
</label>
</div>
</div>
<?php
}
}

View File

@@ -0,0 +1,69 @@
<?php
namespace Elementor;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
/**
* Elementor raw HTML control.
*
* A base control for creating raw HTML control. Displays HTML markup between
* controls in the panel.
*
* @since 1.0.0
*/
class Control_Raw_Html extends Base_UI_Control {
/**
* Get raw html control type.
*
* Retrieve the control type, in this case `raw_html`.
*
* @since 1.0.0
* @access public
*
* @return string Control type.
*/
public function get_type() {
return 'raw_html';
}
/**
* Render raw html control output in the editor.
*
* Used to generate the control HTML in the editor using Underscore JS
* template. The variables for the class are available using `data` JS
* object.
*
* @since 1.0.0
* @access public
*/
public function content_template() {
?>
<# data.raw = elementor.compileTemplate( data.raw, { view } );
if ( data.label ) { #>
<span class="elementor-control-title">{{{ data.label }}}</span>
<# } #>
<div class="elementor-control-raw-html {{ data.content_classes }}">{{{ data.raw }}}</div>
<?php
}
/**
* Get raw html control default settings.
*
* Retrieve the default settings of the raw html control. Used to return the
* default settings while initializing the raw html control.
*
* @since 1.0.0
* @access protected
*
* @return array Control default settings.
*/
protected function get_default_settings() {
return [
'raw' => '',
'content_classes' => '',
];
}
}

View File

@@ -0,0 +1,178 @@
<?php
namespace Elementor;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
/**
* Elementor repeater control.
*
* A base control for creating repeater control. Repeater control allows you to
* build repeatable blocks of fields. You can create, for example, a set of
* fields that will contain a title and a WYSIWYG text - the user will then be
* able to add "rows", and each row will contain a title and a text. The data
* can be wrapper in custom HTML tags, designed using CSS, and interact using JS
* or external libraries.
*
* @since 1.0.0
*/
class Control_Repeater extends Base_Data_Control {
/**
* Get repeater control type.
*
* Retrieve the control type, in this case `repeater`.
*
* @since 1.0.0
* @access public
*
* @return string Control type.
*/
public function get_type() {
return 'repeater';
}
/**
* Get repeater control default value.
*
* Retrieve the default value of the data control. Used to return the default
* values while initializing the repeater control.
*
* @since 2.0.0
* @access public
*
* @return array Control default value.
*/
public function get_default_value() {
return [];
}
/**
* Get repeater control default settings.
*
* Retrieve the default settings of the repeater control. Used to return the
* default settings while initializing the repeater control.
*
* @since 1.0.0
* @access protected
*
* @return array Control default settings.
*/
protected function get_default_settings() {
return [
'fields' => [],
'title_field' => '',
'prevent_empty' => true,
'is_repeater' => true,
'item_actions' => [
'add' => true,
'duplicate' => true,
'remove' => true,
'sort' => true,
],
];
}
/**
* Get repeater control value.
*
* Retrieve the value of the repeater control from a specific Controls_Stack.
*
* @since 1.0.0
* @access public
*
* @param array $control Control
* @param array $settings Controls_Stack settings
*
* @return mixed Control values.
*/
public function get_value( $control, $settings ) {
$value = parent::get_value( $control, $settings );
if ( ! empty( $value ) ) {
foreach ( $value as &$item ) {
foreach ( $control['fields'] as $field ) {
$control_obj = Plugin::$instance->controls_manager->get_control( $field['type'] );
// Prior to 1.5.0 the fields may contains non-data controls.
if ( ! $control_obj instanceof Base_Data_Control ) {
continue;
}
$item[ $field['name'] ] = $control_obj->get_value( $field, $item );
}
}
}
return $value;
}
/**
* Import repeater.
*
* Used as a wrapper method for inner controls while importing Elementor
* template JSON file, and replacing the old data.
*
* @since 1.8.0
* @access public
*
* @param array $settings Control settings.
* @param array $control_data Optional. Control data. Default is an empty array.
*
* @return array Control settings.
*/
public function on_import( $settings, $control_data = [] ) {
if ( empty( $settings ) || empty( $control_data['fields'] ) ) {
return $settings;
}
$method = 'on_import';
foreach ( $settings as &$item ) {
foreach ( $control_data['fields'] as $field ) {
if ( empty( $field['name'] ) || empty( $item[ $field['name'] ] ) ) {
continue;
}
$control_obj = Plugin::$instance->controls_manager->get_control( $field['type'] );
if ( ! $control_obj ) {
continue;
}
if ( method_exists( $control_obj, $method ) ) {
$item[ $field['name'] ] = $control_obj->{$method}( $item[ $field['name'] ], $field );
}
}
}
return $settings;
}
/**
* Render repeater control output in the editor.
*
* Used to generate the control HTML in the editor using Underscore JS
* template. The variables for the class are available using `data` JS
* object.
*
* @since 1.0.0
* @access public
*/
public function content_template() {
?>
<label>
<span class="elementor-control-title">{{{ data.label }}}</span>
</label>
<div class="elementor-repeater-fields-wrapper"></div>
<# if ( itemActions.add ) { #>
<div class="elementor-button-wrapper">
<button class="elementor-button elementor-button-default elementor-repeater-add" type="button">
<i class="eicon-plus" aria-hidden="true"></i><?php echo esc_html__( 'Add Item', 'elementor' ); ?>
</button>
</div>
<# } #>
<?php
}
}

View File

@@ -0,0 +1,72 @@
<?php
namespace Elementor;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
/**
* Elementor section control.
*
* A base control for creating section control. Displays a header that
* functions as a toggle to show or hide a set of controls.
*
* Note: Do not use it directly, instead use `$widget->start_controls_section()`
* and `$widget->end_controls_section()` to wrap a set of controls.
*
* @since 1.0.0
*/
class Control_Section extends Base_UI_Control {
/**
* Get section control type.
*
* Retrieve the control type, in this case `section`.
*
* @since 1.0.0
* @access public
*
* @return string Control type.
*/
public function get_type() {
return 'section';
}
/**
* Render section control output in the editor.
*
* Used to generate the control HTML in the editor using Underscore JS
* template. The variables for the class are available using `data` JS
* object.
*
* @since 1.0.0
* @access public
*/
public function content_template() {
?>
<div class="elementor-panel-heading">
<div class="elementor-panel-heading-toggle elementor-section-toggle" data-collapse_id="{{ data.name }}">
<i class="eicon" aria-hidden="true"></i>
</div>
<div class="elementor-panel-heading-title elementor-section-title">{{{ data.label }}}</div>
</div>
<?php
}
/**
* Get repeater control default settings.
*
* Retrieve the default settings of the repeater control. Used to return the
* default settings while initializing the repeater control.
*
* @since 1.0.0
* @access protected
*
* @return array Control default settings.
*/
protected function get_default_settings() {
return [
'separator' => 'none',
];
}
}

View File

@@ -0,0 +1,98 @@
<?php
namespace Elementor;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
/**
* Elementor select control.
*
* A base control for creating select control. Displays a simple select box.
* It accepts an array in which the `key` is the option value and the `value` is
* the option name.
*
* @since 1.0.0
*/
class Control_Select extends Base_Data_Control {
/**
* Get select control type.
*
* Retrieve the control type, in this case `select`.
*
* @since 1.0.0
* @access public
*
* @return string Control type.
*/
public function get_type() {
return 'select';
}
/**
* Get select control default settings.
*
* Retrieve the default settings of the select control. Used to return the
* default settings while initializing the select control.
*
* @since 2.0.0
* @access protected
*
* @return array Control default settings.
*/
protected function get_default_settings() {
return [
'options' => [],
];
}
/**
* Render select control output in the editor.
*
* Used to generate the control HTML in the editor using Underscore JS
* template. The variables for the class are available using `data` JS
* object.
*
* @since 1.0.0
* @access public
*/
public function content_template() {
?>
<div class="elementor-control-field">
<# if ( data.label ) {#>
<label for="<?php $this->print_control_uid(); ?>" class="elementor-control-title">{{{ data.label }}}</label>
<# } #>
<div class="elementor-control-input-wrapper elementor-control-unit-5">
<select id="<?php $this->print_control_uid(); ?>" data-setting="{{ data.name }}">
<#
var printOptions = function( options ) {
_.each( options, function( option_title, option_value ) { #>
<option value="{{ option_value }}">{{{ option_title }}}</option>
<# } );
};
if ( data.groups ) {
for ( var groupIndex in data.groups ) {
var groupArgs = data.groups[ groupIndex ];
if ( groupArgs.options ) { #>
<optgroup label="{{ groupArgs.label }}">
<# printOptions( groupArgs.options ) #>
</optgroup>
<# } else if ( _.isString( groupArgs ) ) { #>
<option value="{{ groupIndex }}">{{{ groupArgs }}}</option>
<# }
}
} else {
printOptions( data.options );
}
#>
</select>
</div>
</div>
<# if ( data.description ) { #>
<div class="elementor-control-field-description">{{{ data.description }}}</div>
<# } #>
<?php
}
}

View File

@@ -0,0 +1,94 @@
<?php
namespace Elementor;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
/**
* Elementor select2 control.
*
* A base control for creating select2 control. Displays a select box control
* based on select2 jQuery plugin @see https://select2.github.io/ .
* It accepts an array in which the `key` is the value and the `value` is the
* option name. Set `multiple` to `true` to allow multiple value selection.
*
* @since 1.0.0
*/
class Control_Select2 extends Base_Data_Control {
/**
* Get select2 control type.
*
* Retrieve the control type, in this case `select2`.
*
* @since 1.0.0
* @access public
*
* @return string Control type.
*/
public function get_type() {
return 'select2';
}
/**
* Get select2 control default settings.
*
* Retrieve the default settings of the select2 control. Used to return the
* default settings while initializing the select2 control.
*
* @since 1.8.0
* @access protected
*
* @return array Control default settings.
*/
protected function get_default_settings() {
return [
'options' => [],
'multiple' => false,
// Select2 library options
'select2options' => [],
// the lockedOptions array can be passed option keys. The passed option keys will be non-deletable.
'lockedOptions' => [],
];
}
/**
* Render select2 control output in the editor.
*
* Used to generate the control HTML in the editor using Underscore JS
* template. The variables for the class are available using `data` JS
* object.
*
* @since 1.0.0
* @access public
*/
public function content_template() {
?>
<div class="elementor-control-field">
<# if ( data.label ) {#>
<label for="<?php $this->print_control_uid(); ?>" class="elementor-control-title">{{{ data.label }}}</label>
<# } #>
<div class="elementor-control-input-wrapper elementor-control-unit-5">
<# var multiple = ( data.multiple ) ? 'multiple' : ''; #>
<select id="<?php $this->print_control_uid(); ?>" class="elementor-select2" type="select2" {{ multiple }} data-setting="{{ data.name }}">
<# _.each( data.options, function( option_title, option_value ) {
var value = data.controlValue;
if ( typeof value == 'string' ) {
var selected = ( option_value === value ) ? 'selected' : '';
} else if ( null !== value ) {
var value = _.values( value );
var selected = ( -1 !== value.indexOf( option_value ) ) ? 'selected' : '';
}
#>
<option {{ selected }} value="{{ option_value }}">{{{ option_title }}}</option>
<# } ); #>
</select>
</div>
</div>
<# if ( data.description ) { #>
<div class="elementor-control-field-description">{{{ data.description }}}</div>
<# } #>
<?php
}
}

View File

@@ -0,0 +1,128 @@
<?php
namespace Elementor;
use Elementor\Modules\DynamicTags\Module as TagsModule;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
/**
* Elementor slider control.
*
* A base control for creating slider control. Displays a draggable range slider.
* The slider control can optionally have a number of unit types (`size_units`)
* for the user to choose from. The control also accepts a range argument that
* allows you to set the `min`, `max` and `step` values per unit type.
*
* @since 1.0.0
*/
class Control_Slider extends Control_Base_Units {
/**
* Get slider control type.
*
* Retrieve the control type, in this case `slider`.
*
* @since 1.0.0
* @access public
*
* @return string Control type.
*/
public function get_type() {
return 'slider';
}
/**
* Get slider control default values.
*
* Retrieve the default value of the slider control. Used to return the default
* values while initializing the slider control.
*
* @since 1.0.0
* @access public
*
* @return array Control default value.
*/
public function get_default_value() {
return array_merge(
parent::get_default_value(), [
'size' => '',
'sizes' => [],
]
);
}
/**
* Get slider control default settings.
*
* Retrieve the default settings of the slider control. Used to return the
* default settings while initializing the slider control.
*
* @since 1.0.0
* @access protected
*
* @return array Control default settings.
*/
protected function get_default_settings() {
return array_merge(
parent::get_default_settings(), [
'label_block' => true,
'labels' => [],
'scales' => 0,
'handles' => 'default',
'dynamic' => [
'categories' => [ TagsModule::NUMBER_CATEGORY ],
'property' => 'size',
],
]
);
}
/**
* Render slider control output in the editor.
*
* Used to generate the control HTML in the editor using Underscore JS
* template. The variables for the class are available using `data` JS
* object.
*
* @since 1.0.0
* @access public
*/
public function content_template() {
?>
<div class="elementor-control-field">
<label for="<?php $this->print_control_uid(); ?>" class="elementor-control-title">{{{ data.label }}}</label>
<?php $this->print_units_template(); ?>
<div class="elementor-control-input-wrapper elementor-control-dynamic-switcher-wrapper elementor-clearfix elementor-control-tag-area">
<# if ( isMultiple && ( data.labels.length || data.scales ) ) { #>
<div class="elementor-slider__extra">
<# if ( data.labels.length ) { #>
<div class="elementor-slider__labels">
<# jQuery.each( data.labels, ( index, label ) => { #>
<div class="elementor-slider__label">{{{ label }}}</div>
<# } ); #>
</div>
<# } if ( data.scales ) { #>
<div class="elementor-slider__scales">
<# for ( var i = 0; i < data.scales; i++ ) { #>
<div class="elementor-slider__scale"></div>
<# } #>
</div>
<# } #>
</div>
<# } #>
<div class="elementor-slider"></div>
<# if ( ! isMultiple ) { #>
<div class="elementor-slider-input">
<input id="<?php $this->print_control_uid(); ?>" type="number" min="{{ data.min }}" max="{{ data.max }}" step="{{ data.step }}" placeholder="{{ view.getControlPlaceholder()?.size }}" data-setting="size" />
</div>
<# } #>
</div>
</div>
<# if ( data.description ) { #>
<div class="elementor-control-field-description">{{{ data.description }}}</div>
<# } #>
<?php
}
}

View File

@@ -0,0 +1,92 @@
<?php
namespace Elementor;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
/**
* Elementor structure control.
*
* A base control for creating structure control. A private control for section
* columns structure.
*
* @since 1.0.0
*/
class Control_Structure extends Base_Data_Control {
/**
* Get structure control type.
*
* Retrieve the control type, in this case `structure`.
*
* @since 1.0.0
* @access public
*
* @return string Control type.
*/
public function get_type() {
return 'structure';
}
/**
* Render structure control output in the editor.
*
* Used to generate the control HTML in the editor using Underscore JS
* template. The variables for the class are available using `data` JS
* object.
*
* @since 1.0.0
* @access public
*/
public function content_template() {
?>
<div class="elementor-control-field">
<div class="elementor-control-input-wrapper">
<#
var morePresets = getMorePresets();
if ( morePresets.length ) { #>
<div class="elementor-control-structure-presets">
<# _.each( morePresets, function( preset ) { #>
<div class="elementor-control-structure-preset-wrapper">
<input id="<?php $this->print_control_uid( '{{ preset.key }}' ); ?>" type="radio" name="elementor-control-structure-preset-{{ data._cid }}" data-setting="structure" value="{{ preset.key }}">
<label for="<?php $this->print_control_uid( '{{ preset.key }}' ); ?>" class="elementor-control-structure-preset">
{{{ elementor.presetsFactory.getPresetSVG( preset.preset, 102, 42 ).outerHTML }}}
</label>
<div class="elementor-control-structure-preset-title">{{{ preset.preset.join( ', ' ) }}}</div>
</div>
<# } ); #>
</div>
<# } #>
</div>
<div class="elementor-control-structure-reset">
<i class="eicon-undo" aria-hidden="true"></i>
<?php echo esc_html__( 'Reset', 'elementor' ); ?>
</div>
</div>
<# if ( data.description ) { #>
<div class="elementor-control-field-description">{{{ data.description }}}</div>
<# } #>
<?php
}
/**
* Get structure control default settings.
*
* Retrieve the default settings of the structure control. Used to return the
* default settings while initializing the structure control.
*
* @since 1.0.0
* @access protected
*
* @return array Control default settings.
*/
protected function get_default_settings() {
return [
'separator' => 'none',
'label_block' => true,
'show_label' => false,
];
}
}

View File

@@ -0,0 +1,78 @@
<?php
namespace Elementor;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
/**
* Elementor switcher control.
*
* A base control for creating switcher control. Displays an on/off switcher,
* basically a fancy UI representation of a checkbox.
*
* @since 1.0.0
*/
class Control_Switcher extends Base_Data_Control {
/**
* Get switcher control type.
*
* Retrieve the control type, in this case `switcher`.
*
* @since 1.0.0
* @access public
*
* @return string Control type.
*/
public function get_type() {
return 'switcher';
}
/**
* Render switcher control output in the editor.
*
* Used to generate the control HTML in the editor using Underscore JS
* template. The variables for the class are available using `data` JS
* object.
*
* @since 1.0.0
* @access public
*/
public function content_template() {
?>
<div class="elementor-control-field">
<label for="<?php $this->print_control_uid(); ?>" class="elementor-control-title">{{{ data.label }}}</label>
<div class="elementor-control-input-wrapper">
<label class="elementor-switch elementor-control-unit-2">
<input id="<?php $this->print_control_uid(); ?>" type="checkbox" data-setting="{{ data.name }}" class="elementor-switch-input" value="{{ data.return_value }}">
<span class="elementor-switch-label" data-on="{{ data.label_on }}" data-off="{{ data.label_off }}"></span>
<span class="elementor-switch-handle"></span>
</label>
</div>
</div>
<# if ( data.description ) { #>
<div class="elementor-control-field-description">{{{ data.description }}}</div>
<# } #>
<?php
}
/**
* Get switcher control default settings.
*
* Retrieve the default settings of the switcher control. Used to return the
* default settings while initializing the switcher control.
*
* @since 1.0.0
* @access protected
*
* @return array Control default settings.
*/
protected function get_default_settings() {
return [
'label_off' => esc_html__( 'No', 'elementor' ),
'label_on' => esc_html__( 'Yes', 'elementor' ),
'return_value' => 'yes',
];
}
}

View File

@@ -0,0 +1,69 @@
<?php
namespace Elementor;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
/**
* Elementor tab control.
*
* A base control for creating tab control. Displays a tab header for a set of
* controls.
*
* Note: Do not use it directly, instead use: `$widget->start_controls_tab()`
* and in the end `$widget->end_controls_tab()`.
*
* @since 1.0.0
*/
class Control_Tab extends Base_UI_Control {
/**
* Get tab control type.
*
* Retrieve the control type, in this case `tab`.
*
* @since 1.0.0
* @access public
*
* @return string Control type.
*/
public function get_type() {
return 'tab';
}
/**
* Render tab control output in the editor.
*
* Used to generate the control HTML in the editor using Underscore JS
* template. The variables for the class are available using `data` JS
* object.
*
* @since 1.0.0
* @access public
*/
public function content_template() {
?>
<div class="elementor-panel-tab-heading">
{{{ data.label }}}
</div>
<?php
}
/**
* Get tab control default settings.
*
* Retrieve the default settings of the tab control. Used to return the
* default settings while initializing the tab control.
*
* @since 1.0.0
* @access protected
*
* @return array Control default settings.
*/
protected function get_default_settings() {
return [
'separator' => 'none',
];
}
}

View File

@@ -0,0 +1,63 @@
<?php
namespace Elementor;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
/**
* Elementor tabs control.
*
* A base control for creating tabs control. Displays a tabs header for `tab`
* controls.
*
* Note: Do not use it directly, instead use: `$widget->start_controls_tabs()`
* and in the end `$widget->end_controls_tabs()`.
*
* @since 1.0.0
*/
class Control_Tabs extends Base_UI_Control {
/**
* Get tabs control type.
*
* Retrieve the control type, in this case `tabs`.
*
* @since 1.0.0
* @access public
*
* @return string Control type.
*/
public function get_type() {
return 'tabs';
}
/**
* Render tabs control output in the editor.
*
* Used to generate the control HTML in the editor using Underscore JS
* template. The variables for the class are available using `data` JS
* object.
*
* @since 1.0.0
* @access public
*/
public function content_template() {}
/**
* Get tabs control default settings.
*
* Retrieve the default settings of the tabs control. Used to return the
* default settings while initializing the tabs control.
*
* @since 1.0.0
* @access protected
*
* @return array Control default settings.
*/
protected function get_default_settings() {
return [
'separator' => 'none',
];
}
}

View File

@@ -0,0 +1,118 @@
<?php
namespace Elementor;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
/**
* Elementor text shadow control.
*
* A base control for creating text shadows control. Displays input fields for
* horizontal shadow, vertical shadow, shadow blur and shadow color.
*
* @since 1.6.0
*/
class Control_Text_Shadow extends Control_Base_Multiple {
/**
* Get text shadow control type.
*
* Retrieve the control type, in this case `text_shadow`.
*
* @since 1.6.0
* @access public
*
* @return string Control type.
*/
public function get_type() {
return 'text_shadow';
}
/**
* Get text shadow control default values.
*
* Retrieve the default value of the text shadow control. Used to return the
* default values while initializing the text shadow control.
*
* @since 1.6.0
* @access public
*
* @return array Control default value.
*/
public function get_default_value() {
return [
'horizontal' => 0,
'vertical' => 0,
'blur' => 10,
'color' => 'rgba(0,0,0,0.3)',
];
}
/**
* Get text shadow control sliders.
*
* Retrieve the sliders of the text shadow control. Sliders are used while
* rendering the control output in the editor.
*
* @since 1.6.0
* @access public
*
* @return array Control sliders.
*/
public function get_sliders() {
return [
'blur' => [
'label' => esc_html__( 'Blur', 'elementor' ),
'min' => 0,
'max' => 100,
],
'horizontal' => [
'label' => esc_html__( 'Horizontal', 'elementor' ),
'min' => -100,
'max' => 100,
],
'vertical' => [
'label' => esc_html__( 'Vertical', 'elementor' ),
'min' => -100,
'max' => 100,
],
];
}
/**
* Render text shadow control output in the editor.
*
* Used to generate the control HTML in the editor using Underscore JS
* template. The variables for the class are available using `data` JS
* object.
*
* @since 1.6.0
* @access public
*/
public function content_template() {
?>
<div class="elementor-shadow-box">
<div class="elementor-control-field elementor-color-picker-wrapper">
<label class="elementor-control-title"><?php echo esc_html__( 'Color', 'elementor' ); ?></label>
<div class="elementor-control-input-wrapper elementor-control-unit-1">
<div class="elementor-color-picker-placeholder"></div>
</div>
</div>
<?php
foreach ( $this->get_sliders() as $slider_name => $slider ) :
?>
<div class="elementor-shadow-slider elementor-control-type-slider">
<label for="<?php $this->print_control_uid( $slider_name ); ?>" class="elementor-control-title"><?php echo esc_html( $slider['label'] ); ?></label>
<div class="elementor-control-input-wrapper">
<div class="elementor-slider" data-input="<?php echo esc_attr( $slider_name ); ?>"></div>
<div class="elementor-slider-input elementor-control-unit-2">
<input id="<?php $this->print_control_uid( $slider_name ); ?>" type="number" min="<?php echo esc_attr( $slider['min'] ); ?>" max="<?php echo esc_attr( $slider['max'] ); ?>" data-setting="<?php echo esc_attr( $slider_name ); ?>"/>
</div>
</div>
</div>
<?php endforeach; ?>
</div>
<?php
}
}

View File

@@ -0,0 +1,82 @@
<?php
namespace Elementor;
use Elementor\Modules\DynamicTags\Module as TagsModule;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
/**
* Elementor text control.
*
* A base control for creating text control. Displays a simple text input.
*
* @since 1.0.0
*/
class Control_Text extends Base_Data_Control {
/**
* Get text control type.
*
* Retrieve the control type, in this case `text`.
*
* @since 1.0.0
* @access public
*
* @return string Control type.
*/
public function get_type() {
return 'text';
}
/**
* Render text control output in the editor.
*
* Used to generate the control HTML in the editor using Underscore JS
* template. The variables for the class are available using `data` JS
* object.
*
* @since 1.0.0
* @access public
*/
public function content_template() {
?>
<div class="elementor-control-field">
<# if ( data.label ) {#>
<label for="<?php $this->print_control_uid(); ?>" class="elementor-control-title">{{{ data.label }}}</label>
<# } #>
<div class="elementor-control-input-wrapper elementor-control-unit-5 elementor-control-dynamic-switcher-wrapper">
<input id="<?php $this->print_control_uid(); ?>" type="{{ data.input_type }}" class="tooltip-target elementor-control-tag-area" data-tooltip="{{ data.title }}" title="{{ data.title }}" data-setting="{{ data.name }}" placeholder="{{ view.getControlPlaceholder() }}" />
</div>
</div>
<# if ( data.description ) { #>
<div class="elementor-control-field-description">{{{ data.description }}}</div>
<# } #>
<?php
}
/**
* Get text control default settings.
*
* Retrieve the default settings of the text control. Used to return the
* default settings while initializing the text control.
*
* @since 1.0.0
* @access protected
*
* @return array Control default settings.
*/
protected function get_default_settings() {
return [
'input_type' => 'text',
'placeholder' => '',
'title' => '',
'dynamic' => [
'categories' => [
TagsModule::TEXT_CATEGORY,
],
],
];
}
}

View File

@@ -0,0 +1,78 @@
<?php
namespace Elementor;
use Elementor\Modules\DynamicTags\Module as TagsModule;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
/**
* Elementor textarea control.
*
* A base control for creating textarea control. Displays a classic textarea.
*
* @since 1.0.0
*/
class Control_Textarea extends Base_Data_Control {
/**
* Get textarea control type.
*
* Retrieve the control type, in this case `textarea`.
*
* @since 1.0.0
* @access public
*
* @return string Control type.
*/
public function get_type() {
return 'textarea';
}
/**
* Get textarea control default settings.
*
* Retrieve the default settings of the textarea control. Used to return the
* default settings while initializing the textarea control.
*
* @since 1.0.0
* @access protected
*
* @return array Control default settings.
*/
protected function get_default_settings() {
return [
'label_block' => true,
'rows' => 5,
'placeholder' => '',
'dynamic' => [
'categories' => [ TagsModule::TEXT_CATEGORY ],
],
];
}
/**
* Render textarea control output in the editor.
*
* Used to generate the control HTML in the editor using Underscore JS
* template. The variables for the class are available using `data` JS
* object.
*
* @since 1.0.0
* @access public
*/
public function content_template() {
?>
<div class="elementor-control-field">
<label for="<?php $this->print_control_uid(); ?>" class="elementor-control-title">{{{ data.label }}}</label>
<div class="elementor-control-input-wrapper elementor-control-dynamic-switcher-wrapper">
<textarea id="<?php $this->print_control_uid(); ?>" class="elementor-control-tag-area" rows="{{ data.rows }}" data-setting="{{ data.name }}" placeholder="{{ view.getControlPlaceholder() }}"></textarea>
</div>
</div>
<# if ( data.description ) { #>
<div class="elementor-control-field-description">{{{ data.description }}}</div>
<# } #>
<?php
}
}

View File

@@ -0,0 +1,126 @@
<?php
namespace Elementor;
use Elementor\Modules\DynamicTags\Module as TagsModule;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
/**
* Elementor URL control.
*
* A base control for creating url control. Displays a URL input with the
* ability to set the target of the link to `_blank` to open in a new tab.
*
* @since 1.0.0
*/
class Control_URL extends Control_Base_Multiple {
/**
* Get url control type.
*
* Retrieve the control type, in this case `url`.
*
* @since 1.0.0
* @access public
*
* @return string Control type.
*/
public function get_type() {
return 'url';
}
/**
* Get url control default values.
*
* Retrieve the default value of the url control. Used to return the default
* values while initializing the url control.
*
* @since 1.0.0
* @access public
*
* @return array Control default value.
*/
public function get_default_value() {
return [
'url' => '',
'is_external' => '',
'nofollow' => '',
'custom_attributes' => '',
];
}
/**
* Get url control default settings.
*
* Retrieve the default settings of the url control. Used to return the default
* settings while initializing the url control.
*
* @since 1.0.0
* @access protected
*
* @return array Control default settings.
*/
protected function get_default_settings() {
return [
'label_block' => true,
'placeholder' => esc_html__( 'Paste URL or type', 'elementor' ),
'autocomplete' => true,
'options' => [ 'is_external', 'nofollow', 'custom_attributes' ],
'dynamic' => [
'categories' => [ TagsModule::URL_CATEGORY ],
'property' => 'url',
],
'custom_attributes_description' => esc_html__( 'Set custom attributes for the link element. Separate attribute keys from values using the | (pipe) character. Separate key-value pairs with a comma.', 'elementor' )
. ' <a href="https://go.elementor.com/panel-link-custom-attributes/" target="_blank">' . esc_html__( 'Learn More', 'elementor' ) . '</a>',
];
}
/**
* Render url control output in the editor.
*
* Used to generate the control HTML in the editor using Underscore JS
* template. The variables for the class are available using `data` JS
* object.
*
* @since 1.0.0
* @access public
*/
public function content_template() {
?>
<div class="elementor-control-field elementor-control-url-external-{{{ ( data.options.length || data.show_external ) ? 'show' : 'hide' }}}">
<label for="<?php $this->print_control_uid(); ?>" class="elementor-control-title">{{{ data.label }}}</label>
<div class="elementor-control-input-wrapper elementor-control-dynamic-switcher-wrapper">
<i class="elementor-control-url-autocomplete-spinner eicon-loading eicon-animation-spin" aria-hidden="true"></i>
<input id="<?php $this->print_control_uid(); ?>" class="elementor-control-tag-area elementor-input" data-setting="url" placeholder="{{ view.getControlPlaceholder() }}" />
<?php // PHPCS - Nonces don't require escaping. ?>
<input id="_ajax_linking_nonce" type="hidden" value="<?php echo wp_create_nonce( 'internal-linking' ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>" />
<div class="elementor-control-url-more tooltip-target elementor-control-unit-1" data-tooltip="<?php echo esc_html__( 'Link Options', 'elementor' ); ?>">
<i class="eicon-cog" aria-hidden="true"></i>
</div>
</div>
<div class="elementor-control-url-more-options">
<div class="elementor-control-url-option">
<input id="<?php $this->print_control_uid( 'is_external' ); ?>" type="checkbox" class="elementor-control-url-option-input" data-setting="is_external">
<label for="<?php $this->print_control_uid( 'is_external' ); ?>"><?php echo esc_html__( 'Open in new window', 'elementor' ); ?></label>
</div>
<div class="elementor-control-url-option">
<input id="<?php $this->print_control_uid( 'nofollow' ); ?>" type="checkbox" class="elementor-control-url-option-input" data-setting="nofollow">
<label for="<?php $this->print_control_uid( 'nofollow' ); ?>"><?php echo esc_html__( 'Add nofollow', 'elementor' ); ?></label>
</div>
<div class="elementor-control-url__custom-attributes">
<label for="<?php $this->print_control_uid( 'custom_attributes' ); ?>" class="elementor-control-url__custom-attributes-label"><?php echo esc_html__( 'Custom Attributes', 'elementor' ); ?></label>
<input type="text" id="<?php $this->print_control_uid( 'custom_attributes' ); ?>" class="elementor-control-unit-5" placeholder="key|value" data-setting="custom_attributes">
</div>
<# if ( ( data.options && -1 !== data.options.indexOf( 'custom_attributes' ) ) && data.custom_attributes_description ) { #>
<div class="elementor-control-field-description">{{{ data.custom_attributes_description }}}</div>
<# } #>
</div>
</div>
<# if ( data.description ) { #>
<div class="elementor-control-field-description">{{{ data.description }}}</div>
<# } #>
<?php
}
}

View File

@@ -0,0 +1,64 @@
<?php
namespace Elementor;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
/**
* Elementor WordPress widget control.
*
* A base control for creating WordPress widget control. Displays native
* WordPress widgets. This a private control for internal use.
*
* @since 1.0.0
*/
class Control_WP_Widget extends Base_Data_Control {
/**
* Get WordPress widget control type.
*
* Retrieve the control type, in this case `wp_widget`.
*
* @since 1.0.0
* @access public
*
* @return string Control type.
*/
public function get_type() {
return 'wp_widget';
}
/**
* Get WordPress widget control default values.
*
* Retrieve the default value of the WordPress widget control. Used to return the
* default values while initializing the WordPress widget control.
*
* @since 1.4.3
* @access public
*
* @return array Control default value.
*/
public function get_default_value() {
return [];
}
/**
* Render WordPress widget control output in the editor.
*
* Used to generate the control HTML in the editor using Underscore JS
* template. The variables for the class are available using `data` JS
* object.
*
* @since 1.0.0
* @access public
*/
public function content_template() {
?>
<form action="" method="post">
<div class="wp-widget-form-loading">Loading..</div>
</form>
<?php
}
}

View File

@@ -0,0 +1,76 @@
<?php
namespace Elementor;
use Elementor\Modules\DynamicTags\Module as TagsModule;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
/**
* Elementor WYSIWYG control.
*
* A base control for creating WYSIWYG control. Displays a WordPress WYSIWYG
* (TinyMCE) editor.
*
* @since 1.0.0
*/
class Control_Wysiwyg extends Base_Data_Control {
/**
* Get wysiwyg control type.
*
* Retrieve the control type, in this case `wysiwyg`.
*
* @since 1.0.0
* @access public
*
* @return string Control type.
*/
public function get_type() {
return 'wysiwyg';
}
/**
* Render wysiwyg control output in the editor.
*
* Used to generate the control HTML in the editor using Underscore JS
* template. The variables for the class are available using `data` JS
* object.
*
* @since 1.0.0
* @access public
*/
public function content_template() {
?>
<div class="elementor-control-field">
<div class="elementor-control-title">{{{ data.label }}}</div>
<div class="elementor-control-input-wrapper elementor-control-tag-area"></div>
</div>
<# if ( data.description ) { #>
<div class="elementor-control-field-description">{{{ data.description }}}</div>
<# } #>
<?php
}
/**
* Retrieve textarea control default settings.
*
* Get the default settings of the textarea control. Used to return the
* default settings while initializing the textarea control.
*
* @since 2.0.0
* @access protected
*
* @return array Control default settings.
*/
protected function get_default_settings() {
return [
'label_block' => true,
'dynamic' => [
'active' => true,
'categories' => [ TagsModule::TEXT_CATEGORY ],
],
];
}
}