--- a/webd-woocommerce-advanced-reporting-statistics/helper-class.php
+++ b/webd-woocommerce-advanced-reporting-statistics/helper-class.php
@@ -2,7 +2,7 @@
/**
* Advanced WooCommerce Product Sales Reporting - Statistics & Forecast - OrderProcessorHelp Class
*
- * @version 4.1.2
+ * @version 4.1.3
*
* @author WPFactory
*/
@@ -101,36 +101,19 @@
/**
* Constructor.
+ *
+ * @version 4.1.3
*/
public function __construct() {
-
- add_action( 'wp_ajax_getOrders', array( $this,'getOrders' ) );
- add_action( 'wp_ajax_nopriv_getOrders', array( $this,'getOrders' ) );
-
- add_action( 'wp_ajax_get_orders', array( $this,'get_orders' ) );
- add_action( 'wp_ajax_nopriv_get_orders', array( $this,'get_orders' ) );
-
- add_action( 'wp_ajax_get_customers', array( $this,'get_customers' ) );
- add_action( 'wp_ajax_nopriv_get_customers', array( $this,'get_customers' ) );
-
- add_action( 'wp_ajax_get_countries', array( $this,'get_countries' ) );
- add_action( 'wp_ajax_nopriv_get_countries', array( $this,'get_countries' ) );
-
- add_action( 'wp_ajax_get_payments', array( $this,'get_payments' ) );
- add_action( 'wp_ajax_nopriv_get_payments', array( $this,'get_payments' ) );
-
- add_action( 'wp_ajax_get_coupons', array( $this,'get_coupons' ) );
- add_action( 'wp_ajax_nopriv_get_coupons', array( $this,'get_coupons' ) );
-
- add_action( 'wp_ajax_get_products', array( $this,'get_products' ) );
- add_action( 'wp_ajax_nopriv_get_products', array( $this,'get_products' ) );
-
- add_action( 'wp_ajax_get_categories', array( $this,'get_categories' ) );
- add_action( 'wp_ajax_nopriv_get_categories', array( $this,'get_categories' ) );
-
- add_action( 'wp_ajax_display_orders_by_period', array( $this,'display_orders_by_period' ) );
- add_action( 'wp_ajax_nopriv_display_orders_by_period', array( $this,'display_orders_by_period' ) );
-
+ add_action( 'wp_ajax_getOrders', array( $this,'getOrders' ) );
+ add_action( 'wp_ajax_get_orders', array( $this,'get_orders' ) );
+ add_action( 'wp_ajax_get_customers', array( $this,'get_customers' ) );
+ add_action( 'wp_ajax_get_countries', array( $this,'get_countries' ) );
+ add_action( 'wp_ajax_get_payments', array( $this,'get_payments' ) );
+ add_action( 'wp_ajax_get_coupons', array( $this,'get_coupons' ) );
+ add_action( 'wp_ajax_get_products', array( $this,'get_products' ) );
+ add_action( 'wp_ajax_get_categories', array( $this,'get_categories' ) );
+ add_action( 'wp_ajax_display_orders_by_period', array( $this,'display_orders_by_period' ) );
}
/**
@@ -174,7 +157,7 @@
/**
* display_orders_by_period.
*
- * @version 4.1.0
+ * @version 4.1.3
*
* @todo (v4.1.0) `$topush = 0.1`?
* @todo (v4.1.0) `forecastHoltWinters()`?
@@ -183,7 +166,8 @@
if (
'POST' === $_SERVER['REQUEST_METHOD'] &&
- 'display_orders_by_period' === $_POST['action']
+ 'display_orders_by_period' === $_POST['action'] &&
+ current_user_can( 'manage_woocommerce' )
) {
global $wpdb;
@@ -192,15 +176,11 @@
$status = get_option( $this->plugin . '_status', $default_status );
// Post variables from filter form
- $customer_id = (
- empty( $_POST['customer'] ) ?
- null :
- sanitize_text_field( wp_unslash( $_POST['customer'] ) )
- );
+ $customer_id = $this->get_posted_customer_id();
$order_status = (
empty( $_POST['order_status'] ) ?
$status :
- array( sanitize_text_field( wp_unslash( $_POST['order_status'] ) ) )
+ array( $this->get_posted_order_status() )
);
$period = (
( isset( $_POST['tab'] ) && 'months' === $_POST['tab'] ) ?
@@ -301,7 +281,7 @@
$totals = array();
if ( ! empty( $_POST['order_status'] ) ) {
- $order_status = array( sanitize_text_field( wp_unslash( $_POST['order_status'] ) ) );
+ $order_status = array( $this->get_posted_order_status() );
$message = "<h3> " .
esc_html__( 'Orders with Status', 'webd-woocommerce-reporting-statistics' ) .
" " .
@@ -310,7 +290,7 @@
}
if ( ! empty( $_POST['customer'] ) ) {
- $user = get_user_by( 'id', (int) $_POST['customer'] );
+ $user = get_user_by( 'id', $this->get_posted_customer_id() );
$message .= "<h3> for " .
esc_html( $user->first_name ) .
" " .
@@ -391,7 +371,7 @@
"</h3>";
if ( ! empty( $_POST['order_status'] ) ) {
- $order_status = sanitize_text_field( wp_unslash( $_POST['order_status'] ) );
+ $order_status = $this->get_posted_order_status();
$nomessage .= "<h3> " .
esc_html__( ' with Status: ', 'webd-woocommerce-reporting-statistics' ) .
esc_html( $order_status ) .
@@ -399,7 +379,7 @@
}
if ( ! empty( $_POST['customer'] ) ) {
- $user = get_user_by( 'id', (int) $_POST['customer'] );
+ $user = get_user_by( 'id', $this->get_posted_customer_id() );
$nomessage .= "<h3> " .
esc_html(
' for customer: ' .
@@ -426,7 +406,7 @@
/**
* filter_orders.
*
- * @version 4.1.0
+ * @version 4.1.3
*/
public function filter_orders() {
@@ -455,15 +435,11 @@
$default_status = array( 'wc-completed', 'wc-processing', 'wc-on-hold', 'wc-refunded' );
$status = get_option( $this->plugin . '_status', $default_status );
- $customer = (
- empty( $_POST['customer'] ) ?
- '' :
- sanitize_text_field( wp_unslash( $_POST['customer'] ) )
- );
+ $customer = $this->get_posted_customer_id();
$order_status = (
empty( $_POST['order_status'] ) ?
$status :
- sanitize_text_field( wp_unslash( $_POST['order_status'] ) )
+ $this->get_posted_order_status()
);
$filters = array(
@@ -480,13 +456,14 @@
/**
* getOrders.
*
- * @version 4.1.0
+ * @version 4.1.3
*/
public function getOrders() {
if (
'POST' === $_SERVER['REQUEST_METHOD'] &&
- 'getOrders' === $_POST['action']
+ 'getOrders' === $_POST['action'] &&
+ current_user_can( 'manage_woocommerce' )
) {
$args = array(
@@ -538,7 +515,7 @@
$message = '';
if ( ! empty( $_POST['order_status'] ) ) {
- $order_status = array( sanitize_text_field( wp_unslash( $_POST['order_status'] ) ) );
+ $order_status = array( $this->get_posted_order_status() );
$message = "<h3> " .
esc_html__( 'Orders with Status', 'webd-woocommerce-reporting-statistics' ) .
" " .
@@ -573,7 +550,7 @@
}
if ( ! empty( $_POST['customer'] ) ) {
- $user = get_user_by( 'id', (int) $_POST['customer'] );
+ $user = get_user_by( 'id', $this->get_posted_customer_id() );
$message .= "<h3> for " .
esc_html( $user->first_name ) .
" " .
@@ -688,7 +665,7 @@
"</h3>";
if ( ! empty( $_POST['order_status'] ) ) {
- $order_status = sanitize_text_field( wp_unslash( $_POST['order_status'] ) );
+ $order_status = $this->get_posted_order_status();
$nomessage .= "<h3> " .
esc_html__( ' with Status: ', 'webd-woocommerce-reporting-statistics' ) .
esc_html( $order_status ) .
@@ -717,7 +694,7 @@
}
if ( ! empty( $_POST['customer'] ) ) {
- $user = get_user_by( 'id', (int) $_POST['customer'] );
+ $user = get_user_by( 'id', $this->get_posted_customer_id() );
$nomessage .= "<h3> " .
esc_html(
' for customer: ' .
@@ -746,16 +723,15 @@
/**
* get_orders.
*
- * @version 4.1.2
+ * @version 4.1.3
*/
public function get_orders() {
if (
is_admin() &&
- (
- isset( $_POST['action'] ) &&
- 'get_orders' === $_POST['action']
- )
+ isset( $_POST['action'] ) &&
+ 'get_orders' === $_POST['action'] &&
+ current_user_can( 'manage_woocommerce' )
) {
if ( isset( $_POST['page'] ) ) {
@@ -830,16 +806,15 @@
/**
* get_customers.
*
- * @version 4.1.2
+ * @version 4.1.3
*/
public function get_customers() {
if (
is_admin() &&
- (
- isset( $_POST['action'] ) &&
- 'get_customers' === $_POST['action']
- )
+ isset( $_POST['action'] ) &&
+ 'get_customers' === $_POST['action'] &&
+ current_user_can( 'manage_woocommerce' )
) {
global $wpdb;
@@ -963,16 +938,15 @@
/**
* get_countries.
*
- * @version 4.1.2
+ * @version 4.1.3
*/
public function get_countries() {
if (
is_admin() &&
- (
- isset( $_POST['action'] ) &&
- 'get_countries' === $_POST['action']
- )
+ isset( $_POST['action'] ) &&
+ 'get_countries' === $_POST['action'] &&
+ current_user_can( 'manage_woocommerce' )
) {
global $wpdb;
@@ -1062,16 +1036,15 @@
/**
* get_payments.
*
- * @version 4.1.2
+ * @version 4.1.3
*/
public function get_payments() {
if (
is_admin() &&
- (
- isset( $_POST['action'] ) &&
- 'get_payments' === $_POST['action']
- )
+ isset( $_POST['action'] ) &&
+ 'get_payments' === $_POST['action'] &&
+ current_user_can( 'manage_woocommerce' )
) {
global $wpdb;
@@ -1160,16 +1133,15 @@
/**
* get_coupons.
*
- * @version 4.1.2
+ * @version 4.1.3
*/
public function get_coupons() {
if (
is_admin() &&
- (
- isset( $_POST['action'] ) &&
- 'get_coupons' === $_POST['action']
- )
+ isset( $_POST['action'] ) &&
+ 'get_coupons' === $_POST['action'] &&
+ current_user_can( 'manage_woocommerce' )
) {
global $wpdb;
@@ -1247,16 +1219,15 @@
/**
* get_products.
*
- * @version 4.1.2
+ * @version 4.1.3
*/
public function get_products() {
if (
is_admin() &&
- (
- isset( $_POST['action'] ) &&
- 'get_products' === $_POST['action']
- )
+ isset( $_POST['action'] ) &&
+ 'get_products' === $_POST['action'] &&
+ current_user_can( 'manage_woocommerce' )
) {
global $wpdb;
@@ -1380,16 +1351,15 @@
/**
* get_categories.
*
- * @version 4.1.2
+ * @version 4.1.3
*/
public function get_categories() {
if (
is_admin() &&
- (
- isset( $_POST['action'] ) &&
- 'get_categories' === $_POST['action']
- )
+ isset( $_POST['action'] ) &&
+ 'get_categories' === $_POST['action'] &&
+ current_user_can( 'manage_woocommerce' )
) {
global $wpdb;
@@ -1612,12 +1582,12 @@
/**
* get_posted_ids.
*
- * @version 4.1.2
+ * @version 4.1.3
* @since 4.1.2
*/
function get_posted_ids() {
return array_map(
- 'intval',
+ 'absint',
wp_unslash(
$_POST['ids']
)
@@ -1627,13 +1597,13 @@
/**
* get_posted_product_id.
*
- * @version 4.1.2
+ * @version 4.1.3
* @since 4.1.2
*/
function get_posted_product_id() {
return (
! empty( $_POST['product'] ) ?
- intval(
+ absint(
wp_unslash(
$_POST['product']
)
@@ -1645,18 +1615,54 @@
/**
* get_posted_product_cat_id.
*
- * @version 4.1.2
+ * @version 4.1.3
* @since 4.1.2
*/
function get_posted_product_cat_id() {
return (
! empty( $_POST['cat'] ) ?
- intval(
+ absint(
wp_unslash(
$_POST['cat']
)
) :
null
+ );
+ }
+
+ /**
+ * get_posted_customer_id.
+ *
+ * @version 4.1.3
+ * @since 4.1.3
+ */
+ function get_posted_customer_id() {
+ return (
+ ! empty( $_POST['customer'] ) ?
+ absint(
+ wp_unslash(
+ $_POST['customer']
+ )
+ ) :
+ null
+ );
+ }
+
+ /**
+ * get_posted_order_status.
+ *
+ * @version 4.1.3
+ * @since 4.1.3
+ */
+ function get_posted_order_status() {
+ return (
+ ! empty( $_POST['order_status'] ) ?
+ sanitize_key(
+ wp_unslash(
+ $_POST['order_status']
+ )
+ ) :
+ null
);
}
--- a/webd-woocommerce-advanced-reporting-statistics/webd-woocommerce-reporting-statistics.php
+++ b/webd-woocommerce-advanced-reporting-statistics/webd-woocommerce-reporting-statistics.php
@@ -3,7 +3,7 @@
* Plugin Name: Advanced WooCommerce Product Sales Reporting - Statistics & Forecast
* Plugin URI: https://extend-wp.com/advanced-reporting-statistics-plugin-for-woocommerce/
* Description: A comprehensive WordPress Plugin for WooCommerce Reports, Statistics, Analytics & Forecasting Tool for Orders, Sales, Products, Countries, Payment Gateways Shipping, Tax, Refunds, Top Products.
- * Version: 4.1.2
+ * Version: 4.1.3
* Author: WPFactory
* Author URI: https://wpfactory.com
* WC requires at least: 2.2
@@ -14,12 +14,12 @@
* License: GNU General Public License v3.0
* License URI: http://www.gnu.org/licenses/gpl-3.0.html
* Created On: 23-01-2019
- * Updated On: 26-12-2025
+ * Updated On: 14-01-2026
*/
defined( 'ABSPATH' ) || exit;
-defined( 'WPFACTORY_WC_ARS_VERSION' ) || define( 'WPFACTORY_WC_ARS_VERSION', '4.1.2' );
+defined( 'WPFACTORY_WC_ARS_VERSION' ) || define( 'WPFACTORY_WC_ARS_VERSION', '4.1.3' );
defined( 'WPFACTORY_WC_ARS_FILE' ) || define( 'WPFACTORY_WC_ARS_FILE', __FILE__ );
@@ -48,7 +48,7 @@
/**
* webdWoocommerceReportingStatistics class.
*
- * @version 4.0.0
+ * @version 4.1.3
*
* @todo (v4.0.0) cleanup notification (e.g., `push_not` AJAX action)
* @todo (v4.0.0) remove the "GO PRO" tab?
@@ -66,34 +66,36 @@
/**
* Constructor.
*
- * @version 4.0.0
+ * @version 4.1.3
*/
public function __construct() {
- add_action('admin_enqueue_scripts', array($this, 'BackEndScripts') );
+ add_action( 'admin_enqueue_scripts', array( $this, 'BackEndScripts' ) );
add_action( 'wpfactory_wc_ars_output_settings', array( $this, 'init' ) );
- register_activation_hook( __FILE__, array($this, 'onActivation') );
+ register_activation_hook( __FILE__, array( $this, 'onActivation' ) );
- add_action("admin_init", array($this, 'settingsSection') );
+ add_action( 'admin_init', array( $this, 'settingsSection' ) );
- if( isset( $_GET['page'] ) && $_GET['page'] == 'webd-woocommerce-reporting-statistics' ) {
- add_action("admin_footer", array($this,"proModal" ) );
+ if (
+ isset( $_GET['page'] ) &&
+ 'webd-woocommerce-reporting-statistics' === $_GET['page']
+ ) {
+ add_action( 'admin_footer', array( $this, 'proModal' ) );
}
- add_action( 'wp_ajax_nopriv_stat_extensions', array( $this,'extensions' ) );
add_action( 'wp_ajax_stat_extensions', array( $this,'extensions' ) );
// Deactivation survey
- include( plugin_dir_path(__FILE__) .'/lib/codecabin/plugin-deactivation-survey/deactivate-feedback-form.php');
- add_filter( 'codecabin_deactivate_feedback_form_plugins', function( $plugins ) {
+ include( plugin_dir_path( __FILE__ ) . '/lib/codecabin/plugin-deactivation-survey/deactivate-feedback-form.php' );
+ add_filter( 'codecabin_deactivate_feedback_form_plugins', function ( $plugins ) {
$plugins[] = (object) array(
'slug' => 'webd-woocommerce-advanced-reporting-statistics',
'version' => '3.1',
);
return $plugins;
- });
+ } );
}