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.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
← All changes | includes/core/shortcodes/class-wpfnl-shortcode-next-step-button.php +88 -21 2.8.16 → 3.13.3 View file →
@@ -57,13 +57,32 @@
57 57 protected function parse_attributes( $attributes ) {
58 58
59 59 $attributes = shortcode_atts(
60 60 array(
61 - 'btn_text' => '',
62 - 'background_color' => '',
63 - 'color' => '',
64 - 'padding' => '',
65 - 'class' => '',
61 + 'btn_text' => '',
62 + 'background_color' => '',
63 + 'color' => '',
64 + 'padding' => '',
65 + 'class' => '',
66 + 'button_type' => '',
67 + 'data_url' => '',
68 + 'border_radius' => '',
69 + 'font_size' => '',
70 + 'width' => '',
71 + 'border' => '',
72 + 'align' => '',
73 + 'target' => '',
74 + 'icon' => '',
75 + 'icon_position' => 'before',
76 + 'font_family' => '',
77 + 'font_weight' => '',
78 + 'text_transform' => '',
79 + 'letter_spacing' => '',
80 + 'line_height' => '',
81 + 'box_shadow' => '',
82 + 'display' => 'inline-block',
83 + 'custom_id' => '',
84 + 'custom_attrs' => '',
66 85 ),
67 86 $attributes
68 87 );
69 88 return $attributes;
@@ -80,31 +99,79 @@
80 99 }
81 100
82 101
83 102 /**
84 - * Content of optin form
103 + * Generates the HTML output for the customizable button shortcode in WPFunnels.
85 104 *
86 - * @return string
105 + * This function checks if the current step type is 'landing' or 'custom'.
106 + * If valid, it renders a next-step button with a variety of customizable
107 + * style and data attributes based on shortcode inputs.
108 + *
109 + * @return string|false HTML markup for the button or false if step type is invalid.
110 + * @since 3.5.19
87 111 */
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') ) {
112 + public function get_content(){
113 + if (Wpfnl_functions::check_if_this_is_step_type('landing') || Wpfnl_functions::check_if_this_is_step_type('custom')) {
114 +
90 115 $products_array = get_post_meta(get_the_ID(), 'checkout_product_selector', true);
91 - $products = '';
92 - if ($products_array) {
93 - $products = implode(",", $products_array);
116 + $products = $products_array ? implode(",", $products_array) : '';
117 +
118 + // Build inline styles dynamically
119 + $style = 'cursor: pointer;';
120 + $style .= !empty($this->attributes['background_color']) ? 'background-color: ' . esc_html($this->attributes['background_color']) . ';' : '';
121 + $style .= !empty($this->attributes['color']) ? 'color: ' . esc_html($this->attributes['color']) . ';' : '';
122 + $style .= !empty($this->attributes['padding']) ? 'padding: ' . esc_html($this->attributes['padding']) . ';' : '';
123 + $style .= !empty($this->attributes['border_radius']) ? 'border-radius: ' . esc_html($this->attributes['border_radius']) . ';' : '';
124 + $style .= !empty($this->attributes['font_size']) ? 'font-size: ' . esc_html($this->attributes['font_size']) . ';' : '';
125 + $style .= !empty($this->attributes['width']) ? 'width: ' . esc_html($this->attributes['width']) . ';' : '';
126 + $style .= !empty($this->attributes['border']) ? 'border: ' . esc_html($this->attributes['border']) . ';' : '';
127 + $style .= !empty($this->attributes['font_family']) ? 'font-family: ' . esc_html($this->attributes['font_family']) . ';' : '';
128 + $style .= !empty($this->attributes['font_weight']) ? 'font-weight: ' . esc_html($this->attributes['font_weight']) . ';' : '';
129 + $style .= !empty($this->attributes['text_transform']) ? 'text-transform: ' . esc_html($this->attributes['text_transform']) . ';' : '';
130 + $style .= !empty($this->attributes['letter_spacing']) ? 'letter-spacing: ' . esc_html($this->attributes['letter_spacing']) . ';' : '';
131 + $style .= !empty($this->attributes['line_height']) ? 'line-height: ' . esc_html($this->attributes['line_height']) . ';' : '';
132 + $style .= !empty($this->attributes['box_shadow']) ? 'box-shadow: ' . esc_html($this->attributes['box_shadow']) . ';' : '';
133 + $style .= !empty($this->attributes['display']) ? 'display: ' . esc_html($this->attributes['display']) . ';' : '';
134 +
135 + // Alignment
136 + $align_style = !empty($this->attributes['align']) ? 'text-align: ' . esc_attr($this->attributes['align']) . ';' : '';
137 +
138 + // Button Text with optional icon
139 + $btn_text = isset($this->attributes['btn_text']) && $this->attributes['btn_text'] ? esc_html($this->attributes['btn_text']) : 'Get Now';
140 + $icon = isset($this->attributes['icon']) ? $this->attributes['icon'] : '';
141 + $icon_position = isset($this->attributes['icon_position']) ? $this->attributes['icon_position'] : 'before';
142 +
143 + $button_label = '';
144 + if (!empty($icon) && $icon_position === 'before') {
145 + $button_label .= $icon . ' ';
94 146 }
95 -
147 + $button_label .= $btn_text;
148 + if (!empty($icon) && $icon_position === 'after') {
149 + $button_label .= ' ' . $icon;
150 + }
151 +
96 152 $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';
153 + do_action('wpfunnels/before_next_step_button');
154 +
155 + $html .= '<div class="next-step-button-wrapper" style="' . $align_style . '">';
156 + $html .= '<a href="#"
157 + data-button-type="' . esc_attr($this->attributes['button_type']) . '"
158 + data-url="' . esc_url($this->attributes['data_url']) . '"
159 + data-id="' . get_the_ID() . '"
160 + data-products="' . esc_attr($products) . '"
161 + id="' . esc_attr(!empty($this->attributes['custom_id']) ? $this->attributes['custom_id'] : 'wpfunnels_next_step_controller') . '"
162 + style="' . $style . '"
163 + class="' . esc_attr($this->attributes['class']) . ' next-step-button btn-default"
164 + target="' . esc_attr($this->attributes['target']) . '"'
165 + . (!empty($this->attributes['custom_attrs']) ? ' ' . $this->attributes['custom_attrs'] : '') . '>';
166 +
167 + $html .= $button_label;
168 +
103 169 $html .= '</a></div><span class="wpfnl-alert" id="wpfnl-next-button-loader"></span>';
104 - do_action( 'wpfunnels/after_next_step_button' );
105 170
106 - return $html;
171 + do_action('wpfunnels/after_next_step_button');
172 +
173 + return $html;
107 174 }
108 175 return false;
109 176 }
110 177 }