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0-beta.1 3.2.2 6.3.0-rc.1 3.2.3 6.3.0-rc.2 3.2.4 6.3.1 3.2.5 6.3.2 3.2.6 6.4.0 3.3.0 6.4.0-beta.1 3.3.1 6.4.0-rc.1 3.3.2 6.4.1 3.3.2-rc.1 6.4.2 3.3.3 6.5.0 3.3.4 6.5.0-beta.1 3.3.5 6.5.0-rc.1 3.3.6 6.5.0-rc.2 3.4.0 6.5.1 3.4.0-beta.1 6.5.2 3.4.0-rc.2 6.6.0 3.4.1 6.6.0-beta.1 3.4.2 6.6.0-rc.1 3.4.3 6.6.0-rc.2 3.4.4 6.6.1 3.4.5 6.6.2 3.4.6 6.7.0 3.4.7 6.7.0-beta.1 3.4.8 6.7.0-beta.2 3.5.0 6.7.0-rc.1 3.5.0-beta.1 6.7.1 3.5.0-rc.1 6.8.0 3.5.0-rc.2 6.8.0-beta.1 3.5.1 6.8.0-beta.2 3.5.10 6.8.0-rc.1 3.5.2 6.8.1 3.5.3 6.8.2 3.5.4 6.8.3 3.5.5 6.9.0 3.5.6 6.9.0-beta.1 3.5.7 6.9.0-beta.2 3.5.8 6.9.0-rc.1 3.5.9 6.9.1 3.6.0 6.9.2 3.6.0-beta.1 6.9.3 3.6.0-rc.1 6.9.4 3.6.0-rc.2 6.9.5 3.6.0-rc.3 7.0.0 3.6.1 7.0.0-beta.1 3.6.2 7.0.0-beta.2 3.6.3 7.0.0-beta.3 3.6.4 7.0.0-rc.1 3.6.5 7.0.0-rc.2 3.6.6 7.0.1 3.6.7 7.0.2 3.7.0 7.1.0 3.7.0-beta.1 7.1.0-beta.1 3.7.0-rc.1 7.1.0-beta.2 3.7.0-rc.2 7.1.0-rc.1 3.7.1 7.1.0-rc.2 3.7.2 7.1.1
woocommerce / includes / admin / class-wc-admin-reports.php
woocommerce / includes / admin Last commit date
helper 3 years ago importers 3 years ago list-tables 3 years ago marketplace-suggestions 3 years ago meta-boxes 3 years ago notes 3 years ago plugin-updates 5 years ago reports 3 years ago settings 3 years ago views 3 years ago class-wc-admin-addons.php 3 years ago class-wc-admin-api-keys-table-list.php 6 years ago class-wc-admin-api-keys.php 6 years ago class-wc-admin-assets.php 3 years ago class-wc-admin-attributes.php 3 years ago class-wc-admin-customize.php 5 years ago class-wc-admin-dashboard-setup.php 3 years ago class-wc-admin-dashboard.php 3 years ago class-wc-admin-duplicate-product.php 5 years ago class-wc-admin-exporters.php 3 years ago class-wc-admin-help.php 4 years ago class-wc-admin-importers.php 5 years ago class-wc-admin-log-table-list.php 5 years ago class-wc-admin-menus.php 3 years ago class-wc-admin-meta-boxes.php 3 years ago class-wc-admin-notices.php 3 years ago class-wc-admin-permalink-settings.php 5 years ago class-wc-admin-pointers.php 3 years ago class-wc-admin-post-types.php 3 years ago class-wc-admin-profile.php 4 years ago class-wc-admin-reports.php 5 years ago class-wc-admin-settings.php 3 years ago class-wc-admin-setup-wizard.php 4 years ago class-wc-admin-status.php 3 years ago class-wc-admin-taxonomies.php 3 years ago class-wc-admin-webhooks-table-list.php 4 years ago class-wc-admin-webhooks.php 3 years ago class-wc-admin.php 4 years ago wc-admin-functions.php 3 years ago wc-meta-box-functions.php 3 years ago
class-wc-admin-reports.php
180 lines
1 <?php
2 /**
3 * Admin Reports
4 *
5 * Functions used for displaying sales and customer reports in admin.
6 *
7 * @author WooThemes
8 * @category Admin
9 * @package WooCommerce\Admin\Reports
10 * @version 2.0.0
11 */
12
13 if ( ! defined( 'ABSPATH' ) ) {
14 exit;
15 }
16
17 if ( class_exists( 'WC_Admin_Reports', false ) ) {
18 return;
19 }
20
21 /**
22 * WC_Admin_Reports Class.
23 */
24 class WC_Admin_Reports {
25
26 /**
27 * Handles output of the reports page in admin.
28 */
29 public static function output() {
30 $reports = self::get_reports();
31 $first_tab = array_keys( $reports );
32 $current_tab = ! empty( $_GET['tab'] ) && array_key_exists( $_GET['tab'], $reports ) ? sanitize_title( $_GET['tab'] ) : $first_tab[0];
33 $current_report = isset( $_GET['report'] ) ? sanitize_title( $_GET['report'] ) : current( array_keys( $reports[ $current_tab ]['reports'] ) );
34
35 include_once dirname( __FILE__ ) . '/reports/class-wc-admin-report.php';
36 include_once dirname( __FILE__ ) . '/views/html-admin-page-reports.php';
37 }
38
39 /**
40 * Returns the definitions for the reports to show in admin.
41 *
42 * @return array
43 */
44 public static function get_reports() {
45 $reports = array(
46 'orders' => array(
47 'title' => __( 'Orders', 'woocommerce' ),
48 'reports' => array(
49 'sales_by_date' => array(
50 'title' => __( 'Sales by date', 'woocommerce' ),
51 'description' => '',
52 'hide_title' => true,
53 'callback' => array( __CLASS__, 'get_report' ),
54 ),
55 'sales_by_product' => array(
56 'title' => __( 'Sales by product', 'woocommerce' ),
57 'description' => '',
58 'hide_title' => true,
59 'callback' => array( __CLASS__, 'get_report' ),
60 ),
61 'sales_by_category' => array(
62 'title' => __( 'Sales by category', 'woocommerce' ),
63 'description' => '',
64 'hide_title' => true,
65 'callback' => array( __CLASS__, 'get_report' ),
66 ),
67 'coupon_usage' => array(
68 'title' => __( 'Coupons by date', 'woocommerce' ),
69 'description' => '',
70 'hide_title' => true,
71 'callback' => array( __CLASS__, 'get_report' ),
72 ),
73 'downloads' => array(
74 'title' => __( 'Customer downloads', 'woocommerce' ),
75 'description' => '',
76 'hide_title' => true,
77 'callback' => array( __CLASS__, 'get_report' ),
78 ),
79 ),
80 ),
81 'customers' => array(
82 'title' => __( 'Customers', 'woocommerce' ),
83 'reports' => array(
84 'customers' => array(
85 'title' => __( 'Customers vs. guests', 'woocommerce' ),
86 'description' => '',
87 'hide_title' => true,
88 'callback' => array( __CLASS__, 'get_report' ),
89 ),
90 'customer_list' => array(
91 'title' => __( 'Customer list', 'woocommerce' ),
92 'description' => '',
93 'hide_title' => true,
94 'callback' => array( __CLASS__, 'get_report' ),
95 ),
96 ),
97 ),
98 'stock' => array(
99 'title' => __( 'Stock', 'woocommerce' ),
100 'reports' => array(
101 'low_in_stock' => array(
102 'title' => __( 'Low in stock', 'woocommerce' ),
103 'description' => '',
104 'hide_title' => true,
105 'callback' => array( __CLASS__, 'get_report' ),
106 ),
107 'out_of_stock' => array(
108 'title' => __( 'Out of stock', 'woocommerce' ),
109 'description' => '',
110 'hide_title' => true,
111 'callback' => array( __CLASS__, 'get_report' ),
112 ),
113 'most_stocked' => array(
114 'title' => __( 'Most stocked', 'woocommerce' ),
115 'description' => '',
116 'hide_title' => true,
117 'callback' => array( __CLASS__, 'get_report' ),
118 ),
119 ),
120 ),
121 );
122
123 if ( wc_tax_enabled() ) {
124 $reports['taxes'] = array(
125 'title' => __( 'Taxes', 'woocommerce' ),
126 'reports' => array(
127 'taxes_by_code' => array(
128 'title' => __( 'Taxes by code', 'woocommerce' ),
129 'description' => '',
130 'hide_title' => true,
131 'callback' => array( __CLASS__, 'get_report' ),
132 ),
133 'taxes_by_date' => array(
134 'title' => __( 'Taxes by date', 'woocommerce' ),
135 'description' => '',
136 'hide_title' => true,
137 'callback' => array( __CLASS__, 'get_report' ),
138 ),
139 ),
140 );
141 }
142
143 $reports = apply_filters( 'woocommerce_admin_reports', $reports );
144 $reports = apply_filters( 'woocommerce_reports_charts', $reports ); // Backwards compatibility.
145
146 foreach ( $reports as $key => $report_group ) {
147 if ( isset( $reports[ $key ]['charts'] ) ) {
148 $reports[ $key ]['reports'] = $reports[ $key ]['charts'];
149 }
150
151 foreach ( $reports[ $key ]['reports'] as $report_key => $report ) {
152 if ( isset( $reports[ $key ]['reports'][ $report_key ]['function'] ) ) {
153 $reports[ $key ]['reports'][ $report_key ]['callback'] = $reports[ $key ]['reports'][ $report_key ]['function'];
154 }
155 }
156 }
157
158 return $reports;
159 }
160
161 /**
162 * Get a report from our reports subfolder.
163 *
164 * @param string $name
165 */
166 public static function get_report( $name ) {
167 $name = sanitize_title( str_replace( '_', '-', $name ) );
168 $class = 'WC_Report_' . str_replace( '-', '_', $name );
169
170 include_once apply_filters( 'wc_admin_reports_path', 'reports/class-wc-report-' . $name . '.php', $name, $class );
171
172 if ( ! class_exists( $class ) ) {
173 return;
174 }
175
176 $report = new $class();
177 $report->output_report();
178 }
179 }
180