download all files

This commit is contained in:
Roman Pyrih
2025-06-24 14:14:35 +02:00
parent ebed09c00b
commit 4c71b5d9c2
72007 changed files with 10407727 additions and 40029 deletions

View File

@@ -0,0 +1,141 @@
<?php
/**
* 2012-2018 Areama
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 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/afl-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 license@areama.net so we can send you a copy immediately.
*
* @author Areama <contact@areama.net>
* @copyright 2018 Areama
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of Areama
*/
include_once dirname(__FILE__).'/../ArSeoModel.php';
abstract class ArSeoProSitemapAbstract extends ArSeoModel
{
public function __construct($module, $configPrefix = null)
{
parent::__construct($module, $configPrefix);
$this->configPrefix = $this->getConfigPrefix();
}
public static function getConfigTab()
{
return 'sitemap';
}
public function attributeLabels()
{
return array(
'freq' => $this->l('Update frequency', 'ArSeoProSitemapAbstract'),
'priority' => $this->l('Proirity', 'ArSeoProSitemapAbstract'),
'active_only' => $this->l('Skip non-active', 'ArSeoProSitemapAbstract'),
'all' => $this->l('Export all data', 'ArSeoProSitemapAbstract')
);
}
public function attributeTypes()
{
return array(
'freq' => 'select',
'priority' => 'select',
'active_only' => 'switch',
'all' => 'switch'
);
}
public function prioritySelectOptions()
{
return array(
array(
'id' => '1.0',
'name' => $this->l('1.0 (high)', 'ArSeoProSitemapAbstract')
),
array(
'id' => '0.9',
'name' => $this->l('0.9', 'ArSeoProSitemapAbstract')
),
array(
'id' => '0.8',
'name' => $this->l('0.8', 'ArSeoProSitemapAbstract')
),
array(
'id' => '0.7',
'name' => $this->l('0.7', 'ArSeoProSitemapAbstract')
),
array(
'id' => '0.6',
'name' => $this->l('0.6', 'ArSeoProSitemapAbstract')
),
array(
'id' => '0.5',
'name' => $this->l('0.5 (standard)', 'ArSeoProSitemapAbstract')
),
array(
'id' => '0.4',
'name' => $this->l('0.4', 'ArSeoProSitemapAbstract')
),
array(
'id' => '0.3',
'name' => $this->l('0.3', 'ArSeoProSitemapAbstract')
),
array(
'id' => '0.2',
'name' => $this->l('0.2', 'ArSeoProSitemapAbstract')
),
array(
'id' => '0.1',
'name' => $this->l('0.1', 'ArSeoProSitemapAbstract')
),
array(
'id' => '0.0',
'name' => $this->l('0.0 (low)', 'ArSeoProSitemapAbstract')
),
);
}
public function freqSelectOptions()
{
return array(
array(
'id' => 'always',
'name' => $this->l('Always', 'ArSeoProSitemapAbstract')
),
array(
'id' => 'hourly',
'name' => $this->l('Hourly', 'ArSeoProSitemapAbstract')
),
array(
'id' => 'daily',
'name' => $this->l('Daily', 'ArSeoProSitemapAbstract')
),
array(
'id' => 'weekly',
'name' => $this->l('Weekly', 'ArSeoProSitemapAbstract')
),
array(
'id' => 'monthly',
'name' => $this->l('Monthly', 'ArSeoProSitemapAbstract')
),
array(
'id' => 'yearly',
'name' => $this->l('Yearly', 'ArSeoProSitemapAbstract')
),
array(
'id' => 'never',
'name' => $this->l('Never', 'ArSeoProSitemapAbstract')
)
);
}
abstract public function getConfigPrefix();
}

View File

@@ -0,0 +1,60 @@
<?php
/**
* 2012-2018 Areama
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 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/afl-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 license@areama.net so we can send you a copy immediately.
*
* @author Areama <contact@areama.net>
* @copyright 2018 Areama
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of Areama
*/
include_once dirname(__FILE__).'/ArSeoProSitemapAbstract.php';
class ArSeoProSitemapCategories extends ArSeoProSitemapAbstract
{
const CONFIG_PREFIX = 'arssc_';
public $freq;
public $priority;
public $all;
public $active_only;
public function rules()
{
return array(
array(
array(
'freq',
'priority',
'active_only',
'all'
), 'safe'
)
);
}
public function attributeDefaults()
{
return array(
'freq' => 'always',
'priority' => '1.0',
'active_only' => 1,
'all' => 1
);
}
public function getConfigPrefix()
{
return self::CONFIG_PREFIX;
}
}

View File

@@ -0,0 +1,60 @@
<?php
/**
* 2012-2018 Areama
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 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/afl-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 license@areama.net so we can send you a copy immediately.
*
* @author Areama <contact@areama.net>
* @copyright 2018 Areama
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of Areama
*/
include_once dirname(__FILE__).'/ArSeoProSitemapAbstract.php';
class ArSeoProSitemapCmsConfig extends ArSeoProSitemapAbstract
{
const CONFIG_PREFIX = 'arsscms_';
public $freq;
public $priority;
public $all;
public $active_only;
public function rules()
{
return array(
array(
array(
'freq',
'priority',
'active_only',
'all'
), 'safe'
)
);
}
public function attributeDefaults()
{
return array(
'freq' => 'always',
'priority' => '1.0',
'active_only' => 1,
'all' => 1
);
}
public function getConfigPrefix()
{
return self::CONFIG_PREFIX;
}
}

View File

@@ -0,0 +1,57 @@
<?php
/**
* 2012-2018 Areama
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 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/afl-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 license@areama.net so we can send you a copy immediately.
*
* @author Areama <contact@areama.net>
* @copyright 2018 Areama
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of Areama
*/
include_once dirname(__FILE__).'/ArSeoProSitemapAbstract.php';
class ArSeoProSitemapFAQs extends ArSeoProSitemapAbstract
{
const CONFIG_PREFIX = 'arsssb_';
public $freq;
public $priority;
public $active_only;
public function rules()
{
return array(
array(
array(
'freq',
'priority',
'active_only'
), 'safe'
)
);
}
public function attributeDefaults()
{
return array(
'freq' => 'always',
'priority' => '1.0',
'active_only' => 1
);
}
public function getConfigPrefix()
{
return self::CONFIG_PREFIX;
}
}

View File

