id || ! current_user_can( 'activate_plugins' ) ) {
return;
}
echo '
' . esc_html__( 'LoyaltySpin Pro is active and includes everything in the free LoyaltySpin plugin, so the free plugin is paused. You can deactivate it; your settings and data are kept.', 'loyaltyspin' ) . '
';
}
);
return;
}
}
unset( $loyaltypress_active, $loyaltypress_plugin );
}
if ( defined( 'LOYALTYPRESS_FILE' ) ) {
return; // Another LoyaltySpin edition is already loaded.
}
define( 'LOYALTYPRESS_VERSION', '1.7.2' );
define( 'LOYALTYPRESS_DB_VERSION', '1.2.0' );
define( 'LOYALTYPRESS_FILE', __FILE__ );
define( 'LOYALTYPRESS_DIR', plugin_dir_path( __FILE__ ) );
define( 'LOYALTYPRESS_URL', plugin_dir_url( __FILE__ ) );
/**
* PSR-4-style autoloader for the LoyaltyPress namespace.
* LoyaltyPress\Coins\Ledger => includes/coins/class-ledger.php
*/
spl_autoload_register(
static function ( $class_name ) {
$prefix = 'LoyaltyPress\\';
if ( 0 !== strpos( $class_name, $prefix ) ) {
return;
}
$parts = explode( '\\', substr( $class_name, strlen( $prefix ) ) );
$name = array_pop( $parts );
$file = 'class-' . strtolower( str_replace( '_', '-', $name ) ) . '.php';
$dir = $parts ? strtolower( implode( '/', $parts ) ) . '/' : '';
$path = LOYALTYPRESS_DIR . 'includes/' . $dir . $file;
if ( is_readable( $path ) ) {
require_once $path;
}
}
);
// Edition hooks (no-op in this edition).
LoyaltyPress\Licensing\Licensing::init();
register_activation_hook( __FILE__, array( 'LoyaltyPress\\Installer', 'activate' ) );
if ( ! LoyaltyPress\Licensing\Licensing::configured() ) {
// Without Freemius (WordPress.org build, development) WordPress runs the uninstall itself.
register_uninstall_hook( __FILE__, array( 'LoyaltyPress\\Installer', 'uninstall' ) );
}
register_deactivation_hook( __FILE__, array( 'LoyaltyPress\\Installer', 'deactivate' ) );
// Declare compatibility with HPOS and Cart/Checkout blocks.
add_action(
'before_woocommerce_init',
static function () {
if ( class_exists( '\Automattic\WooCommerce\Utilities\FeaturesUtil' ) ) {
\Automattic\WooCommerce\Utilities\FeaturesUtil::declare_compatibility( 'custom_order_tables', __FILE__, true );
\Automattic\WooCommerce\Utilities\FeaturesUtil::declare_compatibility( 'cart_checkout_blocks', __FILE__, true );
}
}
);
add_action(
'plugins_loaded',
static function () {
if ( ! class_exists( 'WooCommerce' ) ) {
add_action(
'admin_notices',
static function () {
echo '' . esc_html__( 'LoyaltySpin needs WooCommerce to be installed and active.', 'loyaltyspin' ) . '
';
}
);
return;
}
\LoyaltyPress\Plugin::instance()->boot();
},
20
);