PluginProbe
Borderless – Addons and Templates for Elementor / 1.4.9
Borderless – Addons and Templates for Elementor v1.4.9
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 1.4.9, at modules/wpbakery/elements/alert.php

133 lines 4.4 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
32 // Retrieve data from the database.
33 $options = get_option( 'borderless' );
34
35
36 // Set default values
37 $borderless_primary_color = isset( $options['primary_color'] ) ? $options['primary_color'] : '#3379fc'; //Primary Color
38 $borderless_secondary_color = isset( $options['secondary_color'] ) ? $options['secondary_color'] : '#3379fc'; //Secondary Color
39 $borderless_text_color = isset( $options['text_color'] ) ? $options['text_color'] : ''; //Text Color
40 $borderless_accent_color = isset( $options['accent_color'] ) ? $options['accent_color'] : '#3379fc'; //Accent Color
41
42
43 // Default Extra Class, CSS and CSS animation
44 $css = isset( $atts['css'] ) ? $atts['css'] : '';
45 $el_id = isset( $atts['el_id'] ) ? 'id="' . esc_attr( $el_id ) . '"' : '';
46 $el_class = isset( $atts['el_class'] ) ? $atts['el_class'] : '';
47 if ( '' !== $css_animation ) {
48 wp_enqueue_script( 'waypoints' );
49 $css_animation_style = ' wpb_animate_when_almost_visible wpb_' . $css_animation;
50 }
51 $class_to_filter = vc_shortcode_custom_css_class( $css, ' ' ) . $this->getExtraClass( $el_class ) . $this->getCSSAnimation( $css_animation );
52 $css_class = apply_filters( VC_SHORTCODE_CUSTOM_CSS_FILTER_TAG, $class_to_filter, $this->settings['base'], $atts );
53
54
55 // Set custom values
56 $quote = "'";
57
58
59 // Output
60 $output .= '<div '.$el_id.' class="borderless-wpbakery-alert '.$css_class.' '.$type.'">';
61 $output .= $content;
62 if(!empty($dismissible)) { $output .= '<span class="borderless-wpbakery-alert-close-button" onclick="this.parentElement.style.display='.$quote.'none'.$quote.';">×</span>'; }
63 $output .= '</div>';
64
65 return $output;
66 }
67 }
68
69 return array(
70 'name' => __( 'Alert', 'borderless' ),
71 'base' => 'borderless_wpbakery_alert',
72 'icon' => plugins_url('../images/alert.png', __FILE__),
73 'show_settings_on_create' => true,
74 'category' => __( 'Borderless', 'borderless' ),
75 'description' => __( 'Provide contextual feedback messages', 'borderless' ),
76 'params' => array(
77
78 array(
79 'type' => 'dropdown',
80 'heading' => __( 'Type', 'borderless' ),
81 'param_name' => 'type',
82 'value' => array(
83 __( 'Success', 'borderless' ) => 'borderless-wpbakery-alert-success',
84 __( 'Info', 'borderless' ) => 'borderless-wpbakery-alert-info',
85 __( 'Warning', 'borderless' ) => 'borderless-wpbakery-alert-warning',
86 __( 'Danger', 'borderless' ) => 'borderless-wpbakery-alert-danger',
87 ),
88 'description' => __( 'Select context type.', 'borderless' ),
89 ),
90
91 array(
92 'type' => 'textarea',
93 'holder' => 'div',
94 'heading' => __( 'Message', 'borderless' ),
95 'param_name' => 'content',
96 'description' => __( 'Enter short message.', 'borderless' ),
97 ),
98
99 array(
100 'type' => 'checkbox',
101 'heading' => __('Dismissible Alert', 'borderless'),
102 'param_name' => 'dismissible',
103 'value' => array(
104 __( 'Add close button.', 'borderless' ) => 'dismissible',
105 ),
106 ),
107
108 // Animation
109 vc_map_add_css_animation(),
110
111 array(
112 'type' => 'el_id',
113 'heading' => __( 'Element ID', 'borderless' ),
114 'param_name' => 'el_id',
115 '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>' ),
116 ),
117
118 array(
119 'type' => 'textfield',
120 'heading' => __( 'Extra class name', 'borderless' ),
121 'param_name' => 'el_class',
122 'description' => __( 'Style particular content element differently - add a class name and refer to it in custom CSS.', 'borderless' ),
123 ),
124
125 array(
126 'type' => 'css_editor',
127 'heading' => __( 'CSS box', 'borderless' ),
128 'param_name' => 'css',
129 'group' => __( 'Design Options', 'borderless' ),
130 ),
131 ),
132 );
133