installed plugin Easy Digital Downloads version 3.1.0.3

This commit is contained in:
2022-11-27 15:03:07 +00:00
committed by Gitium
parent 555673545b
commit c5dce2cec6
1200 changed files with 238970 additions and 0 deletions

View File

@ -0,0 +1,170 @@
<?php
/**
* Adjustment Query Class.
*
* @package EDD
* @subpackage Database\Queries
* @copyright Copyright (c) 2018, Easy Digital Downloads, LLC
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
* @since 3.0
*/
namespace EDD\Database\Queries;
// Exit if accessed directly
defined( 'ABSPATH' ) || exit;
use EDD\Database\Query;
/**
* Class used for querying adjustments.
*
* @since 3.0
*
* @see \EDD\Database\Queries\Adjustment::__construct() for accepted arguments.
*/
class Adjustment extends Query {
/** Table Properties ******************************************************/
/**
* Name of the database table to query.
*
* @since 3.0
* @access protected
* @var string
*/
protected $table_name = 'adjustments';
/**
* String used to alias the database table in MySQL statement.
*
* @since 3.0
* @access protected
* @var string
*/
protected $table_alias = 'a';
/**
* Name of class used to setup the database schema
*
* @since 3.0
* @access protected
* @var string
*/
protected $table_schema = '\\EDD\\Database\\Schemas\\Adjustments';
/** Item ******************************************************************/
/**
* Name for a single item
*
* @since 3.0
* @access protected
* @var string
*/
protected $item_name = 'adjustment';
/**
* Plural version for a group of items.
*
* @since 3.0
* @access protected
* @var string
*/
protected $item_name_plural = 'adjustments';
/**
* Callback function for turning IDs into objects
*
* @since 3.0
* @access protected
* @var mixed
*/
protected $item_shape = '\\EDD\\Database\\Rows\\Adjustment';
/** Cache *****************************************************************/
/**
* Group to cache queries and queried items in.
*
* @since 3.0
* @access protected
* @var string
*/
protected $cache_group = 'adjustments';
/** Methods ***************************************************************/
/**
* Sets up the adjustment query, based on the query vars passed.
*
* @since 3.0
* @access protected
*
* @param string|array $query {
* Optional. Array or query string of adjustment query parameters. Default empty.
*
* @type int $id A adjustment ID to only return that adjustment. Default empty.
* @type array $id__in Array of adjustment IDs to include. Default empty.
* @type array $id__not_in Array of adjustment IDs to exclude. Default empty.
* @type int $parent A parent adjustment ID to only return adjustments with
* that parent. Default empty.
* @type array $parent_id__in An array of parent IDs to include. Default empty.
* @type array $parent_id__not_in An array of parent IDs to exclude. Default empty.
* @type int $code A adjustment code to only return that adjustment. Default empty.
* @type array $code__in Array of adjustment codes to include. Default empty.
* @type array $code__not_in Array of adjustment codes to exclude. Default empty.
* @type int $status A adjustment status to only return that status. Default empty.
* @type array $status__in Array of adjustment statuses to include. Default empty.
* @type array $status__not_in Array of adjustment statuses to exclude. Default empty.
* @type int $type A adjustment type to only return that type. Default empty.
* @type array $type__in Array of adjustment types to include. Default empty.
* @type array $type__not_in Array of adjustment types to exclude. Default empty.
* @type int $scope A adjustment scope to only return that scope. Default empty.
* @type array $scope__in Array of adjustment scopes to include. Default empty.
* @type array $scope__not_in Array of adjustment scopes to exclude. Default empty.
* @type int $amount_type A adjustment amount type to only return that type. Default empty.
* @type array $amount_type__in Array of amount adjustment types to include. Default empty.
* @type array $amount_type__not_in Array of amount adjustment types to exclude. Default empty.
* @type int|float $amount A adjustment amount to only return that amount. Default empty.
* @type array $amount__in Array of adjustment amounts to include. Default empty.
* @type array $amount__not_in Array of adjustment amounts to exclude. Default empty.
* @type int $max_uses A adjustment max_uses to only return that amount. Default empty.
* @type array $max_uses__in Array of adjustment max_uses to include. Default empty.
* @type array $max_uses__not_in Array of adjustment max_uses to exclude. Default empty.
* @type int $use_count A adjustment use_count to only return that count. Default empty.
* @type array $use_count__in Array of adjustment use_counts to include. Default empty.
* @type array $use_count__not_in Array of adjustment use_counts to exclude. Default empty.
* @type int $once_per_customer '1' for true, '0' for false. Default empty.
* @type int|float $min_charge_amount Minimum charge amount. Default empty.
* @type array $date_query Query all datetime columns together. See WP_Date_Query.
* @type array $date_created_query Date query clauses to limit adjustments by. See WP_Date_Query.
* Default null.
* @type array $date_modified_query Date query clauses to limit by. See WP_Date_Query.
* Default null.
* @type array $start_date_query Date query clauses to limit adjustments by. See WP_Date_Query.
* Default null.
* @type array $end_date_query Date query clauses to limit adjustments by. See WP_Date_Query.
* Default null.
* @type bool $count Whether to return a adjustment count (true) or array of adjustment objects.
* Default false.
* @type string $fields Item fields to return. Accepts any column known names
* or empty (returns an array of complete adjustment objects). Default empty.
* @type int $number Limit number of adjustments to retrieve. Default 100.
* @type int $offset Number of adjustments to offset the query. Used to build LIMIT clause.
* Default 0.
* @type bool $no_found_rows Whether to disable the `SQL_CALC_FOUND_ROWS` query. Default true.
* @type string|array $orderby Accepts 'id', 'parent', 'name', 'code', 'status', 'type',
* 'scope', 'amount_type', 'amount', 'start_date', 'end_date',
* 'date_created', and 'date_modified'.
* Also accepts false, an empty array, or 'none' to disable `ORDER BY` clause.
* Default 'id'.
* @type string $order How to order results. Accepts 'ASC', 'DESC'. Default 'DESC'.
* @type string $search Search term(s) to retrieve matching adjustments for. Default empty.
* @type bool $update_cache Whether to prime the cache for found adjustments. Default false.
* }
*/
public function __construct( $query = array() ) {
parent::__construct( $query );
}
}

View File

@ -0,0 +1,169 @@
<?php
/**
* Customer Address Query Class.
*
* @package EDD
* @subpackage Database\Queries
* @copyright Copyright (c) 2018, Easy Digital Downloads, LLC
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
* @since 3.0
*/
namespace EDD\Database\Queries;
// Exit if accessed directly
defined( 'ABSPATH' ) || exit;
use EDD\Database\Query;
/**
* Class used for querying customer addresses.
*
* @since 3.0
*
* @see \EDD\Database\Queries\Customer_Address::__construct() for accepted arguments.
*/
class Customer_Address extends Query {
/** Table Properties ******************************************************/
/**
* Name of the database table to query.
*
* @since 3.0
* @access public
* @var string
*/
protected $table_name = 'customer_addresses';
/**
* String used to alias the database table in MySQL statement.
*
* @since 3.0
* @access public
* @var string
*/
protected $table_alias = 'ca';
/**
* Name of class used to setup the database schema
*
* @since 3.0
* @access public
* @var string
*/
protected $table_schema = '\\EDD\\Database\\Schemas\\Customer_Addresses';
/** Item ******************************************************************/
/**
* Name for a single item
*
* @since 3.0
* @access public
* @var string
*/
protected $item_name = 'customer_address';
/**
* Plural version for a group of items.
*
* @since 3.0
* @access public
* @var string
*/
protected $item_name_plural = 'customer_addresses';
/**
* Callback function for turning IDs into objects
*
* @since 3.0
* @access public
* @var mixed
*/
protected $item_shape = '\\EDD\\Customers\\Customer_Address';
/** Cache *****************************************************************/
/**
* Group to cache queries and queried items in.
*
* @since 3.0
* @access public
* @var string
*/
protected $cache_group = 'customer_addresses';
/** Methods ***************************************************************/
/**
* Sets up the customer query, based on the query vars passed.
*
* @since 3.0
* @access public
*
* @param string|array $query {
* Optional. Array or query string of customer query parameters. Default empty.
*
* @type int $id An address ID to only return that address. Default empty.
* @type array $id__in Array of address IDs to include. Default empty.
* @type array $id__not_in Array of address IDs to exclude. Default empty.
* @type int $customer_id A customer ID to only return that object. Default empty.
* @type array $customer_id__in Array of customer IDs to include. Default empty.
* @type array $customer_id__not_in Array of customer IDs to exclude. Default empty.
* @type int $is_primary Search for primary or non-primary addresses
* @type array $is_primary__in Array of 0 and/or 1 to get primary and/or non-primary.
* @type array $is_primary__not_in Array of 0 and/or 1 to avoid getting addresses of primary designation.
* @type string $type Limit results to those affiliated with a given type. Default empty.
* @type array $type__in Array of types to include affiliated addresses for. Default empty.
* @type array $type__not_in Array of types to exclude affiliated addresses for. Default empty.
* @type string $status An address statuses to only return that address. Default empty.
* @type array $status__in Array of address statuses to include. Default empty.
* @type array $status__not_in Array of address statuses to exclude. Default empty.
* @type string $name A name to only return addresses with that name. Default empty.
* @type array $name__in An array of names to include. Default empty.
* @type array $name__not_in An array of names to exclude. Default empty.
* @type string $address An address line 1 to only return that address. Default empty.
* @type array $address__in Array of addresses to include. Default empty.
* @type array $address__not_in Array of addresses to exclude. Default empty.
* @type string $address2 An address line 2 to only return that address. Default empty.
* @type array $address2__in Array of addresses to include. Default empty.
* @type array $address2__not_in Array of addresses to exclude. Default empty.
* @type string $city A city to only return that address. Default empty.
* @type array $city__in Array of cities to include. Default empty.
* @type array $city__not_in Array of cities to exclude. Default empty.
* @type string $region A region to only return that region. Default empty.
* @type array $region__in Array of regions to include. Default empty.
* @type array $region__not_in Array of regions to exclude. Default empty.
* @type string $postal_code A postal code to only return that post code. Default empty.
* @type array $postal_code__in Array of postal codes to include. Default empty.
* @type array $postal_code__not_in Array of postal codes to exclude. Default empty.
* @type string $country A country to only return that country. Default empty.
* @type array $country__in Array of countries to include. Default empty.
* @type array $country__not_in Array of countries to exclude. Default empty.
* @type array $date_query Query all datetime columns together. See WP_Date_Query.
* @type array $date_created_query Date query clauses to limit customers by. See WP_Date_Query.
* Default null.
* @type array $date_modified_query Date query clauses to limit by. See WP_Date_Query.
* Default null.
* @type bool $count Whether to return a customer count (true) or array of customer objects.
* Default false.
* @type string $fields Item fields to return. Accepts any column known names
* or empty (returns an array of complete customer objects). Default empty.
* @type int $number Limit number of customers to retrieve. Default 100.
* @type int $offset Number of customers to offset the query. Used to build LIMIT clause.
* Default 0.
* @type bool $no_found_rows Whether to disable the `SQL_CALC_FOUND_ROWS` query. Default true.
* @type string|array $orderby Accepts 'id', 'is_primary', 'type', 'status', 'name',
* 'address', 'address2', 'city', 'region', 'postal_code',
* 'country', 'date_created', 'date_modified'.
* Also accepts false, an empty array, or 'none' to disable `ORDER BY` clause.
* Default 'id'.
* @type string $order How to order results. Accepts 'ASC', 'DESC'. Default 'DESC'.
* @type string $search Search term(s) to retrieve matching customers for. Default empty.
* @type bool $update_cache Whether to prime the cache for found customers. Default false.
* }
*/
public function __construct( $query = array() ) {
parent::__construct( $query );
}
}

