| @@ -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 | |
| @@ -126,10 +118,8 @@ | ||
| 126 | 118 | /** |
| 127 | 119 | * AJAX handler to track flows. |
| 128 | 120 | * |
| 129 | 121 | * @since 6.16.1 |
| 130 | - * | |
| 131 | - * @return void | |
| 132 | 122 | */ |
| 133 | 123 | public static function ajax_track_flows() { |
| 134 | 124 | FrmAppHelper::permission_check( 'frm_view_forms' ); |
| 135 | 125 | check_ajax_referer( 'frm_ajax', 'nonce' ); |