initial commit

This commit is contained in:
2021-12-10 12:03:04 +00:00
commit c46c7ddbf0
3643 changed files with 582794 additions and 0 deletions

View File

@ -0,0 +1,50 @@
<?php
/**
* Order Data Store Interface
*
* @version 3.0.0
* @package WooCommerce\Interfaces
*/
/**
* WC Order Data Store Interface
*
* Functions that must be defined by order store classes.
*
* @version 3.0.0
*/
interface WC_Abstract_Order_Data_Store_Interface {
/**
* Read order items of a specific type from the database for this order.
*
* @param WC_Order $order Order object.
* @param string $type Order item type.
* @return array
*/
public function read_items( $order, $type );
/**
* Remove all line items (products, coupons, shipping, taxes) from the order.
*
* @param WC_Order $order Order object.
* @param string $type Order item type. Default null.
*/
public function delete_items( $order, $type = null );
/**
* Get token ids for an order.
*
* @param WC_Order $order Order object.
* @return array
*/
public function get_payment_token_ids( $order );
/**
* Update token ids for an order.
*
* @param WC_Order $order Order object.
* @param array $token_ids Token IDs.
*/
public function update_payment_token_ids( $order, $token_ids );
}

View File

@ -0,0 +1,58 @@
<?php
/**
* Coupon Data Store Interface
*
* @version 3.0.0
* @package WooCommerce\Interfaces
*/
/**
* WC Coupon Data Store Interface
*
* Functions that must be defined by coupon store classes.
*
* @version 3.0.0
*/
interface WC_Coupon_Data_Store_Interface {
/**
* Increase usage count for current coupon.
*
* @param WC_Coupon $coupon Coupon object.
* @param string $used_by Either user ID or billing email.
*/
public function increase_usage_count( &$coupon, $used_by = '' );
/**
* Decrease usage count for current coupon.
*
* @param WC_Coupon $coupon Coupon object.
* @param string $used_by Either user ID or billing email.
*/
public function decrease_usage_count( &$coupon, $used_by = '' );
/**
* Get the number of uses for a coupon by user ID.
*
* @param WC_Coupon $coupon Coupon object.
* @param int $user_id User ID.
* @return int
*/
public function get_usage_by_user_id( &$coupon, $user_id );
/**
* Return a coupon code for a specific ID.
*
* @param int $id Coupon ID.
* @return string Coupon Code.
*/
public function get_code_by_id( $id );
/**
* Return an array of IDs for for a specific coupon code.
* Can return multiple to check for existence.
*
* @param string $code Coupon code.
* @return array Array of IDs.
*/
public function get_ids_by_code( $code );
}

View File

@ -0,0 +1,41 @@
<?php
/**
* Customer Data Store Interface
*
* @version 3.0.0
* @package WooCommerce\Interface
*/
/**
* WC Customer Data Store Interface
*
* Functions that must be defined by customer store classes.
*
* @version 3.0.0
*/
interface WC_Customer_Data_Store_Interface {
/**
* Gets the customers last order.
*
* @param WC_Customer $customer Customer object.
* @return WC_Order|false
*/
public function get_last_order( &$customer );
/**
* Return the number of orders this customer has.
*
* @param WC_Customer $customer Customer object.
* @return integer
*/
public function get_order_count( &$customer );
/**
* Return how much money this customer has spent.
*
* @param WC_Customer $customer Customer object.
* @return float
*/
public function get_total_spent( &$customer );
}

View File

