'43736', 'slug' => 'orderproof', 'premium_slug' => 'orderproof-premium', 'type' => 'plugin', 'public_key' => 'pk_a6c78077d76c4fb600113b6d63383', 'is_premium' => file_exists( CODG_DIR . 'pro/class-codg-pro.php' ), 'premium_suffix' => 'Pro', 'has_addons' => false, 'has_paid_plans' => true, 'has_premium_version' => true, 'is_org_compliant' => true, 'trial' => array( 'days' => 7, 'is_require_payment' => false, ), // Freemius attaches its Pricing/Account pages to this menu item (see CODG_Settings::add_menu). 'menu' => array( 'slug' => 'orderproof', 'first-path' => 'admin.php?page=wc-settings&tab=codg', 'parent' => array( 'slug' => 'woocommerce' ), 'support' => false, 'contact' => false, ), ) ); } return $codg_fs; } codg_fs(); do_action( 'codg_fs_loaded' ); } /** * Remove plugin options on uninstall. Order data (_codg_phone meta) is kept. * Freemius owns the uninstall flow when its SDK is bundled, so it gets the hook there. */ function codg_uninstall_cleanup() { global $wpdb; $wpdb->query( "DELETE FROM {$wpdb->options} WHERE option_name LIKE 'codg\\_%'" ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery delete_transient( 'codg_report' ); wp_clear_scheduled_hook( 'codg_otp_cleanup' ); } if ( codg_fs() ) { codg_fs()->add_action( 'after_uninstall', 'codg_uninstall_cleanup' ); } else { register_uninstall_hook( CODG_FILE, 'codg_uninstall_cleanup' ); } register_deactivation_hook( CODG_FILE, function () { wp_clear_scheduled_hook( 'codg_otp_cleanup' ); } ); /** * True when a valid Pro license (or trial) is active. */ function codg_is_pro() { // WooCommerce.com Marketplace build: sold and licensed by WooCommerce.com, every feature included. if ( defined( 'CODG_DISTRIBUTION' ) && 'woocommerce.com' === CODG_DISTRIBUTION ) { return file_exists( CODG_DIR . 'pro/class-codg-pro.php' ); } $fs = codg_fs(); return $fs && $fs->can_use_premium_code(); } /** * URL of the upgrade / pricing page, or '' when Freemius is not set up (upsells are then hidden). */ function codg_upgrade_url() { if ( defined( 'CODG_DISTRIBUTION' ) && 'woocommerce.com' === CODG_DISTRIBUTION ) { return ''; // Everything is included; WooCommerce.com does not allow upsells to other stores. } $fs = codg_fs(); return $fs ? $fs->get_upgrade_url() : ''; } add_action( 'before_woocommerce_init', function () { if ( class_exists( \Automattic\WooCommerce\Utilities\FeaturesUtil::class ) ) { \Automattic\WooCommerce\Utilities\FeaturesUtil::declare_compatibility( 'custom_order_tables', CODG_FILE, true ); \Automattic\WooCommerce\Utilities\FeaturesUtil::declare_compatibility( 'cart_checkout_blocks', CODG_FILE, true ); } } ); /** * Load bundled translations (French, Arabic). A language pack from translate.wordpress.org, * when installed, is loaded by WordPress itself. Regional locales fall back to the base * language: fr_CA/fr_BE -> fr_FR, ary (Moroccan Arabic)/ar_* -> ar. */ add_action( 'init', function () { $locale = determine_locale(); $base = strtok( $locale, '_' ); $try = array( $locale, 'fr' === $base ? 'fr_FR' : '', 'ar' === $base || 'ary' === $base ? 'ar' : '' ); foreach ( array_filter( $try ) as $candidate ) { $mo = CODG_DIR . 'languages/orderproof-' . $candidate . '.mo'; if ( file_exists( $mo ) ) { load_textdomain( 'orderproof', $mo ); break; } } }, 1 ); add_action( 'plugins_loaded', 'codg_bootstrap', 20 ); function codg_bootstrap() { if ( ! class_exists( 'WooCommerce' ) ) { add_action( 'admin_notices', function () { echo '
' . esc_html__( 'OrderProof requires WooCommerce to be installed and active.', 'orderproof' ) . '