@@ -0,0 +1,144 @@
<?php
/**
* 2012-2018 Areama
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 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/afl-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 license@areama.net so we can send you a copy immediately.
*
* @author Areama <contact@areama.net>
* @copyright 2018 Areama
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of Areama
*/
include_once dirname(__FILE__).'/ArSeoProSitemapAbstract.php';
class ArSeoProSitemapGeneral extends ArSeoProSitemapAbstract
{
const CONFIG_PREFIX = 'arssg_';
public $disable;
public $limit;
public $langs;
public $alternates;
public $ping_google;
public $ping_bing;
public $ping_yandex;
public function rules()
{
return array(
array(
array(
'disable',
'limit',
'langs',
'alternates',
'ping_google',
'ping_bing',
'ping_yandex'
), 'safe'
),
array(
array(
'limit'
), 'isInt'
)
);
}
public function afterSave()
{
$generator = new ArSeoProSitemapGenerator($this->module, Context::getContext()->shop->id);
$generator->setIndexPath($this->module->getIndexSitemapPath(false));
$generator->updateRobots();
return parent::afterSave();
}
public function langsSelectOptions()
{
$langs = Language::getLanguages(true);
$res = array();
foreach ($langs as $lang) {
$res[] = array(
'id' => $lang['id_lang'],
'name' => $lang['name']
);
}
return $res;
}
public function attributeTypes()
{
return array(
'disable' => 'switch',
'limit' => 'text',
'langs' => 'select',
'alternates' => 'switch',
'ping_google' => 'switch',
'ping_bing' => 'switch',
'ping_yandex' => 'switch'
);
}
public function multipleSelects()
{
return array(
'langs' => true
);
}
public function attributeLabels()
{
return array(
'disable' => $this->l('Disable sitemap functionality', 'ArSeoProSitemapGeneral'),
'limit' => $this->l('Max items count in each sitemap', 'ArSeoProSitemapGeneral'),
'langs' => $this->l('Include languages', 'ArSeoProSitemapGeneral'),
'alternates' => $this->l('Alternates', 'ArSeoProSitemapGeneral'),
'ping_google' => $this->l('Ping Google', 'ArSeoProSitemapGeneral'),
'ping_bing' => $this->l('Ping Bing', 'ArSeoProSitemapGeneral'),
'ping_yandex' => $this->l('Ping Yandex', 'ArSeoProSitemapGeneral'),
);
}
public function attributeDescriptions()
{
return array(
'alternates' => $this->l('Please refer https://goo.gl/fc6JDj for more details', 'ArSeoProSitemapGeneral'),
'ping_google' => $this->l('Notify Google Search Console when sitemap is updated', 'ArSeoProSitemapGeneral'),
'ping_bing' => $this->l('Notify Bing Webmaster Tools when sitemap is updated', 'ArSeoProSitemapGeneral'),
'ping_yandex' => $this->l('Notify Yandex when sitemap is updated', 'ArSeoProSitemapGeneral'),
);
}
public function getConfigPrefix()
{
return self::CONFIG_PREFIX;
}
public function attributeDefaults()
{
return array(
'disable' => 0,
'limit' => '3000',
'langs' => $this->getLangIds(),
'alternates' => 1,
'ping_google' => 1,
'ping_bing' => 1,
'ping_yandex' => 0
);
}
public function getLangIds()
{
return Language::getLanguages(true, false, true);
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,60 @@
<?php
/**
* 2012-2018 Areama
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 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/afl-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 license@areama.net so we can send you a copy immediately.
*
* @author Areama <contact@areama.net>
* @copyright 2018 Areama
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of Areama
*/
include_once dirname(__FILE__).'/ArSeoProSitemapAbstract.php';
class ArSeoProSitemapManufacturers extends ArSeoProSitemapAbstract
{
const CONFIG_PREFIX = 'arssm_';
public $freq;
public $priority;
public $all;
public $active_only;
public function rules()
{
return array(
array(
array(
'freq',
'priority',
'active_only',
'all'
), 'safe'
)
);
}
public function attributeDefaults()
{
return array(
'freq' => 'always',
'priority' => '1.0',
'active_only' => 1,
'all' => 1
);
}
public function getConfigPrefix()
{
return self::CONFIG_PREFIX;
}
}

View File

@@ -0,0 +1,57 @@
<?php
/**
* 2012-2018 Areama
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 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/afl-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 license@areama.net so we can send you a copy immediately.
*
* @author Areama <contact@areama.net>
* @copyright 2018 Areama
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of Areama
*/
include_once dirname(__FILE__).'/ArSeoProSitemapAbstract.php';
class ArSeoProSitemapMeta extends ArSeoProSitemapAbstract
{
const CONFIG_PREFIX = 'arssmp_';
public $freq;
public $priority;
public $all;
public function rules()
{
return array(
array(
array(
'freq',
'priority',
'all'
), 'safe'
)
);
}
public function attributeDefaults()
{
return array(
'freq' => 'always',
'priority' => '1.0',
'all' => 1
);
}
public function getConfigPrefix()
{
return self::CONFIG_PREFIX;
}
}

View File

@@ -0,0 +1,57 @@
<?php
/**
* 2012-2018 Areama
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 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/afl-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 license@areama.net so we can send you a copy immediately.
*
* @author Areama <contact@areama.net>
* @copyright 2018 Areama
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of Areama
*/
include_once dirname(__FILE__).'/ArSeoProSitemapAbstract.php';
class ArSeoProSitemapPrestablog extends ArSeoProSitemapAbstract
{
const CONFIG_PREFIX = 'arsspb_';
public $freq;
public $priority;
public $active_only;
public function rules()
{
return array(
array(
array(
'freq',
'priority',
'active_only'
), 'safe'
)
);
}
public function attributeDefaults()
{
return array(
'freq' => 'always',
'priority' => '1.0',
'active_only' => 1
);
}
public function getConfigPrefix()
{
return self::CONFIG_PREFIX;
}
}

View File

@@ -0,0 +1,150 @@
<?php
/**
* 2012-2018 Areama
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 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/afl-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 license@areama.net so we can send you a copy immediately.
*
* @author Areama <contact@areama.net>
* @copyright 2018 Areama
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of Areama
*/
include_once dirname(__FILE__).'/ArSeoProSitemapAbstract.php';
class ArSeoProSitemapProducts extends ArSeoProSitemapAbstract
{
const CONFIG_PREFIX = 'arssp_';
const IMG_NONE = 0;
const IMG_COVER = 1;
const IMG_ALL = 2;
public $freq;
public $priority;
public $all;
public $active_only;
public $skip_zero;
public $attributes;
public $images;
public $image_type;
public $image_title;
public $image_caption;
public function rules()
{
return array(
array(
array(
'freq',
'priority',
'skip_zero',
'attributes',
'images',
'image_type',
'image_title',
'image_caption',
'active_only',
'all'
), 'safe'
)
);
}
public function imagesSelectOptions()
{
return array(
array(
'id' => self::IMG_NONE,
'name' => $this->l('None', 'ArSeoProSitemapProducts')
),
array(
'id' => self::IMG_COVER,
'name' => $this->l('Cover image', 'ArSeoProSitemapProducts')
),
array(
'id' => self::IMG_ALL,
'name' => $this->l('All images', 'ArSeoProSitemapProducts')
),
);
}
public function imageTypeSelectOptions()
{
$types = ImageType::getImagesTypes('products');
$result = array();
foreach ($types as $type) {
$result[] = array(
'id' => $type['name'],
'name' => $type['name'] . ' (' . $type['width'] . 'x' . $type['height'] . ')'
);
}
return $result;
}
public function attributeLabels()
{
return array_merge(parent::attributeLabels(), array(
'attributes' => $this->l('Export each combination of product as separate URL', 'ArSeoProSitemapProducts'),
'images' => $this->l('Include product images', 'ArSeoProSitemapProducts'),
'image_type' => $this->l('Image size', 'ArSeoProSitemapProducts'),
'skip_zero' => $this->l('Skip out of stock products', 'ArSeoProSitemapProducts'),
'image_title' => $this->l('Include image title', 'ArSeoProSitemapProducts'),
'image_caption' => $this->l('Include image caption', 'ArSeoProSitemapProducts')
));
}
public function attributeDescriptions()
{
return array(
'attributes' => $this->l('Please use this option only if your product URL contains ID of combination', 'ArSeoProSitemapProducts'),
);
}
public function attributeTypes()
{
return array_merge(parent::attributeTypes(), array(
'images' => 'select',
'skip_zero' => 'switch',
'image_type' => 'select',
'image_title' => 'switch',
'image_caption' => 'switch',
'attributes' => 'switch'
));
}
public function getConfigPrefix()
{
return self::CONFIG_PREFIX;
}
public function attributeDefaults()
{
$type = null;
$types = ImageType::getImagesTypes('products');
if (isset($types[0])) {
$type = $types[0]['name'];
}
return array(
'images' => '0',
'skip_zero' => '0',
'image_type' => $type,
'freq' => 'always',
'priority' => '1.0',
'images',
'image_type',
'image_title',
'image_caption',
'active_only' => 1,
'all' => 1
);
}
}

View File

@@ -0,0 +1,57 @@
<?php
/**
* 2012-2018 Areama
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 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/afl-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 license@areama.net so we can send you a copy immediately.
*
* @author Areama <contact@areama.net>
* @copyright 2018 Areama
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of Areama
*/
include_once dirname(__FILE__).'/ArSeoProSitemapAbstract.php';
class ArSeoProSitemapSimpleblog extends ArSeoProSitemapAbstract
{
const CONFIG_PREFIX = 'arsssib_';
public $freq;
public $priority;
public $active_only;
public function rules()
{
return array(
array(
array(
'freq',
'priority',
'active_only'
), 'safe'
)
);
}
public function attributeDefaults()
{
return array(
'freq' => 'always',
'priority' => '1.0',
'active_only' => 1
);
}
public function getConfigPrefix()
{
return self::CONFIG_PREFIX;
}
}

View File

@@ -0,0 +1,57 @@
<?php
/**
* 2012-2018 Areama
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 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/afl-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 license@areama.net so we can send you a copy immediately.
*
* @author Areama <contact@areama.net>
* @copyright 2018 Areama
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of Areama
*/
include_once dirname(__FILE__).'/ArSeoProSitemapAbstract.php';
class ArSeoProSitemapSmartblog extends ArSeoProSitemapAbstract
{
const CONFIG_PREFIX = 'arsssb_';
public $freq;
public $priority;
public $active_only;
public function rules()
{
return array(
array(
array(
'freq',
'priority',
'active_only'
), 'safe'
)
);
}
public function attributeDefaults()
{
return array(
'freq' => 'always',
'priority' => '1.0',
'active_only' => 1
);
}
public function getConfigPrefix()
{
return self::CONFIG_PREFIX;
}
}

View File

@@ -0,0 +1,60 @@
<?php
/**
* 2012-2018 Areama
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 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/afl-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 license@areama.net so we can send you a copy immediately.
*
* @author Areama <contact@areama.net>
* @copyright 2018 Areama
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of Areama
*/
include_once dirname(__FILE__).'/ArSeoProSitemapAbstract.php';
class ArSeoProSitemapSuppliers extends ArSeoProSitemapAbstract
{
const CONFIG_PREFIX = 'arsss_';
public $freq;
public $priority;
public $all;
public $active_only;
public function rules()
{
return array(
array(
array(
'freq',
'priority',
'active_only',
'all'
), 'safe'
)
);
}
public function attributeDefaults()
{
return array(
'freq' => 'always',
'priority' => '1.0',
'active_only' => 1,
'all' => 1
);
}
public function getConfigPrefix()
{
return self::CONFIG_PREFIX;
}
}

View File

@@ -0,0 +1,120 @@
<?php
/**
* 2012-2018 Areama
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 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/afl-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 license@areama.net so we can send you a copy immediately.
*
* @author Areama <contact@areama.net>
* @copyright 2018 Areama
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of Areama
*/
class ArSeoProSitemapWriter
{
public $xml;
public $indexXml;
public $owner;
public function __construct($owner)
{
$this->owner = $owner;
}
public function startSitemap($file, $images = false, $alternates = true)
{
$this->xml = new XMLWriter();
$this->xml->openURI($file);
$this->xml->startDocument('1.0', 'utf-8');
$this->xml->startElement('urlset');
$this->xml->writeAttribute('xmlns', 'http://www.sitemaps.org/schemas/sitemap/0.9');
if ($images) {
$this->xml->writeAttribute('xmlns:image', 'http://www.google.com/schemas/sitemap-image/1.1');
}
if ($alternates) {
$this->xml->writeAttribute('xmlns:xhtml', 'http://www.w3.org/1999/xhtml');
}
$this->xml->setIndent(true);
}
public function startIndexSitemap($file)
{
$this->indexXml = new XMLWriter();
$this->indexXml->openURI($file);
$this->indexXml->startDocument('1.0', 'utf-8');
$this->indexXml->startElement('sitemapindex');
$this->indexXml->writeAttribute('xmlns', 'http://www.sitemaps.org/schemas/sitemap/0.9');
$this->indexXml->setIndent(true);
}
public function addSitemaps($nodes)
{
foreach ($nodes as $node) {
$this->indexXml->startElement('sitemap');
foreach ($node as $el => $val) {
if (!is_array($val)) {
$this->indexXml->startElement($el);
$this->indexXml->text($val);
$this->indexXml->endElement();
}
}
$this->indexXml->endElement();
}
}
public function endIndexSitemap()
{
$this->indexXml->endElement();
$this->indexXml->flush();
}
public function addXmlNodes($nodes)
{
foreach ($nodes as $node) {
$this->xml->startElement('url');
foreach ($node as $el => $val) {
if (!is_array($val) && !in_array($el, array('_id', '_lang', '_id_lang', '_type', '_link_rewrite', '_title', '_id_product_attribute'))) {
$this->xml->startElement($el);
$this->xml->text($val);
$this->xml->endElement();
}
if ($el == '_alternates') {
foreach ($val as $alt) {
$this->xml->startElement('xhtml:link');
$this->xml->writeAttribute('rel', 'alternate');
foreach ($alt as $attr => $value) {
$this->xml->writeAttribute($attr, $value);
}
$this->xml->endElement();
}
}
if ($el == '_images') {
foreach ($val as $image) {
$this->xml->startElement('image:image');
foreach ($image as $attr => $value) {
$this->xml->startElement('image:' . $attr);
$this->xml->text($value);
$this->xml->endElement();
}
$this->xml->endElement();
}
}
}
$this->xml->endElement();
}
}
public function endSitemap()
{
$this->xml->endElement();
$this->xml->flush();
}
}

View File

@@ -0,0 +1,31 @@
<?php
/*
* 2018 Areama
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 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/afl-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 license@areama.net so we can send you a copy immediately.
*
*
* @author Areama <contact@areama.net>
* @copyright 2018 Areama
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of Areama
*/
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');
header('Cache-Control: no-store, no-cache, must-revalidate');
header('Cache-Control: post-check=0, pre-check=0', false);
header('Pragma: no-cache');
header('Location: ../../../');
exit;

View File

@@ -0,0 +1,163 @@
<?php
/**
* 2012-2018 Areama
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 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/afl-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 license@areama.net so we can send you a copy immediately.
*
* @author Areama <contact@areama.net>
* @copyright 2018 Areama
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of Areama
*/
include_once dirname(__FILE__).'/../../ArSeoProTableAbstract.php';
class ArSeoProSitemapCategory extends ArSeoProTableAbstract
{
const TABLE_NAME = 'arseopro_sitemap_category';
public $id_sitemap;
public $id_category;
public $id_shop;
public $export;
public $updated_at;
/**
* @see ObjectModel::$definition
*/
public static $definition = array(
'table' => self::TABLE_NAME,
'primary' => 'id_sitemap',
'multilang' => false,
'fields' => array(
'id_sitemap' => array('type' => self::TYPE_INT, 'validate' => 'isInt'),
'id_category' => array('type' => self::TYPE_INT, 'validate' => 'isInt'),
'id_shop' => array('type' => self::TYPE_INT, 'validate' => 'isInt'),
'export' => array('type' => self::TYPE_INT, 'validate' => 'isInt'),
'updated_at' => array('type' => self::TYPE_STRING)
),
);
public static function getTableName($withPrefix = true)
{
return $withPrefix? (_DB_PREFIX_ . self::TABLE_NAME) : self::TABLE_NAME;
}
public static function uninstallTable()
{
return Db::getInstance()->execute('DROP TABLE IF EXISTS `' . self::getTableName() . '`');
}
public static function installTable()
{
$sql = "CREATE TABLE IF NOT EXISTS `" . self::getTableName() . "` (
`id_sitemap` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT,
`id_category` INT(11) UNSIGNED NOT NULL,
`id_shop` INT(11) UNSIGNED NOT NULL,
`export` TINYINT(1) UNSIGNED NOT NULL,
`updated_at` DATETIME NULL DEFAULT NULL,
PRIMARY KEY (`id_sitemap`),
INDEX `id_category` (`id_category`),
INDEX `id_shop` (`id_shop`),
INDEX `export` (`export`)
)
COLLATE='utf8_general_ci'";
return Db::getInstance()->execute($sql);
}
public static function getCount($params = array())
{
$query = new DbQuery();
$query->from('category', 'c');
$query->select('COUNT(1) c');
$query->join('LEFT JOIN ' . self::getTableName() . ' sc ON sc.id_category = c.id_category');
$query->join('LEFT JOIN `' . _DB_PREFIX_ . 'category_lang` cl ON cl.id_category = c.id_category');
$query->join('LEFT JOIN `' . _DB_PREFIX_ . 'category_shop` cs ON cs.id_category = c.id_category');
$filters = isset($params['filter'])? $params['filter'] : array();
$where = self::processFilters($filters, array(
'cl.id_lang = ' . (int)Context::getContext()->language->id,
'cs.id_shop = ' . (int)Context::getContext()->shop->id,
));
$query->where($where);
$res = Db::getInstance()->getRow($query);
return $res['c'];
}
public static function getAll($params = array())
{
$pageSize = isset($params['selected_pagination'])? $params['selected_pagination'] : 50;
$page = isset($params['page'])? $params['page'] - 1 : 0;
$offset = isset($params['page'])? $pageSize * $page : 0;
$query = new DbQuery();
$query->from('category', 'c');
$query->limit($pageSize, $offset);
$query->join('LEFT JOIN ' . self::getTableName() . ' sc ON sc.id_category = c.id_category');
$query->join('LEFT JOIN `' . _DB_PREFIX_ . 'category_lang` cl ON cl.id_category = c.id_category');
$query->join('LEFT JOIN `' . _DB_PREFIX_ . 'category_shop` cs ON cs.id_category = c.id_category');
$query->select('c.id_category, cl.name, c.reference, IF(sc.export IS NOT NULL, sc.export, 0) AS export, sc.id_sitemap');
$query->orderBy('c.id_category ASC');
$filters = isset($params['filter'])? $params['filter'] : array();
$where = self::processFilters($filters, array(
'cl.id_lang = ' . (int)Context::getContext()->language->id,
'cs.id_shop = ' . (int)Context::getContext()->shop->id,
));
$query->where($where);
return Db::getInstance()->executeS($query);
}
public static function processFilters($params, $initPrams = array())
{
$where = $initPrams;
$model = new self();
foreach ($params as $k => $value) {
if (property_exists($model, $k) && $value != '') {
if ($k == 'id') {
$k = 'id_category';
if (strpos($value, '%') !== false) {
$where[] = "c.`" . $k . "` LIKE '" . pSQL($value) . "'";
} else {
$where[] = "c.`" . $k . "` = '" . pSQL($value) . "'";
}
}
if ($k == 'export') {
if ($value) {
$where[] = "sc.`" . $k . "` = '" . pSQL($value) . "'";
} else {
$where[] = "(sc.`" . $k . "` IS NULL OR sc.`" . $k . "` = 0)";
}
}
} elseif (in_array($k, array('id_category', 'name'))) {
if (!empty($value)) {
if (strpos($value, '%') !== false) {
$where[] = "cl.`" . $k . "` LIKE '" . pSQL($value) . "'";
} else {
$where[] = "cl.`" . $k . "` = '" . pSQL($value) . "'";
}
}
} elseif (in_array($k, array('reference'))) {
if (!empty($value)) {
if (strpos($value, '%') !== false) {
$where[] = "c.`" . $k . "` LIKE '" . pSQL($value) . "'";
} else {
$where[] = "c.`" . $k . "` = '" . pSQL($value) . "'";
}
}
}
}
return implode(' AND ', $where);
}
public static function truncate()
{
return Db::getInstance()->execute('TRUNCATE `' . self::getTableName() . '`');
}
}

View File

@@ -0,0 +1,181 @@
<?php
/**
* 2012-2018 Areama
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 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/afl-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 license@areama.net so we can send you a copy immediately.
*
* @author Areama <contact@areama.net>
* @copyright 2018 Areama
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of Areama
*/
include_once dirname(__FILE__).'/../../ArSeoProTableAbstract.php';
class ArSeoProSitemapCms extends ArSeoProTableAbstract
{
const TABLE_NAME = 'arseopro_sitemap_cms';
public $id_sitemap;
public $id_cms;
public $id_shop;
public $export;
public $updated_at;
/**
* @see ObjectModel::$definition
*/
public static $definition = array(
'table' => self::TABLE_NAME,
'primary' => 'id_sitemap',
'multilang' => false,
'fields' => array(
'id_sitemap' => array('type' => self::TYPE_INT, 'validate' => 'isInt'),
'id_cms' => array('type' => self::TYPE_INT, 'validate' => 'isInt'),
'id_shop' => array('type' => self::TYPE_INT, 'validate' => 'isInt'),
'export' => array('type' => self::TYPE_INT, 'validate' => 'isInt'),
'updated_at' => array('type' => self::TYPE_STRING)
),
);
public static function getTableName($withPrefix = true)
{
return $withPrefix? (_DB_PREFIX_ . self::TABLE_NAME) : self::TABLE_NAME;
}
public static function uninstallTable()
{
return Db::getInstance()->execute('DROP TABLE IF EXISTS `' . self::getTableName() . '`');
}
public static function installTable()
{
$sql = "CREATE TABLE IF NOT EXISTS `" . self::getTableName() . "` (
`id_sitemap` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT,
`id_cms` INT(11) UNSIGNED NOT NULL,
`id_shop` INT(11) UNSIGNED NOT NULL,
`export` TINYINT(1) UNSIGNED NOT NULL,
`updated_at` DATETIME NULL DEFAULT NULL,
PRIMARY KEY (`id_sitemap`),
INDEX `id_cms` (`id_cms`),
INDEX `id_shop` (`id_shop`),
INDEX `export` (`export`)
)
COLLATE='utf8_general_ci'";
return Db::getInstance()->execute($sql);
}
public static function getCount($params = array())
{
$query = new DbQuery();
$query->from('cms', 'c');
$query->select('COUNT(1) c');
$query->join('LEFT JOIN ' . self::getTableName() . ' sc ON sc.id_cms = c.id_cms');
$query->join('LEFT JOIN `' . _DB_PREFIX_ . 'cms_lang` cl ON cl.id_cms = c.id_cms');
$query->join('LEFT JOIN `' . _DB_PREFIX_ . 'cms_shop` cs ON cs.id_cms = c.id_cms');
$filters = isset($params['filter'])? $params['filter'] : array();
if (ArSeoProTools::isColumnExists(_DB_PREFIX_ . 'cms_lang', 'id_shop')) {
$where = self::processFilters($filters, array(
'cl.id_lang = ' . (int)Context::getContext()->language->id,
'cs.id_shop = ' . (int)Context::getContext()->shop->id,
'cl.id_shop = ' . (int)Context::getContext()->shop->id
));
} else {
$where = self::processFilters($filters, array(
'cl.id_lang = ' . (int)Context::getContext()->language->id,
'cs.id_shop = ' . (int)Context::getContext()->shop->id
));
}
$query->where($where);
$res = Db::getInstance()->getRow($query);
return $res['c'];
}
public static function getAll($params = array())
{
$pageSize = isset($params['selected_pagination'])? $params['selected_pagination'] : 50;
$page = isset($params['page'])? $params['page'] - 1 : 0;
$offset = isset($params['page'])? $pageSize * $page : 0;
$query = new DbQuery();
$query->from('cms', 'c');
$query->limit($pageSize, $offset);
$query->join('LEFT JOIN ' . self::getTableName() . ' sc ON sc.id_cms = c.id_cms');
$query->join('LEFT JOIN `' . _DB_PREFIX_ . 'cms_lang` cl ON cl.id_cms = c.id_cms');
$query->join('LEFT JOIN `' . _DB_PREFIX_ . 'cms_shop` cs ON cs.id_cms = c.id_cms');
$query->select('c.id_cms, cl.meta_title, cs.id_shop, IF(sc.export IS NOT NULL, sc.export, 0) AS export, sc.id_sitemap');
$query->orderBy('c.id_cms ASC');
$filters = isset($params['filter'])? $params['filter'] : array();
if (ArSeoProTools::isColumnExists(_DB_PREFIX_ . 'cms_lang', 'id_shop')) {
$where = self::processFilters($filters, array(
'cl.id_lang = ' . (int)Context::getContext()->language->id,
'cs.id_shop = ' . (int)Context::getContext()->shop->id,
'cl.id_shop = ' . (int)Context::getContext()->shop->id
));
} else {
$where = self::processFilters($filters, array(
'cl.id_lang = ' . (int)Context::getContext()->language->id,
'cs.id_shop = ' . (int)Context::getContext()->shop->id
));
}
$query->where($where);
return Db::getInstance()->executeS($query);
}
public static function processFilters($params, $initParams = array())
{
$where = $initParams;
$model = new self();
foreach ($params as $k => $value) {
if (property_exists($model, $k) && $value != '') {
if ($k == 'id') {
$k = 'id_cms';
if (strpos($value, '%') !== false) {
$where[] = "c.`" . $k . "` LIKE '" . pSQL($value) . "'";
} else {
$where[] = "c.`" . $k . "` = '" . pSQL($value) . "'";
}
}
if ($k == 'export') {
if ($value) {
$where[] = "sc.`" . $k . "` = '" . pSQL($value) . "'";
} else {
$where[] = "(sc.`" . $k . "` IS NULL OR sc.`" . $k . "` = 0)";
}
}
} elseif (in_array($k, array('id_cms', 'name'))) {
if (!empty($value)) {
if (strpos($value, '%') !== false) {
$where[] = "cl.`" . $k . "` LIKE '" . pSQL($value) . "'";
} else {
$where[] = "cl.`" . $k . "` = '" . pSQL($value) . "'";
}
}
} elseif (in_array($k, array('reference'))) {
if (!empty($value)) {
if (strpos($value, '%') !== false) {
$where[] = "c.`" . $k . "` LIKE '" . pSQL($value) . "'";
} else {
$where[] = "c.`" . $k . "` = '" . pSQL($value) . "'";
}
}
}
}
return implode(' AND ', $where);
}
public static function truncate()
{
return Db::getInstance()->execute('TRUNCATE `' . self::getTableName() . '`');
}
}

