PluginProbe
Borderless – Addons and Templates for Elementor / 1.2.5
Borderless – Addons and Templates for Elementor v1.2.5
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 / testimonial.php

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

258 lines 8.9 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 /* Testimonials
8 /*-----------------------------------------------------------------------------------*/
9
10 class WPBakeryShortCode_borderless_wpbakery_testimonial_section extends WPBakeryShortCode {
11 protected function content( $atts, $content = null ) {
12 extract( shortcode_atts( array(
13 'title' => '',
14 'occupation' => '',
15 'photo' => '',
16 'content' => $content,
17 'testimonial_color' => '',
18 'testimonial_name_color' => '',
19 'testimonial_occupation_color' => '',
20 //Static
21 'el_id' => '',
22 'el_class' => '',
23 'css' => '',
24 'css_animation' => ''
25 ), $atts ) );
26 $output = '';
27
28
29 // Retrieve data from the database.
30 $options = get_option( 'borderless' );
31
32
33 // Set default values
34 $borderless_primary_color = isset( $options['primary_color'] ) ? $options['primary_color'] : '#3379fc'; //Primary Color
35 $borderless_secondary_color = isset( $options['secondary_color'] ) ? $options['secondary_color'] : '#3379fc'; //Secondary Color
36 $borderless_text_color = isset( $options['text_color'] ) ? $options['text_color'] : ''; //Text Color
37 $borderless_accent_color = isset( $options['accent_color'] ) ? $options['accent_color'] : '#3379fc'; //Accent Color
38
39
40 // Picture
41 if ($photo) {
42 $img = wp_get_attachment_image_src( $photo, 'thumbnail' );
43 $imgSrc = $img[0];
44 } else {
45 $imgSrc = '';
46 }
47
48
49 // Start Default Extra Class, CSS and CSS animation
50
51 $css = isset( $atts['css'] ) ? $atts['css'] : '';
52 $el_id = isset( $atts['el_id'] ) ? 'id="' . esc_attr( $el_id ) . '"' : '';
53 $el_class = isset( $atts['el_class'] ) ? $atts['el_class'] : '';
54
55 if ( '' !== $css_animation ) {
56 wp_enqueue_script( 'waypoints' );
57 $css_animation_style = ' wpb_animate_when_almost_visible wpb_' . $css_animation;
58 }
59
60 $class_to_filter = vc_shortcode_custom_css_class( $css, ' ' ) . $this->getExtraClass( $el_class ) . $this->getCSSAnimation( $css_animation );
61 $css_class = apply_filters( VC_SHORTCODE_CUSTOM_CSS_FILTER_TAG, $class_to_filter, $this->settings['base'], $atts );
62
63 // End Default Extra Class, CSS and CSS animation
64
65 if($testimonial_color != '') {
66 $testimonial_color = 'style= "color:'.$testimonial_color.'"';
67 } else {
68 $testimonial_color = '';
69 }
70
71 if($testimonial_name_color != '') {
72 $testimonial_name_color = 'style= "color:'.$testimonial_name_color.'"';
73 } else {
74 $testimonial_name_color = '';
75 }
76
77 if($testimonial_occupation_color != '') {
78 $testimonial_occupation_color = 'style= "color:'.$testimonial_occupation_color.'"';
79 } else {
80 $testimonial_occupation_color = '';
81 }
82
83
84 $output .= '<div '.$el_id.' class="borderless-wpbakery-testimonial-section carousel-cell '.$css_class.'">';
85 $output .= '<p '.$testimonial_color.' class="testimonial-quote">'.$content.'</p>';
86 $output .= '<div class="testimonial-photo-title-occupation">';
87 if(!empty($photo)){ $output .= '<div class="testimonial-photo"><img src="'.$imgSrc.'" /></div>'; }
88 $output .= '<div class="testimonial-title-occupation">';
89 $output .= '<span '.$testimonial_name_color.' class="testimonial-title">'.$title.'</span>';
90 $output .= '<span '.$testimonial_occupation_color.' class="testimonial-occupation">'.$occupation.'</span>';
91 $output .= '</div></div></div>';
92
93 return $output;
94 }
95 }
96
97 class WPBakeryShortCode_borderless_wpbakery_testimonial extends WPBakeryShortCodesContainer {
98 protected function content( $atts, $content = null ) {
99 extract( shortcode_atts( array(
100 //Static
101 'el_id' => '',
102 'el_class' => '',
103 'css' => '',
104 'css_animation' => ''
105 ), $atts ) );
106 $output = '';
107
108 // Start Default Extra Class, CSS and CSS animation
109
110 $css = isset( $atts['css'] ) ? $atts['css'] : '';
111 $el_id = isset( $atts['el_id'] ) ? 'id="' . esc_attr( $el_id ) . '"' : '';
112 $el_class = isset( $atts['el_class'] ) ? $atts['el_class'] : '';
113
114 if ( '' !== $css_animation ) {
115 wp_enqueue_script( 'waypoints' );
116 $css_animation_style = ' wpb_animate_when_almost_visible wpb_' . $css_animation;
117 }
118
119 $class_to_filter = vc_shortcode_custom_css_class( $css, ' ' ) . $this->getExtraClass( $el_class ) . $this->getCSSAnimation( $css_animation );
120 $css_class = apply_filters( VC_SHORTCODE_CUSTOM_CSS_FILTER_TAG, $class_to_filter, $this->settings['base'], $atts );
121
122 // End Default Extra Class, CSS and CSS animation
123
124
125 $output .= '<div '.$el_id.' class="borderless-wpbakery-testimonial'.' '.$css_class.'">
126 <div class="testimonials">
127 <div class="testimonials-container">
128 <div class="testimonial">
129 <div class="main-carousel">'.wpb_js_remove_wpautop($content).'</div>
130 </div>
131 </div>
132 </div>
133 </div>';
134
135 return $output;
136 }
137 }
138
139 vc_map( array(
140 'name' => __( 'Testimonial', 'borderless' ),
141 'base' => 'borderless_wpbakery_testimonial',
142 'icon' => plugins_url('../images/testimonial.png', __FILE__),
143 "as_parent" => array('only' => 'borderless_wpbakery_testimonial_section'),
144 "content_element" => true,
145 "show_settings_on_create" => false,
146 "is_container" => true,
147 'category' => __( 'Borderless', 'borderless' ),
148 'description' => __( 'Display testimonials', 'borderless' ),
149 'params' => array(
150
151 vc_map_add_css_animation(),
152
153 array(
154 'type' => 'el_id',
155 'heading' => __( 'Element ID', 'borderless' ),
156 'param_name' => 'el_id',
157 '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>' ),
158 ),
159
160 array(
161 'type' => 'textfield',
162 'heading' => __( 'Extra class name', 'borderless' ),
163 'param_name' => 'el_class',
164 'description' => __( 'Style particular content element differently - add a class name and refer to it in custom CSS.', 'borderless' ),
165 ),
166
167 array(
168 'type' => 'css_editor',
169 'heading' => __( 'CSS box', 'borderless' ),
170 'param_name' => 'css',
171 'group' => __( 'Design Options', 'borderless' ),
172 ),
173 ),
174 "js_view" => 'VcColumnView'
175 ) );
176
177 vc_map( array(
178 "name" => __("Testimonial Section", 'borderless'),
179 'description' => __( 'Testimonial content panels item.', 'borderless' ),
180 "base" => "borderless_wpbakery_testimonial_section",
181 'icon' => plugins_url('../images/testimonial-section.png', __FILE__),
182 "content_element" => true,
183 "as_child" => array('only' => 'borderless_wpbakery_testimonial_container'),
184 'category' => __( 'Borderless', 'borderless' ),
185 "params" => array(
186 array(
187 'type' => 'textfield',
188 'heading' => __( 'Name', 'borderless' ),
189 'param_name' => 'title',
190 ),
191 array(
192 'type' => 'textfield',
193 'heading' => __( 'Occupation', 'borderless' ),
194 'param_name' => 'occupation',
195 ),
196 array(
197 'type' => 'attach_image',
198 'heading' => __( 'Photo', 'borderless' ),
199 'param_name' => 'photo',
200 'value' => '',
201 'description' => __( 'Select image from media library.', 'borderless' ),
202 ),
203 array(
204 'type' => 'textarea_html',
205 'holder' => 'div',
206 'heading' => __( 'Content', 'borderless' ),
207 'param_name' => 'content',
208 'value' => __( '<p>I am text block. Click edit button to change this text. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut elit tellus, luctus nec ullamcorper mattis, pulvinar dapibus leo.</p>', 'borderless' ),
209 ),
210
211 array(
212 'type' => 'colorpicker',
213 'heading' => __( 'Testimonial Color', 'borderless' ),
214 'param_name' => 'testimonial_color',
215 'description' => __( 'Select testimonial content color.', 'borderless' ),
216 'group' => 'Color',
217 ),
218
219 array(
220 'type' => 'colorpicker',
221 'heading' => __( 'Testimonial Name Color', 'borderless' ),
222 'param_name' => 'testimonial_name_color',
223 'description' => __( 'Select testimonial name color.', 'borderless' ),
224 'group' => 'Color',
225 ),
226
227 array(
228 'type' => 'colorpicker',
229 'heading' => __( 'Testimonial Occupation Color', 'borderless' ),
230 'param_name' => 'testimonial_occupation_color',
231 'description' => __( 'Select testimonial occupation color.', 'borderless' ),
232 'group' => 'Color',
233 ),
234
235 vc_map_add_css_animation(),
236
237 array(
238 'type' => 'el_id',
239 'heading' => __( 'Element ID', 'borderless' ),
240 'param_name' => 'el_id',
241 '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>' ),
242 ),
243
244 array(
245 'type' => 'textfield',
246 'heading' => __( 'Extra class name', 'borderless' ),
247 'param_name' => 'el_class',
248 'description' => __( 'Style particular content element differently - add a class name and refer to it in custom CSS.', 'borderless' ),
249 ),
250
251 array(
252 'type' => 'css_editor',
253 'heading' => __( 'CSS box', 'borderless' ),
254 'param_name' => 'css',
255 'group' => __( 'Design Options', 'borderless' ),
256 ),
257 )
258 ) );