PluginProbe
YayPricing – WooCommerce Dynamic Pricing & Discounts / 3.5.7
YayPricing – WooCommerce Dynamic Pricing & Discounts v3.5.7
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 3.5.7, at yaypricing.php

135 lines 3.7 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://wordpress.org/plugins/yaypricing/
5 * Description: Create automatic product pricing rules and cart discounts to design a powerful marketing strategy for your WooCommerce store.
6 * Version: 3.5.7
7 * Author: YayCommerce
8 * Author URI: https://yaycommerce.com/
9 * Text Domain: yaypricing
10 * WC requires at least: 3.0.0
11 * WC tested up to: 10.9
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\\load_plugin' ) ) {
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', '3.5.7' );
51 }
52 if ( ! defined( 'YAYDP_MINIMUM_PHP_VERSION' ) ) {
53 define( 'YAYDP_MINIMUM_PHP_VERSION', 5.7 );
54 }
55 if ( ! defined( 'YAYDP_DEVELOPMENT' ) ) {
56 define( 'YAYDP_DEVELOPMENT', false );
57 }
58
59 spl_autoload_register(
60 function ( $class_name ) {
61
62 if ( strncmp( __NAMESPACE__, $class_name, strlen( __NAMESPACE__ ) ) !== 0 ) {
63 return;
64 }
65
66 $class_name = strtolower( str_replace( '_', '-', $class_name ) );
67
68 $namespace_arr = \explode( '\\', $class_name );
69
70 $class_name_without_namespace = $namespace_arr[ count( $namespace_arr ) - 1 ];
71 $class_name_without_namespace = str_replace( '\\', '-', $class_name_without_namespace );
72
73 $file_name_prefix = 'class';
74 if ( false !== strpos( $class_name, 'traits' ) ) {
75 $file_name_prefix = 'trait';
76 }
77 if ( false !== strpos( $class_name, 'abstracts' ) ) {
78 $file_name_prefix = 'abstract';
79 }
80 $file_name = $file_name_prefix . '-' . $class_name_without_namespace . '.php';
81
82 $namespace_arr[ count( $namespace_arr ) - 1 ] = $file_name;
83 $namespace_arr[0] = 'includes';
84
85 $file = __DIR__ . '/' . \implode( '/', $namespace_arr );
86
87 if ( file_exists( $file ) ) {
88 require $file;
89 }
90 }
91 );
92
93 add_action( 'plugins_loaded', '\\YAYDP\\load_plugin' );
94
95 if ( ! function_exists( 'YAYDP\\load_plugin' ) ) {
96 /**
97 * Initialize plugin instance
98 */
99 function load_plugin() { //phpcs:ignore
100 \YAYDP\before_load_plugin();
101 if ( function_exists( 'WC' ) && \version_compare( phpversion(), YAYDP_MINIMUM_PHP_VERSION, '>=' ) ) {
102 \YAYDP\YayPricing::get_instance();
103 } else {
104 \YAYDP\YAYDP_Fallback::get_instance();
105 }
106 }
107 }
108
109 if ( ! function_exists( 'YAYDP\\before_load_plugin' ) ) {
110 /**
111 * Do stuff before load plugin
112 */
113 function before_load_plugin() {
114 \YAYDP\YayCommerceMenu\Register_Menu::get_instance(); // Initialize YayCommerce menu.
115 if ( function_exists( 'WC' ) ) {
116 /**
117 * To set plugin is compatible for WC Custom Order Table (HPOS) feature.
118 */
119 add_action(
120 'before_woocommerce_init',
121 function() {
122 if ( class_exists( \Automattic\WooCommerce\Utilities\FeaturesUtil::class ) ) {
123 \Automattic\WooCommerce\Utilities\FeaturesUtil::declare_compatibility( 'custom_order_tables', __FILE__, true );
124 }
125 }
126 );
127 }
128 }
129 }
130
131 register_activation_hook( __FILE__, array( 'YAYDP\\YAYDP_Activation', 'initialize' ) );
132 register_deactivation_hook( __FILE__, array( 'YAYDP\\YAYDP_Deactivation', 'initialize' ) );
133
134
135