@ -0,0 +1,70 @@
<?php
/**
* Customer Download Data Store Interface
*
* @version 3.0.0
* @package WooCommerce\Interface
*/
/**
* WC Customer Download Data Store Interface.
*
* @version 3.0.0
*/
interface WC_Customer_Download_Data_Store_Interface {
/**
* Method to delete a download permission from the database by ID.
*
* @param int $id Download Permission ID.
*/
public function delete_by_id( $id );
/**
* Method to delete a download permission from the database by order ID.
*
* @param int $id Order ID.
*/
public function delete_by_order_id( $id );
/**
* Method to delete a download permission from the database by download ID.
*
* @param int $id Download ID.
*/
public function delete_by_download_id( $id );
/**
* Get array of download ids by specified args.
*
* @param array $args Arguments.
* @return array of WC_Customer_Download
*/
public function get_downloads( $args = array() );
/**
* Update download ids if the hash changes.
*
* @param int $product_id Product ID.
* @param string $old_id Old ID.
* @param string $new_id New ID.
*/
public function update_download_id( $product_id, $old_id, $new_id );
/**
* Get a customers downloads.
*
* @param int $customer_id Customer ID.
* @return array
*/
public function get_downloads_for_customer( $customer_id );
/**
* Update user prop for downloads based on order id.
*
* @param int $order_id Order ID.
* @param int $customer_id Customer ID.
* @param string $email Email Address.
*/
public function update_user_by_order_id( $order_id, $customer_id, $email );
}

View File

@ -0,0 +1,32 @@
<?php
/**
* Customer Download Log Data Store Interface
*
* @version 3.3.0
* @package WooCommerce\Interface
*/
/**
* WC Customer Download Log Data Store Interface.
*
* @version 3.3.0
*/
interface WC_Customer_Download_Log_Data_Store_Interface {
/**
* Get array of download log ids by specified args.
*
* @param array $args Arguments.
* @return array of WC_Customer_Download_Log
*/
public function get_download_logs( $args = array() );
/**
* Get logs for a specific download permission.
*
* @param int $permission_id Permission ID.
* @return array
*/
public function get_download_logs_for_permission( $permission_id );
}

View File

@ -0,0 +1,72 @@
<?php
/**
* WooCommerce Importer Interface
*
* @package WooCommerce\Interface
* @version 3.1.0
*/
/**
* WC_Importer_Interface class.
*/
interface WC_Importer_Interface {
/**
* Process importation.
* Returns an array with the imported and failed items.
* 'imported' contains a list of IDs.
* 'failed' contains a list of WP_Error objects.
*
* Example:
* ['imported' => [], 'failed' => []]
*
* @return array
*/
public function import();
/**
* Get file raw keys.
*
* CSV - Headers.
* XML - Element names.
* JSON - Keys
*
* @return array
*/
public function get_raw_keys();
/**
* Get file mapped headers.
*
* @return array
*/
public function get_mapped_keys();
/**
* Get raw data.
*
* @return array
*/
public function get_raw_data();
/**
* Get parsed data.
*
* @return array
*/
public function get_parsed_data();
/**
* Get file pointer position from the last read.
*
* @return int
*/
public function get_file_position();
/**
* Get file pointer position as a percentage of file size.
*
* @return int
*/
public function get_percent_complete();
}

View File

@ -0,0 +1,29 @@
<?php
/**
* Log Handler Interface
*
* @version 3.3.0
* @package WooCommerce\Interface
*/
/**
* WC Log Handler Interface
*
* Functions that must be defined to correctly fulfill log handler API.
*
* @version 3.3.0
*/
interface WC_Log_Handler_Interface {
/**
* Handle a log entry.
*
* @param int $timestamp Log timestamp.
* @param string $level emergency|alert|critical|error|warning|notice|info|debug.
* @param string $message Log message.
* @param array $context Additional information for log handlers.
*
* @return bool False if value was not handled and true if value was handled.
*/
public function handle( $timestamp, $level, $message, $context );
}

View File