View File

@ -0,0 +1,146 @@
<?php
/**
* Customer Email Address Query Class.
*
* @package EDD
* @subpackage Database\Queries
* @copyright Copyright (c) 2018, Easy Digital Downloads, LLC
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
* @since 3.0
*/
namespace EDD\Database\Queries;
// Exit if accessed directly
defined( 'ABSPATH' ) || exit;
use EDD\Database\Query;
/**
* Class used for querying customer email addresses.
*
* @since 3.0
*
* @see \EDD\Database\Queries\Customer_Email_Address::__construct() for accepted arguments.
*/
class Customer_Email_Address extends Query {
/** Table Properties ******************************************************/
/**
* Name of the database table to query.
*
* @since 3.0
* @access public
* @var string
*/
protected $table_name = 'customer_email_addresses';
/**
* String used to alias the database table in MySQL statement.
*
* @since 3.0
* @access public
* @var string
*/
protected $table_alias = 'cea';
/**
* Name of class used to setup the database schema
*
* @since 3.0
* @access public
* @var string
*/
protected $table_schema = '\\EDD\\Database\\Schemas\\Customer_Email_Addresses';
/** Item ******************************************************************/
/**
* Name for a single item
*
* @since 3.0
* @access public
* @var string
*/
protected $item_name = 'customer_email_address';
/**
* Plural version for a group of items.
*
* @since 3.0
* @access public
* @var string
*/
protected $item_name_plural = 'customer_email_addresses';
/**
* Callback function for turning IDs into objects
*
* @since 3.0
* @access public
* @var mixed
*/
protected $item_shape = '\\EDD\\Customers\\Email_Address';
/** Cache *****************************************************************/
/**
* Group to cache queries and queried items in.
*
* @since 3.0
* @access public
* @var string
*/
protected $cache_group = 'customer_email_addresses';
/** Methods ***************************************************************/
/**
* Sets up the customer query, based on the query vars passed.
*
* @since 3.0
* @access public
*
* @param string|array $query {
* Optional. Array or query string of customer query parameters. Default empty.
*
* @type int $id An email address ID to only return that email address. Default empty.
* @type array $id__in Array of email IDs to include. Default empty.
* @type array $id__not_in Array of email IDs to exclude. Default empty.
* @type int $customer_id A customer ID to only return that customer. Default empty.
* @type array $customer_id__in Array of customer IDs to include. Default empty.
* @type array $customer_id__not_in Array of customer IDs to exclude. Default empty.
* @type string $type Limit results to those affiliated with a given type. Default empty.
* @type array $type__in Array of types to include. Default empty.
* @type array $type__not_in Array of types to exclude. Default empty.
* @type string $status An address statuses to only return that status. Default empty.
* @type array $status__in Array of address statuses to include. Default empty.
* @type array $status__not_in Array of address statuses to exclude. Default empty.
* @type string $email An email address to only return that email address. Default empty.
* @type array $email__in Array of email addresses to include. Default empty.
* @type array $email__not_in Array of email addresses to exclude. Default empty.
* @type array $date_query Query all datetime columns together. See WP_Date_Query.
* @type array $date_created_query Date query clauses to limit results by. See WP_Date_Query.
* Default null.
* @type array $date_modified_query Date query clauses to limit by. See WP_Date_Query.
* Default null.
* @type bool $count Whether to return an item count (true) or array of item objects.
* Default false.
* @type string $fields Item fields to return. Accepts any column known names
* or empty (returns an array of complete customer objects). Default empty.
* @type int $number Limit number of results to retrieve. Default 100.
* @type int $offset Number of items to offset the query. Used to build LIMIT clause.
* Default 0.
* @type bool $no_found_rows Whether to disable the `SQL_CALC_FOUND_ROWS` query. Default true.
* @type string|array $orderby Accepts 'id', 'type', 'email', 'date_created', 'date_modified'.
* Also accepts false, an empty array, or 'none' to disable `ORDER BY` clause.
* Default 'id'.
* @type string $order How to order results. Accepts 'ASC', 'DESC'. Default 'DESC'.
* @type string $search Search term(s) to retrieve matching emails for. Default empty.
* @type bool $update_cache Whether to prime the cache for found emails. Default false.
* }
*/
public function __construct( $query = array() ) {
parent::__construct( $query );
}
}

View File

@ -0,0 +1,146 @@
<?php
/**
* Customer Query Class.
*
* @package EDD
* @subpackage Database\Queries
* @copyright Copyright (c) 2018, Easy Digital Downloads, LLC
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
* @since 3.0
*/
namespace EDD\Database\Queries;
// Exit if accessed directly
defined( 'ABSPATH' ) || exit;
use EDD\Database\Query;
/**
* Class used for querying customers.
*
* @since 3.0
*
* @see \EDD\Database\Queries\Customer::__construct() for accepted arguments.
*/
class Customer extends Query {
/** Table Properties ******************************************************/
/**
* Name of the database table to query.
*
* @since 3.0
* @access public
* @var string
*/
protected $table_name = 'customers';
/**
* String used to alias the database table in MySQL statement.
*
* @since 3.0
* @access public
* @var string
*/
protected $table_alias = 'c';
/**
* Name of class used to setup the database schema
*
* @since 3.0
* @access public
* @var string
*/
protected $table_schema = '\\EDD\\Database\\Schemas\\Customers';
/** Item ******************************************************************/
/**
* Name for a single item
*
* @since 3.0
* @access public
* @var string
*/
protected $item_name = 'customer';
/**
* Plural version for a group of items.
*
* @since 3.0
* @access public
* @var string
*/
protected $item_name_plural = 'customers';
/**
* Callback function for turning IDs into objects
*
* @since 3.0
* @access public
* @var mixed
*/
protected $item_shape = '\\EDD_Customer';
/** Cache *****************************************************************/
/**
* Group to cache queries and queried items in.
*
* @since 3.0
* @access public
* @var string
*/
protected $cache_group = 'customers';
/** Methods ***************************************************************/
/**
* Sets up the customer query, based on the query vars passed.
*
* @since 3.0
* @access public
*
* @param string|array $query {
* Optional. Array or query string of customer query parameters. Default empty.
*
* @type int $id An customer ID to only return that customer. Default empty.
* @type array $id__in Array of customer IDs to include. Default empty.
* @type array $id__not_in Array of customer IDs to exclude. Default empty.
* @type int $user_id A user ID to only return that user. Default empty.
* @type array $user_id__in Array of user IDs to include. Default empty.
* @type array $user_id__not_in Array of user IDs to exclude. Default empty.
* @type string $email Limit results to those affiliated with a given email. Default empty.
* @type array $email__in Array of email to include affiliated orders for. Default empty.
* @type array $email__not_in Array of email to exclude affiliated orders for. Default empty.
* @type string $status A status to only return that status. Default empty.
* @type array $status__in Array of order statuses to include. Default empty.
* @type array $status__not_in Array of order statuses to exclude. Default empty.
* @type float $purchase_value A purchase value. Default empty.
* @type int $purchase_count A numeric value. Default empty.
* @type array $date_query Query all datetime columns together. See WP_Date_Query.
* @type array $date_created_query Date query clauses to limit customers by. See WP_Date_Query.
* Default null.
* @type array $date_modified_query Date query clauses to limit by. See WP_Date_Query.
* Default null.
* @type bool $count Whether to return a customer count (true) or array of customer objects.
* Default false.
* @type string $fields Item fields to return. Accepts any column known names
* or empty (returns an array of complete customer objects). Default empty.
* @type int $number Limit number of customers to retrieve. Default 100.
* @type int $offset Number of customers to offset the query. Used to build LIMIT clause.
* Default 0.
* @type bool $no_found_rows Whether to disable the `SQL_CALC_FOUND_ROWS` query. Default true.
* @type string|array $orderby Accepts 'id', 'email', 'name', 'status', 'purchase_value',
* 'purchase_count', 'date_created', 'date_modified'.
* Also accepts false, an empty array, or 'none' to disable `ORDER BY` clause.
* Default 'id'.
* @type string $order How to order results. Accepts 'ASC', 'DESC'. Default 'DESC'.
* @type string $search Search term(s) to retrieve matching customers for. Default empty.
* @type bool $update_cache Whether to prime the cache for found customers. Default false.
* }
*/
public function __construct( $query = array() ) {
parent::__construct( $query );
}
}

