public function onStart()
 {
     if (App::getLocale() == 'en') {
         header("Location: /presentation");
         die;
     }
 }
 public function onStart()
 {
     if (App::getLocale() == 'en') {
         header("Location: /s***n-selling");
         die;
     }
 }
 public function showIndex()
 {
     $page = $this->node;
     $tree = Collector::get('root');
     $subTree = Tree::getSubTree($tree, $page);
     $blocks = null;
     if ($subTree) {
         $blocks = $subTree->children;
     }
     foreach ($blocks as $index => $block) {
         $blocks[$block->slug] = $block;
         unset($blocks[$index]);
     }
     if (isset($blocks['reporting'])) {
         $blocks['reporting']->children = $blocks['reporting']->children->reverse();
         $reporting = $blocks['reporting'];
     }
     $flatArticles = Cache::tags('j_tree')->rememberForever('about_flat_articles_' . App::getLocale(), function () use($page) {
         return $page->immediateDescendants()->active()->get();
     });
     $articles = array();
     foreach ($flatArticles as $article) {
         $articles[$article->slug] = $article;
     }
     $pressSections = null;
     if (isset($articles['press']) && $articles['press']->count()) {
         $pressSubTree = Tree::getSubTree($tree, $articles['press']);
         if ($pressSubTree) {
             $pressSections = $pressSubTree->children;
         }
     }
     return View::make('about.index', compact('page', 'reporting', 'articles', 'pressSections'));
 }
Beispiel #4
3
function baseUrl()
{
    $fallback = Config::get('app.fallback_locale');
    $lang = App::getLocale();
    $locale = $lang == $fallback ? '' : '/' . $lang;
    return url() . $locale;
}
Beispiel #5
1
 public function onStart()
 {
     if (App::getLocale() == 'en') {
         header("Location: /gallery");
         die;
     }
 }
Beispiel #6
0
 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function handle()
 {
     $c = strtolower($this->argument('controller'));
     $files = [];
     $files[] = mkny_models_path($c) . '.php';
     $files[] = mkny_model_config_path($c) . '.php';
     $files[] = mkny_presenters_path($c) . 'Presenter.php';
     $files[] = mkny_controllers_path($c) . 'Controller.php';
     $files[] = mkny_requests_path($c) . 'Request.php';
     $files[] = mkny_lang_path(\App::getLocale() . '/' . $c) . '.php';
     $errors = [];
     foreach ($files as $file) {
         if (!$this->files->exists($file)) {
             $errors[] = $file;
         }
     }
     if (!$this->option('force') && count($errors)) {
         $this->error("Nao foi possivel executar o delete-automatico!\nAlguns arquivos estao ausentes!");
     } else {
         if ($this->option('force') || $this->confirm("Deseja realmente remover os arquivos: \n'" . implode("',\n'", $files))) {
             foreach ($files as $file) {
                 $this->files->delete($file);
             }
             $this->info('Deleted!');
         }
     }
 }
 /**
  * store created user
  *
  * @param UsersFormRequest $request
  * @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
  */
 public function store(UsersFormRequest $request)
 {
     $data = $request->all();
     $user = $this->userRepository->create($data);
     $user->attachRole($request->get('role'));
     return redirect()->to(\App::getLocale() . '/admin/users');
 }
 public function getAttribute($key)
 {
     if (!isset($this->localizedFields) or !in_array($key, $this->localizedFields)) {
         return parent::getAttribute($key);
     }
     return $this->getTranslation($key, \App::getLocale());
 }
 public function onStart()
 {
     if (App::getLocale() == 'en') {
         header("Location: /contacts");
         die;
     }
 }
 public function getHome()
 {
     Session::put('old_RequestSegment2', '');
     //is root?
     //if (Request::is('/') && Locale::countEnable() > 1) return Redirect::to('/' . App::getLocale(), 301);
     //is OnePage?
     if (Config::get('core::display.onepage')) {
         $data = array();
         $data['onepage'] = OnePage::first();
         return View::make('theme::public.onepage', $data);
     } else {
         //Find good page
         $urls = Urls::getRoutes();
         foreach ($urls as $url) {
             if ($url['url'] == '/' && $url['locale_id'] == App::getLocale()) {
                 $structure = Structure::where('i18n_url', $url['i18n_id'])->first();
                 if (!empty($structure)) {
                     if ($structure->structurable_type != 'OnePage') {
                         $page = $structure->structurable;
                         return View::make('pager::public.pages.page', compact('page'));
                     }
                 }
             }
         }
         return App::abort(404);
     }
 }
