PluginProbe
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More / 6.18
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More v6.18
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 +16 -20 6.276.18 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
@@ -112,15 +105,20 @@
112 105 *
113 106 * @return bool
114 107 */
115 108 private static function is_forms_list_page() {
116 - if ( ! FrmAppHelper::on_form_listing_page() ) {
109 + if ( ! FrmAppHelper::is_admin_page() ) {
117 110 return false;
118 111 }
119 112
120 - // Exclude Trash page.
113 + // Check Trash page.
121 114 $form_type = FrmAppHelper::simple_get( 'form_type' );
122 - return 'published' === $form_type;
115 + if ( $form_type && 'published' !== $form_type ) {
116 + return false;
117 + }
118 +
119 + // Check edit or settings page.
120 + return ! FrmAppHelper::simple_get( 'frm_action' );
123 121 }
124 122
125 123 /**
126 124 * AJAX handler to track flows.
@@ -125,10 +123,8 @@
125 123 /**
126 124 * AJAX handler to track flows.
127 125 *
128 126 * @since 6.16.1
129 - *
130 - * @return void
131 127 */
132 128 public static function ajax_track_flows() {
133 129 FrmAppHelper::permission_check( 'frm_view_forms' );
134 130 check_ajax_referer( 'frm_ajax', 'nonce' );
@@ -151,13 +147,13 @@
151 147 *
152 148 * @return void
153 149 */
154 150 public static function update_flows_data( $key, $value ) {
151 + $flows_data = self::get_flows_data();
152 +
155 153 if ( '' === $key || '' === $value ) {
156 154 return;
157 155 }
158 -
159 - $flows_data = self::get_flows_data();
160 156
161 157 if ( ! isset( $flows_data[ $key ] ) ) {
162 158 $flows_data[ $key ] = array();
163 159 }