View File

@ -0,0 +1,156 @@
<?php
/**
* API Request Log Query Class.
*
* @package EDD
* @subpackage Database\Queries
* @copyright Copyright (c) 2018, Easy Digital Downloads, LLC
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
* @since 3.0
*/
namespace EDD\Database\Queries;
// Exit if accessed directly.
defined( 'ABSPATH' ) || exit;
use EDD\Database\Query;
/**
* Class used for querying items.
*
* @since 3.0
*
* @see \EDD\Database\Queries\Log_Api_Request::__construct() for accepted arguments.
*/
class Log_Api_Request extends Query {
/** Table Properties ******************************************************/
/**
* Name of the database table to query.
*
* @since 3.0
* @access public
* @var string
*/
protected $table_name = 'logs_api_requests';
/**
* String used to alias the database table in MySQL statement.
*
* @since 3.0
* @access public
* @var string
*/
protected $table_alias = 'la';
/**
* Name of class used to setup the database schema
*
* @since 3.0
* @access public
* @var string
*/
protected $table_schema = '\\EDD\\Database\\Schemas\\Logs_Api_Requests';
/** Item ******************************************************************/
/**
* Name for a single item
*
* @since 3.0
* @access public
* @var string
*/
protected $item_name = 'logs_api_request';
/**
* Plural version for a group of items.
*
* @since 3.0
* @access public
* @var string
*/
protected $item_name_plural = 'logs_api_requests';
/**
* Callback function for turning IDs into objects
*
* @since 3.0
* @access public
* @var mixed
*/
protected $item_shape = 'EDD\\Logs\\Api_Request_Log';
/** Cache *****************************************************************/
/**
* Group to cache queries and queried items in.
*
* @since 3.0
* @access public
* @var string
*/
protected $cache_group = 'logs_api_requests';
/** Methods ***************************************************************/
/**
* Sets up the query, based on the query vars passed.
*
* @since 3.0
* @access public
*
* @param string|array $query {
* Optional. Array or query string of query parameters. Default empty.
*
* @type int $id An log ID to only return that log. Default empty.
* @type array $id__in Array of log IDs to include. Default empty.
* @type array $id__not_in Array of log IDs to exclude. Default empty.
* @type string $user_id A user ID to only return those users. Default empty.
* @type array $user_id__in Array of user IDs to include. Default empty.
* @type array $user_id__not_in Array of user IDs to exclude. Default empty.
* @type string $api_key An API key to only return that key. Default empty.
* @type array $api_key__in Array of API keys to include. Default empty.
* @type array $api_key__not_in Array of API keys to exclude. Default empty.
* @type string $token A token to only return that token. Default empty.
* @type array $token__in Array of tokens to include. Default empty.
* @type array $token__not_in Array of tokens to exclude. Default empty.
* @type string $version A version to only return that version. Default empty.
* @type array $version__in Array of versions to include. Default empty.
* @type array $version__not_in Array of versions to exclude. Default empty.
* @type string $request Request to search by. Default empty.
* @type string $error Error to search by. Default empty.
* @type string $ip An IP to only return that IP address. Default empty.
* @type array $ip__in Array of IPs to include. Default empty.
* @type array $ip__not_in Array of IPs to exclude. Default empty.
* @type string $time A time to only return that time. Default empty.
* @type array $time__in Array of times to include. Default empty.
* @type array $time__not_in Array of times to exclude. Default empty.
* @type array $date_query Query all datetime columns together. See WP_Date_Query.
* @type array $date_created_query Date query clauses to limit by. See WP_Date_Query.
* Default null.
* @type array $date_modified_query Date query clauses to limit by. See WP_Date_Query.
* Default null.
* @type bool $count Whether to return a count (true) or array of objects.
* Default false.
* @type string $fields Item fields to return. Accepts any column known names
* or empty (returns an array of complete objects). Default empty.
* @type int $number Limit number of logs to retrieve. Default 100.
* @type int $offset Number of logs to offset the query. Used to build LIMIT clause.
* Default 0.
* @type bool $no_found_rows Whether to disable the `SQL_CALC_FOUND_ROWS` query. Default true.
* @type string|array $orderby Accepts 'id', 'user_id', 'api_key', 'token', 'version', 'ip',
* 'time', 'date_created', and 'date_modified'.
* Also accepts false, an empty array, or 'none' to disable `ORDER BY` clause.
* Default 'id'.
* @type string $order How to order results. Accepts 'ASC', 'DESC'. Default 'DESC'.
* @type string $search Search term(s) to retrieve matching logs for. Default empty.
* @type bool $update_cache Whether to prime the cache for found logs. Default false.
* }
*/
public function __construct( $query = array() ) {
parent::__construct( $query );
}
}

View File

@ -0,0 +1,156 @@
<?php
/**
* File Download Log Query Class.
*
* @package EDD
* @subpackage Database\Queries
* @copyright Copyright (c) 2018, Easy Digital Downloads, LLC
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
* @since 3.0
*/
namespace EDD\Database\Queries;
// Exit if accessed directly
defined( 'ABSPATH' ) || exit;
use EDD\Database\Query;
/**
* Class used for querying items.
*
* @since 3.0
*
* @see \EDD\Database\Queries\Log_File_Download::__construct() for accepted arguments.
*/
class Log_File_Download extends Query {
/** Table Properties ******************************************************/
/**
* Name of the database table to query.
*
* @since 3.0
* @access public
* @var string
*/
protected $table_name = 'logs_file_downloads';
/**
* String used to alias the database table in MySQL statement.
*
* @since 3.0
* @access public
* @var string
*/
protected $table_alias = 'lf';
/**
* Name of class used to setup the database schema
*
* @since 3.0
* @access public
* @var string
*/
protected $table_schema = '\\EDD\\Database\\Schemas\\Logs_File_Downloads';
/** Item ******************************************************************/
/**
* Name for a single item
*
* @since 3.0
* @access public
* @var string
*/
protected $item_name = 'logs_file_download';
/**
* Plural version for a group of items.
*
* @since 3.0
* @access public
* @var string
*/
protected $item_name_plural = 'logs_file_downloads';
/**
* Callback function for turning IDs into objects
*
* @since 3.0
* @access public
* @var mixed
*/
protected $item_shape = 'EDD\\Logs\\File_Download_Log';
/** Cache *****************************************************************/
/**
* Group to cache queries and queried items in.
*
* @since 3.0
* @access public
* @var string
*/
protected $cache_group = 'logs_file_downloads';
/** Methods ***************************************************************/
/**
* Sets up the query, based on the query vars passed.
*
* @since 3.0
* @access public
*
* @param string|array $query {
* Optional. Array or query string of query parameters. Default empty.
*
* @type int $id An log ID to only return that log. Default empty.
* @type array $id__in Array of log IDs to include. Default empty.
* @type array $id__not_in Array of log IDs to exclude. Default empty.
* @type string $product_id A product ID to only return those products. Default empty.
* @type array $product_id__in Array of product IDs to include. Default empty.
* @type array $product_id__not_in Array of product IDs to exclude. Default empty.
* @type string $file_id A file ID to only return those files. Default empty.
* @type array $file_id__in Array of file IDs to include. Default empty.
* @type array $file_id__not_in Array of file IDs to exclude. Default empty.
* @type string $order_id An order ID to only return those orders. Default empty.
* @type array $order_id__in Array of order IDs to include. Default empty.
* @type array $order_id__not_in Array of order IDs to exclude. Default empty.
* @type string $price_id A price ID to only return those prices. Default empty.
* @type array $price_id__in Array of price IDs to include. Default empty.
* @type array $price_id__not_in Array of price IDs to exclude. Default empty.
* @type string $customer_id A customer ID to only return those customers. Default empty.
* @type array $customer_id__in Array of customer IDs to include. Default empty.
* @type array $customer_id__not_in Array of customer IDs to exclude. Default empty.
* @type string $ip An IP to only return that IP address. Default empty.
* @type array $ip__in Array of IPs to include. Default empty.
* @type array $ip__not_in Array of IPs to exclude. Default empty.
* @type string $user_agent A user agent to only return that agent. Default empty.
* @type array $user_agent__in Array of user agents to include. Default empty.
* @type array $user_agent__not_in Array of user agents to exclude. Default empty.
* @type array $date_query Query all datetime columns together. See WP_Date_Query.
* @type array $date_created_query Date query clauses to limit by. See WP_Date_Query.
* Default null.
* @type array $date_modified_query Date query clauses to limit by. See WP_Date_Query.
* Default null.
* @type bool $count Whether to return a count (true) or array of objects.
* Default false.
* @type string $fields Item fields to return. Accepts any column known names
* or empty (returns an array of complete objects). Default empty.
* @type int $number Limit number of logs to retrieve. Default 100.
* @type int $offset Number of logs to offset the query. Used to build LIMIT clause.
* Default 0.
* @type bool $no_found_rows Whether to disable the `SQL_CALC_FOUND_ROWS` query. Default true.
* @type string|array $orderby Accepts 'id', 'product_id', 'file_id', 'order_id', 'customer_id',
* 'ip', 'date_created', and 'date_modified'. Also accepts false,
* an empty array, or 'none' to disable `ORDER BY` clause.
* Default 'id'.
* @type string $order How to order results. Accepts 'ASC', 'DESC'. Default 'DESC'.
* @type string $search Search term(s) to retrieve matching logs for. Default empty.
* @type bool $update_cache Whether to prime the cache for found logs. Default false.
* }
*/
public function __construct( $query = array() ) {
parent::__construct( $query );
}
}

