TriggMineCartRecovery - Version 3.0.5

Version Notes

- Added support for configurable product
- Optimized api client
- Added security access token
- Bug fixes and performance improvements

Download this release

Release Info

Developer TriggMine
Extension TriggMineCartRecovery
Version 3.0.5
Comparing to
See all releases


Code changes from version 2.2.1 to 3.0.5

Files changed (29) hide show
  1. app/code/community/Triggmine/IntegrationModule/Block/Adminhtml/IntegrationModulebackend.php +11 -0
  2. app/code/community/Triggmine/IntegrationModule/Block/Adminhtml/System/Config/Button.php +22 -0
  3. app/code/community/Triggmine/IntegrationModule/Block/Adminhtml/System/Config/Date.php +22 -0
  4. app/code/community/Triggmine/IntegrationModule/Helper/Data.php +557 -0
  5. app/code/community/Triggmine/IntegrationModule/Model/Observer.php +76 -0
  6. app/code/community/Triggmine/IntegrationModule/controllers/Adminhtml/IntegrationmodulebackendController.php +15 -0
  7. app/code/community/{Videal/Triggmine → Triggmine/IntegrationModule}/etc/adminhtml.xml +1 -1
  8. app/code/community/Triggmine/IntegrationModule/etc/config.xml +178 -0
  9. app/code/community/Triggmine/IntegrationModule/etc/system.xml +92 -0
  10. app/code/community/Videal/Triggmine/Block/Adminhtml/Triggminebackend.php +0 -5
  11. app/code/community/Videal/Triggmine/Helper/Data.php +0 -17
  12. app/code/community/Videal/Triggmine/Model/Observer.php +0 -498
  13. app/code/community/Videal/Triggmine/Model/core/ApiClient.php +0 -406
  14. app/code/community/Videal/Triggmine/Model/core/Core.php +0 -1069
  15. app/code/community/Videal/Triggmine/Model/core/Error.php +0 -122
  16. app/code/community/Videal/Triggmine/Model/core/Helper.php +0 -79
  17. app/code/community/Videal/Triggmine/controllers/Adminhtml/TriggminebackendController.php +0 -10
  18. app/code/community/Videal/Triggmine/etc/config.xml +0 -239
  19. app/code/community/Videal/Triggmine/etc/system.xml +0 -63
  20. app/design/frontend/base/default/layout/triggmine_integrationmodule.xml +10 -0
  21. app/design/frontend/base/default/layout/videal_triggmine.xml +0 -13
  22. app/design/frontend/base/default/template/triggmine/integrationmodule/init.phtml +22 -0
  23. app/design/frontend/base/default/template/videal/triggmine/init.phtml +0 -2
  24. app/etc/modules/{Videal_Triggmine.xml → Triggmine_IntegrationModule.xml} +9 -9
  25. js/triggmine/integationmodule/scripts/client.min.js +79 -0
  26. js/triggmine/integationmodule/scripts/fingerprint2.min.js +2 -0
  27. js/triggmine/integationmodule/scripts/jscookie.min.js +1 -0
  28. js/videal/triggmine/api.js +0 -123
  29. package.xml +12 -9
app/code/community/Triggmine/IntegrationModule/Block/Adminhtml/IntegrationModulebackend.php ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Triggmine_IntegrationModule_Block_Adminhtml_IntegrationModulebackend extends Mage_Adminhtml_Block_Template {
4
+
5
+ public function importAction()
6
+ {
7
+
8
+
9
+ }
10
+
11
+ }
app/code/community/Triggmine/IntegrationModule/Block/Adminhtml/System/Config/Button.php ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Triggmine_IntegrationModule_Block_Adminhtml_System_Config_Button extends Mage_Adminhtml_Block_System_Config_Form_Field
4
+ {
5
+ protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
6
+ {
7
+ $this->setElement($element);
8
+
9
+
10
+ //$action = Mage::helper('integrationmodule')->exportInit();
11
+
12
+ $html = $this->getLayout()->createBlock('adminhtml/widget_button')
13
+ ->setType('button')
14
+ ->setClass('scalable')
15
+ ->setLabel('Run Now !')
16
+ ->setOnClick("setLocation('$url')")
17
+ ->toHtml();
18
+
19
+ return $html;
20
+ }
21
+
22
+ }
app/code/community/Triggmine/IntegrationModule/Block/Adminhtml/System/Config/Date.php ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Triggmine_IntegrationModule_Block_Adminhtml_System_Config_Date extends Mage_Adminhtml_Block_System_Config_Form_Field
4
+ {
5
+ protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
6
+ {
7
+ $date = new Varien_Data_Form_Element_Date;
8
+ $format = Mage::app()->getLocale()->getDateFormat(Mage_Core_Model_Locale::FORMAT_TYPE_SHORT);
9
+
10
+ $data = array(
11
+ 'name' => $element->getName(),
12
+ 'html_id' => $element->getId(),
13
+ 'image' => $this->getSkinUrl('images/grid-cal.gif'),
14
+ );
15
+ $date->setData($data);
16
+ $date->setValue($element->getValue(), $format);
17
+ $date->setFormat(Mage::app()->getLocale()->getDateFormat(Mage_Core_Model_Locale::FORMAT_TYPE_SHORT));
18
+ $date->setForm($element->getForm());
19
+
20
+ return $date->getElementHtml();
21
+ }
22
+ }
app/code/community/Triggmine/IntegrationModule/Helper/Data.php ADDED
@@ -0,0 +1,557 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Triggmine_IntegrationModule_Helper_Data extends Mage_Core_Helper_Abstract
4
+ {
5
+ const XML_PATH_ENABLED = 'triggmine/settings/is_on';
6
+ const XML_PATH_URL_API = 'triggmine/settings/url_api';
7
+ const XML_PATH_TOKEN = 'triggmine/settings/token';
8
+ const XML_PATH_KEY = 'triggmine/settings/key';
9
+ const XML_PATH_SECRET = 'triggmine/settings/secret';
10
+ const XML_PATH_EXPORT = 'triggmine/triggmine_export/export';
11
+ const XML_PATH_DATE_FROM = 'triggmine/triggmine_export/my_date_from';
12
+ const XML_PATH_DATE_TO = 'triggmine/triggmine_export/my_date_to';
13
+ const VERSION_PLUGIN = '3.0.5';
14
+
15
+ protected $_storeManager;
16
+ protected $_cartItemRepository;
17
+ protected $_customerRepository;
18
+ protected $_customerSession;
19
+ protected $_cookieManager;
20
+ protected $_url;
21
+ protected $_token;
22
+ protected $_pluginOn;
23
+ protected $_enableExport;
24
+
25
+
26
+ public function __construct()
27
+ {
28
+ $this->_cookieManager = Mage::getModel('core/cookie');
29
+ $this->_storeManager = Mage::app()->getStore()->getId();
30
+ $this->_customerSession = Mage::getSingleton('customer/session');
31
+ $this->_customerRepository = Mage::getModel("customer/customer");
32
+ $this->_url = Mage::getStoreConfig(self::XML_PATH_URL_API);
33
+ $this->_token = Mage::getStoreConfig(self::XML_PATH_TOKEN);
34
+ $this->_pluginOn = Mage::getStoreConfig(self::XML_PATH_ENABLED);
35
+ $this->_enableExport = Mage::getStoreConfig(self::XML_PATH_EXPORT);
36
+ }
37
+
38
+ public function apiClient($data, $method)
39
+ {
40
+
41
+ if ($this->_url == "")
42
+ {
43
+ $res = "false";
44
+ }
45
+ else
46
+ {
47
+ $target = "https://" . $this->_url . "/" . $method;
48
+
49
+ $data_string = json_encode($data);
50
+
51
+ $ch = curl_init();
52
+
53
+ curl_setopt($ch, CURLOPT_URL, $target);
54
+ curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
55
+ curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);
56
+ curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
57
+ curl_setopt($ch, CURLOPT_HTTPHEADER, array(
58
+ 'Content-Type: application/json',
59
+ 'ApiKey: ' . $this->_token,
60
+ 'Content-Length: ' . strlen($data_string))
61
+ );
62
+
63
+ $res_json = curl_exec ($ch);
64
+
65
+ curl_close ($ch);
66
+
67
+ $res = json_decode($res_json, true);
68
+ }
69
+
70
+ return $res;
71
+ }
72
+
73
+ public function isEnabled()
74
+ {
75
+ return ($this->_pluginOn && !empty($this->_token)) ? true : false;
76
+ }
77
+
78
+ public function exportEnabled()
79
+ {
80
+ return ($this->_enableExport) ? true : false;
81
+ }
82
+
83
+ public function getDeviceId()
84
+ {
85
+ return $this->_cookieManager->get('device_id');
86
+ }
87
+
88
+ public function getDeviceId_1()
89
+ {
90
+ return $this->_cookieManager->get('device_id_1');
91
+ }
92
+
93
+ public function normalizeName($name)
94
+ {
95
+ return trim(preg_replace('/\s+/', ' ', $name));
96
+ }
97
+
98
+ public function getCartData()
99
+ {
100
+ $cart = Mage::getSingleton('checkout/session');
101
+ $customer = Mage::getSingleton('customer/session');
102
+
103
+ $products = $cart->getQuote()->getItemsCollection();
104
+
105
+ $customerId = $customer->getCustomer()->getId();
106
+ $customerData = Mage::getModel('customer/customer')->load($customerId);
107
+ $dateCreated = $customerId ? date('Y/m/d h:m:s', $customerData->getCreatedAtTimestamp()) : null;
108
+
109
+ $customer = array(
110
+ 'device_id' => $this->getDeviceId(),
111
+ 'device_id_1' => $this->getDeviceId_1(),
112
+ 'customer_id' => $customerId,
113
+ 'customer_first_name' => $customerData->getFirstname(),
114
+ 'customer_last_name' => $customerData->getLastname(),
115
+ 'customer_email' => $customerData->getEmail(),
116
+ 'customer_date_created' => $dateCreated
117
+ );
118
+
119
+ $data = array(
120
+ 'customer' => $customer,
121
+ 'order_id' => $cart->getQuoteId(), // cart id
122
+ 'price_total' => sprintf('%01.2f', $cart->getQuote()->getGrandTotal()),
123
+ 'qty_total' => Mage::helper('checkout/cart')->getItemsCount(),
124
+ 'products' => array()
125
+ );
126
+
127
+ foreach ($products as $product)
128
+ {
129
+ // to prevent duplicate entries for configurable product - consider only child simple products
130
+ if($product->getProductType() == "simple")
131
+ {
132
+
133
+ $catalogProduct = $product->getProduct();
134
+
135
+ $productId = $catalogProduct->getId();
136
+ $productName = $catalogProduct->getName();
137
+
138
+ $productPull = Mage::getModel('catalog/product')->load($productId);
139
+
140
+ $productImage = $productPull->getImageUrl();
141
+ $productDesc = $productPull->getDescription();
142
+
143
+ if ($product->getParentItem())
144
+ {
145
+ $productPrice = $product->getParentItem()->getPrice();
146
+ $productTotalVal = $product->getParentItem()->getRowTotal();
147
+ $parentIds = Mage::getModel('catalog/product_type_configurable')->getParentIdsByChild($productId);
148
+ $categories = Mage::getModel('catalog/product')->load($parentIds[0])->getCategoryIds();
149
+ $productQty = $product->getParentItem()->getQty();
150
+ }
151
+ else
152
+ {
153
+ $productPrice = $catalogProduct->getFinalPrice($product->getQty());
154
+ $productTotalVal = $product->getRowTotal();
155
+ $categories = Mage::getModel('catalog/product')->load($productId)->getCategoryIds();
156
+ $productQty = $product->getQty();
157
+ }
158
+
159
+ $itemData = array();
160
+ $itemData['product_id'] = (string)$productId;
161
+ $itemData['product_name'] = $this->normalizeName($productName);
162
+ $itemData['product_desc'] = $productDesc;
163
+ $itemData['product_sku'] = $product->GetData('sku');
164
+ $itemData['product_image'] = $productImage;
165
+ $itemData['product_url'] = $catalogProduct->getProductUrl();
166
+ $itemData['product_qty'] = $productQty;
167
+ $itemData['product_price'] = intval($productPrice);
168
+ $itemData['product_total_val'] = intval($productTotalVal);
169
+
170
+ $itemData['product_categories'] = array();
171
+
172
+ foreach ($categories as $categoryId) {
173
+
174
+ $category = Mage::getModel('catalog/category')->load($categoryId);
175
+ $itemData['product_categories'][] = $category->getName();
176
+ }
177
+
178
+ $data['products'][] = $itemData;
179
+
180
+ }
181
+ else
182
+ {
183
+ continue;
184
+ }
185
+ }
186
+
187
+ return $data;
188
+ }
189
+
190
+ public function sendCart($data)
191
+ {
192
+ return $this->apiClient($data, 'api/events/cart');
193
+ }
194
+
195
+ public function onConvertCartToOrder($data)
196
+ {
197
+ return $this->apiClient($data, 'api/events/order');
198
+ }
199
+
200
+ public function getOrderData($observer)
201
+ {
202
+ $orderId = $observer->getEvent()->getOrder();
203
+
204
+ $id = $orderId->getId();
205
+ $idInc = $orderId->getIncrementId();
206
+
207
+ $collection = Mage::getModel('sales/order')->getCollection()->addAttributeToFilter('increment_id', $idInc);
208
+ $order = $collection->getFirstItem();
209
+
210
+ $customerId = $order->getCustomerId();
211
+ $customerData = Mage::getModel('customer/customer')->load($customerId);
212
+ $dateCreated = $customerId ? date('Y/m/d h:m:s', $customerData->getCreatedAtTimestamp()) : null;
213
+
214
+ $customer = array(
215
+ 'device_id' => $this->getDeviceId(),
216
+ 'device_id_1' => $this->getDeviceId_1(),
217
+ 'customer_id' => $customerId,
218
+ 'customer_first_name' => $order->getBillingAddress()->getFirstname(),
219
+ 'customer_last_name' => $order->getBillingAddress()->getLastname(),
220
+ 'customer_email' => $order->getCustomerEmail(),
221
+ 'customer_date_created' => $dateCreated
222
+ );
223
+
224
+ $data = array(
225
+ 'customer' => $customer,
226
+ 'order_id' => $order->getId(),
227
+ 'status' => $order->getStatus() ? $order->getStatus() : 'pending',
228
+ 'price_total' => number_format ($order->getGrandTotal(), 2, '.' , $thousands_sep = ''),
229
+ 'qty_total' => intval($order->getTotalItemCount()),
230
+ 'products' => array()
231
+ );
232
+
233
+ $orderItems = $order->getItemsCollection()
234
+ ->addAttributeToSelect('*')
235
+ ->addAttributeToFilter('product_type', array('eq'=>'simple'))
236
+ ->load();
237
+
238
+ foreach($orderItems as $item)
239
+ {
240
+ // to prevent duplicate entries for configurable product - consider only child simple products
241
+ if($item->getProductType() == "simple")
242
+ {
243
+
244
+ $catalogProduct = $item->getProduct();
245
+ $productId = $catalogProduct->getId();
246
+ $productName = $catalogProduct->getName();
247
+ $productQty = $item->getQtyOrdered();
248
+ $productImage = Mage::getModel('catalog/product')->load($productId)->getImageUrl();
249
+
250
+ if ($item->getParentItem())
251
+ {
252
+ $productPrice = $item->getParentItem()->getPrice();
253
+ $productTotalVal = $item->getParentItem()->getRowTotal();
254
+ $parentIds = Mage::getModel('catalog/product_type_configurable')->getParentIdsByChild($productId);
255
+ $categories = Mage::getModel('catalog/product')->load($parentIds[0])->getCategoryIds();
256
+ }
257
+ else
258
+ {
259
+ $productPrice = $catalogProduct->getFinalPrice($item->getQtyOrdered());
260
+ $productTotalVal = $item->getRowTotal();
261
+ $categories = Mage::getModel('catalog/product')->load($productId)->getCategoryIds();
262
+ }
263
+
264
+
265
+ $itemData = array();
266
+ $itemData['product_id'] = (string)$productId;
267
+ $itemData['product_name'] = $this->normalizeName($productName);
268
+ $itemData['product_desc'] = $catalogProduct->getDescription();
269
+ $itemData['product_sku'] = $item->GetData('sku');
270
+ $itemData['product_image'] = $productImage;
271
+ $itemData['product_url'] = $catalogProduct->getProductUrl();
272
+ $itemData['product_qty'] = round($productQty);
273
+ $itemData['product_price'] = intval($productPrice);
274
+ $itemData['product_total_val'] = intval($productTotalVal);
275
+ $itemData['product_categories'] = array();
276
+
277
+ foreach ($categories as $categoryId) {
278
+
279
+ $category = Mage::getModel('catalog/category')->load($categoryId);
280
+ $itemData['product_categories'][] = $category->getName();
281
+ }
282
+
283
+ $data['products'][] = $itemData;
284
+
285
+ }
286
+ else
287
+ {
288
+ continue;
289
+ }
290
+ }
291
+
292
+ return $data;
293
+ }
294
+
295
+ public function getCustomerLoginData($customer = null)
296
+ {
297
+ if (is_null($customer))
298
+ {
299
+ $customer = $this->getCustomer();
300
+ }
301
+
302
+ $data = array(
303
+ 'device_id' => $this->getDeviceId(),
304
+ 'device_id_1' => $this->getDeviceId_1(),
305
+ 'customer_id' => $customer->getId(),
306
+ 'customer_first_name' => $customer->getFirstname(),
307
+ 'customer_last_name' => $customer->getLastname(),
308
+ 'customer_email' => $customer->getEmail(),
309
+ 'customer_date_created' => date('Y/m/d h:m:s', $customer->getCreatedAtTimestamp())
310
+ );
311
+
312
+ return $data;
313
+ }
314
+
315
+ public function getCustomerRegisterData($observer)
316
+ {
317
+ $customer = $observer->getCustomer();
318
+
319
+ $data = array(
320
+ 'device_id' => $this->getDeviceId(),
321
+ 'device_id_1' => $this->getDeviceId_1(),
322
+ 'customer_id' => $customer->getId(),
323
+ 'customer_first_name' => $customer->getFirstname(),
324
+ 'customer_last_name' => $customer->getLastname(),
325
+ 'customer_email' => $customer->getEmail(),
326
+ 'customer_date_created' => date('Y/m/d h:m:s', $customer->getCreatedAtTimestamp())
327
+ );
328
+
329
+ return $data;
330
+ }
331
+
332
+ public function getCustomer()
333
+ {
334
+ return $this->_customerRepository->load($this->_customerSession->getCustomerId());
335
+ }
336
+
337
+ public function sendLoginData($data)
338
+ {
339
+ return $this->apiClient($data, 'api/events/prospect/login');
340
+ }
341
+
342
+ public function sendLogoutData($data)
343
+ {
344
+ return $this->apiClient($data, 'api/events/prospect/registration');
345
+ }
346
+
347
+ public function sendRegisterData($data)
348
+ {
349
+ return $this->apiClient($data, 'api/events/prospect/logout');
350
+ }
351
+
352
+ public function SoftChek($observer)
353
+ {
354
+ $versionMage = Mage::getVersion();
355
+ $versionPlugin = self::VERSION_PLUGIN;
356
+ $datetime = Mage::getModel('core/date')->date('Y-m-d\TH:i:s');
357
+
358
+ $data = array(
359
+ 'dateCreated' => $datetime,
360
+ 'diagnosticType' => "InstallPlugin",
361
+ 'description' => "Magento " . $versionMage . " Plugin " . $versionPlugin,
362
+ 'status' => "0"
363
+ );
364
+
365
+ return $data;
366
+ }
367
+
368
+ public function onDiagnosticInformationUpdated($data)
369
+ {
370
+ return $this->apiClient($data, 'control/api/plugin/onDiagnosticInformationUpdated');
371
+ }
372
+
373
+ public function PageInit($observer)
374
+ {
375
+ $http = Mage::helper('core/http');
376
+ $url = Mage::helper('core/url');
377
+ $customer = Mage::getSingleton('customer/session');
378
+ $admin = Mage::getSingleton('admin/session');
379
+
380
+ $customerId = $customer->getCustomer()->getId();
381
+ $isAdmin = $admin->isLoggedIn();
382
+
383
+ $product = array();
384
+
385
+ if (Mage::registry('current_product')) {
386
+
387
+ $id = Mage::registry('current_product')->getId();
388
+ $item = Mage::getModel('catalog/product')->load($id);
389
+ $categories = $item->getCategoryIds();
390
+
391
+ $product = array (
392
+ "product_id" => $id,
393
+ "product_name" => $item->getName(),
394
+ "product_desc" => $item->getDescription(),
395
+ "product_sku" => $item->GetData('sku'),
396
+ "product_image" => $item->getImageUrl(),
397
+ "product_url" => $url->getCurrentUrl(),
398
+ "product_qty" => 1,
399
+ "product_price" => $item->getFinalPrice(),
400
+ "product_total_val" => $item->getPrice(),
401
+ "product_categories" => array()
402
+ );
403
+
404
+ foreach ($categories as $categoryId) {
405
+
406
+ $category = Mage::getModel('catalog/category')->load($categoryId);
407
+ $product['product_categories'][] = $category->getName();
408
+ }
409
+ }
410
+
411
+ if ($this->getDeviceId() && $this->getDeviceId_1() && !$isAdmin) {
412
+
413
+ $customerData = Mage::getModel('customer/customer')->load($customerId);
414
+ $dateCreated = $customerId ? date('Y/m/d h:m:s', $customerData->getCreatedAtTimestamp()) : null;
415
+
416
+ $customer = array(
417
+ "device_id" => $this->getDeviceId(),
418
+ "device_id_1" => $this->getDeviceId_1(),
419
+ "customer_id" => $customerId,
420
+ "customer_first_name" => $customerData->getFirstname(),
421
+ "customer_last_name" => $customerData->getLastname(),
422
+ "customer_email" => $customerData->getEmail(),
423
+ "customer_date_created" => $dateCreated
424
+ );
425
+
426
+ $products = array($product);
427
+
428
+ $data = array(
429
+ "user_agent" => $http->getHttpUserAgent(),
430
+ "customer" => $customer,
431
+ "products" => $products
432
+ );
433
+ }
434
+ else {
435
+
436
+ $data = false;
437
+ }
438
+
439
+ return $data;
440
+ }
441
+
442
+ public function onPageInit($data)
443
+ {
444
+ return $this->apiClient($data, 'api/events/navigation');
445
+ }
446
+
447
+ public function getOrderHistory($observer)
448
+ {
449
+ $dataExport = false;
450
+
451
+ $fromDate = Mage::getStoreConfig(self::XML_PATH_DATE_FROM);
452
+ $toDate = Mage::getStoreConfig(self::XML_PATH_DATE_TO);
453
+
454
+ /* Format our dates */
455
+ $fromDate = date('Y-m-d H:i:s', strtotime($fromDate));
456
+ $toDate = date('Y-m-d H:i:s', strtotime($toDate));
457
+
458
+ $dataExport = array();
459
+
460
+ /* Get the collection */
461
+ $orders = Mage::getModel('sales/order')->getCollection()
462
+ ->addAttributeToFilter('created_at', array('from'=>$fromDate, 'to'=>$toDate));
463
+
464
+ foreach ($orders as $order) {
465
+
466
+ $customerId = $order->getCustomerId();
467
+ $customerData = Mage::getModel('customer/customer')->load($customerId);
468
+
469
+ $customer = array(
470
+ 'customer_id' => $customerId,
471
+ 'customer_first_name' => $order->getBillingAddress()->getFirstname(),
472
+ 'customer_last_name' => $order->getBillingAddress()->getLastname(),
473
+ 'customer_email' => $order->getCustomerEmail()
474
+ );
475
+
476
+ $ordersExport = array(
477
+ 'customer' => $customer,
478
+ 'order_id' => $order->getId(),
479
+ 'date_created' => $order->getCreatedAtStoreDate()->toString(Varien_Date::DATETIME_INTERNAL_FORMAT),
480
+ 'status' => $order->getStatus() ? $order->getStatus() : 'pending',
481
+ 'price_total' => number_format ($order->getGrandTotal(), 2, '.' , $thousands_sep = ''),
482
+ 'qty_total' => intval($order->getTotalItemCount()),
483
+ 'products' => array()
484
+ );
485
+
486
+ $orderItems = $order->getItemsCollection()
487
+ ->addAttributeToSelect('*')
488
+ ->addAttributeToFilter('product_type', array('eq'=>'simple'))
489
+ ->load();
490
+
491
+ foreach($orderItems as $item) {
492
+
493
+ // to prevent duplicate entries for configurable product - consider only child simple products
494
+ if($item->getProductType() == "simple")
495
+ {
496
+
497
+ $catalogProduct = $item->getProduct();
498
+ $productId = $catalogProduct->getId();
499
+ $productName = $catalogProduct->getName();
500
+ $productQty = $item->getQtyOrdered();
501
+ $productImage = Mage::getModel('catalog/product')->load($productId)->getImageUrl();
502
+
503
+ if ($item->getParentItem())
504
+ {
505
+ $productPrice = $item->getParentItem()->getPrice();
506
+ $productTotalVal = $item->getParentItem()->getRowTotal();
507
+ $parentIds = Mage::getModel('catalog/product_type_configurable')->getParentIdsByChild($productId);
508
+ $categories = Mage::getModel('catalog/product')->load($parentIds[0])->getCategoryIds();
509
+ }
510
+ else
511
+ {
512
+ $productPrice = $catalogProduct->getFinalPrice($item->getQtyOrdered());
513
+ $productTotalVal = $item->getRowTotal();
514
+ $categories = Mage::getModel('catalog/product')->load($productId)->getCategoryIds();
515
+ }
516
+
517
+
518
+ $itemData = array();
519
+ $itemData['product_id'] = $productId;
520
+ $itemData['product_name'] = $productName; //$this->normalizeName($productName);
521
+ $itemData['product_desc'] = $catalogProduct->getDescription();
522
+ $itemData['product_sku'] = $item->GetData('sku');
523
+ $itemData['product_image'] = $productImage;
524
+ $itemData['product_url'] = $catalogProduct->getProductUrl();
525
+ $itemData['product_qty'] = round($productQty);
526
+ $itemData['product_price'] = intval($productPrice);
527
+ $itemData['product_total_val'] = intval($productTotalVal);
528
+
529
+ $itemData['product_categories'] = array();
530
+
531
+ foreach ($categories as $categoryId) {
532
+
533
+ $category = Mage::getModel('catalog/category')->load($categoryId);
534
+ $itemData['product_categories'][] = $category->getName();
535
+ }
536
+
537
+ $ordersExport['products'][] = $itemData;
538
+
539
+ }
540
+ else
541
+ {
542
+ continue;
543
+ }
544
+ }
545
+
546
+ $dataExport['orders'][] = $ordersExport;
547
+ }
548
+
549
+ return $dataExport;
550
+ }
551
+
552
+ public function exportOrderHistory($data)
553
+ {
554
+ return $this->apiClient($data, 'api/events/history');
555
+ }
556
+
557
+ }
app/code/community/Triggmine/IntegrationModule/Model/Observer.php ADDED
@@ -0,0 +1,76 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Triggmine_IntegrationModule_Model_Observer
4
+ {
5
+ public function send_page_init(Varien_Event_Observer $observer)
6
+ {
7
+ if (Mage::helper('integrationmodule/data')->isEnabled())
8
+ {
9
+ $data = Mage::helper('integrationmodule/data')->PageInit($observer);
10
+ Mage::helper('integrationmodule/data')->onPageInit($data);
11
+ }
12
+ }
13
+
14
+ public function diagnostic_information_updated(Varien_Event_Observer $observer)
15
+ {
16
+ $data = Mage::helper('integrationmodule/data')->SoftChek($observer);
17
+ Mage::helper('integrationmodule/data')->onDiagnosticInformationUpdated($data);
18
+ }
19
+
20
+ public function export_order_history(Varien_Event_Observer $observer)
21
+ {
22
+ if (Mage::helper('integrationmodule/data')->isEnabled() &&
23
+ Mage::helper('integrationmodule/data')->exportEnabled())
24
+ {
25
+ $data = Mage::helper('integrationmodule/data')->getOrderHistory($observer);
26
+ Mage::helper('integrationmodule/data')->exportOrderHistory($data);
27
+ }
28
+ }
29
+
30
+ public function SalesOrderPlaceAfter(Varien_Event_Observer $observer)
31
+ {
32
+ if (Mage::helper('integrationmodule/data')->isEnabled())
33
+ {
34
+ $data = Mage::helper('integrationmodule/data')->getOrderData($observer);
35
+ Mage::helper('integrationmodule/data')->onConvertCartToOrder($data);
36
+ }
37
+ }
38
+
39
+ public function CheckoutCartSaveAfter(Varien_Event_Observer $observer)
40
+ {
41
+ if (Mage::helper('integrationmodule/data')->isEnabled())
42
+ {
43
+ $data = Mage::helper('integrationmodule/data')->getCartData();
44
+ Mage::helper('integrationmodule/data')->sendCart($data);
45
+ }
46
+ }
47
+
48
+ public function CustomerRegisterSuccess(Varien_Event_Observer $observer)
49
+ {
50
+ if (Mage::helper('integrationmodule/data')->isEnabled())
51
+ {
52
+ $event = $observer->getEvent();
53
+
54
+ $data = Mage::helper('integrationmodule/data')->getCustomerRegisterData($event);
55
+ Mage::helper('integrationmodule/data')->sendRegisterData($data);
56
+ }
57
+ }
58
+
59
+ public function CustomerLogin(Varien_Event_Observer $observer)
60
+ {
61
+ if (Mage::helper('integrationmodule/data')->isEnabled())
62
+ {
63
+ $data = Mage::helper('integrationmodule/data')->getCustomerLoginData();
64
+ Mage::helper('integrationmodule/data')->sendLoginData($data);
65
+ }
66
+ }
67
+
68
+ public function CustomerLogout(Varien_Event_Observer $observer)
69
+ {
70
+ if (Mage::helper('integrationmodule/data')->isEnabled())
71
+ {
72
+ $data = Mage::helper('integrationmodule/data')->getCustomerLoginData();
73
+ Mage::helper('integrationmodule/data')->sendLogoutData($data);
74
+ }
75
+ }
76
+ }
app/code/community/Triggmine/IntegrationModule/controllers/Adminhtml/IntegrationmodulebackendController.php ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Triggmine_IntegrationModule_Adminhtml_IntegrationmodulebackendController extends Mage_Adminhtml_Controller_Action
3
+ {
4
+ public function indexAction()
5
+ {
6
+ $this->loadLayout();
7
+ $this->_title($this->__("Triggmine Settings"));
8
+ $this->renderLayout();
9
+ }
10
+
11
+ public function importInitAction()
12
+ {
13
+
14
+ }
15
+ }
app/code/community/{Videal/Triggmine → Triggmine/IntegrationModule}/etc/adminhtml.xml RENAMED
@@ -8,7 +8,7 @@
8
  <children>
9
  <config>
10
  <children>
11
- <triggmine translate="title" module="triggmine">
12
  <title>Triggmine Section</title>
