- {else}
- {$smarty.block.parent}
- {/if}
-{/block}
diff --git a/modules/blockbestsellers/CHANGELOG.txt b/modules/blockbestsellers/CHANGELOG.txt
deleted file mode 100644
index 5ddb96c32..000000000
--- a/modules/blockbestsellers/CHANGELOG.txt
+++ /dev/null
@@ -1,4 +0,0 @@
-2014-04-22 18:56:53 +0200 // Changelog updated
-2014-03-24 11:43:28 +0100 / MO blockbestsellers : ps_versions_compliancy modified (1.5.6.1 => 1.6)
-2014-03-24 10:59:58 +0100 // MO blockbestsellers : ps_versions_compliancy added
-2014-03-20 14:20:39 +0100 Initial commit
diff --git a/modules/blockbestsellers/Readme.md b/modules/blockbestsellers/Readme.md
deleted file mode 100644
index 54407fbd2..000000000
--- a/modules/blockbestsellers/Readme.md
+++ /dev/null
@@ -1,37 +0,0 @@
-# Top-sellers block
-
-## About
-
-Adds a block displaying your store\'s top-selling products.
-
-## Contributing
-
-PrestaShop modules are open-source extensions to the PrestaShop e-commerce solution. Everyone is welcome and even encouraged to contribute with their own improvements.
-
-### Requirements
-
-Contributors **must** follow the following rules:
-
-* **Make your Pull Request on the "dev" branch**, NOT the "master" branch.
-* Do not update the module's version number.
-* Follow [the coding standards][1].
-
-### Process in details
-
-Contributors wishing to edit a module's files should follow the following process:
-
-1. Create your GitHub account, if you do not have one already.
-2. Fork the blockbestsellers project to your GitHub account.
-3. Clone your fork to your local machine in the ```/modules``` directory of your PrestaShop installation.
-4. Create a branch in your local clone of the module for your changes.
-5. Change the files in your branch. Be sure to follow [the coding standards][1]!
-6. Push your changed branch to your fork in your GitHub account.
-7. Create a pull request for your changes **on the _'dev'_ branch** of the module's project. Be sure to follow [the commit message norm][2] in your pull request. If you need help to make a pull request, read the [Github help page about creating pull requests][3].
-8. Wait for one of the core developers either to include your change in the codebase, or to comment on possible improvements you should make to your code.
-
-That's it: you have contributed to this open-source project! Congratulations!
-
-[1]: http://doc.prestashop.com/display/PS16/Coding+Standards
-[2]: http://doc.prestashop.com/display/PS16/How+to+write+a+commit+message
-[3]: https://help.github.com/articles/using-pull-requests
-
diff --git a/modules/blockbestsellers/blockbestsellers.php b/modules/blockbestsellers/blockbestsellers.php
deleted file mode 100644
index fb5b87db2..000000000
--- a/modules/blockbestsellers/blockbestsellers.php
+++ /dev/null
@@ -1,273 +0,0 @@
-
-* @copyright 2007-2015 PrestaShop SA
-* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
-* International Registered Trademark & Property of PrestaShop SA
-*/
-
-if (!defined('_PS_VERSION_'))
- exit;
-
-class BlockBestSellers extends Module
-{
- protected static $cache_best_sellers;
-
- public function __construct()
- {
- $this->name = 'blockbestsellers';
- $this->tab = 'front_office_features';
- $this->version = '1.7.0';
- $this->author = 'PrestaShop';
- $this->need_instance = 0;
- $this->bootstrap = true;
-
- parent::__construct();
-
- $this->displayName = $this->l('Top-sellers block');
- $this->description = $this->l('Adds a block displaying your store\'s top-selling products.');
- $this->ps_versions_compliancy = array('min' => '1.6', 'max' => _PS_VERSION_);
- }
-
- public function install()
- {
- $this->_clearCache('*');
-
- if (!parent::install()
- || !$this->registerHook('header')
- || !$this->registerHook('leftColumn')
- || !$this->registerHook('actionOrderStatusPostUpdate')
- || !$this->registerHook('addproduct')
- || !$this->registerHook('updateproduct')
- || !$this->registerHook('deleteproduct')
- || !$this->registerHook('displayHomeTab')
- || !$this->registerHook('displayHomeTabContent')
- || !ProductSale::fillProductSales()
- )
- return false;
-
- Configuration::updateValue('PS_BLOCK_BESTSELLERS_TO_DISPLAY', 10);
-
- return true;
- }
-
- public function uninstall()
- {
- $this->_clearCache('*');
-
- return parent::uninstall();
- }
-
- public function hookAddProduct($params)
- {
- $this->_clearCache('*');
- }
-
- public function hookUpdateProduct($params)
- {
- $this->_clearCache('*');
- }
-
- public function hookDeleteProduct($params)
- {
- $this->_clearCache('*');
- }
-
- public function hookActionOrderStatusPostUpdate($params)
- {
- $this->_clearCache('*');
- }
-
- public function _clearCache($template, $cache_id = null, $compile_id = null)
- {
- parent::_clearCache('blockbestsellers.tpl', 'blockbestsellers-col');
- parent::_clearCache('blockbestsellers-home.tpl', 'blockbestsellers-home');
- parent::_clearCache('tab.tpl', 'blockbestsellers-tab');
- }
-
- /**
- * Called in administration -> module -> configure
- */
- public function getContent()
- {
- $output = '';
- if (Tools::isSubmit('submitBestSellers'))
- {
- Configuration::updateValue('PS_BLOCK_BESTSELLERS_DISPLAY', (int)Tools::getValue('PS_BLOCK_BESTSELLERS_DISPLAY'));
- Configuration::updateValue('PS_BLOCK_BESTSELLERS_TO_DISPLAY', (int)Tools::getValue('PS_BLOCK_BESTSELLERS_TO_DISPLAY'));
- $this->_clearCache('*');
- $output .= $this->displayConfirmation($this->l('Settings updated'));
- }
-
- return $output.$this->renderForm();
- }
-
- public function renderForm()
- {
- $fields_form = array(
- 'form' => array(
- 'legend' => array(
- 'title' => $this->l('Settings'),
- 'icon' => 'icon-cogs'
- ),
- 'input' => array(
- array(
- 'type' => 'text',
- 'label' => $this->l('Products to display'),
- 'name' => 'PS_BLOCK_BESTSELLERS_TO_DISPLAY',
- 'desc' => $this->l('Determine the number of product to display in this block'),
- 'class' => 'fixed-width-xs',
- ),
- array(
- 'type' => 'switch',
- 'label' => $this->l('Always display this block'),
- 'name' => 'PS_BLOCK_BESTSELLERS_DISPLAY',
- 'desc' => $this->l('Show the block even if no best sellers are available.'),
- 'is_bool' => true,
- 'values' => array(
- array(
- 'id' => 'active_on',
- 'value' => 1,
- 'label' => $this->l('Enabled')
- ),
- array(
- 'id' => 'active_off',
- 'value' => 0,
- 'label' => $this->l('Disabled')
- )
- ),
- )
- ),
- 'submit' => array(
- 'title' => $this->l('Save')
- )
- )
- );
-
- $helper = new HelperForm();
- $helper->show_toolbar = false;
- $helper->table = $this->table;
- $lang = new Language((int)Configuration::get('PS_LANG_DEFAULT'));
- $helper->default_form_language = $lang->id;
- $helper->allow_employee_form_lang = Configuration::get('PS_BO_ALLOW_EMPLOYEE_FORM_LANG') ? Configuration::get('PS_BO_ALLOW_EMPLOYEE_FORM_LANG') : 0;
- $this->fields_form = array();
-
- $helper->identifier = $this->identifier;
- $helper->submit_action = 'submitBestSellers';
- $helper->currentIndex = $this->context->link->getAdminLink('AdminModules', false).'&configure='.$this->name.'&tab_module='.$this->tab.'&module_name='.$this->name;
- $helper->token = Tools::getAdminTokenLite('AdminModules');
- $helper->tpl_vars = array(
- 'fields_value' => $this->getConfigFieldsValues(),
- 'languages' => $this->context->controller->getLanguages(),
- 'id_language' => $this->context->language->id
- );
-
- return $helper->generateForm(array($fields_form));
- }
-
- public function getConfigFieldsValues()
- {
- return array(
- 'PS_BLOCK_BESTSELLERS_TO_DISPLAY' => (int)Tools::getValue('PS_BLOCK_BESTSELLERS_TO_DISPLAY', Configuration::get('PS_BLOCK_BESTSELLERS_TO_DISPLAY')),
- 'PS_BLOCK_BESTSELLERS_DISPLAY' => (int)Tools::getValue('PS_BLOCK_BESTSELLERS_DISPLAY', Configuration::get('PS_BLOCK_BESTSELLERS_DISPLAY')),
- );
- }
-
- public function hookHeader($params)
- {
- if (Configuration::get('PS_CATALOG_MODE'))
- return;
- if (isset($this->context->controller->php_self) && $this->context->controller->php_self == 'index')
- $this->context->controller->addCSS(_THEME_CSS_DIR_.'product_list.css');
- $this->context->controller->addCSS($this->_path.'blockbestsellers.css', 'all');
- }
-
- public function hookDisplayHomeTab($params)
- {
- if (!$this->isCached('tab.tpl', $this->getCacheId('blockbestsellers-tab')))
- {
- BlockBestSellers::$cache_best_sellers = $this->getBestSellers($params);
- $this->smarty->assign('best_sellers', BlockBestSellers::$cache_best_sellers);
- }
-
- if (BlockBestSellers::$cache_best_sellers === false)
- return false;
-
- return $this->display(__FILE__, 'tab.tpl', $this->getCacheId('blockbestsellers-tab'));
- }
-
- public function hookDisplayHomeTabContent($params)
- {
- if (!$this->isCached('blockbestsellers-home.tpl', $this->getCacheId('blockbestsellers-home')))
- {
- $this->smarty->assign(array(
- 'best_sellers' => BlockBestSellers::$cache_best_sellers,
- 'homeSize' => Image::getSize(ImageType::getFormatedName('home'))
- ));
- }
-
- if (BlockBestSellers::$cache_best_sellers === false)
- return false;
-
- return $this->display(__FILE__, 'blockbestsellers-home.tpl', $this->getCacheId('blockbestsellers-home'));
- }
-
- public function hookRightColumn($params)
- {
- if (!$this->isCached('blockbestsellers.tpl', $this->getCacheId('blockbestsellers-col')))
- {
- if (!isset(BlockBestSellers::$cache_best_sellers))
- BlockBestSellers::$cache_best_sellers = $this->getBestSellers($params);
- $this->smarty->assign(array(
- 'best_sellers' => BlockBestSellers::$cache_best_sellers,
- 'display_link_bestsellers' => Configuration::get('PS_DISPLAY_BEST_SELLERS'),
- 'mediumSize' => Image::getSize(ImageType::getFormatedName('medium')),
- 'smallSize' => Image::getSize(ImageType::getFormatedName('small'))
- ));
- }
-
- if (BlockBestSellers::$cache_best_sellers === false)
- return false;
-
- return $this->display(__FILE__, 'blockbestsellers.tpl', $this->getCacheId('blockbestsellers-col'));
- }
-
- public function hookLeftColumn($params)
- {
- return $this->hookRightColumn($params);
- }
-
- protected function getBestSellers($params)
- {
- if (Configuration::get('PS_CATALOG_MODE'))
- return false;
-
- if (!($result = ProductSale::getBestSalesLight((int)$params['cookie']->id_lang, 0, (int)Configuration::get('PS_BLOCK_BESTSELLERS_TO_DISPLAY'))))
- return (Configuration::get('PS_BLOCK_BESTSELLERS_DISPLAY') ? array() : false);
-
- $currency = new Currency($params['cookie']->id_currency);
- $usetax = (Product::getTaxCalculationMethod((int)$this->context->customer->id) != PS_TAX_EXC);
- foreach ($result as &$row)
- $row['price'] = Tools::displayPrice(Product::getPriceStatic((int)$row['id_product'], $usetax), $currency);
-
- return $result;
- }
-}
diff --git a/modules/blockbestsellers/composer.json b/modules/blockbestsellers/composer.json
deleted file mode 100644
index 91882ad0c..000000000
--- a/modules/blockbestsellers/composer.json
+++ /dev/null
@@ -1,19 +0,0 @@
-{
- "name": "PrestaShop/blockbestsellers",
- "description": "PrestaShop module blockbestsellers",
- "homepage": "https://github.com/PrestaShop/blockbestsellers",
- "license": "AFL - Academic Free License (AFL 3.0)",
- "authors": [
- {
- "name": "PrestaShop SA",
- "email": "contact@prestashop.com"
- }
- ],
- "require": {
- "php": ">=5.3.2"
- },
- "config": {
- "preferred-install": "dist"
- },
- "type": "prestashop-module"
-}
diff --git a/modules/blockbestsellers/css/blockbestsellers.css b/modules/blockbestsellers/css/blockbestsellers.css
deleted file mode 100644
index db88db52c..000000000
--- a/modules/blockbestsellers/css/blockbestsellers.css
+++ /dev/null
@@ -1,55 +0,0 @@
-/* Block best sellers */
-#best-sellers_block_right ul {margin-bottom:5px}
-#best-sellers_block_right li {
- float:none;
- padding:10px 0;
- border-bottom:1px dotted #ccc
-}
-#best-sellers_block_right li.last_item {border:none}
-#best-sellers_block_right li a.content_img {
- display:block;
- float:left;
- padding:1px;
- height:47px;
- width:67px;
- text-decoration:none;
- background:#333
-}
-#best-sellers_block_right li span.number {
- display:block;
- float:left;
- margin-top:6px;
- width:20px;
- font-weight:bold;
- font-size:18px;
- color:#fff;
- text-align:center
-}
-#best-sellers_block_right li img {
- border:1px solid #ededed;
-}
-#best-sellers_block_right li p {
- float:left;
- margin-left:7px;
- padding:0;
- width:125px;
- font-weight:bold;
- font-size:12px
-}
-#best-sellers_block_right li .price {
- font-weight:bold;
- font-size:14px;
- color:#990000;
-
-}
-
-#best-sellers_block_right p.lnk {
- padding:0;
- text-align:right
-}
-#best-sellers_block_right .lnk .button_large {
- padding:0;
- border:none;
- background:none
-}
-#best-sellers_block_right .lnk .button_large:hover {text-decoration:underline}
\ No newline at end of file
diff --git a/modules/blockbestsellers/img/index.php b/modules/blockbestsellers/img/index.php
deleted file mode 100644
index 044cb85ee..000000000
--- a/modules/blockbestsellers/img/index.php
+++ /dev/null
@@ -1,35 +0,0 @@
-
-* @copyright 2007-2015 PrestaShop SA
-* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
-* International Registered Trademark & Property of PrestaShop SA
-*/
-
-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;
\ No newline at end of file
diff --git a/modules/blockbestsellers/img/logo.gif b/modules/blockbestsellers/img/logo.gif
deleted file mode 100644
index 86b4e900d..000000000
Binary files a/modules/blockbestsellers/img/logo.gif and /dev/null differ
diff --git a/modules/blockbestsellers/index.php b/modules/blockbestsellers/index.php
deleted file mode 100644
index 3b0dc0312..000000000
--- a/modules/blockbestsellers/index.php
+++ /dev/null
@@ -1,35 +0,0 @@
-
-* @copyright 2007-2015 PrestaShop SA
-* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
-* International Registered Trademark & Property of PrestaShop SA
-*/
-
-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;
\ No newline at end of file
diff --git a/modules/blockbestsellers/logo.gif b/modules/blockbestsellers/logo.gif
deleted file mode 100644
index 86b4e900d..000000000
Binary files a/modules/blockbestsellers/logo.gif and /dev/null differ
diff --git a/modules/blockbestsellers/logo.png b/modules/blockbestsellers/logo.png
deleted file mode 100644
index a7a74dbae..000000000
Binary files a/modules/blockbestsellers/logo.png and /dev/null differ
diff --git a/modules/blockbestsellers/translations/index.php b/modules/blockbestsellers/translations/index.php
deleted file mode 100644
index 044cb85ee..000000000
--- a/modules/blockbestsellers/translations/index.php
+++ /dev/null
@@ -1,35 +0,0 @@
-
-* @copyright 2007-2015 PrestaShop SA
-* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
-* International Registered Trademark & Property of PrestaShop SA
-*/
-
-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;
\ No newline at end of file
diff --git a/modules/blockbestsellers/upgrade/install-1.2.php b/modules/blockbestsellers/upgrade/install-1.2.php
deleted file mode 100644
index 1c636719c..000000000
--- a/modules/blockbestsellers/upgrade/install-1.2.php
+++ /dev/null
@@ -1,9 +0,0 @@
-registerHook('addproduct') && $object->registerHook('updateproduct') && $object->registerHook('deleteproduct') && $object->registerHook('actionOrderStatusPostUpdate'));
-}
diff --git a/modules/blockbestsellers/upgrade/install-1.3.php b/modules/blockbestsellers/upgrade/install-1.3.php
deleted file mode 100644
index a9735d575..000000000
--- a/modules/blockbestsellers/upgrade/install-1.3.php
+++ /dev/null
@@ -1,9 +0,0 @@
-registerHook('displayHomeTab') && $object->registerHook('displayHomeTabContent'));
-}
diff --git a/modules/blockbestsellers/upgrade/install-1.5.5.php b/modules/blockbestsellers/upgrade/install-1.5.5.php
deleted file mode 100644
index 48e645b6e..000000000
--- a/modules/blockbestsellers/upgrade/install-1.5.5.php
+++ /dev/null
@@ -1,33 +0,0 @@
-
-* @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
-*/
-
-if (!defined('_PS_VERSION_'))
- exit;
-
-function upgrade_module_1_5_5($object)
-{
- return Configuration::updateValue('PS_BLOCK_BESTSELLERS_TO_DISPLAY', 10);
-}
diff --git a/modules/blockbestsellers/views/index.php b/modules/blockbestsellers/views/index.php
deleted file mode 100644
index 3b0dc0312..000000000
--- a/modules/blockbestsellers/views/index.php
+++ /dev/null
@@ -1,35 +0,0 @@
-
-* @copyright 2007-2015 PrestaShop SA
-* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
-* International Registered Trademark & Property of PrestaShop SA
-*/
-
-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;
\ No newline at end of file
diff --git a/modules/blockbestsellers/views/templates/hook/blockbestsellers-home.tpl b/modules/blockbestsellers/views/templates/hook/blockbestsellers-home.tpl
deleted file mode 100644
index f8d65f83a..000000000
--- a/modules/blockbestsellers/views/templates/hook/blockbestsellers-home.tpl
+++ /dev/null
@@ -1,32 +0,0 @@
-{*
-* 2007-2015 PrestaShop
-*
-* 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@prestashop.com 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
-* @copyright 2007-2015 PrestaShop SA
-
-* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
-* International Registered Trademark & Property of PrestaShop SA
-*}
-{if isset($best_sellers) && $best_sellers}
- {include file="$tpl_dir./product-list.tpl" products=$best_sellers class='blockbestsellers tab-pane' id='blockbestsellers'}
-{else}
-
-
{l s='No best sellers at this time.' mod='blockbestsellers'}
-
-{/if}
diff --git a/modules/blockbestsellers/views/templates/hook/blockbestsellers.tpl b/modules/blockbestsellers/views/templates/hook/blockbestsellers.tpl
deleted file mode 100644
index bb5d3e8a9..000000000
--- a/modules/blockbestsellers/views/templates/hook/blockbestsellers.tpl
+++ /dev/null
@@ -1,69 +0,0 @@
-{*
-* 2007-2015 PrestaShop
-*
-* 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@prestashop.com 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
-* @copyright 2007-2015 PrestaShop SA
-
-* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
-* International Registered Trademark & Property of PrestaShop SA
-*}
-
-
-
{l s='No best sellers at this time' mod='blockbestsellers'}
- {/if}
-
-
-
diff --git a/modules/blockbestsellers/views/templates/hook/index.php b/modules/blockbestsellers/views/templates/hook/index.php
deleted file mode 100644
index 3b0dc0312..000000000
--- a/modules/blockbestsellers/views/templates/hook/index.php
+++ /dev/null
@@ -1,35 +0,0 @@
-
-* @copyright 2007-2015 PrestaShop SA
-* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
-* International Registered Trademark & Property of PrestaShop SA
-*/
-
-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;
\ No newline at end of file
diff --git a/modules/blockbestsellers/views/templates/hook/tab.tpl b/modules/blockbestsellers/views/templates/hook/tab.tpl
deleted file mode 100644
index c6b795f42..000000000
--- a/modules/blockbestsellers/views/templates/hook/tab.tpl
+++ /dev/null
@@ -1,25 +0,0 @@
-{*
-* 2007-2015 PrestaShop
-*
-* 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@prestashop.com 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
-* @copyright 2007-2015 PrestaShop SA
-* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
-* International Registered Trademark & Property of PrestaShop SA
-*}
-
- {* Javascript moved here to fix bug #PSCFI-151 *}
-
-
-
-
-{/if}
diff --git a/modules/blockcategories/blockcategories_footer.tpl b/modules/blockcategories/blockcategories_footer.tpl
deleted file mode 100644
index 862b18d0a..000000000
--- a/modules/blockcategories/blockcategories_footer.tpl
+++ /dev/null
@@ -1,55 +0,0 @@
-{*
-* 2007-2016 PrestaShop
-*
-* 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@prestashop.com 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
-* @copyright 2007-2016 PrestaShop SA
-* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
-* International Registered Trademark & Property of PrestaShop SA
-*}
-
-
diff --git a/modules/blockcategories/category-tree-branch.tpl b/modules/blockcategories/category-tree-branch.tpl
deleted file mode 100644
index 5e92b6576..000000000
--- a/modules/blockcategories/category-tree-branch.tpl
+++ /dev/null
@@ -1,40 +0,0 @@
-{*
-* 2007-2016 PrestaShop
-*
-* 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@prestashop.com 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
-* @copyright 2007-2016 PrestaShop SA
-* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
-* International Registered Trademark & Property of PrestaShop SA
-*}
-
-
Lorem ipsum dolor sit amet conse ctetur voluptate velit esse cillum dolore eu
-
-
-
-
-
Dolor Sit Amet
-
Lorem ipsum dolor sit amet conse ctetur voluptate velit esse cillum dolore eu
-
-
-
-
-
Ctetur Voluptate
-
Lorem ipsum dolor sit amet conse ctetur voluptate velit esse cillum dolore eu
-
-
-
'
- ),
- array(
- 'text' => '
Custom Block
-
Lorem ipsum dolor sit amet conse ctetu
-
Sit amet conse ctetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit.
'
- ),
- );
-
- $shops_ids = Shop::getShops(true, null, true);
- $return = true;
- foreach ($tab_texts as $tab)
- {
- $info = new InfoBlock();
- foreach (Language::getLanguages(false) as $lang)
- $info->text[$lang['id_lang']] = $tab['text'];
- foreach ($shops_ids as $id_shop)
- {
- $info->id_shop = $id_shop;
- $return &= $info->add();
- }
- }
-
- return $return;
- }
-}
diff --git a/modules/blockcmsinfo/blockcmsinfo.tpl b/modules/blockcmsinfo/blockcmsinfo.tpl
deleted file mode 100644
index 13b8d4fc6..000000000
--- a/modules/blockcmsinfo/blockcmsinfo.tpl
+++ /dev/null
@@ -1,33 +0,0 @@
-{*
-* 2007-2016 PrestaShop
-*
-* 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@prestashop.com 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
-* @copyright 2007-2016 PrestaShop SA
-* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
-* International Registered Trademark & Property of PrestaShop SA
-*}
-{if $infos|@count > 0}
-
-
- {foreach from=$infos item=info}
-
{$info.text}
- {/foreach}
-
-
-{/if}
\ No newline at end of file
diff --git a/modules/blockcmsinfo/classes/InfoBlock.php b/modules/blockcmsinfo/classes/InfoBlock.php
deleted file mode 100644
index cc5a25de1..000000000
--- a/modules/blockcmsinfo/classes/InfoBlock.php
+++ /dev/null
@@ -1,49 +0,0 @@
-
-* @copyright 2007-2016 PrestaShop SA
-* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
-* International Registered Trademark & Property of PrestaShop SA
-*/
-
-class InfoBlock extends ObjectModel
-{
- public $id;
-
- public $id_shop;
-
- public $text;
-
- /**
- * @see ObjectModel::$definition
- */
- public static $definition = array(
- 'table' => 'info',
- 'primary' => 'id_info',
- 'multilang' => true,
- 'fields' => array(
- 'id_shop' => array('type' => self::TYPE_NOTHING, 'validate' => 'isUnsignedId'),
- // Lang fields
- 'text' => array('type' => self::TYPE_HTML, 'lang' => true, 'validate' => 'isCleanHtml', 'required' => true),
- )
- );
-
-}
diff --git a/modules/blockcmsinfo/index.php b/modules/blockcmsinfo/index.php
deleted file mode 100644
index da793c6b5..000000000
--- a/modules/blockcmsinfo/index.php
+++ /dev/null
@@ -1,35 +0,0 @@
-
-* @copyright 2007-2016 PrestaShop SA
-* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
-* International Registered Trademark & Property of PrestaShop SA
-*/
-
-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;
\ No newline at end of file
diff --git a/modules/blockcmsinfo/logo.gif b/modules/blockcmsinfo/logo.gif
deleted file mode 100644
index b29d6badd..000000000
Binary files a/modules/blockcmsinfo/logo.gif and /dev/null differ
diff --git a/modules/blockcmsinfo/logo.png b/modules/blockcmsinfo/logo.png
deleted file mode 100644
index 326506faf..000000000
Binary files a/modules/blockcmsinfo/logo.png and /dev/null differ
diff --git a/modules/blockcmsinfo/style.css b/modules/blockcmsinfo/style.css
deleted file mode 100644
index e69de29bb..000000000
diff --git a/modules/blockcmsinfo/translations/index.php b/modules/blockcmsinfo/translations/index.php
deleted file mode 100644
index e5064df41..000000000
--- a/modules/blockcmsinfo/translations/index.php
+++ /dev/null
@@ -1,35 +0,0 @@
-
-* @copyright 2007-2016 PrestaShop SA
-* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
-* International Registered Trademark & Property of PrestaShop SA
-*/
-
-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;
\ No newline at end of file
diff --git a/modules/blockcontact/CHANGELOG.txt b/modules/blockcontact/CHANGELOG.txt
deleted file mode 100644
index b18cba2ee..000000000
--- a/modules/blockcontact/CHANGELOG.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-2014-04-22 18:57:04 +0200 // Changelog updated
-2014-03-24 12:18:44 +0100 [*] MO : Remove "toll free" from blockcontact strings.
-2014-03-24 11:43:28 +0100 / MO blockcontact : ps_versions_compliancy modified (1.5.6.1 => 1.6)
-2014-03-24 11:01:44 +0100 / MO blockcontact : ps_versions_compliancy added
-2014-03-20 14:21:10 +0100 Initial commit
diff --git a/modules/blockcontact/blockcontact.css b/modules/blockcontact/blockcontact.css
deleted file mode 100644
index 92260328b..000000000
--- a/modules/blockcontact/blockcontact.css
+++ /dev/null
@@ -1,39 +0,0 @@
-/* block CONTACT ******************************************************************************* */
-#contact_block .block_content {
- padding:10px 0 15px 0;
- background: url(images/block_contact_bg.jpg) no-repeat left bottom transparent
-}
-
-#contact_block p {
- padding:0 5px 15px 5px;
- font-size: 13px;
- line-height: 18px
-}
-
-#contact_block .title_block, #contact_block h4 {
- padding:6px 11px;
- font-size: 12px;
- line-height: auto
-}
-#contact_block p.tel {
- margin:0 0 0 60px;
- padding-left: 26px;
- font: bold 11px/20px Arial, Verdana, sans-serif;
- background: url(images/block_contact_pict_tel.png) no-repeat 0 0 transparent
-}
-#contact_block a {
- display:block;
- margin-left:60px;
- padding:6px 8px;
- font:bold 10px Arial,Verdana,sans-serif;
- color:#fff;
- text-shadow:0 -1px 0 #000;
- text-transform:uppercase;
- -moz-border-radius:3px;
- -webkit-border-radius:3px;
- border-radius:3px;
- background:url(images/bloc_contact_a_bg.png) repeat-x 0 0 #000
-}
-#contact_block a:hover {text-decoration:none}
-
-#contact_block .label {display: none}
diff --git a/modules/blockcontact/blockcontact.php b/modules/blockcontact/blockcontact.php
deleted file mode 100644
index 00d11bb7e..000000000
--- a/modules/blockcontact/blockcontact.php
+++ /dev/null
@@ -1,168 +0,0 @@
-
-* @copyright 2007-2016 PrestaShop SA
-* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
-* International Registered Trademark & Property of PrestaShop SA
-*/
-
-if (!defined('_CAN_LOAD_FILES_'))
- exit;
-
-class Blockcontact extends Module
-{
- public function __construct()
- {
- $this->name = 'blockcontact';
- $this->author = 'PrestaShop';
- $this->tab = 'front_office_features';
- $this->version = '1.4.1';
-
- $this->bootstrap = true;
- parent::__construct();
-
- $this->displayName = $this->l('Contact block');
- $this->description = $this->l('Allows you to add additional information about your store\'s customer service.');
- $this->ps_versions_compliancy = array('min' => '1.6', 'max' => '1.6.99.99');
- }
-
- public function install()
- {
- return parent::install()
- && Configuration::updateValue('BLOCKCONTACT_TELNUMBER', '')
- && Configuration::updateValue('BLOCKCONTACT_EMAIL', '')
- && $this->registerHook('displayNav')
- && $this->registerHook('displayHeader');
- }
-
- public function uninstall()
- {
- // Delete configuration
- return Configuration::deleteByName('BLOCKCONTACT_TELNUMBER') && Configuration::deleteByName('BLOCKCONTACT_EMAIL') && parent::uninstall();
- }
-
- public function getContent()
- {
- $html = '';
- // If we try to update the settings
- if (Tools::isSubmit('submitModule'))
- {
- Configuration::updateValue('BLOCKCONTACT_TELNUMBER', Tools::getValue('blockcontact_telnumber'));
- Configuration::updateValue('BLOCKCONTACT_EMAIL', Tools::getValue('blockcontact_email'));
- $this->_clearCache('blockcontact.tpl');
- $this->_clearCache('nav.tpl');
- $html .= $this->displayConfirmation($this->l('Configuration updated'));
- }
-
- $html .= $this->renderForm();
-
- return $html;
- }
-
- public function hookDisplayHeader($params)
- {
- $this->context->controller->addCSS(($this->_path).'blockcontact.css', 'all');
- }
-
- public function hookDisplayRightColumn($params)
- {
- global $smarty;
- $tpl = 'blockcontact';
- if (isset($params['blockcontact_tpl']) && $params['blockcontact_tpl'])
- $tpl = $params['blockcontact_tpl'];
- if (!$this->isCached($tpl.'.tpl', $this->getCacheId()))
- $smarty->assign(array(
- 'telnumber' => Configuration::get('BLOCKCONTACT_TELNUMBER'),
- 'email' => Configuration::get('BLOCKCONTACT_EMAIL')
- ));
- return $this->display(__FILE__, $tpl.'.tpl', $this->getCacheId());
- }
-
- public function hookDisplayLeftColumn($params)
- {
- return $this->hookDisplayRightColumn($params);
- }
-
- public function hookDisplayNav($params)
- {
- $params['blockcontact_tpl'] = 'nav';
- return $this->hookDisplayRightColumn($params);
- }
-
- public function renderForm()
- {
- $fields_form = array(
- 'form' => array(
- 'legend' => array(
- 'title' => $this->l('Settings'),
- 'icon' => 'icon-cogs'
- ),
- 'description' => $this->l('This block displays in the header your phone number (‘Call us now’), and a link to the ‘Contact us’ page.').'
'.
- $this->l('To edit the email addresses for the ‘Contact us’ page: you should go to the ‘Contacts’ page under the ‘Customer’ menu.').' '.
- $this->l('To edit the contact details in the footer: you should go to the ‘Contact Information Block’ module.'),
- 'input' => array(
- array(
- 'type' => 'text',
- 'label' => $this->l('Telephone number'),
- 'name' => 'blockcontact_telnumber',
- ),
- array(
- 'type' => 'text',
- 'label' => $this->l('Email'),
- 'name' => 'blockcontact_email',
- 'desc' => $this->l('Enter here your customer service contact details.'),
- ),
- ),
- 'submit' => array(
- 'title' => $this->l('Save'),
- )
- ),
- );
-
- $helper = new HelperForm();
- $helper->show_toolbar = false;
- $helper->table = $this->table;
- $lang = new Language((int)Configuration::get('PS_LANG_DEFAULT'));
- $helper->default_form_language = $lang->id;
- $helper->allow_employee_form_lang = Configuration::get('PS_BO_ALLOW_EMPLOYEE_FORM_LANG') ? Configuration::get('PS_BO_ALLOW_EMPLOYEE_FORM_LANG') : 0;
- $this->fields_form = array();
-
- $helper->identifier = $this->identifier;
- $helper->submit_action = 'submitModule';
- $helper->currentIndex = $this->context->link->getAdminLink('AdminModules', false).'&configure='.$this->name.'&tab_module='.$this->tab.'&module_name='.$this->name;
- $helper->token = Tools::getAdminTokenLite('AdminModules');
- $helper->tpl_vars = array(
- 'fields_value' => $this->getConfigFieldsValues(),
- 'languages' => $this->context->controller->getLanguages(),
- 'id_language' => $this->context->language->id
- );
-
- return $helper->generateForm(array($fields_form));
- }
-
- public function getConfigFieldsValues()
- {
- return array(
- 'blockcontact_telnumber' => Tools::getValue('blockcontact_telnumber', Configuration::get('BLOCKCONTACT_TELNUMBER')),
- 'blockcontact_email' => Tools::getValue('blockcontact_email', Configuration::get('BLOCKCONTACT_EMAIL')),
- );
- }
-}
diff --git a/modules/blockcontact/blockcontact.tpl b/modules/blockcontact/blockcontact.tpl
deleted file mode 100644
index b50b92e00..000000000
--- a/modules/blockcontact/blockcontact.tpl
+++ /dev/null
@@ -1,33 +0,0 @@
-{*
-* 2007-2016 PrestaShop
-*
-* 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@prestashop.com 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
-* @copyright 2007-2016 PrestaShop SA
-* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
-* International Registered Trademark & Property of PrestaShop SA
-*}
-
-
-
{l s='Contact us' mod='blockcontact'}
-
-
{l s='Our support hotline is available 24/7.' mod='blockcontact'}
diff --git a/modules/blockcontact/images/bloc_contact_a_bg.png b/modules/blockcontact/images/bloc_contact_a_bg.png
deleted file mode 100644
index 57f5fce31..000000000
Binary files a/modules/blockcontact/images/bloc_contact_a_bg.png and /dev/null differ
diff --git a/modules/blockcontact/images/block_contact_bg.jpg b/modules/blockcontact/images/block_contact_bg.jpg
deleted file mode 100644
index 4e4245cb6..000000000
Binary files a/modules/blockcontact/images/block_contact_bg.jpg and /dev/null differ
diff --git a/modules/blockcontact/images/block_contact_pict_tel.png b/modules/blockcontact/images/block_contact_pict_tel.png
deleted file mode 100644
index c0de09cdc..000000000
Binary files a/modules/blockcontact/images/block_contact_pict_tel.png and /dev/null differ
diff --git a/modules/blockcontact/images/index.php b/modules/blockcontact/images/index.php
deleted file mode 100644
index e5064df41..000000000
--- a/modules/blockcontact/images/index.php
+++ /dev/null
@@ -1,35 +0,0 @@
-
-* @copyright 2007-2016 PrestaShop SA
-* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
-* International Registered Trademark & Property of PrestaShop SA
-*/
-
-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;
\ No newline at end of file
diff --git a/modules/blockcontact/img/bloc_contact_a_bg.png b/modules/blockcontact/img/bloc_contact_a_bg.png
deleted file mode 100644
index 57f5fce31..000000000
Binary files a/modules/blockcontact/img/bloc_contact_a_bg.png and /dev/null differ
diff --git a/modules/blockcontact/img/block_contact_bg.jpg b/modules/blockcontact/img/block_contact_bg.jpg
deleted file mode 100644
index 4e4245cb6..000000000
Binary files a/modules/blockcontact/img/block_contact_bg.jpg and /dev/null differ
diff --git a/modules/blockcontact/img/block_contact_pict_tel.png b/modules/blockcontact/img/block_contact_pict_tel.png
deleted file mode 100644
index c0de09cdc..000000000
Binary files a/modules/blockcontact/img/block_contact_pict_tel.png and /dev/null differ
diff --git a/modules/blockcontact/img/index.php b/modules/blockcontact/img/index.php
deleted file mode 100644
index e5064df41..000000000
--- a/modules/blockcontact/img/index.php
+++ /dev/null
@@ -1,35 +0,0 @@
-
-* @copyright 2007-2016 PrestaShop SA
-* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
-* International Registered Trademark & Property of PrestaShop SA
-*/
-
-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;
\ No newline at end of file
diff --git a/modules/blockcontact/index.php b/modules/blockcontact/index.php
deleted file mode 100644
index da793c6b5..000000000
--- a/modules/blockcontact/index.php
+++ /dev/null
@@ -1,35 +0,0 @@
-
-* @copyright 2007-2016 PrestaShop SA
-* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
-* International Registered Trademark & Property of PrestaShop SA
-*/
-
-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;
\ No newline at end of file
diff --git a/modules/blockcontact/logo.gif b/modules/blockcontact/logo.gif
deleted file mode 100644
index 55c1ad665..000000000
Binary files a/modules/blockcontact/logo.gif and /dev/null differ
diff --git a/modules/blockcontact/logo.png b/modules/blockcontact/logo.png
deleted file mode 100644
index 7a46f4456..000000000
Binary files a/modules/blockcontact/logo.png and /dev/null differ
diff --git a/modules/blockcontact/nav.tpl b/modules/blockcontact/nav.tpl
deleted file mode 100644
index 39a4d022c..000000000
--- a/modules/blockcontact/nav.tpl
+++ /dev/null
@@ -1,32 +0,0 @@
-{*
-* 2007-2016 PrestaShop
-*
-* 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@prestashop.com 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
-* @copyright 2007-2016 PrestaShop SA
-* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
-* International Registered Trademark & Property of PrestaShop SA
-*}
-
-
diff --git a/modules/blockcontactinfos/index.php b/modules/blockcontactinfos/index.php
deleted file mode 100644
index da793c6b5..000000000
--- a/modules/blockcontactinfos/index.php
+++ /dev/null
@@ -1,35 +0,0 @@
-
-* @copyright 2007-2016 PrestaShop SA
-* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
-* International Registered Trademark & Property of PrestaShop SA
-*/
-
-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;
\ No newline at end of file
diff --git a/modules/blockcontactinfos/logo.gif b/modules/blockcontactinfos/logo.gif
deleted file mode 100644
index 15471afd4..000000000
Binary files a/modules/blockcontactinfos/logo.gif and /dev/null differ
diff --git a/modules/blockcontactinfos/logo.png b/modules/blockcontactinfos/logo.png
deleted file mode 100644
index 5c773abd1..000000000
Binary files a/modules/blockcontactinfos/logo.png and /dev/null differ
diff --git a/modules/blockcontactinfos/translations/index.php b/modules/blockcontactinfos/translations/index.php
deleted file mode 100644
index e5064df41..000000000
--- a/modules/blockcontactinfos/translations/index.php
+++ /dev/null
@@ -1,35 +0,0 @@
-
-* @copyright 2007-2016 PrestaShop SA
-* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
-* International Registered Trademark & Property of PrestaShop SA
-*/
-
-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;
\ No newline at end of file
diff --git a/modules/blockcontactinfos/upgrade/install-1.1.2.php b/modules/blockcontactinfos/upgrade/install-1.1.2.php
deleted file mode 100644
index e130723ff..000000000
--- a/modules/blockcontactinfos/upgrade/install-1.1.2.php
+++ /dev/null
@@ -1,10 +0,0 @@
-execute('UPDATE '._DB_PREFIX_.'configuration SET `name` = UPPER(`name`) WHERE `name` LIKE "BLOCKCONTACTINFOS\_%"');
- return true;
-}
diff --git a/modules/blockcustomerprivacy/CHANGELOG.txt b/modules/blockcustomerprivacy/CHANGELOG.txt
deleted file mode 100644
index 9125899a1..000000000
--- a/modules/blockcustomerprivacy/CHANGELOG.txt
+++ /dev/null
@@ -1,4 +0,0 @@
-2014-04-22 18:57:11 +0200 // Changelog updated
-2014-03-24 11:43:28 +0100 / MO blockcustomerprivacy : ps_versions_compliancy modified (1.5.6.1 => 1.6)
-2014-03-24 11:02:09 +0100 // MO blockcustomerprivacy/ : ps_versions_compliancy added
-2014-03-20 14:22:37 +0100 Initial commit
diff --git a/modules/blockcustomerprivacy/blockcustomerprivacy-simple.tpl b/modules/blockcustomerprivacy/blockcustomerprivacy-simple.tpl
deleted file mode 100644
index 5085d18e9..000000000
--- a/modules/blockcustomerprivacy/blockcustomerprivacy-simple.tpl
+++ /dev/null
@@ -1,27 +0,0 @@
-{* 2007-2016 PrestaShop
-*
-* 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@prestashop.com 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
-* @copyright 2007-2016 PrestaShop SA
-* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
-* International Registered Trademark & Property of PrestaShop SA
-*}
-
-
-
{$privacy_message}
-
diff --git a/modules/blockcustomerprivacy/blockcustomerprivacy.php b/modules/blockcustomerprivacy/blockcustomerprivacy.php
deleted file mode 100644
index ab4a23053..000000000
--- a/modules/blockcustomerprivacy/blockcustomerprivacy.php
+++ /dev/null
@@ -1,272 +0,0 @@
-
-* @copyright 2007-2016 PrestaShop SA
-* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
-* International Registered Trademark & Property of PrestaShop SA
-*/
-
-if (!defined('_PS_VERSION_'))
- exit;
-
-class Blockcustomerprivacy extends Module
-{
- public function __construct()
- {
- $this->name = 'blockcustomerprivacy';
- if (version_compare(_PS_VERSION_, '1.4.0.0') >= 0)
- $this->tab = 'front_office_features';
- else
- $this->tab = 'Blocks';
- $this->version = '2.0.2';
- $this->author = 'PrestaShop';
- $this->need_instance = 0;
-
- $this->bootstrap = true;
- parent::__construct();
-
- $this->displayName = $this->l('Customer data privacy block');
- $this->description = $this->l('Adds a block displaying a message about a customer\'s privacy data.');
- $this->ps_versions_compliancy = array('min' => '1.6', 'max' => '1.6.99.99');
-
- $this->_html = '';
- }
-
- public function install()
- {
- $return = (parent::install()
- && $this->registerHook('createAccountForm')
- && $this->registerHook('displayCustomerIdentityForm')
- && $this->registerHook('actionBeforeSubmitAccount'));
-
- include 'fixtures.php'; // get Fixture array
- $languages = Language::getLanguages();
- $conf_keys = array('CUSTPRIV_MSG_AUTH', 'CUSTPRIV_MSG_IDENTITY');
- foreach ($conf_keys as $conf_key)
- foreach ($languages as $lang)
- {
- if (isset($fixtures[$conf_key][$lang['language_code']]))
- Configuration::updateValue($conf_key, array(
- $lang['id_lang'] => $fixtures[$conf_key][$lang['language_code']]
- ));
- else
- Configuration::updateValue($conf_key, array(
- $lang['id_lang'] => 'The personal data you provide is used to answer queries, process orders or allow access to specific information. You have the right to modify and delete all the personal information found in the "My Account" page.'
- ));
- }
-
- return $return;
- }
-
- public function uninstall()
- {
- return ($this->unregisterHook('createAccountForm')
- && $this->unregisterHook('displayCustomerIdentityForm')
- && $this->unregisterHook('actionBeforeSubmitAccount')
- && parent::uninstall());
- }
-
- public function getContent()
- {
- if (Tools::isSubmit('submitCustPrivMess'))
- {
- $message_trads = array('auth' => array(), 'identity' => array());
- foreach ($_POST as $key => $value)
- if (preg_match('/CUSTPRIV_MSG_AUTH_/i', $key))
- {
- $id_lang = preg_split('/CUSTPRIV_MSG_AUTH_/i', $key);
- $message_trads['auth'][(int)$id_lang[1]] = $value;
- }
- elseif (preg_match('/CUSTPRIV_MSG_IDENTITY_/i', $key))
- {
- $id_lang = preg_split('/CUSTPRIV_MSG_IDENTITY_/i', $key);
- $message_trads['identity'][(int)$id_lang[1]] = $value;
- }
- Configuration::updateValue('CUSTPRIV_MSG_AUTH', $message_trads['auth'], true);
- Configuration::updateValue('CUSTPRIV_MSG_IDENTITY', $message_trads['identity'], true);
-
- Configuration::updateValue('CUSTPRIV_AUTH_PAGE', (int)Tools::getValue('CUSTPRIV_AUTH_PAGE'));
- Configuration::updateValue('CUSTPRIV_IDENTITY_PAGE', (int)Tools::getValue('CUSTPRIV_IDENTITY_PAGE'));
-
- $this->_clearCache('blockcustomerprivacy.tpl');
- $this->_clearCache('blockcustomerprivacy-simple.tpl');
- $this->_html .= $this->displayConfirmation($this->l('Configuration updated'));
- }
-
- $this->_html .= $this->renderForm();
-
- return $this->_html;
- }
-
- public function checkConfig($switch_key, $msg_key)
- {
- if (!$this->active)
- return false;
-
- if (!Configuration::get($switch_key))
- return false;
-
- $message = Configuration::get($msg_key, $this->context->language->id);
- if (empty($message))
- return false;
-
- return true;
- }
-
- public function hookActionBeforeSubmitAccount($params)
- {
- if (!$this->checkConfig('CUSTPRIV_AUTH_PAGE', 'CUSTPRIV_MSG_AUTH'))
- return;
-
- if (!Tools::getValue('customer_privacy'))
- $this->context->controller->errors[] = $this->l('If you agree to the terms in the Customer Data Privacy message, please click the check box below.');
- }
-
- public function hookCreateAccountForm($params)
- {
- if (!$this->checkConfig('CUSTPRIV_AUTH_PAGE', 'CUSTPRIV_MSG_AUTH'))
- return;
-
- if (!$this->isCached('blockcustomerprivacy.tpl', $this->getCacheId()))
- $this->smarty->assign('privacy_message', Configuration::get('CUSTPRIV_MSG_AUTH', $this->context->language->id));
-
- return $this->display(__FILE__, 'blockcustomerprivacy.tpl', $this->getCacheId());
- }
-
- public function hookDisplayCustomerIdentityForm($params)
- {
- if (!$this->checkConfig('CUSTPRIV_IDENTITY_PAGE', 'CUSTPRIV_MSG_IDENTITY'))
- return;
-
- if (!$this->isCached('blockcustomerprivacy-simple.tpl', $this->getCacheId()))
- {
- $this->smarty->assign(array(
- 'privacy_message' => Configuration::get('CUSTPRIV_MSG_IDENTITY', $this->context->language->id),
- 'privacy_id' => "blockcustomerprivacy-simple",
- ));
- }
-
- return $this->display(__FILE__, 'blockcustomerprivacy-simple.tpl', $this->getCacheId());
- }
-
- public function renderForm()
- {
- $fields_form = array(
- 'form' => array(
- 'legend' => array(
- 'title' => $this->l('Settings'),
- 'icon' => 'icon-cogs'
- ),
- 'input' => array(
- array(
- 'type' => 'switch',
- 'label' => $this->l('Display on account creation form'),
- 'name' => 'CUSTPRIV_AUTH_PAGE',
- 'values' => array(
- array(
- 'id' => 'active_on',
- 'value' => 1,
- 'label' => $this->l('Enabled')
- ),
- array(
- 'id' => 'active_off',
- 'value' => 0,
- 'label' => $this->l('Disabled')
- )
- ),
- ),
- array(
- 'type' => 'textarea',
- 'lang' => true,
- 'autoload_rte' => true,
- 'label' => $this->l('Customer data privacy message for account creation form:'),
- 'name' => 'CUSTPRIV_MSG_AUTH',
- 'desc' => $this->l('The customer data privacy message will be displayed in the account creation form.').' '.$this->l('Tip: If the customer privacy message is too long to be written directly in the form, you can add a link to one of your pages. This can easily be created via the "CMS" page under the "Preferences" menu.')
- ),
- array(
- 'type' => 'switch',
- 'label' => $this->l('Display in customer area'),
- 'name' => 'CUSTPRIV_IDENTITY_PAGE',
- 'values' => array(
- array(
- 'id' => 'active_on',
- 'value' => 1,
- 'label' => $this->l('Enabled')
- ),
- array(
- 'id' => 'active_off',
- 'value' => 0,
- 'label' => $this->l('Disabled')
- )
- ),
- ),
- array(
- 'type' => 'textarea',
- 'lang' => true,
- 'autoload_rte' => true,
- 'label' => $this->l('Customer data privacy message for customer area:'),
- 'name' => 'CUSTPRIV_MSG_IDENTITY',
- 'desc' => $this->l('The customer data privacy message will be displayed in the "Personal information" page, in the customer area.').' '.$this->l('Tip: If the customer privacy message is too long to be written directly on the page, you can add a link to one of your other pages. This can easily be created via the "CMS" page under the "Preferences" menu.')
- ),
- ),
- 'submit' => array(
- 'title' => $this->l('Save'),
- )
- ),
- );
-
- $helper = new HelperForm();
- $helper->show_toolbar = false;
- $helper->table = $this->table;
- $lang = new Language((int)Configuration::get('PS_LANG_DEFAULT'));
- $helper->default_form_language = $lang->id;
- $helper->allow_employee_form_lang = Configuration::get('PS_BO_ALLOW_EMPLOYEE_FORM_LANG') ? Configuration::get('PS_BO_ALLOW_EMPLOYEE_FORM_LANG') : 0;
- $this->fields_form = array();
-
- $helper->identifier = $this->identifier;
- $helper->submit_action = 'submitCustPrivMess';
- $helper->currentIndex = $this->context->link->getAdminLink('AdminModules', false).'&configure='.$this->name.'&tab_module='.$this->tab.'&module_name='.$this->name;
- $helper->token = Tools::getAdminTokenLite('AdminModules');
- $helper->tpl_vars = array(
- 'fields_value' => $this->getConfigFieldsValues(),
- 'languages' => $this->context->controller->getLanguages(),
- 'id_language' => $this->context->language->id
- );
-
- return $helper->generateForm(array($fields_form));
- }
-
- public function getConfigFieldsValues()
- {
- $return = array();
-
- $return['CUSTPRIV_AUTH_PAGE'] = (int)Configuration::get('CUSTPRIV_AUTH_PAGE');
- $return['CUSTPRIV_IDENTITY_PAGE'] = (int)Configuration::get('CUSTPRIV_IDENTITY_PAGE');
-
- $languages = Language::getLanguages(false);
- foreach ($languages as $lang)
- $return['CUSTPRIV_MSG_AUTH'][(int)$lang['id_lang']] = Tools::getValue('CUSTPRIV_MSG_AUTH_'.(int)$lang['id_lang'], Configuration::get('CUSTPRIV_MSG_AUTH', (int)$lang['id_lang']));
- foreach ($languages as $lang)
- $return['CUSTPRIV_MSG_IDENTITY'][(int)$lang['id_lang']] = Tools::getValue('CUSTPRIV_MSG_IDENTITY_'.(int)$lang['id_lang'], Configuration::get('CUSTPRIV_MSG_IDENTITY', (int)$lang['id_lang']));
-
- return $return;
- }
-}
diff --git a/modules/blockcustomerprivacy/blockcustomerprivacy.tpl b/modules/blockcustomerprivacy/blockcustomerprivacy.tpl
deleted file mode 100644
index ec469a73d..000000000
--- a/modules/blockcustomerprivacy/blockcustomerprivacy.tpl
+++ /dev/null
@@ -1,32 +0,0 @@
-{* 2007-2016 PrestaShop
-*
-* 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@prestashop.com 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
-* @copyright 2007-2016 PrestaShop SA
-* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
-* International Registered Trademark & Property of PrestaShop SA
-*}
-
-
-
\ No newline at end of file
diff --git a/modules/blockcustomerprivacy/fixtures.php b/modules/blockcustomerprivacy/fixtures.php
deleted file mode 100644
index 065a71e33..000000000
--- a/modules/blockcustomerprivacy/fixtures.php
+++ /dev/null
@@ -1,10 +0,0 @@
- array(
- 'fr-fr' => "Conformément aux dispositions de la loi du n°78-17 du 6 janvier 1978, vous disposez d'un droit d'accès, de rectification et d'opposition sur les données nominatives vous concernant.",
- ),
- "CUSTPRIV_MSG_IDENTITY" => array(
- 'fr-fr' => "Conformément aux dispositions de la loi du n°78-17 du 6 janvier 1978, vous disposez d'un droit d'accès, de rectification et d'opposition sur les données nominatives vous concernant.",
- ),
-);
\ No newline at end of file
diff --git a/modules/blockcustomerprivacy/index.php b/modules/blockcustomerprivacy/index.php
deleted file mode 100644
index e5064df41..000000000
--- a/modules/blockcustomerprivacy/index.php
+++ /dev/null
@@ -1,35 +0,0 @@
-
-* @copyright 2007-2016 PrestaShop SA
-* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
-* International Registered Trademark & Property of PrestaShop SA
-*/
-
-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;
\ No newline at end of file
diff --git a/modules/blockcustomerprivacy/logo.gif b/modules/blockcustomerprivacy/logo.gif
deleted file mode 100644
index 9cdb8ef3a..000000000
Binary files a/modules/blockcustomerprivacy/logo.gif and /dev/null differ
diff --git a/modules/blockcustomerprivacy/logo.png b/modules/blockcustomerprivacy/logo.png
deleted file mode 100644
index eff626822..000000000
Binary files a/modules/blockcustomerprivacy/logo.png and /dev/null differ
diff --git a/modules/blockcustomerprivacy/translations/index.php b/modules/blockcustomerprivacy/translations/index.php
deleted file mode 100644
index e5064df41..000000000
--- a/modules/blockcustomerprivacy/translations/index.php
+++ /dev/null
@@ -1,35 +0,0 @@
-
-* @copyright 2007-2016 PrestaShop SA
-* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
-* International Registered Trademark & Property of PrestaShop SA
-*/
-
-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;
\ No newline at end of file
diff --git a/modules/blockcustomerprivacy/upgrade/index.php b/modules/blockcustomerprivacy/upgrade/index.php
deleted file mode 100644
index 003c7f786..000000000
--- a/modules/blockcustomerprivacy/upgrade/index.php
+++ /dev/null
@@ -1,35 +0,0 @@
-
-* @copyright 2007-2016 PrestaShop SA
-* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
-* International Registered Trademark & Property of PrestaShop SA
-*/
-
-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;
\ No newline at end of file
diff --git a/modules/blockcustomerprivacy/upgrade/install-2.0.0.php b/modules/blockcustomerprivacy/upgrade/install-2.0.0.php
deleted file mode 100644
index 380662562..000000000
--- a/modules/blockcustomerprivacy/upgrade/install-2.0.0.php
+++ /dev/null
@@ -1,22 +0,0 @@
-registerHook('displayCustomerIdentityForm');
- $return &= $object->unregisterHook('header');
-
- $langs = Language::getLanguages(false);
- $old_messages = array();
- foreach ($langs as $l)
- $old_messages[$l['id_lang']] = Configuration::get('CUSTPRIV_MESSAGE', $l['id_lang']);
-
- Configuration::updateValue('CUSTPRIV_MESSAGE', $old_messages);
- Configuration::updateValue('CUSTPRIV_MESSAGE', $old_messages);
-
- return $return;
-}
diff --git a/modules/blockfacebook/CHANGELOG.txt b/modules/blockfacebook/CHANGELOG.txt
deleted file mode 100644
index 8e5c2845a..000000000
--- a/modules/blockfacebook/CHANGELOG.txt
+++ /dev/null
@@ -1,11 +0,0 @@
-2014-04-22 18:57:13 +0200 // Changelog updated
-2014-04-01 16:41:02 +0200 // fix bracket missing && ++version
-2014-04-01 14:13:46 +0200 Merge pull request #1 from f31n/patch-1
-2014-03-29 23:49:00 +0300 // full url is required for blockFacebook
-2014-03-28 09:56:54 +0100 logic in php
-2014-03-28 09:48:56 +0100 Update blockfacebook.tpl
-2014-03-25 21:21:01 +0100 accepting full url and only name
-2014-03-25 18:31:27 +0100 bug @ v0.1 didn't work on prestashop 1.6.0.5
-2014-03-24 11:43:28 +0100 / MO blockfacebook : ps_versions_compliancy modified (1.5.6.1 => 1.6)
-2014-03-24 11:02:17 +0100 // MO blockfacebook/ : ps_versions_compliancy added
-2014-03-20 14:22:40 +0100 Initial commit
diff --git a/modules/blockfacebook/blockfacebook.js b/modules/blockfacebook/blockfacebook.js
deleted file mode 100644
index 41719d72e..000000000
--- a/modules/blockfacebook/blockfacebook.js
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
-* 2007-2016 PrestaShop
-*
-* 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@prestashop.com 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
-* @copyright 2007-2016 PrestaShop SA
-* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
-* International Registered Trademark & Property of PrestaShop SA
-*/
-$(document).ready(function() {
- initfb(document, 'script', 'facebook-jssdk');
-});
-
-function initfb(d, s, id)
-{
- var js, fjs = d.getElementsByTagName(s)[0];
- if (d.getElementById(id))
- return;
- js = d.createElement(s); js.id = id;
- js.src = "//connect.facebook.net/en_US/all.js#xfbml=1&appId=334341610034299";
- fjs.parentNode.insertBefore(js, fjs);
-}
\ No newline at end of file
diff --git a/modules/blockfacebook/blockfacebook.php b/modules/blockfacebook/blockfacebook.php
deleted file mode 100644
index 969c6323d..000000000
--- a/modules/blockfacebook/blockfacebook.php
+++ /dev/null
@@ -1,170 +0,0 @@
-
-* @copyright 2007-2016 PrestaShop SA
-* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
-* International Registered Trademark & Property of PrestaShop SA
-*/
-
-if (!defined('_PS_VERSION_'))
- exit;
-
-class BlockFacebook extends Module
-{
- public function __construct()
- {
- $this->name = 'blockfacebook';
- $this->tab = 'front_office_features';
- $this->version = '1.4.1';
- $this->author = 'PrestaShop';
-
- $this->bootstrap = true;
- parent::__construct();
- $this->displayName = $this->l('Facebook Like Box block');
- $this->description = $this->l('Displays a block for subscribing to your Facebook Page.');
- $this->ps_versions_compliancy = array('min' => '1.6', 'max' => '1.6.99.99');
- }
-
-
- public function install()
- {
- return parent::install() &&
- Configuration::updateValue('blockfacebook_url', 'https://www.facebook.com/prestashop') &&
- $this->registerHook('displayHome') &&
- $this->registerHook('displayHeader');
- }
-
- public function uninstall()
- {
- // Delete configuration
- return Configuration::deleteByName('blockfacebook_url') && parent::uninstall();
- }
-
- public function getContent()
- {
- $html = '';
- // If we try to update the settings
- if (Tools::isSubmit('submitModule'))
- {
- Configuration::updateValue('blockfacebook_url', Tools::getValue('blockfacebook_url'));
- $html .= $this->displayConfirmation($this->l('Configuration updated'));
- $this->_clearCache('blockfacebook.tpl');
- Tools::redirectAdmin('index.php?tab=AdminModules&configure='.$this->name.'&token='.Tools::getAdminTokenLite('AdminModules'));
- }
-
- $html .= $this->renderForm();
- $facebookurl = Configuration::get('blockfacebook_url');
- if(!strstr($facebookurl, "facebook.com")) $facebookurl="https://www.facebook.com/".$facebookurl;
- $this->context->smarty->assign('facebookurl', $facebookurl);
- $this->context->smarty->assign('facebook_js_url', $this->_path.'blockfacebook.js');
- $this->context->smarty->assign('facebook_css_url', $this->_path.'css/blockfacebook.css');
- $html .= $this->context->smarty->fetch($this->local_path.'views/admin/_configure/preview.tpl');
- return $html;
- }
-
- public function hookDisplayHome()
- {
- if (!$this->isCached('blockfacebook.tpl', $this->getCacheId()))
- {
- $facebookurl = Configuration::get('blockfacebook_url');
- if (!strstr($facebookurl, 'facebook.com'))
- $facebookurl = 'https://www.facebook.com/'.$facebookurl;
- $this->context->smarty->assign('facebookurl', $facebookurl);
- }
- return $this->display(__FILE__, 'blockfacebook.tpl', $this->getCacheId());
- }
-
- public function hookDisplayLeftColumn()
- {
- if ($this->page_name !== 'index')
- $this->_assignMedia();
- return $this->hookDisplayHome();
- }
-
- public function hookDisplayRightColumn()
- {
- if ($this->page_name !== 'index')
- $this->_assignMedia();
- return $this->hookDisplayHome();
- }
-
- public function hookHeader()
- {
- $this->page_name = Dispatcher::getInstance()->getController();
- if ($this->page_name == 'index')
- $this->_assignMedia();
- }
-
- protected function _assignMedia()
- {
- $this->context->controller->addCss(($this->_path).'css/blockfacebook.css');
- $this->context->controller->addJS(($this->_path).'blockfacebook.js');
- }
-
- public function renderForm()
- {
- $fields_form = array(
- 'form' => array(
- 'legend' => array(
- 'title' => $this->l('Settings'),
- 'icon' => 'icon-cogs'
- ),
- 'input' => array(
- array(
- 'type' => 'text',
- 'label' => $this->l('Facebook link (full URL is required)'),
- 'name' => 'blockfacebook_url',
- ),
- ),
- 'submit' => array(
- 'title' => $this->l('Save')
- )
- ),
- );
-
- $helper = new HelperForm();
- $helper->show_toolbar = false;
- $helper->table = $this->table;
- $lang = new Language((int)Configuration::get('PS_LANG_DEFAULT'));
- $helper->default_form_language = $lang->id;
- $helper->allow_employee_form_lang = Configuration::get('PS_BO_ALLOW_EMPLOYEE_FORM_LANG') ? Configuration::get('PS_BO_ALLOW_EMPLOYEE_FORM_LANG') : 0;
- $this->fields_form = array();
-
- $helper->identifier = $this->identifier;
- $helper->submit_action = 'submitModule';
- $helper->currentIndex = $this->context->link->getAdminLink('AdminModules', false).'&configure='.$this->name.'&tab_module='.$this->tab.'&module_name='.$this->name;
- $helper->token = Tools::getAdminTokenLite('AdminModules');
- $helper->tpl_vars = array(
- 'fields_value' => $this->getConfigFieldsValues(),
- 'languages' => $this->context->controller->getLanguages(),
- 'id_language' => $this->context->language->id
- );
-
- return $helper->generateForm(array($fields_form));
- }
-
- public function getConfigFieldsValues()
- {
- return array(
- 'blockfacebook_url' => Tools::getValue('blockfacebook_url', Configuration::get('blockfacebook_url')),
- );
- }
-}
diff --git a/modules/blockfacebook/blockfacebook.tpl b/modules/blockfacebook/blockfacebook.tpl
deleted file mode 100644
index efae75b87..000000000
--- a/modules/blockfacebook/blockfacebook.tpl
+++ /dev/null
@@ -1,35 +0,0 @@
-{*
-* 2007-2016 PrestaShop
-*
-* 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@prestashop.com 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
-* @copyright 2007-2016 PrestaShop SA
-
-* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
-* International Registered Trademark & Property of PrestaShop SA
-*}
-{if $facebookurl != ''}
-
-
-
{l s='Follow us on Facebook' mod='blockfacebook'}
-
-
-
-
-
-{/if}
diff --git a/modules/blockfacebook/css/blockfacebook.css b/modules/blockfacebook/css/blockfacebook.css
deleted file mode 100644
index 454bf0477..000000000
--- a/modules/blockfacebook/css/blockfacebook.css
+++ /dev/null
@@ -1,3 +0,0 @@
-.facebook-fanbox {
- overflow-x : hidden;
-}
\ No newline at end of file
diff --git a/modules/blockfacebook/css/index.php b/modules/blockfacebook/css/index.php
deleted file mode 100644
index a87fdfd18..000000000
--- a/modules/blockfacebook/css/index.php
+++ /dev/null
@@ -1,33 +0,0 @@
-
-* @copyright 2007-2016 PrestaShop SA
-* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
-* International Registered Trademark & Property of PrestaShop SA
-*/
-
-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;
\ No newline at end of file
diff --git a/modules/blockfacebook/logo.gif b/modules/blockfacebook/logo.gif
deleted file mode 100644
index 4614741f5..000000000
Binary files a/modules/blockfacebook/logo.gif and /dev/null differ
diff --git a/modules/blockfacebook/logo.png b/modules/blockfacebook/logo.png
deleted file mode 100644
index 721cb8261..000000000
Binary files a/modules/blockfacebook/logo.png and /dev/null differ
diff --git a/modules/blockfacebook/translations/index.php b/modules/blockfacebook/translations/index.php
deleted file mode 100644
index e5064df41..000000000
--- a/modules/blockfacebook/translations/index.php
+++ /dev/null
@@ -1,35 +0,0 @@
-
-* @copyright 2007-2016 PrestaShop SA
-* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
-* International Registered Trademark & Property of PrestaShop SA
-*/
-
-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;
\ No newline at end of file
diff --git a/modules/blockfacebook/views/admin/_configure/preview.tpl b/modules/blockfacebook/views/admin/_configure/preview.tpl
deleted file mode 100644
index 252297cc1..000000000
--- a/modules/blockfacebook/views/admin/_configure/preview.tpl
+++ /dev/null
@@ -1,17 +0,0 @@
-
-
-{if $facebookurl != ''}
-
-
- {l s='Preview' mod='blockfacebook'}
-
-
-
-
{l s='Follow us on Facebook' mod='blockfacebook'}
-
-
-
-
-
-
-{/if}
diff --git a/modules/blocklayered/CHANGELOG.txt b/modules/blocklayered/CHANGELOG.txt
deleted file mode 100644
index 54e29f2e0..000000000
--- a/modules/blocklayered/CHANGELOG.txt
+++ /dev/null
@@ -1,27 +0,0 @@
------------------------------
-# V2.1.2 to V2.1.3
------------------------------
-
-## Improved/Changed Features:
-
-* [CO] : [#244] Changed Tools::jsonEncode to json_encode
-* [CO] : [#242] PHP7 compatibility changes
-
-
-2014-04-22 18:57:17 +0200 // Changelog updated
-2014-04-17 15:49:24 +0200 [-] MO : Blocklayered - FixBug #PSCSX-1505
-2014-04-17 12:21:18 +0200 [-] MO : Blocklayered - FixBug #PSCSX-1337
-2014-04-08 10:29:23 +0200 // blocklayered: better wording.
-2014-04-03 15:24:10 +0200 // Update version
-2014-04-03 15:23:10 +0200 [-] BO : BlockLayered - FixBug #PSCSX-1399 pagination problem
-2014-03-27 18:22:40 +0100 // update version number
-2014-03-27 11:57:03 +0100 Merge pull request #2 from xBorderie/patch-1
-2014-03-27 11:51:19 +0100 [*] MO : a string you can actually translate.
-2014-03-27 11:51:15 +0100 // Fix wrong backquote in SQL
-2014-03-24 17:53:22 +0100 // MO blocklayered : Removed ps_version_compliancy duplicate
-2014-03-24 12:21:34 +0100 Merge branch 'master' of https://github.com/PrestaShop/blocklayered
-2014-03-24 11:43:28 +0100 / MO blocklayered : ps_versions_compliancy modified (1.5.6.1 => 1.6)
-2014-03-24 11:02:30 +0100 / MO blocklayered : ps_versions_compliancy added
-2014-03-21 18:39:28 +0100 [-] Add column names in SQL insert into
-2014-03-20 16:54:45 +0100 // Two forgotten periods in blocklayered 1.6 template.
-2014-03-20 14:22:46 +0100 Initial commit
diff --git a/modules/blocklayered/Readme.md b/modules/blocklayered/Readme.md
deleted file mode 100644
index 34ace2d9d..000000000
--- a/modules/blocklayered/Readme.md
+++ /dev/null
@@ -1,37 +0,0 @@
-# Layered navigation block
-
-## About
-
-Displays a block with layered navigation filters.
-
-## Contributing
-
-PrestaShop modules are open-source extensions to the PrestaShop e-commerce solution. Everyone is welcome and even encouraged to contribute with their own improvements.
-
-### Requirements
-
-Contributors **must** follow the following rules:
-
-* **Make your Pull Request on the "dev" branch**, NOT the "master" branch.
-* Do not update the module's version number.
-* Follow [the coding standards][1].
-
-### Process in details
-
-Contributors wishing to edit a module's files should follow the following process:
-
-1. Create your GitHub account, if you do not have one already.
-2. Fork the blocklayered project to your GitHub account.
-3. Clone your fork to your local machine in the ```/modules``` directory of your PrestaShop installation.
-4. Create a branch in your local clone of the module for your changes.
-5. Change the files in your branch. Be sure to follow [the coding standards][1]!
-6. Push your changed branch to your fork in your GitHub account.
-7. Create a pull request for your changes **on the _'dev'_ branch** of the module's project. Be sure to follow [the commit message norm][2] in your pull request. If you need help to make a pull request, read the [Github help page about creating pull requests][3].
-8. Wait for one of the core developers either to include your change in the codebase, or to comment on possible improvements you should make to your code.
-
-That's it: you have contributed to this open-source project! Congratulations!
-
-[1]: http://doc.prestashop.com/display/PS16/Coding+Standards
-[2]: http://doc.prestashop.com/display/PS16/How+to+write+a+commit+message
-[3]: https://help.github.com/articles/using-pull-requests
-
diff --git a/modules/blocklayered/blocklayered-15.css b/modules/blocklayered/blocklayered-15.css
deleted file mode 100644
index 615e2b3fb..000000000
--- a/modules/blocklayered/blocklayered-15.css
+++ /dev/null
@@ -1,168 +0,0 @@
-#enabled_filters {
- margin: 0 0 10px 0;
- background: #eee;
- padding: 5px;
-}
-#enabled_filters .layered_subtitle {
- font-weight: bold;
- font-size: 12px;
-}
-#enabled_filters ul li {padding:2px 0}
-#enabled_filters li a {
- float: right;
- display: inline-block;
- height: 12px;
- width: 12px;
- text-indent: -5000px;
- /*background: url(../../../img/icon/delete.gif) no-repeat 0 0 transparent;*/
- background: url(./delete.gif) no-repeat 0 0 transparent;
- cursor: pointer;
-}
-#layered_block_left .layered_close {
- float: right;
- padding-right: 5px;
-}
-#layered_block_left span.layered_close a,
-#layered_block_left span.layered_close a {
- display:block;
- height:13px;
- width:13px;
- text-decoration: none;
- text-indent:-5000px;
- background:url(img/icon/less.gif) no-repeat 2px 2px;
-}
-#layered_block_left span.closed a {
- background:url(img/icon/more.gif) no-repeat 2px 2px;
-}
-
-#layered_block_left .layered_subtitle {
- display: inline-block;
- font-weight: bold;
- font-size: 12px;
-}
-#layered_block_left ul {
- clear: both;
- padding: 5px 0;
-}
-#layered_block_left ul li {padding:2px 0}
-#layered_block_left ul li label {cursor: pointer;}
-#layered_block_left div.block_content {
-}
-#layered_block_left ul {
- padding-left: 0;
-}
-#layered_block_left ul li {
- list-style-type: none;
-}
-#layered_block_left div > form > div > div {
- margin-top: 5px;
-}
-#layered_block_left #enabled_filters , #layered_url_filter_block{
- font-size: 10px;
- padding-bottom: 10px;
- margin-bottom: 5px;
- margin-top: 0px;
- border-bottom: 1px dotted #CCC;
-}
-#layered_block_left #enabled_filters ul li {
- margin-left: 0;
- padding-left: 0;
-}
-
-
-/* Style moved form the template to the css */
-
-#layered_block_left #enabled_filters ul li:hover {
- background: inherit;
- color: inherit;
-}
-#layered_block_left #enabled_filters a {
- text-decoration: none;
- color: red;
-}
-#layered_block_left ul li:hover {
-}
-#layered_block_left ul li input.checkbox {
- vertical-align: middle;
- margin-left: 2px;
-}
-#layered_block_left ul li .disabled {
- color: #666;
-}
-#layered_block_left .color-option {
- border: 1px solid #666666;
- height: 16px;
- margin-left: 0;
- padding: 0;
- width: 16px;
-}
-#layered_block_left .color-option.disable {
- opacity: 0.5;
- filter:alpha(opacity=50);
- -moz-opacity:0.5;
-}
-#layered_block_left .nomargin a {
- display: inline;
-}
-#layered_form .select {
- width: 165px;
-}
-#layered_form .color-option {
- margin-left: 0;
- width: 16px;
- height: 16px;
- padding:0;
- border: 1px solid #666;
-}
-#layered_form .color-option.on {
- border: 1px solid red;
-}
-#layered_form input[type=radio] {
- margin-left: 2px;
- vertical-align: middle;
-}
-.layered_price_range {
- margin-left: 7px;
-}
-.layered_price_range_unit {
- margin-right: 7px;
-}
-.layered_slider_container {
- margin: 6px 0 6px 7px; width: 91%;
-}
-.layered_slider {
- margin-top:5px;
-}
-.layered_input_range_min {
- width:30px;
-}
-.layered_input_range_max {
- width:40px;
-}
-.layered_list_selected {
- font-weight: bold;
-}
-.layered_list {
- display: block;
- cursor: pointer;
-}
-.layered_list:hover {
- font-weight: bold;
-}
-.layered_ajax_loader p {
- margin: 20px 0;
- text-align: center;
-}
-.hide-action {
- text-align: center;
- text-align: right;
- display: block;
- cursor: pointer;
-}
-.hide-action:hover {
- font-weight: bold;
-}
-#layered_form div div ul {
- max-height: 200px;
- overflow-x: auto;
-}
diff --git a/modules/blocklayered/blocklayered-ajax.php b/modules/blocklayered/blocklayered-ajax.php
deleted file mode 100644
index 51a495b5a..000000000
--- a/modules/blocklayered/blocklayered-ajax.php
+++ /dev/null
@@ -1,32 +0,0 @@
-
-* @copyright 2007-2015 PrestaShop SA
-* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
-* International Registred Trademark & Property of PrestaShop SA
-*/
-
-include(dirname(__FILE__).'/../../config/config.inc.php');
-include(dirname(__FILE__).'/../../init.php');
-
-Context::getContext()->controller->php_self = 'category';
-$blockLayered = Module::getInstanceByName('blocklayered');
-echo $blockLayered->ajaxCall();
diff --git a/modules/blocklayered/blocklayered-attribute-indexer.php b/modules/blocklayered/blocklayered-attribute-indexer.php
deleted file mode 100644
index 42d064e1a..000000000
--- a/modules/blocklayered/blocklayered-attribute-indexer.php
+++ /dev/null
@@ -1,10 +0,0 @@
-indexAttribute();
\ No newline at end of file
diff --git a/modules/blocklayered/blocklayered-footer.js b/modules/blocklayered/blocklayered-footer.js
deleted file mode 100644
index 2cd80195a..000000000
--- a/modules/blocklayered/blocklayered-footer.js
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
-* 2007-2015 PrestaShop
-*
-* 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@prestashop.com 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
-* @copyright 2007-2015 PrestaShop SA
-* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
-* International Registred Trademark & Property of PrestaShop SA
-*/
-$(document).ready(function()
-{
- $('#selectProductSort').unbind('change').bind('change', function()
- {
- reloadContent();
- })
-});
\ No newline at end of file
diff --git a/modules/blocklayered/blocklayered-no-products.tpl b/modules/blocklayered/blocklayered-no-products.tpl
deleted file mode 100644
index fc6e00ff1..000000000
--- a/modules/blocklayered/blocklayered-no-products.tpl
+++ /dev/null
@@ -1,27 +0,0 @@
-{*
-* 2007-2015 PrestaShop
-*
-* 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@prestashop.com 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
-* @copyright 2007-2015 PrestaShop SA
-* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
-* International Registred Trademark & Property of PrestaShop SA
-*}
-
-
{l s='There are no products.' mod='blocklayered'}
-
diff --git a/modules/blocklayered/blocklayered-price-indexer.php b/modules/blocklayered/blocklayered-price-indexer.php
deleted file mode 100644
index 2d5bc038e..000000000
--- a/modules/blocklayered/blocklayered-price-indexer.php
+++ /dev/null
@@ -1,32 +0,0 @@
-indexUrl($cursor, (int)Tools::getValue('truncate'));
\ No newline at end of file
diff --git a/modules/blocklayered/blocklayered.css b/modules/blocklayered/blocklayered.css
deleted file mode 100644
index 25b271a1f..000000000
--- a/modules/blocklayered/blocklayered.css
+++ /dev/null
@@ -1,159 +0,0 @@
-#layered_block_left div.block_content {
- padding: 6px;
-}
-
-#layered_block_left ul {
- padding-left: 0;
- max-height: 120px;
- overflow-y: auto;
- overflow-x: hidden;
- padding-left: 1px;
- padding-right: 1px;
-}
-
-#layered_form > div > div {
- border-bottom: 1px dotted #CCCCCC;
- padding-bottom: 5px;
- margin-bottom: 5px;
-}
-
-#layered_block_left .hide-action {
- display: block;
- text-align: right;
- padding-right: 5px;
-}
-#layered_block_left .hide-action:hover {
- text-decoration: underline;
-}
-
-#layered_block_left ul li {
- margin-left: 15px;
- padding-left: 2px;
- list-style-type: none;
-}
-
-#layered_block_left #enabled_filters , #layered_url_filter_block {
- font-size: 10px;
- padding-bottom: 5px;
-}
-
-#layered_block_left #enabled_filters ul li {
- margin-left: 0;
- padding-left: 0;
-}
-
-
-/* Style moved form the template to the css */
-#layered_block_left #enabled_filters ul li:hover {
- background: inherit;
- color: inherit;
-}
-
-#layered_block_left #enabled_filters a {
- text-decoration: none;
- color: red;
-}
-
-#layered_block_left ul li:hover {
- background: #71BF47;
- color: #FFF;
-}
-
-#layered_block_left ul li label {
- cursor: pointer;
-}
-
-#layered_block_left ul li.nomargin {
- margin-left: 0;
-}
-
-#layered_block_left span.layered_subtitle {
- float: left;
- font-weight: bold;
- font-size: 12px;
- display: block;
- margin-bottom: 4px;
-}
-
-#layered_block_left span.layered_close a { text-decoration: none; }
-
-#layered_block_left span.layered_close {
- float: right;
- font-weight: bold;
- font-size: 12px;
- display: block;
- margin-bottom: 4px;
-}
-
-#layered_block_left ul li input.checkbox {
- vertical-align: middle;
- margin-left: 2px;
-}
-
-#layered_block_left ul li .disabled {
- color: #666;
-}
-#product_list .warning {
- margin-top: 13px;
-}
-
-#layered_form .select {
- width: 165px;
-}
-#layered_form .color-option {
- margin-left: 0;
- width: 16px;
- height: 16px;
- padding:0;
- border: 1px solid #666;
-}
-#layered_block_left .color-option.disable {
- opacity: 0.5;
- filter:alpha(opacity=50);
- -moz-opacity:0.5;
-}
-#layered_form .color-option.on {
- border: 1px solid red;
-}
-#layered_form input[type=radio] {
- margin-left: 2px;
- vertical-align: middle;
-}
-.layered_price_range {
- margin-left: 7px;
-}
-.layered_price_range_unit {
- margin-right: 7px;
-}
-.layered_slider_container {
- margin: 6px 0 6px 6px; width: 93%;
-}
-.layered_slider {
- margin-top:5px;
-}
-.layered_input_range_min {
- width:30px;
-}
-.layered_input_range_max {
- width:40px;
-}
-.layered_list_selected {
- font-weight: bold;
-}
-.layered_ajax_loader p {
- margin: 20px 0;
- text-align: center;
-}
-.hide-action {
- text-align: center;
- text-align: right;
- display: block;
- cursor: pointer;
-}
-.hide-action:hover {
- font-weight: bold;
-}
-#layered_form div div ul {
- max-height: 200px;
- overflow-x: auto;
-}
diff --git a/modules/blocklayered/blocklayered.js b/modules/blocklayered/blocklayered.js
deleted file mode 100644
index 3269e4baf..000000000
--- a/modules/blocklayered/blocklayered.js
+++ /dev/null
@@ -1,643 +0,0 @@
-/*
-* 2007-2015 PrestaShop
-*
-* 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@prestashop.com 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
-* @copyright 2007-2015 PrestaShop SA
-* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
-* International Registred Trademark & Property of PrestaShop SA
-*/
-
-var ajaxQueries = new Array();
-var ajaxLoaderOn = 0;
-var sliderList = new Array();
-var slidersInit = false;
-
-$(document).ready(function()
-{
- cancelFilter();
- openCloseFilter();
-
- // Click on color
- $('#layered_form input[type=button], #layered_form label.layered_color').live('click', function()
- {
- if (!$('input[name='+$(this).attr('name')+'][type=hidden]').length)
- $('').attr('type', 'hidden').attr('name', $(this).attr('name')).val($(this).data('rel')).appendTo('#layered_form');
- else
- $('input[name='+$(this).attr('name')+'][type=hidden]').remove();
- reloadContent();
- });
-
- // Click on checkbox
- $('#layered_form input[type=checkbox], #layered_form input[type=radio]').live('click', function()
- {
- reloadContent();
- });
-
- $(document).on('change', '#layered_form .select', function(e)
- {
- reloadContent();
- });
-
- // Changing content of an input text
- $('#layered_form input.layered_input_range').live('keyup', function()
- {
- if ($(this).attr('timeout_id'))
- window.clearTimeout($(this).attr('timeout_id'));
-
- // IE Hack, setTimeout do not acept the third parameter
- var reference = this;
-
- $(this).attr('timeout_id', window.setTimeout(function(it) {
- if (!$(it).attr('id'))
- it = reference;
-
- var filter = $(it).attr('id').replace(/^layered_(.+)_range_.*$/, '$1');
-
- var value_min = parseInt($('#layered_'+filter+'_range_min').val());
- if (isNaN(value_min))
- value_min = 0;
- $('#layered_'+filter+'_range_min').val(value_min);
-
- var value_max = parseInt($('#layered_'+filter+'_range_max').val());
- if (isNaN(value_max))
- value_max = 0;
- $('#layered_'+filter+'_range_max').val(value_max);
-
- if (value_max < value_min) {
- $('#layered_'+filter+'_range_max').val($(it).val());
- $('#layered_'+filter+'_range_min').val($(it).val());
- }
- reloadContent();
- }, 500, this));
- });
-
- $('#layered_block_left .radio').live('click', function() {
- var name = $(this).attr('name');
- $.each($(this).parent().parent().find('input[type=button]'), function (it, item) {
- if ($(item).hasClass('on') && $(item).attr('name') != name) {
- $(item).click();
- }
- });
- return true;
- });
-
- // Click on label
- $('#layered_block_left label a').live({
- click: function() {
- var disable = $(this).parent().parent().find('input').attr('disabled');
- if (disable == ''
- || typeof(disable) == 'undefined'
- || disable == false)
- {
- $(this).parent().parent().find('input').click();
- reloadContent();
- }
- return false;
- }
- });
-
- layered_hidden_list = {};
- $('.hide-action').live('click', function() {
- if (typeof(layered_hidden_list[$(this).parent().find('ul').attr('id')]) == 'undefined' || layered_hidden_list[$(this).parent().find('ul').attr('id')] == false)
- {
- layered_hidden_list[$(this).parent().find('ul').attr('id')] = true;
- }
- else
- {
- layered_hidden_list[$(this).parent().find('ul').attr('id')] = false;
- }
- hideFilterValueAction(this);
- });
- $('.hide-action').each(function() {
- hideFilterValueAction(this);
- });
-
- // To be sure there is no other events attached to the selectProductSort, change the ID
- var id = 1;
- while ($('#selectPrductSort').length) { // Because ids are duplicated
- // Unbind event change on #selectPrductSort
- $('#selectPrductSort').unbind('change');
- $('#selectPrductSort').attr('onchange', '');
- $('#selectPrductSort').addClass('selectProductSort');
- $('#selectPrductSort').attr('id', 'selectPrductSort'+id);
- $('label[for=selectPrductSort]').attr('for', 'selectPrductSort'+id);
- id++;
- }
-
- while ($('#selectProductSort').length) { // Because ids are duplicated
- // Unbind event change on #selectProductSort
- $('#selectProductSort').unbind('change');
- $('#selectProductSort').attr('onchange', '');
- $('#selectProductSort').addClass('selectProductSort');
- $('#selectProductSort').attr('id', 'selectProductSort'+id);
- $('label[for=selectProductSort]').attr('for', 'selectProductSort'+id);
- id++;
- }
-
- // Since 1.5, event is add to .selectProductSort and not to #selectProductSort
- setTimeout(function() {
- $('.selectProductSort').unbind('change');
- }, 100);
-
- $('.selectProductSort').live('change', function(event) {
- $('.selectProductSort').val($(this).val());
- reloadContent();
- });
-
- // To be sure there is no other events attached to the nb_item, change the ID
- var id = 1;
- while ($('#nb_item').length) { // Because ids are duplicated
- // Unbind event change on #nb_item
- $('#nb_item').unbind('change');
- $('#nb_item').attr('onchange', '');
- $('#nb_item').addClass('nb_item');
- $('#nb_item').attr('id', 'nb_item'+id);
- $('label[for=nb_item]').attr('for', 'nb_item'+id);
- id++;
- }
- $('.nb_item').live('change', function(event) {
- $('.nb_item').val($(this).val());
- reloadContent();
- });
-
- paginationButton();
- initLayered();
-});
-
-function hideFilterValueAction(it)
-{
- if (typeof(layered_hidden_list[$(it).parent().find('ul').attr('id')]) == 'undefined' || layered_hidden_list[$(it).parent().find('ul').attr('id')] == false)
- {
- $(it).parent().find('.hiddable').hide();
- $(it).parent().find('.hide-action.less').hide();
- $(it).parent().find('.hide-action.more').show();
- }
- else
- {
- $(it).parent().find('.hiddable').show();
- $(it).parent().find('.hide-action.less').show();
- $(it).parent().find('.hide-action.more').hide();
- }
-}
-
-function addSlider(type, data, unit, format)
-{
- sliderList.push({
- type: type,
- data: data,
- unit: unit,
- format: format
- });
-}
-
-function initSliders()
-{
- $(sliderList).each(function(i, slider){
- $('#layered_'+slider['type']+'_slider').slider(slider['data']);
-
- var from = '';
- var to = '';
- switch (slider['format'])
- {
- case 1:
- case 2:
- case 3:
- case 4:
- from = blocklayeredFormatCurrency($('#layered_'+slider['type']+'_slider').slider('values', 0), slider['format'], slider['unit']);
- to = blocklayeredFormatCurrency($('#layered_'+slider['type']+'_slider').slider('values', 1), slider['format'], slider['unit']);
- break;
- case 5:
- from = $('#layered_'+slider['type']+'_slider').slider('values', 0)+slider['unit']
- to = $('#layered_'+slider['type']+'_slider').slider('values', 1)+slider['unit'];
- break;
- }
- $('#layered_'+slider['type']+'_range').html(from+' - '+to);
- });
-}
-
-function initLayered()
-{
- initSliders();
- initLocationChange();
- updateProductUrl();
- if (window.location.href.split('#').length == 2 && window.location.href.split('#')[1] != '')
- {
- var params = window.location.href.split('#')[1];
- reloadContent('&selected_filters='+params);
- }
-}
-
-function paginationButton() {
- $('#pagination a').not(':hidden').each(function () {
- if ($(this).attr('href').search(/[&|\?]p=/) == -1)
- var page = 1;
- else
- var page = $(this).attr('href').replace(/^.*[&|\?]p=(\d+).*$/, '$1');
-
- var location = window.location.href.replace(/#.*$/, '');
- $(this).attr('href', location+current_friendly_url.replace(/\/page-(\d+)/, '')+'/page-'+page);
- });
- $('#pagination li').not('.current, .disabled').each(function () {
- var nbPage = 0;
- if ($(this).attr('id') == 'pagination_next')
- nbPage = parseInt($('#pagination li.current').children().html())+ 1;
- else if ($(this).attr('id') == 'pagination_previous')
- nbPage = parseInt($('#pagination li.current').children().html())- 1;
-
- $(this).children().click(function () {
- if (nbPage == 0)
- p = parseInt($(this).html()) + parseInt(nbPage);
- else
- p = nbPage;
- p = '&p='+ p;
- reloadContent(p);
- nbPage = 0;
- return false;
- });
- });
-}
-
-function cancelFilter()
-{
- $('#enabled_filters a').live('click', function(e)
- {
- if ($(this).data('rel').search(/_slider$/) > 0)
- {
- if ($('#'+$(this).data('rel')).length)
- {
- $('#'+$(this).data('rel')).slider('values' , 0, $('#'+$(this).data('rel')).slider('option' , 'min' ));
- $('#'+$(this).data('rel')).slider('values' , 1, $('#'+$(this).data('rel')).slider('option' , 'max' ));
- $('#'+$(this).data('rel')).slider('option', 'slide')(0,{values:[$('#'+$(this).data('rel')).slider( 'option' , 'min' ), $('#'+$(this).data('rel')).slider( 'option' , 'max' )]});
- }
- else if($('#'+$(this).data('rel').replace(/_slider$/, '_range_min')).length)
- {
- $('#'+$(this).data('rel').replace(/_slider$/, '_range_min')).val($('#'+$(this).data('rel').replace(/_slider$/, '_range_min')).attr('limitValue'));
- $('#'+$(this).data('rel').replace(/_slider$/, '_range_max')).val($('#'+$(this).data('rel').replace(/_slider$/, '_range_max')).attr('limitValue'));
- }
- }
- else
- {
- if ($('option#'+$(this).data('rel')).length)
- {
- $('#'+$(this).data('rel')).parent().val('');
- }
- else
- {
- $('#'+$(this).data('rel')).attr('checked', false);
- $('.'+$(this).data('rel')).attr('checked', false);
- $('#layered_form input[type=hidden][name='+$(this).data('rel')+']').remove();
- }
- }
- reloadContent();
- e.preventDefault();
- });
-}
-
-function openCloseFilter()
-{
- $('#layered_form span.layered_close a').live('click', function(e)
- {
- if ($(this).html() == '<')
- {
- $('#'+$(this).data('rel')).show();
- $(this).html('v');
- $(this).parent().removeClass('closed');
- }
- else
- {
- $('#'+$(this).data('rel')).hide();
- $(this).html('<');
- $(this).parent().addClass('closed');
- }
-
- e.preventDefault();
- });
-}
-
-function stopAjaxQuery() {
- if (typeof(ajaxQueries) == 'undefined')
- ajaxQueries = new Array();
- for(i = 0; i < ajaxQueries.length; i++) {
- if (typeof ajaxQueries[i] != 'undefined')
- ajaxQueries[i].abort();
- }
- ajaxQueries = new Array();
-}
-
-function reloadContent(params_plus)
-{
- stopAjaxQuery();
-
- if (!ajaxLoaderOn)
- {
- $('#product_list').prepend($('#layered_ajax_loader').html());
- $('#product_list').css('opacity', '0.7');
- ajaxLoaderOn = 1;
- }
-
- data = $('#layered_form').serialize();
- $('.layered_slider').each( function () {
- var sliderStart = $(this).slider('values', 0);
- var sliderStop = $(this).slider('values', 1);
- if (typeof(sliderStart) == 'number' && typeof(sliderStop) == 'number')
- data += '&'+$(this).attr('id')+'='+sliderStart+'_'+sliderStop;
- });
-
- $(['price', 'weight']).each(function(it, sliderType)
- {
- if ($('#layered_'+sliderType+'_range_min').length)
- {
- data += '&layered_'+sliderType+'_slider='+$('#layered_'+sliderType+'_range_min').val()+'_'+$('#layered_'+sliderType+'_range_max').val();
- }
- });
-
- $('#layered_form .select option').each( function () {
- if($(this).attr('id') && $(this).parent().val() == $(this).val())
- {
- data += '&'+$(this).attr('id') + '=' + $(this).val();
- }
- });
-
- if ($('.selectProductSort').length && $('.selectProductSort').val())
- {
- if ($('.selectProductSort').val().search(/orderby=/) > 0)
- {
- // Old ordering working
- var splitData = [
- $('.selectProductSort').val().match(/orderby=(\w*)/)[1],
- $('.selectProductSort').val().match(/orderway=(\w*)/)[1]
- ];
- }
- else
- {
- // New working for default theme 1.4 and theme 1.5
- var splitData = $('.selectProductSort').val().split(':');
- }
- data += '&orderby='+splitData[0]+'&orderway='+splitData[1];
- }
- if ($('.nb_item').length)
- {
- data += '&n='+$('.nb_item').val();
- }
-
- var slideUp = true;
- if (params_plus == undefined || !(typeof params_plus == 'string'))
- {
- params_plus = '';
- slideUp = false;
- }
-
- // Get nb items per page
- var n = '';
- $('#pagination #nb_item').children().each(function(it, option) {
- if (option.selected)
- n = '&n='+option.value;
- });
-
- ajaxQuery = $.ajax(
- {
- type: 'GET',
- url: baseDir + 'modules/blocklayered/blocklayered-ajax.php',
- data: data+params_plus+n,
- dataType: 'json',
- cache: false, // @todo see a way to use cache and to add a timestamps parameter to refresh cache each 10 minutes for example
- success: function(result)
- {
- $('#layered_block_left').replaceWith(utf8_decode(result.filtersBlock));
-
- $('.category-product-count').html(result.categoryCount);
-
- if (result.productList)
- $('#product_list').replaceWith(utf8_decode(result.productList));
- else
- $('#product_list').html('');
-
- $('#product_list').css('opacity', '1');
- if ($.browser.msie) // Fix bug with IE8 and aliasing
- $('#product_list').css('filter', '');
-
- if (result.pagination.search(/[^\s]/) >= 0) {
- if ($(result.pagination).find('ul.pagination').length)
- {
- $('div#pagination').show();
- $('ul.pagination').each(function () {
- $(this).replaceWith($(result.pagination).find('ul.pagination'));
- });
- }
- else if (!$('ul.pagination').length)
- {
- $('div#pagination').show();
- $('div#pagination').each(function () {
- $(this).html($(result.pagination));
- });
- }
- else
- {
- $('ul.pagination').html('');
- $('div#pagination').hide();
- }
- }
- else
- {
- $('ul.pagination').html('');
- $('div#pagination').hide();
- }
-
- paginationButton();
- ajaxLoaderOn = 0;
-
- // On submiting nb items form, relaod with the good nb of items
- $('#pagination form').submit(function() {
- val = $('#pagination #nb_item').val();
- $('#pagination #nb_item').children().each(function(it, option) {
- if (option.value == val)
- $(option).attr('selected', true);
- else
- $(option).removeAttr('selected');
- });
- // Reload products and pagination
- reloadContent();
- return false;
- });
- if (typeof(ajaxCart) != "undefined")
- ajaxCart.overrideButtonsInThePage();
-
- if (typeof(reloadProductComparison) == 'function')
- reloadProductComparison();
- initSliders();
-
- // Currente page url
- if (typeof(current_friendly_url) == 'undefined')
- current_friendly_url = '#';
-
- // Get all sliders value
- $(['price', 'weight']).each(function(it, sliderType)
- {
- if ($('#layered_'+sliderType+'_slider').length)
- {
- // Check if slider is enable & if slider is used
- if(typeof($('#layered_'+sliderType+'_slider').slider('values', 0)) != 'object')
- {
- if ($('#layered_'+sliderType+'_slider').slider('values', 0) != $('#layered_'+sliderType+'_slider').slider('option' , 'min')
- || $('#layered_'+sliderType+'_slider').slider('values', 1) != $('#layered_'+sliderType+'_slider').slider('option' , 'max'))
- current_friendly_url += '/'+sliderType+'-'+$('#layered_'+sliderType+'_slider').slider('values', 0)+'-'+$('#layered_'+sliderType+'_slider').slider('values', 1)
- }
- }
- else if ($('#layered_'+sliderType+'_range_min').length)
- {
- if ($('#layered_' + sliderType + '_range_min').attr('limitValue') != $('#layered_'+sliderType+'_range_min').val()
- || $('#layered_' + sliderType + '_range_max').attr('limitValue') != $('#layered_'+sliderType+'_range_max').val())
- current_friendly_url += '/'+sliderType+'-'+$('#layered_'+sliderType+'_range_min').val()+'-'+$('#layered_'+sliderType+'_range_max').val();
- }
- });
- window.location = current_friendly_url;
- lockLocationChecking = true;
-
- if(slideUp)
- $.scrollTo('#product_list', 400);
- updateProductUrl();
-
- $('.hide-action').each(function() {
- hideFilterValueAction(this);
- });
- }
- });
- ajaxQueries.push(ajaxQuery);
-}
-
-function initLocationChange(func, time)
-{
- if(!time) time = 500;
- var current_friendly_url = getUrlParams();
- setInterval(function()
- {
- if(getUrlParams() != current_friendly_url && !lockLocationChecking)
- {
- // Don't reload page if current_friendly_url and real url match
- if (current_friendly_url.replace(/^#(\/)?/, '') == getUrlParams().replace(/^#(\/)?/, ''))
- return;
-
- lockLocationChecking = true;
- reloadContent('&selected_filters='+getUrlParams().replace(/^#/, ''));
- }
- else {
- lockLocationChecking = false;
- current_friendly_url = getUrlParams();
- }
- }, time);
-}
-
-function getUrlParams()
-{
- var params = current_friendly_url;
- if(window.location.href.split('#').length == 2 && window.location.href.split('#')[1] != '')
- params = '#'+window.location.href.split('#')[1];
- return params;
-}
-
-function updateProductUrl()
-{
- // Adding the filters to URL product
- if (typeof(param_product_url) != 'undefined' && param_product_url != '' && param_product_url !='#') {
- $.each($('ul#product_list li.ajax_block_product .product_img_link,'+
- 'ul#product_list li.ajax_block_product h3 a,'+
- 'ul#product_list li.ajax_block_product .product_desc a,'+
- 'ul#product_list li.ajax_block_product .lnk_view'), function() {
- $(this).attr('href', $(this).attr('href') + param_product_url);
- });
- }
-}
-
-
-/**
- * Copy of the php function utf8_decode()
- */
-function utf8_decode (utfstr) {
- var res = '';
- for (var i = 0; i < utfstr.length;) {
- var c = utfstr.charCodeAt(i);
-
- if (c < 128)
- {
- res += String.fromCharCode(c);
- i++;
- }
- else if((c > 191) && (c < 224))
- {
- var c1 = utfstr.charCodeAt(i+1);
- res += String.fromCharCode(((c & 31) << 6) | (c1 & 63));
- i += 2;
- }
- else
- {
- var c1 = utfstr.charCodeAt(i+1);
- var c2 = utfstr.charCodeAt(i+2);
- res += String.fromCharCode(((c & 15) << 12) | ((c1 & 63) << 6) | (c2 & 63));
- i += 3;
- }
- }
- return res;
-}
-
-
-/**
- * Return a formatted price
- * Copy from tools.js
- */
-function blocklayeredFormatCurrency(price, currencyFormat, currencySign, currencyBlank)
-{
- // if you modified this function, don't forget to modify the PHP function displayPrice (in the Tools.php class)
- blank = '';
- price = parseFloat(price.toFixed(6));
- price = ps_round(price, priceDisplayPrecision);
- if (currencyBlank > 0)
- blank = ' ';
- if (currencyFormat == 1)
- return currencySign + blank + blocklayeredFormatNumber(price, priceDisplayPrecision, ',', '.');
- if (currencyFormat == 2)
- return (blocklayeredFormatNumber(price, priceDisplayPrecision, ' ', ',') + blank + currencySign);
- if (currencyFormat == 3)
- return (currencySign + blank + blocklayeredFormatNumber(price, priceDisplayPrecision, '.', ','));
- if (currencyFormat == 4)
- return (blocklayeredFormatNumber(price, priceDisplayPrecision, ',', '.') + blank + currencySign);
- return price;
-}
-
-
-/**
- * Return a formatted number
- * Copy from tools.js
- */
-function blocklayeredFormatNumber(value, numberOfDecimal, thousenSeparator, virgule)
-{
- value = value.toFixed(numberOfDecimal);
- var val_string = value+'';
- var tmp = val_string.split('.');
- var abs_val_string = (tmp.length == 2) ? tmp[0] : val_string;
- var deci_string = ('0.' + (tmp.length == 2 ? tmp[1] : 0)).substr(2);
- var nb = abs_val_string.length;
-
- for (var i = 1 ; i < 4; i++)
- if (value >= Math.pow(10, (3 * i)))
- abs_val_string = abs_val_string.substring(0, nb - (3 * i)) + thousenSeparator + abs_val_string.substring(nb - (3 * i));
-
- if (parseInt(numberOfDecimal) == 0)
- return abs_val_string;
- return abs_val_string + virgule + (deci_string > 0 ? deci_string : '00');
-}
diff --git a/modules/blocklayered/blocklayered.php b/modules/blocklayered/blocklayered.php
deleted file mode 100644
index 4fc04290a..000000000
--- a/modules/blocklayered/blocklayered.php
+++ /dev/null
@@ -1,3516 +0,0 @@
-
-* @copyright 2007-2015 PrestaShop SA
-* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
-* International Registred Trademark & Property of PrestaShop SA
-*/
-
-if (!defined('_PS_VERSION_'))
- exit;
-
-class BlockLayered extends Module
-{
- private $products;
- private $nbr_products;
- private $page = 1;
-
- public function __construct()
- {
- $this->name = 'blocklayered';
- $this->tab = 'front_office_features';
- $this->version = '2.1.3';
- $this->author = 'PrestaShop';
- $this->need_instance = 0;
- $this->bootstrap = true;
-
- parent::__construct();
-
- $this->displayName = $this->l('Layered navigation block');
- $this->description = $this->l('Displays a block with layered navigation filters.');
-
- if ((int)Tools::getValue('p'))
- $this->page = (int)Tools::getValue('p');
- }
-
- public function install()
- {
- if (parent::install() && $this->registerHook('header') && $this->registerHook('leftColumn')
- && $this->registerHook('categoryAddition') && $this->registerHook('categoryUpdate') && $this->registerHook('attributeGroupForm')
- && $this->registerHook('afterSaveAttributeGroup') && $this->registerHook('afterDeleteAttributeGroup') && $this->registerHook('featureForm')
- && $this->registerHook('afterDeleteFeature') && $this->registerHook('afterSaveFeature') && $this->registerHook('categoryDeletion')
- && $this->registerHook('afterSaveProduct') && $this->registerHook('productListAssign') && $this->registerHook('postProcessAttributeGroup')
- && $this->registerHook('postProcessFeature') && $this->registerHook('featureValueForm') && $this->registerHook('postProcessFeatureValue')
- && $this->registerHook('afterDeleteFeatureValue') && $this->registerHook('afterSaveFeatureValue') && $this->registerHook('attributeForm')
- && $this->registerHook('postProcessAttribute') && $this->registerHook('afterDeleteAttribute') && $this->registerHook('afterSaveAttribute') && $this->registerHook('leftColumn'))
- {
-
- Configuration::updateValue('PS_LAYERED_HIDE_0_VALUES', 1);
- Configuration::updateValue('PS_LAYERED_SHOW_QTIES', 1);
- Configuration::updateValue('PS_LAYERED_FULL_TREE', 1);
- Configuration::updateValue('PS_LAYERED_FILTER_PRICE_USETAX', 1);
- Configuration::updateValue('PS_LAYERED_FILTER_CATEGORY_DEPTH', 1);
- Configuration::updateValue('PS_LAYERED_FILTER_INDEX_QTY', 0);
- Configuration::updateValue('PS_LAYERED_FILTER_INDEX_CDT', 0);
- Configuration::updateValue('PS_LAYERED_FILTER_INDEX_MNF', 0);
- Configuration::updateValue('PS_LAYERED_FILTER_INDEX_CAT', 0);
- Configuration::updateValue('PS_ATTRIBUTE_ANCHOR_SEPARATOR', '-');
- Configuration::updateValue('PS_LAYERED_FILTER_PRICE_ROUNDING', 1);
-
- $this->rebuildLayeredStructure();
- $this->buildLayeredCategories();
-
- $products_count = Db::getInstance()->getValue('SELECT COUNT(*) FROM `'._DB_PREFIX_.'product`');
-
- if ($products_count < 20000) // Lock template filter creation if too many products
- $this->rebuildLayeredCache();
-
- self::installPriceIndexTable();
- $this->installFriendlyUrlTable();
- $this->installIndexableAttributeTable();
- $this->installProductAttributeTable();
-
- if ($products_count < 5000) // Lock indexation if too many products
- {
- self::fullPricesIndexProcess();
- $this->indexUrl();
- $this->indexAttribute();
- }
-
- return true;
- }
- else
- {
- // Installation failed (or hook registration) => uninstall the module
- $this->uninstall();
- return false;
- }
- }
-
- public function uninstall()
- {
- /* Delete all configurations */
- Configuration::deleteByName('PS_LAYERED_HIDE_0_VALUES');
- Configuration::deleteByName('PS_LAYERED_SHOW_QTIES');
- Configuration::deleteByName('PS_LAYERED_FULL_TREE');
- Configuration::deleteByName('PS_LAYERED_INDEXED');
- Configuration::deleteByName('PS_LAYERED_FILTER_PRICE_USETAX');
- Configuration::deleteByName('PS_LAYERED_FILTER_CATEGORY_DEPTH');
- Configuration::deleteByName('PS_LAYERED_FILTER_INDEX_QTY');
- Configuration::deleteByName('PS_LAYERED_FILTER_INDEX_CDT');
- Configuration::deleteByName('PS_LAYERED_FILTER_INDEX_MNF');
- Configuration::deleteByName('PS_LAYERED_FILTER_INDEX_CAT');
- Configuration::deleteByName('PS_LAYERED_FILTER_PRICE_ROUNDING');
-
- Db::getInstance()->execute('DROP TABLE IF EXISTS '._DB_PREFIX_.'layered_price_index');
- Db::getInstance()->execute('DROP TABLE IF EXISTS '._DB_PREFIX_.'layered_friendly_url');
- Db::getInstance()->execute('DROP TABLE IF EXISTS '._DB_PREFIX_.'layered_indexable_attribute_group');
- Db::getInstance()->execute('DROP TABLE IF EXISTS '._DB_PREFIX_.'layered_indexable_feature');
- Db::getInstance()->execute('DROP TABLE IF EXISTS '._DB_PREFIX_.'layered_indexable_attribute_lang_value');
- Db::getInstance()->execute('DROP TABLE IF EXISTS '._DB_PREFIX_.'layered_indexable_attribute_group_lang_value');
- Db::getInstance()->execute('DROP TABLE IF EXISTS '._DB_PREFIX_.'layered_indexable_feature_lang_value');
- Db::getInstance()->execute('DROP TABLE IF EXISTS '._DB_PREFIX_.'layered_indexable_feature_value_lang_value');
- Db::getInstance()->execute('DROP TABLE IF EXISTS '._DB_PREFIX_.'layered_category');
- Db::getInstance()->execute('DROP TABLE IF EXISTS '._DB_PREFIX_.'layered_filter');
- Db::getInstance()->execute('DROP TABLE IF EXISTS '._DB_PREFIX_.'layered_filter_shop');
- Db::getInstance()->execute('DROP TABLE IF EXISTS '._DB_PREFIX_.'layered_product_attribute');
- return parent::uninstall();
- }
-
- private static function installPriceIndexTable()
- {
- Db::getInstance()->execute('DROP TABLE IF EXISTS `'._DB_PREFIX_.'layered_price_index`');
-
- Db::getInstance()->execute('
- CREATE TABLE `'._DB_PREFIX_.'layered_price_index` (
- `id_product` INT NOT NULL,
- `id_currency` INT NOT NULL,
- `id_shop` INT NOT NULL,
- `price_min` INT NOT NULL,
- `price_max` INT NOT NULL,
- PRIMARY KEY (`id_product`, `id_currency`, `id_shop`),
- INDEX `id_currency` (`id_currency`),
- INDEX `price_min` (`price_min`), INDEX `price_max` (`price_max`)
- ) ENGINE='._MYSQL_ENGINE_.' DEFAULT CHARSET=utf8;');
- }
-
- private function installFriendlyUrlTable()
- {
- Db::getInstance()->execute('DROP TABLE IF EXISTS `'._DB_PREFIX_.'layered_friendly_url`');
- Db::getInstance()->execute('
- CREATE TABLE `'._DB_PREFIX_.'layered_friendly_url` (
- `id_layered_friendly_url` INT NOT NULL AUTO_INCREMENT,
- `url_key` varchar(32) NOT NULL,
- `data` varchar(200) NOT NULL,
- `id_lang` INT NOT NULL,
- PRIMARY KEY (`id_layered_friendly_url`),
- INDEX `id_lang` (`id_lang`)
- ) ENGINE='._MYSQL_ENGINE_.' DEFAULT CHARSET=utf8;');
-
- Db::getInstance()->execute('CREATE INDEX `url_key` ON `'._DB_PREFIX_.'layered_friendly_url`(url_key(5))');
- }
-
- private function installIndexableAttributeTable()
- {
- // Attributes Groups
- Db::getInstance()->execute('DROP TABLE IF EXISTS `'._DB_PREFIX_.'layered_indexable_attribute_group`');
- Db::getInstance()->execute('
- CREATE TABLE `'._DB_PREFIX_.'layered_indexable_attribute_group` (
- `id_attribute_group` INT NOT NULL,
- `indexable` BOOL NOT NULL DEFAULT 0,
- PRIMARY KEY (`id_attribute_group`)
- ) ENGINE='._MYSQL_ENGINE_.' DEFAULT CHARSET=utf8;');
- Db::getInstance()->execute('
- INSERT INTO `'._DB_PREFIX_.'layered_indexable_attribute_group`
- SELECT id_attribute_group, 1 FROM `'._DB_PREFIX_.'attribute_group`');
-
- Db::getInstance()->execute('DROP TABLE IF EXISTS `'._DB_PREFIX_.'layered_indexable_attribute_group_lang_value`');
- Db::getInstance()->execute('
- CREATE TABLE `'._DB_PREFIX_.'layered_indexable_attribute_group_lang_value` (
- `id_attribute_group` INT NOT NULL,
- `id_lang` INT NOT NULL,
- `url_name` VARCHAR(128),
- `meta_title` VARCHAR(128),
- PRIMARY KEY (`id_attribute_group`, `id_lang`)
- ) ENGINE='._MYSQL_ENGINE_.' DEFAULT CHARSET=utf8;');
-
- // Attributes
- Db::getInstance()->execute('DROP TABLE IF EXISTS `'._DB_PREFIX_.'layered_indexable_attribute_lang_value`');
- Db::getInstance()->execute('
- CREATE TABLE `'._DB_PREFIX_.'layered_indexable_attribute_lang_value` (
- `id_attribute` INT NOT NULL,
- `id_lang` INT NOT NULL,
- `url_name` VARCHAR(128),
- `meta_title` VARCHAR(128),
- PRIMARY KEY (`id_attribute`, `id_lang`)
- ) ENGINE='._MYSQL_ENGINE_.' DEFAULT CHARSET=utf8;');
-
-
- // Features
- Db::getInstance()->execute('DROP TABLE IF EXISTS `'._DB_PREFIX_.'layered_indexable_feature`');
- Db::getInstance()->execute('
- CREATE TABLE `'._DB_PREFIX_.'layered_indexable_feature` (
- `id_feature` INT NOT NULL,
- `indexable` BOOL NOT NULL DEFAULT 0,
- PRIMARY KEY (`id_feature`)
- ) ENGINE='._MYSQL_ENGINE_.' DEFAULT CHARSET=utf8;');
-
- Db::getInstance()->execute('
- INSERT INTO `'._DB_PREFIX_.'layered_indexable_feature`
- SELECT id_feature, 1 FROM `'._DB_PREFIX_.'feature`');
-
- Db::getInstance()->execute('DROP TABLE IF EXISTS `'._DB_PREFIX_.'layered_indexable_feature_lang_value`');
- Db::getInstance()->execute('
- CREATE TABLE `'._DB_PREFIX_.'layered_indexable_feature_lang_value` (
- `id_feature` INT NOT NULL,
- `id_lang` INT NOT NULL,
- `url_name` VARCHAR(128) NOT NULL,
- `meta_title` VARCHAR(128),
- PRIMARY KEY (`id_feature`, `id_lang`)
- ) ENGINE='._MYSQL_ENGINE_.' DEFAULT CHARSET=utf8;');
-
- // Features values
- Db::getInstance()->execute('DROP TABLE IF EXISTS `'._DB_PREFIX_.'layered_indexable_feature_value_lang_value`');
- Db::getInstance()->execute('
- CREATE TABLE `'._DB_PREFIX_.'layered_indexable_feature_value_lang_value` (
- `id_feature_value` INT NOT NULL,
- `id_lang` INT NOT NULL,
- `url_name` VARCHAR(128),
- `meta_title` VARCHAR(128),
- PRIMARY KEY (`id_feature_value`, `id_lang`)
- ) ENGINE='._MYSQL_ENGINE_.' DEFAULT CHARSET=utf8;');
- }
-
- /**
- *
- * create table product attribute
- */
- public function installProductAttributeTable()
- {
- Db::getInstance()->execute('DROP TABLE IF EXISTS `'._DB_PREFIX_.'layered_product_attribute`');
- Db::getInstance()->execute('
- CREATE TABLE `'._DB_PREFIX_.'layered_product_attribute` (
- `id_attribute` int(10) unsigned NOT NULL,
- `id_product` int(10) unsigned NOT NULL,
- `id_attribute_group` int(10) unsigned NOT NULL DEFAULT "0",
- `id_shop` int(10) unsigned NOT NULL DEFAULT "1",
- PRIMARY KEY (`id_attribute`, `id_product`, `id_shop`),
- UNIQUE KEY `id_attribute_group` (`id_attribute_group`,`id_attribute`,`id_product`, `id_shop`)
- ) ENGINE='._MYSQL_ENGINE_.' DEFAULT CHARSET=utf8;');
- }
-
- //ATTRIBUTES GROUP
- public function hookAfterSaveAttributeGroup($params)
- {
- if (!$params['id_attribute_group'] || Tools::getValue('layered_indexable') === false)
- return;
-
- Db::getInstance()->execute(
- 'DELETE FROM '._DB_PREFIX_.'layered_indexable_attribute_group
- WHERE `id_attribute_group` = '.(int)$params['id_attribute_group']
- );
- Db::getInstance()->execute(
- 'DELETE FROM '._DB_PREFIX_.'layered_indexable_attribute_group_lang_value
- WHERE `id_attribute_group` = '.(int)$params['id_attribute_group']
- );
-
- Db::getInstance()->execute(
- 'INSERT INTO '._DB_PREFIX_.'layered_indexable_attribute_group (`id_attribute_group`, `indexable`)
- VALUES ('.(int)$params['id_attribute_group'].', '.(int)Tools::getValue('layered_indexable').')'
- );
-
-
- foreach (Language::getLanguages(false) as $language)
- {
- $seo_url = Tools::getValue('url_name_'.(int)$language['id_lang']);
-
- if(empty($seo_url))
- $seo_url = Tools::getValue('name_'.(int)$language['id_lang']);
-
- Db::getInstance()->execute(
- 'INSERT INTO '._DB_PREFIX_.'layered_indexable_attribute_group_lang_value
- (`id_attribute_group`, `id_lang`, `url_name`, `meta_title`)
- VALUES (
- '.(int)$params['id_attribute_group'].', '.(int)$language['id_lang'].',
- \''.pSQL(Tools::link_rewrite($seo_url)).'\',
- \''.pSQL(Tools::getValue('meta_title_'.(int)$language['id_lang']), true).'\'
- )'
- );
- }
- }
-
- public function hookAfterDeleteAttributeGroup($params)
- {
- if (!$params['id_attribute_group'])
- return;
-
- Db::getInstance()->execute(
- 'DELETE FROM '._DB_PREFIX_.'layered_indexable_attribute_group
- WHERE `id_attribute_group` = '.(int)$params['id_attribute_group']
- );
- Db::getInstance()->execute(
- 'DELETE FROM '._DB_PREFIX_.'layered_indexable_attribute_group_lang_value
- WHERE `id_attribute_group` = '.(int)$params['id_attribute_group']
- );
- }
-
- public function hookPostProcessAttributeGroup($params)
- {
- $errors = array();
-
- foreach (Language::getLanguages(false) as $language)
- {
- $id_lang = $language['id_lang'];
-
- if (Tools::getValue('url_name_'.$id_lang))
- if (Tools::link_rewrite(Tools::getValue('url_name_'.$id_lang)) != strtolower(Tools::getValue('url_name_'.$id_lang)))
- $params['errors'][] = Tools::displayError(sprintf($this->l('"%s" is not a valid url'),
- Tools::getValue('url_name_'.$id_lang)));
- }
- }
-
- public function hookAttributeGroupForm($params)
- {
- $values = array();
- $is_indexable = Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue(
- 'SELECT `indexable`
- FROM '._DB_PREFIX_.'layered_indexable_attribute_group
- WHERE `id_attribute_group` = '.(int)$params['id_attribute_group']
- );
-
- if ($is_indexable === false)
- $is_indexable = true;
-
- if ($result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS(
- 'SELECT `url_name`, `meta_title`, `id_lang` FROM '._DB_PREFIX_.'layered_indexable_attribute_group_lang_value
- WHERE `id_attribute_group` = '.(int)$params['id_attribute_group']
- ))
- foreach ($result as $data)
- $values[$data['id_lang']] = array('url_name' => $data['url_name'], 'meta_title' => $data['meta_title']);
-
- $this->context->smarty->assign(array(
- 'languages' => Language::getLanguages(false),
- 'default_form_language' => (int)$this->context->controller->default_form_language,
- 'values' => $values,
- 'is_indexable' =>(bool)$is_indexable
- ));
-
- if (version_compare(_PS_VERSION_, '1.6.0', '>=') === true)
- return $this->display(__FILE__, 'attribute_group_form_1.6.tpl');
- else
- return $this->display(__FILE__, 'attribute_group_form.tpl');
- }
-
- //ATTRIBUTES
- public function hookAfterSaveAttribute($params)
- {
- if (!$params['id_attribute'])
- return;
-
- Db::getInstance()->execute(
- 'DELETE FROM '._DB_PREFIX_.'layered_indexable_attribute_lang_value
- WHERE `id_attribute` = '.(int)$params['id_attribute']
- );
-
- foreach (Language::getLanguages(false) as $language)
- {
- $seo_url = Tools::getValue('url_name_'.(int)$language['id_lang']);
-
- if(empty($seo_url))
- $seo_url = Tools::getValue('name_'.(int)$language['id_lang']);
-
- Db::getInstance()->execute(
- 'INSERT INTO '._DB_PREFIX_.'layered_indexable_attribute_lang_value
- (`id_attribute`, `id_lang`, `url_name`, `meta_title`)
- VALUES (
- '.(int)$params['id_attribute'].', '.(int)$language['id_lang'].',
- \''.pSQL(Tools::link_rewrite($seo_url)).'\',
- \''.pSQL(Tools::getValue('meta_title_'.(int)$language['id_lang']), true).'\'
- )'
- );
- }
- }
-
- public function hookAfterDeleteAttribute($params)
- {
- if (!$params['id_attribute'])
- return;
-
- Db::getInstance()->execute(
- 'DELETE FROM '._DB_PREFIX_.'layered_indexable_attribute_lang_value
- WHERE `id_attribute` = '.(int)$params['id_attribute']
- );
- }
-
- public function hookPostProcessAttribute($params)
- {
- $errors = array();
-
- foreach (Language::getLanguages(false) as $language)
- {
- $id_lang = $language['id_lang'];
-
- if (Tools::getValue('url_name_'.$id_lang))
- if (Tools::link_rewrite(Tools::getValue('url_name_'.$id_lang)) != strtolower(Tools::getValue('url_name_'.$id_lang)))
- $params['errors'][] = Tools::displayError(sprintf($this->l('"%s" is not a valid url'),
- Tools::getValue('url_name_'.$id_lang)));
- }
- }
-
- public function hookAttributeForm($params)
- {
- $values = array();
-
- if ($result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS(
- 'SELECT `url_name`, `meta_title`, `id_lang`
- FROM '._DB_PREFIX_.'layered_indexable_attribute_lang_value
- WHERE `id_attribute` = '.(int)$params['id_attribute']
- ))
- foreach ($result as $data)
- $values[$data['id_lang']] = array('url_name' => $data['url_name'], 'meta_title' => $data['meta_title']);
-
- $this->context->smarty->assign(array(
- 'languages' => Language::getLanguages(false),
- 'default_form_language' => (int)$this->context->controller->default_form_language,
- 'values' => $values
- ));
-
- if (version_compare(_PS_VERSION_, '1.6.0', '>=') === true)
- return $this->display(__FILE__, 'attribute_form_1.6.tpl');
- else
- return $this->display(__FILE__, 'attribute_form.tpl');
- }
-
- //FEATURES
- public function hookAfterSaveFeature($params)
- {
- if (!$params['id_feature'] || Tools::getValue('layered_indexable') === false)
- return;
-
- Db::getInstance()->execute(
- 'DELETE FROM '._DB_PREFIX_.'layered_indexable_feature
- WHERE `id_feature` = '.(int)$params['id_feature']
- );
- Db::getInstance()->execute(
- 'DELETE FROM '._DB_PREFIX_.'layered_indexable_feature_lang_value
- WHERE `id_feature` = '.(int)$params['id_feature']
- );
-
- Db::getInstance()->execute(
- 'INSERT INTO '._DB_PREFIX_.'layered_indexable_feature
- (`id_feature`, `indexable`)
- VALUES ('.(int)$params['id_feature'].', '.(int)Tools::getValue('layered_indexable').')'
- );
-
- foreach (Language::getLanguages(false) as $language)
- {
- $seo_url = Tools::getValue('url_name_'.(int)$language['id_lang']);
-
- if(empty($seo_url))
- $seo_url = Tools::getValue('name_'.(int)$language['id_lang']);
-
- Db::getInstance()->execute(
- 'INSERT INTO '._DB_PREFIX_.'layered_indexable_feature_lang_value
- (`id_feature`, `id_lang`, `url_name`, `meta_title`)
- VALUES (
- '.(int)$params['id_feature'].', '.(int)$language['id_lang'].',
- \''.pSQL(Tools::link_rewrite($seo_url)).'\',
- \''.pSQL(Tools::getValue('meta_title_'.(int)$language['id_lang']), true).'\'
- )'
- );
- }
- }
-
- public function hookAfterDeleteFeature($params)
- {
- if (!$params['id_feature'])
- return;
-
- Db::getInstance()->execute(
- 'DELETE FROM '._DB_PREFIX_.'layered_indexable_feature
- WHERE `id_feature` = '.(int)$params['id_feature']
- );
- }
-
- public function hookPostProcessFeature($params)
- {
- $errors = array();
-
- foreach (Language::getLanguages(false) as $language)
- {
- $id_lang = $language['id_lang'];
-
- if (Tools::getValue('url_name_'.$id_lang))
- if (Tools::link_rewrite(Tools::getValue('url_name_'.$id_lang)) != strtolower(Tools::getValue('url_name_'.$id_lang)))
- $params['errors'][] = Tools::displayError(sprintf($this->l('"%s" is not a valid url'),
- Tools::getValue('url_name_'.$id_lang)));
- }
- }
-
- public function hookFeatureForm($params)
- {
- $values = array();
- $is_indexable = Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue(
- 'SELECT `indexable`
- FROM '._DB_PREFIX_.'layered_indexable_feature
- WHERE `id_feature` = '.(int)$params['id_feature']
- );
-
- if ($is_indexable === false)
- $is_indexable = true;
-
- if ($result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS(
- 'SELECT `url_name`, `meta_title`, `id_lang` FROM '._DB_PREFIX_.'layered_indexable_feature_lang_value
- WHERE `id_feature` = '.(int)$params['id_feature']
- ))
- foreach ($result as $data)
- $values[$data['id_lang']] = array('url_name' => $data['url_name'], 'meta_title' => $data['meta_title']);
-
- $this->context->smarty->assign(array(
- 'languages' => Language::getLanguages(false),
- 'default_form_language' => (int)$this->context->controller->default_form_language,
- 'values' => $values,
- 'is_indexable' =>(bool)$is_indexable
- ));
-
- if (version_compare(_PS_VERSION_, '1.6.0', '>=') === true)
- return $this->display(__FILE__, 'feature_form_1.6.tpl');
- else
- return $this->display(__FILE__, 'feature_form.tpl');
- }
-
- //FEATURES VALUE
- public function hookAfterSaveFeatureValue($params)
- {
- if (!$params['id_feature_value'])
- return;
-
- //Removing all indexed language data for this attribute value id
- Db::getInstance()->execute(
- 'DELETE FROM '._DB_PREFIX_.'layered_indexable_feature_value_lang_value
- WHERE `id_feature_value` = '.(int)$params['id_feature_value']
- );
-
- foreach (Language::getLanguages(false) as $language)
- {
- $seo_url = Tools::getValue('url_name_'.(int)$language['id_lang']);
-
- if(empty($seo_url))
- $seo_url = Tools::getValue('name_'.(int)$language['id_lang']);
-
- Db::getInstance()->execute(
- 'INSERT INTO '._DB_PREFIX_.'layered_indexable_feature_value_lang_value
- (`id_feature_value`, `id_lang`, `url_name`, `meta_title`)
- VALUES (
- '.(int)$params['id_feature_value'].', '.(int)$language['id_lang'].',
- \''.pSQL(Tools::link_rewrite($seo_url)).'\',
- \''.pSQL(Tools::getValue('meta_title_'.(int)$language['id_lang']), true).'\'
- )'
- );
- }
- }
-
- public function hookAfterDeleteFeatureValue($params)
- {
- if (!$params['id_feature_value'])
- return;
-
- Db::getInstance()->execute(
- 'DELETE FROM '._DB_PREFIX_.'layered_indexable_feature_value_lang_value
- WHERE `id_feature_value` = '.(int)$params['id_feature_value']
- );
- }
-
- public function hookPostProcessFeatureValue($params)
- {
- $errors = array();
-
- foreach (Language::getLanguages(false) as $language)
- {
- $id_lang = $language['id_lang'];
-
- if (Tools::getValue('url_name_'.$id_lang))
- if (Tools::link_rewrite(Tools::getValue('url_name_'.$id_lang)) != strtolower(Tools::getValue('url_name_'.$id_lang)))
- $params['errors'][] = Tools::displayError(sprintf($this->l('"%s" is not a valid url'),
- Tools::getValue('url_name_'.$id_lang)));
- }
- }
-
- public function hookFeatureValueForm($params)
- {
- $values = array();
-
- if ($result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS(
- 'SELECT `url_name`, `meta_title`, `id_lang`
- FROM '._DB_PREFIX_.'layered_indexable_feature_value_lang_value
- WHERE `id_feature_value` = '.(int)$params['id_feature_value']
- ))
- foreach ($result as $data)
- $values[$data['id_lang']] = array('url_name' => $data['url_name'], 'meta_title' => $data['meta_title']);
-
- $this->context->smarty->assign(array(
- 'languages' => Language::getLanguages(false),
- 'default_form_language' => (int)$this->context->controller->default_form_language,
- 'values' => $values
- ));
-
- if (version_compare(_PS_VERSION_, '1.6.0', '>=') === true)
- return $this->display(__FILE__, 'feature_value_form_1.6.tpl');
- else
- return $this->display(__FILE__, 'feature_value_form.tpl');
- }
-
- public function hookProductListAssign($params)
- {
- if ((isset($this->context->controller->display_column_left) && !$this->context->controller->display_column_left)
- && (isset($this->context->controller->display_column_right) && !$this->context->controller->display_column_right))
- return false;
-
- global $smarty;
- if (!Configuration::getGlobalValue('PS_LAYERED_INDEXED'))
- return;
-
- $categories_count = Db::getInstance()->getValue('
- SELECT COUNT(*)
- FROM '._DB_PREFIX_.'layered_category
- WHERE id_category = '.(int)Tools::getValue('id_category', Tools::getValue('id_category_layered', Configuration::get('PS_HOME_CATEGORY'))).'
- AND id_shop = '.(int) Context::getContext()->shop->id
- );
-
- if ($categories_count == 0)
- return;
-
- // Inform the hook was executed
- $params['hookExecuted'] = true;
- // List of product to overrride categoryController
- $params['catProducts'] = array();
- $selected_filters = $this->getSelectedFilters();
- $filter_block = $this->getFilterBlock($selected_filters);
- $title = '';
-
- if (is_array($filter_block['title_values']))
- foreach ($filter_block['title_values'] as $key => $val)
- $title .= ' > '.$key.' '.implode('/', $val);
-
- $smarty->assign('categoryNameComplement', $title);
- $this->getProducts($selected_filters, $params['catProducts'], $params['nbProducts'], $p, $n, $pages_nb, $start, $stop, $range);
- // Need a nofollow on the pagination links?
- $smarty->assign('no_follow', $filter_block['no_follow']);
- }
-
- public function hookAfterSaveProduct($params)
- {
- if (!$params['id_product'])
- return;
-
- self::indexProductPrices((int)$params['id_product']);
- $this->indexAttribute((int)$params['id_product']);
- }
-
- public function hookLeftColumn($params)
- {
- return $this->generateFiltersBlock($this->getSelectedFilters());
- }
-
- public function hookRightColumn($params)
- {
- return $this->hookLeftColumn($params);
- }
-
- public function hookHeader($params)
- {
- if ((isset($this->context->controller->display_column_left) && !$this->context->controller->display_column_left)
- && (isset($this->context->controller->display_column_right) && !$this->context->controller->display_column_right))
- return false;
-
- global $smarty, $cookie;
-
- // No filters => module disable
- if ($filter_block = $this->getFilterBlock($this->getSelectedFilters()))
- if ($filter_block['nbr_filterBlocks'] == 0)
- return false;
-
- if (Tools::getValue('id_category', Tools::getValue('id_category_layered', Configuration::get('PS_HOME_CATEGORY'))) == Configuration::get('PS_HOME_CATEGORY'))
- return;
-
- $id_lang = (int)$cookie->id_lang;
- $category = new Category((int)Tools::getValue('id_category'));
-
- // Generate meta title and meta description
- $category_title = (empty($category->meta_title[$id_lang]) ? $category->name[$id_lang] : $category->meta_title[$id_lang]);
- $category_metas = Meta::getMetaTags($id_lang, 'category');
- $title = '';
- $keywords = '';
-
- if (is_array($filter_block['title_values']))
- foreach ($filter_block['title_values'] as $key => $val)
- {
- $title .= ' > '.$key.' '.implode('/', $val);
- $keywords .= $key.' '.implode('/', $val).', ';
- }
-
- $title = $category_title.$title;
-
- if (!empty($title))
- $smarty->assign('meta_title', $title.' - '.Configuration::get('PS_SHOP_NAME'));
- else
- $smarty->assign('meta_title', $category_metas['meta_title']);
-
- $smarty->assign('meta_description', $category_metas['meta_description']);
-
- $keywords = substr(strtolower($keywords), 0, 1000);
- if (!empty($keywords))
- $smarty->assign('meta_keywords', rtrim($category_title.', '.$keywords.', '.$category_metas['meta_keywords'], ', '));
-
-
- $this->context->controller->addJS(($this->_path).'blocklayered.js');
- $this->context->controller->addJS(_PS_JS_DIR_.'jquery/jquery-ui-1.8.10.custom.min.js');
- $this->context->controller->addJQueryUI('ui.slider');
- $this->context->controller->addCSS(_PS_CSS_DIR_.'jquery-ui-1.8.10.custom.css');
-
- if (version_compare(_PS_VERSION_, '1.6.0', '>=') === true)
- $this->context->controller->addCSS(($this->_path).'blocklayered.css', 'all');
- else
- $this->context->controller->addCSS(($this->_path).'blocklayered-15.css', 'all');
- $this->context->controller->addJQueryPlugin('scrollTo');
-
- $filters = $this->getSelectedFilters();
-
- // Get non indexable attributes
- $attribute_group_list = Db::getInstance()->executeS('SELECT id_attribute_group FROM '._DB_PREFIX_.'layered_indexable_attribute_group WHERE indexable = 0');
- // Get non indexable features
- $feature_list = Db::getInstance()->executeS('SELECT id_feature FROM '._DB_PREFIX_.'layered_indexable_feature WHERE indexable = 0');
-
- $attributes = array();
- $features = array();
-
- $blacklist = array('weight', 'price');
- if (!Configuration::get('PS_LAYERED_FILTER_INDEX_CDT'))
- $blacklist[] = 'condition';
- if (!Configuration::get('PS_LAYERED_FILTER_INDEX_QTY'))
- $blacklist[] = 'quantity';
- if (!Configuration::get('PS_LAYERED_FILTER_INDEX_MNF'))
- $blacklist[] = 'manufacturer';
- if (!Configuration::get('PS_LAYERED_FILTER_INDEX_CAT'))
- $blacklist[] = 'category';
-
- foreach ($filters as $type => $val)
- {
- switch ($type)
- {
- case 'id_attribute_group':
- foreach ($val as $attr)
- {
- $attr_id = preg_replace('/_\d+$/', '', $attr);
- if (in_array($attr_id, $attributes) || in_array(array('id_attribute_group' => $attr_id), $attribute_group_list))
- {
- $smarty->assign('nobots', true);
- $smarty->assign('nofollow', true);
- return;
- }
- $attributes[] = $attr_id;
- }
- break;
- case 'id_feature':
- foreach ($val as $feat)
- {
- $feat_id = preg_replace('/_\d+$/', '', $feat);
- if (in_array($feat_id, $features) || in_array(array('id_feature' => $feat_id), $feature_list))
- {
- $smarty->assign('nobots', true);
- $smarty->assign('nofollow', true);
- return;
- }
- $features[] = $feat_id;
- }
- break;
- default:
- if (in_array($type, $blacklist))
- {
- if (count($val))
- {
- $smarty->assign('nobots', true);
- $smarty->assign('nofollow', true);
- return;
- }
- }
- elseif (count($val) > 1)
- {
- $smarty->assign('nobots', true);
- $smarty->assign('nofollow', true);
- return;
- }
- break;
- }
- }
- }
-
- public function hookFooter($params)
- {
- if ((isset($this->context->controller->display_column_left) && !$this->context->controller->display_column_left)
- && (isset($this->context->controller->display_column_right) && !$this->context->controller->display_column_right))
- return false;
-
- // No filters => module disable
- if ($filter_block = $this->getFilterBlock($this->getSelectedFilters()))
- if ($filter_block['nbr_filterBlocks'] == 0)
- return false;
-
- if (Dispatcher::getInstance()->getController() == 'category')
- $this->context->controller->addJS($this->_path.'blocklayered-footer.js');
- }
-
- public function hookCategoryAddition($params)
- {
- $this->rebuildLayeredCache(array(), array((int)$params['category']->id));
- }
-
- public function hookCategoryUpdate($params)
- {
- /* The category status might (active, inactive) have changed, we have to update the layered cache table structure */
- if (isset($params['category']) && !$params['category']->active)
- $this->hookCategoryDeletion($params);
- }
-
- public function hookCategoryDeletion($params)
- {
- $layered_filter_list = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS(
- 'SELECT * FROM '._DB_PREFIX_.'layered_filter'
- );
-
- foreach ($layered_filter_list as $layered_filter)
- {
- $data = Tools::unSerialize($layered_filter['filters']);
-
- if (in_array((int)$params['category']->id, $data['categories']))
- {
- unset($data['categories'][array_search((int)$params['category']->id, $data['categories'])]);
- Db::getInstance()->execute(
- 'UPDATE `'._DB_PREFIX_.'layered_filter`
- SET `filters` = \''.pSQL(serialize($data)).'\'
- WHERE `id_layered_filter` = '.(int)$layered_filter['id_layered_filter']
- );
- }
- }
-
- $this->buildLayeredCategories();
- }
-
- /*
- * Generate data product attribute
- */
- public function indexAttribute($id_product = null)
- {
- if (is_null($id_product))
- Db::getInstance()->execute('TRUNCATE '._DB_PREFIX_.'layered_product_attribute');
- else
- Db::getInstance()->execute('
- DELETE FROM '._DB_PREFIX_.'layered_product_attribute
- WHERE id_product = '.(int)$id_product
- );
-
- Db::getInstance()->execute('
- INSERT INTO `'._DB_PREFIX_.'layered_product_attribute` (`id_attribute`, `id_product`, `id_attribute_group`, `id_shop`)
- SELECT pac.id_attribute, pa.id_product, ag.id_attribute_group, product_attribute_shop.`id_shop`
- FROM '._DB_PREFIX_.'product_attribute pa'.
- Shop::addSqlAssociation('product_attribute', 'pa').'
- INNER JOIN '._DB_PREFIX_.'product_attribute_combination pac ON pac.id_product_attribute = pa.id_product_attribute
- INNER JOIN '._DB_PREFIX_.'attribute a ON (a.id_attribute = pac.id_attribute)
- INNER JOIN '._DB_PREFIX_.'attribute_group ag ON ag.id_attribute_group = a.id_attribute_group
- '.(is_null($id_product) ? '' : 'AND pa.id_product = '.(int)$id_product).'
- GROUP BY a.id_attribute, pa.id_product , product_attribute_shop.`id_shop`'
- );
-
- return 1;
- }
-
- /*
- * Url indexation
- */
- public function indexUrl($ajax = false, $truncate = true)
- {
- if ($truncate)
- Db::getInstance()->execute('TRUNCATE '._DB_PREFIX_.'layered_friendly_url');
-
- $attribute_values_by_lang = array();
- $filters = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
- SELECT lc.*, id_lang, name, link_rewrite, cl.id_category
- FROM '._DB_PREFIX_.'layered_category lc
- INNER JOIN '._DB_PREFIX_.'category_lang cl ON (cl.id_category = lc.id_category AND lc.id_category <> 1 )
- GROUP BY type, id_value, id_lang'
- );
-
- if (!$filters)
- return;
-
- foreach ($filters as $filter)
- switch ($filter['type'])
- {
- case 'id_attribute_group':
- $attributes = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
- SELECT agl.public_name name, a.id_attribute_group id_name, al.name value, a.id_attribute id_value, al.id_lang,
- liagl.url_name name_url_name, lial.url_name value_url_name
- FROM '._DB_PREFIX_.'attribute_group ag
- INNER JOIN '._DB_PREFIX_.'attribute_group_lang agl ON (agl.id_attribute_group = ag.id_attribute_group)
- INNER JOIN '._DB_PREFIX_.'attribute a ON (a.id_attribute_group = ag.id_attribute_group)
- INNER JOIN '._DB_PREFIX_.'attribute_lang al ON (al.id_attribute = a.id_attribute)
- LEFT JOIN '._DB_PREFIX_.'layered_indexable_attribute_group liag ON (liag.id_attribute_group = a.id_attribute_group)
- LEFT JOIN '._DB_PREFIX_.'layered_indexable_attribute_group_lang_value liagl
- ON (liagl.id_attribute_group = ag.id_attribute_group AND liagl.id_lang = '.(int)$filter['id_lang'].')
- LEFT JOIN '._DB_PREFIX_.'layered_indexable_attribute_lang_value lial
- ON (lial.id_attribute = a.id_attribute AND lial.id_lang = '.(int)$filter['id_lang'].')
- WHERE a.id_attribute_group = '.(int)$filter['id_value'].' AND agl.id_lang = al.id_lang AND agl.id_lang = '.(int)$filter['id_lang']
- );
-
- foreach ($attributes as $attribute)
- {
- if (!isset($attribute_values_by_lang[$attribute['id_lang']]))
- $attribute_values_by_lang[$attribute['id_lang']] = array();
- if (!isset($attribute_values_by_lang[$attribute['id_lang']]['c'.$attribute['id_name']]))
- $attribute_values_by_lang[$attribute['id_lang']]['c'.$attribute['id_name']] = array();
- $attribute_values_by_lang[$attribute['id_lang']]['c'.$attribute['id_name']][] = array(
- 'name' => (!empty($attribute['name_url_name']) ? $attribute['name_url_name'] : $attribute['name']),
- 'id_name' => 'c'.$attribute['id_name'],
- 'value' => (!empty($attribute['value_url_name']) ? $attribute['value_url_name'] : $attribute['value']),
- 'id_value' => $attribute['id_name'].'_'.$attribute['id_value'],
- 'id_id_value' => $attribute['id_value'],
- 'category_name' => $filter['link_rewrite'],
- 'type' => $filter['type']);
- }
- break;
-
- case 'id_feature':
- $features = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
- SELECT fl.name name, fl.id_feature id_name, fvl.id_feature_value id_value, fvl.value value, fl.id_lang, fl.id_lang,
- lifl.url_name name_url_name, lifvl.url_name value_url_name
- FROM '._DB_PREFIX_.'feature_lang fl
- LEFT JOIN '._DB_PREFIX_.'layered_indexable_feature lif ON (lif.id_feature = fl.id_feature)
- INNER JOIN '._DB_PREFIX_.'feature_value fv ON (fv.id_feature = fl.id_feature)
- INNER JOIN '._DB_PREFIX_.'feature_value_lang fvl ON (fvl.id_feature_value = fv.id_feature_value)
- LEFT JOIN '._DB_PREFIX_.'layered_indexable_feature_lang_value lifl
- ON (lifl.id_feature = fl.id_feature AND lifl.id_lang = '.(int)$filter['id_lang'].')
- LEFT JOIN '._DB_PREFIX_.'layered_indexable_feature_value_lang_value lifvl
- ON (lifvl.id_feature_value = fvl.id_feature_value AND lifvl.id_lang = '.(int)$filter['id_lang'].')
- WHERE fl.id_feature = '.(int)$filter['id_value'].' AND fvl.id_lang = fl.id_lang AND fvl.id_lang = '.(int)$filter['id_lang']
- );
-
- foreach ($features as $feature)
- {
- if (!isset($attribute_values_by_lang[$feature['id_lang']]))
- $attribute_values_by_lang[$feature['id_lang']] = array();
- if (!isset($attribute_values_by_lang[$feature['id_lang']]['f'.$feature['id_name']]))
- $attribute_values_by_lang[$feature['id_lang']]['f'.$feature['id_name']] = array();
- $attribute_values_by_lang[$feature['id_lang']]['f'.$feature['id_name']][] = array(
- 'name' => (!empty($feature['name_url_name']) ? $feature['name_url_name'] : $feature['name']),
- 'id_name' => 'f'.$feature['id_name'],
- 'value' => (!empty($feature['value_url_name']) ? $feature['value_url_name'] : $feature['value']),
- 'id_value' => $feature['id_name'].'_'.$feature['id_value'],
- 'id_id_value' => $feature['id_value'],
- 'category_name' => $filter['link_rewrite'],
- 'type' => $filter['type']);
- }
- break;
-
- case 'category':
- $categories = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
- SELECT cl.name, cl.id_lang, c.id_category
- FROM '._DB_PREFIX_.'category c
- INNER JOIN '._DB_PREFIX_.'category_lang cl ON (c.id_category = cl.id_category)
- WHERE cl.id_lang = '.(int)$filter['id_lang']
- );
-
- foreach ($categories as $category)
- {
- if (!isset($attribute_values_by_lang[$category['id_lang']]))
- $attribute_values_by_lang[$category['id_lang']] = array();
- if (!isset($attribute_values_by_lang[$category['id_lang']]['category']))
- $attribute_values_by_lang[$category['id_lang']]['category'] = array();
- $attribute_values_by_lang[$category['id_lang']]['category'][] = array('name' => $this->translateWord('Categories', $category['id_lang']),
- 'id_name' => null, 'value' => $category['name'], 'id_value' => $category['id_category'],
- 'category_name' => $filter['link_rewrite'], 'type' => $filter['type']);
- }
- break;
-
- case 'manufacturer':
- $manufacturers = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
- SELECT m.name as name,l.id_lang as id_lang, id_manufacturer
- FROM '._DB_PREFIX_.'manufacturer m , '._DB_PREFIX_.'lang l
- WHERE l.id_lang = '.(int)$filter['id_lang']
- );
-
- foreach ($manufacturers as $manufacturer)
- {
- if (!isset($attribute_values_by_lang[$manufacturer['id_lang']]))
- $attribute_values_by_lang[$manufacturer['id_lang']] = array();
- if (!isset($attribute_values_by_lang[$manufacturer['id_lang']]['manufacturer']))
- $attribute_values_by_lang[$manufacturer['id_lang']]['manufacturer'] = array();
- $attribute_values_by_lang[$manufacturer['id_lang']]['manufacturer'][] = array('name' => $this->translateWord('Manufacturer', $manufacturer['id_lang']),
- 'id_name' => null, 'value' => $manufacturer['name'], 'id_value' => $manufacturer['id_manufacturer'],
- 'category_name' => $filter['link_rewrite'], 'type' => $filter['type']);
- }
- break;
-
- case 'quantity':
- $avaibility_list = array(
- $this->translateWord('Not available', (int)$filter['id_lang']),
- $this->translateWord('In stock', (int)$filter['id_lang'])
- );
- foreach ($avaibility_list as $key => $quantity)
- $attribute_values_by_lang[$filter['id_lang']]['quantity'][] = array('name' => $this->translateWord('Availability', (int)$filter['id_lang']),
- 'id_name' => null, 'value' => $quantity, 'id_value' => $key, 'id_id_value' => 0,
- 'category_name' => $filter['link_rewrite'], 'type' => $filter['type']);
- break;
-
- case 'condition':
- $condition_list = array(
- 'new' => $this->translateWord('New', (int)$filter['id_lang']),
- 'used' => $this->translateWord('Used', (int)$filter['id_lang']),
- 'refurbished' => $this->translateWord('Refurbished', (int)$filter['id_lang'])
- );
- foreach ($condition_list as $key => $condition)
- $attribute_values_by_lang[$filter['id_lang']]['condition'][] = array('name' => $this->translateWord('Condition', (int)$filter['id_lang']),
- 'id_name' => null, 'value' => $condition, 'id_value' => $key,
- 'category_name' => $filter['link_rewrite'], 'type' => $filter['type']);
- break;
- }
-
- // Foreach langs
- foreach ($attribute_values_by_lang as $id_lang => $attribute_values)
- {
- // Foreach attributes generate a couple "/_". For example: color_blue
- foreach ($attribute_values as $attribute)
- foreach ($attribute as $param)
- {
- $selected_filters = array();
- $link = '/'.str_replace($this->getAnchor(), '_', Tools::link_rewrite($param['name'])).$this->getAnchor().str_replace($this->getAnchor(), '_', Tools::link_rewrite($param['value']));
- $selected_filters[$param['type']] = array();
-
- if (!isset($param['id_id_value']))
- $param['id_id_value'] = $param['id_value'];
-
- $selected_filters[$param['type']][$param['id_id_value']] = $param['id_value'];
- $url_key = md5($link);
- $id_layered_friendly_url = Db::getInstance()->getValue('
- SELECT id_layered_friendly_url
- FROM `'._DB_PREFIX_.'layered_friendly_url` WHERE `id_lang` = '.$id_lang.' AND `url_key` = \''.$url_key.'\''
- );
-
- if ($id_layered_friendly_url == false)
- {
- Db::getInstance()->insert('layered_friendly_url', array('url_key' => $url_key, 'data' => serialize($selected_filters), 'id_lang' => (int)$id_lang));
- $id_layered_friendly_url = Db::getInstance()->Insert_ID();
- }
- }
- }
-
- if ($ajax)
- return '{"result": 1}';
- else
- return 1;
- }
-
- /*
- * $cursor $cursor in order to restart indexing from the last state
- */
- public static function fullPricesIndexProcess($cursor = 0, $ajax = false, $smart = false)
- {
- if ($cursor == 0 && !$smart)
- self::installPriceIndexTable();
-
- return self::indexPrices($cursor, true, $ajax, $smart);
- }
-
- /*
- * $cursor $cursor in order to restart indexing from the last state
- */
- public static function pricesIndexProcess($cursor = 0, $ajax = false)
- {
- return self::indexPrices($cursor, false, $ajax);
- }
-
- private static function indexPrices($cursor = null, $full = false, $ajax = false, $smart = false)
- {
- if ($full)
- $nb_products = (int)Db::getInstance()->getValue('
- SELECT count(DISTINCT p.`id_product`)
- FROM '._DB_PREFIX_.'product p
- INNER JOIN `'._DB_PREFIX_.'product_shop` ps
- ON (ps.`id_product` = p.`id_product` AND ps.`active` = 1 AND ps.`visibility` IN ("both", "catalog"))');
- else
- $nb_products = (int)Db::getInstance()->getValue('
- SELECT COUNT(DISTINCT p.`id_product`) FROM `'._DB_PREFIX_.'product` p
- INNER JOIN `'._DB_PREFIX_.'product_shop` ps
- ON (ps.`id_product` = p.`id_product` AND ps.`active` = 1 AND ps.`visibility` IN ("both", "catalog"))
- LEFT JOIN `'._DB_PREFIX_.'layered_price_index` psi ON (psi.id_product = p.id_product)
- WHERE psi.id_product IS NULL');
-
- $max_executiontime = @ini_get('max_execution_time');
- if ($max_executiontime > 5 || $max_executiontime <= 0)
- $max_executiontime = 5;
-
- $start_time = microtime(true);
-
- if (function_exists('memory_get_peak_usage'))
- do
- {
- $cursor = (int)self::indexPricesUnbreakable((int)$cursor, $full, $smart);
- $time_elapsed = microtime(true) - $start_time;
- }
- while ($cursor < $nb_products && Tools::getMemoryLimit() > memory_get_peak_usage() && $time_elapsed < $max_executiontime);
- else
- do
- {
- $cursor = (int)self::indexPricesUnbreakable((int)$cursor, $full, $smart);
- $time_elapsed = microtime(true) - $start_time;
- }
- while ($cursor < $nb_products && $time_elapsed < $max_executiontime);
-
- if (($nb_products > 0 && !$full || $cursor < $nb_products && $full) && !$ajax)
- {
- $token = substr(Tools::encrypt('blocklayered/index'), 0, 10);
- if (Tools::usingSecureMode())
- $domain = Tools::getShopDomainSsl(true);
- else
- $domain = Tools::getShopDomain(true);
-
- if (!Tools::file_get_contents($domain.__PS_BASE_URI__.'modules/blocklayered/blocklayered-price-indexer.php?token='.$token.'&cursor='.(int)$cursor.'&full='.(int)$full))
- self::indexPrices((int)$cursor, (int)$full);
- return $cursor;
- }
- if ($ajax && $nb_products > 0 && $cursor < $nb_products && $full)
- return '{"cursor": '.$cursor.', "count": '.($nb_products - $cursor).'}';
- else if ($ajax && $nb_products > 0 && !$full)
- return '{"cursor": '.$cursor.', "count": '.($nb_products).'}';
- else
- {
- Configuration::updateGlobalValue('PS_LAYERED_INDEXED', 1);
-
- if ($ajax)
- return '{"result": "ok"}';
- else
- return -1;
- }
- }
-
- /*
- * $cursor $cursor in order to restart indexing from the last state
- */
- private static function indexPricesUnbreakable($cursor, $full = false, $smart = false)
- {
- static $length = 100; // Nb of products to index
-
- if (is_null($cursor))
- $cursor = 0;
-
- if ($full)
- $query = '
- SELECT p.`id_product`
- FROM `'._DB_PREFIX_.'product` p
- INNER JOIN `'._DB_PREFIX_.'product_shop` ps
- ON (ps.`id_product` = p.`id_product` AND ps.`active` = 1 AND ps.`visibility` IN ("both", "catalog"))
- GROUP BY p.`id_product`
- ORDER BY p.`id_product` LIMIT '.(int)$cursor.','.(int)$length;
- else
- $query = '
- SELECT p.`id_product`
- FROM `'._DB_PREFIX_.'product` p
- INNER JOIN `'._DB_PREFIX_.'product_shop` ps
- ON (ps.`id_product` = p.`id_product` AND ps.`active` = 1 AND ps.`visibility` IN ("both", "catalog"))
- LEFT JOIN `'._DB_PREFIX_.'layered_price_index` psi ON (psi.id_product = p.id_product)
- WHERE psi.id_product IS NULL
- GROUP BY p.`id_product`
- ORDER BY p.`id_product` LIMIT 0,'.(int)$length;
-
- foreach (Db::getInstance()->executeS($query) as $product)
- self::indexProductPrices((int)$product['id_product'], ($smart && $full));
-
- return (int)($cursor + $length);
- }
-
- public static function indexProductPrices($id_product, $smart = true)
- {
- static $groups = null;
-
- if (is_null($groups))
- {
- $groups = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('SELECT id_group FROM `'._DB_PREFIX_.'group_reduction`');
- if (!$groups)
- $groups = array();
- }
-
- $shop_list = Shop::getShops(false, null, true);
-
- foreach ($shop_list as $id_shop)
- {
- static $currency_list = null;
-
- if (is_null($currency_list))
- $currency_list = Currency::getCurrencies(false, 1, new Shop($id_shop));
-
- $min_price = array();
- $max_price = array();
-
- if ($smart)
- Db::getInstance()->execute('DELETE FROM `'._DB_PREFIX_.'layered_price_index` WHERE `id_product` = '.(int)$id_product.' AND `id_shop` = '.(int)$id_shop);
-
- if (Configuration::get('PS_LAYERED_FILTER_PRICE_USETAX'))
- $max_tax_rate = Db::getInstance()->getValue('
- SELECT max(t.rate) max_rate
- FROM `'._DB_PREFIX_.'product_shop` p
- LEFT JOIN `'._DB_PREFIX_.'tax_rules_group` trg ON (trg.id_tax_rules_group = p.id_tax_rules_group AND p.id_shop = '.(int)$id_shop.')
- LEFT JOIN `'._DB_PREFIX_.'tax_rule` tr ON (tr.id_tax_rules_group = trg.id_tax_rules_group)
- LEFT JOIN `'._DB_PREFIX_.'tax` t ON (t.id_tax = tr.id_tax AND t.active = 1)
- WHERE id_product = '.(int)$id_product.'
- GROUP BY id_product');
- else
- $max_tax_rate = 0;
-
- $product_min_prices = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
- SELECT id_shop, id_currency, id_country, id_group, from_quantity
- FROM `'._DB_PREFIX_.'specific_price`
- WHERE id_product = '.(int)$id_product);
-
- // Get min price
- foreach ($currency_list as $currency)
- {
- $price = Product::priceCalculation($id_shop, (int)$id_product, null, null, null, null,
- $currency['id_currency'], null, null, false, 6, false, true, true,
- $specific_price_output, true);
-
- if (!isset($max_price[$currency['id_currency']]))
- $max_price[$currency['id_currency']] = 0;
- if (!isset($min_price[$currency['id_currency']]))
- $min_price[$currency['id_currency']] = null;
- if ($price > $max_price[$currency['id_currency']])
- $max_price[$currency['id_currency']] = $price;
- if ($price == 0)
- continue;
- if (is_null($min_price[$currency['id_currency']]) || $price < $min_price[$currency['id_currency']])
- $min_price[$currency['id_currency']] = $price;
- }
-
- foreach ($product_min_prices as $specific_price)
- foreach ($currency_list as $currency)
- {
- if ($specific_price['id_currency'] && $specific_price['id_currency'] != $currency['id_currency'])
- continue;
- $price = Product::priceCalculation((($specific_price['id_shop'] == 0) ? null : (int)$specific_price['id_shop']), (int)$id_product,
- null, (($specific_price['id_country'] == 0) ? null : $specific_price['id_country']), null, null,
- $currency['id_currency'], (($specific_price['id_group'] == 0) ? null : $specific_price['id_group']),
- $specific_price['from_quantity'], false, 6, false, true, true, $specific_price_output, true);
-
- if (!isset($max_price[$currency['id_currency']]))
- $max_price[$currency['id_currency']] = 0;
- if (!isset($min_price[$currency['id_currency']]))
- $min_price[$currency['id_currency']] = null;
- if ($price > $max_price[$currency['id_currency']])
- $max_price[$currency['id_currency']] = $price;
- if ($price == 0)
- continue;
- if (is_null($min_price[$currency['id_currency']]) || $price < $min_price[$currency['id_currency']])
- $min_price[$currency['id_currency']] = $price;
- }
-
- foreach ($groups as $group)
- foreach ($currency_list as $currency)
- {
- $price = Product::priceCalculation(null, (int)$id_product, null, null, null, null, (int)$currency['id_currency'], (int)$group['id_group'],
- null, false, 6, false, true, true, $specific_price_output, true);
-
- if (!isset($max_price[$currency['id_currency']]))
- $max_price[$currency['id_currency']] = 0;
- if (!isset($min_price[$currency['id_currency']]))
- $min_price[$currency['id_currency']] = null;
- if ($price > $max_price[$currency['id_currency']])
- $max_price[$currency['id_currency']] = $price;
- if ($price == 0)
- continue;
- if (is_null($min_price[$currency['id_currency']]) || $price < $min_price[$currency['id_currency']])
- $min_price[$currency['id_currency']] = $price;
- }
-
- $values = array();
- foreach ($currency_list as $currency)
- $values[] = '('.(int)$id_product.',
- '.(int)$currency['id_currency'].',
- '.$id_shop.',
- '.(int)$min_price[$currency['id_currency']].',
- '.(int)Tools::ps_round($max_price[$currency['id_currency']] * (100 + $max_tax_rate) / 100, 0).')';
-
- Db::getInstance()->execute('
- INSERT INTO `'._DB_PREFIX_.'layered_price_index` (id_product, id_currency, id_shop, price_min, price_max)
- VALUES '.implode(',', $values).'
- ON DUPLICATE KEY UPDATE id_product = id_product # avoid duplicate keys');
- }
- }
-
- public function translateWord($string, $id_lang )
- {
- static $_MODULES = array();
- global $_MODULE;
-
- $file = _PS_MODULE_DIR_.$this->name.'/translations/'.Language::getIsoById($id_lang).'.php';
-
- if (!array_key_exists($id_lang, $_MODULES))
- {
- if (file_exists($file1 = _PS_MODULE_DIR_.$this->name.'/translations/'.Language::getIsoById($id_lang).'.php'))
- {
- include($file1);
- $_MODULES[$id_lang] = $_MODULE;
- }
- elseif (file_exists($file2 = _PS_MODULE_DIR_.$this->name.'/'.Language::getIsoById($id_lang).'.php'))
- {
- include($file2);
- $_MODULES[$id_lang] = $_MODULE;
- }
- else
- return $string;
- }
-
- $string = str_replace('\'', '\\\'', $string);
-
- // set array key to lowercase for 1.3 compatibility
- $_MODULES[$id_lang] = array_change_key_case($_MODULES[$id_lang]);
- $current_key = '<{'.strtolower( $this->name).'}'.strtolower(_THEME_NAME_).'>'.strtolower($this->name).'_'.md5($string);
- $default_key = '<{'.strtolower( $this->name).'}prestashop>'.strtolower($this->name).'_'.md5($string);
-
- if (isset($_MODULES[$id_lang][$current_key]))
- $ret = stripslashes($_MODULES[$id_lang][$current_key]);
- else if (isset($_MODULES[$id_lang][Tools::strtolower($current_key)]))
- $ret = stripslashes($_MODULES[$id_lang][Tools::strtolower($current_key)]);
- else if (isset($_MODULES[$id_lang][$default_key]))
- $ret = stripslashes($_MODULES[$id_lang][$default_key]);
- else if (isset($_MODULES[$id_lang][Tools::strtolower($default_key)]))
- $ret = stripslashes($_MODULES[$id_lang][Tools::strtolower($default_key)]);
- else
- $ret = stripslashes($string);
-
- return str_replace('"', '"', $ret);
- }
-
- public function getContent()
- {
- global $cookie;
- $message = '';
-
- if (Tools::isSubmit('SubmitFilter'))
- {
- if (!Tools::getValue('layered_tpl_name'))
- $message = $this->displayError($this->l('Filter template name required (cannot be empty)'));
- elseif (!Tools::getValue('categoryBox'))
- $message = $this->displayError($this->l('You must select at least one category.'));
- else
- {
- if (Tools::getValue('id_layered_filter'))
- {
- Db::getInstance()->execute('
- DELETE FROM '._DB_PREFIX_.'layered_filter
- WHERE id_layered_filter = '.(int)Tools::getValue('id_layered_filter')
- );
- $this->buildLayeredCategories();
- }
-
- if (Tools::getValue('scope') == 1)
- {
- Db::getInstance()->execute('TRUNCATE TABLE '._DB_PREFIX_.'layered_filter');
- $categories = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
- SELECT id_category
- FROM '._DB_PREFIX_.'category'
- );
-
- foreach ($categories as $category)
- $_POST['categoryBox'][] = (int)$category['id_category'];
- }
-
- $id_layered_filter = (int)Tools::getValue('id_layered_filter');
-
- if (!$id_layered_filter)
- $id_layered_filter = (int)Db::getInstance()->Insert_ID();
-
- $shop_list = array();
-
- if (isset($_POST['checkBoxShopAsso_layered_filter']))
- {
- foreach ($_POST['checkBoxShopAsso_layered_filter'] as $id_shop => $row)
- {
- $assos[] = array('id_object' => (int)$id_layered_filter, 'id_shop' => (int)$id_shop);
- $shop_list[] = (int)$id_shop;
- }
- }
- else
- $shop_list = array(Context::getContext()->shop->id);
-
- Db::getInstance()->execute('
- DELETE FROM '._DB_PREFIX_.'layered_filter_shop
- WHERE `id_layered_filter` = '.(int)$id_layered_filter
- );
-
- if (count($_POST['categoryBox']))
- {
- /* Clean categoryBox before use */
- if (isset($_POST['categoryBox']) && is_array($_POST['categoryBox']))
- foreach ($_POST['categoryBox'] as &$category_box_tmp)
- $category_box_tmp = (int)$category_box_tmp;
-
- $filter_values = array();
-
- foreach ($_POST['categoryBox'] as $idc)
- $filter_values['categories'][] = (int)$idc;
-
- $filter_values['shop_list'] = $shop_list;
- $values = false;
-
- foreach ($_POST['categoryBox'] as $id_category_layered)
- {
- foreach ($_POST as $key => $value)
- if (substr($key, 0, 17) == 'layered_selection' && $value == 'on')
- {
- $values = true;
- $type = 0;
- $limit = 0;
-
- if (Tools::getValue($key.'_filter_type'))
- $type = Tools::getValue($key.'_filter_type');
- if (Tools::getValue($key.'_filter_show_limit'))
- $limit = Tools::getValue($key.'_filter_show_limit');
-
- $filter_values[$key] = array(
- 'filter_type' => (int)$type,
- 'filter_show_limit' => (int)$limit
- );
- }
- }
-
- $values_to_insert = array(
- 'name' => pSQL(Tools::getValue('layered_tpl_name')),
- 'filters' => pSQL(serialize($filter_values)),
- 'n_categories' => (int)count($filter_values['categories']),
- 'date_add' => date('Y-m-d H:i:s'));
-
- if (isset($_POST['id_layered_filter']) && $_POST['id_layered_filter'])
- $values_to_insert['id_layered_filter'] = (int)Tools::getValue('id_layered_filter');
-
- Db::getInstance()->autoExecute(_DB_PREFIX_.'layered_filter', $values_to_insert, 'INSERT');
- $id_layered_filter = (int)Db::getInstance()->Insert_ID();
-
- if (isset($assos))
- foreach ($assos as $asso)
- Db::getInstance()->execute('
- INSERT INTO '._DB_PREFIX_.'layered_filter_shop (`id_layered_filter`, `id_shop`)
- VALUES('.$id_layered_filter.', '.(int)$asso['id_shop'].')'
- );
-
- $this->buildLayeredCategories();
- $message = $this->displayConfirmation($this->l('Your filter').' "'.Tools::safeOutput(Tools::getValue('layered_tpl_name')).'" '.
- ((isset($_POST['id_layered_filter']) && $_POST['id_layered_filter']) ? $this->l('was updated successfully.') : $this->l('was added successfully.')));
- }
- }
- }
- else if (Tools::isSubmit('submitLayeredSettings'))
- {
- Configuration::updateValue('PS_LAYERED_HIDE_0_VALUES', (int)Tools::getValue('ps_layered_hide_0_values'));
- Configuration::updateValue('PS_LAYERED_SHOW_QTIES', (int)Tools::getValue('ps_layered_show_qties'));
- Configuration::updateValue('PS_LAYERED_FULL_TREE', (int)Tools::getValue('ps_layered_full_tree'));
- Configuration::updateValue('PS_LAYERED_FILTER_PRICE_USETAX', (int)Tools::getValue('ps_layered_filter_price_usetax'));
- Configuration::updateValue('PS_LAYERED_FILTER_CATEGORY_DEPTH', (int)Tools::getValue('ps_layered_filter_category_depth'));
- Configuration::updateValue('PS_LAYERED_FILTER_INDEX_QTY', (int)Tools::getValue('ps_layered_filter_index_availability'));
- Configuration::updateValue('PS_LAYERED_FILTER_INDEX_CDT', (int)Tools::getValue('ps_layered_filter_index_condition'));
- Configuration::updateValue('PS_LAYERED_FILTER_INDEX_MNF', (int)Tools::getValue('ps_layered_filter_index_manufacturer'));
- Configuration::updateValue('PS_LAYERED_FILTER_INDEX_CAT', (int)Tools::getValue('ps_layered_filter_index_category'));
- Configuration::updateValue('PS_LAYERED_FILTER_PRICE_ROUNDING', (int)Tools::getValue('ps_layered_filter_price_rounding'));
-
- if (version_compare(_PS_VERSION_, '1.6.0', '>=') === true)
- $message = '
'.$this->l('Settings saved successfully').'
';
- else
- $message = '
'.$this->l('Settings saved successfully').'
';
- }
- else if (Tools::getValue('deleteFilterTemplate'))
- {
- $layered_values = Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue('
- SELECT filters
- FROM '._DB_PREFIX_.'layered_filter
- WHERE id_layered_filter = '.(int)Tools::getValue('id_layered_filter')
- );
-
- if ($layered_values)
- {
- Db::getInstance()->execute('
- DELETE FROM '._DB_PREFIX_.'layered_filter
- WHERE id_layered_filter = '.(int)Tools::getValue('id_layered_filter').' LIMIT 1'
- );
- $this->buildLayeredCategories();
- $message = $this->displayConfirmation($this->l('Filter template deleted, categories updated (reverted to default Filter template).'));
- }
- else
- $message = $this->displayError($this->l('Filter template not found'));
- }
-
- $category_box = array();
- $attribute_groups = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
- SELECT ag.id_attribute_group, ag.is_color_group, agl.name, COUNT(DISTINCT(a.id_attribute)) n
- FROM '._DB_PREFIX_.'attribute_group ag
- LEFT JOIN '._DB_PREFIX_.'attribute_group_lang agl ON (agl.id_attribute_group = ag.id_attribute_group)
- LEFT JOIN '._DB_PREFIX_.'attribute a ON (a.id_attribute_group = ag.id_attribute_group)
- WHERE agl.id_lang = '.(int)$cookie->id_lang.'
- GROUP BY ag.id_attribute_group'
- );
-
- $features = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
- SELECT fl.id_feature, fl.name, COUNT(DISTINCT(fv.id_feature_value)) n
- FROM '._DB_PREFIX_.'feature_lang fl
- LEFT JOIN '._DB_PREFIX_.'feature_value fv ON (fv.id_feature = fl.id_feature)
- WHERE (fv.custom IS NULL OR fv.custom = 0) AND fl.id_lang = '.(int)$cookie->id_lang.'
- GROUP BY fl.id_feature'
- );
-
- if (Shop::isFeatureActive() && count(Shop::getShops(true, null, true)) > 1)
- {
- $helper = new HelperForm();
- $helper->id = Tools::getValue('id_layered_filter', null);
- $helper->table = 'layered_filter';
- $helper->identifier = 'id_layered_filter';
- $this->context->smarty->assign('asso_shops', $helper->renderAssoShop());
- }
-
- if (version_compare(_PS_VERSION_, '1.6.0', '>=') === true)
- {
- $tree_categories_helper = new HelperTreeCategories('categories-treeview');
- $tree_categories_helper->setRootCategory((Shop::getContext() == Shop::CONTEXT_SHOP ? Category::getRootCategory()->id_category : 0))
- ->setUseCheckBox(true);
- }
- else
- {
- if (Shop::getContext() == Shop::CONTEXT_SHOP)
- {
- $root_category = Category::getRootCategory();
- $root_category = array('id_category' => $root_category->id_category, 'name' => $root_category->name);
- }
- else
- $root_category = array('id_category' => '0', 'name' => $this->l('Root'));
-
- $tree_categories_helper = new Helper();
- }
-
- $module_url = Tools::getProtocol(Tools::usingSecureMode()).$_SERVER['HTTP_HOST'].$this->getPathUri();
-
- if (method_exists($this->context->controller, 'addJquery'))
- {
- $this->context->controller->addJS($this->_path.'js/blocklayered_admin.js');
-
- if (version_compare(_PS_VERSION_, '1.6.0.3', '>=') === true)
- $this->context->controller->addjqueryPlugin('sortable');
- elseif (version_compare(_PS_VERSION_, '1.6.0', '>=') === true)
- $this->context->controller->addJS(_PS_JS_DIR_.'jquery/plugins/jquery.sortable.js');
- else
- $this->context->controller->addJS($this->_path.'js/jquery.sortable.js');
- }
-
- if (version_compare(_PS_VERSION_, '1.6.0', '>=') === true)
- $this->context->controller->addCSS($this->_path.'css/blocklayered_admin_1.6.css');
- else
- $this->context->controller->addCSS($this->_path.'css/blocklayered_admin.css');
-
- if (Tools::getValue('add_new_filters_template'))
- {
- $this->context->smarty->assign(array(
- 'current_url' => $this->context->link->getAdminLink('AdminModules').'&configure=blocklayered&tab_module=front_office_features&module_name=blocklayered',
- 'uri' => $this->getPathUri(),
- 'id_layered_filter' => 0,
- 'template_name' => sprintf($this->l('My template - %s'), date('Y-m-d')),
- 'attribute_groups' => $attribute_groups,
- 'features' => $features,
- 'total_filters' => 6+count($attribute_groups)+count($features)
- ));
-
- if (version_compare(_PS_VERSION_, '1.6.0', '>=') === true)
- $this->context->smarty->assign('categories_tree', $tree_categories_helper->render());
- else
- $this->context->smarty->assign('categories_tree', $tree_categories_helper->renderCategoryTree(
- $root_category, array(), 'categoryBox'));
-
- if (version_compare(_PS_VERSION_, '1.6.0', '>=') === true)
- return $this->display(__FILE__, 'views/templates/admin/add_1.6.tpl');
- else
- return $this->display(__FILE__, 'views/templates/admin/add.tpl');
- }
- else if (Tools::getValue('edit_filters_template'))
- {
- $template = Db::getInstance()->getRow('
- SELECT *
- FROM `'._DB_PREFIX_.'layered_filter`
- WHERE id_layered_filter = '.(int)Tools::getValue('id_layered_filter')
- );
-
- $filters = Tools::unSerialize($template['filters']);
-
- if (version_compare(_PS_VERSION_, '1.6.0', '>=') === true)
- {
- $tree_categories_helper->setSelectedCategories($filters['categories']);
- $this->context->smarty->assign('categories_tree', $tree_categories_helper->render());
- }
- else
- $this->context->smarty->assign('categories_tree',$tree_categories_helper->renderCategoryTree(
- $root_category, $filters['categories'], 'categoryBox'));
-
- $select_shops = $filters['shop_list'];
- unset($filters['categories']);
- unset($filters['shop_list']);
-
- $this->context->smarty->assign(array(
- 'current_url' => $this->context->link->getAdminLink('AdminModules').'&configure=blocklayered&tab_module=front_office_features&module_name=blocklayered',
- 'uri' => $this->getPathUri(),
- 'id_layered_filter' => (int)Tools::getValue('id_layered_filter'),
- 'template_name' => $template['name'],
- 'attribute_groups' => $attribute_groups,
- 'features' => $features,
- 'filters' => json_encode($filters),
- 'total_filters' => 6+count($attribute_groups)+count($features)
- ));
-
- if (version_compare(_PS_VERSION_, '1.6.0', '>=') === true)
- return $this->display(__FILE__, 'views/templates/admin/add_1.6.tpl');
- else
- return $this->display(__FILE__, 'views/templates/admin/add.tpl');
- }
- else
- {
- $this->context->smarty->assign(array(
- 'message' => $message,
- 'uri' => $this->getPathUri(),
- 'PS_LAYERED_INDEXED' => Configuration::getGlobalValue('PS_LAYERED_INDEXED'),
- 'current_url' => Tools::safeOutput(preg_replace('/&deleteFilterTemplate=[0-9]*&id_layered_filter=[0-9]*/', '', $_SERVER['REQUEST_URI'])),
- 'id_lang' => Context::getContext()->cookie->id_lang,
- 'token' => substr(Tools::encrypt('blocklayered/index'), 0, 10),
- 'base_folder' => urlencode(_PS_ADMIN_DIR_),
- 'price_indexer_url' => $module_url.'blocklayered-price-indexer.php'.'?token='.substr(Tools::encrypt('blocklayered/index'), 0, 10),
- 'full_price_indexer_url' => $module_url.'blocklayered-price-indexer.php'.'?token='.substr(Tools::encrypt('blocklayered/index'), 0, 10).'&full=1',
- 'attribute_indexer_url' => $module_url.'blocklayered-attribute-indexer.php'.'?token='.substr(Tools::encrypt('blocklayered/index'), 0, 10),
- 'url_indexer_url' => $module_url.'blocklayered-url-indexer.php'.'?token='.substr(Tools::encrypt('blocklayered/index'), 0, 10).'&truncate=1',
- 'filters_templates' => Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('SELECT * FROM '._DB_PREFIX_.'layered_filter ORDER BY date_add DESC'),
- 'hide_values' => Configuration::get('PS_LAYERED_HIDE_0_VALUES'),
- 'show_quantities' => Configuration::get('PS_LAYERED_SHOW_QTIES'),
- 'full_tree' => Configuration::get('PS_LAYERED_FULL_TREE'),
- 'category_depth' => Configuration::get('PS_LAYERED_FILTER_CATEGORY_DEPTH'),
- 'price_use_tax' => (bool)Configuration::get('PS_LAYERED_FILTER_PRICE_USETAX'),
- 'index_cdt' => Configuration::get('PS_LAYERED_FILTER_INDEX_CDT'),
- 'index_qty' => Configuration::get('PS_LAYERED_FILTER_INDEX_QTY'),
- 'index_mnf' => Configuration::get('PS_LAYERED_FILTER_INDEX_MNF'),
- 'index_cat' => Configuration::get('PS_LAYERED_FILTER_INDEX_CAT'),
- 'limit_warning' => $this->displayLimitPostWarning(21+count($attribute_groups)*3+count($features)*3),
- 'price_use_rounding' => (bool)Configuration::get('PS_LAYERED_FILTER_PRICE_ROUNDING')
- ));
-
- if (version_compare(_PS_VERSION_, '1.6.0', '>=') === true)
- return $this->display(__FILE__, 'views/templates/admin/view_1.6.tpl');
- else
- return $this->display(__FILE__, 'views/templates/admin/view.tpl');
- }
- }
-
- public function displayLimitPostWarning($count)
- {
- $return = array();
- if ((ini_get('suhosin.post.max_vars') && ini_get('suhosin.post.max_vars') < $count) || (ini_get('suhosin.request.max_vars') && ini_get('suhosin.request.max_vars') < $count))
- {
- $return['error_type'] = 'suhosin';
- $return['post.max_vars'] = ini_get('suhosin.post.max_vars');
- $return['request.max_vars'] = ini_get('suhosin.request.max_vars');
- $return['needed_limit'] = $count + 100;
- }
- elseif (ini_get('max_input_vars') && ini_get('max_input_vars') < $count)
- {
- $return['error_type'] = 'conf';
- $return['max_input_vars'] = ini_get('max_input_vars');
- $return['needed_limit'] = $count + 100;
- }
- return $return;
- }
-
- private function getSelectedFilters()
- {
- $home_category = Configuration::get('PS_HOME_CATEGORY');
- $id_parent = (int)Tools::getValue('id_category', Tools::getValue('id_category_layered', $home_category));
- if ($id_parent == $home_category)
- return;
-
- // Force attributes selection (by url '.../2-mycategory/color-blue' or by get parameter 'selected_filters')
- if (strpos($_SERVER['SCRIPT_FILENAME'], 'blocklayered-ajax.php') === false || Tools::getValue('selected_filters') !== false)
- {
- if (Tools::getValue('selected_filters'))
- $url = Tools::getValue('selected_filters');
- else
- $url = preg_replace('/\/(?:\w*)\/(?:[0-9]+[-\w]*)([^\?]*)\??.*/', '$1', Tools::safeOutput($_SERVER['REQUEST_URI'], true));
-
- $url_attributes = explode('/', ltrim($url, '/'));
- $selected_filters = array('category' => array());
- if (!empty($url_attributes))
- {
- foreach ($url_attributes as $url_attribute)
- {
- /* Pagination uses - as separator, can be different from $this->getAnchor()*/
- if (strpos($url_attribute, 'page-') === 0)
- $url_attribute = str_replace('-', $this->getAnchor(), $url_attribute);
- $url_parameters = explode($this->getAnchor(), $url_attribute);
- $attribute_name = array_shift($url_parameters);
- if ($attribute_name == 'page')
- $this->page = (int)$url_parameters[0];
- else if (in_array($attribute_name, array('price', 'weight')))
- $selected_filters[$attribute_name] = array($this->filterVar($url_parameters[0]), $this->filterVar($url_parameters[1]));
- else
- {
- foreach ($url_parameters as $url_parameter)
- {
- $data = Db::getInstance()->getValue('SELECT data FROM `'._DB_PREFIX_.'layered_friendly_url` WHERE `url_key` = \''.md5('/'.$attribute_name.$this->getAnchor().$url_parameter).'\'');
- if ($data)
- foreach (Tools::unSerialize($data) as $key_params => $params)
- {
- if (!isset($selected_filters[$key_params]))
- $selected_filters[$key_params] = array();
- foreach ($params as $key_param => $param)
- {
- if (!isset($selected_filters[$key_params][$key_param]))
- $selected_filters[$key_params][$key_param] = array();
- $selected_filters[$key_params][$key_param] = $this->filterVar($param);
- }
- }
- }
- }
- }
- return $selected_filters;
- }
- }
-
- /* Analyze all the filters selected by the user and store them into a tab */
- $selected_filters = array('category' => array(), 'manufacturer' => array(), 'quantity' => array(), 'condition' => array());
- foreach ($_GET as $key => $value)
- if (substr($key, 0, 8) == 'layered_')
- {
- preg_match('/^(.*)_([0-9]+|new|used|refurbished|slider)$/', substr($key, 8, strlen($key) - 8), $res);
- if (isset($res[1]))
- {
- $tmp_tab = explode('_', $this->filterVar($value));
- $value = $this->filterVar($tmp_tab[0]);
- $id_key = false;
- if (isset($tmp_tab[1]))
- $id_key = $tmp_tab[1];
- if ($res[1] == 'condition' && in_array($value, array('new', 'used', 'refurbished')))
- $selected_filters['condition'][] = $value;
- else if ($res[1] == 'quantity' && (!$value || $value == 1))
- $selected_filters['quantity'][] = $value;
- else if (in_array($res[1], array('category', 'manufacturer')))
- {
- if (!isset($selected_filters[$res[1].($id_key ? '_'.$id_key : '')]))
- $selected_filters[$res[1].($id_key ? '_'.$id_key : '')] = array();
- $selected_filters[$res[1].($id_key ? '_'.$id_key : '')][] = (int)$value;
- }
- else if (in_array($res[1], array('id_attribute_group', 'id_feature')))
- {
- if (!isset($selected_filters[$res[1]]))
- $selected_filters[$res[1]] = array();
- $selected_filters[$res[1]][(int)$value] = $id_key.'_'.(int)$value;
- }
- else if ($res[1] == 'weight')
- $selected_filters[$res[1]] = $tmp_tab;
- else if ($res[1] == 'price')
- $selected_filters[$res[1]] = $tmp_tab;
- }
- }
- return $selected_filters;
- }
-
- public function getProductByFilters($selected_filters = array())
- {
- global $cookie;
-
- if (!empty($this->products))
- return $this->products;
-
- $home_category = Configuration::get('PS_HOME_CATEGORY');
- /* If the current category isn't defined or if it's homepage, we have nothing to display */
- $id_parent = (int)Tools::getValue('id_category', Tools::getValue('id_category_layered', $home_category));
- if ($id_parent == $home_category)
- return false;
-
- $alias_where = 'p';
- if (version_compare(_PS_VERSION_,'1.5','>'))
- $alias_where = 'product_shop';
-
- $query_filters_where = ' AND '.$alias_where.'.`active` = 1 AND '.$alias_where.'.`visibility` IN ("both", "catalog")';
- $query_filters_from = '';
-
- $parent = new Category((int)$id_parent);
-
- foreach ($selected_filters as $key => $filter_values)
- {
- if (!count($filter_values))
- continue;
-
- preg_match('/^(.*[^_0-9])/', $key, $res);
- $key = $res[1];
-
- switch ($key)
- {
- case 'id_feature':
- $sub_queries = array();
- foreach ($filter_values as $filter_value)
- {
- $filter_value_array = explode('_', $filter_value);
- if (!isset($sub_queries[$filter_value_array[0]]))
- $sub_queries[$filter_value_array[0]] = array();
- $sub_queries[$filter_value_array[0]][] = 'fp.`id_feature_value` = '.(int)$filter_value_array[1];
- }
- foreach ($sub_queries as $sub_query)
- {
- $query_filters_where .= ' AND p.id_product IN (SELECT `id_product` FROM `'._DB_PREFIX_.'feature_product` fp WHERE ';
- $query_filters_where .= implode(' OR ', $sub_query).') ';
- }
- break;
-
- case 'id_attribute_group':
- $sub_queries = array();
-
-
- foreach ($filter_values as $filter_value)
- {
- $filter_value_array = explode('_', $filter_value);
- if (!isset($sub_queries[$filter_value_array[0]]))
- $sub_queries[$filter_value_array[0]] = array();
- $sub_queries[$filter_value_array[0]][] = 'pac.`id_attribute` = '.(int)$filter_value_array[1];
- }
- foreach ($sub_queries as $sub_query)
- {
- $query_filters_where .= ' AND p.id_product IN (SELECT pa.`id_product`
- FROM `'._DB_PREFIX_.'product_attribute_combination` pac
- LEFT JOIN `'._DB_PREFIX_.'product_attribute` pa
- ON (pa.`id_product_attribute` = pac.`id_product_attribute`)'.
- Shop::addSqlAssociation('product_attribute', 'pa').'
- WHERE '.implode(' OR ', $sub_query).') ';
- }
- break;
-
- case 'category':
- $query_filters_where .= ' AND p.id_product IN (SELECT id_product FROM '._DB_PREFIX_.'category_product cp WHERE ';
- foreach ($selected_filters['category'] as $id_category)
- $query_filters_where .= 'cp.`id_category` = '.(int)$id_category.' OR ';
- $query_filters_where = rtrim($query_filters_where, 'OR ').')';
- break;
-
- case 'quantity':
- if (count($selected_filters['quantity']) == 2)
- break;
-
- $query_filters_where .= ' AND sa.quantity '.(!$selected_filters['quantity'][0] ? '<=' : '>').' 0 ';
- $query_filters_from .= 'LEFT JOIN `'._DB_PREFIX_.'stock_available` sa ON (sa.id_product = p.id_product '.StockAvailable::addSqlShopRestriction(null, null, 'sa').') ';
- break;
-
- case 'manufacturer':
- $query_filters_where .= ' AND p.id_manufacturer IN ('.implode(',', $selected_filters['manufacturer']).')';
- break;
-
- case 'condition':
- if (count($selected_filters['condition']) == 3)
- break;
- $query_filters_where .= ' AND '.$alias_where.'.condition IN (';
- foreach ($selected_filters['condition'] as $cond)
- $query_filters_where .= '\''.pSQL($cond).'\',';
- $query_filters_where = rtrim($query_filters_where, ',').')';
- break;
-
- case 'weight':
- if ($selected_filters['weight'][0] != 0 || $selected_filters['weight'][1] != 0)
- $query_filters_where .= ' AND p.`weight` BETWEEN '.(float)($selected_filters['weight'][0] - 0.001).' AND '.(float)($selected_filters['weight'][1] + 0.001);
- break;
-
- case 'price':
- if (isset($selected_filters['price']))
- {
- if ($selected_filters['price'][0] !== '' || $selected_filters['price'][1] !== '')
- {
- $price_filter = array();
- $price_filter['min'] = (float)($selected_filters['price'][0]);
- $price_filter['max'] = (float)($selected_filters['price'][1]);
- }
- }
- else
- $price_filter = false;
- break;
- }
- }
-
- $context = Context::getContext();
- $id_currency = (int)$context->currency->id;
-
- $price_filter_query_in = ''; // All products with price range between price filters limits
- $price_filter_query_out = ''; // All products with a price filters limit on it price range
- if (isset($price_filter) && $price_filter)
- {
- $price_filter_query_in = 'INNER JOIN `'._DB_PREFIX_.'layered_price_index` psi
- ON
- (
- psi.price_min <= '.(int)$price_filter['max'].'
- AND psi.price_max >= '.(int)$price_filter['min'].'
- AND psi.`id_product` = p.`id_product`
- AND psi.`id_shop` = '.(int)$context->shop->id.'
- AND psi.`id_currency` = '.$id_currency.'
- )';
-
- $price_filter_query_out = 'INNER JOIN `'._DB_PREFIX_.'layered_price_index` psi
- ON
- ((psi.price_min < '.(int)$price_filter['min'].' AND psi.price_max > '.(int)$price_filter['min'].')
- OR
- (psi.price_max > '.(int)$price_filter['max'].' AND psi.price_min < '.(int)$price_filter['max'].'))
- AND psi.`id_product` = p.`id_product`
- AND psi.`id_shop` = '.(int)$context->shop->id.'
- AND psi.`id_currency` = '.$id_currency;
- }
-
- $query_filters_from .= Shop::addSqlAssociation('product', 'p');
-
- Db::getInstance()->execute('DROP TEMPORARY TABLE IF EXISTS '._DB_PREFIX_.'cat_filter_restriction', false);
- if (empty($selected_filters['category']))
- {
- /* Create the table which contains all the id_product in a cat or a tree */
- Db::getInstance()->execute('CREATE TEMPORARY TABLE '._DB_PREFIX_.'cat_filter_restriction ENGINE=MEMORY
- SELECT cp.id_product, MIN(cp.position) position FROM '._DB_PREFIX_.'category_product cp
- INNER JOIN '._DB_PREFIX_.'category c ON (c.id_category = cp.id_category AND
- '.(Configuration::get('PS_LAYERED_FULL_TREE') ? 'c.nleft >= '.(int)$parent->nleft.'
- AND c.nright <= '.(int)$parent->nright : 'c.id_category = '.(int)$id_parent).'
- AND c.active = 1)
- JOIN `'._DB_PREFIX_.'product` p USING (id_product)
- '.$price_filter_query_in.'
- '.$query_filters_from.'
- WHERE 1 '.$query_filters_where.'
- GROUP BY cp.id_product ORDER BY position, id_product', false);
- } else {
- $categories = array_map('intval', $selected_filters['category']);
-
- Db::getInstance()->execute('CREATE TEMPORARY TABLE '._DB_PREFIX_.'cat_filter_restriction ENGINE=MEMORY
- SELECT cp.id_product, MIN(cp.position) position FROM '._DB_PREFIX_.'category_product cp
- JOIN `'._DB_PREFIX_.'product` p USING (id_product)
- '.$price_filter_query_in.'
- '.$query_filters_from.'
- WHERE cp.`id_category` IN ('.implode(',', $categories).') '.$query_filters_where.'
- GROUP BY cp.id_product ORDER BY position, id_product', false);
- }
- Db::getInstance()->execute('ALTER TABLE '._DB_PREFIX_.'cat_filter_restriction ADD PRIMARY KEY (id_product), ADD KEY (position, id_product) USING BTREE', false);
-
- if (isset($price_filter) && $price_filter) {
- static $ps_layered_filter_price_usetax = null;
- static $ps_layered_filter_price_rounding = null;
-
- if ($ps_layered_filter_price_usetax === null) {
- $ps_layered_filter_price_usetax = Configuration::get('PS_LAYERED_FILTER_PRICE_USETAX');
- }
-
- if ($ps_layered_filter_price_rounding === null) {
- $ps_layered_filter_price_rounding = Configuration::get('PS_LAYERED_FILTER_PRICE_ROUNDING');
- }
-
- if (empty($selected_filters['category'])) {
- $all_products_out = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
- SELECT p.`id_product` id_product
- FROM `'._DB_PREFIX_.'product` p JOIN '._DB_PREFIX_.'category_product cp USING (id_product)
- INNER JOIN '._DB_PREFIX_.'category c ON (c.id_category = cp.id_category AND
- '.(Configuration::get('PS_LAYERED_FULL_TREE') ? 'c.nleft >= '.(int)$parent->nleft.'
- AND c.nright <= '.(int)$parent->nright : 'c.id_category = '.(int)$id_parent).'
- AND c.active = 1)
- '.$price_filter_query_out.'
- '.$query_filters_from.'
- WHERE 1 '.$query_filters_where.' GROUP BY cp.id_product');
- } else {
- $all_products_out = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
- SELECT p.`id_product` id_product
- FROM `'._DB_PREFIX_.'product` p JOIN '._DB_PREFIX_.'category_product cp USING (id_product)
- '.$price_filter_query_out.'
- '.$query_filters_from.'
- WHERE cp.`id_category` IN ('.implode(',', $categories).') '.$query_filters_where.' GROUP BY cp.id_product');
- }
-
- /* for this case, price could be out of range, so we need to compute the real price */
- foreach($all_products_out as $product) {
- $price = Product::getPriceStatic($product['id_product'], $ps_layered_filter_price_usetax);
- if ($ps_layered_filter_price_rounding) {
- $price = (int)$price;
- }
- if ($price < $price_filter['min'] || $price > $price_filter['max']) {
- // out of range price, exclude the product
- $product_id_delete_list[] = (int)$product['id_product'];
- }
- }
- if (!empty($product_id_delete_list)) {
- Db::getInstance()->execute('DELETE FROM '._DB_PREFIX_.'cat_filter_restriction WHERE id_product IN ('.implode(',', $product_id_delete_list).')');
- }
- }
- $this->nbr_products = Db::getInstance()->getValue('SELECT COUNT(*) FROM '._DB_PREFIX_.'cat_filter_restriction');
-
- if ($this->nbr_products == 0)
- $this->products = array();
- else
- {
- $product_per_page = isset($this->context->cookie->nb_item_per_page) ? (int)$this->context->cookie->nb_item_per_page : Configuration::get('PS_PRODUCTS_PER_PAGE');
- $n = (int)Tools::getValue('n', Configuration::get('PS_PRODUCTS_PER_PAGE'));
- $nb_day_new_product = (Validate::isUnsignedInt(Configuration::get('PS_NB_DAYS_NEW_PRODUCT')) ? Configuration::get('PS_NB_DAYS_NEW_PRODUCT') : 20);
-
- if (version_compare(_PS_VERSION_, '1.6.1', '>=') === true)
- {
- $this->products = Db::getInstance()->executeS('
- SELECT
- p.*,
- '.($alias_where == 'p' ? '' : 'product_shop.*,' ).'
- '.$alias_where.'.id_category_default,
- pl.*,
- image_shop.`id_image` id_image,
- il.legend,
- m.name manufacturer_name,
- '.(Combination::isFeatureActive() ? 'product_attribute_shop.id_product_attribute id_product_attribute,' : '').'
- DATEDIFF('.$alias_where.'.`date_add`, DATE_SUB("'.date('Y-m-d').' 00:00:00", INTERVAL '.(int)$nb_day_new_product.' DAY)) > 0 AS new,
- stock.out_of_stock, IFNULL(stock.quantity, 0) as quantity'.(Combination::isFeatureActive() ? ', product_attribute_shop.minimal_quantity AS product_attribute_minimal_quantity' : '').'
- FROM '._DB_PREFIX_.'cat_filter_restriction cp
- LEFT JOIN `'._DB_PREFIX_.'product` p ON p.`id_product` = cp.`id_product`
- '.Shop::addSqlAssociation('product', 'p').
- (Combination::isFeatureActive() ?
- ' LEFT JOIN `'._DB_PREFIX_.'product_attribute_shop` product_attribute_shop
- ON (p.`id_product` = product_attribute_shop.`id_product` AND product_attribute_shop.`default_on` = 1 AND product_attribute_shop.id_shop='.(int)$context->shop->id.')':'').'
- LEFT JOIN '._DB_PREFIX_.'product_lang pl ON (pl.id_product = p.id_product'.Shop::addSqlRestrictionOnLang('pl').' AND pl.id_lang = '.(int)$cookie->id_lang.')
- LEFT JOIN `'._DB_PREFIX_.'image_shop` image_shop
- ON (image_shop.`id_product` = p.`id_product` AND image_shop.cover=1 AND image_shop.id_shop='.(int)$context->shop->id.')
- LEFT JOIN `'._DB_PREFIX_.'image_lang` il ON (image_shop.`id_image` = il.`id_image` AND il.`id_lang` = '.(int)$cookie->id_lang.')
- LEFT JOIN '._DB_PREFIX_.'manufacturer m ON (m.id_manufacturer = p.id_manufacturer)
- '.Product::sqlStock('p', 0).'
- WHERE '.$alias_where.'.`active` = 1 AND '.$alias_where.'.`visibility` IN ("both", "catalog")
- ORDER BY '.Tools::getProductsOrder('by', Tools::getValue('orderby'), true).' '.Tools::getProductsOrder('way', Tools::getValue('orderway')).' , cp.id_product'.
- ' LIMIT '.(((int)$this->page - 1) * $n.','.$n));
- }
- else
- {
- $this->products = Db::getInstance()->executeS('
- SELECT
- p.*,
- '.($alias_where == 'p' ? '' : 'product_shop.*,' ).'
- '.$alias_where.'.id_category_default,
- pl.*,
- MAX(image_shop.`id_image`) id_image,
- il.legend,
- m.name manufacturer_name,
- '.(Combination::isFeatureActive() ? 'MAX(product_attribute_shop.id_product_attribute) id_product_attribute,' : '').'
- DATEDIFF('.$alias_where.'.`date_add`, DATE_SUB("'.date('Y-m-d').' 00:00:00", INTERVAL '.(int)$nb_day_new_product.' DAY)) > 0 AS new,
- stock.out_of_stock, IFNULL(stock.quantity, 0) as quantity'.(Combination::isFeatureActive() ? ', MAX(product_attribute_shop.minimal_quantity) AS product_attribute_minimal_quantity' : '').'
- FROM '._DB_PREFIX_.'cat_filter_restriction cp
- LEFT JOIN `'._DB_PREFIX_.'product` p ON p.`id_product` = cp.`id_product`
- '.Shop::addSqlAssociation('product', 'p').
- (Combination::isFeatureActive() ?
- 'LEFT JOIN `'._DB_PREFIX_.'product_attribute` pa ON (p.`id_product` = pa.`id_product`)
- '.Shop::addSqlAssociation('product_attribute', 'pa', false, 'product_attribute_shop.`default_on` = 1 AND product_attribute_shop.id_shop='.(int)$context->shop->id):'').'
- LEFT JOIN '._DB_PREFIX_.'product_lang pl ON (pl.id_product = p.id_product'.Shop::addSqlRestrictionOnLang('pl').' AND pl.id_lang = '.(int)$cookie->id_lang.')
- LEFT JOIN `'._DB_PREFIX_.'image` i ON (i.`id_product` = p.`id_product`)'.
- Shop::addSqlAssociation('image', 'i', false, 'image_shop.cover=1').'
- LEFT JOIN `'._DB_PREFIX_.'image_lang` il ON (image_shop.`id_image` = il.`id_image` AND il.`id_lang` = '.(int)$cookie->id_lang.')
- LEFT JOIN '._DB_PREFIX_.'manufacturer m ON (m.id_manufacturer = p.id_manufacturer)
- '.Product::sqlStock('p', 0).'
- WHERE '.$alias_where.'.`active` = 1 AND '.$alias_where.'.`visibility` IN ("both", "catalog")
- GROUP BY product_shop.id_product
- ORDER BY '.Tools::getProductsOrder('by', Tools::getValue('orderby'), true).' '.Tools::getProductsOrder('way', Tools::getValue('orderway')).' , cp.id_product'.
- ' LIMIT '.(((int)$this->page - 1) * $n.','.$n));
- }
- }
-
- if (Tools::getProductsOrder('by', Tools::getValue('orderby'), true) == 'p.price')
- Tools::orderbyPrice($this->products, Tools::getProductsOrder('way', Tools::getValue('orderway')));
-
- return $this->products;
- }
-
- private static function query($sql_query)
- {
- return Db::getInstance(_PS_USE_SQL_SLAVE_)->query($sql_query);
- }
-
- public function getFilterBlock($selected_filters = array())
- {
- global $cookie;
- static $cache = null;
-
- $context = Context::getContext();
-
- $id_lang = $context->language->id;
- $currency = $context->currency;
- $id_shop = (int) $context->shop->id;
- $alias = 'product_shop';
-
- if (is_array($cache))
- return $cache;
-
- $home_category = Configuration::get('PS_HOME_CATEGORY');
- $id_parent = (int)Tools::getValue('id_category', Tools::getValue('id_category_layered', $home_category));
- if ($id_parent == $home_category)
- return;
-
- $parent = new Category((int)$id_parent, $id_lang);
-
- /* Get the filters for the current category */
- $filters = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
- SELECT type, id_value, filter_show_limit, filter_type FROM '._DB_PREFIX_.'layered_category
- WHERE id_category = '.(int)$id_parent.'
- AND id_shop = '.$id_shop.'
- GROUP BY `type`, id_value ORDER BY position ASC'
- );
-
- /* Create the table which contains all the id_product in a cat or a tree */
-
- Db::getInstance()->execute('DROP TEMPORARY TABLE IF EXISTS '._DB_PREFIX_.'cat_restriction', false);
- Db::getInstance()->execute('CREATE TEMPORARY TABLE '._DB_PREFIX_.'cat_restriction ENGINE=MEMORY
- SELECT DISTINCT cp.id_product, p.id_manufacturer, product_shop.condition, p.weight FROM '._DB_PREFIX_.'category_product cp
- INNER JOIN '._DB_PREFIX_.'category c ON (c.id_category = cp.id_category AND
- '.(Configuration::get('PS_LAYERED_FULL_TREE') ? 'c.nleft >= '.(int)$parent->nleft.'
- AND c.nright <= '.(int)$parent->nright : 'c.id_category = '.(int)$id_parent).'
- AND c.active = 1)
- INNER JOIN '._DB_PREFIX_.'product_shop product_shop ON (product_shop.id_product = cp.id_product
- AND product_shop.id_shop = '.(int)$context->shop->id.')
- INNER JOIN '._DB_PREFIX_.'product p ON (p.id_product=cp.id_product)
- WHERE product_shop.`active` = 1 AND product_shop.`visibility` IN ("both", "catalog")', false);
-
-
- Db::getInstance()->execute('ALTER TABLE '._DB_PREFIX_.'cat_restriction ADD PRIMARY KEY (id_product),
- ADD KEY `id_manufacturer` (`id_manufacturer`,`id_product`) USING BTREE,
- ADD KEY `condition` (`condition`,`id_product`) USING BTREE,
- ADD KEY `weight` (`weight`,`id_product`) USING BTREE', false);
-
- // Remove all empty selected filters
- foreach ($selected_filters as $key => $value)
- switch ($key)
- {
- case 'price':
- case 'weight':
- if ($value[0] === '' && $value[1] === '')
- unset($selected_filters[$key]);
- break;
- default:
- if ($value == '')
- unset($selected_filters[$key]);
- break;
- }
-
- $filter_blocks = array();
- foreach ($filters as $filter)
- {
- $sql_query = array('select' => '', 'from' => '', 'join' => '', 'where' => '', 'group' => '', 'second_query' => '');
- switch ($filter['type'])
- {
- case 'price':
- $sql_query['select'] = 'SELECT p.`id_product`, psi.price_min, psi.price_max ';
- // price slider is not filter dependent
- $sql_query['from'] = '
- FROM '._DB_PREFIX_.'cat_restriction p';
- $sql_query['join'] = 'INNER JOIN `'._DB_PREFIX_.'layered_price_index` psi
- ON (psi.id_product = p.id_product AND psi.id_currency = '.(int)$context->currency->id.' AND psi.id_shop='.(int)$context->shop->id.')';
- $sql_query['where'] = 'WHERE 1';
- break;
- case 'weight':
- $sql_query['select'] = 'SELECT p.`id_product`, p.`weight` ';
- // price slider is not filter dependent
- $sql_query['from'] = '
- FROM '._DB_PREFIX_.'cat_restriction p';
- $sql_query['where'] = 'WHERE 1';
- break;
- case 'condition':
- $sql_query['select'] = 'SELECT p.`id_product`, product_shop.`condition` ';
- $sql_query['from'] = '
- FROM '._DB_PREFIX_.'cat_restriction p';
- $sql_query['where'] = 'WHERE 1';
- $sql_query['from'] .= Shop::addSqlAssociation('product', 'p');
- break;
- case 'quantity':
- $sql_query['select'] = 'SELECT p.`id_product`, sa.`quantity`, sa.`out_of_stock` ';
-
- $sql_query['from'] = '
- FROM '._DB_PREFIX_.'cat_restriction p';
-
- $sql_query['join'] .= 'LEFT JOIN `'._DB_PREFIX_.'stock_available` sa
- ON (sa.id_product = p.id_product AND sa.id_product_attribute=0 '.StockAvailable::addSqlShopRestriction(null, null, 'sa').') ';
- $sql_query['where'] = 'WHERE 1';
- break;
-
- case 'manufacturer':
- $sql_query['select'] = 'SELECT COUNT(DISTINCT p.id_product) nbr, m.id_manufacturer, m.name ';
- $sql_query['from'] = '
- FROM '._DB_PREFIX_.'cat_restriction p
- INNER JOIN '._DB_PREFIX_.'manufacturer m ON (m.id_manufacturer = p.id_manufacturer) ';
- $sql_query['where'] = 'WHERE 1';
- $sql_query['group'] = ' GROUP BY p.id_manufacturer ORDER BY m.name';
-
- if (!Configuration::get('PS_LAYERED_HIDE_0_VALUES'))
- {
- $sql_query['second_query'] = '
- SELECT m.name, 0 nbr, m.id_manufacturer
-
- FROM '._DB_PREFIX_.'cat_restriction p
- INNER JOIN '._DB_PREFIX_.'manufacturer m ON (m.id_manufacturer = p.id_manufacturer)
- WHERE 1
- GROUP BY p.id_manufacturer ORDER BY m.name';
- }
-
- break;
- case 'id_attribute_group':// attribute group
- $sql_query['select'] = '
- SELECT COUNT(DISTINCT lpa.id_product) nbr, lpa.id_attribute_group,
- a.color, al.name attribute_name, agl.public_name attribute_group_name , lpa.id_attribute, ag.is_color_group,
- liagl.url_name name_url_name, liagl.meta_title name_meta_title, lial.url_name value_url_name, lial.meta_title value_meta_title';
- $sql_query['from'] = '
- FROM '._DB_PREFIX_.'layered_product_attribute lpa
- INNER JOIN '._DB_PREFIX_.'attribute a
- ON a.id_attribute = lpa.id_attribute
- INNER JOIN '._DB_PREFIX_.'attribute_lang al
- ON al.id_attribute = a.id_attribute
- AND al.id_lang = '.(int)$id_lang.'
- INNER JOIN '._DB_PREFIX_.'cat_restriction p
- ON p.id_product = lpa.id_product
- INNER JOIN '._DB_PREFIX_.'attribute_group ag
- ON ag.id_attribute_group = lpa.id_attribute_group
- INNER JOIN '._DB_PREFIX_.'attribute_group_lang agl
- ON agl.id_attribute_group = lpa.id_attribute_group
- AND agl.id_lang = '.(int)$id_lang.'
- LEFT JOIN '._DB_PREFIX_.'layered_indexable_attribute_group_lang_value liagl
- ON (liagl.id_attribute_group = lpa.id_attribute_group AND liagl.id_lang = '.(int)$id_lang.')
- LEFT JOIN '._DB_PREFIX_.'layered_indexable_attribute_lang_value lial
- ON (lial.id_attribute = lpa.id_attribute AND lial.id_lang = '.(int)$id_lang.') ';
-
- $sql_query['where'] = 'WHERE lpa.id_attribute_group = '.(int)$filter['id_value'];
- $sql_query['where'] .= ' AND lpa.`id_shop` = '.(int)$context->shop->id;
- $sql_query['group'] = '
- GROUP BY lpa.id_attribute
- ORDER BY ag.`position` ASC, a.`position` ASC';
-
- if (!Configuration::get('PS_LAYERED_HIDE_0_VALUES'))
- {
- $sql_query['second_query'] = '
- SELECT 0 nbr, lpa.id_attribute_group,
- a.color, al.name attribute_name, agl.public_name attribute_group_name , lpa.id_attribute, ag.is_color_group,
- liagl.url_name name_url_name, liagl.meta_title name_meta_title, lial.url_name value_url_name, lial.meta_title value_meta_title
- FROM '._DB_PREFIX_.'layered_product_attribute lpa'.
- Shop::addSqlAssociation('product', 'lpa').'
- INNER JOIN '._DB_PREFIX_.'attribute a
- ON a.id_attribute = lpa.id_attribute
- INNER JOIN '._DB_PREFIX_.'attribute_lang al
- ON al.id_attribute = a.id_attribute AND al.id_lang = '.(int)$id_lang.'
- INNER JOIN '._DB_PREFIX_.'product as p
- ON p.id_product = lpa.id_product
- INNER JOIN '._DB_PREFIX_.'attribute_group ag
- ON ag.id_attribute_group = lpa.id_attribute_group
- INNER JOIN '._DB_PREFIX_.'attribute_group_lang agl
- ON agl.id_attribute_group = lpa.id_attribute_group
- AND agl.id_lang = '.(int)$id_lang.'
- LEFT JOIN '._DB_PREFIX_.'layered_indexable_attribute_group_lang_value liagl
- ON (liagl.id_attribute_group = lpa.id_attribute_group AND liagl.id_lang = '.(int)$id_lang.')
- LEFT JOIN '._DB_PREFIX_.'layered_indexable_attribute_lang_value lial
- ON (lial.id_attribute = lpa.id_attribute AND lial.id_lang = '.(int)$id_lang.')
- WHERE lpa.id_attribute_group = '.(int)$filter['id_value'].'
- AND lpa.`id_shop` = '.(int)$context->shop->id.'
- GROUP BY lpa.id_attribute
- ORDER BY id_attribute_group, id_attribute';
- }
- break;
-
- case 'id_feature':
- $sql_query['select'] = 'SELECT fl.name feature_name, fp.id_feature, fv.id_feature_value, fvl.value,
- COUNT(DISTINCT p.id_product) nbr,
- lifl.url_name name_url_name, lifl.meta_title name_meta_title, lifvl.url_name value_url_name, lifvl.meta_title value_meta_title ';
- $sql_query['from'] = '
- FROM '._DB_PREFIX_.'feature_product fp
- INNER JOIN '._DB_PREFIX_.'cat_restriction p
- ON p.id_product = fp.id_product
- LEFT JOIN '._DB_PREFIX_.'feature_lang fl ON (fl.id_feature = fp.id_feature AND fl.id_lang = '.$id_lang.')
- INNER JOIN '._DB_PREFIX_.'feature_value fv ON (fv.id_feature_value = fp.id_feature_value AND (fv.custom IS NULL OR fv.custom = 0))
- LEFT JOIN '._DB_PREFIX_.'feature_value_lang fvl ON (fvl.id_feature_value = fp.id_feature_value AND fvl.id_lang = '.$id_lang.')
- LEFT JOIN '._DB_PREFIX_.'layered_indexable_feature_lang_value lifl
- ON (lifl.id_feature = fp.id_feature AND lifl.id_lang = '.$id_lang.')
- LEFT JOIN '._DB_PREFIX_.'layered_indexable_feature_value_lang_value lifvl
- ON (lifvl.id_feature_value = fp.id_feature_value AND lifvl.id_lang = '.$id_lang.') ';
- $sql_query['where'] = 'WHERE fp.id_feature = '.(int)$filter['id_value'];
- $sql_query['group'] = 'GROUP BY fv.id_feature_value ';
-
- if (!Configuration::get('PS_LAYERED_HIDE_0_VALUES'))
- {
- $sql_query['second_query'] = '
- SELECT fl.name feature_name, fp.id_feature, fv.id_feature_value, fvl.value,
- 0 nbr,
- lifl.url_name name_url_name, lifl.meta_title name_meta_title, lifvl.url_name value_url_name, lifvl.meta_title value_meta_title
-
- FROM '._DB_PREFIX_.'feature_product fp'.
- Shop::addSqlAssociation('product', 'fp').'
- INNER JOIN '._DB_PREFIX_.'product p ON (p.id_product = fp.id_product)
- LEFT JOIN '._DB_PREFIX_.'feature_lang fl ON (fl.id_feature = fp.id_feature AND fl.id_lang = '.(int)$id_lang.')
- INNER JOIN '._DB_PREFIX_.'feature_value fv ON (fv.id_feature_value = fp.id_feature_value AND (fv.custom IS NULL OR fv.custom = 0))
- LEFT JOIN '._DB_PREFIX_.'feature_value_lang fvl ON (fvl.id_feature_value = fp.id_feature_value AND fvl.id_lang = '.(int)$id_lang.')
- LEFT JOIN '._DB_PREFIX_.'layered_indexable_feature_lang_value lifl
- ON (lifl.id_feature = fp.id_feature AND lifl.id_lang = '.(int)$id_lang.')
- LEFT JOIN '._DB_PREFIX_.'layered_indexable_feature_value_lang_value lifvl
- ON (lifvl.id_feature_value = fp.id_feature_value AND lifvl.id_lang = '.(int)$id_lang.')
- WHERE fp.id_feature = '.(int)$filter['id_value'].'
- GROUP BY fv.id_feature_value';
- }
-
- break;
-
- case 'category':
- if (Group::isFeatureActive())
- $this->user_groups = ($this->context->customer->isLogged() ? $this->context->customer->getGroups() : array(Configuration::get('PS_UNIDENTIFIED_GROUP')));
-
- $depth = Configuration::get('PS_LAYERED_FILTER_CATEGORY_DEPTH');
- if ($depth === false)
- $depth = 1;
-
- $sql_query['select'] = '
- SELECT c.id_category, c.id_parent, cl.name, (SELECT count(DISTINCT p.id_product) # ';
- $sql_query['from'] = '
- FROM '._DB_PREFIX_.'category_product cp
- LEFT JOIN '._DB_PREFIX_.'product p ON (p.id_product = cp.id_product) ';
- $sql_query['where'] = '
- WHERE cp.id_category = c.id_category
- AND '.$alias.'.active = 1 AND '.$alias.'.`visibility` IN ("both", "catalog")';
- $sql_query['group'] = ') count_products
- FROM '._DB_PREFIX_.'category c
- LEFT JOIN '._DB_PREFIX_.'category_lang cl ON (cl.id_category = c.id_category AND cl.`id_shop` = '.(int)Context::getContext()->shop->id.' and cl.id_lang = '.(int)$id_lang.') ';
-
- if (Group::isFeatureActive())
- $sql_query['group'] .= 'RIGHT JOIN '._DB_PREFIX_.'category_group cg ON (cg.id_category = c.id_category AND cg.`id_group` IN ('.implode(', ', $this->user_groups).')) ';
-
- $sql_query['group'] .= 'WHERE c.nleft > '.(int)$parent->nleft.'
- AND c.nright < '.(int)$parent->nright.'
- '.($depth ? 'AND c.level_depth <= '.($parent->level_depth+(int)$depth) : '').'
- AND c.active = 1
- GROUP BY c.id_category ORDER BY c.nleft, c.position';
-
- $sql_query['from'] .= Shop::addSqlAssociation('product', 'p');
- }
-
- foreach ($filters as $filter_tmp)
- {
- $method_name = 'get'.ucfirst($filter_tmp['type']).'FilterSubQuery';
- if (method_exists('BlockLayered', $method_name) &&
- ($filter['type'] != 'price' && $filter['type'] != 'weight' && $filter['type'] != $filter_tmp['type'] || $filter['type'] == $filter_tmp['type']))
- {
- if ($filter['type'] == $filter_tmp['type'] && $filter['id_value'] == $filter_tmp['id_value'])
- $sub_query_filter = self::$method_name(array(), true);
- else
- {
- if (!is_null($filter_tmp['id_value']))
- $selected_filters_cleaned = $this->cleanFilterByIdValue(@$selected_filters[$filter_tmp['type']], $filter_tmp['id_value']);
- else
- $selected_filters_cleaned = @$selected_filters[$filter_tmp['type']];
- $sub_query_filter = self::$method_name($selected_filters_cleaned, $filter['type'] == $filter_tmp['type']);
- }
- foreach ($sub_query_filter as $key => $value)
- $sql_query[$key] .= $value;
- }
- }
-
- $products = false;
- if (!empty($sql_query['from']))
- {
- $products = Db::getInstance()->executeS($sql_query['select']."\n".$sql_query['from']."\n".$sql_query['join']."\n".$sql_query['where']."\n".$sql_query['group']);
- }
-
- // price & weight have slidebar, so it's ok to not complete recompute the product list
- if (!empty($selected_filters['price']) && $filter['type'] != 'price' && $filter['type'] != 'weight') {
- $products = self::filterProductsByPrice(@$selected_filters['price'], $products);
- }
-
- if (!empty($sql_query['second_query']))
- {
- $res = Db::getInstance()->executeS($sql_query['second_query']);
- if ($res)
- $products = array_merge($products, $res);
- }
-
- switch ($filter['type'])
- {
- case 'price':
- if ($this->showPriceFilter()) {
- $price_array = array(
- 'type_lite' => 'price',
- 'type' => 'price',
- 'id_key' => 0,
- 'name' => $this->l('Price'),
- 'slider' => true,
- 'max' => '0',
- 'min' => null,
- 'values' => array ('1' => 0),
- 'unit' => $currency->sign,
- 'format' => $currency->format,
- 'filter_show_limit' => $filter['filter_show_limit'],
- 'filter_type' => $filter['filter_type']
- );
- if (isset($products) && $products)
- foreach ($products as $product)
- {
- if (is_null($price_array['min']))
- {
- $price_array['min'] = $product['price_min'];
- $price_array['values'][0] = $product['price_min'];
- }
- else if ($price_array['min'] > $product['price_min'])
- {
- $price_array['min'] = $product['price_min'];
- $price_array['values'][0] = $product['price_min'];
- }
-
- if ($price_array['max'] < $product['price_max'])
- {
- $price_array['max'] = $product['price_max'];
- $price_array['values'][1] = $product['price_max'];
- }
- }
-
- if ($price_array['max'] != $price_array['min'] && $price_array['min'] != null)
- {
- if ($filter['filter_type'] == 2)
- {
- $price_array['list_of_values'] = array();
- $nbr_of_value = $filter['filter_show_limit'];
- if ($nbr_of_value < 2)
- $nbr_of_value = 4;
- $delta = ($price_array['max'] - $price_array['min']) / $nbr_of_value;
- $current_step = $price_array['min'];
- for ($i = 0; $i < $nbr_of_value; $i++)
- $price_array['list_of_values'][] = array(
- (int)($price_array['min'] + $i * $delta),
- (int)($price_array['min'] + ($i + 1) * $delta)
- );
- }
- if (isset($selected_filters['price']) && isset($selected_filters['price'][0])
- && isset($selected_filters['price'][1]))
- {
- $price_array['values'][0] = $selected_filters['price'][0];
- $price_array['values'][1] = $selected_filters['price'][1];
- }
- $filter_blocks[] = $price_array;
- }
- }
- break;
-
- case 'weight':
- $weight_array = array(
- 'type_lite' => 'weight',
- 'type' => 'weight',
- 'id_key' => 0,
- 'name' => $this->l('Weight'),
- 'slider' => true,
- 'max' => '0',
- 'min' => null,
- 'values' => array ('1' => 0),
- 'unit' => Configuration::get('PS_WEIGHT_UNIT'),
- 'format' => 5, // Ex: xxxxx kg
- 'filter_show_limit' => $filter['filter_show_limit'],
- 'filter_type' => $filter['filter_type']
- );
- if (isset($products) && $products)
- foreach ($products as $product)
- {
- if (is_null($weight_array['min']))
- {
- $weight_array['min'] = $product['weight'];
- $weight_array['values'][0] = $product['weight'];
- }
- else if ($weight_array['min'] > $product['weight'])
- {
- $weight_array['min'] = $product['weight'];
- $weight_array['values'][0] = $product['weight'];
- }
-
- if ($weight_array['max'] < $product['weight'])
- {
- $weight_array['max'] = $product['weight'];
- $weight_array['values'][1] = $product['weight'];
- }
- }
- if ($weight_array['max'] != $weight_array['min'] && $weight_array['min'] != null)
- {
- if (isset($selected_filters['weight']) && isset($selected_filters['weight'][0])
- && isset($selected_filters['weight'][1]))
- {
- $weight_array['values'][0] = $selected_filters['weight'][0];
- $weight_array['values'][1] = $selected_filters['weight'][1];
- }
- $filter_blocks[] = $weight_array;
- }
- break;
-
- case 'condition':
- $condition_array = array(
- 'new' => array('name' => $this->l('New'),'nbr' => 0),
- 'used' => array('name' => $this->l('Used'), 'nbr' => 0),
- 'refurbished' => array('name' => $this->l('Refurbished'),
- 'nbr' => 0)
- );
- if (isset($products) && $products)
- foreach ($products as $product)
- if (isset($selected_filters['condition']) && in_array($product['condition'], $selected_filters['condition']))
- $condition_array[$product['condition']]['checked'] = true;
- foreach ($condition_array as $key => $condition)
- if (isset($selected_filters['condition']) && in_array($key, $selected_filters['condition']))
- $condition_array[$key]['checked'] = true;
- if (isset($products) && $products)
- foreach ($products as $product)
- if (isset($condition_array[$product['condition']]))
- $condition_array[$product['condition']]['nbr']++;
- $filter_blocks[] = array(
- 'type_lite' => 'condition',
- 'type' => 'condition',
- 'id_key' => 0,
- 'name' => $this->l('Condition'),
- 'values' => $condition_array,
- 'filter_show_limit' => $filter['filter_show_limit'],
- 'filter_type' => $filter['filter_type']
- );
- break;
-
- case 'quantity':
- $quantity_array = array (
- 0 => array('name' => $this->l('Not available'), 'nbr' => 0),
- 1 => array('name' => $this->l('In stock'), 'nbr' => 0)
- );
- foreach ($quantity_array as $key => $quantity)
- if (isset($selected_filters['quantity']) && in_array($key, $selected_filters['quantity']))
- $quantity_array[$key]['checked'] = true;
- if (isset($products) && $products)
- foreach ($products as $product)
- {
- //If oosp move all not available quantity to available quantity
- if ((int)$product['quantity'] > 0 || Product::isAvailableWhenOutOfStock($product['out_of_stock']))
- $quantity_array[1]['nbr']++;
- else
- $quantity_array[0]['nbr']++;
- }
-
- $filter_blocks[] = array(
- 'type_lite' => 'quantity',
- 'type' => 'quantity',
- 'id_key' => 0,
- 'name' => $this->l('Availability'),
- 'values' => $quantity_array,
- 'filter_show_limit' => $filter['filter_show_limit'],
- 'filter_type' => $filter['filter_type']
- );
-
- break;
-
- case 'manufacturer':
- if (isset($products) && $products)
- {
- $manufaturers_array = array();
- foreach ($products as $manufacturer)
- {
- if (!isset($manufaturers_array[$manufacturer['id_manufacturer']]))
- $manufaturers_array[$manufacturer['id_manufacturer']] = array('name' => $manufacturer['name'], 'nbr' => $manufacturer['nbr']);
- if (isset($selected_filters['manufacturer']) && in_array((int)$manufacturer['id_manufacturer'], $selected_filters['manufacturer']))
- $manufaturers_array[$manufacturer['id_manufacturer']]['checked'] = true;
- }
- $filter_blocks[] = array(
- 'type_lite' => 'manufacturer',
- 'type' => 'manufacturer',
- 'id_key' => 0,
- 'name' => $this->l('Manufacturer'),
- 'values' => $manufaturers_array,
- 'filter_show_limit' => $filter['filter_show_limit'],
- 'filter_type' => $filter['filter_type']
- );
- }
- break;
-
- case 'id_attribute_group':
- $attributes_array = array();
- if (isset($products) && $products)
- {
- foreach ($products as $attributes)
- {
- if (!isset($attributes_array[$attributes['id_attribute_group']]))
- $attributes_array[$attributes['id_attribute_group']] = array (
- 'type_lite' => 'id_attribute_group',
- 'type' => 'id_attribute_group',
- 'id_key' => (int)$attributes['id_attribute_group'],
- 'name' => $attributes['attribute_group_name'],
- 'is_color_group' => (bool)$attributes['is_color_group'],
- 'values' => array(),
- 'url_name' => $attributes['name_url_name'],
- 'meta_title' => $attributes['name_meta_title'],
- 'filter_show_limit' => $filter['filter_show_limit'],
- 'filter_type' => $filter['filter_type']
- );
-
- if (!isset($attributes_array[$attributes['id_attribute_group']]['values'][$attributes['id_attribute']]))
- $attributes_array[$attributes['id_attribute_group']]['values'][$attributes['id_attribute']] = array(
- 'color' => $attributes['color'],
- 'name' => $attributes['attribute_name'],
- 'nbr' => (int)$attributes['nbr'],
- 'url_name' => $attributes['value_url_name'],
- 'meta_title' => $attributes['value_meta_title']
- );
-
- if (isset($selected_filters['id_attribute_group'][$attributes['id_attribute']]))
- $attributes_array[$attributes['id_attribute_group']]['values'][$attributes['id_attribute']]['checked'] = true;
- }
-
- $filter_blocks = array_merge($filter_blocks, $attributes_array);
- }
- break;
- case 'id_feature':
- $feature_array = array();
- if (isset($products) && $products)
- {
- foreach ($products as $feature)
- {
- if (!isset($feature_array[$feature['id_feature']]))
- $feature_array[$feature['id_feature']] = array(
- 'type_lite' => 'id_feature',
- 'type' => 'id_feature',
- 'id_key' => (int)$feature['id_feature'],
- 'values' => array(),
- 'name' => $feature['feature_name'],
- 'url_name' => $feature['name_url_name'],
- 'meta_title' => $feature['name_meta_title'],
- 'filter_show_limit' => $filter['filter_show_limit'],
- 'filter_type' => $filter['filter_type']
- );
-
- if (!isset($feature_array[$feature['id_feature']]['values'][$feature['id_feature_value']]))
- $feature_array[$feature['id_feature']]['values'][$feature['id_feature_value']] = array(
- 'nbr' => (int)$feature['nbr'],
- 'name' => $feature['value'],
- 'url_name' => $feature['value_url_name'],
- 'meta_title' => $feature['value_meta_title']
- );
-
- if (isset($selected_filters['id_feature'][$feature['id_feature_value']]))
- $feature_array[$feature['id_feature']]['values'][$feature['id_feature_value']]['checked'] = true;
- }
-
- //Natural sort
- foreach ($feature_array as $key => $value)
- {
- $temp = array();
- foreach ($feature_array[$key]['values'] as $keyint => $valueint)
- $temp[$keyint] = $valueint['name'];
-
- natcasesort($temp);
- $temp2 = array();
-
- foreach ($temp as $keytemp => $valuetemp)
- $temp2[$keytemp] = $feature_array[$key]['values'][$keytemp];
-
- $feature_array[$key]['values'] = $temp2;
- }
-
- $filter_blocks = array_merge($filter_blocks, $feature_array);
- }
- break;
-
- case 'category':
- $tmp_array = array();
- if (isset($products) && $products)
- {
- $categories_with_products_count = 0;
- foreach ($products as $category)
- {
- $tmp_array[$category['id_category']] = array(
- 'name' => $category['name'],
- 'nbr' => (int)$category['count_products']
- );
-
- if ((int)$category['count_products'])
- $categories_with_products_count++;
-
- if (isset($selected_filters['category']) && in_array($category['id_category'], $selected_filters['category']))
- $tmp_array[$category['id_category']]['checked'] = true;
- }
- if ($categories_with_products_count || !Configuration::get('PS_LAYERED_HIDE_0_VALUES'))
- $filter_blocks[] = array (
- 'type_lite' => 'category',
- 'type' => 'category',
- 'id_key' => 0, 'name' => $this->l('Categories'),
- 'values' => $tmp_array,
- 'filter_show_limit' => $filter['filter_show_limit'],
- 'filter_type' => $filter['filter_type']
- );
- }
- break;
- }
- }
-
- // All non indexable attribute and feature
- $non_indexable = array();
-
- // Get all non indexable attribute groups
- foreach (Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
- SELECT public_name
- FROM `'._DB_PREFIX_.'attribute_group_lang` agl
- LEFT JOIN `'._DB_PREFIX_.'layered_indexable_attribute_group` liag
- ON liag.id_attribute_group = agl.id_attribute_group
- WHERE indexable IS NULL OR indexable = 0
- AND id_lang = '.(int)$id_lang) as $attribute)
- $non_indexable[] = Tools::link_rewrite($attribute['public_name']);
-
- // Get all non indexable features
- foreach (Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
- SELECT name
- FROM `'._DB_PREFIX_.'feature_lang` fl
- LEFT JOIN `'._DB_PREFIX_.'layered_indexable_feature` lif
- ON lif.id_feature = fl.id_feature
- WHERE indexable IS NULL OR indexable = 0
- AND id_lang = '.(int)$id_lang) as $attribute)
- $non_indexable[] = Tools::link_rewrite($attribute['name']);
-
- //generate SEO link
- $param_selected = '';
- $param_product_url = '';
- $option_checked_array = array();
- $param_group_selected_array = array();
- $title_values = array();
- $meta_values = array();
-
- //get filters checked by group
-
- foreach ($filter_blocks as $type_filter)
- {
- $filter_name = (!empty($type_filter['url_name']) ? $type_filter['url_name'] : $type_filter['name']);
- $filter_meta = (!empty($type_filter['meta_title']) ? $type_filter['meta_title'] : $type_filter['name']);
- $attr_key = $type_filter['type'].'_'.$type_filter['id_key'];
-
- $param_group_selected = '';
- $lower_filter = strtolower($type_filter['type']);
- $filter_name_rewritten = Tools::link_rewrite($filter_name);
-
- if (($lower_filter == 'price' || $lower_filter == 'weight')
- && (float)$type_filter['values'][0] > (float)$type_filter['min']
- && (float)$type_filter['values'][1] > (float)$type_filter['max'])
- {
- $param_group_selected .= $this->getAnchor().str_replace($this->getAnchor(), '_', $type_filter['values'][0])
- .$this->getAnchor().str_replace($this->getAnchor(), '_', $type_filter['values'][1]);
- $param_group_selected_array[$filter_name_rewritten][] = $filter_name_rewritten;
-
- if (!isset($title_values[$filter_meta]))
- $title_values[$filter_meta] = array();
- $title_values[$filter_meta][] = $filter_meta;
- if (!isset($meta_values[$attr_key]))
- $meta_values[$attr_key] = array('title' => $filter_meta, 'values' => array());
- $meta_values[$attr_key]['values'][] = $filter_meta;
- }
- else
- {
- foreach ($type_filter['values'] as $key => $value)
- {
- if (is_array($value) && array_key_exists('checked', $value ))
- {
- $value_name = !empty($value['url_name']) ? $value['url_name'] : $value['name'];
- $value_meta = !empty($value['meta_title']) ? $value['meta_title'] : $value['name'];
- $param_group_selected .= $this->getAnchor().str_replace($this->getAnchor(), '_', Tools::link_rewrite($value_name));
- $param_group_selected_array[$filter_name_rewritten][] = Tools::link_rewrite($value_name);
-
- if (!isset($title_values[$filter_meta]))
- $title_values[$filter_meta] = array();
- $title_values[$filter_meta][] = $value_name;
- if (!isset($meta_values[$attr_key]))
- $meta_values[$attr_key] = array('title' => $filter_meta, 'values' => array());
- $meta_values[$attr_key]['values'][] = $value_meta;
- }
- else
- $param_group_selected_array[$filter_name_rewritten][] = array();
- }
- }
-
- if (!empty($param_group_selected))
- {
- $param_selected .= '/'.str_replace($this->getAnchor(), '_', $filter_name_rewritten).$param_group_selected;
- $option_checked_array[$filter_name_rewritten] = $param_group_selected;
- }
- // select only attribute and group attribute to display an unique product combination link
- if (!empty($param_group_selected) && $type_filter['type'] == 'id_attribute_group')
- $param_product_url .= '/'.str_replace($this->getAnchor(), '_', $filter_name_rewritten).$param_group_selected;
-
- }
-
- if ($this->page > 1)
- $param_selected .= '/page-'.$this->page;
-
- $blacklist = array('weight', 'price');
-
- if (!Configuration::get('PS_LAYERED_FILTER_INDEX_CDT'))
- $blacklist[] = 'condition';
- if (!Configuration::get('PS_LAYERED_FILTER_INDEX_QTY'))
- $blacklist[] = 'quantity';
- if (!Configuration::get('PS_LAYERED_FILTER_INDEX_MNF'))
- $blacklist[] = 'manufacturer';
- if (!Configuration::get('PS_LAYERED_FILTER_INDEX_CAT'))
- $blacklist[] = 'category';
-
- $global_nofollow = false;
- $categorie_link = Context::getContext()->link->getCategoryLink($parent, null, null);
-
- foreach ($filter_blocks as &$type_filter)
- {
- $filter_name = (!empty($type_filter['url_name']) ? $type_filter['url_name'] : $type_filter['name']);
- $filter_link_rewrite = Tools::link_rewrite($filter_name);
-
- if (count($type_filter) > 0 && !isset($type_filter['slider']))
- {
- foreach ($type_filter['values'] as $key => $values)
- {
- $nofollow = false;
- if (!empty($values['checked']) && in_array($type_filter['type'], $blacklist))
- $global_nofollow = true;
-
- $option_checked_clone_array = $option_checked_array;
-
- // If not filters checked, add parameter
- $value_name = !empty($values['url_name']) ? $values['url_name'] : $values['name'];
-
- if (!in_array(Tools::link_rewrite($value_name), $param_group_selected_array[$filter_link_rewrite]))
- {
- // Update parameter filter checked before
- if (array_key_exists($filter_link_rewrite, $option_checked_array))
- {
- $option_checked_clone_array[$filter_link_rewrite] = $option_checked_clone_array[$filter_link_rewrite].$this->getAnchor().str_replace($this->getAnchor(), '_', Tools::link_rewrite($value_name));
-
- if (in_array($type_filter['type'], $blacklist))
- $nofollow = true;
- }
- else
- $option_checked_clone_array[$filter_link_rewrite] = $this->getAnchor().str_replace($this->getAnchor(), '_', Tools::link_rewrite($value_name));
- }
- else
- {
- // Remove selected parameters
- $option_checked_clone_array[$filter_link_rewrite] = str_replace($this->getAnchor().str_replace($this->getAnchor(), '_', Tools::link_rewrite($value_name)), '', $option_checked_clone_array[$filter_link_rewrite]);
- if (empty($option_checked_clone_array[$filter_link_rewrite]))
- unset($option_checked_clone_array[$filter_link_rewrite]);
- }
- $parameters = '';
- ksort($option_checked_clone_array); // Order parameters
- foreach ($option_checked_clone_array as $key_group => $value_group)
- $parameters .= '/'.str_replace($this->getAnchor(), '_', $key_group).$value_group;
-
- // Add nofollow if any blacklisted filters ins in parameters
- foreach ($filter_blocks as $filter)
- {
- $name = Tools::link_rewrite((!empty($filter['url_name']) ? $filter['url_name'] : $filter['name']));
- if (in_array($filter['type'], $blacklist) && strpos($parameters, $name.'-') !== false)
- $nofollow = true;
- }
-
- // Check if there is an non indexable attribute or feature in the url
- foreach ($non_indexable as $value)
- if (strpos($parameters, '/'.$value) !== false)
- $nofollow = true;
-
- $type_filter['values'][$key]['link'] = $categorie_link.'#'.ltrim($parameters, '/');
- $type_filter['values'][$key]['rel'] = ($nofollow) ? 'nofollow' : '';
- }
- }
- }
-
- $n_filters = 0;
-
- if (isset($selected_filters['price']))
- if ($price_array['min'] == $selected_filters['price'][0] && $price_array['max'] == $selected_filters['price'][1])
- unset($selected_filters['price']);
- if (isset($selected_filters['weight']))
- if ($weight_array['min'] == $selected_filters['weight'][0] && $weight_array['max'] == $selected_filters['weight'][1])
- unset($selected_filters['weight']);
-
- foreach ($selected_filters as $filters)
- $n_filters += count($filters);
-
- $cache = array(
- 'layered_show_qties' => (int)Configuration::get('PS_LAYERED_SHOW_QTIES'),
- 'id_category_layered' => (int)$id_parent,
- 'selected_filters' => $selected_filters,
- 'n_filters' => (int)$n_filters,
- 'nbr_filterBlocks' => count($filter_blocks),
- 'filters' => $filter_blocks,
- 'title_values' => $title_values,
- 'meta_values' => $meta_values,
- 'current_friendly_url' => $param_selected,
- 'param_product_url' => $param_product_url,
- 'no_follow' => (!empty($param_selected) || $global_nofollow)
- );
-
- return $cache;
- }
-
- public function cleanFilterByIdValue($attributes, $id_value)
- {
- $selected_filters = array();
- if (is_array($attributes))
- foreach ($attributes as $attribute)
- {
- $attribute_data = explode('_', $attribute);
- if ($attribute_data[0] == $id_value)
- $selected_filters[] = $attribute_data[1];
- }
- return $selected_filters;
- }
-
- public function generateFiltersBlock($selected_filters)
- {
- global $smarty;
- if ($filter_block = $this->getFilterBlock($selected_filters))
- {
- if ($filter_block['nbr_filterBlocks'] == 0)
- return false;
-
- $translate = array();
- $translate['price'] = $this->l('price');
- $translate['weight'] = $this->l('weight');
-
- $smarty->assign($filter_block);
- $smarty->assign(array(
- 'hide_0_values' => Configuration::get('PS_LAYERED_HIDE_0_VALUES'),
- 'blocklayeredSliderName' => $translate,
- 'col_img_dir' => _PS_COL_IMG_DIR_
- ));
- return $this->display(__FILE__, 'blocklayered.tpl');
- }
- else
- return false;
- }
-
- private static function getPriceFilterSubQuery($filter_value, $ignore_join = false)
- {
- $id_currency = (int)Context::getContext()->currency->id;
-
- if (isset($filter_value) && $filter_value)
- {
- $price_filter_query = '
- INNER JOIN `'._DB_PREFIX_.'layered_price_index` psi ON (psi.id_product = p.id_product AND psi.id_currency = '.(int)$id_currency.'
- AND psi.price_min <= '.(int)$filter_value[1].' AND psi.price_max >= '.(int)$filter_value[0].' AND psi.id_shop='.(int)Context::getContext()->shop->id.') ';
- return array('join' => $price_filter_query);
- }
- return array();
- }
-
- private static function filterProductsByPrice($filter_value, $product_collection)
- {
- static $ps_layered_filter_price_usetax = null;
- static $ps_layered_filter_price_rounding = null;
-
- if (empty($filter_value))
- return $product_collection;
-
- if ($ps_layered_filter_price_usetax === null) {
- $ps_layered_filter_price_usetax = Configuration::get('PS_LAYERED_FILTER_PRICE_USETAX');
- }
-
- if ($ps_layered_filter_price_rounding === null) {
- $ps_layered_filter_price_rounding = Configuration::get('PS_LAYERED_FILTER_PRICE_ROUNDING');
- }
-
- foreach ($product_collection as $key => $product)
- {
- if (isset($filter_value) && $filter_value && isset($product['price_min']) && isset($product['id_product'])
- && (($product['price_min'] < (int)$filter_value[0] && $product['price_max'] > (int)$filter_value[0])
- || ($product['price_max'] > (int)$filter_value[1] && $product['price_min'] < (int)$filter_value[1])))
- {
- $price = Product::getPriceStatic($product['id_product'], $ps_layered_filter_price_usetax);
- if ($ps_layered_filter_price_rounding) {
- $price = (int)$price;
- }
- if ($price < $filter_value[0] || $price > $filter_value[1]) {
- unset($product_collection[$key]);
- }
- }
- }
- return $product_collection;
- }
-
- private static function getWeightFilterSubQuery($filter_value, $ignore_join = false)
- {
- if (isset($filter_value) && $filter_value) {
- if ($filter_value[0] != 0 || $filter_value[1] != 0) {
- return array('where' => ' AND p.`weight` BETWEEN '.(float)($filter_value[0] - 0.001).' AND '.(float)($filter_value[1] + 0.001).' ');
- }
- }
-
- return array();
- }
-
- private static function getId_featureFilterSubQuery($filter_value, $ignore_join = false)
- {
- if (empty($filter_value))
- return array();
- $query_filters = ' AND EXISTS (SELECT * FROM '._DB_PREFIX_.'feature_product fp WHERE fp.id_product = p.id_product AND ';
- foreach ($filter_value as $filter_val)
- $query_filters .= 'fp.`id_feature_value` = '.(int)$filter_val.' OR ';
- $query_filters = rtrim($query_filters, 'OR ').') ';
-
- return array('where' => $query_filters);
- }
- private static function getId_attribute_groupFilterSubQuery($filter_value, $ignore_join = false)
- {
- if (empty($filter_value))
- return array();
- $query_filters = '
- AND EXISTS (SELECT *
- FROM `'._DB_PREFIX_.'product_attribute_combination` pac
- LEFT JOIN `'._DB_PREFIX_.'product_attribute` pa ON (pa.`id_product_attribute` = pac.`id_product_attribute`)
- WHERE pa.id_product = p.id_product AND ';
-
- foreach ($filter_value as $filter_val)
- $query_filters .= 'pac.`id_attribute` = '.(int)$filter_val.' OR ';
- $query_filters = rtrim($query_filters, 'OR ').') ';
-
- return array('where' => $query_filters);
- }
-
- private static function getCategoryFilterSubQuery($filter_value, $ignore_join = false)
- {
- if (empty($filter_value))
- return array();
- $query_filters_where = ' AND EXISTS (SELECT * FROM '._DB_PREFIX_.'category_product cp WHERE id_product = p.id_product AND ';
- foreach ($filter_value as $id_category)
- $query_filters_where .= 'cp.`id_category` = '.(int)$id_category.' OR ';
- $query_filters_where = rtrim($query_filters_where, 'OR ').') ';
-
- return array('where' => $query_filters_where);
- }
-
- private static function getQuantityFilterSubQuery($filter_value, $ignore_join = false)
- {
- if (count($filter_value) == 2 || empty($filter_value))
- return array();
-
- $query_filters_join = '';
-
- $query_filters = ' AND sav.quantity '.(!$filter_value[0] ? '<=' : '>').' 0 ';
- $query_filters_join = 'LEFT JOIN `'._DB_PREFIX_.'stock_available` sav ON (sav.id_product = p.id_product AND sav.id_shop = '.(int)Context::getContext()->shop->id.') ';
-
- return array('where' => $query_filters, 'join' => $query_filters_join);
- }
-
- private static function getManufacturerFilterSubQuery($filter_value, $ignore_join = false)
- {
- if (empty($filter_value))
- $query_filters = '';
- else
- {
- array_walk($filter_value, function (&$id_manufacturer) {$id_manufacturer = (int)$id_manufacturer;});
- $query_filters = ' AND p.id_manufacturer IN ('.implode(',', $filter_value).')';
- }
- if ($ignore_join)
- return array('where' => $query_filters);
- else
- return array('where' => $query_filters, 'join' => 'LEFT JOIN `'._DB_PREFIX_.'manufacturer` m ON (m.id_manufacturer = p.id_manufacturer) ');
- }
-
- private static function getConditionFilterSubQuery($filter_value, $ignore_join = false)
- {
- if (count($filter_value) == 3 || empty($filter_value))
- return array();
-
- $query_filters = ' AND p.condition IN (';
-
- foreach ($filter_value as $cond)
- $query_filters .= '\''.$cond.'\',';
- $query_filters = rtrim($query_filters, ',').') ';
-
- return array('where' => $query_filters);
- }
-
- public function ajaxCall()
- {
- global $smarty, $cookie;
-
- $selected_filters = $this->getSelectedFilters();
- $filter_block = $this->getFilterBlock($selected_filters);
- $this->getProducts($selected_filters, $products, $nb_products, $p, $n, $pages_nb, $start, $stop, $range);
-
- // Add pagination variable
- $nArray = (int)Configuration::get('PS_PRODUCTS_PER_PAGE') != 10 ? array((int)Configuration::get('PS_PRODUCTS_PER_PAGE'), 10, 20, 50) : array(10, 20, 50);
- // Clean duplicate values
- $nArray = array_unique($nArray);
- asort($nArray);
-
- Hook::exec(
- 'actionProductListModifier',
- array(
- 'nb_products' => &$nb_products,
- 'cat_products' => &$products,
- )
- );
-
- if (version_compare(_PS_VERSION_, '1.6.0', '>=') === true)
- $this->context->controller->addColorsToProductList($products);
-
- $category = new Category(Tools::getValue('id_category_layered', Configuration::get('PS_HOME_CATEGORY')), (int)$cookie->id_lang);
-
- // Generate meta title and meta description
- $category_title = (empty($category->meta_title) ? $category->name : $category->meta_title);
- $category_metas = Meta::getMetaTags((int)$cookie->id_lang, 'category');
- $title = '';
- $keywords = '';
-
- if (is_array($filter_block['title_values']))
- foreach ($filter_block['title_values'] as $key => $val)
- {
- $title .= ' > '.$key.' '.implode('/', $val);
- $keywords .= $key.' '.implode('/', $val).', ';
- }
-
- $title = $category_title.$title;
-
- if (!empty($title))
- $meta_title = $title;
- else
- $meta_title = $category_metas['meta_title'];
-
- $meta_description = $category_metas['meta_description'];
-
- $keywords = Tools::substr(Tools::strtolower($keywords), 0, 1000);
- if (!empty($keywords))
- $meta_keywords = rtrim($category_title.', '.$keywords.', '.$category_metas['meta_keywords'], ', ');
-
- $smarty->assign(
- array(
- 'homeSize' => Image::getSize(ImageType::getFormatedName('home')),
- 'nb_products' => $nb_products,
- 'category' => $category,
- 'pages_nb' => (int)$pages_nb,
- 'p' => (int)$p,
- 'n' => (int)$n,
- 'range' => (int)$range,
- 'start' => (int)$start,
- 'stop' => (int)$stop,
- 'n_array' => ((int)Configuration::get('PS_PRODUCTS_PER_PAGE') != 10) ? array((int)Configuration::get('PS_PRODUCTS_PER_PAGE'), 10, 20, 50) : array(10, 20, 50),
- 'comparator_max_item' => (int)(Configuration::get('PS_COMPARATOR_MAX_ITEM')),
- 'products' => $products,
- 'products_per_page' => (int)Configuration::get('PS_PRODUCTS_PER_PAGE'),
- 'static_token' => Tools::getToken(false),
- 'page_name' => 'category',
- 'nArray' => $nArray,
- 'compareProducts' => CompareProduct::getCompareProducts((int)$this->context->cookie->id_compare)
- )
- );
-
- // Prevent bug with old template where category.tpl contain the title of the category and category-count.tpl do not exists
- if (file_exists(_PS_THEME_DIR_.'category-count.tpl'))
- $category_count = $smarty->fetch(_PS_THEME_DIR_.'category-count.tpl');
- else
- $category_count = '';
-
- if ($nb_products == 0)
- $product_list = $this->display(__FILE__, 'blocklayered-no-products.tpl');
- else
- $product_list = $smarty->fetch(_PS_THEME_DIR_.'product-list.tpl');
-
- $vars = array(
- 'filtersBlock' => utf8_encode($this->generateFiltersBlock($selected_filters)),
- 'productList' => utf8_encode($product_list),
- 'pagination' => $smarty->fetch(_PS_THEME_DIR_.'pagination.tpl'),
- 'categoryCount' => $category_count,
- 'meta_title' => $meta_title.' - '.Configuration::get('PS_SHOP_NAME'),
- 'heading' => $meta_title,
- 'meta_keywords' => isset($meta_keywords) ? $meta_keywords : null,
- 'meta_description' => $meta_description,
- 'current_friendly_url' => ((int)$n == (int)$nb_products) ? '#/show-all': '#'.$filter_block['current_friendly_url'],
- 'filters' => $filter_block['filters'],
- 'nbRenderedProducts' => (int)$nb_products,
- 'nbAskedProducts' => (int)$n
- );
-
- if (version_compare(_PS_VERSION_, '1.6.0', '>=') === true)
- $vars = array_merge($vars, array('pagination_bottom' => $smarty->assign('paginationId', 'bottom')
- ->fetch(_PS_THEME_DIR_.'pagination.tpl')));
- /* We are sending an array in jSon to the .js controller, it will update both the filters and the products zones */
- return json_encode($vars);
- }
-
- public function getProducts($selected_filters, &$products, &$nb_products, &$p, &$n, &$pages_nb, &$start, &$stop, &$range)
- {
- global $cookie;
-
- $products = $this->getProductByFilters($selected_filters);
- $products = Product::getProductsProperties((int)$cookie->id_lang, $products);
- $nb_products = $this->nbr_products;
- $range = 2; /* how many pages around page selected */
-
- $product_per_page = isset($this->context->cookie->nb_item_per_page) ? (int)$this->context->cookie->nb_item_per_page : Configuration::get('PS_PRODUCTS_PER_PAGE');
- $n = (int)Tools::getValue('n', Configuration::get('PS_PRODUCTS_PER_PAGE'));
-
- if ($n <= 0)
- $n = 1;
-
- $p = $this->page;
-
- if ($p < 0)
- $p = 0;
-
- if ($p > ($nb_products / $n))
- $p = ceil($nb_products / $n);
- $pages_nb = ceil($nb_products / (int)($n));
-
- $start = (int)($p - $range);
- if ($start < 1)
- $start = 1;
-
- $stop = (int)($p + $range);
- if ($stop > $pages_nb)
- $stop = (int)($pages_nb);
-
- foreach ($products as &$product)
- {
- if ($product['id_product_attribute'] && isset($product['product_attribute_minimal_quantity']))
- $product['minimal_quantity'] = $product['product_attribute_minimal_quantity'];
- }
- }
-
- public function rebuildLayeredStructure()
- {
- @set_time_limit(0);
-
- /* Set memory limit to 128M only if current is lower */
- $memory_limit = @ini_get('memory_limit');
- if (substr($memory_limit, -1) != 'G' && ((substr($memory_limit, -1) == 'M' && substr($memory_limit, 0, -1) < 128) || is_numeric($memory_limit) && (intval($memory_limit) < 131072)))
- @ini_set('memory_limit', '128M');
-
- /* Delete and re-create the layered categories table */
- Db::getInstance()->execute('DROP TABLE IF EXISTS '._DB_PREFIX_.'layered_category');
- Db::getInstance()->execute('
- CREATE TABLE IF NOT EXISTS `'._DB_PREFIX_.'layered_category` (
- `id_layered_category` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
- `id_shop` INT(11) UNSIGNED NOT NULL,
- `id_category` INT(10) UNSIGNED NOT NULL,
- `id_value` INT(10) UNSIGNED NULL DEFAULT \'0\',
- `type` ENUM(\'category\',\'id_feature\',\'id_attribute_group\',\'quantity\',\'condition\',\'manufacturer\',\'weight\',\'price\') NOT NULL,
- `position` INT(10) UNSIGNED NOT NULL,
- `filter_type` int(10) UNSIGNED NOT NULL DEFAULT 0,
- `filter_show_limit` int(10) UNSIGNED NOT NULL DEFAULT 0,
- PRIMARY KEY (`id_layered_category`),
- KEY `id_category` (`id_category`,`type`)
- ) ENGINE='._MYSQL_ENGINE_.' DEFAULT CHARSET=latin1 AUTO_INCREMENT=1;'); /* MyISAM + latin1 = Smaller/faster */
-
- Db::getInstance()->execute('
- CREATE TABLE IF NOT EXISTS `'._DB_PREFIX_.'layered_filter` (
- `id_layered_filter` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
- `name` VARCHAR(64) NOT NULL,
- `filters` TEXT NULL,
- `n_categories` INT(10) UNSIGNED NOT NULL,
- `date_add` DATETIME NOT NULL
- ) ENGINE='._MYSQL_ENGINE_.' DEFAULT CHARSET=utf8;');
-
- Db::getInstance()->execute('
- CREATE TABLE IF NOT EXISTS `'._DB_PREFIX_.'layered_filter_shop` (
- `id_layered_filter` INT(10) UNSIGNED NOT NULL,
- `id_shop` INT(11) UNSIGNED NOT NULL,
- PRIMARY KEY (`id_layered_filter`, `id_shop`),
- KEY `id_shop` (`id_shop`)
- ) ENGINE='._MYSQL_ENGINE_.' DEFAULT CHARSET=utf8;');
- }
-
- public function rebuildLayeredCache($products_ids = array(), $categories_ids = array())
- {
- @set_time_limit(0);
-
- $filter_data = array('categories' => array());
-
- /* Set memory limit to 128M only if current is lower */
- $memory_limit = @ini_get('memory_limit');
- if (substr($memory_limit, -1) != 'G' && ((substr($memory_limit, -1) == 'M' && substr($memory_limit, 0, -1) < 128) || is_numeric($memory_limit) && (intval($memory_limit) < 131072)))
- @ini_set('memory_limit', '128M');
-
- $db = Db::getInstance(_PS_USE_SQL_SLAVE_);
- $n_categories = array();
- $done_categories = array();
- $alias = 'p';
- $join_product_attribute = $join_product = '';
-
- $alias = 'product_shop';
- $join_product = Shop::addSqlAssociation('product', 'p');
- $join_product_attribute = Shop::addSqlAssociation('product_attribute', 'pa');
-
-
- $attribute_groups = self::query('
- SELECT a.id_attribute, a.id_attribute_group
- FROM '._DB_PREFIX_.'attribute a
- LEFT JOIN '._DB_PREFIX_.'product_attribute_combination pac ON (pac.id_attribute = a.id_attribute)
- LEFT JOIN '._DB_PREFIX_.'product_attribute pa ON (pa.id_product_attribute = pac.id_product_attribute)
- LEFT JOIN '._DB_PREFIX_.'product p ON (p.id_product = pa.id_product)
- '.$join_product.$join_product_attribute.'
- LEFT JOIN '._DB_PREFIX_.'category_product cp ON (cp.id_product = p.id_product)
- LEFT JOIN '._DB_PREFIX_.'category c ON (c.id_category = cp.id_category)
- WHERE c.active = 1'.
- (count($categories_ids) ? ' AND cp.id_category IN ('.implode(',', $categories_ids).')' : '').'
- AND '.$alias.'.active = 1 AND '.$alias.'.`visibility` IN ("both", "catalog")
- '.(count($products_ids) ? 'AND p.id_product IN ('.implode(',', $products_ids).')' : ''));
-
- $attribute_groups_by_id = array();
- while ($row = $db->nextRow($attribute_groups))
- $attribute_groups_by_id[(int)$row['id_attribute']] = (int)$row['id_attribute_group'];
-
- $features = self::query('
- SELECT fv.id_feature_value, fv.id_feature
- FROM '._DB_PREFIX_.'feature_value fv
- LEFT JOIN '._DB_PREFIX_.'feature_product fp ON (fp.id_feature_value = fv.id_feature_value)
- LEFT JOIN '._DB_PREFIX_.'product p ON (p.id_product = fp.id_product)
- '.$join_product.'
- LEFT JOIN '._DB_PREFIX_.'category_product cp ON (cp.id_product = p.id_product)
- LEFT JOIN '._DB_PREFIX_.'category c ON (c.id_category = cp.id_category)
- WHERE (fv.custom IS NULL OR fv.custom = 0) AND c.active = 1'.(count($categories_ids) ? ' AND cp.id_category IN ('.implode(',', $categories_ids).')' : '').'
- AND '.$alias.'.active = 1 AND '.$alias.'.`visibility` IN ("both", "catalog") '.(count($products_ids) ? 'AND p.id_product IN ('.implode(',', $products_ids).')' : ''));
-
- $features_by_id = array();
- while ($row = $db->nextRow($features))
- $features_by_id[(int)$row['id_feature_value']] = (int)$row['id_feature'];
-
- $result = self::query('
- SELECT p.id_product,
- GROUP_CONCAT(DISTINCT fv.id_feature_value) features,
- GROUP_CONCAT(DISTINCT cp.id_category) categories,
- GROUP_CONCAT(DISTINCT pac.id_attribute) attributes
- FROM '._DB_PREFIX_.'product p
- LEFT JOIN '._DB_PREFIX_.'category_product cp ON (cp.id_product = p.id_product)
- LEFT JOIN '._DB_PREFIX_.'category c ON (c.id_category = cp.id_category)
- LEFT JOIN '._DB_PREFIX_.'feature_product fp ON (fp.id_product = p.id_product)
- LEFT JOIN '._DB_PREFIX_.'feature_value fv ON (fv.id_feature_value = fp.id_feature_value)
- LEFT JOIN '._DB_PREFIX_.'product_attribute pa ON (pa.id_product = p.id_product)
- '.$join_product.$join_product_attribute.'
- LEFT JOIN '._DB_PREFIX_.'product_attribute_combination pac ON (pac.id_product_attribute = pa.id_product_attribute)
- WHERE c.active = 1'.(count($categories_ids) ? ' AND cp.id_category IN ('.implode(',', $categories_ids).')' : '').'
- AND '.$alias.'.active = 1 AND '.$alias.'.`visibility` IN ("both", "catalog")
- '.(count($products_ids) ? 'AND p.id_product IN ('.implode(',', $products_ids).')' : '').
- ' AND (fv.custom IS NULL OR fv.custom = 0)
- GROUP BY p.id_product');
-
-
- $shop_list = Shop::getShops(false, null, true);
-
- $to_insert = false;
- while ($product = $db->nextRow($result))
- {
- $a = $c = $f = array();
- if (!empty($product['attributes']))
- $a = array_flip(explode(',', $product['attributes']));
- if (!empty($product['categories']))
- $c = array_flip(explode(',', $product['categories']));
- if (!empty($product['features']))
- $f = array_flip(explode(',', $product['features']));
-
- $filter_data['shop_list'] = $shop_list;
-
- foreach ($c as $id_category => $category)
- {
- if (!in_array($id_category, $filter_data['categories']))
- $filter_data['categories'][] = $id_category;
-
- if (!isset($n_categories[(int)$id_category]))
- $n_categories[(int)$id_category] = 1;
- if (!isset($done_categories[(int)$id_category]['cat']))
- {
- $filter_data['layered_selection_subcategories'] = array('filter_type' => 0, 'filter_show_limit' => 0);
- $done_categories[(int)$id_category]['cat'] = true;
- $to_insert = true;
- }
- if (is_array($attribute_groups_by_id) && count($attribute_groups_by_id) > 0)
- foreach ($a as $k_attribute => $attribute)
- if (!isset($done_categories[(int)$id_category]['a'.(int)$attribute_groups_by_id[(int)$k_attribute]]))
- {
- $filter_data['layered_selection_ag_'.(int)$attribute_groups_by_id[(int)$k_attribute]] = array('filter_type' => 0, 'filter_show_limit' => 0);
- $done_categories[(int)$id_category]['a'.(int)$attribute_groups_by_id[(int)$k_attribute]] = true;
- $to_insert = true;
- }
- if (is_array($attribute_groups_by_id) && count($attribute_groups_by_id) > 0)
- foreach ($f as $k_feature => $feature)
- if (!isset($done_categories[(int)$id_category]['f'.(int)$features_by_id[(int)$k_feature]]))
- {
- $filter_data['layered_selection_feat_'.(int)$features_by_id[(int)$k_feature]] = array('filter_type' => 0, 'filter_show_limit' => 0);
- $done_categories[(int)$id_category]['f'.(int)$features_by_id[(int)$k_feature]] = true;
- $to_insert = true;
- }
- if (!isset($done_categories[(int)$id_category]['q']))
- {
- $filter_data['layered_selection_stock'] = array('filter_type' => 0, 'filter_show_limit' => 0);
- $done_categories[(int)$id_category]['q'] = true;
- $to_insert = true;
- }
- if (!isset($done_categories[(int)$id_category]['m']))
- {
- $filter_data['layered_selection_manufacturer'] = array('filter_type' => 0, 'filter_show_limit' => 0);
- $done_categories[(int)$id_category]['m'] = true;
- $to_insert = true;
- }
- if (!isset($done_categories[(int)$id_category]['c']))
- {
- $filter_data['layered_selection_condition'] = array('filter_type' => 0, 'filter_show_limit' => 0);
- $done_categories[(int)$id_category]['c'] = true;
- $to_insert = true;
- }
- if (!isset($done_categories[(int)$id_category]['w']))
- {
- $filter_data['layered_selection_weight_slider'] = array('filter_type' => 0, 'filter_show_limit' => 0);
- $done_categories[(int)$id_category]['w'] = true;
- $to_insert = true;
- }
- if (!isset($done_categories[(int)$id_category]['p']))
- {
- $filter_data['layered_selection_price_slider'] = array('filter_type' => 0, 'filter_show_limit' => 0);
- $done_categories[(int)$id_category]['p'] = true;
- $to_insert = true;
- }
- }
- }
- if ($to_insert)
- {
- Db::getInstance()->execute('INSERT INTO '._DB_PREFIX_.'layered_filter(name, filters, n_categories, date_add)
- VALUES (\''.sprintf($this->l('My template %s'), date('Y-m-d')).'\', \''.pSQL(serialize($filter_data)).'\', '.count($filter_data['categories']).', NOW())');
-
- $last_id = Db::getInstance()->Insert_ID();
- Db::getInstance()->execute('DELETE FROM '._DB_PREFIX_.'layered_filter_shop WHERE `id_layered_filter` = '.$last_id);
- foreach ($shop_list as $id_shop)
- Db::getInstance()->execute('INSERT INTO '._DB_PREFIX_.'layered_filter_shop (`id_layered_filter`, `id_shop`)
- VALUES('.$last_id.', '.(int)$id_shop.')');
-
- $this->buildLayeredCategories();
- }
- }
-
- public function buildLayeredCategories()
- {
- // Get all filter template
- $res = Db::getInstance()->executeS('SELECT * FROM '._DB_PREFIX_.'layered_filter ORDER BY date_add DESC');
- $categories = array();
- // Remove all from layered_category
- Db::getInstance()->execute('TRUNCATE '._DB_PREFIX_.'layered_category');
-
- if (!count($res)) // No filters templates defined, nothing else to do
- return true;
-
- $sql_to_insert = 'INSERT INTO '._DB_PREFIX_.'layered_category (id_category, id_shop, id_value, type, position, filter_show_limit, filter_type) VALUES ';
- $values = false;
-
- foreach ($res as $filter_template)
- {
- $data = Tools::unSerialize($filter_template['filters']);
- foreach ($data['shop_list'] as $id_shop)
- {
- if (!isset($categories[$id_shop]))
- $categories[$id_shop] = array();
-
- foreach ($data['categories'] as $id_category)
- {
- $n = 0;
- if (!in_array($id_category, $categories[$id_shop])) // Last definition, erase preivious categories defined
- {
- $categories[$id_shop][] = $id_category;
-
- foreach ($data as $key => $value)
- if (substr($key, 0, 17) == 'layered_selection')
- {
- $values = true;
- $type = $value['filter_type'];
- $limit = $value['filter_show_limit'];
- $n++;
-
- if ($key == 'layered_selection_stock')
- $sql_to_insert .= '('.(int)$id_category.', '.(int)$id_shop.', NULL,\'quantity\','.(int)$n.', '.(int)$limit.', '.(int)$type.'),';
- else if ($key == 'layered_selection_subcategories')
- $sql_to_insert .= '('.(int)$id_category.', '.(int)$id_shop.', NULL,\'category\','.(int)$n.', '.(int)$limit.', '.(int)$type.'),';
- else if ($key == 'layered_selection_condition')
- $sql_to_insert .= '('.(int)$id_category.', '.(int)$id_shop.', NULL,\'condition\','.(int)$n.', '.(int)$limit.', '.(int)$type.'),';
- else if ($key == 'layered_selection_weight_slider')
- $sql_to_insert .= '('.(int)$id_category.', '.(int)$id_shop.', NULL,\'weight\','.(int)$n.', '.(int)$limit.', '.(int)$type.'),';
- else if ($key == 'layered_selection_price_slider')
- $sql_to_insert .= '('.(int)$id_category.', '.(int)$id_shop.', NULL,\'price\','.(int)$n.', '.(int)$limit.', '.(int)$type.'),';
- else if ($key == 'layered_selection_manufacturer')
- $sql_to_insert .= '('.(int)$id_category.', '.(int)$id_shop.', NULL,\'manufacturer\','.(int)$n.', '.(int)$limit.', '.(int)$type.'),';
- else if (substr($key, 0, 21) == 'layered_selection_ag_')
- $sql_to_insert .= '('.(int)$id_category.', '.(int)$id_shop.', '.(int)str_replace('layered_selection_ag_', '', $key).',
- \'id_attribute_group\','.(int)$n.', '.(int)$limit.', '.(int)$type.'),';
- else if (substr($key, 0, 23) == 'layered_selection_feat_')
- $sql_to_insert .= '('.(int)$id_category.', '.(int)$id_shop.', '.(int)str_replace('layered_selection_feat_', '', $key).',
- \'id_feature\','.(int)$n.', '.(int)$limit.', '.(int)$type.'),';
- }
- }
- }
- }
- }
- if ($values)
- Db::getInstance()->execute(rtrim($sql_to_insert, ','));
- }
-
- protected function getAnchor()
- {
- static $anchor = null;
- if ($anchor === null)
- if (!$anchor = Configuration::get('PS_ATTRIBUTE_ANCHOR_SEPARATOR'))
- $anchor = '-';
- return $anchor;
- }
-
- protected function showPriceFilter()
- {
- return Group::getCurrent()->show_prices;
- }
-
- protected function filterVar($value)
- {
- if (version_compare(_PS_VERSION_, '1.6.0.7', '>=') === true)
- return Tools::purifyHTML($value);
- else
- return filter_var($value, FILTER_SANITIZE_STRING);
- }
-}
diff --git a/modules/blocklayered/blocklayered.tpl b/modules/blocklayered/blocklayered.tpl
deleted file mode 100644
index 37d094051..000000000
--- a/modules/blocklayered/blocklayered.tpl
+++ /dev/null
@@ -1,252 +0,0 @@
-{*
-* 2007-2015 PrestaShop
-*
-* 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@prestashop.com 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
-* @copyright 2007-2015 PrestaShop SA
-* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
-* International Registred Trademark & Property of PrestaShop SA
-*}
-
-{if $nbr_filterBlocks != 0}
-
-
-
-
diff --git a/modules/blocklayered/views/templates/admin/index.php b/modules/blocklayered/views/templates/admin/index.php
deleted file mode 100644
index 4768c184e..000000000
--- a/modules/blocklayered/views/templates/admin/index.php
+++ /dev/null
@@ -1,35 +0,0 @@
-
-* @copyright 2007-2015 PrestaShop SA
-* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
-* International Registered Trademark & Property of PrestaShop SA
-*/
-
-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;
\ No newline at end of file
diff --git a/modules/blocklayered/views/templates/admin/view.tpl b/modules/blocklayered/views/templates/admin/view.tpl
deleted file mode 100644
index 9f5c205c9..000000000
--- a/modules/blocklayered/views/templates/admin/view.tpl
+++ /dev/null
@@ -1,279 +0,0 @@
-{if isset($message)}{$message}{/if}
-
-
-
-
-
-
-{if !empty($limit_warning)}
-
- {if $limit_warning['error_type'] == 'suhosin'}
- {l s='Warning! Your hosting provider is using the Suhosin patch for PHP, which limits the maximum number of fields allowed in a form:'}
-
- {$limit_warning['post.max_vars']} {l s='for suhosin.post.max_vars.'}
- {$limit_warning['request.max_vars']} {l s='for suhosin.request.max_vars.'}
- {l s='Please ask your hosting provider to increase the Suhosin limit to'}
- {else}
- {l s='Warning! Your PHP configuration limits the maximum number of fields allowed in a form:'}
- {$limit_warning['max_input_vars']} {l s='for max_input_vars.'}
- {l s='Please ask your hosting provider to increase this limit to'}
- {/if}
- {l s='%s at least, or you will have to edit the translation files manually.' sprintf=$limit_warning['needed_limit']}
-
- {if $limit_warning['error_type'] == 'suhosin'}
- {l s='Warning! Your hosting provider is using the Suhosin patch for PHP, which limits the maximum number of fields allowed in a form:'}
-
- {$limit_warning['post.max_vars']} {l s='for suhosin.post.max_vars.'}
- {$limit_warning['request.max_vars']} {l s='for suhosin.request.max_vars.'}
- {l s='Please ask your hosting provider to increase the Suhosin limit to'}
- {else}
- {l s='Warning! Your PHP configuration limits the maximum number of fields allowed in a form:'}
- {$limit_warning['max_input_vars']} {l s='for max_input_vars.'}
- {l s='Please ask your hosting provider to increase this limit to'}
- {/if}
- {l s='%s at least, or you will have to edit the translation files manually.' sprintf=$limit_warning['needed_limit']}
-
-{/if}
-
-
{l s='Indexes and caches' mod='blocklayered'}
-
- {l s='Indexing is in progress. Please do not leave this page' mod='blocklayered'}
-
- {l s='You can set a cron job that will rebuild price index using the following URL:' mod='blocklayered'}
-
- {$price_indexer_url}
-
-
- {l s='You can set a cron job that will rebuild attribute index using the following URL:' mod='blocklayered'}
-
- {$attribute_indexer_url}
-
-
- {l s='You can set a cron job that will rebuild URL index using the following URL:' mod='blocklayered'}
-
- {$url_indexer_url}
-
-
-
-
{l s='A nightly rebuild is recommended.' mod='blocklayered'}
-
-
diff --git a/modules/blocklayered/views/templates/front/index.php b/modules/blocklayered/views/templates/front/index.php
deleted file mode 100644
index 4768c184e..000000000
--- a/modules/blocklayered/views/templates/front/index.php
+++ /dev/null
@@ -1,35 +0,0 @@
-
-* @copyright 2007-2015 PrestaShop SA
-* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
-* International Registered Trademark & Property of PrestaShop SA
-*/
-
-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;
\ No newline at end of file
diff --git a/modules/blocklayered/views/templates/hook/attribute_form.tpl b/modules/blocklayered/views/templates/hook/attribute_form.tpl
deleted file mode 100644
index 01c3c9ee2..000000000
--- a/modules/blocklayered/views/templates/hook/attribute_form.tpl
+++ /dev/null
@@ -1,53 +0,0 @@
-{*
-* 2007-2015 PrestaShop
-*
-* 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@prestashop.com 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
-* @copyright 2007-2015 PrestaShop SA
-* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
-* International Registred Trademark & Property of PrestaShop SA
-*}
-
-
-
- {foreach $languages as $language}
-
-
-
{l s='When the Layered Navigation Block module is enabled, you can get more detailed URLs by choosing the word that best represent this attribute. By default, PrestaShop uses the attribute\'s name, but you can change that setting using this field.' mod='blocklayered'}
{l s='When the Layered Navigation Block module is enabled, you can get more detailed page titles by choosing the word that best represent this attribute. By default, PrestaShop uses the attribute\'s name, but you can change that setting using this field.' mod='blocklayered'}
-
- {/foreach}
-
-
-
diff --git a/modules/blocklayered/views/templates/hook/attribute_form_1.6.tpl b/modules/blocklayered/views/templates/hook/attribute_form_1.6.tpl
deleted file mode 100644
index 65712fe88..000000000
--- a/modules/blocklayered/views/templates/hook/attribute_form_1.6.tpl
+++ /dev/null
@@ -1,82 +0,0 @@
-{*
-* 2007-2015 PrestaShop
-*
-* 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@prestashop.com 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
-* @copyright 2007-2015 PrestaShop SA
-* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
-* International Registred Trademark & Property of PrestaShop SA
-*}
-
{l s='When the Layered Navigation Block module is enabled, you can get more detailed URLs by choosing the word that best represent this attribute. By default, PrestaShop uses the attribute\'s name, but you can change that setting using this field.' mod='blocklayered'}
{l s='When the Layered Navigation Block module is enabled, you can get more detailed page titles by choosing the word that best represent this attribute. By default, PrestaShop uses the attribute\'s name, but you can change that setting using this field.' mod='blocklayered'}
-
-
-
-
diff --git a/modules/blocklayered/views/templates/hook/attribute_group_form.tpl b/modules/blocklayered/views/templates/hook/attribute_group_form.tpl
deleted file mode 100644
index 2cdbeba1f..000000000
--- a/modules/blocklayered/views/templates/hook/attribute_group_form.tpl
+++ /dev/null
@@ -1,64 +0,0 @@
-{*
-* 2007-2015 PrestaShop
-*
-* 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@prestashop.com 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
-* @copyright 2007-2015 PrestaShop SA
-* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
-* International Registred Trademark & Property of PrestaShop SA
-*}
-
-
-
- {foreach $languages as $language}
-
-
-
{l s='When the Layered Navigation Block module is enabled, you can get more detailed URLs by choosing the word that best represent this attribute. By default, PrestaShop uses the attribute\'s name, but you can change that setting using this field.' mod='blocklayered'}
{l s='When the Layered Navigation Block module is enabled, you can get more detailed page titles by choosing the word that best represent this attribute. By default, PrestaShop uses the attribute\'s name, but you can change that setting using this field.' mod='blocklayered'}
-
- {/foreach}
-
-
-
-
-
-
-
-
-
-
-
-
{l s='Use this attribute in URL generated by the layered navigation module.' mod='blocklayered'}
-
-
diff --git a/modules/blocklayered/views/templates/hook/attribute_group_form_1.6.tpl b/modules/blocklayered/views/templates/hook/attribute_group_form_1.6.tpl
deleted file mode 100644
index 297fe88de..000000000
--- a/modules/blocklayered/views/templates/hook/attribute_group_form_1.6.tpl
+++ /dev/null
@@ -1,101 +0,0 @@
-{*
-* 2007-2015 PrestaShop
-*
-* 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@prestashop.com 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
-* @copyright 2007-2015 PrestaShop SA
-* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
-* International Registred Trademark & Property of PrestaShop SA
-*}
-
{l s='When the Layered Navigation Block module is enabled, you can get more detailed URLs by choosing the word that best represent this attribute. By default, PrestaShop uses the attribute\'s name, but you can change that setting using this field.' mod='blocklayered'}
{l s='When the Layered Navigation Block module is enabled, you can get more detailed page titles by choosing the word that best represent this attribute. By default, PrestaShop uses the attribute\'s name, but you can change that setting using this field.' mod='blocklayered'}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
{l s='Use this attribute in URL generated by the layered navigation module.' mod='blocklayered'}
-
-
diff --git a/modules/blocklayered/views/templates/hook/feature_form.tpl b/modules/blocklayered/views/templates/hook/feature_form.tpl
deleted file mode 100644
index 7fcca2c7b..000000000
--- a/modules/blocklayered/views/templates/hook/feature_form.tpl
+++ /dev/null
@@ -1,64 +0,0 @@
-{*
-* 2007-2015 PrestaShop
-*
-* 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@prestashop.com 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
-* @copyright 2007-2015 PrestaShop SA
-* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
-* International Registred Trademark & Property of PrestaShop SA
-*}
-
-
-
- {foreach $languages as $language}
-
-
-
{l s='When the Layered Navigation Block module is enabled, you can get more detailed URLs by choosing the word that best represent this feature. By default, PrestaShop uses the feature\'s name, but you can change that setting using this field.' mod='blocklayered'}
{l s='When the Layered Navigation Block module is enabled, you can get more detailed page titles by choosing the word that best represent this feature. By default, PrestaShop uses the feature\'s name, but you can change that setting using this field.' mod='blocklayered'}
-
- {/foreach}
-
-
-
-
-
-
-
-
-
-
-
-
{l s='Use this attribute in URL generated by the layered navigation module.' mod='blocklayered'}
-
-
diff --git a/modules/blocklayered/views/templates/hook/feature_form_1.6.tpl b/modules/blocklayered/views/templates/hook/feature_form_1.6.tpl
deleted file mode 100644
index e670d87f9..000000000
--- a/modules/blocklayered/views/templates/hook/feature_form_1.6.tpl
+++ /dev/null
@@ -1,101 +0,0 @@
-{*
-* 2007-2015 PrestaShop
-*
-* 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@prestashop.com 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
-* @copyright 2007-2015 PrestaShop SA
-* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
-* International Registred Trademark & Property of PrestaShop SA
-*}
-
{l s='When the Layered Navigation Block module is enabled, you can get more detailed URLs by choosing the word that best represent this feature. By default, PrestaShop uses the feature\'s name, but you can change that setting using this field.' mod='blocklayered'}
{l s='When the Layered Navigation Block module is enabled, you can get more detailed page titles by choosing the word that best represent this feature. By default, PrestaShop uses the feature\'s name, but you can change that setting using this field.' mod='blocklayered'}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
{l s='Use this attribute in URL generated by the layered navigation module.' mod='blocklayered'}
-
-
diff --git a/modules/blocklayered/views/templates/hook/feature_value_form.tpl b/modules/blocklayered/views/templates/hook/feature_value_form.tpl
deleted file mode 100644
index f16456f96..000000000
--- a/modules/blocklayered/views/templates/hook/feature_value_form.tpl
+++ /dev/null
@@ -1,53 +0,0 @@
-{*
-* 2007-2015 PrestaShop
-*
-* 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@prestashop.com 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
-* @copyright 2007-2015 PrestaShop SA
-* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
-* International Registred Trademark & Property of PrestaShop SA
-*}
-
-
-
- {foreach $languages as $language}
-
-
-
{l s='When the Layered Navigation Block module is enabled, you can get more detailed URLs by choosing the word that best represent this feature\'s value. By default, PrestaShop uses the value\'s name, but you can change that setting using this field.' mod='blocklayered'}
{l s='When the Layered Navigation Block module is enabled, you can get more detailed page titles by choosing the word that best represent this feature\'s value. By default, PrestaShop uses the value\'s name, but you can change that setting using this field.' mod='blocklayered'}
-
- {/foreach}
-
-
-
diff --git a/modules/blocklayered/views/templates/hook/feature_value_form_1.6.tpl b/modules/blocklayered/views/templates/hook/feature_value_form_1.6.tpl
deleted file mode 100644
index b91b2d026..000000000
--- a/modules/blocklayered/views/templates/hook/feature_value_form_1.6.tpl
+++ /dev/null
@@ -1,82 +0,0 @@
-{*
-* 2007-2015 PrestaShop
-*
-* 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@prestashop.com 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
-* @copyright 2007-2015 PrestaShop SA
-* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
-* International Registred Trademark & Property of PrestaShop SA
-*}
-
{l s='When the Layered Navigation Block module is enabled, you can get more detailed URLs by choosing the word that best represent this feature\'s value. By default, PrestaShop uses the value\'s name, but you can change that setting using this field.' mod='blocklayered'}
{l s='When the Layered Navigation Block module is enabled, you can get more detailed page titles by choosing the word that best represent this feature\'s value. By default, PrestaShop uses the value\'s name, but you can change that setting using this field.' mod='blocklayered'}
-
-
-
-
diff --git a/modules/blocklayered/views/templates/hook/index.php b/modules/blocklayered/views/templates/hook/index.php
deleted file mode 100644
index 4768c184e..000000000
--- a/modules/blocklayered/views/templates/hook/index.php
+++ /dev/null
@@ -1,35 +0,0 @@
-
-* @copyright 2007-2015 PrestaShop SA
-* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
-* International Registered Trademark & Property of PrestaShop SA
-*/
-
-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;
\ No newline at end of file
diff --git a/modules/blocklayered/views/templates/index.php b/modules/blocklayered/views/templates/index.php
deleted file mode 100644
index e03b8382a..000000000
--- a/modules/blocklayered/views/templates/index.php
+++ /dev/null
@@ -1,35 +0,0 @@
-
-* @copyright 2007-2015 PrestaShop SA
-* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
-* International Registered Trademark & Property of PrestaShop SA
-*/
-
-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;
\ No newline at end of file
diff --git a/modules/blocklink/CHANGELOG.txt b/modules/blocklink/CHANGELOG.txt
deleted file mode 100644
index ab4c9da38..000000000
--- a/modules/blocklink/CHANGELOG.txt
+++ /dev/null
@@ -1,8 +0,0 @@
-2014-04-22 18:57:19 +0200 // Changelog updated
-2014-04-16 16:18:13 +0200 // Code cleaning
-2014-04-16 16:08:43 +0200 [-] BO : Bug #, Set category if multi-store active and employee has only one shop
-2014-03-24 12:22:19 +0100 Merge branch 'master' of https://github.com/PrestaShop/blocklink
-2014-03-24 11:43:28 +0100 / MO blocklink : ps_versions_compliancy modified (1.5.6.1 => 1.6)
-2014-03-24 11:02:36 +0100 // MO blocklink/ : ps_versions_compliancy added
-2014-03-21 18:36:19 +0100 [-] Add column names in SQL insert into
-2014-03-20 14:22:49 +0100 Initial commit
diff --git a/modules/blocklink/add.png b/modules/blocklink/add.png
deleted file mode 100644
index 5260144e9..000000000
Binary files a/modules/blocklink/add.png and /dev/null differ
diff --git a/modules/blocklink/blocklink.php b/modules/blocklink/blocklink.php
deleted file mode 100644
index 1b2f46153..000000000
--- a/modules/blocklink/blocklink.php
+++ /dev/null
@@ -1,558 +0,0 @@
-
-* @copyright 2007-2016 PrestaShop SA
-* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
-* International Registered Trademark & Property of PrestaShop SA
-*/
-
-if (!defined('_PS_VERSION_'))
- exit;
-
-class BlockLink extends Module
-{
- /* @var boolean error */
- protected $error = false;
-
- public function __construct()
- {
- $this->name = 'blocklink';
- $this->tab = 'front_office_features';
- $this->version = '1.6.1';
- $this->author = 'PrestaShop';
- $this->need_instance = 0;
-
- $this->bootstrap = true;
- parent::__construct();
-
- $this->displayName = $this->l('Link block');
- $this->description = $this->l('Adds a block with additional links.');
- $this->confirmUninstall = $this->l('Are you sure you want to delete all your links?');
- $this->ps_versions_compliancy = array('min' => '1.6', 'max' => '1.6.99.99');
- }
-
- public function install()
- {
- if (!parent::install() || !$this->registerHook('header'))
- return false;
-
- $success = Configuration::updateValue('PS_BLOCKLINK_TITLE', array('1' => 'Block link', '2' => 'Bloc lien'));
- $success &= Db::getInstance()->execute('
- CREATE TABLE '._DB_PREFIX_.'blocklink (
- `id_blocklink` int(10) NOT NULL AUTO_INCREMENT,
- `url` varchar(254) NOT NULL,
- `new_window` TINYINT(1) NOT NULL,
- PRIMARY KEY(`id_blocklink`))
- ENGINE='._MYSQL_ENGINE_.' default CHARSET=utf8');
- $success &= Db::getInstance()->execute('
- CREATE TABLE '._DB_PREFIX_.'blocklink_shop (
- `id_blocklink` int(10) NOT NULL AUTO_INCREMENT,
- `id_shop` int(10) NOT NULL,
- PRIMARY KEY(`id_blocklink`, `id_shop`))
- ENGINE='._MYSQL_ENGINE_.' default CHARSET=utf8');
- $success &= Db::getInstance()->execute('
- CREATE TABLE '._DB_PREFIX_.'blocklink_lang (
- `id_blocklink` int(10) NOT NULL,
- `id_lang` int(10) NOT NULL,
- `text` varchar(62) NOT NULL,
- PRIMARY KEY(`id_blocklink`, `id_lang`))
- ENGINE='._MYSQL_ENGINE_.' default CHARSET=utf8');
- if (!$success)
- {
- parent::uninstall();
-
- return false;
- }
-
- // Hook the module either on the left or right column
- $theme = new Theme(Context::getContext()->shop->id_theme);
- if ((!$theme->default_left_column || !$this->registerHook('leftColumn'))
- && (!$theme->default_right_column || !$this->registerHook('rightColumn'))
- )
- {
- // If there are no colums implemented by the template, throw an error and uninstall the module
- $this->_errors[] = $this->l('This module needs to be hooked to a column, but your theme does not implement one');
- parent::uninstall();
-
- return false;
- }
-
- return true;
- }
-
- public function uninstall()
- {
- if (!parent::uninstall() ||
- !Db::getInstance()->execute('DROP TABLE '._DB_PREFIX_.'blocklink') ||
- !Db::getInstance()->execute('DROP TABLE '._DB_PREFIX_.'blocklink_lang') ||
- !Db::getInstance()->execute('DROP TABLE '._DB_PREFIX_.'blocklink_shop') ||
- !Configuration::deleteByName('PS_BLOCKLINK_TITLE') ||
- !Configuration::deleteByName('PS_BLOCKLINK_URL')
- )
- return false;
-
- return true;
- }
-
- public function hookLeftColumn($params)
- {
- $links = $this->getLinks();
-
- $this->smarty->assign(array(
- 'blocklink_links' => $links,
- 'title' => Configuration::get('PS_BLOCKLINK_TITLE', $this->context->language->id),
- 'url' => Configuration::get('PS_BLOCKLINK_URL'),
- 'lang' => 'text_'.$this->context->language->id
- ));
- if (!$links)
- return false;
-
- return $this->display(__FILE__, 'blocklink.tpl');
- }
-
- public function hookRightColumn($params)
- {
- return $this->hookLeftColumn($params);
- }
-
- public function hookHeader($params)
- {
- $this->context->controller->addCSS($this->_path.'blocklink.css', 'all');
- }
-
- /**
- * @param $id
- *
- * @return bool|array
- */
- public function getLinkById($id)
- {
- if ((int)$id > 0)
- {
- $sql = 'SELECT b.`id_blocklink`, b.`url`, b.`new_window` FROM `'._DB_PREFIX_.'blocklink` b WHERE b.id_blocklink='.(int)$id;
-
- if (!$results = Db::getInstance()->getRow($sql))
- return false;
-
- $link['id_blocklink'] = (int)$results['id_blocklink'];
- $link['url'] = $results['url'];
- $link['newWindow'] = $results['new_window'];
-
- $results = Db::getInstance()->executeS('SELECT `id_lang`, `text` FROM '._DB_PREFIX_.'blocklink_lang WHERE `id_blocklink`='.(int)$link['id_blocklink']);
-
- $results_lang = array();
- foreach ($results as $result)
- $results_lang[(int)$result['id_lang']] = $result;
-
- foreach (Language::getLanguages(false) as $lang)
- $link['text'][(int)$lang['id_lang']] = (isset($results_lang[(int)$lang['id_lang']])) ? $results_lang[(int)$lang['id_lang']]['text'] : false;
-
- return $link;
- }
-
- return false;
- }
-
- public function getLinks()
- {
- $result = array();
- // Get id and url
-
- $sql = 'SELECT b.`id_blocklink`, b.`url`, b.`new_window`
- FROM `'._DB_PREFIX_.'blocklink` b';
- if (Shop::isFeatureActive() && Shop::getContext() != Shop::CONTEXT_ALL)
- $sql .= ' JOIN `'._DB_PREFIX_.'blocklink_shop` bs ON b.`id_blocklink` = bs.`id_blocklink` AND bs.`id_shop` IN ('.implode(', ', Shop::getContextListShopID()).') ';
- $sql .= (int)Configuration::get('PS_BLOCKLINK_ORDERWAY') == 1 ? ' ORDER BY `id_blocklink` DESC' : '';
-
- if (!$links = Db::getInstance()->executeS($sql))
- return false;
-
- $i = 0;
- foreach ($links as $link)
- {
- $result[$i]['id'] = $link['id_blocklink'];
- $result[$i]['url'] = $link['url'];
- $result[$i]['newWindow'] = $link['new_window'];
- // Get multilingual text
-
- if (!$texts = Db::getInstance()->executeS('
- SELECT `id_lang`, `text`
- FROM '._DB_PREFIX_.'blocklink_lang
- WHERE `id_blocklink`='.(int)$link['id_blocklink']
- )
- )
- return false;
-
- foreach ($texts as $text)
- $result[$i]['text_'.$text['id_lang']] = $text['text'];
-
- $i++;
- }
-
- return $result;
- }
-
- public function addLink()
- {
- if (!($languages = Language::getLanguages(true)))
- return false;
- $id_lang_default = (int)Configuration::get('PS_LANG_DEFAULT');
-
- if ((int)Tools::getValue('id_blocklink') > 0)
- {
- $id_link = (int)Tools::getValue('id_blocklink');
- if (!Db::getInstance()->execute('UPDATE '._DB_PREFIX_.'blocklink SET `url` = \''.pSQL(Tools::getValue('url')).'\', `new_window` = '.pSQL((int)Tools::getValue('newWindow')).' WHERE `id_blocklink` = '.(int)$id_link))
- return false;
- if (!Db::getInstance()->execute('DELETE FROM '._DB_PREFIX_.'blocklink_lang WHERE `id_blocklink` = '.(int)$id_link))
- return false;
-
- foreach ($languages as $language)
- if (!empty($_POST['text_'.$language['id_lang']]))
- {
- if (!Db::getInstance()->execute('INSERT INTO '._DB_PREFIX_.'blocklink_lang (`id_blocklink`, `id_lang`, `text`) VALUES ('.(int)$id_link.', '.(int)($language['id_lang']).', \''.pSQL($_POST['text_'.$language['id_lang']]).'\')'))
- return false;
- }
- else
- if (!Db::getInstance()->execute('INSERT INTO '._DB_PREFIX_.'blocklink_lang VALUES ('.(int)$id_link.', '.$language['id_lang'].', \''.pSQL($_POST['text_'.$id_lang_default]).'\')'))
- return false;
- }
- else
- {
- if (!Db::getInstance()->execute('INSERT INTO '._DB_PREFIX_.'blocklink (`id_blocklink`, `url`, `new_window`)
- VALUES (NULL, \''.pSQL(Tools::getValue('url')).'\', '.((isset($_POST['newWindow']) && Tools::getValue('newWindow')) == 'on' ? 1 : 0).')') ||
- !$id_link = Db::getInstance()->Insert_ID()
- )
- return false;
-
- foreach ($languages as $language)
- if (!empty($_POST['text_'.$language['id_lang']]))
- {
- if (!Db::getInstance()->execute('INSERT INTO '._DB_PREFIX_.'blocklink_lang (`id_blocklink`, `id_lang`, `text`)
- VALUES ('.(int)$id_link.', '.(int)$language['id_lang'].', \''.pSQL(Tools::getValue('text_'.$language['id_lang'])).'\')')
- )
- return false;
- }
- else
- if (!Db::getInstance()->execute('INSERT INTO '._DB_PREFIX_.'blocklink_lang (`id_blocklink`, `id_lang`, `text`) VALUES ('.(int)$id_link.', '.(int)($language['id_lang']).', \''.pSQL($_POST['text_'.$id_lang_default]).'\')'))
- return false;
- }
-
- Db::getInstance()->execute('DELETE FROM '._DB_PREFIX_.'blocklink_shop WHERE id_blocklink='.(int)$id_link);
-
- $shops = Shop::getShops(true, null, true);
- if (!Shop::isFeatureActive() || (Shop::isFeatureActive() && count($shops) == 1))
- {
- Db::getInstance()->insert('blocklink_shop', array(
- 'id_blocklink' => (int)$id_link,
- 'id_shop' => (int)Context::getContext()->shop->id,
- ));
- }
- else
- {
- $assos_shop = Tools::getValue('checkBoxShopAsso_configuration');
- if (empty($assos_shop))
- return false;
- foreach ($assos_shop as $id_shop => $row)
- Db::getInstance()->insert('blocklink_shop', array(
- 'id_blocklink' => (int)$id_link,
- 'id_shop' => (int)$id_shop,
- ));
- }
-
- return true;
- }
-
- public function deleteLink()
- {
- return (Db::getInstance()->execute('DELETE FROM '._DB_PREFIX_.'blocklink WHERE `id_blocklink` = '.(int)Tools::getValue('id')) &&
- Db::getInstance()->execute('DELETE FROM '._DB_PREFIX_.'blocklink_shop WHERE `id_blocklink` = '.(int)Tools::getValue('id')) &&
- Db::getInstance()->execute('DELETE FROM '._DB_PREFIX_.'blocklink_lang WHERE `id_blocklink` = '.(int)Tools::getValue('id')));
- }
-
- public function updateTitle()
- {
- $languages = Language::getLanguages();
- $result = array();
- foreach ($languages as $language)
- $result[$language['id_lang']] = Tools::getValue('title_'.$language['id_lang']);
- if (!Configuration::updateValue('PS_BLOCKLINK_TITLE', $result))
- return false;
-
- return Configuration::updateValue('PS_BLOCKLINK_URL', Tools::getValue('title_url'));
- }
-
- public function getContent()
- {
- $this->_html = '';
-
- // Add a link
- if (Tools::isSubmit('submitLinkAdd') /* || Tools::isSubmit('updateblocklink')*/)
- {
- if (empty($_POST['text_'.Configuration::get('PS_LANG_DEFAULT')]) || empty($_POST['url']))
- $this->_html .= $this->displayError($this->l('You must fill in all fields.'));
- elseif (!Validate::isUrl(str_replace('http://', '', $_POST['url'])))
- $this->_html .= $this->displayError($this->l('Bad URL'));
- else
- if ($this->addLink())
- $this->_html .= $this->displayConfirmation($this->l('The link has been added.'));
- else
- $this->_html .= $this->displayError($this->l('An error occurred during link creation.'));
- }
- // Update the block title
- elseif (Tools::isSubmit('submitTitle'))
- {
-
- if (empty($_POST['title_'.Configuration::get('PS_LANG_DEFAULT')]))
- $this->_html .= $this->displayError($this->l('"title" field cannot be empty.'));
- elseif (!empty($_POST['title_url']) && !Validate::isUrl(str_replace('http://', '', $_POST['title_url'])))
- $this->_html .= $this->displayError($this->l('The \'title\' field is invalid'));
- elseif (!Validate::isGenericName($_POST['title_'.Configuration::get('PS_LANG_DEFAULT')]))
- $this->_html .= $this->displayError($this->l('The \'title\' field is invalid'));
- elseif (!$this->updateTitle())
- $this->_html .= $this->displayError($this->l('An error occurred during title updating.'));
- else
- $this->_html .= $this->displayConfirmation($this->l('The block title has been updated.'));
- }
- // Delete a link
- elseif (Tools::isSubmit('deleteblocklink') && Tools::getValue('id'))
- {
-
- if (!is_numeric(Tools::getValue('id')) || !$this->deleteLink())
- $this->_html .= $this->displayError($this->l('An error occurred during link deletion.'));
- else
- $this->_html .= $this->displayConfirmation($this->l('The link has been deleted.'));
- }
-
- if (isset($_POST['submitOrderWay']))
- {
- if (Configuration::updateValue('PS_BLOCKLINK_ORDERWAY', (int)(Tools::getValue('orderWay'))))
- $this->_html .= $this->displayConfirmation($this->l('Sort order updated'));
- else
- $this->_html .= $this->displayError($this->l('An error occurred during sort order set-up.'));
- }
-
- $this->_html .= $this->renderForm();
- $this->_html .= $this->renderList();
-
- return $this->_html;
- }
-
- public function renderList()
- {
- $fields_list = array(
- 'id' => array(
- 'title' => $this->l('Link ID'),
- 'type' => 'text',
- ),
- 'text_'.$this->context->language->id => array(
- 'title' => $this->l('Link text'),
- 'type' => 'text',
- ),
- 'url' => array(
- 'title' => $this->l('URL'),
- 'type' => 'text',
- ),
- );
-
- $helper = new HelperList();
- $helper->shopLinkType = '';
- $helper->simple_header = true;
- $helper->identifier = 'id';
- $helper->actions = array('edit', 'delete');
- $helper->show_toolbar = false;
-
- $helper->title = $this->l('Link list');
- $helper->table = $this->name;
- $helper->token = Tools::getAdminTokenLite('AdminModules');
- $helper->currentIndex = AdminController::$currentIndex.'&configure='.$this->name;
- $links = $this->getLinks();
- if (is_array($links) && count($links))
- return $helper->generateList($links, $fields_list);
- else
- return false;
- }
-
- public function renderForm()
- {
- $fields_form_1 = array(
- 'form' => array(
- 'legend' => array(
- 'title' => $this->l('Add a new link'),
- 'icon' => 'icon-plus-sign-alt'
- ),
- 'input' => array(
- array(
- 'type' => 'hidden',
- 'name' => 'id_blocklink',
- ),
- array(
- 'type' => 'text',
- 'label' => $this->l('Link text'),
- 'name' => 'text',
- 'lang' => true,
- ),
- array(
- 'type' => 'text',
- 'label' => $this->l('URL'),
- 'name' => 'url',
- ),
- array(
- 'type' => 'switch',
- 'label' => $this->l('Open in a new window'),
- 'name' => 'newWindow',
- 'is_bool' => true,
- 'values' => array(
- array(
- 'id' => 'active_on',
- 'value' => 1,
- 'label' => $this->l('Enabled')
- ),
- array(
- 'id' => 'active_off',
- 'value' => 0,
- 'label' => $this->l('Disabled')
- )
- ),
- ),
-
- ),
- 'submit' => array(
- 'title' => $this->l('Save'),
- 'name' => 'submitLinkAdd',
- )
- ),
- );
-
- if (Shop::isFeatureActive())
- {
- $fields_form_1['form']['input'][] = array(
- 'type' => 'shop',
- 'label' => $this->l('Shop association'),
- 'name' => 'checkBoxShopAsso',
- );
- }
-
- $fields_form_2 = array(
- 'form' => array(
- 'legend' => array(
- 'title' => $this->l('Block settings'),
- 'icon' => 'icon-plus-sign-alt'
- ),
- 'input' => array(
- array(
- 'type' => 'text',
- 'label' => $this->l('Block title'),
- 'name' => 'title',
- 'lang' => true,
- ),
- array(
- 'type' => 'text',
- 'label' => $this->l('URL for the block\'s title'),
- 'name' => 'title_url',
- ),
- ),
- 'submit' => array(
- 'title' => $this->l('Save'),
- 'name' => 'submitTitle',
- )
- ),
- );
-
- $fields_form_3 = array(
- 'form' => array(
- 'legend' => array(
- 'title' => $this->l('Link display settings'),
- 'icon' => 'icon-cogs'
- ),
- 'input' => array(
- array(
- 'type' => 'select',
- 'label' => $this->l('List order'),
- 'name' => 'orderWay',
- 'options' => array(
- 'query' => array(
- array(
- 'id' => 0,
- 'name' => $this->l('most recent links first')
- ),
- array(
- 'id' => 1,
- 'name' => $this->l('oldest links first')
- )
- ),
- 'id' => 'id',
- 'name' => 'name',
- )
- ),
- ),
- 'submit' => array(
- 'title' => $this->l('Save'),
- 'name' => 'submitOrderWay',
- )
- ),
- );
-
- $helper = new HelperForm();
- $helper->show_toolbar = false;
- $lang = new Language((int)Configuration::get('PS_LANG_DEFAULT'));
- $helper->default_form_language = $lang->id;
- $helper->allow_employee_form_lang = Configuration::get('PS_BO_ALLOW_EMPLOYEE_FORM_LANG') ? Configuration::get('PS_BO_ALLOW_EMPLOYEE_FORM_LANG') : 0;
- $this->fields_form = array();
-
- $helper->identifier = 'id_blocklink';
- $helper->submit_action = 'submit';
- $helper->currentIndex = $this->context->link->getAdminLink('AdminModules', false).'&configure='.$this->name.'&tab_module='.$this->tab.'&module_name='.$this->name;
- $helper->token = Tools::getAdminTokenLite('AdminModules');
-
- $helper->tpl_vars = array(
- 'fields_value' => $this->getConfigFieldsValues(),
- 'languages' => $this->context->controller->getLanguages(),
- 'id_language' => $this->context->language->id
- );
-
- return $helper->generateForm(array($fields_form_1, $fields_form_2, $fields_form_3));
- }
-
- public function getConfigFieldsValues()
- {
- $fields_values = array(
- 'id_blocklink' => Tools::getValue('id_blocklink'),
- 'url' => Tools::getValue('url'),
- 'newWindow' => Tools::getValue('newWindow'),
- 'orderWay' => Tools::getValue('orderWay', Configuration::get('PS_BLOCKLINK_ORDERWAY')),
- 'title_url' => Tools::getValue('title_url', Configuration::get('PS_BLOCKLINK_URL')),
- );
-
-
- $languages = Language::getLanguages(false);
-
- foreach ($languages as $lang)
- {
- $fields_values['text'][$lang['id_lang']] = Tools::getValue('text_'.(int)$lang['id_lang']);
- $fields_values['title'][$lang['id_lang']] = Tools::getValue('title', Configuration::get('PS_BLOCKLINK_TITLE', $lang['id_lang']));
- }
-
- if (Tools::getIsset('updateblocklink') && (int)Tools::getValue('id') > 0)
- $fields_values = array_merge($fields_values, $this->getLinkById((int)Tools::getValue('id')));
-
- return $fields_values;
- }
-}
diff --git a/modules/blocklink/blocklink.tpl b/modules/blocklink/blocklink.tpl
deleted file mode 100644
index 771e2b507..000000000
--- a/modules/blocklink/blocklink.tpl
+++ /dev/null
@@ -1,44 +0,0 @@
-{*
-* 2007-2016 PrestaShop
-*
-* 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@prestashop.com 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
-* @copyright 2007-2016 PrestaShop SA
-* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
-* International Registered Trademark & Property of PrestaShop SA
-*}
-
-
-
» {l s='Do not allow new products at this time.' mod='blocknewproducts'}
- {/if}
-
-
-
diff --git a/modules/blocknewproducts/views/templates/hook/blocknewproducts_home.tpl b/modules/blocknewproducts/views/templates/hook/blocknewproducts_home.tpl
deleted file mode 100644
index fceb75f12..000000000
--- a/modules/blocknewproducts/views/templates/hook/blocknewproducts_home.tpl
+++ /dev/null
@@ -1,31 +0,0 @@
-{*
-* 2007-2016 PrestaShop
-*
-* 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@prestashop.com 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
-* @copyright 2007-2016 PrestaShop SA
-* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
-* International Registered Trademark & Property of PrestaShop SA
-*}
-{if isset($new_products) && $new_products}
- {include file="$tpl_dir./product-list.tpl" products=$new_products class='blocknewproducts tab-pane' id='blocknewproducts'}
-{else}
-
-
{l s='No new products at this time.' mod='blocknewproducts'}
-
-{/if}
diff --git a/modules/blocknewproducts/views/templates/hook/index.php b/modules/blocknewproducts/views/templates/hook/index.php
deleted file mode 100644
index 8761a003e..000000000
--- a/modules/blocknewproducts/views/templates/hook/index.php
+++ /dev/null
@@ -1,35 +0,0 @@
-
-* @copyright 2007-2016 PrestaShop SA
-* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
-* International Registered Trademark & Property of PrestaShop SA
-*/
-
-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;
\ No newline at end of file
diff --git a/modules/blocknewproducts/views/templates/hook/tab.tpl b/modules/blocknewproducts/views/templates/hook/tab.tpl
deleted file mode 100644
index 61232733c..000000000
--- a/modules/blocknewproducts/views/templates/hook/tab.tpl
+++ /dev/null
@@ -1,25 +0,0 @@
-{*
-* 2007-2016 PrestaShop
-*
-* 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@prestashop.com 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
-* @copyright 2007-2016 PrestaShop SA
-* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
-* International Registered Trademark & Property of PrestaShop SA
-*}
-
-
\ No newline at end of file
diff --git a/modules/blockpaymentlogo/index.php b/modules/blockpaymentlogo/index.php
deleted file mode 100644
index e5064df41..000000000
--- a/modules/blockpaymentlogo/index.php
+++ /dev/null
@@ -1,35 +0,0 @@
-
-* @copyright 2007-2016 PrestaShop SA
-* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
-* International Registered Trademark & Property of PrestaShop SA
-*/
-
-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;
\ No newline at end of file
diff --git a/modules/blockpaymentlogo/logo.gif b/modules/blockpaymentlogo/logo.gif
deleted file mode 100644
index 22c8df5a8..000000000
Binary files a/modules/blockpaymentlogo/logo.gif and /dev/null differ
diff --git a/modules/blockpaymentlogo/logo.png b/modules/blockpaymentlogo/logo.png
deleted file mode 100644
index d94d19760..000000000
Binary files a/modules/blockpaymentlogo/logo.png and /dev/null differ
diff --git a/modules/blockpaymentlogo/translations/index.php b/modules/blockpaymentlogo/translations/index.php
deleted file mode 100644
index e5064df41..000000000
--- a/modules/blockpaymentlogo/translations/index.php
+++ /dev/null
@@ -1,35 +0,0 @@
-
-* @copyright 2007-2016 PrestaShop SA
-* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
-* International Registered Trademark & Property of PrestaShop SA
-*/
-
-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;
\ No newline at end of file
diff --git a/modules/blockpermanentlinks/CHANGELOG.txt b/modules/blockpermanentlinks/CHANGELOG.txt
deleted file mode 100644
index 4015d4cee..000000000
--- a/modules/blockpermanentlinks/CHANGELOG.txt
+++ /dev/null
@@ -1,4 +0,0 @@
-2014-04-22 18:57:34 +0200 // Changelog updated
-2014-03-24 11:43:28 +0100 / MO blockpermanentlinks : ps_versions_compliancy modified (1.5.6.1 => 1.6)
-2014-03-24 11:03:21 +0100 / MO blockpermanentlinks : ps_versions_compliancy added
-2014-03-20 14:23:25 +0100 Initial commit
diff --git a/modules/blockpermanentlinks/blockpermanentlinks-footer.tpl b/modules/blockpermanentlinks/blockpermanentlinks-footer.tpl
deleted file mode 100644
index fe8f1b0b5..000000000
--- a/modules/blockpermanentlinks/blockpermanentlinks-footer.tpl
+++ /dev/null
@@ -1,44 +0,0 @@
-{*
-* 2007-2016 PrestaShop
-*
-* 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@prestashop.com 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
-* @copyright 2007-2016 PrestaShop SA
-* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
-* International Registered Trademark & Property of PrestaShop SA
-*}
-
-
-
-
diff --git a/modules/blockpermanentlinks/blockpermanentlinks-header.tpl b/modules/blockpermanentlinks/blockpermanentlinks-header.tpl
deleted file mode 100644
index 6f8fc38f0..000000000
--- a/modules/blockpermanentlinks/blockpermanentlinks-header.tpl
+++ /dev/null
@@ -1,34 +0,0 @@
-{*
-* 2007-2016 PrestaShop
-*
-* 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@prestashop.com 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
-* @copyright 2007-2016 PrestaShop SA
-* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
-* International Registered Trademark & Property of PrestaShop SA
-*}
-
-
-
-
diff --git a/modules/blockrss/img/arrow_right_2.png b/modules/blockrss/img/arrow_right_2.png
deleted file mode 100644
index 6b076ee2f..000000000
Binary files a/modules/blockrss/img/arrow_right_2.png and /dev/null differ
diff --git a/modules/blockrss/img/index.php b/modules/blockrss/img/index.php
deleted file mode 100644
index 19a328b3b..000000000
--- a/modules/blockrss/img/index.php
+++ /dev/null
@@ -1,35 +0,0 @@
-
-* @copyright 2007-2016 PrestaShop SA
-* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
-* International Registered Trademark & Property of PrestaShop SA
-*/
-
-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;
\ No newline at end of file
diff --git a/modules/blockrss/index.php b/modules/blockrss/index.php
deleted file mode 100644
index e5064df41..000000000
--- a/modules/blockrss/index.php
+++ /dev/null
@@ -1,35 +0,0 @@
-
-* @copyright 2007-2016 PrestaShop SA
-* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
-* International Registered Trademark & Property of PrestaShop SA
-*/
-
-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;
\ No newline at end of file
diff --git a/modules/blockrss/logo.gif b/modules/blockrss/logo.gif
deleted file mode 100644
index 7a5e0099f..000000000
Binary files a/modules/blockrss/logo.gif and /dev/null differ
diff --git a/modules/blockrss/logo.png b/modules/blockrss/logo.png
deleted file mode 100644
index 519118125..000000000
Binary files a/modules/blockrss/logo.png and /dev/null differ
diff --git a/modules/blockrss/translations/index.php b/modules/blockrss/translations/index.php
deleted file mode 100644
index e5064df41..000000000
--- a/modules/blockrss/translations/index.php
+++ /dev/null
@@ -1,35 +0,0 @@
-
-* @copyright 2007-2016 PrestaShop SA
-* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
-* International Registered Trademark & Property of PrestaShop SA
-*/
-
-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;
\ No newline at end of file
diff --git a/modules/blockrss/vendor/autoload.php b/modules/blockrss/vendor/autoload.php
deleted file mode 100644
index f3772b7aa..000000000
--- a/modules/blockrss/vendor/autoload.php
+++ /dev/null
@@ -1,7 +0,0 @@
-
- * Jordi Boggiano
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Composer\Autoload;
-
-/**
- * ClassLoader implements a PSR-0, PSR-4 and classmap class loader.
- *
- * $loader = new \Composer\Autoload\ClassLoader();
- *
- * // register classes with namespaces
- * $loader->add('Symfony\Component', __DIR__.'/component');
- * $loader->add('Symfony', __DIR__.'/framework');
- *
- * // activate the autoloader
- * $loader->register();
- *
- * // to enable searching the include path (eg. for PEAR packages)
- * $loader->setUseIncludePath(true);
- *
- * In this example, if you try to use a class in the Symfony\Component
- * namespace or one of its children (Symfony\Component\Console for instance),
- * the autoloader will first look for the class under the component/
- * directory, and it will then fallback to the framework/ directory if not
- * found before giving up.
- *
- * This class is loosely based on the Symfony UniversalClassLoader.
- *
- * @author Fabien Potencier
- * @author Jordi Boggiano
- * @see http://www.php-fig.org/psr/psr-0/
- * @see http://www.php-fig.org/psr/psr-4/
- */
-class ClassLoader
-{
- // PSR-4
- private $prefixLengthsPsr4 = array();
- private $prefixDirsPsr4 = array();
- private $fallbackDirsPsr4 = array();
-
- // PSR-0
- private $prefixesPsr0 = array();
- private $fallbackDirsPsr0 = array();
-
- private $useIncludePath = false;
- private $classMap = array();
- private $classMapAuthoritative = false;
- private $missingClasses = array();
- private $apcuPrefix;
-
- public function getPrefixes()
- {
- if (!empty($this->prefixesPsr0)) {
- return call_user_func_array('array_merge', $this->prefixesPsr0);
- }
-
- return array();
- }
-
- public function getPrefixesPsr4()
- {
- return $this->prefixDirsPsr4;
- }
-
- public function getFallbackDirs()
- {
- return $this->fallbackDirsPsr0;
- }
-
- public function getFallbackDirsPsr4()
- {
- return $this->fallbackDirsPsr4;
- }
-
- public function getClassMap()
- {
- return $this->classMap;
- }
-
- /**
- * @param array $classMap Class to filename map
- */
- public function addClassMap(array $classMap)
- {
- if ($this->classMap) {
- $this->classMap = array_merge($this->classMap, $classMap);
- } else {
- $this->classMap = $classMap;
- }
- }
-
- /**
- * Registers a set of PSR-0 directories for a given prefix, either
- * appending or prepending to the ones previously set for this prefix.
- *
- * @param string $prefix The prefix
- * @param array|string $paths The PSR-0 root directories
- * @param bool $prepend Whether to prepend the directories
- */
- public function add($prefix, $paths, $prepend = false)
- {
- if (!$prefix) {
- if ($prepend) {
- $this->fallbackDirsPsr0 = array_merge(
- (array) $paths,
- $this->fallbackDirsPsr0
- );
- } else {
- $this->fallbackDirsPsr0 = array_merge(
- $this->fallbackDirsPsr0,
- (array) $paths
- );
- }
-
- return;
- }
-
- $first = $prefix[0];
- if (!isset($this->prefixesPsr0[$first][$prefix])) {
- $this->prefixesPsr0[$first][$prefix] = (array) $paths;
-
- return;
- }
- if ($prepend) {
- $this->prefixesPsr0[$first][$prefix] = array_merge(
- (array) $paths,
- $this->prefixesPsr0[$first][$prefix]
- );
- } else {
- $this->prefixesPsr0[$first][$prefix] = array_merge(
- $this->prefixesPsr0[$first][$prefix],
- (array) $paths
- );
- }
- }
-
- /**
- * Registers a set of PSR-4 directories for a given namespace, either
- * appending or prepending to the ones previously set for this namespace.
- *
- * @param string $prefix The prefix/namespace, with trailing '\\'
- * @param array|string $paths The PSR-4 base directories
- * @param bool $prepend Whether to prepend the directories
- *
- * @throws \InvalidArgumentException
- */
- public function addPsr4($prefix, $paths, $prepend = false)
- {
- if (!$prefix) {
- // Register directories for the root namespace.
- if ($prepend) {
- $this->fallbackDirsPsr4 = array_merge(
- (array) $paths,
- $this->fallbackDirsPsr4
- );
- } else {
- $this->fallbackDirsPsr4 = array_merge(
- $this->fallbackDirsPsr4,
- (array) $paths
- );
- }
- } elseif (!isset($this->prefixDirsPsr4[$prefix])) {
- // Register directories for a new namespace.
- $length = strlen($prefix);
- if ('\\' !== $prefix[$length - 1]) {
- throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
- }
- $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
- $this->prefixDirsPsr4[$prefix] = (array) $paths;
- } elseif ($prepend) {
- // Prepend directories for an already registered namespace.
- $this->prefixDirsPsr4[$prefix] = array_merge(
- (array) $paths,
- $this->prefixDirsPsr4[$prefix]
- );
- } else {
- // Append directories for an already registered namespace.
- $this->prefixDirsPsr4[$prefix] = array_merge(
- $this->prefixDirsPsr4[$prefix],
- (array) $paths
- );
- }
- }
-
- /**
- * Registers a set of PSR-0 directories for a given prefix,
- * replacing any others previously set for this prefix.
- *
- * @param string $prefix The prefix
- * @param array|string $paths The PSR-0 base directories
- */
- public function set($prefix, $paths)
- {
- if (!$prefix) {
- $this->fallbackDirsPsr0 = (array) $paths;
- } else {
- $this->prefixesPsr0[$prefix[0]][$prefix] = (array) $paths;
- }
- }
-
- /**
- * Registers a set of PSR-4 directories for a given namespace,
- * replacing any others previously set for this namespace.
- *
- * @param string $prefix The prefix/namespace, with trailing '\\'
- * @param array|string $paths The PSR-4 base directories
- *
- * @throws \InvalidArgumentException
- */
- public function setPsr4($prefix, $paths)
- {
- if (!$prefix) {
- $this->fallbackDirsPsr4 = (array) $paths;
- } else {
- $length = strlen($prefix);
- if ('\\' !== $prefix[$length - 1]) {
- throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
- }
- $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
- $this->prefixDirsPsr4[$prefix] = (array) $paths;
- }
- }
-
- /**
- * Turns on searching the include path for class files.
- *
- * @param bool $useIncludePath
- */
- public function setUseIncludePath($useIncludePath)
- {
- $this->useIncludePath = $useIncludePath;
- }
-
- /**
- * Can be used to check if the autoloader uses the include path to check
- * for classes.
- *
- * @return bool
- */
- public function getUseIncludePath()
- {
- return $this->useIncludePath;
- }
-
- /**
- * Turns off searching the prefix and fallback directories for classes
- * that have not been registered with the class map.
- *
- * @param bool $classMapAuthoritative
- */
- public function setClassMapAuthoritative($classMapAuthoritative)
- {
- $this->classMapAuthoritative = $classMapAuthoritative;
- }
-
- /**
- * Should class lookup fail if not found in the current class map?
- *
- * @return bool
- */
- public function isClassMapAuthoritative()
- {
- return $this->classMapAuthoritative;
- }
-
- /**
- * APCu prefix to use to cache found/not-found classes, if the extension is enabled.
- *
- * @param string|null $apcuPrefix
- */
- public function setApcuPrefix($apcuPrefix)
- {
- $this->apcuPrefix = function_exists('apcu_fetch') && filter_var(ini_get('apc.enabled'), FILTER_VALIDATE_BOOLEAN) ? $apcuPrefix : null;
- }
-
- /**
- * The APCu prefix in use, or null if APCu caching is not enabled.
- *
- * @return string|null
- */
- public function getApcuPrefix()
- {
- return $this->apcuPrefix;
- }
-
- /**
- * Registers this instance as an autoloader.
- *
- * @param bool $prepend Whether to prepend the autoloader or not
- */
- public function register($prepend = false)
- {
- spl_autoload_register(array($this, 'loadClass'), true, $prepend);
- }
-
- /**
- * Unregisters this instance as an autoloader.
- */
- public function unregister()
- {
- spl_autoload_unregister(array($this, 'loadClass'));
- }
-
- /**
- * Loads the given class or interface.
- *
- * @param string $class The name of the class
- * @return bool|null True if loaded, null otherwise
- */
- public function loadClass($class)
- {
- if ($file = $this->findFile($class)) {
- includeFile($file);
-
- return true;
- }
- }
-
- /**
- * Finds the path to the file where the class is defined.
- *
- * @param string $class The name of the class
- *
- * @return string|false The path if found, false otherwise
- */
- public function findFile($class)
- {
- // class map lookup
- if (isset($this->classMap[$class])) {
- return $this->classMap[$class];
- }
- if ($this->classMapAuthoritative || isset($this->missingClasses[$class])) {
- return false;
- }
- if (null !== $this->apcuPrefix) {
- $file = apcu_fetch($this->apcuPrefix.$class, $hit);
- if ($hit) {
- return $file;
- }
- }
-
- $file = $this->findFileWithExtension($class, '.php');
-
- // Search for Hack files if we are running on HHVM
- if (false === $file && defined('HHVM_VERSION')) {
- $file = $this->findFileWithExtension($class, '.hh');
- }
-
- if (null !== $this->apcuPrefix) {
- apcu_add($this->apcuPrefix.$class, $file);
- }
-
- if (false === $file) {
- // Remember that this class does not exist.
- $this->missingClasses[$class] = true;
- }
-
- return $file;
- }
-
- private function findFileWithExtension($class, $ext)
- {
- // PSR-4 lookup
- $logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext;
-
- $first = $class[0];
- if (isset($this->prefixLengthsPsr4[$first])) {
- $subPath = $class;
- while (false !== $lastPos = strrpos($subPath, '\\')) {
- $subPath = substr($subPath, 0, $lastPos);
- $search = $subPath . '\\';
- if (isset($this->prefixDirsPsr4[$search])) {
- $pathEnd = DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $lastPos + 1);
- foreach ($this->prefixDirsPsr4[$search] as $dir) {
- if (file_exists($file = $dir . $pathEnd)) {
- return $file;
- }
- }
- }
- }
- }
-
- // PSR-4 fallback dirs
- foreach ($this->fallbackDirsPsr4 as $dir) {
- if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) {
- return $file;
- }
- }
-
- // PSR-0 lookup
- if (false !== $pos = strrpos($class, '\\')) {
- // namespaced class name
- $logicalPathPsr0 = substr($logicalPathPsr4, 0, $pos + 1)
- . strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR);
- } else {
- // PEAR-like class name
- $logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . $ext;
- }
-
- if (isset($this->prefixesPsr0[$first])) {
- foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) {
- if (0 === strpos($class, $prefix)) {
- foreach ($dirs as $dir) {
- if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
- return $file;
- }
- }
- }
- }
- }
-
- // PSR-0 fallback dirs
- foreach ($this->fallbackDirsPsr0 as $dir) {
- if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
- return $file;
- }
- }
-
- // PSR-0 include paths.
- if ($this->useIncludePath && $file = stream_resolve_include_path($logicalPathPsr0)) {
- return $file;
- }
-
- return false;
- }
-}
-
-/**
- * Scope isolated include.
- *
- * Prevents access to $this/self from included files.
- */
-function includeFile($file)
-{
- include $file;
-}
diff --git a/modules/blockrss/vendor/composer/LICENSE b/modules/blockrss/vendor/composer/LICENSE
deleted file mode 100644
index f27399a04..000000000
--- a/modules/blockrss/vendor/composer/LICENSE
+++ /dev/null
@@ -1,21 +0,0 @@
-
-Copyright (c) Nils Adermann, Jordi Boggiano
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is furnished
-to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
-
diff --git a/modules/blockrss/vendor/composer/autoload_classmap.php b/modules/blockrss/vendor/composer/autoload_classmap.php
deleted file mode 100644
index 8b46d5171..000000000
--- a/modules/blockrss/vendor/composer/autoload_classmap.php
+++ /dev/null
@@ -1,10 +0,0 @@
- $vendorDir . '/pear/pear_exception/PEAR/Exception.php',
-);
diff --git a/modules/blockrss/vendor/composer/autoload_namespaces.php b/modules/blockrss/vendor/composer/autoload_namespaces.php
deleted file mode 100644
index f3dc5248f..000000000
--- a/modules/blockrss/vendor/composer/autoload_namespaces.php
+++ /dev/null
@@ -1,11 +0,0 @@
- array($vendorDir . '/pear/xml_feed_parser'),
- 'Log' => array($vendorDir . '/pear/log'),
-);
diff --git a/modules/blockrss/vendor/composer/autoload_psr4.php b/modules/blockrss/vendor/composer/autoload_psr4.php
deleted file mode 100644
index b265c64a2..000000000
--- a/modules/blockrss/vendor/composer/autoload_psr4.php
+++ /dev/null
@@ -1,9 +0,0 @@
-= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
- if ($useStaticLoader) {
- require_once __DIR__ . '/autoload_static.php';
-
- call_user_func(\Composer\Autoload\ComposerStaticInit573edf418ff486f71fdaa7e03e5841ca::getInitializer($loader));
- } else {
- $map = require __DIR__ . '/autoload_namespaces.php';
- foreach ($map as $namespace => $path) {
- $loader->set($namespace, $path);
- }
-
- $map = require __DIR__ . '/autoload_psr4.php';
- foreach ($map as $namespace => $path) {
- $loader->setPsr4($namespace, $path);
- }
-
- $classMap = require __DIR__ . '/autoload_classmap.php';
- if ($classMap) {
- $loader->addClassMap($classMap);
- }
- }
-
- $loader->register(true);
-
- return $loader;
- }
-}
diff --git a/modules/blockrss/vendor/composer/autoload_static.php b/modules/blockrss/vendor/composer/autoload_static.php
deleted file mode 100644
index d4f3a4a4d..000000000
--- a/modules/blockrss/vendor/composer/autoload_static.php
+++ /dev/null
@@ -1,38 +0,0 @@
-
- array (
- 'XML' =>
- array (
- 0 => __DIR__ . '/..' . '/pear/xml_feed_parser',
- ),
- ),
- 'L' =>
- array (
- 'Log' =>
- array (
- 0 => __DIR__ . '/..' . '/pear/log',
- ),
- ),
- );
-
- public static $classMap = array (
- 'PEAR_Exception' => __DIR__ . '/..' . '/pear/pear_exception/PEAR/Exception.php',
- );
-
- public static function getInitializer(ClassLoader $loader)
- {
- return \Closure::bind(function () use ($loader) {
- $loader->prefixesPsr0 = ComposerStaticInit573edf418ff486f71fdaa7e03e5841ca::$prefixesPsr0;
- $loader->classMap = ComposerStaticInit573edf418ff486f71fdaa7e03e5841ca::$classMap;
-
- }, null, ClassLoader::class);
- }
-}
diff --git a/modules/blockrss/vendor/composer/include_paths.php b/modules/blockrss/vendor/composer/include_paths.php
deleted file mode 100644
index abbc02ccf..000000000
--- a/modules/blockrss/vendor/composer/include_paths.php
+++ /dev/null
@@ -1,12 +0,0 @@
-5.2"
- },
- "require-dev": {
- "phpunit/phpunit": "*"
- },
- "suggest": {
- "pear/db": "Install optionally via your project's composer.json"
- },
- "time": "2021-05-04T23:51:30+00:00",
- "type": "library",
- "installation-source": "dist",
- "autoload": {
- "psr-0": {
- "Log": "./"
- },
- "exclude-from-classmap": [
- "/examples/"
- ]
- },
- "notification-url": "https://packagist.org/downloads/",
- "include-path": [
- ""
- ],
- "license": [
- "MIT"
- ],
- "authors": [
- {
- "name": "Jon Parise",
- "email": "jon@php.net",
- "homepage": "http://www.indelible.org",
- "role": "Developer"
- }
- ],
- "description": "PEAR Logging Framework",
- "homepage": "http://pear.github.io/Log/",
- "keywords": [
- "log",
- "logging"
- ]
- },
- {
- "name": "pear/pear_exception",
- "version": "v1.0.2",
- "version_normalized": "1.0.2.0",
- "source": {
- "type": "git",
- "url": "https://github.com/pear/PEAR_Exception.git",
- "reference": "b14fbe2ddb0b9f94f5b24cf08783d599f776fff0"
- },
- "dist": {
- "type": "zip",
- "url": "https://api.github.com/repos/pear/PEAR_Exception/zipball/b14fbe2ddb0b9f94f5b24cf08783d599f776fff0",
- "reference": "b14fbe2ddb0b9f94f5b24cf08783d599f776fff0",
- "shasum": ""
- },
- "require": {
- "php": ">=5.2.0"
- },
- "require-dev": {
- "phpunit/phpunit": "<9"
- },
- "time": "2021-03-21T15:43:46+00:00",
- "type": "class",
- "extra": {
- "branch-alias": {
- "dev-master": "1.0.x-dev"
- }
- },
- "installation-source": "dist",
- "autoload": {
- "classmap": [
- "PEAR/"
- ]
- },
- "notification-url": "https://packagist.org/downloads/",
- "include-path": [
- "."
- ],
- "license": [
- "BSD-2-Clause"
- ],
- "authors": [
- {
- "name": "Helgi Thormar",
- "email": "dufuz@php.net"
- },
- {
- "name": "Greg Beaver",
- "email": "cellog@php.net"
- }
- ],
- "description": "The PEAR Exception base class.",
- "homepage": "https://github.com/pear/PEAR_Exception",
- "keywords": [
- "exception"
- ]
- },
- {
- "name": "pear/xml_feed_parser",
- "version": "v1.0.5",
- "version_normalized": "1.0.5.0",
- "source": {
- "type": "git",
- "url": "https://github.com/pear/XML_Feed_Parser.git",
- "reference": "d8ad454742acba786738b39cbcc7c10f7b57adbe"
- },
- "dist": {
- "type": "zip",
- "url": "https://api.github.com/repos/pear/XML_Feed_Parser/zipball/d8ad454742acba786738b39cbcc7c10f7b57adbe",
- "reference": "d8ad454742acba786738b39cbcc7c10f7b57adbe",
- "shasum": ""
- },
- "require": {
- "pear/log": "*",
- "pear/pear_exception": "*"
- },
- "require-dev": {
- "phpunit/phpunit": "*"
- },
- "suggest": {
- "ext-tidy": "May require the tidy PHP extension"
- },
- "time": "2019-02-11T14:09:14+00:00",
- "type": "library",
- "installation-source": "dist",
- "autoload": {
- "psr-0": {
- "XML": "./"
- }
- },
- "notification-url": "https://packagist.org/downloads/",
- "include-path": [
- "./"
- ],
- "license": [
- "LGPL"
- ],
- "authors": [
- {
- "name": "James Stewart",
- "email": "james@jystewart.net",
- "role": "Lead"
- }
- ],
- "description": "More info available on: http://pear.php.net/package/XML_Feed_Parser"
- }
-]
diff --git a/modules/blockrss/vendor/pear/log/.github/workflows/ci.yml b/modules/blockrss/vendor/pear/log/.github/workflows/ci.yml
deleted file mode 100644
index 5c17cfef6..000000000
--- a/modules/blockrss/vendor/pear/log/.github/workflows/ci.yml
+++ /dev/null
@@ -1,29 +0,0 @@
----
-name: CI
-
-on:
- push:
- branches:
- - master
- pull_request:
- branches:
- - master
-
-jobs:
- test:
- runs-on: ubuntu-latest
- strategy:
- matrix:
- php-version: ['5.6', '7.0', '7.1', '7.2', '7.3', '7.4']
-
- steps:
- - uses: actions/checkout@v2
- - name: Set up PHP ${{ matrix.php-version }}
- uses: shivammathur/setup-php@v2
- with:
- php-version: ${{ matrix.php-version }}
- extensions: sqlite
- ini-values: include_path=.:/usr/share/php
- - name: Run tests
- run: |
- pear run-tests -d tests/
diff --git a/modules/blockrss/vendor/pear/log/.gitignore b/modules/blockrss/vendor/pear/log/.gitignore
deleted file mode 100644
index 1cb564d81..000000000
--- a/modules/blockrss/vendor/pear/log/.gitignore
+++ /dev/null
@@ -1,18 +0,0 @@
-
-# /
-/*.tgz
-
-# /docs/
-/docs/api
-
-# /tests/
-/tests/*.diff
-/tests/*.exp
-/tests/*.log
-/tests/*.out
-/tests/sqlite-log.db
-
-# composer related
-composer.lock
-composer.phar
-vendor
diff --git a/modules/blockrss/vendor/pear/log/LICENSE b/modules/blockrss/vendor/pear/log/LICENSE
deleted file mode 100644
index 18847aa36..000000000
--- a/modules/blockrss/vendor/pear/log/LICENSE
+++ /dev/null
@@ -1,19 +0,0 @@
-Copyright (c) 2001-2016 Jon Parise, Chuck Hagenbuch, and Jan Schneider.
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
diff --git a/modules/blockrss/vendor/pear/log/Log.php b/modules/blockrss/vendor/pear/log/Log.php
deleted file mode 100644
index b1c67a4da..000000000
--- a/modules/blockrss/vendor/pear/log/Log.php
+++ /dev/null
@@ -1,872 +0,0 @@
-
- * @author Jon Parise
- * @since Horde 1.3
- * @package Log
- */
-class Log
-{
- /**
- * Indicates whether or not the log can been opened / connected.
- *
- * @var boolean
- * @access protected
- */
- var $_opened = false;
-
- /**
- * Instance-specific unique identification number.
- *
- * @var integer
- * @access protected
- */
- var $_id = 0;
-
- /**
- * The label that uniquely identifies this set of log messages.
- *
- * @var string
- * @access protected
- */
- var $_ident = '';
-
- /**
- * The default priority to use when logging an event.
- *
- * @var integer
- * @access protected
- */
- var $_priority = PEAR_LOG_INFO;
-
- /**
- * The bitmask of allowed log levels.
- *
- * @var integer
- * @access protected
- */
- var $_mask = PEAR_LOG_ALL;
-
- /**
- * Holds all Log_observer objects that wish to be notified of new messages.
- *
- * @var array
- * @access protected
- */
- var $_listeners = array();
-
- /**
- * Starting depth to use when walking a backtrace in search of the
- * function that invoked the log system.
- *
- * @var integer
- * @access protected
- */
- var $_backtrace_depth = 0;
-
- /**
- * Maps canonical format keys to position arguments for use in building
- * "line format" strings.
- *
- * @var array
- * @access protected
- */
- var $_formatMap = array('%{timestamp}' => '%1$s',
- '%{ident}' => '%2$s',
- '%{priority}' => '%3$s',
- '%{message}' => '%4$s',
- '%{file}' => '%5$s',
- '%{line}' => '%6$s',
- '%{function}' => '%7$s',
- '%{class}' => '%8$s',
- '%\{' => '%%{');
-
- public function __construct()
- {
- }
-
- /**
- * Attempts to return a concrete Log instance of type $handler.
- *
- * @param string $handler The type of concrete Log subclass to return.
- * Attempt to dynamically include the code for
- * this subclass. Currently, valid values are
- * 'console', 'syslog', 'sql', 'file', and 'mcal'.
- *
- * @param string $name The name of the actually log file, table, or
- * other specific store to use. Defaults to an
- * empty string, with which the subclass will
- * attempt to do something intelligent.
- *
- * @param string $ident The identity reported to the log system.
- *
- * @param array $conf A hash containing any additional configuration
- * information that a subclass might need.
- *
- * @param int $level Log messages up to and including this level.
- *
- * @return object Log The newly created concrete Log instance, or
- * null on an error.
- * @access public
- * @since Log 1.0
- */
- public static function factory($handler, $name = '', $ident = '',
- $conf = array(), $level = PEAR_LOG_DEBUG)
- {
- $handler = strtolower($handler);
- $class = 'Log_' . $handler;
- $classfile = 'Log/' . $handler . '.php';
-
- /*
- * Attempt to include our version of the named class, but don't treat
- * a failure as fatal. The caller may have already included their own
- * version of the named class.
- */
- if (!class_exists($class, false)) {
- include_once $classfile;
- }
-
- /* If the class exists, return a new instance of it. */
- if (class_exists($class, false)) {
- $obj = new $class($name, $ident, $conf, $level);
- return $obj;
- }
-
- $null = null;
- return $null;
- }
-
- /**
- * Attempts to return a reference to a concrete Log instance of type
- * $handler, only creating a new instance if no log instance with the same
- * parameters currently exists.
- *
- * You should use this if there are multiple places you might create a
- * logger, you don't want to create multiple loggers, and you don't want to
- * check for the existance of one each time. The singleton pattern does all
- * the checking work for you.
- *
- * You MUST call this method with the $var = &Log::singleton() syntax.
- * Without the ampersand (&) in front of the method name, you will not get
- * a reference, you will get a copy.
- *
- * @param string $handler The type of concrete Log subclass to return.
- * Attempt to dynamically include the code for
- * this subclass. Currently, valid values are
- * 'console', 'syslog', 'sql', 'file', and 'mcal'.
- *
- * @param string $name The name of the actually log file, table, or
- * other specific store to use. Defaults to an
- * empty string, with which the subclass will
- * attempt to do something intelligent.
- *
- * @param string $ident The identity reported to the log system.
- *
- * @param array $conf A hash containing any additional configuration
- * information that a subclass might need.
- *
- * @param int $level Log messages up to and including this level.
- *
- * @return object Log The newly created concrete Log instance, or
- * null on an error.
- * @access public
- * @since Log 1.0
- */
- public static function singleton($handler, $name = '', $ident = '',
- $conf = array(), $level = PEAR_LOG_DEBUG)
- {
- static $instances;
- if (!isset($instances)) $instances = array();
-
- $signature = serialize(array($handler, $name, $ident, $conf, $level));
- if (!isset($instances[$signature])) {
- $instances[$signature] = Log::factory($handler, $name, $ident,
- $conf, $level);
- }
-
- return $instances[$signature];
- }
-
- /**
- * Abstract implementation of the open() method.
- * @since Log 1.0
- */
- function open()
- {
- return false;
- }
-
- /**
- * Abstract implementation of the close() method.
- * @since Log 1.0
- */
- function close()
- {
- return false;
- }
-
- /**
- * Abstract implementation of the flush() method.
- * @since Log 1.8.2
- */
- function flush()
- {
- return false;
- }
-
- /**
- * Abstract implementation of the log() method.
- * @since Log 1.0
- */
- function log($message, $priority = null)
- {
- return false;
- }
-
- /**
- * A convenience function for logging a emergency event. It will log a
- * message at the PEAR_LOG_EMERG log level.
- *
- * @param mixed $message String or object containing the message
- * to log.
- *
- * @return boolean True if the message was successfully logged.
- *
- * @access public
- * @since Log 1.7.0
- */
- function emerg($message)
- {
- return $this->log($message, PEAR_LOG_EMERG);
- }
-
- /**
- * A convenience function for logging an alert event. It will log a
- * message at the PEAR_LOG_ALERT log level.
- *
- * @param mixed $message String or object containing the message
- * to log.
- *
- * @return boolean True if the message was successfully logged.
- *
- * @access public
- * @since Log 1.7.0
- */
- function alert($message)
- {
- return $this->log($message, PEAR_LOG_ALERT);
- }
-
- /**
- * A convenience function for logging a critical event. It will log a
- * message at the PEAR_LOG_CRIT log level.
- *
- * @param mixed $message String or object containing the message
- * to log.
- *
- * @return boolean True if the message was successfully logged.
- *
- * @access public
- * @since Log 1.7.0
- */
- function crit($message)
- {
- return $this->log($message, PEAR_LOG_CRIT);
- }
-
- /**
- * A convenience function for logging a error event. It will log a
- * message at the PEAR_LOG_ERR log level.
- *
- * @param mixed $message String or object containing the message
- * to log.
- *
- * @return boolean True if the message was successfully logged.
- *
- * @access public
- * @since Log 1.7.0
- */
- function err($message)
- {
- return $this->log($message, PEAR_LOG_ERR);
- }
-
- /**
- * A convenience function for logging a warning event. It will log a
- * message at the PEAR_LOG_WARNING log level.
- *
- * @param mixed $message String or object containing the message
- * to log.
- *
- * @return boolean True if the message was successfully logged.
- *
- * @access public
- * @since Log 1.7.0
- */
- function warning($message)
- {
- return $this->log($message, PEAR_LOG_WARNING);
- }
-
- /**
- * A convenience function for logging a notice event. It will log a
- * message at the PEAR_LOG_NOTICE log level.
- *
- * @param mixed $message String or object containing the message
- * to log.
- *
- * @return boolean True if the message was successfully logged.
- *
- * @access public
- * @since Log 1.7.0
- */
- function notice($message)
- {
- return $this->log($message, PEAR_LOG_NOTICE);
- }
-
- /**
- * A convenience function for logging a information event. It will log a
- * message at the PEAR_LOG_INFO log level.
- *
- * @param mixed $message String or object containing the message
- * to log.
- *
- * @return boolean True if the message was successfully logged.
- *
- * @access public
- * @since Log 1.7.0
- */
- function info($message)
- {
- return $this->log($message, PEAR_LOG_INFO);
- }
-
- /**
- * A convenience function for logging a debug event. It will log a
- * message at the PEAR_LOG_DEBUG log level.
- *
- * @param mixed $message String or object containing the message
- * to log.
- *
- * @return boolean True if the message was successfully logged.
- *
- * @access public
- * @since Log 1.7.0
- */
- function debug($message)
- {
- return $this->log($message, PEAR_LOG_DEBUG);
- }
-
- /**
- * Returns the string representation of the message data.
- *
- * If $message is an object, _extractMessage() will attempt to extract
- * the message text using a known method (such as a PEAR_Error object's
- * getMessage() method). If a known method, cannot be found, the
- * serialized representation of the object will be returned.
- *
- * If the message data is already a string, it will be returned unchanged.
- *
- * @param mixed $message The original message data. This may be a
- * string or any object.
- *
- * @return string The string representation of the message.
- *
- * @access protected
- */
- function _extractMessage($message)
- {
- /*
- * If we've been given an object, attempt to extract the message using
- * a known method. If we can't find such a method, default to the
- * "human-readable" version of the object.
- *
- * We also use the human-readable format for arrays.
- */
- if (is_object($message)) {
- if (method_exists($message, 'getmessage')) {
- $message = $message->getMessage();
- } else if (method_exists($message, 'tostring')) {
- $message = $message->toString();
- } else if (method_exists($message, '__tostring')) {
- $message = (string)$message;
- } else {
- $message = var_export($message, true);
- }
- } else if (is_array($message)) {
- if (isset($message['message'])) {
- if (is_scalar($message['message'])) {
- $message = $message['message'];
- } else {
- $message = var_export($message['message'], true);
- }
- } else {
- $message = var_export($message, true);
- }
- } else if (is_bool($message) || $message === NULL) {
- $message = var_export($message, true);
- }
-
- /* Otherwise, we assume the message is a string. */
- return $message;
- }
-
- /**
- * Using debug_backtrace(), returns the file, line, and enclosing function
- * name of the source code context from which log() was invoked.
- *
- * @param int $depth The initial number of frames we should step
- * back into the trace.
- *
- * @return array Array containing four strings: the filename, the line,
- * the function name, and the class name from which log()
- * was called.
- *
- * @access private
- * @since Log 1.9.4
- */
- function _getBacktraceVars($depth)
- {
- /* Start by generating a backtrace from the current call (here). */
- $bt = debug_backtrace();
-
- /* Store some handy shortcuts to our previous frames. */
- $bt0 = isset($bt[$depth]) ? $bt[$depth] : null;
- $bt1 = isset($bt[$depth + 1]) ? $bt[$depth + 1] : null;
-
- /*
- * If we were ultimately invoked by the composite handler, we need to
- * increase our depth one additional level to compensate.
- */
- $class = isset($bt1['class']) ? $bt1['class'] : null;
- if ($class !== null && strcasecmp($class, 'Log_composite') == 0) {
- $depth++;
- $bt0 = isset($bt[$depth]) ? $bt[$depth] : null;
- $bt1 = isset($bt[$depth + 1]) ? $bt[$depth + 1] : null;
- $class = isset($bt1['class']) ? $bt1['class'] : null;
- }
-
- /*
- * We're interested in the frame which invoked the log() function, so
- * we need to walk back some number of frames into the backtrace. The
- * $depth parameter tells us where to start looking. We go one step
- * further back to find the name of the encapsulating function from
- * which log() was called.
- */
- $file = isset($bt0) ? $bt0['file'] : null;
- $line = isset($bt0) ? $bt0['line'] : 0;
- $func = isset($bt1) ? $bt1['function'] : null;
-
- /*
- * However, if log() was called from one of our "shortcut" functions,
- * we're going to need to go back an additional step.
- */
- if (in_array($func, array('emerg', 'alert', 'crit', 'err', 'warning',
- 'notice', 'info', 'debug'))) {
- $bt2 = isset($bt[$depth + 2]) ? $bt[$depth + 2] : null;
-
- $file = is_array($bt1) ? $bt1['file'] : null;
- $line = is_array($bt1) ? $bt1['line'] : 0;
- $func = is_array($bt2) ? $bt2['function'] : null;
- $class = isset($bt2['class']) ? $bt2['class'] : null;
- }
-
- /*
- * If we couldn't extract a function name (perhaps because we were
- * executed from the "main" context), provide a default value.
- */
- if ($func === null) {
- $func = '(none)';
- }
-
- /* Return a 4-tuple containing (file, line, function, class). */
- return array($file, $line, $func, $class);
- }
-
- /**
- * Sets the starting depth to use when walking a backtrace in search of
- * the function that invoked the log system. This is used on conjunction
- * with the 'file', 'line', 'function', and 'class' formatters.
- *
- * @param int $depth The new backtrace depth.
- *
- * @access public
- * @since Log 1.12.7
- */
- public function setBacktraceDepth($depth)
- {
- $this->_backtrace_depth = $depth;
- }
-
- /**
- * Produces a formatted log line based on a format string and a set of
- * variables representing the current log record and state.
- *
- * @return string Formatted log string.
- *
- * @access protected
- * @since Log 1.9.4
- */
- function _format($format, $timestamp, $priority, $message)
- {
- /*
- * If the format string references any of the backtrace-driven
- * variables (%5 %6,%7,%8), generate the backtrace and fetch them.
- */
- if (preg_match('/%[5678]/', $format)) {
- /* Plus 2 to account for our internal function calls. */
- $d = $this->_backtrace_depth + 2;
- list($file, $line, $func, $class) = $this->_getBacktraceVars($d);
- }
-
- /*
- * Build the formatted string. We use the sprintf() function's
- * "argument swapping" capability to dynamically select and position
- * the variables which will ultimately appear in the log string.
- */
- return sprintf($format,
- $timestamp,
- $this->_ident,
- $this->priorityToString($priority),
- $message,
- isset($file) ? $file : '',
- isset($line) ? $line : '',
- isset($func) ? $func : '',
- isset($class) ? $class : '');
- }
-
- /**
- * Returns the string representation of a PEAR_LOG_* integer constant.
- *
- * @param int $priority A PEAR_LOG_* integer constant.
- *
- * @return string The string representation of $level.
- *
- * @access public
- * @since Log 1.0
- */
- function priorityToString($priority)
- {
- $levels = array(
- PEAR_LOG_EMERG => 'emergency',
- PEAR_LOG_ALERT => 'alert',
- PEAR_LOG_CRIT => 'critical',
- PEAR_LOG_ERR => 'error',
- PEAR_LOG_WARNING => 'warning',
- PEAR_LOG_NOTICE => 'notice',
- PEAR_LOG_INFO => 'info',
- PEAR_LOG_DEBUG => 'debug'
- );
-
- return $levels[$priority];
- }
-
- /**
- * Returns the the PEAR_LOG_* integer constant for the given string
- * representation of a priority name. This function performs a
- * case-insensitive search.
- *
- * @param string $name String containing a priority name.
- *
- * @return string The PEAR_LOG_* integer contstant corresponding
- * the the specified priority name.
- *
- * @access public
- * @since Log 1.9.0
- */
- function stringToPriority($name)
- {
- $levels = array(
- 'emergency' => PEAR_LOG_EMERG,
- 'alert' => PEAR_LOG_ALERT,
- 'critical' => PEAR_LOG_CRIT,
- 'error' => PEAR_LOG_ERR,
- 'warning' => PEAR_LOG_WARNING,
- 'notice' => PEAR_LOG_NOTICE,
- 'info' => PEAR_LOG_INFO,
- 'debug' => PEAR_LOG_DEBUG
- );
-
- return $levels[strtolower($name)];
- }
-
- /**
- * Calculate the log mask for the given priority.
- *
- * This method may be called statically.
- *
- * @param integer $priority The priority whose mask will be calculated.
- *
- * @return integer The calculated log mask.
- *
- * @access public
- * @since Log 1.7.0
- */
- public static function MASK($priority)
- {
- return (1 << $priority);
- }
-
- /**
- * Calculate the log mask for all priorities up to the given priority.
- *
- * This method may be called statically.
- *
- * @param integer $priority The maximum priority covered by this mask.
- *
- * @return integer The resulting log mask.
- *
- * @access public
- * @since Log 1.7.0
- *
- * @deprecated deprecated since Log 1.9.4; use Log::MAX() instead
- */
- public static function UPTO($priority)
- {
- return Log::MAX($priority);
- }
-
- /**
- * Calculate the log mask for all priorities greater than or equal to the
- * given priority. In other words, $priority will be the lowest priority
- * matched by the resulting mask.
- *
- * This method may be called statically.
- *
- * @param integer $priority The minimum priority covered by this mask.
- *
- * @return integer The resulting log mask.
- *
- * @access public
- * @since Log 1.9.4
- */
- public static function MIN($priority)
- {
- return PEAR_LOG_ALL ^ ((1 << $priority) - 1);
- }
-
- /**
- * Calculate the log mask for all priorities less than or equal to the
- * given priority. In other words, $priority will be the highests priority
- * matched by the resulting mask.
- *
- * This method may be called statically.
- *
- * @param integer $priority The maximum priority covered by this mask.
- *
- * @return integer The resulting log mask.
- *
- * @access public
- * @since Log 1.9.4
- */
- public static function MAX($priority)
- {
- return ((1 << ($priority + 1)) - 1);
- }
-
- /**
- * Set and return the level mask for the current Log instance.
- *
- * @param integer $mask A bitwise mask of log levels.
- *
- * @return integer The current level mask.
- *
- * @access public
- * @since Log 1.7.0
- */
- function setMask($mask)
- {
- $this->_mask = $mask;
-
- return $this->_mask;
- }
-
- /**
- * Returns the current level mask.
- *
- * @return integer The current level mask.
- *
- * @access public
- * @since Log 1.7.0
- */
- function getMask()
- {
- return $this->_mask;
- }
-
- /**
- * Check if the given priority is included in the current level mask.
- *
- * @param integer $priority The priority to check.
- *
- * @return boolean True if the given priority is included in the current
- * log mask.
- *
- * @access protected
- * @since Log 1.7.0
- */
- function _isMasked($priority)
- {
- return (Log::MASK($priority) & $this->_mask);
- }
-
- /**
- * Returns the current default priority.
- *
- * @return integer The current default priority.
- *
- * @access public
- * @since Log 1.8.4
- */
- function getPriority()
- {
- return $this->_priority;
- }
-
- /**
- * Sets the default priority to the specified value.
- *
- * @param integer $priority The new default priority.
- *
- * @access public
- * @since Log 1.8.4
- */
- function setPriority($priority)
- {
- $this->_priority = $priority;
- }
-
- /**
- * Adds a Log_observer instance to the list of observers that are listening
- * for messages emitted by this Log instance.
- *
- * @param object $observer The Log_observer instance to attach as a
- * listener.
- *
- * @return boolean True if the observer is successfully attached.
- *
- * @access public
- * @since Log 1.0
- */
- function attach(&$observer)
- {
- if (!is_a($observer, 'Log_observer')) {
- return false;
- }
-
- $this->_listeners[$observer->_id] = &$observer;
-
- return true;
- }
-
- /**
- * Removes a Log_observer instance from the list of observers.
- *
- * @param object $observer The Log_observer instance to detach from
- * the list of listeners.
- *
- * @return boolean True if the observer is successfully detached.
- *
- * @access public
- * @since Log 1.0
- */
- function detach($observer)
- {
- if (!is_a($observer, 'Log_observer') ||
- !isset($this->_listeners[$observer->_id])) {
- return false;
- }
-
- unset($this->_listeners[$observer->_id]);
-
- return true;
- }
-
- /**
- * Informs each registered observer instance that a new message has been
- * logged.
- *
- * @param array $event A hash describing the log event.
- *
- * @access protected
- */
- function _announce($event)
- {
- foreach ($this->_listeners as $id => $listener) {
- if ($event['priority'] <= $this->_listeners[$id]->_priority) {
- $this->_listeners[$id]->notify($event);
- }
- }
- }
-
- /**
- * Indicates whether this is a composite class.
- *
- * @return boolean True if this is a composite class.
- *
- * @access public
- * @since Log 1.0
- */
- function isComposite()
- {
- return false;
- }
-
- /**
- * Sets this Log instance's identification string.
- *
- * @param string $ident The new identification string.
- *
- * @access public
- * @since Log 1.6.3
- */
- function setIdent($ident)
- {
- $this->_ident = $ident;
- }
-
- /**
- * Returns the current identification string.
- *
- * @return string The current Log instance's identification string.
- *
- * @access public
- * @since Log 1.6.3
- */
- function getIdent()
- {
- return $this->_ident;
- }
-}
diff --git a/modules/blockrss/vendor/pear/log/Log/composite.php b/modules/blockrss/vendor/pear/log/Log/composite.php
deleted file mode 100644
index 41fcd943a..000000000
--- a/modules/blockrss/vendor/pear/log/Log/composite.php
+++ /dev/null
@@ -1,274 +0,0 @@
-
- * @author Jon Parise
- *
- * @since Horde 1.3
- * @since Log 1.0
- * @package Log
- *
- * @example composite.php Using the composite handler.
- */
-class Log_composite extends Log
-{
- /**
- * Array holding all of the Log instances to which log events should be
- * sent.
- *
- * @var array
- * @access private
- */
- var $_children = array();
-
-
- /**
- * Constructs a new composite Log object.
- *
- * @param string $name This parameter is ignored.
- * @param string $ident This parameter is ignored.
- * @param array $conf This parameter is ignored.
- * @param int $level This parameter is ignored.
- *
- * @access public
- */
- public function __construct($name, $ident = '', $conf = array(),
- $level = PEAR_LOG_DEBUG)
- {
- $this->_ident = $ident;
- }
-
- /**
- * Opens all of the child instances.
- *
- * @return True if all of the child instances were successfully opened.
- *
- * @access public
- */
- function open()
- {
- /* Attempt to open each of our children. */
- $this->_opened = true;
- foreach ($this->_children as $child) {
- $this->_opened &= $child->open();
- }
-
- /* If all children were opened, return success. */
- return $this->_opened;
- }
-
- /**
- * Closes all open child instances.
- *
- * @return True if all of the opened child instances were successfully
- * closed.
- *
- * @access public
- */
- function close()
- {
- /* If we haven't been opened, there's nothing more to do. */
- if (!$this->_opened) {
- return true;
- }
-
- /* Attempt to close each of our children. */
- $closed = true;
- foreach ($this->_children as $child) {
- if ($child->_opened) {
- $closed &= $child->close();
- }
- }
-
- /* Clear the opened state for consistency. */
- $this->_opened = false;
-
- /* If all children were closed, return success. */
- return $closed;
- }
-
- /**
- * Flushes all child instances. It is assumed that all of the children
- * have been successfully opened.
- *
- * @return True if all of the child instances were successfully flushed.
- *
- * @access public
- * @since Log 1.8.2
- */
- function flush()
- {
- /* Attempt to flush each of our children. */
- $flushed = true;
- foreach ($this->_children as $child) {
- $flushed &= $child->flush();
- }
-
- /* If all children were flushed, return success. */
- return $flushed;
- }
-
- /**
- * Sends $message and $priority to each child of this composite. If the
- * appropriate children aren't already open, they will be opened here.
- *
- * @param mixed $message String or object containing the message
- * to log.
- * @param string $priority (optional) The priority of the message.
- * Valid values are: PEAR_LOG_EMERG,
- * PEAR_LOG_ALERT, PEAR_LOG_CRIT,
- * PEAR_LOG_ERR, PEAR_LOG_WARNING,
- * PEAR_LOG_NOTICE, PEAR_LOG_INFO, and
- * PEAR_LOG_DEBUG.
- *
- * @return boolean True if the entry is successfully logged.
- *
- * @access public
- */
- function log($message, $priority = null)
- {
- /* If a priority hasn't been specified, use the default value. */
- if ($priority === null) {
- $priority = $this->_priority;
- }
-
- /*
- * Abort early if the priority is above the composite handler's
- * maximum logging level.
- *
- * XXX: Consider whether or not introducing this change would break
- * backwards compatibility. Some users may be expecting composite
- * handlers to pass on all events to their children regardless of
- * their own priority.
- */
- #if (!$this->_isMasked($priority)) {
- # return false;
- #}
-
- /*
- * Iterate over all of our children. If a unopened child will respond
- * to this log event, we attempt to open it immediately. The composite
- * handler's opened state will be enabled as soon as the first child
- * handler is successfully opened.
- *
- * We track an overall success state that indicates whether or not all
- * of the relevant child handlers were opened and successfully logged
- * the event. If one handler fails, we still attempt any remaining
- * children, but we consider the overall result a failure.
- */
- $success = true;
- foreach ($this->_children as $child) {
- /* If this child won't respond to this event, skip it. */
- if (!$child->_isMasked($priority)) {
- continue;
- }
-
- /* If this child has yet to be opened, attempt to do so now. */
- if (!$child->_opened) {
- $success &= $child->open();
-
- /*
- * If we've successfully opened our first handler, the
- * composite handler itself is considered to be opened.
- */
- if (!$this->_opened && $success) {
- $this->_opened = true;
- }
- }
-
- /* Finally, attempt to log the message to the child handler. */
- if ($child->_opened) {
- $success &= $child->log($message, $priority);
- }
- }
-
- /* Notify the observers. */
- $this->_announce(array('priority' => $priority, 'message' => $message));
-
- /* Return success if all of the open children logged the event. */
- return $success;
- }
-
- /**
- * Returns true if this is a composite.
- *
- * @return boolean True if this is a composite class.
- *
- * @access public
- */
- function isComposite()
- {
- return true;
- }
-
- /**
- * Sets this identification string for all of this composite's children.
- *
- * @param string $ident The new identification string.
- *
- * @access public
- * @since Log 1.6.7
- */
- function setIdent($ident)
- {
- /* Call our base class's setIdent() method. */
- parent::setIdent($ident);
-
- /* ... and then call setIdent() on all of our children. */
- foreach ($this->_children as $child) {
- $child->setIdent($ident);
- }
- }
-
- /**
- * Adds a Log instance to the list of children.
- *
- * @param object $child The Log instance to add.
- *
- * @return boolean True if the Log instance was successfully added.
- *
- * @access public
- */
- function addChild(&$child)
- {
- /* Make sure this is a Log instance. */
- if (!is_a($child, 'Log')) {
- return false;
- }
-
- $this->_children[$child->_id] = $child;
-
- return true;
- }
-
- /**
- * Removes a Log instance from the list of children.
- *
- * @param object $child The Log instance to remove.
- *
- * @return boolean True if the Log instance was successfully removed.
- *
- * @access public
- */
- function removeChild($child)
- {
- if (!is_a($child, 'Log') || !isset($this->_children[$child->_id])) {
- return false;
- }
-
- unset($this->_children[$child->_id]);
-
- return true;
- }
-
-}
diff --git a/modules/blockrss/vendor/pear/log/Log/console.php b/modules/blockrss/vendor/pear/log/Log/console.php
deleted file mode 100644
index 4b5ec85b4..000000000
--- a/modules/blockrss/vendor/pear/log/Log/console.php
+++ /dev/null
@@ -1,222 +0,0 @@
-
- * @since Log 1.1
- * @package Log
- *
- * @example console.php Using the console handler.
- */
-class Log_console extends Log
-{
- /**
- * Handle to the current output stream.
- * @var resource
- * @access private
- */
- var $_stream = null;
-
- /**
- * Is this object responsible for closing the stream resource?
- * @var bool
- * @access private
- */
- var $_closeResource = false;
-
- /**
- * Should the output be buffered or displayed immediately?
- * @var string
- * @access private
- */
- var $_buffering = false;
-
- /**
- * String holding the buffered output.
- * @var string
- * @access private
- */
- var $_buffer = '';
-
- /**
- * String containing the format of a log line.
- * @var string
- * @access private
- */
- var $_lineFormat = '%1$s %2$s [%3$s] %4$s';
-
- /**
- * String containing the timestamp format. It will be passed directly to
- * strftime(). Note that the timestamp string will generated using the
- * current locale.
- * @var string
- * @access private
- */
- var $_timeFormat = '%b %d %H:%M:%S';
-
- /**
- * Constructs a new Log_console object.
- *
- * @param string $name Ignored.
- * @param string $ident The identity string.
- * @param array $conf The configuration array.
- * @param int $level Log messages up to and including this level.
- * @access public
- */
- public function __construct($name, $ident = '', $conf = array(),
- $level = PEAR_LOG_DEBUG)
- {
- $this->_id = md5(microtime().rand());
- $this->_ident = $ident;
- $this->_mask = Log::UPTO($level);
-
- if (!empty($conf['stream'])) {
- $this->_stream = $conf['stream'];
- } elseif (defined('STDOUT')) {
- $this->_stream = STDOUT;
- } else {
- $this->_stream = fopen('php://output', 'a');
- $this->_closeResource = true;
- }
-
- if (isset($conf['buffering'])) {
- $this->_buffering = $conf['buffering'];
- }
-
- if (!empty($conf['lineFormat'])) {
- $this->_lineFormat = str_replace(array_keys($this->_formatMap),
- array_values($this->_formatMap),
- $conf['lineFormat']);
- }
-
- if (!empty($conf['timeFormat'])) {
- $this->_timeFormat = $conf['timeFormat'];
- }
-
- /*
- * If output buffering has been requested, we need to register a
- * shutdown function that will dump the buffer upon termination.
- */
- if ($this->_buffering) {
- register_shutdown_function(array(&$this, '_Log_console'));
- }
- }
-
- /**
- * Destructor
- */
- function _Log_console()
- {
- $this->close();
- }
-
- /**
- * Open the output stream.
- *
- * @access public
- * @since Log 1.9.7
- */
- function open()
- {
- $this->_opened = true;
- return true;
- }
-
- /**
- * Closes the output stream.
- *
- * This results in a call to flush().
- *
- * @access public
- * @since Log 1.9.0
- */
- function close()
- {
- $this->flush();
- $this->_opened = false;
- if ($this->_closeResource === true && is_resource($this->_stream)) {
- fclose($this->_stream);
- }
- return true;
- }
-
- /**
- * Flushes all pending ("buffered") data to the output stream.
- *
- * @access public
- * @since Log 1.8.2
- */
- function flush()
- {
- /*
- * If output buffering is enabled, dump the contents of the buffer to
- * the output stream.
- */
- if ($this->_buffering && (strlen($this->_buffer) > 0)) {
- fwrite($this->_stream, $this->_buffer);
- $this->_buffer = '';
- }
-
- if (is_resource($this->_stream)) {
- return fflush($this->_stream);
- }
-
- return false;
- }
-
- /**
- * Writes $message to the text console. Also, passes the message
- * along to any Log_observer instances that are observing this Log.
- *
- * @param mixed $message String or object containing the message to log.
- * @param string $priority The priority of the message. Valid
- * values are: PEAR_LOG_EMERG, PEAR_LOG_ALERT,
- * PEAR_LOG_CRIT, PEAR_LOG_ERR, PEAR_LOG_WARNING,
- * PEAR_LOG_NOTICE, PEAR_LOG_INFO, and PEAR_LOG_DEBUG.
- * @return boolean True on success or false on failure.
- * @access public
- */
- function log($message, $priority = null)
- {
- /* If a priority hasn't been specified, use the default value. */
- if ($priority === null) {
- $priority = $this->_priority;
- }
-
- /* Abort early if the priority is above the maximum logging level. */
- if (!$this->_isMasked($priority)) {
- return false;
- }
-
- /* Extract the string representation of the message. */
- $message = $this->_extractMessage($message);
-
- /* Build the string containing the complete log line. */
- $line = $this->_format($this->_lineFormat,
- strftime($this->_timeFormat),
- $priority, $message) . "\n";
-
- /*
- * If buffering is enabled, append this line to the output buffer.
- * Otherwise, print the line to the output stream immediately.
- */
- if ($this->_buffering) {
- $this->_buffer .= $line;
- } else {
- fwrite($this->_stream, $line);
- }
-
- /* Notify observers about this log message. */
- $this->_announce(array('priority' => $priority, 'message' => $message));
-
- return true;
- }
-}
diff --git a/modules/blockrss/vendor/pear/log/Log/daemon.php b/modules/blockrss/vendor/pear/log/Log/daemon.php
deleted file mode 100644
index 6a24d2bf8..000000000
--- a/modules/blockrss/vendor/pear/log/Log/daemon.php
+++ /dev/null
@@ -1,234 +0,0 @@
-
- * @version $Revision$
- * @package Log
- */
-class Log_daemon extends Log
-{
- /**
- * Integer holding the log facility to use.
- * @var string
- */
- var $_name = LOG_DAEMON;
-
- /**
- * Var holding the resource pointer to the socket
- * @var resource
- */
- var $_socket;
-
- /**
- * The ip address or servername
- * @see http://www.php.net/manual/en/transports.php
- * @var string
- */
- var $_ip = '127.0.0.1';
-
- /**
- * Protocol to use (tcp, udp, etc.)
- * @see http://www.php.net/manual/en/transports.php
- * @var string
- */
- var $_proto = 'udp';
-
- /**
- * Port to connect to
- * @var int
- */
- var $_port = 514;
-
- /**
- * Maximum message length in bytes
- * @var int
- */
- var $_maxsize = 4096;
-
- /**
- * Socket timeout in seconds
- * @var int
- */
- var $_timeout = 1;
-
- /**
- * Constructs a new syslog object.
- *
- * @param string $name The syslog facility.
- * @param string $ident The identity string.
- * @param array $conf The configuration array.
- * @param int $level Maximum level at which to log.
- * @access public
- */
- public function __construct($name, $ident = '', $conf = array(),
- $level = PEAR_LOG_DEBUG)
- {
- /* Ensure we have a valid integer value for $name. */
- if (empty($name) || !is_int($name)) {
- $name = LOG_SYSLOG;
- }
-
- $this->_id = md5(microtime().rand());
- $this->_name = $name;
- $this->_ident = $ident;
- $this->_mask = Log::UPTO($level);
-
- if (isset($conf['ip'])) {
- $this->_ip = $conf['ip'];
- }
- if (isset($conf['proto'])) {
- $this->_proto = $conf['proto'];
- }
- if (isset($conf['port'])) {
- $this->_port = $conf['port'];
- }
- if (isset($conf['maxsize'])) {
- $this->_maxsize = $conf['maxsize'];
- }
- if (isset($conf['timeout'])) {
- $this->_timeout = $conf['timeout'];
- }
- $this->_proto = $this->_proto . '://';
-
- register_shutdown_function(array(&$this, '_Log_daemon'));
- }
-
- /**
- * Destructor.
- *
- * @access private
- */
- function _Log_daemon()
- {
- $this->close();
- }
-
- /**
- * Opens a connection to the system logger, if it has not already
- * been opened. This is implicitly called by log(), if necessary.
- * @access public
- */
- function open()
- {
- if (!$this->_opened) {
- $this->_opened = (bool)($this->_socket = @fsockopen(
- $this->_proto . $this->_ip,
- $this->_port,
- $errno,
- $errstr,
- $this->_timeout));
- }
- return $this->_opened;
- }
-
- /**
- * Closes the connection to the system logger, if it is open.
- * @access public
- */
- function close()
- {
- if ($this->_opened) {
- $this->_opened = false;
- return fclose($this->_socket);
- }
- return true;
- }
-
- /**
- * Sends $message to the currently open syslog connection. Calls
- * open() if necessary. Also passes the message along to any Log_observer
- * instances that are observing this Log.
- *
- * @param string $message The textual message to be logged.
- * @param int $priority (optional) The priority of the message. Valid
- * values are: LOG_EMERG, LOG_ALERT, LOG_CRIT,
- * LOG_ERR, LOG_WARNING, LOG_NOTICE, LOG_INFO,
- * and LOG_DEBUG. The default is LOG_INFO.
- * @access public
- */
- function log($message, $priority = null)
- {
- /* If a priority hasn't been specified, use the default value. */
- if ($priority === null) {
- $priority = $this->_priority;
- }
-
- /* Abort early if the priority is above the maximum logging level. */
- if (!$this->_isMasked($priority)) {
- return false;
- }
-
- /* If the connection isn't open and can't be opened, return failure. */
- if (!$this->_opened && !$this->open()) {
- return false;
- }
-
- /* Extract the string representation of the message. */
- $message = $this->_extractMessage($message);
-
- /* Set the facility level. */
- $facility_level = intval($this->_name) +
- intval($this->_toSyslog($priority));
-
- /* Prepend ident info. */
- if (!empty($this->_ident)) {
- $message = $this->_ident . ' ' . $message;
- }
-
- /* Check for message length. */
- if (strlen($message) > $this->_maxsize) {
- $message = substr($message, 0, ($this->_maxsize) - 10) . ' [...]';
- }
-
- /* Write to socket. */
- fwrite($this->_socket, '<' . $facility_level . '>' . $message . "\n");
-
- $this->_announce(array('priority' => $priority, 'message' => $message));
- }
-
- /**
- * Converts a PEAR_LOG_* constant into a syslog LOG_* constant.
- *
- * This function exists because, under Windows, not all of the LOG_*
- * constants have unique values. Instead, the PEAR_LOG_* were introduced
- * for global use, with the conversion to the LOG_* constants kept local to
- * to the syslog driver.
- *
- * @param int $priority PEAR_LOG_* value to convert to LOG_* value.
- *
- * @return The LOG_* representation of $priority.
- *
- * @access private
- */
- function _toSyslog($priority)
- {
- static $priorities = array(
- PEAR_LOG_EMERG => LOG_EMERG,
- PEAR_LOG_ALERT => LOG_ALERT,
- PEAR_LOG_CRIT => LOG_CRIT,
- PEAR_LOG_ERR => LOG_ERR,
- PEAR_LOG_WARNING => LOG_WARNING,
- PEAR_LOG_NOTICE => LOG_NOTICE,
- PEAR_LOG_INFO => LOG_INFO,
- PEAR_LOG_DEBUG => LOG_DEBUG
- );
-
- /* If we're passed an unknown priority, default to LOG_INFO. */
- if (!is_int($priority) || !in_array($priority, $priorities)) {
- return LOG_INFO;
- }
-
- return $priorities[$priority];
- }
-
-}
diff --git a/modules/blockrss/vendor/pear/log/Log/display.php b/modules/blockrss/vendor/pear/log/Log/display.php
deleted file mode 100644
index 9711221ec..000000000
--- a/modules/blockrss/vendor/pear/log/Log/display.php
+++ /dev/null
@@ -1,181 +0,0 @@
-
- * @since Log 1.8.0
- * @package Log
- *
- * @example display.php Using the display handler.
- */
-class Log_display extends Log
-{
- /**
- * String containing the format of a log line.
- * @var string
- * @access private
- */
- var $_lineFormat = '%3$s: %4$s';
-
- /**
- * String containing the timestamp format. It will be passed directly to
- * strftime(). Note that the timestamp string will generated using the
- * current locale.
- * @var string
- * @access private
- */
- var $_timeFormat = '%b %d %H:%M:%S';
-
- /**
- * Flag indicating whether raw message text should be passed directly to
- * the log system. Otherwise, the text will be converted to an HTML-safe
- * representation.
- * @var boolean
- * @access private
- */
- var $_rawText = false;
-
- /**
- * Constructs a new Log_display object.
- *
- * @param string $name Ignored.
- * @param string $ident The identity string.
- * @param array $conf The configuration array.
- * @param int $level Log messages up to and including this level.
- * @access public
- */
- public function __construct($name = '', $ident = '', $conf = array(),
- $level = PEAR_LOG_DEBUG)
- {
- $this->_id = md5(microtime().rand());
- $this->_ident = $ident;
- $this->_mask = Log::UPTO($level);
-
- /* Start by configuring the line format. */
- if (!empty($conf['lineFormat'])) {
- $this->_lineFormat = str_replace(array_keys($this->_formatMap),
- array_values($this->_formatMap),
- $conf['lineFormat']);
- }
-
- /* We may need to prepend a string to our line format. */
- $prepend = null;
- if (isset($conf['error_prepend'])) {
- $prepend = $conf['error_prepend'];
- } else {
- $prepend = ini_get('error_prepend_string');
- }
- if (!empty($prepend)) {
- $this->_lineFormat = $prepend . $this->_lineFormat;
- }
-
- /* We may also need to append a string to our line format. */
- $append = null;
- if (isset($conf['error_append'])) {
- $append = $conf['error_append'];
- } else {
- $append = ini_get('error_append_string');
- }
- if (!empty($append)) {
- $this->_lineFormat .= $append;
- }
-
- /* Lastly, the line ending sequence is also configurable. */
- if (isset($conf['linebreak'])) {
- $this->_lineFormat .= $conf['linebreak'];
- } else {
- $this->_lineFormat .= " \n";
- }
-
- /* The user can also change the time format. */
- if (!empty($conf['timeFormat'])) {
- $this->_timeFormat = $conf['timeFormat'];
- }
-
- /* Message text conversion can be disabled. */
- if (isset($conf['rawText'])) {
- $this->_rawText = $conf['rawText'];
- }
- }
-
- /**
- * Opens the display handler.
- *
- * @access public
- * @since Log 1.9.6
- */
- function open()
- {
- $this->_opened = true;
- return true;
- }
-
- /**
- * Closes the display handler.
- *
- * @access public
- * @since Log 1.9.6
- */
- function close()
- {
- $this->_opened = false;
- return true;
- }
-
- /**
- * Writes $message to the text browser. Also, passes the message
- * along to any Log_observer instances that are observing this Log.
- *
- * @param mixed $message String or object containing the message to log.
- * @param string $priority The priority of the message. Valid
- * values are: PEAR_LOG_EMERG, PEAR_LOG_ALERT,
- * PEAR_LOG_CRIT, PEAR_LOG_ERR, PEAR_LOG_WARNING,
- * PEAR_LOG_NOTICE, PEAR_LOG_INFO, and PEAR_LOG_DEBUG.
- * @return boolean True on success or false on failure.
- * @access public
- */
- function log($message, $priority = null)
- {
- /* If a priority hasn't been specified, use the default value. */
- if ($priority === null) {
- $priority = $this->_priority;
- }
-
- /* Abort early if the priority is above the maximum logging level. */
- if (!$this->_isMasked($priority)) {
- return false;
- }
-
- /* Extract the string representation of the message. */
- $message = $this->_extractMessage($message);
-
- /* Convert the message to an HTML-friendly represention unless raw
- * text has been requested. */
- if ($this->_rawText === false) {
- $message = nl2br(htmlspecialchars($message));
- }
-
- /* Build and output the complete log line. */
- echo $this->_format($this->_lineFormat,
- strftime($this->_timeFormat),
- $priority,
- $message);
-
- /* Notify observers about this log message. */
- $this->_announce(array('priority' => $priority, 'message' => $message));
-
- return true;
- }
-
-}
diff --git a/modules/blockrss/vendor/pear/log/Log/error_log.php b/modules/blockrss/vendor/pear/log/Log/error_log.php
deleted file mode 100644
index 602d7cd3c..000000000
--- a/modules/blockrss/vendor/pear/log/Log/error_log.php
+++ /dev/null
@@ -1,160 +0,0 @@
-
- * @since Log 1.7.0
- * @package Log
- *
- * @example error_log.php Using the error_log handler.
- */
-class Log_error_log extends Log
-{
- /**
- * The error_log() log type.
- * @var integer
- * @access private
- */
- var $_type = PEAR_LOG_TYPE_SYSTEM;
-
- /**
- * The type-specific destination value.
- * @var string
- * @access private
- */
- var $_destination = '';
-
- /**
- * Additional headers to pass to the mail() function when the
- * PEAR_LOG_TYPE_MAIL type is used.
- * @var string
- * @access private
- */
- var $_extra_headers = '';
-
- /**
- * String containing the format of a log line.
- * @var string
- * @access private
- */
- var $_lineFormat = '%2$s: %4$s';
-
- /**
- * String containing the timestamp format. It will be passed directly to
- * strftime(). Note that the timestamp string will generated using the
- * current locale.
- * @var string
- * @access private
- */
- var $_timeFormat = '%b %d %H:%M:%S';
-
- /**
- * Constructs a new Log_error_log object.
- *
- * @param string $name One of the PEAR_LOG_TYPE_* constants.
- * @param string $ident The identity string.
- * @param array $conf The configuration array.
- * @param int $level Log messages up to and including this level.
- * @access public
- */
- public function __construct($name, $ident = '', $conf = array(),
- $level = PEAR_LOG_DEBUG)
- {
- $this->_id = md5(microtime().rand());
- $this->_type = $name;
- $this->_ident = $ident;
- $this->_mask = Log::UPTO($level);
-
- if (!empty($conf['destination'])) {
- $this->_destination = $conf['destination'];
- }
-
- if (!empty($conf['extra_headers'])) {
- $this->_extra_headers = $conf['extra_headers'];
- }
-
- if (!empty($conf['lineFormat'])) {
- $this->_lineFormat = str_replace(array_keys($this->_formatMap),
- array_values($this->_formatMap),
- $conf['lineFormat']);
- }
-
- if (!empty($conf['timeFormat'])) {
- $this->_timeFormat = $conf['timeFormat'];
- }
- }
-
- /**
- * Opens the handler.
- *
- * @access public
- * @since Log 1.9.6
- */
- function open()
- {
- $this->_opened = true;
- return true;
- }
-
- /**
- * Closes the handler.
- *
- * @access public
- * @since Log 1.9.6
- */
- function close()
- {
- $this->_opened = false;
- return true;
- }
-
- /**
- * Logs $message using PHP's error_log() function. The message is also
- * passed along to any Log_observer instances that are observing this Log.
- *
- * @param mixed $message String or object containing the message to log.
- * @param string $priority The priority of the message. Valid
- * values are: PEAR_LOG_EMERG, PEAR_LOG_ALERT,
- * PEAR_LOG_CRIT, PEAR_LOG_ERR, PEAR_LOG_WARNING,
- * PEAR_LOG_NOTICE, PEAR_LOG_INFO, and PEAR_LOG_DEBUG.
- * @return boolean True on success or false on failure.
- * @access public
- */
- function log($message, $priority = null)
- {
- /* If a priority hasn't been specified, use the default value. */
- if ($priority === null) {
- $priority = $this->_priority;
- }
-
- /* Abort early if the priority is above the maximum logging level. */
- if (!$this->_isMasked($priority)) {
- return false;
- }
-
- /* Extract the string representation of the message. */
- $message = $this->_extractMessage($message);
-
- /* Build the string containing the complete log line. */
- $line = $this->_format($this->_lineFormat,
- strftime($this->_timeFormat),
- $priority, $message);
-
- /* Pass the log line and parameters to the error_log() function. */
- $success = error_log($line, $this->_type, $this->_destination,
- $this->_extra_headers);
-
- $this->_announce(array('priority' => $priority, 'message' => $message));
-
- return $success;
- }
-
-}
diff --git a/modules/blockrss/vendor/pear/log/Log/file.php b/modules/blockrss/vendor/pear/log/Log/file.php
deleted file mode 100644
index 3cd5fec45..000000000
--- a/modules/blockrss/vendor/pear/log/Log/file.php
+++ /dev/null
@@ -1,316 +0,0 @@
-
- * @author Roman Neuhauser
- * @since Log 1.0
- * @package Log
- *
- * @example file.php Using the file handler.
- */
-class Log_file extends Log
-{
- /**
- * String containing the name of the log file.
- * @var string
- * @access private
- */
- var $_filename = 'php.log';
-
- /**
- * Handle to the log file.
- * @var resource
- * @access private
- */
- var $_fp = false;
-
- /**
- * Should new log entries be append to an existing log file, or should the
- * a new log file overwrite an existing one?
- * @var boolean
- * @access private
- */
- var $_append = true;
-
- /**
- * Should advisory file locking (i.e., flock()) be used?
- * @var boolean
- * @access private
- */
- var $_locking = false;
-
- /**
- * Integer (in octal) containing the log file's permissions mode.
- * @var integer
- * @access private
- */
- var $_mode = 0644;
-
- /**
- * Integer (in octal) specifying the file permission mode that will be
- * used when creating directories that do not already exist.
- * @var integer
- * @access private
- */
- var $_dirmode = 0755;
-
- /**
- * String containing the format of a log line.
- * @var string
- * @access private
- */
- var $_lineFormat = '%1$s %2$s [%3$s] %4$s';
-
- /**
- * String containing the timestamp format. It will be passed directly to
- * strftime(). Note that the timestamp string will generated using the
- * current locale.
- * @var string
- * @access private
- */
- var $_timeFormat = '%b %d %H:%M:%S';
-
- /**
- * String containing the end-on-line character sequence.
- * @var string
- * @access private
- */
- var $_eol = "\n";
-
- /**
- * Constructs a new Log_file object.
- *
- * @param string $name Ignored.
- * @param string $ident The identity string.
- * @param array $conf The configuration array.
- * @param int $level Log messages up to and including this level.
- * @access public
- */
- public function __construct($name, $ident = '', $conf = array(),
- $level = PEAR_LOG_DEBUG)
- {
- $this->_id = md5(microtime().rand());
- $this->_filename = $name;
- $this->_ident = $ident;
- $this->_mask = Log::UPTO($level);
-
- if (isset($conf['append'])) {
- $this->_append = $conf['append'];
- }
-
- if (isset($conf['locking'])) {
- $this->_locking = $conf['locking'];
- }
-
- if (!empty($conf['mode'])) {
- if (is_string($conf['mode'])) {
- $this->_mode = octdec($conf['mode']);
- } else {
- $this->_mode = $conf['mode'];
- }
- }
-
- if (!empty($conf['dirmode'])) {
- if (is_string($conf['dirmode'])) {
- $this->_dirmode = octdec($conf['dirmode']);
- } else {
- $this->_dirmode = $conf['dirmode'];
- }
- }
-
- if (!empty($conf['lineFormat'])) {
- $this->_lineFormat = str_replace(array_keys($this->_formatMap),
- array_values($this->_formatMap),
- $conf['lineFormat']);
- }
-
- if (!empty($conf['timeFormat'])) {
- $this->_timeFormat = $conf['timeFormat'];
- }
-
- if (!empty($conf['eol'])) {
- $this->_eol = $conf['eol'];
- } else {
- $this->_eol = (strstr(PHP_OS, 'WIN')) ? "\r\n" : "\n";
- }
-
- register_shutdown_function(array(&$this, '_Log_file'));
- }
-
- /**
- * Destructor
- */
- function _Log_file()
- {
- if ($this->_opened) {
- $this->close();
- }
- }
-
- /**
- * Creates the given directory path. If the parent directories don't
- * already exist, they will be created, too.
- *
- * This implementation is inspired by Python's os.makedirs function.
- *
- * @param string $path The full directory path to create.
- * @param integer $mode The permissions mode with which the
- * directories will be created.
- *
- * @return True if the full path is successfully created or already
- * exists.
- *
- * @access private
- */
- function _mkpath($path, $mode = 0700)
- {
- /* Separate the last pathname component from the rest of the path. */
- $head = dirname($path);
- $tail = basename($path);
-
- /* Make sure we've split the path into two complete components. */
- if (empty($tail)) {
- $head = dirname($path);
- $tail = basename($path);
- }
-
- /* Recurse up the path if our current segment does not exist. */
- if (!empty($head) && !empty($tail) && !is_dir($head)) {
- $this->_mkpath($head, $mode);
- }
-
- /* Create this segment of the path. */
- return @mkdir($head, $mode);
- }
-
- /**
- * Opens the log file for output. If the specified log file does not
- * already exist, it will be created. By default, new log entries are
- * appended to the end of the log file.
- *
- * This is implicitly called by log(), if necessary.
- *
- * @access public
- */
- function open()
- {
- if (!$this->_opened) {
- /* If the log file's directory doesn't exist, create it. */
- if (!is_dir(dirname($this->_filename))) {
- $this->_mkpath($this->_filename, $this->_dirmode);
- }
-
- /* Determine whether the log file needs to be created. */
- $creating = !file_exists($this->_filename);
-
- /* Obtain a handle to the log file. */
- $this->_fp = fopen($this->_filename, ($this->_append) ? 'a' : 'w');
-
- /* We consider the file "opened" if we have a valid file pointer. */
- $this->_opened = ($this->_fp !== false);
-
- /* Attempt to set the file's permissions if we just created it. */
- if ($creating && $this->_opened) {
- chmod($this->_filename, $this->_mode);
- }
- }
-
- return $this->_opened;
- }
-
- /**
- * Closes the log file if it is open.
- *
- * @access public
- */
- function close()
- {
- /* If the log file is open, close it. */
- if ($this->_opened && fclose($this->_fp)) {
- $this->_opened = false;
- }
-
- return ($this->_opened === false);
- }
-
- /**
- * Flushes all pending data to the file handle.
- *
- * @access public
- * @since Log 1.8.2
- */
- function flush()
- {
- if (is_resource($this->_fp)) {
- return fflush($this->_fp);
- }
-
- return false;
- }
-
- /**
- * Logs $message to the output window. The message is also passed along
- * to any Log_observer instances that are observing this Log.
- *
- * @param mixed $message String or object containing the message to log.
- * @param string $priority The priority of the message. Valid
- * values are: PEAR_LOG_EMERG, PEAR_LOG_ALERT,
- * PEAR_LOG_CRIT, PEAR_LOG_ERR, PEAR_LOG_WARNING,
- * PEAR_LOG_NOTICE, PEAR_LOG_INFO, and PEAR_LOG_DEBUG.
- * @return boolean True on success or false on failure.
- * @access public
- */
- function log($message, $priority = null)
- {
- /* If a priority hasn't been specified, use the default value. */
- if ($priority === null) {
- $priority = $this->_priority;
- }
-
- /* Abort early if the priority is above the maximum logging level. */
- if (!$this->_isMasked($priority)) {
- return false;
- }
-
- /* If the log file isn't already open, open it now. */
- if (!$this->_opened && !$this->open()) {
- return false;
- }
-
- /* Extract the string representation of the message. */
- $message = $this->_extractMessage($message);
-
- /* Build the string containing the complete log line. */
- $line = $this->_format($this->_lineFormat,
- strftime($this->_timeFormat),
- $priority, $message) . $this->_eol;
-
- /* If locking is enabled, acquire an exclusive lock on the file. */
- if ($this->_locking) {
- flock($this->_fp, LOCK_EX);
- }
-
- /* Write the log line to the log file. */
- $success = (fwrite($this->_fp, $line) !== false);
-
- /* Unlock the file now that we're finished writing to it. */
- if ($this->_locking) {
- flock($this->_fp, LOCK_UN);
- }
-
- /* Notify observers about this log message. */
- $this->_announce(array('priority' => $priority, 'message' => $message));
-
- return $success;
- }
-
-}
diff --git a/modules/blockrss/vendor/pear/log/Log/firebug.php b/modules/blockrss/vendor/pear/log/Log/firebug.php
deleted file mode 100644
index b30cdbd86..000000000
--- a/modules/blockrss/vendor/pear/log/Log/firebug.php
+++ /dev/null
@@ -1,207 +0,0 @@
-
- * @since Log 1.9.11
- * @package Log
- *
- * @example firebug.php Using the firebug handler.
- */
-class Log_firebug extends Log
-{
- /**
- * Should the output be buffered or displayed immediately?
- * @var string
- * @access private
- */
- var $_buffering = false;
-
- /**
- * String holding the buffered output.
- * @var string
- * @access private
- */
- var $_buffer = array();
-
- /**
- * String containing the format of a log line.
- * @var string
- * @access private
- */
- var $_lineFormat = '%2$s [%3$s] %4$s';
-
- /**
- * String containing the timestamp format. It will be passed directly to
- * strftime(). Note that the timestamp string will generated using the
- * current locale.
- *
- * Note! Default lineFormat of this driver does not display time.
- *
- * @var string
- * @access private
- */
- var $_timeFormat = '%b %d %H:%M:%S';
-
- /**
- * Mapping of log priorities to Firebug methods.
- * @var array
- * @access private
- */
- var $_methods = array(
- PEAR_LOG_EMERG => 'error',
- PEAR_LOG_ALERT => 'error',
- PEAR_LOG_CRIT => 'error',
- PEAR_LOG_ERR => 'error',
- PEAR_LOG_WARNING => 'warn',
- PEAR_LOG_NOTICE => 'info',
- PEAR_LOG_INFO => 'info',
- PEAR_LOG_DEBUG => 'debug'
- );
-
- /**
- * Constructs a new Log_firebug object.
- *
- * @param string $name Ignored.
- * @param string $ident The identity string.
- * @param array $conf The configuration array.
- * @param int $level Log messages up to and including this level.
- * @access public
- */
- public function __construct($name = '', $ident = 'PHP', $conf = array(),
- $level = PEAR_LOG_DEBUG)
- {
- $this->_id = md5(microtime().rand());
- $this->_ident = $ident;
- $this->_mask = Log::UPTO($level);
- if (isset($conf['buffering'])) {
- $this->_buffering = $conf['buffering'];
- }
-
- if ($this->_buffering) {
- register_shutdown_function(array(&$this, '_Log_firebug'));
- }
-
- if (!empty($conf['lineFormat'])) {
- $this->_lineFormat = str_replace(array_keys($this->_formatMap),
- array_values($this->_formatMap),
- $conf['lineFormat']);
- }
-
- if (!empty($conf['timeFormat'])) {
- $this->_timeFormat = $conf['timeFormat'];
- }
- }
-
- /**
- * Opens the firebug handler.
- *
- * @access public
- */
- function open()
- {
- $this->_opened = true;
- return true;
- }
-
- /**
- * Destructor
- */
- function _Log_firebug()
- {
- $this->close();
- }
-
- /**
- * Closes the firebug handler.
- *
- * @access public
- */
- function close()
- {
- $this->flush();
- $this->_opened = false;
- return true;
- }
-
- /**
- * Flushes all pending ("buffered") data.
- *
- * @access public
- */
- function flush() {
- if (count($this->_buffer)) {
- print '\n";
- };
- $this->_buffer = array();
- }
-
- /**
- * Writes $message to Firebug console. Also, passes the message
- * along to any Log_observer instances that are observing this Log.
- *
- * @param mixed $message String or object containing the message to log.
- * @param string $priority The priority of the message. Valid
- * values are: PEAR_LOG_EMERG, PEAR_LOG_ALERT,
- * PEAR_LOG_CRIT, PEAR_LOG_ERR, PEAR_LOG_WARNING,
- * PEAR_LOG_NOTICE, PEAR_LOG_INFO, and PEAR_LOG_DEBUG.
- * @return boolean True on success or false on failure.
- * @access public
- */
- function log($message, $priority = null)
- {
- /* If a priority hasn't been specified, use the default value. */
- if ($priority === null) {
- $priority = $this->_priority;
- }
-
- /* Abort early if the priority is above the maximum logging level. */
- if (!$this->_isMasked($priority)) {
- return false;
- }
-
- /* Extract the string representation of the message. */
- $message = $this->_extractMessage($message);
- $method = $this->_methods[$priority];
-
- /* normalize line breaks and escape quotes*/
- $message = preg_replace("/\r?\n/", "\\n", addslashes($message));
-
- /* Build the string containing the complete log line. */
- $line = $this->_format($this->_lineFormat,
- strftime($this->_timeFormat),
- $priority,
- $message);
-
- if ($this->_buffering) {
- $this->_buffer[] = sprintf('console.%s("%s");', $method, $line);
- } else {
- print '\n";
- }
- /* Notify observers about this log message. */
- $this->_announce(array('priority' => $priority, 'message' => $message));
-
- return true;
- }
-}
diff --git a/modules/blockrss/vendor/pear/log/Log/mail.php b/modules/blockrss/vendor/pear/log/Log/mail.php
deleted file mode 100644
index 5c079ee83..000000000
--- a/modules/blockrss/vendor/pear/log/Log/mail.php
+++ /dev/null
@@ -1,294 +0,0 @@
-
- * @author Jon Parise
- * @since Log 1.3
- * @package Log
- *
- * @example mail.php Using the mail handler.
- */
-class Log_mail extends Log
-{
- /**
- * String holding the recipients' email addresses. Multiple addresses
- * should be separated with commas.
- * @var string
- * @access private
- */
- var $_recipients = '';
-
- /**
- * String holding the sender's email address.
- * @var string
- * @access private
- */
- var $_from = '';
-
- /**
- * String holding the email's subject.
- * @var string
- * @access private
- */
- var $_subject = '[Log_mail] Log message';
-
- /**
- * String holding an optional preamble for the log messages.
- * @var string
- * @access private
- */
- var $_preamble = '';
-
- /**
- * String containing the format of a log line.
- * @var string
- * @access private
- */
- var $_lineFormat = '%1$s %2$s [%3$s] %4$s';
-
- /**
- * String containing the timestamp format. It will be passed directly to
- * strftime(). Note that the timestamp string will generated using the
- * current locale.
- * @var string
- * @access private
- */
- var $_timeFormat = '%b %d %H:%M:%S';
-
- /**
- * String holding the mail message body.
- * @var string
- * @access private
- */
- var $_message = '';
-
- /**
- * Flag used to indicated that log lines have been written to the message
- * body and the message should be sent on close().
- * @var boolean
- * @access private
- */
- var $_shouldSend = false;
-
- /**
- * String holding the backend name of PEAR::Mail
- * @var string
- * @access private
- */
- var $_mailBackend = '';
-
- /**
- * Array holding the params for PEAR::Mail
- * @var array
- * @access private
- */
- var $_mailParams = array();
-
- /**
- * Constructs a new Log_mail object.
- *
- * Here is how you can customize the mail driver with the conf[] hash :
- * $conf['from']: the mail's "From" header line,
- * $conf['subject']: the mail's "Subject" line.
- * $conf['mailBackend']: backend name of PEAR::Mail
- * $conf['mailParams']: parameters for the PEAR::Mail backend
- *
- * @param string $name The message's recipients.
- * @param string $ident The identity string.
- * @param array $conf The configuration array.
- * @param int $level Log messages up to and including this level.
- * @access public
- */
- public function __construct($name, $ident = '', $conf = array(),
- $level = PEAR_LOG_DEBUG)
- {
- $this->_id = md5(microtime().rand());
- $this->_recipients = $name;
- $this->_ident = $ident;
- $this->_mask = Log::UPTO($level);
-
- if (!empty($conf['from'])) {
- $this->_from = $conf['from'];
- } else {
- $this->_from = ini_get('sendmail_from');
- }
-
- if (!empty($conf['subject'])) {
- $this->_subject = $conf['subject'];
- }
-
- if (!empty($conf['preamble'])) {
- $this->_preamble = $conf['preamble'];
- }
-
- if (!empty($conf['lineFormat'])) {
- $this->_lineFormat = str_replace(array_keys($this->_formatMap),
- array_values($this->_formatMap),
- $conf['lineFormat']);
- }
-
- if (!empty($conf['timeFormat'])) {
- $this->_timeFormat = $conf['timeFormat'];
- }
-
- if (!empty($conf['mailBackend'])) {
- $this->_mailBackend = $conf['mailBackend'];
- }
-
- if (!empty($conf['mailParams'])) {
- $this->_mailParams = $conf['mailParams'];
- }
-
- /* register the destructor */
- register_shutdown_function(array(&$this, '_Log_mail'));
- }
-
- /**
- * Destructor. Calls close().
- *
- * @access private
- */
- function _Log_mail()
- {
- $this->close();
- }
-
- /**
- * Starts a new mail message.
- * This is implicitly called by log(), if necessary.
- *
- * @access public
- */
- function open()
- {
- if (!$this->_opened) {
- if (!empty($this->_preamble)) {
- $this->_message = $this->_preamble . "\r\n\r\n";
- }
- $this->_opened = true;
- $_shouldSend = false;
- }
-
- return $this->_opened;
- }
-
- /**
- * Closes the message, if it is open, and sends the mail.
- * This is implicitly called by the destructor, if necessary.
- *
- * @access public
- */
- function close()
- {
- if ($this->_opened) {
- if ($this->_shouldSend && !empty($this->_message)) {
- if ($this->_mailBackend === '') { // use mail()
- $headers = "From: $this->_from\r\n";
- $headers .= 'User-Agent: PEAR Log Package';
- if (mail($this->_recipients, $this->_subject,
- $this->_message, $headers) == false) {
- return false;
- }
- } else { // use PEAR::Mail
- include_once 'Mail.php';
- $headers = array('From' => $this->_from,
- 'To' => $this->_recipients,
- 'User-Agent' => 'PEAR Log Package',
- 'Subject' => $this->_subject);
- $mailer = &Mail::factory($this->_mailBackend,
- $this->_mailParams);
- $res = $mailer->send($this->_recipients, $headers,
- $this->_message);
- if (PEAR::isError($res)) {
- return false;
- }
- }
-
- /* Clear the message string now that the email has been sent. */
- $this->_message = '';
- $this->_shouldSend = false;
- }
- $this->_opened = false;
- }
-
- return ($this->_opened === false);
- }
-
- /**
- * Flushes the log output by forcing the email message to be sent now.
- * Events that are logged after flush() is called will be appended to a
- * new email message.
- *
- * @access public
- * @since Log 1.8.2
- */
- function flush()
- {
- /*
- * It's sufficient to simply call close() to flush the output.
- * The next call to log() will cause the handler to be reopened.
- */
- return $this->close();
- }
-
- /**
- * Writes $message to the currently open mail message.
- * Calls open(), if necessary.
- *
- * @param mixed $message String or object containing the message to log.
- * @param string $priority The priority of the message. Valid
- * values are: PEAR_LOG_EMERG, PEAR_LOG_ALERT,
- * PEAR_LOG_CRIT, PEAR_LOG_ERR, PEAR_LOG_WARNING,
- * PEAR_LOG_NOTICE, PEAR_LOG_INFO, and PEAR_LOG_DEBUG.
- * @return boolean True on success or false on failure.
- * @access public
- */
- function log($message, $priority = null)
- {
- /* If a priority hasn't been specified, use the default value. */
- if ($priority === null) {
- $priority = $this->_priority;
- }
-
- /* Abort early if the priority is above the maximum logging level. */
- if (!$this->_isMasked($priority)) {
- return false;
- }
-
- /* If the message isn't open and can't be opened, return failure. */
- if (!$this->_opened && !$this->open()) {
- return false;
- }
-
- /* Extract the string representation of the message. */
- $message = $this->_extractMessage($message);
-
- /* Append the string containing the complete log line. */
- $this->_message .= $this->_format($this->_lineFormat,
- strftime($this->_timeFormat),
- $priority, $message) . "\r\n";
- $this->_shouldSend = true;
-
- /* Notify observers about this log message. */
- $this->_announce(array('priority' => $priority, 'message' => $message));
-
- return true;
- }
-}
diff --git a/modules/blockrss/vendor/pear/log/Log/mcal.php b/modules/blockrss/vendor/pear/log/Log/mcal.php
deleted file mode 100644
index 57b9e6e6d..000000000
--- a/modules/blockrss/vendor/pear/log/Log/mcal.php
+++ /dev/null
@@ -1,169 +0,0 @@
-
- * @since Horde 1.3
- * @since Log 1.0
- * @package Log
- */
-class Log_mcal extends Log
-{
- /**
- * holding the calendar specification to connect to.
- * @var string
- * @access private
- */
- var $_calendar = '{localhost/mstore}';
-
- /**
- * holding the username to use.
- * @var string
- * @access private
- */
- var $_username = '';
-
- /**
- * holding the password to use.
- * @var string
- * @access private
- */
- var $_password = '';
-
- /**
- * holding the options to pass to the calendar stream.
- * @var integer
- * @access private
- */
- var $_options = 0;
-
- /**
- * ResourceID of the MCAL stream.
- * @var string
- * @access private
- */
- var $_stream = '';
-
- /**
- * Integer holding the log facility to use.
- * @var string
- * @access private
- */
- var $_name = LOG_SYSLOG;
-
- /**
- * Constructs a new Log_mcal object.
- *
- * @param string $name The category to use for our events.
- * @param string $ident The identity string.
- * @param array $conf The configuration array.
- * @param int $level Log messages up to and including this level.
- * @access public
- */
- public function __construct($name, $ident = '', $conf = array(),
- $level = PEAR_LOG_DEBUG)
- {
- $this->_id = md5(microtime().rand());
- $this->_name = $name;
- $this->_ident = $ident;
- $this->_mask = Log::UPTO($level);
- $this->_calendar = $conf['calendar'];
- $this->_username = $conf['username'];
- $this->_password = $conf['password'];
- $this->_options = $conf['options'];
- }
-
- /**
- * Opens a calendar stream, if it has not already been
- * opened. This is implicitly called by log(), if necessary.
- * @access public
- */
- function open()
- {
- if (!$this->_opened) {
- $this->_stream = mcal_open($this->_calendar, $this->_username,
- $this->_password, $this->_options);
- $this->_opened = true;
- }
-
- return $this->_opened;
- }
-
- /**
- * Closes the calendar stream, if it is open.
- * @access public
- */
- function close()
- {
- if ($this->_opened) {
- mcal_close($this->_stream);
- $this->_opened = false;
- }
-
- return ($this->_opened === false);
- }
-
- /**
- * Logs $message and associated information to the currently open
- * calendar stream. Calls open() if necessary. Also passes the
- * message along to any Log_observer instances that are observing
- * this Log.
- *
- * @param mixed $message String or object containing the message to log.
- * @param string $priority The priority of the message. Valid
- * values are: PEAR_LOG_EMERG, PEAR_LOG_ALERT,
- * PEAR_LOG_CRIT, PEAR_LOG_ERR, PEAR_LOG_WARNING,
- * PEAR_LOG_NOTICE, PEAR_LOG_INFO, and PEAR_LOG_DEBUG.
- * @return boolean True on success or false on failure.
- * @access public
- */
- function log($message, $priority = null)
- {
- /* If a priority hasn't been specified, use the default value. */
- if ($priority === null) {
- $priority = $this->_priority;
- }
-
- /* Abort early if the priority is above the maximum logging level. */
- if (!$this->_isMasked($priority)) {
- return false;
- }
-
- /* If the connection isn't open and can't be opened, return failure. */
- if (!$this->_opened && !$this->open()) {
- return false;
- }
-
- /* Extract the string representation of the message. */
- $message = $this->_extractMessage($message);
-
- $date_str = date('Y:n:j:G:i:s');
- $dates = explode(':', $date_str);
-
- mcal_event_init($this->_stream);
- mcal_event_set_title($this->_stream, $this->_ident);
- mcal_event_set_category($this->_stream, $this->_name);
- mcal_event_set_description($this->_stream, $message);
- mcal_event_add_attribute($this->_stream, 'priority', $priority);
- mcal_event_set_start($this->_stream, $dates[0], $dates[1], $dates[2],
- $dates[3], $dates[4], $dates[5]);
- mcal_event_set_end($this->_stream, $dates[0], $dates[1], $dates[2],
- $dates[3], $dates[4], $dates[5]);
- mcal_append_event($this->_stream);
-
- $this->_announce(array('priority' => $priority, 'message' => $message));
-
- return true;
- }
-
-}
diff --git a/modules/blockrss/vendor/pear/log/Log/mdb2.php b/modules/blockrss/vendor/pear/log/Log/mdb2.php
deleted file mode 100644
index 6a0b45c7a..000000000
--- a/modules/blockrss/vendor/pear/log/Log/mdb2.php
+++ /dev/null
@@ -1,358 +0,0 @@
-
- * @author Jon Parise
- * @since Log 1.9.0
- * @package Log
- */
-class Log_mdb2 extends Log
-{
- /**
- * Variable containing the DSN information.
- * @var mixed
- * @access private
- */
- var $_dsn = '';
-
- /**
- * Array containing our set of DB configuration options.
- * @var array
- * @access private
- */
- var $_options = array('persistent' => true);
-
- /**
- * Object holding the database handle.
- * @var object
- * @access private
- */
- var $_db = null;
-
- /**
- * Resource holding the prepared statement handle.
- * @var resource
- * @access private
- */
- var $_statement = null;
-
- /**
- * Flag indicating that we're using an existing database connection.
- * @var boolean
- * @access private
- */
- var $_existingConnection = false;
-
- /**
- * String holding the database table to use.
- * @var string
- * @access private
- */
- var $_table = 'log_table';
-
- /**
- * String holding the name of the ID sequence.
- * @var string
- * @access private
- */
- var $_sequence = 'log_id';
-
- /**
- * Maximum length of the $ident string. This corresponds to the size of
- * the 'ident' column in the SQL table.
- * @var integer
- * @access private
- */
- var $_identLimit = 16;
-
- /**
- * Set of field types used in the database table.
- * @var array
- * @access private
- */
- var $_types = array(
- 'id' => 'integer',
- 'logtime' => 'timestamp',
- 'ident' => 'text',
- 'priority' => 'text',
- 'message' => 'clob'
- );
-
- /**
- * Constructs a new sql logging object.
- *
- * @param string $name The target SQL table.
- * @param string $ident The identification field.
- * @param array $conf The connection configuration array.
- * @param int $level Log messages up to and including this level.
- * @access public
- */
- public function __construct($name, $ident = '', $conf = array(),
- $level = PEAR_LOG_DEBUG)
- {
- $this->_id = md5(microtime().rand());
- $this->_table = $name;
- $this->_mask = Log::UPTO($level);
-
- /* If an options array was provided, use it. */
- if (isset($conf['options']) && is_array($conf['options'])) {
- $this->_options = $conf['options'];
- }
-
- /* If a specific sequence name was provided, use it. */
- if (!empty($conf['sequence'])) {
- $this->_sequence = $conf['sequence'];
- }
-
- /* If a specific sequence name was provided, use it. */
- if (isset($conf['identLimit'])) {
- $this->_identLimit = $conf['identLimit'];
- }
-
- /* Now that the ident limit is confirmed, set the ident string. */
- $this->setIdent($ident);
-
- /* If an existing database connection was provided, use it. */
- if (isset($conf['db'])) {
- $this->_db = &$conf['db'];
- $this->_existingConnection = true;
- $this->_opened = true;
- } elseif (isset($conf['singleton'])) {
- $this->_db = &MDB2::singleton($conf['singleton'], $this->_options);
- $this->_existingConnection = true;
- $this->_opened = true;
- } else {
- $this->_dsn = $conf['dsn'];
- }
- }
-
- /**
- * Opens a connection to the database, if it has not already
- * been opened. This is implicitly called by log(), if necessary.
- *
- * @return boolean True on success, false on failure.
- * @access public
- */
- function open()
- {
- if (!$this->_opened) {
- /* Use the DSN and options to create a database connection. */
- $this->_db = &MDB2::connect($this->_dsn, $this->_options);
- if (PEAR::isError($this->_db)) {
- return false;
- }
-
- /* Create a prepared statement for repeated use in log(). */
- if (!$this->_prepareStatement()) {
- return false;
- }
-
- /* We now consider out connection open. */
- $this->_opened = true;
- }
-
- return $this->_opened;
- }
-
- /**
- * Closes the connection to the database if it is still open and we were
- * the ones that opened it. It is the caller's responsible to close an
- * existing connection that was passed to us via $conf['db'].
- *
- * @return boolean True on success, false on failure.
- * @access public
- */
- function close()
- {
- /* If we have a statement object, free it. */
- if (is_object($this->_statement)) {
- $this->_statement->free();
- $this->_statement = null;
- }
-
- /* If we opened the database connection, disconnect it. */
- if ($this->_opened && !$this->_existingConnection) {
- $this->_opened = false;
- return $this->_db->disconnect();
- }
-
- return ($this->_opened === false);
- }
-
- /**
- * Sets this Log instance's identification string. Note that this
- * SQL-specific implementation will limit the length of the $ident string
- * to sixteen (16) characters.
- *
- * @param string $ident The new identification string.
- *
- * @access public
- * @since Log 1.8.5
- */
- function setIdent($ident)
- {
- $this->_ident = substr($ident, 0, $this->_identLimit);
- }
-
- /**
- * Inserts $message to the currently open database. Calls open(),
- * if necessary. Also passes the message along to any Log_observer
- * instances that are observing this Log.
- *
- * @param mixed $message String or object containing the message to log.
- * @param string $priority The priority of the message. Valid
- * values are: PEAR_LOG_EMERG, PEAR_LOG_ALERT,
- * PEAR_LOG_CRIT, PEAR_LOG_ERR, PEAR_LOG_WARNING,
- * PEAR_LOG_NOTICE, PEAR_LOG_INFO, and PEAR_LOG_DEBUG.
- * @return boolean True on success or false on failure.
- * @access public
- */
- function log($message, $priority = null)
- {
- /* If a priority hasn't been specified, use the default value. */
- if ($priority === null) {
- $priority = $this->_priority;
- }
-
- /* Abort early if the priority is above the maximum logging level. */
- if (!$this->_isMasked($priority)) {
- return false;
- }
-
- /* If the connection isn't open and can't be opened, return failure. */
- if (!$this->_opened && !$this->open()) {
- return false;
- }
-
- /* If we don't already have a statement object, create one. */
- if (!is_object($this->_statement) && !$this->_prepareStatement()) {
- return false;
- }
-
- /* Extract the string representation of the message. */
- $message = $this->_extractMessage($message);
-
- /* Build our set of values for this log entry. */
- $values = array(
- 'id' => $this->_db->nextId($this->_sequence),
- 'logtime' => MDB2_Date::mdbNow(),
- 'ident' => $this->_ident,
- 'priority' => $priority,
- 'message' => $message
- );
-
- /* Execute the SQL query for this log entry insertion. */
- $this->_db->expectError(MDB2_ERROR_NOSUCHTABLE);
- $result = &$this->_statement->execute($values);
- $this->_db->popExpect();
-
- /* Attempt to handle any errors. */
- if (PEAR::isError($result)) {
- /* We can only handle MDB2_ERROR_NOSUCHTABLE errors. */
- if ($result->getCode() != MDB2_ERROR_NOSUCHTABLE) {
- return false;
- }
-
- /* Attempt to create the target table. */
- if (!$this->_createTable()) {
- return false;
- }
-
- /* Recreate our prepared statement resource. */
- $this->_statement->free();
- if (!$this->_prepareStatement()) {
- return false;
- }
-
- /* Attempt to re-execute the insertion query. */
- $result = $this->_statement->execute($values);
- if (PEAR::isError($result)) {
- return false;
- }
- }
-
- $this->_announce(array('priority' => $priority, 'message' => $message));
-
- return true;
- }
-
- /**
- * Create the log table in the database.
- *
- * @return boolean True on success or false on failure.
- * @access private
- */
- function _createTable()
- {
- $this->_db->loadModule('Manager', null, true);
- $result = $this->_db->manager->createTable(
- $this->_table,
- array(
- 'id' => array('type' => $this->_types['id']),
- 'logtime' => array('type' => $this->_types['logtime']),
- 'ident' => array('type' => $this->_types['ident']),
- 'priority' => array('type' => $this->_types['priority']),
- 'message' => array('type' => $this->_types['message'])
- )
- );
- if (PEAR::isError($result)) {
- return false;
- }
-
- $result = $this->_db->manager->createIndex(
- $this->_table,
- 'unique_id',
- array('fields' => array('id' => true), 'unique' => true)
- );
- if (PEAR::isError($result)) {
- return false;
- }
-
- return true;
- }
-
- /**
- * Prepare the SQL insertion statement.
- *
- * @return boolean True if the statement was successfully created.
- *
- * @access private
- * @since Log 1.9.0
- */
- function _prepareStatement()
- {
- $this->_statement = &$this->_db->prepare(
- 'INSERT INTO ' . $this->_table .
- ' (id, logtime, ident, priority, message)' .
- ' VALUES(:id, :logtime, :ident, :priority, :message)',
- $this->_types, MDB2_PREPARE_MANIP);
-
- /* Return success if we didn't generate an error. */
- return (PEAR::isError($this->_statement) === false);
- }
-}
diff --git a/modules/blockrss/vendor/pear/log/Log/null.php b/modules/blockrss/vendor/pear/log/Log/null.php
deleted file mode 100644
index 6b3a0aaa4..000000000
--- a/modules/blockrss/vendor/pear/log/Log/null.php
+++ /dev/null
@@ -1,91 +0,0 @@
-
- * @since Log 1.8.2
- * @package Log
- *
- * @example null.php Using the null handler.
- */
-class Log_null extends Log
-{
- /**
- * Constructs a new Log_null object.
- *
- * @param string $name Ignored.
- * @param string $ident The identity string.
- * @param array $conf The configuration array.
- * @param int $level Log messages up to and including this level.
- * @access public
- */
- public function __construct($name, $ident = '', $conf = array(),
- $level = PEAR_LOG_DEBUG)
- {
- $this->_id = md5(microtime().rand());
- $this->_ident = $ident;
- $this->_mask = Log::UPTO($level);
- }
-
- /**
- * Opens the handler.
- *
- * @access public
- * @since Log 1.9.6
- */
- function open()
- {
- $this->_opened = true;
- return true;
- }
-
- /**
- * Closes the handler.
- *
- * @access public
- * @since Log 1.9.6
- */
- function close()
- {
- $this->_opened = false;
- return true;
- }
-
- /**
- * Simply consumes the log event. The message will still be passed
- * along to any Log_observer instances that are observing this Log.
- *
- * @param mixed $message String or object containing the message to log.
- * @param string $priority The priority of the message. Valid
- * values are: PEAR_LOG_EMERG, PEAR_LOG_ALERT,
- * PEAR_LOG_CRIT, PEAR_LOG_ERR, PEAR_LOG_WARNING,
- * PEAR_LOG_NOTICE, PEAR_LOG_INFO, and PEAR_LOG_DEBUG.
- * @return boolean True on success or false on failure.
- * @access public
- */
- function log($message, $priority = null)
- {
- /* If a priority hasn't been specified, use the default value. */
- if ($priority === null) {
- $priority = $this->_priority;
- }
-
- /* Abort early if the priority is above the maximum logging level. */
- if (!$this->_isMasked($priority)) {
- return false;
- }
-
- $this->_announce(array('priority' => $priority, 'message' => $message));
-
- return true;
- }
-
-}
diff --git a/modules/blockrss/vendor/pear/log/Log/observer.php b/modules/blockrss/vendor/pear/log/Log/observer.php
deleted file mode 100644
index 09b01454b..000000000
--- a/modules/blockrss/vendor/pear/log/Log/observer.php
+++ /dev/null
@@ -1,129 +0,0 @@
-
- * @since Horde 1.3
- * @since Log 1.0
- * @package Log
- *
- * @example observer_mail.php An example Log_observer implementation.
- */
-class Log_observer
-{
- /**
- * Instance-specific unique identification number.
- *
- * @var integer
- * @access private
- */
- var $_id = 0;
-
- /**
- * The minimum priority level of message that we want to hear about.
- * PEAR_LOG_EMERG is the highest priority, so we will only hear messages
- * with an integer priority value less than or equal to ours. It defaults
- * to PEAR_LOG_INFO, which listens to everything except PEAR_LOG_DEBUG.
- *
- * @var string
- * @access private
- */
- var $_priority = PEAR_LOG_INFO;
-
- /**
- * Creates a new basic Log_observer instance.
- *
- * @param integer $priority The highest priority at which to receive
- * log event notifications.
- *
- * @access public
- */
- public function __construct($priority = PEAR_LOG_INFO)
- {
- $this->_id = md5(microtime().rand());
- $this->_priority = $priority;
- }
-
- /**
- * Attempts to return a new concrete Log_observer instance of the requested
- * type.
- *
- * @param string $type The type of concreate Log_observer subclass
- * to return.
- * @param integer $priority The highest priority at which to receive
- * log event notifications.
- * @param array $conf Optional associative array of additional
- * configuration values.
- *
- * @return object The newly created concrete Log_observer
- * instance, or null on an error.
- */
- function &factory($type, $priority = PEAR_LOG_INFO, $conf = array())
- {
- $type = strtolower($type);
- $class = 'Log_observer_' . $type;
-
- /*
- * If the desired class already exists (because the caller has supplied
- * it from some custom location), simply instantiate and return a new
- * instance.
- */
- if (class_exists($class)) {
- $object = new $class($priority, $conf);
- return $object;
- }
-
- /* Support both the new-style and old-style file naming conventions. */
- $newstyle = true;
- $classfile = dirname(__FILE__) . '/observer_' . $type . '.php';
-
- if (!file_exists($classfile)) {
- $classfile = 'Log/' . $type . '.php';
- $newstyle = false;
- }
-
- /*
- * Attempt to include our version of the named class, but don't treat
- * a failure as fatal. The caller may have already included their own
- * version of the named class.
- */
- @include_once $classfile;
-
- /* If the class exists, return a new instance of it. */
- if (class_exists($class)) {
- /* Support both new-style and old-style construction. */
- if ($newstyle) {
- $object = new $class($priority, $conf);
- } else {
- $object = new $class($priority);
- }
- return $object;
- }
-
- $null = null;
- return $null;
- }
-
- /**
- * This is a stub method to make sure that Log_Observer classes do
- * something when they are notified of a message. The default behavior
- * is to just print the message, which is obviously not desireable in
- * practically any situation - which is why you need to override this
- * method. :)
- *
- * @param array $event A hash describing the log event.
- */
- function notify($event)
- {
- print_r($event);
- }
-}
diff --git a/modules/blockrss/vendor/pear/log/Log/sql.php b/modules/blockrss/vendor/pear/log/Log/sql.php
deleted file mode 100644
index a235d09f5..000000000
--- a/modules/blockrss/vendor/pear/log/Log/sql.php
+++ /dev/null
@@ -1,293 +0,0 @@
-
- * @since Horde 1.3
- * @since Log 1.0
- * @package Log
- *
- * @example sql.php Using the SQL handler.
- */
-class Log_sql extends Log
-{
- /**
- * Variable containing the DSN information.
- * @var mixed
- * @access private
- */
- var $_dsn = '';
-
- /**
- * String containing the SQL insertion statement.
- *
- * @var string
- * @access private
- */
- var $_sql = '';
-
- /**
- * Array containing our set of DB configuration options.
- * @var array
- * @access private
- */
- var $_options = array('persistent' => true);
-
- /**
- * Object holding the database handle.
- * @var object
- * @access private
- */
- var $_db = null;
-
- /**
- * Resource holding the prepared statement handle.
- * @var resource
- * @access private
- */
- var $_statement = null;
-
- /**
- * Flag indicating that we're using an existing database connection.
- * @var boolean
- * @access private
- */
- var $_existingConnection = false;
-
- /**
- * String holding the database table to use.
- * @var string
- * @access private
- */
- var $_table = 'log_table';
-
- /**
- * String holding the name of the ID sequence.
- * @var string
- * @access private
- */
- var $_sequence = 'log_id';
-
- /**
- * Maximum length of the $ident string. This corresponds to the size of
- * the 'ident' column in the SQL table.
- * @var integer
- * @access private
- */
- var $_identLimit = 16;
-
- /**
- * Constructs a new sql logging object.
- *
- * @param string $name The target SQL table.
- * @param string $ident The identification field.
- * @param array $conf The connection configuration array.
- * @param int $level Log messages up to and including this level.
- * @access public
- */
- public function __construct($name, $ident = '', $conf = array(),
- $level = PEAR_LOG_DEBUG)
- {
- $this->_id = md5(microtime().rand());
- $this->_table = $name;
- $this->_mask = Log::UPTO($level);
-
- /* Now that we have a table name, assign our SQL statement. */
- if (!empty($conf['sql'])) {
- $this->_sql = $conf['sql'];
- } else {
- $this->_sql = 'INSERT INTO ' . $this->_table .
- ' (id, logtime, ident, priority, message)' .
- ' VALUES(?, CURRENT_TIMESTAMP, ?, ?, ?)';
- }
-
- /* If an options array was provided, use it. */
- if (isset($conf['options']) && is_array($conf['options'])) {
- $this->_options = $conf['options'];
- }
-
- /* If a specific sequence name was provided, use it. */
- if (!empty($conf['sequence'])) {
- $this->_sequence = $conf['sequence'];
- }
-
- /* If a specific sequence name was provided, use it. */
- if (isset($conf['identLimit'])) {
- $this->_identLimit = $conf['identLimit'];
- }
-
- /* Now that the ident limit is confirmed, set the ident string. */
- $this->setIdent($ident);
-
- /* If an existing database connection was provided, use it. */
- if (isset($conf['db'])) {
- $this->_db = &$conf['db'];
- $this->_existingConnection = true;
- $this->_opened = true;
- } else {
- $this->_dsn = $conf['dsn'];
- }
- }
-
- /**
- * Opens a connection to the database, if it has not already
- * been opened. This is implicitly called by log(), if necessary.
- *
- * @return boolean True on success, false on failure.
- * @access public
- */
- function open()
- {
- if (!$this->_opened) {
- /* Use the DSN and options to create a database connection. */
- $this->_db = &DB::connect($this->_dsn, $this->_options);
- if (DB::isError($this->_db)) {
- return false;
- }
-
- /* Create a prepared statement for repeated use in log(). */
- if (!$this->_prepareStatement()) {
- return false;
- }
-
- /* We now consider out connection open. */
- $this->_opened = true;
- }
-
- return $this->_opened;
- }
-
- /**
- * Closes the connection to the database if it is still open and we were
- * the ones that opened it. It is the caller's responsible to close an
- * existing connection that was passed to us via $conf['db'].
- *
- * @return boolean True on success, false on failure.
- * @access public
- */
- function close()
- {
- if ($this->_opened && !$this->_existingConnection) {
- $this->_opened = false;
- $this->_db->freePrepared($this->_statement);
- return $this->_db->disconnect();
- }
-
- return ($this->_opened === false);
- }
-
- /**
- * Sets this Log instance's identification string. Note that this
- * SQL-specific implementation will limit the length of the $ident string
- * to sixteen (16) characters.
- *
- * @param string $ident The new identification string.
- *
- * @access public
- * @since Log 1.8.5
- */
- function setIdent($ident)
- {
- $this->_ident = substr($ident, 0, $this->_identLimit);
- }
-
- /**
- * Inserts $message to the currently open database. Calls open(),
- * if necessary. Also passes the message along to any Log_observer
- * instances that are observing this Log.
- *
- * @param mixed $message String or object containing the message to log.
- * @param string $priority The priority of the message. Valid
- * values are: PEAR_LOG_EMERG, PEAR_LOG_ALERT,
- * PEAR_LOG_CRIT, PEAR_LOG_ERR, PEAR_LOG_WARNING,
- * PEAR_LOG_NOTICE, PEAR_LOG_INFO, and PEAR_LOG_DEBUG.
- * @return boolean True on success or false on failure.
- * @access public
- */
- function log($message, $priority = null)
- {
- /* If a priority hasn't been specified, use the default value. */
- if ($priority === null) {
- $priority = $this->_priority;
- }
-
- /* Abort early if the priority is above the maximum logging level. */
- if (!$this->_isMasked($priority)) {
- return false;
- }
-
- /* If the connection isn't open and can't be opened, return failure. */
- if (!$this->_opened && !$this->open()) {
- return false;
- }
-
- /* If we don't already have our statement object yet, create it. */
- if (!is_object($this->_statement) && !$this->_prepareStatement()) {
- return false;
- }
-
- /* Extract the string representation of the message. */
- $message = $this->_extractMessage($message);
-
- /* Build our set of values for this log entry. */
- $id = $this->_db->nextId($this->_sequence);
- $values = array($id, $this->_ident, $priority, $message);
-
- /* Execute the SQL query for this log entry insertion. */
- $result =& $this->_db->execute($this->_statement, $values);
- if (DB::isError($result)) {
- return false;
- }
-
- $this->_announce(array('priority' => $priority, 'message' => $message));
-
- return true;
- }
-
- /**
- * Prepare the SQL insertion statement.
- *
- * @return boolean True if the statement was successfully created.
- *
- * @access private
- * @since Log 1.9.1
- */
- function _prepareStatement()
- {
- $this->_statement = $this->_db->prepare($this->_sql);
-
- /* Return success if we didn't generate an error. */
- return (DB::isError($this->_statement) === false);
- }
-}
diff --git a/modules/blockrss/vendor/pear/log/Log/sqlite.php b/modules/blockrss/vendor/pear/log/Log/sqlite.php
deleted file mode 100644
index ec7ac27e7..000000000
--- a/modules/blockrss/vendor/pear/log/Log/sqlite.php
+++ /dev/null
@@ -1,224 +0,0 @@
-
- * @author Jon Parise
- * @since Log 1.8.3
- * @package Log
- *
- * @example sqlite.php Using the Sqlite handler.
- */
-class Log_sqlite extends Log
-{
- /**
- * Array containing the connection defaults
- * @var array
- * @access private
- */
- var $_options = array('mode' => 0666,
- 'persistent' => false);
-
- /**
- * Object holding the database handle.
- * @var object
- * @access private
- */
- var $_db = null;
-
- /**
- * Flag indicating that we're using an existing database connection.
- * @var boolean
- * @access private
- */
- var $_existingConnection = false;
-
- /**
- * String holding the database table to use.
- * @var string
- * @access private
- */
- var $_table = 'log_table';
-
- /**
- * Constructs a new sql logging object.
- *
- * @param string $name The target SQL table.
- * @param string $ident The identification field.
- * @param mixed $conf Can be an array of configuration options used
- * to open a new database connection
- * or an already opened sqlite connection.
- * @param int $level Log messages up to and including this level.
- * @access public
- */
- public function __construct($name, $ident = '', &$conf, $level = PEAR_LOG_DEBUG)
- {
- $this->_id = md5(microtime().rand());
- $this->_table = $name;
- $this->_ident = $ident;
- $this->_mask = Log::UPTO($level);
-
- if (is_array($conf)) {
- foreach ($conf as $k => $opt) {
- $this->_options[$k] = $opt;
- }
- } else {
- // If an existing database connection was provided, use it.
- $this->_db =& $conf;
- $this->_existingConnection = true;
- }
- }
-
- /**
- * Opens a connection to the database, if it has not already
- * been opened. This is implicitly called by log(), if necessary.
- *
- * @return boolean True on success, false on failure.
- * @access public
- */
- function open()
- {
- if (is_resource($this->_db)) {
- $this->_opened = true;
- return $this->_createTable();
- } else {
- /* Set the connection function based on the 'persistent' option. */
- if (empty($this->_options['persistent'])) {
- $connectFunction = 'sqlite_open';
- } else {
- $connectFunction = 'sqlite_popen';
- }
-
- /* Attempt to connect to the database. */
- if ($this->_db = $connectFunction($this->_options['filename'],
- (int)$this->_options['mode'],
- $error)) {
- $this->_opened = true;
- return $this->_createTable();
- }
- }
-
- return $this->_opened;
- }
-
- /**
- * Closes the connection to the database if it is still open and we were
- * the ones that opened it. It is the caller's responsible to close an
- * existing connection that was passed to us via $conf['db'].
- *
- * @return boolean True on success, false on failure.
- * @access public
- */
- function close()
- {
- /* We never close existing connections. */
- if ($this->_existingConnection) {
- return false;
- }
-
- if ($this->_opened) {
- $this->_opened = false;
- sqlite_close($this->_db);
- }
-
- return ($this->_opened === false);
- }
-
- /**
- * Inserts $message to the currently open database. Calls open(),
- * if necessary. Also passes the message along to any Log_observer
- * instances that are observing this Log.
- *
- * @param mixed $message String or object containing the message to log.
- * @param string $priority The priority of the message. Valid
- * values are: PEAR_LOG_EMERG, PEAR_LOG_ALERT,
- * PEAR_LOG_CRIT, PEAR_LOG_ERR, PEAR_LOG_WARNING,
- * PEAR_LOG_NOTICE, PEAR_LOG_INFO, and PEAR_LOG_DEBUG.
- * @return boolean True on success or false on failure.
- * @access public
- */
- function log($message, $priority = null)
- {
- /* If a priority hasn't been specified, use the default value. */
- if ($priority === null) {
- $priority = $this->_priority;
- }
-
- /* Abort early if the priority is above the maximum logging level. */
- if (!$this->_isMasked($priority)) {
- return false;
- }
-
- /* If the connection isn't open and can't be opened, return failure. */
- if (!$this->_opened && !$this->open()) {
- return false;
- }
-
- // Extract the string representation of the message.
- $message = $this->_extractMessage($message);
-
- // Build the SQL query for this log entry insertion.
- $q = sprintf('INSERT INTO [%s] (logtime, ident, priority, message) ' .
- "VALUES ('%s', '%s', %d, '%s')",
- $this->_table,
- strftime('%Y-%m-%d %H:%M:%S', time()),
- sqlite_escape_string($this->_ident),
- $priority,
- sqlite_escape_string($message));
- if (!($res = @sqlite_unbuffered_query($this->_db, $q))) {
- return false;
- }
- $this->_announce(array('priority' => $priority, 'message' => $message));
-
- return true;
- }
-
- /**
- * Checks whether the log table exists and creates it if necessary.
- *
- * @return boolean True on success or false on failure.
- * @access private
- */
- function _createTable()
- {
- $q = "SELECT name FROM sqlite_master WHERE name='" . $this->_table .
- "' AND type='table'";
-
- $res = sqlite_query($this->_db, $q);
-
- if (sqlite_num_rows($res) == 0) {
- $q = 'CREATE TABLE [' . $this->_table . '] (' .
- 'id INTEGER PRIMARY KEY NOT NULL, ' .
- 'logtime NOT NULL, ' .
- 'ident CHAR(16) NOT NULL, ' .
- 'priority INT NOT NULL, ' .
- 'message)';
-
- if (!($res = sqlite_unbuffered_query($this->_db, $q))) {
- return false;
- }
- }
-
- return true;
- }
-
-}
diff --git a/modules/blockrss/vendor/pear/log/Log/syslog.php b/modules/blockrss/vendor/pear/log/Log/syslog.php
deleted file mode 100644
index 59c27fdd9..000000000
--- a/modules/blockrss/vendor/pear/log/Log/syslog.php
+++ /dev/null
@@ -1,238 +0,0 @@
-
- * @author Jon Parise
- * @since Horde 1.3
- * @since Log 1.0
- * @package Log
- *
- * @example syslog.php Using the syslog handler.
- */
-class Log_syslog extends Log
-{
- /**
- * Integer holding the log facility to use.
- * @var integer
- * @access private
- */
- var $_name = LOG_SYSLOG;
-
- /**
- * Should we inherit the current syslog connection for this process, or
- * should we call openlog() to start a new syslog connection?
- * @var boolean
- * @access private
- */
- var $_inherit = false;
-
- /**
- * Should we re-open the syslog connection for each log event?
- * @var boolean
- * @access private
- */
- var $_reopen = false;
-
- /**
- * Maximum message length that will be sent to syslog(). If the handler
- * receives a message longer than this length limit, it will be split into
- * multiple syslog() calls.
- * @var integer
- * @access private
- */
- var $_maxLength = 500;
-
- /**
- * String containing the format of a message.
- * @var string
- * @access private
- */
- var $_lineFormat = '%4$s';
-
- /**
- * String containing the timestamp format. It will be passed directly to
- * strftime(). Note that the timestamp string will generated using the
- * current locale.
- * @var string
- * @access private
- */
- var $_timeFormat = '%b %d %H:%M:%S';
-
- /**
- * Constructs a new syslog object.
- *
- * @param string $name The syslog facility.
- * @param string $ident The identity string.
- * @param array $conf The configuration array.
- * @param int $level Log messages up to and including this level.
- * @access public
- */
- public function __construct($name, $ident = '', $conf = array(),
- $level = PEAR_LOG_DEBUG)
- {
- /* Ensure we have a valid integer value for $name. */
- if (empty($name) || !is_int($name)) {
- $name = LOG_SYSLOG;
- }
-
- if (isset($conf['inherit'])) {
- $this->_inherit = $conf['inherit'];
- $this->_opened = $this->_inherit;
- }
- if (isset($conf['reopen'])) {
- $this->_reopen = $conf['reopen'];
- }
- if (isset($conf['maxLength'])) {
- $this->_maxLength = $conf['maxLength'];
- }
- if (!empty($conf['lineFormat'])) {
- $this->_lineFormat = str_replace(array_keys($this->_formatMap),
- array_values($this->_formatMap),
- $conf['lineFormat']);
- }
- if (!empty($conf['timeFormat'])) {
- $this->_timeFormat = $conf['timeFormat'];
- }
-
- $this->_id = md5(microtime().rand());
- $this->_name = $name;
- $this->_ident = $ident;
- $this->_mask = Log::UPTO($level);
- }
-
- /**
- * Opens a connection to the system logger, if it has not already
- * been opened. This is implicitly called by log(), if necessary.
- * @access public
- */
- function open()
- {
- if (!$this->_opened || $this->_reopen) {
- $this->_opened = openlog($this->_ident, LOG_PID, $this->_name);
- }
-
- return $this->_opened;
- }
-
- /**
- * Closes the connection to the system logger, if it is open.
- * @access public
- */
- function close()
- {
- if ($this->_opened && !$this->_inherit) {
- closelog();
- $this->_opened = false;
- }
-
- return true;
- }
-
- /**
- * Sends $message to the currently open syslog connection. Calls
- * open() if necessary. Also passes the message along to any Log_observer
- * instances that are observing this Log.
- *
- * @param mixed $message String or object containing the message to log.
- * @param int $priority (optional) The priority of the message. Valid
- * values are: PEAR_LOG_EMERG, PEAR_LOG_ALERT,
- * PEAR_LOG_CRIT, PEAR_LOG_ERR, PEAR_LOG_WARNING,
- * PEAR_LOG_NOTICE, PEAR_LOG_INFO, and PEAR_LOG_DEBUG.
- * @return boolean True on success or false on failure.
- * @access public
- */
- function log($message, $priority = null)
- {
- /* If a priority hasn't been specified, use the default value. */
- if ($priority === null) {
- $priority = $this->_priority;
- }
-
- /* Abort early if the priority is above the maximum logging level. */
- if (!$this->_isMasked($priority)) {
- return false;
- }
-
- /* If we need to (re)open the connection and open() fails, abort. */
- if ((!$this->_opened || $this->_reopen) && !$this->open()) {
- return false;
- }
-
- /* Extract the string representation of the message. */
- $message = $this->_extractMessage($message);
-
- /* Build a syslog priority value based on our current configuration. */
- $syslogPriority = $this->_toSyslog($priority);
- if ($this->_inherit) {
- $syslogPriority |= $this->_name;
- }
-
- /* Apply the configured line format to the message string. */
- $message = $this->_format($this->_lineFormat,
- strftime($this->_timeFormat),
- $priority, $message);
-
- /* Split the string into parts based on our maximum length setting. */
- $parts = str_split($message, $this->_maxLength);
- if ($parts === false) {
- return false;
- }
-
- foreach ($parts as $part) {
- if (!syslog($syslogPriority, $part)) {
- return false;
- }
- }
-
- $this->_announce(array('priority' => $priority, 'message' => $message));
-
- return true;
- }
-
- /**
- * Converts a PEAR_LOG_* constant into a syslog LOG_* constant.
- *
- * This function exists because, under Windows, not all of the LOG_*
- * constants have unique values. Instead, the PEAR_LOG_* were introduced
- * for global use, with the conversion to the LOG_* constants kept local to
- * to the syslog driver.
- *
- * @param int $priority PEAR_LOG_* value to convert to LOG_* value.
- *
- * @return The LOG_* representation of $priority.
- *
- * @access private
- */
- function _toSyslog($priority)
- {
- static $priorities = array(
- PEAR_LOG_EMERG => LOG_EMERG,
- PEAR_LOG_ALERT => LOG_ALERT,
- PEAR_LOG_CRIT => LOG_CRIT,
- PEAR_LOG_ERR => LOG_ERR,
- PEAR_LOG_WARNING => LOG_WARNING,
- PEAR_LOG_NOTICE => LOG_NOTICE,
- PEAR_LOG_INFO => LOG_INFO,
- PEAR_LOG_DEBUG => LOG_DEBUG
- );
-
- /* If we're passed an unknown priority, default to LOG_INFO. */
- if (!is_int($priority) || !in_array($priority, $priorities)) {
- return LOG_INFO;
- }
-
- return $priorities[$priority];
- }
-
-}
diff --git a/modules/blockrss/vendor/pear/log/Log/win.php b/modules/blockrss/vendor/pear/log/Log/win.php
deleted file mode 100644
index 43d9c4a3d..000000000
--- a/modules/blockrss/vendor/pear/log/Log/win.php
+++ /dev/null
@@ -1,286 +0,0 @@
-
- * @since Log 1.7.0
- * @package Log
- *
- * @example win.php Using the window handler.
- */
-class Log_win extends Log
-{
- /**
- * The name of the output window.
- * @var string
- * @access private
- */
- var $_name = 'LogWindow';
-
- /**
- * The title of the output window.
- * @var string
- * @access private
- */
- var $_title = 'Log Output Window';
-
- /**
- * Mapping of log priorities to styles.
- * @var array
- * @access private
- */
- var $_styles = array(
- PEAR_LOG_EMERG => 'color: red;',
- PEAR_LOG_ALERT => 'color: orange;',
- PEAR_LOG_CRIT => 'color: yellow;',
- PEAR_LOG_ERR => 'color: green;',
- PEAR_LOG_WARNING => 'color: blue;',
- PEAR_LOG_NOTICE => 'color: indigo;',
- PEAR_LOG_INFO => 'color: violet;',
- PEAR_LOG_DEBUG => 'color: black;'
- );
-
- /**
- * String buffer that holds line that are pending output.
- * @var array
- * @access private
- */
- var $_buffer = array();
-
- /**
- * Constructs a new Log_win object.
- *
- * @param string $name Ignored.
- * @param string $ident The identity string.
- * @param array $conf The configuration array.
- * @param int $level Log messages up to and including this level.
- * @access public
- */
- public function __construct($name, $ident = '', $conf = array(),
- $level = PEAR_LOG_DEBUG)
- {
- $this->_id = md5(microtime().rand());
- $this->_name = str_replace(' ', '_', $name);
- $this->_ident = $ident;
- $this->_mask = Log::UPTO($level);
-
- if (isset($conf['title'])) {
- $this->_title = $conf['title'];
- }
- if (isset($conf['styles']) && is_array($conf['styles'])) {
- $this->_styles = $conf['styles'];
- }
- if (isset($conf['colors']) && is_array($conf['colors'])) {
- foreach ($conf['colors'] as $level => $color) {
- $this->_styles[$level] .= "color: $color;";
- }
- }
-
- register_shutdown_function(array(&$this, '_Log_win'));
- }
-
- /**
- * Destructor
- */
- function _Log_win()
- {
- if ($this->_opened || (count($this->_buffer) > 0)) {
- $this->close();
- }
- }
-
- /**
- * The first time open() is called, it will open a new browser window and
- * prepare it for output.
- *
- * This is implicitly called by log(), if necessary.
- *
- * @access public
- */
- function open()
- {
- if (!$this->_opened) {
- $win = $this->_name;
- $styles = $this->_styles;
-
- if (!empty($this->_ident)) {
- $identHeader = "$win.document.writeln('
Ident
')";
- } else {
- $identHeader = '';
- }
-
- echo <<< EOT
-
-EOT;
- $this->_opened = true;
- }
-
- return $this->_opened;
- }
-
- /**
- * Closes the output stream if it is open. If there are still pending
- * lines in the output buffer, the output window will be opened so that
- * the buffer can be drained.
- *
- * @access public
- */
- function close()
- {
- /*
- * If there are still lines waiting to be written, open the output
- * window so that we can drain the buffer.
- */
- if (!$this->_opened && (count($this->_buffer) > 0)) {
- $this->open();
- }
-
- if ($this->_opened) {
- $this->_writeln('');
- $this->_writeln('