View File

@@ -0,0 +1,153 @@
<?php
/**
* 2012-2018 Areama
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 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/afl-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 license@areama.net so we can send you a copy immediately.
*
* @author Areama <contact@areama.net>
* @copyright 2018 Areama
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of Areama
*/
include_once dirname(__FILE__).'/../../ArSeoProTableAbstract.php';
class ArSeoProSitemapManufacturer extends ArSeoProTableAbstract
{
const TABLE_NAME = 'arseopro_sitemap_manufacturer';
public $id_sitemap;
public $id_manufacturer;
public $id_shop;
public $export;
public $updated_at;
/**
* @see ObjectModel::$definition
*/
public static $definition = array(
'table' => self::TABLE_NAME,
'primary' => 'id_sitemap',
'multilang' => false,
'fields' => array(
'id_sitemap' => array('type' => self::TYPE_INT, 'validate' => 'isInt'),
'id_manufacturer' => array('type' => self::TYPE_INT, 'validate' => 'isInt'),
'id_shop' => array('type' => self::TYPE_INT, 'validate' => 'isInt'),
'export' => array('type' => self::TYPE_INT, 'validate' => 'isInt'),
'updated_at' => array('type' => self::TYPE_STRING)
),
);
public static function getTableName($withPrefix = true)
{
return $withPrefix? (_DB_PREFIX_ . self::TABLE_NAME) : self::TABLE_NAME;
}
public static function uninstallTable()
{
return Db::getInstance()->execute('DROP TABLE IF EXISTS `' . self::getTableName() . '`');
}
public static function installTable()
{
$sql = "CREATE TABLE IF NOT EXISTS `" . self::getTableName() . "` (
`id_sitemap` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT,
`id_manufacturer` INT(11) UNSIGNED NOT NULL,
`id_shop` INT(11) UNSIGNED NOT NULL DEFAULT '1',
`export` TINYINT(1) UNSIGNED NOT NULL DEFAULT '1',
`updated_at` DATETIME NULL DEFAULT NULL,
PRIMARY KEY (`id_sitemap`),
INDEX `id_manufacturer` (`id_manufacturer`),
INDEX `id_shop` (`id_shop`),
INDEX `export` (`export`)
)
COLLATE='utf8_general_ci'";
return Db::getInstance()->execute($sql);
}
public static function getCount($params = array())
{
$query = new DbQuery();
$query->from('manufacturer', 'm');
$query->select('COUNT(1) c');
$query->join('LEFT JOIN ' . self::getTableName() . ' sm ON sm.id_manufacturer = m.id_manufacturer');
$query->join('LEFT JOIN `' ._DB_PREFIX_ . 'manufacturer_shop` ms ON ms.id_manufacturer = m.id_manufacturer');
$filters = isset($params['filter'])? $params['filter'] : array();
$where = self::processFilters($filters, array(
'ms.id_shop = ' . (int)Context::getContext()->shop->id
));
$query->where($where);
$res = Db::getInstance()->getRow($query);
return $res['c'];
}
public static function getAll($params = array())
{
$pageSize = isset($params['selected_pagination'])? $params['selected_pagination'] : 50;
$page = isset($params['page'])? $params['page'] - 1 : 0;
$offset = isset($params['page'])? $pageSize * $page : 0;
$query = new DbQuery();
$query->from('manufacturer', 'm');
$query->limit((int)$pageSize, (int)$offset);
$query->join('LEFT JOIN `' . self::getTableName() . '` sm ON sm.id_manufacturer = m.id_manufacturer');
$query->join('LEFT JOIN `' ._DB_PREFIX_ . 'manufacturer_shop` ms ON ms.id_manufacturer = m.id_manufacturer');
$query->select('m.id_manufacturer, m.name, m.id_manufacturer, ms.id_shop, IF(sm.export IS NOT NULL, sm.export, 0) AS export, sm.id_sitemap');
$query->orderBy('m.id_manufacturer ASC');
$filters = isset($params['filter'])? $params['filter'] : array();
$where = self::processFilters($filters, array(
'ms.id_shop = ' . (int)Context::getContext()->shop->id
));
$query->where($where);
return Db::getInstance()->executeS($query);
}
public static function processFilters($params, $initParams = array())
{
$where = $initParams;
$model = new self();
foreach ($params as $k => $value) {
if (property_exists($model, $k) && $value != '') {
if ($k == 'id') {
$k = 'id_manufacturer';
if (strpos($value, '%') !== false) {
$where[] = "m.`" . $k . "` LIKE '" . pSQL($value) . "'";
} else {
$where[] = "m.`" . $k . "` = '" . pSQL($value) . "'";
}
}
if ($k == 'export') {
if ($value) {
$where[] = "sm.`" . $k . "` = '" . pSQL($value) . "'";
} else {
$where[] = "(sm.`" . $k . "` IS NULL OR sm.`" . $k . "` = 0)";
}
}
} elseif (in_array($k, array('id_manufacturer', 'name'))) {
if (!empty($value)) {
if (strpos($value, '%') !== false) {
$where[] = "m.`" . $k . "` LIKE '" . pSQL($value) . "'";
} else {
$where[] = "m.`" . $k . "` = '" . pSQL($value) . "'";
}
}
}
}
return implode(' AND ', $where);
}
public static function truncate()
{
return Db::getInstance()->execute('TRUNCATE `' . self::getTableName() . '`');
}
}

