yayextra.php
| 1 | <?php |
| 2 | /** |
| 3 | * Plugin Name: YayExtra Lite - WooCommerce Extra Product Options |
| 4 | * Plugin URI: https://yaycommerce.com/yayextra-woocommerce-extra-product-options |
| 5 | * Description: Offer extra options like personal engraving, print-on-demand items, gifts, custom canvas prints, and personalized products. |
| 6 | * Version: 2.0.3 |
| 7 | * Author: YayCommerce |
| 8 | * Author URI: https://yaycommerce.com |
| 9 | * Text Domain: yayextra |
| 10 | * WC requires at least: 3.0.0 |
| 11 | * WC tested up to: 11.0 |
| 12 | * Domain Path: /i18n/languages/ |
| 13 | */ |
| 14 | |
| 15 | namespace YayExtra; |
| 16 | |
| 17 | use YayExtra\Init\Settings; |
| 18 | // use YayExtra\Integrations; |
| 19 | use YayExtra\Register\RegisterFacade; |
| 20 | |
| 21 | defined( 'ABSPATH' ) || exit; |
| 22 | |
| 23 | if ( function_exists( 'YayExtra\\plugins_loaded' ) ) { |
| 24 | require_once ABSPATH . '/wp-admin/includes/plugin.php'; |
| 25 | require_once ABSPATH . WPINC . '/pluggable.php'; |
| 26 | deactivate_plugins( plugin_basename( __FILE__ ) ); |
| 27 | require_once plugin_dir_path( __FILE__ ) . 'includes/UpdateVersion.php'; |
| 28 | return; |
| 29 | } |
| 30 | |
| 31 | if ( ! defined( 'YAYE_PLUGIN_FILE' ) ) { |
| 32 | define( 'YAYE_PLUGIN_FILE', __FILE__ ); |
| 33 | } |
| 34 | |
| 35 | if ( ! defined( 'YAYE_PREFIX' ) ) { |
| 36 | define( 'YAYE_PREFIX', 'YAYE_' ); |
| 37 | } |
| 38 | |
| 39 | if ( ! defined( 'YAYE_URL' ) ) { |
| 40 | define( 'YAYE_URL', plugin_dir_url( YAYE_PLUGIN_FILE ) ); |
| 41 | } |
| 42 | |
| 43 | if ( ! defined( 'YAYE_PATH' ) ) { |
| 44 | define( 'YAYE_PATH', plugin_dir_path( YAYE_PLUGIN_FILE ) ); |
| 45 | } |
| 46 | |
| 47 | if ( ! defined( 'YAYE_BASENAME' ) ) { |
| 48 | define( 'YAYE_BASENAME', plugin_basename( YAYE_PLUGIN_FILE ) ); |
| 49 | } |
| 50 | |
| 51 | if ( ! defined( 'YAYE_VERSION' ) ) { |
| 52 | define( 'YAYE_VERSION', '2.0.3' ); |
| 53 | } |
| 54 | |
| 55 | if ( ! defined( 'YAYE_SITE_URL' ) ) { |
| 56 | define( 'YAYE_SITE_URL', site_url() ); |
| 57 | } |
| 58 | |
| 59 | |
| 60 | require __DIR__ . '/autoloader.php'; |
| 61 | require_once __DIR__ . '/vendor/autoload.php'; |
| 62 | require_once __DIR__ . '/YayextraPluginAdapter.php'; |
| 63 | |
| 64 | add_action( 'plugins_loaded', function() { |
| 65 | \YayExtraScoped\YayCommerce\AdminShell\AdminShell::boot(); |
| 66 | \YayExtraScoped\YayCommerce\AdminShell\AdminShell::register_plugin( |
| 67 | new \YayextraPluginAdapter() |
| 68 | ); |
| 69 | }, 5 ); |
| 70 | |
| 71 | /** |
| 72 | * Callback for plugins_loaded action |
| 73 | * |
| 74 | * @return void |
| 75 | */ |
| 76 | if ( ! function_exists( 'YayExtra\\plugins_loaded' ) ) { |
| 77 | function plugins_loaded() { |
| 78 | I18n::getInstance(); |
| 79 | Settings::get_instance(); |
| 80 | // Integrations::get_instance(); |
| 81 | // Register Facade |
| 82 | RegisterFacade::get_instance(); |
| 83 | |
| 84 | add_action( 'admin_notices', 'YayExtra\\required_woocommerce_notice' ); |
| 85 | } |
| 86 | } |
| 87 | |
| 88 | if ( ! function_exists( 'YayExtra\\required_woocommerce_notice' ) ) { |
| 89 | function required_woocommerce_notice() { |
| 90 | if ( ! function_exists( 'WC' ) ) : |
| 91 | ?> |
| 92 | <div class="error"> |
| 93 | <p> |
| 94 | <?php |
| 95 | // translators: %s: search WooCommerce plugin link |
| 96 | printf( 'YayExtra ' . esc_html__( 'is enabled but not effective. It requires %1$sWooCommerce%2$s in order to work.', 'yayextra' ), '<a href="' . esc_url( admin_url( 'plugin-install.php?s=woocommerce&tab=search&type=term' ) ) . '">', '</a>' ); |
| 97 | ?> |
| 98 | </p> |
| 99 | </div> |
| 100 | <?php |
| 101 | endif; |
| 102 | } |
| 103 | } |
| 104 | |
| 105 | add_action( |
| 106 | 'plugins_loaded', |
| 107 | 'YayExtra\\plugins_loaded' |
| 108 | ); |
| 109 |