PluginProbe
WPFunnels – Funnel Builder for WooCommerce with Checkout & One Click Upsell / 2.8.16
WPFunnels – Funnel Builder for WooCommerce with Checkout & One Click Upsell v2.8.16
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 2.8.16 All 261 releases
wpfunnels / includes / core / shortcodes / class-wpfnl-shortcode-next-step-button.php

class-wpfnl-shortcode-next-step-button.php in WPFunnels – Funnel Builder for WooCommerce with Checkout & One Click Upsell 2.8.16, at includes/core/shortcodes/class-wpfnl-shortcode-next-step-button.php

111 lines 2.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Next step shortcode class
4 *
5 * @package
6 */
7 namespace WPFunnels\Shortcodes;
8
9 use WPFunnels\Wpfnl_functions;
10
11 /**
12 * Class WC_Shortcode_Optin
13 *
14 * @package WPFunnels\Shortcodes
15 */
16 class Wpfnl_Shortcode_NextStepButton {
17
18 /**
19 * Attributes
20 *
21 * @var array
22 */
23 protected $attributes = array();
24
25
26 /**
27 * Wpfnl_Shortcode_Order_details constructor.
28 *
29 * @param array $attributes
30 */
31 public function __construct( $attributes = array() ) {
32
33 $this->attributes = $this->parse_attributes( $attributes );
34
35
36 }
37
38
39 /**
40 * Get shortcode attributes.
41 *
42 * @since 3.2.0
43 * @return array
44 */
45 public function get_attributes() {
46 return $this->attributes;
47 }
48
49
50 /**
51 * Parse attributes
52 *
53 * @param $attributes
54 *
55 * @return array
56 */
57 protected function parse_attributes( $attributes ) {
58
59 $attributes = shortcode_atts(
60 array(
61 'btn_text' => '',
62 'background_color' => '',
63 'color' => '',
64 'padding' => '',
65 'class' => '',
66 ),
67 $attributes
68 );
69 return $attributes;
70 }
71
72 /**
73 * Get wrapper classes
74 *
75 * @return array
76 */
77 protected function get_wrapper_classes() {
78 $classes = array( 'wpfnl', 'wpfnl-order-details-wrapper' );
79 return $classes;
80 }
81
82
83 /**
84 * Content of optin form
85 *
86 * @return string
87 */
88 public function get_content() {
89 if( Wpfnl_functions::check_if_this_is_step_type('landing') || Wpfnl_functions::check_if_this_is_step_type('custom') ) {
90 $products_array = get_post_meta(get_the_ID(), 'checkout_product_selector', true);
91 $products = '';
92 if ($products_array) {
93 $products = implode(",", $products_array);
94 }
95
96 $html = '';
97 do_action( 'wpfunnels/before_next_step_button' );
98 $html .= '<div class="next-step-button-wrapper">';
99 $html .= '<a href="#" data-id="'.get_the_ID().'" data-products="'.$products.'"';
100 $html .= 'id="wpfunnels_next_step_controller"';
101 $html .= 'style="cursor: pointer;background-color: '.esc_html($this->attributes['background_color']).';color: '.esc_html($this->attributes['color']).'; padding: '.esc_html($this->attributes['padding']).';" class="'.esc_html($this->attributes['class']).' next-step-button btn-default">';
102 $html .= isset($this->attributes['btn_text']) && $this->attributes['btn_text'] ? esc_html($this->attributes['btn_text']) : 'Get Now';
103 $html .= '</a></div><span class="wpfnl-alert" id="wpfnl-next-button-loader"></span>';
104 do_action( 'wpfunnels/after_next_step_button' );
105
106 return $html;
107 }
108 return false;
109 }
110 }
111