Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecations and warnings fixes for I18n Navigation #1

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
18 changes: 10 additions & 8 deletions plugins/i18n_navigation/frontend.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -195,18 +195,20 @@ private static function getMenuImpl($breadcrumbs, $currenturl, $url, $levels, $s
global $filters;
$params = array($childurl, $pages[$childurl]['parent'],
preg_split('/\s*,\s*/', html_entity_decode(stripslashes(trim(@$pages[$childurl]['tags'])), ENT_QUOTES, 'UTF-8')));
foreach ($filters as $filter) {
if ($filter['filter'] == I18N_FILTER_VETO_NAV_ITEM) {
if (call_user_func_array($filter['function'], $params)) {
$showIt = false;
break;
if(!empty($filters)){
foreach ($filters as $filter) {
if ($filter['filter'] == I18N_FILTER_VETO_NAV_ITEM) {
if (call_user_func_array($filter['function'], $params)) {
$showIt = false;
break;
}
}
}
}
}
if ($showIt) {
$showChildren = !($show & I18N_FILTER_CURRENT) || in_array($childurl,$breadcrumbs);
$children = $showChildren ? self::getMenuImpl($breadcrumbs, $currenturl, $childurl, $levels-1, $show) : null;
$children = $showChildren ? self::getMenuImpl($breadcrumbs, $currenturl, $childurl, $levels-1, $show) : [];
Every0ne marked this conversation as resolved.
Show resolved Hide resolved
$menu[] = array(
'url' => $childurl,
'parent' => $pages[$childurl]['parent'],
Expand All @@ -221,7 +223,7 @@ private static function getMenuImpl($breadcrumbs, $currenturl, $url, $levels, $s
}
}
}
return count($menu) > 0 ? $menu : null;
return count($menu) > 0 ? $menu : [];
}

private static function hasChildren($url, $show=I18N_SHOW_NORMAL) {
Expand Down Expand Up @@ -357,7 +359,7 @@ class I18nNavigationItem {
private $deflang = null;
private $data = array();

public function I18nNavigationItem($item, $classes, $text, $title, $showTitles, $component) {
public function __construct($item, $classes, $text, $title, $showTitles, $component) {
$this->item = $item;
$this->classes = $classes;
$this->text = html_entity_decode($text, ENT_QUOTES, 'UTF-8');
Expand Down