// Context part 13

git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@7650 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
rMalie
2011-07-19 09:44:10 +00:00
parent 89213e18e5
commit 35e5efb530
35 changed files with 101 additions and 117 deletions
+1 -1
View File
@@ -235,7 +235,7 @@ class AddressFormatCore extends ObjectModel
* @addressFormat is the format
* @return double Array
*/
public static function getFormattedAddressFieldsValues($address, $addressFormat, $context = null)
public static function getFormattedAddressFieldsValues($address, $addressFormat, Context $context = null)
{
if (!$context)
$context = Context::getContext();
+1 -1
View File
@@ -1801,7 +1801,7 @@ abstract class AdminTabCore
* @param integer $id_lang Language id (optional)
* @return string
*/
protected function getFieldValue($obj, $key, $id_lang = NULL, $context = NULL)
protected function getFieldValue($obj, $key, $id_lang = NULL, Context $context = NULL)
{
$id_shop = ($context) ? $context->shop->getID() : null;
if (!$context)
+1 -1
View File
@@ -104,7 +104,7 @@ class CMSCore extends ObjectModel
return false;
}
public static function getLinks($id_lang, $selection = NULL, $active = true, $id_shop = false, $context = null)
public static function getLinks($id_lang, $selection = NULL, $active = true, $id_shop = false, Context $context = null)
{
if (!$context)
$context = Context::getContext();
+5 -5
View File
@@ -145,7 +145,7 @@ class CMSCategoryCore extends ObjectModel
*
* @return array Subcategories lite tree
*/
function recurseLiteCategTree($maxDepth = 3, $currentDepth = 0, $idLang = NULL, $excludedIdsArray = NULL, $context = null)
function recurseLiteCategTree($maxDepth = 3, $currentDepth = 0, $idLang = NULL, $excludedIdsArray = NULL, Context $context = null)
{
if (!$context)
$context = Context::getContext();
@@ -176,7 +176,7 @@ class CMSCategoryCore extends ObjectModel
);
}
static public function getRecurseCategory($id_lang = null, $current = 1, $active = 1, $links = 0, $id_shop = false, $context = null)
static public function getRecurseCategory($id_lang = null, $current = 1, $active = 1, $links = 0, $id_shop = false, Context $context = null)
{
if (!$context)
$context = Context::getContext();
@@ -466,14 +466,14 @@ class CMSCategoryCore extends ObjectModel
return $result['link_rewrite'];
}
public function getLink($context = null)
public function getLink(Context $context = null)
{
if (!$context)
$context = Context::getContext();
return $context->link->getCMSCategoryLink($this->id, $this->link_rewrite);
}
public function getName($id_lang = NULL, $context = null)
public function getName($id_lang = NULL, Context $context = null)
{
if (!$id_lang)
{
@@ -536,7 +536,7 @@ class CMSCategoryCore extends ObjectModel
* @param integer $id_lang Language ID
* @return array Corresponding categories
*/
public function getParentsCategories($idLang = null, $context = null)
public function getParentsCategories($idLang = null, Context $context = null)
{
if (!$context)
$context = Context::getContext();
+10 -10
View File
@@ -333,7 +333,7 @@ class CartCore extends ObjectModel
*
* @result array Products
*/
public function getProducts($refresh = false, $id_product = false, $context = null)
public function getProducts($refresh = false, $id_product = false, Context $context = null)
{
if (!$this->id)
return array();
@@ -642,7 +642,7 @@ class CartCore extends ObjectModel
/*
** Customization management
*/
protected function _updateCustomizationQuantity($quantity, $id_customization, $id_product, $id_product_attribute, $operator = 'up', $context = null)
protected function _updateCustomizationQuantity($quantity, $id_customization, $id_product, $id_product_attribute, $operator = 'up', Context $context = null)
{
if (!$context)
$context = Context::getContext();
@@ -975,7 +975,7 @@ class CartCore extends ObjectModel
* @param integer $id_carrier Carrier ID (default : current carrier)
* @return float Shipping total
*/
function getOrderShippingCost($id_carrier = NULL, $useTax = true, $context = null)
function getOrderShippingCost($id_carrier = NULL, $useTax = true, Context $context = null)
{
if (!$context)
$context = Context::getContext();
@@ -1231,7 +1231,7 @@ class CartCore extends ObjectModel
*
* @return mixed Return a string if an error occurred and false otherwise
*/
function checkDiscountValidity($discountObj, $discounts, $order_total, $products, $checkCartDiscount = false, $id_group_shop = false, $id_shop = false, $context = null)
function checkDiscountValidity($discountObj, $discounts, $order_total, $products, $checkCartDiscount = false, $id_group_shop = false, $id_shop = false, Context $context = null)
{
if (!$context)
$context = Context::getContext();
@@ -1332,7 +1332,7 @@ class CartCore extends ObjectModel
*
* @return array Cart details
*/
function getSummaryDetails($context = null)
function getSummaryDetails(Context $context = null)
{
if (!$context)
$context = Context::getContext();
@@ -1484,7 +1484,7 @@ class CartCore extends ObjectModel
*
* @return bool Always true
*/
public function addPictureToProduct($id_product, $index, $identifier, $context = null)
public function addPictureToProduct($id_product, $index, $identifier, Context $context = null)
{
if (!$context)
$context = Context::getContext();
@@ -1504,7 +1504,7 @@ class CartCore extends ObjectModel
*
* @return bool Always true
*/
public function addTextFieldToProduct($id_product, $index, $textValue, $context = null)
public function addTextFieldToProduct($id_product, $index, $textValue, Context $context = null)
{
if (!$context)
$context = Context::getContext();
@@ -1520,7 +1520,7 @@ class CartCore extends ObjectModel
*
* @return bool Always true
*/
public function deleteTextFieldFromProduct($id_product, $index, $context = null)
public function deleteTextFieldFromProduct($id_product, $index, Context $context = null)
{
if (!$context)
$context = Context::getContext();
@@ -1534,7 +1534,7 @@ class CartCore extends ObjectModel
*
* @return bool
*/
public function deletePictureToProduct($id_product, $index, $context = null)
public function deletePictureToProduct($id_product, $index, Context $context = null)
{
if (!$context)
$context = Context::getContext();
@@ -1552,7 +1552,7 @@ class CartCore extends ObjectModel
return false;
}
static public function deleteCustomizationInformations($id_product, $context = null)
static public function deleteCustomizationInformations($id_product, Context $context = null)
{
if (!$context)
$context = Context::getContext();
+6 -6
View File
@@ -189,7 +189,7 @@ class CategoryCore extends ObjectModel
*
* @return array Subcategories lite tree
*/
function recurseLiteCategTree($maxDepth = 3, $currentDepth = 0, $idLang = NULL, $excludedIdsArray = NULL, $context = null)
function recurseLiteCategTree($maxDepth = 3, $currentDepth = 0, $idLang = NULL, $excludedIdsArray = NULL, Context $context = null)
{
if (!$context)
$context = Context::getContext();
@@ -451,7 +451,7 @@ class CategoryCore extends ObjectModel
* @param boolean $checkAccess set to false to return all products (even if customer hasn't access)
* @return mixed Products or number of products
*/
public function getProducts($id_lang, $p, $n, $orderBy = NULL, $orderWay = NULL, $getTotal = false, $active = true, $random = false, $randomNumberProducts = 1, $checkAccess = true, $context = null)
public function getProducts($id_lang, $p, $n, $orderBy = NULL, $orderWay = NULL, $getTotal = false, $active = true, $random = false, $randomNumberProducts = 1, $checkAccess = true, Context $context = null)
{
if (!$context)
$context = Context::getContext();
@@ -567,7 +567,7 @@ class CategoryCore extends ObjectModel
return self::getChildren(1, $id_lang, $active);
}
static public function getRootCategory($id_lang = NULL, $id_shop = false, $context = null)
static public function getRootCategory($id_lang = NULL, $id_shop = false, Context $context = null)
{
if (!$context)
$context = Context::getContext();
@@ -710,14 +710,14 @@ class CategoryCore extends ObjectModel
return $result['link_rewrite'];
}
public function getLink($context = null)
public function getLink(Context $context = null)
{
if (!$context)
$context = Context::getContext();
return $context->link->getCategoryLink($this->id, $this->link_rewrite);
}
public function getName($id_lang = NULL, $context = null)
public function getName($id_lang = NULL, Context $context = null)
{
if (!$id_lang)
{
@@ -781,7 +781,7 @@ class CategoryCore extends ObjectModel
* @param integer $id_lang Language ID
* @return array Corresponding categories
*/
public function getParentsCategories($idLang = null, $context = null)
public function getParentsCategories($idLang = null, Context $context = null)
{
//get idLang
$idLang = is_null($idLang) ? $context->language->id : $idLang;
+1 -1
View File
@@ -59,7 +59,7 @@ class ConnectionsSourceCore extends ObjectModel
return $result;
}
public static function logHttpReferer($context = null)
public static function logHttpReferer(Context $context = null)
{
if (!$context)
$context = Context::getContext();
+1 -1
View File
@@ -614,7 +614,7 @@ class CustomerCore extends ObjectModel
return self::$_defaultGroupId[(int)($id_customer)];
}
static public function getCurrentCountry($id_customer, $context = null)
static public function getCurrentCountry($id_customer, Context $context = null)
{
if (!$context)
$context = Context::getContext();
+2 -2
View File
@@ -229,7 +229,7 @@ class DiscountCore extends ObjectModel
* @param boolean $id_customer Customer ID
* @return array Discounts
*/
static public function getCustomerDiscounts($id_lang, $id_customer, $active = false, $includeGenericOnes = true, $stock = false, $context = null)
static public function getCustomerDiscounts($id_lang, $id_customer, $active = false, $includeGenericOnes = true, $stock = false, Context $context = null)
{
if (!$context)
$context = Context::getContext();
@@ -276,7 +276,7 @@ class DiscountCore extends ObjectModel
* @param boolean $order_total_products Total cart products amount
* @return mixed Return a float value or '!' if reduction is 'Shipping free'
*/
public function getValue($nb_discounts = 0, $order_total_products = 0, $shipping_fees = 0, $idCart = false, $useTax = true, $id_group_shop = false, $id_shop = false, $context = null)
public function getValue($nb_discounts = 0, $order_total_products = 0, $shipping_fees = 0, $idCart = false, $useTax = true, $id_group_shop = false, $id_shop = false, Context $context = null)
{
$totalAmount = 0;
+4 -4
View File
@@ -179,7 +179,7 @@ class LinkCore
return Tools::getProtocol().Tools::getMediaServer($filepath).$filepath;
}
public function preloadPageLinks($context = null)
public function preloadPageLinks(Context $context = null)
{
if (!$context)
$context = Context::getContext();
@@ -195,7 +195,7 @@ class LinkCore
self::$cache['page'][$row['page'].'.php_'.$context->language->id] = $this->getLangLink($context->language->id).$row['url_rewrite'];
}
public function getPageLink($filename, $ssl = false, $id_lang = NULL, $request = NULL, $context = null)
public function getPageLink($filename, $ssl = false, $id_lang = NULL, $request = NULL, Context $context = null)
{
if (!$context)
$context = Context::getContext();
@@ -245,7 +245,7 @@ class LinkCore
* @param integer $id_lang Language ID
* @return string link
*/
public function getLanguageLink($id_lang, $context = null)
public function getLanguageLink($id_lang, Context $context = null)
{
if (!$context)
$context = Context::getContext();
@@ -357,7 +357,7 @@ class LinkCore
return $url.(!strstr($url, '?') ? '?' : '&').'orderby='.urlencode($orderby).'&orderway='.urlencode($orderway);
}
protected function getLangLink($id_lang = NULL, $context = null)
protected function getLangLink($id_lang = NULL, Context $context = null)
{
if (!$context)
$context = Context::getContext();
+1 -1
View File
@@ -201,7 +201,7 @@ class MailCore
*
* @param string $string raw sentence (write directly in file)
*/
static public function l($string, $context = null)
static public function l($string, Context $context = null)
{
global $_LANGMAIL;
if (!$context)
+1 -1
View File
@@ -273,7 +273,7 @@ class ManufacturerCore extends ObjectModel
return Tools::link_rewrite($this->name, false);
}
static public function getProducts($id_manufacturer, $id_lang, $p, $n, $orderBy = NULL, $orderWay = NULL, $getTotal = false, $active = true, $context = null)
static public function getProducts($id_manufacturer, $id_lang, $p, $n, $orderBy = NULL, $orderWay = NULL, $getTotal = false, $active = true, Context $context = null)
{
if (!$context)
$context = Context::getContext();
+2 -2
View File
@@ -98,7 +98,7 @@ class MessageCore extends ObjectModel
* @param boolean $private return WITH private messages
* @return array Messages
*/
static public function getMessagesByOrderId($id_order, $private = false, $context = null)
static public function getMessagesByOrderId($id_order, $private = false, Context $context = null)
{
if (!Validate::isBool($private))
die(Tools::displayError());
@@ -125,7 +125,7 @@ class MessageCore extends ObjectModel
* @param boolean $private return WITH private messages
* @return array Messages
*/
static public function getMessagesByCartId($id_cart, $private = false, $context = null)
static public function getMessagesByCartId($id_cart, $private = false, Context $context = null)
{
if (!Validate::isBool($private))
die(Tools::displayError());
+1 -1
View File
@@ -286,7 +286,7 @@ abstract class ModuleGraphCore extends Module
return call_user_func(array($render, 'hookGraphEngine'), $params, $drawer);
}
protected static function getEmployee($employee = null, $context = null)
protected static function getEmployee($employee = null, Context $context = null)
{
if (!$context)
$context = Context::getContext();
+1 -1
View File
@@ -512,7 +512,7 @@ abstract class ObjectModelCore
return true;
}
static public function displayFieldName($field, $className = __CLASS__, $htmlentities = true, $context = null)
static public function displayFieldName($field, $className = __CLASS__, $htmlentities = true, Context $context = null)
{
global $_FIELDS;
@include(_PS_TRANSLATIONS_DIR_.Context::getContext()->language->iso_code.'/fields.php');
+2 -2
View File
@@ -626,7 +626,7 @@ class OrderCore extends ObjectModel
* @param boolean $showHiddenStatus Display or not hidden order statuses
* @return array Customer orders
*/
static public function getCustomerOrders($id_customer, $showHiddenStatus = false, $context = null)
static public function getCustomerOrders($id_customer, $showHiddenStatus = false, Context $context = null)
{
if (!$context)
$context = Context::getContext();
@@ -685,7 +685,7 @@ class OrderCore extends ObjectModel
'.((int)$limit ? 'LIMIT 0, '.(int)$limit : ''));
}
static public function getOrdersWithInformations($limit = NULL, $context = null)
static public function getOrdersWithInformations($limit = NULL, Context $context = null)
{
if (!$context)
$context = Context::getContext();
+1 -1
View File
@@ -127,7 +127,7 @@ class OrderHistoryCore extends ObjectModel
return new OrderState($id_order_state, Configuration::get('PS_LANG_DEFAULT'));
}
public function addWithemail($autodate = true, $templateVars = false, $context = null)
public function addWithemail($autodate = true, $templateVars = false, Context $context = null)
{
if (!$context)
$context = Context::getContext();
+1 -1
View File
@@ -132,7 +132,7 @@ class OrderReturnCore extends ObjectModel
return (int)($data['total']);
}
static public function getOrdersReturn($customer_id, $order_id = false, $no_denied = false, $context = null)
static public function getOrdersReturn($customer_id, $order_id = false, $no_denied = false, Context $context = null)
{
if (!$context)
$context = Context::getContext();
+1 -1
View File
@@ -476,7 +476,7 @@ class PDFCore extends PDF_PageGroupCore
* @param object $order Order
* @param string $mode Download or display (optional)
*/
public static function invoice($order, $mode = 'D', $multiple = false, &$pdf = NULL, $slip = false, $delivery = false, $context = null)
public static function invoice($order, $mode = 'D', $multiple = false, &$pdf = NULL, $slip = false, $delivery = false, Context $context = null)
{
if (!$context)
$context = Context::getContext();
+12 -12
View File
@@ -288,7 +288,7 @@ class ProductCore extends ObjectModel
),
);
public function __construct($id_product = NULL, $full = false, $id_lang = NULL, $id_shop = NULL, $context = NULL)
public function __construct($id_product = NULL, $full = false, $id_lang = NULL, $id_shop = NULL, Context $context = NULL)
{
parent::__construct($id_product, $id_lang, $id_shop);
if (!$context)
@@ -1421,7 +1421,7 @@ class ProductCore extends ObjectModel
return Product::getProductsProperties((int)$id_lang, $result);
}
static protected function _getProductIdByDate($beginning, $ending, $context = null)
static protected function _getProductIdByDate($beginning, $ending, Context $context = null)
{
if (!$context)
$context = Context::getContext();
@@ -1707,7 +1707,7 @@ class ProductCore extends ObjectModel
*/
public static function getPriceStatic($id_product, $usetax = true, $id_product_attribute = NULL, $decimals = 6, $divisor = NULL, $only_reduc = false,
$usereduc = true, $quantity = 1, $forceAssociatedTax = false, $id_customer = NULL, $id_cart = NULL, $id_address = NULL, &$specificPriceOutput = NULL,
$with_ecotax = TRUE, $context = null)
$with_ecotax = TRUE, Context $context = null)
{
if (!$context)
$context = Context::getContext();
@@ -1908,7 +1908,7 @@ class ProductCore extends ObjectModel
return self::$_prices[$cacheId];
}
public static function convertAndFormatPrice($price, $currency = false, $context = null)
public static function convertAndFormatPrice($price, $currency = false, Context $context = null)
{
if (!$context)
$context = Context::getContext();
@@ -1917,7 +1917,7 @@ class ProductCore extends ObjectModel
return Tools::displayPrice(Tools::convertPrice($price, $currency), $currency);
}
public static function isDiscounted($id_product, $quantity = 1, $context = null)
public static function isDiscounted($id_product, $quantity = 1, Context $context = null)
{
if (!$context)
$context = Context::getContext();
@@ -2081,7 +2081,7 @@ class ProductCore extends ObjectModel
* @param bool $update
* @param Context $context
*/
public function setStock($quantity, $id_product_attribute = 0, $update = false, $context = null)
public function setStock($quantity, $id_product_attribute = 0, $update = false, Context $context = null)
{
if (!$this->id)
return ;
@@ -2157,7 +2157,7 @@ class ProductCore extends ObjectModel
* @param Context $context
* @return int
*/
public function getStock($id_product_attribute = 0, $context = null)
public function getStock($id_product_attribute = 0, Context $context = null)
{
if (!$this->id)
return 0;
@@ -2202,7 +2202,7 @@ class ProductCore extends ObjectModel
return $productObj->addStockMvt(-(int)$product['cart_quantity'], (int)_STOCK_MOVEMENT_ORDER_REASON_, (int)$product['id_product_attribute'], (int)$id_order, NULL);
}
public static function reinjectQuantities(&$orderDetail, $quantity, $context = null)
public static function reinjectQuantities(&$orderDetail, $quantity, Context $context = null)
{
if (!$context)
$context = Context::getContext();
@@ -2749,7 +2749,7 @@ class ProductCore extends ObjectModel
/**
* Get the link of the product page of this product
*/
public function getLink($context = null)
public function getLink(Context $context = null)
{
if (!$context)
$context = Context::getContext();
@@ -2773,7 +2773,7 @@ class ProductCore extends ObjectModel
return Language::getIsoById((int)$id_lang).'-default';
}
public static function getProductProperties($id_lang, $row, $context = null)
public static function getProductProperties($id_lang, $row, Context $context = null)
{
if (!$row['id_product'])
return false;
@@ -2889,7 +2889,7 @@ class ProductCore extends ObjectModel
** Customization management
*/
public static function getAllCustomizedDatas($id_cart, $id_lang = null, $context = null)
public static function getAllCustomizedDatas($id_cart, $id_lang = null, Context $context = null)
{
if (!$context)
$context = Context::getContext();
@@ -3081,7 +3081,7 @@ class ProductCore extends ObjectModel
return Db::getInstance()->ExecuteS('SELECT `id_customization_field`, `type` FROM `'._DB_PREFIX_.'customization_field` WHERE `id_product` = '.(int)($this->id).' AND `required` = 1');
}
public function hasAllRequiredCustomizableFields($context = null)
public function hasAllRequiredCustomizableFields(Context $context = null)
{
if (!$context)
$context = Context::getContext();
+1 -1
View File
@@ -116,7 +116,7 @@ class ProductSaleCore
** @param integer $nbProducts Number of products to return (optional)
** @return array keys : id_product, link_rewrite, name, id_image, legend, sales, ean13, upc, link
*/
static public function getBestSalesLight($id_lang, $pageNumber = 0, $nbProducts = 10, $id_shop = null, $context = null)
static public function getBestSalesLight($id_lang, $pageNumber = 0, $nbProducts = 10, $id_shop = null, Context $context = null)
{
if (!$context)
$context = Context::getContext();
+2 -2
View File
@@ -181,7 +181,7 @@ class SceneCore extends ObjectModel
*
* @return array Products
*/
static public function getScenes($id_category, $id_lang = NULL, $onlyActive = true, $liteResult = true, $hideScenePosition = true, $context = null)
static public function getScenes($id_category, $id_lang = NULL, $onlyActive = true, $liteResult = true, $hideScenePosition = true, Context $context = null)
{
if (!$context)
$context = Context::getContext();
@@ -206,7 +206,7 @@ class SceneCore extends ObjectModel
*
* @return array Products
*/
public function getProducts($onlyActive = true, $id_lang = NULL, $liteResult = true, $context = null)
public function getProducts($onlyActive = true, $id_lang = NULL, $liteResult = true, Context $context = null)
{
if (!$context)
$context = Context::getContext();
+2 -2
View File
@@ -145,7 +145,7 @@ class SearchCore
return $string;
}
public static function find($id_lang, $expr, $pageNumber = 1, $pageSize = 1, $orderBy = 'position', $orderWay = 'desc', $ajax = false, $useCookie = true, $id_shop = false, $context = null)
public static function find($id_lang, $expr, $pageNumber = 1, $pageSize = 1, $orderBy = 'position', $orderWay = 'desc', $ajax = false, $useCookie = true, $id_shop = false, Context $context = null)
{
if (!$context)
$context = Context::getContext();
@@ -532,7 +532,7 @@ class SearchCore
$queryArray3 = array();
}
public static function searchTag($id_lang, $tag, $count = false, $pageNumber = 0, $pageSize = 10, $orderBy = false, $orderWay = false, $useCookie = true, $shops = null, $context = null)
public static function searchTag($id_lang, $tag, $count = false, $pageNumber = 0, $pageSize = 10, $orderBy = false, $orderWay = false, $useCookie = true, $shops = null, Context $context = null)
{
if (!$context)
$context = Context::getContext();
+1 -1
View File
@@ -78,7 +78,7 @@ class TabCore extends ObjectModel
return false;
}
static public function initAccess($id_tab, $context = null)
static public function initAccess($id_tab, Context $context = null)
{
if (!$context)
$context = Context::getContext();
+1 -1
View File
@@ -161,7 +161,7 @@ class TagCore extends ObjectModel
return $result;
}
public function getProducts($associated = true, $context = null)
public function getProducts($associated = true, Context $context = null)
{
if (!$context)
$context = Context::getContext();
+12 -12
View File
@@ -55,7 +55,7 @@ class ToolsCore
* @param string $url Desired URL
* @param string $baseUri Base URI (optional)
*/
public static function redirect($url, $baseUri = __PS_BASE_URI__, $context = null)
public static function redirect($url, $baseUri = __PS_BASE_URI__, Context $context = null)
{
if (strpos($url, 'http://') === FALSE && strpos($url, 'https://') === FALSE)
{
@@ -304,7 +304,7 @@ class ToolsCore
return $iso;
}
public static function switchLanguage($context = null)
public static function switchLanguage(Context $context = null)
{
if (!$context)
$context = Context::getContext();
@@ -341,7 +341,7 @@ class ToolsCore
* @param object $currency Current currency (object, id_currency, NULL => context currency)
* @return string Price correctly formated (sign, decimal separator...)
*/
public static function displayPrice($price, $currency = NULL, $no_utf8 = false, $context = null)
public static function displayPrice($price, $currency = NULL, $no_utf8 = false, Context $context = null)
{
if (!$context)
$context = Context::getContext();
@@ -403,7 +403,7 @@ class ToolsCore
* @param object $currency Current currency object
* @param boolean $to_currency convert to currency or from currency to default currency
*/
public static function convertPrice($price, $currency = NULL, $to_currency = true, $context = null)
public static function convertPrice($price, $currency = NULL, $to_currency = true, Context $context = null)
{
if (!$context)
$context = Context::getContext();
@@ -525,7 +525,7 @@ class ToolsCore
*
* @param integer $code Error code
*/
public static function displayError($string = 'Fatal error', $htmlentities = true, $context = null)
public static function displayError($string = 'Fatal error', $htmlentities = true, Context $context = null)
{
global $_ERRORS;
@@ -720,7 +720,7 @@ class ToolsCore
}
public static function completeMetaTags($metaTags, $defaultValue, $context = null)
public static function completeMetaTags($metaTags, $defaultValue, Context $context = null)
{
if (!$context)
$context = Context::getContext();
@@ -749,7 +749,7 @@ class ToolsCore
*
* @param string $token token to encrypt
*/
public static function getToken($page = true, $context = null)
public static function getToken($page = true, Context $context = null)
{
if (!$context)
$context = Context::getContext();
@@ -768,7 +768,7 @@ class ToolsCore
{
return !empty($string) ? self::encrypt($string) : false;
}
public static function getAdminTokenLite($tab, $context = null)
public static function getAdminTokenLite($tab, Context $context = null)
{
if (!$context)
$context = Context::getContext();
@@ -783,7 +783,7 @@ class ToolsCore
* @param boolean $linkOntheLastItem Put or not a link on the current category
* @param string [optionnal] $categoryType defined what type of categories is used (products or cms)
*/
public static function getPath($id_category, $path = '', $linkOntheLastItem = false, $categoryType = 'products', $context = null)
public static function getPath($id_category, $path = '', $linkOntheLastItem = false, $categoryType = 'products', Context $context = null)
{
if (!$context)
$context = Context::getContext();
@@ -847,7 +847,7 @@ class ToolsCore
/**
* @param string [optionnal] $type_cat defined what type of categories is used (products or cms)
*/
public static function getFullPath($id_category, $end, $type_cat = 'products', $context = null)
public static function getFullPath($id_category, $end, $type_cat = 'products', Context $context = null)
{
if (!$context)
$context = Context::getContext();
@@ -1855,7 +1855,7 @@ FileETag INode MTime Size
}
}
public static function enableCache($level = 1, $context = null)
public static function enableCache($level = 1, Context $context = null)
{
if (!$context)
$context = Context::getContext();
@@ -1870,7 +1870,7 @@ FileETag INode MTime Size
$smarty->caching = (int)($level);
}
public static function restoreCacheSettings($context = null)
public static function restoreCacheSettings(Context $context = null)
{
if (!$context)
$context = Context::getContext();
+7 -11
View File
@@ -65,15 +65,13 @@ class authorizeAIM extends PaymentModule
public function hookOrderConfirmation($params)
{
$context = Context::getContext();
if ($params['objOrder']->module != $this->name)
return;
if ($params['objOrder']->getCurrentState() != _PS_OS_ERROR_)
$context->smarty->assign(array('status' => 'ok', 'id_order' => intval($params['objOrder']->id)));
$this->context->smarty->assign(array('status' => 'ok', 'id_order' => intval($params['objOrder']->id)));
else
$context->smarty->assign('status', 'failed');
$this->context->smarty->assign('status', 'failed');
return $this->display(__FILE__, 'hookorderconfirmation.tpl');
}
@@ -135,8 +133,6 @@ class authorizeAIM extends PaymentModule
public function hookPayment($params)
{
$context = Context::getContext();
if (!empty($_SERVER['HTTPS']) AND strtolower($_SERVER['HTTPS']) != 'off' AND Configuration::get('PS_SSL_ENABLED'))
{
$invoiceAddress = new Address((int)$params['cart']->id_address_invoice);
@@ -156,8 +152,8 @@ class authorizeAIM extends PaymentModule
$authorizeAIMParams['x_amount'] = number_format($params['cart']->getOrderTotal(true, 3), 2, '.', '');
$authorizeAIMParams['x_address'] = $invoiceAddress->address1.' '.$invoiceAddress->address2;
$authorizeAIMParams['x_zip'] = $invoiceAddress->postcode;
$authorizeAIMParams['x_first_name'] = $context->customer->firstname;
$authorizeAIMParams['x_last_name'] = $context->customer->lastname;
$authorizeAIMParams['x_first_name'] = $this->context->customer->firstname;
$authorizeAIMParams['x_last_name'] = $this->context->customer->lastname;
$isFailed = Tools::getValue('aimerror');
@@ -167,9 +163,9 @@ class authorizeAIM extends PaymentModule
$cards['discover'] = Configuration::get('AUTHORIZE_AIM_CARD_DISCOVER') == 'on' ? 1 : 0;
$cards['ax'] = Configuration::get('AUTHORIZE_AIM_CARD_AX') == 'on' ? 1 : 0;
$context->smarty->assign('p', $authorizeAIMParams);
$context->smarty->assign('cards', $cards);
$context->smarty->assign('isFailed', $isFailed);
$this->context->smarty->assign('p', $authorizeAIMParams);
$this->context->smarty->assign('cards', $cards);
$this->context->smarty->assign('isFailed', $isFailed);
return $this->display(__FILE__, 'authorizeaim.tpl');
}
+1 -3
View File
@@ -49,8 +49,6 @@ class BirthdayPresent extends Module
public function getContent()
{
$context = Context::getContext();
if (Tools::isSubmit('submitBirthday'))
{
Configuration::updateValue('BIRTHDAY_ACTIVE', (int)(Tools::getValue('bp_active')));
@@ -73,7 +71,7 @@ class BirthdayPresent extends Module
<label>'.$this->l('Type').'</label>
<div class="margin-form">
<select name="id_discount_type">';
$discountTypes = Discount::getDiscountTypes($context->language->id);
$discountTypes = Discount::getDiscountTypes($this->context->language->id);
foreach ($discountTypes AS $discountType)
$this->_html .= '<option value="'.(int)($discountType['id_discount_type']).'"'.((Configuration::get('BIRTHDAY_DISCOUNT_TYPE') == $discountType['id_discount_type']) ? ' selected="selected"' : '').'>'.$discountType['name'].'</option>';
$this->_html .= '
@@ -78,8 +78,7 @@ class BlockPermanentLinks extends Module
function hookHeader($params)
{
$context = Context::getContext();
$context->controller->addCSS(($this->_path).'blockpermanentlinks.css', 'all');
$this->context->controller->addCSS(($this->_path).'blockpermanentlinks.css', 'all');
}
}
+2 -2
View File
@@ -115,7 +115,7 @@ class Criteo extends Module
}
}
public static function buildCSV($context = null)
public static function buildCSV(Context $context = null)
{
if (!$context)
$context = Context::getContext();
@@ -184,7 +184,7 @@ class Criteo extends Module
echo $html;
}
public static function buildXML($context = null)
public static function buildXML(Context $context = null)
{
global $country_infos;
if (!$context)
+1 -2
View File
@@ -313,7 +313,6 @@ class Editorial extends Module
public function hookHeader()
{
$context = Context::getContext();
$context->controller->addCSS(($this->_path).'editorial.css', 'all');
$this->context->controller->addCSS(($this->_path).'editorial.css', 'all');
}
}
+8 -12
View File
@@ -140,10 +140,8 @@ XML;
* @param string $filename
* @return bool
*/
private function generateSitemap($shopID, $filename = '', $replaceUrl = array(), $context = null)
private function generateSitemap($shopID, $filename = '', $replaceUrl = array())
{
if (!$context)
$context = Context::getContext();
$langs = Language::getLanguages();
$shop = new Shop($shopID);
if (!$shop->id)
@@ -186,7 +184,7 @@ XML;
$cmss = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS($sql);
foreach ($cmss AS $cms)
{
$tmpLink = Configuration::get('PS_REWRITING_SETTINGS') ? $context->link->getCMSLink((int)$cms['id_cms'], $cms['link_rewrite'], false, (int)$cms['id_lang']) : $context->link->getCMSLink((int)$cms['id_cms']);
$tmpLink = Configuration::get('PS_REWRITING_SETTINGS') ? $this->context->link->getCMSLink((int)$cms['id_cms'], $cms['link_rewrite'], false, (int)$cms['id_lang']) : $this->context->link->getCMSLink((int)$cms['id_cms']);
$this->_addSitemapNode($xml, $tmpLink, '0.8', 'daily');
}
@@ -221,7 +219,7 @@ XML;
if (($priority = 0.9 - ($category['level_depth'] / 10)) < 0.1)
$priority = 0.1;
$tmpLink = Configuration::get('PS_REWRITING_SETTINGS') ? $context->link->getCategoryLink((int)$category['id_category'], $category['link_rewrite'], (int)$category['id_lang']) : $context->link->getCategoryLink((int)$category['id_category']);
$tmpLink = Configuration::get('PS_REWRITING_SETTINGS') ? $this->context->link->getCategoryLink((int)$category['id_category'], $category['link_rewrite'], (int)$category['id_lang']) : $this->context->link->getCategoryLink((int)$category['id_category']);
$this->_addSitemapNode($xml, $tmpLink, $priority, 'weekly', substr($category['date_upd'], 0, 10));
}
@@ -250,7 +248,7 @@ XML;
if (($priority = 0.7 - ($product['level_depth'] / 10)) < 0.1)
$priority = 0.1;
$tmpLink = $context->link->getProductLink((int)($product['id_product']), $product['link_rewrite'], $product['category'], $product['ean13'], (int)($product['id_lang']));
$tmpLink = $this->context->link->getProductLink((int)($product['id_product']), $product['link_rewrite'], $product['category'], $product['ean13'], (int)($product['id_lang']));
$sitemap = $this->_addSitemapNode($xml, $tmpLink, $priority, 'weekly', substr($product['date_upd'], 0, 10));
$sitemap = $this->_addSitemapNodeImage($sitemap, $product);
}
@@ -279,10 +277,10 @@ XML;
if(Configuration::get('PS_REWRITING_SETTINGS'))
foreach ($pages AS $page => $ssl)
foreach($langs as $lang)
$this->_addSitemapNode($xml, $context->link->getPageLink($page, $ssl, $lang['id_lang']), '0.5', 'monthly');
$this->_addSitemapNode($xml, $this->context->link->getPageLink($page, $ssl, $lang['id_lang']), '0.5', 'monthly');
else
foreach($pages AS $page => $ssl)
$this->_addSitemapNode($xml, $context->link->getPageLink($page, $ssl), '0.5', 'monthly');
$this->_addSitemapNode($xml, $this->context->link->getPageLink($page, $ssl), '0.5', 'monthly');
$xmlString = $xml->asXML();
@@ -316,12 +314,10 @@ XML;
return $sitemap;
}
private function _addSitemapNodeImage($xml, $product, $context = null)
private function _addSitemapNodeImage($xml, $product)
{
if (!$context)
$context = Context::getContext();
$image = $xml->addChild('image', null, 'http://www.google.com/schemas/sitemap-image/1.1');
$image->addChild('loc', htmlspecialchars($context->link->getImageLink($product['link_rewrite'], (int)$product['id_product'].'-'.(int)$product['id_image'])), 'http://www.google.com/schemas/sitemap-image/1.1');
$image->addChild('loc', htmlspecialchars($this->context->link->getImageLink($product['link_rewrite'], (int)$product['id_product'].'-'.(int)$product['id_image'])), 'http://www.google.com/schemas/sitemap-image/1.1');
$legend_image = preg_replace('/(&+)/i', '&amp;', $product['legend_image']);
$image->addChild('caption', $legend_image, 'http://www.google.com/schemas/sitemap-image/1.1');
+4 -7
View File
@@ -318,20 +318,17 @@ class MailAlerts extends Module
$this->sendCustomerAlert((int)$result['id_product'], (int)$params['id_product_attribute']);
}
public function sendCustomerAlert($id_product, $id_product_attribute, $context = null)
public function sendCustomerAlert($id_product, $id_product_attribute)
{
if (!$context)
$context = Context::getContext();
$customers = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('
SELECT id_customer, customer_email
FROM `'._DB_PREFIX_.'mailalert_customer_oos`
WHERE `id_product` = '.(int)$id_product.' AND `id_product_attribute` = '.(int)$id_product_attribute);
$product = new Product((int)$id_product, false, (int)$context->language->id);
$product = new Product((int)$id_product, false, $this->context->language->id);
$templateVars = array(
'{product}' => (is_array($product->name) ? $product->name[(int)Configuration::get('PS_LANG_DEFAULT')] : $product->name),
'{product_link}' => $context->link->getProductLink($product)
'{product_link}' => $this->context->link->getProductLink($product)
);
foreach ($customers AS $cust)
{
@@ -346,7 +343,7 @@ class MailAlerts extends Module
$customer_email = $cust['customer_email'];
$customer_id = 0;
}
$iso = $context->language->iso_code;
$iso = $this->context->language->iso_code;
if (file_exists(dirname(__FILE__).'/mails/'.$iso.'/customer_qty.txt') AND file_exists(dirname(__FILE__).'/mails/'.$iso.'/customer_qty.html'))
Mail::Send((int)(Configuration::get('PS_LANG_DEFAULT')), 'customer_qty', Mail::l('Product available'), $templateVars, strval($customer_email), NULL, strval(Configuration::get('PS_SHOP_EMAIL')), strval(Configuration::get('PS_SHOP_NAME')), NULL, NULL, dirname(__FILE__).'/mails/');
@@ -176,8 +176,7 @@ class productsCategory extends Module
public function hookHeader($params)
{
$context = Context::getContext();
$context->controller->addCSS($this->_path.'productscategory.css', 'all');
$context->controller->addJS(array($this->_path.'productscategory.js', _PS_JS_DIR_.'jquery/jquery.serialScroll-1.2.2-min.js'));
$this->context->controller->addCSS($this->_path.'productscategory.css', 'all');
$this->context->controller->addJS(array($this->_path.'productscategory.js', _PS_JS_DIR_.'jquery/jquery.serialScroll-1.2.2-min.js'));
}
}
@@ -426,7 +426,7 @@ class ThemeInstallator extends Module
$hookedModule = array();
$position = array();
$msg = '';
$shopID = Context::getContext()->shop->getID();
$shopID = $this->context->shop->getID();
foreach ($this->xml->modules->hooks->hook as $row)
{