Beispiel #11
0
 /**
  * @param \Illuminate\Foundation\Application $app
  */
 protected function setUpRoutes($app)
 {
     \Route::get('/', ['middleware' => 'localize', function () {
         return 'Whoops';
     }]);
     \Route::get('/ca', ['middleware' => 'localize', function () {
         return 'Whoops ca';
     }]);
     \Route::post('/', ['middleware' => 'localize', function () {
         return 'POST answer';
     }]);
     \Route::get('/es', ['middleware' => 'localize', function () {
         return 'Hola mundo';
     }]);
     \Route::get('/en', ['middleware' => 'localize', function () {
         return 'Hello world';
     }]);
     \Route::get('/en/locale', ['middleware' => 'localize', function () {
         return \App::getLocale();
     }]);
     \Route::get('/es/locale', ['middleware' => 'localize', function () {
         return \App::getLocale();
     }]);
     \Route::get('/api/v1/en/locale', ['middleware' => 'localize:2', function () {
         return \App::getLocale();
     }]);
     \Route::get('/api/v1/es/locale', ['middleware' => 'localize:2', function () {
         return \App::getLocale();
     }]);
     \Route::get('/api/v1/ca/locale', ['middleware' => 'localize:2', function () {
         return 'Whoops ca';
     }]);
 }
function getLangSwitch()
{
    $local = App::getLocale();
    $host = Config::get('app.host');
    $fr = '/fr';
    $de = '/de';
    $en = '/en';
    if ($host == 'convergedmaturity.com' || $host == 'convergedmaturity.co.uk' || $host == 'certus.convergedmaturity.co.uk' || $host == 'dellconverged.app' || $host == 'itf.convergedmaturity.com' || $host == 'infoniqa.convergedmaturity.com') {
        $en = '';
    } elseif ($host == 'convergedmaturity.fr') {
        $fr = '';
    } elseif ($host == 'bereit-fuer-konvergente-infrastruktur.de' || $host == 'niteflite.bereit-fuer-konvergente-infrastruktur.de') {
        $de = '';
    }
    switch ($local) {
        case 'en':
            return "\n\t\t\t<li><a href=" . Request::root() . $fr . "><i class=\"flag fr\"></i> French</a></li>\n\t\t\t<li><a href=" . Request::root() . $de . "><i class=\"flag de\"></i> German</a></li>\n\t\t\t";
            break;
        case 'fr':
            return "\n\t\t\t<li><a href=" . Request::root() . $en . "><i class=\"flag\"></i> English</a></li>\n\t\t\t<li><a href=" . Request::root() . $de . "><i class=\"flag de\"></i> German</a></li>\n\t\t\t";
            break;
        case 'de':
            return "\n\t\t\t<li><a href=" . Request::root() . $en . "><i class=\"flag\"></i> English</a></li>\n\t\t\t<li><a href=" . Request::root() . $fr . "><i class=\"flag fr\"></i> French</a></li>\n\t\t\t";
            break;
    }
}
 private function registerRoutes()
 {
     Route::get('/account', MainController::class . '@index');
     Route::get('/account/forms/fields', MainController::class . '@forms');
     Route::post('/account/forms/user', MainController::class . '@formUser');
     Route::post('/account/forms/password', MainController::class . '@formPassword');
     Route::post('/account/forms/card/save', MainController::class . '@formCardSave');
     Route::post('/account/forms/autopay/save', MainController::class . '@formAutopaySave');
     Route::post('/account/forms/card/remove', MainController::class . '@formCardRemove');
     Route::get('/account/orders', MainController::class . '@orders');
     Route::get('/account/history', MainController::class . '@history');
     Route::get('/account/order/{id}', MainController::class . '@order');
     Route::get('/account/order/services/{id}', MainController::class . '@orderServices');
     Route::get('/account/order/services/pdf/{id}', MainController::class . '@orderServicesPdf');
     Route::get('/account/pay/init/{id}/{target}/{reset}', MainController::class . '@pay');
     Route::get('/account/new_card', MainController::class . '@newCard');
     Route::post('/account/delete_card', MainController::class . '@deleteCard');
     Route::post('/account/autopay', MainController::class . '@autopay');
     Route::post('/account/pay_finish', MainController::class . '@payFinish');
     Route::get('/account/pay/card', MainController::class . '@card');
     Route::get('/account/prepayment', MainController::class . '@prepayment');
     Route::post('/account/pay_by_token', MainController::class . '@payByToken');
     Route::get('/account/pay/check/{id}', MainController::class . '@checkPay');
     Route::post('/account/pay/token', MainController::class . '@token');
     Route::post('/account/pay/refund', MainController::class . '@refund');
     Route::get('/account/flash/message/{type}', ServiceController::class . '@flash');
     Route::get('/account/bonus', MainController::class . '@bonus');
     Route::get('/account/order/review/{id}', MainController::class . '@review');
     Route::post('/account/order/review', MainController::class . '@reviewOrder');
     Route::get('/account/subscriptions', MainController::class . '@subscriptions');
     Route::get('/account/customers_cards', MainController::class . '@customersCards');
     Route::get('/account/lang/{lang}', ['as' => 'lang.set', 'before' => 'lang.set', function () {
         return App::getLocale();
     }]);
 }
