| 1 |
<?php |
| 2 |
/** |
| 3 |
* Plugin Name: Product Addons and Product Options With Custom Fields – WowAddons |
| 4 |
* Description: The ultimate WooCommerce product addons plugin to add extra product options, including, swatches, image uploads, text area, and more! |
| 5 |
* Version: 1.6.17 |
| 6 |
* Author: WPXPO |
| 7 |
* Author URI: https://www.wpxpo.com/about |
| 8 |
* Text Domain: product-addons |
| 9 |
* Requires Plugins: woocommerce |
| 10 |
* License: GPLv3 |
| 11 |
* License URI: http://www.gnu.org/licenses/gpl-3.0.html |
| 12 |
* |
| 13 |
* @package WowAddons |
| 14 |
*/ |
| 15 |
|
| 16 |
use PRAD\Includes\WowRevenuePromotion; |
| 17 |
use PRAD\Includes\Blocks\Blocks_Bootstrap; |
| 18 |
use PRAD\Includes\Common\Functions; |
| 19 |
use PRAD\Includes\Initialization; |
| 20 |
use PRAD\Includes\WowShippingPromotion; |
| 21 |
|
| 22 |
defined( 'ABSPATH' ) || exit; |
| 23 |
|
| 24 |
// Define Vars. |
| 25 |
define( 'PRAD_VER', '1.6.17' ); |
| 26 |
define( 'PRAD_URL', plugin_dir_url( __FILE__ ) ); |
| 27 |
define( 'PRAD_BASE', plugin_basename( __FILE__ ) ); |
| 28 |
define( 'PRAD_PATH', plugin_dir_path( __FILE__ ) ); |
| 29 |
|
| 30 |
spl_autoload_register( 'prad_autoloader' ); |
| 31 |
|
| 32 |
if ( ! function_exists( 'product_addons' ) ) { |
| 33 |
/** |
| 34 |
* Returns an instance of the Functions class for product addons. |
| 35 |
* |
| 36 |
* @return Functions |
| 37 |
*/ |
| 38 |
function product_addons() { //phpcs:ignore |
| 39 |
return new Functions(); |
| 40 |
} |
| 41 |
} |
| 42 |
|
| 43 |
new WowShippingPromotion(); |
| 44 |
new WowRevenuePromotion(); |
| 45 |
add_action( 'plugins_loaded', 'prad_init', 10 ); |
| 46 |
|
| 47 |
/** |
| 48 |
* Initializes the plugin by creating Initialization instance and bootstrapping blocks. |
| 49 |
*/ |
| 50 |
function prad_init() { |
| 51 |
new Initialization(); |
| 52 |
$bootstrap = Blocks_Bootstrap::get_instance(); |
| 53 |
$bootstrap->init(); |
| 54 |
} |
| 55 |
|
| 56 |
/** |
| 57 |
* Autoloader for PRAD namespace classes. |
| 58 |
* |
| 59 |
* @param string $class_name The fully-qualified class name. |
| 60 |
*/ |
| 61 |
function prad_autoloader( $class_name ) { |
| 62 |
$namespace = 'PRAD\\'; |
| 63 |
$base_dir = trailingslashit( PRAD_PATH ); |
| 64 |
|
| 65 |
$len = strlen( $namespace ); |
| 66 |
if ( strncmp( $namespace, $class_name, $len ) !== 0 ) { |
| 67 |
return; |
| 68 |
} |
| 69 |
|
| 70 |
$relative_class = substr( $class_name, $len ); |
| 71 |
$segments = explode( '\\', $relative_class ); |
| 72 |
|
| 73 |
$file_name = array_pop( $segments ); |
| 74 |
$subfolder = strtolower( |
| 75 |
implode( |
| 76 |
'/', |
| 77 |
array_map( |
| 78 |
function ( $segment ) { |
| 79 |
return str_replace( '_', '-', $segment ); |
| 80 |
}, |
| 81 |
$segments |
| 82 |
) |
| 83 |
) |
| 84 |
); |
| 85 |
|
| 86 |
$prefix = ( strpos( $subfolder, 'traits' ) !== false ) ? 'trait-' : 'class-'; |
| 87 |
$file_name = strtolower( |
| 88 |
preg_replace( |
| 89 |
'/([a-z])([A-Z])/', |
| 90 |
'$1-$2', |
| 91 |
str_replace( '_', '-', $file_name ) |
| 92 |
) |
| 93 |
); |
| 94 |
|
| 95 |
$file = rtrim( $base_dir . $subfolder, '/' ) . '/' . $prefix . $file_name . '.php'; |
| 96 |
|
| 97 |
if ( file_exists( $file ) ) { |
| 98 |
require_once $file; |
| 99 |
} |
| 100 |
} |
| 101 |
|