Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

browser compatibility #493

Merged
merged 2 commits into from Feb 25, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion upload/admin/controller/catalog/option.php
Original file line number Diff line number Diff line change
Expand Up @@ -505,7 +505,7 @@ public function autocomplete() {

$option_value_data[] = array(
'option_value_id' => $option_value['option_value_id'],
'name' => html_entity_decode($option_value['name'], ENT_QUOTES, 'UTF-8'),
'name' => strip_tags(html_entity_decode($option_value['name'], ENT_QUOTES, 'UTF-8')),
'image' => $image
);
}
Expand Down
2 changes: 1 addition & 1 deletion upload/admin/controller/sale/affiliate.php
Original file line number Diff line number Diff line change
Expand Up @@ -1113,7 +1113,7 @@ public function autocomplete() {
foreach ($results as $result) {
$affiliate_data[] = array(
'affiliate_id' => $result['affiliate_id'],
'name' => html_entity_decode($result['name'], ENT_QUOTES, 'UTF-8')
'name' => strip_tags(html_entity_decode($result['name'], ENT_QUOTES, 'UTF-8'))
);
}
}
Expand Down
1 change: 1 addition & 0 deletions upload/catalog/controller/product/category.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ public function index() {
$this->document->setTitle($category_info['name']);
$this->document->setDescription($category_info['meta_description']);
$this->document->setKeywords($category_info['meta_keyword']);
$this->document->addScript('catalog/view/javascript/jquery/jquery.cookie.js');
$this->document->addScript('catalog/view/javascript/jquery/jquery.total-storage.min.js');

$this->data['heading_title'] = $category_info['name'];
Expand Down
1 change: 1 addition & 0 deletions upload/catalog/controller/product/manufacturer.php
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ public function info() {

if ($manufacturer_info) {
$this->document->setTitle($manufacturer_info['name']);
$this->document->addScript('catalog/view/javascript/jquery/jquery.cookie.js');
$this->document->addScript('catalog/view/javascript/jquery/jquery.total-storage.min.js');

$url = '';
Expand Down
1 change: 1 addition & 0 deletions upload/catalog/controller/product/search.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ public function index() {
$this->document->setTitle($this->language->get('heading_title'));
}

$this->document->addScript('catalog/view/javascript/jquery/jquery.cookie.js');
$this->document->addScript('catalog/view/javascript/jquery/jquery.total-storage.min.js');

$this->data['breadcrumbs'] = array();
Expand Down
1 change: 1 addition & 0 deletions upload/catalog/controller/product/special.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ public function index() {
}

$this->document->setTitle($this->language->get('heading_title'));
$this->document->addScript('catalog/view/javascript/jquery/jquery.cookie.js');
$this->document->addScript('catalog/view/javascript/jquery/jquery.total-storage.min.js');

$this->data['breadcrumbs'] = array();
Expand Down
92 changes: 92 additions & 0 deletions upload/catalog/view/javascript/jquery/jquery.cookie.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
/*!
* jQuery Cookie Plugin v1.3.1
* https://github.com/carhartl/jquery-cookie
*
* Copyright 2013 Klaus Hartl
* Released under the MIT license
*/
(function (factory) {
if (typeof define === 'function' && define.amd) {
// AMD. Register as anonymous module.
define(['jquery'], factory);
} else {
// Browser globals.
factory(jQuery);
}
}(function ($) {

var pluses = /\+/g;

function raw(s) {
return s;
}

function decoded(s) {
return decodeURIComponent(s.replace(pluses, ' '));
}

function converted(s) {
if (s.indexOf('"') === 0) {
// This is a quoted cookie as according to RFC2068, unescape
s = s.slice(1, -1).replace(/\\"/g, '"').replace(/\\\\/g, '\\');
}
try {
return config.json ? JSON.parse(s) : s;
} catch(er) {}
}

var config = $.cookie = function (key, value, options) {

// write
if (value !== undefined) {
options = $.extend({}, config.defaults, options);

if (typeof options.expires === 'number') {
var days = options.expires, t = options.expires = new Date();
t.setDate(t.getDate() + days);
}

value = config.json ? JSON.stringify(value) : String(value);

return (document.cookie = [
encodeURIComponent(key), '=', config.raw ? value : encodeURIComponent(value),
options.expires ? '; expires=' + options.expires.toUTCString() : '', // use expires attribute, max-age is not supported by IE
options.path ? '; path=' + options.path : '',
options.domain ? '; domain=' + options.domain : '',
options.secure ? '; secure' : ''
].join(''));
}

// read
var decode = config.raw ? raw : decoded;
var cookies = document.cookie.split('; ');
var result = key ? undefined : {};
for (var i = 0, l = cookies.length; i < l; i++) {
var parts = cookies[i].split('=');
var name = decode(parts.shift());
var cookie = decode(parts.join('='));

if (key && key === name) {
result = converted(cookie);
break;
}

if (!key) {
result[name] = converted(cookie);
}
}

return result;
};

config.defaults = {};

$.removeCookie = function (key, options) {
if ($.cookie(key) !== undefined) {
$.cookie(key, '', $.extend(options, { expires: -1 }));
return true;
}
return false;
};

}));