13
  <sort_order>600</sort_order>
14
  </triggmine>
8
  <children>
9
  <config>
10
  <children>
11
+ <triggmine translate="title" module="integrationmodule">
12
  <title>Triggmine Section</title>
13
  <sort_order>600</sort_order>
14
  </triggmine>
app/code/community/Triggmine/IntegrationModule/etc/config.xml ADDED
@@ -0,0 +1,178 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Triggmine_IntegrationModule>
5
+ <version>3.0.5</version>
6
+ </Triggmine_IntegrationModule>
7
+ </modules>
8
+ <global>
9
+ <helpers>
10
+ <integrationmodule>
11
+ <class>Triggmine_IntegrationModule_Helper</class>
12
+ </integrationmodule>
13
+ </helpers>
14
+ <blocks>
15
+ <integrationmodule>
16
+ <class>Triggmine_IntegrationModule_Block</class>
17
+ </integrationmodule>
18
+ </blocks>
19
+ <models>
20
+ <integrationmodule>
21
+ <class>Triggmine_IntegrationModule_Model</class>
22
+ <!--<resourceModel>integrationmodule_mysql4</resourceModel>-->
23
+ </integrationmodule>
24
+ </models>
25
+ <events>
26
+ <catalog_controller_product_init>
27
+ <observers>
28
+ <send_page_init_observer>
29
+ <type>singleton</type>
30
+ <class>integrationmodule/observer</class>
31
+ <method>send_page_init</method>
32
+ </send_page_init_observer>
33
+ </observers>
34
+ </catalog_controller_product_init>
35
+ <application_clean_cache> <!-- identifier of the event we want to catch -->
36
+ <observers>
37
+ <application_clean_cache_handler> <!-- identifier of the event handler -->
38
+ <type>model</type>
39
+ <class>integrationmodule/observer</class>
40
+ <method>diagnostic_information_updated</method>
41
+ <args></args>
42
+ </application_clean_cache_handler>
43
+ </observers>
44
+ </application_clean_cache>
45
+ <checkout_cart_add_product_complete> <!-- identifier of the event we want to catch -->
46
+ <observers>
47
+ <checkout_cart_add_product_complete_handler> <!-- identifier of the event handler -->
48
+ <type>model</type><!-- class method call type; valid are model, object and singleton -->
49
+ <class>integrationmodule/observer</class> <!-- observers class alias -->
50
+ <method>CheckoutCartSaveAfter</method> <!-- observer's method to be called -->
51
+ <args></args> <!-- additional arguments passed to observer -->
52
+ </checkout_cart_add_product_complete_handler>
53
+ </observers>
54
+ </checkout_cart_add_product_complete>
55
+ <checkout_cart_update_items_after> <!-- identifier of the event we want to catch -->
56
+ <observers>
57
+ <checkout_cart_update_items_after_handler> <!-- identifier of the event handler -->
58
+ <type>model</type> <!-- class method call type; valid are model, object and singleton -->
59
+ <class>integrationmodule/observer</class> <!-- observers class alias -->
60
+ <method>CheckoutCartSaveAfter</method> <!-- observer's method to be called -->
61
+ <args></args> <!-- additional arguments passed to observer -->
62
+ </checkout_cart_update_items_after_handler>
63
+ </observers>
64
+ </checkout_cart_update_items_after>
65
+ <sales_quote_remove_item> <!-- identifier of the event we want to catch -->
66
+ <observers>
67
+ <sales_quote_remove_item_handler> <!-- identifier of the event handler -->
68
+ <type>model</type> <!-- class method call type; valid are model, object and singleton -->
69
+ <class>integrationmodule/observer</class> <!-- observers class alias -->
70
+ <method>CheckoutCartSaveAfter</method><!-- observer's method to be called -->
71
+ <args></args><!-- additional arguments passed to observer -->
72
+ </sales_quote_remove_item_handler>
73
+ </observers>
74
+ </sales_quote_remove_item>
75
+ <sales_order_place_after> <!-- identifier of the event we want to catch -->
76
+ <observers>
77
+ <sales_order_place_after_handler> <!-- identifier of the event handler -->
78
+ <type>model</type> <!-- class method call type; valid are model, object and singleton -->
79
+ <class>integrationmodule/observer</class> <!-- observers class alias -->
80
+ <method>SalesOrderPlaceAfter</method> <!-- observer's method to be called -->
81
+ <args></args> <!-- additional arguments passed to observer -->
82
+ </sales_order_place_after_handler>
83
+ </observers>
84
+ </sales_order_place_after>
85
+ <customer_login> <!-- identifier of the event we want to catch -->
86
+ <observers>
87
+ <customer_login_handler> <!-- identifier of the event handler -->
88
+ <type>model</type>
89
+ <!-- class method call type; valid are model, object and singleton -->
90
+ <class>integrationmodule/observer</class>
91
+ <!-- observers class alias -->
92
+ <method>CustomerLogin</method>
93
+ <!-- observer's method to be called -->
94
+ <args></args>
95
+ <!-- additional arguments passed to observer -->
96
+ </customer_login_handler>
97
+ </observers>
98
+ </customer_login>
99
+ <customer_register_success> <!-- identifier of the event we want to catch -->
100
+ <observers>
101
+ <customer_register_success_handler> <!-- identifier of the event handler -->
102
+ <type>model</type>
103
+ <!-- class method call type; valid are model, object and singleton -->
104
+ <class>integrationmodule/observer</class>
105
+ <!-- observers class alias -->
106
+ <method>CustomerRegisterSuccess</method>
107
+ <!-- observer's method to be called -->
108
+ <args></args>
109
+ <!-- additional arguments passed to observer -->
110
+ </customer_register_success_handler>
111
+ </observers>
112
+ </customer_register_success>
113
+ <customer_logout> <!-- identifier of the event we want to catch -->
114
+ <observers>
115
+ <customer_logout_handler> <!-- identifier of the event handler -->
116
+ <type>model</type>
117
+ <!-- class method call type; valid are model, object and singleton -->
118
+ <class>integrationmodule/observer</class>
119
+ <!-- observers class alias -->
120
+ <method>CustomerLogout</method>
121
+ <!-- observer's method to be called -->
122
+ <args></args>
123
+ <!-- additional arguments passed to observer -->
124
+ </customer_logout_handler>
125
+ </observers>
126
+ </customer_logout>
127
+ </events>
128
+ </global>
129
+ <frontend>
130
+ <layout>
131
+ <updates>
132
+ <triggmine_integrationmodule>
133
+ <file>triggmine_integrationmodule.xml</file>
134
+ </triggmine_integrationmodule>
135
+ </updates>
136
+ </layout>
137
+ </frontend>
138
+ <admin>
139
+ <routers>
140
+ <integrationmodule>
141
+ <use>admin</use>
142
+ <args>
143
+ <module>Triggmine_IntegrationModule</module>
144
+ <frontName>admin_integrationmodule</frontName>
145
+ </args>
146
+ </integrationmodule>
147
+ </routers>
148
+ </admin>
149
+ <adminhtml>
150
+ <acl>
151
+ <resources>
152
+ <all>
153
+ <title>Allow Everything</title>
154
+ </all>
155
+ <admin>
156
+ <children>
157
+ <integrationmodule translate="title" module="integrationmodule">
158
+ <title>IntegrationModule</title>
159
+ <sort_order>1000</sort_order>
160
+ <children>
161
+ <integrationmodulebackend translate="title">
162
+ <title>Triggmine Settings</title>
163
+ </integrationmodulebackend>
164
+ </children>
165
+ </integrationmodule>
166
+ </children>
167
+ </admin>
168
+ </resources>
169
+ </acl>
170
+ <layout>
171
+ <updates>
172
+ <integrationmodule>
173
+ <file>integrationmodule.xml</file>
174
+ </integrationmodule>
175
+ </updates>
176
+ </layout>
177
+ </adminhtml>
178
+ </config>
app/code/community/Triggmine/IntegrationModule/etc/system.xml ADDED
@@ -0,0 +1,92 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <sections>
4
+ <triggmine translate="label" module="integrationmodule">
5
+ <label>Triggmine</label>
6
+ <tab>general</tab>
7
+ <frontend_type>text</frontend_type>
8
+ <sort_order>600</sort_order>
9
+ <show_in_default>1</show_in_default>
10
+ <show_in_website>1</show_in_website>
11
+ <show_in_store>1</show_in_store>
12
+ <groups>
13
+ <settings translate="label">
14
+ <label>Triggmine Settings</label>
15
+ <frontend_type>text</frontend_type>
16
+ <sort_order>10</sort_order>
17
+ <show_in_default>1</show_in_default>
18
+ <show_in_website>1</show_in_website>
19
+ <show_in_store>1</show_in_store>
20
+ <fields>
21
+ <is_on translate="label">
22
+ <label>Enable Triggmine</label>
23
+ <frontend_type>select</frontend_type>
24
+ <source_model>adminhtml/system_config_source_yesno</source_model>
25
+ <sort_order>10</sort_order>
26
+ <show_in_default>1</show_in_default>
27
+ <show_in_website>1</show_in_website>
28
+ <show_in_store>1</show_in_store>
29
+ </is_on>
30
+ <url_api translate="label">
31
+ <label>API</label>
32
+ <frontend_type>text</frontend_type>
33
+ <sort_order>40</sort_order>
34
+ <show_in_default>1</show_in_default>
35
+ <show_in_website>1</show_in_website>
36
+ <show_in_store>1</show_in_store>
37
+ <comment>Here...</comment>
38
+ </url_api>
39
+ <token translate="label">
40
+ <label>Token</label>
41
+ <frontend_type>text</frontend_type>
42
+ <sort_order>50</sort_order>
43
+ <show_in_default>1</show_in_default>
44
+ <show_in_website>1</show_in_website>
45
+ <show_in_store>1</show_in_store>
46
+ <comment>Here...</comment>
47
+ </token>
48
+ </fields>
49
+ </settings>
50
+ <triggmine_export translate="label" module="integrationmodule">
51
+ <label>Export orders history</label>
52
+ <frontend_type>text</frontend_type>
53
+ <sort_order>201</sort_order>
54
+ <show_in_default>1</show_in_default>
55
+ <show_in_website>1</show_in_website>
56
+ <show_in_store>1</show_in_store>
57
+ <fields>
58
+ <export translate="label">
59
+ <label>Enable Export</label>
60
+ <frontend_type>select</frontend_type>
61
+ <source_model>adminhtml/system_config_source_yesno</source_model>
62
+ <sort_order>50</sort_order>
63
+ <show_in_default>1</show_in_default>
64
+ <show_in_website>1</show_in_website>
65
+ <show_in_store>1</show_in_store>
66
+ </export>
67
+ <my_date_from translate="label">
68
+ <label>Export date from</label>
69
+ <frontend_type>text</frontend_type> <!-- Set the frontend type as Text -->
70
+ <frontend_model>integrationmodule/adminhtml_system_config_date</frontend_model> <!-- Specify our custom model -->
71
+ <sort_order>60</sort_order>
72
+ <show_in_default>1</show_in_default>
73
+ <show_in_website>1</show_in_website>
74
+ <show_in_store>1</show_in_store>
75
+ <comment>Set the Date from to export orders</comment>
76
+ </my_date_from>
77
+ <my_date_to translate="label">
78
+ <label>Export date to</label>
79
+ <frontend_type>text</frontend_type> <!-- Set the frontend type as Text -->
80
+ <frontend_model>integrationmodule/adminhtml_system_config_date</frontend_model> <!-- Specify our custom model -->
81
+ <sort_order>70</sort_order>
82
+ <show_in_default>1</show_in_default>
83
+ <show_in_website>1</show_in_website>
84
+ <show_in_store>1</show_in_store>
85
+ <comment>Set the Date to to export orders</comment>
86
+ </my_date_to>
87
+ </fields>
88
+ </triggmine_export>
89
+ </groups>
90
+ </triggmine>
91
+ </sections>
92
+ </config>
app/code/community/Videal/Triggmine/Block/Adminhtml/Triggminebackend.php DELETED
@@ -1,5 +0,0 @@
1
- <?php
2
-
3
- class Videal_Triggmine_Block_Adminhtml_Triggminebackend extends Mage_Adminhtml_Block_Template {
4
-
5
- }
 
 
 
 
 