@ -0,0 +1,135 @@
<?php
/**
* Logger Interface
*
* @version 3.0.0
* @package WooCommerce\Interface
*/
/**
* WC Logger Interface
*
* Functions that must be defined to correctly fulfill logger API.
*
* @version 3.0.0
*/
interface WC_Logger_Interface {
/**
* Add a log entry.
*
* This is not the preferred method for adding log messages. Please use log() or any one of
* the level methods (debug(), info(), etc.). This method may be deprecated in the future.
*
* @param string $handle File handle.
* @param string $message Log message.
* @param string $level Log level.
*
* @return bool True if log was added, otherwise false.
*/
public function add( $handle, $message, $level = WC_Log_Levels::NOTICE );
/**
* Add a log entry.
*
* @param string $level One of the following:
* 'emergency': System is unusable.
* 'alert': Action must be taken immediately.
* 'critical': Critical conditions.
* 'error': Error conditions.
* 'warning': Warning conditions.
* 'notice': Normal but significant condition.
* 'info': Informational messages.
* 'debug': Debug-level messages.
* @param string $message Log message.
* @param array $context Optional. Additional information for log handlers.
*/
public function log( $level, $message, $context = array() );
/**
* Adds an emergency level message.
*
* System is unusable.
*
* @param string $message Log message.
* @param array $context Optional. Additional information for log handlers.
*/
public function emergency( $message, $context = array() );
/**
* Adds an alert level message.
*
* Action must be taken immediately.
* Example: Entire website down, database unavailable, etc.
*
* @param string $message Log message.
* @param array $context Optional. Additional information for log handlers.
*/
public function alert( $message, $context = array() );
/**
* Adds a critical level message.
*
* Critical conditions.
* Example: Application component unavailable, unexpected exception.
*
* @param string $message Log message.
* @param array $context Optional. Additional information for log handlers.
*/
public function critical( $message, $context = array() );
/**
* Adds an error level message.
*
* Runtime errors that do not require immediate action but should typically be logged
* and monitored.
*
* @param string $message Log message.
* @param array $context Optional. Additional information for log handlers.
*/
public function error( $message, $context = array() );
/**
* Adds a warning level message.
*
* Exceptional occurrences that are not errors.
*
* Example: Use of deprecated APIs, poor use of an API, undesirable things that are not
* necessarily wrong.
*
* @param string $message Log message.
* @param array $context Optional. Additional information for log handlers.
*/
public function warning( $message, $context = array() );
/**
* Adds a notice level message.
*
* Normal but significant events.
*
* @param string $message Log message.
* @param array $context Optional. Additional information for log handlers.
*/
public function notice( $message, $context = array() );
/**
* Adds a info level message.
*
* Interesting events.
* Example: User logs in, SQL logs.
*
* @param string $message Log message.
* @param array $context Optional. Additional information for log handlers.
*/
public function info( $message, $context = array() );
/**
* Adds a debug level message.
*
* Detailed debug information.
*
* @param string $message Log message.
* @param array $context Optional. Additional information for log handlers.
*/
public function debug( $message, $context = array() );
}

View File

@ -0,0 +1,78 @@
<?php
/**
* Object Data Store Interface
*
* @version 3.0.0
* @package WooCommerce\Interface
*/
/**
* WC Data Store Interface
*
* @version 3.0.0
*/
interface WC_Object_Data_Store_Interface {
/**
* Method to create a new record of a WC_Data based object.
*
* @param WC_Data $data Data object.
*/
public function create( &$data );
/**
* Method to read a record. Creates a new WC_Data based object.
*
* @param WC_Data $data Data object.
*/
public function read( &$data );
/**
* Updates a record in the database.
*
* @param WC_Data $data Data object.
*/
public function update( &$data );
/**
* Deletes a record from the database.
*
* @param WC_Data $data Data object.
* @param array $args Array of args to pass to the delete method.
* @return bool result
*/
public function delete( &$data, $args = array() );
/**
* Returns an array of meta for an object.
*
* @param WC_Data $data Data object.
* @return array
*/
public function read_meta( &$data );
/**
* Deletes meta based on meta ID.
*
* @param WC_Data $data Data object.
* @param object $meta Meta object (containing at least ->id).
* @return array
*/
public function delete_meta( &$data, $meta );
/**
* Add new piece of meta.
*
* @param WC_Data $data Data object.
* @param object $meta Meta object (containing ->key and ->value).
* @return int meta ID
*/
public function add_meta( &$data, $meta );
/**
* Update meta.
*
* @param WC_Data $data Data object.
* @param object $meta Meta object (containing ->id, ->key and ->value).
*/
public function update_meta( &$data, $meta );
}

View File

