Skip to content

Commit e6847d3

Browse files
committed
Cisty PrestaShop v1.6.1.8
0 parents  commit e6847d3

7,336 files changed

Lines changed: 748094 additions & 0 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Adapter/Adapter_AddressFactory.php

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
<?php
2+
/**
3+
* 2007-2016 PrestaShop
4+
*
5+
* NOTICE OF LICENSE
6+
*
7+
* This source file is subject to the Open Software License (OSL 3.0)
8+
* that is bundled with this package in the file LICENSE.txt.
9+
* It is also available through the world-wide-web at this URL:
10+
* http://opensource.org/licenses/osl-3.0.php
11+
* If you did not receive a copy of the license and are unable to
12+
* obtain it through the world-wide-web, please send an email
13+
* to license@prestashop.com so we can send you a copy immediately.
14+
*
15+
* DISCLAIMER
16+
*
17+
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
18+
* versions in the future. If you wish to customize PrestaShop for your
19+
* needs please refer to http://www.prestashop.com for more information.
20+
*
21+
* @author PrestaShop SA <contact@prestashop.com>
22+
* @copyright 2007-2016 PrestaShop SA
23+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
24+
* International Registered Trademark & Property of PrestaShop SA
25+
*/
26+
27+
class Adapter_AddressFactory
28+
{
29+
/**
30+
* Initilize an address corresponding to the specified id address or if empty to the
31+
* default shop configuration
32+
* @param null $id_address
33+
* @param bool $with_geoloc
34+
* @return Address
35+
*/
36+
public function findOrCreate($id_address = null, $with_geoloc = false)
37+
{
38+
$func_args = func_get_args();
39+
return call_user_func_array(array('Address', 'initialize'), $func_args);
40+
}
41+
42+
/**
43+
* Check if an address exists depending on given $id_address
44+
* @param $id_address
45+
* @return bool
46+
*/
47+
public function addressExists($id_address)
48+
{
49+
return Address::addressExists($id_address);
50+
}
51+
}

Adapter/Adapter_CacheManager.php

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
<?php
2+
/**
3+
* 2007-2016 PrestaShop
4+
*
5+
* NOTICE OF LICENSE
6+
*
7+
* This source file is subject to the Open Software License (OSL 3.0)
8+
* that is bundled with this package in the file LICENSE.txt.
9+
* It is also available through the world-wide-web at this URL:
10+
* http://opensource.org/licenses/osl-3.0.php
11+
* If you did not receive a copy of the license and are unable to
12+
* obtain it through the world-wide-web, please send an email
13+
* to license@prestashop.com so we can send you a copy immediately.
14+
*
15+
* DISCLAIMER
16+
*
17+
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
18+
* versions in the future. If you wish to customize PrestaShop for your
19+
* needs please refer to http://www.prestashop.com for more information.
20+
*
21+
* @author PrestaShop SA <contact@prestashop.com>
22+
* @copyright 2007-2016 PrestaShop SA
23+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
24+
* International Registered Trademark & Property of PrestaShop SA
25+
*/
26+
27+
class Adapter_CacheManager
28+
{
29+
/**
30+
* Cleans the cache for specific cache key.
31+
*
32+
* @param $key
33+
*/
34+
public function clean($key)
35+
{
36+
Cache::clean($key);
37+
}
38+
}

Adapter/Adapter_Configuration.php

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
<?php
2+
/**
3+
* 2007-2016 PrestaShop
4+
*
5+
* NOTICE OF LICENSE
6+
*
7+
* This source file is subject to the Open Software License (OSL 3.0)
8+
* that is bundled with this package in the file LICENSE.txt.
9+
* It is also available through the world-wide-web at this URL:
10+
* http://opensource.org/licenses/osl-3.0.php
11+
* If you did not receive a copy of the license and are unable to
12+
* obtain it through the world-wide-web, please send an email
13+
* to license@prestashop.com so we can send you a copy immediately.
14+
*
15+
* DISCLAIMER
16+
*
17+
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
18+
* versions in the future. If you wish to customize PrestaShop for your
19+
* needs please refer to http://www.prestashop.com for more information.
20+
*
21+
* @author PrestaShop SA <contact@prestashop.com>
22+
* @copyright 2007-2016 PrestaShop SA
23+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
24+
* International Registered Trademark & Property of PrestaShop SA
25+
*/
26+
27+
class Adapter_Configuration implements Core_Business_ConfigurationInterface
28+
{
29+
/**
30+
* Returns constant defined by given $key if exists or check directly into PrestaShop
31+
* Configuration
32+
* @param $key
33+
* @return mixed
34+
*/
35+
public function get($key)
36+
{
37+
if (defined($key)) {
38+
return constant($key);
39+
} else {
40+
return Configuration::get($key);
41+
}
42+
}
43+
}