Beispiel #14
0
 public function comments($params = array())
 {
     $settings = array();
     $language = false;
     $settings['disqus_shortname'] = $this->config->get('laravel-disqus::disqus_shortname');
     if (isset($params['disqus_identifier'])) {
         $settings['disqus_identifier'] = $params['disqus_identifier'];
     }
     if (isset($params['disqus_title'])) {
         $settings['disqus_title'] = $params['disqus_title'];
     }
     if (isset($params['disqus_url'])) {
         $settings['disqus_url'] = $params['disqus_url'];
     }
     if (isset($params['disqus_category_id'])) {
         $settings['disqus_category_id'] = $params['disqus_category_id'];
     }
     if (true === $this->config->get('laravel-disqus::auto_set_language')) {
         $language = $this->getDisqusLanguage(\App::getLocale());
     }
     if (isset($params['language'])) {
         $language = $params['language'];
     }
     return \View::make('laravel-disqus::disqus.comments', array('settings' => $settings, 'language' => $language));
 }
 function geturl($url, $attributes = array())
 {
     if (!$url) {
         $url = '/';
     }
     return LaravelLocalization::getLocalizedURL(App::getLocale(), $url, $attributes);
 }
 public function translate($filename, $to)
 {
     $tc = new TranslateClient();
     $tc->setSource(\App::getLocale());
     $tc->setTarget($to);
     if ($this->hasConnection()) {
         if (file_exists(base_path() . '\\resources\\lang\\' . \App::getLocale() . '\\' . $filename . '.php')) {
             if ($this->isValidLocale($to)) {
                 $array = $this->getWordsForTranslate($filename);
                 $afterTranslate = [];
                 foreach ($array as $key => $word) {
                     $afterTranslate[$key] = $tc->translate($word);
                 }
                 if (!file_exists(base_path() . '\\resources\\lang\\' . $to)) {
                     mkdir(base_path() . '\\resources\\lang\\' . $to, 0777, true);
                 }
                 $content = '<?php ' . PHP_EOL . 'return' . PHP_EOL . var_export($afterTranslate, true) . '; ?>';
                 $this->setFileContent($content, $filename, $to);
             } else {
                 throw new \Exception('The location is invalid for option --to');
             }
         } else {
             throw new \Exception('This file name does not exist in the language directory.');
         }
     } else {
         throw new \Exception('Error! Check your internet connection!');
     }
 }
