PluginProbe
Sky Addons for Elementor / trunk
Sky Addons for Elementor vtrunk
3.8.5 3.8.4 3.8.3 3.8.2 3.8.0 3.8.1 3.3.3 3.3.2 trunk 1.0.0 1.0.10 1.0.2 1.0.6 1.0.7 1.0.8 1.0.9 1.5.0 2.0.0 2.0.8 2.5.10 2.5.11 2.5.12 2.5.13 2.5.15 2.5.16 All 52 releases
sky-elementor-addons / includes / functions.php

functions.php in Sky Addons for Elementor trunk, at includes/functions.php

758 lines 18.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 defined( 'ABSPATH' ) || exit;
4
5 if ( ! function_exists( 'sky_addons_core' ) ) {
6
7 function sky_addons_core() {
8 $obj = new \stdClass();
9 $obj->templates_dir = \Sky_Addons\Sky_Addons_Plugin::sky_addons_dir() . 'includes/views/';
10 $obj->includes_dir = \Sky_Addons\Sky_Addons_Plugin::sky_addons_dir() . 'includes/';
11 $obj->controls_dir = \Sky_Addons\Sky_Addons_Plugin::sky_addons_dir() . 'controls/';
12 $obj->images = \Sky_Addons\Sky_Addons_Plugin::sky_addons_url() . 'assets/images/';
13 $obj->traits_dir = \Sky_Addons\Sky_Addons_Plugin::sky_addons_dir() . 'traits/';
14 return $obj;
15 }
16 }
17
18 if ( ! function_exists( 'sky_addons_get_icon' ) ) {
19 function sky_addons_get_icon() {
20 return '<span class="sky-ctrl-section-icon-wrapper"><img src="' . SKY_ADDONS_ASSETS_URL . 'images/sky-logo-gradient.png" class="sky-ctrl-section-icon" alt="Sky Addons" title="Sky Addons"></span>';
21 }
22 }
23
24 if ( ! function_exists( 'sky_addons_init_pro' ) ) {
25 function sky_addons_init_pro() {
26 return apply_filters( 'sky_addons_pro_init', false );
27 }
28 }
29
30
31 if ( ! function_exists( 'sky_addons_control_indicator_pro' ) ) {
32 function sky_addons_control_indicator_pro() {
33 if ( sky_addons_init_pro() !== true ) {
34 return '<span class="sa-control-indicator-badge sa-pro-badge">' . esc_html( 'Pro', 'sky-elementor-addons' ) . '<span>';
35 }
36 }
37 }
38
39 if ( ! function_exists( 'sky_addons_label_badge' ) ) {
40 /**
41 * Return a coloured badge span for appending to an Elementor control label.
42 * Automatically disappears once the plugin reaches $until_version.
43 *
44 * Usage: 'label' => esc_html__( 'My Control', 'sky-elementor-addons' ) . sky_addons_label_badge( 'new', '4.5.0' )
45 *
46 * @param string $type Badge type: 'new' | 'updated' | 'fixed' | 'beta'.
47 * @param string|null $until_version Plugin version at which the badge auto-expires (e.g. '3.5.0').
48 * @return string Badge span HTML, or empty string when expired or type is unknown.
49 */
50 function sky_addons_label_badge( $type = 'new', $until_version = null ) {
51 if ( $until_version && defined( 'SKY_ADDONS_VERSION' )
52 && version_compare( SKY_ADDONS_VERSION, $until_version, '>=' ) ) {
53 return '';
54 }
55
56 $types = [
57 'new' => 'New',
58 'updated' => 'Updated',
59 'fixed' => 'Fixed',
60 'beta' => 'Beta',
61 ];
62
63 if ( ! isset( $types[ $type ] ) ) {
64 return '';
65 }
66
67 return ' <span class="sa-control-indicator-badge sa-badge--' . esc_attr( $type ) . '">' . esc_html( $types[ $type ] ) . '</span>';
68 }
69 }
70
71 function sky_addons_elementor() {
72 return \Elementor\Plugin::instance();
73 }
74
75
76 if ( ! function_exists( 'sky_addons_title_tags' ) ) {
77 function sky_addons_title_tags() {
78
79 $title_tags = [
80 'h1' => 'H1',
81 'h2' => 'H2',
82 'h3' => 'H3',
83 'h4' => 'H4',
84 'h5' => 'H5',
85 'h6' => 'H6',
86 'div' => 'div',
87 'span' => 'span',
88 'p' => 'p',
89 ];
90
91 return $title_tags;
92 }
93 }
94
95 /**
96 * Check you are in Editor
97 */
98
99 if ( ! function_exists( 'sky_addons_editor_mode' ) ) {
100 function sky_addons_editor_mode() {
101 if ( \Sky_Addons\Sky_Addons_Plugin::elementor()->preview->is_preview_mode() || \Sky_Addons\Sky_Addons_Plugin::elementor()->editor->is_edit_mode() ) {
102 return true;
103 }
104 return false;
105 }
106 }
107
108 /**
109 * Disable unserializing of the class
110 *
111 * @since 1.0.0
112 * @return void
113 */
114 if ( ! function_exists( 'sky_addons_template_modify_link' ) ) {
115 function sky_addons_template_modify_link( $template_id ) {
116 if ( \Sky_Addons\Sky_Addons_Plugin::elementor()->editor->is_edit_mode() ) {
117
118 $final_url = add_query_arg( [ 'elementor' => '' ], get_permalink( $template_id ) );
119
120 $output = sprintf( '<a class="sa-elementor-template-modify-link" href="%s" title="%s" target="_blank"><i class="eicon-edit"></i></a>', esc_url( $final_url ), esc_html__( 'Edit Template', 'sky-elementor-addons' ) );
121
122 return $output;
123 }
124 }
125 }
126
127 /**
128 * @return array of elementor template
129 */
130 if ( ! function_exists( 'sky_addons_elementor_template_settings' ) ) {
131 function sky_addons_elementor_template_settings() {
132
133 $templates = \Sky_Addons\Sky_Addons_Plugin::elementor()->templates_manager->get_source( 'local' )->get_items();
134 $types = [];
135
136 if ( empty( $templates ) ) {
137 $template_settings = [ '0' => esc_html__( 'Template Not Found!', 'sky-elementor-addons' ) ];
138 } else {
139 $template_settings = [ '0' => esc_html__( 'Select Template', 'sky-elementor-addons' ) ];
140
141 foreach ( $templates as $template ) {
142 $template_settings[ $template['template_id'] ] = $template['title'] . ' (' . $template['type'] . ')';
143 $types[ $template['template_id'] ] = $template['type'];
144 }
145 }
146
147 return $template_settings;
148 }
149 }
150
151 /**
152 * @return array of anywhere templates
153 */
154 if ( ! function_exists( 'sky_addons_anywhere_template_settings' ) ) {
155 function sky_addons_anywhere_template_settings() {
156
157 if ( post_type_exists( 'ae_global_templates' ) ) {
158 $anywhere = get_posts( [
159 'fields' => 'ids', // Only get post IDs
160 'posts_per_page' => -1,
161 'post_type' => 'ae_global_templates',
162 ] );
163
164 $anywhere_settings = [ '0' => esc_html__( 'Select Template', 'sky-elementor-addons' ) ];
165
166 foreach ( $anywhere as $key => $value ) {
167 $anywhere_settings[ $value ] = get_the_title( $value );
168 }
169 } else {
170 $anywhere_settings = [ '0' => esc_html__( 'AE Plugin Not Installed', 'sky-elementor-addons' ) ];
171 }
172
173 return $anywhere_settings;
174 }
175 }
176 if ( ! function_exists( 'sky_addons_get_post_category' ) ) {
177 function sky_addons_get_post_category( $post_type ) {
178 switch ( $post_type ) {
179 case 'campaign':
180 $taxonomy = 'campaign_category';
181 break;
182 case 'give_forms':
183 $taxonomy = 'give_forms_category';
184 break;
185 case 'lightbox_library':
186 $taxonomy = 'ngg_tag';
187 break;
188 case 'product':
189 $taxonomy = 'product_cat';
190 break;
191 case 'tribe_events':
192 $taxonomy = 'tribe_events_cat';
193 break;
194 case 'knowledge-base':
195 $taxonomy = 'knowledge-base-category';
196 break;
197
198 default:
199 $taxonomy = 'category';
200 break;
201 }
202
203 $categories = get_the_terms( get_the_ID(), $taxonomy );
204 $_categories = [];
205 if ( $categories ) {
206 foreach ( $categories as $category ) {
207 $link = '<a href="' . esc_url( get_category_link( $category->term_id ) ) . '">' . wp_kses_post( $category->name ) . '</a>';
208 $_categories[ $category->slug ] = $link;
209 }
210 }
211 return implode( ' ', $_categories );
212 }
213 }
214
215 if ( ! function_exists( 'sky_addons_post_time_ago_kit' ) ) {
216 function sky_addons_post_time_ago_kit( $from, $to = '' ) {
217 $diff = human_time_diff( $from, $to );
218 $replace = [
219 ' hour' => 'h',
220 ' hours' => 'h',
221 ' day' => 'd',
222 ' days' => 'd',
223 ' minute' => 'm',
224 ' minutes' => 'm',
225 ' second' => 's',
226 ' seconds' => 's',
227 ];
228
229 return strtr( $diff, $replace );
230 }
231 }
232
233 if ( ! function_exists( 'sky_addons_post_time_ago' ) ) {
234 function sky_addons_post_time_ago( $format = '' ) {
235 $display_ago = esc_html__( 'ago', 'sky-elementor-addons' );
236
237 if ( 'short' === $format ) {
238 $output = sky_addons_post_time_ago_kit( strtotime( get_the_date() ), current_time( 'timestamp' ) );
239 } else {
240 $output = human_time_diff( strtotime( get_the_date() ), current_time( 'timestamp' ) );
241 }
242
243 $output = $output . ' ' . $display_ago;
244
245 return $output;
246 }
247 }
248 if ( ! function_exists( 'sky_addons_post_custom_excerpt' ) ) {
249 function sky_addons_post_custom_excerpt( $limit = 25, $strip_shortcode = false, $trail = '' ) {
250
251 $output = get_the_content();
252
253 if ( $limit ) {
254 $output = wp_trim_words( $output, $limit, $trail );
255 }
256
257 if ( $strip_shortcode ) {
258 $output = strip_shortcodes( $output );
259 }
260
261 return wpautop( $output );
262 }
263 }
264
265 if ( ! function_exists( 'sky_addons_post_user_role' ) ) {
266 function sky_addons_post_user_role( $id ) {
267
268 $user = new WP_User( $id );
269
270 return array_shift( $user->roles );
271 }
272 }
273
274 if ( ! function_exists( 'sky_addons_post_pagination' ) ) {
275 function sky_addons_post_pagination( $wp_query, $widget_id = '' ) {
276
277 /**
278 * Check if Page only 1
279 * Pause the execution
280 */
281 if ( $wp_query->max_num_pages <= 1 ) {
282 return;
283 }
284
285 if ( is_front_page() ) {
286 $paged = ( get_query_var( 'page' ) ) ? get_query_var( 'page' ) : 1;
287 } else {
288 $paged = ( get_query_var( 'paged' ) ) ? get_query_var( 'paged' ) : 1;
289 }
290 $max = intval( $wp_query->max_num_pages );
291
292 /**
293 * Inject the Current Page
294 */
295 if ( $paged >= 1 ) {
296 $links[] = $paged;
297 }
298
299 /**
300 * Add Middle Pages
301 */
302 if ( $paged >= 3 ) {
303 $links[] = $paged - 1;
304 $links[] = $paged - 2;
305 }
306
307 if ( ( $paged + 2 ) <= $max ) {
308 $links[] = $paged + 2;
309 $links[] = $paged + 1;
310 }
311
312 printf(
313 '<ul class="%1$s" data-widget-id="%2$s" role="navigation">' . "\n",
314 'sa-post-pagination sa-list-style-none sa-d-flex sa-my-5 sa-mx-0 sa-justify-content-center',
315 wp_kses_post( $widget_id )
316 );
317
318 /**
319 * Previous Link
320 */
321 if ( get_previous_posts_link() ) {
322 $prev_arrow = '<i class="sa-post-icon-arrow-left" aria-hidden="true"></i>';
323 printf(
324 '<li class="sa-post-page-previous">%s</li>' . "\n",
325 wp_kses_post( get_previous_posts_link( '<span data-sa-post-page-previous>' . $prev_arrow . '</span>' ) )
326 );
327 }
328
329 if ( ! in_array( 1, $links ) ) {
330 $class = ( 1 === $paged ) ? 'current' : 'sa';
331
332 printf(
333 '<li class="%s"><a class="sa-post-page-link sa-d-block" href="%s">%s</a></li>' . "\n",
334 esc_attr( $class ),
335 esc_url( get_pagenum_link( 1 ) ),
336 '1'
337 );
338
339 if ( ! in_array( 2, $links ) ) {
340 printf( '<li class="sa-post-page-dot-dot"><span>...</span></li>' );
341 }
342 }
343
344 sort( $links );
345 foreach ( (array) $links as $link ) {
346 $class = ( $paged === $link ) ? 'sa-post-page-active' : 'sa';
347 printf(
348 '<li class="%s"><a class="sa-post-page-link sa-d-block" href="%s">%s</a></li>' . "\n",
349 esc_attr( $class ),
350 esc_url( get_pagenum_link( $link ) ),
351 wp_kses_post( $link )
352 );
353 }
354
355 if ( ! in_array( $max, $links ) ) {
356 if ( ! in_array( $max - 1, $links ) ) {
357 printf( '<li class="sa-post-page-dot-dot"><span>...</span></li>' . "\n" );
358 }
359
360 $class = ( $paged === $max ) ? 'sa-post-page-active' : 'sa';
361 printf(
362 '<li class="%s"><a class="sa-post-page-link sa-d-block" href="%s">%s</a></li>' . "\n",
363 esc_attr( $class ),
364 esc_url( get_pagenum_link( $max ) ),
365 wp_kses_post( $max )
366 );
367 }
368
369 /**
370 * Next Link
371 */
372 if ( get_next_posts_link( null, $paged ) ) {
373 $next_arrow = '<i class="sa-post-icon-arrow-right" aria-hidden="true"></i>';
374 printf(
375 '<li class="sa-post-page-next">%s</li>' . "\n",
376 wp_kses_post( get_next_posts_link( '<span data-sa-post-page-next>' . $next_arrow . '</span>' ) )
377 );
378 }
379
380 printf( '</ul>' . "\n" );
381 }
382 }
383
384
385 /**
386 * @return array
387 */
388 if ( ! function_exists( 'sky_addons_wp_get_menu' ) ) {
389 function sky_addons_wp_get_menu() {
390 $menus = wp_get_nav_menus();
391 $items = [ 0 => esc_html__( 'Select Menu', 'sky-elementor-addons' ) ];
392 foreach ( $menus as $menu ) {
393 $items[ $menu->slug ] = $menu->name;
394 }
395 return $items;
396 }
397 }
398
399 /**
400 * Display an Elementor template by its ID.
401 *
402 * @param int $template_id The ID of the Elementor template.
403 */
404 if ( ! function_exists( 'sky_addons_display_el_tem_by_id' ) ) {
405 function sky_addons_display_el_tem_by_id( int $template_id ) {
406 $posts = get_posts( [
407 'post_type' => 'elementor_library',
408 'post_status' => 'publish',
409 'p' => $template_id,
410 ] );
411
412 if ( ! empty( $posts ) && $posts[0]->ID === $template_id ) {
413 //phpcs:ignore
414 echo \Sky_Addons\Sky_Addons_Plugin::elementor()->frontend->get_builder_content_for_display( $template_id );
415 } else {
416 echo esc_html__( 'The post is not published or does not exist.', 'sky-elementor-addons' );
417 }
418 }
419 }
420
421
422 /**
423 * Render Elementor Content
424 *
425 * @param $content_id
426 *
427 * Used in Themes Builder
428 */
429 if ( ! function_exists( 'wowdevs_render_elementor_content' ) ) {
430 function wowdevs_render_elementor_content( $content_id ) {
431
432 $elementor_instance = \Elementor\Plugin::instance();
433 $has_css = false;
434
435 /**
436 * CSS Print Method Internal and Exteral option support for Header and Footer Builder.
437 */
438 if ( ( 'internal' === get_option( 'elementor_css_print_method' ) ) || \Elementor\Plugin::$instance->preview->is_preview_mode() ) {
439 $has_css = true;
440 }
441
442 return $elementor_instance->frontend->get_builder_content_for_display( $content_id, $has_css );
443 }
444 }
445
446
447 /**
448 * Check if contact form 7 is activated
449 *
450 * @return bool
451 */
452 if ( ! function_exists( 'sky_addons_is_cf7_activated' ) ) {
453 function sky_addons_is_cf7_activated() {
454 return class_exists( '\WPCF7' );
455 }
456 }
457
458 /**
459 * Check if Ninja Form is activated
460 *
461 * @return bool
462 */
463 if ( ! function_exists( 'sky_addons_is_ninjaforms_activated' ) ) {
464 function sky_addons_is_ninjaforms_activated() {
465 return class_exists( '\Ninja_Forms' );
466 }
467 }
468
469 /**
470 * Check if We Form is activated
471 *
472 * @return bool
473 */
474 if ( ! function_exists( 'sky_addons_is_weforms_activated' ) ) {
475 function sky_addons_is_weforms_activated() {
476 return class_exists( '\WeForms' );
477 }
478 }
479
480 /**
481 * Check if WPForms is activated
482 *
483 * @return bool
484 */
485 if ( ! function_exists( 'sky_addons_is_wpforms_activated' ) ) {
486 function sky_addons_is_wpforms_activated() {
487 return class_exists( '\WPForms\WPForms' );
488 }
489 }
490
491 /**
492 * Check if Gravity Forms is activated
493 *
494 * @return bool
495 */
496 if ( ! function_exists( 'sky_addons_is_gravityforms_activated' ) ) {
497 function sky_addons_is_gravityforms_activated() {
498 return class_exists( '\GFForms' );
499 }
500 }
501
502 /*
503 * Check if Fluent Form is activated
504 *
505 * @return bool
506 */
507 if ( ! function_exists( 'sky_addons_is_fluent_form_activated' ) ) {
508 function sky_addons_is_fluent_form_activated() {
509 return defined( 'FLUENTFORM' );
510 }
511 }
512
513
514 /**
515 * Get a list of all CF7 forms
516 *
517 * @return array
518 */
519 if ( ! function_exists( 'sky_addons_get_cf7_forms' ) ) {
520 function sky_addons_get_cf7_forms() {
521 $forms = [];
522
523 if ( sky_addons_is_cf7_activated() ) {
524 $_forms = get_posts( [
525 'post_type' => 'wpcf7_contact_form',
526 'post_status' => 'publish',
527 'posts_per_page' => -1,
528 'orderby' => 'title',
529 'order' => 'ASC',
530 ] );
531
532 if ( ! empty( $_forms ) ) {
533 $forms = wp_list_pluck( $_forms, 'post_title', 'ID' );
534 }
535 }
536
537 return $forms;
538 }
539 }
540
541 /**
542 * Get a list of all Ninja Form
543 *
544 * @return array
545 */
546 if ( ! function_exists( 'sky_addons_get_ninjaform' ) ) {
547 function sky_addons_get_ninjaform() {
548 $forms = [];
549
550 if ( sky_addons_is_ninjaforms_activated() ) {
551 $_forms = \Ninja_Forms()->form()->get_forms();
552
553 if ( ! empty( $_forms ) && ! is_wp_error( $_forms ) ) {
554 foreach ( $_forms as $form ) {
555 $forms[ $form->get_id() ] = $form->get_setting( 'title' );
556 }
557 }
558 }
559
560 return $forms;
561 }
562 }
563
564 /**
565 * Get a list of all WeForm
566 *
567 * @return array
568 */
569 if ( ! function_exists( 'sky_addons_get_we_forms' ) ) {
570 function sky_addons_get_we_forms() {
571 $forms = [];
572
573 if ( sky_addons_is_weforms_activated() ) {
574 $_forms = get_posts( [
575 'post_type' => 'wpuf_contact_form',
576 'post_status' => 'publish',
577 'posts_per_page' => -1,
578 'orderby' => 'title',
579 'order' => 'ASC',
580 ] );
581
582 if ( ! empty( $_forms ) ) {
583 $forms = wp_list_pluck( $_forms, 'post_title', 'ID' );
584 }
585 }
586
587 return $forms;
588 }
589 }
590
591 /**
592 * Get a list of all WPForms
593 *
594 * @return array
595 */
596 if ( ! function_exists( 'sky_addons_get_wpforms' ) ) {
597 function sky_addons_get_wpforms() {
598 $forms = [];
599
600 if ( sky_addons_is_wpforms_activated() ) {
601 $_forms = get_posts( [
602 'post_type' => 'wpforms',
603 'post_status' => 'publish',
604 'posts_per_page' => -1,
605 'orderby' => 'title',
606 'order' => 'ASC',
607 ] );
608
609 if ( ! empty( $_forms ) ) {
610 $forms = wp_list_pluck( $_forms, 'post_title', 'ID' );
611 }
612 }
613
614 return $forms;
615 }
616 }
617
618
619 /**
620 * Get a list of all GravityForms
621 *
622 * @return array
623 */
624 if ( ! function_exists( 'sky_addons_get_gravity_forms' ) ) {
625 function sky_addons_get_gravity_forms() {
626 $forms = [];
627
628 if ( sky_addons_is_gravityforms_activated() ) {
629 $gravity_forms = \RGFormsModel::get_forms( null, 'title' );
630
631 if ( ! empty( $gravity_forms ) && ! is_wp_error( $gravity_forms ) ) {
632 foreach ( $gravity_forms as $gravity_form ) {
633 $forms[ $gravity_form->id ] = $gravity_form->title;
634 }
635 }
636 }
637
638 return $forms;
639 }
640 }
641
642 /*
643 * Get a list of all Fluent Forms
644 *
645 * @return array
646 */
647 if ( ! function_exists( 'sky_addons_fluent_forms' ) ) {
648 function sky_addons_fluent_forms() {
649 $forms = [];
650
651 if ( sky_addons_is_fluent_form_activated() ) {
652 global $wpdb;
653
654 $table = $wpdb->prefix . 'fluentform_forms';
655 $query = "SELECT * FROM {$table}";
656 $fluent_forms = $wpdb->get_results( $query );
657
658 if ( $fluent_forms ) {
659 foreach ( $fluent_forms as $form ) {
660 $forms[ $form->id ] = $form->title;
661 }
662 }
663 }
664
665 return $forms;
666 }
667 }
668
669
670 /**
671 * @return mixed
672 */
673 if ( ! function_exists( 'sky_addons_get_current_user_display_name' ) ) {
674 function sky_addons_get_current_user_display_name() {
675 $user = wp_get_current_user();
676 $name = 'user';
677 if ( $user->exists() && $user->display_name ) {
678 $name = $user->display_name;
679 }
680 return $name;
681 }
682 }
683
684 /**
685 * Call a shortcode function by tag name.
686 *
687 * @since 1.0.0
688 *
689 * @param string $tag The shortcode whose function to call.
690 * @param array $atts The attributes to pass to the shortcode function. Optional.
691 * @param array $content The shortcode's content. Default is null (none).
692 *
693 * @return string|bool False on failure, the result of the shortcode on success.
694 */
695
696 if ( ! function_exists( 'sky_addons_do_shortcode' ) ) {
697 function sky_addons_do_shortcode( $tag, array $atts = [], $content = null ) {
698 global $shortcode_tags;
699 if ( ! isset( $shortcode_tags[ $tag ] ) ) {
700 return false;
701 }
702 return call_user_func( $shortcode_tags[ $tag ], $atts, $content, $tag );
703 }
704 }
705
706 /**
707 * Get plugin missing notice
708 *
709 * @param string $plugin
710 * @return void
711 */
712 if ( ! function_exists( 'sky_addons_show_plugin_missing_alert' ) ) {
713 function sky_addons_show_plugin_missing_alert( $plugin ) {
714 if ( current_user_can( 'activate_plugins' ) && $plugin ) {
715 printf(
716 '<div %s>%s</div>',
717 'style="margin: 1rem;padding: 1rem 1.25rem;border-left: 5px solid #f5c848;color: #856404;background-color: #fff3cd;"',
718 $plugin . __( ' is missing! Please install and activate ', 'sky-elementor-addons' ) . $plugin . '.'
719 );
720 }
721 }
722 }
723
724 /**
725 * Get alert notice
726 *
727 * @param string $content
728 * @return void
729 */
730
731 if ( ! function_exists( 'sky_addons_alert_notice' ) ) {
732 function sky_addons_alert_notice( $content ) {
733 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
734 printf(
735 '<div %s>%s</div>',
736 'style="margin: 1rem;padding: 1rem 1.25rem;border-left: 5px solid #f5c848;color: #856404;background-color: #fff3cd;"',
737 esc_html( $content )
738 );
739 }
740 }
741
742 /**
743 * Sanitize html class string
744 *
745 * @param $class
746 * @return string
747 */
748 function sky_addons_sanitize_html_class_param( $class ) {
749 $classes = ! empty( $class ) ? explode( ' ', $class ) : [];
750 $sanitized = [];
751 if ( ! empty( $classes ) ) {
752 $sanitized = array_map(function ( $cls ) {
753 return sanitize_html_class( $cls );
754 }, $classes);
755 }
756 return implode( ' ', $sanitized );
757 }
758