Adapter/Adapter_Database.php

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
<?php
2+
/**
3+
* 2007-2016 PrestaShop
4+
*
5+
* NOTICE OF LICENSE
6+
*
7+
* This source file is subject to the Open Software License (OSL 3.0)
8+
* that is bundled with this package in the file LICENSE.txt.
9+
* It is also available through the world-wide-web at this URL:
10+
* http://opensource.org/licenses/osl-3.0.php
11+
* If you did not receive a copy of the license and are unable to
12+
* obtain it through the world-wide-web, please send an email
13+
* to license@prestashop.com so we can send you a copy immediately.
14+
*
15+
* DISCLAIMER
16+
*
17+
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
18+
* versions in the future. If you wish to customize PrestaShop for your
19+
* needs please refer to http://www.prestashop.com for more information.
20+
*
21+
* @author PrestaShop SA <contact@prestashop.com>
22+
* @copyright 2007-2016 PrestaShop SA
23+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
24+
* International Registered Trademark & Property of PrestaShop SA
25+
*/
26+
27+
class Adapter_Database implements Core_Foundation_Database_DatabaseInterface
28+
{
29+
/**
30+
* Perform a SELECT sql statement
31+
* @param $sqlString
32+
* @return array|false
33+
* @throws PrestaShopDatabaseException
34+
*/
35+
public function select($sqlString)
36+
{
37+
return Db::getInstance()->executeS($sqlString);
38+
}
39+
40+
/**
41+
* Escape $unsafe to be used into a SQL statement
42+
* @param $unsafeData
43+
* @return string
44+
*/
45+
public function escape($unsafeData)
46+
{
47+
// Prepare required params
48+
$html_ok = true;
49+
$bq_sql = true;
50+
return Db::getInstance()->escape($unsafeData, $html_ok, $bq_sql);
51+
}
52+
}

