Remove legacy ps_mainmenu files
Build / Build & Release draft (push) Failing after 0s
PHP tests / PHP Syntax check 5.6 => 8.1 (push) Failing after 9s
PHP tests / PHP-CS-Fixer (push) Failing after 1m10s
PHP tests / PHPStan (1.7.1.2) (push) Failing after 1m13s
PHP tests / PHPStan (1.7.3.4) (push) Has been cancelled
PHP tests / PHPStan (1.7.4.4) (push) Has been cancelled
PHP tests / PHPStan (1.7.5.1) (push) Has been cancelled
PHP tests / PHPStan (1.7.6) (push) Has been cancelled
PHP tests / PHPStan (1.7.7) (push) Has been cancelled
PHP tests / PHPStan (1.7.8) (push) Has been cancelled
PHP tests / PHPStan (latest) (push) Has been cancelled
PHP tests / PHPStan (1.7.2.5) (push) Has been cancelled
Build / Build & Release draft (push) Failing after 0s
PHP tests / PHP Syntax check 5.6 => 8.1 (push) Failing after 9s
PHP tests / PHP-CS-Fixer (push) Failing after 1m10s
PHP tests / PHPStan (1.7.1.2) (push) Failing after 1m13s
PHP tests / PHPStan (1.7.3.4) (push) Has been cancelled
PHP tests / PHPStan (1.7.4.4) (push) Has been cancelled
PHP tests / PHPStan (1.7.5.1) (push) Has been cancelled
PHP tests / PHPStan (1.7.6) (push) Has been cancelled
PHP tests / PHPStan (1.7.7) (push) Has been cancelled
PHP tests / PHPStan (1.7.8) (push) Has been cancelled
PHP tests / PHPStan (latest) (push) Has been cancelled
PHP tests / PHPStan (1.7.2.5) (push) Has been cancelled
This commit is contained in:
@@ -14,4 +14,4 @@ PrestaShop `1.7.8+` and `8.x`
|
||||
|
||||
## Notes
|
||||
|
||||
The repository still contains the original `ps_mainmenu` forked files for reference. The active module entrypoint is `advancedmegamenu.php`.
|
||||
The active module entrypoint is `advancedmegamenu.php`.
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "tiamak/advancedmegamenu",
|
||||
"description": "PrestaShop advanced mega menu module",
|
||||
"homepage": "http://54.38.205.168:3000/tiamak/ps_mainmenu_tia",
|
||||
"homepage": "http://54.38.205.168:3000/tiamak/advancedmegamenu",
|
||||
"license": "AFL-3.0",
|
||||
"authors": [
|
||||
{
|
||||
|
||||
-1509
File diff suppressed because it is too large
Load Diff
@@ -1,68 +0,0 @@
|
||||
{**
|
||||
* 2007-2020 PrestaShop SA and Contributors
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Academic Free License 3.0 (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:
|
||||
* https://opensource.org/licenses/AFL-3.0
|
||||
* 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 https://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2020 PrestaShop SA and Contributors
|
||||
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*}
|
||||
{assign var=_counter value=0}
|
||||
{function name="menu" nodes=[] depth=0 parent=null}
|
||||
{if $nodes|count}
|
||||
<ul class="top-menu"{if $depth == 0} id="top-menu"{/if} data-depth="{$depth}">
|
||||
{foreach from=$nodes item=node}
|
||||
<li class="{$node.type}{if $node.current} current {/if}" id="{$node.page_identifier}">
|
||||
{assign var=_counter value=$_counter+1}
|
||||
<a
|
||||
class="{if $depth >= 0}dropdown-item{/if}{if $depth === 1} dropdown-submenu{/if}"
|
||||
href="{$node.url}" data-depth="{$depth}"
|
||||
{if $node.open_in_new_window} target="_blank" {/if}
|
||||
>
|
||||
{if $node.children|count}
|
||||
{* Cannot use page identifier as we can have the same page several times *}
|
||||
{assign var=_expand_id value=10|mt_rand:100000}
|
||||
<span class="float-xs-right hidden-md-up">
|
||||
<span data-target="#top_sub_menu_{$_expand_id}" data-toggle="collapse" class="navbar-toggler collapse-icons">
|
||||
<i class="material-icons add"></i>
|
||||
<i class="material-icons remove"></i>
|
||||
</span>
|
||||
</span>
|
||||
{/if}
|
||||
{if $node.image_urls|count}
|
||||
{foreach from=$node.image_urls item=image_url}
|
||||
<img src="{$image_url}">
|
||||
{/foreach}
|
||||
{/if}
|
||||
{$node.label}
|
||||
</a>
|
||||
{if $node.children|count}
|
||||
<div {if $depth === 0}class="popover sub-menu js-sub-menu collapse"{else}class="collapse"{/if} id="top_sub_menu_{$_expand_id}">
|
||||
{menu nodes=$node.children depth=$node.depth parent=$node}
|
||||
</div>
|
||||
{/if}
|
||||
</li>
|
||||
{/foreach}
|
||||
</ul>
|
||||
{/if}
|
||||
{/function}
|
||||
|
||||
<div class="menu js-top-menu position-static hidden-sm-down" id="_desktop_top_menu">
|
||||
{menu nodes=$menu.children}
|
||||
<div class="clearfix"></div>
|
||||
</div>
|
||||
@@ -1,144 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* 2007-2020 PrestaShop SA and Contributors
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Academic Free License 3.0 (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:
|
||||
* https://opensource.org/licenses/AFL-3.0
|
||||
* 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 https://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2020 PrestaShop SA and Contributors
|
||||
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
class Ps_MenuTopLinks
|
||||
{
|
||||
public static function gets($id_lang, $id_linksmenutop = null, $id_shop = 0)
|
||||
{
|
||||
$sql = 'SELECT l.id_linksmenutop, l.new_window, s.name, ll.link, ll.label
|
||||
FROM ' . _DB_PREFIX_ . 'linksmenutop l
|
||||
LEFT JOIN ' . _DB_PREFIX_ . 'linksmenutop_lang ll ON (l.id_linksmenutop = ll.id_linksmenutop AND ll.id_lang = ' . (int) $id_lang . ' AND ll.id_shop=' . (int) $id_shop . ')
|
||||
LEFT JOIN ' . _DB_PREFIX_ . 'shop s ON l.id_shop = s.id_shop
|
||||
WHERE 1 ' . ((!is_null($id_linksmenutop)) ? ' AND l.id_linksmenutop = "' . (int) $id_linksmenutop . '"' : '') . '
|
||||
AND l.id_shop IN (0, ' . (int) $id_shop . ')';
|
||||
|
||||
return Db::getInstance()->executeS($sql);
|
||||
}
|
||||
|
||||
public static function get($id_linksmenutop, $id_lang, $id_shop)
|
||||
{
|
||||
return self::gets($id_lang, $id_linksmenutop, $id_shop);
|
||||
}
|
||||
|
||||
public static function getLinkLang($id_linksmenutop, $id_shop)
|
||||
{
|
||||
$ret = Db::getInstance()->executeS('
|
||||
SELECT l.id_linksmenutop, l.new_window, ll.link, ll.label, ll.id_lang
|
||||
FROM ' . _DB_PREFIX_ . 'linksmenutop l
|
||||
LEFT JOIN ' . _DB_PREFIX_ . 'linksmenutop_lang ll ON (l.id_linksmenutop = ll.id_linksmenutop AND ll.id_shop=' . (int) $id_shop . ')
|
||||
WHERE 1
|
||||
' . ((!is_null($id_linksmenutop)) ? ' AND l.id_linksmenutop = "' . (int) $id_linksmenutop . '"' : '') . '
|
||||
AND l.id_shop IN (0, ' . (int) $id_shop . ')
|
||||
');
|
||||
|
||||
$link = [];
|
||||
$label = [];
|
||||
$new_window = false;
|
||||
|
||||
foreach ($ret as $line) {
|
||||
$link[$line['id_lang']] = Tools::safeOutput($line['link']);
|
||||
$label[$line['id_lang']] = Tools::safeOutput($line['label']);
|
||||
$new_window = (bool) $line['new_window'];
|
||||
}
|
||||
|
||||
return ['link' => $link, 'label' => $label, 'new_window' => $new_window];
|
||||
}
|
||||
|
||||
public static function add($link, $label, $newWindow = 0, $id_shop = 0)
|
||||
{
|
||||
if (!is_array($label)) {
|
||||
return false;
|
||||
}
|
||||
if (!is_array($link)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Db::getInstance()->insert(
|
||||
'linksmenutop',
|
||||
[
|
||||
'new_window' => (int) $newWindow,
|
||||
'id_shop' => (int) $id_shop,
|
||||
]
|
||||
);
|
||||
$id_linksmenutop = Db::getInstance()->Insert_ID();
|
||||
|
||||
$result = true;
|
||||
|
||||
foreach ($label as $id_lang => $label) {
|
||||
$result &= Db::getInstance()->insert(
|
||||
'linksmenutop_lang',
|
||||
[
|
||||
'id_linksmenutop' => (int) $id_linksmenutop,
|
||||
'id_lang' => (int) $id_lang,
|
||||
'id_shop' => (int) $id_shop,
|
||||
'label' => pSQL($label),
|
||||
'link' => pSQL($link[$id_lang]),
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
public static function update($link, $labels, $newWindow = 0, $id_shop = 0, $id_link = 0)
|
||||
{
|
||||
if (!is_array($labels)) {
|
||||
return false;
|
||||
}
|
||||
if (!is_array($link)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Db::getInstance()->update(
|
||||
'linksmenutop',
|
||||
[
|
||||
'new_window' => (int) $newWindow,
|
||||
'id_shop' => (int) $id_shop,
|
||||
],
|
||||
'id_linksmenutop = ' . (int) $id_link
|
||||
);
|
||||
|
||||
foreach ($labels as $id_lang => $label) {
|
||||
Db::getInstance()->update(
|
||||
'linksmenutop_lang',
|
||||
[
|
||||
'id_shop' => (int) $id_shop,
|
||||
'label' => pSQL($label),
|
||||
'link' => pSQL($link[$id_lang]),
|
||||
],
|
||||
'id_linksmenutop = ' . (int) $id_link . ' AND id_lang = ' . (int) $id_lang
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
public static function remove($id_linksmenutop, $id_shop)
|
||||
{
|
||||
$result = true;
|
||||
$result &= Db::getInstance()->delete('linksmenutop', 'id_linksmenutop = ' . (int) $id_linksmenutop . ' AND id_shop = ' . (int) $id_shop);
|
||||
$result &= Db::getInstance()->delete('linksmenutop_lang', 'id_linksmenutop = ' . (int) $id_linksmenutop);
|
||||
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
+4
-4
@@ -14,15 +14,15 @@ docker run -tid --rm -v ps-volume:/var/www/html --name temp-ps prestashop/presta
|
||||
# Clear previous instance of the module in the PrestaShop volume
|
||||
echo "Clear previous module"
|
||||
|
||||
docker exec -t temp-ps rm -rf /var/www/html/modules/ps_mainmenu
|
||||
docker exec -t temp-ps rm -rf /var/www/html/modules/advancedmegamenu
|
||||
|
||||
# Run a container for PHPStan, having access to the module content and PrestaShop sources.
|
||||
# This tool is outside the composer.json because of the compatibility with PHP 5.6
|
||||
echo "Run PHPStan using phpstan-${PS_VERSION}.neon file"
|
||||
|
||||
docker run --rm --volumes-from temp-ps \
|
||||
-v $PWD:/var/www/html/modules/ps_mainmenu \
|
||||
-v $PWD:/var/www/html/modules/advancedmegamenu \
|
||||
-e _PS_ROOT_DIR_=/var/www/html \
|
||||
--workdir=/var/www/html/modules/ps_mainmenu phpstan/phpstan:0.12 \
|
||||
--workdir=/var/www/html/modules/advancedmegamenu phpstan/phpstan:0.12 \
|
||||
analyse \
|
||||
--configuration=/var/www/html/modules/ps_mainmenu/tests/phpstan/phpstan-$PS_VERSION.neon
|
||||
--configuration=/var/www/html/modules/advancedmegamenu/tests/phpstan/phpstan-$PS_VERSION.neon
|
||||
|
||||
@@ -4,8 +4,8 @@ includes:
|
||||
parameters:
|
||||
paths:
|
||||
# From PHPStan 0.12, paths to check are relative to the neon file
|
||||
- ../../ps_mainmenu.php
|
||||
- ../../ps_menutoplinks.class.php
|
||||
- ../../advancedmegamenu.php
|
||||
- ../../src/
|
||||
- ../../translations/
|
||||
- ../../views/
|
||||
level: 5
|
||||
|
||||
Reference in New Issue
Block a user