'easycommerce-store#/subscriptions', 'easycommerce-wpbakery' => '', 'easycommerce-license' => 'easycommerce-store#/licenses', 'easycommerce-paddle' => 'easycommerce-settings&menu=payment&submenu=paddle', 'easycommerce-points-and-rewards' => 'easycommerce-settings&menu=points-rewards', 'easycommerce-product-recommendations' => 'easycommerce-settings&menu=product-recommendations', 'easycommerce-fluentcrm' => 'easycommerce-settings&menu=fluentcrm', 'easycommerce-bank-transfer' => 'easycommerce-settings&menu=payment&submenu=bank-transfer', 'easycommerce-sliding-cart' => '', 'easycommerce-rocket' => 'easycommerce-settings&menu=payment&submenu=rocket', 'easycommerce-csv-importer' => 'easycommerce-store#/easycommerce-importer', 'easycommerce-wishlist' => '', 'easycommerce-checkout-editor' => 'easycommerce-checkout-editor', 'easycommerce-nagad' => 'easycommerce-settings&menu=payment&submenu=nagad', 'easycommerce-bkash' => 'easycommerce-settings&menu=payment&submenu=bkash', 'easycommerce-google-sheets-sync' => 'easycommerce-settings&menu=google_sheets', 'easycommerce-klaviyo' => 'easycommerce-settings&menu=klaviyo', 'easycommerce-zendesk' => 'easycommerce-settings&menu=zendesk', 'easycommerce-pdf-invoice' => 'easycommerce-settings&menu=pdf-invoice', 'easycommerce-delivery-date-picker' => '', 'easycommerce-mailchimp' => 'easycommerce-settings&menu=mailchimp', 'easycommerce-hubspot' => 'easycommerce-settings&menu=hubspot', 'easycommerce-migration' => 'easycommerce-settings&menu=migration', 'easycommerce-slack' => 'easycommerce-settings&menu=slack']; public function list($request) { } public function manage($request) { } /** * Resolves a plugin slug to its installed file path (e.g. "fluent-crm" → "fluent-crm/fluentcrm.php"). * * Uses WP_Plugin_Dependencies (WP 6.5+) when available, then falls back to * scanning get_plugins() for a file inside the slug's directory. * * @param string $slug Plugin directory slug. * @return string|false Relative plugin file path, or false if not installed. */ private function find_plugin_file(string $slug) { } /** * Clears plugin caches and resets WP_Plugin_Dependencies static state. * * WP_Plugin_Dependencies (WP 6.5+) populates its internal maps once per request * via static properties. After installing a new plugin mid-request those statics * are stale, so activate_plugin() wrongly reports unmet dependencies. * * Resetting the statics via reflection forces the next initialize() call to * re-read the live plugin list, keeping the dependency check accurate. */ private function refresh_plugin_dependencies(): void { } /** * Installs a plugin from a zip URL using the WordPress upgrader. * * Supports optional auth headers (e.g. for private EasyCommerce store downloads) * by temporarily filtering wp_remote_get arguments. * * Returns the installed plugin's relative file path (e.g. "fluent-crm/fluentcrm.php") * via Plugin_Upgrader::plugin_info() — the WP-native way to get the actual installed path * regardless of what directory name the zip was extracted to. * * @param string $zip_url Direct URL to the plugin zip file. * @param array $headers Optional HTTP headers to attach to the download request. * @param string $slug Optional canonical plugin slug. When set, the extracted * source directory is renamed to this slug before install so * the addon lands in {slug}/ instead of a temp/obfuscated dir. * @return string|\WP_Error Installed plugin file path on success, WP_Error on failure. */ private function install_plugin(string $zip_url, array $headers = [], string $slug = '') { } /** * @todo implement API verification */ public function license($request) { } } } namespace EasyCommerce\Traits { trait Auth { /** * Check if sandbox/test mode is enabled. * * @return bool True if sandbox mode is enabled, false otherwise. */ protected function is_sandbox_mode() { } /** * Verifies if it's a human user, not bots * * @param WP_REST_Request $request The request object. * @return bool True for regular cases, false otherwise. * * @todo Introduce real check */ public function is_user($request) { } /** * Check if the request is from a logged-in user or carries a valid wp_rest nonce. * * Used for storefront endpoints that incur real costs (e.g. AI credits) but must * remain accessible to guest users who loaded the storefront and received a nonce * via EASYCOMMERCE.nonce. Raw unauthenticated API calls without a nonce are rejected. * * @param WP_REST_Request $request The request object. * @return bool */ public function is_nonce_verified($request) { } /** * Check if the current user is a guest (not logged in). * * @param WP_REST_Request $request The request object. * @return bool True if sandbox mode is disabled and the user is not logged in, false otherwise. */ public function is_guest($request) { } /** * Check if the current user is a logged in user. * * @param WP_REST_Request $request The request object. * @return bool True if sandbox mode is enabled or the user is logged in, false otherwise. */ public function is_member($request) { } /** * Check if the current user is a customer. * * @param WP_REST_Request $request The request object. * @return bool True if sandbox mode is enabled or the user is logged in, false otherwise. */ public function is_customer($request) { } /** * Check if the current user is an editor. * * @param WP_REST_Request $request The request object. * @return bool True if sandbox mode is enabled or the user has editor capabilities, false otherwise. */ public function is_editor($request) { } /** * Check if the current user is an administrator. * * @param WP_REST_Request $request The request object. * @return bool True if sandbox mode is enabled or the user has administrator capabilities, false otherwise. */ public function is_admin($request) { } /** * Check if the current user is an administrator or an manager. * * @param WP_REST_Request $request The request object. * @return bool True if sandbox mode is enabled or the user has administrator capabilities or user has manager capabilities, false otherwise. */ public function is_manager($request) { } } } namespace EasyCommerce\Abstracts { abstract class Agent { use \EasyCommerce\Traits\Rest; use \EasyCommerce\Traits\Auth; protected $ai; protected $db; /** * Usage-log type for this agent. Subclasses override (copilot, shopping_agent). * * @var string */ protected $log_type = 'agent'; public function __construct() { } public function handle($request) { } protected function build_response(array $result, string $session_id): array { } public function run_message(string $session_id, string $message): array { } protected function run_agent(array &$history): string { } /** * The most recent user message in a history array. * * @param array $history * @return string */ protected function last_user_message(array $history): string { } protected function load_session(string $session_id): array { } protected function save_session(string $session_id, array $history): void { } abstract protected function dispatch_tool(string $name, array $args): array; abstract protected function get_tools(): array; abstract protected function get_system_prompt(): string; } } namespace EasyCommerce\API\Agent { class Assistant extends \EasyCommerce\Abstracts\Agent { protected $log_type = 'shopping_agent'; private $order_url = null; // ------------------------------------------------------------------------- // Overrides // ------------------------------------------------------------------------- public function run_message(string $session_id, string $message): array { } protected function build_response(array $result, string $session_id): array { } // ------------------------------------------------------------------------- // Tool dispatch // ------------------------------------------------------------------------- protected function dispatch_tool(string $name, array $args): array { } // ------------------------------------------------------------------------- // Tool implementations // ------------------------------------------------------------------------- private function tool_search_products(array $args): array { } private function tool_get_product_details(array $args): array { } private function tool_check_stock(array $args): array { } private function tool_calculate_shipping(array $args): array { } private function tool_apply_coupon(array $args): array { } private function tool_create_order(array $args): array { } private function tool_generate_payment_link(array $args): array { } private function tool_get_order_status(array $args): array { } private function tool_update_order_contact(array $args): array { } private function tool_update_order_address(array $args): array { } private function tool_add_order_note(array $args): array { } private function tool_get_order_breakdown(array $args): array { } private function tool_get_order_items(array $args): array { } private function tool_estimate_order_total(array $args): array { } private function tool_apply_coupon_to_order(array $args): array { } private function tool_cancel_order(array $args): array { } private function tool_resend_order_email(array $args): array { } private function tool_track_order(array $args): array { } private function tool_get_refund_info(array $args): array { } private function tool_get_customer_profile(array $args): array { } private function tool_list_products_by_category(array $args): array { } private function tool_get_product_reviews(array $args): array { } private function tool_validate_coupon(array $args): array { } // ------------------------------------------------------------------------- // Tool definitions & system prompt // ------------------------------------------------------------------------- protected function get_tools(): array { } protected function get_system_prompt(): string { } } class Copilot extends \EasyCommerce\Abstracts\Agent { protected $log_type = 'copilot'; private $reports; public function __construct() { } // ------------------------------------------------------------------------- // Tool dispatch // ------------------------------------------------------------------------- protected function dispatch_tool(string $name, array $args): array { } // ------------------------------------------------------------------------- // Tool implementations // ------------------------------------------------------------------------- private function tool_create_product(array $args): array { } private function tool_update_product(array $args): array { } private function tool_get_store_overview(array $args): array { } private function tool_get_top_products(array $args): array { } private function tool_list_orders(array $args): array { } private function tool_search_order(array $args): array { } private function tool_list_products(array $args): array { } private function tool_search_customer(array $args): array { } private function tool_update_order_status(array $args): array { } private function tool_delete_product(array $args): array { } private function tool_update_product_stock(array $args): array { } private function tool_create_coupon(array $args): array { } private function tool_issue_refund(array $args): array { } private function tool_run_analytics_query(array $args): array { } // ------------------------------------------------------------------------- // Tool definitions & system prompt // ------------------------------------------------------------------------- protected function get_tools(): array { } protected function get_system_prompt(): string { } } } namespace EasyCommerce\API { class Attribute extends \EasyCommerce\Abstracts\API { /** * List all attributes with optional search and details. * * @param \WP_REST_Request $request The request object. */ public function list($request) { } /** * Add new attributes and their values. * * @param \WP_REST_Request $request The request object. */ public function add_item($request) { } /** * Get values for a specific attribute. * * @param \WP_REST_Request $request The request object. */ public function get_values($request) { } /** * Get a specific attribute. * * @param \WP_REST_Request $request The request object. */ public function get_attribute($request) { } /** * Delete an attribute. * * @param \WP_REST_Request $request The request object. */ public function delete_attribute($request) { } public function bulk_delete_attributes($request) { } /** * Update an attribute. * * @param \WP_REST_Request $request The request object. */ public function update_attribute($request) { } } class Cart extends \EasyCommerce\Abstracts\API { /** * List the cart contents and hash. * * @param WP_REST_Request $request The request object. */ public function list($request) { } /** * Add items to the cart. * * @param WP_REST_Request $request The request object. */ public function add_items($request) { } /** * Update a product quantity in the cart. * * @param WP_REST_Request $request The request object. */ public function update_item($request) { } /** * Remove a product from the cart. * * @param WP_REST_Request $request The request object. */ public function remove_item($request) { } /** * Lock the cart for payment processing. * Once locked, add/update/remove operations are rejected until the payment completes or fails. * * @param WP_REST_Request $request The request object. */ public function lock($request) { } /** * Get the shipping options for the cart. * * @param WP_REST_Request $request The request object. */ public function get_shipping_options($request) { } /** * Set the shipping method for the cart. * * @param WP_REST_Request $request The request object. */ public function set_shipping_method($request) { } public function set_payment_method($request) { } /** * Apply a coupon to the cart. * * @param WP_REST_Request $request The request object. */ public function apply_coupon($request) { } /** * Remove a coupon from the cart. * * @param WP_REST_Request $request The request object. */ public function remove_coupon($request) { } /** * Clear the cart. * * @param WP_REST_Request $request The request object. */ public function clear($request) { } /** * Remind abandoned cart. * * @param WP_REST_Request $request The request object. */ public function remind_abandoned($request) { } private function sanitize_address($address) { } } } namespace EasyCommerce\Traits { trait Queue { /** * Schedules a single event to run immediately (if not already scheduled). * * @param string $hook Action hook to execute. * @param array $args Optional. Arguments to pass to the callback function. Default empty array. */ public function schedule($hook, $args = []) { } /** * Schedules a single event to run at a specific timestamp. * * @param int $run_at When to run the event (Unix timestamp). * @param string $hook Action hook to execute. * @param array $args Optional. Arguments to pass to the callback function. Default empty array. */ public function schedule_at($run_at, $hook, $args = []) { } /** * Schedules a recurring event. * * @param int $start_at When to run the first event (Unix timestamp). * @param string $recurrence How often the event should recur ('hourly', 'daily', etc). * @param string $hook Action hook to execute. * @param array $args Optional. Arguments to pass to the callback function. Default empty array. */ public function schedule_recurring($start_at, $recurrence, $hook, $args = []) { } /** * Unschedules a specific event. * * @param string $hook Action hook to remove. * @param array $args Optional. Arguments to match when removing. Default empty array. */ public function unschedule($hook, $args = []) { } /** * Clears all scheduled hooks with the given hook name and arguments. * * @param string $hook Hook name to clear. * @param array $args Optional. Arguments to match. Default empty array. */ public function clear_schedules($hook, $args = []) { } /** * Checks if an event is already scheduled. * * @param string $hook Hook name to check. * @param array $args Optional. Arguments to match. Default empty array. * @return bool */ public function has_schedule($hook, $args = []) { } } } namespace EasyCommerce\API { class Connectivity extends \EasyCommerce\Abstracts\API { use \EasyCommerce\Traits\Cache; use \EasyCommerce\Traits\Queue; public function save($request) { } public function registration($request) { } /** * Handle reset password request */ public function reset_password_request($request) { } /** * Handle reset password confirmation */ public function reset_password_confirm($request) { } /** * Authenticate a user for the React auth screens. * * Mirrors the native wp_login_form behaviour (which posts to wp-login.php) * but returns JSON so the storefront can log in without a full page reload * being driven by the browser's form submit. On success wp_signon sets the * auth cookies, and the client redirects to the dashboard. */ public function login($request) { } /** * Best-effort client IP for login throttling. * * Uses REMOTE_ADDR only (proxy headers are spoofable and must not be trusted * for a security control); sites behind a trusted proxy can override via the * easycommerce_client_ip filter. * * @return string */ private function client_ip() { } /** * Transient key holding the failed-login count for the current client. * * @return string */ private function login_throttle_key() { } public function get_setup_wizard($request) { } /** * Apply a ready-made store design from the setup wizard (#3174). * * By default this only *creates* the design's pages and leaves the site's * front page untouched — safest for existing/live sites. The new home page * is set as the static front page ONLY when the store owner explicitly opts * in (`set_homepage`), so we never silently clobber a live homepage. * * @param \WP_REST_Request $request Request object. * @return \WP_REST_Response */ public function apply_design($request) { } /** * Set a page as the static front page (used to confirm an overwrite from the * wizard after the user opts in). #3174. * * @param \WP_REST_Request $request Request object. * @return \WP_REST_Response */ public function set_front_page($request) { } public function check($request) { } public function disconnect($request) { } public function generate_token($request) { } public function verify_token($request) { } public function get_addons($request) { } public function get_docs($request) { } public function get_doc($request) { } public function feedback($request) { } /** * The site diagnostics attached to every telemetry event. * * Every event carries the same payload — wizard completion, deactivation, * feedback and integration request alike — so a CRM contact reads the same * whichever way the store owner arrived. * * Rides along only with consent: what the store owner typed is their own * submission and always goes, the passive site snapshot (active plugin list, * theme, install age, engagement counts) does not. * * @since 1.45 * @return array Empty when sharing is declined. */ private function diagnostics() { } public function requests($request) { } } class Coupon extends \EasyCommerce\Abstracts\API { /** * Retrieve all coupons or a specific coupon by ID. * * @param WP_REST_Request $request * @return WP_REST_Response */ public function get_all($request) { } /** * Create a new coupon. * * @param WP_REST_Request $request * @return WP_REST_Response */ public function create($request) { } /** * Retrieve details of a specific coupon by ID. * * @param WP_REST_Request $request * @return WP_REST_Response */ public function get_single($request) { } /** * Update an existing coupon. * * @param WP_REST_Request $request * @return WP_REST_Response */ public function update($request) { } /** * Delete a coupon. * * @param WP_REST_Request $request * @return WP_REST_Response */ public function delete($request) { } /** * Bulk delete coupons. * * @param WP_REST_Request $request * @return WP_REST_Response */ public function bulk_delete($request) { } /** * Bulk update the status of coupons. * * @param WP_REST_Request $request * @return WP_REST_Response */ public function bulk_status_update($request) { } } class Customer extends \EasyCommerce\Abstracts\API { /** * Create a new customer. * * @param WP_REST_Request $request * @return WP_REST_Response */ public function create($request) { } /** * Get a specific customer. * * @param WP_REST_Request $request * @return WP_REST_Response */ public function get($request) { } /** * List customers with optional filters such as `s` for search, `page`, and `per_page`. * * @param WP_REST_Request $request * @return WP_REST_Response */ public function list($request) { } /** * Delete a customer. * * @param WP_REST_Request $request * @return WP_REST_Response */ public function delete($request) { } /** * List customer orders with optional filters such as `s` for search, `page`, and `per_page`. * * @param WP_REST_Request $request * @return WP_REST_Response */ public function list_orders($request) { } } /** * Dashboard API */ class Dashboard extends \EasyCommerce\Abstracts\API { use \EasyCommerce\Traits\Cache; const CACHE_DURATION_HOUR = 3600; /** * The dashboard stats * * @param WP_REST_Request $request The request object. */ public function get_stats($request) { } /** * Orders by statuses * * @param WP_REST_Request $request The request object. */ public function get_order_statuses($request) { } public function get_setup_status($request) { } /** * Sales * * @param WP_REST_Request $request The request object. */ public function get_sales($request) { } /** * Recent orders * * @param WP_REST_Request $request The request object. */ public function get_recent_orders($request) { } /** * Get single abandoned cart details including items. * * @param WP_REST_Request $request The request object. */ public function get_abandoned_cart_details($request) { } /** * Resolve a thumbnail value to a full image URL. * * @param int|string|array $thumbnail Attachment ID, full URL, relative path, or thumbnail array with id/url keys. * @param int|null $product_id Optional product ID to fall back to if thumbnail is empty. * @return string Full image URL, or empty string if not resolvable. */ private function get_image_url($thumbnail, $product_id = null) { } /** * Send a custom reminder email for an abandoned cart. * * @param WP_REST_Request $request The request object. */ public function send_abandoned_cart_reminder($request) { } /** * Low stock * * @param WP_REST_Request $request * @return WP_REST_Response */ public function get_low_stock($request) { } /* * Top seller * * @param WP_REST_Request $request * @return WP_REST_Response */ public function get_top_sellers($request) { } /** * Recent activities * * @param WP_REST_Request $request The request object. */ public function get_activities($request) { } /** * Returns a date key based on the given timestamp and range. * * The format of the date key depends on the range: * - If the range is a custom range (i.e. it contains a comma), then the date key is the day of the month (e.g. 1st, 2nd, 3rd, etc.). * - If the range is 'this-year' or 'last-year', then the date key is the full month name (e.g. January, February, etc.). * - If the range is 'this-week', 'last-week', 'last-7', 'today', or 'yesterday', then the date key is the abbreviated day of the week (e.g. Mon, Tue, Wed, etc.). * * @param int $timestamp The timestamp to get the date key for. * @param string $range The range to get the date key for. * @return string The date key. */ public function get_date_key($timestamp, $range) { } /** * Total orders * * @param string $range The date range to query. * @param string $status The order status to filter by. * @param int $product_id The product ID. * @return array */ public function total_orders($range = 'this-month', $status = '', $product_id = null) { } /** * Total sales * * @param string $range The date range to query. * @param string $status The order status to filter by. * @param int $product_id The product ID. * @return float */ public function total_sales($range = 'this-month', $status = '', $product_id = null) { } /** * Total products sold * * @param string $range The date range to query. * @return int */ public function total_products_sold($range = 'this-month') { } /** * Total orders by status * * @param string $range The date range to query. * @param string $status The order status to filter by. * @return int */ public function total_orders_by_status($range, $status) { } /** * Get customers * * @param string $range The date range to query. * @param string $status The order status to filter by. * @return array */ public function get_customers($range = 'this-month') { } public function get_abandoned_carts($range = 'this-month', $from = null, $to = null) { } private function get_total_products() { } /** * Delete all cache entries for a given key prefix across every known range. * * Pass $with_ranges = false for range-independent keys (e.g. 'dashboard_low_stock'). * * @param string $prefix Cache key prefix, e.g. 'dashboard_stats'. * @param bool $with_ranges Whether to iterate over all date ranges. */ private static function purge_cache(string $prefix, bool $with_ranges = true) { } /** * Delete order-related dashboard caches. * * Call when order, refund, or customer data changes. */ public static function delete_orders_cache() { } /** * Delete product-related dashboard caches (stats, low stock, top sellers). * * Call when product or variation data changes. */ public static function delete_products_cache() { } /** * Delete all dashboard caches. */ public static function delete_dashboard_cache() { } /** * Get total refunded amount from the Refund model (handles partial refunds correctly) * * @param string $range The date range to query. * @return float */ public function total_refunded_amount($range = 'this-month') { } } } namespace EasyCommerce\Traits { trait Hook { /** * Registers an action hook. * * @param string $tag The name of the action. * @param callable $callback The callback function. * @param int $priority The order of execution. Default is 10. * @param int $accepted_args The number of accepted arguments. Default is 1. */ public function add_action($tag, $callback, $priority = 10, $accepted_args = 1) { } /** * Convenience wrapper for add_action. */ public function action($tag, $callback, $priority = 10, $accepted_args = 1) { } /** * Registers a filter hook. * * @param string $tag The name of the filter. * @param callable $callback The callback function. * @param int $priority The order of execution. Default is 10. * @param int $accepted_args The number of accepted arguments. Default is 1. */ public function add_filter($tag, $callback, $priority = 10, $accepted_args = 1) { } /** * Convenience wrapper for add_filter. */ public function filter($tag, $callback, $priority = 10, $accepted_args = 1) { } /** * Registers a shortcode. * * @param string $tag The shortcode tag. * @param callable $callback The callback function. */ public function add_shortcode($tag, $callback) { } /** * Convenience wrapper for add_shortcode. */ public function shortcode($tag, $callback) { } /** * Registers an AJAX action for logged-in users. * * @param string $action The AJAX action. * @param callable $callback The callback function. */ public function ajax_priv($action, $callback) { } /** * Registers an AJAX action for non-logged-in users. * * @param string $action The AJAX action. * @param callable $callback The callback function. */ public function ajax_nopriv($action, $callback) { } /** * Registers both logged-in and non-logged-in AJAX actions. */ public function ajax($action, $callback) { } } trait Cleaner { /** * Generic sanitization method that dynamically selects the appropriate sanitization function based on the type or data content. * * @param mixed $input The input data to sanitize, can be a string or an array. * @param string $type The type of sanitization to perform, or 'array' to recursively sanitize an array of data. * @return mixed The sanitized data, either a string or an array of sanitized strings. */ public function sanitize($input, $type = 'text') { } /** * Generic escaping method for securing output against XSS and other vulnerabilities. * If an array is provided as output, the specified escaping context will be applied to each element. * * @param mixed $output The output data to escape, can be a string or an array of strings. * @param string $context The context for escaping. Default is 'html'. * Supported contexts: 'html', 'url', 'js', 'sql', 'attr'. * @return mixed The escaped data, either a string or an array of escaped strings. */ public function escape($output, $context = 'html') { } /** * Recursively unserialize a value if it is serialized, handling nested serialization. * * @param mixed $value The value to unserialize. * @return mixed The unserialized value. */ public function unserialize($value) { } } } namespace EasyCommerce\API { class Email_Placeholder extends \EasyCommerce\Abstracts\API { use \EasyCommerce\Traits\Hook; use \EasyCommerce\Traits\Cleaner; /** * Get general email placeholders (available for all emails) */ public function get_general_placeholders(): array { } /** * Get order-specific email placeholders */ public function get_order_placeholders(): array { } /** * Get cart-specific email placeholders */ public function get_cart_placeholders(): array { } /** * Get placeholder description based on key * * @param string $placeholder The placeholder key. * * @return string The placeholder description. */ private function get_placeholder_description(string $placeholder): string { } /** * REST API handler to get placeholders for Select2 * * @param WP_REST_Request $request The REST request object. * * @return void Uses Rest trait response methods. */ public function get_placeholders(\EasyCommerce\API\WP_REST_Request $request) { } } class Geo extends \EasyCommerce\Abstracts\API { use \EasyCommerce\Traits\Cache; public function list_countries($request) { } public function list_states($request) { } public function list_cities($request) { } public function list_currencies($request) { } } class Importer extends \EasyCommerce\Abstracts\API { use \EasyCommerce\Traits\Cleaner; use \EasyCommerce\Traits\Queue; public function upload_csv($request) { } public function map_columns($request) { } public function import_products($request) { } public function import_sample_products($request) { } public function create_product($row, $is_demo = false) { } /** * Meta key that flags demo products, their categories and their media. */ const DEMO_META_KEY = '_easycommerce_demo'; /** * Flag an imported product, its media and its categories as demo content. * * Keyed removal (see remove_demo()) relies on every demo artefact carrying * this meta, so nothing bundled by the demo importer lingers after cleanup. * * @param int $id Product ID. * @param array $args Product args passed to Product::update(). * @param array $variations Built variation data (for variation thumbnails + downloads). */ private function tag_demo_content($id, $args, $variations) { } /** * REST callback: how many demo products currently exist. * * Drives the Products-page UI (import vs. remove demo content). * * @param \WP_REST_Request $request Request object. * @return \WP_REST_Response */ public function demo_status($request) { } /** * REST callback: remove all demo content. * * @param \WP_REST_Request $request Request object. * @return \WP_REST_Response */ public function delete_demo($request) { } /** * Remove all demo content created by the demo importer. * * Deletes demo products (and their variations via Product::delete-equivalent * cascade), their sideloaded attachments, and any demo categories left empty — * all keyed off DEMO_META_KEY. Idempotent: safe to run repeatedly. * * @return array Counts of removed products, attachments and categories. */ public function remove_demo() { } /** * Extract unique attribute values from variation data when product-level values are empty * * @param string $attribute_names Product-level attribute names (e.g., "Color, Size") * @param string $variation_attr_names Variation attribute names (e.g., "Color,Color,Size,Size") * @param string $variation_attr_values Variation attribute values (e.g., "Blue,Black,M,L") * @return array Structured attributes array with IDs */ private function extract_attributes_from_variations($attribute_names, $variation_attr_names, $variation_attr_values) { } /** * Process product attributes and create them in database if they don't exist * * @param string $attribute_names Comma-separated attribute names * @param string $attribute_values Pipe-separated groups of comma-separated values * @return array Structured attributes array with IDs */ private function process_product_attributes($attribute_names, $attribute_values) { } /** * Generate all possible variations from product attributes * * @param array $attributes Product attributes array * @return array Generated variations */ private function generate_variations_from_attributes($variation_data, $attributes) { } private function generate_attribute_combinations($attributes) { } private function get_img_ids($urls, $keep_alignment = false) { } /** * Validate that a remote URL is safe to fetch (SSRF guard). * * Replaces WP's wp_http_validate_url() guard, which is IPv4-only on WP 7.0 * (gethostbyname()) and rejects IPv6-only CDN hosts. This resolves both A and * AAAA records and rejects any URL that points at a private, reserved, loopback * or link-local address, while still allowing public IPv6 hosts. * * @param string $url Remote URL. * @return bool True when the URL is safe to request. */ private function is_safe_remote_url($url) { } /** * Download a remote image and attach it to the media library. * * Uses wp_remote_get() rather than media_sideload_image()/download_url() because * WP's wp_http_validate_url() guard is IPv4-only on WP 7.0 and rejects IPv6-only * CDN hosts. SSRF protection is provided by is_safe_remote_url() instead, which * resolves both A and AAAA records and blocks private/reserved targets. * * @param string $url Remote image URL. * @return int|\WP_Error Attachment ID on success, WP_Error on failure. */ private function sideload_remote_image($url) { } /** * Sideload a file bundled with the plugin's demo content into the media library. * * Used for the demo importer, which references bundled assets by bare filename * rather than a remote URL. No HTTP request is made, so there is no SSRF surface; * the filename is constrained to the requested demo sub-directory (basename only, * no path traversal). * * @param string $filename Bare filename (e.g. green-shoe.jpg). * @param string $subdir Demo sub-directory under samples/dummy-data/ ('images' or 'downloads'). * @return int|\WP_Error Attachment ID on success, WP_Error on failure. */ private function sideload_local_file($filename, $subdir = 'images') { } /** * Build explicit variation from CSV data with proper attribute structure */ private function build_variation($variation_data, $key, $product_attributes) { } public function is_base64_data_url(string $value): bool { } public function sideload_image($request) { } } class Log extends \EasyCommerce\Abstracts\API { /** * List logs with optional filters. * * @param WP_REST_Request $request * @return WP_REST_Response */ public function list($request) { } /** * Get a single log by ID. * * @param WP_REST_Request $request * @return WP_REST_Response */ public function get($request) { } /** * Add a new log entry. * * @param WP_REST_Request $request * @return WP_REST_Response */ public function add($request) { } /** * Delete a log entry. * * @param WP_REST_Request $request * @return WP_REST_Response */ public function delete($request) { } } class Notice extends \EasyCommerce\Abstracts\API { /** * List notices via REST API, optionally filtered by type and screen. * * @param WP_REST_Request $request Request object containing optional 'type' and 'screen' params. * @return WP_REST_Response Response with 'notices' array and 'total' count. */ public function list($request) { } public function dismiss($request) { } } class Option extends \EasyCommerce\Abstracts\API { /** * Get the value of a specified option. * * @param WP_REST_Request $request * @return WP_REST_Response */ public function get($request) { } /** * Update the value of a specified option. * * @param WP_REST_Request $request * @return WP_REST_Response */ public function update($request) { } /** * Delete the specified option. * * @param WP_REST_Request $request * @return WP_REST_Response */ public function delete($request) { } } class Order extends \EasyCommerce\Abstracts\API { /** * Create a new order. * * @param \WP_REST_Request $request * @return \WP_REST_Response */ public function create($request) { } /** * Get a specific order. * * @param \WP_REST_Request $request * @return \WP_REST_Response */ public function get($request) { } /** * Update an existing order. * * @param \WP_REST_Request $request * @return \WP_REST_Response */ public function update($request) { } public function bulk_update_statuses($request) { } /** * Delete an order. * * @param \WP_REST_Request $request * @return \WP_REST_Response */ public function delete_order($request) { } /** * Refund an order. * * @param \WP_REST_Request $request * @return \WP_REST_Response */ public function refund($request) { } /** * Send an email. * * @param \WP_REST_Request $request * @return \WP_REST_Response */ public function email($request) { } /** * List orders with optional filters such as per_page, page, status, customer_id and customer_email. * * @param \WP_REST_Request $request * @return \WP_REST_Response */ public function get_all($request) { } public function bulk_delete($request) { } /** * Process payment for an existing pending order (agent-created orders). */ public function pay($request) { } /** * Validate address fields before creating an order. * * @param array $address Associative array of address data. * @param string $type 'billing' or 'shipping'. * @return \WP_REST_Response|null Null on success, error response on failure. */ private function sanitize_address($address) { } private function validate_address_fields($address, $type) { } } class Product extends \EasyCommerce\Abstracts\API { public function list($request) { } /** * Get a product. * * @param WP_REST_Request $request * @return WP_REST_Response */ public function get($request) { } /** * Create a new product. * * @param WP_REST_Request $request * @return WP_REST_Response */ public function create($request) { } /** * Update a product. * * @param WP_REST_Request $request * @return WP_REST_Response */ public function update($request) { } /** * Delete a product. * * @param WP_REST_Request $request * @return WP_REST_Response */ public function delete($request) { } /** * Bulk delete products. * * @param WP_REST_Request $request * @return WP_REST_Response */ public function bulk_delete($request) { } // bulk status update public function bulk_update_status($request) { } /** * Get review to a product. * * @param WP_REST_Request $request * @return WP_REST_Response */ public function get_reviews($request) { } /** * Add review to a product. * * @param WP_REST_Request $request * @return WP_REST_Response */ public function add_review($request) { } /** * Get a product's variations * * @param WP_REST_Request $request * @return WP_REST_Response * * @todo optimize */ public function get_variations($request) { } } class Product_Review extends \EasyCommerce\Abstracts\API { /** * Get a list of product reviews. * * @param WP_REST_Request $request The request object. * @return WP_REST_Response */ public function get_all($request) { } /** * Delete a product review. * * @param WP_REST_Request $request The request object. * @return WP_REST_Response */ public function delete($request) { } } class Profile extends \EasyCommerce\Abstracts\API { /** * Gets current user summary */ public function get_summary($request) { } /** * Gets current user data */ public function get_data($request) { } /** * Sets current user data */ public function set_data($request) { } /** * List customer orders with optional filters such as `s` for search, `page`, and `per_page`. * * @param WP_REST_Request $request * @return WP_REST_Response */ public function get_orders($request) { } /** * List customer transactions with optional filters such as `s` for search, `page`, and `per_page`. * * @param WP_REST_Request $request * @return WP_REST_Response */ public function get_transactions($request) { } /** * List customer downloads with optional filters such as `s` for search, `page`, and `per_page`. * * @param WP_REST_Request $request * @return WP_REST_Response */ public function get_downloads($request) { } } class Refund extends \EasyCommerce\Abstracts\API { /** * List refunds. * * @param \WP_REST_Request $request * @return \WP_REST_Response */ public function list($request) { } /** * Get a refund. * * @param \WP_REST_Request $request * @return \WP_REST_Response */ public function get($request) { } /** * Create a new refund. * * @param \WP_REST_Request $request * @return \WP_REST_Response */ public function create($request) { } /** * Update a refund. * * @param \WP_REST_Request $request * @return \WP_REST_Response|\WP_Error */ public function update($request) { } /** * Delete a refund. * * @param \WP_REST_Request $request * @return \WP_REST_Response */ public function delete($request) { } /** * Bulk delete refunds. * * @param \WP_REST_Request $request * @return \WP_REST_Response */ public function bulk_delete($request) { } } } namespace EasyCommerce\API\Reports { /** * Reports Base API */ class Reports extends \EasyCommerce\Abstracts\API { use \EasyCommerce\Traits\Cache; const CACHE_DURATION_HOUR = 3600; const CACHE_DURATION_DAY = 86400; /** * Returns a date key based on the given timestamp and range. * * @param int $timestamp The timestamp to get the date key for. * @param string $range The range to get the date key for. * * @return string The date key. */ public function get_date_key($timestamp, $range) { } public function get_date_range($range = 'all') { } /** * Resolve from/to date strings for a range. * * @param string $range * @return array { from: string, to: string } */ public function resolve_dates($range) { } /** * Build the ordered list of date labels for a given range. * * @param string $range * @return string[] */ public function get_time_series_labels($range) { } /** * Ordinal suffix for a day number — 1 → "1st", 22 → "22nd", etc. * * @param int $day * @return string */ private function ordinal($day) { } /** * Total orders * * @param string $range The date range to query. * @param array $args Optional args passed to Order::list() (e.g. status, product_id, customer_id, meta_query, etc.) * * @return array */ public function total_orders($range = 'this-month', $args = array()) { } /** * Total sales * * @param string $range The date range to query. * @param array $args Optional args passed to Order::list() (e.g. status, product_id, customer_id, meta_query, etc.) * * @return float */ public function total_sales($range = 'this-month', $args = array()) { } /** * Get total refund amount from wp_ec_refunds table. * * Only counts approved/processed refunds within the date range. * * @param string $range The date range to query. * @return float */ public function total_refunds($range = 'this-month') { } /** * Get refund count and total amount from wp_ec_refunds table. * * Used when both the count and the monetary amount are needed. * * @param string $range The date range to query. * @param int|null $product_id Optional product ID to scope to a single product. * @param bool $all_time Whether to skip date filtering entirely. * @return array { refund_count: int, refund_amount: float } */ protected function get_refund_stats($range, $product_id = null, $all_time = false) { } /** * Get comparison range for previous period * * @param string $range The current range. * @return string The comparison range. */ protected function get_comparison_range($range) { } /** * Calculate stats for a given range * * @param string $range The date range. * @return array */ protected function calculate_stats($range) { } /** * Calculate comparison percentage and type * * @param float $current Current period value. * @param float $previous Previous period value. * @return array */ protected function calculate_comparison($current, $previous) { } /** * Get comparison with vibe for positive metrics (increment is good) * * @param float $current Current period value. * @param float $previous Previous period value. * @return array */ public function get_comparison_with_vibe($current, $previous) { } /** * Get comparison with vibe for negative metrics (decrement is good) * * @param float $current Current period value. * @param float $previous Previous period value. * @return array */ public function get_refund_comparison($current, $previous) { } /** * Generate a cache key for a report endpoint. * * @param string $method The method name. * @param array $params Request parameters. * @return string The cache key. */ protected function generate_cache_key($method, $params = array()) { } /** * Try to get cached response or execute callback and cache the result. * * @param string $cache_key The cache key. * @param callable $callback The callback to execute if cache miss. * @param int $expiration Cache duration in seconds. * @return mixed */ protected function get_cached_or_set($cache_key, $callback, $expiration = self::CACHE_DURATION_HOUR) { } /** * Get request params for caching. * * @param \WP_REST_Request $request The request object. * @return array */ protected function get_cache_params($request) { } /** * Get all cache keys used for reports. * * @return array List of cache key prefixes (with 'report_' prefix). */ public static function get_cache_keys() { } /** * Get all possible date ranges. * * @return array List of all range values. */ public static function get_all_ranges() { } /** * Get all possible comparison ranges. * * @return array List of all comparison range values. */ public static function get_all_comparison_ranges() { } /** * Get all possible variations of a cache key. * * Generates: base, range-only, comparison-only, range+comparison combos. * * @param string $key_prefix The base key prefix (e.g., 'report_overview_stats'). * @return array List of all possible key variations. */ private function get_cache_key_variations($key_prefix) { } /** * Delete all cache variations for a specific product. * * @param int $product_id The product ID. */ public static function delete_single_product_cache($product_id) { } /** * Get all possible cache key variations for a single product. * * Generates: base, range-only, comparison-only, range+comparison combos, all with product_id. * * @param string $key_prefix The base key prefix (e.g., 'products_single_info'). * @param int $product_id The product ID. * @return array List of all possible key variations with product_id. */ private function get_single_product_cache_key_variations($key_prefix, $product_id) { } /** * Delete all single product report caches for all products. * * Gets all product IDs from database and deletes their cache variations. */ public static function delete_all_single_product_caches() { } /** * Get all product IDs from database. * * @return array List of product IDs. */ private function get_all_product_ids() { } /** * Delete all variations of a cache key. * * @param string $key_prefix The base key prefix (without 'report_' prefix). */ private function delete_cache_variations($key_prefix) { } /** * Get product-related cache keys. * * @return array List of product cache key prefixes (without 'report_' prefix). */ public static function get_product_cache_keys() { } /** * Get single product-related cache keys. * * @return array List of single product cache key prefixes (with product_id). */ public static function get_single_product_cache_keys() { } /** * Get order/customer-related cache keys. * * @return array List of order/customer cache key prefixes (without 'report_' prefix). */ public static function get_order_cache_keys() { } /** * Delete all report caches. * * @param string $key_prefix Optional key prefix to delete specific caches. */ public static function delete_all_cache($key_prefix = '') { } /** * Delete product-related report caches. */ public static function delete_product_cache() { } /** * Delete order/customer-related report caches. */ public static function delete_order_cache() { } /** * Get orders data by location (country/state) with aggregation. * * @param string $date_from Start date. * @param string $date_to End date. * @param string $aggregate 'count' for order count, 'customers' for unique customer count, 'sum' for revenue. * @param int $product_id Optional product ID to filter orders. * @param array|null $statuses Optional list of order statuses to include. Null means no status filter. * @return array */ public function get_orders_by_location($date_from, $date_to, $aggregate = 'count', $product_id = null, $statuses = null) { } /** * Get chart labels for the given range (alias of get_time_series_labels). * * @param string $range The date range. * * @return array */ protected function get_chart_labels($range) { } /** * Format series data as x/y array * * @param array $values The data values. * @param array $labels The labels. * @return array */ public function format_chart_data($values, $labels) { } /** * Format chart data with labels (int variant). * * @param array $values The data values. * @param array $labels The labels. * @return array */ protected function format_chart_data_with_labels($values, $labels) { } /** * Map raw date-grouped query results to a flat array aligned with labels. * * Replaces the repeated pattern of: fill keys with 0, loop results, * call get_date_key(), assign to matching bucket, return array_values(). * * @param array $rows Query results with 'order_date' and a value column. * @param string $range The date range (used for label formatting). * @param string $value_col Column name for the value (default 'order_count'). * @param string $cast Type to cast values to: 'int' or 'float'. * @return array Flat array of cast values aligned with labels. */ protected function map_to_date_series($rows, $range, $value_col = 'order_count', $cast = 'int') { } /** * Get 24-hour labels for heatmap charts. * * @return string[] */ protected function get_hour_labels() { } /** * Get order status color map. * * @return array */ protected function get_status_colors() { } /** * Get order status label map. * * @return array */ protected function get_status_labels() { } /** * Build a date-to-hours map for heatmap queries. * * @param string $date_from Start date (Y-m-d). * @param string $date_to End date (Y-m-d). * @return array */ protected function build_heatmap_date_map($date_from, $date_to) { } /** * Build heatmap data array from a date-hours map and hour labels. * * @param array $map Date-to-hours map from build_heatmap_date_map(). * @param string[] $hour_labels 24-hour labels from get_hour_labels(). * @return array */ protected function build_heatmap_data($map, $hour_labels) { } /** * Build a status/fulfillment breakdown array. * * @param string $range The date range. * @param array $statuses Status key => label pairs. * @param array $colors Status key => color pairs. * @param array $labels Status key => translated label pairs. * @param string $filter_key The query filter key ('status' or 'fulfill_status'). * @return array */ protected function build_status_breakdown($range, $statuses, $colors, $labels, $filter_key = 'status') { } } /** * Reports Customer API */ class Customers extends \EasyCommerce\API\Reports\Reports { /** * Customer stats - total, new, repeat, orders per customer, LTV, AOV * * @param \WP_REST_Request $request The request object. */ public function stats($request) { } /** * Calculate customer stats for a given range * * @param string $range The date range. * @return array */ protected function calculate_customer_stats($range) { } /** * Customers over time — New and Repeat customer datasets (current + comparison). * * @param \WP_REST_Request $request */ public function over_time($request) { } /** * Customer heatmap - customers over time by hour and day * * Response: * { * "range": "last-30", * "from": "2026-03-01", * "to": "2026-03-30", * "data": [ * { "x": "12am", "y": "2026-03-01", "v": 0 }, * { "x": "1am", "y": "2026-03-01", "v": 0 }, * ... * { "x": "11pm", "y": "2026-03-01", "v": 3 }, * { "x": "0am", "y": "2026-03-02", "v": 0 }, * ... * ] * } * * @param \WP_REST_Request $request */ public function heatmap($request) { } /** * Build new customers series for a given range * * @param string $range * @param string[] $categories * @return int[] */ private function build_new_customers_series($range, $categories) { } /** * Build repeat customers series for a given range * * @param string $range * @param string[] $categories * @return int[] */ private function build_repeat_customers_series($range, $categories) { } /** * Customers by country/state location * * Response (world): * { * "range": "last-30", * "type": "world", * "data": { "US": 100, "GB": 60 }, * "country_names": { "US": "United States", ... }, * "country_numeric": { "US": "840", ... } * } * * Response (states): * { * "range": "last-30", * "type": "states", * "country": "US", * "country_iso3": "USA", * "data": { "CA": 40, "NY": 30 }, * "states_data": [...] * } * * @param \WP_REST_Request $request */ public function customer_by_location($request) { } /** * Top customers * * @param \WP_REST_Request $request */ public function top_customers($request) { } /** * Get top customers by revenue for a date range. * * @param string $date_from Start date. * @param string $date_to End date. * @param int $limit Number of customers to return. * @return array */ private function get_top_customers_by_revenue($date_from, $date_to, $limit = 50) { } } /** * Reports Legacy API - maintains backward compatibility */ class LegacyReports extends \EasyCommerce\API\Reports\Reports { /** * Get the full report data with charts * * @param \WP_REST_Request $request The request object. */ public function reports($request) { } } /** * Reports Orders API */ class Orders extends \EasyCommerce\API\Reports\Reports { /** * Reports orders overview stats * * @param \WP_REST_Request $request The request object. */ public function stats($request) { } /** * Orders over time — Order Count and Order Amount datasets (current + comparison). * * @param \WP_REST_Request $request */ public function over_time($request) { } /** * Build a flat order-count array (int per category bucket). * * @param string $range * @param string[] $categories * @return int[] */ private function build_count_series($range, $categories) { } /** * Build a flat order-amount array (float per category bucket). * * @param string $range * @param string[] $categories * @return float[] */ private function build_amount_series($range, $categories) { } /** * Customer order frequency report. * * @param \WP_REST_Request $request */ public function order_frequency($request) { } /** * Orders by status * * @param \WP_REST_Request $request */ public function status_breakdown($request) { } /** * Get fulfillment status color map. * * @return array */ private function get_fulfill_colors() { } /** * Orders by fulfillment status * * @param \WP_REST_Request $request */ public function fulfillment_breakdown($request) { } /** * Orders heatmap — hourly order count per date. * Each date has 24 hourly buckets (0–23). * * Response: * { * "range": "last-30", * "from": "2026-03-01", * "to": "2026-03-30", * "data": [ * { "x": "0am", "y": "2026-03-01", "v": 5 }, * { "x": "1am", "y": "2026-03-01", "v": 0 }, * ... * { "x": "11pm", "y": "2026-03-01", "v": 3 }, * { "x": "0am", "y": "2026-03-02", "v": 0 }, * ... * ] * } * * @param \WP_REST_Request $request */ public function heatmap($request) { } /** * Orders by country * * Response (world): * { * "range": "last-30", * "type": "world", * "data": { "US": 100, "GB": 60 }, * "country_names": { "US": "United States", ... }, * "country_numeric": { "US": "840", ... } * } * * Response (states): * { * "range": "last-30", * "type": "states", * "country": "US", * "country_iso3": "USA", * "data": { "CA": 40, "NY": 30 }, * "states_data": [...] * } * * @param \WP_REST_Request $request */ public function order_by_location($request) { } } /** * Reports Overview API */ class Overview extends \EasyCommerce\API\Reports\Reports { /** * Reports stats overview * * @param \WP_REST_Request $request The request object. */ public function stats($request) { } /** * Get total products sold * * @param string $range The date range. * @return int */ private function get_products_sold($range) { } /** * Get unique customers count * * @param string $range The date range. * @return int */ private function get_unique_customers($range) { } /** * Get Sales vs Refund vs Revenue data with chart visualization * * @param \WP_REST_Request $request The request object. */ public function sales_refund_revenue($request) { } /** * Count items by date from an array of records with 'created_at'. * * @param array $items Array of records with 'created_at' key. * @param string $range The date range. * @return array Chart-formatted data array. */ private function count_items_by_date($items, $range) { } /** * Sum values by date from an array of records with 'created_at'. * * @param array $items Array of records with 'created_at' and 'total'. * @param string $range The date range. * @return array Chart-formatted data array. */ private function sum_items_by_date($items, $range) { } /** * Get sales amount by date * * @param string $range The date range. * @param string $status Optional status filter. * * @return array */ private function get_sales_by_date($range) { } /** * Get refunds by date from the refunds table * * @param string $range The date range. * * @return array */ private function get_refunds_by_date($range) { } /** * Sum refunds by date and format for chart * * @param array $refunds_by_date Refunds keyed by date. * @param string $range The date range. * * @return array */ private function sum_refunds_by_date($refunds_by_date, $range) { } /** * Get net revenue by date * * @param string $range The date range. * * @return array */ private function get_revenue_by_date($range) { } /** * Get orders vs refund count comparison for chart visualization * * @param \WP_REST_Request $request The request object. */ public function order_vs_refund($request) { } /** * Get order count by date * * @param string $range The date range. * * @return array */ private function get_order_count_by_date($range) { } /** * Get refund count by date * * @param string $range The date range. * * @return array */ private function get_refund_count_by_date($range) { } /** * Get order status breakdown * * @param \WP_REST_Request $request The request object. */ public function order_status($request) { } /** * Get order type breakdown (new vs returning orders) * * @param \WP_REST_Request $request The request object. */ public function order_type($request) { } /** * Get order count by type (new vs returning) for chart data * * @param string $range The date range. * @param string $type The order type ('new' or 'returning'). * * @return array */ private function get_order_type_by_date($range, $type = 'new') { } /** * Get top selling products * * @param \WP_REST_Request $request The request object. */ public function top_selling($request) { } /** * Get top selling products * * @param string $range The date range. * @param int $limit Number of products to return. * * @return array */ private function get_top_selling_products($range, $limit = 5) { } /** * Get product catalog stats * * @param \WP_REST_Request $request The request object. */ public function catalog_stats($request) { } /** * Get catalog stats data * * @param string $range The date range. * * @return array */ private function get_catalog_stats_data($range) { } /** * Get new vs returning customers chart data * * @param \WP_REST_Request $request The request object. */ public function customer_type($request) { } /** * Get customer type data by date * * @param string $range The date range. * @param string $type The customer type ('new' or 'returning'). * * @return array */ private function get_customer_type_by_date($range, $type = 'new') { } /** * Get customer overview stats and top customers * * @param \WP_REST_Request $request The request object. */ public function customer_overview($request) { } /** * Get customer metrics for a date range * * @param string $range The date range. * * @return array */ private function get_customer_metrics($range) { } /** * Get top customers by spending * * @param string $range The date range. * @param int $limit Number of customers to return. * * @return array */ private function get_top_customers($range, $limit = 10) { } } /** * Reports Products API */ class Products extends \EasyCommerce\API\Reports\Reports { /** * Products stats overview * * @param \WP_REST_Request $request The request object. */ public function stats($request) { } /** * Get date range with time for queries. * * @param string $range The date range. * @return array { from: string, to: string, from_raw: string, to_raw: string, is_all_time: bool } */ private function get_query_date_range($range) { } /** * Calculate product stats for a given range * * @param string $range The date range. * @return array */ private function calculate_product_stats($range) { } /** * Get product sales stats (gross sales and refunds) * * @param string $range The date range. * @return array */ private function get_product_sales_stats($range) { } /** * Get average rating across products * * @param string $range The date range. * @return float */ private function get_average_rating($range) { } /** * Get total count of ratings across products * * @param string $range The date range. * @return int */ private function get_total_ratings_count($range) { } /** * Get products sold over time with comparison * * @param \WP_REST_Request $request The request object. */ public function products_sold_over_time($request) { } /** * Get products sold count by date * * @param string $range The date range. * * @return array */ private function get_products_sold_by_date($range) { } /** * Get most sold products with detailed metrics * * @param \WP_REST_Request $request The request object. */ public function most_sold($request) { } /** * Get least sold products with detailed metrics * * @param \WP_REST_Request $request The request object. */ public function least_sold($request) { } /** * Get most sold products data * * @param string $range The date range. * @param int $limit Number of products to return. * * @return array */ private function get_most_sold_products($range, $limit = 10) { } /** * Get least sold products data * * @param string $range The date range. * @param int $limit Number of products to return. * * @return array */ private function get_least_sold_products($range, $limit = 10) { } /** * Get sold products data with detailed metrics. * * @param string $range The date range. * @param int $limit Number of products to return. * @param string $order Sort direction: 'ASC' or 'DESC'. * * @return array */ private function get_sold_products($range, $limit = 10, $order = 'DESC') { } /** * Get total stock for a product * * @param int $product_id The product ID. * @param string $variations_table The variations table name. * * @return int */ private function get_product_stock($product_id, $variations_table) { } /** * Get product name by ID * * @param \WP_REST_Request $request The request object. */ public function get_product_name($request) { } /** * Get single product stats * * @param \WP_REST_Request $request The request object. */ public function single_product_stats($request) { } /** * Get single product stats data * * @param int $product_id The product ID. * @param string $range The date range. * * @return array */ private function get_single_product_stats_data($product_id, $range) { } /** * Get product rating * * @param int $product_id The product ID. * * @return float */ private function get_product_rating($product_id) { } /** * Get single product basic info with variations * * @param \WP_REST_Request $request The request object. */ public function single_product_info($request) { } /** * Get single product info data * * @param \EasyCommerce\Models\Product $product The product object. * @param string $range The date range. * * @return array */ private function get_single_product_info_data($product, $range = 'last-30') { } /** * Get product variations with sales and rating stats * * @param int $product_id The product ID. * @param string $range The date range. * * @return array */ private function get_product_variations_with_stats($product_id, $range = 'last-30') { } /** * Get single product sales over time with new vs repeat customers * * @param \WP_REST_Request $request The request object. */ public function single_product_sales_over_time($request) { } /** * Get new customers who bought a specific product by date * * @param int $product_id The product ID. * @param string $range The date range. * * @return array */ private function get_single_product_new_customers_by_date($product_id, $range) { } /** * Get repeat customers who bought a specific product by date * * @param int $product_id The product ID. * @param string $range The date range. * * @return array */ private function get_single_product_repeat_customers_by_date($product_id, $range) { } /** * Get single product sales by location (country/state). * * Response (world): * { * "range": "last-30", * "type": "world", * "data": { "US": 120.00, "GB": 60.00 }, * "country_names": { "US": "United States", ... }, * "country_numeric": { "US": "840", ... } * } * * Response (states): * { * "range": "last-30", * "type": "states", * "country": "US", * "country_iso3": "USA", * "data": { "CA": 80.00, "NY": 40.00 }, * "states_data": [...] * } * * @param \WP_REST_Request $request The request object. */ public function product_sale_by_location($request) { } /** * Aggregate product-level revenue by country/state. * * Unlike get_orders_by_location() which sums o.total (the full order * amount), this method uses oi.price * oi.quantity so that only the * specific product's contribution is counted per location. * * @param int $product_id Product ID to scope. * @param string $date_from Start datetime (Y-m-d). * @param string $date_to End datetime (Y-m-d H:i:s, with 23:59:59 appended by caller). * @return array Same shape as get_orders_by_location() with type=world|states. */ private function get_product_sales_by_location(int $product_id, string $date_from, string $date_to): array { } /** * Get single product reviews with stats * * @param \WP_REST_Request $request The request object. */ public function single_product_reviews($request) { } /** * Get single product reviews data * * @param int $product_id The product ID. * @param int $limit Number of reviews to return. * @param string $range The date range. * * @return array */ private function get_single_product_reviews_data($product_id, $limit = 6, $range = 'last-30') { } /** * Get product review count * * @param int $product_id The product ID. * @param array $date_query Optional WP_Comment_Query date_query array. * * @return int */ private function get_product_review_count($product_id, $date_query = array()) { } /** * Get product rating counts by star * * @param int $product_id The product ID. * @param array $date_query Optional WP_Comment_Query date_query array. * * @return array */ private function get_product_rating_counts($product_id, $date_query = array()) { } /** * Get product reviews * * @param int $product_id The product ID. * @param int $limit Number of reviews to return. * @param array $date_query Optional WP_Comment_Query date_query array. * * @return array */ private function get_product_reviews($product_id, $limit = 6, $date_query = array()) { } } /** * Reports Revenue API */ class Revenue extends \EasyCommerce\API\Reports\Reports { /** * Revenue stats - gross revenue, averages by customer, order, and product * * @param \WP_REST_Request $request The request object. */ public function stats($request) { } /** * Revenue over time — Revenue Amount datasets (current + comparison) * * @param \WP_REST_Request $request */ public function over_time($request) { } /** * Build a revenue amount array keyed by label. * * @param string $range * @param string[] $labels * @return float[] */ private function build_revenue_series($range, $labels) { } /** * Calculate revenue stats for a given range * * Mirrors calculate_stats() in Reports: only completed, processing, * partially_refunded, and refunded orders count toward gross revenue, * and refunds come from the Refund table (approved refunds only). * * @param string $range The date range. * @return array */ protected function calculate_revenue_stats($range) { } /** * Top customers by revenue * * @param \WP_REST_Request $request */ public function top_customers($request) { } /** * Revenue by country/state location * * Response (world): * { * "range": "last-30", * "type": "world", * "data": { "US": 1000.00, "GB": 600.00 }, * "country_names": { "US": "United States", ... }, * "country_numeric": { "US": "840", ... } * } * * Response (states): * { * "range": "last-30", * "type": "states", * "country": "US", * "country_iso3": "USA", * "data": { "CA": 400.00, "NY": 300.00 }, * "states_data": [...] * } * * @param \WP_REST_Request $request */ public function revenue_by_location($request) { } } } namespace EasyCommerce\API { class Shipping_Plan extends \EasyCommerce\Abstracts\API { /** * Retrieve all shipping plans or a specific plan by ID. * * @param WP_REST_Request $request * @return WP_REST_Response */ public function get_all($request) { } /** * Create a new shipping plan. * * @param WP_REST_Request $request * @return WP_REST_Response */ public function create($request) { } /** * Update an existing shipping plan. * * @param WP_REST_Request $request * @return WP_REST_Response */ public function update($request) { } /** * Delete a shipping plan. * * @param WP_REST_Request $request * @return WP_REST_Response */ public function delete($request) { } /** * Retrieve shipping plans available for a specific region. * * @param WP_REST_Request $request * @return WP_REST_Response */ public function get_by_location($request) { } } /** * Tax API class */ class Tax extends \EasyCommerce\Abstracts\API { public function list_classes($request) { } /** * Create a tax class with associated rates. * * @param WP_REST_Request $request * @return WP_REST_Response */ public function create_class($request) { } public function get_class($request) { } /** * Update a tax class with associated rates. * * @param WP_REST_Request $request * @return WP_REST_Response */ public function update_class($request) { } /** * Delete a tax class and its associated rates. * * @param WP_REST_Request $request * @return WP_REST_Response */ public function delete_class($request) { } /** * Retrieve matching tax CSV files for the given countries and return them in a JSON response. * * This REST API endpoint uses the Tax_Model to search the plugin's /taxes folder * for CSV files matching the provided country codes. Only existing files are returned. * * @param WP_REST_Request $request The current REST API request containing 'countries' parameter. * @return WP_REST_Response JSON response containing an array of matched country codes. */ public function get_tax_files($request) { } /** * Retrieve tax rates from CSV and return them in a JSON response. * * This endpoint uses the Tax_Model to read tax rates from the CSV file * and formats them for API consumption. * * @param WP_REST_Request $request The current REST API request. * @return WP_REST_Response JSON response containing tax rates or an error message. */ public function get_tax_rates($request) { } } class Taxonomy extends \EasyCommerce\Abstracts\API { use \EasyCommerce\Traits\Cleaner; public function get_categories($request) { } public function add_category($request) { } public function update_category($request) { } public function delete_category($request) { } public function bulk_delete_categories($request) { } public function get_brands($request) { } public function add_brand($request) { } public function update_brand($request) { } public function delete_brand($request) { } public function bulk_delete_brands($request) { } public function get_tags($request) { } public function add_tag($request) { } public function update_tag($request) { } public function delete_tag($request) { } public function bulk_delete_tags($request) { } } class Transaction extends \EasyCommerce\Abstracts\API { /** * List transactions with optional filters like order ID, status, and pagination. * * @param WP_REST_Request $request * @return WP_REST_Response */ public function list($request) { } public function delete($request) { } } } namespace EasyCommerce\Abstracts { /** * Abstract Field Class */ abstract class Field { /** * Field ID. * * @var string */ protected $id = ''; /** * Field name attribute. * * @var string */ protected $name = ''; /** * Field label. * * @var string */ protected $label = ''; /** * Field value. * * @var string */ protected $value = ''; /** * Field description. * * @var string */ protected $description = ''; /** * Field column size. * * @var int */ protected $cols = 1; /** * Field placeholder. * * @var string */ protected $placeholder = ''; /** * Field options. * * @var array */ protected $options = array(); /** * Field default value. * * @var mixed */ protected $default = ''; /** * Whether the field is disabled. * * @var bool */ protected $disabled = false; /** * Whether the field is readonly. * * @var bool */ protected $readonly = false; /** * Whether the field is required. * * @var bool */ protected $required = false; /** * Field type. * * @var string */ protected $type = 'text'; /** * Field CSS class. * * @var string */ protected $class = ''; /** * Field attributes. * * @var array */ protected $atts = array(); /** * Additional field args. * * @var array */ protected $args = array(); /** * Whether the field supports multiple selections. * * @var bool */ protected $multiple = false; /** * Constructor. * * @param array $config Field configuration. */ public function __construct($config = array()) { } /** * Set whether the field supports multiple selections. * * @param bool $multiple */ public function set_multiple($multiple = false) { } /** * Get whether the field supports multiple selections. * * @return bool */ public function is_multiple() { } /** * Get the field ID. * * @return string */ public function get_id() { } /** * Get the field name attribute. * * @return string */ public function get_name() { } /** * Get the field label. * * @return string */ public function get_label() { } /** * Get the field value. * * @return string */ public function get_value() { } /** * Get the field description. * * @param string $wrapper Wrapper HTML tag. * @return string */ public function get_description($wrapper = '') { } /** * Get the field column size. * * @return int */ public function get_cols() { } /** * Get the field placeholder. * * @return string */ public function get_placeholder() { } /** * Get the field options. * * @return array */ public function get_options() { } /** * Get the field default value. * * @return mixed */ public function get_default() { } /** * Check if the field is disabled. * * @return bool */ public function is_disabled() { } /** * Check if the field is readonly. * * @return bool */ public function is_readonly() { } /** * Check if the field is required. * * @return bool */ public function is_required() { } /** * Get the field type. * * @return string */ public function get_type() { } /** * Get the field class. * * @return string */ public function get_class() { } /** * Set the field value. * * @param string $value */ public function set_value($value = '') { } /** * Set the field description. * * @param string $description */ public function set_description($description = '') { } /** * Set the field column size. * * @param int $cols */ public function set_cols($cols = 1) { } /** * Set the field placeholder. * * @param string $placeholder */ public function set_placeholder($placeholder = '') { } /** * Set the field options. * * @param array $options */ public function set_options($options = array()) { } /** * Set the field default value. * * @param mixed $default */ public function set_default($default = '') { } /** * Set the field disabled state. * * @param bool $disabled */ public function set_disabled($disabled = false) { } /** * Set the field readonly state. * * @param bool $readonly */ public function set_readonly($readonly = false) { } /** * Set the field type. * * @param string $type */ public function set_type($type = 'text') { } /** * Set the field class. * * @param string $class */ public function set_class($class = '') { } /** * Generate the CSS ID for the field. * * @return string */ public function get_field_id() { } /** * Generate the CSS class for the field. * * @return string */ public function get_field_class() { } /** * Set attributes. * * @param array $atts */ public function set_atts($atts = array()) { } /** * Get additional attributes. * * @return array */ public function get_atts() { } /** * Render additional attributes as a string. * * @return string */ protected function render_atts() { } /** * Set args. * * @param array $args */ public function set_args($args = array()) { } /** * Get args. * * @return array */ public function get_args() { } /** * Get a single arg. * * @return mix */ public function get_arg($key, $default = '') { } /** * Generate the CSS ID for the field wrapper. * * @return string */ public function get_wrapper_id() { } /** * Generate the CSS class for the field wrapper. * * @return string */ public function get_wrapper_class() { } /** * Render the field. * * @return string */ abstract public function render(); } } namespace EasyCommerce\Models { /** * Generic Database class for handling database operations across different tables. */ class Database { /** * The WordPress database access abstraction object. * * @var wpdb */ public $db; /** * The common prefix for the tables. * * @var string */ protected $prefix = 'ec_'; /** * The full database table name including the prefix. * * @var string */ protected $table_name; /** * The primary key for the specific table. * * @var string */ protected $primary_key; /** * Constructor to set up database operations. * * @param string $table_name Table name for the specific entity (without prefix). * @param string $primary_key The primary key for the specific table. */ public function __construct($table_name = null, $primary_key = 'id') { } /** * Sets the table name and updates the table name property. * * @param string $table_name Table name for the specific entity (without prefix). * @return void */ public function set_table($table_name) { } /** * Gets the table name * * @return string $table_name Table name for the specific entity (with prefix). */ public function get_table() { } /** * Gets the primary key * * @return string $primary_key The primary key for the table. */ public function get_primary_key() { } /** * Gets table data * * @return array $data Table data * @todo rename method and maybve marge it with get_rows */ public function get_data($data = '*') { } /** * Creates a new table in the database based on the table name provided during the object's instantiation. * * @param array $columns Associative array of column definitions. * @param array $options Additional options for table creation like primary key. * @return void */ public function create_table($columns, $options = array()) { } /** * Drops the table from the database. * * @return void */ public function drop_table() { } public function prepare($query, ...$args) { } /** * Retrieves an entry by its primary key ID. * * @param int $id The ID of the entry to retrieve. * @return object|null The object if found, otherwise null. */ public function get_by_id($id) { } /** * Inserts a new entry into the database. * * @param array $data Associative array of data to insert. * @return int|null The last inserted ID or null on failure. */ public function insert_row($data) { } /** * Updates an existing entry. * * @param int $id The ID of the entry to update. * @param array $data Associative array of data to update. * @return bool True if successful, false otherwise. */ public function update_row($id, array $data) { } /** * Deletes an entry by its primary key ID. * * @param int $id The ID of the entry to delete. * @return bool True if successful, false otherwise. */ public function delete_row($id) { } /** * Inserts multiple entries into the database. * * @param array $rows Array of associative arrays of data to insert. * @return array Array of inserted IDs or null on failure. */ public function insert_rows($rows) { } /** * Updates multiple entries in the database. * * @param array $rows Array of associative arrays containing 'id' and 'data' keys. * @return bool True if all updates are successful, false otherwise. */ public function update_rows($rows) { } /** * Deletes multiple entries from the database. * * @param array $ids Array of IDs of the entries to delete. * @return bool True if all deletions are successful, false otherwise. */ public function delete_rows($ids) { } /** * Retrieves an entry based on associative array of conditions. * * @param array $conditions Associative array of conditions. * @return object|null The object if found, otherwise null. */ public function get_row($conditions) { } /** * Retrieves multiple entries based on associative array of conditions. * * This method dynamically builds a query to retrieve rows from the database * table, allowing for flexible conditions, sorting, pagination, and nested conditions. * * CONDITIONS EXAMPLES: * - Basic conditions: `[ [ 'status' => 'active' ], [ 'price' => 100 ] ]` * Produces: `WHERE status = 'active' AND price = 100` * - Nested conditions: `[ [ 'price' => [ '>', 50 ] ] ]` * Produces: `WHERE price > 50` * - Multiple nested conditions: `[ [ 'price' => [ '>', 50 ] ], [ 'quantity' => [ '<', 20 ] ] ]` * Produces: `WHERE price > 50 AND quantity < 20` * * SORTING EXAMPLES: * - Default sorting by ID ascending: `'ASC'` * - For descending order: `'DESC'` * * PAGINATION EXAMPLES: * - Limit to 10 rows: `$limit = 10` * - Skip the first 5 rows: `$offset = 5` * * @param array $conditions Associative array of conditions. * - For simple conditions: `[ [ 'column' => 'value' ] ]` (e.g., `[ [ 'status' => 'active' ] ]`). * - For nested conditions: `[ [ 'column' => [ 'operator', value ] ] ]` (e.g., `[ [ 'price' => [ '>', 50 ] ] ]`). * * @param int $limit The number of rows to return. Defaults to 0 (no limit). * @param int $offset The number of rows to skip before starting to return results. Defaults to 0. * @param string $order The sorting order ('ASC' or 'DESC'). Defaults to 'ASC'. * * @return array Array of objects if found, otherwise an empty array. * * USAGE EXAMPLES: * * Example 1: Retrieve all active rows with price > 100, sorted descending * $rows = $db->get_rows( * [ * [ 'status' => 'active' ], * [ 'price' => [ '>', 100 ] * ], * 10, // Limit * 0, // Offset * 'DESC' // Order * ); * * Example 2: Retrieve rows with multiple conditions and pagination * $rows = $db->get_rows( * [ * [ 'price' => [ '>', 50 ] ], * [ 'quantity' => [ '<', 20 ] ], * ], * 5, // Limit * 10, // Offset * 'ASC' // Order * ); * * Example 3: Retrieve rows without any conditions (get all) * $rows = $db->get_rows( [], 20, 0, 'ASC'); */ public function get_rows($conditions = array(), $limit = 0, $offset = 0, $order = 'DESC', $orderby = 'id') { } /** * Retrieves the total count of entries based on associative array of conditions. * * @param array $conditions Associative array of conditions. * @return int The count of entries. */ public function get_count($conditions = array()) { } /** * Prepares an SQL clause * * @see get_rows() * @return [ 'where' => 'where clause statements', 'values' => 'clause values' ] */ private function prepare_clause($conditions) { } /** * Get the default WordPress table prefix. * * @return string */ public function get_wp_prefix() { } /** * Get the table prefix. * * @return string */ public function get_prefix() { } public function exec($sql, $output = OBJECT) { } /** * Gets the $db instance */ public function get_instance() { } } } namespace EasyCommerce\Abstracts { /** * Class Meta * Handles generic meta operations. */ abstract class Meta extends \EasyCommerce\Models\Database { use \EasyCommerce\Traits\Cleaner; /** * The key used to identify unique IDs in the meta table. * * @var string */ protected $unique_id_key; /** * Constructor. * * @param string $table_name The name of the table. * @param string $unique_id_key The key used to identify unique IDs. */ public function __construct($table_name, $unique_id_key) { } /** * Add meta data. * * @param int $unique_id The unique ID to associate the meta data with. * @param string $key The meta key. * @param mixed $value The meta value. * @return int|null The last inserted ID or null on failure. */ public function add($unique_id, $key, $value) { } /** * Get meta data. * * @param int $unique_id The unique ID to retrieve meta data for. * @param string|null $key The meta key to retrieve. If null, retrieves all meta data. * @param bool $single Whether to return a single value or an array of values. * @return mixed */ public function get($unique_id, $key = null, $single = true) { } /** * Update meta data. * * @param int $unique_id The unique ID to update meta data for. * @param string $key The meta key. * @param mixed $value The meta value. * @return bool|int If updating an existing entry, returns true on success, false on failure. * If creating a new entry, returns the last inserted ID or null on failure. */ public function update($unique_id, $key, $value) { } /** * Delete meta data. * * @param int $unique_id The unique ID to delete meta data for. * @param string $key The meta key. * @return bool */ public function delete($unique_id, $key) { } } /** * Abstract Model Class * Provides a base for all model classes with Database dependency injection. */ abstract class Model { /** * @var \EasyCommerce\Models\Database Instance for handling DB operations */ public $db; /** * @var string Table name (without prefix) */ protected $table; /** * @var string Primary key column */ protected $primary_key = 'id'; /** * Constructor for the Model class. * * @param \EasyCommerce\Models\Database|null $db Optional. Database instance for dependency injection. */ public function __construct(\EasyCommerce\Models\Database $db = null) { } } /** * Abstract Payment Method Class */ abstract class Payment_Method { /** * Payment method ID * * @var string */ protected $id; /** * Payment method title * * @var string */ protected $title; /** * Payment method description * * @var string */ protected $description; /** * IDs of already-registered payment methods, used to prevent duplicate * registration when a legacy standalone addon plugin is active alongside * the built-in core version of the same gateway. * * @var string[] */ private static array $registered_ids = []; /** * Constructor * * @param string $id * @param string $title * @param string $description */ public function __construct($id, $title, $description = '') { } /** * Register payment method in the checkout form */ public function register_payment_method() { } /** * Add payment method to the available methods * * @param array $methods Existing payment methods. * @return array Updated list of payment methods. */ public function add_payment_method($methods) { } /** * Enqueue payment method scripts */ public function enqueue_scripts() { } /** * Localize payment method variables * * @param array $vars Existing localized variables. * @return array Updated list of localized variables. */ public function localized($vars) { } /** * Display and save payment method settings * * @return array Payment method settings. */ public function settings() { } /** * Process payment * * @param string $status Payment status. * @param int $order_id Order ID. * @param array $params Payment parameters. * @param int $customer_id Customer ID. */ public function process_payment($status, $order_id, $params, $customer_id) { } /** * Process transaction * * @param mixed $transaction_id Transaction ID. * @param int $order_id Order ID. * @param float $total_amount Total amount. * @param int $customer_id Customer ID. * @param array $params Payment parameters. */ public function insert_transaction($transaction_id, $order_id, $total_amount, $customer_id, $params) { } /** * Display payment form * * @return string Payment form HTML. */ public function payment_form() { } /** * Get payment method status * * @return bool Payment method status. */ public function get_status() { } /** * Get payment method ID * * @return string Payment method ID. */ public function get_id() { } /** * Get payment method title * * @return string Payment method title. */ public function get_title() { } /** * Get payment method name * * @return string Payment method name. */ public function get_method_name() { } /** * Get payment method description * * @return string Payment method description. */ public function get_description() { } /** * Get payment method icon * * @return string Payment method icon HTML or URL. */ public function get_icon() { } public function is_enabled() { } public function is_available() { } public function is_offline(): bool { } public function refund($order_id, $reason, $amount) { } public function supports_refund() { } /** * Check payment method availability * * @param bool $unset Unset flag. * @param bool $has_physical Flag for physical product. * * @return bool Updated unset flag. */ public function validate_availability($unset, $has_physical) { } /** * Supports recurring payments * * @param bool $supports Supports recurring payments. * @return bool Updated supports flag. * */ public function supports_recurring($supports, $payment_id, $cart) { } } /** * Abstract User Class */ abstract class User { use \EasyCommerce\Traits\Cache; /** * User ID * * @var int */ protected $id = 0; /** * User email * * @var string */ protected $email = ''; /** * User display name * * @var string */ protected $name = ''; /** * User first name * * @var string */ protected $first_name = ''; /** * User last name * * @var string */ protected $last_name = ''; /** * User role * * @var string */ protected $role = ''; /** * User password * * @var string */ protected $password; /** * User join date * * @var string */ protected $join_date; /** * Constructor * * @param int|null $id User ID. */ public function __construct($id = null) { } /** * Get user ID. * * @return int */ public function get_id() { } /** * Get user email. * * @return string */ public function get_email() { } /** * Get user name. * * @return string */ public function get_name() { } /** * Set user first name. */ public function set_first_name($first_name) { } /** * Get user first name. * * @return string */ public function get_first_name() { } /** * Get user last name. * * @return string */ public function get_last_name() { } /** * Set user last name. */ public function set_last_name($last_name) { } /** * Get user role. * * @return string */ public function get_role() { } /** * Set user email. * * @param string $email */ public function set_email($email) { } /** * Set user photo. * * @param string $photo */ public function set_photo($photo = '') { } /** * Get user photo. * * @return string $photo */ public function get_photo() { } /** * Set user name. * * @param string $name */ public function set_name($name) { } /** * Set user role. * * @param string $role */ public function set_role($role) { } public function get_join_date() { } /** * Save user data. * * @return bool */ public function save() { } /** * Delete user. * * @return bool */ public function delete() { } /** * Add user meta data. * * @param string $key * @param mixed $value * @return bool */ public function add_meta($key, $value) { } /** * Get user meta data. * * @param string $key * @param bool $single * @return mixed */ public function get_meta($key, $single = true) { } /** * Update user meta data. * * @param string $key * @param mixed $value * @return bool */ public function update_meta($key, $value) { } /** * Delete user meta data. * * @param string $key * @return bool */ public function delete_meta($key) { } /** * Create a new user. * * @param array $args * @return bool */ public function create($args) { } /** * Set user password. * * @param string $password */ public function set_password($password) { } /** * @param int $expiry Time to expire the link, in minutes */ public function get_login_link($expiry = 1, $redirect = '') { } /** * List users by role with optional filters such as search query, page, and per_page. * * @param string $role * @param string|null $search * @param int $page * @param int $per_page * @return array List of users with pagination info */ public static function list($role, $search = null, $page = 1, $per_page = 10) { } } } namespace EasyCommerce\Bootstrap { class Activator { use \EasyCommerce\Traits\Hook; /** * Handles plugin activation tasks. * * @return void */ public static function activate() { } /** * Synchronizes plugin updates with the WordPress update system. * * @return void */ public function sync_updates() { } /** * Registers custom user roles for the plugin. * * @return void */ public function register_roles() { } /** * Registers custom post types for the plugin. * * @return void */ public function register_post_types() { } /** * Registers custom taxonomies for the plugin. * * @return void */ public function register_taxonomies() { } /** * Registers thumbnail sizes for the plugin. * * @return void */ public function register_thumbnails() { } /** * Deactivates conflicting plugins if they are active. * * @return void */ public function deactivate_conflicting_plugins() { } } } namespace EasyCommerce\Bootstrap\Activator { class Post_Type { /** * Registers the custom post type for products. * * @return void */ public function register() { } // Set default content for new products public function insert_default_content($post_id, $post, $update) { } } class Taxonomy { public function register() { } private function registerProductCategory() { } private function registerProductBrand() { } private function registerProductTag() { } } class Thumbnail { /** * Registers thumbnail sizes for the plugin. * * @return void */ public function register() { } } class Updater { /** * List of plugin slugs to check for updates. * * @var array */ private $slugs = array(); /** * API URLs for fetching plugin update data. * * @var array */ private $data_urls = array(); /** * Initializes the updater by setting plugin slugs and generating API URLs. */ public function __construct() { } /** * Checks for plugin updates. * * @param object $transient The update transient object. * @return object Modified transient object with update data. */ public function check($transient) { } /** * Retrieves plugin information for the WordPress update system. * * @param mixed $result The result object. * @param string $action The type of request. * @param object $args Request arguments. * @return mixed Plugin information or the original result. */ public function get_info($result, $action, $args) { } /** * When an addon is activated, store its first activation time */ public function set_addon_flag($plugin_file, $network_wide) { } } class User_Role { /** * Registers custom user roles. * * @return void */ public function register() { } } } namespace EasyCommerce\Bootstrap { class Initializer { /** * Initializes the plugin's components. * * @return void */ public static function initialize() { } /** * Loads configuration files for the plugin. * * @return void */ public function load_config() { } /** * Initializes controllers for wp-admin. * * @return void */ private function load_admin_controllers() { } /** * Initializes controllers for public-facing parts of the site. * * @return void */ private function load_public_controllers() { } /** * Initializes controllers that operate on both admin and public interfaces. * * @return void */ private function load_common_controllers() { } private function load_payment_controllers() { } } class Installer { use \EasyCommerce\Traits\Queue; /** * Runs the installation routines. * * @return void */ public static function install() { } public function setup_wizard_redirect($plugin) { } /** * Seeds sensible defaults on a fresh install so the store is usable * even when the setup wizard is skipped. * * Each value is only written if the slot is currently empty, so existing * data is never overwritten (e.g. on upgrades or re-activations). * * @return void */ private function setup_defaults() { } /** * Prepares the plugin settings and configurations. * * @return void */ public function prepare() { } /** * Seeds Cash on Delivery as an active payment method on fresh install. * * @return void */ protected function seed_default_payment_methods() { } /** * Sets up scheduled tasks for the plugin. * * @return void */ public function set_cron() { } /** * Checks if the database is up to date. * * @return bool True if the database is up to date, false otherwise. */ protected function is_database_up_to_date() { } /** * Creates database tables from the configuration file. * * @return void */ protected function create_tables() { } /** * Updates existing database tables to match the current schema. * * @return void */ protected function update_existing_tables() { } /** * Handles data migration for the coupons table during schema updates. * * This method migrates legacy columns ('discount_type' to 'type', 'amount' to 'offer') * by adding new columns, copying data, and dropping legacy ones. * * @param \EasyCommerce\Models\Database $db Database instance. * @param string $table_full_name Full table name with prefix. * @param array $columns Current column definitions from config. * @param array $options Current table options from config. * * @return void */ public function handle_coupons_data_migration(\EasyCommerce\Models\Database $db, string $table_full_name, array $columns, array $options) { } /** * Handles schema migration for the cart_sessions table during schema updates. * * Adds the `payment_initiated` value to the `status` ENUM on existing installs. * dbDelta does not reliably ALTER ENUM definitions on existing columns, so the * change is applied explicitly here. Without it, the payment lock silently fails * because MySQL coerces the unknown ENUM value to an empty string. * * @param \EasyCommerce\Models\Database $db Database instance. * @param string $table_full_name Full table name with prefix. * @param array $columns Current column definitions from config. * @param array $options Current table options from config. * * @return void */ public function handle_cart_sessions_data_migration(\EasyCommerce\Models\Database $db, string $table_full_name, array $columns, array $options) { } /** * Migrates the Stripe customer id from the legacy `_stripe_customer_id` user-meta * key to the canonical `stripe_customer_id` so existing customers are reused after * the PaymentIntent helper was standardized onto the canonical key. * * @return void */ public function migrate_stripe_customer_meta() { } /** * Handles schema migration for the orders table during schema updates. * * Adds the `failed` value to the `status` ENUM on existing installs and * back-fills any orders whose status was previously coerced to '' (failed * payments written before `failed` existed) to `failed`. dbDelta does not * reliably alter ENUM definitions on existing columns, so the change is * applied explicitly here. * * @param \EasyCommerce\Models\Database $db Database instance. * @param string $table_full_name Full table name with prefix. * @param array $columns Current column definitions from config. * @param array $options Current table options from config. * * @return void */ public function handle_orders_data_migration(\EasyCommerce\Models\Database $db, string $table_full_name, array $columns, array $options) { } /** * Updates or adds the database version in the options table. * * @return void */ protected function update_db_version() { } } class Uninstaller { /** * Runs the uninstallation routines. * * @return void */ public static function uninstall() { } /** * Removes stored flags and options related to the plugin. * * @return void */ protected function delete_flags() { } } } namespace EasyCommerce\Traits { trait Asset { /** * Registers a script with WordPress. * * @param string $handle Script handle. * @param string $src Script source URL. * @param array $deps Script dependencies. * @param string $ver Script version, defaults to the constant EASYCOMMERCE_VERSION. * @param bool $args Optional arguments. */ public function register_script($handle, $src, $deps = array(), $ver = null, $args = array()) { } /** * Enqueues a script in WordPress, registering it first if not already registered. * * @param string $handle Script handle. * @param string $src Script source URL. * @param array $deps Script dependencies. * @param string $ver Script version, defaults to the constant EASYCOMMERCE_VERSION. * @param bool $args Whether to enqueue the script in the footer. */ public function enqueue_script($handle, $src, $deps = array(), $ver = null, $args = array('in_footer' => true)) { } /** * Localizes a script in WordPress. * * @param string $handle Script handle. * @param string $object_name Name of the JavaScript object. * @param array $l10n Data to localize. */ public function localize_script($handle, $object_name, $l10n) { } /** * Registers a style with WordPress. * * @param string $handle Style handle. * @param string $src Style source URL. * @param array $deps Style dependencies. * @param string $ver Style version, defaults to the constant EASYCOMMERCE_VERSION. * @param string $media Media for which this stylesheet has been defined. */ public function register_style($handle, $src, $deps = array(), $ver = null, $media = 'all') { } /** * Enqueues a style in WordPress, registering it first if not already registered. * * @param string $handle Style handle. * @param string $src Style source URL. * @param array $deps Style dependencies. * @param string $ver Style version, defaults to the constant EASYCOMMERCE_VERSION. * @param string $media Media for which this stylesheet has been defined. */ public function enqueue_style($handle, $src, $deps = array(), $ver = null, $media = 'all') { } /** * Retrieves the correct version for enqueued assets. * * If WP_DEBUG is enabled, returns the current timestamp for cache busting. * Otherwise, returns the specified version or the EASYCOMMERCE_VERSION constant if no version is provided. * * @param string|null $version Optional. The version number to return. Default is null. * * @return string The version number for the asset. */ private function get_ver($version = null) { } } } namespace EasyCommerce\Controllers\Admin { class Init { use \EasyCommerce\Traits\Hook; use \EasyCommerce\Traits\Asset; use \EasyCommerce\Traits\Cache; use \EasyCommerce\Traits\Queue; use \EasyCommerce\Traits\Cleaner; /** * Constructor to add all hooks. */ public function __construct() { } /** * Handles the AI activation magic link from the token email. * * The link lands in wp-admin carrying the one-time token + email. It does not * authenticate anyone - it only works inside an already-authenticated admin * session (capability check below), then verifies the token against the * EasyCommerce store and persists the connection exactly like the manual * copy-paste flow ( {@see \EasyCommerce\API\Connectivity::verify_token} ). * * @return void */ public function connect_via_magic_link() { } /** * Adds custom body class to the admin area. * * @param string $classes Existing body classes. * * @return string Modified body classes with 'easycommerce' class added if conditions met. */ public function add_body_class($classes) { } /** * Schedules the locations database download when manually retried * via the "Retry Download" notice button. */ public function handle_locations_db_retry() { } /** * Handles secure file downloads for customers. */ public function secure_download() { } public function show_plugin_notice($plugin_file) { } public function add_page_labels($post_states, $post) { } /** * Force using block editor even if the Classic Editor plugin is activated * * @since 0.9.18-beta */ public function force_block_editor($use_block_editor, $post) { } /** * Register the email-placeholders TinyMCE plugin as a real script handle. * * TinyMCE pulls the file in through `mce_external_plugins`, which never goes * through wp_enqueue_script() - so wp_set_script_translations() never ran for * it and its __() strings always rendered in English. Enqueueing it as a * normal handle (after `wp-tinymce`, so `tinymce` is defined) prints the * locale data and self-registers the plugin with TinyMCE's PluginManager; * TinyMCE then skips its own fetch because the plugin is already in its * lookup table, so the external-plugin registration keeps working untouched. * * @return void */ public function enqueue_email_placeholders_script(): void { } /** * Initialize the TinyMCE plugin and button */ public function tinymce_dropdown_init(): void { } /** * Add TinyMCE plugin */ public function add_tinymce_dropdown_plugin(array $plugin_array): array { } /** * Add button to TinyMCE toolbar */ public function register_tinymce_dropdown_button(array $buttons): array { } /** * Add migration button in the admin secondary top bar */ public function add_migration_btn_in_admin_bar() { } /** * Add migration popup for installing 'Migration Addon' */ public function add_migration_popup() { } /** * Load HelpWP chat widget on all EasyCommerce admin pages. */ public function add_ai_assistant() { } /* * Intercept theme query to show custom themes */ public function intercept_theme_query() { } /** * Handles data migration for the cart sessions table on admin_init. * Adds missing columns introduced in newer versions. * * @return void * @todo remove it in future */ public function handle_cart_sessions_migration() { } /** * Truncates the local ec_ai_logs table (Settings > AI > Usage > Reset Logs). * * This only clears the per-action usage history rows; it has no effect on * the hub's authoritative monthly credit ledger (easycommerce_ai_status()). * * @return void */ public function reset_ai_logs() { } } } namespace EasyCommerce\Traits { /** * Trait Menu * * This trait provides methods to add menu and submenu pages in the WordPress admin dashboard. * * @package EasyCommerce */ trait Menu { /** * Add a menu page to the WordPress admin dashboard. * * @param string $page_title The text to be displayed in the title tags of the page when the menu is selected. * @param string $menu_title The text to be used for the menu. * @param string $capability The capability required for this menu to be displayed to the user. * @param string $menu_slug The slug name to refer to this menu by (should be unique for this menu). * @param callable $callback Optional. The function to be called to output the content for this page. * @param string $icon_url Optional. The URL to the icon to be used for this menu. * @param int $position Optional. The position in the menu order this item should appear. */ public function add_menu($page_title, $menu_title, $capability, $menu_slug, $callback = '', $icon_url = '', $position = null) { } /** * Add a submenu page to a parent menu in the WordPress admin dashboard. * * @param string $parent_slug The slug name for the parent menu (or the file name of a standard WordPress admin page). * @param string $page_title The text to be displayed in the title tags of the page when the submenu is selected. * @param string $menu_title The text to be used for the submenu. * @param string $capability The capability required for this menu to be displayed to the user. * @param string $menu_slug The slug name to refer to this submenu by (should be unique for this submenu). * @param callable $callback Optional. The function to be called to output the content for this page. * @param int $position Optional. The position in the menu order this item should appear. */ public function add_submenu($parent_slug, $page_title, $menu_title, $capability, $menu_slug, $callback = '', $position = null) { } } } namespace EasyCommerce\Controllers\Admin { class Menu { use \EasyCommerce\Traits\Hook; use \EasyCommerce\Traits\Asset; use \EasyCommerce\Traits\Menu; /** * Constructor to add all hooks. */ public function __construct() { } public function register() { } public function hide_menu() { } public function render_settings() { } public function add_action_links($actions) { } public function survey_popup() { } } } namespace EasyCommerce\Controllers\Common { class API { use \EasyCommerce\Traits\Hook; use \EasyCommerce\Traits\Auth; use \EasyCommerce\Traits\Rest; /** * Constructor to add all hooks. */ public function __construct() { } /** * Register all API endpoints */ public function register_endpoints() { } /** * Register Auth-related API endpoints */ private function register_connectivity_endpoints() { } /** * Register Addon-related API endpoints */ private function register_addon_endpoints() { } /** * Register Dashboard-related API endpoints */ private function register_dashboard_endpoints() { } /** * Register Reports-related API endpoints */ private function register_reports_endpoints() { } /** * Register Option-related API endpoints */ private function register_option_endpoints() { } /** * Register Attribute-related API endpoints */ private function register_attribute_endpoints() { } /** * Register Product-related API endpoints */ private function register_product_endpoints() { } /** * Register Product Review-related API endpoints */ private function register_product_review_endpoints() { } /** * Register Customer-related API endpoints */ private function register_customer_endpoints() { } /** * Register Profile-related API endpoints */ private function register_profile_endpoints() { } /** * Register Taxonomy-related API endpoints */ private function register_taxonomy_endpoints() { } /** * Register Cart-related API endpoints */ private function register_cart_endpoints() { } /** * Register Order-related API endpoints */ private function register_order_endpoints() { } /** * Register Transaction-related API endpoints */ private function register_transaction_endpoints() { } /** * Register Shipping Plan-related API endpoints */ private function register_shipping_plan_endpoints() { } /** * Register Geo-related API endpoints */ private function register_location_endpoints() { } /** * Register Coupon-related API endpoints */ private function register_coupon_endpoints() { } /** * Register Unified Tax API endpoints. */ private function register_tax_endpoints() { } /** * Register Abandoned Carts API endpoints. */ private function register_abandoned_cart_endpoints() { } /** * Register AI API endpoints. */ private function register_ai_endpoints() { } /** * Register AI Assistant endpoint (customer-facing). */ private function register_agent_assistant_endpoints() { } /** * Register AI Copilot endpoint (admin only). */ private function register_agent_copilot_endpoints() { } /** * Register Email Placeholder-related API endpoints */ private function register_email_placeholder_endpoints() { } /** * Register Importer-related API endpoints */ private function register_importer_endpoints() { } /** * Register Log-related API endpoints */ private function register_log_endpoints() { } /** * Register Notice-related API endpoints */ private function register_notice_endpoints() { } /** * Register Refund-related API endpoints */ private function register_refund_endpoints() { } } class Asset { use \EasyCommerce\Traits\Hook; use \EasyCommerce\Traits\Asset; /** * Constructor to add all hooks. */ public function __construct() { } /** * Front-end assets for the store patterns (#3175 — theme compatibility). * * Block themes render the patterns from theme.json tokens as-is. Classic * themes additionally get store-patterns.css — a self-contained, `.ec-pattern` * scoped fallback for spacing, full-width alignment and colour presets. The * applied design's colour/typography preset is layered on both via inline CSS. * * Only loads on pages that actually contain a store pattern. */ public function add_pattern_assets() { } /** * Mirror the applied design's token system inside the block editor canvas, * so editing a store page previews its real design (radius, elevation, * spacing rhythm, buttons) rather than the theme's bare block defaults. * * Scoped under `.editor-styles-wrapper` so it only styles the canvas, and * still only bites on `.ec-pattern` elements — inert unless a store pattern * is present. Card rules are frontend-only (the grid block renders a * placeholder in the editor), which is harmless. */ public function add_pattern_editor_styles() { } /** * Register JS translations for an EasyCommerce React SPA bundle. * * Points at the plugin's own languages/ directory, where the shipped * easycommerce-{locale}-{md5}.json files live, so the bundle's __() strings * load translations instead of always rendering in English. Without the * explicit path WordPress only looks in the global WP languages directory. * * @param string $handle Registered/enqueued script handle. * @return void */ private function set_spa_translations($handle) { } /** * Enqueue block assets. * * Editor: always load so EC blocks can be inserted/previewed in any post * type. Front-end: skip the 1+ MB bundle on pages that have no EC blocks * (fixes a site-wide performance regression — see GitHub issue #3083). */ public function enqueue_block_assets() { } /** * Enqueue block editor only assets. */ public function enqueue_block_editor_assets() { } /** * Whether the current public request needs the shared EasyCommerce frontend * bundle (Tailwind + plugin common CSS/JS). * * Loading the bundle site-wide injects Tailwind's preflight reset onto every * page, including the theme's own (non-EasyCommerce) pages. This limits it to * pages that actually render EasyCommerce content: * - the product CPT (single + archive), * - any singular page/post containing an EasyCommerce block or shortcode, * - any page when the AI shopping agent chatbot is enabled (shown site-wide). * * Block themes can place EasyCommerce blocks inside templates/template parts * (not the post content), which this cannot detect - the * `easycommerce_load_storefront_assets` filter is the escape hatch for that. * * @param \WP_Post|null $post The queried post, if any. * @return bool */ private function is_storefront_context($post) { } public function add_assets() { } } class Block { use \EasyCommerce\Traits\Hook; use \EasyCommerce\Traits\Asset; public $categories = array(); public $pattern_categories = array(); /** * Constructor to add all hooks. */ public function __construct() { } public function register() { } /** * Register custom block categories. * * @param array $categories Existing block categories. * @return array Updated block categories. */ public function register_category($categories) { } /** * Registers patterns */ public function register_patterns() { } /** * Register the store pattern library (section + page patterns). * * Each file under views/patterns/store/ defines a $pattern_meta array * (title/description/categories/keywords/blockTypes/viewportWidth) and * echoes its block markup. The markup is captured via output buffering, * so pattern copy can be translated inline. */ public function register_store_patterns() { } /** * Registers pattern categories */ public function register_pattern_categories() { } } class Email { use \EasyCommerce\Traits\Hook; /** * Constructor to add all hooks. */ public function __construct() { } /** * The sender */ public function shoot($recipient, $subject, $body, $placeholders = array()) { } public function remind_password_reset($user_id, \EasyCommerce\Abstracts\User $user) { } public function order_email($event, $order_id) { } public function send_abandoned_reminder($hash) { } } class Init { use \EasyCommerce\Traits\Hook; use \EasyCommerce\Traits\Asset; use \EasyCommerce\Traits\Cache; use \EasyCommerce\Traits\Cleaner; use \EasyCommerce\Traits\Queue; /** * Constructor to add all hooks. */ public function __construct() { } public function invalidate_cache() { } /** * Handle the easycommerce_clear_cache action by delegating to the * appropriate Reports cache purge for the given scope. * * @param string $scope Cache scope to clear. Defaults to 'all'. * @param mixed $arg Optional scope argument (e.g. product ID for 'single_product'). */ public function handle_clear_cache($scope = 'all', $arg = null) { } /** * Custom capability mapping for EasyCommerce features * This allows editors to access certain store features */ public function map_meta_cap($caps, $cap, $user_id) { } public function migrate_old_block_names() { } public function modal() { } public function auto_login() { } public function edit_product_link($link, $post_id, $context) { } public function add_admin_bar_menu() { } public function restrict_media_access($query) { } /** * Add a log entry to the database. * * This method is hooked to the 'easycommerce_log' action and handles logging * various activities within the e-commerce system such as order creation, * product updates, coupon usage, etc. * * @param array $data Log data array with the following keys: * - object (string, required): The object type being logged ('order', 'product', 'coupon', etc.) * - action (string, required): The action performed ('created', 'updated', 'deleted', etc.) * - object_id (int, required): The ID of the object being logged * - user_id (int, optional): User ID who performed the action. Defaults to current user * - note (string, optional): Additional notes or description of the action * - ip_address (string, optional): IP address of the client. Auto-detected if not provided * - type (string, optional): Log level/type ('info', 'warning', 'error'). Defaults to 'info' * - meta (string|array, optional): Additional meta. Can be JSON string or array (will be JSON encoded) * * @return bool|int Log ID on success, false on failure or validation error. * * @example * do_action( 'easycommerce_log', array( * 'object' => 'order', * 'action' => 'created', * 'object_id' => 123, * 'note' => 'Order placed via checkout', * 'type' => 'info', * 'meta' => array('amount' => 99.99, 'currency' => 'USD') * ) ); */ public function add_log($data) { } public function add_notices() { } /** * Register EasyCommerce Full Width page template * * @param array $templates Existing page templates. * @return array Modified page templates. */ public function register_full_width_template($templates) { } /** * Load EasyCommerce Full Width page template from plugin * * @param string $template Current template path. * @return string Modified template path. */ public function load_full_width_template($template) { } /** * Add Store Mode badge to admin bar. * * @param WP_Admin_Bar $wp_admin_bar Admin bar instance. */ public function add_store_mode_admin_bar() { } /** * Show an "AI Credits: used/limit" badge at the top-right of the admin bar, * left of the Howdy menu, linking to the AI usage screen. * * Reads the locally cached credit state only (no hub call on page load); the * numbers refresh on AI usage and when the usage screen is opened. * * @param \WP_Admin_Bar $wp_admin_bar */ public function add_ai_credits_admin_bar($wp_admin_bar) { } public function output_admin_bar_css() { } } class Process { use \EasyCommerce\Traits\Hook; use \EasyCommerce\Traits\Asset; use \EasyCommerce\Traits\Cache; use \EasyCommerce\Traits\Queue; use \EasyCommerce\Traits\Cleaner; use \EasyCommerce\Traits\Rest; /** * Constructor to add all hooks. */ public function __construct() { } /** * Registers custom WP-Cron recurrence intervals. */ public function register_cron_intervals($schedules) { } /** * Keeps the abandoned-cart auto-send cron in sync with the setting. * Schedules every 5 minutes when enabled; unschedules when disabled. */ public function sync_abandoned_cart_cron() { } /** * Cron callback: sends a reminder to every pending abandoned cart that has not yet received one. */ public function send_abandoned_cart_reminders() { } /** * Cron callback: creates the core store pages in the background right after * install. Idempotent — reuses existing pages, so it is a no-op once the * pages exist (e.g. after the setup wizard already created them). */ public function create_store_pages() { } public function process_import_batch($import_id, $offset) { } public function import_sample_products() { } /** * Downloads the `locations.json` database file from the CDN. * * Retries up to 5 times with exponential backoff (60 s, 120 s, 240 s, 480 s, 960 s). * Validates the HTTP response code and JSON structure before persisting. */ public function download_geo_db() { } public function handle_addon_installation($slug) { } } } namespace EasyCommerce\Controllers\Front { class Init { use \EasyCommerce\Traits\Hook; use \EasyCommerce\Traits\Cleaner; /** * Constructor to add all hooks. */ public function __construct() { } public function add_body_class($classes) { } public function add_to_cart() { } /** * Processes the [easycommerce-checkout] shortcode in the current post. * * If the shortcode includes a "products" attribute, parses its comma-separated list * of products. Each product should be in the format: product_id|price_id|quantity. * - product_id is required. * - price_id is optional (default: 1). * - quantity is optional (default: 1). * * Examples: * products="9" * -> Adds product ID 9 with default price_id (1) and quantity (1). * products="9|2|4" * -> Adds product ID 9 with price ID 2 and quantity 4. * products="9,10|3,11|2|5" * -> Processes multiple products: * - Product ID 9 with defaults, * - Product ID 10 with price ID 3 and default quantity, * - Product ID 11 with price ID 2 and quantity 5. * * For each product, if it already exists in the cart, its quantity is updated; * otherwise, the product is added to the cart. * * @param object $cart The cart instance to update. * * @return void */ public function parse_shortcode_params($cart) { } /** * If the cart is empty, return to the shop page */ public function empty_cart_redirect() { } /** * Restore the cart from a hash */ public function restore_cart() { } public function product_head() { } public function smart_search($result, $filters, $request) { } /** * Check if required elements are present on setup wizard pages */ public function check_required_elements($content) { } /** * Show notices */ public function show_notices() { } /** * Show an admin-only banner on the storefront when the store is in Test mode. * * Admins are exempt from the Test-mode checkout/dashboard gate, so the storefront * looks live to them while real customers are silently blocked at checkout. This * banner closes that awareness gap. Hooked to wp_body_open (primary) with a * wp_footer fallback for themes that don't fire wp_body_open; a static guard * prevents duplicate output when a theme fires both. */ public function show_test_mode_banner() { } } class Shortcode { use \EasyCommerce\Traits\Hook; use \EasyCommerce\Traits\Asset; use \EasyCommerce\Traits\Cleaner; /** * Constructor to add all hooks. */ public function __construct() { } /** * Markup for the React auth SPA mount point. * * The login/registration/reset-password screens are rendered by the React * `auth` bundle which mounts into this container. The initial screen is * passed via data-screen so a directly-loaded shortcode page still opens on * the expected screen; in-app navigation is handled by the hash router. * * @param string $screen One of `login`, `register`, `reset`. * @return string */ private function auth_container($screen = 'login') { } /** * Panel shown when a logged-in user lands on an auth screen. */ private function already_logged_in($title, $message) { } public function reset_password() { } public function login() { } public function register() { } /** * Render the checkout, dispatching to the template chosen in settings. * * The active template comes from Settings -> Checkout ("checkout_template"). * Note that template-2 is the intentionally compact checkout: it collects * only name, email and country and does not gather a full shipping/billing * address (see views/shortcodes/checkout/template-2.php). That is by design * for low-friction / digital-goods stores, not a missing-address bug. */ public function checkout($atts) { } public function dashboard($atts) { } public function payment() { } } class Template { use \EasyCommerce\Traits\Hook; /** * Constructor to add all hooks. */ public function __construct() { } public function override_template($template) { } public function show_product_archive() { } public function show_product_archive_loop() { } public function show_product_archive_pagination() { } public function show_single_product() { } public function show_thumbnail() { } public function show_gallery() { } public function show_stock() { } public function show_title() { } public function show_rating() { } public function show_price() { } public function show_attributes() { } public function show_sale_price() { } public function show_add_to_cart() { } public function show_product_tab() { } public function show_product_description() { } public function show_product_summary() { } public function show_product_review() { } public function show_excerpt() { } public function show_shop_products($settings, $products, $shop_name, $view) { } private function render_checkout_template(string $path, array $args = []) { } public function show_billing($cart_obj) { } public function show_shipping($cart_obj) { } public function show_items($cart) { } public function show_summary($cart, $cart_obj) { } public function show_payment_methods($cart_obj) { } } } namespace EasyCommerce\Controllers\Payment\Stripe\API { class Payment_Intent { use \EasyCommerce\Traits\Rest; protected $api_client; protected $payment_methods_helper; public function __construct() { } /** * Get or create a Stripe customer for the current user. * * @return string|\WP_Error Customer ID or error. */ protected function get_or_create_customer() { } /** * Prepare metadata for Stripe. * * @param array $cart Cart data. * @param string $customer_email Customer email. * * @return array Metadata array. */ protected function prepare_metadata($cart, $customer_email) { } /** * Create a Payment Intent OR Setup Intent based on cart contents. * * @param \WP_REST_Request $request The REST request. * * @return array|\WP_Error The intent data or error. */ public function create(\WP_REST_Request $request) { } /** * Update Payment Intent or SetupIntent with current cart amount. * * @param \WP_REST_Request $request The REST request. * * @return array|\WP_Error The update result or error. */ public function update(\WP_REST_Request $request) { } } class Webhook { use \EasyCommerce\Traits\Rest; /** * Order-meta keys that bind a Stripe payment intent to an order. * * `stripe_payment_intent_id` is written by the synchronous checkout flow * (Stripe.php); `_ec_pending_stripe_intent_id` is written by the order-pay * flow (Payment_Intent.php). Either can resolve an inbound webhook to its order. * * @var string[] */ private const INTENT_ORDER_META_KEYS = array('stripe_payment_intent_id', '_ec_pending_stripe_intent_id'); /** * Prefix for the per-event dedup mark stored on the order. * * @var string */ private const PROCESSED_META_PREFIX = '_ec_processed_evt_'; /** * Prefix for the MySQL advisory lock that serialises same-event deliveries. * * @var string */ private const LOCK_PREFIX = 'ec_stripe_evt_'; /** * Seconds to wait for the advisory lock before giving up (Stripe then retries). * * @var int */ private const LOCK_TIMEOUT = 5; /** * Validates the incoming request to ensure it is a legitimate webhook event from Stripe. * It checks for the presence of required parameters and verifies the request signature. * * @see https://docs.stripe.com/webhooks?snapshot-or-thin=thin#verify-webhook-signatures-with-official-libraries * * @param \WP_REST_Request $request The incoming REST request to validate. * * @return \Stripe\Event|\WP_Error */ public function validate_request(\WP_REST_Request $request) { } /** * Listen to webhook events. * * @see https://docs.stripe.com/webhooks#webhook-endpoint-def * * @return void */ public function listen(\WP_REST_Request $request) { } /** * Process a payment_intent.* event idempotently. * * Serialises concurrent deliveries of the same event on a MySQL advisory * lock, then dedups on an order-meta mark so a replayed webhook cannot * re-run the completion path. The event is recorded as processed only * after the completion path succeeds, so a mid-processing failure lets * Stripe retry cleanly. * * @param \Stripe\Event|object $event The Stripe event object. * * @return array{code:int,message:string,processed:bool} HTTP code + whether the completion path ran this call. */ public function process_event($event) { } /** * Resolve the order bound to a Stripe payment intent. * * Reverse-looks-up order meta on the intent id (the intent's own Stripe * metadata does not carry the order id). * * @param object $payment_intent The Stripe payment intent object (needs ->id). * * @return \EasyCommerce\Models\Order|null The bound order, or null when none is resolvable. */ public function resolve_order_from_intent($payment_intent) { } /** * Dispatch the event to its completion handler (fires the completion action). * * @param \Stripe\Event|object $event The Stripe event object. * * @return void */ private function dispatch_event($event) { } /** * Build the advisory-lock name for an event, bounded to MySQL's 64-char limit. * * Standard Stripe event ids keep the readable `ec_stripe_evt_{id}` form; an * over-long id (which would otherwise error GET_LOCK and 503 forever) falls * back to a hashed, fixed-width name. * * @param string $event_id The Stripe event id. * * @return string */ private function lock_name($event_id) { } /** * Acquire a MySQL advisory lock scoped to this DB connection. * * @param string $lock_name The lock name. * @param int $timeout Seconds to wait. * * @return bool True if the lock was acquired. */ private function acquire_lock($lock_name, $timeout = self::LOCK_TIMEOUT) { } /** * Release a previously acquired advisory lock. * * @param string $lock_name The lock name. * * @return void */ private function release_lock($lock_name) { } /** * Handle successful payment intent (fires the completion action). * * @param \Stripe\Event $event The event object. * * @return void */ public function payment_intent_succeeded($event) { } /** * Handle failed payment intent (fires the completion action). * * @param \Stripe\Event $event The event object. * * @return void */ public function payment_intent_failed($event) { } } } namespace EasyCommerce\Controllers\Payment\Stripe\Helpers { class Payment_Methods { protected $api_client; protected array $payment_method_configs = array(); protected string $cache_key = 'easycommerce_stripe_payment_methods_cache'; protected string $pmc_id_cache_key = 'easycommerce_stripe_default_pmc_id'; public function __construct() { } /** * Force sync payment methods from Stripe API and save to database * * @return void */ public function force_sync_payment_methods(): void { } /** * Find the account's default payment method configuration. * * Stripe uses this configuration for any PaymentIntent that does not name a * specific one, so it is the single source of truth for what shows at * checkout. Per Stripe's API, the account default is uniquely identified by * `parent === null` (a top-level config, not a child) AND `is_default === true`. * Stripe guarantees exactly one such configuration per account/mode. * * `name` is a user-editable label and is deliberately NOT matched on — a * renamed default, or an unrelated config coincidentally named "Default", * must not change the result. * * The list is auto-paginated, so the default is found even when the account * has more configurations than fit in a single API page. * * @return \Stripe\PaymentMethodConfiguration|null The account default, or null if none/error. */ private function get_account_default_pmc() { } /** * Fetch payment methods directly from Stripe API * * @return array Array of payment method data */ private function fetch_payment_methods_from_api(): array { } /** * Gets enabled payment methods from Stripe's default configuration. * * @return array Array of enabled payment method types. */ public function get_enabled_payment_methods(): array { } /** * Get the id of the default Stripe payment method configuration in use. * * Returns the cached id, syncing from the Stripe API if not yet cached. * Used to deep-link the admin settings to the exact configuration that * supplies the checkout payment methods. * * @return string The default PMC id (pmc_...), or empty string if unavailable. */ public function get_default_pmc_id(): string { } /** * Gets a human-readable label for a payment method type. * * @param string $method_type The payment method type. * * @return string The human-readable label. */ private function get_payment_method_label(string $method_type): string { } /** * Get all available payment methods from Stripe's default configuration * * @return array Array of payment method data */ public function get_all_available_payment_methods(): array { } /** * Get all possible payment method labels * * @return array Array of payment method labels */ private function get_all_payment_method_labels(): array { } } class Webhook { protected $api_client; protected $events = array(\Stripe\Event::PAYMENT_INTENT_SUCCEEDED, \Stripe\Event::PAYMENT_INTENT_REQUIRES_ACTION, \Stripe\Event::PAYMENT_INTENT_AMOUNT_CAPTURABLE_UPDATED, \Stripe\Event::PAYMENT_INTENT_PAYMENT_FAILED, \Stripe\Event::SETUP_INTENT_SUCCEEDED, \Stripe\Event::SETUP_INTENT_SETUP_FAILED, \Stripe\Event::CHARGE_SUCCEEDED, \Stripe\Event::CHARGE_CAPTURED, \Stripe\Event::CHARGE_FAILED, \Stripe\Event::CHARGE_DISPUTE_CREATED, \Stripe\Event::CHARGE_DISPUTE_CLOSED, \Stripe\Event::BALANCE_AVAILABLE, \Stripe\Event::REVIEW_OPENED, \Stripe\Event::REVIEW_CLOSED, \Stripe\Event::CUSTOMER_SUBSCRIPTION_CREATED, \Stripe\Event::CUSTOMER_SUBSCRIPTION_UPDATED, \Stripe\Event::CUSTOMER_SUBSCRIPTION_DELETED, \Stripe\Event::CUSTOMER_SUBSCRIPTION_PAUSED, \Stripe\Event::CUSTOMER_SUBSCRIPTION_RESUMED, \Stripe\Event::CUSTOMER_SUBSCRIPTION_TRIAL_WILL_END, \Stripe\Event::INVOICE_PAYMENT_SUCCEEDED, \Stripe\Event::INVOICE_PAYMENT_FAILED, \Stripe\Event::INVOICE_PAYMENT_ACTION_REQUIRED, \Stripe\Event::INVOICE_PAID, \Stripe\Event::REFUND_CREATED, \Stripe\Event::ACCOUNT_UPDATED); public function __construct() { } /** * List of events to register. * * @return string[] */ public function get_events(): array { } /** * Deletes any existing webhook event destination matching the provided URL. * * @param string $webhook_url The webhook URL to match for deletion. * * @return void * @throws \Stripe\Exception\ApiErrorException If an error occurs during deletion. */ protected function delete_existing_endpoint(string $webhook_url): void { } /** * Creates a new event destination in Stripe and updates the signing secret if available. * * @param string $webhook_url The URL for the new webhook endpoint. * * @return void * @throws \Stripe\Exception\ApiErrorException If an error occurs during creation. */ protected function create_new_endpoint(string $webhook_url): void { } /** * Registers a new event destination in the Stripe payment gateway. * * @see https://docs.stripe.com/webhooks * @see https://docs.stripe.com/api/v2/core/event_destinations/create * * @return void */ public function register() { } /** * Deregisters the webhook endpoint from Stripe. * * @return void */ public function deregister(): void { } } } namespace EasyCommerce\Helpers { /** * Email class to handle email template rendering and sending. */ class Email { use \EasyCommerce\Traits\Cleaner; private $title = ''; private $header = ''; private $body = ''; private $footer = ''; private $subject = ''; private $headers = array('Content-Type: text/html; charset=UTF-8'); private $attachments = array(); private $recipients = array(); private $placeholders = array(); /** * Sets the title of the email. * * @param string $title The title for the email. */ public function set_title($title) { } /** * Sets the header of the email. * * @param string $header The HTML content for the email header section. */ public function set_header($header) { } /** * Sets the body of the email. * * @param string $body The main content for the email body. */ public function set_body($body) { } /** * Sets the footer of the email. * * @param string $footer The content for the email footer. */ public function set_footer($footer) { } /** * Gets the header of the email. * * @return string $header The HTML content for the email header section. */ public function get_header() { } /** * Gets the body of the email. * * @return string $body The HTML content for the email body section. */ public function get_body() { } /** * Gets the footer of the email. * * @param string $footer The HTML content for the email footer section. */ public function get_footer() { } /** * Sets the subject of the email. * * @param string $subject The subject of the email. */ public function set_subject($subject) { } /** * Sets the recipient(s) of the email. * * @param mixed $recipients A single email address or an array of email addresses. */ public function set_recipient($recipients) { } /** * Adds a recipient to the email. * * @param mixed $recipients A single email address or an array of email addresses. */ public function add_recipient($recipients) { } /** * Adds a header to the email. * * @param string $header The header to add. */ public function add_header($header) { } /** * Adds an attachment to the email. * * @param string $attachment The file path of the attachment. */ public function add_attachment($attachment) { } /** * Gets the subject of the email. * * @return string The email subject. */ public function get_subject() { } /** * Gets the recipient(s) of the email. * * @return string A comma-separated string of valid recipients. */ public function get_recipient() { } /** * Gets the headers for the email. * * @return array The headers for the email. */ public function get_headers() { } /** * Gets the attachments for the email. * * @return array The list of attachment file paths. */ public function get_attachments() { } /** * Gets the email header content. * * @return string The header HTML content for the email. */ public function get_header_content() { } /** * Gets the email body content. * * @return string The HTML content for the email body. */ public function get_body_content() { } /** * Gets the email footer content. * * @return string The HTML content for the email footer. */ public function get_footer_content() { } /** * Combines and returns the full email content. * * @return string The complete HTML content of the email. */ public function get_content() { } /** * Loads and sets the email template. * * @param string $template_name The name of the template file (without extension). * @param array $args Optional. Associative array of variables to pass to the template. */ public function set_template($template_name, $args = array()) { } /** * Sets placeholders for the email content (title, body, footer, and subject). * * @param array $placeholders Associative array of placeholders and their values. */ public function set_placeholders($placeholders = array()) { } public function apply_placeholders($content) { } /** * Sends the email. * * @param string|null $to The recipient email address. * @param string $subject The subject of the email. * @param string $body The body content of the email. * @param string $footer The footer content of the email. * @return bool Whether the email was sent successfully. */ public function send($to = null, $subject = '', $body = '', $footer = '') { } } } namespace EasyCommerce\Helpers\Field { /** * Checkbox Field Class */ class Checkbox extends \EasyCommerce\Abstracts\Field { /** * Get the field label. * * @return string */ public function get_value() { } public function render() { } } /** * Input Field Class */ class Text extends \EasyCommerce\Abstracts\Field { public function render() { } } /** * Color Field Class */ class Color extends \EasyCommerce\Helpers\Field\Text { public function __construct($config = array()) { } } /** * Date Field Class */ class Date extends \EasyCommerce\Helpers\Field\Text { public function __construct($config = array()) { } } /** * WYSIWYG Field Class */ class WYSIWYG extends \EasyCommerce\Abstracts\Field { /** * Renders the WYSIWYG field. */ public function render() { } } /** * Editor Field Class (an alias of WYSIWYG) */ class Editor extends \EasyCommerce\Helpers\Field\WYSIWYG { } /** * Email Field Class */ class Email extends \EasyCommerce\Helpers\Field\Text { public function __construct($config = array()) { } } /** * File Field Class */ class File extends \EasyCommerce\Helpers\Field\Text { public function __construct($config = array()) { } } /** * File Field Class */ class Image extends \EasyCommerce\Helpers\Field\Text { public function render() { } } /** * File Field Class */ class Media extends \EasyCommerce\Helpers\Field\Text { public function render() { } } class Multicheck extends \EasyCommerce\Abstracts\Field { protected $option_type = 'checkbox'; public function render() { } } /** * Number Field Class */ class Number extends \EasyCommerce\Helpers\Field\Text { public function __construct($config = array()) { } } /** * Password Field Class */ class Password extends \EasyCommerce\Helpers\Field\Text { public function __construct($config = array()) { } } /** * Radio Field Class */ class Radio extends \EasyCommerce\Helpers\Field\Multicheck { protected $option_type = 'radio'; protected function get_input_class(): string { } public function render() { } } /** * Range Field Class */ class Range extends \EasyCommerce\Helpers\Field\Text { public function __construct($config = array()) { } } /** * Select Field Class */ class Select extends \EasyCommerce\Abstracts\Field { /** * Whether the field allows free-text input alongside the options list. * * @var bool */ protected $allow_input = false; /** * Constructor. * * @param array $config Field configuration. */ public function __construct($config = array()) { } /** * Whether the field allows free-text input alongside the options list. * * @return bool */ public function allow_input() { } public function render() { } /** * Render the field as a free-text input backed by a datalist. * * @return string */ protected function render_open_text() { } } /** * Submit Field Class */ class Submit extends \EasyCommerce\Helpers\Field\Text { public function __construct($config = array()) { } } /** * Switcher Field Class */ class Switcher extends \EasyCommerce\Helpers\Field\Checkbox { public function render() { } } /** * Textarea Field Class */ class Textarea extends \EasyCommerce\Abstracts\Field { public function render() { } } /** * Time Field Class */ class Time extends \EasyCommerce\Helpers\Field\Text { public function __construct($config = array()) { } } /** * URL Field Class */ class URL extends \EasyCommerce\Helpers\Field\Text { public function __construct($config = array()) { } } } namespace EasyCommerce\Helpers { /** * Utility class with static helper functions for general use throughout the plugin. */ class Utility { use \EasyCommerce\Traits\Cache; /** * Retrieves an option from the WordPress database, formatted according to EasyCommerce settings. * * This function gets an option using a combination of the provided menu, submenu, and key. * If the option is not set, a default value is returned. * * @param string $menu The menu name or key to be used as part of the option name. * @param string $submenu The submenu name or key to be used as part of the option name. * @param string $key The specific option key to retrieve within the option array. * @param mixed $default Optional. The default value to return if the option key is not set. Default is an empty string. * * @return mixed The value of the option if it exists, or the default value if it doesn't. */ public static function get_option($menu, $submenu, $key, $default = '') { } /** * Set an option value. * * @param string $menu The menu slug. * @param string $submenu The submenu slug. * @param string $key The option key. * @param mixed $value The value to set. * @return bool True if the option was updated, false otherwise. */ public static function set_option($menu, $submenu, $key, $value) { } /** * Formats a date string according to WordPress settings. * * @param string $date The date string (e.g., 'Y-m-d H:i:s'). * @param string $format Optional. PHP date format. Defaults to WordPress date format setting. * @return string Formatted date string. */ public static function format_date($date, $format = '') { } /** * Formats a time string according to WordPress settings. * * @param string $time The time string (e.g., 'Y-m-d H:i:s'). * @param string $format Optional. PHP time format. Defaults to 'h:i:s A'. * @return string Formatted time string. */ public static function format_time($time, $format = '') { } /** * Formats a price * * @param float $price The price * @return string Formatted price string. */ public static function format_price($price) { } /** * Logs messages to a specific log file. * * @param mixed $message The message to log. If not a string, it will be converted to JSON. * @param string $log_file The log file to write to within the wp-content directory. */ public static function log_debug($message, $log_file = 'debug.log') { } /** * Error Log */ public static function el($message, $log_file = 'debug.log') { } /** * Prints information about a variable in a more readable format. * * @param mixed $data The variable you want to display. * @param bool $admin_only Should it display in wp-admin area only * @param bool $hide_adminbar Should it hide the admin bar */ public static function pri($data, $admin_only = true, $hide_adminbar = true) { } /** * Resolve the file to load for a template, allowing themes and addons to * override it. * * Resolution order: * 1. Theme override - wp-content/themes//easycommerce/