@ -0,0 +1,137 @@
<?php
/**
* Order Data Store Interface
*
* @version 3.0.0
* @package WooCommerce\Interface
*/
/**
* WC Order Data Store Interface
*
* Functions that must be defined by order store classes.
*
* @version 3.0.0
*/
interface WC_Order_Data_Store_Interface {
/**
* Get amount already refunded.
*
* @param WC_Order $order Order object.
* @return float
*/
public function get_total_refunded( $order );
/**
* Get the total tax refunded.
*
* @param WC_Order $order Order object.
* @return float
*/
public function get_total_tax_refunded( $order );
/**
* Get the total shipping refunded.
*
* @param WC_Order $order Order object.
* @return float
*/
public function get_total_shipping_refunded( $order );
/**
* Finds an Order ID based on an order key.
*
* @param string $order_key An order key has generated by.
* @return int The ID of an order, or 0 if the order could not be found.
*/
public function get_order_id_by_order_key( $order_key );
/**
* Return count of orders with a specific status.
*
* @param string $status Order status.
* @return int
*/
public function get_order_count( $status );
/**
* Get all orders matching the passed in args.
*
* @see wc_get_orders()
* @param array $args Arguments.
* @return array of orders
*/
public function get_orders( $args = array() );
/**
* Get unpaid orders after a certain date,
*
* @param int $date timestamp.
* @return array
*/
public function get_unpaid_orders( $date );
/**
* Search order data for a term and return ids.
*
* @param string $term Term name.
* @return array of ids
*/
public function search_orders( $term );
/**
* Gets information about whether permissions were generated yet.
*
* @param WC_Order $order Order object.
* @return bool
*/
public function get_download_permissions_granted( $order );
/**
* Stores information about whether permissions were generated yet.
*
* @param WC_Order $order Order object.
* @param bool $set If should set.
*/
public function set_download_permissions_granted( $order, $set );
/**
* Gets information about whether sales were recorded.
*
* @param WC_Order $order Order object.
* @return bool
*/
public function get_recorded_sales( $order );
/**
* Stores information about whether sales were recorded.
*
* @param WC_Order $order Order object.
* @param bool $set If should set.
*/
public function set_recorded_sales( $order, $set );
/**
* Gets information about whether coupon counts were updated.
*
* @param WC_Order $order Order object.
* @return bool
*/
public function get_recorded_coupon_usage_counts( $order );
/**
* Stores information about whether coupon counts were updated.
*
* @param WC_Order $order Order object.
* @param bool $set If should set.
*/
public function set_recorded_coupon_usage_counts( $order, $set );
/**
* Get the order type based on Order ID.
*
* @param int $order_id Order ID.
* @return string
*/
public function get_order_type( $order_id );
}

View File

@ -0,0 +1,102 @@
<?php
/**
* Order Item Data Store Interface
*
* @version 3.0.0
* @package WooCommerce\Interface
*/
/**
* WC Order Item Data Store Interface
*
* Functions that must be defined by the order item data store (for functions).
*
* @version 3.0.0
*/
interface WC_Order_Item_Data_Store_Interface {
/**
* Add an order item to an order.
*
* @param int $order_id Order ID.
* @param array $item order_item_name and order_item_type.
* @return int Order Item ID
*/
public function add_order_item( $order_id, $item );
/**
* Update an order item.
*
* @param int $item_id Item ID.
* @param array $item order_item_name or order_item_type.
* @return boolean
*/
public function update_order_item( $item_id, $item );
/**
* Delete an order item.
*
* @param int $item_id Item ID.
*/
public function delete_order_item( $item_id );
/**
* Update term meta.
*
* @param int $item_id Item ID.
* @param string $meta_key Meta key.
* @param mixed $meta_value Meta value.
* @param string $prev_value Previous value (default: '').
* @return bool
*/
public function update_metadata( $item_id, $meta_key, $meta_value, $prev_value = '' );
/**
* Add term meta.
*
* @param int $item_id Item ID.
* @param string $meta_key Meta key.
* @param mixed $meta_value Meta value.
* @param bool $unique Unique? (default: false).
* @return int New row ID or 0
*/
public function add_metadata( $item_id, $meta_key, $meta_value, $unique = false );
/**
* Delete term meta.
*
* @param int $item_id Item ID.
* @param string $meta_key Meta key.
* @param string $meta_value Meta value (default: '').
* @param bool $delete_all Delete all matching entries? (default: false).
* @return bool
*/
public function delete_metadata( $item_id, $meta_key, $meta_value = '', $delete_all = false );
/**
* Get term meta.
*
* @param int $item_id Item ID.
* @param string $key Meta key.
* @param bool $single Store as single value and not serialised (default: true).
* @return mixed
*/
public function get_metadata( $item_id, $key, $single = true );
/**
* Get order ID by order item ID.
*
* @param int $item_id Item ID.
* @return int
*/
public function get_order_id_by_order_item_id( $item_id );
/**
* Get the order item type based on Item ID.
*
* @param int $item_id Item ID.
* @return string
*/
public function get_order_item_type( $item_id );
}