View File

@ -0,0 +1,149 @@
<?php
/**
* Log Query Class.
*
* @package EDD
* @subpackage Database\Queries
* @copyright Copyright (c) 2018, Easy Digital Downloads, LLC
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
* @since 3.0
*/
namespace EDD\Database\Queries;
// Exit if accessed directly
defined( 'ABSPATH' ) || exit;
use EDD\Database\Query;
/**
* Class used for querying items.
*
* @since 3.0
*
* @see \EDD\Database\Queries\Log::__construct() for accepted arguments.
*/
class Log extends Query {
/** Table Properties ******************************************************/
/**
* Name of the database table to query.
*
* @since 3.0
* @access public
* @var string
*/
protected $table_name = 'logs';
/**
* String used to alias the database table in MySQL statement.
*
* @since 3.0
* @access public
* @var string
*/
protected $table_alias = 'l';
/**
* Name of class used to setup the database schema
*
* @since 3.0
* @access public
* @var string
*/
protected $table_schema = '\\EDD\\Database\\Schemas\\Logs';
/** Item ******************************************************************/
/**
* Name for a single item
*
* @since 3.0
* @access public
* @var string
*/
protected $item_name = 'log';
/**
* Plural version for a group of items.
*
* @since 3.0
* @access public
* @var string
*/
protected $item_name_plural = 'logs';
/**
* Callback function for turning IDs into objects
*
* @since 3.0
* @access public
* @var mixed
*/
protected $item_shape = 'EDD\\Logs\\Log';
/** Cache *****************************************************************/
/**
* Group to cache queries and queried items in.
*
* @since 3.0
* @access public
* @var string
*/
protected $cache_group = 'logs';
/** Methods ***************************************************************/
/**
* Sets up the query, based on the query vars passed.
*
* @since 3.0
* @access public
*
* @param string|array $query {
* Optional. Array or query string of query parameters. Default empty.
*
* @type int $id An log ID to only return that log. Default empty.
* @type array $id__in Array of log IDs to include. Default empty.
* @type array $id__not_in Array of log IDs to exclude. Default empty.
* @type string $object_id An object ID to only return those objects. Default empty.
* @type array $object_id__in Array of object IDs to include. Default empty.
* @type array $object_id__not_in Array of IDs object to exclude. Default empty.
* @type string $object_type An object types to only return that type. Default empty.
* @type array $object_type__in Array of object types to include. Default empty.
* @type array $object_type__not_in Array of object types to exclude. Default empty.
* @type string $user_id A user ID to only return those users. Default empty.
* @type array $user_id__in Array of user IDs to include. Default empty.
* @type array $user_id__not_in Array of user IDs to exclude. Default empty.
* @type string $type A type to only return those types. Default empty.
* @type array $type__in Array of types to include. Default empty.
* @type array $type__not_in Array of types to exclude. Default empty.
* @type string $title Title to search by. Default empty.
* @type string $content Content to search by. Default empty.
* @type array $date_query Query all datetime columns together. See WP_Date_Query.
* @type array $date_created_query Date query clauses to limit by. See WP_Date_Query.
* Default null.
* @type array $date_modified_query Date query clauses to limit by. See WP_Date_Query.
* Default null.
* @type bool $count Whether to return a count (true) or array of objects.
* Default false.
* @type string $fields Item fields to return. Accepts any column known names
* or empty (returns an array of complete objects). Default empty.
* @type int $number Limit number of logs to retrieve. Default 100.
* @type int $offset Number of logs to offset the query. Used to build LIMIT clause.
* Default 0.
* @type bool $no_found_rows Whether to disable the `SQL_CALC_FOUND_ROWS` query. Default true.
* @type string|array $orderby Accepts 'id', 'object_id', 'object_type', 'user_id', 'type',
* 'title', 'date_created', and 'date_modified'. Also accepts false,
* an empty array, or 'none' to disable `ORDER BY` clause.
* Default 'id'.
* @type string $order How to order rsults. Accepts 'ASC', 'DESC'. Default 'DESC'.
* @type string $search Search term(s) to retrieve matching logs for. Default empty.
* @type bool $update_cache Whether to prime the cache for found logs. Default false.
* }
*/
public function __construct( $query = array() ) {
parent::__construct( $query );
}
}

View File

@ -0,0 +1,145 @@
<?php
/**
* Note Query Class.
*
* @package EDD
* @subpackage Database\Queries
* @copyright Copyright (c) 2018, Easy Digital Downloads, LLC
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
* @since 3.0
*/
namespace EDD\Database\Queries;
// Exit if accessed directly
defined( 'ABSPATH' ) || exit;
use EDD\Database\Query;
/**
* Class used for querying items.
*
* @since 3.0
*
* @see \EDD\Database\Queries\Note::__construct() for accepted arguments.
*/
class Note extends Query {
/** Table Properties ******************************************************/
/**
* Name of the database table to query.
*
* @since 3.0
* @access public
* @var string
*/
protected $table_name = 'notes';
/**
* String used to alias the database table in MySQL statement.
*
* @since 3.0
* @access public
* @var string
*/
protected $table_alias = 'n';
/**
* Name of class used to setup the database schema
*
* @since 3.0
* @access public
* @var string
*/
protected $table_schema = '\\EDD\\Database\\Schemas\\Notes';
/** Item ******************************************************************/
/**
* Name for a single item
*
* @since 3.0
* @access public
* @var string
*/
protected $item_name = 'note';
/**
* Plural version for a group of items.
*
* @since 3.0
* @access public
* @var string
*/
protected $item_name_plural = 'notes';
/**
* Callback function for turning IDs into objects
*
* @since 3.0
* @access public
* @var mixed
*/
protected $item_shape = '\\EDD\\Notes\\Note';
/** Cache *****************************************************************/
/**
* Group to cache queries and queried items in.
*
* @since 3.0
* @access public
* @var string
*/
protected $cache_group = 'notes';
/** Methods ***************************************************************/
/**
* Sets up the query, based on the query vars passed.
*
* @since 3.0
* @access public
*
* @param string|array $query {
* Optional. Array or query string of query parameters. Default empty.
*
* @type int $id An note ID to only return that note. Default empty.
* @type array $id__in Array of note IDs to include. Default empty.
* @type array $id__not_in Array of note IDs to exclude. Default empty.
* @type string $object_id An object ID to only return those objects. Default empty.
* @type array $object_id__in Array of object IDs to include. Default empty.
* @type array $object_id__not_in Array of IDs object to exclude. Default empty.
* @type string $object_type An object types to only return that type. Default empty.
* @type array $object_type__in Array of object types to include. Default empty.
* @type array $object_type__not_in Array of object types to exclude. Default empty.
* @type string $user_id A user ID to only return those users. Default empty.
* @type array $user_id__in Array of user IDs to include. Default empty.
* @type array $user_id__not_in Array of user IDs to exclude. Default empty.
* @type array $content Content to query by. Default empty.
* @type array $date_query Query all datetime columns together. See WP_Date_Query.
* @type array $date_created_query Date query clauses to limit by. See WP_Date_Query.
* Default null.
* @type array $date_modified_query Date query clauses to limit by. See WP_Date_Query.
* Default null.
* @type bool $count Whether to return a count (true) or array of objects.
* Default false.
* @type string $fields Item fields to return. Accepts any column known names
* or empty (returns an array of complete objects). Default empty.
* @type int $number Limit number of notes to retrieve. Default 100.
* @type int $offset Number of notes to offset the query. Used to build LIMIT clause.
* Default 0.
* @type bool $no_found_rows Whether to disable the `SQL_CALC_FOUND_ROWS` query. Default true.
* @type string|array $orderby Accepts 'id', 'object_id', 'object_type', 'user_id', 'date_created',
* 'date_modified'.
* Also accepts false, an empty array, or 'none' to disable `ORDER BY` clause.
* Default 'id'.
* @type string $order How to order results. Accepts 'ASC', 'DESC'. Default 'DESC'.
* @type string $search Search term(s) to retrieve matching notes for. Default empty.
* @type bool $update_cache Whether to prime the cache for found notes. Default false.
* }
*/
public function __construct( $query = array() ) {
parent::__construct( $query );
}
}

