@@ -28,33 +28,33 @@ discard block |
||
28 | 28 | * @param string $sitecode Unique code of the site to retrieve the categories for |
29 | 29 | * @return array Associative array with existing and new entries |
30 | 30 | */ |
31 | - public function getCategories(array $config, $tceForms = null, string $sitecode = 'default') : array |
|
31 | + public function getCategories( array $config, $tceForms = null, string $sitecode = 'default' ) : array |
|
32 | 32 | { |
33 | 33 | try { |
34 | - if (!isset($config['flexParentDatabaseRow']['pid'])) { |
|
35 | - throw new \Exception('No PID found in "flexParentDatabaseRow" array key: ' . print_r($config, true)); |
|
34 | + if( !isset( $config['flexParentDatabaseRow']['pid'] ) ) { |
|
35 | + throw new \Exception( 'No PID found in "flexParentDatabaseRow" array key: ' . print_r( $config, true ) ); |
|
36 | 36 | } |
37 | 37 | |
38 | 38 | $pid = $config['flexParentDatabaseRow']['pid']; |
39 | - $pageTSConfig = \TYPO3\CMS\Backend\Utility\BackendUtility::getPagesTSconfig($pid); |
|
39 | + $pageTSConfig = \TYPO3\CMS\Backend\Utility\BackendUtility::getPagesTSconfig( $pid ); |
|
40 | 40 | |
41 | - if (isset($pageTSConfig['tx_aimeos.']['mshop.']['locale.']['site'])) { |
|
41 | + if( isset( $pageTSConfig['tx_aimeos.']['mshop.']['locale.']['site'] ) ) { |
|
42 | 42 | $sitecode = $pageTSConfig['tx_aimeos.']['mshop.']['locale.']['site']; |
43 | 43 | } |
44 | 44 | |
45 | - $context = Base::context(Base::config()); |
|
46 | - $context->setEditor('flexform'); |
|
45 | + $context = Base::context( Base::config() ); |
|
46 | + $context->setEditor( 'flexform' ); |
|
47 | 47 | |
48 | - $localeManager = \Aimeos\MShop::create($context, 'locale'); |
|
49 | - $context->setLocale($localeManager->bootstrap($sitecode, '', '', false)); |
|
48 | + $localeManager = \Aimeos\MShop::create( $context, 'locale' ); |
|
49 | + $context->setLocale( $localeManager->bootstrap( $sitecode, '', '', false ) ); |
|
50 | 50 | |
51 | - $manager = \Aimeos\MShop::create($context, 'catalog'); |
|
52 | - $item = $manager->getTree(null, [], \Aimeos\MW\Tree\Manager\Base::LEVEL_TREE); |
|
51 | + $manager = \Aimeos\MShop::create( $context, 'catalog' ); |
|
52 | + $item = $manager->getTree( null, [], \Aimeos\MW\Tree\Manager\Base::LEVEL_TREE ); |
|
53 | 53 | |
54 | 54 | |
55 | - $config['items'] = array_merge($config['items'], $this->getCategoryList($item, $item->getName())); |
|
56 | - } catch(\Exception $e) { |
|
57 | - error_log($e->getMessage() . PHP_EOL . $e->getTraceAsString()); |
|
55 | + $config['items'] = array_merge( $config['items'], $this->getCategoryList( $item, $item->getName() ) ); |
|
56 | + } catch( \Exception $e ) { |
|
57 | + error_log( $e->getMessage() . PHP_EOL . $e->getTraceAsString() ); |
|
58 | 58 | } |
59 | 59 | |
60 | 60 | return $config; |
@@ -68,13 +68,13 @@ discard block |
||
68 | 68 | * @param string $breadcrumb Breadcrumb of the parent nodes |
69 | 69 | * @return array Associative array of category label / ID pairs |
70 | 70 | */ |
71 | - protected function getCategoryList(\Aimeos\MShop\Catalog\Item\Iface $item, string $breadcrumb) : array |
|
71 | + protected function getCategoryList( \Aimeos\MShop\Catalog\Item\Iface $item, string $breadcrumb ) : array |
|
72 | 72 | { |
73 | 73 | $result = []; |
74 | 74 | $result[] = [$breadcrumb, $item->getId()]; |
75 | 75 | |
76 | - foreach ($item->getChildren() as $child) { |
|
77 | - $result = array_merge($result, $this->getCategoryList($child, $breadcrumb . ' > ' . $child->getName())); |
|
76 | + foreach( $item->getChildren() as $child ) { |
|
77 | + $result = array_merge( $result, $this->getCategoryList( $child, $breadcrumb . ' > ' . $child->getName() ) ); |
|
78 | 78 | } |
79 | 79 | |
80 | 80 | return $result; |
@@ -30,7 +30,8 @@ discard block |
||
30 | 30 | */ |
31 | 31 | public function getCategories(array $config, $tceForms = null, string $sitecode = 'default') : array |
32 | 32 | { |
33 | - try { |
|
33 | + try |
|
34 | + { |
|
34 | 35 | if (!isset($config['flexParentDatabaseRow']['pid'])) { |
35 | 36 | throw new \Exception('No PID found in "flexParentDatabaseRow" array key: ' . print_r($config, true)); |
36 | 37 | } |
@@ -53,7 +54,9 @@ discard block |
||
53 | 54 | |
54 | 55 | |
55 | 56 | $config['items'] = array_merge($config['items'], $this->getCategoryList($item, $item->getName())); |
56 | - } catch(\Exception $e) { |
|
57 | + } |
|
58 | + catch(\Exception $e) |
|
59 | + { |
|
57 | 60 | error_log($e->getMessage() . PHP_EOL . $e->getTraceAsString()); |
58 | 61 | } |
59 | 62 |
@@ -27,34 +27,34 @@ |
||
27 | 27 | * @param string $sitecode Unique code of the site to retrieve the categories for |
28 | 28 | * @return array Associative array with existing and new entries |
29 | 29 | */ |
30 | - public function getTypes(array $config, $tceForms = null, string $sitecode = 'default') : array |
|
30 | + public function getTypes( array $config, $tceForms = null, string $sitecode = 'default' ) : array |
|
31 | 31 | { |
32 | 32 | try { |
33 | - if (!isset($config['flexParentDatabaseRow']['pid'])) { |
|
34 | - throw new \Exception('No PID found in "flexParentDatabaseRow" or "row" array key: ' . print_r($config, true)); |
|
33 | + if( !isset( $config['flexParentDatabaseRow']['pid'] ) ) { |
|
34 | + throw new \Exception( 'No PID found in "flexParentDatabaseRow" or "row" array key: ' . print_r( $config, true ) ); |
|
35 | 35 | } |
36 | 36 | |
37 | 37 | $pid = $config['flexParentDatabaseRow']['pid']; |
38 | - $pageTSConfig = \TYPO3\CMS\Backend\Utility\BackendUtility::getPagesTSconfig($pid); |
|
38 | + $pageTSConfig = \TYPO3\CMS\Backend\Utility\BackendUtility::getPagesTSconfig( $pid ); |
|
39 | 39 | |
40 | - if (isset($pageTSConfig['tx_aimeos.']['mshop.']['locale.']['site'])) { |
|
40 | + if( isset( $pageTSConfig['tx_aimeos.']['mshop.']['locale.']['site'] ) ) { |
|
41 | 41 | $sitecode = $pageTSConfig['tx_aimeos.']['mshop.']['locale.']['site']; |
42 | 42 | } |
43 | 43 | |
44 | - $context = Base::context(Base::config()); |
|
45 | - $context->setEditor('flexform'); |
|
44 | + $context = Base::context( Base::config() ); |
|
45 | + $context->setEditor( 'flexform' ); |
|
46 | 46 | |
47 | - $localeManager = \Aimeos\MShop::create($context, 'locale'); |
|
48 | - $context->setLocale($localeManager->bootstrap($sitecode, '', '', false)); |
|
47 | + $localeManager = \Aimeos\MShop::create( $context, 'locale' ); |
|
48 | + $context->setLocale( $localeManager->bootstrap( $sitecode, '', '', false ) ); |
|
49 | 49 | |
50 | - $manager = \Aimeos\MShop::create($context, 'attribute/type'); |
|
51 | - $items = $manager->search($manager->filter(true)); |
|
50 | + $manager = \Aimeos\MShop::create( $context, 'attribute/type' ); |
|
51 | + $items = $manager->search( $manager->filter( true ) ); |
|
52 | 52 | |
53 | - foreach ($items as $item) { |
|
53 | + foreach( $items as $item ) { |
|
54 | 54 | $config['items'][] = [$item->getName(), $item->getCode()]; |
55 | 55 | } |
56 | - } catch(\Exception $e) { |
|
57 | - error_log($e->getMessage() . PHP_EOL . $e->getTraceAsString()); |
|
56 | + } catch( \Exception $e ) { |
|
57 | + error_log( $e->getMessage() . PHP_EOL . $e->getTraceAsString() ); |
|
58 | 58 | } |
59 | 59 | |
60 | 60 | return $config; |
@@ -29,7 +29,8 @@ discard block |
||
29 | 29 | */ |
30 | 30 | public function getTypes(array $config, $tceForms = null, string $sitecode = 'default') : array |
31 | 31 | { |
32 | - try { |
|
32 | + try |
|
33 | + { |
|
33 | 34 | if (!isset($config['flexParentDatabaseRow']['pid'])) { |
34 | 35 | throw new \Exception('No PID found in "flexParentDatabaseRow" or "row" array key: ' . print_r($config, true)); |
35 | 36 | } |
@@ -53,7 +54,9 @@ discard block |
||
53 | 54 | foreach ($items as $item) { |
54 | 55 | $config['items'][] = [$item->getName(), $item->getCode()]; |
55 | 56 | } |
56 | - } catch(\Exception $e) { |
|
57 | + } |
|
58 | + catch(\Exception $e) |
|
59 | + { |
|
57 | 60 | error_log($e->getMessage() . PHP_EOL . $e->getTraceAsString()); |
58 | 61 | } |
59 | 62 |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | private $view; |
20 | 20 | |
21 | 21 | |
22 | - public function __construct(\TYPO3\CMS\Fluid\View\StandaloneView $view) |
|
22 | + public function __construct( \TYPO3\CMS\Fluid\View\StandaloneView $view ) |
|
23 | 23 | { |
24 | 24 | $this->view = $view; |
25 | 25 | } |
@@ -32,8 +32,8 @@ discard block |
||
32 | 32 | */ |
33 | 33 | public function renderWidgetContent() : string |
34 | 34 | { |
35 | - return $this->view->setTemplate('Widget/LatestOrdersWidget') |
|
36 | - ->assign('items', $this->getOrderItems()) |
|
35 | + return $this->view->setTemplate( 'Widget/LatestOrdersWidget' ) |
|
36 | + ->assign( 'items', $this->getOrderItems() ) |
|
37 | 37 | ->render(); |
38 | 38 | } |
39 | 39 | |
@@ -46,11 +46,11 @@ discard block |
||
46 | 46 | protected function getOrderItems() : array |
47 | 47 | { |
48 | 48 | $config = \Aimeos\Aimeos\Base::config(); |
49 | - $context = \Aimeos\Aimeos\Base::context($config); |
|
49 | + $context = \Aimeos\Aimeos\Base::context( $config ); |
|
50 | 50 | |
51 | - $manager = \Aimeos\MShop::create($context, 'order'); |
|
52 | - $filter = $manager->filter()->sort('-order.id')->slice(0, 20); |
|
51 | + $manager = \Aimeos\MShop::create( $context, 'order' ); |
|
52 | + $filter = $manager->filter()->sort( '-order.id' )->slice( 0, 20 ); |
|
53 | 53 | |
54 | - return $manager->search($filter, ['order/base', 'order/base/address'])->toArray(); |
|
54 | + return $manager->search( $filter, ['order/base', 'order/base/address'] )->toArray(); |
|
55 | 55 | } |
56 | 56 | } |
57 | 57 | \ No newline at end of file |
@@ -20,23 +20,23 @@ |
||
20 | 20 | |
21 | 21 | public function initializeArguments() |
22 | 22 | { |
23 | - $this->registerArgument('name', 'string', 'Name of the content block'); |
|
23 | + $this->registerArgument( 'name', 'string', 'Name of the content block' ); |
|
24 | 24 | } |
25 | 25 | |
26 | 26 | |
27 | 27 | public function render() |
28 | 28 | { |
29 | 29 | $iface = '\Aimeos\Base\View\Iface'; |
30 | - $view = $this->templateVariableContainer->get('_aimeos_view'); |
|
30 | + $view = $this->templateVariableContainer->get( '_aimeos_view' ); |
|
31 | 31 | |
32 | - if (!is_object($view) || !($view instanceof $iface)) { |
|
33 | - throw new Exception('Aimeos view object is missing'); |
|
32 | + if( !is_object( $view ) || !( $view instanceof $iface ) ) { |
|
33 | + throw new Exception( 'Aimeos view object is missing' ); |
|
34 | 34 | } |
35 | 35 | |
36 | - if (!isset($this->arguments['name'])) { |
|
37 | - throw new Exception('Attribute "name" missing for Aimeos block view helper'); |
|
36 | + if( !isset( $this->arguments['name'] ) ) { |
|
37 | + throw new Exception( 'Attribute "name" missing for Aimeos block view helper' ); |
|
38 | 38 | } |
39 | 39 | |
40 | - $view->block()->set($this->arguments['name'], $this->renderChildren()); |
|
40 | + $view->block()->set( $this->arguments['name'], $this->renderChildren() ); |
|
41 | 41 | } |
42 | 42 | } |
@@ -20,41 +20,41 @@ |
||
20 | 20 | |
21 | 21 | public function initializeArguments() |
22 | 22 | { |
23 | - $this->registerArgument('singular', 'string', 'Singular form of the text to translate'); |
|
24 | - $this->registerArgument('plural', 'string', 'Plural form of the text, used if $number is greater than one', false); |
|
25 | - $this->registerArgument('number', 'integer', 'Amount of things relevant for the plural form', false); |
|
26 | - $this->registerArgument('escape', 'boolean', 'If translated string should be escaped', false); |
|
27 | - $this->registerArgument('domain', 'string', 'Translation domain from core or an extension', false); |
|
28 | - $this->registerArgument('arguments', 'array', 'Arguments to be replaced in the resulting string', false); |
|
23 | + $this->registerArgument( 'singular', 'string', 'Singular form of the text to translate' ); |
|
24 | + $this->registerArgument( 'plural', 'string', 'Plural form of the text, used if $number is greater than one', false ); |
|
25 | + $this->registerArgument( 'number', 'integer', 'Amount of things relevant for the plural form', false ); |
|
26 | + $this->registerArgument( 'escape', 'boolean', 'If translated string should be escaped', false ); |
|
27 | + $this->registerArgument( 'domain', 'string', 'Translation domain from core or an extension', false ); |
|
28 | + $this->registerArgument( 'arguments', 'array', 'Arguments to be replaced in the resulting string', false ); |
|
29 | 29 | } |
30 | 30 | |
31 | 31 | |
32 | 32 | public function render() |
33 | 33 | { |
34 | 34 | $iface = '\Aimeos\Base\View\Iface'; |
35 | - $view = $this->templateVariableContainer->get('_aimeos_view'); |
|
35 | + $view = $this->templateVariableContainer->get( '_aimeos_view' ); |
|
36 | 36 | |
37 | - if (!is_object($view) || !($view instanceof $iface)) { |
|
38 | - throw new Exception('Aimeos view object is missing'); |
|
37 | + if( !is_object( $view ) || !( $view instanceof $iface ) ) { |
|
38 | + throw new Exception( 'Aimeos view object is missing' ); |
|
39 | 39 | } |
40 | 40 | |
41 | - if (!isset($this->arguments['singular'])) { |
|
42 | - throw new Exception('Attribute "singular" missing for Aimeos translate view helper'); |
|
41 | + if( !isset( $this->arguments['singular'] ) ) { |
|
42 | + throw new Exception( 'Attribute "singular" missing for Aimeos translate view helper' ); |
|
43 | 43 | } |
44 | 44 | |
45 | 45 | $singular = $this->arguments['singular']; |
46 | - $plural = (isset($this->arguments['plural']) ? $this->arguments['plural'] : ''); |
|
47 | - $number = (isset($this->arguments['number']) ? $this->arguments['number'] : 1); |
|
48 | - $escape = (isset($this->arguments['escape']) ? $this->arguments['escape'] : true); |
|
49 | - $domain = (isset($this->arguments['domain']) ? $this->arguments['domain'] : 'client'); |
|
50 | - $values = (isset($this->arguments['arguments']) ? $this->arguments['arguments'] : []); |
|
46 | + $plural = ( isset( $this->arguments['plural'] ) ? $this->arguments['plural'] : '' ); |
|
47 | + $number = ( isset( $this->arguments['number'] ) ? $this->arguments['number'] : 1 ); |
|
48 | + $escape = ( isset( $this->arguments['escape'] ) ? $this->arguments['escape'] : true ); |
|
49 | + $domain = ( isset( $this->arguments['domain'] ) ? $this->arguments['domain'] : 'client' ); |
|
50 | + $values = ( isset( $this->arguments['arguments'] ) ? $this->arguments['arguments'] : [] ); |
|
51 | 51 | |
52 | - $string = vsprintf($view->translate($domain, $singular, $plural, $number), (array) $values); |
|
52 | + $string = vsprintf( $view->translate( $domain, $singular, $plural, $number ), (array) $values ); |
|
53 | 53 | |
54 | - if ($escape === false) { |
|
54 | + if( $escape === false ) { |
|
55 | 55 | return $string; |
56 | 56 | } |
57 | 57 | |
58 | - return $view->encoder()->html($string); |
|
58 | + return $view->encoder()->html( $string ); |
|
59 | 59 | } |
60 | 60 | } |
61 | 61 | \ No newline at end of file |
@@ -20,27 +20,27 @@ |
||
20 | 20 | |
21 | 21 | public function initializeArguments() |
22 | 22 | { |
23 | - $this->registerArgument('key', 'string', 'Configuration key, e.g. client/html/catalog/lists/basket-add'); |
|
24 | - $this->registerArgument('default', 'mixed', 'Value if no configuration for the given key was found', false); |
|
23 | + $this->registerArgument( 'key', 'string', 'Configuration key, e.g. client/html/catalog/lists/basket-add' ); |
|
24 | + $this->registerArgument( 'default', 'mixed', 'Value if no configuration for the given key was found', false ); |
|
25 | 25 | } |
26 | 26 | |
27 | 27 | |
28 | 28 | public function render() |
29 | 29 | { |
30 | 30 | $iface = '\Aimeos\Base\View\Iface'; |
31 | - $view = $this->templateVariableContainer->get('_aimeos_view'); |
|
31 | + $view = $this->templateVariableContainer->get( '_aimeos_view' ); |
|
32 | 32 | |
33 | - if (!is_object($view) || !($view instanceof $iface)) { |
|
34 | - throw new Exception('Aimeos view object is missing'); |
|
33 | + if( !is_object( $view ) || !( $view instanceof $iface ) ) { |
|
34 | + throw new Exception( 'Aimeos view object is missing' ); |
|
35 | 35 | } |
36 | 36 | |
37 | - if (!isset($this->arguments['key'])) { |
|
38 | - throw new Exception('Attribute "key" missing for Aimeos config view helper'); |
|
37 | + if( !isset( $this->arguments['key'] ) ) { |
|
38 | + throw new Exception( 'Attribute "key" missing for Aimeos config view helper' ); |
|
39 | 39 | } |
40 | 40 | |
41 | 41 | $key = $this->arguments['key']; |
42 | - $default = (isset($this->arguments['default']) ? $this->arguments['default'] : null); |
|
42 | + $default = ( isset( $this->arguments['default'] ) ? $this->arguments['default'] : null ); |
|
43 | 43 | |
44 | - return $view->config($key, $default); |
|
44 | + return $view->config( $key, $default ); |
|
45 | 45 | } |
46 | 46 | } |
@@ -27,23 +27,23 @@ |
||
27 | 27 | */ |
28 | 28 | public static function get() : \Aimeos\Bootstrap |
29 | 29 | { |
30 | - if (self::$aimeos === null) { |
|
30 | + if( self::$aimeos === null ) { |
|
31 | 31 | $extDirs = []; |
32 | 32 | |
33 | 33 | // Extension directories |
34 | - if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['aimeos']['extDirs'])) { |
|
35 | - ksort($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['aimeos']['extDirs']); |
|
34 | + if( is_array( $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['aimeos']['extDirs'] ) ) { |
|
35 | + ksort( $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['aimeos']['extDirs'] ); |
|
36 | 36 | |
37 | - foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['aimeos']['extDirs'] as $dir) { |
|
38 | - $absPath = \TYPO3\CMS\Core\Utility\GeneralUtility::getFileAbsFileName($dir); |
|
37 | + foreach( $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['aimeos']['extDirs'] as $dir ) { |
|
38 | + $absPath = \TYPO3\CMS\Core\Utility\GeneralUtility::getFileAbsFileName( $dir ); |
|
39 | 39 | |
40 | - if (!empty($absPath)) { |
|
40 | + if( !empty( $absPath ) ) { |
|
41 | 41 | $extDirs[] = $absPath; |
42 | 42 | } |
43 | 43 | } |
44 | 44 | } |
45 | 45 | |
46 | - self::$aimeos = new \Aimeos\Bootstrap($extDirs, false); |
|
46 | + self::$aimeos = new \Aimeos\Bootstrap( $extDirs, false ); |
|
47 | 47 | } |
48 | 48 | |
49 | 49 | return self::$aimeos; |
@@ -29,49 +29,49 @@ discard block |
||
29 | 29 | * @param \TYPO3\CMS\Extbase\Mvc\RequestInterface|null $request Request object |
30 | 30 | * @return \Aimeos\MShop\Locale\Item\Iface Locale item object |
31 | 31 | */ |
32 | - public static function get(\Aimeos\MShop\ContextIface $context, |
|
33 | - \TYPO3\CMS\Extbase\Mvc\RequestInterface $request = null) : \Aimeos\MShop\Locale\Item\Iface |
|
32 | + public static function get( \Aimeos\MShop\ContextIface $context, |
|
33 | + \TYPO3\CMS\Extbase\Mvc\RequestInterface $request = null ) : \Aimeos\MShop\Locale\Item\Iface |
|
34 | 34 | { |
35 | - if (!isset(self::$locale)) { |
|
35 | + if( !isset( self::$locale ) ) { |
|
36 | 36 | $config = $context->config(); |
37 | 37 | |
38 | 38 | |
39 | - $sitecode = $config->get('mshop/locale/site', 'default'); |
|
40 | - $name = $config->get('typo3/param/name/site', 'site'); |
|
39 | + $sitecode = $config->get( 'mshop/locale/site', 'default' ); |
|
40 | + $name = $config->get( 'typo3/param/name/site', 'site' ); |
|
41 | 41 | |
42 | - if ($request !== null && $request->hasArgument($name) === true) { |
|
43 | - $sitecode = $request->getArgument($name); |
|
44 | - } elseif (($value = GeneralUtility::_GP('S')) !== null) { |
|
42 | + if( $request !== null && $request->hasArgument( $name ) === true ) { |
|
43 | + $sitecode = $request->getArgument( $name ); |
|
44 | + } elseif( ( $value = GeneralUtility::_GP( 'S' ) ) !== null ) { |
|
45 | 45 | $sitecode = $value; |
46 | 46 | } |
47 | 47 | |
48 | 48 | |
49 | - $lang = $config->get('mshop/locale/language', ''); |
|
50 | - $name = $config->get('typo3/param/name/language', 'locale'); |
|
49 | + $lang = $config->get( 'mshop/locale/language', '' ); |
|
50 | + $name = $config->get( 'typo3/param/name/language', 'locale' ); |
|
51 | 51 | |
52 | - if ($request !== null && $request->hasArgument($name) === true) { |
|
53 | - $lang = $request->getArgument($name); |
|
54 | - } elseif (isset($GLOBALS['TSFE']->id)) { // TYPO3 9+ |
|
55 | - $langid = GeneralUtility::makeInstance('TYPO3\CMS\Core\Context\Context')->getAspect('language')->getId(); |
|
56 | - $site = GeneralUtility::makeInstance('TYPO3\CMS\Core\Site\SiteFinder')->getSiteByPageId($GLOBALS['TSFE']->id); |
|
57 | - $lang = substr($site->getLanguageById($langid)->getLocale(), 0, 5); |
|
52 | + if( $request !== null && $request->hasArgument( $name ) === true ) { |
|
53 | + $lang = $request->getArgument( $name ); |
|
54 | + } elseif( isset( $GLOBALS['TSFE']->id ) ) { // TYPO3 9+ |
|
55 | + $langid = GeneralUtility::makeInstance( 'TYPO3\CMS\Core\Context\Context' )->getAspect( 'language' )->getId(); |
|
56 | + $site = GeneralUtility::makeInstance( 'TYPO3\CMS\Core\Site\SiteFinder' )->getSiteByPageId( $GLOBALS['TSFE']->id ); |
|
57 | + $lang = substr( $site->getLanguageById( $langid )->getLocale(), 0, 5 ); |
|
58 | 58 | } |
59 | 59 | |
60 | 60 | |
61 | - $currency = $config->get('mshop/locale/currency', ''); |
|
62 | - $name = $config->get('typo3/param/name/currency', 'currency'); |
|
61 | + $currency = $config->get( 'mshop/locale/currency', '' ); |
|
62 | + $name = $config->get( 'typo3/param/name/currency', 'currency' ); |
|
63 | 63 | |
64 | - if ($request !== null && $request->hasArgument($name) === true) { |
|
65 | - $currency = $request->getArgument($name); |
|
66 | - } elseif (($value = GeneralUtility::_GP('C')) !== null) { |
|
64 | + if( $request !== null && $request->hasArgument( $name ) === true ) { |
|
65 | + $currency = $request->getArgument( $name ); |
|
66 | + } elseif( ( $value = GeneralUtility::_GP( 'C' ) ) !== null ) { |
|
67 | 67 | $currency = $value; |
68 | 68 | } |
69 | 69 | |
70 | 70 | |
71 | - $localeManager = \Aimeos\MShop::create($context, 'locale'); |
|
72 | - self::$locale = $localeManager->bootstrap($sitecode, $lang, $currency); |
|
71 | + $localeManager = \Aimeos\MShop::create( $context, 'locale' ); |
|
72 | + self::$locale = $localeManager->bootstrap( $sitecode, $lang, $currency ); |
|
73 | 73 | |
74 | - $config->apply(self::$locale->getSiteItem()->getConfig()); |
|
74 | + $config->apply( self::$locale->getSiteItem()->getConfig() ); |
|
75 | 75 | } |
76 | 76 | |
77 | 77 | return self::$locale; |
@@ -85,17 +85,17 @@ discard block |
||
85 | 85 | * @param string $site Unique site code |
86 | 86 | * @return \Aimeos\MShop\ContextIface Modified context object |
87 | 87 | */ |
88 | - public static function getBackend(\Aimeos\MShop\ContextIface $context, string $site) : \Aimeos\MShop\Locale\Item\Iface |
|
88 | + public static function getBackend( \Aimeos\MShop\ContextIface $context, string $site ) : \Aimeos\MShop\Locale\Item\Iface |
|
89 | 89 | { |
90 | - $localeManager = \Aimeos\MShop::create($context, 'locale'); |
|
90 | + $localeManager = \Aimeos\MShop::create( $context, 'locale' ); |
|
91 | 91 | |
92 | 92 | try { |
93 | - $localeItem = $localeManager->bootstrap($site, '', '', false, null, true); |
|
94 | - $context->config()->apply($localeItem->getSiteItem()->getConfig()); |
|
95 | - } catch(\Aimeos\MShop\Exception $e) { |
|
93 | + $localeItem = $localeManager->bootstrap( $site, '', '', false, null, true ); |
|
94 | + $context->config()->apply( $localeItem->getSiteItem()->getConfig() ); |
|
95 | + } catch( \Aimeos\MShop\Exception $e ) { |
|
96 | 96 | $localeItem = $localeManager->create(); |
97 | 97 | } |
98 | 98 | |
99 | - return $localeItem->setCurrencyId(null)->setLanguageId(null); |
|
99 | + return $localeItem->setCurrencyId( null )->setLanguageId( null ); |
|
100 | 100 | } |
101 | 101 | } |
@@ -89,10 +89,13 @@ |
||
89 | 89 | { |
90 | 90 | $localeManager = \Aimeos\MShop::create($context, 'locale'); |
91 | 91 | |
92 | - try { |
|
92 | + try |
|
93 | + { |
|
93 | 94 | $localeItem = $localeManager->bootstrap($site, '', '', false, null, true); |
94 | 95 | $context->config()->apply($localeItem->getSiteItem()->getConfig()); |
95 | - } catch(\Aimeos\MShop\Exception $e) { |
|
96 | + } |
|
97 | + catch(\Aimeos\MShop\Exception $e) |
|
98 | + { |
|
96 | 99 | $localeItem = $localeManager->create(); |
97 | 100 | } |
98 | 101 |
@@ -27,32 +27,32 @@ |
||
27 | 27 | * @param array $local Multi-dimensional associative list with local configuration |
28 | 28 | * @return \Aimeos\Base\Config\Iface Configuration object |
29 | 29 | */ |
30 | - public static function get(array $paths, array $local = []) : \Aimeos\Base\Config\Iface |
|
30 | + public static function get( array $paths, array $local = [] ) : \Aimeos\Base\Config\Iface |
|
31 | 31 | { |
32 | - if (self::$config === null) { |
|
32 | + if( self::$config === null ) { |
|
33 | 33 | // Using extension config directories |
34 | - if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['aimeos']['confDirs'])) { |
|
35 | - ksort($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['aimeos']['confDirs']); |
|
36 | - foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['aimeos']['confDirs'] as $dir) { |
|
37 | - if (($absPath = \TYPO3\CMS\Core\Utility\GeneralUtility::getFileAbsFileName($dir)) !== '') { |
|
34 | + if( is_array( $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['aimeos']['confDirs'] ) ) { |
|
35 | + ksort( $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['aimeos']['confDirs'] ); |
|
36 | + foreach( $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['aimeos']['confDirs'] as $dir ) { |
|
37 | + if( ( $absPath = \TYPO3\CMS\Core\Utility\GeneralUtility::getFileAbsFileName( $dir ) ) !== '' ) { |
|
38 | 38 | $paths[] = $absPath; |
39 | 39 | } |
40 | 40 | } |
41 | 41 | } |
42 | 42 | |
43 | - $conf = new \Aimeos\Base\Config\PHPArray([], $paths); |
|
43 | + $conf = new \Aimeos\Base\Config\PHPArray( [], $paths ); |
|
44 | 44 | |
45 | - if ((bool) \Aimeos\Aimeos\Base::getExtConfig('useAPC', false) === true) { |
|
46 | - $conf = new \Aimeos\Base\Config\Decorator\APC($conf, \Aimeos\Aimeos\Base::getExtConfig('apcPrefix', 't3:')); |
|
45 | + if( (bool) \Aimeos\Aimeos\Base::getExtConfig( 'useAPC', false ) === true ) { |
|
46 | + $conf = new \Aimeos\Base\Config\Decorator\APC( $conf, \Aimeos\Aimeos\Base::getExtConfig( 'apcPrefix', 't3:' ) ); |
|
47 | 47 | } |
48 | 48 | |
49 | 49 | self::$config = $conf; |
50 | 50 | } |
51 | 51 | |
52 | - if (isset($local['typo3']['tsconfig'])) { |
|
53 | - $local = array_replace_recursive($local, \Aimeos\Aimeos\Base::parseTS($local['typo3']['tsconfig'])); |
|
52 | + if( isset( $local['typo3']['tsconfig'] ) ) { |
|
53 | + $local = array_replace_recursive( $local, \Aimeos\Aimeos\Base::parseTS( $local['typo3']['tsconfig'] ) ); |
|
54 | 54 | } |
55 | 55 | |
56 | - return new \Aimeos\Base\Config\Decorator\Memory(self::$config, $local); |
|
56 | + return new \Aimeos\Base\Config\Decorator\Memory( self::$config, $local ); |
|
57 | 57 | } |
58 | 58 | } |