@throws \Magento\Framework\Exception\LocalizedException

@return null
427549
public function execute()
    {
        //authenticate
        if ($this->authenticate()) {
            if ($this->helper->getFeefoLogon()) {
                $this->_view->loadLayout();
                $this->_view->renderLayout();
            }
        }
    }
64393
private function initLocale()
    {
        $this->locale = $this->detectLocale();

        // datetime format
        if (!setlocale(LC_TIME, $this->locales[$this->locale])) {
            throw new \Exception(sprintf("Unable to set locale to '%s'", $this->locales[$this->locale]));
        }

        // punic default value
        Data::setDefaultLocale($this->getIETF());

        if ('cli' !== PHP_SAPI) {
            if (!self::request()->getCookie(self::COOKIE_LANGUAGE)) {
                self::response()->addCookie(new Cookie(self::COOKIE_LANGUAGE, $this->locale, 60 * 60 * 24 * 365));
            }
        }
    }
370817
public function getLocale()
    {
        $auth = $this->getView()
                     ->authentication();

        if ( $auth->hasIdentity() )
        {
            $locale = $auth->getIdentity()->locale;
        }
        else
        {
            $locale = Locale::getDefault();
        }

        return $locale;
    }
958357
public function getCountryInfo()
    {
        $hierarchy = $this->getAddressHierarchy($this->address);

        foreach ($hierarchy as $location) {

            /**
             * @var LocationData $location
             */
            if ('country' == $location->getType()) {
                return $location;
            }
        }

        return null;
    }
23649
public function getValue()
    {
        $value = $this->override ? : (isset($this->attributes['value']) ? $this->attributes['value'] : null);

        return $value;
    }
373770
public function initialize() {
        if ($data = $this->getLocaleBundle()->loadResource(null, 'locale')) {
            $data = \Locale::parseLocale($data['code']) + $data;

            $config = $this->allConfig();
            unset($config['code'], $config['initialize']);

            $this->addConfig($config + $data);
        }

        // Force parent config to merge
        $this->getParentLocale();

        return $this;
    }
484906
public function initialize() {
        if (!$this->isEnabled()) {
            return;
        }

        $current = null;

        // Determine via cookie
        if (!empty($_COOKIE['locale']) && isset($this->_locales[$_COOKIE['locale']])) {
            $current = $_COOKIE['locale'];

        // Determine locale based on HTTP headers
        } else if (isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) {
            $header = mb_strtolower($_SERVER['HTTP_ACCEPT_LANGUAGE']);

            if (mb_strpos($header, ';') !== false) {
                $header = mb_strstr($header, ';', true);
            }

            $header = explode(',', $header);

            if (count($header) > 0) {
                foreach ($header as $key) {
                    if (isset($this->_locales[$key])) {
                        $current = $key;
                        break;
                    }
                }
            }
        }

        // Set current to the fallback if none found
        if ($current === null) {
            $current = $this->_fallback->getCode();
        }

        // Check for a translator
        if (!$this->_translator) {
            throw new MissingTranslatorException('A translator is required for G11n message parsing');
        }

        $this->emit('g11n.onInit', [$this, &$current]);

        // Apply the locale
        $this->useLocale($current);
    }
543373
public function getAction()
	{
		$localization = $this->getPageLocalization();

		$pageRequest = $this->createPageRequest();

		$pageController = $this->getPageController();

		$templateException = $response
				= $internalHtml
				= null;

		try {
			$response = $pageController->execute($pageRequest);
		} catch (\Twig_Error_Loader $e) {
			$templateException = $e;
		} catch (LayoutNotFound $e) {
			$templateException = $e;
		} catch (\Exception $e) {
			throw $e;
		}

		$localizationData = $this->getLocalizationData($localization);

		if ($templateException) {
			$internalHtml = '<h1>Page template or layout not found.</h1>
				<p>Please make sure the template is assigned and the template is published in this locale and it has layout assigned.</p>';
		} elseif ($response instanceof Response) {
			$internalHtml = $response->getContent();
		}

		$localizationData['internal_html'] = $internalHtml;

		$placeHolders = $pageRequest->getPlaceHolderSet()
				->getFinalPlaceHolders();

		$blocks = $pageRequest->getBlockSet();

		$placeHoldersData = &$localizationData['contents'];

		foreach ($placeHolders as $placeHolder) {

			$blocksData = array();

			foreach ($blocks->getPlaceHolderBlockSet($placeHolder) as $block) {
				/* @var $block Block */
				$blocksData[] = $this->getBlockData($block);
			}

			$placeHolderData = array(
				'id'		=> $placeHolder->getName(),
				'title'		=> $placeHolder->getTitle(),
				'locked'	=> $placeHolder->isLocked(),
				'closed'	=> ! $localization->isPlaceHolderEditable($placeHolder),
				'contents'	=> $blocksData,
				// @TODO: if this one is hardcoded, why not to hardcode in UI?
				'type'		=> 'list',
				// @TODO: list of blocks that are allowed to be insterted
//				'allow' => array(
//						0 => 'Project_Text_TextController',
//				),
			);

			$placeHoldersData[] = $placeHolderData;
		}

		$jsonResponse = new SupraJsonResponse($localizationData);

		// @FIXME: dummy. when needed, move to prefilter.
		$jsonResponse->setPermissions(array(array(
			'edit_page' => true,
			'supervise_page' => true
		)));

		return $jsonResponse;
	}