View File

@ -0,0 +1,162 @@
<?php
/**
* Order Address Query Class.
*
* @package EDD
* @subpackage Database\Queries
* @copyright Copyright (c) 2018, Easy Digital Downloads, LLC
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
* @since 3.0
*/
namespace EDD\Database\Queries;
// Exit if accessed directly
defined( 'ABSPATH' ) || exit;
use EDD\Database\Query;
/**
* Class used for querying customer addresses.
*
* @since 3.0
*
* @see \EDD\Database\Queries\Order_Address::__construct() for accepted arguments.
*/
class Order_Address extends Query {
/** Table Properties ******************************************************/
/**
* Name of the database table to query.
*
* @since 3.0
* @access public
* @var string
*/
protected $table_name = 'order_addresses';
/**
* String used to alias the database table in MySQL statement.
*
* @since 3.0
* @access public
* @var string
*/
protected $table_alias = 'oa';
/**
* Name of class used to setup the database schema
*
* @since 3.0
* @access public
* @var string
*/
protected $table_schema = '\\EDD\\Database\\Schemas\\Order_Addresses';
/** Item ******************************************************************/
/**
* Name for a single item
*
* @since 3.0
* @access public
* @var string
*/
protected $item_name = 'order_address';
/**
* Plural version for a group of items.
*
* @since 3.0
* @access public
* @var string
*/
protected $item_name_plural = 'order_addresses';
/**
* Callback function for turning IDs into objects
*
* @since 3.0
* @access public
* @var mixed
*/
protected $item_shape = '\\EDD\\Orders\\Order_Address';
/** Cache *****************************************************************/
/**
* Group to cache queries and queried items in.
*
* @since 3.0
* @access public
* @var string
*/
protected $cache_group = 'order_addresses';
/** Methods ***************************************************************/
/**
* Sets up the customer query, based on the query vars passed.
*
* @since 3.0
* @access public
*
* @param string|array $query {
* Optional. Array or query string of query parameters. Default empty.
*
* @type int $id An address ID to only return that order address. Default empty.
* @type array $id__in Array of order address IDs to include. Default empty.
* @type array $id__not_in Array of order address IDs to exclude. Default empty.
* @type int $order_id A order ID to only return that order. Default empty.
* @type array $order_id__in Array of order IDs to include. Default empty.
* @type array $order_id__not_in Array of order IDs to exclude. Default empty.
* @type string $type An order address type. Default empty.
* @type array $type__in An array of types to include. Default empty.
* @type array $type__not_in An array of types to exclude. Default empty.
* @type string $name A name to only return that address.
* @type array $name__in Array of names to include. Default empty.
* @type array $name__not_in Array of names to exclude. Default empty.
* @type string $address An address line 1 to only return that address. Default empty.
* @type array $address__in Array of addresses to include. Default empty.
* @type array $address__not_in Array of addresses to exclude. Default empty.
* @type string $address2 An address line 2 to only return that address. Default empty.
* @type array $address2__in Array of addresses to include. Default empty.
* @type array $address2__not_in Array of addresses to exclude. Default empty.
* @type string $city A city to only return that address. Default empty.
* @type array $city__in Array of cities to include. Default empty.
* @type array $city__not_in Array of cities to exclude. Default empty.
* @type string $region A region to only return that address. Default empty.
* @type array $region__in Array of regions to include. Default empty.
* @type array $region__not_in Array of regions to exclude. Default empty.
* @type string $postal_code A postal code to only return that address. Default empty.
* @type array $postal_code__in Array of postal codes to include. Default empty.
* @type array $postal_code__not_in Array of postal codes to exclude. Default empty.
* @type string $country A country to only return that address. Default empty.
* @type array $country__in Array of countries to include. Default empty.
* @type array $country__not_in Array of countries to exclude. Default empty.
* @type array $date_query Query all datetime columns together. See WP_Date_Query.
* @type array $date_created_query Date query clauses to limit results by. See WP_Date_Query.
* Default null.
* @type array $date_modified_query Date query clauses to limit by. See WP_Date_Query.
* Default null.
* @type bool $count Whether to return an item count (true) or array of item objects.
* Default false.
* @type string $fields Item fields to return. Accepts any column known names
* or empty (returns an array of complete item objects). Default empty.
* @type int $number Limit number of results to retrieve. Default 100.
* @type int $offset Number of items to offset the query. Used to build LIMIT clause.
* Default 0.
* @type bool $no_found_rows Whether to disable the `SQL_CALC_FOUND_ROWS` query. Default true.
* @type string|array $orderby Accepts 'id', 'type', 'name', 'address', 'address2', 'city',
* 'region', 'postal_code', 'country', 'date_created', 'date_modified'.
* Also accepts false, an empty array, or 'none' to disable `ORDER BY` clause.
* Default 'id'.
* @type string $order How to order results. Accepts 'ASC', 'DESC'. Default 'DESC'.
* @type string $search Search term(s) to retrieve matching results for. Default empty.
* @type bool $update_cache Whether to prime the cache for found items. Default false.
* }
*/
public function __construct( $query = array() ) {
parent::__construct( $query );
}
}

View File

@ -0,0 +1,162 @@
<?php
/**
* Order Adjustment Query Class.
*
* @package EDD
* @subpackage Database\Queries
* @copyright Copyright (c) 2018, Easy Digital Downloads, LLC
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
* @since 3.0
*/
namespace EDD\Database\Queries;
// Exit if accessed directly
defined( 'ABSPATH' ) || exit;
use EDD\Database\Query;
/**
* Class used for querying order order adjustments.
*
* @since 3.0
*
* @see \EDD\Database\Queries\Order_Adjustment::__construct() for accepted arguments.
*/
class Order_Adjustment extends Query {
/** Table Properties ******************************************************/
/**
* Name of the database table to query.
*
* @since 3.0
* @access public
* @var string
*/
protected $table_name = 'order_adjustments';
/**
* String used to alias the database table in MySQL statement.
*
* @since 3.0
* @access public
* @var string
*/
protected $table_alias = 'oa';
/**
* Name of class used to setup the database schema
*
* @since 3.0
* @access public
* @var string
*/
protected $table_schema = '\\EDD\\Database\\Schemas\\Order_Adjustments';
/** Item ******************************************************************/
/**
* Name for a single item
*
* @since 3.0
* @access public
* @var string
*/
protected $item_name = 'order_adjustment';
/**
* Plural version for a group of items.
*
* @since 3.0
* @access public
* @var string
*/
protected $item_name_plural = 'order_adjustments';
/**
* Callback function for turning IDs into objects
*
* @since 3.0
* @access public
* @var mixed
*/
protected $item_shape = '\\EDD\\Orders\\Order_Adjustment';
/** Cache *****************************************************************/
/**
* Group to cache queries and queried items in.
*
* @since 3.0
* @access public
* @var string
*/
protected $cache_group = 'order_adjustments';
/** Methods ***************************************************************/
/**
* Sets up the order query, based on the query vars passed.
*
* @since 3.0
* @access public
*
* @param string|array $query {
* Optional. Array or query string of query parameters. Default empty.
*
* @type int $id An order adjustment ID to only return that item. Default empty.
* @type array $id__in Array of order adjustment IDs to include. Default empty.
* @type array $id__not_in Array of order adjustment IDs to exclude. Default empty.
* @type int $parent A parent ID to only return items with that parent. Default empty.
* @type array $parent__in An array of parent IDs to include. Default empty.
* @type array $parent__not_in An array of parent IDs to exclude. Default empty.
* @type string $object_id An object ID to only return those objects. Default empty.
* @type array $object_id__in Array of object IDs to include. Default empty.
* @type array $object_id__not_in Array of IDs object to exclude. Default empty.
* @type string $object_type An object types to only return that type. Default empty.
* @type array $object_type__in Array of object types to include. Default empty.
* @type array $object_type__not_in Array of object types to exclude. Default empty.
* @type string $type_id A type ID to only return that type. Default empty.
* @type array $type_id__in Array of types IDs to include. Default empty.
* @type array $type_id__not_in Array of types IDS to exclude. Default empty.
* @type string $type A type to only return that type. Default empty.
* @type array $type__in Array of types to include. Default empty.
* @type array $type__not_in Array of types to exclude. Default empty.
* @type string $type_key Filter by type key. Default empty.
* @type array $type_key__in An array of type keys to include. Default empty.
* @type array $type_key__not_in An array of type keys to exclude. Default empty.
* @type float $tax Limit results to those with a specific tax amount. Default empty.
* @type array $tax__in Array of tax amounts to include. Default empty.
* @type array $tax__not_in Array of tax amounts to exclude. Default empty.
* @type float $subtotal Limit results to those affiliated with a given subtotal. Default empty.
* @type array $subtotal__in Array of subtotal amounts to include. Default empty.
* @type array $subtotal__not_in Array of subtotal amounts to exclude. Default empty.
* @type float $total Limit results to those affiliated with a given total. Default empty.
* @type array $total__in Array of totals to include. Default empty.
* @type array $total__not_in Array of totals to exclude. Default empty.
* @type array $date_query Query all datetime columns together. See WP_Date_Query.
* @type array $date_created_query Date query clauses to limit by. See WP_Date_Query.
* Default null.
* @type array $date_modified_query Date query clauses to limit by. See WP_Date_Query.
* Default null.
* @type bool $count Whether to return an item count (true) or array of item objects.
* Default false.
* @type string $fields Item fields to return. Accepts any column known names
* or empty (returns an array of complete item objects). Default empty.
* @type int $number Limit number of order adjustments to retrieve. Default 100.
* @type int $offset Number of order adjustments to offset the query. Used to build LIMIT clause.
* Default 0.
* @type bool $no_found_rows Whether to disable the `SQL_CALC_FOUND_ROWS` query. Default true.
* @type string|array $orderby Accepts 'id', 'object_id', 'object_type', 'type_id', 'type',
* 'type_key', 'subtotal', 'tax', 'total', 'date_created', 'date_modified'.
* Also accepts false, an empty array, or 'none' to disable `ORDER BY` clause.
* Default 'id'.
* @type string $order How to order results. Accepts 'ASC', 'DESC'. Default 'DESC'.
* @type string $search Search term(s) to retrieve matching order adjustments for. Default empty.
* @type bool $update_cache Whether to prime the cache for found order adjustments. Default false.
* }
*/
public function __construct( $query = array() ) {
parent::__construct( $query );
}
}

