PluginProbe
YayPricing – WooCommerce Dynamic Pricing & Discounts / 2.1
YayPricing – WooCommerce Dynamic Pricing & Discounts v2.1
3.5.7.2 3.5.7 3.5.6 trunk 1.9 2.1 2.2 2.3 2.3.1 2.4.1 2.4.2 2.4.3 2.4.4 2.4.5 2.4.6 2.4.8 2.4.8.2 2.4.9 2.4.9.1 2.4.9.2 2.5 2.5.2 2.5.3 2.5.4 3.0 All 38 releases
yaypricing / yaypricing.php

yaypricing.php in YayPricing – WooCommerce Dynamic Pricing & Discounts 2.1, at yaypricing.php

109 lines 3.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Plugin Name: YayPricing Lite - WooCommerce Dynamic Pricing And Discounts
4 * Plugin URI: https://woocommerce.com/products/dynamic-pricing-discounts/
5 * Description: Create automatic product pricing rules and cart discounts to design a powerful marketing strategy for your WooCommerce store.
6 * Version: 2.1
7 * Author: YayCommerce
8 * Author URI: https://yaycommerce.com/
9 * Text Domain: yaydp
10 * WC requires at least: 3.0.0
11 * WC tested up to: 7.5.1
12 * Requires PHP: 5.7
13 * Domain Path: /languages
14 *
15 * @package YayPricing
16 */
17
18 namespace YAYDP;
19
20 defined( 'ABSPATH' ) || exit;
21
22 if ( function_exists( 'YAYDP\\YAYDP' ) ) {
23 require_once plugin_dir_path( __FILE__ ) . 'includes/yaydp-duplicate-fallback.php';
24 add_action(
25 'admin_init',
26 function() {
27 deactivate_plugins( plugin_basename( __FILE__ ) );
28 }
29 );
30 return;
31 }
32
33
34 if ( ! defined( 'YAYDP_PLUGIN_FILE' ) ) {
35 define( 'YAYDP_PLUGIN_FILE', __FILE__ );
36 }
37 if ( ! defined( 'YAYDP_ABSPATH' ) ) {
38 define( 'YAYDP_ABSPATH', dirname( __FILE__ ) . '/' );
39 }
40 if ( ! defined( 'YAYDP_PLUGIN_PATH' ) ) {
41 define( 'YAYDP_PLUGIN_PATH', plugin_dir_path( __FILE__ ) );
42 }
43 if ( ! defined( 'YAYDP_PLUGIN_URL' ) ) {
44 define( 'YAYDP_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
45 }
46 if ( ! defined( 'YAYDP_PLUGIN_BASENAME' ) ) {
47 define( 'YAYDP_PLUGIN_BASENAME', plugin_basename( __FILE__ ) );
48 }
49 if ( ! defined( 'YAYDP_VERSION' ) ) {
50 define( 'YAYDP_VERSION', '2.1' );
51 }
52 if ( ! defined( 'YAYDP_MINIMUM_PHP_VERSION' ) ) {
53 define( 'YAYDP_MINIMUM_PHP_VERSION', 5.7 );
54 }
55
56 spl_autoload_register(
57 function ( $class_name ) {
58
59 if ( strncmp( __NAMESPACE__, $class_name, strlen( __NAMESPACE__ ) ) !== 0 ) {
60 return;
61 }
62
63 $class_name = strtolower( str_replace( '_', '-', $class_name ) );
64
65 $namespace_arr = \explode( '\\', $class_name );
66
67 $class_name_without_namespace = $namespace_arr[ count( $namespace_arr ) - 1 ];
68 $class_name_without_namespace = str_replace( '\\', '-', $class_name_without_namespace );
69
70 $file_name_prefix = 'class';
71 if ( false !== strpos( $class_name, 'traits' ) ) {
72 $file_name_prefix = 'trait';
73 }
74 if ( false !== strpos( $class_name, 'abstracts' ) ) {
75 $file_name_prefix = 'abstract';
76 }
77 $file_name = $file_name_prefix . '-' . $class_name_without_namespace . '.php';
78
79 $namespace_arr[ count( $namespace_arr ) - 1 ] = $file_name;
80 $namespace_arr[0] = 'includes';
81
82 $file = __DIR__ . '/' . \implode( '/', $namespace_arr );
83
84 if ( file_exists( $file ) ) {
85 require $file;
86 }
87 }
88 );
89
90 add_action( 'plugins_loaded', '\\YAYDP\\load_plugin' );
91
92 if ( ! function_exists( 'YAYDP\\load_plugin' ) ) {
93 /**
94 * Initialize plugin instance
95 */
96 function load_plugin() { //phpcs:ignore
97 if ( function_exists( 'WC' ) && \version_compare( phpversion(), YAYDP_MINIMUM_PHP_VERSION, '>=' ) ) {
98 \YAYDP\YayPricing::get_instance();
99 } else {
100 \YAYDP\YAYDP_Fallback::get_instance();
101 }
102 }
103 }
104
105 register_activation_hook( __FILE__, array( 'YAYDP\\YAYDP_Activation', 'initialize' ) );
106 register_deactivation_hook( __FILE__, array( 'YAYDP\\YAYDP_Deactivation', 'initialize' ) );
107
108
109