Helpers
11 months ago
Integrations
2 weeks ago
RestApi
4 days ago
abilities
3 weeks ago
abstracts
4 days ago
admin
4 days ago
blocks
1 year ago
elementor
2 years ago
export
2 months ago
fields
3 weeks ago
interfaces
8 years ago
libraries
2 years ago
log-handlers
1 year ago
shortcodes
3 weeks ago
stats
5 months ago
templates
3 months ago
traits
3 weeks ago
class-everest-forms.php
4 days ago
class-evf-addon-upsell.php
3 weeks ago
class-evf-ajax.php
3 weeks ago
class-evf-autoloader.php
7 years ago
class-evf-background-process-import-entries.php
2 years ago
class-evf-background-updater.php
7 years ago
class-evf-cache-helper.php
2 months ago
class-evf-cron.php
2 years ago
class-evf-deprecated-action-hooks.php
6 years ago
class-evf-deprecated-filter-hooks.php
5 years ago
class-evf-email-entries-report.php
3 months ago
class-evf-emails.php
3 weeks ago
class-evf-fields.php
3 weeks ago
class-evf-form-handler.php
3 weeks ago
class-evf-form-task.php
3 weeks ago
class-evf-forms-features.php
3 weeks ago
class-evf-frontend-scripts.php
3 weeks ago
class-evf-install.php
2 months ago
class-evf-integrations.php
3 months ago
class-evf-log-levels.php
8 years ago
class-evf-logger.php
5 years ago
class-evf-post-types.php
1 year ago
class-evf-privacy.php
6 years ago
class-evf-report-cron.php
2 months ago
class-evf-reporting.php
2 months ago
class-evf-session-handler.php
7 years ago
class-evf-shortcodes.php
1 year ago
class-evf-smart-tags.php
9 months ago
class-evf-template-loader.php
1 year ago
class-evf-validation.php
6 years ago
evf-conditional-functions.php
6 years ago
evf-core-functions.php
3 weeks ago
evf-deprecated-functions.php
6 years ago
evf-entry-functions.php
4 months ago
evf-formatting-functions.php
4 years ago
evf-notice-functions.php
4 years ago
evf-template-functions.php
4 years ago
evf-template-hooks.php
7 years ago
evf-update-functions.php
5 years ago
class-evf-reporting.php
67 lines
| 1 | <?php |
| 2 | /** |
| 3 | * EVF Reporting |
| 4 | * |
| 5 | * Orchestrates hooks, unsubscribe handling, and delegates |
| 6 | * all schedule/send work to EVF_Report_Cron. |
| 7 | * |
| 8 | * @package EverestForms\Classes |
| 9 | * @since 2.0.9 |
| 10 | */ |
| 11 | |
| 12 | defined( 'ABSPATH' ) || exit; |
| 13 | |
| 14 | /** |
| 15 | * EVF_Reporting Class. |
| 16 | */ |
| 17 | class EVF_Reporting { |
| 18 | |
| 19 | /** |
| 20 | * @var EVF_Report_Cron |
| 21 | */ |
| 22 | private $cron; |
| 23 | |
| 24 | /** |
| 25 | * Constructor. |
| 26 | * |
| 27 | * @since 2.0.9 |
| 28 | */ |
| 29 | public function __construct() { |
| 30 | $this->cron = new EVF_Report_Cron(); |
| 31 | |
| 32 | add_action( EVF_Report_Cron::HOOK, array( $this, 'run_scheduled_send' ) ); |
| 33 | add_action( 'init', array( $this, 'maybe_schedule' ), 99 ); |
| 34 | } |
| 35 | |
| 36 | /** |
| 37 | * Ensure a schedule exists when reporting is enabled. |
| 38 | * |
| 39 | * @since 2.0.9 |
| 40 | */ |
| 41 | public function maybe_schedule() { |
| 42 | if ( 'yes' !== get_option( 'everest_forms_enable_entries_reporting', 'no' ) ) { |
| 43 | return; |
| 44 | } |
| 45 | |
| 46 | $this->cron->evf_schedule_add(); |
| 47 | } |
| 48 | |
| 49 | /** |
| 50 | * Clear and reschedule. Called explicitly from EVF_Settings_Advanced::save(). |
| 51 | * |
| 52 | * @since 2.0.9 |
| 53 | */ |
| 54 | public function reschedule() { |
| 55 | $this->cron->evf_reschedule(); |
| 56 | } |
| 57 | |
| 58 | /** |
| 59 | * Execute the scheduled send. |
| 60 | * |
| 61 | * @since 2.0.9 |
| 62 | */ |
| 63 | public function run_scheduled_send() { |
| 64 | $this->cron->evf_report_form_statistics_send( false ); |
| 65 | } |
| 66 | } |
| 67 |