Diff: STRATO-apps/wordpress_03/app/wp-content/plugins/elementor/includes/controls/icons.php

Keine Baseline-Datei – Diff nur gegen leer.
Zur Liste
1 -
1 + <?php
2 + namespace Elementor;
3 +
4 + use Elementor\Modules\DynamicTags\Module as TagsModule;
5 +
6 + if ( ! defined( 'ABSPATH' ) ) {
7 + exit; // Exit if accessed directly.
8 + }
9 +
10 + /**
11 + * Elementor Icons control.
12 + *
13 + * A base control for creating a Icons chooser control.
14 + * Used to select an Icon.
15 + *
16 + * Usage: @see https://developers.elementor.com/elementor-controls/icons-control
17 + *
18 + * @since 2.6.0
19 + */
20 + class Control_Icons extends Control_Base_Multiple {
21 +
22 + /**
23 + * Get media control type.
24 + *
25 + * Retrieve the control type, in this case `media`.
26 + *
27 + * @access public
28 + * @since 2.6.0
29 + * @return string Control type.
30 + */
31 + public function get_type() {
32 + return 'icons';
33 + }
34 +
35 + /**
36 + * Get Icons control default values.
37 + *
38 + * Retrieve the default value of the Icons control. Used to return the default
39 + * values while initializing the Icons control.
40 + *
41 + * @access public
42 + * @since 2.6.0
43 + * @return array Control default value.
44 + */
45 + public function get_default_value() {
46 + return [
47 + 'value' => '',
48 + 'library' => '',
49 + ];
50 + }
51 +
52 + /**
53 + * Render Icons control output in the editor.
54 + *
55 + * Used to generate the control HTML in the editor using Underscore JS
56 + * template. The variables for the class are available using `data` JS
57 + * object.
58 + *
59 + * @since 2.6.0
60 + * @access public
61 + */
62 + public function content_template() {
63 + ?>
64 + <# if ( 'inline' === data.skin ) { #>
65 + <?php $this->render_inline_skin(); ?>
66 + <# } else { #>
67 + <?php $this->render_media_skin(); ?>
68 + <# } #>
69 + <?php
70 + }
71 +
72 + public function render_media_skin() {
73 + ?>
74 + <div class="elementor-control-field elementor-control-media">
75 + <label class="elementor-control-title">{{{ data.label }}}</label>
76 + <div class="elementor-control-input-wrapper">
77 + <div class="elementor-control-media__content elementor-control-tag-area elementor-control-preview-area">
78 + <div class="elementor-control-media-upload-button elementor-control-media__content__upload-button">
79 + <i class="eicon-plus-circle" aria-hidden="true"></i>
80 + <span class="elementor-screen-only"><?php echo esc_html__( 'Add', 'elementor' ); ?></span>
81 + </div>
82 + <div class="elementor-control-media-area">
83 + <div class="elementor-control-media__remove elementor-control-media__content__remove" data-tooltip="<?php echo esc_attr__( 'Remove', 'elementor' ); ?>">
84 + <i class="eicon-trash-o" aria-hidden="true"></i>
85 + <span class="elementor-screen-only"><?php echo esc_html__( 'Remove', 'elementor' ); ?></span>
86 + </div>
87 + <div class="elementor-control-media__preview"></div>
88 + </div>
89 + <div class="elementor-control-media__tools elementor-control-dynamic-switcher-wrapper">
90 + <div class="elementor-control-icon-picker elementor-control-media__tool"><?php echo esc_html__( 'Icon Library', 'elementor' ); ?></div>
91 + <div class="elementor-control-svg-uploader elementor-control-media__tool"><?php echo esc_html__( 'Upload SVG', 'elementor' ); ?></div>
92 + </div>
93 + </div>
94 + </div>
95 + <# if ( data.description ) { #>
96 + <div class="elementor-control-field-description">{{{ data.description }}}</div>
97 + <# } #>
98 + <input type="hidden" data-setting="{{ data.name }}"/>
99 + </div>
100 + <?php
101 + }
102 +
103 + public function render_inline_skin() {
104 + ?>
105 + <#
106 + const defaultSkinSettings = {
107 + none: {
108 + label: '<?php echo esc_html__( 'None', 'elementor' ); ?>',
109 + icon: 'eicon-ban',
110 + },
111 + svg: {
112 + label: '<?php echo esc_html__( 'Upload SVG', 'elementor' ); ?>',
113 + icon: 'eicon-upload',
114 + },
115 + icon: {
116 + label: '<?php echo esc_html__( 'Icon Library', 'elementor' ); ?>',
117 + icon: 'eicon-circle',
118 + }
119 + };
120 +
121 + const skinSettings = data.skin_settings.inline;
122 +
123 + const get = ( type, key ) => {
124 + if ( skinSettings[ type ] ) {
125 + return skinSettings[ type ]?.[ key ] || defaultSkinSettings[ type ][ key ];
126 + }
127 +
128 + return defaultSkinSettings[ type ][ key ];
129 + }
130 + #>
131 + <div class="elementor-control-field elementor-control-inline-icon">
132 + <label class="elementor-control-title">{{{ data.label }}}</label>
133 + <div class="elementor-control-input-wrapper">
134 + <div class="elementor-choices">
135 + <# if ( ! data.exclude_inline_options.includes( 'none' ) ) { #>
136 + <input id="<?php $this->print_control_uid(); ?>-none" type="radio" value="none">
137 + <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="{{ get( 'none', 'label' ) }}">
138 + <i class="{{ get( 'none', 'icon' ) }}" aria-hidden="true"></i>
139 + <span class="elementor-screen-only">{{ get( 'none', 'label' ) }}</span>
140 + </label>
141 + <# }
142 + if ( ! data.exclude_inline_options.includes( 'svg' ) ) { #>
143 + <input id="<?php $this->print_control_uid(); ?>-svg" type="radio" value="svg">
144 + <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="{{ get( 'svg', 'label' ) }}">
145 + <i class="{{ get( 'svg', 'icon' ) }}" aria-hidden="true"></i>
146 + <span class="elementor-screen-only">{{ get( 'svg', 'label' ) }}</span>
147 + </label>
148 + <# }
149 + if ( ! data.exclude_inline_options.includes( 'icon' ) ) { #>
150 + <input id="<?php $this->print_control_uid(); ?>-icon" type="radio" value="icon">
151 + <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="{{ get( 'icon', 'label' ) }}">
152 + <span class="elementor-control-icons--inline__displayed-icon">
153 + <i class="{{ get( 'icon', 'icon' ) }}" aria-hidden="true"></i>
154 + </span>
155 + <span class="elementor-screen-only">{{ get( 'icon', 'label' ) }}</span>
156 + </label>
157 + <# } #>
158 + </div>
159 + </div>
160 + </div>
161 +
162 + <# if ( data.description ) { #>
163 + <div class="elementor-control-field-description">{{{ data.description }}}</div>
164 + <# } #>
165 + <?php
166 + }
167 +
168 + /**
169 + * Get Icons control default settings.
170 + *
171 + * Retrieve the default settings of the Icons control. Used to return the default
172 + * settings while initializing the Icons control.
173 + *
174 + * @since 2.6.0
175 + * @access protected
176 + *
177 + * @return array Control default settings.
178 + */
179 + protected function get_default_settings() {
180 + return [
181 + 'label_block' => true,
182 + 'dynamic' => [
183 + 'categories' => [ TagsModule::IMAGE_CATEGORY ],
184 + 'returnType' => 'object',
185 + ],
186 + 'search_bar' => true,
187 + 'recommended' => false,
188 + 'skin' => 'media',
189 + 'exclude_inline_options' => [],
190 + 'disable_initial_active_state' => false,
191 + 'skin_settings' => [
192 + 'inline' => [
193 + 'none' => [
194 + 'label' => esc_html__( 'None', 'elementor' ),
195 + 'icon' => 'eicon-ban',
196 + ],
197 + 'svg' => [
198 + 'label' => esc_html__( 'Upload SVG', 'elementor' ),
199 + 'icon' => 'eicon-upload',
200 + ],
201 + 'icon' => [
202 + 'label' => esc_html__( 'Icon Library', 'elementor' ),
203 + 'icon' => 'eicon-circle',
204 + ],
205 + ],
206 + ],
207 + ];
208 + }
209 +
210 + /**
211 + * Support SVG Import
212 + *
213 + * @param array $mimes
214 + * @return array
215 + * @deprecated 3.5.0
216 + */
217 + public function support_svg_import( $mimes ) {
218 + Plugin::$instance->modules_manager->get_modules( 'dev-tools' )->deprecation->deprecated_function( __METHOD__, '3.5.0' );
219 +
220 + $mimes['svg'] = 'image/svg+xml';
221 + return $mimes;
222 + }
223 +
224 + public function on_import( $settings ) {
225 + if ( empty( $settings['library'] ) || 'svg' !== $settings['library'] || empty( $settings['value']['url'] ) ) {
226 + return $settings;
227 + }
228 +
229 + $imported = Plugin::$instance->templates_manager->get_import_images_instance()->import( $settings['value'] );
230 +
231 + if ( ! $imported ) {
232 + $settings['value'] = '';
233 + $settings['library'] = '';
234 + } else {
235 + $settings['value'] = $imported;
236 + }
237 + return $settings;
238 + }
239 + }
240 +