View File

@ -0,0 +1,25 @@
<?php
/**
* Order Item Product Data Store Interface
*
* @version 3.0.0
* @package WooCommerce\Interface
*/
/**
* WC Order Item Data Store Interface
*
* Functions that must be defined by order item store classes.
*
* @version 3.0.0
*/
interface WC_Order_Item_Product_Data_Store_Interface {
/**
* Get a list of download IDs for a specific item from an order.
*
* @param WC_Order_Item $item Item object.
* @param WC_Order $order Order object.
* @return array
*/
public function get_download_ids( $item, $order );
}

View File

@ -0,0 +1,24 @@
<?php
/**
* Order Item Type Data Store Interface
*
* @version 3.0.0
* @package WooCommerce\Interface
*/
/**
* WC Order Item Data Store Interface
*
* Functions that must be defined by order item store classes.
*
* @version 3.0.0
*/
interface WC_Order_Item_Type_Data_Store_Interface {
/**
* Saves an item's data to the database / item meta.
* Ran after both create and update, so $item->get_id() will be set.
*
* @param WC_Order_Item $item Item object.
*/
public function save_item_data( &$item );
}

View File

@ -0,0 +1,17 @@
<?php
/**
* Order Refund Data Store Interface
*
* @version 3.0.0
* @package WooCommerce\Interface
*/
/**
* WC Order Refund Data Store Interface
*
* Functions that must be defined by order store classes.
*
* @version 3.0.0
*/
interface WC_Order_Refund_Data_Store_Interface {
}

View File

@ -0,0 +1,71 @@
<?php
/**
* Payment Token Data Store Interface
*
* @version 3.0.0
* @package WooCommerce\Interface
*/
/**
* WC Payment Token Data Store Interface
*
* Functions that must be defined by payment token store classes.
*
* @version 3.0.0
*/
interface WC_Payment_Token_Data_Store_Interface {
/**
* Returns an array of objects (stdObject) matching specific token criteria.
* Accepts token_id, user_id, gateway_id, and type.
* Each object should contain the fields token_id, gateway_id, token, user_id, type, is_default.
*
* @param array $args Arguments.
* @return array
*/
public function get_tokens( $args );
/**
* Returns an stdObject of a token for a user's default token.
* Should contain the fields token_id, gateway_id, token, user_id, type, is_default.
*
* @param int $user_id User ID.
* @return object
*/
public function get_users_default_token( $user_id );
/**
* Returns an stdObject of a token.
* Should contain the fields token_id, gateway_id, token, user_id, type, is_default.
*
* @param int $token_id Token ID.
* @return object
*/
public function get_token_by_id( $token_id );
/**
* Returns metadata for a specific payment token.
*
* @param int $token_id Token ID.
* @return array
*/
public function get_metadata( $token_id );
/**
* Get a token's type by ID.
*
* @param int $token_id Token ID.
* @return string
*/
public function get_token_type_by_id( $token_id );
/**
* Update's a tokens default status in the database. Used for quickly
* looping through tokens and setting their statuses instead of creating a bunch
* of objects.
*
* @param int $token_id Token ID.
* @param bool $status If should update status.
* @return string
*/
public function set_default_status( $token_id, $status = true );
}

View File

