PluginProbe
Discount Rules for WooCommerce – Disco | Dynamic Pricing, Conditions, Bulk, Bundle, BOGO / 1.3.18
Discount Rules for WooCommerce – Disco | Dynamic Pricing, Conditions, Bulk, Bundle, BOGO v1.3.18
1.4.13 1.4.12 1.4.11 1.4.10 1.4.9 1.4.8 1.4.7 1.4.6 1.4.5 1.4.4 1.4.3 1.4.2 1.4.1 1.4.0 1.3.54 1.3.53 1.3.52 1.3.51 1.3.50 1.3.49 1.3.48 1.3.47 1.3.46 1.3.45 1.3.44 All 176 releases
disco / disco.php

disco.php in Discount Rules for WooCommerce – Disco | Dynamic Pricing, Conditions, Bulk, Bundle, BOGO 1.3.18, at disco.php

172 lines 4.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * The plugin bootstrap file
4 *
5 * @link https://webappick.com
6 * @since 1.0.0
7 * @package Disco
8 * @wordpress-plugin
9 * Plugin Name: Disco
10 * Plugin URI: https://webappick.com/
11 * Description: Create logical, dynamic and automated discounts for your WooCommerce Store based on product, cart, and cart item information.
12 * Version: 1.3.18
13 * Author: WebAppick
14 * Author URI: https://webappick.com/
15 * License: GPLv3 or later
16 * License URI: http://www.gnu.org/licenses/gpl-3.0.html
17 * Text Domain: disco
18 * Domain Path: /languages
19 *
20 * WP Requirement & Test
21 * Requires at least: 4.4
22 * Tested up to: 6.9.1
23 * Requires PHP: 5.6
24 * Requires Plugins: woocommerce
25 *
26 * WC Requirement & Test
27 * WC requires at least: 3.0
28 * WC tested up to: 10.5.1
29 */
30
31 // If this file is called directly, abort.
32 use Disco\Engine\Initialize;
33 use Micropackage\Requirements\Requirements;
34
35 if ( ! defined( 'ABSPATH' ) ) {
36 die( 'We\'re sorry, but you can not directly access this file.' );
37 }
38
39 const DISCO_VERSION = '1.3.18';
40 const DISCO_TEXTDOMAIN = 'disco';
41 const DISCO_NAME = 'Disco';
42
43 define( 'DISCO_PLUGIN_ROOT', plugin_dir_path( __FILE__ ) );
44 define( 'DISCO_PLUGIN_FILE', __FILE__ );
45 define( 'DISCO_BADGE_IMAGES_DIR', plugins_url( 'backend/views/asset/img', __FILE__ ));
46 define( 'DISCO_PRO_PLUGIN_FILE', dirname(__DIR__, 1) . '/disco-pro/disco-pro.php' );
47 define( 'DISCO_LIBS_PATH', DISCO_PLUGIN_ROOT . 'libs/' );
48
49 error_log(print_r(DISCO_BADGE_IMAGES_DIR, true));
50
51 const DISCO_PLUGIN_ABSOLUTE = __FILE__;
52 const DISCO_MIN_PHP_VERSION = '5.6';
53 const DISCO_WP_VERSION = '4.4';
54 const DISCO_DB_VERSION = '1.0.0';
55
56 // WooCommerce has detected that some of your active plugins are incompatible with currently enabled WooCommerce features. Please review the details.
57 add_action(
58 'before_woocommerce_init',
59 function () {
60 if ( ! class_exists( \Automattic\WooCommerce\Utilities\FeaturesUtil::class ) ) {
61 return;
62 }
63
64 \Automattic\WooCommerce\Utilities\FeaturesUtil::declare_compatibility( 'custom_order_tables', __FILE__, true );
65 }
66 );
67
68 add_action(// @phpstan-ignore-line
69 'init',
70 static function () {
71 load_plugin_textdomain( 'disco', false, dirname( plugin_basename( __FILE__ ) ) . '/languages' );
72 }
73 );
74
75 if ( version_compare( PHP_VERSION, DISCO_MIN_PHP_VERSION, '<=' ) ) {
76 add_action(// @phpstan-ignore-line
77 'admin_init',
78 static function () {
79 deactivate_plugins( plugin_basename( __FILE__ ) );
80 }
81 );
82 add_action(// @phpstan-ignore-line
83 'admin_notices',
84 static function () {
85 echo wp_kses_post(
86 sprintf(
87 '<div class="notice notice-error"><p>%s</p></div>',
88 __( 'Disco requires PHP 5.6 or newer.', 'disco' )// @phpstan-ignore-line
89 )
90 );
91 }
92 );
93
94 // Return early to prevent loading the plugin.
95 return;
96 }
97
98 $disco_libraries = require DISCO_PLUGIN_ROOT . 'vendor/autoload.php'; //phpcs:ignore
99
100 add_action('woocommerce_init', function () {
101 require_once DISCO_PLUGIN_ROOT . 'functions/common.php';
102 require_once DISCO_PLUGIN_ROOT . 'functions/cart.php';
103 require_once DISCO_PLUGIN_ROOT . 'functions/product.php';
104 require_once DISCO_PLUGIN_ROOT . 'functions/order.php';
105 require_once DISCO_PLUGIN_ROOT . 'functions/shipping.php';
106 require_once DISCO_PLUGIN_ROOT . 'functions/bogo.php';
107 require_once DISCO_PLUGIN_ROOT . 'functions/coupon.php';
108 });
109
110
111 $requirements = new Requirements(
112 'Disco',
113 array(
114 'php' => DISCO_MIN_PHP_VERSION,
115 'php_extensions' => array( 'mbstring' ),
116 'wp' => DISCO_WP_VERSION,
117 'plugins' => array(
118 array(
119 'file' => 'woocommerce/woocommerce.php',
120 'name' => 'WooCommerce',
121 'version' => '3.5',
122 ),
123 ),
124 )
125 );
126
127 if ( ! $requirements->satisfied() ) {
128 $requirements->print_notice();
129
130 return;
131 }
132
133 if ( ! wp_installing() ) {
134 register_activation_hook(
135 DISCO_TEXTDOMAIN . '/' . DISCO_TEXTDOMAIN . '.php',
136 array(
137 new \Disco\Backend\ActDeact(),
138 'activate',
139 )
140 );
141 register_deactivation_hook(
142 DISCO_TEXTDOMAIN . '/' . DISCO_TEXTDOMAIN . '.php',
143 array(
144 new \Disco\Backend\ActDeact(),
145 'deactivate',
146 )
147 );
148 add_action(// @phpstan-ignore-line
149 'plugins_loaded',
150 static function () use ( $disco_libraries ) {
151 new Initialize( $disco_libraries );
152 }
153 );
154
155 require_once __DIR__ . '/libs/WebAppick/Classes/DiscoWebAppickAPI.php';
156
157 add_action(
158 'init', function() {
159 DiscoWebAppickAPI::getInstance();
160 }
161 );
162
163 }
164
165 //Add custom link to plugin row meta
166 //add_filter('plugin_row_meta', function ( $links, $file ) {
167 // if ($file == plugin_basename(__FILE__)) {
168 // $links[] = '<a href="https://discoplugin.com/pricing/?utm_source=update&utm_medium=wp_free&utm_campaign=release-update" target="_blank" class="disco-custom-meta-link"><span >🎃 Halloween Special – 30% OFF</span></a>';
169 // }
170 // return $links;
171 //}, 10, 2);
172