Discount Rules for WooCommerce - Version 1.4.4

Version Description

Download this release

Release Info

Developer flycart
Plugin Icon 128x128 Discount Rules for WooCommerce
Version 1.4.4
Comparing to
See all releases

Code changes from version 1.4.3 to 1.4.4

assets/css/style.css CHANGED
@@ -11,4 +11,17 @@
11
  #category_list,
12
  .apply_child_categories{
13
  margin-top: 10px;
 
 
 
 
 
 
 
 
 
 
 
 
 
14
  }
11
  #category_list,
12
  .apply_child_categories{
13
  margin-top: 10px;
14
+ }
15
+ #form_cart_rule .invalid-field,
16
+ #form_price_rule .invalid-field{
17
+ border: 1px solid red;
18
+ }
19
+ #form_cart_rule .error,
20
+ #form_price_rule .error{
21
+ color: red;
22
+ display: inline-block;
23
+ padding: 0 5px;
24
+ }
25
+ .woo-discount-version {
26
+ font-size: 16px;
27
  }
assets/js/app.js CHANGED
@@ -1,4 +1,23 @@
1
  jQuery.noConflict();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
  (function ($) {
3
  jQuery(document).ready(function () {
4
  var ajax_url = $('#ajax_path').val();
@@ -41,6 +60,10 @@ jQuery.noConflict();
41
 
42
  // Saving Rule.
43
  $('#savePriceRule').on('click', function (event) {
 
 
 
 
44
  var form = $('#form_price_rule').serialize();
45
  var current = $(this);
46
  var rule_id = $('#rule_id').val();
@@ -160,9 +183,11 @@ jQuery.noConflict();
160
  $('#discount_block').hide();
161
  });
162
  $('.restriction_tab').on('click', function () {
163
- $('#general_block').hide();
164
- $('#restriction_block').show();
165
- $('#discount_block').hide();
 
 
166
  });
167
  $('.discount_tab').on('click', function () {
168
  $('#general_block').hide();
1
  jQuery.noConflict();
2
+ function validateFields(){
3
+ var returnValue = false;
4
+ (function ($) {
5
+ var rule_order = $('#rule_order');
6
+ if(rule_order.val() != ''){
7
+ rule_order.removeClass('invalid-field');
8
+ rule_order.next('.error').remove();
9
+ returnValue = true;
10
+ } else {
11
+ $('a.general_tab').trigger('click');
12
+ rule_order.addClass('invalid-field');
13
+ rule_order.next('.error').remove();
14
+ rule_order.after('<span class="error">Please fill this field</span>');
15
+ returnValue = false;
16
+ }
17
+
18
+ })(jQuery);
19
+ return returnValue;
20
+ }
21
  (function ($) {
22
  jQuery(document).ready(function () {
23
  var ajax_url = $('#ajax_path').val();
60
 
61
  // Saving Rule.
62
  $('#savePriceRule').on('click', function (event) {
63
+ var validate = validateFields();
64
+ if(validate == false){
65
+ return false;
66
+ }
67
  var form = $('#form_price_rule').serialize();
68
  var current = $(this);
69
  var rule_id = $('#rule_id').val();
183
  $('#discount_block').hide();
184
  });
185
  $('.restriction_tab').on('click', function () {
186
+ if(validateFields() == true){
187
+ $('#general_block').hide();
188
+ $('#restriction_block').show();
189
+ $('#discount_block').hide();
190
+ }
191
  });
192
  $('.discount_tab').on('click', function () {
193
  $('#general_block').hide();
helper/general-helper.php CHANGED
@@ -49,6 +49,7 @@ if ( ! class_exists( 'woo_dicount_rules_generalHelper' ) ) {
49
  {
50
  $purchase = new woo_dicount_rules_purchase();
51
  $this->isPro = $purchase->isPro();
 
52
  // $this->isPro = true;
53
  }
54
 
49
  {
50
  $purchase = new woo_dicount_rules_purchase();
51
  $this->isPro = $purchase->isPro();
52
+ return $this->isPro;
53
  // $this->isPro = true;
54
  }
55
 
helper/purchase.php CHANGED
@@ -36,6 +36,18 @@ if ( ! class_exists( 'woo_dicount_rules_purchase' ) ) {
36
  return '-PRO-';
37
  }
38
 
 
 
 
 
 
 
 
 
 
 
 
 
39
  public function validateLicense()
40
  {
41
 
36
  return '-PRO-';
37
  }
38
 
39
+ /**
40
+ * @return string
41
+ */
42
+ public function getProText()
43
+ {
44
+ if($this->isPro()){
45
+ return 'Pro';
46
+ } else {
47
+ return 'Core';
48
+ }
49
+ }
50
+
51
  public function validateLicense()
52
  {
53
 
loader.php CHANGED
@@ -1,9 +1,6 @@
1
  <?php
2
  if (!defined('ABSPATH')) exit; // Exit if accessed directly
3
- /**
4
- * Version of Woo Discount Rules.
5
- */
6
- define('WOO_DISCOUNT_VERSION', '1.4.3');
7
  /**
8
  * Required Version of WooCommerce to Run.
9
  */
@@ -21,12 +18,18 @@ define('WOO_DISCOUNT_URI', untrailingslashit(plugin_dir_url(__FILE__)));
21
  */
22
  define('WOO_DISCOUNT_PLUGIN_BASENAME', plugin_basename(__FILE__));
23
 
 
 
 
 
 
 
 
 
24
  include_once('includes/discount-base.php');
25
  include_once('includes/pricing-rules.php');
26
  include_once('helper/general-helper.php');
27
- if(!class_exists('\FlycartInput\FInput') && !class_exists('FInput')){
28
- require_once('helper/FlycartInput/FInput.php');
29
- }
30
 
31
  // --------------------------------------------------GENERAL HOOK-------------------------------------------------------
32
 
1
  <?php
2
  if (!defined('ABSPATH')) exit; // Exit if accessed directly
3
+
 
 
 
4
  /**
5
  * Required Version of WooCommerce to Run.
6
  */
18
  */
19
  define('WOO_DISCOUNT_PLUGIN_BASENAME', plugin_basename(__FILE__));
20
 
21
+ if(!function_exists('get_plugin_data')){
22
+ require_once ABSPATH . 'wp-admin/includes/plugin.php';
23
+ }
24
+ /**
25
+ * Version of Woo Discount Rules.
26
+ */
27
+ define('WOO_DISCOUNT_VERSION', get_plugin_data(plugin_dir_path(__FILE__).'woo-discount-rules.php')['Version']);
28
+
29
  include_once('includes/discount-base.php');
30
  include_once('includes/pricing-rules.php');
31
  include_once('helper/general-helper.php');
32
+ require_once __DIR__ . '/vendor/autoload.php';
 
 
33
 
34
  // --------------------------------------------------GENERAL HOOK-------------------------------------------------------
35
 
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: https://flycart.org/
4
  Tags: woocommerce, ecommerce, discounts, coupons, promotion, campaigns, sales, price rules, advanced coupons, advanced discounts
5
  Requires at least: 4.4.1
6
  Tested up to: 4.7
7
- Stable tag: 1.4.3
8
  License: GPLv3 or later
9
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
10
 
4
  Tags: woocommerce, ecommerce, discounts, coupons, promotion, campaigns, sales, price rules, advanced coupons, advanced discounts
5
  Requires at least: 4.4.1
6
  Tested up to: 4.7
7
+ Stable tag: 1.4.4
8
  License: GPLv3 or later
9
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
10
 
vendor/autoload.php ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ // autoload.php @generated by Composer
4
+
5
+ require_once __DIR__ . '/composer' . '/autoload_real.php';
6
+
7
+ return ComposerAutoloaderInit99fb821a098de3bdad03e3323415706b::getLoader();
vendor/composer/ClassLoader.php ADDED
@@ -0,0 +1,413 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * This file is part of Composer.
5
+ *
6
+ * (c) Nils Adermann <naderman@naderman.de>
7
+ * Jordi Boggiano <j.boggiano@seld.be>
8
+ *
9
+ * For the full copyright and license information, please view the LICENSE
10
+ * file that was distributed with this source code.
11
+ */
12
+
13
+ namespace Composer\Autoload;
14
+
15
+ /**
16
+ * ClassLoader implements a PSR-0, PSR-4 and classmap class loader.
17
+ *
18
+ * $loader = new \Composer\Autoload\ClassLoader();
19
+ *
20
+ * // register classes with namespaces
21
+ * $loader->add('Symfony\Component', __DIR__.'/component');
22
+ * $loader->add('Symfony', __DIR__.'/framework');
23
+ *
24
+ * // activate the autoloader
25
+ * $loader->register();
26
+ *
27
+ * // to enable searching the include path (eg. for PEAR packages)
28
+ * $loader->setUseIncludePath(true);
29
+ *
30
+ * In this example, if you try to use a class in the Symfony\Component
31
+ * namespace or one of its children (Symfony\Component\Console for instance),
32
+ * the autoloader will first look for the class under the component/
33
+ * directory, and it will then fallback to the framework/ directory if not
34
+ * found before giving up.
35
+ *
36
+ * This class is loosely based on the Symfony UniversalClassLoader.
37
+ *
38
+ * @author Fabien Potencier <fabien@symfony.com>
39
+ * @author Jordi Boggiano <j.boggiano@seld.be>
40
+ * @see http://www.php-fig.org/psr/psr-0/
41
+ * @see http://www.php-fig.org/psr/psr-4/
42
+ */
43
+ class ClassLoader
44
+ {
45
+ // PSR-4
46
+ private $prefixLengthsPsr4 = array();
47
+ private $prefixDirsPsr4 = array();
48
+ private $fallbackDirsPsr4 = array();
49
+
50
+ // PSR-0
51
+ private $prefixesPsr0 = array();
52
+ private $fallbackDirsPsr0 = array();
53
+
54
+ private $useIncludePath = false;
55
+ private $classMap = array();
56
+
57
+ private $classMapAuthoritative = false;
58
+
59
+ public function getPrefixes()
60
+ {
61
+ if (!empty($this->prefixesPsr0)) {
62
+ return call_user_func_array('array_merge', $this->prefixesPsr0);
63
+ }
64
+
65
+ return array();
66
+ }
67
+
68
+ public function getPrefixesPsr4()
69
+ {
70
+ return $this->prefixDirsPsr4;
71
+ }
72
+
73
+ public function getFallbackDirs()
74
+ {
75
+ return $this->fallbackDirsPsr0;
76
+ }
77
+
78
+ public function getFallbackDirsPsr4()
79
+ {
80
+ return $this->fallbackDirsPsr4;
81
+ }
82
+
83
+ public function getClassMap()
84
+ {
85
+ return $this->classMap;
86
+ }
87
+
88
+ /**
89
+ * @param array $classMap Class to filename map
90
+ */
91
+ public function addClassMap(array $classMap)
92
+ {
93
+ if ($this->classMap) {
94
+ $this->classMap = array_merge($this->classMap, $classMap);
95
+ } else {
96
+ $this->classMap = $classMap;
97
+ }
98
+ }
99
+
100
+ /**
101
+ * Registers a set of PSR-0 directories for a given prefix, either
102
+ * appending or prepending to the ones previously set for this prefix.
103
+ *
104
+ * @param string $prefix The prefix
105
+ * @param array|string $paths The PSR-0 root directories
106
+ * @param bool $prepend Whether to prepend the directories
107
+ */
108
+ public function add($prefix, $paths, $prepend = false)
109
+ {
110
+ if (!$prefix) {
111
+ if ($prepend) {
112
+ $this->fallbackDirsPsr0 = array_merge(
113
+ (array) $paths,
114
+ $this->fallbackDirsPsr0
115
+ );
116
+ } else {
117
+ $this->fallbackDirsPsr0 = array_merge(
118
+ $this->fallbackDirsPsr0,
119
+ (array) $paths
120
+ );
121
+ }
122
+
123
+ return;
124
+ }
125
+
126
+ $first = $prefix[0];
127
+ if (!isset($this->prefixesPsr0[$first][$prefix])) {
128
+ $this->prefixesPsr0[$first][$prefix] = (array) $paths;
129
+
130
+ return;
131
+ }
132
+ if ($prepend) {
133
+ $this->prefixesPsr0[$first][$prefix] = array_merge(
134
+ (array) $paths,
135
+ $this->prefixesPsr0[$first][$prefix]
136
+ );
137
+ } else {
138
+ $this->prefixesPsr0[$first][$prefix] = array_merge(
139
+ $this->prefixesPsr0[$first][$prefix],
140
+ (array) $paths
141
+ );
142
+ }
143
+ }
144
+
145
+ /**
146
+ * Registers a set of PSR-4 directories for a given namespace, either
147
+ * appending or prepending to the ones previously set for this namespace.
148
+ *
149
+ * @param string $prefix The prefix/namespace, with trailing '\\'
150
+ * @param array|string $paths The PSR-4 base directories
151
+ * @param bool $prepend Whether to prepend the directories
152
+ *
153
+ * @throws \InvalidArgumentException
154
+ */
155
+ public function addPsr4($prefix, $paths, $prepend = false)
156
+ {
157
+ if (!$prefix) {
158
+ // Register directories for the root namespace.
159
+ if ($prepend) {
160
+ $this->fallbackDirsPsr4 = array_merge(
161
+ (array) $paths,
162
+ $this->fallbackDirsPsr4
163
+ );
164
+ } else {
165
+ $this->fallbackDirsPsr4 = array_merge(
166
+ $this->fallbackDirsPsr4,
167
+ (array) $paths
168
+ );
169
+ }
170
+ } elseif (!isset($this->prefixDirsPsr4[$prefix])) {
171
+ // Register directories for a new namespace.
172
+ $length = strlen($prefix);
173
+ if ('\\' !== $prefix[$length - 1]) {
174
+ throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
175
+ }
176
+ $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
177
+ $this->prefixDirsPsr4[$prefix] = (array) $paths;
178
+ } elseif ($prepend) {
179
+ // Prepend directories for an already registered namespace.
180
+ $this->prefixDirsPsr4[$prefix] = array_merge(
181
+ (array) $paths,
182
+ $this->prefixDirsPsr4[$prefix]
183
+ );
184
+ } else {
185
+ // Append directories for an already registered namespace.
186
+ $this->prefixDirsPsr4[$prefix] = array_merge(
187
+ $this->prefixDirsPsr4[$prefix],
188
+ (array) $paths
189
+ );
190
+ }
191
+ }
192
+
193
+ /**
194
+ * Registers a set of PSR-0 directories for a given prefix,
195
+ * replacing any others previously set for this prefix.
196
+ *
197
+ * @param string $prefix The prefix
198
+ * @param array|string $paths The PSR-0 base directories
199
+ */
200
+ public function set($prefix, $paths)
201
+ {
202
+ if (!$prefix) {
203
+ $this->fallbackDirsPsr0 = (array) $paths;
204
+ } else {
205
+ $this->prefixesPsr0[$prefix[0]][$prefix] = (array) $paths;
206
+ }
207
+ }
208
+
209
+ /**
210
+ * Registers a set of PSR-4 directories for a given namespace,
211
+ * replacing any others previously set for this namespace.
212
+ *
213
+ * @param string $prefix The prefix/namespace, with trailing '\\'
214
+ * @param array|string $paths The PSR-4 base directories
215
+ *
216
+ * @throws \InvalidArgumentException
217
+ */
218
+ public function setPsr4($prefix, $paths)
219
+ {
220
+ if (!$prefix) {
221
+ $this->fallbackDirsPsr4 = (array) $paths;
222
+ } else {
223
+ $length = strlen($prefix);
224
+ if ('\\' !== $prefix[$length - 1]) {
225
+ throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
226
+ }
227
+ $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
228
+ $this->prefixDirsPsr4[$prefix] = (array) $paths;
229
+ }
230
+ }
231
+
232
+ /**
233
+ * Turns on searching the include path for class files.
234
+ *
235
+ * @param bool $useIncludePath
236
+ */
237
+ public function setUseIncludePath($useIncludePath)
238
+ {
239
+ $this->useIncludePath = $useIncludePath;
240
+ }
241
+
242
+ /**
243
+ * Can be used to check if the autoloader uses the include path to check
244
+ * for classes.
245
+ *
246
+ * @return bool
247
+ */
248
+ public function getUseIncludePath()
249
+ {
250
+ return $this->useIncludePath;
251
+ }
252
+
253
+ /**
254
+ * Turns off searching the prefix and fallback directories for classes
255
+ * that have not been registered with the class map.
256
+ *
257
+ * @param bool $classMapAuthoritative
258
+ */
259
+ public function setClassMapAuthoritative($classMapAuthoritative)
260
+ {
261
+ $this->classMapAuthoritative = $classMapAuthoritative;
262
+ }
263
+
264
+ /**
265
+ * Should class lookup fail if not found in the current class map?
266
+ *
267
+ * @return bool
268
+ */
269
+ public function isClassMapAuthoritative()
270
+ {
271
+ return $this->classMapAuthoritative;
272
+ }
273
+
274
+ /**
275
+ * Registers this instance as an autoloader.
276
+ *
277
+ * @param bool $prepend Whether to prepend the autoloader or not
278
+ */
279
+ public function register($prepend = false)
280
+ {
281
+ spl_autoload_register(array($this, 'loadClass'), true, $prepend);
282
+ }
283
+
284
+ /**
285
+ * Unregisters this instance as an autoloader.
286
+ */
287
+ public function unregister()
288
+ {
289
+ spl_autoload_unregister(array($this, 'loadClass'));
290
+ }
291
+
292
+ /**
293
+ * Loads the given class or interface.
294
+ *
295
+ * @param string $class The name of the class
296
+ * @return bool|null True if loaded, null otherwise
297
+ */
298
+ public function loadClass($class)
299
+ {
300
+ if ($file = $this->findFile($class)) {
301
+ includeFile($file);
302
+
303
+ return true;
304
+ }
305
+ }
306
+
307
+ /**
308
+ * Finds the path to the file where the class is defined.
309
+ *
310
+ * @param string $class The name of the class
311
+ *
312
+ * @return string|false The path if found, false otherwise
313
+ */
314
+ public function findFile($class)
315
+ {
316
+ // work around for PHP 5.3.0 - 5.3.2 https://bugs.php.net/50731
317
+ if ('\\' == $class[0]) {
318
+ $class = substr($class, 1);
319
+ }
320
+
321
+ // class map lookup
322
+ if (isset($this->classMap[$class])) {
323
+ return $this->classMap[$class];
324
+ }
325
+ if ($this->classMapAuthoritative) {
326
+ return false;
327
+ }
328
+
329
+ $file = $this->findFileWithExtension($class, '.php');
330
+
331
+ // Search for Hack files if we are running on HHVM
332
+ if ($file === null && defined('HHVM_VERSION')) {
333
+ $file = $this->findFileWithExtension($class, '.hh');
334
+ }
335
+
336
+ if ($file === null) {
337
+ // Remember that this class does not exist.
338
+ return $this->classMap[$class] = false;
339
+ }
340
+
341
+ return $file;
342
+ }
343
+
344
+ private function findFileWithExtension($class, $ext)
345
+ {
346
+ // PSR-4 lookup
347
+ $logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext;
348
+
349
+ $first = $class[0];
350
+ if (isset($this->prefixLengthsPsr4[$first])) {
351
+ foreach ($this->prefixLengthsPsr4[$first] as $prefix => $length) {
352
+ if (0 === strpos($class, $prefix)) {
353
+ foreach ($this->prefixDirsPsr4[$prefix] as $dir) {
354
+ if (file_exists($file = $dir . DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $length))) {
355
+ return $file;
356
+ }
357
+ }
358
+ }
359
+ }
360
+ }
361
+
362
+ // PSR-4 fallback dirs
363
+ foreach ($this->fallbackDirsPsr4 as $dir) {
364
+ if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) {
365
+ return $file;
366
+ }
367
+ }
368
+
369
+ // PSR-0 lookup
370
+ if (false !== $pos = strrpos($class, '\\')) {
371
+ // namespaced class name
372
+ $logicalPathPsr0 = substr($logicalPathPsr4, 0, $pos + 1)
373
+ . strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR);
374
+ } else {
375
+ // PEAR-like class name
376
+ $logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . $ext;
377
+ }
378
+
379
+ if (isset($this->prefixesPsr0[$first])) {
380
+ foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) {
381
+ if (0 === strpos($class, $prefix)) {
382
+ foreach ($dirs as $dir) {
383
+ if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
384
+ return $file;
385
+ }
386
+ }
387
+ }
388
+ }
389
+ }
390
+
391
+ // PSR-0 fallback dirs
392
+ foreach ($this->fallbackDirsPsr0 as $dir) {
393
+ if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
394
+ return $file;
395
+ }
396
+ }
397
+
398
+ // PSR-0 include paths.
399
+ if ($this->useIncludePath && $file = stream_resolve_include_path($logicalPathPsr0)) {
400
+ return $file;
401
+ }
402
+ }
403
+ }
404
+
405
+ /**
406
+ * Scope isolated include.
407
+ *
408
+ * Prevents access to $this/self from included files.
409
+ */
410
+ function includeFile($file)
411
+ {
412
+ include $file;
413
+ }
vendor/composer/LICENSE ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ Copyright (c) 2016 Nils Adermann, Jordi Boggiano
3
+
4
+ Permission is hereby granted, free of charge, to any person obtaining a copy
5
+ of this software and associated documentation files (the "Software"), to deal
6
+ in the Software without restriction, including without limitation the rights
7
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ copies of the Software, and to permit persons to whom the Software is furnished
9
+ to do so, subject to the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be included in all
12
+ copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20
+ THE SOFTWARE.
21
+
vendor/composer/autoload_classmap.php ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ // autoload_classmap.php @generated by Composer
4
+
5
+ $vendorDir = dirname(dirname(__FILE__));
6
+ $baseDir = dirname($vendorDir);
7
+
8
+ return array(
9
+ );
vendor/composer/autoload_namespaces.php ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ // autoload_namespaces.php @generated by Composer
4
+
5
+ $vendorDir = dirname(dirname(__FILE__));
6
+ $baseDir = dirname($vendorDir);
7
+
8
+ return array(
9
+ );
vendor/composer/autoload_psr4.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ // autoload_psr4.php @generated by Composer
4
+
5
+ $vendorDir = dirname(dirname(__FILE__));
6
+ $baseDir = dirname($vendorDir);
7
+
8
+ return array(
9
+ 'FlycartInput\\' => array($vendorDir . '/flycartinc/inputhelper/src'),
10
+ );
vendor/composer/autoload_real.php ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ // autoload_real.php @generated by Composer
4
+
5
+ class ComposerAutoloaderInit99fb821a098de3bdad03e3323415706b
6
+ {
7
+ private static $loader;
8
+
9
+ public static function loadClassLoader($class)
10
+ {
11
+ if ('Composer\Autoload\ClassLoader' === $class) {
12
+ require __DIR__ . '/ClassLoader.php';
13
+ }
14
+ }
15
+
16
+ public static function getLoader()
17
+ {
18
+ if (null !== self::$loader) {
19
+ return self::$loader;
20
+ }
21
+
22
+ spl_autoload_register(array('ComposerAutoloaderInit99fb821a098de3bdad03e3323415706b', 'loadClassLoader'), true, true);
23
+ self::$loader = $loader = new \Composer\Autoload\ClassLoader();
24
+ spl_autoload_unregister(array('ComposerAutoloaderInit99fb821a098de3bdad03e3323415706b', 'loadClassLoader'));
25
+
26
+ $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION');
27
+ if ($useStaticLoader) {
28
+ require_once __DIR__ . '/autoload_static.php';
29
+
30
+ call_user_func(\Composer\Autoload\ComposerStaticInit99fb821a098de3bdad03e3323415706b::getInitializer($loader));
31
+ } else {
32
+ $map = require __DIR__ . '/autoload_namespaces.php';
33
+ foreach ($map as $namespace => $path) {
34
+ $loader->set($namespace, $path);
35
+ }
36
+
37
+ $map = require __DIR__ . '/autoload_psr4.php';
38
+ foreach ($map as $namespace => $path) {
39
+ $loader->setPsr4($namespace, $path);
40
+ }
41
+
42
+ $classMap = require __DIR__ . '/autoload_classmap.php';
43
+ if ($classMap) {
44
+ $loader->addClassMap($classMap);
45
+ }
46
+ }
47
+
48
+ $loader->register(true);
49
+
50
+ return $loader;
51
+ }
52
+ }
vendor/composer/autoload_static.php ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ // autoload_static.php @generated by Composer
4
+
5
+ namespace Composer\Autoload;
6
+
7
+ class ComposerStaticInit99fb821a098de3bdad03e3323415706b
8
+ {
9
+ public static $prefixLengthsPsr4 = array (
10
+ 'F' =>
11
+ array (
12
+ 'FlycartInput\\' => 13,
13
+ ),
14
+ );
15
+
16
+ public static $prefixDirsPsr4 = array (
17
+ 'FlycartInput\\' =>
18
+ array (
19
+ 0 => __DIR__ . '/..' . '/flycartinc/inputhelper/src',
20
+ ),
21
+ );
22
+
23
+ public static function getInitializer(ClassLoader $loader)
24
+ {
25
+ return \Closure::bind(function () use ($loader) {
26
+ $loader->prefixLengthsPsr4 = ComposerStaticInit99fb821a098de3bdad03e3323415706b::$prefixLengthsPsr4;
27
+ $loader->prefixDirsPsr4 = ComposerStaticInit99fb821a098de3bdad03e3323415706b::$prefixDirsPsr4;
28
+
29
+ }, null, ClassLoader::class);
30
+ }
31
+ }
vendor/composer/installed.json ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [
2
+ {
3
+ "name": "flycartinc/inputhelper",
4
+ "version": "dev-master",
5
+ "version_normalized": "9999999-dev",
6
+ "source": {
7
+ "type": "git",
8
+ "url": "https://github.com/flycartinc/InputHelper.git",
9
+ "reference": "d0443792937349d58f6a5c553d010f87fa09ee3e"
10
+ },
11
+ "dist": {
12
+ "type": "zip",
13
+ "url": "https://api.github.com/repos/flycartinc/InputHelper/zipball/d0443792937349d58f6a5c553d010f87fa09ee3e",
14
+ "reference": "d0443792937349d58f6a5c553d010f87fa09ee3e",
15
+ "shasum": ""
16
+ },
17
+ "require": {
18
+ "php": ">=5.3.0"
19
+ },
20
+ "time": "2017-01-25 08:42:12",
21
+ "type": "library",
22
+ "installation-source": "source",
23
+ "autoload": {
24
+ "psr-4": {
25
+ "FlycartInput\\": "src/"
26
+ }
27
+ },
28
+ "notification-url": "https://packagist.org/downloads/",
29
+ "license": [
30
+ "MIT"
31
+ ],
32
+ "authors": [
33
+ {
34
+ "name": "Ashlin Rejo"
35
+ }
36
+ ],
37
+ "description": "Data Sanitization and Validation With WordPress"
38
+ }
39
+ ]
vendor/flycartinc/inputhelper/composer.json ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "name": "flycartinc/inputhelper",
3
+ "description": "Data Sanitization and Validation With WordPress",
4
+ "type": "library",
5
+ "license": "MIT",
6
+ "authors": [
7
+ {
8
+ "name": "Ashlin Rejo"
9
+ }
10
+ ],
11
+ "require": {
12
+ "php": ">=5.3.0"
13
+ },
14
+ "require-dev": {
15
+ },
16
+ "autoload": {
17
+ "psr-4": {
18
+ "FlycartInput\\": "src/"
19
+ }
20
+ }
21
+ }
{helper/FlycartInput → vendor/flycartinc/inputhelper/src}/FFilterInput.php RENAMED
@@ -1,15 +1,13 @@
1
  <?php
2
- namespace FlycartInput;
3
 
 
4
  if (!defined('ABSPATH')) exit; // Exit if accessed directly
5
-
6
  use FlycartInput\InputFilter;
7
  use FlycartInput\StringHelper;
8
  require_once 'InputFilter.php';
9
  require_once 'StringHelper.php';
10
  /**
11
- * JFilterInput is a class for filtering input from any data source
12
- *
13
  */
14
  class FFilterInput extends InputFilter
15
  {
@@ -57,7 +55,6 @@ class FFilterInput extends InputFilter
57
  {
58
  global $wpdb;
59
  $data = get_object_vars($wpdb);
60
-
61
  if(isset($data['charset']) && $data['charset'] == 'utf8mb4'){
62
  $this->stripUSC = 1;
63
  } else {
1
  <?php
 
2
 
3
+ namespace FlycartInput;
4
  if (!defined('ABSPATH')) exit; // Exit if accessed directly
 
5
  use FlycartInput\InputFilter;
6
  use FlycartInput\StringHelper;
7
  require_once 'InputFilter.php';
8
  require_once 'StringHelper.php';
9
  /**
10
+ * FFilterInput is a class for filtering input from any data source
 
11
  */
12
  class FFilterInput extends InputFilter
13
  {
55
  {
56
  global $wpdb;
57
  $data = get_object_vars($wpdb);
 
58
  if(isset($data['charset']) && $data['charset'] == 'utf8mb4'){
59
  $this->stripUSC = 1;
60
  } else {
{helper/FlycartInput → vendor/flycartinc/inputhelper/src}/FInput.php RENAMED
@@ -2,24 +2,21 @@
2
 
3
  namespace FlycartInput;
4
  if (!defined('ABSPATH')) exit; // Exit if accessed directly
5
-
6
  use Serializable;
7
  use Countable;
8
  use FlycartInput\FFilterInput;
9
  require_once 'FFilterInput.php';
10
  /**
11
- * FInput Base Class
12
- *
13
  * This is an abstracted input class used to manage retrieving data from the application environment.
14
  *
15
  * @since 11.1
16
  *
17
- * @property-read FInput $get
18
- * @property-read FInput $post
19
- * @property-read FInput $request
20
- * @property-read FInput $server
21
- * @property-read FInputFiles $files
22
- * @property-read FInputCookie $cookie
23
  *
24
  * @method integer getInt() getInt($name, $default = null) Get a signed integer.
25
  * @method integer getUint() getUint($name, $default = null) Get an unsigned integer.
@@ -47,8 +44,7 @@ class FInput implements Serializable, Countable
47
  /**
48
  * Filter object to use.
49
  *
50
- * @var JFilterInput
51
- * @since 11.1
52
  */
53
  protected $filter = null;
54
 
@@ -196,7 +192,7 @@ class FInput implements Serializable, Countable
196
  * @param mixed $datasource Array to retrieve data from, or null.
197
  * @param string $defaultFilter Default filter used in JFilterInput::clean if vars is empty and
198
  * datasource is null. If 'unknown', the default case is used in
199
- * JFilterInput::clean.
200
  *
201
  * @return mixed The filtered input data.
202
  *
@@ -217,7 +213,7 @@ class FInput implements Serializable, Countable
217
  * @param mixed $datasource Array to retrieve data from, or null.
218
  * @param string $defaultFilter Default filter used in JFilterInput::clean if vars is empty and
219
  * datasource is null. If 'unknown', the default case is used in
220
- * JFilterInput::clean.
221
  * @param bool $recursion Flag to indicate a recursive function call.
222
  *
223
  * @return mixed The filtered input data.
2
 
3
  namespace FlycartInput;
4
  if (!defined('ABSPATH')) exit; // Exit if accessed directly
 
5
  use Serializable;
6
  use Countable;
7
  use FlycartInput\FFilterInput;
8
  require_once 'FFilterInput.php';
9
  /**
 
 
10
  * This is an abstracted input class used to manage retrieving data from the application environment.
11
  *
12
  * @since 11.1
13
  *
14
+ * @property-read JInput $get
15
+ * @property-read JInput $post
16
+ * @property-read JInput $request
17
+ * @property-read JInput $server
18
+ * @property-read JInputFiles $files
19
+ * @property-read JInputCookie $cookie
20
  *
21
  * @method integer getInt() getInt($name, $default = null) Get a signed integer.
22
  * @method integer getUint() getUint($name, $default = null) Get an unsigned integer.
44
  /**
45
  * Filter object to use.
46
  *
47
+ * @var FFilterInput
 
48
  */
49
  protected $filter = null;
50
 
192
  * @param mixed $datasource Array to retrieve data from, or null.
193
  * @param string $defaultFilter Default filter used in JFilterInput::clean if vars is empty and
194
  * datasource is null. If 'unknown', the default case is used in
195
+ * FFilterInput::clean.
196
  *
197
  * @return mixed The filtered input data.
198
  *
213
  * @param mixed $datasource Array to retrieve data from, or null.
214
  * @param string $defaultFilter Default filter used in JFilterInput::clean if vars is empty and
215
  * datasource is null. If 'unknown', the default case is used in
216
+ * FFilterInput::clean.
217
  * @param bool $recursion Flag to indicate a recursive function call.
218
  *
219
  * @return mixed The filtered input data.
{helper/FlycartInput → vendor/flycartinc/inputhelper/src}/InputFilter.php RENAMED
@@ -2,13 +2,11 @@
2
 
3
  namespace FlycartInput;
4
  if (!defined('ABSPATH')) exit; // Exit if accessed directly
5
-
6
  use FlycartInput\StringHelper;
7
  require_once 'StringHelper.php';
8
 
9
  /**
10
  * InputFilter is a class for filtering input from any data source
11
- *
12
  */
13
  class InputFilter
14
  {
2
 
3
  namespace FlycartInput;
4
  if (!defined('ABSPATH')) exit; // Exit if accessed directly
 
5
  use FlycartInput\StringHelper;
6
  require_once 'StringHelper.php';
7
 
8
  /**
9
  * InputFilter is a class for filtering input from any data source
 
10
  */
11
  class InputFilter
12
  {
vendor/flycartinc/inputhelper/src/ReadMe.md ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ **How to use?**
2
+ Add the code as required
3
+ use FlycartInput\FInput;
4
+ or
5
+ require_once 'FlycartInput/FInput.php';
6
+
7
+
8
+ **To get an input value:**
9
+
10
+ $postData = FInput::getInstance();
11
+ $page_id = $postData->get('page_id'));
{helper/FlycartInput → vendor/flycartinc/inputhelper/src}/StringHelper.php RENAMED
@@ -1,7 +1,7 @@
1
  <?php
 
2
  namespace FlycartInput;
3
  if (!defined('ABSPATH')) exit; // Exit if accessed directly
4
-
5
  // PHP mbstring and iconv local configuration
6
  if (version_compare(PHP_VERSION, '5.6', '>='))
7
  {
1
  <?php
2
+
3
  namespace FlycartInput;
4
  if (!defined('ABSPATH')) exit; // Exit if accessed directly
 
5
  // PHP mbstring and iconv local configuration
6
  if (version_compare(PHP_VERSION, '5.6', '>='))
7
  {
view/cart-rules.php CHANGED
@@ -27,7 +27,7 @@ global $woocommerce;
27
  <div class="row">
28
  <div class="col-md-4" id="add_new_rule_div">
29
  <?php if (isset($rule_list)) {
30
- if (count($rule_list) >= 3) { ?>
31
  <a href=javascript:void(0)
32
  class="button button-secondary">You Reach Max. Rule Limit
33
  </a>
27
  <div class="row">
28
  <div class="col-md-4" id="add_new_rule_div">
29
  <?php if (isset($rule_list)) {
30
+ if (count($rule_list) >= 3 && !$pro) { ?>
31
  <a href=javascript:void(0)
32
  class="button button-secondary">You Reach Max. Rule Limit
33
  </a>
view/includes/cart-menu.php CHANGED
@@ -1,5 +1,8 @@
1
  <?php if (!defined('ABSPATH')) exit; // Exit if accessed directly ?>
2
- <i><h2>Woo Discount Rules</h2></i>
 
 
 
3
  <hr>
4
  <h3 class="nav-tab-wrapper">
5
  <a class="nav-tab" href=javascript:void(0) id="cart_general_tab">
1
  <?php if (!defined('ABSPATH')) exit; // Exit if accessed directly ?>
2
+ <?php
3
+ $proText = $purchase->getProText();
4
+ ?>
5
+ <i><h2>Woo Discount Rules <?php echo $proText; ?> <span class="woo-discount-version">v<?php echo WOO_DISCOUNT_VERSION; ?></span></h2></i>
6
  <hr>
7
  <h3 class="nav-tab-wrapper">
8
  <a class="nav-tab" href=javascript:void(0) id="cart_general_tab">
view/includes/menu.php CHANGED
@@ -1,5 +1,8 @@
1
  <?php if (!defined('ABSPATH')) exit; // Exit if accessed directly ?>
2
- <i><h2>Woo Discount Rules</h2></i><hr>
 
 
 
3
  <h3 class="nav-tab-wrapper">
4
  <a class="nav-tab <?php if ($active == 'pricing-rules') { echo 'nav-tab-active'; } ?>" href="?page=woo_discount_rules&amp;tab=pricing-rules">
5
  <i class="fa fa-tags" style="font-size: 0.8em;"></i> &nbsp;Price Discount Rules </a>
1
  <?php if (!defined('ABSPATH')) exit; // Exit if accessed directly ?>
2
+ <?php
3
+ $proText = $purchase->getProText();
4
+ ?>
5
+ <i><h2>Woo Discount Rules <?php echo $proText; ?> <span class="woo-discount-version">v<?php echo WOO_DISCOUNT_VERSION; ?></span></h2></i><hr>
6
  <h3 class="nav-tab-wrapper">
7
  <a class="nav-tab <?php if ($active == 'pricing-rules') { echo 'nav-tab-active'; } ?>" href="?page=woo_discount_rules&amp;tab=pricing-rules">
8
  <i class="fa fa-tags" style="font-size: 0.8em;"></i> &nbsp;Price Discount Rules </a>
view/includes/sub-menu.php CHANGED
@@ -1,5 +1,8 @@
1
  <?php if (!defined('ABSPATH')) exit; // Exit if accessed directly ?>
2
- <i><h2>Woo Discount Rules</h2></i>
 
 
 
3
  <hr>
4
  <h3 class="nav-tab-wrapper">
5
  <a class="nav-tab general_tab" href=javascript:void(0)>
1
  <?php if (!defined('ABSPATH')) exit; // Exit if accessed directly ?>
2
+ <?php
3
+ $proText = $purchase->getProText();
4
+ ?>
5
+ <i><h2>Woo Discount Rules <?php echo $proText; ?> <span class="woo-discount-version">v<?php echo WOO_DISCOUNT_VERSION; ?></span></h2></i>
6
  <hr>
7
  <h3 class="nav-tab-wrapper">
8
  <a class="nav-tab general_tab" href=javascript:void(0)>
view/pricing-rules.php CHANGED
@@ -57,7 +57,7 @@ $rule_list = $config;
57
  <div class="row">
58
  <div class="col-md-4">
59
  <?php if (isset($rule_list)) {
60
- if (count($rule_list) >= 3) { ?>
61
  <a href=javascript:void(0) class="button button-secondary">You Reach Max. Rule
62
  Limit</a>
63
  <?php } else {
57
  <div class="row">
58
  <div class="col-md-4">
59
  <?php if (isset($rule_list)) {
60
+ if (count($rule_list) >= 3 && !$pro) { ?>
61
  <a href=javascript:void(0) class="button button-secondary">You Reach Max. Rule
62
  Limit</a>
63
  <?php } else {
woo-discount-rules.php CHANGED
@@ -5,11 +5,12 @@
5
  * Description: Simple Discount Rules for WooCommerce.
6
  * Author: Flycart Technologies LLP
7
  * Author URI: https://www.flycart.org
8
- * Version: 1.4.3
9
  * Requires at least: 4.6.1
10
  */
11
 
12
  if (!defined('ABSPATH')) exit; // Exit if accessed directly
13
 
14
  include_once('helper/activation-helper.php');
 
15
  include_once('loader.php');
5
  * Description: Simple Discount Rules for WooCommerce.
6
  * Author: Flycart Technologies LLP
7
  * Author URI: https://www.flycart.org
8
+ * Version: 1.4.4
9
  * Requires at least: 4.6.1
10
  */
11
 
12
  if (!defined('ABSPATH')) exit; // Exit if accessed directly
13
 
14
  include_once('helper/activation-helper.php');
15
+
16
  include_once('loader.php');