@ -0,0 +1,139 @@
<?php
/**
* Product Data Store Interface
*
* @version 3.0.0
* @package WooCommerce\Interface
*/
/**
* WC Product Data Store Interface
*
* Functions that must be defined by product store classes.
*
* @version 3.0.0
*/
interface WC_Product_Data_Store_Interface {
/**
* Returns an array of on sale products, as an array of objects with an
* ID and parent_id present. Example: $return[0]->id, $return[0]->parent_id.
*
* @return array
*/
public function get_on_sale_products();
/**
* Returns a list of product IDs ( id as key => parent as value) that are
* featured. Uses get_posts instead of wc_get_products since we want
* some extra meta queries and ALL products (posts_per_page = -1).
*
* @return array
*/
public function get_featured_product_ids();
/**
* Check if product sku is found for any other product IDs.
*
* @param int $product_id Product ID.
* @param string $sku SKU.
* @return bool
*/
public function is_existing_sku( $product_id, $sku );
/**
* Return product ID based on SKU.
*
* @param string $sku SKU.
* @return int
*/
public function get_product_id_by_sku( $sku );
/**
* Returns an array of IDs of products that have sales starting soon.
*
* @return array
*/
public function get_starting_sales();
/**
* Returns an array of IDs of products that have sales which are due to end.
*
* @return array
*/
public function get_ending_sales();
/**
* Find a matching (enabled) variation within a variable product.
*
* @param WC_Product $product Variable product object.
* @param array $match_attributes Array of attributes we want to try to match.
* @return int Matching variation ID or 0.
*/
public function find_matching_product_variation( $product, $match_attributes = array() );
/**
* Make sure all variations have a sort order set so they can be reordered correctly.
*
* @param int $parent_id Parent ID.
*/
public function sort_all_product_variations( $parent_id );
/**
* Return a list of related products (using data like categories and IDs).
*
* @param array $cats_array List of categories IDs.
* @param array $tags_array List of tags IDs.
* @param array $exclude_ids Excluded IDs.
* @param int $limit Limit of results.
* @param int $product_id Product ID.
* @return array
*/
public function get_related_products( $cats_array, $tags_array, $exclude_ids, $limit, $product_id );
/**
* Update a product's stock amount directly.
*
* Uses queries rather than update_post_meta so we can do this in one query (to avoid stock issues).
*
* @param int $product_id_with_stock Product ID.
* @param int|null $stock_quantity Stock quantity to update to.
* @param string $operation Either set, increase or decrease.
*/
public function update_product_stock( $product_id_with_stock, $stock_quantity = null, $operation = 'set' );
/**
* Update a product's sale count directly.
*
* Uses queries rather than update_post_meta so we can do this in one query for performance.
*
* @param int $product_id Product ID.
* @param int|null $quantity Stock quantity to use for update.
* @param string $operation Either set, increase or decrease.
*/
public function update_product_sales( $product_id, $quantity = null, $operation = 'set' );
/**
* Get shipping class ID by slug.
*
* @param string $slug Shipping class slug.
* @return int|false
*/
public function get_shipping_class_id_by_slug( $slug );
/**
* Returns an array of products.
*
* @param array $args @see wc_get_products.
* @return array
*/
public function get_products( $args = array() );
/**
* Get the product type based on product ID.
*
* @param int $product_id Product ID.
* @return bool|string
*/
public function get_product_type( $product_id );
}

View File

@ -0,0 +1,79 @@
<?php
/**
* Product Variable Data Store Interface
*
* @version 3.0.0
* @package WooCommerce\Interface
*/
/**
* WC Product Variable Data Store Interface
*
* Functions that must be defined by product variable store classes.
*
* @version 3.0.0
*/
interface WC_Product_Variable_Data_Store_Interface {
/**
* Does a child have a weight set?
*
* @param WC_Product $product Product object.
* @return boolean
*/
public function child_has_weight( $product );
/**
* Does a child have dimensions set?
*
* @param WC_Product $product Product object.
* @return boolean
*/
public function child_has_dimensions( $product );
/**
* Is a child in stock?
*
* @param WC_Product $product Product object.
* @return boolean
*/
public function child_is_in_stock( $product );
/**
* Syncs all variation names if the parent name is changed.
*
* @param WC_Product $product Product object.
* @param string $previous_name Previous name.
* @param string $new_name New name.
*/
public function sync_variation_names( &$product, $previous_name = '', $new_name = '' );
/**
* Stock managed at the parent level - update children being managed by this product.
* This sync function syncs downwards (from parent to child) when the variable product is saved.
*
* @param WC_Product $product Product object.
*/
public function sync_managed_variation_stock_status( &$product );
/**
* Sync variable product prices with children.
*
* @param WC_Product|int $product Product object or ID.
*/
public function sync_price( &$product );
/**
* Delete variations of a product.
*
* @param int $product_id Product ID.
* @param bool $force_delete False to trash.
*/
public function delete_variations( $product_id, $force_delete = false );
/**
* Untrash variations.
*
* @param int $product_id Product ID.
*/
public function untrash_variations( $product_id );
}