View File

@@ -0,0 +1,172 @@
<?php
/**
* 2012-2018 Areama
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 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/afl-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 license@areama.net so we can send you a copy immediately.
*
* @author Areama <contact@areama.net>
* @copyright 2018 Areama
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of Areama
*/
include_once dirname(__FILE__).'/../../ArSeoProTableAbstract.php';
class ArSeoProSitemapMetaPages extends ArSeoProTableAbstract
{
const TABLE_NAME = 'arseopro_sitemap_meta';
public $id_sitemap;
public $id_meta;
public $id_shop;
public $export;
public $updated_at;
/**
* @see ObjectModel::$definition
*/
public static $definition = array(
'table' => self::TABLE_NAME,
'primary' => 'id_sitemap',
'multilang' => false,
'fields' => array(
'id_sitemap' => array('type' => self::TYPE_INT, 'validate' => 'isInt'),
'id_meta' => array('type' => self::TYPE_INT, 'validate' => 'isInt'),
'id_shop' => array('type' => self::TYPE_INT, 'validate' => 'isInt'),
'export' => array('type' => self::TYPE_INT, 'validate' => 'isInt'),
'updated_at' => array('type' => self::TYPE_STRING)
),
);
public static function getTableName($withPrefix = true)
{
return $withPrefix? (_DB_PREFIX_ . self::TABLE_NAME) : self::TABLE_NAME;
}
public static function uninstallTable()
{
return Db::getInstance()->execute('DROP TABLE IF EXISTS `' . self::getTableName() . '`');
}
public static function getInitialFilters($langs, $id_shop)
{
if (!is_array($langs)) {
$langs = (array)$langs;
}
foreach ($langs as $k => $v) {
$langs[$k] = (int)$v;
}
return array(
'ml.id_lang IN (' . implode(', ', $langs) . ')',
'(ml.url_rewrite IS NOT NULL AND ml.url_rewrite != "")',
'm.page NOT IN("pagenotfound", "index", "addresses", "discount", "history", "identity", "my-account", "order-follow", "order-slip", "attachment")',
'ml.id_shop = ' . (int)$id_shop
);
}
public static function installTable()
{
$sql = "CREATE TABLE IF NOT EXISTS `" . self::getTableName() . "` (
`id_sitemap` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT,
`id_meta` INT(11) UNSIGNED NOT NULL,
`id_shop` INT(11) UNSIGNED NOT NULL,
`export` TINYINT(1) UNSIGNED NOT NULL,
`updated_at` DATETIME NULL DEFAULT NULL,
PRIMARY KEY (`id_sitemap`),
INDEX `id_meta` (`id_meta`),
INDEX `id_shop` (`id_shop`),
INDEX `export` (`export`)
)
COLLATE='utf8_general_ci'";
return Db::getInstance()->execute($sql);
}
public static function getCount($params = array())
{
$query = new DbQuery();
$query->from('meta', 'm');
$query->select('COUNT(1) c');
$query->join('LEFT JOIN ' . self::getTableName() . ' sm ON sm.id_meta = m.id_meta');
$query->join('LEFT JOIN `' . _DB_PREFIX_ . 'meta_lang` ml ON ml.id_meta = m.id_meta');
$filters = isset($params['filter'])? $params['filter'] : array();
$where = self::processFilters($filters, self::getInitialFilters(Context::getContext()->language->id, Context::getContext()->shop->id));
$query->where($where);
$res = Db::getInstance()->getRow($query);
return $res['c'];
}
public static function getAll($params = array())
{
$pageSize = isset($params['selected_pagination'])? $params['selected_pagination'] : 50;
$page = isset($params['page'])? $params['page'] - 1 : 0;
$offset = isset($params['page'])? $pageSize * $page : 0;
$query = new DbQuery();
$query->from('meta', 'm');
$query->limit((int)$pageSize, (int)$offset);
$query->join('LEFT JOIN ' . self::getTableName() . ' sm ON sm.id_meta = m.id_meta');
$query->join('LEFT JOIN `' . _DB_PREFIX_ . 'meta_lang` ml ON ml.id_meta = m.id_meta');
$query->select('m.id_meta, ml.title, m.page, ml.id_shop, IF(sm.export IS NOT NULL, sm.export, 0) AS export, sm.id_sitemap');
$query->orderBy('m.id_meta ASC');
$filters = isset($params['filter'])? $params['filter'] : array();
$where = self::processFilters($filters, self::getInitialFilters(Context::getContext()->language->id, Context::getContext()->shop->id));
$query->where($where);
return Db::getInstance()->executeS($query);
}
public static function processFilters($params, $initPrams = array())
{
$where = $initPrams;
$model = new self();
foreach ($params as $k => $value) {
if (property_exists($model, $k) && $value != '') {
if ($k == 'id') {
$k = 'id_meta';
if (strpos($value, '%') !== false) {
$where[] = "m.`" . $k . "` LIKE '" . pSQL($value) . "'";
} else {
$where[] = "m.`" . $k . "` = '" . pSQL($value) . "'";
}
}
if ($k == 'export') {
if ($value) {
$where[] = "sm.`" . $k . "` = '" . pSQL($value) . "'";
} else {
$where[] = "(sm.`" . $k . "` IS NULL OR sm.`" . $k . "` = 0)";
}
}
} elseif (in_array($k, array('id_meta', 'name'))) {
if (!empty($value)) {
if (strpos($value, '%') !== false) {
$where[] = "ml.`" . $k . "` LIKE '" . pSQL($value) . "'";
} else {
$where[] = "ml.`" . $k . "` = '" . pSQL($value) . "'";
}
}
} elseif (in_array($k, array('reference'))) {
if (!empty($value)) {
if (strpos($value, '%') !== false) {
$where[] = "m.`" . $k . "` LIKE '" . pSQL($value) . "'";
} else {
$where[] = "m.`" . $k . "` = '" . pSQL($value) . "'";
}
}
}
}
return implode(' AND ', $where);
}
public static function truncate()
{
return Db::getInstance()->execute('TRUNCATE `' . self::getTableName() . '`');
}
}

