WC Vendors - Version 1.9.12

Version Description

No Upgrade required at this time.

Download this release

Release Info

Developer digitalchild
Plugin Icon 128x128 WC Vendors
Version 1.9.12
Comparing to
See all releases

Code changes from version 1.9.11 to 1.9.12

Files changed (112) hide show
  1. assets/banner-1544x500.png +0 -0
  2. assets/banner-772x250.png +0 -0
  3. assets/icon-128x128.png +0 -0
  4. assets/icon-256x256.png +0 -0
  5. assets/icon.svg +115 -0
  6. assets/screenshot-1.png +0 -0
  7. assets/screenshot-2.png +0 -0
  8. assets/screenshot-3.png +0 -0
  9. assets/screenshot-4.png +0 -0
  10. assets/screenshot-5.png +0 -0
  11. assets/screenshot-6.png +0 -0
  12. assets/screenshot-7.png +0 -0
  13. changelog.txt +10 -0
  14. class-wc-vendors.php +3 -3
  15. classes/admin/emails/class-wc-notify-vendor.php +4 -1
  16. classes/class-commission.php +3 -3
  17. classes/class-vendors.php +3 -2
  18. languages/wcvendors-es_ES.mo +0 -0
  19. languages/wcvendors-es_ES.po +1513 -571
  20. languages/wcvendors-pt_PT.mo +0 -0
  21. languages/wcvendors-pt_PT.po +79 -85
  22. readme.txt +3 -3
  23. templates/emails/vendor-new-order.php +1 -1
  24. templates/orders/orders.php +4 -1
  25. trunk/assets/css/admin-orders.css +0 -7
  26. trunk/assets/css/select2.min.css +0 -1
  27. trunk/assets/css/wcv-frontend.css +0 -545
  28. trunk/assets/images/icons/truck.png +0 -0
  29. trunk/assets/js/front-orders.js +0 -8
  30. trunk/assets/js/select2.min.js +0 -3
  31. trunk/assets/js/wcv-admin-quick-edit.js +0 -34
  32. trunk/assets/js/wcv-commissions.js +0 -11
  33. trunk/changelog.txt +0 -582
  34. trunk/class-wc-vendors.php +0 -419
  35. trunk/classes/admin/class-admin-page.php +0 -826
  36. trunk/classes/admin/class-admin-reports.php +0 -549
  37. trunk/classes/admin/class-admin-users.php +0 -478
  38. trunk/classes/admin/class-product-meta.php +0 -267
  39. trunk/classes/admin/class-vendor-admin-dashboard.php +0 -691
  40. trunk/classes/admin/class-vendor-applicants.php +0 -103
  41. trunk/classes/admin/class-vendor-reports.php +0 -121
  42. trunk/classes/admin/emails/class-emails.php +0 -151
  43. trunk/classes/admin/emails/class-wc-approve-vendor.php +0 -165
  44. trunk/classes/admin/emails/class-wc-notify-admin.php +0 -176
  45. trunk/classes/admin/emails/class-wc-notify-shipped.php +0 -201
  46. trunk/classes/admin/emails/class-wc-notify-vendor.php +0 -352
  47. trunk/classes/admin/settings/README.md +0 -126
  48. trunk/classes/admin/settings/assets/css/sf-styles.css +0 -167
  49. trunk/classes/admin/settings/assets/img/tip.png +0 -0
  50. trunk/classes/admin/settings/assets/js/bootstrap-tooltip.js +0 -126
  51. trunk/classes/admin/settings/assets/js/js.iml +0 -10
  52. trunk/classes/admin/settings/assets/js/select2/select2-bootstrap.css +0 -87
  53. trunk/classes/admin/settings/assets/js/select2/select2-spinner.gif +0 -0
  54. trunk/classes/admin/settings/assets/js/select2/select2.css +0 -704
  55. trunk/classes/admin/settings/assets/js/select2/select2.js +0 -3541
  56. trunk/classes/admin/settings/assets/js/select2/select2.min.js +0 -23
  57. trunk/classes/admin/settings/assets/js/select2/select2.png +0 -0
  58. trunk/classes/admin/settings/assets/js/select2/select2x2.png +0 -0
  59. trunk/classes/admin/settings/assets/js/sf-jquery.js +0 -23
  60. trunk/classes/admin/settings/assets/js/wcvendors-media.js +0 -52
  61. trunk/classes/admin/settings/classes/sf-class-format-options.php +0 -347
  62. trunk/classes/admin/settings/classes/sf-class-sanitize.php +0 -199
  63. trunk/classes/admin/settings/classes/sf-class-settings.php +0 -978
  64. trunk/classes/admin/settings/sf-options.php +0 -363
  65. trunk/classes/admin/views/html-vendor-settings-page.php +0 -76
  66. trunk/classes/class-commission.php +0 -537
  67. trunk/classes/class-cron.php +0 -171
  68. trunk/classes/class-install.php +0 -286
  69. trunk/classes/class-queries.php +0 -284
  70. trunk/classes/class-shipping.php +0 -331
  71. trunk/classes/class-vendor-order.php +0 -71
  72. trunk/classes/class-vendor-post-types.php +0 -52
  73. trunk/classes/class-vendors.php +0 -675
  74. trunk/classes/front/class-vendor-cart.php +0 -70
  75. trunk/classes/front/class-vendor-shop.php +0 -352
  76. trunk/classes/front/dashboard/class-vendor-dashboard.php +0 -515
  77. trunk/classes/front/orders/class-export-csv.php +0 -98
  78. trunk/classes/front/orders/class-orders.php +0 -362
  79. trunk/classes/front/orders/class-submit-comment.php +0 -81
  80. trunk/classes/front/signup/class-vendor-signup.php +0 -174
  81. trunk/classes/front/signup/views/html-vendor-signup.php +0 -68
  82. trunk/classes/gateways/PayPal_AdvPayments/PayPal_AP/assets/icons/index.php +0 -0
  83. trunk/classes/gateways/PayPal_AdvPayments/PayPal_AP/assets/icons/paypalap.png +0 -0
  84. trunk/classes/gateways/PayPal_AdvPayments/PayPal_AP/assets/index.php +0 -0
  85. trunk/classes/gateways/PayPal_AdvPayments/PayPal_AP/classes/adaptivepayments-sdk/ChangeLog.txt +0 -33
  86. trunk/classes/gateways/PayPal_AdvPayments/PayPal_AP/classes/adaptivepayments-sdk/LICENSE.txt +0 -41
  87. trunk/classes/gateways/PayPal_AdvPayments/PayPal_AP/classes/adaptivepayments-sdk/README.md +0 -57
  88. trunk/classes/gateways/PayPal_AdvPayments/PayPal_AP/classes/adaptivepayments-sdk/build.xml +0 -24
  89. trunk/classes/gateways/PayPal_AdvPayments/PayPal_AP/classes/adaptivepayments-sdk/config/cert_key.pem +0 -31
  90. trunk/classes/gateways/PayPal_AdvPayments/PayPal_AP/classes/adaptivepayments-sdk/config/sdk_config.ini +0 -26
  91. trunk/classes/gateways/PayPal_AdvPayments/PayPal_AP/classes/adaptivepayments-sdk/lib/IPPCredential.php +0 -53
  92. trunk/classes/gateways/PayPal_AdvPayments/PayPal_AP/classes/adaptivepayments-sdk/lib/PPAPIService.php +0 -62
  93. trunk/classes/gateways/PayPal_AdvPayments/PayPal_AP/classes/adaptivepayments-sdk/lib/PPAuthenticationManager.php +0 -91
  94. trunk/classes/gateways/PayPal_AdvPayments/PayPal_AP/classes/adaptivepayments-sdk/lib/PPBaseService.php +0 -88
  95. trunk/classes/gateways/PayPal_AdvPayments/PayPal_AP/classes/adaptivepayments-sdk/lib/PPCertificateCredential.php +0 -72
  96. trunk/classes/gateways/PayPal_AdvPayments/PayPal_AP/classes/adaptivepayments-sdk/lib/PPConfigManager.php +0 -124
  97. trunk/classes/gateways/PayPal_AdvPayments/PayPal_AP/classes/adaptivepayments-sdk/lib/PPConnectionManager.php +0 -48
  98. trunk/classes/gateways/PayPal_AdvPayments/PayPal_AP/classes/adaptivepayments-sdk/lib/PPCredentialManager.php +0 -117
  99. trunk/classes/gateways/PayPal_AdvPayments/PayPal_AP/classes/adaptivepayments-sdk/lib/PPHttpConnection.php +0 -184
  100. trunk/classes/gateways/PayPal_AdvPayments/PayPal_AP/classes/adaptivepayments-sdk/lib/PPLoggingManager.php +0 -84
  101. trunk/classes/gateways/PayPal_AdvPayments/PayPal_AP/classes/adaptivepayments-sdk/lib/PPObjectTransformer.php +0 -33
  102. trunk/classes/gateways/PayPal_AdvPayments/PayPal_AP/classes/adaptivepayments-sdk/lib/PPSignatureCredential.php +0 -49
  103. trunk/classes/gateways/PayPal_AdvPayments/PayPal_AP/classes/adaptivepayments-sdk/lib/PPUtils.php +0 -274
  104. trunk/classes/gateways/PayPal_AdvPayments/PayPal_AP/classes/adaptivepayments-sdk/lib/auth/AuthUtil.php +0 -83
  105. trunk/classes/gateways/PayPal_AdvPayments/PayPal_AP/classes/adaptivepayments-sdk/lib/auth/PPAuth.php +0 -1077
  106. trunk/classes/gateways/PayPal_AdvPayments/PayPal_AP/classes/adaptivepayments-sdk/lib/cacert.pem +0 -171
  107. trunk/classes/gateways/PayPal_AdvPayments/PayPal_AP/classes/adaptivepayments-sdk/lib/exceptions/PPConfigurationException.php +0 -9
  108. trunk/classes/gateways/PayPal_AdvPayments/PayPal_AP/classes/adaptivepayments-sdk/lib/exceptions/PPConnectionException.php +0 -20
  109. trunk/classes/gateways/PayPal_AdvPayments/PayPal_AP/classes/adaptivepayments-sdk/lib/exceptions/PPInvalidCredentialException.php +0 -22
  110. trunk/classes/gateways/PayPal_AdvPayments/PayPal_AP/classes/adaptivepayments-sdk/lib/exceptions/PPMissingCredentialException.php +0 -22
  111. trunk/classes/gateways/PayPal_AdvPayments/PayPal_AP/classes/adaptivepayments-sdk/lib/exceptions/PPTransformerException.php +0 -20
  112. trunk/classes/gateways/PayPal_AdvPayments/PayPal_AP/classes/adaptivepayments-sdk/lib/services/AdaptivePayments/AdaptivePayments.php +0 -2453
assets/banner-1544x500.png ADDED
Binary file
assets/banner-772x250.png ADDED
Binary file
assets/icon-128x128.png ADDED
Binary file
assets/icon-256x256.png ADDED
Binary file
assets/icon.svg ADDED
@@ -0,0 +1,115 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <svg viewBox="0 0 500 500" xmlns:xlink="http://www.w3.org/1999/xlink" height="500pt" xmlns="http://www.w3.org/2000/svg" width="500pt" version="1.1"><defs>
2
+ <path d="M0.00 0.00 L500.00 0.00 L500.00 500.00 L0.00 500.00 L0.00 0.00" id="p1" />
3
+ <path d="M81.20 65.86 C86.56 60.77 91.79 55.56 97.38 50.72 C107.88 60.16 117.24 70.79 127.00 80.99 C128.97 82.95 130.73 85.43 133.41 86.45 C159.98 91.11 186.86 94.12 213.31 99.49 C210.33 110.00 209.66 121.01 210.56 131.87 C209.92 132.04 208.62 132.39 207.98 132.56 C202.01 127.72 197.14 121.68 191.11 116.90 C189.06 118.91 187.01 120.94 185.01 123.02 C190.35 131.20 200.26 135.94 203.39 145.57 C209.87 163.03 216.76 180.34 223.07 197.87 C224.22 201.13 225.75 204.40 225.73 207.92 C225.48 210.20 224.29 212.23 223.45 214.33 C218.99 214.61 213.97 215.23 210.88 218.83 C206.43 223.50 206.18 231.57 210.72 236.26 C214.45 240.56 221.21 241.88 226.19 239.01 C229.57 237.26 231.39 233.76 233.26 230.63 C245.84 230.66 258.41 230.60 270.99 230.62 C273.85 234.22 277.18 238.38 282.14 238.75 C290.33 239.91 298.02 231.30 296.09 223.30 C295.06 218.43 291.12 213.77 285.94 213.32 C283.08 213.15 279.97 212.97 277.41 214.48 C274.11 216.23 272.37 219.70 270.36 222.67 C257.45 222.43 244.54 222.73 231.63 222.60 C231.23 221.17 230.42 219.79 230.48 218.28 C232.02 214.41 234.51 211.00 236.64 207.44 C258.76 207.23 280.89 207.41 303.02 207.35 C306.26 207.36 309.47 206.89 312.68 206.51 C318.99 188.69 324.59 170.62 330.81 152.76 C335.01 141.26 338.42 129.35 338.50 117.01 C340.36 116.86 342.22 116.70 344.09 116.61 C361.99 119.04 379.93 121.68 397.83 124.32 C402.13 124.81 406.39 125.63 410.62 126.55 C403.27 145.65 395.55 164.62 387.85 183.58 C378.36 207.78 368.47 231.83 358.81 255.96 C358.00 257.55 357.28 260.14 354.98 259.62 C302.96 259.67 250.95 259.66 198.94 259.64 C192.82 268.77 187.99 278.69 182.23 288.04 C183.91 290.90 185.62 293.75 187.31 296.60 C219.72 296.40 252.14 296.83 284.55 296.58 C286.89 292.12 289.20 287.47 293.01 284.04 C299.46 278.23 308.31 274.89 317.02 275.69 C323.90 276.57 330.74 279.33 335.69 284.30 C344.03 292.07 347.71 304.76 344.07 315.67 C340.38 328.98 326.77 338.79 312.95 337.73 C305.62 337.97 298.61 334.62 293.18 329.88 C289.31 326.54 286.92 321.92 284.65 317.42 C252.37 317.52 220.08 317.37 187.79 317.40 C184.23 327.96 175.12 336.50 164.06 338.49 C157.93 338.96 151.44 339.27 145.74 336.56 C136.84 332.90 130.00 324.79 127.80 315.44 C123.88 301.38 131.94 285.22 145.36 279.60 C151.47 276.43 158.54 277.23 165.16 277.52 C168.19 272.67 171.14 267.76 173.92 262.75 C174.75 261.00 175.93 259.01 175.05 257.05 C156.08 206.34 137.13 155.61 118.35 104.82 C116.85 100.91 113.30 98.43 110.51 95.50 C100.78 85.58 90.84 75.87 81.20 65.86" id="p2" />
4
+ <path d="M253.24 60.18 C263.69 56.37 275.17 55.47 286.08 57.67 C306.03 61.43 323.82 75.24 332.41 93.63 C335.86 100.47 337.10 108.10 338.47 115.57 C340.34 115.90 342.21 116.25 344.09 116.61 C342.22 116.70 340.36 116.86 338.50 117.01 C338.42 129.35 335.01 141.26 330.81 152.76 C330.91 152.05 331.11 150.61 331.21 149.90 C327.89 149.46 324.57 149.03 321.26 148.54 C324.36 145.83 326.00 142.01 327.03 138.11 C322.06 139.30 317.29 141.18 312.62 143.23 C312.54 144.58 312.47 145.93 312.39 147.28 C304.65 146.22 296.88 145.38 289.15 144.31 C296.20 144.79 303.34 144.08 309.67 140.72 C309.16 130.99 307.96 121.15 304.13 112.11 C294.74 115.07 285.26 117.86 276.27 121.91 C278.45 129.10 280.84 136.23 283.68 143.20 C281.05 142.76 278.41 142.43 275.79 142.02 C277.11 142.05 278.44 142.07 279.76 142.06 C278.04 135.54 276.02 129.08 273.04 123.01 C263.51 125.91 254.10 129.22 244.90 133.05 C245.84 134.76 246.79 136.47 247.76 138.18 C246.23 137.96 244.70 137.73 243.18 137.48 C242.91 136.63 242.38 134.93 242.11 134.08 C240.17 134.82 238.24 135.58 236.29 136.25 C234.13 135.94 231.97 135.60 229.80 135.37 C233.53 133.99 237.13 132.29 240.76 130.67 C238.29 121.32 236.29 111.85 235.33 102.22 C230.57 103.65 225.55 104.63 221.26 107.25 C219.83 107.98 219.46 109.65 219.15 111.08 C217.74 118.45 218.42 126.01 219.67 133.35 C222.15 133.94 224.63 134.56 227.13 135.09 C220.73 134.36 214.33 133.60 207.98 132.56 C208.62 132.39 209.92 132.04 210.56 131.87 C209.66 121.01 210.33 110.00 213.31 99.49 C214.95 97.03 216.72 94.62 217.77 91.82 C224.02 76.61 237.71 65.12 253.24 60.18" id="p3" />
5
+ <path d="M275.16 65.49 C285.44 65.01 295.90 68.43 304.25 74.39 C299.93 76.02 295.68 78.09 291.08 78.77 C289.26 78.22 288.12 76.47 286.74 75.25 C283.30 71.52 279.12 68.62 275.16 65.49" id="p4" />
6
+ <path d="M257.29 67.74 C260.96 67.01 264.82 64.89 268.55 66.41 C275.87 69.13 281.83 74.53 286.98 80.25 C279.76 83.40 272.26 85.85 264.77 88.30 C261.91 81.58 259.74 74.61 257.29 67.74" id="p5" />
7
+ <path d="M244.73 74.69 C246.69 71.38 250.73 70.47 253.98 68.91 C256.43 75.78 259.22 82.55 261.07 89.62 C253.86 92.39 246.55 94.88 239.17 97.13 C239.01 89.33 240.64 81.39 244.73 74.69" id="p6" />
8
+ <path d="M293.00 81.94 C298.24 80.55 303.16 77.58 308.64 77.32 C316.48 83.22 322.52 91.57 326.03 100.72 C319.66 103.33 313.07 105.32 306.68 107.85 C304.99 104.32 303.45 100.72 301.81 97.17 C299.36 91.82 295.93 87.02 293.00 81.94" id="p7" />
9
+ <path d="M223.06 99.00 C226.54 90.81 231.87 83.26 238.92 77.77 C237.24 84.66 235.54 91.61 235.40 98.75 C231.38 100.03 227.16 99.59 223.06 99.00" id="p8" />
10
+ <path d="M265.96 91.87 C273.55 88.59 281.49 86.23 289.21 83.26 C295.39 91.04 300.24 99.97 303.07 109.51 C301.21 109.62 299.35 109.77 297.49 109.73 C289.68 109.23 282.02 107.44 274.21 106.86 C272.58 106.37 270.71 105.75 269.96 104.07 C268.00 100.24 267.22 95.95 265.96 91.87" id="p9" />
11
+ <path d="M244.65 98.80 C250.62 96.97 256.46 94.72 262.47 93.04 C264.07 97.12 265.59 101.23 266.82 105.43 C266.08 105.31 264.58 105.05 263.84 104.93 C255.85 103.73 247.89 102.15 239.82 101.67 C241.19 100.36 242.79 99.29 244.65 98.80" id="p10" />
12
+ <path d="M221.08 100.93 C223.47 100.26 225.92 99.94 228.40 99.93 C226.49 101.61 224.27 102.88 221.97 103.96 C221.68 102.94 221.38 101.93 221.08 100.93" id="p11" />
13
+ <path d="M221.26 107.25 C225.55 104.63 230.57 103.65 235.33 102.22 C236.29 111.85 238.29 121.32 240.76 130.67 C237.13 132.29 233.53 133.99 229.80 135.37 C229.13 135.30 227.79 135.16 227.13 135.09 C224.63 134.56 222.15 133.94 219.67 133.35 C218.42 126.01 217.74 118.45 219.15 111.08 C219.46 109.65 219.83 107.98 221.26 107.25" id="p12" />
14
+ <path d="M238.32 101.65 C238.69 101.65 239.44 101.67 239.82 101.67 C247.89 102.15 255.85 103.73 263.84 104.93 C269.90 107.04 270.01 114.59 271.94 119.75 C262.84 123.54 253.47 126.65 244.14 129.82 C240.28 120.92 239.46 111.16 238.32 101.65" id="p13" />
15
+ <path d="M309.15 110.27 C315.15 108.26 321.12 106.14 327.11 104.09 C328.26 107.44 328.98 110.92 329.43 114.43 C328.57 114.32 326.85 114.11 325.99 114.00 C320.71 113.11 315.39 112.32 310.02 112.23 C309.80 111.74 309.37 110.76 309.15 110.27" id="p14" />
16
+ <path d="M271.10 106.60 C271.88 106.67 273.43 106.80 274.21 106.86 C282.02 107.44 289.68 109.23 297.49 109.73 C291.10 114.55 282.87 115.54 275.71 118.80 C273.39 115.07 271.97 110.89 271.10 106.60" id="p15" />
17
+ <path d="M276.27 121.91 C285.26 117.86 294.74 115.07 304.13 112.11 C307.96 121.15 309.16 130.99 309.67 140.72 C303.34 144.08 296.20 144.79 289.15 144.31 C287.33 143.93 285.51 143.52 283.68 143.20 C280.84 136.23 278.45 129.10 276.27 121.91" id="p16" />
18
+ <path d="M308.08 112.16 C308.56 112.18 309.54 112.21 310.02 112.23 C315.39 112.32 320.71 113.11 325.99 114.00 C327.22 114.33 328.42 114.74 329.63 115.15 C329.71 120.23 330.06 125.37 329.19 130.41 C328.85 131.79 328.60 133.45 327.26 134.23 C322.80 136.90 317.60 137.90 312.62 139.17 C312.24 130.00 310.00 121.09 308.08 112.16" id="p17" />
19
+ <path d="M185.01 123.02 C187.01 120.94 189.06 118.91 191.11 116.90 C197.14 121.68 202.01 127.72 207.98 132.56 C214.33 133.60 220.73 134.36 227.13 135.09 C227.79 135.16 229.13 135.30 229.80 135.37 C231.97 135.60 234.13 135.94 236.29 136.25 C238.59 136.64 240.87 137.11 243.18 137.48 C244.70 137.73 246.23 137.96 247.76 138.18 C257.11 139.42 266.44 140.80 275.79 142.02 C278.41 142.43 281.05 142.76 283.68 143.20 C285.51 143.52 287.33 143.93 289.15 144.31 C296.88 145.38 304.65 146.22 312.39 147.28 C315.36 147.60 318.31 148.07 321.26 148.54 C324.57 149.03 327.89 149.46 331.21 149.90 C331.11 150.61 330.91 152.05 330.81 152.76 C324.59 170.62 318.99 188.69 312.68 206.51 C309.47 206.89 306.26 207.36 303.02 207.35 C280.89 207.41 258.76 207.23 236.64 207.44 C234.51 211.00 232.02 214.41 230.48 218.28 C230.42 219.79 231.23 221.17 231.63 222.60 C244.54 222.73 257.45 222.43 270.36 222.67 C272.37 219.70 274.11 216.23 277.41 214.48 C279.97 212.97 283.08 213.15 285.94 213.32 C291.12 213.77 295.06 218.43 296.09 223.30 C298.02 231.30 290.33 239.91 282.14 238.75 C277.18 238.38 273.85 234.22 270.99 230.62 C258.41 230.60 245.84 230.66 233.26 230.63 C231.39 233.76 229.57 237.26 226.19 239.01 C221.21 241.88 214.45 240.56 210.72 236.26 C206.18 231.57 206.43 223.50 210.88 218.83 C213.97 215.23 218.99 214.61 223.45 214.33 C224.29 212.23 225.48 210.20 225.73 207.92 C225.75 204.40 224.22 201.13 223.07 197.87 C216.76 180.34 209.87 163.03 203.39 145.57 C200.26 135.94 190.35 131.20 185.01 123.02" id="p18" />
20
+ <path d="M244.90 133.05 C254.10 129.22 263.51 125.91 273.04 123.01 C276.02 129.08 278.04 135.54 279.76 142.06 C278.44 142.07 277.11 142.05 275.79 142.02 C266.44 140.80 257.11 139.42 247.76 138.18 C246.79 136.47 245.84 134.76 244.90 133.05" id="p19" />
21
+ <path d="M236.29 136.25 C238.24 135.58 240.17 134.82 242.11 134.08 C242.38 134.93 242.91 136.63 243.18 137.48 C240.87 137.11 238.59 136.64 236.29 136.25" id="p20" />
22
+ <path d="M312.62 143.23 C317.29 141.18 322.06 139.30 327.03 138.11 C326.00 142.01 324.36 145.83 321.26 148.54 C318.31 148.07 315.36 147.60 312.39 147.28 C312.47 145.93 312.54 144.58 312.62 143.23" id="p21" />
23
+ <path d="M307.28 144.01 C308.89 142.91 310.81 145.58 308.86 146.46 C307.25 147.55 305.34 144.90 307.28 144.01" id="p22" />
24
+ <path d="M334.44 364.50 C337.13 364.56 339.83 364.56 342.52 364.53 C342.61 382.95 342.59 401.36 342.60 419.78 C340.72 419.54 338.71 419.77 336.95 418.99 C335.99 417.77 335.28 416.38 334.50 415.05 C331.13 417.51 327.44 420.24 323.01 419.85 C318.57 420.21 314.00 418.16 311.74 414.26 C308.30 408.88 308.10 402.15 308.80 395.99 C309.63 388.95 314.97 382.17 322.23 381.16 C326.53 380.09 330.61 382.39 334.44 384.02 C334.50 377.51 334.48 371.00 334.44 364.50" id="p23" />
25
+ <path d="M143.41 370.40 C153.35 363.44 167.47 364.52 176.74 372.15 C175.45 374.12 174.16 376.09 172.89 378.07 C168.25 375.68 163.45 372.78 157.99 373.35 C150.51 373.18 143.91 379.07 142.29 386.21 C140.36 394.04 141.45 403.57 147.86 409.11 C152.13 413.05 158.33 413.23 163.78 412.54 C167.33 411.93 170.22 409.61 173.11 407.64 C174.60 409.18 176.12 410.71 177.66 412.22 C171.73 419.80 161.09 421.64 152.09 419.87 C143.82 418.24 136.85 411.76 134.26 403.80 C130.24 392.30 133.04 377.63 143.41 370.40" id="p24" />
26
+ <path d="M178.93 366.41 C181.81 366.43 184.70 366.45 187.58 366.46 C191.15 373.80 193.75 381.54 196.85 389.06 C199.50 395.69 202.23 402.30 204.41 409.10 C207.00 401.05 210.22 393.23 213.47 385.43 C216.14 379.11 217.79 372.37 221.19 366.37 C224.12 366.38 227.06 366.39 229.99 366.39 C222.35 383.96 215.94 402.03 208.42 419.64 C205.73 419.62 203.05 419.62 200.37 419.66 C193.36 401.85 185.80 384.27 178.93 366.41" id="p25" />
27
+ <path d="M53.08 366.56 C54.07 366.56 56.03 366.57 57.02 366.58 C59.99 376.33 63.12 386.04 66.10 395.79 C68.45 403.67 71.43 411.37 73.07 419.45 C71.64 418.81 70.22 418.18 68.81 417.54 C63.90 400.45 58.20 383.59 53.08 366.56" id="p26" />
28
+ <path d="M57.02 366.58 C59.94 366.60 62.94 366.20 65.80 366.93 C67.30 368.09 67.56 370.16 68.20 371.83 C70.70 380.91 73.68 389.86 75.87 399.03 C76.58 398.07 77.29 397.11 78.00 396.17 C77.41 399.59 77.49 403.08 77.87 406.52 C80.78 400.52 82.51 394.06 84.63 387.77 C87.02 380.58 89.38 373.38 91.82 366.21 C93.85 366.39 95.88 366.47 97.89 366.82 C100.03 368.84 100.44 371.96 101.47 374.60 C104.30 382.72 106.30 391.18 110.29 398.85 C110.83 401.34 111.42 403.82 112.07 406.29 C116.25 393.06 119.43 379.54 123.93 366.41 C126.82 366.48 129.71 366.51 132.60 366.59 C127.46 384.35 121.60 401.89 116.44 419.64 C113.67 419.69 110.90 419.73 108.13 419.84 C104.06 406.35 99.53 393.00 95.02 379.66 C94.47 382.07 93.95 384.49 93.38 386.91 C92.32 388.69 91.14 390.43 90.50 392.42 C87.65 401.55 84.83 410.70 81.53 419.67 C77.67 420.08 73.80 420.33 69.92 420.43 C69.55 419.46 69.18 418.50 68.81 417.54 C70.22 418.18 71.64 418.81 73.07 419.45 C71.43 411.37 68.45 403.67 66.10 395.79 C63.12 386.04 59.99 376.33 57.02 366.58" id="p27" />
29
+ <path d="M87.64 367.66 C88.84 366.71 90.38 366.53 91.82 366.21 C89.38 373.38 87.02 380.58 84.63 387.77 C82.51 394.06 80.78 400.52 77.87 406.52 C77.49 403.08 77.41 399.59 78.00 396.17 C80.06 389.57 82.26 383.01 84.45 376.46 C85.45 373.51 86.05 370.38 87.64 367.66" id="p28" />
30
+ <path d="M110.29 398.85 C113.64 388.16 116.22 377.23 119.93 366.65 C121.26 366.56 122.60 366.48 123.93 366.41 C119.43 379.54 116.25 393.06 112.07 406.29 C111.42 403.82 110.83 401.34 110.29 398.85" id="p29" />
31
+ <path d="M93.38 386.91 C93.95 384.49 94.47 382.07 95.02 379.66 C99.53 393.00 104.06 406.35 108.13 419.84 C106.82 419.76 105.51 419.70 104.20 419.64 C100.73 408.69 97.31 397.70 93.38 386.91" id="p30" />
32
+ <path d="M240.45 381.73 C245.53 380.89 251.36 380.95 255.44 384.55 C260.47 388.46 261.75 395.23 261.36 401.26 C252.58 401.58 243.79 401.33 235.01 401.45 C235.52 405.78 236.64 410.89 241.00 412.92 C246.63 415.31 252.58 412.65 257.78 410.41 C258.80 411.69 259.83 412.96 260.85 414.24 C253.37 422.03 238.99 422.70 231.76 414.24 C227.04 408.88 226.65 401.18 227.77 394.46 C229.20 388.37 234.33 383.12 240.45 381.73" id="p31" />
33
+ <path d="M276.09 385.85 C279.07 383.74 282.21 381.30 286.05 381.30 C290.21 380.89 294.83 382.15 297.38 385.66 C300.32 389.80 300.32 395.13 300.31 400.00 C300.18 406.54 300.59 413.09 299.88 419.61 C297.38 419.58 294.88 419.57 292.39 419.59 C292.34 412.04 292.43 404.50 292.37 396.95 C292.22 394.02 292.11 390.37 289.38 388.58 C284.98 386.05 278.71 388.04 276.18 392.26 C275.20 401.33 276.03 410.54 275.84 419.66 C273.33 419.61 270.82 419.59 268.31 419.58 C268.03 411.39 268.50 403.19 267.93 395.01 C267.67 390.53 267.76 386.04 268.07 381.57 C269.65 381.63 271.24 381.63 272.82 381.86 C274.32 382.78 275.06 384.48 276.09 385.85" id="p32" />
34
+ <path d="M362.54 381.76 C368.44 380.79 375.43 380.52 380.15 384.84 C384.95 388.66 386.95 395.04 386.72 401.01 C386.89 407.38 383.97 414.05 378.42 417.45 C374.26 420.20 369.00 419.98 364.24 419.55 C356.95 418.56 351.03 412.20 350.37 404.91 C350.02 400.00 349.71 394.70 352.21 390.25 C354.24 386.12 358.06 382.91 362.54 381.76" id="p33" />
35
+ <path d="M409.50 381.26 C411.81 380.14 414.33 381.12 416.67 381.59 C416.48 383.91 416.32 386.23 416.15 388.55 C412.77 388.73 409.05 388.26 406.05 390.15 C403.52 392.27 402.42 395.71 402.52 398.94 C402.49 405.78 402.68 412.61 402.48 419.44 C399.86 419.42 397.24 419.41 394.63 419.41 C394.67 406.79 394.49 394.17 394.69 381.56 C396.87 381.58 399.04 381.63 401.23 381.69 C401.44 383.79 401.63 385.89 401.81 387.99 C404.06 385.44 406.14 382.42 409.50 381.26" id="p34" />
36
+ <path d="M426.86 382.05 C433.14 379.23 440.14 381.39 445.61 384.95 C444.77 386.46 443.94 387.97 443.10 389.48 C438.67 388.10 433.45 384.99 429.04 388.07 C427.05 389.20 427.51 391.75 427.18 393.66 C432.77 397.46 440.85 397.10 445.01 402.96 C448.54 408.99 444.44 417.02 438.03 418.97 C431.50 420.68 424.21 419.88 418.70 415.77 C419.50 414.12 420.32 412.50 421.17 410.88 C425.94 412.40 431.21 416.20 436.20 413.24 C439.21 411.93 439.70 406.96 436.60 405.45 C431.65 402.58 424.89 402.74 421.17 397.88 C417.30 392.40 420.67 384.08 426.86 382.05" id="p35" />
37
+ <path d="M241.60 387.61 C244.69 386.95 248.48 386.69 250.97 389.01 C253.20 390.77 253.61 393.74 254.33 396.31 C247.93 396.56 241.51 396.60 235.11 396.33 C236.00 392.73 237.71 388.76 241.60 387.61" id="p36" />
38
+ <path d="M323.47 387.57 C327.21 386.79 332.49 387.10 334.27 391.07 C334.79 395.71 334.47 400.40 334.54 405.06 C335.59 412.84 323.62 416.76 319.06 410.94 C316.44 406.87 316.21 401.71 316.83 397.05 C317.45 393.16 319.41 388.80 323.47 387.57" id="p37" />
39
+ <path d="M364.46 387.73 C368.51 386.76 373.52 387.21 376.12 390.88 C378.70 394.66 378.78 399.58 378.39 403.99 C377.91 407.70 376.28 412.02 372.35 413.21 C368.58 414.10 363.76 414.21 361.07 410.93 C357.83 407.06 358.04 401.71 358.41 396.99 C358.73 393.24 360.61 388.95 364.46 387.73" id="p38" /></defs><g stroke-width="10pt">
40
+ <use stroke="#fff" xlink:href="#p1" />
41
+ <use stroke="#005580" xlink:href="#p2" />
42
+ <use stroke="#5e9ab8" xlink:href="#p3" />
43
+ <use stroke="#fff" xlink:href="#p4" />
44
+ <use stroke="#fff" xlink:href="#p5" />
45
+ <use stroke="#fff" xlink:href="#p6" />
46
+ <use stroke="#fff" xlink:href="#p7" />
47
+ <use stroke="#fff" xlink:href="#p8" />
48
+ <use stroke="#fff" xlink:href="#p9" />
49
+ <use stroke="#fff" xlink:href="#p10" />
50
+ <use stroke="#005580" xlink:href="#p11" />
51
+ <use stroke="#005580" xlink:href="#p12" />
52
+ <use stroke="#005580" xlink:href="#p13" />
53
+ <use stroke="#fff" xlink:href="#p14" />
54
+ <use stroke="#005580" xlink:href="#p15" />
55
+ <use stroke="#005580" xlink:href="#p16" />
56
+ <use stroke="#005580" xlink:href="#p17" />
57
+ <use stroke="#fff" xlink:href="#p18" />
58
+ <use stroke="#005580" xlink:href="#p19" />
59
+ <use stroke="#005580" xlink:href="#p20" />
60
+ <use stroke="#005580" xlink:href="#p21" />
61
+ <use stroke="#005580" xlink:href="#p22" />
62
+ <use stroke="#5e9ab8" xlink:href="#p23" />
63
+ <use stroke="#5e9ab8" xlink:href="#p24" />
64
+ <use stroke="#5e9ab8" xlink:href="#p25" />
65
+ <use stroke="#005580" xlink:href="#p26" />
66
+ <use stroke="#5e9ab8" xlink:href="#p27" />
67
+ <use stroke="#005580" xlink:href="#p28" />
68
+ <use stroke="#005580" xlink:href="#p29" />
69
+ <use stroke="#005580" xlink:href="#p30" />
70
+ <use stroke="#5e9ab8" xlink:href="#p31" />
71
+ <use stroke="#5e9ab8" xlink:href="#p32" />
72
+ <use stroke="#5e9ab8" xlink:href="#p33" />
73
+ <use stroke="#5e9ab8" xlink:href="#p34" />
74
+ <use stroke="#5e9ab8" xlink:href="#p35" />
75
+ <use stroke="#fff" xlink:href="#p36" />
76
+ <use stroke="#fff" xlink:href="#p37" />
77
+ <use stroke="#fff" xlink:href="#p38" /></g><g>
78
+ <use xlink:href="#p1" fill="#fff" />
79
+ <use xlink:href="#p2" fill="#005580" />
80
+ <use xlink:href="#p3" fill="#5e9ab8" />
81
+ <use xlink:href="#p4" fill="#fff" />
82
+ <use xlink:href="#p5" fill="#fff" />
83
+ <use xlink:href="#p6" fill="#fff" />
84
+ <use xlink:href="#p7" fill="#fff" />
85
+ <use xlink:href="#p8" fill="#fff" />
86
+ <use xlink:href="#p9" fill="#fff" />
87
+ <use xlink:href="#p10" fill="#fff" />
88
+ <use xlink:href="#p11" fill="#005580" />
89
+ <use xlink:href="#p12" fill="#005580" />
90
+ <use xlink:href="#p13" fill="#005580" />
91
+ <use xlink:href="#p14" fill="#fff" />
92
+ <use xlink:href="#p15" fill="#005580" />
93
+ <use xlink:href="#p16" fill="#005580" />
94
+ <use xlink:href="#p17" fill="#005580" />
95
+ <use xlink:href="#p18" fill="#fff" />
96
+ <use xlink:href="#p19" fill="#005580" />
97
+ <use xlink:href="#p20" fill="#005580" />
98
+ <use xlink:href="#p21" fill="#005580" />
99
+ <use xlink:href="#p22" fill="#005580" />
100
+ <use xlink:href="#p23" fill="#5e9ab8" />
101
+ <use xlink:href="#p24" fill="#5e9ab8" />
102
+ <use xlink:href="#p25" fill="#5e9ab8" />
103
+ <use xlink:href="#p26" fill="#005580" />
104
+ <use xlink:href="#p27" fill="#5e9ab8" />
105
+ <use xlink:href="#p28" fill="#005580" />
106
+ <use xlink:href="#p29" fill="#005580" />
107
+ <use xlink:href="#p30" fill="#005580" />
108
+ <use xlink:href="#p31" fill="#5e9ab8" />
109
+ <use xlink:href="#p32" fill="#5e9ab8" />
110
+ <use xlink:href="#p33" fill="#5e9ab8" />
111
+ <use xlink:href="#p34" fill="#5e9ab8" />
112
+ <use xlink:href="#p35" fill="#5e9ab8" />
113
+ <use xlink:href="#p36" fill="#fff" />
114
+ <use xlink:href="#p37" fill="#fff" />
115
+ <use xlink:href="#p38" fill="#fff" /></g></svg>
assets/screenshot-1.png ADDED
Binary file
assets/screenshot-2.png ADDED
Binary file
assets/screenshot-3.png ADDED
Binary file
assets/screenshot-4.png ADDED
Binary file
assets/screenshot-5.png ADDED
Binary file
assets/screenshot-6.png ADDED
Binary file
assets/screenshot-7.png ADDED
Binary file
changelog.txt CHANGED
@@ -1,5 +1,15 @@
1
  Changelog for WC Vendors
2
 
 
 
 
 
 
 
 
 
 
 
3
  Version 1.9.11
4
 
5
  * Fixed: Correct product id being parsed to shipping function
1
  Changelog for WC Vendors
2
 
3
+ Version 1.9.12
4
+
5
+ * Added: For hook for vendor order content
6
+ * Updated: Portuguese translations thanks Elsa
7
+ * Updated: Show SKU in emails as per pre WC3.0 updates
8
+ * Fixed: Static reference calls in commision class
9
+ * Fixed: Shipping tax bug in vendor calculations
10
+ * Fixed: Variations showing $0 price in emails thanks damanmehta
11
+ * Fixed: Prevent PHP notice for getting non-existing vendor name from JeroenSormani/master
12
+
13
  Version 1.9.11
14
 
15
  * Fixed: Correct product id being parsed to shipping function
class-wc-vendors.php CHANGED
@@ -8,9 +8,9 @@
8
  * Author URI: https://www.wcvendors.com
9
  * GitHub Plugin URI: https://github.com/wcvendors/wcvendors
10
  *
11
- * Version: 1.9.11
12
  * Requires at least: 4.4.0
13
- * Tested up to: 4.7.1
14
  *
15
  * Text Domain: wcvendors
16
  * Domain Path: /languages/
@@ -72,7 +72,7 @@ if ( wcv_is_woocommerce_activated() ) {
72
  if ( !defined( 'wcv_plugin_dir_path' ) ) define( 'wcv_plugin_dir_path', untrailingslashit( plugin_dir_path( __FILE__ ) ) );
73
 
74
 
75
- define('WCV_VERSION', '1.9.11' );
76
 
77
  /**
78
  * Main Product Vendor class
8
  * Author URI: https://www.wcvendors.com
9
  * GitHub Plugin URI: https://github.com/wcvendors/wcvendors
10
  *
11
+ * Version: 1.9.12
12
  * Requires at least: 4.4.0
13
+ * Tested up to: 4.8.0
14
  *
15
  * Text Domain: wcvendors
16
  * Domain Path: /languages/
72
  if ( !defined( 'wcv_plugin_dir_path' ) ) define( 'wcv_plugin_dir_path', untrailingslashit( plugin_dir_path( __FILE__ ) ) );
73
 
74
 
75
+ define('WCV_VERSION', '1.9.12' );
76
 
77
  /**
78
  * Main Product Vendor class
classes/admin/emails/class-wc-notify-vendor.php CHANGED
@@ -196,7 +196,10 @@ class WC_Email_Notify_Vendor extends WC_Email
196
 
197
  $order_id = ( version_compare( WC_VERSION, '2.7', '<' ) ) ? $order->id : $order->get_id();
198
 
199
- $commission_due = WCV_Commission::get_commission_due( $order_id, $product[ 'product_id' ], $author );
 
 
 
200
 
201
  $items[ $key ][ 'line_subtotal' ] = $commission_due;
202
  $items[ $key ][ 'line_total' ] = $commission_due;
196
 
197
  $order_id = ( version_compare( WC_VERSION, '2.7', '<' ) ) ? $order->id : $order->get_id();
198
 
199
+ // Get correct product_id depending on which product type
200
+ $product_id = !empty( $product['variation_id'] ) ? $product['variation_id'] : $product['product_id'];
201
+
202
+ $commission_due = WCV_Commission::get_commission_due( $order_id, $product_id, $author );
203
 
204
  $items[ $key ][ 'line_subtotal' ] = $commission_due;
205
  $items[ $key ][ 'line_total' ] = $commission_due;
classes/class-commission.php CHANGED
@@ -81,7 +81,7 @@ class WCV_Commission
81
  *
82
  * @return unknown
83
  */
84
- public function reverse_due_commission( $order_id )
85
  {
86
  global $wpdb;
87
 
@@ -90,7 +90,7 @@ class WCV_Commission
90
  if ( !$count ) return false;
91
 
92
  // Deduct this amount from the vendor's total due
93
- $results = WCV_Commission::sum_total_due_for_order( $order_id );
94
  $ids = implode( ',', $results[ 'ids' ] );
95
  $table_name = $wpdb->prefix . "pv_commission";
96
 
@@ -159,7 +159,7 @@ class WCV_Commission
159
  *
160
  * @return array
161
  */
162
- public function sum_total_due_for_order( $order_id, $status = 'due' )
163
  {
164
  global $wpdb;
165
 
81
  *
82
  * @return unknown
83
  */
84
+ public static function reverse_due_commission( $order_id )
85
  {
86
  global $wpdb;
87
 
90
  if ( !$count ) return false;
91
 
92
  // Deduct this amount from the vendor's total due
93
+ $results = WCV_Commission::sum_total_due_for_order( $order_id );
94
  $ids = implode( ',', $results[ 'ids' ] );
95
  $table_name = $wpdb->prefix . "pv_commission";
96
 
159
  *
160
  * @return array
161
  */
162
+ public static function sum_total_due_for_order( $order_id, $status = 'due' )
163
  {
164
  global $wpdb;
165
 
classes/class-vendors.php CHANGED
@@ -188,7 +188,7 @@ class WCV_Vendors
188
  // Add remainders on end to admin
189
  $discount = $order->get_total_discount();
190
  $shipping = round( ( $order->get_total_shipping() - $shipping_given ), 2 );
191
- $tax = round(( $order->get_total_tax() + $order->get_shipping_tax() ) - $tax_given, 2);
192
  $total = ( $tax + $shipping ) - $discount;
193
 
194
  if ( $group ) {
@@ -399,7 +399,7 @@ class WCV_Vendors
399
  {
400
  $vendor_id = self::get_vendor_id( $vendor_id );
401
  $name = $vendor_id ? get_user_meta( $vendor_id, 'pv_shop_name', true ) : false;
402
- $shop_name = !$name ? get_userdata( $vendor_id )->user_login : $name;
403
 
404
  return $shop_name;
405
  }
@@ -485,6 +485,7 @@ class WCV_Vendors
485
  * @return void
486
  */
487
  public static function create_child_orders ( $order_id ) {
 
488
  $order = wc_get_order( $order_id );
489
  $items = $order->get_items();
490
  $vendor_items = array();
188
  // Add remainders on end to admin
189
  $discount = $order->get_total_discount();
190
  $shipping = round( ( $order->get_total_shipping() - $shipping_given ), 2 );
191
+ $tax = round( $order->get_total_tax() - $tax_given, 2);
192
  $total = ( $tax + $shipping ) - $discount;
193
 
194
  if ( $group ) {
399
  {
400
  $vendor_id = self::get_vendor_id( $vendor_id );
401
  $name = $vendor_id ? get_user_meta( $vendor_id, 'pv_shop_name', true ) : false;
402
+ $shop_name = ( ! $name && $vendor = get_userdata( $vendor_id ) ) ? $vendor->user_login : $name;
403
 
404
  return $shop_name;
405
  }
485
  * @return void
486
  */
487
  public static function create_child_orders ( $order_id ) {
488
+
489
  $order = wc_get_order( $order_id );
490
  $items = $order->get_items();
491
  $vendor_items = array();
languages/wcvendors-es_ES.mo CHANGED
Binary file
languages/wcvendors-es_ES.po CHANGED
@@ -1,15 +1,15 @@
1
  msgid ""
2
  msgstr ""
3
  "Project-Id-Version: WC Vendors\n"
4
- "POT-Creation-Date: 2015-05-25 19:33-0500\n"
5
- "PO-Revision-Date: 2015-05-25 19:33-0500\n"
6
  "Last-Translator: Dto2y3d <masyoututoriales@gmail.com>\n"
7
  "Language-Team: WC Vendors <support@wcvendors.com>\n"
8
  "Language: es\n"
9
  "MIME-Version: 1.0\n"
10
  "Content-Type: text/plain; charset=UTF-8\n"
11
  "Content-Transfer-Encoding: 8bit\n"
12
- "X-Generator: Poedit 1.7.5\n"
13
  "X-Poedit-Basepath: .\n"
14
  "Plural-Forms: nplurals=2; plural=n != 1;\n"
15
  "X-Poedit-SourceCharset: UTF-8\n"
@@ -17,435 +17,747 @@ msgstr ""
17
  "X-Poedit-SearchPath-0: .\n"
18
  "X-Poedit-SearchPath-1: ..\n"
19
 
20
- #: ../class-wc-vendors.php:72 ../classes/admin/class-admin-reports.php:41
21
- #: ../classes/admin/class-admin-users.php:371
 
 
 
 
 
 
 
 
 
 
22
  msgid "WC Vendors"
23
  msgstr "WC Vendors"
24
 
25
- #: ../class-wc-vendors.php:99
26
  msgid ""
27
- "<b>WC Vendors is disabled</b>. WC Vendors requires a minimum of WooCommerce "
28
- "v2.2.0."
29
  msgstr ""
30
- "<b>WC vendedores está deshabilitado</b>. WC vendedores requiere como mínimo "
31
- "WooCommerce v2.2.0."
32
 
33
- #: ../class-wc-vendors.php:226 ../classes/admin/settings/sf-options.php:160
 
 
34
  msgid "Capabilities"
35
  msgstr "Capacidades"
36
 
37
- #: ../class-wc-vendors.php:250 ../classes/admin/settings/sf-options.php:4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
38
  msgid "General"
39
  msgstr "General"
40
 
41
- #: ../class-wc-vendors.php:285
42
  msgid "Documentation/KB"
43
- msgstr "Documentación/KB"
44
 
45
- #: ../class-wc-vendors.php:286
46
  msgid "Help Forums"
47
  msgstr "Foros de ayuda"
48
 
49
- #: ../class-wc-vendors.php:287
50
  msgid "Paid Support"
51
- msgstr "Soporte pagado"
52
 
53
- #: ../class-wc-vendors.php:309
54
- #, php-format
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
55
  msgid ""
56
- "WC Vendors requires the Vendor shop page value be set <a href=\"%s\">click "
57
- "here to set it.</a> | <a href=\"%s\">Hide Notice</a>"
58
  msgstr ""
59
- "WC vendedores requiere fijar el valor de la pagina tienda del vendedor <a "
60
- "href=\"%s\">haga clic aquí para definirlo</a> | <a href=\"%s\">Ocultar "
61
- "aviso</a>"
62
 
63
- #: ../class-wc-vendors.php:317
64
- #, php-format
 
 
 
 
 
 
 
 
 
 
65
  msgid ""
66
- "You must save your permalinks once you have modified your vendor page. <a "
67
- "href=\"%s\">click here to save</a>. | <a href=\"%s\">Hide Notice</a>"
68
  msgstr ""
69
- "Una vez que ha modificado su página vendedor debe guardar tus enlaces "
70
- "permanentes. <a href=\"%s\">haga clic aquí para guardar</a>. | <a href=\"%s"
71
- "\">Ocultar aviso</a>"
72
 
73
- #: ../classes/admin/class-admin-page.php:27
74
- msgid "Vendors shipped"
75
- msgstr "Vendedores han despachado"
 
 
 
76
 
77
- #: ../classes/admin/class-admin-page.php:50
78
- msgid "Vendors Shipped"
79
- msgstr "Vendedores han despachado"
 
80
 
81
- #: ../classes/admin/class-admin-page.php:72
82
- #: ../classes/admin/class-admin-page.php:132
83
- #: ../classes/admin/class-admin-reports.php:339
84
- #: ../classes/admin/class-product-meta.php:149
85
- #: ../classes/admin/class-product-meta.php:165
86
- #: ../templates/dashboard/reports.php:19
87
- msgid "Commission"
88
- msgstr "Comisión"
89
 
90
- #: ../classes/admin/class-admin-page.php:251
91
- #: ../classes/admin/class-admin-reports.php:168
 
 
 
 
 
92
  #: ../templates/dashboard/reports.php:17
93
  #: ../templates/emails/admin-new-order.php:22
94
- #: ../templates/emails/notify-vendor-shipped.php:22
95
- #: ../templates/emails/vendor-new-order.php:22
 
 
 
 
 
 
96
  msgid "Product"
97
  msgstr "Producto"
98
 
99
- #: ../classes/admin/class-admin-page.php:252
100
- #: ../classes/admin/class-vendor-admin-dashboard.php:253
 
 
101
  msgid "Order ID"
102
- msgstr "ID de la Orden"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
103
 
104
- #: ../classes/admin/class-admin-page.php:253
105
- #: ../classes/admin/class-admin-reports.php:169
106
- #: ../classes/admin/class-product-meta.php:44
107
- #: ../classes/admin/class-product-meta.php:185
108
- #: ../classes/admin/class-product-meta.php:221
109
- msgid "Vendor"
110
- msgstr "Vendedor"
111
 
112
- #: ../classes/admin/class-admin-page.php:254
113
- #: ../classes/admin/class-admin-reports.php:170
114
- #: ../classes/admin/class-admin-reports.php:344
115
- #: ../classes/admin/class-admin-reports.php:368
116
- #: ../classes/admin/class-vendor-admin-dashboard.php:256
117
- #: ../templates/dashboard/orders.php:35
 
 
 
 
118
  msgid "Total"
119
  msgstr "Total"
120
 
121
- #: ../classes/admin/class-admin-page.php:255
122
- #: ../classes/admin/class-admin-reports.php:172
 
 
 
 
123
  msgid "Status"
124
  msgstr "Estado"
125
 
126
- #: ../classes/admin/class-admin-page.php:256
127
- #: ../classes/admin/class-vendor-admin-dashboard.php:257
128
- #: ../classes/front/orders/class-orders.php:216
129
- #: ../templates/dashboard/orders.php:36
 
 
 
 
130
  msgid "Date"
131
  msgstr "Fecha"
132
 
133
- #: ../classes/admin/class-admin-page.php:293
 
134
  msgid "Mark paid"
135
  msgstr "Marcar pagado"
136
 
137
- #: ../classes/admin/class-admin-page.php:294
 
138
  msgid "Mark due"
139
  msgstr "Marcar adeudado"
140
 
141
- #: ../classes/admin/class-admin-page.php:295
 
142
  msgid "Mark reversed"
143
  msgstr "Marcar revertido"
144
 
145
- #: ../classes/admin/class-admin-page.php:312
146
- #: ../classes/admin/class-admin-page.php:316
147
  msgid "Filter"
148
  msgstr "Filtrar"
149
 
150
- #: ../classes/admin/class-admin-page.php:351
 
151
  msgid "Show all dates"
152
  msgstr "Todas las fechas"
153
 
154
- #: ../classes/admin/class-admin-page.php:364
 
155
  #, php-format
156
  msgid "%1$s %2$d"
157
  msgstr "%1$s %2$d"
158
 
159
- #: ../classes/admin/class-admin-page.php:386
 
160
  msgid "Show all Statuses"
161
- msgstr "Mostrar todos los Estados"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
162
 
163
- #: ../classes/admin/class-admin-page.php:412
 
 
 
 
 
 
 
 
 
 
 
 
164
  msgid "Commission marked paid."
165
  msgstr "Comisión marcada pagada."
166
 
167
- #: ../classes/admin/class-admin-page.php:419
 
168
  msgid "Commission marked due."
169
  msgstr "Comisión marcada adeudada."
170
 
171
- #: ../classes/admin/class-admin-page.php:426
 
172
  msgid "Commission marked reversed."
173
  msgstr "Comisión marcada revertida."
174
 
175
  #: ../classes/admin/class-admin-reports.php:44
 
176
  msgid "Overview"
177
  msgstr "Resumen"
178
 
179
  #: ../classes/admin/class-admin-reports.php:50
 
180
  msgid "Commission by vendor"
181
  msgstr "Comisión por vendedor"
182
 
183
  #: ../classes/admin/class-admin-reports.php:56
 
184
  msgid "Commission by product"
185
  msgstr "Comisión por producto"
186
 
187
- #: ../classes/admin/class-admin-reports.php:115
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
188
  #: ../templates/dashboard/date-picker.php:3
 
 
 
189
  msgid "From:"
190
- msgstr "De:"
191
 
192
- #: ../classes/admin/class-admin-reports.php:117
 
193
  #: ../templates/dashboard/date-picker.php:7
 
 
 
194
  msgid "To:"
195
- msgstr "Para:"
196
 
197
- #: ../classes/admin/class-admin-reports.php:119
198
- #: ../classes/admin/class-admin-reports.php:277
 
199
  #: ../templates/dashboard/date-picker.php:12
 
 
 
 
200
  msgid "Show"
201
- msgstr "Mostrar"
202
 
203
- #: ../classes/admin/class-admin-reports.php:125
 
204
  msgid "Total paid in range"
205
  msgstr "Total pagado en el rango"
206
 
207
- #: ../classes/admin/class-admin-reports.php:128
208
- #: ../classes/admin/class-admin-reports.php:135
209
- #: ../classes/admin/class-admin-reports.php:142
 
 
 
210
  msgid "n/a"
211
- msgstr "n/a"
212
 
213
- #: ../classes/admin/class-admin-reports.php:132
 
214
  msgid "Total due in range"
215
  msgstr "Total adeudado en el rango"
216
 
217
- #: ../classes/admin/class-admin-reports.php:139
 
218
  msgid "Total reversed in range"
219
  msgstr "Total revertido en el rango"
220
 
221
- #: ../classes/admin/class-admin-reports.php:149
 
222
  msgid "Recent Commission"
223
- msgstr "Comisión Reciente"
224
-
225
- #: ../classes/admin/class-admin-reports.php:167
226
- #: ../classes/front/orders/class-orders.php:208
227
- #: ../templates/dashboard/orders.php:33
 
 
 
228
  msgid "Order"
229
- msgstr "Orden"
230
 
231
- #: ../classes/admin/class-admin-reports.php:171
 
232
  msgid "Date &amp; Time"
233
- msgstr "Fecha &amp; Hora"
234
 
235
- #: ../classes/admin/class-admin-reports.php:180
 
236
  msgid "N/A"
237
  msgstr "N/A"
238
 
239
- #: ../classes/admin/class-admin-reports.php:185
 
240
  msgid "D j M Y \\a\\t h:ia"
241
  msgstr "D j M Y \\a\\t h:ia"
242
 
243
- #: ../classes/admin/class-admin-reports.php:194
 
244
  msgid "No commission yet"
245
  msgstr "No hay comisión aún"
246
 
247
- #: ../classes/admin/class-admin-reports.php:228
 
248
  msgid "Show:"
249
- msgstr "Mostrar:"
250
 
251
- #: ../classes/admin/class-admin-reports.php:237
 
252
  msgid "Search for a product&hellip;"
253
- msgstr "Busca un producto ..."
254
 
255
- #: ../classes/admin/class-admin-reports.php:240
 
256
  msgid "Type in a product name to start searching..."
257
- msgstr "Escriba un nombre de producto para comenzar la búsqueda..."
258
 
259
- #: ../classes/admin/class-admin-reports.php:272
 
260
  msgid "Select a vendor&hellip;"
261
  msgstr "Seleccionar un vendedor&hellip;"
262
 
263
- #: ../classes/admin/class-admin-reports.php:338
 
264
  msgid "Month"
265
  msgstr "Mes"
266
 
267
- #: ../classes/admin/class-admin-reports.php:340
268
- msgid "Tax"
269
- msgstr "Impuesto"
 
270
 
271
- #: ../classes/admin/class-admin-reports.php:341
272
- #: ../classes/admin/settings/sf-options.php:46
273
- #: ../templates/dashboard/orders.php:34 ../templates/orders/orders.php:113
274
- msgid "Shipping"
275
- msgstr "Despacho"
276
 
277
- #: ../classes/admin/class-admin-reports.php:342
278
- msgid "Reversed"
279
- msgstr "Revertido"
 
280
 
281
- #: ../classes/admin/class-admin-reports.php:343
282
- msgid "Paid"
283
- msgstr "Pagado"
 
284
 
285
- #: ../classes/admin/class-admin-users.php:381
 
286
  msgid "Enable HTML for the shop description"
287
  msgstr "Permitir HTML en la descripción de la tienda"
288
 
289
- #: ../classes/admin/class-admin-users.php:387
 
290
  msgid "Shop name"
291
  msgstr "Nombre de la tienda"
292
 
293
- #: ../classes/admin/class-admin-users.php:394
 
294
  msgid "PayPal E-mail"
295
- msgstr "E-mail de PayPal"
296
 
297
- #: ../classes/admin/class-admin-users.php:395
 
298
  msgid "required"
299
  msgstr "requerido"
300
 
301
- #: ../classes/admin/class-admin-users.php:402
 
302
  msgid "Commission rate"
303
- msgstr "Taza de comisión"
304
 
305
- #: ../classes/admin/class-admin-users.php:403
306
- #: ../classes/admin/class-product-meta.php:172
 
 
307
  msgid "Leave blank for default"
308
- msgstr "Dejar en blanco para \"por defecto\""
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
309
 
310
- #: ../classes/admin/class-admin-users.php:409
311
  #: ../classes/admin/views/html-vendor-settings-page.php:30
312
- #: ../classes/front/class-vendor-shop.php:105
313
  #: ../templates/dashboard/settings/seller-info.php:3
 
 
 
314
  msgid "Seller info"
315
  msgstr "Información del vendedor"
316
 
317
- #: ../classes/admin/class-admin-users.php:414
 
318
  msgid "Shop description"
319
  msgstr "Descripción de la tienda"
320
 
321
- #: ../classes/admin/class-vendor-admin-dashboard.php:19
322
- #: ../classes/class-install.php:166
 
 
323
  msgid "Shop Settings"
324
- msgstr "Ajustes de Tienda"
325
-
326
- #: ../classes/admin/class-vendor-admin-dashboard.php:20
327
- #: ../classes/admin/class-vendor-admin-dashboard.php:140
328
- #: ../classes/admin/settings/sf-options.php:164
329
- #: ../classes/class-install.php:165 ../templates/dashboard/orders.php:24
 
 
 
 
 
330
  msgid "Orders"
331
- msgstr "Órdenes"
332
 
333
- #: ../classes/admin/class-vendor-admin-dashboard.php:52
334
- #: ../classes/front/dashboard/class-vendor-dashboard.php:101
 
 
335
  msgid "Your PayPal address is not a valid email address."
336
  msgstr "Tu dirección de PayPal no es una dirección de email válida."
337
 
338
- #: ../classes/admin/class-vendor-admin-dashboard.php:61
339
- #: ../classes/front/dashboard/class-vendor-dashboard.php:110
 
 
340
  msgid "That shop name is already taken. Your shop name must be unique."
341
  msgstr "Ese nombre de tienda ya está tomado. Tu tienda debe ser única."
342
 
343
- #: ../classes/admin/class-vendor-admin-dashboard.php:81
344
- #: ../classes/admin/settings/classes/sf-class-settings.php:366
345
- #: ../classes/front/dashboard/class-vendor-dashboard.php:128
 
 
 
346
  msgid "Settings saved."
347
  msgstr "Ajustes guardados."
348
 
349
- #: ../classes/admin/class-vendor-admin-dashboard.php:254
 
 
 
 
 
 
 
 
 
 
 
350
  msgid "Customer"
351
  msgstr "Cliente"
352
 
353
- #: ../classes/admin/class-vendor-admin-dashboard.php:255
354
- #: ../classes/admin/settings/sf-options.php:96
355
- #: ../classes/admin/settings/sf-options.php:222
 
 
 
356
  msgid "Products"
357
  msgstr "Productos"
358
 
359
- #: ../classes/admin/class-vendor-admin-dashboard.php:258
 
 
 
360
  msgid "Shipped"
361
  msgstr "Enviado"
362
 
363
- #: ../classes/admin/class-vendor-admin-dashboard.php:291
364
- #: ../templates/dashboard/orders.php:75
 
 
365
  msgid "Mark shipped"
366
- msgstr "Marcar enviado"
367
 
368
- #: ../classes/admin/class-vendor-admin-dashboard.php:315
 
369
  msgid "Orders marked shipped."
370
  msgstr "Pedidos marcados como enviados."
371
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
372
  #: ../classes/admin/class-vendor-applicants.php:26
 
373
  msgid "Approve"
374
  msgstr "Aprobar"
375
 
376
  #: ../classes/admin/class-vendor-applicants.php:27
 
377
  msgid "Deny"
378
  msgstr "Rechazar"
379
 
380
- #: ../classes/admin/class-vendor-applicants.php:71
 
381
  msgid "Vendor has been <b>denied</b>."
382
- msgstr "Vendedor ha sido <b>rechazado</b>"
383
 
384
- #: ../classes/admin/class-vendor-applicants.php:82
 
385
  msgid "Vendor has been <b>approved</b>."
386
  msgstr "Vendedor ha sido <b>aprobado</b>."
387
 
388
- #: ../classes/admin/class-vendor-applicants.php:96
 
389
  msgid "Pending Vendors"
390
- msgstr "Vendedores Pendientes"
391
 
392
- #: ../classes/admin/emails/class-emails.php:55
393
  #: ../classes/admin/emails/class-wc-approve-vendor.php:70
 
 
394
  msgid "pending"
395
  msgstr "pendientes"
396
 
397
- #: ../classes/admin/emails/class-emails.php:57
 
398
  msgid "approved"
399
  msgstr "aprobados"
400
 
401
- #: ../classes/admin/emails/class-emails.php:59
 
402
  msgid "denied"
403
  msgstr "denegados"
404
 
405
- #: ../classes/admin/emails/class-emails.php:86
406
- #: ../classes/front/class-vendor-cart.php:59
407
- #: ../classes/front/class-vendor-shop.php:180
408
- msgid "Sold by: "
409
- msgstr "En venta por: "
410
-
411
  #: ../classes/admin/emails/class-wc-approve-vendor.php:28
 
412
  msgid "Vendor Application"
413
- msgstr "Postulación del Vendedor"
414
 
415
  #: ../classes/admin/emails/class-wc-approve-vendor.php:29
 
416
  msgid "Vendor application will either be approved, denied, or pending."
417
- msgstr "La postulación del Vendedor puede ser aprobada, denegada o pendiente."
418
 
419
  #: ../classes/admin/emails/class-wc-approve-vendor.php:31
 
420
  msgid "Application {status}"
421
  msgstr "Postulación {status}"
422
 
423
  #: ../classes/admin/emails/class-wc-approve-vendor.php:32
 
424
  msgid "[{blogname}] Your vendor application has been {status}"
425
  msgstr "[{blogname}] Tu postulación a vendedor está {status}"
426
 
427
  #: ../classes/admin/emails/class-wc-approve-vendor.php:123
428
- #: ../classes/admin/emails/class-wc-notify-admin.php:138
429
- #: ../classes/admin/emails/class-wc-notify-shipped.php:163
430
- #: ../classes/admin/emails/class-wc-notify-vendor.php:247
431
  #: ../classes/gateways/WCV_Gateway_Test/class-wcv-gateway-test.php:62
 
 
 
 
 
432
  msgid "Enable/Disable"
433
- msgstr "Habilitar/Deshabilitar"
434
 
435
  #: ../classes/admin/emails/class-wc-approve-vendor.php:125
436
- #: ../classes/admin/emails/class-wc-notify-admin.php:140
437
- #: ../classes/admin/emails/class-wc-notify-shipped.php:165
438
- #: ../classes/admin/emails/class-wc-notify-vendor.php:249
 
 
 
 
439
  msgid "Enable this email notification"
440
- msgstr "Habilitar notificación por email"
441
 
442
  #: ../classes/admin/emails/class-wc-approve-vendor.php:129
443
- #: ../classes/admin/emails/class-wc-notify-admin.php:144
 
 
444
  msgid "Recipient(s)"
445
  msgstr "Receptor(es)"
446
 
447
  #: ../classes/admin/emails/class-wc-approve-vendor.php:131
448
- #: ../classes/admin/emails/class-wc-notify-admin.php:146
 
 
449
  #, php-format
450
  msgid ""
451
  "Enter recipients (comma separated) for this email. Defaults to <code>%s</"
@@ -455,200 +767,347 @@ msgstr ""
455
  "<code>%s</code>."
456
 
457
  #: ../classes/admin/emails/class-wc-approve-vendor.php:136
458
- #: ../classes/admin/emails/class-wc-notify-admin.php:151
459
- #: ../classes/admin/emails/class-wc-notify-shipped.php:169
460
- #: ../classes/admin/emails/class-wc-notify-vendor.php:253
 
 
 
 
461
  msgid "Subject"
462
  msgstr "Asunto"
463
 
464
  #: ../classes/admin/emails/class-wc-approve-vendor.php:138
465
- #: ../classes/admin/emails/class-wc-notify-admin.php:153
466
- #: ../classes/admin/emails/class-wc-notify-shipped.php:171
467
- #: ../classes/admin/emails/class-wc-notify-vendor.php:255
 
 
 
 
468
  #, php-format
469
  msgid ""
470
  "This controls the email subject line. Leave blank to use the default "
471
  "subject: <code>%s</code>."
472
  msgstr ""
473
- "Esto controla el asunto del email. Dejar en blanco para usar el por defecto: "
474
- "<code>%s</code>."
475
 
476
  #: ../classes/admin/emails/class-wc-approve-vendor.php:143
477
- #: ../classes/admin/emails/class-wc-notify-admin.php:158
478
- #: ../classes/admin/emails/class-wc-notify-shipped.php:176
479
- #: ../classes/admin/emails/class-wc-notify-vendor.php:260
 
 
 
 
480
  msgid "Email Heading"
481
- msgstr "Título del Email"
482
 
483
  #: ../classes/admin/emails/class-wc-approve-vendor.php:145
484
- #: ../classes/admin/emails/class-wc-notify-admin.php:160
485
- #: ../classes/admin/emails/class-wc-notify-shipped.php:178
486
- #: ../classes/admin/emails/class-wc-notify-vendor.php:262
 
 
 
 
487
  #, php-format
488
  msgid ""
489
  "This controls the main heading contained within the email notification. "
490
  "Leave blank to use the default heading: <code>%s</code>."
491
  msgstr ""
492
  "Esto controla el título principal de la notificación por email. Dejar en "
493
- "blanco para utilizar el por defecto: <code>%s</code>."
494
 
495
  #: ../classes/admin/emails/class-wc-approve-vendor.php:150
496
- #: ../classes/admin/emails/class-wc-notify-admin.php:165
497
- #: ../classes/admin/emails/class-wc-notify-shipped.php:183
498
- #: ../classes/admin/emails/class-wc-notify-vendor.php:267
 
 
 
 
499
  msgid "Email type"
500
  msgstr "Tipo de email"
501
 
502
  #: ../classes/admin/emails/class-wc-approve-vendor.php:152
503
- #: ../classes/admin/emails/class-wc-notify-admin.php:167
504
- #: ../classes/admin/emails/class-wc-notify-shipped.php:185
505
- #: ../classes/admin/emails/class-wc-notify-vendor.php:269
 
 
 
 
506
  msgid "Choose which format of email to send."
507
  msgstr "Elegir cuál formato de email se mandará."
508
 
509
  #: ../classes/admin/emails/class-wc-approve-vendor.php:156
510
- #: ../classes/admin/emails/class-wc-notify-admin.php:171
511
- #: ../classes/admin/emails/class-wc-notify-shipped.php:189
512
- #: ../classes/admin/emails/class-wc-notify-vendor.php:273
 
 
 
 
513
  msgid "Plain text"
514
  msgstr "Texto plano"
515
 
516
  #: ../classes/admin/emails/class-wc-approve-vendor.php:157
517
- #: ../classes/admin/emails/class-wc-notify-admin.php:172
518
- #: ../classes/admin/emails/class-wc-notify-shipped.php:190
519
- #: ../classes/admin/emails/class-wc-notify-vendor.php:274
 
 
 
 
520
  msgid "HTML"
521
  msgstr "HTML"
522
 
523
  #: ../classes/admin/emails/class-wc-approve-vendor.php:158
524
- #: ../classes/admin/emails/class-wc-notify-admin.php:173
525
- #: ../classes/admin/emails/class-wc-notify-shipped.php:191
526
- #: ../classes/admin/emails/class-wc-notify-vendor.php:275
 
 
 
 
527
  msgid "Multipart"
528
  msgstr "Multiparte"
529
 
530
  #: ../classes/admin/emails/class-wc-notify-admin.php:28
 
531
  msgid "New Vendor Product"
532
- msgstr "Nuevo Producto del Vendedor"
533
 
534
  #: ../classes/admin/emails/class-wc-notify-admin.php:29
 
535
  msgid "New order emails are sent when a new product is submitted by a vendor"
536
  msgstr ""
537
  "Nuevos emails de pedido se envían cuando un nuevo producto es ingresado por "
538
  "un vendedor"
539
 
540
  #: ../classes/admin/emails/class-wc-notify-admin.php:31
 
541
  msgid "New product submitted: {product_name}"
542
  msgstr "Nuevo producto ingresado: {product_name}"
543
 
544
  #: ../classes/admin/emails/class-wc-notify-admin.php:32
 
545
  msgid "[{blogname}] New product submitted by {vendor_name} - {product_name}"
546
  msgstr ""
547
  "[{blogname}] Nuevo producto ingresado por {vendor_name} - {product_name}"
548
 
549
  #: ../classes/admin/emails/class-wc-notify-shipped.php:28
 
550
  msgid "Vendor has shipped"
551
- msgstr "Vendedor ha despachado"
552
 
553
  #: ../classes/admin/emails/class-wc-notify-shipped.php:29
 
554
  msgid ""
555
  "An email is sent when a vendor has marked one of their orders as shipped."
556
  msgstr ""
557
- "Un email es enviado cada vez que un vendedor marca una orden como despachada."
558
 
559
  #: ../classes/admin/emails/class-wc-notify-shipped.php:31
 
560
  msgid "Your order has been shipped"
561
- msgstr "Tu orden ha sido despachada"
562
 
563
  #: ../classes/admin/emails/class-wc-notify-shipped.php:32
 
564
  msgid ""
565
  "[{blogname}] Your order has been shipped ({order_number}) - {order_date}"
566
- msgstr ""
567
- "[{blogname}] Tu orden ha sido despachada ({order_number}) - {order_date}"
568
 
569
- #: ../classes/admin/emails/class-wc-notify-shipped.php:112
 
570
  msgid "Subtotal:"
571
  msgstr "Subtotal:"
572
 
573
  #: ../classes/admin/emails/class-wc-notify-vendor.php:27
 
574
  msgid "Notify vendors"
575
  msgstr "Notificar vendedores"
576
 
577
  #: ../classes/admin/emails/class-wc-notify-vendor.php:28
 
578
  msgid "New order emails are sent when an order is received/paid by a customer."
579
  msgstr ""
580
- "Nuevos emails de pedido son enviados cada vez que una orden es recibida/"
581
- "pagada por un usuario."
582
 
583
  #: ../classes/admin/emails/class-wc-notify-vendor.php:30
 
584
  msgid "New customer order"
585
- msgstr "Nueva orden de cliente"
586
 
587
  #: ../classes/admin/emails/class-wc-notify-vendor.php:31
 
588
  msgid "[{blogname}] New customer order ({order_number}) - {order_date}"
589
- msgstr "[{blogname}] Nueva orden de cliente ({order_number}) - {order_date}"
590
 
591
- #: ../classes/admin/emails/class-wc-notify-vendor.php:103
 
592
  msgid "Commission Subtotal:"
593
- msgstr "Subtotal de Comisión:"
594
 
595
- #: ../classes/admin/emails/class-wc-notify-vendor.php:109
 
596
  msgid "Tax Subtotal:"
597
  msgstr "Subtotal de impuesto:"
598
 
599
- #: ../classes/admin/emails/class-wc-notify-vendor.php:117
 
600
  msgid "Shipping Subtotal:"
601
- msgstr "Subtotal Despacho:"
 
 
 
 
 
 
 
 
 
 
 
 
602
 
603
  #: ../classes/admin/settings/classes/sf-class-format-options.php:211
604
- #: ../classes/admin/settings/classes/sf-class-settings.php:776
 
 
 
 
605
  msgid "Select a page..."
606
  msgstr "Seleccionar una página..."
607
 
608
  #: ../classes/admin/settings/classes/sf-class-settings.php:153
609
  #: ../templates/dashboard/settings/settings.php:1
 
 
610
  msgid "Settings"
611
  msgstr "Ajustes"
612
 
613
- #: ../classes/admin/settings/classes/sf-class-settings.php:300
 
614
  msgid "Could not load settings at: "
615
  msgstr "No se pueden cargar ajustes en: "
616
 
617
- #: ../classes/admin/settings/classes/sf-class-settings.php:300
 
618
  msgid "Error - WP Settings Framework"
619
  msgstr "Error - WP Settings Framework"
620
 
621
- #: ../classes/admin/settings/classes/sf-class-settings.php:482
 
622
  #, php-format
623
  msgid "Save %s changes"
624
- msgstr "Guardar %s cambios"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
625
 
626
  #: ../classes/admin/settings/sf-options.php:5
 
627
  msgid "General options"
628
  msgstr "Opciones generales"
629
 
630
  #: ../classes/admin/settings/sf-options.php:8
 
631
  msgid "Default commission (%)"
632
  msgstr "Comisión por defecto (%)"
633
 
634
  #: ../classes/admin/settings/sf-options.php:9
 
635
  msgid ""
636
- "The default rate you pay each vendor for a product sale. If a product has a "
637
- "commission rate already set, this value will be ignored for that product."
 
 
638
  msgstr ""
639
- "El monto que pagas a cada vendedor por la venta de un producto. Si un "
640
- "producto tiene un monto de Comisión ya establecido, este valor se omitirá "
641
- "para ese producto."
 
642
 
643
  #: ../classes/admin/settings/sf-options.php:20
644
- msgid "Registration"
645
- msgstr "Registro"
646
-
647
- #: ../classes/admin/settings/sf-options.php:21
648
  msgid "Allow users or guests to apply to become a vendor"
649
  msgstr "Permitir a los usuarios o visitas solicitar ser vendedores"
650
 
651
  #: ../classes/admin/settings/sf-options.php:22
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
652
  msgid ""
653
  "This will show a checkbox on the My Account page's registration form asking "
654
  "if the user would like to apply to be a vendor. Also, on the Vendor "
@@ -659,269 +1118,447 @@ msgstr ""
659
  "tablero del vendedor, los usuarios pueden aplicar aún para convertirse en un "
660
  "vendedor, incluso si éste está desactivado."
661
 
662
- #: ../classes/admin/settings/sf-options.php:29
 
663
  msgid "Approve vendor applications manually"
664
- msgstr "Aprobar las postulaciones de vendedor automáticamente"
665
 
666
- #: ../classes/admin/settings/sf-options.php:30
 
667
  msgid ""
668
  "With this unchecked, all vendor applications are automatically accepted. "
669
  "Otherwise, you must approve each manually."
670
  msgstr ""
671
- "Si no está chequeado, todas las postulaciones a vendedores se aprobarán "
672
  "automáticamente. De lo contrario, debes aprobarlas manualmente."
673
 
674
- #: ../classes/admin/settings/sf-options.php:37
 
 
 
675
  msgid "Taxes"
676
  msgstr "Impuestos"
677
 
678
- #: ../classes/admin/settings/sf-options.php:38
 
679
  msgid "Give vendors any tax collected per-product"
680
  msgstr "Dar a los vendedores todo el impuesto recolectado por producto"
681
 
682
- #: ../classes/admin/settings/sf-options.php:39
 
683
  msgid "The tax collected on a vendor's product will be given in its entirety"
684
  msgstr ""
685
  "Los impuestos recolectados en el producto de un vendedor se dará en su "
686
  "totalidad"
687
 
688
- #: ../classes/admin/settings/sf-options.php:47
 
689
  msgid "Give vendors any shipping collected per-product"
690
- msgstr "Dar los vendedores cualquier envío recogido por producto"
691
 
692
- #: ../classes/admin/settings/sf-options.php:48
 
693
  msgid ""
694
- "The shipping collected on a vendor's product will be given in its entirety"
695
- msgstr "Se dará el envío recogido por producto a un vendedor en su totalidad"
 
 
696
 
697
- #: ../classes/admin/settings/sf-options.php:54
 
698
  msgid "Shop options"
699
  msgstr "Opciones de la tienda"
700
 
701
- #: ../classes/admin/settings/sf-options.php:57
 
702
  msgid "Shop HTML"
703
  msgstr "HTML de la tienda"
704
 
705
- #: ../classes/admin/settings/sf-options.php:58
 
706
  msgid ""
707
  "Enable HTML for a vendor's shop description by default. You can enable or "
708
- "disable this per vendor by editing the vendors username."
709
  msgstr ""
710
- "Habilitar HTML para la descripción de la tienda de un vendedor por defecto. "
711
- "Usted puede activar o desactivar esto por vendedor editando el nombre de "
712
- "usuario de los vendedores."
713
 
714
- #: ../classes/admin/settings/sf-options.php:65
715
- msgid "Vendor shop page"
716
- msgstr "Página de la Tienda del Vendedor"
 
717
 
718
- #: ../classes/admin/settings/sf-options.php:66
719
- msgid "Eg: <code>yoursite.com/[your_setting_here]/[vendor_name_here]</code>"
720
- msgstr "Ej: <code>tusitio.com/[your_setting_here]/[vendor_name_here]</code>"
 
 
 
 
 
 
721
 
722
- #: ../classes/admin/settings/sf-options.php:73
 
723
  msgid "Shop Headers"
724
- msgstr "Encabezados de la Tienda"
725
 
726
- #: ../classes/admin/settings/sf-options.php:74
 
727
  msgid "Enable vendor shop headers"
728
- msgstr "Habilitar encabezados de la Tienda del Vendedor"
729
 
730
- #: ../classes/admin/settings/sf-options.php:75
 
731
  msgid ""
732
  "This will override the HTML Shop description output on product-archive "
733
  "pages. In order to customize the shop headers visit wcvendors.com and read "
734
  "the article in the Knowledgebase titled Changing the Vendor Templates."
735
  msgstr ""
736
- "Esto sobrescribirá el HTML descripción de la tienda en la salida de páginas "
737
- "de producto-archivo. Para personalizar la cabeceras de tienda visita "
738
- "wcvendors.com y leer el artículo en la Knowledgebase titulado cambiar las "
739
- "plantillas de proveedores."
740
 
741
- #: ../classes/admin/settings/sf-options.php:82
 
742
  msgid "Vendor Display Name"
743
- msgstr "Mostar Nombre del vendedor"
744
 
745
- #: ../classes/admin/settings/sf-options.php:83
 
746
  msgid ""
747
  "Select what will be displayed for the sold by text throughout the store."
748
- msgstr "Seleccione lo que se mostrará para vender por texto en toda la tienda."
749
 
750
- #: ../classes/admin/settings/sf-options.php:87
 
751
  msgid "Display Name"
752
- msgstr "Mostar Nombre"
753
 
754
- #: ../classes/admin/settings/sf-options.php:88
755
  #: ../classes/admin/views/html-vendor-settings-page.php:22
756
  #: ../templates/dashboard/settings/shop-name.php:2
 
 
 
757
  msgid "Shop Name"
758
- msgstr "Nombre de la Tienda"
759
 
760
- #: ../classes/admin/settings/sf-options.php:89
 
761
  msgid "User Login"
762
  msgstr "Identificación del usuario"
763
 
764
- #: ../classes/admin/settings/sf-options.php:90
 
765
  msgid "User Email"
766
- msgstr "Email de Usuario"
767
 
768
- #: ../classes/admin/settings/sf-options.php:97
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
769
  msgid "Product Add Page"
770
- msgstr "Página de Agregar Producto"
771
 
772
- #: ../classes/admin/settings/sf-options.php:97
 
773
  msgid "Configure what to hide from all vendors when adding a product"
774
- msgstr ""
775
- "Configurar qué esconder de todos los vendedores cuando se agrega un producto"
776
 
777
- #: ../classes/admin/settings/sf-options.php:100
 
778
  msgid "Left side panel"
779
  msgstr "Panel de la izquierda"
780
 
781
- #: ../classes/admin/settings/sf-options.php:101
 
782
  msgid ""
783
- "CHECKING these boxes will HIDE these areas of the add product page for "
784
  "vendors"
785
  msgstr ""
786
- "MARCANDO estas cajas se OCULTARÁN estas áreas de la página de agregar "
787
- "producto para vendedores"
788
-
789
- #: ../classes/admin/settings/sf-options.php:115
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
790
  msgid "Types"
791
  msgstr "Tipos"
792
 
793
- #: ../classes/admin/settings/sf-options.php:116
 
794
  msgid "CHECKING these boxes will HIDE these product types from the vendor"
795
- msgstr ""
796
- "MARCANDO estas cajas se OCULTARÁN estos tipos de productos para el vendedor"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
797
 
798
- #: ../classes/admin/settings/sf-options.php:129
 
 
 
 
 
 
799
  msgid "Type options"
800
  msgstr "Opciones de tipos"
801
 
802
- #: ../classes/admin/settings/sf-options.php:130
803
- msgid "CHECKING these boxes will HIDE these product options from the vendor"
 
 
804
  msgstr ""
805
- "MARCANDO estas cajas se OCULTARÁN estas opciones de producto para el vendedor"
806
 
807
- #: ../classes/admin/settings/sf-options.php:141
 
 
 
 
 
 
 
 
 
 
 
808
  msgid "Miscellaneous"
809
- msgstr "Misceláneos"
810
 
811
- #: ../classes/admin/settings/sf-options.php:153
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
812
  msgid "Stylesheet"
813
- msgstr "Hojas de estilos"
814
 
815
- #: ../classes/admin/settings/sf-options.php:154
 
816
  msgid ""
817
  "You can add CSS in this textarea, which will be loaded on the product add/"
818
  "edit page for vendors."
819
  msgstr ""
820
- "Puedes agregar CSS en esta área, éste va a ser cargado en la página de "
821
- "agregar/editar productos del vendedor."
822
 
823
- #: ../classes/admin/settings/sf-options.php:161
 
824
  msgid "Permissions"
825
  msgstr "Permisos"
826
 
827
- #: ../classes/admin/settings/sf-options.php:161
 
828
  msgid "General permissions used around the shop"
829
  msgstr "Permisos generales usados en la tienda"
830
 
831
- #: ../classes/admin/settings/sf-options.php:165
 
832
  msgid "View orders"
833
- msgstr "Ver órdenes"
834
 
835
- #: ../classes/admin/settings/sf-options.php:166
 
836
  msgid "Show customer details such as email, address, name, etc, for each order"
837
  msgstr ""
838
- "Mostrar detalles del cliente como email, dirección y nombre para cada orden"
839
 
840
- #: ../classes/admin/settings/sf-options.php:173
 
841
  msgid "View comments"
842
  msgstr "Ver comentarios"
843
 
844
- #: ../classes/admin/settings/sf-options.php:174
 
845
  msgid "View all vendor comments for an order on the frontend"
846
  msgstr ""
847
- "Ver todos los comentarios de los vendedores para una orden en el frontend"
848
 
849
- #: ../classes/admin/settings/sf-options.php:181
 
850
  msgid "Submit comments"
851
  msgstr "Enviar comentarios"
852
 
853
- #: ../classes/admin/settings/sf-options.php:182
 
854
  msgid ""
855
  "Submit comments for an order on the frontend. Eg, tracking ID for a product"
856
  msgstr ""
857
- "Enviar comentarios de una orden en el frontend. Eg: ID de tracking del "
858
  "producto"
859
 
860
- #: ../classes/admin/settings/sf-options.php:189
 
861
  msgid "View email addresses"
862
  msgstr "Ver dirección de email"
863
 
864
- #: ../classes/admin/settings/sf-options.php:190
 
865
  msgid ""
866
  "While viewing order details on the frontend, you can disable or enable email "
867
  "addresses"
868
  msgstr ""
869
- "Al ver los detalles de la orden en el frontend se puede habilitar o "
870
  "deshabitar la dirección de email"
871
 
872
- #: ../classes/admin/settings/sf-options.php:197
 
873
  msgid "Export a CSV file of orders for a product"
874
- msgstr "Exportar un archivo CSV de las órdenes de productos"
875
 
876
- #: ../classes/admin/settings/sf-options.php:198
 
877
  msgid "Vendors could export orders for a product on the frontend"
878
- msgstr "Los vendedores pueden exportar ordenes de un producto en el frontend"
879
 
880
- #: ../classes/admin/settings/sf-options.php:205
 
881
  msgid "Reports"
882
  msgstr "Reportes"
883
 
884
- #: ../classes/admin/settings/sf-options.php:206
885
- msgid "View backend sales reports"
886
- msgstr "Ver reportes de venta en el backend"
 
 
 
 
887
 
888
- #: ../classes/admin/settings/sf-options.php:207
 
889
  msgid ""
890
- "Graphs and tables via the Reports page in backend. The reports will only "
891
- "display sales data that pertain to their products"
 
892
  msgstr ""
893
- "Gráficos y tablas vía la página de Reportes en el backend. Los reportes solo "
894
- "mostrarán datos de ventas que perteneces a sus productos."
 
895
 
896
- #: ../classes/admin/settings/sf-options.php:214
 
897
  msgid "View Frontend sales reports"
898
- msgstr "Ver reportes de venta en el Frontend"
899
 
900
- #: ../classes/admin/settings/sf-options.php:215
 
901
  msgid ""
902
- "Sales table on the frontend on the My Account page. The table will only "
903
- "display sales data that pertain to their products"
 
904
  msgstr ""
905
- "Tabla de ventas en el frontend en la página de Mi Cuenta. La tabla va a "
906
- "mostrar sólo datos de sus productos."
 
907
 
908
- #: ../classes/admin/settings/sf-options.php:223
 
909
  msgid "Submit products"
910
- msgstr "Enviar productos"
911
 
912
- #: ../classes/admin/settings/sf-options.php:224
 
913
  msgid ""
914
- "Vendors could submit a product through the backend, and an admin would "
915
- "approve or deny it"
916
  msgstr ""
917
- "Los vendedores pueden enviar un producto a través del backend, un "
918
- "administrador pueden aprobarlos o rechazarlos."
 
919
 
920
- #: ../classes/admin/settings/sf-options.php:231
 
921
  msgid "Edit live products"
922
- msgstr "Editar productos en publicados"
923
 
924
- #: ../classes/admin/settings/sf-options.php:232
 
925
  msgid ""
926
  "Vendors could edit an approved product after it has already gone live. There "
927
  "is no approval or review after editing a live product. This could be "
@@ -931,11 +1568,13 @@ msgstr ""
931
  "publicado. No es necesario la aprobación o revisión. Esto puede ser "
932
  "peligroso con vendedores maliciosos, tomar con cuidado."
933
 
934
- #: ../classes/admin/settings/sf-options.php:239
 
935
  msgid "Submit products live without requiring approval"
936
- msgstr "Publicar productos sin necesitar aprobación"
937
 
938
- #: ../classes/admin/settings/sf-options.php:240
 
939
  msgid ""
940
  "Vendors can submit products without review or approval from a shop admin. "
941
  "This could be dangerous with malicious vendors, so take caution."
@@ -944,361 +1583,482 @@ msgstr ""
944
  "revisión. Esto puede ser peligroso con vendedores maliciosos, tomar con "
945
  "cuidado."
946
 
947
- #: ../classes/admin/settings/sf-options.php:246
 
948
  msgid "Pages"
949
  msgstr "Páginas"
950
 
951
- #: ../classes/admin/settings/sf-options.php:247
 
952
  msgid "Page configuration"
953
  msgstr "Configuración de la página"
954
 
955
- #: ../classes/admin/settings/sf-options.php:250
 
956
  msgid "Vendor dashboard"
957
  msgstr "Dashboard del vendedor"
958
 
959
- #: ../classes/admin/settings/sf-options.php:251
 
960
  msgid ""
961
  "Choose the page that has the shortcode <code>[wcv_vendor_dashboard]</"
962
- "code><br/>By default, My Account > Vendor Dashboard should have the "
963
- "shortcode."
 
964
  msgstr ""
965
- "Elegir la página que tiene el shortcode <code>[wcv_vendor_dashboard]</"
966
- "code><br/> Por defecto es Mi Cuenta > Dashboard del Vendedor"
967
 
968
- #: ../classes/admin/settings/sf-options.php:258
 
969
  msgid "Shop settings"
970
- msgstr "Ajustes de la Tienda"
971
 
972
- #: ../classes/admin/settings/sf-options.php:259
 
973
  msgid ""
974
  "Choose the page that has the shortcode <code>[wcv_shop_settings]</code><br/"
975
- ">These are the shop settings a vendor can configure."
 
976
  msgstr ""
977
- "Elegir la página que tiene el shortcode <code>[wcv_shop_settings]</code><br/"
978
- ">Estos son los ajustes de la tienda que el vendedor puede configurar"
979
 
980
- #: ../classes/admin/settings/sf-options.php:266
 
981
  msgid "Orders page"
982
- msgstr "Página de órdenes"
983
 
984
- #: ../classes/admin/settings/sf-options.php:267
 
985
  msgid ""
986
  "Choose the page that has the shortcode <code>[wcv_orders]</code><br/>By "
987
- "default, My Account > Orders should have the shortcode."
988
- msgstr ""
989
- "Elegir la página que tiene el shorcode <code>[wcv_orders]</code><br/>Por "
990
- "defecto es Mi Cuenta > Órdenes"
991
 
992
- #: ../classes/admin/settings/sf-options.php:274
 
993
  msgid "Vendor terms"
994
  msgstr "Condiciones de los vendedores"
995
 
996
- #: ../classes/admin/settings/sf-options.php:275
 
997
  msgid ""
998
  "These terms are shown to a user when submitting an application to become a "
999
- "vendor.<br/>If left blank, no terms will be shown to the applicant."
 
1000
  msgstr ""
1001
- "Estas condiciones se muestran a un usuario cuando envía una postulación a "
1002
- "ser vendedor.<br/>Si se deja en blanco no se mostrará ninguna."
1003
 
1004
- #: ../classes/admin/settings/sf-options.php:282
 
1005
  msgid "payments"
1006
  msgstr "pagos"
1007
 
1008
- #: ../classes/admin/settings/sf-options.php:293
 
1009
  msgid "Payments"
1010
  msgstr "Pagos"
1011
 
1012
- #: ../classes/admin/settings/sf-options.php:295
1013
- msgid "User payments"
1014
- msgstr "Pagos de Usuarios"
 
1015
 
1016
- #: ../classes/admin/settings/sf-options.php:296
 
1017
  #, php-format
1018
  msgid "Total commission currently due: %s. <a href=\"%s\">View details</a>."
1019
  msgstr "Deuda total de comisiones: %s. <a href=\"%s\">Ver detalles</a>."
1020
 
1021
- #: ../classes/admin/settings/sf-options.php:297
 
1022
  #, php-format
1023
  msgid ""
1024
  "Make sure you update your PayPal Adaptive Payments settings <a href=\"%s"
1025
- "\">here</a>."
 
 
 
 
 
 
 
 
 
1026
  msgstr ""
1027
- "Asegúrate de actualizar tus ajustes de PayPal Adaptive Payments <a href=\"%s"
1028
- "\">acá</a>."
1029
 
1030
- #: ../classes/admin/settings/sf-options.php:301
 
1031
  msgid "Instant pay"
1032
  msgstr "Pago instantáneo"
1033
 
1034
- #: ../classes/admin/settings/sf-options.php:302
1035
- msgid "Instantly pay vendors their commission when an order is made"
 
 
 
1036
  msgstr ""
1037
- "Pagar instantáneamente la comisión a los vendedores cuando se hace una orden"
 
1038
 
1039
- #: ../classes/admin/settings/sf-options.php:303
 
1040
  msgid ""
1041
  "For this to work, customers must checkout with the PayPal Adaptive Payments "
1042
  "gateway. Using any other gateways will not pay vendors instantly"
1043
  msgstr ""
1044
- "Para que funcione, los clientes deben finalizar pagos con PayPal Adaptive "
1045
- "Payments gateway. Utilizando cualquier otras pasarelas no pagará los "
1046
- "vendedores al instante."
1047
 
1048
- #: ../classes/admin/settings/sf-options.php:310
 
1049
  msgid "Payment schedule"
1050
  msgstr "Calendario de pagos"
1051
 
1052
- #: ../classes/admin/settings/sf-options.php:311
 
1053
  msgid "Note: Schedule will only work if instant pay is unchecked"
1054
- msgstr ""
1055
- "Nota: El calendario sólo va a funcionar si el \"Pago instantáneo\" no está "
1056
- "chequeado"
1057
 
1058
- #: ../classes/admin/settings/sf-options.php:316
 
 
 
 
 
 
1059
  msgid "Weekly"
1060
  msgstr "Semanal"
1061
 
1062
- #: ../classes/admin/settings/sf-options.php:317
 
1063
  msgid "Biweekly"
1064
  msgstr "Bisemanal"
1065
 
1066
- #: ../classes/admin/settings/sf-options.php:318
 
1067
  msgid "Monthly"
1068
  msgstr "Mensual"
1069
 
1070
- #: ../classes/admin/settings/sf-options.php:319
 
1071
  msgid "Manual"
1072
  msgstr "Manual"
1073
 
1074
- #: ../classes/admin/settings/sf-options.php:320
 
1075
  msgid "Now"
1076
  msgstr "Ahora"
1077
 
1078
- #: ../classes/admin/settings/sf-options.php:325
 
1079
  msgid "Email notification"
1080
  msgstr "Notificaciones por email"
1081
 
1082
- #: ../classes/admin/settings/sf-options.php:326
 
1083
  msgid ""
1084
  "Send the WooCommerce admin an email each time a payment has been made via "
1085
  "the payment schedule options above"
1086
  msgstr ""
1087
- "Mandar un mail al administrador de WooCommerce cada vez que se realice un "
1088
- "pago por medio del Caledario de Pagos"
1089
 
1090
  #: ../classes/admin/views/html-vendor-settings-page.php:11
1091
  #: ../templates/dashboard/settings/paypal-email-form.php:2
 
 
1092
  msgid "PayPal Address"
1093
  msgstr "Dirección de PayPal"
1094
 
1095
  #: ../classes/admin/views/html-vendor-settings-page.php:15
1096
  #: ../templates/dashboard/settings/paypal-email-form.php:3
 
 
1097
  msgid "Your PayPal address is used to send you your commission."
1098
- msgstr "Tu dirección de PayPal es usada para enviarte tu comisión."
1099
 
1100
  #: ../classes/admin/views/html-vendor-settings-page.php:24
1101
  #: ../templates/dashboard/settings/shop-name.php:3
 
 
1102
  msgid "Your shop name is public and must be unique."
1103
  msgstr "El nombre de tu tienda es público y único."
1104
 
1105
  #: ../classes/admin/views/html-vendor-settings-page.php:43
1106
  #: ../templates/dashboard/settings/seller-info.php:4
 
 
1107
  msgid "This is displayed on each of your products."
1108
  msgstr "Esto se muestra en cada uno de tus productos."
1109
 
1110
  #: ../classes/admin/views/html-vendor-settings-page.php:49
1111
  #: ../templates/dashboard/settings/shop-description.php:2
 
 
1112
  msgid "Shop Description"
1113
- msgstr "Descripción de la Tienda"
1114
 
1115
  #: ../classes/admin/views/html-vendor-settings-page.php:61
1116
  #: ../templates/dashboard/settings/shop-description.php:3
 
 
1117
  #, php-format
1118
  msgid "This is displayed on your <a href=\"%s\">shop page</a>."
1119
- msgstr "Esto será mostrado en la <a href=\"%s\">página de tu tienda</a>."
1120
 
1121
  #: ../classes/admin/views/html-vendor-settings-page.php:70
 
1122
  msgid "Save Shop Settings"
1123
  msgstr "Guardar la configuración de la tienda"
1124
 
1125
- #: ../classes/class-cron.php:87
1126
  #, php-format
1127
  msgid "Payment total: %s"
1128
- msgstr "Total de pago: %s"
 
 
 
 
1129
 
1130
- #: ../classes/class-cron.php:148
1131
  msgid "Once Weekly"
1132
  msgstr "Semanal"
1133
 
1134
- #: ../classes/class-cron.php:153
1135
  msgid "Once every two weeks"
1136
  msgstr "Bisemanal"
1137
 
1138
- #: ../classes/class-cron.php:158
1139
  msgid "Once a month"
1140
  msgstr "Mensual"
1141
 
1142
- #: ../classes/class-install.php:59 ../classes/class-install.php:213
1143
- msgid "Pending Vendor"
1144
- msgstr "Vendedor Pendiente"
1145
-
1146
- #: ../classes/class-install.php:164
1147
  msgid "Vendor Dashboard"
1148
- msgstr "Dashboard del Vendedor"
1149
 
1150
- #: ../classes/front/class-vendor-cart.php:41
1151
- #: ../classes/front/class-vendor-shop.php:265
1152
- msgid "Sold by"
1153
- msgstr "Vendido por"
1154
 
1155
- #: ../classes/front/dashboard/class-vendor-dashboard.php:46
 
 
 
 
 
 
1156
  msgid "Order marked shipped."
1157
- msgstr "Marcar como orden enviada."
 
 
 
 
 
 
1158
 
1159
- #: ../classes/front/dashboard/class-vendor-dashboard.php:72
1160
- #: ../classes/front/dashboard/class-vendor-dashboard.php:73
1161
- #: ../classes/front/orders/class-orders.php:144
1162
- #: ../classes/front/orders/class-orders.php:145
1163
  msgid "Tracking number"
1164
- msgstr "Número de Tracking"
1165
 
1166
- #: ../classes/front/dashboard/class-vendor-dashboard.php:75
1167
- #: ../classes/front/orders/class-orders.php:147
1168
  msgid "Success. Your tracking number has been updated."
1169
- msgstr "Éxito. Tu número de tracking ha sido actualizado."
1170
 
1171
  #: ../classes/front/orders/class-export-csv.php:19
1172
  #: ../templates/dashboard/reports.php:18
1173
  #: ../templates/emails/admin-new-order.php:23
1174
- #: ../templates/emails/notify-vendor-shipped.php:23
1175
- #: ../templates/emails/vendor-new-order.php:23
 
 
 
 
 
1176
  msgid "Quantity"
1177
  msgstr "Cantidad"
1178
 
1179
- #: ../classes/front/orders/class-orders.php:107
 
 
 
 
 
 
 
 
1180
  msgid ""
1181
  "You haven't selected a product's orders to view! Please go back to the "
1182
  "Vendor Dashboard and click Show Orders on the product you'd like to view."
1183
  msgstr ""
1184
- "¡No has seleccionado órdenes de productos para ver! Por favor anda al "
1185
- "Dashboard del Vendedor y haz click en Mostrar Órdenes en el producto que "
1186
  "quieres ver."
1187
 
1188
- #: ../classes/front/orders/class-orders.php:111
 
 
 
1189
  msgid "No orders."
1190
- msgstr "No hay órdenes."
1191
 
1192
- #: ../classes/front/orders/class-orders.php:209
 
1193
  msgid "Product Title"
1194
- msgstr "Título del Producto"
1195
 
1196
- #: ../classes/front/orders/class-orders.php:210
 
1197
  msgid "Full name"
1198
  msgstr "Nombre completo"
1199
 
1200
- #: ../classes/front/orders/class-orders.php:211
 
1201
  msgid "Address"
1202
  msgstr "Dirección"
1203
 
1204
- #: ../classes/front/orders/class-orders.php:212
 
1205
  msgid "City"
1206
  msgstr "Ciudad"
1207
 
1208
- #: ../classes/front/orders/class-orders.php:213
 
1209
  msgid "State"
1210
  msgstr "Estado"
1211
 
1212
- #: ../classes/front/orders/class-orders.php:214
 
1213
  msgid "Zip"
1214
- msgstr "Zip"
1215
 
1216
- #: ../classes/front/orders/class-orders.php:215
 
1217
  msgid "Email address"
1218
- msgstr "Dirección de email"
1219
 
1220
  #: ../classes/front/orders/class-submit-comment.php:41
 
1221
  msgid "You've left the comment field empty!"
1222
  msgstr "¡Has dejado el campo de comentarios vacío!"
1223
 
1224
  #: ../classes/front/orders/class-submit-comment.php:63
 
1225
  msgid "Success. The customer has been notified of your comment."
1226
  msgstr "Éxito. El cliente ha sido notificado de tu comentario."
1227
 
1228
- #: ../classes/front/signup/class-vendor-signup.php:44
1229
- #: ../templates/dashboard/denied.php:22
1230
- msgid "Apply to become a vendor? "
1231
- msgstr "Aplicar para convertirse en un vendedor!"
1232
-
1233
- #: ../classes/front/signup/class-vendor-signup.php:53
1234
- #: ../templates/dashboard/denied.php:33
1235
- #, php-format
1236
- msgid "I have read and accepted the <a href=\"%s\">terms and conditions</a>"
1237
- msgstr "Leí y acepto los <a href=\"%s\">términos y condiciones</a>"
1238
-
1239
- #: ../classes/front/signup/class-vendor-signup.php:87
1240
  msgid "Application denied. You are an administrator."
1241
  msgstr "Aplicación denegada. Eres un administrador."
1242
 
1243
- #: ../classes/front/signup/class-vendor-signup.php:89
 
1244
  msgid "Your application has been submitted."
1245
  msgstr "Su solicitud ha sido enviada."
1246
 
1247
- #: ../classes/front/signup/class-vendor-signup.php:125
 
 
 
 
 
1248
  msgid "You must accept the terms and conditions to become a vendor."
1249
  msgstr "Debes aceptar los términos y condiciones para postular a vendedor."
1250
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1251
  #: ../classes/gateways/PayPal_AdvPayments/paypal_ap.php:43
 
1252
  msgid "PayPal Adaptive Payments"
1253
  msgstr "PayPal Adaptive Payments"
1254
 
1255
  #: ../classes/gateways/PayPal_AdvPayments/paypal_ap.php:119
 
1256
  #, php-format
1257
  msgid ""
1258
  "Something went wrong. Response from PayPal invalidated this order. Status: "
1259
  "%s."
1260
  msgstr ""
1261
- "Algo salió mal. La respuesta de PayPal invalidó esta orden. Estado: %s."
1262
 
1263
  #: ../classes/gateways/PayPal_AdvPayments/paypal_ap.php:124
 
1264
  msgid "IPN payment completed"
1265
  msgstr "Pago IPN completado"
1266
 
1267
  #: ../classes/gateways/PayPal_AdvPayments/paypal_ap.php:146
 
1268
  msgid "Enable PayPal Adaptive Payments"
1269
  msgstr "Habilitar PayPal Adaptive Payments"
1270
 
1271
  #: ../classes/gateways/PayPal_AdvPayments/paypal_ap.php:152
 
1272
  msgid "Method Title"
1273
- msgstr "Título del Método"
1274
 
1275
  #: ../classes/gateways/PayPal_AdvPayments/paypal_ap.php:153
1276
  #: ../classes/gateways/WCV_Gateway_Test/class-wcv-gateway-test.php:70
 
 
1277
  msgid "This controls the title which the user sees during checkout."
1278
  msgstr "Esto controla el título que el usuario verá durante el checkout."
1279
 
1280
  #: ../classes/gateways/PayPal_AdvPayments/paypal_ap.php:154
 
1281
  msgid "PayPal"
1282
  msgstr "PayPal"
1283
 
1284
  #: ../classes/gateways/PayPal_AdvPayments/paypal_ap.php:159
1285
  #: ../classes/gateways/WCV_Gateway_Test/class-wcv-gateway-test.php:75
 
 
1286
  msgid "Description"
1287
  msgstr "Descripción"
1288
 
1289
  #: ../classes/gateways/PayPal_AdvPayments/paypal_ap.php:160
 
1290
  msgid "This controls the description which the user sees during checkout."
1291
  msgstr "Esto controla la descripción que el usuario verá durante el checkout."
1292
 
1293
  #: ../classes/gateways/PayPal_AdvPayments/paypal_ap.php:161
 
1294
  msgid "Pay via PayPal!"
1295
  msgstr "¡Pagar vía PayPal!"
1296
 
1297
  #: ../classes/gateways/PayPal_AdvPayments/paypal_ap.php:172
 
1298
  msgid "Live Credentials"
1299
- msgstr "Credenciales Publicadas"
1300
 
1301
  #: ../classes/gateways/PayPal_AdvPayments/paypal_ap.php:174
 
1302
  #, php-format
1303
  msgid ""
1304
  "You must have an <a href=\"%s\">Application ID</a> to process live "
@@ -1309,42 +2069,56 @@ msgstr ""
1309
 
1310
  #: ../classes/gateways/PayPal_AdvPayments/paypal_ap.php:179
1311
  #: ../classes/gateways/PayPal_AdvPayments/paypal_ap.php:213
 
 
1312
  msgid "PayPal Email"
1313
  msgstr "Email de PayPal"
1314
 
1315
  #: ../classes/gateways/PayPal_AdvPayments/paypal_ap.php:180
1316
  #: ../classes/gateways/PayPal_AdvPayments/paypal_ap.php:214
 
 
1317
  msgid "The email address main payments should go to."
1318
- msgstr "El email es la dirección principal a la que deben ir los pagos"
1319
 
1320
  #: ../classes/gateways/PayPal_AdvPayments/paypal_ap.php:185
1321
  #: ../classes/gateways/PayPal_AdvPayments/paypal_ap.php:219
 
 
1322
  msgid "API Username"
1323
  msgstr "API Nombre de Usuario"
1324
 
1325
  #: ../classes/gateways/PayPal_AdvPayments/paypal_ap.php:190
1326
  #: ../classes/gateways/PayPal_AdvPayments/paypal_ap.php:224
 
 
1327
  msgid "API Password"
1328
  msgstr "API Contraseña"
1329
 
1330
  #: ../classes/gateways/PayPal_AdvPayments/paypal_ap.php:195
1331
  #: ../classes/gateways/PayPal_AdvPayments/paypal_ap.php:229
 
 
1332
  msgid "API Signature"
1333
  msgstr "API Firma"
1334
 
1335
  #: ../classes/gateways/PayPal_AdvPayments/paypal_ap.php:200
 
1336
  msgid "Application ID"
1337
- msgstr "ID de Postuación"
1338
 
1339
  #: ../classes/gateways/PayPal_AdvPayments/paypal_ap.php:202
 
1340
  msgid "Only required when doing live transactions."
1341
  msgstr "Solo requerida para hacer transacciones."
1342
 
1343
  #: ../classes/gateways/PayPal_AdvPayments/paypal_ap.php:206
 
1344
  msgid "Sandbox Credentials"
1345
  msgstr "Credenciales de Sandbox"
1346
 
1347
  #: ../classes/gateways/PayPal_AdvPayments/paypal_ap.php:208
 
1348
  #, php-format
1349
  msgid ""
1350
  "You can signup for a sandbox developer account <a href=\"%s\">here</a>. You "
@@ -1355,18 +2129,22 @@ msgstr ""
1355
  "de Sandbox para hacer pruebas."
1356
 
1357
  #: ../classes/gateways/PayPal_AdvPayments/paypal_ap.php:240
 
1358
  msgid "Misc. Settings"
1359
  msgstr "Otros Ajustes"
1360
 
1361
  #: ../classes/gateways/PayPal_AdvPayments/paypal_ap.php:245
 
1362
  msgid "Enable PayPal Sandbox mode"
1363
  msgstr "Habilitar modo Sandbox para PayPal"
1364
 
1365
  #: ../classes/gateways/PayPal_AdvPayments/paypal_ap.php:251
 
1366
  msgid "Enable logging"
1367
  msgstr "Habilitar logging"
1368
 
1369
  #: ../classes/gateways/PayPal_AdvPayments/paypal_ap.php:269
 
1370
  msgid ""
1371
  "The PayPal Adaptive Payments gateway can instantly pay your vendors their "
1372
  "due commission (if enabled). Also used to mass pay vendors on a schedule / "
@@ -1378,38 +2156,48 @@ msgstr ""
1378
  "habilitado)."
1379
 
1380
  #: ../classes/gateways/PayPal_AdvPayments/paypal_ap.php:280
 
1381
  msgid "Gateway Disabled"
1382
- msgstr "Gateway Deshabilitado"
1383
 
1384
  #: ../classes/gateways/PayPal_AdvPayments/paypal_ap.php:280
 
1385
  #, php-format
1386
  msgid "%s does not support your store currency."
1387
  msgstr "%s no soporta la moneda de tu cuenta."
1388
 
1389
- #: ../classes/gateways/PayPal_AdvPayments/paypal_ap.php:369
1390
- #: ../classes/gateways/PayPal_AdvPayments/paypal_ap.php:483
1391
  #: ../classes/gateways/PayPal_Masspay/class-paypal-masspay.php:153
 
 
 
1392
  #, php-format
1393
  msgid "Error: %s"
1394
  msgstr "Error: %s"
1395
 
1396
- #: ../classes/gateways/PayPal_AdvPayments/paypal_ap.php:378
1397
- #: ../classes/gateways/PayPal_AdvPayments/paypal_ap.php:379
 
 
1398
  #, php-format
1399
  msgid "Error ID: %s. %s"
1400
  msgstr "Error ID: %s. %s"
1401
 
1402
  #: ../classes/gateways/PayPal_Masspay/class-paypal-masspay.php:115
 
1403
  msgid "No vendors found to pay. Maybe they haven't set a PayPal address?"
1404
  msgstr ""
1405
- "No se encontraron vendedores que pagar. Puede que no tengan configurada su "
1406
- "dirección de PayPal."
1407
 
1408
  #: ../classes/gateways/PayPal_Masspay/class-paypal-masspay.php:167
 
1409
  msgid "All due commission has been paid for."
1410
  msgstr "Se han pagado todas las comisiones adeudadas."
1411
 
1412
  #: ../classes/gateways/PayPal_Masspay/class-paypal-masspay.php:173
 
1413
  msgid ""
1414
  "All due commission has been paid for, but I could not clear it from their "
1415
  "profiles due to an internal error. Commission will still be listed as due. "
@@ -1420,62 +2208,74 @@ msgstr ""
1420
  "favor marcar manualmente como pagadas desde la Página de Comisiones."
1421
 
1422
  #: ../classes/gateways/PayPal_Masspay/class-paypal-masspay.php:208
 
1423
  msgid "WooCommerce: Mass payments for vendors update"
1424
  msgstr "WooCommerce: Actualizar los pagos en masa de vendedores"
1425
 
1426
  #: ../classes/gateways/PayPal_Masspay/class-paypal-masspay.php:210
 
1427
  msgid ""
1428
  "Hello! A payment was just triggered to mass pay all vendors their due "
1429
  "commission."
1430
  msgstr ""
1431
- "Hola! Un pago ha sido desatado para pagar a todos los vendedores su comisión "
1432
- "adeudada."
1433
 
1434
  #: ../classes/gateways/PayPal_Masspay/class-paypal-masspay.php:211
 
1435
  #, php-format
1436
  msgid "Payment status: %s."
1437
- msgstr "Estado del Pago: %s."
1438
 
1439
  #: ../classes/gateways/PayPal_Masspay/class-paypal-masspay.php:212
 
1440
  #, php-format
1441
  msgid "Payment message: %s."
1442
- msgstr "Mensaje del Pago: %s."
1443
 
1444
  #: ../classes/gateways/PayPal_Masspay/class-paypal-masspay.php:215
 
1445
  #, php-format
1446
  msgid "Payment total: %s."
1447
- msgstr "Total del Pago: %s."
1448
 
1449
  #: ../classes/gateways/WCV_Gateway_Test/class-wcv-gateway-test.php:35
1450
  #: ../classes/gateways/WCV_Gateway_Test/class-wcv-gateway-test.php:71
 
 
1451
  msgid "WC Vendors Test Gateway"
1452
- msgstr "WC Pasarela de prueba para vendedor"
1453
 
1454
  #: ../classes/gateways/WCV_Gateway_Test/class-wcv-gateway-test.php:36
 
1455
  msgid ""
1456
  "This gateway will set orders to processing upon receipt allowing you to test "
1457
  "transactions in your store. Some WooCommerce included gateways have "
1458
  "problems with this - you should use this gateway for all of your non-PayPal "
1459
  "testing."
1460
  msgstr ""
1461
- "Esta pasarela pondrá órdenes en procesamiento tras la recepción que permite "
1462
- "poner a prueba las transacciones en su tienda. Algunos portales de "
1463
  "WooCommerce incluido tienen problemas con esto - usted debe utilizar este "
1464
- "portal para todas las pruebas - pero no para las pruebas de PayPal."
1465
 
1466
  #: ../classes/gateways/WCV_Gateway_Test/class-wcv-gateway-test.php:64
 
1467
  msgid "Enable WC Vendors Test Gateway Payment"
1468
  msgstr "Habilitar WC Vendors pasarela de prueba con pago"
1469
 
1470
  #: ../classes/gateways/WCV_Gateway_Test/class-wcv-gateway-test.php:68
 
1471
  msgid "Title"
1472
  msgstr "Título"
1473
 
1474
  #: ../classes/gateways/WCV_Gateway_Test/class-wcv-gateway-test.php:77
 
1475
  msgid "Payment method description that the customer will see on your checkout."
1476
  msgstr "Forma de pago descripción que el cliente verá en su caja."
1477
 
1478
  #: ../classes/gateways/WCV_Gateway_Test/class-wcv-gateway-test.php:78
 
1479
  msgid ""
1480
  "This is a test gateway -- not to be used on live sites for live "
1481
  "transactions. <a href=\"http://www.wcvendors.com/\" target=\"top\">Click "
@@ -1486,25 +2286,29 @@ msgstr ""
1486
  "\">Haga clic aquí para visitar WCVendors.com</a>."
1487
 
1488
  #: ../classes/gateways/WCV_Gateway_Test/class-wcv-gateway-test.php:82
 
1489
  msgid "Instructions"
1490
  msgstr "Instrucciones"
1491
 
1492
  #: ../classes/gateways/WCV_Gateway_Test/class-wcv-gateway-test.php:84
 
1493
  msgid ""
1494
  "Success! Your test order is now marked as processing and any vendors will "
1495
  "be sent an email as long as you have the Notify Vendors email enabled under "
1496
  "WooCommerce--Settings--Emails."
1497
  msgstr ""
1498
- Completo! La orden de la prueba ya está marcado como procesando se "
1499
- "enviará un correo electrónico, siempre y cuando usted tiene la notificacion "
1500
- "de correo a vendedores permitidos bajo la Configuración en WooCommerce - "
1501
- "Configuración de correos electrónicos."
1502
 
1503
- #: ../classes/gateways/WCV_Gateway_Test/class-wcv-gateway-test.php:124
 
1504
  msgid "Test gateway transation complete. Order processing."
1505
- msgstr "Pasarela de prueba transacción completa. Procesando la orden"
1506
 
1507
  #: ../templates/dashboard/denied.php:8
 
1508
  msgid ""
1509
  "Your account has not yet been approved to become a vendor. When it is, you "
1510
  "will receive an email telling you that your account is approved!"
@@ -1513,216 +2317,354 @@ msgstr ""
1513
  "aprobada, se te enviará un email!"
1514
 
1515
  #: ../templates/dashboard/denied.php:12
 
1516
  msgid "Your account is not setup as a vendor."
1517
  msgstr "No tienes una cuenta configurada como vendedor."
1518
 
 
 
 
 
 
 
1519
  #: ../templates/dashboard/denied.php:53
 
1520
  msgid "Submit"
1521
  msgstr "Enviar"
1522
 
1523
- #: ../templates/dashboard/orders.php:7 ../templates/dashboard/orders.php:10
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1524
  msgid "Hide items"
1525
- msgstr "Esconder elementos"
1526
 
1527
- #: ../templates/dashboard/orders.php:8 ../templates/dashboard/orders.php:74
 
 
1528
  msgid "View items"
1529
- msgstr "Ver elementos"
1530
 
1531
- #: ../templates/dashboard/orders.php:37
 
1532
  msgid "Links"
1533
- msgstr "Links"
1534
-
1535
- #: ../templates/dashboard/orders.php:75
1536
- msgid "Unmark shipped"
1537
- msgstr "Desmarcar enviado"
1538
 
1539
- #: ../templates/dashboard/orders.php:76
 
1540
  msgid "Tracking"
1541
  msgstr "Seguimiento"
1542
 
1543
- #: ../templates/dashboard/orders.php:126
 
1544
  msgid "You have no orders during this period."
1545
- msgstr "No tienes órdenes durante este periodo."
1546
 
1547
  #: ../templates/dashboard/reports.php:1
 
1548
  msgid "Sales Report"
1549
- msgstr "Reporte de Ventas"
1550
 
1551
  #: ../templates/dashboard/reports.php:20
 
1552
  msgid "Rate"
1553
- msgstr "Evaluar"
1554
 
1555
  #: ../templates/dashboard/reports.php:47
 
1556
  msgid "Show Orders"
1557
- msgstr "Mostrar Órdenes"
1558
 
1559
  #: ../templates/dashboard/reports.php:56
 
1560
  msgid "Totals"
1561
  msgstr "Totales"
1562
 
1563
  #: ../templates/dashboard/reports.php:71
 
1564
  msgid "You have no sales during this period."
1565
- msgstr "No has tenido ventas durante este periodo."
1566
 
1567
  #: ../templates/dashboard/reports.php:82
 
1568
  msgid "You haven't made any sales yet."
1569
- msgstr "No ha hecho ninguna venta por ahora."
1570
 
1571
  #: ../templates/dashboard/settings/settings.php:47
 
1572
  msgid "Save"
1573
  msgstr "Guardar"
1574
 
1575
  #: ../templates/emails/admin-new-order.php:13
1576
- #: ../templates/emails/vendor-new-order.php:13
 
 
1577
  #, php-format
1578
  msgid "You have received an order from %s. Their order is as follows:"
1579
- msgstr "Has recibido una orden de %s. La orden la siguiente:"
1580
 
1581
  #: ../templates/emails/admin-new-order.php:17
1582
- #: ../templates/emails/notify-vendor-shipped.php:17
1583
- #: ../templates/emails/vendor-new-order.php:17
 
 
 
1584
  #, php-format
1585
  msgid "Order: %s"
1586
- msgstr "Orden: %s"
1587
 
1588
  #: ../templates/emails/admin-new-order.php:24
1589
- #: ../templates/emails/notify-vendor-shipped.php:24
1590
- #: ../templates/emails/vendor-new-order.php:24
 
 
 
1591
  msgid "Price"
1592
  msgstr "Precio"
1593
 
1594
  #: ../templates/emails/admin-new-order.php:50
1595
- #: ../templates/emails/notify-vendor-shipped.php:50
1596
- #: ../templates/emails/vendor-new-order.php:50
 
 
 
1597
  msgid "Customer details"
1598
  msgstr "Detalle del cliente"
1599
 
1600
  #: ../templates/emails/admin-new-order.php:53
1601
- #: ../templates/emails/notify-vendor-shipped.php:53
1602
- #: ../templates/emails/vendor-new-order.php:53
 
 
 
1603
  msgid "Email:"
1604
  msgstr "Email:"
1605
 
1606
  #: ../templates/emails/admin-new-order.php:56
1607
- #: ../templates/emails/notify-vendor-shipped.php:56
1608
- #: ../templates/emails/vendor-new-order.php:56
 
 
 
1609
  msgid "Tel:"
1610
  msgstr "Tel:"
1611
 
1612
  #: ../templates/emails/application-status.php:5
 
1613
  #, php-format
1614
  msgid "Hi there. This is a notification about a vendor application on %s."
1615
  msgstr "Hola. Esta es una notificación de la postulación de un vendedor en %s."
1616
 
1617
  #: ../templates/emails/application-status.php:8
 
1618
  #, php-format
1619
  msgid "Application status: %s"
1620
  msgstr "Estado de la postulación: %s"
1621
 
1622
  #: ../templates/emails/application-status.php:9
 
1623
  #, php-format
1624
  msgid "Applicant username: %s"
1625
  msgstr "Username del postulante: %s"
1626
 
1627
  #: ../templates/emails/new-product.php:5
 
1628
  #, php-format
1629
  msgid "Hi there. This is a notification about a new product on %s."
1630
  msgstr "Hola. Esta es una notificación sobre un nuevo producto en %s."
1631
 
1632
  #: ../templates/emails/new-product.php:8
 
1633
  #, php-format
1634
  msgid "Product title: %s"
1635
  msgstr "Título del producto: %s"
1636
 
1637
  #: ../templates/emails/new-product.php:9
 
1638
  #, php-format
1639
  msgid "Submitted by: %s"
1640
  msgstr "Enviado por: %s"
1641
 
1642
  #: ../templates/emails/new-product.php:10
 
1643
  #, php-format
1644
  msgid "Edit product: %s"
1645
  msgstr "Editar producto: %s"
1646
 
1647
- #: ../templates/emails/notify-vendor-shipped.php:13
 
1648
  msgid ""
1649
  "A vendor has marked part of your order as shipped. The items that are "
1650
  "shipped are as follows:"
1651
  msgstr ""
1652
- "Un vendedor ha marcado parte de tu orden como enviada. Los elementos serán "
1653
  "enviados de la siguiente forma:"
1654
 
1655
  #: ../templates/orders/comments/add-new-comment.php:11
 
1656
  msgid "Add comment"
1657
  msgstr "Agregar comentario"
1658
 
1659
  #: ../templates/orders/comments/existing-comments.php:9
 
1660
  #, php-format
1661
  msgid "added %s ago"
1662
- msgstr "Agregado %s atrás"
1663
 
1664
  #: ../templates/orders/csv-export.php:6
 
1665
  msgid "Export orders"
1666
- msgstr "Exportar órdenes"
1667
 
1668
  #: ../templates/orders/customer-note/customer-note.php:4
 
1669
  msgid "Customer note"
1670
  msgstr "Nota del cliente"
1671
 
1672
  #: ../templates/orders/customer-note/customer-note.php:8
 
1673
  msgid "No customer note."
1674
  msgstr "No hay nota del cliente."
1675
 
1676
- #: ../templates/orders/orders.php:84
1677
  #, php-format
1678
  msgid "Comments (%s)"
1679
  msgstr "Comentarios (%s)"
1680
 
1681
- #: ../templates/orders/shipping/shipping-form.php:46
 
1682
  msgid "Provider:"
1683
  msgstr "Proveedor:"
1684
 
1685
- #: ../templates/orders/shipping/shipping-form.php:48
 
1686
  msgid "Custom Provider"
1687
- msgstr "Proveedor Personalizado"
1688
 
1689
- #: ../templates/orders/shipping/shipping-form.php:68
 
1690
  msgid "Provider Name:"
1691
- msgstr "Nombre del Proveedor:"
1692
 
1693
- #: ../templates/orders/shipping/shipping-form.php:76
 
1694
  msgid "Tracking number:"
1695
- msgstr "Número de Tracking:"
1696
 
1697
- #: ../templates/orders/shipping/shipping-form.php:84
 
1698
  msgid "Tracking link:"
1699
- msgstr "Enlace de Tracking:"
1700
 
1701
- #: ../templates/orders/shipping/shipping-form.php:93
 
1702
  msgid "Date shipped:"
1703
  msgstr "Fecha de envío:"
1704
 
1705
- #: ../templates/orders/shipping/shipping-form.php:101
 
1706
  msgid "Preview:"
1707
  msgstr "Previsualizar:"
1708
 
1709
- #: ../templates/orders/shipping/shipping-form.php:101
 
1710
  msgid "Click here to track your shipment"
1711
- msgstr "Haz click para trackear tu envío"
1712
 
1713
- #: ../templates/orders/shipping/shipping-form.php:110
 
1714
  msgid "Update tracking number"
1715
- msgstr "Actualizar el numero de tracking"
1716
 
1717
- #: ../templates/orders/shipping/shipping-form.php:112
 
1718
  msgid "Mark as shipped"
1719
  msgstr "Marcar como enviada"
1720
 
1721
  #: ../templates/orders/table-body.php:25
 
1722
  #, php-format
1723
  msgid "Quantity: %d"
1724
  msgstr "Cantidad: %d"
1725
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1726
  #~ msgid "Extra data"
1727
  #~ msgstr "Data adicional"
1728
 
1
  msgid ""
2
  msgstr ""
3
  "Project-Id-Version: WC Vendors\n"
4
+ "POT-Creation-Date: 2017-05-21 19:18-0300\n"
5
+ "PO-Revision-Date: 2017-05-25 04:16-0300\n"
6
  "Last-Translator: Dto2y3d <masyoututoriales@gmail.com>\n"
7
  "Language-Team: WC Vendors <support@wcvendors.com>\n"
8
  "Language: es\n"
9
  "MIME-Version: 1.0\n"
10
  "Content-Type: text/plain; charset=UTF-8\n"
11
  "Content-Transfer-Encoding: 8bit\n"
12
+ "X-Generator: Poedit 2.0.1\n"
13
  "X-Poedit-Basepath: .\n"
14
  "Plural-Forms: nplurals=2; plural=n != 1;\n"
15
  "X-Poedit-SourceCharset: UTF-8\n"
17
  "X-Poedit-SearchPath-0: .\n"
18
  "X-Poedit-SearchPath-1: ..\n"
19
 
20
+ #: ../class-wc-vendors.php:51 ../trunk/class-wc-vendors.php:51
21
+ msgid ""
22
+ "WC Vendors requires WooCommerce to run. Please install WooCommerce and "
23
+ "activate before attempting to activate again."
24
+ msgstr ""
25
+ "WC Vendors necesita WooCommerce para funcionar. Por favor instala y activa "
26
+ "WooCommerce antes de intentar activar WC Vendors."
27
+
28
+ #: ../class-wc-vendors.php:100 ../classes/admin/class-admin-reports.php:41
29
+ #: ../classes/admin/class-admin-users.php:384 ../trunk/class-wc-vendors.php:100
30
+ #: ../trunk/classes/admin/class-admin-reports.php:41
31
+ #: ../trunk/classes/admin/class-admin-users.php:384
32
  msgid "WC Vendors"
33
  msgstr "WC Vendors"
34
 
35
+ #: ../class-wc-vendors.php:128 ../trunk/class-wc-vendors.php:128
36
  msgid ""
37
+ "<b>WC Vendors is inactive</b>. WC Vendors requires a minimum of WooCommerce "
38
+ "v2.7.0."
39
  msgstr ""
40
+ "<b>WC Vendors está deshabilitado</b>. WC Vendors requiere como mínimo "
41
+ "WooCommerce v2.7.0."
42
 
43
+ #: ../class-wc-vendors.php:298 ../classes/admin/settings/sf-options.php:192
44
+ #: ../trunk/class-wc-vendors.php:298
45
+ #: ../trunk/classes/admin/settings/sf-options.php:192
46
  msgid "Capabilities"
47
  msgstr "Capacidades"
48
 
49
+ #: ../class-wc-vendors.php:321 ../classes/admin/class-admin-page.php:153
50
+ #: ../classes/admin/class-admin-page.php:416
51
+ #: ../classes/admin/class-admin-reports.php:178
52
+ #: ../classes/admin/class-admin-reports.php:461
53
+ #: ../classes/admin/class-product-meta.php:46
54
+ #: ../classes/admin/class-product-meta.php:187
55
+ #: ../classes/admin/class-product-meta.php:223 ../classes/class-install.php:51
56
+ #: ../classes/class-install.php:105 ../trunk/class-wc-vendors.php:321
57
+ #: ../trunk/classes/admin/class-admin-page.php:153
58
+ #: ../trunk/classes/admin/class-admin-page.php:416
59
+ #: ../trunk/classes/admin/class-admin-reports.php:178
60
+ #: ../trunk/classes/admin/class-admin-reports.php:461
61
+ #: ../trunk/classes/admin/class-product-meta.php:46
62
+ #: ../trunk/classes/admin/class-product-meta.php:187
63
+ #: ../trunk/classes/admin/class-product-meta.php:223
64
+ #: ../trunk/classes/class-install.php:51 ../trunk/classes/class-install.php:105
65
+ msgid "Vendor"
66
+ msgstr "Vendedor"
67
+
68
+ #: ../class-wc-vendors.php:323 ../classes/admin/settings/sf-options.php:4
69
+ #: ../trunk/class-wc-vendors.php:323
70
+ #: ../trunk/classes/admin/settings/sf-options.php:4
71
  msgid "General"
72
  msgstr "General"
73
 
74
+ #: ../class-wc-vendors.php:361 ../trunk/class-wc-vendors.php:361
75
  msgid "Documentation/KB"
76
+ msgstr "Documentación"
77
 
78
+ #: ../class-wc-vendors.php:362 ../trunk/class-wc-vendors.php:362
79
  msgid "Help Forums"
80
  msgstr "Foros de ayuda"
81
 
82
+ #: ../class-wc-vendors.php:363 ../trunk/class-wc-vendors.php:363
83
  msgid "Paid Support"
84
+ msgstr "Soporte pago"
85
 
86
+ #: ../classes/admin/class-admin-page.php:31
87
+ #: ../trunk/classes/admin/class-admin-page.php:31
88
+ msgid "Vendors shipped"
89
+ msgstr "Vendedores han enviado"
90
+
91
+ #: ../classes/admin/class-admin-page.php:56
92
+ #: ../trunk/classes/admin/class-admin-page.php:56
93
+ msgid "Vendors Shipped"
94
+ msgstr "Vendedores han enviado"
95
+
96
+ #: ../classes/admin/class-admin-page.php:82
97
+ #: ../classes/admin/class-admin-page.php:277
98
+ #: ../classes/admin/class-admin-page.php:417
99
+ #: ../classes/admin/class-product-meta.php:151
100
+ #: ../classes/admin/class-product-meta.php:167
101
+ #: ../templates/dashboard/reports.php:19
102
+ #: ../trunk/classes/admin/class-admin-page.php:82
103
+ #: ../trunk/classes/admin/class-admin-page.php:277
104
+ #: ../trunk/classes/admin/class-admin-page.php:417
105
+ #: ../trunk/classes/admin/class-product-meta.php:151
106
+ #: ../trunk/classes/admin/class-product-meta.php:167
107
+ #: ../trunk/templates/dashboard/reports.php:19
108
+ msgid "Commission"
109
+ msgstr "Comisión"
110
+
111
+ #: ../classes/admin/class-admin-page.php:107
112
+ #: ../trunk/classes/admin/class-admin-page.php:107
113
+ msgid "Reset WC Vendors roles "
114
+ msgstr "Resetear roles de WC Vendors "
115
+
116
+ #: ../classes/admin/class-admin-page.php:108
117
+ #: ../trunk/classes/admin/class-admin-page.php:108
118
+ msgid "Reset WC Vendor Roles"
119
+ msgstr "Resetear roles de WC Vendors"
120
+
121
+ #: ../classes/admin/class-admin-page.php:109
122
+ #: ../trunk/classes/admin/class-admin-page.php:109
123
  msgid ""
124
+ "This will reset the wcvendors roles ( vendor & pending_vendor ), back to the "
125
+ "default capabilities."
126
  msgstr ""
127
+ "Esto resetea los roles de WC Vendor (vender & pending_vendor) a sus "
128
+ "capacidades por defecto."
 
129
 
130
+ #: ../classes/admin/class-admin-page.php:114
131
+ #: ../trunk/classes/admin/class-admin-page.php:114
132
+ msgid "Reset WC Vendors "
133
+ msgstr "Resetear WC Vendors "
134
+
135
+ #: ../classes/admin/class-admin-page.php:115
136
+ #: ../trunk/classes/admin/class-admin-page.php:115
137
+ msgid "Reset WC Vendors Settings"
138
+ msgstr "Restear ajustes de WC Vendors"
139
+
140
+ #: ../classes/admin/class-admin-page.php:116
141
+ #: ../trunk/classes/admin/class-admin-page.php:116
142
  msgid ""
143
+ "This will reset wcvendors back to defaults. This DELETES ALL YOUR Settings."
 
144
  msgstr ""
145
+ "Esto resetea WC Vendors a la configuración original. Esto borra toda tu "
146
+ "configuración."
 
147
 
148
+ #: ../classes/admin/class-admin-page.php:156 ../classes/class-install.php:98
149
+ #: ../classes/class-install.php:254
150
+ #: ../trunk/classes/admin/class-admin-page.php:156
151
+ #: ../trunk/classes/class-install.php:98 ../trunk/classes/class-install.php:254
152
+ msgid "Pending Vendor"
153
+ msgstr "Vendedor Pendiente"
154
 
155
+ #: ../classes/admin/class-admin-page.php:162
156
+ #: ../trunk/classes/admin/class-admin-page.php:162
157
+ msgid "WC Vendor roles successfully reset."
158
+ msgstr "Roles de WC Vendors reseteados."
159
 
160
+ #: ../classes/admin/class-admin-page.php:176
161
+ #: ../trunk/classes/admin/class-admin-page.php:176
162
+ msgid "WC Vendors was successfully reset. All settings have been reset."
163
+ msgstr ""
164
+ "Roles de WC Vendors reseteados. Todas las configuraciones se han reseteado."
 
 
 
165
 
166
+ #: ../classes/admin/class-admin-page.php:190
167
+ #: ../trunk/classes/admin/class-admin-page.php:190
168
+ msgid "Select a Vendor"
169
+ msgstr "Seleccionar un vendedor"
170
+
171
+ #: ../classes/admin/class-admin-page.php:414
172
+ #: ../classes/admin/class-admin-reports.php:177
173
  #: ../templates/dashboard/reports.php:17
174
  #: ../templates/emails/admin-new-order.php:22
175
+ #: ../templates/emails/notify-vendor-shipped.php:26
176
+ #: ../templates/emails/vendor-new-order.php:30
177
+ #: ../trunk/classes/admin/class-admin-page.php:414
178
+ #: ../trunk/classes/admin/class-admin-reports.php:177
179
+ #: ../trunk/templates/dashboard/reports.php:17
180
+ #: ../trunk/templates/emails/admin-new-order.php:22
181
+ #: ../trunk/templates/emails/notify-vendor-shipped.php:26
182
+ #: ../trunk/templates/emails/vendor-new-order.php:30
183
  msgid "Product"
184
  msgstr "Producto"
185
 
186
+ #: ../classes/admin/class-admin-page.php:415
187
+ #: ../classes/admin/class-vendor-admin-dashboard.php:319
188
+ #: ../trunk/classes/admin/class-admin-page.php:415
189
+ #: ../trunk/classes/admin/class-vendor-admin-dashboard.php:319
190
  msgid "Order ID"
191
+ msgstr "Pedido"
192
+
193
+ #: ../classes/admin/class-admin-page.php:418
194
+ #: ../classes/admin/class-admin-reports.php:350
195
+ #: ../classes/admin/settings/sf-options.php:52
196
+ #: ../classes/admin/settings/sf-options.php:136
197
+ #: ../templates/dashboard/orders.php:45 ../templates/orders/orders.php:111
198
+ #: ../trunk/classes/admin/class-admin-page.php:418
199
+ #: ../trunk/classes/admin/class-admin-reports.php:350
200
+ #: ../trunk/classes/admin/settings/sf-options.php:52
201
+ #: ../trunk/classes/admin/settings/sf-options.php:136
202
+ #: ../trunk/templates/dashboard/orders.php:45
203
+ #: ../trunk/templates/orders/orders.php:111
204
+ msgid "Shipping"
205
+ msgstr "Envíos"
206
 
207
+ #: ../classes/admin/class-admin-page.php:419
208
+ #: ../classes/admin/class-admin-reports.php:349
209
+ #: ../trunk/classes/admin/class-admin-page.php:419
210
+ #: ../trunk/classes/admin/class-admin-reports.php:349
211
+ msgid "Tax"
212
+ msgstr "Impuesto"
 
213
 
214
+ #: ../classes/admin/class-admin-page.php:420
215
+ #: ../classes/admin/class-admin-reports.php:179
216
+ #: ../classes/admin/class-admin-reports.php:377
217
+ #: ../classes/admin/class-vendor-admin-dashboard.php:322
218
+ #: ../templates/dashboard/orders.php:46
219
+ #: ../trunk/classes/admin/class-admin-page.php:420
220
+ #: ../trunk/classes/admin/class-admin-reports.php:179
221
+ #: ../trunk/classes/admin/class-admin-reports.php:377
222
+ #: ../trunk/classes/admin/class-vendor-admin-dashboard.php:322
223
+ #: ../trunk/templates/dashboard/orders.php:46
224
  msgid "Total"
225
  msgstr "Total"
226
 
227
+ #: ../classes/admin/class-admin-page.php:421
228
+ #: ../classes/admin/class-admin-reports.php:181
229
+ #: ../classes/admin/class-admin-reports.php:464
230
+ #: ../trunk/classes/admin/class-admin-page.php:421
231
+ #: ../trunk/classes/admin/class-admin-reports.php:181
232
+ #: ../trunk/classes/admin/class-admin-reports.php:464
233
  msgid "Status"
234
  msgstr "Estado"
235
 
236
+ #: ../classes/admin/class-admin-page.php:422
237
+ #: ../classes/admin/class-vendor-admin-dashboard.php:324
238
+ #: ../classes/front/orders/class-orders.php:257
239
+ #: ../templates/dashboard/orders.php:47
240
+ #: ../trunk/classes/admin/class-admin-page.php:422
241
+ #: ../trunk/classes/admin/class-vendor-admin-dashboard.php:324
242
+ #: ../trunk/classes/front/orders/class-orders.php:257
243
+ #: ../trunk/templates/dashboard/orders.php:47
244
  msgid "Date"
245
  msgstr "Fecha"
246
 
247
+ #: ../classes/admin/class-admin-page.php:466
248
+ #: ../trunk/classes/admin/class-admin-page.php:466
249
  msgid "Mark paid"
250
  msgstr "Marcar pagado"
251
 
252
+ #: ../classes/admin/class-admin-page.php:467
253
+ #: ../trunk/classes/admin/class-admin-page.php:467
254
  msgid "Mark due"
255
  msgstr "Marcar adeudado"
256
 
257
+ #: ../classes/admin/class-admin-page.php:468
258
+ #: ../trunk/classes/admin/class-admin-page.php:468
259
  msgid "Mark reversed"
260
  msgstr "Marcar revertido"
261
 
262
+ #: ../classes/admin/class-admin-page.php:495
263
+ #: ../trunk/classes/admin/class-admin-page.php:495
264
  msgid "Filter"
265
  msgstr "Filtrar"
266
 
267
+ #: ../classes/admin/class-admin-page.php:530
268
+ #: ../trunk/classes/admin/class-admin-page.php:530
269
  msgid "Show all dates"
270
  msgstr "Todas las fechas"
271
 
272
+ #: ../classes/admin/class-admin-page.php:543
273
+ #: ../trunk/classes/admin/class-admin-page.php:543
274
  #, php-format
275
  msgid "%1$s %2$d"
276
  msgstr "%1$s %2$d"
277
 
278
+ #: ../classes/admin/class-admin-page.php:565
279
+ #: ../trunk/classes/admin/class-admin-page.php:565
280
  msgid "Show all Statuses"
281
+ msgstr "Ver todos los estados"
282
+
283
+ #: ../classes/admin/class-admin-page.php:566
284
+ #: ../classes/admin/class-admin-reports.php:353
285
+ #: ../classes/admin/class-admin-reports.php:446
286
+ #: ../classes/class-commission.php:66
287
+ #: ../trunk/classes/admin/class-admin-page.php:566
288
+ #: ../trunk/classes/admin/class-admin-reports.php:353
289
+ #: ../trunk/classes/admin/class-admin-reports.php:446
290
+ #: ../trunk/classes/class-commission.php:66
291
+ msgid "Due"
292
+ msgstr "Adeudado"
293
+
294
+ #: ../classes/admin/class-admin-page.php:567
295
+ #: ../classes/admin/class-admin-reports.php:352
296
+ #: ../classes/admin/class-admin-reports.php:447
297
+ #: ../classes/class-commission.php:67
298
+ #: ../trunk/classes/admin/class-admin-page.php:567
299
+ #: ../trunk/classes/admin/class-admin-reports.php:352
300
+ #: ../trunk/classes/admin/class-admin-reports.php:447
301
+ #: ../trunk/classes/class-commission.php:67
302
+ msgid "Paid"
303
+ msgstr "Pagado"
304
 
305
+ #: ../classes/admin/class-admin-page.php:568
306
+ #: ../classes/admin/class-admin-reports.php:351
307
+ #: ../classes/admin/class-admin-reports.php:448
308
+ #: ../classes/class-commission.php:68
309
+ #: ../trunk/classes/admin/class-admin-page.php:568
310
+ #: ../trunk/classes/admin/class-admin-reports.php:351
311
+ #: ../trunk/classes/admin/class-admin-reports.php:448
312
+ #: ../trunk/classes/class-commission.php:68
313
+ msgid "Reversed"
314
+ msgstr "Revertido"
315
+
316
+ #: ../classes/admin/class-admin-page.php:621
317
+ #: ../trunk/classes/admin/class-admin-page.php:621
318
  msgid "Commission marked paid."
319
  msgstr "Comisión marcada pagada."
320
 
321
+ #: ../classes/admin/class-admin-page.php:628
322
+ #: ../trunk/classes/admin/class-admin-page.php:628
323
  msgid "Commission marked due."
324
  msgstr "Comisión marcada adeudada."
325
 
326
+ #: ../classes/admin/class-admin-page.php:635
327
+ #: ../trunk/classes/admin/class-admin-page.php:635
328
  msgid "Commission marked reversed."
329
  msgstr "Comisión marcada revertida."
330
 
331
  #: ../classes/admin/class-admin-reports.php:44
332
+ #: ../trunk/classes/admin/class-admin-reports.php:44
333
  msgid "Overview"
334
  msgstr "Resumen"
335
 
336
  #: ../classes/admin/class-admin-reports.php:50
337
+ #: ../trunk/classes/admin/class-admin-reports.php:50
338
  msgid "Commission by vendor"
339
  msgstr "Comisión por vendedor"
340
 
341
  #: ../classes/admin/class-admin-reports.php:56
342
+ #: ../trunk/classes/admin/class-admin-reports.php:56
343
  msgid "Commission by product"
344
  msgstr "Comisión por producto"
345
 
346
+ #: ../classes/admin/class-admin-reports.php:62
347
+ #: ../classes/admin/class-admin-reports.php:348
348
+ #: ../trunk/classes/admin/class-admin-reports.php:62
349
+ #: ../trunk/classes/admin/class-admin-reports.php:348
350
+ msgid "Commission Totals"
351
+ msgstr "Totales de comisión"
352
+
353
+ #: ../classes/admin/class-admin-reports.php:63
354
+ #: ../trunk/classes/admin/class-admin-reports.php:63
355
+ msgid ""
356
+ "Commission totals for all vendors includes shipping and taxes. By default no "
357
+ "date range is used and all due commissions are returned. Use the date range "
358
+ "to filter."
359
+ msgstr ""
360
+ "Totales de comisiones para todos los vendedores incluyendo envíos e "
361
+ "impuestos. Por defecto no se utilizan rangos de fechas y se muestran todas "
362
+ "las comisiones adeudadas. Utiliza los rangos de fechas para filtrar."
363
+
364
+ #: ../classes/admin/class-admin-reports.php:124
365
+ #: ../classes/admin/class-admin-reports.php:440
366
  #: ../templates/dashboard/date-picker.php:3
367
+ #: ../trunk/classes/admin/class-admin-reports.php:124
368
+ #: ../trunk/classes/admin/class-admin-reports.php:440
369
+ #: ../trunk/templates/dashboard/date-picker.php:3
370
  msgid "From:"
371
+ msgstr "Desde:"
372
 
373
+ #: ../classes/admin/class-admin-reports.php:126
374
+ #: ../classes/admin/class-admin-reports.php:442
375
  #: ../templates/dashboard/date-picker.php:7
376
+ #: ../trunk/classes/admin/class-admin-reports.php:126
377
+ #: ../trunk/classes/admin/class-admin-reports.php:442
378
+ #: ../trunk/templates/dashboard/date-picker.php:7
379
  msgid "To:"
380
+ msgstr "Hasta:"
381
 
382
+ #: ../classes/admin/class-admin-reports.php:128
383
+ #: ../classes/admin/class-admin-reports.php:286
384
+ #: ../classes/admin/class-admin-reports.php:451
385
  #: ../templates/dashboard/date-picker.php:12
386
+ #: ../trunk/classes/admin/class-admin-reports.php:128
387
+ #: ../trunk/classes/admin/class-admin-reports.php:286
388
+ #: ../trunk/classes/admin/class-admin-reports.php:451
389
+ #: ../trunk/templates/dashboard/date-picker.php:12
390
  msgid "Show"
391
+ msgstr "Ver"
392
 
393
+ #: ../classes/admin/class-admin-reports.php:134
394
+ #: ../trunk/classes/admin/class-admin-reports.php:134
395
  msgid "Total paid in range"
396
  msgstr "Total pagado en el rango"
397
 
398
+ #: ../classes/admin/class-admin-reports.php:137
399
+ #: ../classes/admin/class-admin-reports.php:144
400
+ #: ../classes/admin/class-admin-reports.php:151
401
+ #: ../trunk/classes/admin/class-admin-reports.php:137
402
+ #: ../trunk/classes/admin/class-admin-reports.php:144
403
+ #: ../trunk/classes/admin/class-admin-reports.php:151
404
  msgid "n/a"
405
+ msgstr "N/A"
406
 
407
+ #: ../classes/admin/class-admin-reports.php:141
408
+ #: ../trunk/classes/admin/class-admin-reports.php:141
409
  msgid "Total due in range"
410
  msgstr "Total adeudado en el rango"
411
 
412
+ #: ../classes/admin/class-admin-reports.php:148
413
+ #: ../trunk/classes/admin/class-admin-reports.php:148
414
  msgid "Total reversed in range"
415
  msgstr "Total revertido en el rango"
416
 
417
+ #: ../classes/admin/class-admin-reports.php:158
418
+ #: ../trunk/classes/admin/class-admin-reports.php:158
419
  msgid "Recent Commission"
420
+ msgstr "Comisión reciente"
421
+
422
+ #: ../classes/admin/class-admin-reports.php:176
423
+ #: ../classes/front/orders/class-orders.php:249
424
+ #: ../templates/dashboard/orders.php:44
425
+ #: ../trunk/classes/admin/class-admin-reports.php:176
426
+ #: ../trunk/classes/front/orders/class-orders.php:249
427
+ #: ../trunk/templates/dashboard/orders.php:44
428
  msgid "Order"
429
+ msgstr "Pedido"
430
 
431
+ #: ../classes/admin/class-admin-reports.php:180
432
+ #: ../trunk/classes/admin/class-admin-reports.php:180
433
  msgid "Date &amp; Time"
434
+ msgstr "Fecha &amp; hora"
435
 
436
+ #: ../classes/admin/class-admin-reports.php:189
437
+ #: ../trunk/classes/admin/class-admin-reports.php:189
438
  msgid "N/A"
439
  msgstr "N/A"
440
 
441
+ #: ../classes/admin/class-admin-reports.php:194
442
+ #: ../trunk/classes/admin/class-admin-reports.php:194
443
  msgid "D j M Y \\a\\t h:ia"
444
  msgstr "D j M Y \\a\\t h:ia"
445
 
446
+ #: ../classes/admin/class-admin-reports.php:203
447
+ #: ../trunk/classes/admin/class-admin-reports.php:203
448
  msgid "No commission yet"
449
  msgstr "No hay comisión aún"
450
 
451
+ #: ../classes/admin/class-admin-reports.php:237
452
+ #: ../trunk/classes/admin/class-admin-reports.php:237
453
  msgid "Show:"
454
+ msgstr "Ver:"
455
 
456
+ #: ../classes/admin/class-admin-reports.php:246
457
+ #: ../trunk/classes/admin/class-admin-reports.php:246
458
  msgid "Search for a product&hellip;"
459
+ msgstr "Buscar un producto&hellip;"
460
 
461
+ #: ../classes/admin/class-admin-reports.php:249
462
+ #: ../trunk/classes/admin/class-admin-reports.php:249
463
  msgid "Type in a product name to start searching..."
464
+ msgstr "Escribe un nombre de producto para comenzar la búsqueda..."
465
 
466
+ #: ../classes/admin/class-admin-reports.php:281
467
+ #: ../trunk/classes/admin/class-admin-reports.php:281
468
  msgid "Select a vendor&hellip;"
469
  msgstr "Seleccionar un vendedor&hellip;"
470
 
471
+ #: ../classes/admin/class-admin-reports.php:347
472
+ #: ../trunk/classes/admin/class-admin-reports.php:347
473
  msgid "Month"
474
  msgstr "Mes"
475
 
476
+ #: ../classes/admin/class-admin-reports.php:462
477
+ #: ../trunk/classes/admin/class-admin-reports.php:462
478
+ msgid "Tax Total"
479
+ msgstr "Total de impuestos"
480
 
481
+ #: ../classes/admin/class-admin-reports.php:463
482
+ #: ../trunk/classes/admin/class-admin-reports.php:463
483
+ msgid "Shipping Total"
484
+ msgstr "Total de envío"
 
485
 
486
+ #: ../classes/admin/class-admin-reports.php:465
487
+ #: ../trunk/classes/admin/class-admin-reports.php:465
488
+ msgid "Commission Total"
489
+ msgstr "Total de comisión"
490
 
491
+ #: ../classes/admin/class-admin-reports.php:487
492
+ #: ../trunk/classes/admin/class-admin-reports.php:487
493
+ msgid "No commissions found."
494
+ msgstr "No se han encontrado comisiones."
495
 
496
+ #: ../classes/admin/class-admin-users.php:394
497
+ #: ../trunk/classes/admin/class-admin-users.php:394
498
  msgid "Enable HTML for the shop description"
499
  msgstr "Permitir HTML en la descripción de la tienda"
500
 
501
+ #: ../classes/admin/class-admin-users.php:400
502
+ #: ../trunk/classes/admin/class-admin-users.php:400
503
  msgid "Shop name"
504
  msgstr "Nombre de la tienda"
505
 
506
+ #: ../classes/admin/class-admin-users.php:407
507
+ #: ../trunk/classes/admin/class-admin-users.php:407
508
  msgid "PayPal E-mail"
509
+ msgstr "Email de PayPal"
510
 
511
+ #: ../classes/admin/class-admin-users.php:408
512
+ #: ../trunk/classes/admin/class-admin-users.php:408
513
  msgid "required"
514
  msgstr "requerido"
515
 
516
+ #: ../classes/admin/class-admin-users.php:415
517
+ #: ../trunk/classes/admin/class-admin-users.php:415
518
  msgid "Commission rate"
519
+ msgstr "Tasa de comisión"
520
 
521
+ #: ../classes/admin/class-admin-users.php:416
522
+ #: ../classes/admin/class-product-meta.php:174
523
+ #: ../trunk/classes/admin/class-admin-users.php:416
524
+ #: ../trunk/classes/admin/class-product-meta.php:174
525
  msgid "Leave blank for default"
526
+ msgstr "Dejar en blanco para usar el valor por defecto"
527
+
528
+ #: ../classes/admin/class-admin-users.php:422
529
+ #: ../trunk/classes/admin/class-admin-users.php:422
530
+ msgid "Give Tax"
531
+ msgstr "Dar impuesto"
532
+
533
+ #: ../classes/admin/class-admin-users.php:427
534
+ #: ../trunk/classes/admin/class-admin-users.php:427
535
+ msgid "Tax override for vendor"
536
+ msgstr "Impuesto para el vendedor"
537
+
538
+ #: ../classes/admin/class-admin-users.php:433
539
+ #: ../trunk/classes/admin/class-admin-users.php:433
540
+ msgid "Give Shipping"
541
+ msgstr "Dar envío"
542
+
543
+ #: ../classes/admin/class-admin-users.php:438
544
+ #: ../trunk/classes/admin/class-admin-users.php:438
545
+ msgid "Shipping override for vendor"
546
+ msgstr "Envío para el vendedor"
547
 
548
+ #: ../classes/admin/class-admin-users.php:444
549
  #: ../classes/admin/views/html-vendor-settings-page.php:30
 
550
  #: ../templates/dashboard/settings/seller-info.php:3
551
+ #: ../trunk/classes/admin/class-admin-users.php:444
552
+ #: ../trunk/classes/admin/views/html-vendor-settings-page.php:30
553
+ #: ../trunk/templates/dashboard/settings/seller-info.php:3
554
  msgid "Seller info"
555
  msgstr "Información del vendedor"
556
 
557
+ #: ../classes/admin/class-admin-users.php:449
558
+ #: ../trunk/classes/admin/class-admin-users.php:449
559
  msgid "Shop description"
560
  msgstr "Descripción de la tienda"
561
 
562
+ #: ../classes/admin/class-vendor-admin-dashboard.php:22
563
+ #: ../classes/class-install.php:207
564
+ #: ../trunk/classes/admin/class-vendor-admin-dashboard.php:22
565
+ #: ../trunk/classes/class-install.php:207
566
  msgid "Shop Settings"
567
+ msgstr "Tienda"
568
+
569
+ #: ../classes/admin/class-vendor-admin-dashboard.php:23
570
+ #: ../classes/admin/class-vendor-admin-dashboard.php:180
571
+ #: ../classes/admin/settings/sf-options.php:196
572
+ #: ../classes/class-install.php:206 ../templates/dashboard/orders.php:35
573
+ #: ../trunk/classes/admin/class-vendor-admin-dashboard.php:23
574
+ #: ../trunk/classes/admin/class-vendor-admin-dashboard.php:180
575
+ #: ../trunk/classes/admin/settings/sf-options.php:196
576
+ #: ../trunk/classes/class-install.php:206
577
+ #: ../trunk/templates/dashboard/orders.php:35
578
  msgid "Orders"
579
+ msgstr "Pedidos"
580
 
581
+ #: ../classes/admin/class-vendor-admin-dashboard.php:67
582
+ #: ../classes/front/dashboard/class-vendor-dashboard.php:112
583
+ #: ../trunk/classes/admin/class-vendor-admin-dashboard.php:67
584
+ #: ../trunk/classes/front/dashboard/class-vendor-dashboard.php:112
585
  msgid "Your PayPal address is not a valid email address."
586
  msgstr "Tu dirección de PayPal no es una dirección de email válida."
587
 
588
+ #: ../classes/admin/class-vendor-admin-dashboard.php:76
589
+ #: ../classes/front/dashboard/class-vendor-dashboard.php:121
590
+ #: ../trunk/classes/admin/class-vendor-admin-dashboard.php:76
591
+ #: ../trunk/classes/front/dashboard/class-vendor-dashboard.php:121
592
  msgid "That shop name is already taken. Your shop name must be unique."
593
  msgstr "Ese nombre de tienda ya está tomado. Tu tienda debe ser única."
594
 
595
+ #: ../classes/admin/class-vendor-admin-dashboard.php:112
596
+ #: ../classes/admin/settings/classes/sf-class-settings.php:371
597
+ #: ../classes/front/dashboard/class-vendor-dashboard.php:139
598
+ #: ../trunk/classes/admin/class-vendor-admin-dashboard.php:112
599
+ #: ../trunk/classes/admin/settings/classes/sf-class-settings.php:371
600
+ #: ../trunk/classes/front/dashboard/class-vendor-dashboard.php:139
601
  msgid "Settings saved."
602
  msgstr "Ajustes guardados."
603
 
604
+ #: ../classes/admin/class-vendor-admin-dashboard.php:243
605
+ #: ../trunk/classes/admin/class-vendor-admin-dashboard.php:243
606
+ msgid "order"
607
+ msgstr "pedido"
608
+
609
+ #: ../classes/admin/class-vendor-admin-dashboard.php:244
610
+ #: ../trunk/classes/admin/class-vendor-admin-dashboard.php:244
611
+ msgid "orders"
612
+ msgstr "pedidos"
613
+
614
+ #: ../classes/admin/class-vendor-admin-dashboard.php:320
615
+ #: ../trunk/classes/admin/class-vendor-admin-dashboard.php:320
616
  msgid "Customer"
617
  msgstr "Cliente"
618
 
619
+ #: ../classes/admin/class-vendor-admin-dashboard.php:321
620
+ #: ../classes/admin/settings/sf-options.php:127
621
+ #: ../classes/admin/settings/sf-options.php:254
622
+ #: ../trunk/classes/admin/class-vendor-admin-dashboard.php:321
623
+ #: ../trunk/classes/admin/settings/sf-options.php:127
624
+ #: ../trunk/classes/admin/settings/sf-options.php:254
625
  msgid "Products"
626
  msgstr "Productos"
627
 
628
+ #: ../classes/admin/class-vendor-admin-dashboard.php:325
629
+ #: ../templates/dashboard/orders.php:106
630
+ #: ../trunk/classes/admin/class-vendor-admin-dashboard.php:325
631
+ #: ../trunk/templates/dashboard/orders.php:106
632
  msgid "Shipped"
633
  msgstr "Enviado"
634
 
635
+ #: ../classes/admin/class-vendor-admin-dashboard.php:361
636
+ #: ../templates/dashboard/orders.php:99
637
+ #: ../trunk/classes/admin/class-vendor-admin-dashboard.php:361
638
+ #: ../trunk/templates/dashboard/orders.php:99
639
  msgid "Mark shipped"
640
+ msgstr "Marcar como enviado"
641
 
642
+ #: ../classes/admin/class-vendor-admin-dashboard.php:386
643
+ #: ../trunk/classes/admin/class-vendor-admin-dashboard.php:386
644
  msgid "Orders marked shipped."
645
  msgstr "Pedidos marcados como enviados."
646
 
647
+ #: ../classes/admin/class-vendor-admin-dashboard.php:422
648
+ #: ../classes/front/dashboard/class-vendor-dashboard.php:40
649
+ #: ../trunk/classes/admin/class-vendor-admin-dashboard.php:422
650
+ #: ../trunk/classes/front/dashboard/class-vendor-dashboard.php:40
651
+ msgid "You are not allowed to modify this order."
652
+ msgstr "No tienes permiso para editar este pedido."
653
+
654
+ #: ../classes/admin/class-vendor-admin-dashboard.php:544
655
+ #: ../trunk/classes/admin/class-vendor-admin-dashboard.php:544
656
+ msgid "Yes"
657
+ msgstr "Sí"
658
+
659
+ #: ../classes/admin/class-vendor-admin-dashboard.php:544
660
+ #: ../trunk/classes/admin/class-vendor-admin-dashboard.php:544
661
+ msgid "No"
662
+ msgstr "No"
663
+
664
  #: ../classes/admin/class-vendor-applicants.php:26
665
+ #: ../trunk/classes/admin/class-vendor-applicants.php:26
666
  msgid "Approve"
667
  msgstr "Aprobar"
668
 
669
  #: ../classes/admin/class-vendor-applicants.php:27
670
+ #: ../trunk/classes/admin/class-vendor-applicants.php:27
671
  msgid "Deny"
672
  msgstr "Rechazar"
673
 
674
+ #: ../classes/admin/class-vendor-applicants.php:73
675
+ #: ../trunk/classes/admin/class-vendor-applicants.php:73
676
  msgid "Vendor has been <b>denied</b>."
677
+ msgstr "Vendedor ha sido <b>rechazado</b>."
678
 
679
+ #: ../classes/admin/class-vendor-applicants.php:84
680
+ #: ../trunk/classes/admin/class-vendor-applicants.php:84
681
  msgid "Vendor has been <b>approved</b>."
682
  msgstr "Vendedor ha sido <b>aprobado</b>."
683
 
684
+ #: ../classes/admin/class-vendor-applicants.php:98
685
+ #: ../trunk/classes/admin/class-vendor-applicants.php:98
686
  msgid "Pending Vendors"
687
+ msgstr "Vendedores pendientes"
688
 
689
+ #: ../classes/admin/emails/class-emails.php:59
690
  #: ../classes/admin/emails/class-wc-approve-vendor.php:70
691
+ #: ../trunk/classes/admin/emails/class-emails.php:59
692
+ #: ../trunk/classes/admin/emails/class-wc-approve-vendor.php:70
693
  msgid "pending"
694
  msgstr "pendientes"
695
 
696
+ #: ../classes/admin/emails/class-emails.php:61
697
+ #: ../trunk/classes/admin/emails/class-emails.php:61
698
  msgid "approved"
699
  msgstr "aprobados"
700
 
701
+ #: ../classes/admin/emails/class-emails.php:63
702
+ #: ../trunk/classes/admin/emails/class-emails.php:63
703
  msgid "denied"
704
  msgstr "denegados"
705
 
 
 
 
 
 
 
706
  #: ../classes/admin/emails/class-wc-approve-vendor.php:28
707
+ #: ../trunk/classes/admin/emails/class-wc-approve-vendor.php:28
708
  msgid "Vendor Application"
709
+ msgstr "Postulación del vendedor"
710
 
711
  #: ../classes/admin/emails/class-wc-approve-vendor.php:29
712
+ #: ../trunk/classes/admin/emails/class-wc-approve-vendor.php:29
713
  msgid "Vendor application will either be approved, denied, or pending."
714
+ msgstr "La postulación del vendedor puede ser aprobada, denegada o pendiente."
715
 
716
  #: ../classes/admin/emails/class-wc-approve-vendor.php:31
717
+ #: ../trunk/classes/admin/emails/class-wc-approve-vendor.php:31
718
  msgid "Application {status}"
719
  msgstr "Postulación {status}"
720
 
721
  #: ../classes/admin/emails/class-wc-approve-vendor.php:32
722
+ #: ../trunk/classes/admin/emails/class-wc-approve-vendor.php:32
723
  msgid "[{blogname}] Your vendor application has been {status}"
724
  msgstr "[{blogname}] Tu postulación a vendedor está {status}"
725
 
726
  #: ../classes/admin/emails/class-wc-approve-vendor.php:123
727
+ #: ../classes/admin/emails/class-wc-notify-admin.php:134
728
+ #: ../classes/admin/emails/class-wc-notify-shipped.php:166
729
+ #: ../classes/admin/emails/class-wc-notify-vendor.php:265
730
  #: ../classes/gateways/WCV_Gateway_Test/class-wcv-gateway-test.php:62
731
+ #: ../trunk/classes/admin/emails/class-wc-approve-vendor.php:123
732
+ #: ../trunk/classes/admin/emails/class-wc-notify-admin.php:134
733
+ #: ../trunk/classes/admin/emails/class-wc-notify-shipped.php:166
734
+ #: ../trunk/classes/admin/emails/class-wc-notify-vendor.php:265
735
+ #: ../trunk/classes/gateways/WCV_Gateway_Test/class-wcv-gateway-test.php:62
736
  msgid "Enable/Disable"
737
+ msgstr "Habilitar/deshabilitar"
738
 
739
  #: ../classes/admin/emails/class-wc-approve-vendor.php:125
740
+ #: ../classes/admin/emails/class-wc-notify-admin.php:136
741
+ #: ../classes/admin/emails/class-wc-notify-shipped.php:168
742
+ #: ../classes/admin/emails/class-wc-notify-vendor.php:267
743
+ #: ../trunk/classes/admin/emails/class-wc-approve-vendor.php:125
744
+ #: ../trunk/classes/admin/emails/class-wc-notify-admin.php:136
745
+ #: ../trunk/classes/admin/emails/class-wc-notify-shipped.php:168
746
+ #: ../trunk/classes/admin/emails/class-wc-notify-vendor.php:267
747
  msgid "Enable this email notification"
748
+ msgstr "Habilitar esta notificación por email"
749
 
750
  #: ../classes/admin/emails/class-wc-approve-vendor.php:129
751
+ #: ../classes/admin/emails/class-wc-notify-admin.php:140
752
+ #: ../trunk/classes/admin/emails/class-wc-approve-vendor.php:129
753
+ #: ../trunk/classes/admin/emails/class-wc-notify-admin.php:140
754
  msgid "Recipient(s)"
755
  msgstr "Receptor(es)"
756
 
757
  #: ../classes/admin/emails/class-wc-approve-vendor.php:131
758
+ #: ../classes/admin/emails/class-wc-notify-admin.php:142
759
+ #: ../trunk/classes/admin/emails/class-wc-approve-vendor.php:131
760
+ #: ../trunk/classes/admin/emails/class-wc-notify-admin.php:142
761
  #, php-format
762
  msgid ""
763
  "Enter recipients (comma separated) for this email. Defaults to <code>%s</"
767
  "<code>%s</code>."
768
 
769
  #: ../classes/admin/emails/class-wc-approve-vendor.php:136
770
+ #: ../classes/admin/emails/class-wc-notify-admin.php:147
771
+ #: ../classes/admin/emails/class-wc-notify-shipped.php:172
772
+ #: ../classes/admin/emails/class-wc-notify-vendor.php:271
773
+ #: ../trunk/classes/admin/emails/class-wc-approve-vendor.php:136
774
+ #: ../trunk/classes/admin/emails/class-wc-notify-admin.php:147
775
+ #: ../trunk/classes/admin/emails/class-wc-notify-shipped.php:172
776
+ #: ../trunk/classes/admin/emails/class-wc-notify-vendor.php:271
777
  msgid "Subject"
778
  msgstr "Asunto"
779
 
780
  #: ../classes/admin/emails/class-wc-approve-vendor.php:138
781
+ #: ../classes/admin/emails/class-wc-notify-admin.php:149
782
+ #: ../classes/admin/emails/class-wc-notify-shipped.php:174
783
+ #: ../classes/admin/emails/class-wc-notify-vendor.php:273
784
+ #: ../trunk/classes/admin/emails/class-wc-approve-vendor.php:138
785
+ #: ../trunk/classes/admin/emails/class-wc-notify-admin.php:149
786
+ #: ../trunk/classes/admin/emails/class-wc-notify-shipped.php:174
787
+ #: ../trunk/classes/admin/emails/class-wc-notify-vendor.php:273
788
  #, php-format
789
  msgid ""
790
  "This controls the email subject line. Leave blank to use the default "
791
  "subject: <code>%s</code>."
792
  msgstr ""
793
+ "Esto controla el asunto del email. Dejar en blanco para usar el valor por "
794
+ "defecto: <code>%s</code>."
795
 
796
  #: ../classes/admin/emails/class-wc-approve-vendor.php:143
797
+ #: ../classes/admin/emails/class-wc-notify-admin.php:154
798
+ #: ../classes/admin/emails/class-wc-notify-shipped.php:179
799
+ #: ../classes/admin/emails/class-wc-notify-vendor.php:278
800
+ #: ../trunk/classes/admin/emails/class-wc-approve-vendor.php:143
801
+ #: ../trunk/classes/admin/emails/class-wc-notify-admin.php:154
802
+ #: ../trunk/classes/admin/emails/class-wc-notify-shipped.php:179
803
+ #: ../trunk/classes/admin/emails/class-wc-notify-vendor.php:278
804
  msgid "Email Heading"
805
+ msgstr "Título del email"
806
 
807
  #: ../classes/admin/emails/class-wc-approve-vendor.php:145
808
+ #: ../classes/admin/emails/class-wc-notify-admin.php:156
809
+ #: ../classes/admin/emails/class-wc-notify-shipped.php:181
810
+ #: ../classes/admin/emails/class-wc-notify-vendor.php:280
811
+ #: ../trunk/classes/admin/emails/class-wc-approve-vendor.php:145
812
+ #: ../trunk/classes/admin/emails/class-wc-notify-admin.php:156
813
+ #: ../trunk/classes/admin/emails/class-wc-notify-shipped.php:181
814
+ #: ../trunk/classes/admin/emails/class-wc-notify-vendor.php:280
815
  #, php-format
816
  msgid ""
817
  "This controls the main heading contained within the email notification. "
818
  "Leave blank to use the default heading: <code>%s</code>."
819
  msgstr ""
820
  "Esto controla el título principal de la notificación por email. Dejar en "
821
+ "blanco para utilizar el valor por defecto: <code>%s</code>."
822
 
823
  #: ../classes/admin/emails/class-wc-approve-vendor.php:150
824
+ #: ../classes/admin/emails/class-wc-notify-admin.php:161
825
+ #: ../classes/admin/emails/class-wc-notify-shipped.php:186
826
+ #: ../classes/admin/emails/class-wc-notify-vendor.php:291
827
+ #: ../trunk/classes/admin/emails/class-wc-approve-vendor.php:150
828
+ #: ../trunk/classes/admin/emails/class-wc-notify-admin.php:161
829
+ #: ../trunk/classes/admin/emails/class-wc-notify-shipped.php:186
830
+ #: ../trunk/classes/admin/emails/class-wc-notify-vendor.php:291
831
  msgid "Email type"
832
  msgstr "Tipo de email"
833
 
834
  #: ../classes/admin/emails/class-wc-approve-vendor.php:152
835
+ #: ../classes/admin/emails/class-wc-notify-admin.php:163
836
+ #: ../classes/admin/emails/class-wc-notify-shipped.php:188
837
+ #: ../classes/admin/emails/class-wc-notify-vendor.php:293
838
+ #: ../trunk/classes/admin/emails/class-wc-approve-vendor.php:152
839
+ #: ../trunk/classes/admin/emails/class-wc-notify-admin.php:163
840
+ #: ../trunk/classes/admin/emails/class-wc-notify-shipped.php:188
841
+ #: ../trunk/classes/admin/emails/class-wc-notify-vendor.php:293
842
  msgid "Choose which format of email to send."
843
  msgstr "Elegir cuál formato de email se mandará."
844
 
845
  #: ../classes/admin/emails/class-wc-approve-vendor.php:156
846
+ #: ../classes/admin/emails/class-wc-notify-admin.php:167
847
+ #: ../classes/admin/emails/class-wc-notify-shipped.php:192
848
+ #: ../classes/admin/emails/class-wc-notify-vendor.php:297
849
+ #: ../trunk/classes/admin/emails/class-wc-approve-vendor.php:156
850
+ #: ../trunk/classes/admin/emails/class-wc-notify-admin.php:167
851
+ #: ../trunk/classes/admin/emails/class-wc-notify-shipped.php:192
852
+ #: ../trunk/classes/admin/emails/class-wc-notify-vendor.php:297
853
  msgid "Plain text"
854
  msgstr "Texto plano"
855
 
856
  #: ../classes/admin/emails/class-wc-approve-vendor.php:157
857
+ #: ../classes/admin/emails/class-wc-notify-admin.php:168
858
+ #: ../classes/admin/emails/class-wc-notify-shipped.php:193
859
+ #: ../classes/admin/emails/class-wc-notify-vendor.php:298
860
+ #: ../trunk/classes/admin/emails/class-wc-approve-vendor.php:157
861
+ #: ../trunk/classes/admin/emails/class-wc-notify-admin.php:168
862
+ #: ../trunk/classes/admin/emails/class-wc-notify-shipped.php:193
863
+ #: ../trunk/classes/admin/emails/class-wc-notify-vendor.php:298
864
  msgid "HTML"
865
  msgstr "HTML"
866
 
867
  #: ../classes/admin/emails/class-wc-approve-vendor.php:158
868
+ #: ../classes/admin/emails/class-wc-notify-admin.php:169
869
+ #: ../classes/admin/emails/class-wc-notify-shipped.php:194
870
+ #: ../classes/admin/emails/class-wc-notify-vendor.php:299
871
+ #: ../trunk/classes/admin/emails/class-wc-approve-vendor.php:158
872
+ #: ../trunk/classes/admin/emails/class-wc-notify-admin.php:169
873
+ #: ../trunk/classes/admin/emails/class-wc-notify-shipped.php:194
874
+ #: ../trunk/classes/admin/emails/class-wc-notify-vendor.php:299
875
  msgid "Multipart"
876
  msgstr "Multiparte"
877
 
878
  #: ../classes/admin/emails/class-wc-notify-admin.php:28
879
+ #: ../trunk/classes/admin/emails/class-wc-notify-admin.php:28
880
  msgid "New Vendor Product"
881
+ msgstr "Nuevo producto del vendedor"
882
 
883
  #: ../classes/admin/emails/class-wc-notify-admin.php:29
884
+ #: ../trunk/classes/admin/emails/class-wc-notify-admin.php:29
885
  msgid "New order emails are sent when a new product is submitted by a vendor"
886
  msgstr ""
887
  "Nuevos emails de pedido se envían cuando un nuevo producto es ingresado por "
888
  "un vendedor"
889
 
890
  #: ../classes/admin/emails/class-wc-notify-admin.php:31
891
+ #: ../trunk/classes/admin/emails/class-wc-notify-admin.php:31
892
  msgid "New product submitted: {product_name}"
893
  msgstr "Nuevo producto ingresado: {product_name}"
894
 
895
  #: ../classes/admin/emails/class-wc-notify-admin.php:32
896
+ #: ../trunk/classes/admin/emails/class-wc-notify-admin.php:32
897
  msgid "[{blogname}] New product submitted by {vendor_name} - {product_name}"
898
  msgstr ""
899
  "[{blogname}] Nuevo producto ingresado por {vendor_name} - {product_name}"
900
 
901
  #: ../classes/admin/emails/class-wc-notify-shipped.php:28
902
+ #: ../trunk/classes/admin/emails/class-wc-notify-shipped.php:28
903
  msgid "Vendor has shipped"
904
+ msgstr "Vendedor ha enviado"
905
 
906
  #: ../classes/admin/emails/class-wc-notify-shipped.php:29
907
+ #: ../trunk/classes/admin/emails/class-wc-notify-shipped.php:29
908
  msgid ""
909
  "An email is sent when a vendor has marked one of their orders as shipped."
910
  msgstr ""
911
+ "Un email es enviado cada vez que un vendedor marca un pedido como enviado."
912
 
913
  #: ../classes/admin/emails/class-wc-notify-shipped.php:31
914
+ #: ../trunk/classes/admin/emails/class-wc-notify-shipped.php:31
915
  msgid "Your order has been shipped"
916
+ msgstr "Tu pedido ha sido enviado"
917
 
918
  #: ../classes/admin/emails/class-wc-notify-shipped.php:32
919
+ #: ../trunk/classes/admin/emails/class-wc-notify-shipped.php:32
920
  msgid ""
921
  "[{blogname}] Your order has been shipped ({order_number}) - {order_date}"
922
+ msgstr "[{blogname}] Tu pedido ha sido enviado ({order_number}) - {order_date}"
 
923
 
924
+ #: ../classes/admin/emails/class-wc-notify-shipped.php:115
925
+ #: ../trunk/classes/admin/emails/class-wc-notify-shipped.php:115
926
  msgid "Subtotal:"
927
  msgstr "Subtotal:"
928
 
929
  #: ../classes/admin/emails/class-wc-notify-vendor.php:27
930
+ #: ../trunk/classes/admin/emails/class-wc-notify-vendor.php:27
931
  msgid "Notify vendors"
932
  msgstr "Notificar vendedores"
933
 
934
  #: ../classes/admin/emails/class-wc-notify-vendor.php:28
935
+ #: ../trunk/classes/admin/emails/class-wc-notify-vendor.php:28
936
  msgid "New order emails are sent when an order is received/paid by a customer."
937
  msgstr ""
938
+ "Nuevos emails de pedido son enviados cada vez que un pedido es recibido/"
939
+ "pagado por un usuario."
940
 
941
  #: ../classes/admin/emails/class-wc-notify-vendor.php:30
942
+ #: ../trunk/classes/admin/emails/class-wc-notify-vendor.php:30
943
  msgid "New customer order"
944
+ msgstr "Nuevo pedido de cliente"
945
 
946
  #: ../classes/admin/emails/class-wc-notify-vendor.php:31
947
+ #: ../trunk/classes/admin/emails/class-wc-notify-vendor.php:31
948
  msgid "[{blogname}] New customer order ({order_number}) - {order_date}"
949
+ msgstr "[{blogname}] Nuevo pedido de cliente ({order_number}) - {order_date}"
950
 
951
+ #: ../classes/admin/emails/class-wc-notify-vendor.php:107
952
+ #: ../trunk/classes/admin/emails/class-wc-notify-vendor.php:107
953
  msgid "Commission Subtotal:"
954
+ msgstr "Subtotal de comisión:"
955
 
956
+ #: ../classes/admin/emails/class-wc-notify-vendor.php:113
957
+ #: ../trunk/classes/admin/emails/class-wc-notify-vendor.php:113
958
  msgid "Tax Subtotal:"
959
  msgstr "Subtotal de impuesto:"
960
 
961
+ #: ../classes/admin/emails/class-wc-notify-vendor.php:121
962
+ #: ../trunk/classes/admin/emails/class-wc-notify-vendor.php:121
963
  msgid "Shipping Subtotal:"
964
+ msgstr "Subtotal de envío:"
965
+
966
+ #: ../classes/admin/emails/class-wc-notify-vendor.php:285
967
+ #: ../trunk/classes/admin/emails/class-wc-notify-vendor.php:285
968
+ msgid "Product Totals"
969
+ msgstr "Totales del producto"
970
+
971
+ #: ../classes/admin/emails/class-wc-notify-vendor.php:287
972
+ #: ../trunk/classes/admin/emails/class-wc-notify-vendor.php:287
973
+ msgid ""
974
+ "Show the commission due/paid as the product totals instead of the product "
975
+ "prices."
976
+ msgstr ""
977
 
978
  #: ../classes/admin/settings/classes/sf-class-format-options.php:211
979
+ #: ../classes/admin/settings/classes/sf-class-settings.php:794
980
+ #: ../classes/admin/settings/classes/sf-class-settings.php:828
981
+ #: ../trunk/classes/admin/settings/classes/sf-class-format-options.php:211
982
+ #: ../trunk/classes/admin/settings/classes/sf-class-settings.php:794
983
+ #: ../trunk/classes/admin/settings/classes/sf-class-settings.php:828
984
  msgid "Select a page..."
985
  msgstr "Seleccionar una página..."
986
 
987
  #: ../classes/admin/settings/classes/sf-class-settings.php:153
988
  #: ../templates/dashboard/settings/settings.php:1
989
+ #: ../trunk/classes/admin/settings/classes/sf-class-settings.php:153
990
+ #: ../trunk/templates/dashboard/settings/settings.php:1
991
  msgid "Settings"
992
  msgstr "Ajustes"
993
 
994
+ #: ../classes/admin/settings/classes/sf-class-settings.php:305
995
+ #: ../trunk/classes/admin/settings/classes/sf-class-settings.php:305
996
  msgid "Could not load settings at: "
997
  msgstr "No se pueden cargar ajustes en: "
998
 
999
+ #: ../classes/admin/settings/classes/sf-class-settings.php:305
1000
+ #: ../trunk/classes/admin/settings/classes/sf-class-settings.php:305
1001
  msgid "Error - WP Settings Framework"
1002
  msgstr "Error - WP Settings Framework"
1003
 
1004
+ #: ../classes/admin/settings/classes/sf-class-settings.php:489
1005
+ #: ../trunk/classes/admin/settings/classes/sf-class-settings.php:489
1006
  #, php-format
1007
  msgid "Save %s changes"
1008
+ msgstr "Guardar cambios en %s"
1009
+
1010
+ #: ../classes/admin/settings/classes/sf-class-settings.php:502
1011
+ #: ../trunk/classes/admin/settings/classes/sf-class-settings.php:502
1012
+ msgid ""
1013
+ "Please help with a <a href=\"https://wordpress.org/support/view/plugin-"
1014
+ "reviews/wc-vendors?rate=5#postform\" target=\"top\">High Five!</a> | <a href="
1015
+ "\"https://www.wcvendors.com/product/wc-vendors-pro/\" target=\"top\">WC "
1016
+ "Vendors Pro</a> | <a href=\"https://www.wcvendors.com/product/stripe-"
1017
+ "commissions-gateway/\" target=\"top\">Stripe Commissions & Gateway</a> | <a "
1018
+ "href=\"https://www.wcvendors.com/kb/\" target=\"top\">KnowledgeBase</a> | <a "
1019
+ "href=\"https://www.wcvendors.com/help/\" target=\"top\">Help Forums</a>"
1020
+ msgstr ""
1021
+ "Por favor ayuda con una <a href=“https://wordpress.org/support/view/plugin-"
1022
+ "reviews/wc-vendors?rate=5#postform” target=“top”>calificación de cinco "
1023
+ "estrellas</a> | <a href=“https://www.wcvendors.com/product/wc-vendors-pro/“ "
1024
+ "target=“top”>WC Vendors Pro</a> | <a href=“https://www.wcvendors.com/product/"
1025
+ "stripe-commissions-gateway/“ target=“top”>Stripe Commissions & Gateway</a> | "
1026
+ "<a href=“https://www.wcvendors.com/kb/“ target=“top”>KnowledgeBase</a> | <a "
1027
+ "href=“https://www.wcvendors.com/help/“ target=“top”>Foros de ayuda</a>"
1028
+
1029
+ #: ../classes/admin/settings/classes/sf-class-settings.php:787
1030
+ #: ../classes/admin/settings/classes/sf-class-settings.php:821
1031
+ #: ../trunk/classes/admin/settings/classes/sf-class-settings.php:787
1032
+ #: ../trunk/classes/admin/settings/classes/sf-class-settings.php:821
1033
+ msgid "Edit Page"
1034
+ msgstr "Editar página"
1035
+
1036
+ #: ../classes/admin/settings/classes/sf-class-settings.php:788
1037
+ #: ../classes/admin/settings/classes/sf-class-settings.php:822
1038
+ #: ../trunk/classes/admin/settings/classes/sf-class-settings.php:788
1039
+ #: ../trunk/classes/admin/settings/classes/sf-class-settings.php:822
1040
+ msgid "View Page"
1041
+ msgstr "Ver página"
1042
+
1043
+ #: ../classes/admin/settings/classes/sf-class-settings.php:886
1044
+ #: ../trunk/classes/admin/settings/classes/sf-class-settings.php:886
1045
+ #, php-format
1046
+ msgid "Update %s"
1047
+ msgstr "Actualizar %s"
1048
+
1049
+ #: ../classes/admin/settings/classes/sf-class-settings.php:886
1050
+ #: ../trunk/classes/admin/settings/classes/sf-class-settings.php:886
1051
+ #, php-format
1052
+ msgid "Add %s"
1053
+ msgstr "Agregar %s"
1054
+
1055
+ #: ../classes/admin/settings/classes/sf-class-settings.php:886
1056
+ #: ../trunk/classes/admin/settings/classes/sf-class-settings.php:886
1057
+ #, php-format
1058
+ msgid "Upload an image for the %s"
1059
+ msgstr "Subir una imagen para el %s"
1060
 
1061
  #: ../classes/admin/settings/sf-options.php:5
1062
+ #: ../trunk/classes/admin/settings/sf-options.php:5
1063
  msgid "General options"
1064
  msgstr "Opciones generales"
1065
 
1066
  #: ../classes/admin/settings/sf-options.php:8
1067
+ #: ../trunk/classes/admin/settings/sf-options.php:8
1068
  msgid "Default commission (%)"
1069
  msgstr "Comisión por defecto (%)"
1070
 
1071
  #: ../classes/admin/settings/sf-options.php:9
1072
+ #: ../trunk/classes/admin/settings/sf-options.php:9
1073
  msgid ""
1074
+ "The default rate you pay each vendor for a product sale. <br>You can also "
1075
+ "give vendors their own individual commission rates by editing the vendors "
1076
+ "user account.<br>Also, you can edit an individual products commission to "
1077
+ "override both of these settings on a per product basis."
1078
  msgstr ""
1079
+ "La comisión estándar que pagas a cada vendedor por cada producto vendido."
1080
+ "<br>También puedes dar a cada vendedor su propia comisión editando su cuenta "
1081
+ "de usuario.<br>También puedes dar a cada producto su propia comisión "
1082
+ "editando la página del producto."
1083
 
1084
  #: ../classes/admin/settings/sf-options.php:20
1085
+ #: ../classes/admin/settings/sf-options.php:27
1086
+ #: ../trunk/classes/admin/settings/sf-options.php:20
1087
+ #: ../trunk/classes/admin/settings/sf-options.php:27
 
1088
  msgid "Allow users or guests to apply to become a vendor"
1089
  msgstr "Permitir a los usuarios o visitas solicitar ser vendedores"
1090
 
1091
  #: ../classes/admin/settings/sf-options.php:22
1092
+ #: ../trunk/classes/admin/settings/sf-options.php:22
1093
+ msgid ""
1094
+ "Allow users or guests to apply to become a vendor. <br><br><strong>WARNING:"
1095
+ "</strong> You MUST \"<strong>Enable registration on the \"My Account\" "
1096
+ "page</strong>\" in your <strong>WooCommerce > Settings > Accounts</strong> "
1097
+ "page for this option to work. Currently, you have registration disabled."
1098
+ msgstr ""
1099
+ "Permitir a los usuarios o visitas solicitar ser vendedores."
1100
+ "<br><br><strong>ATENCIÓN:</strong> Debes activar la registración en la "
1101
+ "página “Mi cuenta” en WooCommerce > Ajustes > Cuentas para que esta opción "
1102
+ "funcione. Actualmente está desactivada."
1103
+
1104
+ #: ../classes/admin/settings/sf-options.php:26
1105
+ #: ../trunk/classes/admin/settings/sf-options.php:26
1106
+ msgid "Registration"
1107
+ msgstr "Registración"
1108
+
1109
+ #: ../classes/admin/settings/sf-options.php:28
1110
+ #: ../trunk/classes/admin/settings/sf-options.php:28
1111
  msgid ""
1112
  "This will show a checkbox on the My Account page's registration form asking "
1113
  "if the user would like to apply to be a vendor. Also, on the Vendor "
1118
  "tablero del vendedor, los usuarios pueden aplicar aún para convertirse en un "
1119
  "vendedor, incluso si éste está desactivado."
1120
 
1121
+ #: ../classes/admin/settings/sf-options.php:35
1122
+ #: ../trunk/classes/admin/settings/sf-options.php:35
1123
  msgid "Approve vendor applications manually"
1124
+ msgstr "Aprobar las postulaciones de vendedor manualmente"
1125
 
1126
+ #: ../classes/admin/settings/sf-options.php:36
1127
+ #: ../trunk/classes/admin/settings/sf-options.php:36
1128
  msgid ""
1129
  "With this unchecked, all vendor applications are automatically accepted. "
1130
  "Otherwise, you must approve each manually."
1131
  msgstr ""
1132
+ "Si no está seleccionado, todas las postulaciones a vendedores se aprobarán "
1133
  "automáticamente. De lo contrario, debes aprobarlas manualmente."
1134
 
1135
+ #: ../classes/admin/settings/sf-options.php:43
1136
+ #: ../classes/admin/settings/sf-options.php:175
1137
+ #: ../trunk/classes/admin/settings/sf-options.php:43
1138
+ #: ../trunk/classes/admin/settings/sf-options.php:175
1139
  msgid "Taxes"
1140
  msgstr "Impuestos"
1141
 
1142
+ #: ../classes/admin/settings/sf-options.php:44
1143
+ #: ../trunk/classes/admin/settings/sf-options.php:44
1144
  msgid "Give vendors any tax collected per-product"
1145
  msgstr "Dar a los vendedores todo el impuesto recolectado por producto"
1146
 
1147
+ #: ../classes/admin/settings/sf-options.php:45
1148
+ #: ../trunk/classes/admin/settings/sf-options.php:45
1149
  msgid "The tax collected on a vendor's product will be given in its entirety"
1150
  msgstr ""
1151
  "Los impuestos recolectados en el producto de un vendedor se dará en su "
1152
  "totalidad"
1153
 
1154
+ #: ../classes/admin/settings/sf-options.php:53
1155
+ #: ../trunk/classes/admin/settings/sf-options.php:53
1156
  msgid "Give vendors any shipping collected per-product"
1157
+ msgstr "Dar a los vendedores cualquier envío recogido por producto"
1158
 
1159
+ #: ../classes/admin/settings/sf-options.php:54
1160
+ #: ../trunk/classes/admin/settings/sf-options.php:54
1161
  msgid ""
1162
+ "WC Vendors Free - Give vendors shipping if using Per Product Shipping "
1163
+ "gateway. WC Vendors Pro - Give vendors shipping when using Vendor "
1164
+ "Shipping. No other shipping module is compatible with this option."
1165
+ msgstr ""
1166
 
1167
+ #: ../classes/admin/settings/sf-options.php:60
1168
+ #: ../trunk/classes/admin/settings/sf-options.php:60
1169
  msgid "Shop options"
1170
  msgstr "Opciones de la tienda"
1171
 
1172
+ #: ../classes/admin/settings/sf-options.php:63
1173
+ #: ../trunk/classes/admin/settings/sf-options.php:63
1174
  msgid "Shop HTML"
1175
  msgstr "HTML de la tienda"
1176
 
1177
+ #: ../classes/admin/settings/sf-options.php:64
1178
+ #: ../trunk/classes/admin/settings/sf-options.php:64
1179
  msgid ""
1180
  "Enable HTML for a vendor's shop description by default. You can enable or "
1181
+ "disable this per vendor by editing the vendors user account."
1182
  msgstr ""
1183
+ "Habilitar HTML para la descripción de las tiendas de los vendedores. Usted "
1184
+ "puede activar o desactivar esto para cada vendedor editando la cuenta de los "
1185
+ "vendedores."
1186
 
1187
+ #: ../classes/admin/settings/sf-options.php:71
1188
+ #: ../trunk/classes/admin/settings/sf-options.php:71
1189
+ msgid "Vendor Shop Page"
1190
+ msgstr "Tienda del vendedor"
1191
 
1192
+ #: ../classes/admin/settings/sf-options.php:72
1193
+ #: ../trunk/classes/admin/settings/sf-options.php:72
1194
+ msgid ""
1195
+ "Enter one word for the URI. If you enter \"<strong>vendors</strong>\" your "
1196
+ "vendors store will be <code>yourdomain.com/vendors/store-name/</code>"
1197
+ msgstr ""
1198
+ "Ingresa una palabra para la dirección de las tiendas. Si ingresas "
1199
+ "“vendedores” la tienda de tus vendedores será <code>ejemplo.com/vendedores/"
1200
+ "nombre-de-la-tienda/</code>"
1201
 
1202
+ #: ../classes/admin/settings/sf-options.php:79
1203
+ #: ../trunk/classes/admin/settings/sf-options.php:79
1204
  msgid "Shop Headers"
1205
+ msgstr "Encabezados de la tienda"
1206
 
1207
+ #: ../classes/admin/settings/sf-options.php:80
1208
+ #: ../trunk/classes/admin/settings/sf-options.php:80
1209
  msgid "Enable vendor shop headers"
1210
+ msgstr "Habilitar encabezados de la tienda del vendedor"
1211
 
1212
+ #: ../classes/admin/settings/sf-options.php:81
1213
+ #: ../trunk/classes/admin/settings/sf-options.php:81
1214
  msgid ""
1215
  "This will override the HTML Shop description output on product-archive "
1216
  "pages. In order to customize the shop headers visit wcvendors.com and read "
1217
  "the article in the Knowledgebase titled Changing the Vendor Templates."
1218
  msgstr ""
1219
+ "Esto sobrescribirá la descripción de la tienda en las páginas de productos y "
1220
+ "archivos. Para personalizar las cabeceras de tienda visita wcvendors.com y "
1221
+ "lee el artículo en la KnowledgeBase titulado “Changing the Vendor Templates”."
 
1222
 
1223
+ #: ../classes/admin/settings/sf-options.php:88
1224
+ #: ../trunk/classes/admin/settings/sf-options.php:88
1225
  msgid "Vendor Display Name"
1226
+ msgstr "Nombre de los vendedores"
1227
 
1228
+ #: ../classes/admin/settings/sf-options.php:89
1229
+ #: ../trunk/classes/admin/settings/sf-options.php:89
1230
  msgid ""
1231
  "Select what will be displayed for the sold by text throughout the store."
1232
+ msgstr "Elige cómo se mostrará el nombre de los vendedores."
1233
 
1234
+ #: ../classes/admin/settings/sf-options.php:93
1235
+ #: ../trunk/classes/admin/settings/sf-options.php:93
1236
  msgid "Display Name"
1237
+ msgstr "Mostrar nombre"
1238
 
1239
+ #: ../classes/admin/settings/sf-options.php:94
1240
  #: ../classes/admin/views/html-vendor-settings-page.php:22
1241
  #: ../templates/dashboard/settings/shop-name.php:2
1242
+ #: ../trunk/classes/admin/settings/sf-options.php:94
1243
+ #: ../trunk/classes/admin/views/html-vendor-settings-page.php:22
1244
+ #: ../trunk/templates/dashboard/settings/shop-name.php:2
1245
  msgid "Shop Name"
1246
+ msgstr "Nombre de la tienda"
1247
 
1248
+ #: ../classes/admin/settings/sf-options.php:95
1249
+ #: ../trunk/classes/admin/settings/sf-options.php:95
1250
  msgid "User Login"
1251
  msgstr "Identificación del usuario"
1252
 
1253
+ #: ../classes/admin/settings/sf-options.php:96
1254
+ #: ../trunk/classes/admin/settings/sf-options.php:96
1255
  msgid "User Email"
1256
+ msgstr "Email de usuario"
1257
 
1258
+ #: ../classes/admin/settings/sf-options.php:103
1259
+ #: ../classes/admin/settings/sf-options.php:116
1260
+ #: ../trunk/classes/admin/settings/sf-options.php:103
1261
+ #: ../trunk/classes/admin/settings/sf-options.php:116
1262
+ msgid "Sold By"
1263
+ msgstr "Vendido por"
1264
+
1265
+ #: ../classes/admin/settings/sf-options.php:104
1266
+ #: ../trunk/classes/admin/settings/sf-options.php:104
1267
+ msgid "Enable sold by labels"
1268
+ msgstr "Activar las etiquetas “Vendido por”"
1269
+
1270
+ #: ../classes/admin/settings/sf-options.php:105
1271
+ #: ../trunk/classes/admin/settings/sf-options.php:105
1272
+ msgid "This will enable or disable the sold by labels."
1273
+ msgstr "Esto activará o desactivará las etiquetas “Vendido por”."
1274
+
1275
+ #: ../classes/admin/settings/sf-options.php:112
1276
+ #: ../trunk/classes/admin/settings/sf-options.php:112
1277
+ msgid "Sold By Label"
1278
+ msgstr "Etiqueta “Vendido por”"
1279
+
1280
+ #: ../classes/admin/settings/sf-options.php:113
1281
+ #: ../trunk/classes/admin/settings/sf-options.php:113
1282
+ msgid "The sold by label used on the site and emails."
1283
+ msgstr "La etiqueta “Vendido por” utilizada en el sitio y los emails."
1284
+
1285
+ #: ../classes/admin/settings/sf-options.php:120
1286
+ #: ../trunk/classes/admin/settings/sf-options.php:120
1287
+ msgid "Seller Info Label"
1288
+ msgstr "Etiqueta “Acerca del vendedor”"
1289
+
1290
+ #: ../classes/admin/settings/sf-options.php:121
1291
+ #: ../trunk/classes/admin/settings/sf-options.php:121
1292
+ msgid "The seller info tab title on the single product page."
1293
+ msgstr ""
1294
+ "La etiqueta “Acerca del vendedor” en las páginas de productos individuales."
1295
+
1296
+ #: ../classes/admin/settings/sf-options.php:124
1297
+ #: ../trunk/classes/admin/settings/sf-options.php:124
1298
+ msgid "Seller Info"
1299
+ msgstr "Acerca del vendedor"
1300
+
1301
+ #: ../classes/admin/settings/sf-options.php:128
1302
+ #: ../trunk/classes/admin/settings/sf-options.php:128
1303
  msgid "Product Add Page"
1304
+ msgstr "Página de nuevo producto"
1305
 
1306
+ #: ../classes/admin/settings/sf-options.php:128
1307
+ #: ../trunk/classes/admin/settings/sf-options.php:128
1308
  msgid "Configure what to hide from all vendors when adding a product"
1309
+ msgstr "Configurar qué esconder de los vendedores cuando se agrega un producto"
 
1310
 
1311
+ #: ../classes/admin/settings/sf-options.php:131
1312
+ #: ../trunk/classes/admin/settings/sf-options.php:131
1313
  msgid "Left side panel"
1314
  msgstr "Panel de la izquierda"
1315
 
1316
+ #: ../classes/admin/settings/sf-options.php:132
1317
+ #: ../trunk/classes/admin/settings/sf-options.php:132
1318
  msgid ""
1319
+ "CHECKING these boxes will **HIDE** these areas of the add product page for "
1320
  "vendors"
1321
  msgstr ""
1322
+ "MARCAR estas cajas OCULTARÁ estas áreas de la página de nuevo producto para "
1323
+ "vendedores"
1324
+
1325
+ #: ../classes/admin/settings/sf-options.php:135
1326
+ #: ../trunk/classes/admin/settings/sf-options.php:135
1327
+ msgid "Inventory"
1328
+ msgstr "Inventario"
1329
+
1330
+ #: ../classes/admin/settings/sf-options.php:137
1331
+ #: ../trunk/classes/admin/settings/sf-options.php:137
1332
+ msgid "Linked Products"
1333
+ msgstr "Productos enlazados"
1334
+
1335
+ #: ../classes/admin/settings/sf-options.php:138
1336
+ #: ../trunk/classes/admin/settings/sf-options.php:138
1337
+ msgid "Attributes"
1338
+ msgstr "Atributos"
1339
+
1340
+ #: ../classes/admin/settings/sf-options.php:139
1341
+ #: ../trunk/classes/admin/settings/sf-options.php:139
1342
+ msgid "Advanced"
1343
+ msgstr "Avanzado"
1344
+
1345
+ #: ../classes/admin/settings/sf-options.php:146
1346
+ #: ../trunk/classes/admin/settings/sf-options.php:146
1347
  msgid "Types"
1348
  msgstr "Tipos"
1349
 
1350
+ #: ../classes/admin/settings/sf-options.php:147
1351
+ #: ../trunk/classes/admin/settings/sf-options.php:147
1352
  msgid "CHECKING these boxes will HIDE these product types from the vendor"
1353
+ msgstr "MARCAR estas cajas OCULTARÁ estos tipos de productos para el vendedor"
1354
+
1355
+ #: ../classes/admin/settings/sf-options.php:150
1356
+ #: ../trunk/classes/admin/settings/sf-options.php:150
1357
+ msgid "Simple"
1358
+ msgstr "Simple"
1359
+
1360
+ #: ../classes/admin/settings/sf-options.php:151
1361
+ #: ../trunk/classes/admin/settings/sf-options.php:151
1362
+ msgid "Variable"
1363
+ msgstr "Variable"
1364
+
1365
+ #: ../classes/admin/settings/sf-options.php:152
1366
+ #: ../trunk/classes/admin/settings/sf-options.php:152
1367
+ msgid "Grouped"
1368
+ msgstr "Agrupado"
1369
 
1370
+ #: ../classes/admin/settings/sf-options.php:153
1371
+ #: ../trunk/classes/admin/settings/sf-options.php:153
1372
+ msgid "External / affiliate"
1373
+ msgstr "Externo / afiliado"
1374
+
1375
+ #: ../classes/admin/settings/sf-options.php:160
1376
+ #: ../trunk/classes/admin/settings/sf-options.php:160
1377
  msgid "Type options"
1378
  msgstr "Opciones de tipos"
1379
 
1380
+ #: ../classes/admin/settings/sf-options.php:161
1381
+ #: ../trunk/classes/admin/settings/sf-options.php:161
1382
+ msgid ""
1383
+ "CHECKING these boxes will **HIDE** these product options from the vendor"
1384
  msgstr ""
1385
+ "MARCAR estas cajas se OCULTARÁ estas opciones de producto para el vendedor"
1386
 
1387
+ #: ../classes/admin/settings/sf-options.php:164
1388
+ #: ../trunk/classes/admin/settings/sf-options.php:164
1389
+ msgid "Virtual"
1390
+ msgstr "Virtual"
1391
+
1392
+ #: ../classes/admin/settings/sf-options.php:165
1393
+ #: ../trunk/classes/admin/settings/sf-options.php:165
1394
+ msgid "Downloadable"
1395
+ msgstr "Descargable"
1396
+
1397
+ #: ../classes/admin/settings/sf-options.php:172
1398
+ #: ../trunk/classes/admin/settings/sf-options.php:172
1399
  msgid "Miscellaneous"
1400
+ msgstr "Otros"
1401
 
1402
+ #: ../classes/admin/settings/sf-options.php:176
1403
+ #: ../trunk/classes/admin/settings/sf-options.php:176
1404
+ msgid "SKU"
1405
+ msgstr "SKU"
1406
+
1407
+ #: ../classes/admin/settings/sf-options.php:177
1408
+ #: ../trunk/classes/admin/settings/sf-options.php:177
1409
+ msgid "Featured"
1410
+ msgstr "Destacado"
1411
+
1412
+ #: ../classes/admin/settings/sf-options.php:178
1413
+ #: ../trunk/classes/admin/settings/sf-options.php:178
1414
+ msgid "Duplicate Product"
1415
+ msgstr "Producto duplicado"
1416
+
1417
+ #: ../classes/admin/settings/sf-options.php:185
1418
+ #: ../trunk/classes/admin/settings/sf-options.php:185
1419
  msgid "Stylesheet"
1420
+ msgstr "Hoja de estilo"
1421
 
1422
+ #: ../classes/admin/settings/sf-options.php:186
1423
+ #: ../trunk/classes/admin/settings/sf-options.php:186
1424
  msgid ""
1425
  "You can add CSS in this textarea, which will be loaded on the product add/"
1426
  "edit page for vendors."
1427
  msgstr ""
1428
+ "El CSS que agregues aquí será cargado en la página de agregar/editar "
1429
+ "productos del vendedor."
1430
 
1431
+ #: ../classes/admin/settings/sf-options.php:193
1432
+ #: ../trunk/classes/admin/settings/sf-options.php:193
1433
  msgid "Permissions"
1434
  msgstr "Permisos"
1435
 
1436
+ #: ../classes/admin/settings/sf-options.php:193
1437
+ #: ../trunk/classes/admin/settings/sf-options.php:193
1438
  msgid "General permissions used around the shop"
1439
  msgstr "Permisos generales usados en la tienda"
1440
 
1441
+ #: ../classes/admin/settings/sf-options.php:197
1442
+ #: ../trunk/classes/admin/settings/sf-options.php:197
1443
  msgid "View orders"
1444
+ msgstr "Ver pedidos"
1445
 
1446
+ #: ../classes/admin/settings/sf-options.php:198
1447
+ #: ../trunk/classes/admin/settings/sf-options.php:198
1448
  msgid "Show customer details such as email, address, name, etc, for each order"
1449
  msgstr ""
1450
+ "Mostrar detalles del cliente como email, dirección y nombre para cada pedido"
1451
 
1452
+ #: ../classes/admin/settings/sf-options.php:205
1453
+ #: ../trunk/classes/admin/settings/sf-options.php:205
1454
  msgid "View comments"
1455
  msgstr "Ver comentarios"
1456
 
1457
+ #: ../classes/admin/settings/sf-options.php:206
1458
+ #: ../trunk/classes/admin/settings/sf-options.php:206
1459
  msgid "View all vendor comments for an order on the frontend"
1460
  msgstr ""
1461
+ "Ver todos los comentarios de los vendedores para un pedido en el frontend"
1462
 
1463
+ #: ../classes/admin/settings/sf-options.php:213
1464
+ #: ../trunk/classes/admin/settings/sf-options.php:213
1465
  msgid "Submit comments"
1466
  msgstr "Enviar comentarios"
1467
 
1468
+ #: ../classes/admin/settings/sf-options.php:214
1469
+ #: ../trunk/classes/admin/settings/sf-options.php:214
1470
  msgid ""
1471
  "Submit comments for an order on the frontend. Eg, tracking ID for a product"
1472
  msgstr ""
1473
+ "Enviar comentarios de un pedido en el frontend. Ejemplo: ID de rastreo del "
1474
  "producto"
1475
 
1476
+ #: ../classes/admin/settings/sf-options.php:221
1477
+ #: ../trunk/classes/admin/settings/sf-options.php:221
1478
  msgid "View email addresses"
1479
  msgstr "Ver dirección de email"
1480
 
1481
+ #: ../classes/admin/settings/sf-options.php:222
1482
+ #: ../trunk/classes/admin/settings/sf-options.php:222
1483
  msgid ""
1484
  "While viewing order details on the frontend, you can disable or enable email "
1485
  "addresses"
1486
  msgstr ""
1487
+ "Al ver los detalles del pedido en el frontend se puede habilitar o "
1488
  "deshabitar la dirección de email"
1489
 
1490
+ #: ../classes/admin/settings/sf-options.php:229
1491
+ #: ../trunk/classes/admin/settings/sf-options.php:229
1492
  msgid "Export a CSV file of orders for a product"
1493
+ msgstr "Exportar un archivo CSV de los pedidos de un producto"
1494
 
1495
+ #: ../classes/admin/settings/sf-options.php:230
1496
+ #: ../trunk/classes/admin/settings/sf-options.php:230
1497
  msgid "Vendors could export orders for a product on the frontend"
1498
+ msgstr "Los vendedores pueden exportar pedidos de un producto en el frontend"
1499
 
1500
+ #: ../classes/admin/settings/sf-options.php:237
1501
+ #: ../trunk/classes/admin/settings/sf-options.php:237
1502
  msgid "Reports"
1503
  msgstr "Reportes"
1504
 
1505
+ #: ../classes/admin/settings/sf-options.php:238
1506
+ #: ../trunk/classes/admin/settings/sf-options.php:238
1507
+ msgid ""
1508
+ "<strike>View backend sales reports</strike>. <strong>Depreciated</strong>"
1509
+ msgstr ""
1510
+ "<strike>Ver reportes de ventas en el backend</strike>. <strong>Despreciado</"
1511
+ "strong>"
1512
 
1513
+ #: ../classes/admin/settings/sf-options.php:239
1514
+ #: ../trunk/classes/admin/settings/sf-options.php:239
1515
  msgid ""
1516
+ "This option has been removed and will no longer function. It will be "
1517
+ "completely removed in future versions. Vendors should use their Vendor "
1518
+ "Dashboard for reports as all identical functionality is already there. "
1519
  msgstr ""
1520
+ "Esta opción se ha eliminado y ya no funciona. Será completamente eliminada "
1521
+ "en una versión futura. Los vendedores deberían usar su escritorio para "
1522
+ "enviar reportes. "
1523
 
1524
+ #: ../classes/admin/settings/sf-options.php:246
1525
+ #: ../trunk/classes/admin/settings/sf-options.php:246
1526
  msgid "View Frontend sales reports"
1527
+ msgstr "Ver reportes de ventas en el frontend"
1528
 
1529
+ #: ../classes/admin/settings/sf-options.php:247
1530
+ #: ../trunk/classes/admin/settings/sf-options.php:247
1531
  msgid ""
1532
+ "Sales table on the frontend on the Vendor Dashboard page. The table will "
1533
+ "only display sales data that pertain to their products, and only for orders "
1534
+ "that are processing or completed."
1535
  msgstr ""
1536
+ "Tabla de ventas en el escritorio de los vendedores. La tabla solo muestra "
1537
+ "los datos de las ventas de sus productos, y solo para las órdenes en proceso "
1538
+ "o completas."
1539
 
1540
+ #: ../classes/admin/settings/sf-options.php:255
1541
+ #: ../trunk/classes/admin/settings/sf-options.php:255
1542
  msgid "Submit products"
1543
+ msgstr "Crear productos"
1544
 
1545
+ #: ../classes/admin/settings/sf-options.php:256
1546
+ #: ../trunk/classes/admin/settings/sf-options.php:256
1547
  msgid ""
1548
+ "Check to allow vendors to list new products. Admin must approve new "
1549
+ "products by editing the product, and clicking Publish."
1550
  msgstr ""
1551
+ "Marca para permitir que los vendedores agreguen nuevos productos. Los "
1552
+ "administradores deben aprobar los productos editando el producto y haciendo "
1553
+ "click en “Publicar”."
1554
 
1555
+ #: ../classes/admin/settings/sf-options.php:263
1556
+ #: ../trunk/classes/admin/settings/sf-options.php:263
1557
  msgid "Edit live products"
1558
+ msgstr "Editar productos publicados"
1559
 
1560
+ #: ../classes/admin/settings/sf-options.php:264
1561
+ #: ../trunk/classes/admin/settings/sf-options.php:264
1562
  msgid ""
1563
  "Vendors could edit an approved product after it has already gone live. There "
1564
  "is no approval or review after editing a live product. This could be "
1568
  "publicado. No es necesario la aprobación o revisión. Esto puede ser "
1569
  "peligroso con vendedores maliciosos, tomar con cuidado."
1570
 
1571
+ #: ../classes/admin/settings/sf-options.php:271
1572
+ #: ../trunk/classes/admin/settings/sf-options.php:271
1573
  msgid "Submit products live without requiring approval"
1574
+ msgstr "Publicar productos sin necesidad de aprobación"
1575
 
1576
+ #: ../classes/admin/settings/sf-options.php:272
1577
+ #: ../trunk/classes/admin/settings/sf-options.php:272
1578
  msgid ""
1579
  "Vendors can submit products without review or approval from a shop admin. "
1580
  "This could be dangerous with malicious vendors, so take caution."
1583
  "revisión. Esto puede ser peligroso con vendedores maliciosos, tomar con "
1584
  "cuidado."
1585
 
1586
+ #: ../classes/admin/settings/sf-options.php:278
1587
+ #: ../trunk/classes/admin/settings/sf-options.php:278
1588
  msgid "Pages"
1589
  msgstr "Páginas"
1590
 
1591
+ #: ../classes/admin/settings/sf-options.php:279
1592
+ #: ../trunk/classes/admin/settings/sf-options.php:279
1593
  msgid "Page configuration"
1594
  msgstr "Configuración de la página"
1595
 
1596
+ #: ../classes/admin/settings/sf-options.php:282
1597
+ #: ../trunk/classes/admin/settings/sf-options.php:282
1598
  msgid "Vendor dashboard"
1599
  msgstr "Dashboard del vendedor"
1600
 
1601
+ #: ../classes/admin/settings/sf-options.php:283
1602
+ #: ../trunk/classes/admin/settings/sf-options.php:283
1603
  msgid ""
1604
  "Choose the page that has the shortcode <code>[wcv_vendor_dashboard]</"
1605
+ "code><br/>. If this page is not set, you will break your site. If you "
1606
+ "upgrade to Pro, keep this page unchanged as both Pro Dashboard and this "
1607
+ "Dashboard page must be set."
1608
  msgstr ""
1609
+ "Elige la página que tiene el shortcode <code>[wcv_vendor_dashboard]</"
1610
+ "code><br>Debes elegir una página o tu sitio se romperá."
1611
 
1612
+ #: ../classes/admin/settings/sf-options.php:290
1613
+ #: ../trunk/classes/admin/settings/sf-options.php:290
1614
  msgid "Shop settings"
1615
+ msgstr "Ajustes de la tienda"
1616
 
1617
+ #: ../classes/admin/settings/sf-options.php:291
1618
+ #: ../trunk/classes/admin/settings/sf-options.php:291
1619
  msgid ""
1620
  "Choose the page that has the shortcode <code>[wcv_shop_settings]</code><br/"
1621
+ ">These are the shop settings a vendor can configure. By default, Vendor "
1622
+ "Dashboard > Shop Settings should have this shortcode."
1623
  msgstr ""
1624
+ "Elige la página que tiene el shortcode <code>[wcv_shop_settings]</"
1625
+ "code><br>Estos son los ajustes de la tienda que el vendedor puede configurar."
1626
 
1627
+ #: ../classes/admin/settings/sf-options.php:298
1628
+ #: ../trunk/classes/admin/settings/sf-options.php:298
1629
  msgid "Orders page"
1630
+ msgstr "Página de pedidos"
1631
 
1632
+ #: ../classes/admin/settings/sf-options.php:299
1633
+ #: ../trunk/classes/admin/settings/sf-options.php:299
1634
  msgid ""
1635
  "Choose the page that has the shortcode <code>[wcv_orders]</code><br/>By "
1636
+ "default, Vendor Dashboard > Orders should have the shortcode."
1637
+ msgstr "Elige la página que tiene el shortcode <code>[wcv_orders]</code>"
 
 
1638
 
1639
+ #: ../classes/admin/settings/sf-options.php:306
1640
+ #: ../trunk/classes/admin/settings/sf-options.php:306
1641
  msgid "Vendor terms"
1642
  msgstr "Condiciones de los vendedores"
1643
 
1644
+ #: ../classes/admin/settings/sf-options.php:307
1645
+ #: ../trunk/classes/admin/settings/sf-options.php:307
1646
  msgid ""
1647
  "These terms are shown to a user when submitting an application to become a "
1648
+ "vendor.<br/>If left blank, no terms will be shown to the applicant. Vendor "
1649
+ "must accept terms in order to register, if set."
1650
  msgstr ""
1651
+ "Estas condiciones se muestran al usuario cuando envía una postulación para "
1652
+ "ser vendedor.<br>Si se deja en blanco no se le mostrará nada."
1653
 
1654
+ #: ../classes/admin/settings/sf-options.php:314
1655
+ #: ../trunk/classes/admin/settings/sf-options.php:314
1656
  msgid "payments"
1657
  msgstr "pagos"
1658
 
1659
+ #: ../classes/admin/settings/sf-options.php:325
1660
+ #: ../trunk/classes/admin/settings/sf-options.php:325
1661
  msgid "Payments"
1662
  msgstr "Pagos"
1663
 
1664
+ #: ../classes/admin/settings/sf-options.php:327
1665
+ #: ../trunk/classes/admin/settings/sf-options.php:327
1666
+ msgid "PayPal Adaptive Payments Scheduling"
1667
+ msgstr "Calendario de PayPal Adaptive Payments"
1668
 
1669
+ #: ../classes/admin/settings/sf-options.php:328
1670
+ #: ../trunk/classes/admin/settings/sf-options.php:328
1671
  #, php-format
1672
  msgid "Total commission currently due: %s. <a href=\"%s\">View details</a>."
1673
  msgstr "Deuda total de comisiones: %s. <a href=\"%s\">Ver detalles</a>."
1674
 
1675
+ #: ../classes/admin/settings/sf-options.php:329
1676
+ #: ../trunk/classes/admin/settings/sf-options.php:329
1677
  #, php-format
1678
  msgid ""
1679
  "Make sure you update your PayPal Adaptive Payments settings <a href=\"%s"
1680
+ "\">here</a>. <br><br>To instantly pay with Adaptive Payments you must "
1681
+ "activate the PayPal AP gateway in your Checkout settings. <br><a href="
1682
+ "\"https://www.wcvendors.com/kb/configuring-paypal-adaptive-payments/\" "
1683
+ "target=\"top\">PayPal AP Application Help</a>. <br><br>Another gateway that "
1684
+ "offers instant payments to vendors that also accepts credit cards directly "
1685
+ "on your checkout page is Stripe. <br><a href=\"https://www.wcvendors.com/"
1686
+ "product/stripe-commissions-gateway/\" target=\"top\">Stripe Commissions & "
1687
+ "Gateway plugin</a> is $49 and specifically coded for WC Vendors and <a href="
1688
+ "\"https://www.wcvendors.com/product/wc-vendors-pro/\" target=\"top\">WC "
1689
+ "Vendors Pro</a>."
1690
  msgstr ""
 
 
1691
 
1692
+ #: ../classes/admin/settings/sf-options.php:333
1693
+ #: ../trunk/classes/admin/settings/sf-options.php:333
1694
  msgid "Instant pay"
1695
  msgstr "Pago instantáneo"
1696
 
1697
+ #: ../classes/admin/settings/sf-options.php:334
1698
+ #: ../trunk/classes/admin/settings/sf-options.php:334
1699
+ msgid ""
1700
+ "Instantly pay vendors their commission when an order is made, and if a "
1701
+ "vendor has a valid PayPal email added on their Shop Settings page."
1702
  msgstr ""
1703
+ "Pagar instantáneamente la comisión a los vendedores cuando se hace un pedido "
1704
+ "(si el vendedor tiene un email de PayPal válido)."
1705
 
1706
+ #: ../classes/admin/settings/sf-options.php:335
1707
+ #: ../trunk/classes/admin/settings/sf-options.php:335
1708
  msgid ""
1709
  "For this to work, customers must checkout with the PayPal Adaptive Payments "
1710
  "gateway. Using any other gateways will not pay vendors instantly"
1711
  msgstr ""
1712
+ "Para que esto funcione, los clientes deben realizar el pago con PayPal "
1713
+ "Adaptive Payments. Utilizando cualquier otra pasarela no pagará a los "
1714
+ "vendedores al instante"
1715
 
1716
+ #: ../classes/admin/settings/sf-options.php:342
1717
+ #: ../trunk/classes/admin/settings/sf-options.php:342
1718
  msgid "Payment schedule"
1719
  msgstr "Calendario de pagos"
1720
 
1721
+ #: ../classes/admin/settings/sf-options.php:343
1722
+ #: ../trunk/classes/admin/settings/sf-options.php:343
1723
  msgid "Note: Schedule will only work if instant pay is unchecked"
1724
+ msgstr "El calendario solo funciona si el “Pago instantáneo” no está marcado"
 
 
1725
 
1726
+ #: ../classes/admin/settings/sf-options.php:348
1727
+ #: ../trunk/classes/admin/settings/sf-options.php:348
1728
+ msgid "Daily"
1729
+ msgstr "Diario"
1730
+
1731
+ #: ../classes/admin/settings/sf-options.php:349
1732
+ #: ../trunk/classes/admin/settings/sf-options.php:349
1733
  msgid "Weekly"
1734
  msgstr "Semanal"
1735
 
1736
+ #: ../classes/admin/settings/sf-options.php:350
1737
+ #: ../trunk/classes/admin/settings/sf-options.php:350
1738
  msgid "Biweekly"
1739
  msgstr "Bisemanal"
1740
 
1741
+ #: ../classes/admin/settings/sf-options.php:351
1742
+ #: ../trunk/classes/admin/settings/sf-options.php:351
1743
  msgid "Monthly"
1744
  msgstr "Mensual"
1745
 
1746
+ #: ../classes/admin/settings/sf-options.php:352
1747
+ #: ../trunk/classes/admin/settings/sf-options.php:352
1748
  msgid "Manual"
1749
  msgstr "Manual"
1750
 
1751
+ #: ../classes/admin/settings/sf-options.php:353
1752
+ #: ../trunk/classes/admin/settings/sf-options.php:353
1753
  msgid "Now"
1754
  msgstr "Ahora"
1755
 
1756
+ #: ../classes/admin/settings/sf-options.php:358
1757
+ #: ../trunk/classes/admin/settings/sf-options.php:358
1758
  msgid "Email notification"
1759
  msgstr "Notificaciones por email"
1760
 
1761
+ #: ../classes/admin/settings/sf-options.php:359
1762
+ #: ../trunk/classes/admin/settings/sf-options.php:359
1763
  msgid ""
1764
  "Send the WooCommerce admin an email each time a payment has been made via "
1765
  "the payment schedule options above"
1766
  msgstr ""
1767
+ "Mandar un email al administrador de WooCommerce cada vez que se realice un "
1768
+ "pago por medio del calendario de pagos"
1769
 
1770
  #: ../classes/admin/views/html-vendor-settings-page.php:11
1771
  #: ../templates/dashboard/settings/paypal-email-form.php:2
1772
+ #: ../trunk/classes/admin/views/html-vendor-settings-page.php:11
1773
+ #: ../trunk/templates/dashboard/settings/paypal-email-form.php:2
1774
  msgid "PayPal Address"
1775
  msgstr "Dirección de PayPal"
1776
 
1777
  #: ../classes/admin/views/html-vendor-settings-page.php:15
1778
  #: ../templates/dashboard/settings/paypal-email-form.php:3
1779
+ #: ../trunk/classes/admin/views/html-vendor-settings-page.php:15
1780
+ #: ../trunk/templates/dashboard/settings/paypal-email-form.php:3
1781
  msgid "Your PayPal address is used to send you your commission."
1782
+ msgstr "Tu dirección de PayPal se usa para enviarte tu comisión."
1783
 
1784
  #: ../classes/admin/views/html-vendor-settings-page.php:24
1785
  #: ../templates/dashboard/settings/shop-name.php:3
1786
+ #: ../trunk/classes/admin/views/html-vendor-settings-page.php:24
1787
+ #: ../trunk/templates/dashboard/settings/shop-name.php:3
1788
  msgid "Your shop name is public and must be unique."
1789
  msgstr "El nombre de tu tienda es público y único."
1790
 
1791
  #: ../classes/admin/views/html-vendor-settings-page.php:43
1792
  #: ../templates/dashboard/settings/seller-info.php:4
1793
+ #: ../trunk/classes/admin/views/html-vendor-settings-page.php:43
1794
+ #: ../trunk/templates/dashboard/settings/seller-info.php:4
1795
  msgid "This is displayed on each of your products."
1796
  msgstr "Esto se muestra en cada uno de tus productos."
1797
 
1798
  #: ../classes/admin/views/html-vendor-settings-page.php:49
1799
  #: ../templates/dashboard/settings/shop-description.php:2
1800
+ #: ../trunk/classes/admin/views/html-vendor-settings-page.php:49
1801
+ #: ../trunk/templates/dashboard/settings/shop-description.php:2
1802
  msgid "Shop Description"
1803
+ msgstr "Descripción de la tienda"
1804
 
1805
  #: ../classes/admin/views/html-vendor-settings-page.php:61
1806
  #: ../templates/dashboard/settings/shop-description.php:3
1807
+ #: ../trunk/classes/admin/views/html-vendor-settings-page.php:61
1808
+ #: ../trunk/templates/dashboard/settings/shop-description.php:3
1809
  #, php-format
1810
  msgid "This is displayed on your <a href=\"%s\">shop page</a>."
1811
+ msgstr "Esto se muestra en la <a href=\"%s\">página de tu tienda</a>."
1812
 
1813
  #: ../classes/admin/views/html-vendor-settings-page.php:70
1814
+ #: ../trunk/classes/admin/views/html-vendor-settings-page.php:70
1815
  msgid "Save Shop Settings"
1816
  msgstr "Guardar la configuración de la tienda"
1817
 
1818
+ #: ../classes/class-cron.php:87 ../trunk/classes/class-cron.php:87
1819
  #, php-format
1820
  msgid "Payment total: %s"
1821
+ msgstr "Total del pago: %s"
1822
+
1823
+ #: ../classes/class-cron.php:149 ../trunk/classes/class-cron.php:149
1824
+ msgid "Once Daily"
1825
+ msgstr "Diario"
1826
 
1827
+ #: ../classes/class-cron.php:154 ../trunk/classes/class-cron.php:154
1828
  msgid "Once Weekly"
1829
  msgstr "Semanal"
1830
 
1831
+ #: ../classes/class-cron.php:159 ../trunk/classes/class-cron.php:159
1832
  msgid "Once every two weeks"
1833
  msgstr "Bisemanal"
1834
 
1835
+ #: ../classes/class-cron.php:164 ../trunk/classes/class-cron.php:164
1836
  msgid "Once a month"
1837
  msgstr "Mensual"
1838
 
1839
+ #: ../classes/class-install.php:205 ../trunk/classes/class-install.php:205
 
 
 
 
1840
  msgid "Vendor Dashboard"
1841
+ msgstr "Escritorio del vendedor"
1842
 
1843
+ #: ../classes/class-vendor-post-types.php:34
1844
+ #: ../trunk/classes/class-vendor-post-types.php:34
1845
+ msgid "Vendor Orders"
1846
+ msgstr "Pedidos del vendedor"
1847
 
1848
+ #: ../classes/class-vendors.php:554 ../trunk/classes/class-vendors.php:554
1849
+ #, php-format
1850
+ msgid "Vendor Order &ndash; %s"
1851
+ msgstr "Pedido del vendedor &ndash; %s"
1852
+
1853
+ #: ../classes/front/dashboard/class-vendor-dashboard.php:53
1854
+ #: ../trunk/classes/front/dashboard/class-vendor-dashboard.php:53
1855
  msgid "Order marked shipped."
1856
+ msgstr "Marcar como pedido enviado."
1857
+
1858
+ #: ../classes/front/dashboard/class-vendor-dashboard.php:55
1859
+ #: ../trunk/classes/front/dashboard/class-vendor-dashboard.php:55
1860
+ #, php-format
1861
+ msgid "%s has marked as shipped. "
1862
+ msgstr "%s marcado como enviados. "
1863
 
1864
+ #: ../classes/front/dashboard/class-vendor-dashboard.php:83
1865
+ #: ../classes/front/dashboard/class-vendor-dashboard.php:84
1866
+ #: ../trunk/classes/front/dashboard/class-vendor-dashboard.php:83
1867
+ #: ../trunk/classes/front/dashboard/class-vendor-dashboard.php:84
1868
  msgid "Tracking number"
1869
+ msgstr "Número de rastreo"
1870
 
1871
+ #: ../classes/front/dashboard/class-vendor-dashboard.php:86
1872
+ #: ../trunk/classes/front/dashboard/class-vendor-dashboard.php:86
1873
  msgid "Success. Your tracking number has been updated."
1874
+ msgstr "Tu número de rastreo ha sido actualizado."
1875
 
1876
  #: ../classes/front/orders/class-export-csv.php:19
1877
  #: ../templates/dashboard/reports.php:18
1878
  #: ../templates/emails/admin-new-order.php:23
1879
+ #: ../templates/emails/notify-vendor-shipped.php:27
1880
+ #: ../templates/emails/vendor-new-order.php:31
1881
+ #: ../trunk/classes/front/orders/class-export-csv.php:19
1882
+ #: ../trunk/templates/dashboard/reports.php:18
1883
+ #: ../trunk/templates/emails/admin-new-order.php:23
1884
+ #: ../trunk/templates/emails/notify-vendor-shipped.php:27
1885
+ #: ../trunk/templates/emails/vendor-new-order.php:31
1886
  msgid "Quantity"
1887
  msgstr "Cantidad"
1888
 
1889
+ #: ../classes/front/orders/class-export-csv.php:20
1890
+ #: ../trunk/classes/front/orders/class-export-csv.php:20
1891
+ msgid "Item Meta"
1892
+ msgstr "Meta información del producto"
1893
+
1894
+ #: ../classes/front/orders/class-orders.php:100
1895
+ #: ../classes/front/orders/class-orders.php:166
1896
+ #: ../trunk/classes/front/orders/class-orders.php:100
1897
+ #: ../trunk/classes/front/orders/class-orders.php:166
1898
  msgid ""
1899
  "You haven't selected a product's orders to view! Please go back to the "
1900
  "Vendor Dashboard and click Show Orders on the product you'd like to view."
1901
  msgstr ""
1902
+ "No has seleccionado pedidos de productos para ver. Por favor ve al "
1903
+ "Escritorio del vendedor y haz click en Mostrar pedidos” en el producto que "
1904
  "quieres ver."
1905
 
1906
+ #: ../classes/front/orders/class-orders.php:123
1907
+ #: ../classes/front/orders/class-orders.php:189
1908
+ #: ../trunk/classes/front/orders/class-orders.php:123
1909
+ #: ../trunk/classes/front/orders/class-orders.php:189
1910
  msgid "No orders."
1911
+ msgstr "No hay pedidos."
1912
 
1913
+ #: ../classes/front/orders/class-orders.php:250
1914
+ #: ../trunk/classes/front/orders/class-orders.php:250
1915
  msgid "Product Title"
1916
+ msgstr "Producto"
1917
 
1918
+ #: ../classes/front/orders/class-orders.php:251
1919
+ #: ../trunk/classes/front/orders/class-orders.php:251
1920
  msgid "Full name"
1921
  msgstr "Nombre completo"
1922
 
1923
+ #: ../classes/front/orders/class-orders.php:252
1924
+ #: ../trunk/classes/front/orders/class-orders.php:252
1925
  msgid "Address"
1926
  msgstr "Dirección"
1927
 
1928
+ #: ../classes/front/orders/class-orders.php:253
1929
+ #: ../trunk/classes/front/orders/class-orders.php:253
1930
  msgid "City"
1931
  msgstr "Ciudad"
1932
 
1933
+ #: ../classes/front/orders/class-orders.php:254
1934
+ #: ../trunk/classes/front/orders/class-orders.php:254
1935
  msgid "State"
1936
  msgstr "Estado"
1937
 
1938
+ #: ../classes/front/orders/class-orders.php:255
1939
+ #: ../trunk/classes/front/orders/class-orders.php:255
1940
  msgid "Zip"
1941
+ msgstr "CP"
1942
 
1943
+ #: ../classes/front/orders/class-orders.php:256
1944
+ #: ../trunk/classes/front/orders/class-orders.php:256
1945
  msgid "Email address"
1946
+ msgstr "Email"
1947
 
1948
  #: ../classes/front/orders/class-submit-comment.php:41
1949
+ #: ../trunk/classes/front/orders/class-submit-comment.php:41
1950
  msgid "You've left the comment field empty!"
1951
  msgstr "¡Has dejado el campo de comentarios vacío!"
1952
 
1953
  #: ../classes/front/orders/class-submit-comment.php:63
1954
+ #: ../trunk/classes/front/orders/class-submit-comment.php:63
1955
  msgid "Success. The customer has been notified of your comment."
1956
  msgstr "Éxito. El cliente ha sido notificado de tu comentario."
1957
 
1958
+ #: ../classes/front/signup/class-vendor-signup.php:70
1959
+ #: ../trunk/classes/front/signup/class-vendor-signup.php:70
 
 
 
 
 
 
 
 
 
 
1960
  msgid "Application denied. You are an administrator."
1961
  msgstr "Aplicación denegada. Eres un administrador."
1962
 
1963
+ #: ../classes/front/signup/class-vendor-signup.php:72
1964
+ #: ../trunk/classes/front/signup/class-vendor-signup.php:72
1965
  msgid "Your application has been submitted."
1966
  msgstr "Su solicitud ha sido enviada."
1967
 
1968
+ #: ../classes/front/signup/class-vendor-signup.php:119
1969
+ #: ../classes/front/signup/class-vendor-signup.php:156
1970
+ #: ../classes/front/signup/class-vendor-signup.php:168
1971
+ #: ../trunk/classes/front/signup/class-vendor-signup.php:119
1972
+ #: ../trunk/classes/front/signup/class-vendor-signup.php:156
1973
+ #: ../trunk/classes/front/signup/class-vendor-signup.php:168
1974
  msgid "You must accept the terms and conditions to become a vendor."
1975
  msgstr "Debes aceptar los términos y condiciones para postular a vendedor."
1976
 
1977
+ #: ../classes/front/signup/views/html-vendor-signup.php:21
1978
+ #: ../templates/dashboard/denied.php:22
1979
+ #: ../trunk/classes/front/signup/views/html-vendor-signup.php:21
1980
+ #: ../trunk/templates/dashboard/denied.php:22
1981
+ msgid "Apply to become a vendor? "
1982
+ msgstr "¿Postularse para vendedor? "
1983
+
1984
+ #: ../classes/front/signup/views/html-vendor-signup.php:35
1985
+ #: ../trunk/classes/front/signup/views/html-vendor-signup.php:35
1986
+ #, php-format
1987
+ msgid ""
1988
+ "I have read and accepted the <a target=\"top\" href=\"%s\">terms and "
1989
+ "conditions</a>"
1990
+ msgstr "Leí y acepto los <a target=“top” href=“%s”>términos y condiciones</a>"
1991
+
1992
+ #: ../classes/front/signup/views/html-vendor-signup.php:44
1993
+ #: ../trunk/classes/front/signup/views/html-vendor-signup.php:44
1994
+ msgid "Please agree to the terms and conditions"
1995
+ msgstr "Por favor acepta los términos y condiciones"
1996
+
1997
  #: ../classes/gateways/PayPal_AdvPayments/paypal_ap.php:43
1998
+ #: ../trunk/classes/gateways/PayPal_AdvPayments/paypal_ap.php:43
1999
  msgid "PayPal Adaptive Payments"
2000
  msgstr "PayPal Adaptive Payments"
2001
 
2002
  #: ../classes/gateways/PayPal_AdvPayments/paypal_ap.php:119
2003
+ #: ../trunk/classes/gateways/PayPal_AdvPayments/paypal_ap.php:119
2004
  #, php-format
2005
  msgid ""
2006
  "Something went wrong. Response from PayPal invalidated this order. Status: "
2007
  "%s."
2008
  msgstr ""
2009
+ "Algo salió mal. La respuesta de PayPal invalidó este pedido. Estado: %s."
2010
 
2011
  #: ../classes/gateways/PayPal_AdvPayments/paypal_ap.php:124
2012
+ #: ../trunk/classes/gateways/PayPal_AdvPayments/paypal_ap.php:124
2013
  msgid "IPN payment completed"
2014
  msgstr "Pago IPN completado"
2015
 
2016
  #: ../classes/gateways/PayPal_AdvPayments/paypal_ap.php:146
2017
+ #: ../trunk/classes/gateways/PayPal_AdvPayments/paypal_ap.php:146
2018
  msgid "Enable PayPal Adaptive Payments"
2019
  msgstr "Habilitar PayPal Adaptive Payments"
2020
 
2021
  #: ../classes/gateways/PayPal_AdvPayments/paypal_ap.php:152
2022
+ #: ../trunk/classes/gateways/PayPal_AdvPayments/paypal_ap.php:152
2023
  msgid "Method Title"
2024
+ msgstr "Título del método"
2025
 
2026
  #: ../classes/gateways/PayPal_AdvPayments/paypal_ap.php:153
2027
  #: ../classes/gateways/WCV_Gateway_Test/class-wcv-gateway-test.php:70
2028
+ #: ../trunk/classes/gateways/PayPal_AdvPayments/paypal_ap.php:153
2029
+ #: ../trunk/classes/gateways/WCV_Gateway_Test/class-wcv-gateway-test.php:70
2030
  msgid "This controls the title which the user sees during checkout."
2031
  msgstr "Esto controla el título que el usuario verá durante el checkout."
2032
 
2033
  #: ../classes/gateways/PayPal_AdvPayments/paypal_ap.php:154
2034
+ #: ../trunk/classes/gateways/PayPal_AdvPayments/paypal_ap.php:154
2035
  msgid "PayPal"
2036
  msgstr "PayPal"
2037
 
2038
  #: ../classes/gateways/PayPal_AdvPayments/paypal_ap.php:159
2039
  #: ../classes/gateways/WCV_Gateway_Test/class-wcv-gateway-test.php:75
2040
+ #: ../trunk/classes/gateways/PayPal_AdvPayments/paypal_ap.php:159
2041
+ #: ../trunk/classes/gateways/WCV_Gateway_Test/class-wcv-gateway-test.php:75
2042
  msgid "Description"
2043
  msgstr "Descripción"
2044
 
2045
  #: ../classes/gateways/PayPal_AdvPayments/paypal_ap.php:160
2046
+ #: ../trunk/classes/gateways/PayPal_AdvPayments/paypal_ap.php:160
2047
  msgid "This controls the description which the user sees during checkout."
2048
  msgstr "Esto controla la descripción que el usuario verá durante el checkout."
2049
 
2050
  #: ../classes/gateways/PayPal_AdvPayments/paypal_ap.php:161
2051
+ #: ../trunk/classes/gateways/PayPal_AdvPayments/paypal_ap.php:161
2052
  msgid "Pay via PayPal!"
2053
  msgstr "¡Pagar vía PayPal!"
2054
 
2055
  #: ../classes/gateways/PayPal_AdvPayments/paypal_ap.php:172
2056
+ #: ../trunk/classes/gateways/PayPal_AdvPayments/paypal_ap.php:172
2057
  msgid "Live Credentials"
2058
+ msgstr "Credenciales publicadas"
2059
 
2060
  #: ../classes/gateways/PayPal_AdvPayments/paypal_ap.php:174
2061
+ #: ../trunk/classes/gateways/PayPal_AdvPayments/paypal_ap.php:174
2062
  #, php-format
2063
  msgid ""
2064
  "You must have an <a href=\"%s\">Application ID</a> to process live "
2069
 
2070
  #: ../classes/gateways/PayPal_AdvPayments/paypal_ap.php:179
2071
  #: ../classes/gateways/PayPal_AdvPayments/paypal_ap.php:213
2072
+ #: ../trunk/classes/gateways/PayPal_AdvPayments/paypal_ap.php:179
2073
+ #: ../trunk/classes/gateways/PayPal_AdvPayments/paypal_ap.php:213
2074
  msgid "PayPal Email"
2075
  msgstr "Email de PayPal"
2076
 
2077
  #: ../classes/gateways/PayPal_AdvPayments/paypal_ap.php:180
2078
  #: ../classes/gateways/PayPal_AdvPayments/paypal_ap.php:214
2079
+ #: ../trunk/classes/gateways/PayPal_AdvPayments/paypal_ap.php:180
2080
+ #: ../trunk/classes/gateways/PayPal_AdvPayments/paypal_ap.php:214
2081
  msgid "The email address main payments should go to."
2082
+ msgstr "El email donde deben ir los pagos principales."
2083
 
2084
  #: ../classes/gateways/PayPal_AdvPayments/paypal_ap.php:185
2085
  #: ../classes/gateways/PayPal_AdvPayments/paypal_ap.php:219
2086
+ #: ../trunk/classes/gateways/PayPal_AdvPayments/paypal_ap.php:185
2087
+ #: ../trunk/classes/gateways/PayPal_AdvPayments/paypal_ap.php:219
2088
  msgid "API Username"
2089
  msgstr "API Nombre de Usuario"
2090
 
2091
  #: ../classes/gateways/PayPal_AdvPayments/paypal_ap.php:190
2092
  #: ../classes/gateways/PayPal_AdvPayments/paypal_ap.php:224
2093
+ #: ../trunk/classes/gateways/PayPal_AdvPayments/paypal_ap.php:190
2094
+ #: ../trunk/classes/gateways/PayPal_AdvPayments/paypal_ap.php:224
2095
  msgid "API Password"
2096
  msgstr "API Contraseña"
2097
 
2098
  #: ../classes/gateways/PayPal_AdvPayments/paypal_ap.php:195
2099
  #: ../classes/gateways/PayPal_AdvPayments/paypal_ap.php:229
2100
+ #: ../trunk/classes/gateways/PayPal_AdvPayments/paypal_ap.php:195
2101
+ #: ../trunk/classes/gateways/PayPal_AdvPayments/paypal_ap.php:229
2102
  msgid "API Signature"
2103
  msgstr "API Firma"
2104
 
2105
  #: ../classes/gateways/PayPal_AdvPayments/paypal_ap.php:200
2106
+ #: ../trunk/classes/gateways/PayPal_AdvPayments/paypal_ap.php:200
2107
  msgid "Application ID"
2108
+ msgstr "Postuación"
2109
 
2110
  #: ../classes/gateways/PayPal_AdvPayments/paypal_ap.php:202
2111
+ #: ../trunk/classes/gateways/PayPal_AdvPayments/paypal_ap.php:202
2112
  msgid "Only required when doing live transactions."
2113
  msgstr "Solo requerida para hacer transacciones."
2114
 
2115
  #: ../classes/gateways/PayPal_AdvPayments/paypal_ap.php:206
2116
+ #: ../trunk/classes/gateways/PayPal_AdvPayments/paypal_ap.php:206
2117
  msgid "Sandbox Credentials"
2118
  msgstr "Credenciales de Sandbox"
2119
 
2120
  #: ../classes/gateways/PayPal_AdvPayments/paypal_ap.php:208
2121
+ #: ../trunk/classes/gateways/PayPal_AdvPayments/paypal_ap.php:208
2122
  #, php-format
2123
  msgid ""
2124
  "You can signup for a sandbox developer account <a href=\"%s\">here</a>. You "
2129
  "de Sandbox para hacer pruebas."
2130
 
2131
  #: ../classes/gateways/PayPal_AdvPayments/paypal_ap.php:240
2132
+ #: ../trunk/classes/gateways/PayPal_AdvPayments/paypal_ap.php:240
2133
  msgid "Misc. Settings"
2134
  msgstr "Otros Ajustes"
2135
 
2136
  #: ../classes/gateways/PayPal_AdvPayments/paypal_ap.php:245
2137
+ #: ../trunk/classes/gateways/PayPal_AdvPayments/paypal_ap.php:245
2138
  msgid "Enable PayPal Sandbox mode"
2139
  msgstr "Habilitar modo Sandbox para PayPal"
2140
 
2141
  #: ../classes/gateways/PayPal_AdvPayments/paypal_ap.php:251
2142
+ #: ../trunk/classes/gateways/PayPal_AdvPayments/paypal_ap.php:251
2143
  msgid "Enable logging"
2144
  msgstr "Habilitar logging"
2145
 
2146
  #: ../classes/gateways/PayPal_AdvPayments/paypal_ap.php:269
2147
+ #: ../trunk/classes/gateways/PayPal_AdvPayments/paypal_ap.php:269
2148
  msgid ""
2149
  "The PayPal Adaptive Payments gateway can instantly pay your vendors their "
2150
  "due commission (if enabled). Also used to mass pay vendors on a schedule / "
2156
  "habilitado)."
2157
 
2158
  #: ../classes/gateways/PayPal_AdvPayments/paypal_ap.php:280
2159
+ #: ../trunk/classes/gateways/PayPal_AdvPayments/paypal_ap.php:280
2160
  msgid "Gateway Disabled"
2161
+ msgstr "Gateway deshabilitado"
2162
 
2163
  #: ../classes/gateways/PayPal_AdvPayments/paypal_ap.php:280
2164
+ #: ../trunk/classes/gateways/PayPal_AdvPayments/paypal_ap.php:280
2165
  #, php-format
2166
  msgid "%s does not support your store currency."
2167
  msgstr "%s no soporta la moneda de tu cuenta."
2168
 
2169
+ #: ../classes/gateways/PayPal_AdvPayments/paypal_ap.php:389
2170
+ #: ../classes/gateways/PayPal_AdvPayments/paypal_ap.php:505
2171
  #: ../classes/gateways/PayPal_Masspay/class-paypal-masspay.php:153
2172
+ #: ../trunk/classes/gateways/PayPal_AdvPayments/paypal_ap.php:389
2173
+ #: ../trunk/classes/gateways/PayPal_AdvPayments/paypal_ap.php:505
2174
+ #: ../trunk/classes/gateways/PayPal_Masspay/class-paypal-masspay.php:153
2175
  #, php-format
2176
  msgid "Error: %s"
2177
  msgstr "Error: %s"
2178
 
2179
+ #: ../classes/gateways/PayPal_AdvPayments/paypal_ap.php:398
2180
+ #: ../classes/gateways/PayPal_AdvPayments/paypal_ap.php:399
2181
+ #: ../trunk/classes/gateways/PayPal_AdvPayments/paypal_ap.php:398
2182
+ #: ../trunk/classes/gateways/PayPal_AdvPayments/paypal_ap.php:399
2183
  #, php-format
2184
  msgid "Error ID: %s. %s"
2185
  msgstr "Error ID: %s. %s"
2186
 
2187
  #: ../classes/gateways/PayPal_Masspay/class-paypal-masspay.php:115
2188
+ #: ../trunk/classes/gateways/PayPal_Masspay/class-paypal-masspay.php:115
2189
  msgid "No vendors found to pay. Maybe they haven't set a PayPal address?"
2190
  msgstr ""
2191
+ "No se encontraron vendedores que pagar. ¿Quizás no tienen configurada su "
2192
+ "dirección de PayPal?"
2193
 
2194
  #: ../classes/gateways/PayPal_Masspay/class-paypal-masspay.php:167
2195
+ #: ../trunk/classes/gateways/PayPal_Masspay/class-paypal-masspay.php:167
2196
  msgid "All due commission has been paid for."
2197
  msgstr "Se han pagado todas las comisiones adeudadas."
2198
 
2199
  #: ../classes/gateways/PayPal_Masspay/class-paypal-masspay.php:173
2200
+ #: ../trunk/classes/gateways/PayPal_Masspay/class-paypal-masspay.php:173
2201
  msgid ""
2202
  "All due commission has been paid for, but I could not clear it from their "
2203
  "profiles due to an internal error. Commission will still be listed as due. "
2208
  "favor marcar manualmente como pagadas desde la Página de Comisiones."
2209
 
2210
  #: ../classes/gateways/PayPal_Masspay/class-paypal-masspay.php:208
2211
+ #: ../trunk/classes/gateways/PayPal_Masspay/class-paypal-masspay.php:208
2212
  msgid "WooCommerce: Mass payments for vendors update"
2213
  msgstr "WooCommerce: Actualizar los pagos en masa de vendedores"
2214
 
2215
  #: ../classes/gateways/PayPal_Masspay/class-paypal-masspay.php:210
2216
+ #: ../trunk/classes/gateways/PayPal_Masspay/class-paypal-masspay.php:210
2217
  msgid ""
2218
  "Hello! A payment was just triggered to mass pay all vendors their due "
2219
  "commission."
2220
  msgstr ""
2221
+ "¡Hola! Un pago ha sido desatado para pagar a todos los vendedores su "
2222
+ "comisión adeudada."
2223
 
2224
  #: ../classes/gateways/PayPal_Masspay/class-paypal-masspay.php:211
2225
+ #: ../trunk/classes/gateways/PayPal_Masspay/class-paypal-masspay.php:211
2226
  #, php-format
2227
  msgid "Payment status: %s."
2228
+ msgstr "Estado del pago: %s."
2229
 
2230
  #: ../classes/gateways/PayPal_Masspay/class-paypal-masspay.php:212
2231
+ #: ../trunk/classes/gateways/PayPal_Masspay/class-paypal-masspay.php:212
2232
  #, php-format
2233
  msgid "Payment message: %s."
2234
+ msgstr "Mensaje del pago: %s."
2235
 
2236
  #: ../classes/gateways/PayPal_Masspay/class-paypal-masspay.php:215
2237
+ #: ../trunk/classes/gateways/PayPal_Masspay/class-paypal-masspay.php:215
2238
  #, php-format
2239
  msgid "Payment total: %s."
2240
+ msgstr "Total del pago: %s."
2241
 
2242
  #: ../classes/gateways/WCV_Gateway_Test/class-wcv-gateway-test.php:35
2243
  #: ../classes/gateways/WCV_Gateway_Test/class-wcv-gateway-test.php:71
2244
+ #: ../trunk/classes/gateways/WCV_Gateway_Test/class-wcv-gateway-test.php:35
2245
+ #: ../trunk/classes/gateways/WCV_Gateway_Test/class-wcv-gateway-test.php:71
2246
  msgid "WC Vendors Test Gateway"
2247
+ msgstr "Pasarela de prueba para WC Vendors"
2248
 
2249
  #: ../classes/gateways/WCV_Gateway_Test/class-wcv-gateway-test.php:36
2250
+ #: ../trunk/classes/gateways/WCV_Gateway_Test/class-wcv-gateway-test.php:36
2251
  msgid ""
2252
  "This gateway will set orders to processing upon receipt allowing you to test "
2253
  "transactions in your store. Some WooCommerce included gateways have "
2254
  "problems with this - you should use this gateway for all of your non-PayPal "
2255
  "testing."
2256
  msgstr ""
2257
+ "Esta pasarela pondrá pedidos en procesamiento tras la recepción que permite "
2258
+ "poner a prueba las transacciones en su tienda. Algunos portales de "
2259
  "WooCommerce incluido tienen problemas con esto - usted debe utilizar este "
2260
+ "portal para todas las pruebas - pero no para las pruebas de PayPal."
2261
 
2262
  #: ../classes/gateways/WCV_Gateway_Test/class-wcv-gateway-test.php:64
2263
+ #: ../trunk/classes/gateways/WCV_Gateway_Test/class-wcv-gateway-test.php:64
2264
  msgid "Enable WC Vendors Test Gateway Payment"
2265
  msgstr "Habilitar WC Vendors pasarela de prueba con pago"
2266
 
2267
  #: ../classes/gateways/WCV_Gateway_Test/class-wcv-gateway-test.php:68
2268
+ #: ../trunk/classes/gateways/WCV_Gateway_Test/class-wcv-gateway-test.php:68
2269
  msgid "Title"
2270
  msgstr "Título"
2271
 
2272
  #: ../classes/gateways/WCV_Gateway_Test/class-wcv-gateway-test.php:77
2273
+ #: ../trunk/classes/gateways/WCV_Gateway_Test/class-wcv-gateway-test.php:77
2274
  msgid "Payment method description that the customer will see on your checkout."
2275
  msgstr "Forma de pago descripción que el cliente verá en su caja."
2276
 
2277
  #: ../classes/gateways/WCV_Gateway_Test/class-wcv-gateway-test.php:78
2278
+ #: ../trunk/classes/gateways/WCV_Gateway_Test/class-wcv-gateway-test.php:78
2279
  msgid ""
2280
  "This is a test gateway -- not to be used on live sites for live "
2281
  "transactions. <a href=\"http://www.wcvendors.com/\" target=\"top\">Click "
2286
  "\">Haga clic aquí para visitar WCVendors.com</a>."
2287
 
2288
  #: ../classes/gateways/WCV_Gateway_Test/class-wcv-gateway-test.php:82
2289
+ #: ../trunk/classes/gateways/WCV_Gateway_Test/class-wcv-gateway-test.php:82
2290
  msgid "Instructions"
2291
  msgstr "Instrucciones"
2292
 
2293
  #: ../classes/gateways/WCV_Gateway_Test/class-wcv-gateway-test.php:84
2294
+ #: ../trunk/classes/gateways/WCV_Gateway_Test/class-wcv-gateway-test.php:84
2295
  msgid ""
2296
  "Success! Your test order is now marked as processing and any vendors will "
2297
  "be sent an email as long as you have the Notify Vendors email enabled under "
2298
  "WooCommerce--Settings--Emails."
2299
  msgstr ""
2300
+ "¡Completo! El pedido de prueba ya está marcado como en proceso y se enviará "
2301
+ "un correo electrónico, siempre y cuando usted tenga la notificación por "
2302
+ "correo a vendedores activada en WooCommerce > Configuración de correos "
2303
+ "electrónicos."
2304
 
2305
+ #: ../classes/gateways/WCV_Gateway_Test/class-wcv-gateway-test.php:127
2306
+ #: ../trunk/classes/gateways/WCV_Gateway_Test/class-wcv-gateway-test.php:127
2307
  msgid "Test gateway transation complete. Order processing."
2308
+ msgstr "Pasarela de prueba transacción completa. Procesando el pedido."
2309
 
2310
  #: ../templates/dashboard/denied.php:8
2311
+ #: ../trunk/templates/dashboard/denied.php:8
2312
  msgid ""
2313
  "Your account has not yet been approved to become a vendor. When it is, you "
2314
  "will receive an email telling you that your account is approved!"
2317
  "aprobada, se te enviará un email!"
2318
 
2319
  #: ../templates/dashboard/denied.php:12
2320
+ #: ../trunk/templates/dashboard/denied.php:12
2321
  msgid "Your account is not setup as a vendor."
2322
  msgstr "No tienes una cuenta configurada como vendedor."
2323
 
2324
+ #: ../templates/dashboard/denied.php:33
2325
+ #: ../trunk/templates/dashboard/denied.php:33
2326
+ #, php-format
2327
+ msgid "I have read and accepted the <a href=\"%s\">terms and conditions</a>"
2328
+ msgstr "Leí y acepto los <a href=\"%s\">términos y condiciones</a>"
2329
+
2330
  #: ../templates/dashboard/denied.php:53
2331
+ #: ../trunk/templates/dashboard/denied.php:53
2332
  msgid "Submit"
2333
  msgstr "Enviar"
2334
 
2335
+ #: ../templates/dashboard/links.php:3 ../trunk/templates/dashboard/links.php:3
2336
+ msgid "View Your Store"
2337
+ msgstr "Ver tu tienda"
2338
+
2339
+ #: ../templates/dashboard/links.php:4 ../trunk/templates/dashboard/links.php:4
2340
+ msgid "Store Settings"
2341
+ msgstr "Ajustes de la tienda"
2342
+
2343
+ #: ../templates/dashboard/links.php:7 ../trunk/templates/dashboard/links.php:7
2344
+ msgid "Add New Product"
2345
+ msgstr "Nuevo producto"
2346
+
2347
+ #: ../templates/dashboard/links.php:8 ../trunk/templates/dashboard/links.php:8
2348
+ msgid "Edit Products"
2349
+ msgstr "Editar productos"
2350
+
2351
+ #: ../templates/dashboard/orders.php:18 ../templates/dashboard/orders.php:21
2352
+ #: ../trunk/templates/dashboard/orders.php:18
2353
+ #: ../trunk/templates/dashboard/orders.php:21
2354
  msgid "Hide items"
2355
+ msgstr "Esconder productos"
2356
 
2357
+ #: ../templates/dashboard/orders.php:19 ../templates/dashboard/orders.php:93
2358
+ #: ../trunk/templates/dashboard/orders.php:19
2359
+ #: ../trunk/templates/dashboard/orders.php:93
2360
  msgid "View items"
2361
+ msgstr "Ver productos"
2362
 
2363
+ #: ../templates/dashboard/orders.php:48
2364
+ #: ../trunk/templates/dashboard/orders.php:48
2365
  msgid "Links"
2366
+ msgstr "Acciones"
 
 
 
 
2367
 
2368
+ #: ../templates/dashboard/orders.php:114
2369
+ #: ../trunk/templates/dashboard/orders.php:114
2370
  msgid "Tracking"
2371
  msgstr "Seguimiento"
2372
 
2373
+ #: ../templates/dashboard/orders.php:188
2374
+ #: ../trunk/templates/dashboard/orders.php:188
2375
  msgid "You have no orders during this period."
2376
+ msgstr "No tienes pedidos en este período."
2377
 
2378
  #: ../templates/dashboard/reports.php:1
2379
+ #: ../trunk/templates/dashboard/reports.php:1
2380
  msgid "Sales Report"
2381
+ msgstr "Ventas"
2382
 
2383
  #: ../templates/dashboard/reports.php:20
2384
+ #: ../trunk/templates/dashboard/reports.php:20
2385
  msgid "Rate"
2386
+ msgstr "Porcentaje"
2387
 
2388
  #: ../templates/dashboard/reports.php:47
2389
+ #: ../trunk/templates/dashboard/reports.php:47
2390
  msgid "Show Orders"
2391
+ msgstr "Ver pedidos"
2392
 
2393
  #: ../templates/dashboard/reports.php:56
2394
+ #: ../trunk/templates/dashboard/reports.php:56
2395
  msgid "Totals"
2396
  msgstr "Totales"
2397
 
2398
  #: ../templates/dashboard/reports.php:71
2399
+ #: ../trunk/templates/dashboard/reports.php:71
2400
  msgid "You have no sales during this period."
2401
+ msgstr "No tienes ventas en este período."
2402
 
2403
  #: ../templates/dashboard/reports.php:82
2404
+ #: ../trunk/templates/dashboard/reports.php:82
2405
  msgid "You haven't made any sales yet."
2406
+ msgstr "No tienes ventas aún."
2407
 
2408
  #: ../templates/dashboard/settings/settings.php:47
2409
+ #: ../trunk/templates/dashboard/settings/settings.php:47
2410
  msgid "Save"
2411
  msgstr "Guardar"
2412
 
2413
  #: ../templates/emails/admin-new-order.php:13
2414
+ #: ../templates/emails/vendor-new-order.php:21
2415
+ #: ../trunk/templates/emails/admin-new-order.php:13
2416
+ #: ../trunk/templates/emails/vendor-new-order.php:21
2417
  #, php-format
2418
  msgid "You have received an order from %s. Their order is as follows:"
2419
+ msgstr "Has recibido un pedido de %s:"
2420
 
2421
  #: ../templates/emails/admin-new-order.php:17
2422
+ #: ../templates/emails/notify-vendor-shipped.php:21
2423
+ #: ../templates/emails/vendor-new-order.php:25
2424
+ #: ../trunk/templates/emails/admin-new-order.php:17
2425
+ #: ../trunk/templates/emails/notify-vendor-shipped.php:21
2426
+ #: ../trunk/templates/emails/vendor-new-order.php:25
2427
  #, php-format
2428
  msgid "Order: %s"
2429
+ msgstr "Pedido: %s"
2430
 
2431
  #: ../templates/emails/admin-new-order.php:24
2432
+ #: ../templates/emails/notify-vendor-shipped.php:28
2433
+ #: ../templates/emails/vendor-new-order.php:32
2434
+ #: ../trunk/templates/emails/admin-new-order.php:24
2435
+ #: ../trunk/templates/emails/notify-vendor-shipped.php:28
2436
+ #: ../trunk/templates/emails/vendor-new-order.php:32
2437
  msgid "Price"
2438
  msgstr "Precio"
2439
 
2440
  #: ../templates/emails/admin-new-order.php:50
2441
+ #: ../templates/emails/notify-vendor-shipped.php:60
2442
+ #: ../templates/emails/vendor-new-order.php:80
2443
+ #: ../trunk/templates/emails/admin-new-order.php:50
2444
+ #: ../trunk/templates/emails/notify-vendor-shipped.php:60
2445
+ #: ../trunk/templates/emails/vendor-new-order.php:80
2446
  msgid "Customer details"
2447
  msgstr "Detalle del cliente"
2448
 
2449
  #: ../templates/emails/admin-new-order.php:53
2450
+ #: ../templates/emails/notify-vendor-shipped.php:63
2451
+ #: ../templates/emails/vendor-new-order.php:83
2452
+ #: ../trunk/templates/emails/admin-new-order.php:53
2453
+ #: ../trunk/templates/emails/notify-vendor-shipped.php:63
2454
+ #: ../trunk/templates/emails/vendor-new-order.php:83
2455
  msgid "Email:"
2456
  msgstr "Email:"
2457
 
2458
  #: ../templates/emails/admin-new-order.php:56
2459
+ #: ../templates/emails/notify-vendor-shipped.php:66
2460
+ #: ../templates/emails/vendor-new-order.php:86
2461
+ #: ../trunk/templates/emails/admin-new-order.php:56
2462
+ #: ../trunk/templates/emails/notify-vendor-shipped.php:66
2463
+ #: ../trunk/templates/emails/vendor-new-order.php:86
2464
  msgid "Tel:"
2465
  msgstr "Tel:"
2466
 
2467
  #: ../templates/emails/application-status.php:5
2468
+ #: ../trunk/templates/emails/application-status.php:5
2469
  #, php-format
2470
  msgid "Hi there. This is a notification about a vendor application on %s."
2471
  msgstr "Hola. Esta es una notificación de la postulación de un vendedor en %s."
2472
 
2473
  #: ../templates/emails/application-status.php:8
2474
+ #: ../trunk/templates/emails/application-status.php:8
2475
  #, php-format
2476
  msgid "Application status: %s"
2477
  msgstr "Estado de la postulación: %s"
2478
 
2479
  #: ../templates/emails/application-status.php:9
2480
+ #: ../trunk/templates/emails/application-status.php:9
2481
  #, php-format
2482
  msgid "Applicant username: %s"
2483
  msgstr "Username del postulante: %s"
2484
 
2485
  #: ../templates/emails/new-product.php:5
2486
+ #: ../trunk/templates/emails/new-product.php:5
2487
  #, php-format
2488
  msgid "Hi there. This is a notification about a new product on %s."
2489
  msgstr "Hola. Esta es una notificación sobre un nuevo producto en %s."
2490
 
2491
  #: ../templates/emails/new-product.php:8
2492
+ #: ../trunk/templates/emails/new-product.php:8
2493
  #, php-format
2494
  msgid "Product title: %s"
2495
  msgstr "Título del producto: %s"
2496
 
2497
  #: ../templates/emails/new-product.php:9
2498
+ #: ../trunk/templates/emails/new-product.php:9
2499
  #, php-format
2500
  msgid "Submitted by: %s"
2501
  msgstr "Enviado por: %s"
2502
 
2503
  #: ../templates/emails/new-product.php:10
2504
+ #: ../trunk/templates/emails/new-product.php:10
2505
  #, php-format
2506
  msgid "Edit product: %s"
2507
  msgstr "Editar producto: %s"
2508
 
2509
+ #: ../templates/emails/notify-vendor-shipped.php:17
2510
+ #: ../trunk/templates/emails/notify-vendor-shipped.php:17
2511
  msgid ""
2512
  "A vendor has marked part of your order as shipped. The items that are "
2513
  "shipped are as follows:"
2514
  msgstr ""
2515
+ "Un vendedor ha marcado parte de tu pedido como enviado. Los elementos serán "
2516
  "enviados de la siguiente forma:"
2517
 
2518
  #: ../templates/orders/comments/add-new-comment.php:11
2519
+ #: ../trunk/templates/orders/comments/add-new-comment.php:11
2520
  msgid "Add comment"
2521
  msgstr "Agregar comentario"
2522
 
2523
  #: ../templates/orders/comments/existing-comments.php:9
2524
+ #: ../trunk/templates/orders/comments/existing-comments.php:9
2525
  #, php-format
2526
  msgid "added %s ago"
2527
+ msgstr "Agregado hace %s"
2528
 
2529
  #: ../templates/orders/csv-export.php:6
2530
+ #: ../trunk/templates/orders/csv-export.php:6
2531
  msgid "Export orders"
2532
+ msgstr "Exportar pedidos"
2533
 
2534
  #: ../templates/orders/customer-note/customer-note.php:4
2535
+ #: ../trunk/templates/orders/customer-note/customer-note.php:4
2536
  msgid "Customer note"
2537
  msgstr "Nota del cliente"
2538
 
2539
  #: ../templates/orders/customer-note/customer-note.php:8
2540
+ #: ../trunk/templates/orders/customer-note/customer-note.php:8
2541
  msgid "No customer note."
2542
  msgstr "No hay nota del cliente."
2543
 
2544
+ #: ../templates/orders/orders.php:80 ../trunk/templates/orders/orders.php:80
2545
  #, php-format
2546
  msgid "Comments (%s)"
2547
  msgstr "Comentarios (%s)"
2548
 
2549
+ #: ../templates/orders/shipping/shipping-form.php:6
2550
+ #: ../trunk/templates/orders/shipping/shipping-form.php:6
2551
  msgid "Provider:"
2552
  msgstr "Proveedor:"
2553
 
2554
+ #: ../templates/orders/shipping/shipping-form.php:8
2555
+ #: ../trunk/templates/orders/shipping/shipping-form.php:8
2556
  msgid "Custom Provider"
2557
+ msgstr "Proveedor personalizado"
2558
 
2559
+ #: ../templates/orders/shipping/shipping-form.php:31
2560
+ #: ../trunk/templates/orders/shipping/shipping-form.php:31
2561
  msgid "Provider Name:"
2562
+ msgstr "Nombre del proveedor:"
2563
 
2564
+ #: ../templates/orders/shipping/shipping-form.php:40
2565
+ #: ../trunk/templates/orders/shipping/shipping-form.php:40
2566
  msgid "Tracking number:"
2567
+ msgstr "Número de rastreo:"
2568
 
2569
+ #: ../templates/orders/shipping/shipping-form.php:48
2570
+ #: ../trunk/templates/orders/shipping/shipping-form.php:48
2571
  msgid "Tracking link:"
2572
+ msgstr "Enlace de rastreo:"
2573
 
2574
+ #: ../templates/orders/shipping/shipping-form.php:58
2575
+ #: ../trunk/templates/orders/shipping/shipping-form.php:58
2576
  msgid "Date shipped:"
2577
  msgstr "Fecha de envío:"
2578
 
2579
+ #: ../templates/orders/shipping/shipping-form.php:66
2580
+ #: ../trunk/templates/orders/shipping/shipping-form.php:66
2581
  msgid "Preview:"
2582
  msgstr "Previsualizar:"
2583
 
2584
+ #: ../templates/orders/shipping/shipping-form.php:66
2585
+ #: ../trunk/templates/orders/shipping/shipping-form.php:66
2586
  msgid "Click here to track your shipment"
2587
+ msgstr "Haz click para rastrear tu envío"
2588
 
2589
+ #: ../templates/orders/shipping/shipping-form.php:75
2590
+ #: ../trunk/templates/orders/shipping/shipping-form.php:75
2591
  msgid "Update tracking number"
2592
+ msgstr "Actualizar el numero de rastreo"
2593
 
2594
+ #: ../templates/orders/shipping/shipping-form.php:77
2595
+ #: ../trunk/templates/orders/shipping/shipping-form.php:77
2596
  msgid "Mark as shipped"
2597
  msgstr "Marcar como enviada"
2598
 
2599
  #: ../templates/orders/table-body.php:25
2600
+ #: ../trunk/templates/orders/table-body.php:25
2601
  #, php-format
2602
  msgid "Quantity: %d"
2603
  msgstr "Cantidad: %d"
2604
 
2605
+ #~ msgid ""
2606
+ #~ "WC Vendors requires the Vendor shop page value be set <a href=\"%s"
2607
+ #~ "\">click here to set it.</a> | <a href=\"%s\">Hide Notice</a>"
2608
+ #~ msgstr ""
2609
+ #~ "WC vendedores requiere fijar el valor de la pagina tienda del vendedor <a "
2610
+ #~ "href=\"%s\">haga clic aquí para definirlo</a> | <a href=\"%s\">Ocultar "
2611
+ #~ "aviso</a>"
2612
+
2613
+ #~ msgid ""
2614
+ #~ "You must save your permalinks once you have modified your vendor page. <a "
2615
+ #~ "href=\"%s\">click here to save</a>. | <a href=\"%s\">Hide Notice</a>"
2616
+ #~ msgstr ""
2617
+ #~ "Una vez que ha modificado su página vendedor debe guardar tus enlaces "
2618
+ #~ "permanentes. <a href=\"%s\">haga clic aquí para guardar</a>. | <a href="
2619
+ #~ "\"%s\">Ocultar aviso</a>"
2620
+
2621
+ #~ msgid ""
2622
+ #~ "The default rate you pay each vendor for a product sale. If a product has "
2623
+ #~ "a commission rate already set, this value will be ignored for that "
2624
+ #~ "product."
2625
+ #~ msgstr ""
2626
+ #~ "El monto que pagas a cada vendedor por la venta de un producto. Si un "
2627
+ #~ "producto tiene un monto de Comisión ya establecido, este valor se omitirá "
2628
+ #~ "para ese producto."
2629
+
2630
+ #~ msgid ""
2631
+ #~ "The shipping collected on a vendor's product will be given in its entirety"
2632
+ #~ msgstr ""
2633
+ #~ "Se dará el envío recogido por producto a un vendedor en su totalidad"
2634
+
2635
+ #~ msgid "Eg: <code>yoursite.com/[your_setting_here]/[vendor_name_here]</code>"
2636
+ #~ msgstr "Ej: <code>tusitio.com/[your_setting_here]/[vendor_name_here]</code>"
2637
+
2638
+ #~ msgid "View backend sales reports"
2639
+ #~ msgstr "Ver reportes de venta en el backend"
2640
+
2641
+ #~ msgid ""
2642
+ #~ "Graphs and tables via the Reports page in backend. The reports will only "
2643
+ #~ "display sales data that pertain to their products"
2644
+ #~ msgstr ""
2645
+ #~ "Gráficos y tablas vía la página de Reportes en el backend. Los reportes "
2646
+ #~ "solo mostrarán datos de ventas que perteneces a sus productos."
2647
+
2648
+ #~ msgid ""
2649
+ #~ "Vendors could submit a product through the backend, and an admin would "
2650
+ #~ "approve or deny it"
2651
+ #~ msgstr ""
2652
+ #~ "Los vendedores pueden enviar un producto a través del backend, un "
2653
+ #~ "administrador pueden aprobarlos o rechazarlos."
2654
+
2655
+ #~ msgid "User payments"
2656
+ #~ msgstr "Pagos de Usuarios"
2657
+
2658
+ #~ msgid ""
2659
+ #~ "Make sure you update your PayPal Adaptive Payments settings <a href=\"%s"
2660
+ #~ "\">here</a>."
2661
+ #~ msgstr ""
2662
+ #~ "Asegúrate de actualizar tus ajustes de PayPal Adaptive Payments <a href="
2663
+ #~ "\"%s\">acá</a>."
2664
+
2665
+ #~ msgid "Unmark shipped"
2666
+ #~ msgstr "Desmarcar enviado"
2667
+
2668
  #~ msgid "Extra data"
2669
  #~ msgstr "Data adicional"
2670
 
languages/wcvendors-pt_PT.mo CHANGED
Binary file
languages/wcvendors-pt_PT.po CHANGED
@@ -4,7 +4,7 @@ msgstr ""
4
  "Project-Id-Version: WC Vendors\n"
5
  "Report-Msgid-Bugs-To: \n"
6
  "POT-Creation-Date: 2015-10-17 15:17+0100\n"
7
- "PO-Revision-Date: 2015-10-17 19:17+0100\n"
8
  "Last-Translator: Renato <support@pxincha.com>\n"
9
  "Language-Team: WC Vendors <support@wcvendors.com>\n"
10
  "Language: pt_BR\n"
@@ -14,7 +14,7 @@ msgstr ""
14
  "POT-Revision-Date: Sun May 24 2015 08:31:40 GMT-0300 (BRT)\n"
15
  "Plural-Forms: nplurals=2; plural=(n > 1);\n"
16
  "X-Poedit-SourceCharset: UTF-8\n"
17
- "X-Generator: Poedit 1.8.5\n"
18
  "X-Poedit-Basepath: .\n"
19
  "X-Poedit-KeywordsList: _:1;gettext:1;dgettext:2;ngettext:1,2;dngettext:2,3;"
20
  "__:1;_e:1;_c:1;_n:1,2;_n_noop:1,2;_nc:1,2;__ngettext:1,2;__ngettext_noop:1,2;"
@@ -124,7 +124,7 @@ msgstr "Total"
124
  #: ../classes/admin/class-admin-page.php:255
125
  #: ../classes/admin/class-admin-reports.php:172
126
  msgid "Status"
127
- msgstr "Condição"
128
 
129
  #: ../classes/admin/class-admin-page.php:256
130
  #: ../classes/admin/class-vendor-admin-dashboard.php:288
@@ -139,7 +139,7 @@ msgstr "Marcar como pago"
139
 
140
  #: ../classes/admin/class-admin-page.php:294
141
  msgid "Mark due"
142
- msgstr "Marcar como à pagar"
143
 
144
  #: ../classes/admin/class-admin-page.php:295
145
  msgid "Mark reversed"
@@ -161,7 +161,7 @@ msgstr "%1$s %2$d"
161
 
162
  #: ../classes/admin/class-admin-page.php:386
163
  msgid "Show all Statuses"
164
- msgstr "Mostrar todas Condições"
165
 
166
  #: ../classes/admin/class-admin-page.php:412
167
  msgid "Commission marked paid."
@@ -169,7 +169,7 @@ msgstr "Comissão paga"
169
 
170
  #: ../classes/admin/class-admin-page.php:419
171
  msgid "Commission marked due."
172
- msgstr "Comissão à pagar"
173
 
174
  #: ../classes/admin/class-admin-page.php:426
175
  msgid "Commission marked reversed."
@@ -268,7 +268,6 @@ msgid "Month"
268
  msgstr "Mês"
269
 
270
  #: ../classes/admin/class-admin-reports.php:339
271
- #, fuzzy
272
  msgid "Commission Totals"
273
  msgstr "Total de Comissões"
274
 
@@ -281,7 +280,7 @@ msgstr "Imposto"
281
  #: ../classes/admin/settings/sf-options.php:105
282
  #: ../templates/dashboard/orders.php:34 ../templates/orders/orders.php:115
283
  msgid "Shipping"
284
- msgstr "Enviando"
285
 
286
  #: ../classes/admin/class-admin-reports.php:342
287
  msgid "Reversed"
@@ -292,9 +291,8 @@ msgid "Paid"
292
  msgstr "Pago"
293
 
294
  #: ../classes/admin/class-admin-reports.php:344
295
- #, fuzzy
296
  msgid "Due"
297
- msgstr "Comissão à pagar"
298
 
299
  #: ../classes/admin/class-admin-users.php:402
300
  msgid "Enable HTML for the shop description"
@@ -323,20 +321,19 @@ msgstr "Deixe em branco para o padrão"
323
 
324
  #: ../classes/admin/class-admin-users.php:430
325
  msgid "Give Tax"
326
- msgstr ""
327
 
328
  #: ../classes/admin/class-admin-users.php:435
329
  msgid "Tax override for vendor"
330
- msgstr ""
331
 
332
  #: ../classes/admin/class-admin-users.php:441
333
- #, fuzzy
334
  msgid "Give Shipping"
335
- msgstr "Enviando"
336
 
337
  #: ../classes/admin/class-admin-users.php:446
338
  msgid "Shipping override for vendor"
339
- msgstr ""
340
 
341
  #: ../classes/admin/class-admin-users.php:452
342
  #: ../classes/admin/views/html-vendor-settings-page.php:30
@@ -364,7 +361,7 @@ msgstr "Pedidos"
364
  #: ../classes/admin/class-vendor-admin-dashboard.php:58
365
  #: ../classes/front/dashboard/class-vendor-dashboard.php:104
366
  msgid "Your PayPal address is not a valid email address."
367
- msgstr "Seu endereço de e-mail do PayPal não é válido"
368
 
369
  #: ../classes/admin/class-vendor-admin-dashboard.php:67
370
  #: ../classes/front/dashboard/class-vendor-dashboard.php:113
@@ -375,7 +372,7 @@ msgstr "Este nome de loja já existe. O nome da sua loja deve ser único."
375
  #: ../classes/admin/settings/classes/sf-class-settings.php:366
376
  #: ../classes/front/dashboard/class-vendor-dashboard.php:131
377
  msgid "Settings saved."
378
- msgstr "Ajustes salvos."
379
 
380
  #: ../classes/admin/class-vendor-admin-dashboard.php:284
381
  msgid "Customer"
@@ -407,9 +404,8 @@ msgid "Comments (%s)"
407
  msgstr "Comentários (%s)"
408
 
409
  #: ../classes/admin/class-vendor-admin-dashboard.php:470
410
- #, fuzzy
411
  msgid "Comments to Customer"
412
- msgstr "Comentários (%s)"
413
 
414
  #: ../classes/admin/class-vendor-admin-dashboard.php:479
415
  #: ../templates/orders/comments/existing-comments.php:9
@@ -419,7 +415,7 @@ msgstr "adicionado %s atrás"
419
 
420
  #: ../classes/admin/class-vendor-admin-dashboard.php:485
421
  msgid "No comments currently to customer."
422
- msgstr ""
423
 
424
  #: ../classes/admin/class-vendor-admin-dashboard.php:494
425
  #: ../templates/orders/comments/add-new-comment.php:11
@@ -467,19 +463,19 @@ msgstr "Vendedor: "
467
 
468
  #: ../classes/admin/emails/class-wc-approve-vendor.php:28
469
  msgid "Vendor Application"
470
- msgstr "Requerimento para Vendedor"
471
 
472
  #: ../classes/admin/emails/class-wc-approve-vendor.php:29
473
  msgid "Vendor application will either be approved, denied, or pending."
474
- msgstr "Requerimento para Vendedor será aprovado, negado, ou pendente."
475
 
476
  #: ../classes/admin/emails/class-wc-approve-vendor.php:31
477
  msgid "Application {status}"
478
- msgstr "Requerimento {status}"
479
 
480
  #: ../classes/admin/emails/class-wc-approve-vendor.php:32
481
  msgid "[{blogname}] Your vendor application has been {status}"
482
- msgstr "[{blogname}] Seu requerimento para vendedor foi {status}"
483
 
484
  #: ../classes/admin/emails/class-wc-approve-vendor.php:123
485
  #: ../classes/admin/emails/class-wc-notify-admin.php:134
@@ -561,7 +557,7 @@ msgstr "Tipo de email"
561
  #: ../classes/admin/emails/class-wc-notify-shipped.php:185
562
  #: ../classes/admin/emails/class-wc-notify-vendor.php:269
563
  msgid "Choose which format of email to send."
564
- msgstr "Escolha qual formato de email para enviar."
565
 
566
  #: ../classes/admin/emails/class-wc-approve-vendor.php:156
567
  #: ../classes/admin/emails/class-wc-notify-admin.php:167
@@ -596,7 +592,7 @@ msgstr ""
596
 
597
  #: ../classes/admin/emails/class-wc-notify-admin.php:31
598
  msgid "New product submitted: {product_name}"
599
- msgstr "Novo produto enviado: {produto_nome}"
600
 
601
  #: ../classes/admin/emails/class-wc-notify-admin.php:32
602
  msgid "[{blogname}] New product submitted by {vendor_name} - {product_name}"
@@ -615,12 +611,13 @@ msgstr ""
615
 
616
  #: ../classes/admin/emails/class-wc-notify-shipped.php:31
617
  msgid "Your order has been shipped"
618
- msgstr "Seu pedido já foi enviado"
619
 
620
  #: ../classes/admin/emails/class-wc-notify-shipped.php:32
621
  msgid ""
622
  "[{blogname}] Your order has been shipped ({order_number}) - {order_date}"
623
- msgstr "[{blogname}] Seu pedido já foi enviado ({order_number}) - {order_date}"
 
624
 
625
  #: ../classes/admin/emails/class-wc-notify-shipped.php:112
626
  msgid "Subtotal:"
@@ -642,14 +639,13 @@ msgstr "Novo pedido de cliente"
642
 
643
  #: ../classes/admin/emails/class-wc-notify-vendor.php:31
644
  msgid "[{blogname}] New customer order ({order_number}) - {order_date}"
645
- msgstr "[{blogname}] Novo pedido de cliente ({order_number}) - {order_date}"
646
 
647
  #: ../classes/admin/emails/class-wc-notify-vendor.php:103
648
  msgid "Commission Subtotal:"
649
  msgstr "Subtotal de comissão:"
650
 
651
  #: ../classes/admin/emails/class-wc-notify-vendor.php:109
652
- #, fuzzy
653
  msgid "Tax Subtotal:"
654
  msgstr "Subtotal:"
655
 
@@ -669,7 +665,7 @@ msgstr "Ajustes"
669
 
670
  #: ../classes/admin/settings/classes/sf-class-settings.php:300
671
  msgid "Could not load settings at: "
672
- msgstr "Não puderam ser carregados os ajustes na: "
673
 
674
  #: ../classes/admin/settings/classes/sf-class-settings.php:300
675
  msgid "Error - WP Settings Framework"
@@ -694,7 +690,7 @@ msgid ""
694
  "commission rate already set, this value will be ignored for that product."
695
  msgstr ""
696
  "A taxa de padrão que você pagará a cada vendedor pela venda de um produto. "
697
- "Se um produto já tiver uma taxa de comissão definida, este valor será "
698
  "ignorado para esse produto."
699
 
700
  #: ../classes/admin/settings/sf-options.php:20
@@ -703,7 +699,7 @@ msgstr "Registro"
703
 
704
  #: ../classes/admin/settings/sf-options.php:21
705
  msgid "Allow users or guests to apply to become a vendor"
706
- msgstr "Permitir usuários ou convidados a pedirem para se tornarem um vendedor"
707
 
708
  #: ../classes/admin/settings/sf-options.php:22
709
  msgid ""
@@ -726,8 +722,8 @@ msgid ""
726
  "With this unchecked, all vendor applications are automatically accepted. "
727
  "Otherwise, you must approve each manually."
728
  msgstr ""
729
- "Com esta opção desligada, todos os pedidos de vendedor serão automaticamente "
730
- "aceitos. Caso contrário, você deve aprovar cada um manualmente."
731
 
732
  #: ../classes/admin/settings/sf-options.php:37
733
  #: ../classes/admin/settings/sf-options.php:144
@@ -741,17 +737,17 @@ msgstr "Dê aos vendedores qualquer imposto cobrado por produto"
741
  #: ../classes/admin/settings/sf-options.php:39
742
  msgid "The tax collected on a vendor's product will be given in its entirety"
743
  msgstr ""
744
- "O imposto cobrado sobre o produto de um vendedor será dado em sua totalidade"
745
 
746
  #: ../classes/admin/settings/sf-options.php:47
747
  msgid "Give vendors any shipping collected per-product"
748
- msgstr "Dê aos vendedores qualquer taxa de envio recolhida por produto"
749
 
750
  #: ../classes/admin/settings/sf-options.php:48
751
  msgid ""
752
  "The shipping collected on a vendor's product will be given in its entirety"
753
  msgstr ""
754
- "A taxa de envio recolhida do produto de um fornecedor será dada em sua "
755
  "totalidade"
756
 
757
  #: ../classes/admin/settings/sf-options.php:54
@@ -777,7 +773,7 @@ msgstr "Página da loja do Vendedor"
777
 
778
  #: ../classes/admin/settings/sf-options.php:66
779
  msgid "Eg: <code>yoursite.com/[your_setting_here]/[vendor_name_here]</code>"
780
- msgstr "Eg: <code>seusite.com/[seu_ajuste_aqui]/[vendedor_nome_aqui]</code>"
781
 
782
  #: ../classes/admin/settings/sf-options.php:73
783
  msgid "Shop Headers"
@@ -821,9 +817,8 @@ msgid "User Login"
821
  msgstr "Login do Usuário"
822
 
823
  #: ../classes/admin/settings/sf-options.php:90
824
- #, fuzzy
825
  msgid "User Email"
826
- msgstr "Email:"
827
 
828
  #: ../classes/admin/settings/sf-options.php:97
829
  msgid "Product Add Page"
@@ -844,17 +839,16 @@ msgid ""
844
  "CHECKING these boxes will HIDE these areas of the add product page for "
845
  "vendors"
846
  msgstr ""
847
- "MARCANDO estas caixas irá OCULTAR do vendedor estas áreas para na página "
848
  "Adicionar Produto"
849
 
850
  #: ../classes/admin/settings/sf-options.php:104
851
  msgid "Inventory"
852
- msgstr "Inventario"
853
 
854
  #: ../classes/admin/settings/sf-options.php:106
855
- #, fuzzy
856
  msgid "Linked Products"
857
- msgstr "Produtos"
858
 
859
  #: ../classes/admin/settings/sf-options.php:107
860
  msgid "Attributes"
@@ -870,7 +864,7 @@ msgstr "Tipos"
870
 
871
  #: ../classes/admin/settings/sf-options.php:116
872
  msgid "CHECKING these boxes will HIDE these product types from the vendor"
873
- msgstr "MARCANDO estas caixas irá OCULTAR do vendedor estes tipos de produtos"
874
 
875
  #: ../classes/admin/settings/sf-options.php:119
876
  msgid "Simple"
@@ -894,7 +888,7 @@ msgstr "Opções de tipo"
894
 
895
  #: ../classes/admin/settings/sf-options.php:130
896
  msgid "CHECKING these boxes will HIDE these product options from the vendor"
897
- msgstr "MARCANDO estas caixas irá OCULTAR do vendedor estas opções de tipo"
898
 
899
  #: ../classes/admin/settings/sf-options.php:133
900
  msgid "Virtual"
@@ -955,7 +949,7 @@ msgstr "Ver comentários"
955
 
956
  #: ../classes/admin/settings/sf-options.php:175
957
  msgid "View all vendor comments for an order on the frontend"
958
- msgstr "Ver todos comentários do vendedor para um pedido no frontend"
959
 
960
  #: ../classes/admin/settings/sf-options.php:182
961
  msgid "Submit comments"
@@ -977,8 +971,8 @@ msgid ""
977
  "While viewing order details on the frontend, you can disable or enable email "
978
  "addresses"
979
  msgstr ""
980
- "Quando estiver vendo os detalhes de um pedido no frontend, você poderá "
981
- "desativar ou ativar endereços de email"
982
 
983
  #: ../classes/admin/settings/sf-options.php:198
984
  msgid "Export a CSV file of orders for a product"
@@ -996,7 +990,7 @@ msgstr "Relatórios"
996
  msgid ""
997
  "<strike>View backend sales reports</strike>. <strong>Depreciated</strong>"
998
  msgstr ""
999
- "<strike>Ver relatórios de vandas</strike>. <strong>Depreciados</strong>"
1000
 
1001
  #: ../classes/admin/settings/sf-options.php:208
1002
  msgid ""
@@ -1004,6 +998,8 @@ msgid ""
1004
  "completely removed in future versions. Use front end reports if you require "
1005
  "them. "
1006
  msgstr ""
 
 
1007
 
1008
  #: ../classes/admin/settings/sf-options.php:215
1009
  msgid "View Frontend sales reports"
@@ -1115,9 +1111,8 @@ msgstr ""
1115
  "requerente."
1116
 
1117
  #: ../classes/admin/settings/sf-options.php:283
1118
- #, fuzzy
1119
  msgid "payments"
1120
- msgstr "Pagamentos"
1121
 
1122
  #: ../classes/admin/settings/sf-options.php:294
1123
  msgid "Payments"
@@ -1138,8 +1133,8 @@ msgid ""
1138
  "Make sure you update your PayPal Adaptive Payments settings <a href=\"%s"
1139
  "\">here</a>."
1140
  msgstr ""
1141
- "Certifique-se de atualizar suas configurações dos ajustes do PayPal Adaptive "
1142
- "Payments <a href=\"%s\">aqui</a>."
1143
 
1144
  #: ../classes/admin/settings/sf-options.php:302
1145
  msgid "Instant pay"
@@ -1148,7 +1143,7 @@ msgstr "Pagamento imediato"
1148
  #: ../classes/admin/settings/sf-options.php:303
1149
  msgid "Instantly pay vendors their commission when an order is made"
1150
  msgstr ""
1151
- "Pagar imediatamente os vendedores suas comissões quando um pedido é feito"
1152
 
1153
  #: ../classes/admin/settings/sf-options.php:304
1154
  msgid ""
@@ -1166,7 +1161,7 @@ msgstr "Programação de pagamentos"
1166
  #: ../classes/admin/settings/sf-options.php:312
1167
  msgid "Note: Schedule will only work if instant pay is unchecked"
1168
  msgstr ""
1169
- "Nota: Programação só vai funcionar se a opção de pagamento imediato for "
1170
  "desmarcada"
1171
 
1172
  #: ../classes/admin/settings/sf-options.php:317
@@ -1214,12 +1209,12 @@ msgstr "O endereço PayPal é usado para efetuarmos o pagamento."
1214
  #: ../classes/admin/views/html-vendor-settings-page.php:24
1215
  #: ../templates/dashboard/settings/shop-name.php:3
1216
  msgid "Your shop name is public and must be unique."
1217
- msgstr "O nome de sua loja é público e deverá ser único."
1218
 
1219
  #: ../classes/admin/views/html-vendor-settings-page.php:43
1220
  #: ../templates/dashboard/settings/seller-info.php:4
1221
  msgid "This is displayed on each of your products."
1222
- msgstr "Isto será mostrado em cada produto seu."
1223
 
1224
  #: ../classes/admin/views/html-vendor-settings-page.php:49
1225
  #: ../templates/dashboard/settings/shop-description.php:2
@@ -1271,9 +1266,8 @@ msgid "Order marked shipped."
1271
  msgstr "Pedido marcado enviado"
1272
 
1273
  #: ../classes/front/dashboard/class-vendor-dashboard.php:49
1274
- #, fuzzy
1275
  msgid " has marked as shipped. "
1276
- msgstr "Pedidos marcados como enviados"
1277
 
1278
  #: ../classes/front/dashboard/class-vendor-dashboard.php:75
1279
  #: ../classes/front/dashboard/class-vendor-dashboard.php:76
@@ -1282,7 +1276,7 @@ msgstr "Número de rastreamento"
1282
 
1283
  #: ../classes/front/dashboard/class-vendor-dashboard.php:78
1284
  msgid "Success. Your tracking number has been updated."
1285
- msgstr "Sucesso. Seu número de rastreamento foi atualizado."
1286
 
1287
  #: ../classes/front/orders/class-export-csv.php:19
1288
  #: ../templates/dashboard/reports.php:18
@@ -1326,7 +1320,7 @@ msgstr "Estado"
1326
 
1327
  #: ../classes/front/orders/class-orders.php:179
1328
  msgid "Zip"
1329
- msgstr "CEP"
1330
 
1331
  #: ../classes/front/orders/class-orders.php:180
1332
  msgid "Email address"
@@ -1338,12 +1332,12 @@ msgstr "Você deixou o campo de comentário vazio!"
1338
 
1339
  #: ../classes/front/orders/class-submit-comment.php:63
1340
  msgid "Success. The customer has been notified of your comment."
1341
- msgstr "Sucesso. O cliente foi notificado de seu comentário."
1342
 
1343
  #: ../classes/front/signup/class-vendor-signup.php:45
1344
  #: ../templates/dashboard/denied.php:22
1345
  msgid "Apply to become a vendor? "
1346
- msgstr "Torne-se um vendedor no Pxincha? "
1347
 
1348
  #: ../classes/front/signup/class-vendor-signup.php:54
1349
  #: ../templates/dashboard/denied.php:33
@@ -1353,11 +1347,11 @@ msgstr "Eu li e aceito os <a href=\"%s\">Termos e Condições</a>"
1353
 
1354
  #: ../classes/front/signup/class-vendor-signup.php:88
1355
  msgid "Application denied. You are an administrator."
1356
- msgstr "Requerimento negado. Você é um administrador."
1357
 
1358
  #: ../classes/front/signup/class-vendor-signup.php:90
1359
  msgid "Your application has been submitted."
1360
- msgstr "O seu requerimento foi enviado."
1361
 
1362
  #: ../classes/front/signup/class-vendor-signup.php:129
1363
  #: ../classes/front/signup/class-vendor-signup.php:138
@@ -1374,7 +1368,7 @@ msgid ""
1374
  "Something went wrong. Response from PayPal invalidated this order. Status: "
1375
  "%s."
1376
  msgstr ""
1377
- "Algo deu errado. Resposta do PayPal invalidou este pedido. Condição: %s."
1378
 
1379
  #: ../classes/gateways/PayPal_AdvPayments/paypal_ap.php:124
1380
  msgid "IPN payment completed"
@@ -1453,7 +1447,7 @@ msgstr "Assinatura do API"
1453
 
1454
  #: ../classes/gateways/PayPal_AdvPayments/paypal_ap.php:200
1455
  msgid "Application ID"
1456
- msgstr "Requerimento ID"
1457
 
1458
  #: ../classes/gateways/PayPal_AdvPayments/paypal_ap.php:202
1459
  msgid "Only required when doing live transactions."
@@ -1461,7 +1455,7 @@ msgstr "Só exigido ao fazer transações ao vivo."
1461
 
1462
  #: ../classes/gateways/PayPal_AdvPayments/paypal_ap.php:206
1463
  msgid "Sandbox Credentials"
1464
- msgstr "Credenciais sandbox"
1465
 
1466
  #: ../classes/gateways/PayPal_AdvPayments/paypal_ap.php:208
1467
  #, php-format
@@ -1502,7 +1496,7 @@ msgstr "Gateway Desativado"
1502
  #: ../classes/gateways/PayPal_AdvPayments/paypal_ap.php:280
1503
  #, php-format
1504
  msgid "%s does not support your store currency."
1505
- msgstr "%s não suporta a moeda de sua loja."
1506
 
1507
  #: ../classes/gateways/PayPal_AdvPayments/paypal_ap.php:384
1508
  #: ../classes/gateways/PayPal_AdvPayments/paypal_ap.php:498
@@ -1520,12 +1514,12 @@ msgstr "Erro ID: %s. %s"
1520
  #: ../classes/gateways/PayPal_Masspay/class-paypal-masspay.php:115
1521
  msgid "No vendors found to pay. Maybe they haven't set a PayPal address?"
1522
  msgstr ""
1523
- "Nenhum vendedor foi encontrado para ser pago. Talvez eles não tenha definido "
1524
- "um endereço PayPal?"
1525
 
1526
  #: ../classes/gateways/PayPal_Masspay/class-paypal-masspay.php:167
1527
  msgid "All due commission has been paid for."
1528
- msgstr "Todas comissões devidas já foram pagas."
1529
 
1530
  #: ../classes/gateways/PayPal_Masspay/class-paypal-masspay.php:173
1531
  msgid ""
@@ -1533,10 +1527,10 @@ msgid ""
1533
  "profiles due to an internal error. Commission will still be listed as due. "
1534
  "Please manually mark the commission as paid from the Commissions page."
1535
  msgstr ""
1536
- "Todas comissões devidas já foram pagas, mas eu não pude limpar seus perfis "
1537
- "devido a um erro interno. Comissão ainda estará marcada como devida. Por "
1538
- "favor, marque manualmente a comissão como paga a partir da página de "
1539
- "Comissões."
1540
 
1541
  #: ../classes/gateways/PayPal_Masspay/class-paypal-masspay.php:208
1542
  msgid "WooCommerce: Mass payments for vendors update"
@@ -1616,7 +1610,7 @@ msgid ""
1616
  "be sent an email as long as you have the Notify Vendors email enabled under "
1617
  "WooCommerce--Settings--Emails."
1618
  msgstr ""
1619
- "Sucesso! Seu pedido de teste agora está marcado como o processando e será "
1620
  "enviado um e-mail para quaisquer vendedores enquanto você tiver o Notificar "
1621
  "Vendedores habilitado no WooCommerce--Settings--Emails."
1622
 
@@ -1629,12 +1623,12 @@ msgid ""
1629
  "Your account has not yet been approved to become a vendor. When it is, you "
1630
  "will receive an email telling you that your account is approved!"
1631
  msgstr ""
1632
- "Sua conta ainda não foi aprovada para se tornar um vendedor. Quando for "
1633
- "aprovada, você receberá um email dizendo que sua conta está aprovada!"
1634
 
1635
  #: ../templates/dashboard/denied.php:12
1636
  msgid "Your account is not setup as a vendor."
1637
- msgstr "A sua conta actual é apenas de utilizador."
1638
 
1639
  #: ../templates/dashboard/denied.php:53
1640
  msgid "Submit"
@@ -1695,7 +1689,7 @@ msgstr "Salvar"
1695
  #: ../templates/emails/application-status.php:5
1696
  #, php-format
1697
  msgid "Hi there. This is a notification about a vendor application on %s."
1698
- msgstr "Olá. Isto é uma notificação sobre um requerimento para vendedor na %s."
1699
 
1700
  #: ../templates/emails/application-status.php:8
1701
  #, php-format
@@ -1710,7 +1704,7 @@ msgstr "Nome de usuário do requerente: %s"
1710
  #: ../templates/emails/new-product.php:5
1711
  #, php-format
1712
  msgid "Hi there. This is a notification about a new product on %s."
1713
- msgstr "Olá. Isto é uma notificação sobre um novo produto na %s."
1714
 
1715
  #: ../templates/emails/new-product.php:8
1716
  #, php-format
@@ -1808,7 +1802,7 @@ msgstr "Visualizar:"
1808
 
1809
  #: ../templates/orders/shipping/shipping-form.php:66
1810
  msgid "Click here to track your shipment"
1811
- msgstr "Clique aqui para rastrear seu envio"
1812
 
1813
  #: ../templates/orders/shipping/shipping-form.php:75
1814
  msgid "Update tracking number"
4
  "Project-Id-Version: WC Vendors\n"
5
  "Report-Msgid-Bugs-To: \n"
6
  "POT-Creation-Date: 2015-10-17 15:17+0100\n"
7
+ "PO-Revision-Date: 2017-04-07 12:18+0100\n"
8
  "Last-Translator: Renato <support@pxincha.com>\n"
9
  "Language-Team: WC Vendors <support@wcvendors.com>\n"
10
  "Language: pt_BR\n"
14
  "POT-Revision-Date: Sun May 24 2015 08:31:40 GMT-0300 (BRT)\n"
15
  "Plural-Forms: nplurals=2; plural=(n > 1);\n"
16
  "X-Poedit-SourceCharset: UTF-8\n"
17
+ "X-Generator: Poedit 1.8.11\n"
18
  "X-Poedit-Basepath: .\n"
19
  "X-Poedit-KeywordsList: _:1;gettext:1;dgettext:2;ngettext:1,2;dngettext:2,3;"
20
  "__:1;_e:1;_c:1;_n:1,2;_n_noop:1,2;_nc:1,2;__ngettext:1,2;__ngettext_noop:1,2;"
124
  #: ../classes/admin/class-admin-page.php:255
125
  #: ../classes/admin/class-admin-reports.php:172
126
  msgid "Status"
127
+ msgstr "Estado"
128
 
129
  #: ../classes/admin/class-admin-page.php:256
130
  #: ../classes/admin/class-vendor-admin-dashboard.php:288
139
 
140
  #: ../classes/admin/class-admin-page.php:294
141
  msgid "Mark due"
142
+ msgstr "Marcar como a pagar"
143
 
144
  #: ../classes/admin/class-admin-page.php:295
145
  msgid "Mark reversed"
161
 
162
  #: ../classes/admin/class-admin-page.php:386
163
  msgid "Show all Statuses"
164
+ msgstr "Mostrar todas as condições"
165
 
166
  #: ../classes/admin/class-admin-page.php:412
167
  msgid "Commission marked paid."
169
 
170
  #: ../classes/admin/class-admin-page.php:419
171
  msgid "Commission marked due."
172
+ msgstr "Comissão a pagar"
173
 
174
  #: ../classes/admin/class-admin-page.php:426
175
  msgid "Commission marked reversed."
268
  msgstr "Mês"
269
 
270
  #: ../classes/admin/class-admin-reports.php:339
 
271
  msgid "Commission Totals"
272
  msgstr "Total de Comissões"
273
 
280
  #: ../classes/admin/settings/sf-options.php:105
281
  #: ../templates/dashboard/orders.php:34 ../templates/orders/orders.php:115
282
  msgid "Shipping"
283
+ msgstr "A Enviar"
284
 
285
  #: ../classes/admin/class-admin-reports.php:342
286
  msgid "Reversed"
291
  msgstr "Pago"
292
 
293
  #: ../classes/admin/class-admin-reports.php:344
 
294
  msgid "Due"
295
+ msgstr "Comissão a pagar"
296
 
297
  #: ../classes/admin/class-admin-users.php:402
298
  msgid "Enable HTML for the shop description"
321
 
322
  #: ../classes/admin/class-admin-users.php:430
323
  msgid "Give Tax"
324
+ msgstr "Dê o imposto"
325
 
326
  #: ../classes/admin/class-admin-users.php:435
327
  msgid "Tax override for vendor"
328
+ msgstr "Substitui a taxa para o vendedor"
329
 
330
  #: ../classes/admin/class-admin-users.php:441
 
331
  msgid "Give Shipping"
332
+ msgstr "Dê os portes de envio"
333
 
334
  #: ../classes/admin/class-admin-users.php:446
335
  msgid "Shipping override for vendor"
336
+ msgstr "Substitui a taxa de envio para o vendedor"
337
 
338
  #: ../classes/admin/class-admin-users.php:452
339
  #: ../classes/admin/views/html-vendor-settings-page.php:30
361
  #: ../classes/admin/class-vendor-admin-dashboard.php:58
362
  #: ../classes/front/dashboard/class-vendor-dashboard.php:104
363
  msgid "Your PayPal address is not a valid email address."
364
+ msgstr "O seu endereço de e-mail do PayPal não é válido."
365
 
366
  #: ../classes/admin/class-vendor-admin-dashboard.php:67
367
  #: ../classes/front/dashboard/class-vendor-dashboard.php:113
372
  #: ../classes/admin/settings/classes/sf-class-settings.php:366
373
  #: ../classes/front/dashboard/class-vendor-dashboard.php:131
374
  msgid "Settings saved."
375
+ msgstr "Ajustes guardados."
376
 
377
  #: ../classes/admin/class-vendor-admin-dashboard.php:284
378
  msgid "Customer"
404
  msgstr "Comentários (%s)"
405
 
406
  #: ../classes/admin/class-vendor-admin-dashboard.php:470
 
407
  msgid "Comments to Customer"
408
+ msgstr "Comentários ao Cliente"
409
 
410
  #: ../classes/admin/class-vendor-admin-dashboard.php:479
411
  #: ../templates/orders/comments/existing-comments.php:9
415
 
416
  #: ../classes/admin/class-vendor-admin-dashboard.php:485
417
  msgid "No comments currently to customer."
418
+ msgstr "Nenhum comentário atualmente para o cliente."
419
 
420
  #: ../classes/admin/class-vendor-admin-dashboard.php:494
421
  #: ../templates/orders/comments/add-new-comment.php:11
463
 
464
  #: ../classes/admin/emails/class-wc-approve-vendor.php:28
465
  msgid "Vendor Application"
466
+ msgstr "Pedido para Vendedor"
467
 
468
  #: ../classes/admin/emails/class-wc-approve-vendor.php:29
469
  msgid "Vendor application will either be approved, denied, or pending."
470
+ msgstr "Pedido para Vendedor será aprovado, negado, ou pendente."
471
 
472
  #: ../classes/admin/emails/class-wc-approve-vendor.php:31
473
  msgid "Application {status}"
474
+ msgstr "Pedido {status}"
475
 
476
  #: ../classes/admin/emails/class-wc-approve-vendor.php:32
477
  msgid "[{blogname}] Your vendor application has been {status}"
478
+ msgstr "[{blogname}] O seu pedido para vendedor foi {status}"
479
 
480
  #: ../classes/admin/emails/class-wc-approve-vendor.php:123
481
  #: ../classes/admin/emails/class-wc-notify-admin.php:134
557
  #: ../classes/admin/emails/class-wc-notify-shipped.php:185
558
  #: ../classes/admin/emails/class-wc-notify-vendor.php:269
559
  msgid "Choose which format of email to send."
560
+ msgstr "Escolha qual o formato de email a enviar."
561
 
562
  #: ../classes/admin/emails/class-wc-approve-vendor.php:156
563
  #: ../classes/admin/emails/class-wc-notify-admin.php:167
592
 
593
  #: ../classes/admin/emails/class-wc-notify-admin.php:31
594
  msgid "New product submitted: {product_name}"
595
+ msgstr "Novo produto enviado: {product_name}"
596
 
597
  #: ../classes/admin/emails/class-wc-notify-admin.php:32
598
  msgid "[{blogname}] New product submitted by {vendor_name} - {product_name}"
611
 
612
  #: ../classes/admin/emails/class-wc-notify-shipped.php:31
613
  msgid "Your order has been shipped"
614
+ msgstr "O seu pedido já foi enviado"
615
 
616
  #: ../classes/admin/emails/class-wc-notify-shipped.php:32
617
  msgid ""
618
  "[{blogname}] Your order has been shipped ({order_number}) - {order_date}"
619
+ msgstr ""
620
+ "[{blogname}] A sua encomenda já foi enviada ({order_number}) - {order_date}"
621
 
622
  #: ../classes/admin/emails/class-wc-notify-shipped.php:112
623
  msgid "Subtotal:"
639
 
640
  #: ../classes/admin/emails/class-wc-notify-vendor.php:31
641
  msgid "[{blogname}] New customer order ({order_number}) - {order_date}"
642
+ msgstr "[{blogname}] Nova encomenda de cliente ({order_number}) - {order_date}"
643
 
644
  #: ../classes/admin/emails/class-wc-notify-vendor.php:103
645
  msgid "Commission Subtotal:"
646
  msgstr "Subtotal de comissão:"
647
 
648
  #: ../classes/admin/emails/class-wc-notify-vendor.php:109
 
649
  msgid "Tax Subtotal:"
650
  msgstr "Subtotal:"
651
 
665
 
666
  #: ../classes/admin/settings/classes/sf-class-settings.php:300
667
  msgid "Could not load settings at: "
668
+ msgstr "Não puderam ser carregados os ajustes em: "
669
 
670
  #: ../classes/admin/settings/classes/sf-class-settings.php:300
671
  msgid "Error - WP Settings Framework"
690
  "commission rate already set, this value will be ignored for that product."
691
  msgstr ""
692
  "A taxa de padrão que você pagará a cada vendedor pela venda de um produto. "
693
+ "Se um produto já tiver uma taxa de comissão definida, este valor será "
694
  "ignorado para esse produto."
695
 
696
  #: ../classes/admin/settings/sf-options.php:20
699
 
700
  #: ../classes/admin/settings/sf-options.php:21
701
  msgid "Allow users or guests to apply to become a vendor"
702
+ msgstr "Permitir usuários ou convidados a pedirem para se tornarem vendedores"
703
 
704
  #: ../classes/admin/settings/sf-options.php:22
705
  msgid ""
722
  "With this unchecked, all vendor applications are automatically accepted. "
723
  "Otherwise, you must approve each manually."
724
  msgstr ""
725
+ "Com esta opção desativada, todos os pedidos de vendedor serão "
726
+ "automaticamente aceites. Caso contrário, deve aprovar cada um manualmente."
727
 
728
  #: ../classes/admin/settings/sf-options.php:37
729
  #: ../classes/admin/settings/sf-options.php:144
737
  #: ../classes/admin/settings/sf-options.php:39
738
  msgid "The tax collected on a vendor's product will be given in its entirety"
739
  msgstr ""
740
+ "O imposto cobrado sobre o produto de um vendedor será dado na sua totalidade"
741
 
742
  #: ../classes/admin/settings/sf-options.php:47
743
  msgid "Give vendors any shipping collected per-product"
744
+ msgstr "Dê aos vendedores qualquer taxa de envio cobrada por produto"
745
 
746
  #: ../classes/admin/settings/sf-options.php:48
747
  msgid ""
748
  "The shipping collected on a vendor's product will be given in its entirety"
749
  msgstr ""
750
+ "A taxa de envio cobrada do produto de um fornecedor será dada na sua "
751
  "totalidade"
752
 
753
  #: ../classes/admin/settings/sf-options.php:54
773
 
774
  #: ../classes/admin/settings/sf-options.php:66
775
  msgid "Eg: <code>yoursite.com/[your_setting_here]/[vendor_name_here]</code>"
776
+ msgstr "Eg: <code>oseusite.com/[seu_ajuste_aqui]/[vendedor_nome_aqui]</code>"
777
 
778
  #: ../classes/admin/settings/sf-options.php:73
779
  msgid "Shop Headers"
817
  msgstr "Login do Usuário"
818
 
819
  #: ../classes/admin/settings/sf-options.php:90
 
820
  msgid "User Email"
821
+ msgstr "Email de uusário:"
822
 
823
  #: ../classes/admin/settings/sf-options.php:97
824
  msgid "Product Add Page"
839
  "CHECKING these boxes will HIDE these areas of the add product page for "
840
  "vendors"
841
  msgstr ""
842
+ "Ao MARCAR estas caixas irá OCULTAR do vendedor estas áreas para na página "
843
  "Adicionar Produto"
844
 
845
  #: ../classes/admin/settings/sf-options.php:104
846
  msgid "Inventory"
847
+ msgstr "Inventário"
848
 
849
  #: ../classes/admin/settings/sf-options.php:106
 
850
  msgid "Linked Products"
851
+ msgstr "Produtos Ligados"
852
 
853
  #: ../classes/admin/settings/sf-options.php:107
854
  msgid "Attributes"
864
 
865
  #: ../classes/admin/settings/sf-options.php:116
866
  msgid "CHECKING these boxes will HIDE these product types from the vendor"
867
+ msgstr "Ao MARCAR estas caixas irá OCULTAR do vendedor estes tipos de produtos"
868
 
869
  #: ../classes/admin/settings/sf-options.php:119
870
  msgid "Simple"
888
 
889
  #: ../classes/admin/settings/sf-options.php:130
890
  msgid "CHECKING these boxes will HIDE these product options from the vendor"
891
+ msgstr "Ao MARCAR estas caixas irá OCULTAR do vendedor estas opções de tipo"
892
 
893
  #: ../classes/admin/settings/sf-options.php:133
894
  msgid "Virtual"
949
 
950
  #: ../classes/admin/settings/sf-options.php:175
951
  msgid "View all vendor comments for an order on the frontend"
952
+ msgstr "Ver todos os comentários do vendedor para um pedido no frontend"
953
 
954
  #: ../classes/admin/settings/sf-options.php:182
955
  msgid "Submit comments"
971
  "While viewing order details on the frontend, you can disable or enable email "
972
  "addresses"
973
  msgstr ""
974
+ "Quando estiver a ver os detalhes de um pedido no frontend, poderá desativar "
975
+ "ou ativar endereços de email"
976
 
977
  #: ../classes/admin/settings/sf-options.php:198
978
  msgid "Export a CSV file of orders for a product"
990
  msgid ""
991
  "<strike>View backend sales reports</strike>. <strong>Depreciated</strong>"
992
  msgstr ""
993
+ "<strike>Ver relatórios de vendas</strike>. <strong>Depreciados</strong>"
994
 
995
  #: ../classes/admin/settings/sf-options.php:208
996
  msgid ""
998
  "completely removed in future versions. Use front end reports if you require "
999
  "them. "
1000
  msgstr ""
1001
+ "Esta opção foi removida e não funcionará mais. Será completamente removida "
1002
+ "em versões futuras. Use relatórios de front-end se precisar. "
1003
 
1004
  #: ../classes/admin/settings/sf-options.php:215
1005
  msgid "View Frontend sales reports"
1111
  "requerente."
1112
 
1113
  #: ../classes/admin/settings/sf-options.php:283
 
1114
  msgid "payments"
1115
+ msgstr "pagamentos"
1116
 
1117
  #: ../classes/admin/settings/sf-options.php:294
1118
  msgid "Payments"
1133
  "Make sure you update your PayPal Adaptive Payments settings <a href=\"%s"
1134
  "\">here</a>."
1135
  msgstr ""
1136
+ "Certifique-se de atualizar as suas configurações dos ajustes do PayPal "
1137
+ "Adaptive Payments <a href=\"%s\">aqui</a>."
1138
 
1139
  #: ../classes/admin/settings/sf-options.php:302
1140
  msgid "Instant pay"
1143
  #: ../classes/admin/settings/sf-options.php:303
1144
  msgid "Instantly pay vendors their commission when an order is made"
1145
  msgstr ""
1146
+ "Quando um pedido é feito imediatamente são pagas as comissões aos vendedores"
1147
 
1148
  #: ../classes/admin/settings/sf-options.php:304
1149
  msgid ""
1161
  #: ../classes/admin/settings/sf-options.php:312
1162
  msgid "Note: Schedule will only work if instant pay is unchecked"
1163
  msgstr ""
1164
+ "Nota: A programação só vai funcionar se a opção de pagamento imediato for "
1165
  "desmarcada"
1166
 
1167
  #: ../classes/admin/settings/sf-options.php:317
1209
  #: ../classes/admin/views/html-vendor-settings-page.php:24
1210
  #: ../templates/dashboard/settings/shop-name.php:3
1211
  msgid "Your shop name is public and must be unique."
1212
+ msgstr "O nome da sua loja é público e deverá ser único."
1213
 
1214
  #: ../classes/admin/views/html-vendor-settings-page.php:43
1215
  #: ../templates/dashboard/settings/seller-info.php:4
1216
  msgid "This is displayed on each of your products."
1217
+ msgstr "Isto será mostrado em cada um dos seus produtos."
1218
 
1219
  #: ../classes/admin/views/html-vendor-settings-page.php:49
1220
  #: ../templates/dashboard/settings/shop-description.php:2
1266
  msgstr "Pedido marcado enviado"
1267
 
1268
  #: ../classes/front/dashboard/class-vendor-dashboard.php:49
 
1269
  msgid " has marked as shipped. "
1270
+ msgstr " marcou como enviado. "
1271
 
1272
  #: ../classes/front/dashboard/class-vendor-dashboard.php:75
1273
  #: ../classes/front/dashboard/class-vendor-dashboard.php:76
1276
 
1277
  #: ../classes/front/dashboard/class-vendor-dashboard.php:78
1278
  msgid "Success. Your tracking number has been updated."
1279
+ msgstr "Sucesso. o Seu número de rastreamento foi atualizado."
1280
 
1281
  #: ../classes/front/orders/class-export-csv.php:19
1282
  #: ../templates/dashboard/reports.php:18
1320
 
1321
  #: ../classes/front/orders/class-orders.php:179
1322
  msgid "Zip"
1323
+ msgstr "CPostal"
1324
 
1325
  #: ../classes/front/orders/class-orders.php:180
1326
  msgid "Email address"
1332
 
1333
  #: ../classes/front/orders/class-submit-comment.php:63
1334
  msgid "Success. The customer has been notified of your comment."
1335
+ msgstr "Sucesso. O cliente foi notificado do seu comentário."
1336
 
1337
  #: ../classes/front/signup/class-vendor-signup.php:45
1338
  #: ../templates/dashboard/denied.php:22
1339
  msgid "Apply to become a vendor? "
1340
+ msgstr "Quer vender no Pxincha? "
1341
 
1342
  #: ../classes/front/signup/class-vendor-signup.php:54
1343
  #: ../templates/dashboard/denied.php:33
1347
 
1348
  #: ../classes/front/signup/class-vendor-signup.php:88
1349
  msgid "Application denied. You are an administrator."
1350
+ msgstr "Pedido negado. Você é um administrador."
1351
 
1352
  #: ../classes/front/signup/class-vendor-signup.php:90
1353
  msgid "Your application has been submitted."
1354
+ msgstr "O seu pedido foi enviado."
1355
 
1356
  #: ../classes/front/signup/class-vendor-signup.php:129
1357
  #: ../classes/front/signup/class-vendor-signup.php:138
1368
  "Something went wrong. Response from PayPal invalidated this order. Status: "
1369
  "%s."
1370
  msgstr ""
1371
+ "Algo deu errado. A resposta do PayPal invalidou este pedido. Estado: %s."
1372
 
1373
  #: ../classes/gateways/PayPal_AdvPayments/paypal_ap.php:124
1374
  msgid "IPN payment completed"
1447
 
1448
  #: ../classes/gateways/PayPal_AdvPayments/paypal_ap.php:200
1449
  msgid "Application ID"
1450
+ msgstr "Pedido ID"
1451
 
1452
  #: ../classes/gateways/PayPal_AdvPayments/paypal_ap.php:202
1453
  msgid "Only required when doing live transactions."
1455
 
1456
  #: ../classes/gateways/PayPal_AdvPayments/paypal_ap.php:206
1457
  msgid "Sandbox Credentials"
1458
+ msgstr "Credenciais Sandbox"
1459
 
1460
  #: ../classes/gateways/PayPal_AdvPayments/paypal_ap.php:208
1461
  #, php-format
1496
  #: ../classes/gateways/PayPal_AdvPayments/paypal_ap.php:280
1497
  #, php-format
1498
  msgid "%s does not support your store currency."
1499
+ msgstr "%s não suporta a moeda da sua loja."
1500
 
1501
  #: ../classes/gateways/PayPal_AdvPayments/paypal_ap.php:384
1502
  #: ../classes/gateways/PayPal_AdvPayments/paypal_ap.php:498
1514
  #: ../classes/gateways/PayPal_Masspay/class-paypal-masspay.php:115
1515
  msgid "No vendors found to pay. Maybe they haven't set a PayPal address?"
1516
  msgstr ""
1517
+ "Nenhum vendedor encontrado para ser pago. Talvez eles não tenham definido um "
1518
+ "endereço PayPal."
1519
 
1520
  #: ../classes/gateways/PayPal_Masspay/class-paypal-masspay.php:167
1521
  msgid "All due commission has been paid for."
1522
+ msgstr "Todas as comissões devidas já foram pagas."
1523
 
1524
  #: ../classes/gateways/PayPal_Masspay/class-paypal-masspay.php:173
1525
  msgid ""
1527
  "profiles due to an internal error. Commission will still be listed as due. "
1528
  "Please manually mark the commission as paid from the Commissions page."
1529
  msgstr ""
1530
+ "Todas as comissões devidas já foram pagas, mas eu não pude limpar os seus "
1531
+ "perfis devido a um erro interno. A comissão ainda estará marcada como "
1532
+ "devida. Por favor, marque manualmente a comissão como paga a partir da "
1533
+ "página de comissões."
1534
 
1535
  #: ../classes/gateways/PayPal_Masspay/class-paypal-masspay.php:208
1536
  msgid "WooCommerce: Mass payments for vendors update"
1610
  "be sent an email as long as you have the Notify Vendors email enabled under "
1611
  "WooCommerce--Settings--Emails."
1612
  msgstr ""
1613
+ "Sucesso! O seu pedido de teste agora está marcado como a processar e será "
1614
  "enviado um e-mail para quaisquer vendedores enquanto você tiver o Notificar "
1615
  "Vendedores habilitado no WooCommerce--Settings--Emails."
1616
 
1623
  "Your account has not yet been approved to become a vendor. When it is, you "
1624
  "will receive an email telling you that your account is approved!"
1625
  msgstr ""
1626
+ "A sua conta ainda não foi aprovada para se tornar um vendedor. Quando for "
1627
+ "aprovada, receberá um email a informar que a sua conta está aprovada!"
1628
 
1629
  #: ../templates/dashboard/denied.php:12
1630
  msgid "Your account is not setup as a vendor."
1631
+ msgstr "A sua conta atual é apenas de utilizador."
1632
 
1633
  #: ../templates/dashboard/denied.php:53
1634
  msgid "Submit"
1689
  #: ../templates/emails/application-status.php:5
1690
  #, php-format
1691
  msgid "Hi there. This is a notification about a vendor application on %s."
1692
+ msgstr "Olá. Isto é uma notificação sobre um pedido para vendedor em %s."
1693
 
1694
  #: ../templates/emails/application-status.php:8
1695
  #, php-format
1704
  #: ../templates/emails/new-product.php:5
1705
  #, php-format
1706
  msgid "Hi there. This is a notification about a new product on %s."
1707
+ msgstr "Olá. Isto é uma notificação sobre um novo produto em %s."
1708
 
1709
  #: ../templates/emails/new-product.php:8
1710
  #, php-format
1802
 
1803
  #: ../templates/orders/shipping/shipping-form.php:66
1804
  msgid "Click here to track your shipment"
1805
+ msgstr "Clique aqui para rastrear o seu envio"
1806
 
1807
  #: ../templates/orders/shipping/shipping-form.php:75
1808
  msgid "Update tracking number"
readme.txt CHANGED
@@ -1,12 +1,12 @@
1
  === WC Vendors ===
2
- Contributors: wcvendors, digitalchild, bentasm1
3
  Tags: commission rate, e-commerce, ecommerce, ebay, free, marketplace, multi seller, multi store, multi vendor, multistore, multivendor, multivendors, product vendor, product vendors, seller, shops, store, vendor, vendor shop, vendor system, vendors, wc multivendor, wc vendors, wc marketplace, wc market, woo vendors, woocommerce, woocommerce marketplace, woocommerce multi vendor, WooCommerce multivendor, woocommerce product vendors, WooCommerce vendors, yit, yith, yithemes
4
  Donate link: http://www.wcvendors.com/
5
  Author URI: http://www.wcvendors.com/
6
  Plugin URI: http://www.wcvendors.com/
7
  Requires at least: 4.4.0
8
- Tested up to: 4.7.1
9
- Stable tag: 1.9.11
10
  License: GPLv2 or later
11
 
12
  The free marketplace plugin for WooCommerce. Now you can allow anyone to open a store on your site!
1
  === WC Vendors ===
2
+ Contributors: digitalchild, benwcv, annawcvendors
3
  Tags: commission rate, e-commerce, ecommerce, ebay, free, marketplace, multi seller, multi store, multi vendor, multistore, multivendor, multivendors, product vendor, product vendors, seller, shops, store, vendor, vendor shop, vendor system, vendors, wc multivendor, wc vendors, wc marketplace, wc market, woo vendors, woocommerce, woocommerce marketplace, woocommerce multi vendor, WooCommerce multivendor, woocommerce product vendors, WooCommerce vendors, yit, yith, yithemes
4
  Donate link: http://www.wcvendors.com/
5
  Author URI: http://www.wcvendors.com/
6
  Plugin URI: http://www.wcvendors.com/
7
  Requires at least: 4.4.0
8
+ Tested up to: 4.8.0
9
+ Stable tag: 1.9.12
10
  License: GPLv2 or later
11
 
12
  The free marketplace plugin for WooCommerce. Now you can allow anyone to open a store on your site!
templates/emails/vendor-new-order.php CHANGED
@@ -47,7 +47,7 @@ $order_date = ( version_compare( WC_VERSION, '2.7', '<' ) ) ? $order->order_da
47
 
48
  } else {
49
  echo wc_get_email_order_items( $order, array(
50
- 'show_sku' => false,
51
  'show_image' => false,
52
  'image_size' => array( 32, 32 ),
53
  'plain_text' => false,
47
 
48
  } else {
49
  echo wc_get_email_order_items( $order, array(
50
+ 'show_sku' => true,
51
  'show_image' => false,
52
  'image_size' => array( 32, 32 ),
53
  'plain_text' => false,
templates/orders/orders.php CHANGED
@@ -2,6 +2,8 @@
2
 
3
  <h2><?php printf( 'Orders for %s', wc_get_product( $product_id )->get_title() ); ?></h2>
4
 
 
 
5
  <table class="table table-striped table-bordered">
6
  <thead>
7
  <tr>
@@ -138,4 +140,5 @@
138
  <?php endforeach; ?>
139
 
140
  </tbody>
141
- </table>
 
2
 
3
  <h2><?php printf( 'Orders for %s', wc_get_product( $product_id )->get_title() ); ?></h2>
4
 
5
+ <?php do_action('wc_vendors_before_order_detail', $body);?>
6
+
7
  <table class="table table-striped table-bordered">
8
  <thead>
9
  <tr>
140
  <?php endforeach; ?>
141
 
142
  </tbody>
143
+ </table>
144
+ <?php do_action('wc_vendors_after_order_detail', $body);?>
trunk/assets/css/admin-orders.css DELETED
@@ -1,7 +0,0 @@
1
- .wp-list-table .column-order_id { width: 10%; }
2
- .wp-list-table .column-customer { width: 15%; }
3
- .wp-list-table .column-product { width: 35%; }
4
- .wp-list-table .column-total { width: 10%;}
5
- /*.wp-list-table .column-comments { width: 27.5%;}*/
6
- .wp-list-table .column-date { width: 15%;}
7
- .wp-list-table .column-status { width: 15%;}
 
 
 
 
 
 
 
trunk/assets/css/select2.min.css DELETED
@@ -1 +0,0 @@
1
- .select2-container{box-sizing:border-box;display:inline-block;margin:0;position:relative;vertical-align:middle}.select2-container .select2-selection--single{box-sizing:border-box;cursor:pointer;display:block;height:28px;user-select:none;-webkit-user-select:none}.select2-container .select2-selection--single .select2-selection__rendered{display:block;padding-left:8px;padding-right:20px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.select2-container .select2-selection--single .select2-selection__clear{position:relative}.select2-container[dir="rtl"] .select2-selection--single .select2-selection__rendered{padding-right:8px;padding-left:20px}.select2-container .select2-selection--multiple{box-sizing:border-box;cursor:pointer;display:block;min-height:32px;user-select:none;-webkit-user-select:none}.select2-container .select2-selection--multiple .select2-selection__rendered{display:inline-block;overflow:hidden;padding-left:8px;text-overflow:ellipsis;white-space:nowrap}.select2-container .select2-search--inline{float:left}.select2-container .select2-search--inline .select2-search__field{box-sizing:border-box;border:none;font-size:100%;margin-top:5px;padding:0}.select2-container .select2-search--inline .select2-search__field::-webkit-search-cancel-button{-webkit-appearance:none}.select2-dropdown{background-color:white;border:1px solid #aaa;border-radius:4px;box-sizing:border-box;display:block;position:absolute;left:-100000px;width:100%;z-index:1051}.select2-results{display:block}.select2-results__options{list-style:none;margin:0;padding:0}.select2-results__option{padding:6px;user-select:none;-webkit-user-select:none}.select2-results__option[aria-selected]{cursor:pointer}.select2-container--open .select2-dropdown{left:0}.select2-container--open .select2-dropdown--above{border-bottom:none;border-bottom-left-radius:0;border-bottom-right-radius:0}.select2-container--open .select2-dropdown--below{border-top:none;border-top-left-radius:0;border-top-right-radius:0}.select2-search--dropdown{display:block;padding:4px}.select2-search--dropdown .select2-search__field{padding:4px;width:100%;box-sizing:border-box}.select2-search--dropdown .select2-search__field::-webkit-search-cancel-button{-webkit-appearance:none}.select2-search--dropdown.select2-search--hide{display:none}.select2-close-mask{border:0;margin:0;padding:0;display:block;position:fixed;left:0;top:0;min-height:100%;min-width:100%;height:auto;width:auto;opacity:0;z-index:99;background-color:#fff;filter:alpha(opacity=0)}.select2-hidden-accessible{border:0 !important;clip:rect(0 0 0 0) !important;height:1px !important;margin:-1px !important;overflow:hidden !important;padding:0 !important;position:absolute !important;width:1px !important}.select2-container--default .select2-selection--single{background-color:#fff;border:1px solid #aaa;border-radius:4px}.select2-container--default .select2-selection--single .select2-selection__rendered{color:#444;line-height:28px}.select2-container--default .select2-selection--single .select2-selection__clear{cursor:pointer;float:right;font-weight:bold}.select2-container--default .select2-selection--single .select2-selection__placeholder{color:#999}.select2-container--default .select2-selection--single .select2-selection__arrow{height:26px;position:absolute;top:1px;right:1px;width:20px}.select2-container--default .select2-selection--single .select2-selection__arrow b{border-color:#888 transparent transparent transparent;border-style:solid;border-width:5px 4px 0 4px;height:0;left:50%;margin-left:-4px;margin-top:-2px;position:absolute;top:50%;width:0}.select2-container--default[dir="rtl"] .select2-selection--single .select2-selection__clear{float:left}.select2-container--default[dir="rtl"] .select2-selection--single .select2-selection__arrow{left:1px;right:auto}.select2-container--default.select2-container--disabled .select2-selection--single{background-color:#eee;cursor:default}.select2-container--default.select2-container--disabled .select2-selection--single .select2-selection__clear{display:none}.select2-container--default.select2-container--open .select2-selection--single .select2-selection__arrow b{border-color:transparent transparent #888 transparent;border-width:0 4px 5px 4px}.select2-container--default .select2-selection--multiple{background-color:white;border:1px solid #aaa;border-radius:4px;cursor:text}.select2-container--default .select2-selection--multiple .select2-selection__rendered{box-sizing:border-box;list-style:none;margin:0;padding:0 5px;width:100%}.select2-container--default .select2-selection--multiple .select2-selection__rendered li{list-style:none}.select2-container--default .select2-selection--multiple .select2-selection__placeholder{color:#999;margin-top:5px;float:left}.select2-container--default .select2-selection--multiple .select2-selection__clear{cursor:pointer;float:right;font-weight:bold;margin-top:5px;margin-right:10px}.select2-container--default .select2-selection--multiple .select2-selection__choice{background-color:#e4e4e4;border:1px solid #aaa;border-radius:4px;cursor:default;float:left;margin-right:5px;margin-top:5px;padding:0 5px}.select2-container--default .select2-selection--multiple .select2-selection__choice__remove{color:#999;cursor:pointer;display:inline-block;font-weight:bold;margin-right:2px}.select2-container--default .select2-selection--multiple .select2-selection__choice__remove:hover{color:#333}.select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__choice,.select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__placeholder,.select2-container--default[dir="rtl"] .select2-selection--multiple .select2-search--inline{float:right}.select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__choice{margin-left:5px;margin-right:auto}.select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__choice__remove{margin-left:2px;margin-right:auto}.select2-container--default.select2-container--focus .select2-selection--multiple{border:solid black 1px;outline:0}.select2-container--default.select2-container--disabled .select2-selection--multiple{background-color:#eee;cursor:default}.select2-container--default.select2-container--disabled .select2-selection__choice__remove{display:none}.select2-container--default.select2-container--open.select2-container--above .select2-selection--single,.select2-container--default.select2-container--open.select2-container--above .select2-selection--multiple{border-top-left-radius:0;border-top-right-radius:0}.select2-container--default.select2-container--open.select2-container--below .select2-selection--single,.select2-container--default.select2-container--open.select2-container--below .select2-selection--multiple{border-bottom-left-radius:0;border-bottom-right-radius:0}.select2-container--default .select2-search--dropdown .select2-search__field{border:1px solid #aaa}.select2-container--default .select2-search--inline .select2-search__field{background:transparent;border:none;outline:0;box-shadow:none;-webkit-appearance:textfield}.select2-container--default .select2-results>.select2-results__options{max-height:200px;overflow-y:auto}.select2-container--default .select2-results__option[role=group]{padding:0}.select2-container--default .select2-results__option[aria-disabled=true]{color:#999}.select2-container--default .select2-results__option[aria-selected=true]{background-color:#ddd}.select2-container--default .select2-results__option .select2-results__option{padding-left:1em}.select2-container--default .select2-results__option .select2-results__option .select2-results__group{padding-left:0}.select2-container--default .select2-results__option .select2-results__option .select2-results__option{margin-left:-1em;padding-left:2em}.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option{margin-left:-2em;padding-left:3em}.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option{margin-left:-3em;padding-left:4em}.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option{margin-left:-4em;padding-left:5em}.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option{margin-left:-5em;padding-left:6em}.select2-container--default .select2-results__option--highlighted[aria-selected]{background-color:#5897fb;color:white}.select2-container--default .select2-results__group{cursor:default;display:block;padding:6px}.select2-container--classic .select2-selection--single{background-color:#f7f7f7;border:1px solid #aaa;border-radius:4px;outline:0;background-image:-webkit-linear-gradient(top, #fff 50%, #eee 100%);background-image:-o-linear-gradient(top, #fff 50%, #eee 100%);background-image:linear-gradient(to bottom, #fff 50%, #eee 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFFFFFFF', endColorstr='#FFEEEEEE', GradientType=0)}.select2-container--classic .select2-selection--single:focus{border:1px solid #5897fb}.select2-container--classic .select2-selection--single .select2-selection__rendered{color:#444;line-height:28px}.select2-container--classic .select2-selection--single .select2-selection__clear{cursor:pointer;float:right;font-weight:bold;margin-right:10px}.select2-container--classic .select2-selection--single .select2-selection__placeholder{color:#999}.select2-container--classic .select2-selection--single .select2-selection__arrow{background-color:#ddd;border:none;border-left:1px solid #aaa;border-top-right-radius:4px;border-bottom-right-radius:4px;height:26px;position:absolute;top:1px;right:1px;width:20px;background-image:-webkit-linear-gradient(top, #eee 50%, #ccc 100%);background-image:-o-linear-gradient(top, #eee 50%, #ccc 100%);background-image:linear-gradient(to bottom, #eee 50%, #ccc 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFEEEEEE', endColorstr='#FFCCCCCC', GradientType=0)}.select2-container--classic .select2-selection--single .select2-selection__arrow b{border-color:#888 transparent transparent transparent;border-style:solid;border-width:5px 4px 0 4px;height:0;left:50%;margin-left:-4px;margin-top:-2px;position:absolute;top:50%;width:0}.select2-container--classic[dir="rtl"] .select2-selection--single .select2-selection__clear{float:left}.select2-container--classic[dir="rtl"] .select2-selection--single .select2-selection__arrow{border:none;border-right:1px solid #aaa;border-radius:0;border-top-left-radius:4px;border-bottom-left-radius:4px;left:1px;right:auto}.select2-container--classic.select2-container--open .select2-selection--single{border:1px solid #5897fb}.select2-container--classic.select2-container--open .select2-selection--single .select2-selection__arrow{background:transparent;border:none}.select2-container--classic.select2-container--open .select2-selection--single .select2-selection__arrow b{border-color:transparent transparent #888 transparent;border-width:0 4px 5px 4px}.select2-container--classic.select2-container--open.select2-container--above .select2-selection--single{border-top:none;border-top-left-radius:0;border-top-right-radius:0;background-image:-webkit-linear-gradient(top, #fff 0%, #eee 50%);background-image:-o-linear-gradient(top, #fff 0%, #eee 50%);background-image:linear-gradient(to bottom, #fff 0%, #eee 50%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFFFFFFF', endColorstr='#FFEEEEEE', GradientType=0)}.select2-container--classic.select2-container--open.select2-container--below .select2-selection--single{border-bottom:none;border-bottom-left-radius:0;border-bottom-right-radius:0;background-image:-webkit-linear-gradient(top, #eee 50%, #fff 100%);background-image:-o-linear-gradient(top, #eee 50%, #fff 100%);background-image:linear-gradient(to bottom, #eee 50%, #fff 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFEEEEEE', endColorstr='#FFFFFFFF', GradientType=0)}.select2-container--classic .select2-selection--multiple{background-color:white;border:1px solid #aaa;border-radius:4px;cursor:text;outline:0}.select2-container--classic .select2-selection--multiple:focus{border:1px solid #5897fb}.select2-container--classic .select2-selection--multiple .select2-selection__rendered{list-style:none;margin:0;padding:0 5px}.select2-container--classic .select2-selection--multiple .select2-selection__clear{display:none}.select2-container--classic .select2-selection--multiple .select2-selection__choice{background-color:#e4e4e4;border:1px solid #aaa;border-radius:4px;cursor:default;float:left;margin-right:5px;margin-top:5px;padding:0 5px}.select2-container--classic .select2-selection--multiple .select2-selection__choice__remove{color:#888;cursor:pointer;display:inline-block;font-weight:bold;margin-right:2px}.select2-container--classic .select2-selection--multiple .select2-selection__choice__remove:hover{color:#555}.select2-container--classic[dir="rtl"] .select2-selection--multiple .select2-selection__choice{float:right}.select2-container--classic[dir="rtl"] .select2-selection--multiple .select2-selection__choice{margin-left:5px;margin-right:auto}.select2-container--classic[dir="rtl"] .select2-selection--multiple .select2-selection__choice__remove{margin-left:2px;margin-right:auto}.select2-container--classic.select2-container--open .select2-selection--multiple{border:1px solid #5897fb}.select2-container--classic.select2-container--open.select2-container--above .select2-selection--multiple{border-top:none;border-top-left-radius:0;border-top-right-radius:0}.select2-container--classic.select2-container--open.select2-container--below .select2-selection--multiple{border-bottom:none;border-bottom-left-radius:0;border-bottom-right-radius:0}.select2-container--classic .select2-search--dropdown .select2-search__field{border:1px solid #aaa;outline:0}.select2-container--classic .select2-search--inline .select2-search__field{outline:0;box-shadow:none}.select2-container--classic .select2-dropdown{background-color:#fff;border:1px solid transparent}.select2-container--classic .select2-dropdown--above{border-bottom:none}.select2-container--classic .select2-dropdown--below{border-top:none}.select2-container--classic .select2-results>.select2-results__options{max-height:200px;overflow-y:auto}.select2-container--classic .select2-results__option[role=group]{padding:0}.select2-container--classic .select2-results__option[aria-disabled=true]{color:grey}.select2-container--classic .select2-results__option--highlighted[aria-selected]{background-color:#3875d7;color:#fff}.select2-container--classic .select2-results__group{cursor:default;display:block;padding:6px}.select2-container--classic.select2-container--open .select2-dropdown{border-color:#5897fb}
 
trunk/assets/css/wcv-frontend.css DELETED
@@ -1,545 +0,0 @@
1
- /*!
2
- * Bootstrap v2.1.1
3
- *
4
- * Copyright 2012 Twitter, Inc
5
- * Licensed under the Apache License v2.0
6
- * http://www.apache.org/licenses/LICENSE-2.0
7
- *
8
- * Designed and built with all the love in the world @twitter by @mdo and @fat.
9
- */
10
- clearfix {
11
- *zoom: 1;
12
- }
13
-
14
- .clearfix:before, .clearfix:after {
15
- display: table;
16
- content: "";
17
- line-height: 0;
18
- }
19
-
20
- .clearfix:after {
21
- clear: both;
22
- }
23
-
24
- .hide-text {
25
- font: 0/0 a;
26
- color: transparent;
27
- text-shadow: none;
28
- background-color: transparent;
29
- border: 0;
30
- }
31
-
32
- .input-block-level {
33
- display: block;
34
- width: 100%;
35
- min-height: 30px;
36
- -webkit-box-sizing: border-box;
37
- -moz-box-sizing: border-box;
38
- box-sizing: border-box;
39
- }
40
-
41
- .wcv-btn {
42
- display: inline-block;
43
- *display: inline;
44
- *zoom: 1;
45
- padding: 4px 14px;
46
- margin-bottom: 0;
47
- font-size: 14px;
48
- line-height: 20px;
49
- *line-height: 20px;
50
- text-align: center;
51
- vertical-align: middle;
52
- cursor: pointer;
53
- color: #333333;
54
- text-shadow: 0 1px 1px rgba(255, 255, 255, 0.75);
55
- background-color: #f5f5f5;
56
- background-image: -moz-linear-gradient(top, #ffffff, #e6e6e6);
57
- background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#ffffff), to(#e6e6e6));
58
- background-image: -webkit-linear-gradient(top, #ffffff, #e6e6e6);
59
- background-image: -o-linear-gradient(top, #ffffff, #e6e6e6);
60
- background-image: linear-gradient(to bottom, #ffffff, #e6e6e6);
61
- background-repeat: repeat-x;
62
- filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffffff', endColorstr='#ffe6e6e6', GradientType=0);
63
- border-color: #e6e6e6 #e6e6e6 #bfbfbf;
64
- border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);
65
- *background-color: #e6e6e6;
66
- filter: progid:DXImageTransform.Microsoft.gradient(enabled=false);
67
- border: 1px solid #bbbbbb;
68
- *border: 0;
69
- border-bottom-color: #a2a2a2;
70
- -webkit-border-radius: 4px;
71
- -moz-border-radius: 4px;
72
- border-radius: 4px;
73
- *margin-left: .3em;
74
- -webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 1px 2px rgba(0, 0, 0, 0.05);
75
- -moz-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 1px 2px rgba(0, 0, 0, 0.05);
76
- box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 1px 2px rgba(0, 0, 0, 0.05);
77
- }
78
-
79
- .wcv-btn:hover, .wcv-btn:active, .wcv-btn.active, .wcv-btn.disabled, .wcv-btn[disabled] {
80
- color: #333333;
81
- background-color: #e6e6e6;
82
- *background-color: #d9d9d9;
83
- }
84
-
85
- .wcv-btn:active, .wcv-btn.active {
86
- background-color: #cccccc \9;
87
- }
88
-
89
- .wcv-btn:first-child {
90
- *margin-left: 0;
91
- }
92
-
93
- .wcv-btn:hover {
94
- color: #333333;
95
- text-decoration: none;
96
- background-color: #e6e6e6;
97
- *background-color: #d9d9d9;
98
- background-position: 0 -15px;
99
- -webkit-transition: background-position 0.1s linear;
100
- -moz-transition: background-position 0.1s linear;
101
- -o-transition: background-position 0.1s linear;
102
- transition: background-position 0.1s linear;
103
- }
104
-
105
- .wcv-btn:focus {
106
- outline: thin dotted #333;
107
- outline: 5px auto -webkit-focus-ring-color;
108
- outline-offset: -2px;
109
- }
110
-
111
- .wcv-btn.active, .wcv-btn:active {
112
- background-color: #e6e6e6;
113
- background-color: #d9d9d9 \9;
114
- background-image: none;
115
- outline: 0;
116
- -webkit-box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.15), 0 1px 2px rgba(0, 0, 0, 0.05);
117
- -moz-box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.15), 0 1px 2px rgba(0, 0, 0, 0.05);
118
- box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.15), 0 1px 2px rgba(0, 0, 0, 0.05);
119
- }
120
-
121
- .wcv-btn.disabled, .wcv-btn[disabled] {
122
- cursor: default;
123
- background-color: #e6e6e6;
124
- background-image: none;
125
- opacity: 0.65;
126
- filter: alpha(opacity=65);
127
- -webkit-box-shadow: none;
128
- -moz-box-shadow: none;
129
- box-shadow: none;
130
- }
131
-
132
- .wcv-btn-large {
133
- padding: 9px 14px;
134
- font-size: 16px;
135
- line-height: normal;
136
- -webkit-border-radius: 5px;
137
- -moz-border-radius: 5px;
138
- border-radius: 5px;
139
- }
140
-
141
- .wcv-btn-large [class^="icon-"] {
142
- margin-top: 2px;
143
- }
144
-
145
- .wcv-btn-small {
146
- padding: 3px 9px;
147
- font-size: 12px;
148
- line-height: 18px;
149
- }
150
-
151
- .wcv-btn-small [class^="icon-"] {
152
- margin-top: 0;
153
- }
154
-
155
- .wcv-btn-mini {
156
- padding: 2px 6px;
157
- font-size: 11px;
158
- line-height: 17px;
159
- }
160
-
161
- .wcv-btn-block {
162
- display: block;
163
- width: 100%;
164
- padding-left: 0;
165
- padding-right: 0;
166
- -webkit-box-sizing: border-box;
167
- -moz-box-sizing: border-box;
168
- box-sizing: border-box;
169
- }
170
-
171
- .wcv-btn-block + .wcv-btn-block {
172
- margin-top: 5px;
173
- }
174
-
175
- input[type="submit"].wcv-btn-block, input[type="reset"].wcv-btn-block, input[type="button"].wcv-btn-block {
176
- width: 100%;
177
- }
178
-
179
- .wcv-btn-primary.active, .wcv-btn-warning.active, .wcv-btn-danger.active, .wcv-btn-success.active, .wcv-btn-info.active, .wcv-btn-inverse.active {
180
- color: rgba(255, 255, 255, 0.75);
181
- }
182
-
183
- .wcv-btn {
184
- border-color: #c5c5c5;
185
- border-color: rgba(0, 0, 0, 0.15) rgba(0, 0, 0, 0.15) rgba(0, 0, 0, 0.25);
186
- }
187
-
188
- .wcv-btn-primary {
189
- color: #ffffff;
190
- text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25);
191
- background-color: #006dcc;
192
- background-image: -moz-linear-gradient(top, #0088cc, #0044cc);
193
- background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#0088cc), to(#0044cc));
194
- background-image: -webkit-linear-gradient(top, #0088cc, #0044cc);
195
- background-image: -o-linear-gradient(top, #0088cc, #0044cc);
196
- background-image: linear-gradient(to bottom, #0088cc, #0044cc);
197
- background-repeat: repeat-x;
198
- filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff0088cc', endColorstr='#ff0044cc', GradientType=0);
199
- border-color: #0044cc #0044cc #002a80;
200
- border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);
201
- *background-color: #0044cc;
202
- filter: progid:DXImageTransform.Microsoft.gradient(enabled=false);
203
- }
204
-
205
- .wcv-btn-primary:hover, .wcv-btn-primary:active, .wcv-btn-primary.active, .wcv-btn-primary.disabled, .wcv-btn-primary[disabled] {
206
- color: #ffffff;
207
- background-color: #0044cc;
208
- *background-color: #003bb3;
209
- }
210
-
211
- .wcv-btn-primary:active, .wcv-btn-primary.active {
212
- background-color: #003399 \9;
213
- }
214
-
215
- .wcv-btn-warning {
216
- color: #ffffff;
217
- text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25);
218
- background-color: #faa732;
219
- background-image: -moz-linear-gradient(top, #fbb450, #f89406);
220
- background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#fbb450), to(#f89406));
221
- background-image: -webkit-linear-gradient(top, #fbb450, #f89406);
222
- background-image: -o-linear-gradient(top, #fbb450, #f89406);
223
- background-image: linear-gradient(to bottom, #fbb450, #f89406);
224
- background-repeat: repeat-x;
225
- filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fffbb450', endColorstr='#fff89406', GradientType=0);
226
- border-color: #f89406 #f89406 #ad6704;
227
- border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);
228
- *background-color: #f89406;
229
- filter: progid:DXImageTransform.Microsoft.gradient(enabled=false);
230
- }
231
-
232
- .wcv-btn-warning:hover, .wcv-btn-warning:active, .wcv-btn-warning.active, .wcv-btn-warning.disabled, .wcv-btn-warning[disabled] {
233
- color: #ffffff;
234
- background-color: #f89406;
235
- *background-color: #df8505;
236
- }
237
-
238
- .wcv-btn-warning:active, .wcv-btn-warning.active {
239
- background-color: #c67605 \9;
240
- }
241
-
242
- .wcv-btn-danger {
243
- color: #ffffff;
244
- text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25);
245
- background-color: #da4f49;
246
- background-image: -moz-linear-gradient(top, #ee5f5b, #bd362f);
247
- background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#ee5f5b), to(#bd362f));
248
- background-image: -webkit-linear-gradient(top, #ee5f5b, #bd362f);
249
- background-image: -o-linear-gradient(top, #ee5f5b, #bd362f);
250
- background-image: linear-gradient(to bottom, #ee5f5b, #bd362f);
251
- background-repeat: repeat-x;
252
- filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffee5f5b', endColorstr='#ffbd362f', GradientType=0);
253
- border-color: #bd362f #bd362f #802420;
254
- border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);
255
- *background-color: #bd362f;
256
- filter: progid:DXImageTransform.Microsoft.gradient(enabled=false);
257
- }
258
-
259
- .wcv-btn-danger:hover, .wcv-btn-danger:active, .wcv-btn-danger.active, .wcv-btn-danger.disabled, .wcv-btn-danger[disabled] {
260
- color: #ffffff;
261
- background-color: #bd362f;
262
- *background-color: #a9302a;
263
- }
264
-
265
- .wcv-btn-danger:active, .wcv-btn-danger.active {
266
- background-color: #942a25 \9;
267
- }
268
-
269
- .wcv-btn-success {
270
- color: #ffffff;
271
- text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25);
272
- background-color: #5bb75b;
273
- background-image: -moz-linear-gradient(top, #62c462, #51a351);
274
- background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#62c462), to(#51a351));
275
- background-image: -webkit-linear-gradient(top, #62c462, #51a351);
276
- background-image: -o-linear-gradient(top, #62c462, #51a351);
277
- background-image: linear-gradient(to bottom, #62c462, #51a351);
278
- background-repeat: repeat-x;
279
- filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff62c462', endColorstr='#ff51a351', GradientType=0);
280
- border-color: #51a351 #51a351 #387038;
281
- border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);
282
- *background-color: #51a351;
283
- filter: progid:DXImageTransform.Microsoft.gradient(enabled=false);
284
- }
285
-
286
- .wcv-btn-success:hover, .wcv-btn-success:active, .wcv-btn-success.active, .wcv-btn-success.disabled, .wcv-btn-success[disabled] {
287
- color: #ffffff;
288
- background-color: #51a351;
289
- *background-color: #499249;
290
- }
291
-
292
- .wcv-btn-success:active, .wcv-btn-success.active {
293
- background-color: #408140 \9;
294
- }
295
-
296
- .wcv-btn-info {
297
- color: #ffffff;
298
- text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25);
299
- background-color: #49afcd;
300
- background-image: -moz-linear-gradient(top, #5bc0de, #2f96b4);
301
- background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#5bc0de), to(#2f96b4));
302
- background-image: -webkit-linear-gradient(top, #5bc0de, #2f96b4);
303
- background-image: -o-linear-gradient(top, #5bc0de, #2f96b4);
304
- background-image: linear-gradient(to bottom, #5bc0de, #2f96b4);
305
- background-repeat: repeat-x;
306
- filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff5bc0de', endColorstr='#ff2f96b4', GradientType=0);
307
- border-color: #2f96b4 #2f96b4 #1f6377;
308
- border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);
309
- *background-color: #2f96b4;
310
- filter: progid:DXImageTransform.Microsoft.gradient(enabled=false);
311
- }
312
-
313
- .wcv-btn-info:hover, .wcv-btn-info:active, .wcv-btn-info.active, .wcv-btn-info.disabled, .wcv-btn-info[disabled] {
314
- color: #ffffff;
315
- background-color: #2f96b4;
316
- *background-color: #2a85a0;
317
- }
318
-
319
- .wcv-btn-info:active, .wcv-btn-info.active {
320
- background-color: #24748c \9;
321
- }
322
-
323
- .wcv-btn-inverse {
324
- color: #ffffff;
325
- text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25);
326
- background-color: #363636;
327
- background-image: -moz-linear-gradient(top, #444444, #222222);
328
- background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#444444), to(#222222));
329
- background-image: -webkit-linear-gradient(top, #444444, #222222);
330
- background-image: -o-linear-gradient(top, #444444, #222222);
331
- background-image: linear-gradient(to bottom, #444444, #222222);
332
- background-repeat: repeat-x;
333
- filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff444444', endColorstr='#ff222222', GradientType=0);
334
- border-color: #222222 #222222 #000000;
335
- border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);
336
- *background-color: #222222;
337
- filter: progid:DXImageTransform.Microsoft.gradient(enabled=false);
338
- }
339
-
340
- .wcv-btn-inverse:hover, .wcv-btn-inverse:active, .wcv-btn-inverse.active, .wcv-btn-inverse.disabled, .wcv-btn-inverse[disabled] {
341
- color: #ffffff;
342
- background-color: #222222;
343
- *background-color: #151515;
344
- }
345
-
346
- .wcv-btn-inverse:active, .wcv-btn-inverse.active {
347
- background-color: #080808 \9;
348
- }
349
-
350
- button.wcv-btn, input[type="submit"].wcv-btn {
351
- *padding-top: 3px;
352
- *padding-bottom: 3px;
353
- }
354
-
355
- button.wcv-btn::-moz-focus-inner, input[type="submit"].wcv-btn::-moz-focus-inner {
356
- padding: 0;
357
- border: 0;
358
- }
359
-
360
- button.wcv-btn.wcv-btn-large, input[type="submit"].wcv-btn.wcv-btn-large {
361
- *padding-top: 7px;
362
- *padding-bottom: 7px;
363
- }
364
-
365
- button.wcv-btn.wcv-btn-small, input[type="submit"].wcv-btn.wcv-btn-small {
366
- *padding-top: 3px;
367
- *padding-bottom: 3px;
368
- }
369
-
370
- button.wcv-btn.wcv-btn-mini, input[type="submit"].wcv-btn.wcv-btn-mini {
371
- *padding-top: 1px;
372
- *padding-bottom: 1px;
373
- }
374
-
375
- .wcv-btn-link, .wcv-btn-link:active, .wcv-btn-link[disabled] {
376
- background-color: transparent;
377
- background-image: none;
378
- -webkit-box-shadow: none;
379
- -moz-box-shadow: none;
380
- box-shadow: none;
381
- }
382
-
383
- .wcv-btn-link {
384
- border-color: transparent;
385
- cursor: pointer;
386
- color: #0088cc;
387
- -webkit-border-radius: 0;
388
- -moz-border-radius: 0;
389
- border-radius: 0;
390
- }
391
-
392
- .wcv-btn-link:hover {
393
- color: #005580;
394
- text-decoration: underline;
395
- background-color: transparent;
396
- }
397
-
398
- .wcv-btn-link[disabled]:hover {
399
- color: #333333;
400
- text-decoration: none;
401
- }
402
-
403
- table {
404
- max-width: 100%;
405
- background-color: transparent;
406
- border-collapse: collapse;
407
- border-spacing: 0;
408
- }
409
-
410
- .table {
411
- width: 100%;
412
- margin-bottom: 20px;
413
- }
414
-
415
- .table th, .table td {
416
- padding: 8px;
417
- line-height: 20px;
418
- text-align: left;
419
- vertical-align: top;
420
- border-top: 1px solid #dddddd;
421
- }
422
-
423
- .table th {
424
- font-weight: bold;
425
- }
426
-
427
- .table thead th {
428
- vertical-align: bottom;
429
- }
430
-
431
- .table caption + thead tr:first-child th, .table caption + thead tr:first-child td, .table colgroup + thead tr:first-child th, .table colgroup + thead tr:first-child td, .table thead:first-child tr:first-child th, .table thead:first-child tr:first-child td {
432
- border-top: 0;
433
- }
434
-
435
- .table tbody + tbody {
436
- border-top: 2px solid #dddddd;
437
- }
438
-
439
- .table-condensed th, .table-condensed td {
440
- padding: 4px 5px;
441
- }
442
-
443
- .table-bordered {
444
- border: 1px solid #dddddd;
445
- border-collapse: separate;
446
- *border-collapse: collapse;
447
- border-left: 0;
448
- -webkit-border-radius: 4px;
449
- -moz-border-radius: 4px;
450
- border-radius: 4px;
451
- }
452
-
453
- .table-bordered th, .table-bordered td {
454
- border-left: 1px solid #dddddd;
455
- }
456
-
457
- .table-bordered caption + thead tr:first-child th, .table-bordered caption + tbody tr:first-child th, .table-bordered caption + tbody tr:first-child td, .table-bordered colgroup + thead tr:first-child th, .table-bordered colgroup + tbody tr:first-child th, .table-bordered colgroup + tbody tr:first-child td, .table-bordered thead:first-child tr:first-child th, .table-bordered tbody:first-child tr:first-child th, .table-bordered tbody:first-child tr:first-child td {
458
- border-top: 0;
459
- }
460
-
461
- .table-bordered thead:first-child tr:first-child th:first-child, .table-bordered tbody:first-child tr:first-child td:first-child {
462
- -webkit-border-top-left-radius: 4px;
463
- border-top-left-radius: 4px;
464
- -moz-border-radius-topleft: 4px;
465
- }
466
-
467
- .table-bordered thead:first-child tr:first-child th:last-child, .table-bordered tbody:first-child tr:first-child td:last-child {
468
- -webkit-border-top-right-radius: 4px;
469
- border-top-right-radius: 4px;
470
- -moz-border-radius-topright: 4px;
471
- }
472
-
473
- .table-bordered thead:last-child tr:last-child th:first-child, .table-bordered tbody:last-child tr:last-child td:first-child, .table-bordered tfoot:last-child tr:last-child td:first-child {
474
- -webkit-border-radius: 0 0 0 4px;
475
- -moz-border-radius: 0 0 0 4px;
476
- border-radius: 0 0 0 4px;
477
- -webkit-border-bottom-left-radius: 4px;
478
- border-bottom-left-radius: 4px;
479
- -moz-border-radius-bottomleft: 4px;
480
- }
481
-
482
- .table-bordered thead:last-child tr:last-child th:last-child, .table-bordered tbody:last-child tr:last-child td:last-child, .table-bordered tfoot:last-child tr:last-child td:last-child {
483
- -webkit-border-bottom-right-radius: 4px;
484
- border-bottom-right-radius: 4px;
485
- -moz-border-radius-bottomright: 4px;
486
- }
487
-
488
- .table-bordered caption + thead tr:first-child th:first-child, .table-bordered caption + tbody tr:first-child td:first-child, .table-bordered colgroup + thead tr:first-child th:first-child, .table-bordered colgroup + tbody tr:first-child td:first-child {
489
- -webkit-border-top-left-radius: 4px;
490
- border-top-left-radius: 4px;
491
- -moz-border-radius-topleft: 4px;
492
- }
493
-
494
- .table-bordered caption + thead tr:first-child th:last-child, .table-bordered caption + tbody tr:first-child td:last-child, .table-bordered colgroup + thead tr:first-child th:last-child, .table-bordered colgroup + tbody tr:first-child td:last-child {
495
- -webkit-border-top-right-radius: 4px;
496
- border-top-right-radius: 4px;
497
- -moz-border-radius-topleft: 4px;
498
- }
499
-
500
- .table-striped tbody tr:nth-child(odd) td, .table-striped tbody tr:nth-child(odd) th {
501
- background-color: #f9f9f9;
502
- }
503
-
504
- .table-hover tbody tr:hover td, .table-hover tbody tr:hover th {
505
- background-color: #f5f5f5;
506
- }
507
-
508
- table [class*=span], .row-fluid table [class*=span] {
509
- display: table-cell;
510
- float: none;
511
- margin-left: 0;
512
- }
513
-
514
- .table tbody tr.success td {
515
- background-color: #dff0d8;
516
- }
517
-
518
- .table tbody tr.error td {
519
- background-color: #f2dede;
520
- }
521
-
522
- .table tbody tr.warning td {
523
- background-color: #fcf8e3;
524
- }
525
-
526
- .table tbody tr.info td {
527
- background-color: #d9edf7;
528
- }
529
-
530
- .table-hover tbody tr.success:hover td {
531
- background-color: #d0e9c6;
532
- }
533
-
534
- .table-hover tbody tr.error:hover td {
535
- background-color: #ebcccc;
536
- }
537
-
538
- .table-hover tbody tr.warning:hover td {
539
- background-color: #faf2cc;
540
- }
541
-
542
- .table-hover tbody tr.info:hover td {
543
- background-color: #c4e3f3;
544
- }
545
- .hidden { display: none; }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/assets/images/icons/truck.png DELETED
Binary file
trunk/assets/js/front-orders.js DELETED
@@ -1,8 +0,0 @@
1
- jQuery(function () {
2
- jQuery('div.order-comments, div.order-tracking').hide();
3
-
4
- jQuery('a.order-comments-link, a.order-tracking-link').on('click', function (e) {
5
- e.preventDefault();
6
- jQuery(this).next('div').slideToggle();
7
- });
8
- });
 
 
 
 
 
 
 
 
trunk/assets/js/select2.min.js DELETED
@@ -1,3 +0,0 @@
1
- /*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */!function(a){"function"==typeof define&&define.amd?define(["jquery"],a):a("object"==typeof exports?require("jquery"):jQuery)}(function(a){var b=function(){if(a&&a.fn&&a.fn.select2&&a.fn.select2.amd)var b=a.fn.select2.amd;var b;return function(){if(!b||!b.requirejs){b?c=b:b={};var a,c,d;!function(b){function e(a,b){return u.call(a,b)}function f(a,b){var c,d,e,f,g,h,i,j,k,l,m,n=b&&b.split("/"),o=s.map,p=o&&o["*"]||{};if(a&&"."===a.charAt(0))if(b){for(a=a.split("/"),g=a.length-1,s.nodeIdCompat&&w.test(a[g])&&(a[g]=a[g].replace(w,"")),a=n.slice(0,n.length-1).concat(a),k=0;k<a.length;k+=1)if(m=a[k],"."===m)a.splice(k,1),k-=1;else if(".."===m){if(1===k&&(".."===a[2]||".."===a[0]))break;k>0&&(a.splice(k-1,2),k-=2)}a=a.join("/")}else 0===a.indexOf("./")&&(a=a.substring(2));if((n||p)&&o){for(c=a.split("/"),k=c.length;k>0;k-=1){if(d=c.slice(0,k).join("/"),n)for(l=n.length;l>0;l-=1)if(e=o[n.slice(0,l).join("/")],e&&(e=e[d])){f=e,h=k;break}if(f)break;!i&&p&&p[d]&&(i=p[d],j=k)}!f&&i&&(f=i,h=j),f&&(c.splice(0,h,f),a=c.join("/"))}return a}function g(a,c){return function(){var d=v.call(arguments,0);return"string"!=typeof d[0]&&1===d.length&&d.push(null),n.apply(b,d.concat([a,c]))}}function h(a){return function(b){return f(b,a)}}function i(a){return function(b){q[a]=b}}function j(a){if(e(r,a)){var c=r[a];delete r[a],t[a]=!0,m.apply(b,c)}if(!e(q,a)&&!e(t,a))throw new Error("No "+a);return q[a]}function k(a){var b,c=a?a.indexOf("!"):-1;return c>-1&&(b=a.substring(0,c),a=a.substring(c+1,a.length)),[b,a]}function l(a){return function(){return s&&s.config&&s.config[a]||{}}}var m,n,o,p,q={},r={},s={},t={},u=Object.prototype.hasOwnProperty,v=[].slice,w=/\.js$/;o=function(a,b){var c,d=k(a),e=d[0];return a=d[1],e&&(e=f(e,b),c=j(e)),e?a=c&&c.normalize?c.normalize(a,h(b)):f(a,b):(a=f(a,b),d=k(a),e=d[0],a=d[1],e&&(c=j(e))),{f:e?e+"!"+a:a,n:a,pr:e,p:c}},p={require:function(a){return g(a)},exports:function(a){var b=q[a];return"undefined"!=typeof b?b:q[a]={}},module:function(a){return{id:a,uri:"",exports:q[a],config:l(a)}}},m=function(a,c,d,f){var h,k,l,m,n,s,u=[],v=typeof d;if(f=f||a,"undefined"===v||"function"===v){for(c=!c.length&&d.length?["require","exports","module"]:c,n=0;n<c.length;n+=1)if(m=o(c[n],f),k=m.f,"require"===k)u[n]=p.require(a);else if("exports"===k)u[n]=p.exports(a),s=!0;else if("module"===k)h=u[n]=p.module(a);else if(e(q,k)||e(r,k)||e(t,k))u[n]=j(k);else{if(!m.p)throw new Error(a+" missing "+k);m.p.load(m.n,g(f,!0),i(k),{}),u[n]=q[k]}l=d?d.apply(q[a],u):void 0,a&&(h&&h.exports!==b&&h.exports!==q[a]?q[a]=h.exports:l===b&&s||(q[a]=l))}else a&&(q[a]=d)},a=c=n=function(a,c,d,e,f){if("string"==typeof a)return p[a]?p[a](c):j(o(a,c).f);if(!a.splice){if(s=a,s.deps&&n(s.deps,s.callback),!c)return;c.splice?(a=c,c=d,d=null):a=b}return c=c||function(){},"function"==typeof d&&(d=e,e=f),e?m(b,a,c,d):setTimeout(function(){m(b,a,c,d)},4),n},n.config=function(a){return n(a)},a._defined=q,d=function(a,b,c){if("string"!=typeof a)throw new Error("See almond README: incorrect module build, no module name");b.splice||(c=b,b=[]),e(q,a)||e(r,a)||(r[a]=[a,b,c])},d.amd={jQuery:!0}}(),b.requirejs=a,b.require=c,b.define=d}}(),b.define("almond",function(){}),b.define("jquery",[],function(){var b=a||$;return null==b&&console&&console.error&&console.error("Select2: An instance of jQuery or a jQuery-compatible library was not found. Make sure that you are including jQuery before Select2 on your web page."),b}),b.define("select2/utils",["jquery"],function(a){function b(a){var b=a.prototype,c=[];for(var d in b){var e=b[d];"function"==typeof e&&"constructor"!==d&&c.push(d)}return c}var c={};c.Extend=function(a,b){function c(){this.constructor=a}var d={}.hasOwnProperty;for(var e in b)d.call(b,e)&&(a[e]=b[e]);return c.prototype=b.prototype,a.prototype=new c,a.__super__=b.prototype,a},c.Decorate=function(a,c){function d(){var b=Array.prototype.unshift,d=c.prototype.constructor.length,e=a.prototype.constructor;d>0&&(b.call(arguments,a.prototype.constructor),e=c.prototype.constructor),e.apply(this,arguments)}function e(){this.constructor=d}var f=b(c),g=b(a);c.displayName=a.displayName,d.prototype=new e;for(var h=0;h<g.length;h++){var i=g[h];d.prototype[i]=a.prototype[i]}for(var j=(function(a){var b=function(){};a in d.prototype&&(b=d.prototype[a]);var e=c.prototype[a];return function(){var a=Array.prototype.unshift;return a.call(arguments,b),e.apply(this,arguments)}}),k=0;k<f.length;k++){var l=f[k];d.prototype[l]=j(l)}return d};var d=function(){this.listeners={}};return d.prototype.on=function(a,b){this.listeners=this.listeners||{},a in this.listeners?this.listeners[a].push(b):this.listeners[a]=[b]},d.prototype.trigger=function(a){var b=Array.prototype.slice,c=b.call(arguments,1);this.listeners=this.listeners||{},null==c&&(c=[]),0===c.length&&c.push({}),c[0]._type=a,a in this.listeners&&this.invoke(this.listeners[a],b.call(arguments,1)),"*"in this.listeners&&this.invoke(this.listeners["*"],arguments)},d.prototype.invoke=function(a,b){for(var c=0,d=a.length;d>c;c++)a[c].apply(this,b)},c.Observable=d,c.generateChars=function(a){for(var b="",c=0;a>c;c++){var d=Math.floor(36*Math.random());b+=d.toString(36)}return b},c.bind=function(a,b){return function(){a.apply(b,arguments)}},c._convertData=function(a){for(var b in a){var c=b.split("-"),d=a;if(1!==c.length){for(var e=0;e<c.length;e++){var f=c[e];f=f.substring(0,1).toLowerCase()+f.substring(1),f in d||(d[f]={}),e==c.length-1&&(d[f]=a[b]),d=d[f]}delete a[b]}}return a},c.hasScroll=function(b,c){var d=a(c),e=c.style.overflowX,f=c.style.overflowY;return e!==f||"hidden"!==f&&"visible"!==f?"scroll"===e||"scroll"===f?!0:d.innerHeight()<c.scrollHeight||d.innerWidth()<c.scrollWidth:!1},c.escapeMarkup=function(a){var b={"\\":"&#92;","&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#47;"};return"string"!=typeof a?a:String(a).replace(/[&<>"'\/\\]/g,function(a){return b[a]})},c.appendMany=function(b,c){if("1.7"===a.fn.jquery.substr(0,3)){var d=a();a.map(c,function(a){d=d.add(a)}),c=d}b.append(c)},c}),b.define("select2/results",["jquery","./utils"],function(a,b){function c(a,b,d){this.$element=a,this.data=d,this.options=b,c.__super__.constructor.call(this)}return b.Extend(c,b.Observable),c.prototype.render=function(){var b=a('<ul class="select2-results__options" role="tree"></ul>');return this.options.get("multiple")&&b.attr("aria-multiselectable","true"),this.$results=b,b},c.prototype.clear=function(){this.$results.empty()},c.prototype.displayMessage=function(b){var c=this.options.get("escapeMarkup");this.clear(),this.hideLoading();var d=a('<li role="treeitem" aria-live="assertive" class="select2-results__option"></li>'),e=this.options.get("translations").get(b.message);d.append(c(e(b.args))),d[0].className+=" select2-results__message",this.$results.append(d)},c.prototype.hideMessages=function(){this.$results.find(".select2-results__message").remove()},c.prototype.append=function(a){this.hideLoading();var b=[];if(null==a.results||0===a.results.length)return void(0===this.$results.children().length&&this.trigger("results:message",{message:"noResults"}));a.results=this.sort(a.results);for(var c=0;c<a.results.length;c++){var d=a.results[c],e=this.option(d);b.push(e)}this.$results.append(b)},c.prototype.position=function(a,b){var c=b.find(".select2-results");c.append(a)},c.prototype.sort=function(a){var b=this.options.get("sorter");return b(a)},c.prototype.highlightFirstItem=function(){var a=this.$results.find(".select2-results__option[aria-selected]"),b=a.filter("[aria-selected=true]");b.length>0?b.first().trigger("mouseenter"):a.first().trigger("mouseenter"),this.ensureHighlightVisible()},c.prototype.setClasses=function(){var b=this;this.data.current(function(c){var d=a.map(c,function(a){return a.id.toString()}),e=b.$results.find(".select2-results__option[aria-selected]");e.each(function(){var b=a(this),c=a.data(this,"data"),e=""+c.id;null!=c.element&&c.element.selected||null==c.element&&a.inArray(e,d)>-1?b.attr("aria-selected","true"):b.attr("aria-selected","false")})})},c.prototype.showLoading=function(a){this.hideLoading();var b=this.options.get("translations").get("searching"),c={disabled:!0,loading:!0,text:b(a)},d=this.option(c);d.className+=" loading-results",this.$results.prepend(d)},c.prototype.hideLoading=function(){this.$results.find(".loading-results").remove()},c.prototype.option=function(b){var c=document.createElement("li");c.className="select2-results__option";var d={role:"treeitem","aria-selected":"false"};b.disabled&&(delete d["aria-selected"],d["aria-disabled"]="true"),null==b.id&&delete d["aria-selected"],null!=b._resultId&&(c.id=b._resultId),b.title&&(c.title=b.title),b.children&&(d.role="group",d["aria-label"]=b.text,delete d["aria-selected"]);for(var e in d){var f=d[e];c.setAttribute(e,f)}if(b.children){var g=a(c),h=document.createElement("strong");h.className="select2-results__group";a(h);this.template(b,h);for(var i=[],j=0;j<b.children.length;j++){var k=b.children[j],l=this.option(k);i.push(l)}var m=a("<ul></ul>",{"class":"select2-results__options select2-results__options--nested"});m.append(i),g.append(h),g.append(m)}else this.template(b,c);return a.data(c,"data",b),c},c.prototype.bind=function(b,c){var d=this,e=b.id+"-results";this.$results.attr("id",e),b.on("results:all",function(a){d.clear(),d.append(a.data),b.isOpen()&&(d.setClasses(),d.highlightFirstItem())}),b.on("results:append",function(a){d.append(a.data),b.isOpen()&&d.setClasses()}),b.on("query",function(a){d.hideMessages(),d.showLoading(a)}),b.on("select",function(){b.isOpen()&&(d.setClasses(),d.highlightFirstItem())}),b.on("unselect",function(){b.isOpen()&&(d.setClasses(),d.highlightFirstItem())}),b.on("open",function(){d.$results.attr("aria-expanded","true"),d.$results.attr("aria-hidden","false"),d.setClasses(),d.ensureHighlightVisible()}),b.on("close",function(){d.$results.attr("aria-expanded","false"),d.$results.attr("aria-hidden","true"),d.$results.removeAttr("aria-activedescendant")}),b.on("results:toggle",function(){var a=d.getHighlightedResults();0!==a.length&&a.trigger("mouseup")}),b.on("results:select",function(){var a=d.getHighlightedResults();if(0!==a.length){var b=a.data("data");"true"==a.attr("aria-selected")?d.trigger("close",{}):d.trigger("select",{data:b})}}),b.on("results:previous",function(){var a=d.getHighlightedResults(),b=d.$results.find("[aria-selected]"),c=b.index(a);if(0!==c){var e=c-1;0===a.length&&(e=0);var f=b.eq(e);f.trigger("mouseenter");var g=d.$results.offset().top,h=f.offset().top,i=d.$results.scrollTop()+(h-g);0===e?d.$results.scrollTop(0):0>h-g&&d.$results.scrollTop(i)}}),b.on("results:next",function(){var a=d.getHighlightedResults(),b=d.$results.find("[aria-selected]"),c=b.index(a),e=c+1;if(!(e>=b.length)){var f=b.eq(e);f.trigger("mouseenter");var g=d.$results.offset().top+d.$results.outerHeight(!1),h=f.offset().top+f.outerHeight(!1),i=d.$results.scrollTop()+h-g;0===e?d.$results.scrollTop(0):h>g&&d.$results.scrollTop(i)}}),b.on("results:focus",function(a){a.element.addClass("select2-results__option--highlighted")}),b.on("results:message",function(a){d.displayMessage(a)}),a.fn.mousewheel&&this.$results.on("mousewheel",function(a){var b=d.$results.scrollTop(),c=d.$results.get(0).scrollHeight-b+a.deltaY,e=a.deltaY>0&&b-a.deltaY<=0,f=a.deltaY<0&&c<=d.$results.height();e?(d.$results.scrollTop(0),a.preventDefault(),a.stopPropagation()):f&&(d.$results.scrollTop(d.$results.get(0).scrollHeight-d.$results.height()),a.preventDefault(),a.stopPropagation())}),this.$results.on("mouseup",".select2-results__option[aria-selected]",function(b){var c=a(this),e=c.data("data");return"true"===c.attr("aria-selected")?void(d.options.get("multiple")?d.trigger("unselect",{originalEvent:b,data:e}):d.trigger("close",{})):void d.trigger("select",{originalEvent:b,data:e})}),this.$results.on("mouseenter",".select2-results__option[aria-selected]",function(b){var c=a(this).data("data");d.getHighlightedResults().removeClass("select2-results__option--highlighted"),d.trigger("results:focus",{data:c,element:a(this)})})},c.prototype.getHighlightedResults=function(){var a=this.$results.find(".select2-results__option--highlighted");return a},c.prototype.destroy=function(){this.$results.remove()},c.prototype.ensureHighlightVisible=function(){var a=this.getHighlightedResults();if(0!==a.length){var b=this.$results.find("[aria-selected]"),c=b.index(a),d=this.$results.offset().top,e=a.offset().top,f=this.$results.scrollTop()+(e-d),g=e-d;f-=2*a.outerHeight(!1),2>=c?this.$results.scrollTop(0):(g>this.$results.outerHeight()||0>g)&&this.$results.scrollTop(f)}},c.prototype.template=function(b,c){var d=this.options.get("templateResult"),e=this.options.get("escapeMarkup"),f=d(b,c);null==f?c.style.display="none":"string"==typeof f?c.innerHTML=e(f):a(c).append(f)},c}),b.define("select2/keys",[],function(){var a={BACKSPACE:8,TAB:9,ENTER:13,SHIFT:16,CTRL:17,ALT:18,ESC:27,SPACE:32,PAGE_UP:33,PAGE_DOWN:34,END:35,HOME:36,LEFT:37,UP:38,RIGHT:39,DOWN:40,DELETE:46};return a}),b.define("select2/selection/base",["jquery","../utils","../keys"],function(a,b,c){function d(a,b){this.$element=a,this.options=b,d.__super__.constructor.call(this)}return b.Extend(d,b.Observable),d.prototype.render=function(){var b=a('<span class="select2-selection" role="combobox" aria-haspopup="true" aria-expanded="false"></span>');return this._tabindex=0,null!=this.$element.data("old-tabindex")?this._tabindex=this.$element.data("old-tabindex"):null!=this.$element.attr("tabindex")&&(this._tabindex=this.$element.attr("tabindex")),b.attr("title",this.$element.attr("title")),b.attr("tabindex",this._tabindex),this.$selection=b,b},d.prototype.bind=function(a,b){var d=this,e=(a.id+"-container",a.id+"-results");this.container=a,this.$selection.on("focus",function(a){d.trigger("focus",a)}),this.$selection.on("blur",function(a){d._handleBlur(a)}),this.$selection.on("keydown",function(a){d.trigger("keypress",a),a.which===c.SPACE&&a.preventDefault()}),a.on("results:focus",function(a){d.$selection.attr("aria-activedescendant",a.data._resultId)}),a.on("selection:update",function(a){d.update(a.data)}),a.on("open",function(){d.$selection.attr("aria-expanded","true"),d.$selection.attr("aria-owns",e),d._attachCloseHandler(a)}),a.on("close",function(){d.$selection.attr("aria-expanded","false"),d.$selection.removeAttr("aria-activedescendant"),d.$selection.removeAttr("aria-owns"),d.$selection.focus(),d._detachCloseHandler(a)}),a.on("enable",function(){d.$selection.attr("tabindex",d._tabindex)}),a.on("disable",function(){d.$selection.attr("tabindex","-1")})},d.prototype._handleBlur=function(b){var c=this;window.setTimeout(function(){document.activeElement==c.$selection[0]||a.contains(c.$selection[0],document.activeElement)||c.trigger("blur",b)},1)},d.prototype._attachCloseHandler=function(b){a(document.body).on("mousedown.select2."+b.id,function(b){var c=a(b.target),d=c.closest(".select2"),e=a(".select2.select2-container--open");e.each(function(){var b=a(this);if(this!=d[0]){var c=b.data("element");c.select2("close")}})})},d.prototype._detachCloseHandler=function(b){a(document.body).off("mousedown.select2."+b.id)},d.prototype.position=function(a,b){var c=b.find(".selection");c.append(a)},d.prototype.destroy=function(){this._detachCloseHandler(this.container)},d.prototype.update=function(a){throw new Error("The `update` method must be defined in child classes.")},d}),b.define("select2/selection/single",["jquery","./base","../utils","../keys"],function(a,b,c,d){function e(){e.__super__.constructor.apply(this,arguments)}return c.Extend(e,b),e.prototype.render=function(){var a=e.__super__.render.call(this);return a.addClass("select2-selection--single"),a.html('<span class="select2-selection__rendered"></span><span class="select2-selection__arrow" role="presentation"><b role="presentation"></b></span>'),a},e.prototype.bind=function(a,b){var c=this;e.__super__.bind.apply(this,arguments);var d=a.id+"-container";this.$selection.find(".select2-selection__rendered").attr("id",d),this.$selection.attr("aria-labelledby",d),this.$selection.on("mousedown",function(a){1===a.which&&c.trigger("toggle",{originalEvent:a})}),this.$selection.on("focus",function(a){}),this.$selection.on("blur",function(a){}),a.on("focus",function(b){a.isOpen()||c.$selection.focus()}),a.on("selection:update",function(a){c.update(a.data)})},e.prototype.clear=function(){this.$selection.find(".select2-selection__rendered").empty()},e.prototype.display=function(a,b){var c=this.options.get("templateSelection"),d=this.options.get("escapeMarkup");return d(c(a,b))},e.prototype.selectionContainer=function(){return a("<span></span>")},e.prototype.update=function(a){if(0===a.length)return void this.clear();var b=a[0],c=this.$selection.find(".select2-selection__rendered"),d=this.display(b,c);c.empty().append(d),c.prop("title",b.title||b.text)},e}),b.define("select2/selection/multiple",["jquery","./base","../utils"],function(a,b,c){function d(a,b){d.__super__.constructor.apply(this,arguments)}return c.Extend(d,b),d.prototype.render=function(){var a=d.__super__.render.call(this);return a.addClass("select2-selection--multiple"),a.html('<ul class="select2-selection__rendered"></ul>'),a},d.prototype.bind=function(b,c){var e=this;d.__super__.bind.apply(this,arguments),this.$selection.on("click",function(a){e.trigger("toggle",{originalEvent:a})}),this.$selection.on("click",".select2-selection__choice__remove",function(b){if(!e.options.get("disabled")){var c=a(this),d=c.parent(),f=d.data("data");e.trigger("unselect",{originalEvent:b,data:f})}})},d.prototype.clear=function(){this.$selection.find(".select2-selection__rendered").empty()},d.prototype.display=function(a,b){var c=this.options.get("templateSelection"),d=this.options.get("escapeMarkup");return d(c(a,b))},d.prototype.selectionContainer=function(){var b=a('<li class="select2-selection__choice"><span class="select2-selection__choice__remove" role="presentation">&times;</span></li>');return b},d.prototype.update=function(a){if(this.clear(),0!==a.length){for(var b=[],d=0;d<a.length;d++){var e=a[d],f=this.selectionContainer(),g=this.display(e,f);f.append(g),f.prop("title",e.title||e.text),f.data("data",e),b.push(f)}var h=this.$selection.find(".select2-selection__rendered");c.appendMany(h,b)}},d}),b.define("select2/selection/placeholder",["../utils"],function(a){function b(a,b,c){this.placeholder=this.normalizePlaceholder(c.get("placeholder")),a.call(this,b,c)}return b.prototype.normalizePlaceholder=function(a,b){return"string"==typeof b&&(b={id:"",text:b}),b},b.prototype.createPlaceholder=function(a,b){var c=this.selectionContainer();return c.html(this.display(b)),c.addClass("select2-selection__placeholder").removeClass("select2-selection__choice"),c},b.prototype.update=function(a,b){var c=1==b.length&&b[0].id!=this.placeholder.id,d=b.length>1;if(d||c)return a.call(this,b);this.clear();var e=this.createPlaceholder(this.placeholder);this.$selection.find(".select2-selection__rendered").append(e)},b}),b.define("select2/selection/allowClear",["jquery","../keys"],function(a,b){function c(){}return c.prototype.bind=function(a,b,c){var d=this;a.call(this,b,c),null==this.placeholder&&this.options.get("debug")&&window.console&&console.error&&console.error("Select2: The `allowClear` option should be used in combination with the `placeholder` option."),this.$selection.on("mousedown",".select2-selection__clear",function(a){d._handleClear(a)}),b.on("keypress",function(a){d._handleKeyboardClear(a,b)})},c.prototype._handleClear=function(a,b){if(!this.options.get("disabled")){var c=this.$selection.find(".select2-selection__clear");if(0!==c.length){b.stopPropagation();for(var d=c.data("data"),e=0;e<d.length;e++){var f={data:d[e]};if(this.trigger("unselect",f),f.prevented)return}this.$element.val(this.placeholder.id).trigger("change"),this.trigger("toggle",{})}}},c.prototype._handleKeyboardClear=function(a,c,d){d.isOpen()||(c.which==b.DELETE||c.which==b.BACKSPACE)&&this._handleClear(c)},c.prototype.update=function(b,c){if(b.call(this,c),!(this.$selection.find(".select2-selection__placeholder").length>0||0===c.length)){var d=a('<span class="select2-selection__clear">&times;</span>');d.data("data",c),this.$selection.find(".select2-selection__rendered").prepend(d)}},c}),b.define("select2/selection/search",["jquery","../utils","../keys"],function(a,b,c){function d(a,b,c){a.call(this,b,c)}return d.prototype.render=function(b){var c=a('<li class="select2-search select2-search--inline"><input class="select2-search__field" type="search" tabindex="-1" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" role="textbox" aria-autocomplete="list" /></li>');this.$searchContainer=c,this.$search=c.find("input");var d=b.call(this);return this._transferTabIndex(),d},d.prototype.bind=function(a,b,d){var e=this;a.call(this,b,d),b.on("open",function(){e.$search.trigger("focus")}),b.on("close",function(){e.$search.val(""),e.$search.removeAttr("aria-activedescendant"),e.$search.trigger("focus")}),b.on("enable",function(){e.$search.prop("disabled",!1),e._transferTabIndex()}),b.on("disable",function(){e.$search.prop("disabled",!0)}),b.on("focus",function(a){e.$search.trigger("focus")}),b.on("results:focus",function(a){e.$search.attr("aria-activedescendant",a.id)}),this.$selection.on("focusin",".select2-search--inline",function(a){e.trigger("focus",a)}),this.$selection.on("focusout",".select2-search--inline",function(a){e._handleBlur(a)}),this.$selection.on("keydown",".select2-search--inline",function(a){a.stopPropagation(),e.trigger("keypress",a),e._keyUpPrevented=a.isDefaultPrevented();var b=a.which;if(b===c.BACKSPACE&&""===e.$search.val()){var d=e.$searchContainer.prev(".select2-selection__choice");if(d.length>0){var f=d.data("data");e.searchRemoveChoice(f),a.preventDefault()}}});var f=document.documentMode,g=f&&11>=f;this.$selection.on("input.searchcheck",".select2-search--inline",function(a){return g?void e.$selection.off("input.search input.searchcheck"):void e.$selection.off("keyup.search")}),this.$selection.on("keyup.search input.search",".select2-search--inline",function(a){if(g&&"input"===a.type)return void e.$selection.off("input.search input.searchcheck");var b=a.which;b!=c.SHIFT&&b!=c.CTRL&&b!=c.ALT&&b!=c.TAB&&e.handleSearch(a)})},d.prototype._transferTabIndex=function(a){this.$search.attr("tabindex",this.$selection.attr("tabindex")),this.$selection.attr("tabindex","-1")},d.prototype.createPlaceholder=function(a,b){this.$search.attr("placeholder",b.text)},d.prototype.update=function(a,b){var c=this.$search[0]==document.activeElement;this.$search.attr("placeholder",""),a.call(this,b),this.$selection.find(".select2-selection__rendered").append(this.$searchContainer),this.resizeSearch(),c&&this.$search.focus()},d.prototype.handleSearch=function(){if(this.resizeSearch(),!this._keyUpPrevented){var a=this.$search.val();this.trigger("query",{term:a})}this._keyUpPrevented=!1},d.prototype.searchRemoveChoice=function(a,b){this.trigger("unselect",{data:b}),this.$search.val(b.text),this.handleSearch()},d.prototype.resizeSearch=function(){this.$search.css("width","25px");var a="";if(""!==this.$search.attr("placeholder"))a=this.$selection.find(".select2-selection__rendered").innerWidth();else{var b=this.$search.val().length+1;a=.75*b+"em"}this.$search.css("width",a)},d}),b.define("select2/selection/eventRelay",["jquery"],function(a){function b(){}return b.prototype.bind=function(b,c,d){var e=this,f=["open","opening","close","closing","select","selecting","unselect","unselecting"],g=["opening","closing","selecting","unselecting"];b.call(this,c,d),c.on("*",function(b,c){if(-1!==a.inArray(b,f)){c=c||{};var d=a.Event("select2:"+b,{params:c});e.$element.trigger(d),-1!==a.inArray(b,g)&&(c.prevented=d.isDefaultPrevented())}})},b}),b.define("select2/translation",["jquery","require"],function(a,b){function c(a){this.dict=a||{}}return c.prototype.all=function(){return this.dict},c.prototype.get=function(a){return this.dict[a]},c.prototype.extend=function(b){this.dict=a.extend({},b.all(),this.dict)},c._cache={},c.loadPath=function(a){if(!(a in c._cache)){var d=b(a);c._cache[a]=d}return new c(c._cache[a])},c}),b.define("select2/diacritics",[],function(){var a={"Ⓐ":"A","A":"A","À":"A","Á":"A","Â":"A","Ầ":"A","Ấ":"A","Ẫ":"A","Ẩ":"A","Ã":"A","Ā":"A","Ă":"A","Ằ":"A","Ắ":"A","Ẵ":"A","Ẳ":"A","Ȧ":"A","Ǡ":"A","Ä":"A","Ǟ":"A","Ả":"A","Å":"A","Ǻ":"A","Ǎ":"A","Ȁ":"A","Ȃ":"A","Ạ":"A","Ậ":"A","Ặ":"A","Ḁ":"A","Ą":"A","Ⱥ":"A","Ɐ":"A","Ꜳ":"AA","Æ":"AE","Ǽ":"AE","Ǣ":"AE","Ꜵ":"AO","Ꜷ":"AU","Ꜹ":"AV","Ꜻ":"AV","Ꜽ":"AY","Ⓑ":"B","B":"B","Ḃ":"B","Ḅ":"B","Ḇ":"B","Ƀ":"B","Ƃ":"B","Ɓ":"B","Ⓒ":"C","C":"C","Ć":"C","Ĉ":"C","Ċ":"C","Č":"C","Ç":"C","Ḉ":"C","Ƈ":"C","Ȼ":"C","Ꜿ":"C","Ⓓ":"D","D":"D","Ḋ":"D","Ď":"D","Ḍ":"D","Ḑ":"D","Ḓ":"D","Ḏ":"D","Đ":"D","Ƌ":"D","Ɗ":"D","Ɖ":"D","Ꝺ":"D","DZ":"DZ","DŽ":"DZ","Dz":"Dz","Dž":"Dz","Ⓔ":"E","E":"E","È":"E","É":"E","Ê":"E","Ề":"E","Ế":"E","Ễ":"E","Ể":"E","Ẽ":"E","Ē":"E","Ḕ":"E","Ḗ":"E","Ĕ":"E","Ė":"E","Ë":"E","Ẻ":"E","Ě":"E","Ȅ":"E","Ȇ":"E","Ẹ":"E","Ệ":"E","Ȩ":"E","Ḝ":"E","Ę":"E","Ḙ":"E","Ḛ":"E","Ɛ":"E","Ǝ":"E","Ⓕ":"F","F":"F","Ḟ":"F","Ƒ":"F","Ꝼ":"F","Ⓖ":"G","G":"G","Ǵ":"G","Ĝ":"G","Ḡ":"G","Ğ":"G","Ġ":"G","Ǧ":"G","Ģ":"G","Ǥ":"G","Ɠ":"G","Ꞡ":"G","Ᵹ":"G","Ꝿ":"G","Ⓗ":"H","H":"H","Ĥ":"H","Ḣ":"H","Ḧ":"H","Ȟ":"H","Ḥ":"H","Ḩ":"H","Ḫ":"H","Ħ":"H","Ⱨ":"H","Ⱶ":"H","Ɥ":"H","Ⓘ":"I","I":"I","Ì":"I","Í":"I","Î":"I","Ĩ":"I","Ī":"I","Ĭ":"I","İ":"I","Ï":"I","Ḯ":"I","Ỉ":"I","Ǐ":"I","Ȉ":"I","Ȋ":"I","Ị":"I","Į":"I","Ḭ":"I","Ɨ":"I","Ⓙ":"J","J":"J","Ĵ":"J","Ɉ":"J","Ⓚ":"K","K":"K","Ḱ":"K","Ǩ":"K","Ḳ":"K","Ķ":"K","Ḵ":"K","Ƙ":"K","Ⱪ":"K","Ꝁ":"K","Ꝃ":"K","Ꝅ":"K","Ꞣ":"K","Ⓛ":"L","L":"L","Ŀ":"L","Ĺ":"L","Ľ":"L","Ḷ":"L","Ḹ":"L","Ļ":"L","Ḽ":"L","Ḻ":"L","Ł":"L","Ƚ":"L","Ɫ":"L","Ⱡ":"L","Ꝉ":"L","Ꝇ":"L","Ꞁ":"L","LJ":"LJ","Lj":"Lj","Ⓜ":"M","M":"M","Ḿ":"M","Ṁ":"M","Ṃ":"M","Ɱ":"M","Ɯ":"M","Ⓝ":"N","N":"N","Ǹ":"N","Ń":"N","Ñ":"N","Ṅ":"N","Ň":"N","Ṇ":"N","Ņ":"N","Ṋ":"N","Ṉ":"N","Ƞ":"N","Ɲ":"N","Ꞑ":"N","Ꞥ":"N","NJ":"NJ","Nj":"Nj","Ⓞ":"O","O":"O","Ò":"O","Ó":"O","Ô":"O","Ồ":"O","Ố":"O","Ỗ":"O","Ổ":"O","Õ":"O","Ṍ":"O","Ȭ":"O","Ṏ":"O","Ō":"O","Ṑ":"O","Ṓ":"O","Ŏ":"O","Ȯ":"O","Ȱ":"O","Ö":"O","Ȫ":"O","Ỏ":"O","Ő":"O","Ǒ":"O","Ȍ":"O","Ȏ":"O","Ơ":"O","Ờ":"O","Ớ":"O","Ỡ":"O","Ở":"O","Ợ":"O","Ọ":"O","Ộ":"O","Ǫ":"O","Ǭ":"O","Ø":"O","Ǿ":"O","Ɔ":"O","Ɵ":"O","Ꝋ":"O","Ꝍ":"O","Ƣ":"OI","Ꝏ":"OO","Ȣ":"OU","Ⓟ":"P","P":"P","Ṕ":"P","Ṗ":"P","Ƥ":"P","Ᵽ":"P","Ꝑ":"P","Ꝓ":"P","Ꝕ":"P","Ⓠ":"Q","Q":"Q","Ꝗ":"Q","Ꝙ":"Q","Ɋ":"Q","Ⓡ":"R","R":"R","Ŕ":"R","Ṙ":"R","Ř":"R","Ȑ":"R","Ȓ":"R","Ṛ":"R","Ṝ":"R","Ŗ":"R","Ṟ":"R","Ɍ":"R","Ɽ":"R","Ꝛ":"R","Ꞧ":"R","Ꞃ":"R","Ⓢ":"S","S":"S","ẞ":"S","Ś":"S","Ṥ":"S","Ŝ":"S","Ṡ":"S","Š":"S","Ṧ":"S","Ṣ":"S","Ṩ":"S","Ș":"S","Ş":"S","Ȿ":"S","Ꞩ":"S","Ꞅ":"S","Ⓣ":"T","T":"T","Ṫ":"T","Ť":"T","Ṭ":"T","Ț":"T","Ţ":"T","Ṱ":"T","Ṯ":"T","Ŧ":"T","Ƭ":"T","Ʈ":"T","Ⱦ":"T","Ꞇ":"T","Ꜩ":"TZ","Ⓤ":"U","U":"U","Ù":"U","Ú":"U","Û":"U","Ũ":"U","Ṹ":"U","Ū":"U","Ṻ":"U","Ŭ":"U","Ü":"U","Ǜ":"U","Ǘ":"U","Ǖ":"U","Ǚ":"U","Ủ":"U","Ů":"U","Ű":"U","Ǔ":"U","Ȕ":"U","Ȗ":"U","Ư":"U","Ừ":"U","Ứ":"U","Ữ":"U","Ử":"U","Ự":"U","Ụ":"U","Ṳ":"U","Ų":"U","Ṷ":"U","Ṵ":"U","Ʉ":"U","Ⓥ":"V","V":"V","Ṽ":"V","Ṿ":"V","Ʋ":"V","Ꝟ":"V","Ʌ":"V","Ꝡ":"VY","Ⓦ":"W","W":"W","Ẁ":"W","Ẃ":"W","Ŵ":"W","Ẇ":"W","Ẅ":"W","Ẉ":"W","Ⱳ":"W","Ⓧ":"X","X":"X","Ẋ":"X","Ẍ":"X","Ⓨ":"Y","Y":"Y","Ỳ":"Y","Ý":"Y","Ŷ":"Y","Ỹ":"Y","Ȳ":"Y","Ẏ":"Y","Ÿ":"Y","Ỷ":"Y","Ỵ":"Y","Ƴ":"Y","Ɏ":"Y","Ỿ":"Y","Ⓩ":"Z","Z":"Z","Ź":"Z","Ẑ":"Z","Ż":"Z","Ž":"Z","Ẓ":"Z","Ẕ":"Z","Ƶ":"Z","Ȥ":"Z","Ɀ":"Z","Ⱬ":"Z","Ꝣ":"Z","ⓐ":"a","a":"a","ẚ":"a","à":"a","á":"a","â":"a","ầ":"a","ấ":"a","ẫ":"a","ẩ":"a","ã":"a","ā":"a","ă":"a","ằ":"a","ắ":"a","ẵ":"a","ẳ":"a","ȧ":"a","ǡ":"a","ä":"a","ǟ":"a","ả":"a","å":"a","ǻ":"a","ǎ":"a","ȁ":"a","ȃ":"a","ạ":"a","ậ":"a","ặ":"a","ḁ":"a","ą":"a","ⱥ":"a","ɐ":"a","ꜳ":"aa","æ":"ae","ǽ":"ae","ǣ":"ae","ꜵ":"ao","ꜷ":"au","ꜹ":"av","ꜻ":"av","ꜽ":"ay","ⓑ":"b","b":"b","ḃ":"b","ḅ":"b","ḇ":"b","ƀ":"b","ƃ":"b","ɓ":"b","ⓒ":"c","c":"c","ć":"c","ĉ":"c","ċ":"c","č":"c","ç":"c","ḉ":"c","ƈ":"c","ȼ":"c","ꜿ":"c","ↄ":"c","ⓓ":"d","d":"d","ḋ":"d","ď":"d","ḍ":"d","ḑ":"d","ḓ":"d","ḏ":"d","đ":"d","ƌ":"d","ɖ":"d","ɗ":"d","ꝺ":"d","dz":"dz","dž":"dz","ⓔ":"e","e":"e","è":"e","é":"e","ê":"e","ề":"e","ế":"e","ễ":"e","ể":"e","ẽ":"e","ē":"e","ḕ":"e","ḗ":"e","ĕ":"e","ė":"e","ë":"e","ẻ":"e","ě":"e","ȅ":"e","ȇ":"e","ẹ":"e","ệ":"e","ȩ":"e","ḝ":"e","ę":"e","ḙ":"e","ḛ":"e","ɇ":"e","ɛ":"e","ǝ":"e","ⓕ":"f","f":"f","ḟ":"f","ƒ":"f","ꝼ":"f","ⓖ":"g","g":"g","ǵ":"g","ĝ":"g","ḡ":"g","ğ":"g","ġ":"g","ǧ":"g","ģ":"g","ǥ":"g","ɠ":"g","ꞡ":"g","ᵹ":"g","ꝿ":"g","ⓗ":"h","h":"h","ĥ":"h","ḣ":"h","ḧ":"h","ȟ":"h","ḥ":"h","ḩ":"h","ḫ":"h","ẖ":"h","ħ":"h","ⱨ":"h","ⱶ":"h","ɥ":"h","ƕ":"hv","ⓘ":"i","i":"i","ì":"i","í":"i","î":"i","ĩ":"i","ī":"i","ĭ":"i","ï":"i","ḯ":"i","ỉ":"i","ǐ":"i","ȉ":"i","ȋ":"i","ị":"i","į":"i","ḭ":"i","ɨ":"i","ı":"i","ⓙ":"j","j":"j","ĵ":"j","ǰ":"j","ɉ":"j","ⓚ":"k","k":"k","ḱ":"k","ǩ":"k","ḳ":"k","ķ":"k","ḵ":"k","ƙ":"k","ⱪ":"k","ꝁ":"k","ꝃ":"k","ꝅ":"k","ꞣ":"k","ⓛ":"l","l":"l","ŀ":"l","ĺ":"l","ľ":"l","ḷ":"l","ḹ":"l","ļ":"l","ḽ":"l","ḻ":"l","ſ":"l","ł":"l","ƚ":"l","ɫ":"l","ⱡ":"l","ꝉ":"l","ꞁ":"l","ꝇ":"l","lj":"lj","ⓜ":"m","m":"m","ḿ":"m","ṁ":"m","ṃ":"m","ɱ":"m","ɯ":"m","ⓝ":"n","n":"n","ǹ":"n","ń":"n","ñ":"n","ṅ":"n","ň":"n","ṇ":"n","ņ":"n","ṋ":"n","ṉ":"n","ƞ":"n","ɲ":"n","ʼn":"n","ꞑ":"n","ꞥ":"n","nj":"nj","ⓞ":"o","o":"o","ò":"o","ó":"o","ô":"o","ồ":"o","ố":"o","ỗ":"o","ổ":"o","õ":"o","ṍ":"o","ȭ":"o","ṏ":"o","ō":"o","ṑ":"o","ṓ":"o","ŏ":"o","ȯ":"o","ȱ":"o","ö":"o","ȫ":"o","ỏ":"o","ő":"o","ǒ":"o","ȍ":"o","ȏ":"o","ơ":"o","ờ":"o","ớ":"o","ỡ":"o","ở":"o","ợ":"o","ọ":"o","ộ":"o","ǫ":"o","ǭ":"o","ø":"o","ǿ":"o","ɔ":"o","ꝋ":"o","ꝍ":"o","ɵ":"o","ƣ":"oi","ȣ":"ou","ꝏ":"oo","ⓟ":"p","p":"p","ṕ":"p","ṗ":"p","ƥ":"p","ᵽ":"p","ꝑ":"p","ꝓ":"p","ꝕ":"p","ⓠ":"q","q":"q","ɋ":"q","ꝗ":"q","ꝙ":"q","ⓡ":"r","r":"r","ŕ":"r","ṙ":"r","ř":"r","ȑ":"r","ȓ":"r","ṛ":"r","ṝ":"r","ŗ":"r","ṟ":"r","ɍ":"r","ɽ":"r","ꝛ":"r","ꞧ":"r","ꞃ":"r","ⓢ":"s","s":"s","ß":"s","ś":"s","ṥ":"s","ŝ":"s","ṡ":"s","š":"s","ṧ":"s","ṣ":"s","ṩ":"s","ș":"s","ş":"s","ȿ":"s","ꞩ":"s","ꞅ":"s","ẛ":"s","ⓣ":"t","t":"t","ṫ":"t","ẗ":"t","ť":"t","ṭ":"t","ț":"t","ţ":"t","ṱ":"t","ṯ":"t","ŧ":"t","ƭ":"t","ʈ":"t","ⱦ":"t","ꞇ":"t","ꜩ":"tz","ⓤ":"u","u":"u","ù":"u","ú":"u","û":"u","ũ":"u","ṹ":"u","ū":"u","ṻ":"u","ŭ":"u","ü":"u","ǜ":"u","ǘ":"u","ǖ":"u","ǚ":"u","ủ":"u","ů":"u","ű":"u","ǔ":"u","ȕ":"u","ȗ":"u","ư":"u","ừ":"u","ứ":"u","ữ":"u","ử":"u","ự":"u","ụ":"u","ṳ":"u","ų":"u","ṷ":"u","ṵ":"u","ʉ":"u","ⓥ":"v","v":"v","ṽ":"v","ṿ":"v","ʋ":"v","ꝟ":"v","ʌ":"v","ꝡ":"vy","ⓦ":"w","w":"w","ẁ":"w","ẃ":"w","ŵ":"w","ẇ":"w","ẅ":"w","ẘ":"w","ẉ":"w","ⱳ":"w","ⓧ":"x","x":"x","ẋ":"x","ẍ":"x","ⓨ":"y","y":"y","ỳ":"y","ý":"y","ŷ":"y","ỹ":"y","ȳ":"y","ẏ":"y","ÿ":"y","ỷ":"y","ẙ":"y","ỵ":"y","ƴ":"y","ɏ":"y","ỿ":"y","ⓩ":"z","z":"z","ź":"z","ẑ":"z","ż":"z","ž":"z","ẓ":"z","ẕ":"z","ƶ":"z","ȥ":"z","ɀ":"z","ⱬ":"z","ꝣ":"z","Ά":"Α","Έ":"Ε","Ή":"Η","Ί":"Ι","Ϊ":"Ι","Ό":"Ο","Ύ":"Υ","Ϋ":"Υ","Ώ":"Ω","ά":"α","έ":"ε","ή":"η","ί":"ι","ϊ":"ι","ΐ":"ι","ό":"ο","ύ":"υ","ϋ":"υ","ΰ":"υ","ω":"ω","ς":"σ"};return a}),b.define("select2/data/base",["../utils"],function(a){function b(a,c){b.__super__.constructor.call(this)}return a.Extend(b,a.Observable),b.prototype.current=function(a){throw new Error("The `current` method must be defined in child classes.")},b.prototype.query=function(a,b){throw new Error("The `query` method must be defined in child classes.")},b.prototype.bind=function(a,b){},b.prototype.destroy=function(){},b.prototype.generateResultId=function(b,c){var d=b.id+"-result-";return d+=a.generateChars(4),d+=null!=c.id?"-"+c.id.toString():"-"+a.generateChars(4)},b}),b.define("select2/data/select",["./base","../utils","jquery"],function(a,b,c){function d(a,b){this.$element=a,this.options=b,d.__super__.constructor.call(this)}return b.Extend(d,a),d.prototype.current=function(a){var b=[],d=this;this.$element.find(":selected").each(function(){var a=c(this),e=d.item(a);b.push(e)}),a(b)},d.prototype.select=function(a){var b=this;if(a.selected=!0,c(a.element).is("option"))return a.element.selected=!0,void this.$element.trigger("change");
2
- if(this.$element.prop("multiple"))this.current(function(d){var e=[];a=[a],a.push.apply(a,d);for(var f=0;f<a.length;f++){var g=a[f].id;-1===c.inArray(g,e)&&e.push(g)}b.$element.val(e),b.$element.trigger("change")});else{var d=a.id;this.$element.val(d),this.$element.trigger("change")}},d.prototype.unselect=function(a){var b=this;if(this.$element.prop("multiple"))return a.selected=!1,c(a.element).is("option")?(a.element.selected=!1,void this.$element.trigger("change")):void this.current(function(d){for(var e=[],f=0;f<d.length;f++){var g=d[f].id;g!==a.id&&-1===c.inArray(g,e)&&e.push(g)}b.$element.val(e),b.$element.trigger("change")})},d.prototype.bind=function(a,b){var c=this;this.container=a,a.on("select",function(a){c.select(a.data)}),a.on("unselect",function(a){c.unselect(a.data)})},d.prototype.destroy=function(){this.$element.find("*").each(function(){c.removeData(this,"data")})},d.prototype.query=function(a,b){var d=[],e=this,f=this.$element.children();f.each(function(){var b=c(this);if(b.is("option")||b.is("optgroup")){var f=e.item(b),g=e.matches(a,f);null!==g&&d.push(g)}}),b({results:d})},d.prototype.addOptions=function(a){b.appendMany(this.$element,a)},d.prototype.option=function(a){var b;a.children?(b=document.createElement("optgroup"),b.label=a.text):(b=document.createElement("option"),void 0!==b.textContent?b.textContent=a.text:b.innerText=a.text),a.id&&(b.value=a.id),a.disabled&&(b.disabled=!0),a.selected&&(b.selected=!0),a.title&&(b.title=a.title);var d=c(b),e=this._normalizeItem(a);return e.element=b,c.data(b,"data",e),d},d.prototype.item=function(a){var b={};if(b=c.data(a[0],"data"),null!=b)return b;if(a.is("option"))b={id:a.val(),text:a.text(),disabled:a.prop("disabled"),selected:a.prop("selected"),title:a.prop("title")};else if(a.is("optgroup")){b={text:a.prop("label"),children:[],title:a.prop("title")};for(var d=a.children("option"),e=[],f=0;f<d.length;f++){var g=c(d[f]),h=this.item(g);e.push(h)}b.children=e}return b=this._normalizeItem(b),b.element=a[0],c.data(a[0],"data",b),b},d.prototype._normalizeItem=function(a){c.isPlainObject(a)||(a={id:a,text:a}),a=c.extend({},{text:""},a);var b={selected:!1,disabled:!1};return null!=a.id&&(a.id=a.id.toString()),null!=a.text&&(a.text=a.text.toString()),null==a._resultId&&a.id&&null!=this.container&&(a._resultId=this.generateResultId(this.container,a)),c.extend({},b,a)},d.prototype.matches=function(a,b){var c=this.options.get("matcher");return c(a,b)},d}),b.define("select2/data/array",["./select","../utils","jquery"],function(a,b,c){function d(a,b){var c=b.get("data")||[];d.__super__.constructor.call(this,a,b),this.addOptions(this.convertToOptions(c))}return b.Extend(d,a),d.prototype.select=function(a){var b=this.$element.find("option").filter(function(b,c){return c.value==a.id.toString()});0===b.length&&(b=this.option(a),this.addOptions(b)),d.__super__.select.call(this,a)},d.prototype.convertToOptions=function(a){function d(a){return function(){return c(this).val()==a.id}}for(var e=this,f=this.$element.find("option"),g=f.map(function(){return e.item(c(this)).id}).get(),h=[],i=0;i<a.length;i++){var j=this._normalizeItem(a[i]);if(c.inArray(j.id,g)>=0){var k=f.filter(d(j)),l=this.item(k),m=c.extend(!0,{},j,l),n=this.option(m);k.replaceWith(n)}else{var o=this.option(j);if(j.children){var p=this.convertToOptions(j.children);b.appendMany(o,p)}h.push(o)}}return h},d}),b.define("select2/data/ajax",["./array","../utils","jquery"],function(a,b,c){function d(a,b){this.ajaxOptions=this._applyDefaults(b.get("ajax")),null!=this.ajaxOptions.processResults&&(this.processResults=this.ajaxOptions.processResults),d.__super__.constructor.call(this,a,b)}return b.Extend(d,a),d.prototype._applyDefaults=function(a){var b={data:function(a){return c.extend({},a,{q:a.term})},transport:function(a,b,d){var e=c.ajax(a);return e.then(b),e.fail(d),e}};return c.extend({},b,a,!0)},d.prototype.processResults=function(a){return a},d.prototype.query=function(a,b){function d(){var d=f.transport(f,function(d){var f=e.processResults(d,a);e.options.get("debug")&&window.console&&console.error&&(f&&f.results&&c.isArray(f.results)||console.error("Select2: The AJAX results did not return an array in the `results` key of the response.")),b(f)},function(){d.status&&"0"===d.status||e.trigger("results:message",{message:"errorLoading"})});e._request=d}var e=this;null!=this._request&&(c.isFunction(this._request.abort)&&this._request.abort(),this._request=null);var f=c.extend({type:"GET"},this.ajaxOptions);"function"==typeof f.url&&(f.url=f.url.call(this.$element,a)),"function"==typeof f.data&&(f.data=f.data.call(this.$element,a)),this.ajaxOptions.delay&&null!=a.term?(this._queryTimeout&&window.clearTimeout(this._queryTimeout),this._queryTimeout=window.setTimeout(d,this.ajaxOptions.delay)):d()},d}),b.define("select2/data/tags",["jquery"],function(a){function b(b,c,d){var e=d.get("tags"),f=d.get("createTag");void 0!==f&&(this.createTag=f);var g=d.get("insertTag");if(void 0!==g&&(this.insertTag=g),b.call(this,c,d),a.isArray(e))for(var h=0;h<e.length;h++){var i=e[h],j=this._normalizeItem(i),k=this.option(j);this.$element.append(k)}}return b.prototype.query=function(a,b,c){function d(a,f){for(var g=a.results,h=0;h<g.length;h++){var i=g[h],j=null!=i.children&&!d({results:i.children},!0),k=i.text===b.term;if(k||j)return f?!1:(a.data=g,void c(a))}if(f)return!0;var l=e.createTag(b);if(null!=l){var m=e.option(l);m.attr("data-select2-tag",!0),e.addOptions([m]),e.insertTag(g,l)}a.results=g,c(a)}var e=this;return this._removeOldTags(),null==b.term||null!=b.page?void a.call(this,b,c):void a.call(this,b,d)},b.prototype.createTag=function(b,c){var d=a.trim(c.term);return""===d?null:{id:d,text:d}},b.prototype.insertTag=function(a,b,c){b.unshift(c)},b.prototype._removeOldTags=function(b){var c=(this._lastTag,this.$element.find("option[data-select2-tag]"));c.each(function(){this.selected||a(this).remove()})},b}),b.define("select2/data/tokenizer",["jquery"],function(a){function b(a,b,c){var d=c.get("tokenizer");void 0!==d&&(this.tokenizer=d),a.call(this,b,c)}return b.prototype.bind=function(a,b,c){a.call(this,b,c),this.$search=b.dropdown.$search||b.selection.$search||c.find(".select2-search__field")},b.prototype.query=function(b,c,d){function e(b){var c=g._normalizeItem(b),d=g.$element.find("option").filter(function(){return a(this).val()===c.id});if(!d.length){var e=g.option(c);e.attr("data-select2-tag",!0),g._removeOldTags(),g.addOptions([e])}f(c)}function f(a){g.trigger("select",{data:a})}var g=this;c.term=c.term||"";var h=this.tokenizer(c,this.options,e);h.term!==c.term&&(this.$search.length&&(this.$search.val(h.term),this.$search.focus()),c.term=h.term),b.call(this,c,d)},b.prototype.tokenizer=function(b,c,d,e){for(var f=d.get("tokenSeparators")||[],g=c.term,h=0,i=this.createTag||function(a){return{id:a.term,text:a.term}};h<g.length;){var j=g[h];if(-1!==a.inArray(j,f)){var k=g.substr(0,h),l=a.extend({},c,{term:k}),m=i(l);null!=m?(e(m),g=g.substr(h+1)||"",h=0):h++}else h++}return{term:g}},b}),b.define("select2/data/minimumInputLength",[],function(){function a(a,b,c){this.minimumInputLength=c.get("minimumInputLength"),a.call(this,b,c)}return a.prototype.query=function(a,b,c){return b.term=b.term||"",b.term.length<this.minimumInputLength?void this.trigger("results:message",{message:"inputTooShort",args:{minimum:this.minimumInputLength,input:b.term,params:b}}):void a.call(this,b,c)},a}),b.define("select2/data/maximumInputLength",[],function(){function a(a,b,c){this.maximumInputLength=c.get("maximumInputLength"),a.call(this,b,c)}return a.prototype.query=function(a,b,c){return b.term=b.term||"",this.maximumInputLength>0&&b.term.length>this.maximumInputLength?void this.trigger("results:message",{message:"inputTooLong",args:{maximum:this.maximumInputLength,input:b.term,params:b}}):void a.call(this,b,c)},a}),b.define("select2/data/maximumSelectionLength",[],function(){function a(a,b,c){this.maximumSelectionLength=c.get("maximumSelectionLength"),a.call(this,b,c)}return a.prototype.query=function(a,b,c){var d=this;this.current(function(e){var f=null!=e?e.length:0;return d.maximumSelectionLength>0&&f>=d.maximumSelectionLength?void d.trigger("results:message",{message:"maximumSelected",args:{maximum:d.maximumSelectionLength}}):void a.call(d,b,c)})},a}),b.define("select2/dropdown",["jquery","./utils"],function(a,b){function c(a,b){this.$element=a,this.options=b,c.__super__.constructor.call(this)}return b.Extend(c,b.Observable),c.prototype.render=function(){var b=a('<span class="select2-dropdown"><span class="select2-results"></span></span>');return b.attr("dir",this.options.get("dir")),this.$dropdown=b,b},c.prototype.bind=function(){},c.prototype.position=function(a,b){},c.prototype.destroy=function(){this.$dropdown.remove()},c}),b.define("select2/dropdown/search",["jquery","../utils"],function(a,b){function c(){}return c.prototype.render=function(b){var c=b.call(this),d=a('<span class="select2-search select2-search--dropdown"><input class="select2-search__field" type="search" tabindex="-1" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" role="textbox" /></span>');return this.$searchContainer=d,this.$search=d.find("input"),c.prepend(d),c},c.prototype.bind=function(b,c,d){var e=this;b.call(this,c,d),this.$search.on("keydown",function(a){e.trigger("keypress",a),e._keyUpPrevented=a.isDefaultPrevented()}),this.$search.on("input",function(b){a(this).off("keyup")}),this.$search.on("keyup input",function(a){e.handleSearch(a)}),c.on("open",function(){e.$search.attr("tabindex",0),e.$search.focus(),window.setTimeout(function(){e.$search.focus()},0)}),c.on("close",function(){e.$search.attr("tabindex",-1),e.$search.val("")}),c.on("focus",function(){c.isOpen()&&e.$search.focus()}),c.on("results:all",function(a){if(null==a.query.term||""===a.query.term){var b=e.showSearch(a);b?e.$searchContainer.removeClass("select2-search--hide"):e.$searchContainer.addClass("select2-search--hide")}})},c.prototype.handleSearch=function(a){if(!this._keyUpPrevented){var b=this.$search.val();this.trigger("query",{term:b})}this._keyUpPrevented=!1},c.prototype.showSearch=function(a,b){return!0},c}),b.define("select2/dropdown/hidePlaceholder",[],function(){function a(a,b,c,d){this.placeholder=this.normalizePlaceholder(c.get("placeholder")),a.call(this,b,c,d)}return a.prototype.append=function(a,b){b.results=this.removePlaceholder(b.results),a.call(this,b)},a.prototype.normalizePlaceholder=function(a,b){return"string"==typeof b&&(b={id:"",text:b}),b},a.prototype.removePlaceholder=function(a,b){for(var c=b.slice(0),d=b.length-1;d>=0;d--){var e=b[d];this.placeholder.id===e.id&&c.splice(d,1)}return c},a}),b.define("select2/dropdown/infiniteScroll",["jquery"],function(a){function b(a,b,c,d){this.lastParams={},a.call(this,b,c,d),this.$loadingMore=this.createLoadingMore(),this.loading=!1}return b.prototype.append=function(a,b){this.$loadingMore.remove(),this.loading=!1,a.call(this,b),this.showLoadingMore(b)&&this.$results.append(this.$loadingMore)},b.prototype.bind=function(b,c,d){var e=this;b.call(this,c,d),c.on("query",function(a){e.lastParams=a,e.loading=!0}),c.on("query:append",function(a){e.lastParams=a,e.loading=!0}),this.$results.on("scroll",function(){var b=a.contains(document.documentElement,e.$loadingMore[0]);if(!e.loading&&b){var c=e.$results.offset().top+e.$results.outerHeight(!1),d=e.$loadingMore.offset().top+e.$loadingMore.outerHeight(!1);c+50>=d&&e.loadMore()}})},b.prototype.loadMore=function(){this.loading=!0;var b=a.extend({},{page:1},this.lastParams);b.page++,this.trigger("query:append",b)},b.prototype.showLoadingMore=function(a,b){return b.pagination&&b.pagination.more},b.prototype.createLoadingMore=function(){var b=a('<li class="select2-results__option select2-results__option--load-more"role="treeitem" aria-disabled="true"></li>'),c=this.options.get("translations").get("loadingMore");return b.html(c(this.lastParams)),b},b}),b.define("select2/dropdown/attachBody",["jquery","../utils"],function(a,b){function c(b,c,d){this.$dropdownParent=d.get("dropdownParent")||a(document.body),b.call(this,c,d)}return c.prototype.bind=function(a,b,c){var d=this,e=!1;a.call(this,b,c),b.on("open",function(){d._showDropdown(),d._attachPositioningHandler(b),e||(e=!0,b.on("results:all",function(){d._positionDropdown(),d._resizeDropdown()}),b.on("results:append",function(){d._positionDropdown(),d._resizeDropdown()}))}),b.on("close",function(){d._hideDropdown(),d._detachPositioningHandler(b)}),this.$dropdownContainer.on("mousedown",function(a){a.stopPropagation()})},c.prototype.destroy=function(a){a.call(this),this.$dropdownContainer.remove()},c.prototype.position=function(a,b,c){b.attr("class",c.attr("class")),b.removeClass("select2"),b.addClass("select2-container--open"),b.css({position:"absolute",top:-999999}),this.$container=c},c.prototype.render=function(b){var c=a("<span></span>"),d=b.call(this);return c.append(d),this.$dropdownContainer=c,c},c.prototype._hideDropdown=function(a){this.$dropdownContainer.detach()},c.prototype._attachPositioningHandler=function(c,d){var e=this,f="scroll.select2."+d.id,g="resize.select2."+d.id,h="orientationchange.select2."+d.id,i=this.$container.parents().filter(b.hasScroll);i.each(function(){a(this).data("select2-scroll-position",{x:a(this).scrollLeft(),y:a(this).scrollTop()})}),i.on(f,function(b){var c=a(this).data("select2-scroll-position");a(this).scrollTop(c.y)}),a(window).on(f+" "+g+" "+h,function(a){e._positionDropdown(),e._resizeDropdown()})},c.prototype._detachPositioningHandler=function(c,d){var e="scroll.select2."+d.id,f="resize.select2."+d.id,g="orientationchange.select2."+d.id,h=this.$container.parents().filter(b.hasScroll);h.off(e),a(window).off(e+" "+f+" "+g)},c.prototype._positionDropdown=function(){var b=a(window),c=this.$dropdown.hasClass("select2-dropdown--above"),d=this.$dropdown.hasClass("select2-dropdown--below"),e=null,f=this.$container.offset();f.bottom=f.top+this.$container.outerHeight(!1);var g={height:this.$container.outerHeight(!1)};g.top=f.top,g.bottom=f.top+g.height;var h={height:this.$dropdown.outerHeight(!1)},i={top:b.scrollTop(),bottom:b.scrollTop()+b.height()},j=i.top<f.top-h.height,k=i.bottom>f.bottom+h.height,l={left:f.left,top:g.bottom},m=this.$dropdownParent;"static"===m.css("position")&&(m=m.offsetParent());var n=m.offset();l.top-=n.top,l.left-=n.left,c||d||(e="below"),k||!j||c?!j&&k&&c&&(e="below"):e="above",("above"==e||c&&"below"!==e)&&(l.top=g.top-n.top-h.height),null!=e&&(this.$dropdown.removeClass("select2-dropdown--below select2-dropdown--above").addClass("select2-dropdown--"+e),this.$container.removeClass("select2-container--below select2-container--above").addClass("select2-container--"+e)),this.$dropdownContainer.css(l)},c.prototype._resizeDropdown=function(){var a={width:this.$container.outerWidth(!1)+"px"};this.options.get("dropdownAutoWidth")&&(a.minWidth=a.width,a.position="relative",a.width="auto"),this.$dropdown.css(a)},c.prototype._showDropdown=function(a){this.$dropdownContainer.appendTo(this.$dropdownParent),this._positionDropdown(),this._resizeDropdown()},c}),b.define("select2/dropdown/minimumResultsForSearch",[],function(){function a(b){for(var c=0,d=0;d<b.length;d++){var e=b[d];e.children?c+=a(e.children):c++}return c}function b(a,b,c,d){this.minimumResultsForSearch=c.get("minimumResultsForSearch"),this.minimumResultsForSearch<0&&(this.minimumResultsForSearch=1/0),a.call(this,b,c,d)}return b.prototype.showSearch=function(b,c){return a(c.data.results)<this.minimumResultsForSearch?!1:b.call(this,c)},b}),b.define("select2/dropdown/selectOnClose",[],function(){function a(){}return a.prototype.bind=function(a,b,c){var d=this;a.call(this,b,c),b.on("close",function(a){d._handleSelectOnClose(a)})},a.prototype._handleSelectOnClose=function(a,b){if(b&&null!=b.originalSelect2Event){var c=b.originalSelect2Event;if("select"===c._type||"unselect"===c._type)return}var d=this.getHighlightedResults();if(!(d.length<1)){var e=d.data("data");null!=e.element&&e.element.selected||null==e.element&&e.selected||this.trigger("select",{data:e})}},a}),b.define("select2/dropdown/closeOnSelect",[],function(){function a(){}return a.prototype.bind=function(a,b,c){var d=this;a.call(this,b,c),b.on("select",function(a){d._selectTriggered(a)}),b.on("unselect",function(a){d._selectTriggered(a)})},a.prototype._selectTriggered=function(a,b){var c=b.originalEvent;c&&c.ctrlKey||this.trigger("close",{originalEvent:c,originalSelect2Event:b})},a}),b.define("select2/i18n/en",[],function(){return{errorLoading:function(){return"The results could not be loaded."},inputTooLong:function(a){var b=a.input.length-a.maximum,c="Please delete "+b+" character";return 1!=b&&(c+="s"),c},inputTooShort:function(a){var b=a.minimum-a.input.length,c="Please enter "+b+" or more characters";return c},loadingMore:function(){return"Loading more results…"},maximumSelected:function(a){var b="You can only select "+a.maximum+" item";return 1!=a.maximum&&(b+="s"),b},noResults:function(){return"No results found"},searching:function(){return"Searching…"}}}),b.define("select2/defaults",["jquery","require","./results","./selection/single","./selection/multiple","./selection/placeholder","./selection/allowClear","./selection/search","./selection/eventRelay","./utils","./translation","./diacritics","./data/select","./data/array","./data/ajax","./data/tags","./data/tokenizer","./data/minimumInputLength","./data/maximumInputLength","./data/maximumSelectionLength","./dropdown","./dropdown/search","./dropdown/hidePlaceholder","./dropdown/infiniteScroll","./dropdown/attachBody","./dropdown/minimumResultsForSearch","./dropdown/selectOnClose","./dropdown/closeOnSelect","./i18n/en"],function(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C){function D(){this.reset()}D.prototype.apply=function(l){if(l=a.extend(!0,{},this.defaults,l),null==l.dataAdapter){if(null!=l.ajax?l.dataAdapter=o:null!=l.data?l.dataAdapter=n:l.dataAdapter=m,l.minimumInputLength>0&&(l.dataAdapter=j.Decorate(l.dataAdapter,r)),l.maximumInputLength>0&&(l.dataAdapter=j.Decorate(l.dataAdapter,s)),l.maximumSelectionLength>0&&(l.dataAdapter=j.Decorate(l.dataAdapter,t)),l.tags&&(l.dataAdapter=j.Decorate(l.dataAdapter,p)),(null!=l.tokenSeparators||null!=l.tokenizer)&&(l.dataAdapter=j.Decorate(l.dataAdapter,q)),null!=l.query){var C=b(l.amdBase+"compat/query");l.dataAdapter=j.Decorate(l.dataAdapter,C)}if(null!=l.initSelection){var D=b(l.amdBase+"compat/initSelection");l.dataAdapter=j.Decorate(l.dataAdapter,D)}}if(null==l.resultsAdapter&&(l.resultsAdapter=c,null!=l.ajax&&(l.resultsAdapter=j.Decorate(l.resultsAdapter,x)),null!=l.placeholder&&(l.resultsAdapter=j.Decorate(l.resultsAdapter,w)),l.selectOnClose&&(l.resultsAdapter=j.Decorate(l.resultsAdapter,A))),null==l.dropdownAdapter){if(l.multiple)l.dropdownAdapter=u;else{var E=j.Decorate(u,v);l.dropdownAdapter=E}if(0!==l.minimumResultsForSearch&&(l.dropdownAdapter=j.Decorate(l.dropdownAdapter,z)),l.closeOnSelect&&(l.dropdownAdapter=j.Decorate(l.dropdownAdapter,B)),null!=l.dropdownCssClass||null!=l.dropdownCss||null!=l.adaptDropdownCssClass){var F=b(l.amdBase+"compat/dropdownCss");l.dropdownAdapter=j.Decorate(l.dropdownAdapter,F)}l.dropdownAdapter=j.Decorate(l.dropdownAdapter,y)}if(null==l.selectionAdapter){if(l.multiple?l.selectionAdapter=e:l.selectionAdapter=d,null!=l.placeholder&&(l.selectionAdapter=j.Decorate(l.selectionAdapter,f)),l.allowClear&&(l.selectionAdapter=j.Decorate(l.selectionAdapter,g)),l.multiple&&(l.selectionAdapter=j.Decorate(l.selectionAdapter,h)),null!=l.containerCssClass||null!=l.containerCss||null!=l.adaptContainerCssClass){var G=b(l.amdBase+"compat/containerCss");l.selectionAdapter=j.Decorate(l.selectionAdapter,G)}l.selectionAdapter=j.Decorate(l.selectionAdapter,i)}if("string"==typeof l.language)if(l.language.indexOf("-")>0){var H=l.language.split("-"),I=H[0];l.language=[l.language,I]}else l.language=[l.language];if(a.isArray(l.language)){var J=new k;l.language.push("en");for(var K=l.language,L=0;L<K.length;L++){var M=K[L],N={};try{N=k.loadPath(M)}catch(O){try{M=this.defaults.amdLanguageBase+M,N=k.loadPath(M)}catch(P){l.debug&&window.console&&console.warn&&console.warn('Select2: The language file for "'+M+'" could not be automatically loaded. A fallback will be used instead.');continue}}J.extend(N)}l.translations=J}else{var Q=k.loadPath(this.defaults.amdLanguageBase+"en"),R=new k(l.language);R.extend(Q),l.translations=R}return l},D.prototype.reset=function(){function b(a){function b(a){return l[a]||a}return a.replace(/[^\u0000-\u007E]/g,b)}function c(d,e){if(""===a.trim(d.term))return e;if(e.children&&e.children.length>0){for(var f=a.extend(!0,{},e),g=e.children.length-1;g>=0;g--){var h=e.children[g],i=c(d,h);null==i&&f.children.splice(g,1)}return f.children.length>0?f:c(d,f)}var j=b(e.text).toUpperCase(),k=b(d.term).toUpperCase();return j.indexOf(k)>-1?e:null}this.defaults={amdBase:"./",amdLanguageBase:"./i18n/",closeOnSelect:!0,debug:!1,dropdownAutoWidth:!1,escapeMarkup:j.escapeMarkup,language:C,matcher:c,minimumInputLength:0,maximumInputLength:0,maximumSelectionLength:0,minimumResultsForSearch:0,selectOnClose:!1,sorter:function(a){return a},templateResult:function(a){return a.text},templateSelection:function(a){return a.text},theme:"default",width:"resolve"}},D.prototype.set=function(b,c){var d=a.camelCase(b),e={};e[d]=c;var f=j._convertData(e);a.extend(this.defaults,f)};var E=new D;return E}),b.define("select2/options",["require","jquery","./defaults","./utils"],function(a,b,c,d){function e(b,e){if(this.options=b,null!=e&&this.fromElement(e),this.options=c.apply(this.options),e&&e.is("input")){var f=a(this.get("amdBase")+"compat/inputData");this.options.dataAdapter=d.Decorate(this.options.dataAdapter,f)}}return e.prototype.fromElement=function(a){var c=["select2"];null==this.options.multiple&&(this.options.multiple=a.prop("multiple")),null==this.options.disabled&&(this.options.disabled=a.prop("disabled")),null==this.options.language&&(a.prop("lang")?this.options.language=a.prop("lang").toLowerCase():a.closest("[lang]").prop("lang")&&(this.options.language=a.closest("[lang]").prop("lang"))),null==this.options.dir&&(a.prop("dir")?this.options.dir=a.prop("dir"):a.closest("[dir]").prop("dir")?this.options.dir=a.closest("[dir]").prop("dir"):this.options.dir="ltr"),a.prop("disabled",this.options.disabled),a.prop("multiple",this.options.multiple),a.data("select2Tags")&&(this.options.debug&&window.console&&console.warn&&console.warn('Select2: The `data-select2-tags` attribute has been changed to use the `data-data` and `data-tags="true"` attributes and will be removed in future versions of Select2.'),a.data("data",a.data("select2Tags")),a.data("tags",!0)),a.data("ajaxUrl")&&(this.options.debug&&window.console&&console.warn&&console.warn("Select2: The `data-ajax-url` attribute has been changed to `data-ajax--url` and support for the old attribute will be removed in future versions of Select2."),a.attr("ajax--url",a.data("ajaxUrl")),a.data("ajax--url",a.data("ajaxUrl")));var e={};e=b.fn.jquery&&"1."==b.fn.jquery.substr(0,2)&&a[0].dataset?b.extend(!0,{},a[0].dataset,a.data()):a.data();var f=b.extend(!0,{},e);f=d._convertData(f);for(var g in f)b.inArray(g,c)>-1||(b.isPlainObject(this.options[g])?b.extend(this.options[g],f[g]):this.options[g]=f[g]);return this},e.prototype.get=function(a){return this.options[a]},e.prototype.set=function(a,b){this.options[a]=b},e}),b.define("select2/core",["jquery","./options","./utils","./keys"],function(a,b,c,d){var e=function(a,c){null!=a.data("select2")&&a.data("select2").destroy(),this.$element=a,this.id=this._generateId(a),c=c||{},this.options=new b(c,a),e.__super__.constructor.call(this);var d=a.attr("tabindex")||0;a.data("old-tabindex",d),a.attr("tabindex","-1");var f=this.options.get("dataAdapter");this.dataAdapter=new f(a,this.options);var g=this.render();this._placeContainer(g);var h=this.options.get("selectionAdapter");this.selection=new h(a,this.options),this.$selection=this.selection.render(),this.selection.position(this.$selection,g);var i=this.options.get("dropdownAdapter");this.dropdown=new i(a,this.options),this.$dropdown=this.dropdown.render(),this.dropdown.position(this.$dropdown,g);var j=this.options.get("resultsAdapter");this.results=new j(a,this.options,this.dataAdapter),this.$results=this.results.render(),this.results.position(this.$results,this.$dropdown);var k=this;this._bindAdapters(),this._registerDomEvents(),this._registerDataEvents(),this._registerSelectionEvents(),this._registerDropdownEvents(),this._registerResultsEvents(),this._registerEvents(),this.dataAdapter.current(function(a){k.trigger("selection:update",{data:a})}),a.addClass("select2-hidden-accessible"),a.attr("aria-hidden","true"),this._syncAttributes(),a.data("select2",this)};return c.Extend(e,c.Observable),e.prototype._generateId=function(a){var b="";return b=null!=a.attr("id")?a.attr("id"):null!=a.attr("name")?a.attr("name")+"-"+c.generateChars(2):c.generateChars(4),b=b.replace(/(:|\.|\[|\]|,)/g,""),b="select2-"+b},e.prototype._placeContainer=function(a){a.insertAfter(this.$element);var b=this._resolveWidth(this.$element,this.options.get("width"));null!=b&&a.css("width",b)},e.prototype._resolveWidth=function(a,b){var c=/^width:(([-+]?([0-9]*\.)?[0-9]+)(px|em|ex|%|in|cm|mm|pt|pc))/i;if("resolve"==b){var d=this._resolveWidth(a,"style");return null!=d?d:this._resolveWidth(a,"element")}if("element"==b){var e=a.outerWidth(!1);return 0>=e?"auto":e+"px"}if("style"==b){var f=a.attr("style");if("string"!=typeof f)return null;for(var g=f.split(";"),h=0,i=g.length;i>h;h+=1){var j=g[h].replace(/\s/g,""),k=j.match(c);if(null!==k&&k.length>=1)return k[1]}return null}return b},e.prototype._bindAdapters=function(){this.dataAdapter.bind(this,this.$container),this.selection.bind(this,this.$container),this.dropdown.bind(this,this.$container),this.results.bind(this,this.$container)},e.prototype._registerDomEvents=function(){var b=this;this.$element.on("change.select2",function(){b.dataAdapter.current(function(a){b.trigger("selection:update",{data:a})})}),this.$element.on("focus.select2",function(a){b.trigger("focus",a)}),this._syncA=c.bind(this._syncAttributes,this),this._syncS=c.bind(this._syncSubtree,this),this.$element[0].attachEvent&&this.$element[0].attachEvent("onpropertychange",this._syncA);var d=window.MutationObserver||window.WebKitMutationObserver||window.MozMutationObserver;null!=d?(this._observer=new d(function(c){a.each(c,b._syncA),a.each(c,b._syncS)}),this._observer.observe(this.$element[0],{attributes:!0,childList:!0,subtree:!1})):this.$element[0].addEventListener&&(this.$element[0].addEventListener("DOMAttrModified",b._syncA,!1),this.$element[0].addEventListener("DOMNodeInserted",b._syncS,!1),this.$element[0].addEventListener("DOMNodeRemoved",b._syncS,!1))},e.prototype._registerDataEvents=function(){var a=this;this.dataAdapter.on("*",function(b,c){a.trigger(b,c)})},e.prototype._registerSelectionEvents=function(){var b=this,c=["toggle","focus"];this.selection.on("toggle",function(){b.toggleDropdown()}),this.selection.on("focus",function(a){b.focus(a)}),this.selection.on("*",function(d,e){-1===a.inArray(d,c)&&b.trigger(d,e)})},e.prototype._registerDropdownEvents=function(){var a=this;this.dropdown.on("*",function(b,c){a.trigger(b,c)})},e.prototype._registerResultsEvents=function(){var a=this;this.results.on("*",function(b,c){a.trigger(b,c)})},e.prototype._registerEvents=function(){var a=this;this.on("open",function(){a.$container.addClass("select2-container--open")}),this.on("close",function(){a.$container.removeClass("select2-container--open")}),this.on("enable",function(){a.$container.removeClass("select2-container--disabled")}),this.on("disable",function(){a.$container.addClass("select2-container--disabled")}),this.on("blur",function(){a.$container.removeClass("select2-container--focus")}),this.on("query",function(b){a.isOpen()||a.trigger("open",{}),this.dataAdapter.query(b,function(c){a.trigger("results:all",{data:c,query:b})})}),this.on("query:append",function(b){this.dataAdapter.query(b,function(c){a.trigger("results:append",{data:c,query:b})})}),this.on("keypress",function(b){var c=b.which;a.isOpen()?c===d.ESC||c===d.TAB||c===d.UP&&b.altKey?(a.close(),b.preventDefault()):c===d.ENTER?(a.trigger("results:select",{}),b.preventDefault()):c===d.SPACE&&b.ctrlKey?(a.trigger("results:toggle",{}),b.preventDefault()):c===d.UP?(a.trigger("results:previous",{}),b.preventDefault()):c===d.DOWN&&(a.trigger("results:next",{}),b.preventDefault()):(c===d.ENTER||c===d.SPACE||c===d.DOWN&&b.altKey)&&(a.open(),b.preventDefault())})},e.prototype._syncAttributes=function(){this.options.set("disabled",this.$element.prop("disabled")),this.options.get("disabled")?(this.isOpen()&&this.close(),this.trigger("disable",{})):this.trigger("enable",{})},e.prototype._syncSubtree=function(a,b){var c=!1,d=this;if(!a||!a.target||"OPTION"===a.target.nodeName||"OPTGROUP"===a.target.nodeName){if(b)if(b.addedNodes&&b.addedNodes.length>0)for(var e=0;e<b.addedNodes.length;e++){var f=b.addedNodes[e];f.selected&&(c=!0)}else b.removedNodes&&b.removedNodes.length>0&&(c=!0);else c=!0;c&&this.dataAdapter.current(function(a){d.trigger("selection:update",{data:a})})}},e.prototype.trigger=function(a,b){var c=e.__super__.trigger,d={open:"opening",close:"closing",select:"selecting",unselect:"unselecting"};if(void 0===b&&(b={}),a in d){var f=d[a],g={prevented:!1,name:a,args:b};if(c.call(this,f,g),g.prevented)return void(b.prevented=!0)}c.call(this,a,b)},e.prototype.toggleDropdown=function(){this.options.get("disabled")||(this.isOpen()?this.close():this.open())},e.prototype.open=function(){this.isOpen()||this.trigger("query",{})},e.prototype.close=function(){this.isOpen()&&this.trigger("close",{})},e.prototype.isOpen=function(){return this.$container.hasClass("select2-container--open")},e.prototype.hasFocus=function(){return this.$container.hasClass("select2-container--focus")},e.prototype.focus=function(a){this.hasFocus()||(this.$container.addClass("select2-container--focus"),this.trigger("focus",{}))},e.prototype.enable=function(a){this.options.get("debug")&&window.console&&console.warn&&console.warn('Select2: The `select2("enable")` method has been deprecated and will be removed in later Select2 versions. Use $element.prop("disabled") instead.'),(null==a||0===a.length)&&(a=[!0]);var b=!a[0];this.$element.prop("disabled",b)},e.prototype.data=function(){this.options.get("debug")&&arguments.length>0&&window.console&&console.warn&&console.warn('Select2: Data can no longer be set using `select2("data")`. You should consider setting the value instead using `$element.val()`.');var a=[];return this.dataAdapter.current(function(b){a=b}),a},e.prototype.val=function(b){if(this.options.get("debug")&&window.console&&console.warn&&console.warn('Select2: The `select2("val")` method has been deprecated and will be removed in later Select2 versions. Use $element.val() instead.'),null==b||0===b.length)return this.$element.val();var c=b[0];a.isArray(c)&&(c=a.map(c,function(a){return a.toString()})),this.$element.val(c).trigger("change")},e.prototype.destroy=function(){this.$container.remove(),this.$element[0].detachEvent&&this.$element[0].detachEvent("onpropertychange",this._syncA),null!=this._observer?(this._observer.disconnect(),this._observer=null):this.$element[0].removeEventListener&&(this.$element[0].removeEventListener("DOMAttrModified",this._syncA,!1),this.$element[0].removeEventListener("DOMNodeInserted",this._syncS,!1),this.$element[0].removeEventListener("DOMNodeRemoved",this._syncS,!1)),this._syncA=null,this._syncS=null,this.$element.off(".select2"),this.$element.attr("tabindex",this.$element.data("old-tabindex")),this.$element.removeClass("select2-hidden-accessible"),this.$element.attr("aria-hidden","false"),this.$element.removeData("select2"),this.dataAdapter.destroy(),this.selection.destroy(),this.dropdown.destroy(),this.results.destroy(),this.dataAdapter=null,this.selection=null,this.dropdown=null,this.results=null;
3
- },e.prototype.render=function(){var b=a('<span class="select2 select2-container"><span class="selection"></span><span class="dropdown-wrapper" aria-hidden="true"></span></span>');return b.attr("dir",this.options.get("dir")),this.$container=b,this.$container.addClass("select2-container--"+this.options.get("theme")),b.data("element",this.$element),b},e}),b.define("jquery-mousewheel",["jquery"],function(a){return a}),b.define("jquery.select2",["jquery","jquery-mousewheel","./select2/core","./select2/defaults"],function(a,b,c,d){if(null==a.fn.select2){var e=["open","close","destroy"];a.fn.select2=function(b){if(b=b||{},"object"==typeof b)return this.each(function(){var d=a.extend(!0,{},b);new c(a(this),d)}),this;if("string"==typeof b){var d,f=Array.prototype.slice.call(arguments,1);return this.each(function(){var c=a(this).data("select2");null==c&&window.console&&console.error&&console.error("The select2('"+b+"') method was called on an element that is not using Select2."),d=c[b].apply(c,f)}),a.inArray(b,e)>-1?this:d}throw new Error("Invalid arguments for Select2: "+b)}}return null==a.fn.select2.defaults&&(a.fn.select2.defaults=d),c}),{define:b.define,require:b.require}}(),c=b.require("jquery.select2");return a.fn.select2.amd=b,c});
 
 
 
trunk/assets/js/wcv-admin-quick-edit.js DELETED
@@ -1,34 +0,0 @@
1
- jQuery(function(){
2
- jQuery('#the-list').on('click', '.editinline', function(){
3
-
4
- if (jQuery('.inline-edit-author').length && jQuery('.inline-edit-author-new').length) {
5
- jQuery('.inline-edit-author').hide();
6
- jQuery('.inline-edit-author').attr('class', 'inline-edit-author-old');
7
- jQuery('select[name=post_author]').attr('name', 'post_author-old');
8
- jQuery('.inline-edit-author-new').attr('class', 'inline-edit-author');
9
- jQuery('select[name=post_author-new]').attr('name', 'post_author');
10
- }
11
-
12
- inlineEditPost.revert();
13
-
14
- var post_id = jQuery(this).closest('tr').attr('id');
15
-
16
- post_id = post_id.replace("post-", "");
17
-
18
- var wcv_inline_data = jQuery('#vendor_' + post_id),
19
- wc_inline_data = jQuery('#woocommerce_inline_' + post_id );
20
-
21
- var vendor = wcv_inline_data.find("#_vendor").text();
22
-
23
- jQuery('select[name="post_author"] option[value="' + vendor + '"]', '.inline-edit-row').attr('selected', 'selected');
24
-
25
- var product_type = wc_inline_data.find('.product_type').val();
26
-
27
- if (product_type=='simple' || product_type=='external') {
28
- jQuery('.vendor', '.inline-edit-row').show();
29
- } else {
30
- jQuery('.vendor', '.inline-edit-row').hide();
31
- }
32
-
33
- });
34
- });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/assets/js/wcv-commissions.js DELETED
@@ -1,11 +0,0 @@
1
- // global variable
2
- jQuery(function(){
3
-
4
- jQuery('.select2').select2(
5
- {
6
- placeholder: wcv_commissions_select.placeholder,
7
- allowClear: wcv_commissions_select.allowclear
8
- }
9
- );
10
-
11
- });
 
 
 
 
 
 
 
 
 
 
 
trunk/changelog.txt DELETED
@@ -1,582 +0,0 @@
1
- Changelog for WC Vendors
2
-
3
- Version 1.9.11
4
-
5
- * Fixed: Correct product id being parsed to shipping function
6
- * Fixed: Payment method notice due to direct access to object property
7
- * Fixed: Sold by incorrectly showing in cart for variations
8
-
9
- Version 1.9.10
10
-
11
- * Fixed: Terms & Conditions Checkbox is not functioning normally #348
12
- * Fixed: Apply to Become a Vendor Checkbox is Missing with WC 3.0 + WC Vendors 1.9.9 #349
13
- * Fixed: New product title formatting is showing product #350
14
- * Fixed: Incorrect use of wpdb->prepare
15
- * Fixed: Mark shipped filter not providing parameters correctly
16
- * Fixed: Incorrect reference to billing email in notification email
17
- * Updated: Removed Sales reports from backend
18
-
19
- Version 1.9.9
20
-
21
- * Added: Filters to vendor admin dashboard class for custom columns #339
22
- * Added: Vendor shop name to the <title> tag on products archive page
23
- * Updated Woocommerce 2.7 compatibility
24
- * Updated: i18n text domain loading for proper translations #341
25
- * Fixed: Class logger when called via includes files
26
- * Fixed: Bug in how admin notices are displayed when saving shop settings
27
- * Fixed: 2.7 compatibility bugs
28
- * Fixed: Commissions Subtotal showing Full Product Price in vendor email #330
29
- * Fixed: Capabilities Fix for Resetting Roles #329
30
- * Fixed: HTML title attribute doesn't change for store pages #328
31
- * Fixed: Login form not displayed if get variable set
32
- * Fixed: Depreciated action in product edit screen
33
-
34
- Templates Updated:
35
- templates/emails/vendor-new-order.php
36
- templates/emails/notify-vendor-shipped.php
37
- templates/order/orders.php
38
-
39
- Version 1.9.8
40
-
41
- * Fixed: Paypal adaptive payments url changes
42
- * Added: Store Vendor ID in vendor child order #326
43
- * Added: 100% Japanese translations thanks to Shohei Tanaka
44
-
45
- Version 1.9.7
46
-
47
- * Fixed: Capabilities Fix for Resetting Roles #329
48
-
49
- Version 1.9.6
50
-
51
- * Added: Commission Query Functions #321
52
- * Added: Template for sold by in shop loop #324
53
- * Merged: Extended commissions management #319 from MounirHamani
54
- * Updated: Brazilian Portuguese translation
55
- * Template Added:
56
- templates/front/vendor-sold-by.php
57
-
58
- Version 1.9.5
59
-
60
- * Added: Automated language file builds
61
- * Added: Vendors can now delete media in the media uploader
62
- * Updated: Commissions table in backend now shows cost breakdowns
63
- * Fixed: Removed legacy code for unsupported shipping methods
64
- * Fixed: Rounding issue with 100% commission and coupons in pro
65
-
66
- Version 1.9.4
67
-
68
- * Added: Filter to add delayed payment possibility #309
69
- * Added: WPML support configuration file
70
- * Updated: Brazilian translation files thanks Luis!
71
- * Fixed: Using "date_i18n" instead of just "date" #316 from CasperBraske
72
- * Fixed: Geczy text domain in the settings file #314
73
- * Fixed: Commissions lock on one vendor after some actions are made #311
74
- * Fixed: Vendor dashboard Orders Export link is dead #306
75
- * Fixed: Vendor sorting in commissions - no option to NOT choose a vendor #305
76
- * Fixed: vendor order admin product metadata loading #298 from mikko-niemikorpi
77
- * Fixed: Commission status translatable in reports thanks CasperBraske
78
- * Fixed: Translatable strings thanks CasperBraske
79
- * Fixed: Issues with translation strings
80
- * Fixed: Incorrect variable reference
81
- * Fixed: bp_setup_current_user was called incorrectly
82
- * Fixed: Display of variations on main dashboard
83
- * Fixed: Trying to get property of non-object
84
- * Fixed: Variation data styles in order display in wp-admin
85
- * Fixed: Save user meta fields when pending vendor
86
- * Fixed: Incorrect url string format in french translation
87
- * Templates Updated:
88
- templates/dashboard/orders.php
89
-
90
- Version 1.9.3
91
-
92
- * Fixed: Only load asset on orders page in admin
93
- * Fixed: Not showing orders on vendor dashboard for new installations
94
- * Updated: Persian translations thanks to Alireza
95
-
96
- Version 1.9.2
97
-
98
- * Added: Reverse commission when order emptied from trash #277
99
- * Added: Daily Payout option for PayPal Cron #297
100
- * Added: Vendor select2 on the commissions page #284
101
- * Added: Button to reset vendor roles & WC Vendors settings to WooCoomerce system status tools page #230
102
- * Added: Dutch Translation, thanks @jjclinton
103
- * Added: Date filter for order queries
104
- * Added: Turkish translations thanks Hakan
105
- * Added: $wc_vendors object variable
106
- * Added: Action to fire after dashboard links (wcvendors_after_links)
107
- * Added: Body css classes to set pages
108
- * Updated: Support for woo commerce minimum and readme
109
- * Fixed: Mark commission reversed bulk action on commissions table
110
- * Fixed: No longer have to save permalink settings when updating WC Vendors options
111
- * Fixed: Orders page not set on fresh install
112
- * Fixed: Property of non object #300
113
- * Fixed: Translation for Mark Shipped #296
114
- * Fixed: Too many redirect loops if pages not set #290
115
- * Fixed: Non-Object Notice in install #289
116
- * Fixed: Rounding error with 100% commission thanks Brett!
117
- * Fixed: text domain for email templates
118
- * Fixed: Don't start session if user isn't logged
119
- * Fixed: Session error on log out if session doesn't exist
120
- * Fixed: Settings image selector bug
121
- * Merged pull request #302 from NicolasBernier - Completed French Translations, Thanks!
122
- * Merged: pull request #293 from stodorovic/fix_init_sessions
123
-
124
- Version 1.9.1
125
-
126
- * Added: GitHub Plugin URI for afragen/github-updater #282 thanks Agoruh
127
- * Added: Edit and View page settings options
128
- * Fixed: Missing Argument WCV_Admin_Users::filter_product_types() #288
129
- * Fixed: Critical: PHP Fatal error: Call to a member function get_children() #287
130
- * Fixed: Date range session data is not working #285
131
- * Fixed HTML escaped characters in PaypalAP Cancel and Return URLs: #286 thanks Nicolas
132
- * Fixed: Post type check to trigger_new_product() function #276
133
- * Fixed: Updated to notices instead of wordpress errors
134
- * Fixed: Product attribute fetch and returning HTML #283 thanks Mikko
135
- * Fixed: Vendor Mark Shipped Security Fix #280 thanks Agoruh
136
- * Fixed: Missing argument in Vendors Class
137
- * Fixed: Rounded product commission to avoid error 589023 when submitting to PayPal #275 thanks Nicolas
138
-
139
- Version 1.9.0
140
-
141
- * Added: Support for WooCommerce 2.6
142
- * Added: Vendor roles filter wcvendors_vendor_roles
143
- * Added: Product and Vendor id's to sold_by filters
144
- * Added: Vendor Signup Filters #269
145
- * Added: Notify Vendors Email - Add Product SKU, if set #263
146
- * Added: New Option: Notify Vendors show Purchase Price or Commissions #253
147
- * Added: Option to disable sold by #236
148
- * Added: Initial sub order management code #196 thanks Spreeuw
149
- * Fixed: Sold by meta removal
150
- * Fixed: Sequential Orders Support Commissions table #270
151
- * Fixed: Notify Vendors Email Customizer Not Working #240
152
- * Fixed: Commissions Total Report a-z sorting #239
153
- * Fixed: need to agree to terms for this to process correctly
154
- * Fixed: save pending vendor for login screen
155
- * Fixed: Notify Vendors Email in WC 2.5+ #265
156
- * Fixed: Order table layout
157
- * Fixed: Orders screen for vendors in admin #231
158
- * Fixed: product management in WC 2.6
159
- * Fixed: Duplicate application emails firing in free and pro
160
- * Fixed: Commission display issue in notify vendor email
161
- * Fixed: New ítem meta compatability with WC 2.5 and above
162
-
163
- Version 1.8.9
164
-
165
- * Fixed: Commission Totals Report Inaccurate #267
166
- * Added: Swedish Translation Thanks Arvid!
167
-
168
- Version 1.8.8
169
-
170
- * Fixed: Undefined variable error in commission class
171
- * Fixed: Pagination bug in wcv_vendorslist shortcode
172
-
173
- Version 1.8.7
174
-
175
- * Added: New qty argument to commission calculations
176
- * Added: Image uploader settings type
177
- * Added: New commission function for payment gateways
178
- * Fixed: Prefixed all btn css classes to stop theme collision
179
- * Fixed: Sold By:Name spaces issue #256
180
- * Fixed: Show extended fields for vendor and pending vendor roles
181
- * Fixed: Check if product is taxable
182
- * Fixed: Depreciated function calls in email templates
183
- * Fixed: Commission giving tax on none taxable items #251
184
- * Fixed: Sold by label issues with WC 2.5 #250
185
-
186
- Version 1.8.6
187
-
188
- * Fixed: Critical issue with paypal loading classes incorrectly
189
-
190
- Version 1.8.5
191
-
192
- * Fixed: Issue with PayPal on some sites - Rolled back issue #247
193
- * Fixed: Reverted ticket #216 for email conflicts
194
- * Added: New KnowledgeBase URL
195
-
196
- Version 1.8.4
197
-
198
- * Added: Removed fields from users that aren't vendors
199
- * Added: actions to hook into approve/deny vendor
200
- * Added: Ability to integrate with any order status for emails #216
201
- * Added: Terms & Conditions Opens in New Tab #246
202
- * Updated: Added trigger for on-hold to processing/completed for Notify Vendor Email #238
203
- * Updated: Settings page helper text and clarifications
204
- * Fixed: Sold by formatting issue #248
205
- * Fixed: wp_redirect caches with W3 Total Cache #237
206
- * Fixed: Bug in single page settings generator
207
- * Fixed: Category title missing bug #213
208
- * Fixed: Undefined index for non vendor users
209
- * Merge: pull request #247 from archonic/hotfix/oauth-class-exists
210
-
211
-
212
- Version 1.8.3
213
-
214
- * Fixed: Fatal Error on activation Merge pull request #235 from oleggen/patch-1
215
- * Added: Seller info label option
216
-
217
- Version 1.8.2
218
-
219
- * Added: Sold By label option
220
- * Added: New Vendor Commission Totals Report #234
221
- * Fixed: Added 'Shipped' if marked as shipped #233 can be found on WooCommerce > Reports > WC Vendors > Commission Totals
222
- * Fixed: Renamed internal function to stop theme and plugin clash
223
-
224
- Version 1.8.1
225
-
226
- * Added: New options updated action for settings
227
- * Added: New plugin activation hook for testing woocommerce active
228
- * Added: vendor id to get shipping due filter
229
- * Added: Warning on settings page if user registration in WooCommerce is not enabled
230
- * Added: Russian Translations thanks Natalia
231
-
232
- Version 1.8.0
233
-
234
- * Fixed: Mark $0.00 commissions as paid instead of due #205
235
- * Fixed: Email trigger should be filter not action - Thanks ontiuk #215
236
- * Updated: Read me with link to Pro and Updated Language List
237
- * Added: Portuguese Language (Thanks Renato) #212
238
- * Remove Forced HTTP Protocol on Sent IPN URL #207 from GoTeamScotch
239
-
240
- Version 1.7.9
241
-
242
- * Fixed: woocommerce filter and action issues on product edit page
243
-
244
- Version 1.7.8
245
-
246
- * Fixed: Vendors can not register #193
247
- * Fixed: Variation product image upload #194
248
- * Added: Order actions thanks GoTeamScotch
249
- * Updated: New item meta in WC 2.4+
250
- * Updated: WooCommerce Shipment Tracking v1.2.7+
251
- * Fixed: Paypal Logging thanks to GoTeamScotch
252
- * Updated: Templates now fully translatable #195
253
- * Fixed: Translations not loading bug
254
- * Fixed: vendors not defined error
255
- * Updated: Base translation files
256
-
257
- Version 1.7.7
258
-
259
- * Fixed: Terms and conditions processing #182
260
- * Added: filter to order note for overrides
261
- * Added: Order note for marked shipped #187
262
- * Fixed: order retrieval for wp-admin orders table for vendors
263
- * Fixed: pagination bug #179
264
- * Updated: styles for orders table in admin for vendors
265
- * Fixed: Vendor displaying issue #180
266
- * Updated: Admin Commission Report Column Names #183
267
- * Updated: Admin Commissions Page now shows times a product has sold in total #184
268
-
269
- Version 1.7.6
270
-
271
- * Added: Stock notifications go to vendors #114
272
- * Fixed: Instant Pay bug #174
273
- * Fixed: wcv_vendorslist paging #178
274
- * Added: Vendor display name now translatable
275
- * Depreciated: Dashboard vendor reports
276
- * Added: Chinese Language files thanks to SundayLau
277
- * Fixed: Added support for WPML #177
278
- * Update: default pot language file
279
-
280
- Version 1.7.5
281
-
282
- * Merged: Check product post type in vendor dashboard thanks simplementNat
283
- * Updated: Base language file
284
- * Updated: Compatibility for Shipment Tracking for v1.3.5 #167
285
- * Fixed: Shipping taxes
286
- * Fixed: Pending Products for Vendors #168
287
- * Added: Vendor shipping override #171
288
- * Added: Give Tax Per Vendor Override #56
289
- * Added: Hide duplicate product option
290
- * Fixed: Email firing for pending status only
291
- * Updated: Unified vendor-main/mini-header variables
292
- * Fixed: Email template paths to woocommerce paths
293
- * Merged: Updated Brazilian Portuguese thanks carlosramosweb
294
- * Added: Seller Info to header #161
295
- * Updated: Spanish Translations #160
296
- * Updated: Brazilian Portuguese Language #156
297
-
298
- Version 1.7.4
299
-
300
- * Added: Mark shipped filter #157
301
- * Fixed: Added Tax total to vendor email #146
302
- * Updated: Location of email templates in theme to wc-vendors/emails
303
- * Added: User email to Vendor Display Options #158
304
- * Fixed: Mass Pay Now Bug #159
305
- * Fixed: Mark as shipped for downloadable product #40
306
- * Added: Brazilian Portuguese language #156
307
- * Updated: Default Language file
308
- * Fixed: Translation issue for query test #155
309
- * Updated: Template base for emails
310
- * Fixed: Vendor email and renamed template #135
311
- * Fixed: Better CSV Output #63
312
- * Fixed: Made PayPal optional on Vendor Dashboard Shop Settings #144
313
- * Update: fixed return query var
314
- * Fixed: Test for product post types #149
315
- * Fixed: 2.1 Depreciated return call
316
- * Fixed: PHP Strict static call in commissions class
317
- * Merged: Is Vendor checks all user roles #147 thanks crabilld
318
-
319
- Version 1.7.3
320
-
321
- * Fixed: Paypal AP IPN url issue
322
-
323
- Version 1.7.2
324
-
325
- * Added: Filters for seller tab #141
326
- * Fixed: URI Too Large Error #143
327
- * Fixed: Give tax to vendors #142
328
- * Updated: Spanish Translations #140
329
- * Added: Persian Translation #139
330
-
331
- Version 1.7.1
332
-
333
- * Fixed: Invalid argument on new orders dashboard page #138
334
- * Updated: Base translation file
335
-
336
- Version 1.7.0
337
-
338
- * Fixed: add_query_arg/remove_query_arg XSS issue
339
- * Fixed: Hide Notice not working for admin settings
340
- * Added: Shop Settings page in WordPress dashboard
341
- * Added: Orders page in WordPress dashboard
342
-
343
- Version 1.6.2
344
-
345
- * Added: Option to change sold by vendor name #106
346
- * Fixed: Error notice in vendor dashboard #133
347
- * Fixed: Pagination in commissions admin screen #68
348
- * Added: Support for WooCommerce Order Status Manager
349
- * Fixed: Updated media filter method for vendors #132
350
- * Fixed: Commission not logged for variations #131
351
-
352
- Version 1.6.1
353
-
354
- * Fixed: Support for Per Product Shipping 2.2.x #126
355
- * Added: Filter to change commission label in vendor email #127
356
-
357
- Version 1.6.0
358
-
359
- * Added: Admin notices for vendor page slug & permalinks
360
- * Fixed: Plugin row meta links
361
- * Added: Upgrade notice
362
- * Fixed: Rounding issue #120
363
- * Fixed: Paypal https host check depreciated call
364
- * Added: show_products attribute #107
365
- * Updated: Text in denied template to make more sense when registration disabled #123
366
- * Updated: wcv_vendorslist shortcode now shows 3 column output #123
367
- * Fixed: Index issue #122
368
- * Updated: New plugin and template directory structure - IMPORTANT READ KB
369
-
370
- Version 1.5.0
371
-
372
- * Added: Spanish translation thanks Mauricio
373
- * Added: French translation thanks JP
374
- * Added: CSS class for sold by (classes same as filters in those files)
375
- * Fixed: Paypal return URL
376
- * Added: Vendor Dashboard UI Improvements
377
- * Added: WC Vendors Test Gateway
378
- * Updated: ToolTips to be more helpful
379
- * Added: Admin option for not giving shipping cost to vendor
380
- * Fixed: Disable notify admin
381
- * Fixed: Mark as shipped/unshipped
382
- * Fixed: Duplicate column name
383
-
384
- Version 1.4.5
385
-
386
- * Updated: select2 3.5.2 for settings api
387
- * Fixed: Replaced Chosen with Select2 #102
388
- * Fixed: Table Rate Shipping issue #103
389
- * Fixed: Featured column issue #100
390
- * Updated: Filter call for report
391
- * Fixed: Call to depreciated function #98
392
-
393
- Version 1.4.4
394
-
395
- * Fixed: Hardcoded table in wcv_vendorslist shortcode
396
-
397
- Version 1.4.3
398
-
399
- * Fixed: Placeholder on Product Reports
400
-
401
- Version 1.4.2
402
-
403
- * Added: Commission status sort to commissions page
404
- * Fixed: Recent Commissions limit of 20 now works on selected date range
405
- * Fixed: Report By product in WC2.3
406
- * Fixed: Vendor Report date selector in wp-admin
407
- * Fixed: Tracking plugin Order Meta
408
- * Added: New filter wcvendors_dashboard_google_maps_link
409
- * Fixed: Formatting error for Google maps link
410
- * Added: New actions in vendor-dashboard wcvendors_vendor_unship, wcvendors_vendor_ship (thanks Nathan H)
411
-
412
- Version 1.4.1
413
-
414
- * Fixed: Language file loading issue
415
- * Fixed: Static function calls in commision class for php 5.6
416
- * Fixed: Static call in Vendor Cart
417
- * Added: New language files for de_AT, de_DE (thanks to theHubi), it_IT (thanks to Nicole)
418
- * Added: New actions for main and mini headers (before and after see KB)
419
-
420
- Version 1.4.0
421
-
422
- * Added: product category + vendor shortcode [wcv_product_category category="category" vendor="vendorname"]
423
- * Added: Tracking number support via WooThemes Shipment Tracking plugin
424
- * Added: Google Maps for delivery address on front end
425
- * Fixed: woocommerce_wp_text_input via merged pull request from svenl77
426
- * Added: Vendor List shortcode [wcv_vendorlist] + template for styling see KB for full details
427
- * Fixed: Report not showing Commission by Product
428
- * Fixed: Paths in language files
429
-
430
- Version 1.3.1
431
-
432
- * Fixed: Sold by in invoices
433
-
434
- Version 1.3.0
435
-
436
- * Added: show vendor on all emails #29
437
- * Fixed: Critical issue #58
438
- * Added: Vendor header templates #65
439
- * Added: Vendor to QuickEdit #12
440
- * Fixed: Updating notices to use 2.1 Notice API #62
441
- * Added: wcvendors_registration_checkbox filter to denied.php template view
442
- * Added: wcvendors_vendor_registration_checkbox filter to filter "Apply to become a vendor?" at registration.
443
- * Added: wcvendors_vendor_registration_checkbox to filter "Apply to become a vendor?"
444
-
445
- Version 1.2.0
446
-
447
- * Added new filters to change sold by text see Knowledge base for details
448
- * Added sold by to product loop for archive-product.php, see knowledge base on how to disable or change this
449
- * Added new option to hide "Featured product" from vendors
450
- * Added Sold By Filter as per #3
451
- * Removing unused tag filter
452
- * Updated default.pot
453
- * Fixing attribute bug #48 - Thanks to gcskye
454
- * Removing legacy translations
455
- * Fixed Orders view errors
456
- * Fixing call to incorrect method #45
457
-
458
- Version 1.1.5
459
-
460
- * Fixed orders view to remove incorrect call to woocommerce print messages
461
-
462
- Version 1.1.4
463
-
464
- * Fixed called to incorrect notice method
465
- * Moved methods into parent class See #41
466
- * PHP Strict updates
467
- * Deprecated Class due to PHP strict issues
468
- * fixing static call
469
- * Tidying up and comments.
470
- * Renaming class to new standard
471
- * Removing deprecated wc methods.
472
- * Fixing incorrect method call
473
- * Problem with undefined variable.
474
- * fixing static call issues
475
- * fixing static call problems
476
- * Fixing more strict issues
477
- * fixing encoding issue
478
- * Fixing tax rounding issue #37
479
- * Fixing deprecated calls #42
480
- * Fixing strict standards
481
- * Fixing constant reference #36
482
- * Fixed reference to old plugin name
483
- * Fixing strict errors #27
484
- * New Default POT translations #26
485
- * Fixing translation strings #26
486
- * Updated description
487
- * Fix link to paypal adaptive payments #25
488
- * Fixing issue #22
489
- * Remove support for woo commerce 2.1 and below
490
- * Class rename
491
- * Fixed incorrect table name see #35
492
- * Fixed Class description
493
- * Added label on vendor email shipping line see #22
494
- * Fix issue #23 Notify vendor email problem
495
- * Fixing Issue #28 & removing WC2.0 support
496
- * Strict Standards in WCV_Vendors #32
497
- * Fixing Issue #31 PHP Strict Issues
498
- * Fixing Issue #30 PHP Strict Standards
499
- * Change Log added for release changes
500
- * WC Version Requirement changed
501
- * Updating author to include wc after modifications
502
- * Rename class
503
- * Fixing up link to documentation
504
- * Updated Readme
505
-
506
- Version 1.1.3
507
-
508
- * Fixing table names for compatibility
509
- * Rename class
510
- * Fixing Fatal error #18
511
- * Fatal error fixed, version bump
512
- * Fixing Class call
513
- * Fixing all references to incorrect class name
514
- * Commission and report fixes
515
- * Fixing spelling
516
- * Update readme.txt
517
- * Fixing author
518
- * Version bump
519
- * Check if shipping is enabled
520
- * Comment for future reference
521
-
522
- Version 1.1.1
523
-
524
- * Start of adding woocomerce short codes enhanced
525
- * Shortcodes class
526
- * Removing temp file
527
- * Adding short code support
528
- * Version Bump
529
- * PHP Strict Issue #5
530
- * Fatal Error: Class 'PV_Commission' #14
531
- * Fixing references to PV_Vendors
532
- * Renamed filters and actions
533
- * Rename Reports Submenu #15
534
- * "Mark Shipped" Icon #16
535
- * Version increased after bug fixes
536
-
537
- Version 1.0.2
538
-
539
- * Fix up admin settings notices
540
- * Renamed shortcodes
541
- * Version bump for short code rename
542
-
543
-
544
- Version 1.0.1
545
-
546
- * Initial Commit
547
- * First commit - no modifications to existing plugin
548
- * Updating README
549
- * Update README.md
550
- * Features added
551
- * Updated Details of plugin
552
- * Fixing up formatting
553
- * More fixes.
554
- * Updating readme
555
- * Updating more details
556
- * Update denied.php
557
- * Added mac file ignore
558
- * updated read me
559
- * Plugin Rename
560
- * Plugin rename
561
- * Rename plugin
562
- * Rename plugin
563
- * more updates
564
- * Plugin Updater removed
565
- * Updating text domain
566
- * Basic rename complete
567
- * Replacement includes classes
568
- * text domain updates
569
- * text domain updates
570
- * new change log for new fork
571
- * Rename main class
572
- * renaming constants
573
- * updated constants
574
- * plugin constant
575
- * Renaming queries class
576
- * constants updated
577
- * rename vendor shop class
578
- * rename vendor cart class
579
- * Renaming classes
580
- * Author updates
581
- * Class renaming
582
- * Version bump
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/class-wc-vendors.php DELETED
@@ -1,419 +0,0 @@
1
- <?php
2
-
3
- /**
4
- * Plugin Name: WC Vendors
5
- * Plugin URI: https://www.wcvendors.com
6
- * Description: Allow vendors to sell their own products and receive a commission for each sale.
7
- * Author: WC Vendors
8
- * Author URI: https://www.wcvendors.com
9
- * GitHub Plugin URI: https://github.com/wcvendors/wcvendors
10
- *
11
- * Version: 1.9.11
12
- * Requires at least: 4.4.0
13
- * Tested up to: 4.7.1
14
- *
15
- * Text Domain: wcvendors
16
- * Domain Path: /languages/
17
- *
18
- * @category Plugin
19
- * @copyright Copyright © 2012 Matt Gates
20
- * @copyright Copyright © 2017 WC Vendors
21
- * @author Matt Gates, WC Vendors
22
- * @package WCVendors
23
- * @license GPL2
24
-
25
- WC Vendors is free software: you can redistribute it and/or modify
26
- it under the terms of the GNU General Public License as published by
27
- the Free Software Foundation, either version 2 of the License, or
28
- any later version.
29
-
30
- WC Vendors is distributed in the hope that it will be useful,
31
- but WITHOUT ANY WARRANTY; without even the implied warranty of
32
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
33
- GNU General Public License for more details.
34
-
35
- You should have received a copy of the GNU General Public License
36
- along with WC Vendors. If not, see http://www.gnu.org/licenses/gpl-2.0.txt.
37
-
38
- */
39
-
40
-
41
- /**
42
- * Plugin activation hook
43
- */
44
- function wcvendors_activate() {
45
-
46
- /**
47
- * Requires woocommerce to be installed and active
48
- */
49
- if ( !class_exists( 'WooCommerce' ) ) {
50
- deactivate_plugins( plugin_basename( __FILE__ ) );
51
- wp_die( __( 'WC Vendors requires WooCommerce to run. Please install WooCommerce and activate before attempting to activate again.', 'wcvendors' ) );
52
- }
53
- } // wcvendors_activate()
54
-
55
- register_activation_hook( __FILE__, 'wcvendors_activate' );
56
-
57
-
58
- /**
59
- * Required functions
60
- */
61
- require_once trailingslashit( dirname( __FILE__ ) ) . 'classes/includes/class-functions.php';
62
-
63
- /**
64
- * Check if WooCommerce is active
65
- */
66
- if ( wcv_is_woocommerce_activated() ) {
67
-
68
- /* Define an absolute path to our plugin directory. */
69
- if ( !defined( 'wcv_plugin_dir' ) ) define( 'wcv_plugin_dir', trailingslashit( dirname( __FILE__ ) ) . '/' );
70
- if ( !defined( 'wcv_assets_url' ) ) define( 'wcv_assets_url', trailingslashit( plugins_url( 'assets', __FILE__ ) ) );
71
- if ( !defined( 'wcv_plugin_base' ) ) define( 'wcv_plugin_base', plugin_basename( __FILE__ ) );
72
- if ( !defined( 'wcv_plugin_dir_path' ) ) define( 'wcv_plugin_dir_path', untrailingslashit( plugin_dir_path( __FILE__ ) ) );
73
-
74
-
75
- define('WCV_VERSION', '1.9.11' );
76
-
77
- /**
78
- * Main Product Vendor class
79
- *
80
- * @package WCVendors
81
- */
82
- class WC_Vendors
83
- {
84
-
85
- /**
86
- * @var
87
- */
88
- public static $pv_options;
89
- public static $id = 'wc_prd_vendor';
90
-
91
- /**
92
- * Constructor.
93
- */
94
- public function __construct()
95
- {
96
-
97
- // Load text domain
98
- add_action( 'plugins_loaded', array( $this, 'load_il8n' ) );
99
-
100
- $this->title = __( 'WC Vendors', 'wcvendors' );
101
-
102
- // Install & upgrade
103
- add_action( 'admin_init', array( $this, 'check_install' ) );
104
- add_action( 'admin_init', array( $this, 'maybe_flush_permalinks' ), 99 );
105
- add_action( 'admin_init', array( $this, 'wcv_required_ignore_notices' ) );
106
-
107
- add_action( 'plugins_loaded', array( $this, 'load_settings' ) );
108
- add_action( 'plugins_loaded', array( $this, 'include_gateways' ) );
109
- add_action( 'plugins_loaded', array( $this, 'include_core' ) );
110
- add_action( 'init', array( $this, 'include_init' ) );
111
- add_action( 'current_screen', array( $this, 'include_assets' ) );
112
-
113
- add_filter( 'plugin_row_meta', array($this, 'plugin_row_meta'), 10, 2 );
114
- add_action( self::$id . '_options_updated', array( $this, 'option_updates' ), 10, 2 );
115
-
116
- // Start a PHP session, if not yet started then destroy if logged in or out
117
- add_action( 'init', array( $this, 'init_session'), 1 );
118
- add_action( 'wp_logout', array( $this, 'destroy_session') );
119
- add_action( 'wp_login', array( $this, 'destroy_session') );
120
- }
121
-
122
-
123
- /**
124
- *
125
- */
126
- public function invalid_wc_version()
127
- {
128
- echo '<div class="error"><p>' . __( '<b>WC Vendors is inactive</b>. WC Vendors requires a minimum of WooCommerce v2.7.0.', 'wcvendors' ) . '</p></div>';
129
- }
130
-
131
- /**
132
- * Start the session
133
- */
134
- public function init_session(){
135
-
136
- if ( !session_id() && is_user_logged_in() ) {
137
- session_start();
138
- }
139
-
140
- } //init_session()
141
-
142
- public function destroy_session(){
143
-
144
- if ( session_id() ) {
145
- session_destroy();
146
- }
147
-
148
- } // destroy_session()
149
-
150
-
151
- /**
152
- * Check whether install has ran before or not
153
- *
154
- * Run install if it hasn't.
155
- *
156
- * @return unknown
157
- */
158
- public function check_install()
159
- {
160
- global $woocommerce;
161
-
162
- if ( version_compare( WC_VERSION, '2.6', '<' ) ) {
163
- add_action( 'admin_notices', array( $this, 'invalid_wc_version' ) );
164
- deactivate_plugins( plugin_basename( __FILE__ ) );
165
- return false;
166
- }
167
-
168
- require_once wcv_plugin_dir . 'classes/class-install.php';
169
-
170
- $this->load_settings();
171
- $install = new WCV_Install;
172
- $install->init();
173
- }
174
-
175
-
176
- /**
177
- * Set static $pv_options to hold options class
178
- */
179
- public function load_settings()
180
- {
181
- if ( empty( self::$pv_options ) ) {
182
- require_once wcv_plugin_dir . 'classes/admin/settings/classes/sf-class-settings.php';
183
- self::$pv_options = new SF_Settings_API( self::$id, $this->title, 'woocommerce', __FILE__ );
184
- self::$pv_options->load_options( wcv_plugin_dir . 'classes/admin/settings/sf-options.php' );
185
- }
186
- }
187
-
188
- public function load_il8n() {
189
-
190
- $locale = apply_filters( 'plugin_locale', get_locale(), 'wcvendors' );
191
-
192
- //Place your custom translations into wp-content/languages/wc-vendors to be upgrade safe
193
- load_textdomain( 'wcvendors', WP_LANG_DIR.'/wc-vendors/wcvendors-'.$locale.'.mo');
194
-
195
- load_plugin_textdomain( 'wcvendors', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' );
196
-
197
- }
198
-
199
-
200
- /**
201
- * Include core files
202
- */
203
- public function include_core()
204
- {
205
- require_once wcv_plugin_dir . 'classes/class-queries.php';
206
- require_once wcv_plugin_dir . 'classes/class-vendors.php';
207
- require_once wcv_plugin_dir . 'classes/class-cron.php';
208
- require_once wcv_plugin_dir . 'classes/class-commission.php';
209
- require_once wcv_plugin_dir . 'classes/class-shipping.php';
210
- require_once wcv_plugin_dir . 'classes/class-vendor-order.php';
211
- require_once wcv_plugin_dir . 'classes/class-vendor-post-types.php';
212
- require_once wcv_plugin_dir . 'classes/front/class-vendor-cart.php';
213
- require_once wcv_plugin_dir . 'classes/front/dashboard/class-vendor-dashboard.php';
214
- require_once wcv_plugin_dir . 'classes/front/class-vendor-shop.php';
215
- require_once wcv_plugin_dir . 'classes/front/signup/class-vendor-signup.php';
216
- require_once wcv_plugin_dir . 'classes/front/orders/class-orders.php';
217
- require_once wcv_plugin_dir . 'classes/admin/emails/class-emails.php';
218
- require_once wcv_plugin_dir . 'classes/admin/class-product-meta.php';
219
- require_once wcv_plugin_dir . 'classes/admin/class-vendor-applicants.php';
220
- require_once wcv_plugin_dir . 'classes/admin/class-vendor-reports.php';
221
- require_once wcv_plugin_dir . 'classes/admin/class-admin-reports.php';
222
- require_once wcv_plugin_dir . 'classes/admin/class-admin-users.php';
223
- require_once wcv_plugin_dir . 'classes/admin/class-admin-page.php';
224
- require_once wcv_plugin_dir . 'classes/admin/class-vendor-admin-dashboard.php';
225
- require_once wcv_plugin_dir . 'classes/includes/class-wcv-shortcodes.php';
226
-
227
-
228
- if ( !function_exists( 'woocommerce_wp_text_input' ) && !is_admin() ) {
229
- include_once(WC()->plugin_path() . '/includes/admin/wc-meta-box-functions.php');
230
- }
231
-
232
- new WCV_Vendors;
233
- new WCV_Vendor_Shop;
234
- new WCV_Vendor_Cart;
235
- new WCV_Commission;
236
- new WCV_Shipping;
237
- new WCV_Cron;
238
- new WCV_Orders;
239
- new WCV_Vendor_Dashboard;
240
- new WCV_Admin_Setup;
241
- new WCV_Vendor_Admin_Dashboard;
242
- new WCV_Admin_Reports;
243
- new WCV_Vendor_Applicants;
244
- new WCV_Emails;
245
- new WCV_Vendor_Signup;
246
- new WCV_Shortcodes;
247
- }
248
-
249
-
250
- /**
251
- * These need to be initlized later in loading to fix interaction with other plugins that call current_user_can at the right time.
252
- *
253
- * @since 1.9.4
254
- * @access public
255
- */
256
- public function include_init(){
257
-
258
- new WCV_Vendor_Reports;
259
- new WCV_Product_Meta;
260
- new WCV_Admin_Users;
261
-
262
- } // include_init()
263
-
264
- /**
265
- * Load plugin assets
266
- */
267
- public function include_assets(){
268
-
269
- $screen = get_current_screen();
270
-
271
- if ( in_array( $screen->id, array( 'edit-product' ) ) ) {
272
- wp_enqueue_script( 'wcv_quick-edit', wcv_assets_url. 'js/wcv-admin-quick-edit.js', array('jquery') );
273
- }
274
-
275
- }
276
-
277
-
278
- /**
279
- * Include payment gateways
280
- */
281
- public function include_gateways()
282
- {
283
- require_once wcv_plugin_dir . 'classes/gateways/PayPal_AdvPayments/paypal_ap.php';
284
- require_once wcv_plugin_dir . 'classes/gateways/PayPal_Masspay/class-paypal-masspay.php';
285
- require_once wcv_plugin_dir . 'classes/gateways/WCV_Gateway_Test/class-wcv-gateway-test.php';
286
- }
287
-
288
-
289
- /**
290
- * Do an action when options are updated
291
- *
292
- * @param array $options
293
- * @param unknown $tabname
294
- */
295
- public function option_updates( $options, $tabname )
296
- {
297
- // Change the vendor role capabilities
298
- if ( $tabname == sanitize_title(__( 'Capabilities', 'wcvendors' )) ) {
299
- $can_add = $options[ 'can_submit_products' ];
300
- $can_edit = $options[ 'can_edit_published_products' ];
301
- $can_submit_live = $options[ 'can_submit_live_products' ];
302
- $can_view_reports = $options[ 'can_view_backend_reports' ];
303
-
304
- $args = array(
305
- 'assign_product_terms' => $can_add,
306
- 'edit_products' => $can_add || $can_edit,
307
- 'edit_published_products' => $can_edit,
308
- 'delete_published_products' => $can_edit,
309
- 'delete_products' => $can_edit,
310
- 'manage_product' => $can_add,
311
- 'publish_products' => $can_submit_live,
312
- 'read' => true,
313
- 'read_products' => $can_edit || $can_add,
314
- 'upload_files' => true,
315
- 'import' => true,
316
- 'view_woocommerce_reports' => false,
317
- );
318
-
319
- remove_role( 'vendor' );
320
-
321
- add_role( 'vendor', __('Vendor', 'wcvendors'), $args );
322
- } // Update permalinks
323
- else if ( $tabname == sanitize_title(__( 'General', 'wcvendors' ) )) {
324
- $old_permalink = WC_Vendors::$pv_options->get_option( 'vendor_shop_permalink' );
325
- $new_permalink = $options[ 'vendor_shop_permalink' ];
326
-
327
- if ( $old_permalink != $new_permalink ) {
328
- update_option( WC_Vendors::$id . '_flush_rules', true );
329
- }
330
- }
331
-
332
- do_action( 'wcvendors_option_updates', $options, $tabname );
333
-
334
- }
335
-
336
-
337
- /**
338
- * If the settings are updated and the vendor page link has changed update permalinks
339
- * @access public
340
- *
341
- */
342
- public function maybe_flush_permalinks()
343
- {
344
- if ( get_option( WC_Vendors::$id . '_flush_rules' ) ) {
345
- flush_rewrite_rules();
346
- update_option( WC_Vendors::$id . '_flush_rules', false );
347
- }
348
- }
349
-
350
- /**
351
- * Add links to plugin page to our external help site.
352
- * @param $links - links array from action
353
- * @param $file - file reference for this plugin
354
- * @access public
355
- *
356
- */
357
- public static function plugin_row_meta( $links, $file ) {
358
- if ( $file == wcv_plugin_base ) {
359
-
360
- $row_meta = array(
361
- 'docs' => '<a href="http://www.wcvendors.com/kb/" target="_blank">'.__( 'Documentation/KB', 'wcvendors' ).'</a>',
362
- 'help' => '<a href="http://www.wcvendors.com/help/" target="_blank">'.__( 'Help Forums', 'wcvendors').'</a>',
363
- 'support' => '<a href="http://www.wcvendors.com/contact-us/" target="_blank">'.__( 'Paid Support', 'wcvendors' ).'</a>'
364
- );
365
-
366
- return array_merge( $links, $row_meta );
367
- }
368
-
369
- return (array) $links;
370
- }
371
-
372
- /**
373
- * Add user meta to remember ignore notices
374
- * @access public
375
- *
376
- */
377
- public function wcv_required_ignore_notices(){
378
- global $current_user;
379
- $current_user_id = $current_user->ID;
380
-
381
- /* If user clicks to ignore the notice, add that to their user meta */
382
- if ( isset( $_GET[ 'wcv_shop_ignore_notice' ] ) && '0' == $_GET[ 'wcv_shop_ignore_notice' ] ) {
383
- add_user_meta( $current_user_id, 'wcv_shop_ignore_notice', 'true', true);
384
- }
385
- if ( isset($_GET['wcv_pl_ignore_notice']) && '0' == $_GET['wcv_pl_ignore_notice'] ) {
386
- add_user_meta( $current_user_id, 'wcv_pl_ignore_notice', 'true' , true);
387
- }
388
-
389
- }
390
-
391
- /**
392
- * Class logger so that we can keep our debug and logging information cleaner
393
- *
394
- * @since 1.4.0
395
- * @access public
396
- *
397
- * @param mixed - $data the data to go to the error log could be string, array or object
398
- */
399
- public static function log( $data = '' ){
400
-
401
- $trace = debug_backtrace( false, 2 );
402
- $path_info = pathinfo( $trace[ 0 ][ 'file' ] );
403
-
404
- // Only display the class file if there is actually a class file
405
- $caller = ( isset( $trace[ 1 ] ) ) ? array_key_exists( 'class', $trace[ 1 ] ) ? $trace[ 1 ][ 'class' ] : $path_info[ 'basename' ] : '';
406
-
407
- if ( is_array( $data ) || is_object( $data ) ) {
408
- error_log( $caller . ' : ' . print_r( $data, true ) );
409
- } else {
410
- error_log( $caller . ' : ' . $data );
411
- }
412
-
413
- } // log()
414
-
415
- }
416
-
417
- $wc_vendors = new WC_Vendors;
418
-
419
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/classes/admin/class-admin-page.php DELETED
@@ -1,826 +0,0 @@
1
- <?php
2
-
3
- class WCV_Admin_Setup
4
- {
5
- /**
6
- * WC > Referrals menu
7
- */
8
-
9
- public function __construct()
10
- {
11
- add_filter( 'set-screen-option', array( 'WCV_Admin_Setup', 'set_table_option' ), 10, 3 );
12
- add_action( 'admin_menu', array( 'WCV_Admin_Setup', 'menu' ) );
13
-
14
- add_action( 'woocommerce_admin_order_data_after_shipping_address', array( $this, 'add_vendor_details' ), 10, 2 );
15
- add_action( 'woocommerce_admin_order_actions_end', array( $this, 'append_actions' ), 10, 1 );
16
-
17
- add_filter( 'woocommerce_debug_tools', array( $this, 'wcvendors_tools' ) );
18
-
19
- add_action( 'admin_head', array( $this, 'commission_table_header_styles' ) );
20
- }
21
-
22
-
23
- public function add_vendor_details( $order )
24
- {
25
- $actions = $this->append_actions( $order, true );
26
-
27
- if (empty( $actions['wc_pv_shipped']['name'] )) {
28
- return;
29
- }
30
-
31
- echo '<h4>' . __('Vendors shipped', 'wcvendors') . '</h4><br/>';
32
- echo $actions['wc_pv_shipped']['name'];
33
- }
34
-
35
- public function append_actions( $order, $order_page = false )
36
- {
37
- global $woocommerce;
38
-
39
- $order_id = ( version_compare( WC_VERSION, '2.7', '<' ) ) ? $order->id : $order->get_id();
40
-
41
- $authors = WCV_Vendors::get_vendors_from_order( $order );
42
- $authors = $authors ? array_keys( $authors ) : array();
43
- if ( empty( $authors ) ) return false;
44
-
45
- $shipped = (array) get_post_meta( $order_id, 'wc_pv_shipped', true );
46
- $string = '</br></br>';
47
-
48
- foreach ($authors as $author ) {
49
- $string .= in_array( $author, $shipped ) ? '&#10004; ' : '&#10005; ';
50
- $string .= WCV_Vendors::get_vendor_shop_name( $author );
51
- $string .= '</br>';
52
- }
53
-
54
- $response = array(
55
- 'url' => '#',
56
- 'name' => __('Vendors Shipped', 'wcvendors') . $string,
57
- 'action' => 'wc_pv_shipped',
58
- 'image_url' => wcv_assets_url . '/images/icons/truck.png',
59
- );
60
-
61
- if ( ! $order_page ) {
62
- printf( '<a class="button tips %s" href="%s" data-tip="%s"><img style="width:16px;height:16px;" src="%s"></a>', $response['action'], $response['url'], $response['name'], $response['image_url'] );
63
- } else {
64
- echo $response['name'];
65
- }
66
-
67
- return $response;
68
- }
69
-
70
-
71
- /**
72
- * Add the commissions sub menu
73
- *
74
- * @since 1.0.0
75
- * @access public
76
- *
77
- */
78
- public static function menu()
79
- {
80
- $hook = add_submenu_page(
81
- 'woocommerce',
82
- __( 'Commission', 'wcvendors' ), __( 'Commission', 'wcvendors' ),
83
- 'manage_woocommerce',
84
- 'pv_admin_commissions',
85
- array( 'WCV_Admin_Setup', 'commissions_page' )
86
- );
87
-
88
- add_action( "load-$hook", array( 'WCV_Admin_Setup', 'add_options' ) );
89
-
90
- add_action( "admin_print_styles-$hook", array( 'WCV_Admin_Setup', 'commission_enqueue_style' ) );
91
- add_action( "admin_print_scripts-$hook", array( 'WCV_Admin_Setup', 'commission_my_enqueue_script' ) );
92
-
93
-
94
-
95
- } // menu()
96
-
97
-
98
- /**
99
- * Add tools to the woocommerce status tools page
100
- *
101
- * @since 1.9.2
102
- * @access public
103
- */
104
- public function wcvendors_tools( $tools ){
105
-
106
- $tools[ 'reset_wcvendor_roles' ] = array(
107
- 'name' => __( 'Reset WC Vendors roles ', 'wcvendors' ),
108
- 'button' => __( 'Reset WC Vendor Roles', 'wcvendors' ),
109
- 'desc' => __( 'This will reset the wcvendors roles ( vendor & pending_vendor ), back to the default capabilities.', 'wcvendors' ),
110
- 'callback' => array( 'WCV_Admin_Setup', 'reset_vendor_roles' )
111
- );
112
-
113
- $tools[ 'reset_wcvendors' ] = array(
114
- 'name' => __( 'Reset WC Vendors ', 'wcvendors' ),
115
- 'button' => __( 'Reset WC Vendors Settings', 'wcvendors' ),
116
- 'desc' => __( 'This will reset wcvendors back to defaults. This DELETES ALL YOUR Settings.', 'wcvendors' ),
117
- 'callback' => array( 'WCV_Admin_Setup', 'reset_wcvendors' )
118
- );
119
-
120
- return $tools;
121
-
122
- } // wcvendors_tools()
123
-
124
- /**
125
- * Reset the vendor roles
126
- *
127
- * @since 1.9.2
128
- * @access public
129
- */
130
- public static function reset_vendor_roles(){
131
-
132
- $can_add = WC_Vendors::$pv_options->get_option( 'can_submit_products' );
133
- $can_edit = WC_Vendors::$pv_options->get_option( 'can_edit_published_products' );
134
- $can_submit_live = WC_Vendors::$pv_options->get_option( 'can_submit_live_products' );
135
- $can_view_reports = WC_Vendors::$pv_options->get_option( 'can_view_backend_reports' );
136
-
137
- $args = array(
138
- 'assign_product_terms' => $can_add,
139
- 'edit_products' => $can_add || $can_edit,
140
- 'edit_published_products' => $can_edit,
141
- 'delete_published_products' => $can_edit,
142
- 'delete_products' => $can_edit,
143
- 'manage_product' => $can_add,
144
- 'publish_products' => $can_submit_live,
145
- 'read' => true,
146
- 'read_products' => $can_edit || $can_add,
147
- 'upload_files' => true,
148
- 'import' => true,
149
- 'view_woocommerce_reports' => false,
150
- );
151
-
152
- remove_role( 'vendor' );
153
- add_role( 'vendor', __('Vendor', 'wcvendors'), $args );
154
-
155
- remove_role( 'pending_vendor');
156
- add_role( 'pending_vendor', __( 'Pending Vendor', 'wcvendors' ), array(
157
- 'read' => true,
158
- 'edit_posts' => false,
159
- 'delete_posts' => true
160
- ) );
161
-
162
- echo '<div class="updated inline"><p>' . __( 'WC Vendor roles successfully reset.', 'wcvendors' ) . '</p></div>';
163
-
164
- } // reset_vendor_roles()
165
-
166
-
167
- /**
168
- * Reset wcvendors
169
- *
170
- * @since 1.9.2
171
- * @access public
172
- */
173
- public static function reset_wcvendors(){
174
-
175
- delete_option( WC_Vendors::$id . '_options' );
176
- echo '<div class="updated inline"><p>' . __( 'WC Vendors was successfully reset. All settings have been reset.', 'wcvendors' ) . '</p></div>';
177
-
178
- } // reset_wcvendors()
179
-
180
-
181
- public static function commission_enqueue_style(){
182
-
183
- wp_enqueue_style( 'commissions_select2_css', wcv_assets_url . 'css/select2.min.css' );
184
-
185
- } //commission_enqueue_style()
186
-
187
- public static function commission_my_enqueue_script(){
188
-
189
- $select2_args = apply_filters( 'wcvendors_select2_commission_args', array(
190
- 'placeholder' => __( 'Select a Vendor', 'wcvendors' ),
191
- 'allowclear' => true,
192
- ) );
193
-
194
- wp_enqueue_script( 'commissions_select2_styles_js', wcv_assets_url. 'js/select2.min.js', array('jquery') );
195
-
196
- wp_register_script( 'commissions_select2_load_js', wcv_assets_url. 'js/wcv-commissions.js', array('jquery') );
197
- wp_localize_script( 'commissions_select2_load_js', 'wcv_commissions_select', $select2_args );
198
- wp_enqueue_script( 'commissions_select2_load_js' );
199
-
200
- }
201
-
202
- /**
203
- * Load styles for the commissions table page
204
- */
205
- public function commission_table_header_styles() {
206
-
207
- $page = ( isset( $_GET[ 'page' ] ) ) ? esc_attr( $_GET[ 'page' ] ) : false;
208
-
209
- // Only load the styles on the license table page
210
-
211
- if ( 'pv_admin_commissions' !== $page ) return;
212
-
213
- echo '<style type="text/css">';
214
- echo '.wp-list-table .column-product_id { width: 20%; }';
215
- echo '.wp-list-table .column-vendor_id { width: 15%; }';
216
- echo '.wp-list-table .column-order_id { width: 8%; }';
217
- echo '.wp-list-table .column-total_due { width: 10%;}';
218
- echo '.wp-list-table .column-total_shipping { width: 10%;}';
219
- echo '.wp-list-table .column-tax { width: 10%;}';
220
- echo '.wp-list-table .column-totals { width: 10%;}';
221
- echo '.wp-list-table .column-status { width: 5%;}';
222
- echo '.wp-list-table .column-time { width: 10%;}';
223
- echo '</style>';
224
-
225
- } //table_header_styles()
226
-
227
- /**
228
- *
229
- *
230
- * @param unknown $status
231
- * @param unknown $option
232
- * @param unknown $value
233
- *
234
- * @return unknown
235
- */
236
- public static function set_table_option( $status, $option, $value )
237
- {
238
- if ( $option == 'commission_per_page' ) {
239
- return $value;
240
- }
241
- }
242
-
243
-
244
- /**
245
- *
246
- */
247
- public static function add_options()
248
- {
249
- global $PV_Admin_Page;
250
-
251
- $args = array(
252
- 'label' => 'Rows',
253
- 'default' => 10,
254
- 'option' => 'commission_per_page'
255
- );
256
- add_screen_option( 'per_page', $args );
257
-
258
- $PV_Admin_Page = new WCV_Admin_Page();
259
-
260
- }
261
-
262
-
263
- /**
264
- * HTML setup for the WC > Commission page
265
- */
266
- public static function commissions_page()
267
- {
268
- global $woocommerce, $PV_Admin_Page;
269
-
270
-
271
-
272
- ?>
273
-
274
- <div class="wrap">
275
-
276
- <div id="icon-woocommerce" class="icon32 icon32-woocommerce-reports"><br/></div>
277
- <h2><?php _e( 'Commission', 'wcvendors' ); ?></h2>
278
-
279
- <form id="posts-filter" method="get">
280
-
281
- <?php
282
- $page = filter_input( INPUT_GET, 'page', FILTER_SANITIZE_STRIPPED );
283
- $paged = filter_input( INPUT_GET, 'paged', FILTER_SANITIZE_NUMBER_INT );
284
-
285
- printf( '<input type="hidden" name="page" value="%s" />', $page );
286
- printf( '<input type="hidden" name="paged" value="%d" />', $paged );
287
- ?>
288
-
289
- <input type="hidden" name="page" value="pv_admin_commissions"/>
290
-
291
- <?php $PV_Admin_Page->prepare_items(); ?>
292
- <?php $PV_Admin_Page->display() ?>
293
-
294
- </form>
295
- <div id="ajax-response"></div>
296
- <br class="clear"/>
297
- </div>
298
- <?php
299
- }
300
-
301
-
302
- }
303
-
304
-
305
- if ( !class_exists( 'WP_List_Table' ) ) require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php';
306
-
307
- /**
308
- * WC_Simple_Referral_Admin class.
309
- *
310
- * @extends WP_List_Table
311
- */
312
- class WCV_Admin_Page extends WP_List_Table
313
- {
314
-
315
- public $index;
316
-
317
-
318
- /**
319
- * __construct function.
320
- *
321
- * @access public
322
- */
323
- function __construct()
324
- {
325
- global $status, $page;
326
-
327
- $this->index = 0;
328
-
329
- //Set parent defaults
330
- parent::__construct( array(
331
- 'singular' => 'commission',
332
- 'plural' => 'commissions',
333
- 'ajax' => false
334
- ) );
335
- }
336
-
337
-
338
- /**
339
- * column_default function.
340
- *
341
- * @access public
342
- *
343
- * @param unknown $item
344
- * @param mixed $column_name
345
- *
346
- * @return unknown
347
- */
348
- function column_default( $item, $column_name )
349
- {
350
- global $wpdb;
351
-
352
- switch ( $column_name ) {
353
- case 'id' :
354
- return $item->id;
355
- case 'vendor_id' :
356
- $user = get_userdata( $item->vendor_id );
357
- return '<a href="' . admin_url( 'user-edit.php?user_id=' . $item->vendor_id ) . '">' . WCV_Vendors::get_vendor_shop_name( $item->vendor_id ) . '</a>';
358
- case 'total_due' :
359
- return wc_price( $item->total_due );
360
- case 'total_shipping':
361
- return wc_price($item->total_shipping );
362
- case 'tax':
363
- return wc_price( $item->tax );
364
- case 'totals' :
365
- $totals = ( wc_tax_enabled() ) ? $item->total_due + $item->total_shipping + $item->tax : $item->total_due + $item->total_shipping;
366
- return wc_price( $totals );
367
- case 'product_id' :
368
- $parent = get_post_ancestors( $item->product_id );
369
- $product_id = $parent ? $parent[ 0 ] : $item->product_id;
370
- $wcv_total_sales = get_post_meta( $product_id, 'total_sales', true );
371
- return '<a href="' . admin_url( 'post.php?post=' . $product_id . '&action=edit' ) . '">' . get_the_title( $item->product_id ) . '</a> (<span title="' . get_the_title( $item->product_id ) .' has sold ' . $wcv_total_sales . ' times total.">' . $wcv_total_sales . '</span>)';
372
- case 'order_id' :
373
- $order = new WC_Order( $item->order_id );
374
- return '<a href="' . admin_url( 'post.php?post=' . $item->order_id . '&action=edit' ) . '">' . $order->get_order_number() . '</a>';
375
- case 'status' :
376
- return $item->status;
377
- case 'time' :
378
- return date_i18n( get_option( 'date_format' ), strtotime( $item->time ) );
379
- }
380
- }
381
-
382
-
383
- /**
384
- * column_cb function.
385
- *
386
- * @access public
387
- *
388
- * @param mixed $item
389
- *
390
- * @return unknown
391
- */
392
- function column_cb( $item )
393
- {
394
- return sprintf(
395
- '<input type="checkbox" name="%1$s[]" value="%2$s" />',
396
- /*$1%s*/
397
- 'id',
398
- /*$2%s*/
399
- $item->id
400
- );
401
- }
402
-
403
-
404
- /**
405
- * get_columns function.
406
- *
407
- * @access public
408
- * @return unknown
409
- */
410
- function get_columns()
411
- {
412
- $columns = array(
413
- 'cb' => '<input type="checkbox" />',
414
- 'product_id' => __( 'Product', 'wcvendors' ),
415
- 'order_id' => __( 'Order ID', 'wcvendors' ),
416
- 'vendor_id' => __( 'Vendor', 'wcvendors' ),
417
- 'total_due' => __( 'Commission', 'wcvendors' ),
418
- 'total_shipping' => __( 'Shipping', 'wcvendors' ),
419
- 'tax' => __( 'Tax', 'wcvendors' ),
420
- 'totals' => __( 'Total', 'wcvendors' ),
421
- 'status' => __( 'Status', 'wcvendors' ),
422
- 'time' => __( 'Date', 'wcvendors' ),
423
- );
424
-
425
- if ( ! wc_tax_enabled() ) unset( $columns[ 'tax'] );
426
-
427
- return $columns;
428
- }
429
-
430
-
431
- /**
432
- * get_sortable_columns function.
433
- *
434
- * @access public
435
- * @return unknown
436
- */
437
- function get_sortable_columns()
438
- {
439
- $sortable_columns = array(
440
- 'time' => array( 'time', true ),
441
- 'product_id' => array( 'product_id', false ),
442
- 'order_id' => array( 'order_id', false ),
443
- 'total_due' => array( 'total_due', false ),
444
- 'total_shipping' => array( 'total_shipping', false ),
445
- 'tax' => array( 'tax', false ),
446
- 'totals' => array( 'totals', false ),
447
- 'status' => array( 'status', false ),
448
- 'vendor_id' => array( 'vendor_id', false ),
449
- 'status' => array( 'status', false ),
450
- );
451
-
452
- if ( ! wc_tax_enabled() ) unset( $sortable_columns[ 'tax'] );
453
-
454
- return $sortable_columns;
455
- }
456
-
457
-
458
- /**
459
- * Get bulk actions
460
- *
461
- * @return unknown
462
- */
463
- function get_bulk_actions()
464
- {
465
- $actions = array(
466
- 'mark_paid' => __( 'Mark paid', 'wcvendors' ),
467
- 'mark_due' => __( 'Mark due', 'wcvendors' ),
468
- 'mark_reversed' => __( 'Mark reversed', 'wcvendors' ),
469
- // 'delete' => __('Delete', 'wcvendors'),
470
- );
471
-
472
- $actions = apply_filters('wcv_edit_bulk_actions', $actions);
473
-
474
- return $actions;
475
- }
476
-
477
-
478
- /**
479
- *
480
- */
481
- function extra_tablenav( $which )
482
- {
483
- if ( $which == 'top' ) {
484
- ?><div class="alignleft actions" style="width: 70%;">
485
- <?php
486
- // Months drop down
487
- $this->months_dropdown( 'commission' );
488
-
489
- // commission status drop down
490
- $this->status_dropdown( 'commission' );
491
-
492
- // Vendor drop down
493
- $this->vendor_dropdown( 'commission' );
494
-
495
- submit_button( __( 'Filter' ), false, false, false, array( 'id' => "post-query-submit", 'name' => 'do-filter' ) );
496
- ?></div>
497
- <?php
498
- }
499
- }
500
-
501
-
502
- /**
503
- * Display a monthly dropdown for filtering items
504
- *
505
- * @since 3.1.0
506
- * @access protected
507
- *
508
- * @param unknown $post_type
509
- */
510
- function months_dropdown( $post_type )
511
- {
512
- global $wpdb, $wp_locale;
513
-
514
- $table_name = $wpdb->prefix . "pv_commission";
515
-
516
- $months = $wpdb->get_results( "
517
- SELECT DISTINCT YEAR( time ) AS year, MONTH( time ) AS month
518
- FROM $table_name
519
- ORDER BY time DESC
520
- " );
521
-
522
- $month_count = count( $months );
523
-
524
- if ( !$month_count || ( 1 == $month_count && 0 == $months[ 0 ]->month ) )
525
- return;
526
-
527
- $m = isset( $_GET[ 'm' ] ) ? (int) $_GET[ 'm' ] : 0;
528
- ?>
529
- <select name="m" id="filter-by-date">
530
- <option<?php selected( $m, 0 ); ?> value='0'><?php _e( 'Show all dates', 'wcvendors' ); ?></option>
531
- <?php
532
- foreach ( $months as $arc_row ) {
533
- if ( 0 == $arc_row->year )
534
- continue;
535
-
536
- $month = zeroise( $arc_row->month, 2 );
537
- $year = $arc_row->year;
538
-
539
- printf( "<option %s value='%s'>%s</option>\n",
540
- selected( $m, $year . $month, false ),
541
- esc_attr( $arc_row->year . $month ),
542
- /* translators: 1: month name, 2: 4-digit year */
543
- sprintf( __( '%1$s %2$d' ), $wp_locale->get_month( $month ), $year )
544
- );
545
- }
546
- ?>
547
- </select>
548
-
549
- <?php
550
- }
551
-
552
- /**
553
- * Display a status dropdown for filtering items
554
- *
555
- * @since 3.1.0
556
- * @access protected
557
- *
558
- * @param unknown $post_type
559
- */
560
- function status_dropdown( $post_type )
561
- {
562
- $com_status = isset( $_GET[ 'com_status' ] ) ? $_GET[ 'com_status' ] : '';
563
- ?>
564
- <select name="com_status">
565
- <option<?php selected( $com_status, '' ); ?> value=''><?php _e( 'Show all Statuses', 'wcvendors' ); ?></option>
566
- <option<?php selected( $com_status, 'due' ); ?> value="due"><?php _e( 'Due', 'wcvendors' ); ?></option>
567
- <option<?php selected( $com_status, 'paid' ); ?> value="paid"><?php _e( 'Paid', 'wcvendors' ); ?></option>
568
- <option<?php selected( $com_status, 'reversed' ); ?> value="reversed"><?php _e( 'Reversed', 'wcvendors' ); ?></option>
569
- </select>
570
- <?php
571
- }
572
-
573
- /**
574
- * Display a vendor dropdown for filtering commissions
575
- *
576
- * @since 1.9.2
577
- * @access public
578
- *
579
- * @param unknown $post_type
580
- */
581
- public function vendor_dropdown( $post_type ){
582
-
583
- $user_args = array( 'fields' => array( 'ID', 'display_name' ) );
584
- $vendor_id = isset( $_GET[ 'vendor_id' ] ) ? $_GET[ 'vendor_id' ] : '';
585
- $new_args = $user_args;
586
- $new_args[ 'role' ] = 'vendor';
587
- $users = get_users( $new_args );
588
-
589
- // Generate the drop down
590
- $output = '<select style="width: 30%;" name="vendor_id" id="vendor_id" class="select2">';
591
- $output .= "<option></option>";
592
- foreach ( (array) $users as $user ) {
593
- $select = selected( $user->ID, $vendor_id, false );
594
- $output .= "<option value='$user->ID' $select>$user->display_name</option>";
595
- }
596
- $output .= '</select>';
597
-
598
- echo $output;
599
-
600
- } // vendor_dropdown()
601
-
602
-
603
-
604
- /**
605
- * Process bulk actions
606
- *
607
- * @return unknown
608
- */
609
- function process_bulk_action()
610
- {
611
- if ( !isset( $_GET[ 'id' ] ) ) return;
612
-
613
- $items = array_map( 'intval', $_GET[ 'id' ] );
614
- $ids = implode( ',', $items );
615
-
616
- switch ( $this->current_action() ) {
617
- case 'mark_paid':
618
- $result = $this->mark_paid( $ids );
619
-
620
- if ( $result )
621
- echo '<div class="updated"><p>' . __( 'Commission marked paid.', 'wcvendors' ) . '</p></div>';
622
- break;
623
-
624
- case 'mark_due':
625
- $result = $this->mark_due( $ids );
626
-
627
- if ( $result )
628
- echo '<div class="updated"><p>' . __( 'Commission marked due.', 'wcvendors' ) . '</p></div>';
629
- break;
630
-
631
- case 'mark_reversed':
632
- $result = $this->mark_reversed( $ids );
633
-
634
- if ( $result )
635
- echo '<div class="updated"><p>' . __( 'Commission marked reversed.', 'wcvendors' ) . '</p></div>';
636
- break;
637
-
638
- default:
639
- // code...
640
- do_action('wcv_edit_process_bulk_actions', $this->current_action(), $ids);
641
- break;
642
- }
643
-
644
- }
645
-
646
-
647
- /**
648
- *
649
- *
650
- * @param unknown $ids (optional)
651
- *
652
- * @return unknown
653
- */
654
- public function mark_paid( $ids = array() )
655
- {
656
- global $wpdb;
657
-
658
- $table_name = $wpdb->prefix . "pv_commission";
659
-
660
- $query = "UPDATE `{$table_name}` SET `status` = 'paid' WHERE id IN ($ids) AND `status` = 'due'";
661
- $result = $wpdb->query( $query );
662
-
663
- return $result;
664
- }
665
-
666
-
667
- /**
668
- *
669
- *
670
- * @param unknown $ids (optional)
671
- *
672
- * @return unknown
673
- */
674
- public function mark_reversed( $ids = array() )
675
- {
676
- global $wpdb;
677
-
678
- $table_name = $wpdb->prefix . "pv_commission";
679
- $query = "UPDATE `{$table_name}` SET `status` = 'reversed' WHERE id IN ($ids)";
680
- $result = $wpdb->query( $query );
681
-
682
- return $result;
683
-
684
- }
685
-
686
-
687
- /**
688
- *
689
- *
690
- * @param unknown $ids (optional)
691
- *
692
- * @return unknown
693
- */
694
- public function mark_due( $ids = array() )
695
- {
696
- global $wpdb;
697
-
698
- $table_name = $wpdb->prefix . "pv_commission";
699
-
700
- $query = "UPDATE `{$table_name}` SET `status` = 'due' WHERE id IN ($ids)";
701
- $result = $wpdb->query( $query );
702
-
703
- return $result;
704
- }
705
-
706
-
707
- /**
708
- * prepare_items function.
709
- *
710
- * @access public
711
- */
712
- function prepare_items()
713
- {
714
- global $wpdb;
715
-
716
- $_SERVER['REQUEST_URI'] = remove_query_arg( '_wp_http_referer', $_SERVER['REQUEST_URI'] );
717
-
718
- $per_page = $this->get_items_per_page( 'commission_per_page', 10 );
719
- $current_page = $this->get_pagenum();
720
-
721
- $orderby = !empty( $_REQUEST[ 'orderby' ] ) ? esc_attr( $_REQUEST[ 'orderby' ] ) : 'time';
722
- $order = ( !empty( $_REQUEST[ 'order' ] ) && $_REQUEST[ 'order' ] == 'asc' ) ? 'ASC' : 'DESC';
723
- $com_status = !empty( $_REQUEST[ 'com_status' ] ) ? esc_attr( $_REQUEST[ 'com_status' ] ) : '';
724
- $vendor_id = !empty( $_REQUEST[ 'vendor_id' ] ) ? esc_attr( $_REQUEST[ 'vendor_id' ] ) : '';
725
- $status_sql = '';
726
- $time_sql = '';
727
-
728
- /**
729
- * Init column headers
730
- */
731
- $this->_column_headers = $this->get_column_info();
732
-
733
- /**
734
- * Process bulk actions
735
- */
736
- $this->process_bulk_action();
737
-
738
- /**
739
- * Get items
740
- */
741
- $sql = "SELECT COUNT(id) FROM {$wpdb->prefix}pv_commission";
742
-
743
- if ( !empty( $_GET[ 'm' ] ) ) {
744
-
745
- $year = substr( $_GET[ 'm' ], 0, 4 );
746
- $month = substr( $_GET[ 'm' ], 4, 2 );
747
-
748
- $time_sql = "
749
- WHERE MONTH(`time`) = '$month'
750
- AND YEAR(`time`) = '$year'
751
- ";
752
-
753
- $sql .= $time_sql;
754
- }
755
-
756
- if ( !empty( $_GET[ 'com_status' ] ) ) {
757
-
758
- if ( $time_sql == '' ) {
759
- $status_sql = "
760
- WHERE status = '$com_status'
761
- ";
762
- } else {
763
- $status_sql = "
764
- AND status = '$com_status'
765
- ";
766
- }
767
-
768
- $sql .= $status_sql;
769
- }
770
-
771
-
772
- if ( !empty( $_GET[ 'vendor_id' ] ) ) {
773
-
774
- if ( $time_sql == '' || $status_sql == '' ) {
775
- $vendor_sql = "
776
- WHERE vendor_id = '$vendor_id'
777
- ";
778
- } else {
779
- $vendor_sql = "
780
- AND vendor_id = '$vendor_id'
781
- ";
782
- }
783
-
784
- $sql .= $vendor_sql;
785
- }
786
-
787
- $max = $wpdb->get_var( $sql );
788
-
789
- $sql = "
790
- SELECT * FROM {$wpdb->prefix}pv_commission
791
- ";
792
-
793
- if ( !empty( $_GET[ 'm' ] ) ) {
794
- $sql .= $time_sql;
795
- }
796
-
797
- if ( !empty( $_GET['com_status'] ) ) {
798
- $sql .= $status_sql;
799
- }
800
-
801
- if ( !empty( $_GET['vendor_id'] ) ) {
802
- $sql .= $vendor_sql;
803
- }
804
-
805
- $offset = ( $current_page - 1 ) * $per_page;
806
-
807
- $sql .= "
808
- ORDER BY `{$orderby}` {$order}
809
- LIMIT {$offset}, {$per_page}
810
- ";
811
-
812
- // $this->items = $wpdb->get_results( $wpdb->prepare( $sql, ( $current_page - 1 ) * $per_page, $per_page ) );
813
- $this->items = $wpdb->get_results( $sql );
814
-
815
- /**
816
- * Pagination
817
- */
818
- $this->set_pagination_args( array(
819
- 'total_items' => $max,
820
- 'per_page' => $per_page,
821
- 'total_pages' => ceil( $max / $per_page )
822
- ) );
823
- }
824
-
825
-
826
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/classes/admin/class-admin-reports.php DELETED
@@ -1,549 +0,0 @@
1
- <?php
2
- /**
3
- * WCV_Admin_Reports class.
4
- *
5
- * Shows reports related to software in the woocommerce backend
6
- *
7
- * @author Matt Gates <http://mgates.me>
8
- * @package
9
- */
10
-
11
-
12
- class WCV_Admin_Reports
13
- {
14
-
15
-
16
- /**
17
- * __construct function.
18
- *
19
- * @access public
20
- * @return void
21
- *
22
- * @param bool $debug (optional) (default: false)
23
- */
24
- function __construct( $debug = false )
25
- {
26
- add_filter( 'woocommerce_admin_reports', array( $this, 'reports_tab' ) );
27
- }
28
-
29
- /**
30
- * reports_tab function.
31
- *
32
- * @access public
33
- *
34
- * @param unknown $reports
35
- *
36
- * @return void
37
- */
38
- function reports_tab( $reports )
39
- {
40
- $reports[ 'vendors' ] = array(
41
- 'title' => __( 'WC Vendors', 'wcvendors' ),
42
- 'charts' => array(
43
- array(
44
- 'title' => __( 'Overview', 'wcvendors' ),
45
- 'description' => '',
46
- 'hide_title' => true,
47
- 'function' => array( $this, 'sales' ),
48
- ),
49
- array(
50
- 'title' => __( 'Commission by vendor', 'wcvendors' ),
51
- 'description' => '',
52
- 'hide_title' => true,
53
- 'function' => array( $this, 'commission' ),
54
- ),
55
- array(
56
- 'title' => __( 'Commission by product', 'wcvendors' ),
57
- 'description' => '',
58
- 'hide_title' => true,
59
- 'function' => array( $this, 'commission' ),
60
- ),
61
- array(
62
- 'title' => __( 'Commission Totals', 'wcvendors' ),
63
- 'description' => __( 'Commission totals for all vendors includes shipping and taxes. By default no date range is used and all due commissions are returned. Use the date range to filter.', 'wcvendors' ),
64
- 'hide_title' => true,
65
- 'function' => array( $this, 'commission_totals' ),
66
- ),
67
- ),
68
- );
69
-
70
- return $reports;
71
- }
72
-
73
- public function products()
74
- {
75
- # code...
76
- }
77
-
78
-
79
- /**
80
- *
81
- */
82
- function sales()
83
- {
84
-
85
- global $start_date, $end_date, $woocommerce, $wpdb;
86
-
87
- $commission_status_labels = WCV_Commission::commission_status();
88
-
89
- $start_date = !empty( $_POST[ 'start_date' ] ) ? $_POST[ 'start_date' ] : strtotime( date( 'Ymd', strtotime( date( 'Ym', current_time( 'timestamp' ) ) . '01' ) ) );
90
- $end_date = !empty( $_POST[ 'end_date' ] ) ? $_POST[ 'end_date' ] : strtotime( date( 'Ymd', current_time( 'timestamp' ) ) );
91
-
92
- if ( !empty( $_POST[ 'start_date' ] ) ) {
93
- $start_date = strtotime( $_POST[ 'start_date' ] );
94
- }
95
-
96
- if ( !empty( $_POST[ 'end_date' ] ) ) {
97
- $end_date = strtotime( $_POST[ 'end_date' ] );
98
- }
99
-
100
- $after = date( 'Y-m-d', $start_date );
101
- $before = date( 'Y-m-d', strtotime( '+1 day', $end_date ) );
102
-
103
- $commission_due = $wpdb->get_var( "
104
- SELECT SUM(total_due + total_shipping + tax) FROM {$wpdb->prefix}pv_commission WHERE status = 'due'
105
- AND time >= '" . $after . "'
106
- AND time <= '" . $before . "'
107
- " );
108
-
109
- $reversed = $wpdb->get_var( "
110
- SELECT SUM(total_due + total_shipping + tax) FROM {$wpdb->prefix}pv_commission WHERE status = 'reversed'
111
- AND time >= '" . $after . "'
112
- AND time <= '" . $before . "'
113
- " );
114
-
115
- $paid = $wpdb->get_var( "
116
- SELECT SUM(total_due + total_shipping + tax) FROM {$wpdb->prefix}pv_commission WHERE status = 'paid'
117
- AND time >= '" . $after . "'
118
- AND time <= '" . $before . "'
119
- " );
120
-
121
- ?>
122
-
123
- <form method="post" action="">
124
- <p><label for="from"><?php _e( 'From:', 'wcvendors' ); ?></label>
125
- <input type="text" size="9" placeholder="yyyy-mm-dd" value="<?php echo esc_attr( date( 'Y-m-d', $start_date ) ); ?>" name="start_date" class="range_datepicker from" id="from" />
126
- <label for="to"><?php _e( 'To:', 'wcvendors' ); ?></label>
127
- <input type="text" size="9" placeholder="yyyy-mm-dd" value="<?php echo esc_attr( date( 'Y-m-d', $end_date ) ); ?>" name="end_date" class="range_datepicker to" id="to" />
128
- <input type="submit" class="button" value="<?php _e( 'Show', 'wcvendors' ); ?>"/></p>
129
- </form>
130
-
131
- <div id="poststuff" class="woocommerce-reports-wrap">
132
- <div class="woocommerce-reports-sidebar">
133
- <div class="postbox">
134
- <h3><span><?php _e( 'Total paid in range', 'wcvendors' ); ?></span></h3>
135
-
136
- <div class="inside">
137
- <p class="stat"><?php if ( $paid > 0 ) echo wc_price( $paid ); else _e( 'n/a', 'wcvendors' ); ?></p>
138
- </div>
139
- </div>
140
- <div class="postbox">
141
- <h3><span><?php _e( 'Total due in range', 'wcvendors' ); ?></span></h3>
142
-
143
- <div class="inside">
144
- <p class="stat"><?php if ( $commission_due > 0 ) echo wc_price( $commission_due ); else _e( 'n/a', 'wcvendors' ); ?></p>
145
- </div>
146
- </div>
147
- <div class="postbox">
148
- <h3><span><?php _e( 'Total reversed in range', 'wcvendors' ); ?></span></h3>
149
-
150
- <div class="inside">
151
- <p class="stat"><?php if ( $reversed > 0 ) echo wc_price( $reversed ); else _e( 'n/a', 'wcvendors' ); ?></p>
152
- </div>
153
- </div>
154
- </div>
155
-
156
- <div class="woocommerce-reports-main">
157
- <div class="postbox">
158
- <h3><span><?php _e( 'Recent Commission', 'wcvendors' ); ?></span></h3>
159
-
160
- <div>
161
- <?php
162
- $commission = $wpdb->get_results( "
163
- SELECT * FROM {$wpdb->prefix}pv_commission
164
- WHERE time >= '" . $after . "'
165
- AND time <= '" . $before . "'
166
- ORDER BY time DESC
167
- " );
168
-
169
- if ( sizeof( $commission ) > 0 ) {
170
-
171
- ?>
172
- <div class="woocommerce_order_items_wrapper">
173
- <table id="commission-table" class="woocommerce_order_items" cellspacing="0">
174
- <thead>
175
- <tr>
176
- <th><?php _e( 'Order', 'wcvendors' ) ?></th>
177
- <th><?php _e( 'Product', 'wcvendors' ) ?></th>
178
- <th><?php _e( 'Vendor', 'wcvendors' ) ?></th>
179
- <th><?php _e( 'Total', 'wcvendors' ) ?></th>
180
- <th><?php _e( 'Date &amp; Time', 'wcvendors' ) ?></th>
181
- <th><?php _e( 'Status', 'wcvendors' ) ?></th>
182
- </tr>
183
- </thead>
184
- <tbody>
185
- <?php $i = 1;
186
- foreach ( $commission as $row ) : $i++ ?>
187
- <tr<?php if ( $i % 2 == 1 ) echo ' class="alternate"' ?>>
188
- <td><?php if ( $row->order_id ) : ?><a
189
- href="<?php echo admin_url( 'post.php?post=' . $row->order_id . '&action=edit' ); ?>"><?php echo $row->order_id; ?></a><?php else : _e( 'N/A', 'wcvendors' ); endif; ?>
190
- </td>
191
- <td><?php echo get_the_title( $row->product_id ); ?></td>
192
- <td><?php echo WCV_Vendors::get_vendor_shop_name( $row->vendor_id ); ?></td>
193
- <td><?php echo wc_price( $row->total_due + $row->total_shipping + $row->tax ) ?></td>
194
- <td><?php echo date_i18n( __( 'D j M Y \a\t h:ia', 'wcvendors' ), strtotime( $row->time ) ) ?></td>
195
- <td><?php echo $commission_status_labels[ $row->status ]; ?></td>
196
- </tr>
197
- <?php endforeach; ?>
198
- </tbody>
199
- </table>
200
- </div>
201
- <?php
202
- } else {
203
- ?><p><?php _e( 'No commission yet', 'wcvendors' ) ?></p><?php
204
- }
205
- ?>
206
- </div>
207
- </div>
208
- </div>
209
- </div>
210
- <?php
211
-
212
- }
213
-
214
-
215
- /**
216
- *
217
- */
218
- function commission()
219
- {
220
- global $start_date, $end_date, $woocommerce, $wpdb;
221
-
222
- $latest_woo = version_compare( $woocommerce->version, '2.3', '>' );
223
-
224
- $first_year = $wpdb->get_var( "SELECT time FROM {$wpdb->prefix}pv_commission ORDER BY time ASC LIMIT 1;" );
225
- $first_year = $first_year ? date( 'Y', strtotime( $first_year ) ) : date( 'Y' );
226
- $current_year = isset( $_POST[ 'show_year' ] ) ? $_POST[ 'show_year' ] : date( 'Y', current_time( 'timestamp' ) );
227
- $start_date = strtotime( $current_year . '0101' );
228
-
229
- $vendors = get_users( array( 'role' => 'vendor' ) );
230
- $vendors = apply_filters( 'pv_commission_vendors_list', $vendors );
231
- $selected_vendor = !empty( $_POST[ 'show_vendor' ] ) ? (int) $_POST[ 'show_vendor' ] : false;
232
- $products = !empty( $_POST[ 'product_ids' ] ) ? (array) $_POST[ 'product_ids' ] : array();
233
-
234
- ?>
235
-
236
- <form method="post" action="" class="report_filters">
237
- <label for="show_year"><?php _e( 'Show:', 'wcvendors' ); ?></label>
238
- <select name="show_year" id="show_year">
239
- <?php
240
- for ( $i = $first_year; $i <= date( 'Y' ); $i++ )
241
- printf( '<option value="%s" %s>%s</option>', $i, selected( $current_year, $i, false ), $i );
242
- ?>
243
- </select>
244
- <?php if ( $_GET[ 'report' ] == 2 ) {
245
- if ($latest_woo) { ?>
246
- <input type="hidden" class="wc-product-search" style="width:203px;" name="product_ids[]" data-placeholder="<?php _e( 'Search for a product&hellip;', 'woocommerce' ); ?>" data-action="woocommerce_json_search_products_and_variations" />
247
- <?php } else { ?>
248
- <select id="product_ids" name="product_ids[]" class="ajax_chosen_select_products" multiple="multiple"
249
- data-placeholder="<?php _e( 'Type in a product name to start searching...', 'wcvendors' ); ?>"
250
- style="width: 400px;"></select>
251
- <script type="text/javascript">
252
- jQuery(function () {
253
-
254
- // Ajax Chosen Product Selectors
255
- jQuery("select.ajax_chosen_select_products").ajaxChosen({
256
- method: 'GET',
257
- url: '<?php echo admin_url('admin-ajax.php'); ?>',
258
- dataType: 'json',
259
- afterTypeDelay: 100,
260
- data: {
261
- action: 'woocommerce_json_search_products',
262
- security: '<?php echo wp_create_nonce("search-products"); ?>'
263
- }
264
- }, function (data) {
265
-
266
- var terms = {};
267
-
268
- jQuery.each(data, function (i, val) {
269
- terms[i] = val;
270
- });
271
-
272
- return terms;
273
- });
274
-
275
- });
276
- </script>
277
-
278
- <?php }
279
- } else { ?>
280
- <select class="chosen_select" id="show_vendor" name="show_vendor" style="width: 300px;"
281
- data-placeholder="<?php _e( 'Select a vendor&hellip;', 'wcvendors' ); ?>">
282
- <option></option>
283
- <?php foreach ( $vendors as $key => $vendor ) printf( '<option value="%s" %s>%s</option>', $vendor->ID, selected( $selected_vendor, $vendor->ID, false ), $vendor->display_name ); ?>
284
- </select>
285
- <?php } ?>
286
- <input type="submit" class="button" value="<?php _e( 'Show', 'wcvendors' ); ?>"/>
287
- </form>
288
-
289
- <?php
290
-
291
- if ( !empty( $selected_vendor ) || !empty( $products ) ) {
292
-
293
- foreach ($products as $key => $product_id) {
294
- $_product = wc_get_product($product_id);
295
- $childs = $_product->get_children();
296
- $products = array_merge($childs, $products);
297
- }
298
-
299
- $commissions = array();
300
- $filter = !empty( $selected_vendor ) ? (" WHERE vendor_id = " . $selected_vendor) : (" WHERE product_id IN ( " . implode( ', ', $products ) ." )");
301
-
302
- $sql = "SELECT
303
- SUM(total_due + total_shipping + tax) as total,
304
- SUM(total_due) as commission,
305
- SUM(total_shipping) as shipping,
306
- SUM(tax) as tax
307
- FROM {$wpdb->prefix}pv_commission
308
- ";
309
-
310
- $paid_sql = "SELECT SUM(total_due + total_shipping + tax) FROM {$wpdb->prefix}pv_commission " . $filter . " AND status = 'paid'";
311
- $reversed_sql = "SELECT SUM(total_due + total_shipping + tax) FROM {$wpdb->prefix}pv_commission" . $filter . " AND status = 'reversed'";
312
- $date_sql = " AND date_format(`time`,'%%Y%%m') = %d";
313
-
314
- for ( $count = 0; $count < 12; $count++ ) {
315
- $time = strtotime( date( 'Ym', strtotime( '+ ' . $count . ' MONTH', $start_date ) ) . '01' );
316
- if ( $time > current_time( 'timestamp' ) ) continue;
317
-
318
- $month = date( 'Ym', strtotime( date( 'Ym', strtotime( '+ ' . $count . ' MONTH', $start_date ) ) . '01' ) );
319
-
320
- $fetch_results = $wpdb->prepare( $sql . $filter . $date_sql, $month );
321
-
322
- $results = $wpdb->get_results( $fetch_results );
323
- if ( !empty( $results[ 0 ] ) ) {
324
- extract( get_object_vars( $results[ 0 ] ) );
325
- }
326
-
327
- $paid = $wpdb->get_var( $wpdb->prepare( $paid_sql . $date_sql, $month ) );
328
- $reversed = $wpdb->get_var( $wpdb->prepare( $reversed_sql . $date_sql, $month ) );
329
-
330
- $commissions[ date( 'M', strtotime( $month . '01' ) ) ] = array(
331
- 'commission' => $commission,
332
- 'tax' => $tax,
333
- 'shipping' => $shipping,
334
- 'reversed' => $reversed,
335
- 'paid' => $paid,
336
- 'total' => $total - $reversed - $paid,
337
- );
338
-
339
- }
340
-
341
- ?>
342
-
343
- <div class="woocommerce-reports-main">
344
- <table class="widefat">
345
- <thead>
346
- <tr>
347
- <th><?php _e( 'Month', 'wcvendors' ); ?></th>
348
- <th class="total_row"><?php _e( 'Commission Totals', 'wcvendors' ); ?></th>
349
- <th class="total_row"><?php _e( 'Tax', 'wcvendors' ); ?></th>
350
- <th class="total_row"><?php _e( 'Shipping', 'wcvendors' ); ?></th>
351
- <th class="total_row"><?php _e( 'Reversed', 'wcvendors' ); ?></th>
352
- <th class="total_row"><?php _e( 'Paid', 'wcvendors' ); ?></th>
353
- <th class="total_row"><?php _e( 'Due', 'wcvendors' ); ?></th>
354
- </tr>
355
- </thead>
356
- <tfoot>
357
- <tr>
358
- <?php
359
- $total = array(
360
- 'commission' => 0,
361
- 'tax' => 0,
362
- 'shipping' => 0,
363
- 'reversed' => 0,
364
- 'paid' => 0,
365
- 'total' => 0,
366
- );
367
-
368
- foreach ( $commissions as $month => $commission ) {
369
- $total[ 'commission' ] += $commission[ 'commission' ];
370
- $total[ 'tax' ] += $commission[ 'tax' ];
371
- $total[ 'shipping' ] += $commission[ 'shipping' ];
372
- $total[ 'reversed' ] += $commission[ 'reversed' ];
373
- $total[ 'paid' ] += $commission[ 'paid' ];
374
- $total[ 'total' ] += $commission[ 'total' ];
375
- }
376
-
377
- echo '<td>' . __( 'Total', 'wcvendors' ) . '</td>';
378
-
379
- foreach ( $total as $value ) {
380
- echo '<td class="total_row">' . wc_price( $value ) . '</td>';
381
- }
382
- ?>
383
- </tr>
384
- </tfoot>
385
- <tbody>
386
- <?php
387
- foreach ( $commissions as $month => $commission ) {
388
- $alt = ( isset( $alt ) && $alt == 'alt' ) ? '' : 'alt';
389
-
390
- echo '<tr class="' . $alt . '"><td>' . $month . '</td>';
391
-
392
- foreach ( $commission as $value ) {
393
- echo '<td class="total_row">' . wc_price( $value ) . '</td>';
394
- }
395
-
396
- echo '</tr>';
397
- }
398
- ?>
399
- </tbody>
400
- </table>
401
- </div>
402
-
403
- <?php } ?>
404
- <?php
405
-
406
- }
407
-
408
-
409
- /**
410
- * Commission Totals for vendors reports
411
- *
412
- * @since 1.8.4
413
- */
414
- function commission_totals(){
415
-
416
- global $wpdb;
417
-
418
- $total_start_date = !empty( $_POST[ 'total_start_date' ] ) ? $_POST[ 'total_start_date' ] : strtotime( date( 'Ymd', strtotime( date( 'Ym', current_time( 'timestamp' ) ) . '01' ) ) );
419
- $total_end_date = !empty( $_POST[ 'total_end_date' ] ) ? $_POST[ 'total_end_date' ] : strtotime( date( 'Ymd', current_time( 'timestamp' ) ) );
420
- $commission_status = !empty( $_POST[ 'commission_status' ] ) ? $_POST[ 'commission_status' ] : 'due';
421
- $date_sql = ( !empty( $_POST[ 'total_start_date' ] ) && !empty( $_POST[ 'total_end_date' ] ) ) ? " time BETWEEN '$total_start_date 00:00:00' AND '$total_end_date 23:59:59' AND" : "";
422
-
423
- $status_sql = " status='$commission_status'";
424
-
425
- $sql = "SELECT vendor_id, total_due, total_shipping, tax, status FROM {$wpdb->prefix}pv_commission WHERE";
426
-
427
- $commissions = $wpdb->get_results( $sql . $date_sql . $status_sql );
428
-
429
- if ( !empty( $_POST[ 'total_start_date' ] ) ) {
430
- $total_start_date = strtotime( $_POST[ 'total_start_date' ] );
431
- }
432
-
433
- if ( !empty( $_POST[ 'total_end_date' ] ) ) {
434
- $total_end_date = strtotime( $_POST[ 'total_end_date' ] );
435
- }
436
-
437
- $totals = $this->calculate_totals( $commissions );
438
-
439
- ?><form method="post" action="">
440
- <p><label for="from"><?php _e( 'From:', 'wcvendors' ); ?></label>
441
- <input type="text" size="9" placeholder="yyyy-mm-dd" value="<?php echo esc_attr( date( 'Y-m-d', $total_start_date ) ); ?>" name="total_start_date" class="range_datepicker from" id="from" />
442
- <label for="to"><?php _e( 'To:', 'wcvendors' ); ?></label>
443
- <input type="text" size="9" placeholder="yyyy-mm-dd" value="<?php echo esc_attr( date( 'Y-m-d', $total_end_date ) ); ?>" name="total_end_date" class="range_datepicker to" id="to" />
444
-
445
- <select name="commission_status">
446
- <option value="due"><?php _e( 'Due', 'wcvendors' ); ?></option>
447
- <option value="paid"><?php _e( 'Paid', 'wcvendors' ); ?></option>
448
- <option value="reversed"><?php _e( 'Reversed', 'wcvendors' ); ?></option>
449
- </select>
450
-
451
- <input type="submit" class="button" value="<?php _e( 'Show', 'wcvendors' ); ?>"/>
452
-
453
- <?php do_action( 'wcvendors_after_commission_reports', $commissions ); ?>
454
- </p>
455
- </form>
456
-
457
- <div class="woocommerce-reports-main">
458
- <table class="widefat">
459
- <thead>
460
- <tr>
461
- <th class="total_row"><?php _e( 'Vendor', 'wcvendors' ); ?></th>
462
- <th class="total_row"><?php _e( 'Tax Total', 'wcvendors' ); ?></th>
463
- <th class="total_row"><?php _e( 'Shipping Total', 'wcvendors' ); ?></th>
464
- <th class="total_row"><?php _e( 'Status', 'wcvendors' ); ?></th>
465
- <th class="total_row"><?php _e( 'Commission Total', 'wcvendors' ); ?></th>
466
- </tr>
467
- </thead>
468
- <tbody>
469
- <?php
470
-
471
- if ( !empty( $commissions ) ){
472
-
473
- foreach ( $totals as $totals ) {
474
-
475
- echo '<tr>';
476
- echo '<td>' . $totals[ 'user_login' ]. '</td>';
477
- echo '<td>' . wc_price( $totals[ 'tax' ] ). '</td>';
478
- echo '<td>' . wc_price( $totals[ 'total_shipping' ] ). '</td>';
479
- echo '<td>' . $totals[ 'status' ] . '</td>';
480
- echo '<td>' . wc_price( $totals[ 'total_due' ] ). '</td>';
481
- echo '</tr>';
482
-
483
- }
484
-
485
- } else {
486
- echo '<tr>';
487
- echo '<td colspan="5">'. __( 'No commissions found.', 'wcvendors' ) . '</td>';
488
- echo '</tr>';
489
-
490
- }
491
- ?>
492
- </tbody>
493
- </table>
494
-
495
- <?php
496
-
497
-
498
- } // commission_totals()
499
-
500
- /**
501
- * Calculate the totals of the commissions return an array with vendor id as the key with the totals
502
- *
503
- * @param array $commissions total commissions array
504
- * @return array $totals calculated totals
505
- */
506
- function calculate_totals( $commissions ){
507
-
508
- $totals = array();
509
-
510
- $vendors = get_users( array( 'role' => 'vendor', 'fields' => array( 'ID', 'user_login' ) ) );
511
- $vendor_names = wp_list_pluck( $vendors, 'user_login', 'ID' );
512
-
513
- foreach ($commissions as $commission ) {
514
-
515
- if ( array_key_exists( $commission->vendor_id, $totals ) ){
516
-
517
- $totals[ $commission->vendor_id ][ 'total_due' ] += $commission->total_due + $commission->tax + $commission->total_shipping;
518
- $totals[ $commission->vendor_id ][ 'tax' ] += $commission->tax;
519
- $totals[ $commission->vendor_id ][ 'total_shipping' ] += $commission->total_shipping;
520
-
521
- } else {
522
-
523
- if ( array_key_exists( $commission->vendor_id, $vendor_names) ){
524
-
525
- $temp_array = array(
526
- 'user_login' => $vendor_names[ $commission->vendor_id ],
527
- 'total_due' => $commission->total_due,
528
- 'tax' => $commission->tax,
529
- 'total_shipping' => $commission->total_shipping,
530
- 'status' => $commission->status,
531
- );
532
-
533
- $totals[ $commission->vendor_id ] = $temp_array ;
534
-
535
- }
536
-
537
- }
538
-
539
- }
540
-
541
- usort( $totals, function( $a, $b ) {
542
- return strcmp( strtolower( $a[ 'user_login' ] ), strtolower( $b[ 'user_login' ] ) );
543
- });
544
-
545
- return $totals;
546
-
547
- } // calculate_totals()
548
-
549
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/classes/admin/class-admin-users.php DELETED
@@ -1,478 +0,0 @@
1
- <?php
2
-
3
- /**
4
- * WP-Admin users page
5
- *
6
- * @author Matt Gates <http://mgates.me>
7
- * @package WC_Vendors
8
- */
9
-
10
-
11
- class WCV_Admin_Users
12
- {
13
-
14
-
15
- /**
16
- * Constructor
17
- */
18
- function __construct()
19
- {
20
- if ( !is_admin() ) return;
21
-
22
- add_action( 'edit_user_profile', array( $this, 'show_extra_profile_fields' ) );
23
- add_action( 'edit_user_profile_update', array( $this, 'save_extra_profile_fields' ) );
24
-
25
- add_filter( 'add_menu_classes', array( $this, 'show_pending_number' ) );
26
-
27
- // Disabling non-vendor related items on the admin screens
28
- if ( WCV_Vendors::is_vendor( get_current_user_id() ) ) {
29
- add_filter( 'woocommerce_csv_product_role', array( $this, 'csv_import_suite_compatibility' ) );
30
- add_filter( 'woocommerce_csv_product_export_args', array( $this, 'csv_import_suite_compatibility_export' ) );
31
-
32
- // Admin page lockdown
33
- remove_action( 'admin_init', 'woocommerce_prevent_admin_access' );
34
- add_action( 'admin_init', array( $this, 'prevent_admin_access' ) );
35
-
36
- add_filter( 'woocommerce_prevent_admin_access', array( $this, 'deny_admin_access' ) );
37
-
38
- // WC > Product page fixes
39
- add_action( 'load-post-new.php', array( $this, 'confirm_access_to_add' ) );
40
- add_action( 'load-edit.php', array( $this, 'edit_nonvendors' ) );
41
- add_filter( 'views_edit-product', array( $this, 'hide_nonvendor_links' ) );
42
-
43
- // Filter user attachments so they only see their own attachements
44
- add_action( 'ajax_query_attachments_args', array( $this, 'show_user_attachment_ajax' ) );
45
- add_filter( 'parse_query', array( $this, 'show_user_attachment_page' ) );
46
-
47
- add_action( 'admin_menu', array( $this, 'remove_menu_page' ), 99 );
48
- add_action( 'add_meta_boxes', array( $this, 'remove_meta_boxes' ), 99 );
49
- add_filter( 'product_type_selector', array( $this, 'filter_product_types' ), 99 );
50
- add_filter( 'product_type_options', array( $this, 'filter_product_type_options' ), 99 );
51
- add_filter( 'woocommerce_product_data_tabs', array( $this, 'filter_product_data_tabs' ), 99, 2 );
52
-
53
- add_filter( 'woocommerce_duplicate_product_capability', array( $this, 'add_duplicate_capability' ) );
54
-
55
- // WC > Product featured
56
- $product_misc = (array) WC_Vendors::$pv_options->get_option( 'hide_product_misc' );
57
-
58
- if ( isset( $product_misc['featured'] ) ) {
59
- add_filter( 'manage_product_posts_columns', array($this, 'manage_product_columns'), 99);
60
- }
61
- // WC > Product Hide duplicate
62
- if ( isset( $product_misc['duplicate'] ) ) {
63
- add_filter( 'post_row_actions', array( $this, 'remove_dupe_link' ), 99, 2 );
64
- }
65
- }
66
-
67
- }
68
-
69
- public function confirm_access_to_add()
70
- {
71
- if ( empty( $_GET['post_type'] ) || $_GET['post_type'] != 'product' ) {
72
- return;
73
- }
74
-
75
- $can_submit = WC_Vendors::$pv_options->get_option( 'can_submit_products' );
76
- if ( !$can_submit ) {
77
- wp_die( 'You are not allowed to submit products.' );
78
- }
79
- }
80
-
81
- public function csv_import_suite_compatibility( $capability )
82
- {
83
- return 'manage_product';
84
- }
85
-
86
- public function csv_import_suite_compatibility_export( $args )
87
- {
88
- $args[ 'author' ] = get_current_user_id();
89
-
90
- return $args;
91
- }
92
-
93
- public function add_duplicate_capability( $capability )
94
- {
95
- return 'manage_product';
96
- }
97
-
98
-
99
- /**
100
- *
101
- *
102
- * @param unknown $menu
103
- *
104
- * @return unknown
105
- */
106
- public function show_pending_number( $menu )
107
- {
108
-
109
- $args = array(
110
- 'post_type' => 'product',
111
- 'author' => get_current_user_id(),
112
- 'post_status' => 'pending'
113
- );
114
-
115
- if (!WCV_Vendors::is_vendor( get_current_user_id() ) ) unset( $args['author'] );
116
-
117
- $pending_posts = get_posts( $args );
118
-
119
- $pending_count = is_array( $pending_posts ) ? count( $pending_posts ) : 0;
120
-
121
- $menu_str = 'edit.php?post_type=product';
122
-
123
- foreach ( $menu as $menu_key => $menu_data ) {
124
-
125
- if ( $menu_str != $menu_data[ 2 ] ) continue;
126
-
127
- if ($pending_count > 0 ) {
128
- $menu[ $menu_key ][ 0 ] .= " <span class='update-plugins counting-$pending_count'><span class='plugin-count'>" . number_format_i18n( $pending_count ) . '</span></span>';
129
- }
130
- }
131
-
132
- return $menu;
133
- }
134
-
135
- /**
136
- *
137
- *
138
- * @param unknown $types
139
- * @param unknown $product_type
140
- *
141
- * @return unknown
142
- */
143
- function filter_product_types( $types )
144
- {
145
-
146
- $product_types = (array) WC_Vendors::$pv_options->get_option( 'hide_product_types' );
147
- $product_misc = (array) WC_Vendors::$pv_options->get_option( 'hide_product_misc' );
148
- $css = WC_Vendors::$pv_options->get_option( 'product_page_css' );
149
-
150
-
151
- if ( !empty( $product_misc[ 'taxes' ] ) ) {
152
- $css .= '.form-field._tax_status_field, .form-field._tax_class_field{display:none !important;}';
153
- }
154
-
155
- unset( $product_misc[ 'taxes' ] );
156
-
157
- foreach ( $product_misc as $key => $value ) {
158
- if ( $value ) $css .= sprintf( '._%s_field{display:none !important;}', $key );
159
- }
160
-
161
- echo '<style>';
162
- echo $css;
163
- echo '</style>';
164
-
165
- foreach ( $types as $key => $value ) {
166
- if ( !empty( $product_types[ $key ] ) ) {
167
- unset( $types[ $key ] );
168
- }
169
- }
170
-
171
- return $types;
172
- }
173
-
174
- /**
175
- * Filter the product meta tabs in wp-admin
176
- * @since 1.9.0
177
- */
178
- function filter_product_data_tabs( $tabs ){
179
-
180
- $product_panel = (array) WC_Vendors::$pv_options->get_option( 'hide_product_panel' );
181
-
182
- if ( !$product_panel ) return $tabs;
183
-
184
- foreach ( $tabs as $key => $value ){
185
- if ( !empty( $product_panel[ $key ] ) ) {
186
- unset( $tabs[ $key ] );
187
- }
188
-
189
- }
190
-
191
- return $tabs;
192
-
193
- } // filter_product_data_tabs()
194
-
195
-
196
- /**
197
- *
198
- *
199
- * @param unknown $types
200
- *
201
- * @return unknown
202
- */
203
- function filter_product_type_options( $types )
204
- {
205
- $product_options = WC_Vendors::$pv_options->get_option( 'hide_product_type_options' );
206
-
207
- if ( !$product_options ) return $types;
208
-
209
- foreach ( $types as $key => $value ) {
210
- if ( !empty( $product_options[ $key ] ) ) {
211
- unset( $types[ $key ] );
212
- }
213
- }
214
-
215
- return $types;
216
- }
217
-
218
-
219
- /**
220
- * Show attachments only belonging to vendor
221
- *
222
- * @param object $query
223
- */
224
- function show_user_attachment_ajax ( $query ) {
225
-
226
- $user_id = get_current_user_id();
227
- if ( $user_id ) {
228
- $query['author'] = $user_id;
229
- }
230
- return $query;
231
- }
232
-
233
- /**
234
- * Show attachments only belonging to vendor
235
- *
236
- * @param object $query
237
- */
238
- function show_user_attachment_page ( $query ) {
239
-
240
- global $current_user, $pagenow;
241
-
242
- if ( !is_a( $current_user, 'WP_User') )
243
- return;
244
-
245
- if ( 'upload.php' != $pagenow && 'media-upload.php' != $pagenow)
246
- return;
247
-
248
- if ( !current_user_can('delete_pages') )
249
- $query->set('author', $current_user->ID );
250
-
251
- return;
252
- }
253
-
254
- /**
255
- * Allow vendors to access admin when disabled
256
- */
257
- public function prevent_admin_access()
258
- {
259
- $permitted_user = ( current_user_can( 'edit_posts' ) || current_user_can( 'manage_woocommerce' ) || current_user_can( 'vendor' ) );
260
-
261
- if ( get_option( 'woocommerce_lock_down_admin' ) == 'yes' && !is_ajax() && !$permitted_user ) {
262
- wp_safe_redirect( get_permalink( woocommerce_get_page_id( 'myaccount' ) ) );
263
- exit;
264
- }
265
- }
266
-
267
- public function deny_admin_access()
268
- {
269
- return false;
270
- }
271
-
272
-
273
- /**
274
- * Request when load-edit.php
275
- */
276
- public function edit_nonvendors()
277
- {
278
- add_action( 'request', array( $this, 'hide_nonvendor_products' ) );
279
- }
280
-
281
-
282
- /**
283
- * Hide links that don't matter anymore from vendors
284
- *
285
- * @param array $views
286
- *
287
- * @return array
288
- */
289
- public function hide_nonvendor_links( $views )
290
- {
291
- return array();
292
- }
293
-
294
-
295
- /**
296
- * Hide products that don't belong to the vendor
297
- *
298
- * @param array $query_vars
299
- *
300
- * @return array
301
- */
302
- public function hide_nonvendor_products( $query_vars )
303
- {
304
- if (array_key_exists('post_type', $query_vars) && ($query_vars['post_type'] == 'product')) {
305
- $query_vars[ 'author' ] = get_current_user_id();
306
- }
307
-
308
- return $query_vars;
309
- }
310
-
311
-
312
- /**
313
- * Remove the media library menu
314
- */
315
- public function remove_menu_page()
316
- {
317
- global $pagenow, $woocommerce;
318
-
319
- remove_menu_page( 'index.php' ); /* Hides Dashboard menu */
320
- remove_menu_page( 'separator1' ); /* Hides separator under Dashboard menu*/
321
- remove_all_actions( 'admin_notices' );
322
-
323
- if ( $pagenow == 'index.php' ) {
324
- wp_redirect( admin_url( 'profile.php' ) );
325
- }
326
- }
327
-
328
-
329
- /**
330
- *
331
- */
332
- public function remove_meta_boxes()
333
- {
334
- remove_meta_box( 'postcustom', 'product', 'normal' );
335
- remove_meta_box( 'wpseo_meta', 'product', 'normal' );
336
- remove_meta_box( 'expirationdatediv', 'product', 'side' );
337
- }
338
-
339
-
340
- /**
341
- * Update the vendor PayPal email
342
- *
343
- * @param int $vendor_id
344
- *
345
- * @return bool
346
- */
347
- public function save_extra_profile_fields( $vendor_id )
348
- {
349
- if ( !current_user_can( 'edit_user', $vendor_id ) ) return false;
350
-
351
- if ( ! WCV_Vendors::is_pending( $vendor_id ) && ! WCV_Vendors::is_vendor( $vendor_id ) ) { return; }
352
-
353
- $users = get_users( array( 'meta_key' => 'pv_shop_slug', 'meta_value' => sanitize_title( $_POST[ 'pv_shop_name' ] ) ) );
354
- if ( empty( $users ) || $users[ 0 ]->ID == $vendor_id ) {
355
- update_user_meta( $vendor_id, 'pv_shop_name', $_POST[ 'pv_shop_name' ] );
356
- update_user_meta( $vendor_id, 'pv_shop_slug', sanitize_title( $_POST[ 'pv_shop_name' ] ) );
357
- }
358
-
359
- update_user_meta( $vendor_id, 'pv_paypal', $_POST[ 'pv_paypal' ] );
360
- update_user_meta( $vendor_id, 'pv_shop_html_enabled', isset( $_POST[ 'pv_shop_html_enabled' ] ) );
361
- update_user_meta( $vendor_id, 'pv_custom_commission_rate', $_POST[ 'pv_custom_commission_rate' ] );
362
- update_user_meta( $vendor_id, 'pv_shop_description', $_POST[ 'pv_shop_description' ] );
363
- update_user_meta( $vendor_id, 'pv_seller_info', $_POST[ 'pv_seller_info' ] );
364
- update_user_meta( $vendor_id, 'wcv_give_vendor_tax', isset( $_POST[ 'wcv_give_vendor_tax' ] ) );
365
- update_user_meta( $vendor_id, 'wcv_give_vendor_shipping', isset( $_POST[ 'wcv_give_vendor_shipping' ] ) );
366
-
367
- do_action( 'wcvendors_update_admin_user', $vendor_id );
368
- }
369
-
370
-
371
- /**
372
- * Show the PayPal field and commision due table
373
- *
374
- * @param unknown $user
375
- */
376
- public function show_extra_profile_fields( $user )
377
- {
378
-
379
- if ( ! WCV_Vendors::is_vendor( $user->ID ) && ! WCV_Vendors::is_pending( $user->ID ) ) {
380
- return;
381
- }
382
-
383
- ?>
384
- <h3><?php _e( 'WC Vendors', 'wcvendors' ); ?></h3>
385
- <table class="form-table">
386
- <tbody>
387
- <?php do_action( 'wcvendors_admin_before_shop_html', $user ); ?>
388
- <tr>
389
- <th scope="row">Shop HTML</th>
390
- <td>
391
- <label for="pv_shop_html_enabled">
392
- <input name="pv_shop_html_enabled" type="checkbox"
393
- id="pv_shop_html_enabled" <?php checked( true, get_user_meta( $user->ID, 'pv_shop_html_enabled', true ), $echo = true ) ?>/>
394
- <?php _e( 'Enable HTML for the shop description', 'wcvendors' ); ?>
395
- </label>
396
- </td>
397
- </tr>
398
- <?php do_action( 'wcvendors_admin_after_shop_html', $user ); ?>
399
- <tr>
400
- <th><label for="pv_shop_name"><?php _e( 'Shop name', 'wcvendors' ); ?></label></th>
401
- <td><input type="text" name="pv_shop_name" id="pv_shop_name"
402
- value="<?php echo get_user_meta( $user->ID, 'pv_shop_name', true ); ?>" class="regular-text">
403
- </td>
404
- </tr>
405
- <?php do_action( 'wcvendors_admin_after_shop_name', $user ); ?>
406
- <tr>
407
- <th><label for="pv_paypal"><?php _e( 'PayPal E-mail', 'wcvendors' ); ?> <span
408
- class="description">(<?php _e( 'required', 'wcvendors' ); ?>)</span></label></th>
409
- <td><input type="email" name="pv_paypal" id="pv_paypal"
410
- value="<?php echo get_user_meta( $user->ID, 'pv_paypal', true ); ?>" class="regular-text">
411
- </td>
412
- </tr>
413
- <?php do_action( 'wcvendors_admin_after_paypal', $user ); ?>
414
- <tr>
415
- <th><label for="pv_custom_commission_rate"><?php _e( 'Commission rate', 'wcvendors' ); ?> (%)</label></th>
416
- <td><input type="number" step="0.01" max="100" min="0" name="pv_custom_commission_rate" placeholder="<?php _e( 'Leave blank for default', 'wcvendors' ); ?>" id="pv_custom_commission_rate"
417
- value="<?php echo get_user_meta( $user->ID, 'pv_custom_commission_rate', true ); ?>" class="regular-text">
418
- </td>
419
- </tr>
420
- <?php do_action( 'wcvendors_admin_after_commission_due', $user ); ?>
421
- <tr>
422
- <th><label for="wcv_give_vendor_tax"><?php _e( 'Give Tax', 'wcvendors' ); ?> (%)</label></th>
423
- <td>
424
- <label for="wcv_give_vendor_tax">
425
- <input name="wcv_give_vendor_tax" type="checkbox"
426
- id="wcv_give_vendor_tax" <?php checked( true, get_user_meta( $user->ID, 'wcv_give_vendor_tax', true ), $echo = true ) ?>/>
427
- <?php _e( 'Tax override for vendor', 'wcvendors' ); ?>
428
- </label>
429
- </td>
430
- </tr>
431
- <?php do_action( 'wcvendors_admin_after_give_tax', $user ); ?>
432
- <tr>
433
- <th><label for="wcv_give_vendor_shipping"><?php _e( 'Give Shipping', 'wcvendors' ); ?> (%)</label></th>
434
- <td>
435
- <label for="wcv_give_vendor_shipping">
436
- <input name="wcv_give_vendor_shipping" type="checkbox"
437
- id="wcv_give_vendor_shipping" <?php checked( true, get_user_meta( $user->ID, 'wcv_give_vendor_shipping', true ), $echo = true ) ?>/>
438
- <?php _e( 'Shipping override for vendor', 'wcvendors' ); ?>
439
- </label>
440
- </td>
441
- </tr>
442
- <?php do_action( 'wcvendors_admin_after_give_shipping', $user ); ?>
443
- <tr>
444
- <th><label for="pv_seller_info"><?php _e( 'Seller info', 'wcvendors' ); ?></label></th>
445
- <td><?php wp_editor( get_user_meta( $user->ID, 'pv_seller_info', true ), 'pv_seller_info' ); ?></td>
446
- </tr>
447
- <?php do_action( 'wcvendors_admin_after_seller_info', $user ); ?>
448
- <tr>
449
- <th><label for="pv_shop_description"><?php _e( 'Shop description', 'wcvendors' ); ?></label>
450
- </th>
451
- <td><?php wp_editor( get_user_meta( $user->ID, 'pv_shop_description', true ), 'pv_shop_description' ); ?></td>
452
- </tr>
453
- <?php do_action( 'wcvendors_admin_after_shop_description', $user ); ?>
454
- </tbody>
455
- </table>
456
- <?php
457
- }
458
-
459
- /*
460
- Remove featured check box from the product listing
461
- */
462
- public function manage_product_columns( $columns ){
463
- global $woocommerce;
464
- unset($columns['featured']);
465
- return $columns;
466
- }
467
-
468
-
469
- /**
470
- * Hide the duplicate product link by removing it from the row actions
471
- */
472
- public function remove_dupe_link( $actions, $post ) {
473
- unset($actions['duplicate']);
474
- return $actions;
475
- }
476
-
477
-
478
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/classes/admin/class-product-meta.php DELETED
@@ -1,267 +0,0 @@
1
- <?php
2
-
3
- /**
4
- * Product meta configurations
5
- *
6
- * @package ProductVendor
7
- */
8
-
9
-
10
- class WCV_Product_Meta
11
- {
12
-
13
-
14
- /**
15
- * Constructor
16
- */
17
- function __construct()
18
- {
19
- if ( !current_user_can( 'manage_woocommerce' ) ) return;
20
-
21
- // Allow products to have authors
22
- add_post_type_support( 'product', 'author' );
23
-
24
- add_action( 'add_meta_boxes', array( $this, 'change_author_meta_box_title' ) );
25
- add_action( 'wp_dropdown_users', array( $this, 'author_vendor_roles' ), 0, 1 );
26
- if ( apply_filters( 'wcv_product_commission_tab', true ) ) {
27
- add_action( 'woocommerce_product_write_panel_tabs', array( $this, 'add_tab' ) );
28
- add_action( 'woocommerce_product_data_panels', array( $this, 'add_panel' ) );
29
- add_action( 'woocommerce_process_product_meta', array( $this, 'save_panel' ) );
30
- }
31
-
32
- add_action( 'woocommerce_product_quick_edit_end', array($this, 'display_vendor_dd_quick_edit') );
33
- add_action( 'woocommerce_product_quick_edit_save', array($this, 'save_vendor_quick_edit'), 2, 99 );
34
- add_action( 'manage_product_posts_custom_column', array($this, 'display_vendor_column'), 2, 99 );
35
- add_filter( 'manage_product_posts_columns', array($this, 'vendor_column_quickedit') );
36
-
37
- }
38
-
39
-
40
- /**
41
- * Change the "Author" metabox to "Vendor"
42
- */
43
- public function change_author_meta_box_title()
44
- {
45
- global $wp_meta_boxes;
46
- $wp_meta_boxes[ 'product' ][ 'normal' ][ 'core' ][ 'authordiv' ][ 'title' ] = __( 'Vendor', 'wcvendors' );;
47
- }
48
-
49
-
50
- /**
51
- * Override the authors selectbox with +vendor roles
52
- *
53
- * @param html $output
54
- *
55
- * @return html
56
- */
57
- public function author_vendor_roles( $output )
58
- {
59
- global $post;
60
-
61
- if ( empty( $post ) ) return $output;
62
-
63
- // Return if this isn't a WooCommerce product post type
64
- if ( $post->post_type != 'product' ) return $output;
65
-
66
- // Return if this isn't the vendor author override dropdown
67
- if ( !strpos( $output, 'post_author_override' ) ) return $output;
68
-
69
- $args = array(
70
- 'selected' => $post->post_author,
71
- 'id' => 'post_author_override',
72
- );
73
-
74
- $output = $this->vendor_selectbox( $args );
75
-
76
- return $output;
77
- }
78
-
79
-
80
- /**
81
- * Create a selectbox to display vendor & administrator roles
82
- *
83
- * @param array $args
84
- *
85
- * @return html
86
- */
87
- public function vendor_selectbox( $args )
88
- {
89
- $default_args = array(
90
- 'placeholder',
91
- 'id',
92
- 'class',
93
- );
94
-
95
- foreach ( $default_args as $key ) {
96
- if ( !is_array( $key ) && empty( $args[ $key ] ) ) $args[ $key ] = '';
97
- else if ( is_array( $key ) ) foreach ( $key as $val ) $args[ $key ][ $val ] = esc_attr( $args[ $key ][ $val ] );
98
- }
99
- extract( $args );
100
-
101
- $roles = array( 'vendor', 'administrator' );
102
- $user_args = array( 'fields' => array( 'ID', 'user_login' ) );
103
-
104
- $output = "<select style='width:200px;' name='$id' id='$id' class='$class' data-placeholder='$placeholder'>\n";
105
- $output .= "\t<option value=''></option>\n";
106
-
107
- foreach ( $roles as $role ) {
108
-
109
- $new_args = $user_args;
110
- $new_args[ 'role' ] = $role;
111
- $users = get_users( $new_args );
112
-
113
- if ( empty( $users ) ) continue;
114
- foreach ( (array) $users as $user ) {
115
- $select = selected( $user->ID, $selected, false );
116
- $output .= "\t<option value='$user->ID' $select>$user->user_login</option>\n";
117
- }
118
-
119
- }
120
- $output .= "</select>";
121
-
122
- // Convert this selectbox with select2
123
- $output .= '
124
- <script type="text/javascript">jQuery(function() { jQuery("#' . $id . '").select2().focus(); } );</script>';
125
-
126
- return $output;
127
- }
128
-
129
-
130
- /**
131
- * Save commission rate of a product
132
- *
133
- * @param int $post_id
134
- */
135
- public function save_panel( $post_id )
136
- {
137
- if ( isset( $_POST[ 'pv_commission_rate' ] ) ) {
138
- update_post_meta( $post_id, 'pv_commission_rate', is_numeric( $_POST[ 'pv_commission_rate' ] ) ? (float) $_POST[ 'pv_commission_rate' ] : false );
139
- }
140
-
141
- }
142
-
143
-
144
- /**
145
- * Add the Commission tab to a product
146
- */
147
- public function add_tab()
148
- {
149
- ?>
150
- <li class="commission_tab">
151
- <a href="#commission"><?php _e( 'Commission', 'wcvendors' ) ?></a>
152
- </li> <?php
153
- }
154
-
155
-
156
- /**
157
- * Add the Commission panel to a product
158
- */
159
- public function add_panel()
160
- {
161
- global $post; ?>
162
-
163
- <div id="commission" class="panel woocommerce_options_panel">
164
- <fieldset>
165
-
166
- <p class='form-field commission_rate_field'>
167
- <label for='pv_commission_rate'><?php _e( 'Commission', 'wcvendors' ); ?> (%)</label>
168
- <input type='number' id='pv_commission_rate'
169
- name='pv_commission_rate'
170
- class='short'
171
- max="100"
172
- min="0"
173
- step='any'
174
- placeholder='<?php _e( 'Leave blank for default', 'wcvendors' ); ?>'
175
- value="<?php echo get_post_meta( $post->ID, 'pv_commission_rate', true ); ?>"/>
176
- </p>
177
-
178
- </fieldset>
179
- </div> <?php
180
-
181
- }
182
-
183
- /*
184
- * Rename the Authors column to Vendor on products page
185
- */
186
- public function vendor_column_quickedit($posts_columns) {
187
- $posts_columns['author'] = __( 'Vendor', 'wcvendors' );
188
-
189
- return $posts_columns;
190
- }
191
-
192
- /*
193
- * Display the vendor drop down on the quick edit screen
194
- */
195
- public function display_vendor_dd_quick_edit() {
196
-
197
- global $post;
198
- $selected = $post->post_author;
199
-
200
- $roles = array( 'vendor', 'administrator' );
201
- $user_args = array( 'fields' => array( 'ID', 'display_name' ) );
202
-
203
- $output = "<select style='width:200px;' name='post_author-new' class='select'>\n";
204
-
205
- foreach ( $roles as $role ) {
206
-
207
- $new_args = $user_args;
208
- $new_args[ 'role' ] = $role;
209
- $users = get_users( $new_args );
210
-
211
- if ( empty( $users ) ) continue;
212
- foreach ( (array) $users as $user ) {
213
- $select = selected( $user->ID, $selected, false );
214
- $output .= "\t<option value='$user->ID' $select>$user->display_name</option>\n";
215
- }
216
-
217
- }
218
- $output .= "</select>";
219
-
220
- ?>
221
- <br class="clear" />
222
- <label class="inline-edit-author-new">
223
- <span class="title"><?php _e('Vendor', 'wcvendors' ); ?></span>
224
- <?php echo $output; ?>
225
- </label>
226
- <?php
227
- }
228
-
229
-
230
- /*
231
- * Save the vendor on the quick edit screen
232
- */
233
- public function save_vendor_quick_edit( $product ) {
234
-
235
- if ( $product->is_type('simple') || $product->is_type('external') ) {
236
- if ( isset( $_REQUEST['_vendor'] ) ) {
237
- $vendor = wc_clean($_REQUEST['_vendor']);
238
- $product->post->post_author = $vendor;
239
- }
240
- }
241
- return $product;
242
- }
243
-
244
- /*
245
- * Display hidden column data for js
246
- */
247
- public function display_vendor_column( $column, $post_id ){
248
-
249
- $vendor = get_post_field( 'post_author', $post_id );
250
-
251
- switch ( $column ) {
252
- case 'name' :
253
-
254
- ?>
255
- <div class="hidden vendor" id="vendor_<?php echo $post_id; ?>">
256
- <div id="post_author"><?php echo $vendor; ?></div>
257
- </div>
258
- <?php
259
-
260
- break;
261
-
262
- default :
263
- break;
264
- }
265
-
266
- }
267
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/classes/admin/class-vendor-admin-dashboard.php DELETED
@@ -1,691 +0,0 @@
1
- <?php
2
- /**
3
- * WC Vendor Admin Dashboard - Vendor WP-Admin Dashboard Pages
4
- *
5
- * @author Jamie Madden <http://wcvendors.com / https://github.com/digitalchild>
6
- * @package WCVendors
7
- */
8
-
9
- Class WCV_Vendor_Admin_Dashboard {
10
-
11
- public $dashboard_error_msg;
12
-
13
- function __construct(){
14
- // Add Shop Settings page
15
- add_action( 'admin_menu', array( $this, 'vendor_dashboard_pages') );
16
- // Hook into init for form processing
17
- add_action( 'admin_init', array( $this, 'save_shop_settings' ) );
18
- add_action( 'admin_head', array( $this, 'admin_enqueue_order_style') );
19
- }
20
-
21
- function vendor_dashboard_pages(){
22
- add_menu_page( __('Shop Settings', 'wcvendors'), __('Shop Settings', 'wcvendors'), 'manage_product', 'wcv-vendor-shopsettings', array( $this, 'settings_page' ) );
23
- $hook = add_menu_page( __( 'Orders', 'wcvendors' ), __( 'Orders', 'wcvendors' ), 'manage_product', 'wcv-vendor-orders', array( 'WCV_Vendor_Admin_Dashboard', 'orders_page' ) );
24
- add_action( "load-$hook", array( 'WCV_Vendor_Admin_Dashboard', 'add_options' ) );
25
- }
26
-
27
- function settings_page() {
28
- $user_id = get_current_user_id();
29
- $paypal_address = true;
30
- $shop_description = true;
31
- $description = get_user_meta( $user_id, 'pv_shop_description', true );
32
- $seller_info = get_user_meta( $user_id, 'pv_seller_info', true );
33
- $has_html = get_user_meta( $user_id, 'pv_shop_html_enabled', true );
34
- $shop_page = WCV_Vendors::get_vendor_shop_page( wp_get_current_user()->user_login );
35
- $global_html = WC_Vendors::$pv_options->get_option( 'shop_html_enabled' );
36
- include('views/html-vendor-settings-page.php');
37
- }
38
-
39
- function admin_enqueue_order_style() {
40
-
41
- $screen = get_current_screen();
42
- $screen_id = $screen->id;
43
-
44
- if ( 'wcv-vendor-orders' === $screen_id ){
45
-
46
- add_thickbox();
47
- wp_enqueue_style( 'admin_order_styles', wcv_assets_url . 'css/admin-orders.css' );
48
- }
49
- }
50
-
51
- /**
52
- * Save shop settings
53
- */
54
- public function save_shop_settings()
55
- {
56
- $user_id = get_current_user_id();
57
- $error = false;
58
- $error_msg = '';
59
-
60
- if (isset ( $_POST[ 'wc-vendors-nonce' ] ) ) {
61
-
62
- if ( !wp_verify_nonce( $_POST[ 'wc-vendors-nonce' ], 'save-shop-settings-admin' ) ) {
63
- return false;
64
- }
65
-
66
- if ( !is_email( $_POST[ 'pv_paypal' ] ) ) {
67
- $error_msg .= __( 'Your PayPal address is not a valid email address.', 'wcvendors' );
68
- $error = true;
69
- } else {
70
- update_user_meta( $user_id, 'pv_paypal', $_POST[ 'pv_paypal' ] );
71
- }
72
-
73
- if ( !empty( $_POST[ 'pv_shop_name' ] ) ) {
74
- $users = get_users( array( 'meta_key' => 'pv_shop_slug', 'meta_value' => sanitize_title( $_POST[ 'pv_shop_name' ] ) ) );
75
- if ( !empty( $users ) && $users[ 0 ]->ID != $user_id ) {
76
- $error_msg .= __( 'That shop name is already taken. Your shop name must be unique.', 'wcvendors' );
77
- $error = true;
78
- } else {
79
- update_user_meta( $user_id, 'pv_shop_name', $_POST[ 'pv_shop_name' ] );
80
- update_user_meta( $user_id, 'pv_shop_slug', sanitize_title( $_POST[ 'pv_shop_name' ] ) );
81
- }
82
- }
83
-
84
- if ( isset( $_POST[ 'pv_shop_description' ] ) ) {
85
- update_user_meta( $user_id, 'pv_shop_description', $_POST[ 'pv_shop_description' ] );
86
- }
87
-
88
- if ( isset( $_POST[ 'pv_seller_info' ] ) ) {
89
- update_user_meta( $user_id, 'pv_seller_info', $_POST[ 'pv_seller_info' ] );
90
- }
91
-
92
- do_action( 'wcvendors_shop_settings_admin_saved', $user_id );
93
-
94
- if ( ! $error ) {
95
- add_action( 'admin_notices', array( $this, 'add_admin_notice_success' ) );
96
- } else {
97
- $this->dashboard_error_msg = $error_msg;
98
- add_action( 'admin_notices', array( $this, 'add_admin_notice_error' ) );
99
- }
100
- }
101
- }
102
-
103
- /**
104
- * Output a sucessful message after saving the shop settings
105
- *
106
- * @since 1.9.9
107
- * @access public
108
- */
109
- public function add_admin_notice_success( ){
110
-
111
- echo '<div class="updated"><p>';
112
- echo __( 'Settings saved.', 'wcvendors' );
113
- echo '</p></div>';
114
-
115
- } // add_admin_notice_success()
116
-
117
- /**
118
- * Output an error message
119
- *
120
- * @since 1.9.9
121
- * @access public
122
- */
123
- public function add_admin_notice_error( ){
124
-
125
- echo '<div class="error"><p>';
126
- echo $this->dashboard_error_msg;
127
- echo '</p></div>';
128
-
129
- } // add_admin_notice_error()
130
-
131
- /**
132
- *
133
- *
134
- * @param unknown $status
135
- * @param unknown $option
136
- * @param unknown $value
137
- *
138
- * @return unknown
139
- */
140
- public static function set_table_option( $status, $option, $value )
141
- {
142
- if ( $option == 'orders_per_page' ) {
143
- return $value;
144
- }
145
- }
146
-
147
-
148
- /**
149
- *
150
- */
151
- public static function add_options()
152
- {
153
- global $WCV_Vendor_Order_Page;
154
-
155
- $args = array(
156
- 'label' => 'Rows',
157
- 'default' => 10,
158
- 'option' => 'orders_per_page'
159
- );
160
- add_screen_option( 'per_page', $args );
161
-
162
- $WCV_Vendor_Order_Page = new WCV_Vendor_Order_Page();
163
-
164
- }
165
-
166
-
167
- /**
168
- * HTML setup for the Orders Page
169
- */
170
- public static function orders_page()
171
- {
172
- global $woocommerce, $WCV_Vendor_Order_Page;
173
-
174
- $WCV_Vendor_Order_Page->prepare_items();
175
-
176
- ?>
177
- <div class="wrap">
178
-
179
- <div id="icon-woocommerce" class="icon32 icon32-woocommerce-reports"><br/></div>
180
- <h2><?php _e( 'Orders', 'wcvendors' ); ?></h2>
181
-
182
- <form id="posts-filter" method="get">
183
-
184
- <input type="hidden" name="page" value="wcv-vendor-orders"/>
185
- <?php $WCV_Vendor_Order_Page->display() ?>
186
-
187
- </form>
188
- <div id="ajax-response"></div>
189
- <br class="clear"/>
190
- </div>
191
-
192
- <?php }
193
-
194
- } // End WCV_Vendor_Admin_Dashboard
195
-
196
- if ( !class_exists( 'WP_List_Table' ) ) require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php';
197
-
198
- /**
199
- * WCV Vendor Order Page
200
- *
201
- * @author Jamie Madden <http://wcvendors.com / https://github.com/digitalchild>
202
- * @package WCVendors
203
- * @extends WP_List_Table
204
- */
205
- class WCV_Vendor_Order_Page extends WP_List_Table
206
- {
207
-
208
- public $index;
209
-
210
- /**
211
- * can_view_comments
212
- *
213
- * @since 1.0.0
214
- * @access public
215
- * @var string $can_view_comments permission check for view comments
216
- */
217
- public $can_view_comments;
218
-
219
-
220
- /**
221
- * can_add_comments
222
- *
223
- * @since 1.0.0
224
- * @access public
225
- * @var string $can_add_comments permission check for add comments
226
- */
227
- public $can_add_comments;
228
-
229
-
230
- /**
231
- * __construct function.
232
- *
233
- * @access public
234
- */
235
- function __construct()
236
- {
237
- global $status, $page;
238
-
239
- $this->index = 0;
240
-
241
- //Set parent defaults
242
- parent::__construct( array(
243
- 'singular' => __( 'order', 'wcvendors' ),
244
- 'plural' => __( 'orders', 'wcvendors' ),
245
- 'ajax' => false
246
- ) );
247
-
248
- $this->can_view_comments = WC_Vendors::$pv_options->get_option( 'can_view_order_comments' );
249
- $this->can_add_comments = WC_Vendors::$pv_options->get_option( 'can_submit_order_comments' );
250
- }
251
-
252
-
253
- /**
254
- * column_default function.
255
- *
256
- * @access public
257
- *
258
- * @param unknown $item
259
- * @param mixed $column_name
260
- *
261
- * @return unknown
262
- */
263
- function column_default( $item, $column_name )
264
- {
265
- global $wpdb;
266
-
267
- switch ( $column_name ) {
268
- case 'order_id' :
269
- return $item->order_id;
270
- case 'customer' :
271
- return $item->customer;
272
- case 'products' :
273
- return $item->products;
274
- case 'total' :
275
- return $item->total;
276
- // case 'comments' :
277
- // return $item->comments;
278
- case 'date' :
279
- return $item->date;
280
- case 'status' :
281
- return $item->status;
282
- default:
283
- return apply_filters( 'wcvendors_vendor_order_page_column_default', '', $item, $column_name );
284
- }
285
- }
286
-
287
-
288
- /**
289
- * column_cb function.
290
- *
291
- * @access public
292
- *
293
- * @param mixed $item
294
- *
295
- * @return unknown
296
- */
297
- function column_cb( $item )
298
- {
299
- return sprintf(
300
- '<input type="checkbox" name="%1$s[]" value="%2$s" />',
301
- /*$1%s*/
302
- 'order_id',
303
- /*$2%s*/
304
- $item->order_id
305
- );
306
- }
307
-
308
-
309
- /**
310
- * get_columns function.
311
- *
312
- * @access public
313
- * @return unknown
314
- */
315
- function get_columns()
316
- {
317
- $columns = array(
318
- 'cb' => '<input type="checkbox" />',
319
- 'order_id' => __( 'Order ID', 'wcvendors' ),
320
- 'customer' => __( 'Customer', 'wcvendors' ),
321
- 'products' => __( 'Products', 'wcvendors' ),
322
- 'total' => __( 'Total', 'wcvendors' ),
323
- // 'comments' => __( 'Comments to Customer', 'wcvendors' ),
324
- 'date' => __( 'Date', 'wcvendors' ),
325
- 'status' => __( 'Shipped', 'wcvendors' ),
326
- );
327
-
328
- if ( !$this->can_view_comments ) unset( $columns['comments'] );
329
-
330
- return apply_filters( 'wcvendors_vendor_order_page_get_columns', $columns );
331
-
332
- }
333
-
334
-
335
- /**
336
- * get_sortable_columns function.
337
- *
338
- * @access public
339
- * @return unknown
340
- */
341
- function get_sortable_columns()
342
- {
343
- $sortable_columns = array(
344
- 'order_id' => array( 'order_id', false ),
345
- 'total' => array( 'total', false ),
346
- 'status' => array( 'status', false ),
347
- );
348
-
349
- return $sortable_columns;
350
- }
351
-
352
-
353
- /**
354
- * Get bulk actions
355
- *
356
- * @return unknown
357
- */
358
- function get_bulk_actions()
359
- {
360
- $actions = array(
361
- 'mark_shipped' => apply_filters( 'wcvendors_mark_shipped_label', __( 'Mark shipped', 'wcvendors' ) ),
362
- );
363
-
364
- return $actions;
365
- }
366
-
367
-
368
- /**
369
- * Process bulk actions
370
- *
371
- * @return unknown
372
- */
373
- function process_bulk_action()
374
- {
375
- if ( !isset( $_GET[ 'order_id' ] ) ) return;
376
-
377
- if (is_array( $_GET[ 'order_id' ] ) ) {
378
-
379
- $items = array_map( 'intval', $_GET[ 'order_id' ] );
380
- switch ( $this->current_action() ) {
381
- case 'mark_shipped':
382
-
383
- $result = $this->mark_shipped( $items );
384
-
385
- if ( $result )
386
- echo '<div class="updated"><p>' . __( 'Orders marked shipped.', 'wcvendors' ) . '</p></div>';
387
- break;
388
-
389
- default:
390
- // code...
391
- break;
392
- }
393
-
394
- } else {
395
-
396
- if ( !isset( $_GET[ 'action' ] ) ) return;
397
- }
398
-
399
-
400
- }
401
-
402
-
403
- /**
404
- * Mark orders as shipped
405
- *
406
- * @param unknown $ids (optional)
407
- *
408
- * @return unknown
409
- */
410
- public function mark_shipped( $ids = array() )
411
- {
412
- global $woocommerce;
413
-
414
- $user_id = get_current_user_id();
415
-
416
- if ( !empty( $ids ) ) {
417
- foreach ($ids as $order_id ) {
418
- $order = wc_get_order( $order_id );
419
- $vendors = WCV_Vendors::get_vendors_from_order( $order );
420
- $vendor_ids = array_keys( $vendors );
421
- if ( !in_array( $user_id, $vendor_ids ) ) {
422
- wp_die( __( 'You are not allowed to modify this order.', 'wcvendors' ) );
423
- }
424
- $shippers = (array) get_post_meta( $order_id, 'wc_pv_shipped', true );
425
- if( !in_array($user_id, $shippers)) {
426
- $shippers[] = $user_id;
427
- $mails = $woocommerce->mailer()->get_emails();
428
- if ( !empty( $mails ) ) {
429
- $mails[ 'WC_Email_Notify_Shipped' ]->trigger( $order_id, $user_id );
430
- }
431
- do_action('wcvendors_vendor_ship', $order_id, $user_id);
432
- }
433
- update_post_meta( $order_id, 'wc_pv_shipped', $shippers );
434
- }
435
- return true;
436
- }
437
- return false;
438
- }
439
-
440
-
441
-
442
- /**
443
- * Get Orders to display in admin
444
- *
445
- * @return $orders
446
- */
447
- function get_orders() {
448
-
449
- $user_id = get_current_user_id();
450
-
451
- $orders = array();
452
-
453
- $vendor_products = $this->get_vendor_products( $user_id );
454
-
455
- $products = array();
456
-
457
- foreach ( $vendor_products as $_product ) {
458
-
459
- $products[] = $_product->ID;
460
- }
461
-
462
- $_orders = $this->get_orders_for_vendor_products( $products );
463
-
464
- $model_id = 0;
465
-
466
- if ( !empty( $_orders ) ) {
467
-
468
- foreach ( $_orders as $order ) {
469
-
470
- $order = new WC_Order( $order->order_id );
471
- $order_id = ( version_compare( WC_VERSION, '2.7', '<' ) ) ? $order->id : $order->get_id();
472
- $valid_items = WCV_Queries::get_products_for_order( $order_id );
473
- $valid = array();
474
-
475
- $items = $order->get_items();
476
-
477
- foreach ( $items as $order_item_id => $item) {
478
- if ( in_array( $item[ 'variation_id' ], $valid_items) || in_array( $item[ 'product_id' ], $valid_items ) ) {
479
- $valid[ $order_item_id ] = $item;
480
- }
481
- }
482
-
483
- $products = '';
484
-
485
- foreach ( $valid as $order_item_id => $item ) {
486
-
487
- $wc_product = new WC_Product( $item['product_id'] );
488
-
489
- $products .= '<strong>'. $item['qty'] . ' x ' . $item['name'] . '</strong><br />';
490
-
491
- if ( version_compare( WC_VERSION, '2.7', '<' ) ) {
492
- $metadata = $order->has_meta( $order_item_id );
493
- } else {
494
- $_item = $order->get_item( $order_item_id );
495
- $meta_data = $_item->get_meta_data();
496
- }
497
-
498
- if ( !empty( $metadata ) ) {
499
-
500
- $products .= '<table cellspacing="0" class="wcv_display_meta">';
501
-
502
- foreach ( $metadata as $meta ) {
503
-
504
- // Skip hidden core fields
505
- if ( in_array( $meta['meta_key'], apply_filters( 'woocommerce_hidden_order_itemmeta', array(
506
- '_qty',
507
- '_tax_class',
508
- '_product_id',
509
- '_variation_id',
510
- '_line_subtotal',
511
- '_line_subtotal_tax',
512
- '_line_total',
513
- '_line_tax',
514
- '_vendor_order_item_id',
515
- '_vendor_commission',
516
- WC_Vendors::$pv_options->get_option( 'sold_by_label' ),
517
- ) ) ) ) {
518
- continue;
519
- }
520
-
521
- // Skip serialised meta
522
- if ( is_serialized( $meta['meta_value'] ) ) {
523
- continue;
524
- }
525
-
526
- // Get attribute data
527
- if ( taxonomy_exists( wc_sanitize_taxonomy_name( $meta['meta_key'] ) ) ) {
528
- $term = get_term_by( 'slug', $meta['meta_value'], wc_sanitize_taxonomy_name( $meta['meta_key'] ) );
529
- $meta['meta_key'] = wc_attribute_label( wc_sanitize_taxonomy_name( $meta['meta_key'] ) );
530
- $meta['meta_value'] = isset( $term->name ) ? $term->name : $meta['meta_value'];
531
- } else {
532
- $meta['meta_key'] = apply_filters( 'woocommerce_attribute_label', wc_attribute_label( $meta['meta_key'], $wc_product ), $meta['meta_key'] );
533
- }
534
-
535
- $products .= '<tr><th>' . wp_kses_post( rawurldecode( $meta['meta_key'] ) ) . ':</th><td>' . rawurldecode( $meta['meta_value'] ) . '</td></tr>';
536
- }
537
- $products .= '</table>';
538
- }
539
-
540
- }
541
-
542
- $order_id = ( version_compare( WC_VERSION, '2.7', '<' ) ) ? $order->id : $order->get_id();
543
- $shippers = (array) get_post_meta( $order_id, 'wc_pv_shipped', true );
544
- $shipped = in_array($user_id, $shippers) ? __( 'Yes', 'wcvendors' ) : __( 'No', 'wcvendors' ) ;
545
-
546
- $sum = WCV_Queries::sum_for_orders( array( $order_id ), array('vendor_id' =>get_current_user_id() ), false );
547
- $sum = reset( $sum );
548
-
549
- WC_Vendors::log( $sum );
550
-
551
- $total = $sum->line_total;
552
-
553
- $comment_output = '';
554
-
555
- $order_date = ( version_compare( WC_VERSION, '2.7', '<' ) ) ? $order->order_date : $order->get_date_created();
556
-
557
- $order_items = array();
558
- $order_items[ 'order_id' ] = $order_id;
559
- $order_items[ 'customer' ] = $order->get_formatted_shipping_address();
560
- $order_items[ 'products' ] = $products;
561
- $order_items[ 'total' ] = wc_price( $total );
562
- $order_items[ 'date' ] = date_i18n( wc_date_format(), strtotime( $order_date ) );
563
- $order_items[ 'status' ] = $shipped;
564
-
565
- $orders[] = (object) $order_items;
566
-
567
- $model_id++;
568
- }
569
- }
570
- return $orders;
571
-
572
- }
573
-
574
-
575
- /**
576
- * Get the vendor products sold
577
- *
578
- * @param $user_id - the user_id to get the products of
579
- *
580
- * @return unknown
581
- */
582
- public function get_vendor_products( $user_id )
583
- {
584
- global $wpdb;
585
-
586
- $vendor_products = array();
587
- $sql = '';
588
-
589
- $sql .= "SELECT product_id FROM {$wpdb->prefix}pv_commission WHERE vendor_id = {$user_id} AND status != 'reversed' GROUP BY product_id";
590
-
591
- $results = $wpdb->get_results( $sql );
592
-
593
- foreach ( $results as $value ) {
594
- $ids[ ] = $value->product_id;
595
- }
596
-
597
- if ( !empty( $ids ) ) {
598
- $vendor_products = get_posts(
599
- array(
600
- 'numberposts' => -1,
601
- 'orderby' => 'post_date',
602
- 'post_type' => array( 'product', 'product_variation' ),
603
- 'order' => 'DESC',
604
- 'include' => $ids
605
- )
606
- );
607
- }
608
-
609
- return $vendor_products;
610
- }
611
-
612
-
613
- /**
614
- * All orders for a specific product
615
- *
616
- * @param array $product_ids
617
- * @param array $args (optional)
618
- *
619
- * @return object
620
- */
621
- public function get_orders_for_vendor_products( array $product_ids, array $args = array() )
622
- {
623
- global $wpdb;
624
-
625
- if ( empty( $product_ids ) ) return false;
626
-
627
- $defaults = array(
628
- 'status' => apply_filters( 'wcvendors_completed_statuses', array( 'completed', 'processing' ) ),
629
- );
630
-
631
- $args = wp_parse_args( $args, $defaults );
632
-
633
-
634
- $sql = "
635
- SELECT order_id
636
- FROM {$wpdb->prefix}pv_commission as order_items
637
- WHERE product_id IN ('" . implode( "','", $product_ids ) . "')
638
- AND status != 'reversed'
639
- ";
640
-
641
- if ( !empty( $args[ 'vendor_id' ] ) ) {
642
- $sql .= "
643
- AND vendor_id = {$args['vendor_id']}
644
- ";
645
- }
646
-
647
- $sql .= "
648
- GROUP BY order_id
649
- ORDER BY time DESC
650
- ";
651
-
652
- $orders = $wpdb->get_results( $sql );
653
-
654
- return $orders;
655
- }
656
-
657
-
658
-
659
- /**
660
- * prepare_items function.
661
- *
662
- * @access public
663
- */
664
- function prepare_items()
665
- {
666
-
667
-
668
- /**
669
- * Init column headers
670
- */
671
- $this->_column_headers = $this->get_column_info();
672
-
673
-
674
- /**
675
- * Process bulk actions
676
- */
677
- $this->process_bulk_action();
678
-
679
- /**
680
- * Get items
681
- */
682
-
683
- $this->items = $this->get_orders();
684
-
685
- /**
686
- * Pagination
687
- */
688
- }
689
-
690
-
691
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/classes/admin/class-vendor-applicants.php DELETED
@@ -1,103 +0,0 @@
1
- <?php
2
-
3
- /**
4
- *
5
- */
6
- class WCV_Vendor_Applicants
7
- {
8
-
9
- function __construct()
10
- {
11
- add_filter( 'user_row_actions', array( $this, 'user_row_actions' ), 10, 2 );
12
- add_filter( 'load-users.php', array( $this, 'user_row_actions_commit' ) );
13
- }
14
-
15
- /**
16
- *
17
- *
18
- * @param unknown $actions
19
- * @param unknown $user_object
20
- *
21
- * @return unknown
22
- */
23
- function user_row_actions( $actions, $user_object )
24
- {
25
- if ( !empty( $_GET[ 'role' ] ) && $_GET[ 'role' ] == 'pending_vendor' ) {
26
- $actions[ 'approve_vendor' ] = "<a href='?role=pending_vendor&action=approve_vendor&user_id=" . $user_object->ID . "'>" . __( 'Approve', 'cgc_ub' ) . "</a>";
27
- $actions[ 'deny_vendor' ] = "<a href='?role=pending_vendor&action=deny_vendor&user_id=" . $user_object->ID . "'>" . __( 'Deny', 'cgc_ub' ) . "</a>";
28
- }
29
-
30
- return $actions;
31
- }
32
-
33
-
34
- /**
35
- *
36
- */
37
- public function user_row_actions_commit()
38
- {
39
- if ( !empty( $_GET[ 'action' ] ) && !empty( $_GET[ 'user_id' ] ) ) {
40
-
41
- $wp_user_object = new WP_User( (int) $_GET[ 'user_id' ] );
42
-
43
- switch ( $_GET[ 'action' ] ) {
44
- case 'approve_vendor':
45
- $role = 'vendor';
46
- add_action( 'admin_notices', array( $this, 'approved' ) );
47
- do_action( 'wcvendors_approve_vendor', $wp_user_object );
48
- break;
49
-
50
- case 'deny_vendor':
51
- $role = 'subscriber';
52
- add_action( 'admin_notices', array( $this, 'denied' ) );
53
- do_action( 'wcvendors_deny_vendor', $wp_user_object );
54
- break;
55
-
56
- default:
57
- // code...
58
- break;
59
- }
60
-
61
- $wp_user_object->set_role( $role );
62
-
63
- }
64
- }
65
-
66
-
67
- /**
68
- *
69
- */
70
- public function denied()
71
- {
72
- echo '<div class="updated">';
73
- echo '<p>' . __( 'Vendor has been <b>denied</b>.', 'wcvendors' ) . '</p>';
74
- echo '</div>';
75
- }
76
-
77
-
78
- /**
79
- *
80
- */
81
- public function approved()
82
- {
83
- echo '<div class="updated">';
84
- echo '<p>' . __( 'Vendor has been <b>approved</b>.', 'wcvendors' ) . '</p>';
85
- echo '</div>';
86
- }
87
-
88
-
89
- /**
90
- *
91
- *
92
- * @param unknown $values
93
- *
94
- * @return unknown
95
- */
96
- public function show_pending_vendors_link( $values )
97
- {
98
- $values[ 'pending_vendors' ] = '<a href="?role=asd">' . __( 'Pending Vendors', 'wcvendors' ) . ' <span class="count">(3)</span></a>';
99
-
100
- return $values;
101
- }
102
-
103
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/classes/admin/class-vendor-reports.php DELETED
@@ -1,121 +0,0 @@
1
- <?php
2
-
3
- /**
4
- * Report views
5
- *
6
- * @author Matt Gates <http://mgates.me>
7
- * @package ProductVendor
8
- */
9
-
10
-
11
- class WCV_Vendor_Reports
12
- {
13
-
14
-
15
- /**
16
- * Constructor
17
- */
18
- function __construct()
19
- {
20
- $this->vendor_id = !current_user_can( 'manage_woocommerce' ) ? wp_get_current_user()->ID : '';
21
- if ( !empty ( $this->vendor_id ) ) {
22
- add_filter( 'woocommerce_reports_charts', array( $this, 'filter_tabs' ), 99 );
23
- add_filter( 'woocommerce_json_search_found_products', array( $this, 'filter_products_json' ) );
24
- add_filter( 'woocommerce_reports_product_sales_order_items', array( $this, 'filter_products' ) );
25
- add_filter( 'woocommerce_reports_top_sellers_order_items', array( $this, 'filter_products' ) );
26
- add_filter( 'woocommerce_reports_top_earners_order_items', array( $this, 'filter_products' ) );
27
- }
28
-
29
- }
30
-
31
- /**
32
- * Show only reports that are useful to a vendor
33
- *
34
- * @param array $tabs
35
- *
36
- * @return array
37
- */
38
- public function filter_tabs( $tabs )
39
- {
40
- global $woocommerce;
41
-
42
- $remove = array(
43
- 'woocommerce_sales_overview',
44
- 'woocommerce_daily_sales',
45
- 'woocommerce_monthly_sales',
46
- 'woocommerce_monthly_taxes',
47
- 'woocommerce_category_sales',
48
- 'woocommerce_coupon_sales',
49
- );
50
-
51
- $reports = $tabs[ 'orders' ][ 'reports' ];
52
-
53
- foreach ( $reports as $key => $chart ) {
54
- if ( $key == 'coupon_usage' ) {
55
- unset( $tabs[ 'orders' ][ 'reports' ][ $key ] );
56
- }
57
- }
58
-
59
- // These are admin tabs
60
- $return = array(
61
- 'orders' => $tabs[ 'orders' ]
62
- );
63
-
64
- return $return;
65
- }
66
-
67
-
68
- /**
69
- * Filter products based on current vendor
70
- *
71
- * @param unknown $orders
72
- *
73
- * @return unknown
74
- */
75
- public function filter_products( $orders )
76
- {
77
- $products = WCV_Vendors::get_vendor_products( $this->vendor_id );
78
-
79
- $ids = array();
80
- foreach ( $products as $product ) {
81
- $ids[ ] = ( $product->ID );
82
- }
83
-
84
- foreach ( $orders as $key => $order ) {
85
-
86
- if ( !in_array( $order->product_id, $ids ) ) {
87
- unset( $orders[ $key ] );
88
- continue;
89
- } else {
90
- if ( !empty( $order->line_total ) ) {
91
- $orders[ $key ]->line_total = WCV_Commission::calculate_commission( $order->line_total, $order->product_id, $order, $order->qty );
92
- }
93
- }
94
-
95
- }
96
-
97
- return $orders;
98
- }
99
-
100
-
101
- /**
102
- *
103
- *
104
- * @param unknown $products
105
- *
106
- * @return unknown
107
- */
108
- public function filter_products_json( $products )
109
- {
110
- $vendor_products = WCV_Vendors::get_vendor_products( $this->vendor_id );
111
-
112
- $ids = array();
113
- foreach ( $vendor_products as $vendor_product ) {
114
- $ids[ $vendor_product->ID ] = $vendor_product->post_title;
115
- }
116
-
117
- return array_intersect_key( $products, $ids );
118
- }
119
-
120
-
121
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/classes/admin/emails/class-emails.php DELETED
@@ -1,151 +0,0 @@
1
- <?php
2
-
3
- if ( !defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
4
-
5
- /**
6
- *
7
- *
8
- * @author Matt Gates <http://mgates.me>
9
- * @package
10
- */
11
-
12
-
13
- class WCV_Emails
14
- {
15
-
16
-
17
- /**
18
- *
19
- */
20
- function __construct()
21
- {
22
- add_filter( 'woocommerce_email_classes', array( $this, 'check_items' ) );
23
- add_filter( 'woocommerce_resend_order_emails_available', array( $this, 'order_action' ) );
24
- add_filter( 'woocommerce_order_product_title', array( 'WCV_Emails', 'show_vendor_in_email' ), 10, 2 );
25
- add_action( 'set_user_role', array( $this, 'application_status_email' ), 10, 2 );
26
- add_action( 'transition_post_status', array( $this, 'trigger_new_product' ), 10, 3 );
27
-
28
- add_filter( 'woocommerce_email_recipient_low_stock', array( $this, 'vendor_stock_email'), 10, 2 );
29
- add_filter( 'woocommerce_email_recipient_no_stock', array( $this, 'vendor_stock_email'), 10, 2 );
30
- add_filter( 'woocommerce_email_recipient_backorder', array( $this, 'vendor_stock_email'), 10, 2 );
31
- }
32
-
33
- public function trigger_new_product( $from, $to, $post )
34
- {
35
- global $woocommerce;
36
-
37
- if ( $from != $to && $post->post_status == 'pending' && WCV_Vendors::is_vendor( $post->post_author ) && $post->post_type == 'product' ) {
38
- $mails = $woocommerce->mailer()->get_emails();
39
- if ( !empty( $mails ) ) {
40
- $mails[ 'WC_Email_Notify_Admin' ]->trigger( $post->post_id, $post );
41
- }
42
- }
43
- }
44
-
45
-
46
- /**
47
- *
48
- *
49
- * @param unknown $user_id
50
- * @param unknown $role
51
- */
52
- function application_status_email( $user_id, $role )
53
- {
54
- global $woocommerce;
55
-
56
- if ( !empty( $_POST[ 'apply_for_vendor' ] ) || ( !empty( $_GET[ 'action' ] ) && ( $_GET[ 'action' ] == 'approve_vendor' || $_GET[ 'action' ] == 'deny_vendor' ) ) ) {
57
-
58
- if ( $role == 'pending_vendor' ) {
59
- $status = __( 'pending', 'wcvendors' );
60
- } else if ( $role == 'vendor' ) {
61
- $status = __( 'approved', 'wcvendors' );
62
- } else if ( !empty( $_GET[ 'action' ] ) && $_GET[ 'action' ] == 'deny_vendor' ) {
63
- $status = __( 'denied', 'wcvendors' );
64
- }
65
-
66
- $mails = $woocommerce->mailer()->get_emails();
67
-
68
- if ( isset( $status ) && !empty( $mails ) ) {
69
- $mails[ 'WC_Email_Approve_Vendor' ]->trigger( $user_id, $status );
70
- }
71
- }
72
- }
73
-
74
-
75
- /**
76
- *
77
- *
78
- * @param unknown $name
79
- * @param unknown $_product
80
- *
81
- * @return unknown
82
- */
83
- function show_vendor_in_email( $name, $_product )
84
- {
85
- $product = get_post( $_product->get_id() );
86
- $sold_by_label = WC_Vendors::$pv_options->get_option( 'sold_by_label' );
87
- $sold_by = WCV_Vendors::is_vendor( $product->post_author )
88
- ? sprintf( '<a href="%s">%s</a>', WCV_Vendors::get_vendor_shop_page( $product->post_author ), WCV_Vendors::get_vendor_sold_by( $product->post_author ) )
89
- : get_bloginfo( 'name' );
90
-
91
- $name .= '<small class="wcvendors_sold_by_in_email"><br />' . apply_filters('wcvendors_sold_by_in_email', $sold_by_label, $_product->get_id(), $product->post_author ). $sold_by . '</small><br />';
92
-
93
- return $name;
94
- }
95
-
96
-
97
- /**
98
- *
99
- *
100
- * @param unknown $available_emails
101
- *
102
- * @return unknown
103
- */
104
- public function order_action( $available_emails )
105
- {
106
- $available_emails[ ] = 'vendor_new_order';
107
-
108
- return $available_emails;
109
- }
110
-
111
-
112
- /**
113
- *
114
- *
115
- * @param unknown $emails
116
- *
117
- * @return unknown
118
- */
119
- public function check_items( $emails )
120
- {
121
- require_once wcv_plugin_dir . 'classes/admin/emails/class-wc-notify-admin.php';
122
- require_once wcv_plugin_dir . 'classes/admin/emails/class-wc-notify-vendor.php';
123
- require_once wcv_plugin_dir . 'classes/admin/emails/class-wc-approve-vendor.php';
124
- require_once wcv_plugin_dir . 'classes/admin/emails/class-wc-notify-shipped.php';
125
-
126
- $emails[ 'WC_Email_Notify_Vendor' ] = new WC_Email_Notify_Vendor();
127
- $emails[ 'WC_Email_Approve_Vendor' ] = new WC_Email_Approve_Vendor();
128
- $emails[ 'WC_Email_Notify_Admin' ] = new WC_Email_Notify_Admin();
129
- $emails[ 'WC_Email_Notify_Shipped' ] = new WC_Email_Notify_Shipped();
130
-
131
- return $emails;
132
- }
133
-
134
- /**
135
- * Add the vendor email to the low stock emails.
136
- *
137
- */
138
- public function vendor_stock_email( $emails, $product ) {
139
-
140
- if ( WCV_Vendors::is_vendor( $product->post->post_author ) ) {
141
- $vendor_data = get_userdata( $product->post->post_author );
142
- $vendor_email = $vendor_data->user_email;
143
- $emails .= ','.$vendor_email;
144
- }
145
-
146
- return $emails;
147
-
148
- }
149
-
150
-
151
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/classes/admin/emails/class-wc-approve-vendor.php DELETED
@@ -1,165 +0,0 @@
1
- <?php
2
-
3
- if ( !defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
4
-
5
- /**
6
- * New Order Email
7
- *
8
- * An email sent to the admin when a new order is received/paid for.
9
- *
10
- * @class WC_Email_Approve_Vendor
11
- * @version 2.0.0
12
- * @extends WC_Email
13
- * @author WooThemes
14
- * @package WooCommerce/Classes/Emails
15
- */
16
-
17
-
18
- class WC_Email_Approve_Vendor extends WC_Email
19
- {
20
-
21
-
22
- /**
23
- * Constructor
24
- */
25
- function __construct()
26
- {
27
- $this->id = 'vendor_application';
28
- $this->title = __( 'Vendor Application', 'wcvendors' );
29
- $this->description = __( 'Vendor application will either be approved, denied, or pending.', 'wcvendors' );
30
-
31
- $this->heading = __( 'Application {status}', 'wcvendors' );
32
- $this->subject = __( '[{blogname}] Your vendor application has been {status}', 'wcvendors' );
33
-
34
- $this->template_base = dirname( dirname( dirname( dirname( __FILE__ ) ) ) ) . '/templates/emails/';
35
- $this->template_html = 'application-status.php';
36
- $this->template_plain = 'application-status.php';
37
-
38
- // Call parent constuctor
39
- parent::__construct();
40
-
41
- // Other settings
42
- $this->recipient = $this->get_option( 'recipient' );
43
-
44
- if ( !$this->recipient )
45
- $this->recipient = get_option( 'admin_email' );
46
- }
47
-
48
- /**
49
- * trigger function.
50
- *
51
- * @access public
52
- * @return void
53
- *
54
- * @param unknown $order_id
55
- */
56
- function trigger( $user_id, $status )
57
- {
58
- if ( !$this->is_enabled() ) return;
59
-
60
- $this->find[ ] = '{status}';
61
- $this->replace[ ] = $status;
62
-
63
- $this->status = $status;
64
-
65
- $this->user = get_userdata( $user_id );
66
- $user_email = $this->user->user_email;
67
-
68
- $this->send( $user_email, $this->get_subject(), $this->get_content(), $this->get_headers(), $this->get_attachments() );
69
-
70
- if ( $status == __( 'pending', 'wcvendors' ) ) {
71
- $this->send( $this->get_recipient(), $this->get_subject(), $this->get_content(), $this->get_headers(), $this->get_attachments() );
72
- }
73
- }
74
-
75
- /**
76
- * get_content_html function.
77
- *
78
- * @access public
79
- * @return string
80
- */
81
- function get_content_html()
82
- {
83
- ob_start();
84
- wc_get_template( $this->template_html, array(
85
- 'status' => $this->status,
86
- 'user' => $this->user,
87
- 'email_heading' => $this->get_heading()
88
- ), 'woocommerce', $this->template_base );
89
-
90
- return ob_get_clean();
91
- }
92
-
93
-
94
- /**
95
- * get_content_plain function.
96
- *
97
- * @access public
98
- * @return string
99
- */
100
- function get_content_plain()
101
- {
102
- ob_start();
103
- wc_get_template( $this->template_plain, array(
104
- 'status' => $this->status,
105
- 'user' => $this->user,
106
- 'email_heading' => $this->get_heading()
107
- ), 'woocommerce', $this->template_base );
108
-
109
- return ob_get_clean();
110
- }
111
-
112
-
113
- /**
114
- * Initialise Settings Form Fields
115
- *
116
- * @access public
117
- * @return void
118
- */
119
- function init_form_fields()
120
- {
121
- $this->form_fields = array(
122
- 'enabled' => array(
123
- 'title' => __( 'Enable/Disable', 'wcvendors' ),
124
- 'type' => 'checkbox',
125
- 'label' => __( 'Enable this email notification', 'wcvendors' ),
126
- 'default' => 'yes'
127
- ),
128
- 'recipient' => array(
129
- 'title' => __( 'Recipient(s)', 'woocommerce' ),
130
- 'type' => 'text',
131
- 'description' => sprintf( __( 'Enter recipients (comma separated) for this email. Defaults to <code>%s</code>.', 'wcvendors' ), esc_attr( get_option( 'admin_email' ) ) ),
132
- 'placeholder' => '',
133
- 'default' => ''
134
- ),
135
- 'subject' => array(
136
- 'title' => __( 'Subject', 'wcvendors' ),
137
- 'type' => 'text',
138
- 'description' => sprintf( __( 'This controls the email subject line. Leave blank to use the default subject: <code>%s</code>.', 'wcvendors' ), $this->subject ),
139
- 'placeholder' => '',
140
- 'default' => ''
141
- ),
142
- 'heading' => array(
143
- 'title' => __( 'Email Heading', 'wcvendors' ),
144
- 'type' => 'text',
145
- 'description' => sprintf( __( 'This controls the main heading contained within the email notification. Leave blank to use the default heading: <code>%s</code>.', 'wcvendors' ), $this->heading ),
146
- 'placeholder' => '',
147
- 'default' => ''
148
- ),
149
- 'email_type' => array(
150
- 'title' => __( 'Email type', 'wcvendors' ),
151
- 'type' => 'select',
152
- 'description' => __( 'Choose which format of email to send.', 'wcvendors' ),
153
- 'default' => 'html',
154
- 'class' => 'email_type',
155
- 'options' => array(
156
- 'plain' => __( 'Plain text', 'wcvendors' ),
157
- 'html' => __( 'HTML', 'wcvendors' ),
158
- 'multipart' => __( 'Multipart', 'wcvendors' ),
159
- )
160
- )
161
- );
162
- }
163
-
164
-
165
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/classes/admin/emails/class-wc-notify-admin.php DELETED
@@ -1,176 +0,0 @@
1
- <?php
2
-
3
- if ( !defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
4
-
5
- /**
6
- * New Order Email
7
- *
8
- * An email sent to the admin when a new product is created.
9
- *
10
- * @class WC_Email_Notify_Admin
11
- * @version 2.0.0
12
- * @extends WC_Email
13
- * @author WooThemes
14
- * @package WooCommerce/Classes/Emails
15
- */
16
-
17
-
18
- class WC_Email_Notify_Admin extends WC_Email
19
- {
20
-
21
-
22
- /**
23
- * Constructor
24
- */
25
- function __construct()
26
- {
27
- $this->id = 'admin_new_vendor_product';
28
- $this->title = __( 'New Vendor Product', 'wcvendors' );
29
- $this->description = __( 'New order emails are sent when a new product is submitted by a vendor', 'wcvendors' );
30
-
31
- $this->heading = __( 'New product submitted: {product_name}', 'wcvendors' );
32
- $this->subject = __( '[{blogname}] New product submitted by {vendor_name} - {product_name}', 'wcvendors' );
33
-
34
- $this->template_base = dirname( dirname( dirname( dirname( __FILE__ ) ) ) ) . '/templates/emails/';
35
- $this->template_html = 'new-product.php';
36
- $this->template_plain = 'new-product.php';
37
-
38
- // Triggers for this email
39
- add_action( 'pending_product', array( $this, 'trigger' ), 10, 2 );
40
- add_action( 'pending_product_variation', array( $this, 'trigger' ), 10, 2 );
41
-
42
- // Call parent constuctor
43
- parent::__construct();
44
-
45
- // Other settings
46
- $this->recipient = $this->get_option( 'recipient' );
47
-
48
- if ( !$this->recipient )
49
- $this->recipient = get_option( 'admin_email' );
50
- }
51
-
52
-
53
- /**
54
- * trigger function.
55
- *
56
- * @access public
57
- * @return void
58
- *
59
- * @param unknown $order_id
60
- */
61
- function trigger( $id, $post )
62
- {
63
-
64
- // Ensure that the post author is a vendor
65
- if ( !WCV_Vendors::is_vendor( $post->post_author ) ) {
66
- return;
67
- }
68
-
69
- if ( !$this->is_enabled() ) return;
70
-
71
- $this->find[ ] = '{product_name}';
72
- $this->product_name = $post->post_title;
73
- $this->replace[ ] = $this->product_name;
74
-
75
- $this->find[ ] = '{vendor_name}';
76
- $this->vendor_name = WCV_Vendors::get_vendor_shop_name( $post->post_author );
77
- $this->replace[ ] = $this->vendor_name;
78
-
79
- $this->post_id = $post->ID;
80
-
81
- $this->send( $this->get_recipient(), $this->get_subject(), $this->get_content(), $this->get_headers(), $this->get_attachments() );
82
- }
83
-
84
- /**
85
- * get_content_html function.
86
- *
87
- * @access public
88
- * @return string
89
- */
90
- function get_content_html()
91
- {
92
- ob_start();
93
- wc_get_template( $this->template_html, array(
94
- 'product_name' => $this->product_name,
95
- 'vendor_name' => $this->vendor_name,
96
- 'post_id' => $this->post_id,
97
- 'email_heading' => $this->get_heading()
98
- ), 'woocommerce', $this->template_base );
99
-
100
- return ob_get_clean();
101
- }
102
-
103
-
104
- /**
105
- * get_content_plain function.
106
- *
107
- * @access public
108
- * @return string
109
- */
110
- function get_content_plain()
111
- {
112
- ob_start();
113
- wc_get_template( $this->template_plain, array(
114
- 'product_name' => $this->product_name,
115
- 'vendor_name' => $this->vendor_name,
116
- 'post_id' => $this->post_id,
117
- 'email_heading' => $this->get_heading()
118
- ), 'woocommerce', $this->template_base );
119
-
120
- return ob_get_clean();
121
- }
122
-
123
-
124
- /**
125
- * Initialise Settings Form Fields
126
- *
127
- * @access public
128
- * @return void
129
- */
130
- function init_form_fields()
131
- {
132
- $this->form_fields = array(
133
- 'enabled' => array(
134
- 'title' => __( 'Enable/Disable', 'wcvendors' ),
135
- 'type' => 'checkbox',
136
- 'label' => __( 'Enable this email notification', 'wcvendors' ),
137
- 'default' => 'yes'
138
- ),
139
- 'recipient' => array(
140
- 'title' => __( 'Recipient(s)', 'woocommerce' ),
141
- 'type' => 'text',
142
- 'description' => sprintf( __( 'Enter recipients (comma separated) for this email. Defaults to <code>%s</code>.', 'woocommerce' ), esc_attr( get_option( 'admin_email' ) ) ),
143
- 'placeholder' => '',
144
- 'default' => ''
145
- ),
146
- 'subject' => array(
147
- 'title' => __( 'Subject', 'wcvendors' ),
148
- 'type' => 'text',
149
- 'description' => sprintf( __( 'This controls the email subject line. Leave blank to use the default subject: <code>%s</code>.', 'wcvendors' ), $this->subject ),
150
- 'placeholder' => '',
151
- 'default' => ''
152
- ),
153
- 'heading' => array(
154
- 'title' => __( 'Email Heading', 'wcvendors' ),
155
- 'type' => 'text',
156
- 'description' => sprintf( __( 'This controls the main heading contained within the email notification. Leave blank to use the default heading: <code>%s</code>.', 'wcvendors' ), $this->heading ),
157
- 'placeholder' => '',
158
- 'default' => ''
159
- ),
160
- 'email_type' => array(
161
- 'title' => __( 'Email type', 'wcvendors' ),
162
- 'type' => 'select',
163
- 'description' => __( 'Choose which format of email to send.', 'wcvendors' ),
164
- 'default' => 'html',
165
- 'class' => 'email_type',
166
- 'options' => array(
167
- 'plain' => __( 'Plain text', 'wcvendors' ),
168
- 'html' => __( 'HTML', 'wcvendors' ),
169
- 'multipart' => __( 'Multipart', 'wcvendors' ),
170
- )
171
- )
172
- );
173
- }
174
-
175
-
176
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/classes/admin/emails/class-wc-notify-shipped.php DELETED
@@ -1,201 +0,0 @@
1
- <?php
2
-
3
- if ( !defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
4
-
5
- /**
6
- * New Order Email
7
- *
8
- * An email sent to the admin when a new product is created.
9
- *
10
- * @class WC_Email_Notify_Shipped
11
- * @version 2.0.0
12
- * @extends WC_Email
13
- * @author WooThemes
14
- * @package WooCommerce/Classes/Emails
15
- */
16
-
17
-
18
- class WC_Email_Notify_Shipped extends WC_Email
19
- {
20
-
21
-
22
- /**
23
- * Constructor
24
- */
25
- function __construct()
26
- {
27
- $this->id = 'vendor_notify_shipped';
28
- $this->title = __( 'Vendor has shipped', 'wcvendors' );
29
- $this->description = __( 'An email is sent when a vendor has marked one of their orders as shipped.', 'wcvendors' );
30
-
31
- $this->heading = __( 'Your order has been shipped', 'wcvendors' );
32
- $this->subject = __( '[{blogname}] Your order has been shipped ({order_number}) - {order_date}', 'wcvendors' );
33
-
34
- $this->template_html = 'notify-vendor-shipped.php';
35
- $this->template_plain = 'notify-vendor-shipped.php';
36
- $this->template_base = dirname( dirname( dirname( dirname( __FILE__ ) ) ) ) . '/templates/emails/';
37
-
38
- // Call parent constuctor
39
- parent::__construct();
40
- }
41
-
42
-
43
- /**
44
- * trigger function.
45
- *
46
- * @access public
47
- * @return void
48
- *
49
- * @param unknown $order_id
50
- */
51
- function trigger( $order_id, $vendor_id )
52
- {
53
- $this->object = new WC_Order( $order_id );
54
- $this->current_vendor = $vendor_id;
55
- $order_date = ( version_compare( WC_VERSION, '2.7', '<' ) ) ? $this->object->order_date : $this->object->get_date_created();
56
-
57
- $this->find[ ] = '{order_date}';
58
- $this->replace[ ] = date_i18n( wc_date_format(), strtotime( $order_date ) );
59
-
60
- $this->find[ ] = '{order_number}';
61
- $this->replace[ ] = $this->object->get_order_number();
62
-
63
- $billing_email = ( version_compare( WC_VERSION, '2.7', '<' ) ) ? $this->object->billing_email : $this->object->get_billing_email();
64
-
65
- if ( !$this->is_enabled() ) return;
66
-
67
- add_filter( 'woocommerce_order_get_items', array( $this, 'check_items' ), 10, 2 );
68
- add_filter( 'woocommerce_get_order_item_totals', array( $this, 'check_order_totals' ), 10, 2 );
69
- $this->send( $billing_email, $this->get_subject(), $this->get_content(), $this->get_headers(), $this->get_attachments() );
70
- remove_filter( 'woocommerce_get_order_item_totals', array( $this, 'check_order_totals' ), 10, 2 );
71
- remove_filter( 'woocommerce_order_get_items', array( $this, 'check_items' ), 10, 2 );
72
- }
73
-
74
-
75
- /**
76
- *
77
- *
78
- * @param unknown $items
79
- * @param unknown $order
80
- *
81
- * @return unknown
82
- */
83
- public function check_items( $items, $order )
84
- {
85
- foreach ( $items as $key => $product ) {
86
-
87
- if ( empty( $product[ 'product_id' ] ) ) {
88
- unset( $items[ $key ] );
89
- continue;
90
- }
91
-
92
- $author = WCV_Vendors::get_vendor_from_product( $product[ 'product_id' ] );
93
-
94
- if ( $this->current_vendor != $author ) {
95
- unset( $items[ $key ] );
96
- continue;
97
- }
98
-
99
- }
100
-
101
- return $items;
102
- }
103
-
104
- /**
105
- *
106
- *
107
- * @param unknown $total_rows
108
- * @param unknown $order
109
- *
110
- * @return unknown
111
- */
112
- public function check_order_totals( $total_rows, $order )
113
- {
114
- $return[ 'cart_subtotal' ] = $total_rows[ 'cart_subtotal' ];
115
- $return[ 'cart_subtotal' ][ 'label' ] = __( 'Subtotal:', 'wcvendors' );
116
-
117
- return $return;
118
- }
119
-
120
- /**
121
- * get_content_html function.
122
- *
123
- * @access public
124
- * @return string
125
- */
126
- function get_content_html()
127
- {
128
- ob_start();
129
- wc_get_template( $this->template_html, array(
130
- 'order' => $this->object,
131
- 'email_heading' => $this->get_heading()
132
- ), 'woocommerce', $this->template_base );
133
-
134
- return ob_get_clean();
135
- }
136
-
137
-
138
- /**
139
- * get_content_plain function.
140
- *
141
- * @access public
142
- * @return string
143
- */
144
- function get_content_plain()
145
- {
146
- ob_start();
147
- wc_get_template( $this->template_plain, array(
148
- 'order' => $this->object,
149
- 'email_heading' => $this->get_heading()
150
- ), 'woocommerce', $this->template_base );
151
-
152
- return ob_get_clean();
153
- }
154
-
155
-
156
- /**
157
- * Initialise Settings Form Fields
158
- *
159
- * @access public
160
- * @return void
161
- */
162
- function init_form_fields()
163
- {
164
- $this->form_fields = array(
165
- 'enabled' => array(
166
- 'title' => __( 'Enable/Disable', 'wcvendors' ),
167
- 'type' => 'checkbox',
168
- 'label' => __( 'Enable this email notification', 'wcvendors' ),
169
- 'default' => 'yes'
170
- ),
171
- 'subject' => array(
172
- 'title' => __( 'Subject', 'wcvendors' ),
173
- 'type' => 'text',
174
- 'description' => sprintf( __( 'This controls the email subject line. Leave blank to use the default subject: <code>%s</code>.', 'wcvendors' ), $this->subject ),
175
- 'placeholder' => '',
176
- 'default' => ''
177
- ),
178
- 'heading' => array(
179
- 'title' => __( 'Email Heading', 'wcvendors' ),
180
- 'type' => 'text',
181
- 'description' => sprintf( __( 'This controls the main heading contained within the email notification. Leave blank to use the default heading: <code>%s</code>.', 'wcvendors' ), $this->heading ),
182
- 'placeholder' => '',
183
- 'default' => ''
184
- ),
185
- 'email_type' => array(
186
- 'title' => __( 'Email type', 'wcvendors' ),
187
- 'type' => 'select',
188
- 'description' => __( 'Choose which format of email to send.', 'wcvendors' ),
189
- 'default' => 'html',
190
- 'class' => 'email_type',
191
- 'options' => array(
192
- 'plain' => __( 'Plain text', 'wcvendors' ),
193
- 'html' => __( 'HTML', 'wcvendors' ),
194
- 'multipart' => __( 'Multipart', 'wcvendors' ),
195
- )
196
- )
197
- );
198
- }
199
-
200
-
201
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/classes/admin/emails/class-wc-notify-vendor.php DELETED
@@ -1,352 +0,0 @@
1
- <?php
2
-
3
- if ( !defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
4
-
5
- /**
6
- * New Order Email
7
- *
8
- * An email sent to the vendor when a new order is received/paid for.
9
- *
10
- * @class WC_Email_Notify_Vendor
11
- * @version 2.0.0
12
- * @extends WC_Email
13
- * @author WooThemes
14
- * @package WooCommerce/Classes/Emails
15
- */
16
-
17
-
18
- class WC_Email_Notify_Vendor extends WC_Email
19
- {
20
-
21
- /**
22
- * Constructor
23
- */
24
- function __construct()
25
- {
26
- $this->id = 'vendor_new_order';
27
- $this->title = __( 'Notify vendors', 'wcvendors' );
28
- $this->description = __( 'New order emails are sent when an order is received/paid by a customer.', 'wcvendors' );
29
-
30
- $this->heading = __( 'New customer order', 'wcvendors' );
31
- $this->subject = __( '[{blogname}] New customer order ({order_number}) - {order_date}', 'wcvendors' );
32
-
33
- $this->template_html = 'vendor-new-order.php';
34
- $this->template_plain = 'vendor-new-order.php';
35
- $this->template_base = dirname( dirname( dirname( dirname( __FILE__ ) ) ) ) . '/templates/emails/';
36
-
37
- // Triggers for this email
38
- add_action( 'woocommerce_order_status_pending_to_processing_notification', array( $this, 'trigger' ) );
39
- add_action( 'woocommerce_order_status_pending_to_completed_notification', array( $this, 'trigger' ) );
40
- add_action( 'woocommerce_order_status_failed_to_processing_notification', array( $this, 'trigger' ) );
41
- add_action( 'woocommerce_order_status_failed_to_completed_notification', array( $this, 'trigger' ) );
42
- add_action( 'woocommerce_order_status_on-hold_to_processing_notification', array( $this, 'trigger' ) ); // Added in 1.8.4
43
- add_action( 'woocommerce_order_status_on-hold_to_completed_notification', array( $this, 'trigger' ) ); // Added in 1.8.4
44
-
45
- // Call parent constuctor
46
- parent::__construct();
47
- }
48
-
49
-
50
- /**
51
- * trigger function.
52
- *
53
- * @access public
54
- * @return void
55
- *
56
- * @param unknown $order_id
57
- */
58
- function trigger( $order_id )
59
- {
60
- global $woocommerce;
61
-
62
- if ( $order_id ) {
63
- $this->object = new WC_Order( $order_id );
64
-
65
- $order_date = ( version_compare( WC_VERSION, '2.7', '<' ) ) ? $this->object->order_date : $this->object->get_date_created();
66
-
67
- $this->find[ ] = '{order_date}';
68
- $this->replace[ ] = date_i18n( wc_date_format(), strtotime( $order_date ) );
69
-
70
- $this->find[ ] = '{order_number}';
71
- $this->replace[ ] = $this->object->get_order_number();
72
-
73
- }
74
-
75
- if ( !$this->is_enabled() ) return;
76
-
77
- $vendors = $this->get_vendors( $this->object );
78
-
79
- if ( empty( $vendors ) ) return;
80
-
81
- add_filter( 'woocommerce_order_get_items', array( $this, 'check_items' ), 10, 2 );
82
- add_filter( 'woocommerce_get_order_item_totals', array( $this, 'check_order_totals' ), 10, 2 );
83
- add_filter( 'woocommerce_order_formatted_line_subtotal', array( $this, 'check_order_formatted_line_subtotal' ), 10, 3 );
84
- add_filter( 'woocommerce_order_subtotal_to_display', array( $this, 'check_order_subtotal_to_display'), 10, 3 );
85
- foreach ( $vendors as $user_id => $user_email ) {
86
- $this->current_vendor = $user_id;
87
- $this->send( $user_email, $this->get_subject(), $this->get_content(), $this->get_headers(), $this->get_attachments() );
88
- }
89
- remove_filter( 'woocommerce_get_order_item_totals', array( $this, 'check_order_totals' ), 10, 2 );
90
- remove_filter( 'woocommerce_order_get_items', array( $this, 'check_items' ), 10, 2 );
91
- remove_filter( 'woocommerce_order_formatted_line_subtotal', array( $this, 'check_order_formatted_line_subtotal' ), 10, 3 );
92
- remove_filter( 'woocommerce_order_subtotal_to_display', array( $this, 'check_order_subtotal_to_display'), 10, 3 );
93
- }
94
-
95
-
96
- /**
97
- *
98
- *
99
- * @param unknown $total_rows
100
- * @param unknown $order
101
- *
102
- * @return unknown
103
- */
104
- function check_order_totals( $total_rows, $order )
105
- {
106
-
107
- $commission_label = apply_filters('wcv_notify_vendor_commission_label', __( 'Commission Subtotal:', 'wcvendors' ) ) ;
108
- $return[ 'cart_subtotal' ] = $total_rows[ 'cart_subtotal' ];
109
- $return[ 'cart_subtotal' ][ 'label' ] = $commission_label;
110
-
111
- if ( WC_Vendors::$pv_options->get_option( 'give_tax' ) ) {
112
- $return[ 'tax_subtotal'] = array( 'label' => '', 'value' => '');
113
- $return[ 'tax_subtotal']['label'] = apply_filters('wcv_notify_vendor_tax_label', __( 'Tax Subtotal:', 'wcvendors' ) ) ;
114
- }
115
-
116
- $dues = WCV_Vendors::get_vendor_dues_from_order( $order );
117
-
118
- foreach ( $dues as $due ) {
119
- if ( $this->current_vendor == $due['vendor_id'] ) {
120
- if (!empty($return[ 'shipping' ])) $return[ 'shipping' ] = $total_rows[ 'shipping' ];
121
- $return[ 'shipping' ]['label'] = __( 'Shipping Subtotal:', 'wcvendors' );
122
- $return[ 'shipping' ][ 'value' ] = wc_price( $due['shipping'] );
123
- if ( WC_Vendors::$pv_options->get_option( 'give_tax' ) ) {
124
- $return[ 'tax_subtotal']['value'] += $due['tax'];
125
- }
126
- break;
127
- }
128
- }
129
- // Format tax price
130
- if ( WC_Vendors::$pv_options->get_option( 'give_tax' ) ) {
131
- $return[ 'tax_subtotal']['value'] = wc_price( $return[ 'tax_subtotal'] ['value'] );
132
- }
133
-
134
- return $return;
135
- }
136
-
137
-
138
- /**
139
- *
140
- *
141
- * @param unknown $order
142
- *
143
- * @return unknown
144
- */
145
- public function get_vendors( $order )
146
- {
147
- $items = $order->get_items();
148
- $vendors = array();
149
-
150
- foreach ( $items as $key => $product ) {
151
-
152
- if ( empty( $product[ 'product_id' ] ) ) continue;
153
- $author = WCV_Vendors::get_vendor_from_product( $product[ 'product_id' ] );
154
-
155
- // Only store the vendor authors
156
- if ( !WCV_Vendors::is_vendor( $author ) ) {
157
- unset( $items[ $key ] );
158
- continue;
159
- }
160
-
161
- $vendors[ $author ] = get_userdata( $author )->user_email;
162
- }
163
-
164
- return $vendors;
165
- }
166
-
167
- /**
168
- *
169
- *
170
- * @param unknown $items
171
- * @param unknown $order
172
- *
173
- * @return unknown
174
- */
175
- function check_items( $items, $order )
176
- {
177
-
178
- $settings = get_option( 'woocommerce_vendor_new_order_settings' );
179
-
180
- if ( empty( $settings ) ) $settings = $this->get_default_settings();
181
-
182
- foreach ( $items as $key => $product ) {
183
-
184
- // If this is a line item
185
- if ( $product['type'] == 'line_item' ) {
186
-
187
- $author = WCV_Vendors::get_vendor_from_product( $product[ 'product_id' ] );
188
-
189
- if ( $this->current_vendor != $author) {
190
- unset( $items[ $key ] );
191
- continue;
192
- } else {
193
-
194
- // If display commission is ticked show this otherwise show the full price.
195
- if ( 'yes' == $settings[ 'commission_display' ] ){
196
-
197
- $order_id = ( version_compare( WC_VERSION, '2.7', '<' ) ) ? $order->id : $order->get_id();
198
-
199
- $commission_due = WCV_Commission::get_commission_due( $order_id, $product[ 'product_id' ], $author );
200
-
201
- $items[ $key ][ 'line_subtotal' ] = $commission_due;
202
- $items[ $key ][ 'line_total' ] = $commission_due;
203
-
204
- // Don't display tax if give tax is not enabled.
205
- if ( !WC_Vendors::$pv_options->get_option( 'give_tax' ) ) {
206
- unset($items[ $key ][ 'line_tax' ]) ;
207
- }
208
- }
209
- }
210
- }
211
-
212
- }
213
-
214
- return $items;
215
-
216
- } // check_items()
217
-
218
-
219
- /**
220
- * get_content_html function.
221
- *
222
- * @access public
223
- * @return string
224
- */
225
- function get_content_html()
226
- {
227
- ob_start();
228
- wc_get_template( $this->template_html, array(
229
- 'order' => $this->object,
230
- 'email_heading' => $this->get_heading()
231
- ), 'woocommerce', $this->template_base );
232
-
233
- return ob_get_clean();
234
- }
235
-
236
-
237
- /**
238
- * get_content_plain function.
239
- *
240
- * @access public
241
- * @return string
242
- */
243
- function get_content_plain()
244
- {
245
- ob_start();
246
- wc_get_template( $this->template_plain, array(
247
- 'order' => $this->object,
248
- 'email_heading' => $this->get_heading()
249
- ), 'woocommerce', $this->template_base );
250
-
251
- return ob_get_clean();
252
- }
253
-
254
-
255
- /**
256
- * Initialise Settings Form Fields
257
- *
258
- * @access public
259
- * @return void
260
- */
261
- function init_form_fields()
262
- {
263
- $this->form_fields = array(
264
- 'enabled' => array(
265
- 'title' => __( 'Enable/Disable', 'wcvendors' ),
266
- 'type' => 'checkbox',
267
- 'label' => __( 'Enable this email notification', 'wcvendors' ),
268
- 'default' => 'yes'
269
- ),
270
- 'subject' => array(
271
- 'title' => __( 'Subject', 'wcvendors' ),
272
- 'type' => 'text',
273
- 'description' => sprintf( __( 'This controls the email subject line. Leave blank to use the default subject: <code>%s</code>.', 'wcvendors' ), $this->subject ),
274
- 'placeholder' => '',
275
- 'default' => ''
276
- ),
277
- 'heading' => array(
278
- 'title' => __( 'Email Heading', 'wcvendors' ),
279
- 'type' => 'text',
280
- 'description' => sprintf( __( 'This controls the main heading contained within the email notification. Leave blank to use the default heading: <code>%s</code>.', 'wcvendors' ), $this->heading ),
281
- 'placeholder' => '',
282
- 'default' => ''
283
- ),
284
- 'commission_display' => array(
285
- 'title' => __( 'Product Totals', 'wcvendors' ),
286
- 'type' => 'checkbox',
287
- 'label' => __( 'Show the commission due/paid as the product totals instead of the product prices.', 'wcvendors' ),
288
- 'default' => 'yes'
289
- ),
290
- 'email_type' => array(
291
- 'title' => __( 'Email type', 'wcvendors' ),
292
- 'type' => 'select',
293
- 'description' => __( 'Choose which format of email to send.', 'wcvendors' ),
294
- 'default' => 'html',
295
- 'class' => 'email_type',
296
- 'options' => array(
297
- 'plain' => __( 'Plain text', 'wcvendors' ),
298
- 'html' => __( 'HTML', 'wcvendors' ),
299
- 'multipart' => __( 'Multipart', 'wcvendors' ),
300
- )
301
- )
302
- );
303
- }
304
-
305
-
306
- /**
307
- * check the order line item sub total to ensure that the tax is shown correctly on the vendor emails
308
- */
309
- function check_order_formatted_line_subtotal( $subtotal, $item, $order ){
310
-
311
- $order_currency = ( version_compare( WC_VERSION, '2.7', '<' ) ) ? $order->get_order_currency() : $order->get_currency();
312
-
313
- $subtotal = wc_price( $order->get_line_subtotal( $item ), array( 'currency' => $order_currency ) );
314
-
315
- return $subtotal;
316
-
317
- } // check_order_formatted_line_subtotal()
318
-
319
-
320
- function check_order_subtotal_to_display( $subtotal, $compound, $order ){
321
-
322
- $new_subtotal = 0;
323
-
324
- foreach ( $order->get_items() as $key => $product ) {
325
- $new_subtotal += $product[ 'line_subtotal' ];
326
- }
327
-
328
- return wc_price( $new_subtotal );
329
-
330
-
331
- } // check_order_subtotal_to_display()
332
-
333
- /**
334
- * Get the default settings for this email if not already set.
335
- *
336
- * @since 1.9.9
337
- *
338
- */
339
- public function get_default_settings(){
340
-
341
- $settings = array();
342
-
343
- foreach ( $this->form_fields as $key => $field ) {
344
- $settings[ $key ] = $field[ 'default' ];
345
- }
346
-
347
- return $settings;
348
-
349
- } // get_default_settings()
350
-
351
-
352
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/classes/admin/settings/README.md DELETED
@@ -1,126 +0,0 @@
1
- WP Simple Settings Framework
2
- ================================
3
-
4
- A minimalistic framework for Wordpress Settings API.
5
-
6
- Quick start
7
- ------------
8
-
9
- * [Download the latest release](https://github.com/Geczy/WP-Simple-Settings-Framework/zipball/master) (zip)
10
-
11
- * Or, clone the repo, `git clone git://github.com/Geczy/WP-Simple-Settings-Framework.git`
12
-
13
- Installation
14
- ------------
15
- 1. Include the framework in your Wordpress plugin by using:
16
-
17
- ```php
18
- <?php
19
- add_action( 'init', 'sf_load_settings' );
20
- function sf_load_settings() {
21
- require 'classes/sf-class-settings.php';
22
- $settings_framework = new SF_Settings_API($id = 'my_plugin_name', $title = 'My Plugin Title', $menu = 'plugins.php', __FILE__);
23
- }
24
- ```
25
-
26
- Optionally, you might want to make `$settings_framework` a global variable so that you can use the [helper functions](#helpers).
27
-
28
- 2. Open `sf-options.php` to begin configuring your options.
29
-
30
- Features
31
- ------------
32
-
33
- ### Automatic settings page
34
- Don't want it under the Plugins tab like in the screenshot? No problem, you can choose where you want it!
35
-
36
- You can also change "Simple Settings" submenu to be anything you'd like.
37
-
38
- ![settings page example](http://i.imgur.com/aEGUD.png)
39
-
40
- ---
41
-
42
- ### Tooltips
43
- ![tooltips example](http://i.imgur.com/Z3Pnk.png)
44
-
45
- Optional tooltips using [Twitter Bootstrap](http://twitter.github.com/bootstrap/javascript.html#tooltips)!
46
-
47
- ---
48
-
49
- ### Select box replacement
50
- ![select box replacement](http://i.imgur.com/ikOXH.png)
51
-
52
- Utilizing [Select2](http://ivaynberg.github.com/select2/) to display select boxes. It's pretty cool!
53
-
54
- ---
55
-
56
- ### Multiple tabs
57
- ![multiple tabs example](http://i.imgur.com/OUM4i.png)
58
-
59
- Create multiple tabs for your options.
60
-
61
- ---
62
-
63
- ### Input types
64
-
65
- * Text
66
- * Number
67
- * Textarea
68
- * Checkbox
69
- * Radio
70
- * Select
71
- * WP Pages
72
-
73
- Helpers
74
- ------------
75
-
76
- Update or add a new option
77
-
78
- ```php
79
- <?php
80
- $settings_framework->update_option('your_option', 'new_value');
81
- ```
82
-
83
- Get an existing option's value
84
-
85
- ```php
86
- <?php
87
- $settings_framework->get_option('your_option');
88
- ```
89
-
90
- Example configuration
91
- ------------
92
-
93
- Check out the [example config](https://github.com/Geczy/WP-Simple-Settings-Framework/blob/master/sf-options.php) for an idea of how to use every input type.
94
-
95
- Here's an example of one type, though:
96
-
97
- ```php
98
- <?php
99
- $options[] = array(
100
- 'name' => __( 'Name', 'geczy' ),
101
- 'desc' => __( 'Please tell me who you are.', 'geczy' ),
102
- 'id' => 'text_sample',
103
- 'type' => 'text',
104
- );
105
- ```
106
-
107
-
108
- Bug tracker
109
- -----------
110
-
111
- Have a bug? Please create an issue here on GitHub!
112
-
113
- https://github.com/Geczy/WP-Simple-Settings-Framework/issues/
114
-
115
- Copyright and License
116
- ---------------------
117
-
118
- Copyright 2012 Matthew Gates
119
-
120
- Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
121
-
122
- * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
123
- * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
124
- * Neither the names of the copyright holders nor the names of the contributors may be used to endorse or promote products derived from this software without specific prior written permission.
125
-
126
- http://www.opensource.org/licenses/bsd-license.php
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/classes/admin/settings/assets/css/sf-styles.css DELETED
@@ -1,167 +0,0 @@
1
- a.sf-tips {
2
- height: 16px;
3
- width: 16px;
4
- margin-top: 0.2em;
5
- float: right;
6
- background: url(../img/tip.png) no-repeat top left;
7
- }
8
-
9
- /*!
10
- * Bootstrap v2.3.1 [Styles for Tooltips]
11
- *
12
- * Copyright 2012 Twitter, Inc
13
- * Licensed under the Apache License v2.0
14
- * http://www.apache.org/licenses/LICENSE-2.0
15
- *
16
- * Designed and built with all the love in the world @twitter by @mdo and @fat.
17
- */
18
- .clearfix {
19
- *zoom: 1;
20
- }
21
-
22
- .clearfix:before, .clearfix:after {
23
- display: table;
24
- content: "";
25
- line-height: 0;
26
- }
27
-
28
- .clearfix:after {
29
- clear: both;
30
- }
31
-
32
- .hide-text {
33
- font: 0/0 a;
34
- color: transparent;
35
- text-shadow: none;
36
- background-color: transparent;
37
- border: 0;
38
- }
39
-
40
- .input-block-level {
41
- display: block;
42
- width: 100%;
43
- min-height: 30px;
44
- -webkit-box-sizing: border-box;
45
- -moz-box-sizing: border-box;
46
- box-sizing: border-box;
47
- }
48
-
49
- /* Tooltips */
50
- .tooltip {
51
- text-shadow: none;
52
- }
53
-
54
- .tooltip {
55
- position: absolute;
56
- z-index: 1030;
57
- display: block;
58
- visibility: visible;
59
- font-size: 11px;
60
- line-height: 1.4;
61
- opacity: 0;
62
- filter: alpha(opacity=0);
63
- }
64
-
65
- .tooltip.in {
66
- opacity: 0.8;
67
- filter: alpha(opacity=80);
68
- }
69
-
70
- .tooltip.top {
71
- margin-top: -3px;
72
- padding: 5px 0;
73
- }
74
-
75
- .tooltip.right {
76
- margin-left: 3px;
77
- padding: 0 5px;
78
- }
79
-
80
- .tooltip.bottom {
81
- margin-top: 3px;
82
- padding: 5px 0;
83
- }
84
-
85
- .tooltip.left {
86
- margin-left: -3px;
87
- padding: 0 5px;
88
- }
89
-
90
- .tooltip-inner {
91
- max-width: 200px;
92
- padding: 8px;
93
- color: #ffffff;
94
- text-align: center;
95
- text-decoration: none;
96
- background-color: #000000;
97
- -webkit-border-radius: 4px;
98
- -moz-border-radius: 4px;
99
- border-radius: 4px;
100
- }
101
-
102
- .tooltip-arrow {
103
- position: absolute;
104
- width: 0;
105
- height: 0;
106
- border-color: transparent;
107
- border-style: solid;
108
- }
109
-
110
- .tooltip.top .tooltip-arrow {
111
- bottom: 0;
112
- left: 50%;
113
- margin-left: -5px;
114
- border-width: 5px 5px 0;
115
- border-top-color: #000000;
116
- }
117
-
118
- .tooltip.right .tooltip-arrow {
119
- top: 50%;
120
- left: 0;
121
- margin-top: -5px;
122
- border-width: 5px 5px 5px 0;
123
- border-right-color: #000000;
124
- }
125
-
126
- .tooltip.left .tooltip-arrow {
127
- top: 50%;
128
- right: 0;
129
- margin-top: -5px;
130
- border-width: 5px 0 5px 5px;
131
- border-left-color: #000000;
132
- }
133
-
134
- .tooltip.bottom .tooltip-arrow {
135
- top: 0;
136
- left: 50%;
137
- margin-left: -5px;
138
- border-width: 0 5px 5px;
139
- border-bottom-color: #000000;
140
- }
141
-
142
- /* Animation */
143
- .fade {
144
- opacity: 0;
145
- -webkit-transition: opacity 0.15s linear;
146
- -moz-transition: opacity 0.15s linear;
147
- -o-transition: opacity 0.15s linear;
148
- transition: opacity 0.15s linear;
149
- }
150
-
151
- .fade.in {
152
- opacity: 1;
153
- }
154
-
155
- .collapse {
156
- position: relative;
157
- height: 0;
158
- overflow: hidden;
159
- -webkit-transition: height 0.35s ease;
160
- -moz-transition: height 0.35s ease;
161
- -o-transition: height 0.35s ease;
162
- transition: height 0.35s ease;
163
- }
164
-
165
- .collapse.in {
166
- height: auto;
167
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/classes/admin/settings/assets/img/tip.png DELETED
Binary file
trunk/classes/admin/settings/assets/js/bootstrap-tooltip.js DELETED
@@ -1,126 +0,0 @@
1
- /**
2
- * Bootstrap.js by @fat & @mdo
3
- * plugins: bootstrap-transition.js, bootstrap-tooltip.js
4
- * 2.3.1
5
- * Copyright 2012 Twitter, Inc.
6
- * http://www.apache.org/licenses/LICENSE-2.0.txt
7
- */
8
- !function (a) {
9
- a(function () {
10
- a.support.transition = function () {
11
- var a = function () {
12
- var a = document.createElement("bootstrap"), b = {WebkitTransition: "webkitTransitionEnd", MozTransition: "transitionend", OTransition: "oTransitionEnd otransitionend", transition: "transitionend"}, c;
13
- for (c in b)if (a.style[c] !== undefined)return b[c]
14
- }();
15
- return a && {end: a}
16
- }()
17
- })
18
- }(window.jQuery), !function (a) {
19
- var b = function (a, b) {
20
- this.init("tooltip", a, b)
21
- };
22
- b.prototype = {constructor: b, init: function (b, c, d) {
23
- var e, f, g, h, i;
24
- this.type = b, this.$element = a(c), this.options = this.getOptions(d), this.enabled = !0, g = this.options.trigger.split(" ");
25
- for (i = g.length; i--;)h = g[i], h == "click" ? this.$element.on("click." + this.type, this.options.selector, a.proxy(this.toggle, this)) : h != "manual" && (e = h == "hover" ? "mouseenter" : "focus", f = h == "hover" ? "mouseleave" : "blur", this.$element.on(e + "." + this.type, this.options.selector, a.proxy(this.enter, this)), this.$element.on(f + "." + this.type, this.options.selector, a.proxy(this.leave, this)));
26
- this.options.selector ? this._options = a.extend({}, this.options, {trigger: "manual", selector: ""}) : this.fixTitle()
27
- }, getOptions: function (b) {
28
- return b = a.extend({}, a.fn[this.type].defaults, this.$element.data(), b), b.delay && typeof b.delay == "number" && (b.delay = {show: b.delay, hide: b.delay}), b
29
- }, enter: function (b) {
30
- var c = a.fn[this.type].defaults, d = {}, e;
31
- this._options && a.each(this._options, function (a, b) {
32
- c[a] != b && (d[a] = b)
33
- }, this), e = a(b.currentTarget)[this.type](d).data(this.type);
34
- if (!e.options.delay || !e.options.delay.show)return e.show();
35
- clearTimeout(this.timeout), e.hoverState = "in", this.timeout = setTimeout(function () {
36
- e.hoverState == "in" && e.show()
37
- }, e.options.delay.show)
38
- }, leave: function (b) {
39
- var c = a(b.currentTarget)[this.type](this._options).data(this.type);
40
- this.timeout && clearTimeout(this.timeout);
41
- if (!c.options.delay || !c.options.delay.hide)return c.hide();
42
- c.hoverState = "out", this.timeout = setTimeout(function () {
43
- c.hoverState == "out" && c.hide()
44
- }, c.options.delay.hide)
45
- }, show: function () {
46
- var b, c, d, e, f, g, h = a.Event("show");
47
- if (this.hasContent() && this.enabled) {
48
- this.$element.trigger(h);
49
- if (h.isDefaultPrevented())return;
50
- b = this.tip(), this.setContent(), this.options.animation && b.addClass("fade"), f = typeof this.options.placement == "function" ? this.options.placement.call(this, b[0], this.$element[0]) : this.options.placement, b.detach().css({top: 0, left: 0, display: "block"}), this.options.container ? b.appendTo(this.options.container) : b.insertAfter(this.$element), c = this.getPosition(), d = b[0].offsetWidth, e = b[0].offsetHeight;
51
- switch (f) {
52
- case"bottom":
53
- g = {top: c.top + c.height, left: c.left + c.width / 2 - d / 2};
54
- break;
55
- case"top":
56
- g = {top: c.top - e, left: c.left + c.width / 2 - d / 2};
57
- break;
58
- case"left":
59
- g = {top: c.top + c.height / 2 - e / 2, left: c.left - d};
60
- break;
61
- case"right":
62
- g = {top: c.top + c.height / 2 - e / 2, left: c.left + c.width}
63
- }
64
- this.applyPlacement(g, f), this.$element.trigger("shown")
65
- }
66
- }, applyPlacement: function (a, b) {
67
- var c = this.tip(), d = c[0].offsetWidth, e = c[0].offsetHeight, f, g, h, i;
68
- c.offset(a).addClass(b).addClass("in"), f = c[0].offsetWidth, g = c[0].offsetHeight, b == "top" && g != e && (a.top = a.top + e - g, i = !0), b == "bottom" || b == "top" ? (h = 0, a.left < 0 && (h = a.left * -2, a.left = 0, c.offset(a), f = c[0].offsetWidth, g = c[0].offsetHeight), this.replaceArrow(h - d + f, f, "left")) : this.replaceArrow(g - e, g, "top"), i && c.offset(a)
69
- }, replaceArrow: function (a, b, c) {
70
- this.arrow().css(c, a ? 50 * (1 - a / b) + "%" : "")
71
- }, setContent: function () {
72
- var a = this.tip(), b = this.getTitle();
73
- a.find(".tooltip-inner")[this.options.html ? "html" : "text"](b), a.removeClass("fade in top bottom left right")
74
- }, hide: function () {
75
- function e() {
76
- var b = setTimeout(function () {
77
- c.off(a.support.transition.end).detach()
78
- }, 500);
79
- c.one(a.support.transition.end, function () {
80
- clearTimeout(b), c.detach()
81
- })
82
- }
83
-
84
- var b = this, c = this.tip(), d = a.Event("hide");
85
- this.$element.trigger(d);
86
- if (d.isDefaultPrevented())return;
87
- return c.removeClass("in"), a.support.transition && this.$tip.hasClass("fade") ? e() : c.detach(), this.$element.trigger("hidden"), this
88
- }, fixTitle: function () {
89
- var a = this.$element;
90
- (a.attr("title") || typeof a.attr("data-original-title") != "string") && a.attr("data-original-title", a.attr("title") || "").attr("title", "")
91
- }, hasContent: function () {
92
- return this.getTitle()
93
- }, getPosition: function () {
94
- var b = this.$element[0];
95
- return a.extend({}, typeof b.getBoundingClientRect == "function" ? b.getBoundingClientRect() : {width: b.offsetWidth, height: b.offsetHeight}, this.$element.offset())
96
- }, getTitle: function () {
97
- var a, b = this.$element, c = this.options;
98
- return a = b.attr("data-original-title") || (typeof c.title == "function" ? c.title.call(b[0]) : c.title), a
99
- }, tip: function () {
100
- return this.$tip = this.$tip || a(this.options.template)
101
- }, arrow: function () {
102
- return this.$arrow = this.$arrow || this.tip().find(".tooltip-arrow")
103
- }, validate: function () {
104
- this.$element[0].parentNode || (this.hide(), this.$element = null, this.options = null)
105
- }, enable: function () {
106
- this.enabled = !0
107
- }, disable: function () {
108
- this.enabled = !1
109
- }, toggleEnabled: function () {
110
- this.enabled = !this.enabled
111
- }, toggle: function (b) {
112
- var c = b ? a(b.currentTarget)[this.type](this._options).data(this.type) : this;
113
- c.tip().hasClass("in") ? c.hide() : c.show()
114
- }, destroy: function () {
115
- this.hide().$element.off("." + this.type).removeData(this.type)
116
- }};
117
- var c = a.fn.tooltip;
118
- a.fn.tooltip = function (c) {
119
- return this.each(function () {
120
- var d = a(this), e = d.data("tooltip"), f = typeof c == "object" && c;
121
- e || d.data("tooltip", e = new b(this, f)), typeof c == "string" && e[c]()
122
- })
123
- }, a.fn.tooltip.Constructor = b, a.fn.tooltip.defaults = {animation: !0, placement: "top", selector: !1, template: '<div class="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>', trigger: "hover focus", title: "", delay: 0, html: !1, container: !1}, a.fn.tooltip.noConflict = function () {
124
- return a.fn.tooltip = c, this
125
- }
126
- }(window.jQuery)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/classes/admin/settings/assets/js/js.iml DELETED
@@ -1,10 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <module type="WEB_MODULE" version="4">
3
- <component name="NewModuleRootManager" inherit-compiler-output="true">
4
- <exclude-output />
5
- <content url="file://$MODULE_DIR$" />
6
- <orderEntry type="inheritedJdk" />
7
- <orderEntry type="sourceFolder" forTests="false" />
8
- </component>
9
- </module>
10
-
 
 
 
 
 
 
 
 
 
 
trunk/classes/admin/settings/assets/js/select2/select2-bootstrap.css DELETED
@@ -1,87 +0,0 @@
1
- .form-control .select2-choice {
2
- border: 0;
3
- border-radius: 2px;
4
- }
5
-
6
- .form-control .select2-choice .select2-arrow {
7
- border-radius: 0 2px 2px 0;
8
- }
9
-
10
- .form-control.select2-container {
11
- height: auto !important;
12
- padding: 0;
13
- }
14
-
15
- .form-control.select2-container.select2-dropdown-open {
16
- border-color: #5897FB;
17
- border-radius: 3px 3px 0 0;
18
- }
19
-
20
- .form-control .select2-container.select2-dropdown-open .select2-choices {
21
- border-radius: 3px 3px 0 0;
22
- }
23
-
24
- .form-control.select2-container .select2-choices {
25
- border: 0 !important;
26
- border-radius: 3px;
27
- }
28
-
29
- .control-group.warning .select2-container .select2-choice,
30
- .control-group.warning .select2-container .select2-choices,
31
- .control-group.warning .select2-container-active .select2-choice,
32
- .control-group.warning .select2-container-active .select2-choices,
33
- .control-group.warning .select2-dropdown-open.select2-drop-above .select2-choice,
34
- .control-group.warning .select2-dropdown-open.select2-drop-above .select2-choices,
35
- .control-group.warning .select2-container-multi.select2-container-active .select2-choices {
36
- border: 1px solid #C09853 !important;
37
- }
38
-
39
- .control-group.warning .select2-container .select2-choice div {
40
- border-left: 1px solid #C09853 !important;
41
- background: #FCF8E3 !important;
42
- }
43
-
44
- .control-group.error .select2-container .select2-choice,
45
- .control-group.error .select2-container .select2-choices,
46
- .control-group.error .select2-container-active .select2-choice,
47
- .control-group.error .select2-container-active .select2-choices,
48
- .control-group.error .select2-dropdown-open.select2-drop-above .select2-choice,
49
- .control-group.error .select2-dropdown-open.select2-drop-above .select2-choices,
50
- .control-group.error .select2-container-multi.select2-container-active .select2-choices {
51
- border: 1px solid #B94A48 !important;
52
- }
53
-
54
- .control-group.error .select2-container .select2-choice div {
55
- border-left: 1px solid #B94A48 !important;
56
- background: #F2DEDE !important;
57
- }
58
-
59
- .control-group.info .select2-container .select2-choice,
60
- .control-group.info .select2-container .select2-choices,
61
- .control-group.info .select2-container-active .select2-choice,
62
- .control-group.info .select2-container-active .select2-choices,
63
- .control-group.info .select2-dropdown-open.select2-drop-above .select2-choice,
64
- .control-group.info .select2-dropdown-open.select2-drop-above .select2-choices,
65
- .control-group.info .select2-container-multi.select2-container-active .select2-choices {
66
- border: 1px solid #3A87AD !important;
67
- }
68
-
69
- .control-group.info .select2-container .select2-choice div {
70
- border-left: 1px solid #3A87AD !important;
71
- background: #D9EDF7 !important;
72
- }
73
-
74
- .control-group.success .select2-container .select2-choice,
75
- .control-group.success .select2-container .select2-choices,
76
- .control-group.success .select2-container-active .select2-choice,
77
- .control-group.success .select2-container-active .select2-choices,
78
- .control-group.success .select2-dropdown-open.select2-drop-above .select2-choice,
79
- .control-group.success .select2-dropdown-open.select2-drop-above .select2-choices,
80
- .control-group.success .select2-container-multi.select2-container-active .select2-choices {
81
- border: 1px solid #468847 !important;
82
- }
83
-
84
- .control-group.success .select2-container .select2-choice div {
85
- border-left: 1px solid #468847 !important;
86
- background: #DFF0D8 !important;
87
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/classes/admin/settings/assets/js/select2/select2-spinner.gif DELETED
Binary file
trunk/classes/admin/settings/assets/js/select2/select2.css DELETED
@@ -1,704 +0,0 @@
1
- /*
2
- Version: 3.5.2 Timestamp: Sat Nov 1 14:43:36 EDT 2014
3
- */
4
- .select2-container {
5
- margin: 0;
6
- position: relative;
7
- display: inline-block;
8
- /* inline-block for ie7 */
9
- zoom: 1;
10
- *display: inline;
11
- vertical-align: middle;
12
- }
13
-
14
- .select2-container,
15
- .select2-drop,
16
- .select2-search,
17
- .select2-search input {
18
- /*
19
- Force border-box so that % widths fit the parent
20
- container without overlap because of margin/padding.
21
- More Info : http://www.quirksmode.org/css/box.html
22
- */
23
- -webkit-box-sizing: border-box; /* webkit */
24
- -moz-box-sizing: border-box; /* firefox */
25
- box-sizing: border-box; /* css3 */
26
- }
27
-
28
- .select2-container .select2-choice {
29
- display: block;
30
- height: 26px;
31
- padding: 0 0 0 8px;
32
- overflow: hidden;
33
- position: relative;
34
-
35
- border: 1px solid #aaa;
36
- white-space: nowrap;
37
- line-height: 26px;
38
- color: #444;
39
- text-decoration: none;
40
-
41
- border-radius: 4px;
42
-
43
- background-clip: padding-box;
44
-
45
- -webkit-touch-callout: none;
46
- -webkit-user-select: none;
47
- -moz-user-select: none;
48
- -ms-user-select: none;
49
- user-select: none;
50
-
51
- background-color: #fff;
52
- background-image: -webkit-gradient(linear, left bottom, left top, color-stop(0, #eee), color-stop(0.5, #fff));
53
- background-image: -webkit-linear-gradient(center bottom, #eee 0%, #fff 50%);
54
- background-image: -moz-linear-gradient(center bottom, #eee 0%, #fff 50%);
55
- filter: progid:DXImageTransform.Microsoft.gradient(startColorstr = '#ffffff', endColorstr = '#eeeeee', GradientType = 0);
56
- background-image: linear-gradient(to top, #eee 0%, #fff 50%);
57
- }
58
-
59
- html[dir="rtl"] .select2-container .select2-choice {
60
- padding: 0 8px 0 0;
61
- }
62
-
63
- .select2-container.select2-drop-above .select2-choice {
64
- border-bottom-color: #aaa;
65
-
66
- border-radius: 0 0 4px 4px;
67
-
68
- background-image: -webkit-gradient(linear, left bottom, left top, color-stop(0, #eee), color-stop(0.9, #fff));
69
- background-image: -webkit-linear-gradient(center bottom, #eee 0%, #fff 90%);
70
- background-image: -moz-linear-gradient(center bottom, #eee 0%, #fff 90%);
71
- filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffff', endColorstr='#eeeeee', GradientType=0);
72
- background-image: linear-gradient(to bottom, #eee 0%, #fff 90%);
73
- }
74
-
75
- .select2-container.select2-allowclear .select2-choice .select2-chosen {
76
- margin-right: 42px;
77
- }
78
-
79
- .select2-container .select2-choice > .select2-chosen {
80
- margin-right: 26px;
81
- display: block;
82
- overflow: hidden;
83
-
84
- white-space: nowrap;
85
-
86
- text-overflow: ellipsis;
87
- float: none;
88
- width: auto;
89
- }
90
-
91
- html[dir="rtl"] .select2-container .select2-choice > .select2-chosen {
92
- margin-left: 26px;
93
- margin-right: 0;
94
- }
95
-
96
- .select2-container .select2-choice abbr {
97
- display: none;
98
- width: 12px;
99
- height: 12px;
100
- position: absolute;
101
- right: 24px;
102
- top: 8px;
103
-
104
- font-size: 1px;
105
- text-decoration: none;
106
-
107
- border: 0;
108
- background: url('select2.png') right top no-repeat;
109
- cursor: pointer;
110
- outline: 0;
111
- }
112
-
113
- .select2-container.select2-allowclear .select2-choice abbr {
114
- display: inline-block;
115
- }
116
-
117
- .select2-container .select2-choice abbr:hover {
118
- background-position: right -11px;
119
- cursor: pointer;
120
- }
121
-
122
- .select2-drop-mask {
123
- border: 0;
124
- margin: 0;
125
- padding: 0;
126
- position: fixed;
127
- left: 0;
128
- top: 0;
129
- min-height: 100%;
130
- min-width: 100%;
131
- height: auto;
132
- width: auto;
133
- opacity: 0;
134
- z-index: 9998;
135
- /* styles required for IE to work */
136
- background-color: #fff;
137
- filter: alpha(opacity=0);
138
- }
139
-
140
- .select2-drop {
141
- width: 100%;
142
- margin-top: -1px;
143
- position: absolute;
144
- z-index: 9999;
145
- top: 100%;
146
-
147
- background: #fff;
148
- color: #000;
149
- border: 1px solid #aaa;
150
- border-top: 0;
151
-
152
- border-radius: 0 0 4px 4px;
153
-
154
- -webkit-box-shadow: 0 4px 5px rgba(0, 0, 0, .15);
155
- box-shadow: 0 4px 5px rgba(0, 0, 0, .15);
156
- }
157
-
158
- .select2-drop.select2-drop-above {
159
- margin-top: 1px;
160
- border-top: 1px solid #aaa;
161
- border-bottom: 0;
162
-
163
- border-radius: 4px 4px 0 0;
164
-
165
- -webkit-box-shadow: 0 -4px 5px rgba(0, 0, 0, .15);
166
- box-shadow: 0 -4px 5px rgba(0, 0, 0, .15);
167
- }
168
-
169
- .select2-drop-active {
170
- border: 1px solid #5897fb;
171
- border-top: none;
172
- }
173
-
174
- .select2-drop.select2-drop-above.select2-drop-active {
175
- border-top: 1px solid #5897fb;
176
- }
177
-
178
- .select2-drop-auto-width {
179
- border-top: 1px solid #aaa;
180
- width: auto;
181
- }
182
-
183
- .select2-drop-auto-width .select2-search {
184
- padding-top: 4px;
185
- }
186
-
187
- .select2-container .select2-choice .select2-arrow {
188
- display: inline-block;
189
- width: 18px;
190
- height: 100%;
191
- position: absolute;
192
- right: 0;
193
- top: 0;
194
-
195
- border-left: 1px solid #aaa;
196
- border-radius: 0 4px 4px 0;
197
-
198
- background-clip: padding-box;
199
-
200
- background: #ccc;
201
- background-image: -webkit-gradient(linear, left bottom, left top, color-stop(0, #ccc), color-stop(0.6, #eee));
202
- background-image: -webkit-linear-gradient(center bottom, #ccc 0%, #eee 60%);
203
- background-image: -moz-linear-gradient(center bottom, #ccc 0%, #eee 60%);
204
- filter: progid:DXImageTransform.Microsoft.gradient(startColorstr = '#eeeeee', endColorstr = '#cccccc', GradientType = 0);
205
- background-image: linear-gradient(to top, #ccc 0%, #eee 60%);
206
- }
207
-
208
- html[dir="rtl"] .select2-container .select2-choice .select2-arrow {
209
- left: 0;
210
- right: auto;
211
-
212
- border-left: none;
213
- border-right: 1px solid #aaa;
214
- border-radius: 4px 0 0 4px;
215
- }
216
-
217
- .select2-container .select2-choice .select2-arrow b {
218
- display: block;
219
- width: 100%;
220
- height: 100%;
221
- background: url('select2.png') no-repeat 0 1px;
222
- }
223
-
224
- html[dir="rtl"] .select2-container .select2-choice .select2-arrow b {
225
- background-position: 2px 1px;
226
- }
227
-
228
- .select2-search {
229
- display: inline-block;
230
- width: 100%;
231
- min-height: 26px;
232
- margin: 0;
233
- padding-left: 4px;
234
- padding-right: 4px;
235
-
236
- position: relative;
237
- z-index: 10000;
238
-
239
- white-space: nowrap;
240
- }
241
-
242
- .select2-search input {
243
- width: 100%;
244
- height: auto !important;
245
- min-height: 26px;
246
- padding: 4px 20px 4px 5px;
247
- margin: 0;
248
-
249
- outline: 0;
250
- font-family: sans-serif;
251
- font-size: 1em;
252
-
253
- border: 1px solid #aaa;
254
- border-radius: 0;
255
-
256
- -webkit-box-shadow: none;
257
- box-shadow: none;
258
-
259
- background: #fff url('select2.png') no-repeat 100% -22px;
260
- background: url('select2.png') no-repeat 100% -22px, -webkit-gradient(linear, left bottom, left top, color-stop(0.85, #fff), color-stop(0.99, #eee));
261
- background: url('select2.png') no-repeat 100% -22px, -webkit-linear-gradient(center bottom, #fff 85%, #eee 99%);
262
- background: url('select2.png') no-repeat 100% -22px, -moz-linear-gradient(center bottom, #fff 85%, #eee 99%);
263
- background: url('select2.png') no-repeat 100% -22px, linear-gradient(to bottom, #fff 85%, #eee 99%) 0 0;
264
- }
265
-
266
- html[dir="rtl"] .select2-search input {
267
- padding: 4px 5px 4px 20px;
268
-
269
- background: #fff url('select2.png') no-repeat -37px -22px;
270
- background: url('select2.png') no-repeat -37px -22px, -webkit-gradient(linear, left bottom, left top, color-stop(0.85, #fff), color-stop(0.99, #eee));
271
- background: url('select2.png') no-repeat -37px -22px, -webkit-linear-gradient(center bottom, #fff 85%, #eee 99%);
272
- background: url('select2.png') no-repeat -37px -22px, -moz-linear-gradient(center bottom, #fff 85%, #eee 99%);
273
- background: url('select2.png') no-repeat -37px -22px, linear-gradient(to bottom, #fff 85%, #eee 99%) 0 0;
274
- }
275
-
276
- .select2-drop.select2-drop-above .select2-search input {
277
- margin-top: 4px;
278
- }
279
-
280
- .select2-search input.select2-active {
281
- background: #fff url('select2-spinner.gif') no-repeat 100%;
282
- background: url('select2-spinner.gif') no-repeat 100%, -webkit-gradient(linear, left bottom, left top, color-stop(0.85, #fff), color-stop(0.99, #eee));
283
- background: url('select2-spinner.gif') no-repeat 100%, -webkit-linear-gradient(center bottom, #fff 85%, #eee 99%);
284
- background: url('select2-spinner.gif') no-repeat 100%, -moz-linear-gradient(center bottom, #fff 85%, #eee 99%);
285
- background: url('select2-spinner.gif') no-repeat 100%, linear-gradient(to bottom, #fff 85%, #eee 99%) 0 0;
286
- }
287
-
288
- .select2-container-active .select2-choice,
289
- .select2-container-active .select2-choices {
290
- border: 1px solid #5897fb;
291
- outline: none;
292
-
293
- -webkit-box-shadow: 0 0 5px rgba(0, 0, 0, .3);
294
- box-shadow: 0 0 5px rgba(0, 0, 0, .3);
295
- }
296
-
297
- .select2-dropdown-open .select2-choice {
298
- border-bottom-color: transparent;
299
- -webkit-box-shadow: 0 1px 0 #fff inset;
300
- box-shadow: 0 1px 0 #fff inset;
301
-
302
- border-bottom-left-radius: 0;
303
- border-bottom-right-radius: 0;
304
-
305
- background-color: #eee;
306
- background-image: -webkit-gradient(linear, left bottom, left top, color-stop(0, #fff), color-stop(0.5, #eee));
307
- background-image: -webkit-linear-gradient(center bottom, #fff 0%, #eee 50%);
308
- background-image: -moz-linear-gradient(center bottom, #fff 0%, #eee 50%);
309
- filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#eeeeee', endColorstr='#ffffff', GradientType=0);
310
- background-image: linear-gradient(to top, #fff 0%, #eee 50%);
311
- }
312
-
313
- .select2-dropdown-open.select2-drop-above .select2-choice,
314
- .select2-dropdown-open.select2-drop-above .select2-choices {
315
- border: 1px solid #5897fb;
316
- border-top-color: transparent;
317
-
318
- background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0, #fff), color-stop(0.5, #eee));
319
- background-image: -webkit-linear-gradient(center top, #fff 0%, #eee 50%);
320
- background-image: -moz-linear-gradient(center top, #fff 0%, #eee 50%);
321
- filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#eeeeee', endColorstr='#ffffff', GradientType=0);
322
- background-image: linear-gradient(to bottom, #fff 0%, #eee 50%);
323
- }
324
-
325
- .select2-dropdown-open .select2-choice .select2-arrow {
326
- background: transparent;
327
- border-left: none;
328
- filter: none;
329
- }
330
- html[dir="rtl"] .select2-dropdown-open .select2-choice .select2-arrow {
331
- border-right: none;
332
- }
333
-
334
- .select2-dropdown-open .select2-choice .select2-arrow b {
335
- background-position: -18px 1px;
336
- }
337
-
338
- html[dir="rtl"] .select2-dropdown-open .select2-choice .select2-arrow b {
339
- background-position: -16px 1px;
340
- }
341
-
342
- .select2-hidden-accessible {
343
- border: 0;
344
- clip: rect(0 0 0 0);
345
- height: 1px;
346
- margin: -1px;
347
- overflow: hidden;
348
- padding: 0;
349
- position: absolute;
350
- width: 1px;
351
- }
352
-
353
- /* results */
354
- .select2-results {
355
- max-height: 200px;
356
- padding: 0 0 0 4px;
357
- margin: 4px 4px 4px 0;
358
- position: relative;
359
- overflow-x: hidden;
360
- overflow-y: auto;
361
- -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
362
- }
363
-
364
- html[dir="rtl"] .select2-results {
365
- padding: 0 4px 0 0;
366
- margin: 4px 0 4px 4px;
367
- }
368
-
369
- .select2-results ul.select2-result-sub {
370
- margin: 0;
371
- padding-left: 0;
372
- }
373
-
374
- .select2-results li {
375
- list-style: none;
376
- display: list-item;
377
- background-image: none;
378
- }
379
-
380
- .select2-results li.select2-result-with-children > .select2-result-label {
381
- font-weight: bold;
382
- }
383
-
384
- .select2-results .select2-result-label {
385
- padding: 3px 7px 4px;
386
- margin: 0;
387
- cursor: pointer;
388
-
389
- min-height: 1em;
390
-
391
- -webkit-touch-callout: none;
392
- -webkit-user-select: none;
393
- -moz-user-select: none;
394
- -ms-user-select: none;
395
- user-select: none;
396
- }
397
-
398
- .select2-results-dept-1 .select2-result-label { padding-left: 20px }
399
- .select2-results-dept-2 .select2-result-label { padding-left: 40px }
400
- .select2-results-dept-3 .select2-result-label { padding-left: 60px }
401
- .select2-results-dept-4 .select2-result-label { padding-left: 80px }
402
- .select2-results-dept-5 .select2-result-label { padding-left: 100px }
403
- .select2-results-dept-6 .select2-result-label { padding-left: 110px }
404
- .select2-results-dept-7 .select2-result-label { padding-left: 120px }
405
-
406
- .select2-results .select2-highlighted {
407
- background: #3875d7;
408
- color: #fff;
409
- }
410
-
411
- .select2-results li em {
412
- background: #feffde;
413
- font-style: normal;
414
- }
415
-
416
- .select2-results .select2-highlighted em {
417
- background: transparent;
418
- }
419
-
420
- .select2-results .select2-highlighted ul {
421
- background: #fff;
422
- color: #000;
423
- }
424
-
425
- .select2-results .select2-no-results,
426
- .select2-results .select2-searching,
427
- .select2-results .select2-ajax-error,
428
- .select2-results .select2-selection-limit {
429
- background: #f4f4f4;
430
- display: list-item;
431
- padding-left: 5px;
432
- }
433
-
434
- /*
435
- disabled look for disabled choices in the results dropdown
436
- */
437
- .select2-results .select2-disabled.select2-highlighted {
438
- color: #666;
439
- background: #f4f4f4;
440
- display: list-item;
441
- cursor: default;
442
- }
443
- .select2-results .select2-disabled {
444
- background: #f4f4f4;
445
- display: list-item;
446
- cursor: default;
447
- }
448
-
449
- .select2-results .select2-selected {
450
- display: none;
451
- }
452
-
453
- .select2-more-results.select2-active {
454
- background: #f4f4f4 url('select2-spinner.gif') no-repeat 100%;
455
- }
456
-
457
- .select2-results .select2-ajax-error {
458
- background: rgba(255, 50, 50, .2);
459
- }
460
-
461
- .select2-more-results {
462
- background: #f4f4f4;
463
- display: list-item;
464
- }
465
-
466
- /* disabled styles */
467
-
468
- .select2-container.select2-container-disabled .select2-choice {
469
- background-color: #f4f4f4;
470
- background-image: none;
471
- border: 1px solid #ddd;
472
- cursor: default;
473
- }
474
-
475
- .select2-container.select2-container-disabled .select2-choice .select2-arrow {
476
- background-color: #f4f4f4;
477
- background-image: none;
478
- border-left: 0;
479
- }
480
-
481
- .select2-container.select2-container-disabled .select2-choice abbr {
482
- display: none;
483
- }
484
-
485
-
486
- /* multiselect */
487
-
488
- .select2-container-multi .select2-choices {
489
- height: auto !important;
490
- height: 1%;
491
- margin: 0;
492
- padding: 0 5px 0 0;
493
- position: relative;
494
-
495
- border: 1px solid #aaa;
496
- cursor: text;
497
- overflow: hidden;
498
-
499
- background-color: #fff;
500
- background-image: -webkit-gradient(linear, 0% 0%, 0% 100%, color-stop(1%, #eee), color-stop(15%, #fff));
501
- background-image: -webkit-linear-gradient(top, #eee 1%, #fff 15%);
502
- background-image: -moz-linear-gradient(top, #eee 1%, #fff 15%);
503
- background-image: linear-gradient(to bottom, #eee 1%, #fff 15%);
504
- }
505
-
506
- html[dir="rtl"] .select2-container-multi .select2-choices {
507
- padding: 0 0 0 5px;
508
- }
509
-
510
- .select2-locked {
511
- padding: 3px 5px 3px 5px !important;
512
- }
513
-
514
- .select2-container-multi .select2-choices {
515
- min-height: 26px;
516
- }
517
-
518
- .select2-container-multi.select2-container-active .select2-choices {
519
- border: 1px solid #5897fb;
520
- outline: none;
521
-
522
- -webkit-box-shadow: 0 0 5px rgba(0, 0, 0, .3);
523
- box-shadow: 0 0 5px rgba(0, 0, 0, .3);
524
- }
525
- .select2-container-multi .select2-choices li {
526
- float: left;
527
- list-style: none;
528
- }
529
- html[dir="rtl"] .select2-container-multi .select2-choices li
530
- {
531
- float: right;
532
- }
533
- .select2-container-multi .select2-choices .select2-search-field {
534
- margin: 0;
535
- padding: 0;
536
- white-space: nowrap;
537
- }
538
-
539
- .select2-container-multi .select2-choices .select2-search-field input {
540
- padding: 5px;
541
- margin: 1px 0;
542
-
543
- font-family: sans-serif;
544
- font-size: 100%;
545
- color: #666;
546
- outline: 0;
547
- border: 0;
548
- -webkit-box-shadow: none;
549
- box-shadow: none;
550
- background: transparent !important;
551
- }
552
-
553
- .select2-container-multi .select2-choices .select2-search-field input.select2-active {
554
- background: #fff url('select2-spinner.gif') no-repeat 100% !important;
555
- }
556
-
557
- .select2-default {
558
- color: #999 !important;
559
- }
560
-
561
- .select2-container-multi .select2-choices .select2-search-choice {
562
- padding: 3px 5px 3px 18px;
563
- margin: 3px 0 3px 5px;
564
- position: relative;
565
-
566
- line-height: 13px;
567
- color: #333;
568
- cursor: default;
569
- border: 1px solid #aaaaaa;
570
-
571
- border-radius: 3px;
572
-
573
- -webkit-box-shadow: 0 0 2px #fff inset, 0 1px 0 rgba(0, 0, 0, 0.05);
574
- box-shadow: 0 0 2px #fff inset, 0 1px 0 rgba(0, 0, 0, 0.05);
575
-
576
- background-clip: padding-box;
577
-
578
- -webkit-touch-callout: none;
579
- -webkit-user-select: none;
580
- -moz-user-select: none;
581
- -ms-user-select: none;
582
- user-select: none;
583
-
584
- background-color: #e4e4e4;
585
- filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#eeeeee', endColorstr='#f4f4f4', GradientType=0);
586
- background-image: -webkit-gradient(linear, 0% 0%, 0% 100%, color-stop(20%, #f4f4f4), color-stop(50%, #f0f0f0), color-stop(52%, #e8e8e8), color-stop(100%, #eee));
587
- background-image: -webkit-linear-gradient(top, #f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eee 100%);
588
- background-image: -moz-linear-gradient(top, #f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eee 100%);
589
- background-image: linear-gradient(to bottom, #f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eee 100%);
590
- }
591
- html[dir="rtl"] .select2-container-multi .select2-choices .select2-search-choice
592
- {
593
- margin: 3px 5px 3px 0;
594
- padding: 3px 18px 3px 5px;
595
- }
596
- .select2-container-multi .select2-choices .select2-search-choice .select2-chosen {
597
- cursor: default;
598
- }
599
- .select2-container-multi .select2-choices .select2-search-choice-focus {
600
- background: #d4d4d4;
601
- }
602
-
603
- .select2-search-choice-close {
604
- display: block;
605
- width: 12px;
606
- height: 13px;
607
- position: absolute;
608
- right: 3px;
609
- top: 4px;
610
-
611
- font-size: 1px;
612
- outline: none;
613
- background: url('select2.png') right top no-repeat;
614
- }
615
- html[dir="rtl"] .select2-search-choice-close {
616
- right: auto;
617
- left: 3px;
618
- }
619
-
620
- .select2-container-multi .select2-search-choice-close {
621
- left: 3px;
622
- }
623
-
624
- html[dir="rtl"] .select2-container-multi .select2-search-choice-close {
625
- left: auto;
626
- right: 2px;
627
- }
628
-
629
- .select2-container-multi .select2-choices .select2-search-choice .select2-search-choice-close:hover {
630
- background-position: right -11px;
631
- }
632
- .select2-container-multi .select2-choices .select2-search-choice-focus .select2-search-choice-close {
633
- background-position: right -11px;
634
- }
635
-
636
- /* disabled styles */
637
- .select2-container-multi.select2-container-disabled .select2-choices {
638
- background-color: #f4f4f4;
639
- background-image: none;
640
- border: 1px solid #ddd;
641
- cursor: default;
642
- }
643
-
644
- .select2-container-multi.select2-container-disabled .select2-choices .select2-search-choice {
645
- padding: 3px 5px 3px 5px;
646
- border: 1px solid #ddd;
647
- background-image: none;
648
- background-color: #f4f4f4;
649
- }
650
-
651
- .select2-container-multi.select2-container-disabled .select2-choices .select2-search-choice .select2-search-choice-close { display: none;
652
- background: none;
653
- }
654
- /* end multiselect */
655
-
656
-
657
- .select2-result-selectable .select2-match,
658
- .select2-result-unselectable .select2-match {
659
- text-decoration: underline;
660
- }
661
-
662
- .select2-offscreen, .select2-offscreen:focus {
663
- clip: rect(0 0 0 0) !important;
664
- width: 1px !important;
665
- height: 1px !important;
666
- border: 0 !important;
667
- margin: 0 !important;
668
- padding: 0 !important;
669
- overflow: hidden !important;
670
- position: absolute !important;
671
- outline: 0 !important;
672
- left: 0px !important;
673
- top: 0px !important;
674
- }
675
-
676
- .select2-display-none {
677
- display: none;
678
- }
679
-
680
- .select2-measure-scrollbar {
681
- position: absolute;
682
- top: -10000px;
683
- left: -10000px;
684
- width: 100px;
685
- height: 100px;
686
- overflow: scroll;
687
- }
688
-
689
- /* Retina-ize icons */
690
-
691
- @media only screen and (-webkit-min-device-pixel-ratio: 1.5), only screen and (min-resolution: 2dppx) {
692
- .select2-search input,
693
- .select2-search-choice-close,
694
- .select2-container .select2-choice abbr,
695
- .select2-container .select2-choice .select2-arrow b {
696
- background-image: url('select2x2.png') !important;
697
- background-repeat: no-repeat !important;
698
- background-size: 60px 40px !important;
699
- }
700
-
701
- .select2-search input {
702
- background-position: 100% -21px !important;
703
- }
704
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/classes/admin/settings/assets/js/select2/select2.js DELETED
@@ -1,3541 +0,0 @@
1
- /*
2
- Copyright 2012 Igor Vaynberg
3
-
4
- Version: 3.5.2 Timestamp: Sat Nov 1 14:43:36 EDT 2014
5
-
6
- This software is licensed under the Apache License, Version 2.0 (the "Apache License") or the GNU
7
- General Public License version 2 (the "GPL License"). You may choose either license to govern your
8
- use of this software only upon the condition that you accept all of the terms of either the Apache
9
- License or the GPL License.
10
-
11
- You may obtain a copy of the Apache License and the GPL License at:
12
-
13
- http://www.apache.org/licenses/LICENSE-2.0
14
- http://www.gnu.org/licenses/gpl-2.0.html
15
-
16
- Unless required by applicable law or agreed to in writing, software distributed under the
17
- Apache License or the GPL License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
18
- CONDITIONS OF ANY KIND, either express or implied. See the Apache License and the GPL License for
19
- the specific language governing permissions and limitations under the Apache License and the GPL License.
20
- */
21
- (function ($) {
22
- if(typeof $.fn.each2 == "undefined") {
23
- $.extend($.fn, {
24
- /*
25
- * 4-10 times faster .each replacement
26
- * use it carefully, as it overrides jQuery context of element on each iteration
27
- */
28
- each2 : function (c) {
29
- var j = $([0]), i = -1, l = this.length;
30
- while (
31
- ++i < l
32
- && (j.context = j[0] = this[i])
33
- && c.call(j[0], i, j) !== false //"this"=DOM, i=index, j=jQuery object
34
- );
35
- return this;
36
- }
37
- });
38
- }
39
- })(jQuery);
40
-
41
- (function ($, undefined) {
42
- "use strict";
43
- /*global document, window, jQuery, console */
44
-
45
- if (window.Select2 !== undefined) {
46
- return;
47
- }
48
-
49
- var AbstractSelect2, SingleSelect2, MultiSelect2, nextUid, sizer,
50
- lastMousePosition={x:0,y:0}, $document, scrollBarDimensions,
51
-
52
- KEY = {
53
- TAB: 9,
54
- ENTER: 13,
55
- ESC: 27,
56
- SPACE: 32,
57
- LEFT: 37,
58
- UP: 38,
59
- RIGHT: 39,
60
- DOWN: 40,
61
- SHIFT: 16,
62
- CTRL: 17,
63
- ALT: 18,
64
- PAGE_UP: 33,
65
- PAGE_DOWN: 34,
66
- HOME: 36,
67
- END: 35,
68
- BACKSPACE: 8,
69
- DELETE: 46,
70
- isArrow: function (k) {
71
- k = k.which ? k.which : k;
72
- switch (k) {
73
- case KEY.LEFT:
74
- case KEY.RIGHT:
75
- case KEY.UP:
76
- case KEY.DOWN:
77
- return true;
78
- }
79
- return false;
80
- },
81
- isControl: function (e) {
82
- var k = e.which;
83
- switch (k) {
84
- case KEY.SHIFT:
85
- case KEY.CTRL:
86
- case KEY.ALT:
87
- return true;
88
- }
89
-
90
- if (e.metaKey) return true;
91
-
92
- return false;
93
- },
94
- isFunctionKey: function (k) {
95
- k = k.which ? k.which : k;
96
- return k >= 112 && k <= 123;
97
- }
98
- },
99
- MEASURE_SCROLLBAR_TEMPLATE = "<div class='select2-measure-scrollbar'></div>",
100
-
101
- DIACRITICS = {"\u24B6":"A","\uFF21":"A","\u00C0":"A","\u00C1":"A","\u00C2":"A","\u1EA6":"A","\u1EA4":"A","\u1EAA":"A","\u1EA8":"A","\u00C3":"A","\u0100":"A","\u0102":"A","\u1EB0":"A","\u1EAE":"A","\u1EB4":"A","\u1EB2":"A","\u0226":"A","\u01E0":"A","\u00C4":"A","\u01DE":"A","\u1EA2":"A","\u00C5":"A","\u01FA":"A","\u01CD":"A","\u0200":"A","\u0202":"A","\u1EA0":"A","\u1EAC":"A","\u1EB6":"A","\u1E00":"A","\u0104":"A","\u023A":"A","\u2C6F":"A","\uA732":"AA","\u00C6":"AE","\u01FC":"AE","\u01E2":"AE","\uA734":"AO","\uA736":"AU","\uA738":"AV","\uA73A":"AV","\uA73C":"AY","\u24B7":"B","\uFF22":"B","\u1E02":"B","\u1E04":"B","\u1E06":"B","\u0243":"B","\u0182":"B","\u0181":"B","\u24B8":"C","\uFF23":"C","\u0106":"C","\u0108":"C","\u010A":"C","\u010C":"C","\u00C7":"C","\u1E08":"C","\u0187":"C","\u023B":"C","\uA73E":"C","\u24B9":"D","\uFF24":"D","\u1E0A":"D","\u010E":"D","\u1E0C":"D","\u1E10":"D","\u1E12":"D","\u1E0E":"D","\u0110":"D","\u018B":"D","\u018A":"D","\u0189":"D","\uA779":"D","\u01F1":"DZ","\u01C4":"DZ","\u01F2":"Dz","\u01C5":"Dz","\u24BA":"E","\uFF25":"E","\u00C8":"E","\u00C9":"E","\u00CA":"E","\u1EC0":"E","\u1EBE":"E","\u1EC4":"E","\u1EC2":"E","\u1EBC":"E","\u0112":"E","\u1E14":"E","\u1E16":"E","\u0114":"E","\u0116":"E","\u00CB":"E","\u1EBA":"E","\u011A":"E","\u0204":"E","\u0206":"E","\u1EB8":"E","\u1EC6":"E","\u0228":"E","\u1E1C":"E","\u0118":"E","\u1E18":"E","\u1E1A":"E","\u0190":"E","\u018E":"E","\u24BB":"F","\uFF26":"F","\u1E1E":"F","\u0191":"F","\uA77B":"F","\u24BC":"G","\uFF27":"G","\u01F4":"G","\u011C":"G","\u1E20":"G","\u011E":"G","\u0120":"G","\u01E6":"G","\u0122":"G","\u01E4":"G","\u0193":"G","\uA7A0":"G","\uA77D":"G","\uA77E":"G","\u24BD":"H","\uFF28":"H","\u0124":"H","\u1E22":"H","\u1E26":"H","\u021E":"H","\u1E24":"H","\u1E28":"H","\u1E2A":"H","\u0126":"H","\u2C67":"H","\u2C75":"H","\uA78D":"H","\u24BE":"I","\uFF29":"I","\u00CC":"I","\u00CD":"I","\u00CE":"I","\u0128":"I","\u012A":"I","\u012C":"I","\u0130":"I","\u00CF":"I","\u1E2E":"I","\u1EC8":"I","\u01CF":"I","\u0208":"I","\u020A":"I","\u1ECA":"I","\u012E":"I","\u1E2C":"I","\u0197":"I","\u24BF":"J","\uFF2A":"J","\u0134":"J","\u0248":"J","\u24C0":"K","\uFF2B":"K","\u1E30":"K","\u01E8":"K","\u1E32":"K","\u0136":"K","\u1E34":"K","\u0198":"K","\u2C69":"K","\uA740":"K","\uA742":"K","\uA744":"K","\uA7A2":"K","\u24C1":"L","\uFF2C":"L","\u013F":"L","\u0139":"L","\u013D":"L","\u1E36":"L","\u1E38":"L","\u013B":"L","\u1E3C":"L","\u1E3A":"L","\u0141":"L","\u023D":"L","\u2C62":"L","\u2C60":"L","\uA748":"L","\uA746":"L","\uA780":"L","\u01C7":"LJ","\u01C8":"Lj","\u24C2":"M","\uFF2D":"M","\u1E3E":"M","\u1E40":"M","\u1E42":"M","\u2C6E":"M","\u019C":"M","\u24C3":"N","\uFF2E":"N","\u01F8":"N","\u0143":"N","\u00D1":"N","\u1E44":"N","\u0147":"N","\u1E46":"N","\u0145":"N","\u1E4A":"N","\u1E48":"N","\u0220":"N","\u019D":"N","\uA790":"N","\uA7A4":"N","\u01CA":"NJ","\u01CB":"Nj","\u24C4":"O","\uFF2F":"O","\u00D2":"O","\u00D3":"O","\u00D4":"O","\u1ED2":"O","\u1ED0":"O","\u1ED6":"O","\u1ED4":"O","\u00D5":"O","\u1E4C":"O","\u022C":"O","\u1E4E":"O","\u014C":"O","\u1E50":"O","\u1E52":"O","\u014E":"O","\u022E":"O","\u0230":"O","\u00D6":"O","\u022A":"O","\u1ECE":"O","\u0150":"O","\u01D1":"O","\u020C":"O","\u020E":"O","\u01A0":"O","\u1EDC":"O","\u1EDA":"O","\u1EE0":"O","\u1EDE":"O","\u1EE2":"O","\u1ECC":"O","\u1ED8":"O","\u01EA":"O","\u01EC":"O","\u00D8":"O","\u01FE":"O","\u0186":"O","\u019F":"O","\uA74A":"O","\uA74C":"O","\u01A2":"OI","\uA74E":"OO","\u0222":"OU","\u24C5":"P","\uFF30":"P","\u1E54":"P","\u1E56":"P","\u01A4":"P","\u2C63":"P","\uA750":"P","\uA752":"P","\uA754":"P","\u24C6":"Q","\uFF31":"Q","\uA756":"Q","\uA758":"Q","\u024A":"Q","\u24C7":"R","\uFF32":"R","\u0154":"R","\u1E58":"R","\u0158":"R","\u0210":"R","\u0212":"R","\u1E5A":"R","\u1E5C":"R","\u0156":"R","\u1E5E":"R","\u024C":"R","\u2C64":"R","\uA75A":"R","\uA7A6":"R","\uA782":"R","\u24C8":"S","\uFF33":"S","\u1E9E":"S","\u015A":"S","\u1E64":"S","\u015C":"S","\u1E60":"S","\u0160":"S","\u1E66":"S","\u1E62":"S","\u1E68":"S","\u0218":"S","\u015E":"S","\u2C7E":"S","\uA7A8":"S","\uA784":"S","\u24C9":"T","\uFF34":"T","\u1E6A":"T","\u0164":"T","\u1E6C":"T","\u021A":"T","\u0162":"T","\u1E70":"T","\u1E6E":"T","\u0166":"T","\u01AC":"T","\u01AE":"T","\u023E":"T","\uA786":"T","\uA728":"TZ","\u24CA":"U","\uFF35":"U","\u00D9":"U","\u00DA":"U","\u00DB":"U","\u0168":"U","\u1E78":"U","\u016A":"U","\u1E7A":"U","\u016C":"U","\u00DC":"U","\u01DB":"U","\u01D7":"U","\u01D5":"U","\u01D9":"U","\u1EE6":"U","\u016E":"U","\u0170":"U","\u01D3":"U","\u0214":"U","\u0216":"U","\u01AF":"U","\u1EEA":"U","\u1EE8":"U","\u1EEE":"U","\u1EEC":"U","\u1EF0":"U","\u1EE4":"U","\u1E72":"U","\u0172":"U","\u1E76":"U","\u1E74":"U","\u0244":"U","\u24CB":"V","\uFF36":"V","\u1E7C":"V","\u1E7E":"V","\u01B2":"V","\uA75E":"V","\u0245":"V","\uA760":"VY","\u24CC":"W","\uFF37":"W","\u1E80":"W","\u1E82":"W","\u0174":"W","\u1E86":"W","\u1E84":"W","\u1E88":"W","\u2C72":"W","\u24CD":"X","\uFF38":"X","\u1E8A":"X","\u1E8C":"X","\u24CE":"Y","\uFF39":"Y","\u1EF2":"Y","\u00DD":"Y","\u0176":"Y","\u1EF8":"Y","\u0232":"Y","\u1E8E":"Y","\u0178":"Y","\u1EF6":"Y","\u1EF4":"Y","\u01B3":"Y","\u024E":"Y","\u1EFE":"Y","\u24CF":"Z","\uFF3A":"Z","\u0179":"Z","\u1E90":"Z","\u017B":"Z","\u017D":"Z","\u1E92":"Z","\u1E94":"Z","\u01B5":"Z","\u0224":"Z","\u2C7F":"Z","\u2C6B":"Z","\uA762":"Z","\u24D0":"a","\uFF41":"a","\u1E9A":"a","\u00E0":"a","\u00E1":"a","\u00E2":"a","\u1EA7":"a","\u1EA5":"a","\u1EAB":"a","\u1EA9":"a","\u00E3":"a","\u0101":"a","\u0103":"a","\u1EB1":"a","\u1EAF":"a","\u1EB5":"a","\u1EB3":"a","\u0227":"a","\u01E1":"a","\u00E4":"a","\u01DF":"a","\u1EA3":"a","\u00E5":"a","\u01FB":"a","\u01CE":"a","\u0201":"a","\u0203":"a","\u1EA1":"a","\u1EAD":"a","\u1EB7":"a","\u1E01":"a","\u0105":"a","\u2C65":"a","\u0250":"a","\uA733":"aa","\u00E6":"ae","\u01FD":"ae","\u01E3":"ae","\uA735":"ao","\uA737":"au","\uA739":"av","\uA73B":"av","\uA73D":"ay","\u24D1":"b","\uFF42":"b","\u1E03":"b","\u1E05":"b","\u1E07":"b","\u0180":"b","\u0183":"b","\u0253":"b","\u24D2":"c","\uFF43":"c","\u0107":"c","\u0109":"c","\u010B":"c","\u010D":"c","\u00E7":"c","\u1E09":"c","\u0188":"c","\u023C":"c","\uA73F":"c","\u2184":"c","\u24D3":"d","\uFF44":"d","\u1E0B":"d","\u010F":"d","\u1E0D":"d","\u1E11":"d","\u1E13":"d","\u1E0F":"d","\u0111":"d","\u018C":"d","\u0256":"d","\u0257":"d","\uA77A":"d","\u01F3":"dz","\u01C6":"dz","\u24D4":"e","\uFF45":"e","\u00E8":"e","\u00E9":"e","\u00EA":"e","\u1EC1":"e","\u1EBF":"e","\u1EC5":"e","\u1EC3":"e","\u1EBD":"e","\u0113":"e","\u1E15":"e","\u1E17":"e","\u0115":"e","\u0117":"e","\u00EB":"e","\u1EBB":"e","\u011B":"e","\u0205":"e","\u0207":"e","\u1EB9":"e","\u1EC7":"e","\u0229":"e","\u1E1D":"e","\u0119":"e","\u1E19":"e","\u1E1B":"e","\u0247":"e","\u025B":"e","\u01DD":"e","\u24D5":"f","\uFF46":"f","\u1E1F":"f","\u0192":"f","\uA77C":"f","\u24D6":"g","\uFF47":"g","\u01F5":"g","\u011D":"g","\u1E21":"g","\u011F":"g","\u0121":"g","\u01E7":"g","\u0123":"g","\u01E5":"g","\u0260":"g","\uA7A1":"g","\u1D79":"g","\uA77F":"g","\u24D7":"h","\uFF48":"h","\u0125":"h","\u1E23":"h","\u1E27":"h","\u021F":"h","\u1E25":"h","\u1E29":"h","\u1E2B":"h","\u1E96":"h","\u0127":"h","\u2C68":"h","\u2C76":"h","\u0265":"h","\u0195":"hv","\u24D8":"i","\uFF49":"i","\u00EC":"i","\u00ED":"i","\u00EE":"i","\u0129":"i","\u012B":"i","\u012D":"i","\u00EF":"i","\u1E2F":"i","\u1EC9":"i","\u01D0":"i","\u0209":"i","\u020B":"i","\u1ECB":"i","\u012F":"i","\u1E2D":"i","\u0268":"i","\u0131":"i","\u24D9":"j","\uFF4A":"j","\u0135":"j","\u01F0":"j","\u0249":"j","\u24DA":"k","\uFF4B":"k","\u1E31":"k","\u01E9":"k","\u1E33":"k","\u0137":"k","\u1E35":"k","\u0199":"k","\u2C6A":"k","\uA741":"k","\uA743":"k","\uA745":"k","\uA7A3":"k","\u24DB":"l","\uFF4C":"l","\u0140":"l","\u013A":"l","\u013E":"l","\u1E37":"l","\u1E39":"l","\u013C":"l","\u1E3D":"l","\u1E3B":"l","\u017F":"l","\u0142":"l","\u019A":"l","\u026B":"l","\u2C61":"l","\uA749":"l","\uA781":"l","\uA747":"l","\u01C9":"lj","\u24DC":"m","\uFF4D":"m","\u1E3F":"m","\u1E41":"m","\u1E43":"m","\u0271":"m","\u026F":"m","\u24DD":"n","\uFF4E":"n","\u01F9":"n","\u0144":"n","\u00F1":"n","\u1E45":"n","\u0148":"n","\u1E47":"n","\u0146":"n","\u1E4B":"n","\u1E49":"n","\u019E":"n","\u0272":"n","\u0149":"n","\uA791":"n","\uA7A5":"n","\u01CC":"nj","\u24DE":"o","\uFF4F":"o","\u00F2":"o","\u00F3":"o","\u00F4":"o","\u1ED3":"o","\u1ED1":"o","\u1ED7":"o","\u1ED5":"o","\u00F5":"o","\u1E4D":"o","\u022D":"o","\u1E4F":"o","\u014D":"o","\u1E51":"o","\u1E53":"o","\u014F":"o","\u022F":"o","\u0231":"o","\u00F6":"o","\u022B":"o","\u1ECF":"o","\u0151":"o","\u01D2":"o","\u020D":"o","\u020F":"o","\u01A1":"o","\u1EDD":"o","\u1EDB":"o","\u1EE1":"o","\u1EDF":"o","\u1EE3":"o","\u1ECD":"o","\u1ED9":"o","\u01EB":"o","\u01ED":"o","\u00F8":"o","\u01FF":"o","\u0254":"o","\uA74B":"o","\uA74D":"o","\u0275":"o","\u01A3":"oi","\u0223":"ou","\uA74F":"oo","\u24DF":"p","\uFF50":"p","\u1E55":"p","\u1E57":"p","\u01A5":"p","\u1D7D":"p","\uA751":"p","\uA753":"p","\uA755":"p","\u24E0":"q","\uFF51":"q","\u024B":"q","\uA757":"q","\uA759":"q","\u24E1":"r","\uFF52":"r","\u0155":"r","\u1E59":"r","\u0159":"r","\u0211":"r","\u0213":"r","\u1E5B":"r","\u1E5D":"r","\u0157":"r","\u1E5F":"r","\u024D":"r","\u027D":"r","\uA75B":"r","\uA7A7":"r","\uA783":"r","\u24E2":"s","\uFF53":"s","\u00DF":"s","\u015B":"s","\u1E65":"s","\u015D":"s","\u1E61":"s","\u0161":"s","\u1E67":"s","\u1E63":"s","\u1E69":"s","\u0219":"s","\u015F":"s","\u023F":"s","\uA7A9":"s","\uA785":"s","\u1E9B":"s","\u24E3":"t","\uFF54":"t","\u1E6B":"t","\u1E97":"t","\u0165":"t","\u1E6D":"t","\u021B":"t","\u0163":"t","\u1E71":"t","\u1E6F":"t","\u0167":"t","\u01AD":"t","\u0288":"t","\u2C66":"t","\uA787":"t","\uA729":"tz","\u24E4":"u","\uFF55":"u","\u00F9":"u","\u00FA":"u","\u00FB":"u","\u0169":"u","\u1E79":"u","\u016B":"u","\u1E7B":"u","\u016D":"u","\u00FC":"u","\u01DC":"u","\u01D8":"u","\u01D6":"u","\u01DA":"u","\u1EE7":"u","\u016F":"u","\u0171":"u","\u01D4":"u","\u0215":"u","\u0217":"u","\u01B0":"u","\u1EEB":"u","\u1EE9":"u","\u1EEF":"u","\u1EED":"u","\u1EF1":"u","\u1EE5":"u","\u1E73":"u","\u0173":"u","\u1E77":"u","\u1E75":"u","\u0289":"u","\u24E5":"v","\uFF56":"v","\u1E7D":"v","\u1E7F":"v","\u028B":"v","\uA75F":"v","\u028C":"v","\uA761":"vy","\u24E6":"w","\uFF57":"w","\u1E81":"w","\u1E83":"w","\u0175":"w","\u1E87":"w","\u1E85":"w","\u1E98":"w","\u1E89":"w","\u2C73":"w","\u24E7":"x","\uFF58":"x","\u1E8B":"x","\u1E8D":"x","\u24E8":"y","\uFF59":"y","\u1EF3":"y","\u00FD":"y","\u0177":"y","\u1EF9":"y","\u0233":"y","\u1E8F":"y","\u00FF":"y","\u1EF7":"y","\u1E99":"y","\u1EF5":"y","\u01B4":"y","\u024F":"y","\u1EFF":"y","\u24E9":"z","\uFF5A":"z","\u017A":"z","\u1E91":"z","\u017C":"z","\u017E":"z","\u1E93":"z","\u1E95":"z","\u01B6":"z","\u0225":"z","\u0240":"z","\u2C6C":"z","\uA763":"z","\u0386":"\u0391","\u0388":"\u0395","\u0389":"\u0397","\u038A":"\u0399","\u03AA":"\u0399","\u038C":"\u039F","\u038E":"\u03A5","\u03AB":"\u03A5","\u038F":"\u03A9","\u03AC":"\u03B1","\u03AD":"\u03B5","\u03AE":"\u03B7","\u03AF":"\u03B9","\u03CA":"\u03B9","\u0390":"\u03B9","\u03CC":"\u03BF","\u03CD":"\u03C5","\u03CB":"\u03C5","\u03B0":"\u03C5","\u03C9":"\u03C9","\u03C2":"\u03C3"};
102
-
103
- $document = $(document);
104
-
105
- nextUid=(function() { var counter=1; return function() { return counter++; }; }());
106
-
107
-
108
- function reinsertElement(element) {
109
- var placeholder = $(document.createTextNode(''));
110
-
111
- element.before(placeholder);
112
- placeholder.before(element);
113
- placeholder.remove();
114
- }
115
-
116
- function stripDiacritics(str) {
117
- // Used 'uni range + named function' from http://jsperf.com/diacritics/18
118
- function match(a) {
119
- return DIACRITICS[a] || a;
120
- }
121
-
122
- return str.replace(/[^\u0000-\u007E]/g, match);
123
- }
124
-
125
- function indexOf(value, array) {
126
- var i = 0, l = array.length;
127
- for (; i < l; i = i + 1) {
128
- if (equal(value, array[i])) return i;
129
- }
130
- return -1;
131
- }
132
-
133
- function measureScrollbar () {
134
- var $template = $( MEASURE_SCROLLBAR_TEMPLATE );
135
- $template.appendTo(document.body);
136
-
137
- var dim = {
138
- width: $template.width() - $template[0].clientWidth,
139
- height: $template.height() - $template[0].clientHeight
140
- };
141
- $template.remove();
142
-
143
- return dim;
144
- }
145
-
146
- /**
147
- * Compares equality of a and b
148
- * @param a
149
- * @param b
150
- */
151
- function equal(a, b) {
152
- if (a === b) return true;
153
- if (a === undefined || b === undefined) return false;
154
- if (a === null || b === null) return false;
155
- // Check whether 'a' or 'b' is a string (primitive or object).
156
- // The concatenation of an empty string (+'') converts its argument to a string's primitive.
157
- if (a.constructor === String) return a+'' === b+''; // a+'' - in case 'a' is a String object
158
- if (b.constructor === String) return b+'' === a+''; // b+'' - in case 'b' is a String object
159
- return false;
160
- }
161
-
162
- /**
163
- * Splits the string into an array of values, transforming each value. An empty array is returned for nulls or empty
164
- * strings
165
- * @param string
166
- * @param separator
167
- */
168
- function splitVal(string, separator, transform) {
169
- var val, i, l;
170
- if (string === null || string.length < 1) return [];
171
- val = string.split(separator);
172
- for (i = 0, l = val.length; i < l; i = i + 1) val[i] = transform(val[i]);
173
- return val;
174
- }
175
-
176
- function getSideBorderPadding(element) {
177
- return element.outerWidth(false) - element.width();
178
- }
179
-
180
- function installKeyUpChangeEvent(element) {
181
- var key="keyup-change-value";
182
- element.on("keydown", function () {
183
- if ($.data(element, key) === undefined) {
184
- $.data(element, key, element.val());
185
- }
186
- });
187
- element.on("keyup", function () {
188
- var val= $.data(element, key);
189
- if (val !== undefined && element.val() !== val) {
190
- $.removeData(element, key);
191
- element.trigger("keyup-change");
192
- }
193
- });
194
- }
195
-
196
-
197
- /**
198
- * filters mouse events so an event is fired only if the mouse moved.
199
- *
200
- * filters out mouse events that occur when mouse is stationary but
201
- * the elements under the pointer are scrolled.
202
- */
203
- function installFilteredMouseMove(element) {
204
- element.on("mousemove", function (e) {
205
- var lastpos = lastMousePosition;
206
- if (lastpos === undefined || lastpos.x !== e.pageX || lastpos.y !== e.pageY) {
207
- $(e.target).trigger("mousemove-filtered", e);
208
- }
209
- });
210
- }
211
-
212
- /**
213
- * Debounces a function. Returns a function that calls the original fn function only if no invocations have been made
214
- * within the last quietMillis milliseconds.
215
- *
216
- * @param quietMillis number of milliseconds to wait before invoking fn
217
- * @param fn function to be debounced
218
- * @param ctx object to be used as this reference within fn
219
- * @return debounced version of fn
220
- */
221
- function debounce(quietMillis, fn, ctx) {
222
- ctx = ctx || undefined;
223
- var timeout;
224
- return function () {
225
- var args = arguments;
226
- window.clearTimeout(timeout);
227
- timeout = window.setTimeout(function() {
228
- fn.apply(ctx, args);
229
- }, quietMillis);
230
- };
231
- }
232
-
233
- function installDebouncedScroll(threshold, element) {
234
- var notify = debounce(threshold, function (e) { element.trigger("scroll-debounced", e);});
235
- element.on("scroll", function (e) {
236
- if (indexOf(e.target, element.get()) >= 0) notify(e);
237
- });
238
- }
239
-
240
- function focus($el) {
241
- if ($el[0] === document.activeElement) return;
242
-
243
- /* set the focus in a 0 timeout - that way the focus is set after the processing
244
- of the current event has finished - which seems like the only reliable way
245
- to set focus */
246
- window.setTimeout(function() {
247
- var el=$el[0], pos=$el.val().length, range;
248
-
249
- $el.focus();
250
-
251
- /* make sure el received focus so we do not error out when trying to manipulate the caret.
252
- sometimes modals or others listeners may steal it after its set */
253
- var isVisible = (el.offsetWidth > 0 || el.offsetHeight > 0);
254
- if (isVisible && el === document.activeElement) {
255
-
256
- /* after the focus is set move the caret to the end, necessary when we val()
257
- just before setting focus */
258
- if(el.setSelectionRange)
259
- {
260
- el.setSelectionRange(pos, pos);
261
- }
262
- else if (el.createTextRange) {
263
- range = el.createTextRange();
264
- range.collapse(false);
265
- range.select();
266
- }
267
- }
268
- }, 0);
269
- }
270
-
271
- function getCursorInfo(el) {
272
- el = $(el)[0];
273
- var offset = 0;
274
- var length = 0;
275
- if ('selectionStart' in el) {
276
- offset = el.selectionStart;
277
- length = el.selectionEnd - offset;
278
- } else if ('selection' in document) {
279
- el.focus();
280
- var sel = document.selection.createRange();
281
- length = document.selection.createRange().text.length;
282
- sel.moveStart('character', -el.value.length);
283
- offset = sel.text.length - length;
284
- }
285
- return { offset: offset, length: length };
286
- }
287
-
288
- function killEvent(event) {
289
- event.preventDefault();
290
- event.stopPropagation();
291
- }
292
- function killEventImmediately(event) {
293
- event.preventDefault();
294
- event.stopImmediatePropagation();
295
- }
296
-
297
- function measureTextWidth(e) {
298
- if (!sizer){
299
- var style = e[0].currentStyle || window.getComputedStyle(e[0], null);
300
- sizer = $(document.createElement("div")).css({
301
- position: "absolute",
302
- left: "-10000px",
303
- top: "-10000px",
304
- display: "none",
305
- fontSize: style.fontSize,
306
- fontFamily: style.fontFamily,
307
- fontStyle: style.fontStyle,
308
- fontWeight: style.fontWeight,
309
- letterSpacing: style.letterSpacing,
310
- textTransform: style.textTransform,
311
- whiteSpace: "nowrap"
312
- });
313
- sizer.attr("class","select2-sizer");
314
- $(document.body).append(sizer);
315
- }
316
- sizer.text(e.val());
317
- return sizer.width();
318
- }
319
-
320
- function syncCssClasses(dest, src, adapter) {
321
- var classes, replacements = [], adapted;
322
-
323
- classes = $.trim(dest.attr("class"));
324
-
325
- if (classes) {
326
- classes = '' + classes; // for IE which returns object
327
-
328
- $(classes.split(/\s+/)).each2(function() {
329
- if (this.indexOf("select2-") === 0) {
330
- replacements.push(this);
331
- }
332
- });
333
- }
334
-
335
- classes = $.trim(src.attr("class"));
336
-
337
- if (classes) {
338
- classes = '' + classes; // for IE which returns object
339
-
340
- $(classes.split(/\s+/)).each2(function() {
341
- if (this.indexOf("select2-") !== 0) {
342
- adapted = adapter(this);
343
-
344
- if (adapted) {
345
- replacements.push(adapted);
346
- }
347
- }
348
- });
349
- }
350
-
351
- dest.attr("class", replacements.join(" "));
352
- }
353
-
354
-
355
- function markMatch(text, term, markup, escapeMarkup) {
356
- var match=stripDiacritics(text.toUpperCase()).indexOf(stripDiacritics(term.toUpperCase())),
357
- tl=term.length;
358
-
359
- if (match<0) {
360
- markup.push(escapeMarkup(text));
361
- return;
362
- }
363
-
364
- markup.push(escapeMarkup(text.substring(0, match)));
365
- markup.push("<span class='select2-match'>");
366
- markup.push(escapeMarkup(text.substring(match, match + tl)));
367
- markup.push("</span>");
368
- markup.push(escapeMarkup(text.substring(match + tl, text.length)));
369
- }
370
-
371
- function defaultEscapeMarkup(markup) {
372
- var replace_map = {
373
- '\\': '&#92;',
374
- '&': '&amp;',
375
- '<': '&lt;',
376
- '>': '&gt;',
377
- '"': '&quot;',
378
- "'": '&#39;',
379
- "/": '&#47;'
380
- };
381
-
382
- return String(markup).replace(/[&<>"'\/\\]/g, function (match) {
383
- return replace_map[match];
384
- });
385
- }
386
-
387
- /**
388
- * Produces an ajax-based query function
389
- *
390
- * @param options object containing configuration parameters
391
- * @param options.params parameter map for the transport ajax call, can contain such options as cache, jsonpCallback, etc. see $.ajax
392
- * @param options.transport function that will be used to execute the ajax request. must be compatible with parameters supported by $.ajax
393
- * @param options.url url for the data
394
- * @param options.data a function(searchTerm, pageNumber, context) that should return an object containing query string parameters for the above url.
395
- * @param options.dataType request data type: ajax, jsonp, other datatypes supported by jQuery's $.ajax function or the transport function if specified
396
- * @param options.quietMillis (optional) milliseconds to wait before making the ajaxRequest, helps debounce the ajax function if invoked too often
397
- * @param options.results a function(remoteData, pageNumber, query) that converts data returned form the remote request to the format expected by Select2.
398
- * The expected format is an object containing the following keys:
399
- * results array of objects that will be used as choices
400
- * more (optional) boolean indicating whether there are more results available
401
- * Example: {results:[{id:1, text:'Red'},{id:2, text:'Blue'}], more:true}
402
- */
403
- function ajax(options) {
404
- var timeout, // current scheduled but not yet executed request
405
- handler = null,
406
- quietMillis = options.quietMillis || 100,
407
- ajaxUrl = options.url,
408
- self = this;
409
-
410
- return function (query) {
411
- window.clearTimeout(timeout);
412
- timeout = window.setTimeout(function () {
413
- var data = options.data, // ajax data function
414
- url = ajaxUrl, // ajax url string or function
415
- transport = options.transport || $.fn.select2.ajaxDefaults.transport,
416
- // deprecated - to be removed in 4.0 - use params instead
417
- deprecated = {
418
- type: options.type || 'GET', // set type of request (GET or POST)
419
- cache: options.cache || false,
420
- jsonpCallback: options.jsonpCallback||undefined,
421
- dataType: options.dataType||"json"
422
- },
423
- params = $.extend({}, $.fn.select2.ajaxDefaults.params, deprecated);
424
-
425
- data = data ? data.call(self, query.term, query.page, query.context) : null;
426
- url = (typeof url === 'function') ? url.call(self, query.term, query.page, query.context) : url;
427
-
428
- if (handler && typeof handler.abort === "function") { handler.abort(); }
429
-
430
- if (options.params) {
431
- if ($.isFunction(options.params)) {
432
- $.extend(params, options.params.call(self));
433
- } else {
434
- $.extend(params, options.params);
435
- }
436
- }
437
-
438
- $.extend(params, {
439
- url: url,
440
- dataType: options.dataType,
441
- data: data,
442
- success: function (data) {
443
- // TODO - replace query.page with query so users have access to term, page, etc.
444
- // added query as third paramter to keep backwards compatibility
445
- var results = options.results(data, query.page, query);
446
- query.callback(results);
447
- },
448
- error: function(jqXHR, textStatus, errorThrown){
449
- var results = {
450
- hasError: true,
451
- jqXHR: jqXHR,
452
- textStatus: textStatus,
453
- errorThrown: errorThrown
454
- };
455
-
456
- query.callback(results);
457
- }
458
- });
459
- handler = transport.call(self, params);
460
- }, quietMillis);
461
- };
462
- }
463
-
464
- /**
465
- * Produces a query function that works with a local array
466
- *
467
- * @param options object containing configuration parameters. The options parameter can either be an array or an
468
- * object.
469
- *
470
- * If the array form is used it is assumed that it contains objects with 'id' and 'text' keys.
471
- *
472
- * If the object form is used it is assumed that it contains 'data' and 'text' keys. The 'data' key should contain
473
- * an array of objects that will be used as choices. These objects must contain at least an 'id' key. The 'text'
474
- * key can either be a String in which case it is expected that each element in the 'data' array has a key with the
475
- * value of 'text' which will be used to match choices. Alternatively, text can be a function(item) that can extract
476
- * the text.
477
- */
478
- function local(options) {
479
- var data = options, // data elements
480
- dataText,
481
- tmp,
482
- text = function (item) { return ""+item.text; }; // function used to retrieve the text portion of a data item that is matched against the search
483
-
484
- if ($.isArray(data)) {
485
- tmp = data;
486
- data = { results: tmp };
487
- }
488
-
489
- if ($.isFunction(data) === false) {
490
- tmp = data;
491
- data = function() { return tmp; };
492
- }
493
-
494
- var dataItem = data();
495
- if (dataItem.text) {
496
- text = dataItem.text;
497
- // if text is not a function we assume it to be a key name
498
- if (!$.isFunction(text)) {
499
- dataText = dataItem.text; // we need to store this in a separate variable because in the next step data gets reset and data.text is no longer available
500
- text = function (item) { return item[dataText]; };
501
- }
502
- }
503
-
504
- return function (query) {
505
- var t = query.term, filtered = { results: [] }, process;
506
- if (t === "") {
507
- query.callback(data());
508
- return;
509
- }
510
-
511
- process = function(datum, collection) {
512
- var group, attr;
513
- datum = datum[0];
514
- if (datum.children) {
515
- group = {};
516
- for (attr in datum) {
517
- if (datum.hasOwnProperty(attr)) group[attr]=datum[attr];
518
- }
519
- group.children=[];
520
- $(datum.children).each2(function(i, childDatum) { process(childDatum, group.children); });
521
- if (group.children.length || query.matcher(t, text(group), datum)) {
522
- collection.push(group);
523
- }
524
- } else {
525
- if (query.matcher(t, text(datum), datum)) {
526
- collection.push(datum);
527
- }
528
- }
529
- };
530
-
531
- $(data().results).each2(function(i, datum) { process(datum, filtered.results); });
532
- query.callback(filtered);
533
- };
534
- }
535
-
536
- // TODO javadoc
537
- function tags(data) {
538
- var isFunc = $.isFunction(data);
539
- return function (query) {
540
- var t = query.term, filtered = {results: []};
541
- var result = isFunc ? data(query) : data;
542
- if ($.isArray(result)) {
543
- $(result).each(function () {
544
- var isObject = this.text !== undefined,
545
- text = isObject ? this.text : this;
546
- if (t === "" || query.matcher(t, text)) {
547
- filtered.results.push(isObject ? this : {id: this, text: this});
548
- }
549
- });
550
- query.callback(filtered);
551
- }
552
- };
553
- }
554
-
555
- /**
556
- * Checks if the formatter function should be used.
557
- *
558
- * Throws an error if it is not a function. Returns true if it should be used,
559
- * false if no formatting should be performed.
560
- *
561
- * @param formatter
562
- */
563
- function checkFormatter(formatter, formatterName) {
564
- if ($.isFunction(formatter)) return true;
565
- if (!formatter) return false;
566
- if (typeof(formatter) === 'string') return true;
567
- throw new Error(formatterName +" must be a string, function, or falsy value");
568
- }
569
-
570
- /**
571
- * Returns a given value
572
- * If given a function, returns its output
573
- *
574
- * @param val string|function
575
- * @param context value of "this" to be passed to function
576
- * @returns {*}
577
- */
578
- function evaluate(val, context) {
579
- if ($.isFunction(val)) {
580
- var args = Array.prototype.slice.call(arguments, 2);
581
- return val.apply(context, args);
582
- }
583
- return val;
584
- }
585
-
586
- function countResults(results) {
587
- var count = 0;
588
- $.each(results, function(i, item) {
589
- if (item.children) {
590
- count += countResults(item.children);
591
- } else {
592
- count++;
593
- }
594
- });
595
- return count;
596
- }
597
-
598
- /**
599
- * Default tokenizer. This function uses breaks the input on substring match of any string from the
600
- * opts.tokenSeparators array and uses opts.createSearchChoice to create the choice object. Both of those
601
- * two options have to be defined in order for the tokenizer to work.
602
- *
603
- * @param input text user has typed so far or pasted into the search field
604
- * @param selection currently selected choices
605
- * @param selectCallback function(choice) callback tho add the choice to selection
606
- * @param opts select2's opts
607
- * @return undefined/null to leave the current input unchanged, or a string to change the input to the returned value
608
- */
609
- function defaultTokenizer(input, selection, selectCallback, opts) {
610
- var original = input, // store the original so we can compare and know if we need to tell the search to update its text
611
- dupe = false, // check for whether a token we extracted represents a duplicate selected choice
612
- token, // token
613
- index, // position at which the separator was found
614
- i, l, // looping variables
615
- separator; // the matched separator
616
-
617
- if (!opts.createSearchChoice || !opts.tokenSeparators || opts.tokenSeparators.length < 1) return undefined;
618
-
619
- while (true) {
620
- index = -1;
621
-
622
- for (i = 0, l = opts.tokenSeparators.length; i < l; i++) {
623
- separator = opts.tokenSeparators[i];
624
- index = input.indexOf(separator);
625
- if (index >= 0) break;
626
- }
627
-
628
- if (index < 0) break; // did not find any token separator in the input string, bail
629
-
630
- token = input.substring(0, index);
631
- input = input.substring(index + separator.length);
632
-
633
- if (token.length > 0) {
634
- token = opts.createSearchChoice.call(this, token, selection);
635
- if (token !== undefined && token !== null && opts.id(token) !== undefined && opts.id(token) !== null) {
636
- dupe = false;
637
- for (i = 0, l = selection.length; i < l; i++) {
638
- if (equal(opts.id(token), opts.id(selection[i]))) {
639
- dupe = true; break;
640
- }
641
- }
642
-
643
- if (!dupe) selectCallback(token);
644
- }
645
- }
646
- }
647
-
648
- if (original!==input) return input;
649
- }
650
-
651
- function cleanupJQueryElements() {
652
- var self = this;
653
-
654
- $.each(arguments, function (i, element) {
655
- self[element].remove();
656
- self[element] = null;
657
- });
658
- }
659
-
660
- /**
661
- * Creates a new class
662
- *
663
- * @param superClass
664
- * @param methods
665
- */
666
- function clazz(SuperClass, methods) {
667
- var constructor = function () {};
668
- constructor.prototype = new SuperClass;
669
- constructor.prototype.constructor = constructor;
670
- constructor.prototype.parent = SuperClass.prototype;
671
- constructor.prototype = $.extend(constructor.prototype, methods);
672
- return constructor;
673
- }
674
-
675
- AbstractSelect2 = clazz(Object, {
676
-
677
- // abstract
678
- bind: function (func) {
679
- var self = this;
680
- return function () {
681
- func.apply(self, arguments);
682
- };
683
- },
684
-
685
- // abstract
686
- init: function (opts) {
687
- var results, search, resultsSelector = ".select2-results";
688
-
689
- // prepare options
690
- this.opts = opts = this.prepareOpts(opts);
691
-
692
- this.id=opts.id;
693
-
694
- // destroy if called on an existing component
695
- if (opts.element.data("select2") !== undefined &&
696
- opts.element.data("select2") !== null) {
697
- opts.element.data("select2").destroy();
698
- }
699
-
700
- this.container = this.createContainer();
701
-
702
- this.liveRegion = $('.select2-hidden-accessible');
703
- if (this.liveRegion.length == 0) {
704
- this.liveRegion = $("<span>", {
705
- role: "status",
706
- "aria-live": "polite"
707
- })
708
- .addClass("select2-hidden-accessible")
709
- .appendTo(document.body);
710
- }
711
-
712
- this.containerId="s2id_"+(opts.element.attr("id") || "autogen"+nextUid());
713
- this.containerEventName= this.containerId
714
- .replace(/([.])/g, '_')
715
- .replace(/([;&,\-\.\+\*\~':"\!\^#$%@\[\]\(\)=>\|])/g, '\\$1');
716
- this.container.attr("id", this.containerId);
717
-
718
- this.container.attr("title", opts.element.attr("title"));
719
-
720
- this.body = $(document.body);
721
-
722
- syncCssClasses(this.container, this.opts.element, this.opts.adaptContainerCssClass);
723
-
724
- this.container.attr("style", opts.element.attr("style"));
725
- this.container.css(evaluate(opts.containerCss, this.opts.element));
726
- this.container.addClass(evaluate(opts.containerCssClass, this.opts.element));
727
-
728
- this.elementTabIndex = this.opts.element.attr("tabindex");
729
-
730
- // swap container for the element
731
- this.opts.element
732
- .data("select2", this)
733
- .attr("tabindex", "-1")
734
- .before(this.container)
735
- .on("click.select2", killEvent); // do not leak click events
736
-
737
- this.container.data("select2", this);
738
-
739
- this.dropdown = this.container.find(".select2-drop");
740
-
741
- syncCssClasses(this.dropdown, this.opts.element, this.opts.adaptDropdownCssClass);
742
-
743
- this.dropdown.addClass(evaluate(opts.dropdownCssClass, this.opts.element));
744
- this.dropdown.data("select2", this);
745
- this.dropdown.on("click", killEvent);
746
-
747
- this.results = results = this.container.find(resultsSelector);
748
- this.search = search = this.container.find("input.select2-input");
749
-
750
- this.queryCount = 0;
751
- this.resultsPage = 0;
752
- this.context = null;
753
-
754
- // initialize the container
755
- this.initContainer();
756
-
757
- this.container.on("click", killEvent);
758
-
759
- installFilteredMouseMove(this.results);
760
-
761
- this.dropdown.on("mousemove-filtered", resultsSelector, this.bind(this.highlightUnderEvent));
762
- this.dropdown.on("touchstart touchmove touchend", resultsSelector, this.bind(function (event) {
763
- this._touchEvent = true;
764
- this.highlightUnderEvent(event);
765
- }));
766
- this.dropdown.on("touchmove", resultsSelector, this.bind(this.touchMoved));
767
- this.dropdown.on("touchstart touchend", resultsSelector, this.bind(this.clearTouchMoved));
768
-
769
- // Waiting for a click event on touch devices to select option and hide dropdown
770
- // otherwise click will be triggered on an underlying element
771
- this.dropdown.on('click', this.bind(function (event) {
772
- if (this._touchEvent) {
773
- this._touchEvent = false;
774
- this.selectHighlighted();
775
- }
776
- }));
777
-
778
- installDebouncedScroll(80, this.results);
779
- this.dropdown.on("scroll-debounced", resultsSelector, this.bind(this.loadMoreIfNeeded));
780
-
781
- // do not propagate change event from the search field out of the component
782
- $(this.container).on("change", ".select2-input", function(e) {e.stopPropagation();});
783
- $(this.dropdown).on("change", ".select2-input", function(e) {e.stopPropagation();});
784
-
785
- // if jquery.mousewheel plugin is installed we can prevent out-of-bounds scrolling of results via mousewheel
786
- if ($.fn.mousewheel) {
787
- results.mousewheel(function (e, delta, deltaX, deltaY) {
788
- var top = results.scrollTop();
789
- if (deltaY > 0 && top - deltaY <= 0) {
790
- results.scrollTop(0);
791
- killEvent(e);
792
- } else if (deltaY < 0 && results.get(0).scrollHeight - results.scrollTop() + deltaY <= results.height()) {
793
- results.scrollTop(results.get(0).scrollHeight - results.height());
794
- killEvent(e);
795
- }
796
- });
797
- }
798
-
799
- installKeyUpChangeEvent(search);
800
- search.on("keyup-change input paste", this.bind(this.updateResults));
801
- search.on("focus", function () { search.addClass("select2-focused"); });
802
- search.on("blur", function () { search.removeClass("select2-focused");});
803
-
804
- this.dropdown.on("mouseup", resultsSelector, this.bind(function (e) {
805
- if ($(e.target).closest(".select2-result-selectable").length > 0) {
806
- this.highlightUnderEvent(e);
807
- this.selectHighlighted(e);
808
- }
809
- }));
810
-
811
- // trap all mouse events from leaving the dropdown. sometimes there may be a modal that is listening
812
- // for mouse events outside of itself so it can close itself. since the dropdown is now outside the select2's
813
- // dom it will trigger the popup close, which is not what we want
814
- // focusin can cause focus wars between modals and select2 since the dropdown is outside the modal.
815
- this.dropdown.on("click mouseup mousedown touchstart touchend focusin", function (e) { e.stopPropagation(); });
816
-
817
- this.nextSearchTerm = undefined;
818
-
819
- if ($.isFunction(this.opts.initSelection)) {
820
- // initialize selection based on the current value of the source element
821
- this.initSelection();
822
-
823
- // if the user has provided a function that can set selection based on the value of the source element
824
- // we monitor the change event on the element and trigger it, allowing for two way synchronization
825
- this.monitorSource();
826
- }
827
-
828
- if (opts.maximumInputLength !== null) {
829
- this.search.attr("maxlength", opts.maximumInputLength);
830
- }
831
-
832
- var disabled = opts.element.prop("disabled");
833
- if (disabled === undefined) disabled = false;
834
- this.enable(!disabled);
835
-
836
- var readonly = opts.element.prop("readonly");
837
- if (readonly === undefined) readonly = false;
838
- this.readonly(readonly);
839
-
840
- // Calculate size of scrollbar
841
- scrollBarDimensions = scrollBarDimensions || measureScrollbar();
842
-
843
- this.autofocus = opts.element.prop("autofocus");
844
- opts.element.prop("autofocus", false);
845
- if (this.autofocus) this.focus();
846
-
847
- this.search.attr("placeholder", opts.searchInputPlaceholder);
848
- },
849
-
850
- // abstract
851
- destroy: function () {
852
- var element=this.opts.element, select2 = element.data("select2"), self = this;
853
-
854
- this.close();
855
-
856
- if (element.length && element[0].detachEvent && self._sync) {
857
- element.each(function () {
858
- if (self._sync) {
859
- this.detachEvent("onpropertychange", self._sync);
860
- }
861
- });
862
- }
863
- if (this.propertyObserver) {
864
- this.propertyObserver.disconnect();
865
- this.propertyObserver = null;
866
- }
867
- this._sync = null;
868
-
869
- if (select2 !== undefined) {
870
- select2.container.remove();
871
- select2.liveRegion.remove();
872
- select2.dropdown.remove();
873
- element
874
- .show()
875
- .removeData("select2")
876
- .off(".select2")
877
- .prop("autofocus", this.autofocus || false);
878
- if (this.elementTabIndex) {
879
- element.attr({tabindex: this.elementTabIndex});
880
- } else {
881
- element.removeAttr("tabindex");
882
- }
883
- element.show();
884
- }
885
-
886
- cleanupJQueryElements.call(this,
887
- "container",
888
- "liveRegion",
889
- "dropdown",
890
- "results",
891
- "search"
892
- );
893
- },
894
-
895
- // abstract
896
- optionToData: function(element) {
897
- if (element.is("option")) {
898
- return {
899
- id:element.prop("value"),
900
- text:element.text(),
901
- element: element.get(),
902
- css: element.attr("class"),
903
- disabled: element.prop("disabled"),
904
- locked: equal(element.attr("locked"), "locked") || equal(element.data("locked"), true)
905
- };
906
- } else if (element.is("optgroup")) {
907
- return {
908
- text:element.attr("label"),
909
- children:[],
910
- element: element.get(),
911
- css: element.attr("class")
912
- };
913
- }
914
- },
915
-
916
- // abstract
917
- prepareOpts: function (opts) {
918
- var element, select, idKey, ajaxUrl, self = this;
919
-
920
- element = opts.element;
921
-
922
- if (element.get(0).tagName.toLowerCase() === "select") {
923
- this.select = select = opts.element;
924
- }
925
-
926
- if (select) {
927
- // these options are not allowed when attached to a select because they are picked up off the element itself
928
- $.each(["id", "multiple", "ajax", "query", "createSearchChoice", "initSelection", "data", "tags"], function () {
929
- if (this in opts) {
930
- throw new Error("Option '" + this + "' is not allowed for Select2 when attached to a <select> element.");
931
- }
932
- });
933
- }
934
-
935
- opts = $.extend({}, {
936
- populateResults: function(container, results, query) {
937
- var populate, id=this.opts.id, liveRegion=this.liveRegion;
938
-
939
- populate=function(results, container, depth) {
940
-
941
- var i, l, result, selectable, disabled, compound, node, label, innerContainer, formatted;
942
-
943
- results = opts.sortResults(results, container, query);
944
-
945
- // collect the created nodes for bulk append
946
- var nodes = [];
947
- for (i = 0, l = results.length; i < l; i = i + 1) {
948
-
949
- result=results[i];
950
-
951
- disabled = (result.disabled === true);
952
- selectable = (!disabled) && (id(result) !== undefined);
953
-
954
- compound=result.children && result.children.length > 0;
955
-
956
- node=$("<li></li>");
957
- node.addClass("select2-results-dept-"+depth);
958
- node.addClass("select2-result");
959
- node.addClass(selectable ? "select2-result-selectable" : "select2-result-unselectable");
960
- if (disabled) { node.addClass("select2-disabled"); }
961
- if (compound) { node.addClass("select2-result-with-children"); }
962
- node.addClass(self.opts.formatResultCssClass(result));
963
- node.attr("role", "presentation");
964
-
965
- label=$(document.createElement("div"));
966
- label.addClass("select2-result-label");
967
- label.attr("id", "select2-result-label-" + nextUid());
968
- label.attr("role", "option");
969
-
970
- formatted=opts.formatResult(result, label, query, self.opts.escapeMarkup);
971
- if (formatted!==undefined) {
972
- label.html(formatted);
973
- node.append(label);
974
- }
975
-
976
-
977
- if (compound) {
978
-
979
- innerContainer=$("<ul></ul>");
980
- innerContainer.addClass("select2-result-sub");
981
- populate(result.children, innerContainer, depth+1);
982
- node.append(innerContainer);
983
- }
984
-
985
- node.data("select2-data", result);
986
- nodes.push(node[0]);
987
- }
988
-
989
- // bulk append the created nodes
990
- container.append(nodes);
991
- liveRegion.text(opts.formatMatches(results.length));
992
- };
993
-
994
- populate(results, container, 0);
995
- }
996
- }, $.fn.select2.defaults, opts);
997
-
998
- if (typeof(opts.id) !== "function") {
999
- idKey = opts.id;
1000
- opts.id = function (e) { return e[idKey]; };
1001
- }
1002
-
1003
- if ($.isArray(opts.element.data("select2Tags"))) {
1004
- if ("tags" in opts) {
1005
- throw "tags specified as both an attribute 'data-select2-tags' and in options of Select2 " + opts.element.attr("id");
1006
- }
1007
- opts.tags=opts.element.data("select2Tags");
1008
- }
1009
-
1010
- if (select) {
1011
- opts.query = this.bind(function (query) {
1012
- var data = { results: [], more: false },
1013
- term = query.term,
1014
- children, placeholderOption, process;
1015
-
1016
- process=function(element, collection) {
1017
- var group;
1018
- if (element.is("option")) {
1019
- if (query.matcher(term, element.text(), element)) {
1020
- collection.push(self.optionToData(element));
1021
- }
1022
- } else if (element.is("optgroup")) {
1023
- group=self.optionToData(element);
1024
- element.children().each2(function(i, elm) { process(elm, group.children); });
1025
- if (group.children.length>0) {
1026
- collection.push(group);
1027
- }
1028
- }
1029
- };
1030
-
1031
- children=element.children();
1032
-
1033
- // ignore the placeholder option if there is one
1034
- if (this.getPlaceholder() !== undefined && children.length > 0) {
1035
- placeholderOption = this.getPlaceholderOption();
1036
- if (placeholderOption) {
1037
- children=children.not(placeholderOption);
1038
- }
1039
- }
1040
-
1041
- children.each2(function(i, elm) { process(elm, data.results); });
1042
-
1043
- query.callback(data);
1044
- });
1045
- // this is needed because inside val() we construct choices from options and their id is hardcoded
1046
- opts.id=function(e) { return e.id; };
1047
- } else {
1048
- if (!("query" in opts)) {
1049
-
1050
- if ("ajax" in opts) {
1051
- ajaxUrl = opts.element.data("ajax-url");
1052
- if (ajaxUrl && ajaxUrl.length > 0) {
1053
- opts.ajax.url = ajaxUrl;
1054
- }
1055
- opts.query = ajax.call(opts.element, opts.ajax);
1056
- } else if ("data" in opts) {
1057
- opts.query = local(opts.data);
1058
- } else if ("tags" in opts) {
1059
- opts.query = tags(opts.tags);
1060
- if (opts.createSearchChoice === undefined) {
1061
- opts.createSearchChoice = function (term) { return {id: $.trim(term), text: $.trim(term)}; };
1062
- }
1063
- if (opts.initSelection === undefined) {
1064
- opts.initSelection = function (element, callback) {
1065
- var data = [];
1066
- $(splitVal(element.val(), opts.separator, opts.transformVal)).each(function () {
1067
- var obj = { id: this, text: this },
1068
- tags = opts.tags;
1069
- if ($.isFunction(tags)) tags=tags();
1070
- $(tags).each(function() { if (equal(this.id, obj.id)) { obj = this; return false; } });
1071
- data.push(obj);
1072
- });
1073
-
1074
- callback(data);
1075
- };
1076
- }
1077
- }
1078
- }
1079
- }
1080
- if (typeof(opts.query) !== "function") {
1081
- throw "query function not defined for Select2 " + opts.element.attr("id");
1082
- }
1083
-
1084
- if (opts.createSearchChoicePosition === 'top') {
1085
- opts.createSearchChoicePosition = function(list, item) { list.unshift(item); };
1086
- }
1087
- else if (opts.createSearchChoicePosition === 'bottom') {
1088
- opts.createSearchChoicePosition = function(list, item) { list.push(item); };
1089
- }
1090
- else if (typeof(opts.createSearchChoicePosition) !== "function") {
1091
- throw "invalid createSearchChoicePosition option must be 'top', 'bottom' or a custom function";
1092
- }
1093
-
1094
- return opts;
1095
- },
1096
-
1097
- /**
1098
- * Monitor the original element for changes and update select2 accordingly
1099
- */
1100
- // abstract
1101
- monitorSource: function () {
1102
- var el = this.opts.element, observer, self = this;
1103
-
1104
- el.on("change.select2", this.bind(function (e) {
1105
- if (this.opts.element.data("select2-change-triggered") !== true) {
1106
- this.initSelection();
1107
- }
1108
- }));
1109
-
1110
- this._sync = this.bind(function () {
1111
-
1112
- // sync enabled state
1113
- var disabled = el.prop("disabled");
1114
- if (disabled === undefined) disabled = false;
1115
- this.enable(!disabled);
1116
-
1117
- var readonly = el.prop("readonly");
1118
- if (readonly === undefined) readonly = false;
1119
- this.readonly(readonly);
1120
-
1121
- if (this.container) {
1122
- syncCssClasses(this.container, this.opts.element, this.opts.adaptContainerCssClass);
1123
- this.container.addClass(evaluate(this.opts.containerCssClass, this.opts.element));
1124
- }
1125
-
1126
- if (this.dropdown) {
1127
- syncCssClasses(this.dropdown, this.opts.element, this.opts.adaptDropdownCssClass);
1128
- this.dropdown.addClass(evaluate(this.opts.dropdownCssClass, this.opts.element));
1129
- }
1130
-
1131
- });
1132
-
1133
- // IE8-10 (IE9/10 won't fire propertyChange via attachEventListener)
1134
- if (el.length && el[0].attachEvent) {
1135
- el.each(function() {
1136
- this.attachEvent("onpropertychange", self._sync);
1137
- });
1138
- }
1139
-
1140
- // safari, chrome, firefox, IE11
1141
- observer = window.MutationObserver || window.WebKitMutationObserver|| window.MozMutationObserver;
1142
- if (observer !== undefined) {
1143
- if (this.propertyObserver) { delete this.propertyObserver; this.propertyObserver = null; }
1144
- this.propertyObserver = new observer(function (mutations) {
1145
- $.each(mutations, self._sync);
1146
- });
1147
- this.propertyObserver.observe(el.get(0), { attributes:true, subtree:false });
1148
- }
1149
- },
1150
-
1151
- // abstract
1152
- triggerSelect: function(data) {
1153
- var evt = $.Event("select2-selecting", { val: this.id(data), object: data, choice: data });
1154
- this.opts.element.trigger(evt);
1155
- return !evt.isDefaultPrevented();
1156
- },
1157
-
1158
- /**
1159
- * Triggers the change event on the source element
1160
- */
1161
- // abstract
1162
- triggerChange: function (details) {
1163
-
1164
- details = details || {};
1165
- details= $.extend({}, details, { type: "change", val: this.val() });
1166
- // prevents recursive triggering
1167
- this.opts.element.data("select2-change-triggered", true);
1168
- this.opts.element.trigger(details);
1169
- this.opts.element.data("select2-change-triggered", false);
1170
-
1171
- // some validation frameworks ignore the change event and listen instead to keyup, click for selects
1172
- // so here we trigger the click event manually
1173
- this.opts.element.click();
1174
-
1175
- // ValidationEngine ignores the change event and listens instead to blur
1176
- // so here we trigger the blur event manually if so desired
1177
- if (this.opts.blurOnChange)
1178
- this.opts.element.blur();
1179
- },
1180
-
1181
- //abstract
1182
- isInterfaceEnabled: function()
1183
- {
1184
- return this.enabledInterface === true;
1185
- },
1186
-
1187
- // abstract
1188
- enableInterface: function() {
1189
- var enabled = this._enabled && !this._readonly,
1190
- disabled = !enabled;
1191
-
1192
- if (enabled === this.enabledInterface) return false;
1193
-
1194
- this.container.toggleClass("select2-container-disabled", disabled);
1195
- this.close();
1196
- this.enabledInterface = enabled;
1197
-
1198
- return true;
1199
- },
1200
-
1201
- // abstract
1202
- enable: function(enabled) {
1203
- if (enabled === undefined) enabled = true;
1204
- if (this._enabled === enabled) return;
1205
- this._enabled = enabled;
1206
-
1207
- this.opts.element.prop("disabled", !enabled);
1208
- this.enableInterface();
1209
- },
1210
-
1211
- // abstract
1212
- disable: function() {
1213
- this.enable(false);
1214
- },
1215
-
1216
- // abstract
1217
- readonly: function(enabled) {
1218
- if (enabled === undefined) enabled = false;
1219
- if (this._readonly === enabled) return;
1220
- this._readonly = enabled;
1221
-
1222
- this.opts.element.prop("readonly", enabled);
1223
- this.enableInterface();
1224
- },
1225
-
1226
- // abstract
1227
- opened: function () {
1228
- return (this.container) ? this.container.hasClass("select2-dropdown-open") : false;
1229
- },
1230
-
1231
- // abstract
1232
- positionDropdown: function() {
1233
- var $dropdown = this.dropdown,
1234
- container = this.container,
1235
- offset = container.offset(),
1236
- height = container.outerHeight(false),
1237
- width = container.outerWidth(false),
1238
- dropHeight = $dropdown.outerHeight(false),
1239
- $window = $(window),
1240
- windowWidth = $window.width(),
1241
- windowHeight = $window.height(),
1242
- viewPortRight = $window.scrollLeft() + windowWidth,
1243
- viewportBottom = $window.scrollTop() + windowHeight,
1244
- dropTop = offset.top + height,
1245
- dropLeft = offset.left,
1246
- enoughRoomBelow = dropTop + dropHeight <= viewportBottom,
1247
- enoughRoomAbove = (offset.top - dropHeight) >= $window.scrollTop(),
1248
- dropWidth = $dropdown.outerWidth(false),
1249
- enoughRoomOnRight = function() {
1250
- return dropLeft + dropWidth <= viewPortRight;
1251
- },
1252
- enoughRoomOnLeft = function() {
1253
- return offset.left + viewPortRight + container.outerWidth(false) > dropWidth;
1254
- },
1255
- aboveNow = $dropdown.hasClass("select2-drop-above"),
1256
- bodyOffset,
1257
- above,
1258
- changeDirection,
1259
- css,
1260
- resultsListNode;
1261
-
1262
- // always prefer the current above/below alignment, unless there is not enough room
1263
- if (aboveNow) {
1264
- above = true;
1265
- if (!enoughRoomAbove && enoughRoomBelow) {
1266
- changeDirection = true;
1267
- above = false;
1268
- }
1269
- } else {
1270
- above = false;
1271
- if (!enoughRoomBelow && enoughRoomAbove) {
1272
- changeDirection = true;
1273
- above = true;
1274
- }
1275
- }
1276
-
1277
- //if we are changing direction we need to get positions when dropdown is hidden;
1278
- if (changeDirection) {
1279
- $dropdown.hide();
1280
- offset = this.container.offset();
1281
- height = this.container.outerHeight(false);
1282
- width = this.container.outerWidth(false);
1283
- dropHeight = $dropdown.outerHeight(false);
1284
- viewPortRight = $window.scrollLeft() + windowWidth;
1285
- viewportBottom = $window.scrollTop() + windowHeight;
1286
- dropTop = offset.top + height;
1287
- dropLeft = offset.left;
1288
- dropWidth = $dropdown.outerWidth(false);
1289
- $dropdown.show();
1290
-
1291
- // fix so the cursor does not move to the left within the search-textbox in IE
1292
- this.focusSearch();
1293
- }
1294
-
1295
- if (this.opts.dropdownAutoWidth) {
1296
- resultsListNode = $('.select2-results', $dropdown)[0];
1297
- $dropdown.addClass('select2-drop-auto-width');
1298
- $dropdown.css('width', '');
1299
- // Add scrollbar width to dropdown if vertical scrollbar is present
1300
- dropWidth = $dropdown.outerWidth(false) + (resultsListNode.scrollHeight === resultsListNode.clientHeight ? 0 : scrollBarDimensions.width);
1301
- dropWidth > width ? width = dropWidth : dropWidth = width;
1302
- dropHeight = $dropdown.outerHeight(false);
1303
- }
1304
- else {
1305
- this.container.removeClass('select2-drop-auto-width');
1306
- }
1307
-
1308
- //console.log("below/ droptop:", dropTop, "dropHeight", dropHeight, "sum", (dropTop+dropHeight)+" viewport bottom", viewportBottom, "enough?", enoughRoomBelow);
1309
- //console.log("above/ offset.top", offset.top, "dropHeight", dropHeight, "top", (offset.top-dropHeight), "scrollTop", this.body.scrollTop(), "enough?", enoughRoomAbove);
1310
-
1311
- // fix positioning when body has an offset and is not position: static
1312
- if (this.body.css('position') !== 'static') {
1313
- bodyOffset = this.body.offset();
1314
- dropTop -= bodyOffset.top;
1315
- dropLeft -= bodyOffset.left;
1316
- }
1317
-
1318
- if (!enoughRoomOnRight() && enoughRoomOnLeft()) {
1319
- dropLeft = offset.left + this.container.outerWidth(false) - dropWidth;
1320
- }
1321
-
1322
- css = {
1323
- left: dropLeft,
1324
- width: width
1325
- };
1326
-
1327
- if (above) {
1328
- css.top = offset.top - dropHeight;
1329
- css.bottom = 'auto';
1330
- this.container.addClass("select2-drop-above");
1331
- $dropdown.addClass("select2-drop-above");
1332
- }
1333
- else {
1334
- css.top = dropTop;
1335
- css.bottom = 'auto';
1336
- this.container.removeClass("select2-drop-above");
1337
- $dropdown.removeClass("select2-drop-above");
1338
- }
1339
- css = $.extend(css, evaluate(this.opts.dropdownCss, this.opts.element));
1340
-
1341
- $dropdown.css(css);
1342
- },
1343
-
1344
- // abstract
1345
- shouldOpen: function() {
1346
- var event;
1347
-
1348
- if (this.opened()) return false;
1349
-
1350
- if (this._enabled === false || this._readonly === true) return false;
1351
-
1352
- event = $.Event("select2-opening");
1353
- this.opts.element.trigger(event);
1354
- return !event.isDefaultPrevented();
1355
- },
1356
-
1357
- // abstract
1358
- clearDropdownAlignmentPreference: function() {
1359
- // clear the classes used to figure out the preference of where the dropdown should be opened
1360
- this.container.removeClass("select2-drop-above");
1361
- this.dropdown.removeClass("select2-drop-above");
1362
- },
1363
-
1364
- /**
1365
- * Opens the dropdown
1366
- *
1367
- * @return {Boolean} whether or not dropdown was opened. This method will return false if, for example,
1368
- * the dropdown is already open, or if the 'open' event listener on the element called preventDefault().
1369
- */
1370
- // abstract
1371
- open: function () {
1372
-
1373
- if (!this.shouldOpen()) return false;
1374
-
1375
- this.opening();
1376
-
1377
- // Only bind the document mousemove when the dropdown is visible
1378
- $document.on("mousemove.select2Event", function (e) {
1379
- lastMousePosition.x = e.pageX;
1380
- lastMousePosition.y = e.pageY;
1381
- });
1382
-
1383
- return true;
1384
- },
1385
-
1386
- /**
1387
- * Performs the opening of the dropdown
1388
- */
1389
- // abstract
1390
- opening: function() {
1391
- var cid = this.containerEventName,
1392
- scroll = "scroll." + cid,
1393
- resize = "resize."+cid,
1394
- orient = "orientationchange."+cid,
1395
- mask;
1396
-
1397
- this.container.addClass("select2-dropdown-open").addClass("select2-container-active");
1398
-
1399
- this.clearDropdownAlignmentPreference();
1400
-
1401
- if(this.dropdown[0] !== this.body.children().last()[0]) {
1402
- this.dropdown.detach().appendTo(this.body);
1403
- }
1404
-
1405
- // create the dropdown mask if doesn't already exist
1406
- mask = $("#select2-drop-mask");
1407
- if (mask.length === 0) {
1408
- mask = $(document.createElement("div"));
1409
- mask.attr("id","select2-drop-mask").attr("class","select2-drop-mask");
1410
- mask.hide();
1411
- mask.appendTo(this.body);
1412
- mask.on("mousedown touchstart click", function (e) {
1413
- // Prevent IE from generating a click event on the body
1414
- reinsertElement(mask);
1415
-
1416
- var dropdown = $("#select2-drop"), self;
1417
- if (dropdown.length > 0) {
1418
- self=dropdown.data("select2");
1419
- if (self.opts.selectOnBlur) {
1420
- self.selectHighlighted({noFocus: true});
1421
- }
1422
- self.close();
1423
- e.preventDefault();
1424
- e.stopPropagation();
1425
- }
1426
- });
1427
- }
1428
-
1429
- // ensure the mask is always right before the dropdown
1430
- if (this.dropdown.prev()[0] !== mask[0]) {
1431
- this.dropdown.before(mask);
1432
- }
1433
-
1434
- // move the global id to the correct dropdown
1435
- $("#select2-drop").removeAttr("id");
1436
- this.dropdown.attr("id", "select2-drop");
1437
-
1438
- // show the elements
1439
- mask.show();
1440
-
1441
- this.positionDropdown();
1442
- this.dropdown.show();
1443
- this.positionDropdown();
1444
-
1445
- this.dropdown.addClass("select2-drop-active");
1446
-
1447
- // attach listeners to events that can change the position of the container and thus require
1448
- // the position of the dropdown to be updated as well so it does not come unglued from the container
1449
- var that = this;
1450
- this.container.parents().add(window).each(function () {
1451
- $(this).on(resize+" "+scroll+" "+orient, function (e) {
1452
- if (that.opened()) that.positionDropdown();
1453
- });
1454
- });
1455
-
1456
-
1457
- },
1458
-
1459
- // abstract
1460
- close: function () {
1461
- if (!this.opened()) return;
1462
-
1463
- var cid = this.containerEventName,
1464
- scroll = "scroll." + cid,
1465
- resize = "resize."+cid,
1466
- orient = "orientationchange."+cid;
1467
-
1468
- // unbind event listeners
1469
- this.container.parents().add(window).each(function () { $(this).off(scroll).off(resize).off(orient); });
1470
-
1471
- this.clearDropdownAlignmentPreference();
1472
-
1473
- $("#select2-drop-mask").hide();
1474
- this.dropdown.removeAttr("id"); // only the active dropdown has the select2-drop id
1475
- this.dropdown.hide();
1476
- this.container.removeClass("select2-dropdown-open").removeClass("select2-container-active");
1477
- this.results.empty();
1478
-
1479
- // Now that the dropdown is closed, unbind the global document mousemove event
1480
- $document.off("mousemove.select2Event");
1481
-
1482
- this.clearSearch();
1483
- this.search.removeClass("select2-active");
1484
- this.opts.element.trigger($.Event("select2-close"));
1485
- },
1486
-
1487
- /**
1488
- * Opens control, sets input value, and updates results.
1489
- */
1490
- // abstract
1491
- externalSearch: function (term) {
1492
- this.open();
1493
- this.search.val(term);
1494
- this.updateResults(false);
1495
- },
1496
-
1497
- // abstract
1498
- clearSearch: function () {
1499
-
1500
- },
1501
-
1502
- //abstract
1503
- getMaximumSelectionSize: function() {
1504
- return evaluate(this.opts.maximumSelectionSize, this.opts.element);
1505
- },
1506
-
1507
- // abstract
1508
- ensureHighlightVisible: function () {
1509
- var results = this.results, children, index, child, hb, rb, y, more, topOffset;
1510
-
1511
- index = this.highlight();
1512
-
1513
- if (index < 0) return;
1514
-
1515
- if (index == 0) {
1516
-
1517
- // if the first element is highlighted scroll all the way to the top,
1518
- // that way any unselectable headers above it will also be scrolled
1519
- // into view
1520
-
1521
- results.scrollTop(0);
1522
- return;
1523
- }
1524
-
1525
- children = this.findHighlightableChoices().find('.select2-result-label');
1526
-
1527
- child = $(children[index]);
1528
-
1529
- topOffset = (child.offset() || {}).top || 0;
1530
-
1531
- hb = topOffset + child.outerHeight(true);
1532
-
1533
- // if this is the last child lets also make sure select2-more-results is visible
1534
- if (index === children.length - 1) {
1535
- more = results.find("li.select2-more-results");
1536
- if (more.length > 0) {
1537
- hb = more.offset().top + more.outerHeight(true);
1538
- }
1539
- }
1540
-
1541
- rb = results.offset().top + results.outerHeight(false);
1542
- if (hb > rb) {
1543
- results.scrollTop(results.scrollTop() + (hb - rb));
1544
- }
1545
- y = topOffset - results.offset().top;
1546
-
1547
- // make sure the top of the element is visible
1548
- if (y < 0 && child.css('display') != 'none' ) {
1549
- results.scrollTop(results.scrollTop() + y); // y is negative
1550
- }
1551
- },
1552
-
1553
- // abstract
1554
- findHighlightableChoices: function() {
1555
- return this.results.find(".select2-result-selectable:not(.select2-disabled):not(.select2-selected)");
1556
- },
1557
-
1558
- // abstract
1559
- moveHighlight: function (delta) {
1560
- var choices = this.findHighlightableChoices(),
1561
- index = this.highlight();
1562
-
1563
- while (index > -1 && index < choices.length) {
1564
- index += delta;
1565
- var choice = $(choices[index]);
1566
- if (choice.hasClass("select2-result-selectable") && !choice.hasClass("select2-disabled") && !choice.hasClass("select2-selected")) {
1567
- this.highlight(index);
1568
- break;
1569
- }
1570
- }
1571
- },
1572
-
1573
- // abstract
1574
- highlight: function (index) {
1575
- var choices = this.findHighlightableChoices(),
1576
- choice,
1577
- data;
1578
-
1579
- if (arguments.length === 0) {
1580
- return indexOf(choices.filter(".select2-highlighted")[0], choices.get());
1581
- }
1582
-
1583
- if (index >= choices.length) index = choices.length - 1;
1584
- if (index < 0) index = 0;
1585
-
1586
- this.removeHighlight();
1587
-
1588
- choice = $(choices[index]);
1589
- choice.addClass("select2-highlighted");
1590
-
1591
- // ensure assistive technology can determine the active choice
1592
- this.search.attr("aria-activedescendant", choice.find(".select2-result-label").attr("id"));
1593
-
1594
- this.ensureHighlightVisible();
1595
-
1596
- this.liveRegion.text(choice.text());
1597
-
1598
- data = choice.data("select2-data");
1599
- if (data) {
1600
- this.opts.element.trigger({ type: "select2-highlight", val: this.id(data), choice: data });
1601
- }
1602
- },
1603
-
1604
- removeHighlight: function() {
1605
- this.results.find(".select2-highlighted").removeClass("select2-highlighted");
1606
- },
1607
-
1608
- touchMoved: function() {
1609
- this._touchMoved = true;
1610
- },
1611
-
1612
- clearTouchMoved: function() {
1613
- this._touchMoved = false;
1614
- },
1615
-
1616
- // abstract
1617
- countSelectableResults: function() {
1618
- return this.findHighlightableChoices().length;
1619
- },
1620
-
1621
- // abstract
1622
- highlightUnderEvent: function (event) {
1623
- var el = $(event.target).closest(".select2-result-selectable");
1624
- if (el.length > 0 && !el.is(".select2-highlighted")) {
1625
- var choices = this.findHighlightableChoices();
1626
- this.highlight(choices.index(el));
1627
- } else if (el.length == 0) {
1628
- // if we are over an unselectable item remove all highlights
1629
- this.removeHighlight();
1630
- }
1631
- },
1632
-
1633
- // abstract
1634
- loadMoreIfNeeded: function () {
1635
- var results = this.results,
1636
- more = results.find("li.select2-more-results"),
1637
- below, // pixels the element is below the scroll fold, below==0 is when the element is starting to be visible
1638
- page = this.resultsPage + 1,
1639
- self=this,
1640
- term=this.search.val(),
1641
- context=this.context;
1642
-
1643
- if (more.length === 0) return;
1644
- below = more.offset().top - results.offset().top - results.height();
1645
-
1646
- if (below <= this.opts.loadMorePadding) {
1647
- more.addClass("select2-active");
1648
- this.opts.query({
1649
- element: this.opts.element,
1650
- term: term,
1651
- page: page,
1652
- context: context,
1653
- matcher: this.opts.matcher,
1654
- callback: this.bind(function (data) {
1655
-
1656
- // ignore a response if the select2 has been closed before it was received
1657
- if (!self.opened()) return;
1658
-
1659
-
1660
- self.opts.populateResults.call(this, results, data.results, {term: term, page: page, context:context});
1661
- self.postprocessResults(data, false, false);
1662
-
1663
- if (data.more===true) {
1664
- more.detach().appendTo(results).html(self.opts.escapeMarkup(evaluate(self.opts.formatLoadMore, self.opts.element, page+1)));
1665
- window.setTimeout(function() { self.loadMoreIfNeeded(); }, 10);
1666
- } else {
1667
- more.remove();
1668
- }
1669
- self.positionDropdown();
1670
- self.resultsPage = page;
1671
- self.context = data.context;
1672
- this.opts.element.trigger({ type: "select2-loaded", items: data });
1673
- })});
1674
- }
1675
- },
1676
-
1677
- /**
1678
- * Default tokenizer function which does nothing
1679
- */
1680
- tokenize: function() {
1681
-
1682
- },
1683
-
1684
- /**
1685
- * @param initial whether or not this is the call to this method right after the dropdown has been opened
1686
- */
1687
- // abstract
1688
- updateResults: function (initial) {
1689
- var search = this.search,
1690
- results = this.results,
1691
- opts = this.opts,
1692
- data,
1693
- self = this,
1694
- input,
1695
- term = search.val(),
1696
- lastTerm = $.data(this.container, "select2-last-term"),
1697
- // sequence number used to drop out-of-order responses
1698
- queryNumber;
1699
-
1700
- // prevent duplicate queries against the same term
1701
- if (initial !== true && lastTerm && equal(term, lastTerm)) return;
1702
-
1703
- $.data(this.container, "select2-last-term", term);
1704
-
1705
- // if the search is currently hidden we do not alter the results
1706
- if (initial !== true && (this.showSearchInput === false || !this.opened())) {
1707
- return;
1708
- }
1709
-
1710
- function postRender() {
1711
- search.removeClass("select2-active");
1712
- self.positionDropdown();
1713
- if (results.find('.select2-no-results,.select2-selection-limit,.select2-searching').length) {
1714
- self.liveRegion.text(results.text());
1715
- }
1716
- else {
1717
- self.liveRegion.text(self.opts.formatMatches(results.find('.select2-result-selectable:not(".select2-selected")').length));
1718
- }
1719
- }
1720
-
1721
- function render(html) {
1722
- results.html(html);
1723
- postRender();
1724
- }
1725
-
1726
- queryNumber = ++this.queryCount;
1727
-
1728
- var maxSelSize = this.getMaximumSelectionSize();
1729
- if (maxSelSize >=1) {
1730
- data = this.data();
1731
- if ($.isArray(data) && data.length >= maxSelSize && checkFormatter(opts.formatSelectionTooBig, "formatSelectionTooBig")) {
1732
- render("<li class='select2-selection-limit'>" + evaluate(opts.formatSelectionTooBig, opts.element, maxSelSize) + "</li>");
1733
- return;
1734
- }
1735
- }
1736
-
1737
- if (search.val().length < opts.minimumInputLength) {
1738
- if (checkFormatter(opts.formatInputTooShort, "formatInputTooShort")) {
1739
- render("<li class='select2-no-results'>" + evaluate(opts.formatInputTooShort, opts.element, search.val(), opts.minimumInputLength) + "</li>");
1740
- } else {
1741
- render("");
1742
- }
1743
- if (initial && this.showSearch) this.showSearch(true);
1744
- return;
1745
- }
1746
-
1747
- if (opts.maximumInputLength && search.val().length > opts.maximumInputLength) {
1748
- if (checkFormatter(opts.formatInputTooLong, "formatInputTooLong")) {
1749
- render("<li class='select2-no-results'>" + evaluate(opts.formatInputTooLong, opts.element, search.val(), opts.maximumInputLength) + "</li>");
1750
- } else {
1751
- render("");
1752
- }
1753
- return;
1754
- }
1755
-
1756
- if (opts.formatSearching && this.findHighlightableChoices().length === 0) {
1757
- render("<li class='select2-searching'>" + evaluate(opts.formatSearching, opts.element) + "</li>");
1758
- }
1759
-
1760
- search.addClass("select2-active");
1761
-
1762
- this.removeHighlight();
1763
-
1764
- // give the tokenizer a chance to pre-process the input
1765
- input = this.tokenize();
1766
- if (input != undefined && input != null) {
1767
- search.val(input);
1768
- }
1769
-
1770
- this.resultsPage = 1;
1771
-
1772
- opts.query({
1773
- element: opts.element,
1774
- term: search.val(),
1775
- page: this.resultsPage,
1776
- context: null,
1777
- matcher: opts.matcher,
1778
- callback: this.bind(function (data) {
1779
- var def; // default choice
1780
-
1781
- // ignore old responses
1782
- if (queryNumber != this.queryCount) {
1783
- return;
1784
- }
1785
-
1786
- // ignore a response if the select2 has been closed before it was received
1787
- if (!this.opened()) {
1788
- this.search.removeClass("select2-active");
1789
- return;
1790
- }
1791
-
1792
- // handle ajax error
1793
- if(data.hasError !== undefined && checkFormatter(opts.formatAjaxError, "formatAjaxError")) {
1794
- render("<li class='select2-ajax-error'>" + evaluate(opts.formatAjaxError, opts.element, data.jqXHR, data.textStatus, data.errorThrown) + "</li>");
1795
- return;
1796
- }
1797
-
1798
- // save context, if any
1799
- this.context = (data.context===undefined) ? null : data.context;
1800
- // create a default choice and prepend it to the list
1801
- if (this.opts.createSearchChoice && search.val() !== "") {
1802
- def = this.opts.createSearchChoice.call(self, search.val(), data.results);
1803
- if (def !== undefined && def !== null && self.id(def) !== undefined && self.id(def) !== null) {
1804
- if ($(data.results).filter(
1805
- function () {
1806
- return equal(self.id(this), self.id(def));
1807
- }).length === 0) {
1808
- this.opts.createSearchChoicePosition(data.results, def);
1809
- }
1810
- }
1811
- }
1812
-
1813
- if (data.results.length === 0 && checkFormatter(opts.formatNoMatches, "formatNoMatches")) {
1814
- render("<li class='select2-no-results'>" + evaluate(opts.formatNoMatches, opts.element, search.val()) + "</li>");
1815
- return;
1816
- }
1817
-
1818
- results.empty();
1819
- self.opts.populateResults.call(this, results, data.results, {term: search.val(), page: this.resultsPage, context:null});
1820
-
1821
- if (data.more === true && checkFormatter(opts.formatLoadMore, "formatLoadMore")) {
1822
- results.append("<li class='select2-more-results'>" + opts.escapeMarkup(evaluate(opts.formatLoadMore, opts.element, this.resultsPage)) + "</li>");
1823
- window.setTimeout(function() { self.loadMoreIfNeeded(); }, 10);
1824
- }
1825
-
1826
- this.postprocessResults(data, initial);
1827
-
1828
- postRender();
1829
-
1830
- this.opts.element.trigger({ type: "select2-loaded", items: data });
1831
- })});
1832
- },
1833
-
1834
- // abstract
1835
- cancel: function () {
1836
- this.close();
1837
- },
1838
-
1839
- // abstract
1840
- blur: function () {
1841
- // if selectOnBlur == true, select the currently highlighted option
1842
- if (this.opts.selectOnBlur)
1843
- this.selectHighlighted({noFocus: true});
1844
-
1845
- this.close();
1846
- this.container.removeClass("select2-container-active");
1847
- // synonymous to .is(':focus'), which is available in jquery >= 1.6
1848
- if (this.search[0] === document.activeElement) { this.search.blur(); }
1849
- this.clearSearch();
1850
- this.selection.find(".select2-search-choice-focus").removeClass("select2-search-choice-focus");
1851
- },
1852
-
1853
- // abstract
1854
- focusSearch: function () {
1855
- focus(this.search);
1856
- },
1857
-
1858
- // abstract
1859
- selectHighlighted: function (options) {
1860
- if (this._touchMoved) {
1861
- this.clearTouchMoved();
1862
- return;
1863
- }
1864
- var index=this.highlight(),
1865
- highlighted=this.results.find(".select2-highlighted"),
1866
- data = highlighted.closest('.select2-result').data("select2-data");
1867
-
1868
- if (data) {
1869
- this.highlight(index);
1870
- this.onSelect(data, options);
1871
- } else if (options && options.noFocus) {
1872
- this.close();
1873
- }
1874
- },
1875
-
1876
- // abstract
1877
- getPlaceholder: function () {
1878
- var placeholderOption;
1879
- return this.opts.element.attr("placeholder") ||
1880
- this.opts.element.attr("data-placeholder") || // jquery 1.4 compat
1881
- this.opts.element.data("placeholder") ||
1882
- this.opts.placeholder ||
1883
- ((placeholderOption = this.getPlaceholderOption()) !== undefined ? placeholderOption.text() : undefined);
1884
- },
1885
-
1886
- // abstract
1887
- getPlaceholderOption: function() {
1888
- if (this.select) {
1889
- var firstOption = this.select.children('option').first();
1890
- if (this.opts.placeholderOption !== undefined ) {
1891
- //Determine the placeholder option based on the specified placeholderOption setting
1892
- return (this.opts.placeholderOption === "first" && firstOption) ||
1893
- (typeof this.opts.placeholderOption === "function" && this.opts.placeholderOption(this.select));
1894
- } else if ($.trim(firstOption.text()) === "" && firstOption.val() === "") {
1895
- //No explicit placeholder option specified, use the first if it's blank
1896
- return firstOption;
1897
- }
1898
- }
1899
- },
1900
-
1901
- /**
1902
- * Get the desired width for the container element. This is
1903
- * derived first from option `width` passed to select2, then
1904
- * the inline 'style' on the original element, and finally
1905
- * falls back to the jQuery calculated element width.
1906
- */
1907
- // abstract
1908
- initContainerWidth: function () {
1909
- function resolveContainerWidth() {
1910
- var style, attrs, matches, i, l, attr;
1911
-
1912
- if (this.opts.width === "off") {
1913
- return null;
1914
- } else if (this.opts.width === "element"){
1915
- return this.opts.element.outerWidth(false) === 0 ? 'auto' : this.opts.element.outerWidth(false) + 'px';
1916
- } else if (this.opts.width === "copy" || this.opts.width === "resolve") {
1917
- // check if there is inline style on the element that contains width
1918
- style = this.opts.element.attr('style');
1919
- if (style !== undefined) {
1920
- attrs = style.split(';');
1921
- for (i = 0, l = attrs.length; i < l; i = i + 1) {
1922
- attr = attrs[i].replace(/\s/g, '');
1923
- matches = attr.match(/^width:(([-+]?([0-9]*\.)?[0-9]+)(px|em|ex|%|in|cm|mm|pt|pc))/i);
1924
- if (matches !== null && matches.length >= 1)
1925
- return matches[1];
1926
- }
1927
- }
1928
-
1929
- if (this.opts.width === "resolve") {
1930
- // next check if css('width') can resolve a width that is percent based, this is sometimes possible
1931
- // when attached to input type=hidden or elements hidden via css
1932
- style = this.opts.element.css('width');
1933
- if (style.indexOf("%") > 0) return style;
1934
-
1935
- // finally, fallback on the calculated width of the element
1936
- return (this.opts.element.outerWidth(false) === 0 ? 'auto' : this.opts.element.outerWidth(false) + 'px');
1937
- }
1938
-
1939
- return null;
1940
- } else if ($.isFunction(this.opts.width)) {
1941
- return this.opts.width();
1942
- } else {
1943
- return this.opts.width;
1944
- }
1945
- };
1946
-
1947
- var width = resolveContainerWidth.call(this);
1948
- if (width !== null) {
1949
- this.container.css("width", width);
1950
- }
1951
- }
1952
- });
1953
-
1954
- SingleSelect2 = clazz(AbstractSelect2, {
1955
-
1956
- // single
1957
-
1958
- createContainer: function () {
1959
- var container = $(document.createElement("div")).attr({
1960
- "class": "select2-container"
1961
- }).html([
1962
- "<a href='javascript:void(0)' class='select2-choice' tabindex='-1'>",
1963
- " <span class='select2-chosen'>&#160;</span><abbr class='select2-search-choice-close'></abbr>",
1964
- " <span class='select2-arrow' role='presentation'><b role='presentation'></b></span>",
1965
- "</a>",
1966
- "<label for='' class='select2-offscreen'></label>",
1967
- "<input class='select2-focusser select2-offscreen' type='text' aria-haspopup='true' role='button' />",
1968
- "<div class='select2-drop select2-display-none'>",
1969
- " <div class='select2-search'>",
1970
- " <label for='' class='select2-offscreen'></label>",
1971
- " <input type='text' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' class='select2-input' role='combobox' aria-expanded='true'",
1972
- " aria-autocomplete='list' />",
1973
- " </div>",
1974
- " <ul class='select2-results' role='listbox'>",
1975
- " </ul>",
1976
- "</div>"].join(""));
1977
- return container;
1978
- },
1979
-
1980
- // single
1981
- enableInterface: function() {
1982
- if (this.parent.enableInterface.apply(this, arguments)) {
1983
- this.focusser.prop("disabled", !this.isInterfaceEnabled());
1984
- }
1985
- },
1986
-
1987
- // single
1988
- opening: function () {
1989
- var el, range, len;
1990
-
1991
- if (this.opts.minimumResultsForSearch >= 0) {
1992
- this.showSearch(true);
1993
- }
1994
-
1995
- this.parent.opening.apply(this, arguments);
1996
-
1997
- if (this.showSearchInput !== false) {
1998
- // IE appends focusser.val() at the end of field :/ so we manually insert it at the beginning using a range
1999
- // all other browsers handle this just fine
2000
-
2001
- this.search.val(this.focusser.val());
2002
- }
2003
- if (this.opts.shouldFocusInput(this)) {
2004
- this.search.focus();
2005
- // move the cursor to the end after focussing, otherwise it will be at the beginning and
2006
- // new text will appear *before* focusser.val()
2007
- el = this.search.get(0);
2008
- if (el.createTextRange) {
2009
- range = el.createTextRange();
2010
- range.collapse(false);
2011
- range.select();
2012
- } else if (el.setSelectionRange) {
2013
- len = this.search.val().length;
2014
- el.setSelectionRange(len, len);
2015
- }
2016
- }
2017
-
2018
- // initializes search's value with nextSearchTerm (if defined by user)
2019
- // ignore nextSearchTerm if the dropdown is opened by the user pressing a letter
2020
- if(this.search.val() === "") {
2021
- if(this.nextSearchTerm != undefined){
2022
- this.search.val(this.nextSearchTerm);
2023
- this.search.select();
2024
- }
2025
- }
2026
-
2027
- this.focusser.prop("disabled", true).val("");
2028
- this.updateResults(true);
2029
- this.opts.element.trigger($.Event("select2-open"));
2030
- },
2031
-
2032
- // single
2033
- close: function () {
2034
- if (!this.opened()) return;
2035
- this.parent.close.apply(this, arguments);
2036
-
2037
- this.focusser.prop("disabled", false);
2038
-
2039
- if (this.opts.shouldFocusInput(this)) {
2040
- this.focusser.focus();
2041
- }
2042
- },
2043
-
2044
- // single
2045
- focus: function () {
2046
- if (this.opened()) {
2047
- this.close();
2048
- } else {
2049
- this.focusser.prop("disabled", false);
2050
- if (this.opts.shouldFocusInput(this)) {
2051
- this.focusser.focus();
2052
- }
2053
- }
2054
- },
2055
-
2056
- // single
2057
- isFocused: function () {
2058
- return this.container.hasClass("select2-container-active");
2059
- },
2060
-
2061
- // single
2062
- cancel: function () {
2063
- this.parent.cancel.apply(this, arguments);
2064
- this.focusser.prop("disabled", false);
2065
-
2066
- if (this.opts.shouldFocusInput(this)) {
2067
- this.focusser.focus();
2068
- }
2069
- },
2070
-
2071
- // single
2072
- destroy: function() {
2073
- $("label[for='" + this.focusser.attr('id') + "']")
2074
- .attr('for', this.opts.element.attr("id"));
2075
- this.parent.destroy.apply(this, arguments);
2076
-
2077
- cleanupJQueryElements.call(this,
2078
- "selection",
2079
- "focusser"
2080
- );
2081
- },
2082
-
2083
- // single
2084
- initContainer: function () {
2085
-
2086
- var selection,
2087
- container = this.container,
2088
- dropdown = this.dropdown,
2089
- idSuffix = nextUid(),
2090
- elementLabel;
2091
-
2092
- if (this.opts.minimumResultsForSearch < 0) {
2093
- this.showSearch(false);
2094
- } else {
2095
- this.showSearch(true);
2096
- }
2097
-
2098
- this.selection = selection = container.find(".select2-choice");
2099
-
2100
- this.focusser = container.find(".select2-focusser");
2101
-
2102
- // add aria associations
2103
- selection.find(".select2-chosen").attr("id", "select2-chosen-"+idSuffix);
2104
- this.focusser.attr("aria-labelledby", "select2-chosen-"+idSuffix);
2105
- this.results.attr("id", "select2-results-"+idSuffix);
2106
- this.search.attr("aria-owns", "select2-results-"+idSuffix);
2107
-
2108
- // rewrite labels from original element to focusser
2109
- this.focusser.attr("id", "s2id_autogen"+idSuffix);
2110
-
2111
- elementLabel = $("label[for='" + this.opts.element.attr("id") + "']");
2112
- this.opts.element.focus(this.bind(function () { this.focus(); }));
2113
-
2114
- this.focusser.prev()
2115
- .text(elementLabel.text())
2116
- .attr('for', this.focusser.attr('id'));
2117
-
2118
- // Ensure the original element retains an accessible name
2119
- var originalTitle = this.opts.element.attr("title");
2120
- this.opts.element.attr("title", (originalTitle || elementLabel.text()));
2121
-
2122
- this.focusser.attr("tabindex", this.elementTabIndex);
2123
-
2124
- // write label for search field using the label from the focusser element
2125
- this.search.attr("id", this.focusser.attr('id') + '_search');
2126
-
2127
- this.search.prev()
2128
- .text($("label[for='" + this.focusser.attr('id') + "']").text())
2129
- .attr('for', this.search.attr('id'));
2130
-
2131
- this.search.on("keydown", this.bind(function (e) {
2132
- if (!this.isInterfaceEnabled()) return;
2133
-
2134
- // filter 229 keyCodes (input method editor is processing key input)
2135
- if (229 == e.keyCode) return;
2136
-
2137
- if (e.which === KEY.PAGE_UP || e.which === KEY.PAGE_DOWN) {
2138
- // prevent the page from scrolling
2139
- killEvent(e);
2140
- return;
2141
- }
2142
-
2143
- switch (e.which) {
2144
- case KEY.UP:
2145
- case KEY.DOWN:
2146
- this.moveHighlight((e.which === KEY.UP) ? -1 : 1);
2147
- killEvent(e);
2148
- return;
2149
- case KEY.ENTER:
2150
- this.selectHighlighted();
2151
- killEvent(e);
2152
- return;
2153
- case KEY.TAB:
2154
- this.selectHighlighted({noFocus: true});
2155
- return;
2156
- case KEY.ESC:
2157
- this.cancel(e);
2158
- killEvent(e);
2159
- return;
2160
- }
2161
- }));
2162
-
2163
- this.search.on("blur", this.bind(function(e) {
2164
- // a workaround for chrome to keep the search field focussed when the scroll bar is used to scroll the dropdown.
2165
- // without this the search field loses focus which is annoying
2166
- if (document.activeElement === this.body.get(0)) {
2167
- window.setTimeout(this.bind(function() {
2168
- if (this.opened()) {
2169
- this.search.focus();
2170
- }
2171
- }), 0);
2172
- }
2173
- }));
2174
-
2175
- this.focusser.on("keydown", this.bind(function (e) {
2176
- if (!this.isInterfaceEnabled()) return;
2177
-
2178
- if (e.which === KEY.TAB || KEY.isControl(e) || KEY.isFunctionKey(e) || e.which === KEY.ESC) {
2179
- return;
2180
- }
2181
-
2182
- if (this.opts.openOnEnter === false && e.which === KEY.ENTER) {
2183
- killEvent(e);
2184
- return;
2185
- }
2186
-
2187
- if (e.which == KEY.DOWN || e.which == KEY.UP
2188
- || (e.which == KEY.ENTER && this.opts.openOnEnter)) {
2189
-
2190
- if (e.altKey || e.ctrlKey || e.shiftKey || e.metaKey) return;
2191
-
2192
- this.open();
2193
- killEvent(e);
2194
- return;
2195
- }
2196
-
2197
- if (e.which == KEY.DELETE || e.which == KEY.BACKSPACE) {
2198
- if (this.opts.allowClear) {
2199
- this.clear();
2200
- }
2201
- killEvent(e);
2202
- return;
2203
- }
2204
- }));
2205
-
2206
-
2207
- installKeyUpChangeEvent(this.focusser);
2208
- this.focusser.on("keyup-change input", this.bind(function(e) {
2209
- if (this.opts.minimumResultsForSearch >= 0) {
2210
- e.stopPropagation();
2211
- if (this.opened()) return;
2212
- this.open();
2213
- }
2214
- }));
2215
-
2216
- selection.on("mousedown touchstart", "abbr", this.bind(function (e) {
2217
- if (!this.isInterfaceEnabled()) {
2218
- return;
2219
- }
2220
-
2221
- this.clear();
2222
- killEventImmediately(e);
2223
- this.close();
2224
-
2225
- if (this.selection) {
2226
- this.selection.focus();
2227
- }
2228
- }));
2229
-
2230
- selection.on("mousedown touchstart", this.bind(function (e) {
2231
- // Prevent IE from generating a click event on the body
2232
- reinsertElement(selection);
2233
-
2234
- if (!this.container.hasClass("select2-container-active")) {
2235
- this.opts.element.trigger($.Event("select2-focus"));
2236
- }
2237
-
2238
- if (this.opened()) {
2239
- this.close();
2240
- } else if (this.isInterfaceEnabled()) {
2241
- this.open();
2242
- }
2243
-
2244
- killEvent(e);
2245
- }));
2246
-
2247
- dropdown.on("mousedown touchstart", this.bind(function() {
2248
- if (this.opts.shouldFocusInput(this)) {
2249
- this.search.focus();
2250
- }
2251
- }));
2252
-
2253
- selection.on("focus", this.bind(function(e) {
2254
- killEvent(e);
2255
- }));
2256
-
2257
- this.focusser.on("focus", this.bind(function(){
2258
- if (!this.container.hasClass("select2-container-active")) {
2259
- this.opts.element.trigger($.Event("select2-focus"));
2260
- }
2261
- this.container.addClass("select2-container-active");
2262
- })).on("blur", this.bind(function() {
2263
- if (!this.opened()) {
2264
- this.container.removeClass("select2-container-active");
2265
- this.opts.element.trigger($.Event("select2-blur"));
2266
- }
2267
- }));
2268
- this.search.on("focus", this.bind(function(){
2269
- if (!this.container.hasClass("select2-container-active")) {
2270
- this.opts.element.trigger($.Event("select2-focus"));
2271
- }
2272
- this.container.addClass("select2-container-active");
2273
- }));
2274
-
2275
- this.initContainerWidth();
2276
- this.opts.element.hide();
2277
- this.setPlaceholder();
2278
-
2279
- },
2280
-
2281
- // single
2282
- clear: function(triggerChange) {
2283
- var data=this.selection.data("select2-data");
2284
- if (data) { // guard against queued quick consecutive clicks
2285
- var evt = $.Event("select2-clearing");
2286
- this.opts.element.trigger(evt);
2287
- if (evt.isDefaultPrevented()) {
2288
- return;
2289
- }
2290
- var placeholderOption = this.getPlaceholderOption();
2291
- this.opts.element.val(placeholderOption ? placeholderOption.val() : "");
2292
- this.selection.find(".select2-chosen").empty();
2293
- this.selection.removeData("select2-data");
2294
- this.setPlaceholder();
2295
-
2296
- if (triggerChange !== false){
2297
- this.opts.element.trigger({ type: "select2-removed", val: this.id(data), choice: data });
2298
- this.triggerChange({removed:data});
2299
- }
2300
- }
2301
- },
2302
-
2303
- /**
2304
- * Sets selection based on source element's value
2305
- */
2306
- // single
2307
- initSelection: function () {
2308
- var selected;
2309
- if (this.isPlaceholderOptionSelected()) {
2310
- this.updateSelection(null);
2311
- this.close();
2312
- this.setPlaceholder();
2313
- } else {
2314
- var self = this;
2315
- this.opts.initSelection.call(null, this.opts.element, function(selected){
2316
- if (selected !== undefined && selected !== null) {
2317
- self.updateSelection(selected);
2318
- self.close();
2319
- self.setPlaceholder();
2320
- self.nextSearchTerm = self.opts.nextSearchTerm(selected, self.search.val());
2321
- }
2322
- });
2323
- }
2324
- },
2325
-
2326
- isPlaceholderOptionSelected: function() {
2327
- var placeholderOption;
2328
- if (this.getPlaceholder() === undefined) return false; // no placeholder specified so no option should be considered
2329
- return ((placeholderOption = this.getPlaceholderOption()) !== undefined && placeholderOption.prop("selected"))
2330
- || (this.opts.element.val() === "")
2331
- || (this.opts.element.val() === undefined)
2332
- || (this.opts.element.val() === null);
2333
- },
2334
-
2335
- // single
2336
- prepareOpts: function () {
2337
- var opts = this.parent.prepareOpts.apply(this, arguments),
2338
- self=this;
2339
-
2340
- if (opts.element.get(0).tagName.toLowerCase() === "select") {
2341
- // install the selection initializer
2342
- opts.initSelection = function (element, callback) {
2343
- var selected = element.find("option").filter(function() { return this.selected && !this.disabled });
2344
- // a single select box always has a value, no need to null check 'selected'
2345
- callback(self.optionToData(selected));
2346
- };
2347
- } else if ("data" in opts) {
2348
- // install default initSelection when applied to hidden input and data is local
2349
- opts.initSelection = opts.initSelection || function (element, callback) {
2350
- var id = element.val();
2351
- //search in data by id, storing the actual matching item
2352
- var match = null;
2353
- opts.query({
2354
- matcher: function(term, text, el){
2355
- var is_match = equal(id, opts.id(el));
2356
- if (is_match) {
2357
- match = el;
2358
- }
2359
- return is_match;
2360
- },
2361
- callback: !$.isFunction(callback) ? $.noop : function() {
2362
- callback(match);
2363
- }
2364
- });
2365
- };
2366
- }
2367
-
2368
- return opts;
2369
- },
2370
-
2371
- // single
2372
- getPlaceholder: function() {
2373
- // if a placeholder is specified on a single select without a valid placeholder option ignore it
2374
- if (this.select) {
2375
- if (this.getPlaceholderOption() === undefined) {
2376
- return undefined;
2377
- }
2378
- }
2379
-
2380
- return this.parent.getPlaceholder.apply(this, arguments);
2381
- },
2382
-
2383
- // single
2384
- setPlaceholder: function () {
2385
- var placeholder = this.getPlaceholder();
2386
-
2387
- if (this.isPlaceholderOptionSelected() && placeholder !== undefined) {
2388
-
2389
- // check for a placeholder option if attached to a select
2390
- if (this.select && this.getPlaceholderOption() === undefined) return;
2391
-
2392
- this.selection.find(".select2-chosen").html(this.opts.escapeMarkup(placeholder));
2393
-
2394
- this.selection.addClass("select2-default");
2395
-
2396
- this.container.removeClass("select2-allowclear");
2397
- }
2398
- },
2399
-
2400
- // single
2401
- postprocessResults: function (data, initial, noHighlightUpdate) {
2402
- var selected = 0, self = this, showSearchInput = true;
2403
-
2404
- // find the selected element in the result list
2405
-
2406
- this.findHighlightableChoices().each2(function (i, elm) {
2407
- if (equal(self.id(elm.data("select2-data")), self.opts.element.val())) {
2408
- selected = i;
2409
- return false;
2410
- }
2411
- });
2412
-
2413
- // and highlight it
2414
- if (noHighlightUpdate !== false) {
2415
- if (initial === true && selected >= 0) {
2416
- this.highlight(selected);
2417
- } else {
2418
- this.highlight(0);
2419
- }
2420
- }
2421
-
2422
- // hide the search box if this is the first we got the results and there are enough of them for search
2423
-
2424
- if (initial === true) {
2425
- var min = this.opts.minimumResultsForSearch;
2426
- if (min >= 0) {
2427
- this.showSearch(countResults(data.results) >= min);
2428
- }
2429
- }
2430
- },
2431
-
2432
- // single
2433
- showSearch: function(showSearchInput) {
2434
- if (this.showSearchInput === showSearchInput) return;
2435
-
2436
- this.showSearchInput = showSearchInput;
2437
-
2438
- this.dropdown.find(".select2-search").toggleClass("select2-search-hidden", !showSearchInput);
2439
- this.dropdown.find(".select2-search").toggleClass("select2-offscreen", !showSearchInput);
2440
- //add "select2-with-searchbox" to the container if search box is shown
2441
- $(this.dropdown, this.container).toggleClass("select2-with-searchbox", showSearchInput);
2442
- },
2443
-
2444
- // single
2445
- onSelect: function (data, options) {
2446
-
2447
- if (!this.triggerSelect(data)) { return; }
2448
-
2449
- var old = this.opts.element.val(),
2450
- oldData = this.data();
2451
-
2452
- this.opts.element.val(this.id(data));
2453
- this.updateSelection(data);
2454
-
2455
- this.opts.element.trigger({ type: "select2-selected", val: this.id(data), choice: data });
2456
-
2457
- this.nextSearchTerm = this.opts.nextSearchTerm(data, this.search.val());
2458
- this.close();
2459
-
2460
- if ((!options || !options.noFocus) && this.opts.shouldFocusInput(this)) {
2461
- this.focusser.focus();
2462
- }
2463
-
2464
- if (!equal(old, this.id(data))) {
2465
- this.triggerChange({ added: data, removed: oldData });
2466
- }
2467
- },
2468
-
2469
- // single
2470
- updateSelection: function (data) {
2471
-
2472
- var container=this.selection.find(".select2-chosen"), formatted, cssClass;
2473
-
2474
- this.selection.data("select2-data", data);
2475
-
2476
- container.empty();
2477
- if (data !== null) {
2478
- formatted=this.opts.formatSelection(data, container, this.opts.escapeMarkup);
2479
- }
2480
- if (formatted !== undefined) {
2481
- container.append(formatted);
2482
- }
2483
- cssClass=this.opts.formatSelectionCssClass(data, container);
2484
- if (cssClass !== undefined) {
2485
- container.addClass(cssClass);
2486
- }
2487
-
2488
- this.selection.removeClass("select2-default");
2489
-
2490
- if (this.opts.allowClear && this.getPlaceholder() !== undefined) {
2491
- this.container.addClass("select2-allowclear");
2492
- }
2493
- },
2494
-
2495
- // single
2496
- val: function () {
2497
- var val,
2498
- triggerChange = false,
2499
- data = null,
2500
- self = this,
2501
- oldData = this.data();
2502
-
2503
- if (arguments.length === 0) {
2504
- return this.opts.element.val();
2505
- }
2506
-
2507
- val = arguments[0];
2508
-
2509
- if (arguments.length > 1) {
2510
- triggerChange = arguments[1];
2511
- }
2512
-
2513
- if (this.select) {
2514
- this.select
2515
- .val(val)
2516
- .find("option").filter(function() { return this.selected }).each2(function (i, elm) {
2517
- data = self.optionToData(elm);
2518
- return false;
2519
- });
2520
- this.updateSelection(data);
2521
- this.setPlaceholder();
2522
- if (triggerChange) {
2523
- this.triggerChange({added: data, removed:oldData});
2524
- }
2525
- } else {
2526
- // val is an id. !val is true for [undefined,null,'',0] - 0 is legal
2527
- if (!val && val !== 0) {
2528
- this.clear(triggerChange);
2529
- return;
2530
- }
2531
- if (this.opts.initSelection === undefined) {
2532
- throw new Error("cannot call val() if initSelection() is not defined");
2533
- }
2534
- this.opts.element.val(val);
2535
- this.opts.initSelection(this.opts.element, function(data){
2536
- self.opts.element.val(!data ? "" : self.id(data));
2537
- self.updateSelection(data);
2538
- self.setPlaceholder();
2539
- if (triggerChange) {
2540
- self.triggerChange({added: data, removed:oldData});
2541
- }
2542
- });
2543
- }
2544
- },
2545
-
2546
- // single
2547
- clearSearch: function () {
2548
- this.search.val("");
2549
- this.focusser.val("");
2550
- },
2551
-
2552
- // single
2553
- data: function(value) {
2554
- var data,
2555
- triggerChange = false;
2556
-
2557
- if (arguments.length === 0) {
2558
- data = this.selection.data("select2-data");
2559
- if (data == undefined) data = null;
2560
- return data;
2561
- } else {
2562
- if (arguments.length > 1) {
2563
- triggerChange = arguments[1];
2564
- }
2565
- if (!value) {
2566
- this.clear(triggerChange);
2567
- } else {
2568
- data = this.data();
2569
- this.opts.element.val(!value ? "" : this.id(value));
2570
- this.updateSelection(value);
2571
- if (triggerChange) {
2572
- this.triggerChange({added: value, removed:data});
2573
- }
2574
- }
2575
- }
2576
- }
2577
- });
2578
-
2579
- MultiSelect2 = clazz(AbstractSelect2, {
2580
-
2581
- // multi
2582
- createContainer: function () {
2583
- var container = $(document.createElement("div")).attr({
2584
- "class": "select2-container select2-container-multi"
2585
- }).html([
2586
- "<ul class='select2-choices'>",
2587
- " <li class='select2-search-field'>",
2588
- " <label for='' class='select2-offscreen'></label>",
2589
- " <input type='text' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' class='select2-input'>",
2590
- " </li>",
2591
- "</ul>",
2592
- "<div class='select2-drop select2-drop-multi select2-display-none'>",
2593
- " <ul class='select2-results'>",
2594
- " </ul>",
2595
- "</div>"].join(""));
2596
- return container;
2597
- },
2598
-
2599
- // multi
2600
- prepareOpts: function () {
2601
- var opts = this.parent.prepareOpts.apply(this, arguments),
2602
- self=this;
2603
-
2604
- // TODO validate placeholder is a string if specified
2605
- if (opts.element.get(0).tagName.toLowerCase() === "select") {
2606
- // install the selection initializer
2607
- opts.initSelection = function (element, callback) {
2608
-
2609
- var data = [];
2610
-
2611
- element.find("option").filter(function() { return this.selected && !this.disabled }).each2(function (i, elm) {
2612
- data.push(self.optionToData(elm));
2613
- });
2614
- callback(data);
2615
- };
2616
- } else if ("data" in opts) {
2617
- // install default initSelection when applied to hidden input and data is local
2618
- opts.initSelection = opts.initSelection || function (element, callback) {
2619
- var ids = splitVal(element.val(), opts.separator, opts.transformVal);
2620
- //search in data by array of ids, storing matching items in a list
2621
- var matches = [];
2622
- opts.query({
2623
- matcher: function(term, text, el){
2624
- var is_match = $.grep(ids, function(id) {
2625
- return equal(id, opts.id(el));
2626
- }).length;
2627
- if (is_match) {
2628
- matches.push(el);
2629
- }
2630
- return is_match;
2631
- },
2632
- callback: !$.isFunction(callback) ? $.noop : function() {
2633
- // reorder matches based on the order they appear in the ids array because right now
2634
- // they are in the order in which they appear in data array
2635
- var ordered = [];
2636
- for (var i = 0; i < ids.length; i++) {
2637
- var id = ids[i];
2638
- for (var j = 0; j < matches.length; j++) {
2639
- var match = matches[j];
2640
- if (equal(id, opts.id(match))) {
2641
- ordered.push(match);
2642
- matches.splice(j, 1);
2643
- break;
2644
- }
2645
- }
2646
- }
2647
- callback(ordered);
2648
- }
2649
- });
2650
- };
2651
- }
2652
-
2653
- return opts;
2654
- },
2655
-
2656
- // multi
2657
- selectChoice: function (choice) {
2658
-
2659
- var selected = this.container.find(".select2-search-choice-focus");
2660
- if (selected.length && choice && choice[0] == selected[0]) {
2661
-
2662
- } else {
2663
- if (selected.length) {
2664
- this.opts.element.trigger("choice-deselected", selected);
2665
- }
2666
- selected.removeClass("select2-search-choice-focus");
2667
- if (choice && choice.length) {
2668
- this.close();
2669
- choice.addClass("select2-search-choice-focus");
2670
- this.opts.element.trigger("choice-selected", choice);
2671
- }
2672
- }
2673
- },
2674
-
2675
- // multi
2676
- destroy: function() {
2677
- $("label[for='" + this.search.attr('id') + "']")
2678
- .attr('for', this.opts.element.attr("id"));
2679
- this.parent.destroy.apply(this, arguments);
2680
-
2681
- cleanupJQueryElements.call(this,
2682
- "searchContainer",
2683
- "selection"
2684
- );
2685
- },
2686
-
2687
- // multi
2688
- initContainer: function () {
2689
-
2690
- var selector = ".select2-choices", selection;
2691
-
2692
- this.searchContainer = this.container.find(".select2-search-field");
2693
- this.selection = selection = this.container.find(selector);
2694
-
2695
- var _this = this;
2696
- this.selection.on("click", ".select2-container:not(.select2-container-disabled) .select2-search-choice:not(.select2-locked)", function (e) {
2697
- _this.search[0].focus();
2698
- _this.selectChoice($(this));
2699
- });
2700
-
2701
- // rewrite labels from original element to focusser
2702
- this.search.attr("id", "s2id_autogen"+nextUid());
2703
-
2704
- this.search.prev()
2705
- .text($("label[for='" + this.opts.element.attr("id") + "']").text())
2706
- .attr('for', this.search.attr('id'));
2707
- this.opts.element.focus(this.bind(function () { this.focus(); }));
2708
-
2709
- this.search.on("input paste", this.bind(function() {
2710
- if (this.search.attr('placeholder') && this.search.val().length == 0) return;
2711
- if (!this.isInterfaceEnabled()) return;
2712
- if (!this.opened()) {
2713
- this.open();
2714
- }
2715
- }));
2716
-
2717
- this.search.attr("tabindex", this.elementTabIndex);
2718
-
2719
- this.keydowns = 0;
2720
- this.search.on("keydown", this.bind(function (e) {
2721
- if (!this.isInterfaceEnabled()) return;
2722
-
2723
- ++this.keydowns;
2724
- var selected = selection.find(".select2-search-choice-focus");
2725
- var prev = selected.prev(".select2-search-choice:not(.select2-locked)");
2726
- var next = selected.next(".select2-search-choice:not(.select2-locked)");
2727
- var pos = getCursorInfo(this.search);
2728
-
2729
- if (selected.length &&
2730
- (e.which == KEY.LEFT || e.which == KEY.RIGHT || e.which == KEY.BACKSPACE || e.which == KEY.DELETE || e.which == KEY.ENTER)) {
2731
- var selectedChoice = selected;
2732
- if (e.which == KEY.LEFT && prev.length) {
2733
- selectedChoice = prev;
2734
- }
2735
- else if (e.which == KEY.RIGHT) {
2736
- selectedChoice = next.length ? next : null;
2737
- }
2738
- else if (e.which === KEY.BACKSPACE) {
2739
- if (this.unselect(selected.first())) {
2740
- this.search.width(10);
2741
- selectedChoice = prev.length ? prev : next;
2742
- }
2743
- } else if (e.which == KEY.DELETE) {
2744
- if (this.unselect(selected.first())) {
2745
- this.search.width(10);
2746
- selectedChoice = next.length ? next : null;
2747
- }
2748
- } else if (e.which == KEY.ENTER) {
2749
- selectedChoice = null;
2750
- }
2751
-
2752
- this.selectChoice(selectedChoice);
2753
- killEvent(e);
2754
- if (!selectedChoice || !selectedChoice.length) {
2755
- this.open();
2756
- }
2757
- return;
2758
- } else if (((e.which === KEY.BACKSPACE && this.keydowns == 1)
2759
- || e.which == KEY.LEFT) && (pos.offset == 0 && !pos.length)) {
2760
-
2761
- this.selectChoice(selection.find(".select2-search-choice:not(.select2-locked)").last());
2762
- killEvent(e);
2763
- return;
2764
- } else {
2765
- this.selectChoice(null);
2766
- }
2767
-
2768
- if (this.opened()) {
2769
- switch (e.which) {
2770
- case KEY.UP:
2771
- case KEY.DOWN:
2772
- this.moveHighlight((e.which === KEY.UP) ? -1 : 1);
2773
- killEvent(e);
2774
- return;
2775
- case KEY.ENTER:
2776
- this.selectHighlighted();
2777
- killEvent(e);
2778
- return;
2779
- case KEY.TAB:
2780
- this.selectHighlighted({noFocus:true});
2781
- this.close();
2782
- return;
2783
- case KEY.ESC:
2784
- this.cancel(e);
2785
- killEvent(e);
2786
- return;
2787
- }
2788
- }
2789
-
2790
- if (e.which === KEY.TAB || KEY.isControl(e) || KEY.isFunctionKey(e)
2791
- || e.which === KEY.BACKSPACE || e.which === KEY.ESC) {
2792
- return;
2793
- }
2794
-
2795
- if (e.which === KEY.ENTER) {
2796
- if (this.opts.openOnEnter === false) {
2797
- return;
2798
- } else if (e.altKey || e.ctrlKey || e.shiftKey || e.metaKey) {
2799
- return;
2800
- }
2801
- }
2802
-
2803
- this.open();
2804
-
2805
- if (e.which === KEY.PAGE_UP || e.which === KEY.PAGE_DOWN) {
2806
- // prevent the page from scrolling
2807
- killEvent(e);
2808
- }
2809
-
2810
- if (e.which === KEY.ENTER) {
2811
- // prevent form from being submitted
2812
- killEvent(e);
2813
- }
2814
-
2815
- }));
2816
-
2817
- this.search.on("keyup", this.bind(function (e) {
2818
- this.keydowns = 0;
2819
- this.resizeSearch();
2820
- })
2821
- );
2822
-
2823
- this.search.on("blur", this.bind(function(e) {
2824
- this.container.removeClass("select2-container-active");
2825
- this.search.removeClass("select2-focused");
2826
- this.selectChoice(null);
2827
- if (!this.opened()) this.clearSearch();
2828
- e.stopImmediatePropagation();
2829
- this.opts.element.trigger($.Event("select2-blur"));
2830
- }));
2831
-
2832
- this.container.on("click", selector, this.bind(function (e) {
2833
- if (!this.isInterfaceEnabled()) return;
2834
- if ($(e.target).closest(".select2-search-choice").length > 0) {
2835
- // clicked inside a select2 search choice, do not open
2836
- return;
2837
- }
2838
- this.selectChoice(null);
2839
- this.clearPlaceholder();
2840
- if (!this.container.hasClass("select2-container-active")) {
2841
- this.opts.element.trigger($.Event("select2-focus"));
2842
- }
2843
- this.open();
2844
- this.focusSearch();
2845
- e.preventDefault();
2846
- }));
2847
-
2848
- this.container.on("focus", selector, this.bind(function () {
2849
- if (!this.isInterfaceEnabled()) return;
2850
- if (!this.container.hasClass("select2-container-active")) {
2851
- this.opts.element.trigger($.Event("select2-focus"));
2852
- }
2853
- this.container.addClass("select2-container-active");
2854
- this.dropdown.addClass("select2-drop-active");
2855
- this.clearPlaceholder();
2856
- }));
2857
-
2858
- this.initContainerWidth();
2859
- this.opts.element.hide();
2860
-
2861
- // set the placeholder if necessary
2862
- this.clearSearch();
2863
- },
2864
-
2865
- // multi
2866
- enableInterface: function() {
2867
- if (this.parent.enableInterface.apply(this, arguments)) {
2868
- this.search.prop("disabled", !this.isInterfaceEnabled());
2869
- }
2870
- },
2871
-
2872
- // multi
2873
- initSelection: function () {
2874
- var data;
2875
- if (this.opts.element.val() === "" && this.opts.element.text() === "") {
2876
- this.updateSelection([]);
2877
- this.close();
2878
- // set the placeholder if necessary
2879
- this.clearSearch();
2880
- }
2881
- if (this.select || this.opts.element.val() !== "") {
2882
- var self = this;
2883
- this.opts.initSelection.call(null, this.opts.element, function(data){
2884
- if (data !== undefined && data !== null) {
2885
- self.updateSelection(data);
2886
- self.close();
2887
- // set the placeholder if necessary
2888
- self.clearSearch();
2889
- }
2890
- });
2891
- }
2892
- },
2893
-
2894
- // multi
2895
- clearSearch: function () {
2896
- var placeholder = this.getPlaceholder(),
2897
- maxWidth = this.getMaxSearchWidth();
2898
-
2899
- if (placeholder !== undefined && this.getVal().length === 0 && this.search.hasClass("select2-focused") === false) {
2900
- this.search.val(placeholder).addClass("select2-default");
2901
- // stretch the search box to full width of the container so as much of the placeholder is visible as possible
2902
- // we could call this.resizeSearch(), but we do not because that requires a sizer and we do not want to create one so early because of a firefox bug, see #944
2903
- this.search.width(maxWidth > 0 ? maxWidth : this.container.css("width"));
2904
- } else {
2905
- this.search.val("").width(10);
2906
- }
2907
- },
2908
-
2909
- // multi
2910
- clearPlaceholder: function () {
2911
- if (this.search.hasClass("select2-default")) {
2912
- this.search.val("").removeClass("select2-default");
2913
- }
2914
- },
2915
-
2916
- // multi
2917
- opening: function () {
2918
- this.clearPlaceholder(); // should be done before super so placeholder is not used to search
2919
- this.resizeSearch();
2920
-
2921
- this.parent.opening.apply(this, arguments);
2922
-
2923
- this.focusSearch();
2924
-
2925
- // initializes search's value with nextSearchTerm (if defined by user)
2926
- // ignore nextSearchTerm if the dropdown is opened by the user pressing a letter
2927
- if(this.search.val() === "") {
2928
- if(this.nextSearchTerm != undefined){
2929
- this.search.val(this.nextSearchTerm);
2930
- this.search.select();
2931
- }
2932
- }
2933
-
2934
- this.updateResults(true);
2935
- if (this.opts.shouldFocusInput(this)) {
2936
- this.search.focus();
2937
- }
2938
- this.opts.element.trigger($.Event("select2-open"));
2939
- },
2940
-
2941
- // multi
2942
- close: function () {
2943
- if (!this.opened()) return;
2944
- this.parent.close.apply(this, arguments);
2945
- },
2946
-
2947
- // multi
2948
- focus: function () {
2949
- this.close();
2950
- this.search.focus();
2951
- },
2952
-
2953
- // multi
2954
- isFocused: function () {
2955
- return this.search.hasClass("select2-focused");
2956
- },
2957
-
2958
- // multi
2959
- updateSelection: function (data) {
2960
- var ids = [], filtered = [], self = this;
2961
-
2962
- // filter out duplicates
2963
- $(data).each(function () {
2964
- if (indexOf(self.id(this), ids) < 0) {
2965
- ids.push(self.id(this));
2966
- filtered.push(this);
2967
- }
2968
- });
2969
- data = filtered;
2970
-
2971
- this.selection.find(".select2-search-choice").remove();
2972
- $(data).each(function () {
2973
- self.addSelectedChoice(this);
2974
- });
2975
- self.postprocessResults();
2976
- },
2977
-
2978
- // multi
2979
- tokenize: function() {
2980
- var input = this.search.val();
2981
- input = this.opts.tokenizer.call(this, input, this.data(), this.bind(this.onSelect), this.opts);
2982
- if (input != null && input != undefined) {
2983
- this.search.val(input);
2984
- if (input.length > 0) {
2985
- this.open();
2986
- }
2987
- }
2988
-
2989
- },
2990
-
2991
- // multi
2992
- onSelect: function (data, options) {
2993
-
2994
- if (!this.triggerSelect(data) || data.text === "") { return; }
2995
-
2996
- this.addSelectedChoice(data);
2997
-
2998
- this.opts.element.trigger({ type: "selected", val: this.id(data), choice: data });
2999
-
3000
- // keep track of the search's value before it gets cleared
3001
- this.nextSearchTerm = this.opts.nextSearchTerm(data, this.search.val());
3002
-
3003
- this.clearSearch();
3004
- this.updateResults();
3005
-
3006
- if (this.select || !this.opts.closeOnSelect) this.postprocessResults(data, false, this.opts.closeOnSelect===true);
3007
-
3008
- if (this.opts.closeOnSelect) {
3009
- this.close();
3010
- this.search.width(10);
3011
- } else {
3012
- if (this.countSelectableResults()>0) {
3013
- this.search.width(10);
3014
- this.resizeSearch();
3015
- if (this.getMaximumSelectionSize() > 0 && this.val().length >= this.getMaximumSelectionSize()) {
3016
- // if we reached max selection size repaint the results so choices
3017
- // are replaced with the max selection reached message
3018
- this.updateResults(true);
3019
- } else {
3020
- // initializes search's value with nextSearchTerm and update search result
3021
- if(this.nextSearchTerm != undefined){
3022
- this.search.val(this.nextSearchTerm);
3023
- this.updateResults();
3024
- this.search.select();
3025
- }
3026
- }
3027
- this.positionDropdown();
3028
- } else {
3029
- // if nothing left to select close
3030
- this.close();
3031
- this.search.width(10);
3032
- }
3033
- }
3034
-
3035
- // since its not possible to select an element that has already been
3036
- // added we do not need to check if this is a new element before firing change
3037
- this.triggerChange({ added: data });
3038
-
3039
- if (!options || !options.noFocus)
3040
- this.focusSearch();
3041
- },
3042
-
3043
- // multi
3044
- cancel: function () {
3045
- this.close();
3046
- this.focusSearch();
3047
- },
3048
-
3049
- addSelectedChoice: function (data) {
3050
- var enableChoice = !data.locked,
3051
- enabledItem = $(
3052
- "<li class='select2-search-choice'>" +
3053
- " <div></div>" +
3054
- " <a href='#' class='select2-search-choice-close' tabindex='-1'></a>" +
3055
- "</li>"),
3056
- disabledItem = $(
3057
- "<li class='select2-search-choice select2-locked'>" +
3058
- "<div></div>" +
3059
- "</li>");
3060
- var choice = enableChoice ? enabledItem : disabledItem,
3061
- id = this.id(data),
3062
- val = this.getVal(),
3063
- formatted,
3064
- cssClass;
3065
-
3066
- formatted=this.opts.formatSelection(data, choice.find("div"), this.opts.escapeMarkup);
3067
- if (formatted != undefined) {
3068
- choice.find("div").replaceWith($("<div></div>").html(formatted));
3069
- }
3070
- cssClass=this.opts.formatSelectionCssClass(data, choice.find("div"));
3071
- if (cssClass != undefined) {
3072
- choice.addClass(cssClass);
3073
- }
3074
-
3075
- if(enableChoice){
3076
- choice.find(".select2-search-choice-close")
3077
- .on("mousedown", killEvent)
3078
- .on("click dblclick", this.bind(function (e) {
3079
- if (!this.isInterfaceEnabled()) return;
3080
-
3081
- this.unselect($(e.target));
3082
- this.selection.find(".select2-search-choice-focus").removeClass("select2-search-choice-focus");
3083
- killEvent(e);
3084
- this.close();
3085
- this.focusSearch();
3086
- })).on("focus", this.bind(function () {
3087
- if (!this.isInterfaceEnabled()) return;
3088
- this.container.addClass("select2-container-active");
3089
- this.dropdown.addClass("select2-drop-active");
3090
- }));
3091
- }
3092
-
3093
- choice.data("select2-data", data);
3094
- choice.insertBefore(this.searchContainer);
3095
-
3096
- val.push(id);
3097
- this.setVal(val);
3098
- },
3099
-
3100
- // multi
3101
- unselect: function (selected) {
3102
- var val = this.getVal(),
3103
- data,
3104
- index;
3105
- selected = selected.closest(".select2-search-choice");
3106
-
3107
- if (selected.length === 0) {
3108
- throw "Invalid argument: " + selected + ". Must be .select2-search-choice";
3109
- }
3110
-
3111
- data = selected.data("select2-data");
3112
-
3113
- if (!data) {
3114
- // prevent a race condition when the 'x' is clicked really fast repeatedly the event can be queued
3115
- // and invoked on an element already removed
3116
- return;
3117
- }
3118
-
3119
- var evt = $.Event("select2-removing");
3120
- evt.val = this.id(data);
3121
- evt.choice = data;
3122
- this.opts.element.trigger(evt);
3123
-
3124
- if (evt.isDefaultPrevented()) {
3125
- return false;
3126
- }
3127
-
3128
- while((index = indexOf(this.id(data), val)) >= 0) {
3129
- val.splice(index, 1);
3130
- this.setVal(val);
3131
- if (this.select) this.postprocessResults();
3132
- }
3133
-
3134
- selected.remove();
3135
-
3136
- this.opts.element.trigger({ type: "select2-removed", val: this.id(data), choice: data });
3137
- this.triggerChange({ removed: data });
3138
-
3139
- return true;
3140
- },
3141
-
3142
- // multi
3143
- postprocessResults: function (data, initial, noHighlightUpdate) {
3144
- var val = this.getVal(),
3145
- choices = this.results.find(".select2-result"),
3146
- compound = this.results.find(".select2-result-with-children"),
3147
- self = this;
3148
-
3149
- choices.each2(function (i, choice) {
3150
- var id = self.id(choice.data("select2-data"));
3151
- if (indexOf(id, val) >= 0) {
3152
- choice.addClass("select2-selected");
3153
- // mark all children of the selected parent as selected
3154
- choice.find(".select2-result-selectable").addClass("select2-selected");
3155
- }
3156
- });
3157
-
3158
- compound.each2(function(i, choice) {
3159
- // hide an optgroup if it doesn't have any selectable children
3160
- if (!choice.is('.select2-result-selectable')
3161
- && choice.find(".select2-result-selectable:not(.select2-selected)").length === 0) {
3162
- choice.addClass("select2-selected");
3163
- }
3164
- });
3165
-
3166
- if (this.highlight() == -1 && noHighlightUpdate !== false && this.opts.closeOnSelect === true){
3167
- self.highlight(0);
3168
- }
3169
-
3170
- //If all results are chosen render formatNoMatches
3171
- if(!this.opts.createSearchChoice && !choices.filter('.select2-result:not(.select2-selected)').length > 0){
3172
- if(!data || data && !data.more && this.results.find(".select2-no-results").length === 0) {
3173
- if (checkFormatter(self.opts.formatNoMatches, "formatNoMatches")) {
3174
- this.results.append("<li class='select2-no-results'>" + evaluate(self.opts.formatNoMatches, self.opts.element, self.search.val()) + "</li>");
3175
- }
3176
- }
3177
- }
3178
-
3179
- },
3180
-
3181
- // multi
3182
- getMaxSearchWidth: function() {
3183
- return this.selection.width() - getSideBorderPadding(this.search);
3184
- },
3185
-
3186
- // multi
3187
- resizeSearch: function () {
3188
- var minimumWidth, left, maxWidth, containerLeft, searchWidth,
3189
- sideBorderPadding = getSideBorderPadding(this.search);
3190
-
3191
- minimumWidth = measureTextWidth(this.search) + 10;
3192
-
3193
- left = this.search.offset().left;
3194
-
3195
- maxWidth = this.selection.width();
3196
- containerLeft = this.selection.offset().left;
3197
-
3198
- searchWidth = maxWidth - (left - containerLeft) - sideBorderPadding;
3199
-
3200
- if (searchWidth < minimumWidth) {
3201
- searchWidth = maxWidth - sideBorderPadding;
3202
- }
3203
-
3204
- if (searchWidth < 40) {
3205
- searchWidth = maxWidth - sideBorderPadding;
3206
- }
3207
-
3208
- if (searchWidth <= 0) {
3209
- searchWidth = minimumWidth;
3210
- }
3211
-
3212
- this.search.width(Math.floor(searchWidth));
3213
- },
3214
-
3215
- // multi
3216
- getVal: function () {
3217
- var val;
3218
- if (this.select) {
3219
- val = this.select.val();
3220
- return val === null ? [] : val;
3221
- } else {
3222
- val = this.opts.element.val();
3223
- return splitVal(val, this.opts.separator, this.opts.transformVal);
3224
- }
3225
- },
3226
-
3227
- // multi
3228
- setVal: function (val) {
3229
- var unique;
3230
- if (this.select) {
3231
- this.select.val(val);
3232
- } else {
3233
- unique = [];
3234
- // filter out duplicates
3235
- $(val).each(function () {
3236
- if (indexOf(this, unique) < 0) unique.push(this);
3237
- });
3238
- this.opts.element.val(unique.length === 0 ? "" : unique.join(this.opts.separator));
3239
- }
3240
- },
3241
-
3242
- // multi
3243
- buildChangeDetails: function (old, current) {
3244
- var current = current.slice(0),
3245
- old = old.slice(0);
3246
-
3247
- // remove intersection from each array
3248
- for (var i = 0; i < current.length; i++) {
3249
- for (var j = 0; j < old.length; j++) {
3250
- if (equal(this.opts.id(current[i]), this.opts.id(old[j]))) {
3251
- current.splice(i, 1);
3252
- if(i>0){
3253
- i--;
3254
- }
3255
- old.splice(j, 1);
3256
- j--;
3257
- }
3258
- }
3259
- }
3260
-
3261
- return {added: current, removed: old};
3262
- },
3263
-
3264
-
3265
- // multi
3266
- val: function (val, triggerChange) {
3267
- var oldData, self=this;
3268
-
3269
- if (arguments.length === 0) {
3270
- return this.getVal();
3271
- }
3272
-
3273
- oldData=this.data();
3274
- if (!oldData.length) oldData=[];
3275
-
3276
- // val is an id. !val is true for [undefined,null,'',0] - 0 is legal
3277
- if (!val && val !== 0) {
3278
- this.opts.element.val("");
3279
- this.updateSelection([]);
3280
- this.clearSearch();
3281
- if (triggerChange) {
3282
- this.triggerChange({added: this.data(), removed: oldData});
3283
- }
3284
- return;
3285
- }
3286
-
3287
- // val is a list of ids
3288
- this.setVal(val);
3289
-
3290
- if (this.select) {
3291
- this.opts.initSelection(this.select, this.bind(this.updateSelection));
3292
- if (triggerChange) {
3293
- this.triggerChange(this.buildChangeDetails(oldData, this.data()));
3294
- }
3295
- } else {
3296
- if (this.opts.initSelection === undefined) {
3297
- throw new Error("val() cannot be called if initSelection() is not defined");
3298
- }
3299
-
3300
- this.opts.initSelection(this.opts.element, function(data){
3301
- var ids=$.map(data, self.id);
3302
- self.setVal(ids);
3303
- self.updateSelection(data);
3304
- self.clearSearch();
3305
- if (triggerChange) {
3306
- self.triggerChange(self.buildChangeDetails(oldData, self.data()));
3307
- }
3308
- });
3309
- }
3310
- this.clearSearch();
3311
- },
3312
-
3313
- // multi
3314
- onSortStart: function() {
3315
- if (this.select) {
3316
- throw new Error("Sorting of elements is not supported when attached to <select>. Attach to <input type='hidden'/> instead.");
3317
- }
3318
-
3319
- // collapse search field into 0 width so its container can be collapsed as well
3320
- this.search.width(0);
3321
- // hide the container
3322
- this.searchContainer.hide();
3323
- },
3324
-
3325
- // multi
3326
- onSortEnd:function() {
3327
-
3328
- var val=[], self=this;
3329
-
3330
- // show search and move it to the end of the list
3331
- this.searchContainer.show();
3332
- // make sure the search container is the last item in the list
3333
- this.searchContainer.appendTo(this.searchContainer.parent());
3334
- // since we collapsed the width in dragStarted, we resize it here
3335
- this.resizeSearch();
3336
-
3337
- // update selection
3338
- this.selection.find(".select2-search-choice").each(function() {
3339
- val.push(self.opts.id($(this).data("select2-data")));
3340
- });
3341
- this.setVal(val);
3342
- this.triggerChange();
3343
- },
3344
-
3345
- // multi
3346
- data: function(values, triggerChange) {
3347
- var self=this, ids, old;
3348
- if (arguments.length === 0) {
3349
- return this.selection
3350
- .children(".select2-search-choice")
3351
- .map(function() { return $(this).data("select2-data"); })
3352
- .get();
3353
- } else {
3354
- old = this.data();
3355
- if (!values) { values = []; }
3356
- ids = $.map(values, function(e) { return self.opts.id(e); });
3357
- this.setVal(ids);
3358
- this.updateSelection(values);
3359
- this.clearSearch();
3360
- if (triggerChange) {
3361
- this.triggerChange(this.buildChangeDetails(old, this.data()));
3362
- }
3363
- }
3364
- }
3365
- });
3366
-
3367
- $.fn.select2 = function () {
3368
-
3369
- var args = Array.prototype.slice.call(arguments, 0),
3370
- opts,
3371
- select2,
3372
- method, value, multiple,
3373
- allowedMethods = ["val", "destroy", "opened", "open", "close", "focus", "isFocused", "container", "dropdown", "onSortStart", "onSortEnd", "enable", "disable", "readonly", "positionDropdown", "data", "search"],
3374
- valueMethods = ["opened", "isFocused", "container", "dropdown"],
3375
- propertyMethods = ["val", "data"],
3376
- methodsMap = { search: "externalSearch" };
3377
-
3378
- this.each(function () {
3379
- if (args.length === 0 || typeof(args[0]) === "object") {
3380
- opts = args.length === 0 ? {} : $.extend({}, args[0]);
3381
- opts.element = $(this);
3382
-
3383
- if (opts.element.get(0).tagName.toLowerCase() === "select") {
3384
- multiple = opts.element.prop("multiple");
3385
- } else {
3386
- multiple = opts.multiple || false;
3387
- if ("tags" in opts) {opts.multiple = multiple = true;}
3388
- }
3389
-
3390
- select2 = multiple ? new window.Select2["class"].multi() : new window.Select2["class"].single();
3391
- select2.init(opts);
3392
- } else if (typeof(args[0]) === "string") {
3393
-
3394
- if (indexOf(args[0], allowedMethods) < 0) {
3395
- throw "Unknown method: " + args[0];
3396
- }
3397
-
3398
- value = undefined;
3399
- select2 = $(this).data("select2");
3400
- if (select2 === undefined) return;
3401
-
3402
- method=args[0];
3403
-
3404
- if (method === "container") {
3405
- value = select2.container;
3406
- } else if (method === "dropdown") {
3407
- value = select2.dropdown;
3408
- } else {
3409
- if (methodsMap[method]) method = methodsMap[method];
3410
-
3411
- value = select2[method].apply(select2, args.slice(1));
3412
- }
3413
- if (indexOf(args[0], valueMethods) >= 0
3414
- || (indexOf(args[0], propertyMethods) >= 0 && args.length == 1)) {
3415
- return false; // abort the iteration, ready to return first matched value
3416
- }
3417
- } else {
3418
- throw "Invalid arguments to select2 plugin: " + args;
3419
- }
3420
- });
3421
- return (value === undefined) ? this : value;
3422
- };
3423
-
3424
- // plugin defaults, accessible to users
3425
- $.fn.select2.defaults = {
3426
- width: "copy",
3427
- loadMorePadding: 0,
3428
- closeOnSelect: true,
3429
- openOnEnter: true,
3430
- containerCss: {},
3431
- dropdownCss: {},
3432
- containerCssClass: "",
3433
- dropdownCssClass: "",
3434
- formatResult: function(result, container, query, escapeMarkup) {
3435
- var markup=[];
3436
- markMatch(this.text(result), query.term, markup, escapeMarkup);
3437
- return markup.join("");
3438
- },
3439
- transformVal: function(val) {
3440
- return $.trim(val);
3441
- },
3442
- formatSelection: function (data, container, escapeMarkup) {
3443
- return data ? escapeMarkup(this.text(data)) : undefined;
3444
- },
3445
- sortResults: function (results, container, query) {
3446
- return results;
3447
- },
3448
- formatResultCssClass: function(data) {return data.css;},
3449
- formatSelectionCssClass: function(data, container) {return undefined;},
3450
- minimumResultsForSearch: 0,
3451
- minimumInputLength: 0,
3452
- maximumInputLength: null,
3453
- maximumSelectionSize: 0,
3454
- id: function (e) { return e == undefined ? null : e.id; },
3455
- text: function (e) {
3456
- if (e && this.data && this.data.text) {
3457
- if ($.isFunction(this.data.text)) {
3458
- return this.data.text(e);
3459
- } else {
3460
- return e[this.data.text];
3461
- }
3462
- } else {
3463
- return e.text;
3464
- }
3465
- },
3466
- matcher: function(term, text) {
3467
- return stripDiacritics(''+text).toUpperCase().indexOf(stripDiacritics(''+term).toUpperCase()) >= 0;
3468
- },
3469
- separator: ",",
3470
- tokenSeparators: [],
3471
- tokenizer: defaultTokenizer,
3472
- escapeMarkup: defaultEscapeMarkup,
3473
- blurOnChange: false,
3474
- selectOnBlur: false,
3475
- adaptContainerCssClass: function(c) { return c; },
3476
- adaptDropdownCssClass: function(c) { return null; },
3477
- nextSearchTerm: function(selectedObject, currentSearchTerm) { return undefined; },
3478
- searchInputPlaceholder: '',
3479
- createSearchChoicePosition: 'top',
3480
- shouldFocusInput: function (instance) {
3481
- // Attempt to detect touch devices
3482
- var supportsTouchEvents = (('ontouchstart' in window) ||
3483
- (navigator.msMaxTouchPoints > 0));
3484
-
3485
- // Only devices which support touch events should be special cased
3486
- if (!supportsTouchEvents) {
3487
- return true;
3488
- }
3489
-
3490
- // Never focus the input if search is disabled
3491
- if (instance.opts.minimumResultsForSearch < 0) {
3492
- return false;
3493
- }
3494
-
3495
- return true;
3496
- }
3497
- };
3498
-
3499
- $.fn.select2.locales = [];
3500
-
3501
- $.fn.select2.locales['en'] = {
3502
- formatMatches: function (matches) { if (matches === 1) { return "One result is available, press enter to select it."; } return matches + " results are available, use up and down arrow keys to navigate."; },
3503
- formatNoMatches: function () { return "No matches found"; },
3504
- formatAjaxError: function (jqXHR, textStatus, errorThrown) { return "Loading failed"; },
3505
- formatInputTooShort: function (input, min) { var n = min - input.length; return "Please enter " + n + " or more character" + (n == 1 ? "" : "s"); },
3506
- formatInputTooLong: function (input, max) { var n = input.length - max; return "Please delete " + n + " character" + (n == 1 ? "" : "s"); },
3507
- formatSelectionTooBig: function (limit) { return "You can only select " + limit + " item" + (limit == 1 ? "" : "s"); },
3508
- formatLoadMore: function (pageNumber) { return "Loading more results…"; },
3509
- formatSearching: function () { return "Searching…"; }
3510
- };
3511
-
3512
- $.extend($.fn.select2.defaults, $.fn.select2.locales['en']);
3513
-
3514
- $.fn.select2.ajaxDefaults = {
3515
- transport: $.ajax,
3516
- params: {
3517
- type: "GET",
3518
- cache: false,
3519
- dataType: "json"
3520
- }
3521
- };
3522
-
3523
- // exports
3524
- window.Select2 = {
3525
- query: {
3526
- ajax: ajax,
3527
- local: local,
3528
- tags: tags
3529
- }, util: {
3530
- debounce: debounce,
3531
- markMatch: markMatch,
3532
- escapeMarkup: defaultEscapeMarkup,
3533
- stripDiacritics: stripDiacritics
3534
- }, "class": {
3535
- "abstract": AbstractSelect2,
3536
- "single": SingleSelect2,
3537
- "multi": MultiSelect2
3538
- }
3539
- };
3540
-
3541
- }(jQuery));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/classes/admin/settings/assets/js/select2/select2.min.js DELETED
@@ -1,23 +0,0 @@
1
- /*
2
- Copyright 2014 Igor Vaynberg
3
-
4
- Version: 3.5.2 Timestamp: Sat Nov 1 14:43:36 EDT 2014
5
-
6
- This software is licensed under the Apache License, Version 2.0 (the "Apache License") or the GNU
7
- General Public License version 2 (the "GPL License"). You may choose either license to govern your
8
- use of this software only upon the condition that you accept all of the terms of either the Apache
9
- License or the GPL License.
10
-
11
- You may obtain a copy of the Apache License and the GPL License at:
12
-
13
- http://www.apache.org/licenses/LICENSE-2.0
14
- http://www.gnu.org/licenses/gpl-2.0.html
15
-
16
- Unless required by applicable law or agreed to in writing, software distributed under the Apache License
17
- or the GPL Licesnse is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
18
- either express or implied. See the Apache License and the GPL License for the specific language governing
19
- permissions and limitations under the Apache License and the GPL License.
20
- */
21
- !function(a){"undefined"==typeof a.fn.each2&&a.extend(a.fn,{each2:function(b){for(var c=a([0]),d=-1,e=this.length;++d<e&&(c.context=c[0]=this[d])&&b.call(c[0],d,c)!==!1;);return this}})}(jQuery),function(a,b){"use strict";function n(b){var c=a(document.createTextNode(""));b.before(c),c.before(b),c.remove()}function o(a){function b(a){return m[a]||a}return a.replace(/[^\u0000-\u007E]/g,b)}function p(a,b){for(var c=0,d=b.length;d>c;c+=1)if(r(a,b[c]))return c;return-1}function q(){var b=a(l);b.appendTo(document.body);var c={width:b.width()-b[0].clientWidth,height:b.height()-b[0].clientHeight};return b.remove(),c}function r(a,c){return a===c?!0:a===b||c===b?!1:null===a||null===c?!1:a.constructor===String?a+""==c+"":c.constructor===String?c+""==a+"":!1}function s(a,b,c){var d,e,f;if(null===a||a.length<1)return[];for(d=a.split(b),e=0,f=d.length;f>e;e+=1)d[e]=c(d[e]);return d}function t(a){return a.outerWidth(!1)-a.width()}function u(c){var d="keyup-change-value";c.on("keydown",function(){a.data(c,d)===b&&a.data(c,d,c.val())}),c.on("keyup",function(){var e=a.data(c,d);e!==b&&c.val()!==e&&(a.removeData(c,d),c.trigger("keyup-change"))})}function v(c){c.on("mousemove",function(c){var d=h;(d===b||d.x!==c.pageX||d.y!==c.pageY)&&a(c.target).trigger("mousemove-filtered",c)})}function w(a,c,d){d=d||b;var e;return function(){var b=arguments;window.clearTimeout(e),e=window.setTimeout(function(){c.apply(d,b)},a)}}function x(a,b){var c=w(a,function(a){b.trigger("scroll-debounced",a)});b.on("scroll",function(a){p(a.target,b.get())>=0&&c(a)})}function y(a){a[0]!==document.activeElement&&window.setTimeout(function(){var d,b=a[0],c=a.val().length;a.focus();var e=b.offsetWidth>0||b.offsetHeight>0;e&&b===document.activeElement&&(b.setSelectionRange?b.setSelectionRange(c,c):b.createTextRange&&(d=b.createTextRange(),d.collapse(!1),d.select()))},0)}function z(b){b=a(b)[0];var c=0,d=0;if("selectionStart"in b)c=b.selectionStart,d=b.selectionEnd-c;else if("selection"in document){b.focus();var e=document.selection.createRange();d=document.selection.createRange().text.length,e.moveStart("character",-b.value.length),c=e.text.length-d}return{offset:c,length:d}}function A(a){a.preventDefault(),a.stopPropagation()}function B(a){a.preventDefault(),a.stopImmediatePropagation()}function C(b){if(!g){var c=b[0].currentStyle||window.getComputedStyle(b[0],null);g=a(document.createElement("div")).css({position:"absolute",left:"-10000px",top:"-10000px",display:"none",fontSize:c.fontSize,fontFamily:c.fontFamily,fontStyle:c.fontStyle,fontWeight:c.fontWeight,letterSpacing:c.letterSpacing,textTransform:c.textTransform,whiteSpace:"nowrap"}),g.attr("class","select2-sizer"),a(document.body).append(g)}return g.text(b.val()),g.width()}function D(b,c,d){var e,g,f=[];e=a.trim(b.attr("class")),e&&(e=""+e,a(e.split(/\s+/)).each2(function(){0===this.indexOf("select2-")&&f.push(this)})),e=a.trim(c.attr("class")),e&&(e=""+e,a(e.split(/\s+/)).each2(function(){0!==this.indexOf("select2-")&&(g=d(this),g&&f.push(g))})),b.attr("class",f.join(" "))}function E(a,b,c,d){var e=o(a.toUpperCase()).indexOf(o(b.toUpperCase())),f=b.length;return 0>e?(c.push(d(a)),void 0):(c.push(d(a.substring(0,e))),c.push("<span class='select2-match'>"),c.push(d(a.substring(e,e+f))),c.push("</span>"),c.push(d(a.substring(e+f,a.length))),void 0)}function F(a){var b={"\\":"&#92;","&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#47;"};return String(a).replace(/[&<>"'\/\\]/g,function(a){return b[a]})}function G(c){var d,e=null,f=c.quietMillis||100,g=c.url,h=this;return function(i){window.clearTimeout(d),d=window.setTimeout(function(){var d=c.data,f=g,j=c.transport||a.fn.select2.ajaxDefaults.transport,k={type:c.type||"GET",cache:c.cache||!1,jsonpCallback:c.jsonpCallback||b,dataType:c.dataType||"json"},l=a.extend({},a.fn.select2.ajaxDefaults.params,k);d=d?d.call(h,i.term,i.page,i.context):null,f="function"==typeof f?f.call(h,i.term,i.page,i.context):f,e&&"function"==typeof e.abort&&e.abort(),c.params&&(a.isFunction(c.params)?a.extend(l,c.params.call(h)):a.extend(l,c.params)),a.extend(l,{url:f,dataType:c.dataType,data:d,success:function(a){var b=c.results(a,i.page,i);i.callback(b)},error:function(a,b,c){var d={hasError:!0,jqXHR:a,textStatus:b,errorThrown:c};i.callback(d)}}),e=j.call(h,l)},f)}}function H(b){var d,e,c=b,f=function(a){return""+a.text};a.isArray(c)&&(e=c,c={results:e}),a.isFunction(c)===!1&&(e=c,c=function(){return e});var g=c();return g.text&&(f=g.text,a.isFunction(f)||(d=g.text,f=function(a){return a[d]})),function(b){var g,d=b.term,e={results:[]};return""===d?(b.callback(c()),void 0):(g=function(c,e){var h,i;if(c=c[0],c.children){h={};for(i in c)c.hasOwnProperty(i)&&(h[i]=c[i]);h.children=[],a(c.children).each2(function(a,b){g(b,h.children)}),(h.children.length||b.matcher(d,f(h),c))&&e.push(h)}else b.matcher(d,f(c),c)&&e.push(c)},a(c().results).each2(function(a,b){g(b,e.results)}),b.callback(e),void 0)}}function I(c){var d=a.isFunction(c);return function(e){var f=e.term,g={results:[]},h=d?c(e):c;a.isArray(h)&&(a(h).each(function(){var a=this.text!==b,c=a?this.text:this;(""===f||e.matcher(f,c))&&g.results.push(a?this:{id:this,text:this})}),e.callback(g))}}function J(b,c){if(a.isFunction(b))return!0;if(!b)return!1;if("string"==typeof b)return!0;throw new Error(c+" must be a string, function, or falsy value")}function K(b,c){if(a.isFunction(b)){var d=Array.prototype.slice.call(arguments,2);return b.apply(c,d)}return b}function L(b){var c=0;return a.each(b,function(a,b){b.children?c+=L(b.children):c++}),c}function M(a,c,d,e){var h,i,j,k,l,f=a,g=!1;if(!e.createSearchChoice||!e.tokenSeparators||e.tokenSeparators.length<1)return b;for(;;){for(i=-1,j=0,k=e.tokenSeparators.length;k>j&&(l=e.tokenSeparators[j],i=a.indexOf(l),!(i>=0));j++);if(0>i)break;if(h=a.substring(0,i),a=a.substring(i+l.length),h.length>0&&(h=e.createSearchChoice.call(this,h,c),h!==b&&null!==h&&e.id(h)!==b&&null!==e.id(h))){for(g=!1,j=0,k=c.length;k>j;j++)if(r(e.id(h),e.id(c[j]))){g=!0;break}g||d(h)}}return f!==a?a:void 0}function N(){var b=this;a.each(arguments,function(a,c){b[c].remove(),b[c]=null})}function O(b,c){var d=function(){};return d.prototype=new b,d.prototype.constructor=d,d.prototype.parent=b.prototype,d.prototype=a.extend(d.prototype,c),d}if(window.Select2===b){var c,d,e,f,g,i,j,h={x:0,y:0},k={TAB:9,ENTER:13,ESC:27,SPACE:32,LEFT:37,UP:38,RIGHT:39,DOWN:40,SHIFT:16,CTRL:17,ALT:18,PAGE_UP:33,PAGE_DOWN:34,HOME:36,END:35,BACKSPACE:8,DELETE:46,isArrow:function(a){switch(a=a.which?a.which:a){case k.LEFT:case k.RIGHT:case k.UP:case k.DOWN:return!0}return!1},isControl:function(a){var b=a.which;switch(b){case k.SHIFT:case k.CTRL:case k.ALT:return!0}return a.metaKey?!0:!1},isFunctionKey:function(a){return a=a.which?a.which:a,a>=112&&123>=a}},l="<div class='select2-measure-scrollbar'></div>",m={"\u24b6":"A","\uff21":"A","\xc0":"A","\xc1":"A","\xc2":"A","\u1ea6":"A","\u1ea4":"A","\u1eaa":"A","\u1ea8":"A","\xc3":"A","\u0100":"A","\u0102":"A","\u1eb0":"A","\u1eae":"A","\u1eb4":"A","\u1eb2":"A","\u0226":"A","\u01e0":"A","\xc4":"A","\u01de":"A","\u1ea2":"A","\xc5":"A","\u01fa":"A","\u01cd":"A","\u0200":"A","\u0202":"A","\u1ea0":"A","\u1eac":"A","\u1eb6":"A","\u1e00":"A","\u0104":"A","\u023a":"A","\u2c6f":"A","\ua732":"AA","\xc6":"AE","\u01fc":"AE","\u01e2":"AE","\ua734":"AO","\ua736":"AU","\ua738":"AV","\ua73a":"AV","\ua73c":"AY","\u24b7":"B","\uff22":"B","\u1e02":"B","\u1e04":"B","\u1e06":"B","\u0243":"B","\u0182":"B","\u0181":"B","\u24b8":"C","\uff23":"C","\u0106":"C","\u0108":"C","\u010a":"C","\u010c":"C","\xc7":"C","\u1e08":"C","\u0187":"C","\u023b":"C","\ua73e":"C","\u24b9":"D","\uff24":"D","\u1e0a":"D","\u010e":"D","\u1e0c":"D","\u1e10":"D","\u1e12":"D","\u1e0e":"D","\u0110":"D","\u018b":"D","\u018a":"D","\u0189":"D","\ua779":"D","\u01f1":"DZ","\u01c4":"DZ","\u01f2":"Dz","\u01c5":"Dz","\u24ba":"E","\uff25":"E","\xc8":"E","\xc9":"E","\xca":"E","\u1ec0":"E","\u1ebe":"E","\u1ec4":"E","\u1ec2":"E","\u1ebc":"E","\u0112":"E","\u1e14":"E","\u1e16":"E","\u0114":"E","\u0116":"E","\xcb":"E","\u1eba":"E","\u011a":"E","\u0204":"E","\u0206":"E","\u1eb8":"E","\u1ec6":"E","\u0228":"E","\u1e1c":"E","\u0118":"E","\u1e18":"E","\u1e1a":"E","\u0190":"E","\u018e":"E","\u24bb":"F","\uff26":"F","\u1e1e":"F","\u0191":"F","\ua77b":"F","\u24bc":"G","\uff27":"G","\u01f4":"G","\u011c":"G","\u1e20":"G","\u011e":"G","\u0120":"G","\u01e6":"G","\u0122":"G","\u01e4":"G","\u0193":"G","\ua7a0":"G","\ua77d":"G","\ua77e":"G","\u24bd":"H","\uff28":"H","\u0124":"H","\u1e22":"H","\u1e26":"H","\u021e":"H","\u1e24":"H","\u1e28":"H","\u1e2a":"H","\u0126":"H","\u2c67":"H","\u2c75":"H","\ua78d":"H","\u24be":"I","\uff29":"I","\xcc":"I","\xcd":"I","\xce":"I","\u0128":"I","\u012a":"I","\u012c":"I","\u0130":"I","\xcf":"I","\u1e2e":"I","\u1ec8":"I","\u01cf":"I","\u0208":"I","\u020a":"I","\u1eca":"I","\u012e":"I","\u1e2c":"I","\u0197":"I","\u24bf":"J","\uff2a":"J","\u0134":"J","\u0248":"J","\u24c0":"K","\uff2b":"K","\u1e30":"K","\u01e8":"K","\u1e32":"K","\u0136":"K","\u1e34":"K","\u0198":"K","\u2c69":"K","\ua740":"K","\ua742":"K","\ua744":"K","\ua7a2":"K","\u24c1":"L","\uff2c":"L","\u013f":"L","\u0139":"L","\u013d":"L","\u1e36":"L","\u1e38":"L","\u013b":"L","\u1e3c":"L","\u1e3a":"L","\u0141":"L","\u023d":"L","\u2c62":"L","\u2c60":"L","\ua748":"L","\ua746":"L","\ua780":"L","\u01c7":"LJ","\u01c8":"Lj","\u24c2":"M","\uff2d":"M","\u1e3e":"M","\u1e40":"M","\u1e42":"M","\u2c6e":"M","\u019c":"M","\u24c3":"N","\uff2e":"N","\u01f8":"N","\u0143":"N","\xd1":"N","\u1e44":"N","\u0147":"N","\u1e46":"N","\u0145":"N","\u1e4a":"N","\u1e48":"N","\u0220":"N","\u019d":"N","\ua790":"N","\ua7a4":"N","\u01ca":"NJ","\u01cb":"Nj","\u24c4":"O","\uff2f":"O","\xd2":"O","\xd3":"O","\xd4":"O","\u1ed2":"O","\u1ed0":"O","\u1ed6":"O","\u1ed4":"O","\xd5":"O","\u1e4c":"O","\u022c":"O","\u1e4e":"O","\u014c":"O","\u1e50":"O","\u1e52":"O","\u014e":"O","\u022e":"O","\u0230":"O","\xd6":"O","\u022a":"O","\u1ece":"O","\u0150":"O","\u01d1":"O","\u020c":"O","\u020e":"O","\u01a0":"O","\u1edc":"O","\u1eda":"O","\u1ee0":"O","\u1ede":"O","\u1ee2":"O","\u1ecc":"O","\u1ed8":"O","\u01ea":"O","\u01ec":"O","\xd8":"O","\u01fe":"O","\u0186":"O","\u019f":"O","\ua74a":"O","\ua74c":"O","\u01a2":"OI","\ua74e":"OO","\u0222":"OU","\u24c5":"P","\uff30":"P","\u1e54":"P","\u1e56":"P","\u01a4":"P","\u2c63":"P","\ua750":"P","\ua752":"P","\ua754":"P","\u24c6":"Q","\uff31":"Q","\ua756":"Q","\ua758":"Q","\u024a":"Q","\u24c7":"R","\uff32":"R","\u0154":"R","\u1e58":"R","\u0158":"R","\u0210":"R","\u0212":"R","\u1e5a":"R","\u1e5c":"R","\u0156":"R","\u1e5e":"R","\u024c":"R","\u2c64":"R","\ua75a":"R","\ua7a6":"R","\ua782":"R","\u24c8":"S","\uff33":"S","\u1e9e":"S","\u015a":"S","\u1e64":"S","\u015c":"S","\u1e60":"S","\u0160":"S","\u1e66":"S","\u1e62":"S","\u1e68":"S","\u0218":"S","\u015e":"S","\u2c7e":"S","\ua7a8":"S","\ua784":"S","\u24c9":"T","\uff34":"T","\u1e6a":"T","\u0164":"T","\u1e6c":"T","\u021a":"T","\u0162":"T","\u1e70":"T","\u1e6e":"T","\u0166":"T","\u01ac":"T","\u01ae":"T","\u023e":"T","\ua786":"T","\ua728":"TZ","\u24ca":"U","\uff35":"U","\xd9":"U","\xda":"U","\xdb":"U","\u0168":"U","\u1e78":"U","\u016a":"U","\u1e7a":"U","\u016c":"U","\xdc":"U","\u01db":"U","\u01d7":"U","\u01d5":"U","\u01d9":"U","\u1ee6":"U","\u016e":"U","\u0170":"U","\u01d3":"U","\u0214":"U","\u0216":"U","\u01af":"U","\u1eea":"U","\u1ee8":"U","\u1eee":"U","\u1eec":"U","\u1ef0":"U","\u1ee4":"U","\u1e72":"U","\u0172":"U","\u1e76":"U","\u1e74":"U","\u0244":"U","\u24cb":"V","\uff36":"V","\u1e7c":"V","\u1e7e":"V","\u01b2":"V","\ua75e":"V","\u0245":"V","\ua760":"VY","\u24cc":"W","\uff37":"W","\u1e80":"W","\u1e82":"W","\u0174":"W","\u1e86":"W","\u1e84":"W","\u1e88":"W","\u2c72":"W","\u24cd":"X","\uff38":"X","\u1e8a":"X","\u1e8c":"X","\u24ce":"Y","\uff39":"Y","\u1ef2":"Y","\xdd":"Y","\u0176":"Y","\u1ef8":"Y","\u0232":"Y","\u1e8e":"Y","\u0178":"Y","\u1ef6":"Y","\u1ef4":"Y","\u01b3":"Y","\u024e":"Y","\u1efe":"Y","\u24cf":"Z","\uff3a":"Z","\u0179":"Z","\u1e90":"Z","\u017b":"Z","\u017d":"Z","\u1e92":"Z","\u1e94":"Z","\u01b5":"Z","\u0224":"Z","\u2c7f":"Z","\u2c6b":"Z","\ua762":"Z","\u24d0":"a","\uff41":"a","\u1e9a":"a","\xe0":"a","\xe1":"a","\xe2":"a","\u1ea7":"a","\u1ea5":"a","\u1eab":"a","\u1ea9":"a","\xe3":"a","\u0101":"a","\u0103":"a","\u1eb1":"a","\u1eaf":"a","\u1eb5":"a","\u1eb3":"a","\u0227":"a","\u01e1":"a","\xe4":"a","\u01df":"a","\u1ea3":"a","\xe5":"a","\u01fb":"a","\u01ce":"a","\u0201":"a","\u0203":"a","\u1ea1":"a","\u1ead":"a","\u1eb7":"a","\u1e01":"a","\u0105":"a","\u2c65":"a","\u0250":"a","\ua733":"aa","\xe6":"ae","\u01fd":"ae","\u01e3":"ae","\ua735":"ao","\ua737":"au","\ua739":"av","\ua73b":"av","\ua73d":"ay","\u24d1":"b","\uff42":"b","\u1e03":"b","\u1e05":"b","\u1e07":"b","\u0180":"b","\u0183":"b","\u0253":"b","\u24d2":"c","\uff43":"c","\u0107":"c","\u0109":"c","\u010b":"c","\u010d":"c","\xe7":"c","\u1e09":"c","\u0188":"c","\u023c":"c","\ua73f":"c","\u2184":"c","\u24d3":"d","\uff44":"d","\u1e0b":"d","\u010f":"d","\u1e0d":"d","\u1e11":"d","\u1e13":"d","\u1e0f":"d","\u0111":"d","\u018c":"d","\u0256":"d","\u0257":"d","\ua77a":"d","\u01f3":"dz","\u01c6":"dz","\u24d4":"e","\uff45":"e","\xe8":"e","\xe9":"e","\xea":"e","\u1ec1":"e","\u1ebf":"e","\u1ec5":"e","\u1ec3":"e","\u1ebd":"e","\u0113":"e","\u1e15":"e","\u1e17":"e","\u0115":"e","\u0117":"e","\xeb":"e","\u1ebb":"e","\u011b":"e","\u0205":"e","\u0207":"e","\u1eb9":"e","\u1ec7":"e","\u0229":"e","\u1e1d":"e","\u0119":"e","\u1e19":"e","\u1e1b":"e","\u0247":"e","\u025b":"e","\u01dd":"e","\u24d5":"f","\uff46":"f","\u1e1f":"f","\u0192":"f","\ua77c":"f","\u24d6":"g","\uff47":"g","\u01f5":"g","\u011d":"g","\u1e21":"g","\u011f":"g","\u0121":"g","\u01e7":"g","\u0123":"g","\u01e5":"g","\u0260":"g","\ua7a1":"g","\u1d79":"g","\ua77f":"g","\u24d7":"h","\uff48":"h","\u0125":"h","\u1e23":"h","\u1e27":"h","\u021f":"h","\u1e25":"h","\u1e29":"h","\u1e2b":"h","\u1e96":"h","\u0127":"h","\u2c68":"h","\u2c76":"h","\u0265":"h","\u0195":"hv","\u24d8":"i","\uff49":"i","\xec":"i","\xed":"i","\xee":"i","\u0129":"i","\u012b":"i","\u012d":"i","\xef":"i","\u1e2f":"i","\u1ec9":"i","\u01d0":"i","\u0209":"i","\u020b":"i","\u1ecb":"i","\u012f":"i","\u1e2d":"i","\u0268":"i","\u0131":"i","\u24d9":"j","\uff4a":"j","\u0135":"j","\u01f0":"j","\u0249":"j","\u24da":"k","\uff4b":"k","\u1e31":"k","\u01e9":"k","\u1e33":"k","\u0137":"k","\u1e35":"k","\u0199":"k","\u2c6a":"k","\ua741":"k","\ua743":"k","\ua745":"k","\ua7a3":"k","\u24db":"l","\uff4c":"l","\u0140":"l","\u013a":"l","\u013e":"l","\u1e37":"l","\u1e39":"l","\u013c":"l","\u1e3d":"l","\u1e3b":"l","\u017f":"l","\u0142":"l","\u019a":"l","\u026b":"l","\u2c61":"l","\ua749":"l","\ua781":"l","\ua747":"l","\u01c9":"lj","\u24dc":"m","\uff4d":"m","\u1e3f":"m","\u1e41":"m","\u1e43":"m","\u0271":"m","\u026f":"m","\u24dd":"n","\uff4e":"n","\u01f9":"n","\u0144":"n","\xf1":"n","\u1e45":"n","\u0148":"n","\u1e47":"n","\u0146":"n","\u1e4b":"n","\u1e49":"n","\u019e":"n","\u0272":"n","\u0149":"n","\ua791":"n","\ua7a5":"n","\u01cc":"nj","\u24de":"o","\uff4f":"o","\xf2":"o","\xf3":"o","\xf4":"o","\u1ed3":"o","\u1ed1":"o","\u1ed7":"o","\u1ed5":"o","\xf5":"o","\u1e4d":"o","\u022d":"o","\u1e4f":"o","\u014d":"o","\u1e51":"o","\u1e53":"o","\u014f":"o","\u022f":"o","\u0231":"o","\xf6":"o","\u022b":"o","\u1ecf":"o","\u0151":"o","\u01d2":"o","\u020d":"o","\u020f":"o","\u01a1":"o","\u1edd":"o","\u1edb":"o","\u1ee1":"o","\u1edf":"o","\u1ee3":"o","\u1ecd":"o","\u1ed9":"o","\u01eb":"o","\u01ed":"o","\xf8":"o","\u01ff":"o","\u0254":"o","\ua74b":"o","\ua74d":"o","\u0275":"o","\u01a3":"oi","\u0223":"ou","\ua74f":"oo","\u24df":"p","\uff50":"p","\u1e55":"p","\u1e57":"p","\u01a5":"p","\u1d7d":"p","\ua751":"p","\ua753":"p","\ua755":"p","\u24e0":"q","\uff51":"q","\u024b":"q","\ua757":"q","\ua759":"q","\u24e1":"r","\uff52":"r","\u0155":"r","\u1e59":"r","\u0159":"r","\u0211":"r","\u0213":"r","\u1e5b":"r","\u1e5d":"r","\u0157":"r","\u1e5f":"r","\u024d":"r","\u027d":"r","\ua75b":"r","\ua7a7":"r","\ua783":"r","\u24e2":"s","\uff53":"s","\xdf":"s","\u015b":"s","\u1e65":"s","\u015d":"s","\u1e61":"s","\u0161":"s","\u1e67":"s","\u1e63":"s","\u1e69":"s","\u0219":"s","\u015f":"s","\u023f":"s","\ua7a9":"s","\ua785":"s","\u1e9b":"s","\u24e3":"t","\uff54":"t","\u1e6b":"t","\u1e97":"t","\u0165":"t","\u1e6d":"t","\u021b":"t","\u0163":"t","\u1e71":"t","\u1e6f":"t","\u0167":"t","\u01ad":"t","\u0288":"t","\u2c66":"t","\ua787":"t","\ua729":"tz","\u24e4":"u","\uff55":"u","\xf9":"u","\xfa":"u","\xfb":"u","\u0169":"u","\u1e79":"u","\u016b":"u","\u1e7b":"u","\u016d":"u","\xfc":"u","\u01dc":"u","\u01d8":"u","\u01d6":"u","\u01da":"u","\u1ee7":"u","\u016f":"u","\u0171":"u","\u01d4":"u","\u0215":"u","\u0217":"u","\u01b0":"u","\u1eeb":"u","\u1ee9":"u","\u1eef":"u","\u1eed":"u","\u1ef1":"u","\u1ee5":"u","\u1e73":"u","\u0173":"u","\u1e77":"u","\u1e75":"u","\u0289":"u","\u24e5":"v","\uff56":"v","\u1e7d":"v","\u1e7f":"v","\u028b":"v","\ua75f":"v","\u028c":"v","\ua761":"vy","\u24e6":"w","\uff57":"w","\u1e81":"w","\u1e83":"w","\u0175":"w","\u1e87":"w","\u1e85":"w","\u1e98":"w","\u1e89":"w","\u2c73":"w","\u24e7":"x","\uff58":"x","\u1e8b":"x","\u1e8d":"x","\u24e8":"y","\uff59":"y","\u1ef3":"y","\xfd":"y","\u0177":"y","\u1ef9":"y","\u0233":"y","\u1e8f":"y","\xff":"y","\u1ef7":"y","\u1e99":"y","\u1ef5":"y","\u01b4":"y","\u024f":"y","\u1eff":"y","\u24e9":"z","\uff5a":"z","\u017a":"z","\u1e91":"z","\u017c":"z","\u017e":"z","\u1e93":"z","\u1e95":"z","\u01b6":"z","\u0225":"z","\u0240":"z","\u2c6c":"z","\ua763":"z","\u0386":"\u0391","\u0388":"\u0395","\u0389":"\u0397","\u038a":"\u0399","\u03aa":"\u0399","\u038c":"\u039f","\u038e":"\u03a5","\u03ab":"\u03a5","\u038f":"\u03a9","\u03ac":"\u03b1","\u03ad":"\u03b5","\u03ae":"\u03b7","\u03af":"\u03b9","\u03ca":"\u03b9","\u0390":"\u03b9","\u03cc":"\u03bf","\u03cd":"\u03c5","\u03cb":"\u03c5","\u03b0":"\u03c5","\u03c9":"\u03c9","\u03c2":"\u03c3"};i=a(document),f=function(){var a=1;return function(){return a++}}(),c=O(Object,{bind:function(a){var b=this;return function(){a.apply(b,arguments)}},init:function(c){var d,e,g=".select2-results";this.opts=c=this.prepareOpts(c),this.id=c.id,c.element.data("select2")!==b&&null!==c.element.data("select2")&&c.element.data("select2").destroy(),this.container=this.createContainer(),this.liveRegion=a(".select2-hidden-accessible"),0==this.liveRegion.length&&(this.liveRegion=a("<span>",{role:"status","aria-live":"polite"}).addClass("select2-hidden-accessible").appendTo(document.body)),this.containerId="s2id_"+(c.element.attr("id")||"autogen"+f()),this.containerEventName=this.containerId.replace(/([.])/g,"_").replace(/([;&,\-\.\+\*\~':"\!\^#$%@\[\]\(\)=>\|])/g,"\\$1"),this.container.attr("id",this.containerId),this.container.attr("title",c.element.attr("title")),this.body=a(document.body),D(this.container,this.opts.element,this.opts.adaptContainerCssClass),this.container.attr("style",c.element.attr("style")),this.container.css(K(c.containerCss,this.opts.element)),this.container.addClass(K(c.containerCssClass,this.opts.element)),this.elementTabIndex=this.opts.element.attr("tabindex"),this.opts.element.data("select2",this).attr("tabindex","-1").before(this.container).on("click.select2",A),this.container.data("select2",this),this.dropdown=this.container.find(".select2-drop"),D(this.dropdown,this.opts.element,this.opts.adaptDropdownCssClass),this.dropdown.addClass(K(c.dropdownCssClass,this.opts.element)),this.dropdown.data("select2",this),this.dropdown.on("click",A),this.results=d=this.container.find(g),this.search=e=this.container.find("input.select2-input"),this.queryCount=0,this.resultsPage=0,this.context=null,this.initContainer(),this.container.on("click",A),v(this.results),this.dropdown.on("mousemove-filtered",g,this.bind(this.highlightUnderEvent)),this.dropdown.on("touchstart touchmove touchend",g,this.bind(function(a){this._touchEvent=!0,this.highlightUnderEvent(a)})),this.dropdown.on("touchmove",g,this.bind(this.touchMoved)),this.dropdown.on("touchstart touchend",g,this.bind(this.clearTouchMoved)),this.dropdown.on("click",this.bind(function(){this._touchEvent&&(this._touchEvent=!1,this.selectHighlighted())})),x(80,this.results),this.dropdown.on("scroll-debounced",g,this.bind(this.loadMoreIfNeeded)),a(this.container).on("change",".select2-input",function(a){a.stopPropagation()}),a(this.dropdown).on("change",".select2-input",function(a){a.stopPropagation()}),a.fn.mousewheel&&d.mousewheel(function(a,b,c,e){var f=d.scrollTop();e>0&&0>=f-e?(d.scrollTop(0),A(a)):0>e&&d.get(0).scrollHeight-d.scrollTop()+e<=d.height()&&(d.scrollTop(d.get(0).scrollHeight-d.height()),A(a))}),u(e),e.on("keyup-change input paste",this.bind(this.updateResults)),e.on("focus",function(){e.addClass("select2-focused")}),e.on("blur",function(){e.removeClass("select2-focused")}),this.dropdown.on("mouseup",g,this.bind(function(b){a(b.target).closest(".select2-result-selectable").length>0&&(this.highlightUnderEvent(b),this.selectHighlighted(b))})),this.dropdown.on("click mouseup mousedown touchstart touchend focusin",function(a){a.stopPropagation()}),this.nextSearchTerm=b,a.isFunction(this.opts.initSelection)&&(this.initSelection(),this.monitorSource()),null!==c.maximumInputLength&&this.search.attr("maxlength",c.maximumInputLength);var h=c.element.prop("disabled");h===b&&(h=!1),this.enable(!h);var i=c.element.prop("readonly");i===b&&(i=!1),this.readonly(i),j=j||q(),this.autofocus=c.element.prop("autofocus"),c.element.prop("autofocus",!1),this.autofocus&&this.focus(),this.search.attr("placeholder",c.searchInputPlaceholder)},destroy:function(){var a=this.opts.element,c=a.data("select2"),d=this;this.close(),a.length&&a[0].detachEvent&&d._sync&&a.each(function(){d._sync&&this.detachEvent("onpropertychange",d._sync)}),this.propertyObserver&&(this.propertyObserver.disconnect(),this.propertyObserver=null),this._sync=null,c!==b&&(c.container.remove(),c.liveRegion.remove(),c.dropdown.remove(),a.show().removeData("select2").off(".select2").prop("autofocus",this.autofocus||!1),this.elementTabIndex?a.attr({tabindex:this.elementTabIndex}):a.removeAttr("tabindex"),a.show()),N.call(this,"container","liveRegion","dropdown","results","search")},optionToData:function(a){return a.is("option")?{id:a.prop("value"),text:a.text(),element:a.get(),css:a.attr("class"),disabled:a.prop("disabled"),locked:r(a.attr("locked"),"locked")||r(a.data("locked"),!0)}:a.is("optgroup")?{text:a.attr("label"),children:[],element:a.get(),css:a.attr("class")}:void 0},prepareOpts:function(c){var d,e,g,h,i=this;if(d=c.element,"select"===d.get(0).tagName.toLowerCase()&&(this.select=e=c.element),e&&a.each(["id","multiple","ajax","query","createSearchChoice","initSelection","data","tags"],function(){if(this in c)throw new Error("Option '"+this+"' is not allowed for Select2 when attached to a <select> element.")}),c=a.extend({},{populateResults:function(d,e,g){var h,j=this.opts.id,k=this.liveRegion;h=function(d,e,l){var m,n,o,p,q,r,s,t,u,v;d=c.sortResults(d,e,g);var w=[];for(m=0,n=d.length;n>m;m+=1)o=d[m],q=o.disabled===!0,p=!q&&j(o)!==b,r=o.children&&o.children.length>0,s=a("<li></li>"),s.addClass("select2-results-dept-"+l),s.addClass("select2-result"),s.addClass(p?"select2-result-selectable":"select2-result-unselectable"),q&&s.addClass("select2-disabled"),r&&s.addClass("select2-result-with-children"),s.addClass(i.opts.formatResultCssClass(o)),s.attr("role","presentation"),t=a(document.createElement("div")),t.addClass("select2-result-label"),t.attr("id","select2-result-label-"+f()),t.attr("role","option"),v=c.formatResult(o,t,g,i.opts.escapeMarkup),v!==b&&(t.html(v),s.append(t)),r&&(u=a("<ul></ul>"),u.addClass("select2-result-sub"),h(o.children,u,l+1),s.append(u)),s.data("select2-data",o),w.push(s[0]);e.append(w),k.text(c.formatMatches(d.length))},h(e,d,0)}},a.fn.select2.defaults,c),"function"!=typeof c.id&&(g=c.id,c.id=function(a){return a[g]}),a.isArray(c.element.data("select2Tags"))){if("tags"in c)throw"tags specified as both an attribute 'data-select2-tags' and in options of Select2 "+c.element.attr("id");c.tags=c.element.data("select2Tags")}if(e?(c.query=this.bind(function(a){var f,g,h,c={results:[],more:!1},e=a.term;h=function(b,c){var d;b.is("option")?a.matcher(e,b.text(),b)&&c.push(i.optionToData(b)):b.is("optgroup")&&(d=i.optionToData(b),b.children().each2(function(a,b){h(b,d.children)}),d.children.length>0&&c.push(d))},f=d.children(),this.getPlaceholder()!==b&&f.length>0&&(g=this.getPlaceholderOption(),g&&(f=f.not(g))),f.each2(function(a,b){h(b,c.results)}),a.callback(c)}),c.id=function(a){return a.id}):"query"in c||("ajax"in c?(h=c.element.data("ajax-url"),h&&h.length>0&&(c.ajax.url=h),c.query=G.call(c.element,c.ajax)):"data"in c?c.query=H(c.data):"tags"in c&&(c.query=I(c.tags),c.createSearchChoice===b&&(c.createSearchChoice=function(b){return{id:a.trim(b),text:a.trim(b)}}),c.initSelection===b&&(c.initSelection=function(b,d){var e=[];a(s(b.val(),c.separator,c.transformVal)).each(function(){var b={id:this,text:this},d=c.tags;a.isFunction(d)&&(d=d()),a(d).each(function(){return r(this.id,b.id)?(b=this,!1):void 0}),e.push(b)}),d(e)}))),"function"!=typeof c.query)throw"query function not defined for Select2 "+c.element.attr("id");if("top"===c.createSearchChoicePosition)c.createSearchChoicePosition=function(a,b){a.unshift(b)};else if("bottom"===c.createSearchChoicePosition)c.createSearchChoicePosition=function(a,b){a.push(b)};else if("function"!=typeof c.createSearchChoicePosition)throw"invalid createSearchChoicePosition option must be 'top', 'bottom' or a custom function";return c},monitorSource:function(){var d,c=this.opts.element,e=this;c.on("change.select2",this.bind(function(){this.opts.element.data("select2-change-triggered")!==!0&&this.initSelection()})),this._sync=this.bind(function(){var a=c.prop("disabled");a===b&&(a=!1),this.enable(!a);var d=c.prop("readonly");d===b&&(d=!1),this.readonly(d),this.container&&(D(this.container,this.opts.element,this.opts.adaptContainerCssClass),this.container.addClass(K(this.opts.containerCssClass,this.opts.element))),this.dropdown&&(D(this.dropdown,this.opts.element,this.opts.adaptDropdownCssClass),this.dropdown.addClass(K(this.opts.dropdownCssClass,this.opts.element)))}),c.length&&c[0].attachEvent&&c.each(function(){this.attachEvent("onpropertychange",e._sync)}),d=window.MutationObserver||window.WebKitMutationObserver||window.MozMutationObserver,d!==b&&(this.propertyObserver&&(delete this.propertyObserver,this.propertyObserver=null),this.propertyObserver=new d(function(b){a.each(b,e._sync)}),this.propertyObserver.observe(c.get(0),{attributes:!0,subtree:!1}))},triggerSelect:function(b){var c=a.Event("select2-selecting",{val:this.id(b),object:b,choice:b});return this.opts.element.trigger(c),!c.isDefaultPrevented()},triggerChange:function(b){b=b||{},b=a.extend({},b,{type:"change",val:this.val()}),this.opts.element.data("select2-change-triggered",!0),this.opts.element.trigger(b),this.opts.element.data("select2-change-triggered",!1),this.opts.element.click(),this.opts.blurOnChange&&this.opts.element.blur()},isInterfaceEnabled:function(){return this.enabledInterface===!0},enableInterface:function(){var a=this._enabled&&!this._readonly,b=!a;return a===this.enabledInterface?!1:(this.container.toggleClass("select2-container-disabled",b),this.close(),this.enabledInterface=a,!0)},enable:function(a){a===b&&(a=!0),this._enabled!==a&&(this._enabled=a,this.opts.element.prop("disabled",!a),this.enableInterface())},disable:function(){this.enable(!1)},readonly:function(a){a===b&&(a=!1),this._readonly!==a&&(this._readonly=a,this.opts.element.prop("readonly",a),this.enableInterface())},opened:function(){return this.container?this.container.hasClass("select2-dropdown-open"):!1},positionDropdown:function(){var v,w,x,y,z,b=this.dropdown,c=this.container,d=c.offset(),e=c.outerHeight(!1),f=c.outerWidth(!1),g=b.outerHeight(!1),h=a(window),i=h.width(),k=h.height(),l=h.scrollLeft()+i,m=h.scrollTop()+k,n=d.top+e,o=d.left,p=m>=n+g,q=d.top-g>=h.scrollTop(),r=b.outerWidth(!1),s=function(){return l>=o+r},t=function(){return d.left+l+c.outerWidth(!1)>r},u=b.hasClass("select2-drop-above");u?(w=!0,!q&&p&&(x=!0,w=!1)):(w=!1,!p&&q&&(x=!0,w=!0)),x&&(b.hide(),d=this.container.offset(),e=this.container.outerHeight(!1),f=this.container.outerWidth(!1),g=b.outerHeight(!1),l=h.scrollLeft()+i,m=h.scrollTop()+k,n=d.top+e,o=d.left,r=b.outerWidth(!1),b.show(),this.focusSearch()),this.opts.dropdownAutoWidth?(z=a(".select2-results",b)[0],b.addClass("select2-drop-auto-width"),b.css("width",""),r=b.outerWidth(!1)+(z.scrollHeight===z.clientHeight?0:j.width),r>f?f=r:r=f,g=b.outerHeight(!1)):this.container.removeClass("select2-drop-auto-width"),"static"!==this.body.css("position")&&(v=this.body.offset(),n-=v.top,o-=v.left),!s()&&t()&&(o=d.left+this.container.outerWidth(!1)-r),y={left:o,width:f},w?(y.top=d.top-g,y.bottom="auto",this.container.addClass("select2-drop-above"),b.addClass("select2-drop-above")):(y.top=n,y.bottom="auto",this.container.removeClass("select2-drop-above"),b.removeClass("select2-drop-above")),y=a.extend(y,K(this.opts.dropdownCss,this.opts.element)),b.css(y)},shouldOpen:function(){var b;return this.opened()?!1:this._enabled===!1||this._readonly===!0?!1:(b=a.Event("select2-opening"),this.opts.element.trigger(b),!b.isDefaultPrevented())},clearDropdownAlignmentPreference:function(){this.container.removeClass("select2-drop-above"),this.dropdown.removeClass("select2-drop-above")},open:function(){return this.shouldOpen()?(this.opening(),i.on("mousemove.select2Event",function(a){h.x=a.pageX,h.y=a.pageY}),!0):!1},opening:function(){var f,b=this.containerEventName,c="scroll."+b,d="resize."+b,e="orientationchange."+b;this.container.addClass("select2-dropdown-open").addClass("select2-container-active"),this.clearDropdownAlignmentPreference(),this.dropdown[0]!==this.body.children().last()[0]&&this.dropdown.detach().appendTo(this.body),f=a("#select2-drop-mask"),0===f.length&&(f=a(document.createElement("div")),f.attr("id","select2-drop-mask").attr("class","select2-drop-mask"),f.hide(),f.appendTo(this.body),f.on("mousedown touchstart click",function(b){n(f);var d,c=a("#select2-drop");c.length>0&&(d=c.data("select2"),d.opts.selectOnBlur&&d.selectHighlighted({noFocus:!0}),d.close(),b.preventDefault(),b.stopPropagation())})),this.dropdown.prev()[0]!==f[0]&&this.dropdown.before(f),a("#select2-drop").removeAttr("id"),this.dropdown.attr("id","select2-drop"),f.show(),this.positionDropdown(),this.dropdown.show(),this.positionDropdown(),this.dropdown.addClass("select2-drop-active");var g=this;this.container.parents().add(window).each(function(){a(this).on(d+" "+c+" "+e,function(){g.opened()&&g.positionDropdown()})})},close:function(){if(this.opened()){var b=this.containerEventName,c="scroll."+b,d="resize."+b,e="orientationchange."+b;this.container.parents().add(window).each(function(){a(this).off(c).off(d).off(e)}),this.clearDropdownAlignmentPreference(),a("#select2-drop-mask").hide(),this.dropdown.removeAttr("id"),this.dropdown.hide(),this.container.removeClass("select2-dropdown-open").removeClass("select2-container-active"),this.results.empty(),i.off("mousemove.select2Event"),this.clearSearch(),this.search.removeClass("select2-active"),this.opts.element.trigger(a.Event("select2-close"))}},externalSearch:function(a){this.open(),this.search.val(a),this.updateResults(!1)},clearSearch:function(){},getMaximumSelectionSize:function(){return K(this.opts.maximumSelectionSize,this.opts.element)},ensureHighlightVisible:function(){var c,d,e,f,g,h,i,j,b=this.results;if(d=this.highlight(),!(0>d)){if(0==d)return b.scrollTop(0),void 0;c=this.findHighlightableChoices().find(".select2-result-label"),e=a(c[d]),j=(e.offset()||{}).top||0,f=j+e.outerHeight(!0),d===c.length-1&&(i=b.find("li.select2-more-results"),i.length>0&&(f=i.offset().top+i.outerHeight(!0))),g=b.offset().top+b.outerHeight(!1),f>g&&b.scrollTop(b.scrollTop()+(f-g)),h=j-b.offset().top,0>h&&"none"!=e.css("display")&&b.scrollTop(b.scrollTop()+h)}},findHighlightableChoices:function(){return this.results.find(".select2-result-selectable:not(.select2-disabled):not(.select2-selected)")},moveHighlight:function(b){for(var c=this.findHighlightableChoices(),d=this.highlight();d>-1&&d<c.length;){d+=b;
22
- var e=a(c[d]);if(e.hasClass("select2-result-selectable")&&!e.hasClass("select2-disabled")&&!e.hasClass("select2-selected")){this.highlight(d);break}}},highlight:function(b){var d,e,c=this.findHighlightableChoices();return 0===arguments.length?p(c.filter(".select2-highlighted")[0],c.get()):(b>=c.length&&(b=c.length-1),0>b&&(b=0),this.removeHighlight(),d=a(c[b]),d.addClass("select2-highlighted"),this.search.attr("aria-activedescendant",d.find(".select2-result-label").attr("id")),this.ensureHighlightVisible(),this.liveRegion.text(d.text()),e=d.data("select2-data"),e&&this.opts.element.trigger({type:"select2-highlight",val:this.id(e),choice:e}),void 0)},removeHighlight:function(){this.results.find(".select2-highlighted").removeClass("select2-highlighted")},touchMoved:function(){this._touchMoved=!0},clearTouchMoved:function(){this._touchMoved=!1},countSelectableResults:function(){return this.findHighlightableChoices().length},highlightUnderEvent:function(b){var c=a(b.target).closest(".select2-result-selectable");if(c.length>0&&!c.is(".select2-highlighted")){var d=this.findHighlightableChoices();this.highlight(d.index(c))}else 0==c.length&&this.removeHighlight()},loadMoreIfNeeded:function(){var c,a=this.results,b=a.find("li.select2-more-results"),d=this.resultsPage+1,e=this,f=this.search.val(),g=this.context;0!==b.length&&(c=b.offset().top-a.offset().top-a.height(),c<=this.opts.loadMorePadding&&(b.addClass("select2-active"),this.opts.query({element:this.opts.element,term:f,page:d,context:g,matcher:this.opts.matcher,callback:this.bind(function(c){e.opened()&&(e.opts.populateResults.call(this,a,c.results,{term:f,page:d,context:g}),e.postprocessResults(c,!1,!1),c.more===!0?(b.detach().appendTo(a).html(e.opts.escapeMarkup(K(e.opts.formatLoadMore,e.opts.element,d+1))),window.setTimeout(function(){e.loadMoreIfNeeded()},10)):b.remove(),e.positionDropdown(),e.resultsPage=d,e.context=c.context,this.opts.element.trigger({type:"select2-loaded",items:c}))})})))},tokenize:function(){},updateResults:function(c){function m(){d.removeClass("select2-active"),h.positionDropdown(),e.find(".select2-no-results,.select2-selection-limit,.select2-searching").length?h.liveRegion.text(e.text()):h.liveRegion.text(h.opts.formatMatches(e.find('.select2-result-selectable:not(".select2-selected")').length))}function n(a){e.html(a),m()}var g,i,l,d=this.search,e=this.results,f=this.opts,h=this,j=d.val(),k=a.data(this.container,"select2-last-term");if((c===!0||!k||!r(j,k))&&(a.data(this.container,"select2-last-term",j),c===!0||this.showSearchInput!==!1&&this.opened())){l=++this.queryCount;var o=this.getMaximumSelectionSize();if(o>=1&&(g=this.data(),a.isArray(g)&&g.length>=o&&J(f.formatSelectionTooBig,"formatSelectionTooBig")))return n("<li class='select2-selection-limit'>"+K(f.formatSelectionTooBig,f.element,o)+"</li>"),void 0;if(d.val().length<f.minimumInputLength)return J(f.formatInputTooShort,"formatInputTooShort")?n("<li class='select2-no-results'>"+K(f.formatInputTooShort,f.element,d.val(),f.minimumInputLength)+"</li>"):n(""),c&&this.showSearch&&this.showSearch(!0),void 0;if(f.maximumInputLength&&d.val().length>f.maximumInputLength)return J(f.formatInputTooLong,"formatInputTooLong")?n("<li class='select2-no-results'>"+K(f.formatInputTooLong,f.element,d.val(),f.maximumInputLength)+"</li>"):n(""),void 0;f.formatSearching&&0===this.findHighlightableChoices().length&&n("<li class='select2-searching'>"+K(f.formatSearching,f.element)+"</li>"),d.addClass("select2-active"),this.removeHighlight(),i=this.tokenize(),i!=b&&null!=i&&d.val(i),this.resultsPage=1,f.query({element:f.element,term:d.val(),page:this.resultsPage,context:null,matcher:f.matcher,callback:this.bind(function(g){var i;if(l==this.queryCount){if(!this.opened())return this.search.removeClass("select2-active"),void 0;if(g.hasError!==b&&J(f.formatAjaxError,"formatAjaxError"))return n("<li class='select2-ajax-error'>"+K(f.formatAjaxError,f.element,g.jqXHR,g.textStatus,g.errorThrown)+"</li>"),void 0;if(this.context=g.context===b?null:g.context,this.opts.createSearchChoice&&""!==d.val()&&(i=this.opts.createSearchChoice.call(h,d.val(),g.results),i!==b&&null!==i&&h.id(i)!==b&&null!==h.id(i)&&0===a(g.results).filter(function(){return r(h.id(this),h.id(i))}).length&&this.opts.createSearchChoicePosition(g.results,i)),0===g.results.length&&J(f.formatNoMatches,"formatNoMatches"))return n("<li class='select2-no-results'>"+K(f.formatNoMatches,f.element,d.val())+"</li>"),void 0;e.empty(),h.opts.populateResults.call(this,e,g.results,{term:d.val(),page:this.resultsPage,context:null}),g.more===!0&&J(f.formatLoadMore,"formatLoadMore")&&(e.append("<li class='select2-more-results'>"+f.escapeMarkup(K(f.formatLoadMore,f.element,this.resultsPage))+"</li>"),window.setTimeout(function(){h.loadMoreIfNeeded()},10)),this.postprocessResults(g,c),m(),this.opts.element.trigger({type:"select2-loaded",items:g})}})})}},cancel:function(){this.close()},blur:function(){this.opts.selectOnBlur&&this.selectHighlighted({noFocus:!0}),this.close(),this.container.removeClass("select2-container-active"),this.search[0]===document.activeElement&&this.search.blur(),this.clearSearch(),this.selection.find(".select2-search-choice-focus").removeClass("select2-search-choice-focus")},focusSearch:function(){y(this.search)},selectHighlighted:function(a){if(this._touchMoved)return this.clearTouchMoved(),void 0;var b=this.highlight(),c=this.results.find(".select2-highlighted"),d=c.closest(".select2-result").data("select2-data");d?(this.highlight(b),this.onSelect(d,a)):a&&a.noFocus&&this.close()},getPlaceholder:function(){var a;return this.opts.element.attr("placeholder")||this.opts.element.attr("data-placeholder")||this.opts.element.data("placeholder")||this.opts.placeholder||((a=this.getPlaceholderOption())!==b?a.text():b)},getPlaceholderOption:function(){if(this.select){var c=this.select.children("option").first();if(this.opts.placeholderOption!==b)return"first"===this.opts.placeholderOption&&c||"function"==typeof this.opts.placeholderOption&&this.opts.placeholderOption(this.select);if(""===a.trim(c.text())&&""===c.val())return c}},initContainerWidth:function(){function c(){var c,d,e,f,g,h;if("off"===this.opts.width)return null;if("element"===this.opts.width)return 0===this.opts.element.outerWidth(!1)?"auto":this.opts.element.outerWidth(!1)+"px";if("copy"===this.opts.width||"resolve"===this.opts.width){if(c=this.opts.element.attr("style"),c!==b)for(d=c.split(";"),f=0,g=d.length;g>f;f+=1)if(h=d[f].replace(/\s/g,""),e=h.match(/^width:(([-+]?([0-9]*\.)?[0-9]+)(px|em|ex|%|in|cm|mm|pt|pc))/i),null!==e&&e.length>=1)return e[1];return"resolve"===this.opts.width?(c=this.opts.element.css("width"),c.indexOf("%")>0?c:0===this.opts.element.outerWidth(!1)?"auto":this.opts.element.outerWidth(!1)+"px"):null}return a.isFunction(this.opts.width)?this.opts.width():this.opts.width}var d=c.call(this);null!==d&&this.container.css("width",d)}}),d=O(c,{createContainer:function(){var b=a(document.createElement("div")).attr({"class":"select2-container"}).html(["<a href='javascript:void(0)' class='select2-choice' tabindex='-1'>"," <span class='select2-chosen'>&#160;</span><abbr class='select2-search-choice-close'></abbr>"," <span class='select2-arrow' role='presentation'><b role='presentation'></b></span>","</a>","<label for='' class='select2-offscreen'></label>","<input class='select2-focusser select2-offscreen' type='text' aria-haspopup='true' role='button' />","<div class='select2-drop select2-display-none'>"," <div class='select2-search'>"," <label for='' class='select2-offscreen'></label>"," <input type='text' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' class='select2-input' role='combobox' aria-expanded='true'"," aria-autocomplete='list' />"," </div>"," <ul class='select2-results' role='listbox'>"," </ul>","</div>"].join(""));return b},enableInterface:function(){this.parent.enableInterface.apply(this,arguments)&&this.focusser.prop("disabled",!this.isInterfaceEnabled())},opening:function(){var c,d,e;this.opts.minimumResultsForSearch>=0&&this.showSearch(!0),this.parent.opening.apply(this,arguments),this.showSearchInput!==!1&&this.search.val(this.focusser.val()),this.opts.shouldFocusInput(this)&&(this.search.focus(),c=this.search.get(0),c.createTextRange?(d=c.createTextRange(),d.collapse(!1),d.select()):c.setSelectionRange&&(e=this.search.val().length,c.setSelectionRange(e,e))),""===this.search.val()&&this.nextSearchTerm!=b&&(this.search.val(this.nextSearchTerm),this.search.select()),this.focusser.prop("disabled",!0).val(""),this.updateResults(!0),this.opts.element.trigger(a.Event("select2-open"))},close:function(){this.opened()&&(this.parent.close.apply(this,arguments),this.focusser.prop("disabled",!1),this.opts.shouldFocusInput(this)&&this.focusser.focus())},focus:function(){this.opened()?this.close():(this.focusser.prop("disabled",!1),this.opts.shouldFocusInput(this)&&this.focusser.focus())},isFocused:function(){return this.container.hasClass("select2-container-active")},cancel:function(){this.parent.cancel.apply(this,arguments),this.focusser.prop("disabled",!1),this.opts.shouldFocusInput(this)&&this.focusser.focus()},destroy:function(){a("label[for='"+this.focusser.attr("id")+"']").attr("for",this.opts.element.attr("id")),this.parent.destroy.apply(this,arguments),N.call(this,"selection","focusser")},initContainer:function(){var b,g,c=this.container,d=this.dropdown,e=f();this.opts.minimumResultsForSearch<0?this.showSearch(!1):this.showSearch(!0),this.selection=b=c.find(".select2-choice"),this.focusser=c.find(".select2-focusser"),b.find(".select2-chosen").attr("id","select2-chosen-"+e),this.focusser.attr("aria-labelledby","select2-chosen-"+e),this.results.attr("id","select2-results-"+e),this.search.attr("aria-owns","select2-results-"+e),this.focusser.attr("id","s2id_autogen"+e),g=a("label[for='"+this.opts.element.attr("id")+"']"),this.opts.element.focus(this.bind(function(){this.focus()})),this.focusser.prev().text(g.text()).attr("for",this.focusser.attr("id"));var h=this.opts.element.attr("title");this.opts.element.attr("title",h||g.text()),this.focusser.attr("tabindex",this.elementTabIndex),this.search.attr("id",this.focusser.attr("id")+"_search"),this.search.prev().text(a("label[for='"+this.focusser.attr("id")+"']").text()).attr("for",this.search.attr("id")),this.search.on("keydown",this.bind(function(a){if(this.isInterfaceEnabled()&&229!=a.keyCode){if(a.which===k.PAGE_UP||a.which===k.PAGE_DOWN)return A(a),void 0;switch(a.which){case k.UP:case k.DOWN:return this.moveHighlight(a.which===k.UP?-1:1),A(a),void 0;case k.ENTER:return this.selectHighlighted(),A(a),void 0;case k.TAB:return this.selectHighlighted({noFocus:!0}),void 0;case k.ESC:return this.cancel(a),A(a),void 0}}})),this.search.on("blur",this.bind(function(){document.activeElement===this.body.get(0)&&window.setTimeout(this.bind(function(){this.opened()&&this.search.focus()}),0)})),this.focusser.on("keydown",this.bind(function(a){if(this.isInterfaceEnabled()&&a.which!==k.TAB&&!k.isControl(a)&&!k.isFunctionKey(a)&&a.which!==k.ESC){if(this.opts.openOnEnter===!1&&a.which===k.ENTER)return A(a),void 0;if(a.which==k.DOWN||a.which==k.UP||a.which==k.ENTER&&this.opts.openOnEnter){if(a.altKey||a.ctrlKey||a.shiftKey||a.metaKey)return;return this.open(),A(a),void 0}return a.which==k.DELETE||a.which==k.BACKSPACE?(this.opts.allowClear&&this.clear(),A(a),void 0):void 0}})),u(this.focusser),this.focusser.on("keyup-change input",this.bind(function(a){if(this.opts.minimumResultsForSearch>=0){if(a.stopPropagation(),this.opened())return;this.open()}})),b.on("mousedown touchstart","abbr",this.bind(function(a){this.isInterfaceEnabled()&&(this.clear(),B(a),this.close(),this.selection&&this.selection.focus())})),b.on("mousedown touchstart",this.bind(function(c){n(b),this.container.hasClass("select2-container-active")||this.opts.element.trigger(a.Event("select2-focus")),this.opened()?this.close():this.isInterfaceEnabled()&&this.open(),A(c)})),d.on("mousedown touchstart",this.bind(function(){this.opts.shouldFocusInput(this)&&this.search.focus()})),b.on("focus",this.bind(function(a){A(a)})),this.focusser.on("focus",this.bind(function(){this.container.hasClass("select2-container-active")||this.opts.element.trigger(a.Event("select2-focus")),this.container.addClass("select2-container-active")})).on("blur",this.bind(function(){this.opened()||(this.container.removeClass("select2-container-active"),this.opts.element.trigger(a.Event("select2-blur")))})),this.search.on("focus",this.bind(function(){this.container.hasClass("select2-container-active")||this.opts.element.trigger(a.Event("select2-focus")),this.container.addClass("select2-container-active")})),this.initContainerWidth(),this.opts.element.hide(),this.setPlaceholder()},clear:function(b){var c=this.selection.data("select2-data");if(c){var d=a.Event("select2-clearing");if(this.opts.element.trigger(d),d.isDefaultPrevented())return;var e=this.getPlaceholderOption();this.opts.element.val(e?e.val():""),this.selection.find(".select2-chosen").empty(),this.selection.removeData("select2-data"),this.setPlaceholder(),b!==!1&&(this.opts.element.trigger({type:"select2-removed",val:this.id(c),choice:c}),this.triggerChange({removed:c}))}},initSelection:function(){if(this.isPlaceholderOptionSelected())this.updateSelection(null),this.close(),this.setPlaceholder();else{var c=this;this.opts.initSelection.call(null,this.opts.element,function(a){a!==b&&null!==a&&(c.updateSelection(a),c.close(),c.setPlaceholder(),c.nextSearchTerm=c.opts.nextSearchTerm(a,c.search.val()))})}},isPlaceholderOptionSelected:function(){var a;return this.getPlaceholder()===b?!1:(a=this.getPlaceholderOption())!==b&&a.prop("selected")||""===this.opts.element.val()||this.opts.element.val()===b||null===this.opts.element.val()},prepareOpts:function(){var b=this.parent.prepareOpts.apply(this,arguments),c=this;return"select"===b.element.get(0).tagName.toLowerCase()?b.initSelection=function(a,b){var d=a.find("option").filter(function(){return this.selected&&!this.disabled});b(c.optionToData(d))}:"data"in b&&(b.initSelection=b.initSelection||function(c,d){var e=c.val(),f=null;b.query({matcher:function(a,c,d){var g=r(e,b.id(d));return g&&(f=d),g},callback:a.isFunction(d)?function(){d(f)}:a.noop})}),b},getPlaceholder:function(){return this.select&&this.getPlaceholderOption()===b?b:this.parent.getPlaceholder.apply(this,arguments)},setPlaceholder:function(){var a=this.getPlaceholder();if(this.isPlaceholderOptionSelected()&&a!==b){if(this.select&&this.getPlaceholderOption()===b)return;this.selection.find(".select2-chosen").html(this.opts.escapeMarkup(a)),this.selection.addClass("select2-default"),this.container.removeClass("select2-allowclear")}},postprocessResults:function(a,b,c){var d=0,e=this;if(this.findHighlightableChoices().each2(function(a,b){return r(e.id(b.data("select2-data")),e.opts.element.val())?(d=a,!1):void 0}),c!==!1&&(b===!0&&d>=0?this.highlight(d):this.highlight(0)),b===!0){var g=this.opts.minimumResultsForSearch;g>=0&&this.showSearch(L(a.results)>=g)}},showSearch:function(b){this.showSearchInput!==b&&(this.showSearchInput=b,this.dropdown.find(".select2-search").toggleClass("select2-search-hidden",!b),this.dropdown.find(".select2-search").toggleClass("select2-offscreen",!b),a(this.dropdown,this.container).toggleClass("select2-with-searchbox",b))},onSelect:function(a,b){if(this.triggerSelect(a)){var c=this.opts.element.val(),d=this.data();this.opts.element.val(this.id(a)),this.updateSelection(a),this.opts.element.trigger({type:"select2-selected",val:this.id(a),choice:a}),this.nextSearchTerm=this.opts.nextSearchTerm(a,this.search.val()),this.close(),b&&b.noFocus||!this.opts.shouldFocusInput(this)||this.focusser.focus(),r(c,this.id(a))||this.triggerChange({added:a,removed:d})}},updateSelection:function(a){var d,e,c=this.selection.find(".select2-chosen");this.selection.data("select2-data",a),c.empty(),null!==a&&(d=this.opts.formatSelection(a,c,this.opts.escapeMarkup)),d!==b&&c.append(d),e=this.opts.formatSelectionCssClass(a,c),e!==b&&c.addClass(e),this.selection.removeClass("select2-default"),this.opts.allowClear&&this.getPlaceholder()!==b&&this.container.addClass("select2-allowclear")},val:function(){var a,c=!1,d=null,e=this,f=this.data();if(0===arguments.length)return this.opts.element.val();if(a=arguments[0],arguments.length>1&&(c=arguments[1]),this.select)this.select.val(a).find("option").filter(function(){return this.selected}).each2(function(a,b){return d=e.optionToData(b),!1}),this.updateSelection(d),this.setPlaceholder(),c&&this.triggerChange({added:d,removed:f});else{if(!a&&0!==a)return this.clear(c),void 0;if(this.opts.initSelection===b)throw new Error("cannot call val() if initSelection() is not defined");this.opts.element.val(a),this.opts.initSelection(this.opts.element,function(a){e.opts.element.val(a?e.id(a):""),e.updateSelection(a),e.setPlaceholder(),c&&e.triggerChange({added:a,removed:f})})}},clearSearch:function(){this.search.val(""),this.focusser.val("")},data:function(a){var c,d=!1;return 0===arguments.length?(c=this.selection.data("select2-data"),c==b&&(c=null),c):(arguments.length>1&&(d=arguments[1]),a?(c=this.data(),this.opts.element.val(a?this.id(a):""),this.updateSelection(a),d&&this.triggerChange({added:a,removed:c})):this.clear(d),void 0)}}),e=O(c,{createContainer:function(){var b=a(document.createElement("div")).attr({"class":"select2-container select2-container-multi"}).html(["<ul class='select2-choices'>"," <li class='select2-search-field'>"," <label for='' class='select2-offscreen'></label>"," <input type='text' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' class='select2-input'>"," </li>","</ul>","<div class='select2-drop select2-drop-multi select2-display-none'>"," <ul class='select2-results'>"," </ul>","</div>"].join(""));return b},prepareOpts:function(){var b=this.parent.prepareOpts.apply(this,arguments),c=this;return"select"===b.element.get(0).tagName.toLowerCase()?b.initSelection=function(a,b){var d=[];a.find("option").filter(function(){return this.selected&&!this.disabled}).each2(function(a,b){d.push(c.optionToData(b))}),b(d)}:"data"in b&&(b.initSelection=b.initSelection||function(c,d){var e=s(c.val(),b.separator,b.transformVal),f=[];b.query({matcher:function(c,d,g){var h=a.grep(e,function(a){return r(a,b.id(g))}).length;return h&&f.push(g),h},callback:a.isFunction(d)?function(){for(var a=[],c=0;c<e.length;c++)for(var g=e[c],h=0;h<f.length;h++){var i=f[h];if(r(g,b.id(i))){a.push(i),f.splice(h,1);break}}d(a)}:a.noop})}),b},selectChoice:function(a){var b=this.container.find(".select2-search-choice-focus");b.length&&a&&a[0]==b[0]||(b.length&&this.opts.element.trigger("choice-deselected",b),b.removeClass("select2-search-choice-focus"),a&&a.length&&(this.close(),a.addClass("select2-search-choice-focus"),this.opts.element.trigger("choice-selected",a)))},destroy:function(){a("label[for='"+this.search.attr("id")+"']").attr("for",this.opts.element.attr("id")),this.parent.destroy.apply(this,arguments),N.call(this,"searchContainer","selection")},initContainer:function(){var c,b=".select2-choices";this.searchContainer=this.container.find(".select2-search-field"),this.selection=c=this.container.find(b);var d=this;this.selection.on("click",".select2-container:not(.select2-container-disabled) .select2-search-choice:not(.select2-locked)",function(){d.search[0].focus(),d.selectChoice(a(this))}),this.search.attr("id","s2id_autogen"+f()),this.search.prev().text(a("label[for='"+this.opts.element.attr("id")+"']").text()).attr("for",this.search.attr("id")),this.opts.element.focus(this.bind(function(){this.focus()})),this.search.on("input paste",this.bind(function(){this.search.attr("placeholder")&&0==this.search.val().length||this.isInterfaceEnabled()&&(this.opened()||this.open())})),this.search.attr("tabindex",this.elementTabIndex),this.keydowns=0,this.search.on("keydown",this.bind(function(a){if(this.isInterfaceEnabled()){++this.keydowns;var b=c.find(".select2-search-choice-focus"),d=b.prev(".select2-search-choice:not(.select2-locked)"),e=b.next(".select2-search-choice:not(.select2-locked)"),f=z(this.search);if(b.length&&(a.which==k.LEFT||a.which==k.RIGHT||a.which==k.BACKSPACE||a.which==k.DELETE||a.which==k.ENTER)){var g=b;return a.which==k.LEFT&&d.length?g=d:a.which==k.RIGHT?g=e.length?e:null:a.which===k.BACKSPACE?this.unselect(b.first())&&(this.search.width(10),g=d.length?d:e):a.which==k.DELETE?this.unselect(b.first())&&(this.search.width(10),g=e.length?e:null):a.which==k.ENTER&&(g=null),this.selectChoice(g),A(a),g&&g.length||this.open(),void 0}if((a.which===k.BACKSPACE&&1==this.keydowns||a.which==k.LEFT)&&0==f.offset&&!f.length)return this.selectChoice(c.find(".select2-search-choice:not(.select2-locked)").last()),A(a),void 0;if(this.selectChoice(null),this.opened())switch(a.which){case k.UP:case k.DOWN:return this.moveHighlight(a.which===k.UP?-1:1),A(a),void 0;case k.ENTER:return this.selectHighlighted(),A(a),void 0;case k.TAB:return this.selectHighlighted({noFocus:!0}),this.close(),void 0;case k.ESC:return this.cancel(a),A(a),void 0}if(a.which!==k.TAB&&!k.isControl(a)&&!k.isFunctionKey(a)&&a.which!==k.BACKSPACE&&a.which!==k.ESC){if(a.which===k.ENTER){if(this.opts.openOnEnter===!1)return;if(a.altKey||a.ctrlKey||a.shiftKey||a.metaKey)return}this.open(),(a.which===k.PAGE_UP||a.which===k.PAGE_DOWN)&&A(a),a.which===k.ENTER&&A(a)}}})),this.search.on("keyup",this.bind(function(){this.keydowns=0,this.resizeSearch()})),this.search.on("blur",this.bind(function(b){this.container.removeClass("select2-container-active"),this.search.removeClass("select2-focused"),this.selectChoice(null),this.opened()||this.clearSearch(),b.stopImmediatePropagation(),this.opts.element.trigger(a.Event("select2-blur"))})),this.container.on("click",b,this.bind(function(b){this.isInterfaceEnabled()&&(a(b.target).closest(".select2-search-choice").length>0||(this.selectChoice(null),this.clearPlaceholder(),this.container.hasClass("select2-container-active")||this.opts.element.trigger(a.Event("select2-focus")),this.open(),this.focusSearch(),b.preventDefault()))})),this.container.on("focus",b,this.bind(function(){this.isInterfaceEnabled()&&(this.container.hasClass("select2-container-active")||this.opts.element.trigger(a.Event("select2-focus")),this.container.addClass("select2-container-active"),this.dropdown.addClass("select2-drop-active"),this.clearPlaceholder())})),this.initContainerWidth(),this.opts.element.hide(),this.clearSearch()},enableInterface:function(){this.parent.enableInterface.apply(this,arguments)&&this.search.prop("disabled",!this.isInterfaceEnabled())},initSelection:function(){if(""===this.opts.element.val()&&""===this.opts.element.text()&&(this.updateSelection([]),this.close(),this.clearSearch()),this.select||""!==this.opts.element.val()){var c=this;this.opts.initSelection.call(null,this.opts.element,function(a){a!==b&&null!==a&&(c.updateSelection(a),c.close(),c.clearSearch())})}},clearSearch:function(){var a=this.getPlaceholder(),c=this.getMaxSearchWidth();a!==b&&0===this.getVal().length&&this.search.hasClass("select2-focused")===!1?(this.search.val(a).addClass("select2-default"),this.search.width(c>0?c:this.container.css("width"))):this.search.val("").width(10)},clearPlaceholder:function(){this.search.hasClass("select2-default")&&this.search.val("").removeClass("select2-default")},opening:function(){this.clearPlaceholder(),this.resizeSearch(),this.parent.opening.apply(this,arguments),this.focusSearch(),""===this.search.val()&&this.nextSearchTerm!=b&&(this.search.val(this.nextSearchTerm),this.search.select()),this.updateResults(!0),this.opts.shouldFocusInput(this)&&this.search.focus(),this.opts.element.trigger(a.Event("select2-open"))},close:function(){this.opened()&&this.parent.close.apply(this,arguments)},focus:function(){this.close(),this.search.focus()},isFocused:function(){return this.search.hasClass("select2-focused")},updateSelection:function(b){var c=[],d=[],e=this;a(b).each(function(){p(e.id(this),c)<0&&(c.push(e.id(this)),d.push(this))}),b=d,this.selection.find(".select2-search-choice").remove(),a(b).each(function(){e.addSelectedChoice(this)}),e.postprocessResults()},tokenize:function(){var a=this.search.val();a=this.opts.tokenizer.call(this,a,this.data(),this.bind(this.onSelect),this.opts),null!=a&&a!=b&&(this.search.val(a),a.length>0&&this.open())},onSelect:function(a,c){this.triggerSelect(a)&&""!==a.text&&(this.addSelectedChoice(a),this.opts.element.trigger({type:"selected",val:this.id(a),choice:a}),this.nextSearchTerm=this.opts.nextSearchTerm(a,this.search.val()),this.clearSearch(),this.updateResults(),(this.select||!this.opts.closeOnSelect)&&this.postprocessResults(a,!1,this.opts.closeOnSelect===!0),this.opts.closeOnSelect?(this.close(),this.search.width(10)):this.countSelectableResults()>0?(this.search.width(10),this.resizeSearch(),this.getMaximumSelectionSize()>0&&this.val().length>=this.getMaximumSelectionSize()?this.updateResults(!0):this.nextSearchTerm!=b&&(this.search.val(this.nextSearchTerm),this.updateResults(),this.search.select()),this.positionDropdown()):(this.close(),this.search.width(10)),this.triggerChange({added:a}),c&&c.noFocus||this.focusSearch())},cancel:function(){this.close(),this.focusSearch()},addSelectedChoice:function(c){var j,k,d=!c.locked,e=a("<li class='select2-search-choice'> <div></div> <a href='#' class='select2-search-choice-close' tabindex='-1'></a></li>"),f=a("<li class='select2-search-choice select2-locked'><div></div></li>"),g=d?e:f,h=this.id(c),i=this.getVal();j=this.opts.formatSelection(c,g.find("div"),this.opts.escapeMarkup),j!=b&&g.find("div").replaceWith(a("<div></div>").html(j)),k=this.opts.formatSelectionCssClass(c,g.find("div")),k!=b&&g.addClass(k),d&&g.find(".select2-search-choice-close").on("mousedown",A).on("click dblclick",this.bind(function(b){this.isInterfaceEnabled()&&(this.unselect(a(b.target)),this.selection.find(".select2-search-choice-focus").removeClass("select2-search-choice-focus"),A(b),this.close(),this.focusSearch())})).on("focus",this.bind(function(){this.isInterfaceEnabled()&&(this.container.addClass("select2-container-active"),this.dropdown.addClass("select2-drop-active"))})),g.data("select2-data",c),g.insertBefore(this.searchContainer),i.push(h),this.setVal(i)},unselect:function(b){var d,e,c=this.getVal();if(b=b.closest(".select2-search-choice"),0===b.length)throw"Invalid argument: "+b+". Must be .select2-search-choice";if(d=b.data("select2-data")){var f=a.Event("select2-removing");if(f.val=this.id(d),f.choice=d,this.opts.element.trigger(f),f.isDefaultPrevented())return!1;for(;(e=p(this.id(d),c))>=0;)c.splice(e,1),this.setVal(c),this.select&&this.postprocessResults();return b.remove(),this.opts.element.trigger({type:"select2-removed",val:this.id(d),choice:d}),this.triggerChange({removed:d}),!0}},postprocessResults:function(a,b,c){var d=this.getVal(),e=this.results.find(".select2-result"),f=this.results.find(".select2-result-with-children"),g=this;e.each2(function(a,b){var c=g.id(b.data("select2-data"));p(c,d)>=0&&(b.addClass("select2-selected"),b.find(".select2-result-selectable").addClass("select2-selected"))}),f.each2(function(a,b){b.is(".select2-result-selectable")||0!==b.find(".select2-result-selectable:not(.select2-selected)").length||b.addClass("select2-selected")}),-1==this.highlight()&&c!==!1&&this.opts.closeOnSelect===!0&&g.highlight(0),!this.opts.createSearchChoice&&!e.filter(".select2-result:not(.select2-selected)").length>0&&(!a||a&&!a.more&&0===this.results.find(".select2-no-results").length)&&J(g.opts.formatNoMatches,"formatNoMatches")&&this.results.append("<li class='select2-no-results'>"+K(g.opts.formatNoMatches,g.opts.element,g.search.val())+"</li>")},getMaxSearchWidth:function(){return this.selection.width()-t(this.search)},resizeSearch:function(){var a,b,c,d,e,f=t(this.search);a=C(this.search)+10,b=this.search.offset().left,c=this.selection.width(),d=this.selection.offset().left,e=c-(b-d)-f,a>e&&(e=c-f),40>e&&(e=c-f),0>=e&&(e=a),this.search.width(Math.floor(e))},getVal:function(){var a;return this.select?(a=this.select.val(),null===a?[]:a):(a=this.opts.element.val(),s(a,this.opts.separator,this.opts.transformVal))},setVal:function(b){var c;this.select?this.select.val(b):(c=[],a(b).each(function(){p(this,c)<0&&c.push(this)}),this.opts.element.val(0===c.length?"":c.join(this.opts.separator)))},buildChangeDetails:function(a,b){for(var b=b.slice(0),a=a.slice(0),c=0;c<b.length;c++)for(var d=0;d<a.length;d++)r(this.opts.id(b[c]),this.opts.id(a[d]))&&(b.splice(c,1),c>0&&c--,a.splice(d,1),d--);return{added:b,removed:a}},val:function(c,d){var e,f=this;if(0===arguments.length)return this.getVal();if(e=this.data(),e.length||(e=[]),!c&&0!==c)return this.opts.element.val(""),this.updateSelection([]),this.clearSearch(),d&&this.triggerChange({added:this.data(),removed:e}),void 0;if(this.setVal(c),this.select)this.opts.initSelection(this.select,this.bind(this.updateSelection)),d&&this.triggerChange(this.buildChangeDetails(e,this.data()));else{if(this.opts.initSelection===b)throw new Error("val() cannot be called if initSelection() is not defined");this.opts.initSelection(this.opts.element,function(b){var c=a.map(b,f.id);f.setVal(c),f.updateSelection(b),f.clearSearch(),d&&f.triggerChange(f.buildChangeDetails(e,f.data()))})}this.clearSearch()},onSortStart:function(){if(this.select)throw new Error("Sorting of elements is not supported when attached to <select>. Attach to <input type='hidden'/> instead.");this.search.width(0),this.searchContainer.hide()},onSortEnd:function(){var b=[],c=this;this.searchContainer.show(),this.searchContainer.appendTo(this.searchContainer.parent()),this.resizeSearch(),this.selection.find(".select2-search-choice").each(function(){b.push(c.opts.id(a(this).data("select2-data")))}),this.setVal(b),this.triggerChange()},data:function(b,c){var e,f,d=this;return 0===arguments.length?this.selection.children(".select2-search-choice").map(function(){return a(this).data("select2-data")}).get():(f=this.data(),b||(b=[]),e=a.map(b,function(a){return d.opts.id(a)}),this.setVal(e),this.updateSelection(b),this.clearSearch(),c&&this.triggerChange(this.buildChangeDetails(f,this.data())),void 0)}}),a.fn.select2=function(){var d,e,f,g,h,c=Array.prototype.slice.call(arguments,0),i=["val","destroy","opened","open","close","focus","isFocused","container","dropdown","onSortStart","onSortEnd","enable","disable","readonly","positionDropdown","data","search"],j=["opened","isFocused","container","dropdown"],k=["val","data"],l={search:"externalSearch"};return this.each(function(){if(0===c.length||"object"==typeof c[0])d=0===c.length?{}:a.extend({},c[0]),d.element=a(this),"select"===d.element.get(0).tagName.toLowerCase()?h=d.element.prop("multiple"):(h=d.multiple||!1,"tags"in d&&(d.multiple=h=!0)),e=h?new window.Select2["class"].multi:new window.Select2["class"].single,e.init(d);else{if("string"!=typeof c[0])throw"Invalid arguments to select2 plugin: "+c;if(p(c[0],i)<0)throw"Unknown method: "+c[0];if(g=b,e=a(this).data("select2"),e===b)return;if(f=c[0],"container"===f?g=e.container:"dropdown"===f?g=e.dropdown:(l[f]&&(f=l[f]),g=e[f].apply(e,c.slice(1))),p(c[0],j)>=0||p(c[0],k)>=0&&1==c.length)return!1}}),g===b?this:g},a.fn.select2.defaults={width:"copy",loadMorePadding:0,closeOnSelect:!0,openOnEnter:!0,containerCss:{},dropdownCss:{},containerCssClass:"",dropdownCssClass:"",formatResult:function(a,b,c,d){var e=[];return E(this.text(a),c.term,e,d),e.join("")},transformVal:function(b){return a.trim(b)},formatSelection:function(a,c,d){return a?d(this.text(a)):b},sortResults:function(a){return a},formatResultCssClass:function(a){return a.css},formatSelectionCssClass:function(){return b},minimumResultsForSearch:0,minimumInputLength:0,maximumInputLength:null,maximumSelectionSize:0,id:function(a){return a==b?null:a.id},text:function(b){return b&&this.data&&this.data.text?a.isFunction(this.data.text)?this.data.text(b):b[this.data.text]:b.text
23
- },matcher:function(a,b){return o(""+b).toUpperCase().indexOf(o(""+a).toUpperCase())>=0},separator:",",tokenSeparators:[],tokenizer:M,escapeMarkup:F,blurOnChange:!1,selectOnBlur:!1,adaptContainerCssClass:function(a){return a},adaptDropdownCssClass:function(){return null},nextSearchTerm:function(){return b},searchInputPlaceholder:"",createSearchChoicePosition:"top",shouldFocusInput:function(a){var b="ontouchstart"in window||navigator.msMaxTouchPoints>0;return b?a.opts.minimumResultsForSearch<0?!1:!0:!0}},a.fn.select2.locales=[],a.fn.select2.locales.en={formatMatches:function(a){return 1===a?"One result is available, press enter to select it.":a+" results are available, use up and down arrow keys to navigate."},formatNoMatches:function(){return"No matches found"},formatAjaxError:function(){return"Loading failed"},formatInputTooShort:function(a,b){var c=b-a.length;return"Please enter "+c+" or more character"+(1==c?"":"s")},formatInputTooLong:function(a,b){var c=a.length-b;return"Please delete "+c+" character"+(1==c?"":"s")},formatSelectionTooBig:function(a){return"You can only select "+a+" item"+(1==a?"":"s")},formatLoadMore:function(){return"Loading more results\u2026"},formatSearching:function(){return"Searching\u2026"}},a.extend(a.fn.select2.defaults,a.fn.select2.locales.en),a.fn.select2.ajaxDefaults={transport:a.ajax,params:{type:"GET",cache:!1,dataType:"json"}},window.Select2={query:{ajax:G,local:H,tags:I},util:{debounce:w,markMatch:E,escapeMarkup:F,stripDiacritics:o},"class":{"abstract":c,single:d,multi:e}}}}(jQuery);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/classes/admin/settings/assets/js/select2/select2.png DELETED
Binary file
trunk/classes/admin/settings/assets/js/select2/select2x2.png DELETED
Binary file
trunk/classes/admin/settings/assets/js/sf-jquery.js DELETED
@@ -1,23 +0,0 @@
1
- jQuery(document).ready(function () {
2
-
3
- jQuery(".sf-tips").tooltip({ animation: true, html: true, delay: { show: 300, hide: 100 } });
4
-
5
-
6
- //This if statement checks if the color picker widget exists within jQuery UI
7
- //If it does exist then we initialize the WordPress color picker on our text input field
8
- if (typeof jQuery.wp === 'object' && typeof jQuery.wp.wpColorPicker === 'function') {
9
- jQuery('.colorpick').wpColorPicker();
10
- } else {
11
- // Color picker
12
- jQuery('.colorpick').each(function () {
13
- jQuery('.colorpickdiv', jQuery(this).parent()).farbtastic(this);
14
- jQuery(this).click(function () {
15
- if (jQuery(this).val() == "") jQuery(this).val('#');
16
- jQuery('.colorpickdiv', jQuery(this).parent()).show();
17
- });
18
- });
19
- jQuery(document).mousedown(function () {
20
- jQuery('.colorpickdiv').hide();
21
- });
22
- }
23
- });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/classes/admin/settings/assets/js/wcvendors-media.js DELETED
@@ -1,52 +0,0 @@
1
- jQuery( function( $ ){
2
-
3
- var id;
4
-
5
- // Iterate over all instances of the uploader on the page
6
- $('.wcv-img-id').each( function () {
7
-
8
- id = $( this ).data( 'id' );
9
-
10
- // Handle Add banner
11
- $( '#wcv-add-' + id ).on( 'click', function(e) {
12
- e.preventDefault();
13
- file_uploader( id );
14
- return false;
15
- });
16
-
17
- });
18
-
19
- function file_uploader( id )
20
- {
21
-
22
- var media_uploader, json;
23
-
24
- if (undefined !== media_uploader ) {
25
- media_uploader.open();
26
- return;
27
- }
28
-
29
- media_uploader = wp.media({
30
- title: $( '#wcv-add-' + id ).data('window_title'),
31
- button: {
32
- text: $( '#wcv-add-' + id ).data('save_button'),
33
- },
34
- multiple: false // Set to true to allow multiple files to be selected
35
- });
36
-
37
- media_uploader.on( 'select' , function(){
38
-
39
- json = media_uploader.state().get('selection').first().toJSON();
40
-
41
- if ( 0 > $.trim( json.url.length ) ) {
42
- return;
43
- }
44
-
45
- $( '.wcv-image-container-' + id ).prop( 'src', json.sizes.full.url );
46
- $( '#' + id ).val( json.sizes.full.url );
47
-
48
- });
49
-
50
- media_uploader.open();
51
- }
52
- });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/classes/admin/settings/classes/sf-class-format-options.php DELETED
@@ -1,347 +0,0 @@
1
- <?php
2
-
3
- /**
4
- * Format an options array into HTML
5
- * This class has been deprecated
6
- *
7
- * @author Matt Gates <http://mgates.me>
8
- * @package WordPress
9
- */
10
-
11
-
12
- if ( !class_exists( 'SF_Format_Options' ) ) {
13
-
14
- class SF_Format_Options extends SF_Settings_API
15
- {
16
-
17
- /**
18
- * Format an option array into HTML
19
- *
20
- *
21
- * @access public
22
- *
23
- * @param unknown $setting
24
- *
25
- * @return string HTML.
26
- */
27
- public function settings_options_format( $setting )
28
- {
29
- if ( empty( $setting ) ) return false;
30
-
31
- $defaults = apply_filters( $this->id . '_options_defaults', array(
32
- 'name' => '',
33
- 'desc' => '',
34
- 'placeholder' => '',
35
- 'class' => '',
36
- 'tip' => '',
37
- 'id' => '',
38
- 'css' => '',
39
- 'type' => 'text',
40
- 'std' => '',
41
- 'select2' => false,
42
- 'multiple' => false,
43
- 'options' => array(),
44
- 'restrict' => array(),
45
- 'settings' => array()
46
- ) );
47
-
48
- // Each to it's own variable for slim-ness' sakes.
49
- $setting = shortcode_atts( $defaults, $setting );
50
-
51
- $restrict_defaults = array(
52
- 'min' => 0,
53
- 'max' => '',
54
- 'step' => 'any',
55
- );
56
-
57
- $setting[ 'restrict' ] = shortcode_atts( $restrict_defaults, $setting[ 'restrict' ] );
58
-
59
- $setting[ 'value' ] = $this->get_option( $setting[ 'id' ] );
60
- $setting[ 'value' ] = $setting[ 'value' ] !== false ? maybe_unserialize( $setting[ 'value' ] ) : false;
61
- $setting[ 'value' ] = SF_Format_Options::sanitize_value( $setting[ 'value' ], $setting );
62
-
63
- $setting[ 'title' ] = $setting[ 'name' ];
64
- $setting[ 'name' ] = $this->id . "_options[{$setting['id']}]";
65
-
66
- $setting[ 'grouped' ] = !$setting[ 'title' ] ? ' style="padding-top:0px;"' : '';
67
- $setting[ 'tip' ] = SF_Format_Options::get_formatted_tip( $setting[ 'tip' ] );
68
-
69
- $header_types = apply_filters( $this->id . '_options_header_types', array( 'heading', 'title' ) );
70
-
71
- extract( $setting );
72
-
73
- $description = $desc && !$grouped && $type != 'checkbox'
74
- ? '<br /><small>' . $desc . '</small>'
75
- : '<label for="' . $id . '"> ' . $desc . '</label>';
76
-
77
- $description = ( ( in_array( $type, $header_types ) || $type == 'radio' ) && !empty( $desc ) )
78
- ? '<p>' . $desc . '</p>'
79
- : $description;
80
-
81
- ?>
82
-
83
- <?php if ( !in_array( $type, $header_types ) ) : ?>
84
- <!-- Header of the option. -->
85
- <tr valign="top">
86
- <th scope="row"<?php echo $grouped; ?>>
87
-
88
- <?php echo $tip; ?>
89
-
90
- <?php if ( !$grouped ) : ?>
91
- <label for="<?php echo $name; ?>" class="description"><?php echo $title; ?></label>
92
- <?php endif; ?>
93
-
94
- </th>
95
- <td <?php echo $grouped; ?> >
96
- <?php endif; ?>
97
-
98
- <?php foreach ( $header_types as $header ) :
99
- if ( $type != $header ) continue; ?>
100
- <tr>
101
- <th scope="col" colspan="2">
102
- <h3 class="title"><?php echo $title; ?></h3>
103
- <?php echo $description; ?>
104
- </th>
105
- </tr>
106
- <?php endforeach; ?>
107
-
108
- <?php switch ( $type ) :
109
-
110
- case 'text' :
111
- case 'color' :
112
- case 'number' :
113
- if ( $type == 'color' ) {
114
- $type = 'text';
115
- $class .= ' colorpick';
116
- $description .= '<div id="colorPickerDiv_' . $id . '" class="colorpickdiv" style="z-index: 100;background:#eee;border:1px solid #ccc;position:absolute;display:none;"></div>';
117
- }
118
- ?>
119
- <input name="<?php echo $name; ?>"
120
- id="<?php echo $id; ?>"
121
- type="<?php echo $type; ?>"
122
-
123
- <?php if ( $type == 'number' ): ?>
124
- min="<?php echo $restrict[ 'min' ]; ?>"
125
- max="<?php echo $restrict[ 'max' ]; ?>"
126
- step="<?php echo $restrict[ 'step' ]; ?>"
127
- <?php endif; ?>
128
-
129
- class="regular-text <?php echo $class; ?>"
130
- style="<?php echo $css; ?>"
131
- placeholder="<?php echo $placeholder; ?>"
132
- value="<?php echo $value !== false ? $value : $std; ?>"
133
- />
134
- <?php echo $description;
135
- break;
136
-
137
- case 'checkbox':
138
-
139
- $selected = ( $value !== false ) ? $value : $std;
140
-
141
- if ( $multiple ) :
142
-
143
- foreach ( $options as $key => $desc ) : ?>
144
-
145
- <input name="<?php echo $name; ?><?php echo $multiple ? '[]' : ''; ?>"
146
- id="<?php echo $id . '_' . $key; ?>"
147
- type="checkbox"
148
- class="<?php echo $class; ?>"
149
- style="<?php echo $css; ?>"
150
- value="<?php echo $key; ?>"
151
- <?php self::checked( $value, $key ); ?>
152
- />
153
- <label for="<?php echo $id . '_' . $key; ?>">
154
- <?php echo $desc; ?>
155
- </label>
156
- <br/>
157
- <?php
158
-
159
- endforeach;
160
-
161
- else : ?>
162
-
163
- <input name="<?php echo $name; ?>"
164
- id="<?php echo $id ?>"
165
- type="checkbox"
166
- class="<?php echo $class; ?>"
167
- style="<?php echo $css; ?>"
168
- <?php checked( $selected, 1 ); ?>
169
- />
170
- <?php echo $description;
171
- endif;
172
- break;
173
-
174
- case 'radio':
175
-
176
- $selected = ( $value !== false ) ? $value : $std;
177
-
178
- foreach ( $options as $key => $val ) : ?>
179
- <label class="radio">
180
- <input type="radio"
181
- name="<?php echo $name; ?>"
182
- id="<?php echo $key; ?>"
183
- value="<?php echo $key; ?>"
184
- class="<?php echo $class; ?>"
185
- <?php checked( $selected, $key ); ?>
186
- />
187
- <?php echo $val; ?>
188
- </label><br/>
189
- <?php endforeach;
190
- echo $description;
191
- break;
192
-
193
- case 'single_select_page':
194
-
195
- $selected = ( $value !== false ) ? $value : $std;
196
-
197
- $args = array(
198
- 'name' => $name,
199
- 'id' => $id,
200
- 'sort_order' => 'ASC',
201
- 'echo' => 0,
202
- 'selected' => $selected
203
- );
204
-
205
- echo str_replace( "'>", "'><option></option>", wp_dropdown_pages( $args ) );
206
-
207
- echo $description;
208
-
209
- if ( $select2 ) : ?>
210
- <script type="text/javascript">jQuery(function () {
211
- jQuery("#<?php echo $id; ?>").select2({ allowClear: true, placeholder: "<?php _e( 'Select a page...', 'wcvendors' ); ?>", width: '350px' });
212
- });</script>
213
- <?php endif;
214
-
215
- break;
216
-
217
- case 'select':
218
-
219
- $selected = ( $value !== false ) ? $value : $std;
220
- $options = apply_filters( $this->id . '_select_options', $options, $setting ); ?>
221
-
222
- <select id="<?php echo $id; ?>"
223
- class="<?php echo $class; ?>"
224
- style="<?php echo $css; ?>"
225
- name="<?php echo $name; ?><?php echo $multiple ? '[]' : ''; ?>"
226
- <?php echo $multiple ? 'multiple="multiple"' : ''; ?>>
227
-
228
- <?php foreach ( $options as $key => $val ) : ?>
229
- <option
230
- value="<?php echo $key; ?>" <?php self::selected( $selected, $key ); ?>><?php echo $val; ?></option>
231
- <?php endforeach; ?>
232
- </select>
233
-
234
- <?php echo $description;
235
-
236
- if ( $select2 ) : ?>
237
- <script type="text/javascript">jQuery(function () {
238
- jQuery("#<?php echo $id; ?>").select2({ width: '350px' });
239
- });</script>
240
- <?php endif;
241
-
242
- break;
243
-
244
- case 'textarea':
245
- ?>
246
- <textarea name="<?php echo $name; ?>"
247
- id="<?php echo $id; ?>"
248
- class="large-text <?php echo $class; ?>"
249
- style="<?php if ( $css ) echo $css; else echo 'width:300px;'; ?>"
250
- placeholder="<?php echo $placeholder; ?>"
251
- rows="3"
252
- ><?php echo ( $value !== false ) ? $value : $std; ?></textarea>
253
- <?php echo $description;
254
- break;
255
-
256
- case 'wysiwyg':
257
- wp_editor( $value, $id, array( 'textarea_name' => $name ) );
258
- echo $description;
259
- break;
260
-
261
- default :
262
- do_action( $this->id . '_options_type_' . $type, $setting );
263
- break;
264
-
265
- endswitch;
266
-
267
- /* Footer of the option. */
268
- if ( !in_array( $type, $header_types ) ) echo '</td></tr>';
269
-
270
- }
271
-
272
-
273
- /**
274
- *
275
- *
276
- * @param unknown $haystack
277
- * @param unknown $current
278
- */
279
- private function selected( $haystack, $current )
280
- {
281
-
282
- if ( is_array( $haystack ) && in_array( $current, $haystack ) ) {
283
- $current = $haystack = 1;
284
- }
285
-
286
- selected( $haystack, $current );
287
- }
288
-
289
-
290
- /**
291
- *
292
- *
293
- * @param unknown $haystack
294
- * @param unknown $current
295
- */
296
- private function checked( $haystack, $current )
297
- {
298
-
299
- if ( is_array( $haystack ) && !empty( $haystack[ $current ] ) ) {
300
- $current = $haystack = 1;
301
- }
302
-
303
- checked( $haystack, $current );
304
- }
305
-
306
-
307
- /**
308
- * Format a tooltip given a string
309
- *
310
- * @param string $tip
311
- *
312
- * @return string
313
- */
314
- private function get_formatted_tip( $tip )
315
- {
316
- return $tip ? sprintf( '<a href="#" title="%s" class="sf-tips" tabindex="99"></a>', $tip ) : '';
317
- }
318
-
319
-
320
- /**
321
- *
322
- *
323
- * @param unknown $value
324
- * @param unknown $setting
325
- *
326
- * @return unknown
327
- */
328
- private function sanitize_value( $value, $setting )
329
- {
330
- if ( $value !== false && $setting[ 'type' ] != 'wysiwyg' ) {
331
- if ( is_array( $value ) ) {
332
- foreach ( $value as $key => $output ) {
333
- $value[ $key ] = esc_attr( $output );
334
- }
335
- } else {
336
- $value = esc_attr( $value );
337
- }
338
- }
339
-
340
- return apply_filters( $this->id . '_options_sanitize_value', $value, $setting );
341
- }
342
-
343
-
344
- }
345
-
346
-
347
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/classes/admin/settings/classes/sf-class-sanitize.php DELETED
@@ -1,199 +0,0 @@
1
- <?php
2
-
3
- /**
4
- * Sanitize filters
5
- *
6
- * @author Matt Gates <http://mgates.me>
7
- * @package WordPress
8
- */
9
-
10
-
11
- if ( !class_exists( 'SF_Sanitize' ) ) {
12
-
13
- class SF_Sanitize
14
- {
15
-
16
-
17
- /**
18
- * Hooks
19
- */
20
- function __construct()
21
- {
22
- add_filter( 'geczy_sanitize_color', 'sanitize_text_field' );
23
- add_filter( 'geczy_sanitize_text', 'sanitize_text_field' );
24
- add_filter( 'geczy_sanitize_number', array( 'SF_Sanitize', 'sanitize_number_field' ) );
25
- add_filter( 'geczy_sanitize_textarea', array( 'SF_Sanitize', 'sanitize_textarea' ) );
26
- add_filter( 'geczy_sanitize_wysiwyg', array( 'SF_Sanitize', 'sanitize_wysiwyg' ) );
27
- add_filter( 'geczy_sanitize_checkbox', array( 'SF_Sanitize', 'sanitize_checkbox' ), 10, 2 );
28
- add_filter( 'geczy_sanitize_radio', array( 'SF_Sanitize', 'sanitize_enum' ), 10, 2 );
29
- add_filter( 'geczy_sanitize_select', array( 'SF_Sanitize', 'sanitize_enum' ), 10, 2 );
30
- add_filter( 'geczy_sanitize_image', array( 'SF_Sanitize', 'sanitize_image_url' ), 10, 2 );
31
- add_filter( 'geczy_sanitize_single_select_page', array( 'SF_Sanitize', 'sanitize_select_pages' ), 10, 2 );
32
- add_filter( 'geczy_sanitize_multi_select_page', array( 'SF_Sanitize', 'sanitize_multi_pages' ), 10, 2 );
33
- }
34
-
35
-
36
- /**
37
- * Numeric sanitization
38
- *
39
- * @param int $input
40
- *
41
- * @return int
42
- */
43
- public static function sanitize_number_field( $input )
44
- {
45
- $output = is_numeric( $input ) ? (float) $input : false;
46
-
47
- return $input;
48
- }
49
-
50
-
51
- /**
52
- * Textarea sanitization
53
- *
54
- * @param string $input
55
- *
56
- * @return string
57
- */
58
- public static function sanitize_textarea( $input )
59
- {
60
- global $allowedposttags;
61
- $output = wp_kses( $input, $allowedposttags );
62
-
63
- return $output;
64
- }
65
-
66
-
67
- /**
68
- * WYSIWYG sanitization
69
- *
70
- * @param string $input
71
- *
72
- * @return string
73
- */
74
- public static function sanitize_wysiwyg( $input )
75
- {
76
- return $input;
77
- }
78
-
79
-
80
- /**
81
- * Checkbox sanitization
82
- *
83
- * @param int $input
84
- * @param unknown $option
85
- *
86
- * @return int
87
- */
88
- public static function sanitize_checkbox( $input, $option )
89
- {
90
- if ( !empty( $option[ 'multiple' ] ) ) {
91
-
92
- $defaults = array_keys( $option[ 'options' ] );
93
-
94
- foreach ( $defaults as $value ) {
95
-
96
- if ( !is_array( $input ) ) {
97
- $output[ $value ] = 0;
98
- } else {
99
- $output[ $value ] = in_array( $value, $input ) ? 1 : 0;
100
- }
101
-
102
- }
103
-
104
- $output = serialize( $output );
105
- } else {
106
- $output = $input ? 1 : 0;
107
- }
108
-
109
- return $output;
110
- }
111
-
112
-
113
- /**
114
- * Array sanitization
115
- *
116
- * @param unknown $input
117
- * @param array $option
118
- *
119
- * @return bool
120
- */
121
- public static function sanitize_enum( $input, $option )
122
- {
123
- $output = $input;
124
-
125
- $sfs = new SF_Sanitize();
126
-
127
- if ( is_array( $input ) ) {
128
- foreach ( $input as $value ) {
129
- if ( !$sfs->sanitize_enum( $value, $option ) ) {
130
- $output = false;
131
- break;
132
- }
133
- }
134
- $output = $output ? serialize( $output ) : $output;
135
- } else {
136
- $output = array_key_exists( $input, $option[ 'options' ] ) ? $input : false;
137
- }
138
-
139
- return $output;
140
- }
141
-
142
-
143
- /**
144
- * Select box for pages sanitize
145
- *
146
- * @param int $input
147
- * @param int $option
148
- *
149
- * @return int
150
- */
151
- public static function sanitize_select_pages( $input, $option )
152
- {
153
- $output = get_page( $input ) ? (int) $input : 0;
154
-
155
- return $output;
156
- }
157
-
158
- /**
159
- * Select box for pages sanitize
160
- *
161
- * @param int $input
162
- * @param int $option
163
- *
164
- * @return int
165
- */
166
- public static function sanitize_multi_pages( $input, $option )
167
- {
168
-
169
- foreach ( $input as $value ){
170
- $output[ $value ] = get_page( $value ) ? (int) $value : 0;
171
- }
172
-
173
- // $output = serialize( $output );
174
-
175
-
176
- return $output;
177
- }
178
-
179
-
180
-
181
- /**
182
- * Image uploader
183
- *
184
- * @param url $input
185
- *
186
- * @return int
187
- */
188
- public static function sanitize_image_url( $input, $option ) {
189
-
190
- $output = $input;
191
- return $output;
192
-
193
- }
194
-
195
-
196
- }
197
-
198
-
199
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/classes/admin/settings/classes/sf-class-settings.php DELETED
@@ -1,978 +0,0 @@
1
- <?php
2
-
3
- /**
4
- * WP-Simple-Settings-Framework
5
- *
6
- * Copyright (c) 2012 Matt Gates.
7
- * All rights reserved.
8
- *
9
- * Redistribution and use in source and binary forms, with or without
10
- * modification, are permitted provided that the following conditions
11
- * are met:
12
- *
13
- * * Redistributions of source code must retain the above copyright
14
- * notice, this list of conditions and the following disclaimer.
15
- *
16
- * * Redistributions in binary form must reproduce the above copyright
17
- * notice, this list of conditions and the following disclaimer in
18
- * the documentation and/or other materials provided with the
19
- * distribution.
20
- *
21
- * * Neither the names of the copyright holders nor the names of the
22
- * contributors may be used to endorse or promote products derived
23
- * from this software without specific prior written permission.
24
- *
25
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
26
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
27
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
28
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
29
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
30
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
31
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
32
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
33
- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
34
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
35
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
36
- * POSSIBILITY OF SUCH DAMAGE.
37
- *
38
- * @subpackage WP-Simple-Settings-Framework
39
- * @copyright 2012 Matt Gates.
40
- * @license http://www.opensource.org/licenses/bsd-license.php BSD License
41
- * @link http://mgates.me
42
- * @version 1.1
43
- * @author Matt Gates <info@mgates.me>
44
- * @package WordPress
45
- */
46
-
47
-
48
- if ( !class_exists( 'SF_Settings_API' ) ) {
49
-
50
- class SF_Settings_API
51
- {
52
-
53
- private $data = array();
54
-
55
- /**
56
- * Init
57
- *
58
- * @param string $id
59
- * @param string $title
60
- * @param string $menu (optional)
61
- * @param string $file
62
- */
63
- public function __construct( $id, $title, $menu = '', $file )
64
- {
65
- $this->assets_url = trailingslashit( plugins_url( 'assets/', dirname( __FILE__ ) ) );
66
- $this->id = $id;
67
- $this->title = $title;
68
- $this->menu = empty( $menu ) ? 'plugins.php' : $menu;
69
-
70
- $this->file = $file;
71
-
72
- $this->includes();
73
- $this->actions();
74
- }
75
-
76
-
77
- // ==================================================================
78
- //
79
- // Getter and setter.
80
- //
81
- // ------------------------------------------------------------------
82
-
83
- /**
84
- * Setter
85
- *
86
- * @param unknown $name
87
- * @param unknown $value
88
- */
89
- public function __set( $name, $value )
90
- {
91
- if ( isset ( $this->data[ $name ] ) && is_array( $this->data[ $name ] ) ) {
92
- $this->data[ $name ] = array_merge( $this->data[ $name ], $value );
93
- } else {
94
- $this->data[ $name ] = $value;
95
- }
96
- }
97
-
98
-
99
- /**
100
- * Getter
101
- *
102
- * @param unknown $name
103
- *
104
- * @return unknown
105
- */
106
- public function __get( $name )
107
- {
108
- if ( array_key_exists( $name, $this->data ) ) {
109
- return $this->data[ $name ];
110
- }
111
-
112
- return null;
113
- }
114
-
115
-
116
- /**
117
- * Isset
118
- *
119
- * @param unknown $name
120
- *
121
- * @return unknown
122
- */
123
- public function __isset( $name )
124
- {
125
- return isset( $this->data[ $name ] );
126
- }
127
-
128
-
129
- /**
130
- * Unset
131
- *
132
- * @param unknown $name
133
- */
134
- public function __unset( $name )
135
- {
136
- unset( $this->data[ $name ] );
137
- }
138
-
139
-
140
- /**
141
- * Add a "Settings" link to the plugins.php page
142
- *
143
- * @param array $links
144
- * @param array $file
145
- *
146
- * @return array
147
- */
148
- public function add_settings_link( $links, $file )
149
- {
150
- $this_plugin = plugin_basename( $this->file );
151
- $page = strpos( $this->menu, '.php' ) ? $this->menu : 'admin.php';
152
- if ( $file == $this_plugin ) {
153
- $settings_link = '<a href="' . $page . '?page=' . $this->id . '">' . __( 'Settings', 'wcvendors' ) . '</a>';
154
- array_unshift( $links, $settings_link );
155
- }
156
-
157
- return $links;
158
- }
159
-
160
-
161
- // ==================================================================
162
- //
163
- // Begin initialization.
164
- //
165
- // ------------------------------------------------------------------
166
-
167
- /**
168
- * Core files
169
- */
170
- private function includes()
171
- {
172
- require_once dirname( __FILE__ ) . '/sf-class-sanitize.php';
173
- require_once dirname( __FILE__ ) . '/sf-class-format-options.php';
174
- new SF_Sanitize;
175
- }
176
-
177
-
178
- /**
179
- * Hooks
180
- */
181
- private function actions()
182
- {
183
- add_action( 'admin_enqueue_scripts', array( &$this, 'admin_enqueue_scripts' ) );
184
- add_action( 'admin_init', array( &$this, 'register_options' ) );
185
- add_action( 'admin_menu', array( &$this, 'create_menu' ) );
186
- add_filter( 'plugin_action_links', array( &$this, 'add_settings_link' ), 10, 2 );
187
- }
188
-
189
-
190
- /**
191
- * Admin scripts and styles
192
- */
193
- public function admin_enqueue_scripts()
194
- {
195
-
196
- $screen = get_current_screen();
197
- $screen_id = $screen->id;
198
-
199
- if ( $screen_id === 'woocommerce_page_wc_prd_vendor') {
200
- wp_register_script( 'bootstrap-tooltip', $this->assets_url . 'js/bootstrap-tooltip.js', array( 'jquery' ), '1.0' );
201
- wp_register_script( 'select2', $this->assets_url . 'js/select2/select2.min.js', array( 'jquery' ), '3.5.2' );
202
- wp_register_script( 'wcvendors-media', $this->assets_url . 'js/wcvendors-media.js', array( 'jquery' ), '1.0' );
203
- wp_register_script( 'sf-scripts', $this->assets_url . 'js/sf-jquery.js', array( 'jquery' ), '1.0' );
204
- wp_register_style( 'select2', $this->assets_url . 'js/select2/select2.css' );
205
- wp_register_style( 'sf-styles', $this->assets_url . 'css/sf-styles.css' );
206
- }
207
- }
208
-
209
-
210
- /**
211
- * Admin scripts and styles
212
- */
213
- public function admin_print_scripts()
214
- {
215
- global $wp_version;
216
-
217
- //Check wp version and load appropriate scripts for colorpicker.
218
- if ( 3.5 <= $wp_version ) {
219
- wp_enqueue_style( 'wp-color-picker' );
220
- wp_enqueue_script( 'wp-color-picker' );
221
- } else {
222
- wp_enqueue_style( 'farbtastic' );
223
- wp_enqueue_script( 'farbtastic' );
224
- }
225
-
226
- wp_enqueue_script( 'bootstrap-tooltip' );
227
- wp_enqueue_script( 'select2' );
228
- wp_enqueue_script( 'wcvendors-media' );
229
- wp_enqueue_script( 'sf-scripts' );
230
-
231
- wp_enqueue_style( 'wp-color-picker' );
232
- wp_enqueue_style( 'select2' );
233
- wp_enqueue_style( 'sf-styles' );
234
- }
235
-
236
-
237
- /**
238
- * Register setting
239
- */
240
- public function register_options()
241
- {
242
- register_setting( $this->id . '_options_nonce', $this->id . '_options', array( &$this, 'validate_options' ) );
243
- }
244
-
245
-
246
- /**
247
- * Create menu
248
- */
249
- public function create_menu()
250
- {
251
- $page = add_submenu_page( $this->menu, $this->title, $this->title, apply_filters( $this->id . '_manage_options', 'manage_options' ), $this->id, array( &$this, 'init_settings_page' ) );
252
- add_action( 'admin_print_scripts-' . $page, array( &$this, 'admin_print_scripts' ) );
253
- }
254
-
255
-
256
- /**
257
- * Parse options into tabbed organization
258
- *
259
- * @return array
260
- */
261
- private function parse_options()
262
- {
263
- $options = $this->options;
264
-
265
- foreach ( $options as $option ) {
266
-
267
- if ( $option[ 'type' ] == 'heading' ) {
268
- $tab_name = sanitize_title( $option[ 'name' ] );
269
- $this->tab_headers = array( $tab_name => $option[ 'name' ] );
270
-
271
- continue;
272
- }
273
-
274
- $option[ 'tab' ] = $tab_name;
275
- $tabs[ $tab_name ][ ] = $option;
276
-
277
- }
278
-
279
- $this->tabs = $tabs;
280
-
281
- return $tabs;
282
- }
283
-
284
-
285
- /**
286
- * Load the options array from a file
287
- *
288
- * @param string $option_file
289
- */
290
- public function load_options( $option_file )
291
- {
292
- if ( !empty( $this->options ) ) return;
293
-
294
- if ( file_exists( $option_file ) ) {
295
- require $option_file;
296
- $this->options = apply_filters( $this->id . '_options', $options );
297
- $this->parse_options();
298
-
299
- $this->current_options = $this->get_current_options();
300
-
301
- /* If the option has no saved data, load the defaults. */
302
- /* @TODO: Can prob add this to the activation hook. */
303
- $this->set_defaults( $this->current_options );
304
- } else {
305
- wp_die( __( 'Could not load settings at: ', 'wcvendors' ) . '<br/><code>' . $option_file . '</code>', __( 'Error - WP Settings Framework', 'wcvendors' ) );
306
- }
307
- }
308
-
309
-
310
- /**
311
- *
312
- *
313
- * @return unknown
314
- */
315
- public function get_current_options()
316
- {
317
- if ( !empty( $this->current_options ) )
318
- return $this->current_options;
319
-
320
- $options = get_option( $this->id . '_options' );
321
-
322
- if ( $options ) {
323
- $options = array_map( 'maybe_unserialize', $options );
324
- }
325
-
326
- return $options;
327
- }
328
-
329
-
330
- /**
331
- * Sanitize and validate post fields
332
- *
333
- * @param unknown $input
334
- *
335
- * @return unknown
336
- */
337
- public function validate_options( $input )
338
- {
339
- if ( !isset( $_POST[ 'update' ] ) )
340
- return $this->get_defaults();
341
-
342
- $clean = $this->current_options;
343
- $tabname = $_POST[ 'currentTab' ];
344
-
345
- foreach ( $this->tabs[ $tabname ] as $option ) :
346
-
347
- if ( !isset( $option[ 'id' ] ) )
348
- continue;
349
-
350
- if ( !isset( $option[ 'type' ] ) )
351
- continue;
352
-
353
- if ( $option[ 'type' ] == 'select' ) {
354
- $option[ 'options' ] = apply_filters( $this->id . '_select_options', $option[ 'options' ], $option );
355
- }
356
-
357
- $id = sanitize_text_field( strtolower( $option[ 'id' ] ) );
358
-
359
- // Set checkbox to false if it wasn't sent in the $_POST
360
- if ( 'checkbox' == $option[ 'type' ] && !isset( $input[ $id ] ) )
361
- $input[ $id ] = 0;
362
-
363
- // For a value to be submitted to database it must pass through a sanitization filter
364
- if ( has_filter( 'geczy_sanitize_' . $option[ 'type' ] ) ) {
365
- $clean[ $id ] = apply_filters( 'geczy_sanitize_' . $option[ 'type' ], $input[ $id ], $option );
366
- }
367
-
368
- endforeach;
369
-
370
- do_action( $this->id . '_options_updated', $clean, $tabname );
371
- add_settings_error( $this->id, 'save_options', __( 'Settings saved.', 'wcvendors' ), 'updated' );
372
-
373
- update_option( WC_Vendors::$id . '_flush_rules', true );
374
-
375
- return apply_filters( $this->id . '_options_on_update', $clean, $tabname );
376
- }
377
-
378
-
379
- /**
380
- * Create default options
381
- *
382
- * @param unknown $current_options (optional)
383
- */
384
- private function set_defaults( $current_options = array() )
385
- {
386
- $options = $this->get_defaults( $current_options );
387
- if ( $options ) {
388
- update_option( $this->id . '_options', $options );
389
- }
390
- }
391
-
392
-
393
- /**
394
- * Retrieve default options
395
- *
396
- * @param unknown $currents (optional)
397
- *
398
- * @return array
399
- */
400
- private function get_defaults( $currents = array() )
401
- {
402
- $output = array();
403
- $config = $this->options;
404
- $flag = false;
405
-
406
- if ( $currents ) {
407
- foreach ( $config as $value ) {
408
- if ( !isset( $value[ 'id' ] ) || !isset( $value[ 'std' ] ) || !isset( $value[ 'type' ] ) )
409
- continue;
410
-
411
- if ( !isset( $currents[ $value[ 'id' ] ] ) ) {
412
- $flag = true;
413
- }
414
- }
415
- }
416
-
417
- foreach ( $config as $option ) {
418
- if ( !isset( $option[ 'id' ] ) || !isset( $option[ 'std' ] ) || !isset( $option[ 'type' ] ) )
419
- continue;
420
-
421
- if ( $currents && isset( $currents[ $option[ 'id' ] ] ) ) {
422
- $output[ $option[ 'id' ] ] = $currents[ $option[ 'id' ] ];
423
- } else if ( has_filter( 'geczy_sanitize_' . $option[ 'type' ] ) ) {
424
- $output[ $option[ 'id' ] ] = apply_filters( 'geczy_sanitize_' . $option[ 'type' ], $option[ 'std' ], $option );
425
- }
426
- }
427
-
428
- if ( $currents ) {
429
- $output = array_merge( $currents, $output );
430
- }
431
-
432
- return !$flag && $currents ? array() : $output;
433
- }
434
-
435
-
436
- /**
437
- * HTML header
438
- */
439
- private function template_header()
440
- {
441
- ?>
442
- <div class="wrap">
443
- <?php screen_icon(); ?><h2><?php echo $this->title; ?></h2>
444
-
445
- <h2 class="nav-tab-wrapper">
446
- <?php echo $this->display_tabs(); ?>
447
- </h2><?php
448
-
449
- if ( !empty ( $_REQUEST[ 'settings-updated' ] ) )
450
- settings_errors();
451
-
452
- }
453
-
454
-
455
- /**
456
- * HTML body
457
- *
458
- * @return unknown
459
- */
460
- private function template_body()
461
- {
462
-
463
- if ( empty( $this->options ) ) return false;
464
-
465
-
466
- $options = $this->options;
467
- $tabs = $this->get_tabs();
468
- $tabname = !empty ( $_GET[ 'tab' ] ) ? $_GET[ 'tab' ] : $tabs[ 0 ][ 'slug' ];
469
-
470
- $options = apply_filters( $this->id . '_options_tab-' . $tabname, $this->tabs[ $tabname ] ); ?>
471
-
472
- <form method="post" action="options.php">
473
- <?php settings_fields( $this->id . '_options_nonce' ); ?>
474
- <table class="form-table">
475
-
476
- <?php
477
- foreach ( $options as $value ) :
478
- $this->settings_options_format( $value );
479
- endforeach;
480
-
481
- do_action( $this->id . '_options_tab-' . $tabname );
482
- ?>
483
-
484
- </table>
485
-
486
- <p class="submit">
487
- <input type="hidden" name="currentTab" value="<?php echo $tabname; ?>">
488
- <input type="submit" name="update" class="button-primary"
489
- value="<?php echo sprintf( __( 'Save %s changes', 'wcvendors' ), $this->tab_headers[ $tabname ] ); ?>"/>
490
- </p>
491
- </form> <?php
492
-
493
- }
494
-
495
-
496
- /**
497
- * HTML footer
498
- */
499
- private function template_footer()
500
- {
501
-
502
- $message = apply_filters( 'wcvendors_footer_msg', __( 'Please help with a <a href="https://wordpress.org/support/view/plugin-reviews/wc-vendors?rate=5#postform" target="top">High Five!</a> | <a href="https://www.wcvendors.com/product/wc-vendors-pro/" target="top">WC Vendors Pro</a> | <a href="https://www.wcvendors.com/product/stripe-commissions-gateway/" target="top">Stripe Commissions & Gateway</a> | <a href="https://www.wcvendors.com/kb/" target="top">KnowledgeBase</a> | <a href="https://www.wcvendors.com/help/" target="top">Help Forums</a>', 'wcvendors' ) );
503
-
504
- echo '<div><p>' . $message . '</a></p>';
505
- echo '</div>';
506
-
507
-
508
- }
509
-
510
-
511
- /**
512
- * Create the settings page
513
- */
514
- public function init_settings_page()
515
- {
516
-
517
- $this->template_header();
518
- $this->template_body();
519
- $this->template_footer();
520
-
521
- }
522
-
523
-
524
- /**
525
- * Retrieve tabs
526
- *
527
- * @return array
528
- */
529
- private function get_tabs()
530
- {
531
- $tabs = array();
532
- foreach ( $this->options as $option ) {
533
-
534
- if ( $option[ 'type' ] != 'heading' )
535
- continue;
536
-
537
- $option[ 'slug' ] = sanitize_title( $option[ 'name' ] );
538
- unset( $option[ 'type' ] );
539
-
540
- $tabs[ ] = $option;
541
- }
542
-
543
- return $tabs;
544
- }
545
-
546
-
547
- /**
548
- * Heading for navigation
549
- *
550
- * @return string
551
- */
552
- private function display_tabs()
553
- {
554
- $tabs = $this->get_tabs();
555
- $tabname = !empty ( $_GET[ 'tab' ] ) ? $_GET[ 'tab' ] : $tabs[ 0 ][ 'slug' ];
556
- $menu = '';
557
-
558
- foreach ( $tabs as $tab ) {
559
- $class = $tabname == $tab[ 'slug' ] ? 'nav-tab-active' : '';
560
-
561
- $fields = array(
562
- 'page' => $this->id,
563
- 'tab' => $tab[ 'slug' ],
564
- );
565
-
566
- $query = http_build_query( array_merge( $_GET, $fields ) );
567
- $menu .= sprintf( '<a id="%s-tab" class="nav-tab %s" title="%s" href="?%s">%s</a>', $tab[ 'slug' ], $class, $tab[ 'name' ], $query, esc_html( $tab[ 'name' ] ) );
568
- }
569
-
570
- return $menu;
571
- }
572
-
573
-
574
- /**
575
- * Update an option
576
- *
577
- * @param string $name
578
- * @param string $value
579
- *
580
- * @return bool
581
- */
582
- public function update_option( $name, $value )
583
- {
584
- // Overwrite the key/value pair
585
- $this->current_options = array( $name => $value ) + (array) $this->current_options;
586
-
587
- return update_option( $this->id . '_options', $this->current_options );
588
- }
589
-
590
-
591
- /**
592
- * Get an option
593
- *
594
- * @param string $name
595
- * @param string $default (optional)
596
- *
597
- * @return bool
598
- */
599
- public function get_option( $name, $default = false )
600
- {
601
- return isset( $this->current_options[ $name ] ) ? maybe_unserialize( $this->current_options[ $name ] ) : $default;
602
- }
603
-
604
-
605
- public function settings_options_format( $setting )
606
- {
607
- if ( empty( $setting ) ) return false;
608
-
609
- $defaults = apply_filters( $this->id . '_options_defaults', array(
610
- 'name' => '',
611
- 'desc' => '',
612
- 'placeholder' => '',
613
- 'class' => '',
614
- 'tip' => '',
615
- 'id' => '',
616
- 'css' => '',
617
- 'type' => 'text',
618
- 'std' => '',
619
- 'select2' => false,
620
- 'multiple' => false,
621
- 'options' => array(),
622
- 'restrict' => array(),
623
- 'settings' => array()
624
- ) );
625
-
626
- // Each to it's own variable for slim-ness' sakes.
627
- $setting = shortcode_atts( $defaults, $setting );
628
-
629
- $restrict_defaults = array(
630
- 'min' => 0,
631
- 'max' => '',
632
- 'step' => 'any',
633
- );
634
-
635
- $setting[ 'restrict' ] = shortcode_atts( $restrict_defaults, $setting[ 'restrict' ] );
636
-
637
- $setting[ 'value' ] = $this->get_option( $setting[ 'id' ] );
638
- $setting[ 'value' ] = $setting[ 'value' ] !== false ? maybe_unserialize( $setting[ 'value' ] ) : false;
639
- $setting[ 'value' ] = $this->sanitize_value( $setting[ 'value' ], $setting );
640
-
641
- $setting[ 'title' ] = $setting[ 'name' ];
642
- $setting[ 'name' ] = $this->id . "_options[{$setting['id']}]";
643
-
644
- $setting[ 'grouped' ] = !$setting[ 'title' ] ? ' style="padding-top:0px;"' : '';
645
- $setting[ 'tip' ] = $this->get_formatted_tip( $setting[ 'tip' ] );
646
-
647
- $header_types = apply_filters( $this->id . '_options_header_types', array( 'heading', 'title' ) );
648
-
649
- extract( $setting );
650
-
651
- $description = $desc && !$grouped && $type != 'checkbox'
652
- ? '<br /><small>' . $desc . '</small>'
653
- : '<label for="' . $id . '"> ' . $desc . '</label>';
654
-
655
- $description = ( ( in_array( $type, $header_types ) || $type == 'radio' ) && !empty( $desc ) )
656
- ? '<p>' . $desc . '</p>'
657
- : $description;
658
-
659
- ?>
660
-
661
- <?php if ( !in_array( $type, $header_types ) ) : ?>
662
- <!-- Header of the option. -->
663
- <tr valign="top">
664
- <th scope="row"<?php echo $grouped; ?>>
665
-
666
- <?php echo $tip; ?>
667
-
668
- <?php if ( !$grouped ) : ?>
669
- <label for="<?php echo $name; ?>" class="description"><?php echo $title; ?></label>
670
- <?php endif; ?>
671
-
672
- </th>
673
- <td <?php echo $grouped; ?> >
674
- <?php endif; ?>
675
-
676
- <?php foreach ( $header_types as $header ) :
677
- if ( $type != $header ) continue; ?>
678
- <tr>
679
- <th scope="col" colspan="2">
680
- <h3 class="title"><?php echo $title; ?></h3>
681
- <?php echo $description; ?>
682
- </th>
683
- </tr>
684
- <?php endforeach; ?>
685
-
686
- <?php switch ( $type ) :
687
-
688
- case 'text' :
689
- case 'color' :
690
- case 'number' :
691
- if ( $type == 'color' ) {
692
- $type = 'text';
693
- $class .= ' colorpick';
694
- $description .= '<div id="colorPickerDiv_' . $id . '" class="colorpickdiv" style="z-index: 100;background:#eee;border:1px solid #ccc;position:absolute;display:none;"></div>';
695
- }
696
- ?>
697
- <input name="<?php echo $name; ?>"
698
- id="<?php echo $id; ?>"
699
- type="<?php echo $type; ?>"
700
-
701
- <?php if ( $type == 'number' ): ?>
702
- min="<?php echo $restrict[ 'min' ]; ?>"
703
- max="<?php echo $restrict[ 'max' ]; ?>"
704
- step="<?php echo $restrict[ 'step' ]; ?>"
705
- <?php endif; ?>
706
-
707
- class="regular-text <?php echo $class; ?>"
708
- style="<?php echo $css; ?>"
709
- placeholder="<?php echo $placeholder; ?>"
710
- value="<?php echo $value !== false ? $value : $std; ?>"
711
- />
712
- <?php echo $description;
713
- break;
714
-
715
- case 'checkbox':
716
-
717
- $selected = ( $value !== false ) ? $value : $std;
718
-
719
- if ( $multiple ) :
720
-
721
- foreach ( $options as $key => $desc ) : ?>
722
-
723
- <input name="<?php echo $name; ?><?php echo $multiple ? '[]' : ''; ?>"
724
- id="<?php echo $id . '_' . $key; ?>"
725
- type="checkbox"
726
- class="<?php echo $class; ?>"
727
- style="<?php echo $css; ?>"
728
- value="<?php echo $key; ?>"
729
- <?php @checked( $selected[$key], 1 ); ?>
730
- />
731
- <label for="<?php echo $id . '_' . $key; ?>">
732
- <?php echo $desc; ?>
733
- </label>
734
- <br/>
735
- <?php
736
-
737
- endforeach;
738
-
739
- else : ?>
740
-
741
- <input name="<?php echo $name; ?>"
742
- id="<?php echo $id ?>"
743
- type="checkbox"
744
- class="<?php echo $class; ?>"
745
- style="<?php echo $css; ?>"
746
- <?php checked( $selected, 1 ); ?>
747
- />
748
- <?php echo $description;
749
- endif;
750
- break;
751
-
752
- case 'radio':
753
-
754
- $selected = ( $value !== false ) ? $value : $std;
755
-
756
- foreach ( $options as $key => $val ) : ?>
757
- <label class="radio">
758
- <input type="radio"
759
- name="<?php echo $name; ?>"
760
- id="<?php echo $key; ?>"
761
- value="<?php echo $key; ?>"
762
- class="<?php echo $class; ?>"
763
- <?php checked( $selected, $key ); ?>
764
- />
765
- <?php echo $val; ?>
766
- </label><br/>
767
- <?php endforeach;
768
- echo $description;
769
- break;
770
-
771
- case 'single_select_page':
772
-
773
- $selected = ( $value !== false ) ? $value : $std;
774
-
775
- if ( $value == 0 ) $selected = $std;
776
-
777
- $args = array(
778
- 'name' => $name,
779
- 'id' => $id,
780
- 'sort_order' => 'ASC',
781
- 'echo' => 0,
782
- 'selected' => $selected
783
- );
784
-
785
- echo str_replace( "'>", "'><option></option>", wp_dropdown_pages( $args ) );
786
-
787
- echo '<a href="post.php?post='.$selected.'&action=edit" class="button">'.__( 'Edit Page', 'wcvendors' ).'</a>';
788
- echo '<a href="'.get_permalink( $selected ). '" class="button">'.__( 'View Page', 'wcvendors' ).'</a>';
789
-
790
- echo $description;
791
-
792
- if ( $select2 ) : ?>
793
- <script type="text/javascript">jQuery(function () {
794
- jQuery("#<?php echo $id; ?>").select2({ allowClear: true, placeholder: "<?php _e( 'Select a page...', 'wcvendors' ); ?>", width: '350px', allowMultiple: true });
795
- });</script>
796
- <?php endif;
797
-
798
- break;
799
-
800
- case 'multi_select_page':
801
-
802
- // TODO get this working with multiple page selection
803
-
804
- $selected = ( $value !== false ) ? $value : $std;
805
- $selected = implode( ',', array_keys( $selected ) );
806
-
807
- if ( $value == 0 ) $selected = $std;
808
-
809
- $name = $name . '[]';
810
-
811
- $args = array(
812
- 'name' => $name,
813
- 'id' => $id,
814
- 'sort_order' => 'ASC',
815
- 'echo' => 0,
816
- 'selected' => $selected
817
- );
818
-
819
- echo str_replace( "'>", "' multiple=\"multiple\"><option></option>", wp_dropdown_pages( $args ) );
820
-
821
- echo '<a href="post.php?post='.$selected.'&action=edit" class="button">'.__( 'Edit Page', 'wcvendors' ).'</a>';
822
- echo '<a href="'.get_permalink( $selected ). '" class="button">'.__( 'View Page', 'wcvendors' ).'</a>';
823
-
824
- echo $description;
825
-
826
- if ( $select2 ) : ?>
827
- <script type="text/javascript">jQuery(function () {
828
- jQuery("#<?php echo $id; ?>").select2({ allowClear: true, placeholder: "<?php _e( 'Select a page...', 'wcvendors' ); ?>", width: '350px', allowMultiple: true });
829
- });</script>
830
- <?php endif;
831
-
832
- break;
833
-
834
-
835
- case 'select':
836
-
837
- $selected = ( $value !== false ) ? $value : $std;
838
- $options = apply_filters( $this->id . '_select_options', $options, $setting ); ?>
839
-
840
- <select id="<?php echo $id; ?>"
841
- class="<?php echo $class; ?>"
842
- style="<?php echo $css; ?>"
843
- name="<?php echo $name; ?><?php echo $multiple ? '[]' : ''; ?>"
844
- <?php echo $multiple ? 'multiple="multiple"' : ''; ?>>
845
-
846
- <?php foreach ( $options as $key => $val ) : ?>
847
- <option
848
- value="<?php echo $key; ?>" <?php self::selected( $selected, $key ); ?>><?php echo $val; ?></option>
849
- <?php endforeach; ?>
850
- </select>
851
-
852
- <?php echo $description;
853
-
854
- if ( $select2 ) : ?>
855
- <script type="text/javascript">jQuery(function () {
856
- jQuery("#<?php echo $id; ?>").select2({ width: '350px' });
857
- });</script>
858
- <?php endif;
859
-
860
- break;
861
-
862
- case 'textarea':
863
- ?>
864
- <textarea name="<?php echo $name; ?>"
865
- id="<?php echo $id; ?>"
866
- class="large-text <?php echo $class; ?>"
867
- style="<?php if ( $css ) echo $css; else echo 'width:300px;'; ?>"
868
- placeholder="<?php echo $placeholder; ?>"
869
- rows="3"
870
- ><?php echo ( $value !== false ) ? $value : $std; ?></textarea>
871
- <?php echo $description;
872
- break;
873
-
874
- case 'wysiwyg':
875
- wp_editor( $value, $id, array( 'textarea_name' => $name ) );
876
- echo $description;
877
- break;
878
-
879
- case 'image':
880
-
881
- if ( empty ( $value ) ) $value = $std;
882
-
883
- ?>
884
- <img class="wcv-image-container-<?php echo $id; ?>" src="<?php echo $value; ?>" alt="" style="max-width:100%;" />
885
- <br />
886
- <input id="wcv-add-<?php echo $id; ?>" type="button" class="<?php echo $class; ?>" value="<?php echo sprintf( __( 'Update %s', 'wcvendors' ), strtolower( $title ) ); ?>" data-id="<?php echo $id; ?>" data-save_button="<?php echo sprintf( __( 'Add %s', 'wcvendors' ), $title ); ?>" data-window_title="<?php echo sprintf( __( 'Add %s', 'wcvendors' ), strtolower( $title ) ); ?>" data-upload_notice="<?php echo sprintf( __( 'Upload an image for the %s', 'wcvendors' ), strtolower( $title ) ); ?>" />
887
- <input type="hidden" name="<?php echo $name; ?>" id="<?php echo $id; ?>" value="<?php echo $value; ?>">
888
- <?php
889
- break;
890
-
891
- default :
892
- do_action( $this->id . '_options_type_' . $type, $setting );
893
- break;
894
-
895
- endswitch;
896
-
897
- /* Footer of the option. */
898
- if ( !in_array( $type, $header_types ) ) echo '</td></tr>';
899
-
900
- }
901
-
902
-
903
- /**
904
- *
905
- *
906
- * @param unknown $haystack
907
- * @param unknown $current
908
- */
909
- private function selected( $haystack, $current )
910
- {
911
-
912
- if ( is_array( $haystack ) && in_array( $current, $haystack ) ) {
913
- $current = $haystack = 1;
914
- }
915
-
916
- selected( $haystack, $current );
917
- }
918
-
919
-
920
- /**
921
- *
922
- *
923
- * @param unknown $haystack
924
- * @param unknown $current
925
- */
926
- private function checked( $haystack, $current )
927
- {
928
-
929
- if ( is_array( $haystack ) && !empty( $haystack[ $current ] ) ) {
930
- $current = $haystack = 1;
931
- }
932
-
933
- checked( $haystack, $current );
934
- }
935
-
936
-
937
- /**
938
- * Format a tooltip given a string
939
- *
940
- * @param string $tip
941
- *
942
- * @return string
943
- */
944
- private function get_formatted_tip( $tip )
945
- {
946
- return $tip ? sprintf( '<a href="#" title="%s" class="sf-tips" tabindex="99"></a>', $tip ) : '';
947
- }
948
-
949
-
950
- /**
951
- *
952
- *
953
- * @param unknown $value
954
- * @param unknown $setting
955
- *
956
- * @return unknown
957
- */
958
- private function sanitize_value( $value, $setting )
959
- {
960
- if ( $value !== false && $setting[ 'type' ] != 'wysiwyg' ) {
961
- if ( is_array( $value ) ) {
962
- foreach ( $value as $key => $output ) {
963
- $value[ $key ] = esc_attr( $output );
964
- }
965
- } else {
966
- $value = esc_attr( $value );
967
- }
968
- }
969
-
970
- return apply_filters( $this->id . '_options_sanitize_value', $value, $setting );
971
- }
972
-
973
-
974
-
975
- }
976
-
977
-
978
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/classes/admin/settings/sf-options.php DELETED
@@ -1,363 +0,0 @@
1
- <?php
2
- $options = array();
3
-
4
- $options[ ] = array( 'name' => __( 'General', 'wcvendors' ), 'type' => 'heading' );
5
- $options[ ] = array( 'name' => __( 'General options', 'wcvendors' ), 'type' => 'title', 'desc' => '' );
6
-
7
- $options[ ] = array(
8
- 'name' => __( 'Default commission (%)', 'wcvendors' ),
9
- 'desc' => __( 'The default rate you pay each vendor for a product sale. <br>You can also give vendors their own individual commission rates by editing the vendors user account.<br>Also, you can edit an individual products commission to override both of these settings on a per product basis.', 'wcvendors' ),
10
- 'id' => 'default_commission',
11
- 'css' => 'width:70px;',
12
- 'type' => 'number',
13
- 'restrict' => array(
14
- 'min' => 0,
15
- 'max' => 100
16
- )
17
- );
18
-
19
- /* Customize registration message depending on if they have registration enabled on the my account page */
20
- $registration_message = __( 'Allow users or guests to apply to become a vendor', 'wcvendors' );
21
- if ( get_option( 'woocommerce_enable_myaccount_registration' ) === 'no' ) {
22
- $registration_message = __( 'Allow users or guests to apply to become a vendor. <br><br><strong>WARNING:</strong> You MUST "<strong>Enable registration on the "My Account" page</strong>" in your <strong>WooCommerce > Settings > Accounts</strong> page for this option to work. Currently, you have registration disabled.', 'wcvendors' );
23
- }
24
-
25
- $options[ ] = array(
26
- 'name' => __( 'Registration', 'wcvendors' ),
27
- 'desc' => __( 'Allow users or guests to apply to become a vendor', 'wcvendors' ),
28
- 'tip' => __( 'This will show a checkbox on the My Account page\'s registration form asking if the user would like to apply to be a vendor. Also, on the Vendor Dashboard, users can still apply to become a vendor even if this is disabled.', 'wcvendors' ),
29
- 'id' => 'show_vendor_registration',
30
- 'type' => 'checkbox',
31
- 'std' => true,
32
- );
33
-
34
- $options[ ] = array(
35
- 'desc' => __( 'Approve vendor applications manually', 'wcvendors' ),
36
- 'tip' => __( 'With this unchecked, all vendor applications are automatically accepted. Otherwise, you must approve each manually.', 'wcvendors' ),
37
- 'id' => 'manual_vendor_registration',
38
- 'type' => 'checkbox',
39
- 'std' => true,
40
- );
41
-
42
- $options[ ] = array(
43
- 'name' => __( 'Taxes', 'wcvendors' ),
44
- 'desc' => __( 'Give vendors any tax collected per-product', 'wcvendors' ),
45
- 'tip' => __( 'The tax collected on a vendor\'s product will be given in its entirety', 'wcvendors' ),
46
- 'id' => 'give_tax',
47
- 'type' => 'checkbox',
48
- 'std' => false,
49
- );
50
-
51
- $options[ ] = array(
52
- 'name' => __( 'Shipping', 'wcvendors' ),
53
- 'desc' => __( 'Give vendors any shipping collected per-product', 'wcvendors' ),
54
- 'tip' => __( 'WC Vendors Free - Give vendors shipping if using Per Product Shipping gateway. WC Vendors Pro - Give vendors shipping when using Vendor Shipping. No other shipping module is compatible with this option.', 'wcvendors' ),
55
- 'id' => 'give_shipping',
56
- 'type' => 'checkbox',
57
- 'std' => true,
58
- );
59
-
60
- $options[ ] = array( 'name' => __( 'Shop options', 'wcvendors' ), 'type' => 'title', 'desc' => '' );
61
-
62
- $options[ ] = array(
63
- 'name' => __( 'Shop HTML', 'wcvendors' ),
64
- 'desc' => __( 'Enable HTML for a vendor\'s shop description by default. You can enable or disable this per vendor by editing the vendors user account.', 'wcvendors' ),
65
- 'id' => 'shop_html_enabled',
66
- 'type' => 'checkbox',
67
- 'std' => true,
68
- );
69
-
70
- $options[ ] = array(
71
- 'name' => __( 'Vendor Shop Page', 'wcvendors' ),
72
- 'desc' => __( 'Enter one word for the URI. If you enter "<strong>vendors</strong>" your vendors store will be <code>yourdomain.com/vendors/store-name/</code>', 'wcvendors' ),
73
- 'id' => 'vendor_shop_permalink',
74
- 'type' => 'text',
75
- 'std' => 'vendors/',
76
- );
77
-
78
- $options[ ] = array(
79
- 'name' => __( 'Shop Headers', 'wcvendors' ),
80
- 'desc' => __( 'Enable vendor shop headers', 'wcvendors' ),
81
- 'tip' => __( 'This will override the HTML Shop description output on product-archive pages. In order to customize the shop headers visit wcvendors.com and read the article in the Knowledgebase titled Changing the Vendor Templates.', 'wcvendors' ),
82
- 'id' => 'shop_headers_enabled',
83
- 'type' => 'checkbox',
84
- 'std' => false,
85
- );
86
-
87
- $options[ ] = array(
88
- 'name' => __( 'Vendor Display Name', 'wcvendors' ),
89
- 'desc' => __( 'Select what will be displayed for the sold by text throughout the store.', 'wcvendors' ),
90
- 'id' => 'vendor_display_name',
91
- 'type' => 'select',
92
- 'options' => array(
93
- 'display_name' => __( 'Display Name', 'wcvendors'),
94
- 'shop_name' => __( 'Shop Name', 'wcvendors'),
95
- 'user_login' => __( 'User Login', 'wcvendors'),
96
- 'user_email' => __( 'User Email', 'wcvendors'),
97
- ),
98
- 'std' => 'shop_name'
99
-
100
- );
101
-
102
- $options[ ] = array(
103
- 'name' => __( 'Sold By', 'wcvendors' ),
104
- 'desc' => __( 'Enable sold by labels', 'wcvendors' ),
105
- 'tip' => __( 'This will enable or disable the sold by labels.', 'wcvendors' ),
106
- 'id' => 'sold_by',
107
- 'type' => 'checkbox',
108
- 'std' => true,
109
- );
110
-
111
- $options[ ] = array(
112
- 'name' => __( 'Sold By Label', 'wcvendors' ),
113
- 'desc' => __( 'The sold by label used on the site and emails.', 'wcvendors' ),
114
- 'id' => 'sold_by_label',
115
- 'type' => 'text',
116
- 'std' => __( 'Sold By', 'wcvendors' ),
117
- );
118
-
119
- $options[ ] = array(
120
- 'name' => __( 'Seller Info Label', 'wcvendors' ),
121
- 'desc' => __( 'The seller info tab title on the single product page.', 'wcvendors' ),
122
- 'id' => 'seller_info_label',
123
- 'type' => 'text',
124
- 'std' => __( 'Seller Info', 'wcvendors' ),
125
- );
126
-
127
- $options[ ] = array( 'name' => __( 'Products', 'wcvendors' ), 'type' => 'heading' );
128
- $options[ ] = array( 'name' => __( 'Product Add Page', 'wcvendors' ), 'type' => 'title', 'desc' => __( 'Configure what to hide from all vendors when adding a product', 'wcvendors' ) );
129
-
130
- $options[ ] = array(
131
- 'name' => __( 'Left side panel', 'wcvendors' ),
132
- 'desc' => __( 'CHECKING these boxes will **HIDE** these areas of the add product page for vendors', 'wcvendors' ),
133
- 'id' => 'hide_product_panel',
134
- 'options' => array(
135
- 'inventory' => __( 'Inventory', 'wcvendors' ),
136
- 'shipping' => __( 'Shipping', 'wcvendors' ),
137
- 'linked_product' => __( 'Linked Products', 'wcvendors' ),
138
- 'attribute' => __( 'Attributes', 'wcvendors' ),
139
- 'advanced' => __( 'Advanced', 'wcvendors' ),
140
- ),
141
- 'type' => 'checkbox',
142
- 'multiple' => true,
143
- );
144
-
145
- $options[ ] = array(
146
- 'name' => __( 'Types', 'wcvendors' ),
147
- 'desc' => __( 'CHECKING these boxes will HIDE these product types from the vendor', 'wcvendors' ),
148
- 'id' => 'hide_product_types',
149
- 'options' => array(
150
- 'simple' => __( 'Simple', 'wcvendors' ),
151
- 'variable' => __( 'Variable', 'wcvendors' ),
152
- 'grouped' => __( 'Grouped', 'wcvendors' ),
153
- 'external' => __( 'External / affiliate', 'wcvendors' ),
154
- ),
155
- 'type' => 'checkbox',
156
- 'multiple' => true,
157
- );
158
-
159
- $options[ ] = array(
160
- 'name' => __( 'Type options', 'wcvendors' ),
161
- 'desc' => __( 'CHECKING these boxes will **HIDE** these product options from the vendor', 'wcvendors' ),
162
- 'id' => 'hide_product_type_options',
163
- 'options' => array(
164
- 'virtual' => __( 'Virtual', 'wcvendors' ),
165
- 'downloadable' => __( 'Downloadable', 'wcvendors' ),
166
- ),
167
- 'type' => 'checkbox',
168
- 'multiple' => true,
169
- );
170
-
171
- $options[ ] = array(
172
- 'name' => __( 'Miscellaneous', 'wcvendors' ),
173
- 'id' => 'hide_product_misc',
174
- 'options' => array(
175
- 'taxes' => __( 'Taxes', 'wcvendors' ),
176
- 'sku' => __( 'SKU', 'wcvendors' ),
177
- 'featured' => __( 'Featured', 'wcvendors' ),
178
- 'duplicate' => __( 'Duplicate Product', 'wcvendors' ),
179
- ),
180
- 'type' => 'checkbox',
181
- 'multiple' => true,
182
- );
183
-
184
- $options[ ] = array(
185
- 'name' => __( 'Stylesheet', 'wcvendors' ),
186
- 'desc' => __( 'You can add CSS in this textarea, which will be loaded on the product add/edit page for vendors.', 'wcvendors' ),
187
- 'id' => 'product_page_css',
188
- 'type' => 'textarea',
189
- );
190
-
191
-
192
- $options[ ] = array( 'name' => __( 'Capabilities', 'wcvendors' ), 'type' => 'heading', 'id' => 'capabilities' );
193
- $options[ ] = array( 'name' => __( 'Permissions', 'wcvendors' ), 'id' => 'permissions', 'type' => 'title', 'desc' => __( 'General permissions used around the shop', 'wcvendors' ) );
194
-
195
- $options[ ] = array(
196
- 'name' => __( 'Orders', 'wcvendors' ),
197
- 'desc' => __( 'View orders', 'wcvendors' ),
198
- 'tip' => __( 'Show customer details such as email, address, name, etc, for each order', 'wcvendors' ),
199
- 'id' => 'can_show_orders',
200
- 'type' => 'checkbox',
201
- 'std' => true,
202
- );
203
-
204
- $options[ ] = array(
205
- 'desc' => __( 'View comments', 'wcvendors' ),
206
- 'tip' => __( 'View all vendor comments for an order on the frontend', 'wcvendors' ),
207
- 'id' => 'can_view_order_comments',
208
- 'type' => 'checkbox',
209
- 'std' => true,
210
- );
211
-
212
- $options[ ] = array(
213
- 'desc' => __( 'Submit comments', 'wcvendors' ),
214
- 'tip' => __( 'Submit comments for an order on the frontend. Eg, tracking ID for a product', 'wcvendors' ),
215
- 'id' => 'can_submit_order_comments',
216
- 'type' => 'checkbox',
217
- 'std' => true,
218
- );
219
-
220
- $options[ ] = array(
221
- 'desc' => __( 'View email addresses', 'wcvendors' ),
222
- 'tip' => __( 'While viewing order details on the frontend, you can disable or enable email addresses', 'wcvendors' ),
223
- 'id' => 'can_view_order_emails',
224
- 'type' => 'checkbox',
225
- 'std' => true,
226
- );
227
-
228
- $options[ ] = array(
229
- 'desc' => __( 'Export a CSV file of orders for a product', 'wcvendors' ),
230
- 'tip' => __( 'Vendors could export orders for a product on the frontend', 'wcvendors' ),
231
- 'id' => 'can_export_csv',
232
- 'type' => 'checkbox',
233
- 'std' => true,
234
- );
235
-
236
- $options[ ] = array(
237
- 'name' => __( 'Reports', 'wcvendors' ),
238
- 'desc' => __( '<strike>View backend sales reports</strike>. <strong>Depreciated</strong>', 'wcvendors' ),
239
- 'tip' => __( 'This option has been removed and will no longer function. It will be completely removed in future versions. Vendors should use their Vendor Dashboard for reports as all identical functionality is already there. ', 'wcvendors' ),
240
- 'id' => 'can_view_backend_reports',
241
- 'type' => 'checkbox',
242
- 'std' => false,
243
- );
244
-
245
- $options[ ] = array(
246
- 'desc' => __( 'View Frontend sales reports', 'wcvendors' ),
247
- 'tip' => __( 'Sales table on the frontend on the Vendor Dashboard page. The table will only display sales data that pertain to their products, and only for orders that are processing or completed.', 'wcvendors' ),
248
- 'id' => 'can_view_frontend_reports',
249
- 'type' => 'checkbox',
250
- 'std' => true,
251
- );
252
-
253
- $options[ ] = array(
254
- 'name' => __( 'Products', 'wcvendors' ),
255
- 'desc' => __( 'Submit products', 'wcvendors' ),
256
- 'tip' => __( 'Check to allow vendors to list new products. Admin must approve new products by editing the product, and clicking Publish.', 'wcvendors' ),
257
- 'id' => 'can_submit_products',
258
- 'type' => 'checkbox',
259
- 'std' => true,
260
- );
261
-
262
- $options[ ] = array(
263
- 'desc' => __( 'Edit live products', 'wcvendors' ),
264
- 'tip' => __( 'Vendors could edit an approved product after it has already gone live. There is no approval or review after editing a live product. This could be dangerous with malicious vendors, so take caution.', 'wcvendors' ),
265
- 'id' => 'can_edit_published_products',
266
- 'type' => 'checkbox',
267
- 'std' => false,
268
- );
269
-
270
- $options[ ] = array(
271
- 'desc' => __( 'Submit products live without requiring approval', 'wcvendors' ),
272
- 'tip' => __( 'Vendors can submit products without review or approval from a shop admin. This could be dangerous with malicious vendors, so take caution.', 'wcvendors' ),
273
- 'id' => 'can_submit_live_products',
274
- 'type' => 'checkbox',
275
- 'std' => false,
276
- );
277
-
278
- $options[ ] = array( 'name' => __( 'Pages', 'wcvendors' ), 'type' => 'heading' );
279
- $options[ ] = array( 'name' => __( 'Page configuration', 'wcvendors' ), 'type' => 'title', 'desc' => '' );
280
-
281
- $options[ ] = array(
282
- 'name' => __( 'Vendor dashboard', 'wcvendors' ),
283
- 'desc' => __( 'Choose the page that has the shortcode <code>[wcv_vendor_dashboard]</code><br/>. If this page is not set, you will break your site. If you upgrade to Pro, keep this page unchanged as both Pro Dashboard and this Dashboard page must be set.', 'wcvendors' ),
284
- 'id' => 'vendor_dashboard_page',
285
- 'type' => 'single_select_page',
286
- 'select2' => true,
287
- );
288
-
289
- $options[ ] = array(
290
- 'name' => __( 'Shop settings', 'wcvendors' ),
291
- 'desc' => __( 'Choose the page that has the shortcode <code>[wcv_shop_settings]</code><br/>These are the shop settings a vendor can configure. By default, Vendor Dashboard > Shop Settings should have this shortcode.', 'wcvendors' ),
292
- 'id' => 'shop_settings_page',
293
- 'type' => 'single_select_page',
294
- 'select2' => true,
295
- );
296
-
297
- $options[ ] = array(
298
- 'name' => __( 'Orders page', 'wcvendors' ),
299
- 'desc' => __( 'Choose the page that has the shortcode <code>[wcv_orders]</code><br/>By default, Vendor Dashboard > Orders should have the shortcode.', 'wcvendors' ),
300
- 'id' => 'product_orders_page',
301
- 'type' => 'single_select_page',
302
- 'select2' => true,
303
- );
304
-
305
- $options[ ] = array(
306
- 'name' => __( 'Vendor terms', 'wcvendors' ),
307
- 'desc' => __( 'These terms are shown to a user when submitting an application to become a vendor.<br/>If left blank, no terms will be shown to the applicant. Vendor must accept terms in order to register, if set.', 'wcvendors' ),
308
- 'id' => 'terms_to_apply_page',
309
- 'type' => 'single_select_page',
310
- 'select2' => true,
311
- );
312
-
313
- $total_due = 0;
314
- if ( !empty( $_GET[ 'tab' ] ) && $_GET[ 'tab' ] == __( 'payments', 'wcvendors' ) ) {
315
- global $wpdb;
316
-
317
- $table_name = $wpdb->prefix . "pv_commission";
318
- $query = "SELECT sum(total_due + total_shipping + tax) as total
319
- FROM `{$table_name}`
320
- WHERE status = %s";
321
- $results = $wpdb->get_results( $wpdb->prepare( $query, 'due' ) );
322
-
323
- $total_due = array_shift( $results )->total;
324
- }
325
- $options[ ] = array( 'name' => __( 'Payments', 'wcvendors' ), 'type' => 'heading' );
326
- $options[ ] = array(
327
- 'name' => __( 'PayPal Adaptive Payments Scheduling', 'wcvendors' ), 'type' => 'title', 'desc' =>
328
- sprintf( __( 'Total commission currently due: %s. <a href="%s">View details</a>.', 'wcvendors' ), !function_exists( 'wc_price' ) ? $total_due : wc_price( $total_due ), '?page=pv_admin_commissions' ) .
329
- '<br/><br/>' . sprintf( __( 'Make sure you update your PayPal Adaptive Payments settings <a href="%s">here</a>. <br><br>To instantly pay with Adaptive Payments you must activate the PayPal AP gateway in your Checkout settings. <br><a href="https://www.wcvendors.com/kb/configuring-paypal-adaptive-payments/" target="top">PayPal AP Application Help</a>. <br><br>Another gateway that offers instant payments to vendors that also accepts credit cards directly on your checkout page is Stripe. <br><a href="https://www.wcvendors.com/product/stripe-commissions-gateway/" target="top">Stripe Commissions & Gateway plugin</a> is $49 and specifically coded for WC Vendors and <a href="https://www.wcvendors.com/product/wc-vendors-pro/" target="top">WC Vendors Pro</a>.', 'wcvendors' ), 'admin.php?page=wc-settings&tab=checkout&section=wc_paypalap' )
330
- );
331
-
332
- $options[ ] = array(
333
- 'name' => __( 'Instant pay', 'wcvendors' ),
334
- 'desc' => __( 'Instantly pay vendors their commission when an order is made, and if a vendor has a valid PayPal email added on their Shop Settings page.', 'wcvendors' ),
335
- 'tip' => __( 'For this to work, customers must checkout with the PayPal Adaptive Payments gateway. Using any other gateways will not pay vendors instantly', 'wcvendors' ),
336
- 'id' => 'instapay',
337
- 'type' => 'checkbox',
338
- 'std' => true,
339
- );
340
-
341
- $options[ ] = array(
342
- 'name' => __( 'Payment schedule', 'wcvendors' ),
343
- 'desc' => __( 'Note: Schedule will only work if instant pay is unchecked', 'wcvendors' ),
344
- 'id' => 'schedule',
345
- 'type' => 'radio',
346
- 'std' => 'manual',
347
- 'options' => array(
348
- 'daily' => __( 'Daily', 'wcvendors' ),
349
- 'weekly' => __( 'Weekly', 'wcvendors' ),
350
- 'biweekly' => __( 'Biweekly', 'wcvendors' ),
351
- 'monthly' => __( 'Monthly', 'wcvendors' ),
352
- 'manual' => __( 'Manual', 'wcvendors' ),
353
- 'now' => '<span style="color:green;"><strong>' . __( 'Now', 'wcvendors' ) . '</strong></span>',
354
- )
355
- );
356
-
357
- $options[ ] = array(
358
- 'name' => __( 'Email notification', 'wcvendors' ),
359
- 'desc' => __( 'Send the WooCommerce admin an email each time a payment has been made via the payment schedule options above', 'wcvendors' ),
360
- 'id' => 'mail_mass_pay_results',
361
- 'type' => 'checkbox',
362
- 'std' => true,
363
- );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/classes/admin/views/html-vendor-settings-page.php DELETED
@@ -1,76 +0,0 @@
1
- <div class="wrap">
2
- <h2>Shop Settings</h2>
3
- <table class="form-table">
4
-
5
- <form method="post">
6
- <?php do_action( 'wcvendors_settings_before_paypal' );
7
-
8
- if ( $paypal_address !== 'false' ) { ?>
9
-
10
- <tr>
11
- <th><?php _e( 'PayPal Address', 'wcvendors' ); ?></th>
12
- <td><input type="email" name="pv_paypal" id="pv_paypal" placeholder="some@email.com"
13
- value="<?php echo get_user_meta( $user_id, 'pv_paypal', true ); ?>"/>
14
- <p class="description">
15
- <?php _e( 'Your PayPal address is used to send you your commission.', 'wcvendors' ); ?><br/>
16
- </p>
17
- </td>
18
- </tr>
19
- <?php } ?>
20
- <?php do_action( 'wcvendors_settings_after_paypal' ); ?>
21
- <tr>
22
- <th><?php _e( 'Shop Name', 'wcvendors' ); ?></th>
23
- <td><input type="text" name="pv_shop_name" id="pv_shop_name" placeholder="Your shop name" value="<?php echo get_user_meta( $user_id, 'pv_shop_name', true ); ?>"/>
24
- <p class="description"><?php _e( 'Your shop name is public and must be unique.', 'wcvendors' ); ?></p>
25
- </td>
26
- </tr>
27
- <?php do_action( 'wcvendors_settings_after_shop_name' ); ?>
28
-
29
- <tr>
30
- <th><?php echo apply_filters( 'wcvendors_seller_info_label', __( 'Seller info', 'wcvendors' ) ); ?></th>
31
- <td><?php
32
-
33
- if ( $global_html || $has_html ) {
34
- $old_post = $GLOBALS[ 'post' ];
35
- $GLOBALS[ 'post' ] = 0;
36
- wp_editor( $seller_info, 'pv_seller_info' );
37
- $GLOBALS[ 'post' ] = $old_post;
38
- } else {
39
- ?><textarea class="large-text" rows="10" id="pv_seller_info_unhtml" style="width:95%"
40
- name="pv_seller_info"><?php echo $seller_info; ?></textarea><?php
41
- }
42
- ?>
43
- <p class="description"><?php _e( 'This is displayed on each of your products.', 'wcvendors' ); ?></p>
44
- </td>
45
- </tr>
46
- <?php do_action( 'wcvendors_settings_after_seller_info' ); ?>
47
- <?php if ( $shop_description !== 'false' ) { ?>
48
- <tr>
49
- <th><?php _e( 'Shop Description', 'wcvendors' ); ?></th>
50
- <td><?php
51
-
52
- if ( $global_html || $has_html ) {
53
- $old_post = $GLOBALS[ 'post' ];
54
- $GLOBALS[ 'post' ] = 0;
55
- wp_editor( $description, 'pv_shop_description' );
56
- $GLOBALS[ 'post' ] = $old_post;
57
- } else {
58
- ?><textarea class="large-text" rows="10" id="pv_shop_description_unhtml" style="width:95%" name="pv_shop_description"><?php echo $description; ?></textarea><?php
59
- }
60
- ?>
61
- <p class="description"><?php printf( __( 'This is displayed on your <a href="%s">shop page</a>.', 'wcvendors' ), $shop_page ); ?></p>
62
- </td>
63
- </tr>
64
-
65
- <?php do_action( 'wcvendors_settings_after_shop_description' ); ?>
66
- <?php } ?>
67
- <?php wp_nonce_field( 'save-shop-settings-admin', 'wc-vendors-nonce' ); ?>
68
- <tr>
69
- <td colspa="2">
70
- <input type="submit" class="button button-primary" name="vendor_application_submit" value="<?php _e( 'Save Shop Settings', 'wcvendors' ); ?>"/>
71
- </td>
72
- </tr>
73
- </form>
74
- </table>
75
- </div>
76
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/classes/class-commission.php DELETED
@@ -1,537 +0,0 @@
1
- <?php
2
-
3
- /**
4
- * Commission functions
5
- *
6
- * @author Matt Gates <http://mgates.me>
7
- * @package ProductVendor
8
- */
9
-
10
-
11
- class WCV_Commission
12
- {
13
-
14
-
15
- /**
16
- * Constructor
17
- */
18
- function __construct()
19
- {
20
- $this->completed_statuses = apply_filters( 'wcvendors_completed_statuses', array(
21
- 'completed',
22
- 'processing',
23
- ) );
24
-
25
- $this->reverse_statuses = apply_filters( 'wcvendors_reversed_statuses', array(
26
- 'pending',
27
- 'refunded',
28
- 'cancelled',
29
- 'failed',
30
- ) );
31
-
32
- $this->check_order_reverse();
33
- $this->check_order_complete();
34
-
35
- // Reverse the commission if the order is deleted
36
- add_action( 'delete_post', array( $this, 'commissions_table_sync' ), 10 );
37
- }
38
-
39
-
40
- /**
41
- * Run actions when an order is reversed
42
- */
43
- public function check_order_reverse()
44
- {
45
- foreach ( $this->completed_statuses as $completed ) {
46
- foreach ( $this->reverse_statuses as $reversed ) {
47
- add_action( "woocommerce_order_status_{$completed}_to_{$reversed}", array( 'WCV_Commission', 'reverse_due_commission' ) );
48
- }
49
- }
50
- }
51
-
52
-
53
- /**
54
- * Runs only on a manual order update by a human
55
- */
56
- public function check_order_complete()
57
- {
58
- foreach ( $this->completed_statuses as $completed ) {
59
- add_action( 'woocommerce_order_status_' . $completed, array( 'WCV_Commission', 'log_commission_due' ) );
60
- }
61
- }
62
-
63
- public static function commission_status(){
64
-
65
- return apply_filters( 'wcvendors_commission_status', array(
66
- 'due' => __( 'Due', 'wcvendors' ),
67
- 'paid' => __( 'Paid', 'wcvendors' ),
68
- 'reversed' => __( 'Reversed', 'wcvendors' )
69
- )
70
- );
71
-
72
- }
73
-
74
-
75
- /**
76
- * Reverse commission for an entire order
77
- *
78
- * Only runs if the order has been logged in pv_commission table
79
- *
80
- * @param int $order_id
81
- *
82
- * @return unknown
83
- */
84
- public function reverse_due_commission( $order_id )
85
- {
86
- global $wpdb;
87
-
88
- // Check if this order exists
89
- $count = WCV_Commission::count_commission_by_order( $order_id );
90
- if ( !$count ) return false;
91
-
92
- // Deduct this amount from the vendor's total due
93
- $results = WCV_Commission::sum_total_due_for_order( $order_id );
94
- $ids = implode( ',', $results[ 'ids' ] );
95
- $table_name = $wpdb->prefix . "pv_commission";
96
-
97
- $query = "UPDATE `{$table_name}` SET `status` = '%s' WHERE id IN ({$ids})";
98
- $results = $wpdb->query( $wpdb->prepare( $query, 'reversed' ) );
99
-
100
- return $results;
101
- }
102
-
103
-
104
- /**
105
- * Store all commission due for an order
106
- *
107
- * @return bool
108
- *
109
- * @param int $order_id
110
- */
111
- public static function log_commission_due( $order_id )
112
- {
113
- global $woocommerce;
114
-
115
- $order = new WC_Order( $order_id );
116
- $dues = WCV_Vendors::get_vendor_dues_from_order( $order, false );
117
-
118
- foreach ( $dues as $vendor_id => $details ) {
119
-
120
- // Only process vendor commission
121
- if ( !WCV_Vendors::is_vendor( $vendor_id ) ) continue;
122
-
123
- // See if they currently have an amount due
124
- $due = WCV_Vendors::count_due_by_vendor( $vendor_id, $order_id );
125
- if ( $due > 0 ) continue;
126
-
127
- // Get the dues in an easy format for inserting to our table
128
- $insert_due = array();
129
-
130
- foreach ( $details as $key => $detail ) {
131
-
132
- $product_id = $detail['product_id'];
133
- $order_date = ( version_compare( WC_VERSION, '2.7', '<' ) ) ? $order->order_date : $order->get_date_created();
134
-
135
- $insert_due[ $product_id ] = array(
136
- 'order_id' => $order_id,
137
- 'vendor_id' => $vendor_id,
138
- 'product_id' => $product_id,
139
- 'total_due' => !empty( $insert_due[ $product_id ][ 'total_due' ] ) ? ( $detail[ 'commission' ] + $insert_due[ $product_id ][ 'total_due' ] ) : $detail[ 'commission' ],
140
- 'total_shipping' => !empty( $insert_due[ $product_id ][ 'total_shipping' ] ) ? ( $detail[ 'shipping' ] + $insert_due[ $product_id ][ 'total_shipping' ] ) : $detail[ 'shipping' ],
141
- 'tax' => !empty( $insert_due[ $product_id ][ 'tax' ] ) ? ( $detail[ 'tax' ] + $insert_due[ $product_id ][ 'tax' ] ) : $detail[ 'tax' ],
142
- 'qty' => !empty( $insert_due[ $product_id ][ 'qty' ] ) ? ( $detail[ 'qty' ] + $insert_due[ $product_id ][ 'qty' ] ) : $detail[ 'qty' ],
143
- 'time' => date( 'Y-m-d H:i:s', strtotime( $order_date ) ),
144
- );
145
- }
146
-
147
- if ( !empty( $insert_due ) ) {
148
- WCV_Commission::insert_new_commission( array_values( $insert_due ) );
149
- }
150
- }
151
-
152
- }
153
-
154
-
155
- /**
156
- * Add up the totals for an order for each vendor
157
- *
158
- * @param int $order_id
159
- *
160
- * @return array
161
- */
162
- public function sum_total_due_for_order( $order_id, $status = 'due' )
163
- {
164
- global $wpdb;
165
-
166
- $table_name = $wpdb->prefix . "pv_commission";
167
- $query = "SELECT `id`, `total_due`, `total_shipping`, `tax`, `vendor_id`
168
- FROM `{$table_name}`
169
- WHERE `order_id` = %d
170
- AND `status` = %s";
171
-
172
- $results = $wpdb->get_results( $wpdb->prepare( $query, $order_id, 'due' ) );
173
-
174
- foreach ( $results as $commission ) {
175
- $commission_ids[ ] = $commission->id;
176
-
177
- $pay[ $commission->vendor_id ] = !empty( $pay[ $commission->vendor_id ] )
178
- ? ( $pay[ $commission->vendor_id ] + ( $commission->total_due + $commission->total_shipping + $commission->tax ) )
179
- : ( $commission->total_due + $commission->total_shipping + $commission->tax );
180
- }
181
-
182
- $return = array(
183
- 'vendors' => $pay,
184
- 'ids' => $commission_ids,
185
- );
186
-
187
- return $return;
188
- }
189
-
190
-
191
- /**
192
- * Return all commission outstanding with a 'due' status
193
- *
194
- * @return object
195
- */
196
- public static function get_all_due()
197
- {
198
- global $wpdb;
199
-
200
- $table_name = $wpdb->prefix . "pv_commission";
201
- $where = $wpdb->prepare( 'WHERE status = %s', 'due' );
202
- $where = apply_filters( 'wcvendors_commission_all_due_where', $where );
203
- $query = "SELECT id, vendor_id, total_due FROM `{$table_name}` $where";
204
- $query = apply_filters( 'wcvendors_commission_all_due_sql', $query );
205
- $results = $wpdb->get_results( $query );
206
-
207
- return $results;
208
- }
209
-
210
-
211
- /**
212
- * Check if this order has commission logged already
213
- *
214
- * @param int $order_id
215
- *
216
- * @return int
217
- */
218
- public static function count_commission_by_order( $order_id )
219
- {
220
- global $wpdb;
221
- $table_name = $wpdb->prefix . "pv_commission";
222
-
223
- if ( is_array( $order_id ) )
224
- $order_id = implode( ',', $order_id );
225
-
226
- $query = "SELECT COUNT(order_id) AS order_count
227
- FROM {$table_name}
228
- WHERE order_id IN ($order_id)
229
- AND status <> %s";
230
- $count = $wpdb->get_var( $wpdb->prepare( $query, 'reversed' ) );
231
-
232
- return $count;
233
- }
234
-
235
- /**
236
- * Check the commission status for the order
237
- *
238
- * @param array $order
239
- * @param string $status
240
- *
241
- * @return int
242
- */
243
- public static function check_commission_status( $order, $status ) {
244
-
245
- global $wpdb;
246
-
247
- $table_name = $wpdb->prefix . "pv_commission";
248
-
249
- $order_id = $order[ 'order_id' ];
250
- $vendor_id = $order[ 'vendor_id' ];
251
- $product_id = $order[ 'product_id' ];
252
-
253
- $query = "SELECT count(order_id) AS order_count
254
- FROM {$table_name}
255
- WHERE order_id = {$order_id}
256
- AND vendor_id = {$vendor_id}
257
- AND product_id = {$product_id}
258
- AND status = %s
259
- ";
260
-
261
- return $wpdb->get_var( $wpdb->prepare( $query , $status ) );
262
-
263
- }
264
-
265
-
266
- /**
267
- * Product's commission rate in percentage form
268
- *
269
- * Eg: 50 for 50%
270
- *
271
- * @param int $product_id
272
- *
273
- * @return float
274
- */
275
- public static function get_commission_rate( $product_id )
276
- {
277
-
278
- $commission = 0;
279
-
280
- $parent = get_post_ancestors( $product_id );
281
- if ( $parent ) $product_id = $parent[ 0 ];
282
-
283
- $vendor_id = WCV_Vendors::get_vendor_from_product( $product_id );
284
-
285
- $product_commission = get_post_meta( $product_id, 'pv_commission_rate', true );
286
- $vendor_commission = WCV_Vendors::get_default_commission( $vendor_id );
287
- $default_commission = WC_Vendors::$pv_options->get_option( 'default_commission' );
288
-
289
- if ( $product_commission != '' && $product_commission !== false ) {
290
- $commission = $product_commission;
291
- }
292
-
293
- else if ( $vendor_commission != '' && $vendor_commission !== false ) {
294
- $commission = $vendor_commission;
295
- }
296
-
297
- else if ( $default_commission != '' && $default_commission !== false ) {
298
- $commission = $default_commission;
299
- }
300
-
301
- return apply_filters( 'wcv_commission_rate_percent', $commission, $product_id );
302
- }
303
-
304
-
305
- /**
306
- * Commission due for a product based on a rate and price
307
- *
308
- * @param float $product_price
309
- * @param unknown $product_id
310
- *
311
- * @return float
312
- */
313
- public static function calculate_commission( $product_price, $product_id, $order, $qty )
314
- {
315
- $commission_rate = WCV_Commission::get_commission_rate( $product_id );
316
- $commission = $product_price * ( $commission_rate / 100 );
317
- $commission = round( $commission, 2 );
318
-
319
- return apply_filters( 'wcv_commission_rate', $commission, $product_id, $product_price, $order, $qty );
320
- }
321
-
322
-
323
- /**
324
- * Log commission to the pv_commission table
325
- *
326
- * Will either update or insert to the database
327
- *
328
- * @param array $orders
329
- *
330
- * @return unknown
331
- */
332
- public static function insert_new_commission( $orders = array() )
333
- {
334
- global $wpdb;
335
-
336
- if ( empty( $orders ) ) return false;
337
-
338
- $table = $wpdb->prefix . "pv_commission";
339
-
340
- // Insert the time and default status 'due'
341
- foreach ( $orders as $key => $order ) {
342
- $orders[ $key ][ 'time' ] = $order['time'];
343
- $orders[ $key ][ 'status' ] = ( $order['total_due'] == 0 ) ? 'paid' : 'due';
344
- }
345
-
346
- foreach ( $orders as $key => $order ) {
347
- $where = array(
348
- 'order_id' => $order[ 'order_id' ],
349
- 'product_id' => $order[ 'product_id' ],
350
- 'vendor_id' => $order[ 'vendor_id' ],
351
- 'qty' => $order[ 'qty' ],
352
- );
353
- // Is the commission already paid?
354
- $count = WCV_Commission::check_commission_status( $order, 'paid' );
355
-
356
- if ( $count == 0 ) {
357
- $update = $wpdb->update( $table, $order, $where );
358
- if ( !$update ) $insert = $wpdb->insert( $table, $order );
359
- }
360
-
361
- }
362
-
363
- do_action( 'wcv_commissions_inserted', $orders );
364
- }
365
-
366
-
367
- /**
368
- * Set commission to 'paid' for an entire order
369
- *
370
- *
371
- * @access public
372
- *
373
- * @param mixed $order_id An array of Order IDs or an int.
374
- * @param unknown $column_ids (optional)
375
- *
376
- * @return bool.
377
- */
378
- public static function set_order_commission_paid( $order_id, $column_ids = false )
379
- {
380
- global $wpdb;
381
-
382
- $table_name = $wpdb->prefix . "pv_commission";
383
-
384
- if ( is_array( $order_id ) )
385
- $order_id = implode( ',', $order_id );
386
-
387
- $query = "UPDATE `{$table_name}` SET `status` = 'paid' WHERE order_id IN ($order_id)";
388
- $result = $wpdb->query( $query );
389
-
390
- return $result;
391
- }
392
-
393
-
394
- /**
395
- * Set commission to 'paid' for an entire order
396
- *
397
- *
398
- * @access public
399
- *
400
- * @param mixed $order_id An array of Order IDs or an int.
401
- *
402
- * @return bool.
403
- */
404
- public static function set_vendor_commission_paid( $vendors )
405
- {
406
- global $wpdb;
407
-
408
- $table_name = $wpdb->prefix . "pv_commission";
409
-
410
- if ( is_array( $vendors ) )
411
- $vendors = implode( ',', $vendors );
412
-
413
- $query = "UPDATE `{$table_name}` SET `status` = 'paid' WHERE vendor_id IN ($vendors)";
414
- $result = $wpdb->query( $query );
415
-
416
- return $result;
417
- }
418
-
419
-
420
- /**
421
- * Set commission to 'paid' for a specifc vendor
422
- *
423
- *
424
- * @access public
425
- *
426
- * @param int $vendor_id the vendor id
427
- * @param int $product_id the product id
428
- * @param int $order_id the order id
429
- *
430
- * @return bool.
431
- */
432
- public static function set_vendor_product_commission_paid( $vendor_id, $product_id, $order_id )
433
- {
434
- global $wpdb;
435
-
436
- $table_name = $wpdb->prefix . "pv_commission";
437
-
438
- $query = "UPDATE `{$table_name}` SET `status` = 'paid' WHERE vendor_id = $vendor_id AND order_id = $order_id AND product_id = $product_id";
439
- $result = $wpdb->query( $query );
440
-
441
- return $result;
442
- }
443
-
444
- /**
445
- * If an order is deleted reverse the commissions rows
446
- *
447
- * @since 1.9.2
448
- * @access public
449
- * @param int $order_id the order id
450
- *
451
- * @return bool.
452
- */
453
- public function commissions_table_sync( $order_id ){
454
-
455
- global $wpdb;
456
-
457
- // Check if this order exists in the commissions table
458
- $count = WCV_Commission::count_commission_by_order( $order_id );
459
- if ( !$count ) return false;
460
-
461
- $table_name = $wpdb->prefix . "pv_commission";
462
-
463
- $query = "UPDATE `{$table_name}` SET `status` = '%s' WHERE order_id = '%d'";
464
- $results = $wpdb->query( $wpdb->prepare( $query, 'reversed', $order_id ) );
465
-
466
-
467
- } // commissions_table_sync()
468
-
469
-
470
- /**
471
- * Get the commission total for a specific vendor.
472
- *
473
- * @since 1.9.6
474
- * @access public
475
- * @param int $vendor_id the vendor id to search for
476
- * @param string $status the status to look for
477
- * @return object $totals as an object
478
- */
479
- public static function commissions_now( $vendor_id, $status = 'due', $inc_shipping = false, $inc_tax = false ){
480
-
481
- global $wpdb;
482
-
483
- $table_name = $wpdb->prefix . "pv_commission";
484
-
485
- $sql = "SELECT sum( `total_due` ) as total_due";
486
-
487
- if ( $inc_shipping ) $sql .= ", sum( `total_shipping` ) as total_shipping";
488
- if ( $inc_tax ) $sql .= ", sum( `tax` ) as total_tax ";
489
-
490
- $sql .= "
491
- FROM `{$table_name}`
492
- WHERE vendor_id = {$vendor_id}
493
- AND status = '{$status}'
494
- ";
495
-
496
- $results = $wpdb->get_row( $sql );
497
-
498
- $commissions_now = array_filter( get_object_vars( $results ) );
499
-
500
- if ( empty( $commissions_now ) ) $results = false;
501
-
502
- return $results;
503
-
504
- } // commissions_now()
505
-
506
-
507
- /**
508
- * Get the commission for a specific order, product and vendor
509
- *
510
- * @since 1.9.9
511
- * @access public
512
- * @param int $order_id the order id to search for
513
- * @param int $product_id the product id to search for
514
- * @param int $vendor_id the vendor id to search for
515
- */
516
- public static function get_commission_due( $order_id, $product_id, $vendor_id ){
517
-
518
- global $wpdb;
519
-
520
- $table_name = $wpdb->prefix . "pv_commission";
521
-
522
- $sql = "SELECT total_due";
523
-
524
- $sql .= "
525
- FROM `{$table_name}`
526
- WHERE vendor_id = {$vendor_id}
527
- AND product_id = '{$product_id}'
528
- AND order_id = '{$order_id}'
529
- ";
530
-
531
- $commission_due = $wpdb->get_var( $sql );
532
-
533
- return $commission_due;
534
-
535
- } // get_commission_due()
536
-
537
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/classes/class-cron.php DELETED
@@ -1,171 +0,0 @@
1
- <?php
2
- /**
3
- * Cron class
4
- *
5
- * @package WC_Vendors
6
- */
7
-
8
-
9
- class WCV_Cron
10
- {
11
-
12
-
13
- /**
14
- * Constructor
15
- */
16
- function __construct()
17
- {
18
- add_filter( 'cron_schedules', array( 'WCV_Cron', 'custom_cron_intervals' ) );
19
- add_action( WC_Vendors::$id . '_options_updated', array( 'WCV_Cron', 'check_schedule' ) );
20
- add_filter( WC_Vendors::$id . '_options_on_update', array( 'WCV_Cron', 'check_schedule_now' ) );
21
- }
22
-
23
-
24
- /**
25
- * Re-add cron schedule when the settings have been updated
26
- *
27
- * @param array
28
- * @param unknown $options
29
- */
30
- public static function check_schedule( $options )
31
- {
32
- $old_interval = wp_get_schedule( 'pv_schedule_mass_payments' );
33
- $new_interval = $options[ 'schedule' ];
34
- $instapay = $options[ 'instapay' ];
35
-
36
- /**
37
- * 1. The user actually changed the schedule
38
- * 2. Instapay is turned off
39
- * 3. Manual was not selected
40
- */
41
- if ( ( $old_interval != $new_interval ) && !$instapay && $new_interval != 'manual' ) {
42
- WCV_Cron::remove_cron_schedule( $options );
43
- WCV_Cron::schedule_cron( $new_interval );
44
- }
45
-
46
- if ( $new_interval == 'manual' || $instapay ) {
47
- WCV_Cron::remove_cron_schedule( $options );
48
- }
49
-
50
- }
51
-
52
-
53
- /**
54
- * Check if the user chose "Now" on the Schedule settings
55
- *
56
- * @param array $options
57
- *
58
- * @return array
59
- */
60
- public static function check_schedule_now( $options )
61
- {
62
- $old_schedule = WC_Vendors::$pv_options->get_option( 'schedule' );
63
- $new_schedule = $options[ 'schedule' ];
64
-
65
- if ( $new_schedule == 'now' ) {
66
- $return = WCV_Cron::pay_now();
67
- $options[ 'schedule' ] = $old_schedule;
68
- WCV_Cron::schedule_cron( $old_schedule );
69
- add_settings_error( WC_Vendors::$pv_options->id, 'save_options', $return[ 'message' ], $return[ 'status' ] );
70
- }
71
-
72
- return $options;
73
- }
74
-
75
-
76
- /**
77
- * Pay all outstanding commission using Paypal Mass Pay
78
- *
79
- * @return array
80
- */
81
- public static function pay_now()
82
- {
83
- $mass_pay = new WCV_Mass_Pay;
84
- $mass_pay = $mass_pay->do_payments();
85
-
86
- $message = !empty( $mass_pay[ 'total' ] )
87
- ? $mass_pay[ 'msg' ] . '<br/>' . sprintf( __( 'Payment total: %s', 'wcvendors' ), wc_price( $mass_pay[ 'total' ] ) )
88
- : $mass_pay[ 'msg' ];
89
-
90
- return array(
91
- 'message' => $message,
92
- 'status' => $mass_pay[ 'status' ]
93
- );
94
- }
95
-
96
-
97
- /**
98
- * Remove the mass payments schedule
99
- *
100
- * @return bool
101
- */
102
- private static function remove_cron_schedule()
103
- {
104
- $timestamp = wp_next_scheduled( 'pv_schedule_mass_payments' );
105
-
106
- return wp_unschedule_event( $timestamp, 'pv_schedule_mass_payments' );
107
- }
108
-
109
-
110
- /**
111
- * Schedule a cron event on a specified interval
112
- *
113
- * @param string $interval
114
- *
115
- * @return bool
116
- */
117
- public static function schedule_cron( $interval )
118
- {
119
- // Scheduled event
120
- add_action( 'pv_schedule_mass_payments', array( 'WCV_Cron', 'pay_now' ) );
121
-
122
- // Schedule the event
123
- if ( !wp_next_scheduled( 'pv_schedule_mass_payments' ) ) {
124
- wp_schedule_event( time(), $interval, 'pv_schedule_mass_payments' );
125
-
126
- return true;
127
- }
128
-
129
- return false;
130
- }
131
-
132
-
133
- /**
134
- * Add new schedule intervals to WP
135
- *
136
- * Weekly
137
- * Biweekly
138
- * Monthly
139
- *
140
- * @param array $schedules
141
- *
142
- * @return array
143
- */
144
- public static function custom_cron_intervals( $schedules )
145
- {
146
-
147
- $schedules[ 'daily' ] = array(
148
- 'interval' => 86400,
149
- 'display' => __( 'Once Daily' )
150
- );
151
-
152
- $schedules[ 'weekly' ] = array(
153
- 'interval' => 604800,
154
- 'display' => __( 'Once Weekly' )
155
- );
156
-
157
- $schedules[ 'biweekly' ] = array(
158
- 'interval' => 1209600,
159
- 'display' => __( 'Once every two weeks' )
160
- );
161
-
162
- $schedules[ 'monthly' ] = array(
163
- 'interval' => 2635200,
164
- 'display' => __( 'Once a month' )
165
- );
166
-
167
- return $schedules;
168
- }
169
-
170
-
171
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/classes/class-install.php DELETED
@@ -1,286 +0,0 @@
1
- <?php
2
- /**
3
- * Install class on activation.
4
- *
5
- * @author Matt Gates <http://mgates.me>
6
- * @package ProductVendor
7
- */
8
-
9
-
10
- class WCV_Install
11
- {
12
-
13
- /**
14
- * Checks if install is requierd
15
- *
16
- * @return unknown
17
- */
18
- public function init()
19
- {
20
- $db_version = WC_Vendors::$pv_options->get_option( 'db_version' );
21
-
22
- // Initial Install
23
- if ( version_compare( $db_version, '1.0', '<' ) ) {
24
-
25
- $this->install_wcvendor();
26
- WC_Vendors::$pv_options->update_option( 'db_version', '1.5.0' );
27
-
28
- } else if ( version_compare( $db_version, '1.9.0', '<' ) ) {
29
-
30
- $orders_page = get_post( WC_Vendors::$pv_options->get_option( 'orders_page' ) );
31
-
32
- // Only update the page slug for orders if it is called orders
33
- // This is due to WC 2.6 api changes
34
- if ( is_object( $orders_page ) ) {
35
-
36
- if ( $orders_page && $orders_page->post_name === 'orders' ){
37
-
38
- wp_update_post(
39
- array (
40
- 'ID' => $orders_page->ID,
41
- 'post_name' => 'product_orders'
42
- )
43
- );
44
-
45
- WC_Vendors::$pv_options->update_option( 'db_version', '1.9.0' );
46
- }
47
- }
48
-
49
- } else if ( version_compare( $db_version, '1.9.1', '<' ) ) {
50
- remove_role( 'vendor' );
51
- add_role( 'vendor', __('Vendor', 'wcvendors') , array(
52
- 'assign_product_terms' => true,
53
- 'edit_products' => true,
54
- 'edit_product' => true,
55
- 'edit_published_products' => false,
56
- 'manage_product' => true,
57
- 'publish_products' => false,
58
- 'delete_posts' => true,
59
- 'read' => true,
60
- 'upload_files' => true,
61
- 'view_woocommerce_reports' => false,
62
- ) );
63
-
64
- WC_Vendors::$pv_options->update_option( 'db_version', '1.9.1' );
65
- }
66
-
67
- } // init()
68
-
69
-
70
- /**
71
- * Grouped functions for installing the WC Vendor plugin
72
- */
73
- private function install_wcvendor()
74
- {
75
- // Clear the cron
76
- wp_clear_scheduled_hook( 'pv_schedule_mass_payments' );
77
-
78
- // Add the vendors role
79
- $this->add_new_roles();
80
-
81
- // Create tables
82
- $this->create_new_tables();
83
-
84
- // Create the Orders page if it doesn't exist
85
- $orders_page = WC_Vendors::$pv_options->get_option( 'orders_page' );
86
- if ( empty( $orders_page ) ) $this->create_new_pages();
87
- }
88
-
89
-
90
- /**
91
- * Add the new Vendor role
92
- *
93
- * @return bool
94
- */
95
- private function add_new_roles()
96
- {
97
- remove_role( 'pending_vendor' );
98
- add_role( 'pending_vendor', __( 'Pending Vendor', 'wcvendors' ), array(
99
- 'read' => true,
100
- 'edit_posts' => false,
101
- 'delete_posts' => false
102
- ) );
103
-
104
- remove_role( 'vendor' );
105
- add_role( 'vendor', __('Vendor', 'wcvendors') , array(
106
- 'assign_product_terms' => true,
107
- 'edit_products' => true,
108
- 'edit_product' => true,
109
- 'edit_published_products' => false,
110
- 'manage_product' => true,
111
- 'publish_products' => false,
112
- 'delete_posts' => true,
113
- 'read' => true,
114
- 'upload_files' => true,
115
- 'view_woocommerce_reports' => false,
116
- ) );
117
- }
118
-
119
-
120
- /**
121
- * Create the pv_commission table
122
- */
123
- private function create_new_tables()
124
- {
125
- global $wpdb;
126
-
127
- $table_name = $wpdb->prefix . "pv_commission";
128
- require_once ABSPATH . 'wp-admin/includes/upgrade.php';
129
-
130
- $sql = "CREATE TABLE $table_name (
131
- id bigint(20) NOT NULL AUTO_INCREMENT,
132
- product_id bigint(20) NOT NULL,
133
- order_id bigint(20) NOT NULL,
134
- vendor_id bigint(20) NOT NULL,
135
- total_due decimal(20,2) NOT NULL,
136
- qty BIGINT( 20 ) NOT NULL,
137
- total_shipping decimal(20,2) NOT NULL,
138
- tax decimal(20,2) NOT NULL,
139
- status varchar(20) NOT NULL DEFAULT 'due',
140
- time datetime DEFAULT '0000-00-00 00:00:00' NOT NULL,
141
- UNIQUE KEY id (id)
142
- );";
143
- dbDelta( $sql );
144
- }
145
-
146
-
147
- /**
148
- * Create a page
149
- *
150
- * @access public
151
- * @return void
152
- *
153
- * @param mixed $slug Slug for the new page
154
- * @param mixed $option Option name to store the page's ID
155
- * @param string $page_title (optional) (default: '') Title for the new page
156
- * @param string $page_content (optional) (default: '') Content for the new page
157
- * @param int $post_parent (optional) (default: 0) Parent for the new page
158
- */
159
- function create_page( $slug, $page_title = '', $page_content = '', $post_parent = 0 )
160
- {
161
- global $wpdb;
162
-
163
- $page_id = WC_Vendors::$pv_options->get_option( $slug . '_page' );
164
-
165
- if ( $page_id > 0 && get_post( $page_id ) ) {
166
- return $page_id;
167
- }
168
-
169
- $page_found = $wpdb->get_var( $wpdb->prepare( "SELECT ID FROM " . $wpdb->posts . " WHERE post_name = %s LIMIT 1;", $slug ) );
170
- if ( $page_found ) {
171
- if ( !$page_id ) {
172
- WC_Vendors::$pv_options->update_option( $slug . '_page', $page_found );
173
-
174
- return $page_found;
175
- }
176
-
177
- return $page_id;
178
- }
179
-
180
- $page_data = array(
181
- 'post_status' => 'publish',
182
- 'post_type' => 'page',
183
- 'post_author' => 1,
184
- 'post_name' => $slug,
185
- 'post_title' => $page_title,
186
- 'post_content' => $page_content,
187
- 'post_parent' => $post_parent,
188
- 'comment_status' => 'closed'
189
- );
190
-
191
- $page_id = wp_insert_post( $page_data );
192
- WC_Vendors::$pv_options->update_option( $slug . '_page', $page_id );
193
-
194
- return $page_id;
195
- }
196
-
197
-
198
- /**
199
- * Create the Orders page for the frontend
200
- */
201
- private function create_new_pages()
202
- {
203
- global $wpdb;
204
-
205
- $vendor_page_id = $this->create_page( 'vendor_dashboard', __( 'Vendor Dashboard', 'wcvendors' ), '[wcv_vendor_dashboard]' );
206
- $this->create_page( 'product_orders', __( 'Orders', 'wcvendors' ), '[wcv_orders]', $vendor_page_id );
207
- $this->create_page( 'shop_settings', __( 'Shop Settings', 'wcvendors' ), '[wcv_shop_settings]', $vendor_page_id );
208
- }
209
-
210
-
211
- /**
212
- * Depreciated
213
- *
214
- * @param unknown $version
215
- */
216
- public function update_to( $version )
217
- {
218
- global $wpdb;
219
-
220
- $table_name = $wpdb->prefix . "pv_commission";
221
-
222
- switch ( $version ) {
223
-
224
- case '1.3.2':
225
-
226
- $sql = "ALTER TABLE `{$table_name}` ADD `qty` BIGINT( 20 ) NOT NULL AFTER `total_due`";
227
- $wpdb->query( $sql );
228
-
229
- $sql = "SELECT * FROM `{$table_name}`";
230
- $results = $wpdb->get_results( $sql );
231
- foreach ( $results as $key => $value ) {
232
-
233
- $order = new WC_Order( $value->order_id );
234
-
235
- foreach ( $order->get_items() as $o_key => $o_value ) {
236
-
237
- if ( $value->product_id == $o_value[ 'product_id' ] || ( !empty( $o_value[ 'variation_id' ] ) && $value->product_id == $o_value[ 'variation_id' ] ) ) {
238
- $wpdb->update(
239
- $table_name,
240
- array( 'qty' => $o_value[ 'qty' ] ),
241
- array( 'id' => $value->id ),
242
- array( '%d' ),
243
- array( '%d' )
244
- );
245
- }
246
- }
247
-
248
- }
249
-
250
- break;
251
-
252
- case '1.4.0':
253
-
254
- add_role( 'pending_vendor', __( 'Pending Vendor', 'wcvendors' ), array(
255
- 'read' => true,
256
- 'edit_posts' => false,
257
- 'delete_posts' => false
258
- ) );
259
-
260
- $this->create_new_pages();
261
-
262
- break;
263
-
264
- case '1.4.2':
265
-
266
- $sql = "ALTER TABLE `{$table_name}` ADD `total_shipping` decimal(20,2) NOT NULL AFTER `total_due`";
267
- $wpdb->query( $sql );
268
-
269
- case '1.4.3':
270
-
271
- $sql = "ALTER TABLE `{$table_name}` ADD `tax` decimal(20,2) NOT NULL AFTER `total_shipping`";
272
- $wpdb->query( $sql );
273
-
274
- case '1.4.5':
275
-
276
- // Flush rules to fix the /page/2/ issue on vendor shop pages
277
- update_option( WC_Vendors::$id . '_flush_rules', true );
278
-
279
- default:
280
- // code...
281
- break;
282
- }
283
- }
284
-
285
-
286
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/classes/class-queries.php DELETED
@@ -1,284 +0,0 @@
1
- <?php
2
-
3
- class WCV_Queries
4
- {
5
-
6
- /**
7
- *
8
- *
9
- * @param unknown $user_id
10
- *
11
- * @return unknown
12
- */
13
-
14
-
15
- public static function get_commission_products( $user_id )
16
- {
17
- global $wpdb;
18
-
19
- $dates = WCV_Queries::orders_within_range();
20
- $vendor_products = array();
21
- $sql = '';
22
-
23
- $sql .= "SELECT product_id FROM {$wpdb->prefix}pv_commission WHERE vendor_id = {$user_id} ";
24
-
25
- if ( !empty( $dates ) ) {
26
- $sql .= "AND time >= '" . $dates[ 'after' ] . "' AND time <= '" . $dates[ 'before' ] . "'";
27
- }
28
-
29
- $sql .= " AND status != 'reversed' GROUP BY product_id";
30
-
31
- $results = $wpdb->get_results( $sql );
32
-
33
- foreach ( $results as $value ) {
34
- $ids[ ] = $value->product_id;
35
- }
36
-
37
- if ( !empty( $ids ) ) {
38
- $vendor_products = get_posts( array(
39
- 'numberposts' => -1,
40
- 'orderby' => 'post_date',
41
- 'post_type' => array( 'product', 'product_variation' ),
42
- 'order' => 'DESC',
43
- 'include' => $ids
44
- )
45
- );
46
- }
47
-
48
- return $vendor_products;
49
- }
50
-
51
- /**
52
- *
53
- *
54
- * @param unknown $order_id
55
- *
56
- * @return unknown
57
- */
58
-
59
-
60
- public static function get_products_for_order( $order_id )
61
- {
62
- global $wpdb;
63
-
64
- $vendor_products = array();
65
-
66
- $results = $wpdb->get_results( "
67
- SELECT product_id
68
- FROM {$wpdb->prefix}pv_commission
69
- WHERE order_id = {$order_id}
70
- AND status != 'reversed'
71
- AND vendor_id = " . get_current_user_id() . "
72
- GROUP BY product_id" );
73
-
74
- foreach ( $results as $value ) {
75
- $ids[ ] = $value->product_id;
76
- }
77
-
78
- return $ids;
79
- }
80
-
81
-
82
- /**
83
- * All orders for a specific product
84
- *
85
- * @param array $product_ids
86
- * @param array $args (optional)
87
- *
88
- * @return object
89
- */
90
- public static function get_orders_for_products( array $product_ids, array $args = array() )
91
- {
92
- global $wpdb;
93
-
94
- if ( empty( $product_ids ) ) return false;
95
-
96
- $dates = WCV_Queries::orders_within_range();
97
-
98
- $defaults = array(
99
- 'status' => apply_filters( 'wcvendors_completed_statuses', array( 'completed', 'processing' ) ),
100
- 'dates' => array( 'before' => $dates[ 'before' ], 'after' => $dates[ 'after' ] ),
101
- );
102
-
103
- $args = wp_parse_args( $args, $defaults );
104
-
105
-
106
- $sql = "
107
- SELECT order_id
108
- FROM {$wpdb->prefix}pv_commission as order_items
109
- WHERE product_id IN ('" . implode( "','", $product_ids ) . "')
110
- AND time >= '" . $args[ 'dates' ][ 'after' ] . "'
111
- AND time <= '" . $args[ 'dates' ][ 'before' ] . "'
112
- AND status != 'reversed'
113
- ";
114
-
115
- if ( !empty( $args[ 'vendor_id' ] ) ) {
116
- $sql .= "
117
- AND vendor_id = {$args['vendor_id']}
118
- ";
119
- }
120
-
121
- $sql .= "
122
- GROUP BY order_id
123
- ORDER BY time DESC
124
- ";
125
-
126
- $orders = $wpdb->get_results( $sql );
127
-
128
- return $orders;
129
- }
130
-
131
-
132
- /**
133
- * Sum of orders for a specific product
134
- *
135
- * @param array $product_ids
136
- * @param array $args (optional)
137
- *
138
- * @return object
139
- */
140
- public static function sum_orders_for_products( array $product_ids, array $args = array() )
141
- {
142
- global $wpdb;
143
-
144
- $dates = WCV_Queries::orders_within_range();
145
-
146
- $defaults = array(
147
- 'status' => apply_filters( 'wcvendors_completed_statuses', array( 'completed', 'processing' ) ),
148
- 'dates' => array( 'before' => $dates[ 'before' ], 'after' => $dates[ 'after' ] ),
149
- );
150
-
151
- foreach ( $product_ids as $id ) {
152
- $posts = get_posts( array(
153
- 'numberposts' => -1,
154
- 'post_type' => 'product_variation',
155
- 'post_parent' => $id,
156
- )
157
- );
158
-
159
- if ( !empty( $posts ) ) {
160
- foreach ( $posts as $post ) {
161
- $product_ids[ ] = $post->ID;
162
- }
163
- }
164
- }
165
-
166
- $args = wp_parse_args( $args, $defaults );
167
-
168
- $sql = "
169
- SELECT COUNT(order_id) as total_orders,
170
- SUM(total_due + total_shipping + tax) as line_total,
171
- SUM(qty) as qty,
172
- product_id
173
-
174
- FROM {$wpdb->prefix}pv_commission
175
-
176
- WHERE product_id IN ('" . implode( "','", $product_ids ) . "')
177
- AND time >= '" . $args[ 'dates' ][ 'after' ] . "'
178
- AND time <= '" . $args[ 'dates' ][ 'before' ] . "'
179
- AND status != 'reversed'
180
- ";
181
-
182
- if ( !empty( $args[ 'vendor_id' ] ) ) {
183
- $sql .= "
184
- AND vendor_id = {$args['vendor_id']}
185
- ";
186
- }
187
-
188
- $sql .= "
189
- GROUP BY product_id
190
- ORDER BY time DESC;
191
- ";
192
-
193
- $orders = $wpdb->get_results( $sql );
194
-
195
- return $orders;
196
- }
197
-
198
-
199
- /**
200
- * Sum of orders for a specific order
201
- *
202
- * @param array $order_ids
203
- * @param array $args (optional)
204
- *
205
- * @return object
206
- */
207
- public static function sum_for_orders( array $order_ids, array $args = array(), $date_range = true )
208
- {
209
- global $wpdb;
210
-
211
- $dates = ( $date_range ) ? WCV_Queries::orders_within_range() : array();
212
-
213
- $defaults = array(
214
- 'status' => apply_filters( 'wcvendors_completed_statuses', array( 'completed', 'processing' ) ),
215
- );
216
-
217
- $args = wp_parse_args( $args, $defaults );
218
-
219
- $sql = "
220
- SELECT COUNT(order_id) as total_orders,
221
- SUM(total_due + total_shipping + tax) as line_total,
222
- SUM(qty) as qty,
223
- product_id
224
-
225
- FROM {$wpdb->prefix}pv_commission
226
-
227
- WHERE order_id IN ('" . implode( "','", $order_ids ) . "')
228
- AND status != 'reversed'
229
- ";
230
-
231
- if ( !empty ( $dates ) ){
232
- $sql .= "
233
- AND time >= '" . $dates[ 'after' ] . "'
234
- AND time <= '" . $dates[ 'before' ] . "'
235
- ";
236
- }
237
-
238
- if ( !empty( $args[ 'vendor_id' ] ) ) {
239
- $sql .= "
240
- AND vendor_id = {$args['vendor_id']}
241
- ";
242
- }
243
-
244
- $sql .= "
245
- GROUP BY order_id
246
- ORDER BY time DESC;
247
- ";
248
-
249
- $orders = $wpdb->get_results( $sql );
250
-
251
- return $orders;
252
- }
253
-
254
-
255
- /**
256
- * Orders for range filter function
257
- *
258
- * @return array
259
- */
260
- public static function orders_within_range()
261
- {
262
- global $start_date, $end_date;
263
-
264
- $start_date = !empty( $_SESSION[ 'PV_Session' ][ 'start_date' ] ) ? $_SESSION[ 'PV_Session' ][ 'start_date' ] : strtotime( date( 'Ymd', strtotime( date( 'Ym', current_time( 'timestamp' ) ) . '01' ) ) );
265
- $end_date = !empty( $_SESSION[ 'PV_Session' ][ 'end_date' ] ) ? $_SESSION[ 'PV_Session' ][ 'end_date' ] : strtotime( date( 'Ymd', current_time( 'timestamp' ) ) );
266
-
267
- if ( !empty( $_POST[ 'start_date' ] ) ) {
268
- $start_date = strtotime( $_POST[ 'start_date' ] );
269
- $_SESSION[ 'PV_Session' ][ 'start_date' ] = $start_date;
270
- }
271
-
272
- if ( !empty( $_POST[ 'end_date' ] ) ) {
273
- $end_date = strtotime( $_POST[ 'end_date' ] );
274
- $_SESSION[ 'PV_Session' ][ 'end_date' ] = $end_date;
275
- }
276
-
277
- $after = date( 'Y-m-d', $start_date );
278
- $before = date( 'Y-m-d', strtotime( '+1 day', $end_date ) );
279
-
280
- return apply_filters( 'wcvendors_orders_date_range', array( 'after' => $after, 'before' => $before ) );
281
- }
282
-
283
-
284
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/classes/class-shipping.php DELETED
@@ -1,331 +0,0 @@
1
- <?php
2
-
3
- /**
4
- * Shipping functions
5
- *
6
- * @author Matt Gates <http://mgates.me>, WC Vendors <http://wcvendors.com>
7
- * @package ProductVendor
8
- */
9
-
10
-
11
- class WCV_Shipping
12
- {
13
- public static $trs2_shipping_rates;
14
- public static $trs2_shipping_calc_type;
15
- public static $pps_shipping_costs = array();
16
-
17
-
18
- /**
19
- * Constructor
20
- */
21
- function __construct()
22
- {
23
- // Table Rate Shipping 2 by WooThemes
24
- if ( function_exists( 'woocommerce_get_shipping_method_table_rate' ) ) {
25
- // add_action( 'wp', array( $this, 'trs2_clear_transients' ) );
26
- add_action( 'woocommerce_checkout_update_order_meta', array( 'WCV_Shipping', 'trs2_add_shipping_data' ), 1, 2 );
27
- add_action( 'wc_trs2_matched_rates', array( 'WCV_Shipping', 'trs2_store_shipping_data' ), 10, 3 );
28
- }
29
- }
30
-
31
- /**
32
- *
33
- *
34
- * @param unknown $order_id
35
- * @param unknown $product
36
- * @param unknown $author
37
- *
38
- * @return unknown
39
- */
40
- public static function get_shipping_due( $order_id, $product, $author, $product_id = 0 )
41
- {
42
- global $woocommerce;
43
-
44
- $shipping_costs = array( 'amount' => 0, 'tax' => 0);
45
- $shipping_due = 0;
46
- $method = '';
47
- $_product = wc_get_product( $product[ 'product_id' ] );
48
- $order = wc_get_order( $order_id );
49
-
50
- if ( $_product && $_product->needs_shipping() && !$_product->is_downloadable() ) {
51
-
52
- // Get Shipping methods.
53
- $shipping_methods = $order->get_shipping_methods();
54
-
55
- // TODO: Currently this only allows one shipping method per order, this definitely needs changing
56
- foreach ($shipping_methods as $shipping_method) {
57
- $method = $shipping_method['method_id'];
58
- break;
59
- }
60
-
61
- // Per Product Shipping
62
- if ( ( class_exists('WC_Shipping_Per_Product_Init') || function_exists( 'woocommerce_per_product_shipping' ) ) && $method == 'per_product' ) {
63
- $shipping_costs = WCV_Shipping::pps_get_due( $order_id, $product );
64
-
65
- // Local Delivery
66
- } else if ( $method == 'local_delivery' ) {
67
- $local_delivery = get_option( 'woocommerce_local_delivery_settings' );
68
-
69
- if ( $local_delivery[ 'type' ] == 'product' ) {
70
-
71
- $shipping_costs['amount'] = $product[ 'qty' ] * $local_delivery[ 'fee' ];
72
- $shipping_costs['tax'] = WCV_Shipping::calculate_shipping_tax( $shipping_costs['amount'], $order );
73
- }
74
-
75
- // International Delivery
76
- } else if ( $method == 'international_delivery' ) {
77
-
78
- $int_delivery = get_option( 'woocommerce_international_delivery_settings' );
79
-
80
- if ( $int_delivery[ 'type' ] == 'item' ) {
81
- $WC_Shipping_International_Delivery = new WC_Shipping_International_Delivery();
82
- $fee = $WC_Shipping_International_Delivery->get_fee( $int_delivery[ 'fee' ], $_product->get_price() );
83
- $shipping_costs['amount'] = ( $int_delivery[ 'cost' ] + $fee ) * $product[ 'qty' ];
84
- $shipping_costs['tax'] = ( 'taxable' === $int_delivery[ 'tax_status' ] ) ? WCV_Shipping::calculate_shipping_tax( $shipping_costs['amount'], $order ) : 0;
85
- }
86
-
87
- }
88
- }
89
-
90
- $shipping_costs = apply_filters( 'wcvendors_shipping_due', $shipping_costs, $order_id, $product, $author, $product_id );
91
-
92
- return $shipping_costs;
93
- }
94
-
95
-
96
- /**
97
- *
98
- *
99
- * @param unknown $order_id
100
- * @param unknown $product
101
- *
102
- * @return array
103
- */
104
- public static function pps_get_due( $order_id, $product )
105
- {
106
- global $woocommerce;
107
-
108
- $item_shipping_cost = 0;
109
- $shipping_costs = array();
110
-
111
- $settings = get_option( 'woocommerce_per_product_settings' );
112
- $taxable = $settings['tax_status'];
113
-
114
- $order = new WC_Order( $order_id );
115
-
116
- $shipping_country = ( version_compare( WC_VERSION, '2.7', '<' ) ) ? $order->shipping_country : $order->get_shipping_country();
117
- $shipping_state = ( version_compare( WC_VERSION, '2.7', '<' ) ) ? $order->shipping_state : $order->get_shipping_state();
118
- $shipping_postcode = ( version_compare( WC_VERSION, '2.7', '<' ) ) ? $order->shipping_postcode : $order->get_shipping_postcode();
119
-
120
- $package[ 'destination' ][ 'country' ] = $shipping_country;
121
- $package[ 'destination' ][ 'state' ] = $shipping_state;
122
- $package[ 'destination' ][ 'postcode' ] = $shipping_postcode;
123
- $product_id = !empty( $product['variation_id'] ) ? $product['variation_id'] : $product['product_id'];
124
-
125
- if ( !empty( $product['variation_id'] ) ) {
126
- $rule = woocommerce_per_product_shipping_get_matching_rule( $product['variation_id'], $package );
127
- }
128
-
129
- if ( empty( $rule ) ) {
130
- $rule = woocommerce_per_product_shipping_get_matching_rule( $product['product_id'], $package );
131
- }
132
-
133
- if ( !empty( $rule ) ) {
134
- $item_shipping_cost += $rule->rule_item_cost * $product[ 'qty' ];
135
-
136
- if ( !empty(self::$pps_shipping_costs[$order_id]) && ! in_array( $rule->rule_id, self::$pps_shipping_costs[$order_id] ) ) {
137
- $item_shipping_cost += $rule->rule_cost;
138
- } else if ( empty( self::$pps_shipping_costs[$order_id] ) ) {
139
- $item_shipping_cost += $rule->rule_cost;
140
- }
141
-
142
- self::$pps_shipping_costs[$order_id][] = $rule->rule_id;
143
- }
144
-
145
- $shipping_costs['amount'] = $item_shipping_cost;
146
- $shipping_costs['tax'] = ('taxable' === $taxable ) ? WCV_Shipping::calculate_shipping_tax( $item_shipping_cost, $order ) : 0;
147
-
148
- // return $item_shipping_cost;
149
- return $shipping_costs;
150
- }
151
-
152
- public static function calculate_shipping_tax( $shipping_amount, $order ) {
153
-
154
- $tax_based_on = get_option( 'woocommerce_tax_based_on' );
155
- $wc_tax_enabled = get_option( 'woocommerce_calc_taxes' );
156
-
157
- $shipping_city = ( version_compare( WC_VERSION, '2.7', '<' ) ) ? $order->shipping_city : $order->get_shipping_city();
158
- $shipping_country = ( version_compare( WC_VERSION, '2.7', '<' ) ) ? $order->shipping_country : $order->get_shipping_country();
159
- $shipping_state = ( version_compare( WC_VERSION, '2.7', '<' ) ) ? $order->shipping_state : $order->get_shipping_state();
160
- $shipping_postcode = ( version_compare( WC_VERSION, '2.7', '<' ) ) ? $order->shipping_postcode : $order->get_shipping_postcode();
161
- $billing_city = ( version_compare( WC_VERSION, '2.7', '<' ) ) ? $order->billing_city : $order->get_billing_city();
162
- $billing_country = ( version_compare( WC_VERSION, '2.7', '<' ) ) ? $order->billing_country : $order->get_billing_country();
163
- $billing_state = ( version_compare( WC_VERSION, '2.7', '<' ) ) ? $order->billing_state : $order->get_billing_state();
164
- $billing_postcode = ( version_compare( WC_VERSION, '2.7', '<' ) ) ? $order->billing_postcode : $order->get_billing_postcode();
165
-
166
- // if taxes aren't enabled don't calculate them
167
- if ( 'no' === $wc_tax_enabled ) return 0;
168
-
169
- if ( 'base' === $tax_based_on ) {
170
-
171
- $default = wc_get_base_location();
172
- $country = $default['country'];
173
- $state = $default['state'];
174
- $postcode = '';
175
- $city = '';
176
-
177
- } elseif ( 'billing' === $tax_based_on ) {
178
-
179
- $country = $billing_country;
180
- $state = $billing_state;
181
- $postcode = $billing_postcode;
182
- $city = $billing_city;
183
-
184
- } else {
185
-
186
- $country = $shipping_country;
187
- $state = $shipping_state;
188
- $postcode = $shipping_postcode;
189
- $city = $shipping_city;
190
-
191
- }
192
-
193
- // Now calculate shipping tax
194
- $matched_tax_rates = array();
195
-
196
- $tax_rates = WC_Tax::find_rates( array(
197
- 'country' => $country,
198
- 'state' => $state,
199
- 'postcode' => $postcode,
200
- 'city' => $city,
201
- 'tax_class' => ''
202
- ) );
203
-
204
-
205
- if ( $tax_rates ) {
206
- foreach ( $tax_rates as $key => $rate ) {
207
- if ( isset( $rate['shipping'] ) && 'yes' === $rate['shipping'] ) {
208
- $matched_tax_rates[ $key ] = $rate;
209
- }
210
- }
211
- }
212
-
213
- $shipping_taxes = WC_Tax::calc_shipping_tax( $shipping_amount, $matched_tax_rates );
214
- $shipping_tax_total = WC_Tax::round( array_sum( $shipping_taxes ) );
215
-
216
- return $shipping_tax_total;
217
-
218
- }
219
-
220
-
221
- /**
222
- *
223
- */
224
- public function trs2_clear_transients()
225
- {
226
- global $woocommerce;
227
-
228
- if ( is_checkout() ) {
229
- wc_delete_product_transients();
230
- }
231
- }
232
-
233
-
234
- /**
235
- *
236
- *
237
- * @param unknown $order_id
238
- * @param unknown $product_id
239
- *
240
- * @return unknown
241
- */
242
- public function trs2_get_due( $order_id, $product_id )
243
- {
244
- if ( !function_exists( 'woocommerce_get_shipping_method_table_rate' ) ) return;
245
-
246
- $shipping_due = 0;
247
-
248
- WCV_Shipping::trs2_retrieve_shipping_data( $order_id );
249
- if ( !empty( WCV_Shipping::$trs2_shipping_calc_type ) ) {
250
-
251
- $ship_id = ( WCV_Shipping::$trs2_shipping_calc_type == 'class' ) ? get_product( $product_id )->get_shipping_class_id() : $product_id;
252
-
253
- if ( !empty( WCV_Shipping::$trs2_shipping_rates[ $ship_id ] ) ) {
254
- $shipping_due = WCV_Shipping::$trs2_shipping_rates[ $ship_id ];
255
- unset( WCV_Shipping::$trs2_shipping_rates[ $ship_id ] );
256
- }
257
- }
258
-
259
- return $shipping_due;
260
- }
261
-
262
-
263
- /**
264
- *
265
- *
266
- * @param unknown $order_id
267
- */
268
- public function trs2_retrieve_shipping_data( $order_id )
269
- {
270
- global $woocommerce;
271
-
272
- if ( !empty( WCV_Shipping::$trs2_shipping_rates ) ) return;
273
-
274
- WCV_Shipping::$trs2_shipping_rates = array_filter( (array) get_post_meta( $order_id, '_wcvendors_trs2_shipping_rates', true ) );
275
- WCV_Shipping::$trs2_shipping_calc_type = get_post_meta( $order_id, '_wcvendors_trs2_shipping_calc_type', true );
276
- }
277
-
278
-
279
- /**
280
- *
281
- *
282
- * @param unknown $type
283
- * @param unknown $rates
284
- * @param unknown $per_item
285
- */
286
- public function trs2_store_shipping_data( $type, $rates, $per_item )
287
- {
288
- global $woocommerce;
289
-
290
- $types = (array) $woocommerce->session->trs2_shipping_class_type;
291
- $types[ ] = $type;
292
- $woocommerce->session->trs2_shipping_class_type = $types;
293
-
294
- $items = (array) $woocommerce->session->trs2_shipping_rates;
295
- $items[ ] = $per_item;
296
- $woocommerce->session->trs2_shipping_rates = $items;
297
- }
298
-
299
-
300
- /**
301
- *
302
- *
303
- * @param unknown $order_id
304
- * @param unknown $post
305
- *
306
- * @return unknown
307
- */
308
- public function trs2_add_shipping_data( $order_id, $post )
309
- {
310
- global $woocommerce;
311
-
312
- if ( empty( $woocommerce->session->trs2_shipping_rates ) ) {
313
- return false;
314
- }
315
-
316
- $order = new WC_Order( $order_id );
317
-
318
- foreach ( $woocommerce->session->trs2_shipping_rates as $key => $shipping_rates ) {
319
-
320
- if ( is_array( $shipping_rates ) && array_sum( $shipping_rates ) == $order->order_shipping ) {
321
- $shipping_calc_type = $woocommerce->session->trs2_shipping_class_type[ $key ];
322
- update_post_meta( $order_id, '_wcvendors_trs2_shipping_rates', $shipping_rates );
323
- update_post_meta( $order_id, '_wcvendors_trs2_shipping_calc_type', $shipping_calc_type );
324
-
325
- break;
326
- }
327
- }
328
-
329
- unset( $woocommerce->session->trs2_shipping_rates, $woocommerce->session->trs2_shipping_class_type );
330
- }
331
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/classes/class-vendor-order.php DELETED
@@ -1,71 +0,0 @@
1
- <?php
2
- /**
3
- * Order vendor_order
4
- *
5
- * @class WC_Order_Vendor
6
- */
7
- class WC_Order_Vendor extends WC_Order {
8
-
9
- /** @public string Order type */
10
- public $order_type = 'vendor_order';
11
-
12
- /** @var string Date */
13
- public $date;
14
-
15
- /**
16
- * Init/load the vendor_order object. Called from the constructor.
17
- *
18
- * @param string|int|object|WC_Order_Vendor $vendor_order Vendor Order to init
19
- * @uses WP_POST
20
- */
21
- protected function init( $vendor_order ) {
22
- if ( is_numeric( $vendor_order ) ) {
23
- $this->id = absint( $vendor_order );
24
- $this->post = get_post( $vendor_order );
25
- $this->get_vendor_order( $this->id );
26
- } elseif ( $vendor_order instanceof WC_Order_Vendor ) {
27
- $this->id = absint( $vendor_order->id );
28
- $this->post = $vendor_order->post;
29
- $this->get_vendor_order( $this->id );
30
- } elseif ( isset( $vendor_order->ID ) ) {
31
- $this->id = absint( $vendor_order->ID );
32
- $this->post = $vendor_order;
33
- $this->get_vendor_order( $this->id );
34
- }
35
- }
36
-
37
- /**
38
- * Gets an vendor_order from the database
39
- *
40
- * @since 2.2
41
- * @param int $id
42
- * @return bool
43
- */
44
- public function get_vendor_order( $id = 0 ) {
45
- if ( ! $id ) {
46
- return false;
47
- }
48
-
49
- if ( $result = get_post( $id ) ) {
50
- $this->populate( $result );
51
-
52
- return true;
53
- }
54
-
55
- return false;
56
- }
57
-
58
- /**
59
- * Populates a vendor_order from the loaded post data
60
- *
61
- * @param mixed $result
62
- */
63
- public function populate( $result ) {
64
- // Standard post data
65
- $this->id = $result->ID;
66
- $this->date = $result->post_date;
67
- $this->modified_date = $result->post_modified;
68
- $this->reason = $result->post_excerpt;
69
- }
70
-
71
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/classes/class-vendor-post-types.php DELETED
@@ -1,52 +0,0 @@
1
- <?php
2
- /**
3
- * Post Types
4
- *
5
- * Registers post types and taxonomies
6
- *
7
- * @class WCV_Post_types
8
- */
9
-
10
- if ( ! defined( 'ABSPATH' ) ) {
11
- exit;
12
- }
13
-
14
- /**
15
- * WCV_Post_types Class
16
- */
17
- class WCV_Post_types {
18
-
19
- /**
20
- * Hook in methods.
21
- */
22
- public static function init() {
23
- add_action( 'woocommerce_register_post_type', array( __CLASS__, 'register_shop_order_vendor' ) );
24
- }
25
-
26
- /**
27
- * Register vendor order type
28
- */
29
- public static function register_shop_order_vendor() {
30
- wc_register_order_type(
31
- 'shop_order_vendor',
32
- apply_filters( 'woocommerce_register_post_type_shop_order_vendor',
33
- array(
34
- 'label' => __( 'Vendor Orders', 'woocommerce' ),
35
- 'capability_type' => 'shop_order',
36
- 'public' => false,
37
- 'hierarchical' => false,
38
- 'supports' => false,
39
- 'exclude_from_orders_screen' => false,
40
- 'add_order_meta_boxes' => false,
41
- 'exclude_from_order_count' => true,
42
- 'exclude_from_order_views' => false,
43
- 'exclude_from_order_reports' => false,
44
- 'exclude_from_order_sales_reports' => true,
45
- 'class_name' => 'WC_Order_Vendor'
46
- )
47
- )
48
- );
49
- }
50
- }
51
-
52
- WCV_Post_types::init();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/classes/class-vendors.php DELETED
@@ -1,675 +0,0 @@
1
- <?php
2
-
3
- /**
4
- * Vendor functions
5
- *
6
- * @author Matt Gates <http://mgates.me>, WC Vendors <http://wcvendors.com>
7
- * @package WCVendors
8
- */
9
-
10
-
11
- class WCV_Vendors
12
- {
13
-
14
- /**
15
- * Constructor
16
- */
17
- function __construct()
18
- {
19
- add_action( 'woocommerce_checkout_order_processed', array( __CLASS__, 'create_child_orders' ), 10, 1 );
20
- }
21
-
22
- /**
23
- * Retrieve all products for a vendor
24
- *
25
- * @param int $vendor_id
26
- *
27
- * @return object
28
- */
29
- public static function get_vendor_products( $vendor_id )
30
- {
31
- $args = array(
32
- 'numberposts' => -1,
33
- 'post_type' => 'product',
34
- 'author' => $vendor_id,
35
- 'post_status' => 'publish',
36
- );
37
-
38
- $args = apply_filters( 'pv_get_vendor_products_args', $args );
39
-
40
- return get_posts( $args );
41
- }
42
-
43
- public static function get_default_commission( $vendor_id )
44
- {
45
- return get_user_meta( $vendor_id, 'pv_custom_commission_rate', true );
46
- }
47
-
48
-
49
- /**
50
- * Vendor IDs and PayPal addresses from an order
51
- *
52
- * @param object $order
53
- * @param unknown $items (optional)
54
- *
55
- * @return array
56
- */
57
- public static function get_vendors_from_order( $order, $items = false )
58
- {
59
- if ( !$order ) return;
60
- if ( !$items ) $items = $order->get_items();
61
-
62
- $vendors = array();
63
- foreach ( $items as $key => $product ) {
64
-
65
- $author = WCV_Vendors::get_vendor_from_product( $product[ 'product_id' ] );
66
-
67
- // Only store the vendor authors
68
- if ( !WCV_Vendors::is_vendor( $author ) ) continue;
69
-
70
- $vendors[ $author ] = the_author_meta( 'author_paypal', $author );
71
- }
72
-
73
- return apply_filters( 'pv_vendors_from_order', $vendors, $order );
74
- }
75
-
76
-
77
- /**
78
- *
79
- *
80
- * @param unknown $order
81
- * @param unknown $group (optional)
82
- *
83
- * @return unknown
84
- */
85
- public static function get_vendor_dues_from_order( $order, $group = true )
86
- {
87
- global $woocommerce;
88
-
89
- $give_tax = WC_Vendors::$pv_options->get_option( 'give_tax' );
90
- $give_shipping = WC_Vendors::$pv_options->get_option( 'give_shipping' );
91
- $receiver = array();
92
- $shipping_given = 0;
93
- $tax_given = 0;
94
-
95
- WCV_Shipping::$pps_shipping_costs = array();
96
-
97
- foreach ( $order->get_items() as $key => $product ) {
98
-
99
- $product_id = !empty( $product[ 'variation_id' ] ) ? $product[ 'variation_id' ] : $product[ 'product_id' ];
100
- $author = WCV_Vendors::get_vendor_from_product( $product_id );
101
- $give_tax_override = get_user_meta( $author, 'wcv_give_vendor_tax', true );
102
- $give_shipping_override = get_user_meta( $author, 'wcv_give_vendor_shipping', true );
103
- $is_vendor = WCV_Vendors::is_vendor( $author );
104
- $commission = $is_vendor ? WCV_Commission::calculate_commission( $product[ 'line_subtotal' ], $product_id, $order, $product[ 'qty' ] ) : 0;
105
- $tax = !empty( $product[ 'line_tax' ] ) ? (float) $product[ 'line_tax' ] : 0;
106
- $order_id = ( version_compare( WC_VERSION, '2.7', '<' ) ) ? $order->id : $order->get_id();
107
-
108
- // Check if shipping is enabled
109
- if ( get_option('woocommerce_calc_shipping') === 'no' ) {
110
- $shipping = 0; $shipping_tax = 0;
111
- } else {
112
- $shipping_costs = WCV_Shipping::get_shipping_due( $order_id, $product, $author, $product_id );
113
- $shipping = $shipping_costs['amount'];
114
- $shipping_tax = $shipping_costs['tax'];
115
- }
116
-
117
- $_product = new WC_Product( $product['product_id'] );
118
-
119
- // Add line item tax and shipping taxes together
120
- $total_tax = ( $_product->is_taxable() ) ? (float) $tax + (float) $shipping_tax : 0;
121
-
122
- // Tax override on a per vendor basis
123
- if ( $give_tax_override ) $give_tax = true;
124
- // Shipping override
125
- if ( $give_shipping_override ) $give_shipping = true;
126
-
127
- if ( $is_vendor ) {
128
-
129
- $shipping_given += $give_shipping ? $shipping : 0;
130
- $tax_given += $give_tax ? $total_tax : 0;
131
-
132
- $give = 0;
133
- $give += !empty( $receiver[ $author ][ 'total' ] ) ? $receiver[ $author ][ 'total' ] : 0;
134
- $give += $give_shipping ? $shipping : 0;
135
- $give += $commission;
136
- $give += $give_tax ? $total_tax : 0;
137
-
138
- if ( $group ) {
139
-
140
- $receiver[ $author ] = array(
141
- 'vendor_id' => (int) $author,
142
- 'commission' => !empty( $receiver[ $author ][ 'commission' ] ) ? $receiver[ $author ][ 'commission' ] + $commission : $commission,
143
- 'shipping' => $give_shipping ? ( !empty( $receiver[ $author ][ 'shipping' ] ) ? $receiver[ $author ][ 'shipping' ] + $shipping : $shipping) : 0,
144
- 'tax' => $give_tax ? ( !empty( $receiver[ $author ][ 'tax' ] ) ? $receiver[ $author ][ 'tax' ] + $total_tax : $total_tax ) : 0,
145
- 'qty' => !empty( $receiver[ $author ][ 'qty' ] ) ? $receiver[ $author ][ 'qty' ] + $product[ 'qty' ] : $product[ 'qty' ],
146
- 'total' => $give,
147
- );
148
-
149
- } else {
150
-
151
- $receiver[ $author ][ $key ] = array(
152
- 'vendor_id' => (int) $author,
153
- 'product_id' => $product_id,
154
- 'commission' => $commission,
155
- 'shipping' => $give_shipping ? $shipping : 0,
156
- 'tax' => $give_tax ? $total_tax : 0,
157
- 'qty' => $product[ 'qty' ],
158
- 'total' => ($give_shipping ? $shipping : 0) + $commission + ( $give_tax ? $total_tax : 0 ),
159
- );
160
-
161
- }
162
-
163
- }
164
-
165
- $admin_comm = $product[ 'line_subtotal' ] - $commission;
166
-
167
- if ( $group ) {
168
- $receiver[ 1 ] = array(
169
- 'vendor_id' => 1,
170
- 'qty' => !empty( $receiver[ 1 ][ 'qty' ] ) ? $receiver[ 1 ][ 'qty' ] + $product[ 'qty' ] : $product[ 'qty' ],
171
- 'commission' => !empty( $receiver[ 1 ][ 'commission' ] ) ? $receiver[ 1 ][ 'commission' ] + $admin_comm : $admin_comm,
172
- 'total' => !empty( $receiver[ 1 ] ) ? $receiver[ 1 ][ 'total' ] + $admin_comm : $admin_comm,
173
- );
174
- } else {
175
- $receiver[ 1 ][ $key ] = array(
176
- 'vendor_id' => 1,
177
- 'product_id' => $product_id,
178
- 'commission' => $admin_comm,
179
- 'shipping' => 0,
180
- 'tax' => 0,
181
- 'qty' => $product[ 'qty' ],
182
- 'total' => $admin_comm,
183
- );
184
- }
185
-
186
- }
187
-
188
- // Add remainders on end to admin
189
- $discount = $order->get_total_discount();
190
- $shipping = round( ( $order->get_total_shipping() - $shipping_given ), 2 );
191
- $tax = round(( $order->get_total_tax() + $order->get_shipping_tax() ) - $tax_given, 2);
192
- $total = ( $tax + $shipping ) - $discount;
193
-
194
- if ( $group ) {
195
- $r_total = round( $receiver[ 1 ][ 'total' ], 2 ) ;
196
- $receiver[ 1 ][ 'commission' ] = round( $receiver[ 1 ][ 'commission' ], 2 ) - round( $discount, 2 );
197
- $receiver[ 1 ][ 'shipping' ] = $shipping;
198
- $receiver[ 1 ][ 'tax' ] = $tax;
199
- $receiver[ 1 ][ 'total' ] = $r_total + round( $total, 2 );
200
- } else {
201
- $r_total = round( $receiver[ 1 ][ $key ][ 'total' ], 2 );
202
- $receiver[ 1 ][ $key ][ 'commission' ] = round( $receiver[ 1 ][ $key ][ 'commission' ], 2 ) - round( $discount, 2 );
203
- $receiver[ 1 ][ $key ][ 'shipping' ] = ( $order->get_total_shipping() - $shipping_given );
204
- $receiver[ 1 ][ $key ][ 'tax' ] = $tax;
205
- $receiver[ 1 ][ $key ][ 'total' ] = $r_total + round( $total, 2 );
206
- }
207
-
208
- // Reset the array keys
209
- // $receivers = array_values( $receiver );
210
-
211
- return $receiver;
212
- }
213
-
214
-
215
- /**
216
- * Return the PayPal address for a vendor
217
- *
218
- * If no PayPal is set, it returns the vendor's email
219
- *
220
- * @param int $vendor_id
221
- *
222
- * @return string
223
- */
224
- public static function get_vendor_paypal( $vendor_id )
225
- {
226
- $paypal = get_user_meta( $vendor_id, $meta_key = 'pv_paypal', true );
227
- $paypal = !empty( $paypal ) ? $paypal : get_the_author_meta( 'user_email', $vendor_id, false );
228
-
229
- return $paypal;
230
- }
231
-
232
-
233
- /**
234
- * Check if a vendor has an amount due for an order already
235
- *
236
- * @param int $vendor_id
237
- * @param int $order_id
238
- *
239
- * @return int
240
- */
241
- public static function count_due_by_vendor( $vendor_id, $order_id )
242
- {
243
- global $wpdb;
244
-
245
- $table_name = $wpdb->prefix . "pv_commission";
246
-
247
- $query = "SELECT COUNT(*)
248
- FROM {$table_name}
249
- WHERE vendor_id = %s
250
- AND order_id = %s
251
- AND status = %s";
252
- $count = $wpdb->get_var( $wpdb->prepare( $query, $vendor_id, $order_id, 'due' ) );
253
-
254
- return $count;
255
- }
256
-
257
-
258
- /**
259
- * All commission due for a specific vendor
260
- *
261
- * @param int $vendor_id
262
- *
263
- * @return int
264
- */
265
- public static function get_due_orders_by_vendor( $vendor_id )
266
- {
267
- global $wpdb;
268
-
269
- $table_name = $wpdb->prefix . "pv_commission";
270
-
271
- $query = "SELECT *
272
- FROM {$table_name}
273
- WHERE vendor_id = %s
274
- AND status = %s";
275
- $results = $wpdb->get_results( $wpdb->prepare( $query, $vendor_id, 'due' ) );
276
-
277
- return $results;
278
- }
279
-
280
-
281
- /**
282
- *
283
- *
284
- * @param unknown $product_id
285
- *
286
- * @return unknown
287
- */
288
- public static function get_vendor_from_product( $product_id )
289
- {
290
- // Make sure we are returning an author for products or product variations only
291
- if ( 'product' === get_post_type( $product_id ) || 'product_variation' === get_post_type( $product_id ) ) {
292
- $parent = get_post_ancestors( $product_id );
293
- if ( $parent ) $product_id = $parent[ 0 ];
294
-
295
- $post = get_post( $product_id );
296
- $author = $post ? $post->post_author : 1;
297
- $author = apply_filters( 'pv_product_author', $author, $product_id );
298
- } else {
299
- $author = -1;
300
- }
301
- return $author;
302
- }
303
-
304
-
305
- /**
306
- * Checks whether the ID provided is vendor capable or not
307
- *
308
- * @param int $user_id
309
- *
310
- * @return bool
311
- */
312
- public static function is_vendor( $user_id )
313
- {
314
- $user = get_userdata( $user_id );
315
-
316
- $vendor_roles = apply_filters( 'wcvendors_vendor_roles', array( 'vendor') );
317
-
318
- if (is_object($user)) {
319
-
320
- foreach ($vendor_roles as $role ) {
321
- $is_vendor = is_array( $user->roles ) ? in_array( $role , $user->roles ) : false;
322
- }
323
-
324
- } else {
325
- $is_vendor = false;
326
- }
327
-
328
- return apply_filters( 'pv_is_vendor', $is_vendor, $user_id );
329
- }
330
-
331
-
332
- /**
333
- * Grabs the vendor ID whether a username or an int is provided
334
- * and returns the vendor_id if it's actually a vendor
335
- *
336
- * @param unknown $input
337
- *
338
- * @return unknown
339
- */
340
- public static function get_vendor_id( $input )
341
- {
342
- if ( empty( $input ) ) {
343
- return false;
344
- }
345
-
346
- $users = get_users( array( 'meta_key' => 'pv_shop_slug', 'meta_value' => sanitize_title( $input ) ) );
347
-
348
- if ( !empty( $users ) && count( $users ) == 1 ) {
349
- $vendor = $users[ 0 ];
350
- } else {
351
- $int_vendor = is_numeric( $input );
352
- $vendor = !empty( $int_vendor ) ? get_userdata( $input ) : get_user_by( 'login', $input );
353
- }
354
-
355
- if ( $vendor ) {
356
- $vendor_id = $vendor->ID;
357
- if ( self::is_vendor( $vendor_id ) ) {
358
- return $vendor_id;
359
- }
360
- }
361
-
362
- return false;
363
- }
364
-
365
-
366
- /**
367
- * Retrieve the shop page for a specific vendor
368
- *
369
- * @param unknown $vendor_id
370
- *
371
- * @return string
372
- */
373
- public static function get_vendor_shop_page( $vendor_id )
374
- {
375
- $vendor_id = self::get_vendor_id( $vendor_id );
376
- if ( !$vendor_id ) return;
377
-
378
- $slug = get_user_meta( $vendor_id, 'pv_shop_slug', true );
379
- $vendor = !$slug ? get_userdata( $vendor_id )->user_login : $slug;
380
-
381
- if ( get_option( 'permalink_structure' ) ) {
382
- $permalink = trailingslashit( WC_Vendors::$pv_options->get_option( 'vendor_shop_permalink' ) );
383
-
384
- return trailingslashit( home_url( sprintf( '/%s%s', $permalink, $vendor ) ) );
385
- } else {
386
- return esc_url( add_query_arg( array( 'vendor_shop' => $vendor ), get_post_type_archive_link( 'product' ) ) );
387
- }
388
- }
389
-
390
-
391
- /**
392
- * Retrieve the shop name for a specific vendor
393
- *
394
- * @param unknown $vendor_id
395
- *
396
- * @return string
397
- */
398
- public static function get_vendor_shop_name( $vendor_id )
399
- {
400
- $vendor_id = self::get_vendor_id( $vendor_id );
401
- $name = $vendor_id ? get_user_meta( $vendor_id, 'pv_shop_name', true ) : false;
402
- $shop_name = !$name ? get_userdata( $vendor_id )->user_login : $name;
403
-
404
- return $shop_name;
405
- }
406
-
407
-
408
- /**
409
- *
410
- *
411
- * @param unknown $user_id
412
- *
413
- * @return unknown
414
- */
415
- public static function is_pending( $user_id )
416
- {
417
- $user = get_userdata( $user_id );
418
-
419
- $role = !empty( $user->roles ) ? array_shift( $user->roles ) : false;
420
- $is_pending = ( $role == 'pending_vendor' );
421
-
422
- return $is_pending;
423
- }
424
-
425
- /*
426
- * Is this a vendor product ?
427
- * @param uknown $role
428
- */
429
- public static function is_vendor_product($role) {
430
- return ($role === 'Vendor') ? true : false;
431
- }
432
-
433
- /*
434
- * Is this the vendors shop archive page ?
435
- */
436
- public static function is_vendor_page() {
437
-
438
- $vendor_shop = urldecode( get_query_var( 'vendor_shop' ) );
439
- $vendor_id = WCV_Vendors::get_vendor_id( $vendor_shop );
440
-
441
- return $vendor_id ? true : false;
442
-
443
- } // is_vendor_page()
444
-
445
- /*
446
- * Is this a vendor single product page ?
447
- */
448
- public static function is_vendor_product_page($vendor_id) {
449
-
450
- $vendor_product = WCV_Vendors::is_vendor_product( wcv_get_user_role($vendor_id) );
451
- return $vendor_product ? true : false;
452
-
453
- } // is_vendor_product_page()
454
-
455
- public static function get_vendor_sold_by( $vendor_id ){
456
-
457
- $vendor_display_name = WC_Vendors::$pv_options->get_option( 'vendor_display_name' );
458
- $vendor = get_userdata( $vendor_id );
459
-
460
- switch ($vendor_display_name) {
461
- case 'display_name':
462
- $display_name = $vendor->display_name;
463
- break;
464
- case 'user_login':
465
- $display_name = $vendor->user_login;
466
- break;
467
- case 'user_email':
468
- $display_name = $vendor->user_email;
469
- break;
470
-
471
- default:
472
- $display_name = WCV_Vendors::get_vendor_shop_name( $vendor_id );
473
- break;
474
- }
475
-
476
- return $display_name;
477
-
478
- } // get_vendor_sold_by()
479
-
480
- /**
481
- * Split order into vendor orders (when applicable) after checkout
482
- *
483
- * @since
484
- * @param int $order_id
485
- * @return void
486
- */
487
- public static function create_child_orders ( $order_id ) {
488
- $order = wc_get_order( $order_id );
489
- $items = $order->get_items();
490
- $vendor_items = array();
491
-
492
- foreach ($items as $item_id => $item) {
493
- if ( isset($item['product_id']) && $item['product_id'] !== 0 ) {
494
- // check if product is from vendor
495
- $product_author = get_post_field( 'post_author', $item['product_id'] );
496
- if (WCV_Vendors::is_vendor( $product_author ) ) {
497
- $vendor_items[ $product_author ][ $item_id ] = array (
498
- 'item_id' => $item_id,
499
- 'qty' => $item['qty'],
500
- 'total' => $item['line_total'],
501
- 'subtotal' => $item['line_subtotal'],
502
- 'tax' => $item['line_tax'],
503
- 'subtotal_tax' => $item['line_subtotal_tax'],
504
- 'tax_data' => maybe_unserialize( $item['line_tax_data'] ),
505
- 'commission' => WCV_Commission::calculate_commission( $item['line_subtotal'], $item['product_id'], $order, $item['qty'] ),
506
- );
507
- }
508
- }
509
- }
510
-
511
- foreach ($vendor_items as $vendor_id => $items) {
512
- if (!empty($items)) {
513
- $vendor_order = WCV_Vendors::create_vendor_order( array(
514
- 'order_id' => $order_id,
515
- 'vendor_id' => $vendor_id,
516
- 'line_items' => $items
517
- ) );
518
- }
519
- }
520
- }
521
-
522
- /**
523
- * Create a new vendor order programmatically
524
- *
525
- * Returns a new vendor_order object on success which can then be used to add additional data.
526
- *
527
- * @since
528
- * @param array $args
529
- * @return WC_Order_Vendor|WP_Error
530
- */
531
- public static function create_vendor_order( $args = array() ) {
532
- $default_args = array(
533
- 'vendor_id' => null,
534
- 'order_id' => 0,
535
- 'vendor_order_id' => 0,
536
- 'line_items' => array(),
537
- 'date' => current_time( 'mysql', 0 )
538
- );
539
-
540
- $args = wp_parse_args( $args, $default_args );
541
- $vendor_order_data = array();
542
-
543
- if ( $args['vendor_order_id'] > 0 ) {
544
- $updating = true;
545
- $vendor_order_data['ID'] = $args['vendor_order_id'];
546
- } else {
547
- $updating = false;
548
- $vendor_order_data['post_type'] = 'shop_order_vendor';
549
- $vendor_order_data['post_status'] = 'wc-completed';
550
- $vendor_order_data['ping_status'] = 'closed';
551
- $vendor_order_data['post_author'] = get_current_user_id();
552
- $vendor_order_data['post_password'] = uniqid( 'vendor_' ); // password = 20 char max! (uniqid = 13)
553
- $vendor_order_data['post_parent'] = absint( $args['order_id'] );
554
- $vendor_order_data['post_title'] = sprintf( __( 'Vendor Order &ndash; %s', 'woocommerce' ), strftime( _x( '%b %d, %Y @ %I:%M %p', 'Order date parsed by strftime', 'woocommerce' ) ) );
555
- $vendor_order_data['post_date'] = $args['date'];
556
- }
557
-
558
- if ( $updating ) {
559
- $vendor_order_id = wp_update_post( $vendor_order_data );
560
- } else {
561
- $vendor_order_id = wp_insert_post( apply_filters( 'woocommerce_new_vendor_order_data', $vendor_order_data ), true );
562
- }
563
-
564
- if ( is_wp_error( $vendor_order_id ) ) {
565
- return $vendor_order_id;
566
- }
567
-
568
- if ( ! $updating ) {
569
- // Store vendor ID
570
- update_post_meta( $vendor_order_id, '_vendor_id', $args['vendor_id'] );
571
-
572
- // Get vendor order object
573
- $vendor_order = wc_get_order( $vendor_order_id );
574
- $order = wc_get_order( $args['order_id'] );
575
-
576
- $order_currency = ( version_compare( WC_VERSION, '2.7', '<' ) ) ? $order->get_order_currency() : $order->get_currency();
577
-
578
- // Order currency is the same used for the parent order
579
- update_post_meta( $vendor_order_id, '_order_currency', $order_currency );
580
-
581
- if ( sizeof( $args['line_items'] ) > 0 ) {
582
- $order_items = $order->get_items( array( 'line_item', 'fee', 'shipping' ) );
583
-
584
- foreach ( $args['line_items'] as $vendor_order_item_id => $vendor_order_item ) {
585
- if ( isset( $order_items[ $vendor_order_item_id ] ) ) {
586
- if ( empty( $vendor_order_item['qty'] ) && empty( $vendor_order_item['total'] ) && empty( $vendor_order_item['tax'] ) ) {
587
- continue;
588
- }
589
-
590
- // Prevents errors when the order has no taxes
591
- if ( ! isset( $vendor_order_item['tax'] ) ) {
592
- $vendor_order_item['tax'] = array();
593
- }
594
-
595
- switch ( $order_items[ $vendor_order_item_id ]['type'] ) {
596
- case 'line_item' :
597
- $line_item_args = array(
598
- 'totals' => array(
599
- 'subtotal' => $vendor_order_item['subtotal'],
600
- 'total' => $vendor_order_item['total'],
601
- 'subtotal_tax' => $vendor_order_item['subtotal_tax'],
602
- 'tax' => $vendor_order_item['tax'],
603
- 'tax_data' => $vendor_order_item['tax_data'],
604
- )
605
- );
606
- $new_item_id = $vendor_order->add_product( $order->get_product_from_item( $order_items[ $vendor_order_item_id ] ), isset( $vendor_order_item['qty'] ) ? $vendor_order_item['qty'] : 0, $line_item_args );
607
- wc_add_order_item_meta( $new_item_id, '_vendor_order_item_id', $vendor_order_item_id );
608
- wc_add_order_item_meta( $new_item_id, '_vendor_commission', $vendor_order_item['commission'] );
609
- break;
610
- case 'shipping' :
611
- $shipping = new stdClass();
612
- $shipping->label = $order_items[ $vendor_order_item_id ]['name'];
613
- $shipping->id = $order_items[ $vendor_order_item_id ]['method_id'];
614
- $shipping->cost = $vendor_order_item['total'];
615
- $shipping->taxes = $vendor_order_item['tax'];
616
-
617
- $new_item_id = $vendor_order->add_shipping( $shipping );
618
- wc_add_order_item_meta( $new_item_id, '_vendor_order_item_id', $vendor_order_item_id );
619
- break;
620
- case 'fee' :
621
- $fee = new stdClass();
622
- $fee->name = $order_items[ $vendor_order_item_id ]['name'];
623
- $fee->tax_class = $order_items[ $vendor_order_item_id ]['tax_class'];
624
- $fee->taxable = $fee->tax_class !== '0';
625
- $fee->amount = $vendor_order_item['total'];
626
- $fee->tax = array_sum( $vendor_order_item['tax'] );
627
- $fee->tax_data = $vendor_order_item['tax'];
628
-
629
- $new_item_id = $vendor_order->add_fee( $fee );
630
- wc_add_order_item_meta( $new_item_id, '_vendor_order_item_id', $vendor_order_item_id );
631
- break;
632
- }
633
- }
634
- }
635
- $vendor_order->update_taxes();
636
- }
637
-
638
- $vendor_order->calculate_totals( false );
639
-
640
- do_action( 'woocommerce_vendor_order_created', $vendor_order_id, $args );
641
- }
642
-
643
- // Clear transients
644
- wc_delete_shop_order_transients( $args['order_id'] );
645
-
646
- return new WC_Order_Vendor( $vendor_order_id );
647
- }
648
-
649
-
650
- /**
651
- * Get vendor orders
652
- *
653
- * @return array
654
- */
655
- public static function get_vendor_orders( $order_id ) {
656
- $vendor_orders = array();
657
- $vendor_order_ids = get_posts(
658
- array(
659
- 'post_type' => 'shop_order_vendor',
660
- 'post_parent' => $order_id,
661
- 'posts_per_page' => -1,
662
- 'post_status' => 'any',
663
- 'fields' => 'ids'
664
- )
665
- );
666
-
667
- foreach ( $vendor_order_ids as $vendor_order_id ) {
668
- $vendor_orders[] = new WC_Order_Vendor( $vendor_order_id );
669
- }
670
-
671
- return $vendor_orders;
672
-
673
- } // get_vendor_orders()
674
-
675
- } // WCV_Vendors
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/classes/front/class-vendor-cart.php DELETED
@@ -1,70 +0,0 @@
1
- <?php
2
-
3
- /**
4
- *
5
- *
6
- * @author Matt Gates <http://mgates.me>
7
- * @package
8
- */
9
-
10
-
11
- class WCV_Vendor_Cart
12
- {
13
-
14
-
15
- /**
16
- *
17
- */
18
- function __construct()
19
- {
20
-
21
- if ( WC_Vendors::$pv_options->get_option( 'sold_by' ) ) {
22
- add_filter( 'woocommerce_get_item_data', array( 'WCV_Vendor_Cart', 'sold_by' ), 10, 2 );
23
- add_action( 'woocommerce_product_meta_start', array( 'WCV_Vendor_Cart', 'sold_by_meta' ), 10, 2 );
24
- }
25
-
26
- }
27
-
28
-
29
- /**
30
- * Sold by in cart item
31
- *
32
- * @param unknown $values
33
- * @param unknown $cart_item
34
- *
35
- * @return unknown
36
- */
37
- public static function sold_by( $values, $cart_item ){
38
-
39
- $product_id = $cart_item[ 'product_id'];
40
- $post = get_post( $product_id );
41
- $vendor_id = $post->post_author;
42
- $sold_by_label = WC_Vendors::$pv_options->get_option( 'sold_by_label' );
43
- $sold_by = WCV_Vendors::is_vendor( $vendor_id )
44
- ? sprintf( '<a href="%s" target="_TOP">%s </a>', WCV_Vendors::get_vendor_shop_page( $vendor_id ), WCV_Vendors::get_vendor_sold_by( $vendor_id ) )
45
- : get_bloginfo( 'name' );
46
-
47
- $values[ ] = array(
48
- 'name' => apply_filters( 'wcvendors_cart_sold_by', $sold_by_label, $product_id, $vendor_id ),
49
- 'display' => $sold_by,
50
- );
51
-
52
- return $values;
53
- }
54
-
55
-
56
- /**
57
- * Single product meta
58
- */
59
- public static function sold_by_meta()
60
- {
61
- $vendor_id = get_the_author_meta( 'ID' );
62
- $sold_by_label = WC_Vendors::$pv_options->get_option( 'sold_by_label' );
63
- $sold_by = WCV_Vendors::is_vendor( $vendor_id )
64
- ? sprintf( '<a href="%s" class="wcvendors_cart_sold_by_meta">%s</a>', WCV_Vendors::get_vendor_shop_page( $vendor_id ), WCV_Vendors::get_vendor_sold_by( $vendor_id ) )
65
- : get_bloginfo( 'name' );
66
-
67
- echo apply_filters('wcvendors_cart_sold_by_meta', $sold_by_label, get_the_ID(), $vendor_id ) .'&nbsp;'. $sold_by . '<br/>';
68
- }
69
-
70
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/classes/front/class-vendor-shop.php DELETED
@@ -1,352 +0,0 @@
1
- <?php
2
-
3
- /**
4
- * Shop functions for each vendor.
5
- *
6
- * @author Matt Gates <http://mgates.me>
7
- * @package ProductVendor
8
- */
9
-
10
-
11
- class WCV_Vendor_Shop
12
- {
13
-
14
- public static $seller_info;
15
-
16
- /**
17
- * init
18
- */
19
- function __construct()
20
- {
21
-
22
- add_filter( 'product_enquiry_send_to', array( 'WCV_Vendor_Shop', 'product_enquiry_compatibility' ), 10, 2 );
23
-
24
- add_action( 'woocommerce_product_query', array( $this, 'vendor_shop_query' ), 10, 2 );
25
- add_filter( 'init', array( $this, 'add_rewrite_rules' ), 0 );
26
-
27
- add_action( 'woocommerce_before_main_content', array( 'WCV_Vendor_Shop', 'shop_description' ), 30 );
28
- add_filter( 'woocommerce_product_tabs', array( 'WCV_Vendor_Shop', 'seller_info_tab' ) );
29
- add_filter( 'post_type_archive_link', array( 'WCV_Vendor_Shop', 'change_archive_link' ) );
30
-
31
- // Add sold by to product loop before add to cart
32
- if ( WC_Vendors::$pv_options->get_option( 'sold_by' ) ) {
33
- add_action( 'woocommerce_after_shop_loop_item', array('WCV_Vendor_Shop', 'template_loop_sold_by'), 9 );
34
- }
35
-
36
- // Remove Page Title if on Vendor Shop
37
- add_filter ( 'woocommerce_show_page_title', array( 'WCV_Vendor_Shop', 'remove_vendor_title' ) );
38
-
39
- // Show vendor on all sales related invoices
40
- if ( version_compare( WC_VERSION, '2.7', '<' ) ) {
41
-
42
- add_action( 'woocommerce_add_order_item_meta', array( $this, 'add_vendor_to_order_item_meta_legacy' ), 50, 2 );
43
-
44
- } else {
45
-
46
- add_action( 'woocommerce_checkout_create_order_line_item', array( $this, 'add_vendor_to_order_item_meta' ), 50, 3 ); }
47
-
48
- // Add a vendor header
49
- if (WC_Vendors::$pv_options->get_option( 'shop_headers_enabled' ) ) {
50
- add_action( 'woocommerce_before_main_content', array('WCV_Vendor_Shop', 'vendor_main_header'), 20 );
51
- add_action( 'woocommerce_before_single_product', array('WCV_Vendor_Shop', 'vendor_mini_header'));
52
- }
53
-
54
- add_filter( 'document_title_parts', array( $this, 'vendor_page_title' ) );
55
-
56
- }
57
-
58
- public static function change_archive_link( $link )
59
- {
60
- $vendor_shop = urldecode( get_query_var( 'vendor_shop' ) );
61
- $vendor_id = WCV_Vendors::get_vendor_id( $vendor_shop );
62
-
63
- return !$vendor_id ? $link : WCV_Vendors::get_vendor_shop_page( $vendor_id );
64
- }
65
-
66
- public static function vendor_shop_query( $q, $that )
67
- {
68
- $vendor_shop = urldecode( get_query_var( 'vendor_shop' ) );
69
- $vendor_id = WCV_Vendors::get_vendor_id( $vendor_shop );
70
-
71
- if ( !$vendor_id ) return;
72
- add_filter( 'woocommerce_page_title', array( 'WCV_Vendor_Shop', 'page_title' ) );
73
-
74
- $q->set( 'author', $vendor_id );
75
- }
76
-
77
- public static function product_enquiry_compatibility( $send_to, $product_id )
78
- {
79
- $author_id = get_post( $product_id )->post_author;
80
- if ( WCV_Vendors::is_vendor( $author_id ) ) {
81
- $send_to = get_userdata( $author_id )->user_email;
82
- }
83
-
84
- return $send_to;
85
- }
86
-
87
-
88
- /**
89
- *
90
- *
91
- * @param unknown $tabs
92
- *
93
- * @return unknown
94
- */
95
- public static function seller_info_tab( $tabs )
96
- {
97
- global $post;
98
-
99
- if ( WCV_Vendors::is_vendor( $post->post_author ) ) {
100
-
101
- $seller_info = get_user_meta( $post->post_author, 'pv_seller_info', true );
102
- $has_html = get_user_meta( $post->post_author, 'pv_shop_html_enabled', true );
103
- $global_html = WC_Vendors::$pv_options->get_option( 'shop_html_enabled' );
104
-
105
- $seller_info_label = WC_Vendors::$pv_options->get_option( 'seller_info_label' );
106
-
107
- if ( !empty( $seller_info ) ) {
108
-
109
- $seller_info = do_shortcode( $seller_info );
110
- self::$seller_info = '<div class="pv_seller_info">';
111
- self::$seller_info .= apply_filters('wcv_before_seller_info_tab', '');
112
- self::$seller_info .= ( $global_html || $has_html ) ? wpautop( wptexturize( wp_kses_post( $seller_info ) ) ) : sanitize_text_field( $seller_info );
113
- self::$seller_info .= apply_filters('wcv_after_seller_info_tab', '');
114
- self::$seller_info .= '</div>';
115
-
116
- $tabs[ 'seller_info' ] = array(
117
- 'title' => apply_filters( 'wcvendors_seller_info_label', $seller_info_label ),
118
- 'priority' => 50,
119
- 'callback' => array( 'WCV_Vendor_Shop', 'seller_info_tab_panel' ),
120
- );
121
- }
122
- }
123
-
124
- return $tabs;
125
- }
126
-
127
-
128
- /**
129
- *
130
- */
131
- public static function seller_info_tab_panel()
132
- {
133
- echo self::$seller_info;
134
- }
135
-
136
-
137
- /**
138
- * Show the description a vendor sets when viewing products by that vendor
139
- */
140
- public static function shop_description()
141
- {
142
- $vendor_shop = urldecode( get_query_var( 'vendor_shop' ) );
143
- $vendor_id = WCV_Vendors::get_vendor_id( $vendor_shop );
144
-
145
- if ( $vendor_id ) {
146
- $has_html = get_user_meta( $vendor_id, 'pv_shop_html_enabled', true );
147
- $global_html = WC_Vendors::$pv_options->get_option( 'shop_html_enabled' );
148
- $description = do_shortcode( get_user_meta( $vendor_id, 'pv_shop_description', true ) );
149
-
150
- echo '<div class="pv_shop_description">';
151
- echo ( $global_html || $has_html ) ? wpautop( wptexturize( wp_kses_post( $description ) ) ) : sanitize_text_field( $description );
152
- echo '</div>';
153
- }
154
- }
155
-
156
- /**
157
- *
158
- */
159
- public static function add_rewrite_rules()
160
- {
161
- $permalink = untrailingslashit( WC_Vendors::$pv_options->get_option( 'vendor_shop_permalink' ) );
162
-
163
- // Remove beginning slash
164
- if ( substr( $permalink, 0, 1 ) == '/' ) {
165
- $permalink = substr( $permalink, 1, strlen( $permalink ) );
166
- }
167
-
168
- add_rewrite_tag( '%vendor_shop%', '([^&]+)' );
169
-
170
- add_rewrite_rule( $permalink . '/([^/]*)/page/([0-9]+)', 'index.php?post_type=product&vendor_shop=$matches[1]&paged=$matches[2]', 'top' );
171
- add_rewrite_rule( $permalink . '/([^/]*)', 'index.php?post_type=product&vendor_shop=$matches[1]', 'top' );
172
- }
173
-
174
-
175
- public static function page_title( $page_title = "" )
176
- {
177
- $vendor_shop = urldecode( get_query_var( 'vendor_shop' ) );
178
- $vendor_id = WCV_Vendors::get_vendor_id( $vendor_shop );
179
-
180
- return $vendor_id ? WCV_Vendors::get_vendor_shop_name( $vendor_id ) : $page_title;
181
- }
182
-
183
-
184
- /*
185
- Adding sold by to product loop
186
- */
187
- public static function template_loop_sold_by($product_id) {
188
- $vendor_id = WCV_Vendors::get_vendor_from_product( $product_id );
189
- $sold_by_label = WC_Vendors::$pv_options->get_option( 'sold_by_label' );
190
- $sold_by = WCV_Vendors::is_vendor( $vendor_id )
191
- ? sprintf( '<a href="%s">%s</a>', WCV_Vendors::get_vendor_shop_page( $vendor_id ), WCV_Vendors::get_vendor_sold_by( $vendor_id ) )
192
- : get_bloginfo( 'name' );
193
-
194
- wc_get_template( 'vendor-sold-by.php', array(
195
- 'vendor_id' => $vendor_id,
196
- 'sold_by_label' => $sold_by_label,
197
- 'sold_by' => $sold_by,
198
-
199
- ), 'wc-vendors/front/', wcv_plugin_dir . 'templates/front/' );
200
-
201
- }
202
-
203
-
204
- /*
205
- * Remove the Page title from Archive-Product while on a vendor Page
206
- */
207
- public static function remove_vendor_title( $b ) {
208
-
209
- if ( WCV_Vendors::is_vendor_page() ) {
210
- return false;
211
- }
212
- return $b;
213
- }
214
-
215
- /*
216
- * Display a vendor header at the top of the vendors product archive page
217
- */
218
- public static function vendor_main_header() {
219
-
220
- // Remove the basic shop description from the loop
221
- remove_action( 'woocommerce_before_main_content', array('WCV_Vendor_Shop', 'shop_description' ), 30);
222
-
223
- if (WCV_Vendors::is_vendor_page()) {
224
- $vendor_shop = urldecode( get_query_var( 'vendor_shop' ) );
225
- $vendor_id = WCV_Vendors::get_vendor_id( $vendor_shop );
226
- $shop_name = get_user_meta( $vendor_id, 'pv_shop_name', true );
227
-
228
- // Shop description
229
- $has_html = get_user_meta( $vendor_id, 'pv_shop_html_enabled', true );
230
- $global_html = WC_Vendors::$pv_options->get_option( 'shop_html_enabled' );
231
- $description = do_shortcode( get_user_meta( $vendor_id, 'pv_shop_description', true ) );
232
- $shop_description = ( $global_html || $has_html ) ? wpautop( wptexturize( wp_kses_post( $description ) ) ) : sanitize_text_field( $description );
233
- $seller_info = ( $global_html || $has_html ) ? wpautop( get_user_meta( $vendor_id, 'pv_seller_info', true ) ) : sanitize_text_field( get_user_meta( $vendor_id, 'pv_seller_info', true ) );
234
- $vendor = get_userdata( $vendor_id );
235
- $vendor_email = $vendor->user_email;
236
- $vendor_login = $vendor->user_login;
237
-
238
-
239
- do_action('wcv_before_main_header', $vendor_id);
240
-
241
- wc_get_template( 'vendor-main-header.php', array(
242
- 'vendor' => $vendor,
243
- 'vendor_id' => $vendor_id,
244
- 'shop_name' => $shop_name,
245
- 'shop_description' => $shop_description,
246
- 'seller_info' => $seller_info,
247
- 'vendor_email' => $vendor_email,
248
- 'vendor_login' => $vendor_login,
249
- ), 'wc-vendors/front/', wcv_plugin_dir . 'templates/front/' );
250
-
251
- do_action('wcv_after_main_header', $vendor_id);
252
-
253
- }
254
- }
255
-
256
-
257
- /*
258
- * Display a vendor header at the top of the single-product page
259
- */
260
- public static function vendor_mini_header() {
261
-
262
- global $product;
263
-
264
- if ( WCV_Vendors::is_vendor_product_page($product->post->post_author)) {
265
-
266
- $vendor = get_userdata( $product->post->post_author );
267
- $vendor_id = $product->post->post_author;
268
- $vendor_shop_link = site_url( WC_Vendors::$pv_options->get_option( 'vendor_shop_permalink' ) .'/' .$vendor->pv_shop_slug );
269
- $shop_name = get_user_meta( $vendor_id, 'pv_shop_name', true );
270
- $has_html = $vendor->pv_shop_html_enabled;
271
- $global_html = WC_Vendors::$pv_options->get_option( 'shop_html_enabled' );
272
- $description = do_shortcode( $vendor->pv_shop_description );
273
- $shop_description = ( $global_html || $has_html ) ? wpautop( wptexturize( wp_kses_post( $description ) ) ) : sanitize_text_field( $description );
274
- $seller_info = ( $global_html || $has_html ) ? wpautop( get_user_meta( $vendor_id, 'pv_seller_info', true ) ) : sanitize_text_field( get_user_meta( $vendor_id, 'pv_seller_info', true ) );
275
- $vendor_email = $vendor->user_email;
276
- $vendor_login = $vendor->user_login;
277
-
278
- do_action('wcv_before_mini_header', $vendor->ID);
279
-
280
- wc_get_template( 'vendor-mini-header.php', array(
281
- 'vendor' => $vendor,
282
- 'vendor_id' => $vendor_id,
283
- 'vendor_shop_link' => $vendor_shop_link,
284
- 'shop_name' => $vendor->pv_shop_name,
285
- 'shop_description' => $shop_description,
286
- 'seller_info' => $seller_info,
287
- 'shop_name' => $shop_name,
288
- 'vendor_email' => $vendor_email,
289
- 'vendor_login' => $vendor_login,
290
- ), 'wc-vendors/front/', wcv_plugin_dir . 'templates/front/' );
291
-
292
- do_action('wcv_after_mini_header', $vendor->ID);
293
-
294
- }
295
- }
296
-
297
- /*
298
- * Add Vendor to Order item Meta legacy
299
- * Thanks to Asbjoern Andersen for the code
300
- *
301
- * @depreciated
302
- */
303
- public static function add_vendor_to_order_item_meta_legacy( $item_id, $cart_item) {
304
-
305
- $vendor_id = $cart_item[ 'data' ]->post->post_author;
306
- $sold_by_label = WC_Vendors::$pv_options->get_option( 'sold_by_label' );
307
- $sold_by = WCV_Vendors::is_vendor( $vendor_id ) ? sprintf( WCV_Vendors::get_vendor_sold_by( $vendor_id ) ): get_bloginfo( 'name' );
308
-
309
- wc_add_order_item_meta( $item_id, apply_filters( 'wcvendors_sold_by_in_email', $sold_by_label ), $sold_by );
310
- }
311
-
312
-
313
- /**
314
- * Add vendor to order item meta WC2.7 and above
315
- *
316
- * @since 1.9.9
317
- * @access public
318
- */
319
- public function add_vendor_to_order_item_meta( $item, $cart_item_key, $values ) {
320
-
321
- $cart = WC()->cart->get_cart();
322
- $cart_item = $cart[ $cart_item_key ];
323
- $product_id = $cart_item[ 'product_id'];
324
- $post = get_post( $product_id );
325
- $vendor_id = $post->post_author;
326
- $sold_by_label = WC_Vendors::$pv_options->get_option( 'sold_by_label' );
327
- $sold_by = WCV_Vendors::is_vendor( $vendor_id ) ? sprintf( WCV_Vendors::get_vendor_sold_by( $vendor_id ) ): get_bloginfo( 'name' );
328
-
329
- $item->add_meta_data( apply_filters( 'wcvendors_sold_by_in_email', $sold_by_label ), $sold_by );
330
-
331
-
332
- } // add_vendor_to_order_item_meta()
333
-
334
-
335
- /**
336
- * Add the Vendor shop name to the <title> tag on archive and single product page
337
- *
338
- * @since 1.9.9
339
- */
340
- public function vendor_page_title( $title ){
341
-
342
- if ( WCV_Vendors::is_vendor_page() ) {
343
-
344
- $title[ 'title' ] = self::page_title();
345
- }
346
-
347
- return $title;
348
-
349
- } // vendor_page_title
350
-
351
-
352
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/classes/front/dashboard/class-vendor-dashboard.php DELETED
@@ -1,515 +0,0 @@
1
- <?php
2
-
3
- /**
4
- * WCV Vendor Dashboard
5
- *
6
- * @author Matt Gates <http://mgates.me>
7
- * @author Jamie Madden <http://wcvendors.com>
8
- * @package WCVendors
9
- */
10
-
11
-
12
- class WCV_Vendor_Dashboard
13
- {
14
-
15
-
16
- /**
17
- * __construct()
18
- */
19
- function __construct()
20
- {
21
- add_shortcode( 'wcv_shop_settings', array( $this, 'display_vendor_settings' ) );
22
- add_shortcode( 'wcv_vendor_dashboard', array( $this, 'display_vendor_products' ) );
23
-
24
- add_action( 'template_redirect', array( $this, 'check_access' ) );
25
- add_action( 'init', array( $this, 'save_vendor_settings' ) );
26
- }
27
-
28
- public function save_vendor_settings()
29
- {
30
- global $woocommerce;
31
-
32
- $user_id = get_current_user_id();
33
-
34
- if ( !empty( $_GET['wc_pv_mark_shipped'] ) ) {
35
- $order_id = $_GET['wc_pv_mark_shipped'];
36
- $order = wc_get_order( $order_id );
37
- $vendors = WCV_Vendors::get_vendors_from_order( $order );
38
- $vendor_ids = array_keys( $vendors );
39
- if ( !in_array( $user_id, $vendor_ids ) ) {
40
- wc_add_notice( __( 'You are not allowed to modify this order.', 'wcvendors' ) );
41
- return null;
42
- }
43
- $shippers = (array) get_post_meta( $order_id, 'wc_pv_shipped', true );
44
-
45
- // If not in the shippers array mark as shipped otherwise do nothing.
46
- if( !in_array($user_id, $shippers)) {
47
- $shippers[] = $user_id;
48
- $mails = $woocommerce->mailer()->get_emails();
49
- if ( !empty( $mails ) ) {
50
- $mails[ 'WC_Email_Notify_Shipped' ]->trigger( $order_id, $user_id );
51
- }
52
- do_action('wcvendors_vendor_ship', $order_id, $user_id);
53
- wc_add_notice( __( 'Order marked shipped.', 'wcvendors' ), 'success' );
54
- $shop_name = WCV_Vendors::get_vendor_shop_name( $user_id );
55
- $order->add_order_note( apply_filters( 'wcvendors_vendor_shipped_note', sprintf( __( '%s has marked as shipped. ', 'wcvendors'), $shop_name ) , $user_id, $shop_name ) );
56
- } elseif ( false != ( $key = array_search( $user_id, $shippers) ) ) {
57
- unset( $shippers[$key] ); // Remove user from the shippers array
58
- }
59
-
60
- update_post_meta( $order_id, 'wc_pv_shipped', $shippers );
61
- return;
62
- }
63
-
64
- if ( isset( $_POST[ 'update_tracking' ] ) ) {
65
- $order_id = (int) $_POST[ 'order_id' ];
66
- $product_id = (int) $_POST[ 'product_id' ];
67
-
68
- $tracking_provider = wc_clean( $_POST[ 'tracking_provider' ] );
69
- $custom_tracking_provider = wc_clean( $_POST[ 'custom_tracking_provider_name' ] );
70
- $custom_tracking_link = wc_clean( $_POST[ 'custom_tracking_url' ] );
71
- $tracking_number = wc_clean( $_POST[ 'tracking_number' ] );
72
- $date_shipped = wc_clean( strtotime( $_POST[ 'date_shipped' ] ) );
73
-
74
- $order = new WC_Order( $order_id );
75
- $products = $order->get_items();
76
- foreach ( $products as $key => $value ) {
77
- if ( $value[ 'product_id' ] == $product_id || $value[ 'variation_id' ] == $product_id ) {
78
- $order_item_id = $key;
79
- break;
80
- }
81
- }
82
- if ( $order_item_id ) {
83
- wc_delete_order_item_meta( $order_item_id, __( 'Tracking number', 'wcvendors' ) );
84
- wc_add_order_item_meta( $order_item_id, __( 'Tracking number', 'wcvendors' ), $tracking_number );
85
-
86
- $message = __( 'Success. Your tracking number has been updated.', 'wcvendors' );
87
- wc_add_notice( $message, 'success' );
88
-
89
- // Update order data
90
- update_post_meta( $order_id, '_tracking_provider', $tracking_provider );
91
- update_post_meta( $order_id, '_custom_tracking_provider', $custom_tracking_provider );
92
- update_post_meta( $order_id, '_tracking_number', $tracking_number );
93
- update_post_meta( $order_id, '_custom_tracking_link', $custom_tracking_link );
94
- update_post_meta( $order_id, '_date_shipped', $date_shipped );
95
- }
96
-
97
- }
98
-
99
- if ( empty( $_POST[ 'vendor_application_submit' ] ) ) {
100
- return false;
101
- }
102
-
103
- if (isset ( $_POST[ 'wc-product-vendor-nonce' ] ) ) {
104
-
105
- if ( !wp_verify_nonce( $_POST[ 'wc-product-vendor-nonce' ], 'save-shop-settings' ) ) {
106
- return false;
107
- }
108
-
109
-
110
- if ( isset( $_POST[ 'pv_paypal' ] ) ) {
111
- if ( !is_email( $_POST[ 'pv_paypal' ] ) ) {
112
- wc_add_notice( __( 'Your PayPal address is not a valid email address.', 'wcvendors' ), 'error' );
113
- } else {
114
- update_user_meta( $user_id, 'pv_paypal', $_POST[ 'pv_paypal' ] );
115
- }
116
- }
117
-
118
- if ( !empty( $_POST[ 'pv_shop_name' ] ) ) {
119
- $users = get_users( array( 'meta_key' => 'pv_shop_slug', 'meta_value' => sanitize_title( $_POST[ 'pv_shop_name' ] ) ) );
120
- if ( !empty( $users ) && $users[ 0 ]->ID != $user_id ) {
121
- wc_add_notice( __( 'That shop name is already taken. Your shop name must be unique.', 'wcvendors' ), 'error' );
122
- } else {
123
- update_user_meta( $user_id, 'pv_shop_name', $_POST[ 'pv_shop_name' ] );
124
- update_user_meta( $user_id, 'pv_shop_slug', sanitize_title( $_POST[ 'pv_shop_name' ] ) );
125
- }
126
- }
127
-
128
- if ( isset( $_POST[ 'pv_shop_description' ] ) ) {
129
- update_user_meta( $user_id, 'pv_shop_description', $_POST[ 'pv_shop_description' ] );
130
- }
131
-
132
- if ( isset( $_POST[ 'pv_seller_info' ] ) ) {
133
- update_user_meta( $user_id, 'pv_seller_info', $_POST[ 'pv_seller_info' ] );
134
- }
135
-
136
- do_action( 'wcvendors_shop_settings_saved', $user_id );
137
-
138
- if ( !wc_notice_count() ) {
139
- wc_add_notice( __( 'Settings saved.', 'wcvendors' ), 'success' );
140
- }
141
- }
142
- }
143
-
144
-
145
- /**
146
- *
147
- */
148
- public function check_access()
149
- {
150
- $vendor_dashboard_page = WC_Vendors::$pv_options->get_option( 'vendor_dashboard_page' );
151
- $shop_settings_page = WC_Vendors::$pv_options->get_option( 'shop_settings_page' );
152
-
153
- if ( $vendor_dashboard_page && is_page( $vendor_dashboard_page ) || $shop_settings_page && is_page( $shop_settings_page ) ) {
154
- if ( !is_user_logged_in() ) {
155
- wp_redirect( get_permalink( wc_get_page_id( 'myaccount' ) ), 303 );
156
- exit;
157
- }
158
- }
159
-
160
- } //check_access()
161
-
162
-
163
- /**
164
- * [wcv_vendor_dashboard] shortcode
165
- *
166
- * @param array $atts
167
- *
168
- * @return unknown
169
- */
170
- public function display_vendor_products( $atts )
171
- {
172
- global $start_date, $end_date;
173
-
174
- $start_date = !empty( $_SESSION[ 'PV_Session' ][ 'start_date' ] ) ? $_SESSION[ 'PV_Session' ][ 'start_date' ] : strtotime( date( 'Ymd', strtotime( date( 'Ym', current_time( 'timestamp' ) ) . '01' ) ) );
175
- $end_date = !empty( $_SESSION[ 'PV_Session' ][ 'end_date' ] ) ? $_SESSION[ 'PV_Session' ][ 'end_date' ] : strtotime( date( 'Ymd', current_time( 'timestamp' ) ) );
176
-
177
- $can_view_orders = WC_Vendors::$pv_options->get_option( 'can_show_orders' );
178
- $settings_page = get_permalink( WC_Vendors::$pv_options->get_option( 'shop_settings_page' ) );
179
- $can_submit = WC_Vendors::$pv_options->get_option( 'can_submit_products' );
180
- $submit_link = ( $can_submit ) ? admin_url( 'post-new.php?post_type=product' ) : '';
181
- $edit_link = ( $can_submit ) ? admin_url( 'edit.php?post_type=product' ) : '';
182
-
183
- if ( !$this->can_view_vendor_page() ) {
184
- return false;
185
- }
186
-
187
- extract( shortcode_atts( array(
188
- 'user_id' => get_current_user_id(),
189
- 'datepicker' => true,
190
- ), $atts ) );
191
-
192
- $vendor_products = WCV_Queries::get_commission_products( $user_id );
193
- $products = array();
194
- foreach ($vendor_products as $_product) {
195
- $products[] = $_product->ID;
196
- }
197
-
198
- $vendor_summary = $this->format_product_details( $vendor_products );
199
- $order_summary = WCV_Queries::get_orders_for_products( $products );
200
- $shop_page = WCV_Vendors::get_vendor_shop_page( wp_get_current_user()->user_login );
201
-
202
- wp_enqueue_style( 'wcv_frontend_style', wcv_assets_url . 'css/wcv-frontend.css' );
203
-
204
- $providers = array();
205
- $provider_array = array();
206
-
207
- // WC Shipment Tracking Providers
208
- if ( class_exists( 'WC_Shipment_Tracking' ) ) {
209
- $WC_Shipment_Tracking = new WC_Shipment_Tracking();
210
- $providers = (method_exists($WC_Shipment_Tracking, 'get_providers')) ? $WC_Shipment_Tracking->get_providers() : $WC_Shipment_Tracking->providers;
211
- $provider_array = array();
212
- foreach ( $providers as $all_providers ) {
213
- foreach ( $all_providers as $provider => $format ) {
214
- $provider_array[sanitize_title( $provider )] = urlencode( $format );
215
- }
216
- }
217
- }
218
-
219
- ob_start();
220
- do_action( 'wcvendors_before_dashboard' );
221
-
222
- wc_print_notices();
223
- wc_get_template( 'links.php', array(
224
- 'shop_page' => urldecode($shop_page),
225
- 'settings_page' => $settings_page,
226
- 'can_submit' => $can_submit,
227
- 'submit_link' => $submit_link,
228
- 'edit_link' => $edit_link,
229
- ), 'wc-vendors/dashboard/', wcv_plugin_dir . 'templates/dashboard/' );
230
-
231
- if ( $can_view_sales = WC_Vendors::$pv_options->get_option( 'can_view_frontend_reports' ) ) {
232
-
233
- wc_get_template( 'reports.php', array(
234
- 'start_date' => $start_date,
235
- 'end_date' => $end_date,
236
- 'vendor_products' => $vendor_products,
237
- 'vendor_summary' => $vendor_summary,
238
- 'datepicker' => $datepicker,
239
- 'can_view_orders' => $can_view_orders,
240
- ), 'wc-vendors/dashboard/', wcv_plugin_dir . 'templates/dashboard/' );
241
- }
242
-
243
- wc_get_template( 'orders.php', array(
244
- 'start_date' => $start_date,
245
- 'end_date' => $end_date,
246
- 'vendor_products' => $vendor_products,
247
- 'order_summary' => $order_summary,
248
- 'datepicker' => $datepicker,
249
- 'providers' => $providers,
250
- 'provider_array' => $provider_array,
251
- 'can_view_orders' => $can_view_orders,
252
- ), 'wc-vendors/dashboard/', wcv_plugin_dir . 'templates/dashboard/' );
253
- do_action( 'wcvendors_after_dashboard' );
254
-
255
-
256
- if ( function_exists( 'wc_enqueue_js' ) ) {
257
- wc_enqueue_js( WCV_Vendor_dashboard::wc_st_js( $provider_array ) );
258
- } else {
259
- $woocommerce->add_inline_js( $js );
260
- }
261
-
262
- return ob_get_clean();
263
- }
264
-
265
-
266
- /**
267
- * [pv_recent_vendor_sales] shortcode
268
- *
269
- * @param array $atts
270
- *
271
- * @return unknown
272
- */
273
- public function display_vendor_settings( $atts )
274
- {
275
- global $woocommerce;
276
-
277
- if ( !$this->can_view_vendor_page() ) {
278
- return false;
279
- }
280
-
281
- extract( shortcode_atts( array(
282
- 'user_id' => get_current_user_id(),
283
- 'paypal_address' => true,
284
- 'shop_description' => true,
285
- ), $atts ) );
286
-
287
- $description = get_user_meta( $user_id, 'pv_shop_description', true );
288
- $seller_info = get_user_meta( $user_id, 'pv_seller_info', true );
289
- $has_html = get_user_meta( $user_id, 'pv_shop_html_enabled', true );
290
- $shop_page = WCV_Vendors::get_vendor_shop_page( wp_get_current_user()->user_login );
291
- $global_html = WC_Vendors::$pv_options->get_option( 'shop_html_enabled' );
292
-
293
- ob_start();
294
- wc_get_template( 'settings.php', array(
295
- 'description' => $description,
296
- 'global_html' => $global_html,
297
- 'has_html' => $has_html,
298
- 'paypal_address' => $paypal_address,
299
- 'seller_info' => $seller_info,
300
- 'shop_description' => $shop_description,
301
- 'shop_page' => $shop_page,
302
- 'user_id' => $user_id,
303
- ), 'wc-vendors/dashboard/settings/', wcv_plugin_dir . 'templates/dashboard/settings/' );
304
-
305
- return ob_get_clean();
306
- }
307
-
308
-
309
- /**
310
- *
311
- *
312
- * @return unknown
313
- */
314
- public static function can_view_vendor_page()
315
- {
316
- if ( !is_user_logged_in() ) {
317
-
318
- return false;
319
-
320
- } else if ( !WCV_Vendors::is_vendor( get_current_user_id() ) ) {
321
-
322
- wc_get_template( 'denied.php', array(), 'wc-vendors/dashboard/', wcv_plugin_dir . 'templates/dashboard/' );
323
-
324
- return false;
325
-
326
- }
327
-
328
- return true;
329
- }
330
-
331
-
332
- /**
333
- * Format products for easier displaying
334
- *
335
- * @param object $products
336
- *
337
- * @return array
338
- */
339
- public function format_product_details( $products )
340
- {
341
- if ( empty( $products ) ) return false;
342
-
343
- // This is required to support existing installations after WC 2.6
344
- $orders_page_id = (string) WC_Vendors::$pv_options->get_option( 'orders_page' );
345
- $orders_page_id = ( strlen( $orders_page_id ) > 0 ) ? $orders_page_id : WC_Vendors::$pv_options->get_option( 'product_orders_page' );
346
- $orders_page = get_permalink( $orders_page_id );
347
- $default_commission = WC_Vendors::$pv_options->get_option( 'default_commission' );
348
- $total_qty = $total_cost = 0;
349
- $data = array(
350
- 'products' => array(),
351
- 'total_qty' => '',
352
- 'total_cost' => '',
353
- );
354
-
355
- foreach ( $products as $product )
356
- $ids[ ] = $product->ID;
357
-
358
- $orders = WCV_Queries::sum_orders_for_products( $ids, array( 'vendor_id' => get_current_user_id() ) );
359
-
360
- if ( $orders )
361
- foreach ( $orders as $order_item ) {
362
- if ( $order_item->qty < 1 ) continue;
363
-
364
- $commission_rate = WCV_Commission::get_commission_rate( $order_item->product_id );
365
- $_product = wc_get_product( $order_item->product_id );
366
- $parent_id = ( version_compare( WC_VERSION, '2.7', '<' ) ) ? $_product->parent->id : $_product->get_parent_id();
367
- $id = !empty( $parent_id ) ?$parent_id : $order_item->product_id;
368
-
369
- $data[ 'products' ][$id] = array(
370
- 'id' => $id,
371
- 'title' => $_product->get_title(),
372
- 'qty' => !empty($data[ 'products' ][$id]) ? $data[ 'products' ][$id]['qty'] + $order_item->qty : $order_item->qty,
373
- 'cost' => !empty($data[ 'products' ][$id]) ? $data[ 'products' ][$id]['cost'] + $order_item->line_total : $order_item->line_total,
374
- 'view_orders_url' => esc_url( add_query_arg( 'orders_for_product', $id, $orders_page ) ),
375
- 'commission_rate' => $commission_rate,
376
- );
377
-
378
- $total_qty += $order_item->qty;
379
- $total_cost += $order_item->line_total;
380
-
381
- }
382
-
383
- $data[ 'total_qty' ] = $total_qty;
384
- $data[ 'total_cost' ] = $total_cost;
385
-
386
- // Sort by product title
387
- if ( !empty( $data[ 'products' ] ) )
388
- usort( $data[ 'products' ], array( $this, 'sort_by_title' ) );
389
-
390
- return $data;
391
- }
392
-
393
-
394
- /**
395
- * Sort an array by 'title'
396
- *
397
- * @param array $a
398
- * @param array $b
399
- *
400
- * @return array
401
- */
402
- private function sort_by_title( array $a, array $b )
403
- {
404
- return strcasecmp( $a[ 'title' ], $b[ 'title' ] );
405
- }
406
-
407
- /**
408
- * Load the javascript for the WC Shipment Tracking form
409
- */
410
- public static function wc_st_js( $provider_array ) {
411
- $js = "
412
- jQuery(function() {
413
-
414
- var providers = jQuery.parseJSON( '" . json_encode( $provider_array ) . "' );
415
-
416
- jQuery('#tracking_number').prop('readonly',true);
417
- jQuery('#date_shipped').prop('readonly',true);
418
-
419
- function updatelink( tracking, provider ) {
420
-
421
- var postcode = '32';
422
- postcode = encodeURIComponent(postcode);
423
-
424
- link = providers[provider];
425
- link = link.replace('%251%24s', tracking);
426
- link = link.replace('%252%24s', postcode);
427
- link = decodeURIComponent(link);
428
- return link;
429
- }
430
-
431
- jQuery('.tracking_provider, #tracking_number').unbind().change(function(){
432
-
433
- var form = jQuery(this).parent().parent().attr('id');
434
-
435
- var tracking = jQuery('#' + form + ' input#tracking_number').val();
436
- var provider = jQuery('#' + form + ' #tracking_provider').val();
437
-
438
- if ( providers[ provider ]) {
439
- link = updatelink(tracking, provider);
440
- jQuery('#' + form + ' #tracking_number').prop('readonly',false);
441
- jQuery('#' + form + ' #date_shipped').prop('readonly',false);
442
- jQuery('#' + form + ' .custom_tracking_url_field, #' + form + ' .custom_tracking_provider_name_field').hide();
443
- } else {
444
- jQuery('#' + form + ' .custom_tracking_url_field, #' + form + ' .custom_tracking_provider_name_field').show();
445
- link = jQuery('#' + form + ' input#custom_tracking_link').val();
446
- }
447
-
448
- if (link) {
449
- jQuery('#' + form + ' p.preview_tracking_link a').attr('href', link);
450
- jQuery('#' + form + ' p.preview_tracking_link').show();
451
- } else {
452
- jQuery('#' + form + ' p.preview_tracking_link').hide();
453
- }
454
-
455
- });
456
-
457
- jQuery('#custom_tracking_provider_name').unbind().click(function(){
458
-
459
- var form = jQuery(this).parent().parent().attr('id');
460
-
461
- jQuery('#' + form + ' #tracking_number').prop('readonly',false);
462
- jQuery('#' + form + ' #date_shipped').prop('readonly',false);
463
-
464
- });
465
-
466
- });
467
- ";
468
-
469
- return $js;
470
- } // wc_st_js()
471
-
472
-
473
- /**
474
- * Add custom wcvendors pro css classes
475
- *
476
- * @since 1.0.0
477
- * @access public
478
- *
479
- * @param array $classes - body css classes
480
- * @return array $classes - body css classes
481
- */
482
- public function body_class( $classes ){
483
-
484
- $dashboard_page = WC_Vendors::$pv_options->get_option( 'vendor_dashboard_page' );
485
-
486
- // This is required to support existing installations after WC 2.6
487
- $orders_page_id = WC_Vendors::$pv_options->get_option( 'orders_page' );
488
- $orders_page_id = isset( $orders_page_id ) ? $orders_page_id : WC_Vendors::$pv_options->get_option( 'product_orders_page' );
489
-
490
- $orders_page = $orders_page_id;
491
- $shop_settings = WC_Vendors::$pv_options->get_option( 'shop_settings_page' );
492
- $terms_page = WC_Vendors::$pv_options->get_option( 'terms_to_apply_page' );
493
-
494
- if ( is_page( $dashboard_page ) ){
495
- $classes[] = 'wcvendors wcv-vendor-dashboard-page';
496
- }
497
-
498
- if ( is_page( $orders_page ) ){
499
- $classes[] = 'wcvendors wcv-orders-page';
500
- }
501
-
502
- if ( is_page( $shop_settings ) ){
503
- $classes[] = 'wcvendors wcv-shop-settings-page';
504
- }
505
-
506
- if ( is_page( $terms_page ) ){
507
- $classes[] = 'wcvendors wcv-terms-page';
508
- }
509
-
510
-
511
- return $classes;
512
-
513
-
514
- } // body_class()
515
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/classes/front/orders/class-export-csv.php DELETED
@@ -1,98 +0,0 @@
1
- <?php
2
-
3
- class WCV_Export_CSV
4
- {
5
-
6
- /**
7
- * Sort the data for CSV output first
8
- *
9
- * @param int $product_id
10
- * @param array $headers
11
- * @param array $body
12
- * @param array $items
13
- */
14
-
15
-
16
- public static function output_csv( $product_id, $headers, $body, $items )
17
- {
18
-
19
- $headers[ 'quantity' ] = __( 'Quantity', 'wcvendors' );
20
- $headers[ 'item_meta' ] = __( 'Item Meta', 'wcvendors' );
21
-
22
- $new_body = array();
23
-
24
- foreach ( $body as $i => $order ) {
25
-
26
- // Remove comments
27
- unset( $body[ $i ][ 'comments' ] );
28
-
29
- // Remove all numeric keys in each order (these are the meta values we are redoing into new lines)
30
- foreach ( $order as $key => $col ) {
31
- if ( is_int( $key ) ) unset( $order[ $key ] );
32
- }
33
-
34
- // New order row
35
- $new_row = $body[ $i ];
36
- // Remove order to redo
37
- unset( $body[ $i ] );
38
-
39
- $order = new WC_Order( $i );
40
-
41
- foreach ( $items[ $i ][ 'items' ] as $item ) {
42
-
43
- $product_id = !empty( $item['variation_id'] ) ? $item['variation_id'] : $item['product_id'];
44
-
45
- $_product = $order->get_product_from_item( $item );
46
-
47
- $new_row_with_meta = $new_row;
48
-
49
- // Add the qty row
50
- $new_row_with_meta[] = $item[ 'qty' ];
51
- // Add the new item meta row
52
-
53
- $variation_detail = !empty( $item['variation_id'] ) ? WCV_Orders::get_variation_data( $item[ 'variation_id' ] ) : '';
54
-
55
- $new_row_with_meta[] = $variation_detail;
56
- $new_row_with_meta['product'] = $item[ 'name' ];
57
- $new_body[] = $new_row_with_meta;
58
- }
59
- }
60
-
61
- $headers = apply_filters( 'wcvendors_csv_headers', $headers, $product_id, $items );
62
- $body = apply_filters( 'wcvendors_csv_body', $new_body, $product_id, $items );
63
-
64
- WCV_Export_CSV::download( $headers, $body, $product_id );
65
- }
66
-
67
-
68
- /**
69
- * Send the CSV to the browser for download
70
- *
71
- * @param array $headers
72
- * @param array $body
73
- * @param string $filename
74
- */
75
- public static function download( $headers, $body, $filename )
76
- {
77
- // Clear browser output before this point
78
- if (ob_get_contents()) ob_end_clean();
79
-
80
- // Output headers so that the file is downloaded rather than displayed
81
- header( 'Content-Type: text/csv; charset=utf-8' );
82
- header( 'Content-Disposition: attachment; filename=orders_for_' . $filename . '.csv' );
83
-
84
- // Create a file pointer connected to the output stream
85
- $output = fopen( 'php://output', 'w' );
86
-
87
- // Output the column headings
88
- fputcsv( $output, $headers );
89
-
90
- // Body
91
- foreach ( $body as $data )
92
- fputcsv( $output, $data );
93
-
94
- die();
95
- }
96
-
97
-
98
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/classes/front/orders/class-orders.php DELETED
@@ -1,362 +0,0 @@
1
- <?php
2
-
3
- /**
4
- * My account views
5
- *
6
- * @author Matt Gates <http://mgates.me>
7
- * @package ProductVendor
8
- */
9
-
10
-
11
- class WCV_Orders
12
- {
13
-
14
-
15
- /**
16
- * __construct()
17
- */
18
- function __construct()
19
- {
20
- $this->can_view_orders = WC_Vendors::$pv_options->get_option( 'can_show_orders' );
21
- $this->can_export_csv = WC_Vendors::$pv_options->get_option( 'can_export_csv' );
22
- $this->can_view_emails = WC_Vendors::$pv_options->get_option( 'can_view_order_emails' );
23
-
24
- add_action( 'template_redirect', array( $this, 'check_access' ) );
25
- add_action( 'template_redirect', array( $this, 'process_export_orders' ) );
26
- // add_action( 'template_redirect', array( $this, 'display_product_orders' ) );
27
- // add_action( 'wp', array( $this, 'display_shortcodes' ) );
28
- add_shortcode( 'wcv_orders', array( $this, 'display_product_orders' ) );
29
- }
30
-
31
-
32
- /**
33
- *
34
- */
35
- public function check_access()
36
- {
37
-
38
- // This is required to support existing installations after WC 2.6
39
- $orders_page_id = WC_Vendors::$pv_options->get_option( 'orders_page' );
40
- $orders_page_id = isset( $orders_page_id ) ? $orders_page_id : WC_Vendors::$pv_options->get_option( 'product_orders_page' );
41
-
42
- $orders_page = $orders_page_id;
43
- // Only if the orders page is set should we check access
44
- if ( $orders_page && is_page( $orders_page ) && !is_user_logged_in() ) {
45
- wp_redirect( get_permalink( wc_get_page_id( 'myaccount' ) ), 303 );
46
- exit;
47
- }
48
-
49
- } // check_access()
50
-
51
-
52
- /**
53
- * DEPRICATED
54
- */
55
- public function display_shortcodes()
56
- {
57
-
58
- if ( is_page( WC_Vendors::$pv_options->get_option( 'orders_page' ) ) && $this->can_view_orders ) {
59
-
60
- wp_enqueue_script( 'jquery' );
61
-
62
- $this->product_id = !empty( $_GET[ 'orders_for_product' ] ) ? (int) $_GET[ 'orders_for_product' ] : false;
63
-
64
- $products = array( $this->product_id );
65
-
66
- $_product = wc_get_product( $this->product_id );
67
-
68
- if ( is_object( $_product ) ) {
69
-
70
- $children = $_product->get_children();
71
-
72
- if ( !empty( $children ) ) {
73
- $products = array_merge($products, $children);
74
- $products = array_unique($products);
75
- }
76
- }
77
-
78
- $this->orders = WCV_Queries::get_orders_for_products( $products, array( 'vendor_id' => get_current_user_id() ) );
79
-
80
- add_action( 'init', array( $this, 'verify_order_access' ) );
81
- add_shortcode( 'wcv_orders', array( $this, 'display_product_orders' ) );
82
-
83
- if ( $this->can_export_csv && !empty( $_POST[ 'export_orders' ] ) ) {
84
- $this->download_csv();
85
- }
86
-
87
- }
88
-
89
- }
90
-
91
- /**
92
- * Processs export orders csv request
93
- *
94
- * @since 1.9.4
95
- */
96
- public function process_export_orders( ){
97
-
98
- if ( empty( $_GET[ 'orders_for_product' ] ) ) {
99
-
100
- return __( 'You haven\'t selected a product\'s orders to view! Please go back to the Vendor Dashboard and click Show Orders on the product you\'d like to view.', 'wcvendors' );
101
-
102
- } else {
103
- $this->product_id = !empty( $_GET[ 'orders_for_product' ] ) ? (int) $_GET[ 'orders_for_product' ] : false;
104
-
105
- $products = array( $this->product_id );
106
-
107
- $_product = wc_get_product( $this->product_id );
108
-
109
- if ( is_object( $_product ) ) {
110
-
111
- $children = $_product->get_children();
112
-
113
- if ( !empty( $children ) ) {
114
- $products = array_merge($products, $children);
115
- $products = array_unique($products);
116
- }
117
- }
118
-
119
- $this->orders = WCV_Queries::get_orders_for_products( $products, array( 'vendor_id' => get_current_user_id() ) );
120
- }
121
-
122
- if ( !$this->orders ) {
123
- return __( 'No orders.', 'wcvendors' );
124
- }
125
-
126
- if ( $this->can_export_csv && !empty( $_POST[ 'export_orders' ] ) ) {
127
- $this->download_csv();
128
- }
129
-
130
- } // process_export_orders()
131
-
132
- /**
133
- *
134
- *
135
- * @return unknown
136
- */
137
- public function download_csv()
138
- {
139
- if ( !$this->orders ) return false;
140
-
141
- extract( WCV_Orders::format_order_details( $this->orders, $this->product_id ) );
142
- $headers = WCV_Orders::get_headers();
143
-
144
- // Export the CSV
145
- require_once wcv_plugin_dir . 'classes/front/orders/class-export-csv.php';
146
- WCV_Export_CSV::output_csv( $this->product_id, $headers, $body, $items );
147
- }
148
-
149
-
150
- /**
151
- * Use views to display the Orders page
152
- *
153
- * @return html
154
- */
155
- public function display_product_orders()
156
- {
157
-
158
- if ( !WCV_Vendors::is_vendor( get_current_user_id() ) ) {
159
- ob_start();
160
- wc_get_template( 'denied.php', array(), 'wc-vendors/dashboard/', wcv_plugin_dir . 'templates/dashboard/' );
161
- return ob_get_clean();
162
- }
163
-
164
- if ( empty( $_GET[ 'orders_for_product' ] ) ) {
165
-
166
- return __( 'You haven\'t selected a product\'s orders to view! Please go back to the Vendor Dashboard and click Show Orders on the product you\'d like to view.', 'wcvendors' );
167
-
168
- } else {
169
- $this->product_id = !empty( $_GET[ 'orders_for_product' ] ) ? (int) $_GET[ 'orders_for_product' ] : false;
170
-
171
- $products = array( $this->product_id );
172
-
173
- $_product = wc_get_product( $this->product_id );
174
-
175
- if ( is_object( $_product ) ) {
176
-
177
- $children = $_product->get_children();
178
-
179
- if ( !empty( $children ) ) {
180
- $products = array_merge($products, $children);
181
- $products = array_unique($products);
182
- }
183
- }
184
-
185
- $this->orders = WCV_Queries::get_orders_for_products( $products, array( 'vendor_id' => get_current_user_id() ) );
186
- }
187
-
188
- if ( !$this->orders ) {
189
- return __( 'No orders.', 'wcvendors' );
190
- }
191
-
192
- if ( !empty( $_POST[ 'submit_comment' ] ) ) {
193
- require_once wcv_plugin_dir . 'classes/front/orders/class-submit-comment.php';
194
- WCV_Submit_Comment::new_comment( $this->orders );
195
- }
196
-
197
- if ( isset( $_POST[ 'mark_shipped' ] ) ) {
198
- $order_id = (int) $_POST[ 'order_id' ];
199
- $product_id = (int) $_POST[ 'product_id' ];
200
- exit;
201
- }
202
-
203
- $headers = WCV_Orders::get_headers();
204
- $all = WCV_Orders::format_order_details( $this->orders, $this->product_id );
205
-
206
- wp_enqueue_style( 'pv_frontend_style', wcv_assets_url . 'css/wcv-frontend.css' );
207
- wp_enqueue_script( 'pv_frontend_script', wcv_assets_url . 'js/front-orders.js' );
208
-
209
- $providers = array();
210
- $provider_array = array();
211
-
212
- // WC Shipment Tracking Providers
213
- if ( class_exists( 'WC_Shipment_Tracking' ) ) {
214
- $WC_Shipment_Tracking = new WC_Shipment_Tracking();
215
- $providers = (method_exists($WC_Shipment_Tracking, 'get_providers')) ? $WC_Shipment_Tracking->get_providers() : $WC_Shipment_Tracking->providers;
216
- $provider_array = array();
217
- foreach ( $providers as $all_providers ) {
218
- foreach ( $all_providers as $provider => $format ) {
219
- $provider_array[sanitize_title( $provider )] = urlencode( $format );
220
- }
221
- }
222
- }
223
-
224
- // Show the Export CSV button
225
- if ( $this->can_export_csv ) {
226
- wc_get_template( 'csv-export.php', array(), 'wc-vendors/orders/', wcv_plugin_dir . 'templates/orders/' );
227
- }
228
-
229
- wc_get_template( 'orders.php', array(
230
- 'headers' => $headers,
231
- 'body' => $all[ 'body' ],
232
- 'items' => $all[ 'items' ],
233
- 'product_id' => $all[ 'product_id' ],
234
- 'providers' => $providers,
235
- 'provider_array' => $provider_array,
236
- ), 'wc-vendors/orders/', wcv_plugin_dir . 'templates/orders/' );
237
-
238
- } // display_product_orders()
239
-
240
-
241
- /**
242
- * Headers for the Orders page
243
- *
244
- * @return array
245
- */
246
- public function get_headers()
247
- {
248
- $headers = array(
249
- 'order' => __( 'Order', 'wcvendors' ),
250
- 'product' => __( 'Product Title', 'wcvendors' ),
251
- 'name' => __( 'Full name', 'wcvendors' ),
252
- 'address' => __( 'Address', 'wcvendors' ),
253
- 'city' => __( 'City', 'wcvendors' ),
254
- 'state' => __( 'State', 'wcvendors' ),
255
- 'zip' => __( 'Zip', 'wcvendors' ),
256
- 'email' => __( 'Email address', 'wcvendors' ),
257
- 'date' => __( 'Date', 'wcvendors' ),
258
- );
259
-
260
- if ( !$this->can_view_emails ) {
261
- unset( $headers[ 'email' ] );
262
- }
263
-
264
- return $headers;
265
- }
266
-
267
-
268
- /**
269
- * Format the orders with just the products we want
270
- *
271
- * @param object $orders
272
- * @param int $product_id
273
- *
274
- * @return array
275
- */
276
- public function format_order_details( $orders, $product_id )
277
- {
278
- $body = $items = array();
279
- $product = wc_get_product( $product_id )->get_title();
280
-
281
- foreach ( $orders as $i => $order ) {
282
- $i = $order->order_id;
283
- $order = new WC_Order ( $i );
284
- $order_date = ( version_compare( WC_VERSION, '2.7', '<' ) ) ? $order->order_date : $order->get_date_created();
285
-
286
- $shipping_first_name = ( version_compare( WC_VERSION, '2.7', '<' ) ) ? $order->billing_first_name : $order->get_shipping_first_name();
287
- $shipping_last_name = ( version_compare( WC_VERSION, '2.7', '<' ) ) ? $order->billing_last_name : $order->get_shipping_last_name();
288
- $shipping_address_1 = ( version_compare( WC_VERSION, '2.7', '<' ) ) ? $order->shipping_address_1 : $order->get_shipping_address_1();
289
- $shipping_city = ( version_compare( WC_VERSION, '2.7', '<' ) ) ? $order->shipping_city : $order->get_shipping_city();
290
- $shipping_country = ( version_compare( WC_VERSION, '2.7', '<' ) ) ? $order->shipping_country : $order->get_shipping_country();
291
- $shipping_state = ( version_compare( WC_VERSION, '2.7', '<' ) ) ? $order->shipping_state : $order->get_shipping_state();
292
- $shipping_postcode = ( version_compare( WC_VERSION, '2.7', '<' ) ) ? $order->shipping_postcode : $order->get_shipping_postcode();
293
- $billing_email = ( version_compare( WC_VERSION, '2.7', '<' ) ) ? $order->billing_email : $order->get_billing_email();
294
- $customer_note = ( version_compare( WC_VERSION, '2.7', '<' ) ) ? $order->customer_note : $order->get_customer_note();
295
-
296
- $body[ $i ] = array(
297
- 'order_number' => $order->get_order_number(),
298
- 'product' => $product,
299
- 'name' => $shipping_first_name . ' ' . $shipping_last_name,
300
- 'address' => $shipping_address_1,
301
- 'city' => $shipping_city,
302
- 'state' => $shipping_state,
303
- 'zip' => $shipping_postcode,
304
- 'email' => $billing_email,
305
- 'date' => date_i18n( wc_date_format(), strtotime( $order_date ) ),
306
- 'comments' => wptexturize( $customer_note ),
307
- );
308
-
309
- if ( !$this->can_view_emails ) {
310
- unset( $body[ $i ][ 'email' ] );
311
- }
312
-
313
- $items[ $i ][ 'total_qty' ] = 0;
314
- foreach ( $order->get_items() as $line_id => $item ) {
315
-
316
- if ( $item[ 'product_id' ] != $product_id && $item[ 'variation_id' ] != $product_id ) continue;
317
-
318
- $items[ $i ][ 'items' ][ ] = $item;
319
- $items[ $i ][ 'total_qty' ] += $item[ 'qty' ];
320
- }
321
-
322
- }
323
-
324
- return array( 'body' => $body, 'items' => $items, 'product_id' => $product_id );
325
- }
326
-
327
-
328
- /**
329
- * Verify the current user can view orders for a product
330
- *
331
- * @param int $product_id
332
- */
333
- public function verify_order_access()
334
- {
335
- if ( !is_user_logged_in() || empty( $this->product_id ) ) {
336
- wp_safe_redirect( apply_filters( 'woocommerce_get_myaccount_page_id', get_permalink( woocommerce_get_page_id( 'myaccount' ) ) ) );
337
- exit;
338
- }
339
-
340
- $product = get_post( $this->product_id );
341
- if ( empty ( $product ) || $product->post_type != 'product' || get_current_user_id() != $product->post_author ) {
342
- wp_safe_redirect( apply_filters( 'woocommerce_get_myaccount_page_id', get_permalink( woocommerce_get_page_id( 'myaccount' ) ) ) );
343
- exit;
344
- }
345
- }
346
-
347
- /**
348
- * Get the variation data for a product
349
- *
350
- * @since 1.9.4
351
- * @return string variation_data
352
- */
353
- public static function get_variation_data( $item_id ){
354
-
355
- $_var_product = new WC_Product_Variation( $item_id );
356
- $variation_data = $_var_product->get_variation_attributes();
357
- $variation_detail = wc_get_formatted_variation( $variation_data, true );
358
- return $variation_detail;
359
-
360
- } // get_variation_data()
361
-
362
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/classes/front/orders/class-submit-comment.php DELETED
@@ -1,81 +0,0 @@
1
- <?php
2
-
3
- class WCV_Submit_Comment
4
- {
5
-
6
- /**
7
- * Submit a comment for an order
8
- *
9
- * @param object $orders
10
- *
11
- * @return unknown
12
- */
13
- public static function new_comment( $orders )
14
- {
15
- global $woocommerce;
16
-
17
- $user = wp_get_current_user();
18
- $user = $user->ID;
19
-
20
- // Security
21
- if ( !wp_verify_nonce( $_POST[ '_wpnonce' ], 'add-comment' ) ) return false;
22
-
23
- // Check if this product belongs to the vendor submitting the comment
24
- $product_id = (int) $_POST[ 'product_id' ];
25
- $author = WCV_Vendors::get_vendor_from_product( $product_id );
26
- if ( $author != $user ) return false;
27
-
28
- // Find the order belonging to this comment
29
- foreach ( $orders as $order ) {
30
- if ( $order->order_id == $_POST[ 'order_id' ] ) {
31
- $found_order = $order;
32
- break;
33
- }
34
- }
35
-
36
- // No order was found
37
- if ( empty( $found_order ) ) return false;
38
-
39
- // Don't submit empty comments
40
- if ( empty( $_POST[ 'comment_text' ] ) ) {
41
- wc_add_notice( __( 'You\'ve left the comment field empty!', 'wcvendors' ), 'error' );
42
-
43
- return false;
44
- }
45
-
46
- // Only submit if the order has the product belonging to this vendor
47
- $found_order = new WC_Order ( $found_order->order_id );
48
- $valid_order = false;
49
- foreach ( $found_order->get_items() as $item ) {
50
- if ( $item[ 'product_id' ] == $product_id ) {
51
- $valid_order = true;
52
- break;
53
- }
54
- }
55
-
56
- if ( $valid_order ) {
57
- $comment = esc_textarea( $_POST[ 'comment_text' ] );
58
-
59
- add_filter( 'woocommerce_new_order_note_data', array( __CLASS__, 'filter_comment' ), 10, 2 );
60
- $found_order->add_order_note( $comment, 1 );
61
- remove_filter( 'woocommerce_new_order_note_data', array( __CLASS__, 'filter_comment' ), 10, 2 );
62
-
63
- wc_add_notice( __( 'Success. The customer has been notified of your comment.', 'wcvendors' ), 'success' );
64
- }
65
-
66
- }
67
-
68
- public static function filter_comment( $commentdata, $order )
69
- {
70
- $user_id = get_current_user_id();
71
-
72
- $commentdata[ 'user_id' ] = $user_id;
73
- $commentdata[ 'comment_author' ] = WCV_Vendors::get_vendor_shop_name( $user_id );
74
- $commentdata[ 'comment_author_url' ] = WCV_Vendors::get_vendor_shop_page( $user_id );
75
- $commentdata[ 'comment_author_email' ] = wp_get_current_user()->user_email;
76
-
77
- return $commentdata;
78
- }
79
-
80
-
81
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/classes/front/signup/class-vendor-signup.php DELETED
@@ -1,174 +0,0 @@
1
- <?php
2
-
3
- /**
4
- * Signup form for applying as a vendor
5
- *
6
- * @author Matt Gates <http://mgates.me>
7
- * @package ProductVendor
8
- */
9
-
10
-
11
- class WCV_Vendor_Signup
12
- {
13
-
14
-
15
- /**
16
- * __construct()
17
- */
18
- function __construct()
19
- {
20
- if ( !WC_Vendors::$pv_options->get_option( 'show_vendor_registration' ) ) return;
21
-
22
- $this->terms_page = WC_Vendors::$pv_options->get_option( 'terms_to_apply_page' );
23
-
24
- add_action( 'woocommerce_register_form', array( $this, 'vendor_option' ) );
25
- // add_action( 'login_form', array( $this, 'login_apply_vendor_option' ) );
26
-
27
- if ( ! class_exists( 'WCVendors_Pro' ) ) {
28
- add_action( 'woocommerce_created_customer', array( $this, 'save_pending' ), 10, 2 );
29
- }
30
-
31
- add_action( 'template_redirect', array( $this, 'apply_form_dashboard' ), 10 );
32
- add_action( 'woocommerce_register_post', array( $this, 'validate_vendor_registration' ), 10, 3 );
33
-
34
- }
35
-
36
- /**
37
- *
38
- */
39
- public function vendor_option()
40
- {
41
- include_once('views/html-vendor-signup.php');
42
- }
43
-
44
-
45
- /**
46
- * Show apply to be vendor on the wp-login screen
47
- *
48
- * @since 1.9.0
49
- * @version 1.0.0
50
- */
51
- public function login_apply_vendor_option(){
52
-
53
-
54
-
55
- } // login_apply_vendor_option
56
-
57
- /**
58
- *
59
- *
60
- * @param unknown $user_id
61
- */
62
- public function save_pending( $user_id )
63
- {
64
-
65
- if ( isset( $_POST[ 'apply_for_vendor' ] ) ) {
66
-
67
- wc_clear_notices();
68
-
69
- if ( user_can( $user_id, 'manage_options' ) ) {
70
- wc_add_notice( apply_filters( 'wcvendors_application_denied_msg', __( 'Application denied. You are an administrator.', 'wcvendors' ) ), 'error' );
71
- } else {
72
- wc_add_notice( apply_filters( 'wcvendors_application_submitted_msg', __( 'Your application has been submitted.', 'wcvendors' ) ), 'notice' );
73
-
74
- $manual = WC_Vendors::$pv_options->get_option( 'manual_vendor_registration' );
75
- $role = apply_filters( 'wcvendors_pending_role', ( $manual ? 'pending_vendor' : 'vendor' ) );
76
-
77
- $wp_user_object = new WP_User( $user_id );
78
- $wp_user_object->set_role( $role );
79
-
80
- do_action( 'wcvendors_application_submited', $user_id );
81
-
82
- add_filter( 'woocommerce_registration_redirect', array( $this, 'redirect_to_vendor_dash' ) );
83
- }
84
- }
85
- }
86
-
87
-
88
- /**
89
- * Save the pending vendor from the login screen
90
- *
91
- * @since 1.9.0
92
- * @version 1.0.0
93
- */
94
- public function login_save_pending( $user_id ){
95
-
96
- if ( isset( $_POST[ 'apply_for_vendor' ] ) ) {
97
-
98
- $manual = WC_Vendors::$pv_options->get_option( 'manual_vendor_registration' );
99
- $role = apply_filters( 'wcvendors_pending_role', ( $manual ? 'pending_vendor' : 'vendor' ) );
100
-
101
- $wp_user_object = new WP_User( $user_id );
102
- $wp_user_object->set_role( $role );
103
-
104
- do_action( 'wcvendors_application_submited', $user_id );
105
-
106
- }
107
-
108
- } // login_save_pending()
109
-
110
- /**
111
- * Login authentication check code for vendors
112
- */
113
- public function login_vendor_check( $user, $password ){
114
-
115
- if ( isset( $_POST[ 'apply_for_vendor' ] ) ) {
116
-
117
- if ( $this->terms_page && ! isset( $_POST[ 'agree_to_terms' ] ) ) {
118
- $error = new WP_Error();
119
- $error->add( 'no_terms', apply_filters( 'wcvendors_agree_to_terms_error', __( 'You must accept the terms and conditions to become a vendor.', 'wcvendors' ) ) );
120
- return $error;
121
- } else {
122
- return $user;
123
- }
124
- }
125
-
126
- return $user;
127
-
128
- }
129
-
130
-
131
- public function redirect_to_vendor_dash( $redirect )
132
- {
133
- $vendor_dashboard_page = WC_Vendors::$pv_options->get_option( 'vendor_dashboard_page' );
134
-
135
- return apply_filters( 'wcvendors_signup_redirect', get_permalink( $vendor_dashboard_page ) );
136
- }
137
-
138
-
139
- /**
140
- *
141
- *
142
- * @return unknown
143
- */
144
- public function apply_form_dashboard()
145
- {
146
- if ( !isset( $_POST[ 'apply_for_vendor' ] ) ) return false;
147
-
148
- $vendor_dashboard_page = WC_Vendors::$pv_options->get_option( 'vendor_dashboard_page' );
149
- $page_id = get_queried_object_id();
150
-
151
- if ( $page_id == $vendor_dashboard_page ) {
152
- if ( $this->terms_page ) {
153
- if ( isset( $_POST[ 'agree_to_terms' ] ) ) {
154
- self::save_pending( get_current_user_id() );
155
- } else {
156
- wc_add_notice( apply_filters( 'wcvendors_agree_to_terms_error', __( 'You must accept the terms and conditions to become a vendor.', 'wcvendors' ), 'error' ) );
157
- }
158
- } else {
159
- self::save_pending( get_current_user_id() );
160
- }
161
- }
162
- }
163
-
164
- public function validate_vendor_registration( $username, $email, $validation_errors ) {
165
-
166
- if ( isset( $_POST[ 'apply_for_vendor' ] ) ) {
167
- if ( $this->terms_page && !isset( $_POST[ 'agree_to_terms' ] ) ) {
168
- $validation_errors->add( 'agree_to_terms_error', apply_filters( 'wcvendors_agree_to_terms_error', __( 'You must accept the terms and conditions to become a vendor.', 'wcvendors' ) ) );
169
- }
170
- }
171
- }
172
-
173
-
174
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/classes/front/signup/views/html-vendor-signup.php DELETED
@@ -1,68 +0,0 @@
1
- <?php
2
-
3
- /**
4
- * Vendor Signup
5
- *
6
- * This file is used to output the vendor signup options on the wordpress login form.
7
- *
8
- * @link http://www.wcvendors.com
9
- * @since 1.9.0
10
- *
11
- * @package WCVendors
12
- * @subpackage WCVendors/classes/front/signup/views
13
- */
14
- ?>
15
-
16
- <?php do_action( 'wcvendors_login_apply_for_vendor_before' ); ?>
17
-
18
- <p class="forgetmenot">
19
- <label for="apply_for_vendor">
20
- <input class="input-checkbox" id="apply_for_vendor" <?php checked( isset( $_POST[ 'apply_for_vendor' ] ), true ) ?> type="checkbox" name="apply_for_vendor" value="1"/>
21
- <?php echo apply_filters('wcvendors_vendor_registration_checkbox', __( 'Apply to become a vendor? ', 'wcvendors' )); ?>
22
- </label>
23
-
24
- </p>
25
-
26
- <?php do_action( 'wcvendors_login_apply_for_vendor_after' ); ?>
27
-
28
- <?php if ( $this->terms_page ) : ?>
29
-
30
- <?php do_action( 'wcvendors_login_agree_to_terms_before' ); ?>
31
-
32
- <p class="forgetmenot agree-to-terms-container" style="display:none;">
33
- <label for="agree_to_terms">
34
- <input class="input-checkbox" id="agree_to_terms" <?php checked( isset( $_POST[ 'agree_to_terms' ] ), true ); ?> type="checkbox" name="agree_to_terms" value="1"/>
35
- <?php apply_filters( 'wcvendors_vendor_registration_terms', printf( __( 'I have read and accepted the <a target="top" href="%s">terms and conditions</a>', 'wcvendors' ), get_permalink( $this->terms_page ) ) ); ?>
36
- </label>
37
- </p>
38
-
39
- <?php do_action( 'wcvendors_login_agree_to_terms_after' ); ?>
40
-
41
-
42
- <script type="text/javascript">
43
-
44
- var error_message = "<?php _e( 'Please agree to the terms and conditions', 'wcvendors'); ?>";
45
-
46
- jQuery( function( $ ){
47
-
48
- $( "#apply_for_vendor" ).change( function() {
49
- if ( this.checked ) {
50
- $('.agree-to-terms-container').show();
51
- } else {
52
- $('.agree-to-terms-container').hide();
53
- }
54
- });
55
-
56
- $( 'form.register').on( 'submit', function ( e ){
57
- if ( $('#agree_to_terms').is(':visible') && ! $('#agree_to_terms').is(':checked') ) {
58
- alert( error_message );
59
- e.preventDefault();
60
- }
61
- } );
62
-
63
- });
64
- </script>
65
-
66
- <?php endif; ?>
67
-
68
- <div class="clear"></div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/classes/gateways/PayPal_AdvPayments/PayPal_AP/assets/icons/index.php DELETED
File without changes
trunk/classes/gateways/PayPal_AdvPayments/PayPal_AP/assets/icons/paypalap.png DELETED
Binary file
trunk/classes/gateways/PayPal_AdvPayments/PayPal_AP/assets/index.php DELETED
File without changes
trunk/classes/gateways/PayPal_AdvPayments/PayPal_AP/classes/adaptivepayments-sdk/ChangeLog.txt DELETED
@@ -1,33 +0,0 @@
1
-
2
- Version 1.2.95 - September 28, 2012
3
-
4
- - Sender details (eg:email,phno) serialization bug fixed(https://github.com/paypal/SDKs/issues/30)
5
- - Bug fixed for 'PPLoggingManager.php' to pickup configuration entries.(https://github.com/paypal/SDKs/issues/28)
6
- - Updated SDK sample
7
-
8
- --------------------------------------------------------------------------------------------------
9
-
10
-
11
- Version 1.1.93 - August 13, 2012
12
-
13
- - SDK refreshed to Release 1.8.1. Please refer https://www.x.com/developers/paypal/documentation-tools/release-notes#AdaptivePaymentsAPI
14
- - SDK Core - Deserialization Logic Change
15
- --------------------------------------------------------------------------------------------------
16
-
17
-
18
- Version 1.0.92 - July 30, 2012
19
-
20
- - Stable release
21
- -------------------------------------------------------------------------------------------------
22
- Version 0.7.92 - July 17, 2012
23
- - wsdl update version 0.7.92
24
- ------------------------------------------
25
-
26
- Version 0.6.88 - Apr 17, 2012
27
- ----------------------------------------
28
- - Fix to get SDK working with Permissions API token
29
- - wsdl update version 88.0
30
-
31
- Version 0.6.86 - Feb 27, 2012
32
- ----------------------------------------
33
- - Initial release
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/classes/gateways/PayPal_AdvPayments/PayPal_AP/classes/adaptivepayments-sdk/LICENSE.txt DELETED
@@ -1,41 +0,0 @@
1
- PAYPAL, INC.
2
-
3
- SDK LICENSE
4
-
5
- NOTICE TO USER: PayPal, Inc. is providing the Software and Documentation for use under the terms of this Agreement. Any use, reproduction, modification or distribution of the Software or Documentation, or any derivatives or portions hereof, constitutes your acceptance of this Agreement.
6
-
7
- As used in this Agreement, "PayPal" means PayPal, Inc. "Software" means the software code accompanying this agreement. "Documentation" means the documents, specifications and all other items accompanying this Agreement other than the Software.
8
-
9
- 1. LICENSE GRANT Subject to the terms of this Agreement, PayPal hereby grants you a non-exclusive, worldwide, royalty free license to use, reproduce, prepare derivative works from, publicly display, publicly perform, distribute and sublicense the Software for any purpose, provided the copyright notice below appears in a conspicuous location within the source code of the distributed Software and this license is distributed in the supporting documentation of the Software you distribute. Furthermore, you must comply with all third party licenses in order to use the third party software contained in the Software.
10
-
11
- Subject to the terms of this Agreement, PayPal hereby grants you a non-exclusive, worldwide, royalty free license to use, reproduce, publicly display, publicly perform, distribute and sublicense the Documentation for any purpose. You may not modify the Documentation.
12
-
13
- No title to the intellectual property in the Software or Documentation is transferred to you under the terms of this Agreement. You do not acquire any rights to the Software or the Documentation except as expressly set forth in this Agreement.
14
-
15
- If you choose to distribute the Software in a commercial product, you do so with the understanding that you agree to defend, indemnify and hold harmless PayPal and its suppliers against any losses, damages and costs arising from the claims, lawsuits or other legal actions arising out of such distribution. You may distribute the Software in object code form under your own license, provided that your license agreement:
16
-
17
- (a) complies with the terms and conditions of this license agreement;
18
-
19
- (b) effectively disclaims all warranties and conditions, express or implied, on behalf of PayPal;
20
-
21
- (c) effectively excludes all liability for damages on behalf of PayPal;
22
-
23
- (d) states that any provisions that differ from this Agreement are offered by you alone and not PayPal; and
24
-
25
- (e) states that the Software is available from you or PayPal and informs licensees how to obtain it in a reasonable manner on or through a medium customarily used for software exchange.
26
-
27
- 2. DISCLAIMER OF WARRANTY
28
- PAYPAL LICENSES THE SOFTWARE AND DOCUMENTATION TO YOU ONLY ON AN "AS IS" BASIS WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. PAYPAL MAKES NO WARRANTY THAT THE SOFTWARE OR DOCUMENTATION WILL BE ERROR-FREE. Each user of the Software or Documentation is solely responsible for determining the appropriateness of using and distributing the Software and Documentation and assumes all risks associated with its exercise of rights under this Agreement, including but not limited to the risks and costs of program errors, compliance with applicable laws, damage to or loss of data, programs, or equipment, and unavailability or interruption of operations. Use of the Software and Documentation is made with the understanding that PayPal will not provide you with any technical or customer support or maintenance. Some states or jurisdictions do not allow the exclusion of implied warranties or limitations on how long an implied warranty may last, so the above limitations may not apply to you. To the extent permissible, any implied warranties are limited to ninety (90) days.
29
-
30
-
31
- 3. LIMITATION OF LIABILITY
32
- PAYPAL AND ITS SUPPLIERS SHALL NOT BE LIABLE FOR LOSS OR DAMAGE ARISING OUT OF THIS AGREEMENT OR FROM THE USE OF THE SOFTWARE OR DOCUMENTATION. IN NO EVENT WILL PAYPAL OR ITS SUPPLIERS BE LIABLE TO YOU OR ANY THIRD PARTY FOR ANY DIRECT, INDIRECT, CONSEQUENTIAL, INCIDENTAL, OR SPECIAL DAMAGES INCLUDING LOST PROFITS, LOST SAVINGS, COSTS, FEES, OR EXPENSES OF ANY KIND ARISING OUT OF ANY PROVISION OF THIS AGREEMENT OR THE USE OR THE INABILITY TO USE THE SOFTWARE OR DOCUMENTATION, HOWEVER CAUSED AND UNDER ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY OR TORT INCLUDING NEGLIGENCE OR OTHERWISE), EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. PAYPAL'S AGGREGATE LIABILITY AND THAT OF ITS SUPPLIERS UNDER OR IN CONNECTION WITH THIS AGREEMENT SHALL BE LIMITED TO THE AMOUNT PAID BY YOU FOR THE SOFTWARE AND DOCUMENTATION.
33
-
34
- 4. TRADEMARK USAGE
35
- PayPal is a trademark PayPal, Inc. in the United States and other countries. Such trademarks may not be used to endorse or promote any product unless expressly permitted under separate agreement with PayPal.
36
-
37
- 5. TERM
38
- Your rights under this Agreement shall terminate if you fail to comply with any of the material terms or conditions of this Agreement and do not cure such failure in a reasonable period of time after becoming aware of such noncompliance. If all your rights under this Agreement terminate, you agree to cease use and distribution of the Software and Documentation as soon as reasonably practicable.
39
-
40
- 6. GOVERNING LAW AND JURISDICTION. This Agreement is governed by the statutes and laws of the State of California, without regard to the conflicts of law principles thereof. If any part of this Agreement is found void and unenforceable, it will not affect the validity of the balance of the Agreement, which shall remain valid and enforceable according to its terms. Any dispute arising out of or related to this Agreement shall be brought in the courts of Santa Clara County, California, USA.
41
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/classes/gateways/PayPal_AdvPayments/PayPal_AP/classes/adaptivepayments-sdk/README.md DELETED
@@ -1,57 +0,0 @@
1
-
2
- PayPal PHP Adaptive Payments SDK
3
- ===============================
4
-
5
- Prerequisites
6
- -------------
7
-
8
- PayPal's PHP Adaptive Payments SDK requires
9
-
10
- * PHP 5.2 and above with curl extension enabled
11
-
12
-
13
- Using the SDK
14
- -------------
15
-
16
- To use the SDK,
17
-
18
- * Copy the config and lib folders into your project.
19
- * Make sure that the lib folder in your project is available in PHP's include path
20
- * Include the services\AdaptivePayments\AdaptivePaymentsService.php file in your code.
21
- * Create a service wrapper object
22
- * Create a request object as per your project's needs. All the API request and response classes are available in services\AdaptivePayments\AdaptivePaymentsService.php
23
- * Invoke the appropriate method on the request object.
24
-
25
- For example,
26
-
27
- require_once('services/AdaptivePayments/AdaptivePaymentsService.php');
28
- require_once('PPLoggingManager.php');
29
-
30
- $payRequest = new PayRequest($requestEnvelope, $_POST['actionType'], $_POST['cancelUrl'], $_POST['currencyCode'], $receiverList, $_POST['returnUrl']);
31
- // Add optional params
32
- if($_POST["feesPayer"] != "") {
33
- $payRequest->feesPayer = $_POST["feesPayer"];
34
- }
35
- ......
36
-
37
- $service = new AdaptivePaymentsService();
38
- $response = $service->Pay($payRequest);
39
-
40
- $ack = strtoupper($response->responseEnvelope->ack);
41
-
42
- if($ack == 'SUCCESS') {
43
- // Success
44
- }
45
-
46
-
47
-
48
- SDK Configuration
49
- -----------------
50
-
51
- replace the API credential in config/sdk_config.ini . You can use the configuration file to configure
52
-
53
- * (Multiple) API account credentials.
54
- * Service endpoint and other HTTP connection parameters
55
-
56
-
57
- Please refer to the sample config file provided with this bundle.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/classes/gateways/PayPal_AdvPayments/PayPal_AP/classes/adaptivepayments-sdk/build.xml DELETED
@@ -1,24 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <project name="PayPal_PHP_SDK" default="build">
3
-
4
-
5
- <condition property="PHPUNIT_PATH" value="phpunit.bat" else="phpunit">
6
- <os family="windows"/>
7
- </condition>
8
-
9
- <target name="clean">
10
- <delete dir="${basedir}/build"/>
11
- </target>
12
-
13
-
14
- <target name="phpunit">
15
- <mkdir dir="tests/reports/"/>
16
- <exec dir="${basedir}" executable="${PHPUNIT_PATH}" failonerror="true">
17
- <arg
18
- line="--testdox --include-path lib --log-junit tests\reports\phpunit.xml tests"/>
19
- </exec>
20
- </target>
21
-
22
-
23
- <target name="build" depends="clean, phpunit"/>
24
- </project>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/classes/gateways/PayPal_AdvPayments/PayPal_AP/classes/adaptivepayments-sdk/config/cert_key.pem DELETED
@@ -1,31 +0,0 @@
1
- -----BEGIN RSA PRIVATE KEY-----
2
- MIICXgIBAAKBgQCaGw566OIaeIsrp2tyzfwUtwapk2aPgL9N8oOoPmTmA/bqhqF8
3
- 2X43EB2zZF1HY35kPp3L5rZSjqraEZz5j7W4DkXMS286wLnaoh02sVWbbXlLcZ/v
4
- sAQzNgi1s2raOWonkcbAIAyhjVoGQjpuCn7y9YNgQfpZkgrh/R5ig8obQwIDAQAB
5
- AoGBAI/YrZ2BAHzhBFdNQXi6WZEkfu2PD27oKKojs006YIhsLvEflmGpyqyvOGoZ
6
- RxC6CGKeKEEKLCnHzicbxcEVqfKfOxrXkym3ldqBaYubL1OU62biDRtZZdIpG3TE
7
- gBDRtU8gPQv1ykqY9KqdeORy8vu0lW9Zx9/4ccW126HLt/kxAkEAzF9NKltIc+gu
8
- S79lzerE8qngiUSc/ccb1ssLj4v4Lf90HNeJ4oSQEikuN32GjPVrUpQYpC4fjcET
9
- KmqE7k1V3wJBAMEJB3VRToeTQKhWet8JQPkcfES3B+l7NCauUcysSI5XZ9kVflLu
10
- c5vzznMooRpcNtjJwDmkcnW0lhIQH/DKvx0CQQCWHJXoO54vDGYc2xuisQMyHha/
11
- nHcXbA0FqqP2Lt/+oTifCq3LhITx4e+BcKDInmbTA9ZJmVsx2pQCPrUe+AzPAkA/
12
- OU7ZDPVUkFU4DYMW8/f033CQLQaJYVH2bVfbWn41KMmZn2GNlg4FgTgYHbGOaa+J
13
- F6M+/e6DQM96QQ/FFRK9AkEApx1r0di+W2ibrTANnk6QjQbva9JyOztI+Avg86X5
14
- swB44tEsRImOTNsE6nfE/215AxjgI1vdn6uU4P8GIKfxnw==
15
- -----END RSA PRIVATE KEY-----
16
- -----BEGIN CERTIFICATE-----
17
- MIICiDCCAfGgAwIBAgIDD/WUMA0GCSqGSIb3DQEBBQUAMIGfMQswCQYDVQQGEwJV
18
- UzETMBEGA1UECBMKQ2FsaWZvcm5pYTERMA8GA1UEBxMIU2FuIEpvc2UxFTATBgNV
19
- BAoTDFBheVBhbCwgSW5jLjEWMBQGA1UECxQNc2FuZGJveF9jZXJ0czEbMBkGA1UE
20
- AxQSc2FuZGJveF9jYW1lcmNoYXBpMRwwGgYJKoZIhvcNAQkBFg1yZUBwYXlwYWwu
21
- Y29tMB4XDTExMDUwMjA1MDQ0NFoXDTIxMDQyOTA1MDQ0NFowYzElMCMGA1UEAxQc
22
- Y2VydHVzZXJfYml6X2FwaTEucGF5cGFsLmNvbTEPMA0GA1UEChMGQm9uem9wMQ8w
23
- DQYDVQQHEwZBdXN0aW4xCzAJBgNVBAgTAlRYMQswCQYDVQQGEwJVUzCBnzANBgkq
24
- hkiG9w0BAQEFAAOBjQAwgYkCgYEAmhsOeujiGniLK6drcs38FLcGqZNmj4C/TfKD
25
- qD5k5gP26oahfNl+NxAds2RdR2N+ZD6dy+a2Uo6q2hGc+Y+1uA5FzEtvOsC52qId
26
- NrFVm215S3Gf77AEMzYItbNq2jlqJ5HGwCAMoY1aBkI6bgp+8vWDYEH6WZIK4f0e
27
- YoPKG0MCAwEAAaMNMAswCQYDVR0TBAIwADANBgkqhkiG9w0BAQUFAAOBgQBj6xWw
28
- AumLzSodCWyocPcyKSooNa7wgJKzaVrf0Kxz2QBesKpsfe9UN3Dj04016FIUbkRI
29
- 4qLJIkKHyeQRU9hvJ78tU7OeykDEVqlHAEE/Z4c5EIs6l9x60VqOpAjnaqX/9Jty
30
- jXhqpINjolTh6D5jq8y4FX5krKqIYBCNDHM+cQ==
31
- -----END CERTIFICATE-----
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/classes/gateways/PayPal_AdvPayments/PayPal_AP/classes/adaptivepayments-sdk/config/sdk_config.ini DELETED
@@ -1,26 +0,0 @@
1
- ;Account credentials
2
- [Account]
3
- acct1.UserName = jb-us-seller_api1.paypal.com
4
- acct1.Password = WX4WTU3S8MY44S7F
5
- acct1.Signature = AFcWxV21C7fd0v3bYYYRCpSSRl31A7yDhhsPUU2XhtMoZXsWHFxu-RWy
6
- acct1.AppId = APP-80W284485P519543T
7
-
8
- ;Connection Information
9
- [Http]
10
- http.ConnectionTimeOut = 30
11
- http.Retry = 5
12
- ;http.Proxy
13
-
14
- ;Service Configuration
15
- [Service]
16
- ; NOTE: Do not change the service binding configuration.
17
- service.Binding = NV
18
- service.EndPoint = "https://svcs.sandbox.paypal.com/"
19
- service.RedirectURL = "https://www.sandbox.paypal.com/webscr&cmd="
20
- service.DevCentralURL = "https://developer.paypal.com"
21
-
22
- ;Logging Information
23
- [Log]
24
- log.FileName = PayPal.log
25
- log.LogLevel = INFO
26
- log.LogEnabled = true
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/classes/gateways/PayPal_AdvPayments/PayPal_AP/classes/adaptivepayments-sdk/lib/IPPCredential.php DELETED
@@ -1,53 +0,0 @@
1
- <?php
2
-
3
- /**
4
- * Base class that represents API credentials
5
- */
6
- abstract class IPPCredential
7
- {
8
- /**
9
- * Application Id that uniquely identifies the application
10
- * The application Id is issued by PayPal.
11
- * Test application Ids are available for the sandbox environment
12
- * @var string
13
- */
14
- protected $applicationId;
15
-
16
- /**
17
- * API username
18
- * @var string
19
- */
20
- protected $userName;
21
-
22
- /**
23
- * API password
24
- * @var string
25
- */
26
- protected $password;
27
-
28
- protected abstract function validate();
29
-
30
- public function __construct( $userName, $password, $applicationId )
31
- {
32
- $this->userName = $userName;
33
- $this->password = $password;
34
- $this->applicationId = $applicationId;
35
- }
36
-
37
- public function getApplicationId()
38
- {
39
- return $this->applicationId;
40
- }
41
-
42
- public function getUserName()
43
- {
44
- return $this->userName;
45
- }
46
-
47
- public function getPassword()
48
- {
49
- return $this->password;
50
- }
51
- }
52
-
53
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/classes/gateways/PayPal_AdvPayments/PayPal_AP/classes/adaptivepayments-sdk/lib/PPAPIService.php DELETED
@@ -1,62 +0,0 @@
1
- <?php
2
- require_once 'PPCredentialManager.php';
3
- require_once 'PPConnectionManager.php';
4
- require_once 'PPObjectTransformer.php';
5
- require_once 'PPLoggingManager.php';
6
- require_once 'PPUtils.php';
7
- require_once 'PPAuthenticationManager.php';
8
-
9
- class PPAPIService
10
- {
11
- public $endpoint;
12
- public $serviceName;
13
- private $logger;
14
-
15
- public function __construct( $serviceName = "" )
16
- {
17
- $this->serviceName = $serviceName;
18
- $config = PPConfigManager::getInstance();
19
- $this->endpoint = $config->get( 'service.EndPoint' );
20
- $this->logger = new PPLoggingManager( __CLASS__ );
21
- }
22
-
23
- public function setServiceName( $serviceName )
24
- {
25
- $this->serviceName = $serviceName;
26
- }
27
-
28
-
29
- public function makeRequest( $apiMethod, $params, $apiUsername = null, $accessToken = null, $tokenSecret = null )
30
- {
31
-
32
- $authentication = new PPAuthenticationManager();
33
- $connectionMgr = PPConnectionManager::getInstance();
34
- $connection = $connectionMgr->getConnection();
35
-
36
- $credMgr = PPCredentialManager::getInstance();
37
- // $apiUsernam is optional, if null the default account in congif file is taken
38
- $apIPPCredential = $credMgr->getCredentialObject( $apiUsername );
39
- $config = PPConfigManager::getInstance();
40
- if ( $config->get( 'service.Binding' ) == 'SOAP' ) {
41
- $url = $this->endpoint;
42
- if ( isset( $accessToken ) && isset( $tokenSecret ) ) {
43
- $headers = $authentication->getPayPalHeaders( $apIPPCredential, $connection, $accessToken, $tokenSecret, $url );
44
- } else {
45
- $headers = null;
46
- }
47
- $params = $authentication->appendSoapHeader( $params, $apIPPCredential, $connection, $accessToken, $tokenSecret, $url );
48
- } else {
49
- $url = $this->endpoint . $this->serviceName . '/' . $apiMethod;
50
- $headers = $authentication->getPayPalHeaders( $apIPPCredential, $connection, $accessToken, $tokenSecret, $url );
51
- }
52
-
53
-
54
- $this->logger->info( "Request: $params" );
55
- $response = $connection->execute( $url, $params, $headers );
56
- $this->logger->info( "Response: $response" );
57
-
58
- return $response;
59
- }
60
-
61
-
62
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/classes/gateways/PayPal_AdvPayments/PayPal_AP/classes/adaptivepayments-sdk/lib/PPAuthenticationManager.php DELETED
@@ -1,91 +0,0 @@
1
- <?php
2
- require_once 'IPPCredential.php';
3
- require_once 'PPConfigManager.php';
4
- require_once 'PPSignatureCredential.php';
5
- require_once 'PPCertificateCredential.php';
6
- require_once 'exceptions/PPInvalidCredentialException.php';
7
- require_once 'auth/PPAuth.php';
8
-
9
- class PPAuthenticationManager
10
- {
11
- public function getPayPalHeaders( $apiCred, $connection, $accessToken = null, $tokenSecret = null, $url = null )
12
- {
13
- $config = PPConfigManager::getInstance();
14
-
15
- if ( isset( $accessToken ) && isset( $tokenSecret ) ) {
16
- $headers_arr[ ] = "X-PAYPAL-AUTHORIZATION: " . $this->generateAuthString( $apiCred, $accessToken, $tokenSecret, $url );
17
- //$headers_arr[] = "CLIENT-AUTH: No cert";
18
- } // Add headers required for service authentication
19
- else if ( $apiCred instanceof PPSignatureCredential ) {
20
- $headers_arr[ ] = "X-PAYPAL-SECURITY-USERID: " . $apiCred->getUserName();
21
- $headers_arr[ ] = "X-PAYPAL-SECURITY-PASSWORD: " . $apiCred->getPassword();
22
- $headers_arr[ ] = "X-PAYPAL-SECURITY-SIGNATURE: " . $apiCred->getSignature();
23
- } else if ( $apiCred instanceof PPCertificateCredential ) {
24
-
25
- $headers_arr[ ] = "X-PAYPAL-SECURITY-USERID: " . $apiCred->getUserName();
26
- $headers_arr[ ] = "X-PAYPAL-SECURITY-PASSWORD: " . $apiCred->getPassword();
27
- $connection->setSSLCert( $apiCred->getCertificatePath(), $apiCred->getPassPhrase() );
28
- }
29
-
30
- // Add other headers
31
- $headers_arr[ ] = "X-PAYPAL-APPLICATION-ID: " . $apiCred->getApplicationId();
32
- $headers_arr[ ] = "X-PAYPAL-REQUEST-DATA-FORMAT: " . $config->get( 'service.Binding' );
33
- $headers_arr[ ] = "X-PAYPAL-RESPONSE-DATA-FORMAT: " . $config->get( 'service.Binding' );
34
- $headers_arr[ ] = "X-PAYPAL-DEVICE-IPADDRESS: " . PPUtils::getLocalIPAddress();
35
- $headers_arr[ ] = "X-PAYPAL-REQUEST-SOURCE: " . PPUtils::getRequestSource();
36
-
37
- return $headers_arr;
38
- }
39
-
40
- public function appendSoapHeader( $payLoad, $apiCred, $connection, $accessToken = null, $tokenSecret = null, $url = null )
41
- {
42
- $soapHeader = "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:urn=\"urn:ebay:api:PayPalAPI\" xmlns:ebl=\"urn:ebay:apis:eBLBaseComponents\" xmlns:cc=\"urn:ebay:apis:CoreComponentTypes\" xmlns:ed=\"urn:ebay:apis:EnhancedDataTypes\">";
43
-
44
- if ( isset( $accessToken ) && isset( $tokenSecret ) ) {
45
- $soapHeader .= "<soapenv:Header>";
46
- $soapHeader .= "<urn:RequesterCredentials/>";
47
- $soapHeader .= "</soapenv:Header>";
48
- } else if ( $apiCred instanceof PPSignatureCredential ) {
49
- $soapHeader .= "<soapenv:Header>";
50
- $soapHeader .= "<urn:RequesterCredentials>";
51
- $soapHeader .= "<ebl:Credentials>";
52
- $soapHeader .= "<ebl:Username>" . $apiCred->getUserName() . "</ebl:Username>";
53
- $soapHeader .= "<ebl:Password>" . $apiCred->getPassword() . "</ebl:Password>";
54
- $soapHeader .= "<ebl:Signature>" . $apiCred->getSignature() . "</ebl:Signature>";
55
- $soapHeader .= "</ebl:Credentials>";
56
- $soapHeader .= "</urn:RequesterCredentials>";
57
- $soapHeader .= "</soapenv:Header>";
58
- } else if ( $apiCred instanceof PPCertificateCredential ) {
59
- $soapHeader .= "<soapenv:Header>";
60
- $soapHeader .= "<urn:RequesterCredentials>";
61
- $soapHeader .= "<ebl:Credentials>";
62
- $soapHeader .= "<ebl:Username>" . $apiCred->getUserName() . "</ebl:Username>";
63
- $soapHeader .= "<ebl:Password>" . $apiCred->getPassword() . "</ebl:Password>";
64
- $soapHeader .= "</ebl:Credentials>";
65
- $soapHeader .= "</urn:RequesterCredentials>";
66
- $soapHeader .= "</soapenv:Header>";
67
- $connection->setSSLCert( $apiCred->getCertificatePath(), $apiCred->getPassPhrase() );
68
- }
69
- $soapHeader .= "<soapenv:Body>";
70
- $soapHeader .= $payLoad;
71
- $soapHeader .= "</soapenv:Body>";
72
- $soapHeader .= "</soapenv:Envelope>";
73
-
74
- return $soapHeader;
75
-
76
- }
77
-
78
- private function generateAuthString( $apiCred, $accessToken, $tokenSecret, $endpoint )
79
- {
80
- $key = $apiCred->getUserName();
81
- $secret = $apiCred->getPassword();
82
- $auth = new AuthSignature();
83
- $response = $auth->genSign( $key, $secret, $accessToken, $tokenSecret, 'POST', $endpoint );
84
- $authString = "token=" . $accessToken . ",signature=" . $response[ 'oauth_signature' ] . ",timestamp=" . $response[ 'oauth_timestamp' ];
85
-
86
- return $authString;
87
- }
88
-
89
- }
90
-
91
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/classes/gateways/PayPal_AdvPayments/PayPal_AP/classes/adaptivepayments-sdk/lib/PPBaseService.php DELETED
@@ -1,88 +0,0 @@
1
- <?php
2
- require_once 'PPAPIService.php';
3
-
4
-
5
- class PPBaseService
6
- {
7
-
8
- private $serviceName;
9
-
10
- /*
11
- * Setters and getters for Third party authentication (Permission Services)
12
- */
13
- protected $accessToken;
14
- protected $tokenSecret;
15
- protected $lastRequest;
16
- protected $lastResponse;
17
-
18
- public function getLastRequest()
19
- {
20
- return $this->lastRequest;
21
- }
22
-
23
- public function setLastRequest( $lastRqst )
24
- {
25
- $this->lastRequest = $lastRqst;
26
- }
27
-
28
- public function getLastResponse()
29
- {
30
- return $this->lastResponse;
31
- }
32
-
33
- public function setLastResponse( $lastRspns )
34
- {
35
- $this->lastResponse = $lastRspns;
36
- }
37
-
38
- public function getAccessToken()
39
- {
40
- return $this->accessToken;
41
- }
42
-
43
- public function setAccessToken( $accessToken )
44
- {
45
- $this->accessToken = $accessToken;
46
- }
47
-
48
- public function getTokenSecret()
49
- {
50
- return $this->tokenSecret;
51
- }
52
-
53
- public function setTokenSecret( $tokenSecret )
54
- {
55
- $this->tokenSecret = $tokenSecret;
56
- }
57
-
58
- public function __construct( $serviceName )
59
- {
60
- $this->serviceName = $serviceName;
61
- }
62
-
63
- public function getServiceName()
64
- {
65
- return $this->serviceName;
66
- }
67
-
68
- public function call( $method, $requestObject, $apiUsername = null )
69
- {
70
- $params = $this->marshall( $requestObject );
71
- $service = new PPAPIService();
72
- $service->setServiceName( $this->serviceName );
73
-
74
- $this->lastRequest = $params;
75
- $this->lastResponse = $service->makeRequest( $method, $params, $apiUsername, $this->accessToken, $this->tokenSecret );
76
-
77
- return $this->lastResponse;
78
- }
79
-
80
- private function marshall( $object )
81
- {
82
- $transformer = new PPObjectTransformer();
83
-
84
- return $transformer->toString( $object );
85
- }
86
- }
87
-
88
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/classes/gateways/PayPal_AdvPayments/PayPal_AP/classes/adaptivepayments-sdk/lib/PPCertificateCredential.php DELETED
@@ -1,72 +0,0 @@
1
- <?php
2
- require_once 'IPPCredential.php';
3
- require_once 'PPConfigManager.php';
4
- require_once 'exceptions/PPMissingCredentialException.php';
5
-
6
- class PPCertificateCredential extends IPPCredential
7
- {
8
-
9
- private $certificatePath;
10
-
11
- private $passPhrase;
12
-
13
- public function __construct( $userName, $password, $certPath, $appId, $passPhrase )
14
- {
15
- parent::__construct( $userName, $password, $appId );
16
- $this->certificatePath = $certPath;
17
- $this->passPhrase = $passPhrase;
18
- $this->validate();
19
- }
20
-
21
- public function validate()
22
- {
23
-
24
- if ( $this->userName == null || $this->userName == "" ) {
25
- throw new PPMissingCredentialException( "username cannot be empty" );
26
- }
27
- if ( $this->password == null || $this->password == "" ) {
28
- throw new PPMissingCredentialException( "password cannot be empty" );
29
- }
30
- if ( $this->certificatePath == null || $this->certificatePath == "" ) {
31
- throw new PPMissingCredentialException( "certificate cannot be empty" );
32
- }
33
- if ( $this->passPhrase == null || $this->passPhrase == "" ) {
34
- throw new PPMissingCredentialException( "passphrase cannot be empty" );
35
- }
36
- if ( $this->applicationId == null || $this->applicationId == "" ) {
37
- throw new PPMissingCredentialException( "applicationId cannot be empty" );
38
- }
39
- }
40
-
41
- public function getUserName()
42
- {
43
- return $this->userName;
44
- }
45
-
46
- public function getPassword()
47
- {
48
- return $this->password;
49
- }
50
-
51
- public function getCertificatePath()
52
- {
53
- if ( realpath( $this->certificatePath ) ) {
54
- return realpath( $this->certificatePath );
55
- } else {
56
- return realpath( dirname( __FILE__ ) . DIRECTORY_SEPARATOR . ".." . DIRECTORY_SEPARATOR . "config" . DIRECTORY_SEPARATOR . $this->certificatePath );
57
- }
58
- }
59
-
60
- public function getPassPhrase()
61
- {
62
- return $this->passPhrase;
63
- }
64
-
65
- public function getApplicationId()
66
- {
67
- return $this->applicationId;
68
- }
69
-
70
- }
71
-
72
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/classes/gateways/PayPal_AdvPayments/PayPal_AP/classes/adaptivepayments-sdk/lib/PPConfigManager.php DELETED
@@ -1,124 +0,0 @@
1
- <?php
2
- /**
3
- * PPConfigManager loads the SDK configuration file and
4
- * hands out appropriate config params to other classes
5
- */
6
- require_once 'exceptions/PPConfigurationException.php';
7
-
8
- class PPConfigManager
9
- {
10
-
11
- private $config;
12
- /**
13
- *
14
- *
15
- * @var PPConfigManager
16
- */
17
- private static $instance;
18
-
19
- private function __construct()
20
- {
21
- $configFile = dirname( __FILE__ ) . DIRECTORY_SEPARATOR . ".."
22
- . DIRECTORY_SEPARATOR . "config" . DIRECTORY_SEPARATOR . "sdk_config.ini";
23
- $this->load( $configFile );
24
- }
25
-
26
- // create singleton object for PPConfigManager
27
- public static function getInstance()
28
- {
29
- if ( !isset( self::$instance ) ) {
30
- self::$instance = new PPConfigManager();
31
- }
32
-
33
- return self::$instance;
34
- }
35
-
36
- //used to load the file
37
- private function load( $fileName )
38
- {
39
- if ( class_exists( 'Woocommerce' ) ) {
40
- global $woocommerce;
41
- $gateways = $woocommerce->payment_gateways->payment_gateways();
42
- $settings = $gateways[ 'paypalap' ]->settings;
43
-
44
- $mode = $settings[ 'sandbox_enabled' ];
45
-
46
- $this->config = array(
47
- 'acct1.UserName' => $mode == 'yes' ? $settings[ 'username' ] : $settings[ 'username_live' ],
48
- 'acct1.Password' => $mode == 'yes' ? $settings[ 'password' ] : $settings[ 'password_live' ],
49
- 'acct1.Signature' => $mode == 'yes' ? $settings[ 'signature' ] : $settings[ 'signature_live' ],
50
- 'acct1.AppId' => $mode == 'yes' ? 'APP-80W284485P519543T' : $settings[ 'app_id' ],
51
-
52
- 'service.Binding' => 'NV',
53
- 'service.EndPoint' => $mode == 'yes' ? 'https://svcs.sandbox.paypal.com/' : 'https://svcs.paypal.com/',
54
- 'service.RedirectURL' => $mode == 'yes' ? 'https://sandbox.paypal.com/webscr&cmd=' : 'https://paypal.com/webscr&cmd=',
55
- 'service.DevCentralURL' => 'https://developer.paypal.com',
56
- 'http.ConnectionTimeOut' => '30',
57
- 'http.Retry' => '5',
58
- 'log.FileName' => 'PayPal.log',
59
- 'log.LogLevel' => 'INFO',
60
- 'log.LogEnabled' => $settings[ 'logging_enabled' ] == 'yes' ? 'true' : 'false',
61
- );
62
- } else {
63
- $this->config = @parse_ini_file( $fileName );
64
- }
65
-
66
- if ( $this->config == null || count( $this->config ) == 0 ) {
67
- throw new PPConfigurationException( "Config file $fileName not found", "303" );
68
- }
69
- }
70
-
71
- /**
72
- * simple getter for configuration params
73
- * If an exact match for key is not found,
74
- * does a "contains" search on the key
75
- */
76
- public function get( $searchKey )
77
- {
78
-
79
- if ( array_key_exists( $searchKey, $this->config ) ) {
80
- return $this->config[ $searchKey ];
81
- } else {
82
- $arr = array();
83
- foreach ( $this->config as $k => $v ) {
84
- if ( strstr( $k, $searchKey ) ) {
85
- $arr[ $k ] = $v;
86
- }
87
- }
88
-
89
- return $arr;
90
- }
91
-
92
- }
93
-
94
- /**
95
- * Utility method for handling account configuration
96
- * return config key corresponding to the API userId passed in
97
- *
98
- * If $userId is null, returns config keys corresponding to
99
- * all configured accounts
100
- */
101
- public function getIniPrefix( $userId = null )
102
- {
103
-
104
- if ( $userId == null ) {
105
- $arr = array();
106
- foreach ( $this->config as $key => $value ) {
107
- $pos = strpos( $key, '.' );
108
- if ( strstr( $key, "acct" ) ) {
109
- $arr[ ] = substr( $key, 0, $pos );
110
- }
111
- }
112
-
113
- return array_unique( $arr );
114
- } else {
115
- $iniPrefix = array_search( $userId, $this->config );
116
- $pos = strpos( $iniPrefix, '.' );
117
- $acct = substr( $iniPrefix, 0, $pos );
118
-
119
- return $acct;
120
- }
121
- }
122
- }
123
-
124
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/classes/gateways/PayPal_AdvPayments/PayPal_AP/classes/adaptivepayments-sdk/lib/PPConnectionManager.php DELETED
@@ -1,48 +0,0 @@
1
- <?php
2
- require_once 'PPHttpConnection.php';
3
- require_once 'PPConfigManager.php';
4
- class PPConnectionManager
5
- {
6
- /**
7
- * reference to singleton instance
8
- * @var PPConnectionManager
9
- */
10
- private static $instance;
11
-
12
- private function __construct()
13
- {
14
- }
15
-
16
- public static function getInstance()
17
- {
18
- if ( self::$instance == null ) {
19
- self::$instance = new PPConnectionManager();
20
- }
21
-
22
- return self::$instance;
23
- }
24
-
25
- /**
26
- * This function returns a new PPHttpConnection object
27
- */
28
- public function getConnection()
29
- {
30
-
31
- $connection = new PPHttpConnection();
32
-
33
- $configMgr = PPConfigManager::getInstance();
34
- if ( ( $configMgr->get( "http.ConnectionTimeOut" ) ) ) {
35
- $connection->setHttpTimeout( $configMgr->get( "http.ConnectionTimeOut" ) );
36
- }
37
- if ( $configMgr->get( "http.Proxy" ) ) {
38
- $connection->setHttpProxy( $configMgr->get( "http.Proxy" ) );
39
- }
40
- if ( $configMgr->get( "http.Retry" ) ) {
41
- $retry = $configMgr->get( "http.Retry" );
42
- $connection->setHttpRetry( $retry );
43
- }
44
-
45
- return $connection;
46
- }
47
-
48
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/classes/gateways/PayPal_AdvPayments/PayPal_AP/classes/adaptivepayments-sdk/lib/PPCredentialManager.php DELETED
@@ -1,117 +0,0 @@
1
- <?php
2
- require_once 'IPPCredential.php';
3
- require_once 'PPConfigManager.php';
4
- require_once 'PPSignatureCredential.php';
5
- require_once 'PPCertificateCredential.php';
6
- require_once 'exceptions/PPInvalidCredentialException.php';
7
-
8
- class PPCredentialManager
9
- {
10
-
11
- private static $instance;
12
- //hashmap to contain credentials for accounts.
13
- private $credentialHashmap = array();
14
- /**
15
- * Contains the API username of the default account to use
16
- * when authenticating API calls.
17
- * @var string
18
- */
19
- private $defaultAccountName;
20
-
21
- /*
22
- * Constructor initialize credential for multiple accounts specified in property file.
23
- */
24
- private function __construct()
25
- {
26
- try {
27
- $this->initCredential();
28
- } catch ( Exception $e ) {
29
- $this->credentialHashmap = array();
30
- throw $e;
31
- }
32
- }
33
-
34
- /*
35
- * Create singleton instance for this class.
36
- */
37
- public static function getInstance()
38
- {
39
- if ( !isset( self::$instance ) ) {
40
- self::$instance = new PPCredentialManager();
41
- }
42
-
43
- return self::$instance;
44
- }
45
-
46
- /*
47
- * Load credentials for multiple accounts, with priority given to Signature credential.
48
- */
49
- private function initCredential()
50
- {
51
- $configMgr = PPConfigManager::getInstance();
52
- $suffix = 1;
53
- $prefix = "acct";
54
-
55
- $credArr = $configMgr->get( $prefix );
56
- $arrayPartKeys = $configMgr->getIniPrefix();
57
- if ( count( $arrayPartKeys ) == 0 )
58
- throw new MissingCredentialException( "No valid API accounts have been configured" );
59
-
60
- while ( in_array( $prefix . $suffix, $arrayPartKeys ) ) {
61
-
62
- if ( isset( $credArr[ $prefix . $suffix . ".Signature" ] )
63
- && $credArr[ $prefix . $suffix . ".Signature" ] != null && $credArr[ $prefix . $suffix . ".Signature" ] != ""
64
- ) {
65
-
66
- $userName = isset( $credArr[ $prefix . $suffix . '.UserName' ] ) ? $credArr[ $prefix . $suffix . '.UserName' ] : "";
67
- $password = isset( $credArr[ $prefix . $suffix . '.Password' ] ) ? $credArr[ $prefix . $suffix . '.Password' ] : "";
68
- $signature = isset( $credArr[ $prefix . $suffix . '.Signature' ] ) ? $credArr[ $prefix . $suffix . '.Signature' ] : "";
69
- $appId = isset( $credArr[ $prefix . $suffix . '.AppId' ] ) ? $credArr[ $prefix . $suffix . '.AppId' ] : "";
70
- $this->credentialHashmap[ $userName ] = new PPSignatureCredential( $userName, $password, $signature, $appId );
71
-
72
- } elseif ( isset( $credArr[ $prefix . $suffix . ".CertPath" ] )
73
- && $credArr[ $prefix . $suffix . ".CertPath" ] != null && $credArr[ $prefix . $suffix . ".CertPath" ] != ""
74
- ) {
75
-
76
- $userName = isset( $credArr[ $prefix . $suffix . '.UserName' ] ) ? $credArr[ $prefix . $suffix . '.UserName' ] : "";
77
- $password = isset( $credArr[ $prefix . $suffix . '.Password' ] ) ? $credArr[ $prefix . $suffix . '.Password' ] : "";
78
- $passPhrase = isset( $credArr[ $prefix . $suffix . '.CertKey' ] ) ? $credArr[ $prefix . $suffix . '.CertKey' ] : "";
79
- $certPath = isset( $credArr[ $prefix . $suffix . '.CertPath' ] ) ? $credArr[ $prefix . $suffix . '.CertPath' ] : "";
80
- $appId = isset( $credArr[ $prefix . $suffix . '.AppId' ] ) ? $credArr[ $prefix . $suffix . '.AppId' ] : "";
81
- $this->credentialHashmap[ $userName ] = new PPCertificateCredential( $userName, $password, $certPath, $appId, $passPhrase );
82
-
83
- }
84
- if ( $this->defaultAccountName == null )
85
- $this->defaultAccountName = $credArr[ $prefix . $suffix . '.UserName' ];
86
- $suffix++;
87
- }
88
-
89
- }
90
-
91
- /*
92
- * Obtain Credential Object based on UserId provided.
93
- */
94
- public function getCredentialObject( $userId = null )
95
- {
96
-
97
- if ( $userId == null )
98
- $credObj = $this->credentialHashmap[ $this->defaultAccountName ];
99
- else if ( array_key_exists( $userId, $this->credentialHashmap ) )
100
- $credObj = $this->credentialHashmap[ $userId ];
101
-
102
- if ( empty( $credObj ) ) {
103
- throw new PPInvalidCredentialException( "Invalid userId $userId" );
104
- }
105
-
106
- return $credObj;
107
- }
108
-
109
-
110
- public function __clone()
111
- {
112
- trigger_error( 'Clone is not allowed.', E_USER_ERROR );
113
- }
114
-
115
- }
116
-
117
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/classes/gateways/PayPal_AdvPayments/PayPal_AP/classes/adaptivepayments-sdk/lib/PPHttpConnection.php DELETED
@@ -1,184 +0,0 @@
1
- <?php
2
-
3
- require_once 'exceptions/PPConnectionException.php';
4
- require_once 'exceptions/PPConfigurationException.php';
5
- require_once 'PPLoggingManager.php';
6
- /**
7
- * A wrapper class based on the curl extension.
8
- * Requires the PHP curl module to be enabled.
9
- * See for full requirements the PHP manual: http://php.net/curl
10
- */
11
-
12
-
13
- class PPHttpConnection
14
- {
15
-
16
- const HTTP_GET = 'GET';
17
- const HTTP_POST = 'POST';
18
-
19
- /**
20
- * curl options to be set for the request
21
- */
22
- private $curlOpt = array();
23
-
24
- /**
25
- * Number of times a retry must be attempted on getting an HTTP error
26
- * @var integer
27
- */
28
- private $retry;
29
-
30
- /**
31
- * HTTP status codes for which a retry must be attempted
32
- */
33
- private static $retryCodes = array( '401', '403', '404', );
34
-
35
- private $logger;
36
-
37
-
38
- /**
39
- * Some default options for curl
40
- * These are typically overridden by PPConnectionManager
41
- */
42
- public static $DEFAULT_CURL_OPTS = array(
43
- CURLOPT_CONNECTTIMEOUT => 10,
44
- CURLOPT_RETURNTRANSFER => true,
45
- CURLOPT_TIMEOUT => 60, // maximum number of seconds to allow cURL functions to execute
46
- CURLOPT_USERAGENT => 'PayPal-PHP-SDK',
47
- CURLOPT_POST => 1,
48
- CURLOPT_HTTPHEADER => array(),
49
- CURLOPT_SSL_VERIFYHOST => 2,
50
- CURLOPT_SSL_VERIFYPEER => 2
51
- );
52
-
53
- public function __construct()
54
- {
55
- if ( !function_exists( "curl_init" ) ) {
56
- throw new PPConfigurationException( "Curl module is not available on this system" );
57
- }
58
- $this->curlOpt = self::$DEFAULT_CURL_OPTS;
59
- $this->logger = new PPLoggingManager( __CLASS__ );
60
- }
61
-
62
- /**
63
- * Set ssl parameters for certificate based client authentication
64
- *
65
- * @param string $certPath - path to client certificate file (PEM formatted file)
66
- */
67
- public function setSSLCert( $certPath, $passPhrase )
68
- {
69
- $this->curlOpt[ CURLOPT_SSLCERT ] = realpath( $certPath );
70
- $this->curlOpt[ CURLOPT_SSLCERTPASSWD ] = $passPhrase;
71
- }
72
-
73
- /**
74
- * Set connection timeout in seconds
75
- *
76
- * @param integer $timeout
77
- */
78
- public function setHttpTimeout( $timeout )
79
- {
80
- $this->curlOpt[ CURLOPT_CONNECTTIMEOUT ] = $timeout;
81
- }
82
-
83
- /**
84
- * Set HTTP proxy information
85
- *
86
- * @param string $proxy
87
- *
88
- * @throws PPConfigurationException
89
- */
90
- public function setHttpProxy( $proxy )
91
- {
92
- $urlParts = parse_url( $proxy );
93
- if ( $urlParts == false || !array_key_exists( "host", $urlParts ) )
94
- throw new PPConfigurationException( "Invalid proxy configuration " . $proxy );
95
-
96
- $this->curlOpt[ CURLOPT_PROXY ] = $urlParts[ "host" ];
97
- if ( isset( $urlParts[ "port" ] ) )
98
- $this->curlOpt[ CURLOPT_PROXY ] .= ":" . $urlParts[ "port" ];
99
- if ( isset( $urlParts[ "user" ] ) )
100
- $this->curlOpt[ URLOPT_PROXYUSERPWD ] = $urlParts[ "user" ] . ":" . $urlParts[ "pass" ];
101
- }
102
-
103
- public function setHttpHeaders( $headers )
104
- {
105
- $this->curlOpt[ CURLOPT_HTTPHEADER ] = $headers;
106
- }
107
-
108
- /**
109
- * @param integer $retry
110
- */
111
- public function setHttpRetry( $retry )
112
- {
113
- $this->retry = $retry;
114
- }
115
-
116
- /**
117
- * Executes an HTTP request
118
- *
119
- * @param string $url
120
- * @param string $params query string OR POST content as a string
121
- * @param array $headers array of HTTP headers to be added to existing headers
122
- * @param string $method HTTP method (GET, POST etc) defaults to POST
123
- *
124
- * @throws PPConnectionException
125
- */
126
- public function execute( $url, $params, $headers = null, $method = null )
127
- {
128
-
129
- $ch = curl_init( $url );
130
-
131
- $this->curlOpt[ CURLOPT_POSTFIELDS ] = $params;
132
- $this->curlOpt[ CURLOPT_URL ] = $url;
133
- $this->curlOpt[ CURLOPT_HEADER ] = false;
134
- if ( isset( $headers ) ) {
135
- $this->curlOpt[ CURLOPT_HTTPHEADER ] = array_merge( $this->curlOpt[ CURLOPT_HTTPHEADER ], $headers );
136
- }
137
- foreach ( $this->curlOpt[ CURLOPT_HTTPHEADER ] as $header ) {
138
- //TODO: Strip out credentials when logging.
139
- $this->logger->info( "Adding header $header" );
140
- }
141
- if ( isset( $method ) ) {
142
- $this->curlOpt[ CURLOPT_CUSTOMREQUEST ] = $method;
143
- }
144
-
145
- // curl_setopt_array available only in PHP 5 >= 5.1.3
146
- curl_setopt_array( $ch, $this->curlOpt );
147
-
148
- $result = curl_exec( $ch );
149
-
150
- if ( curl_errno( $ch ) == 60 ) {
151
- $this->logger->info( "Invalid or no certificate authority found, retrying using bundled CA certs" );
152
- curl_setopt( $ch, CURLOPT_CAINFO,
153
- dirname( __FILE__ ) . '/cacert.pem' );
154
- $result = curl_exec( $ch );
155
- }
156
- $httpStatus = curl_getinfo( $ch, CURLINFO_HTTP_CODE );
157
- $retries = 0;
158
- if ( in_array( $httpStatus, self::$retryCodes ) && isset( $this->retry ) ) {
159
- $this->logger->info( "Got $httpStatus response from server. Retrying" );
160
-
161
- do {
162
- $result = curl_exec( $ch );
163
- $httpStatus = curl_getinfo( $ch, CURLINFO_HTTP_CODE );
164
-
165
- } while ( in_array( $httpStatus, self::$retryCodes ) && ++$retries < $this->retry );
166
-
167
-
168
- }
169
- if ( curl_errno( $ch ) ) {
170
- $ex = new PPConnectionException( $url, curl_error( $ch ), curl_errno( $ch ) );
171
- curl_close( $ch );
172
- throw $ex;
173
- }
174
-
175
- curl_close( $ch );
176
-
177
- if ( in_array( $httpStatus, self::$retryCodes ) ) {
178
- throw new PPConnectionException( $url, "Retried " . $retries . " times, Http Response code " . $httpStatus );
179
- }
180
-
181
- return $result;
182
- }
183
-
184
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/classes/gateways/PayPal_AdvPayments/PayPal_AP/classes/adaptivepayments-sdk/lib/PPLoggingManager.php DELETED
@@ -1,84 +0,0 @@
1
- <?php
2
-
3
- /**
4
- * Simple Logging Manager.
5
- * This does an error_log for now
6
- * Potential frameworks to use are PEAR logger, log4php from Apache
7
- */
8
-
9
- class PPLoggingLevel
10
- {
11
-
12
- // FINE Logging Level
13
- const FINE = 3;
14
-
15
- // INFO Logging Level
16
- const INFO = 2;
17
-
18
- // WARN Logging Level
19
- const WARN = 1;
20
-
21
- // ERROR Logging Level
22
- const ERROR = 0;
23
- }
24
-
25
- class PPLoggingManager
26
- {
27
-
28
- // Default Logging Level
29
- const DEFAULT_LOGGING_LEVEL = 0;
30
-
31
- // Logger name
32
- private $loggerName;
33
-
34
- // Log enabled
35
- private $isLoggingEnabled;
36
-
37
- // Configured logging level
38
- private $loggingLevel;
39
-
40
- // Configured logging file
41
- private $loggerFile;
42
-
43
- public function __construct( $loggerName )
44
- {
45
- $this->loggerName = $loggerName;
46
- $config = PPConfigManager::getInstance();
47
- $this->loggerFile = ( $config->get( 'log.FileName' ) ) ? $config->get( 'log.FileName' ) : ini_get( 'error_log' );
48
- $loggingEnabled = $config->get( 'log.LogEnabled' );
49
- $this->isLoggingEnabled = ( isset( $loggingEnabled ) ) ? $loggingEnabled : false;
50
- $loggingLevel = strtoupper( $config->get( 'log.LogLevel' ) );
51
- $this->loggingLevel = ( isset( $loggingLevel ) && defined( "PPLoggingLevel::$loggingLevel" ) ) ? constant( "PPLoggingLevel::$loggingLevel" ) : PPLoggingManager::DEFAULT_LOGGING_LEVEL;
52
-
53
- }
54
-
55
- public function log( $message, $level = PPLoggingLevel::INFO )
56
- {
57
- if ( $this->isLoggingEnabled && ( $level <= $this->loggingLevel ) ) {
58
- error_log( $this->loggerName . ": $message\n" );
59
- }
60
- }
61
-
62
- public function error( $message )
63
- {
64
- $this->log( $message, PPLoggingLevel::ERROR );
65
- }
66
-
67
- public function warning( $message )
68
- {
69
- $this->log( $message, PPLoggingLevel::WARN );
70
- }
71
-
72
- public function info( $message )
73
- {
74
- $this->log( $message, PPLoggingLevel::INFO );
75
- }
76
-
77
- public function fine( $message )
78
- {
79
- $this->log( $message, PPLoggingLevel::FINE );
80
- }
81
-
82
- }
83
-
84
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/classes/gateways/PayPal_AdvPayments/PayPal_AP/classes/adaptivepayments-sdk/lib/PPObjectTransformer.php DELETED
@@ -1,33 +0,0 @@
1
- <?php
2
- /**
3
- * Utility class for transforming PHP objects into
4
- * appropriate service payload type and vice versa
5
- */
6
- class PPObjectTransformer
7
- {
8
-
9
- public function toString( $object )
10
- {
11
-
12
- if ( $object == null ) {
13
- throw new PPTransformerException( "Empty object" );
14
- }
15
-
16
- $confManager = PPConfigManager::getInstance();
17
- switch ( strtoupper( $confManager->get( "service.Binding" ) ) ) {
18
- case 'SOAP':
19
- return $object->toXMLString();
20
-
21
- case 'XML':
22
- case 'JSON':
23
- return "";
24
- case 'NVP':
25
- default:
26
- return $object->toNVPString();
27
- }
28
- }
29
-
30
-
31
- }
32
-
33
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/classes/gateways/PayPal_AdvPayments/PayPal_AP/classes/adaptivepayments-sdk/lib/PPSignatureCredential.php DELETED
@@ -1,49 +0,0 @@
1
- <?php
2
-
3
- require_once 'exceptions/PPMissingCredentialException.php';
4
- require_once 'IPPCredential.php';
5
- require_once 'PPConfigManager.php';
6
-
7
- /**
8
- * API signature based credentials
9
- */
10
- class PPSignatureCredential extends IPPCredential
11
- {
12
-
13
- /**
14
- * API Signature
15
- * @var string
16
- */
17
- private $signature;
18
-
19
- public function __construct( $userName, $password, $signature, $appId )
20
- {
21
- parent::__construct( $userName, $password, $appId );
22
- $this->signature = $signature;
23
- $this->validate();
24
- }
25
-
26
- public function validate()
27
- {
28
-
29
- if ( $this->userName == null || $this->userName == "" ) {
30
- throw new PPMissingCredentialException( "username cannot be empty" );
31
- }
32
- if ( $this->password == null || $this->password == "" ) {
33
- throw new PPMissingCredentialException( "password cannot be empty" );
34
- }
35
- if ( $this->signature == null || $this->signature == "" ) {
36
- throw new PPMissingCredentialException( "signature cannot be empty" );
37
- }
38
- if ( $this->applicationId == null || $this->applicationId == "" ) {
39
- throw new PPMissingCredentialException( "applicationId cannot be empty" );
40
- }
41
- }
42
-
43
- public function getSignature()
44
- {
45
- return $this->signature;
46
- }
47
- }
48
-
49
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/classes/gateways/PayPal_AdvPayments/PayPal_AP/classes/adaptivepayments-sdk/lib/PPUtils.php DELETED
@@ -1,274 +0,0 @@
1
- <?php
2
- class PPUtils
3
- {
4
-
5
- const SDK_VERSION = "1.2.95";
6
- const SDK_NAME = "sdk-adaptivepayments-php ";
7
-
8
- /**
9
- *
10
- * Convert a Name Value Pair (NVP) formatted string into
11
- * an associative array taking care to urldecode array values
12
- *
13
- * @param string $nvpString
14
- */
15
- public static function nvpToMap( $nvpString )
16
- {
17
-
18
- $ret = array();
19
- $params = explode( "&", $nvpString );
20
- foreach ( $params as $p ) {
21
- list( $k, $v ) = explode( "=", $p );
22
- $ret[ $k ] = urldecode( $v );
23
- }
24
-
25
- return $ret;
26
- }
27
-
28
- /**
29
- * Returns true if the array contains a key like $key
30
- *
31
- * @param array $map
32
- * @param regex $key
33
- */
34
- public static function array_match_key( $map, $key )
35
- {
36
- $key = str_replace( "(", "\(", $key );
37
- $key = str_replace( ")", "\)", $key );
38
- $key = str_replace( ".", "\.", $key );
39
- $pattern = "/$key*/";
40
- foreach ( $map as $k => $v ) {
41
- preg_match( $pattern, $k, $matches );
42
- if ( count( $matches ) > 0 )
43
- return true;
44
- }
45
-
46
- return false;
47
- }
48
-
49
- /**
50
- *
51
- * Get the local IP address. The client address is a required
52
- * request parameter for some API calls
53
- */
54
- public static function getLocalIPAddress()
55
- {
56
-
57
- if ( array_key_exists( "SERVER_ADDR", $_SERVER ) ) {
58
- // SERVER_ADDR is available only if we are running the CGI SAPI
59
- return $_SERVER[ 'SERVER_ADDR' ];
60
- } else if ( function_exists( "gethostname" ) ) {
61
- // gethostname is available only in PHP >= v5.3
62
- return gethostbyname( gethostname() );
63
- } else {
64
- // fallback if nothing works
65
- return "127.0.0.1";
66
- }
67
- }
68
-
69
- /**
70
- *
71
- * Compute the value that needs to sent for the PAYPAL_REQUEST_SOURCE
72
- * parameter when making API calls
73
- */
74
- public static function getRequestSource()
75
- {
76
- return str_replace( " ", "_", self::SDK_NAME ) . self::SDK_VERSION;
77
- }
78
-
79
- public static function xmlToArray( $xmlInput )
80
- {
81
-
82
- $xml = simplexml_load_string( $xmlInput );
83
-
84
- $ns = $xml->getNamespaces( true );
85
-
86
- $soap = $xml->children( $ns[ 'SOAP-ENV' ] );
87
- $getChild = $soap->Body->children();
88
-
89
- $ret = PPUtils::convertXmlObjToArr( $getChild, $array = array() );
90
-
91
- return $ret;
92
- }
93
-
94
- /*foreach ($ret as $arry)
95
- {
96
- if (isset($arry['children']) && is_array($arry['children'])&& ($arry['children'])!=null) {
97
- foreach ($arry['children'] as $novel)
98
- {
99
-
100
- }
101
- }
102
- else if ($arry['name'] != null)
103
- {
104
- $a = $arry['name'] ;
105
- $b= $arry['text'];
106
- if (isset($arry['attribute']))
107
- {
108
- $c = $arry['attribute'];
109
- }
110
- }
111
-
112
-
113
- }*/
114
-
115
- /*public function xml2array ( $xmlObject, $out = array () )
116
- {
117
- foreach ( (array) $xmlObject as $index => $node )
118
- {
119
- $out[$index] = ( is_object ( $node ) ) ? PPUtils::xml2array ( $node ) : $node;
120
- }
121
- return $out;
122
- }*/
123
-
124
-
125
- function convertXmlObjToArr( $obj, &$arr )
126
- {
127
- $children = $obj->children();
128
- foreach ( $children as $elementName => $node ) {
129
- $nextIdx = count( $arr );
130
- $arr[ $nextIdx ] = array();
131
- $arr[ $nextIdx ][ 'name' ] = strtolower( (string) $elementName );
132
- $arr[ $nextIdx ][ 'attributes' ] = array();
133
- $attributes = $node->attributes();
134
- foreach ( $attributes as $attributeName => $attributeValue ) {
135
- $attribName = strtolower( trim( (string) $attributeName ) );
136
- $attribVal = trim( (string) $attributeValue );
137
- $arr[ $nextIdx ][ 'attributes' ][ $attribName ] = $attribVal;
138
- }
139
- $text = (string) $node;
140
- $text = trim( $text );
141
- if ( strlen( $text ) > 0 ) {
142
- $arr[ $nextIdx ][ 'text' ] = $text;
143
- }
144
- $arr[ $nextIdx ][ 'children' ] = array();
145
- PPutils::convertXmlObjToArr( $node, $arr[ $nextIdx ][ 'children' ] );
146
- }
147
-
148
- return $arr;
149
- }
150
-
151
- }
152
-
153
- /**
154
- * @class xml2array
155
- */
156
-
157
-
158
- /**
159
- * XMLToArray Generator Class
160
- * @author : MA Razzaque Rupom <rupom_315@yahoo.com>, <rupom.bd@gmail.com>
161
- * Moderator, phpResource (LINK1http://groups.yahoo.com/group/phpresource/LINK1)
162
- * URL: LINK2http://www.rupom.infoLINK2
163
- * @version : 1.0
164
- * @date 06/05/2006
165
- * Purpose : Creating Hierarchical Array from XML Data
166
- * Released : Under GPL
167
- */
168
-
169
- // class XmlToArray
170
- // {
171
-
172
- // var $xml = '';
173
-
174
- // /**
175
- // * Default Constructor
176
- // *
177
- // * @param $xml = xml data
178
- // *
179
- // * @return none
180
- // */
181
-
182
- // function XmlToArray( $xml )
183
- // {
184
- // $this->xml = $xml;
185
- // }
186
-
187
- // /**
188
- // * _struct_to_array($values, &$i)
189
- // *
190
- // * This is adds the contents of the return xml into the array for easier processing.
191
- // * Recursive, Static
192
- // *
193
- // * @access private
194
- // *
195
- // * @param array $values this is the xml data in an array
196
- // * @param int $i this is the current location in the array
197
- // *
198
- // * @return Array
199
- // */
200
-
201
- // function _struct_to_array( $values, &$i )
202
- // {
203
- // $child = array();
204
- // if ( isset( $values[ $i ][ 'value' ] ) ) array_push( $child, $values[ $i ][ 'value' ] );
205
-
206
- // while ( $i++ < count( $values ) ) {
207
- // switch ( $values[ $i ][ 'type' ] ) {
208
- // case 'cdata':
209
- // array_push( $child, $values[ $i ][ 'value' ] );
210
- // break;
211
-
212
- // case 'complete':
213
- // $name = $values[ $i ][ 'tag' ];
214
- // if ( !empty( $name ) ) {
215
- // $child[ $name ] = ( $values[ $i ][ 'value' ] ) ? ( $values[ $i ][ 'value' ] ) : '';
216
- // if ( isset( $values[ $i ][ 'attributes' ] ) ) {
217
- // $child[ $name ] = $values[ $i ][ 'attributes' ];
218
- // }
219
- // }
220
- // break;
221
-
222
- // case 'open':
223
- // $name = $values[ $i ][ 'tag' ];
224
- // $size = isset( $child[ $name ] ) ? sizeof( $child[ $name ] ) : 0;
225
- // $child[ $name ][ $size ] = $this->_struct_to_array( $values, $i );
226
- // break;
227
-
228
- // case 'close':
229
- // return $child;
230
- // break;
231
- // }
232
- // }
233
-
234
- // return $child;
235
- // }
236
-
237
- // //_struct_to_array
238
-
239
- // /**
240
- // * createArray($data)
241
- // *
242
- // * This is adds the contents of the return xml into the array for easier processing.
243
- // *
244
- // * @access public
245
- // *
246
- // * @param string $data this is the string of the xml data
247
- // *
248
- // * @return Array
249
- // */
250
- // function createArray()
251
- // {
252
- // $xml = $this->xml;
253
- // $values = array();
254
- // $index = array();
255
- // $array = array();
256
- // $parser = xml_parser_create();
257
- // xml_parser_set_option( $parser, XML_OPTION_SKIP_WHITE, 1 );
258
- // xml_parser_set_option( $parser, XML_OPTION_CASE_FOLDING, 0 );
259
- // xml_parse_into_struct( $parser, $xml, $values, $index );
260
- // xml_parser_free( $parser );
261
- // $i = 0;
262
- // $name = $values[ $i ][ 'tag' ];
263
- // $array[ $name ] = isset( $values[ $i ][ 'attributes' ] ) ? $values[ $i ][ 'attributes' ] : '';
264
- // $array[ $name ] = $this->_struct_to_array( $values, $i );
265
-
266
- // return $array;
267
- // }
268
- // //createArray
269
-
270
-
271
- // }
272
-
273
- //XmlToArray
274
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/classes/gateways/PayPal_AdvPayments/PayPal_AP/classes/adaptivepayments-sdk/lib/auth/AuthUtil.php DELETED
@@ -1,83 +0,0 @@
1
- <?php //vim: foldmethod=marker
2
-
3
- class MockOAuthDataStore extends OAuthDataStore
4
- { /*{{{*/
5
- private $consumer;
6
- private $request_token;
7
- private $access_token;
8
- private $nonce;
9
-
10
- function __construct()
11
- { /*{{{*/
12
- $this->consumer = new OAuthConsumer( "key", "secret", null );
13
- $this->request_token = new OAuthToken( "requestkey", "requestsecret", 1 );
14
- $this->access_token = new OAuthToken( "accesskey", "accesssecret", 1 );
15
- $this->nonce = "nonce";
16
- }
17
-
18
- /*}}}*/
19
-
20
- function lookup_consumer( $consumer_key )
21
- { /*{{{*/
22
- if ( $consumer_key == $this->consumer->key ) return $this->consumer;
23
-
24
- return null;
25
- }
26
-
27
- /*}}}*/
28
-
29
- function lookup_token( $consumer, $token_type, $token )
30
- { /*{{{*/
31
- $token_attrib = $token_type . "_token";
32
- if ( $consumer->key == $this->consumer->key
33
- && $token == $this->$token_attrib->key
34
- ) {
35
- return $this->$token_attrib;
36
- }
37
-
38
- return null;
39
- }
40
-
41
- /*}}}*/
42
-
43
- function lookup_nonce( $consumer, $token, $nonce, $timestamp )
44
- { /*{{{*/
45
- if ( $consumer->key == $this->consumer->key
46
- && ( ( $token && $token->key == $this->request_token->key )
47
- || ( $token && $token->key == $this->access_token->key ) )
48
- && $nonce == $this->nonce
49
- ) {
50
- return $this->nonce;
51
- }
52
-
53
- return null;
54
- }
55
-
56
- /*}}}*/
57
-
58
- function new_request_token( $consumer, $callback = null )
59
- { /*{{{*/
60
- if ( $consumer->key == $this->consumer->key ) {
61
- return $this->request_token;
62
- }
63
-
64
- return null;
65
- }
66
-
67
- /*}}}*/
68
-
69
- function new_access_token( $token, $consumer, $verifier = null )
70
- { /*{{{*/
71
- if ( $consumer->key == $this->consumer->key
72
- && $token->key == $this->request_token->key
73
- ) {
74
- return $this->access_token;
75
- }
76
-
77
- return null;
78
- }
79
- /*}}}*/
80
- }
81
-
82
- /*}}}*/
83
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/classes/gateways/PayPal_AdvPayments/PayPal_AP/classes/adaptivepayments-sdk/lib/auth/PPAuth.php DELETED
@@ -1,1077 +0,0 @@
1
- <?php
2
- //PayPal specific modification ends
3
- /* Generic exception class
4
- */
5
- if ( !class_exists( 'OAuthException' ) ) {
6
- class OAuthException extends Exception
7
- {
8
- // pass
9
- }
10
- }
11
-
12
- if ( !class_exists( 'OAuthConsumer' ) ) {
13
- class OAuthConsumer
14
- {
15
- public $key;
16
- public $secret;
17
-
18
- function __construct( $key, $secret, $callback_url = null )
19
- {
20
- $this->key = $key;
21
- $this->secret = $secret;
22
- $this->callback_url = $callback_url;
23
- }
24
-
25
- function __toString()
26
- {
27
- return "OAuthConsumer[key=$this->key,secret=$this->secret]";
28
- }
29
- }
30
- }
31
-
32
- if ( !class_exists( 'OAuthToken' ) ) {
33
- class OAuthToken
34
- {
35
- // access tokens and request tokens
36
- public $key;
37
- public $secret;
38
-
39
- /**
40
- * key = the token
41
- * secret = the token secret
42
- */
43
- function __construct( $key, $secret )
44
- {
45
- $this->key = $key;
46
- $this->secret = $secret;
47
- }
48
-
49
- /**
50
- * generates the basic string serialization of a token that a server
51
- * would respond to request_token and access_token calls with
52
- */
53
- function to_string()
54
- {
55
- return "oauth_token=" .
56
- OAuthUtil::urlencode_rfc3986( $this->key ) .
57
- "&oauth_token_secret=" .
58
- OAuthUtil::urlencode_rfc3986( $this->secret );
59
- }
60
-
61
- function __toString()
62
- {
63
- return $this->to_string();
64
- }
65
- }
66
- }
67
-
68
- /**
69
- * A class for implementing a Signature Method
70
- * See section 9 ("Signing Requests") in the spec
71
- */
72
- if ( !class_exists( 'OAuthSignatureMethod' ) ) {
73
- abstract class OAuthSignatureMethod
74
- {
75
- /**
76
- * Needs to return the name of the Signature Method (ie HMAC-SHA1)
77
- * @return string
78
- */
79
- abstract public function get_name();
80
-
81
- /**
82
- * Build up the signature
83
- * NOTE: The output of this function MUST NOT be urlencoded.
84
- * the encoding is handled in OAuthRequest when the final
85
- * request is serialized
86
- *
87
- * @param OAuthRequest $request
88
- * @param OAuthConsumer $consumer
89
- * @param OAuthToken $token
90
- *
91
- * @return string
92
- */
93
- abstract public function build_signature( $request, $consumer, $token );
94
-
95
- /**
96
- * Verifies that a given signature is correct
97
- *
98
- * @param OAuthRequest $request
99
- * @param OAuthConsumer $consumer
100
- * @param OAuthToken $token
101
- * @param string $signature
102
- *
103
- * @return bool
104
- */
105
- public function check_signature( $request, $consumer, $token, $signature )
106
- {
107
- $built = $this->build_signature( $request, $consumer, $token );
108
-
109
- return $built == $signature;
110
- }
111
- }
112
- }
113
-
114
- /**
115
- * The HMAC-SHA1 signature method uses the HMAC-SHA1 signature algorithm as defined in [RFC2104]
116
- * where the Signature Base String is the text and the key is the concatenated values (each first
117
- * encoded per Parameter Encoding) of the Consumer Secret and Token Secret, separated by an '&'
118
- * character (ASCII code 38) even if empty.
119
- * - Chapter 9.2 ("HMAC-SHA1")
120
- */
121
- if ( !class_exists( 'OAuthSignatureMethod_HMAC_SHA1' ) ) {
122
- class OAuthSignatureMethod_HMAC_SHA1 extends OAuthSignatureMethod
123
- {
124
- function get_name()
125
- {
126
- return "HMAC-SHA1";
127
- }
128
-
129
- public function build_signature( $request, $consumer, $token )
130
- {
131
- $base_string = $request->get_signature_base_string();
132
- $base_string = preg_replace( "/(%[A-Za-z0-9]{2})/e", "strtolower('\\0')", $base_string ); //convert base string to lowercase
133
- $request->base_string = $base_string;
134
-
135
- $key_parts = array(
136
- $consumer->secret,
137
- ( $token ) ? $token->secret : ""
138
- );
139
-
140
- $key_parts = OAuthUtil::urlencode_rfc3986( $key_parts );
141
- $key = implode( '&', $key_parts );
142
- $key = preg_replace( "/(%[A-Za-z0-9]{2})/e", "strtolower('\\0')", $key ); //convert to lowercase
143
- return base64_encode( hash_hmac( 'sha1', $base_string, $key, true ) );
144
- }
145
- }
146
- }
147
- /**
148
- * The PLAINTEXT method does not provide any security protection and SHOULD only be used
149
- * over a secure channel such as HTTPS. It does not use the Signature Base String.
150
- * - Chapter 9.4 ("PLAINTEXT")
151
- */
152
- if ( !class_exists( 'OAuthSignatureMethod_PLAINTEXT' ) ) {
153
- class OAuthSignatureMethod_PLAINTEXT extends OAuthSignatureMethod
154
- {
155
- public function get_name()
156
- {
157
- return "PLAINTEXT";
158
- }
159
-
160
- /**
161
- * oauth_signature is set to the concatenated encoded values of the Consumer Secret and
162
- * Token Secret, separated by a '&' character (ASCII code 38), even if either secret is
163
- * empty. The result MUST be encoded again.
164
- * - Chapter 9.4.1 ("Generating Signatures")
165
- *
166
- * Please note that the second encoding MUST NOT happen in the SignatureMethod, as
167
- * OAuthRequest handles this!
168
- */
169
- public function build_signature( $request, $consumer, $token )
170
- {
171
- $key_parts = array(
172
- $consumer->secret,
173
- ( $token ) ? $token->secret : ""
174
- );
175
-
176
- $key_parts = OAuthUtil::urlencode_rfc3986( $key_parts );
177
- $key = implode( '&', $key_parts );
178
- $request->base_string = $key;
179
-
180
- return $key;
181
- }
182
- }
183
- }
184
- /**
185
- * The RSA-SHA1 signature method uses the RSASSA-PKCS1-v1_5 signature algorithm as defined in
186
- * [RFC3447] section 8.2 (more simply known as PKCS#1), using SHA-1 as the hash function for
187
- * EMSA-PKCS1-v1_5. It is assumed that the Consumer has provided its RSA public key in a
188
- * verified way to the Service Provider, in a manner which is beyond the scope of this
189
- * specification.
190
- * - Chapter 9.3 ("RSA-SHA1")
191
- */
192
- if ( !class_exists( 'OAuthSignatureMethod_RSA_SHA1' ) ) {
193
- abstract class OAuthSignatureMethod_RSA_SHA1 extends OAuthSignatureMethod
194
- {
195
- public function get_name()
196
- {
197
- return "RSA-SHA1";
198
- }
199
-
200
- // Up to the SP to implement this lookup of keys. Possible ideas are:
201
- // (1) do a lookup in a table of trusted certs keyed off of consumer
202
- // (2) fetch via http using a url provided by the requester
203
- // (3) some sort of specific discovery code based on request
204
- //
205
- // Either way should return a string representation of the certificate
206
- protected abstract function fetch_public_cert( &$request );
207
-
208
- // Up to the SP to implement this lookup of keys. Possible ideas are:
209
- // (1) do a lookup in a table of trusted certs keyed off of consumer
210
- //
211
- // Either way should return a string representation of the certificate
212
- protected abstract function fetch_private_cert( &$request );
213
-
214
- public function build_signature( $request, $consumer, $token )
215
- {
216
- $base_string = $request->get_signature_base_string();
217
- $request->base_string = $base_string;
218
-
219
- // Fetch the private key cert based on the request
220
- $cert = $this->fetch_private_cert( $request );
221
-
222
- // Pull the private key ID from the certificate
223
- $privatekeyid = openssl_get_privatekey( $cert );
224
-
225
- // Sign using the key
226
- $ok = openssl_sign( $base_string, $signature, $privatekeyid );
227
-
228
- // Release the key resource
229
- openssl_free_key( $privatekeyid );
230
-
231
- return base64_encode( $signature );
232
- }
233
-
234
- public function check_signature( $request, $consumer, $token, $signature )
235
- {
236
- $decoded_sig = base64_decode( $signature );
237
-
238
- $base_string = $request->get_signature_base_string();
239
-
240
- // Fetch the public key cert based on the request
241
- $cert = $this->fetch_public_cert( $request );
242
-
243
- // Pull the public key ID from the certificate
244
- $publickeyid = openssl_get_publickey( $cert );
245
-
246
- // Check the computed signature against the one passed in the query
247
- $ok = openssl_verify( $base_string, $decoded_sig, $publickeyid );
248
-
249
- // Release the key resource
250
- openssl_free_key( $publickeyid );
251
-
252
- return $ok == 1;
253
- }
254
- }
255
- }
256
-
257
- if ( !class_exists( 'OAuthRequest' ) ) {
258
- class OAuthRequest
259
- {
260
- public $parameters;
261
- protected $http_method;
262
- protected $http_url;
263
- // for debug purposes
264
- public $base_string;
265
- public static $version = '1.0';
266
- public static $POST_INPUT = 'php://input';
267
-
268
- function __construct( $http_method, $http_url, $parameters = null )
269
- {
270
- $parameters = ( $parameters ) ? $parameters : array();
271
- $parameters = array_merge( OAuthUtil::parse_parameters( parse_url( $http_url, PHP_URL_QUERY ) ), $parameters );
272
- $this->parameters = $parameters;
273
- $this->http_method = $http_method;
274
- $this->http_url = $http_url;
275
- }
276
-
277
-
278
- /**
279
- * attempt to build up a request from what was passed to the server
280
- */
281
- public static function from_request( $http_method = null, $http_url = null, $parameters = null )
282
- {
283
- $scheme = ( !isset( $_SERVER[ 'HTTPS' ] ) || $_SERVER[ 'HTTPS' ] != "on" )
284
- ? 'http'
285
- : 'https';
286
- $http_url = ( $http_url ) ? $http_url : $scheme .
287
- '://' . $_SERVER[ 'HTTP_HOST' ] .
288
- ':' .
289
- $_SERVER[ 'SERVER_PORT' ] .
290
- $_SERVER[ 'REQUEST_URI' ];
291
- $http_method = ( $http_method ) ? $http_method : $_SERVER[ 'REQUEST_METHOD' ];
292
-
293
- // We weren't handed any parameters, so let's find the ones relevant to
294
- // this request.
295
- // If you run XML-RPC or similar you should use this to provide your own
296
- // parsed parameter-list
297
- if ( !$parameters ) {
298
- // Find request headers
299
- $request_headers = OAuthUtil::get_headers();
300
-
301
- // Parse the query-string to find GET parameters
302
- $parameters = OAuthUtil::parse_parameters( $_SERVER[ 'QUERY_STRING' ] );
303
-
304
- // It's a POST request of the proper content-type, so parse POST
305
- // parameters and add those overriding any duplicates from GET
306
- if ( $http_method == "POST"
307
- && isset( $request_headers[ 'Content-Type' ] )
308
- && strstr( $request_headers[ 'Content-Type' ],
309
- 'application/x-www-form-urlencoded' )
310
- ) {
311
- $post_data = OAuthUtil::parse_parameters(
312
- file_get_contents( self::$POST_INPUT )
313
- );
314
- $parameters = array_merge( $parameters, $post_data );
315
- }
316
-
317
- // We have a Authorization-header with OAuth data. Parse the header
318
- // and add those overriding any duplicates from GET or POST
319
- if ( isset( $request_headers[ 'Authorization' ] ) && substr( $request_headers[ 'Authorization' ], 0, 6 ) == 'OAuth ' ) {
320
- $header_parameters = OAuthUtil::split_header(
321
- $request_headers[ 'Authorization' ]
322
- );
323
- $parameters = array_merge( $parameters, $header_parameters );
324
- }
325
-
326
- }
327
-
328
- return new OAuthRequest( $http_method, $http_url, $parameters );
329
- }
330
-
331
- /**
332
- * pretty much a helper function to set up the request
333
- */
334
- public static function from_consumer_and_token( $consumer, $token, $http_method, $http_url, $parameters = null )
335
- {
336
- $parameters = ( $parameters ) ? $parameters : array();
337
- $defaults = array(
338
- "oauth_version" => OAuthRequest::$version,
339
- // "oauth_nonce" => OAuthRequest::generate_nonce(),
340
- "oauth_timestamp" => OAuthRequest::generate_timestamp(),
341
-
342
- "oauth_consumer_key" => $consumer->key
343
- );
344
- if ( $token )
345
- $defaults[ 'oauth_token' ] = $token->key;
346
-
347
- $parameters = array_merge( $defaults, $parameters );
348
- ksort( $parameters );
349
-
350
- return new OAuthRequest( $http_method, $http_url, $parameters );
351
- }
352
-
353
- public function set_parameter( $name, $value, $allow_duplicates = true )
354
- {
355
- if ( $allow_duplicates && isset( $this->parameters[ $name ] ) ) {
356
- // We have already added parameter(s) with this name, so add to the list
357
- if ( is_scalar( $this->parameters[ $name ] ) ) {
358
- // This is the first duplicate, so transform scalar (string)
359
- // into an array so we can add the duplicates
360
- $this->parameters[ $name ] = array( $this->parameters[ $name ] );
361
- }
362
-
363
- $this->parameters[ $name ][ ] = $value;
364
- } else {
365
- $this->parameters[ $name ] = $value;
366
- }
367
- }
368
-
369
- public function get_parameter( $name )
370
- {
371
- return isset( $this->parameters[ $name ] ) ? $this->parameters[ $name ] : null;
372
- }
373
-
374
- public function get_parameters()
375
- {
376
- return $this->parameters;
377
- }
378
-
379
- public function unset_parameter( $name )
380
- {
381
- unset( $this->parameters[ $name ] );
382
- }
383
-
384
- /**
385
- * The request parameters, sorted and concatenated into a normalized string.
386
- * @return string
387
- */
388
- public function get_signable_parameters()
389
- {
390
- // Grab all parameters
391
- $params = $this->parameters;
392
- ksort( $params );
393
- // Remove oauth_signature if present
394
- // Ref: Spec: 9.1.1 ("The oauth_signature parameter MUST be excluded.")
395
- if ( isset( $params[ 'oauth_signature' ] ) ) {
396
- unset( $params[ 'oauth_signature' ] );
397
- }
398
- foreach ( $params as $key => $value ) {
399
- $res[ ] = $key . "=" . $value;
400
- }
401
-
402
- return implode( '&', $res );
403
- //return OAuthUtil::build_http_query($params);
404
- }
405
-
406
- /**
407
- * Returns the base string of this request
408
- *
409
- * The base string defined as the method, the url
410
- * and the parameters (normalized), each urlencoded
411
- * and the concated with &.
412
- */
413
- public function get_signature_base_string()
414
- {
415
- $parts = array(
416
- $this->get_normalized_http_method(),
417
- $this->get_normalized_http_url(),
418
- $this->get_signable_parameters()
419
- );
420
-
421
- $parts = OAuthUtil::urlencode_rfc3986( $parts );
422
-
423
- return implode( '&', $parts );
424
- }
425
-
426
- /**
427
- * just uppercases the http method
428
- */
429
- public function get_normalized_http_method()
430
- {
431
- return strtoupper( $this->http_method );
432
- }
433
-
434
- /**
435
- * parses the url and rebuilds it to be
436
- * scheme://host/path
437
- */
438
- public function get_normalized_http_url()
439
- {
440
- $parts = parse_url( $this->http_url );
441
-
442
- $scheme = ( isset( $parts[ 'scheme' ] ) ) ? $parts[ 'scheme' ] : 'http';
443
- $port = ( isset( $parts[ 'port' ] ) ) ? $parts[ 'port' ] : ( ( $scheme == 'https' ) ? '443' : '80' );
444
- $host = ( isset( $parts[ 'host' ] ) ) ? $parts[ 'host' ] : '';
445
- $path = ( isset( $parts[ 'path' ] ) ) ? $parts[ 'path' ] : '';
446
-
447
- if ( ( $scheme == 'https' && $port != '443' )
448
- || ( $scheme == 'http' && $port != '80' )
449
- ) {
450
- $host = "$host:$port";
451
- }
452
-
453
- return "$scheme://$host$path";
454
- }
455
-
456
- /**
457
- * builds a url usable for a GET request
458
- */
459
- public function to_url()
460
- {
461
- $post_data = $this->to_postdata();
462
- $out = $this->get_normalized_http_url();
463
- if ( $post_data ) {
464
- $out .= '?' . $post_data;
465
- }
466
-
467
- return $out;
468
- }
469
-
470
- /**
471
- * builds the data one would send in a POST request
472
- */
473
- public function to_postdata()
474
- {
475
- return OAuthUtil::build_http_query( $this->parameters );
476
- }
477
-
478
- /**
479
- * builds the Authorization: header
480
- */
481
- public function to_header( $realm = null )
482
- {
483
- $first = true;
484
- if ( $realm ) {
485
- $out = 'Authorization: OAuth realm="' . OAuthUtil::urlencode_rfc3986( $realm ) . '"';
486
- $first = false;
487
- } else
488
- $out = 'Authorization: OAuth';
489
-
490
- $total = array();
491
- foreach ( $this->parameters as $k => $v ) {
492
- if ( substr( $k, 0, 5 ) != "oauth" ) continue;
493
- if ( is_array( $v ) ) {
494
- throw new OAuthException( 'Arrays not supported in headers' );
495
- }
496
- $out .= ( $first ) ? ' ' : ',';
497
- $out .= OAuthUtil::urlencode_rfc3986( $k ) .
498
- '="' .
499
- OAuthUtil::urlencode_rfc3986( $v ) .
500
- '"';
501
- $first = false;
502
- }
503
-
504
- return $out;
505
- }
506
-
507
- public function __toString()
508
- {
509
- return $this->to_url();
510
- }
511
-
512
-
513
- public function sign_request( $signature_method, $consumer, $token )
514
- {
515
-
516
- $empty = false;
517
- $msg = array();
518
- if ( $token->key == null ) {
519
- $msg[ ] = 'Token key';
520
- }
521
- if ( $token->secret == null ) {
522
- $msg[ ] = 'Token secret';
523
- }
524
- if ( $consumer->key == null ) {
525
-
526
- $msg[ ] = 'Consumer key';
527
- }
528
- if ( $consumer->secret == null ) {
529
-
530
- $msg[ ] = 'Consumer secret';
531
- }
532
- if ( $this->http_url == null ) {
533
-
534
- $msg[ ] = 'Endpoint';
535
- }
536
- if ( $this->http_method == null ) {
537
-
538
- $msg[ ] = 'HTTP method';
539
- }
540
- if ( count( $msg ) ) {
541
- throw new OAuthException( 'Enter valid ' . implode( ',', $msg ) );
542
- }
543
- $this->set_parameter(
544
- "oauth_signature_method",
545
- $signature_method->get_name(),
546
- false );
547
-
548
- $signature = $this->build_signature( $signature_method, $consumer, $token );
549
- $this->set_parameter( "oauth_signature", $signature, false );
550
-
551
- }
552
-
553
- public function build_signature( $signature_method, $consumer, $token )
554
- {
555
- $signature = $signature_method->build_signature( $this, $consumer, $token );
556
-
557
- return $signature;
558
- }
559
-
560
- /**
561
- * util function: current timestamp
562
- */
563
- private static function generate_timestamp()
564
- {
565
- return time();
566
- }
567
-
568
- /**
569
- * util function: current nonce
570
- */
571
- private static function generate_nonce()
572
- {
573
- $mt = microtime();
574
- $rand = mt_rand();
575
-
576
- return md5( $mt . $rand ); // md5s look nicer than numbers
577
- }
578
- }
579
- }
580
-
581
- if ( !class_exists( 'OAuthServer' ) ) {
582
- class OAuthServer
583
- {
584
- protected $timestamp_threshold = 300; // in seconds, five minutes
585
- protected $version = '1.0'; // hi blaine
586
- protected $signature_methods = array();
587
-
588
- protected $data_store;
589
-
590
- function __construct( $data_store )
591
- {
592
- $this->data_store = $data_store;
593
- }
594
-
595
- public function add_signature_method( $signature_method )
596
- {
597
- $this->signature_methods[ $signature_method->get_name() ] =
598
- $signature_method;
599
- }
600
-
601
- // high level functions
602
-
603
- /**
604
- * process a request_token request
605
- * returns the request token on success
606
- */
607
- public function fetch_request_token( &$request )
608
- {
609
- $this->get_version( $request );
610
-
611
- $consumer = $this->get_consumer( $request );
612
-
613
- // no token required for the initial token request
614
- $token = null;
615
-
616
- $this->check_signature( $request, $consumer, $token );
617
-
618
- // Rev A change
619
- $callback = $request->get_parameter( 'oauth_callback' );
620
- $new_token = $this->data_store->new_request_token( $consumer, $callback );
621
-
622
- return $new_token;
623
- }
624
-
625
- /**
626
- * process an access_token request
627
- * returns the access token on success
628
- */
629
- public function fetch_access_token( &$request )
630
- {
631
- $this->get_version( $request );
632
-
633
- $consumer = $this->get_consumer( $request );
634
-
635
- // requires authorized request token
636
- $token = $this->get_token( $request, $consumer, "request" );
637
-
638
- $this->check_signature( $request, $consumer, $token );
639
-
640
- // Rev A change
641
- $verifier = $request->get_parameter( 'oauth_verifier' );
642
- $new_token = $this->data_store->new_access_token( $token, $consumer, $verifier );
643
-
644
- return $new_token;
645
- }
646
-
647
- /**
648
- * verify an api call, checks all the parameters
649
- */
650
- public function verify_request( &$request )
651
- {
652
- $this->get_version( $request );
653
- $consumer = $this->get_consumer( $request );
654
- $token = $this->get_token( $request, $consumer, "access" );
655
- $this->check_signature( $request, $consumer, $token );
656
-
657
- return array( $consumer, $token );
658
- }
659
-
660
- // Internals from here
661
- /**
662
- * version 1
663
- */
664
- private function get_version( &$request )
665
- {
666
- $version = $request->get_parameter( "oauth_version" );
667
- if ( !$version ) {
668
- // Service Providers MUST assume the protocol version to be 1.0 if this parameter is not present.
669
- // Chapter 7.0 ("Accessing Protected Ressources")
670
- $version = '1.0';
671
- }
672
- if ( $version !== $this->version ) {
673
- throw new OAuthException( "OAuth version '$version' not supported" );
674
- }
675
-
676
- return $version;
677
- }
678
-
679
- /**
680
- * figure out the signature with some defaults
681
- */
682
- private function get_signature_method( $request )
683
- {
684
- $signature_method = $request instanceof OAuthRequest
685
- ? $request->get_parameter( "oauth_signature_method" )
686
- : null;
687
-
688
- if ( !$signature_method ) {
689
- // According to chapter 7 ("Accessing Protected Ressources") the signature-method
690
- // parameter is required, and we can't just fallback to PLAINTEXT
691
- throw new OAuthException( 'No signature method parameter. This parameter is required' );
692
- }
693
-
694
- if ( !in_array( $signature_method,
695
- array_keys( $this->signature_methods ) )
696
- ) {
697
- throw new OAuthException(
698
- "Signature method '$signature_method' not supported " .
699
- "try one of the following: " .
700
- implode( ", ", array_keys( $this->signature_methods ) )
701
- );
702
- }
703
-
704
- return $this->signature_methods[ $signature_method ];
705
- }
706
-
707
- /**
708
- * try to find the consumer for the provided request's consumer key
709
- */
710
- private function get_consumer( $request )
711
- {
712
- $consumer_key = $request instanceof OAuthRequest
713
- ? $request->get_parameter( "oauth_consumer_key" )
714
- : null;
715
-
716
- if ( !$consumer_key ) {
717
- throw new OAuthException( "Invalid consumer key" );
718
- }
719
-
720
- $consumer = $this->data_store->lookup_consumer( $consumer_key );
721
- if ( !$consumer ) {
722
- throw new OAuthException( "Invalid consumer" );
723
- }
724
-
725
- return $consumer;
726
- }
727
-
728
- /**
729
- * try to find the token for the provided request's token key
730
- */
731
- private function get_token( $request, $consumer, $token_type = "access" )
732
- {
733
- $token_field = $request instanceof OAuthRequest
734
- ? $request->get_parameter( 'oauth_token' )
735
- : null;
736
-
737
- $token = $this->data_store->lookup_token(
738
- $consumer, $token_type, $token_field
739
- );
740
- if ( !$token ) {
741
- throw new OAuthException( "Invalid $token_type token: $token_field" );
742
- }
743
-
744
- return $token;
745
- }
746
-
747
- /**
748
- * all-in-one function to check the signature on a request
749
- * should guess the signature method appropriately
750
- */
751
- private function check_signature( $request, $consumer, $token )
752
- {
753
- // this should probably be in a different method
754
- $timestamp = $request instanceof OAuthRequest
755
- ? $request->get_parameter( 'oauth_timestamp' )
756
- : null;
757
- $nonce = $request instanceof OAuthRequest
758
- ? $request->get_parameter( 'oauth_nonce' )
759
- : null;
760
-
761
- $this->check_timestamp( $timestamp );
762
- $this->check_nonce( $consumer, $token, $nonce, $timestamp );
763
-
764
- $signature_method = $this->get_signature_method( $request );
765
-
766
- $signature = $request->get_parameter( 'oauth_signature' );
767
- $valid_sig = $signature_method->check_signature(
768
- $request,
769
- $consumer,
770
- $token,
771
- $signature
772
- );
773
-
774
- if ( !$valid_sig ) {
775
- throw new OAuthException( "Invalid signature" );
776
- }
777
- }
778
-
779
- /**
780
- * check that the timestamp is new enough
781
- */
782
- private function check_timestamp( $timestamp )
783
- {
784
- if ( !$timestamp )
785
- throw new OAuthException(
786
- 'Missing timestamp parameter. The parameter is required'
787
- );
788
-
789
- // verify that timestamp is recentish
790
- $now = time();
791
- if ( abs( $now - $timestamp ) > $this->timestamp_threshold ) {
792
- throw new OAuthException(
793
- "Expired timestamp, yours $timestamp, ours $now"
794
- );
795
- }
796
- }
797
-
798
- /**
799
- * check that the nonce is not repeated
800
- */
801
- private function check_nonce( $consumer, $token, $nonce, $timestamp )
802
- {
803
- if ( !$nonce )
804
- throw new OAuthException(
805
- 'Missing nonce parameter. The parameter is required'
806
- );
807
-
808
- // verify that the nonce is uniqueish
809
- $found = $this->data_store->lookup_nonce(
810
- $consumer,
811
- $token,
812
- $nonce,
813
- $timestamp
814
- );
815
- if ( $found ) {
816
- throw new OAuthException( "Nonce already used: $nonce" );
817
- }
818
- }
819
-
820
- }
821
- }
822
-
823
- // if ( !class_exists( 'OAuthDataStore' ) ) { // If you experience clashes with other OAuthDataStore classes, uncommenting this line and the closing curly brace
824
- // at the end of the class declaration MAY help you.
825
- class OAuthDataStore
826
- {
827
- function lookup_consumer( $consumer_key )
828
- {
829
- // implement me
830
- }
831
-
832
- function lookup_token( $consumer, $token_type, $token )
833
- {
834
- // implement me
835
- }
836
-
837
- function lookup_nonce( $consumer, $token, $nonce, $timestamp )
838
- {
839
- // implement me
840
- }
841
-
842
- function new_request_token( $consumer, $callback = null )
843
- {
844
- // return a new token attached to this consumer
845
- }
846
-
847
- function new_access_token( $token, $consumer, $verifier = null )
848
- {
849
- // return a new access token attached to this consumer
850
- // for the user associated with this token if the request token
851
- // is authorized
852
- // should also invalidate the request token
853
- }
854
-
855
- }
856
- // } // This is the curly brace to uncomment
857
-
858
- if ( !class_exists( 'OAuthUtil' ) ) {
859
- class OAuthUtil
860
- {
861
- public static function urlencode_rfc3986( $input )
862
- {
863
- if ( is_array( $input ) ) {
864
- return array_map( array( 'OAuthUtil', 'urlencode_rfc3986' ), $input );
865
- } else if ( is_scalar( $input ) ) {
866
- $tmp1 = str_replace( '%7E', '~', rawurlencode( $input ) );
867
- $tmp2 = str_replace( ".", "%2E", $tmp1 );
868
- $tmp3 = str_replace( "*", "%2A", $tmp2 );
869
- $tmp4 = str_replace( '+', ' ', $tmp3 );
870
- $tmp = str_replace( "-", "%2D", $tmp4 );
871
-
872
- return $tmp;
873
- /*$tmp1=str_replace('%7E', '~', rawurlencode($input));
874
- $tmp2= str_replace(".","%2E",$tmp1);
875
-
876
-
877
- return $tmp;*/
878
- } else {
879
- return '';
880
- }
881
- }
882
-
883
- public static function parseQueryString( $str )
884
- {
885
- $op = array();
886
- $pairs = explode( "&", $str );
887
- foreach ( $pairs as $pair ) {
888
- list( $k, $v ) = array_map( "urldecode", explode( "=", $pair ) );
889
- $op[ $k ] = $v;
890
- }
891
-
892
- return $op;
893
- }
894
-
895
- //parses string to associative array -modified for PayPal Signature
896
-
897
-
898
- // This decode function isn't taking into consideration the above
899
- // modifications to the encoding process. However, this method doesn't
900
- // seem to be used anywhere so leaving it as is.
901
- public static function urldecode_rfc3986( $string )
902
- {
903
- return urldecode( $string );
904
- }
905
-
906
- // Utility function for turning the Authorization: header into
907
- // parameters, has to do some unescaping
908
- // Can filter out any non-oauth parameters if needed (default behaviour)
909
- // May 28th, 2010 - method updated to tjerk.meesters for a speed improvement.
910
- // see http://code.google.com/p/oauth/issues/detail?id=163
911
- public static function split_header( $header, $only_allow_oauth_parameters = true )
912
- {
913
- $params = array();
914
- if ( preg_match_all( '/(' . ( $only_allow_oauth_parameters ? 'oauth_' : '' ) . '[a-z_-]*)=(:?"([^"]*)"|([^,]*))/', $header, $matches ) ) {
915
- foreach ( $matches[ 1 ] as $i => $h ) {
916
- $params[ $h ] = OAuthUtil::urldecode_rfc3986( empty( $matches[ 3 ][ $i ] ) ? $matches[ 4 ][ $i ] : $matches[ 3 ][ $i ] );
917
- }
918
- if ( isset( $params[ 'realm' ] ) ) {
919
- unset( $params[ 'realm' ] );
920
- }
921
- }
922
-
923
- return $params;
924
- }
925
-
926
- // helper to try to sort out headers for people who aren't running apache
927
- public static function get_headers()
928
- {
929
- if ( function_exists( 'apache_request_headers' ) ) {
930
- // we need this to get the actual Authorization: header
931
- // because apache tends to tell us it doesn't exist
932
- $headers = apache_request_headers();
933
-
934
- // sanitize the output of apache_request_headers because
935
- // we always want the keys to be Cased-Like-This and arh()
936
- // returns the headers in the same case as they are in the
937
- // request
938
- $out = array();
939
- foreach ( $headers AS $key => $value ) {
940
- $key = str_replace(
941
- " ",
942
- "-",
943
- ucwords( strtolower( str_replace( "-", " ", $key ) ) )
944
- );
945
- $out[ $key ] = $value;
946
- }
947
- } else {
948
- // otherwise we don't have apache and are just going to have to hope
949
- // that $_SERVER actually contains what we need
950
- $out = array();
951
- if ( isset( $_SERVER[ 'CONTENT_TYPE' ] ) )
952
- $out[ 'Content-Type' ] = $_SERVER[ 'CONTENT_TYPE' ];
953
- if ( isset( $_ENV[ 'CONTENT_TYPE' ] ) )
954
- $out[ 'Content-Type' ] = $_ENV[ 'CONTENT_TYPE' ];
955
-
956
- foreach ( $_SERVER as $key => $value ) {
957
- if ( substr( $key, 0, 5 ) == "HTTP_" ) {
958
- // this is chaos, basically it is just there to capitalize the first
959
- // letter of every word that is not an initial HTTP and strip HTTP
960
- // code from przemek
961
- $key = str_replace(
962
- " ",
963
- "-",
964
- ucwords( strtolower( str_replace( "_", " ", substr( $key, 5 ) ) ) )
965
- );
966
- $out[ $key ] = $value;
967
- }
968
- }
969
- }
970
-
971
- return $out;
972
- }
973
-
974
- // This function takes a input like a=b&a=c&d=e and returns the parsed
975
- // parameters like this
976
- // array('a' => array('b','c'), 'd' => 'e')
977
- public static function parse_parameters( $input )
978
- {
979
- if ( !isset( $input ) || !$input ) return array();
980
-
981
- $pairs = explode( '&', $input );
982
-
983
- $parsed_parameters = array();
984
- foreach ( $pairs as $pair ) {
985
- $split = explode( '=', $pair, 2 );
986
- $parameter = OAuthUtil::urldecode_rfc3986( $split[ 0 ] );
987
- $value = isset( $split[ 1 ] ) ? OAuthUtil::urldecode_rfc3986( $split[ 1 ] ) : '';
988
-
989
- if ( isset( $parsed_parameters[ $parameter ] ) ) {
990
- // We have already recieved parameter(s) with this name, so add to the list
991
- // of parameters with this name
992
-
993
- if ( is_scalar( $parsed_parameters[ $parameter ] ) ) {
994
- // This is the first duplicate, so transform scalar (string) into an array
995
- // so we can add the duplicates
996
- $parsed_parameters[ $parameter ] = array( $parsed_parameters[ $parameter ] );
997
- }
998
-
999
- $parsed_parameters[ $parameter ][ ] = $value;
1000
- } else {
1001
- $parsed_parameters[ $parameter ] = $value;
1002
- }
1003
- }
1004
-
1005
- return $parsed_parameters;
1006
- }
1007
-
1008
- public static function build_http_query( $params )
1009
- {
1010
- if ( !$params ) return '';
1011
-
1012
- // Urlencode both keys and values
1013
- $keys = OAuthUtil::urlencode_rfc3986( array_keys( $params ) );
1014
- $values = OAuthUtil::urlencode_rfc3986( array_values( $params ) );
1015
- $params = array_combine( $keys, $values );
1016
-
1017
- // Parameters are sorted by name, using lexicographical byte value ordering.
1018
- // Ref: Spec: 9.1.1 (1)
1019
- uksort( $params, 'strcmp' );
1020
-
1021
- $pairs = array();
1022
- foreach ( $params as $parameter => $value ) {
1023
- if ( is_array( $value ) ) {
1024
- // If two or more parameters share the same name, they are sorted by their value
1025
- // Ref: Spec: 9.1.1 (1)
1026
- // June 12th, 2010 - changed to sort because of issue 164 by hidetaka
1027
- sort( $value, SORT_STRING );
1028
- foreach ( $value as $duplicate_value ) {
1029
- $pairs[ ] = $parameter . '=' . $duplicate_value;
1030
- }
1031
- } else {
1032
- $pairs[ ] = $parameter . '=' . $value;
1033
- }
1034
- }
1035
-
1036
- // For each parameter, the name is separated from the corresponding value by an '=' character (ASCII code 61)
1037
- // Each name-value pair is separated by an '&' character (ASCII code 38)
1038
- return implode( '&', $pairs );
1039
- }
1040
- }
1041
- }
1042
- //PayPal specific modification starts
1043
- //Method to be called for generating signature
1044
- require_once( "AuthUtil.php" );
1045
- class AuthSignature
1046
- {
1047
-
1048
- public function genSign( $key, $secret, $token, $tokenSecret, $httpMethod, $endpoint )
1049
- {
1050
-
1051
-
1052
- $authServer = new OAuthServer( new MockOAuthDataStore() );
1053
- $hmac_method = new OAuthSignatureMethod_HMAC_SHA1();
1054
- $authServer->add_signature_method( $hmac_method );
1055
-
1056
- $sig_method = $hmac_method;
1057
- $authConsumer = new OAuthConsumer( $key, $secret, null );
1058
- $authToken = null;
1059
- $authToken = new OAuthToken( $token, $tokenSecret );
1060
-
1061
- //$params is the query param array which is required only in the httpMethod is "GET"
1062
-
1063
- $params = array();
1064
- //set the Query parameters to $params if httpMethod is "GET"
1065
-
1066
- $acc_req = OAuthRequest::from_consumer_and_token( $authConsumer, $authToken, $httpMethod, $endpoint, $params );
1067
-
1068
- $acc_req->sign_request( $sig_method, $authConsumer, $authToken );
1069
- $response = OAuthutil::parseQueryString( $acc_req );
1070
-
1071
- return $response;
1072
-
1073
- }
1074
- }
1075
-
1076
-
1077
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/classes/gateways/PayPal_AdvPayments/PayPal_AP/classes/adaptivepayments-sdk/lib/cacert.pem DELETED
@@ -1,171 +0,0 @@
1
- Verisign Class 3 Public Primary Certification Authority
2
- =======================================================
3
- -----BEGIN CERTIFICATE-----
4
- MIICPDCCAaUCEHC65B0Q2Sk0tjjKewPMur8wDQYJKoZIhvcNAQECBQAwXzELMAkGA1UEBhMCVVMx
5
- FzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMTcwNQYDVQQLEy5DbGFzcyAzIFB1YmxpYyBQcmltYXJ5
6
- IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MB4XDTk2MDEyOTAwMDAwMFoXDTI4MDgwMTIzNTk1OVow
7
- XzELMAkGA1UEBhMCVVMxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMTcwNQYDVQQLEy5DbGFzcyAz
8
- IFB1YmxpYyBQcmltYXJ5IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MIGfMA0GCSqGSIb3DQEBAQUA
9
- A4GNADCBiQKBgQDJXFme8huKARS0EN8EQNvjV69qRUCPhAwL0TPZ2RHP7gJYHyX3KqhEBarsAx94
10
- f56TuZoAqiN91qyFomNFx3InzPRMxnVx0jnvT0Lwdd8KkMaOIG+YD/isI19wKTakyYbnsZogy1Ol
11
- hec9vn2a/iRFM9x2Fe0PonFkTGUugWhFpwIDAQABMA0GCSqGSIb3DQEBAgUAA4GBALtMEivPLCYA
12
- TxQT3ab7/AoRhIzzKBxnki98tsX63/Dolbwdj2wsqFHMc9ikwFPwTtYmwHYBV4GSXiHx0bH/59Ah
13
- WM1pF+NEHJwZRDmJXNycAA9WjQKZ7aKQRUzkuxCkPfAyAw7xzvjoyVGM5mKf5p/AfbdynMk2Omuf
14
- Tqj/ZA1k
15
- -----END CERTIFICATE-----
16
-
17
- Verisign Class 3 Public Primary Certification Authority - G2
18
- ============================================================
19
- -----BEGIN CERTIFICATE-----
20
- MIIDAjCCAmsCEH3Z/gfPqB63EHln+6eJNMYwDQYJKoZIhvcNAQEFBQAwgcExCzAJBgNVBAYTAlVT
21
- MRcwFQYDVQQKEw5WZXJpU2lnbiwgSW5jLjE8MDoGA1UECxMzQ2xhc3MgMyBQdWJsaWMgUHJpbWFy
22
- eSBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eSAtIEcyMTowOAYDVQQLEzEoYykgMTk5OCBWZXJpU2ln
23
- biwgSW5jLiAtIEZvciBhdXRob3JpemVkIHVzZSBvbmx5MR8wHQYDVQQLExZWZXJpU2lnbiBUcnVz
24
- dCBOZXR3b3JrMB4XDTk4MDUxODAwMDAwMFoXDTI4MDgwMTIzNTk1OVowgcExCzAJBgNVBAYTAlVT
25
- MRcwFQYDVQQKEw5WZXJpU2lnbiwgSW5jLjE8MDoGA1UECxMzQ2xhc3MgMyBQdWJsaWMgUHJpbWFy
26
- eSBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eSAtIEcyMTowOAYDVQQLEzEoYykgMTk5OCBWZXJpU2ln
27
- biwgSW5jLiAtIEZvciBhdXRob3JpemVkIHVzZSBvbmx5MR8wHQYDVQQLExZWZXJpU2lnbiBUcnVz
28
- dCBOZXR3b3JrMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDMXtERXVxp0KvTuWpMmR9ZmDCO
29
- FoUgRm1HP9SFIIThbbP4pO0M8RcPO/mn+SXXwc+EY/J8Y8+iR/LGWzOOZEAEaMGAuWQcRXfH2G71
30
- lSk8UOg013gfqLptQ5GVj0VXXn7F+8qkBOvqlzdUMG+7AUcyM83cV5tkaWH4mx0ciU9cZwIDAQAB
31
- MA0GCSqGSIb3DQEBBQUAA4GBAFFNzb5cy5gZnBWyATl4Lk0PZ3BwmcYQWpSkU01UbSuvDV1Ai2TT
32
- 1+7eVmGSX6bEHRBhNtMsJzzoKQm5EWR0zLVznxxIqbxhAe7iF6YM40AIOw7n60RzKprxaZLvcRTD
33
- Oaxxp5EJb+RxBrO6WVcmeQD2+A2iMzAo1KpYoJ2daZH9
34
- -----END CERTIFICATE-----
35
-
36
-
37
- Verisign Class 3 Public Primary Certification Authority - G3
38
- ============================================================
39
- -----BEGIN CERTIFICATE-----
40
- MIIEGjCCAwICEQCbfgZJoz5iudXukEhxKe9XMA0GCSqGSIb3DQEBBQUAMIHKMQswCQYDVQQGEwJV
41
- UzEXMBUGA1UEChMOVmVyaVNpZ24sIEluYy4xHzAdBgNVBAsTFlZlcmlTaWduIFRydXN0IE5ldHdv
42
- cmsxOjA4BgNVBAsTMShjKSAxOTk5IFZlcmlTaWduLCBJbmMuIC0gRm9yIGF1dGhvcml6ZWQgdXNl
43
- IG9ubHkxRTBDBgNVBAMTPFZlcmlTaWduIENsYXNzIDMgUHVibGljIFByaW1hcnkgQ2VydGlmaWNh
44
- dGlvbiBBdXRob3JpdHkgLSBHMzAeFw05OTEwMDEwMDAwMDBaFw0zNjA3MTYyMzU5NTlaMIHKMQsw
45
- CQYDVQQGEwJVUzEXMBUGA1UEChMOVmVyaVNpZ24sIEluYy4xHzAdBgNVBAsTFlZlcmlTaWduIFRy
46
- dXN0IE5ldHdvcmsxOjA4BgNVBAsTMShjKSAxOTk5IFZlcmlTaWduLCBJbmMuIC0gRm9yIGF1dGhv
47
- cml6ZWQgdXNlIG9ubHkxRTBDBgNVBAMTPFZlcmlTaWduIENsYXNzIDMgUHVibGljIFByaW1hcnkg
48
- Q2VydGlmaWNhdGlvbiBBdXRob3JpdHkgLSBHMzCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoC
49
- ggEBAMu6nFL8eB8aHm8bN3O9+MlrlBIwT/A2R/XQkQr1F8ilYcEWQE37imGQ5XYgwREGfassbqb1
50
- EUGO+i2tKmFZpGcmTNDovFJbcCAEWNF6yaRpvIMXZK0Fi7zQWM6NjPXr8EJJC52XJ2cybuGukxUc
51
- cLwgTS8Y3pKI6GyFVxEa6X7jJhFUokWWVYPKMIno3Nij7SqAP395ZVc+FSBmCC+Vk7+qRy+oRpfw
52
- EuL+wgorUeZ25rdGt+INpsyow0xZVYnm6FNcHOqd8GIWC6fJXwzw3sJ2zq/3avL6QaaiMxTJ5Xpj
53
- 055iN9WFZZ4O5lMkdBteHRJTW8cs54NJOxWuimi5V5cCAwEAATANBgkqhkiG9w0BAQUFAAOCAQEA
54
- ERSWwauSCPc/L8my/uRan2Te2yFPhpk0djZX3dAVL8WtfxUfN2JzPtTnX84XA9s1+ivbrmAJXx5f
55
- j267Cz3qWhMeDGBvtcC1IyIuBwvLqXTLR7sdwdela8wv0kL9Sd2nic9TutoAWii/gt/4uhMdUIaC
56
- /Y4wjylGsB49Ndo4YhYYSq3mtlFs3q9i6wHQHiT+eo8SGhJouPtmmRQURVyu565pF4ErWjfJXir0
57
- xuKhXFSbplQAz/DxwceYMBo7Nhbbo27q/a2ywtrvAkcTisDxszGtTxzhT5yvDwyd93gN2PQ1VoDa
58
- t20Xj50egWTh/sVFuq1ruQp6Tk9LhO5L8X3dEQ==
59
- -----END CERTIFICATE-----
60
-
61
- Verisign Class 4 Public Primary Certification Authority - G3
62
- ============================================================
63
- -----BEGIN CERTIFICATE-----
64
- MIIEGjCCAwICEQDsoKeLbnVqAc/EfMwvlF7XMA0GCSqGSIb3DQEBBQUAMIHKMQswCQYDVQQGEwJV
65
- UzEXMBUGA1UEChMOVmVyaVNpZ24sIEluYy4xHzAdBgNVBAsTFlZlcmlTaWduIFRydXN0IE5ldHdv
66
- cmsxOjA4BgNVBAsTMShjKSAxOTk5IFZlcmlTaWduLCBJbmMuIC0gRm9yIGF1dGhvcml6ZWQgdXNl
67
- IG9ubHkxRTBDBgNVBAMTPFZlcmlTaWduIENsYXNzIDQgUHVibGljIFByaW1hcnkgQ2VydGlmaWNh
68
- dGlvbiBBdXRob3JpdHkgLSBHMzAeFw05OTEwMDEwMDAwMDBaFw0zNjA3MTYyMzU5NTlaMIHKMQsw
69
- CQYDVQQGEwJVUzEXMBUGA1UEChMOVmVyaVNpZ24sIEluYy4xHzAdBgNVBAsTFlZlcmlTaWduIFRy
70
- dXN0IE5ldHdvcmsxOjA4BgNVBAsTMShjKSAxOTk5IFZlcmlTaWduLCBJbmMuIC0gRm9yIGF1dGhv
71
- cml6ZWQgdXNlIG9ubHkxRTBDBgNVBAMTPFZlcmlTaWduIENsYXNzIDQgUHVibGljIFByaW1hcnkg
72
- Q2VydGlmaWNhdGlvbiBBdXRob3JpdHkgLSBHMzCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoC
73
- ggEBAK3LpRFpxlmr8Y+1GQ9Wzsy1HyDkniYlS+BzZYlZ3tCD5PUPtbut8XzoIfzk6AzufEUiGXaS
74
- tBO3IFsJ+mGuqPKljYXCKtbeZjbSmwL0qJJgfJxptI8kHtCGUvYynEFYHiK9zUVilQhu0GbdU6LM
75
- 8BDcVHOLBKFGMzNcF0C5nk3T875Vg+ixiY5afJqWIpA7iCXy0lOIAgwLePLmNxdLMEYH5IBtptiW
76
- Lugs+BGzOA1mppvqySNb247i8xOOGlktqgLw7KSHZtzBP/XYufTsgsbSPZUd5cBPhMnZo0QoBmrX
77
- Razwa2rvTl/4EYIeOGM0ZlDUPpNz+jDDZq3/ky2X7wMCAwEAATANBgkqhkiG9w0BAQUFAAOCAQEA
78
- j/ola09b5KROJ1WrIhVZPMq1CtRK26vdoV9TxaBXOcLORyu+OshWv8LZJxA6sQU8wHcxuzrTBXtt
79
- mhwwjIDLk5Mqg6sFUYICABFna/OIYUdfA5PVWw3g8dShMjWFsjrbsIKr0csKvE+MW8VLADsfKoKm
80
- fjaF3H48ZwC15DtS4KjrXRX5xm3wrR0OhbepmnMUWluPQSjA1egtTaRezarZ7c7c2NU8Qh0XwRJd
81
- RTjDOPP8hS6DRkiy1yBfkjaP53kPmF6Z6PDQpLv1U70qzlmwr25/bLvSHgCwIe34QWKCudiyxLtG
82
- UPMxxY8BqHTr9Xgn2uf3ZkPznoM+IKrDNWCRzg==
83
- -----END CERTIFICATE-----
84
- VeriSign Class 3 Public Primary Certification Authority - G5
85
- ============================================================
86
- -----BEGIN CERTIFICATE-----
87
- MIIE0zCCA7ugAwIBAgIQGNrRniZ96LtKIVjNzGs7SjANBgkqhkiG9w0BAQUFADCByjELMAkGA1UE
88
- BhMCVVMxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMR8wHQYDVQQLExZWZXJpU2lnbiBUcnVzdCBO
89
- ZXR3b3JrMTowOAYDVQQLEzEoYykgMjAwNiBWZXJpU2lnbiwgSW5jLiAtIEZvciBhdXRob3JpemVk
90
- IHVzZSBvbmx5MUUwQwYDVQQDEzxWZXJpU2lnbiBDbGFzcyAzIFB1YmxpYyBQcmltYXJ5IENlcnRp
91
- ZmljYXRpb24gQXV0aG9yaXR5IC0gRzUwHhcNMDYxMTA4MDAwMDAwWhcNMzYwNzE2MjM1OTU5WjCB
92
- yjELMAkGA1UEBhMCVVMxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMR8wHQYDVQQLExZWZXJpU2ln
93
- biBUcnVzdCBOZXR3b3JrMTowOAYDVQQLEzEoYykgMjAwNiBWZXJpU2lnbiwgSW5jLiAtIEZvciBh
94
- dXRob3JpemVkIHVzZSBvbmx5MUUwQwYDVQQDEzxWZXJpU2lnbiBDbGFzcyAzIFB1YmxpYyBQcmlt
95
- YXJ5IENlcnRpZmljYXRpb24gQXV0aG9yaXR5IC0gRzUwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAw
96
- ggEKAoIBAQCvJAgIKXo1nmAMqudLO07cfLw8RRy7K+D+KQL5VwijZIUVJ/XxrcgxiV0i6CqqpkKz
97
- j/i5Vbext0uz/o9+B1fs70PbZmIVYc9gDaTY3vjgw2IIPVQT60nKWVSFJuUrjxuf6/WhkcIzSdhD
98
- Y2pSS9KP6HBRTdGJaXvHcPaz3BJ023tdS1bTlr8Vd6Gw9KIl8q8ckmcY5fQGBO+QueQA5N06tRn/
99
- Arr0PO7gi+s3i+z016zy9vA9r911kTMZHRxAy3QkGSGT2RT+rCpSx4/VBEnkjWNHiDxpg8v+R70r
100
- fk/Fla4OndTRQ8Bnc+MUCH7lP59zuDMKz10/NIeWiu5T6CUVAgMBAAGjgbIwga8wDwYDVR0TAQH/
101
- BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwbQYIKwYBBQUHAQwEYTBfoV2gWzBZMFcwVRYJaW1hZ2Uv
102
- Z2lmMCEwHzAHBgUrDgMCGgQUj+XTGoasjY5rw8+AatRIGCx7GS4wJRYjaHR0cDovL2xvZ28udmVy
103
- aXNpZ24uY29tL3ZzbG9nby5naWYwHQYDVR0OBBYEFH/TZafC3ey78DAJ80M5+gKvMzEzMA0GCSqG
104
- SIb3DQEBBQUAA4IBAQCTJEowX2LP2BqYLz3q3JktvXf2pXkiOOzEp6B4Eq1iDkVwZMXnl2YtmAl+
105
- X6/WzChl8gGqCBpH3vn5fJJaCGkgDdk+bW48DW7Y5gaRQBi5+MHt39tBquCWIMnNZBU4gcmU7qKE
106
- KQsTb47bDN0lAtukixlE0kF6BWlKWE9gyn6CagsCqiUXObXbf+eEZSqVir2G3l6BFoMtEMze/aiC
107
- Km0oHw0LxOXnGiYZ4fQRbxC1lfznQgUy286dUV4otp6F01vvpX1FQHKOtw5rDgb7MzVIcbidJ4vE
108
- ZV8NhnacRHr2lVz2XTIIM6RUthg/aFzyQkqFOFSDX9HoLPKsEdao7WNq
109
- -----END CERTIFICATE-----
110
- VeriSign Universal Root Certification Authority
111
- ===============================================
112
- -----BEGIN CERTIFICATE-----
113
- MIIEuTCCA6GgAwIBAgIQQBrEZCGzEyEDDrvkEhrFHTANBgkqhkiG9w0BAQsFADCBvTELMAkGA1UE
114
- BhMCVVMxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMR8wHQYDVQQLExZWZXJpU2lnbiBUcnVzdCBO
115
- ZXR3b3JrMTowOAYDVQQLEzEoYykgMjAwOCBWZXJpU2lnbiwgSW5jLiAtIEZvciBhdXRob3JpemVk
116
- IHVzZSBvbmx5MTgwNgYDVQQDEy9WZXJpU2lnbiBVbml2ZXJzYWwgUm9vdCBDZXJ0aWZpY2F0aW9u
117
- IEF1dGhvcml0eTAeFw0wODA0MDIwMDAwMDBaFw0zNzEyMDEyMzU5NTlaMIG9MQswCQYDVQQGEwJV
118
- UzEXMBUGA1UEChMOVmVyaVNpZ24sIEluYy4xHzAdBgNVBAsTFlZlcmlTaWduIFRydXN0IE5ldHdv
119
- cmsxOjA4BgNVBAsTMShjKSAyMDA4IFZlcmlTaWduLCBJbmMuIC0gRm9yIGF1dGhvcml6ZWQgdXNl
120
- IG9ubHkxODA2BgNVBAMTL1ZlcmlTaWduIFVuaXZlcnNhbCBSb290IENlcnRpZmljYXRpb24gQXV0
121
- aG9yaXR5MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAx2E3XrEBNNti1xWb/1hajCMj
122
- 1mCOkdeQmIN65lgZOIzF9uVkhbSicfvtvbnazU0AtMgtc6XHaXGVHzk8skQHnOgO+k1KxCHfKWGP
123
- MiJhgsWHH26MfF8WIFFE0XBPV+rjHOPMee5Y2A7Cs0WTwCznmhcrewA3ekEzeOEz4vMQGn+HLL72
124
- 9fdC4uW/h2KJXwBL38Xd5HVEMkE6HnFuacsLdUYI0crSK5XQz/u5QGtkjFdN/BMReYTtXlT2NJ8I
125
- AfMQJQYXStrxHXpma5hgZqTZ79IugvHw7wnqRMkVauIDbjPTrJ9VAMf2CGqUuV/c4DPxhGD5WycR
126
- tPwW8rtWaoAljQIDAQABo4GyMIGvMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMG0G
127
- CCsGAQUFBwEMBGEwX6FdoFswWTBXMFUWCWltYWdlL2dpZjAhMB8wBwYFKw4DAhoEFI/l0xqGrI2O
128
- a8PPgGrUSBgsexkuMCUWI2h0dHA6Ly9sb2dvLnZlcmlzaWduLmNvbS92c2xvZ28uZ2lmMB0GA1Ud
129
- DgQWBBS2d/ppSEefUxLVwuoHMnYH0ZcHGTANBgkqhkiG9w0BAQsFAAOCAQEASvj4sAPmLGd75JR3
130
- Y8xuTPl9Dg3cyLk1uXBPY/ok+myDjEedO2Pzmvl2MpWRsXe8rJq+seQxIcaBlVZaDrHC1LGmWazx
131
- Y8u4TB1ZkErvkBYoH1quEPuBUDgMbMzxPcP1Y+Oz4yHJJDnp/RVmRvQbEdBNc6N9Rvk97ahfYtTx
132
- P/jgdFcrGJ2BtMQo2pSXpXDrrB2+BxHw1dvd5Yzw1TKwg+ZX4o+/vqGqvz0dtdQ46tewXDpPaj+P
133
- wGZsY6rp2aQW9IHRlRQOfc2VNNnSj3BzgXucfr2YYdhFh5iQxeuGMMY1v/D/w1WIg0vvBZIGcfK4
134
- mJO37M2CYfE45k+XmCpajQ==
135
- -----END CERTIFICATE-----
136
-
137
- VeriSign Class 3 Public Primary Certification Authority - G4
138
- ============================================================
139
- -----BEGIN CERTIFICATE-----
140
- MIIDhDCCAwqgAwIBAgIQL4D+I4wOIg9IZxIokYesszAKBggqhkjOPQQDAzCByjELMAkGA1UEBhMC
141
- VVMxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMR8wHQYDVQQLExZWZXJpU2lnbiBUcnVzdCBOZXR3
142
- b3JrMTowOAYDVQQLEzEoYykgMjAwNyBWZXJpU2lnbiwgSW5jLiAtIEZvciBhdXRob3JpemVkIHVz
143
- ZSBvbmx5MUUwQwYDVQQDEzxWZXJpU2lnbiBDbGFzcyAzIFB1YmxpYyBQcmltYXJ5IENlcnRpZmlj
144
- YXRpb24gQXV0aG9yaXR5IC0gRzQwHhcNMDcxMTA1MDAwMDAwWhcNMzgwMTE4MjM1OTU5WjCByjEL
145
- MAkGA1UEBhMCVVMxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMR8wHQYDVQQLExZWZXJpU2lnbiBU
146
- cnVzdCBOZXR3b3JrMTowOAYDVQQLEzEoYykgMjAwNyBWZXJpU2lnbiwgSW5jLiAtIEZvciBhdXRo
147
- b3JpemVkIHVzZSBvbmx5MUUwQwYDVQQDEzxWZXJpU2lnbiBDbGFzcyAzIFB1YmxpYyBQcmltYXJ5
148
- IENlcnRpZmljYXRpb24gQXV0aG9yaXR5IC0gRzQwdjAQBgcqhkjOPQIBBgUrgQQAIgNiAASnVnp8
149
- Utpkmw4tXNherJI9/gHmGUo9FANL+mAnINmDiWn6VMaaGF5VKmTeBvaNSjutEDxlPZCIBIngMGGz
150
- rl0Bp3vefLK+ymVhAIau2o970ImtTR1ZmkGxvEeA3J5iw/mjgbIwga8wDwYDVR0TAQH/BAUwAwEB
151
- /zAOBgNVHQ8BAf8EBAMCAQYwbQYIKwYBBQUHAQwEYTBfoV2gWzBZMFcwVRYJaW1hZ2UvZ2lmMCEw
152
- HzAHBgUrDgMCGgQUj+XTGoasjY5rw8+AatRIGCx7GS4wJRYjaHR0cDovL2xvZ28udmVyaXNpZ24u
153
- Y29tL3ZzbG9nby5naWYwHQYDVR0OBBYEFLMWkf3upm7ktS5Jj4d4gYDs5bG1MAoGCCqGSM49BAMD
154
- A2gAMGUCMGYhDBgmYFo4e1ZC4Kf8NoRRkSAsdk1DPcQdhCPQrNZ8NQbOzWm9kA3bbEhCHQ6qQgIx
155
- AJw9SDkjOVgaFRJZap7v1VmyHVIsmXHNxynfGyphe3HR3vPA5Q06Sqotp9iGKt0uEA==
156
- -----END CERTIFICATE-----
157
- Verisign Class 3 Public Primary Certification Authority
158
- =======================================================
159
- -----BEGIN CERTIFICATE-----
160
- MIICPDCCAaUCEDyRMcsf9tAbDpq40ES/Er4wDQYJKoZIhvcNAQEFBQAwXzELMAkGA1UEBhMCVVMx
161
- FzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMTcwNQYDVQQLEy5DbGFzcyAzIFB1YmxpYyBQcmltYXJ5
162
- IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MB4XDTk2MDEyOTAwMDAwMFoXDTI4MDgwMjIzNTk1OVow
163
- XzELMAkGA1UEBhMCVVMxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMTcwNQYDVQQLEy5DbGFzcyAz
164
- IFB1YmxpYyBQcmltYXJ5IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MIGfMA0GCSqGSIb3DQEBAQUA
165
- A4GNADCBiQKBgQDJXFme8huKARS0EN8EQNvjV69qRUCPhAwL0TPZ2RHP7gJYHyX3KqhEBarsAx94
166
- f56TuZoAqiN91qyFomNFx3InzPRMxnVx0jnvT0Lwdd8KkMaOIG+YD/isI19wKTakyYbnsZogy1Ol
167
- hec9vn2a/iRFM9x2Fe0PonFkTGUugWhFpwIDAQABMA0GCSqGSIb3DQEBBQUAA4GBABByUqkFFBky
168
- CEHwxWsKzH4PIRnN5GfcX6kb5sroc50i2JhucwNhkcV8sEVAbkSdjbCxlnRhLQ2pRdKkkirWmnWX
169
- bj9T/UWZYB2oK0z5XqcJ2HUw19JlYD1n1khVdWk/kfVIC0dpImmClr7JyDiGSnoscxlIaU5rfGW/
170
- D/xwzoiQ
171
- -----END CERTIFICATE-----
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/classes/gateways/PayPal_AdvPayments/PayPal_AP/classes/adaptivepayments-sdk/lib/exceptions/PPConfigurationException.php DELETED
@@ -1,9 +0,0 @@
1
- <?php
2
- class PPConfigurationException extends Exception
3
- {
4
-
5
- public function __construct( $message = null, $code = 0 )
6
- {
7
- parent::__construct( $message, $code );
8
- }
9
- }
 
 
 
 
 
 
 
 
 
trunk/classes/gateways/PayPal_AdvPayments/PayPal_AP/classes/adaptivepayments-sdk/lib/exceptions/PPConnectionException.php DELETED
@@ -1,20 +0,0 @@
1
- <?php
2
- class PPConnectionException extends Exception
3
- {
4
- /**
5
- * The url that was being connected to when the exception occured
6
- * @var string
7
- */
8
- private $url;
9
-
10
- public function __construct( $url, $message, $code = 0 )
11
- {
12
- parent::__construct( $message, $code );
13
- $this->url = $url;
14
- }
15
-
16
- public function getUrl()
17
- {
18
- return $this->url;
19
- }
20
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/classes/gateways/PayPal_AdvPayments/PayPal_AP/classes/adaptivepayments-sdk/lib/exceptions/PPInvalidCredentialException.php DELETED
@@ -1,22 +0,0 @@
1
- <?php
2
-
3
-
4
- class PPInvalidCredentialException extends Exception
5
- {
6
-
7
- public function __construct( $message = null, $code = 0 )
8
- {
9
- parent::__construct( $message, $code );
10
- }
11
-
12
- public function errorMessage()
13
- {
14
- $errorMsg = 'Error on line ' . $this->getLine() . ' in ' . $this->getFile()
15
- . ': <b>' . $this->getMessage() . '</b>';
16
-
17
- return $errorMsg;
18
- }
19
-
20
- }
21
-
22
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/classes/gateways/PayPal_AdvPayments/PayPal_AP/classes/adaptivepayments-sdk/lib/exceptions/PPMissingCredentialException.php DELETED
@@ -1,22 +0,0 @@
1
- <?php
2
-
3
-
4
- class PPMissingCredentialException extends Exception
5
- {
6
-
7
- public function __construct( $message = null, $code = 0 )
8
- {
9
- parent::__construct( $message, $code );
10
- }
11
-
12
- public function errorMessage()
13
- {
14
- $errorMsg = 'Error on line ' . $this->getLine() . ' in ' . $this->getFile()
15
- . ': <b>' . $this->getMessage() . '</b>';
16
-
17
- return $errorMsg;
18
- }
19
-
20
- }
21
-
22
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/classes/gateways/PayPal_AdvPayments/PayPal_AP/classes/adaptivepayments-sdk/lib/exceptions/PPTransformerException.php DELETED
@@ -1,20 +0,0 @@
1
- <?php
2
- class PPTransformerException extends Exception
3
- {
4
-
5
- public function __construct( $message = null, $code = 0 )
6
- {
7
- parent::__construct( $message, $code );
8
- }
9
-
10
- public function errorMessage()
11
- {
12
- $errorMsg = 'Error on line ' . $this->getLine() . ' in ' . $this->getFile()
13
- . ': <b>' . $this->getMessage() . '</b>';
14
-
15
- return $errorMsg;
16
- }
17
-
18
- }
19
-
20
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/classes/gateways/PayPal_AdvPayments/PayPal_AP/classes/adaptivepayments-sdk/lib/services/AdaptivePayments/AdaptivePayments.php DELETED
@@ -1,5797 +0,0 @@
1
- <?php
2
- /**
3
- * Stub objects for AdaptivePayments
4
- * Auto generated code
5
- *
6
- */
7
- require_once( 'PPUtils.php' );
8
- /**
9
- *
10
- */
11
- class AccountIdentifier
12
- {
13
-
14
- /**
15
- *
16
- * @access public
17
- * @var string
18
- */
19
- public $email;
20
-
21
- /**
22
- *
23
- * @access public
24
- * @var PhoneNumberType
25
- */
26
- public $phone;
27
-
28
-
29
- public function toNVPString( $prefix = '' )
30
- {
31
- $str = '';
32
- $delim = '';
33
- if ( $this->email != null ) {
34
- $str .= $delim . $prefix . 'email=' . urlencode( $this->email );
35
- $delim = '&';
36
- }
37
- if ( $this->phone != null ) {
38
- $newPrefix = $prefix . 'phone.';
39
- $str .= $delim . call_user_func( array( $this->phone, 'toNVPString' ), $newPrefix );
40
- $delim = '&';
41
- }
42
-
43
- return $str;
44
- }
45
-
46
- public function init( $map = null, $prefix = '' )
47
- {
48
- if ( $map != null ) {
49
- $mapKeyName = $prefix . 'email';
50
- if ( $map != null && array_key_exists( $mapKeyName, $map ) ) {
51
- $this->email = $map[ $mapKeyName ];
52
- }
53
- if ( PPUtils::array_match_key( $map, $prefix . "phone." ) ) {
54
- $newPrefix = $prefix . "phone.";
55
- $this->phone = new PhoneNumberType();
56
- $this->phone->init( $map, $newPrefix );
57
- }
58
-
59
- }
60
- }
61
- }
62
-
63
-
64
- /**
65
- *
66
- */
67
- class BaseAddress
68
- {
69
-
70
- /**
71
- *
72
- * @access public
73
- * @var string
74
- */
75
- public $line1;
76
-
77
- /**
78
- *
79
- * @access public
80
- * @var string
81
- */
82
- public $line2;
83
-
84
- /**
85
- *
86
- * @access public
87
- * @var string
88
- */
89
- public $city;
90
-
91
- /**
92
- *
93
- * @access public
94
- * @var string
95
- */
96
- public $state;
97
-
98
- /**
99
- *
100
- * @access public
101
- * @var string
102
- */
103
- public $postalCode;
104
-
105
- /**
106
- *
107
- * @access public
108
- * @var string
109
- */
110
- public $countryCode;
111
-
112
- /**
113
- *
114
- * @access public
115
- * @var string
116
- */
117
- public $type;
118
-
119
-
120
- public function init( $map = null, $prefix = '' )
121
- {
122
- if ( $map != null ) {
123
- $mapKeyName = $prefix . 'line1';
124
- if ( $map != null && array_key_exists( $mapKeyName, $map ) ) {
125
- $this->line1 = $map[ $mapKeyName ];
126
- }
127
- $mapKeyName = $prefix . 'line2';
128
- if ( $map != null && array_key_exists( $mapKeyName, $map ) ) {
129
- $this->line2 = $map[ $mapKeyName ];
130
- }
131
- $mapKeyName = $prefix . 'city';
132
- if ( $map != null && array_key_exists( $mapKeyName, $map ) ) {
133
- $this->city = $map[ $mapKeyName ];
134
- }
135
- $mapKeyName = $prefix . 'state';
136
- if ( $map != null && array_key_exists( $mapKeyName, $map ) ) {
137
- $this->state = $map[ $mapKeyName ];
138
- }
139
- $mapKeyName = $prefix . 'postalCode';
140
- if ( $map != null && array_key_exists( $mapKeyName, $map ) ) {
141
- $this->postalCode = $map[ $mapKeyName ];
142
- }
143
- $mapKeyName = $prefix . 'countryCode';
144
- if ( $map != null && array_key_exists( $mapKeyName, $map ) ) {
145
- $this->countryCode = $map[ $mapKeyName ];
146
- }
147
- $mapKeyName = $prefix . 'type';
148
- if ( $map != null && array_key_exists( $mapKeyName, $map ) ) {
149
- $this->type = $map[ $mapKeyName ];
150
- }
151
-
152
- }
153
- }
154
- }
155
-
156
-
157
- /**
158
- * Details about the end user of the application invoking this
159
- * service.
160
- */
161
- class ClientDetailsType
162
- {
163
-
164
- /**
165
- *
166
- * @access public
167
- * @var string
168
- */
169
- public $ipAddress;
170
-
171
- /**
172
- *
173
- * @access public
174
- * @var string
175
- */
176
- public $deviceId;
177
-
178
- /**
179
- *
180
- * @access public
181
- * @var string
182
- */
183
- public $applicationId;
184
-
185
- /**
186
- *
187
- * @access public
188
- * @var string
189
- */
190
- public $model;
191
-
192
- /**
193
- *
194
- * @access public
195
- * @var string
196
- */
197
- public $geoLocation;
198
-
199
- /**
200
- *
201
- * @access public
202
- * @var string
203
- */
204
- public $customerType;
205
-
206
- /**
207
- *
208
- * @access public
209
- * @var string
210
- */
211
- public $partnerName;
212
-
213
- /**
214
- *
215
- * @access public
216
- * @var string
217
- */
218
- public $customerId;
219
-
220
-
221
- public function toNVPString( $prefix = '' )
222
- {
223
- $str = '';
224
- $delim = '';
225
- if ( $this->ipAddress != null ) {
226
- $str .= $delim . $prefix . 'ipAddress=' . urlencode( $this->ipAddress );
227
- $delim = '&';
228
- }
229
- if ( $this->deviceId != null ) {
230
- $str .= $delim . $prefix . 'deviceId=' . urlencode( $this->deviceId );
231
- $delim = '&';
232
- }
233
- if ( $this->applicationId != null ) {
234
- $str .= $delim . $prefix . 'applicationId=' . urlencode( $this->applicationId );
235
- $delim = '&';
236
- }
237
- if ( $this->model != null ) {
238
- $str .= $delim . $prefix . 'model=' . urlencode( $this->model );
239
- $delim = '&';
240
- }
241
- if ( $this->geoLocation != null ) {
242
- $str .= $delim . $prefix . 'geoLocation=' . urlencode( $this->geoLocation );
243
- $delim = '&';
244
- }
245
- if ( $this->customerType != null ) {
246
- $str .= $delim . $prefix . 'customerType=' . urlencode( $this->customerType );
247
- $delim = '&';
248
- }
249
- if ( $this->partnerName != null ) {
250
- $str .= $delim . $prefix . 'partnerName=' . urlencode( $this->partnerName );
251
- $delim = '&';
252
- }
253
- if ( $this->customerId != null ) {
254
- $str .= $delim . $prefix . 'customerId=' . urlencode( $this->customerId );
255
- $delim = '&';
256
- }
257
-
258
- return $str;
259
- }
260
-
261
- }
262
-
263
-
264
- /**
265
- *
266
- */
267
- class CurrencyType
268
- {
269
-
270
- /**
271
- *
272
- * @access public
273
- * @var string
274
- */
275
- public $code;
276
-
277
- /**
278
- *
279
- * @access public
280
- * @var double
281
- */
282
- public $amount;
283
-
284
- /**
285
- * Constructor with arguments
286
- */
287
- public function __construct( $code = null, $amount = null )
288
- {
289
- $this->code = $code;
290
- $this->amount = $amount;
291
- }
292
-
293
-
294
- public function toNVPString( $prefix = '' )
295
- {
296
- $str = '';
297
- $delim = '';
298
- if ( $this->code != null ) {
299
- $str .= $delim . $prefix . 'code=' . urlencode( $this->code );
300
- $delim = '&';
301
- }
302
- if ( $this->amount != null ) {
303
- $str .= $delim . $prefix . 'amount=' . urlencode( $this->amount );
304
- $delim = '&';
305
- }
306
-
307
- return $str;
308
- }
309
-
310
- public function init( $map = null, $prefix = '' )
311
- {
312
- if ( $map != null ) {
313
- $mapKeyName = $prefix . 'code';
314
- if ( $map != null && array_key_exists( $mapKeyName, $map ) ) {
315
- $this->code = $map[ $mapKeyName ];
316
- }
317
- $mapKeyName = $prefix . 'amount';
318
- if ( $map != null && array_key_exists( $mapKeyName, $map ) ) {
319
- $this->amount = $map[ $mapKeyName ];
320
- }
321
-
322
- }
323
- }
324
- }
325
-
326
-
327
- /**
328
- * This type contains the detailed error information resulting
329
- * from the service operation.
330
- */
331
- class ErrorData
332
- {
333
-
334
- /**
335
- *
336
- * @access public
337
- * @var integer
338
- */
339
- public $errorId;
340
-
341
- /**
342
- *
343
- * @access public
344
- * @var string
345
- */
346
- public $domain;
347
-
348
- /**
349
- *
350
- * @access public
351
- * @var string
352
- */
353
- public $subdomain;
354
-
355
- /**
356
- *
357
- * @access public
358
- * @var ErrorSeverity
359
- */
360
- public $severity;
361
-
362
- /**
363
- *
364
- * @access public
365
- * @var ErrorCategory
366
- */
367
- public $category;
368
-
369
- /**
370
- *
371
- * @access public
372
- * @var string
373
- */
374
- public $message;
375
-
376
- /**
377
- *
378
- * @access public
379
- * @var string
380
- */
381
- public $exceptionId;
382
-
383
- /**
384
- *
385
- * @array
386
- * @access public
387
- * @var ErrorParameter
388
- */
389
- public $parameter;
390
-
391
-
392
- public function init( $map = null, $prefix = '' )
393
- {
394
- if ( $map != null ) {
395
- $mapKeyName = $prefix . 'errorId';
396
- if ( $map != null && array_key_exists( $mapKeyName, $map ) ) {
397
- $this->errorId = $map[ $mapKeyName ];
398
- }
399
- $mapKeyName = $prefix . 'domain';
400
- if ( $map != null && array_key_exists( $mapKeyName, $map ) ) {
401
- $this->domain = $map[ $mapKeyName ];
402
- }
403
- $mapKeyName = $prefix . 'subdomain';
404
- if ( $map != null && array_key_exists( $mapKeyName, $map ) ) {
405
- $this->subdomain = $map[ $mapKeyName ];
406
- }
407
- $mapKeyName = $prefix . 'severity';
408
- if ( $map != null && array_key_exists( $mapKeyName, $map ) ) {
409
- $this->severity = $map[ $mapKeyName ];
410
- }
411
- $mapKeyName = $prefix . 'category';
412
- if ( $map != null && array_key_exists( $mapKeyName, $map ) ) {
413
- $this->category = $map[ $mapKeyName ];
414
- }
415
- $mapKeyName = $prefix . 'message';
416
- if ( $map != null && array_key_exists( $mapKeyName, $map ) ) {
417
- $this->message = $map[ $mapKeyName ];
418
- }
419
- $mapKeyName = $prefix . 'exceptionId';
420
- if ( $map != null && array_key_exists( $mapKeyName, $map ) ) {
421
- $this->exceptionId = $map[ $mapKeyName ];
422
- }
423
- $i = 0;
424
- while ( true ) {
425
- if ( PPUtils::array_match_key( $map, $prefix . "parameter($i)" ) ) {
426
- $newPrefix = $prefix . "parameter($i).";
427
- $this->parameter[ $i ] = new ErrorParameter();
428
- $this->parameter[ $i ]->init( $map, $newPrefix );
429
- } else {
430
- break;
431
- }
432
- $i++;
433
- }
434
-
435
- }
436
- }
437
- }
438
-
439
-
440
- /**
441
- *
442
- */
443
- class ErrorParameter
444
- {
445
-
446
- /**
447
- *
448
- * @access public
449
- * @var string
450
- */
451
- public $name;
452
-
453
- /**
454
- *
455
- * @access public
456
- * @var string
457
- */
458
- public $value;
459
-
460
-
461
- public function init( $map = null, $prefix = '' )
462
- {
463
- if ( $map != null ) {
464
- $mapKeyName = $prefix . 'name';
465
- if ( $map != null && array_key_exists( $mapKeyName, $map ) ) {
466
- $this->name = $map[ $mapKeyName ];
467
- }
468
- $mapKeyName = $prefix . 'value';
469
- if ( $map != null && array_key_exists( $mapKeyName, $map ) ) {
470
- $this->value = $map[ $mapKeyName ];
471
- }
472
-
473
- }
474
- }
475
- }
476
-
477
-
478
- /**
479
- * This specifies a fault, encapsulating error data, with
480
- * specific error codes.
481
- */
482
- class FaultMessage
483
- {
484
-
485
- /**
486
- *
487
- * @access public
488
- * @var ResponseEnvelope
489
- */
490
- public $responseEnvelope;
491
-
492
- /**
493
- *
494
- * @array
495
- * @access public
496
- * @var ErrorData
497
- */
498
- public $error;
499
-
500
-
501
- public function init( $map = null, $prefix = '' )
502
- {
503
- if ( $map != null ) {
504
- if ( PPUtils::array_match_key( $map, $prefix . "responseEnvelope." ) ) {
505
- $newPrefix = $prefix . "responseEnvelope.";
506
- $this->responseEnvelope = new ResponseEnvelope();
507
- $this->responseEnvelope->init( $map, $newPrefix );
508
- }
509
- $i = 0;
510
- while ( true ) {
511
- if ( PPUtils::array_match_key( $map, $prefix . "error($i)" ) ) {
512
- $newPrefix = $prefix . "error($i).";
513
- $this->error[ $i ] = new ErrorData();
514
- $this->error[ $i ]->init( $map, $newPrefix );
515
- } else {
516
- break;
517
- }
518
- $i++;
519
- }
520
-
521
- }
522
- }
523
- }
524
-
525
-
526
- /**
527
- *
528
- */
529
- class PhoneNumberType
530
- {
531
-
532
- /**
533
- *
534
- * @access public
535
- * @var string
536
- */
537
- public $countryCode;
538
-
539
- /**
540
- *
541
- * @access public
542
- * @var string
543
- */
544
- public $phoneNumber;
545
-
546
- /**
547
- *
548
- * @access public
549
- * @var string
550
- */
551
- public $extension;
552
-
553
- /**
554
- * Constructor with arguments
555
- */
556
- public function __construct( $countryCode = null, $phoneNumber = null )
557
- {
558
- $this->countryCode = $countryCode;
559
- $this->phoneNumber = $phoneNumber;
560
- }
561
-
562
-
563
- public function toNVPString( $prefix = '' )
564
- {
565
- $str = '';
566
- $delim = '';
567
- if ( $this->countryCode != null ) {
568
- $str .= $delim . $prefix . 'countryCode=' . urlencode( $this->countryCode );
569
- $delim = '&';
570
- }
571
- if ( $this->phoneNumber != null ) {
572
- $str .= $delim . $prefix . 'phoneNumber=' . urlencode( $this->phoneNumber );
573
- $delim = '&';
574
- }
575
- if ( $this->extension != null ) {
576
- $str .= $delim . $prefix . 'extension=' . urlencode( $this->extension );
577
- $delim = '&';
578
- }
579
-
580
- return $str;
581
- }
582
-
583
- public function init( $map = null, $prefix = '' )
584
- {
585
- if ( $map != null ) {
586
- $mapKeyName = $prefix . 'countryCode';
587
- if ( $map != null && array_key_exists( $mapKeyName, $map ) ) {
588
- $this->countryCode = $map[ $mapKeyName ];
589
- }
590
- $mapKeyName = $prefix . 'phoneNumber';
591
- if ( $map != null && array_key_exists( $mapKeyName, $map ) ) {
592
- $this->phoneNumber = $map[ $mapKeyName ];
593
- }
594
- $mapKeyName = $prefix . 'extension';
595
- if ( $map != null && array_key_exists( $mapKeyName, $map ) ) {
596
- $this->extension = $map[ $mapKeyName ];
597
- }
598
-
599
- }
600
- }
601
- }
602
-
603
-
604
- /**
605
- * This specifies the list of parameters with every request to
606
- * the service.
607
- */
608
- class RequestEnvelope
609
- {
610
-
611
- /**
612
- * This specifies the required detail level that is needed by a
613
- * client application pertaining to a particular data component
614
- * (e.g., Item, Transaction, etc.). The detail level is
615
- * specified in the DetailLevelCodeType which has all the
616
- * enumerated values of the detail level for each component.
617
- * @access public
618
- * @var DetailLevelCode
619
- */
620
- public $detailLevel;
621
-
622
- /**
623
- * This should be the standard RFC 3066 language identification
624
- * tag, e.g., en_US.
625
- * @access public
626
- * @var string
627
- */
628
- public $errorLanguage;
629
-
630
- /**
631
- * Constructor with arguments
632
- */
633
- public function __construct( $errorLanguage = null )
634
- {
635
- $this->errorLanguage = $errorLanguage;
636
- }
637
-
638
-
639
- public function toNVPString( $prefix = '' )
640
- {
641
- $str = '';
642
- $delim = '';
643
- if ( $this->detailLevel != null ) {
644
- $str .= $delim . $prefix . 'detailLevel=' . urlencode( $this->detailLevel );
645
- $delim = '&';
646
- }
647
- if ( $this->errorLanguage != null ) {
648
- $str .= $delim . $prefix . 'errorLanguage=' . urlencode( $this->errorLanguage );
649
- $delim = '&';
650
- }
651
-
652
- return $str;
653
- }
654
-
655
- }
656
-
657
-
658
- /**
659
- * This specifies a list of parameters with every response from
660
- * a service.
661
- */
662
- class ResponseEnvelope
663
- {
664
-
665
- /**
666
- *
667
- * @access public
668
- * @var dateTime
669
- */
670
- public $timestamp;
671
-
672
- /**
673
- * Application level acknowledgment code.
674
- * @access public
675
- * @var AckCode
676
- */
677
- public $ack;
678
-
679
- /**
680
- *
681
- * @access public
682
- * @var string
683
- */
684
- public $correlationId;
685
-
686
- /**
687
- *
688
- * @access public
689
- * @var string
690
- */
691
- public $build;
692
-
693
-
694
- public function init( $map = null, $prefix = '' )
695
- {
696
- if ( $map != null ) {
697
- $mapKeyName = $prefix . 'timestamp';
698
- if ( $map != null && array_key_exists( $mapKeyName, $map ) ) {
699
- $this->timestamp = $map[ $mapKeyName ];
700
- }
701
- $mapKeyName = $prefix . 'ack';
702
- if ( $map != null && array_key_exists( $mapKeyName, $map ) ) {
703
- $this->ack = $map[ $mapKeyName ];
704
- }
705
- $mapKeyName = $prefix . 'correlationId';
706
- if ( $map != null && array_key_exists( $mapKeyName, $map ) ) {
707
- $this->correlationId = $map[ $mapKeyName ];
708
- }
709
- $mapKeyName = $prefix . 'build';
710
- if ( $map != null && array_key_exists( $mapKeyName, $map ) ) {
711
- $this->build = $map[ $mapKeyName ];
712
- }
713
-
714
- }
715
- }
716
- }
717
-
718
-
719
- /**
720
- *
721
- */
722
- class Address
723
- {
724
-
725
- /**
726
- *
727
- * @access public
728
- * @var string
729
- */
730
- public $addresseeName;
731
-
732
- /**
733
- *
734
- * @access public
735
- * @var BaseAddress
736
- */
737
- public $baseAddress;
738
-
739
- /**
740
- *
741
- * @access public
742
- * @var string
743
- */
744
- public $addressId;
745
-
746
-
747
- public function init( $map = null, $prefix = '' )
748
- {
749
- if ( $map != null ) {
750
- $mapKeyName = $prefix . 'addresseeName';
751
- if ( $map != null && array_key_exists( $mapKeyName, $map ) ) {
752
- $this->addresseeName = $map[ $mapKeyName ];
753
- }
754
- if ( PPUtils::array_match_key( $map, $prefix . "baseAddress." ) ) {
755
- $newPrefix = $prefix . "baseAddress.";
756
- $this->baseAddress = new BaseAddress();
757
- $this->baseAddress->init( $map, $newPrefix );
758
- }
759
- $mapKeyName = $prefix . 'addressId';
760
- if ( $map != null && array_key_exists( $mapKeyName, $map ) ) {
761
- $this->addressId = $map[ $mapKeyName ];
762
- }
763
-
764
- }
765
- }
766
- }
767
-
768
-
769
- /**
770
- *
771
- */
772
- class AddressList
773
- {
774
-
775
- /**
776
- *
777
- * @array
778
- * @access public
779
- * @var Address
780
- */
781
- public $address;
782
-
783
-
784
- public function init( $map = null, $prefix = '' )
785
- {
786
- if ( $map != null ) {
787
- $i = 0;
788
- while ( true ) {
789
- if ( PPUtils::array_match_key( $map, $prefix . "address($i)" ) ) {
790
- $newPrefix = $prefix . "address($i).";
791
- $this->address[ $i ] = new Address();
792
- $this->address[ $i ]->init( $map, $newPrefix );
793
- } else {
794
- break;
795
- }
796
- $i++;
797
- }
798
-
799
- }
800
- }
801
- }
802
-
803
-
804
- /**
805
- * A list of ISO currency codes.
806
- */
807
- class CurrencyCodeList
808
- {
809
-
810
- /**
811
- *
812
- * @array
813
- * @access public
814
- * @var string
815
- */
816
- public $currencyCode;
817
-
818
- /**
819
- * Constructor with arguments
820
- */
821
- public function __construct( $currencyCode = null )
822
- {
823
- $this->currencyCode = $currencyCode;
824
- }
825
-
826
-
827
- public function toNVPString( $prefix = '' )
828
- {
829
- $str = '';
830
- $delim = '';
831
- for ( $i = 0; $i < count( $this->currencyCode ); $i++ ) {
832
- $str .= $delim . $prefix . "currencyCode($i)=" . urlencode( $this->currencyCode[ $i ] );
833
- $delim = '&';
834
- }
835
-
836
- return $str;
837
- }
838
-
839
- }
840
-
841
-
842
- /**
843
- * A list of estimated currency conversions for a base
844
- * currency.
845
- */
846
- class CurrencyConversionList
847
- {
848
-
849
- /**
850
- *
851
- * @access public
852
- * @var CurrencyType
853
- */
854
- public $baseAmount;
855
-
856
- /**
857
- *
858
- * @access public
859
- * @var CurrencyList
860
- */
861
- public $currencyList;
862
-
863
-
864
- public function init( $map = null, $prefix = '' )
865
- {
866
- if ( $map != null ) {
867
- if ( PPUtils::array_match_key( $map, $prefix . "baseAmount." ) ) {
868
- $newPrefix = $prefix . "baseAmount.";
869
- $this->baseAmount = new CurrencyType();
870
- $this->baseAmount->init( $map, $newPrefix );
871
- }
872
- if ( PPUtils::array_match_key( $map, $prefix . "currencyList." ) ) {
873
- $newPrefix = $prefix . "currencyList.";
874
- $this->currencyList = new CurrencyList();
875
- $this->currencyList->init( $map, $newPrefix );
876
- }
877
-
878
- }
879
- }
880
- }
881
-
882
-
883
- /**
884
- * A table that contains a list of estimated currency
885
- * conversions for a base currency in each row.
886
- */
887
- class CurrencyConversionTable
888
- {
889
-
890
- /**
891
- *
892
- * @array
893
- * @access public
894
- * @var CurrencyConversionList
895
- */
896
- public $currencyConversionList;
897
-
898
-
899
- public function init( $map = null, $prefix = '' )
900
- {
901
- if ( $map != null ) {
902
- $i = 0;
903
- while ( true ) {
904
- if ( PPUtils::array_match_key( $map, $prefix . "currencyConversionList($i)" ) ) {
905
- $newPrefix = $prefix . "currencyConversionList($i).";
906
- $this->currencyConversionList[ $i ] = new CurrencyConversionList();
907
- $this->currencyConversionList[ $i ]->init( $map, $newPrefix );
908
- } else {
909
- break;
910
- }
911
- $i++;
912
- }
913
-
914
- }
915
- }
916
- }
917
-
918
-
919
- /**
920
- * A list of ISO currencies.
921
- */
922
- class CurrencyList
923
- {
924
-
925
- /**
926
- *
927
- * @array
928
- * @access public
929
- * @var CurrencyType
930
- */
931
- public $currency;
932
-
933
- /**
934
- * Constructor with arguments
935
- */
936
- public function __construct( $currency = null )
937
- {
938
- $this->currency = $currency;
939
- }
940
-
941
-
942
- public function toNVPString( $prefix = '' )
943
- {
944
- $str = '';
945
- $delim = '';
946
- for ( $i = 0; $i < count( $this->currency ); $i++ ) {
947
- $newPrefix = $prefix . "currency($i).";
948
- $str .= $delim . call_user_func( array( $this->currency[ $i ], 'toNVPString' ), $newPrefix );
949
- $delim = '&';
950
- }
951
-
952
- return $str;
953
- }
954
-
955
- public function init( $map = null, $prefix = '' )
956
- {
957
- if ( $map != null ) {
958
- $i = 0;
959
- while ( true ) {
960
- if ( PPUtils::array_match_key( $map, $prefix . "currency($i)" ) ) {
961
- $newPrefix = $prefix . "currency($i).";
962
- $this->currency[ $i ] = new CurrencyType();
963
- $this->currency[ $i ]->init( $map, $newPrefix );
964
- } else {
965
- break;
966
- }
967
- $i++;
968
- }
969
-
970
- }
971
- }
972
- }
973
-
974
-
975
- /**
976
- * Customizable options that a client application can specify
977
- * for display purposes.
978
- */
979
- class DisplayOptions
980
- {
981
-
982
- /**
983
- *
984
- * @access public
985
- * @var string
986
- */
987
- public $emailHeaderImageUrl;
988
-
989
- /**
990
- *
991
- * @access public
992
- * @var string
993
- */
994
- public $emailMarketingImageUrl;
995
-
996
- /**
997
- *
998
- * @access public
999
- * @var string
1000
- */
1001
- public $headerImageUrl;
1002
-
1003
- /**
1004
- *
1005
- * @access public
1006
- * @var string
1007
- */
1008
- public $businessName;
1009
-
1010
-
1011
- public function toNVPString( $prefix = '' )
1012
- {
1013
- $str = '';
1014
- $delim = '';
1015
- if ( $this->emailHeaderImageUrl != null ) {
1016
- $str .= $delim . $prefix . 'emailHeaderImageUrl=' . urlencode( $this->emailHeaderImageUrl );
1017
- $delim = '&';
1018
- }
1019
- if ( $this->emailMarketingImageUrl != null ) {
1020
- $str .= $delim . $prefix . 'emailMarketingImageUrl=' . urlencode( $this->emailMarketingImageUrl );
1021
- $delim = '&';
1022
- }
1023
- if ( $this->headerImageUrl != null ) {
1024
- $str .= $delim . $prefix . 'headerImageUrl=' . urlencode( $this->headerImageUrl );
1025
- $delim = '&';
1026
- }
1027
- if ( $this->businessName != null ) {
1028
- $str .= $delim . $prefix . 'businessName=' . urlencode( $this->businessName );
1029
- $delim = '&';
1030
- }
1031
-
1032
- return $str;
1033
- }
1034
-
1035
- public function init( $map = null, $prefix = '' )
1036
- {
1037
- if ( $map != null ) {
1038
- $mapKeyName = $prefix . 'emailHeaderImageUrl';
1039
- if ( $map != null && array_key_exists( $mapKeyName, $map ) ) {
1040
- $this->emailHeaderImageUrl = $map[ $mapKeyName ];
1041
- }
1042
- $mapKeyName = $prefix . 'emailMarketingImageUrl';
1043
- if ( $map != null && array_key_exists( $mapKeyName, $map ) ) {
1044
- $this->emailMarketingImageUrl = $map[ $mapKeyName ];
1045
- }
1046
- $mapKeyName = $prefix . 'headerImageUrl';
1047
- if ( $map != null && array_key_exists( $mapKeyName, $map ) ) {
1048
- $this->headerImageUrl = $map[ $mapKeyName ];
1049
- }
1050
- $mapKeyName = $prefix . 'businessName';
1051
- if ( $map != null && array_key_exists( $mapKeyName, $map ) ) {
1052
- $this->businessName = $map[ $mapKeyName ];
1053
- }
1054
-
1055
- }
1056
- }
1057
- }
1058
-
1059
-
1060
- /**
1061
- *
1062
- */
1063
- class ErrorList
1064
- {
1065
-
1066
- /**
1067
- *
1068
- * @array
1069
- * @access public
1070
- * @var ErrorData
1071
- */
1072
- public $error;
1073
-
1074
-
1075
- public function init( $map = null, $prefix = '' )
1076
- {
1077
- if ( $map != null ) {
1078
- $i = 0;
1079
- while ( true ) {
1080
- if ( PPUtils::array_match_key( $map, $prefix . "error($i)" ) ) {
1081
- $newPrefix = $prefix . "error($i).";
1082
- $this->error[ $i ] = new ErrorData();
1083
- $this->error[ $i ]->init( $map, $newPrefix );
1084
- } else {
1085
- break;
1086
- }
1087
- $i++;
1088
- }
1089
-
1090
- }
1091
- }
1092
- }
1093
-
1094
-
1095
- /**
1096
- *
1097
- */
1098
- class FundingConstraint
1099
- {
1100
-
1101
- /**
1102
- *
1103
- * @access public
1104
- * @var FundingTypeList
1105
- */
1106
- public $allowedFundingType;
1107
-
1108
-
1109
- public function toNVPString( $prefix = '' )
1110
- {
1111
- $str = '';
1112
- $delim = '';
1113
- if ( $this->allowedFundingType != null ) {
1114
- $newPrefix = $prefix . 'allowedFundingType.';
1115
- $str .= $delim . call_user_func( array( $this->allowedFundingType, 'toNVPString' ), $newPrefix );
1116
- $delim = '&';
1117
- }
1118
-
1119
- return $str;
1120
- }
1121
-
1122
- public function init( $map = null, $prefix = '' )
1123
- {
1124
- if ( $map != null ) {
1125
- if ( PPUtils::array_match_key( $map, $prefix . "allowedFundingType." ) ) {
1126
- $newPrefix = $prefix . "allowedFundingType.";
1127
- $this->allowedFundingType = new FundingTypeList();
1128
- $this->allowedFundingType->init( $map, $newPrefix );
1129
- }
1130
-
1131
- }
1132
- }
1133
- }
1134
-
1135
-
1136
- /**
1137
- * FundingTypeInfo represents one allowed funding type.
1138
- */
1139
- class FundingTypeInfo
1140
- {
1141
-
1142
- /**
1143
- *
1144
- * @access public
1145
- * @var string
1146
- */
1147
- public $fundingType;
1148
-
1149
- /**
1150
- * Constructor with arguments
1151
- */
1152
- public function __construct( $fundingType = null )
1153
- {
1154
- $this->fundingType = $fundingType;
1155
- }
1156
-
1157
-
1158
- public function toNVPString( $prefix = '' )
1159
- {
1160
- $str = '';
1161
- $delim = '';
1162
- if ( $this->fundingType != null ) {
1163
- $str .= $delim . $prefix . 'fundingType=' . urlencode( $this->fundingType );
1164
- $delim = '&';
1165
- }
1166
-
1167
- return $str;
1168
- }
1169
-
1170
- public function init( $map = null, $prefix = '' )
1171
- {
1172
- if ( $map != null ) {
1173
- $mapKeyName = $prefix . 'fundingType';
1174
- if ( $map != null && array_key_exists( $mapKeyName, $map ) ) {
1175
- $this->fundingType = $map[ $mapKeyName ];
1176
- }
1177
-
1178
- }
1179
- }
1180
- }
1181
-
1182
-
1183
- /**
1184
- *
1185
- */
1186
- class FundingTypeList
1187
- {
1188
-
1189
- /**
1190
- *
1191
- * @array
1192
- * @access public
1193
- * @var FundingTypeInfo
1194
- */
1195
- public $fundingTypeInfo;
1196
-
1197
- /**
1198
- * Constructor with arguments
1199
- */
1200
- public function __construct( $fundingTypeInfo = null )
1201
- {
1202
- $this->fundingTypeInfo = $fundingTypeInfo;
1203
- }
1204
-
1205
-
1206
- public function toNVPString( $prefix = '' )
1207
- {
1208
- $str = '';
1209
- $delim = '';
1210
- for ( $i = 0; $i < count( $this->fundingTypeInfo ); $i++ ) {
1211
- $newPrefix = $prefix . "fundingTypeInfo($i).";
1212
- $str .= $delim . call_user_func( array( $this->fundingTypeInfo[ $i ], 'toNVPString' ), $newPrefix );
1213
- $delim = '&';
1214
- }
1215
-
1216
- return $str;
1217
- }
1218
-
1219
- public function init( $map = null, $prefix = '' )
1220
- {
1221
- if ( $map != null ) {
1222
- $i = 0;
1223
- while ( true ) {
1224
- if ( PPUtils::array_match_key( $map, $prefix . "fundingTypeInfo($i)" ) ) {
1225
- $newPrefix = $prefix . "fundingTypeInfo($i).";
1226
- $this->fundingTypeInfo[ $i ] = new FundingTypeInfo();
1227
- $this->fundingTypeInfo[ $i ]->init( $map, $newPrefix );
1228
- } else {
1229
- break;
1230
- }
1231
- $i++;
1232
- }
1233
-
1234
- }
1235
- }
1236
- }
1237
-
1238
-
1239
- /**
1240
- * Describes the conversion between 2 currencies.
1241
- */
1242
- class CurrencyConversion
1243
- {
1244
-
1245
- /**
1246
- *
1247
- * @access public
1248
- * @var CurrencyType
1249
- */
1250
- public $from;
1251
-
1252
- /**
1253
- *
1254
- * @access public
1255
- * @var CurrencyType
1256
- */
1257
- public $to;
1258
-
1259
- /**
1260
- *
1261
- * @access public
1262
- * @var double
1263
- */
1264
- public $exchangeRate;
1265
-
1266
-
1267
- public function init( $map = null, $prefix = '' )
1268
- {
1269
- if ( $map != null ) {
1270
- if ( PPUtils::array_match_key( $map, $prefix . "from." ) ) {
1271
- $newPrefix = $prefix . "from.";
1272
- $this->from = new CurrencyType();
1273
- $this->from->init( $map, $newPrefix );
1274
- }
1275
- if ( PPUtils::array_match_key( $map, $prefix . "to." ) ) {
1276
- $newPrefix = $prefix . "to.";
1277
- $this->to = new CurrencyType();
1278
- $this->to->init( $map, $newPrefix );
1279
- }
1280
- $mapKeyName = $prefix . 'exchangeRate';
1281
- if ( $map != null && array_key_exists( $mapKeyName, $map ) ) {
1282
- $this->exchangeRate = $map[ $mapKeyName ];
1283
- }
1284
-
1285
- }
1286
- }
1287
- }
1288
-
1289
-
1290
- /**
1291
- * Funding source information.
1292
- */
1293
- class FundingSource
1294
- {
1295
-
1296
- /**
1297
- *
1298
- * @access public
1299
- * @var string
1300
- */
1301
- public $lastFourOfAccountNumber;
1302
-
1303
- /**
1304
- *
1305
- * @access public
1306
- * @var string
1307
- */
1308
- public $type;
1309
-
1310
- /**
1311
- *
1312
- * @access public
1313
- * @var string
1314
- */
1315
- public $displayName;
1316
-
1317
- /**
1318
- *
1319
- * @access public
1320
- * @var string
1321
- */
1322
- public $fundingSourceId;
1323
-
1324
- /**
1325
- *
1326
- * @access public
1327
- * @var boolean
1328
- */
1329
- public $allowed;
1330
-
1331
-
1332
- public function init( $map = null, $prefix = '' )
1333
- {
1334
- if ( $map != null ) {
1335
- $mapKeyName = $prefix . 'lastFourOfAccountNumber';
1336
- if ( $map != null && array_key_exists( $mapKeyName, $map ) ) {
1337
- $this->lastFourOfAccountNumber = $map[ $mapKeyName ];
1338
- }
1339
- $mapKeyName = $prefix . 'type';
1340
- if ( $map != null && array_key_exists( $mapKeyName, $map ) ) {
1341
- $this->type = $map[ $mapKeyName ];
1342
- }
1343
- $mapKeyName = $prefix . 'displayName';
1344
- if ( $map != null && array_key_exists( $mapKeyName, $map ) ) {
1345
- $this->displayName = $map[ $mapKeyName ];
1346
- }
1347
- $mapKeyName = $prefix . 'fundingSourceId';
1348
- if ( $map != null && array_key_exists( $mapKeyName, $map ) ) {
1349
- $this->fundingSourceId = $map[ $mapKeyName ];
1350
- }
1351
- $mapKeyName = $prefix . 'allowed';
1352
- if ( $map != null && array_key_exists( $mapKeyName, $map ) ) {
1353
- $this->allowed = $map[ $mapKeyName ];
1354
- }
1355
-
1356
- }
1357
- }
1358
- }
1359
-
1360
-
1361
- /**
1362
- * Amount to be charged to a particular funding source.
1363
- */
1364
- class FundingPlanCharge
1365
- {
1366
-
1367
- /**
1368
- *
1369
- * @access public
1370
- * @var CurrencyType
1371
- */
1372
- public $charge;
1373
-
1374
- /**
1375
- *
1376
- * @access public
1377
- * @var FundingSource
1378
- */
1379
- public $fundingSource;
1380
-
1381
-
1382
- public function init( $map = null, $prefix = '' )
1383
- {
1384
- if ( $map != null ) {
1385
- if ( PPUtils::array_match_key( $map, $prefix . "charge." ) ) {
1386
- $newPrefix = $prefix . "charge.";
1387
- $this->charge = new CurrencyType();
1388
- $this->charge->init( $map, $newPrefix );
1389
- }
1390
- if ( PPUtils::array_match_key( $map, $prefix . "fundingSource." ) ) {
1391
- $newPrefix = $prefix . "fundingSource.";
1392
- $this->fundingSource = new FundingSource();
1393
- $this->fundingSource->init( $map, $newPrefix );
1394
- }
1395
-
1396
- }
1397
- }
1398
- }
1399
-
1400
-
1401
- /**
1402
- * FundingPlan describes the funding sources to be used for a
1403
- * specific payment.
1404
- */
1405
- class FundingPlan
1406
- {
1407
-
1408
- /**
1409
- *
1410
- * @access public
1411
- * @var string
1412
- */
1413
- public $fundingPlanId;
1414
-
1415
- /**
1416
- *
1417
- * @access public
1418
- * @var CurrencyType
1419
- */
1420
- public $fundingAmount;
1421
-
1422
- /**
1423
- *
1424
- * @access public
1425
- * @var FundingSource
1426
- */
1427
- public $backupFundingSource;
1428
-
1429
- /**
1430
- *
1431
- * @access public
1432
- * @var CurrencyType
1433
- */
1434
- public $senderFees;
1435
-
1436
- /**
1437
- *
1438
- * @access public
1439
- * @var CurrencyConversion
1440
- */
1441
- public $currencyConversion;
1442
-
1443
- /**
1444
- *
1445
- * @array
1446
- * @access public
1447
- * @var FundingPlanCharge
1448
- */
1449
- public $charge;
1450
-
1451
-
1452
- public function init( $map = null, $prefix = '' )
1453
- {
1454
- if ( $map != null ) {
1455
- $mapKeyName = $prefix . 'fundingPlanId';
1456
- if ( $map != null && array_key_exists( $mapKeyName, $map ) ) {
1457
- $this->fundingPlanId = $map[ $mapKeyName ];
1458
- }
1459
- if ( PPUtils::array_match_key( $map, $prefix . "fundingAmount." ) ) {
1460
- $newPrefix = $prefix . "fundingAmount.";
1461
- $this->fundingAmount = new CurrencyType();
1462
- $this->fundingAmount->init( $map, $newPrefix );
1463
- }
1464
- if ( PPUtils::array_match_key( $map, $prefix . "backupFundingSource." ) ) {
1465
- $newPrefix = $prefix . "backupFundingSource.";
1466
- $this->backupFundingSource = new FundingSource();
1467
- $this->backupFundingSource->init( $map, $newPrefix );
1468
- }
1469
- if ( PPUtils::array_match_key( $map, $prefix . "senderFees." ) ) {
1470
- $newPrefix = $prefix . "senderFees.";
1471
- $this->senderFees = new CurrencyType();
1472
- $this->senderFees->init( $map, $newPrefix );
1473
- }
1474
- if ( PPUtils::array_match_key( $map, $prefix . "currencyConversion." ) ) {
1475
- $newPrefix = $prefix . "currencyConversion.";
1476
- $this->currencyConversion = new CurrencyConversion();
1477
- $this->currencyConversion->init( $map, $newPrefix );
1478
- }
1479
- $i = 0;
1480
- while ( true ) {
1481
- if ( PPUtils::array_match_key( $map, $prefix . "charge($i)" ) ) {
1482
- $newPrefix = $prefix . "charge($i).";
1483
- $this->charge[ $i ] = new FundingPlanCharge();
1484
- $this->charge[ $i ]->init( $map, $newPrefix );
1485
- } else {
1486
- break;
1487
- }
1488
- $i++;
1489
- }
1490
-
1491
- }
1492
- }
1493
- }
1494
-
1495
-
1496
- /**
1497
- * Details about the party that initiated this payment. The API
1498
- * user is making this payment on behalf of the initiator. The
1499
- * initiator can simply be an institution or a customer of the
1500
- * institution.
1501
- */
1502
- class InitiatingEntity
1503
- {
1504
-
1505
- /**
1506
- *
1507
- * @access public
1508
- * @var InstitutionCustomer
1509
- */
1510
- public $institutionCustomer;
1511
-
1512
-
1513
- public function toNVPString( $prefix = '' )
1514
- {
1515
- $str = '';
1516
- $delim = '';
1517
- if ( $this->institutionCustomer != null ) {
1518
- $newPrefix = $prefix . 'institutionCustomer.';
1519
- $str .= $delim . call_user_func( array( $this->institutionCustomer, 'toNVPString' ), $newPrefix );
1520
- $delim = '&';
1521
- }
1522
-
1523
- return $str;
1524
- }
1525
-
1526
- public function init( $map = null, $prefix = '' )
1527
- {
1528
- if ( $map != null ) {
1529
- if ( PPUtils::array_match_key( $map, $prefix . "institutionCustomer." ) ) {
1530
- $newPrefix = $prefix . "institutionCustomer.";
1531
- $this->institutionCustomer = new InstitutionCustomer();
1532
- $this->institutionCustomer->init( $map, $newPrefix );
1533
- }
1534
-
1535
- }
1536
- }
1537
- }
1538
-
1539
-
1540
- /**
1541
- * The customer of the initiating institution
1542
- */
1543
- class InstitutionCustomer
1544
- {
1545
-
1546
- /**
1547
- * The unique identifier as assigned to the institution.
1548
- * @access public
1549
- * @var string
1550
- */
1551
- public $institutionId;
1552
-
1553
- /**
1554
- * The first (given) name of the end consumer as known by the
1555
- * institution.
1556
- * @access public
1557
- * @var string
1558
- */
1559
- public $firstName;
1560
-
1561
- /**
1562
- * The last (family) name of the end consumer as known by the
1563
- * institution.
1564
- * @access public
1565
- * @var string
1566
- */
1567
- public $lastName;
1568
-
1569
- /**
1570
- * The full name of the end consumer as known by the
1571
- * institution.
1572
- * @access public
1573
- * @var string
1574
- */
1575
- public $displayName;
1576
-
1577
- /**
1578
- * The unique identifier as assigned to the end consumer by the
1579
- * institution.
1580
- * @access public
1581
- * @var string
1582
- */
1583
- public $institutionCustomerId;
1584
-
1585
- /**
1586
- * The two-character ISO country code of the home country of
1587
- * the end consumer
1588
- * @access public
1589
- * @var string
1590
- */
1591
- public $countryCode;
1592
-
1593
- /**
1594
- *
1595
- * @access public
1596
- * @var string
1597
- */
1598
- public $email;
1599
-
1600
- /**
1601
- * Constructor with arguments
1602
- */
1603
- public function __construct( $institutionId = null, $firstName = null, $lastName = null, $displayName = null, $institutionCustomerId = null, $countryCode = null )
1604
- {
1605
- $this->institutionId = $institutionId;
1606
- $this->firstName = $firstName;
1607
- $this->lastName = $lastName;
1608
- $this->displayName = $displayName;
1609
- $this->institutionCustomerId = $institutionCustomerId;
1610
- $this->countryCode = $countryCode;
1611
- }
1612
-
1613
-
1614
- public function toNVPString( $prefix = '' )
1615
- {
1616
- $str = '';
1617
- $delim = '';
1618
- if ( $this->institutionId != null ) {
1619
- $str .= $delim . $prefix . 'institutionId=' . urlencode( $this->institutionId );
1620
- $delim = '&';
1621
- }
1622
- if ( $this->firstName != null ) {
1623
- $str .= $delim . $prefix . 'firstName=' . urlencode( $this->firstName );
1624
- $delim = '&';
1625
- }
1626
- if ( $this->lastName != null ) {
1627
- $str .= $delim . $prefix . 'lastName=' . urlencode( $this->lastName );
1628
- $delim = '&';
1629
- }
1630
- if ( $this->displayName != null ) {
1631
- $str .= $delim . $prefix . 'displayName=' . urlencode( $this->displayName );
1632
- $delim = '&';
1633
- }
1634
- if ( $this->institutionCustomerId != null ) {
1635
- $str .= $delim . $prefix . 'institutionCustomerId=' . urlencode( $this->institutionCustomerId );
1636
- $delim = '&';
1637
- }
1638
- if ( $this->countryCode != null ) {
1639
- $str .= $delim . $prefix . 'countryCode=' . urlencode( $this->countryCode );
1640
- $delim = '&';
1641
- }
1642
- if ( $this->email != null ) {
1643
- $str .= $delim . $prefix . 'email=' . urlencode( $this->email );
1644
- $delim = '&';
1645
- }
1646
-
1647
- return $str;
1648
- }
1649
-
1650
- public function init( $map = null, $prefix = '' )
1651
- {
1652
- if ( $map != null ) {
1653
- $mapKeyName = $prefix . 'institutionId';
1654
- if ( $map != null && array_key_exists( $mapKeyName, $map ) ) {
1655
- $this->institutionId = $map[ $mapKeyName ];
1656
- }
1657
- $mapKeyName = $prefix . 'firstName';
1658
- if ( $map != null && array_key_exists( $mapKeyName, $map ) ) {
1659
- $this->firstName = $map[ $mapKeyName ];
1660
- }
1661
- $mapKeyName = $prefix . 'lastName';
1662
- if ( $map != null && array_key_exists( $mapKeyName, $map ) ) {
1663
- $this->lastName = $map[ $mapKeyName ];
1664
- }
1665
- $mapKeyName = $prefix . 'displayName';
1666
- if ( $map != null && array_key_exists( $mapKeyName, $map ) ) {
1667
- $this->displayName = $map[ $mapKeyName ];
1668
- }
1669
- $mapKeyName = $prefix . 'institutionCustomerId';
1670
- if ( $map != null && array_key_exists( $mapKeyName, $map ) ) {
1671
- $this->institutionCustomerId = $map[ $mapKeyName ];
1672
- }
1673
- $mapKeyName = $prefix . 'countryCode';
1674
- if ( $map != null && array_key_exists( $mapKeyName, $map ) ) {
1675
- $this->countryCode = $map[ $mapKeyName ];
1676
- }
1677
- $mapKeyName = $prefix . 'email';
1678
- if ( $map != null && array_key_exists( $mapKeyName, $map ) ) {
1679
- $this->email = $map[ $mapKeyName ];
1680
- }
1681
-
1682
- }
1683
- }
1684
- }
1685
-
1686
-
1687
- /**
1688
- * Describes an individual item for an invoice.
1689
- */
1690
- class InvoiceItem
1691
- {
1692
-
1693
- /**
1694
- *
1695
- * @access public
1696
- * @var string
1697
- */
1698
- public $name;
1699
-
1700
- /**
1701
- *
1702
- * @access public
1703
- * @var string
1704
- */
1705
- public $identifier;
1706
-
1707
- /**
1708
- *
1709
- * @access public
1710
- * @var double
1711
- */
1712
- public $price;
1713
-
1714
- /**
1715
- *
1716
- * @access public
1717
- * @var double
1718
- */
1719
- public $itemPrice;
1720
-
1721
- /**
1722
- *
1723
- * @access public
1724
- * @var integer
1725
- */
1726
- public $itemCount;
1727
-
1728
-
1729
- public function toNVPString( $prefix = '' )
1730
- {
1731
- $str = '';
1732
- $delim = '';
1733
- if ( $this->name != null ) {
1734
- $str .= $delim . $prefix . 'name=' . urlencode( $this->name );
1735
- $delim = '&';
1736
- }
1737
- if ( $this->identifier != null ) {
1738
- $str .= $delim . $prefix . 'identifier=' . urlencode( $this->identifier );
1739
- $delim = '&';
1740
- }
1741
- if ( $this->price != null ) {
1742
- $str .= $delim . $prefix . 'price=' . urlencode( $this->price );
1743
- $delim = '&';
1744
- }
1745
- if ( $this->itemPrice != null ) {
1746
- $str .= $delim . $prefix . 'itemPrice=' . urlencode( $this->itemPrice );
1747
- $delim = '&';
1748
- }
1749
- if ( $this->itemCount != null ) {
1750
- $str .= $delim . $prefix . 'itemCount=' . urlencode( $this->itemCount );
1751
- $delim = '&';
1752
- }
1753
-
1754
- return $str;
1755
- }
1756
-
1757
- public function init( $map = null, $prefix = '' )
1758
- {
1759
- if ( $map != null ) {
1760
- $mapKeyName = $prefix . 'name';
1761
- if ( $map != null && array_key_exists( $mapKeyName, $map ) ) {
1762
- $this->name = $map[ $mapKeyName ];
1763
- }
1764
- $mapKeyName = $prefix . 'identifier';
1765
- if ( $map != null && array_key_exists( $mapKeyName, $map ) ) {
1766
- $this->identifier = $map[ $mapKeyName ];
1767
- }
1768
- $mapKeyName = $prefix . 'price';
1769
- if ( $map != null && array_key_exists( $mapKeyName, $map ) ) {
1770
- $this->price = $map[ $mapKeyName ];
1771
- }
1772
- $mapKeyName = $prefix . 'itemPrice';
1773
- if ( $map != null && array_key_exists( $mapKeyName, $map ) ) {
1774
- $this->itemPrice = $map[ $mapKeyName ];
1775
- }
1776
- $mapKeyName = $prefix . 'itemCount';
1777
- if ( $map != null && array_key_exists( $mapKeyName, $map ) ) {
1778
- $this->itemCount = $map[ $mapKeyName ];
1779
- }
1780
-
1781
- }
1782
- }
1783
- }
1784
-
1785
-
1786
- /**
1787
- * Describes a payment for a particular receiver (merchant),
1788
- * contains list of additional per item details.
1789
- */
1790
- class InvoiceData
1791
- {
1792
-
1793
- /**
1794
- *
1795
- * @array
1796
- * @access public
1797
- * @var InvoiceItem
1798
- */
1799
- public $item;
1800
-
1801
- /**
1802
- *
1803
- * @access public
1804
- * @var double
1805
- */
1806
- public $totalTax;
1807
-
1808
- /**
1809
- *
1810
- * @access public
1811
- * @var double
1812
- */
1813
- public $totalShipping;
1814
-
1815
-
1816
- public function toNVPString( $prefix = '' )
1817
- {
1818
- $str = '';
1819
- $delim = '';
1820
- for ( $i = 0; $i < count( $this->item ); $i++ ) {
1821
- $newPrefix = $prefix . "item($i).";
1822
- $str .= $delim . call_user_func( array( $this->item[ $i ], 'toNVPString' ), $newPrefix );
1823
- $delim = '&';
1824
- }
1825
- if ( $this->totalTax != null ) {
1826
- $str .= $delim . $prefix . 'totalTax=' . urlencode( $this->totalTax );
1827
- $delim = '&';
1828
- }
1829
- if ( $this->totalShipping != null ) {
1830
- $str .= $delim . $prefix . 'totalShipping=' . urlencode( $this->totalShipping );
1831
- $delim = '&';
1832
- }
1833
-
1834
- return $str;
1835
- }
1836
-
1837
- public function init( $map = null, $prefix = '' )
1838
- {
1839
- if ( $map != null ) {
1840
- $i = 0;
1841
- while ( true ) {
1842
- if ( PPUtils::array_match_key( $map, $prefix . "item($i)" ) ) {
1843
- $newPrefix = $prefix . "item($i).";
1844
- $this->item[ $i ] = new InvoiceItem();
1845
- $this->item[ $i ]->init( $map, $newPrefix );
1846
- } else {
1847
- break;
1848
- }
1849
- $i++;
1850
- }
1851
- $mapKeyName = $prefix . 'totalTax';
1852
- if ( $map != null && array_key_exists( $mapKeyName, $map ) ) {
1853
- $this->totalTax = $map[ $mapKeyName ];
1854
- }
1855
- $mapKeyName = $prefix . 'totalShipping';
1856
- if ( $map != null && array_key_exists( $mapKeyName, $map ) ) {
1857
- $this->totalShipping = $map[ $mapKeyName ];
1858
- }
1859
-
1860
- }
1861
- }
1862
- }
1863
-
1864
-
1865
- /**
1866
- * The error that resulted from an attempt to make a payment to
1867
- * a receiver.
1868
- */
1869
- class PayError
1870
- {
1871
-
1872
- /**
1873
- *
1874
- * @access public
1875
- * @var Receiver
1876
- */
1877
- public $receiver;
1878
-
1879
- /**
1880
- *
1881
- * @access public
1882
- * @var ErrorData
1883
- */
1884
- public $error;
1885
-
1886
-
1887
- public function init( $map = null, $prefix = '' )
1888
- {
1889
- if ( $map != null ) {
1890
- if ( PPUtils::array_match_key( $map, $prefix . "receiver." ) ) {
1891
- $newPrefix = $prefix . "receiver.";
1892
- $this->receiver = new Receiver();
1893
- $this->receiver->init( $map, $newPrefix );
1894
- }
1895
- if ( PPUtils::array_match_key( $map, $prefix . "error." ) ) {
1896
- $newPrefix = $prefix . "error.";
1897
- $this->error = new ErrorData();
1898
- $this->error->init( $map, $newPrefix );
1899
- }
1900
-
1901
- }
1902
- }
1903
- }
1904
-
1905
-
1906
- /**
1907
- *
1908
- */
1909
- class PayErrorList
1910
- {
1911
-
1912
- /**
1913
- *
1914
- * @array
1915
- * @access public
1916
- * @var PayError
1917
- */
1918
- public $payError;
1919
-
1920
-
1921
- public function init( $map = null, $prefix = '' )
1922
- {
1923
- if ( $map != null ) {
1924
- $i = 0;
1925
- while ( true ) {
1926
- if ( PPUtils::array_match_key( $map, $prefix . "payError($i)" ) ) {
1927
- $newPrefix = $prefix . "payError($i).";
1928
- $this->payError[ $i ] = new PayError();
1929
- $this->payError[ $i ]->init( $map, $newPrefix );
1930
- } else {
1931
- break;
1932
- }
1933
- $i++;
1934
- }
1935
-
1936
- }
1937
- }
1938
- }
1939
-
1940
-
1941
- /**
1942
- * PaymentInfo represents the payment attempt made to a
1943
- * Receiver of a PayRequest. If the execution of the payment
1944
- * has not yet completed, there will not be any transaction
1945
- * details.
1946
- */
1947
- class PaymentInfo
1948
- {
1949
-
1950
- /**
1951
- *
1952
- * @access public
1953
- * @var string
1954
- */
1955
- public $transactionId;
1956
-
1957
- /**
1958
- *
1959
- * @access public
1960
- * @var string
1961
- */
1962
- public $transactionStatus;
1963
-
1964
- /**
1965
- *
1966
- * @access public
1967
- * @var Receiver
1968
- */
1969
- public $receiver;
1970
-
1971
- /**
1972
- *
1973
- * @access public
1974
- * @var double
1975
- */
1976
- public $refundedAmount;
1977
-
1978
- /**
1979
- *
1980
- * @access public
1981
- * @var boolean
1982
- */
1983
- public $pendingRefund;
1984
-
1985
- /**
1986
- *
1987
- * @access public
1988
- * @var string
1989
- */
1990
- public $senderTransactionId;
1991
-
1992
- /**
1993
- *
1994
- * @access public
1995
- * @var string
1996
- */
1997
- public $senderTransactionStatus;
1998
-
1999
- /**
2000
- *
2001
- * @access public
2002
- * @var string
2003
- */
2004
- public $pendingReason;
2005
-
2006
-
2007
- public function init( $map = null, $prefix = '' )
2008
- {
2009
- if ( $map != null ) {
2010
- $mapKeyName = $prefix . 'transactionId';
2011
- if ( $map != null && array_key_exists( $mapKeyName, $map ) ) {
2012
- $this->transactionId = $map[ $mapKeyName ];
2013
- }
2014
- $mapKeyName = $prefix . 'transactionStatus';
2015
- if ( $map != null && array_key_exists( $mapKeyName, $map ) ) {
2016
- $this->transactionStatus = $map[ $mapKeyName ];
2017
- }
2018
- if ( PPUtils::array_match_key( $map, $prefix . "receiver." ) ) {
2019
- $newPrefix = $prefix . "receiver.";
2020
- $this->receiver = new Receiver();
2021
- $this->receiver->init( $map, $newPrefix );
2022
- }
2023
- $mapKeyName = $prefix . 'refundedAmount';
2024
- if ( $map != null && array_key_exists( $mapKeyName, $map ) ) {
2025
- $this->refundedAmount = $map[ $mapKeyName ];
2026
- }
2027
- $mapKeyName = $prefix . 'pendingRefund';
2028
- if ( $map != null && array_key_exists( $mapKeyName, $map ) ) {
2029
- $this->pendingRefund = $map[ $mapKeyName ];
2030
- }
2031
- $mapKeyName = $prefix . 'senderTransactionId';
2032
- if ( $map != null && array_key_exists( $mapKeyName, $map ) ) {
2033
- $this->senderTransactionId = $map[ $mapKeyName ];
2034
- }
2035
- $mapKeyName = $prefix . 'senderTransactionStatus';
2036
- if ( $map != null && array_key_exists( $mapKeyName, $map ) ) {
2037
- $this->senderTransactionStatus = $map[ $mapKeyName ];
2038
- }
2039
- $mapKeyName = $prefix . 'pendingReason';
2040
- if ( $map != null && array_key_exists( $mapKeyName, $map ) ) {
2041
- $this->pendingReason = $map[ $mapKeyName ];
2042
- }
2043
-
2044
- }
2045
- }
2046
- }
2047
-
2048
-
2049
- /**
2050
- *
2051
- */
2052
- class PaymentInfoList
2053
- {
2054
-
2055
- /**
2056
- *
2057
- * @array
2058
- * @access public
2059
- * @var PaymentInfo
2060
- */
2061
- public $paymentInfo;
2062
-
2063
-
2064
- public function init( $map = null, $prefix = '' )
2065
- {
2066
- if ( $map != null ) {
2067
- $i = 0;
2068
- while ( true ) {
2069
- if ( PPUtils::array_match_key( $map, $prefix . "paymentInfo($i)" ) ) {
2070
- $newPrefix = $prefix . "paymentInfo($i).";
2071
- $this->paymentInfo[ $i ] = new PaymentInfo();
2072
- $this->paymentInfo[ $i ]->init( $map, $newPrefix );
2073
- } else {
2074
- break;
2075
- }
2076
- $i++;
2077
- }
2078
-
2079
- }
2080
- }
2081
- }
2082
-
2083
-
2084
- /**
2085
- * Receiver is the party where funds are transferred to. A
2086
- * primary receiver receives a payment directly from the sender
2087
- * in a chained split payment. A primary receiver should not be
2088
- * specified when making a single or parallel split payment.
2089
- */
2090
- class Receiver
2091
- {
2092
-
2093
- /**
2094
- *
2095
- * @access public
2096
- * @var double
2097
- */
2098
- public $amount;
2099
-
2100
- /**
2101
- *
2102
- * @access public
2103
- * @var string
2104
- */
2105
- public $email;
2106
-
2107
- /**
2108
- *
2109
- * @access public
2110
- * @var PhoneNumberType
2111
- */
2112
- public $phone;
2113
-
2114
- /**
2115
- *
2116
- * @access public
2117
- * @var boolean
2118
- */
2119
- public $primary;
2120
-
2121
- /**
2122
- *
2123
- * @access public
2124
- * @var string
2125
- */
2126
- public $invoiceId;
2127
-
2128
- /**
2129
- *
2130
- * @access public
2131
- * @var string
2132
- */
2133
- public $paymentType;
2134
-
2135
- /**
2136
- *
2137
- * @access public
2138
- * @var string
2139
- */
2140
- public $paymentSubType;
2141
-
2142
- /**
2143
- * Constructor with arguments
2144
- */
2145
- public function __construct( $amount = null )
2146
- {
2147
- $this->amount = $amount;
2148
- }
2149
-
2150
-
2151
- public function toNVPString( $prefix = '' )
2152
- {
2153
- $str = '';
2154
- $delim = '';
2155
- if ( $this->amount != null ) {
2156
- $str .= $delim . $prefix . 'amount=' . urlencode( $this->amount );
2157
- $delim = '&';
2158
- }
2159
- if ( $this->email != null ) {
2160
- $str .= $delim . $prefix . 'email=' . urlencode( $this->email );
2161
- $delim = '&';
2162
- }
2163
- if ( $this->phone != null ) {
2164
- $newPrefix = $prefix . 'phone.';
2165
- $str .= $delim . call_user_func( array( $this->phone, 'toNVPString' ), $newPrefix );
2166
- $delim = '&';
2167
- }
2168
- if ( $this->primary != null ) {
2169
- $str .= $delim . $prefix . 'primary=' . urlencode( $this->primary );
2170
- $delim = '&';
2171
- }
2172
- if ( $this->invoiceId != null ) {
2173
- $str .= $delim . $prefix . 'invoiceId=' . urlencode( $this->invoiceId );
2174
- $delim = '&';
2175
- }
2176
- if ( $this->paymentType != null ) {
2177
- $str .= $delim . $prefix . 'paymentType=' . urlencode( $this->paymentType );
2178
- $delim = '&';
2179
- }
2180
- if ( $this->paymentSubType != null ) {
2181
- $str .= $delim . $prefix . 'paymentSubType=' . urlencode( $this->paymentSubType );
2182
- $delim = '&';
2183
- }
2184
-
2185
- return $str;
2186
- }
2187
-
2188
- public function init( $map = null, $prefix = '' )
2189
- {
2190
- if ( $map != null ) {
2191
- $mapKeyName = $prefix . 'amount';
2192
- if ( $map != null && array_key_exists( $mapKeyName, $map ) ) {
2193
- $this->amount = $map[ $mapKeyName ];
2194
- }
2195
- $mapKeyName = $prefix . 'email';
2196
- if ( $map != null && array_key_exists( $mapKeyName, $map ) ) {
2197
- $this->email = $map[ $mapKeyName ];
2198
- }
2199
- if ( PPUtils::array_match_key( $map, $prefix . "phone." ) ) {
2200
- $newPrefix = $prefix . "phone.";
2201
- $this->phone = new PhoneNumberType();
2202
- $this->phone->init( $map, $newPrefix );
2203
- }
2204
- $mapKeyName = $prefix . 'primary';
2205
- if ( $map != null && array_key_exists( $mapKeyName, $map ) ) {
2206
- $this->primary = $map[ $mapKeyName ];
2207
- }
2208
- $mapKeyName = $prefix . 'invoiceId';
2209
- if ( $map != null && array_key_exists( $mapKeyName, $map ) ) {
2210
- $this->invoiceId = $map[ $mapKeyName ];
2211
- }
2212
- $mapKeyName = $prefix . 'paymentType';
2213
- if ( $map != null && array_key_exists( $mapKeyName, $map ) ) {
2214
- $this->paymentType = $map[ $mapKeyName ];
2215
- }
2216
- $mapKeyName = $prefix . 'paymentSubType';
2217
- if ( $map != null && array_key_exists( $mapKeyName, $map ) ) {
2218
- $this->paymentSubType = $map[ $mapKeyName ];
2219
- }
2220
-
2221
- }
2222
- }
2223
- }
2224
-
2225
-
2226
- /**
2227
- *
2228
- */
2229
- class ReceiverList
2230
- {
2231
-
2232
- /**
2233
- *
2234
- * @array
2235
- * @access public
2236
- * @var Receiver
2237
- */
2238
- public $receiver;
2239
-
2240
- /**
2241
- * Constructor with arguments
2242
- */
2243
- public function __construct( $receiver = null )
2244
- {
2245
- $this->receiver = $receiver;
2246
- }
2247
-
2248
-
2249
- public function toNVPString( $prefix = '' )
2250
- {
2251
- $str = '';
2252
- $delim = '';
2253
- for ( $i = 0; $i < count( $this->receiver ); $i++ ) {
2254
- $newPrefix = $prefix . "receiver($i).";
2255
- $str .= $delim . call_user_func( array( $this->receiver[ $i ], 'toNVPString' ), $newPrefix );
2256
- $delim = '&';
2257
- }
2258
-
2259
- return $str;
2260
- }
2261
-
2262
- }
2263
-
2264
-
2265
- /**
2266
- * The sender identifier type contains information to identify
2267
- * a PayPal account.
2268
- */
2269
- class ReceiverIdentifier extends AccountIdentifier
2270
- {
2271
-
2272
-
2273
- public function toNVPString( $prefix = '' )
2274
- {
2275
- $str = parent::toNVPString( $prefix );
2276
- if ( strlen( $str ) > 0 ) {
2277
- $delim = '&';
2278
- } else {
2279
- $delim = '';
2280
- }
2281
-
2282
- return $str;
2283
- }
2284
-
2285
- public function init( $map = null, $prefix = '' )
2286
- {
2287
- if ( $map != null ) {
2288
-
2289
- }
2290
- }
2291
- }
2292
-
2293
-
2294
- /**
2295
- * Options that apply to the receiver of a payment, allows
2296
- * setting additional details for payment using invoice.
2297
- */
2298
- class ReceiverOptions
2299
- {
2300
-
2301
- /**
2302
- *
2303
- * @access public
2304
- * @var string
2305
- */
2306
- public $description;
2307
-
2308
- /**
2309
- *
2310
- * @access public
2311
- * @var string
2312
- */
2313
- public $customId;
2314
-
2315
- /**
2316
- *
2317
- * @access public
2318
- * @var InvoiceData
2319
- */
2320
- public $invoiceData;
2321
-
2322
- /**
2323
- *
2324
- * @access public
2325
- * @var ReceiverIdentifier
2326
- */
2327
- public $receiver;
2328
-
2329
- /**
2330
- *
2331
- * @access public
2332
- * @var string
2333
- */
2334
- public $referrerCode;
2335
-
2336
- /**
2337
- * Constructor with arguments
2338
- */
2339
- public function __construct( $receiver = null )
2340
- {
2341
- $this->receiver = $receiver;
2342
- }
2343
-
2344
-
2345
- public function toNVPString( $prefix = '' )
2346
- {
2347
- $str = '';
2348
- $delim = '';
2349
- if ( $this->description != null ) {
2350
- $str .= $delim . $prefix . 'description=' . urlencode( $this->description );
2351
- $delim = '&';
2352
- }
2353
- if ( $this->customId != null ) {
2354
- $str .= $delim . $prefix . 'customId=' . urlencode( $this->customId );
2355
- $delim = '&';
2356
- }
2357
- if ( $this->invoiceData != null ) {
2358
- $newPrefix = $prefix . 'invoiceData.';
2359
- $str .= $delim . call_user_func( array( $this->invoiceData, 'toNVPString' ), $newPrefix );
2360
- $delim = '&';
2361
- }
2362
- if ( $this->receiver != null ) {
2363
- $newPrefix = $prefix . 'receiver.';
2364
- $str .= $delim . call_user_func( array( $this->receiver, 'toNVPString' ), $newPrefix );
2365
- $delim = '&';
2366
- }
2367
- if ( $this->referrerCode != null ) {
2368
- $str .= $delim . $prefix . 'referrerCode=' . urlencode( $this->referrerCode );
2369
- $delim = '&';
2370
- }
2371
-
2372
- return $str;
2373
- }
2374
-
2375
- public function init( $map = null, $prefix = '' )
2376
- {
2377
- if ( $map != null ) {
2378
- $mapKeyName = $prefix . 'description';
2379
- if ( $map != null && array_key_exists( $mapKeyName, $map ) ) {
2380
- $this->description = $map[ $mapKeyName ];
2381
- }
2382
- $mapKeyName = $prefix . 'customId';
2383
- if ( $map != null && array_key_exists( $mapKeyName, $map ) ) {
2384
- $this->customId = $map[ $mapKeyName ];
2385
- }
2386
- if ( PPUtils::array_match_key( $map, $prefix . "invoiceData." ) ) {
2387
- $newPrefix = $prefix . "invoiceData.";
2388
- $this->invoiceData = new InvoiceData();
2389
- $this->invoiceData->init( $map, $newPrefix );
2390
- }
2391
- if ( PPUtils::array_match_key( $map, $prefix . "receiver." ) ) {
2392
- $newPrefix = $prefix . "receiver.";
2393
- $this->receiver = new ReceiverIdentifier();
2394
- $this->receiver->init( $map, $newPrefix );
2395
- }
2396
- $mapKeyName = $prefix . 'referrerCode';
2397
- if ( $map != null && array_key_exists( $mapKeyName, $map ) ) {
2398
- $this->referrerCode = $map[ $mapKeyName ];
2399
- }
2400
-
2401
- }
2402
- }
2403
- }
2404
-
2405
-
2406
- /**
2407
- * RefundInfo represents the refund attempt made to a Receiver
2408
- * of a PayRequest.
2409
- */
2410
- class RefundInfo
2411
- {
2412
-
2413
- /**
2414
- *
2415
- * @access public
2416
- * @var Receiver
2417
- */
2418
- public $receiver;
2419
-
2420
- /**
2421
- *
2422
- * @access public
2423
- * @var string
2424
- */
2425
- public $refundStatus;
2426
-
2427
- /**
2428
- *
2429
- * @access public
2430
- * @var double
2431
- */
2432
- public $refundNetAmount;
2433
-
2434
- /**
2435
- *
2436
- * @access public
2437
- * @var double
2438
- */
2439
- public $refundFeeAmount;
2440
-
2441
- /**
2442
- *
2443
- * @access public
2444
- * @var double
2445
- */
2446
- public $refundGrossAmount;
2447
-
2448
- /**
2449
- *
2450
- * @access public
2451
- * @var double
2452
- */
2453
- public $tota