PluginProbe
WPFunnels – Funnel Builder for WooCommerce with Checkout & One Click Upsell / 3.13.3
WPFunnels – Funnel Builder for WooCommerce with Checkout & One Click Upsell v3.13.3
3.13.4 3.13.3 3.13.2 3.13.1 3.13.0 3.12.13 3.12.12 3.12.11 3.12.10 3.12.9 3.12.8 3.12.7 3.12.6 3.12.5 3.12.4 3.12.3 3.12.1 3.12.2 3.12.0 3.11.1 3.11.0 3.10.9 3.10.8 3.10.7 3.10.6 All 262 releases
← All changes | includes/core/widgets/bricks/OrderDetailsWidget.php +335 -14 3.10.8 → 3.13.3 View file →
@@ -45,8 +45,29 @@
45 45 {
46 46 return esc_html__('Order Detail', 'wpfnl');
47 47 }
48 48
49 + /**
50 + * Get WordPress user roles for display condition control.
51 + *
52 + * @return array
53 + * @since 3.1.0
54 + */
55 + protected function get_wp_user_roles()
56 + {
57 + $roles = [ 'none' => esc_html__( 'None', 'wpfnl' ) ];
58 +
59 + if ( ! function_exists( 'get_editable_roles' ) ) {
60 + require_once ABSPATH . 'wp-admin/includes/user.php';
61 + }
62 +
63 + foreach ( get_editable_roles() as $role_key => $role_info ) {
64 + $roles[ $role_key ] = $role_info['name'];
65 + }
66 +
67 + return $roles;
68 + }
69 +
49 70
50 71 /**
51 72 * Set builder control groups
52 73 *
@@ -54,9 +75,9 @@
54 75 */
55 76 public function set_control_groups()
56 77 {
57 78 $this->control_groups['wpfunnels'] = [
58 - 'title' => esc_html__('wpfunnels', 'wpfnl'), // Localized control group title
79 + 'title' => esc_html__('Settings', 'wpfnl'), // Localized control group title
59 80 'tab' => 'content', // Set to either "content" or "style"
60 81 ];
61 82 }
62 83
@@ -145,8 +166,195 @@
145 166 'clearable' => false,
146 167 'pasteStyles' => false,
147 168 'default' => $wpfnl_thankyou_shipping_details,
148 169 ];
170 +
171 + // Responsive Display
172 + $this->controls['responsiveSeparator'] = [
173 + 'tab' => 'content',
174 + 'group' => 'wpfunnels',
175 + 'label' => esc_html__( 'Responsive Display', 'wpfnl' ),
176 + 'type' => 'separator',
177 + ];
178 +
179 + $this->controls['hide_on_desktop'] = [
180 + 'tab' => 'content',
181 + 'group' => 'wpfunnels',
182 + 'label' => esc_html__( 'Hide on Desktop (≥ 1200px)', 'wpfnl' ),
183 + 'type' => 'checkbox',
184 + 'default' => false,
185 + 'description' => esc_html__( 'Hide order details on desktop devices (window width >= 1200px)', 'wpfnl' ),
186 + ];
187 +
188 + $this->controls['hide_on_tablet'] = [
189 + 'tab' => 'content',
190 + 'group' => 'wpfunnels',
191 + 'label' => esc_html__( 'Hide on Tablet (768px – 1199px)', 'wpfnl' ),
192 + 'type' => 'checkbox',
193 + 'default' => false,
194 + 'description' => esc_html__( 'Hide order details on tablet devices (window width 768px - 1199px)', 'wpfnl' ),
195 + ];
196 +
197 + $this->controls['hide_on_mobile'] = [
198 + 'tab' => 'content',
199 + 'group' => 'wpfunnels',
200 + 'label' => esc_html__( 'Hide on Mobile (≤ 767px)', 'wpfnl' ),
201 + 'type' => 'checkbox',
202 + 'default' => false,
203 + 'description' => esc_html__( 'Hide order details on mobile devices (window width <= 767px)', 'wpfnl' ),
204 + ];
205 +
206 + // Display Conditions
207 + $this->controls['displayConditionSeparator'] = [
208 + 'tab' => 'content',
209 + 'group' => 'wpfunnels',
210 + 'label' => esc_html__( 'Display Conditions', 'wpfnl' ),
211 + 'type' => 'separator',
212 + ];
213 +
214 + $this->controls['display_condition_type'] = [
215 + 'tab' => 'content',
216 + 'group' => 'wpfunnels',
217 + 'label' => esc_html__( 'Display Condition', 'wpfnl' ),
218 + 'type' => 'select',
219 + 'options' => [
220 + 'none' => esc_html__( 'None', 'wpfnl' ),
221 + 'user_state' => esc_html__( 'User State', 'wpfnl' ),
222 + 'user_role' => esc_html__( 'User Role', 'wpfnl' ),
223 + 'browser' => esc_html__( 'Browser', 'wpfnl' ),
224 + 'operating_system' => esc_html__( 'Operating System', 'wpfnl' ),
225 + 'day' => esc_html__( 'Day', 'wpfnl' ),
226 + ],
227 + 'inline' => false,
228 + 'default' => 'none',
229 + ];
230 +
231 + // User State
232 + $this->controls['hide_from_logged_in'] = [
233 + 'tab' => 'content',
234 + 'group' => 'wpfunnels',
235 + 'label' => esc_html__( 'Hide From Logged In User', 'wpfnl' ),
236 + 'type' => 'checkbox',
237 + 'default' => false,
238 + 'required' => [ 'display_condition_type', '=', 'user_state' ],
239 + ];
240 +
241 + $this->controls['hide_from_logged_out'] = [
242 + 'tab' => 'content',
243 + 'group' => 'wpfunnels',
244 + 'label' => esc_html__( 'Hide From Logged Out User', 'wpfnl' ),
245 + 'type' => 'checkbox',
246 + 'default' => false,
247 + 'required' => [ 'display_condition_type', '=', 'user_state' ],
248 + ];
249 +
250 + // User Role
251 + $this->controls['hide_for_user_role'] = [
252 + 'tab' => 'content',
253 + 'group' => 'wpfunnels',
254 + 'label' => esc_html__( 'Hide For User Role', 'wpfnl' ),
255 + 'type' => 'select',
256 + 'options' => $this->get_wp_user_roles(),
257 + 'default' => 'none',
258 + 'required' => [ 'display_condition_type', '=', 'user_role' ],
259 + ];
260 +
261 + // Browser
262 + $this->controls['hide_on_browser'] = [
263 + 'tab' => 'content',
264 + 'group' => 'wpfunnels',
265 + 'label' => esc_html__( 'Hide On Browser', 'wpfnl' ),
266 + 'type' => 'select',
267 + 'options' => [
268 + 'none' => esc_html__( 'None', 'wpfnl' ),
269 + 'mozilla' => esc_html__( 'Mozilla Firefox', 'wpfnl' ),
270 + 'chrome' => esc_html__( 'Google Chrome', 'wpfnl' ),
271 + 'opera_mini' => esc_html__( 'Opera Mini', 'wpfnl' ),
272 + 'safari' => esc_html__( 'Safari', 'wpfnl' ),
273 + 'edge' => esc_html__( 'Microsoft Edge', 'wpfnl' ),
274 + ],
275 + 'default' => 'none',
276 + 'required' => [ 'display_condition_type', '=', 'browser' ],
277 + ];
278 +
279 + // Operating System
280 + $this->controls['hide_on_os'] = [
281 + 'tab' => 'content',
282 + 'group' => 'wpfunnels',
283 + 'label' => esc_html__( 'Hide On Operating System', 'wpfnl' ),
284 + 'type' => 'select',
285 + 'options' => [
286 + 'none' => esc_html__( 'None', 'wpfnl' ),
287 + 'ios' => esc_html__( 'iOS', 'wpfnl' ),
288 + 'android' => esc_html__( 'Android', 'wpfnl' ),
289 + 'windows' => esc_html__( 'Windows', 'wpfnl' ),
290 + 'macos' => esc_html__( 'MacOS', 'wpfnl' ),
291 + 'linux' => esc_html__( 'Linux', 'wpfnl' ),
292 + 'sunos' => esc_html__( 'SunOS', 'wpfnl' ),
293 + 'openbsd' => esc_html__( 'OpenBSD', 'wpfnl' ),
294 + ],
295 + 'default' => 'none',
296 + 'required' => [ 'display_condition_type', '=', 'operating_system' ],
297 + ];
298 +
299 + // Day
300 + $this->controls['disable_on_days'] = [
301 + 'tab' => 'content',
302 + 'group' => 'wpfunnels',
303 + 'label' => esc_html__( 'Select Days You Want To Disable', 'wpfnl' ),
304 + 'type' => 'select',
305 + 'multiple' => true,
306 + 'options' => [
307 + 'monday' => esc_html__( 'Monday', 'wpfnl' ),
308 + 'tuesday' => esc_html__( 'Tuesday', 'wpfnl' ),
309 + 'wednesday' => esc_html__( 'Wednesday', 'wpfnl' ),
310 + 'thursday' => esc_html__( 'Thursday', 'wpfnl' ),
311 + 'friday' => esc_html__( 'Friday', 'wpfnl' ),
312 + 'saturday' => esc_html__( 'Saturday', 'wpfnl' ),
313 + 'sunday' => esc_html__( 'Sunday', 'wpfnl' ),
314 + ],
315 + 'default' => [],
316 + 'required' => [ 'display_condition_type', '=', 'day' ],
317 + ];
318 +
319 + // Animation
320 + $this->controls['animationSeparator'] = [
321 + 'tab' => 'content',
322 + 'group' => 'wpfunnels',
323 + 'label' => esc_html__( 'Animation', 'wpfnl' ),
324 + 'type' => 'separator',
325 + ];
326 +
327 + $this->controls['entrance_animation'] = [
328 + 'tab' => 'content',
329 + 'group' => 'wpfunnels',
330 + 'label' => esc_html__( 'Entrance Animation', 'wpfnl' ),
331 + 'type' => 'select',
332 + 'options' => [
333 + '' => esc_html__( 'None', 'wpfnl' ),
334 + 'fadeIn' => esc_html__( 'Fade In', 'wpfnl' ),
335 + 'fadeInUp' => esc_html__( 'Fade In Up', 'wpfnl' ),
336 + 'fadeInDown' => esc_html__( 'Fade In Down', 'wpfnl' ),
337 + 'fadeInLeft' => esc_html__( 'Fade In Left', 'wpfnl' ),
338 + 'fadeInRight'=> esc_html__( 'Fade In Right', 'wpfnl' ),
339 + 'zoomIn' => esc_html__( 'Zoom In', 'wpfnl' ),
340 + 'zoomInUp' => esc_html__( 'Zoom In Up', 'wpfnl' ),
341 + 'bounceIn' => esc_html__( 'Bounce In', 'wpfnl' ),
342 + 'bounceInUp' => esc_html__( 'Bounce In Up', 'wpfnl' ),
343 + 'slideInUp' => esc_html__( 'Slide In Up', 'wpfnl' ),
344 + 'slideInLeft'=> esc_html__( 'Slide In Left', 'wpfnl' ),
345 + 'slideInRight'=> esc_html__( 'Slide In Right', 'wpfnl' ),
346 + 'flipInX' => esc_html__( 'Flip In X', 'wpfnl' ),
347 + 'flipInY' => esc_html__( 'Flip In Y', 'wpfnl' ),
348 + 'pulse' => esc_html__( 'Pulse', 'wpfnl' ),
349 + 'tada' => esc_html__( 'Tada', 'wpfnl' ),
350 + 'wobble' => esc_html__( 'Wobble', 'wpfnl' ),
351 + ],
352 + 'inline' => false,
353 + 'placeholder' => esc_html__( 'None', 'wpfnl' ),
354 + 'default' => '',
355 + 'description' => esc_html__( 'Animation plays when the order details enters the viewport on the live page.', 'wpfnl' ),
356 + ];
149 357 }
150 358
151 359
152 360 /**
@@ -159,9 +367,98 @@
159 367 * @access public
160 368 */
161 369 public function render()
162 370 {
371 + $settings = $this->settings;
163 372
373 + // ---- Display Conditions ----------------------------------------
374 + $display_condition = ! empty( $settings['display_condition_type'] ) ? $settings['display_condition_type'] : 'none';
375 +
376 + if ( $display_condition === 'user_state' ) {
377 + $hide_logged_in = ! empty( $settings['hide_from_logged_in'] );
378 + $hide_logged_out = ! empty( $settings['hide_from_logged_out'] );
379 +
380 + if ( $hide_logged_in && is_user_logged_in() ) {
381 + return;
382 + }
383 + if ( $hide_logged_out && ! is_user_logged_in() ) {
384 + return;
385 + }
386 +
387 + } elseif ( $display_condition === 'user_role' ) {
388 + $hide_for_user_role = ! empty( $settings['hide_for_user_role'] ) ? $settings['hide_for_user_role'] : 'none';
389 +
390 + if ( $hide_for_user_role !== 'none' && is_user_logged_in() ) {
391 + $user = wp_get_current_user();
392 + if ( in_array( $hide_for_user_role, $user->roles ) ) {
393 + return;
394 + }
395 + }
396 +
397 + } elseif ( $display_condition === 'day' ) {
398 + $disable_on_days = ! empty( $settings['disable_on_days'] ) ? $settings['disable_on_days'] : [];
399 +
400 + if ( ! empty( $disable_on_days ) && is_array( $disable_on_days ) ) {
401 + $current_day = strtolower( date( 'l' ) ); // e.g., 'monday'
402 + if ( in_array( $current_day, $disable_on_days ) ) {
403 + return;
404 + }
405 + }
406 +
407 + } elseif ( $display_condition === 'browser' ) {
408 + $hide_on_browser = ! empty( $settings['hide_on_browser'] ) ? $settings['hide_on_browser'] : 'none';
409 +
410 + if ( $hide_on_browser !== 'none' ) {
411 + $user_agent = isset( $_SERVER['HTTP_USER_AGENT'] ) ? strtolower( $_SERVER['HTTP_USER_AGENT'] ) : '';
412 + $current_browser = '';
413 +
414 + if ( strpos( $user_agent, 'edg' ) !== false ) {
415 + $current_browser = 'edge';
416 + } elseif ( strpos( $user_agent, 'opr' ) !== false || strpos( $user_agent, 'opera' ) !== false ) {
417 + $current_browser = 'opera_mini';
418 + } elseif ( strpos( $user_agent, 'chrome' ) !== false ) {
419 + $current_browser = 'chrome';
420 + } elseif ( strpos( $user_agent, 'safari' ) !== false ) {
421 + $current_browser = 'safari';
422 + } elseif ( strpos( $user_agent, 'firefox' ) !== false ) {
423 + $current_browser = 'mozilla';
424 + }
425 +
426 + if ( $current_browser === $hide_on_browser ) {
427 + return;
428 + }
429 + }
430 +
431 + } elseif ( $display_condition === 'operating_system' ) {
432 + $hide_on_os = ! empty( $settings['hide_on_os'] ) ? $settings['hide_on_os'] : 'none';
433 +
434 + if ( $hide_on_os !== 'none' ) {
435 + $user_agent = isset( $_SERVER['HTTP_USER_AGENT'] ) ? strtolower( $_SERVER['HTTP_USER_AGENT'] ) : '';
436 + $current_os = '';
437 +
438 + if ( strpos( $user_agent, 'windows' ) !== false || strpos( $user_agent, 'win32' ) !== false || strpos( $user_agent, 'win64' ) !== false ) {
439 + $current_os = 'windows';
440 + } elseif ( strpos( $user_agent, 'macintosh' ) !== false || strpos( $user_agent, 'mac os x' ) !== false ) {
441 + $current_os = 'macos';
442 + } elseif ( strpos( $user_agent, 'linux' ) !== false && strpos( $user_agent, 'android' ) === false ) {
443 + $current_os = 'linux';
444 + } elseif ( strpos( $user_agent, 'android' ) !== false ) {
445 + $current_os = 'android';
446 + } elseif ( strpos( $user_agent, 'iphone' ) !== false || strpos( $user_agent, 'ipad' ) !== false || strpos( $user_agent, 'ipod' ) !== false ) {
447 + $current_os = 'ios';
448 + } elseif ( strpos( $user_agent, 'sunos' ) !== false ) {
449 + $current_os = 'sunos';
450 + } elseif ( strpos( $user_agent, 'openbsd' ) !== false ) {
451 + $current_os = 'openbsd';
452 + }
453 +
454 + if ( $current_os === $hide_on_os ) {
455 + return;
456 + }
457 + }
458 + }
459 + // ---- End Display Conditions ------------------------------------
460 +
164 461 $output = '';
165 462 $order_overview = 'on';
166 463 $order_details = 'on';
167 464 $billing_details = 'on';
@@ -166,44 +463,68 @@
166 463 $order_details = 'on';
167 464 $billing_details = 'on';
168 465 $shipping_details = 'on';
169 466
170 - if (isset($this->settings['enable_order_review']) && !empty($this->settings['enable_order_review']) ) {
171 - $order_overview = $this->settings['enable_order_review'];
172 - update_post_meta($this->post_id, '_wpfnl_thankyou_order_overview', $this->settings['enable_order_review']);
467 + if (isset($settings['enable_order_review']) && !empty($settings['enable_order_review']) ) {
468 + $order_overview = $settings['enable_order_review'];
469 + update_post_meta($this->post_id, '_wpfnl_thankyou_order_overview', $settings['enable_order_review']);
173 470 }else{
174 471 $order_overview = 'off';
175 472 update_post_meta( $this->post_id, '_wpfnl_thankyou_order_overview', 'off' );
176 473 }
177 474
178 - if (isset($this->settings['enable_order_details']) && !empty($this->settings['enable_order_details']) ) {
179 - $order_details = $this->settings['enable_order_details'];
180 - update_post_meta($this->post_id, '_wpfnl_thankyou_order_details', $this->settings['enable_order_details']);
475 + if (isset($settings['enable_order_details']) && !empty($settings['enable_order_details']) ) {
476 + $order_details = $settings['enable_order_details'];
477 + update_post_meta($this->post_id, '_wpfnl_thankyou_order_details', $settings['enable_order_details']);
181 478 }else{
182 479 $order_details = 'off';
183 480 update_post_meta( $this->post_id, '_wpfnl_thankyou_order_details', 'off' );
184 481 }
185 482
186 - if (isset($this->settings['enable_billing_details']) && !empty($this->settings['enable_billing_details']) ) {
187 - $billing_details = $this->settings['enable_billing_details'];
188 - update_post_meta($this->post_id, '_wpfnl_thankyou_billing_details', $this->settings['enable_billing_details']);
483 + if (isset($settings['enable_billing_details']) && !empty($settings['enable_billing_details']) ) {
484 + $billing_details = $settings['enable_billing_details'];
485 + update_post_meta($this->post_id, '_wpfnl_thankyou_billing_details', $settings['enable_billing_details']);
189 486 }else{
190 487 $billing_details = 'off';
191 488 update_post_meta( $this->post_id, '_wpfnl_thankyou_billing_details', 'off' );
192 489 }
193 490
194 - if (isset($this->settings['enable_shipping_details']) && !empty($this->settings['enable_shipping_details']) ) {
195 - $shipping_details = $this->settings['enable_shipping_details'];
196 - update_post_meta($this->post_id, '_wpfnl_thankyou_shipping_details', $this->settings['enable_shipping_details']);
491 + if (isset($settings['enable_shipping_details']) && !empty($settings['enable_shipping_details']) ) {
492 + $shipping_details = $settings['enable_shipping_details'];
493 + update_post_meta($this->post_id, '_wpfnl_thankyou_shipping_details', $settings['enable_shipping_details']);
197 494 }else{
198 495 $shipping_details = 'off';
199 496 update_post_meta( $this->post_id, '_wpfnl_thankyou_shipping_details', 'off' );
200 497 }
498 +
499 + // Build wrapper classes
500 + $wrapper_classes = 'wpfnl-bricks-order-details-form';
501 + $wrapper_classes .= ' wpfnl-bricks-display-order-overview-' . esc_attr( $order_overview );
502 + $wrapper_classes .= ' wpfnl-bricks-display-order-details-' . esc_attr( $order_details );
503 + $wrapper_classes .= ' wpfnl-bricks-display-billing-address-' . esc_attr( $billing_details );
504 + $wrapper_classes .= ' wpfnl-bricks-display-shipping-address-' . esc_attr( $shipping_details );
505 +
506 + // Add responsive classes
507 + if ( ! empty( $settings['hide_on_desktop'] ) ) {
508 + $wrapper_classes .= ' wpfnl-hide-desktop';
509 + }
510 + if ( ! empty( $settings['hide_on_tablet'] ) ) {
511 + $wrapper_classes .= ' wpfnl-hide-tablet';
512 + }
513 + if ( ! empty( $settings['hide_on_mobile'] ) ) {
514 + $wrapper_classes .= ' wpfnl-hide-mobile';
515 + }
516 +
517 + // Add animation class
518 + $animation = ! empty( $settings['entrance_animation'] ) ? $settings['entrance_animation'] : '';
519 + if ( $animation ) {
520 + $wrapper_classes .= ' wpfnl-animation ' . esc_attr( $animation );
521 + }
201 522
202 523 ?>
203 524 <?php if( !isset($_GET['optin']) ) {
204 525 ?>
205 - <div class = "wpfnl-bricks-order-details-form wpfnl-bricks-display-order-overview-<?php echo esc_attr( $order_overview ); ?> wpfnl-bricks-display-order-details-<?php echo esc_attr( $order_details ); ?> wpfnl-bricks-display-billing-address-<?php echo esc_attr( $billing_details ); ?> wpfnl-bricks-display-shipping-address-<?php echo esc_attr( $shipping_details ); ?>">
526 + <div class="<?php echo esc_attr( $wrapper_classes ); ?>">
206 527 <?php
207 528 echo do_shortcode( '[wpfunnels_order_details step_id='.$this->post_id.']' );
208 529 ?>
209 530 </div>