View File

@ -0,0 +1,125 @@
<?php
/**
* Queue Interface
*
* @version 3.5.0
* @package WooCommerce\Interface
*/
/**
* WC Queue Interface
*
* Functions that must be defined to implement an action/job/event queue.
*
* @version 3.5.0
*/
interface WC_Queue_Interface {
/**
* Enqueue an action to run one time, as soon as possible
*
* @param string $hook The hook to trigger.
* @param array $args Arguments to pass when the hook triggers.
* @param string $group The group to assign this job to.
* @return string The action ID
*/
public function add( $hook, $args = array(), $group = '' );
/**
* Schedule an action to run once at some time in the future
*
* @param int $timestamp When the job will run.
* @param string $hook The hook to trigger.
* @param array $args Arguments to pass when the hook triggers.
* @param string $group The group to assign this job to.
* @return string The action ID
*/
public function schedule_single( $timestamp, $hook, $args = array(), $group = '' );
/**
* Schedule a recurring action
*
* @param int $timestamp When the first instance of the job will run.
* @param int $interval_in_seconds How long to wait between runs.
* @param string $hook The hook to trigger.
* @param array $args Arguments to pass when the hook triggers.
* @param string $group The group to assign this job to.
* @return string The action ID
*/
public function schedule_recurring( $timestamp, $interval_in_seconds, $hook, $args = array(), $group = '' );
/**
* Schedule an action that recurs on a cron-like schedule.
*
* @param int $timestamp The schedule will start on or after this time.
* @param string $cron_schedule A cron-link schedule string.
* @see http://en.wikipedia.org/wiki/Cron
* * * * * * *
* ┬ ┬ ┬ ┬ ┬ ┬
* | | | | | |
* | | | | | + year [optional]
* | | | | +----- day of week (0 - 7) (Sunday=0 or 7)
* | | | +---------- month (1 - 12)
* | | +--------------- day of month (1 - 31)
* | +-------------------- hour (0 - 23)
* +------------------------- min (0 - 59)
* @param string $hook The hook to trigger.
* @param array $args Arguments to pass when the hook triggers.
* @param string $group The group to assign this job to.
* @return string The action ID
*/
public function schedule_cron( $timestamp, $cron_schedule, $hook, $args = array(), $group = '' );
/**
* Dequeue the next scheduled instance of an action with a matching hook (and optionally matching args and group).
*
* Any recurring actions with a matching hook should also be cancelled, not just the next scheduled action.
*
* @param string $hook The hook that the job will trigger.
* @param array $args Args that would have been passed to the job.
* @param string $group The group the job is assigned to (if any).
*/
public function cancel( $hook, $args = array(), $group = '' );
/**
* Dequeue all actions with a matching hook (and optionally matching args and group) so no matching actions are ever run.
*
* @param string $hook The hook that the job will trigger.
* @param array $args Args that would have been passed to the job.
* @param string $group The group the job is assigned to (if any).
*/
public function cancel_all( $hook, $args = array(), $group = '' );
/**
* Get the date and time for the next scheduled occurence of an action with a given hook
* (an optionally that matches certain args and group), if any.
*
* @param string $hook The hook that the job will trigger.
* @param array $args Filter to a hook with matching args that will be passed to the job when it runs.
* @param string $group Filter to only actions assigned to a specific group.
* @return WC_DateTime|null The date and time for the next occurrence, or null if there is no pending, scheduled action for the given hook
*/
public function get_next( $hook, $args = null, $group = '' );
/**
* Find scheduled actions.
*
* @param array $args Possible arguments, with their default values.
* 'hook' => '' - the name of the action that will be triggered.
* 'args' => null - the args array that will be passed with the action.
* 'date' => null - the scheduled date of the action. Expects a DateTime object, a unix timestamp, or a string that can parsed with strtotime(). Used in UTC timezone.
* 'date_compare' => '<=' - operator for testing "date". accepted values are '!=', '>', '>=', '<', '<=', '='.
* 'modified' => null - the date the action was last updated. Expects a DateTime object, a unix timestamp, or a string that can parsed with strtotime(). Used in UTC timezone.
* 'modified_compare' => '<=' - operator for testing "modified". accepted values are '!=', '>', '>=', '<', '<=', '='.
* 'group' => '' - the group the action belongs to.
* 'status' => '' - ActionScheduler_Store::STATUS_COMPLETE or ActionScheduler_Store::STATUS_PENDING.
* 'claimed' => null - TRUE to find claimed actions, FALSE to find unclaimed actions, a string to find a specific claim ID.
* 'per_page' => 5 - Number of results to return.
* 'offset' => 0.
* 'orderby' => 'date' - accepted values are 'hook', 'group', 'modified', or 'date'.
* 'order' => 'ASC'.
* @param string $return_format OBJECT, ARRAY_A, or ids.
* @return array
*/
public function search( $args = array(), $return_format = OBJECT );
}

