Diff: STRATO-apps/wordpress_03/app/wp-content/plugins/elementor/includes/controls/base-data.php
Keine Baseline-Datei – Diff nur gegen leer.
1
-
1
+
<?php
2
+
namespace Elementor;
3
+
4
+
if ( ! defined( 'ABSPATH' ) ) {
5
+
exit; // Exit if accessed directly.
6
+
}
7
+
8
+
/**
9
+
* Elementor base data control.
10
+
*
11
+
* An abstract class for creating new data controls in the panel.
12
+
*
13
+
* @since 1.5.0
14
+
* @abstract
15
+
*/
16
+
abstract class Base_Data_Control extends Base_Control {
17
+
18
+
public function __construct() {
19
+
parent::__construct();
20
+
21
+
$default_value = $this->get_default_value();
22
+
23
+
if ( '' !== $default_value ) {
24
+
$this->set_settings( 'default_value', $default_value );
25
+
}
26
+
}
27
+
28
+
/**
29
+
* Get data control default value.
30
+
*
31
+
* Retrieve the default value of the data control. Used to return the default
32
+
* values while initializing the data control.
33
+
*
34
+
* @since 1.5.0
35
+
* @access public
36
+
*
37
+
* @return string Control default value.
38
+
*/
39
+
public function get_default_value() {
40
+
return '';
41
+
}
42
+
43
+
/**
44
+
* Get data control value.
45
+
*
46
+
* Retrieve the value of the data control from a specific Controls_Stack settings.
47
+
*
48
+
* @since 1.5.0
49
+
* @access public
50
+
*
51
+
* @param array $control Control.
52
+
* @param array $settings Element settings.
53
+
*
54
+
* @return mixed Control values.
55
+
*/
56
+
public function get_value( $control, $settings ) {
57
+
if ( ! isset( $control['default'] ) ) {
58
+
$control['default'] = $this->get_default_value();
59
+
}
60
+
61
+
if ( isset( $settings[ $control['name'] ] ) ) {
62
+
$value = $settings[ $control['name'] ];
63
+
} else {
64
+
$value = $control['default'];
65
+
}
66
+
67
+
return $value;
68
+
}
69
+
70
+
/**
71
+
* Parse dynamic tags.
72
+
*
73
+
* Iterates through all the controls and renders all the dynamic tags.
74
+
*
75
+
* @since 2.0.0
76
+
* @access public
77
+
*
78
+
* @param string $dynamic_value The dynamic tag text.
79
+
* @param array $dynamic_settings The dynamic tag settings.
80
+
*
81
+
* @return string|string[]|mixed A string or an array of strings with the
82
+
* return value from each tag callback function.
83
+
*/
84
+
public function parse_tags( $dynamic_value, $dynamic_settings ) {
85
+
$current_dynamic_settings = $this->get_settings( 'dynamic' );
86
+
87
+
if ( is_array( $current_dynamic_settings ) ) {
88
+
$dynamic_settings = array_merge( $current_dynamic_settings, $dynamic_settings );
89
+
}
90
+
91
+
return Plugin::$instance->dynamic_tags->parse_tags_text( $dynamic_value, $dynamic_settings, [ Plugin::$instance->dynamic_tags, 'get_tag_data_content' ] );
92
+
}
93
+
94
+
/**
95
+
* Get data control style value.
96
+
*
97
+
* Retrieve the style of the control. Used when adding CSS rules to the control
98
+
* while extracting CSS from the `selectors` data argument.
99
+
*
100
+
* @since 1.5.0
101
+
* @since 2.3.3 New `$control_data` parameter added.
102
+
* @access public
103
+
*
104
+
* @param string $css_property CSS property.
105
+
* @param string $control_value Control value.
106
+
* @param array $control_data Control Data.
107
+
*
108
+
* @return string Control style value.
109
+
*/
110
+
public function get_style_value( $css_property, $control_value, array $control_data ) {
111
+
if ( 'DEFAULT' === $css_property ) {
112
+
return $control_data['default'];
113
+
}
114
+
115
+
return $control_value;
116
+
}
117
+
118
+
/**
119
+
* Get data control unique ID.
120
+
*
121
+
* Retrieve the unique ID of the control. Used to set a uniq CSS ID for the
122
+
* element.
123
+
*
124
+
* @since 1.5.0
125
+
* @access protected
126
+
*
127
+
* @param string $input_type Input type. Default is 'default'.
128
+
*
129
+
* @return string Unique ID.
130
+
*/
131
+
protected function get_control_uid( $input_type = 'default' ) {
132
+
return 'elementor-control-' . $input_type . '-{{{ data._cid }}}';
133
+
}
134
+
135
+
/**
136
+
* Safe Print data control unique ID.
137
+
*
138
+
* Retrieve the unique ID of the control. Used to set a unique CSS ID for the
139
+
* element.
140
+
*
141
+
* @access protected
142
+
*
143
+
* @param string $input_type Input type. Default is 'default'.
144
+
*/
145
+
protected function print_control_uid( $input_type = 'default' ) {
146
+
echo esc_attr( $this->get_control_uid( $input_type ) );
147
+
}
148
+
}
149
+