Adapter/Adapter_EntityMapper.php

Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
<?php
2+
/**
3+
* 2007-2016 PrestaShop
4+
*
5+
* NOTICE OF LICENSE
6+
*
7+
* This source file is subject to the Open Software License (OSL 3.0)
8+
* that is bundled with this package in the file LICENSE.txt.
9+
* It is also available through the world-wide-web at this URL:
10+
* http://opensource.org/licenses/osl-3.0.php
11+
* If you did not receive a copy of the license and are unable to
12+
* obtain it through the world-wide-web, please send an email
13+
* to license@prestashop.com so we can send you a copy immediately.
14+
*
15+
* DISCLAIMER
16+
*
17+
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
18+
* versions in the future. If you wish to customize PrestaShop for your
19+
* needs please refer to http://www.prestashop.com for more information.
20+
*
21+
* @author PrestaShop SA <contact@prestashop.com>
22+
* @copyright 2007-2016 PrestaShop SA
23+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
24+
* International Registered Trademark & Property of PrestaShop SA
25+
*/
26+
27+
class Adapter_EntityMapper
28+
{
29+
/**
30+
* Load ObjectModel
31+
* @param $id
32+
* @param $id_lang
33+
* @param $entity ObjectModel
34+
* @param $entity_defs
35+
* @param $id_shop
36+
* @param $should_cache_objects
37+
* @throws PrestaShopDatabaseException
38+
*/
39+
public function load($id, $id_lang, $entity, $entity_defs, $id_shop, $should_cache_objects)
40+
{
41+
// Load object from database if object id is present
42+
$cache_id = 'objectmodel_' . $entity_defs['classname'] . '_' . (int)$id . '_' . (int)$id_shop . '_' . (int)$id_lang;
43+
if (!$should_cache_objects || !Cache::isStored($cache_id)) {
44+
$sql = new DbQuery();
45+
$sql->from($entity_defs['table'], 'a');
46+
$sql->where('a.`' . bqSQL($entity_defs['primary']) . '` = ' . (int)$id);
47+
48+
// Get lang informations
49+
if ($id_lang && isset($entity_defs['multilang']) && $entity_defs['multilang']) {
50+
$sql->leftJoin($entity_defs['table'] . '_lang', 'b', 'a.`' . bqSQL($entity_defs['primary']) . '` = b.`' . bqSQL($entity_defs['primary']) . '` AND b.`id_lang` = ' . (int)$id_lang);
51+
if ($id_shop && !empty($entity_defs['multilang_shop'])) {
52+
$sql->where('b.`id_shop` = ' . (int)$id_shop);
53+
}
54+
}
55+
56+
// Get shop informations
57+
if (Shop::isTableAssociated($entity_defs['table'])) {
58+
$sql->leftJoin($entity_defs['table'] . '_shop', 'c', 'a.`' . bqSQL($entity_defs['primary']) . '` = c.`' . bqSQL($entity_defs['primary']) . '` AND c.`id_shop` = ' . (int)$id_shop);
59+
}
60+
61+
if ($object_datas = Db::getInstance()->getRow($sql)) {
62+
if (!$id_lang && isset($entity_defs['multilang']) && $entity_defs['multilang']) {
63+
$sql = 'SELECT *
64+
FROM `' . bqSQL(_DB_PREFIX_ . $entity_defs['table']) . '_lang`
65+
WHERE `' . bqSQL($entity_defs['primary']) . '` = ' . (int)$id
66+
.(($id_shop && $entity->isLangMultishop()) ? ' AND `id_shop` = ' . (int)$id_shop : '');
67+
68+
if ($object_datas_lang = Db::getInstance()->executeS($sql)) {
69+
foreach ($object_datas_lang as $row) {
70+
foreach ($row as $key => $value) {
71+
if ($key != $entity_defs['primary'] && array_key_exists($key, $entity)) {
72+
if (!isset($object_datas[$key]) || !is_array($object_datas[$key])) {
73+
$object_datas[$key] = array();
74+
}
75+
76+
$object_datas[$key][$row['id_lang']] = $value;
77+
}
78+
}
79+
}
80+
}
81+
}
82+
$entity->id = (int)$id;
83+
foreach ($object_datas as $key => $value) {
84+
if (array_key_exists($key, $entity)) {
85+
$entity->{$key} = $value;
86+
} else {
87+
unset($object_datas[$key]);
88+
}
89+
}
90+
if ($should_cache_objects) {
91+
Cache::store($cache_id, $object_datas);
92+
}
93+
}
94+
} else {
95+
$object_datas = Cache::retrieve($cache_id);
96+
if ($object_datas) {
97+
$entity->id = (int)$id;
98+
foreach ($object_datas as $key => $value) {
99+
$entity->{$key} = $value;
100+
}
101+
}
102+
}
103+
}
104+
}
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
<?php
2+
/**
3+
* 2007-2016 PrestaShop
4+
*
5+
* NOTICE OF LICENSE
6+
*
7+
* This source file is subject to the Open Software License (OSL 3.0)
8+
* that is bundled with this package in the file LICENSE.txt.
9+
* It is also available through the world-wide-web at this URL:
10+
* http://opensource.org/licenses/osl-3.0.php
11+
* If you did not receive a copy of the license and are unable to
12+
* obtain it through the world-wide-web, please send an email
13+
* to license@prestashop.com so we can send you a copy immediately.
14+
*
15+
* DISCLAIMER
16+
*
17+
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
18+
* versions in the future. If you wish to customize PrestaShop for your
19+
* needs please refer to http://www.prestashop.com for more information.
20+
*
21+
* @author PrestaShop SA <contact@prestashop.com>
22+
* @copyright 2007-2016 PrestaShop SA
23+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
24+
* International Registered Trademark & Property of PrestaShop SA
25+
*/
26+
27+
class Adapter_EntityMetaDataRetriever
28+
{
29+
public function getEntityMetaData($className)
30+
{
31+
$metaData = new Core_Foundation_Database_EntityMetaData;
32+
33+
$metaData->setEntityClassName($className);
34+
35+
if (property_exists($className, 'definition')) {
36+
// Legacy entity
37+
$classVars = get_class_vars($className);
38+
$metaData->setTableName($classVars['definition']['table']);
39+
$metaData->setPrimaryKeyFieldNames(array($classVars['definition']['primary']));
40+
} else {
41+
throw new Adapter_Exception(
42+
sprintf(
43+
'Cannot get metadata for entity `%s`.',
44+
$className
45+
)
46+
);
47+
}
48+
49+
return $metaData;
50+
}
51+
}

Adapter/Adapter_Exception.php

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<?php
2+
/**
3+
* 2007-2016 PrestaShop
4+
*
5+
* NOTICE OF LICENSE
6+
*
7+
* This source file is subject to the Open Software License (OSL 3.0)
8+
* that is bundled with this package in the file LICENSE.txt.
9+
* It is also available through the world-wide-web at this URL:
10+
* http://opensource.org/licenses/osl-3.0.php
11+
* If you did not receive a copy of the license and are unable to
12+
* obtain it through the world-wide-web, please send an email
13+
* to license@prestashop.com so we can send you a copy immediately.
14+
*
15+
* DISCLAIMER
16+
*
17+
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
18+
* versions in the future. If you wish to customize PrestaShop for your
19+
* needs please refer to http://www.prestashop.com for more information.
20+
*
21+
* @author PrestaShop SA <contact@prestashop.com>
22+
* @copyright 2007-2016 PrestaShop SA
23+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
24+
* International Registered Trademark & Property of PrestaShop SA
25+
*/
26+
27+
class Adapter_Exception extends Core_Foundation_Exception_Exception
28+
{
29+
}

0 commit comments

Comments
 (0)