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 +13 -18 6.26.16.18 View file →
@@ -4,9 +4,8 @@
4 4 }
5 5
6 6 /**
7 7 * @todo Show opt-in popup after plugin activation.
8 - *
9 8 * @since 3.06.04
10 9 */
11 10 class FrmUsageController {
12 11
@@ -27,9 +26,8 @@
27 26 * @return void
28 27 */
29 28 public static function schedule_send() {
30 29 $timestamp = wp_next_scheduled( 'formidable_send_usage' );
31 -
32 30 if ( ! self::tracking_allowed() ) {
33 31 if ( $timestamp ) {
34 32 // Remove the scheduled event if it's not allowed and it's scheduled.
35 33 wp_unschedule_event( $timestamp, 'formidable_send_usage' );
@@ -41,12 +39,12 @@
41 39 return;
42 40 }
43 41
44 42 $tracking = array(
45 - 'day' => random_int( 0, 6 ) * DAY_IN_SECONDS,
46 - 'hour' => random_int( 0, 23 ) * HOUR_IN_SECONDS,
47 - 'minute' => random_int( 0, 59 ) * MINUTE_IN_SECONDS,
48 - '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 ),
49 47 );
50 48
51 49 $offset = array_sum( $tracking );
52 50 $init_send = strtotime( 'next sunday' ) + $offset;
@@ -57,12 +55,8 @@
57 55 /**
58 56 * Adds once weekly to the existing schedules.
59 57 *
60 58 * @since 3.06.04
61 - *
62 - * @param array $schedules Schedules.
63 - *
64 - * @return array
65 59 */
66 60 public static function add_schedules( $schedules = array() ) {
67 61 $schedules['weekly'] = array(
68 62 'interval' => DAY_IN_SECONDS * 7,
@@ -96,13 +90,11 @@
96 90 /**
97 91 * Loads scripts.
98 92 *
99 93 * @since 6.16.1
100 - *
101 - * @return void
102 94 */
103 95 public static function load_scripts() {
104 - 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' ) ) {
105 97 wp_enqueue_script( 'frm-usage-tracking', FrmAppHelper::plugin_url() . '/js/admin/usage-tracking.js', array( 'formidable_dom' ), FrmAppHelper::$plug_version, true );
106 98 }
107 99 }
108 100
@@ -113,15 +105,20 @@
113 105 *
114 106 * @return bool
115 107 */
116 108 private static function is_forms_list_page() {
117 - if ( ! FrmAppHelper::on_form_listing_page() ) {
109 + if ( ! FrmAppHelper::is_admin_page() ) {
118 110 return false;
119 111 }
120 112
121 - // Exclude Trash page.
113 + // Check Trash page.
122 114 $form_type = FrmAppHelper::simple_get( 'form_type' );
123 - return $form_type && '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' );
124 121 }
125 122
126 123 /**
127 124 * AJAX handler to track flows.
@@ -126,10 +123,8 @@
126 123 /**
127 124 * AJAX handler to track flows.
128 125 *
129 126 * @since 6.16.1
130 - *
131 - * @return void
132 127 */
133 128 public static function ajax_track_flows() {
134 129 FrmAppHelper::permission_check( 'frm_view_forms' );
135 130 check_ajax_referer( 'frm_ajax', 'nonce' );