View File

@@ -0,0 +1,165 @@
<?php
/**
* 2012-2018 Areama
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 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/afl-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 license@areama.net so we can send you a copy immediately.
*
* @author Areama <contact@areama.net>
* @copyright 2018 Areama
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of Areama
*/
include_once dirname(__FILE__).'/../../ArSeoProTableAbstract.php';
class ArSeoProSitemapProduct extends ArSeoProTableAbstract
{
const TABLE_NAME = 'arseopro_sitemap_product';
public $id_sitemap;
public $id_product;
public $id_shop;
public $export;
public $updated_at;
/**
* @see ObjectModel::$definition
*/
public static $definition = array(
'table' => self::TABLE_NAME,
'primary' => 'id_sitemap',
'multilang' => false,
'fields' => array(
'id_sitemap' => array('type' => self::TYPE_INT, 'validate' => 'isInt'),
'id_product' => array('type' => self::TYPE_INT, 'validate' => 'isInt'),
'id_shop' => array('type' => self::TYPE_INT, 'validate' => 'isInt'),
'export' => array('type' => self::TYPE_INT, 'validate' => 'isInt'),
'updated_at' => array('type' => self::TYPE_STRING)
),
);
public static function getTableName($withPrefix = true)
{
return $withPrefix? (_DB_PREFIX_ . self::TABLE_NAME) : self::TABLE_NAME;
}
public static function uninstallTable()
{
return Db::getInstance()->execute('DROP TABLE IF EXISTS `' . self::getTableName() . '`');
}
public static function installTable()
{
$sql = "CREATE TABLE IF NOT EXISTS `" . self::getTableName() . "` (
`id_sitemap` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT,
`id_product` INT(11) UNSIGNED NOT NULL,
`id_shop` INT(11) UNSIGNED NOT NULL,
`export` TINYINT(1) UNSIGNED NOT NULL,
`updated_at` DATETIME NULL DEFAULT NULL,
PRIMARY KEY (`id_sitemap`),
INDEX `id_product` (`id_product`),
INDEX `id_shop` (`id_shop`),
INDEX `export` (`export`)
)
COLLATE='utf8_general_ci'";
return Db::getInstance()->execute($sql);
}
public static function getCount($params = array())
{
$query = new DbQuery();
$query->from('product', 'p');
$query->select('COUNT(1) c');
$query->join('LEFT JOIN ' . self::getTableName() . ' sp ON sp.id_product = p.id_product');
$query->join('LEFT JOIN `' . _DB_PREFIX_ . 'product_lang` pl ON pl.id_product = p.id_product');
$query->join('LEFT JOIN `' . _DB_PREFIX_ . 'product_shop` ps ON ps.id_product = p.id_product');
$filters = isset($params['filter'])? $params['filter'] : array();
$where = self::processFilters($filters, array(
'pl.id_lang = ' . (int)Context::getContext()->language->id,
'pl.id_shop = ' . (int)Context::getContext()->shop->id,
'ps.id_shop = ' . (int)Context::getContext()->shop->id,
));
$query->where($where);
$res = Db::getInstance()->getRow($query);
return $res['c'];
}
public static function getAll($params = array())
{
$pageSize = isset($params['selected_pagination'])? $params['selected_pagination'] : 50;
$page = isset($params['page'])? $params['page'] - 1 : 0;
$offset = isset($params['page'])? $pageSize * $page : 0;
$query = new DbQuery();
$query->from('product', 'p');
$query->limit($pageSize, $offset);
$query->join('LEFT JOIN ' . self::getTableName() . ' sp ON sp.id_product = p.id_product');
$query->join('LEFT JOIN `' . _DB_PREFIX_ . 'product_lang` pl ON pl.id_product = p.id_product');
$query->join('LEFT JOIN `' . _DB_PREFIX_ . 'product_shop` ps ON ps.id_product = p.id_product');
$query->select('p.id_product, pl.name, pl.id_shop, p.reference, IF(sp.export IS NOT NULL, sp.export, 0) AS export, sp.id_sitemap');
$query->orderBy('p.id_product ASC');
$filters = isset($params['filter'])? $params['filter'] : array();
$where = self::processFilters($filters, array(
'pl.id_lang = ' . (int)Context::getContext()->language->id,
'pl.id_shop = ' . (int)Context::getContext()->shop->id,
'ps.id_shop = ' . (int)Context::getContext()->shop->id,
));
$query->where($where);
return Db::getInstance()->executeS($query);
}
public static function processFilters($params, $initParams = array())
{
$where = $initParams;
$model = new self();
foreach ($params as $k => $value) {
if (property_exists($model, $k) && $value != '') {
if ($k == 'id') {
$k = 'id_product';
if (strpos($value, '%') !== false) {
$where[] = "p.`" . $k . "` LIKE '" . pSQL($value) . "'";
} else {
$where[] = "p.`" . $k . "` = '" . pSQL($value) . "'";
}
}
if ($k == 'export') {
if ($value) {
$where[] = "sp.`" . $k . "` = '" . pSQL($value) . "'";
} else {
$where[] = "(sp.`" . $k . "` IS NULL OR sp.`" . $k . "` = 0)";
}
}
} elseif (in_array($k, array('id_product', 'name'))) {
if (!empty($value)) {
if (strpos($value, '%') !== false) {
$where[] = "pl.`" . $k . "` LIKE '" . pSQL($value) . "'";
} else {
$where[] = "pl.`" . $k . "` = '" . pSQL($value) . "'";
}
}
} elseif (in_array($k, array('reference'))) {
if (!empty($value)) {
if (strpos($value, '%') !== false) {
$where[] = "p.`" . $k . "` LIKE '" . pSQL($value) . "'";
} else {
$where[] = "p.`" . $k . "` = '" . pSQL($value) . "'";
}
}
}
}
return implode(' AND ', $where);
}
public static function truncate()
{
return Db::getInstance()->execute('TRUNCATE `' . self::getTableName() . '`');
}
}

