PluginProbe
Borderless – Addons and Templates for Elementor / trunk
Borderless – Addons and Templates for Elementor vtrunk
trunk 1.0.0 1.0.1 1.0.2 1.0.3 1.0.4 1.0.5 1.0.6 1.0.7 1.0.8 1.0.9 1.1.0 1.1.1 1.1.2 1.1.3 1.1.4 1.1.5 1.1.6 1.1.7 1.1.8 1.1.9 1.2.0 1.2.1 1.2.2 1.2.3 All 78 releases
borderless / modules / wpbakery / elements / alert.php

alert.php in Borderless – Addons and Templates for Elementor trunk, at modules/wpbakery/elements/alert.php

130 lines 4.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 if ( ! defined( 'ABSPATH' ) ) {
3 die( '-1' );
4 }
5
6 /*-----------------------------------------------------------------------------------*/
7 /* Alert
8 /*-----------------------------------------------------------------------------------*/
9
10 class WPBakeryShortCode_borderless_wpbakery_alert extends WPBakeryShortCode {
11 protected function content( $atts, $content = null ) {
12 extract( shortcode_atts( array(
13 'type' => 'borderless-wpbakery-alert-success',
14 'dismissible' => '',
15 // Static
16 'el_id' => '',
17 'el_class' => '',
18 'css' => '',
19 'css_animation' => ''
20 ), $atts ) );
21 $output = '';
22
23 // Assets.
24 wp_enqueue_style(
25 'borderless-wpbakery-style',
26 BORDERLESS__STYLES . 'wpbakery.min.css',
27 false,
28 BORDERLESS__VERSION
29 );
30
31 // Retrieve data from the database.
32 $options = get_option( 'borderless' );
33
34 // Set default values
35 $borderless_primary_color = isset( $options['primary_color'] ) ? esc_attr( $options['primary_color'] ) : '#3379fc'; // Primary Color
36 $borderless_secondary_color = isset( $options['secondary_color'] ) ? esc_attr( $options['secondary_color'] ) : '#3379fc'; // Secondary Color
37 $borderless_text_color = isset( $options['text_color'] ) ? esc_attr( $options['text_color'] ) : ''; // Text Color
38 $borderless_accent_color = isset( $options['accent_color'] ) ? esc_attr( $options['accent_color'] ) : '#3379fc'; // Accent Color
39
40 // Default Extra Class, CSS and CSS animation
41 $css = isset( $atts['css'] ) ? esc_attr( $atts['css'] ) : '';
42 $el_id = isset( $atts['el_id'] ) ? 'id="' . esc_attr( $atts['el_id'] ) . '"' : '';
43 $el_class = isset( $atts['el_class'] ) ? esc_attr( $atts['el_class'] ) : '';
44 if ( '' !== $css_animation ) {
45 wp_enqueue_script( 'waypoints' );
46 $css_animation_style = ' wpb_animate_when_almost_visible wpb_' . esc_attr( $css_animation );
47 }
48 $class_to_filter = vc_shortcode_custom_css_class( $css, ' ' ) . $this->getExtraClass( $el_class ) . $this->getCSSAnimation( $css_animation );
49 $css_class = apply_filters( VC_SHORTCODE_CUSTOM_CSS_FILTER_TAG, $class_to_filter, $this->settings['base'], $atts );
50
51 // Set custom values
52 $quote = "'";
53
54 // Output
55 $output .= '<div '.$el_id.' class="borderless-wpbakery-alert '.esc_attr( $css_class ).' '.esc_attr( $type ).'">';
56 $output .= wp_kses_post( $content );
57 if ( ! empty( $dismissible ) ) {
58 $output .= '<span class="borderless-wpbakery-alert-close-button" onclick="this.parentElement.style.display=' . $quote . 'none' . $quote . ';">×</span>';
59 }
60 $output .= '</div>';
61
62 return $output;
63 }
64 }
65
66 return array(
67 'name' => __( 'Alert', 'borderless' ),
68 'base' => 'borderless_wpbakery_alert',
69 'icon' => plugins_url('../images/alert.png', __FILE__),
70 'show_settings_on_create' => true,
71 'category' => __( 'Borderless', 'borderless' ),
72 'description' => __( 'Provide contextual feedback messages', 'borderless' ),
73 'params' => array(
74
75 array(
76 'type' => 'dropdown',
77 'heading' => __( 'Type', 'borderless' ),
78 'param_name' => 'type',
79 'value' => array(
80 __( 'Success', 'borderless' ) => 'borderless-wpbakery-alert-success',
81 __( 'Info', 'borderless' ) => 'borderless-wpbakery-alert-info',
82 __( 'Warning', 'borderless' ) => 'borderless-wpbakery-alert-warning',
83 __( 'Danger', 'borderless' ) => 'borderless-wpbakery-alert-danger',
84 ),
85 'description' => __( 'Select context type.', 'borderless' ),
86 ),
87
88 array(
89 'type' => 'textarea',
90 'holder' => 'div',
91 'heading' => __( 'Message', 'borderless' ),
92 'param_name' => 'content',
93 'description' => __( 'Enter short message.', 'borderless' ),
94 ),
95
96 array(
97 'type' => 'checkbox',
98 'heading' => __('Dismissible Alert', 'borderless'),
99 'param_name' => 'dismissible',
100 'value' => array(
101 __( 'Add close button.', 'borderless' ) => 'dismissible',
102 ),
103 ),
104
105 // Animation
106 vc_map_add_css_animation(),
107
108 array(
109 'type' => 'el_id',
110 'heading' => __( 'Element ID', 'borderless' ),
111 'param_name' => 'el_id',
112 'description' => sprintf( __( 'Enter element ID (Note: make sure it is unique and valid according to %sw3c specification%s).', 'borderless' ), '<a href="https://www.w3schools.com/tags/att_global_id.asp" target="_blank">', '</a>' ),
113 ),
114
115 array(
116 'type' => 'textfield',
117 'heading' => __( 'Extra class name', 'borderless' ),
118 'param_name' => 'el_class',
119 'description' => __( 'Style particular content element differently - add a class name and refer to it in custom CSS.', 'borderless' ),
120 ),
121
122 array(
123 'type' => 'css_editor',
124 'heading' => __( 'CSS box', 'borderless' ),
125 'param_name' => 'css',
126 'group' => __( 'Design Options', 'borderless' ),
127 ),
128 ),
129 );
130