| @@ -1,6 +1,5 @@ | ||
| 1 | 1 | <?php |
| 2 | -namespace Easyel\EasyElements\Widgets; | |
| 3 | 2 | use Elementor\Controls_Manager; |
| 4 | 3 | use Elementor\Group_Control_Typography; |
| 5 | 4 | use Elementor\Widget_Base; |
| 6 | 5 | use Elementor\Group_Control_Background; |
| @@ -10,8 +9,18 @@ | ||
| 10 | 9 | } |
| 11 | 10 | |
| 12 | 11 | class Easyel_Heading_Widget extends \Elementor\Widget_Base { |
| 13 | 12 | |
| 13 | + public function get_style_depends() { | |
| 14 | + $handle = 'eel-heading-style'; | |
| 15 | + $css_path = plugin_dir_path( __FILE__ ) . 'css/heading.css'; | |
| 16 | + | |
| 17 | + if ( ! wp_style_is( $handle, 'registered' ) && file_exists( $css_path ) ) { | |
| 18 | + wp_register_style( $handle, plugins_url( 'css/heading.css', __FILE__ ), [], defined( 'WP_DEBUG' ) && WP_DEBUG ? filemtime( $css_path ) : '1.0.0' ); | |
| 19 | + } | |
| 20 | + return [ $handle ]; | |
| 21 | + } | |
| 22 | + | |
| 14 | 23 | public function get_name() { |
| 15 | 24 | return 'eel-heading'; |
| 16 | 25 | } |
| 17 | 26 | |
| @@ -29,20 +38,14 @@ | ||
| 29 | 38 | public function get_keywords() { |
| 30 | 39 | return [ 'heading', 'title', 'link', 'click', 'text' ]; |
| 31 | 40 | } |
| 32 | 41 | |
| 33 | - public function get_style_depends() { | |
| 34 | - return [ | |
| 35 | - 'eel-heading', | |
| 36 | - ]; | |
| 37 | - } | |
| 42 | + protected function register_controls() { | |
| 38 | 43 | |
| 39 | - | |
| 40 | - protected function register_controls() { | |
| 41 | 44 | $this->start_controls_section( |
| 42 | 45 | 'content_section', |
| 43 | 46 | [ |
| 44 | - 'label' => esc_html__('Heading Settings', 'easy-elements'), | |
| 47 | + 'label' => esc_html__('Easy Heading Settings', 'easy-elements'), | |
| 45 | 48 | 'tab' => Controls_Manager::TAB_CONTENT, |
| 46 | 49 | ] |
| 47 | 50 | ); |
| 48 | 51 | |
| @@ -1195,9 +1198,8 @@ | ||
| 1195 | 1198 | |
| 1196 | 1199 | if ( ! empty( $settings['sub_title'] ) ) : ?> |
| 1197 | 1200 | <div class="eel-sub-heading <?php echo esc_attr($icon_direction); ?> <?php echo esc_attr($settings['show_gradient_border'] == 'yes' ? 'easy_gradiant_border' : ''); ?>"> |
| 1198 | 1201 | <?php |
| 1199 | - $this->add_inline_editing_attributes( 'sub_title' ); | |
| 1200 | 1202 | if ( 'icon' === $settings['sub_heading_type'] && ! empty( $settings['sub_heading_icon']['value'] ) ) { |
| 1201 | 1203 | \Elementor\Icons_Manager::render_icon( $settings['sub_heading_icon'], [ 'aria-hidden' => 'true' ] ); |
| 1202 | 1204 | } elseif ( 'image' === $settings['sub_heading_type'] && ! empty( $settings['sub_heading_image']['url'] ) ) { |
| 1203 | 1205 | if ( ! empty( $settings['sub_heading_image']['id'] ) ) { |
| @@ -1209,15 +1211,11 @@ | ||
| 1209 | 1211 | ); |
| 1210 | 1212 | } elseif ( ! empty( $settings['sub_heading_image']['url'] ) ) { |
| 1211 | 1213 | echo '<img src="' . esc_url( $settings['sub_heading_image']['url'] ) . '" alt="">'; |
| 1212 | 1214 | } |
| 1213 | - } | |
| 1214 | - | |
| 1215 | - ?> | |
| 1216 | - <span class="elementor-inline-editing" <?php | |
| 1217 | - // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped | |
| 1218 | - echo $this->get_render_attribute_string( 'sub_title' ); ?>> | |
| 1219 | - <?php | |
| 1215 | + } ?> | |
| 1216 | + <span> | |
| 1217 | + <?php | |
| 1220 | 1218 | echo wp_kses_post( $settings['sub_title'] ); |
| 1221 | 1219 | ?> |
| 1222 | 1220 | </span> |
| 1223 | 1221 | </div> |
| @@ -1228,32 +1226,27 @@ | ||
| 1228 | 1226 | $this->render_separator( $settings ); |
| 1229 | 1227 | } |
| 1230 | 1228 | } |
| 1231 | 1229 | |
| 1232 | - $allowed_tags = ['h1','h2','h3','h4','h5','h6','div','span']; | |
| 1230 | + $allowed_tags = ['h1','h2','h3','h4','h5','h6','div','span']; | |
| 1233 | 1231 | $tag = in_array(strtolower($tag), $allowed_tags, true) ? strtolower($tag) : 'div'; |
| 1234 | 1232 | |
| 1235 | 1233 | |
| 1236 | 1234 | if ( ! empty( $title ) ) { |
| 1237 | - $gradient_class = ! empty( $settings['show_gradient_title'] ) ? ' e-e-gradient-title' : ''; | |
| 1235 | + $gradient_class = ! empty( $settings['show_gradient_title'] ) ? ' e-e-gradient-title' : ''; | |
| 1238 | 1236 | $image_fill_class = ( ! empty( $settings['enable_title_image_fill'] ) ) ? ' e-e-image-fill' : ''; |
| 1239 | - $tag_class = 'e-e-title elementor-inline-editing' . $gradient_class . $image_fill_class; | |
| 1237 | + $tag_class = 'e-e-title' . $gradient_class . $image_fill_class; | |
| 1240 | 1238 | |
| 1241 | - // Inline editing attribute add | |
| 1242 | - $this->add_inline_editing_attributes( 'title' ); | |
| 1243 | - | |
| 1244 | 1239 | printf( |
| 1245 | 1240 | '<%1$s class="%2$s" %3$s>%4$s</%1$s>', |
| 1246 | 1241 | esc_html( $tag ), |
| 1247 | 1242 | esc_attr( $tag_class ), |
| 1248 | - // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped | |
| 1249 | - $this->get_render_attribute_string( 'title' ), | |
| 1243 | + esc_attr( $this->get_render_attribute_string( 'title' ) ), | |
| 1250 | 1244 | wp_kses_post( $title ) |
| 1251 | 1245 | ); |
| 1252 | 1246 | } |
| 1253 | 1247 | |
| 1254 | 1248 | |
| 1255 | - | |
| 1256 | 1249 | if ( in_array( $separator_position, ['below'], true ) ) { |
| 1257 | 1250 | if ( ! empty( $settings['separator_'] ) ) { |
| 1258 | 1251 | $this->render_separator( $settings ); |
| 1259 | 1252 | } |
| @@ -1259,13 +1252,10 @@ | ||
| 1259 | 1252 | } |
| 1260 | 1253 | } |
| 1261 | 1254 | |
| 1262 | 1255 | if ( ! empty( $settings['description'] ) ) { |
| 1263 | - $this->add_inline_editing_attributes( 'description' ); | |
| 1264 | 1256 | ?> |
| 1265 | - <div class="e-e-description elementor-inline-editing" <?php | |
| 1266 | - // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped | |
| 1267 | - echo $this->get_render_attribute_string( 'description' ); ?>> | |
| 1257 | + <div class="e-e-description"> | |
| 1268 | 1258 | <?php echo wp_kses_post( $settings['description'] ); ?> |
| 1269 | 1259 | </div> |
| 1270 | 1260 | <?php } |
| 1271 | 1261 | if ( in_array( $separator_position, ['bottom'], true ) ) { |
| @@ -1282,5 +1272,6 @@ | ||
| 1282 | 1272 | |
| 1283 | 1273 | ?> |
| 1284 | 1274 | </div> |
| 1285 | 1275 | <?php } |
| 1286 | -} | |
| 1276 | +} | |
| 1277 | +?> | |