/var/www/vhosts/ihelp.ro/ajutam.ro/wp-content/plugins/give/includes/admin/reports
Edit: /var/www/vhosts/ihelp.ro/ajutam.ro/wp-content/plugins/give/includes/admin/reports/reports.php (8969B)
esc_html__( 'Revenue', 'give' ),
'forms' => esc_html__( 'Forms', 'give' ),
'gateways' => esc_html__( 'Donation Methods', 'give' ),
];
$views = apply_filters( 'give_report_views', $views );
return $views;
}
/**
* Default Report Views
*
* Checks the $_GET['view'] parameter to ensure it exists within the default allowed views.
*
* @param string $default Default view to use.
*
* @since 1.0
* @return string $view Report View
*/
function give_get_reporting_view( $default = 'earnings' ) {
if ( ! isset( $_GET['view'] ) || ! in_array( $_GET['view'], array_keys( give_reports_default_views() ) ) ) {
$view = $default;
} else {
$view = $_GET['view'];
}
return apply_filters( 'give_get_reporting_view', $view );
}
/**
* Renders the Reports page
*
* @since 1.0
* @return void
*/
function give_reports_tab_reports() {
if ( ! current_user_can( 'view_give_reports' ) ) {
wp_die( __( 'You do not have permission to access this report', 'give' ), __( 'Error', 'give' ), [ 'response' => 403 ] );
}
$current_view = 'earnings';
$views = give_reports_default_views();
if ( isset( $_GET['tab'] ) && array_key_exists( $_GET['tab'], $views ) ) {
$current_view = $_GET['tab'];
}
/**
* Fires the report page view.
*
* @since 1.0
*/
do_action( "give_reports_view_{$current_view}" );
}
add_action( 'give_reports_tab_reports', 'give_reports_tab_reports' );
/**
* Renders the Reports Page Views Drop Downs
*
* @since 1.0
* @return void
*/
function give_report_views() {
$views = give_reports_default_views();
$current_view = isset( $_GET['view'] ) ? $_GET['view'] : 'earnings';
/**
* Fires before the report page actions form.
*
* @since 1.0
*/
do_action( 'give_report_view_actions_before' );
?>
prepare_items();
$give_table->display();
?>
prepare_items();
$give_table->display();
}
add_action( 'give_reports_view_gateways', 'give_reports_gateways_table' );
/**
* Renders the Reports Earnings Graphs
*
* @since 1.0
* @return void
*/
function give_reports_earnings() {
?>
0,
'sales' => 0,
];
$stats = new Give_Payment_Stats();
$to_date_earnings = $stats->get_earnings( 0, 'this_month' );
$to_date_sales = $stats->get_sales( 0, 'this_month' );
$current_day = date( 'd', current_time( 'timestamp' ) );
$current_month = date( 'n', current_time( 'timestamp' ) );
$current_year = date( 'Y', current_time( 'timestamp' ) );
$days_in_month = cal_days_in_month( CAL_GREGORIAN, $current_month, $current_year );
$estimated['earnings'] = ( $to_date_earnings / $current_day ) * $days_in_month;
$estimated['sales'] = ( $to_date_sales / $current_day ) * $days_in_month;
// Cache for one day
Give_Cache::set( 'give_estimated_monthly_stats', $estimated, DAY_IN_SECONDS, true );
}
return maybe_unserialize( $estimated );
}
/**
* Assign Get form method for reporting tabs
*
* @since 1.8.12
*
* @return string
*/
function give_reports_set_form_method() {
return 'get';
}
add_filter( 'give-reports_form_method_tab_forms', 'give_reports_set_form_method', 10 );
add_filter( 'give-reports_form_method_tab_donors', 'give_reports_set_form_method', 10 );
// @TODO: After release 1.8 Donations -> Reports generates with new setting api, so we can remove some old code from this file.