PluginProbe
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More / 6.14
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More v6.14
6.35 6.34 6.33.1 6.33 6.32.1 6.32 6.31 6.25 6.25.1 6.26 6.26.1 6.27 6.28 6.29 6.3 6.3.1 6.3.2 6.30 6.4 6.4.1 6.4.2 6.5 6.5.1 6.5.2 6.5.3 All 141 releases
← All changes | classes/models/FrmUsage.php +13 -144 6.266.14 View file →
@@ -17,9 +17,9 @@
17 17 if ( ! $this->tracking_allowed() ) {
18 18 return;
19 19 }
20 20
21 - $ep = 'aHR0cHM6Ly91c2FnZTIuZm9ybWlkYWJsZWZvcm1zLmNvbS9zbmFwc2hvdA==';
21 + $ep = 'aHR0cHM6Ly91c2FnZS5mb3JtaWRhYmxlZm9ybXMuY29tL2FwcC9zbmFwc2hvdAo=';
22 22 // $ep = base64_encode( 'http://localhost:4567/snapshot' ); // Uncomment for testing
23 23 $body = json_encode( $this->snapshot() );
24 24
25 25 // Setup variable for wp_remote_request.
@@ -30,25 +30,15 @@
30 30 'Content-Type' => 'application/json',
31 31 'Content-Length' => strlen( $body ),
32 32 ),
33 33 'body' => $body,
34 - // Without this, Debug Log catches the `http_request_failed` error.
35 - 'timeout' => 45,
36 34 );
37 35
38 - // Remove time limit to execute this function.
39 - if ( function_exists( 'set_time_limit' ) ) {
40 - set_time_limit( 0 );
41 - }
42 -
43 36 wp_remote_request( base64_decode( $ep ), $post );
44 37 }
45 38
46 39 /**
47 40 * @since 3.06.04
48 - *
49 - * @param bool $regenerate
50 - *
51 41 * @return string
52 42 */
53 43 public function uuid( $regenerate = false ) {
54 44 $uuid_key = 'frm-usage-uuid';
@@ -65,9 +55,8 @@
65 55 }
66 56
67 57 /**
68 58 * @since 3.06.04
69 - *
70 59 * @return array
71 60 */
72 61 public function snapshot() {
73 62 global $wpdb, $wp_version;
@@ -98,91 +87,16 @@
98 87 'forms' => $this->forms(),
99 88 'fields' => $this->fields(),
100 89 'actions' => $this->actions(),
101 90
102 - 'onboarding-wizard' => $this->onboarding_wizard(),
103 - 'welcome-tour' => FrmWelcomeTourController::get_usage_data(),
104 - 'flows' => FrmUsageController::get_flows_data(),
105 - 'payments' => $this->payments(),
106 - 'subscriptions' => $this->payments( 'frm_subscriptions' ),
91 + 'onboarding-wizard' => FrmOnboardingWizardController::get_usage_data(),
107 92 );
108 93
109 - if ( method_exists( 'FrmProAddonsController', 'get_readable_license_type' ) ) {
110 - $snap['active_license'] = FrmProAddonsController::get_readable_license_type();
111 - }
112 -
113 94 return apply_filters( 'frm_usage_snapshot', $snap );
114 95 }
115 96
116 97 /**
117 - * Gets onboarding wizard data.
118 - *
119 - * @since 6.16.1
120 - *
121 - * @return array
122 - */
123 - private function onboarding_wizard() {
124 - $data = FrmOnboardingWizardController::get_usage_data();
125 - $skipped_keys = array(
126 - 'default_email',
127 - 'is_subscribed',
128 - 'allows_tracking',
129 - 'summary_emails',
130 - 'installed_addons',
131 - );
132 -
133 - foreach ( $skipped_keys as $skipped_key ) {
134 - unset( $data[ $skipped_key ] );
135 - }
136 -
137 - return $data;
138 - }
139 -
140 - /**
141 - * Gets payments data.
142 - *
143 - * @since 6.16.1
144 - *
145 - * @param string $table Database table name.
146 - *
147 - * @return array
148 - */
149 - private function payments( $table = 'frm_payments' ) {
150 - $allowed_tables = array( 'frm_payments', 'frm_subscriptions' );
151 -
152 - if ( ! in_array( $table, $allowed_tables, true ) ) {
153 - return array();
154 - }
155 -
156 - if ( ! FrmTransLiteAppHelper::payments_table_exists() ) {
157 - return array();
158 - }
159 -
160 - global $wpdb;
161 - $rows = $wpdb->get_results(
162 - $wpdb->prepare(
163 - 'SELECT amount, status, paysys, created_at FROM %1$s',
164 - $wpdb->prefix . $table
165 - )
166 - );
167 -
168 - $payments = array();
169 -
170 - foreach ( $rows as $row ) {
171 - $payments[] = array(
172 - 'amount' => (float) $row->amount,
173 - 'status' => $row->status,
174 - 'gateway' => $row->paysys,
175 - 'created_at' => $row->created_at,
176 - );
177 - }
178 -
179 - return $payments;
180 - }
181 -
182 - /**
183 98 * @since 3.06.04
184 - *
185 99 * @return array
186 100 */
187 101 private function plugins() {
188 102 $plugin_list = FrmAppHelper::get_plugins();
@@ -187,9 +101,8 @@
187 101 private function plugins() {
188 102 $plugin_list = FrmAppHelper::get_plugins();
189 103
190 104 $plugins = array();
191 -
192 105 foreach ( $plugin_list as $slug => $info ) {
193 106 $plugins[] = array(
194 107 'name' => $info['Name'],
195 108 'slug' => $slug,
@@ -204,9 +117,8 @@
204 117 /**
205 118 * Add global settings to tracking data.
206 119 *
207 120 * @since 3.06.04
208 - *
209 121 * @return array
210 122 */
211 123 private function settings() {
212 124 $settings_list = FrmAppHelper::get_settings();
@@ -215,9 +127,11 @@
215 127 'permissions' => $this->permissions( $settings_list ),
216 128 );
217 129 $pass_settings = array(
218 130 'load_style',
131 + 'use_html',
219 132 'fade_form',
133 + 'jquery_css',
220 134 're_type',
221 135 're_lang',
222 136 're_multi',
223 137 'menu',
@@ -222,20 +136,11 @@
222 136 're_multi',
223 137 'menu',
224 138 'mu_menu',
225 139 'no_ips',
226 - 'custom_header_ip',
227 - 'enable_gdpr',
228 - 'no_gdpr_cookies',
229 140 'btsp_css',
230 - 'btsp_version',
141 + 'btsp_errors',
231 142 'admin_bar',
232 - 'summary_emails',
233 - 'active_captcha',
234 - 'honeypot',
235 - 'wp_spam_check',
236 - 'denylist_check',
237 - 'email_style',
238 143 );
239 144
240 145 foreach ( $pass_settings as $setting ) {
241 146 if ( isset( $settings_list->$setting ) ) {
@@ -256,9 +161,8 @@
256 161 *
257 162 * @since 3.06.04
258 163 *
259 164 * @param FrmSettings $settings_list
260 - *
261 165 * @return array
262 166 */
263 167 private function messages( $settings_list ) {
264 168 $messages = array(
@@ -271,14 +175,11 @@
271 175 'login_msg',
272 176 'admin_permission',
273 177 );
274 178
275 - $default = $settings_list->default_options();
276 -
277 179 $message_settings = array();
278 -
279 180 foreach ( $messages as $message ) {
280 - $message_settings[ 'changed-' . $message ] = $settings_list->$message === $default[ $message ] ? 0 : 1;
181 + $message_settings[ $message ] = $settings_list->$message;
281 182 }
282 183
283 184 return $message_settings;
284 185 }
@@ -288,9 +189,8 @@
288 189 *
289 190 * @since 3.06.04
290 191 *
291 192 * @param FrmSettings $settings_list
292 - *
293 193 * @return array
294 194 */
295 195 private function permissions( $settings_list ) {
296 196 $permissions = array();
@@ -306,9 +206,8 @@
306 206 }
307 207
308 208 /**
309 209 * @since 3.06.04
310 - *
311 210 * @return array
312 211 */
313 212 private function forms() {
314 213 $s_query = array(
@@ -323,10 +222,10 @@
323 222 $forms = array();
324 223 $settings = array(
325 224 'form_class',
326 225 'akismet',
226 + 'honeypot',
327 227 'antispam',
328 - 'stopforumspam',
329 228 'custom_style',
330 229 'success_action',
331 230 'show_form',
332 231 'no_save',
@@ -355,10 +254,8 @@
355 254 'prev_value',
356 255 'submit_conditions',
357 256 );
358 257
359 - $style = new FrmStyle();
360 -
361 258 foreach ( $saved_forms as $form ) {
362 259 $new_form = array(
363 260 'form_id' => $form->id,
364 261 'description' => $form->description,
@@ -371,29 +268,14 @@
371 268 );
372 269
373 270 foreach ( $settings as $setting ) {
374 271 if ( isset( $form->options[ $setting ] ) ) {
375 - if ( 'custom_style' === $setting ) {
376 - $style->id = $form->options[ $setting ];
377 -
378 - if ( ! $style->id ) {
379 - $style_name = 0;
380 - } elseif ( 1 === intval( $style->id ) ) {
381 - $style_name = 'formidable-style';
382 - } else {
383 - $style_post = $style->get_one();
384 - $style_name = $style_post ? $style_post->post_name : 'formidable-style';
385 - }
386 -
387 - $new_form[ $setting ] = $style_name;
388 - } else {
389 - $new_form[ $setting ] = $this->maybe_json( $form->options[ $setting ] );
390 - }
272 + $new_form[ $setting ] = $this->maybe_json( $form->options[ $setting ] );
391 273 }
392 274 }
393 275
394 276 $forms[] = apply_filters( 'frm_usage_form', $new_form, compact( 'form' ) );
395 - }//end foreach
277 + }
396 278
397 279 // If the array uses numeric keys, reset them.
398 280 return $forms;
399 281 }
@@ -399,17 +281,14 @@
399 281 }
400 282
401 283 /**
402 284 * @since 3.06.04
403 - *
404 - * @param int|string $form_id Form ID.
405 - *
406 285 * @return int
407 286 */
408 287 private function form_field_count( $form_id ) {
409 288 global $wpdb;
410 289
411 - $join = $wpdb->prefix . 'frm_fields fi JOIN ' . $wpdb->prefix . 'frm_forms fo ON (fi.form_id=fo.id)';
290 + $join = $wpdb->prefix . 'frm_fields fi LEFT OUTER JOIN ' . $wpdb->prefix . 'frm_forms fo ON (fi.form_id=fo.id)';
412 291
413 292 $field_query = array(
414 293 'or' => 1,
415 294 'fi.form_id' => $form_id,
@@ -420,11 +299,8 @@
420 299 }
421 300
422 301 /**
423 302 * @since 3.06.04
424 - *
425 - * @param int|string $form_id Form ID.
426 - *
427 303 * @return int
428 304 */
429 305 private function form_action_count( $form_id ) {
430 306 $args = array(
@@ -440,9 +316,8 @@
440 316 /**
441 317 * Get the last 100 fields created.
442 318 *
443 319 * @since 3.06.04
444 - *
445 320 * @return array
446 321 */
447 322 private function fields() {
448 323 $args = array(
@@ -449,10 +324,9 @@
449 324 'limit' => 50,
450 325 'order_by' => 'id DESC',
451 326 );
452 327
453 - $fields = FrmDb::get_results( 'frm_fields', array(), 'id, form_id, name, type, field_options', $args );
454 -
328 + $fields = FrmDb::get_results( 'frm_fields', array(), 'form_id, name, type, field_options', $args );
455 329 foreach ( $fields as $k => $field ) {
456 330 FrmAppHelper::unserialize_or_decode( $field->field_options );
457 331 $fields[ $k ]->field_options = json_encode( $field->field_options );
458 332 }
@@ -460,9 +334,8 @@
460 334 }
461 335
462 336 /**
463 337 * @since 3.06.04
464 - *
465 338 * @return array
466 339 */
467 340 private function actions() {
468 341 $args = array(
@@ -472,9 +345,8 @@
472 345
473 346 $actions = array();
474 347
475 348 $saved_actions = FrmDb::check_cache( json_encode( $args ), 'frm_actions', $args, 'get_posts' );
476 -
477 349 foreach ( $saved_actions as $action ) {
478 350 $actions[] = array(
479 351 'form_id' => $action->menu_order,
480 352 'type' => $action->post_excerpt,
@@ -487,20 +359,17 @@
487 359 }
488 360
489 361 /**
490 362 * @since 3.06.04
491 - *
492 363 * @return bool
493 364 */
494 365 private function tracking_allowed() {
495 - return FrmUsageController::tracking_allowed();
366 + $settings = FrmAppHelper::get_settings();
367 + return $settings->tracking;
496 368 }
497 369
498 370 /**
499 371 * @since 3.06.04
500 - *
501 - * @param mixed $value Value.
502 - *
503 372 * @return string
504 373 */
505 374 private function maybe_json( $value ) {
506 375 return is_array( $value ) ? json_encode( $value ) : $value;