// Fix PrestaShopException typo

This commit is contained in:
rMalie
2012-01-04 13:53:19 +00:00
parent 1ad456ad41
commit 4b17d64cf7
36 changed files with 96 additions and 86 deletions
+1 -1
View File
@@ -325,7 +325,7 @@ class AddressCore extends ObjectModel
$address = new Address((int)$id_address);
if (!Validate::isLoadedObject($address))
throw new PrestashopException('Invalid address');
throw new PrestaShopException('Invalid address');
}
return $address;
+2 -2
View File
@@ -1941,7 +1941,7 @@ class AdminControllerCore extends Controller
}
if (!Validate::isTableOrIdentifier($this->table))
throw new PrestashopException(sprintf('Table name %s is invalid:', $this->table));
throw new PrestaShopException(sprintf('Table name %s is invalid:', $this->table));
if (empty($order_by))
$order_by = $this->context->cookie->__get($this->table.'Orderby') ? $this->context->cookie->__get($this->table.'Orderby') : $this->_defaultOrderBy;
@@ -1955,7 +1955,7 @@ class AdminControllerCore extends Controller
if (!Validate::isOrderBy($order_by) || !Validate::isOrderWay($order_way)
|| !is_numeric($start) || !is_numeric($limit)
|| !Validate::isUnsignedId($id_lang))
throw new PrestashopException('get list params is not valid');
throw new PrestaShopException('get list params is not valid');
/* Determine offset from current page */
if ((isset($_POST['submitFilter'.$this->table]) ||
+2 -2
View File
@@ -162,7 +162,7 @@ class CategoryCore extends ObjectModel
public function update($nullValues = false)
{
if ($this->id_parent == $this->id)
throw new PrestashopException('a category cannot be it\'s own parent');
throw new PrestaShopException('a category cannot be it\'s own parent');
// Update group selection
$this->updateGroup($this->groupBox);
$this->level_depth = $this->calcLevelDepth();
@@ -395,7 +395,7 @@ class CategoryCore extends ObjectModel
public function recalculateLevelDepth($id_category)
{
if (!is_numeric($id_category))
throw new PrestashopException('id category is not numeric');
throw new PrestaShopException('id category is not numeric');
/* Gets all children */
$categories = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
SELECT id_category, id_parent, level_depth
+1 -1
View File
@@ -188,7 +188,7 @@ class ConfigurationCore extends ObjectModel
static public function getMultiple($keys, $langID = NULL, $shopGroupID = NULL, $shopID = NULL)
{
if (!is_array($keys))
throw new PrestashopException('keys var is not an array');
throw new PrestaShopException('keys var is not an array');
$langID = (int)$langID;
self::getShopFromContext($shopGroupID, $shopID);
+1 -1
View File
@@ -342,7 +342,7 @@ class DispatcherCore
{
Controller::getController($controller_class)->run();
}
catch (PrestashopException $e)
catch (PrestaShopException $e)
{
$e->displayMessage();
}
+2 -2
View File
@@ -105,7 +105,7 @@ class HookCore extends ObjectModel
public static function getIdByName($hook_name)
{
if (!Validate::isHookName($hook_name))
throw new PrestashopException('Invalid hook name');
throw new PrestaShopException('Invalid hook name');
$cache_id = 'hook_idbyname_'.$hook_name;
if (!Cache::isStored($cache_id))
@@ -321,7 +321,7 @@ class HookCore extends ObjectModel
// Check arguments validity
$context = Context::getContext();
if (($id_module && !Validate::isUnsignedId($id_module)) || !Validate::isHookName($hook_name))
throw new PrestashopException('Invalid id_module or hook_name');
throw new PrestaShopException('Invalid id_module or hook_name');
// Check if hook exists
if (!$id_hook = Hook::getIdByName($hook_name))
+1 -1
View File
@@ -91,7 +91,7 @@ class LinkCore
else if(is_numeric($product))
$product = new Product((int)$product, false, $id_lang);
else
throw new PrestashopException('Invalid product vars');
throw new PrestaShopException('Invalid product vars');
}
// Set available keywords
+2 -2
View File
@@ -584,7 +584,7 @@ abstract class ModuleCore
{
// Check hook name validation and if module is installed
if (!Validate::isHookName($hook_name))
throw new PrestashopException('Invalid hook name');
throw new PrestaShopException('Invalid hook name');
if (!isset($this->id) || !is_numeric($this->id))
return false;
@@ -1073,7 +1073,7 @@ abstract class ModuleCore
if (is_dir(_PS_MODULE_DIR_.$name) && Tools::file_exists_cache(_PS_MODULE_DIR_.$name.'/'.$name.'.php'))
{
if (!Validate::isModuleName($name))
throw new PrestashopException(sprintf('Module %s is not a valid module name', $name));
throw new PrestaShopException(sprintf('Module %s is not a valid module name', $name));
$moduleList[] = $name;
}
}
+27 -17
View File
@@ -165,7 +165,7 @@ abstract class ObjectModelCore
$this->id_shop = Context::getContext()->shop->getID(true);
if (!Validate::isTableOrIdentifier($this->def['primary']) || !Validate::isTableOrIdentifier($this->def['table']))
throw new PrestashopException('Identifier or table format not valid for class '.get_class($this));
throw new PrestaShopException('Identifier or table format not valid for class '.get_class($this));
if ($id)
{
@@ -403,7 +403,7 @@ abstract class ObjectModelCore
{
foreach (array_keys($field) AS $key)
if (!Validate::isTableOrIdentifier($key))
throw new PrestashopException('key '.$key.' is not table or identifier, ');
throw new PrestaShopException('key '.$key.' is not table or identifier, ');
$field[$this->def['primary']] = (int)$this->id;
if (isset($assos[$this->def['table'].'_lang']) && $assos[$this->def['table'].'_lang']['type'] == 'fk_shop')
@@ -470,7 +470,7 @@ abstract class ObjectModelCore
{
foreach (array_keys($field) as $key)
if (!Validate::isTableOrIdentifier($key))
throw new PrestashopException('key '.$key.' is not a valid table or identifier');
throw new PrestaShopException('key '.$key.' is not a valid table or identifier');
// If this table is linked to multishop system, update / insert for all shops from context
if ($this->isLangMultishop())
@@ -570,7 +570,7 @@ abstract class ObjectModelCore
{
// Object must have a variable called 'active'
if (!array_key_exists('active', $this))
throw new PrestashopException('property "active is missing in object '.get_class($this));
throw new PrestaShopException('property "active is missing in object '.get_class($this));
// Update active status on object
$this->active = !(int)$this->active;
@@ -620,7 +620,7 @@ abstract class ObjectModelCore
/* Check fields validity */
if (!Validate::isTableOrIdentifier($fieldName))
throw new PrestashopException('identifier is not table or identifier : '.$fieldName);
throw new PrestaShopException('identifier is not table or identifier : '.$fieldName);
/* Copy the field, or the default language field if it's both required and empty */
if ((!$this->id_lang && isset($this->{$fieldName}[$id_language]) && !empty($this->{$fieldName}[$id_language]))
@@ -651,7 +651,7 @@ abstract class ObjectModelCore
if ($message !== true)
{
if ($die)
throw new PrestashopException($message);
throw new PrestaShopException($message);
return $error_return ? $message : false;
}
}
@@ -683,7 +683,7 @@ abstract class ObjectModelCore
if ($message !== true)
{
if ($die)
throw new PrestashopException($message);
throw new PrestaShopException($message);
return $error_return ? $message : false;
}
}
@@ -728,7 +728,7 @@ abstract class ObjectModelCore
if (!empty($data['validate']))
{
if (!method_exists('Validate', $data['validate']))
throw new PrestashopException('Validation function not found. '.$data['validate']);
throw new PrestaShopException('Validation function not found. '.$data['validate']);
if (!empty($value) && !call_user_func(array('Validate', $data['validate']), $value))
return 'Property '.get_class($this).'->'.$field.' is not valid';
@@ -1164,7 +1164,7 @@ abstract class ObjectModelCore
public static function hydrateCollection($class, array $datas, $id_lang = null)
{
if (!class_exists($class))
throw new PrestashopException("Class '$class' not found");
throw new PrestaShopException("Class '$class' not found");
$collection = array();
$rows = array();
@@ -1172,7 +1172,7 @@ abstract class ObjectModelCore
{
$definition = ObjectModel::getDefinition($class);
if (!array_key_exists($definition['primary'], $datas[0]))
throw new PrestashopException("Identifier '{$definition['primary']}' not found for class '$class'");
throw new PrestaShopException("Identifier '{$definition['primary']}' not found for class '$class'");
foreach ($datas as $row)
{
@@ -1203,10 +1203,25 @@ abstract class ObjectModelCore
return $collection;
}
/**
* Get object definition
*
* @param string $class Name of object
* @param string $field Name of field if we want the definition of one field only
* @return array
*/
public static function getDefinition($class, $field = null)
{
$reflection = new ReflectionClass($class);
$definition = $reflection->getStaticPropertyValue('definition');
$definition['classname'] = $class;
if (!empty($definition['multilang']))
$definition['associations'][Collection::LANG_ALIAS] = array(
'type' => self::HAS_MANY,
'field' => $definition['primary'],
'foreign_field' => $definition['primary'],
);
if ($field)
return isset($definition['fields'][$field]) ? $definition['fields'][$field] : null;
return $definition;
@@ -1263,18 +1278,13 @@ abstract class ObjectModelCore
}
}
public function getEntity($entity)
{
}
/**
* Return the field value for the specified language if the field is multilang, else the field value.
*
* @param $field_name
* @param null $id_lang
* @return mixed
* @throws PrestashopException
* @throws PrestaShopException
* @since 1.5
*/
public function getFieldByLang($field_name, $id_lang = null)
@@ -1293,6 +1303,6 @@ abstract class ObjectModelCore
return $this->{$field_name};
}
else
throw new PrestashopException('Could not load field from definition.');
throw new PrestaShopException('Could not load field from definition.');
}
}
+2 -2
View File
@@ -132,7 +132,7 @@ abstract class PaymentModuleCore extends Module
$order_status = new OrderState((int)$id_order_state, (int)$cart->id_lang);
if (!Validate::isLoadedObject($order_status))
throw new PrestashopException('Can\'t load Order state status');
throw new PrestaShopException('Can\'t load Order state status');
foreach ($cart_delivery_option as $id_address => $key_carriers)
foreach ($delivery_option_list[$id_address][$key_carriers]['carrier_list'] as $id_carrier => $data)
@@ -202,7 +202,7 @@ abstract class PaymentModuleCore extends Module
if ($result && $order_status->logable)
{
if (!$order->addOrderPayment($amountPaid))
throw new PrestashopException('Can\'t save Order Payment');
throw new PrestaShopException('Can\'t save Order Payment');
}
$order_list[] = $order;
+1 -1
View File
@@ -576,7 +576,7 @@ class ToolsCore
return '';
if (!Validate::isDate($date) || !Validate::isBool($full))
throw new PrestashopException('Invalid date');
throw new PrestaShopException('Invalid date');
$context = Context::getContext();
$date_format = ($full ? $context->language->date_format_full : $context->language->date_format_lite);
+5 -5
View File
@@ -281,7 +281,7 @@ abstract class DbCore
{
// Check if row array mapping are the same
if (!in_array("`$key`", $keys))
throw new PrestashopDatabaseException('Keys form $data subarray don\'t match');
throw new PrestaShopDatabaseException('Keys form $data subarray don\'t match');
}
else
$keys[] = "`$key`";
@@ -323,7 +323,7 @@ abstract class DbCore
return (bool)$this->q($sql, $use_cache);
}
else
throw new PrestashopDatabaseException('Wrong argument (miss type) in Db::autoExecute()');
throw new PrestaShopDatabaseException('Wrong argument (miss type) in Db::autoExecute()');
return false;
}
@@ -414,7 +414,7 @@ abstract class DbCore
if (!preg_match('#^\s*(select|show|explain|describe)\s#i', $sql))
{
if (defined('_PS_MODE_DEV_') && _PS_MODE_DEV_)
throw new PrestashopDatabaseException('Db->executeS() must be used only with select, show, explain or describe queries');
throw new PrestaShopDatabaseException('Db->executeS() must be used only with select, show, explain or describe queries');
return $this->execute($sql, $use_cache);
}
@@ -546,8 +546,8 @@ abstract class DbCore
else if (_PS_DEBUG_SQL_ && $errno && !defined('PS_INSTALLATION_IN_PROGRESS'))
{
if ($sql)
throw new PrestashopDatabaseException($this->getMsgError().'<br /><br /><pre>'.$sql.'</pre>');
throw new PrestashopDatabaseException($this->getMsgError());
throw new PrestaShopDatabaseException($this->getMsgError().'<br /><br /><pre>'.$sql.'</pre>');
throw new PrestaShopDatabaseException($this->getMsgError());
}
}
+2 -2
View File
@@ -39,11 +39,11 @@ class DbMySQLiCore extends Db
// Do not use object way for error because this work bad before PHP 5.2.9
if (mysqli_connect_error())
throw new PrestashopDatabaseException(Tools::displayError('Link to database cannot be established : '.mysqli_connect_error()));
throw new PrestaShopDatabaseException(Tools::displayError('Link to database cannot be established : '.mysqli_connect_error()));
// UTF-8 support
if (!$this->link->query('SET NAMES \'utf8\''))
throw new PrestashopDatabaseException(Tools::displayError('PrestaShop Fatal error: no utf-8 support. Please check your server configuration.'));
throw new PrestaShopDatabaseException(Tools::displayError('PrestaShop Fatal error: no utf-8 support. Please check your server configuration.'));
return $this->link;
}
+2 -2
View File
@@ -43,12 +43,12 @@ class DbPDOCore extends Db
}
catch (PDOException $e)
{
throw new PrestashopDatabaseException(Tools::displayError('Link to database cannot be established. ('.$e->getMessage().')'));
throw new PrestaShopDatabaseException(Tools::displayError('Link to database cannot be established. ('.$e->getMessage().')'));
}
// UTF-8 support
if ($this->link->exec('SET NAMES \'utf8\'') === false)
throw new PrestashopDatabaseException(Tools::displayError('PrestaShop Fatal error: no utf-8 support. Please check your server configuration.'));
throw new PrestaShopDatabaseException(Tools::displayError('PrestaShop Fatal error: no utf-8 support. Please check your server configuration.'));
return $this->link;
}
+3 -3
View File
@@ -36,14 +36,14 @@ class MySQLCore extends Db
define('_PS_MYSQL_REAL_ESCAPE_STRING_', function_exists('mysql_real_escape_string'));
if (!$this->link = mysql_connect($this->server, $this->user, $this->password))
throw new PrestashopDatabaseException(Tools::displayError('Link to database cannot be established.'));
throw new PrestaShopDatabaseException(Tools::displayError('Link to database cannot be established.'));
if (!$this->set_db($this->database))
throw new PrestashopDatabaseException(Tools::displayError('The database selection cannot be made.'));
throw new PrestaShopDatabaseException(Tools::displayError('The database selection cannot be made.'));
// UTF-8 support
if (!mysql_query('SET NAMES \'utf8\'', $this->link))
throw new PrestashopDatabaseException(Tools::displayError('PrestaShop Fatal error: no utf-8 support. Please check your server configuration.'));
throw new PrestaShopDatabaseException(Tools::displayError('PrestaShop Fatal error: no utf-8 support. Please check your server configuration.'));
return $this->link;
}
@@ -28,7 +28,7 @@
/**
* @since 1.5.0
*/
class PrestashopDatabaseExceptionCore extends PrestashopException
class PrestaShopDatabaseExceptionCore extends PrestaShopException
{
}
+1 -1
View File
@@ -28,7 +28,7 @@
/**
* @since 1.5.0
*/
class PrestashopExceptionCore extends Exception
class PrestaShopExceptionCore extends Exception
{
/**
* This method acts like an error handler, if dev mode is on, display the error else use a better silent way
@@ -28,7 +28,7 @@
/**
* @since 1.5.0
*/
class PrestashopModuleExceptionCore extends PrestashopException
class PrestaShopModuleExceptionCore extends PrestaShopException
{
}
@@ -28,7 +28,7 @@
/**
* @since 1.5.0
*/
class PrestashopPaymentExceptionCore extends PrestashopException
class PrestaShopPaymentExceptionCore extends PrestaShopException
{
}
+1 -1
View File
@@ -1131,7 +1131,7 @@ class OrderCore extends ObjectModel
{
$number = (int)Configuration::get('PS_DELIVERY_NUMBER');
if (!$number)
throw new PrestashopException('Invalid delivery number');
throw new PrestaShopException('Invalid delivery number');
// Set delivery number on invoice
$order_invoice->delivery_number = $number;
+1 -1
View File
@@ -514,7 +514,7 @@ class OrderInvoiceCore extends ObjectModel
{
$order_invoice = new OrderInvoice($id);
if (!Validate::isLoadedObject($order_invoice))
throw new PrestashopException('Can\'t load Order Invoice object for id: '.$id);
throw new PrestaShopException('Can\'t load Order Invoice object for id: '.$id);
return $order_invoice;
}
+1 -1
View File
@@ -93,7 +93,7 @@ class PDFCore
{
$class = new $classname($object, $this->smarty);
if (!($class instanceof HTMLTemplate))
throw new PrestashopException('Invalid class. It should be an instance of HTMLTemplate');
throw new PrestaShopException('Invalid class. It should be an instance of HTMLTemplate');
}
return $class;
+2 -2
View File
@@ -122,12 +122,12 @@ class PDFGeneratorCore extends TCPDF
*
* @param string $filename
* @param boolean $inline
* @throws PrestashopException
* @throws PrestaShopException
*/
public function render($filename, $display = true)
{
if (empty($filename))
throw new PrestashopException('Missing filename.');
throw new PrestaShopException('Missing filename.');
$this->lastPage();
+2 -2
View File
@@ -283,7 +283,7 @@ class ShopCore extends ObjectModel
$default_shop = new Shop(Configuration::get('PS_SHOP_DEFAULT'));
// Hmm there is something really bad in your Prestashop !
if (!Validate::isLoadedObject($default_shop))
throw new PrestashopException('Shop not found');
throw new PrestaShopException('Shop not found');
$url = 'http://'.$default_shop->domain.$default_shop->getBaseURI().ltrim($_SERVER['SCRIPT_NAME'], '/').'?'.$_SERVER['QUERY_STRING'];
header('location: '.$url);
@@ -294,7 +294,7 @@ class ShopCore extends ObjectModel
if (defined('INSTALL_VERSION'))
$shop = new Shop();
else
throw new PrestashopException('Shop not found');
throw new PrestaShopException('Shop not found');
return $shop;
}