View File

@@ -0,0 +1,151 @@
<?php
/**
* 2012-2018 Areama
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 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/afl-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 license@areama.net so we can send you a copy immediately.
*
* @author Areama <contact@areama.net>
* @copyright 2018 Areama
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of Areama
*/
include_once dirname(__FILE__).'/../../ArSeoProTableAbstract.php';
class ArSeoProSitemapSupplier extends ArSeoProTableAbstract
{
const TABLE_NAME = 'arseopro_sitemap_supplier';
public $id_sitemap;
public $id_supplier;
public $id_shop;
public $export;
public $updated_at;
/**
* @see ObjectModel::$definition
*/
public static $definition = array(
'table' => self::TABLE_NAME,
'primary' => 'id_sitemap',
'multilang' => false,
'fields' => array(
'id_sitemap' => array('type' => self::TYPE_INT, 'validate' => 'isInt'),
'id_supplier' => array('type' => self::TYPE_INT, 'validate' => 'isInt'),
'id_shop' => array('type' => self::TYPE_INT, 'validate' => 'isInt'),
'export' => array('type' => self::TYPE_INT, 'validate' => 'isInt'),
'updated_at' => array('type' => self::TYPE_STRING)
),
);
public static function getTableName($withPrefix = true)
{
return $withPrefix? (_DB_PREFIX_ . self::TABLE_NAME) : self::TABLE_NAME;
}
public static function uninstallTable()
{
return Db::getInstance()->execute('DROP TABLE IF EXISTS `' . self::getTableName() . '`');
}
public static function installTable()
{
$sql = "CREATE TABLE IF NOT EXISTS `" . self::getTableName() . "` (
`id_sitemap` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT,
`id_supplier` INT(11) UNSIGNED NOT NULL,
`id_shop` INT(11) UNSIGNED NOT NULL,
`export` TINYINT(1) UNSIGNED NOT NULL DEFAULT '1',
`updated_at` DATETIME NULL DEFAULT NULL,
PRIMARY KEY (`id_sitemap`),
INDEX `id_supplier` (`id_supplier`),
INDEX `id_shop` (`id_shop`),
INDEX `export` (`export`)
)
COLLATE='utf8_general_ci'";
return Db::getInstance()->execute($sql);
}
public static function getCount($params = array())
{
$query = new DbQuery();
$query->from('supplier', 's');
$query->select('COUNT(1) c');
$query->join('LEFT JOIN ' . self::getTableName() . ' ss ON ss.id_supplier = s.id_supplier');
$query->join('LEFT JOIN ' . _DB_PREFIX_ . 'supplier_shop sh ON sh.id_supplier = s.id_supplier');
$filters = isset($params['filter'])? $params['filter'] : array();
$where = self::processFilters($filters, array(
'sh.id_shop = ' . (int)Context::getContext()->shop->id
));
$query->where($where);
$res = Db::getInstance()->getRow($query);
return $res['c'];
}
public static function getAll($params = array())
{
$pageSize = isset($params['selected_pagination'])? $params['selected_pagination'] : 50;
$page = isset($params['page'])? $params['page'] - 1 : 0;
$offset = isset($params['page'])? $pageSize * $page : 0;
$query = new DbQuery();
$query->from('supplier', 's');
$query->limit($pageSize, $offset);
$query->join('LEFT JOIN ' . self::getTableName() . ' ss ON ss.id_supplier = s.id_supplier');
$query->join('LEFT JOIN ' . _DB_PREFIX_ . 'supplier_shop sh ON sh.id_supplier = s.id_supplier');
$query->select('s.id_supplier, s.name, s.id_supplier, sh.id_shop, IF(ss.export IS NOT NULL, ss.export, 0) AS export, ss.id_sitemap');
$query->orderBy('s.id_supplier ASC');
$filters = isset($params['filter'])? $params['filter'] : array();
$where = self::processFilters($filters, array(
'sh.id_shop = ' . (int)Context::getContext()->shop->id
));
$query->where($where);
return Db::getInstance()->executeS($query);
}
public static function processFilters($params, $initPrams = array())
{
$where = $initPrams;
$model = new self();
foreach ($params as $k => $value) {
if (property_exists($model, $k) && $value != '') {
if ($k == 'id') {
$k = 'id_supplier';
if (strpos($value, '%') !== false) {
$where[] = "s.`" . $k . "` LIKE '" . pSQL($value) . "'";
} else {
$where[] = "s.`" . $k . "` = '" . pSQL($value) . "'";
}
}
if ($k == 'export') {
if ($value) {
$where[] = "ss.`" . $k . "` = '" . pSQL($value) . "'";
} else {
$where[] = "(ss.`" . $k . "` IS NULL OR ss.`" . $k . "` = 0)";
}
}
} elseif (in_array($k, array('id_supplier', 'name'))) {
if (!empty($value)) {
if (strpos($value, '%') !== false) {
$where[] = "s.`" . $k . "` LIKE '" . pSQL($value) . "'";
} else {
$where[] = "s.`" . $k . "` = '" . pSQL($value) . "'";
}
}
}
}
return implode(' AND ', $where);
}
public static function truncate()
{
return Db::getInstance()->execute('TRUNCATE `' . self::getTableName() . '`');
}
}

View File

@@ -0,0 +1,31 @@
<?php
/*
* 2018 Areama
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 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/afl-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 license@areama.net so we can send you a copy immediately.
*
*
* @author Areama <contact@areama.net>
* @copyright 2018 Areama
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of Areama
*/
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');
header('Cache-Control: no-store, no-cache, must-revalidate');
header('Cache-Control: post-check=0, pre-check=0', false);
header('Pragma: no-cache');
header('Location: ../../../');
exit;