View File

@ -0,0 +1,178 @@
<?php
/**
* Order Item Query Class.
*
* @package EDD
* @subpackage Database\Queries
* @copyright Copyright (c) 2018, Easy Digital Downloads, LLC
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
* @since 3.0
*/
namespace EDD\Database\Queries;
// Exit if accessed directly
defined( 'ABSPATH' ) || exit;
use EDD\Database\Query;
/**
* Class used for querying order items.
*
* @since 3.0
*
* @see \EDD\Database\Queries\Order_Item::__construct() for accepted arguments.
*/
class Order_Item extends Query {
/** Table Properties ******************************************************/
/**
* Name of the database table to query.
*
* @since 3.0
* @access public
* @var string
*/
protected $table_name = 'order_items';
/**
* String used to alias the database table in MySQL statement.
*
* @since 3.0
* @access public
* @var string
*/
protected $table_alias = 'oi';
/**
* Name of class used to setup the database schema
*
* @since 3.0
* @access public
* @var string
*/
protected $table_schema = '\\EDD\\Database\\Schemas\\Order_Items';
/** Item ******************************************************************/
/**
* Name for a single item
*
* @since 3.0
* @access public
* @var string
*/
protected $item_name = 'order_item';
/**
* Plural version for a group of items.
*
* @since 3.0
* @access public
* @var string
*/
protected $item_name_plural = 'order_items';
/**
* Callback function for turning IDs into objects
*
* @since 3.0
* @access public
* @var mixed
*/
protected $item_shape = '\\EDD\\Orders\\Order_Item';
/** Cache *****************************************************************/
/**
* Group to cache queries and queried items in.
*
* @since 3.0
* @access public
* @var string
*/
protected $cache_group = 'order_items';
/** Methods ***************************************************************/
/**
* Sets up the order query, based on the query vars passed.
*
* @since 3.0
* @access public
*
* @param string|array $query {
* Optional. Array or query string of query parameters. Default empty.
*
* @type int $id An order item ID to only return that item. Default empty.
* @type array $id__in Array of order item IDs to include. Default empty.
* @type array $id__not_in Array of order item IDs to exclude. Default empty.
* @type int $parent A parent ID to only return items with that parent. Default empty.
* @type array $parent__in An array of parent IDs to include. Default empty.
* @type array $parent__not_in An array of parent IDs to exclude. Default empty.
* @type int $order_id An order ID to only return those order items. Default empty.
* @type array $order_id__in Array of order IDs to include. Default empty.
* @type array $order_id__not_in Array of order IDs to exclude. Default empty.
* @type int $product_id A product ID to only return those products. Default empty.
* @type array $product_id__in Array of product IDs to include. Default empty.
* @type array $product_id__not_in Array of product IDs to exclude. Default empty.
* @type string $product_name A product name to filter by. Default empty.
* @type array $product_name__in An array of product names to include. Default empty.
* @type array $product_name__not_in An array of product names to exclude. Default empty.
* @type int $price_id A price ID to only return that price. Default empty.
* @type array $price_id__in Array of price IDs to include. Default empty.
* @type array $price_id__not_in Array of price IDs to exclude. Default empty.
* @type int $cart_index A cart index to only return that index. Default empty.
* @type array $cart_index__in Array of cart index to include. Default empty.
* @type array $cart_index__not_in Array of cart index to exclude. Default empty.
* @type string $type A product type to only return that type. Default empty.
* @type array $type__in Array of product types to include. Default empty.
* @type array $type__not_in Array of product types to exclude. Default empty.
* @type string $status An order statuses to only return that status. Default empty.
* @type array $status__in Array of order statuses to include. Default empty.
* @type array $status__not_in Array of order statuses to exclude. Default empty.
* @type int $quantity A quantity to only return those quantities. Default empty.
* @type array $quantity__in Array of quantities to include. Default empty.
* @type array $quantity__not_in Array of quantities to exclude. Default empty.
* @type float $amount Limit results to those affiliated with a given amount. Default empty.
* @type array $amount__in Array of amounts to include affiliated order items for. Default empty.
* @type array $amount__not_in Array of amounts to exclude affiliated order items for. Default empty.
* @type float $subtotal Limit results to those affiliated with a given subtotal. Default empty.
* @type array $subtotal__in Array of subtotals to include affiliated order items for. Default empty.
* @type array $subtotal__not_in Array of subtotals to exclude affiliated order items for. Default empty.
* @type float $discount Limit results to those affiliated with a given discount. Default empty.
* @type array $discount__in Array of discounts to include affiliated order items for. Default empty.
* @type array $discount__not_in Array of discounts to exclude affiliated order items for. Default empty.
* @type float $tax Limit results to those affiliated with a given tax. Default empty.
* @type array $tax__in Array of taxes to include affiliated order items for. Default empty.
* @type array $tax__not_in Array of taxes to exclude affiliated order items for. Default empty.
* @type float $total Limit results to those affiliated with a given total. Default empty.
* @type array $total__in Array of totals to include affiliated order items for. Default empty.
* @type array $total__not_in Array of totals to exclude affiliated order items for. Default empty.
* @type array $date_query Query all datetime columns together. See WP_Date_Query.
* @type array $date_created_query Date query clauses to limit by. See WP_Date_Query.
* Default null.
* @type array $date_modified_query Date query clauses to limit by. See WP_Date_Query.
* Default null.
* @type bool $count Whether to return a order count (true) or array of order objects.
* Default false.
* @type string $fields Item fields to return. Accepts any column known names
* or empty (returns an array of complete order objects). Default empty.
* @type int $number Limit number of order items to retrieve. Default 100.
* @type int $offset Number of order items to offset the query. Used to build LIMIT clause.
* Default 0.
* @type bool $no_found_rows Whether to disable the `SQL_CALC_FOUND_ROWS` query. Default true.
* @type string|array $orderby Accepts 'id', 'order_id', 'product_id', 'price_id', 'cart_index', 'type'
* 'status', 'quantity', 'amount', 'subtotal', 'discount', 'tax',
* 'total', 'date_created', 'date_modified'.
* Also accepts false, an empty array, or 'none' to disable `ORDER BY` clause.
* Default 'id'.
* @type string $order How to order results. Accepts 'ASC', 'DESC'. Default 'DESC'.
* @type string $search Search term(s) to retrieve matching order items for. Default empty.
* @type bool $update_cache Whether to prime the cache for found order items. Default false.
* }
*/
public function __construct( $query = array() ) {
parent::__construct( $query );
}
}

View File

