@@ -30,7 +30,7 @@ discard block |
||
| 30 | 30 | * |
| 31 | 31 | * @param ContainerInterface $container Dependency container |
| 32 | 32 | */ |
| 33 | - public function __construct( ContainerInterface $container ) |
|
| 33 | + public function __construct(ContainerInterface $container) |
|
| 34 | 34 | { |
| 35 | 35 | $this->container = $container; |
| 36 | 36 | } |
@@ -46,54 +46,54 @@ discard block |
||
| 46 | 46 | * @param string|null $locale Code of the current language or null for no translation |
| 47 | 47 | * @return \Aimeos\MW\View\Iface View object |
| 48 | 48 | */ |
| 49 | - public function create( ServerRequestInterface $request, ResponseInterface $response, array $attr, array $templatePaths, $locale = null ) |
|
| 49 | + public function create(ServerRequestInterface $request, ResponseInterface $response, array $attr, array $templatePaths, $locale = null) |
|
| 50 | 50 | { |
| 51 | 51 | $params = $fixed = array(); |
| 52 | - $config = $this->container->get( 'aimeos_config' ); |
|
| 52 | + $config = $this->container->get('aimeos_config'); |
|
| 53 | 53 | |
| 54 | - if( $locale !== null ) |
|
| 54 | + if ($locale !== null) |
|
| 55 | 55 | { |
| 56 | 56 | $params = $attr + (array) $request->getParsedBody() + (array) $request->getQueryParams(); |
| 57 | - $fixed = $this->getFixedParams( $attr ); |
|
| 57 | + $fixed = $this->getFixedParams($attr); |
|
| 58 | 58 | |
| 59 | - $i18n = $this->container->get( 'aimeos_i18n' )->get( array( $locale ) ); |
|
| 59 | + $i18n = $this->container->get('aimeos_i18n')->get(array($locale)); |
|
| 60 | 60 | $translation = $i18n[$locale]; |
| 61 | 61 | } |
| 62 | 62 | else |
| 63 | 63 | { |
| 64 | - $translation = new \Aimeos\MW\Translation\None( 'en' ); |
|
| 64 | + $translation = new \Aimeos\MW\Translation\None('en'); |
|
| 65 | 65 | } |
| 66 | 66 | |
| 67 | 67 | |
| 68 | - $view = new \Aimeos\MW\View\Standard( $templatePaths ); |
|
| 68 | + $view = new \Aimeos\MW\View\Standard($templatePaths); |
|
| 69 | 69 | |
| 70 | - $helper = new \Aimeos\MW\View\Helper\Translate\Standard( $view, $translation ); |
|
| 71 | - $view->addHelper( 'translate', $helper ); |
|
| 70 | + $helper = new \Aimeos\MW\View\Helper\Translate\Standard($view, $translation); |
|
| 71 | + $view->addHelper('translate', $helper); |
|
| 72 | 72 | |
| 73 | - $helper = new \Aimeos\MW\View\Helper\Url\Slim( $view, $this->container->get( 'router' ), $fixed ); |
|
| 74 | - $view->addHelper( 'url', $helper ); |
|
| 73 | + $helper = new \Aimeos\MW\View\Helper\Url\Slim($view, $this->container->get('router'), $fixed); |
|
| 74 | + $view->addHelper('url', $helper); |
|
| 75 | 75 | |
| 76 | - $helper = new \Aimeos\MW\View\Helper\Param\Standard( $view, $params ); |
|
| 77 | - $view->addHelper( 'param', $helper ); |
|
| 76 | + $helper = new \Aimeos\MW\View\Helper\Param\Standard($view, $params); |
|
| 77 | + $view->addHelper('param', $helper); |
|
| 78 | 78 | |
| 79 | - $config = new \Aimeos\MW\Config\Decorator\Protect( clone $config, array( 'admin', 'client' ) ); |
|
| 80 | - $helper = new \Aimeos\MW\View\Helper\Config\Standard( $view, $config ); |
|
| 81 | - $view->addHelper( 'config', $helper ); |
|
| 79 | + $config = new \Aimeos\MW\Config\Decorator\Protect(clone $config, array('admin', 'client')); |
|
| 80 | + $helper = new \Aimeos\MW\View\Helper\Config\Standard($view, $config); |
|
| 81 | + $view->addHelper('config', $helper); |
|
| 82 | 82 | |
| 83 | - $sepDec = $config->get( 'client/html/common/format/seperatorDecimal', '.' ); |
|
| 84 | - $sep1000 = $config->get( 'client/html/common/format/seperator1000', ' ' ); |
|
| 85 | - $helper = new \Aimeos\MW\View\Helper\Number\Standard( $view, $sepDec, $sep1000 ); |
|
| 86 | - $view->addHelper( 'number', $helper ); |
|
| 83 | + $sepDec = $config->get('client/html/common/format/seperatorDecimal', '.'); |
|
| 84 | + $sep1000 = $config->get('client/html/common/format/seperator1000', ' '); |
|
| 85 | + $helper = new \Aimeos\MW\View\Helper\Number\Standard($view, $sepDec, $sep1000); |
|
| 86 | + $view->addHelper('number', $helper); |
|
| 87 | 87 | |
| 88 | - $helper = new \Aimeos\MW\View\Helper\Request\Slim( $view, $request ); |
|
| 89 | - $view->addHelper( 'request', $helper ); |
|
| 88 | + $helper = new \Aimeos\MW\View\Helper\Request\Slim($view, $request); |
|
| 89 | + $view->addHelper('request', $helper); |
|
| 90 | 90 | |
| 91 | - $helper = new \Aimeos\MW\View\Helper\Response\Slim( $view, $response ); |
|
| 92 | - $view->addHelper( 'response', $helper ); |
|
| 91 | + $helper = new \Aimeos\MW\View\Helper\Response\Slim($view, $response); |
|
| 92 | + $view->addHelper('response', $helper); |
|
| 93 | 93 | |
| 94 | - $csrf = $request->getAttribute( 'csrf_name' ); |
|
| 95 | - $helper = new \Aimeos\MW\View\Helper\Csrf\Standard( $view, $csrf, $request->getAttribute( 'csrf_value ') ); |
|
| 96 | - $view->addHelper( 'csrf', $helper ); |
|
| 94 | + $csrf = $request->getAttribute('csrf_name'); |
|
| 95 | + $helper = new \Aimeos\MW\View\Helper\Csrf\Standard($view, $csrf, $request->getAttribute('csrf_value ')); |
|
| 96 | + $view->addHelper('csrf', $helper); |
|
| 97 | 97 | |
| 98 | 98 | return $view; |
| 99 | 99 | } |
@@ -105,19 +105,19 @@ discard block |
||
| 105 | 105 | * @param array $attributes Associative list of route attributes |
| 106 | 106 | * @return array Associative list of parameters with "site", "locale" and "currency" if available |
| 107 | 107 | */ |
| 108 | - protected function getFixedParams( array $attributes ) |
|
| 108 | + protected function getFixedParams(array $attributes) |
|
| 109 | 109 | { |
| 110 | 110 | $fixed = array(); |
| 111 | 111 | |
| 112 | - if( isset( $attributes['site'] ) ) { |
|
| 112 | + if (isset($attributes['site'])) { |
|
| 113 | 113 | $fixed['site'] = $attributes['site']; |
| 114 | 114 | } |
| 115 | 115 | |
| 116 | - if( isset( $attributes['locale'] ) ) { |
|
| 116 | + if (isset($attributes['locale'])) { |
|
| 117 | 117 | $fixed['locale'] = $attributes['locale']; |
| 118 | 118 | } |
| 119 | 119 | |
| 120 | - if( isset( $attributes['currency'] ) ) { |
|
| 120 | + if (isset($attributes['currency'])) { |
|
| 121 | 121 | $fixed['currency'] = $attributes['currency']; |
| 122 | 122 | } |
| 123 | 123 | |
@@ -6,16 +6,16 @@ discard block |
||
| 6 | 6 | 'uploaddir' => '/', |
| 7 | 7 | |
| 8 | 8 | 'page' => array( |
| 9 | - 'account-index' => array( 'account/history','account/favorite','account/watch','basket/mini','catalog/session' ), |
|
| 10 | - 'basket-index' => array( 'basket/standard','basket/related' ), |
|
| 11 | - 'catalog-count' => array( 'catalog/count' ), |
|
| 12 | - 'catalog-detail' => array( 'basket/mini','catalog/stage','catalog/detail','catalog/session' ), |
|
| 13 | - 'catalog-list' => array( 'basket/mini','catalog/filter','catalog/stage','catalog/lists' ), |
|
| 14 | - 'catalog-stock' => array( 'catalog/stock' ), |
|
| 15 | - 'catalog-suggest' => array( 'catalog/suggest' ), |
|
| 16 | - 'checkout-confirm' => array( 'checkout/confirm' ), |
|
| 17 | - 'checkout-index' => array( 'checkout/standard' ), |
|
| 18 | - 'checkout-update' => array( 'checkout/update'), |
|
| 9 | + 'account-index' => array('account/history', 'account/favorite', 'account/watch', 'basket/mini', 'catalog/session'), |
|
| 10 | + 'basket-index' => array('basket/standard', 'basket/related'), |
|
| 11 | + 'catalog-count' => array('catalog/count'), |
|
| 12 | + 'catalog-detail' => array('basket/mini', 'catalog/stage', 'catalog/detail', 'catalog/session'), |
|
| 13 | + 'catalog-list' => array('basket/mini', 'catalog/filter', 'catalog/stage', 'catalog/lists'), |
|
| 14 | + 'catalog-stock' => array('catalog/stock'), |
|
| 15 | + 'catalog-suggest' => array('catalog/suggest'), |
|
| 16 | + 'checkout-confirm' => array('checkout/confirm'), |
|
| 17 | + 'checkout-index' => array('checkout/standard'), |
|
| 18 | + 'checkout-update' => array('checkout/update'), |
|
| 19 | 19 | ), |
| 20 | 20 | |
| 21 | 21 | 'routes' => array( |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | 'database' => 'slim', |
| 35 | 35 | 'username' => 'root', |
| 36 | 36 | 'password' => '', |
| 37 | - 'stmt' => array( "SET NAMES 'utf8'", "SET SESSION sql_mode='ANSI'" ), |
|
| 37 | + 'stmt' => array("SET NAMES 'utf8'", "SET SESSION sql_mode='ANSI'"), |
|
| 38 | 38 | 'opt-persistent' => 0, |
| 39 | 39 | 'limit' => 2, |
| 40 | 40 | ), |
@@ -30,7 +30,7 @@ discard block |
||
| 30 | 30 | * |
| 31 | 31 | * @param ContainerInterface $container Dependency container |
| 32 | 32 | */ |
| 33 | - public function __construct( ContainerInterface $container ) |
|
| 33 | + public function __construct(ContainerInterface $container) |
|
| 34 | 34 | { |
| 35 | 35 | $this->container = $container; |
| 36 | 36 | } |
@@ -43,48 +43,48 @@ discard block |
||
| 43 | 43 | * @param array Associative list of URL parameter |
| 44 | 44 | * @return \Aimeos\MShop\Context\Item\Iface Context object |
| 45 | 45 | */ |
| 46 | - public function get( $locale = true, array $attributes = array() ) |
|
| 46 | + public function get($locale = true, array $attributes = array()) |
|
| 47 | 47 | { |
| 48 | - if( self::$context === null ) |
|
| 48 | + if (self::$context === null) |
|
| 49 | 49 | { |
| 50 | 50 | $context = new \Aimeos\MShop\Context\Item\Standard(); |
| 51 | 51 | |
| 52 | - $config = $this->container->get( 'aimeos_config' ); |
|
| 53 | - $context->setConfig( $config ); |
|
| 52 | + $config = $this->container->get('aimeos_config'); |
|
| 53 | + $context->setConfig($config); |
|
| 54 | 54 | |
| 55 | - $dbm = new \Aimeos\MW\DB\Manager\PDO( $config ); |
|
| 56 | - $context->setDatabaseManager( $dbm ); |
|
| 55 | + $dbm = new \Aimeos\MW\DB\Manager\PDO($config); |
|
| 56 | + $context->setDatabaseManager($dbm); |
|
| 57 | 57 | |
| 58 | - $fs = new \Aimeos\MW\Filesystem\Manager\Standard( $config ); |
|
| 59 | - $context->setFilesystemManager( $fs ); |
|
| 58 | + $fs = new \Aimeos\MW\Filesystem\Manager\Standard($config); |
|
| 59 | + $context->setFilesystemManager($fs); |
|
| 60 | 60 | |
| 61 | - $mq = new \Aimeos\MW\MQueue\Manager\Standard( $config ); |
|
| 62 | - $context->setMessageQueueManager( $mq ); |
|
| 61 | + $mq = new \Aimeos\MW\MQueue\Manager\Standard($config); |
|
| 62 | + $context->setMessageQueueManager($mq); |
|
| 63 | 63 | |
| 64 | - $mail = new \Aimeos\MW\Mail\Swift( $this->container->get( 'mailer' ) ); |
|
| 65 | - $context->setMail( $mail ); |
|
| 64 | + $mail = new \Aimeos\MW\Mail\Swift($this->container->get('mailer')); |
|
| 65 | + $context->setMail($mail); |
|
| 66 | 66 | |
| 67 | - $logger = \Aimeos\MAdmin\Log\Manager\Factory::createManager( $context ); |
|
| 68 | - $context->setLogger( $logger ); |
|
| 67 | + $logger = \Aimeos\MAdmin\Log\Manager\Factory::createManager($context); |
|
| 68 | + $context->setLogger($logger); |
|
| 69 | 69 | |
| 70 | - $cache = new \Aimeos\MAdmin\Cache\Proxy\Standard( $context ); |
|
| 71 | - $context->setCache( $cache ); |
|
| 70 | + $cache = new \Aimeos\MAdmin\Cache\Proxy\Standard($context); |
|
| 71 | + $context->setCache($cache); |
|
| 72 | 72 | |
| 73 | 73 | $session = new \Aimeos\MW\Session\PHP(); |
| 74 | - $context->setSession( $session ); |
|
| 74 | + $context->setSession($session); |
|
| 75 | 75 | |
| 76 | 76 | self::$context = $context; |
| 77 | 77 | } |
| 78 | 78 | |
| 79 | 79 | $context = self::$context; |
| 80 | 80 | |
| 81 | - if( $locale === true ) |
|
| 81 | + if ($locale === true) |
|
| 82 | 82 | { |
| 83 | - $localeItem = $this->getLocale( $context, $attributes ); |
|
| 83 | + $localeItem = $this->getLocale($context, $attributes); |
|
| 84 | 84 | $langid = $localeItem->getLanguageId(); |
| 85 | 85 | |
| 86 | - $context->setLocale( $localeItem ); |
|
| 87 | - $context->setI18n( $this->container->get( 'aimeos_i18n' )->get( array( $langid ) ) ); |
|
| 86 | + $context->setLocale($localeItem); |
|
| 87 | + $context->setI18n($this->container->get('aimeos_i18n')->get(array($langid))); |
|
| 88 | 88 | } |
| 89 | 89 | |
| 90 | 90 | return $context; |
@@ -98,18 +98,18 @@ discard block |
||
| 98 | 98 | * @param array Associative list of URL parameter |
| 99 | 99 | * @return \Aimeos\MShop\Locale\Item\Iface Locale item object |
| 100 | 100 | */ |
| 101 | - protected function getLocale( \Aimeos\MShop\Context\Item\Iface $context, array $attr ) |
|
| 101 | + protected function getLocale(\Aimeos\MShop\Context\Item\Iface $context, array $attr) |
|
| 102 | 102 | { |
| 103 | - if( $this->locale === null ) |
|
| 103 | + if ($this->locale === null) |
|
| 104 | 104 | { |
| 105 | - $disableSites = $this->container->get( 'aimeos_config' )->get( 'disableSites', true ); |
|
| 105 | + $disableSites = $this->container->get('aimeos_config')->get('disableSites', true); |
|
| 106 | 106 | |
| 107 | - $site = ( isset( $attr['site'] ) ? $attr['site'] : 'default' ); |
|
| 108 | - $lang = ( isset( $attr['locale'] ) ? $attr['locale'] : '' ); |
|
| 109 | - $currency = ( isset( $attr['currency'] ) ? $attr['currency'] : '' ); |
|
| 107 | + $site = (isset($attr['site']) ? $attr['site'] : 'default'); |
|
| 108 | + $lang = (isset($attr['locale']) ? $attr['locale'] : ''); |
|
| 109 | + $currency = (isset($attr['currency']) ? $attr['currency'] : ''); |
|
| 110 | 110 | |
| 111 | - $localeManager = \Aimeos\MShop\Locale\Manager\Factory::createManager( $context ); |
|
| 112 | - $this->locale = $localeManager->bootstrap( $site, $lang, $currency, $disableSites ); |
|
| 111 | + $localeManager = \Aimeos\MShop\Locale\Manager\Factory::createManager($context); |
|
| 112 | + $this->locale = $localeManager->bootstrap($site, $lang, $currency, $disableSites); |
|
| 113 | 113 | } |
| 114 | 114 | |
| 115 | 115 | return $this->locale; |
@@ -6,28 +6,28 @@ discard block |
||
| 6 | 6 | */ |
| 7 | 7 | |
| 8 | 8 | |
| 9 | -if( php_sapi_name() != 'cli' ) { |
|
| 10 | - exit( 'Setup can only be started via command line for security reasons' ); |
|
| 9 | +if (php_sapi_name() != 'cli') { |
|
| 10 | + exit('Setup can only be started via command line for security reasons'); |
|
| 11 | 11 | } |
| 12 | 12 | |
| 13 | -ini_set( 'display_errors', 1 ); |
|
| 14 | -date_default_timezone_set( 'UTC' ); |
|
| 13 | +ini_set('display_errors', 1); |
|
| 14 | +date_default_timezone_set('UTC'); |
|
| 15 | 15 | |
| 16 | 16 | |
| 17 | 17 | |
| 18 | 18 | try |
| 19 | 19 | { |
| 20 | - require 'vendor' . DIRECTORY_SEPARATOR . 'autoload.php'; |
|
| 20 | + require 'vendor'.DIRECTORY_SEPARATOR.'autoload.php'; |
|
| 21 | 21 | |
| 22 | - \Aimeos\Slim\Command\Jobs::run( $_SERVER['argv'] ); |
|
| 22 | + \Aimeos\Slim\Command\Jobs::run($_SERVER['argv']); |
|
| 23 | 23 | } |
| 24 | -catch( \Aimeos\Slim\Command\Exception $e ) |
|
| 24 | +catch (\Aimeos\Slim\Command\Exception $e) |
|
| 25 | 25 | { |
| 26 | - echo $e->getMessage() . "\n"; |
|
| 26 | + echo $e->getMessage()."\n"; |
|
| 27 | 27 | echo \Aimeos\Slim\Command\Jobs::usage(); |
| 28 | - exit( 1 ); |
|
| 28 | + exit(1); |
|
| 29 | 29 | } |
| 30 | -catch( \Throwable $t ) |
|
| 30 | +catch (\Throwable $t) |
|
| 31 | 31 | { |
| 32 | 32 | echo "\n\nCaught PHP error while processing setup"; |
| 33 | 33 | echo "\n\nMessage:\n"; |
@@ -35,9 +35,9 @@ discard block |
||
| 35 | 35 | echo "\n\nStack trace:\n"; |
| 36 | 36 | echo $t->getTraceAsString(); |
| 37 | 37 | echo "\n\n"; |
| 38 | - exit( 1 ); |
|
| 38 | + exit(1); |
|
| 39 | 39 | } |
| 40 | -catch( \Exception $e ) |
|
| 40 | +catch (\Exception $e) |
|
| 41 | 41 | { |
| 42 | 42 | echo "\n\nCaught exception while processing setup"; |
| 43 | 43 | echo "\n\nMessage:\n"; |
@@ -45,5 +45,5 @@ discard block |
||
| 45 | 45 | echo "\n\nStack trace:\n"; |
| 46 | 46 | echo $e->getTraceAsString(); |
| 47 | 47 | echo "\n\n"; |
| 48 | - exit( 1 ); |
|
| 48 | + exit(1); |
|
| 49 | 49 | } |
@@ -6,27 +6,27 @@ discard block |
||
| 6 | 6 | */ |
| 7 | 7 | |
| 8 | 8 | |
| 9 | -if( php_sapi_name() != 'cli' ) { |
|
| 10 | - exit( 'Setup can only be started via command line for security reasons' ); |
|
| 9 | +if (php_sapi_name() != 'cli') { |
|
| 10 | + exit('Setup can only be started via command line for security reasons'); |
|
| 11 | 11 | } |
| 12 | 12 | |
| 13 | -ini_set( 'display_errors', 1 ); |
|
| 14 | -date_default_timezone_set( 'UTC' ); |
|
| 13 | +ini_set('display_errors', 1); |
|
| 14 | +date_default_timezone_set('UTC'); |
|
| 15 | 15 | |
| 16 | 16 | |
| 17 | 17 | try |
| 18 | 18 | { |
| 19 | - require 'vendor' . DIRECTORY_SEPARATOR . 'autoload.php'; |
|
| 19 | + require 'vendor'.DIRECTORY_SEPARATOR.'autoload.php'; |
|
| 20 | 20 | |
| 21 | - \Aimeos\Slim\Command\Cache::run( $_SERVER['argv'] ); |
|
| 21 | + \Aimeos\Slim\Command\Cache::run($_SERVER['argv']); |
|
| 22 | 22 | } |
| 23 | -catch( \Aimeos\Slim\Command\Exception $e ) |
|
| 23 | +catch (\Aimeos\Slim\Command\Exception $e) |
|
| 24 | 24 | { |
| 25 | - echo $e->getMessage() . "\n"; |
|
| 25 | + echo $e->getMessage()."\n"; |
|
| 26 | 26 | echo \Aimeos\Slim\Command\Cache::usage(); |
| 27 | - exit( 1 ); |
|
| 27 | + exit(1); |
|
| 28 | 28 | } |
| 29 | -catch( \Throwable $t ) |
|
| 29 | +catch (\Throwable $t) |
|
| 30 | 30 | { |
| 31 | 31 | echo "\n\nCaught PHP error"; |
| 32 | 32 | echo "\n\nMessage:\n"; |
@@ -34,9 +34,9 @@ discard block |
||
| 34 | 34 | echo "\n\nStack trace:\n"; |
| 35 | 35 | echo $t->getTraceAsString(); |
| 36 | 36 | echo "\n\n"; |
| 37 | - exit( 1 ); |
|
| 37 | + exit(1); |
|
| 38 | 38 | } |
| 39 | -catch( \Exception $e ) |
|
| 39 | +catch (\Exception $e) |
|
| 40 | 40 | { |
| 41 | 41 | echo "\n\nCaught exception"; |
| 42 | 42 | echo "\n\nMessage:\n"; |
@@ -44,5 +44,5 @@ discard block |
||
| 44 | 44 | echo "\n\nStack trace:\n"; |
| 45 | 45 | echo $e->getTraceAsString(); |
| 46 | 46 | echo "\n\n"; |
| 47 | - exit( 1 ); |
|
| 47 | + exit(1); |
|
| 48 | 48 | } |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | * |
| 30 | 30 | * @param ContainerInterface $container Dependency container |
| 31 | 31 | */ |
| 32 | - public function __construct( ContainerInterface $container ) |
|
| 32 | + public function __construct(ContainerInterface $container) |
|
| 33 | 33 | { |
| 34 | 34 | $this->container = $container; |
| 35 | 35 | } |
@@ -41,23 +41,23 @@ discard block |
||
| 41 | 41 | * @param array $languageIds List of two letter ISO language IDs |
| 42 | 42 | * @return \Aimeos\MW\Translation\Iface[] List of translation objects |
| 43 | 43 | */ |
| 44 | - public function get( array $languageIds ) |
|
| 44 | + public function get(array $languageIds) |
|
| 45 | 45 | { |
| 46 | - $config = $this->container->get( 'aimeos_config' ); |
|
| 47 | - $i18nPaths = $this->container->get( 'aimeos' )->getI18nPaths(); |
|
| 46 | + $config = $this->container->get('aimeos_config'); |
|
| 47 | + $i18nPaths = $this->container->get('aimeos')->getI18nPaths(); |
|
| 48 | 48 | |
| 49 | - foreach( $languageIds as $langid ) |
|
| 49 | + foreach ($languageIds as $langid) |
|
| 50 | 50 | { |
| 51 | - if( !isset( $this->i18n[$langid] ) ) |
|
| 51 | + if (!isset($this->i18n[$langid])) |
|
| 52 | 52 | { |
| 53 | - $i18n = new \Aimeos\MW\Translation\Gettext( $i18nPaths, $langid ); |
|
| 53 | + $i18n = new \Aimeos\MW\Translation\Gettext($i18nPaths, $langid); |
|
| 54 | 54 | |
| 55 | - if( function_exists( 'apc_store' ) === true && $config->get( 'apc_enabled', false ) == true ) { |
|
| 56 | - $i18n = new \Aimeos\MW\Translation\Decorator\APC( $i18n, $config->get( 'apc_prefix', 'slim:' ) ); |
|
| 55 | + if (function_exists('apc_store') === true && $config->get('apc_enabled', false) == true) { |
|
| 56 | + $i18n = new \Aimeos\MW\Translation\Decorator\APC($i18n, $config->get('apc_prefix', 'slim:')); |
|
| 57 | 57 | } |
| 58 | 58 | |
| 59 | - if( ( $cfg = $config->get( 'i18n/' . $langid, array() ) ) !== array() ) { |
|
| 60 | - $i18n = new \Aimeos\MW\Translation\Decorator\Memory( $i18n, $cfg ); |
|
| 59 | + if (($cfg = $config->get('i18n/'.$langid, array())) !== array()) { |
|
| 60 | + $i18n = new \Aimeos\MW\Translation\Decorator\Memory($i18n, $cfg); |
|
| 61 | 61 | } |
| 62 | 62 | |
| 63 | 63 | $this->i18n[$langid] = $i18n; |
@@ -27,7 +27,7 @@ discard block |
||
| 27 | 27 | * @param \Slim\App $app Slim application |
| 28 | 28 | * @param array $settings Multi-dimensional array of configuration settings |
| 29 | 29 | */ |
| 30 | - public function __construct( \Slim\App $app, array $settings ) |
|
| 30 | + public function __construct(\Slim\App $app, array $settings) |
|
| 31 | 31 | { |
| 32 | 32 | $this->app = $app; |
| 33 | 33 | $this->settings = $settings; |
@@ -40,16 +40,16 @@ discard block |
||
| 40 | 40 | * @param string $path Absolute or relative path to the Aimeos route file |
| 41 | 41 | * @return \Aimeos\Slim\Bootstrap Self instance |
| 42 | 42 | */ |
| 43 | - public function routes( $path ) |
|
| 43 | + public function routes($path) |
|
| 44 | 44 | { |
| 45 | 45 | $app = $this->app; |
| 46 | 46 | $settings = $this->settings; |
| 47 | 47 | |
| 48 | - $config = function( $key, $default ) use ( $settings ) |
|
| 48 | + $config = function($key, $default) use ($settings) |
|
| 49 | 49 | { |
| 50 | - foreach( explode( '/', trim( $key, '/' ) ) as $part ) |
|
| 50 | + foreach (explode('/', trim($key, '/')) as $part) |
|
| 51 | 51 | { |
| 52 | - if( isset( $settings[$part] ) ) { |
|
| 52 | + if (isset($settings[$part])) { |
|
| 53 | 53 | $settings = $settings[$part]; |
| 54 | 54 | } else { |
| 55 | 55 | return $default; |
@@ -71,48 +71,48 @@ discard block |
||
| 71 | 71 | * @param string $extdir Absolute or relative path to the Aimeos extension directory |
| 72 | 72 | * @return \Aimeos\Slim\Bootstrap Self instance |
| 73 | 73 | */ |
| 74 | - public function setup( $extdir = '../ext' ) |
|
| 74 | + public function setup($extdir = '../ext') |
|
| 75 | 75 | { |
| 76 | 76 | $container = $this->app->getContainer(); |
| 77 | 77 | |
| 78 | - $container['aimeos'] = function( $c ) use ( $extdir ) { |
|
| 79 | - return new \Aimeos\Bootstrap( (array) $extdir, false ); |
|
| 78 | + $container['aimeos'] = function($c) use ($extdir) { |
|
| 79 | + return new \Aimeos\Bootstrap((array) $extdir, false); |
|
| 80 | 80 | }; |
| 81 | 81 | |
| 82 | - $container['aimeos_context'] = function( $c ) { |
|
| 83 | - return new \Aimeos\Slim\Base\Context( $c ); |
|
| 82 | + $container['aimeos_context'] = function($c) { |
|
| 83 | + return new \Aimeos\Slim\Base\Context($c); |
|
| 84 | 84 | }; |
| 85 | 85 | |
| 86 | - $container['aimeos_i18n'] = function( $c ) { |
|
| 87 | - return new \Aimeos\Slim\Base\I18n( $c ); |
|
| 86 | + $container['aimeos_i18n'] = function($c) { |
|
| 87 | + return new \Aimeos\Slim\Base\I18n($c); |
|
| 88 | 88 | }; |
| 89 | 89 | |
| 90 | - $container['aimeos_page'] = function( $c ) { |
|
| 91 | - return new \Aimeos\Slim\Base\Page( $c ); |
|
| 90 | + $container['aimeos_page'] = function($c) { |
|
| 91 | + return new \Aimeos\Slim\Base\Page($c); |
|
| 92 | 92 | }; |
| 93 | 93 | |
| 94 | - $container['aimeos_view'] = function( $c ) { |
|
| 95 | - return new \Aimeos\Slim\Base\View( $c ); |
|
| 94 | + $container['aimeos_view'] = function($c) { |
|
| 95 | + return new \Aimeos\Slim\Base\View($c); |
|
| 96 | 96 | }; |
| 97 | 97 | |
| 98 | 98 | |
| 99 | - $default = require __DIR__ . DIRECTORY_SEPARATOR . 'aimeos-default.php'; |
|
| 100 | - $settings = array_replace_recursive( $default, $this->settings ); |
|
| 99 | + $default = require __DIR__.DIRECTORY_SEPARATOR.'aimeos-default.php'; |
|
| 100 | + $settings = array_replace_recursive($default, $this->settings); |
|
| 101 | 101 | |
| 102 | - $container['aimeos_config'] = function( $c ) use ( $settings ) { |
|
| 102 | + $container['aimeos_config'] = function($c) use ($settings) { |
|
| 103 | 103 | |
| 104 | - $config = new \Aimeos\MW\Config\PHPArray( $settings, $c['aimeos']->getConfigPaths() ); |
|
| 104 | + $config = new \Aimeos\MW\Config\PHPArray($settings, $c['aimeos']->getConfigPaths()); |
|
| 105 | 105 | |
| 106 | - if( function_exists( 'apc_store' ) === true && $config->get( 'apc_enabled', false ) == true ) { |
|
| 107 | - $config = new \Aimeos\MW\Config\Decorator\APC( $config, $config->get( 'apc_prefix', 'slim:' ) ); |
|
| 106 | + if (function_exists('apc_store') === true && $config->get('apc_enabled', false) == true) { |
|
| 107 | + $config = new \Aimeos\MW\Config\Decorator\APC($config, $config->get('apc_prefix', 'slim:')); |
|
| 108 | 108 | } |
| 109 | 109 | |
| 110 | 110 | return $config; |
| 111 | 111 | }; |
| 112 | 112 | |
| 113 | 113 | |
| 114 | - $container['mailer'] = function( $c ) { |
|
| 115 | - return \Swift_Mailer::newInstance( \Swift_SendmailTransport::newInstance() ); |
|
| 114 | + $container['mailer'] = function($c) { |
|
| 115 | + return \Swift_Mailer::newInstance(\Swift_SendmailTransport::newInstance()); |
|
| 116 | 116 | }; |
| 117 | 117 | |
| 118 | 118 | return $this; |
@@ -126,14 +126,14 @@ discard block |
||
| 126 | 126 | */ |
| 127 | 127 | public static function getVersion() |
| 128 | 128 | { |
| 129 | - $basedir = dirname( dirname( dirname( dirname( __DIR__ ) ) ) ) . DIRECTORY_SEPARATOR; |
|
| 129 | + $basedir = dirname(dirname(dirname(dirname(__DIR__)))).DIRECTORY_SEPARATOR; |
|
| 130 | 130 | |
| 131 | - if( ( $content = @file_get_contents( $basedir . 'composer.lock' ) ) !== false |
|
| 132 | - && ( $content = json_decode( $content, true ) ) !== null && isset( $content['packages'] ) |
|
| 131 | + if (($content = @file_get_contents($basedir.'composer.lock')) !== false |
|
| 132 | + && ($content = json_decode($content, true)) !== null && isset($content['packages']) |
|
| 133 | 133 | ) { |
| 134 | - foreach( (array) $content['packages'] as $item ) |
|
| 134 | + foreach ((array) $content['packages'] as $item) |
|
| 135 | 135 | { |
| 136 | - if( $item['name'] === 'aimeos/aimeos-slim' ) { |
|
| 136 | + if ($item['name'] === 'aimeos/aimeos-slim') { |
|
| 137 | 137 | return $item['version']; |
| 138 | 138 | } |
| 139 | 139 | } |
@@ -32,62 +32,62 @@ discard block |
||
| 32 | 32 | * @param array $args Associative list of route parameters |
| 33 | 33 | * @return ResponseInterface $response Modified response object with generated output |
| 34 | 34 | */ |
| 35 | - public static function indexAction( ContainerInterface $container, ServerRequestInterface $request, ResponseInterface $response, array $args ) |
|
| 35 | + public static function indexAction(ContainerInterface $container, ServerRequestInterface $request, ResponseInterface $response, array $args) |
|
| 36 | 36 | { |
| 37 | - $site = ( isset( $args['site'] ) ? $args['site'] : 'default' ); |
|
| 38 | - $lang = ( isset( $args['lang'] ) ? $args['lang'] : 'en' ); |
|
| 39 | - $tab = ( isset( $args['tab'] ) ? $args['tab'] : 0 ); |
|
| 37 | + $site = (isset($args['site']) ? $args['site'] : 'default'); |
|
| 38 | + $lang = (isset($args['lang']) ? $args['lang'] : 'en'); |
|
| 39 | + $tab = (isset($args['tab']) ? $args['tab'] : 0); |
|
| 40 | 40 | |
| 41 | - $aimeos = $container->get( 'aimeos' ); |
|
| 42 | - $cntlPaths = $aimeos->getCustomPaths( 'controller/extjs' ); |
|
| 41 | + $aimeos = $container->get('aimeos'); |
|
| 42 | + $cntlPaths = $aimeos->getCustomPaths('controller/extjs'); |
|
| 43 | 43 | |
| 44 | - $context = $container->get( 'aimeos_context' )->get( false, $args ); |
|
| 45 | - $context = self::setLocale( $context, $site, $lang ); |
|
| 44 | + $context = $container->get('aimeos_context')->get(false, $args); |
|
| 45 | + $context = self::setLocale($context, $site, $lang); |
|
| 46 | 46 | |
| 47 | - $controller = new \Aimeos\Controller\ExtJS\JsonRpc( $context, $cntlPaths ); |
|
| 47 | + $controller = new \Aimeos\Controller\ExtJS\JsonRpc($context, $cntlPaths); |
|
| 48 | 48 | $cssFiles = array(); |
| 49 | 49 | |
| 50 | - foreach( $aimeos->getCustomPaths( 'admin/extjs' ) as $base => $paths ) |
|
| 50 | + foreach ($aimeos->getCustomPaths('admin/extjs') as $base => $paths) |
|
| 51 | 51 | { |
| 52 | - foreach( $paths as $path ) |
|
| 52 | + foreach ($paths as $path) |
|
| 53 | 53 | { |
| 54 | - $jsbAbsPath = $base . '/' . $path; |
|
| 54 | + $jsbAbsPath = $base.'/'.$path; |
|
| 55 | 55 | |
| 56 | - if( !is_file( $jsbAbsPath ) ) { |
|
| 57 | - throw new \Exception( sprintf( 'JSB2 file "%1$s" not found', $jsbAbsPath ) ); |
|
| 56 | + if (!is_file($jsbAbsPath)) { |
|
| 57 | + throw new \Exception(sprintf('JSB2 file "%1$s" not found', $jsbAbsPath)); |
|
| 58 | 58 | } |
| 59 | 59 | |
| 60 | - $jsb2 = new \Aimeos\MW\Jsb2\Standard( $jsbAbsPath, dirname( $path ) ); |
|
| 61 | - $cssFiles = array_merge( $cssFiles, $jsb2->getUrls( 'css' ) ); |
|
| 60 | + $jsb2 = new \Aimeos\MW\Jsb2\Standard($jsbAbsPath, dirname($path)); |
|
| 61 | + $cssFiles = array_merge($cssFiles, $jsb2->getUrls('css')); |
|
| 62 | 62 | } |
| 63 | 63 | } |
| 64 | 64 | |
| 65 | - $csrfname = $request->getAttribute( 'csrf_name' ); |
|
| 66 | - $csrfvalue = $request->getAttribute( 'csrf_value' ); |
|
| 65 | + $csrfname = $request->getAttribute('csrf_name'); |
|
| 66 | + $csrfvalue = $request->getAttribute('csrf_value'); |
|
| 67 | 67 | |
| 68 | - $router = $container->get( 'router' ); |
|
| 69 | - $jqadmUrl = $router->pathFor( 'aimeos_shop_jqadm_search', array( 'site' => $site, 'resource' => 'product' ) ); |
|
| 70 | - $jsonUrl = $router->pathFor( 'aimeos_shop_extadm_json', array( 'site' => $site, $csrfname => $csrfvalue ) ); |
|
| 71 | - $adminUrl = $router->pathFor( 'aimeos_shop_extadm', array( 'site' => '<site>', 'lang' => '<lang>', 'tab' => '<tab>' ) ); |
|
| 68 | + $router = $container->get('router'); |
|
| 69 | + $jqadmUrl = $router->pathFor('aimeos_shop_jqadm_search', array('site' => $site, 'resource' => 'product')); |
|
| 70 | + $jsonUrl = $router->pathFor('aimeos_shop_extadm_json', array('site' => $site, $csrfname => $csrfvalue)); |
|
| 71 | + $adminUrl = $router->pathFor('aimeos_shop_extadm', array('site' => '<site>', 'lang' => '<lang>', 'tab' => '<tab>')); |
|
| 72 | 72 | |
| 73 | 73 | $vars = array( |
| 74 | 74 | 'lang' => $lang, |
| 75 | 75 | 'cssFiles' => $cssFiles, |
| 76 | - 'languages' => self::getJsonLanguages( $aimeos ), |
|
| 77 | - 'config' => self::getJsonClientConfig( $context ), |
|
| 78 | - 'site' => self::getJsonSiteItem( $context, $site ), |
|
| 79 | - 'i18nContent' => self::getJsonClientI18n( $aimeos->getI18nPaths(), $lang ), |
|
| 80 | - 'uploaddir' => $context->getConfig()->get( 'uploaddir', '/.' ), |
|
| 76 | + 'languages' => self::getJsonLanguages($aimeos), |
|
| 77 | + 'config' => self::getJsonClientConfig($context), |
|
| 78 | + 'site' => self::getJsonSiteItem($context, $site), |
|
| 79 | + 'i18nContent' => self::getJsonClientI18n($aimeos->getI18nPaths(), $lang), |
|
| 80 | + 'uploaddir' => $context->getConfig()->get('uploaddir', '/.'), |
|
| 81 | 81 | 'searchSchemas' => $controller->getJsonSearchSchemas(), |
| 82 | 82 | 'itemSchemas' => $controller->getJsonItemSchemas(), |
| 83 | - 'smd' => $controller->getJsonSmd( $jsonUrl ), |
|
| 83 | + 'smd' => $controller->getJsonSmd($jsonUrl), |
|
| 84 | 84 | 'urlTemplate' => $adminUrl, |
| 85 | 85 | 'jqadmurl' => $jqadmUrl, |
| 86 | 86 | 'activeTab' => $tab, |
| 87 | 87 | 'version' => \Aimeos\Slim\Bootstrap::getVersion(), |
| 88 | 88 | ); |
| 89 | 89 | |
| 90 | - return $container->get( 'view' )->render( $response, 'Extadm/index.html.twig', $vars ); |
|
| 90 | + return $container->get('view')->render($response, 'Extadm/index.html.twig', $vars); |
|
| 91 | 91 | } |
| 92 | 92 | |
| 93 | 93 | |
@@ -100,22 +100,22 @@ discard block |
||
| 100 | 100 | * @param array $args Associative list of route parameters |
| 101 | 101 | * @return ResponseInterface $response Modified response object with generated output |
| 102 | 102 | */ |
| 103 | - public static function doAction( ContainerInterface $container, ServerRequestInterface $request, ResponseInterface $response, array $args ) |
|
| 103 | + public static function doAction(ContainerInterface $container, ServerRequestInterface $request, ResponseInterface $response, array $args) |
|
| 104 | 104 | { |
| 105 | - $cntlPaths = $container->get( 'aimeos' )->getCustomPaths( 'controller/extjs' ); |
|
| 105 | + $cntlPaths = $container->get('aimeos')->getCustomPaths('controller/extjs'); |
|
| 106 | 106 | |
| 107 | - $context = $container->get( 'aimeos_context' )->get( false, $args ); |
|
| 108 | - $context->setView( $container->get( 'aimeos_view' )->create( $request, $response, $args, array() ) ); |
|
| 109 | - $context = self::setLocale( $context ); |
|
| 107 | + $context = $container->get('aimeos_context')->get(false, $args); |
|
| 108 | + $context->setView($container->get('aimeos_view')->create($request, $response, $args, array())); |
|
| 109 | + $context = self::setLocale($context); |
|
| 110 | 110 | |
| 111 | 111 | $params = $request->getQueryParams(); |
| 112 | - if( ( $post = $request->getParsedBody() ) !== null ) { |
|
| 113 | - $params = array_merge( $params, (array) $post ); |
|
| 112 | + if (($post = $request->getParsedBody()) !== null) { |
|
| 113 | + $params = array_merge($params, (array) $post); |
|
| 114 | 114 | } |
| 115 | 115 | |
| 116 | - $controller = new \Aimeos\Controller\ExtJS\JsonRpc( $context, $cntlPaths ); |
|
| 117 | - $output = $controller->process( $params, (string) $request->getBody() ); |
|
| 118 | - $response->getBody()->write( $output ); |
|
| 116 | + $controller = new \Aimeos\Controller\ExtJS\JsonRpc($context, $cntlPaths); |
|
| 117 | + $output = $controller->process($params, (string) $request->getBody()); |
|
| 118 | + $response->getBody()->write($output); |
|
| 119 | 119 | |
| 120 | 120 | return $response; |
| 121 | 121 | } |
@@ -130,30 +130,30 @@ discard block |
||
| 130 | 130 | * @param array $args Associative list of route parameters |
| 131 | 131 | * @return ResponseInterface $response Modified response object with generated output |
| 132 | 132 | */ |
| 133 | - public static function fileAction( ContainerInterface $container, ServerRequestInterface $request, ResponseInterface $response, array $args ) |
|
| 133 | + public static function fileAction(ContainerInterface $container, ServerRequestInterface $request, ResponseInterface $response, array $args) |
|
| 134 | 134 | { |
| 135 | 135 | $contents = ''; |
| 136 | 136 | $jsFiles = array(); |
| 137 | - $aimeos = $container->get( 'aimeos' ); |
|
| 137 | + $aimeos = $container->get('aimeos'); |
|
| 138 | 138 | |
| 139 | - foreach( $aimeos->getCustomPaths( 'admin/extjs' ) as $base => $paths ) |
|
| 139 | + foreach ($aimeos->getCustomPaths('admin/extjs') as $base => $paths) |
|
| 140 | 140 | { |
| 141 | - foreach( $paths as $path ) |
|
| 141 | + foreach ($paths as $path) |
|
| 142 | 142 | { |
| 143 | - $jsbAbsPath = $base . '/' . $path; |
|
| 144 | - $jsb2 = new \Aimeos\MW\Jsb2\Standard( $jsbAbsPath, dirname( $jsbAbsPath ) ); |
|
| 145 | - $jsFiles = array_merge( $jsFiles, $jsb2->getFiles( 'js' ) ); |
|
| 143 | + $jsbAbsPath = $base.'/'.$path; |
|
| 144 | + $jsb2 = new \Aimeos\MW\Jsb2\Standard($jsbAbsPath, dirname($jsbAbsPath)); |
|
| 145 | + $jsFiles = array_merge($jsFiles, $jsb2->getFiles('js')); |
|
| 146 | 146 | } |
| 147 | 147 | } |
| 148 | 148 | |
| 149 | - foreach( $jsFiles as $file ) |
|
| 149 | + foreach ($jsFiles as $file) |
|
| 150 | 150 | { |
| 151 | - if( ( $content = file_get_contents( $file ) ) !== false ) { |
|
| 151 | + if (($content = file_get_contents($file)) !== false) { |
|
| 152 | 152 | $contents .= $content; |
| 153 | 153 | } |
| 154 | 154 | } |
| 155 | 155 | |
| 156 | - return $response->withHeader( 'Content-Type', 'application/javascript' )->getBody()->write( $contents ); |
|
| 156 | + return $response->withHeader('Content-Type', 'application/javascript')->getBody()->write($contents); |
|
| 157 | 157 | } |
| 158 | 158 | |
| 159 | 159 | |
@@ -163,15 +163,15 @@ discard block |
||
| 163 | 163 | * @param \Aimeos\Bootstrap $aimeos Aimeos object |
| 164 | 164 | * @return array List of language IDs with labels |
| 165 | 165 | */ |
| 166 | - protected static function getJsonLanguages( \Aimeos\Bootstrap $aimeos ) |
|
| 166 | + protected static function getJsonLanguages(\Aimeos\Bootstrap $aimeos) |
|
| 167 | 167 | { |
| 168 | 168 | $result = array(); |
| 169 | 169 | |
| 170 | - foreach( $aimeos->getI18nList( 'admin' ) as $id ) { |
|
| 171 | - $result[] = array( 'id' => $id, 'label' => $id ); |
|
| 170 | + foreach ($aimeos->getI18nList('admin') as $id) { |
|
| 171 | + $result[] = array('id' => $id, 'label' => $id); |
|
| 172 | 172 | } |
| 173 | 173 | |
| 174 | - return json_encode( $result ); |
|
| 174 | + return json_encode($result); |
|
| 175 | 175 | } |
| 176 | 176 | |
| 177 | 177 | |
@@ -181,10 +181,10 @@ discard block |
||
| 181 | 181 | * @param \Aimeos\MShop\Context\Item\Iface $context Context item object |
| 182 | 182 | * @return string JSON encoded configuration object |
| 183 | 183 | */ |
| 184 | - protected static function getJsonClientConfig( \Aimeos\MShop\Context\Item\Iface $context ) |
|
| 184 | + protected static function getJsonClientConfig(\Aimeos\MShop\Context\Item\Iface $context) |
|
| 185 | 185 | { |
| 186 | - $config = $context->getConfig()->get( 'admin/extjs', array() ); |
|
| 187 | - return json_encode( array( 'admin' => array( 'extjs' => $config ) ), JSON_FORCE_OBJECT ); |
|
| 186 | + $config = $context->getConfig()->get('admin/extjs', array()); |
|
| 187 | + return json_encode(array('admin' => array('extjs' => $config)), JSON_FORCE_OBJECT); |
|
| 188 | 188 | } |
| 189 | 189 | |
| 190 | 190 | |
@@ -195,16 +195,16 @@ discard block |
||
| 195 | 195 | * @param string $lang ISO language code like "en" or "en_GB" |
| 196 | 196 | * @return string JSON encoded translation object |
| 197 | 197 | */ |
| 198 | - protected static function getJsonClientI18n( array $i18nPaths, $lang ) |
|
| 198 | + protected static function getJsonClientI18n(array $i18nPaths, $lang) |
|
| 199 | 199 | { |
| 200 | - $i18n = new \Aimeos\MW\Translation\Gettext( $i18nPaths, $lang ); |
|
| 200 | + $i18n = new \Aimeos\MW\Translation\Gettext($i18nPaths, $lang); |
|
| 201 | 201 | |
| 202 | 202 | $content = array( |
| 203 | - 'admin' => $i18n->getAll( 'admin' ), |
|
| 204 | - 'admin/ext' => $i18n->getAll( 'admin/ext' ), |
|
| 203 | + 'admin' => $i18n->getAll('admin'), |
|
| 204 | + 'admin/ext' => $i18n->getAll('admin/ext'), |
|
| 205 | 205 | ); |
| 206 | 206 | |
| 207 | - return json_encode( $content, JSON_FORCE_OBJECT ); |
|
| 207 | + return json_encode($content, JSON_FORCE_OBJECT); |
|
| 208 | 208 | } |
| 209 | 209 | |
| 210 | 210 | |
@@ -216,19 +216,19 @@ discard block |
||
| 216 | 216 | * @return string JSON encoded site item object |
| 217 | 217 | * @throws Exception If no site item was found for the code |
| 218 | 218 | */ |
| 219 | - protected static function getJsonSiteItem( \Aimeos\MShop\Context\Item\Iface $context, $site ) |
|
| 219 | + protected static function getJsonSiteItem(\Aimeos\MShop\Context\Item\Iface $context, $site) |
|
| 220 | 220 | { |
| 221 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'locale/site' ); |
|
| 221 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'locale/site'); |
|
| 222 | 222 | |
| 223 | 223 | $criteria = $manager->createSearch(); |
| 224 | - $criteria->setConditions( $criteria->compare( '==', 'locale.site.code', $site ) ); |
|
| 225 | - $items = $manager->searchItems( $criteria ); |
|
| 224 | + $criteria->setConditions($criteria->compare('==', 'locale.site.code', $site)); |
|
| 225 | + $items = $manager->searchItems($criteria); |
|
| 226 | 226 | |
| 227 | - if( ( $item = reset( $items ) ) === false ) { |
|
| 228 | - throw new \Exception( sprintf( 'No site found for code "%1$s"', $site ) ); |
|
| 227 | + if (($item = reset($items)) === false) { |
|
| 228 | + throw new \Exception(sprintf('No site found for code "%1$s"', $site)); |
|
| 229 | 229 | } |
| 230 | 230 | |
| 231 | - return json_encode( $item->toArray() ); |
|
| 231 | + return json_encode($item->toArray()); |
|
| 232 | 232 | } |
| 233 | 233 | |
| 234 | 234 | |
@@ -240,17 +240,17 @@ discard block |
||
| 240 | 240 | * @param string $locale ISO language code, e.g. "en" or "en_GB" |
| 241 | 241 | * @return \Aimeos\MShop\Context\Item\Iface Modified context object |
| 242 | 242 | */ |
| 243 | - protected static function setLocale( \Aimeos\MShop\Context\Item\Iface $context, $sitecode = 'default', $locale = null ) |
|
| 243 | + protected static function setLocale(\Aimeos\MShop\Context\Item\Iface $context, $sitecode = 'default', $locale = null) |
|
| 244 | 244 | { |
| 245 | - $localeManager = \Aimeos\MShop\Factory::createManager( $context, 'locale' ); |
|
| 245 | + $localeManager = \Aimeos\MShop\Factory::createManager($context, 'locale'); |
|
| 246 | 246 | |
| 247 | 247 | try { |
| 248 | - $localeItem = $localeManager->bootstrap( $sitecode, $locale, '', false ); |
|
| 249 | - } catch( \Aimeos\MShop\Locale\Exception $e ) { |
|
| 248 | + $localeItem = $localeManager->bootstrap($sitecode, $locale, '', false); |
|
| 249 | + } catch (\Aimeos\MShop\Locale\Exception $e) { |
|
| 250 | 250 | $localeItem = $localeManager->createItem(); |
| 251 | 251 | } |
| 252 | 252 | |
| 253 | - $context->setLocale( $localeItem ); |
|
| 253 | + $context->setLocale($localeItem); |
|
| 254 | 254 | |
| 255 | 255 | return $context; |
| 256 | 256 | } |
@@ -32,36 +32,36 @@ discard block |
||
| 32 | 32 | * @param array $args Associative list of route parameters |
| 33 | 33 | * @return ResponseInterface $response Modified response object with generated output |
| 34 | 34 | */ |
| 35 | - public static function fileAction( ContainerInterface $container, ServerRequestInterface $request, ResponseInterface $response, array $args ) |
|
| 35 | + public static function fileAction(ContainerInterface $container, ServerRequestInterface $request, ResponseInterface $response, array $args) |
|
| 36 | 36 | { |
| 37 | 37 | $contents = ''; |
| 38 | 38 | $files = array(); |
| 39 | - $aimeos = $container->get( 'aimeos' ); |
|
| 40 | - $type = ( isset( $args['type'] ) ? $args['type'] : 'js' ); |
|
| 39 | + $aimeos = $container->get('aimeos'); |
|
| 40 | + $type = (isset($args['type']) ? $args['type'] : 'js'); |
|
| 41 | 41 | |
| 42 | - foreach( $aimeos->getCustomPaths( 'admin/jqadm' ) as $base => $paths ) |
|
| 42 | + foreach ($aimeos->getCustomPaths('admin/jqadm') as $base => $paths) |
|
| 43 | 43 | { |
| 44 | - foreach( $paths as $path ) |
|
| 44 | + foreach ($paths as $path) |
|
| 45 | 45 | { |
| 46 | - $jsbAbsPath = $base . '/' . $path; |
|
| 47 | - $jsb2 = new \Aimeos\MW\Jsb2\Standard( $jsbAbsPath, dirname( $jsbAbsPath ) ); |
|
| 48 | - $files = array_merge( $files, $jsb2->getFiles( $type ) ); |
|
| 46 | + $jsbAbsPath = $base.'/'.$path; |
|
| 47 | + $jsb2 = new \Aimeos\MW\Jsb2\Standard($jsbAbsPath, dirname($jsbAbsPath)); |
|
| 48 | + $files = array_merge($files, $jsb2->getFiles($type)); |
|
| 49 | 49 | } |
| 50 | 50 | } |
| 51 | 51 | |
| 52 | - foreach( $files as $file ) |
|
| 52 | + foreach ($files as $file) |
|
| 53 | 53 | { |
| 54 | - if( ( $content = file_get_contents( $file ) ) !== false ) { |
|
| 54 | + if (($content = file_get_contents($file)) !== false) { |
|
| 55 | 55 | $contents .= $content; |
| 56 | 56 | } |
| 57 | 57 | } |
| 58 | 58 | |
| 59 | - $response->getBody()->write( $contents ); |
|
| 59 | + $response->getBody()->write($contents); |
|
| 60 | 60 | |
| 61 | - if( $type === 'js' ) { |
|
| 62 | - $response = $response->withHeader( 'Content-Type', 'application/javascript' ); |
|
| 63 | - } elseif( $type === 'css' ) { |
|
| 64 | - $response = $response->withHeader( 'Content-Type', 'text/css' ); |
|
| 61 | + if ($type === 'js') { |
|
| 62 | + $response = $response->withHeader('Content-Type', 'application/javascript'); |
|
| 63 | + } elseif ($type === 'css') { |
|
| 64 | + $response = $response->withHeader('Content-Type', 'text/css'); |
|
| 65 | 65 | } |
| 66 | 66 | |
| 67 | 67 | return $response; |
@@ -77,10 +77,10 @@ discard block |
||
| 77 | 77 | * @param array $args Associative list of route parameters |
| 78 | 78 | * @return ResponseInterface $response Modified response object with generated output |
| 79 | 79 | */ |
| 80 | - public static function copyAction( ContainerInterface $container, ServerRequestInterface $request, ResponseInterface $response, array $args ) |
|
| 80 | + public static function copyAction(ContainerInterface $container, ServerRequestInterface $request, ResponseInterface $response, array $args) |
|
| 81 | 81 | { |
| 82 | - $cntl = self::createClient( $container, $request, $response, $args ); |
|
| 83 | - return self::getHtml( $container, $response, $cntl->copy() ); |
|
| 82 | + $cntl = self::createClient($container, $request, $response, $args); |
|
| 83 | + return self::getHtml($container, $response, $cntl->copy()); |
|
| 84 | 84 | } |
| 85 | 85 | |
| 86 | 86 | |
@@ -93,10 +93,10 @@ discard block |
||
| 93 | 93 | * @param array $args Associative list of route parameters |
| 94 | 94 | * @return ResponseInterface $response Modified response object with generated output |
| 95 | 95 | */ |
| 96 | - public static function createAction( ContainerInterface $container, ServerRequestInterface $request, ResponseInterface $response, array $args ) |
|
| 96 | + public static function createAction(ContainerInterface $container, ServerRequestInterface $request, ResponseInterface $response, array $args) |
|
| 97 | 97 | { |
| 98 | - $cntl = self::createClient( $container, $request, $response, $args ); |
|
| 99 | - return self::getHtml( $container, $response, $cntl->create() ); |
|
| 98 | + $cntl = self::createClient($container, $request, $response, $args); |
|
| 99 | + return self::getHtml($container, $response, $cntl->create()); |
|
| 100 | 100 | } |
| 101 | 101 | |
| 102 | 102 | |
@@ -109,10 +109,10 @@ discard block |
||
| 109 | 109 | * @param array $args Associative list of route parameters |
| 110 | 110 | * @return ResponseInterface $response Modified response object with generated output |
| 111 | 111 | */ |
| 112 | - public static function deleteAction( ContainerInterface $container, ServerRequestInterface $request, ResponseInterface $response, array $args ) |
|
| 112 | + public static function deleteAction(ContainerInterface $container, ServerRequestInterface $request, ResponseInterface $response, array $args) |
|
| 113 | 113 | { |
| 114 | - $cntl = self::createClient( $container, $request, $response, $args ); |
|
| 115 | - return self::getHtml( $container, $response, $cntl->delete() . $cntl->search() ); |
|
| 114 | + $cntl = self::createClient($container, $request, $response, $args); |
|
| 115 | + return self::getHtml($container, $response, $cntl->delete().$cntl->search()); |
|
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | |
@@ -125,10 +125,10 @@ discard block |
||
| 125 | 125 | * @param array $args Associative list of route parameters |
| 126 | 126 | * @return ResponseInterface $response Modified response object with generated output |
| 127 | 127 | */ |
| 128 | - public static function getAction( ContainerInterface $container, ServerRequestInterface $request, ResponseInterface $response, array $args ) |
|
| 128 | + public static function getAction(ContainerInterface $container, ServerRequestInterface $request, ResponseInterface $response, array $args) |
|
| 129 | 129 | { |
| 130 | - $cntl = self::createClient( $container, $request, $response, $args ); |
|
| 131 | - return self::getHtml( $container, $response, $cntl->get() ); |
|
| 130 | + $cntl = self::createClient($container, $request, $response, $args); |
|
| 131 | + return self::getHtml($container, $response, $cntl->get()); |
|
| 132 | 132 | } |
| 133 | 133 | |
| 134 | 134 | |
@@ -141,10 +141,10 @@ discard block |
||
| 141 | 141 | * @param array $args Associative list of route parameters |
| 142 | 142 | * @return ResponseInterface $response Modified response object with generated output |
| 143 | 143 | */ |
| 144 | - public static function saveAction( ContainerInterface $container, ServerRequestInterface $request, ResponseInterface $response, array $args ) |
|
| 144 | + public static function saveAction(ContainerInterface $container, ServerRequestInterface $request, ResponseInterface $response, array $args) |
|
| 145 | 145 | { |
| 146 | - $cntl = self::createClient( $container, $request, $response, $args ); |
|
| 147 | - return self::getHtml( $container, $response, ( $cntl->save() ? : $cntl->search() ) ); |
|
| 146 | + $cntl = self::createClient($container, $request, $response, $args); |
|
| 147 | + return self::getHtml($container, $response, ($cntl->save() ?: $cntl->search())); |
|
| 148 | 148 | } |
| 149 | 149 | |
| 150 | 150 | |
@@ -157,10 +157,10 @@ discard block |
||
| 157 | 157 | * @param array $args Associative list of route parameters |
| 158 | 158 | * @return ResponseInterface $response Modified response object with generated output |
| 159 | 159 | */ |
| 160 | - public static function searchAction( ContainerInterface $container, ServerRequestInterface $request, ResponseInterface $response, array $args ) |
|
| 160 | + public static function searchAction(ContainerInterface $container, ServerRequestInterface $request, ResponseInterface $response, array $args) |
|
| 161 | 161 | { |
| 162 | - $cntl = self::createClient( $container, $request, $response, $args ); |
|
| 163 | - return self::getHtml( $container, $response, $cntl->search() ); |
|
| 162 | + $cntl = self::createClient($container, $request, $response, $args); |
|
| 163 | + return self::getHtml($container, $response, $cntl->search()); |
|
| 164 | 164 | } |
| 165 | 165 | |
| 166 | 166 | |
@@ -173,21 +173,21 @@ discard block |
||
| 173 | 173 | * @param array $args Associative list of route parameters |
| 174 | 174 | * @return \Aimeos\Admin\JQAdm\Iface JQAdm client |
| 175 | 175 | */ |
| 176 | - protected static function createClient( ContainerInterface $container, ServerRequestInterface $request, ResponseInterface $response, array $args ) |
|
| 176 | + protected static function createClient(ContainerInterface $container, ServerRequestInterface $request, ResponseInterface $response, array $args) |
|
| 177 | 177 | { |
| 178 | - $resource = ( isset( $args['resource'] ) ? $args['resource'] : null ); |
|
| 179 | - $site = ( isset( $args['site'] ) ? $args['site'] : 'default' ); |
|
| 180 | - $lang = ( isset( $args['lang'] ) ? $args['lang'] : 'en' ); |
|
| 178 | + $resource = (isset($args['resource']) ? $args['resource'] : null); |
|
| 179 | + $site = (isset($args['site']) ? $args['site'] : 'default'); |
|
| 180 | + $lang = (isset($args['lang']) ? $args['lang'] : 'en'); |
|
| 181 | 181 | |
| 182 | - $templatePaths = $container->get( 'aimeos' )->getCustomPaths( 'admin/jqadm/templates' ); |
|
| 182 | + $templatePaths = $container->get('aimeos')->getCustomPaths('admin/jqadm/templates'); |
|
| 183 | 183 | |
| 184 | - $context = $container->get( 'aimeos_context' )->get( false, $args ); |
|
| 185 | - $context = self::setLocale( $container->get( 'aimeos_i18n' ), $context, $site, $lang ); |
|
| 184 | + $context = $container->get('aimeos_context')->get(false, $args); |
|
| 185 | + $context = self::setLocale($container->get('aimeos_i18n'), $context, $site, $lang); |
|
| 186 | 186 | |
| 187 | - $view = $container->get( 'aimeos_view' )->create( $request, $response, $args, $templatePaths, $lang ); |
|
| 188 | - $context->setView( $view ); |
|
| 187 | + $view = $container->get('aimeos_view')->create($request, $response, $args, $templatePaths, $lang); |
|
| 188 | + $context->setView($view); |
|
| 189 | 189 | |
| 190 | - return \Aimeos\Admin\JQAdm\Factory::createClient( $context, $templatePaths, $resource ); |
|
| 190 | + return \Aimeos\Admin\JQAdm\Factory::createClient($context, $templatePaths, $resource); |
|
| 191 | 191 | } |
| 192 | 192 | |
| 193 | 193 | |
@@ -199,12 +199,12 @@ discard block |
||
| 199 | 199 | * @param string $content Content from admin client |
| 200 | 200 | * @return \Illuminate\Contracts\View\View View for rendering the output |
| 201 | 201 | */ |
| 202 | - protected static function getHtml( ContainerInterface $container, ResponseInterface $response, $content ) |
|
| 202 | + protected static function getHtml(ContainerInterface $container, ResponseInterface $response, $content) |
|
| 203 | 203 | { |
| 204 | 204 | $version = \Aimeos\Slim\Bootstrap::getVersion(); |
| 205 | - $content = str_replace( array( '{type}', '{version}' ), array( 'Slim', $version ), $content ); |
|
| 205 | + $content = str_replace(array('{type}', '{version}'), array('Slim', $version), $content); |
|
| 206 | 206 | |
| 207 | - return $container->get( 'view' )->render( $response, 'Jqadm/index.html.twig', array( 'content' => $content ) ); |
|
| 207 | + return $container->get('view')->render($response, 'Jqadm/index.html.twig', array('content' => $content)); |
|
| 208 | 208 | } |
| 209 | 209 | |
| 210 | 210 | |
@@ -217,23 +217,23 @@ discard block |
||
| 217 | 217 | * @param string $lang ISO language code, e.g. "en" or "en_GB" |
| 218 | 218 | * @return \Aimeos\MShop\Context\Item\Iface Modified context object |
| 219 | 219 | */ |
| 220 | - protected static function setLocale( \Aimeos\Slim\Base\I18n $i18n, \Aimeos\MShop\Context\Item\Iface $context, $site, $lang ) |
|
| 220 | + protected static function setLocale(\Aimeos\Slim\Base\I18n $i18n, \Aimeos\MShop\Context\Item\Iface $context, $site, $lang) |
|
| 221 | 221 | { |
| 222 | - $localeManager = \Aimeos\MShop\Factory::createManager( $context, 'locale' ); |
|
| 222 | + $localeManager = \Aimeos\MShop\Factory::createManager($context, 'locale'); |
|
| 223 | 223 | |
| 224 | 224 | try |
| 225 | 225 | { |
| 226 | - $localeItem = $localeManager->bootstrap( $site, '', '', false ); |
|
| 227 | - $localeItem->setLanguageId( null ); |
|
| 228 | - $localeItem->setCurrencyId( null ); |
|
| 226 | + $localeItem = $localeManager->bootstrap($site, '', '', false); |
|
| 227 | + $localeItem->setLanguageId(null); |
|
| 228 | + $localeItem->setCurrencyId(null); |
|
| 229 | 229 | } |
| 230 | - catch( \Aimeos\MShop\Locale\Exception $e ) |
|
| 230 | + catch (\Aimeos\MShop\Locale\Exception $e) |
|
| 231 | 231 | { |
| 232 | 232 | $localeItem = $localeManager->createItem(); |
| 233 | 233 | } |
| 234 | 234 | |
| 235 | - $context->setLocale( $localeItem ); |
|
| 236 | - $context->setI18n( $i18n->get( array( $lang, 'en' ) ) ); |
|
| 235 | + $context->setLocale($localeItem); |
|
| 236 | + $context->setI18n($i18n->get(array($lang, 'en'))); |
|
| 237 | 237 | |
| 238 | 238 | return $context; |
| 239 | 239 | } |