PluginProbe
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More / trunk
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More vtrunk
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 +22 -12 6.25 → trunk View file →
@@ -3,9 +3,8 @@
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.
8 7 * @since 3.06.04
9 8 */
10 9 class FrmUsageController {
11 10
@@ -26,13 +25,15 @@
26 25 * @return void
27 26 */
28 27 public static function schedule_send() {
29 28 $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 +
35 36 return;
36 37 }
37 38
38 39 if ( $timestamp ) {
@@ -54,15 +55,21 @@
54 55
55 56 /**
56 57 * Adds once weekly to the existing schedules.
57 58 *
59 + * WordPress core registers an identical 'weekly' schedule of its own, so this adds nothing.
60 + * The 'cron_schedules' registration is gone, and with it the translated label that made
61 + * this run before the text domain loaded.
62 + *
58 63 * @since 3.06.04
64 + * @deprecated 6.35
65 + *
66 + * @param array $schedules Unused. The registered cron schedules, keyed by schedule name.
67 + *
68 + * @return array
59 69 */
60 70 public static function add_schedules( $schedules = array() ) {
61 - $schedules['weekly'] = array(
62 - 'interval' => DAY_IN_SECONDS * 7,
63 - 'display' => __( 'Once Weekly', 'formidable' ),
64 - );
71 + _deprecated_function( __METHOD__, '6.35' );
65 72 return $schedules;
66 73 }
67 74
68 75 /**
@@ -72,10 +79,9 @@
72 79 *
73 80 * @return bool
74 81 */
75 82 public static function tracking_allowed() {
76 - $settings = FrmAppHelper::get_settings();
77 - return $settings->tracking;
83 + return (bool) FrmAppHelper::get_settings()->tracking;
78 84 }
79 85
80 86 /**
81 87 * @since 3.06.04
@@ -90,11 +96,13 @@
90 96 /**
91 97 * Loads scripts.
92 98 *
93 99 * @since 6.16.1
100 + *
101 + * @return void
94 102 */
95 103 public static function load_scripts() {
96 - if ( self::is_forms_list_page() || FrmAppHelper::is_admin_page( 'formidable-form-templates' ) ) {
104 + if ( self::is_forms_list_page() || FrmAppHelper::is_admin_page( 'formidable-form-templates' ) || FrmAppHelper::is_admin_page() ) {
97 105 wp_enqueue_script( 'frm-usage-tracking', FrmAppHelper::plugin_url() . '/js/admin/usage-tracking.js', array( 'formidable_dom' ), FrmAppHelper::$plug_version, true );
98 106 }
99 107 }
100 108
@@ -111,9 +119,9 @@
111 119 }
112 120
113 121 // Exclude Trash page.
114 122 $form_type = FrmAppHelper::simple_get( 'form_type' );
115 - return $form_type && 'published' === $form_type;
123 + return 'published' === $form_type;
116 124 }
117 125
118 126 /**
119 127 * AJAX handler to track flows.
@@ -118,8 +126,10 @@
118 126 /**
119 127 * AJAX handler to track flows.
120 128 *
121 129 * @since 6.16.1
130 + *
131 + * @return void
122 132 */
123 133 public static function ajax_track_flows() {
124 134 FrmAppHelper::permission_check( 'frm_view_forms' );
125 135 check_ajax_referer( 'frm_ajax', 'nonce' );
@@ -132,9 +142,9 @@
132 142 wp_send_json_success();
133 143 }
134 144
135 145 /**
136 - * Updates flows data.
146 + * Updates flows data. This increases the count of flow_data[ $key ][ $value ].
137 147 *
138 148 * @since 6.16.1
139 149 *
140 150 * @param string $key Flow key.
@@ -142,13 +152,13 @@
142 152 *
143 153 * @return void
144 154 */
145 155 public static function update_flows_data( $key, $value ) {
146 - $flows_data = self::get_flows_data();
147 -
148 156 if ( '' === $key || '' === $value ) {
149 157 return;
150 158 }
159 +
160 + $flows_data = self::get_flows_data();
151 161
152 162 if ( ! isset( $flows_data[ $key ] ) ) {
153 163 $flows_data[ $key ] = array();
154 164 }