app/code/community/Videal/Triggmine/Helper/Data.php DELETED
@@ -1,17 +0,0 @@
1
- <?php
2
- class Videal_Triggmine_Helper_Data extends Mage_Core_Helper_Abstract
3
- {
4
- const XML_PATH_ENABLED = 'triggmine/config/is_on';
5
- const XML_PATH_API_KEY = 'triggmine/config/rest_api';
6
-
7
- public function isEnabled($store = null)
8
- {
9
- return Mage::getStoreConfigFlag(self::XML_PATH_ENABLED, $store);
10
- }
11
-
12
- public function getAPIKey($store = null) {
13
- $api_key = Mage::getStoreConfig(self::XML_PATH_API_KEY, $store);
14
- return $api_key ? $api_key : false;
15
- }
16
- }
17
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Videal/Triggmine/Model/Observer.php DELETED
@@ -1,498 +0,0 @@
1
- <?php
2
- require_once dirname(__FILE__) . '/core/Core.php';
3
-
4
- class Videal_Triggmine_Model_Observer extends TriggMine_Core
5
- {
6
- const VERSION = '2.0.0';
7
- const SETTING_EXPORT = 'triggmine_send_export';
8
-
9
- private $_scriptFiles = array();
10
- private $_scripts = array();
11
-
12
- /**
13
- * Tells whether current request is AJAX one.
14
- * AJAX doesn't equal to async.
15
- * @return bool
16
- */
17
- public function isAjaxRequest()
18
- {
19
- return Mage::app()->getFrontController()->getRequest()->isAjax();
20
- }
21
-
22
- /**
23
- * Tells about JS support in the integrator.
24
- * @return bool
25
- */
26
- public function supportsJavaScript()
27
- {
28
- return true;
29
- }
30
-
31
- function __construct()
32
- {
33
- parent::__construct();
34
-
35
- }
36
-
37
- /**
38
- * Adds JS into the HTML.
39
- * @param string $script JS code.
40
- */
41
- public function registerJavaScript($script)
42
- {
43
- $this->_scripts[] = $script;
44
- }
45
-
46
- /**
47
- * Adds &lt;script&gt; tag into the HTML.
48
- * Modifies the URL depending on whether it is a plugin file or not.
49
- * @param string $url Relative or absolute URL of the JS file.
50
- * @param bool $isPluginFile Is it a part of plugin?
51
- */
52
- public function registerJavaScriptFile($url, $isPluginFile = true)
53
- {
54
- $this->_scriptFiles[] = $isPluginFile ?
55
- Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_JS) . $url :
56
- $url
57
- ;
58
- }
59
-
60
- public function outputJavaScript() {
61
- foreach ($this->_scriptFiles as $scriptFile) {
62
- echo "<script type='text/javascript' src='$scriptFile'></script>" . PHP_EOL;
63
- }
64
-
65
- foreach ($this->_scripts as $script) {
66
- echo "<script type='text/javascript'>/* <![CDATA[ */ $script /* ]]> */</script>" . PHP_EOL;
67
- }
68
- }
69
-
70
- public function onFooterEvent()
71
- {
72
- if(!$this->isAjaxRequest()) {
73
- $this->registerJavaScriptFile('videal/triggmine/api.js', true);
74
- parent::onPageLoaded();
75
- $this->outputJavaScript();
76
- }
77
- }
78
- /**
79
- * Returns URL of the website.
80
- */
81
- public function getSiteUrl()
82
- {
83
- return Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB);
84
- }
85
-
86
- /**
87
- * Returns array with buyer info [BuyerEmail, FirstName, LastName].
88
- */
89
- public function getBuyerInfo()
90
- {
91
- $customer = Mage::getSingleton('customer/session')->getCustomer()->getData();
92
- return array(
93
- 'BuyerEmail' => $customer['email'],
94
- 'FirstName' => $customer['firstname'],
95
- 'LastName' => $customer['lastname']
96
- );
97
- }
98
-
99
- /**
100
- * Returns absolute URL to the shopping cart page.
101
- * @return string Shopping cart URL.
102
- */
103
- public function getCartUrl()
104
- {
105
- return Mage::helper('checkout/cart')->getCartUrl();
106
- }
107
-
108
- /**
109
- * Returns a name of your CMS / eCommerce platform.
110
- * @return string Agent name.
111
- */
112
- public function getAgent()
113
- {
114
- return 'Magento';
115
- }
116
-
117
- /**
118
- * Returns a version of your CMS / eCommerce platform.
119
- * @return string Version.
120
- */
121
- public function getAgentVersion()
122
- {
123
- return Mage::getVersion();
124
- }
125
-
126
- /**
127
- * Tells whether current user is admin.
128
- * @return bool Is user an administrator.
129
- */
130
- protected function _isUserAdmin()
131
- {
132
- return Mage::app()->getStore()->isAdmin();
133
- }
134
-
135
- protected function _fillShoppingCart($cartContent)
136
- {
137
- if ( empty( $cartContent['Items'] ) ) {
138
- return false;
139
- }
140
-
141
- $oCart = Mage::getSingleton('checkout/cart');
142
-
143
- $oCart->getQuote()->removeAllItems();
144
-
145
- $cartItems = $cartContent['Items'];
146
-
147
- foreach ( $cartItems as $aProduct ) {
148
- unset($ids, $iProductId, $aOptions, $aOptionIds, $sOptionIds);
149
- $ids = explode('|', $aProduct['CartItemId']);
150
- $iProductId = array_shift($ids);
151
-
152
- if ( !empty($ids) )
153
- {
154
- $aOptions['options'] = array();
155
- foreach ( $ids as $sOptionIds )
156
- {
157
- $aOptionIds = explode('_', $sOptionIds);
158
- $aOptions['options'][$aOptionIds[0]] = $aOptionIds[1];
159
- }
160
- }
161
-
162
- $aOptions['qty'] = $aProduct['Count'];
163
- $aOptions['product'] = $iProductId;
164
-
165
- $oCart->addProduct($iProductId, $aOptions);
166
- }
167
-
168
- $oCart->saveQuote();
169
- Mage::app()->getFrontController()->getResponse()->setRedirect(Mage::getUrl('checkout/cart'));
170
- }
171
-
172
- public function install()
173
- {
174
-
175
- }
176
-
177
- public function uninstall()
178
- {
179
-
180
- }
181
-
182
- /**
183
- * Returns a value of the setting having given name.
184
- * @param string $key Setting name.
185
- * @return string Setting value.
186
- */
187
- protected function _getSettingValue($key)
188
- {
189
- $key = str_replace('triggmine_', 'triggmine/config/', $key);
190
-
191
- return Mage::getStoreConfig($key);
192
- }
193
-
194
- public function onCartItemAddedFromWishList(Varien_Event_Observer $observer)
195
- {
196
- $data = $this->_refillShoppingCart();
197
-
198
- $this->updateCartFull($data);
199
- }
200
-
201
- public function onCartItemAdded(Varien_Event_Observer $observer)
202
- {
203
- $products = Mage::getSingleton('checkout/session')->getQuote()->getAllVisibleItems();
204
- foreach ( $products as $product )
205
- {
206
- if ( !$catalogProduct = $observer->getEvent()->getProduct() ) throw new Exception('No productModel');
207
- if ( $catalogProduct->getId() != $product->getProductId() ) continue;
208
- if ( !$productId = $catalogProduct->getId() ) throw new Exception('No productId');
209
- if ( !$productName = $catalogProduct->getName() ) throw new Exception('No productName');
210
- if ( !$productPrice = $catalogProduct->getPrice() ) throw new Exception('No productPrice');
211
- if ( !$productQty = $product->getQty() ) throw new Exception('No productQnt');
212
-
213
- if ( $options = $product->getBuyRequest()->getData('options') )
214
- {
215
- foreach ( $options as $typeId => $optionId )
216
- $productId .= '|' . $typeId . '_' . $optionId;
217
- }
218
-
219
- $data = array(
220
- "CartItemId" => (string) $productId,
221
- "ThumbnailUrl" => $catalogProduct->getSmallImageUrl(),
222
- "ImageUrl" => $catalogProduct->getImageUrl(),
223
- "Title" => $productName,
224
- "ShortDescription" => $catalogProduct->getShortDescription(),
225
- "Description" => $catalogProduct->getDescription(),
226
-
227
- "Price" => $productPrice,
228
- "Count" => $productQty,
229
- );
230
- }
231
- $this->addCartItem($data);
232
- }
233
-
234
- public function onCartItemDeleted(Varien_Event_Observer $observer)
235
- {
236
- $product = $observer->getEvent()->getQuoteItem();
237
-
238
- $productId = $product->getProductId();
239
- $this->deleteCartItem( $productId );
240
- }
241
-
242
- public function onCartItemUpdated(Varien_Event_Observer $observer)
243
- {
244
- $products = Mage::getSingleton('checkout/session')->getQuote()->getAllVisibleItems();
245
- $newProducts = $observer->info;
246
-
247
- foreach ( $products as $product )
248
- {
249
- foreach ( $newProducts as $newProductId => $newProduct )
250
- {
251
- if ( $newProductId != $product->getId() || $newProduct['qty'] == $product->getQty() ) continue;
252
-
253
- if ( !$productId = $product->getProductId() ) throw new Exception('No productId');
254
- if ( !$productName = $product->getName() ) throw new Exception('No productName');
255
-
256
- if ( $options = $product->getBuyRequest()->getData('options') )
257
- {
258
- foreach ( $options as $typeId => $optionId )
259
- $productId .= '|' . $typeId . '_' . $optionId;
260
- }
261
-
262
- $obj = Mage::getModel('catalog/product');
263
- $_product = $obj->load($productId); // Enter your Product Id in $product_id
264
-
265
- $data = array(
266
- "CartItemId" => (string) $productId,
267
- "ThumbnailUrl" => $product->getProduct()->getSmallImageUrl(),
268
- "ImageUrl" => $product->getProduct()->getImageUrl(),
269
- "Title" => $productName,
270
- "ShortDescription" => $_product->getShortDescription(),
271
- "Description" => $_product->getDescription(),
272
-
273
- "Price" => $product->getProduct()->getPrice(),
274
- "Count" => $newProduct['qty'],
275
- );
276
- }
277
- }
278
-
279
- $this->updateCartItem($data);
280
- }
281
-
282
- public function onCartCleanedUp(Varien_Event_Observer $observer)
283
- {
284
- if ( Mage::app()->getFrontController()->getRequest()->getParam('update_cart_action') == "empty_cart" ) {
285
- $this->cleanupCart();
286
- }
287
-
288
- }
289
-
290
- public function onBuyerLoggedIn(Varien_Event_Observer $observer)
291
- {
292
- $this->logInBuyer( $this->getBuyerInfo() );
293
-
294
- $data = $this->_refillShoppingCart();
295
-
296
- $this->updateCartFull($data);
297
- }
298
-
299
- public function _refillShoppingCart()
300
- {
301
- $quote = Mage::getSingleton('checkout/session')->loadCustomerQuote()->getQuote();
302
-
303
- $cart = array();
304
-
305
- foreach ($quote->getAllItems() as $item)
306
- {
307
- $productID = $item->getProductId();
308
- $product = Mage::getModel('catalog/product')->load($productID);
309
-
310
- $data = array(
311
- 'CartItemId' => (string) $productID,
312
- 'Title' => $item->getName(),
313
- 'Price' => (string) number_format($item->getPrice(), 2, ".", ""),
314
- 'Count' => (string) $item->getQty(),
315
- 'Description' => $product->getDescription(),
316
- 'ImageUrl' => $product->getImageUrl()
317
- );
318
-
319
-
320
- if ($data['Price'] != '0.00') {
321
- $cart['Items'][] = $data;
322
- }
323
- }
324
-
325
- return $cart;
326
- }
327
-
328
- public function onBuyerLoggedOut(Varien_Event_Observer $observer)
329
- {
330
- $this->logOutBuyer();
331
- }
332
-
333
- public function onCartPurchased(Varien_Event_Observer $observer)
334
- {
335
- $this->purchaseCart( $this->getBuyerInfo() );
336
- }
337
-
338
- public function onPageLoaded(Varien_Event_Observer $observer)
339
- {
340
- if(!$this->isAjaxRequest()) {
341
- parent::onPageLoaded();
342
- $this->outputJavaScript();
343
- }
344
- }
345
-
346
- public function onBuyerRegister(Varien_Event_Observer $observer)
347
- {
348
- $email = $observer->getEvent()->getCustomer()->getEmail();
349
- $this->logInBuyer( $email );
350
- }
351
-
352
- protected function _prepareCartItemData(Varien_Event_Observer $observer)
353
- {
354
- $product = $observer->getEvent()->getData('product');
355
- $productId = $product->getId();
356
-
357
- if ( $options = $product->getOptions() )
358
- {
359
- foreach ( $options as $typeId => $optionId )
360
- $productId .= '|' . $typeId . '_' . $optionId;
361
- }
362
-
363
- $data = array(
364
- 'CartItemId' => $productId,
365
- 'Title' => $product->getName(),
366
- 'Description' => $product->getDescription(),
367
- 'ShortDescription' => $product->getShortDescription(),
368
- 'Price' => $product->getPrice(),
369
- 'Count' => $product->getQty(),
370
- "ThumbnailUrl" => $product->getSmallImageUrl(),
371
- "ImageUrl" => $product->getImageUrl(),
372
- );
373
-
374
- return $data;
375
- }
376
-
377
- protected function _getUserDataFromDatabase($email)
378
- {
379
- $customer = Mage::getModel("customer/customer");
380
- $customer->setWebsiteId(Mage::app()->getWebsite()->getId());
381
- $customer->loadByEmail($email);
382
-
383
- if ( $customer->getId() ) {
384
- $user = $customer->getData();
385
-
386
- $data = array(
387
- 'BuyerRegEnd' => gmdate ( "Y-m-d H:i:s", strtotime( $user['created_at'] ) )
388
- );
389
-
390
- return $data;
391
- }
392
-
393
- $data = array(
394
- 'BuyerRegStart' => gmdate( "Y-m-d H:i:s", time() )
395
- );
396
-
397
- return $data;
398
- }
399
-
400
- /**
401
- * Returns a json string of orders
402
- *
403
- * @param $data
404
- *
405
- * @return string Json
406
- */
407
- public function exportOrders($data)
408
- {
409
- $span = $data->Span;
410
- $span = explode('-', $span);
411
- $spanMax= $span[1];
412
- $offset = (int) $data->Offset;
413
- $next = (int) $data->Next;
414
- $nextQ = $offset + $next - 1;
415
- $mainOutput = array();
416
-
417
- for ($i = $offset; $i <= $nextQ; $i++) {
418
- $order = Mage::getModel('sales/order')->load($i);
419
- if($order) {
420
- $localOutput = array();
421
- $orderData = $order->getData();
422
-
423
- $localOutput['CartId'] = $orderData['entity_id']; //Purchase ID
424
- $localOutput['Amount'] = number_format ($order->getGrandTotal(), 2, '.' , $thousands_sep = ''); //Purchase Total
425
- $localOutput['DateTime'] = gmdate( "Y-m-d H:i:s\Z", strtotime($orderData['created_at']) );
426
- $localOutput['State'] = ( $orderData['state'] == 'new' ) ? 1 : 2;
427
- $localOutput['Email'] = $orderData['customer_email'];
428
-
429
- $orderItems = $order->getItemsCollection();
430
-
431
- foreach ($orderItems as $item){
432
- $orderProductID = $item->getProductId();
433
- $product = Mage::getModel('catalog/product')->load($orderProductID);
434
-
435
- $data = array(
436
- 'CartItemId' => (string) $orderProductID,
437
- 'Title' => $item->getName(),
438
- 'Price' => (string) number_format($item->getPrice(), 2, ".", ""),
439
- 'Count' => (string) $item->getQtyOrdered(),
440
- 'Description' => $product->getDescription(),
441
- 'ImageUrl' => $product->getImageUrl()
442
- );
443
-
444
- $localOutput['Content'][] = $data;
445
- }
446
- $mainOutput[] = $localOutput;
447
- }
448
- }
449
-
450
- return $mainOutput;
451
- }
452
-
453
- public function onChangedTriggmine(Varien_Event_Observer $observer)
454
- {
455
-
456
- $test = $this->test();
457
- if ($test === true) {
458
- if ($this->_getSettingValue(self::SETTING_IS_ON)) {
459
- $this->activate();
460
- } else {
461
- $this->deactivate();
462
- }
463
- if ($this->_getSettingValue(self::SETTING_EXPORT)) {
464
- $this->onSendExport('all');
465
- }
466
- } else {
467
- Mage::throwException($test);
468
- }
469
- }
470
-
471
- protected function _onSendExport($input)
472
- {
473
- $data = $this->_prepareExportData($input);
474
- $this->sendExport($data);
475
- }
476
-
477
- protected function _prepareExportData($input)
478
- {
479
- if($input == 'all') {
480
- $orders = Mage::getModel("sales/order")->getCollection();
481
- $lastFirstId = $orders->getFirstItem()->getId();
482
- $lastOrderId = $orders->getLastItem()->getId();
483
-
484
- if ($lastFirstId && $lastFirstId) {
485
- $data = array(
486
- 'Url' => $this->getSiteUrl() . '/?' . self::KEY_TRIGGMINE_EXPORT,
487
- 'Span' => '' . $lastFirstId . '-' . $lastOrderId . ''
488
- );
489
-
490
- return $data;
491
- } else {
492
- return false;
493
- }
494
- }
495
-
496
- return false;
497
- }
498
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Videal/Triggmine/Model/core/ApiClient.php DELETED
@@ -1,406 +0,0 @@
1
- <?php
2
-
3
- final class TriggMine_ApiClient
4
- {
5
- const VERSION = '1.0.7';
6
-
7
- /**
8
- * Keys to be used in code.
9
- */
10
- const KEY_AGENT = 'Agent';
11
- const KEY_BUYER_ID = 'BuyerId';
12
- const KEY_BUYER_EMAIL = 'BuyerEmail';
13
- const KEY_BUYER_BIRTHDAY = 'BuyerBirthday';
14
- const KEY_BUYER_REG_START = 'BuyerRegStart';
15
- const KEY_BUYER_REG_END = 'BuyerRegEnd';
16
- const KEY_CART_ID = 'CartId';
17
- const KEY_CART_URL = 'CartUrl';
18
- const KEY_REDIRECT_ID = 'RedirectId';
19
- const KEY_TOKEN = 'Token';
20
- const KEY_VISITOR_ID = 'VisitorId';
21
- const KEY_CART_PING_TIME = 'CartPingTime';
22
- const KEY_CONVERSION_ID = 'ConversionId';
23
-
24
- const KEY_MAIN_API_SUFFIX = 'api/Cart';
25
-
26
- private $_actionMapping = array(
27
- 'log' => array(
28
- 'method' => 'Log'
29
- ),
30
- 'activate' => array(
31
- 'method' => 'Activate'
32
- ),
33
- 'deactivate' => array(
34
- 'method' => 'Deactivate'
35
- ),
36
- 'sendExport' => array(
37
- 'method' => 'Import',
38
- ),
39
- 'getVisitor' => array(
40
- 'method' => 'GetVisitorId',
41
- 'paramsOut' => array(self::KEY_AGENT, self::KEY_VISITOR_ID),
42
- 'paramsIn' => array(self::KEY_VISITOR_ID)
43
- ),
44
- 'getBuyerEmail' => array(
45
- 'method' => 'GetBuyerEmail',
46
- 'paramsOut' => array(self::KEY_BUYER_ID)
47
- ),
48
- 'getBuyerByEmail' => array(
49
- 'method' => 'GetBuyerId',
50
- 'paramsOut'=> array(self::KEY_BUYER_ID),
51
- 'paramsIn' => array(self::KEY_BUYER_ID)
52
- ),
53
- 'getNewBuyer' => array(
54
- 'method' => 'GetBuyerId',
55
- 'paramsIn' => array(self::KEY_BUYER_ID)
56
- ),
57
- 'updateBuyer' => array(
58
- 'method' => 'CreateReplaceBuyerInfo',
59
- 'paramsOut' => array(self::KEY_BUYER_ID)
60
- ),
61
- 'setBuyerBirthday' => array(
62
- 'method' => 'SetBuyerBirthday',
63
- 'paramsOut' => array(self::KEY_BUYER_ID, self::KEY_BUYER_EMAIL, self::KEY_BUYER_BIRTHDAY)
64
- ),
65
- 'setBuyerRegStart' => array(
66
- 'method' => 'SetBuyerRegStart',
67
- 'paramsOut' => array(self::KEY_BUYER_ID, self::KEY_BUYER_EMAIL, self::KEY_BUYER_REG_START)
68
- ),
69
- 'setBuyerRegEnd' => array(
70
- 'method' => 'SetBuyerRegEnd',
71
- 'paramsOut' => array(self::KEY_BUYER_ID, self::KEY_BUYER_EMAIL, self::KEY_BUYER_REG_END)
72
- ),
73
- 'getNewCart' => array(
74
- 'method' => 'GetCartId',
75
- 'paramsOut' => array(self::KEY_BUYER_ID),
76
- 'paramsIn' => array(self::KEY_BUYER_ID, self::KEY_CART_ID)
77
- ),
78
- 'addCartItem' => array(
79
- 'method' => 'CreateReplaceCartItem',
80
- 'paramsOut' => array(self::KEY_BUYER_ID, self::KEY_CART_ID, self::KEY_CART_URL),
81
- 'paramsIn' => array(self::KEY_BUYER_ID, self::KEY_CART_ID)
82
- ),
83
- 'updateCartItem' => array(
84
- 'method' => 'CreateReplaceCartItem',
85
- 'paramsOut' => array(self::KEY_BUYER_ID, self::KEY_CART_ID, self::KEY_CART_URL),
86
- 'paramsIn' => array(self::KEY_BUYER_ID, self::KEY_CART_ID)
87
- ),
88
- 'updateCartFull' => array(
89
- 'method' => 'CreateReplaceCart',
90
- 'paramsOut' => array(self::KEY_BUYER_ID, self::KEY_CART_ID, self::KEY_CART_URL),
91
- 'paramsIn' => array(self::KEY_BUYER_ID, self::KEY_CART_ID)
92
- ),
93
- 'deleteCartItem' => array(
94
- 'method' => 'DeleteCartItem',
95
- 'paramsOut' => array(self::KEY_BUYER_ID, self::KEY_CART_ID)
96
- ),
97
- 'cleanupCart' => array(
98
- 'method' => 'CleanupCart',
99
- 'paramsOut' => array(self::KEY_BUYER_ID, self::KEY_CART_ID)
100
- ),
101
- 'purchaseCart' => array(
102
- 'method' => 'PurchaseCart',
103
- 'paramsOut' => array(self::KEY_BUYER_ID, self::KEY_CART_ID, self::KEY_REDIRECT_ID, self::KEY_CONVERSION_ID)
104
- ),
105
- 'getCartContent' => array(
106
- 'method' => 'GetCartContent',
107
- 'paramsOut' => array(self::KEY_BUYER_ID, self::KEY_CART_ID)
108
- ),
109
- 'pingCart' => array(
110
- 'method' => 'PingCart',
111
- 'paramsOut' => array(self::KEY_AGENT, self::KEY_BUYER_ID, self::KEY_CART_ID),
112
- 'paramsIn' => array(self::KEY_CART_PING_TIME)
113
- ),
114
-
115
- );
116
-
117
- /**
118
- * @var TriggMine_Core
119
- */
120
- private $_integrator = null;
121
-
122
- /**
123
- * URL of API.
124
- * @var string
125
- */
126
- private $_apiUrl = null;
127
-
128
- /**
129
- * API access token.
130
- * @var string
131
- */
132
- private $_token = null;
133
-
134
- public function __construct(TriggMine_Core $integrator)
135
- {
136
- $this->_integrator = $integrator;
137
- $this->_apiUrl = $this->_integrator->_restApi;
138
- $this->_token = $this->_integrator->_token;
139
- }
140
-
141
- /**
142
- * Makes request to API server.
143
- *
144
- * @param array $request Data to send.
145
- * @param array $response [optional]<br />Please provide if you need actual response.
146
- *
147
- * @return bool Is request successful.
148
- */
149
- public function request($request, &$response = null)
150
- {
151
- if (!($this->_apiUrl && $this->_token)) {
152
- return false;
153
- }
154
-
155
- try {
156
- $this->_processOutgoingData($request);
157
-
158
- TriggMine_Helper::encodeArray($request, $this->_integrator->getCharset());
159
-
160
- if ($this->_integrator->supportsJavaScript()
161
- && !$this->_integrator->isAjaxRequest()
162
- && !$this->_integrator->isAsyncRequest()
163
- && in_array($request['_action'], array('getVisitor'))
164
- ) {
165
- // Can't handle any other actions.
166
- // In case of redirect other method calls can be lost in case of redirect,
167
- // which often happens in CMS after the cart purchase, for example.
168
- $this->_registerAsyncRequest($request);
169
- } elseif (in_array($request['_action'], array('onPingCart'))) {
170
- $this->_integrator->pingCart();
171
- } elseif (in_array($request['_action'], array('onUpdateBuyerEmail'))) {
172
- $this->_integrator->updateBuyerEmail($request['Data']);
173
- } else {
174
- $url = strstr($this->_apiUrl, 'http://') ? $this->_apiUrl : 'http://' . $this->_apiUrl;
175
- $url .= substr($url, -1) === '/' ? '' : '/';
176
- $url .= self::KEY_MAIN_API_SUFFIX;
177
- $result = false;
178
-
179
- if (TriggMine_Helper::isCurlEnabled()) {
180
- $result = $this->_curlRequest($url, $request);
181
- } else if (TriggMine_Helper::isUrlFopenEnabled()) {
182
- $result = $this->_fopenRequest($url, $request);
183
- }
184
-
185
- $response = json_decode($result, true);
186
-
187
- $this->_processIncomingData($request, $response);
188
- TriggMine_Helper::encodeArray($response, $this->_integrator->getCharset(), true);
189
-
190
- }
191
- } catch (Exception $e) {
192
- if ($request['_action'] != 'Log') {
193
- // It's not 'Log' method failed, so no recursion will occure
194
- $this->reportError($e, $response ? $response['LogId'] : null);
195
- }
196
- }
197
-
198
- if ($isResponseNull = TriggMine_Error::isResponseNull($response)) {
199
- return $isResponseNull;
200
- } elseif (!TriggMine_Error::isError($response['ErrorCode'])) {
201
- return true;
202
- } else {
203
- return TriggMine_Error::getByCode($response['ErrorCode']);
204
- }
205
- }
206
-
207
- /**
208
- * Checks outgoing data whether it contains all needed information.
209
- *
210
- * @param array $request
211
- */
212
- private function _processOutgoingData(&$request)
213
- {
214
- // Always send token
215
- $request[self::KEY_TOKEN] = $this->_token;
216
-
217
- // Always send Data array having at least something inside
218
- isset($request['Data']) || $request['Data'] = array('dummy' => 1);
219
- if (isset($this->_actionMapping[$request['_action']])) {
220
- $actionMapping = $this->_actionMapping[$request['_action']];
221
- } else {
222
- $actionMapping = array('method' => ucfirst($request['_action']));
223
- }
224
-
225
- $request['Method'] = $actionMapping['method'];
226
- $paramsOut = isset($actionMapping['paramsOut']) ? $actionMapping['paramsOut'] : array();
227
-
228
- foreach ($paramsOut as $paramName) {
229
- if (empty($request['Data'][$paramName])) {
230
- switch ($paramName) {
231
- case self::KEY_AGENT:
232
- $value = $this->_integrator->getAgent();
233
- break;
234
-
235
- case self::KEY_VISITOR_ID:
236
- $value = $this->_integrator->getVisitorId();
237
- break;
238
-
239
- case self::KEY_BUYER_ID:
240
- $value = $this->_integrator->getBuyerId();
241
- break;
242
-
243
- case self::KEY_CART_ID:
244
- $value = $this->_integrator->getCartId();
245
- break;
246
-
247
- case self::KEY_REDIRECT_ID:
248
- $value = $this->_integrator->getRedirectId();
249
- break;
250
-
251
- case self::KEY_CART_URL:
252
- $value = $this->_integrator->getCartUrl();
253
- break;
254
-
255
- case self::KEY_CONVERSION_ID:
256
- $value = $this->_integrator->getСonversionId();
257
- break;
258
-
259
- default:
260
- $value = null;
261
- }
262
-
263
- if ($value) {
264
- $request['Data'][$paramName] = $value;
265
- }
266
- }
267
- }
268
- }
269
-
270
- /**
271
- * Registers fake JavaScript file to be loaded on the client-side.
272
- * &lt;script&gt; tag will invoke an asynchronous API request.
273
- *
274
- * @param array $request
275
- */
276
- private function _registerAsyncRequest($request)
277
- {
278
- $url = $this->_integrator->getSiteUrl() . '?triggmine_async=1&';
279
- $url .= http_build_query(array(
280
- '_action' => $request['_action'],
281
- 'Data' => json_encode($request['Data'])
282
- ));
283
-
284
- // Adding salt to avoid caching
285
- $url .= '&salt=' . substr(str_shuffle('0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'), 0, 8);
286
-
287
- $this->_integrator->registerJavaScriptFile($url, false);
288
- }
289
-
290
- /**
291
- * Performs CURL request.
292
- *
293
- * @param string $url
294
- * @param array $data
295
- *
296
- * @return bool
297
- */
298
- private function _curlRequest($url, $data)
299
- {
300
- $curl = curl_init();
301
- curl_setopt($curl, CURLOPT_URL, $url);
302
- curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
303
- curl_setopt($curl, CURLOPT_POST, true);
304
- curl_setopt($curl, CURLOPT_HTTPHEADER, array('Content-Type: application/json', 'Accept: application/json'));
305
- curl_setopt($curl, CURLOPT_POSTFIELDS, json_encode($data));
306
- $result = curl_exec($curl);
307
- curl_close($curl);
308
-
309
- return $result;
310
- }
311
-
312
- /**
313
- * Performs file open request.
314
- *
315
- * @param $url
316
- * @param $data
317
- *
318
- * @return string
319
- * @throws Exception
320
- *
321
- */
322
- private function _fopenRequest($url, $data)
323
- {
324
- $options = array(
325
- 'http' => array(
326
- 'method' => 'POST',
327
- 'content' => json_encode($data),
328
- 'header' => "Content-Type: application/json\r\n" . "Accept: application/json\r\n"
329
- )
330
- );
331
-
332
- if (!$context = stream_context_create($options)) {
333
- throw new Exception("Request failed. Can't create stream context.");
334
- }
335
-
336
- if (!$result = @file_get_contents($url, false, $context)) {
337
- throw new Exception('Error occured.');
338
- }
339
-
340
- return $result;
341
- }
342
-
343
- /**
344
- * Persists all needed information from the incoming data set.
345
- *
346
- * @param array $request
347
- * @param array $response
348
- */
349
- private function _processIncomingData($request, $response)
350
- {
351
- $actionMapping = $this->_actionMapping[$request['_action']];
352
- $paramsIn = isset($actionMapping['paramsIn']) ? $actionMapping['paramsIn'] : array();
353
- foreach ($paramsIn as $paramName) {
354
- if (!empty($response['Data'][$paramName]) || $paramName === self::KEY_CART_PING_TIME) {
355
- switch ($paramName) {
356
- case self::KEY_BUYER_ID:
357
- $this->_integrator->setBuyerId($response['Data'][$paramName]);
358
- break;
359
-
360
- case self::KEY_CART_ID:
361
- $this->_integrator->setCartId($response['Data'][$paramName]);
362
- break;
363
-
364
- case self::KEY_VISITOR_ID:
365
- $this->_integrator->setVisitorId($response['Data'][$paramName]);
366
- $this->_integrator->setVisitorCalled();
367
- break;
368
-
369
- case self::KEY_REDIRECT_ID:
370
- $this->_integrator->setRedirectId($response['Data'][$paramName]);
371
- break;
372
-
373
- case self::KEY_CART_PING_TIME:
374
- $this->_integrator->setCartPingTime(time());
375
- break;
376
- }
377
- }
378
- }
379
- }
380
-
381
- /**
382
- * Reports an error to the API server.
383
- *
384
- * @param mixed $error Exception or string.
385
- * @param string $logId [optional] LogId, if present after another API method request.
386
- */
387
- public function reportError($error, $logId = null)
388
- {
389
- if ($error instanceof Exception) {
390
- $error = $error->getMessage() . "\n" . $error->getTraceAsString();
391
- }
392
-
393
- $data = array(
394
- '_action' => 'log',
395
- 'Data' => array(
396
- 'Description' => $error
397
- )
398
- );
399
-
400
- if ($logId) {
401
- $data['Data']['LogId'] = $logId;
402
- }
403
-
404
- $this->request($data);
405
- }
406
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Videal/Triggmine/Model/core/Core.php DELETED
@@ -1,1069 +0,0 @@
1
- <?php
2
- include dirname(__FILE__) . '/ApiClient.php';
3
- include dirname(__FILE__) . '/Helper.php';
4
- include dirname(__FILE__) . '/Error.php';
5
-
6
- abstract class TriggMine_Core
7
- {
8
- const VERSION = '1.0.7';
9
-
10
- /**
11
- * Keys to be used in code.
12
- */
13
- const KEY_CART_PING_TIME = 'CartPingTime';
14
- const KEY_TRIGGMINE = 'triggmine';
15
- const KEY_TRIGGMINE_ASYNC = 'triggmine_async';
16
- const KEY_TRIGGMINE_VERSION = 'triggmine_version';
17
- const KEY_TRIGGMINE_EXPORT = 'triggmine_export';
18
-
19
- const SETTING_IS_ON = 'triggmine_is_on';
20
- const SETTING_REST_API = 'triggmine_rest_api';
21
- const SETTING_TOKEN = 'triggmine_token';
22
-
23
- const CART_PING_INTERVAL = 60; // seconds
24
-
25
- const MSG_IMPLEMENT_IN_INTEGRATOR = 'Method has to be implemented in the Integrator class.';
26
-
27
- /**
28
- * State flag: handling events at the moment.
29
- * @var bool
30
- */
31
- protected $_handleEvents = true;
32
-
33
- /**
34
- * Plugin setting: is plugin active.
35
- * @var bool
36
- */
37
- protected $_isOn = null;
38
-
39
- /**
40
- * Is it an asynchronous request.
41
- * @var bool
42
- */
43
- protected $_isAsync = false;
44
- /**
45
- * @var string
46
- */
47
- protected $_buyerId = null;
48
- /**
49
- * @var string
50
- */
51
- protected $_cartId = null;
52
- /**
53
- * @var string
54
- */
55
- protected $_redirectId = null;
56
- /**
57
- * @var string
58
- */
59
- protected $_visitorId = null;
60
- /**
61
- * API client instance.
62
- * @var TriggMine_ApiClient
63
- */
64
- private $_api = null;
65
- /**
66
- * Remembers whether API was called in current request already.
67
- * @var bool
68
- */
69
- private $_apiCalled = false;
70
- /**
71
- * Remembers whether Api was called visitor request
72
- * @var bool
73
- */
74
- private $_visitorCalled = false;
75
- /**
76
- * @var string
77
- */
78
- private $_conversionId;
79
- /**
80
- * Log in file flag
81
- * @var bool
82
- */
83
- protected $_logInFile = true;
84
-
85
-
86
- public function __construct()
87
- {
88
- if ($this->_getGetValue(self::KEY_TRIGGMINE_VERSION) !== null) {
89
- echo $this->getVersion();
90
- exit;
91
- }
92
-
93
- $this->_isOn = $this->_getSettingValue(self::SETTING_IS_ON);
94
- $this->_token = $this->_getSettingValue(self::SETTING_TOKEN);
95
- $this->_restApi = $this->_getSettingValue(self::SETTING_REST_API);
96
- $this->_isAsync = ($this->_getGetValue(self::KEY_TRIGGMINE_ASYNC) !== null);
97
-
98
- if ($this->_getGetValue(self::KEY_TRIGGMINE_EXPORT) !== null) {
99
- echo $this->getOrders();
100
- exit;
101
- }
102
-
103
- // Initializing API client
104
- $this->_api = new TriggMine_ApiClient($this);
105
-
106
- if ($this->_isFictiveRequest()) {
107
- $this->_isOn = false;
108
- }
109
-
110
- $this->_processAsyncRequest();
111
-
112
- }
113
-
114
- /**
115
- * Encapsulates the work with $_GET array.
116
- *
117
- * @param string $key Key from $_GET array.
118
- * @param string $default Default value if not found.
119
- *
120
- * @return string False if failed.
121
- */
122
- protected function _getGetValue($key, $default = null)
123
- {
124
- $value = filter_input(INPUT_GET, $key, FILTER_SANITIZE_STRING);
125
-
126
- return $value !== null ? $value : $default;
127
- }
128
-
129
- /**
130
- * Returns HTML string with versions info.
131
- * @return string
132
- */
133
- final public function getVersion()
134
- {
135
- return 'Agent: ' . $this->getAgent() . ' ' . $this->getAgentVersion() . '<br/>'
136
- . 'Core version: ' . self::VERSION . '<br/>'
137
- . 'Integrator version: ' . constant(get_class($this) . '::VERSION') . '<br/>'
138
- . 'ApiClient version: ' . TriggMine_ApiClient::VERSION;
139
- }
140
-
141
- /**
142
- * Returns a name of your CMS / eCommerce platform.
143
- * @return string Agent name.
144
- */
145
- abstract public function getAgent();
146
-
147
- /**
148
- * Returns a version of your CMS / eCommerce platform.
149
- * @return string Version.
150
- */
151
- abstract public function getAgentVersion();
152
-
153
- /**
154
- * Returns a value of the setting having given name.
155
- *
156
- * @param string $key Setting name.
157
- *
158
- * @return string Setting value.
159
- */
160
- abstract protected function _getSettingValue($key);
161
-
162
- final function getOrders()
163
- {
164
- $input = file_get_contents('php://input');
165
- $data = json_decode($input);
166
- if ($data->Method === 'GetHistory' && $data->Token === $this->_token) {
167
- header('Content-Type: application/json');
168
- $response = json_encode($this->exportOrders($data->Data));
169
-
170
- return $response;
171
- }
172
- }
173
-
174
- /**
175
- * Returns a json string of orders
176
- *
177
- * @param $data
178
- *
179
- * @return string Json
180
- */
181
- abstract public function exportOrders($data);
182
-
183
- /**
184
- * Tells whether current request is fictive, i.e. a bot request etc.
185
- * @return bool
186
- */
187
- protected function _isFictiveRequest()
188
- {
189
- return TriggMine_Helper::isRobotRequest();
190
- }
191
-
192
- /**
193
- * Processes asynchronous requests.
194
- */
195
- private function _processAsyncRequest()
196
- {
197
- if ($this->_getGetValue(self::KEY_TRIGGMINE_ASYNC) === null) {
198
- return;
199
- }
200
-
201
- $action = $this->_getGetValue('_action');
202
- if ($action) {
203
- $data = filter_input(INPUT_GET, 'Data');
204
- $this->_request(array(
205
- '_action' => $action,
206
- 'Data' => $data ? json_decode($data, true) : array()
207
- ));
208
- }
209
-
210
- // Request processed, nothing more to do
211
- exit;
212
- }
213
-
214
- /**
215
- * Makes request to API server.
216
- *
217
- * @param array $data Data to send.
218
- * @param array $response [optional]<br />Please provide if you need actual response.
219
- *
220
- * @return bool Is request successful.
221
- */
222
- private function _request($data, &$response = null)
223
- {
224
- $result = false;
225
-
226
- if ($this->_isOn || in_array($data['_action'], array('activate', 'deactivate', 'test'))) {
227
- $result = $this->_api->request($data, $response);
228
- $this->_apiCalled = true;
229
- }
230
-
231
- return $result;
232
- }
233
-
234
- /**
235
- * Adds &lt;script&gt; tag into the HTML.
236
- * Modifies the URL depending on whether it is a plugin file or not.
237
- *
238
- * @param string $url Relative or absolute URL of the JS file.
239
- * @param bool $isPluginFile Is it a part of plugin?
240
- */
241
- abstract public function registerJavaScriptFile($url, $isPluginFile = true);
242
-
243
- abstract public function install();
244
-
245
- abstract public function uninstall();
246
-
247
- /**
248
- * Tells whether current request is AJAX one.
249
- * AJAX doesn't equal to async.
250
- * @return bool
251
- */
252
- abstract public function isAjaxRequest();
253
-
254
- /**
255
- * Tells about JS support in the integrator.
256
- * @return bool
257
- */
258
- abstract public function supportsJavaScript();
259
-
260
- /**
261
- * Adds JS into the HTML.
262
- *
263
- * @param string $script JS code.
264
- */
265
- abstract public function registerJavaScript($script);
266
-
267
- /**
268
- * Returns URL of the website.
269
- */
270
- abstract public function getSiteUrl();
271
-
272
- /**
273
- * Charset used in the system.
274
- * @return string
275
- */
276
- public function getCharset()
277
- {
278
- return 'UTF8';
279
- }
280
-
281
- /**
282
- * @return string
283
- */
284
- public function getVisitorId()
285
- {
286
- if (!$this->_visitorId) {
287
- $this->_visitorId = $this->_getCookieValue(TriggMine_ApiClient::KEY_VISITOR_ID);
288
- }
289
-
290
- return $this->_visitorId;
291
- }
292
-
293
- /**
294
- * Remembers VisitorId locally and in cookies.
295
- *
296
- * @param string $id
297
- */
298
- public function setVisitorId($id)
299
- {
300
- $this->_visitorId = $id;
301
- $this->_setCookieValue(TriggMine_ApiClient::KEY_VISITOR_ID, $id, strtotime('+20 years'));
302
- }
303
-
304
- /**
305
- * Encapsulates the work with cookies.
306
- *
307
- * @param string $name Key from $_COOKIES['triggmine'] array.
308
- *
309
- * @return string Null if not found.
310
- */
311
- protected function _getCookieValue($name)
312
- {
313
- return isset($_COOKIE[self::KEY_TRIGGMINE][$name]) ? $_COOKIE[self::KEY_TRIGGMINE][$name] : null;
314
- }
315
-
316
- /**
317
- * Encapsulates the work with cookies.
318
- *
319
- * @param string $name Cookie name.
320
- * @param string $value Cookie value. Pass <b>null</b> to delete cookie.
321
- * @param int $expire [optional]<br />Expiration timestamp.
322
- * @param string $path [optional]<br />The path on the server in which the cookie will be available on.
323
- */
324
- protected function _setCookieValue($name, $value, $expire = 0, $path = '/')
325
- {
326
- $key = self::KEY_TRIGGMINE . '[' . $name . ']';
327
-
328
- if ($value === null) {
329
- // Delete this cookie
330
- $expire = time() - 999999;
331
- unset($_COOKIE[self::KEY_TRIGGMINE][$name]);
332
- }
333
-
334
- setcookie($key, $value, $expire, $path);
335
- }
336
-
337
- /**
338
- * @return string
339
- */
340
- public function getRedirectId()
341
- {
342
- if (!$this->_redirectId) {
343
- $this->_redirectId = $this->_getCookieValue(TriggMine_ApiClient::KEY_REDIRECT_ID);
344
- }
345
-
346
- return $this->_redirectId;
347
- }
348
-
349
- /**
350
- * Remembers RedirectId locally and in session.
351
- *
352
- * @param string $id
353
- */
354
- public function setRedirectId($id)
355
- {
356
- $this->_redirectId = $id;
357
- $this->_setCookieValue(TriggMine_ApiClient::KEY_REDIRECT_ID, $id);
358
- }
359
-
360
- /**
361
- * Return ConversionId
362
- *
363
- * @return mixed|string
364
- */
365
- public function getСonversionId()
366
- {
367
- if (!$this->_conversionId) {
368
- $this->_conversionId = $this->_getSessionValue(TriggMine_ApiClient::KEY_CONVERSION_ID);
369
- }
370
-
371
- return $this->_conversionId;
372
- }
373
-
374
- public function setConversionId($id)
375
- {
376
- $this->_conversionId = $id;
377
- $this->_setSessionValue(TriggMine_ApiClient::KEY_CONVERSION_ID, $id);
378
- }
379
-
380
- /**
381
- * Encapsulates the work with $_SESSION array.
382
- *
383
- * @param string $key Key from $_SESSION['triggmine'] array.
384
- *
385
- * @return mixed Null if not found.
386
- */
387
- protected function _getSessionValue($key)
388
- {
389
- return isset($_SESSION[self::KEY_TRIGGMINE][$key]) ? $_SESSION[self::KEY_TRIGGMINE][$key] : null;
390
- }
391
-
392
- /**
393
- * Remember CartPingTime in cookies
394
- *
395
- * @param string $time
396
- */
397
- public function setCartPingTime($time)
398
- {
399
- $this->_setCookieValue(TriggMine_ApiClient::KEY_CART_PING_TIME, $time);
400
- }
401
-
402
-
403
- public function setLogInFile($bool)
404
- {
405
- $this->_logInFile = $bool;
406
- }
407
-
408
- public function getLogInFile()
409
- {
410
- return $this->_logInFile;
411
- }
412
-
413
- /**
414
- * Common entry point for any call of event handlers and API actions.
415
- * Catches all possible exceptions.
416
- *
417
- * @param string $name
418
- * @param array $arguments
419
- * @return method
420
- */
421
- public function __call($name, $arguments)
422
- {
423
- $method = '';
424
-
425
- if (strpos($name, 'on') === 0) {
426
- if ($this->_handleEvents) {
427
- $method = '_' . $name;
428
- } else {
429
- // Event can't be handled now
430
- return;
431
- }
432
- } else {
433
- if (method_exists($this, '_action_' . $name)) {
434
- $method = '_action_' . $name;
435
- }
436
- }
437
-
438
- if (!$method) {
439
- // TODO: log
440
- return;
441
- }
442
-
443
- try {
444
- return call_user_func_array(array($this, $method), $arguments);
445
- } catch (Exception $e) {
446
- $this->_api->reportError($e);
447
- // TODO: log locally
448
- }
449
- }
450
-
451
- public function localResponseLog($request, $responce, $fileName = '/logs/log.txt')
452
- {
453
- $f = fopen(dirname(__FILE__) . $fileName, 'a+');
454
- fputs($f, '-----Start log at ' . date('d-m-Y H:i:s') . '------' . "\n");
455
-
456
- fputs($f, 'INFO: Request:' . "\n");
457
- fputs($f, json_encode($request) . "\n");
458
- fputs($f, 'INFO: Response:' . "\n");
459
- fputs($f, json_encode($responce) . "\n");
460
-
461
- fputs($f, '-----End log at ' . date('d-m-Y H:i:s') . '--------' . "\n");
462
- fclose($f);
463
- }
464
-
465
- /**
466
- * Builds unique CartItemId to be sent to the server. This is a default implementation.
467
- * Method has to be overriden according to the data structures specific for the system.
468
- *
469
- * @param mixed $item Object or array containing cart item data.
470
- *
471
- * @return string
472
- */
473
- protected function _buildCartItemId($item)
474
- {
475
- return is_object($item) ? $item->id : $item['id'];
476
- }
477
-
478
- /**
479
- * Handler for 'buyer logged in' event.
480
- */
481
- protected function _onBuyerLoggedIn($email)
482
- {
483
- throw new RuntimeException(self::MSG_IMPLEMENT_IN_INTEGRATOR);
484
- }
485
-
486
- /**
487
- * Handler for 'buyer logged out' event.
488
- */
489
- protected function _onBuyerLoggedOut()
490
- {
491
- throw new RuntimeException(self::MSG_IMPLEMENT_IN_INTEGRATOR);
492
- }
493
-
494
- /**
495
- * Handler for 'item added to the cart' event.
496
- */
497
- protected function _onCartItemAdded($item)
498
- {
499
- throw new RuntimeException(self::MSG_IMPLEMENT_IN_INTEGRATOR);
500
- }
501
-
502
- /**
503
- * Handler for 'item updated in the cart' event.
504
- */
505
- protected function _onCartItemUpdated($item)
506
- {
507
- throw new RuntimeException(self::MSG_IMPLEMENT_IN_INTEGRATOR);
508
- }
509
-
510
- /**
511
- * Handler for 'item deleted from the cart' event.
512
- */
513
- protected function _onCartItemDeleted($item)
514
- {
515
- throw new RuntimeException(self::MSG_IMPLEMENT_IN_INTEGRATOR);
516
- }
517
-
518
- /**
519
- * Handler for 'shopping cart cleaned up' event.
520
- */
521
- protected function _onCartCleanedUp($data)
522
- {
523
- throw new RuntimeException(self::MSG_IMPLEMENT_IN_INTEGRATOR);
524
- }
525
-
526
- /**
527
- * Handler for 'shopping cart is purchased' event.
528
- */
529
- protected function _onCartPurchased($data)
530
- {
531
- throw new RuntimeException(self::MSG_IMPLEMENT_IN_INTEGRATOR);
532
- }
533
-
534
- /**
535
- * Handler for 'shopping cart is updated' event.
536
- */
537
- protected function _onCartUpdated($data)
538
- {
539
- throw new RuntimeException(self::MSG_IMPLEMENT_IN_INTEGRATOR);
540
- }
541
-
542
- /**
543
- * Encapsulates the work with $_POST array.
544
- *
545
- * @param string $key Key from $_POST array.
546
- * @param string $default Default value if not found.
547
- *
548
- * @return string False if failed.
549
- */
550
- protected function _getPostValue($key, $default = null)
551
- {
552
- $value = filter_input(INPUT_POST, $key, FILTER_SANITIZE_STRING);
553
-
554
- return $value !== null ? $value : $default;
555
- }
556
-
557
- /**
558
- * Encapsulates the work with $_SESSION array.
559
- *
560
- * @param string $key Key from $_SESSION['triggmine'] array.
561
- * @param string $value Value to store in $_SESSION. Pass <b>null</b> to unset.
562
- */
563
- protected function _setSessionValue($key, $value)
564
- {
565
- if ($value === null) {
566
- unset($_SESSION[self::KEY_TRIGGMINE][$key]);
567
- } else {
568
- $_SESSION[self::KEY_TRIGGMINE] || $_SESSION[self::KEY_TRIGGMINE] = array();
569
- $_SESSION[self::KEY_TRIGGMINE][$key] = $value;
570
- }
571
- }
572
-
573
- /**
574
- * Handler for 'page loaded' event.
575
- */
576
- private function _onPageLoaded()
577
- {
578
- if (!$this->_isOn || $this->isAsyncRequest() || $this->isAjaxRequest()) {
579
- return;
580
- }
581
-
582
- // Trying to get and set Conversion Id
583
-
584
- $this->registerConversion();
585
-
586
- // Trying to retrieve a cart if needed
587
- $this->retrieveCart();
588
-
589
- // Registering new unique visitor in the system
590
- if (!$this->_getVisitorCalled()) {
591
- $this->registerVisitor();
592
- }
593
- }
594
-
595
- /**
596
- * Tells whether current request is async one.
597
- * Async doesn't equal to AJAX, it means a special GET param has been passed.
598
- * @return bool
599
- */
600
- public function isAsyncRequest()
601
- {
602
- return $this->_isAsync;
603
- }
604
-
605
- /**
606
- * Sends an API request to receive a unique Id for current visitor.
607
- * @return boolean Result.
608
- */
609
- private function _action_registerVisitor()
610
- {
611
-
612
- $data = array(
613
- '_action' => 'getVisitor'
614
- );
615
-
616
- return $this->_request($data);
617
- }
618
-
619
- private function _action_registerConversion()
620
- {
621
- $conversionId = $this->_getGetValue(TriggMine_ApiClient::KEY_CONVERSION_ID);
622
-
623
- if (!($conversionId)) {
624
- return false;
625
- }
626
-
627
- $this->setConversionId($conversionId);
628
- }
629
-
630
- /**
631
- * Sends an API request to receive a unique Id for current buyer.
632
- * @return boolean Result.
633
- */
634
- private function _action_registerBuyer()
635
- {
636
- if ($this->getBuyerId()) {
637
- return false;
638
- }
639
-
640
- $data = array('_action' => 'getNewBuyer');
641
-
642
- $buyerInfo = $this->getBuyerInfo();
643
- if (!empty($buyerInfo['BuyerEmail'])) {
644
- $data['Data'] = array('BuyerEmail' => $buyerInfo['BuyerEmail']);
645
- }
646
-
647
- if ($this->_request($data)) {
648
- // Got new BuyerId
649
-
650
- if (count($buyerInfo) > 1) {
651
- // Have some info except email, updating buyer
652
- $this->_request(array(
653
- '_action' => 'updateBuyer',
654
- 'Data' => $buyerInfo
655
- ));
656
- }
657
- }
658
- }
659
-
660
- /**
661
- * @return string
662
- */
663
- public function getBuyerId()
664
- {
665
- if (!$this->_buyerId) {
666
- $this->_buyerId = $this->_getCookieValue(TriggMine_ApiClient::KEY_BUYER_ID);
667
- }
668
-
669
- return $this->_buyerId;
670
- }
671
-
672
- /**
673
- * Remembers BuyerId locally and in cookies.
674
- *
675
- * @param string $id
676
- */
677
- public function setBuyerId($id)
678
- {
679
- $this->_buyerId = $id;
680
- $this->_setCookieValue(TriggMine_ApiClient::KEY_BUYER_ID, $id, strtotime('+20 years'));
681
- }
682
-
683
- /**
684
- * Returns array with buyer info [BuyerEmail, FirstName, LastName].
685
- */
686
- abstract public function getBuyerInfo();
687
-
688
- /**
689
- * Test plugin settings
690
- * @return bool
691
- */
692
- private function _action_test()
693
- {
694
- $data = array('_action' => 'test');
695
-
696
- return $this->_request($data);
697
- }
698
-
699
- /**
700
- * Activates plugin.
701
- * @return bool
702
- */
703
- private function _action_activate()
704
- {
705
- $data = array('_action' => 'activate');
706
-
707
- return $this->_request($data);
708
- }
709
-
710
- /**
711
- * Deactivates plugin.
712
- * @return bool
713
- */
714
- private function _action_deactivate()
715
- {
716
- $data = array('_action' => 'deactivate');
717
-
718
- return $this->_request($data);
719
- }
720
-
721
- /**
722
- * Sends an API request to update buyer info.
723
- *
724
- * @param mixed $data Either array [BuyerEmail, FirstName, LastName] or string with email.
725
- *
726
- * @return bool Result.
727
- */
728
- private function _action_logInBuyer($data)
729
- {
730
- $this->updateBuyerEmail($data);
731
- }
732
-
733
- /**
734
- * Tells whether current user is admin.
735
- * @return bool Is user an administrator.
736
- */
737
- abstract protected function _isUserAdmin();
738
-
739
- private function _action_logOutBuyer()
740
- {
741
- // Clear Buyer Id
742
- $this->setBuyerId(null);
743
-
744
- // Purchased cart doesn't exist anymore
745
- $this->setCartId(null);
746
-
747
- // Clear Redirect Id
748
- $this->setRedirectId(null);
749
-
750
- // Clear Redirect Id
751
- $this->setCartPingTime(null);
752
- }
753
-
754
- /**
755
- * Sends an API request to update buyer's personal data.
756
- *
757
- * @param array $data Array containing: BuyerEmail, FirstName, LastName.
758
- *
759
- * @return bool Result.
760
- */
761
- private function _action_updateBuyerInfo($data)
762
- {
763
- $data = array(
764
- '_action' => 'updateBuyer',
765
- 'Data' => $data
766
- );
767
-
768
- return $this->_request($data);
769
- }
770
-
771
- /**
772
- * Sends an API request to add cart item.
773
- *
774
- * @param array $item Cart item data array: CartItemId, ImageUrl, ThumbnailUrl, Price, Count, Title, Description.
775
- *
776
- * @return bool Result.
777
- */
778
- private function _action_addCartItem($item)
779
- {
780
- $data = array(
781
- '_action' => 'addCartItem',
782
- 'Data' => $item
783
- );
784
-
785
- return $this->_request($data);
786
- }
787
-
788
- private function _action_updateCartFull($items)
789
- {
790
- $data = array(
791
- '_action' => 'updateCartFull',
792
- 'Data' => $items
793
- );
794
-
795
- return $this->_request($data);
796
- }
797
-
798
- private function _action_sendExport($item)
799
- {
800
- $data = array(
801
- '_action' => 'sendExport',
802
- 'Data' => $item
803
- );
804
-
805
- return $this->_request($data);
806
- }
807
-
808
- /**
809
- * Sends an API request to add cart item.
810
- *
811
- * @param array $item Cart item data array: CartItemId, ImageUrl, ThumbnailUrl, Price, Count, Title, Description.
812
- *
813
- * @return bool Result.
814
- */
815
- private function _action_updateCartItem($item)
816
- {
817
- $data = array(
818
- '_action' => 'updateCartItem',
819
- 'Data' => $item
820
- );
821
-
822
- return $this->_request($data);
823
- }
824
-
825
- /**
826
- * Sends an API request to mark a cart item deleted.
827
- *
828
- * @param string $itemId Cart item ID.
829
- *
830
- * @return boolean Result.
831
- */
832
- private function _action_deleteCartItem($itemId)
833
- {
834
- $data = array(
835
- '_action' => 'deleteCartItem',
836
- 'Data' => array(
837
- 'CartItemId' => $itemId
838
- )
839
- );
840
-
841
- return $this->_request($data);
842
- }
843
-
844
- /**
845
- * Sends an API request to mark the shopping cart cleaned up.
846
- * @return boolean Result.
847
- */
848
- private function _action_cleanupCart()
849
- {
850
- if (!$this->getCartId()) {
851
- // Nothing to clean up
852
- return false;
853
- }
854
-
855
- $data = array('_action' => 'cleanupCart');
856
- $result = $this->_request($data);
857
-
858
- // Forgetting this cart as it was manually cleaned up
859
- $this->setCartId(null);
860
-
861
- return $result;
862
- }
863
-
864
- /**
865
- * @return string
866
- */
867
- public function getCartId()
868
- {
869
- if (!$this->_cartId) {
870
- $this->_cartId = $this->_getCookieValue(TriggMine_ApiClient::KEY_CART_ID);
871
- }
872
-
873
- return $this->_cartId;
874
- }
875
-
876
- /**
877
- * Remembers CartId locally and in session.
878
- *
879
- * @param string $id
880
- */
881
- public function setCartId($id)
882
- {
883
- $this->_cartId = $id;
884
- $this->_setCookieValue(TriggMine_ApiClient::KEY_CART_ID, $id);
885
- }
886
-
887
- /**
888
- * Sends an API request to mark the shopping cart purchased.
889
- *
890
- * @param mixed $buyerInfo Either array [BuyerEmail, FirstName, LastName] or string with email.
891
- *
892
- * @return bool
893
- */
894
- private function _action_purchaseCart($buyerInfo)
895
- {
896
- $data = array('_action' => 'purchaseCart');
897
- $result = $this->_request($data);
898
-
899
- // Purchased cart doesn't exist anymore
900
- $this->setCartId(null);
901
-
902
- // Clear Redirect Id
903
- $this->setRedirectId(null);
904
-
905
- // Clear CartPingTime
906
- $this->setCartPingTime(null);
907
-
908
- // Clearing data stored in cookie variable
909
- $this->_clearSession();
910
-
911
- return $result;
912
- }
913
-
914
- /**
915
- * Unsets whole set of TriggMine's session values.
916
- */
917
- protected function _clearSession()
918
- {
919
- unset($_SESSION[self::KEY_TRIGGMINE]);
920
- }
921
-
922
- /**
923
- * Sends a ping request to the server in order to show that visitor still works with the website.
924
- *
925
- * @param bool $force Force ping request.
926
- *
927
- * @return boolean
928
- */
929
- private function _action_pingCart($force = false)
930
- {
931
- if (!$this->getCartId()) {
932
- return false;
933
- }
934
-
935
- $timePassed = time() - (int)$this->_getCookieValue(self::KEY_CART_PING_TIME);
936
- $timeout = $timePassed > self::CART_PING_INTERVAL;
937
-
938
- if ($force || $timeout) {
939
- $this->_setCookieValue(self::KEY_CART_PING_TIME, time());
940
-
941
- $data = array('_action' => 'pingCart');
942
-
943
- return $this->_request($data);
944
- }
945
-
946
- return false;
947
- }
948
-
949
- private function _action_updateBuyerEmail($data)
950
- {
951
-
952
- if ($this->_isUserAdmin()) {
953
- // TODO: do we need to send any requests from admin?
954
- return false;
955
- }
956
-
957
- if (!is_array($data)) {
958
- $data = array('BuyerEmail' => $data);
959
- }
960
-
961
- if ($data['BuyerEmail'] != '') {
962
- $this->_request(array(
963
- '_action' => 'getBuyerByEmail',
964
- 'Data' => array('BuyerEmail' => $data['BuyerEmail'])
965
- )
966
- );
967
- } else {
968
- $this->_request(array('_action' => 'getNewBuyer'));
969
- }
970
-
971
- if ($userData = $this->_getUserDataFromDatabase(trim(strip_tags(stripslashes($data['BuyerEmail']))))) {
972
- $data = array_merge($data, $userData);
973
- }
974
-
975
- $data = array(
976
- '_action' => 'updateBuyer',
977
- 'Data' => $data
978
- );
979
-
980
- $cart = $this->_refillShoppingCart();
981
-
982
- $this->updateCartFull($cart);
983
-
984
- return $this->_request($data);
985
-
986
- }
987
-
988
- abstract protected function _getUserDataFromDatabase($email);
989
-
990
- /**
991
- * Handles a request of the URL from trigger email, retrieves shopping cart content.
992
- * @return bool Result.
993
- */
994
- private function _action_retrieveCart()
995
- {
996
- $buyerId = $this->_getGetValue(TriggMine_ApiClient::KEY_BUYER_ID);
997
- $cartId = $this->_getGetValue(TriggMine_ApiClient::KEY_CART_ID);
998
- $redirectId = $this->_getGetValue(TriggMine_ApiClient::KEY_REDIRECT_ID);
999
-
1000
- if (!($buyerId && $cartId && $redirectId)) {
1001
- // There are no some of the required values
1002
- return false;
1003
- }
1004
-
1005
- $this->setBuyerId($buyerId);
1006
- $this->setCartId($cartId);
1007
- $this->setRedirectId($redirectId);
1008
-
1009
- $data = array('_action' => 'getCartContent');
1010
-
1011
- $response = null;
1012
- $this->_request($data, $response);
1013
-
1014
- if (!empty($response['Data']['Items'])) {
1015
- // disabling event handling during cart re-fill
1016
- $this->_handleEvents = false;
1017
- $this->_fillShoppingCart($response['Data']);
1018
- $this->_handleEvents = true;
1019
- }
1020
-
1021
- // Redirect to the cart
1022
- header('Location: ' . $this->getCartUrl());
1023
- exit;
1024
- }
1025
-
1026
- public function setVisitorCalled()
1027
- {
1028
- $this->_visitorCalled = true;
1029
- }
1030
-
1031
- protected function _getVisitorCalled()
1032
- {
1033
- return $this->_visitorCalled;
1034
- }
1035
-
1036
- /**
1037
- * Re-fills shopping cart with items.
1038
- *
1039
- * @param array $cartContent Content of the shopping cart. Structure:
1040
- * <pre><code>
1041
- * array(
1042
- * 'CartUrl' => 'http://...',
1043
- * 'TotalPrice' => 1000,
1044
- * 'Items' => array(
1045
- * 0 => array(
1046
- * CartItemId : '123',
1047
- * Price : 750.00,
1048
- * Count : 1,
1049
- * Title : 'Lumia 920',
1050
- * ImageUrl : 'http://...',
1051
- * ThumbnailUrl: 'http://...',
1052
- * Description : '...',
1053
- * ),
1054
- * ...
1055
- * )
1056
- * )</code></pre>
1057
- */
1058
- abstract protected function _fillShoppingCart($cartContent);
1059
-
1060
-
1061
- abstract protected function _refillShoppingCart();
1062
-
1063
-
1064
- /**
1065
- * Returns absolute URL to the shopping cart page.
1066
- * @return string Shopping cart URL.
1067
- */
1068
- abstract public function getCartUrl();
1069
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Videal/Triggmine/Model/core/Error.php DELETED
@@ -1,122 +0,0 @@
1
- <?php
2
-
3
- final class TriggMine_Error
4
- {
5
- const VERSION = '1.0.3';
6
-
7
- private static $_errors = array(
8
- 'Incorrect settings. Please check the incoming data' => null,
9
- 'No Error' => 0,
10
- 'Unhandle dException' => 99, // непредвиденная ошибка в работе метода
11
- 'Invalid Request Format' => 100, // неправильный формат запроса: не JSON
12
-
13
- 'Token Not Found' => 110, // входной параметр не найден: Token
14
- 'Token Invalid Type' => 111, // неправильный тип параметра: Token
15
- 'TokenUnsupportedValue' => 112, // не поддерживаемое значение либо формат
16
-
17
- 'Method Not Found' => 120, // входной параметр не найден: Method
18
- 'Method Invalid Type' => 121, // неправильный тип параметра: Method
19
- 'Method Unsupported Value' => 122, // не поддерживаемое значение либо формат
20
-
21
- 'Data Not Found' => 130, // входной параметр не найден: Data
22
- 'Data Invalid Type' => 131, // неправильный тип параметра: Data
23
-
24
- 'BuyerIdNotFound' => 140, // входной параметр не найден: BuyerId
25
- 'BuyerIdInvalidType' => 141, // неправильный тип параметра: BuyerId
26
- 'BuyerIdUnsupportedValue' => 142, // не поддерживаемое значение либо формат
27
- 'BuyerIdUnregistered' => 143, // отсутствует в базе
28
-
29
- 'CartIdNotFound' => 150, // входной параметр не найден: CartId
30
- 'CartIdInvalidType' => 151, // неправильный тип параметра: CartId
31
- 'CartIdUnsupportedValue' => 152, // не поддерживаемое значение либо формат
32
- 'CartIdUnregistered' => 153, // отсутствует в базе
33
-
34
- 'BuyerEmailNotFound' => 160, // входной параметр не найден: BuyerEmail
35
- 'BuyerEmailInvalidType' => 161, // неправильный тип параметра: BuyerEmail
36
- 'BuyerEmailUnsupportedValue' => 162, // не поддерживаемое значение либо формат
37
- 'BuyerEmailInvalidSyntax' => 163, // мыло не проходит проверку регулярным выражением
38
-
39
- 'CartItemIdNotFound' => 170, // входной параметр не найден: CartItemId
40
- 'CartItemIdInvalidType' => 171, // неправильный тип параметра: CartItemId
41
- 'CartItemIdUnsupportedValue' => 172, // не поддерживаемое значение либо формат
42
- 'CartItemIdIsNull' => 173, //
43
-
44
- 'CartStateNotFound' => 180, // входной параметр не найден: CartState
45
- 'CartStateInvalidType' => 181, // неправильный тип параметра: CartState
46
- 'CartStateUnsupportedValue' => 182, // не поддерживаемое значение либо формат
47
-
48
- 'RedirectIdNotFound' => 190,
49
- 'RedirectIdInvalidType' => 191,
50
- 'RedirectIdUnsupportedValue' => 192,
51
- 'RedirectIdInvalidFormat' => 193,
52
- 'RedirectIdUnregistered' => 194,
53
-
54
- 'LogIdNotFound' => 210,
55
- 'LogIdInvalidType' => 211,
56
- 'LogIdUnsupportedValue' => 212,
57
- 'LogIdInvalidFormat' => 213,
58
- 'LogIdUnregistered' => 214,
59
-
60
- 'CartUrlNotFound' => 220,
61
- 'CartUrlInvalidType' => 221,
62
- 'CartUrlUnsupportedValue' => 222,
63
- 'CartUrlInvalidSyntax' => 223,
64
-
65
- 'CartIsClosed' => 230,
66
-
67
- 'BuyerBirthdayNotFound' => 270,
68
- 'BuyerBirthdayInvalidType' => 271,
69
- 'BuyerBirthdayUnsupportedValue' => 272,
70
- 'BuyerRegStartNotFound' => 273,
71
- 'BuyerRegStartInvalidType' => 274,
72
- 'BuyerRegStartUnsupportedValue' => 275,
73
- 'BuyerRegEndNotFound' => 276,
74
- 'BuyerRegEndInvalidType' => 277,
75
- 'BuyerRegEndUnsupportedValue' => 278,
76
-
77
- 'UrlNotFound' => 280,
78
- 'UrlInvalidType' => 281,
79
- 'UrlUnsupportedValue' => 282,
80
-
81
- 'SpanNotFound' => 290,
82
- 'SpanInvalidType' => 291,
83
- 'SpanUnsupportedValue' => 292,
84
-
85
- 'ImportTaskAlreadyExists' => 300,
86
-
87
- 'OffsetNotFound' => 310,
88
- 'OffsetInvalidType' => 311,
89
- 'OffsetUnsupportedValue' => 312,
90
-
91
- 'NextNotFound' => 320,
92
- 'NextInvalidType' => 321,
93
- 'NextUnsupportedValue' => 322,
94
- );
95
-
96
- private function __construct()
97
- {
98
- }
99
-
100
- public static function isError($code)
101
- {
102
- return $code > 0;
103
- }
104
-
105
- public static function getByCode($code)
106
- {
107
- return array_search($code, self::$_errors);
108
- }
109
-
110
- public static function isResponseNull($response)
111
- {
112
- if ($response === null) {
113
- return self::getByCode($response);
114
- } else {
115
- return false;
116
- }
117
- }
118
-
119
- private function __clone()
120
- {
121
- }
122
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Videal/Triggmine/Model/core/Helper.php DELETED
@@ -1,79 +0,0 @@
1
- <?php
2
-
3
- final class TriggMine_Helper {
4
- /**
5
- * Encodes given value from or to UTF8.
6
- *
7
- * @param array $data Data to encode.
8
- * @param string $charset [optional] Source/destination charset.
9
- * @param bool $reverse [optional] True means encoding from UTF8 to the given charset.
10
- */
11
- public static function encodeArray( &$data, $charset = 'windows-1251', $reverse = false ) {
12
- if ( $charset == 'UTF8' ) {
13
- return;
14
- }
15
-
16
- foreach ( $data as $key => &$value ) {
17
- if ( is_numeric( $value ) ) {
18
- continue;
19
- } else if ( is_array( $value ) ) {
20
- $value = self::encodeArray( $value, $charset, $reverse );
21
- } else if ( is_string( $value ) ) {
22
- if ( $reverse ) {
23
- $value = mb_convert_encoding( $value, $charset, 'UTF8' );
24
- } else {
25
- $value = mb_convert_encoding( $value, 'UTF8', $charset );
26
- }
27
- }
28
- }
29
- }
30
-
31
- /**
32
- * @return bool
33
- */
34
- public static function isUrlFopenEnabled() {
35
- return ini_get( 'allow_url_fopen' ) && function_exists( 'file_get_contents' );
36
- }
37
-
38
- /**
39
- * @return bool
40
- */
41
- public static function isCurlEnabled() {
42
- return function_exists( 'curl_version' );
43
- }
44
-
45
- public static function isRobotRequest() {
46
- // robots USER_AGENT in lower-case
47
- $robots = array(
48
- 'Any ad bot1' => 'adbot',
49
- 'Any ad bot2' => 'adsbot',
50
- 'Alexa' => 'ia_archiver',
51
- 'Altavista robot1' => 'scooter',
52
- 'Altavista robot2' => 'altavista',
53
- 'Altavista robot3' => 'mercator',
54
- 'Baidu' => 'baidu',
55
- 'Bing1' => 'msnbot',
56
- 'Bing2' => 'bingbot',
57
- 'Exalead' => 'exabot',
58
- 'Facebook' => 'facebookexternalhit',
59
- 'Gigabot' => 'gigabot',
60
- 'Google' => 'googlebot',
61
- 'Rambler' => 'rambler',
62
- 'Soso' => 'sosospider',
63
- 'Yahoo' => 'yahoo'
64
- );
65
-
66
- $isRobot = false;
67
- $userAgent = strtolower( $_SERVER['HTTP_USER_AGENT'] );
68
-
69
- foreach ( $robots as $robot ) {
70
- // Searching robot in the user agent, because user agent can be a longer string
71
- if ( strpos( $userAgent, $robot ) === 0 ) {
72
- $isRobot = true;
73
- break;
74
- }
75
- }
76
-
77
- return $isRobot;
78
- }
79
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Videal/Triggmine/controllers/Adminhtml/TriggminebackendController.php DELETED
@@ -1,10 +0,0 @@
1
- <?php
2
- class Videal_Triggmine_Adminhtml_TriggminebackendController extends Mage_Adminhtml_Controller_Action
3
- {
4
- public function indexAction()
5
- {
6
- $this->loadLayout();
7
- $this->_title($this->__("Triggmine"));
8
- $this->renderLayout();
9
- }
10
- }
 
 
 
 
 
 
 
 
 
 
app/code/community/Videal/Triggmine/etc/config.xml DELETED
@@ -1,239 +0,0 @@
1
- <?xml version="1.0"?>
2
- <config>
3
- <modules>
4
- <Videal_Triggmine>
5
- <version>2.0.0</version>
6
- </Videal_Triggmine>
7
- </modules>
8
- <global>
9
- <helpers>
10
- <triggmine>
11
- <class>Videal_Triggmine_Helper</class>
12
- </triggmine>
13
- </helpers>
14
- <models>
15
- <triggmine>
16
- <class>Videal_Triggmine_Model</class>
17
- </triggmine>
18
- </models>
19
- <events>
20
- <checkout_cart_add_product_complete> <!-- identifier of the event we want to catch -->
21
- <observers>
22
- <checkout_cart_add_product_complete_handler> <!-- identifier of the event handler -->
23
- <type>model</type>
24
- <!-- class method call type; valid are model, object and singleton -->
25
- <class>triggmine/observer</class>
26
- <!-- observers class alias -->
27
- <method>onCartItemAdded</method>
28
- <!-- observer's method to be called -->
29
- <args></args>
30
- <!-- additional arguments passed to observer -->
31
- </checkout_cart_add_product_complete_handler>
32
- </observers>
33
- </checkout_cart_add_product_complete>
34
- <sales_quote_remove_item> <!-- identifier of the event we want to catch -->
35
- <observers>
36
- <sales_quote_remove_item_handler> <!-- identifier of the event handler -->
37
- <type>model</type>
38
- <!-- class method call type; valid are model, object and singleton -->
39
- <class>triggmine/observer</class>
40
- <!-- observers class alias -->
41
- <method>onCartItemDeleted</method>
42
- <!-- observer's method to be called -->
43
- <args></args>
44
- <!-- additional arguments passed to observer -->
45
- </sales_quote_remove_item_handler>
46
- </observers>
47
- </sales_quote_remove_item>
48
- <checkout_cart_update_items_before> <!-- identifier of the event we want to catch -->
49
- <observers>
50
- <checkout_cart_update_items_before_handler> <!-- identifier of the event handler -->
51
- <type>model</type>
52
- <!-- class method call type; valid are model, object and singleton -->
53
- <class>triggmine/observer</class>
54
- <!-- observers class alias -->
55
- <method>onCartItemUpdated</method>
56
- <!-- observer's method to be called -->
57
- <args></args>
58
- <!-- additional arguments passed to observer -->
59
- </checkout_cart_update_items_before_handler>
60
- </observers>
61
- </checkout_cart_update_items_before>
62
- <checkout_cart_save_after> <!-- identifier of the event we want to catch -->
63
- <observers>
64
- <checkout_cart_save_after_handler> <!-- identifier of the event handler -->
65
- <type>model</type>
66
- <!-- class method call type; valid are model, object and singleton -->
67
- <class>triggmine/observer</class>
68
- <!-- observers class alias -->
69
- <method>onCartCleanedUp</method>
70
- <!-- observer's method to be called -->
71
- <args></args>
72
- <!-- additional arguments passed to observer -->
73
- </checkout_cart_save_after_handler>
74
- </observers>
75
- </checkout_cart_save_after>
76
- <customer_login> <!-- identifier of the event we want to catch -->
77
- <observers>
78
- <customer_login_handler> <!-- identifier of the event handler -->
79
- <type>model</type>
80
- <!-- class method call type; valid are model, object and singleton -->
81
- <class>triggmine/observer</class>
82
- <!-- observers class alias -->
83
- <method>onBuyerLoggedIn</method>
84
- <!-- observer's method to be called -->
85
- <args></args>
86
- <!-- additional arguments passed to observer -->
87
- </customer_login_handler>
88
- </observers>
89
- </customer_login>
90
- <customer_register_success> <!-- identifier of the event we want to catch -->
91
- <observers>
92
- <customer_register_success_handler> <!-- identifier of the event handler -->
93
- <type>model</type>
94
- <!-- class method call type; valid are model, object and singleton -->
95
- <class>triggmine/observer</class>
96
- <!-- observers class alias -->
97
- <method>onBuyerRegister</method>
98
- <!-- observer's method to be called -->
99
- <args></args>
100
- <!-- additional arguments passed to observer -->
101
- </customer_register_success_handler>
102
- </observers>
103
- </customer_register_success>
104
- <customer_logout> <!-- identifier of the event we want to catch -->
105
- <observers>
106
- <customer_logout_handler> <!-- identifier of the event handler -->
107
- <type>model</type>
108
- <!-- class method call type; valid are model, object and singleton -->
109
- <class>triggmine/observer</class>
110
- <!-- observers class alias -->
111
- <method>onBuyerLoggedOut</method>
112
- <!-- observer's method to be called -->
113
- <args></args>
114
- <!-- additional arguments passed to observer -->
115
- </customer_logout_handler>
116
- </observers>
117
- </customer_logout>
118
- <customer_logout> <!-- identifier of the event we want to catch -->
119
- <observers>
120
- <customer_logout_handler> <!-- identifier of the event handler -->
121
- <type>model</type>
122
- <!-- class method call type; valid are model, object and singleton -->
123
- <class>triggmine/observer</class>
124
- <!-- observers class alias -->
125
- <method>onBuyerLoggedOut</method>
126
- <!-- observer's method to be called -->
127
- <args></args>
128
- <!-- additional arguments passed to observer -->
129
- </customer_logout_handler>
130
- </observers>
131
- </customer_logout>
132
- <sales_order_place_after> <!-- identifier of the event we want to catch -->
133
- <observers>
134
- <sales_order_place_after_handler> <!-- identifier of the event handler -->
135
- <type>model</type>
136
- <!-- class method call type; valid are model, object and singleton -->
137
- <class>triggmine/observer</class>
138
- <!-- observers class alias -->
139
- <method>onCartPurchased</method>
140
- <!-- observer's method to be called -->
141
- <args></args>
142
- <!-- additional arguments passed to observer -->
143
- </sales_order_place_after_handler>
144
- </observers>
145
- </sales_order_place_after>
146
- <admin_system_config_changed_section_triggmine> <!-- identifier of the event we want to catch -->
147
- <observers>
148
- <admin_system_config_changed_section_triggmine_handler> <!-- identifier of the event handler -->
149
- <type>model</type>
150
- <!-- class method call type; valid are model, object and singleton -->
151
- <class>triggmine/observer</class>
152
- <!-- observers class alias -->
153
- <method>onChangedTriggmine</method>
154
- <!-- observer's method to be called -->
155
- <args></args>
156
- <!-- additional arguments passed to observer -->
157
- </admin_system_config_changed_section_triggmine_handler>
158
- </observers>
159
- </admin_system_config_changed_section_triggmine>
160
- <frontend_videal_triggmine_footer_event> <!-- identifier of the event we want to catch -->
161
- <observers>
162
- <frontend_videal_triggmine_footer_event_handler> <!-- identifier of the event handler -->
163
- <type>model</type>
164
- <!-- class method call type; valid are model, object and singleton -->
165
- <class>triggmine/observer</class>
166
- <!-- observers class alias -->
167
- <method>onFooterEvent</method>
168
- <!-- observer's method to be called -->
169
- <args></args>
170
- <!-- additional arguments passed to observer -->
171
- </frontend_videal_triggmine_footer_event_handler>
172
- </observers>
173
- </frontend_videal_triggmine_footer_event>
174
- <controller_action_postdispatch_wishlist_index_cart>
175
- <observers>
176
- <controller_action_postdispatch_wishlist_index_cart_handler> <!-- identifier of the event handler -->
177
- <type>model</type>
178
- <!-- class method call type; valid are model, object and singleton -->
179
- <class>triggmine/observer</class>
180
- <!-- observers class alias -->
181
- <method>onCartItemAddedFromWishList</method>
182
- <!-- observer's method to be called -->
183
- <args></args>
184
- <!-- additional arguments passed to observer -->
185
- </controller_action_postdispatch_wishlist_index_cart_handler>
186
- </observers>
187
- </controller_action_postdispatch_wishlist_index_cart>
188
- </events>
189
- </global>
190
- <frontend>
191
- <layout>
192
- <updates>
193
- <videal_triggmine>
194
- <file>videal_triggmine.xml</file>
195
- </videal_triggmine>
196
- </updates>
197
- </layout>
198
- </frontend>
199
- <admin>
200
- <routers>
201
- <triggmine>
202
- <use>admin</use>
203
- <args>
204
- <module>Videal_Triggmine</module>
205
- <frontName>admin_triggmine</frontName>
206
- </args>
207
- </triggmine>
208
- </routers>
209
- </admin>
210
- <adminhtml>
211
- <acl>
212
- <resources>
213
- <all>
214
- <title>Allow Everything</title>
215
- </all>
216
- <admin>
217
- <children>
218
- <triggmine translate="title" module="triggmine">
219
- <title>Triggmine</title>
220
- <sort_order>1000</sort_order>
221
- <children>
222
- <triggminebackend translate="title">
223
- <title>Triggmine</title>
224
- </triggminebackend>
225
- </children>
226
- </triggmine>
227
- </children>
228
- </admin>
229
- </resources>
230
- </acl>
231
- <layout>
232
- <updates>
233
- <triggmine>
234
- <file>triggmine.xml</file>
235
- </triggmine>
236
- </updates>
237
- </layout>
238
- </adminhtml>
239
- </config>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Videal/Triggmine/etc/system.xml DELETED
@@ -1,63 +0,0 @@
1
- <?xml version="1.0"?>
2
- <config>
3
- <sections>
4
- <triggmine translate="label" module="triggmine">
5
- <label>Triggmine</label>
6
- <tab>general</tab>
7
- <frontend_type>text</frontend_type>
8
- <sort_order>600</sort_order>
9
- <show_in_default>1</show_in_default>
10
- <show_in_website>1</show_in_website>
11
- <show_in_store>1</show_in_store>
12
- <groups>
13
- <config translate="label">
14
- <label>Triggmine Settings</label>
15
- <frontend_type>text</frontend_type>
16
- <sort_order>10</sort_order>
17
- <show_in_default>1</show_in_default>
18
- <show_in_website>1</show_in_website>
19
- <show_in_store>1</show_in_store>
20
- <fields>
21
- <is_on translate="label">
22
- <label>Enable Triggmine</label>
23
- <frontend_type>select</frontend_type>
24
- <source_model>adminhtml/system_config_source_yesno</source_model>
25
- <sort_order>10</sort_order>
26
- <show_in_default>1</show_in_default>
27
- <show_in_website>1</show_in_website>
28
- <show_in_store>1</show_in_store>
29
- </is_on>
30
- <rest_api translate="label">
31
- <label>Rest api</label>
32
- <frontend_type>text</frontend_type>
33
- <sort_order>20</sort_order>
34
- <show_in_default>1</show_in_default>
35
- <show_in_website>1</show_in_website>
36
- <show_in_store>1</show_in_store>
37
- <comment>Put rest api url taken after registration in triggmine.com here.</comment>
38
- </rest_api>
39
- <token translate="label">
40
- <label>Token</label>
41
- <frontend_type>text</frontend_type>
42
- <sort_order>30</sort_order>
43
- <show_in_default>1</show_in_default>
44
- <show_in_website>1</show_in_website>
45
- <show_in_store>1</show_in_store>
46
- <comment>Put token taken after registration in triggmine.com here.</comment>
47
- </token>
48
- <send_export translate="label">
49
- <label>Send order history</label>
50
- <frontend_type>select</frontend_type>
51
- <source_model>adminhtml/system_config_source_yesno</source_model>
52
- <sort_order>40</sort_order>
53
- <show_in_default>1</show_in_default>
54
- <show_in_website>1</show_in_website>
55
- <show_in_store>1</show_in_store>
56
- <comment>Agreeing you send your order history to the server Triggmine.</comment>
57
- </send_export>
58
- </fields>
59
- </config>
60
- </groups>
61
- </triggmine>
62
- </sections>
63
- </config>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/design/frontend/base/default/layout/triggmine_integrationmodule.xml ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <layout version="3.0.5">
3
+ <default>
4
+ <reference name="before_body_end">
5
+ <block type="core/template" name="triggmine_init" after="-" template="triggmine/integrationmodule/init.phtml"/>
6
+ </reference>
7
+ </default>
8
+ </layout>
9
+
10
+
app/design/frontend/base/default/layout/videal_triggmine.xml DELETED
@@ -1,13 +0,0 @@
1
- <?xml version="1.0"?>
2
- <layout version="0.1.0">
3
- <!-- @videal -->
4
-
5
- <!-- All pages tracking -->
6
- <default>
7
- <reference name="before_body_end">
8
- <block type="core/template" name="videal_init" after="-" template="videal/triggmine/init.phtml"/>
9
- </reference>
10
- </default>
11
- </layout>
12
-
13
-
 
 
 
 
 
 
 
 
 
 
 
 
 
app/design/frontend/base/default/template/triggmine/integrationmodule/init.phtml ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php if (Mage::helper('core')->isModuleEnabled('Triggmine_IntegrationModule') && Mage::helper('integrationmodule/data')->isEnabled()) : ?>
2
+
3
+ <!-- TriggMine -->
4
+ <script type="text/javascript" src="<?php echo Mage::getBaseUrl('js'); ?>triggmine/integationmodule/scripts/fingerprint2.min.js"></script>
5
+ <script type="text/javascript" src="<?php echo Mage::getBaseUrl('js'); ?>triggmine/integationmodule/scripts/client.min.js"></script>
6
+ <script type="text/javascript" src="<?php echo Mage::getBaseUrl('js'); ?>triggmine/integationmodule/scripts/jscookie.min.js"></script>
7
+ <script type="text/javascript">
8
+ //<![CDATA[
9
+ document.addEventListener('DOMContentLoaded',function(){var a={swfPath:'/assets/FontList.swf',excludeUserAgent:!0,excludeLanguage:!0},b=new ClientJS,c=b.getFingerprint();Cookies.set('device_id_1',c,{path:'/',expires:7}),new Fingerprint2(a).get(function(a){Cookies.set('device_id',a,{path:'/',expires:7})})});
10
+ //]]
11
+ </script>
12
+ <!-- TriggMine End -->
13
+
14
+ <?php else: ?>
15
+
16
+ <!-- TriggMine module is not used! -->
17
+ <script type="text/javascript">
18
+ //<![CDATA[
19
+ console.warn("TriggMine module is not used!");
20
+ //]]
21
+ </script>
22
+ <?php endif; ?>
app/design/frontend/base/default/template/videal/triggmine/init.phtml DELETED
@@ -1,2 +0,0 @@
1
- <?php
2
- Mage::dispatchEvent('frontend_videal_triggmine_footer_event');
 
 
app/etc/modules/{Videal_Triggmine.xml → Triggmine_IntegrationModule.xml} RENAMED
@@ -1,10 +1,10 @@
1
- <?xml version="1.0"?>
2
- <config>
3
- <modules>
4
- <Videal_Triggmine>
5
- <active>true</active>
6
- <codePool>community</codePool>
7
- <version>2.2.0</version>
8
- </Videal_Triggmine>
9
- </modules>
10
  </config>
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Triggmine_IntegrationModule>
5
+ <active>true</active>
6
+ <codePool>community</codePool>
7
+ <version>3.0.5</version>
8
+ </Triggmine_IntegrationModule>
9
+ </modules>
10
  </config>
js/triggmine/integationmodule/scripts/client.min.js ADDED
@@ -0,0 +1,79 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ (function(f,e){var d={extend:function(a,c){for(var h in c)-1!=="browser cpu device engine os".indexOf(h)&&0===c[h].length%2&&(a[h]=c[h].concat(a[h]));return a},has:function(a,c){if("string"===typeof a)return-1!==c.toLowerCase().indexOf(a.toLowerCase())},lowerize:function(a){return a.toLowerCase()}},n=function(){for(var a,c=0,h,b,f,m,g,d,n=arguments;c<n.length&&!g;){var l=n[c],p=n[c+1];if("undefined"===typeof a)for(f in a={},p)m=p[f],"object"===typeof m?a[m[0]]=e:a[m]=e;for(h=b=0;h<l.length&&!g;)if(g=
2
+ l[h++].exec(this.getUA()))for(f=0;f<p.length;f++)d=g[++b],m=p[f],"object"===typeof m&&0<m.length?2==m.length?a[m[0]]="function"==typeof m[1]?m[1].call(this,d):m[1]:3==m.length?a[m[0]]="function"!==typeof m[1]||m[1].exec&&m[1].test?d?d.replace(m[1],m[2]):e:d?m[1].call(this,d,m[2]):e:4==m.length&&(a[m[0]]=d?m[3].call(this,d.replace(m[1],m[2])):e):a[m]=d?d:e;c+=2}return a},b=function(a,c){for(var h in c)if("object"===typeof c[h]&&0<c[h].length)for(var b=0;b<c[h].length;b++){if(d.has(c[h][b],a))return"?"===
3
+ h?e:h}else if(d.has(c[h],a))return"?"===h?e:h;return a},g={ME:"4.90","NT 3.11":"NT3.51","NT 4.0":"NT4.0",2E3:"NT 5.0",XP:["NT 5.1","NT 5.2"],Vista:"NT 6.0",7:"NT 6.1",8:"NT 6.2","8.1":"NT 6.3",10:"NT 6.4",RT:"ARM"},p={browser:[[/(opera\smini)\/((\d+)?[\w\.-]+)/i,/(opera\s[mobiletab]+).+version\/((\d+)?[\w\.-]+)/i,/(opera).+version\/((\d+)?[\w\.]+)/i,/(opera)[\/\s]+((\d+)?[\w\.]+)/i],["name","version","major"],[/\s(opr)\/((\d+)?[\w\.]+)/i],[["name","Opera"],"version","major"],[/(kindle)\/((\d+)?[\w\.]+)/i,
4
+ /(lunascape|maxthon|netfront|jasmine|blazer)[\/\s]?((\d+)?[\w\.]+)*/i,/(avant\s|iemobile|slim|baidu)(?:browser)?[\/\s]?((\d+)?[\w\.]*)/i,/(?:ms|\()(ie)\s((\d+)?[\w\.]+)/i,/(rekonq)((?:\/)[\w\.]+)*/i,/(chromium|flock|rockmelt|midori|epiphany|silk|skyfire|ovibrowser|bolt|iron)\/((\d+)?[\w\.-]+)/i],["name","version","major"],[/(trident).+rv[:\s]((\d+)?[\w\.]+).+like\sgecko/i],[["name","IE"],"version","major"],[/(yabrowser)\/((\d+)?[\w\.]+)/i],[["name","Yandex"],"version","major"],[/(comodo_dragon)\/((\d+)?[\w\.]+)/i],
5
+ [["name",/_/g," "],"version","major"],[/(chrome|omniweb|arora|[tizenoka]{5}\s?browser)\/v?((\d+)?[\w\.]+)/i,/(uc\s?browser|qqbrowser)[\/\s]?((\d+)?[\w\.]+)/i],["name","version","major"],[/(dolfin)\/((\d+)?[\w\.]+)/i],[["name","Dolphin"],"version","major"],[/((?:android.+)crmo|crios)\/((\d+)?[\w\.]+)/i],[["name","Chrome"],"version","major"],[/version\/((\d+)?[\w\.]+).+?mobile\/\w+\s(safari)/i],["version","major",["name","Mobile Safari"]],[/version\/((\d+)?[\w\.]+).+?(mobile\s?safari|safari)/i],["version",
6
+ "major","name"],[/webkit.+?(mobile\s?safari|safari)((\/[\w\.]+))/i],["name",["major",b,{1:["/8","/1","/3"],2:"/4","?":"/"}],["version",b,{"1.0":"/8","1.2":"/1","1.3":"/3","2.0":"/412","2.0.2":"/416","2.0.3":"/417","2.0.4":"/419","?":"/"}]],[/(konqueror)\/((\d+)?[\w\.]+)/i,/(webkit|khtml)\/((\d+)?[\w\.]+)/i],["name","version","major"],[/(navigator|netscape)\/((\d+)?[\w\.-]+)/i],[["name","Netscape"],"version","major"],[/(swiftfox)/i,/(icedragon|iceweasel|camino|chimera|fennec|maemo\sbrowser|minimo|conkeror)[\/\s]?((\d+)?[\w\.\+]+)/i,
7
+ /(firefox|seamonkey|k-meleon|icecat|iceape|firebird|phoenix)\/((\d+)?[\w\.-]+)/i,/(mozilla)\/((\d+)?[\w\.]+).+rv\:.+gecko\/\d+/i,/(polaris|lynx|dillo|icab|doris|amaya|w3m|netsurf)[\/\s]?((\d+)?[\w\.]+)/i,/(links)\s\(((\d+)?[\w\.]+)/i,/(gobrowser)\/?((\d+)?[\w\.]+)*/i,/(ice\s?browser)\/v?((\d+)?[\w\._]+)/i,/(mosaic)[\/\s]((\d+)?[\w\.]+)/i],["name","version","major"]],cpu:[[/(?:(amd|x(?:(?:86|64)[_-])?|wow|win)64)[;\)]/i],[["architecture","amd64"]],[/(ia32(?=;))/i],[["architecture",d.lowerize]],[/((?:i[346]|x)86)[;\)]/i],
8
+ [["architecture","ia32"]],[/windows\s(ce|mobile);\sppc;/i],[["architecture","arm"]],[/((?:ppc|powerpc)(?:64)?)(?:\smac|;|\))/i],[["architecture",/ower/,"",d.lowerize]],[/(sun4\w)[;\)]/i],[["architecture","sparc"]],[/((?:avr32|ia64(?=;))|68k(?=\))|arm(?:64|(?=v\d+;))|(?=atmel\s)avr|(?:irix|mips|sparc)(?:64)?(?=;)|pa-risc)/i],[["architecture",d.lowerize]]],device:[[/\((ipad|playbook);[\w\s\);-]+(rim|apple)/i],["model","vendor",["type","tablet"]],[/applecoremedia\/[\w\.]+ \((ipad)/],["model",["vendor",
9
+ "Apple"],["type","tablet"]],[/(apple\s{0,1}tv)/i],[["model","Apple TV"],["vendor","Apple"]],[/(archos)\s(gamepad2?)/i,/(hp).+(touchpad)/i,/(kindle)\/([\w\.]+)/i,/\s(nook)[\w\s]+build\/(\w+)/i,/(dell)\s(strea[kpr\s\d]*[\dko])/i],["vendor","model",["type","tablet"]],[/(kf[A-z]+)\sbuild\/[\w\.]+.*silk\//i],["model",["vendor","Amazon"],["type","tablet"]],[/(sd|kf)[0349hijorstuw]+\sbuild\/[\w\.]+.*silk\//i],[["model",b,{"Fire Phone":["SD","KF"]}],["vendor","Amazon"],["type","mobile"]],[/\((ip[honed|\s\w*]+);.+(apple)/i],
10
+ ["model","vendor",["type","mobile"]],[/\((ip[honed|\s\w*]+);/i],["model",["vendor","Apple"],["type","mobile"]],[/(blackberry)[\s-]?(\w+)/i,/(blackberry|benq|palm(?=\-)|sonyericsson|acer|asus|dell|huawei|meizu|motorola|polytron)[\s_-]?([\w-]+)*/i,/(hp)\s([\w\s]+\w)/i,/(asus)-?(\w+)/i],["vendor","model",["type","mobile"]],[/\(bb10;\s(\w+)/i],["model",["vendor","BlackBerry"],["type","mobile"]],[/android.+(transfo[prime\s]{4,10}\s\w+|eeepc|slider\s\w+|nexus 7)/i],["model",["vendor","Asus"],["type","tablet"]],
11
+ [/(sony)\s(tablet\s[ps])/i],["vendor","model",["type","tablet"]],[/\s(ouya)\s/i,/(nintendo)\s([wids3u]+)/i],["vendor","model",["type","console"]],[/android.+;\s(shield)\sbuild/i],["model",["vendor","Nvidia"],["type","console"]],[/(playstation\s[3portablevi]+)/i],["model",["vendor","Sony"],["type","console"]],[/(sprint\s(\w+))/i],[["vendor",b,{HTC:"APA",Sprint:"Sprint"}],["model",b,{"Evo Shift 4G":"7373KT"}],["type","mobile"]],[/(lenovo)\s?(S(?:5000|6000)+(?:[-][\w+]))/i],["vendor","model",["type",
12
+ "tablet"]],[/(htc)[;_\s-]+([\w\s]+(?=\))|\w+)*/i,/(zte)-(\w+)*/i,/(alcatel|geeksphone|huawei|lenovo|nexian|panasonic|(?=;\s)sony)[_\s-]?([\w-]+)*/i],["vendor",["model",/_/g," "],["type","mobile"]],[/[\s\(;](xbox(?:\sone)?)[\s\);]/i],["model",["vendor","Microsoft"],["type","console"]],[/(kin\.[onetw]{3})/i],[["model",/\./g," "],["vendor","Microsoft"],["type","mobile"]],[/\s((milestone|droid(?:[2-4x]|\s(?:bionic|x2|pro|razr))?(:?\s4g)?))[\w\s]+build\//i,/(mot)[\s-]?(\w+)*/i],[["vendor","Motorola"],
13
+ "model",["type","mobile"]],[/android.+\s(mz60\d|xoom[\s2]{0,2})\sbuild\//i],["model",["vendor","Motorola"],["type","tablet"]],[/android.+((sch-i[89]0\d|shw-m380s|gt-p\d{4}|gt-n8000|sgh-t8[56]9|nexus 10))/i,/((SM-T\w+))/i],[["vendor","Samsung"],"model",["type","tablet"]],[/((s[cgp]h-\w+|gt-\w+|galaxy\snexus|sm-n900))/i,/(sam[sung]*)[\s-]*(\w+-?[\w-]*)*/i,/sec-((sgh\w+))/i],[["vendor","Samsung"],"model",["type","mobile"]],[/(samsung);smarttv/i],["vendor","model",["type","smarttv"]],[/\(dtv[\);].+(aquos)/i],
14
+ ["model",["vendor","Sharp"],["type","smarttv"]],[/sie-(\w+)*/i],["model",["vendor","Siemens"],["type","mobile"]],[/(maemo|nokia).*(n900|lumia\s\d+)/i,/(nokia)[\s_-]?([\w-]+)*/i],[["vendor","Nokia"],"model",["type","mobile"]],[/android\s3\.[\s\w-;]{10}(a\d{3})/i],["model",["vendor","Acer"],["type","tablet"]],[/android\s3\.[\s\w-;]{10}(lg?)-([06cv9]{3,4})/i],[["vendor","LG"],"model",["type","tablet"]],[/(lg) netcast\.tv/i],["vendor","model",["type","smarttv"]],[/(nexus\s[45])/i,/lg[e;\s\/-]+(\w+)*/i],
15
+ ["model",["vendor","LG"],["type","mobile"]],[/android.+(ideatab[a-z0-9\-\s]+)/i],["model",["vendor","Lenovo"],["type","tablet"]],[/linux;.+((jolla));/i],["vendor","model",["type","mobile"]],[/((pebble))app\/[\d\.]+\s/i],["vendor","model",["type","wearable"]],[/android.+;\s(glass)\s\d/i],["model",["vendor","Google"],["type","wearable"]],[/(mobile|tablet);.+rv\:.+gecko\//i],[["type",d.lowerize],"vendor","model"]],engine:[[/(presto)\/([\w\.]+)/i,/(webkit|trident|netfront|netsurf|amaya|lynx|w3m)\/([\w\.]+)/i,
16
+ /(khtml|tasman|links)[\/\s]\(?([\w\.]+)/i,/(icab)[\/\s]([23]\.[\d\.]+)/i],["name","version"],[/rv\:([\w\.]+).*(gecko)/i],["version","name"]],os:[[/microsoft\s(windows)\s(vista|xp)/i],["name","version"],[/(windows)\snt\s6\.2;\s(arm)/i,/(windows\sphone(?:\sos)*|windows\smobile|windows)[\s\/]?([ntce\d\.\s]+\w)/i],["name",["version",b,g]],[/(win(?=3|9|n)|win\s9x\s)([nt\d\.]+)/i],[["name","Windows"],["version",b,g]],[/\((bb)(10);/i],[["name","BlackBerry"],"version"],[/(blackberry)\w*\/?([\w\.]+)*/i,/(tizen)[\/\s]([\w\.]+)/i,
17
+ /(android|webos|palm\os|qnx|bada|rim\stablet\sos|meego|contiki)[\/\s-]?([\w\.]+)*/i,/linux;.+(sailfish);/i],["name","version"],[/(symbian\s?os|symbos|s60(?=;))[\/\s-]?([\w\.]+)*/i],[["name","Symbian"],"version"],[/\((series40);/i],["name"],[/mozilla.+\(mobile;.+gecko.+firefox/i],[["name","Firefox OS"],"version"],[/(nintendo|playstation)\s([wids3portablevu]+)/i,/(mint)[\/\s\(]?(\w+)*/i,/(mageia|vectorlinux)[;\s]/i,/(joli|[kxln]?ubuntu|debian|[open]*suse|gentoo|arch|slackware|fedora|mandriva|centos|pclinuxos|redhat|zenwalk|linpus)[\/\s-]?([\w\.-]+)*/i,
18
+ /(hurd|linux)\s?([\w\.]+)*/i,/(gnu)\s?([\w\.]+)*/i],["name","version"],[/(cros)\s[\w]+\s([\w\.]+\w)/i],[["name","Chromium OS"],"version"],[/(sunos)\s?([\w\.]+\d)*/i],[["name","Solaris"],"version"],[/\s([frentopc-]{0,4}bsd|dragonfly)\s?([\w\.]+)*/i],["name","version"],[/(ip[honead]+)(?:.*os\s*([\w]+)*\slike\smac|;\sopera)/i],[["name","iOS"],["version",/_/g,"."]],[/(mac\sos\sx)\s?([\w\s\.]+\w)*/i,/(macintosh|mac(?=_powerpc)\s)/i],[["name","Mac OS"],["version",/_/g,"."]],[/((?:open)?solaris)[\/\s-]?([\w\.]+)*/i,
19
+ /(haiku)\s(\w+)/i,/(aix)\s((\d)(?=\.|\)|\s)[\w\.]*)*/i,/(plan\s9|minix|beos|os\/2|amigaos|morphos|risc\sos|openvms)/i,/(unix)\s?([\w\.]+)*/i],["name","version"]]},q=function(a,c){if(!(this instanceof q))return(new q(a,c)).getResult();var h=a||(f&&f.navigator&&f.navigator.userAgent?f.navigator.userAgent:""),b=c?d.extend(p,c):p;this.getBrowser=function(){return n.apply(this,b.browser)};this.getCPU=function(){return n.apply(this,b.cpu)};this.getDevice=function(){return n.apply(this,b.device)};this.getEngine=
20
+ function(){return n.apply(this,b.engine)};this.getOS=function(){return n.apply(this,b.os)};this.getResult=function(){return{ua:this.getUA(),browser:this.getBrowser(),engine:this.getEngine(),os:this.getOS(),device:this.getDevice(),cpu:this.getCPU()}};this.getUA=function(){return h};this.setUA=function(a){h=a;return this};this.setUA(h)};q.VERSION="0.7.3";q.BROWSER={NAME:"name",MAJOR:"major",VERSION:"version"};q.CPU={ARCHITECTURE:"architecture"};q.DEVICE={MODEL:"model",VENDOR:"vendor",TYPE:"type",CONSOLE:"console",
21
+ MOBILE:"mobile",SMARTTV:"smarttv",TABLET:"tablet",WEARABLE:"wearable",EMBEDDED:"embedded"};q.ENGINE={NAME:"name",VERSION:"version"};q.OS={NAME:"name",VERSION:"version"};if("undefined"!==typeof exports)"undefined"!==typeof module&&module.exports&&(exports=module.exports=q),exports.UAParser=q;else{f.UAParser=q;"function"===typeof define&&define.amd&&define(function(){return q});var r=f.jQuery||f.Zepto;if("undefined"!==typeof r){var t=new q;r.ua=t.getResult();r.ua.get=function(){return t.getUA()};r.ua.set=
22
+ function(a){t.setUA(a);a=t.getResult();for(var c in a)r.ua[c]=a[c]}}}})(this);var Detector=function(){var f=["monospace","sans-serif","serif"],e=document.getElementsByTagName("body")[0],d=document.createElement("span");d.style.fontSize="72px";d.innerHTML="mmmmmmmmmmlli";var n={},b={},g;for(g in f)d.style.fontFamily=f[g],e.appendChild(d),n[f[g]]=d.offsetWidth,b[f[g]]=d.offsetHeight,e.removeChild(d);this.detect=function(g){var q=!1,r;for(r in f){d.style.fontFamily=g+","+f[r];e.appendChild(d);var t=d.offsetWidth!=n[f[r]]||d.offsetHeight!=b[f[r]];e.removeChild(d);q=q||t}return q}};var swfobject=function(){function f(){if(!A){try{var a=l.getElementsByTagName("body")[0].appendChild(l.createElement("span"));a.parentNode.removeChild(a)}catch(c){return}A=!0;for(var a=E.length,h=0;h<a;h++)E[h]()}}function e(a){A?a():E[E.length]=a}function d(a){if("undefined"!=typeof u.addEventListener)u.addEventListener("load",a,!1);else if("undefined"!=typeof l.addEventListener)l.addEventListener("load",a,!1);else if("undefined"!=typeof u.attachEvent)v(u,"onload",a);else if("function"==typeof u.onload){var c=
23
+ u.onload;u.onload=function(){c();a()}}else u.onload=a}function n(){var a=l.getElementsByTagName("body")[0],c=l.createElement("object");c.setAttribute("type","application/x-shockwave-flash");var h=a.appendChild(c);if(h){var e=0;(function(){if("undefined"!=typeof h.GetVariable){var d=h.GetVariable("$version");d&&(d=d.split(" ")[1].split(","),k.pv=[parseInt(d[0],10),parseInt(d[1],10),parseInt(d[2],10)])}else if(10>e){e++;setTimeout(arguments.callee,10);return}a.removeChild(c);h=null;b()})()}else b()}
24
+ function b(){var a=y.length;if(0<a)for(var c=0;c<a;c++){var b=y[c].id,d=y[c].callbackFn,e={success:!1,id:b};if(0<k.pv[0]){var f=h(b);if(f)if(!D(y[c].swfVersion)||k.wk&&312>k.wk)if(y[c].expressInstall&&p()){e={};e.data=y[c].expressInstall;e.width=f.getAttribute("width")||"0";e.height=f.getAttribute("height")||"0";f.getAttribute("class")&&(e.styleclass=f.getAttribute("class"));f.getAttribute("align")&&(e.align=f.getAttribute("align"));for(var m={},f=f.getElementsByTagName("param"),l=f.length,n=0;n<
25
+ l;n++)"movie"!=f[n].getAttribute("name").toLowerCase()&&(m[f[n].getAttribute("name")]=f[n].getAttribute("value"));q(e,m,b,d)}else r(f),d&&d(e);else z(b,!0),d&&(e.success=!0,e.ref=g(b),d(e))}else z(b,!0),d&&((b=g(b))&&"undefined"!=typeof b.SetVariable&&(e.success=!0,e.ref=b),d(e))}}function g(a){var c=null;(a=h(a))&&"OBJECT"==a.nodeName&&("undefined"!=typeof a.SetVariable?c=a:(a=a.getElementsByTagName("object")[0])&&(c=a));return c}function p(){return!F&&D("6.0.65")&&(k.win||k.mac)&&!(k.wk&&312>k.wk)}
26
+ function q(c,b,e,d){F=!0;I=d||null;L={success:!1,id:e};var f=h(e);if(f){"OBJECT"==f.nodeName?(C=t(f),G=null):(C=f,G=e);c.id="SWFObjectExprInst";if("undefined"==typeof c.width||!/%$/.test(c.width)&&310>parseInt(c.width,10))c.width="310";if("undefined"==typeof c.height||!/%$/.test(c.height)&&137>parseInt(c.height,10))c.height="137";l.title=l.title.slice(0,47)+" - Flash Player Installation";d=k.ie&&k.win?"ActiveX":"PlugIn";d="MMredirectURL="+u.location.toString().replace(/&/g,"%26")+"&MMplayerType="+
27
+ d+"&MMdoctitle="+l.title;b.flashvars="undefined"!=typeof b.flashvars?b.flashvars+("&"+d):d;k.ie&&k.win&&4!=f.readyState&&(d=l.createElement("div"),e+="SWFObjectNew",d.setAttribute("id",e),f.parentNode.insertBefore(d,f),f.style.display="none",function(){4==f.readyState?f.parentNode.removeChild(f):setTimeout(arguments.callee,10)}());a(c,b,e)}}function r(a){if(k.ie&&k.win&&4!=a.readyState){var c=l.createElement("div");a.parentNode.insertBefore(c,a);c.parentNode.replaceChild(t(a),c);a.style.display="none";
28
+ (function(){4==a.readyState?a.parentNode.removeChild(a):setTimeout(arguments.callee,10)})()}else a.parentNode.replaceChild(t(a),a)}function t(a){var c=l.createElement("div");if(k.win&&k.ie)c.innerHTML=a.innerHTML;else if(a=a.getElementsByTagName("object")[0])if(a=a.childNodes)for(var b=a.length,h=0;h<b;h++)1==a[h].nodeType&&"PARAM"==a[h].nodeName||8==a[h].nodeType||c.appendChild(a[h].cloneNode(!0));return c}function a(a,c,b){var e,f=h(b);if(k.wk&&312>k.wk)return e;if(f)if("undefined"==typeof a.id&&
29
+ (a.id=b),k.ie&&k.win){var d="",m;for(m in a)a[m]!=Object.prototype[m]&&("data"==m.toLowerCase()?c.movie=a[m]:"styleclass"==m.toLowerCase()?d+=' class="'+a[m]+'"':"classid"!=m.toLowerCase()&&(d+=" "+m+'="'+a[m]+'"'));m="";for(var g in c)c[g]!=Object.prototype[g]&&(m+='<param name="'+g+'" value="'+c[g]+'" />');f.outerHTML='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"'+d+">"+m+"</object>";H[H.length]=a.id;e=h(a.id)}else{g=l.createElement("object");g.setAttribute("type","application/x-shockwave-flash");
30
+ for(var n in a)a[n]!=Object.prototype[n]&&("styleclass"==n.toLowerCase()?g.setAttribute("class",a[n]):"classid"!=n.toLowerCase()&&g.setAttribute(n,a[n]));for(d in c)c[d]!=Object.prototype[d]&&"movie"!=d.toLowerCase()&&(a=g,m=d,n=c[d],b=l.createElement("param"),b.setAttribute("name",m),b.setAttribute("value",n),a.appendChild(b));f.parentNode.replaceChild(g,f);e=g}return e}function c(a){var c=h(a);c&&"OBJECT"==c.nodeName&&(k.ie&&k.win?(c.style.display="none",function(){if(4==c.readyState){var b=h(a);
31
+ if(b){for(var d in b)"function"==typeof b[d]&&(b[d]=null);b.parentNode.removeChild(b)}}else setTimeout(arguments.callee,10)}()):c.parentNode.removeChild(c))}function h(a){var c=null;try{c=l.getElementById(a)}catch(b){}return c}function v(a,c,b){a.attachEvent(c,b);B[B.length]=[a,c,b]}function D(a){var c=k.pv;a=a.split(".");a[0]=parseInt(a[0],10);a[1]=parseInt(a[1],10)||0;a[2]=parseInt(a[2],10)||0;return c[0]>a[0]||c[0]==a[0]&&c[1]>a[1]||c[0]==a[0]&&c[1]==a[1]&&c[2]>=a[2]?!0:!1}function m(a,c,b,h){if(!k.ie||
32
+ !k.mac){var d=l.getElementsByTagName("head")[0];d&&(b=b&&"string"==typeof b?b:"screen",h&&(J=w=null),w&&J==b||(h=l.createElement("style"),h.setAttribute("type","text/css"),h.setAttribute("media",b),w=d.appendChild(h),k.ie&&k.win&&"undefined"!=typeof l.styleSheets&&0<l.styleSheets.length&&(w=l.styleSheets[l.styleSheets.length-1]),J=b),k.ie&&k.win?w&&"object"==typeof w.addRule&&w.addRule(a,c):w&&"undefined"!=typeof l.createTextNode&&w.appendChild(l.createTextNode(a+" {"+c+"}")))}}function z(a,c){if(M){var b=
33
+ c?"visible":"hidden";A&&h(a)?h(a).style.visibility=b:m("#"+a,"visibility:"+b)}}function K(a){return null!=/[\\\"<>\.;]/.exec(a)&&"undefined"!=typeof encodeURIComponent?encodeURIComponent(a):a}var u=window,l=document,x=navigator,N=!1,E=[function(){N?n():b()}],y=[],H=[],B=[],C,G,I,L,A=!1,F=!1,w,J,M=!0,k=function(){var a="undefined"!=typeof l.getElementById&&"undefined"!=typeof l.getElementsByTagName&&"undefined"!=typeof l.createElement,c=x.userAgent.toLowerCase(),b=x.platform.toLowerCase(),h=b?/win/.test(b):
34
+ /win/.test(c),b=b?/mac/.test(b):/mac/.test(c),c=/webkit/.test(c)?parseFloat(c.replace(/^.*webkit\/(\d+(\.\d+)?).*$/,"$1")):!1,d=!+"\v1",e=[0,0,0],f=null;if("undefined"!=typeof x.plugins&&"object"==typeof x.plugins["Shockwave Flash"])!(f=x.plugins["Shockwave Flash"].description)||"undefined"!=typeof x.mimeTypes&&x.mimeTypes["application/x-shockwave-flash"]&&!x.mimeTypes["application/x-shockwave-flash"].enabledPlugin||(N=!0,d=!1,f=f.replace(/^.*\s+(\S+\s+\S+$)/,"$1"),e[0]=parseInt(f.replace(/^(.*)\..*$/,
35
+ "$1"),10),e[1]=parseInt(f.replace(/^.*\.(.*)\s.*$/,"$1"),10),e[2]=/[a-zA-Z]/.test(f)?parseInt(f.replace(/^.*[a-zA-Z]+(.*)$/,"$1"),10):0);else if("undefined"!=typeof u.ActiveXObject)try{var m=new ActiveXObject("ShockwaveFlash.ShockwaveFlash");m&&(f=m.GetVariable("$version"))&&(d=!0,f=f.split(" ")[1].split(","),e=[parseInt(f[0],10),parseInt(f[1],10),parseInt(f[2],10)])}catch(g){}return{w3:a,pv:e,wk:c,ie:d,win:h,mac:b}}();(function(){k.w3&&(("undefined"!=typeof l.readyState&&"complete"==l.readyState||
36
+ "undefined"==typeof l.readyState&&(l.getElementsByTagName("body")[0]||l.body))&&f(),A||("undefined"!=typeof l.addEventListener&&l.addEventListener("DOMContentLoaded",f,!1),k.ie&&k.win&&(l.attachEvent("onreadystatechange",function(){"complete"==l.readyState&&(l.detachEvent("onreadystatechange",arguments.callee),f())}),u==top&&function(){if(!A){try{l.documentElement.doScroll("left")}catch(a){setTimeout(arguments.callee,0);return}f()}}()),k.wk&&function(){A||(/loaded|complete/.test(l.readyState)?f():
37
+ setTimeout(arguments.callee,0))}(),d(f)))})();(function(){k.ie&&k.win&&window.attachEvent("onunload",function(){for(var a=B.length,b=0;b<a;b++)B[b][0].detachEvent(B[b][1],B[b][2]);a=H.length;for(b=0;b<a;b++)c(H[b]);for(var h in k)k[h]=null;k=null;for(var d in swfobject)swfobject[d]=null;swfobject=null})})();return{registerObject:function(a,c,b,h){if(k.w3&&a&&c){var d={};d.id=a;d.swfVersion=c;d.expressInstall=b;d.callbackFn=h;y[y.length]=d;z(a,!1)}else h&&h({success:!1,id:a})},getObjectById:function(a){if(k.w3)return g(a)},
38
+ embedSWF:function(c,b,h,d,f,m,g,n,l,v){var u={success:!1,id:b};k.w3&&!(k.wk&&312>k.wk)&&c&&b&&h&&d&&f?(z(b,!1),e(function(){h+="";d+="";var e={};if(l&&"object"===typeof l)for(var k in l)e[k]=l[k];e.data=c;e.width=h;e.height=d;k={};if(n&&"object"===typeof n)for(var r in n)k[r]=n[r];if(g&&"object"===typeof g)for(var t in g)k.flashvars="undefined"!=typeof k.flashvars?k.flashvars+("&"+t+"="+g[t]):t+"="+g[t];if(D(f))r=a(e,k,b),e.id==b&&z(b,!0),u.success=!0,u.ref=r;else{if(m&&p()){e.data=m;q(e,k,b,v);return}z(b,
39
+ !0)}v&&v(u)})):v&&v(u)},switchOffAutoHideShow:function(){M=!1},ua:k,getFlashPlayerVersion:function(){return{major:k.pv[0],minor:k.pv[1],release:k.pv[2]}},hasFlashPlayerVersion:D,createSWF:function(c,b,h){if(k.w3)return a(c,b,h)},showExpressInstall:function(a,c,b,h){k.w3&&p()&&q(a,c,b,h)},removeSWF:function(a){k.w3&&c(a)},createCSS:function(a,c,b,h){k.w3&&m(a,c,b,h)},addDomLoadEvent:e,addLoadEvent:d,getQueryParamValue:function(a){var c=l.location.search||l.location.hash;if(c){/\?/.test(c)&&(c=c.split("?")[1]);
40
+ if(null==a)return K(c);for(var c=c.split("&"),b=0;b<c.length;b++)if(c[b].substring(0,c[b].indexOf("="))==a)return K(c[b].substring(c[b].indexOf("=")+1))}return""},expressInstallCallback:function(){if(F){var a=h("SWFObjectExprInst");a&&C&&(a.parentNode.replaceChild(C,a),G&&(z(G,!0),k.ie&&k.win&&(C.style.display="block")),I&&I(L));F=!1}}}}();function murmurhash3_32_gc(f,e){var d,n,b,g,p;d=f.length&3;n=f.length-d;b=e;for(p=0;p<n;)g=f.charCodeAt(p)&255|(f.charCodeAt(++p)&255)<<8|(f.charCodeAt(++p)&255)<<16|(f.charCodeAt(++p)&255)<<24,++p,g=3432918353*(g&65535)+((3432918353*(g>>>16)&65535)<<16)&4294967295,g=g<<15|g>>>17,g=461845907*(g&65535)+((461845907*(g>>>16)&65535)<<16)&4294967295,b^=g,b=b<<13|b>>>19,b=5*(b&65535)+((5*(b>>>16)&65535)<<16)&4294967295,b=(b&65535)+27492+(((b>>>16)+58964&65535)<<16);g=0;switch(d){case 3:g^=(f.charCodeAt(p+
41
+ 2)&255)<<16;case 2:g^=(f.charCodeAt(p+1)&255)<<8;case 1:g^=f.charCodeAt(p)&255,g=3432918353*(g&65535)+((3432918353*(g>>>16)&65535)<<16)&4294967295,g=g<<15|g>>>17,b^=461845907*(g&65535)+((461845907*(g>>>16)&65535)<<16)&4294967295}b^=f.length;b^=b>>>16;b=2246822507*(b&65535)+((2246822507*(b>>>16)&65535)<<16)&4294967295;b^=b>>>13;b=3266489909*(b&65535)+((3266489909*(b>>>16)&65535)<<16)&4294967295;return(b^b>>>16)>>>0};var deployJava=function(){function f(a){p.debug&&(console.log?console.log(a):alert(a))}function e(a){if(null==a||0==a.length)return"http://java.com/dt-redirect";"&"==a.charAt(0)&&(a=a.substring(1,a.length));return"http://java.com/dt-redirect?"+a}var d=["id","class","title","style"];"classid codebase codetype data type archive declare standby height width usemap name tabindex align border hspace vspace".split(" ").concat(d,["lang","dir"],"onclick ondblclick onmousedown onmouseup onmouseover onmousemove onmouseout onkeypress onkeydown onkeyup".split(" "));
42
+ var n="codebase code name archive object width height alt align hspace vspace".split(" ").concat(d),b;try{b=-1!=document.location.protocol.indexOf("http")?"//java.com/js/webstart.png":"http://java.com/js/webstart.png"}catch(g){b="http://java.com/js/webstart.png"}var p={debug:null,version:"20120801",firefoxJavaVersion:null,myInterval:null,preInstallJREList:null,returnPage:null,brand:null,locale:null,installType:null,EAInstallEnabled:!1,EarlyAccessURL:null,oldMimeType:"application/npruntime-scriptable-plugin;DeploymentToolkit",
43
+ mimeType:"application/java-deployment-toolkit",launchButtonPNG:b,browserName:null,browserName2:null,getJREs:function(){var a=[];if(this.isPluginInstalled())for(var c=this.getPlugin().jvms,b=0;b<c.getLength();b++)a[b]=c.get(b).version;else c=this.getBrowser(),"MSIE"==c?this.testUsingActiveX("1.7.0")?a[0]="1.7.0":this.testUsingActiveX("1.6.0")?a[0]="1.6.0":this.testUsingActiveX("1.5.0")?a[0]="1.5.0":this.testUsingActiveX("1.4.2")?a[0]="1.4.2":this.testForMSVM()&&(a[0]="1.1"):"Netscape Family"==c&&(this.getJPIVersionUsingMimeType(),
44
+ null!=this.firefoxJavaVersion?a[0]=this.firefoxJavaVersion:this.testUsingMimeTypes("1.7")?a[0]="1.7.0":this.testUsingMimeTypes("1.6")?a[0]="1.6.0":this.testUsingMimeTypes("1.5")?a[0]="1.5.0":this.testUsingMimeTypes("1.4.2")?a[0]="1.4.2":"Safari"==this.browserName2&&(this.testUsingPluginsArray("1.7.0")?a[0]="1.7.0":this.testUsingPluginsArray("1.6")?a[0]="1.6.0":this.testUsingPluginsArray("1.5")?a[0]="1.5.0":this.testUsingPluginsArray("1.4.2")&&(a[0]="1.4.2")));if(this.debug)for(b=0;b<a.length;++b)f("[getJREs()] We claim to have detected Java SE "+
45
+ a[b]);return a},installJRE:function(a,c){if(this.isPluginInstalled()&&this.isAutoInstallEnabled(a)){var b=!1;if(b=this.isCallbackSupported()?this.getPlugin().installJRE(a,c):this.getPlugin().installJRE(a))this.refresh(),null!=this.returnPage&&(document.location=this.returnPage);return b}return this.installLatestJRE()},isAutoInstallEnabled:function(a){if(!this.isPluginInstalled())return!1;"undefined"==typeof a&&(a=null);if("MSIE"!=deployJava.browserName||deployJava.compareVersionToPattern(deployJava.getPlugin().version,
46
+ ["10","0","0"],!1,!0))a=!0;else if(null==a)a=!1;else{var c="1.6.0_33+";if(null==c||0==c.length)a=!0;else{var b=c.charAt(c.length-1);"+"!=b&&"*"!=b&&-1!=c.indexOf("_")&&"_"!=b&&(c+="*",b="*");c=c.substring(0,c.length-1);if(0<c.length){var d=c.charAt(c.length-1);if("."==d||"_"==d)c=c.substring(0,c.length-1)}a="*"==b?0==a.indexOf(c):"+"==b?c<=a:!1}a=!a}return a},isCallbackSupported:function(){return this.isPluginInstalled()&&this.compareVersionToPattern(this.getPlugin().version,["10","2","0"],!1,!0)},
47
+ installLatestJRE:function(a){if(this.isPluginInstalled()&&this.isAutoInstallEnabled()){var c=!1;if(c=this.isCallbackSupported()?this.getPlugin().installLatestJRE(a):this.getPlugin().installLatestJRE())this.refresh(),null!=this.returnPage&&(document.location=this.returnPage);return c}a=this.getBrowser();c=navigator.platform.toLowerCase();if("true"==this.EAInstallEnabled&&-1!=c.indexOf("win")&&null!=this.EarlyAccessURL)this.preInstallJREList=this.getJREs(),null!=this.returnPage&&(this.myInterval=setInterval("deployJava.poll()",
48
+ 3E3)),location.href=this.EarlyAccessURL;else{if("MSIE"==a)return this.IEInstall();if("Netscape Family"==a&&-1!=c.indexOf("win32"))return this.FFInstall();location.href=e((null!=this.returnPage?"&returnPage="+this.returnPage:"")+(null!=this.locale?"&locale="+this.locale:"")+(null!=this.brand?"&brand="+this.brand:""))}return!1},runApplet:function(a,c,b){if("undefined"==b||null==b)b="1.1";var d=b.match("^(\\d+)(?:\\.(\\d+)(?:\\.(\\d+)(?:_(\\d+))?)?)?$");null==this.returnPage&&(this.returnPage=document.location);
49
+ null!=d?"?"!=this.getBrowser()?this.versionCheck(b+"+")?this.writeAppletTag(a,c):this.installJRE(b+"+")&&(this.refresh(),location.href=document.location,this.writeAppletTag(a,c)):this.writeAppletTag(a,c):f("[runApplet()] Invalid minimumVersion argument to runApplet():"+b)},writeAppletTag:function(a,c){var b="<applet ",d="",e=!0;if(null==c||"object"!=typeof c)c={};for(var f in a){var g;a:{g=f.toLowerCase();for(var p=n.length,q=0;q<p;q++)if(n[q]===g){g=!0;break a}g=!1}g?(b+=" "+f+'="'+a[f]+'"',"code"==
50
+ f&&(e=!1)):c[f]=a[f]}f=!1;for(var l in c){"codebase_lookup"==l&&(f=!0);if("object"==l||"java_object"==l||"java_code"==l)e=!1;d+='<param name="'+l+'" value="'+c[l]+'"/>'}f||(d+='<param name="codebase_lookup" value="false"/>');e&&(b+=' code="dummy"');document.write(b+">\n"+d+"\n</applet>")},versionCheck:function(a){var c=0,b=a.match("^(\\d+)(?:\\.(\\d+)(?:\\.(\\d+)(?:_(\\d+))?)?)?(\\*|\\+)?$");if(null!=b){for(var d=a=!1,e=[],g=1;g<b.length;++g)"string"==typeof b[g]&&""!=b[g]&&(e[c]=b[g],c++);"+"==e[e.length-
51
+ 1]?(d=!0,a=!1,e.length--):"*"==e[e.length-1]?(d=!1,a=!0,e.length--):4>e.length&&(d=!1,a=!0);c=this.getJREs();for(g=0;g<c.length;++g)if(this.compareVersionToPattern(c[g],e,a,d))return!0}else c="Invalid versionPattern passed to versionCheck: "+a,f("[versionCheck()] "+c),alert(c);return!1},isWebStartInstalled:function(a){if("?"==this.getBrowser())return!0;if("undefined"==a||null==a)a="1.4.2";var c=!1;null!=a.match("^(\\d+)(?:\\.(\\d+)(?:\\.(\\d+)(?:_(\\d+))?)?)?$")?c=this.versionCheck(a+"+"):(f("[isWebStartInstaller()] Invalid minimumVersion argument to isWebStartInstalled(): "+
52
+ a),c=this.versionCheck("1.4.2+"));return c},getJPIVersionUsingMimeType:function(){for(var a=0;a<navigator.mimeTypes.length;++a){var c=navigator.mimeTypes[a].type.match(/^application\/x-java-applet;jpi-version=(.*)$/);if(null!=c&&(this.firefoxJavaVersion=c[1],"Opera"!=this.browserName2))break}},launchWebStartApplication:function(a){navigator.userAgent.toLowerCase();this.getJPIVersionUsingMimeType();if(0==this.isWebStartInstalled("1.7.0")&&(0==this.installJRE("1.7.0+")||0==this.isWebStartInstalled("1.7.0")))return!1;
53
+ var c=null;document.documentURI&&(c=document.documentURI);null==c&&(c=document.URL);var b=this.getBrowser(),d;"MSIE"==b?d='<object classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93" width="0" height="0"><PARAM name="launchjnlp" value="'+a+'"><PARAM name="docbase" value="'+c+'"></object>':"Netscape Family"==b&&(d='<embed type="application/x-java-applet;jpi-version='+this.firefoxJavaVersion+'" width="0" height="0" launchjnlp="'+a+'"docbase="'+c+'" />');"undefined"==document.body||null==document.body?
54
+ (document.write(d),document.location=c):(a=document.createElement("div"),a.id="div1",a.style.position="relative",a.style.left="-10000px",a.style.margin="0px auto",a.className="dynamicDiv",a.innerHTML=d,document.body.appendChild(a))},createWebStartLaunchButtonEx:function(a,c){null==this.returnPage&&(this.returnPage=a);document.write('<a href="'+("javascript:deployJava.launchWebStartApplication('"+a+"');")+'" onMouseOver="window.status=\'\'; return true;"><img src="'+this.launchButtonPNG+'" border="0" /></a>')},
55
+ createWebStartLaunchButton:function(a,c){null==this.returnPage&&(this.returnPage=a);document.write('<a href="'+("javascript:if (!deployJava.isWebStartInstalled(&quot;"+c+"&quot;)) {if (deployJava.installLatestJRE()) {if (deployJava.launch(&quot;"+a+"&quot;)) {}}} else {if (deployJava.launch(&quot;"+a+"&quot;)) {}}")+'" onMouseOver="window.status=\'\'; return true;"><img src="'+this.launchButtonPNG+'" border="0" /></a>')},launch:function(a){document.location=a;return!0},isPluginInstalled:function(){var a=
56
+ this.getPlugin();return a&&a.jvms?!0:!1},isAutoUpdateEnabled:function(){return this.isPluginInstalled()?this.getPlugin().isAutoUpdateEnabled():!1},setAutoUpdateEnabled:function(){return this.isPluginInstalled()?this.getPlugin().setAutoUpdateEnabled():!1},setInstallerType:function(a){this.installType=a;return this.isPluginInstalled()?this.getPlugin().setInstallerType(a):!1},setAdditionalPackages:function(a){return this.isPluginInstalled()?this.getPlugin().setAdditionalPackages(a):!1},setEarlyAccess:function(a){this.EAInstallEnabled=
57
+ a},isPlugin2:function(){if(this.isPluginInstalled()&&this.versionCheck("1.6.0_10+"))try{return this.getPlugin().isPlugin2()}catch(a){}return!1},allowPlugin:function(){this.getBrowser();return"Safari"!=this.browserName2&&"Opera"!=this.browserName2},getPlugin:function(){this.refresh();var a=null;this.allowPlugin()&&(a=document.getElementById("deployJavaPlugin"));return a},compareVersionToPattern:function(a,c,b,d){if(void 0==a||void 0==c)return!1;var e=a.match("^(\\d+)(?:\\.(\\d+)(?:\\.(\\d+)(?:_(\\d+))?)?)?$");
58
+ if(null!=e){var f=0;a=[];for(var g=1;g<e.length;++g)"string"==typeof e[g]&&""!=e[g]&&(a[f]=e[g],f++);e=Math.min(a.length,c.length);if(d){for(g=0;g<e;++g){if(a[g]<c[g])return!1;if(a[g]>c[g])break}return!0}for(g=0;g<e;++g)if(a[g]!=c[g])return!1;return b?!0:a.length==c.length}return!1},getBrowser:function(){if(null==this.browserName){var a=navigator.userAgent.toLowerCase();f("[getBrowser()] navigator.userAgent.toLowerCase() -> "+a);-1!=a.indexOf("msie")&&-1==a.indexOf("opera")?this.browserName2=this.browserName=
59
+ "MSIE":-1!=a.indexOf("iphone")?(this.browserName="Netscape Family",this.browserName2="iPhone"):-1!=a.indexOf("firefox")&&-1==a.indexOf("opera")?(this.browserName="Netscape Family",this.browserName2="Firefox"):-1!=a.indexOf("chrome")?(this.browserName="Netscape Family",this.browserName2="Chrome"):-1!=a.indexOf("safari")?(this.browserName="Netscape Family",this.browserName2="Safari"):-1!=a.indexOf("mozilla")&&-1==a.indexOf("opera")?(this.browserName="Netscape Family",this.browserName2="Other"):-1!=
60
+ a.indexOf("opera")?(this.browserName="Netscape Family",this.browserName2="Opera"):(this.browserName="?",this.browserName2="unknown");f("[getBrowser()] Detected browser name:"+this.browserName+", "+this.browserName2)}return this.browserName},testUsingActiveX:function(a){a="JavaWebStart.isInstalled."+a+".0";if("undefined"==typeof ActiveXObject||!ActiveXObject)return f("[testUsingActiveX()] Browser claims to be IE, but no ActiveXObject object?"),!1;try{return null!=new ActiveXObject(a)}catch(c){return!1}},
61
+ testForMSVM:function(){if("undefined"!=typeof oClientCaps){var a=oClientCaps.getComponentVersion("{08B0E5C0-4FCB-11CF-AAA5-00401C608500}","ComponentID");return""==a||"5,0,5000,0"==a?!1:!0}return!1},testUsingMimeTypes:function(a){if(!navigator.mimeTypes)return f("[testUsingMimeTypes()] Browser claims to be Netscape family, but no mimeTypes[] array?"),!1;for(var c=0;c<navigator.mimeTypes.length;++c){s=navigator.mimeTypes[c].type;var b=s.match(/^application\/x-java-applet\x3Bversion=(1\.8|1\.7|1\.6|1\.5|1\.4\.2)$/);
62
+ if(null!=b&&this.compareVersions(b[1],a))return!0}return!1},testUsingPluginsArray:function(a){if(!navigator.plugins||!navigator.plugins.length)return!1;for(var c=navigator.platform.toLowerCase(),b=0;b<navigator.plugins.length;++b)if(s=navigator.plugins[b].description,-1!=s.search(/^Java Switchable Plug-in (Cocoa)/)){if(this.compareVersions("1.5.0",a))return!0}else if(-1!=s.search(/^Java/)&&-1!=c.indexOf("win")&&(this.compareVersions("1.5.0",a)||this.compareVersions("1.6.0",a)))return!0;return this.compareVersions("1.5.0",
63
+ a)?!0:!1},IEInstall:function(){location.href=e((null!=this.returnPage?"&returnPage="+this.returnPage:"")+(null!=this.locale?"&locale="+this.locale:"")+(null!=this.brand?"&brand="+this.brand:""));return!1},done:function(a,b){},FFInstall:function(){location.href=e((null!=this.returnPage?"&returnPage="+this.returnPage:"")+(null!=this.locale?"&locale="+this.locale:"")+(null!=this.brand?"&brand="+this.brand:"")+(null!=this.installType?"&type="+this.installType:""));return!1},compareVersions:function(a,
64
+ b){for(var d=a.split("."),e=b.split("."),f=0;f<d.length;++f)d[f]=Number(d[f]);for(f=0;f<e.length;++f)e[f]=Number(e[f]);2==d.length&&(d[2]=0);return d[0]>e[0]?!0:d[0]<e[0]?!1:d[1]>e[1]?!0:d[1]<e[1]?!1:d[2]>e[2]?!0:d[2]<e[2]?!1:!0},enableAlerts:function(){this.browserName=null;this.debug=!0},poll:function(){this.refresh();var a=this.getJREs();0==this.preInstallJREList.length&&0!=a.length&&(clearInterval(this.myInterval),null!=this.returnPage&&(location.href=this.returnPage));0!=this.preInstallJREList.length&&
65
+ 0!=a.length&&this.preInstallJREList[0]!=a[0]&&(clearInterval(this.myInterval),null!=this.returnPage&&(location.href=this.returnPage))},writePluginTag:function(){var a=this.getBrowser();"MSIE"==a?document.write('<object classid="clsid:CAFEEFAC-DEC7-0000-0001-ABCDEFFEDCBA" id="deployJavaPlugin" width="0" height="0"></object>'):"Netscape Family"==a&&this.allowPlugin()&&this.writeEmbedTag()},refresh:function(){navigator.plugins.refresh(!1);"Netscape Family"==this.getBrowser()&&this.allowPlugin()&&null==
66
+ document.getElementById("deployJavaPlugin")&&this.writeEmbedTag()},writeEmbedTag:function(){var a=!1;if(null!=navigator.mimeTypes){for(var b=0;b<navigator.mimeTypes.length;b++)navigator.mimeTypes[b].type==this.mimeType&&navigator.mimeTypes[b].enabledPlugin&&(document.write('<embed id="deployJavaPlugin" type="'+this.mimeType+'" hidden="true" />'),a=!0);if(!a)for(b=0;b<navigator.mimeTypes.length;b++)navigator.mimeTypes[b].type==this.oldMimeType&&navigator.mimeTypes[b].enabledPlugin&&document.write('<embed id="deployJavaPlugin" type="'+
67
+ this.oldMimeType+'" hidden="true" />')}}};p.writePluginTag();if(null==p.locale){d=null;if(null==d)try{d=navigator.userLanguage}catch(q){}if(null==d)try{d=navigator.systemLanguage}catch(r){}if(null==d)try{d=navigator.language}catch(t){}null!=d&&(d.replace("-","_"),p.locale=d)}return p}();(function(f){var e,d=function(){e=(new UAParser).getResult();return this};d.prototype={getSoftwareVersion:function(){return"ClientJS 0.1.5"},getBrowserData:function(){return e},getFingerprint:function(){var d=e.ua,b=this.getScreenPrint(),f=this.getPlugins(),p=this.getFonts(),q=this.isLocalStorage(),r=this.isSessionStorage(),t=this.getTimeZone(),a=this.getLanguage(),c=this.getSystemLanguage(),h=this.isCookie(),v=this.getCanvasPrint();return murmurhash3_32_gc(d+"|"+b+"|"+f+"|"+p+"|"+q+"|"+r+"|"+t+"|"+
68
+ a+"|"+c+"|"+h+"|"+v,256)},getUserAgent:function(){return e.ua},getUserAgentLowerCase:function(){return e.ua.toLowerCase()},getBrowser:function(){return e.browser.name},getBrowserVersion:function(){return e.browser.version},getBrowserMajorVersion:function(){return e.browser.major},isIE:function(){return/IE/i.test(e.browser.name)},isChrome:function(){return/Chrome/i.test(e.browser.name)},isFirefox:function(){return/Firefox/i.test(e.browser.name)},isSafari:function(){return/Safari/i.test(e.browser.name)},
69
+ isOpera:function(){return/Opera/i.test(e.browser.name)},getEngine:function(){return e.engine.name},getEngineVersion:function(){return e.engine.version},getOS:function(){return e.os.name},getOSVersion:function(){return e.os.version},isWindows:function(){return/Windows/i.test(e.os.name)},isMac:function(){return/Mac/i.test(e.os.name)},isLinux:function(){return/Linux/i.test(e.os.name)},isUbuntu:function(){return/Ubuntu/i.test(e.os.name)},isSolaris:function(){return/Solaris/i.test(e.os.name)},getDevice:function(){return e.device.model},
70
+ getDeviceType:function(){return e.device.type},getDeviceVendor:function(){return e.device.vendor},getCPU:function(){return e.cpu.architecture},isMobile:function(){var d=e.ua||navigator.vendor||window.opera;return/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i.test(d)||
71
+ /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(d.substr(0,
72
+ 4))},isMobileMajor:function(){return this.isMobileAndroid()||this.isMobileBlackBerry()||this.isMobileIOS()||this.isMobileOpera()||this.isMobileWindows()},isMobileAndroid:function(){return e.ua.match(/Android/i)?!0:!1},isMobileOpera:function(){return e.ua.match(/Opera Mini/i)?!0:!1},isMobileWindows:function(){return e.ua.match(/IEMobile/i)?!0:!1},isMobileBlackBerry:function(){return e.ua.match(/BlackBerry/i)?!0:!1},isMobileIOS:function(){return e.ua.match(/iPhone|iPad|iPod/i)?!0:!1},isIphone:function(){return e.ua.match(/iPhone/i)?
73
+ !0:!1},isIpad:function(){return e.ua.match(/iPad/i)?!0:!1},isIpod:function(){return e.ua.match(/iPod/i)?!0:!1},getScreenPrint:function(){return"Current Resolution: "+this.getCurrentResolution()+", Avaiable Resolution: "+this.getAvailableResolution()+", Color Depth: "+this.getColorDepth()+", Device XDPI: "+this.getDeviceXDPI()+", Device YDPI: "+this.getDeviceYDPI()},getColorDepth:function(){return screen.colorDepth},getCurrentResolution:function(){return screen.width+"x"+screen.height},getAvailableResolution:function(){return screen.availWidth+
74
+ "x"+screen.availHeight},getDeviceXDPI:function(){return screen.deviceXDPI},getDeviceYDPI:function(){return screen.deviceYDPI},getPlugins:function(){for(var d="",b=0;b<navigator.plugins.length;b++)d=b==navigator.plugins.length-1?d+navigator.plugins[b].name:d+(navigator.plugins[b].name+", ");return d},isJava:function(){return navigator.javaEnabled()},getJavaVersion:function(){return deployJava.getJREs().toString()},isFlash:function(){return navigator.plugins["Shockwave Flash"]?!0:!1},getFlashVersion:function(){return this.isFlash()?
75
+ (objPlayerVersion=swfobject.getFlashPlayerVersion(),objPlayerVersion.major+"."+objPlayerVersion.minor+"."+objPlayerVersion.release):""},isSilverlight:function(){return navigator.plugins["Silverlight Plug-In"]?!0:!1},getSilverlightVersion:function(){return this.isSilverlight()?navigator.plugins["Silverlight Plug-In"].description:""},isMimeTypes:function(){return navigator.mimeTypes.length?!0:!1},getMimeTypes:function(){for(var d="",b=0;b<navigator.mimeTypes.length;b++)d=b==navigator.mimeTypes.length-
76
+ 1?d+navigator.mimeTypes[b].description:d+(navigator.mimeTypes[b].description+", ");return d},isFont:function(d){return(new Detector).detect(d)},getFonts:function(){for(var d=new Detector,b="Abadi MT Condensed Light;Adobe Fangsong Std;Adobe Hebrew;Adobe Ming Std;Agency FB;Aharoni;Andalus;Angsana New;AngsanaUPC;Aparajita;Arab;Arabic Transparent;Arabic Typesetting;Arial Baltic;Arial Black;Arial CE;Arial CYR;Arial Greek;Arial TUR;Arial;Batang;BatangChe;Bauhaus 93;Bell MT;Bitstream Vera Serif;Bodoni MT;Bookman Old Style;Braggadocio;Broadway;Browallia New;BrowalliaUPC;Calibri Light;Calibri;Californian FB;Cambria Math;Cambria;Candara;Castellar;Casual;Centaur;Century Gothic;Chalkduster;Colonna MT;Comic Sans MS;Consolas;Constantia;Copperplate Gothic Light;Corbel;Cordia New;CordiaUPC;Courier New Baltic;Courier New CE;Courier New CYR;Courier New Greek;Courier New TUR;Courier New;DFKai-SB;DaunPenh;David;DejaVu LGC Sans Mono;Desdemona;DilleniaUPC;DokChampa;Dotum;DotumChe;Ebrima;Engravers MT;Eras Bold ITC;Estrangelo Edessa;EucrosiaUPC;Euphemia;Eurostile;FangSong;Forte;FrankRuehl;Franklin Gothic Heavy;Franklin Gothic Medium;FreesiaUPC;French Script MT;Gabriola;Gautami;Georgia;Gigi;Gisha;Goudy Old Style;Gulim;GulimChe;GungSeo;Gungsuh;GungsuhChe;Haettenschweiler;Harrington;Hei S;HeiT;Heisei Kaku Gothic;Hiragino Sans GB;Impact;Informal Roman;IrisUPC;Iskoola Pota;JasmineUPC;KacstOne;KaiTi;Kalinga;Kartika;Khmer UI;Kino MT;KodchiangUPC;Kokila;Kozuka Gothic Pr6N;Lao UI;Latha;Leelawadee;Levenim MT;LilyUPC;Lohit Gujarati;Loma;Lucida Bright;Lucida Console;Lucida Fax;Lucida Sans Unicode;MS Gothic;MS Mincho;MS PGothic;MS PMincho;MS Reference Sans Serif;MS UI Gothic;MV Boli;Magneto;Malgun Gothic;Mangal;Marlett;Matura MT Script Capitals;Meiryo UI;Meiryo;Menlo;Microsoft Himalaya;Microsoft JhengHei;Microsoft New Tai Lue;Microsoft PhagsPa;Microsoft Sans Serif;Microsoft Tai Le;Microsoft Uighur;Microsoft YaHei;Microsoft Yi Baiti;MingLiU;MingLiU-ExtB;MingLiU_HKSCS;MingLiU_HKSCS-ExtB;Miriam Fixed;Miriam;Mongolian Baiti;MoolBoran;NSimSun;Narkisim;News Gothic MT;Niagara Solid;Nyala;PMingLiU;PMingLiU-ExtB;Palace Script MT;Palatino Linotype;Papyrus;Perpetua;Plantagenet Cherokee;Playbill;Prelude Bold;Prelude Condensed Bold;Prelude Condensed Medium;Prelude Medium;PreludeCompressedWGL Black;PreludeCompressedWGL Bold;PreludeCompressedWGL Light;PreludeCompressedWGL Medium;PreludeCondensedWGL Black;PreludeCondensedWGL Bold;PreludeCondensedWGL Light;PreludeCondensedWGL Medium;PreludeWGL Black;PreludeWGL Bold;PreludeWGL Light;PreludeWGL Medium;Raavi;Rachana;Rockwell;Rod;Sakkal Majalla;Sawasdee;Script MT Bold;Segoe Print;Segoe Script;Segoe UI Light;Segoe UI Semibold;Segoe UI Symbol;Segoe UI;Shonar Bangla;Showcard Gothic;Shruti;SimHei;SimSun;SimSun-ExtB;Simplified Arabic Fixed;Simplified Arabic;Snap ITC;Sylfaen;Symbol;Tahoma;Times New Roman Baltic;Times New Roman CE;Times New Roman CYR;Times New Roman Greek;Times New Roman TUR;Times New Roman;TlwgMono;Traditional Arabic;Trebuchet MS;Tunga;Tw Cen MT Condensed Extra Bold;Ubuntu;Umpush;Univers;Utopia;Utsaah;Vani;Verdana;Vijaya;Vladimir Script;Vrinda;Webdings;Wide Latin;Wingdings".split(";"),
77
+ e="",f=0;f<b.length;f++)d.detect(b[f])&&(e=f==b.length-1?e+b[f]:e+(b[f]+", "));return e},isLocalStorage:function(){try{return!!f.localStorage}catch(d){return!0}},isSessionStorage:function(){try{return!!f.sessionStorage}catch(d){return!0}},isCookie:function(){return navigator.cookieEnabled},getTimeZone:function(){return String(String(new Date).split("(")[1]).split(")")[0]},getLanguage:function(){return navigator.language},getSystemLanguage:function(){return navigator.systemLanguage},isCanvas:function(){var d=
78
+ document.createElement("canvas");try{return!(!d.getContext||!d.getContext("2d"))}catch(b){return!1}},getCanvasPrint:function(){var d=document.createElement("canvas"),b;try{b=d.getContext("2d")}catch(e){return""}b.textBaseline="top";b.font="14px 'Arial'";b.textBaseline="alphabetic";b.fillStyle="#f60";b.fillRect(125,1,62,20);b.fillStyle="#069";b.fillText("http://valve.github.io",2,15);b.fillStyle="rgba(102, 204, 0, 0.7)";b.fillText("http://valve.github.io",4,17);return d.toDataURL()}};"object"===typeof module&&
79
+ "object"===typeof exports&&(module.exports=d);f.ClientJS=d})(window);
js/triggmine/integationmodule/scripts/fingerprint2.min.js ADDED
@@ -0,0 +1,2 @@
 
 
1
+ !function(e,t,i){"use strict";"undefined"!=typeof module&&module.exports?module.exports=i():"function"==typeof define&&define.amd?define(i):t[e]=i()}("Fingerprint2",this,function(){"use strict";Array.prototype.indexOf||(Array.prototype.indexOf=function(e,t){var i;if(null==this)throw new TypeError("'this' is null or undefined");var a=Object(this),r=a.length>>>0;if(0===r)return-1;var n=+t||0;if(Math.abs(n)===1/0&&(n=0),n>=r)return-1;for(i=Math.max(n>=0?n:r-Math.abs(n),0);r>i;){if(i in a&&a[i]===e)return i;i++}return-1});var e=function(e){var t={swfContainerId:"fingerprintjs2",swfPath:"flash/compiled/FontList.swf",detectScreenOrientation:!0,sortPluginsFor:[/palemoon/i],userDefinedFonts:[]};this.options=this.extend(e,t),this.nativeForEach=Array.prototype.forEach,this.nativeMap=Array.prototype.map};return e.prototype={extend:function(e,t){if(null==e)return t;for(var i in e)null!=e[i]&&t[i]!==e[i]&&(t[i]=e[i]);return t},log:function(e){window.console&&console.log(e)},get:function(e){var t=[];t=this.userAgentKey(t),t=this.languageKey(t),t=this.colorDepthKey(t),t=this.pixelRatioKey(t),t=this.screenResolutionKey(t),t=this.availableScreenResolutionKey(t),t=this.timezoneOffsetKey(t),t=this.sessionStorageKey(t),t=this.localStorageKey(t),t=this.indexedDbKey(t),t=this.addBehaviorKey(t),t=this.openDatabaseKey(t),t=this.cpuClassKey(t),t=this.platformKey(t),t=this.doNotTrackKey(t),t=this.pluginsKey(t),t=this.canvasKey(t),t=this.webglKey(t),t=this.adBlockKey(t),t=this.hasLiedLanguagesKey(t),t=this.hasLiedResolutionKey(t),t=this.hasLiedOsKey(t),t=this.hasLiedBrowserKey(t),t=this.touchSupportKey(t);var i=this;this.fontsKey(t,function(t){var a=[];i.each(t,function(e){var t=e.value;"undefined"!=typeof e.value.join&&(t=e.value.join(";")),a.push(t)});var r=i.x64hash128(a.join("~~~"),31);return e(r,t)})},userAgentKey:function(e){return this.options.excludeUserAgent||e.push({key:"user_agent",value:this.getUserAgent()}),e},getUserAgent:function(){return navigator.userAgent},languageKey:function(e){return this.options.excludeLanguage||e.push({key:"language",value:navigator.language||navigator.userLanguage||navigator.browserLanguage||navigator.systemLanguage||""}),e},colorDepthKey:function(e){return this.options.excludeColorDepth||e.push({key:"color_depth",value:screen.colorDepth}),e},pixelRatioKey:function(e){return this.options.excludePixelRatio||e.push({key:"pixel_ratio",value:this.getPixelRatio()}),e},getPixelRatio:function(){return window.devicePixelRatio||""},screenResolutionKey:function(e){return this.options.excludeScreenResolution?e:this.getScreenResolution(e)},getScreenResolution:function(e){var t;return t=this.options.detectScreenOrientation&&screen.height>screen.width?[screen.height,screen.width]:[screen.width,screen.height],"undefined"!=typeof t&&e.push({key:"resolution",value:t}),e},availableScreenResolutionKey:function(e){return this.options.excludeAvailableScreenResolution?e:this.getAvailableScreenResolution(e)},getAvailableScreenResolution:function(e){var t;return screen.availWidth&&screen.availHeight&&(t=this.options.detectScreenOrientation?screen.availHeight>screen.availWidth?[screen.availHeight,screen.availWidth]:[screen.availWidth,screen.availHeight]:[screen.availHeight,screen.availWidth]),"undefined"!=typeof t&&e.push({key:"available_resolution",value:t}),e},timezoneOffsetKey:function(e){return this.options.excludeTimezoneOffset||e.push({key:"timezone_offset",value:(new Date).getTimezoneOffset()}),e},sessionStorageKey:function(e){return!this.options.excludeSessionStorage&&this.hasSessionStorage()&&e.push({key:"session_storage",value:1}),e},localStorageKey:function(e){return!this.options.excludeSessionStorage&&this.hasLocalStorage()&&e.push({key:"local_storage",value:1}),e},indexedDbKey:function(e){return!this.options.excludeIndexedDB&&this.hasIndexedDB()&&e.push({key:"indexed_db",value:1}),e},addBehaviorKey:function(e){return document.body&&!this.options.excludeAddBehavior&&document.body.addBehavior&&e.push({key:"add_behavior",value:1}),e},openDatabaseKey:function(e){return!this.options.excludeOpenDatabase&&window.openDatabase&&e.push({key:"open_database",value:1}),e},cpuClassKey:function(e){return this.options.excludeCpuClass||e.push({key:"cpu_class",value:this.getNavigatorCpuClass()}),e},platformKey:function(e){return this.options.excludePlatform||e.push({key:"navigator_platform",value:this.getNavigatorPlatform()}),e},doNotTrackKey:function(e){return this.options.excludeDoNotTrack||e.push({key:"do_not_track",value:this.getDoNotTrack()}),e},canvasKey:function(e){return!this.options.excludeCanvas&&this.isCanvasSupported()&&e.push({key:"canvas",value:this.getCanvasFp()}),e},webglKey:function(e){return this.options.excludeWebGL?e:this.isWebGlSupported()?(e.push({key:"webgl",value:this.getWebglFp()}),e):e},adBlockKey:function(e){return this.options.excludeAdBlock||e.push({key:"adblock",value:this.getAdBlock()}),e},hasLiedLanguagesKey:function(e){return this.options.excludeHasLiedLanguages||e.push({key:"has_lied_languages",value:this.getHasLiedLanguages()}),e},hasLiedResolutionKey:function(e){return this.options.excludeHasLiedResolution||e.push({key:"has_lied_resolution",value:this.getHasLiedResolution()}),e},hasLiedOsKey:function(e){return this.options.excludeHasLiedOs||e.push({key:"has_lied_os",value:this.getHasLiedOs()}),e},hasLiedBrowserKey:function(e){return this.options.excludeHasLiedBrowser||e.push({key:"has_lied_browser",value:this.getHasLiedBrowser()}),e},fontsKey:function(e,t){return this.options.excludeJsFonts?this.flashFontsKey(e,t):this.jsFontsKey(e,t)},flashFontsKey:function(e,t){return this.options.excludeFlashFonts?t(e):this.hasSwfObjectLoaded()&&this.hasMinFlashInstalled()?"undefined"==typeof this.options.swfPath?t(e):void this.loadSwfAndDetectFonts(function(i){e.push({key:"swf_fonts",value:i.join(";")}),t(e)}):t(e)},jsFontsKey:function(e,t){var i=this;return setTimeout(function(){var a=["monospace","sans-serif","serif"],r=["Andale Mono","Arial","Arial Black","Arial Hebrew","Arial MT","Arial Narrow","Arial Rounded MT Bold","Arial Unicode MS","Bitstream Vera Sans Mono","Book Antiqua","Bookman Old Style","Calibri","Cambria","Cambria Math","Century","Century Gothic","Century Schoolbook","Comic Sans","Comic Sans MS","Consolas","Courier","Courier New","Garamond","Geneva","Georgia","Helvetica","Helvetica Neue","Impact","Lucida Bright","Lucida Calligraphy","Lucida Console","Lucida Fax","LUCIDA GRANDE","Lucida Handwriting","Lucida Sans","Lucida Sans Typewriter","Lucida Sans Unicode","Microsoft Sans Serif","Monaco","Monotype Corsiva","MS Gothic","MS Outlook","MS PGothic","MS Reference Sans Serif","MS Sans Serif","MS Serif","MYRIAD","MYRIAD PRO","Palatino","Palatino Linotype","Segoe Print","Segoe Script","Segoe UI","Segoe UI Light","Segoe UI Semibold","Segoe UI Symbol","Tahoma","Times","Times New Roman","Times New Roman PS","Trebuchet MS","Verdana","Wingdings","Wingdings 2","Wingdings 3"],n=["Abadi MT Condensed Light","Academy Engraved LET","ADOBE CASLON PRO","Adobe Garamond","ADOBE GARAMOND PRO","Agency FB","Aharoni","Albertus Extra Bold","Albertus Medium","Algerian","Amazone BT","American Typewriter","American Typewriter Condensed","AmerType Md BT","Andalus","Angsana New","AngsanaUPC","Antique Olive","Aparajita","Apple Chancery","Apple Color Emoji","Apple SD Gothic Neo","Arabic Typesetting","ARCHER","ARNO PRO","Arrus BT","Aurora Cn BT","AvantGarde Bk BT","AvantGarde Md BT","AVENIR","Ayuthaya","Bandy","Bangla Sangam MN","Bank Gothic","BankGothic Md BT","Baskerville","Baskerville Old Face","Batang","BatangChe","Bauer Bodoni","Bauhaus 93","Bazooka","Bell MT","Bembo","Benguiat Bk BT","Berlin Sans FB","Berlin Sans FB Demi","Bernard MT Condensed","BernhardFashion BT","BernhardMod BT","Big Caslon","BinnerD","Blackadder ITC","BlairMdITC TT","Bodoni 72","Bodoni 72 Oldstyle","Bodoni 72 Smallcaps","Bodoni MT","Bodoni MT Black","Bodoni MT Condensed","Bodoni MT Poster Compressed","Bookshelf Symbol 7","Boulder","Bradley Hand","Bradley Hand ITC","Bremen Bd BT","Britannic Bold","Broadway","Browallia New","BrowalliaUPC","Brush Script MT","Californian FB","Calisto MT","Calligrapher","Candara","CaslonOpnface BT","Castellar","Centaur","Cezanne","CG Omega","CG Times","Chalkboard","Chalkboard SE","Chalkduster","Charlesworth","Charter Bd BT","Charter BT","Chaucer","ChelthmITC Bk BT","Chiller","Clarendon","Clarendon Condensed","CloisterBlack BT","Cochin","Colonna MT","Constantia","Cooper Black","Copperplate","Copperplate Gothic","Copperplate Gothic Bold","Copperplate Gothic Light","CopperplGoth Bd BT","Corbel","Cordia New","CordiaUPC","Cornerstone","Coronet","Cuckoo","Curlz MT","DaunPenh","Dauphin","David","DB LCD Temp","DELICIOUS","Denmark","DFKai-SB","Didot","DilleniaUPC","DIN","DokChampa","Dotum","DotumChe","Ebrima","Edwardian Script ITC","Elephant","English 111 Vivace BT","Engravers MT","EngraversGothic BT","Eras Bold ITC","Eras Demi ITC","Eras Light ITC","Eras Medium ITC","EucrosiaUPC","Euphemia","Euphemia UCAS","EUROSTILE","Exotc350 Bd BT","FangSong","Felix Titling","Fixedsys","FONTIN","Footlight MT Light","Forte","FrankRuehl","Fransiscan","Freefrm721 Blk BT","FreesiaUPC","Freestyle Script","French Script MT","FrnkGothITC Bk BT","Fruitger","FRUTIGER","Futura","Futura Bk BT","Futura Lt BT","Futura Md BT","Futura ZBlk BT","FuturaBlack BT","Gabriola","Galliard BT","Gautami","Geeza Pro","Geometr231 BT","Geometr231 Hv BT","Geometr231 Lt BT","GeoSlab 703 Lt BT","GeoSlab 703 XBd BT","Gigi","Gill Sans","Gill Sans MT","Gill Sans MT Condensed","Gill Sans MT Ext Condensed Bold","Gill Sans Ultra Bold","Gill Sans Ultra Bold Condensed","Gisha","Gloucester MT Extra Condensed","GOTHAM","GOTHAM BOLD","Goudy Old Style","Goudy Stout","GoudyHandtooled BT","GoudyOLSt BT","Gujarati Sangam MN","Gulim","GulimChe","Gungsuh","GungsuhChe","Gurmukhi MN","Haettenschweiler","Harlow Solid Italic","Harrington","Heather","Heiti SC","Heiti TC","HELV","Herald","High Tower Text","Hiragino Kaku Gothic ProN","Hiragino Mincho ProN","Hoefler Text","Humanst 521 Cn BT","Humanst521 BT","Humanst521 Lt BT","Imprint MT Shadow","Incised901 Bd BT","Incised901 BT","Incised901 Lt BT","INCONSOLATA","Informal Roman","Informal011 BT","INTERSTATE","IrisUPC","Iskoola Pota","JasmineUPC","Jazz LET","Jenson","Jester","Jokerman","Juice ITC","Kabel Bk BT","Kabel Ult BT","Kailasa","KaiTi","Kalinga","Kannada Sangam MN","Kartika","Kaufmann Bd BT","Kaufmann BT","Khmer UI","KodchiangUPC","Kokila","Korinna BT","Kristen ITC","Krungthep","Kunstler Script","Lao UI","Latha","Leelawadee","Letter Gothic","Levenim MT","LilyUPC","Lithograph","Lithograph Light","Long Island","Lydian BT","Magneto","Maiandra GD","Malayalam Sangam MN","Malgun Gothic","Mangal","Marigold","Marion","Marker Felt","Market","Marlett","Matisse ITC","Matura MT Script Capitals","Meiryo","Meiryo UI","Microsoft Himalaya","Microsoft JhengHei","Microsoft New Tai Lue","Microsoft PhagsPa","Microsoft Tai Le","Microsoft Uighur","Microsoft YaHei","Microsoft Yi Baiti","MingLiU","MingLiU_HKSCS","MingLiU_HKSCS-ExtB","MingLiU-ExtB","Minion","Minion Pro","Miriam","Miriam Fixed","Mistral","Modern","Modern No. 20","Mona Lisa Solid ITC TT","Mongolian Baiti","MONO","MoolBoran","Mrs Eaves","MS LineDraw","MS Mincho","MS PMincho","MS Reference Specialty","MS UI Gothic","MT Extra","MUSEO","MV Boli","Nadeem","Narkisim","NEVIS","News Gothic","News GothicMT","NewsGoth BT","Niagara Engraved","Niagara Solid","Noteworthy","NSimSun","Nyala","OCR A Extended","Old Century","Old English Text MT","Onyx","Onyx BT","OPTIMA","Oriya Sangam MN","OSAKA","OzHandicraft BT","Palace Script MT","Papyrus","Parchment","Party LET","Pegasus","Perpetua","Perpetua Titling MT","PetitaBold","Pickwick","Plantagenet Cherokee","Playbill","PMingLiU","PMingLiU-ExtB","Poor Richard","Poster","PosterBodoni BT","PRINCETOWN LET","Pristina","PTBarnum BT","Pythagoras","Raavi","Rage Italic","Ravie","Ribbon131 Bd BT","Rockwell","Rockwell Condensed","Rockwell Extra Bold","Rod","Roman","Sakkal Majalla","Santa Fe LET","Savoye LET","Sceptre","Script","Script MT Bold","SCRIPTINA","Serifa","Serifa BT","Serifa Th BT","ShelleyVolante BT","Sherwood","Shonar Bangla","Showcard Gothic","Shruti","Signboard","SILKSCREEN","SimHei","Simplified Arabic","Simplified Arabic Fixed","SimSun","SimSun-ExtB","Sinhala Sangam MN","Sketch Rockwell","Skia","Small Fonts","Snap ITC","Snell Roundhand","Socket","Souvenir Lt BT","Staccato222 BT","Steamer","Stencil","Storybook","Styllo","Subway","Swis721 BlkEx BT","Swiss911 XCm BT","Sylfaen","Synchro LET","System","Tamil Sangam MN","Technical","Teletype","Telugu Sangam MN","Tempus Sans ITC","Terminal","Thonburi","Traditional Arabic","Trajan","TRAJAN PRO","Tristan","Tubular","Tunga","Tw Cen MT","Tw Cen MT Condensed","Tw Cen MT Condensed Extra Bold","TypoUpright BT","Unicorn","Univers","Univers CE 55 Medium","Univers Condensed","Utsaah","Vagabond","Vani","Vijaya","Viner Hand ITC","VisualUI","Vivaldi","Vladimir Script","Vrinda","Westminster","WHITNEY","Wide Latin","ZapfEllipt BT","ZapfHumnst BT","ZapfHumnst Dm BT","Zapfino","Zurich BlkEx BT","Zurich Ex BT","ZWAdobeF"];i.options.extendedJsFonts&&(r=r.concat(n)),r=r.concat(i.options.userDefinedFonts);var o="mmmmmmmmmmlli",s="72px",l=document.getElementsByTagName("body")[0],h=document.createElement("div"),u=document.createElement("div"),d={},c={},g=function(){var e=document.createElement("span");return e.style.position="absolute",e.style.left="-9999px",e.style.fontSize=s,e.innerHTML=o,e},p=function(e,t){var i=g();return i.style.fontFamily="'"+e+"',"+t,i},f=function(){for(var e=[],t=0,i=a.length;i>t;t++){var r=g();r.style.fontFamily=a[t],h.appendChild(r),e.push(r)}return e},m=function(){for(var e={},t=0,i=r.length;i>t;t++){for(var n=[],o=0,s=a.length;s>o;o++){var l=p(r[t],a[o]);u.appendChild(l),n.push(l)}e[r[t]]=n}return e},S=function(e){for(var t=!1,i=0;i<a.length;i++)if(t=e[i].offsetWidth!==d[a[i]]||e[i].offsetHeight!==c[a[i]])return t;return t},T=f();l.appendChild(h);for(var x=0,v=a.length;v>x;x++)d[a[x]]=T[x].offsetWidth,c[a[x]]=T[x].offsetHeight;var M=m();l.appendChild(u);for(var A=[],E=0,y=r.length;y>E;E++)S(M[r[E]])&&A.push(r[E]);l.removeChild(u),l.removeChild(h),e.push({key:"js_fonts",value:A}),t(e)},1)},pluginsKey:function(e){return this.options.excludePlugins||(this.isIE()?this.options.excludeIEPlugins||e.push({key:"ie_plugins",value:this.getIEPlugins()}):e.push({key:"regular_plugins",value:this.getRegularPlugins()})),e},getRegularPlugins:function(){for(var e=[],t=0,i=navigator.plugins.length;i>t;t++)e.push(navigator.plugins[t]);return this.pluginsShouldBeSorted()&&(e=e.sort(function(e,t){return e.name>t.name?1:e.name<t.name?-1:0})),this.map(e,function(e){var t=this.map(e,function(e){return[e.type,e.suffixes].join("~")}).join(",");return[e.name,e.description,t].join("::")},this)},getIEPlugins:function(){var e=[];if(Object.getOwnPropertyDescriptor&&Object.getOwnPropertyDescriptor(window,"ActiveXObject")||"ActiveXObject"in window){var t=["AcroPDF.PDF","Adodb.Stream","AgControl.AgControl","DevalVRXCtrl.DevalVRXCtrl.1","MacromediaFlashPaper.MacromediaFlashPaper","Msxml2.DOMDocument","Msxml2.XMLHTTP","PDF.PdfCtrl","QuickTime.QuickTime","QuickTimeCheckObject.QuickTimeCheck.1","RealPlayer","RealPlayer.RealPlayer(tm) ActiveX Control (32-bit)","RealVideo.RealVideo(tm) ActiveX Control (32-bit)","Scripting.Dictionary","SWCtl.SWCtl","Shell.UIHelper","ShockwaveFlash.ShockwaveFlash","Skype.Detection","TDCCtl.TDCCtl","WMPlayer.OCX","rmocx.RealPlayer G2 Control","rmocx.RealPlayer G2 Control.1"];e=this.map(t,function(e){try{return new ActiveXObject(e),e}catch(t){return null}})}return navigator.plugins&&(e=e.concat(this.getRegularPlugins())),e},pluginsShouldBeSorted:function(){for(var e=!1,t=0,i=this.options.sortPluginsFor.length;i>t;t++){var a=this.options.sortPluginsFor[t];if(navigator.userAgent.match(a)){e=!0;break}}return e},touchSupportKey:function(e){return this.options.excludeTouchSupport||e.push({key:"touch_support",value:this.getTouchSupport()}),e},hasSessionStorage:function(){try{return!!window.sessionStorage}catch(e){return!0}},hasLocalStorage:function(){try{return!!window.localStorage}catch(e){return!0}},hasIndexedDB:function(){return!!window.indexedDB},getNavigatorCpuClass:function(){return navigator.cpuClass?navigator.cpuClass:"unknown"},getNavigatorPlatform:function(){return navigator.platform?navigator.platform:"unknown"},getDoNotTrack:function(){return navigator.doNotTrack?navigator.doNotTrack:"unknown"},getTouchSupport:function(){var e=0,t=!1;"undefined"!=typeof navigator.maxTouchPoints?e=navigator.maxTouchPoints:"undefined"!=typeof navigator.msMaxTouchPoints&&(e=navigator.msMaxTouchPoints);try{document.createEvent("TouchEvent"),t=!0}catch(i){}var a="ontouchstart"in window;return[e,t,a]},getCanvasFp:function(){var e=[],t=document.createElement("canvas");t.width=2e3,t.height=200,t.style.display="inline";var i=t.getContext("2d");return i.rect(0,0,10,10),i.rect(2,2,6,6),e.push("canvas winding:"+(i.isPointInPath(5,5,"evenodd")===!1?"yes":"no")),i.textBaseline="alphabetic",i.fillStyle="#f60",i.fillRect(125,1,62,20),i.fillStyle="#069",this.options.dontUseFakeFontInCanvas?i.font="11pt Arial":i.font="11pt no-real-font-123",i.fillText("Cwm fjordbank glyphs vext quiz, 😃",2,15),i.fillStyle="rgba(102, 204, 0, 0.2)",i.font="18pt Arial",i.fillText("Cwm fjordbank glyphs vext quiz, 😃",4,45),i.globalCompositeOperation="multiply",i.fillStyle="rgb(255,0,255)",i.beginPath(),i.arc(50,50,50,0,2*Math.PI,!0),i.closePath(),i.fill(),i.fillStyle="rgb(0,255,255)",i.beginPath(),i.arc(100,50,50,0,2*Math.PI,!0),i.closePath(),i.fill(),i.fillStyle="rgb(255,255,0)",i.beginPath(),i.arc(75,100,50,0,2*Math.PI,!0),i.closePath(),i.fill(),i.fillStyle="rgb(255,0,255)",i.arc(75,75,75,0,2*Math.PI,!0),i.arc(75,75,25,0,2*Math.PI,!0),i.fill("evenodd"),e.push("canvas fp:"+t.toDataURL()),e.join("~")},getWebglFp:function(){var e,t=function(t){return e.clearColor(0,0,0,1),e.enable(e.DEPTH_TEST),e.depthFunc(e.LEQUAL),e.clear(e.COLOR_BUFFER_BIT|e.DEPTH_BUFFER_BIT),"["+t[0]+", "+t[1]+"]"},i=function(e){var t,i=e.getExtension("EXT_texture_filter_anisotropic")||e.getExtension("WEBKIT_EXT_texture_filter_anisotropic")||e.getExtension("MOZ_EXT_texture_filter_anisotropic");return i?(t=e.getParameter(i.MAX_TEXTURE_MAX_ANISOTROPY_EXT),0===t&&(t=2),t):null};if(e=this.getWebglCanvas(),!e)return null;var a=[],r="attribute vec2 attrVertex;varying vec2 varyinTexCoordinate;uniform vec2 uniformOffset;void main(){varyinTexCoordinate=attrVertex+uniformOffset;gl_Position=vec4(attrVertex,0,1);}",n="precision mediump float;varying vec2 varyinTexCoordinate;void main() {gl_FragColor=vec4(varyinTexCoordinate,0,1);}",o=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,o);var s=new Float32Array([-.2,-.9,0,.4,-.26,0,0,.732134444,0]);e.bufferData(e.ARRAY_BUFFER,s,e.STATIC_DRAW),o.itemSize=3,o.numItems=3;var l=e.createProgram(),h=e.createShader(e.VERTEX_SHADER);e.shaderSource(h,r),e.compileShader(h);var u=e.createShader(e.FRAGMENT_SHADER);return e.shaderSource(u,n),e.compileShader(u),e.attachShader(l,h),e.attachShader(l,u),e.linkProgram(l),e.useProgram(l),l.vertexPosAttrib=e.getAttribLocation(l,"attrVertex"),l.offsetUniform=e.getUniformLocation(l,"uniformOffset"),e.enableVertexAttribArray(l.vertexPosArray),e.vertexAttribPointer(l.vertexPosAttrib,o.itemSize,e.FLOAT,!1,0,0),e.uniform2f(l.offsetUniform,1,1),e.drawArrays(e.TRIANGLE_STRIP,0,o.numItems),null!=e.canvas&&a.push(e.canvas.toDataURL()),a.push("extensions:"+e.getSupportedExtensions().join(";")),a.push("webgl aliased line width range:"+t(e.getParameter(e.ALIASED_LINE_WIDTH_RANGE))),a.push("webgl aliased point size range:"+t(e.getParameter(e.ALIASED_POINT_SIZE_RANGE))),a.push("webgl alpha bits:"+e.getParameter(e.ALPHA_BITS)),a.push("webgl antialiasing:"+(e.getContextAttributes().antialias?"yes":"no")),a.push("webgl blue bits:"+e.getParameter(e.BLUE_BITS)),a.push("webgl depth bits:"+e.getParameter(e.DEPTH_BITS)),a.push("webgl green bits:"+e.getParameter(e.GREEN_BITS)),a.push("webgl max anisotropy:"+i(e)),a.push("webgl max combined texture image units:"+e.getParameter(e.MAX_COMBINED_TEXTURE_IMAGE_UNITS)),a.push("webgl max cube map texture size:"+e.getParameter(e.MAX_CUBE_MAP_TEXTURE_SIZE)),a.push("webgl max fragment uniform vectors:"+e.getParameter(e.MAX_FRAGMENT_UNIFORM_VECTORS)),a.push("webgl max render buffer size:"+e.getParameter(e.MAX_RENDERBUFFER_SIZE)),a.push("webgl max texture image units:"+e.getParameter(e.MAX_TEXTURE_IMAGE_UNITS)),a.push("webgl max texture size:"+e.getParameter(e.MAX_TEXTURE_SIZE)),a.push("webgl max varying vectors:"+e.getParameter(e.MAX_VARYING_VECTORS)),a.push("webgl max vertex attribs:"+e.getParameter(e.MAX_VERTEX_ATTRIBS)),a.push("webgl max vertex texture image units:"+e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS)),a.push("webgl max vertex uniform vectors:"+e.getParameter(e.MAX_VERTEX_UNIFORM_VECTORS)),a.push("webgl max viewport dims:"+t(e.getParameter(e.MAX_VIEWPORT_DIMS))),a.push("webgl red bits:"+e.getParameter(e.RED_BITS)),a.push("webgl renderer:"+e.getParameter(e.RENDERER)),a.push("webgl shading language version:"+e.getParameter(e.SHADING_LANGUAGE_VERSION)),a.push("webgl stencil bits:"+e.getParameter(e.STENCIL_BITS)),a.push("webgl vendor:"+e.getParameter(e.VENDOR)),a.push("webgl version:"+e.getParameter(e.VERSION)),e.getShaderPrecisionFormat?(a.push("webgl vertex shader high float precision:"+e.getShaderPrecisionFormat(e.VERTEX_SHADER,e.HIGH_FLOAT).precision),a.push("webgl vertex shader high float precision rangeMin:"+e.getShaderPrecisionFormat(e.VERTEX_SHADER,e.HIGH_FLOAT).rangeMin),a.push("webgl vertex shader high float precision rangeMax:"+e.getShaderPrecisionFormat(e.VERTEX_SHADER,e.HIGH_FLOAT).rangeMax),a.push("webgl vertex shader medium float precision:"+e.getShaderPrecisionFormat(e.VERTEX_SHADER,e.MEDIUM_FLOAT).precision),a.push("webgl vertex shader medium float precision rangeMin:"+e.getShaderPrecisionFormat(e.VERTEX_SHADER,e.MEDIUM_FLOAT).rangeMin),a.push("webgl vertex shader medium float precision rangeMax:"+e.getShaderPrecisionFormat(e.VERTEX_SHADER,e.MEDIUM_FLOAT).rangeMax),a.push("webgl vertex shader low float precision:"+e.getShaderPrecisionFormat(e.VERTEX_SHADER,e.LOW_FLOAT).precision),a.push("webgl vertex shader low float precision rangeMin:"+e.getShaderPrecisionFormat(e.VERTEX_SHADER,e.LOW_FLOAT).rangeMin),a.push("webgl vertex shader low float precision rangeMax:"+e.getShaderPrecisionFormat(e.VERTEX_SHADER,e.LOW_FLOAT).rangeMax),a.push("webgl fragment shader high float precision:"+e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.HIGH_FLOAT).precision),a.push("webgl fragment shader high float precision rangeMin:"+e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.HIGH_FLOAT).rangeMin),a.push("webgl fragment shader high float precision rangeMax:"+e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.HIGH_FLOAT).rangeMax),a.push("webgl fragment shader medium float precision:"+e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.MEDIUM_FLOAT).precision),a.push("webgl fragment shader medium float precision rangeMin:"+e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.MEDIUM_FLOAT).rangeMin),a.push("webgl fragment shader medium float precision rangeMax:"+e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.MEDIUM_FLOAT).rangeMax),a.push("webgl fragment shader low float precision:"+e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.LOW_FLOAT).precision),a.push("webgl fragment shader low float precision rangeMin:"+e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.LOW_FLOAT).rangeMin),a.push("webgl fragment shader low float precision rangeMax:"+e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.LOW_FLOAT).rangeMax),a.push("webgl vertex shader high int precision:"+e.getShaderPrecisionFormat(e.VERTEX_SHADER,e.HIGH_INT).precision),a.push("webgl vertex shader high int precision rangeMin:"+e.getShaderPrecisionFormat(e.VERTEX_SHADER,e.HIGH_INT).rangeMin),a.push("webgl vertex shader high int precision rangeMax:"+e.getShaderPrecisionFormat(e.VERTEX_SHADER,e.HIGH_INT).rangeMax),a.push("webgl vertex shader medium int precision:"+e.getShaderPrecisionFormat(e.VERTEX_SHADER,e.MEDIUM_INT).precision),a.push("webgl vertex shader medium int precision rangeMin:"+e.getShaderPrecisionFormat(e.VERTEX_SHADER,e.MEDIUM_INT).rangeMin),a.push("webgl vertex shader medium int precision rangeMax:"+e.getShaderPrecisionFormat(e.VERTEX_SHADER,e.MEDIUM_INT).rangeMax),a.push("webgl vertex shader low int precision:"+e.getShaderPrecisionFormat(e.VERTEX_SHADER,e.LOW_INT).precision),a.push("webgl vertex shader low int precision rangeMin:"+e.getShaderPrecisionFormat(e.VERTEX_SHADER,e.LOW_INT).rangeMin),a.push("webgl vertex shader low int precision rangeMax:"+e.getShaderPrecisionFormat(e.VERTEX_SHADER,e.LOW_INT).rangeMax),a.push("webgl fragment shader high int precision:"+e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.HIGH_INT).precision),a.push("webgl fragment shader high int precision rangeMin:"+e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.HIGH_INT).rangeMin),a.push("webgl fragment shader high int precision rangeMax:"+e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.HIGH_INT).rangeMax),a.push("webgl fragment shader medium int precision:"+e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.MEDIUM_INT).precision),a.push("webgl fragment shader medium int precision rangeMin:"+e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.MEDIUM_INT).rangeMin),a.push("webgl fragment shader medium int precision rangeMax:"+e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.MEDIUM_INT).rangeMax),a.push("webgl fragment shader low int precision:"+e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.LOW_INT).precision),a.push("webgl fragment shader low int precision rangeMin:"+e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.LOW_INT).rangeMin),a.push("webgl fragment shader low int precision rangeMax:"+e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.LOW_INT).rangeMax),a.join("~")):a.join("~")},getAdBlock:function(){var e=document.createElement("div");e.innerHTML="&nbsp;",e.className="adsbox";var t=!1;try{document.body.appendChild(e),t=0===document.getElementsByClassName("adsbox")[0].offsetHeight,document.body.removeChild(e)}catch(i){t=!1}return t},getHasLiedLanguages:function(){if("undefined"!=typeof navigator.languages)try{var e=navigator.languages[0].substr(0,2);if(e!==navigator.language.substr(0,2))return!0}catch(t){return!0}return!1},getHasLiedResolution:function(){return screen.width<screen.availWidth?!0:screen.height<screen.availHeight},getHasLiedOs:function(){var e,t=navigator.userAgent.toLowerCase(),i=navigator.oscpu,a=navigator.platform.toLowerCase();e=t.indexOf("windows phone")>=0?"Windows Phone":t.indexOf("win")>=0?"Windows":t.indexOf("android")>=0?"Android":t.indexOf("linux")>=0?"Linux":t.indexOf("iphone")>=0||t.indexOf("ipad")>=0?"iOS":t.indexOf("mac")>=0?"Mac":"Other";var r;if(r="ontouchstart"in window||navigator.maxTouchPoints>0||navigator.msMaxTouchPoints>0,r&&"Windows Phone"!==e&&"Android"!==e&&"iOS"!==e&&"Other"!==e)return!0;if("undefined"!=typeof i){if(i=i.toLowerCase(),i.indexOf("win")>=0&&"Windows"!==e&&"Windows Phone"!==e)return!0;if(i.indexOf("linux")>=0&&"Linux"!==e&&"Android"!==e)return!0;if(i.indexOf("mac")>=0&&"Mac"!==e&&"iOS"!==e)return!0;if(0===i.indexOf("win")&&0===i.indexOf("linux")&&i.indexOf("mac")>=0&&"other"!==e)return!0}return a.indexOf("win")>=0&&"Windows"!==e&&"Windows Phone"!==e?!0:(a.indexOf("linux")>=0||a.indexOf("android")>=0||a.indexOf("pike")>=0)&&"Linux"!==e&&"Android"!==e?!0:(a.indexOf("mac")>=0||a.indexOf("ipad")>=0||a.indexOf("ipod")>=0||a.indexOf("iphone")>=0)&&"Mac"!==e&&"iOS"!==e?!0:0===a.indexOf("win")&&0===a.indexOf("linux")&&a.indexOf("mac")>=0&&"other"!==e?!0:"undefined"==typeof navigator.plugins&&"Windows"!==e&&"Windows Phone"!==e},getHasLiedBrowser:function(){var e,t=navigator.userAgent.toLowerCase(),i=navigator.productSub;if(e=t.indexOf("firefox")>=0?"Firefox":t.indexOf("opera")>=0||t.indexOf("opr")>=0?"Opera":t.indexOf("chrome")>=0?"Chrome":t.indexOf("safari")>=0?"Safari":t.indexOf("trident")>=0?"Internet Explorer":"Other",("Chrome"===e||"Safari"===e||"Opera"===e)&&"20030107"!==i)return!0;var a=eval.toString().length;if(37===a&&"Safari"!==e&&"Firefox"!==e&&"Other"!==e)return!0;if(39===a&&"Internet Explorer"!==e&&"Other"!==e)return!0;if(33===a&&"Chrome"!==e&&"Opera"!==e&&"Other"!==e)return!0;var r;try{throw"a"}catch(n){try{n.toSource(),r=!0}catch(o){r=!1}}return!(!r||"Firefox"===e||"Other"===e)},isCanvasSupported:function(){var e=document.createElement("canvas");return!(!e.getContext||!e.getContext("2d"))},isWebGlSupported:function(){if(!this.isCanvasSupported())return!1;var e,t=document.createElement("canvas");try{e=t.getContext&&(t.getContext("webgl")||t.getContext("experimental-webgl"))}catch(i){e=!1}return!!window.WebGLRenderingContext&&!!e},isIE:function(){return"Microsoft Internet Explorer"===navigator.appName?!0:!("Netscape"!==navigator.appName||!/Trident/.test(navigator.userAgent))},hasSwfObjectLoaded:function(){return"undefined"!=typeof window.swfobject},hasMinFlashInstalled:function(){return swfobject.hasFlashPlayerVersion("9.0.0")},addFlashDivNode:function(){var e=document.createElement("div");e.setAttribute("id",this.options.swfContainerId),document.body.appendChild(e)},loadSwfAndDetectFonts:function(e){var t="___fp_swf_loaded";window[t]=function(t){e(t)};var i=this.options.swfContainerId;this.addFlashDivNode();var a={onReady:t},r={allowScriptAccess:"always",menu:"false"};swfobject.embedSWF(this.options.swfPath,i,"1","1","9.0.0",!1,a,r,{})},getWebglCanvas:function(){var e=document.createElement("canvas"),t=null;try{t=e.getContext("webgl")||e.getContext("experimental-webgl")}catch(i){}return t||(t=null),t},each:function(e,t,i){if(null!==e)if(this.nativeForEach&&e.forEach===this.nativeForEach)e.forEach(t,i);else if(e.length===+e.length){for(var a=0,r=e.length;r>a;a++)if(t.call(i,e[a],a,e)==={})return}else for(var n in e)if(e.hasOwnProperty(n)&&t.call(i,e[n],n,e)==={})return},map:function(e,t,i){var a=[];return null==e?a:this.nativeMap&&e.map===this.nativeMap?e.map(t,i):(this.each(e,function(e,r,n){a[a.length]=t.call(i,e,r,n)}),a)},x64Add:function(e,t){e=[e[0]>>>16,65535&e[0],e[1]>>>16,65535&e[1]],t=[t[0]>>>16,65535&t[0],t[1]>>>16,65535&t[1]];var i=[0,0,0,0];return i[3]+=e[3]+t[3],i[2]+=i[3]>>>16,i[3]&=65535,i[2]+=e[2]+t[2],i[1]+=i[2]>>>16,i[2]&=65535,i[1]+=e[1]+t[1],i[0]+=i[1]>>>16,i[1]&=65535,i[0]+=e[0]+t[0],i[0]&=65535,[i[0]<<16|i[1],i[2]<<16|i[3]]},x64Multiply:function(e,t){e=[e[0]>>>16,65535&e[0],e[1]>>>16,65535&e[1]],t=[t[0]>>>16,65535&t[0],t[1]>>>16,65535&t[1]];var i=[0,0,0,0];return i[3]+=e[3]*t[3],i[2]+=i[3]>>>16,i[3]&=65535,i[2]+=e[2]*t[3],i[1]+=i[2]>>>16,i[2]&=65535,i[2]+=e[3]*t[2],i[1]+=i[2]>>>16,i[2]&=65535,i[1]+=e[1]*t[3],i[0]+=i[1]>>>16,i[1]&=65535,i[1]+=e[2]*t[2],i[0]+=i[1]>>>16,i[1]&=65535,i[1]+=e[3]*t[1],i[0]+=i[1]>>>16,i[1]&=65535,i[0]+=e[0]*t[3]+e[1]*t[2]+e[2]*t[1]+e[3]*t[0],i[0]&=65535,[i[0]<<16|i[1],i[2]<<16|i[3]]},x64Rotl:function(e,t){return t%=64,32===t?[e[1],e[0]]:32>t?[e[0]<<t|e[1]>>>32-t,e[1]<<t|e[0]>>>32-t]:(t-=32,[e[1]<<t|e[0]>>>32-t,e[0]<<t|e[1]>>>32-t])},x64LeftShift:function(e,t){return t%=64,0===t?e:32>t?[e[0]<<t|e[1]>>>32-t,e[1]<<t]:[e[1]<<t-32,0]},x64Xor:function(e,t){return[e[0]^t[0],e[1]^t[1]]},x64Fmix:function(e){return e=this.x64Xor(e,[0,e[0]>>>1]),e=this.x64Multiply(e,[4283543511,3981806797]),e=this.x64Xor(e,[0,e[0]>>>1]),e=this.x64Multiply(e,[3301882366,444984403]),e=this.x64Xor(e,[0,e[0]>>>1])},x64hash128:function(e,t){e=e||"",t=t||0;for(var i=e.length%16,a=e.length-i,r=[0,t],n=[0,t],o=[0,0],s=[0,0],l=[2277735313,289559509],h=[1291169091,658871167],u=0;a>u;u+=16)o=[255&e.charCodeAt(u+4)|(255&e.charCodeAt(u+5))<<8|(255&e.charCodeAt(u+6))<<16|(255&e.charCodeAt(u+7))<<24,255&e.charCodeAt(u)|(255&e.charCodeAt(u+1))<<8|(255&e.charCodeAt(u+2))<<16|(255&e.charCodeAt(u+3))<<24],s=[255&e.charCodeAt(u+12)|(255&e.charCodeAt(u+13))<<8|(255&e.charCodeAt(u+14))<<16|(255&e.charCodeAt(u+15))<<24,255&e.charCodeAt(u+8)|(255&e.charCodeAt(u+9))<<8|(255&e.charCodeAt(u+10))<<16|(255&e.charCodeAt(u+11))<<24],o=this.x64Multiply(o,l),o=this.x64Rotl(o,31),o=this.x64Multiply(o,h),r=this.x64Xor(r,o),r=this.x64Rotl(r,27),r=this.x64Add(r,n),
2
+ r=this.x64Add(this.x64Multiply(r,[0,5]),[0,1390208809]),s=this.x64Multiply(s,h),s=this.x64Rotl(s,33),s=this.x64Multiply(s,l),n=this.x64Xor(n,s),n=this.x64Rotl(n,31),n=this.x64Add(n,r),n=this.x64Add(this.x64Multiply(n,[0,5]),[0,944331445]);switch(o=[0,0],s=[0,0],i){case 15:s=this.x64Xor(s,this.x64LeftShift([0,e.charCodeAt(u+14)],48));case 14:s=this.x64Xor(s,this.x64LeftShift([0,e.charCodeAt(u+13)],40));case 13:s=this.x64Xor(s,this.x64LeftShift([0,e.charCodeAt(u+12)],32));case 12:s=this.x64Xor(s,this.x64LeftShift([0,e.charCodeAt(u+11)],24));case 11:s=this.x64Xor(s,this.x64LeftShift([0,e.charCodeAt(u+10)],16));case 10:s=this.x64Xor(s,this.x64LeftShift([0,e.charCodeAt(u+9)],8));case 9:s=this.x64Xor(s,[0,e.charCodeAt(u+8)]),s=this.x64Multiply(s,h),s=this.x64Rotl(s,33),s=this.x64Multiply(s,l),n=this.x64Xor(n,s);case 8:o=this.x64Xor(o,this.x64LeftShift([0,e.charCodeAt(u+7)],56));case 7:o=this.x64Xor(o,this.x64LeftShift([0,e.charCodeAt(u+6)],48));case 6:o=this.x64Xor(o,this.x64LeftShift([0,e.charCodeAt(u+5)],40));case 5:o=this.x64Xor(o,this.x64LeftShift([0,e.charCodeAt(u+4)],32));case 4:o=this.x64Xor(o,this.x64LeftShift([0,e.charCodeAt(u+3)],24));case 3:o=this.x64Xor(o,this.x64LeftShift([0,e.charCodeAt(u+2)],16));case 2:o=this.x64Xor(o,this.x64LeftShift([0,e.charCodeAt(u+1)],8));case 1:o=this.x64Xor(o,[0,e.charCodeAt(u)]),o=this.x64Multiply(o,l),o=this.x64Rotl(o,31),o=this.x64Multiply(o,h),r=this.x64Xor(r,o)}return r=this.x64Xor(r,[0,e.length]),n=this.x64Xor(n,[0,e.length]),r=this.x64Add(r,n),n=this.x64Add(n,r),r=this.x64Fmix(r),n=this.x64Fmix(n),r=this.x64Add(r,n),n=this.x64Add(n,r),("00000000"+(r[0]>>>0).toString(16)).slice(-8)+("00000000"+(r[1]>>>0).toString(16)).slice(-8)+("00000000"+(n[0]>>>0).toString(16)).slice(-8)+("00000000"+(n[1]>>>0).toString(16)).slice(-8)}},e.VERSION="1.4.1",e});
js/triggmine/integationmodule/scripts/jscookie.min.js ADDED
@@ -0,0 +1 @@
 