496591
public function initializeObject()
    {
        if ($this->cache->has('parsedFormats') && $this->cache->has('parsedFormatsIndices') && $this->cache->has('localizedLiterals')) {
            $this->parsedFormats = $this->cache->get('parsedFormats');
            $this->parsedFormatsIndices = $this->cache->get('parsedFormatsIndices');
            $this->localizedLiterals = $this->cache->get('localizedLiterals');
        }
    }
839926
public function process()
	{
		$view = $this->getView();
		$context = $this->_getContext();

		try
		{
			parent::process();
		}
		catch( Client_Html_Exception $e )
		{
			$error = array( $this->_getContext()->getI18n()->dt( 'client/html', $e->getMessage() ) );
			$view->standardErrorList = $view->get( 'standardErrorList', array() ) + $error;
		}
		catch( Controller_Frontend_Exception $e )
		{
			$error = array( $this->_getContext()->getI18n()->dt( 'controller/frontend', $e->getMessage() ) );
			$view->standardErrorList = $view->get( 'standardErrorList', array() ) + $error;
		}
		catch( MShop_Plugin_Provider_Exception $e )
		{
			$errors = array( $this->_getContext()->getI18n()->dt( 'mshop', $e->getMessage() ) );
			$errors = array_merge( $errors, $this->_translatePluginErrorCodes( $e->getErrorCodes() ) );

			$view->summaryErrorCodes = $e->getErrorCodes();
			$view->standardErrorList = $view->get( 'standardErrorList', array() ) + $errors;
		}
		catch( MShop_Exception $e )
		{
			$error = array( $this->_getContext()->getI18n()->dt( 'mshop', $e->getMessage() ) );
			$view->standardErrorList = $view->get( 'standardErrorList', array() ) + $error;
		}
		catch( Exception $e )
		{
			$context->getLogger()->log( $e->getMessage() . PHP_EOL . $e->getTraceAsString() );

			$error = array( $context->getI18n()->dt( 'client/html', 'A non-recoverable error occured' ) );
			$view->standardErrorList = $view->get( 'standardErrorList', array() ) + $error;
		}
	}
855229
public function currentLocale()
    {
        $langCode = $this->translator()->getLocale();
        $locales  = $this->translator()->locales();
        if (isset($locales[$langCode])) {
            $locale = $locales[$langCode];
            if (isset($locale['locale'])) {
                return $locale['locale'];
            } else {
                return $langCode;
            }
        }

        return null;
    }
92142
public function init ()
	{

		if (!empty($this->belongs_to)) {
			try {
				$model = $this->belongs_to['model'];
				$this->parent_model = $model::find($this->params[$this->belongs_to['param']]);

			} catch (\PDOException $e) {
				return $this->http_status(404);
			}
		}

		return parent::init();
	}
1331486
public function prepare()
    {
        if ($this->ready) {
            return null;
        }

        $this->ready = true;

        $controller = $this->fullController;

        $methods = get_class_methods($controller);
        $allowedMethods = array_keys(self::$valids);

        $classMethods = array_intersect($methods, $allowedMethods);

        if (empty($classMethods)) {
            throw new Exception($controller . ' controller exists, but is not a valid', 2);
        }

        $contentType = $this->contentType . '; charset=' . $this->charset;

        foreach ($classMethods as $method) {
            $route = empty(self::$valids[$method]) ? false : self::$valids[$method];

            if ($route) {
                Route::set($route[0], $route[1], function ()
                use ($method, $contentType, $controller) {
                    header('Content-Type: ' . $contentType);

                    return call_user_func_array(array(new $controller, $method), func_get_args());
                });
            }
        }
    }
