table_exists() && $charitable_campaign_activities_db->table_exists() ) { $charitable_db_tables_installed = true; $charitable_reports = Charitable_Reports::get_instance(); // Check the transients via charitable_report_overview_args. $charitable_report_data_args = false; // get_transient( 'charitable-report-activity-args' ); if ( false !== $charitable_report_data_args ) { $charitable_start_date = ( false === $charitable_start_date && ! empty( $charitable_report_data_args['start_date'] ) ) ? $charitable_reports->get_valid_date_string( $charitable_report_data_args['start_date'] ) : false; $charitable_end_date = ( false === $charitable_end_date && ! empty( $charitable_report_data_args['end_date'] ) ) ? $charitable_reports->get_valid_date_string( $charitable_report_data_args['end_date'] ) : false; $charitable_campaign_id = ( false === $charitable_campaign_id && ! empty( $charitable_report_data_args['campaign_id'] ) ) ? intval( $charitable_report_data_args['campaign_id'] ) : false; $charitable_activity_type = ( false === $charitable_activity_type && ! empty( $charitable_report_data_args['activity_type'] ) ) ? esc_attr( $charitable_report_data_args['activity_type'] ) : false; } if ( false === $charitable_start_date || false === $charitable_end_date || false === $charitable_campaign_id ) { // so nothing from the transient, so check the $_GET. $charitable_start_date = isset( $_GET['start_date'] ) ? $charitable_reports->get_valid_date_string( sanitize_text_field( $_GET['start_date'] ) ) : false; // phpcs:ignore $charitable_end_date = isset( $_GET['end_date'] ) ? $charitable_reports->get_valid_date_string( sanitize_text_field( $_GET['end_date'] ) ) : false; // phpcs:ignore $charitable_campaign_id = isset( $_GET['campaign_id'] ) ? intval( $_GET['campaign_id'] ) : false; // phpcs:ignore $charitable_activity_type = isset( $_GET['activity_type'] ) ? esc_attr( $_GET['activity_type'] ) : false; // phpcs:ignore } if ( false === $charitable_start_date || false === $charitable_end_date || false === $charitable_campaign_id ) { // If still nothing assign defaults. /* * Site-local, not UTC: this feeds Charitable_Reports::get_data(), which * filters on p.post_date (site-local time), so a bound built from bare * UTC excludes part of today's activity on any site whose timezone is * ahead of UTC. * * @since 1.8.13 */ $charitable_report_overview_defaults = apply_filters( 'charitable_report_activity_defaults', array( 'start_date' => gmdate( 'Y/m/d', current_time( 'timestamp', 0 ) - ( 7 * DAY_IN_SECONDS ) ), 'end_date' => gmdate( 'Y/m/d', current_time( 'timestamp', 0 ) ), 'campaign_id' => -1, 'activity_type' => '', 'limit' => false, ) ); $charitable_start_date = $charitable_report_overview_defaults['start_date']; $charitable_end_date = $charitable_report_overview_defaults['end_date']; $charitable_campaign_id = $charitable_report_overview_defaults['campaign_id']; $charitable_activity_type = $charitable_report_overview_defaults['activity_type']; } $charitable_args = array( 'start_date' => $charitable_start_date, 'end_date' => $charitable_end_date, 'campaign_id' => $charitable_campaign_id, ); $charitable_reports->init_with_array( 'activity', $charitable_args ); // activity (filter and action) types. // Activity types is a filter from the dropdown on the activity page. // Empty means no filter. Example: 'campaigns-created'. // $activity_filter_types = array( 'campaigns-created' );. $charitable_activity_filter_types = array(); // Activity action types are actions found in the database for filtering. // For example this is filtering for donation and campaign activities... // $activity_action_types = array( // 'donation' => array( 'charitable-completed' ), // 'campaign' => array( 'charitable-campaign-created', 'charitable-campaign-ended', 'charitable-campaign-goal-reached' ), // );. $charitable_activity_action_types = array(); // cammpaigns. $charitable_campaign_args = false; $charitable_available_campaigns = Charitable_Campaigns::get_campaign_title_id( $charitable_campaign_args ); $charitable_campaign_dropdown = array(); if ( ! empty( $charitable_available_campaigns ) ) : $charitable_campaign_dropdown = wp_list_pluck( $charitable_available_campaigns, 'title', 'id' ); // sort by title (array value) alphabetically. asort( $charitable_campaign_dropdown ); endif; $charitable_activity_args = array( 'campaign_id' => $charitable_campaign_id, 'activity_filter_types' => $charitable_activity_filter_types, 'activity_action_types' => $charitable_activity_action_types, ); $charitable_report_activity = $charitable_reports->get_activity( $charitable_activity_args ); } if ( $charitable_db_tables_installed ) : ?>
get_activity_report_filter_dropdown( $charitable_activity_filter_types ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>

:


generate_activity_list( $charitable_report_activity ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>