public static function getMenuTree($arr, $navigation = '') { $class = ''; echo '<ul class="' . $navigation . '">'; foreach ($arr as $a) { if (isset($a->children[0])) { $class = "current dropdown"; } echo '<li class="' . $class . '">'; echo '<a href="' . $a->url . '">' . \L10nHelper::get($a) . '</a>'; if (isset($a->children[0])) { self::getMenuTree($a->children); } echo '</li>'; } echo '</ul>'; }
<?php $request = Request(); if ($request->has('lang')) { $lang = $request->input('lang'); \L10nHelper::setLocale($lang); } else { if ($request->cookie('lang')) { \L10nHelper::setLocale($request->cookie('lang')); } else { $lang = 'geo'; \L10nHelper::setLocale($lang); } } Route::get('/', ['uses' => 'SiteController@index', 'as' => 'site.index']); Route::get('login', ['uses' => 'SiteController@ShowLogin', 'as' => 'site.login.show']); Route::post('login', ['uses' => 'SiteController@checkLogin']); Route::get('logout', ['uses' => 'SiteController@logout', 'as' => 'site.log.out']); Route::get('account', ['uses' => 'SiteController@ShowAccount', 'as' => 'site.account.show']); Route::get('checkout', ['uses' => 'SiteController@ShowCheckOut', 'as' => 'site.checkout.show']); Route::get('hot', ['uses' => 'SiteController@ShowHotItems', 'as' => 'site.hot.show']); Route::post('account', ['uses' => 'UserController@AddCard']); Route::get('registration', ['uses' => 'SiteController@ShowRegistration', 'as' => 'site.registration.show']); Route::get('category/{id}', ['uses' => 'SiteController@ShowCategoryItems', 'as' => 'site.categoryitems.show']); Route::get('subcategory/{id}', ['uses' => 'SiteController@ShowSubCategoryItems', 'as' => 'site.subcategoryitems.show']); Route::post('registration', ['uses' => 'UserController@store']); Route::get('terms', ['uses' => 'SiteController@ShowTerms', 'as' => 'site.terms.show']); Route::get('item/{slug}/{id}', ['uses' => 'SiteController@ShowItemDetail', 'as' => 'site.ItemDetail.show']); Route::get('contact', ['uses' => 'SiteController@ShowContact', 'as' => 'site.contact.show']); Route::post('contact', ['uses' => 'SiteController@SendMail']); Route::get('library', ['uses' => 'SiteController@ShowLibrary', 'as' => 'site.library.show']);
public static final function setLocale($l) { self::$lang = $l; setcookie("lang", $l, time() + 2628000); }