PluginProbe
CartFlows – Funnel Builder & Checkout Plugin for WooCommerce / 1.1.0
CartFlows – Funnel Builder & Checkout Plugin for WooCommerce v1.1.0
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 / classes / class-cartflows-admin-fields.php

class-cartflows-admin-fields.php in CartFlows – Funnel Builder & Checkout Plugin for WooCommerce 1.1.0, at classes/class-cartflows-admin-fields.php

158 lines 4.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * CARTFLOWS Admin Fields.
4 *
5 * @package CARTFLOWS
6 */
7
8 /**
9 * Class Cartflows_Admin_Fields.
10 */
11 class Cartflows_Admin_Fields {
12
13 /**
14 * Text Field
15 *
16 * @param array $args Args.
17 * @return string
18 */
19 static public function text_field( $args ) {
20
21 $id = $args['id'];
22 $name = $args['name'];
23 $title = $args['title'];
24 $value = $args['value'];
25
26 $output = '<div class="form-field">';
27 $output .= '<label for="' . $id . '">' . $title . '</label>';
28 $output .= '<input type="text" name="' . $name . '" id="' . $id . '" class="placeholder placeholder-active" value="' . esc_attr( $value ) . '">';
29 $output .= '</div>';
30
31 return $output;
32 }
33
34 /**
35 * URL Field
36 *
37 * @param array $args Args.
38 * @return string
39 */
40 static public function url_field( $args ) {
41
42 $id = $args['id'];
43 $name = $args['name'];
44 $title = $args['title'];
45 $value = $args['value'];
46
47 $output = '<div class="form-field">';
48 $output .= '<label for="' . $id . '">' . $title . '</label>';
49 $output .= '<input type="text" name="' . $name . '" id="' . $id . '" class="placeholder placeholder-active" value="' . esc_url( $value ) . '">';
50 $output .= '</div>';
51
52 return $output;
53 }
54
55 /**
56 * Checkbox Field
57 *
58 * @param array $args Args.
59 * @return string
60 */
61 static public function checkobox_field( $args ) {
62
63 $id = $args['id'];
64 $name = $args['name'];
65 $title = $args['title'];
66 $value = $args['value'];
67
68 $output = '<div class="form-field">';
69 $output .= '<label for="' . $id . '">';
70 $output .= '<input type="hidden" id="wcf_hid_' . $id . '" name="' . $name . '" value="disable">';
71 $output .= '<input type="checkbox" id="wcf_' . $id . '" name="' . $name . '" value="enable" ' . checked( $value, 'enable', false ) . '>';
72 $output .= $title;
73 $output .= '</label>';
74 $output .= '</div>';
75
76 return $output;
77 }
78
79 /**
80 * Checkout Selection Field
81 *
82 * @param array $args Args.
83 * @return string
84 */
85 static public function flow_checkout_selection_field( $args ) {
86
87 $id = $args['id'];
88 $name = $args['name'];
89 $title = $args['title'];
90 $value = $args['value'];
91
92 $checkout_steps = get_posts(
93 array(
94 'posts_per_page' => -1,
95 'post_type' => CARTFLOWS_STEP_POST_TYPE,
96 'post_status' => 'publish',
97 'orderby' => 'ID',
98 'order' => 'ASC',
99 'tax_query' => array(
100 array(
101 'taxonomy' => CARTFLOWS_TAXONOMY_STEP_TYPE,
102 'field' => 'slug',
103 'terms' => 'checkout',
104 ),
105 ),
106 )
107 );
108
109 $output = '<div class="form-field">';
110
111 $output .= '<div class="form-field-label">';
112 $output .= '<label for="' . $id . '">';
113 $output .= $title;
114 $output .= '</label>';
115 $output .= '</div>';
116
117 $output .= '<div class="form-field-data">';
118 $output .= '<select id="wcf_' . $id . '" name="' . $name . '">';
119
120 if ( ! empty( $checkout_steps ) ) {
121 $output .= '<option value="">' . __( 'Select', 'cartflows' ) . '</option>';
122 } else {
123
124 $output .= '<option value="">' . __( 'No Checkout Steps', 'cartflows' ) . '</option>';
125 }
126
127 foreach ( $checkout_steps as $index => $step_data ) {
128
129 $output .= '<option value="' . $step_data->ID . '" ' . selected( $value, $step_data->ID, false ) . '>' . $step_data->post_title . ' (#' . $step_data->ID . ') </option>';
130 }
131
132 $output .= '</select>';
133 $output .= '</div>';
134
135 if ( '' !== $value ) {
136 $output .= '<div class="form-field-actions">';
137 $output .= '<a href="' . get_edit_post_link( $value ) . '" target="_blank" class="" title="Edit">';
138 $output .= '<span class="dashicons dashicons-edit"></span>';
139 $output .= '<span class="">Edit</span>';
140 $output .= '</a>';
141 $output .= '<a href="' . get_permalink( $value ) . '" target="_blank" class="" title="View">';
142 $output .= '<span class="dashicons dashicons-visibility"></span>';
143 $output .= '<span class="">View</span>';
144 $output .= '</a>';
145 $output .= '</div>';
146 }
147
148 $output .= '<div class="form-field-desc">';
149 /* translators: %s: link */
150 $output .= '<p>' . sprintf( __( 'Be sure not to add any product in above selected Global Checkout step. Please read information about how to set up Global Checkout %1$shere%2$s.', 'cartflows' ), '<a href="https://cartflows.com/docs/global-checkout/" target="_blank">', '</a>' ) . '</p>';
151 $output .= '</div>';
152
153 $output .= '</div>';
154
155 return $output;
156 }
157 }
158