PluginProbe
SellKit – Funnel builder and checkout optimizer for WooCommerce to sell more, faster / 2.7.0
SellKit – Funnel builder and checkout optimizer for WooCommerce to sell more, faster v2.7.0
2.7.0 2.6.0 trunk 1.1.0 1.1.4 1.2.1 1.2.2 1.2.3 1.2.5 1.2.9 1.3.1 1.3.2 1.5.0 1.5.1 1.5.4 1.5.7 1.5.8 1.5.9 1.6.2 1.6.5 1.6.8 1.7.2 1.7.4 1.7.5 1.7.9 All 43 releases
← All changes | includes/admin/funnel/importer/ajax-handler.php +28 -8 1.7.92.7.0 View file →
@@ -42,8 +42,10 @@
42 42 *
43 43 * @since 1.1.0
44 44 */
45 45 public function import_steps_data() {
46 + check_ajax_referer( 'sellkit', 'nonce' );
47 +
46 48 $nonce = sellkit_htmlspecialchars( INPUT_GET, 'nonce' );
47 49 $step_id = sellkit_htmlspecialchars( INPUT_GET, 'step_id' );
48 50 $funnel_id = sellkit_htmlspecialchars( INPUT_GET, 'funnel_id' );
49 51 $origin_node = filter_input( INPUT_GET, 'origin_node', FILTER_SANITIZE_FULL_SPECIAL_CHARS );
@@ -51,9 +53,11 @@
51 53 $target_index = filter_input( INPUT_GET, 'target_index', FILTER_SANITIZE_FULL_SPECIAL_CHARS );
52 54 $origin_node = isset( $origin_node ) ? $origin_node : 'none';
53 55 $target_node = ! empty( $target_node ) ? $target_node : 'none';
54 56
55 - wp_verify_nonce( $nonce, 'sellkit' );
57 + if ( ! wp_verify_nonce( $nonce, 'sellkit' ) ) {
58 + wp_send_json_error( __( 'Invalid nonce.', 'sellkit' ) );
59 + }
56 60
57 61 $data = $this->step_importer->import_from_api( $step_id );
58 62
59 63 if ( empty( $data ) || is_wp_error( $data ) ) {
@@ -66,9 +70,9 @@
66 70 $this->step_importer->run();
67 71
68 72 sleep( 3 );
69 73
70 - wp_send_json_success( esc_html__( 'The data has been imported successfully.' ) );
74 + wp_send_json_success( esc_html__( 'The data has been imported successfully.', 'sellkit' ) );
71 75 }
72 76
73 77 /**
74 78 * Gets steps.
@@ -75,12 +79,16 @@
75 79 *
76 80 * @since 1.1.0
77 81 */
78 82 public function get_steps() {
83 + check_ajax_referer( 'sellkit', 'nonce' );
84 +
79 85 $nonce = sellkit_htmlspecialchars( INPUT_GET, 'nonce' );
80 86 $type = sellkit_htmlspecialchars( INPUT_GET, 'type' );
81 87
82 - wp_verify_nonce( $nonce, 'sellkit' );
88 + if ( ! wp_verify_nonce( $nonce, 'sellkit' ) ) {
89 + wp_send_json_error( __( 'Invalid nonce.', 'sellkit' ) );
90 + }
83 91
84 92 $response = wp_remote_get( "https://templates.getsellkit.com/wp-json/sellkit/v1/steps/type={$type}", [
85 93 'timeout' => 10,
86 94 ] );
@@ -99,11 +107,15 @@
99 107 *
100 108 * @since 1.1.0
101 109 */
102 110 public function get_funnels() {
111 + check_ajax_referer( 'sellkit', 'nonce' );
112 +
103 113 $nonce = sellkit_htmlspecialchars( INPUT_GET, 'nonce' );
104 114
105 - wp_verify_nonce( $nonce, 'sellkit' );
115 + if ( ! wp_verify_nonce( $nonce, 'sellkit' ) ) {
116 + wp_send_json_error( __( 'Invalid nonce.', 'sellkit' ) );
117 + }
106 118
107 119 $response = wp_remote_get( 'https://templates.getsellkit.com/wp-json/sellkit/v1/funnels', [
108 120 'timeout' => 10,
109 121 ] );
@@ -122,12 +134,16 @@
122 134 *
123 135 * @since 1.1.0
124 136 */
125 137 public function get_funnel_data() {
138 + check_ajax_referer( 'sellkit', 'nonce' );
139 +
126 140 $nonce = sellkit_htmlspecialchars( INPUT_GET, 'nonce' );
127 141 $funnel_id = sellkit_htmlspecialchars( INPUT_GET, 'funnel_id' );
128 142
129 - wp_verify_nonce( $nonce, 'sellkit' );
143 + if ( ! wp_verify_nonce( $nonce, 'sellkit' ) ) {
144 + wp_send_json_error( __( 'Invalid nonce.', 'sellkit' ) );
145 + }
130 146
131 147 $funnel_data = $this->import_funnel_data_from_api( $funnel_id );
132 148
133 149 if ( ! empty( $funnel_data ) ) {
@@ -142,13 +158,17 @@
142 158 *
143 159 * @since 1.1.0
144 160 */
145 161 public function import_funnel() {
162 + check_ajax_referer( 'sellkit', 'nonce' );
163 +
146 164 $nonce = sellkit_htmlspecialchars( INPUT_GET, 'nonce' );
147 165 $funnel_id = sellkit_htmlspecialchars( INPUT_GET, 'funnel_id' );
148 166 $page = sellkit_htmlspecialchars( INPUT_GET, 'page' );
149 167
150 - wp_verify_nonce( $nonce, 'sellkit' );
168 + if ( ! wp_verify_nonce( $nonce, 'sellkit' ) ) {
169 + wp_send_json_error( __( 'Invalid nonce.', 'sellkit' ) );
170 + }
151 171
152 172 if ( 'checkout' === $page && get_post_status( get_option( Checkout::SELLKIT_GLOBAL_CHECKOUT_OPTION, 0 ) ) ) {
153 173 wp_send_json_error( __( 'In order to iport a new global checkout,Please remove previous one.', 'sellkit' ) );
154 174 }
@@ -186,9 +206,9 @@
186 206 $step_id = $step->page_id;
187 207 $data = $steps_data->$step_id;
188 208 }
189 209
190 - if ( false === $steps_data ) {
210 + if ( false === $steps_data && property_exists( $step, 'page_id' ) ) {
191 211 $data = $this->step_importer->import_from_api( $step->page_id );
192 212 }
193 213
194 214 if ( is_wp_error( $data ) ) {
@@ -209,9 +229,9 @@
209 229 if ( ! empty( $step->bump[0]->data->products->list ) ) {
210 230 unset( $step->bump[0]->data->products->list );
211 231 }
212 232
213 - $new_step_data[ $key ] = (array) $step;
233 + $new_step_data[ $key ] = json_decode( wp_json_encode( $step ), true );
214 234 }
215 235
216 236 if ( false === $steps_data ) {
217 237 update_post_meta( $new_funnel_id, 'sellkit_steps', $new_step_data );