stas_test_extension_2 - Version 1.0.1

Version Notes

Adding js file to package

Download this release

Release Info

Developer Magento Core Team
Extension stas_test_extension_2
Version 1.0.1
Comparing to
See all releases


Version 1.0.1

app/code/community/Beecoder/Beeshopy/Block/Track.php ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Beetailer checkout tracking code
4
+ *
5
+ * @category Beetailer
6
+ * @package Beecoder_Beeshopy
7
+ */
8
+
9
+
10
+ class Beecoder_Beeshopy_Block_Track extends Mage_Core_Block_Template
11
+ {
12
+
13
+ private $_order = null;
14
+
15
+ public function getOrder()
16
+ {
17
+ if ($this->_order === null) {
18
+ $orderId = Mage::getSingleton('checkout/session')->getLastOrderId();
19
+ if ($orderId) {
20
+ $order = Mage::getModel('sales/order')->load($orderId);
21
+ if ($order->getId()) {
22
+ $this->_order = $order;
23
+ }
24
+ }
25
+ }
26
+ return $this->_order;
27
+ }
28
+
29
+ public function trackingCode()
30
+ {
31
+ $beetailerRef = Mage::getModel('core/cookie')->get('beetailer_ref');
32
+ $beetailerRefDate = Mage::getModel('core/cookie')->get('beetailer_ref_date');
33
+
34
+ if ($order = $this->getOrder()) {
35
+ $res = '<script type="text/javascript" src=\'//www.beetailer.com/s.js'.
36
+ '?p[order_number]='.$order->getIncrementId().
37
+ '&p[amount]='.urlencode(sprintf("%.2f", $order->getSubtotal())).
38
+ '&p[order_date]='.urlencode($order->getCreatedAt()).
39
+ '&p[email]='.urlencode($order->getCustomerEmail()).
40
+ '&p[beetailer_ref]='.urlencode($beetailerRef).
41
+ '&p[beetailer_ref_date]='.urlencode($beetailerRefDate).
42
+ '&p[shop_domain]='.urlencode(Mage::getBaseURL()).
43
+ '\'></script>';
44
+
45
+ Mage::getModel('core/cookie')->delete('beetailer_ref');
46
+ }
47
+ return $res;
48
+ }
49
+ }
app/code/community/Beecoder/Beeshopy/Helper/Data.php ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Beetailer Data helper
4
+ *
5
+ * @category Beetailer
6
+ * @package Beecoder_Beeshopy
7
+ */
8
+
9
+
10
+ class Beecoder_Beeshopy_Helper_Data extends Mage_Core_Helper_Abstract
11
+ {
12
+
13
+ }
app/code/community/Beecoder/Beeshopy/Model/Api.php ADDED
@@ -0,0 +1,315 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Beetailer Custom API
4
+ *
5
+ * @category Beetailer
6
+ * @package Beecoder_Beeshopy
7
+ */
8
+
9
+
10
+ class Beecoder_Beeshopy_Model_Api extends Mage_Catalog_Model_Api_Resource
11
+ {
12
+ /** Get beeshopy needed product information */
13
+ public function productInfo($productId, $store = null, $identifierType = null)
14
+ {
15
+ /* Load Product */
16
+ $product = $this->_getProduct($productId, $store, $identifierType);
17
+
18
+ if (!$product->getId()) {
19
+ $this->_fault('not_exists');
20
+ }
21
+
22
+ $result = $this->getProductInfo($product, $store);
23
+ /* Children and related products*/
24
+ $result += $this->children($product, $store);
25
+
26
+ return $result;
27
+ }
28
+
29
+ public function categoryTree($parentId, $store = null)
30
+ {
31
+ if (is_null($parentId) && !is_null($store)) {
32
+ $parentId = Mage::app()->getStore($this->_getStoreId($store))->getRootCategoryId();
33
+ } elseif (is_null($parentId)) {
34
+ $parentId = 1;
35
+ }
36
+
37
+ $tree = Mage::getResourceSingleton('catalog/category_tree')->load();
38
+
39
+ $root = $tree->getNodeById($parentId);
40
+
41
+ if ($root && $root->getId() == 1) {
42
+ $root->setName(Mage::helper('catalog')->__('Root'));
43
+ }
44
+
45
+ $collection = Mage::getModel('catalog/category')->getCollection()
46
+ ->setStoreId($this->_getStoreId($store))
47
+ ->addAttributeToSelect('name')
48
+ ->setLoadProductCount(true)
49
+ ->addAttributeToSelect('is_active');
50
+
51
+ $tree->addCollectionData($collection, true);
52
+
53
+ return $this->_nodeToArray($root);
54
+ }
55
+
56
+ public function assignedProducts($categoryId, $store = null)
57
+ {
58
+ $category = Mage::getModel('catalog/category')->load($categoryId);
59
+
60
+ $collection = $category->setStoreId($this->_getStoreId($store))
61
+ ->getProductCollection()
62
+ ->addAttributeToSelect('name')
63
+ ->addAttributeToSelect('visibility')
64
+ ->setOrder(Mage::getStoreConfig('catalog/frontend/default_sort_by'), 'asc');
65
+
66
+ $result = array();
67
+
68
+ foreach ($collection as $product) {
69
+ $result[] = array(
70
+ 'product_id' => $product->getId(),
71
+ 'visibility' => $product->getVisibility(),
72
+ 'type' => $product->getTypeId(),
73
+ 'sku' => $product->getSku(),
74
+ 'title' => $product->getName()
75
+ );
76
+ }
77
+
78
+ return $result;
79
+ }
80
+
81
+ /** Get system info such as currency, rates, ... */
82
+ public function systemInfo()
83
+ {
84
+ $currencyModel = Mage::getModel('directory/currency');
85
+ $store_views = array();
86
+ $default_store_view = Mage::app()->getDefaultStoreView()->getId();
87
+ /* Store views */
88
+ foreach(Mage::app()->getStores() as $sview){
89
+ if($sview->getIsActive() == 1 || $sview->getId() == $default_store_view){
90
+ $includes_taxes = Mage::helper('tax')->priceIncludesTax($sview);
91
+ $store_views[$sview->getId()] = array('id' => $sview->getId(), 'name' => $sview->getName(), 'code' => $sview->getCode(), 'root_category_id' => $sview->getRootCategoryId(), 'taxes_included' => $includes_taxes);
92
+ /* Currencies */
93
+ $store_views[$sview->getId()]['currencies'] = array();
94
+ $base = $sview->getBaseCurrency()->getCode();
95
+
96
+ foreach($sview->getAvailableCurrencyCodes() as $code){
97
+ $default = $sview->getDefaultCurrencyCode() == $code ? true : false;
98
+ $currency = $currencyModel->load($code);
99
+ /* No ratio defined */
100
+ $ratios = $currencyModel->getCurrencyRates($base, $code);
101
+ if($ratios == NULL){$ratios = array($code => 1);}
102
+ /* EO No ratio*/
103
+ array_push($store_views[$sview->getId()]['currencies'],
104
+ array("default" => $default, 'ratio' => $ratios, 'format' => $currency->getOutputFormat()));
105
+ }
106
+ }
107
+ }
108
+ return array('store_views' => $store_views, 'include_url_code' => Mage::getStoreConfig('web/url/use_store'));
109
+ }
110
+
111
+ /* Used to know if module is installed*/
112
+ public function checkModule()
113
+ {
114
+ return array("api_version" => '2.4.8', "magento_version" => Mage::getVersion());
115
+ }
116
+
117
+ /*Auxiliar functions*/
118
+
119
+ /** Get configurable/grouped and related children information */
120
+ private function children($parent, $store = null, $identifierType = null)
121
+ {
122
+ try
123
+ {
124
+ $res['children'] = array();
125
+ $res['related'] = array();
126
+
127
+ /* Related products */
128
+ foreach($parent->getRelatedProductIds() as $product_id){
129
+ $product = $this->_getProduct($product_id, $store, $identifierType);
130
+
131
+ if($product->isSalable() != false){
132
+ array_push($res['related'], $this->getProductInfo($product, $store));
133
+ }
134
+ }
135
+
136
+ switch($parent->getTypeId()){
137
+ case("configurable"):
138
+ $res["children"] = $this->configurableProducts($parent, $store, $identifierType);
139
+ break;
140
+ case("grouped"):
141
+ $res["children"] = $this->groupedProducts($parent, $store, $identifierType);
142
+ break;
143
+ }
144
+
145
+ return $res;
146
+ }
147
+ catch (Mage_Core_Exception $e)
148
+ {
149
+ $this->_fault('store_not_exists');
150
+ }
151
+ }
152
+
153
+ private function getProductInfo($product, $store = null, $extra_params = array())
154
+ {
155
+ /* Images */
156
+ $image_class = Mage::getModel('catalog/product_attribute_media_api');
157
+ $images = $image_class->items($product->getId(), $store);
158
+
159
+ /* Custom Options */
160
+ $options = $this->getCustomOptions($product);
161
+ $links = $this->getDownloadableLinks($product);
162
+
163
+ /* Prepare results */
164
+ $result = array(
165
+ 'idx' => $product->getId(),
166
+ 'sku' => $product->getSku(),
167
+ 'product_type' => $product->getTypeId(),
168
+ 'body' => $product->getInDepth(),
169
+ 'description' => $product->getDescription(),
170
+ 'short_description' => $product->getShortDescription(),
171
+ 'title' => $product->getName(),
172
+ 'in_stock' => $product->getStockItem()->getIsInStock(),
173
+ 'qty' => $product->getStockItem()->getQty(),
174
+ 'price' => $product->getPrice(),
175
+ 'permalink' => $product->getUrlPath(),
176
+ 'url_in_store' => $product->getProductUrl(),
177
+ 'images' => $images,
178
+ 'visibility' => $product->getVisibility(),
179
+ 'special_price' => $product->getSpecialPrice(),
180
+ 'special_from_date' => $product->getSpecialFromDate(),
181
+ 'special_to_date' => $product->getSpecialToDate(),
182
+ 'custom_options' => $options,
183
+ 'status' => $product->getStatus(),
184
+ 'links' => $links
185
+ );
186
+
187
+ // Optional extra parameters
188
+ return $result + $extra_params;
189
+ }
190
+
191
+ /** Get configurable products */
192
+ private function configurableProducts($parent, $store = null, $identifierType = null)
193
+ {
194
+ $res = array();
195
+
196
+ /* Check if using magento-configurable-simple module */
197
+ $modules = Mage::getConfig()->getNode('modules')->children();
198
+ $modulesArray = (array)$modules;
199
+ $use_simple_configurable = (isset($modulesArray['OrganicInternet_SimpleConfigurableProducts']) && $modulesArray['OrganicInternet_SimpleConfigurableProducts']->is('active')) ? true : false;
200
+ /* EO Check */
201
+
202
+ /* Get configurable attributes */
203
+ $attrs_codes = $parent->getTypeInstance()->getConfigurableAttributesAsArray();
204
+ /* Get all children */
205
+ $children = $parent->getTypeInstance()->getChildrenIds($parent->getId());
206
+
207
+ foreach ($children[0] as $i => $value) {
208
+ $product = $this->_getProduct($value, $store, $identifierType);
209
+ /* Initial Price */
210
+
211
+ $price = $use_simple_configurable ? $product->getFinalPrice() : $parent->getFinalPrice();
212
+ /* Price Difference */
213
+ $difference = 0;
214
+ //Generate caption_name
215
+ $caption = "";
216
+ $configurable_options = array();
217
+ foreach($attrs_codes as $code){
218
+ $caption .= $product->getResource()->getAttribute($code['attribute_code'])->getFrontend()->getValue($product) . " - ";
219
+ $attr_value = $product->getData($code['attribute_code']);
220
+ /* Calculate price */
221
+ foreach($code['values'] as $value){
222
+ if($value['value_index'] == $attr_value) {
223
+ $configurable_options[$code['attribute_id']] = $attr_value;
224
+ if($value["is_percent"] == 1){
225
+ $difference += ($price * $value['pricing_value']) / 100;
226
+ }else{
227
+ $difference += $value['pricing_value'];
228
+ }
229
+ }
230
+ }
231
+ }
232
+
233
+ if($product->isSalable() != false){
234
+ array_push($res, $this->getProductInfo($product, $store, array('caption_name' => $caption,
235
+ 'configurable_price' => $price + $difference, 'configurable_options' => $configurable_options)));
236
+ }
237
+ }
238
+ return $res;
239
+ }
240
+
241
+ private function groupedProducts($parent, $store = null, $identifierType = null)
242
+ {
243
+ $res = array();
244
+ $children = $parent->getTypeInstance()->getChildrenIds($parent->getId());
245
+ foreach ($children[3] as $i => $value) {
246
+ $product = $this->_getProduct($value, $store, $identifierType);
247
+ if($product->isSalable() != false){
248
+ array_push($res,$this->getProductInfo($product, $store));
249
+ }
250
+ }
251
+ return $res;
252
+ }
253
+
254
+ private function getCustomOptions($product)
255
+ {
256
+ $options = array();
257
+ $customOptions = $product->getOptions();
258
+ foreach ($customOptions as $customOption) {
259
+ $values = $customOption->getValues();
260
+ $option = array(
261
+ 'mgnt_id' => $customOption->getId(),
262
+ 'title' => $customOption->getTitle(),
263
+ 'required' => $customOption->getIsRequire(),
264
+ 'input_type' => $customOption->getType(),
265
+ 'order' => $customOption->getSortOrder(),
266
+ 'price' => $customOption->getPrice(),
267
+ 'price_type' => $customOption->getPriceType(),
268
+ 'values' => array()
269
+ );
270
+
271
+ foreach ($values as $value) {
272
+ array_push($option['values'],
273
+ array(
274
+ 'title' => $value->getTitle(),
275
+ 'price' => $value->getPrice(),
276
+ 'price_type' => $value->getPriceType(),
277
+ 'sku' => $value->getSku(),
278
+ 'mgnt_id' => $value->getId()
279
+ )
280
+ );
281
+ }
282
+ array_push($options, $option);
283
+ }
284
+ return $options;
285
+ }
286
+
287
+ /* Downloadable products links */
288
+ private function getDownloadableLinks($product){
289
+ if($product->getTypeId() != "downloadable") return array();
290
+ $links = $product->getTypeInstance(true)->getLinks($product);
291
+ $links_res = array();
292
+ foreach($links as $link){
293
+ array_push($links_res, array('price' => $link->getPrice(), 'mgnt_id' => $link->getId(), 'title' => $link->getTitle(), 'price_type' => "fixed"));
294
+ }
295
+ return $links_res;
296
+ }
297
+
298
+ protected function _nodeToArray(Varien_Data_Tree_Node $node)
299
+ {
300
+ $result = array();
301
+ $result['category_id'] = $node->getId();
302
+ $result['parent_id'] = $node->getParentId();
303
+ $result['name'] = $node->getName();
304
+ $result['is_active'] = $node->getIsActive();
305
+ $result['position'] = $node->getPosition();
306
+ $result['level'] = $node->getLevel();
307
+ $result['product_count'] = $node->getProductCount();
308
+ $result['children'] = array();
309
+
310
+ foreach ($node->getChildren() as $child) {
311
+ $result['children'][] = $this->_nodeToArray($child);
312
+ }
313
+ return $result;
314
+ }
315
+ }
app/code/community/Beecoder/Beeshopy/controllers/AdminController.php ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Admin menu
4
+ *
5
+ * @category Beetailer
6
+ * @package Beecoder_Beeshopy
7
+ */
8
+
9
+
10
+ class Beecoder_Beeshopy_AdminController extends Mage_Adminhtml_Controller_Action
11
+ {
12
+ public function indexAction()
13
+ {
14
+ $this->loadLayout();
15
+ $this->_setActiveMenu('facebook-store');
16
+
17
+ $block = $this->getLayout()
18
+ ->createBlock('core/text', 'beetailer-admin')
19
+ ->setText("<iframe src='https://www.beetailer.com?from=iframe' width=1124 height='2350' frameborder='0' scrolling='no' style='margin:0px auto;display:block;'></iframe>");
20
+
21
+ $this->_addContent($block);
22
+ $this->renderLayout();
23
+ }
24
+
25
+ protected function _isAllowed()
26
+ {
27
+ return Mage::getSingleton('admin/session')->isAllowed('facebook-store');
28
+ }
29
+ }
app/code/community/Beecoder/Beeshopy/controllers/IndexController.php ADDED
@@ -0,0 +1,66 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Beetailer Shopping cart class
4
+ *
5
+ * @category Beetailer
6
+ * @package Beecoder_Beeshopy
7
+ */
8
+
9
+
10
+ class Beecoder_Beeshopy_IndexController extends Mage_Core_Controller_Front_Action
11
+ {
12
+ public function indexAction()
13
+ {
14
+ if ($this->getRequest()->getParams()) {
15
+ Mage::getModel('core/cookie')->set("beetailer_ref", $this->getRequest()->getParam('fb_ref'));
16
+ Mage::getModel('core/cookie')->set("beetailer_ref_date", time());
17
+
18
+ /* Fill shopping cart */
19
+ $cart = Mage::getSingleton('checkout/cart');
20
+ $products = $this->getRequest()->getParam('products');
21
+ $sview = $this->getRequest()->getParam('store_view');
22
+
23
+ foreach($products as $attrs){
24
+ $product = Mage::getModel('catalog/product')
25
+ ->setStoreId(Mage::app()->getStore($sview)->getId())
26
+ ->load($attrs['idx']);
27
+
28
+ $options = isset($attrs['options']) ? $attrs['options'] : array();
29
+ $super_attributes = isset($attrs['super_attributes']) ? $attrs['super_attributes'] : array();
30
+ $links = isset($attrs['links']) ? explode(",", $attrs['links'][0]) : array();
31
+
32
+ try{
33
+ $cart->addProduct($product, array(
34
+ 'qty' => $attrs["qty"],
35
+ 'super_attribute' => $super_attributes,
36
+ 'options' => $options,
37
+ 'links' => $links
38
+ ));
39
+ }catch (Mage_Core_Exception $e) { }
40
+ }
41
+ $cart->save();
42
+ Mage::getSingleton('checkout/session')->setCartWasUpdated(true);
43
+
44
+ $this->_redirect('checkout/cart', $this->gaParams());
45
+ }else{
46
+ $this->_redirect('/');
47
+ }
48
+ }
49
+
50
+ /** Add Google analytics parameters */
51
+ public function gaParams()
52
+ {
53
+ $redirect_params = array();
54
+ foreach($this->getRequest()->getParams() as $k => $v){
55
+ if(preg_match('/^utm_/', $k)){
56
+ $redirect_params[$k] = $v;
57
+ }
58
+ }
59
+
60
+ if(count($redirect_params)){
61
+ $redirect_params = array('_query' => $redirect_params);
62
+ }
63
+
64
+ return $redirect_params;
65
+ }
66
+ }
app/code/community/Beecoder/Beeshopy/etc/api.xml ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <api>
4
+ <resources>
5
+ <beeshopyCustomApi translate="title" module="Beecoder_Beeshopy">
6
+ <title>Beeshopy custom API</title>
7
+ <model>Beecoder_Beeshopy/Api</model>
8
+ <methods>
9
+ <!-- Retrieve product information -->
10
+ <productInfo translate="title" module="beecoder_beeshopy">
11
+ <title>Retrieve product information</title>
12
+ <acl>catalog/product</acl>
13
+ </productInfo>
14
+ <!-- Rewrite original category.tree, num products added -->
15
+ <categoryTree translate="title" module="beecoder_beeshopy">
16
+ <title>Rewrite original category.tree, num products added</title>
17
+ <acl>catalog/product</acl>
18
+ </categoryTree>
19
+ <!-- Rewrite original category.assignedProducts, product_name added -->
20
+ <assignedProducts translate="title" module="beecoder_beeshopy">
21
+ <title>Rewrite original category.assignedProducts, product_name added</title>
22
+ <acl>catalog/product</acl>
23
+ </assignedProducts>
24
+ <!-- System information, store views, taxes included, currencies -->
25
+ <systemInfo translate="title" module="beecoder_beeshopy">
26
+ <title>Retrieve usefull system information</title>
27
+ <acl>catalog/product</acl>
28
+ </systemInfo>
29
+ <!-- Check if module is instaled and check correct access permissions-->
30
+ <checkModule translate="title" module="beecoder_beeshopy">
31
+ <title>Check if module installed and return version</title>
32
+ <acl>catalog/product</acl>
33
+ </checkModule>
34
+ </methods>
35
+ </beeshopyCustomApi>
36
+ </resources>
37
+ <acl>
38
+ <resources>
39
+ <all>
40
+ </all>
41
+ </resources>
42
+ </acl>
43
+ </api>
44
+ </config>
app/code/community/Beecoder/Beeshopy/etc/config.xml ADDED
@@ -0,0 +1,84 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <config>
3
+ <modules>
4
+ <Beecoder_Beeshopy>
5
+ <version>0.1.0</version>
6
+ </Beecoder_Beeshopy>
7
+ </modules>
8
+
9
+ <global>
10
+ <blocks>
11
+ <beecoder_beeshopy>
12
+ <class>Beecoder_Beeshopy_Block</class>
13
+ </beecoder_beeshopy>
14
+ </blocks>
15
+
16
+ <models>
17
+ <Beecoder_Beeshopy>
18
+ <class>Beecoder_Beeshopy_Model</class>
19
+ </Beecoder_Beeshopy>
20
+ </models>
21
+
22
+ <helpers>
23
+ <Beeshopy>
24
+ <class>Beecoder_Beeshopy_Helper</class>
25
+ </Beeshopy>
26
+ </helpers>
27
+ </global>
28
+
29
+ <frontend>
30
+ <routers>
31
+ <process-facebook-cart>
32
+ <use>standard</use>
33
+ <args>
34
+ <module>Beecoder_Beeshopy</module>
35
+ <frontName>process-facebook-cart</frontName>
36
+ </args>
37
+ </process-facebook-cart>
38
+ </routers>
39
+
40
+ <layout>
41
+ <updates>
42
+ <beeshopy>
43
+ <file>beeshopy.xml</file>
44
+ </beeshopy>
45
+ </updates>
46
+ </layout>
47
+ </frontend>
48
+
49
+ <admin>
50
+ <routers>
51
+ <beetailer-installation>
52
+ <use>admin</use>
53
+ <args>
54
+ <module>Beecoder_Beeshopy</module>
55
+ <frontName>beetailer-installation</frontName>
56
+ </args>
57
+ </beetailer-installation>
58
+ </routers>
59
+ </admin>
60
+
61
+ <adminhtml>
62
+ <menu>
63
+ <facebook-store translate="title" module="Beeshopy">
64
+ <title>Facebook Store</title>
65
+ <action>beetailer-installation/admin/index</action>
66
+ <sort_order>100</sort_order>
67
+ </facebook-store>
68
+ </menu>
69
+
70
+ <acl>
71
+ <resources>
72
+ <admin>
73
+ <children>
74
+ <facebook-store translate="title" module="Beeshopy">
75
+ <title>Facebook Store</title>
76
+ <sort_order>100</sort_order>
77
+ </facebook-store>
78
+ </children>
79
+ </admin>
80
+ </resources>
81
+ </acl>
82
+ </adminhtml>
83
+ </config>
84
+
app/design/frontend/base/default/layout/beeshopy.xml ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <layout version="0.1.0">
3
+ <checkout_onepage_success>
4
+ <reference name="before_body_end">
5
+ <block type="beecoder_beeshopy/track" name="beecoderbeeshopy_track" template='beeshopy/track.phtml'/>
6
+ </reference>
7
+ </checkout_onepage_success>
8
+
9
+ <default>
10
+ <reference name="head">
11
+ <block type="core/text" name='beetailer'>
12
+ <action method="setText">
13
+ <text><![CDATA[ <script type='text/javascript' src='//www.beetailer.com/javascripts/beetailer.js'></script> ]]> </text>
14
+ </action>
15
+ </block>
16
+ </reference>
17
+ </default>
18
+ </layout>
app/design/frontend/base/default/template/beeshopy/track.phtml ADDED
@@ -0,0 +1,4 @@
 
 
 
 
1
+ <!-- Beetailer.com tracking code -->
2
+ <?php
3
+ echo($this->trackingCode());
4
+ ?>
app/etc/modules/Beecoder_Beeshopy.xml ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Beecoder_Beeshopy>
5
+ <active>true</active>
6
+ <codePool>community</codePool>
7
+ </Beecoder_Beeshopy>
8
+ </modules>
9
+ </config>
10
+
package.xml ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>stas_test_extension_2</name>
4
+ <version>1.0.1</version>
5
+ <stability>stable</stability>
6
+ <license>OSL v3.0</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>Insert your shop in Facebook!&#xD;
10
+ Beeshopy extension for Magento, it allows you to integrates your magento store with beeshopy.</summary>
11
+ <description>Custom Module that allows you to connect with beeshopy service and integrates your magento store with Facebook. &#xD;
12
+ &#xD;
13
+ It contains a custom API and cart processing.</description>
14
+ <notes>Adding js file to package</notes>
15
+ <authors><author><name>Miguel &#xC1;ngel Mart&#xED;nez Trivi&#xF1;o</name><user>auto-converted</user><email>migmartri@gmail.com</email></author></authors>
16
+ <date>2011-09-14</date>
17
+ <time>08:56:17</time>
18
+ <contents><target name="magecommunity"><dir name="Beecoder"><dir name="Beeshopy"><dir name="Block"><file name="Track.php" hash="a40d400b02f73d5b4dea35c348ffee00"/></dir><dir name="Helper"><file name="Data.php" hash="ead88c0b629856526d39e7fb6f3a4ca5"/></dir><dir name="Model"><file name="Api.php" hash="8e02acad05b4494025b76a7a1504351c"/></dir><dir name="controllers"><file name="AdminController.php" hash="1b343fe1ef8ae5fafc5d355844e3f508"/><file name="IndexController.php" hash="bad3391bb742a55a2ee62895cb723e87"/></dir><dir name="etc"><file name="api.xml" hash="507ae656ea724a77def33efd8429d674"/><file name="config.xml" hash="2fcfaeccb838771505e12715c9618c3d"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Beecoder_Beeshopy.xml" hash="55666ef45f08dab44b138e49532ca3b8"/></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="beeshopy.xml" hash="d307958edf914638aa5cd57f8d449c46"/></dir><dir name="template"><dir name="beeshopy"><file name="track.phtml" hash="47c95001bb55042c5ae7d8ee4b03cccf"/></dir></dir></dir></dir></dir></target><target name="mageskin"><dir name="frontend"><dir name="base"><dir name="default"><dir name="js"><dir name="beeshopy"><file name="beetailer.js" hash="1ec29bef61895d80519a8559734c90e6"/></dir></dir></dir></dir></dir></target></contents>
19
+ <compatible/>
20
+ <dependencies/>
21
+ </package>
skin/frontend/base/default/js/beeshopy/beetailer.js ADDED
@@ -0,0 +1,390 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ var fb_ref_regex = /^beetailer_(.*)/
2
+
3
+ function getParam(name){
4
+ var results = new RegExp('[\\?&]' + name + '=([^&#]*)').exec(window.location.href);
5
+ if (results) {
6
+ return results[1];
7
+ } else {
8
+ null
9
+ }
10
+ }
11
+
12
+ /* Cookies handle */
13
+ function createCookie(name,value,days) {
14
+ if (days) {
15
+ var date = new Date();
16
+ date.setTime(date.getTime()+(days*24*60*60*1000));
17
+ var expires = "; expires="+date.toGMTString();
18
+ }
19
+ else var expires = "";
20
+ /* Adding wildcard period character in order to work with Magento core/cookie set function */
21
+ document.cookie = name+"="+value+expires+"; path=/; domain=."+window.location.hostname;
22
+ }
23
+
24
+ function readCookie(name) {
25
+ var nameEQ = name + "=";
26
+ var ca = document.cookie.split(';');
27
+ for(var i=0;i < ca.length;i++) {
28
+ var c = ca[i];
29
+ while (c.charAt(0)==' ') c = c.substring(1,c.length);
30
+ if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
31
+ }
32
+
33
+ return "";
34
+ }
35
+
36
+ function eraseCookie(name) {
37
+ createCookie(name,"",-1);
38
+ }
39
+
40
+ /* Check for Beetailer ref*/
41
+ function checkUrl(){
42
+ if(getParam("fb_ref") && fb_ref_regex.test(getParam("fb_ref"))){
43
+ /* Deprecated */
44
+ /* General cookie */
45
+ createCookie("beetailer_shop", getParam("fb_ref").split("_")[1] , 720);
46
+ /* Checkout cookie */
47
+ if(getParam("checkout_token")){
48
+ createCookie("beetailer_checkout", getParam("checkout_token"), 720);
49
+ }
50
+ /* EO deprecated */
51
+
52
+ createCookie("beetailer_ref", getParam("fb_ref") , 720);
53
+ createCookie("beetailer_ref_date", new Date().getTime()/1000 , 720);
54
+
55
+ }
56
+ }
57
+
58
+ function hidePromoPopup(){
59
+ var head = document.getElementsByTagName('html')[0];
60
+ var child = document.getElementById("beetailer_promotion");
61
+ head.removeChild(child);
62
+ createCookie("hide_beetailer_promos", 1)
63
+ }
64
+
65
+ function addPromos(){
66
+ if(!readCookie('hide_beetailer_promos')){
67
+ /* Load promotions script */
68
+ var head= document.getElementsByTagName('head')[0];
69
+ var script= document.createElement('script');
70
+ script.type= 'text/javascript';
71
+ script.src= '//www.beetailer.com/out/promotions.js?domain=' + window.location.hostname;
72
+ head.appendChild(script);
73
+ }
74
+ }
75
+
76
+ function addBeesocial(){
77
+ if(typeof bt_widget_label == "undefined"){ bt_widget_label = "beesocial"};
78
+ if(document.getElementById(bt_widget_label) && !document.getElementById("social_widget_iframe")){
79
+ label = document.getElementById(bt_widget_label);
80
+ var attributes = document.getElementById(bt_widget_label).attributes;
81
+ var options = Array();
82
+
83
+ /* Load javascript vbles embeded in html tag attributes */
84
+ for (i=0;i<attributes.length; i++){
85
+ options[attributes[i].nodeName] = attributes[i].nodeValue;
86
+ }
87
+
88
+ /* Instanciate iframe script */
89
+ var iframe= document.createElement('iframe');
90
+ iframe.setAttribute("frameBorder", "0");
91
+ iframe.setAttribute("scrolling", "no");
92
+ iframe.setAttribute("width", "100%");
93
+ iframe.setAttribute("height", "1");
94
+ iframe.setAttribute("id", "social_widget_iframe");
95
+ var src= "//www.beetailer.com/out/social_widget" +
96
+ "?domain=" + options["data-domain"] +
97
+ "&product_id=" + options["data-product-id"] +
98
+ "&url=" + options["data-url"] +
99
+ "&data_comment_width=" + options['data-comment-width'] +
100
+ "&data_css_style=" + escape(options['data-css-style']) +
101
+ "&data_disable_twitter=" + options['data-disable-twitter'] +
102
+ "&data_disable_like=" + options['data-disable-like'] +
103
+ "&data_disable_comment=" + options['data-disable-comment'] +
104
+ "&data_disable_plusone=" + options['data-disable-plusone'] +
105
+ "&data_twitter_text=" + options['data-twitter-text'] +
106
+ "&data_fb_comment_style=" + options['data-fb-comment-style'] +
107
+ "&data_fb_comment_num_post=" + options['data-fb-comment-num-post'] +
108
+ "&platform=" + options['platform'];
109
+
110
+ iframe.src= src + "&hash=" + MD5(src) + "#" + window.location.href;
111
+ label.appendChild(iframe);
112
+
113
+ /* Resize listener */
114
+ XD.receiveMessage(function(message){
115
+ console.warn('Resizing iframe ' + message.data + 'px');
116
+ document.getElementById('social_widget_iframe').style.height= message.data + 'px';
117
+ }, 'https://www.beetailer.com');
118
+ }
119
+ }
120
+
121
+ // Resize post_message
122
+ //
123
+ var XD = function(){
124
+ var interval_id,
125
+ last_hash,
126
+ cache_bust = 1,
127
+ attached_callback,
128
+ window = this;
129
+
130
+ return {
131
+ postMessage : function(message, target_url, target) {
132
+ if (!target_url) {
133
+ return;
134
+ }
135
+ target = target || parent; // default to parent
136
+ if (window['postMessage']) {
137
+ // the browser supports window.postMessage, so call it with a targetOrigin
138
+ // set appropriately, based on the target_url parameter.
139
+ target['postMessage'](message, target_url.replace( /([^:]+:\/\/[^\/]+).*/, '$1'));
140
+ } else if (target_url) {
141
+ // the browser does not support window.postMessage, so use the window.location.hash fragment hack
142
+ target.location = target_url.replace(/#.*$/, '') + '#' + (+new Date) + (cache_bust++) + '&' + message;
143
+ }
144
+ },
145
+ receiveMessage : function(callback, source_origin) {
146
+ // browser supports window.postMessage
147
+ if (window['postMessage']) {
148
+ // bind the callback to the actual event associated with window.postMessage
149
+ if (callback) {
150
+ attached_callback = function(e) {
151
+ if ((typeof source_origin === 'string' && typeof e.origin === 'string' && e.origin.replace(/http(s*):\/\//, "") !== source_origin.replace(/http(s*):\/\//, ""))
152
+ || (Object.prototype.toString.call(source_origin) === "[object Function]" && source_origin(e.origin) === !1)) {
153
+ return !1;
154
+ }
155
+ callback(e);
156
+ };
157
+ }
158
+ if (window['addEventListener']) {
159
+ window[callback ? 'addEventListener' : 'removeEventListener']('message', attached_callback, !1);
160
+ } else {
161
+ window[callback ? 'attachEvent' : 'detachEvent']('onmessage', attached_callback);
162
+ }
163
+ } else {
164
+ // a polling loop is started & callback is called whenever the location.hash changes
165
+ interval_id && clearInterval(interval_id);
166
+ interval_id = null;
167
+ if (callback) {
168
+ interval_id = setInterval(function() {
169
+ var hash = document.location.hash,
170
+ re = /^#?\d+&/;
171
+ if (hash !== last_hash && re.test(hash)) {
172
+ last_hash = hash;
173
+ callback({data: hash.replace(re, '')});
174
+ }
175
+ }, 100);
176
+ }
177
+ }
178
+ }
179
+ };
180
+ }();
181
+
182
+ /**
183
+ *
184
+ * MD5 (Message-Digest Algorithm)
185
+ * http://www.webtoolkit.info/
186
+ *
187
+ **/
188
+
189
+ var MD5 = function (string) {
190
+
191
+ function RotateLeft(lValue, iShiftBits) {
192
+ return (lValue<<iShiftBits) | (lValue>>>(32-iShiftBits));
193
+ }
194
+
195
+ function AddUnsigned(lX,lY) {
196
+ var lX4,lY4,lX8,lY8,lResult;
197
+ lX8 = (lX & 0x80000000);
198
+ lY8 = (lY & 0x80000000);
199
+ lX4 = (lX & 0x40000000);
200
+ lY4 = (lY & 0x40000000);
201
+ lResult = (lX & 0x3FFFFFFF)+(lY & 0x3FFFFFFF);
202
+ if (lX4 & lY4) {
203
+ return (lResult ^ 0x80000000 ^ lX8 ^ lY8);
204
+ }
205
+ if (lX4 | lY4) {
206
+ if (lResult & 0x40000000) {
207
+ return (lResult ^ 0xC0000000 ^ lX8 ^ lY8);
208
+ } else {
209
+ return (lResult ^ 0x40000000 ^ lX8 ^ lY8);
210
+ }
211
+ } else {
212
+ return (lResult ^ lX8 ^ lY8);
213
+ }
214
+ }
215
+
216
+ function F(x,y,z) { return (x & y) | ((~x) & z); }
217
+ function G(x,y,z) { return (x & z) | (y & (~z)); }
218
+ function H(x,y,z) { return (x ^ y ^ z); }
219
+ function I(x,y,z) { return (y ^ (x | (~z))); }
220
+
221
+ function FF(a,b,c,d,x,s,ac) {
222
+ a = AddUnsigned(a, AddUnsigned(AddUnsigned(F(b, c, d), x), ac));
223
+ return AddUnsigned(RotateLeft(a, s), b);
224
+ };
225
+
226
+ function GG(a,b,c,d,x,s,ac) {
227
+ a = AddUnsigned(a, AddUnsigned(AddUnsigned(G(b, c, d), x), ac));
228
+ return AddUnsigned(RotateLeft(a, s), b);
229
+ };
230
+
231
+ function HH(a,b,c,d,x,s,ac) {
232
+ a = AddUnsigned(a, AddUnsigned(AddUnsigned(H(b, c, d), x), ac));
233
+ return AddUnsigned(RotateLeft(a, s), b);
234
+ };
235
+
236
+ function II(a,b,c,d,x,s,ac) {
237
+ a = AddUnsigned(a, AddUnsigned(AddUnsigned(I(b, c, d), x), ac));
238
+ return AddUnsigned(RotateLeft(a, s), b);
239
+ };
240
+
241
+ function ConvertToWordArray(string) {
242
+ var lWordCount;
243
+ var lMessageLength = string.length;
244
+ var lNumberOfWords_temp1=lMessageLength + 8;
245
+ var lNumberOfWords_temp2=(lNumberOfWords_temp1-(lNumberOfWords_temp1 % 64))/64;
246
+ var lNumberOfWords = (lNumberOfWords_temp2+1)*16;
247
+ var lWordArray=Array(lNumberOfWords-1);
248
+ var lBytePosition = 0;
249
+ var lByteCount = 0;
250
+ while ( lByteCount < lMessageLength ) {
251
+ lWordCount = (lByteCount-(lByteCount % 4))/4;
252
+ lBytePosition = (lByteCount % 4)*8;
253
+ lWordArray[lWordCount] = (lWordArray[lWordCount] | (string.charCodeAt(lByteCount)<<lBytePosition));
254
+ lByteCount++;
255
+ }
256
+ lWordCount = (lByteCount-(lByteCount % 4))/4;
257
+ lBytePosition = (lByteCount % 4)*8;
258
+ lWordArray[lWordCount] = lWordArray[lWordCount] | (0x80<<lBytePosition);
259
+ lWordArray[lNumberOfWords-2] = lMessageLength<<3;
260
+ lWordArray[lNumberOfWords-1] = lMessageLength>>>29;
261
+ return lWordArray;
262
+ };
263
+
264
+ function WordToHex(lValue) {
265
+ var WordToHexValue="",WordToHexValue_temp="",lByte,lCount;
266
+ for (lCount = 0;lCount<=3;lCount++) {
267
+ lByte = (lValue>>>(lCount*8)) & 255;
268
+ WordToHexValue_temp = "0" + lByte.toString(16);
269
+ WordToHexValue = WordToHexValue + WordToHexValue_temp.substr(WordToHexValue_temp.length-2,2);
270
+ }
271
+ return WordToHexValue;
272
+ };
273
+
274
+ function Utf8Encode(string) {
275
+ string = string.replace(/\r\n/g,"\n");
276
+ var utftext = "";
277
+
278
+ for (var n = 0; n < string.length; n++) {
279
+
280
+ var c = string.charCodeAt(n);
281
+
282
+ if (c < 128) {
283
+ utftext += String.fromCharCode(c);
284
+ }
285
+ else if((c > 127) && (c < 2048)) {
286
+ utftext += String.fromCharCode((c >> 6) | 192);
287
+ utftext += String.fromCharCode((c & 63) | 128);
288
+ }
289
+ else {
290
+ utftext += String.fromCharCode((c >> 12) | 224);
291
+ utftext += String.fromCharCode(((c >> 6) & 63) | 128);
292
+ utftext += String.fromCharCode((c & 63) | 128);
293
+ }
294
+
295
+ }
296
+
297
+ return utftext;
298
+ };
299
+
300
+ var x=Array();
301
+ var k,AA,BB,CC,DD,a,b,c,d;
302
+ var S11=7, S12=12, S13=17, S14=22;
303
+ var S21=5, S22=9 , S23=14, S24=20;
304
+ var S31=4, S32=11, S33=16, S34=23;
305
+ var S41=6, S42=10, S43=15, S44=21;
306
+
307
+ string = Utf8Encode(string);
308
+
309
+ x = ConvertToWordArray(string);
310
+
311
+ a = 0x67452301; b = 0xEFCDAB89; c = 0x98BADCFE; d = 0x10325476;
312
+
313
+ for (k=0;k<x.length;k+=16) {
314
+ AA=a; BB=b; CC=c; DD=d;
315
+ a=FF(a,b,c,d,x[k+0], S11,0xD76AA478);
316
+ d=FF(d,a,b,c,x[k+1], S12,0xE8C7B756);
317
+ c=FF(c,d,a,b,x[k+2], S13,0x242070DB);
318
+ b=FF(b,c,d,a,x[k+3], S14,0xC1BDCEEE);
319
+ a=FF(a,b,c,d,x[k+4], S11,0xF57C0FAF);
320
+ d=FF(d,a,b,c,x[k+5], S12,0x4787C62A);
321
+ c=FF(c,d,a,b,x[k+6], S13,0xA8304613);
322
+ b=FF(b,c,d,a,x[k+7], S14,0xFD469501);
323
+ a=FF(a,b,c,d,x[k+8], S11,0x698098D8);
324
+ d=FF(d,a,b,c,x[k+9], S12,0x8B44F7AF);
325
+ c=FF(c,d,a,b,x[k+10],S13,0xFFFF5BB1);
326
+ b=FF(b,c,d,a,x[k+11],S14,0x895CD7BE);
327
+ a=FF(a,b,c,d,x[k+12],S11,0x6B901122);
328
+ d=FF(d,a,b,c,x[k+13],S12,0xFD987193);
329
+ c=FF(c,d,a,b,x[k+14],S13,0xA679438E);
330
+ b=FF(b,c,d,a,x[k+15],S14,0x49B40821);
331
+ a=GG(a,b,c,d,x[k+1], S21,0xF61E2562);
332
+ d=GG(d,a,b,c,x[k+6], S22,0xC040B340);
333
+ c=GG(c,d,a,b,x[k+11],S23,0x265E5A51);
334
+ b=GG(b,c,d,a,x[k+0], S24,0xE9B6C7AA);
335
+ a=GG(a,b,c,d,x[k+5], S21,0xD62F105D);
336
+ d=GG(d,a,b,c,x[k+10],S22,0x2441453);
337
+ c=GG(c,d,a,b,x[k+15],S23,0xD8A1E681);
338
+ b=GG(b,c,d,a,x[k+4], S24,0xE7D3FBC8);
339
+ a=GG(a,b,c,d,x[k+9], S21,0x21E1CDE6);
340
+ d=GG(d,a,b,c,x[k+14],S22,0xC33707D6);
341
+ c=GG(c,d,a,b,x[k+3], S23,0xF4D50D87);
342
+ b=GG(b,c,d,a,x[k+8], S24,0x455A14ED);
343
+ a=GG(a,b,c,d,x[k+13],S21,0xA9E3E905);
344
+ d=GG(d,a,b,c,x[k+2], S22,0xFCEFA3F8);
345
+ c=GG(c,d,a,b,x[k+7], S23,0x676F02D9);
346
+ b=GG(b,c,d,a,x[k+12],S24,0x8D2A4C8A);
347
+ a=HH(a,b,c,d,x[k+5], S31,0xFFFA3942);
348
+ d=HH(d,a,b,c,x[k+8], S32,0x8771F681);
349
+ c=HH(c,d,a,b,x[k+11],S33,0x6D9D6122);
350
+ b=HH(b,c,d,a,x[k+14],S34,0xFDE5380C);
351
+ a=HH(a,b,c,d,x[k+1], S31,0xA4BEEA44);
352
+ d=HH(d,a,b,c,x[k+4], S32,0x4BDECFA9);
353
+ c=HH(c,d,a,b,x[k+7], S33,0xF6BB4B60);
354
+ b=HH(b,c,d,a,x[k+10],S34,0xBEBFBC70);
355
+ a=HH(a,b,c,d,x[k+13],S31,0x289B7EC6);
356
+ d=HH(d,a,b,c,x[k+0], S32,0xEAA127FA);
357
+ c=HH(c,d,a,b,x[k+3], S33,0xD4EF3085);
358
+ b=HH(b,c,d,a,x[k+6], S34,0x4881D05);
359
+ a=HH(a,b,c,d,x[k+9], S31,0xD9D4D039);
360
+ d=HH(d,a,b,c,x[k+12],S32,0xE6DB99E5);
361
+ c=HH(c,d,a,b,x[k+15],S33,0x1FA27CF8);
362
+ b=HH(b,c,d,a,x[k+2], S34,0xC4AC5665);
363
+ a=II(a,b,c,d,x[k+0], S41,0xF4292244);
364
+ d=II(d,a,b,c,x[k+7], S42,0x432AFF97);
365
+ c=II(c,d,a,b,x[k+14],S43,0xAB9423A7);
366
+ b=II(b,c,d,a,x[k+5], S44,0xFC93A039);
367
+ a=II(a,b,c,d,x[k+12],S41,0x655B59C3);
368
+ d=II(d,a,b,c,x[k+3], S42,0x8F0CCC92);
369
+ c=II(c,d,a,b,x[k+10],S43,0xFFEFF47D);
370
+ b=II(b,c,d,a,x[k+1], S44,0x85845DD1);
371
+ a=II(a,b,c,d,x[k+8], S41,0x6FA87E4F);
372
+ d=II(d,a,b,c,x[k+15],S42,0xFE2CE6E0);
373
+ c=II(c,d,a,b,x[k+6], S43,0xA3014314);
374
+ b=II(b,c,d,a,x[k+13],S44,0x4E0811A1);
375
+ a=II(a,b,c,d,x[k+4], S41,0xF7537E82);
376
+ d=II(d,a,b,c,x[k+11],S42,0xBD3AF235);
377
+ c=II(c,d,a,b,x[k+2], S43,0x2AD7D2BB);
378
+ b=II(b,c,d,a,x[k+9], S44,0xEB86D391);
379
+ a=AddUnsigned(a,AA);
380
+ b=AddUnsigned(b,BB);
381
+ c=AddUnsigned(c,CC);
382
+ d=AddUnsigned(d,DD);
383
+ }
384
+
385
+ var temp = WordToHex(a)+WordToHex(b)+WordToHex(c)+WordToHex(d);
386
+
387
+ return temp.toLowerCase();
388
+ }
389
+
390
+ window.onload=function(){ checkUrl(); addBeesocial(); addPromos(); };