@ -0,0 +1,154 @@
<?php
/**
* Order Transaction Query Class.
*
* @package EDD
* @subpackage Database\Queries
* @copyright Copyright (c) 2018, Easy Digital Downloads, LLC
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
* @since 3.0
*/
namespace EDD\Database\Queries;
// Exit if accessed directly
defined( 'ABSPATH' ) || exit;
use EDD\Database\Query;
/**
* Class used for querying order transactions.
*
* @since 3.0
*
* @see \EDD\Database\Queries\Order_Transaction::__construct() for accepted arguments.
*/
class Order_Transaction extends Query {
/** Table Properties ******************************************************/
/**
* Name of the database table to query.
*
* @since 3.0
* @access public
* @var string
*/
protected $table_name = 'order_transactions';
/**
* String used to alias the database table in MySQL statement.
*
* @since 3.0
* @access public
* @var string
*/
protected $table_alias = 'ot';
/**
* Name of class used to setup the database schema
*
* @since 3.0
* @access public
* @var string
*/
protected $table_schema = '\\EDD\\Database\\Schemas\\Order_Transactions';
/** Item ******************************************************************/
/**
* Name for a single item.
*
* @since 3.0
* @access public
* @var string
*/
protected $item_name = 'order_transaction';
/**
* Plural version for a group of items.
*
* @since 3.0
* @access public
* @var string
*/
protected $item_name_plural = 'order_transactions';
/**
* Callback function for turning IDs into objects.
*
* @since 3.0
* @access public
* @var mixed
*/
protected $item_shape = '\\EDD\\Orders\\Order_Transaction';
/** Cache *****************************************************************/
/**
* Group to cache queries and queried items in.
*
* @since 3.0
* @access public
* @var string
*/
protected $cache_group = 'order_transactions';
/** Methods ***************************************************************/
/**
* Sets up the order query, based on the query vars passed.
*
* @since 3.0
* @access public
*
* @param string|array $query {
* Optional. Array or query string of query parameters. Default empty.
*
* @type int $id An ID to only return that order transaction. Default empty.
* @type array $id__in Array of order transaction IDs to include. Default empty.
* @type array $id__not_in Array of order transaction IDs to exclude. Default empty.
* @type string $object_id An object ID to only return those objects. Default empty.
* @type array $object_id__in Array of object IDs to include. Default empty.
* @type array $object_id__not_in Array of IDs object to exclude. Default empty.
* @type string $object_type An object type to only return that type. Default empty.
* @type array $object_type__in Array of object types to include. Default empty.
* @type array $object_type__not_in Array of object types to exclude. Default empty.
* @type string $transaction_id A transaction ID to only return that transaction. Default empty.
* @type array $transaction_id__in Array of transaction IDs to include. Default empty.
* @type array $transaction_id__not_in Array of transaction IDs to exclude. Default empty.
* @type string $gateway A gateway to filter by. Default empty.
* @type array $gateway__in Array of gateways to include. Default empty.
* @type array $gateway__not_in Array of gateways to exclude. Default empty.
* @type string $status A status to only return that status. Default empty.
* @type array $status__in Array of statuses to include. Default empty.
* @type array $status__not_in Array of statuses to exclude. Default empty.
* @type float $total Limit results to those affiliated with a given total. Default empty.
* @type array $total__in Array of totals to include affiliated order items for. Default empty.
* @type array $total__not_in Array of totals to exclude affiliated order items for. Default empty.
* @type array $date_query Query all datetime columns together. See WP_Date_Query.
* @type array $date_created_query Date query clauses to limit by. See WP_Date_Query.
* Default null.
* @type array $date_modified_query Date query clauses to limit by. See WP_Date_Query.
* Default null.
* @type bool $count Whether to return an item count (true) or array of item objects.
* Default false.
* @type string $fields Item fields to return. Accepts any column known names
* or empty (returns an array of complete order transactions objects).
* Default empty.
* @type int $number Limit number of order transactions to retrieve. Default 100.
* @type int $offset Number of items to offset the query. Used to build LIMIT clause.
* Default 0.
* @type bool $no_found_rows Whether to disable the `SQL_CALC_FOUND_ROWS` query. Default true.
* @type string|array $orderby Accepts 'id', 'object_id', 'object_type', 'transaction_id', 'gateway',
* 'status', 'total', 'date_created', 'date_modified'.
* Also accepts false, an empty array, or 'none' to disable `ORDER BY` clause.
* Default 'id'.
* @type string $order How to order results. Accepts 'ASC', 'DESC'. Default 'DESC'.
* @type string $search Search term(s) to retrieve matching order transactions for. Default empty.
* @type bool $update_cache Whether to prime the cache for found order transactions. Default false.
* }
*/
public function __construct( $query = array() ) {
parent::__construct( $query );
}
}

View File