Beispiel #17
0
 function day_localize($day, $is = "en", $localize = "tr")
 {
     $localize = \App::getLocale();
     $days['locale']['D'] = [trans('whole::http/helpers.monday'), trans('whole::http/helpers.tuesday'), trans('whole::http/helpers.wednesday'), trans('whole::http/helpers.thursday'), trans('whole::http/helpers.friday'), trans('whole::http/helpers.saturday'), trans('whole::http/helpers.sunday')];
     $days['en']['D'] = ['Monday ', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday'];
     return $days['locale']['D'][array_search($day, $days[$is]['D'])];
 }
 protected function checkLocale()
 {
     $locale = \App::getLocale();
     if ($this->locale != $locale) {
         $this->locale = $locale;
     }
 }
Beispiel #19
0
 public static function requestResult($result)
 {
     switch (\App::getLocale()) {
         case 'ru':
             $array['nothing'] = 'Ничего не было найдено';
             $array['noright'] = 'У вас нет прав для удаления объекта';
             $array['delok'] = 'Успешно удалено';
             $array['delfail'] = 'Возникла ошибка при удалении';
             $array['changeok'] = 'Данные были успешно изменены';
             $array['changefail'] = 'Произошел сбой при изменении';
             $array['confirm'] = 'Ваш email подтвержден';
             $array['unconfirm'] = 'Произошел сбой. Ваш email не был подтвержден!';
             $array['faillogin'] = '******';
             return $array[$result];
         default:
             $array['nothing'] = 'Nothing has been found';
             $array['noright'] = 'You have no rights to delete objects';
             $array['delok'] = 'Object has been deleted';
             $array['delfail'] = 'The error has occurred while deleting';
             $array['changeok'] = 'The data was successfully updated';
             $array['changefail'] = 'The update has failed';
             $array['confirm'] = 'Your email has been confirmed';
             $array['unconfirm'] = 'Something has gone wrong. Your email has not been confirmed';
             $array['faillogin'] = '******';
             return $array[$result];
     }
 }
 public function showMain()
 {
     $page = $this->node;
     $tree = Collector::get('root');
     $subTree = Tree::getSubTree($tree, $page);
     $blocks = null;
     if ($subTree) {
         $blocks = $subTree->children;
     }
     foreach ($blocks as $index => $block) {
         $blocks[$block->slug] = $block;
         unset($blocks[$index]);
     }
     $allRates = Cache::tags('rates')->rememberForever('rates_' . App::getLocale(), function () {
         return Rates::orderPriority()->get();
     });
     $rates = array();
     foreach ($allRates as $i => $rate) {
         if ($rate['type'] == 1) {
             $rates['departments'][] = $rate;
         } else {
             $rates['cards'][$rate['name_card']][] = $rate;
         }
     }
     $calculatorCredit = new CashCalculator();
     // fixme:
     //$calculatorCredit->setMonthlyIncome(Settings::get('monthly_income_default', 0));
     $calculatorCredit->setCreditAmount(Settings::get('credit_amount_default', 100000));
     $calculatorCredit->setTerm(Settings::get('term_default', 3));
     $calculationsCredit = $calculatorCredit->calculate();
     return View::make('index', compact('page', 'blocks', 'rates', 'calculationsCredit'));
 }
 public function onStart()
 {
     if (App::getLocale() == 'en') {
         header("Location: /offspring");
         die;
     }
 }
Beispiel #22
0
function products_root()
{
    if (\App::getLocale() == 'no') {
        return '/produkter/';
    }
    return '/vorur/';
}
Beispiel #23
0
 public function getUrlAttribute()
 {
     $defaultLocale = config('gtcmslang.defaultLocale');
     $propertyName = config('gtcms.premium') && config('gtcmslang.siteIsMultilingual') ? "slug_" . \App::getLocale() : "slug";
     $langPrefix = \App::getLocale() == $defaultLocale ? '' : "/" . \App::getLocale();
     return \Request::root() . $langPrefix . "/" . $this->{$propertyName};
 }
Beispiel #24
0
 public function getFile($lang = false, $module = false)
 {
     // dd(view()->shared('controller'));
     // app('request')->attributes->get('controller');
     if (!$lang) {
         $lang = \App::getLocale();
     }
     // Busca o arquivo especificado
     $cfg_file = mkny_lang_path($lang . '/' . $module) . '.php';
     // Field types
     $f_types = array_unique(array_values(app()->make('Mkny\\Cinimod\\Logic\\AppLogic')->_getFieldTypes()));
     // Se o diretorio nao existir
     if (!realpath(dirname($cfg_file))) {
         \File::makeDirectory(dirname($cfg_file));
     }
     // Config file data
     if (!\File::exists($cfg_file)) {
         \File::put($cfg_file, "<?php return array( 'teste' => 'teste' );");
     }
     // Arquivo aberto
     $config_str = \File::getRequire($cfg_file);
     $arrFields = array();
     foreach ($config_str as $field_name => $field_value) {
         if (!is_string($field_value)) {
             $arrFields[$field_name] = array('name' => $field_name, 'trans' => $field_name, 'values' => $field_value, 'type' => 'multi');
         } else {
             $arrFields[$field_name] = array('name' => $field_name, 'trans' => $field_name, 'default_value' => $field_value, 'type' => 'string');
         }
     }
     return view('cinimod::admin.generator.trans_detailed')->with(['form' => app()->make('\\Mkny\\Cinimod\\Logic\\FormLogic', [['fields-default-class' => 'form-control']])->getForm(false, action('\\' . get_class($this) . '@postFile', [$lang, $module]), $arrFields, $module)]);
 }
 function __($key)
 {
     $client = new Client(['base_uri' => env('TRANSLATE_URL')]);
     $translate = $client->get('api/translate', ['query' => ['key' => $key, 'locale' => App::getLocale()]]);
     if ($translate->getStatusCode() === 200) {
         return $translate->getBody()->getContents();
     }
 }
Beispiel #26
0
 /**
  * Converts string to uppercase depending on the language
  * This helper mainly resolves the issue for Turkish i => İ
  * This should otherwise be done with CSS
  *
  * @param string $string
  * @param string $locale
  * @return string
  */
 function uppercase($string, $locale = null)
 {
     $locale = $locale ?: App::getLocale();
     if ($locale === 'tr') {
         return mb_strtoupper(str_replace('i', 'İ', $string), 'UTF-8');
     }
     return mb_strtoupper($string, 'UTF-8');
 }
 public function showCatalogFirst()
 {
     $page = $this->node;
     $products = Cache::tags('j_tree')->rememberForever('financial_products_' . App::getLocale(), function () use($page) {
         return $page->immediateDescendants()->active()->catalogItems()->get();
     });
     return View::make('financial.catalog_first', compact('page', 'products'));
 }
Beispiel #28
0
 /**
  * Additional Method
  *
  * @var string
  */
 public static function translate($key, $locale_id = null)
 {
     $i18n_id = Config::get('option.i18n_' . $key);
     if ($locale_id === null) {
         $locale_id = App::getLocale();
     }
     return I18n::getTranslation($i18n_id, $locale_id);
 }
Beispiel #29
0
 public function onStart()
 {
     $this['lang'] = App::getLocale();
     /*if(App::getLocale() == 'en'){
           header("Location: /presentation");
           die();
       }*/
 }
 public function showCatalogSecond()
 {
     $page = $this->node;
     $products = Cache::tags('j_tree')->rememberForever('small_business_products_catalog_' . $page->id . '_' . App::getLocale(), function () use($page) {
         return $page->immediateDescendants()->where('is_active', 'like', '%' . App::getLocale() . '%')->get();
     });
     return View::make('small-business.catalog_second', compact('page', 'products'));
 }