AfterShip – WooCommerce Tracking - Version 1.4.7

Version Description

  • Add new couriers
Download this release

Release Info

Developer aftership
Plugin Icon 128x128 AfterShip – WooCommerce Tracking
Version 1.4.7
Comparing to
See all releases

Code changes from version 1.4.6 to 1.4.7

aftership.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: AfterShip - WooCommerce Tracking
4
  Plugin URI: http://aftership.com/
5
  Description: Add tracking number and carrier name to WooCommerce, display tracking info at order history page, auto import tracking numbers to AfterShip.
6
- Version: 1.4.6
7
  Author: AfterShip
8
  Author URI: http://aftership.com
9
 
3
  Plugin Name: AfterShip - WooCommerce Tracking
4
  Plugin URI: http://aftership.com/
5
  Description: Add tracking number and carrier name to WooCommerce, display tracking info at order history page, auto import tracking numbers to AfterShip.
6
+ Version: 1.4.7
7
  Author: AfterShip
8
  Author URI: http://aftership.com
9
 
assets/js/couriers.js CHANGED
@@ -1,5 +1,5 @@
1
  function get_couriers() {
2
- var data =[
3
  {
4
  "slug": "17postservice",
5
  "name": "17 Post Service",
@@ -12,6 +12,12 @@ function get_couriers() {
12
  "other_name": "Negros Navigation",
13
  "required_fields": []
14
  },
 
 
 
 
 
 
15
  {
16
  "slug": "4-72",
17
  "name": "4-72 Entregando",
@@ -54,6 +60,18 @@ function get_couriers() {
54
  "other_name": "Αναζήτηση Καταστημάτων",
55
  "required_fields": []
56
  },
 
 
 
 
 
 
 
 
 
 
 
 
57
  {
58
  "slug": "aeroflash",
59
  "name": "Mexico AeroFlash",
@@ -72,6 +90,12 @@ function get_couriers() {
72
  "other_name": "",
73
  "required_fields": []
74
  },
 
 
 
 
 
 
75
  {
76
  "slug": "an-post",
77
  "name": "An Post",
@@ -312,6 +336,12 @@ function get_couriers() {
312
  "other_name": "Collect Plus UK",
313
  "required_fields": []
314
  },
 
 
 
 
 
 
315
  {
316
  "slug": "correo-argentino",
317
  "name": "Correo Argentino",
@@ -368,6 +398,12 @@ function get_couriers() {
368
  "other_name": "CouriersPlease",
369
  "required_fields": []
370
  },
 
 
 
 
 
 
371
  {
372
  "slug": "cuckooexpress",
373
  "name": "Cuckoo Express",
@@ -486,6 +522,12 @@ function get_couriers() {
486
  "other_name": "DGM Asia",
487
  "required_fields": []
488
  },
 
 
 
 
 
 
489
  {
490
  "slug": "dhl-nl",
491
  "name": "DHL Netherlands",
@@ -614,6 +656,12 @@ function get_couriers() {
614
  "other_name": "CIS Post, u4e0au6d77u4e1cu64ce",
615
  "required_fields": []
616
  },
 
 
 
 
 
 
617
  {
618
  "slug": "ecom-express",
619
  "name": "Ecom Express",
@@ -635,7 +683,7 @@ function get_couriers() {
635
  {
636
  "slug": "empsexpress",
637
  "name": "EMPS Express",
638
- "other_name": "Shenzhen Express Mail & Parcel Service Freight Forwarding Co.,",
639
  "required_fields": []
640
  },
641
  {
@@ -876,6 +924,12 @@ function get_couriers() {
876
  "other_name": "भारतीय डाक, Speed Post & eMO, EMS, IPS Web",
877
  "required_fields": []
878
  },
 
 
 
 
 
 
879
  {
880
  "slug": "interlink-express",
881
  "name": "Interlink Express",
@@ -960,6 +1014,12 @@ function get_couriers() {
960
  "other_name": "KTTC",
961
  "required_fields": []
962
  },
 
 
 
 
 
 
963
  {
964
  "slug": "kn",
965
  "name": "Kuehne + Nagel",
@@ -978,6 +1038,12 @@ function get_couriers() {
978
  "other_name": "Coliposte",
979
  "required_fields": []
980
  },
 
 
 
 
 
 
981
  {
982
  "slug": "lasership",
983
  "name": "LaserShip",
@@ -992,10 +1058,16 @@ function get_couriers() {
992
  },
993
  {
994
  "slug": "lietuvos-pastas",
995
- "name": "Lietuvos paštas",
996
  "other_name": "Lithuania Post, LP Express",
997
  "required_fields": []
998
  },
 
 
 
 
 
 
999
  {
1000
  "slug": "lwe-hk",
1001
  "name": "Logistic Worldwide Express",
@@ -1020,6 +1092,18 @@ function get_couriers() {
1020
  "other_name": "PosDaftar",
1021
  "required_fields": []
1022
  },
 
 
 
 
 
 
 
 
 
 
 
 
1023
  {
1024
  "slug": "maxcellents",
1025
  "name": "Maxcellents Pte Ltd",
@@ -1038,6 +1122,14 @@ function get_couriers() {
1038
  "other_name": "Mexico Senda Express",
1039
  "required_fields": []
1040
  },
 
 
 
 
 
 
 
 
1041
  {
1042
  "slug": "mrw-spain",
1043
  "name": "MRW",
@@ -1130,6 +1222,12 @@ function get_couriers() {
1130
  "other_name": "Новая Почта",
1131
  "required_fields": []
1132
  },
 
 
 
 
 
 
1133
  {
1134
  "slug": "oca-ar",
1135
  "name": "OCA Argentina",
@@ -1142,6 +1240,12 @@ function get_couriers() {
1142
  "other_name": "ODFL",
1143
  "required_fields": []
1144
  },
 
 
 
 
 
 
1145
  {
1146
  "slug": "oneworldexpress",
1147
  "name": "One World Express",
@@ -1180,6 +1284,12 @@ function get_couriers() {
1180
  "tracking_account_number"
1181
  ]
1182
  },
 
 
 
 
 
 
1183
  {
1184
  "slug": "parcel-force",
1185
  "name": "Parcel Force",
@@ -1198,6 +1308,12 @@ function get_couriers() {
1198
  "other_name": "ParcelPost",
1199
  "required_fields": []
1200
  },
 
 
 
 
 
 
1201
  {
1202
  "slug": "poczta-polska",
1203
  "name": "Poczta Polska",
@@ -1341,12 +1457,24 @@ function get_couriers() {
1341
  "other_name": "Qxpress Qoo10",
1342
  "required_fields": []
1343
  },
 
 
 
 
 
 
1344
  {
1345
  "slug": "raf",
1346
  "name": "RAF Philippines",
1347
  "other_name": "RAF Int'l. Forwarding",
1348
  "required_fields": []
1349
  },
 
 
 
 
 
 
1350
  {
1351
  "slug": "ramgroup-za",
1352
  "name": "RAM",
@@ -1377,6 +1505,12 @@ function get_couriers() {
1377
  "other_name": "R+L Carriers",
1378
  "required_fields": []
1379
  },
 
 
 
 
 
 
1380
  {
1381
  "slug": "royal-mail",
1382
  "name": "Royal Mail",
@@ -1455,6 +1589,12 @@ function get_couriers() {
1455
  "other_name": "順豐國際",
1456
  "required_fields": []
1457
  },
 
 
 
 
 
 
1458
  {
1459
  "slug": "sgt-it",
1460
  "name": "SGT Corriere Espresso",
@@ -1512,6 +1652,12 @@ function get_couriers() {
1512
  "other_name": "Skynet UK",
1513
  "required_fields": []
1514
  },
 
 
 
 
 
 
1515
  {
1516
  "slug": "spain-correos-es",
1517
  "name": "Correos de España",
@@ -1698,12 +1844,6 @@ function get_couriers() {
1698
  "other_name": "Postnl TNT",
1699
  "required_fields": []
1700
  },
1701
- {
1702
- "slug": "toll-global-express",
1703
- "name": "Toll Global Express",
1704
- "other_name": "DPEX",
1705
- "required_fields": []
1706
- },
1707
  {
1708
  "slug": "toll-ipec",
1709
  "name": "Toll IPEC",
@@ -1868,6 +2008,12 @@ function get_couriers() {
1868
  "other_name": "YRC Freight",
1869
  "required_fields": []
1870
  },
 
 
 
 
 
 
1871
  {
1872
  "slug": "yundaex",
1873
  "name": "Yunda Express",
@@ -1880,6 +2026,12 @@ function get_couriers() {
1880
  "other_name": "云途物流",
1881
  "required_fields": []
1882
  },
 
 
 
 
 
 
1883
  {
1884
  "slug": "zjs-express",
1885
  "name": "ZJS International",
1
  function get_couriers() {
2
+ var data = [
3
  {
4
  "slug": "17postservice",
5
  "name": "17 Post Service",
12
  "other_name": "Negros Navigation",
13
  "required_fields": []
14
  },
15
+ {
16
+ "slug": "360lion",
17
+ "name": "360 Lion Express",
18
+ "other_name": "",
19
+ "required_fields": []
20
+ },
21
  {
22
  "slug": "4-72",
23
  "name": "4-72 Entregando",
60
  "other_name": "Αναζήτηση Καταστημάτων",
61
  "required_fields": []
62
  },
63
+ {
64
+ "slug": "adicional",
65
+ "name": "Adicional Logistics",
66
+ "other_name": "",
67
+ "required_fields": []
68
+ },
69
+ {
70
+ "slug": "adsone",
71
+ "name": "ADSOne",
72
+ "other_name": "ADSOne Group",
73
+ "required_fields": []
74
+ },
75
  {
76
  "slug": "aeroflash",
77
  "name": "Mexico AeroFlash",
90
  "other_name": "",
91
  "required_fields": []
92
  },
93
+ {
94
+ "slug": "airspeed",
95
+ "name": "Airspeed International Corporation",
96
+ "other_name": "Airspeed Philippines",
97
+ "required_fields": []
98
+ },
99
  {
100
  "slug": "an-post",
101
  "name": "An Post",
336
  "other_name": "Collect Plus UK",
337
  "required_fields": []
338
  },
339
+ {
340
+ "slug": "con-way",
341
+ "name": "Con-way Freight",
342
+ "other_name": "Conway",
343
+ "required_fields": []
344
+ },
345
  {
346
  "slug": "correo-argentino",
347
  "name": "Correo Argentino",
398
  "other_name": "CouriersPlease",
399
  "required_fields": []
400
  },
401
+ {
402
+ "slug": "cpacket",
403
+ "name": "cPacket",
404
+ "other_name": "u52a0u90aeu5b9d",
405
+ "required_fields": []
406
+ },
407
  {
408
  "slug": "cuckooexpress",
409
  "name": "Cuckoo Express",
522
  "other_name": "DGM Asia",
523
  "required_fields": []
524
  },
525
+ {
526
+ "slug": "dhl-hk",
527
+ "name": "DHL Hong Kong",
528
+ "other_name": "DHL HK Domestic",
529
+ "required_fields": []
530
+ },
531
  {
532
  "slug": "dhl-nl",
533
  "name": "DHL Netherlands",
656
  "other_name": "CIS Post, u4e0au6d77u4e1cu64ce",
657
  "required_fields": []
658
  },
659
+ {
660
+ "slug": "echo",
661
+ "name": "Echo",
662
+ "other_name": "Echo Global Logistics",
663
+ "required_fields": []
664
+ },
665
  {
666
  "slug": "ecom-express",
667
  "name": "Ecom Express",
683
  {
684
  "slug": "empsexpress",
685
  "name": "EMPS Express",
686
+ "other_name": "快信快包",
687
  "required_fields": []
688
  },
689
  {
924
  "other_name": "भारतीय डाक, Speed Post & eMO, EMS, IPS Web",
925
  "required_fields": []
926
  },
927
+ {
928
+ "slug": "inpost-paczkomaty",
929
+ "name": "InPost Paczkomaty",
930
+ "other_name": "",
931
+ "required_fields": []
932
+ },
933
  {
934
  "slug": "interlink-express",
935
  "name": "Interlink Express",
1014
  "other_name": "KTTC",
1015
  "required_fields": []
1016
  },
1017
+ {
1018
+ "slug": "kgmhub",
1019
+ "name": "KGM Hub",
1020
+ "other_name": "KGM",
1021
+ "required_fields": []
1022
+ },
1023
  {
1024
  "slug": "kn",
1025
  "name": "Kuehne + Nagel",
1038
  "other_name": "Coliposte",
1039
  "required_fields": []
1040
  },
1041
+ {
1042
+ "slug": "lao-post",
1043
+ "name": "Lao Post",
1044
+ "other_name": "Laos Postal Service",
1045
+ "required_fields": []
1046
+ },
1047
  {
1048
  "slug": "lasership",
1049
  "name": "LaserShip",
1058
  },
1059
  {
1060
  "slug": "lietuvos-pastas",
1061
+ "name": "Lietuvos Paštas",
1062
  "other_name": "Lithuania Post, LP Express",
1063
  "required_fields": []
1064
  },
1065
+ {
1066
+ "slug": "lion-parcel",
1067
+ "name": "Lion Parcel",
1068
+ "other_name": "",
1069
+ "required_fields": []
1070
+ },
1071
  {
1072
  "slug": "lwe-hk",
1073
  "name": "Logistic Worldwide Express",
1092
  "other_name": "PosDaftar",
1093
  "required_fields": []
1094
  },
1095
+ {
1096
+ "slug": "matdespatch",
1097
+ "name": "Matdespatch",
1098
+ "other_name": "",
1099
+ "required_fields": []
1100
+ },
1101
+ {
1102
+ "slug": "matkahuolto",
1103
+ "name": "Matkahuolto",
1104
+ "other_name": "Oy Matkahuolto Ab",
1105
+ "required_fields": []
1106
+ },
1107
  {
1108
  "slug": "maxcellents",
1109
  "name": "Maxcellents Pte Ltd",
1122
  "other_name": "Mexico Senda Express",
1123
  "required_fields": []
1124
  },
1125
+ {
1126
+ "slug": "mondialrelay",
1127
+ "name": "Mondial Relay",
1128
+ "other_name": "Mondial Relay France",
1129
+ "required_fields": [
1130
+ "tracking_postal_code"
1131
+ ]
1132
+ },
1133
  {
1134
  "slug": "mrw-spain",
1135
  "name": "MRW",
1222
  "other_name": "Новая Почта",
1223
  "required_fields": []
1224
  },
1225
+ {
1226
+ "slug": "nuvoex",
1227
+ "name": "NuvoEx",
1228
+ "other_name": "Nuvo Ex",
1229
+ "required_fields": []
1230
+ },
1231
  {
1232
  "slug": "oca-ar",
1233
  "name": "OCA Argentina",
1240
  "other_name": "ODFL",
1241
  "required_fields": []
1242
  },
1243
+ {
1244
+ "slug": "omniparcel",
1245
+ "name": "Omni Parcel",
1246
+ "other_name": "Omni-Channel Logistics (Seko)",
1247
+ "required_fields": []
1248
+ },
1249
  {
1250
  "slug": "oneworldexpress",
1251
  "name": "One World Express",
1284
  "tracking_account_number"
1285
  ]
1286
  },
1287
+ {
1288
+ "slug": "parcel-express",
1289
+ "name": "Parcel Express",
1290
+ "other_name": "Parcel Express Pte Ltd",
1291
+ "required_fields": []
1292
+ },
1293
  {
1294
  "slug": "parcel-force",
1295
  "name": "Parcel Force",
1308
  "other_name": "ParcelPost",
1309
  "required_fields": []
1310
  },
1311
+ {
1312
+ "slug": "pfcexpress",
1313
+ "name": "PFC Express",
1314
+ "other_name": "PFCu7687u5bb6u7269u6d41",
1315
+ "required_fields": []
1316
+ },
1317
  {
1318
  "slug": "poczta-polska",
1319
  "name": "Poczta Polska",
1457
  "other_name": "Qxpress Qoo10",
1458
  "required_fields": []
1459
  },
1460
+ {
1461
+ "slug": "raben-group",
1462
+ "name": "Raben Group",
1463
+ "other_name": "myRaben",
1464
+ "required_fields": []
1465
+ },
1466
  {
1467
  "slug": "raf",
1468
  "name": "RAF Philippines",
1469
  "other_name": "RAF Int'l. Forwarding",
1470
  "required_fields": []
1471
  },
1472
+ {
1473
+ "slug": "raiderex",
1474
+ "name": "RaidereX",
1475
+ "other_name": "Detrack",
1476
+ "required_fields": []
1477
+ },
1478
  {
1479
  "slug": "ramgroup-za",
1480
  "name": "RAM",
1505
  "other_name": "R+L Carriers",
1506
  "required_fields": []
1507
  },
1508
+ {
1509
+ "slug": "rocketparcel",
1510
+ "name": "Rocket Parcel International",
1511
+ "other_name": "",
1512
+ "required_fields": []
1513
+ },
1514
  {
1515
  "slug": "royal-mail",
1516
  "name": "Royal Mail",
1589
  "other_name": "順豐國際",
1590
  "required_fields": []
1591
  },
1592
+ {
1593
+ "slug": "sfcservice",
1594
+ "name": "SFC Service",
1595
+ "other_name": "u6df1u5733u4e09u6001u56fdu9645u901fu9012",
1596
+ "required_fields": []
1597
+ },
1598
  {
1599
  "slug": "sgt-it",
1600
  "name": "SGT Corriere Espresso",
1652
  "other_name": "Skynet UK",
1653
  "required_fields": []
1654
  },
1655
+ {
1656
+ "slug": "smsa-express",
1657
+ "name": "SMSA Express",
1658
+ "other_name": "",
1659
+ "required_fields": []
1660
+ },
1661
  {
1662
  "slug": "spain-correos-es",
1663
  "name": "Correos de España",
1844
  "other_name": "Postnl TNT",
1845
  "required_fields": []
1846
  },
 
 
 
 
 
 
1847
  {
1848
  "slug": "toll-ipec",
1849
  "name": "Toll IPEC",
2008
  "other_name": "YRC Freight",
2009
  "required_fields": []
2010
  },
2011
+ {
2012
+ "slug": "yto",
2013
+ "name": "YTO Express",
2014
+ "other_name": "u5706u901au901fu9012",
2015
+ "required_fields": []
2016
+ },
2017
  {
2018
  "slug": "yundaex",
2019
  "name": "Yunda Express",
2026
  "other_name": "云途物流",
2027
  "required_fields": []
2028
  },
2029
+ {
2030
+ "slug": "zalora-7-eleven",
2031
+ "name": "Zalora 7-Eleven",
2032
+ "other_name": "7-11",
2033
+ "required_fields": []
2034
+ },
2035
  {
2036
  "slug": "zjs-express",
2037
  "name": "ZJS International",
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: aftership
3
  Donate link: https://www.aftership.com/
4
  Tags: shipping, tracking, ups, usps, fedex, dhl, tnt, dpd, post, shipment, woocommerce, tracking number, aftership, package tracking, fulfilment, tracking link, carrier, courier, woo commerce, woocommerce shipment tracking, shipping details plugin, widget, shipstation, track, package
5
  Requires at least: 2.9
6
- Tested up to: 4.3.1
7
- Stable tag: 1.4.6
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -31,29 +31,26 @@ Upgrade to [Premium](https://www.aftership.com/premium) to automatically send ou
31
  [youtube http://www.youtube.com/watch?v=1zCCx8Ap9ms]
32
 
33
  ###Full list of supported carriers (200+):
34
- **①. US, Canada & Global Tracking (23)**
 
35
 
36
- FedEx UPS DHL Express • USPS • UPS Mail Innovations • TNT • DPD • Aramex • DHL Global Mail • Toll Global Express • UPS Freight • Canada Post • Purolator • APC Postal Logistics • OnTrac • YRC • Asendia USA • LaserShip • i-parcel • ABF Freight • Estes • RL Carriers • Greyhound
 
37
 
38
- **②. UK & Ireland Tracking (19)**
 
39
 
40
- Royal Mail Parcel Force • FedEx UK • DPD UK • SkyNet Worldwide Express • TNT UK • Interlink Express • UK Mail • YODEL • myHermes UK • City Link • Collect+ • DX • Deltec Courier • XDP Express • An Post • DPD Ireland • Fastway Ireland • Arrow XL
41
 
42
- **③. Europe Tracking (66)**
43
 
44
- Direct Link International Seur GLS • DHL Benelux • PostNord Logistics • Deutsche Post Mail • Deutsche Post DHL • Hermes Germany • DPD Germany • Austrian Post (Registered) • Austrian Post (Express) • Swiss Post • Correos de España • NACEX Spain • Spanish Seur • ASM • MRW • Redur Spain • Portugal CTT • Chronopost Portugal • Portugal Seur • La Poste • Colissimo • Chronopost France • Colis Privé • TNT France • Geodis Calberson France • PostNL Domestic • PostNL International • PostNL International 3S • DHL Netherlands • GLS Netherlands • Selektvracht • DHL Parcel NL • Belgium Post • bpost international • Itella Posti • Posten Norge • Sweden Posten • Post Danmark • Italy SDA • Poste Italiane Paccocelere • Poste Italiane • BRT Bartolini • GLS Italy • TNT Italy • Nexive (TNT Post Italy) • Russian Post • Nova Poshta • DHL Poland • Poczta Polska • DPD Poland • Siodemka • OPEK • Lietuvos paštas • Česká Pošta • ELTA Hellenic Post • ACS Courier • PTT Posta • Belpost • Bulgarian Posts • Hrvatska PoÅ¡ta • Kuehne + Nagel • Poșta Română • Cyprus Post • UkrPoshta
45
 
46
- **④. Asia & China Tracking (57)**
47
 
48
- DHL Global Mail Asia Kerry Express Thailand • Singapore Post • Singapore Speedpost • TAQBIN Singapore • Korea Post • CJ GLS • India Post Domestic • India Post International • Delhivery • Bluedart • DTDC India • Professional Couriers • Safexpress • Red Express • Red Express Waybill • First Flight Couriers • Gati-KWE • GoJaVAS • Japan Post • Yamato Japan • Sagawa • Taiwan Post • Malaysia Post EMS / Poslaju • Malaysia Post - Registered • TAQBIN Malaysia • GDEX • SkyNet Malaysia • City-Link Express • Thailand Thai Post • Dynamic Logistics • 2GO • Xend • AIR21 • Jam Express • Pos Indonesia Domestic • Pos Indonesia Int'l • JNE • RPX Indonesia • Tiki • Wahana • LBC Express • First Logistics • Vietnam Post • Vietnam Post EMS • ViettelPost • Cambodia Post • S.F. Express • China Post • China EMS • 4PX • Yanwen • EC-Firstclass • AuPost China • WeDo Logistics • PayPal Package • JCEX • STO Express • Flyt Express • Hong Kong Post • TAQBIN Hong Kong • TGX
49
 
50
- **⑤. Australia & New Zealand Tracking (10)**
51
-
52
- Australia Post • Toll Priority • Toll IPEC • TNT Australia • Fastway Australia • StarTrack • Star Track Express • Couriers Please • New Zealand Post • CourierPost
53
-
54
- **⑥. Latin America, Middle East & Other Tracking (18)**
55
-
56
- Correos de Mexico • Estafeta • Mexico Senda Express • Mexico Redpack • Mexico Multipack • Mexico AeroFlash • Brazil Correios • Flash Courier • Correos Chile • Correo Argentino • OCA Argentina • Israel Post • Israel Post Domestic • South African Post Office • Fastway South Africa • Saudi Post • NiPost • Evergreen
57
 
58
 
59
  == Installation ==
@@ -95,10 +92,11 @@ You'll find the FAQ on [AfterShip.com](https://aftership.uservoice.com/knowledge
95
 
96
  == Changelog ==
97
 
 
 
 
98
  = 1.4.6 =
99
- * Compatible up to WordPress 4.3.1
100
  * Add new couriers
101
- * Support 308 couriers, please check out supported couriers in https://www.aftership.com/courier
102
 
103
  = 1.4.5 =
104
  * Compatible up to WordPress 4.2.2
3
  Donate link: https://www.aftership.com/
4
  Tags: shipping, tracking, ups, usps, fedex, dhl, tnt, dpd, post, shipment, woocommerce, tracking number, aftership, package tracking, fulfilment, tracking link, carrier, courier, woo commerce, woocommerce shipment tracking, shipping details plugin, widget, shipstation, track, package
5
  Requires at least: 2.9
6
+ Tested up to: 4.2.2
7
+ Stable tag: 1.4.7
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
31
  [youtube http://www.youtube.com/watch?v=1zCCx8Ap9ms]
32
 
33
  ###Full list of supported carriers (200+):
34
+ **①. US, Canada & Global Tracking (35)**
35
+ ABF Freight • APC Postal Logistics • Aramex • Asendia USA • Canada Post • Canpar Courier • Con-way Freight • DACHSER • DHL Express • DHL eCommerce • DHL Express (Piece ID) • DPD • DSV • Echo • Ensenda • Estes • FedEx • FedEx Freight • Globegistics Inc. • Greyhound • i-parcel • LaserShip • Newgistics • Old Dominion Freight Line • OnTrac • Purolator • RL Carriers • RR Donnelley • TNT • TNT Reference • UPS • UPS Freight • UPS Mail Innovations • USPS • YRC
36
 
37
+ **②. UK & Ireland Tracking (30)**
38
+ 4Square Group • An Post • APC Overnight • Arrow XL • Asendia UK • Collect+ • Deltec Courier • DPD Ireland • DPD UK • Fastway Ireland • FedEx UK • Hermesworld • Homedirect Logistics • Interlink Express • myHermes UK • Nightline • Norsk Global • Panther • Parcel Force • Royal Mail • SkyNet Worldwide Express • Skynet Worldwide Express UK • TNT UK • TNT UK Reference • Tuffnells Parcels Express • UK Mail • XDP Express • XDP Express Reference • Yodel Domestic • Yodel International
39
 
40
+ **③. Europe Tracking (93)**
41
+ ACS Courier • Asendia Germany • ASM • Austrian Post (Express) • Austrian Post (Registered) • Belpost • Bert Transport • Bulgarian Posts • JP BH Pošta • Belgium Post • bpost international • BRT Bartolini • CBL Logistics • Česká Pošta • Chronopost France • Chronopost Portugal • Colis Privé • Colissimo • Correos Express • Cyprus Post • Post Danmark • DB Schenker Sweden • Deutsche Post Mail • DHL Benelux • DHL 2-Mann-Handling • DHL Spain Domestic • Deutsche Post DHL • DHL Netherlands • DHL Poland Domestic • DHL Parcel NL • Direct Link • DMM Network • DPD Germany • DPD Poland • Easy Mail • ELTA Hellenic Post • Envialia • Exapaq • FERCAM Logistics & Transport • Geodis Calberson France • GLS • GLS Italy • GLS Netherlands • Hermes Germany • Hrvatska Pošta • IMX Mail • InPost Paczkomaty • International Seur • Italy SDA • Kuehne + Nagel • La Poste • Lietuvos Paštas • Magyar Posta • Matkahuolto • Mondial Relay • MRW • NACEX Spain • Nova Poshta • FedEx Poland Domestic • Packlink • Poczta Polska • Portugal CTT • Portugal Seur • Poșta Română • Poste Italiane • Poste Italiane Paccocelere • Posten Norge / Bring • Itella Posti • PostNL Domestic • PostNL International 3S • PostNL International • PostNord Logistics • Iceland Post • PTT Posta • Raben Group • Redur Spain • Russian Post • SGT Corriere Espresso • Teliway SIC Express • Siodemka • Correos de España • Spanish Seur • Speed Couriers • Sweden Posten • Swiss Post • Geniki Taxydromiki • TNT-Click Italy • TNT France • TNT Italy • Nexive (TNT Post Italy) • TrakPak • TransMission • UkrPoshta
42
 
43
+ **④. Asia & China Tracking (125)**
44
 
45
+ 2GO ABX Express • AIR21 • Airpak Express • Airspeed International Corporation • Bluedart • Cambodia Post • City-Link Express • CJ GLS • Delcart • Delhivery • Delivree King • Detrack • DHL Global Mail Asia • Dotzot • DPEX • DTDC India • Dynamic Logistics • Ecargo • Ecom Express • Fastrak Services • First Flight Couriers • First Logistics • Gati-KWE • GDEX • Giao hà ng nhanh • GoJavas • India Post Domestic • India Post International • Jam Express • Japan Post • Jayon Express (JEX) • Jet-Ship Worldwide • JNE • Kangaroo Worldwide Express • Kerry Express Thailand • Kerry TTC Express • KGM Hub • Korea Post • Lao Post • LBC Express • Lion Parcel • Malaysia Post EMS / Poslaju • Malaysia Post - Registered • Maxcellents Pte Ltd • Mypostonline • Nationwide Express • Nhans Solutions • Ninja Van • Ninja Van Malaysia • NuvoEx • Omni Parcel • Pandu Logistics • Parcel Express • Parcelled.in • Parcel Post Singapore • Pos Indonesia Domestic • Pos Indonesia Int'l • Professional Couriers • Quantium • Qxpress • RAF Philippines • Red Express • Red Express Waybill • RPX Indonesia • RPX Online • RZY Express • Safexpress • Sagawa • Singapore Post • Singapore Speedpost • SingParcel Service • SkyNet Malaysia • Spreadel • SRE Korea • Taiwan Post • Yamato Japan • TAQBIN Malaysia • TAQBIN Singapore • Thailand Thai Post • Tiki • ViettelPost • Vietnam Post • Vietnam Post EMS • Wahana • Xend Express • XpressBees • Zalora 7-Eleven • 17 Post Service • 4PX • Best Express • AuPost China • BOXC • China EMS • China Post • CNE Express • Cuckoo Express • DHL Hong Kong • EC-Firstclass • EC Express • EMPS Express • Equick China • Flyt Express • GoFly • Hua Han Logistics • Hong Kong Post • JCEX • Logistic Worldwide Express • Nanjing Woyuan • One World Express • Post56 • PayPal Package • SEKO Logistics • S.F. Express • S.F International • STO Express • DPEX China • TAQBIN Hong Kong • TGX • WeDo Logistics • WishPost • Yanwen • Yunda Express • Yun Express • ZJS International
46
 
47
+ **⑤. Australia & New Zealand Tracking (14)**
48
 
49
+ ADSOne Australia Post Bonds Couriers • CourierPost • Couriers Please • Fastway Australia • Fastway New Zealand • New Zealand Post • StarTrack • Star Track Express • TNT Australia • Toll IPEC • Toll Priority • UBI Logistics Australia
50
 
51
+ **⑥. Latin America, Middle East & Other Tracking (27)**
52
 
53
+ 4-72 Entregando Mexico AeroFlash Brazil Correios • Correo Argentino • Correos Chile • Correos de Mexico • Cosmetics Now • Courier Plus • Courier IT • Dawn Wing • DPE South Africa • Emirates Post • Estafeta • Fastway South Africa • Israel Post • Israel Post Domestic • Mexico Redpack • Mexico Senda Express • NiPost • OCA Argentina • Post Serbia • RAM • South African Post Office • Saudi Post • SMSA Express • Specialised Freight • Speedex Courier
 
 
 
 
 
 
54
 
55
 
56
  == Installation ==
92
 
93
  == Changelog ==
94
 
95
+ = 1.4.7 =
96
+ * Add new couriers
97
+
98
  = 1.4.6 =
 
99
  * Add new couriers
 
100
 
101
  = 1.4.5 =
102
  * Compatible up to WordPress 4.2.2
trunk/aftership-fields.php DELETED
@@ -1,86 +0,0 @@
1
- <?php
2
- /**
3
- * Created by PhpStorm.
4
- * User: Sunny Chow
5
- * Date: 4/2/15
6
- * Time: 6:08 PM
7
- */
8
-
9
- $aftership_fields = array(
10
- 'aftership_tracking_provider_name' => array(
11
- 'id' => 'aftership_tracking_provider_name',
12
- 'type' => 'text',
13
- 'label' => '',
14
- 'placeholder' => '',
15
- 'description' => '',
16
- 'class' => 'hidden'
17
- ),
18
-
19
- 'aftership_tracking_required_fields' => array(
20
- 'id' => 'aftership_tracking_required_fields',
21
- 'type' => 'text',
22
- 'label' => '',
23
- 'placeholder' => '',
24
- 'description' => '',
25
- 'class' => 'hidden'
26
- ),
27
-
28
- 'aftership_tracking_number' => array(
29
- 'id' => 'aftership_tracking_number',
30
- 'type' => 'text',
31
- 'label' => 'Tracking number',
32
- 'placeholder' => '',
33
- 'description' => '',
34
- 'class' => ''
35
- ),
36
-
37
- 'aftership_tracking_shipdate' => array(
38
- 'key' => 'tracking_ship_date',
39
- 'id' => 'aftership_tracking_shipdate',
40
- 'type' => 'date',
41
- 'label' => 'Date shipped',
42
- 'placeholder' => 'YYYY-MM-DD',
43
- 'description' => '',
44
- 'class' => 'date-picker-field hidden-field'
45
- ),
46
-
47
- 'aftership_tracking_postal' => array(
48
- 'key' => 'tracking_postal_code',
49
- 'id' => 'aftership_tracking_postal',
50
- 'type' => 'text',
51
- 'label' => 'Postal Code',
52
- 'placeholder' => '',
53
- 'description' => '',
54
- 'class' => 'hidden-field'
55
- ),
56
-
57
- 'aftership_tracking_account' => array(
58
- 'key' => 'tracking_account_number',
59
- 'id' => 'aftership_tracking_account',
60
- 'type' => 'text',
61
- 'label' => 'Account name',
62
- 'placeholder' => '',
63
- 'description' => '',
64
- 'class' => 'hidden-field'
65
- ),
66
-
67
- 'aftership_tracking_key' => array(
68
- 'key' => 'tracking_key',
69
- 'id' => 'aftership_tracking_key',
70
- 'type' => 'text',
71
- 'label' => 'Tracking key',
72
- 'placeholder' => '',
73
- 'description' => '',
74
- 'class' => 'hidden-field'
75
- ),
76
-
77
- 'aftership_tracking_destination_country' => array(
78
- 'key' => 'tracking_destination_country',
79
- 'id' => 'aftership_tracking_destination_country',
80
- 'type' => 'text',
81
- 'label' => 'Destination Country',
82
- 'placeholder' => '',
83
- 'description' => '',
84
- 'class' => 'hidden-field'
85
- )
86
- );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/aftership-functions.php DELETED
@@ -1,15 +0,0 @@
1
- <?php
2
- /**
3
- * Functions used by plugins
4
- */
5
- if ( ! class_exists( 'AfterShip_Dependencies' ) )
6
- require_once 'class-aftership-dependencies.php';
7
-
8
- /**
9
- * WC Detection
10
- */
11
- if ( ! function_exists( 'is_woocommerce_active' ) ) {
12
- function is_woocommerce_active() {
13
- return AfterShip_Dependencies::woocommerce_active_check();
14
- }
15
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/aftership.php DELETED
@@ -1,582 +0,0 @@
1
- <?php
2
- /*
3
- Plugin Name: AfterShip - WooCommerce Tracking
4
- Plugin URI: http://aftership.com/
5
- Description: Add tracking number and carrier name to WooCommerce, display tracking info at order history page, auto import tracking numbers to AfterShip.
6
- Version: 1.4.6
7
- Author: AfterShip
8
- Author URI: http://aftership.com
9
-
10
- Copyright: © AfterShip
11
- */
12
-
13
- /**
14
- * Security Note
15
- */
16
- defined('ABSPATH') or die("No script kiddies please!");
17
-
18
- /**
19
- * Required functions
20
- */
21
- if (!function_exists('is_woocommerce_active'))
22
- require_once('aftership-functions.php');
23
-
24
-
25
- /**
26
- * Plugin updates
27
- */
28
-
29
- if (is_woocommerce_active()) {
30
-
31
- /**
32
- * AfterShip class
33
- */
34
- if (!class_exists('AfterShip')) {
35
-
36
- final class AfterShip
37
- {
38
-
39
- protected static $_instance = null;
40
-
41
- public static function instance()
42
- {
43
- if (is_null(self::$_instance)) {
44
- self::$_instance = new self();
45
- }
46
- return self::$_instance;
47
- }
48
-
49
-
50
- /**
51
- * Constructor
52
- */
53
- public function __construct()
54
- {
55
- $this->includes();
56
-
57
- $this->api = new AfterShip_API();
58
-
59
- $options = get_option('aftership_option_name');
60
- if ($options) {
61
-
62
- if (isset($options['plugin'])) {
63
- $plugin = $options['plugin'];
64
- if ($plugin == 'aftership') {
65
- add_action('admin_print_scripts', array(&$this, 'library_scripts'));
66
- add_action('admin_print_styles', array(&$this, 'admin_styles'));
67
- add_action('add_meta_boxes', array(&$this, 'add_meta_box'));
68
- add_action('woocommerce_process_shop_order_meta', array(&$this, 'save_meta_box'), 0, 2);
69
- add_action('plugins_loaded', array($this, 'load_plugin_textdomain'));
70
-
71
- $this->couriers = $options['couriers'];
72
- }
73
-
74
- // View Order Page
75
- $this->plugin = $plugin;
76
- } else {
77
- $this->plugin = '';
78
- }
79
-
80
- if (isset($options['use_track_button'])) {
81
- $this->use_track_button = $options['use_track_button'];
82
- } else {
83
- $this->use_track_button = false;
84
- }
85
-
86
- add_action('woocommerce_view_order', array(&$this, 'display_tracking_info'));
87
- add_action('woocommerce_email_before_order_table', array(&$this, 'email_display'));
88
-
89
- }
90
-
91
- // user profile api key
92
- add_action('show_user_profile', array($this, 'add_api_key_field'));
93
- add_action('edit_user_profile', array($this, 'add_api_key_field'));
94
- add_action('personal_options_update', array($this, 'generate_api_key'));
95
- add_action('edit_user_profile_update', array($this, 'generate_api_key'));
96
-
97
- register_activation_hook(__FILE__, array($this, 'install'));
98
- }
99
-
100
- public function install()
101
- {
102
- global $wp_roles;
103
-
104
- if (class_exists('WP_Roles')) {
105
- if (!isset($wp_roles)) {
106
- $wp_roles = new WP_Roles();
107
- }
108
- }
109
-
110
- if (is_object($wp_roles)) {
111
- $wp_roles->add_cap('administrator', 'manage_aftership');
112
- }
113
- }
114
-
115
- private function includes()
116
- {
117
- include_once('aftership-fields.php');
118
- $this->aftership_fields = $aftership_fields;
119
-
120
- include_once('class-aftership-api.php');
121
- include_once('class-aftership-settings.php');
122
- }
123
-
124
- /**
125
- * Localisation
126
- */
127
- public function load_plugin_textdomain()
128
- {
129
- load_plugin_textdomain('aftership', false, dirname(plugin_basename(__FILE__)) . '/languages/');
130
- }
131
-
132
- public function admin_styles()
133
- {
134
- wp_enqueue_style('aftership_styles_chosen', plugins_url(basename(dirname(__FILE__))) . '/assets/plugin/chosen/chosen.min.css');
135
- wp_enqueue_style('aftership_styles', plugins_url(basename(dirname(__FILE__))) . '/assets/css/admin.css');
136
- }
137
-
138
- public function library_scripts()
139
- {
140
- wp_enqueue_script('aftership_styles_chosen_jquery', plugins_url(basename(dirname(__FILE__))) . '/assets/plugin/chosen/chosen.jquery.min.js');
141
- wp_enqueue_script('aftership_styles_chosen_proto', plugins_url(basename(dirname(__FILE__))) . '/assets/plugin/chosen/chosen.proto.min.js');
142
- wp_enqueue_script('aftership_script_util', plugins_url(basename(dirname(__FILE__))) . '/assets/js/util.js');
143
- wp_enqueue_script('aftership_script_couriers', plugins_url(basename(dirname(__FILE__))) . '/assets/js/couriers.js');
144
- wp_enqueue_script('aftership_script_admin', plugins_url(basename(dirname(__FILE__))) . '/assets/js/admin.js');
145
- wp_enqueue_script('aftership_script_footer', plugins_url(basename(dirname(__FILE__))) . '/assets/js/footer.js', true);
146
- }
147
-
148
- /**
149
- * Add the meta box for shipment info on the order page
150
- *
151
- * @access public
152
- */
153
- public function add_meta_box()
154
- {
155
- add_meta_box('woocommerce-aftership', __('AfterShip', 'wc_aftership'), array(&$this, 'meta_box'), 'shop_order', 'side', 'high');
156
- }
157
-
158
- /**
159
- * Show the meta box for shipment info on the order page
160
- *
161
- * @access public
162
- */
163
- public function meta_box()
164
- {
165
-
166
- // just draw the layout, no data
167
- global $post;
168
-
169
- $selected_provider = get_post_meta($post->ID, '_aftership_tracking_provider', true);
170
-
171
- echo '<div id="aftership_wrapper">';
172
-
173
- echo '<p class="form-field"><label for="aftership_tracking_provider">' . __('Carrier:', 'wc_aftership') . '</label><br/><select id="aftership_tracking_provider" name="aftership_tracking_provider" class="chosen_select" style="width:100%">';
174
- if ($selected_provider == '') {
175
- $selected_text = 'selected="selected"';
176
- } else {
177
- $selected_text = '';
178
- }
179
- echo '<option disabled ' . $selected_text . ' value="">Please Select</option>';
180
- echo '</select>';
181
- echo '<br><a href="options-general.php?page=aftership-setting-admin">Update carrier list</a>';
182
- echo '<input type="hidden" id="aftership_tracking_provider_hidden" value="' . $selected_provider . '"/>';
183
- echo '<input type="hidden" id="aftership_couriers_selected" value="' . $this->couriers . '"/>';
184
-
185
- foreach ($this->aftership_fields as $field) {
186
- if ($field['type'] == 'date') {
187
- woocommerce_wp_text_input(array(
188
- 'id' => $field['id'],
189
- 'label' => __($field['label'], 'wc_aftership'),
190
- 'placeholder' => $field['placeholder'],
191
- 'description' => $field['description'],
192
- 'class' => $field['class'],
193
- 'value' => ($date = get_post_meta($post->ID, '_' . $field['id'], true)) ? date('Y-m-d', $date) : ''
194
- ));
195
- } else {
196
- woocommerce_wp_text_input(array(
197
- 'id' => $field['id'],
198
- 'label' => __($field['label'], 'wc_aftership'),
199
- 'placeholder' => $field['placeholder'],
200
- 'description' => $field['description'],
201
- 'class' => $field['class'],
202
- 'value' => get_post_meta($post->ID, '_' . $field['id'], true),
203
- ));
204
- }
205
- }
206
-
207
- //
208
- // woocommerce_wp_text_input(array(
209
- // 'id' => 'aftership_tracking_provider_name',
210
- // 'label' => __('', 'wc_aftership'),
211
- // 'placeholder' => '',
212
- // 'description' => '',
213
- // 'class' => 'hidden',
214
- // 'value' => get_post_meta($post->ID, '_aftership_tracking_provider_name', true),
215
- // ));
216
- //
217
- // woocommerce_wp_text_input(array(
218
- // 'id' => 'aftership_tracking_required_fields',
219
- // 'label' => __('', 'wc_aftership'),
220
- // 'placeholder' => '',
221
- // 'description' => '',
222
- // 'class' => 'hidden',
223
- // 'value' => get_post_meta($post->ID, '_aftership_tracking_required_fields', true),
224
- // ));
225
- //
226
- // woocommerce_wp_text_input(array(
227
- // 'id' => 'aftership_tracking_number',
228
- // 'label' => __('Tracking number:', 'wc_aftership'),
229
- // 'placeholder' => '',
230
- // 'description' => '',
231
- // 'value' => get_post_meta($post->ID, '_aftership_tracking_number', true),
232
- // ));
233
- //
234
- // woocommerce_wp_text_input(array(
235
- // 'id' => 'aftership_tracking_shipdate',
236
- // 'label' => __('Date shipped:', 'wc_aftership'),
237
- // 'placeholder' => 'YYYY-MM-DD',
238
- // 'description' => '',
239
- // 'class' => 'date-picker-field hidden-field',
240
- // 'value' => ($date = get_post_meta($post->ID, '_aftership_tracking_shipdate', true)) ? date('Y-m-d', $date) : ''
241
- // ));
242
- //
243
- // woocommerce_wp_text_input(array(
244
- // 'id' => 'aftership_tracking_postal',
245
- // 'label' => __('Postal Code:', 'wc_aftership'),
246
- // 'placeholder' => '',
247
- // 'description' => '',
248
- // 'class' => 'hidden-field',
249
- // 'value' => get_post_meta($post->ID, '_aftership_tracking_postal', true),
250
- // ));
251
- //
252
- // woocommerce_wp_text_input(array(
253
- // 'id' => 'aftership_tracking_account',
254
- // 'label' => __('Account name:', 'wc_aftership'),
255
- // 'placeholder' => '',
256
- // 'description' => '',
257
- // 'class' => 'hidden-field',
258
- // 'value' => get_post_meta($post->ID, '_aftership_tracking_account', true),
259
- // ));
260
- //
261
- // woocommerce_wp_text_input(array(
262
- // 'id' => 'aftership_tracking_key',
263
- // 'label' => __('Tracking key:', 'wc_aftership'),
264
- // 'placeholder' => '',
265
- // 'description' => '',
266
- // 'class' => 'hidden-field',
267
- // 'value' => get_post_meta($post->ID, '_aftership_tracking_key', true),
268
- // ));
269
- //
270
- // woocommerce_wp_text_input(array(
271
- // 'id' => 'aftership_tracking_destination_country',
272
- // 'label' => __('Destination Country:', 'wc_aftership'),
273
- // 'placeholder' => '',
274
- // 'description' => '',
275
- // 'class' => 'hidden-field',
276
- // 'value' => get_post_meta($post->ID, '_aftership_tracking_destination_country', true),
277
- // ));
278
- echo '</div>';
279
- }
280
-
281
- /**
282
- * Order Downloads Save
283
- *
284
- * Function for processing and storing all order downloads.
285
- */
286
- public function save_meta_box($post_id, $post)
287
- {
288
- if (isset($_POST['aftership_tracking_number'])) {
289
- //
290
- // // Download data
291
- $tracking_provider = woocommerce_clean($_POST['aftership_tracking_provider']);
292
- // $tracking_number = woocommerce_clean($_POST['aftership_tracking_number']);
293
- // $tracking_provider_name = woocommerce_clean($_POST['aftership_tracking_provider_name']);
294
- // $tracking_required_fields = woocommerce_clean($_POST['aftership_tracking_required_fields']);
295
- // $shipdate = woocommerce_clean(strtotime($_POST['aftership_tracking_shipdate']));
296
- // $postal = woocommerce_clean($_POST['aftership_tracking_postal']);
297
- // $account = woocommerce_clean($_POST['aftership_tracking_account']);
298
- // $tracking_key = woocommerce_clean($_POST['aftership_tracking_key']);
299
- // $tracking_destination_country = woocommerce_clean($_POST['aftership_tracking_destination_country']);
300
- //
301
- // // Update order data
302
- update_post_meta($post_id, '_aftership_tracking_provider', $tracking_provider);
303
- // update_post_meta($post_id, '_aftership_tracking_number', $tracking_number);
304
- // update_post_meta($post_id, '_aftership_tracking_provider_name', $tracking_provider_name);
305
- // update_post_meta($post_id, '_aftership_tracking_required_fields', $tracking_required_fields);
306
- // update_post_meta($post_id, '_aftership_tracking_shipdate', $shipdate);
307
- // update_post_meta($post_id, '_aftership_tracking_postal', $postal);
308
- // update_post_meta($post_id, '_aftership_tracking_account', $account);
309
- // update_post_meta($post_id, '_aftership_tracking_key', $tracking_key);
310
- // update_post_meta($post_id, '_aftership_tracking_destination_country', $tracking_destination_country);
311
-
312
-
313
- foreach ($this->aftership_fields as $field) {
314
- if ($field['type'] == 'date') {
315
- update_post_meta($post_id, '_' . $field['id'], woocommerce_clean(strtotime($_POST[$field['id']])));
316
- } else {
317
- update_post_meta($post_id, '_' . $field['id'], woocommerce_clean($_POST[$field['id']]));
318
- }
319
- }
320
- }
321
- }
322
-
323
- /**
324
- * Display the API key info for a user
325
- *
326
- * @since 2.1
327
- * @param WP_User $user
328
- */
329
- public function add_api_key_field($user)
330
- {
331
-
332
- if (!current_user_can('manage_aftership'))
333
- return;
334
-
335
- if (current_user_can('edit_user', $user->ID)) {
336
- ?>
337
- <h3>AfterShip</h3>
338
- <table class="form-table">
339
- <tbody>
340
- <tr>
341
- <th><label
342
- for="aftership_wp_api_key"><?php _e('AfterShip\'s WordPress API Key', 'aftership'); ?></label>
343
- </th>
344
- <td>
345
- <?php if (empty($user->aftership_wp_api_key)) : ?>
346
- <input name="aftership_wp_generate_api_key" type="checkbox"
347
- id="aftership_wp_generate_api_key" value="0"/>
348
- <span class="description"><?php _e('Generate API Key', 'aftership'); ?></span>
349
- <?php else : ?>
350
- <code id="aftership_wp_api_key"><?php echo $user->aftership_wp_api_key ?></code>
351
- <br/>
352
- <input name="aftership_wp_generate_api_key" type="checkbox"
353
- id="aftership_wp_generate_api_key" value="0"/>
354
- <span class="description"><?php _e('Revoke API Key', 'aftership'); ?></span>
355
- <?php endif; ?>
356
- </td>
357
- </tr>
358
- </tbody>
359
- </table>
360
- <?php
361
- }
362
- }
363
-
364
- /**
365
- * Generate and save (or delete) the API keys for a user
366
- *
367
- * @since 2.1
368
- * @param int $user_id
369
- */
370
- public function generate_api_key($user_id)
371
- {
372
-
373
- if (current_user_can('edit_user', $user_id)) {
374
-
375
- $user = get_userdata($user_id);
376
-
377
- // creating/deleting key
378
- if (isset($_POST['aftership_wp_generate_api_key'])) {
379
-
380
- // consumer key
381
- if (empty($user->aftership_wp_api_key)) {
382
-
383
- $api_key = 'ck_' . hash('md5', $user->user_login . date('U') . mt_rand());
384
-
385
- update_user_meta($user_id, 'aftership_wp_api_key', $api_key);
386
-
387
- } else {
388
-
389
- delete_user_meta($user_id, 'aftership_wp_api_key');
390
- }
391
-
392
- }
393
- }
394
- }
395
-
396
- /**
397
- * Display Shipment info in the frontend (order view/tracking page).
398
- *
399
- * @access public
400
- */
401
- function display_tracking_info($order_id, $for_email = false)
402
- {
403
- if ($this->plugin == 'aftership') {
404
- $this->display_order_aftership($order_id, $for_email);
405
- } else if ($this->plugin == 'wc-shipment-tracking') { //$49
406
- $this->display_order_wc_shipment_tracking($order_id, $for_email);
407
- }
408
- }
409
-
410
- private function display_order_aftership($order_id, $for_email)
411
- {
412
-
413
- // print_r($this->aftership_fields);
414
- $values = array();
415
- foreach ($this->aftership_fields as $field) {
416
- $values[$field['id']] = get_post_meta($order_id, '_' . $field['id'], true);
417
- if ($field['type'] == 'date' && $values[$field['id']]) {
418
- $values[$field['id']] = date_i18n(__('l jS F Y', 'wc_shipment_tracking'), $values[$field['id']]);
419
- }
420
- }
421
- $values['aftership_tracking_provider'] = get_post_meta($order_id, '_aftership_tracking_provider', true);
422
-
423
- if (!$values['aftership_tracking_provider'])
424
- return;
425
-
426
- if (!$values['aftership_tracking_number'])
427
- return;
428
-
429
-
430
- $options = get_option('aftership_option_name');
431
- if (array_key_exists('track_message_1', $options) && array_key_exists('track_message_2', $options)) {
432
- $track_message_1 = $options['track_message_1'];
433
- $track_message_2 = $options['track_message_2'];
434
- } else {
435
- $track_message_1 = 'Your order was shipped via ';
436
- $track_message_2 = 'Tracking number is ';
437
- }
438
-
439
- $required_fields_values = array();
440
- $provider_required_fields = explode(",", $values['aftership_tracking_required_fields']);
441
- foreach ($provider_required_fields as $field) {
442
- foreach ($this->aftership_fields as $aftership_field) {
443
- if (array_key_exists('key', $aftership_field) && $field == $aftership_field['key']) {
444
- array_push($required_fields_values, $values[$aftership_field['id']]);
445
- }
446
- }
447
- }
448
-
449
- if (count($required_fields_values)) {
450
- $required_fields_msg = ' (' . join(', ', $required_fields_values) . ')';
451
- } else {
452
- $required_fields_msg = '';
453
- }
454
-
455
-
456
- echo $track_message_1 . $values['aftership_tracking_provider_name'] . '<br/>' . $track_message_2 . $values['aftership_tracking_number'] . $required_fields_msg;
457
-
458
- if (!$for_email && $this->use_track_button) {
459
- $this->display_track_button($values['aftership_tracking_provider'], $values['aftership_tracking_number']);
460
- }
461
-
462
- //-------------------------------------------------------------------------------------
463
- /*
464
- $tracking_provider = get_post_meta($order_id, '_aftership_tracking_provider', true);
465
- $tracking_number = get_post_meta($order_id, '_aftership_tracking_number', true);
466
- $tracking_provider_name = get_post_meta($order_id, '_aftership_tracking_provider_name', true);
467
- $tracking_required_fields = get_post_meta($order_id, '_aftership_tracking_required_fields', true);
468
- $date_shipped = get_post_meta($order_id, '_aftership_tracking_shipdate', true);
469
- $postcode = get_post_meta($order_id, '_aftership_tracking_postal', true);
470
- $account = get_post_meta($order_id, '_aftership_tracking_account', true);
471
-
472
- if (!$tracking_provider)
473
- return;
474
-
475
- if (!$tracking_number)
476
- return;
477
-
478
- $provider_name = $tracking_provider_name;
479
- $provider_required_fields = explode(",", $tracking_required_fields);
480
-
481
- $date_shipped_str = '';
482
- $postcode_str = '';
483
- $account_str = '';
484
-
485
- foreach ($provider_required_fields as $field) {
486
- if ($field == 'tracking_ship_date') {
487
- if ($date_shipped) {
488
- $date_shipped_str = '&nbsp;' . sprintf(__('on %s', 'wc_shipment_tracking'), date_i18n(__('l jS F Y', 'wc_shipment_tracking'), $date_shipped));
489
- }
490
- } else if ($field == 'tracking_postal_code') {
491
- if ($postcode) {
492
- $postcode_str = '&nbsp;' . sprintf('The postal code is %s.', $postcode);
493
- }
494
- } else if ($field == 'tracking_account_number') {
495
- if ($account) {
496
- $account_str = '&nbsp;' . sprintf('The account is %s.', $account);
497
- }
498
- }
499
- }
500
-
501
- $provider_name = '&nbsp;' . __('via', 'wc_shipment_tracking') . ' <strong>' . $provider_name . '</strong>';
502
-
503
- echo wpautop(sprintf(__('Your order was shipped%s%s. Tracking number is %s.%s%s', 'wc_shipment_tracking'), $date_shipped_str, $provider_name, $tracking_number, $postcode_str, $account_str));
504
-
505
- if (!$for_email && $this->use_track_button) {
506
- $this->display_track_button($tracking_provider, $tracking_number);
507
- }
508
- */
509
-
510
- }
511
-
512
- private function display_order_wc_shipment_tracking($order_id, $for_email)
513
- {
514
- if ($for_email || !$this->use_track_button) {
515
- return;
516
- }
517
-
518
- $tracking = get_post_meta($order_id, '_tracking_number', true);
519
- $sharp = strpos($tracking, '#');
520
- $colon = strpos($tracking, ':');
521
- if ($sharp && $colon && $sharp >= $colon) {
522
- return;
523
- } else if (!$sharp && $colon) {
524
- return;
525
- } else if ($sharp) {
526
- $tracking_provider = substr($tracking, 0, $sharp);
527
- if ($colon) {
528
- $tracking_number = substr($tracking, $sharp + 1, $colon - $sharp - 1);
529
- } else {
530
- $tracking_number = substr($tracking, $sharp + 1, strlen($tracking));
531
- }
532
- } else {
533
- $tracking_provider = '';
534
- $tracking_number = $tracking;
535
- }
536
- if ($tracking_number) {
537
- $this->display_track_button($tracking_provider, $tracking_number);
538
- }
539
- }
540
-
541
- /**
542
- * Display shipment info in customer emails.
543
- *
544
- * @access public
545
- * @return void
546
- */
547
- function email_display($order)
548
- {
549
- $this->display_tracking_info($order->id, true);
550
- }
551
-
552
- private function display_track_button($tracking_provider, $tracking_number)
553
- {
554
-
555
- $js = '(function(e,t,n){var r,i=e.getElementsByTagName(t)[0];if(e.getElementById(n))return;r=e.createElement(t);r.id=n;r.src="//apps.aftership.com/all.js";i.parentNode.insertBefore(r,i)})(document,"script","aftership-jssdk")';
556
- if (function_exists('wc_enqueue_js')) {
557
- wc_enqueue_js($js);
558
- } else {
559
- global $woocommerce;
560
- $woocommerce->add_inline_js($js);
561
- }
562
-
563
- $track_button = '<div id="as-root"></div><div class="as-track-button" data-slug="' . $tracking_provider . '" data-tracking-number="' . $tracking_number . '" data-support="true" data-width="400" data-size="normal" data-hide-tracking-number="true"></div>';
564
- echo wpautop(sprintf('%s', $track_button));
565
- echo "<br><br>";
566
- }
567
- }
568
-
569
- if (!function_exists('getAfterShipInstance')) {
570
- function getAfterShipInstance()
571
- {
572
- return AfterShip::Instance();
573
- }
574
- }
575
- }
576
-
577
- /**
578
- * Register this class globally
579
- */
580
- $GLOBALS['aftership'] = getAfterShipInstance();
581
-
582
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/api/class-aftership-api-authentication.php DELETED
@@ -1,126 +0,0 @@
1
- <?php
2
- /**
3
- * AfterShip API Authentication Class
4
- *
5
- * @author AfterShip
6
- * @category API
7
- * @package AfterShip/API
8
- * @since 1
9
- */
10
-
11
- if (!defined('ABSPATH')) exit; // Exit if accessed directly
12
-
13
-
14
- if (!function_exists('getallheaders')) {
15
- function getallheaders()
16
- {
17
- $headers = '';
18
- foreach ($_SERVER as $name => $value) {
19
- if (substr($name, 0, 5) == 'HTTP_') {
20
- $headers[str_replace(' ', '-', ucwords(strtolower(str_replace('_', ' ', substr($name, 5)))))] = $value;
21
- }
22
- }
23
- return $headers;
24
- }
25
- }
26
-
27
- class AfterShip_API_Authentication
28
- {
29
-
30
- /**
31
- * Setup class
32
- *
33
- * @since 2.1
34
- * @return WC_API_Authentication
35
- */
36
- public function __construct()
37
- {
38
-
39
- // to disable authentication, hook into this filter at a later priority and return a valid WP_User
40
- add_filter('aftership_api_check_authentication', array($this, 'authenticate'), 0);
41
- }
42
-
43
- /**
44
- * Authenticate the request. The authentication method varies based on whether the request was made over SSL or not.
45
- *
46
- * @since 2.1
47
- * @param WP_User $user
48
- * @return null|WP_Error|WP_User
49
- */
50
- public function authenticate($user)
51
- {
52
-
53
- // allow access to the index by default
54
- if ('/' === getAfterShipInstance()->api->server->path)
55
- return new WP_User(0);
56
-
57
- try {
58
- $user = $this->perform_authentication();
59
-
60
- } catch (Exception $e) {
61
-
62
- $user = new WP_Error('aftership_api_authentication_error', $e->getMessage(), array('status' => $e->getCode()));
63
- }
64
-
65
- return $user;
66
- }
67
-
68
- private function perform_authentication()
69
- {
70
- //$params = getAfterShipInstance()->api->server->params['GET'];
71
-
72
- $headers = getallheaders();
73
- $headers = json_decode(json_encode($headers), true);
74
-
75
- // it dues to different kind of server configuration
76
- $key = 'AFTERSHIP_WP_KEY';
77
- $key1 = str_replace(' ', '-', ucwords(strtolower(str_replace('_', ' ', $key))));
78
- $key2 = 'AFTERSHIP-WP-KEY';
79
-
80
- // get aftership wp key
81
- if (!empty($headers[$key])) {
82
- $api_key = $headers[$key];
83
- } else if (!empty($headers[$key1])){
84
- $api_key = $headers[$key1];
85
- } else if (!empty($headers[$key2])){
86
- $api_key = $headers[$key2];
87
- } else {
88
- throw new Exception(__('AfterShip\'s WordPress Key is missing', 'aftership'), 404);
89
- }
90
-
91
- $user = $this->get_user_by_api_key($api_key);
92
-
93
- return $user;
94
-
95
- }
96
-
97
- /**
98
- * Return the user for the given consumer key
99
- *
100
- * @since 2.1
101
- * @param string $consumer_key
102
- * @return WP_User
103
- * @throws Exception
104
- */
105
- private function get_user_by_api_key($api_key)
106
- {
107
-
108
- $user_query = new WP_User_Query(
109
- array(
110
- //'meta_key' => 'woocommerce_api_consumer_key',
111
- 'meta_key' => 'aftership_wp_api_key',
112
- 'meta_value' => $api_key,
113
- )
114
- );
115
-
116
- $users = $user_query->get_results();
117
-
118
- if (empty($users[0]))
119
- throw new Exception(__('AfterShip\'s WordPress API Key is invalid', 'aftership'), 401);
120
-
121
- return $users[0];
122
-
123
-
124
- }
125
-
126
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/api/class-aftership-api-json-handler.php DELETED
@@ -1,77 +0,0 @@
1
- <?php
2
- /**
3
- * AfterShip API
4
- *
5
- * Handles parsing JSON request bodies and generating JSON responses
6
- *
7
- * @author AfterShip
8
- * @category API
9
- * @package AfterShip/API
10
- * @since 1.0
11
- */
12
-
13
- if (!defined('ABSPATH')) exit; // Exit if accessed directly
14
-
15
- class AfterShip_API_JSON_Handler implements AfterShip_API_Handler
16
- {
17
-
18
- /**
19
- * Get the content type for the response
20
- *
21
- * @since 2.1
22
- * @return string
23
- */
24
- public function get_content_type()
25
- {
26
-
27
- return 'application/json; charset=' . get_option('blog_charset');
28
- }
29
-
30
- /**
31
- * Parse the raw request body entity
32
- *
33
- * @since 2.1
34
- * @param string $body the raw request body
35
- * @return array|mixed
36
- */
37
- public function parse_body($body)
38
- {
39
-
40
- return json_decode($body, true);
41
- }
42
-
43
- /**
44
- * Generate a JSON response given an array of data
45
- *
46
- * @since 2.1
47
- * @param array $data the response data
48
- * @return string
49
- */
50
- public function generate_response($data)
51
- {
52
-
53
- if (isset($_GET['_jsonp'])) {
54
-
55
- // JSONP enabled by default
56
- if (!apply_filters('aftership_api_jsonp_enabled', true)) {
57
-
58
- WC()->api->server->send_status(400);
59
-
60
- $data = array(array('code' => 'aftership_api_jsonp_disabled', 'message' => __('JSONP support is disabled on this site', 'aftership')));
61
- }
62
-
63
- // Check for invalid characters (only alphanumeric allowed)
64
- if (preg_match('/\W/', $_GET['_jsonp'])) {
65
-
66
- WC()->api->server->send_status(400);
67
-
68
- $data = array(array('code' => 'aftership_api_jsonp_callback_invalid', __('The JSONP callback function is invalid', 'aftership')));
69
- }
70
-
71
- return $_GET['_jsonp'] . '(' . json_encode($data) . ')';
72
- }
73
-
74
- return json_encode($data);
75
- }
76
-
77
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/api/class-aftership-api-orders.php DELETED
@@ -1,474 +0,0 @@
1
- <?php
2
- /**
3
- * AfterShip API Orders Class
4
- *
5
- * Handles requests to the /orders endpoint
6
- *
7
- * @author AfterShip
8
- * @category API
9
- * @package AfterShip/API
10
- * @since 1.0
11
- */
12
-
13
- if (!defined('ABSPATH')) exit; // Exit if accessed directly
14
-
15
- class AfterShip_API_Orders extends AfterShip_API_Resource
16
- {
17
-
18
- /** @var string $base the route base */
19
- protected $base = '/orders';
20
-
21
- /**
22
- * Register the routes for this class
23
- *
24
- * GET /orders
25
- * GET /orders/count
26
- * GET|PUT /orders/<id>
27
- * GET /orders/<id>/notes
28
- *
29
- * @since 2.1
30
- * @param array $routes
31
- * @return array
32
- */
33
- public function register_routes($routes)
34
- {
35
-
36
- # GET /orders
37
- $routes[$this->base] = array(
38
- array(array($this, 'get_orders'), AfterShip_API_Server::READABLE),
39
- );
40
-
41
- # GET /orders/count
42
- $routes[$this->base . '/count'] = array(
43
- array(array($this, 'get_orders_count'), AfterShip_API_Server::READABLE),
44
- );
45
-
46
- # GET|PUT /orders/<id>
47
- $routes[$this->base . '/(?P<id>\d+)'] = array(
48
- array(array($this, 'get_order'), AfterShip_API_Server::READABLE),
49
- array(array($this, 'edit_order'), AfterShip_API_Server::EDITABLE | AfterShip_API_Server::ACCEPT_DATA),
50
- );
51
-
52
- # GET /orders/<id>/notes
53
- $routes[$this->base . '/(?P<id>\d+)/notes'] = array(
54
- array(array($this, 'get_order_notes'), AfterShip_API_Server::READABLE),
55
- );
56
-
57
- return $routes;
58
- }
59
-
60
- /**
61
- * Get all orders
62
- *
63
- * @since 2.1
64
- * @param string $fields
65
- * @param array $filter
66
- * @param string $status
67
- * @param int $page
68
- * @return array
69
- */
70
- public function get_orders($fields = null, $filter = array(), $status = null, $page = 1)
71
- {
72
-
73
- if (!empty($status))
74
- $filter['status'] = $status;
75
-
76
- $filter['page'] = $page;
77
-
78
- $query = $this->query_orders($filter);
79
-
80
- $orders = array();
81
-
82
- foreach ($query->posts as $order_id) {
83
-
84
- if (!$this->is_readable($order_id))
85
- continue;
86
-
87
- $orders[] = current($this->get_order($order_id, $fields));
88
- }
89
-
90
- $this->server->add_pagination_headers($query);
91
-
92
- return array('orders' => $orders);
93
- }
94
-
95
-
96
- /**
97
- * Get the order for the given ID
98
- *
99
- * @since 2.1
100
- * @param int $id the order ID
101
- * @param array $fields
102
- * @return array
103
- */
104
- public function get_order($id, $fields = null)
105
- {
106
-
107
- // ensure order ID is valid & user has permission to read
108
- $id = $this->validate_request($id, 'shop_order', 'read');
109
-
110
- if (is_wp_error($id))
111
- return $id;
112
-
113
- $order = new WC_Order($id);
114
-
115
- $order_post = get_post($id);
116
-
117
- $order_data = array(
118
- 'id' => $order->id,
119
- 'order_number' => $order->get_order_number(),
120
- 'created_at' => $this->server->format_datetime($order_post->post_date_gmt),
121
- 'updated_at' => $this->server->format_datetime($order_post->post_modified_gmt),
122
- // 'completed_at' => $this->server->format_datetime($order->completed_date, true),
123
- // 'status' => $order->status,
124
- // 'currency' => $order->order_currency,
125
- // 'total' => wc_format_decimal($order->get_total(), 2),
126
- // 'subtotal' => wc_format_decimal($this->get_order_subtotal($order), 2),
127
- // 'total_line_items_quantity' => $order->get_item_count(),
128
- // 'total_tax' => wc_format_decimal($order->get_total_tax(), 2),
129
- // 'total_shipping' => wc_format_decimal($order->get_total_shipping(), 2),
130
- // 'cart_tax' => wc_format_decimal($order->get_cart_tax(), 2),
131
- // 'shipping_tax' => wc_format_decimal($order->get_shipping_tax(), 2),
132
- // 'total_discount' => wc_format_decimal($order->get_total_discount(), 2),
133
- // 'cart_discount' => wc_format_decimal($order->get_cart_discount(), 2),
134
- // 'order_discount' => wc_format_decimal($order->get_order_discount(), 2),
135
- // 'shipping_methods' => $order->get_shipping_method(),
136
- // 'payment_details' => array(
137
- // 'method_id' => $order->payment_method,
138
- // 'method_title' => $order->payment_method_title,
139
- // 'paid' => isset($order->paid_date),
140
- // ),
141
- 'billing_address' => array(
142
- 'first_name' => $order->billing_first_name,
143
- 'last_name' => $order->billing_last_name,
144
- 'company' => $order->billing_company,
145
- 'address_1' => $order->billing_address_1,
146
- 'address_2' => $order->billing_address_2,
147
- 'city' => $order->billing_city,
148
- 'state' => $order->billing_state,
149
- 'postcode' => $order->billing_postcode,
150
- 'country' => $order->billing_country,
151
- 'email' => $order->billing_email,
152
- 'phone' => $order->billing_phone,
153
- ),
154
- 'shipping_address' => array(
155
- 'first_name' => $order->shipping_first_name,
156
- 'last_name' => $order->shipping_last_name,
157
- 'company' => $order->shipping_company,
158
- 'address_1' => $order->shipping_address_1,
159
- 'address_2' => $order->shipping_address_2,
160
- 'city' => $order->shipping_city,
161
- 'state' => $order->shipping_state,
162
- 'postcode' => $order->shipping_postcode,
163
- 'country' => $order->shipping_country,
164
- ),
165
- // 'note' => $order->customer_note,
166
- // 'customer_ip' => $order->customer_ip_address,
167
- // 'customer_user_agent' => $order->customer_user_agent,
168
- // 'customer_id' => $order->customer_user,
169
- // 'view_order_url' => $order->get_view_order_url(),
170
- 'line_items' => array(),
171
- // 'shipping_lines' => array(),
172
- // 'tax_lines' => array(),
173
- // 'fee_lines' => array(),
174
- // 'coupon_lines' => array(),
175
- );
176
-
177
- // add line items
178
- foreach ($order->get_items() as $item_id => $item) {
179
-
180
- // $product = $order->get_product_from_item($item);
181
-
182
- $order_data['line_items'][] = array(
183
- 'id' => $item_id,
184
- // 'subtotal' => wc_format_decimal($order->get_line_subtotal($item), 2),
185
- // 'total' => wc_format_decimal($order->get_line_total($item), 2),
186
- // 'total_tax' => wc_format_decimal($order->get_line_tax($item), 2),
187
- // 'price' => wc_format_decimal($order->get_item_total($item), 2),
188
- 'quantity' => (int)$item['qty'],
189
- // 'tax_class' => (!empty($item['tax_class'])) ? $item['tax_class'] : null,
190
- 'name' => $item['name'],
191
- // 'product_id' => (isset($product->variation_id)) ? $product->variation_id : $product->id,
192
- // 'sku' => is_object($product) ? $product->get_sku() : null,
193
- );
194
- }
195
-
196
- /*
197
- // add shipping
198
- foreach ($order->get_shipping_methods() as $shipping_item_id => $shipping_item) {
199
-
200
- $order_data['shipping_lines'][] = array(
201
- 'id' => $shipping_item_id,
202
- 'method_id' => $shipping_item['method_id'],
203
- 'method_title' => $shipping_item['name'],
204
- 'total' => wc_format_decimal($shipping_item['cost'], 2),
205
- );
206
- }
207
-
208
- // add taxes
209
- foreach ($order->get_tax_totals() as $tax_code => $tax) {
210
-
211
- $order_data['tax_lines'][] = array(
212
- 'code' => $tax_code,
213
- 'title' => $tax->label,
214
- 'total' => wc_format_decimal($tax->amount, 2),
215
- 'compound' => (bool)$tax->is_compound,
216
- );
217
- }
218
-
219
- // add fees
220
- foreach ($order->get_fees() as $fee_item_id => $fee_item) {
221
-
222
- $order_data['fee_lines'][] = array(
223
- 'id' => $fee_item_id,
224
- 'title' => $fee_item['name'],
225
- 'tax_class' => (!empty($fee_item['tax_class'])) ? $fee_item['tax_class'] : null,
226
- 'total' => wc_format_decimal($order->get_line_total($fee_item), 2),
227
- 'total_tax' => wc_format_decimal($order->get_line_tax($fee_item), 2),
228
- );
229
- }
230
-
231
- // add coupons
232
- foreach ($order->get_items('coupon') as $coupon_item_id => $coupon_item) {
233
-
234
- $order_data['coupon_lines'][] = array(
235
- 'id' => $coupon_item_id,
236
- 'code' => $coupon_item['name'],
237
- 'amount' => wc_format_decimal($coupon_item['discount_amount'], 2),
238
- );
239
- }
240
- */
241
-
242
- // aftership add
243
- $options = get_option('aftership_option_name');
244
- $plugin = $options['plugin'];
245
- if ($plugin == 'aftership') {
246
-
247
- // $result = array();
248
- // foreach($this->aftership_fields as $field){
249
- // $id = $field['id'];
250
- // $result[substr($id,10)] = get_post_meta($order->id, '_' . $field['id'], true);
251
- // }
252
- // $order_data['aftership']['woocommerce']['trackings'][] = $result;
253
-
254
- $order_data['aftership']['woocommerce']['trackings'][] = array(
255
- 'tracking_provider' => get_post_meta($order->id, '_aftership_tracking_provider', true),
256
- 'tracking_number' => get_post_meta($order->id, '_aftership_tracking_number', true),
257
- 'tracking_ship_date' => get_post_meta($order->id, '_aftership_tracking_shipdate', true),
258
- 'tracking_postal_code' => get_post_meta($order->id, '_aftership_tracking_postal', true),
259
- 'tracking_account_number' => get_post_meta($order->id, '_aftership_tracking_account', true),
260
- 'tracking_key' => get_post_meta($order->id, '_aftership_tracking_key', true),
261
- 'tracking_destination_country' => get_post_meta($order->id, '_aftership_tracking_destination_country', true),
262
- );
263
- } else if ($plugin == 'wc-shipment-tracking') { //$49
264
- $order_data['aftership']['woocommerce']['trackings'][] = array(
265
- 'tracking_number' => get_post_meta($order->id, '_tracking_number', true),
266
- );
267
- }
268
- // aftership add finish
269
-
270
- return array('order' => apply_filters('aftership_api_order_response', $order_data, $order, $fields, $this->server));
271
- }
272
-
273
- /**
274
- * Get the total number of orders
275
- *
276
- * @since 2.1
277
- * @param string $status
278
- * @param array $filter
279
- * @return array
280
- */
281
- public function get_orders_count($status = null, $filter = array())
282
- {
283
-
284
- if (!empty($status))
285
- $filter['status'] = $status;
286
-
287
- $query = $this->query_orders($filter);
288
-
289
- if (!current_user_can('read_private_shop_orders'))
290
- return new WP_Error('aftership_api_user_cannot_read_orders_count', __('You do not have permission to read the orders count', 'aftership'), array('status' => 401));
291
-
292
- return array('count' => (int)$query->found_posts);
293
- }
294
-
295
- /**
296
- * Edit an order
297
- *
298
- * API v1 only allows updating the status of an order
299
- *
300
- * @since 2.1
301
- * @param int $id the order ID
302
- * @param array $data
303
- * @return array
304
- */
305
- public function edit_order($id, $data)
306
- {
307
-
308
- $id = $this->validate_request($id, 'shop_order', 'edit');
309
-
310
- if (is_wp_error($id))
311
- return $id;
312
-
313
- $order = new WC_Order($id);
314
-
315
- if (!empty($data['status'])) {
316
-
317
- $order->update_status($data['status'], isset($data['note']) ? $data['note'] : '');
318
- }
319
-
320
- return $this->get_order($id);
321
- }
322
-
323
- /**
324
- * Delete an order
325
- *
326
- * @TODO enable along with POST in 2.2
327
- * @param int $id the order ID
328
- * @param bool $force true to permanently delete order, false to move to trash
329
- * @return array
330
- */
331
- public function delete_order($id, $force = false)
332
- {
333
-
334
- $id = $this->validate_request($id, 'shop_order', 'delete');
335
-
336
- return $this->delete($id, 'order', ('true' === $force));
337
- }
338
-
339
- /**
340
- * Get the admin order notes for an order
341
- *
342
- * @since 2.1
343
- * @param int $id the order ID
344
- * @param string $fields fields to include in response
345
- * @return array
346
- */
347
- public function get_order_notes($id, $fields = null)
348
- {
349
-
350
- // ensure ID is valid order ID
351
- $id = $this->validate_request($id, 'shop_order', 'read');
352
-
353
- if (is_wp_error($id))
354
- return $id;
355
-
356
- $args = array(
357
- 'post_id' => $id,
358
- 'approve' => 'approve',
359
- 'type' => 'order_note'
360
- );
361
-
362
- remove_filter('comments_clauses', array('WC_Comments', 'exclude_order_comments'), 10, 1);
363
-
364
- $notes = get_comments($args);
365
-
366
- add_filter('comments_clauses', array('WC_Comments', 'exclude_order_comments'), 10, 1);
367
-
368
- $order_notes = array();
369
-
370
- foreach ($notes as $note) {
371
-
372
- $order_notes[] = array(
373
- 'id' => $note->comment_ID,
374
- 'created_at' => $this->server->format_datetime($note->comment_date_gmt),
375
- 'note' => $note->comment_content,
376
- 'customer_note' => get_comment_meta($note->comment_ID, 'is_customer_note', true) ? true : false,
377
- );
378
- }
379
-
380
- return array('order_notes' => apply_filters('aftership_api_order_notes_response', $order_notes, $id, $fields, $notes, $this->server));
381
- }
382
-
383
- /**
384
- * Helper method to get order post objects
385
- *
386
- * @since 2.1
387
- * @param array $args request arguments for filtering query
388
- * @return WP_Query
389
- */
390
- private function query_orders($args)
391
- {
392
-
393
- function aftership_wpbo_get_woo_version_number()
394
- {
395
- // If get_plugins() isn't available, require it
396
- if (!function_exists('get_plugins'))
397
- require_once(ABSPATH . 'wp-admin/includes/plugin.php');
398
-
399
- // Create the plugins folder and file variables
400
- $plugin_folder = get_plugins('/' . 'woocommerce');
401
- $plugin_file = 'woocommerce.php';
402
-
403
- // If the plugin version number is set, return it
404
- if (isset($plugin_folder[$plugin_file]['Version'])) {
405
- return $plugin_folder[$plugin_file]['Version'];
406
-
407
- } else {
408
- // Otherwise return null
409
- return NULL;
410
- }
411
- }
412
-
413
- $woo_version = aftership_wpbo_get_woo_version_number();
414
-
415
- if ($woo_version >= 2.2) {
416
- // set base query arguments
417
- $query_args = array(
418
- 'fields' => 'ids',
419
- 'post_type' => 'shop_order',
420
- // 'post_status' => 'publish',
421
- 'post_status' => array_keys(wc_get_order_statuses())
422
- );
423
- } else {
424
- // set base query arguments
425
- $query_args = array(
426
- 'fields' => 'ids',
427
- 'post_type' => 'shop_order',
428
- 'post_status' => 'publish',
429
- );
430
- }
431
-
432
- // add status argument
433
- if (!empty($args['status'])) {
434
-
435
- $statuses = explode(',', $args['status']);
436
-
437
- $query_args['tax_query'] = array(
438
- array(
439
- 'taxonomy' => 'shop_order_status',
440
- 'field' => 'slug',
441
- 'terms' => $statuses,
442
- ),
443
- );
444
-
445
- unset($args['status']);
446
- }
447
-
448
- $query_args = $this->merge_query_args($query_args, $args);
449
-
450
- return new WP_Query($query_args);
451
- }
452
-
453
- /**
454
- * Helper method to get the order subtotal
455
- *
456
- * @since 2.1
457
- * @param WC_Order $order
458
- * @return float
459
- */
460
- private function get_order_subtotal($order)
461
- {
462
-
463
- $subtotal = 0;
464
-
465
- // subtotal
466
- foreach ($order->get_items() as $item) {
467
-
468
- $subtotal += (isset($item['line_subtotal'])) ? $item['line_subtotal'] : 0;
469
- }
470
-
471
- return $subtotal;
472
- }
473
-
474
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/api/class-aftership-api-resource.php DELETED
@@ -1,416 +0,0 @@
1
- <?php
2
- /**
3
- * AfterShip API Resource class
4
- *
5
- * Provides shared functionality for resource-specific API classes
6
- *
7
- * @author AfterShip
8
- * @category API
9
- * @package AfterShip/API
10
- * @since 1.0
11
- */
12
-
13
- if (!defined('ABSPATH')) exit; // Exit if accessed directly
14
-
15
- class AfterShip_API_Resource
16
- {
17
-
18
- /** @var WC_API_Server the API server */
19
- protected $server;
20
-
21
- /** @var string sub-classes override this to set a resource-specific base route */
22
- protected $base;
23
-
24
- /**
25
- * Setup class
26
- *
27
- * @since 2.1
28
- * @param WC_API_Server $server
29
- * @return WC_API_Resource
30
- */
31
- public function __construct(AfterShip_API_Server $server)
32
- {
33
-
34
- $this->server = $server;
35
-
36
- // automatically register routes for sub-classes
37
- add_filter('aftership_api_endpoints', array($this, 'register_routes'));
38
-
39
- // remove fields from responses when requests specify certain fields
40
- // note these are hooked at a later priority so data added via filters (e.g. customer data to the order response)
41
- // still has the fields filtered properly
42
- foreach (array('order', 'coupon', 'customer', 'product', 'report') as $resource) {
43
-
44
- add_filter("aftership_api_{$resource}_response", array($this, 'maybe_add_meta'), 15, 2);
45
- add_filter("aftership_api_{$resource}_response", array($this, 'filter_response_fields'), 20, 3);
46
- }
47
- }
48
-
49
- /**
50
- * Validate the request by checking:
51
- *
52
- * 1) the ID is a valid integer
53
- * 2) the ID returns a valid post object and matches the provided post type
54
- * 3) the current user has the proper permissions to read/edit/delete the post
55
- *
56
- * @since 2.1
57
- * @param string|int $id the post ID
58
- * @param string $type the post type, either `shop_order`, `shop_coupon`, or `product`
59
- * @param string $context the context of the request, either `read`, `edit` or `delete`
60
- * @return int|WP_Error valid post ID or WP_Error if any of the checks fails
61
- */
62
- protected function validate_request($id, $type, $context)
63
- {
64
-
65
- if ('shop_order' === $type || 'shop_coupon' === $type)
66
- $resource_name = str_replace('shop_', '', $type);
67
- else
68
- $resource_name = $type;
69
-
70
- $id = absint($id);
71
-
72
- // validate ID
73
- if (empty($id))
74
- return new WP_Error("aftership_api_invalid_{$resource_name}_id", sprintf(__('Invalid %s ID', 'aftership'), $type), array('status' => 404));
75
-
76
- // only custom post types have per-post type/permission checks
77
- if ('customer' !== $type) {
78
-
79
- $post = get_post($id);
80
-
81
- // for checking permissions, product variations are the same as the product post type
82
- $post_type = ('product_variation' === $post->post_type) ? 'product' : $post->post_type;
83
-
84
- // validate post type
85
- if ($type !== $post_type)
86
- return new WP_Error("aftership_api_invalid_{$resource_name}", sprintf(__('Invalid %s', 'aftership'), $resource_name), array('status' => 404));
87
-
88
- // validate permissions
89
- switch ($context) {
90
-
91
- case 'read':
92
- if (!$this->is_readable($post))
93
- return new WP_Error("aftership_api_user_cannot_read_{$resource_name}", sprintf(__('You do not have permission to read this %s', 'aftership'), $resource_name), array('status' => 401));
94
- break;
95
-
96
- case 'edit':
97
- if (!$this->is_editable($post))
98
- return new WP_Error("aftership_api_user_cannot_edit_{$resource_name}", sprintf(__('You do not have permission to edit this %s', 'aftership'), $resource_name), array('status' => 401));
99
- break;
100
-
101
- case 'delete':
102
- if (!$this->is_deletable($post))
103
- return new WP_Error("aftership_api_user_cannot_delete_{$resource_name}", sprintf(__('You do not have permission to delete this %s', 'aftership'), $resource_name), array('status' => 401));
104
- break;
105
- }
106
- }
107
-
108
- return $id;
109
- }
110
-
111
- /**
112
- * Add common request arguments to argument list before WP_Query is run
113
- *
114
- * @since 2.1
115
- * @param array $base_args required arguments for the query (e.g. `post_type`, etc)
116
- * @param array $request_args arguments provided in the request
117
- * @return array
118
- */
119
- protected function merge_query_args($base_args, $request_args)
120
- {
121
-
122
- $args = array();
123
-
124
- // date
125
- if (!empty($request_args['created_at_min']) || !empty($request_args['created_at_max']) || !empty($request_args['updated_at_min']) || !empty($request_args['updated_at_max'])) {
126
-
127
- $args['date_query'] = array();
128
-
129
- // resources created after specified date
130
- if (!empty($request_args['created_at_min']))
131
- $args['date_query'][] = array('column' => 'post_date_gmt', 'after' => $this->server->parse_datetime($request_args['created_at_min']), 'inclusive' => true);
132
-
133
- // resources created before specified date
134
- if (!empty($request_args['created_at_max']))
135
- $args['date_query'][] = array('column' => 'post_date_gmt', 'before' => $this->server->parse_datetime($request_args['created_at_max']), 'inclusive' => true);
136
-
137
- // resources updated after specified date
138
- if (!empty($request_args['updated_at_min']))
139
- $args['date_query'][] = array('column' => 'post_modified_gmt', 'after' => $this->server->parse_datetime($request_args['updated_at_min']), 'inclusive' => true);
140
-
141
- // resources updated before specified date
142
- if (!empty($request_args['updated_at_max']))
143
- $args['date_query'][] = array('column' => 'post_modified_gmt', 'before' => $this->server->parse_datetime($request_args['updated_at_max']), 'inclusive' => true);
144
- }
145
-
146
- // search
147
- if (!empty($request_args['q']))
148
- $args['s'] = $request_args['q'];
149
-
150
- // resources per response
151
- if (!empty($request_args['limit']))
152
- $args['posts_per_page'] = $request_args['limit'];
153
-
154
- // resource offset
155
- if (!empty($request_args['offset']))
156
- $args['offset'] = $request_args['offset'];
157
-
158
- // resource page
159
- $args['paged'] = (isset($request_args['page'])) ? absint($request_args['page']) : 1;
160
-
161
- // order
162
- if (!empty($request_args['orderby']))
163
- $args['orderby'] = $request_args['orderby'];
164
- if (!empty($request_args['order']))
165
- $args['order'] = $request_args['order'];
166
-
167
- return array_merge($base_args, $args);
168
- }
169
-
170
- /**
171
- * Add meta to resources when requested by the client. Meta is added as a top-level
172
- * `<resource_name>_meta` attribute (e.g. `order_meta`) as a list of key/value pairs
173
- *
174
- * @since 2.1
175
- * @param array $data the resource data
176
- * @param object $resource the resource object (e.g WC_Order)
177
- * @return mixed
178
- */
179
- public function maybe_add_meta($data, $resource)
180
- {
181
-
182
- if (isset($this->server->params['GET']['filter']['meta']) && 'true' === $this->server->params['GET']['filter']['meta'] && is_object($resource)) {
183
-
184
- // don't attempt to add meta more than once
185
- if (preg_grep('/[a-z]+_meta/', array_keys($data)))
186
- return $data;
187
-
188
- // define the top-level property name for the meta
189
- switch (get_class($resource)) {
190
-
191
- case 'WC_Order':
192
- $meta_name = 'order_meta';
193
- break;
194
-
195
- case 'WC_Coupon':
196
- $meta_name = 'coupon_meta';
197
- break;
198
-
199
- case 'WP_User':
200
- $meta_name = 'customer_meta';
201
- break;
202
-
203
- default:
204
- $meta_name = 'product_meta';
205
- break;
206
- }
207
-
208
- if (is_a($resource, 'WP_User')) {
209
-
210
- // customer meta
211
- $meta = (array)get_user_meta($resource->ID);
212
-
213
- } elseif (is_a($resource, 'WC_Product_Variation')) {
214
-
215
- // product variation meta
216
- $meta = (array)get_post_meta($resource->get_variation_id());
217
-
218
- } else {
219
-
220
- // coupon/order/product meta
221
- $meta = (array)get_post_meta($resource->id);
222
- }
223
-
224
- foreach ($meta as $meta_key => $meta_value) {
225
-
226
- // don't add hidden meta by default
227
- if (!is_protected_meta($meta_key)) {
228
- $data[$meta_name][$meta_key] = maybe_unserialize($meta_value[0]);
229
- }
230
- }
231
-
232
- }
233
-
234
- return $data;
235
- }
236
-
237
- /**
238
- * Restrict the fields included in the response if the request specified certain only certain fields should be returned
239
- *
240
- * @since 2.1
241
- * @param array $data the response data
242
- * @param object $resource the object that provided the response data, e.g. WC_Coupon or WC_Order
243
- * @param array|string the requested list of fields to include in the response
244
- * @return array response data
245
- */
246
- public function filter_response_fields($data, $resource, $fields)
247
- {
248
-
249
- if (!is_array($data) || empty($fields))
250
- return $data;
251
-
252
- $fields = explode(',', $fields);
253
- $sub_fields = array();
254
-
255
- // get sub fields
256
- foreach ($fields as $field) {
257
-
258
- if (false !== strpos($field, '.')) {
259
-
260
- list($name, $value) = explode('.', $field);
261
-
262
- $sub_fields[$name] = $value;
263
- }
264
- }
265
-
266
- // iterate through top-level fields
267
- foreach ($data as $data_field => $data_value) {
268
-
269
- // if a field has sub-fields and the top-level field has sub-fields to filter
270
- if (is_array($data_value) && in_array($data_field, array_keys($sub_fields))) {
271
-
272
- // iterate through each sub-field
273
- foreach ($data_value as $sub_field => $sub_field_value) {
274
-
275
- // remove non-matching sub-fields
276
- if (!in_array($sub_field, $sub_fields)) {
277
- unset($data[$data_field][$sub_field]);
278
- }
279
- }
280
-
281
- } else {
282
-
283
- // remove non-matching top-level fields
284
- if (!in_array($data_field, $fields)) {
285
- unset($data[$data_field]);
286
- }
287
- }
288
- }
289
-
290
- return $data;
291
- }
292
-
293
- /**
294
- * Delete a given resource
295
- *
296
- * @since 2.1
297
- * @param int $id the resource ID
298
- * @param string $type the resource post type, or `customer`
299
- * @param bool $force true to permanently delete resource, false to move to trash (not supported for `customer`)
300
- * @return array|WP_Error
301
- */
302
- protected function delete($id, $type, $force = false)
303
- {
304
-
305
- if ('shop_order' === $type || 'shop_coupon' === $type)
306
- $resource_name = str_replace('shop_', '', $type);
307
- else
308
- $resource_name = $type;
309
-
310
- if ('customer' === $type) {
311
-
312
- $result = wp_delete_user($id);
313
-
314
- if ($result)
315
- return array('message' => __('Permanently deleted customer', 'aftership'));
316
- else
317
- return new WP_Error('aftership_api_cannot_delete_customer', __('The customer cannot be deleted', 'aftership'), array('status' => 500));
318
-
319
- } else {
320
-
321
- // delete order/coupon/product
322
-
323
- $result = ($force) ? wp_delete_post($id, true) : wp_trash_post($id);
324
-
325
- if (!$result)
326
- return new WP_Error("aftership_api_cannot_delete_{$resource_name}", sprintf(__('This %s cannot be deleted', 'aftership'), $resource_name), array('status' => 500));
327
-
328
- if ($force) {
329
- return array('message' => sprintf(__('Permanently deleted %s', 'aftership'), $resource_name));
330
-
331
- } else {
332
-
333
- $this->server->send_status('202');
334
-
335
- return array('message' => sprintf(__('Deleted %s', 'aftership'), $resource_name));
336
- }
337
- }
338
- }
339
-
340
-
341
- /**
342
- * Checks if the given post is readable by the current user
343
- *
344
- * @since 2.1
345
- * @see WC_API_Resource::check_permission()
346
- * @param WP_Post|int $post
347
- * @return bool
348
- */
349
- protected function is_readable($post)
350
- {
351
-
352
- return $this->check_permission($post, 'read');
353
- }
354
-
355
- /**
356
- * Checks if the given post is editable by the current user
357
- *
358
- * @since 2.1
359
- * @see WC_API_Resource::check_permission()
360
- * @param WP_Post|int $post
361
- * @return bool
362
- */
363
- protected function is_editable($post)
364
- {
365
-
366
- return $this->check_permission($post, 'edit');
367
-
368
- }
369
-
370
- /**
371
- * Checks if the given post is deletable by the current user
372
- *
373
- * @since 2.1
374
- * @see WC_API_Resource::check_permission()
375
- * @param WP_Post|int $post
376
- * @return bool
377
- */
378
- protected function is_deletable($post)
379
- {
380
-
381
- return $this->check_permission($post, 'delete');
382
- }
383
-
384
- /**
385
- * Checks the permissions for the current user given a post and context
386
- *
387
- * @since 2.1
388
- * @param WP_Post|int $post
389
- * @param string $context the type of permission to check, either `read`, `write`, or `delete`
390
- * @return bool true if the current user has the permissions to perform the context on the post
391
- */
392
- private function check_permission($post, $context)
393
- {
394
-
395
- if (!is_a($post, 'WP_Post'))
396
- $post = get_post($post);
397
-
398
- if (is_null($post))
399
- return false;
400
-
401
- $post_type = get_post_type_object($post->post_type);
402
-
403
- if ('read' === $context)
404
- return current_user_can($post_type->cap->read_private_posts, $post->ID);
405
-
406
- elseif ('edit' === $context)
407
- return current_user_can($post_type->cap->edit_post, $post->ID);
408
-
409
- elseif ('delete' === $context)
410
- return current_user_can($post_type->cap->delete_post, $post->ID);
411
-
412
- else
413
- return false;
414
- }
415
-
416
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/api/class-aftership-api-server.php DELETED
@@ -1,766 +0,0 @@
1
- <?php
2
- /**
3
- * AfterShip API
4
- *
5
- * Handles REST API requests
6
- *
7
- * This class and related code (JSON response handler, resource classes) are based on WP-API v0.6 (https://github.com/WP-API/WP-API)
8
- * Many thanks to Ryan McCue and any other contributors!
9
- *
10
- * @author AfterShip
11
- * @category API
12
- * @package AfterShip/API
13
- * @since 1.0
14
- */
15
-
16
- if (!defined('ABSPATH')) exit; // Exit if accessed directly
17
-
18
- require_once ABSPATH . 'wp-admin/includes/admin.php';
19
-
20
- class AfterShip_API_Server
21
- {
22
-
23
- const METHOD_GET = 1;
24
- const METHOD_POST = 2;
25
- const METHOD_PUT = 4;
26
- const METHOD_PATCH = 8;
27
- const METHOD_DELETE = 16;
28
-
29
- const READABLE = 1; // GET
30
- const CREATABLE = 2; // POST
31
- const EDITABLE = 14; // POST | PUT | PATCH
32
- const DELETABLE = 16; // DELETE
33
- const ALLMETHODS = 31; // GET | POST | PUT | PATCH | DELETE
34
-
35
- /**
36
- * Does the endpoint accept a raw request body?
37
- */
38
- const ACCEPT_RAW_DATA = 64;
39
-
40
- /** Does the endpoint accept a request body? (either JSON or XML) */
41
- const ACCEPT_DATA = 128;
42
-
43
- /**
44
- * Should we hide this endpoint from the index?
45
- */
46
- const HIDDEN_ENDPOINT = 256;
47
-
48
- /**
49
- * Map of HTTP verbs to constants
50
- * @var array
51
- */
52
- public static $method_map = array(
53
- 'HEAD' => self::METHOD_GET,
54
- 'GET' => self::METHOD_GET,
55
- 'POST' => self::METHOD_POST,
56
- 'PUT' => self::METHOD_PUT,
57
- 'PATCH' => self::METHOD_PATCH,
58
- 'DELETE' => self::METHOD_DELETE,
59
- );
60
-
61
- /**
62
- * Requested path (relative to the API root, wp-json.php)
63
- *
64
- * @var string
65
- */
66
- public $path = '';
67
-
68
- /**
69
- * Requested method (GET/HEAD/POST/PUT/PATCH/DELETE)
70
- *
71
- * @var string
72
- */
73
- public $method = 'HEAD';
74
-
75
- /**
76
- * Request parameters
77
- *
78
- * This acts as an abstraction of the superglobals
79
- * (GET => $_GET, POST => $_POST)
80
- *
81
- * @var array
82
- */
83
- public $params = array('GET' => array(), 'POST' => array());
84
-
85
- /**
86
- * Request headers
87
- *
88
- * @var array
89
- */
90
- public $headers = array();
91
-
92
- /**
93
- * Request files (matches $_FILES)
94
- *
95
- * @var array
96
- */
97
- public $files = array();
98
-
99
- /**
100
- * Request/Response handler, either JSON by default
101
- * or XML if requested by client
102
- *
103
- * @var WC_API_Handler
104
- */
105
- public $handler;
106
-
107
-
108
- /**
109
- * Setup class and set request/response handler
110
- *
111
- * @since 2.1
112
- * @param $path
113
- * @return WC_API_Server
114
- */
115
- public function __construct($path)
116
- {
117
-
118
- if (empty($path)) {
119
- if (isset($_SERVER['PATH_INFO']))
120
- $path = $_SERVER['PATH_INFO'];
121
- else
122
- $path = '/';
123
- }
124
-
125
- $this->path = $path;
126
- $this->method = $_SERVER['REQUEST_METHOD'];
127
- $this->params['GET'] = $_GET;
128
- $this->params['POST'] = $_POST;
129
- $this->headers = $this->get_headers($_SERVER);
130
- $this->files = $_FILES;
131
-
132
- // Compatibility for clients that can't use PUT/PATCH/DELETE
133
- if (isset($_GET['_method'])) {
134
- $this->method = strtoupper($_GET['_method']);
135
- }
136
-
137
- // determine type of request/response and load handler, JSON by default
138
- if ($this->is_json_request())
139
- $handler_class = 'AfterShip_API_JSON_Handler';
140
-
141
- elseif ($this->is_xml_request())
142
- $handler_class = 'WC_API_XML_Handler';
143
-
144
- else
145
- $handler_class = apply_filters('aftership_api_default_response_handler', 'AfterShip_API_JSON_Handler', $this->path, $this);
146
-
147
- $this->handler = new $handler_class();
148
- }
149
-
150
- /**
151
- * Check authentication for the request
152
- *
153
- * @since 2.1
154
- * @return WP_User|WP_Error WP_User object indicates successful login, WP_Error indicates unsuccessful login
155
- */
156
- public function check_authentication()
157
- {
158
-
159
- // allow plugins to remove default authentication or add their own authentication
160
- $user = apply_filters('aftership_api_check_authentication', null, $this);
161
-
162
- // API requests run under the context of the authenticated user
163
- if (is_a($user, 'WP_User'))
164
- wp_set_current_user($user->ID);
165
-
166
- // WP_Errors are handled in serve_request()
167
- elseif (!is_wp_error($user))
168
- $user = new WP_Error('aftership_api_authentication_error', __('Invalid authentication method', 'aftership'), array('code' => 500));
169
-
170
- return $user;
171
- }
172
-
173
- /**
174
- * Convert an error to an array
175
- *
176
- * This iterates over all error codes and messages to change it into a flat
177
- * array. This enables simpler client behaviour, as it is represented as a
178
- * list in JSON rather than an object/map
179
- *
180
- * @since 2.1
181
- * @param WP_Error $error
182
- * @return array List of associative arrays with code and message keys
183
- */
184
- protected function error_to_array($error)
185
- {
186
- $errors = array();
187
- foreach ((array)$error->errors as $code => $messages) {
188
- foreach ((array)$messages as $message) {
189
- $errors[] = array('code' => $code, 'message' => $message);
190
- }
191
- }
192
- return array('errors' => $errors);
193
- }
194
-
195
- /**
196
- * Handle serving an API request
197
- *
198
- * Matches the current server URI to a route and runs the first matching
199
- * callback then outputs a JSON representation of the returned value.
200
- *
201
- * @since 2.1
202
- * @uses WC_API_Server::dispatch()
203
- */
204
- public function serve_request()
205
- {
206
-
207
- do_action('aftership_api_server_before_serve', $this);
208
-
209
- $this->header('Content-Type', $this->handler->get_content_type(), true);
210
-
211
- // the API is enabled by default
212
- if (!apply_filters('aftership_api_enabled', true, $this) || ('no' === get_option('aftership_api_enabled'))) {
213
-
214
- $this->send_status(404);
215
-
216
- echo $this->handler->generate_response(array('errors' => array('code' => 'aftership_api_disabled', 'message' => 'The WooCommerce API is disabled on this site')));
217
-
218
- return;
219
- }
220
-
221
- $result = $this->check_authentication();
222
-
223
- // if authorization check was successful, dispatch the request
224
- if (!is_wp_error($result)) {
225
- $result = $this->dispatch();
226
- }
227
-
228
- // handle any dispatch errors
229
- if (is_wp_error($result)) {
230
- $data = $result->get_error_data();
231
- if (is_array($data) && isset($data['status'])) {
232
- $this->send_status($data['status']);
233
- }
234
-
235
- $result = $this->error_to_array($result);
236
- }
237
-
238
- // This is a filter rather than an action, since this is designed to be
239
- // re-entrant if needed
240
- $served = apply_filters('aftership_api_serve_request', false, $result, $this);
241
-
242
- if (!$served) {
243
-
244
- if ('HEAD' === $this->method)
245
- return;
246
-
247
- echo $this->handler->generate_response($result);
248
- }
249
- }
250
-
251
- /**
252
- * Retrieve the route map
253
- *
254
- * The route map is an associative array with path regexes as the keys. The
255
- * value is an indexed array with the callback function/method as the first
256
- * item, and a bitmask of HTTP methods as the second item (see the class
257
- * constants).
258
- *
259
- * Each route can be mapped to more than one callback by using an array of
260
- * the indexed arrays. This allows mapping e.g. GET requests to one callback
261
- * and POST requests to another.
262
- *
263
- * Note that the path regexes (array keys) must have @ escaped, as this is
264
- * used as the delimiter with preg_match()
265
- *
266
- * @since 2.1
267
- * @return array `'/path/regex' => array( $callback, $bitmask )` or `'/path/regex' => array( array( $callback, $bitmask ), ...)`
268
- */
269
- public function get_routes()
270
- {
271
-
272
- // index added by default
273
- $endpoints = array(
274
-
275
- '/' => array(array($this, 'get_index'), self::READABLE),
276
- );
277
-
278
- $endpoints = apply_filters('aftership_api_endpoints', $endpoints);
279
-
280
- // Normalise the endpoints
281
- foreach ($endpoints as $route => &$handlers) {
282
- if (count($handlers) <= 2 && isset($handlers[1]) && !is_array($handlers[1])) {
283
- $handlers = array($handlers);
284
- }
285
- }
286
-
287
- return $endpoints;
288
- }
289
-
290
- /**
291
- * Match the request to a callback and call it
292
- *
293
- * @since 2.1
294
- * @return mixed The value returned by the callback, or a WP_Error instance
295
- */
296
- public function dispatch()
297
- {
298
-
299
- switch ($this->method) {
300
-
301
- case 'HEAD':
302
- case 'GET':
303
- $method = self::METHOD_GET;
304
- break;
305
- /*
306
- case 'POST':
307
- $method = self::METHOD_POST;
308
- break;
309
-
310
- case 'PUT':
311
- $method = self::METHOD_PUT;
312
- break;
313
-
314
- case 'PATCH':
315
- $method = self::METHOD_PATCH;
316
- break;
317
-
318
- case 'DELETE':
319
- $method = self::METHOD_DELETE;
320
- break;
321
- */
322
- default:
323
- return new WP_Error('aftership_api_unsupported_method', __('Unsupported request method', 'aftership'), array('status' => 400));
324
- }
325
-
326
- foreach ($this->get_routes() as $route => $handlers) {
327
- foreach ($handlers as $handler) {
328
- $callback = $handler[0];
329
- $supported = isset($handler[1]) ? $handler[1] : self::METHOD_GET;
330
-
331
- if (!($supported & $method))
332
- continue;
333
-
334
- $match = preg_match('@^' . $route . '$@i', urldecode($this->path), $args);
335
-
336
- if (!$match)
337
- continue;
338
-
339
- if (!is_callable($callback))
340
- return new WP_Error('aftership_api_invalid_handler', __('The handler for the route is invalid', 'aftership'), array('status' => 500));
341
-
342
- $args = array_merge($args, $this->params['GET']);
343
- if ($method & self::METHOD_POST) {
344
- $args = array_merge($args, $this->params['POST']);
345
- }
346
- if ($supported & self::ACCEPT_DATA) {
347
- $data = $this->handler->parse_body($this->get_raw_data());
348
- $args = array_merge($args, array('data' => $data));
349
- } elseif ($supported & self::ACCEPT_RAW_DATA) {
350
- $data = $this->get_raw_data();
351
- $args = array_merge($args, array('data' => $data));
352
- }
353
-
354
- $args['_method'] = $method;
355
- $args['_route'] = $route;
356
- $args['_path'] = $this->path;
357
- $args['_headers'] = $this->headers;
358
- $args['_files'] = $this->files;
359
-
360
- $args = apply_filters('aftership_api_dispatch_args', $args, $callback);
361
-
362
- // Allow plugins to halt the request via this filter
363
- if (is_wp_error($args)) {
364
- return $args;
365
- }
366
-
367
- $params = $this->sort_callback_params($callback, $args);
368
- if (is_wp_error($params))
369
- return $params;
370
-
371
- return call_user_func_array($callback, $params);
372
- }
373
- }
374
-
375
- return new WP_Error('aftership_api_no_route', __('No route was found matching the URL and request method', 'aftership'), array('status' => 404));
376
- }
377
-
378
- /**
379
- * Sort parameters by order specified in method declaration
380
- *
381
- * Takes a callback and a list of available params, then filters and sorts
382
- * by the parameters the method actually needs, using the Reflection API
383
- *
384
- * @since 2.1
385
- * @param callable|array $callback the endpoint callback
386
- * @param array $provided the provided request parameters
387
- * @return array
388
- */
389
- protected function sort_callback_params($callback, $provided)
390
- {
391
- if (is_array($callback))
392
- $ref_func = new ReflectionMethod($callback[0], $callback[1]);
393
- else
394
- $ref_func = new ReflectionFunction($callback);
395
-
396
- $wanted = $ref_func->getParameters();
397
- $ordered_parameters = array();
398
-
399
- foreach ($wanted as $param) {
400
- if (isset($provided[$param->getName()])) {
401
- // We have this parameters in the list to choose from
402
-
403
- $ordered_parameters[] = is_array($provided[$param->getName()]) ? array_map('urldecode', $provided[$param->getName()]) : urldecode($provided[$param->getName()]);
404
- } elseif ($param->isDefaultValueAvailable()) {
405
- // We don't have this parameter, but it's optional
406
- $ordered_parameters[] = $param->getDefaultValue();
407
- } else {
408
- // We don't have this parameter and it wasn't optional, abort!
409
- return new WP_Error('aftership_api_missing_callback_param', sprintf(__('Missing parameter %s', 'aftership'), $param->getName()), array('status' => 400));
410
- }
411
- }
412
- return $ordered_parameters;
413
- }
414
-
415
- /**
416
- * Get the site index.
417
- *
418
- * This endpoint describes the capabilities of the site.
419
- *
420
- * @since 2.1
421
- * @return array Index entity
422
- */
423
- public function get_index()
424
- {
425
-
426
- // General site data
427
- $available = array('store' => array(
428
- 'name' => get_option('blogname'),
429
- 'description' => get_option('blogdescription'),
430
- 'URL' => get_option('siteurl'),
431
- 'wc_version' => WC()->version,
432
- 'routes' => array(),
433
- 'meta' => array(
434
- 'timezone' => wc_timezone_string(),
435
- 'currency' => get_aftership_currency(),
436
- 'currency_format' => get_aftership_currency_symbol(),
437
- 'tax_included' => ('yes' === get_option('aftership_prices_include_tax')),
438
- 'weight_unit' => get_option('aftership_weight_unit'),
439
- 'dimension_unit' => get_option('aftership_dimension_unit'),
440
- 'ssl_enabled' => ('yes' === get_option('aftership_force_ssl_checkout')),
441
- 'permalinks_enabled' => ('' !== get_option('permalink_structure')),
442
- 'links' => array(
443
- 'help' => 'https://aftership.uservoice.com/knowledgebase',
444
- ),
445
- ),
446
- ));
447
-
448
- // Find the available routes
449
- foreach ($this->get_routes() as $route => $callbacks) {
450
- $data = array();
451
-
452
- $route = preg_replace('#\(\?P(<\w+?>).*?\)#', '$1', $route);
453
- $methods = array();
454
- foreach (self::$method_map as $name => $bitmask) {
455
- foreach ($callbacks as $callback) {
456
- // Skip to the next route if any callback is hidden
457
- if ($callback[1] & self::HIDDEN_ENDPOINT)
458
- continue 3;
459
-
460
- if ($callback[1] & $bitmask)
461
- $data['supports'][] = $name;
462
-
463
- if ($callback[1] & self::ACCEPT_DATA)
464
- $data['accepts_data'] = true;
465
-
466
- // For non-variable routes, generate links
467
- if (strpos($route, '<') === false) {
468
- $data['meta'] = array(
469
- 'self' => get_aftership_api_url($route),
470
- );
471
- }
472
- }
473
- }
474
- $available['store']['routes'][$route] = apply_filters('aftership_api_endpoints_description', $data);
475
- }
476
- return apply_filters('aftership_api_index', $available);
477
- }
478
-
479
- /**
480
- * Send a HTTP status code
481
- *
482
- * @since 2.1
483
- * @param int $code HTTP status
484
- */
485
- public function send_status($code)
486
- {
487
- status_header($code);
488
- }
489
-
490
- /**
491
- * Send a HTTP header
492
- *
493
- * @since 2.1
494
- * @param string $key Header key
495
- * @param string $value Header value
496
- * @param boolean $replace Should we replace the existing header?
497
- */
498
- public function header($key, $value, $replace = true)
499
- {
500
- header(sprintf('%s: %s', $key, $value), $replace);
501
- }
502
-
503
- /**
504
- * Send a Link header
505
- *
506
- * @internal The $rel parameter is first, as this looks nicer when sending multiple
507
- *
508
- * @link http://tools.ietf.org/html/rfc5988
509
- * @link http://www.iana.org/assignments/link-relations/link-relations.xml
510
- *
511
- * @since 2.1
512
- * @param string $rel Link relation. Either a registered type, or an absolute URL
513
- * @param string $link Target IRI for the link
514
- * @param array $other Other parameters to send, as an associative array
515
- */
516
- public function link_header($rel, $link, $other = array())
517
- {
518
-
519
- $header = sprintf('<%s>; rel="%s"', $link, esc_attr($rel));
520
-
521
- foreach ($other as $key => $value) {
522
-
523
- if ('title' == $key) {
524
-
525
- $value = '"' . $value . '"';
526
- }
527
-
528
- $header .= '; ' . $key . '=' . $value;
529
- }
530
-
531
- $this->header('Link', $header, false);
532
- }
533
-
534
- /**
535
- * Send pagination headers for resources
536
- *
537
- * @since 2.1
538
- * @param WP_Query|WP_User_Query $query
539
- */
540
- public function add_pagination_headers($query)
541
- {
542
-
543
- // WP_User_Query
544
- if (is_a($query, 'WP_User_Query')) {
545
-
546
- $page = $query->page;
547
- $single = count($query->get_results()) > 1;
548
- $total = $query->get_total();
549
- $total_pages = $query->total_pages;
550
-
551
- // WP_Query
552
- } else {
553
-
554
- $page = $query->get('paged');
555
- $single = $query->is_single();
556
- $total = $query->found_posts;
557
- $total_pages = $query->max_num_pages;
558
- }
559
-
560
- if (!$page)
561
- $page = 1;
562
-
563
- $next_page = absint($page) + 1;
564
-
565
- if (!$single) {
566
-
567
- // first/prev
568
- if ($page > 1) {
569
- $this->link_header('first', $this->get_paginated_url(1));
570
- $this->link_header('prev', $this->get_paginated_url($page - 1));
571
- }
572
-
573
- // next
574
- if ($next_page <= $total_pages) {
575
- $this->link_header('next', $this->get_paginated_url($next_page));
576
- }
577
-
578
- // last
579
- if ($page != $total_pages)
580
- $this->link_header('last', $this->get_paginated_url($total_pages));
581
- }
582
-
583
- $this->header('X-WC-Total', $total);
584
- $this->header('X-WC-TotalPages', $total_pages);
585
-
586
- do_action('aftership_api_pagination_headers', $this, $query);
587
- }
588
-
589
- /**
590
- * Returns the request URL with the page query parameter set to the specified page
591
- *
592
- * @since 2.1
593
- * @param int $page
594
- * @return string
595
- */
596
- private function get_paginated_url($page)
597
- {
598
-
599
- // remove existing page query param
600
- $request = remove_query_arg('page');
601
-
602
- // add provided page query param
603
- $request = urldecode(add_query_arg('page', $page, $request));
604
-
605
- // get the home host
606
- $host = parse_url(get_home_url(), PHP_URL_HOST);
607
-
608
- return set_url_scheme("http://{$host}{$request}");
609
- }
610
-
611
- /**
612
- * Retrieve the raw request entity (body)
613
- *
614
- * @since 2.1
615
- * @return string
616
- */
617
- public function get_raw_data()
618
- {
619
- global $HTTP_RAW_POST_DATA;
620
-
621
- // A bug in PHP < 5.2.2 makes $HTTP_RAW_POST_DATA not set by default,
622
- // but we can do it ourself.
623
- if (!isset($HTTP_RAW_POST_DATA)) {
624
- $HTTP_RAW_POST_DATA = file_get_contents('php://input');
625
- }
626
-
627
- return $HTTP_RAW_POST_DATA;
628
- }
629
-
630
- /**
631
- * Parse an RFC3339 datetime into a MySQl datetime
632
- *
633
- * Invalid dates default to unix epoch
634
- *
635
- * @since 2.1
636
- * @param string $datetime RFC3339 datetime
637
- * @return string MySQl datetime (YYYY-MM-DD HH:MM:SS)
638
- */
639
- public function parse_datetime($datetime)
640
- {
641
-
642
- // Strip millisecond precision (a full stop followed by one or more digits)
643
- if (strpos($datetime, '.') !== false) {
644
- $datetime = preg_replace('/\.\d+/', '', $datetime);
645
- }
646
-
647
- // default timezone to UTC
648
- $datetime = preg_replace('/[+-]\d+:+\d+$/', '+00:00', $datetime);
649
-
650
- try {
651
-
652
- $datetime = new DateTime($datetime, new DateTimeZone('UTC'));
653
-
654
- } catch (Exception $e) {
655
-
656
- $datetime = new DateTime('@0');
657
-
658
- }
659
-
660
- return $datetime->format('Y-m-d H:i:s');
661
- }
662
-
663
- /**
664
- * Format a unix timestamp or MySQL datetime into an RFC3339 datetime
665
- *
666
- * @since 2.1
667
- * @param int|string $timestamp unix timestamp or MySQL datetime
668
- * @param bool $convert_to_utc
669
- * @return string RFC3339 datetime
670
- */
671
- public function format_datetime($timestamp, $convert_to_utc = false)
672
- {
673
-
674
- if ($convert_to_utc) {
675
- $timezone = new DateTimeZone(wc_timezone_string());
676
- } else {
677
- $timezone = new DateTimeZone('UTC');
678
- }
679
-
680
- try {
681
-
682
- if (is_numeric($timestamp)) {
683
- $date = new DateTime("@{$timestamp}");
684
- } else {
685
- $date = new DateTime($timestamp, $timezone);
686
- }
687
-
688
- // convert to UTC by adjusting the time based on the offset of the site's timezone
689
- if ($convert_to_utc) {
690
- $date->modify(-1 * $date->getOffset() . ' seconds');
691
- }
692
-
693
- } catch (Exception $e) {
694
-
695
- $date = new DateTime('@0');
696
- }
697
-
698
- return $date->format('Y-m-d\TH:i:s\Z');
699
- }
700
-
701
- /**
702
- * Extract headers from a PHP-style $_SERVER array
703
- *
704
- * @since 2.1
705
- * @param array $server Associative array similar to $_SERVER
706
- * @return array Headers extracted from the input
707
- */
708
- public function get_headers($server)
709
- {
710
- $headers = array();
711
- // CONTENT_* headers are not prefixed with HTTP_
712
- $additional = array('CONTENT_LENGTH' => true, 'CONTENT_MD5' => true, 'CONTENT_TYPE' => true);
713
-
714
- foreach ($server as $key => $value) {
715
- if (strpos($key, 'HTTP_') === 0) {
716
- $headers[substr($key, 5)] = $value;
717
- } elseif (isset($additional[$key])) {
718
- $headers[$key] = $value;
719
- }
720
- }
721
-
722
- return $headers;
723
- }
724
-
725
- /**
726
- * Check if the current request accepts a JSON response by checking the endpoint suffix (.json) or
727
- * the HTTP ACCEPT header
728
- *
729
- * @since 2.1
730
- * @return bool
731
- */
732
- private function is_json_request()
733
- {
734
-
735
- // check path
736
- if (false !== stripos($this->path, '.json'))
737
- return true;
738
-
739
- // check ACCEPT header, only 'application/json' is acceptable, see RFC 4627
740
- if (isset($this->headers['ACCEPT']) && 'application/json' == $this->headers['ACCEPT'])
741
- return true;
742
-
743
- return false;
744
- }
745
-
746
- /**
747
- * Check if the current request accepts an XML response by checking the endpoint suffix (.xml) or
748
- * the HTTP ACCEPT header
749
- *
750
- * @since 2.1
751
- * @return bool
752
- */
753
- private function is_xml_request()
754
- {
755
-
756
- // check path
757
- if (false !== stripos($this->path, '.xml'))
758
- return true;
759
-
760
- // check headers, 'application/xml' or 'text/xml' are acceptable, see RFC 2376
761
- if (isset($this->headers['ACCEPT']) && ('application/xml' == $this->headers['ACCEPT'] || 'text/xml' == $this->headers['ACCEPT']))
762
- return true;
763
-
764
- return false;
765
- }
766
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/api/interface-aftership-api-handler.php DELETED
@@ -1,46 +0,0 @@
1
- <?php
2
- /**
3
- * AfterShip API
4
- *
5
- * Defines an interface that API request/response handlers should implement
6
- *
7
- * @author AfterShip
8
- * @category API
9
- * @package AfterShip/API
10
- * @since 1.0
11
- */
12
-
13
- if (!defined('ABSPATH')) exit; // Exit if accessed directly
14
-
15
- interface AfterShip_API_Handler
16
- {
17
-
18
- /**
19
- * Get the content type for the response
20
- *
21
- * This should return the proper HTTP content-type for the response
22
- *
23
- * @since 2.1
24
- * @return string
25
- */
26
- public function get_content_type();
27
-
28
- /**
29
- * Parse the raw request body entity into an array
30
- *
31
- * @since 2.1
32
- * @param string $data
33
- * @return array
34
- */
35
- public function parse_body($data);
36
-
37
- /**
38
- * Generate a response from an array of data
39
- *
40
- * @since 2.1
41
- * @param array $data
42
- * @return string
43
- */
44
- public function generate_response($data);
45
-
46
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/assets/css/admin.css DELETED
@@ -1,15 +0,0 @@
1
- .hidden-field {
2
- display: none;
3
- }
4
-
5
- #aftership_tracking_provider {
6
- width: 100%;
7
- }
8
-
9
- .aftership_input_text {
10
- width: 300px;
11
- }
12
-
13
- .aftership_dropdown {
14
- width: 300px;
15
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/assets/js/admin.js DELETED
@@ -1,127 +0,0 @@
1
- var aftership_woocommerce_tracking_onload_run = false;
2
-
3
- var aftership_woocommerce_tracking_onload = function () {
4
- if (aftership_woocommerce_tracking_onload_run) {
5
- return aftership_woocommerce_tracking_onload_run;
6
- }
7
- aftership_woocommerce_tracking_onload_run = true;
8
-
9
- var fields_id = {
10
- 'tracking_ship_date': 'aftership_tracking_shipdate',
11
- 'tracking_postal_code': 'aftership_tracking_postal',
12
- 'tracking_account_number': 'aftership_tracking_account',
13
- 'tracking_key': 'aftership_tracking_key',
14
- 'tracking_destination_country': 'aftership_tracking_destination_country'
15
- };
16
-
17
- var providers;
18
-
19
- function hide_input_and_label(id) {
20
- jQuery('#' + id).hide();
21
- jQuery('label[for=' + id + ']').hide();
22
- }
23
-
24
- function show_input_and_label(id) {
25
- jQuery('#' + id).show();
26
- jQuery('label[for=' + id + ']').show();
27
- }
28
-
29
- function set_aftership_tracking_provider() {
30
-
31
- jQuery('#aftership_tracking_provider').change(function () {
32
- jQuery.each(fields_id, function (index, item) {
33
- hide_input_and_label(item);
34
- });
35
-
36
- var slug = jQuery(this).val();
37
- if (slug) {
38
- var provider = providers[slug];
39
- var fields = [];
40
- if (jQuery.isArray(provider.required_fields)) {
41
- fields = provider.required_fields;
42
- } else {
43
- fields.push(provider.required_fields);
44
- }
45
- jQuery.each(fields, function (index, item) {
46
- if (fields_id[item]) {
47
- show_input_and_label(fields_id[item]);
48
- }
49
- });
50
- jQuery('#aftership_tracking_provider_name').val(provider.name);
51
- jQuery('#aftership_tracking_required_fields').val(fields.join());
52
- }
53
- });
54
- }
55
-
56
-
57
- function fill_meta_box(couriers_selected) {
58
- var response = get_couriers();
59
- var couriers = [];
60
- jQuery.each(response, function (index, courier) {
61
- if (couriers_selected.indexOf(courier.slug) != -1) {
62
- couriers.push(courier);
63
- }
64
- });
65
-
66
- var selected_provider = jQuery('#aftership_tracking_provider_hidden').val();
67
- var find_selected_provider = couriers_selected.indexOf(selected_provider) != -1;
68
- if (!find_selected_provider && selected_provider) {
69
- couriers.push({
70
- slug: selected_provider,
71
- name: jQuery("#aftership_tracking_provider_name").val(),
72
- required_fields: jQuery("#aftership_tracking_required_fields").val()
73
- });
74
- }
75
- // console.log(couriers);
76
-
77
- couriers = sort_couriers(couriers);
78
-
79
- jQuery.each(couriers, function (key, courier) {
80
- var str = '<option ';
81
- if (!find_selected_provider && courier['slug'] == selected_provider) {
82
- str += 'style="display:none;" ';
83
- }
84
- str += 'value="' + courier['slug'] + '" ';
85
- if (courier['slug'] == selected_provider) {
86
- str += 'selected="selected"';
87
- }
88
- str += '>' + courier['name'] + '</option>';
89
- jQuery('#aftership_tracking_provider').append(str);
90
- });
91
- // jQuery('#aftership_tracking_provider').val(selected_provider);
92
- jQuery('#aftership_tracking_provider').trigger("chosen:updated");
93
- jQuery('#aftership_tracking_provider_chosen').css({width: '100%'});
94
-
95
- providers = {};
96
- jQuery.each(couriers, function (index, courier) {
97
- providers[courier.slug] = courier;
98
- });
99
- set_aftership_tracking_provider();
100
- jQuery('#aftership_tracking_provider').trigger('change');
101
- }
102
-
103
- if (jQuery('#aftership_tracking_provider').length > 0) {
104
-
105
- jQuery.each(fields_id, function (index, item) {
106
- hide_input_and_label(item);
107
- });
108
-
109
- var couriers_selected = jQuery('#aftership_couriers_selected').val();
110
- var couriers_selected_arr = (couriers_selected) ? couriers_selected.split(',') : [];
111
- fill_meta_box(couriers_selected_arr);
112
- }
113
-
114
- if (jQuery('#aftership_tracking_provider_name').length > 0) {
115
- jQuery('#aftership_tracking_provider_name').parent().hide();
116
- }
117
-
118
- if (jQuery('#aftership_tracking_required_fields').length > 0) {
119
- jQuery('#aftership_tracking_required_fields').parent().hide();
120
- }
121
-
122
- return aftership_woocommerce_tracking_onload_run;
123
- };
124
-
125
- jQuery(function () {
126
- aftership_woocommerce_tracking_onload();
127
- });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/assets/js/couriers.js DELETED
@@ -1,2020 +0,0 @@
1
- function get_couriers() {
2
- var data = [
3
- {
4
- "slug": "17postservice",
5
- "name": "17 Post Service",
6
- "other_name": "17PostService",
7
- "required_fields": []
8
- },
9
- {
10
- "slug": "2go",
11
- "name": "2GO",
12
- "other_name": "Negros Navigation",
13
- "required_fields": []
14
- },
15
- {
16
- "slug": "360lion",
17
- "name": "360 Lion Express",
18
- "other_name": "",
19
- "required_fields": []
20
- },
21
- {
22
- "slug": "4-72",
23
- "name": "4-72 Entregando",
24
- "other_name": "Colombia Postal Service",
25
- "required_fields": []
26
- },
27
- {
28
- "slug": "4px",
29
- "name": "4PX",
30
- "other_name": "递四方",
31
- "required_fields": []
32
- },
33
- {
34
- "slug": "4squaregroup",
35
- "name": "4Square Group",
36
- "other_name": "4 Square",
37
- "required_fields": []
38
- },
39
- {
40
- "slug": "800bestex",
41
- "name": "Best Express",
42
- "other_name": "百世汇通",
43
- "required_fields": []
44
- },
45
- {
46
- "slug": "abf",
47
- "name": "ABF Freight",
48
- "other_name": "Arkansas Best Corporation",
49
- "required_fields": []
50
- },
51
- {
52
- "slug": "abxexpress-my",
53
- "name": "ABX Express",
54
- "other_name": "ABX Express (M) Sdn Bhd",
55
- "required_fields": []
56
- },
57
- {
58
- "slug": "acscourier",
59
- "name": "ACS Courier",
60
- "other_name": "Αναζήτηση Καταστημάτων",
61
- "required_fields": []
62
- },
63
- {
64
- "slug": "adsone",
65
- "name": "ADSOne",
66
- "other_name": "ADSOne Group",
67
- "required_fields": []
68
- },
69
- {
70
- "slug": "aeroflash",
71
- "name": "Mexico AeroFlash",
72
- "other_name": "AeroFlash",
73
- "required_fields": []
74
- },
75
- {
76
- "slug": "air21",
77
- "name": "AIR21",
78
- "other_name": "AIR 21 PH",
79
- "required_fields": []
80
- },
81
- {
82
- "slug": "airpak-express",
83
- "name": "Airpak Express",
84
- "other_name": "",
85
- "required_fields": []
86
- },
87
- {
88
- "slug": "airspeed",
89
- "name": "Airspeed International Corporation",
90
- "other_name": "Airspeed Philippines",
91
- "required_fields": []
92
- },
93
- {
94
- "slug": "an-post",
95
- "name": "An Post",
96
- "other_name": "Ireland Post",
97
- "required_fields": []
98
- },
99
- {
100
- "slug": "apc",
101
- "name": "APC Postal Logistics",
102
- "other_name": "APC-PLI",
103
- "required_fields": []
104
- },
105
- {
106
- "slug": "apc-overnight",
107
- "name": "APC Overnight",
108
- "other_name": "The Alternative Parcels Company Limited",
109
- "required_fields": [
110
- "tracking_account_number"
111
- ]
112
- },
113
- {
114
- "slug": "aramex",
115
- "name": "Aramex",
116
- "other_name": "ارامكس",
117
- "required_fields": []
118
- },
119
- {
120
- "slug": "arrowxl",
121
- "name": "Arrow XL",
122
- "other_name": "Yodel XL",
123
- "required_fields": [
124
- "tracking_postal_code"
125
- ]
126
- },
127
- {
128
- "slug": "asendia-de",
129
- "name": "Asendia Germany",
130
- "other_name": "Asendia De",
131
- "required_fields": []
132
- },
133
- {
134
- "slug": "asendia-uk",
135
- "name": "Asendia UK",
136
- "other_name": "Asendia United Kingdom",
137
- "required_fields": []
138
- },
139
- {
140
- "slug": "asendia-usa",
141
- "name": "Asendia USA",
142
- "other_name": "Brokers Worldwide",
143
- "required_fields": []
144
- },
145
- {
146
- "slug": "asm",
147
- "name": "ASM",
148
- "other_name": "Asm-Red",
149
- "required_fields": [
150
- "tracking_postal_code"
151
- ]
152
- },
153
- {
154
- "slug": "aupost-china",
155
- "name": "AuPost China",
156
- "other_name": "澳邮宝",
157
- "required_fields": []
158
- },
159
- {
160
- "slug": "australia-post",
161
- "name": "Australia Post",
162
- "other_name": "AusPost",
163
- "required_fields": []
164
- },
165
- {
166
- "slug": "austrian-post",
167
- "name": "Austrian Post (Express)",
168
- "other_name": "Österreichische Post AG",
169
- "required_fields": []
170
- },
171
- {
172
- "slug": "austrian-post-registered",
173
- "name": "Austrian Post (Registered)",
174
- "other_name": "Österreichische Post AG",
175
- "required_fields": []
176
- },
177
- {
178
- "slug": "belpost",
179
- "name": "Belpost",
180
- "other_name": "Belposhta, Белпочта",
181
- "required_fields": []
182
- },
183
- {
184
- "slug": "bert-fr",
185
- "name": "Bert Transport",
186
- "other_name": "",
187
- "required_fields": []
188
- },
189
- {
190
- "slug": "bgpost",
191
- "name": "Bulgarian Posts",
192
- "other_name": "Български пощи",
193
- "required_fields": []
194
- },
195
- {
196
- "slug": "bh-posta",
197
- "name": "JP BH Pošta",
198
- "other_name": "Bosnia and Herzegovina Post",
199
- "required_fields": []
200
- },
201
- {
202
- "slug": "bluedart",
203
- "name": "Bluedart",
204
- "other_name": "Blue Dart Express",
205
- "required_fields": []
206
- },
207
- {
208
- "slug": "bondscouriers",
209
- "name": "Bonds Couriers",
210
- "other_name": "",
211
- "required_fields": []
212
- },
213
- {
214
- "slug": "boxc",
215
- "name": "BOXC",
216
- "other_name": "BOXC快遞",
217
- "required_fields": []
218
- },
219
- {
220
- "slug": "bpost",
221
- "name": "Belgium Post",
222
- "other_name": "bpost, Belgian Post",
223
- "required_fields": []
224
- },
225
- {
226
- "slug": "bpost-international",
227
- "name": "bpost international",
228
- "other_name": "Landmark Global",
229
- "required_fields": []
230
- },
231
- {
232
- "slug": "brazil-correios",
233
- "name": "Brazil Correios",
234
- "other_name": "Brazilian Post",
235
- "required_fields": []
236
- },
237
- {
238
- "slug": "brt-it",
239
- "name": "BRT Bartolini",
240
- "other_name": "BRT Corriere Espresso, DPD Italy",
241
- "required_fields": []
242
- },
243
- {
244
- "slug": "cambodia-post",
245
- "name": "Cambodia Post",
246
- "other_name": "Cambodia Post",
247
- "required_fields": []
248
- },
249
- {
250
- "slug": "canada-post",
251
- "name": "Canada Post",
252
- "other_name": "Postes Canada",
253
- "required_fields": []
254
- },
255
- {
256
- "slug": "canpar",
257
- "name": "Canpar Courier",
258
- "other_name": "TransForce",
259
- "required_fields": []
260
- },
261
- {
262
- "slug": "cbl-logistica",
263
- "name": "CBL Logistics",
264
- "other_name": "",
265
- "required_fields": []
266
- },
267
- {
268
- "slug": "ceska-posta",
269
- "name": "Česká Pošta",
270
- "other_name": "Czech Post",
271
- "required_fields": []
272
- },
273
- {
274
- "slug": "china-ems",
275
- "name": "China EMS",
276
- "other_name": "中国邮政速递物流",
277
- "required_fields": []
278
- },
279
- {
280
- "slug": "china-post",
281
- "name": "China Post",
282
- "other_name": "中国邮政, ePacket, e-Packet",
283
- "required_fields": []
284
- },
285
- {
286
- "slug": "chronopost-france",
287
- "name": "Chronopost France",
288
- "other_name": "La Poste EMS",
289
- "required_fields": []
290
- },
291
- {
292
- "slug": "chronopost-portugal",
293
- "name": "Chronopost Portugal",
294
- "other_name": "Chronopost pt",
295
- "required_fields": []
296
- },
297
- {
298
- "slug": "citylinkexpress",
299
- "name": "City-Link Express",
300
- "other_name": "Citylink Malaysia",
301
- "required_fields": []
302
- },
303
- {
304
- "slug": "cj-gls",
305
- "name": "CJ GLS",
306
- "other_name": "CJ Korea Express, 씨제이지엘에스주식회사",
307
- "required_fields": []
308
- },
309
- {
310
- "slug": "cnexps",
311
- "name": "CNE Express",
312
- "other_name": "国际快递",
313
- "required_fields": []
314
- },
315
- {
316
- "slug": "colis-prive",
317
- "name": "Colis Privé",
318
- "other_name": "ColisPrivé",
319
- "required_fields": []
320
- },
321
- {
322
- "slug": "colissimo",
323
- "name": "Colissimo",
324
- "other_name": "Colissimo fr",
325
- "required_fields": []
326
- },
327
- {
328
- "slug": "collectplus",
329
- "name": "Collect+",
330
- "other_name": "Collect Plus UK",
331
- "required_fields": []
332
- },
333
- {
334
- "slug": "con-way",
335
- "name": "Con-way Freight",
336
- "other_name": "Conway",
337
- "required_fields": []
338
- },
339
- {
340
- "slug": "correo-argentino",
341
- "name": "Correo Argentino",
342
- "other_name": "Argentina Post",
343
- "required_fields": []
344
- },
345
- {
346
- "slug": "correos-chile",
347
- "name": "Correos Chile",
348
- "other_name": "Chile Post",
349
- "required_fields": []
350
- },
351
- {
352
- "slug": "correos-de-mexico",
353
- "name": "Correos de Mexico",
354
- "other_name": "Mexico Post",
355
- "required_fields": []
356
- },
357
- {
358
- "slug": "correosexpress",
359
- "name": "Correos Express",
360
- "other_name": "",
361
- "required_fields": [
362
- "tracking_postal_code"
363
- ]
364
- },
365
- {
366
- "slug": "costmeticsnow",
367
- "name": "Cosmetics Now",
368
- "other_name": "CosmeticsNow",
369
- "required_fields": []
370
- },
371
- {
372
- "slug": "courier-plus",
373
- "name": "Courier Plus",
374
- "other_name": "Courier Plus",
375
- "required_fields": []
376
- },
377
- {
378
- "slug": "courierit",
379
- "name": "Courier IT",
380
- "other_name": "Courierit",
381
- "required_fields": []
382
- },
383
- {
384
- "slug": "courierpost",
385
- "name": "CourierPost",
386
- "other_name": "Express Couriers",
387
- "required_fields": []
388
- },
389
- {
390
- "slug": "couriers-please",
391
- "name": "Couriers Please",
392
- "other_name": "CouriersPlease",
393
- "required_fields": []
394
- },
395
- {
396
- "slug": "cuckooexpress",
397
- "name": "Cuckoo Express",
398
- "other_name": "布谷鸟",
399
- "required_fields": []
400
- },
401
- {
402
- "slug": "cyprus-post",
403
- "name": "Cyprus Post",
404
- "other_name": "ΚΥΠΡΙΑΚΑ ΤΑΧΥΔΡΟΜΕΙΑ",
405
- "required_fields": []
406
- },
407
- {
408
- "slug": "dachser",
409
- "name": "DACHSER",
410
- "other_name": "Azkar",
411
- "required_fields": []
412
- },
413
- {
414
- "slug": "danmark-post",
415
- "name": "Post Danmark",
416
- "other_name": "Danske Post",
417
- "required_fields": []
418
- },
419
- {
420
- "slug": "dawnwing",
421
- "name": "Dawn Wing",
422
- "other_name": "DPD Laser Express Logistics",
423
- "required_fields": []
424
- },
425
- {
426
- "slug": "dbschenker-se",
427
- "name": "DB Schenker Sweden",
428
- "other_name": "Deutsche Bahn",
429
- "required_fields": []
430
- },
431
- {
432
- "slug": "delcart-in",
433
- "name": "Delcart",
434
- "other_name": "",
435
- "required_fields": []
436
- },
437
- {
438
- "slug": "delhivery",
439
- "name": "Delhivery",
440
- "other_name": "Gharpay",
441
- "required_fields": []
442
- },
443
- {
444
- "slug": "delivreeking",
445
- "name": "Delivree King",
446
- "other_name": "delivery king",
447
- "required_fields": []
448
- },
449
- {
450
- "slug": "deltec-courier",
451
- "name": "Deltec Courier",
452
- "other_name": "Deltec Interntional Courier",
453
- "required_fields": []
454
- },
455
- {
456
- "slug": "detrack",
457
- "name": "Detrack",
458
- "other_name": "Detrack Singapore",
459
- "required_fields": []
460
- },
461
- {
462
- "slug": "deutsch-post",
463
- "name": "Deutsche Post Mail",
464
- "other_name": "dpdhl",
465
- "required_fields": [
466
- "tracking_ship_date"
467
- ]
468
- },
469
- {
470
- "slug": "dhl",
471
- "name": "DHL Express",
472
- "other_name": "DHL International",
473
- "required_fields": []
474
- },
475
- {
476
- "slug": "dhl-benelux",
477
- "name": "DHL Benelux",
478
- "other_name": "DHL TrackNet Benelux",
479
- "required_fields": []
480
- },
481
- {
482
- "slug": "dhl-deliverit",
483
- "name": "DHL 2-Mann-Handling",
484
- "other_name": "DHL Deliver IT",
485
- "required_fields": [
486
- "tracking_postal_code"
487
- ]
488
- },
489
- {
490
- "slug": "dhl-es",
491
- "name": "DHL Spain Domestic",
492
- "other_name": "DHL España",
493
- "required_fields": []
494
- },
495
- {
496
- "slug": "dhl-germany",
497
- "name": "Deutsche Post DHL",
498
- "other_name": "DHL Germany",
499
- "required_fields": []
500
- },
501
- {
502
- "slug": "dhl-global-mail",
503
- "name": "DHL eCommerce",
504
- "other_name": "DHL Global Mail",
505
- "required_fields": []
506
- },
507
- {
508
- "slug": "dhl-global-mail-asia",
509
- "name": "DHL Global Mail Asia",
510
- "other_name": "DGM Asia",
511
- "required_fields": []
512
- },
513
- {
514
- "slug": "dhl-hk",
515
- "name": "DHL Hong Kong",
516
- "other_name": "DHL HK Domestic",
517
- "required_fields": []
518
- },
519
- {
520
- "slug": "dhl-nl",
521
- "name": "DHL Netherlands",
522
- "other_name": "DHL Nederlands",
523
- "required_fields": []
524
- },
525
- {
526
- "slug": "dhl-pieceid",
527
- "name": "DHL Express (Piece ID)",
528
- "other_name": "DHL International",
529
- "required_fields": []
530
- },
531
- {
532
- "slug": "dhl-poland",
533
- "name": "DHL Poland Domestic",
534
- "other_name": "DHL Polska",
535
- "required_fields": []
536
- },
537
- {
538
- "slug": "dhlparcel-nl",
539
- "name": "DHL Parcel NL",
540
- "other_name": "Selektvracht, dhlparcel.nl",
541
- "required_fields": []
542
- },
543
- {
544
- "slug": "directlink",
545
- "name": "Direct Link",
546
- "other_name": "Direct Link",
547
- "required_fields": []
548
- },
549
- {
550
- "slug": "dmm-network",
551
- "name": "DMM Network",
552
- "other_name": "dmmnetwork.it",
553
- "required_fields": []
554
- },
555
- {
556
- "slug": "dotzot",
557
- "name": "Dotzot",
558
- "other_name": "Dotzot",
559
- "required_fields": []
560
- },
561
- {
562
- "slug": "dpd",
563
- "name": "DPD",
564
- "other_name": "Dynamic Parcel Distribution",
565
- "required_fields": []
566
- },
567
- {
568
- "slug": "dpd-de",
569
- "name": "DPD Germany",
570
- "other_name": "DPD Germany",
571
- "required_fields": []
572
- },
573
- {
574
- "slug": "dpd-ireland",
575
- "name": "DPD Ireland",
576
- "other_name": "DPD ie",
577
- "required_fields": []
578
- },
579
- {
580
- "slug": "dpd-poland",
581
- "name": "DPD Poland",
582
- "other_name": "Dynamic Parcel Distribution Poland",
583
- "required_fields": []
584
- },
585
- {
586
- "slug": "dpd-uk",
587
- "name": "DPD UK",
588
- "other_name": "Dynamic Parcel Distribution UK",
589
- "required_fields": []
590
- },
591
- {
592
- "slug": "dpe-za",
593
- "name": "DPE South Africa",
594
- "other_name": "DPE Worldwide Express",
595
- "required_fields": []
596
- },
597
- {
598
- "slug": "dpex",
599
- "name": "DPEX",
600
- "other_name": "TGX, Toll Global Express Asia",
601
- "required_fields": []
602
- },
603
- {
604
- "slug": "dsv",
605
- "name": "DSV",
606
- "other_name": "",
607
- "required_fields": []
608
- },
609
- {
610
- "slug": "dtdc",
611
- "name": "DTDC India",
612
- "other_name": "DTDC Courier & Cargo",
613
- "required_fields": []
614
- },
615
- {
616
- "slug": "dynamic-logistics",
617
- "name": "Dynamic Logistics",
618
- "other_name": "Dynamic Logistics Thailand",
619
- "required_fields": [
620
- "tracking_account_number"
621
- ]
622
- },
623
- {
624
- "slug": "easy-mail",
625
- "name": "Easy Mail",
626
- "other_name": "",
627
- "required_fields": []
628
- },
629
- {
630
- "slug": "ec-firstclass",
631
- "name": "EC-Firstclass",
632
- "other_name": "ChuKou1, CK1",
633
- "required_fields": []
634
- },
635
- {
636
- "slug": "ecargo-asia",
637
- "name": "Ecargo",
638
- "other_name": "Ecargo Pte. Ltd",
639
- "required_fields": []
640
- },
641
- {
642
- "slug": "ecexpress-cn",
643
- "name": "EC Express",
644
- "other_name": "CIS Post, u4e0au6d77u4e1cu64ce",
645
- "required_fields": []
646
- },
647
- {
648
- "slug": "echo",
649
- "name": "Echo",
650
- "other_name": "Echo Global Logistics",
651
- "required_fields": []
652
- },
653
- {
654
- "slug": "ecom-express",
655
- "name": "Ecom Express",
656
- "other_name": "EcomExpress",
657
- "required_fields": []
658
- },
659
- {
660
- "slug": "elta-courier",
661
- "name": "ELTA Hellenic Post",
662
- "other_name": "Greece Post, Ελληνικά Ταχυδρομεία, ELTA Courier, Ταχυμεταφορές ΕΛΤΑ",
663
- "required_fields": []
664
- },
665
- {
666
- "slug": "emirates-post",
667
- "name": "Emirates Post",
668
- "other_name": "مجموعة بريد الإمارات, UAE Post",
669
- "required_fields": []
670
- },
671
- {
672
- "slug": "empsexpress",
673
- "name": "EMPS Express",
674
- "other_name": "快信快包",
675
- "required_fields": []
676
- },
677
- {
678
- "slug": "ensenda",
679
- "name": "Ensenda",
680
- "other_name": "",
681
- "required_fields": []
682
- },
683
- {
684
- "slug": "envialia",
685
- "name": "Envialia",
686
- "other_name": "Envialia Spain",
687
- "required_fields": []
688
- },
689
- {
690
- "slug": "equick-cn",
691
- "name": "Equick China",
692
- "other_name": "北京网易速达",
693
- "required_fields": []
694
- },
695
- {
696
- "slug": "estafeta",
697
- "name": "Estafeta",
698
- "other_name": "Estafeta Mexicana",
699
- "required_fields": []
700
- },
701
- {
702
- "slug": "estes",
703
- "name": "Estes",
704
- "other_name": "Estes Express Lines",
705
- "required_fields": []
706
- },
707
- {
708
- "slug": "exapaq",
709
- "name": "Exapaq",
710
- "other_name": "DPD France",
711
- "required_fields": []
712
- },
713
- {
714
- "slug": "fastrak-th",
715
- "name": "Fastrak Services",
716
- "other_name": "Fastrak Advanced Delivery Systems",
717
- "required_fields": []
718
- },
719
- {
720
- "slug": "fastway-au",
721
- "name": "Fastway Australia",
722
- "other_name": "Fastway Couriers",
723
- "required_fields": []
724
- },
725
- {
726
- "slug": "fastway-ireland",
727
- "name": "Fastway Ireland",
728
- "other_name": "Fastway Couriers",
729
- "required_fields": []
730
- },
731
- {
732
- "slug": "fastway-nz",
733
- "name": "Fastway New Zealand",
734
- "other_name": "",
735
- "required_fields": []
736
- },
737
- {
738
- "slug": "fastway-za",
739
- "name": "Fastway South Africa",
740
- "other_name": "Fastway Couriers",
741
- "required_fields": []
742
- },
743
- {
744
- "slug": "fedex",
745
- "name": "FedEx",
746
- "other_name": "Federal Express",
747
- "required_fields": []
748
- },
749
- {
750
- "slug": "fedex-freight",
751
- "name": "FedEx Freight",
752
- "other_name": "FedEx LTL",
753
- "required_fields": []
754
- },
755
- {
756
- "slug": "fedex-uk",
757
- "name": "FedEx UK",
758
- "other_name": "FedEx United Kingdom",
759
- "required_fields": []
760
- },
761
- {
762
- "slug": "fercam",
763
- "name": "FERCAM Logistics & Transport",
764
- "other_name": "FERCAM SpA",
765
- "required_fields": []
766
- },
767
- {
768
- "slug": "first-flight",
769
- "name": "First Flight Couriers",
770
- "other_name": "FirstFlight India",
771
- "required_fields": []
772
- },
773
- {
774
- "slug": "first-logistics",
775
- "name": "First Logistics",
776
- "other_name": "PT Synergy First Logistics",
777
- "required_fields": []
778
- },
779
- {
780
- "slug": "flytexpress",
781
- "name": "Flyt Express",
782
- "other_name": "飞特物流",
783
- "required_fields": []
784
- },
785
- {
786
- "slug": "gati-kwe",
787
- "name": "Gati-KWE",
788
- "other_name": "Gati-Kintetsu Express",
789
- "required_fields": []
790
- },
791
- {
792
- "slug": "gdex",
793
- "name": "GDEX",
794
- "other_name": "GD Express",
795
- "required_fields": []
796
- },
797
- {
798
- "slug": "geodis-calberson-fr",
799
- "name": "Geodis Calberson France",
800
- "other_name": "Geodiscalberson",
801
- "required_fields": [
802
- "tracking_postal_code"
803
- ]
804
- },
805
- {
806
- "slug": "ghn",
807
- "name": "Giao hàng nhanh",
808
- "other_name": "Giaohangnhanh.vn, GHN",
809
- "required_fields": []
810
- },
811
- {
812
- "slug": "globegistics",
813
- "name": "Globegistics Inc.",
814
- "other_name": "",
815
- "required_fields": []
816
- },
817
- {
818
- "slug": "gls",
819
- "name": "GLS",
820
- "other_name": "General Logistics Systems",
821
- "required_fields": []
822
- },
823
- {
824
- "slug": "gls-italy",
825
- "name": "GLS Italy",
826
- "other_name": "GLS Corriere Espresso",
827
- "required_fields": []
828
- },
829
- {
830
- "slug": "gls-netherlands",
831
- "name": "GLS Netherlands",
832
- "other_name": "GLS NL",
833
- "required_fields": [
834
- "tracking_postal_code"
835
- ]
836
- },
837
- {
838
- "slug": "gofly",
839
- "name": "GoFly",
840
- "other_name": "GoFlyi",
841
- "required_fields": []
842
- },
843
- {
844
- "slug": "gojavas",
845
- "name": "GoJavas",
846
- "other_name": "Javas",
847
- "required_fields": []
848
- },
849
- {
850
- "slug": "greyhound",
851
- "name": "Greyhound",
852
- "other_name": "Greyhound Package Express",
853
- "required_fields": []
854
- },
855
- {
856
- "slug": "hermes",
857
- "name": "Hermesworld",
858
- "other_name": "Hermes-europe UK",
859
- "required_fields": []
860
- },
861
- {
862
- "slug": "hermes-de",
863
- "name": "Hermes Germany",
864
- "other_name": "myhermes.de, Hermes Logistik Gruppe Deutschland",
865
- "required_fields": []
866
- },
867
- {
868
- "slug": "hh-exp",
869
- "name": "Hua Han Logistics",
870
- "other_name": "u534eu7ff0u56fdu9645u7269u6d41",
871
- "required_fields": []
872
- },
873
- {
874
- "slug": "homedirect-logistics",
875
- "name": "Homedirect Logistics",
876
- "other_name": "",
877
- "required_fields": []
878
- },
879
- {
880
- "slug": "hong-kong-post",
881
- "name": "Hong Kong Post",
882
- "other_name": "香港郵政",
883
- "required_fields": []
884
- },
885
- {
886
- "slug": "hrvatska-posta",
887
- "name": "Hrvatska Pošta",
888
- "other_name": "Croatia Post",
889
- "required_fields": []
890
- },
891
- {
892
- "slug": "i-parcel",
893
- "name": "i-parcel",
894
- "other_name": "iparcel",
895
- "required_fields": []
896
- },
897
- {
898
- "slug": "imxmail",
899
- "name": "IMX Mail",
900
- "other_name": "IMX International Mail Consolidator",
901
- "required_fields": []
902
- },
903
- {
904
- "slug": "india-post",
905
- "name": "India Post Domestic",
906
- "other_name": "भारतीय डाक",
907
- "required_fields": []
908
- },
909
- {
910
- "slug": "india-post-int",
911
- "name": "India Post International",
912
- "other_name": "भारतीय डाक, Speed Post & eMO, EMS, IPS Web",
913
- "required_fields": []
914
- },
915
- {
916
- "slug": "inpost-paczkomaty",
917
- "name": "InPost Paczkomaty",
918
- "other_name": "",
919
- "required_fields": []
920
- },
921
- {
922
- "slug": "interlink-express",
923
- "name": "Interlink Express",
924
- "other_name": "Interlink UK",
925
- "required_fields": []
926
- },
927
- {
928
- "slug": "international-seur",
929
- "name": "International Seur",
930
- "other_name": "SEUR Internacional",
931
- "required_fields": []
932
- },
933
- {
934
- "slug": "israel-post",
935
- "name": "Israel Post",
936
- "other_name": "חברת דואר ישראל",
937
- "required_fields": []
938
- },
939
- {
940
- "slug": "israel-post-domestic",
941
- "name": "Israel Post Domestic",
942
- "other_name": "חברת דואר ישראל מקומית",
943
- "required_fields": []
944
- },
945
- {
946
- "slug": "italy-sda",
947
- "name": "Italy SDA",
948
- "other_name": "SDA Express Courier",
949
- "required_fields": []
950
- },
951
- {
952
- "slug": "jam-express",
953
- "name": "Jam Express",
954
- "other_name": "JAM Global Express",
955
- "required_fields": []
956
- },
957
- {
958
- "slug": "japan-post",
959
- "name": "Japan Post",
960
- "other_name": "日本郵便",
961
- "required_fields": []
962
- },
963
- {
964
- "slug": "jayonexpress",
965
- "name": "Jayon Express (JEX)",
966
- "other_name": "",
967
- "required_fields": []
968
- },
969
- {
970
- "slug": "jcex",
971
- "name": "JCEX",
972
- "other_name": "JiaCheng, 杭州佳成",
973
- "required_fields": []
974
- },
975
- {
976
- "slug": "jet-ship",
977
- "name": "Jet-Ship Worldwide",
978
- "other_name": "",
979
- "required_fields": []
980
- },
981
- {
982
- "slug": "jne",
983
- "name": "JNE",
984
- "other_name": "Express Across Nation, Tiki Jalur Nugraha Ekakurir",
985
- "required_fields": []
986
- },
987
- {
988
- "slug": "kangaroo-my",
989
- "name": "Kangaroo Worldwide Express",
990
- "other_name": "",
991
- "required_fields": []
992
- },
993
- {
994
- "slug": "kerry-logistics",
995
- "name": "Kerry Express Thailand",
996
- "other_name": "嘉里物流, Kerry Logistics",
997
- "required_fields": []
998
- },
999
- {
1000
- "slug": "kerryttc-vn",
1001
- "name": "Kerry TTC Express",
1002
- "other_name": "KTTC",
1003
- "required_fields": []
1004
- },
1005
- {
1006
- "slug": "kgmhub",
1007
- "name": "KGM Hub",
1008
- "other_name": "KGM",
1009
- "required_fields": []
1010
- },
1011
- {
1012
- "slug": "kn",
1013
- "name": "Kuehne + Nagel",
1014
- "other_name": "KN",
1015
- "required_fields": []
1016
- },
1017
- {
1018
- "slug": "korea-post",
1019
- "name": "Korea Post",
1020
- "other_name": "우정사업본부",
1021
- "required_fields": []
1022
- },
1023
- {
1024
- "slug": "la-poste-colissimo",
1025
- "name": "La Poste",
1026
- "other_name": "Coliposte",
1027
- "required_fields": []
1028
- },
1029
- {
1030
- "slug": "lao-post",
1031
- "name": "Lao Post",
1032
- "other_name": "Laos Postal Service",
1033
- "required_fields": []
1034
- },
1035
- {
1036
- "slug": "lasership",
1037
- "name": "LaserShip",
1038
- "other_name": "LaserShip",
1039
- "required_fields": []
1040
- },
1041
- {
1042
- "slug": "lbcexpress",
1043
- "name": "LBC Express",
1044
- "other_name": "LBC Express",
1045
- "required_fields": []
1046
- },
1047
- {
1048
- "slug": "lietuvos-pastas",
1049
- "name": "Lietuvos Paštas",
1050
- "other_name": "Lithuania Post, LP Express",
1051
- "required_fields": []
1052
- },
1053
- {
1054
- "slug": "lion-parcel",
1055
- "name": "Lion Parcel",
1056
- "other_name": "",
1057
- "required_fields": []
1058
- },
1059
- {
1060
- "slug": "lwe-hk",
1061
- "name": "Logistic Worldwide Express",
1062
- "other_name": "LWE",
1063
- "required_fields": []
1064
- },
1065
- {
1066
- "slug": "magyar-posta",
1067
- "name": "Magyar Posta",
1068
- "other_name": "Hungarian Post",
1069
- "required_fields": []
1070
- },
1071
- {
1072
- "slug": "malaysia-post",
1073
- "name": "Malaysia Post EMS / Poslaju",
1074
- "other_name": "Pos Ekspres, Pos Malaysia Express",
1075
- "required_fields": []
1076
- },
1077
- {
1078
- "slug": "malaysia-post-posdaftar",
1079
- "name": "Malaysia Post - Registered",
1080
- "other_name": "PosDaftar",
1081
- "required_fields": []
1082
- },
1083
- {
1084
- "slug": "matdespatch",
1085
- "name": "Matdespatch",
1086
- "other_name": "",
1087
- "required_fields": []
1088
- },
1089
- {
1090
- "slug": "matkahuolto",
1091
- "name": "Matkahuolto",
1092
- "other_name": "Oy Matkahuolto Ab",
1093
- "required_fields": []
1094
- },
1095
- {
1096
- "slug": "maxcellents",
1097
- "name": "Maxcellents Pte Ltd",
1098
- "other_name": "Maxcellent",
1099
- "required_fields": []
1100
- },
1101
- {
1102
- "slug": "mexico-redpack",
1103
- "name": "Mexico Redpack",
1104
- "other_name": "TNT Mexico",
1105
- "required_fields": []
1106
- },
1107
- {
1108
- "slug": "mexico-senda-express",
1109
- "name": "Mexico Senda Express",
1110
- "other_name": "Mexico Senda Express",
1111
- "required_fields": []
1112
- },
1113
- {
1114
- "slug": "mondialrelay",
1115
- "name": "Mondial Relay",
1116
- "other_name": "Mondial Relay France",
1117
- "required_fields": [
1118
- "tracking_postal_code"
1119
- ]
1120
- },
1121
- {
1122
- "slug": "mrw-spain",
1123
- "name": "MRW",
1124
- "other_name": "MRW Spain",
1125
- "required_fields": []
1126
- },
1127
- {
1128
- "slug": "myhermes-uk",
1129
- "name": "myHermes UK",
1130
- "other_name": "",
1131
- "required_fields": []
1132
- },
1133
- {
1134
- "slug": "mypostonline",
1135
- "name": "Mypostonline",
1136
- "other_name": "MYBOXPOST",
1137
- "required_fields": []
1138
- },
1139
- {
1140
- "slug": "nacex-spain",
1141
- "name": "NACEX Spain",
1142
- "other_name": "NACEX Logista",
1143
- "required_fields": [
1144
- "tracking_postal_code"
1145
- ]
1146
- },
1147
- {
1148
- "slug": "nanjingwoyuan",
1149
- "name": "Nanjing Woyuan",
1150
- "other_name": "u6c83u6e90",
1151
- "required_fields": []
1152
- },
1153
- {
1154
- "slug": "nationwide-my",
1155
- "name": "Nationwide Express",
1156
- "other_name": "nationwide2u",
1157
- "required_fields": []
1158
- },
1159
- {
1160
- "slug": "new-zealand-post",
1161
- "name": "New Zealand Post",
1162
- "other_name": "NZ Post",
1163
- "required_fields": []
1164
- },
1165
- {
1166
- "slug": "newgistics",
1167
- "name": "Newgistics",
1168
- "other_name": "",
1169
- "required_fields": []
1170
- },
1171
- {
1172
- "slug": "nhans-solutions",
1173
- "name": "Nhans Solutions",
1174
- "other_name": "Nhans Courier",
1175
- "required_fields": []
1176
- },
1177
- {
1178
- "slug": "nightline",
1179
- "name": "Nightline",
1180
- "other_name": "",
1181
- "required_fields": []
1182
- },
1183
- {
1184
- "slug": "ninjavan",
1185
- "name": "Ninja Van",
1186
- "other_name": "",
1187
- "required_fields": []
1188
- },
1189
- {
1190
- "slug": "ninjavan-my",
1191
- "name": "Ninja Van Malaysia",
1192
- "other_name": "NinjaVan MY",
1193
- "required_fields": []
1194
- },
1195
- {
1196
- "slug": "nipost",
1197
- "name": "NiPost",
1198
- "other_name": "Nigerian Postal Service",
1199
- "required_fields": []
1200
- },
1201
- {
1202
- "slug": "norsk-global",
1203
- "name": "Norsk Global",
1204
- "other_name": "Norsk European Wholesale",
1205
- "required_fields": []
1206
- },
1207
- {
1208
- "slug": "nova-poshta",
1209
- "name": "Nova Poshta",
1210
- "other_name": "Новая Почта",
1211
- "required_fields": []
1212
- },
1213
- {
1214
- "slug": "nuvoex",
1215
- "name": "NuvoEx",
1216
- "other_name": "Nuvo Ex",
1217
- "required_fields": []
1218
- },
1219
- {
1220
- "slug": "oca-ar",
1221
- "name": "OCA Argentina",
1222
- "other_name": "OCA e-Pak",
1223
- "required_fields": []
1224
- },
1225
- {
1226
- "slug": "old-dominion",
1227
- "name": "Old Dominion Freight Line",
1228
- "other_name": "ODFL",
1229
- "required_fields": []
1230
- },
1231
- {
1232
- "slug": "omniparcel",
1233
- "name": "Omni Parcel",
1234
- "other_name": "Omni-Channel Logistics (Seko)",
1235
- "required_fields": []
1236
- },
1237
- {
1238
- "slug": "oneworldexpress",
1239
- "name": "One World Express",
1240
- "other_name": "u6613u65f6u9039u7269u6d41",
1241
- "required_fields": []
1242
- },
1243
- {
1244
- "slug": "ontrac",
1245
- "name": "OnTrac",
1246
- "other_name": "OnTrac Shipping",
1247
- "required_fields": []
1248
- },
1249
- {
1250
- "slug": "opek",
1251
- "name": "FedEx Poland Domestic",
1252
- "other_name": "OPEK",
1253
- "required_fields": []
1254
- },
1255
- {
1256
- "slug": "packlink",
1257
- "name": "Packlink",
1258
- "other_name": "Packlink Spain",
1259
- "required_fields": []
1260
- },
1261
- {
1262
- "slug": "pandulogistics",
1263
- "name": "Pandu Logistics",
1264
- "other_name": "",
1265
- "required_fields": []
1266
- },
1267
- {
1268
- "slug": "panther",
1269
- "name": "Panther",
1270
- "other_name": "Panther Group UK",
1271
- "required_fields": [
1272
- "tracking_account_number"
1273
- ]
1274
- },
1275
- {
1276
- "slug": "parcel-express",
1277
- "name": "Parcel Express",
1278
- "other_name": "Parcel Express Pte Ltd",
1279
- "required_fields": []
1280
- },
1281
- {
1282
- "slug": "parcel-force",
1283
- "name": "Parcel Force",
1284
- "other_name": "Parcelforce UK",
1285
- "required_fields": []
1286
- },
1287
- {
1288
- "slug": "parcelled-in",
1289
- "name": "Parcelled.in",
1290
- "other_name": "Parcelled",
1291
- "required_fields": []
1292
- },
1293
- {
1294
- "slug": "parcelpost-sg",
1295
- "name": "Parcel Post Singapore",
1296
- "other_name": "ParcelPost",
1297
- "required_fields": []
1298
- },
1299
- {
1300
- "slug": "pfcexpress",
1301
- "name": "PFC Express",
1302
- "other_name": "PFCu7687u5bb6u7269u6d41",
1303
- "required_fields": []
1304
- },
1305
- {
1306
- "slug": "poczta-polska",
1307
- "name": "Poczta Polska",
1308
- "other_name": "Poland Post",
1309
- "required_fields": []
1310
- },
1311
- {
1312
- "slug": "portugal-ctt",
1313
- "name": "Portugal CTT",
1314
- "other_name": "Correios de Portugal",
1315
- "required_fields": []
1316
- },
1317
- {
1318
- "slug": "portugal-seur",
1319
- "name": "Portugal Seur",
1320
- "other_name": "SEUR",
1321
- "required_fields": []
1322
- },
1323
- {
1324
- "slug": "pos-indonesia",
1325
- "name": "Pos Indonesia Domestic",
1326
- "other_name": "Indonesian Post Domestic",
1327
- "required_fields": []
1328
- },
1329
- {
1330
- "slug": "pos-indonesia-int",
1331
- "name": "Pos Indonesia Int'l",
1332
- "other_name": "Indonesian Post International EMS",
1333
- "required_fields": []
1334
- },
1335
- {
1336
- "slug": "post-serbia",
1337
- "name": "Post Serbia",
1338
- "other_name": "Pou0161ta Srbije",
1339
- "required_fields": []
1340
- },
1341
- {
1342
- "slug": "post56",
1343
- "name": "Post56",
1344
- "other_name": "捷邮快递",
1345
- "required_fields": []
1346
- },
1347
- {
1348
- "slug": "posta-romana",
1349
- "name": "Poșta Română",
1350
- "other_name": "Romania Post",
1351
- "required_fields": []
1352
- },
1353
- {
1354
- "slug": "poste-italiane",
1355
- "name": "Poste Italiane",
1356
- "other_name": "Italian Post",
1357
- "required_fields": []
1358
- },
1359
- {
1360
- "slug": "poste-italiane-paccocelere",
1361
- "name": "Poste Italiane Paccocelere",
1362
- "other_name": "Italian Post EMS / Express",
1363
- "required_fields": []
1364
- },
1365
- {
1366
- "slug": "posten-norge",
1367
- "name": "Posten Norge / Bring",
1368
- "other_name": "Norway Post, Norska Posten",
1369
- "required_fields": []
1370
- },
1371
- {
1372
- "slug": "posti",
1373
- "name": "Itella Posti",
1374
- "other_name": "Finland Post",
1375
- "required_fields": []
1376
- },
1377
- {
1378
- "slug": "postnl",
1379
- "name": "PostNL Domestic",
1380
- "other_name": "PostNL Pakketten, TNT Post Netherlands",
1381
- "required_fields": [
1382
- "tracking_postal_code"
1383
- ]
1384
- },
1385
- {
1386
- "slug": "postnl-3s",
1387
- "name": "PostNL International 3S",
1388
- "other_name": "TNT Post parcel service United Kingdom",
1389
- "required_fields": [
1390
- "tracking_destination_country",
1391
- "tracking_postal_code"
1392
- ]
1393
- },
1394
- {
1395
- "slug": "postnl-international",
1396
- "name": "PostNL International",
1397
- "other_name": "Netherlands Post, Spring Global Mail",
1398
- "required_fields": []
1399
- },
1400
- {
1401
- "slug": "postnord",
1402
- "name": "PostNord Logistics",
1403
- "other_name": "Posten Norden",
1404
- "required_fields": []
1405
- },
1406
- {
1407
- "slug": "postur-is",
1408
- "name": "Iceland Post",
1409
- "other_name": "Postur.is, Íslandspóstur",
1410
- "required_fields": []
1411
- },
1412
- {
1413
- "slug": "ppbyb",
1414
- "name": "PayPal Package",
1415
- "other_name": "贝邮宝",
1416
- "required_fields": []
1417
- },
1418
- {
1419
- "slug": "professional-couriers",
1420
- "name": "Professional Couriers",
1421
- "other_name": "TPC India",
1422
- "required_fields": []
1423
- },
1424
- {
1425
- "slug": "ptt-posta",
1426
- "name": "PTT Posta",
1427
- "other_name": "Turkish Post",
1428
- "required_fields": []
1429
- },
1430
- {
1431
- "slug": "purolator",
1432
- "name": "Purolator",
1433
- "other_name": "Purolator Freight",
1434
- "required_fields": []
1435
- },
1436
- {
1437
- "slug": "quantium",
1438
- "name": "Quantium",
1439
- "other_name": "u51a0u5eadu7269u6d41",
1440
- "required_fields": []
1441
- },
1442
- {
1443
- "slug": "qxpress",
1444
- "name": "Qxpress",
1445
- "other_name": "Qxpress Qoo10",
1446
- "required_fields": []
1447
- },
1448
- {
1449
- "slug": "raben-group",
1450
- "name": "Raben Group",
1451
- "other_name": "myRaben",
1452
- "required_fields": []
1453
- },
1454
- {
1455
- "slug": "raf",
1456
- "name": "RAF Philippines",
1457
- "other_name": "RAF Int'l. Forwarding",
1458
- "required_fields": []
1459
- },
1460
- {
1461
- "slug": "raiderex",
1462
- "name": "RaidereX",
1463
- "other_name": "Detrack",
1464
- "required_fields": []
1465
- },
1466
- {
1467
- "slug": "ramgroup-za",
1468
- "name": "RAM",
1469
- "other_name": "RAM Group",
1470
- "required_fields": []
1471
- },
1472
- {
1473
- "slug": "red-express",
1474
- "name": "Red Express",
1475
- "other_name": "Red Express",
1476
- "required_fields": []
1477
- },
1478
- {
1479
- "slug": "red-express-wb",
1480
- "name": "Red Express Waybill",
1481
- "other_name": "Red Express WayBill",
1482
- "required_fields": []
1483
- },
1484
- {
1485
- "slug": "redur-es",
1486
- "name": "Redur Spain",
1487
- "other_name": "Eurodis",
1488
- "required_fields": []
1489
- },
1490
- {
1491
- "slug": "rl-carriers",
1492
- "name": "RL Carriers",
1493
- "other_name": "R+L Carriers",
1494
- "required_fields": []
1495
- },
1496
- {
1497
- "slug": "rocketparcel",
1498
- "name": "Rocket Parcel International",
1499
- "other_name": "",
1500
- "required_fields": []
1501
- },
1502
- {
1503
- "slug": "royal-mail",
1504
- "name": "Royal Mail",
1505
- "other_name": "Royal Mail United Kingdom",
1506
- "required_fields": []
1507
- },
1508
- {
1509
- "slug": "rpx",
1510
- "name": "RPX Indonesia",
1511
- "other_name": "Repex Perdana International",
1512
- "required_fields": []
1513
- },
1514
- {
1515
- "slug": "rpxonline",
1516
- "name": "RPX Online",
1517
- "other_name": "Cathay Pacific",
1518
- "required_fields": []
1519
- },
1520
- {
1521
- "slug": "rrdonnelley",
1522
- "name": "RR Donnelley",
1523
- "other_name": "RRD",
1524
- "required_fields": []
1525
- },
1526
- {
1527
- "slug": "russian-post",
1528
- "name": "Russian Post",
1529
- "other_name": "Почта России, EMS Post RU",
1530
- "required_fields": []
1531
- },
1532
- {
1533
- "slug": "rzyexpress",
1534
- "name": "RZY Express",
1535
- "other_name": "RZYExpress",
1536
- "required_fields": []
1537
- },
1538
- {
1539
- "slug": "safexpress",
1540
- "name": "Safexpress",
1541
- "other_name": "Safexpress",
1542
- "required_fields": []
1543
- },
1544
- {
1545
- "slug": "sagawa",
1546
- "name": "Sagawa",
1547
- "other_name": "佐川急便",
1548
- "required_fields": []
1549
- },
1550
- {
1551
- "slug": "sapo",
1552
- "name": "South African Post Office",
1553
- "other_name": "South African Post Office",
1554
- "required_fields": []
1555
- },
1556
- {
1557
- "slug": "saudi-post",
1558
- "name": "Saudi Post",
1559
- "other_name": "البريد السعودي",
1560
- "required_fields": []
1561
- },
1562
- {
1563
- "slug": "sekologistics",
1564
- "name": "SEKO Logistics",
1565
- "other_name": "SEKO",
1566
- "required_fields": []
1567
- },
1568
- {
1569
- "slug": "sf-express",
1570
- "name": "S.F. Express",
1571
- "other_name": "順豊快遞",
1572
- "required_fields": []
1573
- },
1574
- {
1575
- "slug": "sfb2c",
1576
- "name": "S.F International",
1577
- "other_name": "順豐國際",
1578
- "required_fields": []
1579
- },
1580
- {
1581
- "slug": "sgt-it",
1582
- "name": "SGT Corriere Espresso",
1583
- "other_name": "SoGeTras Corriere Espresso",
1584
- "required_fields": []
1585
- },
1586
- {
1587
- "slug": "sic-teliway",
1588
- "name": "Teliway SIC Express",
1589
- "other_name": "Prevote",
1590
- "required_fields": [
1591
- "tracking_account_number",
1592
- "tracking_key"
1593
- ]
1594
- },
1595
- {
1596
- "slug": "singapore-post",
1597
- "name": "Singapore Post",
1598
- "other_name": "SingPost",
1599
- "required_fields": []
1600
- },
1601
- {
1602
- "slug": "singapore-speedpost",
1603
- "name": "Singapore Speedpost",
1604
- "other_name": "Singapore EMS",
1605
- "required_fields": []
1606
- },
1607
- {
1608
- "slug": "singparcel",
1609
- "name": "SingParcel Service",
1610
- "other_name": "SPS",
1611
- "required_fields": []
1612
- },
1613
- {
1614
- "slug": "siodemka",
1615
- "name": "Siodemka",
1616
- "other_name": "Siodemka Kurier",
1617
- "required_fields": []
1618
- },
1619
- {
1620
- "slug": "skynet",
1621
- "name": "SkyNet Malaysia",
1622
- "other_name": "SkyNet MY",
1623
- "required_fields": []
1624
- },
1625
- {
1626
- "slug": "skynetworldwide",
1627
- "name": "SkyNet Worldwide Express",
1628
- "other_name": "Skynetwwe",
1629
- "required_fields": []
1630
- },
1631
- {
1632
- "slug": "skynetworldwide-uk",
1633
- "name": "Skynet Worldwide Express UK",
1634
- "other_name": "Skynet UK",
1635
- "required_fields": []
1636
- },
1637
- {
1638
- "slug": "smsa-express",
1639
- "name": "SMSA Express",
1640
- "other_name": "",
1641
- "required_fields": []
1642
- },
1643
- {
1644
- "slug": "spain-correos-es",
1645
- "name": "Correos de España",
1646
- "other_name": "Spain Post, ChronoExpress",
1647
- "required_fields": []
1648
- },
1649
- {
1650
- "slug": "spanish-seur",
1651
- "name": "Spanish Seur",
1652
- "other_name": "SEUR",
1653
- "required_fields": []
1654
- },
1655
- {
1656
- "slug": "specialisedfreight-za",
1657
- "name": "Specialised Freight",
1658
- "other_name": "SFS",
1659
- "required_fields": []
1660
- },
1661
- {
1662
- "slug": "speedcouriers-gr",
1663
- "name": "Speed Couriers",
1664
- "other_name": "Speed Couriers",
1665
- "required_fields": []
1666
- },
1667
- {
1668
- "slug": "speedexcourier",
1669
- "name": "Speedex Courier",
1670
- "other_name": "Speedex Courier",
1671
- "required_fields": []
1672
- },
1673
- {
1674
- "slug": "spreadel",
1675
- "name": "Spreadel",
1676
- "other_name": "Jabong delivery",
1677
- "required_fields": []
1678
- },
1679
- {
1680
- "slug": "srekorea",
1681
- "name": "SRE Korea",
1682
- "other_name": "SRE 배송서비스",
1683
- "required_fields": []
1684
- },
1685
- {
1686
- "slug": "star-track",
1687
- "name": "StarTrack",
1688
- "other_name": "Star Track",
1689
- "required_fields": []
1690
- },
1691
- {
1692
- "slug": "star-track-express",
1693
- "name": "Star Track Express",
1694
- "other_name": "AaE Australian air Express",
1695
- "required_fields": []
1696
- },
1697
- {
1698
- "slug": "sto",
1699
- "name": "STO Express",
1700
- "other_name": "申通快递, Shentong Express",
1701
- "required_fields": []
1702
- },
1703
- {
1704
- "slug": "sweden-posten",
1705
- "name": "Sweden Posten",
1706
- "other_name": "Sweden Post",
1707
- "required_fields": []
1708
- },
1709
- {
1710
- "slug": "swiss-post",
1711
- "name": "Swiss Post",
1712
- "other_name": "La Poste Suisse, Die Schweizerische Post, Die Post",
1713
- "required_fields": []
1714
- },
1715
- {
1716
- "slug": "szdpex",
1717
- "name": "DPEX China",
1718
- "other_name": "DPEX(深圳)国际物流, Toll China",
1719
- "required_fields": []
1720
- },
1721
- {
1722
- "slug": "taiwan-post",
1723
- "name": "Taiwan Post",
1724
- "other_name": "Chunghwa Post, 台灣中華郵政",
1725
- "required_fields": []
1726
- },
1727
- {
1728
- "slug": "taqbin-hk",
1729
- "name": "TAQBIN Hong Kong",
1730
- "other_name": "Yamat, 雅瑪多運輸- 宅急便",
1731
- "required_fields": []
1732
- },
1733
- {
1734
- "slug": "taqbin-jp",
1735
- "name": "Yamato Japan",
1736
- "other_name": "ヤマト運輸, TAQBIN",
1737
- "required_fields": []
1738
- },
1739
- {
1740
- "slug": "taqbin-my",
1741
- "name": "TAQBIN Malaysia",
1742
- "other_name": "TAQBIN Malaysia",
1743
- "required_fields": []
1744
- },
1745
- {
1746
- "slug": "taqbin-sg",
1747
- "name": "TAQBIN Singapore",
1748
- "other_name": "Yamato Singapore",
1749
- "required_fields": []
1750
- },
1751
- {
1752
- "slug": "taxydromiki",
1753
- "name": "Geniki Taxydromiki",
1754
- "other_name": "ΓΕΝΙΚΗ ΤΑΧΥΔΡΟΜΙΚΗ",
1755
- "required_fields": []
1756
- },
1757
- {
1758
- "slug": "tgx",
1759
- "name": "TGX",
1760
- "other_name": "Top Gun Express, 精英速運",
1761
- "required_fields": []
1762
- },
1763
- {
1764
- "slug": "thailand-post",
1765
- "name": "Thailand Thai Post",
1766
- "other_name": "ไปรษณีย์ไทย",
1767
- "required_fields": []
1768
- },
1769
- {
1770
- "slug": "tiki",
1771
- "name": "Tiki",
1772
- "other_name": "Citra Van Titipan Kilat",
1773
- "required_fields": []
1774
- },
1775
- {
1776
- "slug": "tnt",
1777
- "name": "TNT",
1778
- "other_name": "TNT Express",
1779
- "required_fields": []
1780
- },
1781
- {
1782
- "slug": "tnt-au",
1783
- "name": "TNT Australia",
1784
- "other_name": "TNT AU",
1785
- "required_fields": []
1786
- },
1787
- {
1788
- "slug": "tnt-click",
1789
- "name": "TNT-Click Italy",
1790
- "other_name": "TNT Italy",
1791
- "required_fields": []
1792
- },
1793
- {
1794
- "slug": "tnt-fr",
1795
- "name": "TNT France",
1796
- "other_name": "TNT Express FR",
1797
- "required_fields": []
1798
- },
1799
- {
1800
- "slug": "tnt-it",
1801
- "name": "TNT Italy",
1802
- "other_name": "TNT Express IT",
1803
- "required_fields": []
1804
- },
1805
- {
1806
- "slug": "tnt-reference",
1807
- "name": "TNT Reference",
1808
- "other_name": "TNT consignment reference",
1809
- "required_fields": []
1810
- },
1811
- {
1812
- "slug": "tnt-uk",
1813
- "name": "TNT UK",
1814
- "other_name": "TNT United Kingdom",
1815
- "required_fields": []
1816
- },
1817
- {
1818
- "slug": "tnt-uk-reference",
1819
- "name": "TNT UK Reference",
1820
- "other_name": "TNT UK consignment reference",
1821
- "required_fields": []
1822
- },
1823
- {
1824
- "slug": "tntpost-it",
1825
- "name": "Nexive (TNT Post Italy)",
1826
- "other_name": "Postnl TNT",
1827
- "required_fields": []
1828
- },
1829
- {
1830
- "slug": "toll-ipec",
1831
- "name": "Toll IPEC",
1832
- "other_name": "Toll Express",
1833
- "required_fields": []
1834
- },
1835
- {
1836
- "slug": "toll-priority",
1837
- "name": "Toll Priority",
1838
- "other_name": "Toll Group, Toll Priority",
1839
- "required_fields": []
1840
- },
1841
- {
1842
- "slug": "trakpak",
1843
- "name": "TrakPak",
1844
- "other_name": "bpost international P2P Mailing Trak Pak",
1845
- "required_fields": []
1846
- },
1847
- {
1848
- "slug": "transmission-nl",
1849
- "name": "TransMission",
1850
- "other_name": "mijnzending",
1851
- "required_fields": [
1852
- "tracking_postal_code"
1853
- ]
1854
- },
1855
- {
1856
- "slug": "tuffnells",
1857
- "name": "Tuffnells Parcels Express",
1858
- "other_name": "",
1859
- "required_fields": [
1860
- "tracking_account_number"
1861
- ]
1862
- },
1863
- {
1864
- "slug": "ubi-logistics",
1865
- "name": "UBI Logistics Australia",
1866
- "other_name": "",
1867
- "required_fields": []
1868
- },
1869
- {
1870
- "slug": "uk-mail",
1871
- "name": "UK Mail",
1872
- "other_name": "Business Post Group",
1873
- "required_fields": []
1874
- },
1875
- {
1876
- "slug": "ukrposhta",
1877
- "name": "UkrPoshta",
1878
- "other_name": "Укрпошта",
1879
- "required_fields": []
1880
- },
1881
- {
1882
- "slug": "ups",
1883
- "name": "UPS",
1884
- "other_name": "United Parcel Service",
1885
- "required_fields": []
1886
- },
1887
- {
1888
- "slug": "ups-freight",
1889
- "name": "UPS Freight",
1890
- "other_name": "UPS LTL and Truckload",
1891
- "required_fields": []
1892
- },
1893
- {
1894
- "slug": "ups-mi",
1895
- "name": "UPS Mail Innovations",
1896
- "other_name": "UPS MI",
1897
- "required_fields": []
1898
- },
1899
- {
1900
- "slug": "usps",
1901
- "name": "USPS",
1902
- "other_name": "United States Postal Service",
1903
- "required_fields": []
1904
- },
1905
- {
1906
- "slug": "viettelpost",
1907
- "name": "ViettelPost",
1908
- "other_name": "Bưu chính Viettel",
1909
- "required_fields": []
1910
- },
1911
- {
1912
- "slug": "vnpost",
1913
- "name": "Vietnam Post",
1914
- "other_name": "VNPost",
1915
- "required_fields": []
1916
- },
1917
- {
1918
- "slug": "vnpost-ems",
1919
- "name": "Vietnam Post EMS",
1920
- "other_name": "VNPost EMS",
1921
- "required_fields": []
1922
- },
1923
- {
1924
- "slug": "wahana",
1925
- "name": "Wahana",
1926
- "other_name": "Wahana Indonesia",
1927
- "required_fields": []
1928
- },
1929
- {
1930
- "slug": "wedo",
1931
- "name": "WeDo Logistics",
1932
- "other_name": "運德物流",
1933
- "required_fields": []
1934
- },
1935
- {
1936
- "slug": "wishpost",
1937
- "name": "WishPost",
1938
- "other_name": "Wish",
1939
- "required_fields": []
1940
- },
1941
- {
1942
- "slug": "xdp-uk",
1943
- "name": "XDP Express",
1944
- "other_name": "XDP UK",
1945
- "required_fields": [
1946
- "tracking_postal_code"
1947
- ]
1948
- },
1949
- {
1950
- "slug": "xdp-uk-reference",
1951
- "name": "XDP Express Reference",
1952
- "other_name": "XDP UK",
1953
- "required_fields": [
1954
- "tracking_postal_code"
1955
- ]
1956
- },
1957
- {
1958
- "slug": "xend",
1959
- "name": "Xend Express",
1960
- "other_name": "Xend Business Solutions",
1961
- "required_fields": []
1962
- },
1963
- {
1964
- "slug": "xpressbees",
1965
- "name": "XpressBees",
1966
- "other_name": "XpressBees logistics",
1967
- "required_fields": []
1968
- },
1969
- {
1970
- "slug": "yanwen",
1971
- "name": "Yanwen",
1972
- "other_name": "燕文物流",
1973
- "required_fields": []
1974
- },
1975
- {
1976
- "slug": "yodel",
1977
- "name": "Yodel Domestic",
1978
- "other_name": "Home Delivery Network Limited (HDNL)",
1979
- "required_fields": []
1980
- },
1981
- {
1982
- "slug": "yodel-international",
1983
- "name": "Yodel International",
1984
- "other_name": "Home Delivery Network, HDNL",
1985
- "required_fields": []
1986
- },
1987
- {
1988
- "slug": "yrc",
1989
- "name": "YRC",
1990
- "other_name": "YRC Freight",
1991
- "required_fields": []
1992
- },
1993
- {
1994
- "slug": "yundaex",
1995
- "name": "Yunda Express",
1996
- "other_name": "韵达快递",
1997
- "required_fields": []
1998
- },
1999
- {
2000
- "slug": "yunexpress",
2001
- "name": "Yun Express",
2002
- "other_name": "云途物流",
2003
- "required_fields": []
2004
- },
2005
- {
2006
- "slug": "zalora-7-eleven",
2007
- "name": "Zalora 7-Eleven",
2008
- "other_name": "7-11",
2009
- "required_fields": []
2010
- },
2011
- {
2012
- "slug": "zjs-express",
2013
- "name": "ZJS International",
2014
- "other_name": "宅急送快運",
2015
- "required_fields": []
2016
- }
2017
- ];
2018
- return data;
2019
- }
2020
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/assets/js/footer.js DELETED
@@ -1,3 +0,0 @@
1
- setTimeout(function(){
2
- aftership_woocommerce_tracking_onload();
3
- }, 2000);
 
 
 
trunk/assets/js/setting.js DELETED
@@ -1,72 +0,0 @@
1
- jQuery(function () {
2
- function set_aftership_tracking_provider(selected_couriers) {
3
- var couriers = sort_couriers(get_couriers());
4
-
5
- // console.log(couriers);
6
-
7
- jQuery.each(couriers, function (key, courier) {
8
- // console.log(courier.name);
9
- var str = '<option ';
10
- str += 'value="' + courier['slug'] + '" ';
11
- if (selected_couriers.hasOwnProperty(courier['slug'])) {
12
- str += 'selected="selected"';
13
- }
14
- str += '>' + courier['name'] + '</option>';
15
- jQuery('#couriers_select').append(str);
16
- });
17
-
18
- jQuery('#couriers_select').val(selected_couriers);
19
- jQuery('#couriers_select').chosen();
20
- jQuery('#couriers_select').trigger('chosen:updated');
21
- }
22
-
23
- function set_track_message_demo(){
24
- jQuery('#track_message_demo_1').html(
25
- jQuery('#track_message_1').val() + 'UPS' +
26
- '<br/>'+
27
- jQuery('#track_message_2').val() + '1Z0X118A0324011613'
28
- );
29
- }
30
-
31
- jQuery('#couriers_select').change(function () {
32
- var couriers_select = jQuery('#couriers_select').val();
33
- var value = (couriers_select) ? couriers_select.join(',') : '';
34
- jQuery('#couriers').val(value);
35
- });
36
-
37
- jQuery('#plugin').change(function () {
38
- if (jQuery(this).val() == 'aftership') {
39
- jQuery('#couriers').parent().parent().show();
40
- jQuery('#track_message_demo_1').parent().parent().show();
41
- } else {
42
- jQuery('#couriers').parent().parent().hide();
43
- jQuery('#track_message_demo_1').parent().parent().hide();
44
- }
45
- });
46
-
47
- if (jQuery('#couriers')) {
48
- var couriers_select = jQuery('#couriers').val();
49
- var couriers_select_array = (couriers_select) ? couriers_select.split(',') : [];
50
- set_aftership_tracking_provider(couriers_select_array);
51
-
52
- if (jQuery('#plugin').val() != 'aftership') {
53
- jQuery('#couriers').parent().parent().hide();
54
- }
55
- }
56
-
57
- if (jQuery('#track_message_demo_1')) {
58
- set_track_message_demo();
59
-
60
- if (jQuery('#plugin').val() != 'aftership') {
61
- jQuery('#track_message_demo_1').parent().parent().hide();
62
- }
63
- }
64
-
65
- jQuery('#track_message_1').keyup(function () {
66
- set_track_message_demo();
67
- });
68
-
69
- jQuery('#track_message_2').keyup(function () {
70
- set_track_message_demo();
71
- });
72
- });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/assets/js/util.js DELETED
@@ -1,18 +0,0 @@
1
- function sort_couriers(data){
2
- var n = data.length;
3
- for (var i = 0; i < n - 1; i++) {
4
- var find = false;
5
- for (var j = i+1; j < n; j++) {
6
- if (data[i].name.toLowerCase() > data[j].name.toLowerCase()) {
7
- var tmp = data[i];
8
- data[i] = data[j];
9
- data[j] = tmp;
10
- find = true;
11
- }
12
- }
13
- if (!find) {
14
- break;
15
- }
16
- }
17
- return data;
18
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/assets/plugin/chosen/chosen-sprite.png DELETED
Binary file
trunk/assets/plugin/chosen/chosen-sprite@2x.png DELETED
Binary file
trunk/assets/plugin/chosen/chosen.jquery.min.js DELETED
@@ -1,2 +0,0 @@
1
- /* Chosen v1.2.0 | (c) 2011-2014 by Harvest | MIT License, https://github.com/harvesthq/chosen/blob/master/LICENSE.md */
2
- !function(){var a,AbstractChosen,Chosen,SelectParser,b,c={}.hasOwnProperty,d=function(a,b){function d(){this.constructor=a}for(var e in b)c.call(b,e)&&(a[e]=b[e]);return d.prototype=b.prototype,a.prototype=new d,a.__super__=b.prototype,a};SelectParser=function(){function SelectParser(){this.options_index=0,this.parsed=[]}return SelectParser.prototype.add_node=function(a){return"OPTGROUP"===a.nodeName.toUpperCase()?this.add_group(a):this.add_option(a)},SelectParser.prototype.add_group=function(a){var b,c,d,e,f,g;for(b=this.parsed.length,this.parsed.push({array_index:b,group:!0,label:this.escapeExpression(a.label),children:0,disabled:a.disabled}),f=a.childNodes,g=[],d=0,e=f.length;e>d;d++)c=f[d],g.push(this.add_option(c,b,a.disabled));return g},SelectParser.prototype.add_option=function(a,b,c){return"OPTION"===a.nodeName.toUpperCase()?(""!==a.text?(null!=b&&(this.parsed[b].children+=1),this.parsed.push({array_index:this.parsed.length,options_index:this.options_index,value:a.value,text:a.text,html:a.innerHTML,selected:a.selected,disabled:c===!0?c:a.disabled,group_array_index:b,classes:a.className,style:a.style.cssText})):this.parsed.push({array_index:this.parsed.length,options_index:this.options_index,empty:!0}),this.options_index+=1):void 0},SelectParser.prototype.escapeExpression=function(a){var b,c;return null==a||a===!1?"":/[\&\<\>\"\'\`]/.test(a)?(b={"<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#x27;","`":"&#x60;"},c=/&(?!\w+;)|[\<\>\"\'\`]/g,a.replace(c,function(a){return b[a]||"&amp;"})):a},SelectParser}(),SelectParser.select_to_array=function(a){var b,c,d,e,f;for(c=new SelectParser,f=a.childNodes,d=0,e=f.length;e>d;d++)b=f[d],c.add_node(b);return c.parsed},AbstractChosen=function(){function AbstractChosen(a,b){this.form_field=a,this.options=null!=b?b:{},AbstractChosen.browser_is_supported()&&(this.is_multiple=this.form_field.multiple,this.set_default_text(),this.set_default_values(),this.setup(),this.set_up_html(),this.register_observers())}return AbstractChosen.prototype.set_default_values=function(){var a=this;return this.click_test_action=function(b){return a.test_active_click(b)},this.activate_action=function(b){return a.activate_field(b)},this.active_field=!1,this.mouse_on_container=!1,this.results_showing=!1,this.result_highlighted=null,this.allow_single_deselect=null!=this.options.allow_single_deselect&&null!=this.form_field.options[0]&&""===this.form_field.options[0].text?this.options.allow_single_deselect:!1,this.disable_search_threshold=this.options.disable_search_threshold||0,this.disable_search=this.options.disable_search||!1,this.enable_split_word_search=null!=this.options.enable_split_word_search?this.options.enable_split_word_search:!0,this.group_search=null!=this.options.group_search?this.options.group_search:!0,this.search_contains=this.options.search_contains||!1,this.single_backstroke_delete=null!=this.options.single_backstroke_delete?this.options.single_backstroke_delete:!0,this.max_selected_options=this.options.max_selected_options||1/0,this.inherit_select_classes=this.options.inherit_select_classes||!1,this.display_selected_options=null!=this.options.display_selected_options?this.options.display_selected_options:!0,this.display_disabled_options=null!=this.options.display_disabled_options?this.options.display_disabled_options:!0},AbstractChosen.prototype.set_default_text=function(){return this.default_text=this.form_field.getAttribute("data-placeholder")?this.form_field.getAttribute("data-placeholder"):this.is_multiple?this.options.placeholder_text_multiple||this.options.placeholder_text||AbstractChosen.default_multiple_text:this.options.placeholder_text_single||this.options.placeholder_text||AbstractChosen.default_single_text,this.results_none_found=this.form_field.getAttribute("data-no_results_text")||this.options.no_results_text||AbstractChosen.default_no_result_text},AbstractChosen.prototype.mouse_enter=function(){return this.mouse_on_container=!0},AbstractChosen.prototype.mouse_leave=function(){return this.mouse_on_container=!1},AbstractChosen.prototype.input_focus=function(){var a=this;if(this.is_multiple){if(!this.active_field)return setTimeout(function(){return a.container_mousedown()},50)}else if(!this.active_field)return this.activate_field()},AbstractChosen.prototype.input_blur=function(){var a=this;return this.mouse_on_container?void 0:(this.active_field=!1,setTimeout(function(){return a.blur_test()},100))},AbstractChosen.prototype.results_option_build=function(a){var b,c,d,e,f;for(b="",f=this.results_data,d=0,e=f.length;e>d;d++)c=f[d],b+=c.group?this.result_add_group(c):this.result_add_option(c),(null!=a?a.first:void 0)&&(c.selected&&this.is_multiple?this.choice_build(c):c.selected&&!this.is_multiple&&this.single_set_selected_text(c.text));return b},AbstractChosen.prototype.result_add_option=function(a){var b,c;return a.search_match?this.include_option_in_results(a)?(b=[],a.disabled||a.selected&&this.is_multiple||b.push("active-result"),!a.disabled||a.selected&&this.is_multiple||b.push("disabled-result"),a.selected&&b.push("result-selected"),null!=a.group_array_index&&b.push("group-option"),""!==a.classes&&b.push(a.classes),c=document.createElement("li"),c.className=b.join(" "),c.style.cssText=a.style,c.setAttribute("data-option-array-index",a.array_index),c.innerHTML=a.search_text,this.outerHTML(c)):"":""},AbstractChosen.prototype.result_add_group=function(a){var b;return a.search_match||a.group_match?a.active_options>0?(b=document.createElement("li"),b.className="group-result",b.innerHTML=a.search_text,this.outerHTML(b)):"":""},AbstractChosen.prototype.results_update_field=function(){return this.set_default_text(),this.is_multiple||this.results_reset_cleanup(),this.result_clear_highlight(),this.results_build(),this.results_showing?this.winnow_results():void 0},AbstractChosen.prototype.reset_single_select_options=function(){var a,b,c,d,e;for(d=this.results_data,e=[],b=0,c=d.length;c>b;b++)a=d[b],a.selected?e.push(a.selected=!1):e.push(void 0);return e},AbstractChosen.prototype.results_toggle=function(){return this.results_showing?this.results_hide():this.results_show()},AbstractChosen.prototype.results_search=function(){return this.results_showing?this.winnow_results():this.results_show()},AbstractChosen.prototype.winnow_results=function(){var a,b,c,d,e,f,g,h,i,j,k,l;for(this.no_results_clear(),d=0,f=this.get_search_text(),a=f.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),i=new RegExp(a,"i"),c=this.get_search_regex(a),l=this.results_data,j=0,k=l.length;k>j;j++)b=l[j],b.search_match=!1,e=null,this.include_option_in_results(b)&&(b.group&&(b.group_match=!1,b.active_options=0),null!=b.group_array_index&&this.results_data[b.group_array_index]&&(e=this.results_data[b.group_array_index],0===e.active_options&&e.search_match&&(d+=1),e.active_options+=1),(!b.group||this.group_search)&&(b.search_text=b.group?b.label:b.text,b.search_match=this.search_string_match(b.search_text,c),b.search_match&&!b.group&&(d+=1),b.search_match?(f.length&&(g=b.search_text.search(i),h=b.search_text.substr(0,g+f.length)+"</em>"+b.search_text.substr(g+f.length),b.search_text=h.substr(0,g)+"<em>"+h.substr(g)),null!=e&&(e.group_match=!0)):null!=b.group_array_index&&this.results_data[b.group_array_index].search_match&&(b.search_match=!0)));return this.result_clear_highlight(),1>d&&f.length?(this.update_results_content(""),this.no_results(f)):(this.update_results_content(this.results_option_build()),this.winnow_results_set_highlight())},AbstractChosen.prototype.get_search_regex=function(a){var b;return b=this.search_contains?"":"^",new RegExp(b+a,"i")},AbstractChosen.prototype.search_string_match=function(a,b){var c,d,e,f;if(b.test(a))return!0;if(this.enable_split_word_search&&(a.indexOf(" ")>=0||0===a.indexOf("["))&&(d=a.replace(/\[|\]/g,"").split(" "),d.length))for(e=0,f=d.length;f>e;e++)if(c=d[e],b.test(c))return!0},AbstractChosen.prototype.choices_count=function(){var a,b,c,d;if(null!=this.selected_option_count)return this.selected_option_count;for(this.selected_option_count=0,d=this.form_field.options,b=0,c=d.length;c>b;b++)a=d[b],a.selected&&(this.selected_option_count+=1);return this.selected_option_count},AbstractChosen.prototype.choices_click=function(a){return a.preventDefault(),this.results_showing||this.is_disabled?void 0:this.results_show()},AbstractChosen.prototype.keyup_checker=function(a){var b,c;switch(b=null!=(c=a.which)?c:a.keyCode,this.search_field_scale(),b){case 8:if(this.is_multiple&&this.backstroke_length<1&&this.choices_count()>0)return this.keydown_backstroke();if(!this.pending_backstroke)return this.result_clear_highlight(),this.results_search();break;case 13:if(a.preventDefault(),this.results_showing)return this.result_select(a);break;case 27:return this.results_showing&&this.results_hide(),!0;case 9:case 38:case 40:case 16:case 91:case 17:break;default:return this.results_search()}},AbstractChosen.prototype.clipboard_event_checker=function(){var a=this;return setTimeout(function(){return a.results_search()},50)},AbstractChosen.prototype.container_width=function(){return null!=this.options.width?this.options.width:""+this.form_field.offsetWidth+"px"},AbstractChosen.prototype.include_option_in_results=function(a){return this.is_multiple&&!this.display_selected_options&&a.selected?!1:!this.display_disabled_options&&a.disabled?!1:a.empty?!1:!0},AbstractChosen.prototype.search_results_touchstart=function(a){return this.touch_started=!0,this.search_results_mouseover(a)},AbstractChosen.prototype.search_results_touchmove=function(a){return this.touch_started=!1,this.search_results_mouseout(a)},AbstractChosen.prototype.search_results_touchend=function(a){return this.touch_started?this.search_results_mouseup(a):void 0},AbstractChosen.prototype.outerHTML=function(a){var b;return a.outerHTML?a.outerHTML:(b=document.createElement("div"),b.appendChild(a),b.innerHTML)},AbstractChosen.browser_is_supported=function(){return"Microsoft Internet Explorer"===window.navigator.appName?document.documentMode>=8:/iP(od|hone)/i.test(window.navigator.userAgent)?!1:/Android/i.test(window.navigator.userAgent)&&/Mobile/i.test(window.navigator.userAgent)?!1:!0},AbstractChosen.default_multiple_text="Select Some Options",AbstractChosen.default_single_text="Select an Option",AbstractChosen.default_no_result_text="No results match",AbstractChosen}(),a=jQuery,a.fn.extend({chosen:function(b){return AbstractChosen.browser_is_supported()?this.each(function(){var c,d;c=a(this),d=c.data("chosen"),"destroy"===b&&d instanceof Chosen?d.destroy():d instanceof Chosen||c.data("chosen",new Chosen(this,b))}):this}}),Chosen=function(c){function Chosen(){return b=Chosen.__super__.constructor.apply(this,arguments)}return d(Chosen,c),Chosen.prototype.setup=function(){return this.form_field_jq=a(this.form_field),this.current_selectedIndex=this.form_field.selectedIndex,this.is_rtl=this.form_field_jq.hasClass("chosen-rtl")},Chosen.prototype.set_up_html=function(){var b,c;return b=["chosen-container"],b.push("chosen-container-"+(this.is_multiple?"multi":"single")),this.inherit_select_classes&&this.form_field.className&&b.push(this.form_field.className),this.is_rtl&&b.push("chosen-rtl"),c={"class":b.join(" "),style:"width: "+this.container_width()+";",title:this.form_field.title},this.form_field.id.length&&(c.id=this.form_field.id.replace(/[^\w]/g,"_")+"_chosen"),this.container=a("<div />",c),this.is_multiple?this.container.html('<ul class="chosen-choices"><li class="search-field"><input type="text" value="'+this.default_text+'" class="default" autocomplete="off" style="width:25px;" /></li></ul><div class="chosen-drop"><ul class="chosen-results"></ul></div>'):this.container.html('<a class="chosen-single chosen-default" tabindex="-1"><span>'+this.default_text+'</span><div><b></b></div></a><div class="chosen-drop"><div class="chosen-search"><input type="text" autocomplete="off" /></div><ul class="chosen-results"></ul></div>'),this.form_field_jq.hide().after(this.container),this.dropdown=this.container.find("div.chosen-drop").first(),this.search_field=this.container.find("input").first(),this.search_results=this.container.find("ul.chosen-results").first(),this.search_field_scale(),this.search_no_results=this.container.find("li.no-results").first(),this.is_multiple?(this.search_choices=this.container.find("ul.chosen-choices").first(),this.search_container=this.container.find("li.search-field").first()):(this.search_container=this.container.find("div.chosen-search").first(),this.selected_item=this.container.find(".chosen-single").first()),this.results_build(),this.set_tab_index(),this.set_label_behavior(),this.form_field_jq.trigger("chosen:ready",{chosen:this})},Chosen.prototype.register_observers=function(){var a=this;return this.container.bind("touchstart.chosen",function(b){a.container_mousedown(b)}),this.container.bind("touchend.chosen",function(b){a.container_mouseup(b)}),this.container.bind("mousedown.chosen",function(b){a.container_mousedown(b)}),this.container.bind("mouseup.chosen",function(b){a.container_mouseup(b)}),this.container.bind("mouseenter.chosen",function(b){a.mouse_enter(b)}),this.container.bind("mouseleave.chosen",function(b){a.mouse_leave(b)}),this.search_results.bind("mouseup.chosen",function(b){a.search_results_mouseup(b)}),this.search_results.bind("mouseover.chosen",function(b){a.search_results_mouseover(b)}),this.search_results.bind("mouseout.chosen",function(b){a.search_results_mouseout(b)}),this.search_results.bind("mousewheel.chosen DOMMouseScroll.chosen",function(b){a.search_results_mousewheel(b)}),this.search_results.bind("touchstart.chosen",function(b){a.search_results_touchstart(b)}),this.search_results.bind("touchmove.chosen",function(b){a.search_results_touchmove(b)}),this.search_results.bind("touchend.chosen",function(b){a.search_results_touchend(b)}),this.form_field_jq.bind("chosen:updated.chosen",function(b){a.results_update_field(b)}),this.form_field_jq.bind("chosen:activate.chosen",function(b){a.activate_field(b)}),this.form_field_jq.bind("chosen:open.chosen",function(b){a.container_mousedown(b)}),this.form_field_jq.bind("chosen:close.chosen",function(b){a.input_blur(b)}),this.search_field.bind("blur.chosen",function(b){a.input_blur(b)}),this.search_field.bind("keyup.chosen",function(b){a.keyup_checker(b)}),this.search_field.bind("keydown.chosen",function(b){a.keydown_checker(b)}),this.search_field.bind("focus.chosen",function(b){a.input_focus(b)}),this.search_field.bind("cut.chosen",function(b){a.clipboard_event_checker(b)}),this.search_field.bind("paste.chosen",function(b){a.clipboard_event_checker(b)}),this.is_multiple?this.search_choices.bind("click.chosen",function(b){a.choices_click(b)}):this.container.bind("click.chosen",function(a){a.preventDefault()})},Chosen.prototype.destroy=function(){return a(this.container[0].ownerDocument).unbind("click.chosen",this.click_test_action),this.search_field[0].tabIndex&&(this.form_field_jq[0].tabIndex=this.search_field[0].tabIndex),this.container.remove(),this.form_field_jq.removeData("chosen"),this.form_field_jq.show()},Chosen.prototype.search_field_disabled=function(){return this.is_disabled=this.form_field_jq[0].disabled,this.is_disabled?(this.container.addClass("chosen-disabled"),this.search_field[0].disabled=!0,this.is_multiple||this.selected_item.unbind("focus.chosen",this.activate_action),this.close_field()):(this.container.removeClass("chosen-disabled"),this.search_field[0].disabled=!1,this.is_multiple?void 0:this.selected_item.bind("focus.chosen",this.activate_action))},Chosen.prototype.container_mousedown=function(b){return this.is_disabled||(b&&"mousedown"===b.type&&!this.results_showing&&b.preventDefault(),null!=b&&a(b.target).hasClass("search-choice-close"))?void 0:(this.active_field?this.is_multiple||!b||a(b.target)[0]!==this.selected_item[0]&&!a(b.target).parents("a.chosen-single").length||(b.preventDefault(),this.results_toggle()):(this.is_multiple&&this.search_field.val(""),a(this.container[0].ownerDocument).bind("click.chosen",this.click_test_action),this.results_show()),this.activate_field())},Chosen.prototype.container_mouseup=function(a){return"ABBR"!==a.target.nodeName||this.is_disabled?void 0:this.results_reset(a)},Chosen.prototype.search_results_mousewheel=function(a){var b;return a.originalEvent&&(b=a.originalEvent.deltaY||-a.originalEvent.wheelDelta||a.originalEvent.detail),null!=b?(a.preventDefault(),"DOMMouseScroll"===a.type&&(b=40*b),this.search_results.scrollTop(b+this.search_results.scrollTop())):void 0},Chosen.prototype.blur_test=function(){return!this.active_field&&this.container.hasClass("chosen-container-active")?this.close_field():void 0},Chosen.prototype.close_field=function(){return a(this.container[0].ownerDocument).unbind("click.chosen",this.click_test_action),this.active_field=!1,this.results_hide(),this.container.removeClass("chosen-container-active"),this.clear_backstroke(),this.show_search_field_default(),this.search_field_scale()},Chosen.prototype.activate_field=function(){return this.container.addClass("chosen-container-active"),this.active_field=!0,this.search_field.val(this.search_field.val()),this.search_field.focus()},Chosen.prototype.test_active_click=function(b){var c;return c=a(b.target).closest(".chosen-container"),c.length&&this.container[0]===c[0]?this.active_field=!0:this.close_field()},Chosen.prototype.results_build=function(){return this.parsing=!0,this.selected_option_count=null,this.results_data=SelectParser.select_to_array(this.form_field),this.is_multiple?this.search_choices.find("li.search-choice").remove():this.is_multiple||(this.single_set_selected_text(),this.disable_search||this.form_field.options.length<=this.disable_search_threshold?(this.search_field[0].readOnly=!0,this.container.addClass("chosen-container-single-nosearch")):(this.search_field[0].readOnly=!1,this.container.removeClass("chosen-container-single-nosearch"))),this.update_results_content(this.results_option_build({first:!0})),this.search_field_disabled(),this.show_search_field_default(),this.search_field_scale(),this.parsing=!1},Chosen.prototype.result_do_highlight=function(a){var b,c,d,e,f;if(a.length){if(this.result_clear_highlight(),this.result_highlight=a,this.result_highlight.addClass("highlighted"),d=parseInt(this.search_results.css("maxHeight"),10),f=this.search_results.scrollTop(),e=d+f,c=this.result_highlight.position().top+this.search_results.scrollTop(),b=c+this.result_highlight.outerHeight(),b>=e)return this.search_results.scrollTop(b-d>0?b-d:0);if(f>c)return this.search_results.scrollTop(c)}},Chosen.prototype.result_clear_highlight=function(){return this.result_highlight&&this.result_highlight.removeClass("highlighted"),this.result_highlight=null},Chosen.prototype.results_show=function(){return this.is_multiple&&this.max_selected_options<=this.choices_count()?(this.form_field_jq.trigger("chosen:maxselected",{chosen:this}),!1):(this.container.addClass("chosen-with-drop"),this.results_showing=!0,this.search_field.focus(),this.search_field.val(this.search_field.val()),this.winnow_results(),this.form_field_jq.trigger("chosen:showing_dropdown",{chosen:this}))},Chosen.prototype.update_results_content=function(a){return this.search_results.html(a)},Chosen.prototype.results_hide=function(){return this.results_showing&&(this.result_clear_highlight(),this.container.removeClass("chosen-with-drop"),this.form_field_jq.trigger("chosen:hiding_dropdown",{chosen:this})),this.results_showing=!1},Chosen.prototype.set_tab_index=function(){var a;return this.form_field.tabIndex?(a=this.form_field.tabIndex,this.form_field.tabIndex=-1,this.search_field[0].tabIndex=a):void 0},Chosen.prototype.set_label_behavior=function(){var b=this;return this.form_field_label=this.form_field_jq.parents("label"),!this.form_field_label.length&&this.form_field.id.length&&(this.form_field_label=a("label[for='"+this.form_field.id+"']")),this.form_field_label.length>0?this.form_field_label.bind("click.chosen",function(a){return b.is_multiple?b.container_mousedown(a):b.activate_field()}):void 0},Chosen.prototype.show_search_field_default=function(){return this.is_multiple&&this.choices_count()<1&&!this.active_field?(this.search_field.val(this.default_text),this.search_field.addClass("default")):(this.search_field.val(""),this.search_field.removeClass("default"))},Chosen.prototype.search_results_mouseup=function(b){var c;return c=a(b.target).hasClass("active-result")?a(b.target):a(b.target).parents(".active-result").first(),c.length?(this.result_highlight=c,this.result_select(b),this.search_field.focus()):void 0},Chosen.prototype.search_results_mouseover=function(b){var c;return c=a(b.target).hasClass("active-result")?a(b.target):a(b.target).parents(".active-result").first(),c?this.result_do_highlight(c):void 0},Chosen.prototype.search_results_mouseout=function(b){return a(b.target).hasClass("active-result")?this.result_clear_highlight():void 0},Chosen.prototype.choice_build=function(b){var c,d,e=this;return c=a("<li />",{"class":"search-choice"}).html("<span>"+b.html+"</span>"),b.disabled?c.addClass("search-choice-disabled"):(d=a("<a />",{"class":"search-choice-close","data-option-array-index":b.array_index}),d.bind("click.chosen",function(a){return e.choice_destroy_link_click(a)}),c.append(d)),this.search_container.before(c)},Chosen.prototype.choice_destroy_link_click=function(b){return b.preventDefault(),b.stopPropagation(),this.is_disabled?void 0:this.choice_destroy(a(b.target))},Chosen.prototype.choice_destroy=function(a){return this.result_deselect(a[0].getAttribute("data-option-array-index"))?(this.show_search_field_default(),this.is_multiple&&this.choices_count()>0&&this.search_field.val().length<1&&this.results_hide(),a.parents("li").first().remove(),this.search_field_scale()):void 0},Chosen.prototype.results_reset=function(){return this.reset_single_select_options(),this.form_field.options[0].selected=!0,this.single_set_selected_text(),this.show_search_field_default(),this.results_reset_cleanup(),this.form_field_jq.trigger("change"),this.active_field?this.results_hide():void 0},Chosen.prototype.results_reset_cleanup=function(){return this.current_selectedIndex=this.form_field.selectedIndex,this.selected_item.find("abbr").remove()},Chosen.prototype.result_select=function(a){var b,c;return this.result_highlight?(b=this.result_highlight,this.result_clear_highlight(),this.is_multiple&&this.max_selected_options<=this.choices_count()?(this.form_field_jq.trigger("chosen:maxselected",{chosen:this}),!1):(this.is_multiple?b.removeClass("active-result"):this.reset_single_select_options(),c=this.results_data[b[0].getAttribute("data-option-array-index")],c.selected=!0,this.form_field.options[c.options_index].selected=!0,this.selected_option_count=null,this.is_multiple?this.choice_build(c):this.single_set_selected_text(c.text),(a.metaKey||a.ctrlKey)&&this.is_multiple||this.results_hide(),this.search_field.val(""),(this.is_multiple||this.form_field.selectedIndex!==this.current_selectedIndex)&&this.form_field_jq.trigger("change",{selected:this.form_field.options[c.options_index].value}),this.current_selectedIndex=this.form_field.selectedIndex,this.search_field_scale())):void 0},Chosen.prototype.single_set_selected_text=function(a){return null==a&&(a=this.default_text),a===this.default_text?this.selected_item.addClass("chosen-default"):(this.single_deselect_control_build(),this.selected_item.removeClass("chosen-default")),this.selected_item.find("span").text(a)},Chosen.prototype.result_deselect=function(a){var b;return b=this.results_data[a],this.form_field.options[b.options_index].disabled?!1:(b.selected=!1,this.form_field.options[b.options_index].selected=!1,this.selected_option_count=null,this.result_clear_highlight(),this.results_showing&&this.winnow_results(),this.form_field_jq.trigger("change",{deselected:this.form_field.options[b.options_index].value}),this.search_field_scale(),!0)},Chosen.prototype.single_deselect_control_build=function(){return this.allow_single_deselect?(this.selected_item.find("abbr").length||this.selected_item.find("span").first().after('<abbr class="search-choice-close"></abbr>'),this.selected_item.addClass("chosen-single-with-deselect")):void 0},Chosen.prototype.get_search_text=function(){return this.search_field.val()===this.default_text?"":a("<div/>").text(a.trim(this.search_field.val())).html()},Chosen.prototype.winnow_results_set_highlight=function(){var a,b;return b=this.is_multiple?[]:this.search_results.find(".result-selected.active-result"),a=b.length?b.first():this.search_results.find(".active-result").first(),null!=a?this.result_do_highlight(a):void 0},Chosen.prototype.no_results=function(b){var c;return c=a('<li class="no-results">'+this.results_none_found+' "<span></span>"</li>'),c.find("span").first().html(b),this.search_results.append(c),this.form_field_jq.trigger("chosen:no_results",{chosen:this})},Chosen.prototype.no_results_clear=function(){return this.search_results.find(".no-results").remove()},Chosen.prototype.keydown_arrow=function(){var a;return this.results_showing&&this.result_highlight?(a=this.result_highlight.nextAll("li.active-result").first())?this.result_do_highlight(a):void 0:this.results_show()},Chosen.prototype.keyup_arrow=function(){var a;return this.results_showing||this.is_multiple?this.result_highlight?(a=this.result_highlight.prevAll("li.active-result"),a.length?this.result_do_highlight(a.first()):(this.choices_count()>0&&this.results_hide(),this.result_clear_highlight())):void 0:this.results_show()},Chosen.prototype.keydown_backstroke=function(){var a;return this.pending_backstroke?(this.choice_destroy(this.pending_backstroke.find("a").first()),this.clear_backstroke()):(a=this.search_container.siblings("li.search-choice").last(),a.length&&!a.hasClass("search-choice-disabled")?(this.pending_backstroke=a,this.single_backstroke_delete?this.keydown_backstroke():this.pending_backstroke.addClass("search-choice-focus")):void 0)},Chosen.prototype.clear_backstroke=function(){return this.pending_backstroke&&this.pending_backstroke.removeClass("search-choice-focus"),this.pending_backstroke=null},Chosen.prototype.keydown_checker=function(a){var b,c;switch(b=null!=(c=a.which)?c:a.keyCode,this.search_field_scale(),8!==b&&this.pending_backstroke&&this.clear_backstroke(),b){case 8:this.backstroke_length=this.search_field.val().length;break;case 9:this.results_showing&&!this.is_multiple&&this.result_select(a),this.mouse_on_container=!1;break;case 13:this.results_showing&&a.preventDefault();break;case 32:this.disable_search&&a.preventDefault();break;case 38:a.preventDefault(),this.keyup_arrow();break;case 40:a.preventDefault(),this.keydown_arrow()}},Chosen.prototype.search_field_scale=function(){var b,c,d,e,f,g,h,i,j;if(this.is_multiple){for(d=0,h=0,f="position:absolute; left: -1000px; top: -1000px; display:none;",g=["font-size","font-style","font-weight","font-family","line-height","text-transform","letter-spacing"],i=0,j=g.length;j>i;i++)e=g[i],f+=e+":"+this.search_field.css(e)+";";return b=a("<div />",{style:f}),b.text(this.search_field.val()),a("body").append(b),h=b.width()+25,b.remove(),c=this.container.outerWidth(),h>c-10&&(h=c-10),this.search_field.css({width:h+"px"})}},Chosen}(AbstractChosen)}.call(this);
 
 
trunk/assets/plugin/chosen/chosen.min.css DELETED
@@ -1,3 +0,0 @@
1
- /* Chosen v1.2.0 | (c) 2011-2014 by Harvest | MIT License, https://github.com/harvesthq/chosen/blob/master/LICENSE.md */
2
-
3
- .chosen-container{position:relative;display:inline-block;vertical-align:middle;font-size:13px;zoom:1;*display:inline;-webkit-user-select:none;-moz-user-select:none;user-select:none}.chosen-container *{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}.chosen-container .chosen-drop{position:absolute;top:100%;left:-9999px;z-index:1010;width:100%;border:1px solid #aaa;border-top:0;background:#fff;box-shadow:0 4px 5px rgba(0,0,0,.15)}.chosen-container.chosen-with-drop .chosen-drop{left:0}.chosen-container a{cursor:pointer}.chosen-container-single .chosen-single{position:relative;display:block;overflow:hidden;padding:0 0 0 8px;height:25px;border:1px solid #aaa;border-radius:5px;background-color:#fff;background:-webkit-gradient(linear,50% 0,50% 100%,color-stop(20%,#fff),color-stop(50%,#f6f6f6),color-stop(52%,#eee),color-stop(100%,#f4f4f4));background:-webkit-linear-gradient(top,#fff 20%,#f6f6f6 50%,#eee 52%,#f4f4f4 100%);background:-moz-linear-gradient(top,#fff 20%,#f6f6f6 50%,#eee 52%,#f4f4f4 100%);background:-o-linear-gradient(top,#fff 20%,#f6f6f6 50%,#eee 52%,#f4f4f4 100%);background:linear-gradient(top,#fff 20%,#f6f6f6 50%,#eee 52%,#f4f4f4 100%);background-clip:padding-box;box-shadow:0 0 3px #fff inset,0 1px 1px rgba(0,0,0,.1);color:#444;text-decoration:none;white-space:nowrap;line-height:24px}.chosen-container-single .chosen-default{color:#999}.chosen-container-single .chosen-single span{display:block;overflow:hidden;margin-right:26px;text-overflow:ellipsis;white-space:nowrap}.chosen-container-single .chosen-single-with-deselect span{margin-right:38px}.chosen-container-single .chosen-single abbr{position:absolute;top:6px;right:26px;display:block;width:12px;height:12px;background:url(chosen-sprite.png) -42px 1px no-repeat;font-size:1px}.chosen-container-single .chosen-single abbr:hover{background-position:-42px -10px}.chosen-container-single.chosen-disabled .chosen-single abbr:hover{background-position:-42px -10px}.chosen-container-single .chosen-single div{position:absolute;top:0;right:0;display:block;width:18px;height:100%}.chosen-container-single .chosen-single div b{display:block;width:100%;height:100%;background:url(chosen-sprite.png) no-repeat 0 2px}.chosen-container-single .chosen-search{position:relative;z-index:1010;margin:0;padding:3px 4px;white-space:nowrap}.chosen-container-single .chosen-search input[type=text]{margin:1px 0;padding:4px 20px 4px 5px;width:100%;height:auto;outline:0;border:1px solid #aaa;background:#fff url(chosen-sprite.png) no-repeat 100% -20px;background:url(chosen-sprite.png) no-repeat 100% -20px;font-size:1em;font-family:sans-serif;line-height:normal;border-radius:0}.chosen-container-single .chosen-drop{margin-top:-1px;border-radius:0 0 4px 4px;background-clip:padding-box}.chosen-container-single.chosen-container-single-nosearch .chosen-search{position:absolute;left:-9999px}.chosen-container .chosen-results{color:#444;position:relative;overflow-x:hidden;overflow-y:auto;margin:0 4px 4px 0;padding:0 0 0 4px;max-height:240px;-webkit-overflow-scrolling:touch}.chosen-container .chosen-results li{display:none;margin:0;padding:5px 6px;list-style:none;line-height:15px;word-wrap:break-word;-webkit-touch-callout:none}.chosen-container .chosen-results li.active-result{display:list-item;cursor:pointer}.chosen-container .chosen-results li.disabled-result{display:list-item;color:#ccc;cursor:default}.chosen-container .chosen-results li.highlighted{background-color:#3875d7;background-image:-webkit-gradient(linear,50% 0,50% 100%,color-stop(20%,#3875d7),color-stop(90%,#2a62bc));background-image:-webkit-linear-gradient(#3875d7 20%,#2a62bc 90%);background-image:-moz-linear-gradient(#3875d7 20%,#2a62bc 90%);background-image:-o-linear-gradient(#3875d7 20%,#2a62bc 90%);background-image:linear-gradient(#3875d7 20%,#2a62bc 90%);color:#fff}.chosen-container .chosen-results li.no-results{color:#777;display:list-item;background:#f4f4f4}.chosen-container .chosen-results li.group-result{display:list-item;font-weight:700;cursor:default}.chosen-container .chosen-results li.group-option{padding-left:15px}.chosen-container .chosen-results li em{font-style:normal;text-decoration:underline}.chosen-container-multi .chosen-choices{position:relative;overflow:hidden;margin:0;padding:0 5px;width:100%;height:auto!important;height:1%;border:1px solid #aaa;background-color:#fff;background-image:-webkit-gradient(linear,50% 0,50% 100%,color-stop(1%,#eee),color-stop(15%,#fff));background-image:-webkit-linear-gradient(#eee 1%,#fff 15%);background-image:-moz-linear-gradient(#eee 1%,#fff 15%);background-image:-o-linear-gradient(#eee 1%,#fff 15%);background-image:linear-gradient(#eee 1%,#fff 15%);cursor:text}.chosen-container-multi .chosen-choices li{float:left;list-style:none}.chosen-container-multi .chosen-choices li.search-field{margin:0;padding:0;white-space:nowrap}.chosen-container-multi .chosen-choices li.search-field input[type=text]{margin:1px 0;padding:0;height:25px;outline:0;border:0!important;background:transparent!important;box-shadow:none;color:#999;font-size:100%;font-family:sans-serif;line-height:normal;border-radius:0}.chosen-container-multi .chosen-choices li.search-choice{position:relative;margin:3px 5px 3px 0;padding:3px 20px 3px 5px;border:1px solid #aaa;max-width:100%;border-radius:3px;background-color:#eee;background-image:-webkit-gradient(linear,50% 0,50% 100%,color-stop(20%,#f4f4f4),color-stop(50%,#f0f0f0),color-stop(52%,#e8e8e8),color-stop(100%,#eee));background-image:-webkit-linear-gradient(#f4f4f4 20%,#f0f0f0 50%,#e8e8e8 52%,#eee 100%);background-image:-moz-linear-gradient(#f4f4f4 20%,#f0f0f0 50%,#e8e8e8 52%,#eee 100%);background-image:-o-linear-gradient(#f4f4f4 20%,#f0f0f0 50%,#e8e8e8 52%,#eee 100%);background-image:linear-gradient(#f4f4f4 20%,#f0f0f0 50%,#e8e8e8 52%,#eee 100%);background-size:100% 19px;background-repeat:repeat-x;background-clip:padding-box;box-shadow:0 0 2px #fff inset,0 1px 0 rgba(0,0,0,.05);color:#333;line-height:13px;cursor:default}.chosen-container-multi .chosen-choices li.search-choice span{word-wrap:break-word}.chosen-container-multi .chosen-choices li.search-choice .search-choice-close{position:absolute;top:4px;right:3px;display:block;width:12px;height:12px;background:url(chosen-sprite.png) -42px 1px no-repeat;font-size:1px}.chosen-container-multi .chosen-choices li.search-choice .search-choice-close:hover{background-position:-42px -10px}.chosen-container-multi .chosen-choices li.search-choice-disabled{padding-right:5px;border:1px solid #ccc;background-color:#e4e4e4;background-image:-webkit-gradient(linear,50% 0,50% 100%,color-stop(20%,#f4f4f4),color-stop(50%,#f0f0f0),color-stop(52%,#e8e8e8),color-stop(100%,#eee));background-image:-webkit-linear-gradient(top,#f4f4f4 20%,#f0f0f0 50%,#e8e8e8 52%,#eee 100%);background-image:-moz-linear-gradient(top,#f4f4f4 20%,#f0f0f0 50%,#e8e8e8 52%,#eee 100%);background-image:-o-linear-gradient(top,#f4f4f4 20%,#f0f0f0 50%,#e8e8e8 52%,#eee 100%);background-image:linear-gradient(top,#f4f4f4 20%,#f0f0f0 50%,#e8e8e8 52%,#eee 100%);color:#666}.chosen-container-multi .chosen-choices li.search-choice-focus{background:#d4d4d4}.chosen-container-multi .chosen-choices li.search-choice-focus .search-choice-close{background-position:-42px -10px}.chosen-container-multi .chosen-results{margin:0;padding:0}.chosen-container-multi .chosen-drop .result-selected{display:list-item;color:#ccc;cursor:default}.chosen-container-active .chosen-single{border:1px solid #5897fb;box-shadow:0 0 5px rgba(0,0,0,.3)}.chosen-container-active.chosen-with-drop .chosen-single{border:1px solid #aaa;-moz-border-radius-bottomright:0;border-bottom-right-radius:0;-moz-border-radius-bottomleft:0;border-bottom-left-radius:0;background-image:-webkit-gradient(linear,50% 0,50% 100%,color-stop(20%,#eee),color-stop(80%,#fff));background-image:-webkit-linear-gradient(#eee 20%,#fff 80%);background-image:-moz-linear-gradient(#eee 20%,#fff 80%);background-image:-o-linear-gradient(#eee 20%,#fff 80%);background-image:linear-gradient(#eee 20%,#fff 80%);box-shadow:0 1px 0 #fff inset}.chosen-container-active.chosen-with-drop .chosen-single div{border-left:0;background:transparent}.chosen-container-active.chosen-with-drop .chosen-single div b{background-position:-18px 2px}.chosen-container-active .chosen-choices{border:1px solid #5897fb;box-shadow:0 0 5px rgba(0,0,0,.3)}.chosen-container-active .chosen-choices li.search-field input[type=text]{color:#222!important}.chosen-disabled{opacity:.5!important;cursor:default}.chosen-disabled .chosen-single{cursor:default}.chosen-disabled .chosen-choices .search-choice .search-choice-close{cursor:default}.chosen-rtl{text-align:right}.chosen-rtl .chosen-single{overflow:visible;padding:0 8px 0 0}.chosen-rtl .chosen-single span{margin-right:0;margin-left:26px;direction:rtl}.chosen-rtl .chosen-single-with-deselect span{margin-left:38px}.chosen-rtl .chosen-single div{right:auto;left:3px}.chosen-rtl .chosen-single abbr{right:auto;left:26px}.chosen-rtl .chosen-choices li{float:right}.chosen-rtl .chosen-choices li.search-field input[type=text]{direction:rtl}.chosen-rtl .chosen-choices li.search-choice{margin:3px 5px 3px 0;padding:3px 5px 3px 19px}.chosen-rtl .chosen-choices li.search-choice .search-choice-close{right:auto;left:4px}.chosen-rtl.chosen-container-single-nosearch .chosen-search,.chosen-rtl .chosen-drop{left:9999px}.chosen-rtl.chosen-container-single .chosen-results{margin:0 0 4px 4px;padding:0 4px 0 0}.chosen-rtl .chosen-results li.group-option{padding-right:15px;padding-left:0}.chosen-rtl.chosen-container-active.chosen-with-drop .chosen-single div{border-right:0}.chosen-rtl .chosen-search input[type=text]{padding:4px 5px 4px 20px;background:#fff url(chosen-sprite.png) no-repeat -30px -20px;background:url(chosen-sprite.png) no-repeat -30px -20px;direction:rtl}.chosen-rtl.chosen-container-single .chosen-single div b{background-position:6px 2px}.chosen-rtl.chosen-container-single.chosen-with-drop .chosen-single div b{background-position:-12px 2px}@media only screen and (-webkit-min-device-pixel-ratio:2),only screen and (min-resolution:144dpi){.chosen-rtl .chosen-search input[type=text],.chosen-container-single .chosen-single abbr,.chosen-container-single .chosen-single div b,.chosen-container-single .chosen-search input[type=text],.chosen-container-multi .chosen-choices .search-choice .search-choice-close,.chosen-container .chosen-results-scroll-down span,.chosen-container .chosen-results-scroll-up span{background-image:url(chosen-sprite@2x.png)!important;background-size:52px 37px!important;background-repeat:no-repeat!important}}
 
 
 
trunk/assets/plugin/chosen/chosen.proto.min.js DELETED
@@ -1,2 +0,0 @@
1
- /* Chosen v1.2.0 | (c) 2011-2014 by Harvest | MIT License, https://github.com/harvesthq/chosen/blob/master/LICENSE.md */
2
- !function(){var AbstractChosen,SelectParser,a,b={}.hasOwnProperty,c=function(a,c){function d(){this.constructor=a}for(var e in c)b.call(c,e)&&(a[e]=c[e]);return d.prototype=c.prototype,a.prototype=new d,a.__super__=c.prototype,a};SelectParser=function(){function SelectParser(){this.options_index=0,this.parsed=[]}return SelectParser.prototype.add_node=function(a){return"OPTGROUP"===a.nodeName.toUpperCase()?this.add_group(a):this.add_option(a)},SelectParser.prototype.add_group=function(a){var b,c,d,e,f,g;for(b=this.parsed.length,this.parsed.push({array_index:b,group:!0,label:this.escapeExpression(a.label),children:0,disabled:a.disabled}),f=a.childNodes,g=[],d=0,e=f.length;e>d;d++)c=f[d],g.push(this.add_option(c,b,a.disabled));return g},SelectParser.prototype.add_option=function(a,b,c){return"OPTION"===a.nodeName.toUpperCase()?(""!==a.text?(null!=b&&(this.parsed[b].children+=1),this.parsed.push({array_index:this.parsed.length,options_index:this.options_index,value:a.value,text:a.text,html:a.innerHTML,selected:a.selected,disabled:c===!0?c:a.disabled,group_array_index:b,classes:a.className,style:a.style.cssText})):this.parsed.push({array_index:this.parsed.length,options_index:this.options_index,empty:!0}),this.options_index+=1):void 0},SelectParser.prototype.escapeExpression=function(a){var b,c;return null==a||a===!1?"":/[\&\<\>\"\'\`]/.test(a)?(b={"<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#x27;","`":"&#x60;"},c=/&(?!\w+;)|[\<\>\"\'\`]/g,a.replace(c,function(a){return b[a]||"&amp;"})):a},SelectParser}(),SelectParser.select_to_array=function(a){var b,c,d,e,f;for(c=new SelectParser,f=a.childNodes,d=0,e=f.length;e>d;d++)b=f[d],c.add_node(b);return c.parsed},AbstractChosen=function(){function AbstractChosen(a,b){this.form_field=a,this.options=null!=b?b:{},AbstractChosen.browser_is_supported()&&(this.is_multiple=this.form_field.multiple,this.set_default_text(),this.set_default_values(),this.setup(),this.set_up_html(),this.register_observers())}return AbstractChosen.prototype.set_default_values=function(){var a=this;return this.click_test_action=function(b){return a.test_active_click(b)},this.activate_action=function(b){return a.activate_field(b)},this.active_field=!1,this.mouse_on_container=!1,this.results_showing=!1,this.result_highlighted=null,this.allow_single_deselect=null!=this.options.allow_single_deselect&&null!=this.form_field.options[0]&&""===this.form_field.options[0].text?this.options.allow_single_deselect:!1,this.disable_search_threshold=this.options.disable_search_threshold||0,this.disable_search=this.options.disable_search||!1,this.enable_split_word_search=null!=this.options.enable_split_word_search?this.options.enable_split_word_search:!0,this.group_search=null!=this.options.group_search?this.options.group_search:!0,this.search_contains=this.options.search_contains||!1,this.single_backstroke_delete=null!=this.options.single_backstroke_delete?this.options.single_backstroke_delete:!0,this.max_selected_options=this.options.max_selected_options||1/0,this.inherit_select_classes=this.options.inherit_select_classes||!1,this.display_selected_options=null!=this.options.display_selected_options?this.options.display_selected_options:!0,this.display_disabled_options=null!=this.options.display_disabled_options?this.options.display_disabled_options:!0},AbstractChosen.prototype.set_default_text=function(){return this.default_text=this.form_field.getAttribute("data-placeholder")?this.form_field.getAttribute("data-placeholder"):this.is_multiple?this.options.placeholder_text_multiple||this.options.placeholder_text||AbstractChosen.default_multiple_text:this.options.placeholder_text_single||this.options.placeholder_text||AbstractChosen.default_single_text,this.results_none_found=this.form_field.getAttribute("data-no_results_text")||this.options.no_results_text||AbstractChosen.default_no_result_text},AbstractChosen.prototype.mouse_enter=function(){return this.mouse_on_container=!0},AbstractChosen.prototype.mouse_leave=function(){return this.mouse_on_container=!1},AbstractChosen.prototype.input_focus=function(){var a=this;if(this.is_multiple){if(!this.active_field)return setTimeout(function(){return a.container_mousedown()},50)}else if(!this.active_field)return this.activate_field()},AbstractChosen.prototype.input_blur=function(){var a=this;return this.mouse_on_container?void 0:(this.active_field=!1,setTimeout(function(){return a.blur_test()},100))},AbstractChosen.prototype.results_option_build=function(a){var b,c,d,e,f;for(b="",f=this.results_data,d=0,e=f.length;e>d;d++)c=f[d],b+=c.group?this.result_add_group(c):this.result_add_option(c),(null!=a?a.first:void 0)&&(c.selected&&this.is_multiple?this.choice_build(c):c.selected&&!this.is_multiple&&this.single_set_selected_text(c.text));return b},AbstractChosen.prototype.result_add_option=function(a){var b,c;return a.search_match?this.include_option_in_results(a)?(b=[],a.disabled||a.selected&&this.is_multiple||b.push("active-result"),!a.disabled||a.selected&&this.is_multiple||b.push("disabled-result"),a.selected&&b.push("result-selected"),null!=a.group_array_index&&b.push("group-option"),""!==a.classes&&b.push(a.classes),c=document.createElement("li"),c.className=b.join(" "),c.style.cssText=a.style,c.setAttribute("data-option-array-index",a.array_index),c.innerHTML=a.search_text,this.outerHTML(c)):"":""},AbstractChosen.prototype.result_add_group=function(a){var b;return a.search_match||a.group_match?a.active_options>0?(b=document.createElement("li"),b.className="group-result",b.innerHTML=a.search_text,this.outerHTML(b)):"":""},AbstractChosen.prototype.results_update_field=function(){return this.set_default_text(),this.is_multiple||this.results_reset_cleanup(),this.result_clear_highlight(),this.results_build(),this.results_showing?this.winnow_results():void 0},AbstractChosen.prototype.reset_single_select_options=function(){var a,b,c,d,e;for(d=this.results_data,e=[],b=0,c=d.length;c>b;b++)a=d[b],a.selected?e.push(a.selected=!1):e.push(void 0);return e},AbstractChosen.prototype.results_toggle=function(){return this.results_showing?this.results_hide():this.results_show()},AbstractChosen.prototype.results_search=function(){return this.results_showing?this.winnow_results():this.results_show()},AbstractChosen.prototype.winnow_results=function(){var a,b,c,d,e,f,g,h,i,j,k,l;for(this.no_results_clear(),d=0,f=this.get_search_text(),a=f.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),i=new RegExp(a,"i"),c=this.get_search_regex(a),l=this.results_data,j=0,k=l.length;k>j;j++)b=l[j],b.search_match=!1,e=null,this.include_option_in_results(b)&&(b.group&&(b.group_match=!1,b.active_options=0),null!=b.group_array_index&&this.results_data[b.group_array_index]&&(e=this.results_data[b.group_array_index],0===e.active_options&&e.search_match&&(d+=1),e.active_options+=1),(!b.group||this.group_search)&&(b.search_text=b.group?b.label:b.text,b.search_match=this.search_string_match(b.search_text,c),b.search_match&&!b.group&&(d+=1),b.search_match?(f.length&&(g=b.search_text.search(i),h=b.search_text.substr(0,g+f.length)+"</em>"+b.search_text.substr(g+f.length),b.search_text=h.substr(0,g)+"<em>"+h.substr(g)),null!=e&&(e.group_match=!0)):null!=b.group_array_index&&this.results_data[b.group_array_index].search_match&&(b.search_match=!0)));return this.result_clear_highlight(),1>d&&f.length?(this.update_results_content(""),this.no_results(f)):(this.update_results_content(this.results_option_build()),this.winnow_results_set_highlight())},AbstractChosen.prototype.get_search_regex=function(a){var b;return b=this.search_contains?"":"^",new RegExp(b+a,"i")},AbstractChosen.prototype.search_string_match=function(a,b){var c,d,e,f;if(b.test(a))return!0;if(this.enable_split_word_search&&(a.indexOf(" ")>=0||0===a.indexOf("["))&&(d=a.replace(/\[|\]/g,"").split(" "),d.length))for(e=0,f=d.length;f>e;e++)if(c=d[e],b.test(c))return!0},AbstractChosen.prototype.choices_count=function(){var a,b,c,d;if(null!=this.selected_option_count)return this.selected_option_count;for(this.selected_option_count=0,d=this.form_field.options,b=0,c=d.length;c>b;b++)a=d[b],a.selected&&(this.selected_option_count+=1);return this.selected_option_count},AbstractChosen.prototype.choices_click=function(a){return a.preventDefault(),this.results_showing||this.is_disabled?void 0:this.results_show()},AbstractChosen.prototype.keyup_checker=function(a){var b,c;switch(b=null!=(c=a.which)?c:a.keyCode,this.search_field_scale(),b){case 8:if(this.is_multiple&&this.backstroke_length<1&&this.choices_count()>0)return this.keydown_backstroke();if(!this.pending_backstroke)return this.result_clear_highlight(),this.results_search();break;case 13:if(a.preventDefault(),this.results_showing)return this.result_select(a);break;case 27:return this.results_showing&&this.results_hide(),!0;case 9:case 38:case 40:case 16:case 91:case 17:break;default:return this.results_search()}},AbstractChosen.prototype.clipboard_event_checker=function(){var a=this;return setTimeout(function(){return a.results_search()},50)},AbstractChosen.prototype.container_width=function(){return null!=this.options.width?this.options.width:""+this.form_field.offsetWidth+"px"},AbstractChosen.prototype.include_option_in_results=function(a){return this.is_multiple&&!this.display_selected_options&&a.selected?!1:!this.display_disabled_options&&a.disabled?!1:a.empty?!1:!0},AbstractChosen.prototype.search_results_touchstart=function(a){return this.touch_started=!0,this.search_results_mouseover(a)},AbstractChosen.prototype.search_results_touchmove=function(a){return this.touch_started=!1,this.search_results_mouseout(a)},AbstractChosen.prototype.search_results_touchend=function(a){return this.touch_started?this.search_results_mouseup(a):void 0},AbstractChosen.prototype.outerHTML=function(a){var b;return a.outerHTML?a.outerHTML:(b=document.createElement("div"),b.appendChild(a),b.innerHTML)},AbstractChosen.browser_is_supported=function(){return"Microsoft Internet Explorer"===window.navigator.appName?document.documentMode>=8:/iP(od|hone)/i.test(window.navigator.userAgent)?!1:/Android/i.test(window.navigator.userAgent)&&/Mobile/i.test(window.navigator.userAgent)?!1:!0},AbstractChosen.default_multiple_text="Select Some Options",AbstractChosen.default_single_text="Select an Option",AbstractChosen.default_no_result_text="No results match",AbstractChosen}(),this.Chosen=function(b){function Chosen(){return a=Chosen.__super__.constructor.apply(this,arguments)}return c(Chosen,b),Chosen.prototype.setup=function(){return this.current_selectedIndex=this.form_field.selectedIndex,this.is_rtl=this.form_field.hasClassName("chosen-rtl")},Chosen.prototype.set_default_values=function(){return Chosen.__super__.set_default_values.call(this),this.single_temp=new Template('<a class="chosen-single chosen-default" tabindex="-1"><span>#{default}</span><div><b></b></div></a><div class="chosen-drop"><div class="chosen-search"><input type="text" autocomplete="off" /></div><ul class="chosen-results"></ul></div>'),this.multi_temp=new Template('<ul class="chosen-choices"><li class="search-field"><input type="text" value="#{default}" class="default" autocomplete="off" style="width:25px;" /></li></ul><div class="chosen-drop"><ul class="chosen-results"></ul></div>'),this.no_results_temp=new Template('<li class="no-results">'+this.results_none_found+' "<span>#{terms}</span>"</li>')},Chosen.prototype.set_up_html=function(){var a,b;return a=["chosen-container"],a.push("chosen-container-"+(this.is_multiple?"multi":"single")),this.inherit_select_classes&&this.form_field.className&&a.push(this.form_field.className),this.is_rtl&&a.push("chosen-rtl"),b={"class":a.join(" "),style:"width: "+this.container_width()+";",title:this.form_field.title},this.form_field.id.length&&(b.id=this.form_field.id.replace(/[^\w]/g,"_")+"_chosen"),this.container=this.is_multiple?new Element("div",b).update(this.multi_temp.evaluate({"default":this.default_text})):new Element("div",b).update(this.single_temp.evaluate({"default":this.default_text})),this.form_field.hide().insert({after:this.container}),this.dropdown=this.container.down("div.chosen-drop"),this.search_field=this.container.down("input"),this.search_results=this.container.down("ul.chosen-results"),this.search_field_scale(),this.search_no_results=this.container.down("li.no-results"),this.is_multiple?(this.search_choices=this.container.down("ul.chosen-choices"),this.search_container=this.container.down("li.search-field")):(this.search_container=this.container.down("div.chosen-search"),this.selected_item=this.container.down(".chosen-single")),this.results_build(),this.set_tab_index(),this.set_label_behavior(),this.form_field.fire("chosen:ready",{chosen:this})},Chosen.prototype.register_observers=function(){var a=this;return this.container.observe("touchstart",function(b){return a.container_mousedown(b)}),this.container.observe("touchend",function(b){return a.container_mouseup(b)}),this.container.observe("mousedown",function(b){return a.container_mousedown(b)}),this.container.observe("mouseup",function(b){return a.container_mouseup(b)}),this.container.observe("mouseenter",function(b){return a.mouse_enter(b)}),this.container.observe("mouseleave",function(b){return a.mouse_leave(b)}),this.search_results.observe("mouseup",function(b){return a.search_results_mouseup(b)}),this.search_results.observe("mouseover",function(b){return a.search_results_mouseover(b)}),this.search_results.observe("mouseout",function(b){return a.search_results_mouseout(b)}),this.search_results.observe("mousewheel",function(b){return a.search_results_mousewheel(b)}),this.search_results.observe("DOMMouseScroll",function(b){return a.search_results_mousewheel(b)}),this.search_results.observe("touchstart",function(b){return a.search_results_touchstart(b)}),this.search_results.observe("touchmove",function(b){return a.search_results_touchmove(b)}),this.search_results.observe("touchend",function(b){return a.search_results_touchend(b)}),this.form_field.observe("chosen:updated",function(b){return a.results_update_field(b)}),this.form_field.observe("chosen:activate",function(b){return a.activate_field(b)}),this.form_field.observe("chosen:open",function(b){return a.container_mousedown(b)}),this.form_field.observe("chosen:close",function(b){return a.input_blur(b)}),this.search_field.observe("blur",function(b){return a.input_blur(b)}),this.search_field.observe("keyup",function(b){return a.keyup_checker(b)}),this.search_field.observe("keydown",function(b){return a.keydown_checker(b)}),this.search_field.observe("focus",function(b){return a.input_focus(b)}),this.search_field.observe("cut",function(b){return a.clipboard_event_checker(b)}),this.search_field.observe("paste",function(b){return a.clipboard_event_checker(b)}),this.is_multiple?this.search_choices.observe("click",function(b){return a.choices_click(b)}):this.container.observe("click",function(a){return a.preventDefault()})},Chosen.prototype.destroy=function(){return this.container.ownerDocument.stopObserving("click",this.click_test_action),this.form_field.stopObserving(),this.container.stopObserving(),this.search_results.stopObserving(),this.search_field.stopObserving(),null!=this.form_field_label&&this.form_field_label.stopObserving(),this.is_multiple?(this.search_choices.stopObserving(),this.container.select(".search-choice-close").each(function(a){return a.stopObserving()})):this.selected_item.stopObserving(),this.search_field.tabIndex&&(this.form_field.tabIndex=this.search_field.tabIndex),this.container.remove(),this.form_field.show()},Chosen.prototype.search_field_disabled=function(){return this.is_disabled=this.form_field.disabled,this.is_disabled?(this.container.addClassName("chosen-disabled"),this.search_field.disabled=!0,this.is_multiple||this.selected_item.stopObserving("focus",this.activate_action),this.close_field()):(this.container.removeClassName("chosen-disabled"),this.search_field.disabled=!1,this.is_multiple?void 0:this.selected_item.observe("focus",this.activate_action))},Chosen.prototype.container_mousedown=function(a){return this.is_disabled||(a&&"mousedown"===a.type&&!this.results_showing&&a.stop(),null!=a&&a.target.hasClassName("search-choice-close"))?void 0:(this.active_field?this.is_multiple||!a||a.target!==this.selected_item&&!a.target.up("a.chosen-single")||this.results_toggle():(this.is_multiple&&this.search_field.clear(),this.container.ownerDocument.observe("click",this.click_test_action),this.results_show()),this.activate_field())},Chosen.prototype.container_mouseup=function(a){return"ABBR"!==a.target.nodeName||this.is_disabled?void 0:this.results_reset(a)},Chosen.prototype.search_results_mousewheel=function(a){var b;return b=a.deltaY||-a.wheelDelta||a.detail,null!=b?(a.preventDefault(),"DOMMouseScroll"===a.type&&(b=40*b),this.search_results.scrollTop=b+this.search_results.scrollTop):void 0},Chosen.prototype.blur_test=function(){return!this.active_field&&this.container.hasClassName("chosen-container-active")?this.close_field():void 0},Chosen.prototype.close_field=function(){return this.container.ownerDocument.stopObserving("click",this.click_test_action),this.active_field=!1,this.results_hide(),this.container.removeClassName("chosen-container-active"),this.clear_backstroke(),this.show_search_field_default(),this.search_field_scale()},Chosen.prototype.activate_field=function(){return this.container.addClassName("chosen-container-active"),this.active_field=!0,this.search_field.value=this.search_field.value,this.search_field.focus()},Chosen.prototype.test_active_click=function(a){return a.target.up(".chosen-container")===this.container?this.active_field=!0:this.close_field()},Chosen.prototype.results_build=function(){return this.parsing=!0,this.selected_option_count=null,this.results_data=SelectParser.select_to_array(this.form_field),this.is_multiple?this.search_choices.select("li.search-choice").invoke("remove"):this.is_multiple||(this.single_set_selected_text(),this.disable_search||this.form_field.options.length<=this.disable_search_threshold?(this.search_field.readOnly=!0,this.container.addClassName("chosen-container-single-nosearch")):(this.search_field.readOnly=!1,this.container.removeClassName("chosen-container-single-nosearch"))),this.update_results_content(this.results_option_build({first:!0})),this.search_field_disabled(),this.show_search_field_default(),this.search_field_scale(),this.parsing=!1},Chosen.prototype.result_do_highlight=function(a){var b,c,d,e,f;return this.result_clear_highlight(),this.result_highlight=a,this.result_highlight.addClassName("highlighted"),d=parseInt(this.search_results.getStyle("maxHeight"),10),f=this.search_results.scrollTop,e=d+f,c=this.result_highlight.positionedOffset().top,b=c+this.result_highlight.getHeight(),b>=e?this.search_results.scrollTop=b-d>0?b-d:0:f>c?this.search_results.scrollTop=c:void 0},Chosen.prototype.result_clear_highlight=function(){return this.result_highlight&&this.result_highlight.removeClassName("highlighted"),this.result_highlight=null},Chosen.prototype.results_show=function(){return this.is_multiple&&this.max_selected_options<=this.choices_count()?(this.form_field.fire("chosen:maxselected",{chosen:this}),!1):(this.container.addClassName("chosen-with-drop"),this.results_showing=!0,this.search_field.focus(),this.search_field.value=this.search_field.value,this.winnow_results(),this.form_field.fire("chosen:showing_dropdown",{chosen:this}))},Chosen.prototype.update_results_content=function(a){return this.search_results.update(a)},Chosen.prototype.results_hide=function(){return this.results_showing&&(this.result_clear_highlight(),this.container.removeClassName("chosen-with-drop"),this.form_field.fire("chosen:hiding_dropdown",{chosen:this})),this.results_showing=!1},Chosen.prototype.set_tab_index=function(){var a;return this.form_field.tabIndex?(a=this.form_field.tabIndex,this.form_field.tabIndex=-1,this.search_field.tabIndex=a):void 0},Chosen.prototype.set_label_behavior=function(){var a=this;return this.form_field_label=this.form_field.up("label"),null==this.form_field_label&&(this.form_field_label=$$("label[for='"+this.form_field.id+"']").first()),null!=this.form_field_label?this.form_field_label.observe("click",function(b){return a.is_multiple?a.container_mousedown(b):a.activate_field()}):void 0},Chosen.prototype.show_search_field_default=function(){return this.is_multiple&&this.choices_count()<1&&!this.active_field?(this.search_field.value=this.default_text,this.search_field.addClassName("default")):(this.search_field.value="",this.search_field.removeClassName("default"))},Chosen.prototype.search_results_mouseup=function(a){var b;return b=a.target.hasClassName("active-result")?a.target:a.target.up(".active-result"),b?(this.result_highlight=b,this.result_select(a),this.search_field.focus()):void 0},Chosen.prototype.search_results_mouseover=function(a){var b;return b=a.target.hasClassName("active-result")?a.target:a.target.up(".active-result"),b?this.result_do_highlight(b):void 0},Chosen.prototype.search_results_mouseout=function(a){return a.target.hasClassName("active-result")||a.target.up(".active-result")?this.result_clear_highlight():void 0},Chosen.prototype.choice_build=function(a){var b,c,d=this;return b=new Element("li",{"class":"search-choice"}).update("<span>"+a.html+"</span>"),a.disabled?b.addClassName("search-choice-disabled"):(c=new Element("a",{href:"#","class":"search-choice-close",rel:a.array_index}),c.observe("click",function(a){return d.choice_destroy_link_click(a)}),b.insert(c)),this.search_container.insert({before:b})},Chosen.prototype.choice_destroy_link_click=function(a){return a.preventDefault(),a.stopPropagation(),this.is_disabled?void 0:this.choice_destroy(a.target)},Chosen.prototype.choice_destroy=function(a){return this.result_deselect(a.readAttribute("rel"))?(this.show_search_field_default(),this.is_multiple&&this.choices_count()>0&&this.search_field.value.length<1&&this.results_hide(),a.up("li").remove(),this.search_field_scale()):void 0},Chosen.prototype.results_reset=function(){return this.reset_single_select_options(),this.form_field.options[0].selected=!0,this.single_set_selected_text(),this.show_search_field_default(),this.results_reset_cleanup(),"function"==typeof Event.simulate&&this.form_field.simulate("change"),this.active_field?this.results_hide():void 0},Chosen.prototype.results_reset_cleanup=function(){var a;return this.current_selectedIndex=this.form_field.selectedIndex,a=this.selected_item.down("abbr"),a?a.remove():void 0},Chosen.prototype.result_select=function(a){var b,c;return this.result_highlight?(b=this.result_highlight,this.result_clear_highlight(),this.is_multiple&&this.max_selected_options<=this.choices_count()?(this.form_field.fire("chosen:maxselected",{chosen:this}),!1):(this.is_multiple?b.removeClassName("active-result"):this.reset_single_select_options(),b.addClassName("result-selected"),c=this.results_data[b.getAttribute("data-option-array-index")],c.selected=!0,this.form_field.options[c.options_index].selected=!0,this.selected_option_count=null,this.is_multiple?this.choice_build(c):this.single_set_selected_text(c.text),(a.metaKey||a.ctrlKey)&&this.is_multiple||this.results_hide(),this.search_field.value="","function"!=typeof Event.simulate||!this.is_multiple&&this.form_field.selectedIndex===this.current_selectedIndex||this.form_field.simulate("change"),this.current_selectedIndex=this.form_field.selectedIndex,this.search_field_scale())):void 0},Chosen.prototype.single_set_selected_text=function(a){return null==a&&(a=this.default_text),a===this.default_text?this.selected_item.addClassName("chosen-default"):(this.single_deselect_control_build(),this.selected_item.removeClassName("chosen-default")),this.selected_item.down("span").update(a)},Chosen.prototype.result_deselect=function(a){var b;return b=this.results_data[a],this.form_field.options[b.options_index].disabled?!1:(b.selected=!1,this.form_field.options[b.options_index].selected=!1,this.selected_option_count=null,this.result_clear_highlight(),this.results_showing&&this.winnow_results(),"function"==typeof Event.simulate&&this.form_field.simulate("change"),this.search_field_scale(),!0)},Chosen.prototype.single_deselect_control_build=function(){return this.allow_single_deselect?(this.selected_item.down("abbr")||this.selected_item.down("span").insert({after:'<abbr class="search-choice-close"></abbr>'}),this.selected_item.addClassName("chosen-single-with-deselect")):void 0},Chosen.prototype.get_search_text=function(){return this.search_field.value===this.default_text?"":this.search_field.value.strip().escapeHTML()},Chosen.prototype.winnow_results_set_highlight=function(){var a;return this.is_multiple||(a=this.search_results.down(".result-selected.active-result")),null==a&&(a=this.search_results.down(".active-result")),null!=a?this.result_do_highlight(a):void 0},Chosen.prototype.no_results=function(a){return this.search_results.insert(this.no_results_temp.evaluate({terms:a})),this.form_field.fire("chosen:no_results",{chosen:this})},Chosen.prototype.no_results_clear=function(){var a,b;for(a=null,b=[];a=this.search_results.down(".no-results");)b.push(a.remove());return b},Chosen.prototype.keydown_arrow=function(){var a;return this.results_showing&&this.result_highlight?(a=this.result_highlight.next(".active-result"))?this.result_do_highlight(a):void 0:this.results_show()},Chosen.prototype.keyup_arrow=function(){var a,b,c;return this.results_showing||this.is_multiple?this.result_highlight?(c=this.result_highlight.previousSiblings(),a=this.search_results.select("li.active-result"),b=c.intersect(a),b.length?this.result_do_highlight(b.first()):(this.choices_count()>0&&this.results_hide(),this.result_clear_highlight())):void 0:this.results_show()},Chosen.prototype.keydown_backstroke=function(){var a;return this.pending_backstroke?(this.choice_destroy(this.pending_backstroke.down("a")),this.clear_backstroke()):(a=this.search_container.siblings().last(),a&&a.hasClassName("search-choice")&&!a.hasClassName("search-choice-disabled")?(this.pending_backstroke=a,this.pending_backstroke&&this.pending_backstroke.addClassName("search-choice-focus"),this.single_backstroke_delete?this.keydown_backstroke():this.pending_backstroke.addClassName("search-choice-focus")):void 0)},Chosen.prototype.clear_backstroke=function(){return this.pending_backstroke&&this.pending_backstroke.removeClassName("search-choice-focus"),this.pending_backstroke=null},Chosen.prototype.keydown_checker=function(a){var b,c;switch(b=null!=(c=a.which)?c:a.keyCode,this.search_field_scale(),8!==b&&this.pending_backstroke&&this.clear_backstroke(),b){case 8:this.backstroke_length=this.search_field.value.length;break;case 9:this.results_showing&&!this.is_multiple&&this.result_select(a),this.mouse_on_container=!1;break;case 13:this.results_showing&&a.preventDefault();break;case 32:this.disable_search&&a.preventDefault();break;case 38:a.preventDefault(),this.keyup_arrow();break;case 40:a.preventDefault(),this.keydown_arrow()}},Chosen.prototype.search_field_scale=function(){var a,b,c,d,e,f,g,h,i;if(this.is_multiple){for(c=0,g=0,e="position:absolute; left: -1000px; top: -1000px; display:none;",f=["font-size","font-style","font-weight","font-family","line-height","text-transform","letter-spacing"],h=0,i=f.length;i>h;h++)d=f[h],e+=d+":"+this.search_field.getStyle(d)+";";return a=new Element("div",{style:e}).update(this.search_field.value.escapeHTML()),document.body.appendChild(a),g=Element.measure(a,"width")+25,a.remove(),b=this.container.getWidth(),g>b-10&&(g=b-10),this.search_field.setStyle({width:g+"px"})}},Chosen}(AbstractChosen)}.call(this);
 
 
trunk/class-aftership-api.php DELETED
@@ -1,185 +0,0 @@
1
- <?php
2
- /**
3
- * AfterShip API
4
- *
5
- * Handles AfterShip-API endpoint requests
6
- *
7
- * @author AfterShip
8
- * @category API
9
- * @package AfterShip
10
- * @since 1.0
11
- */
12
-
13
- if (!defined('ABSPATH')) exit; // Exit if accessed directly
14
-
15
- class AfterShip_API
16
- {
17
-
18
- /** This is the major version for the REST API and takes
19
- * first-order position in endpoint URLs
20
- */
21
- const VERSION = 1;
22
-
23
- /** @var WC_API_Server the REST API server */
24
- public $server;
25
-
26
- /**
27
- * Setup class
28
- *
29
- * @access public
30
- * @since 2.0
31
- * @return WC_API
32
- */
33
- public function __construct()
34
- {
35
-
36
- // add query vars
37
- add_filter('query_vars', array($this, 'add_query_vars'), 0);
38
-
39
- // register API endpoints
40
- add_action('init', array($this, 'add_endpoint'), 0);
41
-
42
- // handle REST/legacy API request
43
- add_action('parse_request', array($this, 'handle_api_requests'), 0);
44
- }
45
-
46
- /**
47
- * add_query_vars function.
48
- *
49
- * @access public
50
- * @since 2.0
51
- * @param $vars
52
- * @return array
53
- */
54
- public function add_query_vars($vars)
55
- {
56
- $vars[] = 'aftership-api';
57
- $vars[] = 'aftership-api-route';
58
- return $vars;
59
- }
60
-
61
- /**
62
- * add_endpoint function.
63
- *
64
- * @access public
65
- * @since 2.0
66
- * @return void
67
- */
68
- public function add_endpoint()
69
- {
70
-
71
- // REST API
72
- add_rewrite_rule('^aftership-api\/v' . self::VERSION . '/?$', 'index.php?aftership-api-route=/', 'top');
73
- add_rewrite_rule('^aftership-api\/v' . self::VERSION . '(.*)?', 'index.php?aftership-api-route=$matches[1]', 'top');
74
-
75
- // legacy API for payment gateway IPNs
76
- add_rewrite_endpoint('aftership-api', EP_ALL);
77
- }
78
-
79
-
80
- /**
81
- * API request - Trigger any API requests
82
- *
83
- * @access public
84
- * @since 2.0
85
- * @return void
86
- */
87
- public function handle_api_requests()
88
- {
89
- global $wp;
90
-
91
- if (!empty($_GET['aftership-api']))
92
- $wp->query_vars['aftership-api'] = $_GET['aftership-api'];
93
-
94
- if (!empty($_GET['aftership-api-route']))
95
- $wp->query_vars['aftership-api-route'] = $_GET['aftership-api-route'];
96
-
97
- // REST API request
98
- if (!empty($wp->query_vars['aftership-api-route'])) {
99
-
100
- define('AFTERSHIP_API_REQUEST', true);
101
-
102
- // load required files
103
- $this->includes();
104
-
105
- $this->server = new AfterShip_API_Server($wp->query_vars['aftership-api-route']);
106
-
107
- // load API resource classes
108
- $this->register_resources($this->server);
109
-
110
- // Fire off the request
111
- $this->server->serve_request();
112
-
113
- exit;
114
- }
115
-
116
- // legacy API requests
117
- if (!empty($wp->query_vars['aftership-api'])) {
118
-
119
- // Buffer, we won't want any output here
120
- ob_start();
121
-
122
- // Get API trigger
123
- $api = strtolower(esc_attr($wp->query_vars['aftership-api']));
124
-
125
- // Load class if exists
126
- if (class_exists($api))
127
- $api_class = new $api();
128
-
129
- // Trigger actions
130
- do_action('woocommerce_api_' . $api);
131
-
132
- // Done, clear buffer and exit
133
- ob_end_clean();
134
- die('1');
135
- }
136
- }
137
-
138
-
139
- /**
140
- * Include required files for REST API request
141
- *
142
- * @since 2.1
143
- */
144
- private function includes()
145
- {
146
-
147
- // API server / response handlers
148
- include_once('api/class-aftership-api-server.php');
149
- include_once('api/interface-aftership-api-handler.php');
150
- include_once('api/class-aftership-api-json-handler.php');
151
-
152
- // authentication
153
- include_once('api/class-aftership-api-authentication.php');
154
- $this->authentication = new AfterShip_API_Authentication();
155
-
156
- include_once('api/class-aftership-api-resource.php');
157
-
158
- // self api
159
- include_once('api/class-aftership-api-orders.php');
160
-
161
- // allow plugins to load other response handlers or resource classes
162
- do_action('woocommerce_api_loaded');
163
- }
164
-
165
- /**
166
- * Register available API resources
167
- *
168
- * @since 2.1
169
- * @param object $server the REST server
170
- */
171
- public function register_resources($server)
172
- {
173
-
174
- $api_classes = apply_filters('aftership_api_classes',
175
- array(
176
- 'AfterShip_API_Orders',
177
- )
178
- );
179
-
180
- foreach ($api_classes as $api_class) {
181
- $this->$api_class = new $api_class($server);
182
- }
183
- }
184
-
185
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/class-aftership-dependencies.php DELETED
@@ -1,25 +0,0 @@
1
- <?php
2
- class AfterShip_Dependencies {
3
-
4
- private static $active_plugins;
5
-
6
- public static function init() {
7
-
8
- self::$active_plugins = (array) get_option( 'active_plugins', array() );
9
-
10
- if ( is_multisite() )
11
- self::$active_plugins = array_merge( self::$active_plugins, get_site_option( 'active_sitewide_plugins', array() ) );
12
- }
13
-
14
- public static function plugin_active_check($plugin){
15
- if ( ! self::$active_plugins ) self::init();
16
- return in_array( $plugin, self::$active_plugins ) || array_key_exists( $plugin, self::$active_plugins );
17
- }
18
-
19
- public static function woocommerce_active_check() {
20
- return self::plugin_active_check('woocommerce/woocommerce.php');
21
- }
22
-
23
- }
24
-
25
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/class-aftership-settings.php DELETED
@@ -1,275 +0,0 @@
1
- <?php
2
- /**
3
- * AfterShip Admin
4
- *
5
- * Handles AfterShip-Admin endpoint requests
6
- *
7
- * @author AfterShip
8
- * @category Admin
9
- * @package AfterShip
10
- * @since 1.0
11
- */
12
-
13
- if (!defined('ABSPATH')) exit; // Exit if accessed directly
14
-
15
- /**
16
- * Required functions
17
- */
18
- if (!class_exists('AfterShip_Dependencies'))
19
- require_once 'class-aftership-dependencies.php';
20
-
21
- class AfterShip_Settings
22
- {
23
- /**
24
- * Holds the values to be used in the fields callbacks
25
- */
26
- private $options;
27
-
28
- private $plugins;
29
-
30
- /**
31
- * Start up
32
- */
33
- public function __construct()
34
- {
35
- $this->plugins[] = array(
36
- 'value' => 'aftership',
37
- 'label' => 'AfterShip',
38
- 'path' => 'aftership-woocommerce-tracking/aftership.php'
39
- );
40
- $this->plugins[] = array(
41
- 'value' => 'wc-shipment-tracking',
42
- 'label' => 'WooCommerce Shipment Tracking',
43
- 'path' => 'woocommerce-shipment-tracking/shipment-tracking.php'
44
- );
45
-
46
- add_action('admin_menu', array($this, 'add_plugin_page'));
47
- add_action('admin_init', array($this, 'page_init'));
48
- add_action('admin_print_styles', array($this, 'admin_styles'));
49
- add_action('admin_print_scripts', array(&$this, 'library_scripts'));
50
- }
51
-
52
-
53
- public function admin_styles()
54
- {
55
- wp_enqueue_style('aftership_styles_chosen', plugins_url(basename(dirname(__FILE__))) . '/assets/plugin/chosen/chosen.min.css');
56
- wp_enqueue_style('aftership_styles', plugins_url(basename(dirname(__FILE__))) . '/assets/css/admin.css');
57
- }
58
-
59
- public function library_scripts()
60
- {
61
- wp_enqueue_script('aftership_styles_chosen_jquery', plugins_url(basename(dirname(__FILE__))) . '/assets/plugin/chosen/chosen.jquery.min.js');
62
- wp_enqueue_script('aftership_styles_chosen_proto', plugins_url(basename(dirname(__FILE__))) . '/assets/plugin/chosen/chosen.proto.min.js');
63
- wp_enqueue_script('aftership_script_util', plugins_url(basename(dirname(__FILE__))) . '/assets/js/util.js');
64
- wp_enqueue_script('aftership_script_couriers', plugins_url(basename(dirname(__FILE__))) . '/assets/js/couriers.js');
65
- wp_enqueue_script('aftership_script_setting', plugins_url(basename(dirname(__FILE__))) . '/assets/js/setting.js');
66
- }
67
-
68
- /**
69
- * Add options page
70
- */
71
- public function add_plugin_page()
72
- {
73
- // This page will be under "Settings"
74
- add_options_page(
75
- 'AfterShip Settings Admin',
76
- 'AfterShip',
77
- 'manage_options',
78
- 'aftership-setting-admin',
79
- array($this, 'create_admin_page')
80
- );
81
- }
82
-
83
- /**
84
- * Options page callback
85
- */
86
- public function create_admin_page()
87
- {
88
- // Set class property
89
- $this->options = get_option('aftership_option_name');
90
- ?>
91
- <div class="wrap">
92
- <?php screen_icon(); ?>
93
- <h2>AfterShip Settings</h2>
94
-
95
- <form method="post" action="options.php">
96
- <?php
97
- // This prints out all hidden setting fields
98
- settings_fields('aftership_option_group');
99
- do_settings_sections('aftership-setting-admin');
100
- submit_button();
101
- ?>
102
- </form>
103
- </div>
104
- <?php
105
- }
106
-
107
- /**
108
- * Register and add settings
109
- */
110
- public function page_init()
111
- {
112
- register_setting(
113
- 'aftership_option_group', // Option group
114
- 'aftership_option_name', // Option name
115
- array($this, 'sanitize') // Sanitize
116
- );
117
-
118
- add_settings_section(
119
- 'aftership_setting_section_id', // ID
120
- '', // Title
121
- array($this, 'print_section_info'), // Callback
122
- 'aftership-setting-admin' // Page
123
- );
124
-
125
- add_settings_field(
126
- 'plugin',
127
- 'Plugin',
128
- array($this, 'plugin_callback'),
129
- 'aftership-setting-admin',
130
- 'aftership_setting_section_id'
131
- );
132
-
133
- add_settings_field(
134
- 'couriers',
135
- 'Couriers',
136
- array($this, 'couriers_callback'),
137
- 'aftership-setting-admin',
138
- 'aftership_setting_section_id'
139
- );
140
-
141
- add_settings_field(
142
- 'use_track_button',
143
- 'Display Track Button at Order History Page',
144
- array($this, 'track_button_callback'),
145
- 'aftership-setting-admin',
146
- 'aftership_setting_section_id'
147
- );
148
-
149
- add_settings_field(
150
- 'track_message',
151
- 'Content',
152
- array($this, 'track_message_callback'),
153
- 'aftership-setting-admin',
154
- 'aftership_setting_section_id'
155
- );
156
- }
157
-
158
- /**
159
- * Sanitize each setting field as needed
160
- *
161
- * @param array $input Contains all settings fields as array keys
162
- */
163
- public function sanitize($input)
164
- {
165
- $new_input = array();
166
-
167
- if (isset($input['couriers'])) {
168
- $new_input['couriers'] = sanitize_text_field($input['couriers']);
169
- }
170
-
171
- if (isset($input['plugin'])) {
172
- $new_input['plugin'] = sanitize_text_field($input['plugin']);
173
- }
174
-
175
- if (isset($input['track_message_1'])) {
176
- $postfix = '';
177
- if (substr($input['track_message_1'], -1) == ' ') {
178
- $postfix = ' ';
179
- }
180
- $new_input['track_message_1'] = sanitize_text_field($input['track_message_1']) . $postfix;
181
- }
182
-
183
- if (isset($input['track_message_2'])) {
184
- $postfix = '';
185
- if (substr($input['track_message_2'], -1) == ' ') {
186
- $postfix = ' ';
187
- }
188
- $new_input['track_message_2'] = sanitize_text_field($input['track_message_2']) . $postfix;
189
- }
190
-
191
- if (isset($input['use_track_button'])) {
192
- $new_input['use_track_button'] = true;
193
- }
194
-
195
- return $new_input;
196
- }
197
-
198
- /**
199
- * Print the Section text
200
- */
201
- public function print_section_info()
202
- {
203
- //print 'Enter your settings below:';
204
- }
205
-
206
- public function couriers_callback()
207
- {
208
-
209
- $couriers = array();
210
- if (isset($this->options['couriers'])) {
211
- $couriers = explode(',', $this->options['couriers']);
212
- }
213
-
214
- // print_r($couriers);
215
- echo '<select data-placeholder="Please select couriers" id="couriers_select" class="chosen-select " multiple style="width:100%">';
216
- echo '</select>';
217
- // echo '<br><a href="https://www.aftership.com/settings/courier" target="_blank">Update carrier list</a>';
218
- echo '<input type="hidden" id="couriers" name="aftership_option_name[couriers]" value="' . implode(",", $couriers) . '"/>';
219
-
220
- }
221
-
222
- public function plugin_callback()
223
- {
224
-
225
- $options = "";
226
- foreach ($this->plugins as $plugin) {
227
- //print_r($plugin);
228
- if (AfterShip_Dependencies::plugin_active_check($plugin['path'])) {
229
- $option = '<option value="' . $plugin['value'] . '"';
230
-
231
- if (isset($this->options['plugin']) && esc_attr($this->options['plugin']) == $plugin['value']) {
232
- $option .= ' selected="selected"';
233
- }
234
-
235
- $option .= '>' . $plugin['label'] . '</option>';
236
- $options .= $option;
237
- }
238
- }
239
-
240
- printf(
241
- '<select id="plugin" name="aftership_option_name[plugin]" class="aftership_dropdown">' . $options . '</select>'
242
- );
243
- }
244
-
245
- public function track_message_callback()
246
- {
247
- printf(
248
- '<input type="text" id="track_message_1" name="aftership_option_name[track_message_1]" value="%s" style="width:100%%">',
249
- isset($this->options['track_message_1']) ? $this->options['track_message_1'] : 'Your order was shipped via '
250
- );
251
- printf('<br/>');
252
- printf(
253
- '<input type="text" id="track_message_2" name="aftership_option_name[track_message_2]" value="%s" style="width:100%%">',
254
- isset($this->options['track_message_2']) ? $this->options['track_message_2'] : 'Tracking number is '
255
- );
256
- printf('<br/>');
257
- printf('<br/>');
258
- printf('<b>Demo:</b>');
259
- printf(
260
- '<div id="track_message_demo_1" style="width:100%%"></div>'
261
- );
262
- }
263
-
264
- public function track_button_callback()
265
- {
266
- printf(
267
- '<label><input type="checkbox" id="use_track_button" name="aftership_option_name[use_track_button]" %s>Use Track Button</label>',
268
- (isset($this->options['use_track_button']) && $this->options['use_track_button'] === true) ? 'checked="checked"' : ''
269
- );
270
- }
271
- }
272
-
273
-
274
- if (is_admin())
275
- $aftership_settings = new AfterShip_Settings();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/readme.txt DELETED
@@ -1,153 +0,0 @@
1
- === Plugin Name ===
2
- Contributors: aftership
3
- Donate link: https://www.aftership.com/
4
- Tags: shipping, tracking, ups, usps, fedex, dhl, tnt, dpd, post, shipment, woocommerce, tracking number, aftership, package tracking, fulfilment, tracking link, carrier, courier, woo commerce, woocommerce shipment tracking, shipping details plugin, widget, shipstation, track, package
5
- Requires at least: 2.9
6
- Tested up to: 4.2.2
7
- Stable tag: 1.4.6
8
- License: GPLv2 or later
9
- License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
-
11
- Add tracking number and carrier name to WooCommerce, display tracking info at order history page, auto import tracking numbers to AfterShip.
12
-
13
- == Description ==
14
-
15
- ###Add tracking number and carrier name fields (Free)
16
- By installing AfterShip plugin, you can automatically add Tracking Number and Carrier fields to your admin panel. After you fulfill an order, simply enter the tracking number and select a carrier at WooCommerce, the same info will be displayed at customer's order history page. AfterShip supports over 200 carriers worldwide, you can select carriers by [signing up a free AfterShip account](https://www.aftership.com/signup).
17
-
18
- ###Display tracking info at order history page (Free)
19
- The plugin allows you to insert the AfterShip Track Button to order history page, so that your customers can track the latest order status in one click.
20
-
21
- ###Support 200+ International Carrier (Free)
22
- AfterShip supports UPS tracking, FedEx tracking, USPS tracking, DHL tracking and shipment tracking of over 200+ carriers worlwide. Please scroll down to see the full list of our supported carriers.
23
-
24
-
25
- ###Track all shipments in one place (Free)
26
- By setting up an auto import of tracking numbers to AfterShip, you can get the latest tracking info of all shipments in one place. Each free account comes with a Dashboard to monitor current statuses of all shipments. You can also filter your shipments by dates, statuses, couriers and destination. Find out if all your shipments are delivered on time and discover any exceptions. Support [WooCommerce Shipment Tracking Plugin](http://www.woothemes.com/products/shipment-tracking/) as well.
27
-
28
- ###Notify customers of delivery updates (Premium)
29
- Upgrade to [Premium](https://www.aftership.com/premium) to automatically send out delivery notifications to customers or yourself. Your choice of notification triggers - In transit, Out for delivery, Delivered, Failed delivery attempt or Exceptions. Use your own email to send out notifications, and customize messages to add store logo, URL, a tracking link to get more returned customers after shipping!
30
-
31
- [youtube http://www.youtube.com/watch?v=1zCCx8Ap9ms]
32
-
33
- ###Full list of supported carriers (200+):
34
- **①. US, Canada & Global Tracking (35)**
35
- ABF Freight • APC Postal Logistics • Aramex • Asendia USA • Canada Post • Canpar Courier • Con-way Freight • DACHSER • DHL Express • DHL eCommerce • DHL Express (Piece ID) • DPD • DSV • Echo • Ensenda • Estes • FedEx • FedEx Freight • Globegistics Inc. • Greyhound • i-parcel • LaserShip • Newgistics • Old Dominion Freight Line • OnTrac • Purolator • RL Carriers • RR Donnelley • TNT • TNT Reference • UPS • UPS Freight • UPS Mail Innovations • USPS • YRC
36
-
37
- **②. UK & Ireland Tracking (30)**
38
- 4Square Group • An Post • APC Overnight • Arrow XL • Asendia UK • Collect+ • Deltec Courier • DPD Ireland • DPD UK • Fastway Ireland • FedEx UK • Hermesworld • Homedirect Logistics • Interlink Express • myHermes UK • Nightline • Norsk Global • Panther • Parcel Force • Royal Mail • SkyNet Worldwide Express • Skynet Worldwide Express UK • TNT UK • TNT UK Reference • Tuffnells Parcels Express • UK Mail • XDP Express • XDP Express Reference • Yodel Domestic • Yodel International
39
-
40
- **③. Europe Tracking (93)**
41
- ACS Courier • Asendia Germany • ASM • Austrian Post (Express) • Austrian Post (Registered) • Belpost • Bert Transport • Bulgarian Posts • JP BH Pošta • Belgium Post • bpost international • BRT Bartolini • CBL Logistics • Česká Pošta • Chronopost France • Chronopost Portugal • Colis Privé • Colissimo • Correos Express • Cyprus Post • Post Danmark • DB Schenker Sweden • Deutsche Post Mail • DHL Benelux • DHL 2-Mann-Handling • DHL Spain Domestic • Deutsche Post DHL • DHL Netherlands • DHL Poland Domestic • DHL Parcel NL • Direct Link • DMM Network • DPD Germany • DPD Poland • Easy Mail • ELTA Hellenic Post • Envialia • Exapaq • FERCAM Logistics & Transport • Geodis Calberson France • GLS • GLS Italy • GLS Netherlands • Hermes Germany • Hrvatska Pošta • IMX Mail • InPost Paczkomaty • International Seur • Italy SDA • Kuehne + Nagel • La Poste • Lietuvos Paštas • Magyar Posta • Matkahuolto • Mondial Relay • MRW • NACEX Spain • Nova Poshta • FedEx Poland Domestic • Packlink • Poczta Polska • Portugal CTT • Portugal Seur • Poșta Română • Poste Italiane • Poste Italiane Paccocelere • Posten Norge / Bring • Itella Posti • PostNL Domestic • PostNL International 3S • PostNL International • PostNord Logistics • Iceland Post • PTT Posta • Raben Group • Redur Spain • Russian Post • SGT Corriere Espresso • Teliway SIC Express • Siodemka • Correos de España • Spanish Seur • Speed Couriers • Sweden Posten • Swiss Post • Geniki Taxydromiki • TNT-Click Italy • TNT France • TNT Italy • Nexive (TNT Post Italy) • TrakPak • TransMission • UkrPoshta
42
-
43
- **④. Asia & China Tracking (125)**
44
-
45
- 2GO • ABX Express • AIR21 • Airpak Express • Airspeed International Corporation • Bluedart • Cambodia Post • City-Link Express • CJ GLS • Delcart • Delhivery • Delivree King • Detrack • DHL Global Mail Asia • Dotzot • DPEX • DTDC India • Dynamic Logistics • Ecargo • Ecom Express • Fastrak Services • First Flight Couriers • First Logistics • Gati-KWE • GDEX • Giao hà ng nhanh • GoJavas • India Post Domestic • India Post International • Jam Express • Japan Post • Jayon Express (JEX) • Jet-Ship Worldwide • JNE • Kangaroo Worldwide Express • Kerry Express Thailand • Kerry TTC Express • KGM Hub • Korea Post • Lao Post • LBC Express • Lion Parcel • Malaysia Post EMS / Poslaju • Malaysia Post - Registered • Maxcellents Pte Ltd • Mypostonline • Nationwide Express • Nhans Solutions • Ninja Van • Ninja Van Malaysia • NuvoEx • Omni Parcel • Pandu Logistics • Parcel Express • Parcelled.in • Parcel Post Singapore • Pos Indonesia Domestic • Pos Indonesia Int'l • Professional Couriers • Quantium • Qxpress • RAF Philippines • Red Express • Red Express Waybill • RPX Indonesia • RPX Online • RZY Express • Safexpress • Sagawa • Singapore Post • Singapore Speedpost • SingParcel Service • SkyNet Malaysia • Spreadel • SRE Korea • Taiwan Post • Yamato Japan • TAQBIN Malaysia • TAQBIN Singapore • Thailand Thai Post • Tiki • ViettelPost • Vietnam Post • Vietnam Post EMS • Wahana • Xend Express • XpressBees • Zalora 7-Eleven • 17 Post Service • 4PX • Best Express • AuPost China • BOXC • China EMS • China Post • CNE Express • Cuckoo Express • DHL Hong Kong • EC-Firstclass • EC Express • EMPS Express • Equick China • Flyt Express • GoFly • Hua Han Logistics • Hong Kong Post • JCEX • Logistic Worldwide Express • Nanjing Woyuan • One World Express • Post56 • PayPal Package • SEKO Logistics • S.F. Express • S.F International • STO Express • DPEX China • TAQBIN Hong Kong • TGX • WeDo Logistics • WishPost • Yanwen • Yunda Express • Yun Express • ZJS International
46
-
47
- **⑤. Australia & New Zealand Tracking (14)**
48
-
49
- ADSOne • Australia Post • Bonds Couriers • CourierPost • Couriers Please • Fastway Australia • Fastway New Zealand • New Zealand Post • StarTrack • Star Track Express • TNT Australia • Toll IPEC • Toll Priority • UBI Logistics Australia
50
-
51
- **⑥. Latin America, Middle East & Other Tracking (27)**
52
-
53
- 4-72 Entregando • Mexico AeroFlash • Brazil Correios • Correo Argentino • Correos Chile • Correos de Mexico • Cosmetics Now • Courier Plus • Courier IT • Dawn Wing • DPE South Africa • Emirates Post • Estafeta • Fastway South Africa • Israel Post • Israel Post Domestic • Mexico Redpack • Mexico Senda Express • NiPost • OCA Argentina • Post Serbia • RAM • South African Post Office • Saudi Post • SMSA Express • Specialised Freight • Speedex Courier
54
-
55
-
56
- == Installation ==
57
-
58
- 1. [Sign up AfterShip account for FREE](https://www.aftership.com/signup)
59
- 2. [Download AfterShip plugin](http://downloads.wordpress.org/plugin/aftership-woocommerce-tracking.zip), then install and activate at wordpress.
60
- 3. Select AfterShip Plugin or [WooCommerce Shipment Tracking Plugin](http://www.woothemes.com/products/shipment-tracking/) for entering tracking number
61
- 4. Check `Use Track Button` for displaying tracking info at order history page
62
- 5. Generate [AfterShip's WordPress API Key](http://aftership.uservoice.com/knowledgebase/articles/405909) under `Users` > `Your Profile`
63
- 6. Input `Store URL` and `AfterShip's WordPress API Key` at [AfterShip WooCommerce page](https://www.aftership.com/apps/woocommerce)
64
-
65
- *** This plugin requires at least PHP 5.2.4
66
- *** This plugin requires at least WooCommerce 2.1
67
-
68
- ###Further Reading
69
-
70
- * [How to insert AfterShip Track Button to WordPress or WooCommerce](https://aftership.uservoice.com/knowledgebase/articles/268665)
71
- * [Premium account pricing](https://www.aftership.com/premium)
72
- * [List of supported couriers](https://www.aftership.com/courier)
73
- * [Free vs Premium](https://www.aftership.com/free-vs-premium)
74
- * [SMS Charges](https://www.aftership.com/sms-pricing)
75
- * [Isn’t my store or courier sending notifications already?](https://aftership.uservoice.com/knowledgebase/articles/169634-isn-t-my-store-or-courier-sending-notifications-al)
76
-
77
-
78
- == Frequently Asked Questions ==
79
-
80
- You'll find the FAQ on [AfterShip.com](https://aftership.uservoice.com/knowledgebase)
81
-
82
-
83
- == Screenshots ==
84
-
85
- 1. Add tracking number and carrier to WooCommerce
86
- 2. Display tracking info at order history page
87
- 3. Support tracking of UPS, DHL, FedEx, USPS and 200+ carriers
88
- 4. AfterShip dashboard
89
- 5. Track all shipments in one place
90
- 6. View exception, and filter by status
91
- 7. Automatically send out delivery notifications
92
-
93
- == Changelog ==
94
-
95
- = 1.4.6 =
96
- * Add new couriers
97
-
98
- = 1.4.5 =
99
- * Compatible up to WordPress 4.2.2
100
- * Add new couriers
101
-
102
- = 1.4.4 =
103
- * Add new couriers
104
-
105
- = 1.4.3 =
106
- * Add new couriers
107
- * Disable unused field for import orders to AfterShip system
108
-
109
- = 1.4.2 =
110
- * Fix carrier list data in setting page, to support new dropdown menu in Wordpress 4.1
111
-
112
- = 1.4.1 =
113
- * Add order by filter option
114
-
115
- = 1.4.0 =
116
- * Remove courier url and telephone no.
117
-
118
- = 1.3.9 =
119
- * Disable get_cart_discount() and get_order_discount() as it's deprecated in WooCommerce 2.3
120
-
121
- = 1.3.8 =
122
- * Force load the script to display the plugin if the script didn't execute normally after 2 seconds while the page loaded.
123
-
124
- = 1.3.7 =
125
- * Add new courier
126
-
127
- = 1.3.6 =
128
- * Fix the display problem of required fields in order history page
129
-
130
- = 1.3.5 =
131
- * Fix carrier list data, to support new dropdown menu in Wordpress 4.1
132
-
133
- = 1.3.4 =
134
- * Fix the custom track message tailing space problem
135
-
136
- = 1.3.3 =
137
- * Add the fields config
138
-
139
- = 1.3.2 =
140
- * Support new couriers, please check out supported couriers in https://www.aftership.com/courier
141
- * Support new required field, `tracking key` and `tracking destination country`
142
- * Support custom track message on order history page
143
-
144
- = 1.3.1 =
145
- * Support 231 couriers, please check out supported couriers in https://www.aftership.com/courier
146
-
147
- = 1.3.0 =
148
- * Fix the redeclare class issues
149
-
150
-
151
- == Upgrade Notice ==
152
-
153
- No Upgrade Yet