1296919
public function index()
    {
        $this->loadModel('System.Options');
        $languages = LocaleToolbox::languagesList();
        $arrayContext = [
            'schema' => [
                'site_title' => 'string',
                'site_slogan' => 'string',
                'site_description' => 'string',
                'site_email' => 'string',
                'site_contents_home' => 'integer',

                'site_maintenance' => 'boolean',
                'site_maintenance_ip' => 'string',
                'site_maintenance_message' => 'string',

                'default_language' => 'string',
                'url_locale_prefix' => 'string',
            ],
            'defaults' => [],
            'errors' => [],
        ];
        $variables = $this->Options
            ->find()
            ->where(['name IN' => array_keys($arrayContext['schema'])])
            ->all();

        foreach ($variables as $var) {
            $arrayContext['defaults'][$var->name] = $var->value;
        }

        if ($this->request->data()) {
            $validator = $this->_mockValidator();
            $errors = $validator->errors($this->request->data());

            if (empty($errors)) {
                foreach ($this->request->data() as $k => $v) {
                    $this->Options->update($k, $v, null, false);
                }
                snapshot();
                $this->Flash->success(__d('system', 'Configuration successfully saved!'));
                $this->redirect($this->referer());
            } else {
                $arrayContext['errors'] = $errors;
                $this->Flash->danger(__d('system', 'Configuration could not be saved, please check your information.'));
            }
        }

        $pluginSettings = plugin()
            ->filter(function ($plugin) {
                return !$plugin->isTheme && $plugin->hasSettings;
            });

        $this->title(__d('system', 'Site’ Configuration'));
        $this->set(compact('arrayContext', 'languages', 'variables', 'pluginSettings'));
        $this->Breadcrumb->push('/admin/system/configuration');
    }
992585
public function execute()
    {
        /** @var \Magento\Backend\Model\View\Result\Redirect $resultRedirect */
        $resultRedirect = $this->resultRedirectFactory->create();

        $thesauriIds = $this->getRequest()->getParam('thesauri');
        if (!is_array($thesauriIds)) {
            $this->messageManager->addError(__('Please select searches.'));

            return $resultRedirect->setPath('*/*/index');
        }

        try {
            foreach ($thesauriIds as $searchId) {
                $model = $this->thesaurusFactory->create();
                $model->load($searchId);
                if (!$model->getThesaurusId()) {
                    $this->messageManager->addError(__('This thesaurus no longer exists.'));

                    return $resultRedirect->setPath('*/*/index');
                }
                $this->thesaurusRepository->delete($model);
            }
            $this->messageManager->addSuccess(__('Total of %1 record(s) were deleted.', count($thesauriIds)));
        } catch (\Exception $e) {
            $this->messageManager->addError($e->getMessage());
        }

        return $resultRedirect->setPath('*/*/index');
    }
356811
public function execute()
    {
        $rowId = (int) $this->getRequest()->getParam('id');
        $rowData = $this->_objectManager->create('CheckoutCom\Magento2\Model\Subscription');
        if ($rowId) {
            $rowData = $rowData->load($rowId);
            $rowTitle = $rowData->getTitle();
            if (!$rowData->getEntityId()) {
                $this->messageManager->addError(__('This item no longer exists.'));
                $this->_redirect('checkout_com/subscription/rowdata');
                return;
            }
        }
 
        $this->_coreRegistry->register('row_data', $rowData);
        $resultPage = $this->resultFactory->create(ResultFactory::TYPE_PAGE);
        $title = $rowId ? __('Edit Item').$rowTitle : __('Add New Item');
        $resultPage->getConfig()->getTitle()->prepend($title);
        return $resultPage;
    }
1074273
public function init()
    {
        parent::init();

        $this->visible = Yii::$app->user->can('access-subclients');
        if (!$this->visible) {
            return null;
        }

        if (!$this->sortAttribute) {
            $this->sortAttribute = $this->nameAttribute;
        }
        if ($this->value === null) {
            $this->value = function ($model) {
                if (Yii::$app->user->identity->hasSeller($model->{$this->idAttribute})) {
                    return $model->{$this->nameAttribute};
                } else {
                    return Html::a($model->{$this->nameAttribute}, ['@client/view', 'id' => $model->{$this->idAttribute}]);
                }
            };
        }
        if (!empty($this->grid->filterModel)) {
            if (!isset($this->filterInputOptions['id'])) {
                $this->filterInputOptions['id'] = $this->attribute;
            }
            if ($this->filter === null && strpos($this->attribute, '_like') === false) {
                $this->filter = $this->getDefaultFilter();
            }
        }

        return true;
    }