| 9 |
- |
1 |
<?php
|
| 65 |
- |
2 |
class Vendors {
|
| 9 |
- |
3 |
private static $instance = null;
|
|
|
4 |
private static $ebay = [];
|
|
|
5 |
private static $discogs = [];
|
| 20 |
- |
6 |
private static $linkshare = [];
|
|
|
7 |
private static $cjaffiliate = [];
|
|
|
8 |
private static $walmart = [];
|
| 54 |
- |
9 |
private static $itunes = [];
|
| 81 |
- |
10 |
private static $amazon = [];
|
| 83 |
- |
11 |
private static $impact = [];
|
| 107 |
- |
12 |
private static $ipapi = [];
|
| 9 |
- |
13 |
|
|
|
14 |
const EBAY = 0;
|
|
|
15 |
const DISCOGS = 1;
|
| 20 |
- |
16 |
const LINKSHARE = 2;
|
|
|
17 |
const CJAFFILIATE = 3;
|
|
|
18 |
const WALMART = 4;
|
| 54 |
- |
19 |
const ITUNES = 5;
|
| 81 |
- |
20 |
const AMAZON = 6;
|
| 83 |
- |
21 |
const IMPACT = 7;
|
| 107 |
- |
22 |
const IPAPI = 8;
|
| 9 |
- |
23 |
|
| 65 |
- |
24 |
public static function getInstance() {
|
|
|
25 |
if (is_null(self::$instance)) {
|
| 9 |
- |
26 |
self::$instance = new self();
|
|
|
27 |
}
|
|
|
28 |
|
|
|
29 |
return self::$instance;
|
|
|
30 |
}
|
|
|
31 |
|
| 65 |
- |
32 |
public function setVendor($vendorArray, $type) {
|
| 10 |
- |
33 |
if ($type == self::EBAY) {
|
| 9 |
- |
34 |
self::$ebay = $vendorArray;
|
| 83 |
- |
35 |
} else if ($type == self::DISCOGS) {
|
| 9 |
- |
36 |
self::$discogs = $vendorArray;
|
| 83 |
- |
37 |
} else if ($type == self::LINKSHARE) {
|
| 20 |
- |
38 |
self::$linkshare = $vendorArray;
|
| 83 |
- |
39 |
} else if ($type == self::CJAFFILIATE) {
|
| 20 |
- |
40 |
self::$cjaffiliate = $vendorArray;
|
| 83 |
- |
41 |
} else if ($type == self::WALMART) {
|
| 20 |
- |
42 |
self::$walmart = $vendorArray;
|
| 83 |
- |
43 |
} else if ($type == self::ITUNES) {
|
| 54 |
- |
44 |
self::$itunes = $vendorArray;
|
| 83 |
- |
45 |
} else if ($type == self::AMAZON) {
|
| 81 |
- |
46 |
self::$amazon = $vendorArray;
|
| 83 |
- |
47 |
} else if ($type == self::IMPACT) {
|
|
|
48 |
self::$impact = $vendorArray;
|
| 107 |
- |
49 |
} else if ($type == self::IPAPI) {
|
|
|
50 |
self::$ipapi = $vendorArray;
|
| 81 |
- |
51 |
}
|
| 9 |
- |
52 |
}
|
|
|
53 |
|
| 65 |
- |
54 |
public function getVendor($type) {
|
| 10 |
- |
55 |
if ($type == self::EBAY) {
|
| 9 |
- |
56 |
return self::$ebay;
|
| 83 |
- |
57 |
} else if ($type == self::DISCOGS) {
|
| 9 |
- |
58 |
return self::$discogs;
|
| 83 |
- |
59 |
} else if ($type == self::LINKSHARE) {
|
| 20 |
- |
60 |
return self::$linkshare;
|
| 83 |
- |
61 |
} else if ($type == self::CJAFFILIATE) {
|
| 20 |
- |
62 |
return self::$cjaffiliate;
|
| 83 |
- |
63 |
} else if ($type == self::WALMART) {
|
| 20 |
- |
64 |
return self::$walmart;
|
| 83 |
- |
65 |
} else if ($type == self::ITUNES) {
|
| 54 |
- |
66 |
return self::$itunes;
|
| 83 |
- |
67 |
} else if ($type == self::AMAZON) {
|
| 81 |
- |
68 |
return self::$amazon;
|
| 83 |
- |
69 |
} else if ($type == self::IMPACT) {
|
|
|
70 |
return self::$impact;
|
| 107 |
- |
71 |
} else if ($type == self::IPAPI) {
|
|
|
72 |
return self::$ipapi;
|
| 81 |
- |
73 |
}
|
| 9 |
- |
74 |
|
|
|
75 |
return null;
|
|
|
76 |
}
|
| 83 |
- |
77 |
|
|
|
78 |
public static function setAllVendors($configFile, $vendors) {
|
|
|
79 |
$vendors->setVendor($configFile['ebay'], Vendors::EBAY);
|
|
|
80 |
$vendors->setVendor($configFile['discogs'], Vendors::DISCOGS);
|
|
|
81 |
$vendors->setVendor($configFile['linkshare'], Vendors::LINKSHARE);
|
|
|
82 |
$vendors->setVendor($configFile['cjaffiliate'], Vendors::CJAFFILIATE);
|
|
|
83 |
$vendors->setVendor($configFile['walmart'], Vendors::WALMART);
|
|
|
84 |
$vendors->setVendor($configFile['itunes'], Vendors::ITUNES);
|
|
|
85 |
$vendors->setVendor($configFile['amazon'], Vendors::AMAZON);
|
|
|
86 |
$vendors->setVendor($configFile['impact'], Vendors::IMPACT);
|
| 107 |
- |
87 |
$vendors->setVendor($configFile['ipapi'], Vendors::IPAPI);
|
| 83 |
- |
88 |
}
|
| 10 |
- |
89 |
}
|