PluginProbe
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More / 6.22.2
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More v6.22.2
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/controllers/FrmUsageController.php +9 -18 6.276.22.2 View file →
@@ -3,8 +3,9 @@
3 3 die( 'You are not allowed to call this page directly.' );
4 4 }
5 5
6 6 /**
7 + * @todo Show opt-in popup after plugin activation.
7 8 * @since 3.06.04
8 9 */
9 10 class FrmUsageController {
10 11
@@ -25,15 +26,13 @@
25 26 * @return void
26 27 */
27 28 public static function schedule_send() {
28 29 $timestamp = wp_next_scheduled( 'formidable_send_usage' );
29 -
30 30 if ( ! self::tracking_allowed() ) {
31 31 if ( $timestamp ) {
32 32 // Remove the scheduled event if it's not allowed and it's scheduled.
33 33 wp_unschedule_event( $timestamp, 'formidable_send_usage' );
34 34 }
35 -
36 35 return;
37 36 }
38 37
39 38 if ( $timestamp ) {
@@ -40,12 +39,12 @@
40 39 return;
41 40 }
42 41
43 42 $tracking = array(
44 - 'day' => random_int( 0, 6 ) * DAY_IN_SECONDS,
45 - 'hour' => random_int( 0, 23 ) * HOUR_IN_SECONDS,
46 - 'minute' => random_int( 0, 59 ) * MINUTE_IN_SECONDS,
47 - 'second' => random_int( 0, 59 ),
43 + 'day' => rand( 0, 6 ) * DAY_IN_SECONDS,
44 + 'hour' => rand( 0, 23 ) * HOUR_IN_SECONDS,
45 + 'minute' => rand( 0, 59 ) * MINUTE_IN_SECONDS,
46 + 'second' => rand( 0, 59 ),
48 47 );
49 48
50 49 $offset = array_sum( $tracking );
51 50 $init_send = strtotime( 'next sunday' ) + $offset;
@@ -56,12 +55,8 @@
56 55 /**
57 56 * Adds once weekly to the existing schedules.
58 57 *
59 58 * @since 3.06.04
60 - *
61 - * @param array $schedules Schedules.
62 - *
63 - * @return array
64 59 */
65 60 public static function add_schedules( $schedules = array() ) {
66 61 $schedules['weekly'] = array(
67 62 'interval' => DAY_IN_SECONDS * 7,
@@ -95,13 +90,11 @@
95 90 /**
96 91 * Loads scripts.
97 92 *
98 93 * @since 6.16.1
99 - *
100 - * @return void
101 94 */
102 95 public static function load_scripts() {
103 - if ( self::is_forms_list_page() || FrmAppHelper::is_admin_page( 'formidable-form-templates' ) || FrmAppHelper::is_admin_page() ) {
96 + if ( self::is_forms_list_page() || FrmAppHelper::is_admin_page( 'formidable-form-templates' ) ) {
104 97 wp_enqueue_script( 'frm-usage-tracking', FrmAppHelper::plugin_url() . '/js/admin/usage-tracking.js', array( 'formidable_dom' ), FrmAppHelper::$plug_version, true );
105 98 }
106 99 }
107 100
@@ -118,9 +111,9 @@
118 111 }
119 112
120 113 // Exclude Trash page.
121 114 $form_type = FrmAppHelper::simple_get( 'form_type' );
122 - return 'published' === $form_type;
115 + return $form_type && 'published' === $form_type;
123 116 }
124 117
125 118 /**
126 119 * AJAX handler to track flows.
@@ -125,10 +118,8 @@
125 118 /**
126 119 * AJAX handler to track flows.
127 120 *
128 121 * @since 6.16.1
129 - *
130 - * @return void
131 122 */
132 123 public static function ajax_track_flows() {
133 124 FrmAppHelper::permission_check( 'frm_view_forms' );
134 125 check_ajax_referer( 'frm_ajax', 'nonce' );
@@ -151,13 +142,13 @@
151 142 *
152 143 * @return void
153 144 */
154 145 public static function update_flows_data( $key, $value ) {
146 + $flows_data = self::get_flows_data();
147 +
155 148 if ( '' === $key || '' === $value ) {
156 149 return;
157 150 }
158 -
159 - $flows_data = self::get_flows_data();
160 151
161 152 if ( ! isset( $flows_data[ $key ] ) ) {
162 153 $flows_data[ $key ] = array();
163 154 }