| @@ -3,10 +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 | - * | |
| 9 | 7 | * @since 3.06.04 |
| 10 | 8 | */ |
| 11 | 9 | class FrmUsageController { |
| 12 | 10 | |
| @@ -33,8 +31,9 @@ | ||
| 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' ); |
| 36 | 34 | } |
| 35 | + | |
| 37 | 36 | return; |
| 38 | 37 | } |
| 39 | 38 | |
| 40 | 39 | if ( $timestamp ) { |
| @@ -56,19 +55,21 @@ | ||
| 56 | 55 | |
| 57 | 56 | /** |
| 58 | 57 | * Adds once weekly to the existing schedules. |
| 59 | 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 | + * | |
| 60 | 63 | * @since 3.06.04 |
| 64 | + * @deprecated 6.35 | |
| 61 | 65 | * |
| 62 | - * @param array $schedules Schedules. | |
| 66 | + * @param array $schedules Unused. The registered cron schedules, keyed by schedule name. | |
| 63 | 67 | * |
| 64 | 68 | * @return array |
| 65 | 69 | */ |
| 66 | 70 | public static function add_schedules( $schedules = array() ) { |
| 67 | - $schedules['weekly'] = array( | |
| 68 | - 'interval' => DAY_IN_SECONDS * 7, | |
| 69 | - 'display' => __( 'Once Weekly', 'formidable' ), | |
| 70 | - ); | |
| 71 | + _deprecated_function( __METHOD__, '6.35' ); | |
| 71 | 72 | return $schedules; |
| 72 | 73 | } |
| 73 | 74 | |
| 74 | 75 | /** |
| @@ -78,10 +79,9 @@ | ||
| 78 | 79 | * |
| 79 | 80 | * @return bool |
| 80 | 81 | */ |
| 81 | 82 | public static function tracking_allowed() { |
| 82 | - $settings = FrmAppHelper::get_settings(); | |
| 83 | - return $settings->tracking; | |
| 83 | + return (bool) FrmAppHelper::get_settings()->tracking; | |
| 84 | 84 | } |
| 85 | 85 | |
| 86 | 86 | /** |
| 87 | 87 | * @since 3.06.04 |
| @@ -119,9 +119,9 @@ | ||
| 119 | 119 | } |
| 120 | 120 | |
| 121 | 121 | // Exclude Trash page. |
| 122 | 122 | $form_type = FrmAppHelper::simple_get( 'form_type' ); |
| 123 | - return $form_type && 'published' === $form_type; | |
| 123 | + return 'published' === $form_type; | |
| 124 | 124 | } |
| 125 | 125 | |
| 126 | 126 | /** |
| 127 | 127 | * AJAX handler to track flows. |
| @@ -142,9 +142,9 @@ | ||
| 142 | 142 | wp_send_json_success(); |
| 143 | 143 | } |
| 144 | 144 | |
| 145 | 145 | /** |
| 146 | - * Updates flows data. | |
| 146 | + * Updates flows data. This increases the count of flow_data[ $key ][ $value ]. | |
| 147 | 147 | * |
| 148 | 148 | * @since 6.16.1 |
| 149 | 149 | * |
| 150 | 150 | * @param string $key Flow key. |
| @@ -152,13 +152,13 @@ | ||
| 152 | 152 | * |
| 153 | 153 | * @return void |
| 154 | 154 | */ |
| 155 | 155 | public static function update_flows_data( $key, $value ) { |
| 156 | - $flows_data = self::get_flows_data(); | |
| 157 | - | |
| 158 | 156 | if ( '' === $key || '' === $value ) { |
| 159 | 157 | return; |
| 160 | 158 | } |
| 159 | + | |
| 160 | + $flows_data = self::get_flows_data(); | |
| 161 | 161 | |
| 162 | 162 | if ( ! isset( $flows_data[ $key ] ) ) { |
| 163 | 163 | $flows_data[ $key ] = array(); |
| 164 | 164 | } |