WooCommerce. * Version: 1.10.2 * Author: kilbot * Author URI: http://wcpos.com * Text Domain: woocommerce-pos * License: GPL-3.0+ * License URI: http://www.gnu.org/licenses/gpl-3.0.txt * Domain Path: /languages * Requires at least: 5.6 * Tested up to: 7.1 * Requires PHP: 7.4 * Requires Plugins: woocommerce * WC tested up to: 11.0.1 * WC requires at least: 5.3 * * @see http://wcpos.com * @package WCPOS\WooCommercePOS */ namespace WCPOS\WooCommercePOS; // Define plugin constants (use define() with checks to avoid conflicts when Pro plugin is active). if ( ! \defined( __NAMESPACE__ . '\VERSION' ) ) { \define( __NAMESPACE__ . '\VERSION', '1.10.2' ); } require_once __DIR__ . '/includes/API/V2/Ping.php'; API\V2\Ping::maybe_serve(); if ( ! \defined( __NAMESPACE__ . '\TRANSLATION_VERSION' ) ) { \define( __NAMESPACE__ . '\TRANSLATION_VERSION', '2026.8.10' ); } if ( ! \defined( __NAMESPACE__ . '\PLUGIN_NAME' ) ) { \define( __NAMESPACE__ . '\PLUGIN_NAME', 'woocommerce-pos' ); } if ( ! \defined( __NAMESPACE__ . '\SHORT_NAME' ) ) { \define( __NAMESPACE__ . '\SHORT_NAME', 'wcpos' ); } if ( ! \defined( __NAMESPACE__ . '\PLUGIN_FILE' ) ) { \define( __NAMESPACE__ . '\PLUGIN_FILE', plugin_basename( __FILE__ ) ); // 'woocommerce-pos/woocommerce-pos.php' } if ( ! \defined( __NAMESPACE__ . '\PLUGIN_PATH' ) ) { \define( __NAMESPACE__ . '\PLUGIN_PATH', trailingslashit( plugin_dir_path( __FILE__ ) ) ); } if ( ! \defined( __NAMESPACE__ . '\PLUGIN_URL' ) ) { \define( __NAMESPACE__ . '\PLUGIN_URL', trailingslashit( plugin_dir_url( __FILE__ ) ) ); } // Minimum requirements. if ( ! \defined( __NAMESPACE__ . '\WC_MIN_VERSION' ) ) { \define( __NAMESPACE__ . '\WC_MIN_VERSION', '5.3' ); } if ( ! \defined( __NAMESPACE__ . '\PHP_MIN_VERSION' ) ) { \define( __NAMESPACE__ . '\PHP_MIN_VERSION', '7.4' ); } if ( ! \defined( __NAMESPACE__ . '\MIN_PRO_VERSION' ) ) { \define( __NAMESPACE__ . '\MIN_PRO_VERSION', '1.8.7' ); } // If Pro plugin is active, bail out early to avoid conflicts. // Pro includes all free plugin functionality, so there's no need to initialize both. // We check the option directly since Pro may not have loaded yet (alphabetical order). $wcpos_pro_plugin_file = 'woocommerce-pos-pro/woocommerce-pos-pro.php'; // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound -- namespaced file scope. $wcpos_active_plugins = get_option( 'active_plugins', array() ); // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound -- namespaced file scope. $wcpos_pro_is_active = \in_array( $wcpos_pro_plugin_file, $wcpos_active_plugins, true ); // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound -- namespaced file scope. // Also check network-activated plugins on multisite. if ( ! $wcpos_pro_is_active && is_multisite() ) { $wcpos_network_plugins = get_site_option( 'active_sitewide_plugins', array() ); // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound -- namespaced file scope. $wcpos_pro_is_active = isset( $wcpos_network_plugins[ $wcpos_pro_plugin_file ] ); // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound -- namespaced file scope. } if ( $wcpos_pro_is_active ) { return; } /** * Load .env flags for development. * * @param string $file The path to the .env file. */ function wcpos_load_env( $file ): void { // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound -- namespaced. if ( ! file_exists( $file ) ) { return; } $lines = file( $file, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES ); foreach ( $lines as $line ) { if ( 0 === strpos( trim( $line ), '#' ) ) { continue; } list($name, $value) = explode( '=', $line, 2 ); $name = trim( $name ); $value = trim( $value ); if ( ! \array_key_exists( $name, $_SERVER ) && ! \array_key_exists( $name, $_ENV ) ) { putenv( \sprintf( '%s=%s', $name, $value ) ); $_ENV[ $name ] = $value; } } } /** * Autoload vendor and prefixed libraries. */ function wcpos_load_autoloaders(): void { // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound -- namespaced. $vendor_autoload = __DIR__ . '/vendor/autoload.php'; $vendor_prefixed_autoload = __DIR__ . '/vendor_prefixed/autoload.php'; if ( file_exists( $vendor_autoload ) ) { require_once $vendor_autoload; } if ( file_exists( $vendor_prefixed_autoload ) ) { require_once $vendor_prefixed_autoload; require_once __DIR__ . '/includes/Vendor_Prefixed_Polyfills.php'; } } wcpos_load_autoloaders(); require_once __DIR__ . '/includes/API/class-aliases.php'; if ( \defined( 'WP_CLI' ) && WP_CLI ) { if ( ! class_exists( \WCPOS\WooCommercePOS\Services\Anon_ID::class ) ) { require_once __DIR__ . '/includes/Services/Anon_ID.php'; } if ( ! class_exists( \WCPOS\WooCommercePOS\CLI\Anon_ID_Command::class ) ) { require_once __DIR__ . '/includes/CLI/Anon_ID_Command.php'; } \WP_CLI::add_command( 'wcpos anon-id', \WCPOS\WooCommercePOS\CLI\Anon_ID_Command::class ); } // Environment variables. wcpos_load_env( __DIR__ . '/.env' ); // Error handling for autoload failure. if ( ! class_exists( Activator::class ) || ! class_exists( Deactivator::class ) ) { add_action( 'admin_notices', function (): void { ?>