PluginProbe
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More / 6.15
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More v6.15
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
formidable / classes / controllers / FrmUsageController.php

FrmUsageController.php in Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More 6.15, at classes/controllers/FrmUsageController.php

60 lines 1.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 if ( ! defined( 'ABSPATH' ) ) {
3 die( 'You are not allowed to call this page directly.' );
4 }
5
6 /**
7 * @todo Show opt-in popup after plugin activation.
8 * @since 3.06.04
9 */
10 class FrmUsageController {
11
12 /**
13 * Randomize the first send to prevent our servers from crashing.
14 *
15 * @since 3.06.04
16 *
17 * @return void
18 */
19 public static function schedule_send() {
20 if ( wp_next_scheduled( 'formidable_send_usage' ) ) {
21 return;
22 }
23
24 $tracking = array(
25 'day' => rand( 0, 6 ) * DAY_IN_SECONDS,
26 'hour' => rand( 0, 23 ) * HOUR_IN_SECONDS,
27 'minute' => rand( 0, 59 ) * MINUTE_IN_SECONDS,
28 'second' => rand( 0, 59 ),
29 );
30
31 $offset = array_sum( $tracking );
32 $init_send = strtotime( 'next sunday' ) + $offset;
33
34 wp_schedule_event( $init_send, 'weekly', 'formidable_send_usage' );
35 }
36
37 /**
38 * Adds once weekly to the existing schedules.
39 *
40 * @since 3.06.04
41 */
42 public static function add_schedules( $schedules = array() ) {
43 $schedules['weekly'] = array(
44 'interval' => DAY_IN_SECONDS * 7,
45 'display' => __( 'Once Weekly', 'formidable' ),
46 );
47 return $schedules;
48 }
49
50 /**
51 * @since 3.06.04
52 *
53 * @return void
54 */
55 public static function send_snapshot() {
56 $usage = new FrmUsage();
57 $usage->send_snapshot();
58 }
59 }
60