1
+ !function(e){if("function"==typeof define&&define.amd)define(e);else if("object"==typeof exports)module.exports=e();else{var n=window.Cookies,t=window.Cookies=e();t.noConflict=function(){return window.Cookies=n,t}}}(function(){function e(){for(var e=0,n={};e<arguments.length;e++){var t=arguments[e];for(var o in t)n[o]=t[o]}return n}function n(t){function o(n,r,i){var c;if("undefined"!=typeof document){if(arguments.length>1){if(i=e({path:"/"},o.defaults,i),"number"==typeof i.expires){var s=new Date;s.setMilliseconds(s.getMilliseconds()+864e5*i.expires),i.expires=s}try{c=JSON.stringify(r),/^[\{\[]/.test(c)&&(r=c)}catch(a){}return r=t.write?t.write(r,n):encodeURIComponent(String(r)).replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g,decodeURIComponent),n=encodeURIComponent(String(n)),n=n.replace(/%(23|24|26|2B|5E|60|7C)/g,decodeURIComponent),n=n.replace(/[\(\)]/g,escape),document.cookie=[n,"=",r,i.expires&&"; expires="+i.expires.toUTCString(),i.path&&"; path="+i.path,i.domain&&"; domain="+i.domain,i.secure?"; secure":""].join("")}n||(c={});for(var p=document.cookie?document.cookie.split("; "):[],d=/(%[0-9A-Z]{2})+/g,f=0;f<p.length;f++){var u=p[f].split("="),l=u[0].replace(d,decodeURIComponent),m=u.slice(1).join("=");'"'===m.charAt(0)&&(m=m.slice(1,-1));try{if(m=t.read?t.read(m,l):t(m,l)||m.replace(d,decodeURIComponent),this.json)try{m=JSON.parse(m)}catch(a){}if(n===l){c=m;break}n||(c[l]=m)}catch(a){}}return c}}return o.get=o.set=o,o.getJSON=function(){return o.apply({json:!0},[].slice.call(arguments))},o.defaults={},o.remove=function(n,t){o(n,"",e(t,{expires:-1}))},o.withConverter=n,o}return n(function(){})});
js/videal/triggmine/api.js DELETED
@@ -1,123 +0,0 @@
1
- var TriggMineApi = {
2
- version: '1.0.3',
3
- pingInterval: 30000, // 30 seconds
4
- keyCartPingTime: 'triggmine[CartPingTime]',
5
- keyCartId: 'triggmine[CartId]',
6
- xhr: null,
7
- lastEmail: null,
8
- emailRegExp: "[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9]))+?\\.[a-zA-Z]{2,6}$",
9
-
10
- init: function () {
11
- this.createXhr();
12
- this.pingCart();
13
- this.waitingEmail();
14
- },
15
- createXhr: function () {
16
- var f = window.ActiveXObject !== undefined ?
17
- function () {
18
- return TriggMineApi.createStandardXHR() || TriggMineApi.createActiveXHR();
19
- } :
20
- this.createStandardXHR;
21
-
22
- this.xhr = f();
23
- },
24
- createStandardXHR: function () {
25
- try {
26
- return new window.XMLHttpRequest();
27
- } catch (e) {
28
- }
29
- },
30
- createActiveXHR: function () {
31
- try {
32
- return new window.ActiveXObject("Microsoft.XMLHTTP");
33
- } catch (e) {
34
- }
35
- },
36
- getCookie: function (cname) {
37
- var name = cname + "=";
38
- var ca = document.cookie.split(';');
39
- for (var i = 0; i < ca.length; i++) {
40
- var c = ca[i];
41
- while (c.charAt(0) == ' ') c = c.substring(1);
42
- if (c.indexOf(name) != -1) return c.substring(name.length, c.length);
43
- }
44
- return "";
45
- },
46
- time: function () {
47
- return Math.floor(new Date().getTime() / 1000);
48
- },
49
- pingCart: function () {
50
- var timePassed = this.time() - this.getCookie(this.keyCartPingTime);
51
- var timeout = timePassed > this.pingInterval / 1000;
52
- var cartId = this.getCookie(this.keyCartId);
53
- if (timeout && cartId) {
54
- this.xhr.open('GET', '/?triggmine_async=1&_action=onPingCart' + this.getSalt(), true);
55
- this.xhr.send();
56
- }
57
- setTimeout('TriggMineApi.pingCart()', this.pingInterval);
58
- },
59
- waitingEmail: function () {
60
- var inputs, index;
61
-
62
- if (document.querySelectorAll) {
63
- inputs = document.querySelectorAll('input[type=text], input[type=email]');
64
- }
65
- else {
66
- inputs = [];
67
- var unfiltered = document.getElementsByTagName("input"),
68
- i = unfiltered.length,
69
- input;
70
- while (i--) {
71
- input = unfiltered[i];
72
- if (!input.type || input.type === 'text' || input.type === 'email') {
73
- inputs.push(input);
74
- }
75
- }
76
- }
77
-
78
- for (index = 0; index < inputs.length; ++index) {
79
- inputs[index].oninput = function () {
80
- var value = this.value;
81
- var pattern = new RegExp(TriggMineApi.emailRegExp);
82
-
83
- if (value != TriggMineApi.lastEmail && pattern.test(value)) {
84
- TriggMineApi.updateBuyerEmail(value);
85
- TriggMineApi.lastEmail = value;
86
- }
87
- }
88
- }
89
- },
90
- updateBuyerEmail: function (email) {
91
- var mail = '{"BuyerEmail":"' + email + '"}';
92
- this.xhr.open('GET', '/?triggmine_async=1&_action=onUpdateBuyerEmail&Data=' + encodeURIComponent(mail) + this.getSalt(), true);
93
- this.xhr.send();
94
- },
95
- getSalt: function () {
96
- return '&salt=' + this.str_shuffle('0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ').substr(0, 8);
97
- },
98
- str_shuffle: function (str) {
99
- if (arguments.length === 0) {
100
- throw 'Wrong parameter count for str_shuffle()';
101
- }
102
-
103
- if (str == null) {
104
- return '';
105
- }
106
-
107
- str += '';
108
-
109
- var newStr = '',
110
- rand, i = str.length;
111
-
112
- while (i) {
113
- rand = Math.floor(Math.random() * i);
114
- newStr += str.charAt(rand);
115
- str = str.substring(0, rand) + str.substr(rand + 1);
116
- i--;
117
- }
118
-
119
- return newStr;
120
- }
121
- };
122
- // init TriggMineApi javascript
123
- TriggMineApi.init();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
package.xml CHANGED
@@ -1,18 +1,21 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>TriggMineCartRecovery</name>
4
- <version>2.2.1</version>
5
  <stability>stable</stability>
6
- <license>GPL</license>
7
  <channel>community</channel>
8
  <extends/>
9
- <summary>Triggered Messaging Solution for E-commerce</summary>
10
- <description>We provide triggered messaging solution for E-commerce. You&#x2019;ll get a set of ready-to-use business processes that will help you turn new customers into repeat customers and generate outstanding sales via Email Marketing</description>
11
- <notes>Support for PHP 5.6.16</notes>
 
 
 
12
  <authors><author><name>TriggMine</name><user>TriggMine</user><email>admin@triggmine.com</email></author></authors>
13
- <date>2015-12-18</date>
14
- <time>14:16:57</time>
15
- <contents><target name="magecommunity"><dir name="Videal"><dir name="Triggmine"><dir name="Block"><dir name="Adminhtml"><file name="Triggminebackend.php" hash="d5d872c11ae85335a8a3f627b43f2820"/></dir></dir><dir name="Helper"><file name="Data.php" hash="ae6c08289260d91677f0b26a51d45a5d"/></dir><dir name="Model"><file name="Observer.php" hash="07da984df2bcaf70b3304ffb47c8cb96"/><dir name="core"><file name="ApiClient.php" hash="dda593d167d0afb8bc77ca25ee4133f4"/><file name="Core.php" hash="d648af568f5869bb7165ba28c725bacc"/><file name="Error.php" hash="8fa1a3effc30f931f60169fd25bd849a"/><file name="Helper.php" hash="70f1bfaada3a4deae5f876bda3722146"/></dir></dir><dir name="controllers"><dir name="Adminhtml"><file name="TriggminebackendController.php" hash="2c42b9789bb22f10668ca258bb7ec15c"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="dbaa360cbb1da748a7492c33d13f81a7"/><file name="config.xml" hash="c168903be52c914a3ba0a617b6d539fe"/><file name="system.xml" hash="a2f383e01459b73848fef582c87909e0"/></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="videal_triggmine.xml" hash="c7805fd5b5496629435a0ee08f70520e"/></dir><dir name="template"><dir name="videal"><dir name="triggmine"><file name="init.phtml" hash="d2d38515ca3f5d8f49747e0c090961a0"/></dir></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Videal_Triggmine.xml" hash="769d82f538877ff4bf8f6f46f046690a"/></dir></target><target name="mageweb"><dir name="js"><dir name="videal"><dir name="triggmine"><file name="api.js" hash="b279fe573df42b63f9aa98a09c65fe9d"/></dir></dir></dir></target></contents>
16
  <compatible/>
17
- <dependencies><required><php><min>5.2.1</min><max>5.6.16</max></php><package><name></name><channel>connect.magentocommerce.com/core</channel><min></min><max></max></package></required></dependencies>
18
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>TriggMineCartRecovery</name>
4
+ <version>3.0.5</version>
5
  <stability>stable</stability>
6
+ <license uri="https://opensource.org/licenses/gpl-license.php">GPL</license>
7
  <channel>community</channel>
8
  <extends/>
9
+ <summary>ECOMMERCE EMAIL MARKETING AUTOMATION FOR YOUR IDEAL CUSTOMER EXPERIENCE.</summary>
10
+ <description>TriggMine&#x2019;s automated email campaigns are only limited by your imagination. Whoever you want to reach out to, and whatever you want to say to them, now you can, without complex coding or time consuming email management. </description>
11
+ <notes>- Added support for configurable product&#xD;
12
+ - Optimized api client&#xD;
13
+ - Added security access token&#xD;
14
+ - Bug fixes and performance improvements</notes>
15
  <authors><author><name>TriggMine</name><user>TriggMine</user><email>admin@triggmine.com</email></author></authors>
16
+ <date>2016-12-20</date>
17
+ <time>00:27:19</time>
18
+ <contents><target name="magecommunity"><dir name="Triggmine"><dir name="IntegrationModule"><dir name="Block"><dir name="Adminhtml"><file name="IntegrationModulebackend.php" hash="88a2a04dedcd1d68be3e171e075f467f"/><dir name="System"><dir name="Config"><file name="Button.php" hash="926526dc6c3b4f6e561b256feaf11a10"/><file name="Date.php" hash="d6b04acde97c3ec4eb52179740e420cb"/></dir></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="62a6606835d3132d05e0530c2c9bd3f8"/></dir><dir name="Model"><file name="Observer.php" hash="a95b79b25db187e52b59fb31029cb0a7"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="IntegrationmodulebackendController.php" hash="92631d246bc9febb5c5c49dc8d25e83b"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="a9e572206a5552400f84673294e95269"/><file name="config.xml" hash="8f8972e432d7dd5e674c1ed6de4790ce"/><file name="system.xml" hash="7ac41c4d460908c8f5d5d57429ef3cf9"/></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="triggmine_integrationmodule.xml" hash="31e50bf08b36c947932e6ac0eb1dcc17"/></dir><dir name="template"><dir name="triggmine"><dir name="integrationmodule"><file name="init.phtml" hash="088f4b1efdbb774a020ebcb2d6405c86"/></dir></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Triggmine_IntegrationModule.xml" hash="ce2843234cbe2362a1f637001c27f6e1"/></dir></target><target name="mageweb"><dir name="js"><dir name="triggmine"><dir name="integationmodule"><dir name="scripts"><file name="client.min.js" hash="068c5c31adf266449d9de64f31772f55"/><file name="fingerprint2.min.js" hash="36b594aba875677b7ede86aa823b2493"/><file name="jscookie.min.js" hash="390302a82ecd74b0e39e2ff66eb23c13"/></dir></dir></dir></dir></target></contents>
19
  <compatible/>
20
+ <dependencies><required><php><min>5.4.0</min><max>5.6.0</max></php></required></dependencies>
21
  </package>