Discount Rules for WooCommerce - Version 2.2.0

Version Description

  • 02/09/20 =
  • Fix - Security checks improved.
  • Fix - Taxonomy not listed in sale page.
  • Improvement - Front end script improved.
  • Improvement - Disable BXGY auto add when product not in stock.
Download this release

Release Info

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

Code changes from version 2.1.2 to 2.2.0

Files changed (72) hide show
  1. common.php +3 -0
  2. i18n/languages/woo-discount-rules.pot +293 -282
  3. readme.txt +7 -1
  4. v1/assets/js/app.js +17 -8
  5. v1/helper/general-helper.php +57 -0
  6. v1/helper/purchase.php +22 -17
  7. v1/includes/discount-base.php +214 -149
  8. v1/includes/pricing-rules.php +28 -22
  9. v1/view/cart-rules.php +1 -0
  10. v1/view/pricing-rules.php +1 -0
  11. v1/view/settings.php +1 -0
  12. v1/view/view-cart-rules.php +2 -0
  13. v1/view/view-pricing-rules.php +2 -0
  14. v2/App/Controllers/Admin/Tabs/Compatible.php +12 -4
  15. v2/App/Controllers/Admin/Tabs/DiscountRules.php +5 -1
  16. v2/App/Controllers/Admin/Tabs/Statistics.php +5 -0
  17. v2/App/Controllers/Admin/WDRAjax.php +49 -36
  18. v2/App/Controllers/ManageDiscount.php +16 -14
  19. v2/App/Controllers/OnSaleShortCode.php +8 -6
  20. v2/App/Helpers/Helper.php +129 -68
  21. v2/App/Helpers/Rule.php +38 -1
  22. v2/App/Helpers/Validation.php +451 -0
  23. v2/App/Helpers/Woocommerce.php +15 -0
  24. v2/App/Models/DBTable.php +6 -3
  25. v2/App/Router.php +2 -2
  26. v2/App/Views/Admin/Rules/Discounts/Cart.php +3 -3
  27. v2/App/Views/Admin/Rules/Manage.php +207 -202
  28. v2/App/Views/Admin/Tabs/ImportExport.php +125 -112
  29. v2/App/Views/Admin/Tabs/settings.php +15 -15
  30. v2/App/Views/Templates/discount_table.php +3 -0
  31. v2/Assets/Js/admin_script.js +396 -356
  32. v2/Assets/Js/site_main.js +52 -50
  33. v2/composer.json +3 -1
  34. v2/vendor/composer/autoload_psr4.php +1 -0
  35. v2/vendor/composer/autoload_static.php +8 -0
  36. v2/vendor/composer/installed.json +59 -1
  37. v2/vendor/vlucas/valitron/LICENSE.txt +32 -0
  38. v2/vendor/vlucas/valitron/lang/ar.php +29 -0
  39. v2/vendor/vlucas/valitron/lang/az.php +35 -0
  40. v2/vendor/vlucas/valitron/lang/bg.php +35 -0
  41. v2/vendor/vlucas/valitron/lang/de.php +34 -0
  42. v2/vendor/vlucas/valitron/lang/el.php +35 -0
  43. v2/vendor/vlucas/valitron/lang/en.php +42 -0
  44. v2/vendor/vlucas/valitron/lang/es.php +37 -0
  45. v2/vendor/vlucas/valitron/lang/fi.php +35 -0
  46. v2/vendor/vlucas/valitron/lang/fr.php +40 -0
  47. v2/vendor/vlucas/valitron/lang/id.php +34 -0
  48. v2/vendor/vlucas/valitron/lang/it.php +35 -0
  49. v2/vendor/vlucas/valitron/lang/ja.php +35 -0
  50. v2/vendor/vlucas/valitron/lang/ko.php +35 -0
  51. v2/vendor/vlucas/valitron/lang/lt.php +38 -0
  52. v2/vendor/vlucas/valitron/lang/lv.php +32 -0
  53. v2/vendor/vlucas/valitron/lang/nb.php +39 -0
  54. v2/vendor/vlucas/valitron/lang/nl.php +35 -0
  55. v2/vendor/vlucas/valitron/lang/nn.php +35 -0
  56. v2/vendor/vlucas/valitron/lang/no.php +3 -0
  57. v2/vendor/vlucas/valitron/lang/pl.php +35 -0
  58. v2/vendor/vlucas/valitron/lang/pt-br.php +37 -0
  59. v2/vendor/vlucas/valitron/lang/ro.php +35 -0
  60. v2/vendor/vlucas/valitron/lang/ru.php +39 -0
  61. v2/vendor/vlucas/valitron/lang/sk.php +35 -0
  62. v2/vendor/vlucas/valitron/lang/sl.php +42 -0
  63. v2/vendor/vlucas/valitron/lang/sv.php +35 -0
  64. v2/vendor/vlucas/valitron/lang/th.php +35 -0
  65. v2/vendor/vlucas/valitron/lang/tr.php +35 -0
  66. v2/vendor/vlucas/valitron/lang/uk.php +34 -0
  67. v2/vendor/vlucas/valitron/lang/vi.php +35 -0
  68. v2/vendor/vlucas/valitron/lang/zh-cn.php +34 -0
  69. v2/vendor/vlucas/valitron/lang/zh-tw.php +29 -0
  70. v2/vendor/vlucas/valitron/phpunit.xml +26 -0
  71. v2/vendor/vlucas/valitron/src/Valitron/Validator.php +1561 -0
  72. woo-discount-rules.php +13 -21
common.php CHANGED
@@ -36,6 +36,9 @@ add_action('wp_ajax_awdr_switch_version', function (){
36
  }
37
  }
38
  if($do_switch){
 
 
 
39
  $return['status'] = true;
40
  $return['message'] = '';
41
  $return['url'] = $url;
36
  }
37
  }
38
  if($do_switch){
39
+ if(in_array($version, array('v1', 'v2'))){
40
+ update_option('advanced_woo_discount_rules_load_version', $version);
41
+ }
42
  $return['status'] = true;
43
  $return['message'] = '';
44
  $return['url'] = $url;
i18n/languages/woo-discount-rules.pot CHANGED
@@ -12,8 +12,9 @@ msgstr ""
12
  "X-Generator: Loco https://localise.biz/\n"
13
  "Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;"
14
 
15
- #: common.php:9 v2/App/Controllers/Admin/Tabs/Statistics.php:113
16
  #: v2/App/Controllers/Admin/WDRAjax.php:51
 
17
  msgid "Authentication required"
18
  msgstr ""
19
 
@@ -125,15 +126,15 @@ msgstr ""
125
 
126
  #: updater.php:142 updater.php:307 v1/helper/purchase.php:62
127
  #: v1/helper/purchase.php:66 v1/helper/purchase.php:134
128
- #: v1/helper/purchase.php:137 v1/helper/purchase.php:173
129
  msgid "Please enter a valid license key"
130
  msgstr ""
131
 
132
- #: updater.php:145 v1/helper/purchase.php:182
133
  msgid "License key check : Passed."
134
  msgstr ""
135
 
136
- #: updater.php:147 v1/helper/purchase.php:186 v1/view/settings_general.php:32
137
  msgid "License key seems to be Invalid. Please enter a valid license key"
138
  msgstr ""
139
 
@@ -182,13 +183,13 @@ msgstr ""
182
 
183
  #: v1/helper/general-helper.php:797
184
  #: v2/App/Views/Admin/Rules/Conditions/Main.php:10
185
- #: v2/App/Views/Admin/Rules/Manage.php:131
186
- #: v2/App/Views/Admin/Rules/Manage.php:132
187
- #: v2/App/Views/Admin/Rules/Manage.php:133
188
  #: v2/App/Views/Admin/Rules/Manage.php:134
189
  #: v2/App/Views/Admin/Rules/Manage.php:135
190
  #: v2/App/Views/Admin/Rules/Manage.php:136
191
  #: v2/App/Views/Admin/Rules/Manage.php:137
 
 
 
192
  #: v2/App/Views/Admin/Tabs/settings.php:24
193
  #: v2/App/Views/Admin/Tabs/settings.php:64
194
  #: v2/App/Views/Admin/Tabs/settings.php:121
@@ -204,6 +205,10 @@ msgstr ""
204
  msgid "Coupon already exists in WooCommerce. Please select another name"
205
  msgstr ""
206
 
 
 
 
 
207
  #: v1/helper/purchase.php:25 v1/view/includes/cart-menu.php:5
208
  #: v1/view/includes/menu.php:6 v1/view/includes/sub-menu.php:5
209
  #: v2/App/Controllers/Admin/Settings.php:40
@@ -271,7 +276,7 @@ msgid "Free Shipping"
271
  msgstr ""
272
 
273
  #: v1/includes/advanced/free_shipping_method.php:73
274
- #: v1/includes/discount-base.php:1063 v1/view/cart-rules.php:133
275
  #: v1/view/pricing-rules.php:163 v1/view/settings_promotion.php:65
276
  #: v1/view/settings_promotion.php:100 v2/App/Controllers/Admin/Settings.php:418
277
  #: v2/App/Views/Admin/Tabs/DiscountRule.php:77
@@ -300,12 +305,12 @@ msgstr ""
300
  msgid "Failed to save"
301
  msgstr ""
302
 
303
- #: v1/includes/discount-base.php:203 v1/view/cart-rules.php:162
304
  #: v1/view/pricing-rules.php:192 v2/App/Controllers/Admin/Settings.php:417
305
  msgid "Active"
306
  msgstr ""
307
 
308
- #: v1/includes/discount-base.php:205 v1/view/cart-rules.php:164
309
  #: v1/view/pricing-rules.php:194 v1/view/settings_cart_rules.php:95
310
  #: v1/view/settings_cart_rules.php:102 v1/view/settings_price_rules.php:169
311
  #: v1/view/settings_promotion.php:22 v1/view/settings_promotion.php:62
@@ -315,432 +320,432 @@ msgstr ""
315
  msgid "Disabled"
316
  msgstr ""
317
 
318
- #: v1/includes/discount-base.php:522
319
  msgid "Cache cleared successfully"
320
  msgstr ""
321
 
322
- #: v1/includes/discount-base.php:524
323
  msgid "Failed to clear cache"
324
  msgstr ""
325
 
326
- #: v1/includes/discount-base.php:635 v1/includes/discount-base.php:670
327
  msgid "Failed to do action"
328
  msgstr ""
329
 
330
- #: v1/includes/discount-base.php:674
331
  msgid "Disabled successfully"
332
  msgstr ""
333
 
334
- #: v1/includes/discount-base.php:677
335
  msgid "Deleted successfully"
336
  msgstr ""
337
 
338
- #: v1/includes/discount-base.php:680
339
  msgid "Enabled successfully"
340
  msgstr ""
341
 
342
- #: v1/includes/discount-base.php:700 v1/includes/discount-base.php:701
343
- #: v1/includes/discount-base.php:718
344
  msgid "copy"
345
  msgstr ""
346
 
347
- #: v1/includes/discount-base.php:726
348
  msgid "Duplicate rule created successfully"
349
  msgstr ""
350
 
351
- #: v1/includes/discount-base.php:730
352
  msgid "Failed to create duplicate rule"
353
  msgstr ""
354
 
355
- #: v1/includes/discount-base.php:1017
356
  msgid "Please fill this field"
357
  msgstr ""
358
 
359
- #: v1/includes/discount-base.php:1018
360
  msgid "Please Enter the Rule Name to Create / Save."
361
  msgstr ""
362
 
363
- #: v1/includes/discount-base.php:1019
364
  msgid "Saving..."
365
  msgstr ""
366
 
367
- #: v1/includes/discount-base.php:1020 v1/view/view-cart-rules.php:55
368
  #: v1/view/view-pricing-rules.php:37
369
  msgid "Save Rule"
370
  msgstr ""
371
 
372
- #: v1/includes/discount-base.php:1021
373
  msgid "Please enter a Key"
374
  msgstr ""
375
 
376
- #: v1/includes/discount-base.php:1022 v1/view/view-pricing-rules.php:739
377
  msgid "Min Quantity"
378
  msgstr ""
379
 
380
- #: v1/includes/discount-base.php:1023 v1/view/view-pricing-rules.php:746
381
  msgid "Max Quantity"
382
  msgstr ""
383
 
384
- #: v1/includes/discount-base.php:1024 v1/view/view-pricing-rules.php:654
385
  #: v1/view/view-pricing-rules.php:657 v1/view/view-pricing-rules.php:677
386
  #: v2/App/Controllers/Admin/Settings.php:435
387
  msgid "Quantity"
388
  msgstr ""
389
 
390
- #: v1/includes/discount-base.php:1025 v1/view/view-cart-rules.php:92
391
  #: v1/view/view-pricing-rules.php:74 v1/view/view-pricing-rules.php:744
392
  #: v1/view/view-pricing-rules.php:897 v1/view/view-pricing-rules.php:920
393
  #: v1/view/view-pricing-rules.php:927
394
  msgid "ex. 1"
395
  msgstr ""
396
 
397
- #: v1/includes/discount-base.php:1026 v1/view/view-pricing-rules.php:965
398
  msgid "ex. 10"
399
  msgstr ""
400
 
401
- #: v1/includes/discount-base.php:1027 v1/view/view-pricing-rules.php:751
402
  #: v1/view/view-pricing-rules.php:879
403
  msgid "ex. 50"
404
  msgstr ""
405
 
406
- #: v1/includes/discount-base.php:1028
407
  msgid "Search for a user"
408
  msgstr ""
409
 
410
- #: v1/includes/discount-base.php:1029 v1/view/view-pricing-rules.php:752
411
  msgid "Adjustment Type"
412
  msgstr ""
413
 
414
- #: v1/includes/discount-base.php:1030 v1/view/view-pricing-rules.php:954
415
  #: v2/App/Controllers/Admin/Settings.php:438
416
  msgid "Discount percentage"
417
  msgstr ""
418
 
419
- #: v1/includes/discount-base.php:1031 v1/view/view-cart-rules.php:776
420
  #: v1/view/view-pricing-rules.php:786
421
  msgid "Percentage Discount"
422
  msgstr ""
423
 
424
- #: v1/includes/discount-base.php:1032 v1/view/view-cart-rules.php:782
425
  #: v1/view/view-cart-rules.php:784 v1/view/view-pricing-rules.php:794
426
  #: v1/view/view-pricing-rules.php:796
427
  msgid "Price Discount"
428
  msgstr ""
429
 
430
- #: v1/includes/discount-base.php:1033
431
  msgid "BOGO Product Discount"
432
  msgstr ""
433
 
434
- #: v1/includes/discount-base.php:1034
435
  msgid "Product Discount - Not support for subtotal based rule"
436
  msgstr ""
437
 
438
- #: v1/includes/discount-base.php:1035 v1/view/view-cart-rules.php:462
439
  #: v1/view/view-pricing-rules.php:874 v1/view/view-pricing-rules.php:1014
440
  #: v2/App/Views/Admin/Rules/Discounts/Cart.php:33
441
  #: v2/App/Views/Admin/Rules/Discounts/simple.php:31
442
  msgid "Value"
443
  msgstr ""
444
 
445
- #: v1/includes/discount-base.php:1036 v1/view/view-pricing-rules.php:882
446
  msgid "receive discount for"
447
  msgstr ""
448
 
449
- #: v1/includes/discount-base.php:1037 v1/view/view-pricing-rules.php:884
450
  msgid "Auto add all selected products"
451
  msgstr ""
452
 
453
- #: v1/includes/discount-base.php:1038 v1/view/view-pricing-rules.php:885
454
  msgid "Same product"
455
  msgstr ""
456
 
457
- #: v1/includes/discount-base.php:1039
458
  msgid "Any one cheapest from selected"
459
  msgstr ""
460
 
461
- #: v1/includes/discount-base.php:1040
462
  msgid "Any one cheapest from all products"
463
  msgstr ""
464
 
465
- #: v1/includes/discount-base.php:1041 v1/view/view-pricing-rules.php:854
466
  #: v1/view/view-pricing-rules.php:856
467
  msgid "Buy X Get Y - Selected Categories (Cheapest in cart)"
468
  msgstr ""
469
 
470
- #: v1/includes/discount-base.php:1042 v1/view/view-pricing-rules.php:844
471
  #: v1/view/view-pricing-rules.php:846
472
  msgid "Buy X Get Y - Selected item(s) (Cheapest in cart)"
473
  msgstr ""
474
 
475
- #: v1/includes/discount-base.php:1043 v1/view/view-pricing-rules.php:864
476
  #: v1/view/view-pricing-rules.php:866
477
  msgid "Buy X get Y - Cheapest among all items in cart"
478
  msgstr ""
479
 
480
- #: v1/includes/discount-base.php:1044 v1/view/view-pricing-rules.php:892
481
  msgid "Free quantity"
482
  msgstr ""
483
 
484
- #: v1/includes/discount-base.php:1045 v1/view/view-pricing-rules.php:892
485
  msgid "Number of quantity(ies) in each selected product(s)"
486
  msgstr ""
487
 
488
- #: v1/includes/discount-base.php:1046 v1/view/view-pricing-rules.php:912
489
  msgid "Fixed item count (not recommended)"
490
  msgstr ""
491
 
492
- #: v1/includes/discount-base.php:1047 v1/view/view-pricing-rules.php:911
493
  msgid "Dynamic item count"
494
  msgstr ""
495
 
496
- #: v1/includes/discount-base.php:1048 v1/view/view-pricing-rules.php:914
497
  msgid ""
498
  "Fixed item count - You need to provide item count manually. Dynamic item "
499
  "count - System will choose dynamically based on cart"
500
  msgstr ""
501
 
502
- #: v1/includes/discount-base.php:1049 v1/view/view-pricing-rules.php:915
503
  msgid "Item count"
504
  msgstr ""
505
 
506
- #: v1/includes/discount-base.php:1050 v1/view/view-pricing-rules.php:915
507
  msgid "Discount for number of item(s) in cart"
508
  msgstr ""
509
 
510
- #: v1/includes/discount-base.php:1051 v1/view/view-pricing-rules.php:922
511
  msgid "Discount for number of quantity(ies)"
512
  msgstr ""
513
 
514
- #: v1/includes/discount-base.php:1052 v1/view/view-pricing-rules.php:922
515
  msgid "Item quantity"
516
  msgstr ""
517
 
518
- #: v1/includes/discount-base.php:1053
519
  msgid "Search for a products"
520
  msgstr ""
521
 
522
- #: v1/includes/discount-base.php:1054
523
  msgid "and"
524
  msgstr ""
525
 
526
- #: v1/includes/discount-base.php:1055 v1/view/view-pricing-rules.php:956
527
  msgid "100% percent"
528
  msgstr ""
529
 
530
- #: v1/includes/discount-base.php:1056 v1/view/view-pricing-rules.php:957
531
  msgid "Limited percent"
532
  msgstr ""
533
 
534
- #: v1/includes/discount-base.php:1057
535
  msgid "Percentage"
536
  msgstr ""
537
 
538
- #: v1/includes/discount-base.php:1058
539
  msgid "as discount"
540
  msgstr ""
541
 
542
- #: v1/includes/discount-base.php:1059 v1/view/view-cart-rules.php:701
543
  #: v1/view/view-pricing-rules.php:974
544
  msgid "Remove"
545
  msgstr ""
546
 
547
- #: v1/includes/discount-base.php:1060 v1/view/cart-rules.php:185
548
  #: v1/view/pricing-rules.php:215 v1/view/view-pricing-rules.php:971
549
  #: v2/App/Views/Admin/Tabs/DiscountRule.php:304
550
  msgid "Duplicate"
551
  msgstr ""
552
 
553
- #: v1/includes/discount-base.php:1061
554
  msgid "none"
555
  msgstr ""
556
 
557
- #: v1/includes/discount-base.php:1062
558
  msgid "Are you sure to remove this ?"
559
  msgstr ""
560
 
561
- #: v1/includes/discount-base.php:1064 v1/view/cart-rules.php:130
562
  #: v1/view/pricing-rules.php:160 v2/App/Controllers/Admin/Settings.php:416
563
  #: v2/App/Views/Admin/Tabs/DiscountRule.php:78
564
  msgid "Disable"
565
  msgstr ""
566
 
567
- #: v1/includes/discount-base.php:1065
568
  msgid "Are you sure to remove ?"
569
  msgstr ""
570
 
571
- #: v1/includes/discount-base.php:1066 v1/view/view-cart-rules.php:172
572
  msgid "Type"
573
  msgstr ""
574
 
575
- #: v1/includes/discount-base.php:1067 v1/view/view-cart-rules.php:176
576
  msgid "Cart Subtotal"
577
  msgstr ""
578
 
579
- #: v1/includes/discount-base.php:1068 v1/view/view-cart-rules.php:179
580
  msgid "Subtotal at least"
581
  msgstr ""
582
 
583
- #: v1/includes/discount-base.php:1069 v1/view/view-cart-rules.php:183
584
  msgid "Subtotal less than"
585
  msgstr ""
586
 
587
- #: v1/includes/discount-base.php:1070 v1/view/view-cart-rules.php:186
588
  msgid "Cart Item Count"
589
  msgstr ""
590
 
591
- #: v1/includes/discount-base.php:1071 v1/view/view-cart-rules.php:189
592
  msgid "Number of line items in the cart (not quantity) at least"
593
  msgstr ""
594
 
595
- #: v1/includes/discount-base.php:1072 v1/view/view-cart-rules.php:193
596
  msgid "Number of line items in the cart (not quantity) less than"
597
  msgstr ""
598
 
599
- #: v1/includes/discount-base.php:1073 v1/view/view-cart-rules.php:196
600
  msgid "Quantity Sum"
601
  msgstr ""
602
 
603
- #: v1/includes/discount-base.php:1074 v1/view/view-cart-rules.php:202
604
  #: v1/view/view-cart-rules.php:205
605
  msgid "Total number of quantities in the cart at least"
606
  msgstr ""
607
 
608
- #: v1/includes/discount-base.php:1075 v1/view/view-cart-rules.php:214
609
  #: v1/view/view-cart-rules.php:217
610
  msgid "Total number of quantities in the cart less than"
611
  msgstr ""
612
 
613
- #: v1/includes/discount-base.php:1076 v1/view/view-cart-rules.php:246
614
  msgid "Categories in cart"
615
  msgstr ""
616
 
617
- #: v1/includes/discount-base.php:1077 v1/view/view-cart-rules.php:252
618
  msgid "Including sub-categories in cart"
619
  msgstr ""
620
 
621
- #: v1/includes/discount-base.php:1078 v1/view/view-cart-rules.php:267
622
  msgid "Customer Details (must be logged in)"
623
  msgstr ""
624
 
625
- #: v1/includes/discount-base.php:1079 v1/view/view-cart-rules.php:273
626
  #: v1/view/view-cart-rules.php:275
627
  msgid "User in list"
628
  msgstr ""
629
 
630
- #: v1/includes/discount-base.php:1080 v1/view/view-cart-rules.php:283
631
  #: v1/view/view-cart-rules.php:285
632
  msgid "User role in list"
633
  msgstr ""
634
 
635
- #: v1/includes/discount-base.php:1081 v1/view/view-cart-rules.php:349
636
  #: v1/view/view-cart-rules.php:351
637
  msgid "Shipping country in list"
638
  msgstr ""
639
 
640
- #: v1/includes/discount-base.php:1082 v1/view/view-cart-rules.php:289
641
  msgid "Customer Email"
642
  msgstr ""
643
 
644
- #: v1/includes/discount-base.php:1083
645
  msgid "Email with TLD (Ege: edu)"
646
  msgstr ""
647
 
648
- #: v1/includes/discount-base.php:1084 v1/view/view-cart-rules.php:305
649
  #: v1/view/view-cart-rules.php:307
650
  msgid "Email with Domain (Eg: gmail.com)"
651
  msgstr ""
652
 
653
- #: v1/includes/discount-base.php:1085 v1/view/view-cart-rules.php:311
654
  msgid "Customer Billing Details"
655
  msgstr ""
656
 
657
- #: v1/includes/discount-base.php:1086 v1/view/view-cart-rules.php:317
658
  #: v1/view/view-cart-rules.php:319
659
  msgid "Billing city"
660
  msgstr ""
661
 
662
- #: v1/includes/discount-base.php:1087 v1/view/view-cart-rules.php:323
663
  msgid "Customer Shipping Details"
664
  msgstr ""
665
 
666
- #: v1/includes/discount-base.php:1088 v1/view/view-cart-rules.php:339
667
  #: v1/view/view-cart-rules.php:341
668
  msgid "Shipping state"
669
  msgstr ""
670
 
671
- #: v1/includes/discount-base.php:1089 v1/view/view-cart-rules.php:329
672
  #: v1/view/view-cart-rules.php:331
673
  msgid "Shipping city"
674
  msgstr ""
675
 
676
- #: v1/includes/discount-base.php:1090 v1/view/view-cart-rules.php:359
677
  #: v1/view/view-cart-rules.php:361
678
  msgid "Shipping zip code"
679
  msgstr ""
680
 
681
- #: v1/includes/discount-base.php:1091 v1/view/view-cart-rules.php:365
682
- #: v1/view/view-pricing-rules.php:536 v2/App/Helpers/Helper.php:156
683
  #: v2/App/Helpers/ProOptions.php:192 v2/App/Helpers/ProOptions.php:200
684
  #: v2/App/Helpers/ProOptions.php:208 v2/App/Helpers/ProOptions.php:216
685
  #: v2/App/Helpers/ProOptions.php:224 v2/App/Helpers/ProOptions.php:232
686
  msgid "Purchase History"
687
  msgstr ""
688
 
689
- #: v1/includes/discount-base.php:1092 v1/view/view-cart-rules.php:381
690
  #: v1/view/view-cart-rules.php:383 v1/view/view-pricing-rules.php:551
691
  msgid "Purchased amount"
692
  msgstr ""
693
 
694
- #: v1/includes/discount-base.php:1093 v1/view/view-cart-rules.php:391
695
  #: v1/view/view-cart-rules.php:393 v1/view/view-pricing-rules.php:552
696
  msgid "Number of previous orders made"
697
  msgstr ""
698
 
699
- #: v1/includes/discount-base.php:1094 v1/view/view-cart-rules.php:401
700
  #: v1/view/view-cart-rules.php:403 v1/view/view-pricing-rules.php:553
701
  msgid "Number of previous orders made with following products"
702
  msgstr ""
703
 
704
- #: v1/includes/discount-base.php:1095 v1/view/view-cart-rules.php:411
705
  #: v1/view/view-cart-rules.php:413 v1/view/view-pricing-rules.php:554
706
  msgid "Number of quantity(s) in previous orders made with following products"
707
  msgstr ""
708
 
709
- #: v1/includes/discount-base.php:1096 v1/view/view-cart-rules.php:417
710
  msgid "Coupon applied"
711
  msgstr ""
712
 
713
- #: v1/includes/discount-base.php:1097 v1/view/view-cart-rules.php:423
714
  #: v1/view/view-cart-rules.php:425 v1/view/view-pricing-rules.php:410
715
  msgid "Create your own coupon"
716
  msgstr ""
717
 
718
- #: v1/includes/discount-base.php:1098 v1/view/view-cart-rules.php:433
719
  #: v1/view/view-cart-rules.php:435
720
  msgid "Atleast any one (Select from WooCommerce)"
721
  msgstr ""
722
 
723
- #: v1/includes/discount-base.php:1099 v1/view/view-cart-rules.php:443
724
  #: v1/view/view-cart-rules.php:445
725
  msgid "All selected (Select from WooCommerce)"
726
  msgstr ""
727
 
728
- #: v1/includes/discount-base.php:1100 v1/view/view-cart-rules.php:647
729
  #: v1/view/view-pricing-rules.php:590
730
  msgid "Greater than or equal to"
731
  msgstr ""
732
 
733
- #: v1/includes/discount-base.php:1101 v1/view/view-cart-rules.php:648
734
  #: v1/view/view-pricing-rules.php:591 v1/view/view-pricing-rules.php:650
735
  msgid "Less than or equal to"
736
  msgstr ""
737
 
738
- #: v1/includes/discount-base.php:1102 v1/view/view-cart-rules.php:650
739
  #: v1/view/view-pricing-rules.php:594
740
  msgid "and the order status should be"
741
  msgstr ""
742
 
743
- #: v1/includes/discount-base.php:1103 v1/view/cart-rules.php:114
744
  #: v1/view/cart-rules.php:224 v1/view/pricing-rules.php:144
745
  #: v1/view/pricing-rules.php:254 v1/view/view-cart-rules.php:700
746
  #: v2/App/Views/Admin/Tabs/DiscountRule.php:129
@@ -748,16 +753,16 @@ msgstr ""
748
  msgid "Action"
749
  msgstr ""
750
 
751
- #: v1/includes/discount-base.php:1104 v1/view/settings.php:33
752
- #: v1/view/settings_taxonomy.php:21 v2/App/Views/Admin/Rules/Manage.php:84
753
  msgid "Save"
754
  msgstr ""
755
 
756
- #: v1/includes/discount-base.php:1105
757
  msgid "Saved Successfully!"
758
  msgstr ""
759
 
760
- #: v1/includes/discount-base.php:1106 v1/view/view-cart-rules.php:491
761
  #: v1/view/view-cart-rules.php:559 v1/view/view-cart-rules.php:579
762
  #: v1/view/view-cart-rules.php:600 v1/view/view-cart-rules.php:655
763
  #: v1/view/view-pricing-rules.php:238 v1/view/view-pricing-rules.php:254
@@ -766,68 +771,68 @@ msgstr ""
766
  msgid "None selected"
767
  msgstr ""
768
 
769
- #: v1/includes/discount-base.php:1107 v1/view/view-cart-rules.php:258
770
  msgid "In each category"
771
  msgstr ""
772
 
773
- #: v1/includes/discount-base.php:1108 v1/view/settings_price_rules.php:208
774
  #: v1/view/settings_price_rules.php:226 v1/view/settings_price_rules.php:244
775
  #: v1/view/settings_price_rules.php:262
776
  #: v2/App/Views/Admin/Tabs/settings.php:533
777
  msgid "Show"
778
  msgstr ""
779
 
780
- #: v1/includes/discount-base.php:1109 v1/view/template/sidebar.php:12
781
  msgid "Hide"
782
  msgstr ""
783
 
784
- #: v1/includes/discount-base.php:1110
785
  msgid "Please select at least one rule"
786
  msgstr ""
787
 
788
- #: v1/includes/discount-base.php:1111
789
  msgid "Please select an action to apply"
790
  msgstr ""
791
 
792
- #: v1/includes/discount-base.php:1112
793
  msgid "Are you sure to remove the selected rules"
794
  msgstr ""
795
 
796
- #: v1/includes/discount-base.php:1113 v1/view/view-pricing-rules.php:931
797
  msgid "Choose product(s)"
798
  msgstr ""
799
 
800
- #: v1/includes/discount-base.php:1114 v1/view/view-pricing-rules.php:941
801
  msgid "Choose category(ies)"
802
  msgstr ""
803
 
804
- #: v1/includes/discount-base.php:1115
805
  msgid "Search for a coupon"
806
  msgstr ""
807
 
808
- #: v1/includes/discount-base.php:1116 v1/view/view-pricing-rules.php:965
809
  #, php-format
810
  msgid "Enter only numeric values. Eg: <b>50</b> for 50% discount"
811
  msgstr ""
812
 
813
- #: v1/includes/discount-base.php:1117
814
  #, php-format
815
  msgid "Enter the discount price. Eg: <b>10</b> for %s discount"
816
  msgstr ""
817
 
818
- #: v1/includes/discount-base.php:1118
819
  #, php-format
820
  msgid "Enter the discounted price per unit. Eg: <b>10</b> for %s as unit price"
821
  msgstr ""
822
 
823
- #: v1/includes/discount-base.php:1119
824
  #, php-format
825
  msgid ""
826
  "Enter the price for selected quantity. Eg: <b>10</b> then %s as total price "
827
  "for selected quantity"
828
  msgstr ""
829
 
830
- #: v1/includes/discount-base.php:1120 v1/view/view-pricing-rules.php:890
831
  msgid ""
832
  "Auto add all selected products - Automatically added to the cart <br> Same "
833
  "product - get discount in same product <br> Any one cheapest from selected - "
@@ -838,122 +843,122 @@ msgid ""
838
  "no.of quantities"
839
  msgstr ""
840
 
841
- #: v1/includes/discount-base.php:1121 v1/view/view-cart-rules.php:221
842
  #: v2/App/Controllers/Base.php:47
843
  msgid "Products"
844
  msgstr ""
845
 
846
- #: v1/includes/discount-base.php:1122 v1/view/view-cart-rules.php:226
847
  msgid "Products in cart"
848
  msgstr ""
849
 
850
- #: v1/includes/discount-base.php:1123 v1/view/view-cart-rules.php:232
851
  #: v1/view/view-pricing-rules.php:273
852
  msgid "Exclude products"
853
  msgstr ""
854
 
855
- #: v1/includes/discount-base.php:1124 v1/view/view-cart-rules.php:238
856
  msgid "Exclude on sale products"
857
  msgstr ""
858
 
859
- #: v1/includes/discount-base.php:1125 v1/view/view-cart-rules.php:529
860
  msgid "This will exclude the on sale products from discount"
861
  msgstr ""
862
 
863
- #: v1/includes/discount-base.php:1126 v1/view/view-cart-rules.php:663
864
  #: v1/view/view-pricing-rules.php:609
865
  msgid "From all previous orders"
866
  msgstr ""
867
 
868
- #: v1/includes/discount-base.php:1127 v1/view/view-cart-rules.php:664
869
  #: v1/view/view-pricing-rules.php:610
870
  msgid "Last 7 days"
871
  msgstr ""
872
 
873
- #: v1/includes/discount-base.php:1128 v1/view/view-cart-rules.php:665
874
  #: v1/view/view-pricing-rules.php:611
875
  msgid "Last 14 days"
876
  msgstr ""
877
 
878
- #: v1/includes/discount-base.php:1129 v1/view/view-cart-rules.php:666
879
  #: v1/view/view-pricing-rules.php:612
880
  msgid "Last 30 days"
881
  msgstr ""
882
 
883
- #: v1/includes/discount-base.php:1130 v1/view/view-cart-rules.php:667
884
  #: v1/view/view-pricing-rules.php:613
885
  msgid "Last 60 days"
886
  msgstr ""
887
 
888
- #: v1/includes/discount-base.php:1131 v1/view/view-cart-rules.php:668
889
  #: v1/view/view-pricing-rules.php:614
890
  msgid "Last 90 days"
891
  msgstr ""
892
 
893
- #: v1/includes/discount-base.php:1132 v1/view/view-cart-rules.php:669
894
  #: v1/view/view-pricing-rules.php:615
895
  msgid "Last 180 days"
896
  msgstr ""
897
 
898
- #: v1/includes/discount-base.php:1133 v1/view/view-cart-rules.php:670
899
  #: v1/view/view-pricing-rules.php:616
900
  msgid "Last 1 year"
901
  msgstr ""
902
 
903
- #: v1/includes/discount-base.php:1134 v1/view/view-cart-rules.php:671
904
  #: v1/view/view-pricing-rules.php:617
905
  msgid "Custom"
906
  msgstr ""
907
 
908
- #: v1/includes/discount-base.php:1135 v1/view/view-cart-rules.php:674
909
  #: v1/view/view-pricing-rules.php:621
910
  msgid "in days"
911
  msgstr ""
912
 
913
- #: v1/includes/discount-base.php:1136 v1/view/view-pricing-rules.php:804
914
  #: v1/view/view-pricing-rules.php:806
915
  msgid "Fixed Price Per Unit"
916
  msgstr ""
917
 
918
- #: v1/includes/discount-base.php:1137 v1/view/view-pricing-rules.php:814
919
  #: v1/view/view-pricing-rules.php:816
920
  msgid "Bundle (Set) Discount"
921
  msgstr ""
922
 
923
- #: v1/includes/discount-base.php:1138 v1/view/view-cart-rules.php:371
924
  #: v1/view/view-cart-rules.php:373 v1/view/view-pricing-rules.php:550
925
  msgid "First Order discount"
926
  msgstr ""
927
 
928
- #: v1/includes/discount-base.php:1139 v1/view/view-cart-rules.php:264
929
  msgid "Exclude categories in cart"
930
  msgstr ""
931
 
932
- #: v1/includes/discount-base.php:1141 v1/view/view-pricing-rules.php:824
933
  #: v1/view/view-pricing-rules.php:826
934
  msgid "Buy X get X (Same product)"
935
  msgstr ""
936
 
937
- #: v1/includes/discount-base.php:1142 v1/view/view-pricing-rules.php:834
938
  #: v1/view/view-pricing-rules.php:836
939
  msgid "Buy X get Y (Auto add all selected products)"
940
  msgstr ""
941
 
942
- #: v1/includes/discount-base.php:1143
943
  #, php-format
944
  msgid ""
945
  "The customer gets the same product free (Buy 2 get 1 free) or a limited "
946
  "percentage (Buy 2 and get 1 at 50% discount)"
947
  msgstr ""
948
 
949
- #: v1/includes/discount-base.php:1144
950
  msgid ""
951
  "Provide a specific product free when purchasing another product."
952
  "<br><br>Example: Buy Product A and get Product B free. Product B will be "
953
  "automatically added to cart."
954
  msgstr ""
955
 
956
- #: v1/includes/discount-base.php:1145
957
  msgid ""
958
  "Provide a specific product free when purchasing another product."
959
  "<br><br>Instead of automatically adding, if you wish to choose the free "
@@ -961,7 +966,7 @@ msgid ""
961
  "discounted only when the user manually adds the product to cart."
962
  msgstr ""
963
 
964
- #: v1/includes/discount-base.php:1146
965
  msgid ""
966
  "Used to provide BOGO discount within categories.<br><br>Example 1: Buy 2 "
967
  "from Category A and get 1 free from the same Category A.<br>Example 2: Buy "
@@ -969,13 +974,13 @@ msgid ""
969
  "B."
970
  msgstr ""
971
 
972
- #: v1/includes/discount-base.php:1147
973
  msgid ""
974
  "This allows you to offer the cheapest product in cart for free (or at a "
975
  "limited percentage like 50%)"
976
  msgstr ""
977
 
978
- #: v1/includes/discount-base.php:1148
979
  #, php-format
980
  msgid ""
981
  "<span class=\"wdr_desc_text\">Useful for providing a discount on store wide "
@@ -983,7 +988,7 @@ msgid ""
983
  "\">Read docs</a>.</span>"
984
  msgstr ""
985
 
986
- #: v1/includes/discount-base.php:1149
987
  #, php-format
988
  msgid ""
989
  "<span class=\"wdr_desc_text\">Useful for providing a discount on selected "
@@ -993,7 +998,7 @@ msgid ""
993
  "\">Read docs</a>.</span>"
994
  msgstr ""
995
 
996
- #: v1/includes/discount-base.php:1150
997
  #, php-format
998
  msgid ""
999
  "<span class=\"wdr_desc_text\">Useful for providing a discount on a specific "
@@ -1002,7 +1007,7 @@ msgid ""
1002
  "<a href=\"%s\">Read docs</a>.</span>"
1003
  msgstr ""
1004
 
1005
- #: v1/includes/discount-base.php:1151
1006
  #, php-format
1007
  msgid ""
1008
  "<span class=\"wdr_desc_text\">Useful to offer discount based on attributes. "
@@ -1011,114 +1016,114 @@ msgid ""
1011
  "defined in WooCommerce -> Attributes. <a href=\"%s\">Read docs</a>.</span>"
1012
  msgstr ""
1013
 
1014
- #: v1/includes/discount-base.php:1237 v2/App/Controllers/ManageDiscount.php:847
1015
  #, php-format
1016
  msgid ""
1017
  "Sorry, it is not possible to apply coupon <b>\"%s\"</b> as you already have "
1018
  "a discount applied in cart."
1019
  msgstr ""
1020
 
1021
- #: v1/includes/discount-base.php:1292 v1/view/includes/menu.php:18
1022
  #: v2/App/Controllers/Admin/Settings.php:65
1023
  #: v2/App/Controllers/Admin/Tabs/GeneralSettings.php:23
1024
  msgid "Settings"
1025
  msgstr ""
1026
 
1027
- #: v1/includes/pricing-rules.php:3207 v1/view/view-pricing-rules.php:642
1028
  msgid "Buy"
1029
  msgstr ""
1030
 
1031
- #: v1/includes/pricing-rules.php:3211
1032
  msgid " less than or equal to "
1033
  msgstr ""
1034
 
1035
- #: v1/includes/pricing-rules.php:3211 v1/includes/pricing-rules.php:3217
1036
  msgid " Quantity"
1037
  msgstr ""
1038
 
1039
- #: v1/includes/pricing-rules.php:3214
1040
  msgid " Quantity "
1041
  msgstr ""
1042
 
1043
- #: v1/includes/pricing-rules.php:3221
1044
  msgid " or more Quantity"
1045
  msgstr ""
1046
 
1047
- #: v1/includes/pricing-rules.php:3230
1048
  msgid " any "
1049
  msgstr ""
1050
 
1051
- #: v1/includes/pricing-rules.php:3230
1052
  msgid " products from "
1053
  msgstr ""
1054
 
1055
- #: v1/includes/pricing-rules.php:3237
1056
  msgid " in each products"
1057
  msgstr ""
1058
 
1059
- #: v1/includes/pricing-rules.php:3249
1060
  msgid " and get discount on "
1061
  msgstr ""
1062
 
1063
- #: v1/includes/pricing-rules.php:3252
1064
  msgid " first "
1065
  msgstr ""
1066
 
1067
- #: v1/includes/pricing-rules.php:3254 v1/includes/pricing-rules.php:3258
1068
  msgid " quantity of product(s) - "
1069
  msgstr ""
1070
 
1071
- #: v1/includes/pricing-rules.php:3256
1072
  msgid " after first "
1073
  msgstr ""
1074
 
1075
- #: v1/includes/pricing-rules.php:3274
1076
  msgid "Category(ies) "
1077
  msgstr ""
1078
 
1079
- #: v1/includes/pricing-rules.php:3345
1080
  msgid "Get "
1081
  msgstr ""
1082
 
1083
- #: v1/includes/pricing-rules.php:3347
1084
  #, php-format
1085
  msgid "% discount in "
1086
  msgstr ""
1087
 
1088
- #: v1/includes/pricing-rules.php:3350
1089
  msgid "same product"
1090
  msgstr ""
1091
 
1092
- #: v1/includes/pricing-rules.php:3352
1093
  msgid "any cheapest one from cart"
1094
  msgstr ""
1095
 
1096
- #: v1/includes/pricing-rules.php:3355
1097
  msgid "any cheapest one of "
1098
  msgstr ""
1099
 
1100
- #: v1/includes/pricing-rules.php:3360
1101
  msgid " quantity of any "
1102
  msgstr ""
1103
 
1104
- #: v1/includes/pricing-rules.php:3362
1105
  msgid " cheapest item "
1106
  msgstr ""
1107
 
1108
- #: v1/includes/pricing-rules.php:3365
1109
  msgid " quantity of cheapest item "
1110
  msgstr ""
1111
 
1112
- #: v1/includes/pricing-rules.php:3369
1113
  msgid "from the category "
1114
  msgstr ""
1115
 
1116
- #: v1/includes/pricing-rules.php:3391
1117
  #, php-format
1118
  msgid "%s for %s Quantity(s)"
1119
  msgstr ""
1120
 
1121
- #: v1/includes/pricing-rules.php:3393
1122
  #, php-format
1123
  msgid "%s as price per unit"
1124
  msgstr ""
@@ -1408,7 +1413,7 @@ msgid ""
1408
  "conditions"
1409
  msgstr ""
1410
 
1411
- #: v1/view/documentation.php:72 v2/App/Helpers/Helper.php:164
1412
  msgid "Category Combination"
1413
  msgstr ""
1414
 
@@ -1432,7 +1437,7 @@ msgstr ""
1432
  #: v1/view/template/discount-table.php:42 v1/view/view-cart-rules.php:756
1433
  #: v1/view/view-pricing-rules.php:708 v2/App/Controllers/Admin/Settings.php:443
1434
  #: v2/App/Views/Admin/Rules/Discounts/Bulk.php:59
1435
- #: v2/App/Views/Admin/Rules/Manage.php:192
1436
  msgid "Discount"
1437
  msgstr ""
1438
 
@@ -2044,11 +2049,11 @@ msgid "Edit Cart Rule"
2044
  msgstr ""
2045
 
2046
  #: v1/view/view-cart-rules.php:75 v1/view/view-pricing-rules.php:57
2047
- #: v2/App/Views/Admin/Rules/Manage.php:17
2048
- #: v2/App/Views/Admin/Rules/Manage.php:21
2049
- #: v2/App/Views/Admin/Rules/Manage.php:29
2050
- #: v2/App/Views/Admin/Rules/Manage.php:33
2051
- #: v2/App/Views/Admin/Rules/Manage.php:41
2052
  msgid "This rule is not running currently: "
2053
  msgstr ""
2054
 
@@ -2063,7 +2068,7 @@ msgid ""
2063
  msgstr ""
2064
 
2065
  #: v1/view/view-cart-rules.php:98 v1/view/view-pricing-rules.php:81
2066
- #: v2/App/Controllers/Admin/Tabs/Statistics.php:36
2067
  msgid "Rule Name"
2068
  msgstr ""
2069
 
@@ -2365,7 +2370,7 @@ msgstr ""
2365
  msgid "Do not use"
2366
  msgstr ""
2367
 
2368
- #: v1/view/view-pricing-rules.php:394 v2/App/Helpers/Helper.php:162
2369
  msgid "Coupon"
2370
  msgstr ""
2371
 
@@ -2390,7 +2395,7 @@ msgid "Make sure you have created the coupon already"
2390
  msgstr ""
2391
 
2392
  #: v1/view/view-pricing-rules.php:484 v2/App/Conditions/CartSubTotal.php:17
2393
- #: v2/App/Helpers/Helper.php:153
2394
  msgid "Subtotal"
2395
  msgstr ""
2396
 
@@ -2682,7 +2687,7 @@ msgid "Filter (Buy)"
2682
  msgstr ""
2683
 
2684
  #: v2/App/Controllers/Admin/Settings.php:440
2685
- #: v2/App/Views/Admin/Rules/Manage.php:146
2686
  msgid "Filter"
2687
  msgstr ""
2688
 
@@ -2942,7 +2947,7 @@ msgstr ""
2942
  msgid "<b>This rule is not running currently:</b> Validity expired"
2943
  msgstr ""
2944
 
2945
- #: v2/App/Controllers/Admin/Tabs/Compatible.php:21
2946
  msgid "Compatibility"
2947
  msgstr ""
2948
 
@@ -2970,20 +2975,20 @@ msgstr ""
2970
  msgid "Date"
2971
  msgstr ""
2972
 
2973
- #: v2/App/Controllers/Admin/Tabs/Statistics.php:26
2974
  msgid "Reports"
2975
  msgstr ""
2976
 
2977
- #: v2/App/Controllers/Admin/Tabs/Statistics.php:43
2978
  msgid "All Rules"
2979
  msgstr ""
2980
 
2981
- #: v2/App/Controllers/Admin/Tabs/Statistics.php:44
2982
- #: v2/App/Controllers/Admin/Tabs/Statistics.php:50
2983
  msgid "Rule"
2984
  msgstr ""
2985
 
2986
- #: v2/App/Controllers/Admin/Tabs/Statistics.php:49
2987
  msgid "All Rules (except cart adjustment type)"
2988
  msgstr ""
2989
 
@@ -3017,51 +3022,47 @@ msgstr ""
3017
  msgid "Bulk Discount"
3018
  msgstr ""
3019
 
3020
- #: v2/App/Controllers/ManageDiscount.php:662
3021
  msgid "cart discount"
3022
  msgstr ""
3023
 
3024
- #: v2/App/Controllers/ManageDiscount.php:861
3025
  msgid "Coupon code applied successfully."
3026
  msgstr ""
3027
 
3028
- #: v2/App/Controllers/ShortCodeManager.php:677
3029
- msgid "No Banner Content"
3030
- msgstr ""
3031
-
3032
- #: v2/App/Helpers/Helper.php:148
3033
  msgid "Include additional conditions (if necessary)"
3034
  msgstr ""
3035
 
3036
- #: v2/App/Helpers/Helper.php:149
3037
  msgid "Popular conditions:"
3038
  msgstr ""
3039
 
3040
- #: v2/App/Helpers/Helper.php:154
3041
  msgid "User role"
3042
  msgstr ""
3043
 
3044
- #: v2/App/Helpers/Helper.php:155
3045
  msgid "Days & Time"
3046
  msgstr ""
3047
 
3048
- #: v2/App/Helpers/Helper.php:157
3049
  msgid "Payment Method"
3050
  msgstr ""
3051
 
3052
- #: v2/App/Helpers/Helper.php:163
3053
  msgid "Shipping Address"
3054
  msgstr ""
3055
 
3056
- #: v2/App/Helpers/Helper.php:165
3057
  msgid "Product Combination"
3058
  msgstr ""
3059
 
3060
- #: v2/App/Helpers/Helper.php:166
3061
  msgid "Quantities/Line items"
3062
  msgstr ""
3063
 
3064
- #: v2/App/Helpers/Helper.php:179
3065
  msgid ""
3066
  "Individual Product : \n"
3067
  " This counts the total quantity of each product / line item "
@@ -3076,7 +3077,7 @@ msgid ""
3076
  "variant because WooCommerce considers a variant as a product itself."
3077
  msgstr ""
3078
 
3079
- #: v2/App/Helpers/Helper.php:193
3080
  msgid ""
3081
  "Filter set above :\n"
3082
  " This will count the quantities of products set in the 'Filter' "
@@ -3090,7 +3091,7 @@ msgid ""
3090
  "1 quantity each of X, Y and Z from Category A, then the count here is 3."
3091
  msgstr ""
3092
 
3093
- #: v2/App/Helpers/Helper.php:204
3094
  msgid ""
3095
  "All variants in each product together :\n"
3096
  " Useful when applying discounts based on variable products and "
@@ -3101,15 +3102,11 @@ msgid ""
3101
  "Medium, 6 of Product A - Large, then the count will be: 6+4+2 = 12\n"
3102
  msgstr ""
3103
 
3104
- #: v2/App/Helpers/Helper.php:237
3105
- msgid "Invalid token"
3106
- msgstr ""
3107
-
3108
- #: v2/App/Helpers/Helper.php:249
3109
  msgid "Update now"
3110
  msgstr ""
3111
 
3112
- #: v2/App/Helpers/Helper.php:254
3113
  #, php-format
3114
  msgid ""
3115
  "You are using a lower version of our <b>Woo Discount Rules PRO 2.0</b> "
@@ -3286,11 +3283,49 @@ msgstr ""
3286
  msgid "discount"
3287
  msgstr ""
3288
 
3289
- #: v2/App/Helpers/Rule.php:1246 v2/App/Helpers/Rule.php:1329
3290
- #: v2/App/Views/Admin/Tabs/ImportExport.php:84
3291
  msgid "Untitled Rule"
3292
  msgstr ""
3293
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3294
  #: v2/App/Helpers/Woocommerce.php:922
3295
  msgid "Sunday"
3296
  msgstr ""
@@ -3899,59 +3934,59 @@ msgstr ""
3899
  msgid "Select Products"
3900
  msgstr ""
3901
 
3902
- #: v2/App/Views/Admin/Rules/Manage.php:17
3903
  msgid " Start date and time is set in the future date"
3904
  msgstr ""
3905
 
3906
- #: v2/App/Views/Admin/Rules/Manage.php:21
3907
- #: v2/App/Views/Admin/Rules/Manage.php:33
3908
- #: v2/App/Views/Admin/Rules/Manage.php:41
3909
  msgid " Rule reached maximum usage limit "
3910
  msgstr ""
3911
 
3912
- #: v2/App/Views/Admin/Rules/Manage.php:29
3913
  msgid " Validity expired"
3914
  msgstr ""
3915
 
3916
- #: v2/App/Views/Admin/Rules/Manage.php:61
3917
  msgid "Enable?"
3918
  msgstr ""
3919
 
3920
- #: v2/App/Views/Admin/Rules/Manage.php:70
3921
  msgid "Apply this rule if matched and ignore all other rules"
3922
  msgstr ""
3923
 
3924
- #: v2/App/Views/Admin/Rules/Manage.php:79
3925
  msgid "#Rule ID: "
3926
  msgstr ""
3927
 
3928
- #: v2/App/Views/Admin/Rules/Manage.php:86
3929
  msgid "Save & Close"
3930
  msgstr ""
3931
 
3932
- #: v2/App/Views/Admin/Rules/Manage.php:89
3933
  msgid "Cancel"
3934
  msgstr ""
3935
 
3936
- #: v2/App/Views/Admin/Rules/Manage.php:98
3937
  msgid "Choose a discount type"
3938
  msgstr ""
3939
 
3940
- #: v2/App/Views/Admin/Rules/Manage.php:102
3941
  msgid "Select Discount Type"
3942
  msgstr ""
3943
 
3944
- #: v2/App/Views/Admin/Rules/Manage.php:148
3945
  msgid ""
3946
  "Choose which <b>gets</b> discount (products/categories/attributes/SKU and so "
3947
  "on )"
3948
  msgstr ""
3949
 
3950
- #: v2/App/Views/Admin/Rules/Manage.php:149
3951
  msgid "Note : You can also exclude products/categories."
3952
  msgstr ""
3953
 
3954
- #: v2/App/Views/Admin/Rules/Manage.php:194
3955
  msgid "Select discount type and its value (percentage/price/fixed price)"
3956
  msgstr ""
3957
 
@@ -4108,32 +4143,32 @@ msgstr ""
4108
  msgid "Go PRO"
4109
  msgstr ""
4110
 
4111
- #: v2/App/Views/Admin/Tabs/ImportExport.php:10
4112
  msgid "Export tool"
4113
  msgstr ""
4114
 
4115
- #: v2/App/Views/Admin/Tabs/ImportExport.php:15
4116
  msgid "Export"
4117
  msgstr ""
4118
 
4119
- #: v2/App/Views/Admin/Tabs/ImportExport.php:26
4120
- #: v2/App/Views/Admin/Tabs/ImportExport.php:142
4121
  msgid "Import Tool"
4122
  msgstr ""
4123
 
4124
- #: v2/App/Views/Admin/Tabs/ImportExport.php:119
4125
  msgid "<b style=\"color: green;\">Rules Imported successfully</b>"
4126
  msgstr ""
4127
 
4128
- #: v2/App/Views/Admin/Tabs/ImportExport.php:122
4129
  msgid "<b style=\"color: red;\">Problem in Importing CSV Data</b>"
4130
  msgstr ""
4131
 
4132
- #: v2/App/Views/Admin/Tabs/ImportExport.php:132
4133
  msgid "Import"
4134
  msgstr ""
4135
 
4136
- #: v2/App/Views/Admin/Tabs/ImportExport.php:143
4137
  msgid ""
4138
  "Unlock this feature by <a href=\"https://www.flycart.org/products/wordpress/"
4139
  "woocommerce-discount-rules\" target=\"_blank\">Upgrading to Pro</a>"
@@ -4418,38 +4453,6 @@ msgstr ""
4418
  msgid "Text to show when rule applied"
4419
  msgstr ""
4420
 
4421
- #: v2/App/Views/Admin/Tabs/settings.php:402
4422
- msgid "Banner"
4423
- msgstr ""
4424
-
4425
- #: v2/App/Views/Admin/Tabs/settings.php:409
4426
- msgid "Banner Content"
4427
- msgstr ""
4428
-
4429
- #: v2/App/Views/Admin/Tabs/settings.php:410
4430
- msgid ""
4431
- "A static banner you that you want to display in your storefront. <br><br> "
4432
- "<b>NOTE:</b> It is a static banner. You can use any content or html here."
4433
- msgstr ""
4434
-
4435
- #: v2/App/Views/Admin/Tabs/settings.php:413
4436
- #: v2/App/Views/Admin/Tabs/settings.php:422
4437
- #: v2/App/Views/Admin/Tabs/settings.php:485
4438
- msgid ""
4439
- "Unlock this feature by <a href='https://www.flycart.org/products/wordpress/"
4440
- "woocommerce-discount-rules?utm_source=woo-discount-rules-"
4441
- "v2&utm_campaign=doc&utm_medium=text-click&utm_content=unlock_pro' "
4442
- "target='_blank'>Upgrading to Pro</a>"
4443
- msgstr ""
4444
-
4445
- #: v2/App/Views/Admin/Tabs/settings.php:419
4446
- msgid "Banner Content display position"
4447
- msgstr ""
4448
-
4449
- #: v2/App/Views/Admin/Tabs/settings.php:420
4450
- msgid "Choose a display position for the banner in your storefront"
4451
- msgstr ""
4452
-
4453
  #: v2/App/Views/Admin/Tabs/settings.php:431
4454
  msgid "On-Sale page"
4455
  msgstr ""
@@ -4458,11 +4461,11 @@ msgstr ""
4458
  msgid "Select rules for the On Sale Page"
4459
  msgstr ""
4460
 
4461
- #: v2/App/Views/Admin/Tabs/settings.php:450
4462
  msgid "Type the name of the rule to select it"
4463
  msgstr ""
4464
 
4465
- #: v2/App/Views/Admin/Tabs/settings.php:458
4466
  msgid "All active rules"
4467
  msgstr ""
4468
 
@@ -4470,6 +4473,14 @@ msgstr ""
4470
  msgid "Save and Build Index"
4471
  msgstr ""
4472
 
 
 
 
 
 
 
 
 
4473
  #: v2/App/Views/Admin/Tabs/settings.php:493
4474
  msgid ""
4475
  "ShortCode to load all products which has discount through Woo Discount Rules"
@@ -4535,7 +4546,7 @@ msgstr ""
4535
  #: v2/App/Views/Admin/Tabs/settings.php:669
4536
  #: v2/App/Views/Admin/Tabs/settings.php:715
4537
  #: v2/App/Views/Admin/Tabs/settings.php:782
4538
- #: v2/App/Views/Templates/discount_table.php:113
4539
  msgid " flat"
4540
  msgstr ""
4541
 
@@ -4604,6 +4615,6 @@ msgstr ""
4604
  msgid "15"
4605
  msgstr ""
4606
 
4607
- #: v2/App/Views/Templates/discount_table.php:108
4608
  msgid " (in cart)"
4609
  msgstr ""
12
  "X-Generator: Loco https://localise.biz/\n"
13
  "Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;"
14
 
15
+ #: common.php:9 v2/App/Controllers/Admin/Tabs/Statistics.php:118
16
  #: v2/App/Controllers/Admin/WDRAjax.php:51
17
+ #: v2/App/Controllers/Admin/WDRAjax.php:54
18
  msgid "Authentication required"
19
  msgstr ""
20
 
126
 
127
  #: updater.php:142 updater.php:307 v1/helper/purchase.php:62
128
  #: v1/helper/purchase.php:66 v1/helper/purchase.php:134
129
+ #: v1/helper/purchase.php:137 v1/helper/purchase.php:175
130
  msgid "Please enter a valid license key"
131
  msgstr ""
132
 
133
+ #: updater.php:145 v1/helper/purchase.php:184
134
  msgid "License key check : Passed."
135
  msgstr ""
136
 
137
+ #: updater.php:147 v1/helper/purchase.php:188 v1/view/settings_general.php:32
138
  msgid "License key seems to be Invalid. Please enter a valid license key"
139
  msgstr ""
140
 
183
 
184
  #: v1/helper/general-helper.php:797
185
  #: v2/App/Views/Admin/Rules/Conditions/Main.php:10
 
 
 
186
  #: v2/App/Views/Admin/Rules/Manage.php:134
187
  #: v2/App/Views/Admin/Rules/Manage.php:135
188
  #: v2/App/Views/Admin/Rules/Manage.php:136
189
  #: v2/App/Views/Admin/Rules/Manage.php:137
190
+ #: v2/App/Views/Admin/Rules/Manage.php:138
191
+ #: v2/App/Views/Admin/Rules/Manage.php:139
192
+ #: v2/App/Views/Admin/Rules/Manage.php:140
193
  #: v2/App/Views/Admin/Tabs/settings.php:24
194
  #: v2/App/Views/Admin/Tabs/settings.php:64
195
  #: v2/App/Views/Admin/Tabs/settings.php:121
205
  msgid "Coupon already exists in WooCommerce. Please select another name"
206
  msgstr ""
207
 
208
+ #: v1/helper/general-helper.php:1266 v2/App/Helpers/Helper.php:244
209
+ msgid "Invalid token"
210
+ msgstr ""
211
+
212
  #: v1/helper/purchase.php:25 v1/view/includes/cart-menu.php:5
213
  #: v1/view/includes/menu.php:6 v1/view/includes/sub-menu.php:5
214
  #: v2/App/Controllers/Admin/Settings.php:40
276
  msgstr ""
277
 
278
  #: v1/includes/advanced/free_shipping_method.php:73
279
+ #: v1/includes/discount-base.php:1128 v1/view/cart-rules.php:133
280
  #: v1/view/pricing-rules.php:163 v1/view/settings_promotion.php:65
281
  #: v1/view/settings_promotion.php:100 v2/App/Controllers/Admin/Settings.php:418
282
  #: v2/App/Views/Admin/Tabs/DiscountRule.php:77
305
  msgid "Failed to save"
306
  msgstr ""
307
 
308
+ #: v1/includes/discount-base.php:207 v1/view/cart-rules.php:162
309
  #: v1/view/pricing-rules.php:192 v2/App/Controllers/Admin/Settings.php:417
310
  msgid "Active"
311
  msgstr ""
312
 
313
+ #: v1/includes/discount-base.php:209 v1/view/cart-rules.php:164
314
  #: v1/view/pricing-rules.php:194 v1/view/settings_cart_rules.php:95
315
  #: v1/view/settings_cart_rules.php:102 v1/view/settings_price_rules.php:169
316
  #: v1/view/settings_promotion.php:22 v1/view/settings_promotion.php:62
320
  msgid "Disabled"
321
  msgstr ""
322
 
323
+ #: v1/includes/discount-base.php:572
324
  msgid "Cache cleared successfully"
325
  msgstr ""
326
 
327
+ #: v1/includes/discount-base.php:574
328
  msgid "Failed to clear cache"
329
  msgstr ""
330
 
331
+ #: v1/includes/discount-base.php:691 v1/includes/discount-base.php:726
332
  msgid "Failed to do action"
333
  msgstr ""
334
 
335
+ #: v1/includes/discount-base.php:730
336
  msgid "Disabled successfully"
337
  msgstr ""
338
 
339
+ #: v1/includes/discount-base.php:733
340
  msgid "Deleted successfully"
341
  msgstr ""
342
 
343
+ #: v1/includes/discount-base.php:736
344
  msgid "Enabled successfully"
345
  msgstr ""
346
 
347
+ #: v1/includes/discount-base.php:762 v1/includes/discount-base.php:763
348
+ #: v1/includes/discount-base.php:780
349
  msgid "copy"
350
  msgstr ""
351
 
352
+ #: v1/includes/discount-base.php:788
353
  msgid "Duplicate rule created successfully"
354
  msgstr ""
355
 
356
+ #: v1/includes/discount-base.php:795
357
  msgid "Failed to create duplicate rule"
358
  msgstr ""
359
 
360
+ #: v1/includes/discount-base.php:1082
361
  msgid "Please fill this field"
362
  msgstr ""
363
 
364
+ #: v1/includes/discount-base.php:1083
365
  msgid "Please Enter the Rule Name to Create / Save."
366
  msgstr ""
367
 
368
+ #: v1/includes/discount-base.php:1084
369
  msgid "Saving..."
370
  msgstr ""
371
 
372
+ #: v1/includes/discount-base.php:1085 v1/view/view-cart-rules.php:55
373
  #: v1/view/view-pricing-rules.php:37
374
  msgid "Save Rule"
375
  msgstr ""
376
 
377
+ #: v1/includes/discount-base.php:1086
378
  msgid "Please enter a Key"
379
  msgstr ""
380
 
381
+ #: v1/includes/discount-base.php:1087 v1/view/view-pricing-rules.php:739
382
  msgid "Min Quantity"
383
  msgstr ""
384
 
385
+ #: v1/includes/discount-base.php:1088 v1/view/view-pricing-rules.php:746
386
  msgid "Max Quantity"
387
  msgstr ""
388
 
389
+ #: v1/includes/discount-base.php:1089 v1/view/view-pricing-rules.php:654
390
  #: v1/view/view-pricing-rules.php:657 v1/view/view-pricing-rules.php:677
391
  #: v2/App/Controllers/Admin/Settings.php:435
392
  msgid "Quantity"
393
  msgstr ""
394
 
395
+ #: v1/includes/discount-base.php:1090 v1/view/view-cart-rules.php:92
396
  #: v1/view/view-pricing-rules.php:74 v1/view/view-pricing-rules.php:744
397
  #: v1/view/view-pricing-rules.php:897 v1/view/view-pricing-rules.php:920
398
  #: v1/view/view-pricing-rules.php:927
399
  msgid "ex. 1"
400
  msgstr ""
401
 
402
+ #: v1/includes/discount-base.php:1091 v1/view/view-pricing-rules.php:965
403
  msgid "ex. 10"
404
  msgstr ""
405
 
406
+ #: v1/includes/discount-base.php:1092 v1/view/view-pricing-rules.php:751
407
  #: v1/view/view-pricing-rules.php:879
408
  msgid "ex. 50"
409
  msgstr ""
410
 
411
+ #: v1/includes/discount-base.php:1093
412
  msgid "Search for a user"
413
  msgstr ""
414
 
415
+ #: v1/includes/discount-base.php:1094 v1/view/view-pricing-rules.php:752
416
  msgid "Adjustment Type"
417
  msgstr ""
418
 
419
+ #: v1/includes/discount-base.php:1095 v1/view/view-pricing-rules.php:954
420
  #: v2/App/Controllers/Admin/Settings.php:438
421
  msgid "Discount percentage"
422
  msgstr ""
423
 
424
+ #: v1/includes/discount-base.php:1096 v1/view/view-cart-rules.php:776
425
  #: v1/view/view-pricing-rules.php:786
426
  msgid "Percentage Discount"
427
  msgstr ""
428
 
429
+ #: v1/includes/discount-base.php:1097 v1/view/view-cart-rules.php:782
430
  #: v1/view/view-cart-rules.php:784 v1/view/view-pricing-rules.php:794
431
  #: v1/view/view-pricing-rules.php:796
432
  msgid "Price Discount"
433
  msgstr ""
434
 
435
+ #: v1/includes/discount-base.php:1098
436
  msgid "BOGO Product Discount"
437
  msgstr ""
438
 
439
+ #: v1/includes/discount-base.php:1099
440
  msgid "Product Discount - Not support for subtotal based rule"
441
  msgstr ""
442
 
443
+ #: v1/includes/discount-base.php:1100 v1/view/view-cart-rules.php:462
444
  #: v1/view/view-pricing-rules.php:874 v1/view/view-pricing-rules.php:1014
445
  #: v2/App/Views/Admin/Rules/Discounts/Cart.php:33
446
  #: v2/App/Views/Admin/Rules/Discounts/simple.php:31
447
  msgid "Value"
448
  msgstr ""
449
 
450
+ #: v1/includes/discount-base.php:1101 v1/view/view-pricing-rules.php:882
451
  msgid "receive discount for"
452
  msgstr ""
453
 
454
+ #: v1/includes/discount-base.php:1102 v1/view/view-pricing-rules.php:884
455
  msgid "Auto add all selected products"
456
  msgstr ""
457
 
458
+ #: v1/includes/discount-base.php:1103 v1/view/view-pricing-rules.php:885
459
  msgid "Same product"
460
  msgstr ""
461
 
462
+ #: v1/includes/discount-base.php:1104
463
  msgid "Any one cheapest from selected"
464
  msgstr ""
465
 
466
+ #: v1/includes/discount-base.php:1105
467
  msgid "Any one cheapest from all products"
468
  msgstr ""
469
 
470
+ #: v1/includes/discount-base.php:1106 v1/view/view-pricing-rules.php:854
471
  #: v1/view/view-pricing-rules.php:856
472
  msgid "Buy X Get Y - Selected Categories (Cheapest in cart)"
473
  msgstr ""
474
 
475
+ #: v1/includes/discount-base.php:1107 v1/view/view-pricing-rules.php:844
476
  #: v1/view/view-pricing-rules.php:846
477
  msgid "Buy X Get Y - Selected item(s) (Cheapest in cart)"
478
  msgstr ""
479
 
480
+ #: v1/includes/discount-base.php:1108 v1/view/view-pricing-rules.php:864
481
  #: v1/view/view-pricing-rules.php:866
482
  msgid "Buy X get Y - Cheapest among all items in cart"
483
  msgstr ""
484
 
485
+ #: v1/includes/discount-base.php:1109 v1/view/view-pricing-rules.php:892
486
  msgid "Free quantity"
487
  msgstr ""
488
 
489
+ #: v1/includes/discount-base.php:1110 v1/view/view-pricing-rules.php:892
490
  msgid "Number of quantity(ies) in each selected product(s)"
491
  msgstr ""
492
 
493
+ #: v1/includes/discount-base.php:1111 v1/view/view-pricing-rules.php:912
494
  msgid "Fixed item count (not recommended)"
495
  msgstr ""
496
 
497
+ #: v1/includes/discount-base.php:1112 v1/view/view-pricing-rules.php:911
498
  msgid "Dynamic item count"
499
  msgstr ""
500
 
501
+ #: v1/includes/discount-base.php:1113 v1/view/view-pricing-rules.php:914
502
  msgid ""
503
  "Fixed item count - You need to provide item count manually. Dynamic item "
504
  "count - System will choose dynamically based on cart"
505
  msgstr ""
506
 
507
+ #: v1/includes/discount-base.php:1114 v1/view/view-pricing-rules.php:915
508
  msgid "Item count"
509
  msgstr ""
510
 
511
+ #: v1/includes/discount-base.php:1115 v1/view/view-pricing-rules.php:915
512
  msgid "Discount for number of item(s) in cart"
513
  msgstr ""
514
 
515
+ #: v1/includes/discount-base.php:1116 v1/view/view-pricing-rules.php:922
516
  msgid "Discount for number of quantity(ies)"
517
  msgstr ""
518
 
519
+ #: v1/includes/discount-base.php:1117 v1/view/view-pricing-rules.php:922
520
  msgid "Item quantity"
521
  msgstr ""
522
 
523
+ #: v1/includes/discount-base.php:1118
524
  msgid "Search for a products"
525
  msgstr ""
526
 
527
+ #: v1/includes/discount-base.php:1119
528
  msgid "and"
529
  msgstr ""
530
 
531
+ #: v1/includes/discount-base.php:1120 v1/view/view-pricing-rules.php:956
532
  msgid "100% percent"
533
  msgstr ""
534
 
535
+ #: v1/includes/discount-base.php:1121 v1/view/view-pricing-rules.php:957
536
  msgid "Limited percent"
537
  msgstr ""
538
 
539
+ #: v1/includes/discount-base.php:1122
540
  msgid "Percentage"
541
  msgstr ""
542
 
543
+ #: v1/includes/discount-base.php:1123
544
  msgid "as discount"
545
  msgstr ""
546
 
547
+ #: v1/includes/discount-base.php:1124 v1/view/view-cart-rules.php:701
548
  #: v1/view/view-pricing-rules.php:974
549
  msgid "Remove"
550
  msgstr ""
551
 
552
+ #: v1/includes/discount-base.php:1125 v1/view/cart-rules.php:185
553
  #: v1/view/pricing-rules.php:215 v1/view/view-pricing-rules.php:971
554
  #: v2/App/Views/Admin/Tabs/DiscountRule.php:304
555
  msgid "Duplicate"
556
  msgstr ""
557
 
558
+ #: v1/includes/discount-base.php:1126
559
  msgid "none"
560
  msgstr ""
561
 
562
+ #: v1/includes/discount-base.php:1127
563
  msgid "Are you sure to remove this ?"
564
  msgstr ""
565
 
566
+ #: v1/includes/discount-base.php:1129 v1/view/cart-rules.php:130
567
  #: v1/view/pricing-rules.php:160 v2/App/Controllers/Admin/Settings.php:416
568
  #: v2/App/Views/Admin/Tabs/DiscountRule.php:78
569
  msgid "Disable"
570
  msgstr ""
571
 
572
+ #: v1/includes/discount-base.php:1130
573
  msgid "Are you sure to remove ?"
574
  msgstr ""
575
 
576
+ #: v1/includes/discount-base.php:1131 v1/view/view-cart-rules.php:172
577
  msgid "Type"
578
  msgstr ""
579
 
580
+ #: v1/includes/discount-base.php:1132 v1/view/view-cart-rules.php:176
581
  msgid "Cart Subtotal"
582
  msgstr ""
583
 
584
+ #: v1/includes/discount-base.php:1133 v1/view/view-cart-rules.php:179
585
  msgid "Subtotal at least"
586
  msgstr ""
587
 
588
+ #: v1/includes/discount-base.php:1134 v1/view/view-cart-rules.php:183
589
  msgid "Subtotal less than"
590
  msgstr ""
591
 
592
+ #: v1/includes/discount-base.php:1135 v1/view/view-cart-rules.php:186
593
  msgid "Cart Item Count"
594
  msgstr ""
595
 
596
+ #: v1/includes/discount-base.php:1136 v1/view/view-cart-rules.php:189
597
  msgid "Number of line items in the cart (not quantity) at least"
598
  msgstr ""
599
 
600
+ #: v1/includes/discount-base.php:1137 v1/view/view-cart-rules.php:193
601
  msgid "Number of line items in the cart (not quantity) less than"
602
  msgstr ""
603
 
604
+ #: v1/includes/discount-base.php:1138 v1/view/view-cart-rules.php:196
605
  msgid "Quantity Sum"
606
  msgstr ""
607
 
608
+ #: v1/includes/discount-base.php:1139 v1/view/view-cart-rules.php:202
609
  #: v1/view/view-cart-rules.php:205
610
  msgid "Total number of quantities in the cart at least"
611
  msgstr ""
612
 
613
+ #: v1/includes/discount-base.php:1140 v1/view/view-cart-rules.php:214
614
  #: v1/view/view-cart-rules.php:217
615
  msgid "Total number of quantities in the cart less than"
616
  msgstr ""
617
 
618
+ #: v1/includes/discount-base.php:1141 v1/view/view-cart-rules.php:246
619
  msgid "Categories in cart"
620
  msgstr ""
621
 
622
+ #: v1/includes/discount-base.php:1142 v1/view/view-cart-rules.php:252
623
  msgid "Including sub-categories in cart"
624
  msgstr ""
625
 
626
+ #: v1/includes/discount-base.php:1143 v1/view/view-cart-rules.php:267
627
  msgid "Customer Details (must be logged in)"
628
  msgstr ""
629
 
630
+ #: v1/includes/discount-base.php:1144 v1/view/view-cart-rules.php:273
631
  #: v1/view/view-cart-rules.php:275
632
  msgid "User in list"
633
  msgstr ""
634
 
635
+ #: v1/includes/discount-base.php:1145 v1/view/view-cart-rules.php:283
636
  #: v1/view/view-cart-rules.php:285
637
  msgid "User role in list"
638
  msgstr ""
639
 
640
+ #: v1/includes/discount-base.php:1146 v1/view/view-cart-rules.php:349
641
  #: v1/view/view-cart-rules.php:351
642
  msgid "Shipping country in list"
643
  msgstr ""
644
 
645
+ #: v1/includes/discount-base.php:1147 v1/view/view-cart-rules.php:289
646
  msgid "Customer Email"
647
  msgstr ""
648
 
649
+ #: v1/includes/discount-base.php:1148
650
  msgid "Email with TLD (Ege: edu)"
651
  msgstr ""
652
 
653
+ #: v1/includes/discount-base.php:1149 v1/view/view-cart-rules.php:305
654
  #: v1/view/view-cart-rules.php:307
655
  msgid "Email with Domain (Eg: gmail.com)"
656
  msgstr ""
657
 
658
+ #: v1/includes/discount-base.php:1150 v1/view/view-cart-rules.php:311
659
  msgid "Customer Billing Details"
660
  msgstr ""
661
 
662
+ #: v1/includes/discount-base.php:1151 v1/view/view-cart-rules.php:317
663
  #: v1/view/view-cart-rules.php:319
664
  msgid "Billing city"
665
  msgstr ""
666
 
667
+ #: v1/includes/discount-base.php:1152 v1/view/view-cart-rules.php:323
668
  msgid "Customer Shipping Details"
669
  msgstr ""
670
 
671
+ #: v1/includes/discount-base.php:1153 v1/view/view-cart-rules.php:339
672
  #: v1/view/view-cart-rules.php:341
673
  msgid "Shipping state"
674
  msgstr ""
675
 
676
+ #: v1/includes/discount-base.php:1154 v1/view/view-cart-rules.php:329
677
  #: v1/view/view-cart-rules.php:331
678
  msgid "Shipping city"
679
  msgstr ""
680
 
681
+ #: v1/includes/discount-base.php:1155 v1/view/view-cart-rules.php:359
682
  #: v1/view/view-cart-rules.php:361
683
  msgid "Shipping zip code"
684
  msgstr ""
685
 
686
+ #: v1/includes/discount-base.php:1156 v1/view/view-cart-rules.php:365
687
+ #: v1/view/view-pricing-rules.php:536 v2/App/Helpers/Helper.php:158
688
  #: v2/App/Helpers/ProOptions.php:192 v2/App/Helpers/ProOptions.php:200
689
  #: v2/App/Helpers/ProOptions.php:208 v2/App/Helpers/ProOptions.php:216
690
  #: v2/App/Helpers/ProOptions.php:224 v2/App/Helpers/ProOptions.php:232
691
  msgid "Purchase History"
692
  msgstr ""
693
 
694
+ #: v1/includes/discount-base.php:1157 v1/view/view-cart-rules.php:381
695
  #: v1/view/view-cart-rules.php:383 v1/view/view-pricing-rules.php:551
696
  msgid "Purchased amount"
697
  msgstr ""
698
 
699
+ #: v1/includes/discount-base.php:1158 v1/view/view-cart-rules.php:391
700
  #: v1/view/view-cart-rules.php:393 v1/view/view-pricing-rules.php:552
701
  msgid "Number of previous orders made"
702
  msgstr ""
703
 
704
+ #: v1/includes/discount-base.php:1159 v1/view/view-cart-rules.php:401
705
  #: v1/view/view-cart-rules.php:403 v1/view/view-pricing-rules.php:553
706
  msgid "Number of previous orders made with following products"
707
  msgstr ""
708
 
709
+ #: v1/includes/discount-base.php:1160 v1/view/view-cart-rules.php:411
710
  #: v1/view/view-cart-rules.php:413 v1/view/view-pricing-rules.php:554
711
  msgid "Number of quantity(s) in previous orders made with following products"
712
  msgstr ""
713
 
714
+ #: v1/includes/discount-base.php:1161 v1/view/view-cart-rules.php:417
715
  msgid "Coupon applied"
716
  msgstr ""
717
 
718
+ #: v1/includes/discount-base.php:1162 v1/view/view-cart-rules.php:423
719
  #: v1/view/view-cart-rules.php:425 v1/view/view-pricing-rules.php:410
720
  msgid "Create your own coupon"
721
  msgstr ""
722
 
723
+ #: v1/includes/discount-base.php:1163 v1/view/view-cart-rules.php:433
724
  #: v1/view/view-cart-rules.php:435
725
  msgid "Atleast any one (Select from WooCommerce)"
726
  msgstr ""
727
 
728
+ #: v1/includes/discount-base.php:1164 v1/view/view-cart-rules.php:443
729
  #: v1/view/view-cart-rules.php:445
730
  msgid "All selected (Select from WooCommerce)"
731
  msgstr ""
732
 
733
+ #: v1/includes/discount-base.php:1165 v1/view/view-cart-rules.php:647
734
  #: v1/view/view-pricing-rules.php:590
735
  msgid "Greater than or equal to"
736
  msgstr ""
737
 
738
+ #: v1/includes/discount-base.php:1166 v1/view/view-cart-rules.php:648
739
  #: v1/view/view-pricing-rules.php:591 v1/view/view-pricing-rules.php:650
740
  msgid "Less than or equal to"
741
  msgstr ""
742
 
743
+ #: v1/includes/discount-base.php:1167 v1/view/view-cart-rules.php:650
744
  #: v1/view/view-pricing-rules.php:594
745
  msgid "and the order status should be"
746
  msgstr ""
747
 
748
+ #: v1/includes/discount-base.php:1168 v1/view/cart-rules.php:114
749
  #: v1/view/cart-rules.php:224 v1/view/pricing-rules.php:144
750
  #: v1/view/pricing-rules.php:254 v1/view/view-cart-rules.php:700
751
  #: v2/App/Views/Admin/Tabs/DiscountRule.php:129
753
  msgid "Action"
754
  msgstr ""
755
 
756
+ #: v1/includes/discount-base.php:1169 v1/view/settings.php:33
757
+ #: v1/view/settings_taxonomy.php:21 v2/App/Views/Admin/Rules/Manage.php:87
758
  msgid "Save"
759
  msgstr ""
760
 
761
+ #: v1/includes/discount-base.php:1170
762
  msgid "Saved Successfully!"
763
  msgstr ""
764
 
765
+ #: v1/includes/discount-base.php:1171 v1/view/view-cart-rules.php:491
766
  #: v1/view/view-cart-rules.php:559 v1/view/view-cart-rules.php:579
767
  #: v1/view/view-cart-rules.php:600 v1/view/view-cart-rules.php:655
768
  #: v1/view/view-pricing-rules.php:238 v1/view/view-pricing-rules.php:254
771
  msgid "None selected"
772
  msgstr ""
773
 
774
+ #: v1/includes/discount-base.php:1172 v1/view/view-cart-rules.php:258
775
  msgid "In each category"
776
  msgstr ""
777
 
778
+ #: v1/includes/discount-base.php:1173 v1/view/settings_price_rules.php:208
779
  #: v1/view/settings_price_rules.php:226 v1/view/settings_price_rules.php:244
780
  #: v1/view/settings_price_rules.php:262
781
  #: v2/App/Views/Admin/Tabs/settings.php:533
782
  msgid "Show"
783
  msgstr ""
784
 
785
+ #: v1/includes/discount-base.php:1174 v1/view/template/sidebar.php:12
786
  msgid "Hide"
787
  msgstr ""
788
 
789
+ #: v1/includes/discount-base.php:1175
790
  msgid "Please select at least one rule"
791
  msgstr ""
792
 
793
+ #: v1/includes/discount-base.php:1176
794
  msgid "Please select an action to apply"
795
  msgstr ""
796
 
797
+ #: v1/includes/discount-base.php:1177
798
  msgid "Are you sure to remove the selected rules"
799
  msgstr ""
800
 
801
+ #: v1/includes/discount-base.php:1178 v1/view/view-pricing-rules.php:931
802
  msgid "Choose product(s)"
803
  msgstr ""
804
 
805
+ #: v1/includes/discount-base.php:1179 v1/view/view-pricing-rules.php:941
806
  msgid "Choose category(ies)"
807
  msgstr ""
808
 
809
+ #: v1/includes/discount-base.php:1180
810
  msgid "Search for a coupon"
811
  msgstr ""
812
 
813
+ #: v1/includes/discount-base.php:1181 v1/view/view-pricing-rules.php:965
814
  #, php-format
815
  msgid "Enter only numeric values. Eg: <b>50</b> for 50% discount"
816
  msgstr ""
817
 
818
+ #: v1/includes/discount-base.php:1182
819
  #, php-format
820
  msgid "Enter the discount price. Eg: <b>10</b> for %s discount"
821
  msgstr ""
822
 
823
+ #: v1/includes/discount-base.php:1183
824
  #, php-format
825
  msgid "Enter the discounted price per unit. Eg: <b>10</b> for %s as unit price"
826
  msgstr ""
827
 
828
+ #: v1/includes/discount-base.php:1184
829
  #, php-format
830
  msgid ""
831
  "Enter the price for selected quantity. Eg: <b>10</b> then %s as total price "
832
  "for selected quantity"
833
  msgstr ""
834
 
835
+ #: v1/includes/discount-base.php:1185 v1/view/view-pricing-rules.php:890
836
  msgid ""
837
  "Auto add all selected products - Automatically added to the cart <br> Same "
838
  "product - get discount in same product <br> Any one cheapest from selected - "
843
  "no.of quantities"
844
  msgstr ""
845
 
846
+ #: v1/includes/discount-base.php:1186 v1/view/view-cart-rules.php:221
847
  #: v2/App/Controllers/Base.php:47
848
  msgid "Products"
849
  msgstr ""
850
 
851
+ #: v1/includes/discount-base.php:1187 v1/view/view-cart-rules.php:226
852
  msgid "Products in cart"
853
  msgstr ""
854
 
855
+ #: v1/includes/discount-base.php:1188 v1/view/view-cart-rules.php:232
856
  #: v1/view/view-pricing-rules.php:273
857
  msgid "Exclude products"
858
  msgstr ""
859
 
860
+ #: v1/includes/discount-base.php:1189 v1/view/view-cart-rules.php:238
861
  msgid "Exclude on sale products"
862
  msgstr ""
863
 
864
+ #: v1/includes/discount-base.php:1190 v1/view/view-cart-rules.php:529
865
  msgid "This will exclude the on sale products from discount"
866
  msgstr ""
867
 
868
+ #: v1/includes/discount-base.php:1191 v1/view/view-cart-rules.php:663
869
  #: v1/view/view-pricing-rules.php:609
870
  msgid "From all previous orders"
871
  msgstr ""
872
 
873
+ #: v1/includes/discount-base.php:1192 v1/view/view-cart-rules.php:664
874
  #: v1/view/view-pricing-rules.php:610
875
  msgid "Last 7 days"
876
  msgstr ""
877
 
878
+ #: v1/includes/discount-base.php:1193 v1/view/view-cart-rules.php:665
879
  #: v1/view/view-pricing-rules.php:611
880
  msgid "Last 14 days"
881
  msgstr ""
882
 
883
+ #: v1/includes/discount-base.php:1194 v1/view/view-cart-rules.php:666
884
  #: v1/view/view-pricing-rules.php:612
885
  msgid "Last 30 days"
886
  msgstr ""
887
 
888
+ #: v1/includes/discount-base.php:1195 v1/view/view-cart-rules.php:667
889
  #: v1/view/view-pricing-rules.php:613
890
  msgid "Last 60 days"
891
  msgstr ""
892
 
893
+ #: v1/includes/discount-base.php:1196 v1/view/view-cart-rules.php:668
894
  #: v1/view/view-pricing-rules.php:614
895
  msgid "Last 90 days"
896
  msgstr ""
897
 
898
+ #: v1/includes/discount-base.php:1197 v1/view/view-cart-rules.php:669
899
  #: v1/view/view-pricing-rules.php:615
900
  msgid "Last 180 days"
901
  msgstr ""
902
 
903
+ #: v1/includes/discount-base.php:1198 v1/view/view-cart-rules.php:670
904
  #: v1/view/view-pricing-rules.php:616
905
  msgid "Last 1 year"
906
  msgstr ""
907
 
908
+ #: v1/includes/discount-base.php:1199 v1/view/view-cart-rules.php:671
909
  #: v1/view/view-pricing-rules.php:617
910
  msgid "Custom"
911
  msgstr ""
912
 
913
+ #: v1/includes/discount-base.php:1200 v1/view/view-cart-rules.php:674
914
  #: v1/view/view-pricing-rules.php:621
915
  msgid "in days"
916
  msgstr ""
917
 
918
+ #: v1/includes/discount-base.php:1201 v1/view/view-pricing-rules.php:804
919
  #: v1/view/view-pricing-rules.php:806
920
  msgid "Fixed Price Per Unit"
921
  msgstr ""
922
 
923
+ #: v1/includes/discount-base.php:1202 v1/view/view-pricing-rules.php:814
924
  #: v1/view/view-pricing-rules.php:816
925
  msgid "Bundle (Set) Discount"
926
  msgstr ""
927
 
928
+ #: v1/includes/discount-base.php:1203 v1/view/view-cart-rules.php:371
929
  #: v1/view/view-cart-rules.php:373 v1/view/view-pricing-rules.php:550
930
  msgid "First Order discount"
931
  msgstr ""
932
 
933
+ #: v1/includes/discount-base.php:1204 v1/view/view-cart-rules.php:264
934
  msgid "Exclude categories in cart"
935
  msgstr ""
936
 
937
+ #: v1/includes/discount-base.php:1206 v1/view/view-pricing-rules.php:824
938
  #: v1/view/view-pricing-rules.php:826
939
  msgid "Buy X get X (Same product)"
940
  msgstr ""
941
 
942
+ #: v1/includes/discount-base.php:1207 v1/view/view-pricing-rules.php:834
943
  #: v1/view/view-pricing-rules.php:836
944
  msgid "Buy X get Y (Auto add all selected products)"
945
  msgstr ""
946
 
947
+ #: v1/includes/discount-base.php:1208
948
  #, php-format
949
  msgid ""
950
  "The customer gets the same product free (Buy 2 get 1 free) or a limited "
951
  "percentage (Buy 2 and get 1 at 50% discount)"
952
  msgstr ""
953
 
954
+ #: v1/includes/discount-base.php:1209
955
  msgid ""
956
  "Provide a specific product free when purchasing another product."
957
  "<br><br>Example: Buy Product A and get Product B free. Product B will be "
958
  "automatically added to cart."
959
  msgstr ""
960
 
961
+ #: v1/includes/discount-base.php:1210
962
  msgid ""
963
  "Provide a specific product free when purchasing another product."
964
  "<br><br>Instead of automatically adding, if you wish to choose the free "
966
  "discounted only when the user manually adds the product to cart."
967
  msgstr ""
968
 
969
+ #: v1/includes/discount-base.php:1211
970
  msgid ""
971
  "Used to provide BOGO discount within categories.<br><br>Example 1: Buy 2 "
972
  "from Category A and get 1 free from the same Category A.<br>Example 2: Buy "
974
  "B."
975
  msgstr ""
976
 
977
+ #: v1/includes/discount-base.php:1212
978
  msgid ""
979
  "This allows you to offer the cheapest product in cart for free (or at a "
980
  "limited percentage like 50%)"
981
  msgstr ""
982
 
983
+ #: v1/includes/discount-base.php:1213
984
  #, php-format
985
  msgid ""
986
  "<span class=\"wdr_desc_text\">Useful for providing a discount on store wide "
988
  "\">Read docs</a>.</span>"
989
  msgstr ""
990
 
991
+ #: v1/includes/discount-base.php:1214
992
  #, php-format
993
  msgid ""
994
  "<span class=\"wdr_desc_text\">Useful for providing a discount on selected "
998
  "\">Read docs</a>.</span>"
999
  msgstr ""
1000
 
1001
+ #: v1/includes/discount-base.php:1215
1002
  #, php-format
1003
  msgid ""
1004
  "<span class=\"wdr_desc_text\">Useful for providing a discount on a specific "
1007
  "<a href=\"%s\">Read docs</a>.</span>"
1008
  msgstr ""
1009
 
1010
+ #: v1/includes/discount-base.php:1216
1011
  #, php-format
1012
  msgid ""
1013
  "<span class=\"wdr_desc_text\">Useful to offer discount based on attributes. "
1016
  "defined in WooCommerce -> Attributes. <a href=\"%s\">Read docs</a>.</span>"
1017
  msgstr ""
1018
 
1019
+ #: v1/includes/discount-base.php:1302 v2/App/Controllers/ManageDiscount.php:849
1020
  #, php-format
1021
  msgid ""
1022
  "Sorry, it is not possible to apply coupon <b>\"%s\"</b> as you already have "
1023
  "a discount applied in cart."
1024
  msgstr ""
1025
 
1026
+ #: v1/includes/discount-base.php:1357 v1/view/includes/menu.php:18
1027
  #: v2/App/Controllers/Admin/Settings.php:65
1028
  #: v2/App/Controllers/Admin/Tabs/GeneralSettings.php:23
1029
  msgid "Settings"
1030
  msgstr ""
1031
 
1032
+ #: v1/includes/pricing-rules.php:3208 v1/view/view-pricing-rules.php:642
1033
  msgid "Buy"
1034
  msgstr ""
1035
 
1036
+ #: v1/includes/pricing-rules.php:3212
1037
  msgid " less than or equal to "
1038
  msgstr ""
1039
 
1040
+ #: v1/includes/pricing-rules.php:3212 v1/includes/pricing-rules.php:3218
1041
  msgid " Quantity"
1042
  msgstr ""
1043
 
1044
+ #: v1/includes/pricing-rules.php:3215
1045
  msgid " Quantity "
1046
  msgstr ""
1047
 
1048
+ #: v1/includes/pricing-rules.php:3222
1049
  msgid " or more Quantity"
1050
  msgstr ""
1051
 
1052
+ #: v1/includes/pricing-rules.php:3231
1053
  msgid " any "
1054
  msgstr ""
1055
 
1056
+ #: v1/includes/pricing-rules.php:3231
1057
  msgid " products from "
1058
  msgstr ""
1059
 
1060
+ #: v1/includes/pricing-rules.php:3238
1061
  msgid " in each products"
1062
  msgstr ""
1063
 
1064
+ #: v1/includes/pricing-rules.php:3250
1065
  msgid " and get discount on "
1066
  msgstr ""
1067
 
1068
+ #: v1/includes/pricing-rules.php:3253
1069
  msgid " first "
1070
  msgstr ""
1071
 
1072
+ #: v1/includes/pricing-rules.php:3255 v1/includes/pricing-rules.php:3259
1073
  msgid " quantity of product(s) - "
1074
  msgstr ""
1075
 
1076
+ #: v1/includes/pricing-rules.php:3257
1077
  msgid " after first "
1078
  msgstr ""
1079
 
1080
+ #: v1/includes/pricing-rules.php:3275
1081
  msgid "Category(ies) "
1082
  msgstr ""
1083
 
1084
+ #: v1/includes/pricing-rules.php:3346
1085
  msgid "Get "
1086
  msgstr ""
1087
 
1088
+ #: v1/includes/pricing-rules.php:3348
1089
  #, php-format
1090
  msgid "% discount in "
1091
  msgstr ""
1092
 
1093
+ #: v1/includes/pricing-rules.php:3351
1094
  msgid "same product"
1095
  msgstr ""
1096
 
1097
+ #: v1/includes/pricing-rules.php:3353
1098
  msgid "any cheapest one from cart"
1099
  msgstr ""
1100
 
1101
+ #: v1/includes/pricing-rules.php:3356
1102
  msgid "any cheapest one of "
1103
  msgstr ""
1104
 
1105
+ #: v1/includes/pricing-rules.php:3361
1106
  msgid " quantity of any "
1107
  msgstr ""
1108
 
1109
+ #: v1/includes/pricing-rules.php:3363
1110
  msgid " cheapest item "
1111
  msgstr ""
1112
 
1113
+ #: v1/includes/pricing-rules.php:3366
1114
  msgid " quantity of cheapest item "
1115
  msgstr ""
1116
 
1117
+ #: v1/includes/pricing-rules.php:3370
1118
  msgid "from the category "
1119
  msgstr ""
1120
 
1121
+ #: v1/includes/pricing-rules.php:3392
1122
  #, php-format
1123
  msgid "%s for %s Quantity(s)"
1124
  msgstr ""
1125
 
1126
+ #: v1/includes/pricing-rules.php:3394
1127
  #, php-format
1128
  msgid "%s as price per unit"
1129
  msgstr ""
1413
  "conditions"
1414
  msgstr ""
1415
 
1416
+ #: v1/view/documentation.php:72 v2/App/Helpers/Helper.php:166
1417
  msgid "Category Combination"
1418
  msgstr ""
1419
 
1437
  #: v1/view/template/discount-table.php:42 v1/view/view-cart-rules.php:756
1438
  #: v1/view/view-pricing-rules.php:708 v2/App/Controllers/Admin/Settings.php:443
1439
  #: v2/App/Views/Admin/Rules/Discounts/Bulk.php:59
1440
+ #: v2/App/Views/Admin/Rules/Manage.php:195
1441
  msgid "Discount"
1442
  msgstr ""
1443
 
2049
  msgstr ""
2050
 
2051
  #: v1/view/view-cart-rules.php:75 v1/view/view-pricing-rules.php:57
2052
+ #: v2/App/Views/Admin/Rules/Manage.php:20
2053
+ #: v2/App/Views/Admin/Rules/Manage.php:24
2054
+ #: v2/App/Views/Admin/Rules/Manage.php:32
2055
+ #: v2/App/Views/Admin/Rules/Manage.php:36
2056
+ #: v2/App/Views/Admin/Rules/Manage.php:44
2057
  msgid "This rule is not running currently: "
2058
  msgstr ""
2059
 
2068
  msgstr ""
2069
 
2070
  #: v1/view/view-cart-rules.php:98 v1/view/view-pricing-rules.php:81
2071
+ #: v2/App/Controllers/Admin/Tabs/Statistics.php:37
2072
  msgid "Rule Name"
2073
  msgstr ""
2074
 
2370
  msgid "Do not use"
2371
  msgstr ""
2372
 
2373
+ #: v1/view/view-pricing-rules.php:394 v2/App/Helpers/Helper.php:164
2374
  msgid "Coupon"
2375
  msgstr ""
2376
 
2395
  msgstr ""
2396
 
2397
  #: v1/view/view-pricing-rules.php:484 v2/App/Conditions/CartSubTotal.php:17
2398
+ #: v2/App/Helpers/Helper.php:155
2399
  msgid "Subtotal"
2400
  msgstr ""
2401
 
2687
  msgstr ""
2688
 
2689
  #: v2/App/Controllers/Admin/Settings.php:440
2690
+ #: v2/App/Views/Admin/Rules/Manage.php:149
2691
  msgid "Filter"
2692
  msgstr ""
2693
 
2947
  msgid "<b>This rule is not running currently:</b> Validity expired"
2948
  msgstr ""
2949
 
2950
+ #: v2/App/Controllers/Admin/Tabs/Compatible.php:23
2951
  msgid "Compatibility"
2952
  msgstr ""
2953
 
2975
  msgid "Date"
2976
  msgstr ""
2977
 
2978
+ #: v2/App/Controllers/Admin/Tabs/Statistics.php:27
2979
  msgid "Reports"
2980
  msgstr ""
2981
 
2982
+ #: v2/App/Controllers/Admin/Tabs/Statistics.php:44
2983
  msgid "All Rules"
2984
  msgstr ""
2985
 
2986
+ #: v2/App/Controllers/Admin/Tabs/Statistics.php:45
2987
+ #: v2/App/Controllers/Admin/Tabs/Statistics.php:51
2988
  msgid "Rule"
2989
  msgstr ""
2990
 
2991
+ #: v2/App/Controllers/Admin/Tabs/Statistics.php:50
2992
  msgid "All Rules (except cart adjustment type)"
2993
  msgstr ""
2994
 
3022
  msgid "Bulk Discount"
3023
  msgstr ""
3024
 
3025
+ #: v2/App/Controllers/ManageDiscount.php:663
3026
  msgid "cart discount"
3027
  msgstr ""
3028
 
3029
+ #: v2/App/Controllers/ManageDiscount.php:863
3030
  msgid "Coupon code applied successfully."
3031
  msgstr ""
3032
 
3033
+ #: v2/App/Helpers/Helper.php:150
 
 
 
 
3034
  msgid "Include additional conditions (if necessary)"
3035
  msgstr ""
3036
 
3037
+ #: v2/App/Helpers/Helper.php:151
3038
  msgid "Popular conditions:"
3039
  msgstr ""
3040
 
3041
+ #: v2/App/Helpers/Helper.php:156
3042
  msgid "User role"
3043
  msgstr ""
3044
 
3045
+ #: v2/App/Helpers/Helper.php:157
3046
  msgid "Days & Time"
3047
  msgstr ""
3048
 
3049
+ #: v2/App/Helpers/Helper.php:159
3050
  msgid "Payment Method"
3051
  msgstr ""
3052
 
3053
+ #: v2/App/Helpers/Helper.php:165
3054
  msgid "Shipping Address"
3055
  msgstr ""
3056
 
3057
+ #: v2/App/Helpers/Helper.php:167
3058
  msgid "Product Combination"
3059
  msgstr ""
3060
 
3061
+ #: v2/App/Helpers/Helper.php:168
3062
  msgid "Quantities/Line items"
3063
  msgstr ""
3064
 
3065
+ #: v2/App/Helpers/Helper.php:182
3066
  msgid ""
3067
  "Individual Product : \n"
3068
  " This counts the total quantity of each product / line item "
3077
  "variant because WooCommerce considers a variant as a product itself."
3078
  msgstr ""
3079
 
3080
+ #: v2/App/Helpers/Helper.php:197
3081
  msgid ""
3082
  "Filter set above :\n"
3083
  " This will count the quantities of products set in the 'Filter' "
3091
  "1 quantity each of X, Y and Z from Category A, then the count here is 3."
3092
  msgstr ""
3093
 
3094
+ #: v2/App/Helpers/Helper.php:209
3095
  msgid ""
3096
  "All variants in each product together :\n"
3097
  " Useful when applying discounts based on variable products and "
3102
  "Medium, 6 of Product A - Large, then the count will be: 6+4+2 = 12\n"
3103
  msgstr ""
3104
 
3105
+ #: v2/App/Helpers/Helper.php:258
 
 
 
 
3106
  msgid "Update now"
3107
  msgstr ""
3108
 
3109
+ #: v2/App/Helpers/Helper.php:263
3110
  #, php-format
3111
  msgid ""
3112
  "You are using a lower version of our <b>Woo Discount Rules PRO 2.0</b> "
3283
  msgid "discount"
3284
  msgstr ""
3285
 
3286
+ #: v2/App/Helpers/Rule.php:1246 v2/App/Helpers/Rule.php:1346
3287
+ #: v2/App/Views/Admin/Tabs/ImportExport.php:99
3288
  msgid "Untitled Rule"
3289
  msgstr ""
3290
 
3291
+ #: v2/App/Helpers/Validation.php:137 v2/App/Helpers/Validation.php:142
3292
+ #: v2/App/Helpers/Validation.php:308
3293
+ msgid "Invalid characters"
3294
+ msgstr ""
3295
+
3296
+ #: v2/App/Helpers/Validation.php:138
3297
+ msgid ""
3298
+ "Accepts only letters a-z, numbers 0-9 and spaces with special characters"
3299
+ msgstr ""
3300
+
3301
+ #: v2/App/Helpers/Validation.php:139
3302
+ msgid "Accepts only numbers 0-9 and one dot"
3303
+ msgstr ""
3304
+
3305
+ #: v2/App/Helpers/Validation.php:140
3306
+ msgid "Accepts only 0 or 1"
3307
+ msgstr ""
3308
+
3309
+ #: v2/App/Helpers/Validation.php:141
3310
+ msgid "Accepts only hex color code"
3311
+ msgstr ""
3312
+
3313
+ #: v2/App/Helpers/Validation.php:309
3314
+ msgid "Accept only yes, on, 1, true"
3315
+ msgstr ""
3316
+
3317
+ #: v2/App/Helpers/Validation.php:310
3318
+ msgid "Should not contain any tags"
3319
+ msgstr ""
3320
+
3321
+ #: v2/App/Helpers/Validation.php:311
3322
+ msgid "Should not contain any tags and special characters"
3323
+ msgstr ""
3324
+
3325
+ #: v2/App/Helpers/Validation.php:433
3326
+ msgid "Validation error"
3327
+ msgstr ""
3328
+
3329
  #: v2/App/Helpers/Woocommerce.php:922
3330
  msgid "Sunday"
3331
  msgstr ""
3934
  msgid "Select Products"
3935
  msgstr ""
3936
 
3937
+ #: v2/App/Views/Admin/Rules/Manage.php:20
3938
  msgid " Start date and time is set in the future date"
3939
  msgstr ""
3940
 
3941
+ #: v2/App/Views/Admin/Rules/Manage.php:24
3942
+ #: v2/App/Views/Admin/Rules/Manage.php:36
3943
+ #: v2/App/Views/Admin/Rules/Manage.php:44
3944
  msgid " Rule reached maximum usage limit "
3945
  msgstr ""
3946
 
3947
+ #: v2/App/Views/Admin/Rules/Manage.php:32
3948
  msgid " Validity expired"
3949
  msgstr ""
3950
 
3951
+ #: v2/App/Views/Admin/Rules/Manage.php:64
3952
  msgid "Enable?"
3953
  msgstr ""
3954
 
3955
+ #: v2/App/Views/Admin/Rules/Manage.php:73
3956
  msgid "Apply this rule if matched and ignore all other rules"
3957
  msgstr ""
3958
 
3959
+ #: v2/App/Views/Admin/Rules/Manage.php:82
3960
  msgid "#Rule ID: "
3961
  msgstr ""
3962
 
3963
+ #: v2/App/Views/Admin/Rules/Manage.php:89
3964
  msgid "Save & Close"
3965
  msgstr ""
3966
 
3967
+ #: v2/App/Views/Admin/Rules/Manage.php:92
3968
  msgid "Cancel"
3969
  msgstr ""
3970
 
3971
+ #: v2/App/Views/Admin/Rules/Manage.php:101
3972
  msgid "Choose a discount type"
3973
  msgstr ""
3974
 
3975
+ #: v2/App/Views/Admin/Rules/Manage.php:105
3976
  msgid "Select Discount Type"
3977
  msgstr ""
3978
 
3979
+ #: v2/App/Views/Admin/Rules/Manage.php:151
3980
  msgid ""
3981
  "Choose which <b>gets</b> discount (products/categories/attributes/SKU and so "
3982
  "on )"
3983
  msgstr ""
3984
 
3985
+ #: v2/App/Views/Admin/Rules/Manage.php:152
3986
  msgid "Note : You can also exclude products/categories."
3987
  msgstr ""
3988
 
3989
+ #: v2/App/Views/Admin/Rules/Manage.php:197
3990
  msgid "Select discount type and its value (percentage/price/fixed price)"
3991
  msgstr ""
3992
 
4143
  msgid "Go PRO"
4144
  msgstr ""
4145
 
4146
+ #: v2/App/Views/Admin/Tabs/ImportExport.php:13
4147
  msgid "Export tool"
4148
  msgstr ""
4149
 
4150
+ #: v2/App/Views/Admin/Tabs/ImportExport.php:19
4151
  msgid "Export"
4152
  msgstr ""
4153
 
4154
+ #: v2/App/Views/Admin/Tabs/ImportExport.php:29
4155
+ #: v2/App/Views/Admin/Tabs/ImportExport.php:155
4156
  msgid "Import Tool"
4157
  msgstr ""
4158
 
4159
+ #: v2/App/Views/Admin/Tabs/ImportExport.php:130
4160
  msgid "<b style=\"color: green;\">Rules Imported successfully</b>"
4161
  msgstr ""
4162
 
4163
+ #: v2/App/Views/Admin/Tabs/ImportExport.php:133
4164
  msgid "<b style=\"color: red;\">Problem in Importing CSV Data</b>"
4165
  msgstr ""
4166
 
4167
+ #: v2/App/Views/Admin/Tabs/ImportExport.php:146
4168
  msgid "Import"
4169
  msgstr ""
4170
 
4171
+ #: v2/App/Views/Admin/Tabs/ImportExport.php:156
4172
  msgid ""
4173
  "Unlock this feature by <a href=\"https://www.flycart.org/products/wordpress/"
4174
  "woocommerce-discount-rules\" target=\"_blank\">Upgrading to Pro</a>"
4453
  msgid "Text to show when rule applied"
4454
  msgstr ""
4455
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4456
  #: v2/App/Views/Admin/Tabs/settings.php:431
4457
  msgid "On-Sale page"
4458
  msgstr ""
4461
  msgid "Select rules for the On Sale Page"
4462
  msgstr ""
4463
 
4464
+ #: v2/App/Views/Admin/Tabs/settings.php:451
4465
  msgid "Type the name of the rule to select it"
4466
  msgstr ""
4467
 
4468
+ #: v2/App/Views/Admin/Tabs/settings.php:459
4469
  msgid "All active rules"
4470
  msgstr ""
4471
 
4473
  msgid "Save and Build Index"
4474
  msgstr ""
4475
 
4476
+ #: v2/App/Views/Admin/Tabs/settings.php:485
4477
+ msgid ""
4478
+ "Unlock this feature by <a href='https://www.flycart.org/products/wordpress/"
4479
+ "woocommerce-discount-rules?utm_source=woo-discount-rules-"
4480
+ "v2&utm_campaign=doc&utm_medium=text-click&utm_content=unlock_pro' "
4481
+ "target='_blank'>Upgrading to Pro</a>"
4482
+ msgstr ""
4483
+
4484
  #: v2/App/Views/Admin/Tabs/settings.php:493
4485
  msgid ""
4486
  "ShortCode to load all products which has discount through Woo Discount Rules"
4546
  #: v2/App/Views/Admin/Tabs/settings.php:669
4547
  #: v2/App/Views/Admin/Tabs/settings.php:715
4548
  #: v2/App/Views/Admin/Tabs/settings.php:782
4549
+ #: v2/App/Views/Templates/discount_table.php:116
4550
  msgid " flat"
4551
  msgstr ""
4552
 
4615
  msgid "15"
4616
  msgstr ""
4617
 
4618
+ #: v2/App/Views/Templates/discount_table.php:111
4619
  msgid " (in cart)"
4620
  msgstr ""
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: https://flycart.org/
4
  Tags: woocommerce, coupons, discounts, dynamic pricing, Buy One Get One Free, pricing deals, bulk discount, discount
5
  Requires at least: 4.4.1
6
  Tested up to: 5.5
7
- Stable tag: 2.1.2
8
  License: GPLv3 or later
9
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
10
 
@@ -336,6 +336,12 @@ Discount - Enter minimum & Maximum quantity -> Adjustment Type -> Product Discou
336
 
337
  == Changelog ==
338
 
 
 
 
 
 
 
339
  = 2.1.2 - 22/08/20 =
340
  * Fix - Security fix: though a major release was made in 2.1.0 in August 13th, a few sites might had older versions. In case, they were affected due to cross-site scripting, this fix will clean up the html before displaying in the front end.
341
 
4
  Tags: woocommerce, coupons, discounts, dynamic pricing, Buy One Get One Free, pricing deals, bulk discount, discount
5
  Requires at least: 4.4.1
6
  Tested up to: 5.5
7
+ Stable tag: 2.2.0
8
  License: GPLv3 or later
9
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
10
 
336
 
337
  == Changelog ==
338
 
339
+ = 2.2.0 - 02/09/20 =
340
+ * Fix - Security checks improved.
341
+ * Fix - Taxonomy not listed in sale page.
342
+ * Improvement - Front end script improved.
343
+ * Improvement - Disable BXGY auto add when product not in stock.
344
+
345
  = 2.1.2 - 22/08/20 =
346
  * Fix - Security fix: though a major release was made in 2.1.0 in August 13th, a few sites might had older versions. In case, they were affected due to cross-site scripting, this fix will clean up the html before displaying in the front end.
347
 
v1/assets/js/app.js CHANGED
@@ -442,12 +442,13 @@ function wooo_discount_range_altered() {
442
  event.preventDefault();
443
  var current = $(this);
444
  var id = $(this).attr('id');
 
445
  id = id.replace('state_', '');
446
  $.ajax({
447
  url: ajax_url,
448
  type: 'POST',
449
  dataType: "json",
450
- data: {action: 'UpdateStatus', id: id, from: 'pricing-rules'},
451
  success: function (response) {
452
  // After Status Changed.
453
  if (response.status == 'Disable') {
@@ -472,13 +473,14 @@ function wooo_discount_range_altered() {
472
  event.preventDefault();
473
  var current = $(this);
474
  var id = $(this).attr('id');
 
475
  id = id.replace('delete_', '');
476
  var confirm_delete = confirm(woo_discount_localization.are_you_sure_to_remove);
477
  if (confirm_delete) {
478
  $.ajax({
479
  url: ajax_url,
480
  type: 'POST',
481
- data: {action: 'RemoveRule', id: id, from: 'pricing-rules'},
482
  success: function () {
483
  // After Removed.
484
  current.closest('tr').remove();
@@ -662,10 +664,11 @@ function wooo_discount_range_altered() {
662
  var product_list = '';
663
  var products_list = '';
664
  var loader = $('.woo_discount_loader_outer > .woo_discount_loader');
 
665
  $.ajax({
666
  url: ajax_url,
667
  type: 'POST',
668
- data: {action: 'loadProductSelectBox', name: 'discount_rule['+count+'][purchase_history_products]'},
669
  beforeSend: function() {
670
  loader.show();
671
  },
@@ -681,7 +684,7 @@ function wooo_discount_range_altered() {
681
  $.ajax({
682
  url: ajax_url,
683
  type: 'POST',
684
- data: {action: 'loadProductSelectBox', name: 'discount_rule['+count+'][products]'},
685
  beforeSend: function() {
686
  loader.show();
687
  },
@@ -1099,12 +1102,13 @@ function wooo_discount_range_altered() {
1099
  event.preventDefault();
1100
  var current = $(this);
1101
  var id = $(this).attr('id');
 
1102
  id = id.replace('state_', '');
1103
  $.ajax({
1104
  url: ajax_url,
1105
  type: 'POST',
1106
  dataType: "json",
1107
- data: {action: 'UpdateStatus', id: id, from: 'cart-rules'},
1108
  success: function (response) {
1109
  // After Status Changed.
1110
  if (response.status == 'Disable') {
@@ -1129,13 +1133,14 @@ function wooo_discount_range_altered() {
1129
  event.preventDefault();
1130
  var current = $(this);
1131
  var id = $(this).attr('id');
 
1132
  id = id.replace('delete_', '');
1133
  var confirm_delete = confirm(woo_discount_localization.are_you_sure_to_remove);
1134
  if (confirm_delete) {
1135
  $.ajax({
1136
  url: ajax_url,
1137
  type: 'POST',
1138
- data: {action: 'RemoveRule', id: id, from: 'cart-rules'},
1139
  success: function () {
1140
  // After Removed.
1141
  current.closest('tr').remove();
@@ -1305,10 +1310,11 @@ function wooo_discount_range_altered() {
1305
  function createDuplicateRule(id, type) {
1306
  if(id != undefined && type != undefined){
1307
  var loader = $('.woo_discount_loader_outer > .woo_discount_loader');
 
1308
  $.ajax({
1309
  url: ajax_url,
1310
  type: 'POST',
1311
- data: {'action': 'createDuplicateRule', 'id': id, 'type': type},
1312
  beforeSend: function() {
1313
  loader.show();
1314
  },
@@ -1403,10 +1409,11 @@ function wooo_discount_range_altered() {
1403
  $('#refresh_wdr_cache').on('click', function (event) {
1404
  event.preventDefault();
1405
  var loader = $('.woo_discount_loader_outer > .woo_discount_loader');
 
1406
  $.ajax({
1407
  url: ajax_url,
1408
  type: 'POST',
1409
- data: {action: 'resetWDRCache'},
1410
  beforeSend: function() {
1411
  loader.show();
1412
  },
@@ -1512,6 +1519,7 @@ function wooo_discount_range_altered() {
1512
  });
1513
 
1514
  $('.coupons_selectbox_multi_select_wdr').on('trigger_ajax_select_wdr', function (event) {
 
1515
  $('.coupons_selectbox_multi_select_wdr').selectWoo({
1516
  ajax: {
1517
  url: ajax_url,
@@ -1523,6 +1531,7 @@ function wooo_discount_range_altered() {
1523
  return {
1524
  q: params.term, // search term
1525
  page: params.page,
 
1526
  action: 'loadCoupons'
1527
  };
1528
  },
442
  event.preventDefault();
443
  var current = $(this);
444
  var id = $(this).attr('id');
445
+ var wdr_nonce = $('input[name="wdr_nonce"]').val();
446
  id = id.replace('state_', '');
447
  $.ajax({
448
  url: ajax_url,
449
  type: 'POST',
450
  dataType: "json",
451
+ data: {action: 'UpdateStatus', id: id, from: 'pricing-rules', wdr_nonce: wdr_nonce},
452
  success: function (response) {
453
  // After Status Changed.
454
  if (response.status == 'Disable') {
473
  event.preventDefault();
474
  var current = $(this);
475
  var id = $(this).attr('id');
476
+ var wdr_nonce = $('input[name="wdr_nonce"]').val();
477
  id = id.replace('delete_', '');
478
  var confirm_delete = confirm(woo_discount_localization.are_you_sure_to_remove);
479
  if (confirm_delete) {
480
  $.ajax({
481
  url: ajax_url,
482
  type: 'POST',
483
+ data: {action: 'RemoveRule', id: id, from: 'pricing-rules', wdr_nonce: wdr_nonce},
484
  success: function () {
485
  // After Removed.
486
  current.closest('tr').remove();
664
  var product_list = '';
665
  var products_list = '';
666
  var loader = $('.woo_discount_loader_outer > .woo_discount_loader');
667
+ var wdr_nonce = $('input[name="wdr_search_nonce"]').val();
668
  $.ajax({
669
  url: ajax_url,
670
  type: 'POST',
671
+ data: {action: 'loadProductSelectBox', name: 'discount_rule['+count+'][purchase_history_products]', wdr_nonce: wdr_nonce},
672
  beforeSend: function() {
673
  loader.show();
674
  },
684
  $.ajax({
685
  url: ajax_url,
686
  type: 'POST',
687
+ data: {action: 'loadProductSelectBox', name: 'discount_rule['+count+'][products]', wdr_nonce: wdr_nonce},
688
  beforeSend: function() {
689
  loader.show();
690
  },
1102
  event.preventDefault();
1103
  var current = $(this);
1104
  var id = $(this).attr('id');
1105
+ var wdr_nonce = $('input[name="wdr_nonce"]').val();
1106
  id = id.replace('state_', '');
1107
  $.ajax({
1108
  url: ajax_url,
1109
  type: 'POST',
1110
  dataType: "json",
1111
+ data: {action: 'UpdateStatus', id: id, from: 'cart-rules', wdr_nonce: wdr_nonce},
1112
  success: function (response) {
1113
  // After Status Changed.
1114
  if (response.status == 'Disable') {
1133
  event.preventDefault();
1134
  var current = $(this);
1135
  var id = $(this).attr('id');
1136
+ var wdr_nonce = $('input[name="wdr_nonce"]').val();
1137
  id = id.replace('delete_', '');
1138
  var confirm_delete = confirm(woo_discount_localization.are_you_sure_to_remove);
1139
  if (confirm_delete) {
1140
  $.ajax({
1141
  url: ajax_url,
1142
  type: 'POST',
1143
+ data: {action: 'RemoveRule', id: id, from: 'cart-rules', wdr_nonce: wdr_nonce},
1144
  success: function () {
1145
  // After Removed.
1146
  current.closest('tr').remove();
1310
  function createDuplicateRule(id, type) {
1311
  if(id != undefined && type != undefined){
1312
  var loader = $('.woo_discount_loader_outer > .woo_discount_loader');
1313
+ var wdr_nonce = $('input[name="wdr_nonce"]').val();
1314
  $.ajax({
1315
  url: ajax_url,
1316
  type: 'POST',
1317
+ data: {'action': 'createDuplicateRule', 'id': id, 'type': type, 'wdr_nonce': wdr_nonce},
1318
  beforeSend: function() {
1319
  loader.show();
1320
  },
1409
  $('#refresh_wdr_cache').on('click', function (event) {
1410
  event.preventDefault();
1411
  var loader = $('.woo_discount_loader_outer > .woo_discount_loader');
1412
+ var wdr_nonce = $('input[name="wdr_nonce"]').val();
1413
  $.ajax({
1414
  url: ajax_url,
1415
  type: 'POST',
1416
+ data: {action: 'resetWDRCache', wdr_nonce: wdr_nonce},
1417
  beforeSend: function() {
1418
  loader.show();
1419
  },
1519
  });
1520
 
1521
  $('.coupons_selectbox_multi_select_wdr').on('trigger_ajax_select_wdr', function (event) {
1522
+ var wdr_nonce = $('input[name="wdr_search_nonce"]').val();
1523
  $('.coupons_selectbox_multi_select_wdr').selectWoo({
1524
  ajax: {
1525
  url: ajax_url,
1531
  return {
1532
  q: params.term, // search term
1533
  page: params.page,
1534
+ wdr_nonce: wdr_nonce,
1535
  action: 'loadCoupons'
1536
  };
1537
  },
v1/helper/general-helper.php CHANGED
@@ -1220,5 +1220,62 @@ if ( ! class_exists( 'FlycartWooDiscountRulesGeneralHelper' ) ) {
1220
 
1221
  return $sub_total;
1222
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1223
  }
1224
  }
1220
 
1221
  return $sub_total;
1222
  }
1223
+
1224
+ /**
1225
+ * Create nonce for v1
1226
+ * @param int $action
1227
+ * @return mixed
1228
+ */
1229
+ public static function createNonce($action = -1){
1230
+ return wp_create_nonce($action);
1231
+ }
1232
+
1233
+ /**
1234
+ * Verify nonce
1235
+ * @param $nonce
1236
+ * @param int $action
1237
+ * @return bool
1238
+ */
1239
+ protected static function verifyNonce($nonce, $action = -1 ){
1240
+ if (wp_verify_nonce($nonce, $action)){
1241
+ return true;
1242
+ } else {
1243
+ return false;
1244
+ }
1245
+ }
1246
+
1247
+ /**
1248
+ * check valid nonce for v1
1249
+ * @param $method
1250
+ * @param null $wdr_nonce
1251
+ * @return bool
1252
+ */
1253
+ public static function validateRequest($method, $wdr_nonce = null){
1254
+ if($wdr_nonce === null){
1255
+ if(isset($_REQUEST['wdr_nonce']) && !empty($_REQUEST['wdr_nonce'])){
1256
+ if(self::verifyNonce(wp_unslash($_REQUEST['wdr_nonce']), $method)){
1257
+ return true;
1258
+ }
1259
+ }
1260
+ } else {
1261
+ if(self::verifyNonce(wp_unslash($wdr_nonce), $method)){
1262
+ return true;
1263
+ }
1264
+ }
1265
+
1266
+ die(__('Invalid token', 'woo-discount-rules'));
1267
+ }
1268
+
1269
+ /**
1270
+ * Has admin privilage to change rule data
1271
+ * @return bool
1272
+ */
1273
+ public static function hasAdminPrivilege(){
1274
+ if (current_user_can( 'manage_woocommerce' )) {
1275
+ return true;
1276
+ } else {
1277
+ return false;
1278
+ }
1279
+ }
1280
  }
1281
  }
v1/helper/purchase.php CHANGED
@@ -165,27 +165,32 @@ if ( ! class_exists( 'FlycartWooDiscountRulesPurchase' ) ) {
165
  $params = array();
166
  if (!isset($request['data'])) return false;
167
  parse_str($request['data'], $params);
168
-
169
- $this->force_license_check = true;
170
-
171
  $resp = array();
172
- if (empty($params['license_key'])) {
173
- $resp['error'] = esc_html__('Please enter a valid license key', 'woo-discount-rules');
174
- echo json_encode( $resp );
175
- die();
176
- }
 
 
 
 
 
177
 
178
- $base = new FlycartWooDiscountBase();
179
- $base->saveConfig(1);
180
 
181
- if ( $this->validateLicenseKey() ) {
182
- $resp['success'] = esc_html__('License key check : Passed.', 'woo-discount-rules');
183
- // TODO: passed tick mark with a flag
184
- } else {
185
- // return an error
186
- $resp['error'] = esc_html__('License key seems to be Invalid. Please enter a valid license key', 'woo-discount-rules');
 
 
 
187
  }
188
-
189
  echo json_encode( $resp );
190
  die();
191
  }
165
  $params = array();
166
  if (!isset($request['data'])) return false;
167
  parse_str($request['data'], $params);
 
 
 
168
  $resp = array();
169
+ if(isset($params['wdr_nonce']) && !empty($params['wdr_nonce'])) {
170
+ if (FlycartWooDiscountRulesGeneralHelper::hasAdminPrivilege()) {
171
+ if (FlycartWooDiscountRulesGeneralHelper::validateRequest('wdr_save_rule_config', $params['wdr_nonce'])) {
172
+ $this->force_license_check = true;
173
+
174
+ if (empty($params['license_key'])) {
175
+ $resp['error'] = esc_html__('Please enter a valid license key', 'woo-discount-rules');
176
+ echo json_encode( $resp );
177
+ die();
178
+ }
179
 
180
+ $base = new FlycartWooDiscountBase();
181
+ $base->saveConfig(1);
182
 
183
+ if ( $this->validateLicenseKey() ) {
184
+ $resp['success'] = esc_html__('License key check : Passed.', 'woo-discount-rules');
185
+ // TODO: passed tick mark with a flag
186
+ } else {
187
+ // return an error
188
+ $resp['error'] = esc_html__('License key seems to be Invalid. Please enter a valid license key', 'woo-discount-rules');
189
+ }
190
+ }
191
+ }
192
  }
193
+
194
  echo json_encode( $resp );
195
  die();
196
  }
v1/includes/discount-base.php CHANGED
@@ -186,34 +186,41 @@ if (!class_exists('FlycartWooDiscountBase')) {
186
  {
187
  $postData = \FlycartInput\FInput::getInstance();
188
  $id = $postData->get('id', false);
189
- if ($id) {
190
- $status = get_post_meta($id, 'status', false);
191
- if (isset($status[0])) {
192
- $state = ($status[0] == 'publish') ? 'disable' : 'publish';
193
- update_post_meta($id, 'status', $state);
194
- } else {
195
- add_post_meta($id, 'status', 'disable');
196
- $state = 'disable';
197
- }
198
- $meta = get_post_meta($id, '', true);
199
- $status_string = '';
200
- if(!empty($meta)){
201
- if(!isset($meta['status'][0])) $meta['status'][0] = 'disable';
202
- if($meta['status'][0] == 'publish'){
203
- $status_string .= "<span class='wdr_status_active_text alert alert-success'>".esc_html__('Active', 'woo-discount-rules')."</span>";
204
- } else {
205
- $status_string .= "<span class='wdr_status_disabled_text alert alert-danger'>".esc_html__('Disabled', 'woo-discount-rules')."</span>";
206
- }
207
- if($meta['status'][0] == 'publish'){
208
- $date_from = (isset($meta['date_from'][0]) ? $meta['date_from'][0] : false);
209
- $date_to = (isset($meta['date_to'][0]) ? $meta['date_to'][0] : false);
210
- $validate_date_string = FlycartWooDiscountRulesGeneralHelper::validateDateAndTimeWarningTextForListingHTML($date_from, $date_to);
211
- $status_string .= $validate_date_string;
 
 
 
 
 
 
 
 
 
 
212
  }
213
  }
214
- $return_value = array('status' => ucfirst($state), 'status_html' => $status_string);
215
-
216
- echo json_encode($return_value);
217
  }
218
  die();
219
  }
@@ -225,13 +232,20 @@ if (!class_exists('FlycartWooDiscountBase')) {
225
  {
226
  $postData = \FlycartInput\FInput::getInstance();
227
  $id = $postData->get('id', false);
228
- if ($id) {
229
- try {
230
- $id = intval($id);
231
- if (!$id) return false;
232
- wp_delete_post($id);
233
- } catch (Exception $e) {
234
- //
 
 
 
 
 
 
 
235
  }
236
  }
237
  die();
@@ -249,9 +263,14 @@ if (!class_exists('FlycartWooDiscountBase')) {
249
  $params = array();
250
  if (!isset($request['data'])) return false;
251
  parse_str($request['data'], $params);
252
-
253
- $pricing_rule = $this->getInstance('FlycartWooDiscountRulesPricingRules');
254
- $pricing_rule->save($params);
 
 
 
 
 
255
  die();
256
  }
257
 
@@ -269,9 +288,15 @@ if (!class_exists('FlycartWooDiscountBase')) {
269
  $params = array();
270
  if (!isset($request['data'])) return false;
271
  parse_str($request['data'], $params);
272
- $this->parseFormWithRules($params, true);
273
- $pricing_rule = $this->getInstance('FlycartWooDiscountRulesCartRules');
274
- $pricing_rule->save($params);
 
 
 
 
 
 
275
  die();
276
  }
277
 
@@ -283,8 +308,14 @@ if (!class_exists('FlycartWooDiscountBase')) {
283
  public function loadProductSelectBox() {
284
  $postData = \FlycartInput\FInput::getInstance();
285
  $request = $postData->getArray();
286
- if (!isset($request['name'])) return false;
287
- echo FlycartWoocommerceProduct::getProductAjaxSelectBox(array(), $request['name']);
 
 
 
 
 
 
288
  die();
289
  }
290
 
@@ -296,19 +327,26 @@ if (!class_exists('FlycartWooDiscountBase')) {
296
  public function loadCoupons() {
297
  $postData = \FlycartInput\FInput::getInstance();
298
  $request = $postData->getArray();
299
- $page = isset($request['page'])? $request['page']: 1;
300
- $query = isset($request['q'])? $request['q']: '';
301
- $args = array( 'posts_per_page' => 30, 's' => $query,
302
- 'paged' => $page, 'post_type' => 'shop_coupon' );
303
- $posts = get_posts($args);
304
- if(!empty($posts) && count($posts) > 0){
305
- foreach ($posts as $post){
306
- if(function_exists('wc_strtolower')){
307
- $coupon_name = wc_strtolower($post->post_title);
308
- } else {
309
- $coupon_name = strtolower($post->post_title);
 
 
 
 
 
 
 
 
310
  }
311
- $post->post_name = $coupon_name;
312
  }
313
  }
314
 
@@ -489,39 +527,54 @@ if (!class_exists('FlycartWooDiscountBase')) {
489
  parse_str($request['data'], $params);
490
  }
491
 
492
- if(isset($params['coupon_name'])){
493
- $params['coupon_name'] = trim($params['coupon_name']);
494
- }
 
 
 
495
 
496
- if (is_array($request)) {
497
- if(isset($params['show_draft']) && $params['show_draft']){
498
- $params['show_draft'] = 1;
499
- } else {
500
- $params['show_draft'] = 0;
501
- }
502
- foreach ($params as $index => $item) {
503
  // $params[$index] = FlycartWooDiscountRulesGeneralHelper::makeString($item);
504
- $params[$index] = $item;
 
 
 
 
 
 
 
 
 
 
505
  }
506
- $params = json_encode($params);
507
  }
508
 
509
- if (get_option($option_type)) {
510
- update_option($option_type, $params);
511
- } else {
512
- add_option($option_type, $params);
513
- }
514
  if(!$licenceValidate)
515
  die();
516
  }
517
 
518
  public function resetWDRCache(){
519
- $price_discount = $this->getInstance('FlycartWooDiscountRulesPricingRules');
520
- $result = $price_discount->updateLastUpdateTimeOfRule();
521
- if($result){
522
- esc_html_e('Cache cleared successfully', 'woo-discount-rules');
523
- } else {
524
- esc_html_e('Failed to clear cache', 'woo-discount-rules');
 
 
 
 
 
 
 
 
525
  }
526
  die();
527
  }
@@ -631,56 +684,62 @@ if (!class_exists('FlycartWooDiscountBase')) {
631
  public function doBulkAction(){
632
  $postData = \FlycartInput\FInput::getInstance();
633
  $request = $postData->getArray();
634
- if(empty($request['bulk_action'])){
635
- echo esc_html__('Failed to do action', 'woo-discount-rules');exit;
636
- }
637
- $result = array();
638
- $had_action = 0;
639
- if(!empty($request['post'])){
640
- foreach ($request['post'] as $key => $id){
641
- $had_action = 1;
642
- $result[$key] = 0;
643
- if($id){
644
- switch ($request['bulk_action']){
645
- case 'unpublish':
646
- $status = get_post_meta($id, 'status', true);
647
- if (!empty($status)) {
648
- $result[$key] = update_post_meta($id, 'status', 'disable');
649
- }
650
- break;
651
- case 'delete':
652
- try {
653
- $id = intval($id);
654
- if ($id) $result[$key] = wp_delete_post($id);
655
- } catch (Exception $e) {
656
- }
657
- break;
658
- default:
659
- $status = get_post_meta($id, 'status', true);
 
 
 
660
 
661
- if (!empty($status)) {
662
- $result[$key] = update_post_meta($id, 'status', 'publish');
 
 
 
663
  }
664
- break;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
665
  }
666
  }
667
  }
668
  }
669
- if(!$had_action){
670
- echo esc_html__('Failed to do action', 'woo-discount-rules');
671
- } else{
672
- switch ($request['bulk_action']){
673
- case 'unpublish':
674
- echo esc_html__('Disabled successfully', 'woo-discount-rules');
675
- break;
676
- case 'delete':
677
- echo esc_html__('Deleted successfully', 'woo-discount-rules');
678
- break;
679
- default:
680
- echo esc_html__('Enabled successfully', 'woo-discount-rules');
681
- break;
682
- }
683
- }
684
  die();
685
  }
686
 
@@ -693,37 +752,43 @@ if (!class_exists('FlycartWooDiscountBase')) {
693
  if(!$isPro) return false;
694
  $postData = \FlycartInput\FInput::getInstance();
695
  $request = $postData->getArray();
696
- if(!empty($request['id']) && (int)$request['id'] && !empty($request['type'])){
697
- $post = get_post( (int)$request['id'] );
698
- if(!empty($post)){
699
- $post_new = array(
700
- 'post_title' => $post->post_title.' - '.esc_html__('copy', 'woo-discount-rules'),
701
- 'post_name' => $post->post_title.' - '.esc_html__('copy', 'woo-discount-rules'),
702
- 'post_content' => 'New Rule',
703
- 'post_type' => $post->post_type,
704
- 'post_status' => 'publish'
705
- );
706
- $id = wp_insert_post($post_new);
707
- if($id){
708
- /*
709
- * duplicate all post meta just in two SQL queries
710
- */
711
- global $wpdb;
712
- $post_meta_infos = $wpdb->get_results("SELECT meta_key, meta_value FROM $wpdb->postmeta WHERE post_id=$post->ID");
713
- if (count($post_meta_infos)!=0) {
714
- $sql_query = "INSERT INTO $wpdb->postmeta (post_id, meta_key, meta_value) ";
715
- foreach ($post_meta_infos as $meta_info) {
716
- $meta_key = $meta_info->meta_key;
717
- if( $meta_key == 'rule_order' ) $meta_info->meta_value = FlycartWooDiscountRulesGeneralHelper::reOrderRuleIfExists($id, 1, $post->post_type);
718
- if( $meta_key == 'rule_name' ) $meta_info->meta_value = $meta_info->meta_value.' - '.esc_html__('copy', 'woo-discount-rules');
719
- if( $meta_key == 'status' ) $meta_info->meta_value = 'disable';
720
- $meta_value = addslashes($meta_info->meta_value);
721
- $sql_query_sel[]= "SELECT $id, '$meta_key', '$meta_value'";
 
 
 
 
 
 
 
 
 
722
  }
723
- $sql_query.= implode(" UNION ALL ", $sql_query_sel);
724
- $wpdb->query($sql_query);
725
  }
726
- echo esc_html__('Duplicate rule created successfully', 'woo-discount-rules'); die();
727
  }
728
  }
729
  }
186
  {
187
  $postData = \FlycartInput\FInput::getInstance();
188
  $id = $postData->get('id', false);
189
+ $wdr_nonce = $postData->get('wdr_nonce', false);
190
+ if(!empty($wdr_nonce)){
191
+ if(FlycartWooDiscountRulesGeneralHelper::hasAdminPrivilege()) {
192
+ if(FlycartWooDiscountRulesGeneralHelper::validateRequest('wdr_rule_listing', $wdr_nonce)){
193
+ if ($id) {
194
+ $status = get_post_meta($id, 'status', false);
195
+ if (isset($status[0])) {
196
+ $state = ($status[0] == 'publish') ? 'disable' : 'publish';
197
+ update_post_meta($id, 'status', $state);
198
+ } else {
199
+ add_post_meta($id, 'status', 'disable');
200
+ $state = 'disable';
201
+ }
202
+ $meta = get_post_meta($id, '', true);
203
+ $status_string = '';
204
+ if(!empty($meta)){
205
+ if(!isset($meta['status'][0])) $meta['status'][0] = 'disable';
206
+ if($meta['status'][0] == 'publish'){
207
+ $status_string .= "<span class='wdr_status_active_text alert alert-success'>".esc_html__('Active', 'woo-discount-rules')."</span>";
208
+ } else {
209
+ $status_string .= "<span class='wdr_status_disabled_text alert alert-danger'>".esc_html__('Disabled', 'woo-discount-rules')."</span>";
210
+ }
211
+ if($meta['status'][0] == 'publish'){
212
+ $date_from = (isset($meta['date_from'][0]) ? $meta['date_from'][0] : false);
213
+ $date_to = (isset($meta['date_to'][0]) ? $meta['date_to'][0] : false);
214
+ $validate_date_string = FlycartWooDiscountRulesGeneralHelper::validateDateAndTimeWarningTextForListingHTML($date_from, $date_to);
215
+ $status_string .= $validate_date_string;
216
+ }
217
+ }
218
+ $return_value = array('status' => ucfirst($state), 'status_html' => $status_string);
219
+
220
+ echo json_encode($return_value);
221
+ }
222
  }
223
  }
 
 
 
224
  }
225
  die();
226
  }
232
  {
233
  $postData = \FlycartInput\FInput::getInstance();
234
  $id = $postData->get('id', false);
235
+ $wdr_nonce = $postData->get('wdr_nonce', false);
236
+ if(!empty($wdr_nonce)) {
237
+ if (FlycartWooDiscountRulesGeneralHelper::hasAdminPrivilege()) {
238
+ if (FlycartWooDiscountRulesGeneralHelper::validateRequest('wdr_rule_listing', $wdr_nonce)) {
239
+ if ($id) {
240
+ try {
241
+ $id = intval($id);
242
+ if (!$id) return false;
243
+ wp_delete_post($id);
244
+ } catch (Exception $e) {
245
+ //
246
+ }
247
+ }
248
+ }
249
  }
250
  }
251
  die();
263
  $params = array();
264
  if (!isset($request['data'])) return false;
265
  parse_str($request['data'], $params);
266
+ if(isset($params['wdr_nonce']) && !empty($params['wdr_nonce'])){
267
+ if(FlycartWooDiscountRulesGeneralHelper::hasAdminPrivilege()) {
268
+ if(FlycartWooDiscountRulesGeneralHelper::validateRequest('wdr_save_price_rule', $params['wdr_nonce'])){
269
+ $pricing_rule = $this->getInstance('FlycartWooDiscountRulesPricingRules');
270
+ $pricing_rule->save($params);
271
+ }
272
+ }
273
+ }
274
  die();
275
  }
276
 
288
  $params = array();
289
  if (!isset($request['data'])) return false;
290
  parse_str($request['data'], $params);
291
+ if(isset($params['wdr_nonce']) && !empty($params['wdr_nonce'])){
292
+ if(FlycartWooDiscountRulesGeneralHelper::hasAdminPrivilege()) {
293
+ if(FlycartWooDiscountRulesGeneralHelper::validateRequest('wdr_save_cart_rule', $params['wdr_nonce'])){
294
+ $this->parseFormWithRules($params, true);
295
+ $pricing_rule = $this->getInstance('FlycartWooDiscountRulesCartRules');
296
+ $pricing_rule->save($params);
297
+ }
298
+ }
299
+ }
300
  die();
301
  }
302
 
308
  public function loadProductSelectBox() {
309
  $postData = \FlycartInput\FInput::getInstance();
310
  $request = $postData->getArray();
311
+ if(isset($request['wdr_nonce']) && !empty($request['wdr_nonce'])) {
312
+ if (FlycartWooDiscountRulesGeneralHelper::hasAdminPrivilege()) {
313
+ if (FlycartWooDiscountRulesGeneralHelper::validateRequest('wdr_ajax_search_field', $request['wdr_nonce'])) {
314
+ if (!isset($request['name'])) return false;
315
+ echo FlycartWoocommerceProduct::getProductAjaxSelectBox(array(), $request['name']);
316
+ }
317
+ }
318
+ }
319
  die();
320
  }
321
 
327
  public function loadCoupons() {
328
  $postData = \FlycartInput\FInput::getInstance();
329
  $request = $postData->getArray();
330
+ $posts = array();
331
+ if(isset($request['wdr_nonce']) && !empty($request['wdr_nonce'])){
332
+ if(FlycartWooDiscountRulesGeneralHelper::hasAdminPrivilege()) {
333
+ if(FlycartWooDiscountRulesGeneralHelper::validateRequest('wdr_ajax_search_field', $request['wdr_nonce'])){
334
+ $page = isset($request['page'])? $request['page']: 1;
335
+ $query = isset($request['q'])? $request['q']: '';
336
+ $args = array( 'posts_per_page' => 30, 's' => $query,
337
+ 'paged' => $page, 'post_type' => 'shop_coupon' );
338
+ $posts = get_posts($args);
339
+ if(!empty($posts) && count($posts) > 0){
340
+ foreach ($posts as $post){
341
+ if(function_exists('wc_strtolower')){
342
+ $coupon_name = wc_strtolower($post->post_title);
343
+ } else {
344
+ $coupon_name = strtolower($post->post_title);
345
+ }
346
+ $post->post_name = $coupon_name;
347
+ }
348
+ }
349
  }
 
350
  }
351
  }
352
 
527
  parse_str($request['data'], $params);
528
  }
529
 
530
+ if(isset($params['wdr_nonce']) && !empty($params['wdr_nonce'])){
531
+ if(FlycartWooDiscountRulesGeneralHelper::hasAdminPrivilege()) {
532
+ if(FlycartWooDiscountRulesGeneralHelper::validateRequest('wdr_save_rule_config', $params['wdr_nonce'])){
533
+ if(isset($params['coupon_name'])){
534
+ $params['coupon_name'] = trim($params['coupon_name']);
535
+ }
536
 
537
+ if (is_array($request)) {
538
+ if(isset($params['show_draft']) && $params['show_draft']){
539
+ $params['show_draft'] = 1;
540
+ } else {
541
+ $params['show_draft'] = 0;
542
+ }
543
+ foreach ($params as $index => $item) {
544
  // $params[$index] = FlycartWooDiscountRulesGeneralHelper::makeString($item);
545
+ $params[$index] = $item;
546
+ }
547
+ $params = json_encode($params);
548
+ }
549
+
550
+ if (get_option($option_type)) {
551
+ update_option($option_type, $params);
552
+ } else {
553
+ add_option($option_type, $params);
554
+ }
555
+ }
556
  }
 
557
  }
558
 
 
 
 
 
 
559
  if(!$licenceValidate)
560
  die();
561
  }
562
 
563
  public function resetWDRCache(){
564
+ $postData = \FlycartInput\FInput::getInstance();
565
+ $wdr_nonce = $postData->get('wdr_nonce', false);
566
+ if(!empty($wdr_nonce)) {
567
+ if (FlycartWooDiscountRulesGeneralHelper::hasAdminPrivilege()) {
568
+ if (FlycartWooDiscountRulesGeneralHelper::validateRequest('wdr_save_rule_config', $wdr_nonce)) {
569
+ $price_discount = $this->getInstance('FlycartWooDiscountRulesPricingRules');
570
+ $result = $price_discount->updateLastUpdateTimeOfRule();
571
+ if($result){
572
+ esc_html_e('Cache cleared successfully', 'woo-discount-rules');
573
+ } else {
574
+ esc_html_e('Failed to clear cache', 'woo-discount-rules');
575
+ }
576
+ }
577
+ }
578
  }
579
  die();
580
  }
684
  public function doBulkAction(){
685
  $postData = \FlycartInput\FInput::getInstance();
686
  $request = $postData->getArray();
687
+ if(isset($request['wdr_nonce']) && !empty($request['wdr_nonce'])){
688
+ if(FlycartWooDiscountRulesGeneralHelper::hasAdminPrivilege()) {
689
+ if(FlycartWooDiscountRulesGeneralHelper::validateRequest('wdr_rule_listing', $request['wdr_nonce'])){
690
+ if(empty($request['bulk_action'])){
691
+ echo esc_html__('Failed to do action', 'woo-discount-rules');exit;
692
+ }
693
+ $result = array();
694
+ $had_action = 0;
695
+ if(!empty($request['post'])){
696
+ foreach ($request['post'] as $key => $id){
697
+ $had_action = 1;
698
+ $result[$key] = 0;
699
+ if($id){
700
+ switch ($request['bulk_action']){
701
+ case 'unpublish':
702
+ $status = get_post_meta($id, 'status', true);
703
+ if (!empty($status)) {
704
+ $result[$key] = update_post_meta($id, 'status', 'disable');
705
+ }
706
+ break;
707
+ case 'delete':
708
+ try {
709
+ $id = intval($id);
710
+ if ($id) $result[$key] = wp_delete_post($id);
711
+ } catch (Exception $e) {
712
+ }
713
+ break;
714
+ default:
715
+ $status = get_post_meta($id, 'status', true);
716
 
717
+ if (!empty($status)) {
718
+ $result[$key] = update_post_meta($id, 'status', 'publish');
719
+ }
720
+ break;
721
+ }
722
  }
723
+ }
724
+ }
725
+ if(!$had_action){
726
+ echo esc_html__('Failed to do action', 'woo-discount-rules');
727
+ } else{
728
+ switch ($request['bulk_action']){
729
+ case 'unpublish':
730
+ echo esc_html__('Disabled successfully', 'woo-discount-rules');
731
+ break;
732
+ case 'delete':
733
+ echo esc_html__('Deleted successfully', 'woo-discount-rules');
734
+ break;
735
+ default:
736
+ echo esc_html__('Enabled successfully', 'woo-discount-rules');
737
+ break;
738
+ }
739
  }
740
  }
741
  }
742
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
743
  die();
744
  }
745
 
752
  if(!$isPro) return false;
753
  $postData = \FlycartInput\FInput::getInstance();
754
  $request = $postData->getArray();
755
+ if(isset($request['wdr_nonce']) && !empty($request['wdr_nonce'])) {
756
+ if (FlycartWooDiscountRulesGeneralHelper::hasAdminPrivilege()) {
757
+ if (FlycartWooDiscountRulesGeneralHelper::validateRequest('wdr_rule_listing', $request['wdr_nonce'])) {
758
+ if(!empty($request['id']) && (int)$request['id'] && !empty($request['type'])){
759
+ $post = get_post( (int)$request['id'] );
760
+ if(!empty($post)){
761
+ $post_new = array(
762
+ 'post_title' => $post->post_title.' - '.esc_html__('copy', 'woo-discount-rules'),
763
+ 'post_name' => $post->post_title.' - '.esc_html__('copy', 'woo-discount-rules'),
764
+ 'post_content' => 'New Rule',
765
+ 'post_type' => $post->post_type,
766
+ 'post_status' => 'publish'
767
+ );
768
+ $id = wp_insert_post($post_new);
769
+ if($id){
770
+ /*
771
+ * duplicate all post meta just in two SQL queries
772
+ */
773
+ global $wpdb;
774
+ $post_meta_infos = $wpdb->get_results("SELECT meta_key, meta_value FROM $wpdb->postmeta WHERE post_id=$post->ID");
775
+ if (count($post_meta_infos)!=0) {
776
+ $sql_query = "INSERT INTO $wpdb->postmeta (post_id, meta_key, meta_value) ";
777
+ foreach ($post_meta_infos as $meta_info) {
778
+ $meta_key = $meta_info->meta_key;
779
+ if( $meta_key == 'rule_order' ) $meta_info->meta_value = FlycartWooDiscountRulesGeneralHelper::reOrderRuleIfExists($id, 1, $post->post_type);
780
+ if( $meta_key == 'rule_name' ) $meta_info->meta_value = $meta_info->meta_value.' - '.esc_html__('copy', 'woo-discount-rules');
781
+ if( $meta_key == 'status' ) $meta_info->meta_value = 'disable';
782
+ $meta_value = addslashes($meta_info->meta_value);
783
+ $sql_query_sel[]= "SELECT $id, '$meta_key', '$meta_value'";
784
+ }
785
+ $sql_query.= implode(" UNION ALL ", $sql_query_sel);
786
+ $wpdb->query($sql_query);
787
+ }
788
+ echo esc_html__('Duplicate rule created successfully', 'woo-discount-rules'); die();
789
+ }
790
  }
 
 
791
  }
 
792
  }
793
  }
794
  }
v1/includes/pricing-rules.php CHANGED
@@ -2801,7 +2801,8 @@ if (!class_exists('FlycartWooDiscountRulesPricingRules')) {
2801
  }
2802
  $loadFromCookie = $this->loadPriceTableFromCookie($cookie_set_time);
2803
  if(!$loadFromCookie){
2804
- $product = FlycartWoocommerceProduct::wc_get_product($_REQUEST['id']);
 
2805
  ob_start();
2806
  $this->loadPriceTable($product);
2807
  $html = ob_get_contents();
@@ -4240,26 +4241,30 @@ if (!class_exists('FlycartWooDiscountRulesPricingRules')) {
4240
  $return['status'] = 0;
4241
  $return['price_html'] = '';
4242
  if (!defined('WOO_DISCOUNT_DOING_AJAX')) define('WOO_DISCOUNT_DOING_AJAX', 1);
4243
- $product = FlycartWoocommerceProduct::wc_get_product(sanitize_text_field($_REQUEST['id']));
4244
- if(!empty($product)){
4245
- $price_html_request = $this->getOriginalStrikeoutPriceOfProduct($product);
4246
- $this->custom_qty = sanitize_text_field($_REQUEST['qty']);
4247
- $price_html = $this->replaceVisiblePrices($price_html_request, $product);
4248
- $this->custom_qty = 0;
4249
- $return['status'] = 1;
4250
- $return['price_html'] = $price_html;
4251
- $return['product_type'] = $product->get_type();
4252
- if($product->get_type() == 'variation'){
4253
- $return['has_single_price'] = 0;
4254
- $parent_id = FlycartWoocommerceProduct::get_parent_id($product);
4255
- $return['parent_id'] = $parent_id;
4256
- if($parent_id){
4257
- $parent_product = FlycartWoocommerceProduct::wc_get_product($parent_id);
4258
- if(method_exists($parent_product, 'get_variation_price')){
4259
- $variation_min_price = $parent_product->get_variation_price('min');
4260
- $variation_max_price = $parent_product->get_variation_price('max');
4261
- if($variation_min_price == $variation_max_price){
4262
- $return['has_single_price'] = 1;
 
 
 
 
4263
  }
4264
  }
4265
  }
@@ -4315,7 +4320,8 @@ if (!class_exists('FlycartWooDiscountRulesPricingRules')) {
4315
  public function getWooDiscountedPriceForVariant(){
4316
  if (isset($_REQUEST['id']) && $_REQUEST['id'] && isset($_REQUEST['price_html']) && $_REQUEST['price_html'] != '') {
4317
  if (!defined('WOO_DISCOUNT_DOING_AJAX')) define('WOO_DISCOUNT_DOING_AJAX', 1);
4318
- $product = FlycartWoocommerceProduct::wc_get_product($_REQUEST['id']);
 
4319
  $price_html_request = stripslashes($_REQUEST['price_html']);
4320
  $price_html = $this->replaceVisiblePrices($price_html_request, $product);
4321
  $return['status'] = 1;
2801
  }
2802
  $loadFromCookie = $this->loadPriceTableFromCookie($cookie_set_time);
2803
  if(!$loadFromCookie){
2804
+ $product_id = intval($_REQUEST['id']);
2805
+ $product = FlycartWoocommerceProduct::wc_get_product($product_id);
2806
  ob_start();
2807
  $this->loadPriceTable($product);
2808
  $html = ob_get_contents();
4241
  $return['status'] = 0;
4242
  $return['price_html'] = '';
4243
  if (!defined('WOO_DISCOUNT_DOING_AJAX')) define('WOO_DISCOUNT_DOING_AJAX', 1);
4244
+ $product_id = intval(sanitize_text_field($_REQUEST['id']));
4245
+ if(!empty($product_id)){
4246
+ $product = FlycartWoocommerceProduct::wc_get_product($product_id);
4247
+ if(!empty($product)){
4248
+ $price_html_request = $this->getOriginalStrikeoutPriceOfProduct($product);
4249
+ $qty = intval(sanitize_text_field($_REQUEST['qty']));
4250
+ $this->custom_qty = $qty;
4251
+ $price_html = $this->replaceVisiblePrices($price_html_request, $product);
4252
+ $this->custom_qty = 0;
4253
+ $return['status'] = 1;
4254
+ $return['price_html'] = $price_html;
4255
+ $return['product_type'] = $product->get_type();
4256
+ if($product->get_type() == 'variation'){
4257
+ $return['has_single_price'] = 0;
4258
+ $parent_id = FlycartWoocommerceProduct::get_parent_id($product);
4259
+ $return['parent_id'] = $parent_id;
4260
+ if($parent_id){
4261
+ $parent_product = FlycartWoocommerceProduct::wc_get_product($parent_id);
4262
+ if(method_exists($parent_product, 'get_variation_price')){
4263
+ $variation_min_price = $parent_product->get_variation_price('min');
4264
+ $variation_max_price = $parent_product->get_variation_price('max');
4265
+ if($variation_min_price == $variation_max_price){
4266
+ $return['has_single_price'] = 1;
4267
+ }
4268
  }
4269
  }
4270
  }
4320
  public function getWooDiscountedPriceForVariant(){
4321
  if (isset($_REQUEST['id']) && $_REQUEST['id'] && isset($_REQUEST['price_html']) && $_REQUEST['price_html'] != '') {
4322
  if (!defined('WOO_DISCOUNT_DOING_AJAX')) define('WOO_DISCOUNT_DOING_AJAX', 1);
4323
+ $product_id = intval($_REQUEST['id']);
4324
+ $product = FlycartWoocommerceProduct::wc_get_product($product_id);
4325
  $price_html_request = stripslashes($_REQUEST['price_html']);
4326
  $price_html = $this->replaceVisiblePrices($price_html_request, $product);
4327
  $return['status'] = 1;
v1/view/cart-rules.php CHANGED
@@ -231,6 +231,7 @@ $current_language = FlycartWooDiscountRulesGeneralHelper::getWPMLLanguage();
231
 
232
  <input type="hidden" name="form" value="cart_rules">
233
  <input type="hidden" id="ajax_path" value="<?php echo admin_url('admin-ajax.php') ?>">
 
234
  </form>
235
  </div>
236
  </div>
231
 
232
  <input type="hidden" name="form" value="cart_rules">
233
  <input type="hidden" id="ajax_path" value="<?php echo admin_url('admin-ajax.php') ?>">
234
+ <input type="hidden" name="wdr_nonce" value="<?php echo FlycartWooDiscountRulesGeneralHelper::createNonce('wdr_rule_listing'); ?>">
235
  </form>
236
  </div>
237
  </div>
v1/view/pricing-rules.php CHANGED
@@ -261,6 +261,7 @@ $current_language = FlycartWooDiscountRulesGeneralHelper::getWPMLLanguage();
261
 
262
  <input type="hidden" name="form" value="pricing_rules">
263
  <input type="hidden" id="ajax_path" value="<?php echo admin_url('admin-ajax.php') ?>">
 
264
  </form>
265
  </div>
266
  </div>
261
 
262
  <input type="hidden" name="form" value="pricing_rules">
263
  <input type="hidden" id="ajax_path" value="<?php echo admin_url('admin-ajax.php') ?>">
264
+ <input type="hidden" name="wdr_nonce" value="<?php echo FlycartWooDiscountRulesGeneralHelper::createNonce('wdr_rule_listing'); ?>">
265
  </form>
266
  </div>
267
  </div>
v1/view/settings.php CHANGED
@@ -61,6 +61,7 @@ if($target === 'table'){
61
  </div>
62
  </div>
63
  <input type="hidden" id="ajax_path" value="<?php echo admin_url('admin-ajax.php') ?>">
 
64
  </form>
65
  </div>
66
  <?php if(!$isPro){ ?>
61
  </div>
62
  </div>
63
  <input type="hidden" id="ajax_path" value="<?php echo admin_url('admin-ajax.php') ?>">
64
+ <input type="hidden" name="wdr_nonce" value="<?php echo FlycartWooDiscountRulesGeneralHelper::createNonce('wdr_save_rule_config'); ?>">
65
  </form>
66
  </div>
67
  <?php if(!$isPro){ ?>
v1/view/view-cart-rules.php CHANGED
@@ -861,6 +861,8 @@ $has_large_no_of_coupon = FlycartWooDiscountBase::hasLargeNumberOfCoupon();
861
  <input type="hidden" id="pro_suffix" value="<?php echo $suffix; ?>">
862
  <input type="hidden" id="is_pro" value="<?php echo $pro; ?>">
863
  <input type="hidden" id="flycart_wdr_woocommerce_version" value="<?php echo $flycart_wdr_woocommerce_version; ?>">
 
 
864
  </form>
865
  <div class="woo_discount_loader">
866
  <div class="lds-ripple"><div></div><div></div></div>
861
  <input type="hidden" id="pro_suffix" value="<?php echo $suffix; ?>">
862
  <input type="hidden" id="is_pro" value="<?php echo $pro; ?>">
863
  <input type="hidden" id="flycart_wdr_woocommerce_version" value="<?php echo $flycart_wdr_woocommerce_version; ?>">
864
+ <input type="hidden" name="wdr_nonce" value="<?php echo FlycartWooDiscountRulesGeneralHelper::createNonce('wdr_save_cart_rule'); ?>">
865
+ <input type="hidden" name="wdr_search_nonce" value="<?php echo FlycartWooDiscountRulesGeneralHelper::createNonce('wdr_ajax_search_field'); ?>">
866
  </form>
867
  <div class="woo_discount_loader">
868
  <div class="lds-ripple"><div></div><div></div></div>
v1/view/view-pricing-rules.php CHANGED
@@ -1035,6 +1035,8 @@ $current_date_and_time = FlycartWooDiscountRulesGeneralHelper::getCurrentDateAnd
1035
  <input type="hidden" id="pro_suffix" value="<?php echo $suffix; ?>">
1036
  <input type="hidden" id="is_pro" value="<?php echo $pro; ?>">
1037
  <input type="hidden" id="flycart_wdr_woocommerce_version" value="<?php echo $flycart_wdr_woocommerce_version; ?>">
 
 
1038
  </form>
1039
  <div class="woo_discount_loader">
1040
  <div class="lds-ripple"><div></div><div></div></div>
1035
  <input type="hidden" id="pro_suffix" value="<?php echo $suffix; ?>">
1036
  <input type="hidden" id="is_pro" value="<?php echo $pro; ?>">
1037
  <input type="hidden" id="flycart_wdr_woocommerce_version" value="<?php echo $flycart_wdr_woocommerce_version; ?>">
1038
+ <input type="hidden" name="wdr_nonce" value="<?php echo FlycartWooDiscountRulesGeneralHelper::createNonce('wdr_save_price_rule'); ?>">
1039
+ <input type="hidden" name="wdr_search_nonce" value="<?php echo FlycartWooDiscountRulesGeneralHelper::createNonce('wdr_ajax_search_field'); ?>">
1040
  </form>
1041
  <div class="woo_discount_loader">
1042
  <div class="lds-ripple"><div></div><div></div></div>
v2/App/Controllers/Admin/Tabs/Compatible.php CHANGED
@@ -1,6 +1,8 @@
1
  <?php
2
  namespace Wdr\App\Controllers\Admin\Tabs;
3
 
 
 
4
  if (!defined('ABSPATH')) exit; // Exit if accessed directly
5
 
6
  class Compatible extends Base
@@ -80,10 +82,16 @@ class Compatible extends Base
80
  * Save compatibility settings
81
  * */
82
  protected function saveCompatibilitySettings(){
83
- if(isset($_POST['awdr_compatibility_submit'])){
84
- if($_POST['awdr_compatibility_submit'] == 1){
85
- $wdrc = isset($_POST['wdrc'])? $_POST['wdrc']: array();
86
- update_option($this->option_key, $wdrc);
 
 
 
 
 
 
87
  }
88
  }
89
  }
1
  <?php
2
  namespace Wdr\App\Controllers\Admin\Tabs;
3
 
4
+ use Wdr\App\Helpers\Helper;
5
+
6
  if (!defined('ABSPATH')) exit; // Exit if accessed directly
7
 
8
  class Compatible extends Base
82
  * Save compatibility settings
83
  * */
84
  protected function saveCompatibilitySettings(){
85
+ if(Helper::hasAdminPrivilege()){
86
+ if(isset($_POST['awdr_compatibility_submit'])){
87
+ $awdr_compatibility_submit = intval($_POST['awdr_compatibility_submit']);
88
+ if($awdr_compatibility_submit == 1){
89
+ $wdrc = isset($_POST['wdrc'])? $_POST['wdrc']: array();
90
+ if(!empty($wdrc)){
91
+ $wdrc = array_map('absint', $wdrc);
92
+ }
93
+ update_option($this->option_key, $wdrc);
94
+ }
95
  }
96
  }
97
  }
v2/App/Controllers/Admin/Tabs/DiscountRules.php CHANGED
@@ -37,11 +37,15 @@ class DiscountRules extends Base
37
  $params['site_languages'] = $this->getAvailableLanguages();
38
  if (isset($page) && !empty($page)) {
39
  $id = $this->input->get('id', 0);
 
 
 
 
40
  $params['rule'] = $rule_helper->getRule($id, $available_conditions);
41
  $params['page'] = $page;
42
  $params['product_filters'] = $this->getProductFilterTypes();
43
  $params['on_sale_page_rebuild'] = OnSaleShortCode::getOnPageReBuildOption($id);
44
- self::$template_helper->setPath(WDR_PLUGIN_PATH . 'App/Views/Admin/Rules/Manage.php')->setData($params)->display();
45
  } else {
46
  $params['has_migration'] = $this->isMigrationAvailable();
47
  if($params['has_migration']){
37
  $params['site_languages'] = $this->getAvailableLanguages();
38
  if (isset($page) && !empty($page)) {
39
  $id = $this->input->get('id', 0);
40
+ $id = intval($id);
41
+ if(is_int($id) && $id >= 0 ){} else {
42
+ $id = 0;
43
+ }
44
  $params['rule'] = $rule_helper->getRule($id, $available_conditions);
45
  $params['page'] = $page;
46
  $params['product_filters'] = $this->getProductFilterTypes();
47
  $params['on_sale_page_rebuild'] = OnSaleShortCode::getOnPageReBuildOption($id);
48
+ self::$template_helper->setPath(WDR_PLUGIN_PATH . 'App/Views/Admin/Rules/Manage.php' )->setData($params)->display();
49
  } else {
50
  $params['has_migration'] = $this->isMigrationAvailable();
51
  if($params['has_migration']){
v2/App/Controllers/Admin/Tabs/Statistics.php CHANGED
@@ -6,6 +6,7 @@ use Wdr\App\Controllers\Configuration;
6
  use Wdr\App\Helpers\Helper;
7
  use Wdr\App\Helpers\Rule;
8
  use Wdr\App\Controllers\Admin\Tabs\Reports;
 
9
 
10
  if (!defined('ABSPATH')) exit; // Exit if accessed directly
11
 
@@ -85,6 +86,10 @@ class Statistics extends Base
85
  Helper::validateRequest('wdr_ajax_report', $awdr_nonce);
86
  if(Helper::hasAdminPrivilege()){
87
  $type = $params['type'];
 
 
 
 
88
  if ( isset( $this->reports[ $type ] ) ) {
89
  $handler = $this->reports[ $type ]['handler'];
90
  $data = $handler->get_data( $params );
6
  use Wdr\App\Helpers\Helper;
7
  use Wdr\App\Helpers\Rule;
8
  use Wdr\App\Controllers\Admin\Tabs\Reports;
9
+ use Wdr\App\Helpers\Validation;
10
 
11
  if (!defined('ABSPATH')) exit; // Exit if accessed directly
12
 
86
  Helper::validateRequest('wdr_ajax_report', $awdr_nonce);
87
  if(Helper::hasAdminPrivilege()){
88
  $type = $params['type'];
89
+ if(!Validation::validateReportTabFields($params)){
90
+ wp_send_json_error();
91
+ }
92
+
93
  if ( isset( $this->reports[ $type ] ) ) {
94
  $handler = $this->reports[ $type ]['handler'];
95
  $data = $handler->get_data( $params );
v2/App/Controllers/Admin/WDRAjax.php CHANGED
@@ -10,6 +10,7 @@ use Wdr\App\Controllers\OnSaleShortCode;
10
  use Wdr\App\Helpers\Helper;
11
  use Wdr\App\Helpers\Migration;
12
  use Wdr\App\Helpers\Rule;
 
13
  use Wdr\App\Helpers\Woocommerce;
14
 
15
  if (!defined('ABSPATH')) exit;
@@ -46,11 +47,12 @@ class WDRAjax extends Base
46
  $method_name = 'wdr_ajax_' . $method;
47
  if (method_exists($this, $method_name)) {
48
  $result = $this->$method_name();
 
 
49
  }
50
  } else {
51
  $result = __('Authentication required', WDR_TEXT_DOMAIN);
52
  }
53
-
54
  wp_send_json_success($result);
55
  }
56
 
@@ -75,9 +77,10 @@ class WDRAjax extends Base
75
  * Process v1 to v2 migration
76
  * */
77
  public function wdr_ajax_skip_v1_v2_migration(){
78
- $migration = new Migration();
 
79
  $migration->updateMigrationInfo(array('skipped_migration' => 1));
80
- wp_send_json_success(true);
81
  }
82
 
83
  /**
@@ -310,6 +313,15 @@ class WDRAjax extends Base
310
  public function wdr_ajax_save_configuration()
311
  {
312
  Helper::validateRequest('wdr_ajax_save_configuration');
 
 
 
 
 
 
 
 
 
313
  $save_config = $this->input->post();
314
  $save_config['modify_price_at_shop_page'] = $this->input->post('modify_price_at_shop_page', 0);
315
  $save_config['modify_price_at_product_page'] = $this->input->post('modify_price_at_product_page', 0);
@@ -320,18 +332,14 @@ class WDRAjax extends Base
320
  $save_config['table_title_column'] = $this->input->post('table_title_column', 0);
321
  $save_config['table_discount_column'] = $this->input->post('table_discount_column', 0);
322
  $save_config['table_range_column'] = $this->input->post('table_range_column', 0);
323
- $save_config['awdr_banner_editor'] = (isset($_POST['customize_banner_content'])) ? stripslashes($_POST['customize_banner_content']) : '';
324
- if(empty($save_config['awdr_banner_editor'])){
325
- $save_config['awdr_banner_editor'] = (isset($_POST['banner_content'])) ? stripslashes($_POST['banner_content']) : '';
326
- }
327
  $save_config['on_sale_badge_html'] = (isset($_POST['on_sale_badge_html'])) ? stripslashes($_POST['on_sale_badge_html']) : '';
328
- $save_alert = $this->input->post('customizer_save_alert', 0) ;
329
- if($save_alert == "1"){
330
- $save_alert = "alert_in_popup";
331
- } else {
332
- $save_alert = "alert_in_normal";
333
- }
334
- return array('result' => Configuration::saveConfig($save_config), 'save_popup' => $save_alert);
335
  }
336
 
337
  /**
@@ -340,29 +348,34 @@ class WDRAjax extends Base
340
  public function wdr_ajax_save_rule()
341
  {
342
  Helper::validateRequest('wdr_ajax_save_rule');
343
- $rule_helper = new Rule();
344
- $post = $this->input->post();
345
- $post['title'] = (isset($_POST['title'])) ? stripslashes(sanitize_text_field($_POST['title'])) : '';
346
- $post['product_adjustments']['cart_label'] = (isset($_POST['product_adjustments']) && isset($_POST['product_adjustments']['cart_label'])) ? stripslashes(sanitize_text_field($_POST['product_adjustments']['cart_label'])) : '';
347
- $post['bulk_adjustments']['cart_label'] = (isset($_POST['bulk_adjustments']) && isset($_POST['bulk_adjustments']['cart_label'])) ? stripslashes(sanitize_text_field($_POST['bulk_adjustments']['cart_label'])) : '';
348
- $post['set_adjustments']['cart_label'] = (isset($_POST['set_adjustments']) && isset($_POST['set_adjustments']['cart_label'])) ? stripslashes(sanitize_text_field($_POST['set_adjustments']['cart_label'])) : '';
349
- $rule_id = $rule_helper->save($post);
350
- if(isset($rule_id['coupon_exists'])){
351
- $coupon_message = $rule_id['coupon_exists'];
352
- wp_send_json( array('coupon_message' => $coupon_message ));
353
- die;
354
- }
355
- $redirect_url = false;
356
- if (!empty($this->input->post('wdr_save_close', ''))) {
357
- $redirect_url = admin_url("admin.php?" . http_build_query(array('page' => WDR_SLUG, 'tab' => 'rules')));
358
- } elseif (empty($this->input->post('edit_rule', ''))) {
359
- $redirect_url = admin_url("admin.php?" . http_build_query(array('page' => WDR_SLUG, 'tab' => 'rules', 'task' => 'view', 'id' => $rule_id)));
360
- }
361
- $build_index = array();
362
- if($rule_id){
363
- $build_index = OnSaleShortCode::getOnPageReBuildOption($rule_id);
 
 
 
 
 
 
364
  }
365
- wp_send_json(array('rule_id' => $rule_id, 'redirect' => $redirect_url, 'build_index' => $build_index));
366
  }
367
 
368
  /**
10
  use Wdr\App\Helpers\Helper;
11
  use Wdr\App\Helpers\Migration;
12
  use Wdr\App\Helpers\Rule;
13
+ use Wdr\App\Helpers\Validation;
14
  use Wdr\App\Helpers\Woocommerce;
15
 
16
  if (!defined('ABSPATH')) exit;
47
  $method_name = 'wdr_ajax_' . $method;
48
  if (method_exists($this, $method_name)) {
49
  $result = $this->$method_name();
50
+ }else{
51
+ $result = __('Authentication required', WDR_TEXT_DOMAIN);
52
  }
53
  } else {
54
  $result = __('Authentication required', WDR_TEXT_DOMAIN);
55
  }
 
56
  wp_send_json_success($result);
57
  }
58
 
77
  * Process v1 to v2 migration
78
  * */
79
  public function wdr_ajax_skip_v1_v2_migration(){
80
+ wp_send_json_success(true);
81
+ /*$migration = new Migration(); //Removed for now
82
  $migration->updateMigrationInfo(array('skipped_migration' => 1));
83
+ wp_send_json_success(true);*/
84
  }
85
 
86
  /**
313
  public function wdr_ajax_save_configuration()
314
  {
315
  Helper::validateRequest('wdr_ajax_save_configuration');
316
+ $save_alert = $this->input->post('customizer_save_alert', 0) ;
317
+ if($save_alert == "1"){
318
+ $save_alert = "alert_in_popup";
319
+ } else {
320
+ $save_alert = "alert_in_normal";
321
+ }
322
+ if(!Validation::validateSettingsTabFields($_POST)){
323
+ return array('result' => false, 'save_popup' => $save_alert, 'security_pass' => 'fails' );
324
+ }
325
  $save_config = $this->input->post();
326
  $save_config['modify_price_at_shop_page'] = $this->input->post('modify_price_at_shop_page', 0);
327
  $save_config['modify_price_at_product_page'] = $this->input->post('modify_price_at_product_page', 0);
332
  $save_config['table_title_column'] = $this->input->post('table_title_column', 0);
333
  $save_config['table_discount_column'] = $this->input->post('table_discount_column', 0);
334
  $save_config['table_range_column'] = $this->input->post('table_range_column', 0);
335
+ $save_config['licence_key'] = $this->input->post('licence_key', '');
 
 
 
336
  $save_config['on_sale_badge_html'] = (isset($_POST['on_sale_badge_html'])) ? stripslashes($_POST['on_sale_badge_html']) : '';
337
+ $save_config['on_sale_badge_html'] = Rule::validateHtmlBeforeSave($_POST['on_sale_badge_html']);
338
+ $save_config['you_saved_text'] = Rule::validateHtmlBeforeSave($this->input->post('you_saved_text'));
339
+ $save_config['applied_rule_message'] = Rule::validateHtmlBeforeSave($this->input->post('applied_rule_message'));
340
+ $save_config['discount_label_for_combined_discounts'] = Rule::validateHtmlBeforeSave($this->input->post('discount_label_for_combined_discounts'));
341
+ $save_config['free_shipping_title'] = Rule::validateHtmlBeforeSave($this->input->post('free_shipping_title'));
342
+ return array('result' => Configuration::saveConfig($save_config), 'save_popup' => $save_alert, 'security_pass' => 'passed');
 
343
  }
344
 
345
  /**
348
  public function wdr_ajax_save_rule()
349
  {
350
  Helper::validateRequest('wdr_ajax_save_rule');
351
+ $validation_result = Validation::validateRules($_POST);
352
+ if ($validation_result === true) {
353
+ $post = $this->input->post();
354
+ $rule_helper = new Rule();
355
+ $post['title'] = (isset($_POST['title'])) ? stripslashes(sanitize_text_field($_POST['title'])) : '';
356
+ $post['product_adjustments']['cart_label'] = (isset($_POST['product_adjustments']) && isset($_POST['product_adjustments']['cart_label'])) ? stripslashes(sanitize_text_field($_POST['product_adjustments']['cart_label'])) : '';
357
+ $post['bulk_adjustments']['cart_label'] = (isset($_POST['bulk_adjustments']) && isset($_POST['bulk_adjustments']['cart_label'])) ? stripslashes(sanitize_text_field($_POST['bulk_adjustments']['cart_label'])) : '';
358
+ $post['set_adjustments']['cart_label'] = (isset($_POST['set_adjustments']) && isset($_POST['set_adjustments']['cart_label'])) ? stripslashes(sanitize_text_field($_POST['set_adjustments']['cart_label'])) : '';
359
+ $rule_id = $rule_helper->save($post);
360
+ if (isset($rule_id['coupon_exists'])) {
361
+ $coupon_message = $rule_id['coupon_exists'];
362
+ wp_send_json(array('coupon_message' => $coupon_message));
363
+ die;
364
+ }
365
+ $redirect_url = false;
366
+ if (!empty($this->input->post('wdr_save_close', ''))) {
367
+ $redirect_url = admin_url("admin.php?" . http_build_query(array('page' => WDR_SLUG, 'tab' => 'rules')));
368
+ } elseif (empty($this->input->post('edit_rule', ''))) {
369
+ $redirect_url = admin_url("admin.php?" . http_build_query(array('page' => WDR_SLUG, 'tab' => 'rules', 'task' => 'view', 'id' => $rule_id)));
370
+ }
371
+ $build_index = array();
372
+ if ($rule_id) {
373
+ $build_index = OnSaleShortCode::getOnPageReBuildOption($rule_id);
374
+ }
375
+ wp_send_json_success(array('rule_id' => $rule_id, 'redirect' => $redirect_url, 'build_index' => $build_index));
376
+ } else {
377
+ wp_send_json_error($validation_result);
378
  }
 
379
  }
380
 
381
  /**
v2/App/Controllers/ManageDiscount.php CHANGED
@@ -2049,20 +2049,22 @@ class ManageDiscount extends Base
2049
  * Export Data via CSV
2050
  */
2051
  public function awdrExportCsv(){
2052
- if (isset($_POST['wdr-export'])) {
2053
- ob_end_clean();
2054
- $rule_helper = new Rule();
2055
- $rules = $rule_helper->exportRuleByName('all');
2056
- $file_name = 'advanced-discount-rules-' . date("Y-m-d-h-i-a") . '.csv';
2057
- $file = fopen('php://output', 'w');
2058
- header('Content-type: application/csv');
2059
- header('Content-Disposition: attachment; filename='.$file_name);
2060
- fputcsv($file, array('id', 'enabled', 'deleted', 'exclusive', 'title', 'priority', 'apply_to', 'filters', 'conditions', 'product_adjustments', 'cart_adjustments', 'buy_x_get_x_adjustments', 'buy_x_get_y_adjustments', 'bulk_adjustments', 'set_adjustments', 'other_discounts', 'date_from', 'date_to', 'usage_limits', 'rule_language', 'used_limits', 'additional', 'max_discount_sum', 'advanced_discount_message', 'discount_type', 'used_coupons', 'created_by', 'created_on', 'modified_by', 'modified_on'));
2061
- foreach ($rules as $rule_row) {
2062
- $row_data = (array)$rule_row;
2063
- fputcsv($file, $row_data);
2064
- }
2065
- exit;
 
 
2066
  }
2067
  }
2068
  }
2049
  * Export Data via CSV
2050
  */
2051
  public function awdrExportCsv(){
2052
+ if (isset($_POST['wdr-export']) && isset($_POST['security'])) {
2053
+ if(wp_verify_nonce($_POST['security'],'awdr_export_rules')) {
2054
+ ob_end_clean();
2055
+ $rule_helper = new Rule();
2056
+ $rules = $rule_helper->exportRuleByName('all');
2057
+ $file_name = 'advanced-discount-rules-' . date("Y-m-d-h-i-a") . '.csv';
2058
+ $file = fopen('php://output', 'w');
2059
+ header('Content-type: application/csv');
2060
+ header('Content-Disposition: attachment; filename=' . $file_name);
2061
+ fputcsv($file, array('id', 'enabled', 'deleted', 'exclusive', 'title', 'priority', 'apply_to', 'filters', 'conditions', 'product_adjustments', 'cart_adjustments', 'buy_x_get_x_adjustments', 'buy_x_get_y_adjustments', 'bulk_adjustments', 'set_adjustments', 'other_discounts', 'date_from', 'date_to', 'usage_limits', 'rule_language', 'used_limits', 'additional', 'max_discount_sum', 'advanced_discount_message', 'discount_type', 'used_coupons', 'created_by', 'created_on', 'modified_by', 'modified_on'));
2062
+ foreach ($rules as $rule_row) {
2063
+ $row_data = (array)$rule_row;
2064
+ fputcsv($file, $row_data);
2065
+ }
2066
+ exit;
2067
+ }
2068
  }
2069
  }
2070
  }
v2/App/Controllers/OnSaleShortCode.php CHANGED
@@ -362,20 +362,22 @@ class OnSaleShortCode extends ManageDiscount
362
 
363
  function setCustomTaxonomyQueryArguments(&$query_arguments, $query_type, $taxonomies)
364
  {
 
365
  if($query_type == 'include'){
366
  $operator = 'IN';
367
  } else {
368
  $operator = 'NOT IN';
369
  }
370
- if (!empty($taxonomies)) {
371
- foreach ($taxonomies as $taxonomy => $values) {
372
- $values = array_map('absint', $values);
373
- $query_arguments['tax_query'][$query_type][] = array(
 
374
  'taxonomy' => $taxonomy,
375
- 'terms' => $values,
376
  'field' => 'term_id',
377
- 'operator' => $operator,
378
  );
 
379
  }
380
  }
381
  }
362
 
363
  function setCustomTaxonomyQueryArguments(&$query_arguments, $query_type, $taxonomies)
364
  {
365
+ $values = array_map('absint', $taxonomies);
366
  if($query_type == 'include'){
367
  $operator = 'IN';
368
  } else {
369
  $operator = 'NOT IN';
370
  }
371
+ foreach ($values as $taxonomy_id) {
372
+ $data = get_term($taxonomy_id);
373
+ if (!empty($data)) {
374
+ $taxonomy = $data->taxonomy;
375
+ $query_arguments['tax_query'][$query_type][$taxonomy] = array(
376
  'taxonomy' => $taxonomy,
 
377
  'field' => 'term_id',
378
+ 'operator' => $operator
379
  );
380
+ $query_arguments['tax_query'][$query_type][$taxonomy]['terms'][] = $taxonomy_id;
381
  }
382
  }
383
  }
v2/App/Helpers/Helper.php CHANGED
@@ -1,9 +1,7 @@
1
  <?php
2
 
3
  namespace Wdr\App\Helpers;
4
-
5
  if (!defined('ABSPATH')) exit; // Exit if accessed directly
6
-
7
  class Helper
8
  {
9
  /**
@@ -13,10 +11,10 @@ class Helper
13
  * @param $additional_products array
14
  * @return array
15
  * */
16
- public static function combineProductArrays($products, $additional_products){
 
17
  $products = array_merge($products, $additional_products);
18
  $products = array_unique($products);
19
-
20
  return $products;
21
  }
22
 
@@ -25,10 +23,10 @@ class Helper
25
  *
26
  * @return boolean
27
  * */
28
- public static function hasPro(){
 
29
  if (defined('WDR_PRO'))
30
- if(WDR_PRO === true) return true;
31
-
32
  return false;
33
  }
34
 
@@ -38,25 +36,25 @@ class Helper
38
  * @param $data mixed
39
  * @return mixed
40
  * */
41
- public static function formatAllPrices($data){
42
- if(is_array($data)){
43
- if(isset($data['initial_price']) && !isset($data['initial_price_html'])){
 
44
  $data['initial_price_html'] = Woocommerce::formatPrice($data['initial_price']);
45
  }
46
- if(isset($data['discounted_price']) && !isset($data['discounted_price_html'])){
47
  $data['discounted_price_html'] = Woocommerce::formatPrice($data['discounted_price']);
48
  }
49
- if(isset($data['initial_price_with_tax']) && !isset($data['initial_price_with_tax_html'])){
50
  $data['initial_price_with_tax_html'] = Woocommerce::formatPrice($data['initial_price_with_tax']);
51
  }
52
- if(isset($data['discounted_price_with_tax']) && !isset($data['discounted_price_with_tax_html'])){
53
  $data['discounted_price_with_tax_html'] = Woocommerce::formatPrice($data['discounted_price_with_tax']);
54
  }
55
- if(!isset($data['currency_symbol'])){
56
  $data['currency_symbol'] = Woocommerce::get_currency_symbol();
57
  }
58
  }
59
-
60
  return $data;
61
  }
62
 
@@ -66,11 +64,12 @@ class Helper
66
  * @param string $folder
67
  * @return string
68
  * */
69
- public static function getTemplateOverride($template_name, $folder = ''){
70
- if(!empty($folder)){
71
- $path = trailingslashit('woo-discount-rules') .$folder."/".$template_name;
 
72
  } else {
73
- $path = trailingslashit( 'woo-discount-rules' ) . $template_name;
74
  }
75
  $template = locate_template(
76
  array(
@@ -78,7 +77,6 @@ class Helper
78
  $template_name,
79
  )
80
  );
81
-
82
  return $template;
83
  }
84
 
@@ -90,10 +88,10 @@ class Helper
90
  * @param $folder string
91
  * @return string
92
  * */
93
- public static function getTemplatePath($template_name, $default_path, $folder = ''){
 
94
  $path_from_template = self::getTemplateOverride($template_name, $folder);
95
- if($path_from_template) $default_path = $path_from_template;
96
-
97
  return $default_path;
98
  }
99
 
@@ -105,65 +103,69 @@ class Helper
105
  * @param $type string
106
  * @return bool
107
  * */
108
- public static function isCartItemConsideredForCalculation($status, $cart_item, $type){
 
109
  return apply_filters('advanced_woo_discount_rules_include_cart_item_to_count_quantity', $status, $cart_item, $type);
110
  }
111
 
112
  /**
113
  * Set messages
114
  * */
115
- public static function setPromotionMessage($message, $rule_id = ''){
 
116
  $messages = Woocommerce::getSession('awdr_promotion_messages', array());
117
- if(!is_array($messages)) $messages = array();
118
- if(!empty($messages) && in_array($message, $messages)){
119
  } else {
120
- if(empty($rule_id)){
121
  $messages[] = $message;
122
  } else {
123
  $messages[$rule_id] = $message;
124
  }
125
  }
126
-
127
  Woocommerce::setSession('awdr_promotion_messages', $messages);
128
  }
129
 
130
  /**
131
  * Get promotion messages
132
  * */
133
- public static function getPromotionMessages(){
 
134
  return Woocommerce::getSession('awdr_promotion_messages', array());
135
  }
136
 
137
  /**
138
  * Clear promotion messages
139
  * */
140
- public static function clearPromotionMessages(){
 
141
  Woocommerce::setSession('awdr_promotion_messages', array());
142
  }
143
 
144
  /**
145
  * ruleConditionDescription
146
  */
147
- public static function ruleConditionDescription(){
148
- return $content = "<p>". __('Include additional conditions (if necessary)', WDR_TEXT_DOMAIN)."</p>
149
- <b>".__('Popular conditions:', WDR_TEXT_DOMAIN)."</b>
 
150
  <span style='width: 100%; display: flex;'>
151
  <span style='width: 45%; padding-right: 5px;'>
152
  <ul class='awdr-bullet-style'>
153
- <li ><a href=' https://docs.flycart.org/en/articles/3977542-subtotal-based-free-product-2-0?utm_source=woo-discount-rules-v2&utm_campaign=doc&utm_medium=text-click&utm_content=subtotal_documentation' target='_blank'>".__('Subtotal', WDR_TEXT_DOMAIN)."</a></li>
154
- <li ><a href=' https://docs.flycart.org/en/articles/4203313-user-role-based-discount-rules-discount-rules-2-0?utm_source=woo-discount-rules-v2&utm_campaign=doc&utm_medium=text-click&utm_content=user_role_documentation' target='_blank'>".__('User role', WDR_TEXT_DOMAIN)."</a></li>
155
- <li >".__('Days & Time', WDR_TEXT_DOMAIN)."</li>
156
- <li >".__('Purchase History', WDR_TEXT_DOMAIN)."</li>
157
- <li >".__('Payment Method', WDR_TEXT_DOMAIN)."</li>
158
  </ul>
159
  </span>
160
  <span style='width: 45%;'>
161
  <ul class='awdr-bullet-style'>
162
- <li ><a href='https://docs.flycart.org/en/articles/4268595-activate-discount-rule-using-a-coupon-code-in-woocommerce-2-0?utm_source=woo-discount-rules-v2&utm_campaign=doc&utm_medium=text-click&utm_content=coupon_documentation' target='_blank'>". __('Coupon', WDR_TEXT_DOMAIN)."</a></li>
163
- <li ><a href='https://docs.flycart.org/en/articles/4214869-customer-shipping-address-based-discount-2-0?utm_source=woo-discount-rules-v2&utm_campaign=doc&utm_medium=text-click&utm_content=shipping_address_documentation' target='_blank'>".__('Shipping Address', WDR_TEXT_DOMAIN)."</a></li>
164
- <li>".__('Category Combination', WDR_TEXT_DOMAIN)."</li>
165
- <li><a href='https://docs.flycart.org/en/articles/4164153-buy-product-a-b-and-get-discount-in-product-c-discount-rules-2-0?utm_source=woo-discount-rules-v2&utm_campaign=doc&utm_medium=text-click&utm_content=product_combination' target='_blank'>".__('Product Combination', WDR_TEXT_DOMAIN)."</a></li>
166
- <li >".__('Quantities/Line items', WDR_TEXT_DOMAIN)."</li>
167
 
168
 
169
  </ul>
@@ -175,7 +177,8 @@ class Helper
175
  * bogoToolTipDescriptionForIndividualProduct
176
  * @return mixed
177
  */
178
- public static function bogoToolTipDescriptionForIndividualProduct(){
 
179
  return $content = __("Individual Product :
180
  This counts the total quantity of each product / line item separately.
181
  Example:
@@ -189,7 +192,8 @@ class Helper
189
  * bogoToolTipDescriptionForFilterTogether
190
  * @return mixed
191
  */
192
- public static function bogoToolTipDescriptionForFilterTogether(){
 
193
  return $content = __("Filter set above :
194
  This will count the quantities of products set in the 'Filter' section.
195
  Example: If you selected a few categories there, it will count the quantities of products in those categories added in cart. If you selected a few products in the filters section, then it will count the quantities together.
@@ -200,7 +204,8 @@ class Helper
200
  * bogoToolTipDescriptionForvariants
201
  * @return mixed
202
  */
203
- public static function bogoToolTipDescriptionForvariants(){
 
204
  return $content = __('All variants in each product together :
205
  Useful when applying discounts based on variable products and you want the quantity to be counted based on the parent product.
206
  Example:
@@ -209,44 +214,48 @@ class Helper
209
  ', WDR_TEXT_DOMAIN);
210
  }
211
 
212
- public static function create_nonce($action = -1){
 
213
  return wp_create_nonce($action);
214
  }
215
 
216
- protected static function verify_nonce($nonce, $action = -1 ){
217
- if (wp_verify_nonce($nonce, $action)){
 
218
  return true;
219
  } else {
220
  return false;
221
  }
222
  }
223
 
224
- public static function validateRequest($method, $awdr_nonce = null){
225
- if($awdr_nonce === null){
226
- if(isset($_REQUEST['awdr_nonce']) && !empty($_REQUEST['awdr_nonce'])){
227
- if(self::verify_nonce(wp_unslash($_REQUEST['awdr_nonce']), $method)){
 
228
  return true;
229
  }
230
  }
231
  } else {
232
- if(self::verify_nonce(wp_unslash($awdr_nonce), $method)){
233
  return true;
234
  }
235
  }
236
-
237
  die(__('Invalid token', WDR_TEXT_DOMAIN));
238
  }
239
 
240
- public static function filterSelect2SearchQuery($query){
 
241
  return esc_sql(stripslashes($query));
242
  }
243
 
244
- public static function displayCompatibleCheckMessages(){
245
- if(version_compare(WDR_VERSION, '2.1.1', '>=')){
246
- if(defined('WDR_PRO_VERSION')){
247
- if(version_compare(WDR_PRO_VERSION, '2.1.1', '<')){
248
- $url = admin_url()."plugins.php";
249
- $plugin_page = '<a target="_blank" href="'.$url.'">'.__('Update now', WDR_TEXT_DOMAIN).'</a>';
 
250
  ?>
251
  <br>
252
  <div class="notice inline notice notice-warning notice-alt awdr-rule-limit-disabled">
@@ -260,18 +269,20 @@ class Helper
260
  }
261
  }
262
 
263
- public static function hasAdminPrivilege(){
264
- if (current_user_can( 'manage_woocommerce' )) {
 
265
  return true;
266
  } else {
267
  return false;
268
  }
269
  }
270
 
271
- public static function getCleanHtml($html) {
 
272
  try {
273
  $html = html_entity_decode($html);
274
- $html = preg_replace('/(<(script|style|iframe)\b[^>]*>).*?(<\/\2>)/is', "$1$3", $html);
275
  $allowed_html = array(
276
  'br' => array(),
277
  'strong' => array(),
@@ -280,8 +291,58 @@ class Helper
280
  'p' => array('class' => array()),
281
  );
282
  return wp_kses($html, $allowed_html);
283
- } catch (\Exception $e){
284
  return '';
285
  }
286
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
287
  }
1
  <?php
2
 
3
  namespace Wdr\App\Helpers;
 
4
  if (!defined('ABSPATH')) exit; // Exit if accessed directly
 
5
  class Helper
6
  {
7
  /**
11
  * @param $additional_products array
12
  * @return array
13
  * */
14
+ public static function combineProductArrays($products, $additional_products)
15
+ {
16
  $products = array_merge($products, $additional_products);
17
  $products = array_unique($products);
 
18
  return $products;
19
  }
20
 
23
  *
24
  * @return boolean
25
  * */
26
+ public static function hasPro()
27
+ {
28
  if (defined('WDR_PRO'))
29
+ if (WDR_PRO === true) return true;
 
30
  return false;
31
  }
32
 
36
  * @param $data mixed
37
  * @return mixed
38
  * */
39
+ public static function formatAllPrices($data)
40
+ {
41
+ if (is_array($data)) {
42
+ if (isset($data['initial_price']) && !isset($data['initial_price_html'])) {
43
  $data['initial_price_html'] = Woocommerce::formatPrice($data['initial_price']);
44
  }
45
+ if (isset($data['discounted_price']) && !isset($data['discounted_price_html'])) {
46
  $data['discounted_price_html'] = Woocommerce::formatPrice($data['discounted_price']);
47
  }
48
+ if (isset($data['initial_price_with_tax']) && !isset($data['initial_price_with_tax_html'])) {
49
  $data['initial_price_with_tax_html'] = Woocommerce::formatPrice($data['initial_price_with_tax']);
50
  }
51
+ if (isset($data['discounted_price_with_tax']) && !isset($data['discounted_price_with_tax_html'])) {
52
  $data['discounted_price_with_tax_html'] = Woocommerce::formatPrice($data['discounted_price_with_tax']);
53
  }
54
+ if (!isset($data['currency_symbol'])) {
55
  $data['currency_symbol'] = Woocommerce::get_currency_symbol();
56
  }
57
  }
 
58
  return $data;
59
  }
60
 
64
  * @param string $folder
65
  * @return string
66
  * */
67
+ public static function getTemplateOverride($template_name, $folder = '')
68
+ {
69
+ if (!empty($folder)) {
70
+ $path = trailingslashit('woo-discount-rules') . $folder . "/" . $template_name;
71
  } else {
72
+ $path = trailingslashit('woo-discount-rules') . $template_name;
73
  }
74
  $template = locate_template(
75
  array(
77
  $template_name,
78
  )
79
  );
 
80
  return $template;
81
  }
82
 
88
  * @param $folder string
89
  * @return string
90
  * */
91
+ public static function getTemplatePath($template_name, $default_path, $folder = '')
92
+ {
93
  $path_from_template = self::getTemplateOverride($template_name, $folder);
94
+ if ($path_from_template) $default_path = $path_from_template;
 
95
  return $default_path;
96
  }
97
 
103
  * @param $type string
104
  * @return bool
105
  * */
106
+ public static function isCartItemConsideredForCalculation($status, $cart_item, $type)
107
+ {
108
  return apply_filters('advanced_woo_discount_rules_include_cart_item_to_count_quantity', $status, $cart_item, $type);
109
  }
110
 
111
  /**
112
  * Set messages
113
  * */
114
+ public static function setPromotionMessage($message, $rule_id = '')
115
+ {
116
  $messages = Woocommerce::getSession('awdr_promotion_messages', array());
117
+ if (!is_array($messages)) $messages = array();
118
+ if (!empty($messages) && in_array($message, $messages)) {
119
  } else {
120
+ if (empty($rule_id)) {
121
  $messages[] = $message;
122
  } else {
123
  $messages[$rule_id] = $message;
124
  }
125
  }
 
126
  Woocommerce::setSession('awdr_promotion_messages', $messages);
127
  }
128
 
129
  /**
130
  * Get promotion messages
131
  * */
132
+ public static function getPromotionMessages()
133
+ {
134
  return Woocommerce::getSession('awdr_promotion_messages', array());
135
  }
136
 
137
  /**
138
  * Clear promotion messages
139
  * */
140
+ public static function clearPromotionMessages()
141
+ {
142
  Woocommerce::setSession('awdr_promotion_messages', array());
143
  }
144
 
145
  /**
146
  * ruleConditionDescription
147
  */
148
+ public static function ruleConditionDescription()
149
+ {
150
+ return $content = "<p>" . __('Include additional conditions (if necessary)', WDR_TEXT_DOMAIN) . "</p>
151
+ <b>" . __('Popular conditions:', WDR_TEXT_DOMAIN) . "</b>
152
  <span style='width: 100%; display: flex;'>
153
  <span style='width: 45%; padding-right: 5px;'>
154
  <ul class='awdr-bullet-style'>
155
+ <li ><a href=' https://docs.flycart.org/en/articles/3977542-subtotal-based-free-product-2-0?utm_source=woo-discount-rules-v2&utm_campaign=doc&utm_medium=text-click&utm_content=subtotal_documentation' target='_blank'>" . __('Subtotal', WDR_TEXT_DOMAIN) . "</a></li>
156
+ <li ><a href=' https://docs.flycart.org/en/articles/4203313-user-role-based-discount-rules-discount-rules-2-0?utm_source=woo-discount-rules-v2&utm_campaign=doc&utm_medium=text-click&utm_content=user_role_documentation' target='_blank'>" . __('User role', WDR_TEXT_DOMAIN) . "</a></li>
157
+ <li >" . __('Days & Time', WDR_TEXT_DOMAIN) . "</li>
158
+ <li >" . __('Purchase History', WDR_TEXT_DOMAIN) . "</li>
159
+ <li >" . __('Payment Method', WDR_TEXT_DOMAIN) . "</li>
160
  </ul>
161
  </span>
162
  <span style='width: 45%;'>
163
  <ul class='awdr-bullet-style'>
164
+ <li ><a href='https://docs.flycart.org/en/articles/4268595-activate-discount-rule-using-a-coupon-code-in-woocommerce-2-0?utm_source=woo-discount-rules-v2&utm_campaign=doc&utm_medium=text-click&utm_content=coupon_documentation' target='_blank'>" . __('Coupon', WDR_TEXT_DOMAIN) . "</a></li>
165
+ <li ><a href='https://docs.flycart.org/en/articles/4214869-customer-shipping-address-based-discount-2-0?utm_source=woo-discount-rules-v2&utm_campaign=doc&utm_medium=text-click&utm_content=shipping_address_documentation' target='_blank'>" . __('Shipping Address', WDR_TEXT_DOMAIN) . "</a></li>
166
+ <li>" . __('Category Combination', WDR_TEXT_DOMAIN) . "</li>
167
+ <li><a href='https://docs.flycart.org/en/articles/4164153-buy-product-a-b-and-get-discount-in-product-c-discount-rules-2-0?utm_source=woo-discount-rules-v2&utm_campaign=doc&utm_medium=text-click&utm_content=product_combination' target='_blank'>" . __('Product Combination', WDR_TEXT_DOMAIN) . "</a></li>
168
+ <li >" . __('Quantities/Line items', WDR_TEXT_DOMAIN) . "</li>
169
 
170
 
171
  </ul>
177
  * bogoToolTipDescriptionForIndividualProduct
178
  * @return mixed
179
  */
180
+ public static function bogoToolTipDescriptionForIndividualProduct()
181
+ {
182
  return $content = __("Individual Product :
183
  This counts the total quantity of each product / line item separately.
184
  Example:
192
  * bogoToolTipDescriptionForFilterTogether
193
  * @return mixed
194
  */
195
+ public static function bogoToolTipDescriptionForFilterTogether()
196
+ {
197
  return $content = __("Filter set above :
198
  This will count the quantities of products set in the 'Filter' section.
199
  Example: If you selected a few categories there, it will count the quantities of products in those categories added in cart. If you selected a few products in the filters section, then it will count the quantities together.
204
  * bogoToolTipDescriptionForvariants
205
  * @return mixed
206
  */
207
+ public static function bogoToolTipDescriptionForvariants()
208
+ {
209
  return $content = __('All variants in each product together :
210
  Useful when applying discounts based on variable products and you want the quantity to be counted based on the parent product.
211
  Example:
214
  ', WDR_TEXT_DOMAIN);
215
  }
216
 
217
+ public static function create_nonce($action = -1)
218
+ {
219
  return wp_create_nonce($action);
220
  }
221
 
222
+ protected static function verify_nonce($nonce, $action = -1)
223
+ {
224
+ if (wp_verify_nonce($nonce, $action)) {
225
  return true;
226
  } else {
227
  return false;
228
  }
229
  }
230
 
231
+ public static function validateRequest($method, $awdr_nonce = null)
232
+ {
233
+ if ($awdr_nonce === null) {
234
+ if (isset($_REQUEST['awdr_nonce']) && !empty($_REQUEST['awdr_nonce'])) {
235
+ if (self::verify_nonce(wp_unslash($_REQUEST['awdr_nonce']), $method)) {
236
  return true;
237
  }
238
  }
239
  } else {
240
+ if (self::verify_nonce(wp_unslash($awdr_nonce), $method)) {
241
  return true;
242
  }
243
  }
 
244
  die(__('Invalid token', WDR_TEXT_DOMAIN));
245
  }
246
 
247
+ public static function filterSelect2SearchQuery($query)
248
+ {
249
  return esc_sql(stripslashes($query));
250
  }
251
 
252
+ public static function displayCompatibleCheckMessages()
253
+ {
254
+ if (version_compare(WDR_VERSION, '2.2.0', '>=')) {
255
+ if (defined('WDR_PRO_VERSION')) {
256
+ if (version_compare(WDR_PRO_VERSION, '2.2.0', '<')) {
257
+ $url = admin_url() . "plugins.php";
258
+ $plugin_page = '<a target="_blank" href="' . $url . '">' . __('Update now', WDR_TEXT_DOMAIN) . '</a>';
259
  ?>
260
  <br>
261
  <div class="notice inline notice notice-warning notice-alt awdr-rule-limit-disabled">
269
  }
270
  }
271
 
272
+ public static function hasAdminPrivilege()
273
+ {
274
+ if (current_user_can('manage_woocommerce')) {
275
  return true;
276
  } else {
277
  return false;
278
  }
279
  }
280
 
281
+ public static function getCleanHtml($html)
282
+ {
283
  try {
284
  $html = html_entity_decode($html);
285
+ $html = preg_replace('/(<(script|style|iframe)\b[^>]*>).*?(<\/\2>)/is', "$1$3", $html);
286
  $allowed_html = array(
287
  'br' => array(),
288
  'strong' => array(),
291
  'p' => array('class' => array()),
292
  );
293
  return wp_kses($html, $allowed_html);
294
+ } catch (\Exception $e) {
295
  return '';
296
  }
297
  }
298
+
299
+ /**
300
+ * check the given content is json or not
301
+ * @param $string
302
+ * @return bool
303
+ */
304
+ static function isJson($string)
305
+ {
306
+ json_decode($string);
307
+ return (json_last_error() == JSON_ERROR_NONE);
308
+ }
309
+
310
+ /**
311
+ * sanitize the json data
312
+ * @param $data
313
+ * @return bool|false|mixed|string
314
+ */
315
+ static function sanitizeJson($data)
316
+ {
317
+ $arr = array();
318
+ if (is_array($data)) {
319
+ $arr = $data;
320
+ } elseif (is_object($data)) {
321
+ $encoded = wp_json_encode($data);
322
+ $arr = json_decode($encoded, true);
323
+ } elseif (self::isJson($data)) {
324
+ $arr = json_decode($data, true);
325
+ }
326
+ $result = array();
327
+ if (is_array($arr) && !empty($arr)) {
328
+ foreach ($arr as $key => $value) {
329
+ if (is_array($value) || is_object($value)) {
330
+ $value = self::sanitizeJson($value);
331
+ $result[sanitize_key($key)] = $value;
332
+ } else {
333
+ if (is_string($value)) {
334
+ $value = sanitize_text_field($value);
335
+ } elseif (is_int($value)) {
336
+ $value = intval($value);
337
+ } elseif (is_float($value)) {
338
+ $value = floatval($value);
339
+ } else {
340
+ $value = sanitize_text_field($value);
341
+ }
342
+ $result[sanitize_key($key)] = $value;
343
+ }
344
+ }
345
+ }
346
+ return $result;
347
+ }
348
  }
v2/App/Helpers/Rule.php CHANGED
@@ -1244,6 +1244,7 @@ class Rule
1244
  $current_user = get_current_user_id();
1245
  $rule_id = intval($this->getFromArray($post, 'edit_rule', NULL));
1246
  $title = $this->getFromArray($post, 'title', esc_html__('Untitled Rule', WDR_TEXT_DOMAIN));
 
1247
  $enabled = $this->getFromArray($post, 'enabled', '0');
1248
  $exclusive = $this->getFromArray($post, 'exclusive', '0');
1249
  $date_from = $this->getFromArray($post, 'date_from', NULL);
@@ -1257,9 +1258,11 @@ class Rule
1257
  if (!empty($rule_conditions)) {
1258
  foreach ($rule_conditions as $coupon_key => $coupon_conditions) {
1259
  $type = (isset($coupon_conditions['type']) && !empty($coupon_conditions['type'])) ? $coupon_conditions['type'] : '';
 
1260
  $operator = (isset($coupon_conditions['options']['operator']) && !empty($coupon_conditions['options']['operator'])) ? $coupon_conditions['options']['operator'] : '';
1261
  $awdr_woo_coupon_name = (isset($coupon_conditions['options']['value']) && !empty($coupon_conditions['options']['value'])) ? $coupon_conditions['options']['value'] : '';
1262
  $coupon_name = (isset($coupon_conditions['options']['custom_value']) && !empty($coupon_conditions['options']['custom_value'])) ? $coupon_conditions['options']['custom_value'] : '';
 
1263
  if ($type == 'cart_coupon' && $operator == 'custom_coupon' && $coupon_name != '') {
1264
  $coupon_name = trim($coupon_name);
1265
  //$coupon_name = str_replace(' ', '', $coupon_name);
@@ -1277,14 +1280,28 @@ class Rule
1277
  if(!empty($awdr_woo_coupon_name)){
1278
  $awdr_coupon_names = array_merge($awdr_coupon_names,$awdr_woo_coupon_name);
1279
  }
 
 
1280
  }
1281
  }
1282
  }
1283
  $rule_additional = $this->getFromArray($post, 'additional', array());
1284
  $product_adjustments = $this->getFromArray($post, 'product_adjustments', array());
 
 
 
1285
  $cart_adjustments = $this->getFromArray($post, 'cart_adjustments', array());
 
 
 
1286
  $bulk_adjustments = $this->getFromArray($post, 'bulk_adjustments', array());
 
 
 
1287
  $set_adjustments = $this->getFromArray($post, 'set_adjustments', array());
 
 
 
1288
  $buyx_getx_adjustments = $this->getFromArray($post, 'buyx_getx_adjustments', array());
1289
  $buy_x_get_y_adjustments = $this->getFromArray($post, 'buyx_gety_adjustments', array());
1290
  if(!empty($buy_x_get_y_adjustments)){
@@ -1312,7 +1329,7 @@ class Rule
1312
  $discount_badge_text = (isset($_POST['discount_badge']['badge_text'])) ? $_POST['discount_badge']['badge_text'] : '';
1313
  if (!empty($discount_badge_text)) {
1314
  $discount_badge_text = stripslashes($discount_badge_text);
1315
- $discount_badge['badge_text'] = $discount_badge_text;
1316
  }
1317
  }
1318
 
@@ -1367,7 +1384,27 @@ class Rule
1367
  do_action('advanced_woo_discount_rules_after_save_rule', $rule_id, $post, $arg);
1368
  }
1369
  return $rule_id;
 
1370
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1371
  }
1372
 
1373
  /**
1244
  $current_user = get_current_user_id();
1245
  $rule_id = intval($this->getFromArray($post, 'edit_rule', NULL));
1246
  $title = $this->getFromArray($post, 'title', esc_html__('Untitled Rule', WDR_TEXT_DOMAIN));
1247
+ $title = self::validateHtmlBeforeSave($title);
1248
  $enabled = $this->getFromArray($post, 'enabled', '0');
1249
  $exclusive = $this->getFromArray($post, 'exclusive', '0');
1250
  $date_from = $this->getFromArray($post, 'date_from', NULL);
1258
  if (!empty($rule_conditions)) {
1259
  foreach ($rule_conditions as $coupon_key => $coupon_conditions) {
1260
  $type = (isset($coupon_conditions['type']) && !empty($coupon_conditions['type'])) ? $coupon_conditions['type'] : '';
1261
+ $options = (isset($coupon_conditions['options']) && !empty($coupon_conditions['options'])) ? $coupon_conditions['options'] : '';
1262
  $operator = (isset($coupon_conditions['options']['operator']) && !empty($coupon_conditions['options']['operator'])) ? $coupon_conditions['options']['operator'] : '';
1263
  $awdr_woo_coupon_name = (isset($coupon_conditions['options']['value']) && !empty($coupon_conditions['options']['value'])) ? $coupon_conditions['options']['value'] : '';
1264
  $coupon_name = (isset($coupon_conditions['options']['custom_value']) && !empty($coupon_conditions['options']['custom_value'])) ? $coupon_conditions['options']['custom_value'] : '';
1265
+ $subtotal_promotion_message = isset($options['subtotal_promotion_message']) ? $options['subtotal_promotion_message'] : '';
1266
  if ($type == 'cart_coupon' && $operator == 'custom_coupon' && $coupon_name != '') {
1267
  $coupon_name = trim($coupon_name);
1268
  //$coupon_name = str_replace(' ', '', $coupon_name);
1280
  if(!empty($awdr_woo_coupon_name)){
1281
  $awdr_coupon_names = array_merge($awdr_coupon_names,$awdr_woo_coupon_name);
1282
  }
1283
+ }else if(!empty($subtotal_promotion_message) && $subtotal_promotion_message != ''){
1284
+ $rule_conditions[$coupon_key]['options']['subtotal_promotion_message'] = self::validateHtmlBeforeSave($subtotal_promotion_message);
1285
  }
1286
  }
1287
  }
1288
  $rule_additional = $this->getFromArray($post, 'additional', array());
1289
  $product_adjustments = $this->getFromArray($post, 'product_adjustments', array());
1290
+ if(isset( $product_adjustments['cart_label']) && !empty( $product_adjustments['cart_label'])){
1291
+ $product_adjustments['cart_label'] = self::validateHtmlBeforeSave( $product_adjustments['cart_label']);
1292
+ }
1293
  $cart_adjustments = $this->getFromArray($post, 'cart_adjustments', array());
1294
+ if(isset($cart_adjustments['label']) && !empty($cart_adjustments['label'])){
1295
+ $cart_adjustments['label'] = self::validateHtmlBeforeSave($cart_adjustments['label']);
1296
+ }
1297
  $bulk_adjustments = $this->getFromArray($post, 'bulk_adjustments', array());
1298
+ if(isset( $bulk_adjustments['cart_label']) && !empty( $bulk_adjustments['cart_label'])){
1299
+ $bulk_adjustments['cart_label'] = self::validateHtmlBeforeSave( $bulk_adjustments['cart_label']);
1300
+ }
1301
  $set_adjustments = $this->getFromArray($post, 'set_adjustments', array());
1302
+ if(isset($set_adjustments['cart_label']) && !empty($set_adjustments['cart_label'])){
1303
+ $set_adjustments['cart_label'] = self::validateHtmlBeforeSave($set_adjustments['cart_label']);
1304
+ }
1305
  $buyx_getx_adjustments = $this->getFromArray($post, 'buyx_getx_adjustments', array());
1306
  $buy_x_get_y_adjustments = $this->getFromArray($post, 'buyx_gety_adjustments', array());
1307
  if(!empty($buy_x_get_y_adjustments)){
1329
  $discount_badge_text = (isset($_POST['discount_badge']['badge_text'])) ? $_POST['discount_badge']['badge_text'] : '';
1330
  if (!empty($discount_badge_text)) {
1331
  $discount_badge_text = stripslashes($discount_badge_text);
1332
+ $discount_badge['badge_text'] = self::validateHtmlBeforeSave($discount_badge_text);
1333
  }
1334
  }
1335
 
1384
  do_action('advanced_woo_discount_rules_after_save_rule', $rule_id, $post, $arg);
1385
  }
1386
  return $rule_id;
1387
+ }
1388
 
1389
+ /**
1390
+ * Remove some Html tags before save
1391
+ * @param $value
1392
+ * @return mixed
1393
+ */
1394
+ static function validateHtmlBeforeSave($value){
1395
+ if (!empty($value)) {
1396
+ $html = html_entity_decode($value);
1397
+ $html = preg_replace('/(<(script|style|iframe)\b[^>]*>).*?(<\/\2>)/is', "$1$3", $html);
1398
+ $allowed_html = array(
1399
+ 'br' => array(),
1400
+ 'strong' => array(),
1401
+ 'span' => array('class' => array()),
1402
+ 'div' => array('class' => array()),
1403
+ 'p' => array('class' => array()),
1404
+ );
1405
+ return wp_kses($html, $allowed_html);
1406
+ }
1407
+ return $value;
1408
  }
1409
 
1410
  /**
v2/App/Helpers/Validation.php ADDED
@@ -0,0 +1,451 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Wdr\App\Helpers;
4
+
5
+ use Valitron\Validator;
6
+
7
+ if (!defined('ABSPATH')) exit; // Exit if accessed directly
8
+ class Validation
9
+ {
10
+ static $is_condition_value_valid = NULL;
11
+
12
+ /**
13
+ * validate input against the alpha numeric and spaces
14
+ * @param $field
15
+ * @param $value
16
+ * @param array $params
17
+ * @param array $fields
18
+ * @return bool
19
+ */
20
+ static function validateAlphaNumWithSpace($field, $value, array $params, array $fields)
21
+ {
22
+ return (bool)preg_match('/^[\p{L}\p{Nd} .-]+$/', $value);
23
+ }
24
+
25
+ /**
26
+ * validate Input Text Html Tags
27
+ *
28
+ * @param $field
29
+ * @param $value
30
+ * @param array $params
31
+ * @param array $fields
32
+ * @return bool
33
+ */
34
+ static function validateBasicHtmlTags($field, $value, array $params, array $fields)
35
+ {
36
+ $value = stripslashes($value);
37
+ $value = html_entity_decode($value);
38
+ $invalid_tags = array("script", "iframe", "style");
39
+ foreach ($invalid_tags as $tag_name) {
40
+ $pattern = "#<\s*?$tag_name\b[^>]*>(.*?)</$tag_name\b[^>]*>#s";;
41
+ preg_match($pattern, $value, $matches);
42
+ //script or iframe found
43
+ if (!empty($matches)) {
44
+ return false;
45
+ }
46
+ }
47
+ return true;
48
+ }
49
+
50
+ /**
51
+ * validate Plain Input Text
52
+ *
53
+ * @param $field
54
+ * @param $value
55
+ * @param array $params
56
+ * @param array $fields
57
+ * @return bool
58
+ */
59
+ static function validatePlainInputText($field, $value, array $params, array $fields)
60
+ {
61
+ if (!empty($value)) {
62
+ $value = html_entity_decode($value);
63
+ $html = Woocommerce::removeHtmlTags($value);
64
+ return ($html === trim($value));
65
+ } else {
66
+ return true;
67
+ }
68
+ }
69
+
70
+ /**
71
+ * validate input against the alpha numeric and spaces
72
+ * @param $field
73
+ * @param $value
74
+ * @param array $params
75
+ * @param array $fields
76
+ * @return bool
77
+ */
78
+ static function validateColor($field, $value, array $params, array $fields)
79
+ {
80
+ return (bool)preg_match('/^#(([0-9a-fA-F]{2}){3}|([0-9a-fA-F]){3})$/', $value);
81
+ }
82
+
83
+ /**
84
+ * validate the value is float or not
85
+ * @param $field
86
+ * @param $value
87
+ * @param array $params
88
+ * @param array $fields
89
+ * @return bool
90
+ */
91
+ static function validateFloat($field, $value, array $params, array $fields)
92
+ {
93
+ return (is_numeric($value) || is_float($value));
94
+ }
95
+
96
+ /**
97
+ * validate the value is 0 or 1
98
+ * @param $field
99
+ * @param $value
100
+ * @param array $params
101
+ * @param array $fields
102
+ * @return bool
103
+ */
104
+ static function validateChecked($field, $value, array $params, array $fields)
105
+ {
106
+ return (in_array($value, array('0', '1')));
107
+ }
108
+
109
+ /**
110
+ * validate the conditional values
111
+ * @param $field
112
+ * @param $value
113
+ * @param array $params
114
+ * @param array $fields
115
+ * @return bool
116
+ */
117
+ static function validateConditionFields($field, $value, array $params, array $fields)
118
+ {
119
+ if (is_array($value)) {
120
+ foreach ($value as $input_val) {
121
+ if (!self::validateConditionFields($field, $input_val, $params, $fields)) {
122
+ return false;
123
+ }
124
+ }
125
+ } else {
126
+ return self::validatePlainInputText($field, $value, $params, $fields);
127
+ }
128
+ return true;
129
+ }
130
+
131
+ /**
132
+ * validate rules while saving data
133
+ * @param $post_values
134
+ * @return array|bool
135
+ */
136
+ static function validateRules($post_values)
137
+ {
138
+ $input_validator = new Validator($post_values);
139
+ Validator::addRule('basicTags', array(__CLASS__, 'validateBasicHtmlTags'), __('Invalid characters', WDR_TEXT_DOMAIN));
140
+ Validator::addRule('checkPlainInputText', array(__CLASS__, 'validatePlainInputText'), __('Accepts only letters a-z, numbers 0-9 and spaces with special characters', WDR_TEXT_DOMAIN));
141
+ Validator::addRule('float', array(__CLASS__, 'validateFloat'), __('Accepts only numbers 0-9 and one dot', WDR_TEXT_DOMAIN));
142
+ Validator::addRule('checked', array(__CLASS__, 'validateChecked'), __('Accepts only 0 or 1', WDR_TEXT_DOMAIN));
143
+ Validator::addRule('color', array(__CLASS__, 'validateColor'), __('Accepts only hex color code', WDR_TEXT_DOMAIN));
144
+ Validator::addRule('conditionValues', array(__CLASS__, 'validateConditionFields'), __('Invalid characters', WDR_TEXT_DOMAIN));
145
+ //may contain
146
+ $input_validator->rule('checkPlainInputText',
147
+ array(
148
+ 'title',
149
+ 'product_adjustments.cart_label',
150
+ 'cart_adjustments.label',
151
+ 'bulk_adjustments.ranges.*.label',
152
+ 'set_adjustments.ranges.*.label',
153
+ 'conditions.*.options.custom_value',
154
+ )
155
+ );
156
+ //Discount bar accept br, strong, span,div, p tags only
157
+ $input_validator->rule('basicTags',
158
+ array(
159
+ 'discount_badge.badge_text',
160
+ 'conditions.*.options.subtotal_promotion_message', //regex for exclude our tags - > '/^[a-zA-Z0-9 _}?{-]*$/'
161
+ )
162
+ );
163
+ //Validation condition values
164
+ $input_validator->rule('conditionValues',
165
+ array(
166
+ 'conditions.*.options.value',
167
+ )
168
+ );
169
+ //exclude our short code
170
+ $input_validator->rule('regex', array(
171
+ 'conditions.*.options.time',
172
+ 'conditions.*.options.to',
173
+ 'conditions.*.options.from',
174
+ ), '/^[\p{L}\p{Nd} :._-]+$/');
175
+ //validate slug may contains a-zA-Z0-9_-
176
+ $input_validator->rule('slug',
177
+ array(
178
+ 'discount_type',
179
+ 'product_adjustments.type',
180
+ 'filters.*.type',
181
+ 'filters.*.method',
182
+ 'filters.*.value.*',
183
+ 'cart_adjustments.type',
184
+ 'bulk_adjustments.operator',
185
+ 'bulk_adjustments.ranges.*.type',
186
+ 'set_adjustments.operator',
187
+ 'set_adjustments.ranges.*.type',
188
+ 'buyx_getx_adjustments.ranges.*.free_type',
189
+ 'buyx_gety_adjustments.type',
190
+ 'buyx_gety_adjustments.operator',
191
+ 'buyx_gety_adjustments.mode',
192
+ 'buyx_gety_adjustments.ranges.*.free_type',
193
+ 'additional.condition_relationship',
194
+ 'conditions.*.type',
195
+ 'conditions.*.options.operator',
196
+ 'conditions.*.options.calculate_from',
197
+ 'conditions.*.options.status.*',
198
+ 'conditions.*.options.combination',
199
+ 'conditions.*.options.type',
200
+ 'conditions.*.options.cartqty',
201
+ )
202
+ );
203
+ //only numbers, not accepts float also
204
+ $input_validator->rule('integer',
205
+ array(
206
+ 'usage_limits',
207
+ 'bulk_adjustments.ranges.*.from',
208
+ 'bulk_adjustments.ranges.*.to',
209
+ 'set_adjustments.ranges.*.from',
210
+ 'buyx_getx_adjustments.ranges.*.from',
211
+ 'buyx_getx_adjustments.ranges.*.to',
212
+ 'buyx_getx_adjustments.ranges.*.free_qty',
213
+ 'buyx_gety_adjustments.ranges.*.from',
214
+ 'buyx_gety_adjustments.ranges.*.to',
215
+ 'buyx_gety_adjustments.ranges.*.products.*',
216
+ 'buyx_gety_adjustments.ranges.*.free_qty',
217
+ 'buyx_gety_adjustments.ranges.*.categories.*',
218
+ 'conditions.*.options.products.*',
219
+ 'conditions.*.options.product.*',
220
+ 'conditions.*.options.category.*',
221
+ 'conditions.*.options.qty',
222
+ )
223
+ );
224
+ //may contain flot or number
225
+ $input_validator->rule('float',
226
+ array(
227
+ 'product_adjustments.value',
228
+ 'cart_adjustments.value',
229
+ 'bulk_adjustments.ranges.*.value',
230
+ 'set_adjustments.ranges.*.value',
231
+ 'conditions.*.options.amount',
232
+ )
233
+ );
234
+ // must 0 or 1
235
+ $input_validator->rule('checked',
236
+ array(
237
+ 'enabled',
238
+ 'exclusive',
239
+ 'product_adjustments.apply_as_cart_rule',
240
+ 'bulk_adjustments.apply_as_cart_rule',
241
+ 'set_adjustments.apply_as_cart_rule',
242
+ 'buyx_getx_adjustments.ranges.*.recursive',
243
+ 'buyx_gety_adjustments.ranges.*.recursive',
244
+ 'discount_badge.display')
245
+ );
246
+ // format date
247
+ $input_validator->rule('dateFormat', array(
248
+ 'date_from',
249
+ 'date_to'
250
+ ), 'Y-m-d H:i');
251
+ //validate only hex color code #000000 or #fff
252
+ $input_validator->rule('color', array(
253
+ 'discount_badge.badge_color_picker',
254
+ 'discount_badge.badge_text_color_picker',
255
+ ));
256
+ if ($input_validator->validate()) {
257
+ return true;
258
+ } else {
259
+ return $input_validator->errors();
260
+ }
261
+ }
262
+
263
+ /**
264
+ * validate Radio Button And Select Box
265
+ *
266
+ * @param $field
267
+ * @param $value
268
+ * @param array $params
269
+ * @param array $fields
270
+ * @return bool
271
+ */
272
+ static function validateRadioButtonAndSelectBox($field, $value, array $params, array $fields)
273
+ {
274
+ $acceptable = array('yes', 'on', 1, '1', true, 0, '0');
275
+ return in_array($value, $acceptable, true);
276
+ }
277
+
278
+ /**
279
+ * Check alphaNum values for selected array values (multi select box)
280
+ *
281
+ * @param $field
282
+ * @param $value
283
+ * @param array $params
284
+ * @param array $fields
285
+ * @return bool
286
+ */
287
+ static function validateSelectedArrayValues($field, $value, array $params, array $fields)
288
+ {
289
+ $result = false;
290
+ if (is_array($value) && !empty($value)) {
291
+ $result = true;
292
+ foreach ($value as $val) {
293
+ //Validate that a field contains only alpha-numeric characters, dashes, and underscores
294
+ if (!preg_match('/^([-a-z0-9_-])+$/i', $val)) {
295
+ $result = false;
296
+ }
297
+ }
298
+ }
299
+ return $result;
300
+ }
301
+
302
+ /**
303
+ * Validate discount rules settings tab input fields
304
+ * @param $post_values
305
+ * @return bool
306
+ */
307
+ static function validateSettingsTabFields($post_values)
308
+ {
309
+ $settings_fields_validator = new Validator($post_values);
310
+ Validator::addRule('basicTags', array(__CLASS__, 'validateBasicHtmlTags'), __('Invalid characters', WDR_TEXT_DOMAIN));
311
+ Validator::addRule('radioButtonAndSelectBox', array(__CLASS__, 'validateRadioButtonAndSelectBox'), __('Accept only yes, on, 1, true', WDR_TEXT_DOMAIN));
312
+ Validator::addRule('plainInputText', array(__CLASS__, 'validatePlainInputText'), __('Should not contain any tags', WDR_TEXT_DOMAIN));
313
+ Validator::addRule('selectedArrayValues', array(__CLASS__, 'validateSelectedArrayValues'), __('Should not contain any tags and special characters', WDR_TEXT_DOMAIN));
314
+ //allow br, strong, span,div, p tags only
315
+ $settings_fields_validator->rule('basicTags',
316
+ array(
317
+ 'on_sale_badge_html',
318
+ 'applied_rule_message',
319
+ )
320
+ );
321
+ //Should not allow any tags
322
+ $settings_fields_validator->rule('plainInputText',
323
+ array(
324
+ 'discount_label_for_combined_discounts',
325
+ 'free_shipping_title',
326
+ 'you_saved_text',
327
+ )
328
+ );
329
+ //validate yes, on, 1, true, 0 , '0'
330
+ $settings_fields_validator->rule('radioButtonAndSelectBox',
331
+ array(
332
+ 'apply_discount_subsequently',
333
+ 'refresh_order_review',
334
+ 'suppress_other_discount_plugins',
335
+ 'customize_on_sale_badge',
336
+ 'force_override_on_sale_badge',
337
+ 'show_bulk_table',
338
+ 'table_column_header',
339
+ 'table_title_column',
340
+ 'table_range_column',
341
+ 'table_discount_column_value',
342
+ 'table_discount_column',
343
+ 'modify_price_at_shop_page',
344
+ 'modify_price_at_product_page',
345
+ 'modify_price_at_category_page',
346
+ 'show_strikeout_on_cart',
347
+ 'combine_all_cart_discounts',
348
+ 'show_subtotal_promotion',
349
+ 'show_promo_text_con',
350
+ 'show_applied_rules_message_on_cart',
351
+ )
352
+ );
353
+ //validate slug may contains a-zA-Z0-9_-
354
+ $settings_fields_validator->rule('slug',
355
+ array(
356
+ 'table_title_column_name',
357
+ 'table_discount_column_name',
358
+ 'table_range_column_name',
359
+ 'calculate_discount_from',
360
+ 'apply_product_discount_to',
361
+ 'disable_coupon_when_rule_applied',
362
+ 'show_on_sale_badge',
363
+ 'position_to_show_bulk_table',
364
+ 'position_to_show_discount_bar',
365
+ 'show_strikeout_when',
366
+ 'display_saving_text',
367
+ )
368
+ );
369
+ //validate integer 0,1,2..
370
+ $settings_fields_validator->rule('integer',
371
+ array(
372
+ 'customize_bulk_table_title',
373
+ 'customize_bulk_table_discount',
374
+ 'customize_bulk_table_range',
375
+ )
376
+ );
377
+ //validate array
378
+ $settings_fields_validator->rule('selectedArrayValues',
379
+ array(
380
+ 'awdr_rebuild_on_sale_rules',
381
+ 'show_promo_text',
382
+ )
383
+ );
384
+ //LicenceKey
385
+ $settings_fields_validator->rule('alphaNum',
386
+ array(
387
+ 'licence_key',
388
+ )
389
+ );
390
+ if ($settings_fields_validator->validate()) {
391
+ return true;
392
+ } else {
393
+ return false;
394
+ }
395
+ }
396
+
397
+ /**
398
+ * Validate discount rules licence key input
399
+ * @param $post_values
400
+ * @return bool
401
+ */
402
+ static function validateLicenceKay($post_values)
403
+ {
404
+ $rules = [
405
+ 'alphaNum' => 'licence_key',
406
+ ];
407
+ $v = new Validator(array('licence_key' => $post_values));
408
+ $v->rules($rules);
409
+ return $v->validate();
410
+ }
411
+
412
+ /**
413
+ *validate Report Fields
414
+ *
415
+ * @param $field
416
+ * @param $value
417
+ * @param array $params
418
+ * @param array $fields
419
+ * @return bool
420
+ */
421
+ static function validateReportFields($field, $value, array $params, array $fields)
422
+ {
423
+ return (bool)preg_match('/^[a-zA-Z0-9 :_-]+$/', $value);
424
+ }
425
+
426
+ /**
427
+ * validate Report Tab Fields
428
+ *
429
+ * @param $post_values
430
+ * @return bool
431
+ */
432
+ static function validateReportTabFields($post_values)
433
+ {
434
+ $report_fields_validator = new Validator($post_values);
435
+ Validator::addRule('reportFields', array(__CLASS__, 'validateReportFields'), __('Validation error', WDR_TEXT_DOMAIN));
436
+ //Validation condition values
437
+ $report_fields_validator->rule('reportFields',
438
+ array(
439
+ 'period',
440
+ 'from',
441
+ 'to',
442
+ 'type',
443
+ )
444
+ );
445
+ if ($report_fields_validator->validate()) {
446
+ return true;
447
+ } else {
448
+ return false;
449
+ }
450
+ }
451
+ }
v2/App/Helpers/Woocommerce.php CHANGED
@@ -1564,4 +1564,19 @@ class Woocommerce
1564
  }
1565
  return $user_email;
1566
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1567
  }
1564
  }
1565
  return $user_email;
1566
  }
1567
+
1568
+ /**
1569
+ * remove Html Tags
1570
+ *
1571
+ * @param $html
1572
+ * @return string
1573
+ */
1574
+ public static function removeHtmlTags($html){
1575
+ if (function_exists('wp_strip_all_tags')) {
1576
+ $html = wp_strip_all_tags($html);
1577
+ }else{
1578
+ $html = strip_tags($html);
1579
+ }
1580
+ return $html;
1581
+ }
1582
  }
v2/App/Models/DBTable.php CHANGED
@@ -39,9 +39,10 @@ class DBTable
39
  {
40
  global $wpdb;
41
  require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
 
42
  $charset_collate = $wpdb->get_charset_collate();
43
  $rules_table_name = $wpdb->prefix . self::RULES_TABLE_NAME;
44
- $rules_table_query = "CREATE TABLE IF NOT EXISTS $rules_table_name (
45
  `id` int(11) NOT NULL AUTO_INCREMENT,
46
  `enabled` tinyint(1) DEFAULT '1',
47
  `deleted` tinyint(1) DEFAULT '0',
@@ -75,7 +76,7 @@ class DBTable
75
  PRIMARY KEY (`id`)
76
  ) $charset_collate;";
77
  $order_discount_table_name = $wpdb->prefix . self::ORDER_DISCOUNT_TABLE_NAME;
78
- $order_discount_table_query = "CREATE TABLE IF NOT EXISTS $order_discount_table_name (
79
  `id` int(11) NOT NULL AUTO_INCREMENT,
80
  `order_id` int(11) DEFAULT NULL,
81
  `has_free_shipping` enum('yes','no') NOT NULL DEFAULT 'no',
@@ -86,7 +87,7 @@ class DBTable
86
  PRIMARY KEY (`id`)
87
  ) $charset_collate;";
88
  $order_item_discount_table_name = $wpdb->prefix . self::ORDER_ITEM_DISCOUNT_TABLE_NAME;
89
- $order_item_discount_table_query = "CREATE TABLE IF NOT EXISTS $order_item_discount_table_name (
90
  `id` int(11) NOT NULL AUTO_INCREMENT,
91
  `order_id` int(11) DEFAULT NULL,
92
  `rule_id` int(11) DEFAULT NULL,
@@ -155,6 +156,8 @@ class DBTable
155
  static function getRules($rule_id = NULL, $rule_name = NULL, $export = NULL, $cache = true)
156
  {
157
  global $wpdb;
 
 
158
  $rules_table_name = $wpdb->prefix . self::RULES_TABLE_NAME;
159
 
160
  $is_front_end_request = self::isFrontEndRequest();
39
  {
40
  global $wpdb;
41
  require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
42
+ $wpdb->hide_errors();
43
  $charset_collate = $wpdb->get_charset_collate();
44
  $rules_table_name = $wpdb->prefix . self::RULES_TABLE_NAME;
45
+ $rules_table_query = "CREATE TABLE $rules_table_name (
46
  `id` int(11) NOT NULL AUTO_INCREMENT,
47
  `enabled` tinyint(1) DEFAULT '1',
48
  `deleted` tinyint(1) DEFAULT '0',
76
  PRIMARY KEY (`id`)
77
  ) $charset_collate;";
78
  $order_discount_table_name = $wpdb->prefix . self::ORDER_DISCOUNT_TABLE_NAME;
79
+ $order_discount_table_query = "CREATE TABLE $order_discount_table_name (
80
  `id` int(11) NOT NULL AUTO_INCREMENT,
81
  `order_id` int(11) DEFAULT NULL,
82
  `has_free_shipping` enum('yes','no') NOT NULL DEFAULT 'no',
87
  PRIMARY KEY (`id`)
88
  ) $charset_collate;";
89
  $order_item_discount_table_name = $wpdb->prefix . self::ORDER_ITEM_DISCOUNT_TABLE_NAME;
90
+ $order_item_discount_table_query = "CREATE TABLE $order_item_discount_table_name (
91
  `id` int(11) NOT NULL AUTO_INCREMENT,
92
  `order_id` int(11) DEFAULT NULL,
93
  `rule_id` int(11) DEFAULT NULL,
156
  static function getRules($rule_id = NULL, $rule_name = NULL, $export = NULL, $cache = true)
157
  {
158
  global $wpdb;
159
+ $wpdb->hide_errors();
160
+
161
  $rules_table_name = $wpdb->prefix . self::RULES_TABLE_NAME;
162
 
163
  $is_front_end_request = self::isFrontEndRequest();
v2/App/Router.php CHANGED
@@ -173,13 +173,13 @@ class Router
173
  self::$short_code_manager = (!empty(self::$short_code_manager)) ? self::$short_code_manager : new ShortCodeManager();
174
  add_shortcode('awdr_sale_items_list', array(self::$short_code_manager, 'saleItemsList'));
175
 
176
- $display_banner_text = $manage_discount_class::$config->getConfig('display_banner_text', '');
177
  if($display_banner_text != '' && is_array($display_banner_text) && !empty($display_banner_text)){
178
  foreach ($display_banner_text as $display_hook){
179
  add_action($display_hook, array(self::$short_code_manager, 'bannerContent'));
180
  }
181
  }
182
- add_shortcode('awdr_banner_content', array(self::$short_code_manager, 'bannerContent'));
183
 
184
  // For handling BOGO
185
  add_filter('advanced_woo_discount_rules_after_processed_bogo_free_auto_add', array(self::$manage_discount, 'removeThirdPartyCoupon'));
173
  self::$short_code_manager = (!empty(self::$short_code_manager)) ? self::$short_code_manager : new ShortCodeManager();
174
  add_shortcode('awdr_sale_items_list', array(self::$short_code_manager, 'saleItemsList'));
175
 
176
+ /*$display_banner_text = $manage_discount_class::$config->getConfig('display_banner_text', '');
177
  if($display_banner_text != '' && is_array($display_banner_text) && !empty($display_banner_text)){
178
  foreach ($display_banner_text as $display_hook){
179
  add_action($display_hook, array(self::$short_code_manager, 'bannerContent'));
180
  }
181
  }
182
+ add_shortcode('awdr_banner_content', array(self::$short_code_manager, 'bannerContent'));*/
183
 
184
  // For handling BOGO
185
  add_filter('advanced_woo_discount_rules_after_processed_bogo_free_auto_add', array(self::$manage_discount, 'removeThirdPartyCoupon'));
v2/App/Views/Admin/Rules/Discounts/Cart.php CHANGED
@@ -11,10 +11,10 @@ $is_pro = \Wdr\App\Helpers\Helper::hasPro();
11
  <div class="cart_discount_option wdr-select-filed-hight">
12
  <select class="cart_free_shipping awdr-left-align"
13
  name="cart_adjustments[type]">
14
- <option value="percentage" <?php echo (!empty($cart_adjustment) && $cart_adjustment->type == 'percentage') ? 'selected' : ''; ?>><?php _e('Percentage discount', WDR_TEXT_DOMAIN); ?></option>
15
- <option value="flat_in_subtotal" <?php echo (!empty($cart_adjustment) && $cart_adjustment->type == 'flat_in_subtotal') ? 'selected' : ''; ?>><?php _e('Fixed discount', WDR_TEXT_DOMAIN); ?></option>
16
  <?php if($is_pro){ ?>
17
- <option value="flat" <?php echo (!empty($cart_adjustment) && $cart_adjustment->type == 'flat') ? 'selected' : ''; ?>><?php _e('Fixed discount per product', WDR_TEXT_DOMAIN); ?></option>
18
  <?php } else {
19
  ?>
20
  <option disabled><?php _e('Fixed discount per product -PRO-', WDR_TEXT_DOMAIN); ?></option>
11
  <div class="cart_discount_option wdr-select-filed-hight">
12
  <select class="cart_free_shipping awdr-left-align"
13
  name="cart_adjustments[type]">
14
+ <option value="percentage" <?php echo (!empty($cart_adjustment) && isset($cart_adjustment->type) && $cart_adjustment->type == 'percentage') ? 'selected' : ''; ?>><?php _e('Percentage discount', WDR_TEXT_DOMAIN); ?></option>
15
+ <option value="flat_in_subtotal" <?php echo (!empty($cart_adjustment) && isset($cart_adjustment->type) && $cart_adjustment->type == 'flat_in_subtotal') ? 'selected' : ''; ?>><?php _e('Fixed discount', WDR_TEXT_DOMAIN); ?></option>
16
  <?php if($is_pro){ ?>
17
+ <option value="flat" <?php echo (!empty($cart_adjustment) && isset($cart_adjustment->type) && $cart_adjustment->type == 'flat') ? 'selected' : ''; ?>><?php _e('Fixed discount per product', WDR_TEXT_DOMAIN); ?></option>
18
  <?php } else {
19
  ?>
20
  <option disabled><?php _e('Fixed discount per product -PRO-', WDR_TEXT_DOMAIN); ?></option>
v2/App/Views/Admin/Rules/Manage.php CHANGED
@@ -4,238 +4,243 @@
4
  <div style="overflow:auto">
5
  <div class="awdr-container"><br/>
6
  <?php
7
- $current_time = '';
8
- if (function_exists('current_time')) {
9
- $current_time = current_time('timestamp');
10
- }
11
- $rule_status = $rule->getRuleVaildStatus();
12
- $check_rule_limit = $rule->checkRuleUsageLimits();
13
- $rule_id = $rule->getId();
14
- if ($rule_status == 'in_future') { ?>
15
- <div class="notice inline notice notice-warning notice-alt awdr-rule-limit-disabled">
16
- <p class="rule_limit_msg_future">
17
- <b><?php esc_html_e('This rule is not running currently: ', WDR_TEXT_DOMAIN); ?></b><?php esc_html_e(' Start date and time is set in the future date', WDR_TEXT_DOMAIN); ?>
18
- </p><?php
19
- if ($check_rule_limit == 'Disabled') {?>
20
- <p class="rule_limit_msg">
21
- <b><?php esc_html_e('This rule is not running currently: ', WDR_TEXT_DOMAIN); ?></b><?php esc_html_e(' Rule reached maximum usage limit ', WDR_TEXT_DOMAIN); ?>
22
- </p><?php
23
- } ?>
24
- </div><?php
25
- } elseif ($rule_status == 'expired') {
26
- ?>
27
- <div class="notice inline notice notice-warning notice-alt awdr-rule-limit-disabled">
28
- <p class="rule_limit_msg_expired">
29
- <b><?php esc_html_e('This rule is not running currently: ', WDR_TEXT_DOMAIN); ?></b><?php esc_html_e(' Validity expired', WDR_TEXT_DOMAIN); ?>
30
- </p><?php
31
- if ($check_rule_limit == 'Disabled') {?>
32
- <p class="rule_limit_msg">
33
- <b><?php esc_html_e('This rule is not running currently: ', WDR_TEXT_DOMAIN); ?></b><?php esc_html_e(' Rule reached maximum usage limit ', WDR_TEXT_DOMAIN); ?>
34
- </p><?php
35
- } ?>
36
- </div><?php
37
  }else{
38
- if($check_rule_limit == 'Disabled') {?>
 
 
 
 
 
 
 
39
  <div class="notice inline notice notice-warning notice-alt awdr-rule-limit-disabled">
40
- <p class="rule_limit_msg">
41
- <b><?php esc_html_e('This rule is not running currently: ', WDR_TEXT_DOMAIN); ?></b><?php esc_html_e(' Rule reached maximum usage limit ', WDR_TEXT_DOMAIN); ?>
42
- </p>
 
 
 
 
 
43
  </div><?php
44
- }
45
- }?>
46
- <div class="notice inline notice notice-warning notice-alt awdr-rule-limit-disabled-outer" style="display: none; padding: 10px;">
47
- <p class="rule_limit_msg_outer"></p>
48
- </div>
49
- <form id="wdr-save-rule" name="rule_generator">
50
- <div class="wdr-sticky-header" id="ruleHeader">
51
- <div class="wdr-enable-rule">
52
- <div class="wdr-field-title" style="width: 45%">
53
- <input class="wdr-title" type="text" name="title" placeholder="Rule Title"
54
- value="<?php echo esc_attr($rule->getTitle()); ?>"><!--awdr-clear-both-->
55
- </div>
56
- <div class="page__toggle">
57
- <label class="toggle">
58
- <input class="toggle__input" type="checkbox"
59
- name="enabled" <?php echo ($rule->isEnabled()) ? 'checked' : '' ?> value="1">
60
- <span class="toggle__label"><span
61
- class="toggle__text"><?php _e('Enable?', WDR_TEXT_DOMAIN); ?></span></span>
62
- </label>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
63
 
64
- </div>
65
- <div class="page__toggle">
66
- <label class="toggle">
67
- <input class="toggle__input" type="checkbox"
68
- name="exclusive" <?php echo ($rule->isExclusive()) ? 'checked' : '' ?> value="1">
69
- <span class="toggle__label"><span
70
- class="toggle__text"><?php _e('Apply this rule if matched and ignore all other rules', WDR_TEXT_DOMAIN); ?></span></span>
71
- </label>
72
 
73
- </div>
74
 
75
 
76
- <?php
77
- if (isset($rule_id) && !empty($rule_id)) { ?>
78
- <span class="wdr_desc_text awdr_valide_date_in_desc">
79
- <?php esc_html_e('#Rule ID: ', WDR_TEXT_DOMAIN); ?><b><?php echo $rule_id; ?></b>
80
- </span><?php
81
- } ?>
82
- <div class="awdr-common-save">
83
- <button type="submit" class="btn btn-primary wdr_save_stay">
84
- <?php _e('Save', WDR_TEXT_DOMAIN); ?></button>
85
- <button type="button" class="btn btn-success wdr_save_close">
86
- <?php _e('Save & Close', WDR_TEXT_DOMAIN); ?></button>
87
- <a href="<?php echo admin_url("admin.php?" . http_build_query(array('page' => WDR_SLUG, 'tab' => 'rules'))); ?>"
88
- class="btn btn-danger" style="text-decoration: none">
89
- <?php _e('Cancel', WDR_TEXT_DOMAIN); ?></a>
 
90
  </div>
91
- </div>
92
- <div class="awdr_discount_type_section">
93
- <?php
94
- $wdr_product_discount_types = $base->getDiscountTypes();
95
- $rule_discount_type = $rule->getRuleDiscountType();
96
- ?>
97
- <div class="wdr-discount-type">
98
- <b style="display: block;"><?php _e('Choose a discount type', WDR_TEXT_DOMAIN); ?></b>
99
- <select name="discount_type" class="awdr-product-discount-type wdr-discount-type-selector"
100
- data-placement="wdr-discount-template-placement">
101
- <optgroup label="">
102
- <option value="not_selected"><?php _e("Select Discount Type", WDR_TEXT_DOMAIN); ?></option>
103
- </optgroup><?php
104
- if (isset($wdr_product_discount_types) && !empty($wdr_product_discount_types)) {
105
- foreach ($wdr_product_discount_types as $wdr_discount_key => $wdr_discount_value) {
106
- ?>
107
- <optgroup label="<?php echo $wdr_discount_key; ?>">
108
- <?php
109
- foreach ($wdr_discount_value as $key => $value) {
110
- $enable_option = true;
111
- if (isset($value['enable']) && $value['enable'] === false) {
112
- $enable_option = false;
113
- }
114
  ?>
115
- <option
116
- <?php if ($enable_option) {
117
- ?>
118
- value="<?php echo $key; ?>"
119
- <?php
120
- } else {
 
121
  ?>
122
- disabled="disabled"
123
- <?php
 
 
 
 
 
 
 
 
 
124
  } ?>
125
- <?php echo ($rule_discount_type && $rule_discount_type == $key) ? 'selected' : ''; ?>><?php _e($value['label'], WDR_TEXT_DOMAIN); ?></option><?php
126
- } ?>
127
- </optgroup><?php
128
- }
129
- } ?>
130
- </select>
131
- <sub><a href="https://docs.flycart.org/en/articles/3788550-product-adjustment-discount-rules-2-0?utm_source=woo-discount-rules-v2&utm_campaign=doc&utm_medium=text-click&utm_content=product_adjustment_document" target="_blank" class="awdr_doc_wdr_simple_discount" style="<?php echo ($rule_discount_type != 'wdr_simple_discount') ? 'display: none' : '';?>"><?php _e("Read Docs", WDR_TEXT_DOMAIN); ?></a></sub>
132
- <sub><a href="https://docs.flycart.org/en/articles/3806593-cart-adjustment-discount-rules-2-0?utm_source=woo-discount-rules-v2&utm_campaign=doc&utm_medium=text-click&utm_content=cart_adjustment_document" target="_blank" class="awdr_doc_wdr_cart_discount" style="<?php echo ($rule_discount_type != 'wdr_cart_discount') ? 'display: none' : '';?>"><?php _e("Read Docs", WDR_TEXT_DOMAIN); ?></a></sub>
133
- <sub><a href="https://docs.flycart.org/en/articles/3807036-free-shipping-discount-rules-2-0?utm_source=woo-discount-rules-v2&utm_campaign=doc&utm_medium=text-click&utm_content=free_shipping_document" target="_blank" class="awdr_doc_wdr_free_shipping" style="<?php echo ($rule_discount_type != 'wdr_free_shipping') ? 'display: none' : '';?>"><?php _e("Read Docs", WDR_TEXT_DOMAIN); ?></a></sub>
134
- <sub><a href="https://docs.flycart.org/en/articles/3807208-bulk-discounts-or-tiered-pricings-discount-rules-2-0?utm_source=woo-discount-rules-v2&utm_campaign=doc&utm_medium=text-click&utm_content=bulk_adjustment_document" target="_blank" class="awdr_doc_wdr_bulk_discount" style="<?php echo ($rule_discount_type != 'wdr_bulk_discount') ? 'display: none' : '';?>"><?php _e("Read Docs", WDR_TEXT_DOMAIN); ?></a></sub>
135
- <sub><a href="https://docs.flycart.org/en/articles/3809899-bundle-set-discount-discount-rules-2-0?utm_source=woo-discount-rules-v2&utm_campaign=doc&utm_medium=text-click&utm_content=set_bundle_adjustment_document" target="_blank" class="awdr_doc_wdr_set_discount" style="<?php echo ($rule_discount_type != 'wdr_set_discount') ? 'display: none' : '';?>"><?php _e("Read Docs", WDR_TEXT_DOMAIN); ?></a></sub>
136
- <sub><a href="https://docs.flycart.org/en/articles/3810071-buy-one-get-one-free-buy-x-get-x-discount-rules-2-0?utm_source=woo-discount-rules-v2&utm_campaign=doc&utm_medium=text-click&utm_content=bxgx_adjustment" target="_blank" class="awdr_doc_wdr_buy_x_get_x_discount" style="<?php echo ($rule_discount_type != 'wdr_buy_x_get_x_discount') ? 'display: none' : '';?>"><?php _e("Read Docs", WDR_TEXT_DOMAIN); ?></a></sub>
137
- <sub><a href="https://docs.flycart.org/en/articles/3810570-buy-x-get-y-discount-rules-2-0?utm_source=woo-discount-rules-v2&utm_campaign=doc&utm_medium=text-click&utm_content=bxgy_adjustment_document" target="_blank" class="awdr_doc_wdr_buy_x_get_y_discount" style="<?php echo ($rule_discount_type != 'wdr_buy_x_get_y_discount') ? 'display: none' : '';?>"><?php _e("Read Docs", WDR_TEXT_DOMAIN); ?></a></sub>
138
  </div>
139
  </div>
140
- </div>
141
- <div class="awdr-hidden-new-rule" style="<?php echo (is_null($rule_id)) ? "display:none;" : "" ?>">
142
 
143
- <!-- ------------------------Rule Filter Section Start------------------------ -->
144
- <div class="wdr-rule-filters-and-options-con awdr-filter-section">
145
- <div class="wdr-rule-menu">
146
- <h2 class="awdr-filter-heading"><?php _e("Filter", WDR_TEXT_DOMAIN); ?></h2>
147
- <div class="awdr-filter-content">
148
- <p><?php _e("Choose which <b>gets</b> discount (products/categories/attributes/SKU and so on )", WDR_TEXT_DOMAIN); ?></p>
149
- <p><?php _e("Note : You can also exclude products/categories.", WDR_TEXT_DOMAIN); ?></p>
150
- </div>
151
- </div>
152
- <div class="wdr-rule-options-con">
153
- <div id="wdr-save-rule" name="rule_generator">
154
- <input type="hidden" name="action" value="wdr_ajax">
155
- <input type="hidden" name="method" value="save_rule">
156
- <input type="hidden" name="awdr_nonce" value="<?php echo \Wdr\App\Helpers\Helper::create_nonce('wdr_ajax_save_rule'); ?>">
157
- <input type="hidden" name="wdr_save_close" value="">
158
- <div id="rule_template">
159
- <?php include 'Filters/Main.php'; ?>
 
160
  </div>
161
  </div>
162
  </div>
163
- </div>
164
- <!-- ------------------------Rule Filter Section End-------------------------- -->
165
 
166
- <!-- ------------------------Rule Discount Section Start---------------------- -->
167
- <?php
168
- //product adjustments
169
- $product_adjustments = ($rule->getProductAdjustments()) ? $rule->getProductAdjustments() : false;
170
- //echo "<pre>"; print_r($product_adjustments); echo "</pre>";
171
- //cart adjustments
172
- $cart_adjustment = $rule->getCartAdjustments();
173
- //Bulk adjustments
174
- if ($get_bulk_adjustments = $rule->getBulkAdjustments()) {
175
- $bulk_adj_operator = (isset($get_bulk_adjustments->operator) && !empty($get_bulk_adjustments->operator)) ? $get_bulk_adjustments->operator : 'product_cumulative';
176
- $bulk_adj_as_cart = (isset($get_bulk_adjustments->apply_as_cart_rule) && !empty($get_bulk_adjustments->apply_as_cart_rule)) ? $get_bulk_adjustments->apply_as_cart_rule : '';
177
- $bulk_adj_as_cart_label = (isset($get_bulk_adjustments->cart_label) && !empty($get_bulk_adjustments->cart_label)) ? $get_bulk_adjustments->cart_label : '';
178
- $bulk_adj_ranges = (isset($get_bulk_adjustments->ranges) && !empty($get_bulk_adjustments->ranges)) ? $get_bulk_adjustments->ranges : false;
179
- $bulk_cat_selector = (isset($get_bulk_adjustments->selected_categories) && !empty($get_bulk_adjustments->selected_categories)) ? $get_bulk_adjustments->selected_categories : false;
180
- } else {
181
- $bulk_adj_operator = 'product_cumulative';
182
- $bulk_adj_as_cart = '';
183
- $bulk_adj_as_cart_label = '';
184
- $bulk_adj_ranges = false;
185
- $bulk_cat_selector = false;
186
- }
187
- $show_bulk_discount = $rule->showHideDiscount($bulk_adj_ranges); ?>
188
- <div class="awdr-discount-container">
189
- <div class="awdr-discount-row">
190
- <div class="wdr-rule-filters-and-options-con">
191
- <div class="wdr-rule-menu">
192
- <h2 class="awdr-discount-heading"><?php _e("Discount", WDR_TEXT_DOMAIN); ?></h2>
193
- <div class="awdr-discount-content">
194
- <p><?php _e("Select discount type and its value (percentage/price/fixed price)", WDR_TEXT_DOMAIN); ?></p>
 
195
  </div>
196
- </div>
197
- <div class="wdr-rule-options-con">
198
- <div class="wdr-discount-template">
199
- <div class="wdr-block wdr-discount-template-placement">
200
  </div>
201
  </div>
202
  </div>
203
  </div>
204
  </div>
205
- </div>
206
- <!-- ------------------------Rule Discount Section End------------------------ -->
207
 
208
- <!-- ------------------------Rule Condition Section Start--------------------- -->
209
- <div class="awdr-condition-container">
210
- <div class="awdr-condition-row">
211
- <div class="wdr-rule-filters-and-options-con">
212
- <?php include 'Conditions/Main.php'; ?>
 
213
  </div>
214
  </div>
215
- </div>
216
- <!-- ------------------------Rule Condition Section End----------------------- -->
217
 
218
 
219
- <!-- ------------------------Rule Discount Batch Section Start---------------- -->
220
- <?php
221
- if ($rule->hasAdvancedDiscountMessage()) {
222
- $badge_display = $rule->getAdvancedDiscountMessage('display', 0);
223
- $badge_bg_color = $rule->getAdvancedDiscountMessage('badge_color_picker', '#ffffff');
224
- $badge_text_color = $rule->getAdvancedDiscountMessage('badge_text_color_picker', '#000000');
225
- $badge_text = $rule->getAdvancedDiscountMessage('badge_text');
226
- } else {
227
- $badge_display = false;
228
- $badge_bg_color = '#ffffff';
229
- $badge_text_color = '#000000';
230
- $badge_text = false;
231
- }
232
- ?>
233
- <?php include 'DiscountBatch/Main.php'; ?>
234
- <!-- ------------------------Rule Discount Batch Section End------------------ -->
235
 
236
- </div>
237
- <input type="hidden" name="wdr_ajax_select2" value="<?php echo \Wdr\App\Helpers\Helper::create_nonce('wdr_ajax_select2'); ?>">
238
- </form>
 
 
239
  </div>
240
  </div>
241
  <?php include 'Discounts/Main.php'; ?>
4
  <div style="overflow:auto">
5
  <div class="awdr-container"><br/>
6
  <?php
7
+ if(isset($wdr_404_found) && !empty($wdr_404_found)){
8
+ echo "<h2 style='color: red;'>".$wdr_404_found."</h2>";
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9
  }else{
10
+ $current_time = '';
11
+ if (function_exists('current_time')) {
12
+ $current_time = current_time('timestamp');
13
+ }
14
+ $rule_status = $rule->getRuleVaildStatus();
15
+ $check_rule_limit = $rule->checkRuleUsageLimits();
16
+ $rule_id = $rule->getId();
17
+ if ($rule_status == 'in_future') { ?>
18
  <div class="notice inline notice notice-warning notice-alt awdr-rule-limit-disabled">
19
+ <p class="rule_limit_msg_future">
20
+ <b><?php esc_html_e('This rule is not running currently: ', WDR_TEXT_DOMAIN); ?></b><?php esc_html_e(' Start date and time is set in the future date', WDR_TEXT_DOMAIN); ?>
21
+ </p><?php
22
+ if ($check_rule_limit == 'Disabled') {?>
23
+ <p class="rule_limit_msg">
24
+ <b><?php esc_html_e('This rule is not running currently: ', WDR_TEXT_DOMAIN); ?></b><?php esc_html_e(' Rule reached maximum usage limit ', WDR_TEXT_DOMAIN); ?>
25
+ </p><?php
26
+ } ?>
27
  </div><?php
28
+ } elseif ($rule_status == 'expired') {
29
+ ?>
30
+ <div class="notice inline notice notice-warning notice-alt awdr-rule-limit-disabled">
31
+ <p class="rule_limit_msg_expired">
32
+ <b><?php esc_html_e('This rule is not running currently: ', WDR_TEXT_DOMAIN); ?></b><?php esc_html_e(' Validity expired', WDR_TEXT_DOMAIN); ?>
33
+ </p><?php
34
+ if ($check_rule_limit == 'Disabled') {?>
35
+ <p class="rule_limit_msg">
36
+ <b><?php esc_html_e('This rule is not running currently: ', WDR_TEXT_DOMAIN); ?></b><?php esc_html_e(' Rule reached maximum usage limit ', WDR_TEXT_DOMAIN); ?>
37
+ </p><?php
38
+ } ?>
39
+ </div><?php
40
+ }else{
41
+ if($check_rule_limit == 'Disabled') {?>
42
+ <div class="notice inline notice notice-warning notice-alt awdr-rule-limit-disabled">
43
+ <p class="rule_limit_msg">
44
+ <b><?php esc_html_e('This rule is not running currently: ', WDR_TEXT_DOMAIN); ?></b><?php esc_html_e(' Rule reached maximum usage limit ', WDR_TEXT_DOMAIN); ?>
45
+ </p>
46
+ </div><?php
47
+ }
48
+ }?>
49
+ <div class="notice inline notice notice-warning notice-alt awdr-rule-limit-disabled-outer" style="display: none; padding: 10px;">
50
+ <p class="rule_limit_msg_outer"></p>
51
+ </div>
52
+ <form id="wdr-save-rule" name="rule_generator">
53
+ <div class="wdr-sticky-header" id="ruleHeader">
54
+ <div class="wdr-enable-rule">
55
+ <div class="wdr-field-title" style="width: 45%">
56
+ <input class="wdr-title" type="text" name="title" placeholder="Rule Title"
57
+ value="<?php echo esc_attr($rule->getTitle()); ?>"><!--awdr-clear-both-->
58
+ </div>
59
+ <div class="page__toggle">
60
+ <label class="toggle">
61
+ <input class="toggle__input" type="checkbox"
62
+ name="enabled" <?php echo ($rule->isEnabled()) ? 'checked' : '' ?> value="1">
63
+ <span class="toggle__label"><span
64
+ class="toggle__text"><?php _e('Enable?', WDR_TEXT_DOMAIN); ?></span></span>
65
+ </label>
66
 
67
+ </div>
68
+ <div class="page__toggle">
69
+ <label class="toggle">
70
+ <input class="toggle__input" type="checkbox"
71
+ name="exclusive" <?php echo ($rule->isExclusive()) ? 'checked' : '' ?> value="1">
72
+ <span class="toggle__label"><span
73
+ class="toggle__text"><?php _e('Apply this rule if matched and ignore all other rules', WDR_TEXT_DOMAIN); ?></span></span>
74
+ </label>
75
 
76
+ </div>
77
 
78
 
79
+ <?php
80
+ if (isset($rule_id) && !empty($rule_id)) { ?>
81
+ <span class="wdr_desc_text awdr_valide_date_in_desc">
82
+ <?php esc_html_e('#Rule ID: ', WDR_TEXT_DOMAIN); ?><b><?php echo $rule_id; ?></b>
83
+ </span><?php
84
+ } ?>
85
+ <div class="awdr-common-save">
86
+ <button type="submit" class="btn btn-primary wdr_save_stay">
87
+ <?php _e('Save', WDR_TEXT_DOMAIN); ?></button>
88
+ <button type="button" class="btn btn-success wdr_save_close">
89
+ <?php _e('Save & Close', WDR_TEXT_DOMAIN); ?></button>
90
+ <a href="<?php echo admin_url("admin.php?" . http_build_query(array('page' => WDR_SLUG, 'tab' => 'rules'))); ?>"
91
+ class="btn btn-danger" style="text-decoration: none">
92
+ <?php _e('Cancel', WDR_TEXT_DOMAIN); ?></a>
93
+ </div>
94
  </div>
95
+ <div class="awdr_discount_type_section">
96
+ <?php
97
+ $wdr_product_discount_types = $base->getDiscountTypes();
98
+ $rule_discount_type = $rule->getRuleDiscountType();
99
+ ?>
100
+ <div class="wdr-discount-type">
101
+ <b style="display: block;"><?php _e('Choose a discount type', WDR_TEXT_DOMAIN); ?></b>
102
+ <select name="discount_type" class="awdr-product-discount-type wdr-discount-type-selector"
103
+ data-placement="wdr-discount-template-placement">
104
+ <optgroup label="">
105
+ <option value="not_selected"><?php _e("Select Discount Type", WDR_TEXT_DOMAIN); ?></option>
106
+ </optgroup><?php
107
+ if (isset($wdr_product_discount_types) && !empty($wdr_product_discount_types)) {
108
+ foreach ($wdr_product_discount_types as $wdr_discount_key => $wdr_discount_value) {
 
 
 
 
 
 
 
 
 
109
  ?>
110
+ <optgroup label="<?php echo $wdr_discount_key; ?>">
111
+ <?php
112
+ foreach ($wdr_discount_value as $key => $value) {
113
+ $enable_option = true;
114
+ if (isset($value['enable']) && $value['enable'] === false) {
115
+ $enable_option = false;
116
+ }
117
  ?>
118
+ <option
119
+ <?php if ($enable_option) {
120
+ ?>
121
+ value="<?php echo $key; ?>"
122
+ <?php
123
+ } else {
124
+ ?>
125
+ disabled="disabled"
126
+ <?php
127
+ } ?>
128
+ <?php echo ($rule_discount_type && $rule_discount_type == $key) ? 'selected' : ''; ?>><?php _e($value['label'], WDR_TEXT_DOMAIN); ?></option><?php
129
  } ?>
130
+ </optgroup><?php
131
+ }
132
+ } ?>
133
+ </select>
134
+ <sub><a href="https://docs.flycart.org/en/articles/3788550-product-adjustment-discount-rules-2-0?utm_source=woo-discount-rules-v2&utm_campaign=doc&utm_medium=text-click&utm_content=product_adjustment_document" target="_blank" class="awdr_doc_wdr_simple_discount" style="<?php echo ($rule_discount_type != 'wdr_simple_discount') ? 'display: none' : '';?>"><?php _e("Read Docs", WDR_TEXT_DOMAIN); ?></a></sub>
135
+ <sub><a href="https://docs.flycart.org/en/articles/3806593-cart-adjustment-discount-rules-2-0?utm_source=woo-discount-rules-v2&utm_campaign=doc&utm_medium=text-click&utm_content=cart_adjustment_document" target="_blank" class="awdr_doc_wdr_cart_discount" style="<?php echo ($rule_discount_type != 'wdr_cart_discount') ? 'display: none' : '';?>"><?php _e("Read Docs", WDR_TEXT_DOMAIN); ?></a></sub>
136
+ <sub><a href="https://docs.flycart.org/en/articles/3807036-free-shipping-discount-rules-2-0?utm_source=woo-discount-rules-v2&utm_campaign=doc&utm_medium=text-click&utm_content=free_shipping_document" target="_blank" class="awdr_doc_wdr_free_shipping" style="<?php echo ($rule_discount_type != 'wdr_free_shipping') ? 'display: none' : '';?>"><?php _e("Read Docs", WDR_TEXT_DOMAIN); ?></a></sub>
137
+ <sub><a href="https://docs.flycart.org/en/articles/3807208-bulk-discounts-or-tiered-pricings-discount-rules-2-0?utm_source=woo-discount-rules-v2&utm_campaign=doc&utm_medium=text-click&utm_content=bulk_adjustment_document" target="_blank" class="awdr_doc_wdr_bulk_discount" style="<?php echo ($rule_discount_type != 'wdr_bulk_discount') ? 'display: none' : '';?>"><?php _e("Read Docs", WDR_TEXT_DOMAIN); ?></a></sub>
138
+ <sub><a href="https://docs.flycart.org/en/articles/3809899-bundle-set-discount-discount-rules-2-0?utm_source=woo-discount-rules-v2&utm_campaign=doc&utm_medium=text-click&utm_content=set_bundle_adjustment_document" target="_blank" class="awdr_doc_wdr_set_discount" style="<?php echo ($rule_discount_type != 'wdr_set_discount') ? 'display: none' : '';?>"><?php _e("Read Docs", WDR_TEXT_DOMAIN); ?></a></sub>
139
+ <sub><a href="https://docs.flycart.org/en/articles/3810071-buy-one-get-one-free-buy-x-get-x-discount-rules-2-0?utm_source=woo-discount-rules-v2&utm_campaign=doc&utm_medium=text-click&utm_content=bxgx_adjustment" target="_blank" class="awdr_doc_wdr_buy_x_get_x_discount" style="<?php echo ($rule_discount_type != 'wdr_buy_x_get_x_discount') ? 'display: none' : '';?>"><?php _e("Read Docs", WDR_TEXT_DOMAIN); ?></a></sub>
140
+ <sub><a href="https://docs.flycart.org/en/articles/3810570-buy-x-get-y-discount-rules-2-0?utm_source=woo-discount-rules-v2&utm_campaign=doc&utm_medium=text-click&utm_content=bxgy_adjustment_document" target="_blank" class="awdr_doc_wdr_buy_x_get_y_discount" style="<?php echo ($rule_discount_type != 'wdr_buy_x_get_y_discount') ? 'display: none' : '';?>"><?php _e("Read Docs", WDR_TEXT_DOMAIN); ?></a></sub>
141
+ </div>
 
142
  </div>
143
  </div>
144
+ <div class="awdr-hidden-new-rule" style="<?php echo (is_null($rule_id)) ? "display:none;" : "" ?>">
 
145
 
146
+ <!-- ------------------------Rule Filter Section Start------------------------ -->
147
+ <div class="wdr-rule-filters-and-options-con awdr-filter-section">
148
+ <div class="wdr-rule-menu">
149
+ <h2 class="awdr-filter-heading"><?php _e("Filter", WDR_TEXT_DOMAIN); ?></h2>
150
+ <div class="awdr-filter-content">
151
+ <p><?php _e("Choose which <b>gets</b> discount (products/categories/attributes/SKU and so on )", WDR_TEXT_DOMAIN); ?></p>
152
+ <p><?php _e("Note : You can also exclude products/categories.", WDR_TEXT_DOMAIN); ?></p>
153
+ </div>
154
+ </div>
155
+ <div class="wdr-rule-options-con">
156
+ <div id="wdr-save-rule" name="rule_generator">
157
+ <input type="hidden" name="action" value="wdr_ajax">
158
+ <input type="hidden" name="method" value="save_rule">
159
+ <input type="hidden" name="awdr_nonce" value="<?php echo \Wdr\App\Helpers\Helper::create_nonce('wdr_ajax_save_rule'); ?>">
160
+ <input type="hidden" name="wdr_save_close" value="">
161
+ <div id="rule_template">
162
+ <?php include 'Filters/Main.php'; ?>
163
+ </div>
164
  </div>
165
  </div>
166
  </div>
167
+ <!-- ------------------------Rule Filter Section End-------------------------- -->
 
168
 
169
+ <!-- ------------------------Rule Discount Section Start---------------------- -->
170
+ <?php
171
+ //product adjustments
172
+ $product_adjustments = ($rule->getProductAdjustments()) ? $rule->getProductAdjustments() : false;
173
+ //echo "<pre>"; print_r($product_adjustments); echo "</pre>";
174
+ //cart adjustments
175
+ $cart_adjustment = $rule->getCartAdjustments();
176
+ //Bulk adjustments
177
+ if ($get_bulk_adjustments = $rule->getBulkAdjustments()) {
178
+ $bulk_adj_operator = (isset($get_bulk_adjustments->operator) && !empty($get_bulk_adjustments->operator)) ? $get_bulk_adjustments->operator : 'product_cumulative';
179
+ $bulk_adj_as_cart = (isset($get_bulk_adjustments->apply_as_cart_rule) && !empty($get_bulk_adjustments->apply_as_cart_rule)) ? $get_bulk_adjustments->apply_as_cart_rule : '';
180
+ $bulk_adj_as_cart_label = (isset($get_bulk_adjustments->cart_label) && !empty($get_bulk_adjustments->cart_label)) ? $get_bulk_adjustments->cart_label : '';
181
+ $bulk_adj_ranges = (isset($get_bulk_adjustments->ranges) && !empty($get_bulk_adjustments->ranges)) ? $get_bulk_adjustments->ranges : false;
182
+ $bulk_cat_selector = (isset($get_bulk_adjustments->selected_categories) && !empty($get_bulk_adjustments->selected_categories)) ? $get_bulk_adjustments->selected_categories : false;
183
+ } else {
184
+ $bulk_adj_operator = 'product_cumulative';
185
+ $bulk_adj_as_cart = '';
186
+ $bulk_adj_as_cart_label = '';
187
+ $bulk_adj_ranges = false;
188
+ $bulk_cat_selector = false;
189
+ }
190
+ $show_bulk_discount = $rule->showHideDiscount($bulk_adj_ranges); ?>
191
+ <div class="awdr-discount-container">
192
+ <div class="awdr-discount-row">
193
+ <div class="wdr-rule-filters-and-options-con">
194
+ <div class="wdr-rule-menu">
195
+ <h2 class="awdr-discount-heading"><?php _e("Discount", WDR_TEXT_DOMAIN); ?></h2>
196
+ <div class="awdr-discount-content">
197
+ <p><?php _e("Select discount type and its value (percentage/price/fixed price)", WDR_TEXT_DOMAIN); ?></p>
198
+ </div>
199
  </div>
200
+ <div class="wdr-rule-options-con">
201
+ <div class="wdr-discount-template">
202
+ <div class="wdr-block wdr-discount-template-placement">
203
+ </div>
204
  </div>
205
  </div>
206
  </div>
207
  </div>
208
  </div>
209
+ <!-- ------------------------Rule Discount Section End------------------------ -->
 
210
 
211
+ <!-- ------------------------Rule Condition Section Start--------------------- -->
212
+ <div class="awdr-condition-container">
213
+ <div class="awdr-condition-row">
214
+ <div class="wdr-rule-filters-and-options-con">
215
+ <?php include 'Conditions/Main.php'; ?>
216
+ </div>
217
  </div>
218
  </div>
219
+ <!-- ------------------------Rule Condition Section End----------------------- -->
 
220
 
221
 
222
+ <!-- ------------------------Rule Discount Batch Section Start---------------- -->
223
+ <?php
224
+ if ($rule->hasAdvancedDiscountMessage()) {
225
+ $badge_display = $rule->getAdvancedDiscountMessage('display', 0);
226
+ $badge_bg_color = $rule->getAdvancedDiscountMessage('badge_color_picker', '#ffffff');
227
+ $badge_text_color = $rule->getAdvancedDiscountMessage('badge_text_color_picker', '#000000');
228
+ $badge_text = $rule->getAdvancedDiscountMessage('badge_text');
229
+ } else {
230
+ $badge_display = false;
231
+ $badge_bg_color = '#ffffff';
232
+ $badge_text_color = '#000000';
233
+ $badge_text = false;
234
+ }
235
+ ?>
236
+ <?php include 'DiscountBatch/Main.php'; ?>
237
+ <!-- ------------------------Rule Discount Batch Section End------------------ -->
238
 
239
+ </div>
240
+ <input type="hidden" name="wdr_ajax_select2" value="<?php echo \Wdr\App\Helpers\Helper::create_nonce('wdr_ajax_select2'); ?>">
241
+ </form><?php
242
+
243
+ }?>
244
  </div>
245
  </div>
246
  <?php include 'Discounts/Main.php'; ?>
v2/App/Views/Admin/Tabs/ImportExport.php CHANGED
@@ -1,147 +1,160 @@
1
  <?php
2
  if (!defined('ABSPATH')) exit;
 
3
  use Wdr\App\Models\DBTable;
 
 
4
  $is_pro_activated = isset($is_pro_activated) ? $is_pro_activated : false;
5
  ?>
6
  <br>
7
  <div class="wdr_settings ui-page-theme-a awdr-container">
8
  <div class="wdr_settings_container" style="border-bottom: 1px solid black; padding-bottom: 10px;">
9
  <div>
10
- <h3><?php _e('Export tool', WDR_TEXT_DOMAIN);?></h3>
11
  <div>
12
  <p>
13
  <form method="post">
 
14
  <button type="submit" id="wdr-export" name="wdr-export" class="button button-primary">
15
- <?php _e('Export', WDR_TEXT_DOMAIN);?>
16
  </button>
17
  </form>
18
  </p>
19
-
20
  </div>
21
  </div>
22
  </div>
23
- <?php if($is_pro_activated){ ?>
24
- <div class="wdr_settings_container" >
25
  <div>
26
- <h3><?php _e('Import Tool', WDR_TEXT_DOMAIN);?></h3>
27
  <div><?php
28
  $message = '';
29
- if (isset($_POST['wdr-import'])) {
30
- $fileName = $_FILES["awdr_import_rule"]["tmp_name"];
31
-
32
- if ($_FILES["awdr_import_rule"]["size"] > 0) {
33
-
34
- $file = fopen($fileName, "r");
35
- $current_date_time = '';
36
- if (function_exists('current_time')) {
37
- $current_time = current_time('timestamp');
38
- $current_date_time = date('Y-m-d H:i:s', $current_time);
39
- }
40
- $current_user = get_current_user_id();
41
- $i = 1;
42
-
43
- while (($column = fgetcsv($file, 100000, ",")) !== FALSE) {
44
- if($i == 1){
45
- $i++;
46
- continue;
47
- }
48
- $rule_id = isset($column[0]) ? $column[0] : NULL;
49
- $enabled = isset($column[1]) ? $column[1] : 0;
50
- $deleted = isset($column[2]) ? $column[2] : 0;
51
- $exclusive = isset($column[3]) ? $column[3] : 0;
52
- $title = isset($column[4]) ? $column[4] : "Untitled Rule";
53
- $priority = isset($column[5]) ? $column[5] : $rule_id;
54
- $apply_to = isset($column[6]) ? $column[6] : NULL;
55
- $filters = isset($column[7]) ? $column[7] : '[]';
56
- $conditions = isset($column[8]) ? $column[8] : '[]';
57
- $product_adjustments = isset($column[9]) ? $column[9] : "[]";
58
- $cart_adjustment = isset($column[10]) ? $column[10] : "[]";
59
- $buy_x_get_x = isset($column[11]) ? $column[11] : "[]";
60
- $buy_x_get_y = isset($column[12]) ? $column[12] : "[]";
61
- $bulk_adjustment = isset($column[13]) ? $column[13] : "[]";
62
- $set_adjustment = isset($column[14]) ? $column[14] : "[]";
63
- $other_discount = isset($column[15]) ? $column[15] : NULL;
64
- $date_from = isset($column[16]) ? $column[16] : NULL;
65
- $date_to = isset($column[17]) ? $column[17] : NULL;
66
- $usage_limits = isset($column[18]) ? $column[18] : 0;
67
- $rule_language = isset($column[19]) ? $column[19] : "[]";
68
- $used_limits = isset($column[20]) ? $column[20] : 0;
69
- $additional = isset($column[21]) ? $column[21] : '{"condition_relationship":"and"}';
70
- $max_discount_sum = isset($column[22]) ? $column[22] : NULL;
71
- $advanced_discount_message = isset($column[23]) ? $column[23] : '{"display":"0","badge_color_picker":"#ffffff","badge_text_color_picker":"#000000","badge_text":""}';
72
- $discount_type = isset($column[24]) ? $column[24] : "wdr_simple_discount";
73
- $used_coupons = isset($column[25]) ? $column[25] : "[]";
74
- $created_by = isset($column[26]) ? $column[26] : $current_user;
75
- $created_on = isset($column[27]) ? $column[27] : $current_date_time;
76
- $modified_by = isset($column[28]) ? $column[28] : $current_user;
77
- $modified_on = isset($column[29]) ? $column[29] : $current_date_time;
78
-
79
-
80
- $arg = array(
81
- 'enabled' => $enabled,
82
- 'deleted' => $deleted,
83
- 'exclusive' => $exclusive,
84
- 'title' => (empty($title)) ? esc_html__('Untitled Rule', WDR_TEXT_DOMAIN) : $title,
85
- 'priority' => $priority,
86
- 'apply_to' => $apply_to,
87
- 'filters' => $filters,
88
- 'conditions' => $conditions,
89
- 'product_adjustments' => $product_adjustments,
90
- 'cart_adjustments' => $cart_adjustment,
91
- 'buy_x_get_x_adjustments' => $buy_x_get_x,
92
- 'buy_x_get_y_adjustments' => $buy_x_get_y,
93
- 'bulk_adjustments' => $bulk_adjustment,
94
- 'set_adjustments' => $set_adjustment,
95
- 'other_discounts' => $other_discount,
96
- 'date_from' => $date_from,
97
- 'date_to' => $date_to,
98
- 'usage_limits' => $usage_limits,
99
- 'rule_language' => $rule_language,
100
- 'used_limits' => $used_limits,
101
- 'additional' => $additional,
102
- 'max_discount_sum' => $max_discount_sum,
103
- 'advanced_discount_message' => $advanced_discount_message,
104
- 'discount_type' => $discount_type,
105
- 'used_coupons' => $used_coupons,
106
- 'created_by' => $created_by,
107
- 'created_on' => $created_on,
108
- 'modified_by' => $modified_by,
109
- 'modified_on' => $modified_on,
110
- );
111
-
112
-
113
- $column_format = array('%d','%d','%d', '%s', '%d', '%d', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%d', '%d', '%d', '%s', '%d','%s','%d','%s','%s','%s','%d', '%s', '%d', '%s');
114
-
115
- $rule_id = DBTable::saveRule($column_format, $arg);
116
-
117
- if (!empty($rule_id)) {
118
- $type = "success";
119
- $message = __('<b style="color: green;">Rules Imported successfully</b>', WDR_TEXT_DOMAIN);
120
- } else {
121
- $type = "error";
122
- $message = __('<b style="color: red;">Problem in Importing CSV Data</b>', WDR_TEXT_DOMAIN);
123
- break;
 
 
 
 
 
 
 
 
 
 
124
  }
125
  }
126
  }
127
- }?>
128
  <form method="post" name="awdr-import-csv" id="awdr-import-csv" enctype="multipart/form-data">
 
129
  <input type="file" name="awdr_import_rule" id="awdr-file-uploader" accept=".csv"><br>
130
- <span id="awdr-upload-response"><?php echo $message;?></span></br>
131
  <button type="submit" id="wdr-import" name="wdr-import" class="button button-primary">
132
- <?php _e('Import', WDR_TEXT_DOMAIN);?>
133
  </button>
134
  </form>
135
  </div>
136
  </div>
137
- </div><?php
138
-
139
- }else{?>
140
- <div class="wdr_settings_container" >
141
- <div>
142
- <h3><?php _e('Import Tool', WDR_TEXT_DOMAIN);?></h3>
143
- <p><?php _e('Unlock this feature by <a href="https://www.flycart.org/products/wordpress/woocommerce-discount-rules" target="_blank">Upgrading to Pro</a>', WDR_TEXT_DOMAIN);?> </p>
144
- </div>
145
  </div><?php
146
  }
147
  ?>
1
  <?php
2
  if (!defined('ABSPATH')) exit;
3
+
4
  use Wdr\App\Models\DBTable;
5
+ use Wdr\App\Helpers\Helper;
6
+
7
  $is_pro_activated = isset($is_pro_activated) ? $is_pro_activated : false;
8
  ?>
9
  <br>
10
  <div class="wdr_settings ui-page-theme-a awdr-container">
11
  <div class="wdr_settings_container" style="border-bottom: 1px solid black; padding-bottom: 10px;">
12
  <div>
13
+ <h3><?php _e('Export tool', WDR_TEXT_DOMAIN); ?></h3>
14
  <div>
15
  <p>
16
  <form method="post">
17
+ <input type="hidden" name="security" value="<?php echo wp_create_nonce('awdr_export_rules') ?>">
18
  <button type="submit" id="wdr-export" name="wdr-export" class="button button-primary">
19
+ <?php _e('Export', WDR_TEXT_DOMAIN); ?>
20
  </button>
21
  </form>
22
  </p>
 
23
  </div>
24
  </div>
25
  </div>
26
+ <?php if ($is_pro_activated) { ?>
27
+ <div class="wdr_settings_container">
28
  <div>
29
+ <h3><?php _e('Import Tool', WDR_TEXT_DOMAIN); ?></h3>
30
  <div><?php
31
  $message = '';
32
+ if (isset($_POST['wdr-import']) && isset($_FILES["awdr_import_rule"]) && isset($_POST['security'])) {
33
+ //check for nonce, before
34
+ if (wp_verify_nonce($_POST['security'], 'awdr_import_rules_csv')) {
35
+ $originalFileName = $_FILES['awdr_import_rule']['name'];
36
+ $fileExtension = pathinfo($originalFileName, PATHINFO_EXTENSION);
37
+ //check for valid file extension
38
+ if (strtolower($fileExtension) == "csv") {
39
+ $fileName = $_FILES["awdr_import_rule"]["tmp_name"];
40
+ $originalFileType = $_FILES["awdr_import_rule"]["type"];
41
+ $valid_csv_mime_types = array('application/vnd.ms-excel', 'text/plain', 'text/csv', 'text/tsv');
42
+ //Check for valid mime type
43
+ if ($_FILES["awdr_import_rule"]["size"] > 0 && in_array($originalFileType, $valid_csv_mime_types)) {
44
+ $file = fopen($fileName, "r");
45
+ $current_date_time = '';
46
+ if (function_exists('current_time')) {
47
+ $current_time = current_time('timestamp');
48
+ $current_date_time = date('Y-m-d H:i:s', $current_time);
49
+ }
50
+ $current_user = get_current_user_id();
51
+ $i = 1;
52
+ while (($column = fgetcsv($file, 100000, ",")) !== FALSE) {
53
+ if ($i == 1) {
54
+ $i++;
55
+ continue;
56
+ }
57
+ $rule_id = intval(isset($column[0]) ? $column[0] : NULL);
58
+ $enabled = intval(isset($column[1]) ? $column[1] : 0);
59
+ $deleted = intval(isset($column[2]) ? $column[2] : 0);
60
+ $exclusive = intval(isset($column[3]) ? $column[3] : 0);
61
+ $title = sanitize_text_field(isset($column[4]) ? $column[4] : "Untitled Rule");
62
+ $priority = intval(isset($column[5]) ? $column[5] : $rule_id);
63
+ $apply_to = isset($column[6]) ? $column[6] : NULL;
64
+ $filters = isset($column[7]) ? $column[7] : array();
65
+ $filters = wp_json_encode(Helper::sanitizeJson($filters));
66
+ $conditions = isset($column[8]) ? $column[8] : array();
67
+ $conditions = wp_json_encode(Helper::sanitizeJson($conditions));
68
+ $product_adjustments = isset($column[9]) ? $column[9] : array();
69
+ $product_adjustments = wp_json_encode(Helper::sanitizeJson($product_adjustments));
70
+ $cart_adjustment = isset($column[10]) ? $column[10] : array();
71
+ $cart_adjustment = wp_json_encode(Helper::sanitizeJson($cart_adjustment));
72
+ $buy_x_get_x = isset($column[11]) ? $column[11] : array();
73
+ $buy_x_get_x = wp_json_encode(Helper::sanitizeJson($buy_x_get_x));
74
+ $buy_x_get_y = isset($column[12]) ? $column[12] : array();
75
+ $buy_x_get_y = wp_json_encode(Helper::sanitizeJson($buy_x_get_y));
76
+ $bulk_adjustment = isset($column[13]) ? $column[13] : array();
77
+ $bulk_adjustment = wp_json_encode(Helper::sanitizeJson($bulk_adjustment));
78
+ $set_adjustment = isset($column[14]) ? $column[14] : array();
79
+ $set_adjustment = wp_json_encode(Helper::sanitizeJson($set_adjustment));
80
+ $other_discount = isset($column[15]) ? $column[15] : NULL;
81
+ $date_from = isset($column[16]) && !empty($column[16]) ? intval($column[16]) : NULL;
82
+ $date_to = isset($column[17]) && !empty($column[16]) ? intval($column[17]) : NULL;
83
+ $usage_limits = intval(isset($column[18]) ? $column[18] : 0);
84
+ $rule_language = isset($column[19]) ? $column[19] : array();
85
+ $rule_language = wp_json_encode(Helper::sanitizeJson($rule_language));
86
+ $used_limits = intval(isset($column[20]) ? $column[20] : 0);
87
+ $additional = isset($column[21]) ? $column[21] : array('condition_relationship' => 'and');
88
+ $additional = wp_json_encode(Helper::sanitizeJson($additional));
89
+ $max_discount_sum = intval(isset($column[22]) ? $column[22] : NULL);
90
+ $advanced_discount_message = isset($column[23]) ? $column[23] : array('display' => 0, 'badge_color_picker' => '#ffffff', 'badge_text_color_picker' => '#000000', 'badge_text' => '');
91
+ $advanced_discount_message = wp_json_encode(Helper::sanitizeJson($advanced_discount_message));
92
+ $discount_type = sanitize_key(isset($column[24]) ? $column[24] : "wdr_simple_discount");
93
+ $used_coupons = isset($column[25]) ? $column[25] : array();
94
+ $used_coupons = wp_json_encode(Helper::sanitizeJson($used_coupons));
95
+ $arg = array(
96
+ 'enabled' => $enabled,
97
+ 'deleted' => $deleted,
98
+ 'exclusive' => $exclusive,
99
+ 'title' => (empty($title)) ? esc_html__('Untitled Rule', WDR_TEXT_DOMAIN) : $title,
100
+ 'priority' => $priority,
101
+ 'apply_to' => $apply_to,
102
+ 'filters' => $filters,
103
+ 'conditions' => $conditions,
104
+ 'product_adjustments' => $product_adjustments,
105
+ 'cart_adjustments' => $cart_adjustment,
106
+ 'buy_x_get_x_adjustments' => $buy_x_get_x,
107
+ 'buy_x_get_y_adjustments' => $buy_x_get_y,
108
+ 'bulk_adjustments' => $bulk_adjustment,
109
+ 'set_adjustments' => $set_adjustment,
110
+ 'other_discounts' => $other_discount,
111
+ 'date_from' => $date_from,
112
+ 'date_to' => $date_to,
113
+ 'usage_limits' => $usage_limits,
114
+ 'rule_language' => $rule_language,
115
+ 'used_limits' => $used_limits,
116
+ 'additional' => $additional,
117
+ 'max_discount_sum' => $max_discount_sum,
118
+ 'advanced_discount_message' => $advanced_discount_message,
119
+ 'discount_type' => $discount_type,
120
+ 'used_coupons' => $used_coupons,
121
+ 'created_by' => $current_user,
122
+ 'created_on' => $current_date_time,
123
+ 'modified_by' => $current_user,
124
+ 'modified_on' => $current_date_time,
125
+ );
126
+ $column_format = array('%d', '%d', '%d', '%s', '%d', '%d', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%d', '%d', '%d', '%s', '%d', '%s', '%d', '%s', '%s', '%s', '%d', '%s', '%d', '%s');
127
+ $rule_id = DBTable::saveRule($column_format, $arg);
128
+ if (!empty($rule_id)) {
129
+ $type = "success";
130
+ $message = __('<b style="color: green;">Rules Imported successfully</b>', WDR_TEXT_DOMAIN);
131
+ } else {
132
+ $type = "error";
133
+ $message = __('<b style="color: red;">Problem in Importing CSV Data</b>', WDR_TEXT_DOMAIN);
134
+ break;
135
+ }
136
+ }
137
  }
138
  }
139
  }
140
+ } ?>
141
  <form method="post" name="awdr-import-csv" id="awdr-import-csv" enctype="multipart/form-data">
142
+ <input type="hidden" name="security" value="<?php echo wp_create_nonce('awdr_import_rules_csv') ?>">
143
  <input type="file" name="awdr_import_rule" id="awdr-file-uploader" accept=".csv"><br>
144
+ <span id="awdr-upload-response"><?php echo $message; ?></span></br>
145
  <button type="submit" id="wdr-import" name="wdr-import" class="button button-primary">
146
+ <?php _e('Import', WDR_TEXT_DOMAIN); ?>
147
  </button>
148
  </form>
149
  </div>
150
  </div>
151
+ </div><?php
152
+ } else { ?>
153
+ <div class="wdr_settings_container">
154
+ <div>
155
+ <h3><?php _e('Import Tool', WDR_TEXT_DOMAIN); ?></h3>
156
+ <p><?php _e('Unlock this feature by <a href="https://www.flycart.org/products/wordpress/woocommerce-discount-rules" target="_blank">Upgrading to Pro</a>', WDR_TEXT_DOMAIN); ?> </p>
157
+ </div>
 
158
  </div><?php
159
  }
160
  ?>
v2/App/Views/Admin/Tabs/settings.php CHANGED
@@ -399,35 +399,35 @@
399
  </tr>
400
  </tbody>
401
  </table>
402
- <h1><?php _e('Banner', WDR_TEXT_DOMAIN); ?></h1>
403
  <table class="wdr-general-setting form-table">
404
  <tbody style="background-color: #fff;">
405
- <?php if(!$is_pro) { ?>
406
  <tr class="" style="">
407
  <td scope="row">
408
  <label for="applied_rule_message"
409
- class="awdr-left-align"><?php _e('Banner Content', WDR_TEXT_DOMAIN) ?></label>
410
- <span class="wdr_desc_text awdr-clear-both"><?php _e('A static banner you that you want to display in your storefront. <br><br> <b>NOTE:</b> It is a static banner. You can use any content or html here.', WDR_TEXT_DOMAIN); ?></span>
411
  </td>
412
  <td>
413
- <?php _e("Unlock this feature by <a href='https://www.flycart.org/products/wordpress/woocommerce-discount-rules?utm_source=woo-discount-rules-v2&utm_campaign=doc&utm_medium=text-click&utm_content=unlock_pro' target='_blank'>Upgrading to Pro</a>", WDR_TEXT_DOMAIN); ?>
414
  </td>
415
  </tr>
416
  <tr class="" style="">
417
  <td scope="row">
418
  <label for="applied_rule_message"
419
- class="awdr-left-align"><?php _e('Banner Content display position', WDR_TEXT_DOMAIN) ?></label>
420
- <span class="wdr_desc_text awdr-clear-both"><?php _e('Choose a display position for the banner in your storefront', WDR_TEXT_DOMAIN); ?></span>
421
  </td>
422
- <td><?php _e("Unlock this feature by <a href='https://www.flycart.org/products/wordpress/woocommerce-discount-rules?utm_source=woo-discount-rules-v2&utm_campaign=doc&utm_medium=text-click&utm_content=unlock_pro' target='_blank'>Upgrading to Pro</a>", WDR_TEXT_DOMAIN); ?></td>
423
  </tr>
424
- <?php } ?>
425
 
426
  <?php
427
- do_action('advanced_woo_discount_rules_promotion_settings_fields', $configuration);
428
- ?>
429
  </tbody>
430
- </table>
431
  <h1><?php _e('On-Sale page', WDR_TEXT_DOMAIN); ?> - <a href="https://docs.flycart.org/en/articles/4098969-sale-page-discount-rules-2-0?utm_source=woo-discount-rules-v2&utm_campaign=doc&utm_medium=text-click&utm_content=on_sale_page_settings" target="_blank"><?php esc_html_e('Read Docs', WDR_TEXT_DOMAIN); ?></a></h1>
432
  <table class="wdr-general-setting form-table">
433
  <tbody style="background-color: #fff;">
@@ -438,7 +438,8 @@
438
  ?>
439
  </td>
440
  <td scope="row">
441
- <?php if($is_pro){ ?>
 
442
  <div class="awdr_rebuild_on_sale_list_progress">
443
  </div>
444
  <div class="awdr_rebuild_on_sale_list_con">
@@ -457,7 +458,6 @@
457
  } ?>
458
  ><?php esc_attr_e("All active rules", WDR_TEXT_DOMAIN); ?></option>
459
  <?php
460
- $awdr_rebuild_on_sale_rules = $configuration->getConfig('awdr_rebuild_on_sale_rules', array());
461
  $rules = \Wdr\App\Controllers\ManageDiscount::$available_rules;
462
  if(!empty($rules) && is_array($rules)){
463
  foreach ($rules as $rule){
@@ -884,7 +884,7 @@
884
  <input type="hidden" name="customize_bulk_table_range" class="customize_bulk_table_range" value="<?php echo $configuration->getConfig('customize_bulk_table_range', 1); ?>">
885
 
886
  <input type="hidden" name="method" value="save_configuration">
887
- <input type="hidden" class="customize_banner_content" name="customize_banner_content" value="">
888
  <input type="hidden" name="action" value="wdr_ajax">
889
  <input type="hidden" name="awdr_nonce" value="<?php echo \Wdr\App\Helpers\Helper::create_nonce('wdr_ajax_save_configuration'); ?>">
890
  <p class="submit"><input type="submit" name="submit" id="submit" class="button button-primary save-configuration-submit"
399
  </tr>
400
  </tbody>
401
  </table>
402
+ <!--<h1><?php /*_e('Banner', WDR_TEXT_DOMAIN); */?></h1>
403
  <table class="wdr-general-setting form-table">
404
  <tbody style="background-color: #fff;">
405
+ <?php /*if(!$is_pro) { */?>
406
  <tr class="" style="">
407
  <td scope="row">
408
  <label for="applied_rule_message"
409
+ class="awdr-left-align"><?php /*_e('Banner Content', WDR_TEXT_DOMAIN) */?></label>
410
+ <span class="wdr_desc_text awdr-clear-both"><?php /*_e('A static banner you that you want to display in your storefront. <br><br> <b>NOTE:</b> It is a static banner. You can use any content or html here.', WDR_TEXT_DOMAIN); */?></span>
411
  </td>
412
  <td>
413
+ <?php /*_e("Unlock this feature by <a href='https://www.flycart.org/products/wordpress/woocommerce-discount-rules?utm_source=woo-discount-rules-v2&utm_campaign=doc&utm_medium=text-click&utm_content=unlock_pro' target='_blank'>Upgrading to Pro</a>", WDR_TEXT_DOMAIN); */?>
414
  </td>
415
  </tr>
416
  <tr class="" style="">
417
  <td scope="row">
418
  <label for="applied_rule_message"
419
+ class="awdr-left-align"><?php /*_e('Banner Content display position', WDR_TEXT_DOMAIN) */?></label>
420
+ <span class="wdr_desc_text awdr-clear-both"><?php /*_e('Choose a display position for the banner in your storefront', WDR_TEXT_DOMAIN); */?></span>
421
  </td>
422
+ <td><?php /*_e("Unlock this feature by <a href='https://www.flycart.org/products/wordpress/woocommerce-discount-rules?utm_source=woo-discount-rules-v2&utm_campaign=doc&utm_medium=text-click&utm_content=unlock_pro' target='_blank'>Upgrading to Pro</a>", WDR_TEXT_DOMAIN); */?></td>
423
  </tr>
424
+ <?php /*} */?>
425
 
426
  <?php
427
+ /* do_action('advanced_woo_discount_rules_promotion_settings_fields', $configuration);
428
+ */?>
429
  </tbody>
430
+ </table>-->
431
  <h1><?php _e('On-Sale page', WDR_TEXT_DOMAIN); ?> - <a href="https://docs.flycart.org/en/articles/4098969-sale-page-discount-rules-2-0?utm_source=woo-discount-rules-v2&utm_campaign=doc&utm_medium=text-click&utm_content=on_sale_page_settings" target="_blank"><?php esc_html_e('Read Docs', WDR_TEXT_DOMAIN); ?></a></h1>
432
  <table class="wdr-general-setting form-table">
433
  <tbody style="background-color: #fff;">
438
  ?>
439
  </td>
440
  <td scope="row">
441
+ <?php if($is_pro){
442
+ $awdr_rebuild_on_sale_rules = $configuration->getConfig('awdr_rebuild_on_sale_rules', array()); ?>
443
  <div class="awdr_rebuild_on_sale_list_progress">
444
  </div>
445
  <div class="awdr_rebuild_on_sale_list_con">
458
  } ?>
459
  ><?php esc_attr_e("All active rules", WDR_TEXT_DOMAIN); ?></option>
460
  <?php
 
461
  $rules = \Wdr\App\Controllers\ManageDiscount::$available_rules;
462
  if(!empty($rules) && is_array($rules)){
463
  foreach ($rules as $rule){
884
  <input type="hidden" name="customize_bulk_table_range" class="customize_bulk_table_range" value="<?php echo $configuration->getConfig('customize_bulk_table_range', 1); ?>">
885
 
886
  <input type="hidden" name="method" value="save_configuration">
887
+ <!-- <input type="hidden" class="customize_banner_content" name="customize_banner_content" value="">-->
888
  <input type="hidden" name="action" value="wdr_ajax">
889
  <input type="hidden" name="awdr_nonce" value="<?php echo \Wdr\App\Helpers\Helper::create_nonce('wdr_ajax_save_configuration'); ?>">
890
  <p class="submit"><input type="submit" name="submit" id="submit" class="button button-primary save-configuration-submit"
v2/App/Views/Templates/discount_table.php CHANGED
@@ -47,8 +47,11 @@ if (!empty($ranges) && !empty($woocommerce)) {
47
  $tbl_range = $base::$config->getConfig('customize_bulk_table_range', 1);
48
 
49
  $tbl_title_text = $base::$config->getConfig('table_title_column_name', 'Title');
 
50
  $tbl_discount_text = $base::$config->getConfig('table_discount_column_name', 'Discount');
 
51
  $tbl_range_text = $base::$config->getConfig('table_range_column_name', 'Range');
 
52
 
53
  $table_sort_by_columns = array(
54
  'tbl_title' => $tbl_title,
47
  $tbl_range = $base::$config->getConfig('customize_bulk_table_range', 1);
48
 
49
  $tbl_title_text = $base::$config->getConfig('table_title_column_name', 'Title');
50
+ $tbl_title_text = \Wdr\App\Helpers\Helper::getCleanHtml($tbl_title_text);
51
  $tbl_discount_text = $base::$config->getConfig('table_discount_column_name', 'Discount');
52
+ $tbl_discount_text = \Wdr\App\Helpers\Helper::getCleanHtml($tbl_discount_text);
53
  $tbl_range_text = $base::$config->getConfig('table_range_column_name', 'Range');
54
+ $tbl_range_text = \Wdr\App\Helpers\Helper::getCleanHtml($tbl_range_text);
55
 
56
  $table_sort_by_columns = array(
57
  'tbl_title' => $tbl_title,
v2/Assets/Js/admin_script.js CHANGED
@@ -54,30 +54,30 @@ jQuery(document).ready(function ($) {
54
  newIndex: last_index
55
  });
56
  //
57
- switch(current_block) {
58
  case "products":
59
- $('.wdr-filter-group[data-index="'+ last_index +'"]').append('<div class="wdr_filter_desc_text">' + wdr_data.localization_data.filter_products + '</div>');
60
  break;
61
  case "product_category":
62
- $('.wdr-filter-group[data-index="'+ last_index +'"]').append('<div class="wdr_filter_desc_text">' + wdr_data.localization_data.filter_Category + '</div>');
63
  break;
64
  case "product_attributes":
65
- $('.wdr-filter-group[data-index="'+ last_index +'"]').append('<div class="wdr_filter_desc_text">' + wdr_data.localization_data.filter_Attributes + '</div>');
66
  break;
67
  case "product_tags":
68
- $('.wdr-filter-group[data-index="'+ last_index +'"]').append('<div class="wdr_filter_desc_text">' + wdr_data.localization_data.filter_Tags + '</div>');
69
  break;
70
  case "product_sku":
71
- $('.wdr-filter-group[data-index="'+ last_index +'"]').append('<div class="wdr_filter_desc_text">' + wdr_data.localization_data.filter_SKUs + '</div>');
72
  break;
73
  case "product_on_sale":
74
- $('.wdr-filter-group[data-index="'+ last_index +'"]').append('<div class="wdr_filter_desc_text">' + wdr_data.localization_data.filter_On_sale_products + '</div>');
75
  break;
76
  case "all_products":
77
- $('.wdr-filter-group[data-index="'+ last_index +'"]').append('<div class="wdr_filter_desc_text">' + wdr_data.localization_data.filter_all_products + '</div>');
78
  break;
79
  default:
80
- $('.wdr-filter-group[data-index="'+ last_index +'"]').append('<div class="wdr_filter_desc_text">' + wdr_data.localization_data.filter_custom_taxonomies + '</div>');
81
  break;
82
 
83
  }
@@ -108,7 +108,7 @@ jQuery(document).ready(function ($) {
108
  newIndex: last_index
109
  });
110
 
111
- if(wdr_data.enable_subtotal_promo_text == '1'){
112
  wdr_buildrule.wdr_clone_field({
113
  addConditionType: 'empty-promo',
114
  addFilterMethod: '.wdr-subtotal-promo-messeage-main',
@@ -121,7 +121,7 @@ jQuery(document).ready(function ($) {
121
 
122
  $(document).on('change', '.subtotal_operator', function () {
123
  // alert($(this).val());
124
- if(wdr_data.enable_subtotal_promo_text == '1') {
125
  let subtotal_operator = $(this).val();
126
  let current_promo_index = $(this).parents('.wdr-conditions-container').attr("data-index");
127
  if (subtotal_operator == 'greater_than_or_equal' || subtotal_operator == 'greater_than') {
@@ -139,7 +139,7 @@ jQuery(document).ready(function ($) {
139
  parentsRow: ".wdr-conditions-container",
140
  thisObject: this,
141
  });
142
- if(wdr_data.enable_subtotal_promo_text == '1') {
143
  let condition_type = $(this).parent('.wdr-btn-remove').siblings('.wdr-condition-type').find('.wdr-product-condition-type').val();
144
  if (condition_type == 'cart_subtotal') {
145
  let promo_index = $(this).parents('.wdr-conditions-container').attr("data-index");
@@ -168,11 +168,11 @@ jQuery(document).ready(function ($) {
168
  datepicker: false,
169
  format: 'H:i'
170
  });
171
- }else if(current_block != 'cart_subtotal'){
172
  let promo_index = $(this).parents('.wdr-conditions-container').attr("data-index");
173
  $('.promo_show_hide_' + promo_index).remove();
174
- }else if(current_block == 'cart_subtotal'){
175
- if(wdr_data.enable_subtotal_promo_text == '1'){
176
  wdr_buildrule.wdr_clone_field({
177
  addConditionType: 'empty-promo',
178
  addFilterMethod: '.wdr-subtotal-promo-messeage-main',
@@ -275,7 +275,7 @@ jQuery(document).ready(function ($) {
275
  $('.' + show_discount_content).show();
276
  });
277
 
278
- function awdr_process_v1_to_v2_migration(awdr_nonce){
279
  $.ajax({
280
  data: {method: 'do_v1_v2_migration', action: 'wdr_ajax', awdr_nonce: awdr_nonce},
281
  type: 'post',
@@ -284,8 +284,8 @@ jQuery(document).ready(function ($) {
284
  notify(wdr_data.localization_data.error, 'error', alert_counter);
285
  },
286
  success: function (data) {
287
- if(data.data.status != undefined){
288
- if(data.data.status == "completed"){
289
  notify(wdr_data.localization_data.processing_migration_success_message, 'success', alert_counter);
290
  location.reload();
291
  } else {
@@ -305,7 +305,7 @@ jQuery(document).ready(function ($) {
305
  $(document).on('click', '#awdr_rebuild_on_sale_list', function () {
306
  var rules = $("#awdr_rebuild_on_sale_rules").val();
307
  $(".awdr_rebuild_on_sale_list_notice").html("");
308
- if(rules != null){
309
  $("#awdr_rebuild_on_sale_list").attr('disabled', "disabled");
310
  $("#awdr_rebuild_on_sale_list").html(wdr_data.localization_data.rebuild_on_sale_list_processing_text);
311
  awdr_process_on_sale_list(rules, $(this));
@@ -324,9 +324,14 @@ jQuery(document).ready(function ($) {
324
  //$(".awdr_rebuild_on_sale_rule_page_con").removeClass("need_attention");
325
  });
326
 
327
- function awdr_process_on_sale_list(rules, current_obj){
328
  $.ajax({
329
- data: {method: 'rebuild_onsale_list', action: 'wdr_ajax', rules: rules, awdr_nonce: current_obj.attr('data-awdr_nonce')},
 
 
 
 
 
330
  type: 'post',
331
  url: ajaxurl,
332
  error: function (request, error) {
@@ -363,7 +368,7 @@ jQuery(document).ready(function ($) {
363
  success: function (data) {
364
  if (data === 'failed') {
365
  notify(wdr_data.localization_data.error, 'error', alert_counter);
366
- } else if(data.data === true){
367
  $(".wdr_migration_process").append(wdr_data.localization_data.skip_migration_success_message);
368
  notify(wdr_data.localization_data.skip_migration_success_message, 'success', alert_counter);
369
  }
@@ -381,7 +386,7 @@ jQuery(document).ready(function ($) {
381
  type: 'POST',
382
  data: {action: 'awdr_switch_version', version: version, page: page},
383
  success: function (data) {
384
- if(data.data.status == true){
385
  window.location.replace(data.data.url);
386
  }
387
  $(".wdr_switch_message").html(data.data.message);
@@ -395,13 +400,18 @@ jQuery(document).ready(function ($) {
395
  $(document).on('click', '.wdr_duplicate_rule', function () {
396
  let loader = $('.woo_discount_loader');
397
  $.ajax({
398
- data: {rowid: $(this).data('duplicate-rule'), awdr_nonce: $(this).data('awdr_nonce'), method: 'duplicate_rule', action: 'wdr_ajax'},
 
 
 
 
 
399
  type: 'post',
400
  url: ajaxurl,
401
- beforeSend: function() {
402
  loader.show();
403
  },
404
- complete: function() {
405
  loader.hide();
406
  },
407
  error: function (request, error) {
@@ -426,13 +436,18 @@ jQuery(document).ready(function ($) {
426
  if (confirm(wdr_data.localization_data.delete_confirm)) {
427
  let loader = $('.woo_discount_loader');
428
  $.ajax({
429
- data: {rowid: $(this).data('delete-rule'), awdr_nonce: $(this).data('awdr_nonce'), method: 'delete_rule', action: 'wdr_ajax'},
 
 
 
 
 
430
  type: 'post',
431
  url: ajaxurl,
432
- beforeSend: function() {
433
  loader.show();
434
  },
435
- complete: function() {
436
  loader.hide();
437
  },
438
  error: function (request, error) {
@@ -474,10 +489,10 @@ jQuery(document).ready(function ($) {
474
  },
475
  type: 'post',
476
  url: ajaxurl,
477
- beforeSend: function() {
478
  loader.show();
479
  },
480
- complete: function() {
481
  loader.hide();
482
  },
483
  error: function (request, error) {
@@ -515,7 +530,7 @@ jQuery(document).ready(function ($) {
515
  noResults: function () {
516
  return wdr_data.labels.select2_no_results;
517
  },
518
- errorLoading: function() {
519
  /* Workaround for https://github.com/select2/select2/issues/4355 instead of i18n_ajax_error.*/
520
  return wdr_data.labels.searching_text;
521
  }
@@ -530,7 +545,7 @@ jQuery(document).ready(function ($) {
530
  query: params.term,
531
  action: 'wdr_ajax',
532
  method: $el.data('list') || 'products',
533
- awdr_nonce: $('input[name=wdr_ajax_select2]').val() || '',
534
  taxonomy: $el.data('taxonomy') || '',
535
  selected: $el.val()
536
  };
@@ -753,8 +768,8 @@ jQuery(document).ready(function ($) {
753
  */
754
  $('#wdr-save-rule').submit(function (e) {
755
  e.preventDefault();
756
- let validation = woo_discount_rule_validation( $(this) );
757
- if(!validation){
758
  return false;
759
  }
760
  let loader = $('.woo_discount_loader');
@@ -763,35 +778,45 @@ jQuery(document).ready(function ($) {
763
  data: $(this).serialize(),
764
  type: 'post',
765
  url: ajaxurl,
766
- beforeSend: function() {
767
  loader.show();
768
  },
769
- complete: function() {
770
  loader.hide();
771
  },
772
  error: function (request, error) {
773
  notify(wdr_data.localization_data.error, 'error', alert_counter);
774
  },
775
- success: function (data) {
776
- if(data.build_index != undefined) {
777
- if (data.build_index.required_rebuild != undefined) {
778
- if (data.build_index.required_rebuild == true) {
779
- $(".awdr_rebuild_on_sale_rule_page_con").addClass("need_attention");
 
 
 
780
  }
781
  }
782
- }
783
- if (data.redirect) {
784
- window.location.href = data.redirect;
785
- notify(wdr_data.localization_data.save_rule, 'success', alert_counter);
786
- } else if (data.coupon_message) {
787
- $(".coupon_name_msg").css("border", "1px solid #FF0000").focus();
788
- notify(wdr_data.localization_data.coupon_exists, 'error', alert_counter);
 
 
 
 
789
  } else {
790
- $('.wdr_desc_text.coupon_error_msg').hide();
791
- $(".coupon_name_msg").css("border", "");
792
- notify(wdr_data.localization_data.save_rule, 'success', alert_counter);
 
 
 
 
793
  }
794
-
795
  }
796
  });
797
  });
@@ -809,126 +834,126 @@ jQuery(document).ready(function ($) {
809
  * @param form
810
  * @returns {boolean}
811
  */
812
- function woo_discount_rule_validation( form ){
813
- let discount_type = $('.awdr-product-discount-type').val();
814
- let wdr_filter_validations = [];
815
- let wdr_discount_validations = [];
816
- let wdr_condition_validations = [];
817
- switch(discount_type){
818
- case 'wdr_simple_discount':
819
- wdr_filter_validations = wdr_filter_validation();
820
- wdr_discount_validations = wdr_discount_validation(discount_type);
821
- wdr_condition_validations = wdr_condition_validation();
822
- break;
823
- case 'wdr_cart_discount':
824
- wdr_filter_validations = wdr_filter_validation();
825
- wdr_discount_validations = wdr_discount_validation(discount_type);
826
- wdr_condition_validations = wdr_condition_validation();
827
- break;
828
- case 'wdr_free_shipping':
829
- wdr_condition_validations = wdr_condition_validation();
830
- break;
831
- case 'wdr_bulk_discount':
832
- wdr_filter_validations = wdr_filter_validation();
833
- wdr_discount_validations = wdr_discount_validation(discount_type);
834
- wdr_condition_validations = wdr_condition_validation();
835
- break;
836
- case 'wdr_set_discount':
837
- wdr_filter_validations = wdr_filter_validation();
838
- wdr_discount_validations = wdr_discount_validation(discount_type);
839
- wdr_condition_validations = wdr_condition_validation();
840
- break;
841
- case 'wdr_buy_x_get_x_discount':
842
- wdr_filter_validations = wdr_filter_validation();
843
- wdr_discount_validations = wdr_discount_validation(discount_type);
844
- wdr_condition_validations = wdr_condition_validation();
845
- break;
846
- case 'wdr_buy_x_get_y_discount':
847
- wdr_filter_validations = wdr_filter_validation();
848
- wdr_discount_validations = wdr_discount_validation(discount_type);
849
- wdr_condition_validations = wdr_condition_validation();
850
- break
851
- default:
852
- case 'not_selected':
853
- break;
854
- }
855
- if(wdr_filter_validations.indexOf("fails") !== -1){
856
- return false;
857
- }
858
- if(wdr_discount_validations.indexOf("fails") !== -1){
859
- return false;
860
- }
861
- if(wdr_condition_validations.indexOf("fails") !== -1){
862
- return false;
863
- }
864
- return true;
865
  }
866
 
867
  /**
868
  * Validate Filter section
869
  * @returns {[]}
870
  */
871
- function wdr_filter_validation(){
872
- let filter_array = [];
873
- $('.wdr-filter-group').each(function (index,element) {
874
  let product_filter = $(element).find('.wdr-product-filter-type').val();
875
  let product_filter_val = $(element).find('.awdr_validation').val();
876
  switch (product_filter) {
877
  case 'all_products':
878
  break;
879
  case 'products':
880
- if(!product_filter_val){
881
  filter_array.push("fails");
882
  $(element).find('.select2-selection').css("border", "1px solid red");
883
  $(element).find('.select2-selection').focus();
884
- }else{
885
  $(element).find('.select2-selection').css("border", "1px solid #7e8993");
886
  }
887
  break;
888
  case 'product_category':
889
- if(!product_filter_val){
890
  filter_array.push("fails");
891
  $(element).find('.select2-selection').css("border", "1px solid red");
892
  $(element).find('.select2-selection').focus();
893
- }else{
894
  $(element).find('.select2-selection').css("border", "1px solid #7e8993");
895
  }
896
  break;
897
  case 'product_attributes':
898
- if(!product_filter_val){
899
  filter_array.push("fails");
900
  $(element).find('.select2-selection').css("border", "1px solid red");
901
  $(element).find('.select2-selection').focus();
902
- }else{
903
  $(element).find('.select2-selection').css("border", "1px solid #7e8993");
904
  }
905
  break;
906
  case 'product_tags':
907
- if(!product_filter_val){
908
  filter_array.push("fails");
909
  $(element).find('.select2-selection').css("border", "1px solid red");
910
  $(element).find('.select2-selection').focus();
911
- }else{
912
  $(element).find('.select2-selection').css("border", "1px solid #7e8993");
913
  }
914
  break;
915
  case 'product_sku':
916
- if(!product_filter_val){
917
  filter_array.push("fails");
918
  $(element).find('.select2-selection').css("border", "1px solid red");
919
  $(element).find('.select2-selection').focus();
920
- }else{
921
  $(element).find('.select2-selection').css("border", "1px solid #7e8993");
922
  }
923
  break;
924
  case 'product_on_sale':
925
  break;
926
  default:
927
- if(!product_filter_val){
928
  filter_array.push("fails");
929
  $(element).find('.select2-selection').css("border", "1px solid red");
930
  $(element).find('.select2-selection').focus();
931
- }else{
932
  $(element).find('.select2-selection').css("border", "1px solid #7e8993");
933
  }
934
  break;
@@ -942,185 +967,185 @@ jQuery(document).ready(function ($) {
942
  * @param discount_type
943
  * @returns {[]}
944
  */
945
- function wdr_discount_validation(discount_type){
946
  let discount_array = [];
947
- switch(discount_type){
948
  case 'wdr_simple_discount':
949
  let product_discount = $('.product_discount_value').val();
950
- if( product_discount == '' || !product_discount ){
951
  discount_array.push("fails");
952
  $('.product_discount_value').css("border", "1px solid red");
953
  $('.product_discount_value').focus();
954
- }else{
955
  $('.product_discount_value').css("border", "1px solid #7e8993");
956
  }
957
  break;
958
  case 'wdr_cart_discount':
959
  let cart_discount = $('.awdr_cart_discount_value').val();
960
- if( cart_discount == '' || !cart_discount ){
961
  discount_array.push("fails");
962
  $('.awdr_cart_discount_value').css("border", "1px solid red");
963
  $('.awdr_cart_discount_value').focus();
964
- }else{
965
  $('.awdr_cart_discount_value').css("border", "1px solid #7e8993");
966
  }
967
  break;
968
  case 'wdr_free_shipping':
969
  break;
970
  case 'wdr_bulk_discount':
971
- $('.bulk_range_setter').find('.awdr-bulk-group').each(function (index,element) {
972
- let min_qty = $(element).find('.bulk_discount_min').val();
973
- let max_qty = $(element).find('.bulk_discount_max').val();
974
- let max_val = $(element).find('.bulk_discount_value').val();
975
- if( min_qty == '' && max_qty == ''){
976
  discount_array.push("fails");
977
  $(element).find('.bulk_discount_min').css("border", "1px solid red");
978
  $(element).find('.bulk_discount_min').focus();
979
  $(element).find('.bulk_discount_max').css("border", "1px solid red");
980
  $(element).find('.bulk_discount_max').focus();
981
- }else{
982
  $(element).find('.bulk_discount_min').css("border", "1px solid #7e8993");
983
  $(element).find('.bulk_discount_max').css("border", "1px solid #7e8993");
984
  }
985
- if(max_val == ''){
986
  discount_array.push("fails");
987
  $(element).find('.bulk_discount_value').css("border", "1px solid red");
988
  $(element).find('.bulk_discount_value').focus();
989
- }else{
990
  $(element).find('.bulk_discount_value').css("border", "1px solid #7e8993");
991
  }
992
  });
993
  break;
994
  case 'wdr_set_discount':
995
- $('.set_range_setter').find('.awdr-set-group').each(function (index,element) {
996
- let min_qty = $(element).find('.set_discount_min').val();
997
- let max_val = $(element).find('.set_discount_value').val();
998
- if( min_qty == ''){
999
  discount_array.push("fails");
1000
  $(element).find('.set_discount_min').css("border", "1px solid red");
1001
  $(element).find('.set_discount_min').focus();
1002
- }else{
1003
  $(element).find('.set_discount_min').css("border", "1px solid #7e8993");
1004
  }
1005
- if(max_val == ''){
1006
  discount_array.push("fails");
1007
  $(element).find('.set_discount_value').css("border", "1px solid red");
1008
  $(element).find('.set_discount_value').focus();
1009
- }else{
1010
  $(element).find('.set_discount_value').css("border", "1px solid #7e8993");
1011
  }
1012
  });
1013
  break;
1014
  case 'wdr_buy_x_get_x_discount':
1015
- $('.buyx_getx_range_setter').find('.buyx_getx_individual_range').each(function (index,element) {
1016
- let min_qty = $(element).find('.bxgx-min').val();
1017
- let max_qty = $(element).find('.bxgx-max').val();
1018
- let free_qty = $(element).find('.bxgx-qty').val();
1019
- let select_type = $(element).find('.buyx_getx_discount_select').val();
1020
- let max_val = $(element).find('.bxgx-value').val();
1021
- if($(element).find('.awdr-bogo-recurcive').prop("checked") == true){
1022
- if( min_qty == ''){
1023
  discount_array.push("fails");
1024
  $(element).find('.bxgx-min').css("border", "1px solid red");
1025
  $(element).find('.bxgx-min').focus();
1026
- }else{
1027
  $(element).find('.bxgx-min').css("border", "1px solid #7e8993");
1028
  }
1029
  }
1030
- if( min_qty == '' && max_qty == ''){
1031
  discount_array.push("fails");
1032
  $(element).find('.bxgx-min').css("border", "1px solid red");
1033
  $(element).find('.bxgx-min').focus();
1034
  $(element).find('.bxgx-max').css("border", "1px solid red");
1035
  $(element).find('.bxgx-max').focus();
1036
- }else{
1037
  $(element).find('.bxgx-min').css("border", "1px solid #7e8993");
1038
  $(element).find('.bxgx-max').css("border", "1px solid #7e8993");
1039
  }
1040
- if(free_qty == ''){
1041
  discount_array.push("fails");
1042
  $(element).find('.bxgx-qty').css("border", "1px solid red");
1043
  $(element).find('.bxgx-qty').focus();
1044
- }else{
1045
  $(element).find('.bxgx-qty').css("border", "1px solid #7e8993");
1046
  }
1047
 
1048
- if(select_type != 'free_product' && max_val == ''){
1049
  discount_array.push("fails");
1050
  $(element).find('.bxgx-value').css("border", "1px solid red");
1051
  $(element).find('.bxgx-value').focus();
1052
- }else{
1053
  $(element).find('.bxgx-value').css("border", "1px solid #7e8993");
1054
  }
1055
  });
1056
  break;
1057
  case 'wdr_buy_x_get_y_discount':
1058
- let bxgy_type = $('.select_bxgy_type').val();
1059
- $('.awdr_buyx_gety_range_setter').find('.buyx_gety_individual_range').each(function (index,element) {
1060
- let min_qty = $(element).find('.bxgy-min').val();
1061
- let max_qty = $(element).find('.bxgy-max').val();
1062
- let product_qty = $(element).find('.bxgy-product-selector').val();
1063
- let category_qty = $(element).find('.bxgy-category-selector').val();
1064
- let free_qty = $(element).find('.bxgy-qty').val();
1065
- let select_type = $(element).find('.buyx_gety_discount_select').val();
1066
- let max_val = $(element).find('.bxgy-val').val();
1067
-
1068
- if(bxgy_type == 'bxgy_product'){
1069
- if(!product_qty){
1070
  discount_array.push("fails");
1071
  $(element).find('.select2-selection').css("border", "1px solid red");
1072
  $(element).find('.select2-selection').focus();
1073
- }else{
1074
  $(element).find('.select2-selection').css("border", "1px solid #7e8993");
1075
  }
1076
- }else if(bxgy_type == 'bxgy_category'){
1077
- if(!category_qty){
1078
  discount_array.push("fails");
1079
  $(element).find('.select2-selection').css("border", "1px solid red");
1080
  $(element).find('.select2-selection').focus();
1081
- }else{
1082
  $(element).find('.select2-selection').css("border", "1px solid #7e8993");
1083
  }
1084
- }else if(bxgy_type == '0' || !bxgy_type){
1085
  discount_array.push("fails");
1086
  $('.select_bxgy_type').css("border", "1px solid red");
1087
  $('.select_bxgy_type').focus();
1088
- }else {
1089
  $('.select_bxgy_type').css("border", "1px solid #7e8993");
1090
  }
1091
 
1092
- if($(element).find('.awdr-bogo-recurcive').prop("checked") == true){
1093
- if( min_qty == ''){
1094
  discount_array.push("fails");
1095
  $(element).find('.bxgy-min').css("border", "1px solid red");
1096
  $(element).find('.bxgy-min').focus();
1097
- }else{
1098
  $(element).find('.bxgy-min').css("border", "1px solid #7e8993");
1099
  }
1100
  }
1101
- if( min_qty == '' && max_qty == ''){
1102
  discount_array.push("fails");
1103
  $(element).find('.bxgy-min').css("border", "1px solid red");
1104
  $(element).find('.bxgy-min').focus();
1105
  $(element).find('.bxgy-max').css("border", "1px solid red");
1106
  $(element).find('.bxgy-max').focus();
1107
- }else{
1108
  $(element).find('.bxgy-min').css("border", "1px solid #7e8993");
1109
  $(element).find('.bxgy-max').css("border", "1px solid #7e8993");
1110
  }
1111
- if(free_qty == ''){
1112
  discount_array.push("fails");
1113
  $(element).find('.bxgy-qty').css("border", "1px solid red");
1114
  $(element).find('.bxgy-qty').focus();
1115
- }else{
1116
  $(element).find('.bxgy-qty').css("border", "1px solid #7e8993");
1117
  }
1118
 
1119
- if(select_type != 'free_product' && max_val == ''){
1120
  discount_array.push("fails");
1121
  $(element).find('.bxgy-val').css("border", "1px solid red");
1122
  $(element).find('.bxgy-val').focus();
1123
- }else{
1124
  $(element).find('.bxgy-val').css("border", "1px solid #7e8993");
1125
  }
1126
  });
@@ -1133,29 +1158,29 @@ jQuery(document).ready(function ($) {
1133
  return discount_array;
1134
  }
1135
 
1136
- function wdr_condition_validation(){
1137
  let condition_array = [];
1138
- $('.wdr-condition-group').each(function (index,element) {
1139
- let condition_type = $(element).find('.wdr-product-condition-type').val();
1140
  if (typeof condition_type !== 'undefined') {
1141
  switch (condition_type) {
1142
  case 'cart_subtotal':
1143
  let sub_total = $(element).find('.float_only_field').val();
1144
- if(sub_total == ''){
1145
  condition_array.push("fails");
1146
  $(element).find('.float_only_field').css("border", "1px solid red");
1147
  $(element).find('.float_only_field').focus();
1148
- }else{
1149
  $(element).find('.float_only_field').css("border", "1px solid #7e8993");
1150
  }
1151
  break;
1152
  case 'cart_items_quantity':
1153
  let item_qty = $(element).find('.float_only_field').val();
1154
- if(item_qty == ''){
1155
  condition_array.push("fails");
1156
  $(element).find('.float_only_field').css("border", "1px solid red");
1157
  $(element).find('.float_only_field').focus();
1158
- }else{
1159
  $(element).find('.float_only_field').css("border", "1px solid #7e8993");
1160
  }
1161
  break;
@@ -1163,87 +1188,87 @@ jQuery(document).ready(function ($) {
1163
  let coupon_type = $(element).find('.wdr_copon_type').val();
1164
  let custom_coupon = $(element).find('.coupon_name_msg').val();
1165
  let wc_coupon_val = $(element).find('#rm-coupon').val();
1166
- if(coupon_type == 'custom_coupon'){
1167
- if(custom_coupon == ''){
1168
  condition_array.push("fails");
1169
  $(element).find('.coupon_name_msg').css("border", "1px solid red");
1170
  $(element).find('.coupon_name_msg').focus();
1171
- }else{
1172
  $(element).find('.coupon_name_msg').css("border", "1px solid #7e8993");
1173
  }
1174
- }else{
1175
- if(!wc_coupon_val){
1176
  condition_array.push("fails");
1177
  $(element).find('.select2-selection').css("border", "1px solid red");
1178
  $(element).find('.select2-selection').focus();
1179
- }else{
1180
  $(element).find('.select2-selection').css("border", "1px solid #7e8993");
1181
  }
1182
  }
1183
  break;
1184
  case 'cart_items_weight':
1185
  let item_weight = $(element).find('.float_only_field').val();
1186
- if(item_weight == ''){
1187
  condition_array.push("fails");
1188
  $(element).find('.float_only_field').css("border", "1px solid red");
1189
  $(element).find('.float_only_field').focus();
1190
- }else{
1191
  $(element).find('.float_only_field').css("border", "1px solid #7e8993");
1192
  }
1193
  break;
1194
  case 'cart_payment_method':
1195
  let wc_payment_gateway = $(element).find('.select2-hidden-accessible').val();
1196
- if(!wc_payment_gateway){
1197
  condition_array.push("fails");
1198
  $(element).find('.select2-selection').css("border", "1px solid red");
1199
  $(element).find('.select2-selection').focus();
1200
- }else{
1201
  $(element).find('.select2-selection').css("border", "1px solid #7e8993");
1202
  }
1203
  break;
1204
  case 'cart_line_items_count':
1205
  let line_item_count = $(element).find('.float_only_field').val();
1206
- if(line_item_count == ''){
1207
  condition_array.push("fails");
1208
  $(element).find('.float_only_field').css("border", "1px solid red");
1209
  $(element).find('.float_only_field').focus();
1210
- }else{
1211
  $(element).find('.float_only_field').css("border", "1px solid #7e8993");
1212
  }
1213
  break;
1214
  case 'cart_item_product_attributes':
1215
  let wc_attributes = $(element).find('.awdr-attribute-validation').val();
1216
  let attribute_qty = $(element).find('.awdr-num-validation').val();
1217
- if(!wc_attributes){
1218
  condition_array.push("fails");
1219
  $(element).find('.select2-selection').css("border", "1px solid red");
1220
  $(element).find('.select2-selection').focus();
1221
- }else{
1222
  $(element).find('.select2-selection').css("border", "1px solid #7e8993");
1223
  }
1224
- if(attribute_qty == ''){
1225
  condition_array.push("fails");
1226
  $(element).find('.awdr-num-validation').css("border", "1px solid red");
1227
  $(element).find('.awdr-num-validation').focus();
1228
- }else{
1229
  $(element).find('.awdr-num-validation').css("border", "1px solid #7e8993");
1230
  }
1231
  break;
1232
  case 'cart_item_product_category':
1233
  let wc_category = $(element).find('.awdr-category-validation').val();
1234
  let category_qty = $(element).find('.awdr-num-validation').val();
1235
- if(!wc_category){
1236
  condition_array.push("fails");
1237
  $(element).find('.select2-selection').css("border", "1px solid red");
1238
  $(element).find('.select2-selection').focus();
1239
- }else{
1240
  $(element).find('.select2-selection').css("border", "1px solid #7e8993");
1241
  }
1242
- if(category_qty == ''){
1243
  condition_array.push("fails");
1244
  $(element).find('.awdr-num-validation').css("border", "1px solid red");
1245
  $(element).find('.awdr-num-validation').focus();
1246
- }else{
1247
  $(element).find('.awdr-num-validation').css("border", "1px solid #7e8993");
1248
  }
1249
  break;
@@ -1252,30 +1277,30 @@ jQuery(document).ready(function ($) {
1252
  let min_qty = $(element).find('.product_from_qty').val();
1253
  let max_qty = $(element).find('.product_to_qty').val();
1254
  let combination_operator = $(element).find('.combination_operator').val();
1255
- if(!wc_product){
1256
  condition_array.push("fails");
1257
  $(element).find('.select2-selection').css("border", "1px solid red");
1258
  $(element).find('.select2-selection').focus();
1259
- }else{
1260
  $(element).find('.select2-selection').css("border", "1px solid #7e8993");
1261
  }
1262
- if(combination_operator == 'in_range'){
1263
- if(min_qty == '' && max_qty == ''){
1264
  condition_array.push("fails");
1265
  $(element).find('.product_from_qty').css("border", "1px solid red");
1266
  $(element).find('.product_from_qty').focus();
1267
  $(element).find('.product_to_qty').css("border", "1px solid red");
1268
  $(element).find('.product_to_qty').focus();
1269
- }else{
1270
  $(element).find('.product_from_qty').css("border", "1px solid #7e8993");
1271
  $(element).find('.product_to_qty').css("border", "1px solid #7e8993");
1272
  }
1273
- }else{
1274
- if(min_qty == ''){
1275
  condition_array.push("fails");
1276
  $(element).find('.product_from_qty').css("border", "1px solid red");
1277
  $(element).find('.product_from_qty').focus();
1278
- }else{
1279
  $(element).find('.product_from_qty').css("border", "1px solid #7e8993");
1280
  }
1281
  }
@@ -1283,54 +1308,54 @@ jQuery(document).ready(function ($) {
1283
  case 'cart_item_product_sku':
1284
  let wc_sku = $(element).find('.awdr-sku-validation').val();
1285
  let sku_qty = $(element).find('.awdr-num-validation').val();
1286
- if(!wc_sku){
1287
  condition_array.push("fails");
1288
  $(element).find('.select2-selection').css("border", "1px solid red");
1289
  $(element).find('.select2-selection').focus();
1290
- }else{
1291
  $(element).find('.select2-selection').css("border", "1px solid #7e8993");
1292
  }
1293
- if(sku_qty == ''){
1294
  condition_array.push("fails");
1295
  $(element).find('.awdr-num-validation').css("border", "1px solid red");
1296
  $(element).find('.awdr-num-validation').focus();
1297
- }else{
1298
  $(element).find('.awdr-num-validation').css("border", "1px solid #7e8993");
1299
  }
1300
  break;
1301
  case 'cart_item_product_tags':
1302
  let wc_tags = $(element).find('.awdr-tag-validation').val();
1303
  let tag_qty = $(element).find('.awdr-num-validation').val();
1304
- if(!wc_tags){
1305
  condition_array.push("fails");
1306
  $(element).find('.select2-selection').css("border", "1px solid red");
1307
  $(element).find('.select2-selection').focus();
1308
- }else{
1309
  $(element).find('.select2-selection').css("border", "1px solid #7e8993");
1310
  }
1311
- if(tag_qty == ''){
1312
  condition_array.push("fails");
1313
  $(element).find('.awdr-num-validation').css("border", "1px solid red");
1314
  $(element).find('.awdr-num-validation').focus();
1315
- }else{
1316
  $(element).find('.awdr-num-validation').css("border", "1px solid #7e8993");
1317
  }
1318
  break;
1319
  case 'cart_item_products':
1320
  let wc_products = $(element).find('.awdr-product-validation').val();
1321
  let product_qty = $(element).find('.awdr-num-validation').val();
1322
- if(!wc_products){
1323
  condition_array.push("fails");
1324
  $(element).find('.select2-selection').css("border", "1px solid red");
1325
  $(element).find('.select2-selection').focus();
1326
- }else{
1327
  $(element).find('.select2-selection').css("border", "1px solid #7e8993");
1328
  }
1329
- if(product_qty == ''){
1330
  condition_array.push("fails");
1331
  $(element).find('.awdr-num-validation').css("border", "1px solid red");
1332
  $(element).find('.awdr-num-validation').focus();
1333
- }else{
1334
  $(element).find('.awdr-num-validation').css("border", "1px solid #7e8993");
1335
  }
1336
  break;
@@ -1339,129 +1364,129 @@ jQuery(document).ready(function ($) {
1339
  let from_qty = $(element).find('.cat_from_qty').val();
1340
  let to_qty = $(element).find('.cat_to_qty').val();
1341
  let cat_combination = $(element).find('.cat_combination_operator').val();
1342
- if(!wc_cat){
1343
  condition_array.push("fails");
1344
  $(element).find('.select2-selection').css("border", "1px solid red");
1345
  $(element).find('.select2-selection').focus();
1346
- }else{
1347
  $(element).find('.select2-selection').css("border", "1px solid #7e8993");
1348
  }
1349
- if(cat_combination == 'in_range'){
1350
- if(from_qty == '' && to_qty == ''){
1351
  condition_array.push("fails");
1352
  $(element).find('.cat_from_qty').css("border", "1px solid red");
1353
  $(element).find('.cat_from_qty').focus();
1354
  $(element).find('.cat_to_qty').css("border", "1px solid red");
1355
  $(element).find('.cat_to_qty').focus();
1356
- }else{
1357
  $(element).find('.cat_from_qty').css("border", "1px solid #7e8993");
1358
  $(element).find('.cat_to_qty').css("border", "1px solid #7e8993");
1359
  }
1360
- }else{
1361
- if(from_qty == ''){
1362
  condition_array.push("fails");
1363
  $(element).find('.cat_from_qty').css("border", "1px solid red");
1364
  $(element).find('.cat_from_qty').focus();
1365
- }else{
1366
  $(element).find('.cat_from_qty').css("border", "1px solid #7e8993");
1367
  }
1368
  }
1369
  break;
1370
  case 'order_date':
1371
- let from_date = $(element).find('.awdr-from-date').val();
1372
- let end_date = $(element).find('.awdr-end-date').val();
1373
- if(from_date == '' && end_date == ''){
1374
- condition_array.push("fails");
1375
- $(element).find('.awdr-from-date').css("border", "1px solid red");
1376
- $(element).find('.awdr-from-date').focus();
1377
- $(element).find('.awdr-end-date').css("border", "1px solid red");
1378
- $(element).find('.awdr-end-date').focus();
1379
- }else{
1380
- $(element).find('.awdr-from-date').css("border", "1px solid #7e8993");
1381
- $(element).find('.awdr-end-date').css("border", "1px solid #7e8993");
1382
- }
1383
  break;
1384
  case 'order_date_and_time':
1385
  let from_date_time = $(element).find('.awdr-from-date').val();
1386
  let end_date_time = $(element).find('.awdr-end-date').val();
1387
- if(from_date_time == '' && end_date_time == ''){
1388
  condition_array.push("fails");
1389
  $(element).find('.awdr-from-date').css("border", "1px solid red");
1390
  $(element).find('.awdr-from-date').focus();
1391
  $(element).find('.awdr-end-date').css("border", "1px solid red");
1392
  $(element).find('.awdr-end-date').focus();
1393
- }else{
1394
  $(element).find('.awdr-from-date').css("border", "1px solid #7e8993");
1395
  $(element).find('.awdr-end-date').css("border", "1px solid #7e8993");
1396
  }
1397
  break;
1398
  case 'order_days':
1399
  let order_days = $(element).find('.order_days').val();
1400
- if(!order_days){
1401
  condition_array.push("fails");
1402
  $(element).find('.select2-selection').css("border", "1px solid red");
1403
  $(element).find('.select2-selection').focus();
1404
- }else{
1405
  $(element).find('.select2-selection').css("border", "1px solid #7e8993");
1406
  }
1407
  break;
1408
  case 'order_time':
1409
  let from_time = $(element).find('.wdr-from-time').val();
1410
  let end_time = $(element).find('.wdr-to-time').val();
1411
- if(from_time == '' && end_time == ''){
1412
  condition_array.push("fails");
1413
  $(element).find('.wdr-from-time').css("border", "1px solid red");
1414
  $(element).find('.wdr-from-time').focus();
1415
  $(element).find('.wdr-to-time').css("border", "1px solid red");
1416
  $(element).find('.wdr-to-time').focus();
1417
- }else{
1418
  $(element).find('.wdr-from-time').css("border", "1px solid #7e8993");
1419
  $(element).find('.wdr-to-time').css("border", "1px solid #7e8993");
1420
  }
1421
  break;
1422
  case 'purchase_last_order':
1423
  let last_order = $(element).find('.wdr-wc-order-status').val();
1424
- if(!last_order){
1425
  condition_array.push("fails");
1426
  $(element).find('.select2-selection').css("border", "1px solid red");
1427
  $(element).find('.select2-selection').focus();
1428
- }else{
1429
  $(element).find('.select2-selection').css("border", "1px solid #7e8993");
1430
  }
1431
  break;
1432
  case 'purchase_last_order_amount':
1433
  let last_order_amount_status = $(element).find('.wdr-wc-order-status').val();
1434
  let last_order_amount = $(element).find('.float_only_field').val();
1435
- if(!last_order_amount_status){
1436
  condition_array.push("fails");
1437
  $(element).find('.select2-selection').css("border", "1px solid red");
1438
  $(element).find('.select2-selection').focus();
1439
- }else{
1440
  $(element).find('.select2-selection').css("border", "1px solid #7e8993");
1441
  }
1442
- if(last_order_amount == ''){
1443
  condition_array.push("fails");
1444
  $(element).find('.float_only_field').css("border", "1px solid red");
1445
  $(element).find('.float_only_field').focus();
1446
- }else{
1447
  $(element).find('.float_only_field').css("border", "1px solid #7e8993");
1448
  }
1449
  break;
1450
  case 'purchase_previous_orders':
1451
  let made_order_status = $(element).find('.wdr-wc-order-status').val();
1452
  let made_order_amount = $(element).find('.float_only_field').val();
1453
- if(!made_order_status){
1454
  condition_array.push("fails");
1455
  $(element).find('.select2-selection').css("border", "1px solid red");
1456
  $(element).find('.select2-selection').focus();
1457
- }else{
1458
  $(element).find('.select2-selection').css("border", "1px solid #7e8993");
1459
  }
1460
- if(made_order_amount == ''){
1461
  condition_array.push("fails");
1462
  $(element).find('.float_only_field').css("border", "1px solid red");
1463
  $(element).find('.float_only_field').focus();
1464
- }else{
1465
  $(element).find('.float_only_field').css("border", "1px solid #7e8993");
1466
  }
1467
  break;
@@ -1469,25 +1494,25 @@ jQuery(document).ready(function ($) {
1469
  let made_order_status_for_product = $(element).find('.wdr-wc-order-status').val();
1470
  let made_order_amount_for_product = $(element).find('.float_only_field').val();
1471
  let ordered_product = $(element).find('.specific_product').val();
1472
- if(!ordered_product){
1473
  condition_array.push("fails");
1474
  $(element).find('.wdr-previous-order-product-selector .select2-selection').css("border", "1px solid red");
1475
  $(element).find('.wdr-previous-order-product-selector .select2-selection').focus();
1476
- }else{
1477
  $(element).find('.wdr-previous-order-product-selector .select2-selection').css("border", "1px solid #7e8993");
1478
  }
1479
- if(!made_order_status_for_product){
1480
  condition_array.push("fails");
1481
  $(element).find('.wdr-previous-order-product-status .select2-selection').css("border", "1px solid red");
1482
  $(element).find('.wdr-previous-order-product-status .select2-selection').focus();
1483
- }else{
1484
  $(element).find('.wdr-previous-order-product-status .select2-selection').css("border", "1px solid #7e8993");
1485
  }
1486
- if(made_order_amount_for_product == ''){
1487
  condition_array.push("fails");
1488
  $(element).find('.float_only_field').css("border", "1px solid red");
1489
  $(element).find('.float_only_field').focus();
1490
- }else{
1491
  $(element).find('.float_only_field').css("border", "1px solid #7e8993");
1492
  }
1493
  break;
@@ -1495,25 +1520,25 @@ jQuery(document).ready(function ($) {
1495
  let status_for_product_qty = $(element).find('.wdr-wc-order-status').val();
1496
  let amount_for_product_qty = $(element).find('.float_only_field').val();
1497
  let product_ordered = $(element).find('.specific_product').val();
1498
- if(!product_ordered){
1499
  condition_array.push("fails");
1500
  $(element).find('.wdr-previous-order-product-selector .select2-selection').css("border", "1px solid red");
1501
  $(element).find('.wdr-previous-order-product-selector .select2-selection').focus();
1502
- }else{
1503
  $(element).find('.wdr-previous-order-product-selector .select2-selection').css("border", "1px solid #7e8993");
1504
  }
1505
- if(!status_for_product_qty){
1506
  condition_array.push("fails");
1507
  $(element).find('.wdr-previous-order-product-status .select2-selection').css("border", "1px solid red");
1508
  $(element).find('.wdr-previous-order-product-status .select2-selection').focus();
1509
- }else{
1510
  $(element).find('.wdr-previous-order-product-status .select2-selection').css("border", "1px solid #7e8993");
1511
  }
1512
- if(amount_for_product_qty == ''){
1513
  condition_array.push("fails");
1514
  $(element).find('.float_only_field').css("border", "1px solid red");
1515
  $(element).find('.float_only_field').focus();
1516
- }else{
1517
  $(element).find('.float_only_field').css("border", "1px solid #7e8993");
1518
  }
1519
 
@@ -1521,98 +1546,98 @@ jQuery(document).ready(function ($) {
1521
  case 'purchase_spent':
1522
  let spent_status = $(element).find('.wdr-wc-order-status').val();
1523
  let spent_amount = $(element).find('.float_only_field').val();
1524
- if(!spent_status){
1525
  condition_array.push("fails");
1526
  $(element).find('.select2-selection').css("border", "1px solid red");
1527
  $(element).find('.select2-selection').focus();
1528
- }else{
1529
  $(element).find('.select2-selection').css("border", "1px solid #7e8993");
1530
  }
1531
- if(spent_amount == ''){
1532
  condition_array.push("fails");
1533
  $(element).find('.float_only_field').css("border", "1px solid red");
1534
  $(element).find('.float_only_field').focus();
1535
- }else{
1536
  $(element).find('.float_only_field').css("border", "1px solid #7e8993");
1537
  }
1538
  break;
1539
  case 'shipping_city':
1540
  let shipping_city = $(element).find('.awdr-validation').val();
1541
- if(shipping_city == ''){
1542
  condition_array.push("fails");
1543
  $(element).find('.awdr-validation').css("border", "1px solid red");
1544
  $(element).find('.awdr-validation').focus();
1545
- }else{
1546
  $(element).find('.awdr-validation').css("border", "1px solid #7e8993");
1547
  }
1548
  break;
1549
  case 'shipping_country':
1550
  let shipping_country = $(element).find('.get_awdr_shipping_country').val();
1551
- if(!shipping_country){
1552
  condition_array.push("fails");
1553
  $(element).find('.select2-selection').css("border", "1px solid red");
1554
  $(element).find('.select2-selection').focus();
1555
- }else{
1556
  $(element).find('.select2-selection').css("border", "1px solid #7e8993");
1557
  }
1558
  break;
1559
  case 'shipping_state':
1560
  let shipping_state = $(element).find('.get_awdr_shipping_state').val();
1561
- if(!shipping_state){
1562
  condition_array.push("fails");
1563
  $(element).find('.select2-selection').css("border", "1px solid red");
1564
  $(element).find('.select2-selection').focus();
1565
- }else{
1566
  $(element).find('.select2-selection').css("border", "1px solid #7e8993");
1567
  }
1568
  break;
1569
  case 'shipping_zipcode':
1570
  let shipping_zipcode = $(element).find('.awdr-validation').val();
1571
- if(shipping_zipcode == ''){
1572
  condition_array.push("fails");
1573
  $(element).find('.awdr-validation').css("border", "1px solid red");
1574
  $(element).find('.awdr-validation').focus();
1575
- }else{
1576
  $(element).find('.awdr-validation').css("border", "1px solid #7e8993");
1577
  }
1578
  break;
1579
  case 'Billing_city':
1580
  let Billing_city = $(element).find('.awdr-validation').val();
1581
- if(Billing_city == ''){
1582
  condition_array.push("fails");
1583
  $(element).find('.awdr-validation').css("border", "1px solid red");
1584
  $(element).find('.awdr-validation').focus();
1585
- }else{
1586
  $(element).find('.awdr-validation').css("border", "1px solid #7e8993");
1587
  }
1588
  break;
1589
  case 'user_email':
1590
  let user_email = $(element).find('.awdr-validation').val();
1591
- if(user_email == ''){
1592
  condition_array.push("fails");
1593
  $(element).find('.awdr-validation').css("border", "1px solid red");
1594
  $(element).find('.awdr-validation').focus();
1595
- }else{
1596
  $(element).find('.awdr-validation').css("border", "1px solid #7e8993");
1597
  }
1598
  break;
1599
  case 'user_list':
1600
  let user_list = $(element).find('.wdr_user_list').val();
1601
- if(!user_list){
1602
  condition_array.push("fails");
1603
  $(element).find('.select2-selection').css("border", "1px solid red");
1604
  $(element).find('.select2-selection').focus();
1605
- }else{
1606
  $(element).find('.select2-selection').css("border", "1px solid #7e8993");
1607
  }
1608
  break;
1609
  case 'user_role':
1610
  let user_role = $(element).find('.wdr_user_role').val();
1611
- if(!user_role){
1612
  condition_array.push("fails");
1613
  $(element).find('.select2-selection').css("border", "1px solid red");
1614
  $(element).find('.select2-selection').focus();
1615
- }else{
1616
  $(element).find('.select2-selection').css("border", "1px solid #7e8993");
1617
  }
1618
  break;
@@ -1627,36 +1652,50 @@ jQuery(document).ready(function ($) {
1627
  */
1628
  $('#configuration-form').submit(function (e) {
1629
  e.preventDefault();
1630
- $("#awdr_banner_editor-html").click();
1631
  $("#awdr_banner_editor-tmce").click();
1632
- let awdr_banner_editer = $('#awdr_banner_editor').val();
1633
- $('.customize_banner_content').val(awdr_banner_editer);
1634
  let values = $(this).serialize();
1635
  let loader = $('.woo_discount_loader');
1636
- values += "&banner_content=" + awdr_banner_editer;
1637
  $.ajax({
1638
  data: values,
1639
  type: 'post',
1640
  url: ajaxurl,
1641
- beforeSend: function() {
1642
  loader.show();
1643
  },
1644
- complete: function() {
1645
  loader.hide();
1646
  },
1647
  error: function (request, error) {
1648
  notify(wdr_data.localization_data.error, 'error', alert_counter);
1649
  },
1650
  success: function (response) {
1651
- if (response.data.save_popup == "alert_in_popup") {
1652
  $('.awdr-save-green').show();
1653
  setTimeout(
1654
  function () {
1655
  $('.awdr-save-green').fadeOut(500);
1656
- }, 2500
 
1657
  );
1658
- } else if (response.data.save_popup == "alert_in_normal") {
1659
  notify(wdr_data.localization_data.save_settings, 'success', alert_counter);
 
 
 
 
 
 
 
 
 
 
 
 
 
1660
  }
1661
  }
1662
  });
@@ -1693,7 +1732,7 @@ jQuery(document).ready(function ($) {
1693
  */
1694
  $('#wdr-bulk-action-top').submit(function (e) {
1695
  e.preventDefault();
1696
- if($('input[name="saved_rules[]"]:checked').length > 0) {
1697
  let action = $('#bulk-action-selector-top').val();
1698
  let result;
1699
  if (action == 'enable') {
@@ -1708,7 +1747,7 @@ jQuery(document).ready(function ($) {
1708
  if (result == false) {
1709
  return false;
1710
  }
1711
- }else{
1712
  return false;
1713
  }
1714
  let loader = $('.woo_discount_loader');
@@ -1716,10 +1755,10 @@ jQuery(document).ready(function ($) {
1716
  data: $(this).serialize(),
1717
  type: 'post',
1718
  url: ajaxurl,
1719
- beforeSend: function() {
1720
  loader.show();
1721
  },
1722
- complete: function() {
1723
  loader.hide();
1724
  },
1725
  error: function (request, error) {
@@ -1866,7 +1905,7 @@ jQuery(document).ready(function ($) {
1866
  function () {
1867
  message_div.fadeOut(500);
1868
  message_div.remove();
1869
- }, 2500
1870
  );
1871
  }
1872
 
@@ -2214,7 +2253,7 @@ jQuery(document).ready(function ($) {
2214
  $(this).parents('.awdr_bogo_main').siblings('.' + hide_if_recursive).show();
2215
  $(this).parents('.' + get_recursive_parent).siblings('.' + bogo_max_range).show();
2216
  $(this).parents('.' + get_recursive_parent).siblings().find('.' + bogo_max_range).show();
2217
- // $('.'+bogo_max_range).show();
2218
  $(this).parents('.' + get_recursive_parent).siblings('.' + bogo_min_range).find('.wdr_desc_text').text(wdr_data.localization_data.recursive_min_qty);
2219
  $('.' + bogo_border_bottom).css("border-bottom", "1px solid #ddd");
2220
  return;
@@ -2240,26 +2279,26 @@ jQuery(document).ready(function ($) {
2240
  $(document).on('change', '.awdr_mode_of_operator', function () {
2241
  let mode_of_operator = $(this).val();
2242
  let discount_type = $('.awdr-product-discount-type').val();
2243
- if(discount_type == 'wdr_buy_x_get_y_discount'){
2244
- if(mode_of_operator == "variation"){
2245
  $('.awdr-bxgy-dynamic-tip').attr("title", wdr_data.localization_data.bulk_variants_discount_description_tool_tip);
2246
  $('.awdr-example').html(wdr_data.localization_data.mode_variation_cumulative_example);
2247
- }else if(mode_of_operator == "product"){
2248
  $('.awdr-bxgy-dynamic-tip').attr("title", wdr_data.localization_data.bulk_individual_product_discount_description_tool_tip);
2249
  $('.awdr-example').html('');
2250
- }else{
2251
  $('.awdr-bxgy-dynamic-tip').attr("title", wdr_data.localization_data.bulk_filter_together_discount_description_tool_tip);
2252
  $('.awdr-example').html('');
2253
  }
2254
  return;
2255
  }
2256
- if(mode_of_operator == "variation"){
2257
  $('.awdr-discount-content').html(wdr_data.localization_data.bulk_variants_discount_description);
2258
  $('.awdr-example').html(wdr_data.localization_data.mode_variation_cumulative_example);
2259
- }else if(mode_of_operator == "product"){
2260
  $('.awdr-discount-content').html(wdr_data.localization_data.bulk_individual_product_discount_description);
2261
  $('.awdr-example').html('');
2262
- }else{
2263
  $('.awdr-discount-content').html(wdr_data.localization_data.bulk_filter_together_discount_description);
2264
  $('.awdr-example').html('');
2265
  }
@@ -2270,33 +2309,33 @@ jQuery(document).ready(function ($) {
2270
  var data_placement = $(this).data('placement');
2271
  let discount_type = $(this).val();
2272
  let read_doc_prefix = 'awdr_doc_';
2273
- switch(discount_type){
2274
  case 'wdr_simple_discount':
2275
- $('.'+read_doc_prefix+discount_type).show();
2276
  $('.awdr_doc_wdr_cart_discount,.awdr_doc_wdr_free_shipping,.awdr_doc_wdr_bulk_discount,.awdr_doc_wdr_set_discount,.awdr_doc_wdr_buy_x_get_x_discount,.awdr_doc_wdr_buy_x_get_y_discount').hide();
2277
  break;
2278
  case 'wdr_cart_discount':
2279
- $('.'+read_doc_prefix+discount_type).show();
2280
  $('.awdr_doc_wdr_simple_discount,.awdr_doc_wdr_free_shipping,.awdr_doc_wdr_bulk_discount,.awdr_doc_wdr_set_discount,.awdr_doc_wdr_buy_x_get_x_discount,.awdr_doc_wdr_buy_x_get_y_discount').hide();
2281
  break;
2282
  case 'wdr_free_shipping':
2283
- $('.'+read_doc_prefix+discount_type).show();
2284
  $('.awdr_doc_wdr_simple_discount,.awdr_doc_wdr_cart_discount,.awdr_doc_wdr_bulk_discount,.awdr_doc_wdr_set_discount,.awdr_doc_wdr_buy_x_get_x_discount,.awdr_doc_wdr_buy_x_get_y_discount').hide();
2285
  break;
2286
  case 'wdr_bulk_discount':
2287
- $('.'+read_doc_prefix+discount_type).show();
2288
  $('.awdr_doc_wdr_simple_discount,.awdr_doc_wdr_cart_discount,.awdr_doc_wdr_free_shipping,.awdr_doc_wdr_set_discount,.awdr_doc_wdr_buy_x_get_x_discount,.awdr_doc_wdr_buy_x_get_y_discount').hide();
2289
- break;
2290
  case 'wdr_set_discount':
2291
- $('.'+read_doc_prefix+discount_type).show();
2292
  $('.awdr_doc_wdr_simple_discount,.awdr_doc_wdr_cart_discount,.awdr_doc_wdr_free_shipping,.awdr_doc_wdr_bulk_discount,.awdr_doc_wdr_buy_x_get_x_discount,.awdr_doc_wdr_buy_x_get_y_discount').hide();
2293
  break;
2294
  case 'wdr_buy_x_get_x_discount':
2295
- $('.'+read_doc_prefix+discount_type).show();
2296
  $('.awdr_doc_wdr_simple_discount,.awdr_doc_wdr_cart_discount,.awdr_doc_wdr_free_shipping,.awdr_doc_wdr_bulk_discount,.awdr_doc_wdr_set_discount,.awdr_doc_wdr_buy_x_get_y_discount').hide();
2297
  break;
2298
  case 'wdr_buy_x_get_y_discount':
2299
- $('.'+read_doc_prefix+discount_type).show();
2300
  $('.awdr_doc_wdr_simple_discount,.awdr_doc_wdr_cart_discount,.awdr_doc_wdr_free_shipping,.awdr_doc_wdr_bulk_discount,.awdr_doc_wdr_set_discount,.awdr_doc_wdr_buy_x_get_x_discount').hide();
2301
  break
2302
  default:
@@ -2310,7 +2349,7 @@ jQuery(document).ready(function ($) {
2310
  ruleAppendTo: '.' + data_placement,
2311
  addDiscountType: 'enable',
2312
  });
2313
- if(!$(".awdr-free-shipping-special-condition").hasClass("wdr-hide")){
2314
  $('.awdr-free-shipping-special-condition').addClass('wdr-hide');
2315
  }
2316
  awdrRemoveOnSaleCondition();
@@ -2332,26 +2371,26 @@ jQuery(document).ready(function ($) {
2332
  $('.awdr-discount-content').html(wdr_data.localization_data.common_discount_description);
2333
  $('.awdr-rules-content').html(wdr_data.localization_data.common_rules_description);
2334
 
2335
- if($(this).val() == 'wdr_buy_x_get_y_discount'){
2336
- if(!$(".awdr-free-shipping-special-condition").hasClass("wdr-hide")){
2337
  $('.awdr-free-shipping-special-condition').addClass('wdr-hide');
2338
  }
2339
  awdrRemoveOnSaleCondition();
2340
  //$('.awdr_mode_of_operator').trigger('change');
2341
  console.log('yes');
2342
  $('.awdr-discount-heading').html(wdr_data.localization_data.two_column_bxgy_discount_heading);
2343
- make_wdr_select2_search($('.' + data_placement ).find('[data-list="product_category"]'));
2344
  $('.adv-msg-min-qty, .adv-msg-max-qty, .adv-msg-discount, .adv-msg-discount-price').hide();
2345
  }
2346
- if($(this).val() == 'wdr_buy_x_get_x_discount'){
2347
- if(!$(".awdr-free-shipping-special-condition").hasClass("wdr-hide")){
2348
  $('.awdr-free-shipping-special-condition').addClass('wdr-hide');
2349
  }
2350
  awdrRemoveOnSaleCondition();
2351
  $('.adv-msg-min-qty, .adv-msg-max-qty, .adv-msg-discount, .adv-msg-discount-price').hide();
2352
  }
2353
  if ($(this).val() == 'wdr_bulk_discount') {
2354
- if(!$(".awdr-free-shipping-special-condition").hasClass("wdr-hide")){
2355
  $('.awdr-free-shipping-special-condition').addClass('wdr-hide');
2356
  }
2357
  awdrRemoveOnSaleCondition();
@@ -2359,7 +2398,7 @@ jQuery(document).ready(function ($) {
2359
  $('.awdr_mode_of_operator').trigger('change');
2360
  $('.adv-msg-min-qty, .adv-msg-max-qty, .adv-msg-discount, .adv-msg-discount-price').show();
2361
  } else if ($(this).val() == 'wdr_set_discount') {
2362
- if(!$(".awdr-free-shipping-special-condition").hasClass("wdr-hide")){
2363
  $('.awdr-free-shipping-special-condition').addClass('wdr-hide');
2364
  }
2365
  awdrRemoveOnSaleCondition();
@@ -2378,7 +2417,7 @@ jQuery(document).ready(function ($) {
2378
  $('.adv-msg-min-qty, .adv-msg-max-qty, .adv-msg-discount, .adv-msg-discount-price').hide();
2379
  $(".calculate_cart_from option[value='from_filter']").hide();
2380
  } else {
2381
- if(!$(".awdr-free-shipping-special-condition").hasClass("wdr-hide")){
2382
  $('.awdr-free-shipping-special-condition').addClass('wdr-hide');
2383
  }
2384
  awdrRemoveOnSaleCondition();
@@ -2391,7 +2430,7 @@ jQuery(document).ready(function ($) {
2391
  $(".awdr-product-discount-type").trigger('change');
2392
 
2393
  function awdrRemoveOnSaleCondition() {
2394
- $('.wdr-condition-group').each(function (index,element) {
2395
  let condition_type = $(element).find('.wdr-product-condition-type').val();
2396
  if (typeof condition_type !== 'undefined') {
2397
  switch (condition_type) {
@@ -2402,6 +2441,7 @@ jQuery(document).ready(function ($) {
2402
  }
2403
  });
2404
  }
 
2405
  if (wdr_data.rule_id == "view") {
2406
  $("button.wdr_save_stay, button.wdr_save_close").attr("disabled", false).removeClass("wdr_save_btn_disabled");
2407
  } else {
@@ -2443,40 +2483,40 @@ jQuery(document).ready(function ($) {
2443
  });
2444
  }
2445
  $(document).on('change', '.on_sale_badge_condition', function () {
2446
- if($(this).val() === 'disabled'){
2447
  $('.sale_badge_toggle').hide();
2448
  $('.sale_badge_customizer').hide();
2449
- }else{
2450
  $('.sale_badge_toggle').show();
2451
- if($('#customize_on_sale_badge').prop("checked") == true){
2452
  $('.sale_badge_customizer').show();
2453
- }else{
2454
  $('.sale_badge_customizer').hide();
2455
  }
2456
  }
2457
  });
2458
  $(document).on('change', '#customize_on_sale_badge', function () {
2459
- if($(this).prop("checked") == true){
2460
  $('.sale_badge_customizer').show();
2461
- }else{
2462
  $('.sale_badge_customizer').hide();
2463
  }
2464
  });
2465
  $(document).on('change', '#badge_colorpicker', function () {
2466
  let background_color = $(this).val();
2467
- $('.awdr_admin_discount_bar').css('background-color',background_color);
2468
  });
2469
  $(document).on('change', '#badge_hexcolor', function () {
2470
  let background_color = $(this).val();
2471
- $('.awdr_admin_discount_bar').css('background-color',background_color);
2472
  });
2473
  $(document).on('change', '#text_colorpicker', function () {
2474
  let text_color = $(this).val();
2475
- $('.awdr_admin_discount_bar').css('color',text_color);
2476
  });
2477
  $(document).on('change', '#text_hexcolor', function () {
2478
  let text_color = $(this).val();
2479
- $('.awdr_admin_discount_bar').css('color',text_color);
2480
  });
2481
  $(document).on('change', '#awdr_discount_bar_content', function () {
2482
  let discount_bar_content = $(this).val();
@@ -2493,24 +2533,24 @@ jQuery(document).ready(function ($) {
2493
  * Rule limit dynamic message
2494
  */
2495
  $(document).on('change', '#select_usage_limits', function () {
2496
- let selected_limit = $( "#select_usage_limits option:selected" ).text();
2497
- if( selected_limit == "Unlimited"){
2498
  $('.usage-limits-display').hide();
2499
  $('.awdr-rule-limit-disabled-outer .rule_limit_msg_outer').hide();
2500
  $('.awdr-rule-limit-disabled').hide();
2501
- }else{
2502
  $('.usage-limits-display').show();
2503
  var rule_applied_total = $('.awdr-used-limit-total').html();
2504
- if(selected_limit <= parseInt(rule_applied_total)){
2505
  $('.awdr-rule-limit-disabled').hide();
2506
  $('.awdr-rule-limit-disabled-outer').show();
2507
  $('.awdr-rule-limit-disabled-outer .rule_limit_msg_outer').html(wdr_data.localization_data.invalid_rule_limit);
2508
- }else{
2509
  $('.awdr-rule-limit-disabled').hide();
2510
  $('.awdr-rule-limit-disabled-outer').hide();
2511
  }
2512
  }
2513
- // awdrRuleDateValidationMessage();
2514
  });
2515
 
2516
  /**
54
  newIndex: last_index
55
  });
56
  //
57
+ switch (current_block) {
58
  case "products":
59
+ $('.wdr-filter-group[data-index="' + last_index + '"]').append('<div class="wdr_filter_desc_text">' + wdr_data.localization_data.filter_products + '</div>');
60
  break;
61
  case "product_category":
62
+ $('.wdr-filter-group[data-index="' + last_index + '"]').append('<div class="wdr_filter_desc_text">' + wdr_data.localization_data.filter_Category + '</div>');
63
  break;
64
  case "product_attributes":
65
+ $('.wdr-filter-group[data-index="' + last_index + '"]').append('<div class="wdr_filter_desc_text">' + wdr_data.localization_data.filter_Attributes + '</div>');
66
  break;
67
  case "product_tags":
68
+ $('.wdr-filter-group[data-index="' + last_index + '"]').append('<div class="wdr_filter_desc_text">' + wdr_data.localization_data.filter_Tags + '</div>');
69
  break;
70
  case "product_sku":
71
+ $('.wdr-filter-group[data-index="' + last_index + '"]').append('<div class="wdr_filter_desc_text">' + wdr_data.localization_data.filter_SKUs + '</div>');
72
  break;
73
  case "product_on_sale":
74
+ $('.wdr-filter-group[data-index="' + last_index + '"]').append('<div class="wdr_filter_desc_text">' + wdr_data.localization_data.filter_On_sale_products + '</div>');
75
  break;
76
  case "all_products":
77
+ $('.wdr-filter-group[data-index="' + last_index + '"]').append('<div class="wdr_filter_desc_text">' + wdr_data.localization_data.filter_all_products + '</div>');
78
  break;
79
  default:
80
+ $('.wdr-filter-group[data-index="' + last_index + '"]').append('<div class="wdr_filter_desc_text">' + wdr_data.localization_data.filter_custom_taxonomies + '</div>');
81
  break;
82
 
83
  }
108
  newIndex: last_index
109
  });
110
 
111
+ if (wdr_data.enable_subtotal_promo_text == '1') {
112
  wdr_buildrule.wdr_clone_field({
113
  addConditionType: 'empty-promo',
114
  addFilterMethod: '.wdr-subtotal-promo-messeage-main',
121
 
122
  $(document).on('change', '.subtotal_operator', function () {
123
  // alert($(this).val());
124
+ if (wdr_data.enable_subtotal_promo_text == '1') {
125
  let subtotal_operator = $(this).val();
126
  let current_promo_index = $(this).parents('.wdr-conditions-container').attr("data-index");
127
  if (subtotal_operator == 'greater_than_or_equal' || subtotal_operator == 'greater_than') {
139
  parentsRow: ".wdr-conditions-container",
140
  thisObject: this,
141
  });
142
+ if (wdr_data.enable_subtotal_promo_text == '1') {
143
  let condition_type = $(this).parent('.wdr-btn-remove').siblings('.wdr-condition-type').find('.wdr-product-condition-type').val();
144
  if (condition_type == 'cart_subtotal') {
145
  let promo_index = $(this).parents('.wdr-conditions-container').attr("data-index");
168
  datepicker: false,
169
  format: 'H:i'
170
  });
171
+ } else if (current_block != 'cart_subtotal') {
172
  let promo_index = $(this).parents('.wdr-conditions-container').attr("data-index");
173
  $('.promo_show_hide_' + promo_index).remove();
174
+ } else if (current_block == 'cart_subtotal') {
175
+ if (wdr_data.enable_subtotal_promo_text == '1') {
176
  wdr_buildrule.wdr_clone_field({
177
  addConditionType: 'empty-promo',
178
  addFilterMethod: '.wdr-subtotal-promo-messeage-main',
275
  $('.' + show_discount_content).show();
276
  });
277
 
278
+ function awdr_process_v1_to_v2_migration(awdr_nonce) {
279
  $.ajax({
280
  data: {method: 'do_v1_v2_migration', action: 'wdr_ajax', awdr_nonce: awdr_nonce},
281
  type: 'post',
284
  notify(wdr_data.localization_data.error, 'error', alert_counter);
285
  },
286
  success: function (data) {
287
+ if (data.data.status != undefined) {
288
+ if (data.data.status == "completed") {
289
  notify(wdr_data.localization_data.processing_migration_success_message, 'success', alert_counter);
290
  location.reload();
291
  } else {
305
  $(document).on('click', '#awdr_rebuild_on_sale_list', function () {
306
  var rules = $("#awdr_rebuild_on_sale_rules").val();
307
  $(".awdr_rebuild_on_sale_list_notice").html("");
308
+ if (rules != null) {
309
  $("#awdr_rebuild_on_sale_list").attr('disabled', "disabled");
310
  $("#awdr_rebuild_on_sale_list").html(wdr_data.localization_data.rebuild_on_sale_list_processing_text);
311
  awdr_process_on_sale_list(rules, $(this));
324
  //$(".awdr_rebuild_on_sale_rule_page_con").removeClass("need_attention");
325
  });
326
 
327
+ function awdr_process_on_sale_list(rules, current_obj) {
328
  $.ajax({
329
+ data: {
330
+ method: 'rebuild_onsale_list',
331
+ action: 'wdr_ajax',
332
+ rules: rules,
333
+ awdr_nonce: current_obj.attr('data-awdr_nonce')
334
+ },
335
  type: 'post',
336
  url: ajaxurl,
337
  error: function (request, error) {
368
  success: function (data) {
369
  if (data === 'failed') {
370
  notify(wdr_data.localization_data.error, 'error', alert_counter);
371
+ } else if (data.data === true) {
372
  $(".wdr_migration_process").append(wdr_data.localization_data.skip_migration_success_message);
373
  notify(wdr_data.localization_data.skip_migration_success_message, 'success', alert_counter);
374
  }
386
  type: 'POST',
387
  data: {action: 'awdr_switch_version', version: version, page: page},
388
  success: function (data) {
389
+ if (data.data.status == true) {
390
  window.location.replace(data.data.url);
391
  }
392
  $(".wdr_switch_message").html(data.data.message);
400
  $(document).on('click', '.wdr_duplicate_rule', function () {
401
  let loader = $('.woo_discount_loader');
402
  $.ajax({
403
+ data: {
404
+ rowid: $(this).data('duplicate-rule'),
405
+ awdr_nonce: $(this).data('awdr_nonce'),
406
+ method: 'duplicate_rule',
407
+ action: 'wdr_ajax'
408
+ },
409
  type: 'post',
410
  url: ajaxurl,
411
+ beforeSend: function () {
412
  loader.show();
413
  },
414
+ complete: function () {
415
  loader.hide();
416
  },
417
  error: function (request, error) {
436
  if (confirm(wdr_data.localization_data.delete_confirm)) {
437
  let loader = $('.woo_discount_loader');
438
  $.ajax({
439
+ data: {
440
+ rowid: $(this).data('delete-rule'),
441
+ awdr_nonce: $(this).data('awdr_nonce'),
442
+ method: 'delete_rule',
443
+ action: 'wdr_ajax'
444
+ },
445
  type: 'post',
446
  url: ajaxurl,
447
+ beforeSend: function () {
448
  loader.show();
449
  },
450
+ complete: function () {
451
  loader.hide();
452
  },
453
  error: function (request, error) {
489
  },
490
  type: 'post',
491
  url: ajaxurl,
492
+ beforeSend: function () {
493
  loader.show();
494
  },
495
+ complete: function () {
496
  loader.hide();
497
  },
498
  error: function (request, error) {
530
  noResults: function () {
531
  return wdr_data.labels.select2_no_results;
532
  },
533
+ errorLoading: function () {
534
  /* Workaround for https://github.com/select2/select2/issues/4355 instead of i18n_ajax_error.*/
535
  return wdr_data.labels.searching_text;
536
  }
545
  query: params.term,
546
  action: 'wdr_ajax',
547
  method: $el.data('list') || 'products',
548
+ awdr_nonce: $('input[name=wdr_ajax_select2]').val() || '',
549
  taxonomy: $el.data('taxonomy') || '',
550
  selected: $el.val()
551
  };
768
  */
769
  $('#wdr-save-rule').submit(function (e) {
770
  e.preventDefault();
771
+ let validation = woo_discount_rule_validation($(this));
772
+ if (!validation) {
773
  return false;
774
  }
775
  let loader = $('.woo_discount_loader');
778
  data: $(this).serialize(),
779
  type: 'post',
780
  url: ajaxurl,
781
+ beforeSend: function () {
782
  loader.show();
783
  },
784
+ complete: function () {
785
  loader.hide();
786
  },
787
  error: function (request, error) {
788
  notify(wdr_data.localization_data.error, 'error', alert_counter);
789
  },
790
+ success: function (response) {
791
+ var data = response.data;
792
+ if (response.success) {
793
+ if (data.build_index != undefined) {
794
+ if (data.build_index.required_rebuild != undefined) {
795
+ if (data.build_index.required_rebuild == true) {
796
+ $(".awdr_rebuild_on_sale_rule_page_con").addClass("need_attention");
797
+ }
798
  }
799
  }
800
+ if (data.redirect) {
801
+ window.location.href = data.redirect;
802
+ notify(wdr_data.localization_data.save_rule, 'success', alert_counter);
803
+ } else if (data.coupon_message) {
804
+ $(".coupon_name_msg").css("border", "1px solid #FF0000").focus();
805
+ notify(wdr_data.localization_data.coupon_exists, 'error', alert_counter);
806
+ } else {
807
+ $('.wdr_desc_text.coupon_error_msg').hide();
808
+ $(".coupon_name_msg").css("border", "");
809
+ notify(wdr_data.localization_data.save_rule, 'success', alert_counter);
810
+ }
811
  } else {
812
+ for (const [key, value] of Object.entries(data)) {
813
+ if (data.hasOwnProperty(key)) {
814
+ value.forEach(function(message){
815
+ notify(message, 'error',alert_counter);
816
+ });
817
+ }
818
+ }
819
  }
 
820
  }
821
  });
822
  });
834
  * @param form
835
  * @returns {boolean}
836
  */
837
+ function woo_discount_rule_validation(form) {
838
+ let discount_type = $('.awdr-product-discount-type').val();
839
+ let wdr_filter_validations = [];
840
+ let wdr_discount_validations = [];
841
+ let wdr_condition_validations = [];
842
+ switch (discount_type) {
843
+ case 'wdr_simple_discount':
844
+ wdr_filter_validations = wdr_filter_validation();
845
+ wdr_discount_validations = wdr_discount_validation(discount_type);
846
+ wdr_condition_validations = wdr_condition_validation();
847
+ break;
848
+ case 'wdr_cart_discount':
849
+ wdr_filter_validations = wdr_filter_validation();
850
+ wdr_discount_validations = wdr_discount_validation(discount_type);
851
+ wdr_condition_validations = wdr_condition_validation();
852
+ break;
853
+ case 'wdr_free_shipping':
854
+ wdr_condition_validations = wdr_condition_validation();
855
+ break;
856
+ case 'wdr_bulk_discount':
857
+ wdr_filter_validations = wdr_filter_validation();
858
+ wdr_discount_validations = wdr_discount_validation(discount_type);
859
+ wdr_condition_validations = wdr_condition_validation();
860
+ break;
861
+ case 'wdr_set_discount':
862
+ wdr_filter_validations = wdr_filter_validation();
863
+ wdr_discount_validations = wdr_discount_validation(discount_type);
864
+ wdr_condition_validations = wdr_condition_validation();
865
+ break;
866
+ case 'wdr_buy_x_get_x_discount':
867
+ wdr_filter_validations = wdr_filter_validation();
868
+ wdr_discount_validations = wdr_discount_validation(discount_type);
869
+ wdr_condition_validations = wdr_condition_validation();
870
+ break;
871
+ case 'wdr_buy_x_get_y_discount':
872
+ wdr_filter_validations = wdr_filter_validation();
873
+ wdr_discount_validations = wdr_discount_validation(discount_type);
874
+ wdr_condition_validations = wdr_condition_validation();
875
+ break
876
+ default:
877
+ case 'not_selected':
878
+ break;
879
+ }
880
+ if (wdr_filter_validations.indexOf("fails") !== -1) {
881
+ return false;
882
+ }
883
+ if (wdr_discount_validations.indexOf("fails") !== -1) {
884
+ return false;
885
+ }
886
+ if (wdr_condition_validations.indexOf("fails") !== -1) {
887
+ return false;
888
+ }
889
+ return true;
890
  }
891
 
892
  /**
893
  * Validate Filter section
894
  * @returns {[]}
895
  */
896
+ function wdr_filter_validation() {
897
+ let filter_array = [];
898
+ $('.wdr-filter-group').each(function (index, element) {
899
  let product_filter = $(element).find('.wdr-product-filter-type').val();
900
  let product_filter_val = $(element).find('.awdr_validation').val();
901
  switch (product_filter) {
902
  case 'all_products':
903
  break;
904
  case 'products':
905
+ if (!product_filter_val) {
906
  filter_array.push("fails");
907
  $(element).find('.select2-selection').css("border", "1px solid red");
908
  $(element).find('.select2-selection').focus();
909
+ } else {
910
  $(element).find('.select2-selection').css("border", "1px solid #7e8993");
911
  }
912
  break;
913
  case 'product_category':
914
+ if (!product_filter_val) {
915
  filter_array.push("fails");
916
  $(element).find('.select2-selection').css("border", "1px solid red");
917
  $(element).find('.select2-selection').focus();
918
+ } else {
919
  $(element).find('.select2-selection').css("border", "1px solid #7e8993");
920
  }
921
  break;
922
  case 'product_attributes':
923
+ if (!product_filter_val) {
924
  filter_array.push("fails");
925
  $(element).find('.select2-selection').css("border", "1px solid red");
926
  $(element).find('.select2-selection').focus();
927
+ } else {
928
  $(element).find('.select2-selection').css("border", "1px solid #7e8993");
929
  }
930
  break;
931
  case 'product_tags':
932
+ if (!product_filter_val) {
933
  filter_array.push("fails");
934
  $(element).find('.select2-selection').css("border", "1px solid red");
935
  $(element).find('.select2-selection').focus();
936
+ } else {
937
  $(element).find('.select2-selection').css("border", "1px solid #7e8993");
938
  }
939
  break;
940
  case 'product_sku':
941
+ if (!product_filter_val) {
942
  filter_array.push("fails");
943
  $(element).find('.select2-selection').css("border", "1px solid red");
944
  $(element).find('.select2-selection').focus();
945
+ } else {
946
  $(element).find('.select2-selection').css("border", "1px solid #7e8993");
947
  }
948
  break;
949
  case 'product_on_sale':
950
  break;
951
  default:
952
+ if (!product_filter_val) {
953
  filter_array.push("fails");
954
  $(element).find('.select2-selection').css("border", "1px solid red");
955
  $(element).find('.select2-selection').focus();
956
+ } else {
957
  $(element).find('.select2-selection').css("border", "1px solid #7e8993");
958
  }
959
  break;
967
  * @param discount_type
968
  * @returns {[]}
969
  */
970
+ function wdr_discount_validation(discount_type) {
971
  let discount_array = [];
972
+ switch (discount_type) {
973
  case 'wdr_simple_discount':
974
  let product_discount = $('.product_discount_value').val();
975
+ if (product_discount == '' || !product_discount) {
976
  discount_array.push("fails");
977
  $('.product_discount_value').css("border", "1px solid red");
978
  $('.product_discount_value').focus();
979
+ } else {
980
  $('.product_discount_value').css("border", "1px solid #7e8993");
981
  }
982
  break;
983
  case 'wdr_cart_discount':
984
  let cart_discount = $('.awdr_cart_discount_value').val();
985
+ if (cart_discount == '' || !cart_discount) {
986
  discount_array.push("fails");
987
  $('.awdr_cart_discount_value').css("border", "1px solid red");
988
  $('.awdr_cart_discount_value').focus();
989
+ } else {
990
  $('.awdr_cart_discount_value').css("border", "1px solid #7e8993");
991
  }
992
  break;
993
  case 'wdr_free_shipping':
994
  break;
995
  case 'wdr_bulk_discount':
996
+ $('.bulk_range_setter').find('.awdr-bulk-group').each(function (index, element) {
997
+ let min_qty = $(element).find('.bulk_discount_min').val();
998
+ let max_qty = $(element).find('.bulk_discount_max').val();
999
+ let max_val = $(element).find('.bulk_discount_value').val();
1000
+ if (min_qty == '' && max_qty == '') {
1001
  discount_array.push("fails");
1002
  $(element).find('.bulk_discount_min').css("border", "1px solid red");
1003
  $(element).find('.bulk_discount_min').focus();
1004
  $(element).find('.bulk_discount_max').css("border", "1px solid red");
1005
  $(element).find('.bulk_discount_max').focus();
1006
+ } else {
1007
  $(element).find('.bulk_discount_min').css("border", "1px solid #7e8993");
1008
  $(element).find('.bulk_discount_max').css("border", "1px solid #7e8993");
1009
  }
1010
+ if (max_val == '') {
1011
  discount_array.push("fails");
1012
  $(element).find('.bulk_discount_value').css("border", "1px solid red");
1013
  $(element).find('.bulk_discount_value').focus();
1014
+ } else {
1015
  $(element).find('.bulk_discount_value').css("border", "1px solid #7e8993");
1016
  }
1017
  });
1018
  break;
1019
  case 'wdr_set_discount':
1020
+ $('.set_range_setter').find('.awdr-set-group').each(function (index, element) {
1021
+ let min_qty = $(element).find('.set_discount_min').val();
1022
+ let max_val = $(element).find('.set_discount_value').val();
1023
+ if (min_qty == '') {
1024
  discount_array.push("fails");
1025
  $(element).find('.set_discount_min').css("border", "1px solid red");
1026
  $(element).find('.set_discount_min').focus();
1027
+ } else {
1028
  $(element).find('.set_discount_min').css("border", "1px solid #7e8993");
1029
  }
1030
+ if (max_val == '') {
1031
  discount_array.push("fails");
1032
  $(element).find('.set_discount_value').css("border", "1px solid red");
1033
  $(element).find('.set_discount_value').focus();
1034
+ } else {
1035
  $(element).find('.set_discount_value').css("border", "1px solid #7e8993");
1036
  }
1037
  });
1038
  break;
1039
  case 'wdr_buy_x_get_x_discount':
1040
+ $('.buyx_getx_range_setter').find('.buyx_getx_individual_range').each(function (index, element) {
1041
+ let min_qty = $(element).find('.bxgx-min').val();
1042
+ let max_qty = $(element).find('.bxgx-max').val();
1043
+ let free_qty = $(element).find('.bxgx-qty').val();
1044
+ let select_type = $(element).find('.buyx_getx_discount_select').val();
1045
+ let max_val = $(element).find('.bxgx-value').val();
1046
+ if ($(element).find('.awdr-bogo-recurcive').prop("checked") == true) {
1047
+ if (min_qty == '') {
1048
  discount_array.push("fails");
1049
  $(element).find('.bxgx-min').css("border", "1px solid red");
1050
  $(element).find('.bxgx-min').focus();
1051
+ } else {
1052
  $(element).find('.bxgx-min').css("border", "1px solid #7e8993");
1053
  }
1054
  }
1055
+ if (min_qty == '' && max_qty == '') {
1056
  discount_array.push("fails");
1057
  $(element).find('.bxgx-min').css("border", "1px solid red");
1058
  $(element).find('.bxgx-min').focus();
1059
  $(element).find('.bxgx-max').css("border", "1px solid red");
1060
  $(element).find('.bxgx-max').focus();
1061
+ } else {
1062
  $(element).find('.bxgx-min').css("border", "1px solid #7e8993");
1063
  $(element).find('.bxgx-max').css("border", "1px solid #7e8993");
1064
  }
1065
+ if (free_qty == '') {
1066
  discount_array.push("fails");
1067
  $(element).find('.bxgx-qty').css("border", "1px solid red");
1068
  $(element).find('.bxgx-qty').focus();
1069
+ } else {
1070
  $(element).find('.bxgx-qty').css("border", "1px solid #7e8993");
1071
  }
1072
 
1073
+ if (select_type != 'free_product' && max_val == '') {
1074
  discount_array.push("fails");
1075
  $(element).find('.bxgx-value').css("border", "1px solid red");
1076
  $(element).find('.bxgx-value').focus();
1077
+ } else {
1078
  $(element).find('.bxgx-value').css("border", "1px solid #7e8993");
1079
  }
1080
  });
1081
  break;
1082
  case 'wdr_buy_x_get_y_discount':
1083
+ let bxgy_type = $('.select_bxgy_type').val();
1084
+ $('.awdr_buyx_gety_range_setter').find('.buyx_gety_individual_range').each(function (index, element) {
1085
+ let min_qty = $(element).find('.bxgy-min').val();
1086
+ let max_qty = $(element).find('.bxgy-max').val();
1087
+ let product_qty = $(element).find('.bxgy-product-selector').val();
1088
+ let category_qty = $(element).find('.bxgy-category-selector').val();
1089
+ let free_qty = $(element).find('.bxgy-qty').val();
1090
+ let select_type = $(element).find('.buyx_gety_discount_select').val();
1091
+ let max_val = $(element).find('.bxgy-val').val();
1092
+
1093
+ if (bxgy_type == 'bxgy_product') {
1094
+ if (!product_qty) {
1095
  discount_array.push("fails");
1096
  $(element).find('.select2-selection').css("border", "1px solid red");
1097
  $(element).find('.select2-selection').focus();
1098
+ } else {
1099
  $(element).find('.select2-selection').css("border", "1px solid #7e8993");
1100
  }
1101
+ } else if (bxgy_type == 'bxgy_category') {
1102
+ if (!category_qty) {
1103
  discount_array.push("fails");
1104
  $(element).find('.select2-selection').css("border", "1px solid red");
1105
  $(element).find('.select2-selection').focus();
1106
+ } else {
1107
  $(element).find('.select2-selection').css("border", "1px solid #7e8993");
1108
  }
1109
+ } else if (bxgy_type == '0' || !bxgy_type) {
1110
  discount_array.push("fails");
1111
  $('.select_bxgy_type').css("border", "1px solid red");
1112
  $('.select_bxgy_type').focus();
1113
+ } else {
1114
  $('.select_bxgy_type').css("border", "1px solid #7e8993");
1115
  }
1116
 
1117
+ if ($(element).find('.awdr-bogo-recurcive').prop("checked") == true) {
1118
+ if (min_qty == '') {
1119
  discount_array.push("fails");
1120
  $(element).find('.bxgy-min').css("border", "1px solid red");
1121
  $(element).find('.bxgy-min').focus();
1122
+ } else {
1123
  $(element).find('.bxgy-min').css("border", "1px solid #7e8993");
1124
  }
1125
  }
1126
+ if (min_qty == '' && max_qty == '') {
1127
  discount_array.push("fails");
1128
  $(element).find('.bxgy-min').css("border", "1px solid red");
1129
  $(element).find('.bxgy-min').focus();
1130
  $(element).find('.bxgy-max').css("border", "1px solid red");
1131
  $(element).find('.bxgy-max').focus();
1132
+ } else {
1133
  $(element).find('.bxgy-min').css("border", "1px solid #7e8993");
1134
  $(element).find('.bxgy-max').css("border", "1px solid #7e8993");
1135
  }
1136
+ if (free_qty == '') {
1137
  discount_array.push("fails");
1138
  $(element).find('.bxgy-qty').css("border", "1px solid red");
1139
  $(element).find('.bxgy-qty').focus();
1140
+ } else {
1141
  $(element).find('.bxgy-qty').css("border", "1px solid #7e8993");
1142
  }
1143
 
1144
+ if (select_type != 'free_product' && max_val == '') {
1145
  discount_array.push("fails");
1146
  $(element).find('.bxgy-val').css("border", "1px solid red");
1147
  $(element).find('.bxgy-val').focus();
1148
+ } else {
1149
  $(element).find('.bxgy-val').css("border", "1px solid #7e8993");
1150
  }
1151
  });
1158
  return discount_array;
1159
  }
1160
 
1161
+ function wdr_condition_validation() {
1162
  let condition_array = [];
1163
+ $('.wdr-condition-group').each(function (index, element) {
1164
+ let condition_type = $(element).find('.wdr-product-condition-type').val();
1165
  if (typeof condition_type !== 'undefined') {
1166
  switch (condition_type) {
1167
  case 'cart_subtotal':
1168
  let sub_total = $(element).find('.float_only_field').val();
1169
+ if (sub_total == '') {
1170
  condition_array.push("fails");
1171
  $(element).find('.float_only_field').css("border", "1px solid red");
1172
  $(element).find('.float_only_field').focus();
1173
+ } else {
1174
  $(element).find('.float_only_field').css("border", "1px solid #7e8993");
1175
  }
1176
  break;
1177
  case 'cart_items_quantity':
1178
  let item_qty = $(element).find('.float_only_field').val();
1179
+ if (item_qty == '') {
1180
  condition_array.push("fails");
1181
  $(element).find('.float_only_field').css("border", "1px solid red");
1182
  $(element).find('.float_only_field').focus();
1183
+ } else {
1184
  $(element).find('.float_only_field').css("border", "1px solid #7e8993");
1185
  }
1186
  break;
1188
  let coupon_type = $(element).find('.wdr_copon_type').val();
1189
  let custom_coupon = $(element).find('.coupon_name_msg').val();
1190
  let wc_coupon_val = $(element).find('#rm-coupon').val();
1191
+ if (coupon_type == 'custom_coupon') {
1192
+ if (custom_coupon == '') {
1193
  condition_array.push("fails");
1194
  $(element).find('.coupon_name_msg').css("border", "1px solid red");
1195
  $(element).find('.coupon_name_msg').focus();
1196
+ } else {
1197
  $(element).find('.coupon_name_msg').css("border", "1px solid #7e8993");
1198
  }
1199
+ } else {
1200
+ if (!wc_coupon_val) {
1201
  condition_array.push("fails");
1202
  $(element).find('.select2-selection').css("border", "1px solid red");
1203
  $(element).find('.select2-selection').focus();
1204
+ } else {
1205
  $(element).find('.select2-selection').css("border", "1px solid #7e8993");
1206
  }
1207
  }
1208
  break;
1209
  case 'cart_items_weight':
1210
  let item_weight = $(element).find('.float_only_field').val();
1211
+ if (item_weight == '') {
1212
  condition_array.push("fails");
1213
  $(element).find('.float_only_field').css("border", "1px solid red");
1214
  $(element).find('.float_only_field').focus();
1215
+ } else {
1216
  $(element).find('.float_only_field').css("border", "1px solid #7e8993");
1217
  }
1218
  break;
1219
  case 'cart_payment_method':
1220
  let wc_payment_gateway = $(element).find('.select2-hidden-accessible').val();
1221
+ if (!wc_payment_gateway) {
1222
  condition_array.push("fails");
1223
  $(element).find('.select2-selection').css("border", "1px solid red");
1224
  $(element).find('.select2-selection').focus();
1225
+ } else {
1226
  $(element).find('.select2-selection').css("border", "1px solid #7e8993");
1227
  }
1228
  break;
1229
  case 'cart_line_items_count':
1230
  let line_item_count = $(element).find('.float_only_field').val();
1231
+ if (line_item_count == '') {
1232
  condition_array.push("fails");
1233
  $(element).find('.float_only_field').css("border", "1px solid red");
1234
  $(element).find('.float_only_field').focus();
1235
+ } else {
1236
  $(element).find('.float_only_field').css("border", "1px solid #7e8993");
1237
  }
1238
  break;
1239
  case 'cart_item_product_attributes':
1240
  let wc_attributes = $(element).find('.awdr-attribute-validation').val();
1241
  let attribute_qty = $(element).find('.awdr-num-validation').val();
1242
+ if (!wc_attributes) {
1243
  condition_array.push("fails");
1244
  $(element).find('.select2-selection').css("border", "1px solid red");
1245
  $(element).find('.select2-selection').focus();
1246
+ } else {
1247
  $(element).find('.select2-selection').css("border", "1px solid #7e8993");
1248
  }
1249
+ if (attribute_qty == '') {
1250
  condition_array.push("fails");
1251
  $(element).find('.awdr-num-validation').css("border", "1px solid red");
1252
  $(element).find('.awdr-num-validation').focus();
1253
+ } else {
1254
  $(element).find('.awdr-num-validation').css("border", "1px solid #7e8993");
1255
  }
1256
  break;
1257
  case 'cart_item_product_category':
1258
  let wc_category = $(element).find('.awdr-category-validation').val();
1259
  let category_qty = $(element).find('.awdr-num-validation').val();
1260
+ if (!wc_category) {
1261
  condition_array.push("fails");
1262
  $(element).find('.select2-selection').css("border", "1px solid red");
1263
  $(element).find('.select2-selection').focus();
1264
+ } else {
1265
  $(element).find('.select2-selection').css("border", "1px solid #7e8993");
1266
  }
1267
+ if (category_qty == '') {
1268
  condition_array.push("fails");
1269
  $(element).find('.awdr-num-validation').css("border", "1px solid red");
1270
  $(element).find('.awdr-num-validation').focus();
1271
+ } else {
1272
  $(element).find('.awdr-num-validation').css("border", "1px solid #7e8993");
1273
  }
1274
  break;
1277
  let min_qty = $(element).find('.product_from_qty').val();
1278
  let max_qty = $(element).find('.product_to_qty').val();
1279
  let combination_operator = $(element).find('.combination_operator').val();
1280
+ if (!wc_product) {
1281
  condition_array.push("fails");
1282
  $(element).find('.select2-selection').css("border", "1px solid red");
1283
  $(element).find('.select2-selection').focus();
1284
+ } else {
1285
  $(element).find('.select2-selection').css("border", "1px solid #7e8993");
1286
  }
1287
+ if (combination_operator == 'in_range') {
1288
+ if (min_qty == '' && max_qty == '') {
1289
  condition_array.push("fails");
1290
  $(element).find('.product_from_qty').css("border", "1px solid red");
1291
  $(element).find('.product_from_qty').focus();
1292
  $(element).find('.product_to_qty').css("border", "1px solid red");
1293
  $(element).find('.product_to_qty').focus();
1294
+ } else {
1295
  $(element).find('.product_from_qty').css("border", "1px solid #7e8993");
1296
  $(element).find('.product_to_qty').css("border", "1px solid #7e8993");
1297
  }
1298
+ } else {
1299
+ if (min_qty == '') {
1300
  condition_array.push("fails");
1301
  $(element).find('.product_from_qty').css("border", "1px solid red");
1302
  $(element).find('.product_from_qty').focus();
1303
+ } else {
1304
  $(element).find('.product_from_qty').css("border", "1px solid #7e8993");
1305
  }
1306
  }
1308
  case 'cart_item_product_sku':
1309
  let wc_sku = $(element).find('.awdr-sku-validation').val();
1310
  let sku_qty = $(element).find('.awdr-num-validation').val();
1311
+ if (!wc_sku) {
1312
  condition_array.push("fails");
1313
  $(element).find('.select2-selection').css("border", "1px solid red");
1314
  $(element).find('.select2-selection').focus();
1315
+ } else {
1316
  $(element).find('.select2-selection').css("border", "1px solid #7e8993");
1317
  }
1318
+ if (sku_qty == '') {
1319
  condition_array.push("fails");
1320
  $(element).find('.awdr-num-validation').css("border", "1px solid red");
1321
  $(element).find('.awdr-num-validation').focus();
1322
+ } else {
1323
  $(element).find('.awdr-num-validation').css("border", "1px solid #7e8993");
1324
  }
1325
  break;
1326
  case 'cart_item_product_tags':
1327
  let wc_tags = $(element).find('.awdr-tag-validation').val();
1328
  let tag_qty = $(element).find('.awdr-num-validation').val();
1329
+ if (!wc_tags) {
1330
  condition_array.push("fails");
1331
  $(element).find('.select2-selection').css("border", "1px solid red");
1332
  $(element).find('.select2-selection').focus();
1333
+ } else {
1334
  $(element).find('.select2-selection').css("border", "1px solid #7e8993");
1335
  }
1336
+ if (tag_qty == '') {
1337
  condition_array.push("fails");
1338
  $(element).find('.awdr-num-validation').css("border", "1px solid red");
1339
  $(element).find('.awdr-num-validation').focus();
1340
+ } else {
1341
  $(element).find('.awdr-num-validation').css("border", "1px solid #7e8993");
1342
  }
1343
  break;
1344
  case 'cart_item_products':
1345
  let wc_products = $(element).find('.awdr-product-validation').val();
1346
  let product_qty = $(element).find('.awdr-num-validation').val();
1347
+ if (!wc_products) {
1348
  condition_array.push("fails");
1349
  $(element).find('.select2-selection').css("border", "1px solid red");
1350
  $(element).find('.select2-selection').focus();
1351
+ } else {
1352
  $(element).find('.select2-selection').css("border", "1px solid #7e8993");
1353
  }
1354
+ if (product_qty == '') {
1355
  condition_array.push("fails");
1356
  $(element).find('.awdr-num-validation').css("border", "1px solid red");
1357
  $(element).find('.awdr-num-validation').focus();
1358
+ } else {
1359
  $(element).find('.awdr-num-validation').css("border", "1px solid #7e8993");
1360
  }
1361
  break;
1364
  let from_qty = $(element).find('.cat_from_qty').val();
1365
  let to_qty = $(element).find('.cat_to_qty').val();
1366
  let cat_combination = $(element).find('.cat_combination_operator').val();
1367
+ if (!wc_cat) {
1368
  condition_array.push("fails");
1369
  $(element).find('.select2-selection').css("border", "1px solid red");
1370
  $(element).find('.select2-selection').focus();
1371
+ } else {
1372
  $(element).find('.select2-selection').css("border", "1px solid #7e8993");
1373
  }
1374
+ if (cat_combination == 'in_range') {
1375
+ if (from_qty == '' && to_qty == '') {
1376
  condition_array.push("fails");
1377
  $(element).find('.cat_from_qty').css("border", "1px solid red");
1378
  $(element).find('.cat_from_qty').focus();
1379
  $(element).find('.cat_to_qty').css("border", "1px solid red");
1380
  $(element).find('.cat_to_qty').focus();
1381
+ } else {
1382
  $(element).find('.cat_from_qty').css("border", "1px solid #7e8993");
1383
  $(element).find('.cat_to_qty').css("border", "1px solid #7e8993");
1384
  }
1385
+ } else {
1386
+ if (from_qty == '') {
1387
  condition_array.push("fails");
1388
  $(element).find('.cat_from_qty').css("border", "1px solid red");
1389
  $(element).find('.cat_from_qty').focus();
1390
+ } else {
1391
  $(element).find('.cat_from_qty').css("border", "1px solid #7e8993");
1392
  }
1393
  }
1394
  break;
1395
  case 'order_date':
1396
+ let from_date = $(element).find('.awdr-from-date').val();
1397
+ let end_date = $(element).find('.awdr-end-date').val();
1398
+ if (from_date == '' && end_date == '') {
1399
+ condition_array.push("fails");
1400
+ $(element).find('.awdr-from-date').css("border", "1px solid red");
1401
+ $(element).find('.awdr-from-date').focus();
1402
+ $(element).find('.awdr-end-date').css("border", "1px solid red");
1403
+ $(element).find('.awdr-end-date').focus();
1404
+ } else {
1405
+ $(element).find('.awdr-from-date').css("border", "1px solid #7e8993");
1406
+ $(element).find('.awdr-end-date').css("border", "1px solid #7e8993");
1407
+ }
1408
  break;
1409
  case 'order_date_and_time':
1410
  let from_date_time = $(element).find('.awdr-from-date').val();
1411
  let end_date_time = $(element).find('.awdr-end-date').val();
1412
+ if (from_date_time == '' && end_date_time == '') {
1413
  condition_array.push("fails");
1414
  $(element).find('.awdr-from-date').css("border", "1px solid red");
1415
  $(element).find('.awdr-from-date').focus();
1416
  $(element).find('.awdr-end-date').css("border", "1px solid red");
1417
  $(element).find('.awdr-end-date').focus();
1418
+ } else {
1419
  $(element).find('.awdr-from-date').css("border", "1px solid #7e8993");
1420
  $(element).find('.awdr-end-date').css("border", "1px solid #7e8993");
1421
  }
1422
  break;
1423
  case 'order_days':
1424
  let order_days = $(element).find('.order_days').val();
1425
+ if (!order_days) {
1426
  condition_array.push("fails");
1427
  $(element).find('.select2-selection').css("border", "1px solid red");
1428
  $(element).find('.select2-selection').focus();
1429
+ } else {
1430
  $(element).find('.select2-selection').css("border", "1px solid #7e8993");
1431
  }
1432
  break;
1433
  case 'order_time':
1434
  let from_time = $(element).find('.wdr-from-time').val();
1435
  let end_time = $(element).find('.wdr-to-time').val();
1436
+ if (from_time == '' && end_time == '') {
1437
  condition_array.push("fails");
1438
  $(element).find('.wdr-from-time').css("border", "1px solid red");
1439
  $(element).find('.wdr-from-time').focus();
1440
  $(element).find('.wdr-to-time').css("border", "1px solid red");
1441
  $(element).find('.wdr-to-time').focus();
1442
+ } else {
1443
  $(element).find('.wdr-from-time').css("border", "1px solid #7e8993");
1444
  $(element).find('.wdr-to-time').css("border", "1px solid #7e8993");
1445
  }
1446
  break;
1447
  case 'purchase_last_order':
1448
  let last_order = $(element).find('.wdr-wc-order-status').val();
1449
+ if (!last_order) {
1450
  condition_array.push("fails");
1451
  $(element).find('.select2-selection').css("border", "1px solid red");
1452
  $(element).find('.select2-selection').focus();
1453
+ } else {
1454
  $(element).find('.select2-selection').css("border", "1px solid #7e8993");
1455
  }
1456
  break;
1457
  case 'purchase_last_order_amount':
1458
  let last_order_amount_status = $(element).find('.wdr-wc-order-status').val();
1459
  let last_order_amount = $(element).find('.float_only_field').val();
1460
+ if (!last_order_amount_status) {
1461
  condition_array.push("fails");
1462
  $(element).find('.select2-selection').css("border", "1px solid red");
1463
  $(element).find('.select2-selection').focus();
1464
+ } else {
1465
  $(element).find('.select2-selection').css("border", "1px solid #7e8993");
1466
  }
1467
+ if (last_order_amount == '') {
1468
  condition_array.push("fails");
1469
  $(element).find('.float_only_field').css("border", "1px solid red");
1470
  $(element).find('.float_only_field').focus();
1471
+ } else {
1472
  $(element).find('.float_only_field').css("border", "1px solid #7e8993");
1473
  }
1474
  break;
1475
  case 'purchase_previous_orders':
1476
  let made_order_status = $(element).find('.wdr-wc-order-status').val();
1477
  let made_order_amount = $(element).find('.float_only_field').val();
1478
+ if (!made_order_status) {
1479
  condition_array.push("fails");
1480
  $(element).find('.select2-selection').css("border", "1px solid red");
1481
  $(element).find('.select2-selection').focus();
1482
+ } else {
1483
  $(element).find('.select2-selection').css("border", "1px solid #7e8993");
1484
  }
1485
+ if (made_order_amount == '') {
1486
  condition_array.push("fails");
1487
  $(element).find('.float_only_field').css("border", "1px solid red");
1488
  $(element).find('.float_only_field').focus();
1489
+ } else {
1490
  $(element).find('.float_only_field').css("border", "1px solid #7e8993");
1491
  }
1492
  break;
1494
  let made_order_status_for_product = $(element).find('.wdr-wc-order-status').val();
1495
  let made_order_amount_for_product = $(element).find('.float_only_field').val();
1496
  let ordered_product = $(element).find('.specific_product').val();
1497
+ if (!ordered_product) {
1498
  condition_array.push("fails");
1499
  $(element).find('.wdr-previous-order-product-selector .select2-selection').css("border", "1px solid red");
1500
  $(element).find('.wdr-previous-order-product-selector .select2-selection').focus();
1501
+ } else {
1502
  $(element).find('.wdr-previous-order-product-selector .select2-selection').css("border", "1px solid #7e8993");
1503
  }
1504
+ if (!made_order_status_for_product) {
1505
  condition_array.push("fails");
1506
  $(element).find('.wdr-previous-order-product-status .select2-selection').css("border", "1px solid red");
1507
  $(element).find('.wdr-previous-order-product-status .select2-selection').focus();
1508
+ } else {
1509
  $(element).find('.wdr-previous-order-product-status .select2-selection').css("border", "1px solid #7e8993");
1510
  }
1511
+ if (made_order_amount_for_product == '') {
1512
  condition_array.push("fails");
1513
  $(element).find('.float_only_field').css("border", "1px solid red");
1514
  $(element).find('.float_only_field').focus();
1515
+ } else {
1516
  $(element).find('.float_only_field').css("border", "1px solid #7e8993");
1517
  }
1518
  break;
1520
  let status_for_product_qty = $(element).find('.wdr-wc-order-status').val();
1521
  let amount_for_product_qty = $(element).find('.float_only_field').val();
1522
  let product_ordered = $(element).find('.specific_product').val();
1523
+ if (!product_ordered) {
1524
  condition_array.push("fails");
1525
  $(element).find('.wdr-previous-order-product-selector .select2-selection').css("border", "1px solid red");
1526
  $(element).find('.wdr-previous-order-product-selector .select2-selection').focus();
1527
+ } else {
1528
  $(element).find('.wdr-previous-order-product-selector .select2-selection').css("border", "1px solid #7e8993");
1529
  }
1530
+ if (!status_for_product_qty) {
1531
  condition_array.push("fails");
1532
  $(element).find('.wdr-previous-order-product-status .select2-selection').css("border", "1px solid red");
1533
  $(element).find('.wdr-previous-order-product-status .select2-selection').focus();
1534
+ } else {
1535
  $(element).find('.wdr-previous-order-product-status .select2-selection').css("border", "1px solid #7e8993");
1536
  }
1537
+ if (amount_for_product_qty == '') {
1538
  condition_array.push("fails");
1539
  $(element).find('.float_only_field').css("border", "1px solid red");
1540
  $(element).find('.float_only_field').focus();
1541
+ } else {
1542
  $(element).find('.float_only_field').css("border", "1px solid #7e8993");
1543
  }
1544
 
1546
  case 'purchase_spent':
1547
  let spent_status = $(element).find('.wdr-wc-order-status').val();
1548
  let spent_amount = $(element).find('.float_only_field').val();
1549
+ if (!spent_status) {
1550
  condition_array.push("fails");
1551
  $(element).find('.select2-selection').css("border", "1px solid red");
1552
  $(element).find('.select2-selection').focus();
1553
+ } else {
1554
  $(element).find('.select2-selection').css("border", "1px solid #7e8993");
1555
  }
1556
+ if (spent_amount == '') {
1557
  condition_array.push("fails");
1558
  $(element).find('.float_only_field').css("border", "1px solid red");
1559
  $(element).find('.float_only_field').focus();
1560
+ } else {
1561
  $(element).find('.float_only_field').css("border", "1px solid #7e8993");
1562
  }
1563
  break;
1564
  case 'shipping_city':
1565
  let shipping_city = $(element).find('.awdr-validation').val();
1566
+ if (shipping_city == '') {
1567
  condition_array.push("fails");
1568
  $(element).find('.awdr-validation').css("border", "1px solid red");
1569
  $(element).find('.awdr-validation').focus();
1570
+ } else {
1571
  $(element).find('.awdr-validation').css("border", "1px solid #7e8993");
1572
  }
1573
  break;
1574
  case 'shipping_country':
1575
  let shipping_country = $(element).find('.get_awdr_shipping_country').val();
1576
+ if (!shipping_country) {
1577
  condition_array.push("fails");
1578
  $(element).find('.select2-selection').css("border", "1px solid red");
1579
  $(element).find('.select2-selection').focus();
1580
+ } else {
1581
  $(element).find('.select2-selection').css("border", "1px solid #7e8993");
1582
  }
1583
  break;
1584
  case 'shipping_state':
1585
  let shipping_state = $(element).find('.get_awdr_shipping_state').val();
1586
+ if (!shipping_state) {
1587
  condition_array.push("fails");
1588
  $(element).find('.select2-selection').css("border", "1px solid red");
1589
  $(element).find('.select2-selection').focus();
1590
+ } else {
1591
  $(element).find('.select2-selection').css("border", "1px solid #7e8993");
1592
  }
1593
  break;
1594
  case 'shipping_zipcode':
1595
  let shipping_zipcode = $(element).find('.awdr-validation').val();
1596
+ if (shipping_zipcode == '') {
1597
  condition_array.push("fails");
1598
  $(element).find('.awdr-validation').css("border", "1px solid red");
1599
  $(element).find('.awdr-validation').focus();
1600
+ } else {
1601
  $(element).find('.awdr-validation').css("border", "1px solid #7e8993");
1602
  }
1603
  break;
1604
  case 'Billing_city':
1605
  let Billing_city = $(element).find('.awdr-validation').val();
1606
+ if (Billing_city == '') {
1607
  condition_array.push("fails");
1608
  $(element).find('.awdr-validation').css("border", "1px solid red");
1609
  $(element).find('.awdr-validation').focus();
1610
+ } else {
1611
  $(element).find('.awdr-validation').css("border", "1px solid #7e8993");
1612
  }
1613
  break;
1614
  case 'user_email':
1615
  let user_email = $(element).find('.awdr-validation').val();
1616
+ if (user_email == '') {
1617
  condition_array.push("fails");
1618
  $(element).find('.awdr-validation').css("border", "1px solid red");
1619
  $(element).find('.awdr-validation').focus();
1620
+ } else {
1621
  $(element).find('.awdr-validation').css("border", "1px solid #7e8993");
1622
  }
1623
  break;
1624
  case 'user_list':
1625
  let user_list = $(element).find('.wdr_user_list').val();
1626
+ if (!user_list) {
1627
  condition_array.push("fails");
1628
  $(element).find('.select2-selection').css("border", "1px solid red");
1629
  $(element).find('.select2-selection').focus();
1630
+ } else {
1631
  $(element).find('.select2-selection').css("border", "1px solid #7e8993");
1632
  }
1633
  break;
1634
  case 'user_role':
1635
  let user_role = $(element).find('.wdr_user_role').val();
1636
+ if (!user_role) {
1637
  condition_array.push("fails");
1638
  $(element).find('.select2-selection').css("border", "1px solid red");
1639
  $(element).find('.select2-selection').focus();
1640
+ } else {
1641
  $(element).find('.select2-selection').css("border", "1px solid #7e8993");
1642
  }
1643
  break;
1652
  */
1653
  $('#configuration-form').submit(function (e) {
1654
  e.preventDefault();
1655
+ /* $("#awdr_banner_editor-html").click();
1656
  $("#awdr_banner_editor-tmce").click();
1657
+ let awdr_banner_editer = $('#awdr_banner_editor').val();*/
1658
+ /*$('.customize_banner_content').val(awdr_banner_editer);*/
1659
  let values = $(this).serialize();
1660
  let loader = $('.woo_discount_loader');
1661
+ /* values += "&banner_content=" + awdr_banner_editer;*/
1662
  $.ajax({
1663
  data: values,
1664
  type: 'post',
1665
  url: ajaxurl,
1666
+ beforeSend: function () {
1667
  loader.show();
1668
  },
1669
+ complete: function () {
1670
  loader.hide();
1671
  },
1672
  error: function (request, error) {
1673
  notify(wdr_data.localization_data.error, 'error', alert_counter);
1674
  },
1675
  success: function (response) {
1676
+ if (response.data.save_popup == "alert_in_popup" && response.data.security_pass == "passed") {
1677
  $('.awdr-save-green').show();
1678
  setTimeout(
1679
  function () {
1680
  $('.awdr-save-green').fadeOut(500);
1681
+ window.location.replace(wdr_data.admin_url+'&tab=settings');
1682
+ }, 1000
1683
  );
1684
+ } else if (response.data.save_popup == "alert_in_normal" && response.data.security_pass == "passed") {
1685
  notify(wdr_data.localization_data.save_settings, 'success', alert_counter);
1686
+ setTimeout(
1687
+ function () {
1688
+ window.location.replace(wdr_data.admin_url+'&tab=settings');
1689
+ }, 1000
1690
+ );
1691
+
1692
+ }else if(response.data.save_popup == "alert_in_normal" && response.data.security_pass == "fails"){
1693
+ notify(wdr_data.localization_data.error, 'error', alert_counter);
1694
+ setTimeout(
1695
+ function () {
1696
+ window.location.replace(wdr_data.admin_url+'&tab=settings');
1697
+ }, 1000
1698
+ );
1699
  }
1700
  }
1701
  });
1732
  */
1733
  $('#wdr-bulk-action-top').submit(function (e) {
1734
  e.preventDefault();
1735
+ if ($('input[name="saved_rules[]"]:checked').length > 0) {
1736
  let action = $('#bulk-action-selector-top').val();
1737
  let result;
1738
  if (action == 'enable') {
1747
  if (result == false) {
1748
  return false;
1749
  }
1750
+ } else {
1751
  return false;
1752
  }
1753
  let loader = $('.woo_discount_loader');
1755
  data: $(this).serialize(),
1756
  type: 'post',
1757
  url: ajaxurl,
1758
+ beforeSend: function () {
1759
  loader.show();
1760
  },
1761
+ complete: function () {
1762
  loader.hide();
1763
  },
1764
  error: function (request, error) {
1905
  function () {
1906
  message_div.fadeOut(500);
1907
  message_div.remove();
1908
+ }, 5000
1909
  );
1910
  }
1911
 
2253
  $(this).parents('.awdr_bogo_main').siblings('.' + hide_if_recursive).show();
2254
  $(this).parents('.' + get_recursive_parent).siblings('.' + bogo_max_range).show();
2255
  $(this).parents('.' + get_recursive_parent).siblings().find('.' + bogo_max_range).show();
2256
+ // $('.'+bogo_max_range).show();
2257
  $(this).parents('.' + get_recursive_parent).siblings('.' + bogo_min_range).find('.wdr_desc_text').text(wdr_data.localization_data.recursive_min_qty);
2258
  $('.' + bogo_border_bottom).css("border-bottom", "1px solid #ddd");
2259
  return;
2279
  $(document).on('change', '.awdr_mode_of_operator', function () {
2280
  let mode_of_operator = $(this).val();
2281
  let discount_type = $('.awdr-product-discount-type').val();
2282
+ if (discount_type == 'wdr_buy_x_get_y_discount') {
2283
+ if (mode_of_operator == "variation") {
2284
  $('.awdr-bxgy-dynamic-tip').attr("title", wdr_data.localization_data.bulk_variants_discount_description_tool_tip);
2285
  $('.awdr-example').html(wdr_data.localization_data.mode_variation_cumulative_example);
2286
+ } else if (mode_of_operator == "product") {
2287
  $('.awdr-bxgy-dynamic-tip').attr("title", wdr_data.localization_data.bulk_individual_product_discount_description_tool_tip);
2288
  $('.awdr-example').html('');
2289
+ } else {
2290
  $('.awdr-bxgy-dynamic-tip').attr("title", wdr_data.localization_data.bulk_filter_together_discount_description_tool_tip);
2291
  $('.awdr-example').html('');
2292
  }
2293
  return;
2294
  }
2295
+ if (mode_of_operator == "variation") {
2296
  $('.awdr-discount-content').html(wdr_data.localization_data.bulk_variants_discount_description);
2297
  $('.awdr-example').html(wdr_data.localization_data.mode_variation_cumulative_example);
2298
+ } else if (mode_of_operator == "product") {
2299
  $('.awdr-discount-content').html(wdr_data.localization_data.bulk_individual_product_discount_description);
2300
  $('.awdr-example').html('');
2301
+ } else {
2302
  $('.awdr-discount-content').html(wdr_data.localization_data.bulk_filter_together_discount_description);
2303
  $('.awdr-example').html('');
2304
  }
2309
  var data_placement = $(this).data('placement');
2310
  let discount_type = $(this).val();
2311
  let read_doc_prefix = 'awdr_doc_';
2312
+ switch (discount_type) {
2313
  case 'wdr_simple_discount':
2314
+ $('.' + read_doc_prefix + discount_type).show();
2315
  $('.awdr_doc_wdr_cart_discount,.awdr_doc_wdr_free_shipping,.awdr_doc_wdr_bulk_discount,.awdr_doc_wdr_set_discount,.awdr_doc_wdr_buy_x_get_x_discount,.awdr_doc_wdr_buy_x_get_y_discount').hide();
2316
  break;
2317
  case 'wdr_cart_discount':
2318
+ $('.' + read_doc_prefix + discount_type).show();
2319
  $('.awdr_doc_wdr_simple_discount,.awdr_doc_wdr_free_shipping,.awdr_doc_wdr_bulk_discount,.awdr_doc_wdr_set_discount,.awdr_doc_wdr_buy_x_get_x_discount,.awdr_doc_wdr_buy_x_get_y_discount').hide();
2320
  break;
2321
  case 'wdr_free_shipping':
2322
+ $('.' + read_doc_prefix + discount_type).show();
2323
  $('.awdr_doc_wdr_simple_discount,.awdr_doc_wdr_cart_discount,.awdr_doc_wdr_bulk_discount,.awdr_doc_wdr_set_discount,.awdr_doc_wdr_buy_x_get_x_discount,.awdr_doc_wdr_buy_x_get_y_discount').hide();
2324
  break;
2325
  case 'wdr_bulk_discount':
2326
+ $('.' + read_doc_prefix + discount_type).show();
2327
  $('.awdr_doc_wdr_simple_discount,.awdr_doc_wdr_cart_discount,.awdr_doc_wdr_free_shipping,.awdr_doc_wdr_set_discount,.awdr_doc_wdr_buy_x_get_x_discount,.awdr_doc_wdr_buy_x_get_y_discount').hide();
2328
+ break;
2329
  case 'wdr_set_discount':
2330
+ $('.' + read_doc_prefix + discount_type).show();
2331
  $('.awdr_doc_wdr_simple_discount,.awdr_doc_wdr_cart_discount,.awdr_doc_wdr_free_shipping,.awdr_doc_wdr_bulk_discount,.awdr_doc_wdr_buy_x_get_x_discount,.awdr_doc_wdr_buy_x_get_y_discount').hide();
2332
  break;
2333
  case 'wdr_buy_x_get_x_discount':
2334
+ $('.' + read_doc_prefix + discount_type).show();
2335
  $('.awdr_doc_wdr_simple_discount,.awdr_doc_wdr_cart_discount,.awdr_doc_wdr_free_shipping,.awdr_doc_wdr_bulk_discount,.awdr_doc_wdr_set_discount,.awdr_doc_wdr_buy_x_get_y_discount').hide();
2336
  break;
2337
  case 'wdr_buy_x_get_y_discount':
2338
+ $('.' + read_doc_prefix + discount_type).show();
2339
  $('.awdr_doc_wdr_simple_discount,.awdr_doc_wdr_cart_discount,.awdr_doc_wdr_free_shipping,.awdr_doc_wdr_bulk_discount,.awdr_doc_wdr_set_discount,.awdr_doc_wdr_buy_x_get_x_discount').hide();
2340
  break
2341
  default:
2349
  ruleAppendTo: '.' + data_placement,
2350
  addDiscountType: 'enable',
2351
  });
2352
+ if (!$(".awdr-free-shipping-special-condition").hasClass("wdr-hide")) {
2353
  $('.awdr-free-shipping-special-condition').addClass('wdr-hide');
2354
  }
2355
  awdrRemoveOnSaleCondition();
2371
  $('.awdr-discount-content').html(wdr_data.localization_data.common_discount_description);
2372
  $('.awdr-rules-content').html(wdr_data.localization_data.common_rules_description);
2373
 
2374
+ if ($(this).val() == 'wdr_buy_x_get_y_discount') {
2375
+ if (!$(".awdr-free-shipping-special-condition").hasClass("wdr-hide")) {
2376
  $('.awdr-free-shipping-special-condition').addClass('wdr-hide');
2377
  }
2378
  awdrRemoveOnSaleCondition();
2379
  //$('.awdr_mode_of_operator').trigger('change');
2380
  console.log('yes');
2381
  $('.awdr-discount-heading').html(wdr_data.localization_data.two_column_bxgy_discount_heading);
2382
+ make_wdr_select2_search($('.' + data_placement).find('[data-list="product_category"]'));
2383
  $('.adv-msg-min-qty, .adv-msg-max-qty, .adv-msg-discount, .adv-msg-discount-price').hide();
2384
  }
2385
+ if ($(this).val() == 'wdr_buy_x_get_x_discount') {
2386
+ if (!$(".awdr-free-shipping-special-condition").hasClass("wdr-hide")) {
2387
  $('.awdr-free-shipping-special-condition').addClass('wdr-hide');
2388
  }
2389
  awdrRemoveOnSaleCondition();
2390
  $('.adv-msg-min-qty, .adv-msg-max-qty, .adv-msg-discount, .adv-msg-discount-price').hide();
2391
  }
2392
  if ($(this).val() == 'wdr_bulk_discount') {
2393
+ if (!$(".awdr-free-shipping-special-condition").hasClass("wdr-hide")) {
2394
  $('.awdr-free-shipping-special-condition').addClass('wdr-hide');
2395
  }
2396
  awdrRemoveOnSaleCondition();
2398
  $('.awdr_mode_of_operator').trigger('change');
2399
  $('.adv-msg-min-qty, .adv-msg-max-qty, .adv-msg-discount, .adv-msg-discount-price').show();
2400
  } else if ($(this).val() == 'wdr_set_discount') {
2401
+ if (!$(".awdr-free-shipping-special-condition").hasClass("wdr-hide")) {
2402
  $('.awdr-free-shipping-special-condition').addClass('wdr-hide');
2403
  }
2404
  awdrRemoveOnSaleCondition();
2417
  $('.adv-msg-min-qty, .adv-msg-max-qty, .adv-msg-discount, .adv-msg-discount-price').hide();
2418
  $(".calculate_cart_from option[value='from_filter']").hide();
2419
  } else {
2420
+ if (!$(".awdr-free-shipping-special-condition").hasClass("wdr-hide")) {
2421
  $('.awdr-free-shipping-special-condition').addClass('wdr-hide');
2422
  }
2423
  awdrRemoveOnSaleCondition();
2430
  $(".awdr-product-discount-type").trigger('change');
2431
 
2432
  function awdrRemoveOnSaleCondition() {
2433
+ $('.wdr-condition-group').each(function (index, element) {
2434
  let condition_type = $(element).find('.wdr-product-condition-type').val();
2435
  if (typeof condition_type !== 'undefined') {
2436
  switch (condition_type) {
2441
  }
2442
  });
2443
  }
2444
+
2445
  if (wdr_data.rule_id == "view") {
2446
  $("button.wdr_save_stay, button.wdr_save_close").attr("disabled", false).removeClass("wdr_save_btn_disabled");
2447
  } else {
2483
  });
2484
  }
2485
  $(document).on('change', '.on_sale_badge_condition', function () {
2486
+ if ($(this).val() === 'disabled') {
2487
  $('.sale_badge_toggle').hide();
2488
  $('.sale_badge_customizer').hide();
2489
+ } else {
2490
  $('.sale_badge_toggle').show();
2491
+ if ($('#customize_on_sale_badge').prop("checked") == true) {
2492
  $('.sale_badge_customizer').show();
2493
+ } else {
2494
  $('.sale_badge_customizer').hide();
2495
  }
2496
  }
2497
  });
2498
  $(document).on('change', '#customize_on_sale_badge', function () {
2499
+ if ($(this).prop("checked") == true) {
2500
  $('.sale_badge_customizer').show();
2501
+ } else {
2502
  $('.sale_badge_customizer').hide();
2503
  }
2504
  });
2505
  $(document).on('change', '#badge_colorpicker', function () {
2506
  let background_color = $(this).val();
2507
+ $('.awdr_admin_discount_bar').css('background-color', background_color);
2508
  });
2509
  $(document).on('change', '#badge_hexcolor', function () {
2510
  let background_color = $(this).val();
2511
+ $('.awdr_admin_discount_bar').css('background-color', background_color);
2512
  });
2513
  $(document).on('change', '#text_colorpicker', function () {
2514
  let text_color = $(this).val();
2515
+ $('.awdr_admin_discount_bar').css('color', text_color);
2516
  });
2517
  $(document).on('change', '#text_hexcolor', function () {
2518
  let text_color = $(this).val();
2519
+ $('.awdr_admin_discount_bar').css('color', text_color);
2520
  });
2521
  $(document).on('change', '#awdr_discount_bar_content', function () {
2522
  let discount_bar_content = $(this).val();
2533
  * Rule limit dynamic message
2534
  */
2535
  $(document).on('change', '#select_usage_limits', function () {
2536
+ let selected_limit = $("#select_usage_limits option:selected").text();
2537
+ if (selected_limit == "Unlimited") {
2538
  $('.usage-limits-display').hide();
2539
  $('.awdr-rule-limit-disabled-outer .rule_limit_msg_outer').hide();
2540
  $('.awdr-rule-limit-disabled').hide();
2541
+ } else {
2542
  $('.usage-limits-display').show();
2543
  var rule_applied_total = $('.awdr-used-limit-total').html();
2544
+ if (selected_limit <= parseInt(rule_applied_total)) {
2545
  $('.awdr-rule-limit-disabled').hide();
2546
  $('.awdr-rule-limit-disabled-outer').show();
2547
  $('.awdr-rule-limit-disabled-outer .rule_limit_msg_outer').html(wdr_data.localization_data.invalid_rule_limit);
2548
+ } else {
2549
  $('.awdr-rule-limit-disabled').hide();
2550
  $('.awdr-rule-limit-disabled-outer').hide();
2551
  }
2552
  }
2553
+ // awdrRuleDateValidationMessage();
2554
  });
2555
 
2556
  /**
v2/Assets/Js/site_main.js CHANGED
@@ -22,63 +22,65 @@
22
  $(document).ready(function ($) {
23
  function init_events() {
24
  if (awdr_params.enable_update_price_with_qty == 'show_dynamically') {
25
- jQuery('[name="quantity"]').on('change', function () {
26
- var $qty = jQuery(this).val();
27
- var $product_id = 0;
28
- var $price_place = "";
29
-
30
- if (jQuery('button[name="add-to-cart"]').length) {
31
- $product_id = jQuery('button[name="add-to-cart"]').val();
32
- var target = 'div.product p.price';
33
- if(awdr_params.custom_target_simple_product != undefined){
34
- if(awdr_params.custom_target_simple_product != ""){
35
- target = awdr_params.custom_target_simple_product;
 
 
 
36
  }
37
- }
38
- $price_place = jQuery(target).first();
39
- } else if (jQuery('input[name="variation_id"]').length) {
40
- $product_id = jQuery('input[name="variation_id"]').val();
41
- var target = 'div.product .woocommerce-variation-price';
42
- if(awdr_params.custom_target_variable_product != undefined){
43
- if(awdr_params.custom_target_variable_product != ""){
44
- target = awdr_params.custom_target_variable_product;
45
  }
 
 
 
 
 
 
46
  }
47
- $price_place = jQuery(target);
48
- if (!jQuery(target+' .price').length) {
49
- $price_place.html("<div class='price'></div>");
50
  }
51
 
52
- $price_place = jQuery(target+' .price')
53
- }
54
- if (!$product_id || !$price_place || $product_id == 0) {
55
- return;
56
- }
57
-
58
- var data = {
59
- action: 'wdr_ajax',
60
- method: 'get_price_html',
61
- product_id: $product_id,
62
- qty: $qty,
63
- };
64
- jQuery.ajax({
65
- url: awdr_params.ajaxurl,
66
- data: data,
67
- type: 'POST',
68
- success: function (response) {
69
- if (response.price_html) {
70
- $price_place.html(response.price_html)
71
- } else {
72
- if(response.original_price_html != undefined){
73
- $price_place.html(response.original_price_html)
74
  }
 
 
 
75
  }
76
- },
77
- error: function (response) {
78
- $price_place.html("")
79
- }
80
- });
81
-
82
  });
83
  $( ".single_variation_wrap" ).on( "show_variation", function ( event, variation, purchasable ) {
84
  $(this).closest('form').find('input[name="quantity"]').trigger('change');
22
  $(document).ready(function ($) {
23
  function init_events() {
24
  if (awdr_params.enable_update_price_with_qty == 'show_dynamically') {
25
+ $(document).on('change', '[name="quantity"]', function (){
26
+ var awdr_qty_object = $(this);
27
+ setTimeout(function(){
28
+ var $qty = awdr_qty_object.val();
29
+ var $product_id = 0;
30
+ var $price_place = "";
31
+ var form = awdr_qty_object.closest("form");
32
+ if (form.find('button[name="add-to-cart"]').length) {
33
+ $product_id = form.find('button[name="add-to-cart"]').val();
34
+ var target = 'div.product p.price';
35
+ if(awdr_params.custom_target_simple_product != undefined){
36
+ if(awdr_params.custom_target_simple_product != ""){
37
+ target = awdr_params.custom_target_simple_product;
38
+ }
39
  }
40
+ $price_place = $(target).first();
41
+ } else if (form.find('input[name="variation_id"]').length) {
42
+ $product_id = form.find('input[name="variation_id"]').val();
43
+ var target = 'div.product .woocommerce-variation-price';
44
+ if(awdr_params.custom_target_variable_product != undefined){
45
+ if(awdr_params.custom_target_variable_product != ""){
46
+ target = awdr_params.custom_target_variable_product;
47
+ }
48
  }
49
+ $price_place = $(target);
50
+ if (!$(target+' .price').length) {
51
+ $price_place.html("<div class='price'></div>");
52
+ }
53
+
54
+ $price_place = $(target+' .price')
55
  }
56
+ if (!$product_id || !$price_place || $product_id == 0) {
57
+ return;
 
58
  }
59
 
60
+ var data = {
61
+ action: 'wdr_ajax',
62
+ method: 'get_price_html',
63
+ product_id: $product_id,
64
+ qty: $qty,
65
+ };
66
+ $.ajax({
67
+ url: awdr_params.ajaxurl,
68
+ data: data,
69
+ type: 'POST',
70
+ success: function (response) {
71
+ if (response.price_html) {
72
+ $price_place.html(response.price_html)
73
+ } else {
74
+ if(response.original_price_html != undefined){
75
+ $price_place.html(response.original_price_html)
76
+ }
 
 
 
 
 
77
  }
78
+ },
79
+ error: function (response) {
80
+ $price_place.html("")
81
  }
82
+ });
83
+ }, 0);
 
 
 
 
84
  });
85
  $( ".single_variation_wrap" ).on( "show_variation", function ( event, variation, purchasable ) {
86
  $(this).closest('form').find('input[name="quantity"]').trigger('change');
v2/composer.json CHANGED
@@ -14,7 +14,9 @@
14
  }
15
  ],
16
  "minimum-stability": "dev",
17
- "require": {},
 
 
18
  "autoload": {
19
  "files": [
20
  "App/Helpers/ProOptions.php"
14
  }
15
  ],
16
  "minimum-stability": "dev",
17
+ "require": {
18
+ "vlucas/valitron": "dev-master"
19
+ },
20
  "autoload": {
21
  "files": [
22
  "App/Helpers/ProOptions.php"
v2/vendor/composer/autoload_psr4.php CHANGED
@@ -19,4 +19,5 @@ return array(
19
  'Wdr\\App\\Conditions\\' => array($baseDir . '/App/Conditions'),
20
  'Wdr\\App\\' => array($baseDir . '/App'),
21
  'Wdr\\' => array($baseDir . '/'),
 
22
  );
19
  'Wdr\\App\\Conditions\\' => array($baseDir . '/App/Conditions'),
20
  'Wdr\\App\\' => array($baseDir . '/App'),
21
  'Wdr\\' => array($baseDir . '/'),
22
+ 'Valitron\\' => array($vendorDir . '/vlucas/valitron/src/Valitron'),
23
  );
v2/vendor/composer/autoload_static.php CHANGED
@@ -27,6 +27,10 @@ class ComposerStaticInitb26056d0c17fcbb02d4183fc935d6bbd
27
  'Wdr\\App\\' => 8,
28
  'Wdr\\' => 4,
29
  ),
 
 
 
 
30
  );
31
 
32
  public static $prefixDirsPsr4 = array (
@@ -82,6 +86,10 @@ class ComposerStaticInitb26056d0c17fcbb02d4183fc935d6bbd
82
  array (
83
  0 => __DIR__ . '/../..' . '/',
84
  ),
 
 
 
 
85
  );
86
 
87
  public static function getInitializer(ClassLoader $loader)
27
  'Wdr\\App\\' => 8,
28
  'Wdr\\' => 4,
29
  ),
30
+ 'V' =>
31
+ array (
32
+ 'Valitron\\' => 9,
33
+ ),
34
  );
35
 
36
  public static $prefixDirsPsr4 = array (
86
  array (
87
  0 => __DIR__ . '/../..' . '/',
88
  ),
89
+ 'Valitron\\' =>
90
+ array (
91
+ 0 => __DIR__ . '/..' . '/vlucas/valitron/src/Valitron',
92
+ ),
93
  );
94
 
95
  public static function getInitializer(ClassLoader $loader)
v2/vendor/composer/installed.json CHANGED
@@ -1 +1,59 @@
1
- []
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [
2
+ {
3
+ "name": "vlucas/valitron",
4
+ "version": "dev-master",
5
+ "version_normalized": "9999999-dev",
6
+ "source": {
7
+ "type": "git",
8
+ "url": "https://github.com/vlucas/valitron.git",
9
+ "reference": "9268adeeb48ba155e35dca861f5990283e14eafb"
10
+ },
11
+ "dist": {
12
+ "type": "zip",
13
+ "url": "https://api.github.com/repos/vlucas/valitron/zipball/9268adeeb48ba155e35dca861f5990283e14eafb",
14
+ "reference": "9268adeeb48ba155e35dca861f5990283e14eafb",
15
+ "shasum": ""
16
+ },
17
+ "require": {
18
+ "php": ">=5.3.2"
19
+ },
20
+ "require-dev": {
21
+ "phpunit/phpunit": "^4.8.35 || ^5.5 || ^6.5"
22
+ },
23
+ "suggest": {
24
+ "ext-mbstring": "It can support the multiple bytes string length."
25
+ },
26
+ "time": "2020-07-10T08:55:05+00:00",
27
+ "type": "library",
28
+ "installation-source": "source",
29
+ "autoload": {
30
+ "psr-4": {
31
+ "Valitron\\": "src/Valitron"
32
+ }
33
+ },
34
+ "notification-url": "https://packagist.org/downloads/",
35
+ "license": [
36
+ "BSD-3-Clause"
37
+ ],
38
+ "authors": [
39
+ {
40
+ "name": "Vance Lucas",
41
+ "email": "vance@vancelucas.com",
42
+ "homepage": "http://www.vancelucas.com"
43
+ }
44
+ ],
45
+ "description": "Simple, elegant, stand-alone validation library with NO dependencies",
46
+ "homepage": "http://github.com/vlucas/valitron",
47
+ "keywords": [
48
+ "valid",
49
+ "validation",
50
+ "validator"
51
+ ],
52
+ "funding": [
53
+ {
54
+ "url": "https://tidelift.com/funding/github/packagist/vlucas/valitron",
55
+ "type": "tidelift"
56
+ }
57
+ ]
58
+ }
59
+ ]
v2/vendor/vlucas/valitron/LICENSE.txt ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ The BSD 3-Clause License
2
+ http://opensource.org/licenses/BSD-3-Clause
3
+
4
+ Copyright (c) 2013, Vance Lucas
5
+ All rights reserved.
6
+
7
+ Redistribution and use in source and binary forms, with or without
8
+ modification, are permitted provided that the following conditions are
9
+ met:
10
+
11
+ * Redistributions of source code must retain the above copyright
12
+ notice,
13
+ this list of conditions and the following disclaimer.
14
+ * Redistributions in binary form must reproduce the above copyright
15
+ notice, this list of conditions and the following disclaimer in the
16
+ documentation and/or other materials provided with the distribution.
17
+ * Neither the name of the Vance Lucas nor the names of its contributors
18
+ may be used to endorse or promote products derived from this software
19
+ without specific prior written permission.
20
+
21
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
22
+ IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
23
+ TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
24
+ PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
25
+ HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
26
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
27
+ TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
28
+ PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
29
+ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
30
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
31
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32
+
v2/vendor/vlucas/valitron/lang/ar.php ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ return array(
4
+ 'required' => "مطلوب",
5
+ 'equals' => "يجب أن يكون مساوي لي '%s'",
6
+ 'different' => "يجب ان يكون غير '%s'",
7
+ 'accepted' => "يجب ان يكون نعم",
8
+ 'numeric' => "يجب ان يكون رقم",
9
+ 'integer' => "يجب ان يكون رقم (0-9)",
10
+ 'length' => "يجب ان يكون أطول من %d",
11
+ 'min' => "يجب ان يكون اعلي من %s",
12
+ 'max' => "يجب ان يكون اقل من %s",
13
+ 'in' => "الُمدخل يغير صحيح",
14
+ 'listContains' => "الُمدخل يغير صحيح",
15
+ 'notIn' => "الُمدخل يغير صحيح",
16
+ 'ip' => "رقم الإتصال غير صحيح",
17
+ 'email' => "البريد الألكتروني غير صحيح",
18
+ 'url' => "الرابط غير صحيح",
19
+ 'urlActive' => "يجب أن يكون نطاق فعال",
20
+ 'alpha' => "يجب أن يحتوي فقط علي a-z",
21
+ 'alphaNum' => "يجب ان يحتوي فقط a-z او ارقام 0-9",
22
+ 'slug' => "يجب ان يحتوي فقط علي a-z, و ارقام 0-9, شرطات و خط سفلي",
23
+ 'regex' => "خطا بالصيغة",
24
+ 'date' => "خطا بالتاريخ",
25
+ 'dateFormat' => "يجب ان يكون تاريخ بهذه الصيغة '%s'",
26
+ 'dateBefore' => "التاريخ يجب ان يكون قبل '%s'",
27
+ 'dateAfter' => "التاريخ يجب ان يكون بعد '%s'",
28
+ 'contains' => "يجب ان يحتوي %s"
29
+ );
v2/vendor/vlucas/valitron/lang/az.php ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ return array(
4
+ 'required' => "mütləqdir",
5
+ 'equals' => "'%s' olmalıdır",
6
+ 'different' => "'%s'-dən fərqli olmalıdır",
7
+ 'accepted' => "Qeyd dilməlidir",
8
+ 'numeric' => "rəqəm olmalıdır",
9
+ 'integer' => "tam ədəd olmalıdır",
10
+ 'length' => "%d qədər uzunluğu olmalıdır",
11
+ 'min' => "minimum %s qədər olmalıdır",
12
+ 'max' => "maksimum %s qədər olmalıdır",
13
+ 'listContains' => "yalnış dəyər ehtiva edir",
14
+ 'in' => "yalnış dəyər ehtiva edir",
15
+ 'notIn' => "yalnış dəyər ehtiva edir",
16
+ 'ip' => "düzgün IP ünvanı deyil",
17
+ 'email' => "düzgün email ünvanı deyil",
18
+ 'url' => "URL deyil",
19
+ 'urlActive' => "aktiv domain olmalıdır",
20
+ 'alpha' => "ancaq latın hərfləri ehtiva etməlidir",
21
+ 'alphaNum' => "ancaq latın hərfləri və(və ya) rəqəmlər ehtiva etməlidir",
22
+ 'slug' => "ancaq latın hərfləri,rəqəmlər,tire və altdan xət ehtiva etməlidir",
23
+ 'regex' => "etiabrsız sinvollar ehtiva edir",
24
+ 'date' => "tarix deyil",
25
+ 'dateFormat' => "tarix formatı bu cür olmalıdır: %s",
26
+ 'dateBefore' => "tarix %s -dən əvvəl olmamalıdır",
27
+ 'dateAfter' => "tarix %s -dən sonra olmamalıdır",
28
+ 'contains' => "%s ehtiva etməlidir",
29
+ 'boolean' => "boolen olmalıdır",
30
+ 'lengthBetween' => "%d - %d sinvolları arası ehtiva etməlidir",
31
+ 'creditCard' => "kredir kart nömrəsi olmalıdır",
32
+ "lengthMin" => "%d -dən çox sinvol olmalıdır",
33
+ "lengthMax" => "%d -dən az sinvol olmalıdır",
34
+ "instanceOf" => "'%s' əvəzinə olmalıdır"
35
+ );
v2/vendor/vlucas/valitron/lang/bg.php ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ return array(
4
+ 'required' => "е задължително",
5
+ 'equals' => "трябва да бъде същото като '%s'",
6
+ 'different' => "трябва да бъде различно от '%s'",
7
+ 'accepted' => "трабва да бъде прието",
8
+ 'numeric' => "трябва да бъде число",
9
+ 'integer' => "трябва да бъде цифра (0-9)",
10
+ 'length' => "трябва да бъде %d символа дълго",
11
+ 'min' => "трябвя да бъде поне %s",
12
+ 'max' => "трябва да бъде не повече от %s",
13
+ 'listContains' => "съдържа невалидна стойност",
14
+ 'in' => "съдържа невалидна стойност",
15
+ 'notIn' => "съдържа невалидна стойност",
16
+ 'ip' => "е невалиден IP адрес",
17
+ 'email' => "е невалиден имейл адрес",
18
+ 'url' => "е невалиден URL адрес",
19
+ 'urlActive' => "трябва да бъде активен домейн",
20
+ 'alpha' => "трябва да съдържа само букви a-z",
21
+ 'alphaNum' => "трябва да съдържа само букви a-z и/или цифри 0-9",
22
+ 'slug' => "трябва да съдържа само букви a-z, цифри 0-9, тирета и долни черти",
23
+ 'regex' => "съдържа невалидни символи",
24
+ 'date' => "е невалидна дата",
25
+ 'dateFormat' => "трябва да бъде дата с формат '%s'",
26
+ 'dateBefore' => "трябва да бъде дата преди '%s'",
27
+ 'dateAfter' => "трябва да бъде дата след '%s'",
28
+ 'contains' => "трябв да съдържа %s",
29
+ 'boolean' => "трябва да бъде истина или лъжа",
30
+ 'lengthBetween' => "трябва да бъде между %d и %d символа",
31
+ 'creditCard' => "трябва да бъде валиден номер на кредитна карта",
32
+ 'lengthMin' => "трябва да бъде поне %d символа дълго",
33
+ 'lengthMax' => "не трябва да надвишава %d символа",
34
+ 'instanceOf' => "трябва да бъде инстанция от '%s'"
35
+ );
v2/vendor/vlucas/valitron/lang/de.php ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ return array(
4
+ 'required' => "ist erforderlich",
5
+ 'equals' => "muss identisch mit '%s' sein",
6
+ 'different' => "muss sich von '%s' unterscheiden",
7
+ 'accepted' => "muss markiert sein",
8
+ 'numeric' => "muss eine Zahl sein",
9
+ 'integer' => "muss eine ganze Zahl sein",
10
+ 'length' => "kann nicht länger als %d sein",
11
+ 'min' => "muss größer als %s sein",
12
+ 'max' => "muss kleiner als %s sein",
13
+ 'listContains' => "enthält einen ungültigen Wert",
14
+ 'in' => "enthält einen ungültigen Wert",
15
+ 'notIn' => "enthält einen ungültigen Wert",
16
+ 'ip' => "enthält keine gültige IP-Addresse",
17
+ 'email' => "enthält keine gültige E-Mail-Adresse",
18
+ 'url' => "enthält keine gültige URL",
19
+ 'urlActive' => "muss eine aktive Domain sein",
20
+ 'alpha' => "darf nur Buchstaben enthalten",
21
+ 'alphaNum' => "darf nur Buchstaben und Ganzzahlen enthalten",
22
+ 'slug' => "darf nur Buchstaben, Ganzzahlen, Schrägstriche und Grundstriche enthalten",
23
+ 'regex' => "enthält ungültige Zeichen",
24
+ 'date' => "enthält kein gültiges Datum",
25
+ 'dateFormat' => "benötigt ein Datum im Format '%s'",
26
+ 'dateBefore' => "benötigt ein Datum, das vor dem '%s' liegt",
27
+ 'dateAfter' => "benötigt ein Datum, das nach dem '%s' liegt",
28
+ 'contains' => "muss %s beinhalten",
29
+ 'boolean' => "muss ein Wahrheitswert sein",
30
+ 'lengthBetween' => "benötigt zwischen %d und %d Zeichen",
31
+ 'creditCard' => "muss eine gültige Kreditkartennummer sein",
32
+ "lengthMin" => "muss mindestens %d Zeichen enthalten",
33
+ "lengthMax" => "kann nicht mehr als %d Zeichen enthalten"
34
+ );
v2/vendor/vlucas/valitron/lang/el.php ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ return array(
4
+ 'required' => "είναι απαραίτητο",
5
+ 'equals' => "πρέπει να είναι ίδιο με '%s'",
6
+ 'different' => "πρέπει να διαφέρει από '%s'",
7
+ 'accepted' => "πρέπει να έχει αποδεχτεί",
8
+ 'numeric' => "πρέπει να είναι αριθμός",
9
+ 'integer' => "πρέπει να είναι ακέραιος αριθμός",
10
+ 'length' => "πρέπει να είναι μεγαλύτερο από %d",
11
+ 'min' => "πρέπει να είναι τουλάχιστον %s",
12
+ 'max' => "δεν πρέπει να είναι περισσότερο από %s",
13
+ 'listContains' => "περιέχει μη έγκυρη τιμή",
14
+ 'in' => "περιέχει μη έγκυρη τιμή",
15
+ 'notIn' => "περιέχει μη έγκυρη τιμή",
16
+ 'ip' => "δεν είναι έγκυρη διεύθυνση IP",
17
+ 'email' => "δεν είναι έγκυρη διεύθυνση email",
18
+ 'url' => "δεν είναι URL",
19
+ 'urlActive' => "πρέπει να είναι ενεργό domain",
20
+ 'alpha' => "πρέπει να περιέχει μόνο χαρακτήρες",
21
+ 'alphaNum' => "πρέπει να περιέχει μόνο χαρακτήρες και/ή αριθμούς",
22
+ 'slug' => "πρέπει να περιέχει μόνο χαρακτήρες, αριθμούς, παύλες και κάτω παύλες",
23
+ 'regex' => "περιέχει μη έγκυρους χαρακτήρες",
24
+ 'date' => "δεν είναι έγκυρη ημερομηνία",
25
+ 'dateFormat' => "πρέπει να είναι ημερομηνία της μορφής '%s'",
26
+ 'dateBefore' => "πρέπει να είναι ημερομηνία πριν από '%s'",
27
+ 'dateAfter' => "πρέπει να είναι ημερομηνία μετά από '%s'",
28
+ 'contains' => "πρέπει να περιέχει %s",
29
+ 'boolean' => "πρέπει να είναι boolean",
30
+ 'lengthBetween' => "πρέπει να είναι μεταξύ %d και %d χαρακτήρων",
31
+ 'creditCard' => "πρέπει να είναι ένα έγκυρο νούμερο πιστωτικής κάρτας",
32
+ "lengthMin" => "πρέπει να περιέχει περισσότερους από %d χαρακτήρες",
33
+ "lengthMax" => "πρέπει να περιέχει λιγότερους από %d χαρακτήρες",
34
+ "instanceOf" => "πρέπει να είναι αντικείμενο της '%s'"
35
+ );
v2/vendor/vlucas/valitron/lang/en.php ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ return array(
4
+ 'required' => "is required",
5
+ 'equals' => "must be the same as '%s'",
6
+ 'different' => "must be different than '%s'",
7
+ 'accepted' => "must be accepted",
8
+ 'numeric' => "must be numeric",
9
+ 'integer' => "must be an integer",
10
+ 'length' => "must be %d characters long",
11
+ 'min' => "must be at least %s",
12
+ 'max' => "must be no more than %s",
13
+ 'listContains' => "contains invalid value",
14
+ 'in' => "contains invalid value",
15
+ 'notIn' => "contains invalid value",
16
+ 'ip' => "is not a valid IP address",
17
+ 'ipv4' => "is not a valid IPv4 address",
18
+ 'ipv6' => "is not a valid IPv6 address",
19
+ 'email' => "is not a valid email address",
20
+ 'url' => "is not a valid URL",
21
+ 'urlActive' => "must be an active domain",
22
+ 'alpha' => "must contain only letters a-z",
23
+ 'alphaNum' => "must contain only letters a-z and/or numbers 0-9",
24
+ 'slug' => "must contain only letters a-z, numbers 0-9, dashes and underscores",
25
+ 'regex' => "contains invalid characters",
26
+ 'date' => "is not a valid date",
27
+ 'dateFormat' => "must be date with format '%s'",
28
+ 'dateBefore' => "must be date before '%s'",
29
+ 'dateAfter' => "must be date after '%s'",
30
+ 'contains' => "must contain %s",
31
+ 'boolean' => "must be a boolean",
32
+ 'lengthBetween' => "must be between %d and %d characters",
33
+ 'creditCard' => "must be a valid credit card number",
34
+ 'lengthMin' => "must be at least %d characters long",
35
+ 'lengthMax' => "must not exceed %d characters",
36
+ 'instanceOf' => "must be an instance of '%s'",
37
+ 'containsUnique' => "must contain unique elements only",
38
+ 'requiredWith' => "is required",
39
+ 'requiredWithout'=> "is required",
40
+ 'subset' => "contains an item that is not in the list",
41
+ 'arrayHasKeys' => "does not contain all required keys",
42
+ );
v2/vendor/vlucas/valitron/lang/es.php ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ return array(
4
+ 'required' => "es obligatorio",
5
+ 'equals' => "debe ser igual a '%s'",
6
+ 'different' => "debe ser diferente a '%s'",
7
+ 'accepted' => "debe ser aceptado",
8
+ 'numeric' => "debe ser numérico",
9
+ 'integer' => "debe ser un entero",
10
+ 'length' => "debe ser mas largo de %d",
11
+ 'min' => "debe ser mayor de %s",
12
+ 'max' => "debe ser menor de %s",
13
+ 'in' => "contiene un valor inválido",
14
+ 'notIn' => "contiene un valor inválido",
15
+ 'ip' => "no es una dirección IP",
16
+ 'email' => "no es un correo electrónico válido",
17
+ 'url' => "no es una URL",
18
+ 'urlActive' => "debe ser un dominio activo",
19
+ 'alpha' => "debe contener solo letras a-z",
20
+ 'alphaNum' => "debe contener solo letras a-z o números 0-9",
21
+ 'slug' => "debe contener solo letras a-z, números 0-9, barras y guiones bajos",
22
+ 'regex' => "contiene caracteres inválidos",
23
+ 'date' => "no es una fecha válida",
24
+ 'dateFormat' => "debe ser una fecha con formato '%s'",
25
+ 'dateBefore' => "debe ser una fecha antes de '%s'",
26
+ 'dateAfter' => "debe ser una fecha después de '%s'",
27
+ 'contains' => "debe contener %s",
28
+ 'boolean' => "debe ser booleano",
29
+ 'lengthBetween' => "debe tener entre %d y %d caracteres",
30
+ 'creditCard' => "debe ser un numero de tarjeta de crédito válido",
31
+ "lengthMin" => "debe tener al menos %d caracteres",
32
+ "lengthMax" => "debe tener menos de %d caracteres",
33
+ "instanceOf" => "debe ser una instancia de '%s'",
34
+ 'containsUnique' => "debe contener solo valores únicos",
35
+ 'subset' => "contiene un elemento que no está en la lista",
36
+ 'arrayHasKeys' => "no contiene todas las claves requeridas"
37
+ );
v2/vendor/vlucas/valitron/lang/fi.php ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ return array(
4
+ 'required' => "vaaditaan",
5
+ 'equals' => "ei ole sama kuin '%s'",
6
+ 'different' => "on sama kuin '%s'",
7
+ 'accepted' => "ei ole hyväksytty",
8
+ 'numeric' => "ei ole numeerinen",
9
+ 'integer' => "ei ole kokonaisluku",
10
+ 'length' => "on lyhyempi kuin %d",
11
+ 'min' => "ei ole vähintään %s",
12
+ 'max' => "ei ole enintään %s",
13
+ 'listContains' => "sisältää virheellisen arvon",
14
+ 'in' => "sisältää virheellisen arvon",
15
+ 'notIn' => "sisältää virheellisen arvon",
16
+ 'ip' => "ei ole oikeanmuotoinen IP-osoite",
17
+ 'email' => "ei ole oikeanmuotoinen sähköpostiosoite",
18
+ 'url' => "ei ole URL",
19
+ 'urlActive' => "ei ole aktiivinen verkkotunnus",
20
+ 'alpha' => "sisältää muita merkkejä kuin a-z",
21
+ 'alphaNum' => "sisältää muita merkkejä kuin a-z ja 0-9",
22
+ 'slug' => "sisältää muita merkkejä kuin a-z, 0-9, - ja _",
23
+ 'regex' => "sisältää virheellisiä merkkejä",
24
+ 'date' => "ei ole oikeanmuotoinen päivämäärä",
25
+ 'dateFormat' => "ei ole päivämäärä muotoa '%s'",
26
+ 'dateBefore' => "ei ole päivämäärä ennen '%s'",
27
+ 'dateAfter' => "ei ole päivämäärä '%s' jälkeen",
28
+ 'contains' => "ei sisällä merkkijonoa %s",
29
+ 'boolean' => "ei ole totuusarvo",
30
+ 'lengthBetween' => "ei ole %d-%d merkkiä pitkä",
31
+ 'creditCard' => "ei ole pätevä luottokortin numero",
32
+ "lengthMin" => "ei ole vähintään %d merkkiä pitkä",
33
+ "lengthMax" => "ei ole enintään %d merkkiä pitkä",
34
+ "instanceOf" => "ei ole luokan '%s' ilmentymä"
35
+ );
v2/vendor/vlucas/valitron/lang/fr.php ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ return array(
4
+ 'required' => "est obligatoire",
5
+ 'equals' => "doit être identique à '%s'",
6
+ 'different' => "doit être différent de '%s'",
7
+ 'accepted' => "doit être accepté",
8
+ 'numeric' => "doit être numérique",
9
+ 'integer' => "doit être un entier",
10
+ 'length' => "doit être plus long que %d",
11
+ 'min' => "doit être plus grand que %s",
12
+ 'max' => "doit être plus petit que %s",
13
+ 'listContains' => "contient une valeur non valide",
14
+ 'in' => "contient une valeur non valide",
15
+ 'notIn' => "contient une valeur non valide",
16
+ 'ip' => "n'est pas une adresse IP valide",
17
+ 'email' => "n'est pas une adresse email valide",
18
+ 'url' => "n'est pas une URL",
19
+ 'urlActive' => "doit être un domaine actif",
20
+ 'alpha' => "doit contenir uniquement les lettres a-z",
21
+ 'alphaNum' => "doit contenir uniquement des lettres de a-z et/ou des chiffres 0-9",
22
+ 'slug' => "doit contenir uniquement des lettres de a-z, des chiffres 0-9, des tirets et des traits soulignés",
23
+ 'regex' => "contient des caractères invalides",
24
+ 'date' => "n'est pas une date valide",
25
+ 'dateFormat' => "doit être une date avec le format '%s'",
26
+ 'dateBefore' => "doit être une date avant '%s'",
27
+ 'dateAfter' => "doit être une date après '%s'",
28
+ 'contains' => "doit contenir %s",
29
+ 'boolean' => "doit être un booléen",
30
+ 'lengthBetween' => "doit être entre %d et %d caractères",
31
+ 'creditCard' => "doit être un numéro de carte de crédit valide",
32
+ 'lengthMin' => "doit avoir au moins %d caractères",
33
+ 'lengthMax' => "ne doit pas dépasser %d caractères",
34
+ 'instanceOf' => "doit être une instance de '%s'",
35
+ "containsUnique" => "doit contenir des élements unique",
36
+ "requiredWith" => "est requis",
37
+ "requiredWithout" => "est requis",
38
+ "subset" => "contient un élement qui n'est pas dans la liste",
39
+ "arrayHasKeys" => "ne contient pas toutes les clés requises"
40
+ );
v2/vendor/vlucas/valitron/lang/id.php ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ return array(
4
+ 'required' => "harus diisi",
5
+ 'equals' => "harus sama dengan '%s'",
6
+ 'different' => "harus berbeda dengan '%s'",
7
+ 'accepted' => "harus diterima (accepted)",
8
+ 'numeric' => "harus berupa nomor/angka",
9
+ 'integer' => "harus berupa nilai integer",
10
+ 'length' => "harus lebih panjang dari %d",
11
+ 'min' => "harus lebih besar dari %s",
12
+ 'max' => "harus kurang dari %s",
13
+ 'listContains' => "berisi nilai/value yang tidak valid",
14
+ 'in' => "berisi nilai/value yang tidak valid",
15
+ 'notIn' => "berisi nilai/value yang tidak valid",
16
+ 'ip' => "format alamat IP tidak benar",
17
+ 'email' => "format alamat email tidak benar",
18
+ 'url' => "bukan format URL yang benar",
19
+ 'urlActive' => "harus berupa domain aktif",
20
+ 'alpha' => "hanya boleh menggunakan huruf a-z",
21
+ 'alphaNum' => "hanya boleh menggunakan huruf a-z dan atau nomor 0-9",
22
+ 'slug' => "hanya boleh menggunakan huruf a-z, nomor 0-9, tanda minus (-), dan uderscore atau strip bawah (_)",
23
+ 'regex' => "berisi karakter yang tidak valid",
24
+ 'date' => "format tanggal tidak valid",
25
+ 'dateFormat' => "harus berupa tanggal dengan format '%s'",
26
+ 'dateBefore' => "tanggal harus sebelum tanggal '%s'",
27
+ 'dateAfter' => "tanggal harus sesudah tanggal '%s'",
28
+ 'contains' => "harus berisi %s",
29
+ 'boolean' => "harus berupa nilai boolean",
30
+ 'lengthBetween' => "harus diantara karakter %d dan %d",
31
+ 'creditCard' => "nomor kartu kredit harus valid",
32
+ "lengthMin" => "minimal berisi %d karakter",
33
+ "lengthMax" => "maksimal berisi %d karakter"
34
+ );
v2/vendor/vlucas/valitron/lang/it.php ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ return array(
4
+ 'required' => "è obbligatorio",
5
+ 'equals' => "deve essere uguale a '%s'",
6
+ 'different' => "deve essere differente da '%s'",
7
+ 'accepted' => "deve essere accettato",
8
+ 'numeric' => "deve essere numerico",
9
+ 'integer' => "deve essere un intero",
10
+ 'length' => "deve avere una lunghezza di %d",
11
+ 'min' => "deve essere superiore a %s",
12
+ 'max' => "deve essere inferiore a %s",
13
+ 'listContains' => "contiene un valore non valido",
14
+ 'in' => "contiene un valore non valido",
15
+ 'notIn' => "contiene un valore non valido",
16
+ 'ip' => "non è un indirizzo IP valido",
17
+ 'email' => "non è un indirizzo email valido",
18
+ 'url' => "non è una URL",
19
+ 'urlActive' => "deve essere un dominio attivo",
20
+ 'alpha' => "deve contenere solamente lettere (a-z)",
21
+ 'alphaNum' => "deve contenere solamente lettere (a-z) e/o numeri (0-9)",
22
+ 'slug' => "deve contenere solamente lettere (a-z), numeri (0-9), trattini (-) e trattini bassi (_)",
23
+ 'regex' => "contiene caratteri non validi",
24
+ 'date' => "non è una data valida",
25
+ 'dateFormat' => "deve essere una data nel formato '%s'",
26
+ 'dateBefore' => "deve essere una data precedente al '%s'",
27
+ 'dateAfter' => "deve essere una data successiva al '%s'",
28
+ 'contains' => "deve contenere %s",
29
+ 'boolean' => "deve essere un booleano",
30
+ 'lengthBetween' => "deve essere compreso tra %d e %d caratteri",
31
+ 'creditCard' => "deve essere un numero di carta di credito valido",
32
+ 'lengthMin' => "deve essere lungo almeno %d caratteri",
33
+ 'lengthMax' => "non deve superare %d caratteri",
34
+ 'instanceOf' => "deve essere un'istanza di '%s'",
35
+ );
v2/vendor/vlucas/valitron/lang/ja.php ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ return array(
4
+ 'required' => "を入力してください",
5
+ 'equals' => "は「%s」と同じ内容を入力してください",
6
+ 'different' => "は「%s」と異なる内容を入力してください",
7
+ 'accepted' => "に同意してください",
8
+ 'numeric' => "は数値を入力してください",
9
+ 'integer' => "は半角数字で入力してください",
10
+ 'length' => "は%d文字で入力してください",
11
+ 'min' => "には%sより大きな値を入力してください",
12
+ 'max' => "には%sより小さな値を入力してください",
13
+ 'listContains' => "には選択できない値が含まれています",
14
+ 'in' => "には選択できない値が含まれています",
15
+ 'notIn' => "には選択できない値が含まれています",
16
+ 'ip' => "はIPアドレスの書式として正しくありません",
17
+ 'email' => "はメールアドレスの書式として正しくありません",
18
+ 'url' => "はURLの書式として正しくありません",
19
+ 'urlActive' => "はアクティブなドメインではありません",
20
+ 'alpha' => "は半角英字で入力してください",
21
+ 'alphaNum' => "は半角英数字で入力してください",
22
+ 'slug' => "は半角英数字、もしくは「-」「_」の文字で入力してください",
23
+ 'regex' => "の書式が正しくありません",
24
+ 'date' => "は日付の書式として正しくありません",
25
+ 'dateFormat' => "は「%s」の書式で日付を入力してください",
26
+ 'dateBefore' => "は「%s」以前の日付を入力してください",
27
+ 'dateAfter' => "は「%s」以後の日付を入力してください",
28
+ 'contains' => "は「%s」を含んでいなければいけません",
29
+ 'boolean' => "は真偽値である必要があります",
30
+ 'lengthBetween' => "は%d〜%d文字で入力してください",
31
+ 'creditCard' => "はクレジットカード番号の書式として正しくありません",
32
+ 'lengthMin' => "は%d文字以上入力してください",
33
+ 'lengthMax' => "は%d文字以内で入力してください",
34
+ 'instanceOf' => "は「%s」のインスタンスではありません",
35
+ );
v2/vendor/vlucas/valitron/lang/ko.php ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ return array(
4
+ 'required' => "을(를) 입력해야 합니다.",
5
+ 'equals' => "은(는) '%s'와(과) 같아야 합니다.",
6
+ 'different' => "은(는) '%s'와(과) 달라야 합니다.",
7
+ 'accepted' => "을(를) 동의해야 합니다.",
8
+ 'numeric' => "은(는) 숫자여야 합니다.",
9
+ 'integer' => "은(는) 정수여야 합니다.",
10
+ 'length' => "의 길이는 %d 이어야 합니다.",
11
+ 'min' => "은(는) %s 이상이어야 합니다.",
12
+ 'max' => "은(는) %s 이하여야 합니다.",
13
+ 'listContains' => "은(는) 올바르지 않은 값을 포함하고 있습니다.",
14
+ 'in' => "은(는) 올바르지 않은 값을 포함하고 있습니다.",
15
+ 'notIn' => "은(는) 올바르지 않은 값을 포함하고 있습니다.",
16
+ 'ip' => "은(는) 올바르지 않은 IP입니다.",
17
+ 'email' => "은(는) 올바르지 않은 email입니다.",
18
+ 'url' => "은(는) 올바르지 않은 URL입니다.",
19
+ 'urlActive' => "은(는) 접속 가능한 도메인이어야 합니다.",
20
+ 'alpha' => "은(는) 영문자(a-z)로만 이루어져야 합니다.",
21
+ 'alphaNum' => "은(는) 영문자(a-z)와 숫자(0-9)로만 이루어져야 합니다.",
22
+ 'slug' => "은(는) 영문자(a-z)와 숫자(0-9), 특수문자 -와 _로만 이루어져야 합니다.",
23
+ 'regex' => "은(는) 올바르지 않은 문자를 포함하고 있습니다.",
24
+ 'date' => "은(는) 올바르지 않은 날짜입니다.",
25
+ 'dateFormat' => "은(는) '%s' 형태의 날짜여야 합니다.",
26
+ 'dateBefore' => "은(는) '%s' 보다 이전이어야 합니다.",
27
+ 'dateAfter' => "은(는) '%s' 보다 이후여야 합니다.",
28
+ 'contains' => "은(는) '%s'을(를) 포함해야 합니다.",
29
+ 'boolean' => "은(는) boolean이어야 합니다.",
30
+ 'lengthBetween' => "의 길이는 %d에서 %d 사이여야 합니다.",
31
+ 'creditCard' => "은(는) 올바른 신용카드 번호가 아닙니다.",
32
+ 'lengthMin' => "의 길이는 %d 이상이어야 합니다.",
33
+ 'lengthMax' => "의 길이는 %d을(를) 넘을 수 없습니다.",
34
+ 'instanceOf' => "는 '%s'의 객체여야 합니다."
35
+ );
v2/vendor/vlucas/valitron/lang/lt.php ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ return array(
3
+ 'required' => "yra privalomas",
4
+ 'equals' => "reikšmė turi būti tokia pati, kaip „%s“",
5
+ 'different' => "turi būti kitokia, nei „%s“",
6
+ 'accepted' => "turi būti priimta",
7
+ 'numeric' => "turi būti sveikasis skaičius",
8
+ 'integer' => "turi būti skaičius",
9
+ 'length' => "turi būti %d ženklų ilgio",
10
+ 'min' => "turi būti bent %s",
11
+ 'max' => "turi būti ne daugiau kaip %s",
12
+ 'listContains' => "turi neteisingą vertę",
13
+ 'in' => "turi neteisingą vertę",
14
+ 'notIn' => "turi neteisingą vertę",
15
+ 'ip' => "nėra teisingas IP adresas",
16
+ 'ipv4' => "nėra teisingas IPv4 adresas",
17
+ 'ipv6' => "nėra teisingas IPv6 adresas",
18
+ 'email' => "nėra teisingas el. pašto adresas",
19
+ 'url' => "nėra teisingas URL",
20
+ 'urlActive' => "turi būti aktyvus domenas",
21
+ 'alpha' => "turi turėti tik raides a-ž",
22
+ 'alphaNum' => "turi turėti tik raides a-ž ir/ar skaičius 0-9",
23
+ 'slug' => "turi turėti tik raides a-ž, skaičius 0-9, brukšnelius ir apatinius brukšnelius",
24
+ 'regex' => "yra neteisingų ženklų",
25
+ 'date' => "nėra teisinga data",
26
+ 'dateFormat' => "turi būti „%s“ formato data",
27
+ 'dateBefore' => "turi būti data, ankstesnė nei „%s“",
28
+ 'dateAfter' => "turi būti data, vėlesnė nei „%s“",
29
+ 'contains' => "turi turėti %s",
30
+ 'boolean' => "turi būti būlio (taip/ne) tipo",
31
+ 'lengthBetween' => "turi būti nuo %d iki %d ilgio",
32
+ 'creditCard' => "turi būti teisingas kreditinės kortelės numeris",
33
+ 'lengthMin' => "turi būti bent %d ženklų ilgio",
34
+ 'lengthMax' => "turi būti ne ilgesnis nei %d ženklų",
35
+ 'instanceOf' => "turi būti „%s“ atvejis",
36
+ 'containsUnique' => "turi turėti tik unikalius elementus",
37
+ 'subset' => "turi elementą, kurio nėra sąraše"
38
+ );
v2/vendor/vlucas/valitron/lang/lv.php ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ return array(
4
+ 'required' => "ir obligāts lauks",
5
+ 'equals' => "jāsakrīt ar '%s'",
6
+ 'different' => "nedrīkst sakrist ar '%s' lauku",
7
+ 'accepted' => "laukam jābūt apstiprinātam",
8
+ 'numeric' => "jābūt skaitliskai vērtībai",
9
+ 'integer' => "jābūt ciparam (0-9)",
10
+ 'length' => "nedrīkst būt garāks par %d simboliem",
11
+ 'min' => "jābūt garākam par %s simboliem",
12
+ 'max' => "jābūt īsākam par %s simboliem",
13
+ 'listContains' => "lauks satur nederīgu vērtību",
14
+ 'in' => "lauks satur nederīgu vērtību",
15
+ 'notIn' => "lauks satur nederīgu vērtību",
16
+ 'ip' => " lauks nav derīga IP adrese",
17
+ 'email' => "lauks nav norādīta derīga epasta adrese",
18
+ 'url' => "lauks nav tīmekļa saite",
19
+ 'urlActive' => "saite neatrodas esošajā domēna vārdā",
20
+ 'alpha' => "lauks var saturēt tikai alfabēta burtus a-z",
21
+ 'alphaNum' => "lauks var saturēt tikai alfabēta burtus un/vai ciparus 0-9",
22
+ 'slug' => "lauks var saturēt tikai alfabēta burtus un/vai ciparus 0-9, domuzīmes and zemsvītras",
23
+ 'regex' => "lauks satur nederīgus simbolus",
24
+ 'date' => "lauks ir nederīgā datuma formātā",
25
+ 'dateFormat' => "laukam jābūt datuma formātā '%s'",
26
+ 'dateBefore' => "lauka datumam jābūt pirms '%s'",
27
+ 'dateAfter' => "lauka datumam jābūt pēc '%s'",
28
+ 'contains' => "laukam jāsatur %s",
29
+ 'boolean' => "laukam jābūt ir/nav vērtībai",
30
+ 'lengthBetween' => "lauka garumam jābūt no %d līdz %d simbolu garam",
31
+ 'creditCard' => "laukam jābūt derīgam kredītkartes numuram"
32
+ );
v2/vendor/vlucas/valitron/lang/nb.php ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ // Norwegian Bokmål (nb)
3
+ return array(
4
+ 'required' => "er påkrevd",
5
+ 'equals' => "må være lik '%s'",
6
+ 'different' => "må være annerledes enn '%s'",
7
+ 'accepted' => "må aksepteres",
8
+ 'numeric' => "må være numerisk",
9
+ 'integer' => "må være et heltall",
10
+ 'length' => "må være %d tegn langt",
11
+ 'min' => "må være minst %s",
12
+ 'max' => "må ikke være mer enn %s",
13
+ 'listContains' => "inneholder ugyldig verdi",
14
+ 'in' => "inneholder ugyldig verdi",
15
+ 'notIn' => "inneholder ugyldig verdi",
16
+ 'ip' => "er ikke en gyldig IP adresse",
17
+ 'ipv4' => "er ikke en gyldig IPv4 adresse",
18
+ 'ipv6' => "er ikke en gyldig IPv6 adresse",
19
+ 'email' => "er ikke en gyldig e-postadresse",
20
+ 'url' => "er ikke en gyldig URL",
21
+ 'urlActive' => "må være et aktivt domene",
22
+ 'alpha' => "må bare innholde bokstaver a-z",
23
+ 'alphaNum' => "må bare innholde bokstaver a-z og/eller tall 0-9",
24
+ 'slug' => "må bare innholde bokstaver a-z og/eller tall 0-9, bindestreker og understreker",
25
+ 'regex' => "inneholder ulovlige tegn",
26
+ 'date' => "er ikke en gyldig dato",
27
+ 'dateFormat' => "må være en dato med format '%s'",
28
+ 'dateBefore' => "må være en dato før '%s'",
29
+ 'dateAfter' => "må være en dato etter '%s'",
30
+ 'contains' => "må inneholde %s",
31
+ 'boolean' => "må være en boolsk verdi",
32
+ 'lengthBetween' => "må være mellom %d og %d tegn",
33
+ 'creditCard' => "må være et gyldig kredittkortnummer",
34
+ 'lengthMin' => "må være minst %d tegn langt",
35
+ 'lengthMax' => "må ikke overstige %d tegn",
36
+ 'instanceOf' => "må være en instans av '%s'",
37
+ 'containsUnique'=> "må inneholde kun unike elementer",
38
+ 'subset' => "inneholder et element som ikke er i listen"
39
+ );
v2/vendor/vlucas/valitron/lang/nl.php ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ return array(
4
+ 'required' => "is verplicht",
5
+ 'equals' => "moet gelijk zijn aan '%s'",
6
+ 'different' => "moet verschillend zijn van '%s'",
7
+ 'accepted' => "moet aanvaard worden",
8
+ 'numeric' => "moet numeriek zijn",
9
+ 'integer' => "moet een cijfer zijn",
10
+ 'length' => "moet minstens %d karakters lang zijn",
11
+ 'min' => "moet minstens %s zijn",
12
+ 'max' => "mag niet meer zijn dan %s",
13
+ 'listContains' => "bevat een ongeldige waarde",
14
+ 'in' => "bevat een ongeldige waarde",
15
+ 'notIn' => "bevat een ongeldige waarde",
16
+ 'ip' => "is geen geldig IP-adres",
17
+ 'email' => "is geen geldig e-mailadres",
18
+ 'url' => "is geen geldige URL",
19
+ 'urlActive' => "moet een actief domein zijn",
20
+ 'alpha' => "mag enkel letters (a-z) bevatten",
21
+ 'alphaNum' => "mag enkel letters (a-z) en/of cijfers (0-9) bevatten",
22
+ 'slug' => "mag enkel letters (a-z), cijfers (0-9) en liggende streepjes (_,-) bevatten",
23
+ 'regex' => "bevat ongeldige karakters",
24
+ 'date' => "is geen geldige datum",
25
+ 'dateFormat' => "moet een datum zijn in het formaat '%s'",
26
+ 'dateBefore' => "moet een datum voor '%s' zijn",
27
+ 'dateAfter' => "moet een datum na '%s' zijn",
28
+ 'contains' => "moet '%s' bevatten",
29
+ 'boolean' => "moet een booleaanse waarde zijn",
30
+ 'lengthBetween' => "moet tussen %d en %d karakters lang zijn",
31
+ 'creditCard' => "moet een geldig kredietkaartnummer zijn",
32
+ "lengthMin" => "moet meer dan %d karakters lang zijn",
33
+ "lengthMax" => "mag niet meer dan %d karakters lang zijn",
34
+ "instanceOf" => "moet een instantie zijn van '%s'"
35
+ );
v2/vendor/vlucas/valitron/lang/nn.php ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ return array(
4
+ 'required' => "er nødvendig",
5
+ 'equals' => "må være de samme som '%s'",
6
+ 'different' => "må være annerledes enn '%s'",
7
+ 'accepted' => "må aksepteres",
8
+ 'numeric' => "må være numerisk",
9
+ 'integer' => "må være et heltall",
10
+ 'length' => "må være %d tegn",
11
+ 'min' => "må være minst %s",
12
+ 'max' => "må ikke være mer enn %s",
13
+ 'listContains' => "inneholder ugyldig verdi",
14
+ 'in' => "inneholder ugyldig verdi",
15
+ 'notIn' => "inneholder ugyldig verdi",
16
+ 'ip' => "er ikkje ein gyldig IP Adresse",
17
+ 'email' => "er ikkje ein gyldig E-post adresse",
18
+ 'url' => "er ikkje ein gyldig URL",
19
+ 'urlActive' => "må være eit aktivt domene",
20
+ 'alpha' => "må bare innholde bokstaver a-z",
21
+ 'alphaNum' => "må bare innholde bokstaver a-z og/eller tall 0-9",
22
+ 'slug' => "må bare innholde bokstaver a-z og/eller tall 0-9, bindestreker og understreker",
23
+ 'regex' => "inneholder ulovlige tegn",
24
+ 'date' => "er ikkje ein gylid dato",
25
+ 'dateFormat' => "må være ein dato med formatet '%s'",
26
+ 'dateBefore' => "må være ein dato før '%s'",
27
+ 'dateAfter' => "må være ein dato etter '%s'",
28
+ 'contains' => "må inneholde %s",
29
+ 'boolean' => "må være ein boolsk verdi",
30
+ 'lengthBetween' => "må være imellom %d og %d tegn",
31
+ 'creditCard' => "må være et gyldig kredittkortnummer",
32
+ 'lengthMin' => "må være minst %d tegn",
33
+ 'lengthMax' => "må ikkje overstige %d tegn",
34
+ 'instanceOf' => "må være ein instans av '%s'"
35
+ );
v2/vendor/vlucas/valitron/lang/no.php ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ <?php
2
+
3
+ return include __DIR__ . '/nn.php';
v2/vendor/vlucas/valitron/lang/pl.php ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ return array(
4
+ 'required' => "jest wymagane",
5
+ 'equals' => "musi być takie same jak '%s'",
6
+ 'different' => "musi być różne od '%s'",
7
+ 'accepted' => "musi być zaakceptowane",
8
+ 'numeric' => "musi być liczbą",
9
+ 'integer' => "musi być liczbą całkowitą",
10
+ 'length' => "musi być dłuższe niż %d",
11
+ 'min' => "musi być przynajmniej %s",
12
+ 'max' => "nie może być większe niż %s",
13
+ 'listContains' => "zawiera nieprawidłową wartość",
14
+ 'in' => "zawiera nieprawidłową wartość",
15
+ 'notIn' => "zawiera nieprawidłową wartość",
16
+ 'ip' => "nie jest prawidłowym adresem IP",
17
+ 'email' => "nie jest prawidłowym adresem email",
18
+ 'url' => "nie jest URL",
19
+ 'urlActive' => "musi być aktywną domeną",
20
+ 'alpha' => "musi zawierać tylko litery a-z",
21
+ 'alphaNum' => "musi zawierać tylko litery a-z i/lub cyfry 0-9",
22
+ 'slug' => "musi zawierać tylko litery a-z i/lub cyfry 0-9, myślinik I podkreślnik",
23
+ 'regex' => "zawiera nieprawidłowe znaki",
24
+ 'date' => "nie jest prawidłową datą",
25
+ 'dateFormat' => "Data musi być w formacie '%s'",
26
+ 'dateBefore' => "Data musi występować przed '%s'",
27
+ 'dateAfter' => "Data musi następować po '%s'",
28
+ 'contains' => "Musi zawierać %s",
29
+ 'boolean' => "musi być wartością logiczną",
30
+ 'lengthBetween' => "ilość znaków musi być między %d a %d",
31
+ 'creditCard' => "musi być prawidłowym numerem karty kredytowej",
32
+ "lengthMin" => "musi zawierać więcej niż %d znaków",
33
+ "lengthMax" => "musi zawierać mniej niż %d znaków",
34
+ "instanceOf" => "musi być instancją '%s'",
35
+ );
v2/vendor/vlucas/valitron/lang/pt-br.php ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ return array(
4
+ 'required' => "é obrigatório",
5
+ 'equals' => "deve ser o mesmo que '%s'",
6
+ 'different' => "deve ser diferente de '%s'",
7
+ 'accepted' => "deve ser aceito",
8
+ 'numeric' => "deve ser um número",
9
+ 'integer' => "deve ser um inteiro",
10
+ 'length' => "deve ter %d caracteres",
11
+ 'min' => "deve ser maior que %s",
12
+ 'max' => "deve ser menor que %s",
13
+ 'in' => "contém um valor inválido",
14
+ 'notIn' => "contém um valor inválido",
15
+ 'ip' => "não é um IP válido",
16
+ 'email' => "não é um email válido",
17
+ 'url' => "não é uma URL válida",
18
+ 'urlActive' => "deve ser um domínio ativo",
19
+ 'alpha' => "deve conter as letras a-z",
20
+ 'alphaNum' => "deve conter apenas letras a-z e/ou números 0-9",
21
+ 'slug' => "deve conter apenas letras a-z, números 0-9, ou os caracteres - ou _",
22
+ 'regex' => "contém caracteres inválidos",
23
+ 'date' => "não é uma data válida",
24
+ 'dateFormat' => "deve ser uma data no formato '%s'",
25
+ 'dateBefore' => "deve ser uma data anterior a '%s'",
26
+ 'dateAfter' => "deve ser uma data posterior a '%s'",
27
+ 'contains' => "deve conter %s",
28
+ 'boolean' => "deve ser um booleano",
29
+ 'lengthBetween' => "deve estar entre %d e %d caracteres",
30
+ 'creditCard' => "deve ser um numero de cartão de credito válido",
31
+ 'lengthMin' => "deve ter ao menos %d caracteres",
32
+ 'lengthMax' => "não deve exceder %d caracteres",
33
+ 'instanceOf' => "deve ser uma instância de '%s'",
34
+ 'containsUnique' => "deve conter apenas valores únicos",
35
+ 'subset' => "contém um item que não está na lista",
36
+ 'arrayHasKeys' => "não contém todas as chaves requeridas"
37
+ );
v2/vendor/vlucas/valitron/lang/ro.php ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ return array(
4
+ 'required' => "se cere",
5
+ 'equals' => "trebuie sa fie la fel ca '%s'",
6
+ 'different' => "trebuie sa fie diferit de '%s'",
7
+ 'accepted' => "trebuie sa fie acceptat",
8
+ 'numeric' => "trebuie sa fie numeric",
9
+ 'integer' => "trebuie sa fie intreg",
10
+ 'length' => "trebuie sa fie mai lung decat %d",
11
+ 'min' => "trebuie sa fie cel putin %s",
12
+ 'max' => "nu trebuie sa fie mai mult de %s",
13
+ 'listContains' => "contine caractere invalide",
14
+ 'in' => "contine caractere invalide",
15
+ 'notIn' => "contine o valoare invalida",
16
+ 'ip' => "nu este o adresa IP valida",
17
+ 'email' => "nu este o adresa de email valida",
18
+ 'url' => "nu este un URL",
19
+ 'urlActive' => "trebuie sa fie un domeniu activ",
20
+ 'alpha' => "trebuie sa contina doar litere de la a-z",
21
+ 'alphaNum' => "trebuie sa contina doar numere de la a-z si/sau numere 0-9",
22
+ 'slug' => "trebuie sa contina doar litere de la a-z, numere de la 0-9, cratime si underline '_'",
23
+ 'regex' => "contine caractere invalide",
24
+ 'date' => "nu este o data valida",
25
+ 'dateFormat' => "trebuie sa fie o data care sa aiba forma '%s'",
26
+ 'dateBefore' => "trebuie sa fie o data inainte de '%s'",
27
+ 'dateAfter' => "trebuie sa fie o data dupa '%s'",
28
+ 'contains' => "trebuie sa contina %s",
29
+ 'boolean' => "trebuie sa fie o constructie logica",
30
+ 'lengthBetween' => "trebuie sa contina intre %d si %d caractere",
31
+ 'creditCard' => "trebuie sa fie nu numar de card de credit valid",
32
+ "lengthMin" => "trebuie sa contina caractere mai multe decat %d",
33
+ "lengthMax" => "trebuie sa contina mai putin de %d caractere",
34
+ "instanceOf" => "trebuie sa fie un exemplu de '%s’",
35
+ );
v2/vendor/vlucas/valitron/lang/ru.php ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ return array(
4
+ 'required' => "обязательно для заполнения",
5
+ 'equals' => "должно совпадать со значением '%s'",
6
+ 'different' => "должно отличаться от '%s'",
7
+ 'accepted' => "должно быть указано",
8
+ 'numeric' => "должно содержать числовое значение",
9
+ 'integer' => "должно быть числом",
10
+ 'length' => "должно быть длиннее, чем %d",
11
+ 'min' => "должно быть не менее, чем %s",
12
+ 'max' => "должно быть не более, чем %s",
13
+ 'listContains' => "содержит неверное значение",
14
+ 'in' => "содержит неверное значение",
15
+ 'notIn' => "содержит неверное значение",
16
+ 'ip' => "не является валидным IP адресом",
17
+ 'ipv4' => "не является валидным IPv4 адресом",
18
+ 'ipv6' => "не является валидным IPv6 адресом",
19
+ 'email' => "не является валидным email адресом",
20
+ 'url' => "не является валидной ссылкой",
21
+ 'urlActive' => "содержит не активную ссылку",
22
+ 'alpha' => "должно содержать только латинские символы",
23
+ 'alphaNum' => "должно содержать только латинские символы и/или цифры",
24
+ 'slug' => "должно содержать только латинские символы, цифры, тире и подчёркивания",
25
+ 'regex' => "содержит недопустимые символы",
26
+ 'date' => "не является датой",
27
+ 'dateFormat' => "должно содержать дату следующего формата: %s",
28
+ 'dateBefore' => "должно содержать дату не позднее, чем %s",
29
+ 'dateAfter' => "должно содержать дату не ранее, чем %s",
30
+ 'contains' => "должно содержать %s",
31
+ 'boolean' => "должно содержать логическое значение",
32
+ 'lengthBetween' => "должно содержать от %d до %d символов",
33
+ 'creditCard' => "должно быть номером кредитной карты",
34
+ 'lengthMin' => "должно содержать более %d символов",
35
+ 'lengthMax' => "должно содержать менее %d символов",
36
+ 'instanceOf' => "должно быть объектом класса '%s'",
37
+ 'containsUnique' => "должно содержать только уникальные элементы",
38
+ 'subset' => "содержит элемент, не указанный в списке",
39
+ );
v2/vendor/vlucas/valitron/lang/sk.php ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ return array(
4
+ 'required' => "je povinná položka",
5
+ 'equals' => "musí byť rovnaký ako '%s'",
6
+ 'different' => "musí byť rôzny od '%s'",
7
+ 'accepted' => "musí byť akceptovaný",
8
+ 'numeric' => "musí byť číslo",
9
+ 'integer' => "musí byť celé číslo",
10
+ 'length' => "musí byť dlhý aspoň %d",
11
+ 'min' => "musí byť dlhý minimálne %s",
12
+ 'max' => "musí byť maximálne %s",
13
+ 'listContains' => "obsahuje nepovolenú hodnotu",
14
+ 'in' => "obsahuje nepovolenú hodnotu",
15
+ 'notIn' => "obsahuje nepovolenú hodnotu",
16
+ 'ip' => "nie je korektná IP adresa",
17
+ 'email' => "nie je korektný e-mail",
18
+ 'url' => "nie je URL",
19
+ 'urlActive' => "musí byť aktívna URL",
20
+ 'alpha' => "musí obsahovať len písmená a-z",
21
+ 'alphaNum' => "musí obsahovať len písmená a-z a/alebo čísla 0-9",
22
+ 'slug' => "musí obsahovať len písmená a-z, čísla 0-9, pomlčky alebo podtržítka",
23
+ 'regex' => "obsahuje nepovolené znaky",
24
+ 'date' => "nie je korektný formáť",
25
+ 'dateFormat' => "musí byť dátum formátu '%s'",
26
+ 'dateBefore' => "musí byť dátum pred '%s'",
27
+ 'dateAfter' => "musí byť dátum po '%s'",
28
+ 'contains' => "musí obsahovať %s",
29
+ 'boolean' => "musí byť pravdivostná hodnota (boolean)",
30
+ 'lengthBetween' => "musí byť %d až %d znakov dlhý",
31
+ 'creditCard' => "musí byť korektné číslo kreditnej karty",
32
+ "lengthMin" => "musí byť aspoň %d znakov dlhý",
33
+ "lengthMax" => "musí byť najviac %d znakov dlhý",
34
+ "instanceOf" => "musí byť inštanciou '%s'"
35
+ );
v2/vendor/vlucas/valitron/lang/sl.php ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ return array(
4
+ 'required' => "potrebno",
5
+ 'equals' => "mora biti enak '% s'",
6
+ 'different' => "mora biti drugačen od '% s'",
7
+ 'accepted' => "mora biti označeno",
8
+ 'numeric' => "mora biti številka",
9
+ 'integer' => "mora biti celo število",
10
+ 'length' => "ne sme biti daljši od% d",
11
+ 'min' => "mora biti večji od% s",
12
+ 'max' => "mora biti manjši od% s",
13
+ 'listContains' => "vsebuje neveljavno vrednost",
14
+ 'in' => "vsebuje neveljavno vrednost",
15
+ 'notIn' => "vsebuje neveljavno vrednost",
16
+ 'ip' => "ni veljaven naslov IP",
17
+ 'ipv4' => "ni veljaven naslov IPv4",
18
+ 'ipv6' => "ni veljaven naslov IPv6",
19
+ 'email' => "ni veljaven e-poštni naslov",
20
+ 'url' => "ni veljaven URL",
21
+ 'urlActive' => "mora biti aktivna domena",
22
+ 'alpha' => "mora vsebovati samo črke a-z",
23
+ 'alphaNum' => "mora vsebovati samo črke a-z in / ali številke 0-9",
24
+ 'slug' => "mora vsebovati samo črke a-z, številke 0-9, črtice in podčrtaje",
25
+ 'regex' => "vsebuje neveljavne znake",
26
+ 'date' => "ni veljaven datum",
27
+ 'dateFormat' => "mora biti datum s formatom '% s'",
28
+ 'dateBefore' => "mora biti datum pred '% s'",
29
+ 'dateAfter' => "mora biti datum za '% s'",
30
+ 'contains' => "mora vsebovati% s",
31
+ 'boolean' => "mora biti boolean",
32
+ 'lengthBetween' => "mora biti med% d in% d znaki",
33
+ 'creditCard' => "mora biti veljavna številka kreditne kartice",
34
+ 'lengthMin' => "mora biti dolg vsaj% d znakov",
35
+ 'lengthMax' => "ne sme presegati% d znakov",
36
+ 'instanceOf' => "mora biti primerek '% s'",
37
+ 'containsUnique' => "mora vsebovati samo edinstvene elemente",
38
+ 'requiredWith' => "je potrebno",
39
+ 'requiredWithout'=> "je potrebno",
40
+ 'subset' => "vsebuje element, ki ga ni na seznamu",
41
+ 'arrayHasKeys' => "ne vsebuje vseh potrebnih tipk",
42
+ );
v2/vendor/vlucas/valitron/lang/sv.php ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ return array(
4
+ 'required' => "är obligatorisk",
5
+ 'equals' => "måste vara samma som '%s'",
6
+ 'different' => "får inte vara samma som '%s'",
7
+ 'accepted' => "måste accepteras",
8
+ 'numeric' => "måste vara numerisk",
9
+ 'integer' => "måste vara ett heltal",
10
+ 'length' => "måste vara %d tecken långt",
11
+ 'min' => "måste vara minst %s",
12
+ 'max' => "får inte vara mer än %s",
13
+ 'listContains' => "innehåller ogiltigt värde",
14
+ 'in' => "innehåller ogiltigt värde",
15
+ 'notIn' => "innehåller ogiltigt värde",
16
+ 'ip' => "är inte en giltlig IP-adress",
17
+ 'email' => "är inte en giltlig e-postadress",
18
+ 'url' => "är inte en giltlig URL",
19
+ 'urlActive' => "måste vara ett aktivt domännamn",
20
+ 'alpha' => "får bara inehålla bokstäver a-z",
21
+ 'alphaNum' => "får bara inehålla bokstäver a-z och/eller siffror 0-9",
22
+ 'slug' => "får bara inehålla bokstäver a-z och/eller siffror 0-9, bindesträck og understräck",
23
+ 'regex' => "inehåller ogiltliga tecken",
24
+ 'date' => "är inte ett giltligt datum",
25
+ 'dateFormat' => "måste vara ett datum med formatet '%s'",
26
+ 'dateBefore' => "måste vara ett datum före '%s'",
27
+ 'dateAfter' => "måste vara ett datum efter '%s'",
28
+ 'contains' => "måste innehålla %s",
29
+ 'boolean' => "måste vara ett booleskt värde",
30
+ 'lengthBetween' => "måste vara mellan %d och %d tecken långt",
31
+ 'creditCard' => "måste vara et gyldig kredittkortnummer",
32
+ 'lengthMin' => "måste vara minst %d tecken långt",
33
+ 'lengthMax' => "får itne överstiga %d tecken",
34
+ 'instanceOf' => "måste vara en instans av '%s'"
35
+ );
v2/vendor/vlucas/valitron/lang/th.php ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ return array(
4
+ 'required' => "นั้นจำเป็นต้องมี",
5
+ 'equals' => "ต้องเหมือนกับ '%s'",
6
+ 'different' => "ต้องแตกต่างจาก '%s'",
7
+ 'accepted' => "ต้องถูกยอมรับ",
8
+ 'numeric' => "ต้องเป็นตัวเลข",
9
+ 'integer' => "ต้องเป็นตัวเลข integer",
10
+ 'length' => "ต้องมีความยาวมากกว่า %d",
11
+ 'min' => "ต้องมีอย่างน้อย %s",
12
+ 'max' => "ต้องไม่มากเกิน %s",
13
+ 'listContains' => "ประกอบด้วยค่าที่ไม่ถูกต้อง",
14
+ 'in' => "ประกอบด้วยค่าที่ไม่ถูกต้อง",
15
+ 'notIn' => "ประกอบด้วยค่าที่ไม่ถูกต้อง",
16
+ 'ip' => "ไม่ใช่ IP ที่ถูกต้อง",
17
+ 'email' => "ไม่ใช่อีเมลที่ถูกต้อง",
18
+ 'url' => "ไม่ใช่ลิงก์",
19
+ 'urlActive' => "ต้องไม่ใช่โดเมนที่ใช้งานอยู่",
20
+ 'alpha' => "ต้องมีแค่ตัวอักษร a-z",
21
+ 'alphaNum' => "ต้องมีแค่ตัวอักษร a-z และ/หรือ ตัวเลข 0-9",
22
+ 'slug' => "ต้องมีแค่ตัวอักษร a-z ตัวเลข 0-9 / และ _",
23
+ 'regex' => "มีตัวอักษรที่ไม่ถูกต้อง",
24
+ 'date' => "ไม่ใช่วันที่ที่ถูกต้อง",
25
+ 'dateFormat' => "ต้องเป็นวันที่ในรูปแบบ '%s'",
26
+ 'dateBefore' => "ต้องเป็นวันที่ก่อน '%s'",
27
+ 'dateAfter' => "ต้องเป็นวันที่หลัง '%s'",
28
+ 'contains' => "ต้องมี %s",
29
+ 'boolean' => "ต้องเป็น boolean",
30
+ 'lengthBetween' => "ต้องอยู่ระหว่าง %d ถึง %d ตัวอักษร",
31
+ 'creditCard' => "ต้องเป็นหมายเลขบัตรเครดิตที่ถูกต้อง",
32
+ "lengthMin" => "ต้องมีมากกว่า %d ตัวอักษร",
33
+ "lengthMax" => "ต้องมีน้อยกว่า %d ตัวอักษร",
34
+ "instanceOf" => "ต้องเป็นส่วนหนึ่งของ '%s'"
35
+ );
v2/vendor/vlucas/valitron/lang/tr.php ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ return array(
4
+ 'required' => "gerekli ",
5
+ 'equals' => "bununla aynı olmalı '%s'",
6
+ 'different' => "bundan değişik olmalı '%s'",
7
+ 'accepted' => "kabul edilebilir olmalı",
8
+ 'numeric' => "numerik olmalı",
9
+ 'integer' => "sayı olmalı",
10
+ 'length' => "en az %d adet uzunluğunda olmalı",
11
+ 'min' => "en az böyle olmalı %s",
12
+ 'max' => "bundan daha fazla olmalı %s",
13
+ 'listContains' => "geçersiz değer içeriyor",
14
+ 'in' => "geçersiz değer içeriyor",
15
+ 'notIn' => "geçersiz değer içeriyor",
16
+ 'ip' => "geçerli bir IP adresi değil",
17
+ 'email' => "geçerli bir eposta adresi değil",
18
+ 'url' => "bir URL değil",
19
+ 'urlActive' => "aktif bir alan adı olmalı",
20
+ 'alpha' => "sadece harf içermeli a-z",
21
+ 'alphaNum' => "sadece harf (a-z) ve/veya sayılar (0-9) içermeli",
22
+ 'slug' => "sadece harf (a-z), numbers sayılar (0-9), tire ve alt tire içermeli",
23
+ 'regex' => "geçersiz karakterler içeriyor",
24
+ 'date' => "geçerli bir karakter değil",
25
+ 'dateFormat' => "bu biçimde bir tarih olmalı '%s'",
26
+ 'dateBefore' => "bu tarihden önce olmalı '%s'",
27
+ 'dateAfter' => "bu tarihden sonra olmalı '%s'",
28
+ 'contains' => "bunu içermeli %s",
29
+ 'boolean' => "boolean olmalı",
30
+ 'lengthBetween' => "%d ve %d karakter arasında olmalı",
31
+ 'creditCard' => "geçerli bir kredi kartı numarası olmalı",
32
+ "lengthMin" => "%d katakterden fazla içermeli",
33
+ "lengthMax" => "%d karakterden az içermeli",
34
+ "instanceOf" => "bunun bir örneği olmalı '%s'"
35
+ );
v2/vendor/vlucas/valitron/lang/uk.php ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ return array(
4
+ 'required' => "обов'язкове для заповнення",
5
+ 'equals' => "має містити '%s'",
6
+ 'different' => "має відрізнятися від '%s'",
7
+ 'accepted' => "має бути вказаним",
8
+ 'numeric' => "має містити числове значення",
9
+ 'integer' => "має бути числом",
10
+ 'length' => "має бути довшим, ніж %d",
11
+ 'min' => "має бути більше, ніж %s",
12
+ 'max' => "повинно бути менше, ніж %s",
13
+ 'listContains' => "містить невірне значення",
14
+ 'in' => "містить невірне значення",
15
+ 'notIn' => "містить невірне значення",
16
+ 'ip' => "не є валідною IP адресою",
17
+ 'email' => "не є валідною email адресою",
18
+ 'url' => "не є посиланням",
19
+ 'urlActive' => "містить не активне посилання",
20
+ 'alpha' => "повинно містити тільки латинські символи",
21
+ 'alphaNum' => "повинно містити тільки латинські символи та/або цифри",
22
+ 'slug' => "повинно містити тільки латинські символи, цифри, тире і підкреслення",
23
+ 'regex' => "містить неприпустимі символи",
24
+ 'date' => "не є датою",
25
+ 'dateFormat' => "має містити дату наступного формату:%s",
26
+ 'dateBefore' => "має містити дату не пізнішу, ніж %s",
27
+ 'dateAfter' => "має містити дату не ранішу, ніж %s",
28
+ 'contains' => "має містити %s",
29
+ 'boolean' => "має містити логічне значення",
30
+ 'lengthBetween' => "має містити від %d в до %d символів",
31
+ 'creditCard' => "має бути номером кредитної картки",
32
+ "lengthMin" => "має містити більше %d символів",
33
+ "lengthMax" => "має містити менше %d символів"
34
+ );
v2/vendor/vlucas/valitron/lang/vi.php ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ return array(
4
+ 'required' => "là bắt buộc",
5
+ 'equals' => "phải giống '%s'",
6
+ 'different' => "phải khác '%s'",
7
+ 'accepted' => "được chấp nhận",
8
+ 'numeric' => "phải là số",
9
+ 'integer' => "phải là số nguyên",
10
+ 'length' => "phải dài hơn %d",
11
+ 'min' => "ít nhất %s",
12
+ 'max' => "tối đa %s",
13
+ 'listContains' => "chứa giá trị không hợp lệ",
14
+ 'in' => "chứa giá trị không hợp lệ",
15
+ 'notIn' => "chứa giá trị không hợp lệ",
16
+ 'ip' => "địa chỉ IP không hợp lệ",
17
+ 'email' => "địa chỉ email không hợp lệ",
18
+ 'url' => "không phải là URL",
19
+ 'urlActive' => "Domain chưa được kích hoạt",
20
+ 'alpha' => "chỉ chứa các kí tự a-z",
21
+ 'alphaNum' => "chỉ chứa các kí tự a-z hoặc số 0-9",
22
+ 'slug' => "chỉ chứa các kí tự a-z, số 0-9, gạch nối và gạch dưới",
23
+ 'regex' => "chứa kí tự không hợp lệ",
24
+ 'date' => "thời gian hợp lệ",
25
+ 'dateFormat' => "thời gian nên được định dạng '%s'",
26
+ 'dateBefore' => "thời gian nên trước '%s'",
27
+ 'dateAfter' => "thời gian nên sau '%s'",
28
+ 'contains' => "phải chứa %s",
29
+ 'boolean' => "phải là boolean",
30
+ 'lengthBetween' => "phải từ %d đến %d kí tự",
31
+ 'creditCard' => "credit card không hợp lệ",
32
+ "lengthMin" => "ít nhất %d kí tự",
33
+ "lengthMax" => "tối đa %d kí tự",
34
+ "instanceOf" => "phải là instance của '%s'"
35
+ );
v2/vendor/vlucas/valitron/lang/zh-cn.php ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ return array(
4
+ 'required' => "不能为空",
5
+ 'equals' => "必须和 '%s' 一致",
6
+ 'different' => "必须和 '%s' 不一致",
7
+ 'accepted' => "必须接受",
8
+ 'numeric' => "只能是数字",
9
+ 'integer' => "只能是整数",
10
+ 'length' => "长度必须大于 %d",
11
+ 'min' => "必须大于 %s",
12
+ 'max' => "必须小于 %s",
13
+ 'listContains' => "无效的值",
14
+ 'in' => "无效的值",
15
+ 'notIn' => "无效的值",
16
+ 'ip' => "无效IP地址",
17
+ 'email' => "无效邮箱地址",
18
+ 'url' => "无效的URL",
19
+ 'urlActive' => "必须是可用的域名",
20
+ 'alpha' => "只能包括英文字母(a-z)",
21
+ 'alphaNum' => "只能包括英文字母(a-z)和数字(0-9)",
22
+ 'slug' => "只能包括英文字母(a-z)、数字(0-9)、破折号和下划线",
23
+ 'regex' => "无效格式",
24
+ 'date' => "无效的日期",
25
+ 'dateFormat' => "日期的格式应该为 '%s'",
26
+ 'dateBefore' => "日期必须在 '%s' 之前",
27
+ 'dateAfter' => "日期必须在 '%s' 之后",
28
+ 'contains' => "必须包含 %s",
29
+ 'boolean' => "必须是真或假",
30
+ 'lengthBetween' => "长度只能介于 %d 和 %d 之间",
31
+ 'creditCard' => "信用卡号码不正确",
32
+ 'lengthMin' => "长度必须大于 %d",
33
+ 'lengthMax' => "长度必须小于 %d"
34
+ );
v2/vendor/vlucas/valitron/lang/zh-tw.php ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ return array(
4
+ 'required' => "不能為空",
5
+ 'equals' => "必須和 '%s' 一致",
6
+ 'different' => "必須和 '%s' 不一致",
7
+ 'accepted' => "必須接受",
8
+ 'numeric' => "只能是數字",
9
+ 'integer' => "只能是整數",
10
+ 'length' => "長度必須大於 %d",
11
+ 'min' => "必須大於 %s",
12
+ 'max' => "必須小於 %s",
13
+ 'listContains' => "無效的值",
14
+ 'in' => "無效的值",
15
+ 'notIn' => "無效的值",
16
+ 'ip' => "無效IP地址",
17
+ 'email' => "無效郵箱地址",
18
+ 'url' => "無效的URL",
19
+ 'urlActive' => "必須是可用的域名",
20
+ 'alpha' => "只能包括英文字母(a-z)",
21
+ 'alphaNum' => "只能包括英文字母(a-z)和數字(0-9)",
22
+ 'slug' => "只能包括英文字母(a-z)、數字(0-9)、破折號和下劃線",
23
+ 'regex' => "無效格式",
24
+ 'date' => "無效的日期",
25
+ 'dateFormat' => "日期的格式應該為 '%s'",
26
+ 'dateBefore' => "日期必須在 '%s' 之前",
27
+ 'dateAfter' => "日期必須在 '%s' 之後",
28
+ 'contains' => "必須包含 %s"
29
+ );
v2/vendor/vlucas/valitron/phpunit.xml ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <phpunit backupGlobals="false"
3
+ backupStaticAttributes="false"
4
+ colors="true"
5
+ convertErrorsToExceptions="true"
6
+ convertNoticesToExceptions="true"
7
+ convertWarningsToExceptions="true"
8
+ processIsolation="false"
9
+ stopOnFailure="false"
10
+ syntaxCheck="false"
11
+ bootstrap="tests/bootstrap.php"
12
+ >
13
+ <testsuites>
14
+ <testsuite name="Valitron Test Suite">
15
+ <directory suffix="Test.php">tests/Valitron</directory>
16
+ </testsuite>
17
+ </testsuites>
18
+ <filter>
19
+ <whitelist>
20
+ <directory suffix=".php">src/</directory>
21
+ </whitelist>
22
+ <blacklist>
23
+ <directory suffix=".php">vendor/</directory>
24
+ </blacklist>
25
+ </filter>
26
+ </phpunit>
v2/vendor/vlucas/valitron/src/Valitron/Validator.php ADDED
@@ -0,0 +1,1561 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace Valitron;
4
+
5
+ /**
6
+ * Validation Class
7
+ *
8
+ * Validates input against certain criteria
9
+ *
10
+ * @package Valitron
11
+ * @author Vance Lucas <vance@vancelucas.com>
12
+ * @link http://www.vancelucas.com/
13
+ */
14
+ class Validator
15
+ {
16
+ /**
17
+ * @var string
18
+ */
19
+ const ERROR_DEFAULT = 'Invalid';
20
+
21
+ /**
22
+ * @var array
23
+ */
24
+ protected $_fields = array();
25
+
26
+ /**
27
+ * @var array
28
+ */
29
+ protected $_errors = array();
30
+
31
+ /**
32
+ * @var array
33
+ */
34
+ protected $_validations = array();
35
+
36
+ /**
37
+ * @var array
38
+ */
39
+ protected $_labels = array();
40
+
41
+ /**
42
+ * Contains all rules that are available to the current valitron instance.
43
+ *
44
+ * @var array
45
+ */
46
+ protected $_instanceRules = array();
47
+
48
+ /**
49
+ * Contains all rule messages that are available to the current valitron
50
+ * instance
51
+ *
52
+ * @var array
53
+ */
54
+ protected $_instanceRuleMessage = array();
55
+
56
+ /**
57
+ * @var string
58
+ */
59
+ protected static $_lang;
60
+
61
+ /**
62
+ * @var string
63
+ */
64
+ protected static $_langDir;
65
+
66
+ /**
67
+ * @var array
68
+ */
69
+ protected static $_rules = array();
70
+
71
+ /**
72
+ * @var array
73
+ */
74
+ protected static $_ruleMessages = array();
75
+
76
+ /**
77
+ * @var array
78
+ */
79
+ protected $validUrlPrefixes = array('http://', 'https://', 'ftp://');
80
+
81
+ /**
82
+ * @var bool
83
+ */
84
+ protected $stop_on_first_fail = false;
85
+
86
+ /**
87
+ * Setup validation
88
+ *
89
+ * @param array $data
90
+ * @param array $fields
91
+ * @param string $lang
92
+ * @param string $langDir
93
+ * @throws \InvalidArgumentException
94
+ */
95
+ public function __construct($data = array(), $fields = array(), $lang = null, $langDir = null)
96
+ {
97
+ // Allows filtering of used input fields against optional second array of field names allowed
98
+ // This is useful for limiting raw $_POST or $_GET data to only known fields
99
+ $this->_fields = !empty($fields) ? array_intersect_key($data, array_flip($fields)) : $data;
100
+
101
+ // set lang in the follow order: constructor param, static::$_lang, default to en
102
+ $lang = $lang ?: static::lang();
103
+
104
+ // set langDir in the follow order: constructor param, static::$_langDir, default to package lang dir
105
+ $langDir = $langDir ?: static::langDir();
106
+
107
+ // Load language file in directory
108
+ $langFile = rtrim($langDir, '/') . '/' . $lang . '.php';
109
+ if (stream_resolve_include_path($langFile)) {
110
+ $langMessages = include $langFile;
111
+ static::$_ruleMessages = array_merge(static::$_ruleMessages, $langMessages);
112
+ } else {
113
+ throw new \InvalidArgumentException("Fail to load language file '" . $langFile . "'");
114
+ }
115
+ }
116
+
117
+ /**
118
+ * Get/set language to use for validation messages
119
+ *
120
+ * @param string $lang
121
+ * @return string
122
+ */
123
+ public static function lang($lang = null)
124
+ {
125
+ if ($lang !== null) {
126
+ static::$_lang = $lang;
127
+ }
128
+
129
+ return static::$_lang ?: 'en';
130
+ }
131
+
132
+ /**
133
+ * Get/set language file path
134
+ *
135
+ * @param string $dir
136
+ * @return string
137
+ */
138
+ public static function langDir($dir = null)
139
+ {
140
+ if ($dir !== null) {
141
+ static::$_langDir = $dir;
142
+ }
143
+
144
+ return static::$_langDir ?: dirname(dirname(__DIR__)) . '/lang';
145
+ }
146
+
147
+ /**
148
+ * Required field validator
149
+ *
150
+ * @param string $field
151
+ * @param mixed $value
152
+ * @param array $params
153
+ * @return bool
154
+ */
155
+ protected function validateRequired($field, $value, $params = array())
156
+ {
157
+ if (isset($params[0]) && (bool)$params[0]) {
158
+ $find = $this->getPart($this->_fields, explode('.', $field), true);
159
+ return $find[1];
160
+ }
161
+
162
+ if (is_null($value)) {
163
+ return false;
164
+ } elseif (is_string($value) && trim($value) === '') {
165
+ return false;
166
+ }
167
+
168
+ return true;
169
+ }
170
+
171
+ /**
172
+ * Validate that two values match
173
+ *
174
+ * @param string $field
175
+ * @param mixed $value
176
+ * @param array $params
177
+ * @return bool
178
+ */
179
+ protected function validateEquals($field, $value, array $params)
180
+ {
181
+ // extract the second field value, this accounts for nested array values
182
+ list($field2Value, $multiple) = $this->getPart($this->_fields, explode('.', $params[0]));
183
+ return isset($field2Value) && $value == $field2Value;
184
+ }
185
+
186
+ /**
187
+ * Validate that a field is different from another field
188
+ *
189
+ * @param string $field
190
+ * @param mixed $value
191
+ * @param array $params
192
+ * @return bool
193
+ */
194
+ protected function validateDifferent($field, $value, array $params)
195
+ {
196
+ // extract the second field value, this accounts for nested array values
197
+ list($field2Value, $multiple) = $this->getPart($this->_fields, explode('.', $params[0]));
198
+ return isset($field2Value) && $value != $field2Value;
199
+ }
200
+
201
+ /**
202
+ * Validate that a field was "accepted" (based on PHP's string evaluation rules)
203
+ *
204
+ * This validation rule implies the field is "required"
205
+ *
206
+ * @param string $field
207
+ * @param mixed $value
208
+ * @return bool
209
+ */
210
+ protected function validateAccepted($field, $value)
211
+ {
212
+ $acceptable = array('yes', 'on', 1, '1', true);
213
+
214
+ return $this->validateRequired($field, $value) && in_array($value, $acceptable, true);
215
+ }
216
+
217
+ /**
218
+ * Validate that a field is an array
219
+ *
220
+ * @param string $field
221
+ * @param mixed $value
222
+ * @return bool
223
+ */
224
+ protected function validateArray($field, $value)
225
+ {
226
+ return is_array($value);
227
+ }
228
+
229
+ /**
230
+ * Validate that a field is numeric
231
+ *
232
+ * @param string $field
233
+ * @param mixed $value
234
+ * @return bool
235
+ */
236
+ protected function validateNumeric($field, $value)
237
+ {
238
+ return is_numeric($value);
239
+ }
240
+
241
+ /**
242
+ * Validate that a field is an integer
243
+ *
244
+ * @param string $field
245
+ * @param mixed $value
246
+ * @param array $params
247
+ * @return bool
248
+ */
249
+ protected function validateInteger($field, $value, $params)
250
+ {
251
+ if (isset($params[0]) && (bool)$params[0]) {
252
+ //strict mode
253
+ return preg_match('/^([0-9]|-[1-9]|-?[1-9][0-9]*)$/i', $value);
254
+ }
255
+
256
+ return filter_var($value, \FILTER_VALIDATE_INT) !== false;
257
+ }
258
+
259
+ /**
260
+ * Validate the length of a string
261
+ *
262
+ * @param string $field
263
+ * @param mixed $value
264
+ * @param array $params
265
+ * @return bool
266
+ */
267
+ protected function validateLength($field, $value, $params)
268
+ {
269
+ $length = $this->stringLength($value);
270
+ // Length between
271
+ if (isset($params[1])) {
272
+ return $length >= $params[0] && $length <= $params[1];
273
+ }
274
+ // Length same
275
+ return ($length !== false) && $length == $params[0];
276
+ }
277
+
278
+ /**
279
+ * Validate the length of a string (between)
280
+ *
281
+ * @param string $field
282
+ * @param mixed $value
283
+ * @param array $params
284
+ * @return bool
285
+ */
286
+ protected function validateLengthBetween($field, $value, $params)
287
+ {
288
+ $length = $this->stringLength($value);
289
+
290
+ return ($length !== false) && $length >= $params[0] && $length <= $params[1];
291
+ }
292
+
293
+ /**
294
+ * Validate the length of a string (min)
295
+ *
296
+ * @param string $field
297
+ * @param mixed $value
298
+ * @param array $params
299
+ *
300
+ * @return bool
301
+ */
302
+ protected function validateLengthMin($field, $value, $params)
303
+ {
304
+ $length = $this->stringLength($value);
305
+
306
+ return ($length !== false) && $length >= $params[0];
307
+ }
308
+
309
+ /**
310
+ * Validate the length of a string (max)
311
+ *
312
+ * @param string $field
313
+ * @param mixed $value
314
+ * @param array $params
315
+ *
316
+ * @return bool
317
+ */
318
+ protected function validateLengthMax($field, $value, $params)
319
+ {
320
+ $length = $this->stringLength($value);
321
+
322
+ return ($length !== false) && $length <= $params[0];
323
+ }
324
+
325
+ /**
326
+ * Get the length of a string
327
+ *
328
+ * @param string $value
329
+ * @return int|false
330
+ */
331
+ protected function stringLength($value)
332
+ {
333
+ if (!is_string($value)) {
334
+ return false;
335
+ } elseif (function_exists('mb_strlen')) {
336
+ return mb_strlen($value);
337
+ }
338
+
339
+ return strlen($value);
340
+ }
341
+
342
+ /**
343
+ * Validate the size of a field is greater than a minimum value.
344
+ *
345
+ * @param string $field
346
+ * @param mixed $value
347
+ * @param array $params
348
+ * @return bool
349
+ */
350
+ protected function validateMin($field, $value, $params)
351
+ {
352
+ if (!is_numeric($value)) {
353
+ return false;
354
+ } elseif (function_exists('bccomp')) {
355
+ return !(bccomp($params[0], $value, 14) === 1);
356
+ } else {
357
+ return $params[0] <= $value;
358
+ }
359
+ }
360
+
361
+ /**
362
+ * Validate the size of a field is less than a maximum value
363
+ *
364
+ * @param string $field
365
+ * @param mixed $value
366
+ * @param array $params
367
+ * @return bool
368
+ */
369
+ protected function validateMax($field, $value, $params)
370
+ {
371
+ if (!is_numeric($value)) {
372
+ return false;
373
+ } elseif (function_exists('bccomp')) {
374
+ return !(bccomp($value, $params[0], 14) === 1);
375
+ } else {
376
+ return $params[0] >= $value;
377
+ }
378
+ }
379
+
380
+ /**
381
+ * Validate the size of a field is between min and max values
382
+ *
383
+ * @param string $field
384
+ * @param mixed $value
385
+ * @param array $params
386
+ * @return bool
387
+ */
388
+ protected function validateBetween($field, $value, $params)
389
+ {
390
+ if (!is_numeric($value)) {
391
+ return false;
392
+ }
393
+ if (!isset($params[0]) || !is_array($params[0]) || count($params[0]) !== 2) {
394
+ return false;
395
+ }
396
+
397
+ list($min, $max) = $params[0];
398
+
399
+ return $this->validateMin($field, $value, array($min)) && $this->validateMax($field, $value, array($max));
400
+ }
401
+
402
+ /**
403
+ * Validate a field is contained within a list of values
404
+ *
405
+ * @param string $field
406
+ * @param mixed $value
407
+ * @param array $params
408
+ * @return bool
409
+ */
410
+ protected function validateIn($field, $value, $params)
411
+ {
412
+ $isAssoc = array_values($params[0]) !== $params[0];
413
+ if ($isAssoc) {
414
+ $params[0] = array_keys($params[0]);
415
+ }
416
+
417
+ $strict = false;
418
+ if (isset($params[1])) {
419
+ $strict = $params[1];
420
+ }
421
+
422
+ return in_array($value, $params[0], $strict);
423
+ }
424
+
425
+ /**
426
+ * Validate a field is contained within a list of values
427
+ *
428
+ * @param string $field
429
+ * @param mixed $value
430
+ * @param array $params
431
+ * @return bool
432
+ */
433
+ protected function validateListContains($field, $value, $params)
434
+ {
435
+ $isAssoc = array_values($value) !== $value;
436
+ if ($isAssoc) {
437
+ $value = array_keys($value);
438
+ }
439
+
440
+ $strict = false;
441
+ if (isset($params[1])) {
442
+ $strict = $params[1];
443
+ }
444
+
445
+ return in_array($params[0], $value, $strict);
446
+ }
447
+
448
+ /**
449
+ * Validate a field is not contained within a list of values
450
+ *
451
+ * @param string $field
452
+ * @param mixed $value
453
+ * @param array $params
454
+ * @return bool
455
+ */
456
+ protected function validateNotIn($field, $value, $params)
457
+ {
458
+ return !$this->validateIn($field, $value, $params);
459
+ }
460
+
461
+ /**
462
+ * Validate a field contains a given string
463
+ *
464
+ * @param string $field
465
+ * @param string $value
466
+ * @param array $params
467
+ * @return bool
468
+ */
469
+ protected function validateContains($field, $value, $params)
470
+ {
471
+ if (!isset($params[0])) {
472
+ return false;
473
+ }
474
+ if (!is_string($params[0]) || !is_string($value)) {
475
+ return false;
476
+ }
477
+
478
+ $strict = true;
479
+ if (isset($params[1])) {
480
+ $strict = (bool)$params[1];
481
+ }
482
+
483
+ if ($strict) {
484
+ if (function_exists('mb_strpos')) {
485
+ $isContains = mb_strpos($value, $params[0]) !== false;
486
+ } else {
487
+ $isContains = strpos($value, $params[0]) !== false;
488
+ }
489
+ } else {
490
+ if (function_exists('mb_stripos')) {
491
+ $isContains = mb_stripos($value, $params[0]) !== false;
492
+ } else {
493
+ $isContains = stripos($value, $params[0]) !== false;
494
+ }
495
+ }
496
+ return $isContains;
497
+ }
498
+
499
+ /**
500
+ * Validate that all field values contains a given array
501
+ *
502
+ * @param string $field
503
+ * @param array $value
504
+ * @param array $params
505
+ * @return bool
506
+ */
507
+ protected function validateSubset($field, $value, $params)
508
+ {
509
+ if (!isset($params[0])) {
510
+ return false;
511
+ }
512
+ if (!is_array($params[0])) {
513
+ $params[0] = array($params[0]);
514
+ }
515
+ if (is_scalar($value) || is_null($value)) {
516
+ return $this->validateIn($field, $value, $params);
517
+ }
518
+
519
+ $intersect = array_intersect($value, $params[0]);
520
+ return array_diff($value, $intersect) === array_diff($intersect, $value);
521
+ }
522
+
523
+ /**
524
+ * Validate that field array has only unique values
525
+ *
526
+ * @param string $field
527
+ * @param array $value
528
+ * @return bool
529
+ */
530
+ protected function validateContainsUnique($field, $value)
531
+ {
532
+ if (!is_array($value)) {
533
+ return false;
534
+ }
535
+
536
+ return $value === array_unique($value, SORT_REGULAR);
537
+ }
538
+
539
+ /**
540
+ * Validate that a field is a valid IP address
541
+ *
542
+ * @param string $field
543
+ * @param mixed $value
544
+ * @return bool
545
+ */
546
+ protected function validateIp($field, $value)
547
+ {
548
+ return filter_var($value, \FILTER_VALIDATE_IP) !== false;
549
+ }
550
+
551
+ /**
552
+ * Validate that a field is a valid IP v4 address
553
+ *
554
+ * @param string $field
555
+ * @param mixed $value
556
+ * @return bool
557
+ */
558
+ protected function validateIpv4($field, $value)
559
+ {
560
+ return filter_var($value, \FILTER_VALIDATE_IP, \FILTER_FLAG_IPV4) !== false;
561
+ }
562
+
563
+ /**
564
+ * Validate that a field is a valid IP v6 address
565
+ *
566
+ * @param string $field
567
+ * @param mixed $value
568
+ * @return bool
569
+ */
570
+ protected function validateIpv6($field, $value)
571
+ {
572
+ return filter_var($value, \FILTER_VALIDATE_IP, \FILTER_FLAG_IPV6) !== false;
573
+ }
574
+
575
+ /**
576
+ * Validate that a field is a valid e-mail address
577
+ *
578
+ * @param string $field
579
+ * @param mixed $value
580
+ * @return bool
581
+ */
582
+ protected function validateEmail($field, $value)
583
+ {
584
+ return filter_var($value, \FILTER_VALIDATE_EMAIL) !== false;
585
+ }
586
+
587
+ /**
588
+ * Validate that a field contains only ASCII characters
589
+ *
590
+ * @param $field
591
+ * @param $value
592
+ * @return bool|false|string
593
+ */
594
+ protected function validateAscii($field, $value)
595
+ {
596
+ // multibyte extension needed
597
+ if (function_exists('mb_detect_encoding')) {
598
+ return mb_detect_encoding($value, 'ASCII', true);
599
+ }
600
+
601
+ // fallback with regex
602
+ return 0 === preg_match('/[^\x00-\x7F]/', $value);
603
+ }
604
+
605
+ /**
606
+ * Validate that a field is a valid e-mail address and the domain name is active
607
+ *
608
+ * @param string $field
609
+ * @param mixed $value
610
+ * @return bool
611
+ */
612
+ protected function validateEmailDNS($field, $value)
613
+ {
614
+ if ($this->validateEmail($field, $value)) {
615
+ $domain = ltrim(stristr($value, '@'), '@') . '.';
616
+ if (function_exists('idn_to_ascii') && defined('INTL_IDNA_VARIANT_UTS46')) {
617
+ $domain = idn_to_ascii($domain, 0, INTL_IDNA_VARIANT_UTS46);
618
+ }
619
+ return checkdnsrr($domain, 'ANY');
620
+ }
621
+
622
+ return false;
623
+ }
624
+
625
+ /**
626
+ * Validate that a field is a valid URL by syntax
627
+ *
628
+ * @param string $field
629
+ * @param mixed $value
630
+ * @return bool
631
+ */
632
+ protected function validateUrl($field, $value)
633
+ {
634
+ foreach ($this->validUrlPrefixes as $prefix) {
635
+ if (strpos($value, $prefix) !== false) {
636
+ return filter_var($value, \FILTER_VALIDATE_URL) !== false;
637
+ }
638
+ }
639
+
640
+ return false;
641
+ }
642
+
643
+ /**
644
+ * Validate that a field is an active URL by verifying DNS record
645
+ *
646
+ * @param string $field
647
+ * @param mixed $value
648
+ * @return bool
649
+ */
650
+ protected function validateUrlActive($field, $value)
651
+ {
652
+ foreach ($this->validUrlPrefixes as $prefix) {
653
+ if (strpos($value, $prefix) !== false) {
654
+ $host = parse_url(strtolower($value), PHP_URL_HOST);
655
+
656
+ return checkdnsrr($host, 'A') || checkdnsrr($host, 'AAAA') || checkdnsrr($host, 'CNAME');
657
+ }
658
+ }
659
+
660
+ return false;
661
+ }
662
+
663
+ /**
664
+ * Validate that a field contains only alphabetic characters
665
+ *
666
+ * @param string $field
667
+ * @param mixed $value
668
+ * @return bool
669
+ */
670
+ protected function validateAlpha($field, $value)
671
+ {
672
+ return preg_match('/^([a-z])+$/i', $value);
673
+ }
674
+
675
+ /**
676
+ * Validate that a field contains only alpha-numeric characters
677
+ *
678
+ * @param string $field
679
+ * @param mixed $value
680
+ * @return bool
681
+ */
682
+ protected function validateAlphaNum($field, $value)
683
+ {
684
+ return preg_match('/^([a-z0-9])+$/i', $value);
685
+ }
686
+
687
+ /**
688
+ * Validate that a field contains only alpha-numeric characters, dashes, and underscores
689
+ *
690
+ * @param string $field
691
+ * @param mixed $value
692
+ * @return bool
693
+ */
694
+ protected function validateSlug($field, $value)
695
+ {
696
+ if (is_array($value)) {
697
+ return false;
698
+ }
699
+ return preg_match('/^([-a-z0-9_-])+$/i', $value);
700
+ }
701
+
702
+ /**
703
+ * Validate that a field passes a regular expression check
704
+ *
705
+ * @param string $field
706
+ * @param mixed $value
707
+ * @param array $params
708
+ * @return bool
709
+ */
710
+ protected function validateRegex($field, $value, $params)
711
+ {
712
+ return preg_match($params[0], $value);
713
+ }
714
+
715
+ /**
716
+ * Validate that a field is a valid date
717
+ *
718
+ * @param string $field
719
+ * @param mixed $value
720
+ * @return bool
721
+ */
722
+ protected function validateDate($field, $value)
723
+ {
724
+ $isDate = false;
725
+ if ($value instanceof \DateTime) {
726
+ $isDate = true;
727
+ } else {
728
+ $isDate = strtotime($value) !== false;
729
+ }
730
+
731
+ return $isDate;
732
+ }
733
+
734
+ /**
735
+ * Validate that a field matches a date format
736
+ *
737
+ * @param string $field
738
+ * @param mixed $value
739
+ * @param array $params
740
+ * @return bool
741
+ */
742
+ protected function validateDateFormat($field, $value, $params)
743
+ {
744
+ $parsed = date_parse_from_format($params[0], $value);
745
+
746
+ return $parsed['error_count'] === 0 && $parsed['warning_count'] === 0;
747
+ }
748
+
749
+ /**
750
+ * Validate the date is before a given date
751
+ *
752
+ * @param string $field
753
+ * @param mixed $value
754
+ * @param array $params
755
+ * @return bool
756
+ */
757
+ protected function validateDateBefore($field, $value, $params)
758
+ {
759
+ $vtime = ($value instanceof \DateTime) ? $value->getTimestamp() : strtotime($value);
760
+ $ptime = ($params[0] instanceof \DateTime) ? $params[0]->getTimestamp() : strtotime($params[0]);
761
+
762
+ return $vtime < $ptime;
763
+ }
764
+
765
+ /**
766
+ * Validate the date is after a given date
767
+ *
768
+ * @param string $field
769
+ * @param mixed $value
770
+ * @param array $params
771
+ * @return bool
772
+ */
773
+ protected function validateDateAfter($field, $value, $params)
774
+ {
775
+ $vtime = ($value instanceof \DateTime) ? $value->getTimestamp() : strtotime($value);
776
+ $ptime = ($params[0] instanceof \DateTime) ? $params[0]->getTimestamp() : strtotime($params[0]);
777
+
778
+ return $vtime > $ptime;
779
+ }
780
+
781
+ /**
782
+ * Validate that a field contains a boolean.
783
+ *
784
+ * @param string $field
785
+ * @param mixed $value
786
+ * @return bool
787
+ */
788
+ protected function validateBoolean($field, $value)
789
+ {
790
+ return is_bool($value);
791
+ }
792
+
793
+ /**
794
+ * Validate that a field contains a valid credit card
795
+ * optionally filtered by an array
796
+ *
797
+ * @param string $field
798
+ * @param mixed $value
799
+ * @param array $params
800
+ * @return bool
801
+ */
802
+ protected function validateCreditCard($field, $value, $params)
803
+ {
804
+ /**
805
+ * I there has been an array of valid cards supplied, or the name of the users card
806
+ * or the name and an array of valid cards
807
+ */
808
+ if (!empty($params)) {
809
+ /**
810
+ * array of valid cards
811
+ */
812
+ if (is_array($params[0])) {
813
+ $cards = $params[0];
814
+ } elseif (is_string($params[0])) {
815
+ $cardType = $params[0];
816
+ if (isset($params[1]) && is_array($params[1])) {
817
+ $cards = $params[1];
818
+ if (!in_array($cardType, $cards)) {
819
+ return false;
820
+ }
821
+ }
822
+ }
823
+ }
824
+ /**
825
+ * Luhn algorithm
826
+ *
827
+ * @return bool
828
+ */
829
+ $numberIsValid = function () use ($value) {
830
+ $number = preg_replace('/[^0-9]+/', '', $value);
831
+ $sum = 0;
832
+
833
+ $strlen = strlen($number);
834
+ if ($strlen < 13) {
835
+ return false;
836
+ }
837
+ for ($i = 0; $i < $strlen; $i++) {
838
+ $digit = (int)substr($number, $strlen - $i - 1, 1);
839
+ if ($i % 2 == 1) {
840
+ $sub_total = $digit * 2;
841
+ if ($sub_total > 9) {
842
+ $sub_total = ($sub_total - 10) + 1;
843
+ }
844
+ } else {
845
+ $sub_total = $digit;
846
+ }
847
+ $sum += $sub_total;
848
+ }
849
+ if ($sum > 0 && $sum % 10 == 0) {
850
+ return true;
851
+ }
852
+
853
+ return false;
854
+ };
855
+
856
+ if ($numberIsValid()) {
857
+ if (!isset($cards)) {
858
+ return true;
859
+ } else {
860
+ $cardRegex = array(
861
+ 'visa' => '#^4[0-9]{12}(?:[0-9]{3})?$#',
862
+ 'mastercard' => '#^(5[1-5]|2[2-7])[0-9]{14}$#',
863
+ 'amex' => '#^3[47][0-9]{13}$#',
864
+ 'dinersclub' => '#^3(?:0[0-5]|[68][0-9])[0-9]{11}$#',
865
+ 'discover' => '#^6(?:011|5[0-9]{2})[0-9]{12}$#',
866
+ );
867
+
868
+ if (isset($cardType)) {
869
+ // if we don't have any valid cards specified and the card we've been given isn't in our regex array
870
+ if (!isset($cards) && !in_array($cardType, array_keys($cardRegex))) {
871
+ return false;
872
+ }
873
+
874
+ // we only need to test against one card type
875
+ return (preg_match($cardRegex[$cardType], $value) === 1);
876
+
877
+ } elseif (isset($cards)) {
878
+ // if we have cards, check our users card against only the ones we have
879
+ foreach ($cards as $card) {
880
+ if (in_array($card, array_keys($cardRegex))) {
881
+ // if the card is valid, we want to stop looping
882
+ if (preg_match($cardRegex[$card], $value) === 1) {
883
+ return true;
884
+ }
885
+ }
886
+ }
887
+ } else {
888
+ // loop through every card
889
+ foreach ($cardRegex as $regex) {
890
+ // until we find a valid one
891
+ if (preg_match($regex, $value) === 1) {
892
+ return true;
893
+ }
894
+ }
895
+ }
896
+ }
897
+ }
898
+
899
+ // if we've got this far, the card has passed no validation so it's invalid!
900
+ return false;
901
+ }
902
+
903
+ protected function validateInstanceOf($field, $value, $params)
904
+ {
905
+ $isInstanceOf = false;
906
+ if (is_object($value)) {
907
+ if (is_object($params[0]) && $value instanceof $params[0]) {
908
+ $isInstanceOf = true;
909
+ }
910
+ if (get_class($value) === $params[0]) {
911
+ $isInstanceOf = true;
912
+ }
913
+ }
914
+ if (is_string($value)) {
915
+ if (is_string($params[0]) && get_class($value) === $params[0]) {
916
+ $isInstanceOf = true;
917
+ }
918
+ }
919
+
920
+ return $isInstanceOf;
921
+ }
922
+
923
+ /**
924
+ * Validates whether or not a field is required based on whether or not other fields are present.
925
+ *
926
+ * @param string $field name of the field in the data array
927
+ * @param mixed $value value of this field
928
+ * @param array $params parameters for this rule
929
+ * @param array $fields full list of data to be validated
930
+ * @return bool
931
+ */
932
+ protected function validateRequiredWith($field, $value, $params, $fields)
933
+ {
934
+ $conditionallyReq = false;
935
+ // if we actually have conditionally required with fields to check against
936
+ if (isset($params[0])) {
937
+ // convert single value to array if it isn't already
938
+ $reqParams = is_array($params[0]) ? $params[0] : array($params[0]);
939
+ // check for the flag indicating if all fields are required
940
+ $allRequired = isset($params[1]) && (bool)$params[1];
941
+ $emptyFields = 0;
942
+ foreach ($reqParams as $requiredField) {
943
+ // check the field is set, not null, and not the empty string
944
+ if (isset($fields[$requiredField]) && !is_null($fields[$requiredField])
945
+ && (is_string($fields[$requiredField]) ? trim($fields[$requiredField]) !== '' : true)) {
946
+ if (!$allRequired) {
947
+ $conditionallyReq = true;
948
+ break;
949
+ } else {
950
+ $emptyFields++;
951
+ }
952
+ }
953
+ }
954
+ // if all required fields are present in strict mode, we're requiring it
955
+ if ($allRequired && $emptyFields === count($reqParams)) {
956
+ $conditionallyReq = true;
957
+ }
958
+ }
959
+ // if we have conditionally required fields
960
+ if ($conditionallyReq && (is_null($value) ||
961
+ is_string($value) && trim($value) === '')) {
962
+ return false;
963
+ }
964
+ return true;
965
+ }
966
+
967
+ /**
968
+ * Validates whether or not a field is required based on whether or not other fields are present.
969
+ *
970
+ * @param string $field name of the field in the data array
971
+ * @param mixed $value value of this field
972
+ * @param array $params parameters for this rule
973
+ * @param array $fields full list of data to be validated
974
+ * @return bool
975
+ */
976
+ protected function validateRequiredWithout($field, $value, $params, $fields)
977
+ {
978
+ $conditionallyReq = false;
979
+ // if we actually have conditionally required with fields to check against
980
+ if (isset($params[0])) {
981
+ // convert single value to array if it isn't already
982
+ $reqParams = is_array($params[0]) ? $params[0] : array($params[0]);
983
+ // check for the flag indicating if all fields are required
984
+ $allEmpty = isset($params[1]) && (bool)$params[1];
985
+ $filledFields = 0;
986
+ foreach ($reqParams as $requiredField) {
987
+ // check the field is NOT set, null, or the empty string, in which case we are requiring this value be present
988
+ if (!isset($fields[$requiredField]) || (is_null($fields[$requiredField])
989
+ || (is_string($fields[$requiredField]) && trim($fields[$requiredField]) === ''))) {
990
+ if (!$allEmpty) {
991
+ $conditionallyReq = true;
992
+ break;
993
+ } else {
994
+ $filledFields++;
995
+ }
996
+ }
997
+ }
998
+ // if all fields were empty, then we're requiring this in strict mode
999
+ if ($allEmpty && $filledFields === count($reqParams)) {
1000
+ $conditionallyReq = true;
1001
+ }
1002
+ }
1003
+ // if we have conditionally required fields
1004
+ if ($conditionallyReq && (is_null($value) ||
1005
+ is_string($value) && trim($value) === '')) {
1006
+ return false;
1007
+ }
1008
+ return true;
1009
+ }
1010
+
1011
+ /**
1012
+ * Validate optional field
1013
+ *
1014
+ * @param $field
1015
+ * @param $value
1016
+ * @param $params
1017
+ * @return bool
1018
+ */
1019
+ protected function validateOptional($field, $value, $params)
1020
+ {
1021
+ //Always return true
1022
+ return true;
1023
+ }
1024
+
1025
+ protected function validateArrayHasKeys($field, $value, $params)
1026
+ {
1027
+ if (!is_array($value) || !isset($params[0])) {
1028
+ return false;
1029
+ }
1030
+ $requiredFields = $params[0];
1031
+ if (count($requiredFields) === 0) {
1032
+ return false;
1033
+ }
1034
+ foreach ($requiredFields as $fieldName) {
1035
+ if (!array_key_exists($fieldName, $value)) {
1036
+ return false;
1037
+ }
1038
+ }
1039
+ return true;
1040
+ }
1041
+
1042
+ /**
1043
+ * Get array of fields and data
1044
+ *
1045
+ * @return array
1046
+ */
1047
+ public function data()
1048
+ {
1049
+ return $this->_fields;
1050
+ }
1051
+
1052
+ /**
1053
+ * Get array of error messages
1054
+ *
1055
+ * @param null|string $field
1056
+ * @return array|bool
1057
+ */
1058
+ public function errors($field = null)
1059
+ {
1060
+ if ($field !== null) {
1061
+ return isset($this->_errors[$field]) ? $this->_errors[$field] : false;
1062
+ }
1063
+
1064
+ return $this->_errors;
1065
+ }
1066
+
1067
+ /**
1068
+ * Add an error to error messages array
1069
+ *
1070
+ * @param string $field
1071
+ * @param string $message
1072
+ * @param array $params
1073
+ */
1074
+ public function error($field, $message, array $params = array())
1075
+ {
1076
+ $message = $this->checkAndSetLabel($field, $message, $params);
1077
+
1078
+ $values = array();
1079
+ // Printed values need to be in string format
1080
+ foreach ($params as $param) {
1081
+ if (is_array($param)) {
1082
+ $param = "['" . implode("', '", $param) . "']";
1083
+ }
1084
+ if ($param instanceof \DateTime) {
1085
+ $param = $param->format('Y-m-d');
1086
+ } else {
1087
+ if (is_object($param)) {
1088
+ $param = get_class($param);
1089
+ }
1090
+ }
1091
+ // Use custom label instead of field name if set
1092
+ if (is_string($params[0])) {
1093
+ if (isset($this->_labels[$param])) {
1094
+ $param = $this->_labels[$param];
1095
+ }
1096
+ }
1097
+ $values[] = $param;
1098
+ }
1099
+
1100
+ $this->_errors[$field][] = vsprintf($message, $values);
1101
+ }
1102
+
1103
+ /**
1104
+ * Specify validation message to use for error for the last validation rule
1105
+ *
1106
+ * @param string $message
1107
+ * @return Validator
1108
+ */
1109
+ public function message($message)
1110
+ {
1111
+ $this->_validations[count($this->_validations) - 1]['message'] = $message;
1112
+
1113
+ return $this;
1114
+ }
1115
+
1116
+ /**
1117
+ * Reset object properties
1118
+ */
1119
+ public function reset()
1120
+ {
1121
+ $this->_fields = array();
1122
+ $this->_errors = array();
1123
+ $this->_validations = array();
1124
+ $this->_labels = array();
1125
+ }
1126
+
1127
+ protected function getPart($data, $identifiers, $allow_empty = false)
1128
+ {
1129
+ // Catches the case where the field is an array of discrete values
1130
+ if (is_array($identifiers) && count($identifiers) === 0) {
1131
+ return array($data, false);
1132
+ }
1133
+ // Catches the case where the data isn't an array or object
1134
+ if (is_scalar($data)) {
1135
+ return array(null, false);
1136
+ }
1137
+ $identifier = array_shift($identifiers);
1138
+ // Glob match
1139
+ if ($identifier === '*') {
1140
+ $values = array();
1141
+ foreach ($data as $row) {
1142
+ list($value, $multiple) = $this->getPart($row, $identifiers, $allow_empty);
1143
+ if ($multiple) {
1144
+ $values = array_merge($values, $value);
1145
+ } else {
1146
+ $values[] = $value;
1147
+ }
1148
+ }
1149
+ return array($values, true);
1150
+ } // Dead end, abort
1151
+ elseif ($identifier === null || ! isset($data[$identifier])) {
1152
+ if ($allow_empty){
1153
+ //when empty values are allowed, we only care if the key exists
1154
+ return array(null, array_key_exists($identifier, $data));
1155
+ }
1156
+ return array(null, false);
1157
+ } // Match array element
1158
+ elseif (count($identifiers) === 0) {
1159
+ if ($allow_empty) {
1160
+ //when empty values are allowed, we only care if the key exists
1161
+ return array(null, array_key_exists($identifier, $data));
1162
+ }
1163
+ return array($data[$identifier], $allow_empty);
1164
+ } // We need to go deeper
1165
+ else {
1166
+ return $this->getPart($data[$identifier], $identifiers, $allow_empty);
1167
+ }
1168
+ }
1169
+
1170
+ private function validationMustBeExcecuted($validation, $field, $values, $multiple){
1171
+ //always excecute requiredWith(out) rules
1172
+ if (in_array($validation['rule'], array('requiredWith', 'requiredWithout'))){
1173
+ return true;
1174
+ }
1175
+
1176
+ //do not execute if the field is optional and not set
1177
+ if($this->hasRule('optional', $field) && ! isset($values)){
1178
+ return false;
1179
+ }
1180
+
1181
+ //ignore empty input, except for required and accepted rule
1182
+ if (! $this->hasRule('required', $field) && ! in_array($validation['rule'], array('required', 'accepted'))){
1183
+ if($multiple){
1184
+ return count($values) != 0;
1185
+ }
1186
+ return (isset($values) && $values !== '');
1187
+ }
1188
+
1189
+ return true;
1190
+ }
1191
+ /**
1192
+ * Run validations and return boolean result
1193
+ *
1194
+ * @return bool
1195
+ */
1196
+ public function validate()
1197
+ {
1198
+ $set_to_break = false;
1199
+ foreach ($this->_validations as $v) {
1200
+ foreach ($v['fields'] as $field) {
1201
+ list($values, $multiple) = $this->getPart($this->_fields, explode('.', $field), false);
1202
+
1203
+ if (! $this->validationMustBeExcecuted($v, $field, $values, $multiple)){
1204
+ continue;
1205
+ }
1206
+
1207
+ // Callback is user-specified or assumed method on class
1208
+ $errors = $this->getRules();
1209
+ if (isset($errors[$v['rule']])) {
1210
+ $callback = $errors[$v['rule']];
1211
+ } else {
1212
+ $callback = array($this, 'validate' . ucfirst($v['rule']));
1213
+ }
1214
+
1215
+ if (!$multiple) {
1216
+ $values = array($values);
1217
+ } else if (! $this->hasRule('required', $field)){
1218
+ $values = array_filter($values);
1219
+ }
1220
+
1221
+ $result = true;
1222
+ foreach ($values as $value) {
1223
+ $result = $result && call_user_func($callback, $field, $value, $v['params'], $this->_fields);
1224
+ }
1225
+
1226
+ if (!$result) {
1227
+ $this->error($field, $v['message'], $v['params']);
1228
+ if ($this->stop_on_first_fail) {
1229
+ $set_to_break = true;
1230
+ break;
1231
+ }
1232
+ }
1233
+ }
1234
+ if ($set_to_break) {
1235
+ break;
1236
+ }
1237
+ }
1238
+
1239
+ return count($this->errors()) === 0;
1240
+ }
1241
+
1242
+ /**
1243
+ * Should the validation stop a rule is failed
1244
+ * @param bool $stop
1245
+ */
1246
+ public function stopOnFirstFail($stop = true)
1247
+ {
1248
+ $this->stop_on_first_fail = (bool)$stop;
1249
+ }
1250
+
1251
+ /**
1252
+ * Returns all rule callbacks, the static and instance ones.
1253
+ *
1254
+ * @return array
1255
+ */
1256
+ protected function getRules()
1257
+ {
1258
+ return array_merge($this->_instanceRules, static::$_rules);
1259
+ }
1260
+
1261
+ /**
1262
+ * Returns all rule message, the static and instance ones.
1263
+ *
1264
+ * @return array
1265
+ */
1266
+ protected function getRuleMessages()
1267
+ {
1268
+ return array_merge($this->_instanceRuleMessage, static::$_ruleMessages);
1269
+ }
1270
+
1271
+ /**
1272
+ * Determine whether a field is being validated by the given rule.
1273
+ *
1274
+ * @param string $name The name of the rule
1275
+ * @param string $field The name of the field
1276
+ * @return bool
1277
+ */
1278
+ protected function hasRule($name, $field)
1279
+ {
1280
+ foreach ($this->_validations as $validation) {
1281
+ if ($validation['rule'] == $name) {
1282
+ if (in_array($field, $validation['fields'])) {
1283
+ return true;
1284
+ }
1285
+ }
1286
+ }
1287
+
1288
+ return false;
1289
+ }
1290
+
1291
+ protected static function assertRuleCallback($callback)
1292
+ {
1293
+ if (!is_callable($callback)) {
1294
+ throw new \InvalidArgumentException(
1295
+ 'Second argument must be a valid callback. Given argument was not callable.'
1296
+ );
1297
+ }
1298
+ }
1299
+
1300
+ /**
1301
+ * Adds a new validation rule callback that is tied to the current
1302
+ * instance only.
1303
+ *
1304
+ * @param string $name
1305
+ * @param callable $callback
1306
+ * @param string $message
1307
+ * @throws \InvalidArgumentException
1308
+ */
1309
+ public function addInstanceRule($name, $callback, $message = null)
1310
+ {
1311
+ static::assertRuleCallback($callback);
1312
+
1313
+ $this->_instanceRules[$name] = $callback;
1314
+ $this->_instanceRuleMessage[$name] = $message;
1315
+ }
1316
+
1317
+ /**
1318
+ * Register new validation rule callback
1319
+ *
1320
+ * @param string $name
1321
+ * @param callable $callback
1322
+ * @param string $message
1323
+ * @throws \InvalidArgumentException
1324
+ */
1325
+ public static function addRule($name, $callback, $message = null)
1326
+ {
1327
+ if ($message === null) {
1328
+ $message = static::ERROR_DEFAULT;
1329
+ }
1330
+
1331
+ static::assertRuleCallback($callback);
1332
+
1333
+ static::$_rules[$name] = $callback;
1334
+ static::$_ruleMessages[$name] = $message;
1335
+ }
1336
+
1337
+ /**
1338
+ * @param mixed $fields
1339
+ * @return string
1340
+ */
1341
+ public function getUniqueRuleName($fields)
1342
+ {
1343
+ if (is_array($fields)) {
1344
+ $fields = implode("_", $fields);
1345
+ }
1346
+
1347
+ $orgName = "{$fields}_rule";
1348
+ $name = $orgName;
1349
+ $rules = $this->getRules();
1350
+ while (isset($rules[$name])) {
1351
+ $name = $orgName . "_" . rand(0, 10000);
1352
+ }
1353
+
1354
+ return $name;
1355
+ }
1356
+
1357
+ /**
1358
+ * Returns true if either a validator with the given name has been
1359
+ * registered or there is a default validator by that name.
1360
+ *
1361
+ * @param string $name
1362
+ * @return bool
1363
+ */
1364
+ public function hasValidator($name)
1365
+ {
1366
+ $rules = $this->getRules();
1367
+ return method_exists($this, "validate" . ucfirst($name))
1368
+ || isset($rules[$name]);
1369
+ }
1370
+
1371
+ /**
1372
+ * Convenience method to add a single validation rule
1373
+ *
1374
+ * @param string|callable $rule
1375
+ * @param array|string $fields
1376
+ * @return Validator
1377
+ * @throws \InvalidArgumentException
1378
+ */
1379
+ public function rule($rule, $fields)
1380
+ {
1381
+ // Get any other arguments passed to function
1382
+ $params = array_slice(func_get_args(), 2);
1383
+
1384
+ if (is_callable($rule)
1385
+ && !(is_string($rule) && $this->hasValidator($rule))) {
1386
+ $name = $this->getUniqueRuleName($fields);
1387
+ $message = isset($params[0]) ? $params[0] : null;
1388
+ $this->addInstanceRule($name, $rule, $message);
1389
+ $rule = $name;
1390
+ }
1391
+
1392
+ $errors = $this->getRules();
1393
+ if (!isset($errors[$rule])) {
1394
+ $ruleMethod = 'validate' . ucfirst($rule);
1395
+ if (!method_exists($this, $ruleMethod)) {
1396
+ throw new \InvalidArgumentException(
1397
+ "Rule '" . $rule . "' has not been registered with " . get_called_class() . "::addRule()."
1398
+ );
1399
+ }
1400
+ }
1401
+
1402
+ // Ensure rule has an accompanying message
1403
+ $messages = $this->getRuleMessages();
1404
+ $message = isset($messages[$rule]) ? $messages[$rule] : self::ERROR_DEFAULT;
1405
+
1406
+ // Ensure message contains field label
1407
+ if (function_exists('mb_strpos')) {
1408
+ $notContains = mb_strpos($message, '{field}') === false;
1409
+ } else {
1410
+ $notContains = strpos($message, '{field}') === false;
1411
+ }
1412
+ if ($notContains) {
1413
+ $message = '{field} ' . $message;
1414
+ }
1415
+
1416
+ $this->_validations[] = array(
1417
+ 'rule' => $rule,
1418
+ 'fields' => (array)$fields,
1419
+ 'params' => (array)$params,
1420
+ 'message' => $message
1421
+ );
1422
+
1423
+ return $this;
1424
+ }
1425
+
1426
+ /**
1427
+ * Add label to rule
1428
+ *
1429
+ * @param string $value
1430
+ * @return Validator
1431
+ */
1432
+ public function label($value)
1433
+ {
1434
+ $lastRules = $this->_validations[count($this->_validations) - 1]['fields'];
1435
+ $this->labels(array($lastRules[0] => $value));
1436
+
1437
+ return $this;
1438
+ }
1439
+
1440
+ /**
1441
+ * Add labels to rules
1442
+ *
1443
+ * @param array $labels
1444
+ * @return Validator
1445
+ */
1446
+ public function labels($labels = array())
1447
+ {
1448
+ $this->_labels = array_merge($this->_labels, $labels);
1449
+
1450
+ return $this;
1451
+ }
1452
+
1453
+ /**
1454
+ * @param string $field
1455
+ * @param string $message
1456
+ * @param array $params
1457
+ * @return array
1458
+ */
1459
+ protected function checkAndSetLabel($field, $message, $params)
1460
+ {
1461
+ if (isset($this->_labels[$field])) {
1462
+ $message = str_replace('{field}', $this->_labels[$field], $message);
1463
+
1464
+ if (is_array($params)) {
1465
+ $i = 1;
1466
+ foreach ($params as $k => $v) {
1467
+ $tag = '{field' . $i . '}';
1468
+ $label = isset($params[$k]) && (is_numeric($params[$k]) || is_string($params[$k])) && isset($this->_labels[$params[$k]]) ? $this->_labels[$params[$k]] : $tag;
1469
+ $message = str_replace($tag, $label, $message);
1470
+ $i++;
1471
+ }
1472
+ }
1473
+ } else {
1474
+ $message = str_replace('{field}', ucwords(str_replace('_', ' ', $field)), $message);
1475
+ }
1476
+
1477
+ return $message;
1478
+ }
1479
+
1480
+ /**
1481
+ * Convenience method to add multiple validation rules with an array
1482
+ *
1483
+ * @param array $rules
1484
+ */
1485
+ public function rules($rules)
1486
+ {
1487
+ foreach ($rules as $ruleType => $params) {
1488
+ if (is_array($params)) {
1489
+ foreach ($params as $innerParams) {
1490
+ if (!is_array($innerParams)) {
1491
+ $innerParams = (array)$innerParams;
1492
+ }
1493
+ array_unshift($innerParams, $ruleType);
1494
+ call_user_func_array(array($this, 'rule'), $innerParams);
1495
+ }
1496
+ } else {
1497
+ $this->rule($ruleType, $params);
1498
+ }
1499
+ }
1500
+ }
1501
+
1502
+ /**
1503
+ * Replace data on cloned instance
1504
+ *
1505
+ * @param array $data
1506
+ * @param array $fields
1507
+ * @return Validator
1508
+ */
1509
+ public function withData($data, $fields = array())
1510
+ {
1511
+ $clone = clone $this;
1512
+ $clone->_fields = !empty($fields) ? array_intersect_key($data, array_flip($fields)) : $data;
1513
+ $clone->_errors = array();
1514
+ return $clone;
1515
+ }
1516
+
1517
+ /**
1518
+ * Convenience method to add validation rule(s) by field
1519
+ *
1520
+ * @param string $field
1521
+ * @param array $rules
1522
+ */
1523
+ public function mapFieldRules($field, $rules)
1524
+ {
1525
+ $me = $this;
1526
+
1527
+ array_map(function ($rule) use ($field, $me) {
1528
+
1529
+ //rule must be an array
1530
+ $rule = (array)$rule;
1531
+
1532
+ //First element is the name of the rule
1533
+ $ruleName = array_shift($rule);
1534
+
1535
+ //find a custom message, if any
1536
+ $message = null;
1537
+ if (isset($rule['message'])) {
1538
+ $message = $rule['message'];
1539
+ unset($rule['message']);
1540
+ }
1541
+ //Add the field and additional parameters to the rule
1542
+ $added = call_user_func_array(array($me, 'rule'), array_merge(array($ruleName, $field), $rule));
1543
+ if (!empty($message)) {
1544
+ $added->message($message);
1545
+ }
1546
+ }, (array)$rules);
1547
+ }
1548
+
1549
+ /**
1550
+ * Convenience method to add validation rule(s) for multiple fields
1551
+ *
1552
+ * @param array $rules
1553
+ */
1554
+ public function mapFieldsRules($rules)
1555
+ {
1556
+ $me = $this;
1557
+ array_map(function ($field) use ($rules, $me) {
1558
+ $me->mapFieldRules($field, $rules[$field]);
1559
+ }, array_keys($rules));
1560
+ }
1561
+ }
woo-discount-rules.php CHANGED
@@ -5,13 +5,13 @@
5
  * Description: Simple to complex discount rules for your WooCommerce store. Core package.
6
  * Author: Flycart Technologies LLP
7
  * Author URI: https://www.flycart.org
8
- * Version: 2.1.2
9
  * Slug: woo-discount-rules
10
  * Text Domain: woo-discount-rules
11
  * Domain Path: /i18n/languages/
12
  * Requires at least: 4.6.1
13
  * WC requires at least: 3.0
14
- * WC tested up to: 4.3
15
  */
16
  if (!defined('ABSPATH')) {
17
  exit;
@@ -21,22 +21,11 @@ if (!defined('ABSPATH')) {
21
  * Current version of our app
22
  */
23
  if (!defined('WDR_VERSION')) {
24
- define('WDR_VERSION', '2.1.2');
25
  }
26
 
27
- global $awdr_load_version, $awdr_switched_to_version;
28
- /**
29
- * Save the load version of the plugin
30
- */
31
- if (isset($_GET['awdr_switch_plugin_to']) && in_array($_GET['awdr_switch_plugin_to'], array('v1', 'v2'))) {
32
- if(is_admin() && function_exists('current_user_can')){
33
- include_once(ABSPATH . 'wp-includes/pluggable.php');
34
- if (current_user_can( 'manage_woocommerce' )) {
35
- $awdr_switched_to_version = $version = sanitize_text_field($_GET['awdr_switch_plugin_to']);
36
- update_option('advanced_woo_discount_rules_load_version', $version);
37
- }
38
- }
39
- }
40
  $awdr_load_version = get_option('advanced_woo_discount_rules_load_version', null);
41
 
42
  if($awdr_load_version === null || empty($awdr_load_version)){
@@ -150,12 +139,15 @@ if ($awdr_load_version == "v2") {
150
  awdr_check_compatible();
151
  awdr_create_required_tables();
152
  });
153
- if ($awdr_switched_to_version == "v2") {
154
- awdr_create_required_tables();
 
 
 
 
 
 
155
  }
156
- add_action('admin_init', function () {
157
- awdr_create_required_tables();
158
- });
159
 
160
  // This is required to load the pro events before core initialize
161
  add_action('plugins_loaded', function () {
5
  * Description: Simple to complex discount rules for your WooCommerce store. Core package.
6
  * Author: Flycart Technologies LLP
7
  * Author URI: https://www.flycart.org
8
+ * Version: 2.2.0
9
  * Slug: woo-discount-rules
10
  * Text Domain: woo-discount-rules
11
  * Domain Path: /i18n/languages/
12
  * Requires at least: 4.6.1
13
  * WC requires at least: 3.0
14
+ * WC tested up to: 4.4
15
  */
16
  if (!defined('ABSPATH')) {
17
  exit;
21
  * Current version of our app
22
  */
23
  if (!defined('WDR_VERSION')) {
24
+ define('WDR_VERSION', '2.2.0');
25
  }
26
 
27
+ global $awdr_load_version;
28
+
 
 
 
 
 
 
 
 
 
 
 
29
  $awdr_load_version = get_option('advanced_woo_discount_rules_load_version', null);
30
 
31
  if($awdr_load_version === null || empty($awdr_load_version)){
139
  awdr_check_compatible();
140
  awdr_create_required_tables();
141
  });
142
+ if (isset($_GET['awdr_switch_plugin_to']) && in_array($_GET['awdr_switch_plugin_to'], array('v1', 'v2'))) {
143
+ if(is_admin() && $_GET['awdr_switch_plugin_to'] === "v2"){
144
+ awdr_create_required_tables();
145
+ }
146
+ } else {
147
+ add_action('admin_init', function () {
148
+ awdr_create_required_tables();
149
+ });
150
  }
 
 
 
151
 
152
  // This is required to load the pro events before core initialize
153
  add_action('plugins_loaded', function () {