@ -0,0 +1,446 @@
<?php
/**
* Order Query Class.
*
* @package EDD
* @subpackage Database\Queries
* @copyright Copyright (c) 2018, Easy Digital Downloads, LLC
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
* @since 3.0
*/
namespace EDD\Database\Queries;
// Exit if accessed directly
defined( 'ABSPATH' ) || exit;
use EDD\Database\Query;
/**
* Class used for querying orders.
*
* @since 3.0
*
* @see \EDD\Database\Queries\Order::__construct() for accepted arguments.
*/
class Order extends Query {
/** Table Properties ******************************************************/
/**
* Name of the database table to query.
*
* @since 3.0
* @access public
* @var string
*/
protected $table_name = 'orders';
/**
* String used to alias the database table in MySQL statement.
*
* @since 3.0
* @access public
* @var string
*/
protected $table_alias = 'o';
/**
* Name of class used to setup the database schema
*
* @since 3.0
* @access public
* @var string
*/
protected $table_schema = '\\EDD\\Database\\Schemas\\Orders';
/** Item ******************************************************************/
/**
* Name for a single item
*
* @since 3.0
* @access public
* @var string
*/
protected $item_name = 'order';
/**
* Plural version for a group of items.
*
* @since 3.0
* @access public
* @var string
*/
protected $item_name_plural = 'orders';
/**
* Callback function for turning IDs into objects
*
* @since 3.0
* @access public
* @var mixed
*/
protected $item_shape = '\\EDD\\Orders\\Order';
/** Cache *****************************************************************/
/**
* Group to cache queries and queried items in.
*
* @since 3.0
* @access public
* @var string
*/
protected $cache_group = 'orders';
/** Methods ***************************************************************/
/**
* Sets up the order query, based on the query vars passed.
*
* @since 3.0
* @access public
*
* @param string|array $query {
* Optional. Array or query string of order query parameters. Default empty.
*
* @type int $id An order ID to only return that order. Default empty.
* @type array $id__in Array of order IDs to include. Default empty.
* @type array $id__not_in Array of order IDs to exclude. Default empty.
* @type int $parent A parent ID to only return orders with that parent. Default empty.
* @type array $parent__in An array of parent IDs to include. Default empty.
* @type array $parent__not_in An array of parent IDs to exclude. Default empty.
* @type string $order_number An order number to only return that number. Default empty.
* @type array $order_number__in Array of order numbers to include. Default empty.
* @type array $order_number__not_in Array of order numbers to exclude. Default empty.
* @type string $status An order status to only return that status. Default empty.
* @type array $status__in Array of order statuses to include. Default empty.
* @type array $status__not_in Array of order statuses to exclude. Default empty.
* @type string $type An order type to only return that type. Default empty.
* @type array $type__in Array of order types to include. Default empty.
* @type array $type__not_in Array of order types to exclude. Default empty.
* @type int $user_id A user ID to only return that user. Default empty.
* @type array $user_id__in Array of user IDs to include. Default empty.
* @type array $user_id__not_in Array of user IDs to exclude. Default empty.
* @type int $customer_id A customer ID to only return that customer. Default empty.
* @type array $customer_id__in Array of customer IDs to include. Default empty.
* @type array $customer_id__not_in Array of customer IDs to exclude. Default empty.
* @type string $email Limit results to those affiliated with a given email. Default empty.
* @type array $email__in Array of email to include affiliated orders for. Default empty.
* @type array $email__not_in Array of email to exclude affiliated orders for. Default empty.
* @type string $ip A filter IP address to only include orders with that IP. Default empty.
* @type array $ip__in An array of IPs to include. Default empty.
* @type array $ip__not_in An array of IPs to exclude. Default empty.
* @type string $gateway Limit results to those affiliated with a given gateway. Default empty.
* @type array $gateway__in Array of gateways to include affiliated orders for. Default empty.
* @type array $gateway__not_in Array of gateways to exclude affiliated orders for. Default empty.
* @type string $mode Limit results to those affiliated with a given mode. Default empty.
* @type array $mode__in Array of modes to include affiliated orders for. Default empty.
* @type array $mode__not_in Array of modes to exclude affiliated orders for. Default empty.
* @type string $currency Limit results to those affiliated with a given currency. Default empty.
* @type array $currency__in Array of currencies to include affiliated orders for. Default empty.
* @type array $currency__not_in Array of currencies to exclude affiliated orders for. Default empty.
* @type string $payment_key Limit results to those affiliated with a given payment key. Default empty.
* @type array $payment_key__in Array of payment keys to include affiliated orders for. Default empty.
* @type array $payment_key__not_in Array of payment keys to exclude affiliated orders for. Default empty.
* @type int $tax_rate_id A tax rate ID to filter by. Default empty.
* @type array $tax_rate_id__in Array of tax rate IDs to filter by. Default empty.
* @type array $tax_rate_id__not_in Array of tax rate IDs to exclude orders for. Default empty.
* @type array $date_query Query all datetime columns together. See WP_Date_Query.
* @type array $date_created_query Date query clauses to limit orders by. See WP_Date_Query.
* Default null.
* @type array $date_completed_query Date query clauses to limit orders by. See WP_Date_Query.
* Default null.
* @type array $date_refundable_query Date query clauses to limit orders by. See WP_Date_Query.
* Default null.
* @type bool $count Whether to return a order count (true) or array of order objects.
* Default false.
* @type string $fields Item fields to return. Accepts any column known names
* or empty (returns an array of complete order objects). Default empty.
* @type int $number Limit number of orders to retrieve. Default 100.
* @type int $offset Number of orders to offset the query. Used to build LIMIT clause.
* Default 0.
* @type bool $no_found_rows Whether to disable the `SQL_CALC_FOUND_ROWS` query. Default true.
* @type string|array $orderby Accepts 'id', 'parent', 'order_number', 'status', 'type',
* 'user_id', 'customer_id', 'email', 'ip', 'gateway',
* 'tax_rate_id', 'subtotal', 'discount', 'tax', 'total',
* 'date_created', 'date_modified', 'date_completed', 'date_refundable'.
* Also accepts false, an empty array, or 'none' to disable `ORDER BY` clause.
* Default 'id'.
* @type string $order How to order retrieved orders. Accepts 'ASC', 'DESC'. Default 'DESC'.
* @type string $search Search term(s) to retrieve matching orders for. Default empty.
* @type bool $update_cache Whether to prime the cache for found orders. Default false.
* @type string $country Limit results to those affiliated with a given country. Default empty.
* @type string $region Limit results to those affiliated with a given region. Default empty.
* @type int $product_id Filter by product ID. Default empty.
* @type int $product_price_id Filter by product price ID. Default empty.
* @type string $txn Filter by transaction ID.
* @type int $discount_id Filter by discount code.
* }
*/
public function __construct( $query = array() ) {
// In EDD 3.0 we converted our use of the status 'publish' to 'complete', this accounts for queries using publish.
if ( isset( $query['status'] ) ) {
if ( is_array( $query['status'] ) && in_array( 'publish', $query['status'], true ) ) {
foreach ( $query['status'] as $key => $status ) {
if ( 'publish' === $status ) {
unset( $query['status'][ $key ] );
}
}
$query['status'][] = 'complete';
} elseif ( 'publish' === $query['status'] ) {
$query['status'] = 'complete';
}
}
parent::__construct( $query );
}
/**
* Set up the filter callback to add the country and region from the order addresses table.
*
* @since 3.0
* @access public
*
* @param string|array $query See Order::__construct() for accepted arguments.
*
* @see Order::__construct()
*/
public function query( $query = array() ) {
$query_clauses_filters = $this->get_query_clauses_filters( $query );
foreach ( $query_clauses_filters as $filter ) {
if ( $filter['condition'] ) {
add_filter( 'edd_orders_query_clauses', array( $this, $filter['callback'] ) );
}
}
$result = parent::query( $query );
foreach ( $query_clauses_filters as $filter ) {
if ( $filter['condition'] ) {
remove_filter( 'edd_orders_query_clauses', array( $this, $filter['callback'] ) );
}
}
return $result;
}
/**
* Filter the query clause to add the country and region from the order addresses table.
*
* @since 3.0
* @access public
*
* @param string|array $clauses The clauses which will generate the final SQL query.
*/
public function query_by_country( $clauses ) {
if ( empty( $this->query_vars['country'] ) || 'all' === $this->query_vars['country'] ) {
return $clauses;
}
global $wpdb;
$primary_alias = $this->table_alias;
$primary_column = parent::get_primary_column_name();
$order_addresses_query = new \EDD\Database\Queries\Order_Address();
$join_alias = $order_addresses_query->table_alias;
// Filter by the order address's region (state/province/etc)..
if ( ! empty( $this->query_vars['region'] ) && 'all' !== $this->query_vars['region'] ) {
$location_join = $wpdb->prepare(
" INNER JOIN {$order_addresses_query->table_name} {$join_alias} ON ({$primary_alias}.{$primary_column} = {$join_alias}.order_id AND {$join_alias}.country = %s AND {$join_alias}.region = %s)",
$this->query_vars['country'],
$this->query_vars['region']
);
// Add the region to the query var defaults.
$this->query_var_defaults['region'] = $this->query_vars['region'];
// Filter only by the country, not by region.
} else {
$location_join = $wpdb->prepare(
" INNER JOIN {$order_addresses_query->table_name} {$join_alias} ON ({$primary_alias}.{$primary_column} = {$join_alias}.order_id AND {$join_alias}.country = %s)",
$this->query_vars['country']
);
// Add the country to the query var defaults.
$this->query_var_defaults['country'] = $this->query_vars['country'];
}
// Add the customized join to the query.
$clauses['join'] .= ' ' . $location_join;
return $clauses;
}
/**
* Filter the query clause to filter by product ID.
*
* @since 3.0
* @access public
*
* @param string|array $clauses The clauses which will generate the final SQL query.
*/
public function query_by_product( $clauses ) {
if (
empty( $this->query_vars['product_id'] ) &&
( ! isset( $this->query_vars['product_price_id'] ) || ! is_numeric( $this->query_vars['product_price_id'] ) )
) {
return $clauses;
}
global $wpdb;
$primary_column = parent::get_primary_column_name();
$order_items_query = new Order_Item();
// Build up our conditions.
$conditions = array();
foreach ( array( 'product_id' => 'product_id', 'product_price_id' => 'price_id' ) as $query_var => $db_col ) {
if ( isset( $this->query_vars[ $query_var ] ) && is_numeric( $this->query_vars[ $query_var ] ) ) {
$conditions[] = $wpdb->prepare(
"AND {$order_items_query->table_alias}.{$db_col} = %d",
absint( $this->query_vars[ $query_var ] )
);
}
}
$conditions = implode( ' ', $conditions );
$clauses['join'] .= " INNER JOIN {$order_items_query->table_name} {$order_items_query->table_alias} ON(
{$this->table_alias}.{$primary_column} = {$order_items_query->table_alias}.order_id
{$conditions}
)";
return $clauses;
}
/**
* Filter the query clause to filter by transaction ID.
*
* @since 3.0.2
* @param string $clauses
* @return string
*/
public function query_by_txn( $clauses ) {
if ( empty( $this->query_vars['txn'] ) ) {
return $clauses;
}
global $wpdb;
$primary_column = parent::get_primary_column_name();
$order_transaction_query = new Order_Transaction();
$clauses['join'] .= $wpdb->prepare(
" INNER JOIN {$order_transaction_query->table_name} {$order_transaction_query->table_alias}
ON( {$this->table_alias}.{$primary_column} = {$order_transaction_query->table_alias}.object_id
AND {$order_transaction_query->table_alias}.transaction_id = %s )",
sanitize_text_field( $this->query_vars['txn'] )
);
return $clauses;
}
/**
* Filter the query clause to filter by discount ID.
*
* @since 3.0.2
* @param string $clauses
* @return string
*/
public function query_by_discount_id( $clauses ) {
if ( empty( $this->query_vars['discount_id'] ) ) {
return $clauses;
}
global $wpdb;
$primary_column = parent::get_primary_column_name();
$order_adjustment_query = new Order_Adjustment();
$clauses['join'] .= $wpdb->prepare(
" INNER JOIN {$order_adjustment_query->table_name} {$order_adjustment_query->table_alias}
ON( {$this->table_alias}.{$primary_column} = {$order_adjustment_query->table_alias}.object_id
AND {$order_adjustment_query->table_alias}.type_id = %d )",
absint( $this->query_vars['discount_id'] )
);
return $clauses;
}
/**
* Set the query var defaults for country and region.
*
* @since 3.0
* @access public
*/
protected function set_query_var_defaults() {
parent::set_query_var_defaults();
$this->query_var_defaults['country'] = false;
$this->query_var_defaults['region'] = false;
$this->query_var_defaults['product_id'] = false;
$this->query_var_defaults['product_product_id'] = false;
}
/**
* Adds an item to the database
*
* @since 3.0
*
* @param array $data
* @return false|int Returns the item ID on success; false on failure.
*/
public function add_item( $data = array() ) {
// Every order should have a currency assigned.
if ( empty( $data['currency'] ) ) {
$data['currency'] = edd_get_currency();
}
// If the payment key isn't already created, generate it.
if ( empty( $data['payment_key'] ) ) {
$email = ! empty( $data['email'] ) ? $data['email'] : '';
$data['payment_key'] = edd_generate_order_payment_key( $email );
}
// Add the IP address if it hasn't been already.
if ( empty( $data['ip'] ) ) {
$data['ip'] = edd_get_ip();
}
return parent::add_item( $data );
}
/**
* Get the array of possible query clause filters.
*
* @since 3.0.2
* @param array $query
* @return array
*/
private function get_query_clauses_filters( $query ) {
return array(
array(
'condition' => ! empty( $query['country'] ),
'callback' => 'query_by_country',
),
array(
'condition' => ! empty( $query['product_id'] ) || ( isset( $query['product_price_id'] ) && is_numeric( $query['product_price_id'] ) ),
'callback' => 'query_by_product',
),
array(
'condition' => ! empty( $query['txn'] ),
'callback' => 'query_by_txn',
),
array(
'condition' => ! empty( $query['discount_id'] ),
'callback' => 'query_by_discount_id',
),
);
}
}