PluginProbe
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More / 6.23
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More v6.23
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 +6 -35 6.276.23 View file →
@@ -44,11 +44,8 @@
44 44 }
45 45
46 46 /**
47 47 * @since 3.06.04
48 - *
49 - * @param bool $regenerate
50 - *
51 48 * @return string
52 49 */
53 50 public function uuid( $regenerate = false ) {
54 51 $uuid_key = 'frm-usage-uuid';
@@ -53,9 +50,9 @@
53 50 public function uuid( $regenerate = false ) {
54 51 $uuid_key = 'frm-usage-uuid';
55 52 $uuid = get_option( $uuid_key );
56 53
57 - if ( $regenerate || ! $uuid ) {
54 + if ( $regenerate || empty( $uuid ) ) {
58 55 // Definitely not cryptographically secure but
59 56 // close enough to provide an unique id
60 57 $uuid = md5( uniqid() . site_url() );
61 58 update_option( $uuid_key, $uuid, 'no' );
@@ -65,9 +62,8 @@
65 62 }
66 63
67 64 /**
68 65 * @since 3.06.04
69 - *
70 66 * @return array
71 67 */
72 68 public function snapshot() {
73 69 global $wpdb, $wp_version;
@@ -99,9 +95,8 @@
99 95 'fields' => $this->fields(),
100 96 'actions' => $this->actions(),
101 97
102 98 'onboarding-wizard' => $this->onboarding_wizard(),
103 - 'welcome-tour' => FrmWelcomeTourController::get_usage_data(),
104 99 'flows' => FrmUsageController::get_flows_data(),
105 100 'payments' => $this->payments(),
106 101 'subscriptions' => $this->payments( 'frm_subscriptions' ),
107 102 );
@@ -142,14 +137,12 @@
142 137 *
143 138 * @since 6.16.1
144 139 *
145 140 * @param string $table Database table name.
146 - *
147 141 * @return array
148 142 */
149 143 private function payments( $table = 'frm_payments' ) {
150 144 $allowed_tables = array( 'frm_payments', 'frm_subscriptions' );
151 -
152 145 if ( ! in_array( $table, $allowed_tables, true ) ) {
153 146 return array();
154 147 }
155 148
@@ -165,9 +158,8 @@
165 158 )
166 159 );
167 160
168 161 $payments = array();
169 -
170 162 foreach ( $rows as $row ) {
171 163 $payments[] = array(
172 164 'amount' => (float) $row->amount,
173 165 'status' => $row->status,
@@ -180,15 +172,14 @@
180 172 }
181 173
182 174 /**
183 175 * @since 3.06.04
184 - *
185 176 * @return array
186 177 */
187 178 private function plugins() {
188 179 $plugin_list = FrmAppHelper::get_plugins();
189 - $plugins = array();
190 180
181 + $plugins = array();
191 182 foreach ( $plugin_list as $slug => $info ) {
192 183 $plugins[] = array(
193 184 'name' => $info['Name'],
194 185 'slug' => $slug,
@@ -203,9 +194,8 @@
203 194 /**
204 195 * Add global settings to tracking data.
205 196 *
206 197 * @since 3.06.04
207 - *
208 198 * @return array
209 199 */
210 200 private function settings() {
211 201 $settings_list = FrmAppHelper::get_settings();
@@ -232,9 +222,8 @@
232 222 'active_captcha',
233 223 'honeypot',
234 224 'wp_spam_check',
235 225 'denylist_check',
236 - 'email_style',
237 226 );
238 227
239 228 foreach ( $pass_settings as $setting ) {
240 229 if ( isset( $settings_list->$setting ) ) {
@@ -255,9 +244,8 @@
255 244 *
256 245 * @since 3.06.04
257 246 *
258 247 * @param FrmSettings $settings_list
259 - *
260 248 * @return array
261 249 */
262 250 private function messages( $settings_list ) {
263 251 $messages = array(
@@ -270,11 +258,11 @@
270 258 'login_msg',
271 259 'admin_permission',
272 260 );
273 261
274 - $default = $settings_list->default_options();
262 + $default = $settings_list->default_options();
263 +
275 264 $message_settings = array();
276 -
277 265 foreach ( $messages as $message ) {
278 266 $message_settings[ 'changed-' . $message ] = $settings_list->$message === $default[ $message ] ? 0 : 1;
279 267 }
280 268
@@ -286,9 +274,8 @@
286 274 *
287 275 * @since 3.06.04
288 276 *
289 277 * @param FrmSettings $settings_list
290 - *
291 278 * @return array
292 279 */
293 280 private function permissions( $settings_list ) {
294 281 $permissions = array();
@@ -304,9 +291,8 @@
304 291 }
305 292
306 293 /**
307 294 * @since 3.06.04
308 - *
309 295 * @return array
310 296 */
311 297 private function forms() {
312 298 $s_query = array(
@@ -354,9 +340,8 @@
354 340 'submit_conditions',
355 341 );
356 342
357 343 $style = new FrmStyle();
358 -
359 344 foreach ( $saved_forms as $form ) {
360 345 $new_form = array(
361 346 'form_id' => $form->id,
362 347 'description' => $form->description,
@@ -397,11 +382,8 @@
397 382 }
398 383
399 384 /**
400 385 * @since 3.06.04
401 - *
402 - * @param int|string $form_id Form ID.
403 - *
404 386 * @return int
405 387 */
406 388 private function form_field_count( $form_id ) {
407 389 global $wpdb;
@@ -418,11 +400,8 @@
418 400 }
419 401
420 402 /**
421 403 * @since 3.06.04
422 - *
423 - * @param int|string $form_id Form ID.
424 - *
425 404 * @return int
426 405 */
427 406 private function form_action_count( $form_id ) {
428 407 $args = array(
@@ -438,9 +417,8 @@
438 417 /**
439 418 * Get the last 100 fields created.
440 419 *
441 420 * @since 3.06.04
442 - *
443 421 * @return array
444 422 */
445 423 private function fields() {
446 424 $args = array(
@@ -448,20 +426,17 @@
448 426 'order_by' => 'id DESC',
449 427 );
450 428
451 429 $fields = FrmDb::get_results( 'frm_fields', array(), 'id, form_id, name, type, field_options', $args );
452 -
453 430 foreach ( $fields as $k => $field ) {
454 431 FrmAppHelper::unserialize_or_decode( $field->field_options );
455 432 $fields[ $k ]->field_options = json_encode( $field->field_options );
456 433 }
457 -
458 434 return $fields;
459 435 }
460 436
461 437 /**
462 438 * @since 3.06.04
463 - *
464 439 * @return array
465 440 */
466 441 private function actions() {
467 442 $args = array(
@@ -468,11 +443,11 @@
468 443 'post_type' => FrmFormActionsController::$action_post_type,
469 444 'numberposts' => 100,
470 445 );
471 446
472 - $actions = array();
447 + $actions = array();
448 +
473 449 $saved_actions = FrmDb::check_cache( json_encode( $args ), 'frm_actions', $args, 'get_posts' );
474 -
475 450 foreach ( $saved_actions as $action ) {
476 451 $actions[] = array(
477 452 'form_id' => $action->menu_order,
478 453 'type' => $action->post_excerpt,
@@ -485,9 +460,8 @@
485 460 }
486 461
487 462 /**
488 463 * @since 3.06.04
489 - *
490 464 * @return bool
491 465 */
492 466 private function tracking_allowed() {
493 467 return FrmUsageController::tracking_allowed();
@@ -494,11 +468,8 @@
494 468 }
495 469
496 470 /**
497 471 * @since 3.06.04
498 - *
499 - * @param mixed $value Value.
500 - *
501 472 * @return string
502 473 */
503 474 private function maybe_json( $value ) {
504 475 return is_array( $value ) ? json_encode( $value ) : $value;