forked from Qloapps/QloApps
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9,331 changed files
with
924,618 additions
and
29 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
<?php | ||
/** | ||
* 2007-2015 PrestaShop | ||
* | ||
* NOTICE OF LICENSE | ||
* | ||
* This source file is subject to the Open Software License (OSL 3.0) | ||
* that is bundled with this package in the file LICENSE.txt. | ||
* It is also available through the world-wide-web at this URL: | ||
* http://opensource.org/licenses/osl-3.0.php | ||
* If you did not receive a copy of the license and are unable to | ||
* obtain it through the world-wide-web, please send an email | ||
* to [email protected] so we can send you a copy immediately. | ||
* | ||
* DISCLAIMER | ||
* | ||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer | ||
* versions in the future. If you wish to customize PrestaShop for your | ||
* needs please refer to http://www.prestashop.com for more information. | ||
* | ||
* @author PrestaShop SA <[email protected]> | ||
* @copyright 2007-2015 PrestaShop SA | ||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) | ||
* International Registered Trademark & Property of PrestaShop SA | ||
*/ | ||
|
||
class Adapter_AddressFactory | ||
{ | ||
/** | ||
* Initilize an address corresponding to the specified id address or if empty to the | ||
* default shop configuration | ||
* @param null $id_address | ||
* @param bool $with_geoloc | ||
* @return Address | ||
*/ | ||
public function findOrCreate($id_address = null, $with_geoloc = false) | ||
{ | ||
$func_args = func_get_args(); | ||
return call_user_func_array(array('Address', 'initialize'), $func_args); | ||
} | ||
|
||
/** | ||
* Check if an address exists depending on given $id_address | ||
* @param $id_address | ||
* @return bool | ||
*/ | ||
public function addressExists($id_address) | ||
{ | ||
return Address::addressExists($id_address); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
<?php | ||
/** | ||
* 2007-2015 PrestaShop | ||
* | ||
* NOTICE OF LICENSE | ||
* | ||
* This source file is subject to the Open Software License (OSL 3.0) | ||
* that is bundled with this package in the file LICENSE.txt. | ||
* It is also available through the world-wide-web at this URL: | ||
* http://opensource.org/licenses/osl-3.0.php | ||
* If you did not receive a copy of the license and are unable to | ||
* obtain it through the world-wide-web, please send an email | ||
* to [email protected] so we can send you a copy immediately. | ||
* | ||
* DISCLAIMER | ||
* | ||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer | ||
* versions in the future. If you wish to customize PrestaShop for your | ||
* needs please refer to http://www.prestashop.com for more information. | ||
* | ||
* @author PrestaShop SA <[email protected]> | ||
* @copyright 2007-2015 PrestaShop SA | ||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) | ||
* International Registered Trademark & Property of PrestaShop SA | ||
*/ | ||
|
||
class Adapter_CacheManager | ||
{ | ||
/** | ||
* Cleans the cache for specific cache key. | ||
* | ||
* @param $key | ||
*/ | ||
public function clean($key) | ||
{ | ||
Cache::clean($key); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
<?php | ||
/** | ||
* 2007-2015 PrestaShop | ||
* | ||
* NOTICE OF LICENSE | ||
* | ||
* This source file is subject to the Open Software License (OSL 3.0) | ||
* that is bundled with this package in the file LICENSE.txt. | ||
* It is also available through the world-wide-web at this URL: | ||
* http://opensource.org/licenses/osl-3.0.php | ||
* If you did not receive a copy of the license and are unable to | ||
* obtain it through the world-wide-web, please send an email | ||
* to [email protected] so we can send you a copy immediately. | ||
* | ||
* DISCLAIMER | ||
* | ||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer | ||
* versions in the future. If you wish to customize PrestaShop for your | ||
* needs please refer to http://www.prestashop.com for more information. | ||
* | ||
* @author PrestaShop SA <[email protected]> | ||
* @copyright 2007-2015 PrestaShop SA | ||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) | ||
* International Registered Trademark & Property of PrestaShop SA | ||
*/ | ||
|
||
class Adapter_Configuration implements Core_Business_ConfigurationInterface | ||
{ | ||
/** | ||
* Returns constant defined by given $key if exists or check directly into PrestaShop | ||
* Configuration | ||
* @param $key | ||
* @return mixed | ||
*/ | ||
public function get($key) | ||
{ | ||
if (defined($key)) { | ||
return constant($key); | ||
} else { | ||
return Configuration::get($key); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
<?php | ||
/** | ||
* 2007-2015 PrestaShop | ||
* | ||
* NOTICE OF LICENSE | ||
* | ||
* This source file is subject to the Open Software License (OSL 3.0) | ||
* that is bundled with this package in the file LICENSE.txt. | ||
* It is also available through the world-wide-web at this URL: | ||
* http://opensource.org/licenses/osl-3.0.php | ||
* If you did not receive a copy of the license and are unable to | ||
* obtain it through the world-wide-web, please send an email | ||
* to [email protected] so we can send you a copy immediately. | ||
* | ||
* DISCLAIMER | ||
* | ||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer | ||
* versions in the future. If you wish to customize PrestaShop for your | ||
* needs please refer to http://www.prestashop.com for more information. | ||
* | ||
* @author PrestaShop SA <[email protected]> | ||
* @copyright 2007-2015 PrestaShop SA | ||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) | ||
* International Registered Trademark & Property of PrestaShop SA | ||
*/ | ||
|
||
class Adapter_Database implements Core_Foundation_Database_DatabaseInterface | ||
{ | ||
/** | ||
* Perform a SELECT sql statement | ||
* @param $sqlString | ||
* @return array|false | ||
* @throws PrestaShopDatabaseException | ||
*/ | ||
public function select($sqlString) | ||
{ | ||
return Db::getInstance()->executeS($sqlString); | ||
} | ||
|
||
/** | ||
* Escape $unsafe to be used into a SQL statement | ||
* @param $unsafeData | ||
* @return string | ||
*/ | ||
public function escape($unsafeData) | ||
{ | ||
// Prepare required params | ||
$html_ok = true; | ||
$bq_sql = true; | ||
return Db::getInstance()->escape($unsafeData, $html_ok, $bq_sql); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
<?php | ||
/** | ||
* 2007-2015 PrestaShop | ||
* | ||
* NOTICE OF LICENSE | ||
* | ||
* This source file is subject to the Open Software License (OSL 3.0) | ||
* that is bundled with this package in the file LICENSE.txt. | ||
* It is also available through the world-wide-web at this URL: | ||
* http://opensource.org/licenses/osl-3.0.php | ||
* If you did not receive a copy of the license and are unable to | ||
* obtain it through the world-wide-web, please send an email | ||
* to [email protected] so we can send you a copy immediately. | ||
* | ||
* DISCLAIMER | ||
* | ||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer | ||
* versions in the future. If you wish to customize PrestaShop for your | ||
* needs please refer to http://www.prestashop.com for more information. | ||
* | ||
* @author PrestaShop SA <[email protected]> | ||
* @copyright 2007-2015 PrestaShop SA | ||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) | ||
* International Registered Trademark & Property of PrestaShop SA | ||
*/ | ||
|
||
class Adapter_EntityMapper | ||
{ | ||
/** | ||
* Load ObjectModel | ||
* @param $id | ||
* @param $id_lang | ||
* @param $entity ObjectModel | ||
* @param $entity_defs | ||
* @param $id_shop | ||
* @param $should_cache_objects | ||
* @throws PrestaShopDatabaseException | ||
*/ | ||
public function load($id, $id_lang, $entity, $entity_defs, $id_shop, $should_cache_objects) | ||
{ | ||
// Load object from database if object id is present | ||
$cache_id = 'objectmodel_' . $entity_defs['classname'] . '_' . (int)$id . '_' . (int)$id_shop . '_' . (int)$id_lang; | ||
if (!$should_cache_objects || !Cache::isStored($cache_id)) { | ||
$sql = new DbQuery(); | ||
$sql->from($entity_defs['table'], 'a'); | ||
$sql->where('a.`' . bqSQL($entity_defs['primary']) . '` = ' . (int)$id); | ||
|
||
// Get lang informations | ||
if ($id_lang && isset($entity_defs['multilang']) && $entity_defs['multilang']) { | ||
$sql->leftJoin($entity_defs['table'] . '_lang', 'b', 'a.`' . bqSQL($entity_defs['primary']) . '` = b.`' . bqSQL($entity_defs['primary']) . '` AND b.`id_lang` = ' . (int)$id_lang); | ||
if ($id_shop && !empty($entity_defs['multilang_shop'])) { | ||
$sql->where('b.`id_shop` = ' . (int)$id_shop); | ||
} | ||
} | ||
|
||
// Get shop informations | ||
if (Shop::isTableAssociated($entity_defs['table'])) { | ||
$sql->leftJoin($entity_defs['table'] . '_shop', 'c', 'a.`' . bqSQL($entity_defs['primary']) . '` = c.`' . bqSQL($entity_defs['primary']) . '` AND c.`id_shop` = ' . (int)$id_shop); | ||
} | ||
|
||
if ($object_datas = Db::getInstance()->getRow($sql)) { | ||
if (!$id_lang && isset($entity_defs['multilang']) && $entity_defs['multilang']) { | ||
$sql = 'SELECT * | ||
FROM `' . bqSQL(_DB_PREFIX_ . $entity_defs['table']) . '_lang` | ||
WHERE `' . bqSQL($entity_defs['primary']) . '` = ' . (int)$id | ||
.(($id_shop && $entity->isLangMultishop()) ? ' AND `id_shop` = ' . (int)$id_shop : ''); | ||
|
||
if ($object_datas_lang = Db::getInstance()->executeS($sql)) { | ||
foreach ($object_datas_lang as $row) { | ||
foreach ($row as $key => $value) { | ||
if ($key != $entity_defs['primary'] && array_key_exists($key, $entity)) { | ||
if (!isset($object_datas[$key]) || !is_array($object_datas[$key])) { | ||
$object_datas[$key] = array(); | ||
} | ||
|
||
$object_datas[$key][$row['id_lang']] = $value; | ||
} | ||
} | ||
} | ||
} | ||
} | ||
$entity->id = (int)$id; | ||
foreach ($object_datas as $key => $value) { | ||
if (array_key_exists($key, $entity)) { | ||
$entity->{$key} = $value; | ||
} else { | ||
unset($object_datas[$key]); | ||
} | ||
} | ||
if ($should_cache_objects) { | ||
Cache::store($cache_id, $object_datas); | ||
} | ||
} | ||
} else { | ||
$object_datas = Cache::retrieve($cache_id); | ||
if ($object_datas) { | ||
$entity->id = (int)$id; | ||
foreach ($object_datas as $key => $value) { | ||
$entity->{$key} = $value; | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
<?php | ||
/** | ||
* 2007-2015 PrestaShop | ||
* | ||
* NOTICE OF LICENSE | ||
* | ||
* This source file is subject to the Open Software License (OSL 3.0) | ||
* that is bundled with this package in the file LICENSE.txt. | ||
* It is also available through the world-wide-web at this URL: | ||
* http://opensource.org/licenses/osl-3.0.php | ||
* If you did not receive a copy of the license and are unable to | ||
* obtain it through the world-wide-web, please send an email | ||
* to [email protected] so we can send you a copy immediately. | ||
* | ||
* DISCLAIMER | ||
* | ||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer | ||
* versions in the future. If you wish to customize PrestaShop for your | ||
* needs please refer to http://www.prestashop.com for more information. | ||
* | ||
* @author PrestaShop SA <[email protected]> | ||
* @copyright 2007-2015 PrestaShop SA | ||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) | ||
* International Registered Trademark & Property of PrestaShop SA | ||
*/ | ||
|
||
class Adapter_EntityMetaDataRetriever | ||
{ | ||
public function getEntityMetaData($className) | ||
{ | ||
$metaData = new Core_Foundation_Database_EntityMetaData; | ||
|
||
$metaData->setEntityClassName($className); | ||
|
||
if (property_exists($className, 'definition')) { | ||
// Legacy entity | ||
$classVars = get_class_vars($className); | ||
$metaData->setTableName($classVars['definition']['table']); | ||
$metaData->setPrimaryKeyFieldNames(array($classVars['definition']['primary'])); | ||
} else { | ||
throw new Adapter_Exception( | ||
sprintf( | ||
'Cannot get metadata for entity `%s`.', | ||
$className | ||
) | ||
); | ||
} | ||
|
||
return $metaData; | ||
} | ||
} |
Oops, something went wrong.