public function register() { Menu::macro('front', function () { return Menu::new()->setActiveFromRequest(locale()); }); Menu::macro('main', function () { return Menu::front()->addClass('nav__list')->url('/', 'Home'); }); Menu::macro('language', function () { return Menu::build(locales(), function (Menu $menu, string $locale) { return $menu->url($locale, strtoupper($locale)); })->setActiveFromRequest(); }); Menu::macro('articleSiblings', function (Article $article) { return $article->siblings->reduce(function (Menu $menu, Article $article) { return $menu->url($article->fullUrl, $article->name); }, Menu::front()); }); }
/** * @param Cruncher $cruncher * @param array $compilation * @return array */ protected function compileTableStatistics(Cruncher $cruncher, array $compilation) { $cacheKey = 'dashboard'; foreach (locales() as $locale) { $compilation = $this->compileTableLocaleStatistics($cruncher, $locale, $cacheKey, $compilation); } return $compilation; }
public function buildForm() { $this->add('name', 'text', ['rules' => 'required|max:255']); $this->add('public_url', 'text', ['attr' => ['disabled']]); foreach (locales() as $locale) { $this->add($locale, 'form', ['class' => 'Reactor\\Html\\Forms\\Documents\\EditTranslationForm', 'label_show' => false]); } }
/** * @param Form $form */ protected function determineLocaleField(Form $form) { if (locale_count() > 1) { $locales = []; foreach (locales() as $locale) { $locales[$locale] = trans('general.' . $locale); } $form->addAfter('type', 'locale', 'select', ['inline' => true, 'choices' => $locales, 'selected' => env('REACTOR_LOCALE')]); } }
public function getFullUrlAttribute() : string { $localeSegment = ''; if (locales()->count() > 1) { $localeSegment = '/' . locale(); } if ($this->technical_name === SpecialArticle::HOME) { return $localeSegment; } $parentUrl = $this->hasParent() ? $this->parent->url . '/' : ''; return "{$localeSegment}/{$parentUrl}{$this->url}"; }
public function update($id, FragmentRequest $request) { $fragment = Fragment::find($id); foreach (locales() as $locale) { $requestAttribute = "translated_{$locale}_text"; $fragment->setTranslation($locale, $request->get($requestAttribute)); } $fragment->save(); app('cache')->flush(); $eventDescription = fragment('back.events.updated', ['model' => 'Fragment', 'name' => $fragment->name]); flash()->success(strip_tags($eventDescription)); return redirect()->action('Back\\FragmentsController@index'); }
/** * Handle an incoming request. * * @param \Illuminate\Http\Request $request * @param \Closure $next * @return mixed */ public function handle($request, Closure $next) { // Set Reactor locale if (is_request_install() || is_request_reactor()) { $locale = env('REACTOR_LOCALE'); if (array_key_exists($locale, InstallHelper::$locales)) { set_app_locale($locale, false); } return $next($request); } // Else set site locale $locale = session('_locale', null) ?: (env('APP_AUTO_LOCALE', true) ? mb_substr($request->getPreferredLanguage(), 0, 2) : env('REACTOR_LOCALE')); if (in_array($locale, locales())) { set_app_locale($locale); } return $next($request); }
<?php include_once(dirname(__FILE__)."/frame.class.inc"); include_once(dirname(__FILE__)."/class.unix.inc"); include_once(dirname(__FILE__)."/class.postfix.inc"); if(isset($_GET["locales"])){locales();exit;} if(isset($_GET["foldersnames"])){foldersnames();exit;} if(isset($_GET["zarafa-user-create-store"])){zarafa_user_create_store();exit;} if(isset($_GET["DbAttachConverter"])){DbAttachConverter();exit;} if(isset($_GET["mbx-infos"])){mbx_infos();exit;} if(isset($_GET["csv-export"])){csv_export();exit;} while (list ($num, $ligne) = each ($_GET) ){$a[]="$num=$ligne";} writelogs_framework("unable to unserstand ".@implode("&",$a),__FUNCTION__,__FILE__,__LINE__); function locales(){ $unix=new unix(); $locale=$unix->find_program("locale"); exec("$locale -a 2>&1",$results); echo "<articadatascgi>". base64_encode(serialize($results))."</articadatascgi>"; } function foldersnames(){ $unix=new unix(); $php5=$unix->LOCATE_PHP5_BIN(); $zarafa=$unix->find_program("zarafa-server");
exit; } if (isset($_GET["webapp-version"])) { webapp_version(); exit; } if (isset($_GET["webaccess-version"])) { webaccess_version(); exit; } if (isset($_GET["audit-log"])) { audit_log(); exit; } if (isset($_GET["locales"])) { locales(); exit; } if (isset($_GET["foldersnames"])) { foldersnames(); exit; } if (isset($_GET["zarafa-user-create-store"])) { zarafa_user_create_store(); exit; } if (isset($_GET["DbAttachConverter"])) { DbAttachConverter(); exit; } if (isset($_GET["mbx-infos"])) {
protected function getHeaderColumns() : array { return collect(['group', 'key', 'contains_html', 'description'])->merge(locales()->map(function (string $locale) { return "text_{$locale}"; }))->toArray(); }
public function seo() : string { return locales()->map(function ($locale) { return collect($this->model->defaultSeoValues())->keys()->map(function ($attribute) use($locale) { $fieldName = translate_field_name("seo.{$attribute}", $locale); return $this->group([Form::label($fieldName, $this->getSeoLabel($attribute)), Form::text($fieldName, old($fieldName, $this->model->getTranslation('seo_values', $locale)[$attribute] ?? ''), ['placeholder' => $this->model->defaultSeoValues()[$attribute]])]); })->pipe(function (Collection $fields) use($locale) { return $this->languageFieldSet($locale, $fields->toArray()); }); })->implode(''); }
<span class="sr-only">Toggle navigation</span> </a> <div class="navbar-custom-menu"> <ul class="nav navbar-nav"> <li class="dropdown lang-menu"> <a href="#" class="dropdown-toggle" data-toggle="dropdown"> <b><?php echo $this->e(strtoupper(locale())); ?> </b> </a> <ul class="dropdown-menu"> <?php foreach (locales() as $locale => $language) { ?> <li><a href="<?php echo route('admin', $locale); ?> "><?php echo $this->e($language); ?> </a></li> <?php } ?> </ul> </li> <li class="dropdown exit">
/** * Sets the locale * * @param string $locale */ protected function setLocaleSession($locale) { if (in_array($locale, locales())) { session()->set('_locale', $locale); } }
?> ></textarea> </div> <div class="form-group"> <label for="language">Site Language</label> <select class="form-control" id="language" name="language" placeholder="admin" value="<?php echo $language; ?> " <?php if ($saved) { echo "disabled='disabled'"; } ?> > <?php foreach (locales() as $key => $value) { ?> <option value="<?php echo $key; ?> "><?php echo $value; ?> </option> <?php } ?> </select> </div> <div class="form-group"> <label for="timezone">Timezone</label>