PluginProbe
CartFlows – Funnel Builder & Checkout Plugin for WooCommerce / 3.1.3
CartFlows – Funnel Builder & Checkout Plugin for WooCommerce v3.1.3
3.3.0 3.2.1 3.2.0 3.1.4 3.1.3 3.1.2 3.1.1 3.1.0 3.0.1 trunk 1.0.4 1.1.0 1.1.0.1 1.1.1 1.1.10 1.1.11 1.1.12 1.1.13 1.1.14 1.1.15 1.1.16 1.1.17 1.1.18 1.1.19 1.1.2 All 162 releases
cartflows / admin-legacy-core / inc / flow-meta.php

flow-meta.php in CartFlows – Funnel Builder & Checkout Plugin for WooCommerce 3.1.3, at admin-legacy-core/inc/flow-meta.php

309 lines 10.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * CartFlows flow Meta Helper.
4 *
5 * @package CartFlows
6 */
7
8 namespace CartflowsAdmin\AdminLegacyCore\Inc;
9
10 // Exit if accessed directly.
11 if ( ! defined( 'ABSPATH' ) ) {
12 exit;
13 }
14
15 /**
16 * Class flowMeta.
17 */
18 class FlowMeta {
19
20
21 /**
22 * Get flow meta options.
23 *
24 * @param int $flow_id flow id.
25 */
26 public static function get_meta_settings( $flow_id ) {
27
28 $settings = self::get_settings_fields( $flow_id );
29 $settings_data = array(
30 'settings' => $settings,
31 );
32 return $settings_data;
33 }
34
35
36 /**
37 * Page Header Tabs.
38 *
39 * @param int $flow_id id.
40 */
41 public static function get_settings_fields( $flow_id ) {
42
43 // Check is the current theme is FSE theme or not.
44 $is_fse_theme = wcf_is_current_theme_is_fse_theme();
45
46 // Add the hidden class if the current theme is not FSE theme.
47 $section_hide_class = ! $is_fse_theme ? 'wcf-hide hidden' : '';
48
49 // Check is the current flow is Store Checkout Flow.
50 $is_store_checkout_flow = intval( \Cartflows_Helper::get_global_setting( '_cartflows_store_checkout' ) ) === intval( $flow_id );
51
52 // Determine whether to show CodeMirror editors or the legacy textarea.
53 $show_code_editor = AdminHelper::should_show_code_editor();
54
55 $general_fields = array(
56 'flow_slug' => array(
57 'type' => 'text',
58 'name' => 'post_name',
59 'label' => __( 'Funnel Slug', 'cartflows' ),
60 'value' => get_post_field( 'post_name', $flow_id ),
61 'display_align' => 'vertical',
62 ),
63 'flow_indexing' => array(
64 'type' => 'select',
65 'name' => 'wcf-flow-indexing',
66 'label' => __( 'Disallow Indexing', 'cartflows' ),
67 'tooltip' => __( 'Changing this will replace the default global setting. To go back to the global setting, just select Default.', 'cartflows' ),
68 'display_align' => 'vertical',
69 'options' => array(
70 array(
71 'value' => '',
72 'label' => __( 'Default', 'cartflows' ),
73 ),
74 array(
75 'value' => 'disallow',
76 'label' => __( 'Yes', 'cartflows' ),
77 ),
78 array(
79 'value' => 'allow',
80 'label' => __( 'No', 'cartflows' ),
81 ),
82 ),
83 'value' => get_post_meta( $flow_id, 'wcf-flow-indexing', true ),
84 ),
85 );
86
87 if ( $show_code_editor ) {
88 // Migration completed: show separate JS and CSS CodeMirror editors.
89 $general_fields['flow_script_option'] = array(
90 'type' => 'code',
91 'label' => __( 'Funnel Custom JavaScript', 'cartflows' ),
92 'name' => 'wcf-flow-custom-js',
93 'value' => get_post_meta( $flow_id, 'wcf-flow-custom-js', true ),
94 'language' => 'javascript',
95 'tooltip' => __( 'Any JavaScript added here will run across all pages in this funnel. Do not include script tags.', 'cartflows' ),
96 'display_align' => 'vertical',
97 );
98 $general_fields['flow_style_option'] = array(
99 'type' => 'code',
100 'label' => __( 'Funnel Custom CSS', 'cartflows' ),
101 'name' => 'wcf-flow-custom-css',
102 'value' => get_post_meta( $flow_id, 'wcf-flow-custom-css', true ),
103 'language' => 'css',
104 'tooltip' => __( 'Any CSS added here will run across all pages in this funnel. Do not include style tags.', 'cartflows' ),
105 'display_align' => 'vertical',
106 );
107 } else {
108 // Migration not completed: show the legacy combined textarea.
109 $general_fields['script_option'] = array(
110 'type' => 'textarea',
111 'label' => __( 'Funnel Custom Script', 'cartflows' ),
112 'name' => 'wcf-flow-custom-script',
113 'value' => get_post_meta( $flow_id, 'wcf-flow-custom-script', true ),
114 'tooltip' => __( 'Any code you add here will work across all the pages in this funnel.', 'cartflows' ),
115 'display_align' => 'vertical',
116 );
117 }
118
119 $settings = array(
120 'instant-layout' => array(
121 'title' => __( 'Instant Layout ', 'cartflows' ),
122 'slug' => 'instant_layout',
123 'fields' => array(
124 'instant-layout-style' => array(
125 'type' => 'toggle',
126 'label' => __( 'Enable Instant Layout', 'cartflows' ),
127 'name' => 'instant-layout-style',
128 'value' => get_post_meta( $flow_id, 'instant-layout-style', true ),
129 'desc' => sprintf(
130 /* translators: %1$s: Break line, %2$s: link html Start, %3$s: Link html end. */
131 __( 'This layout will replace the default page template for the Checkout, Upsell/Downsell and Thank You steps. You can customize %1$sthe design in the Checkout, Upsell/Downsell and Thank You step\'s settings, under the design tab. %2$sRead More.%3$s', 'cartflows' ),
132 '<br>',
133 '<a href="' . esc_url( \Cartflows_Helper::get_kb_doc_link( 'https://cartflows.com/docs/cartflows-instant-checkout-layout/' ) ) . '" target="_blank">',
134 '</a>'
135 ),
136 'is_fullwidth' => true,
137 ),
138 'wcf-instant-checkout-header-logo-heading' => array(
139 'type' => 'heading',
140 'label' => __( 'Logo', 'cartflows' ),
141 'conditions' => array(
142 'relation' => 'and',
143 'fields' => array(
144 array(
145 'name' => 'instant-layout-style',
146 'operator' => '===',
147 'value' => 'yes',
148 ),
149 ),
150 ),
151 ),
152 'wcf-instant-checkout-header-logo' => array(
153 'type' => 'image-selector',
154 'label' => __( 'Custom Logo', 'cartflows' ),
155 'name' => 'wcf-instant-checkout-header-logo',
156 'value' => wcf()->options->get_flow_meta_value( $flow_id, 'wcf-instant-checkout-header-logo' ),
157 'isNameArray' => true,
158 'objName' => 'wcf_instant_checkout_header_logo',
159 'tooltip' => __( 'If you\'ve added a custom logo, it will show up here. If not, a default logo from the theme will be used instead.', 'cartflows' ),
160 'conditions' => array(
161 'relation' => 'and',
162 'fields' => array(
163 array(
164 'name' => 'instant-layout-style',
165 'operator' => '===',
166 'value' => 'yes',
167 ),
168 ),
169 ),
170 'desc' => __( 'Minimum image size should be 130 x 40 in pixes for ideal display.', 'cartflows' ),
171 'display_align' => 'vertical',
172 ),
173 'wcf-instant-checkout-header-logo-width' => array(
174 'type' => 'number',
175 'label' => __( 'Width (In px)', 'cartflows' ),
176 'name' => 'wcf-instant-checkout-header-logo-width',
177 'placeholder' => '130px',
178 'value' => wcf()->options->get_flow_meta_value( $flow_id, 'wcf-instant-checkout-header-logo-width' ),
179 'display_align' => 'vertical',
180 'conditions' => array(
181 'fields' => array(
182 array(
183 'name' => 'instant-layout-style',
184 'operator' => '===',
185 'value' => 'yes',
186 ),
187 ),
188 ),
189 ),
190 'wcf-instant-checkout-header-logo-height' => array(
191 'type' => 'number',
192 'label' => __( 'Height (In px)', 'cartflows' ),
193 'name' => 'wcf-instant-checkout-header-logo-height',
194 'placeholder' => '40px',
195 'value' => wcf()->options->get_flow_meta_value( $flow_id, 'wcf-instant-checkout-header-logo-height' ),
196 'display_align' => 'vertical',
197 'conditions' => array(
198 'fields' => array(
199 array(
200 'name' => 'instant-layout-style',
201 'operator' => '===',
202 'value' => 'yes',
203 ),
204 ),
205 ),
206 ),
207 'wcf-instant-checkout-header--color' => array(
208 'type' => 'color-picker',
209 'name' => 'wcf-instant-checkout-header-color',
210 'label' => __( 'Header Color', 'cartflows' ),
211 'value' => wcf()->options->get_flow_meta_value( $flow_id, 'wcf-instant-checkout-header-color' ),
212 'conditions' => array(
213 'fields' => array(
214 array(
215 'name' => 'instant-layout-style',
216 'operator' => '===',
217 'value' => 'yes',
218 ),
219 ),
220 ),
221 ),
222 ),
223 'priority' => 10,
224 ),
225 'funnel-advanced-options' => array(
226 'title' => __( 'Global Styling', 'cartflows' ),
227 'slug' => 'funnel_advanced_options',
228 'fields' => array(
229 'gcp-enable-option' => array(
230 'type' => 'toggle',
231 'label' => __( 'Enable Global Styling', 'cartflows' ),
232 'name' => 'wcf-enable-gcp-styling',
233 'value' => get_post_meta( $flow_id, 'wcf-enable-gcp-styling', true ),
234 'is_fullwidth' => true,
235 ),
236 'gcp-primary-color' => array(
237 'type' => 'color-picker',
238 'name' => 'wcf-gcp-primary-color',
239 'label' => __( 'Primary Color', 'cartflows' ),
240 'value' => wcf()->options->get_flow_meta_value( $flow_id, 'wcf-gcp-primary-color' ),
241 'conditions' => array(
242 'fields' => array(
243 array(
244 'name' => 'wcf-enable-gcp-styling',
245 'operator' => '===',
246 'value' => 'yes',
247 ),
248 ),
249 ),
250 ),
251 'gcp-secondary-color' => array(
252 'type' => 'color-picker',
253 'name' => 'wcf-gcp-secondary-color',
254 'label' => __( 'Secondary Color', 'cartflows' ),
255 'value' => wcf()->options->get_flow_meta_value( $flow_id, 'wcf-gcp-secondary-color' ),
256 'conditions' => array(
257 'fields' => array(
258 array(
259 'name' => 'wcf-enable-gcp-styling',
260 'operator' => '===',
261 'value' => 'yes',
262 ),
263 ),
264 ),
265 ),
266 'gcp-primary-text-color' => array(
267 'type' => 'color-picker',
268 'name' => 'wcf-gcp-text-color',
269 'label' => __( 'Text Color', 'cartflows' ),
270 'value' => wcf()->options->get_flow_meta_value( $flow_id, 'wcf-gcp-text-color' ),
271 'conditions' => array(
272 'fields' => array(
273 array(
274 'name' => 'wcf-enable-gcp-styling',
275 'operator' => '===',
276 'value' => 'yes',
277 ),
278 ),
279 ),
280 ),
281 'gcp-accent-color' => array(
282 'type' => 'color-picker',
283 'name' => 'wcf-gcp-accent-color',
284 'label' => __( 'Heading/Accent Color', 'cartflows' ),
285 'value' => wcf()->options->get_flow_meta_value( $flow_id, 'wcf-gcp-accent-color' ),
286 'conditions' => array(
287 'fields' => array(
288 array(
289 'name' => 'wcf-enable-gcp-styling',
290 'operator' => '===',
291 'value' => 'yes',
292 ),
293 ),
294 ),
295 ),
296 ),
297 'priority' => 20,
298 ),
299 'general' => array(
300 'title' => __( 'General ', 'cartflows' ),
301 'slug' => 'general',
302 'fields' => $general_fields,
303 'priority' => 30,
304 ),
305 );
306 return apply_filters( 'cartflows_admin_flow_settings', $settings, $flow_id );
307 }
308 }
309