View File

@ -0,0 +1,81 @@
<?php
/**
* Shipping Zone Data Store Interface
*
* @version 3.0.0
* @package WooCommerce\Interface
*/
/**
* WC Shipping Zone Data Store Interface.
*
* Functions that must be defined by shipping zone store classes.
*
* @version 3.0.0
*/
interface WC_Shipping_Zone_Data_Store_Interface {
/**
* Get a list of shipping methods for a specific zone.
*
* @param int $zone_id Zone ID.
* @param bool $enabled_only True to request enabled methods only.
* @return array Array of objects containing method_id, method_order, instance_id, is_enabled
*/
public function get_methods( $zone_id, $enabled_only );
/**
* Get count of methods for a zone.
*
* @param int $zone_id Zone ID.
* @return int Method Count
*/
public function get_method_count( $zone_id );
/**
* Add a shipping method to a zone.
*
* @param int $zone_id Zone ID.
* @param string $type Method Type/ID.
* @param int $order Method Order ID.
* @return int Instance ID
*/
public function add_method( $zone_id, $type, $order );
/**
* Delete a method instance.
*
* @param int $instance_id Intance ID.
*/
public function delete_method( $instance_id );
/**
* Get a shipping zone method instance.
*
* @param int $instance_id Instance ID.
* @return object
*/
public function get_method( $instance_id );
/**
* Find a matching zone ID for a given package.
*
* @param object $package Zone package object.
* @return int
*/
public function get_zone_id_from_package( $package );
/**
* Return an ordered list of zones.
*
* @return array An array of objects containing a zone_id, zone_name, and zone_order.
*/
public function get_zones();
/**
* Return a zone ID from an instance ID.
*
* @param int $id Instance ID.
* @return int
*/
public function get_zone_id_by_instance_id( $id );
}

View File

@ -0,0 +1,32 @@
<?php
/**
* Webhook Data Store Interface
*
* @version 3.2.0
* @package WooCommerce\Interface
*/
/**
* WooCommerce Webhook data store interface.
*/
interface WC_Webhook_Data_Store_Interface {
/**
* Get API version number.
*
* @since 3.2.0
* @param string $api_version REST API version.
* @return int
*/
public function get_api_version_number( $api_version );
/**
* Get all webhooks IDs.
*
* @since 3.2.0
* @throws InvalidArgumentException If a $status value is passed in that is not in the known wc_get_webhook_statuses() keys.
* @param string $status Optional - status to filter results by. Must be a key in return value of @see wc_get_webhook_statuses(). @since 3.6.0.
* @return int[]
*/
public function get_webhooks_ids( $status = '' );
}