@@ -31,13 +31,13 @@ discard block |
||
| 31 | 31 | * @param array $args Associative list of route parameters |
| 32 | 32 | * @return ResponseInterface $response Modified response object with generated output |
| 33 | 33 | */ |
| 34 | - public static function countAction( ContainerInterface $container, ServerRequestInterface $request, ResponseInterface $response, array $args ) |
|
| 34 | + public static function countAction(ContainerInterface $container, ServerRequestInterface $request, ResponseInterface $response, array $args) |
|
| 35 | 35 | { |
| 36 | - $contents = $container->get( 'aimeos_page' )->getSections( 'catalog-count', $request, $response, $args ); |
|
| 37 | - $response = $container->get( 'view' )->render( $response, 'Catalog/count.html.twig', $contents ); |
|
| 36 | + $contents = $container->get('aimeos_page')->getSections('catalog-count', $request, $response, $args); |
|
| 37 | + $response = $container->get('view')->render($response, 'Catalog/count.html.twig', $contents); |
|
| 38 | 38 | |
| 39 | - return $response->withHeader( 'Content-Type', 'application/javascript' ) |
|
| 40 | - ->withHeader( 'Cache-Control', 'max-age=300' ); |
|
| 39 | + return $response->withHeader('Content-Type', 'application/javascript') |
|
| 40 | + ->withHeader('Cache-Control', 'max-age=300'); |
|
| 41 | 41 | } |
| 42 | 42 | |
| 43 | 43 | |
@@ -50,10 +50,10 @@ discard block |
||
| 50 | 50 | * @param array $args Associative list of route parameters |
| 51 | 51 | * @return ResponseInterface $response Modified response object with generated output |
| 52 | 52 | */ |
| 53 | - public static function detailAction( ContainerInterface $container, ServerRequestInterface $request, ResponseInterface $response, array $args ) |
|
| 53 | + public static function detailAction(ContainerInterface $container, ServerRequestInterface $request, ResponseInterface $response, array $args) |
|
| 54 | 54 | { |
| 55 | - $contents = $container->get( 'aimeos_page' )->getSections( 'catalog-detail', $request, $response, $args ); |
|
| 56 | - return $container->get( 'view' )->render( $response, 'Catalog/detail.html.twig', $contents ); |
|
| 55 | + $contents = $container->get('aimeos_page')->getSections('catalog-detail', $request, $response, $args); |
|
| 56 | + return $container->get('view')->render($response, 'Catalog/detail.html.twig', $contents); |
|
| 57 | 57 | } |
| 58 | 58 | |
| 59 | 59 | |
@@ -66,10 +66,10 @@ discard block |
||
| 66 | 66 | * @param array $args Associative list of route parameters |
| 67 | 67 | * @return ResponseInterface $response Modified response object with generated output |
| 68 | 68 | */ |
| 69 | - public static function listAction( ContainerInterface $container, ServerRequestInterface $request, ResponseInterface $response, array $args ) |
|
| 69 | + public static function listAction(ContainerInterface $container, ServerRequestInterface $request, ResponseInterface $response, array $args) |
|
| 70 | 70 | { |
| 71 | - $contents = $container->get( 'aimeos_page' )->getSections( 'catalog-list', $request, $response, $args ); |
|
| 72 | - return $container->get( 'view' )->render( $response, 'Catalog/list.html.twig', $contents ); |
|
| 71 | + $contents = $container->get('aimeos_page')->getSections('catalog-list', $request, $response, $args); |
|
| 72 | + return $container->get('view')->render($response, 'Catalog/list.html.twig', $contents); |
|
| 73 | 73 | } |
| 74 | 74 | |
| 75 | 75 | |
@@ -82,13 +82,13 @@ discard block |
||
| 82 | 82 | * @param array $args Associative list of route parameters |
| 83 | 83 | * @return ResponseInterface $response Modified response object with generated output |
| 84 | 84 | */ |
| 85 | - public static function stockAction( ContainerInterface $container, ServerRequestInterface $request, ResponseInterface $response, array $args ) |
|
| 85 | + public static function stockAction(ContainerInterface $container, ServerRequestInterface $request, ResponseInterface $response, array $args) |
|
| 86 | 86 | { |
| 87 | - $contents = $container->get( 'aimeos_page' )->getSections( 'catalog-stock', $request, $response, $args ); |
|
| 88 | - $response = $container->get( 'view' )->render( $response, 'Catalog/stock.html.twig', $contents ); |
|
| 87 | + $contents = $container->get('aimeos_page')->getSections('catalog-stock', $request, $response, $args); |
|
| 88 | + $response = $container->get('view')->render($response, 'Catalog/stock.html.twig', $contents); |
|
| 89 | 89 | |
| 90 | - return $response->withHeader( 'Cache-Control', 'max-age=30' ) |
|
| 91 | - ->withHeader( 'Content-Type', 'application/javascript' ); |
|
| 90 | + return $response->withHeader('Cache-Control', 'max-age=30') |
|
| 91 | + ->withHeader('Content-Type', 'application/javascript'); |
|
| 92 | 92 | } |
| 93 | 93 | |
| 94 | 94 | |
@@ -101,11 +101,11 @@ discard block |
||
| 101 | 101 | * @param array $args Associative list of route parameters |
| 102 | 102 | * @return ResponseInterface $response Modified response object with generated output |
| 103 | 103 | */ |
| 104 | - public static function suggestAction( ContainerInterface $container, ServerRequestInterface $request, ResponseInterface $response, array $args ) |
|
| 104 | + public static function suggestAction(ContainerInterface $container, ServerRequestInterface $request, ResponseInterface $response, array $args) |
|
| 105 | 105 | { |
| 106 | - $contents = $container->get( 'aimeos_page' )->getSections( 'catalog-suggest', $request, $response, $args ); |
|
| 107 | - $response = $container->get( 'view' )->render( $response, 'Catalog/suggest.html.twig', $contents ); |
|
| 106 | + $contents = $container->get('aimeos_page')->getSections('catalog-suggest', $request, $response, $args); |
|
| 107 | + $response = $container->get('view')->render($response, 'Catalog/suggest.html.twig', $contents); |
|
| 108 | 108 | |
| 109 | - return $response->withHeader( 'Content-Type', 'application/json' ); |
|
| 109 | + return $response->withHeader('Content-Type', 'application/json'); |
|
| 110 | 110 | } |
| 111 | 111 | } |
| 112 | 112 | \ No newline at end of file |
@@ -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 | } |
@@ -43,35 +43,35 @@ discard block |
||
| 43 | 43 | * @param string $type Configuration type ("frontend" or "backend") |
| 44 | 44 | * @return \Aimeos\MShop\Context\Item\Iface Context object |
| 45 | 45 | */ |
| 46 | - public function get( $locale = true, array $attributes = array(), $type = 'frontend' ) |
|
| 46 | + public function get($locale = true, array $attributes = array(), $type = 'frontend') |
|
| 47 | 47 | { |
| 48 | - $config = $this->container->get( 'aimeos_config' )->get( $type ); |
|
| 48 | + $config = $this->container->get('aimeos_config')->get($type); |
|
| 49 | 49 | |
| 50 | - if( $this->context === null ) |
|
| 50 | + if ($this->context === null) |
|
| 51 | 51 | { |
| 52 | 52 | $context = new \Aimeos\MShop\Context\Item\Standard(); |
| 53 | - $context->setConfig( $config ); |
|
| 54 | - |
|
| 55 | - $this->addDataBaseManager( $context ); |
|
| 56 | - $this->addFilesystemManager( $context ); |
|
| 57 | - $this->addMessageQueueManager( $context ); |
|
| 58 | - $this->addLogger( $context ); |
|
| 59 | - $this->addCache( $context ); |
|
| 60 | - $this->addMailer( $context); |
|
| 61 | - $this->addProcess( $context ); |
|
| 62 | - $this->addSession( $context ); |
|
| 63 | - $this->addUser( $context ); |
|
| 53 | + $context->setConfig($config); |
|
| 54 | + |
|
| 55 | + $this->addDataBaseManager($context); |
|
| 56 | + $this->addFilesystemManager($context); |
|
| 57 | + $this->addMessageQueueManager($context); |
|
| 58 | + $this->addLogger($context); |
|
| 59 | + $this->addCache($context); |
|
| 60 | + $this->addMailer($context); |
|
| 61 | + $this->addProcess($context); |
|
| 62 | + $this->addSession($context); |
|
| 63 | + $this->addUser($context); |
|
| 64 | 64 | |
| 65 | 65 | $this->context = $context; |
| 66 | 66 | } |
| 67 | 67 | |
| 68 | - $this->context->setConfig( $config ); |
|
| 68 | + $this->context->setConfig($config); |
|
| 69 | 69 | |
| 70 | - if( $locale === true ) |
|
| 70 | + if ($locale === true) |
|
| 71 | 71 | { |
| 72 | - $localeItem = $this->container->get( 'aimeos_locale' )->get( $this->context, $attributes ); |
|
| 73 | - $this->context->setLocale( $localeItem ); |
|
| 74 | - $this->context->setI18n( $this->container->get( 'aimeos_i18n' )->get( array( $localeItem->getLanguageId() ) ) ); |
|
| 72 | + $localeItem = $this->container->get('aimeos_locale')->get($this->context, $attributes); |
|
| 73 | + $this->context->setLocale($localeItem); |
|
| 74 | + $this->context->setI18n($this->container->get('aimeos_i18n')->get(array($localeItem->getLanguageId()))); |
|
| 75 | 75 | } |
| 76 | 76 | |
| 77 | 77 | return $this->context; |
@@ -84,11 +84,11 @@ discard block |
||
| 84 | 84 | * @param \Aimeos\MShop\Context\Item\Iface $context Context object including config |
| 85 | 85 | * @return \Aimeos\MShop\Context\Item\Iface Modified context object |
| 86 | 86 | */ |
| 87 | - protected function addCache( \Aimeos\MShop\Context\Item\Iface $context ) |
|
| 87 | + protected function addCache(\Aimeos\MShop\Context\Item\Iface $context) |
|
| 88 | 88 | { |
| 89 | - $cache = new \Aimeos\MAdmin\Cache\Proxy\Standard( $context ); |
|
| 89 | + $cache = new \Aimeos\MAdmin\Cache\Proxy\Standard($context); |
|
| 90 | 90 | |
| 91 | - return $context->setCache( $cache ); |
|
| 91 | + return $context->setCache($cache); |
|
| 92 | 92 | } |
| 93 | 93 | |
| 94 | 94 | |
@@ -98,11 +98,11 @@ discard block |
||
| 98 | 98 | * @param \Aimeos\MShop\Context\Item\Iface $context Context object |
| 99 | 99 | * @return \Aimeos\MShop\Context\Item\Iface Modified context object |
| 100 | 100 | */ |
| 101 | - protected function addDatabaseManager( \Aimeos\MShop\Context\Item\Iface $context ) |
|
| 101 | + protected function addDatabaseManager(\Aimeos\MShop\Context\Item\Iface $context) |
|
| 102 | 102 | { |
| 103 | - $dbm = new \Aimeos\MW\DB\Manager\DBAL( $context->getConfig() ); |
|
| 103 | + $dbm = new \Aimeos\MW\DB\Manager\DBAL($context->getConfig()); |
|
| 104 | 104 | |
| 105 | - return $context->setDatabaseManager( $dbm ); |
|
| 105 | + return $context->setDatabaseManager($dbm); |
|
| 106 | 106 | } |
| 107 | 107 | |
| 108 | 108 | |
@@ -112,11 +112,11 @@ discard block |
||
| 112 | 112 | * @param \Aimeos\MShop\Context\Item\Iface $context Context object |
| 113 | 113 | * @return \Aimeos\MShop\Context\Item\Iface Modified context object |
| 114 | 114 | */ |
| 115 | - protected function addFilesystemManager( \Aimeos\MShop\Context\Item\Iface $context ) |
|
| 115 | + protected function addFilesystemManager(\Aimeos\MShop\Context\Item\Iface $context) |
|
| 116 | 116 | { |
| 117 | - $fs = new \Aimeos\MW\Filesystem\Manager\Standard( $context->getConfig() ); |
|
| 117 | + $fs = new \Aimeos\MW\Filesystem\Manager\Standard($context->getConfig()); |
|
| 118 | 118 | |
| 119 | - return $context->setFilesystemManager( $fs ); |
|
| 119 | + return $context->setFilesystemManager($fs); |
|
| 120 | 120 | } |
| 121 | 121 | |
| 122 | 122 | |
@@ -126,11 +126,11 @@ discard block |
||
| 126 | 126 | * @param \Aimeos\MShop\Context\Item\Iface $context Context object |
| 127 | 127 | * @return \Aimeos\MShop\Context\Item\Iface Modified context object |
| 128 | 128 | */ |
| 129 | - protected function addLogger( \Aimeos\MShop\Context\Item\Iface $context ) |
|
| 129 | + protected function addLogger(\Aimeos\MShop\Context\Item\Iface $context) |
|
| 130 | 130 | { |
| 131 | - $logger = \Aimeos\MAdmin\Log\Manager\Factory::createManager( $context ); |
|
| 131 | + $logger = \Aimeos\MAdmin\Log\Manager\Factory::createManager($context); |
|
| 132 | 132 | |
| 133 | - return $context->setLogger( $logger ); |
|
| 133 | + return $context->setLogger($logger); |
|
| 134 | 134 | } |
| 135 | 135 | |
| 136 | 136 | |
@@ -141,11 +141,11 @@ discard block |
||
| 141 | 141 | * @param \Aimeos\MShop\Context\Item\Iface $context Context object |
| 142 | 142 | * @return \Aimeos\MShop\Context\Item\Iface Modified context object |
| 143 | 143 | */ |
| 144 | - protected function addMailer( \Aimeos\MShop\Context\Item\Iface $context ) |
|
| 144 | + protected function addMailer(\Aimeos\MShop\Context\Item\Iface $context) |
|
| 145 | 145 | { |
| 146 | - $mail = new \Aimeos\MW\Mail\Swift( $this->container->get( 'mailer' ) ); |
|
| 146 | + $mail = new \Aimeos\MW\Mail\Swift($this->container->get('mailer')); |
|
| 147 | 147 | |
| 148 | - return $context->setMail( $mail ); |
|
| 148 | + return $context->setMail($mail); |
|
| 149 | 149 | } |
| 150 | 150 | |
| 151 | 151 | |
@@ -155,11 +155,11 @@ discard block |
||
| 155 | 155 | * @param \Aimeos\MShop\Context\Item\Iface $context Context object |
| 156 | 156 | * @return \Aimeos\MShop\Context\Item\Iface Modified context object |
| 157 | 157 | */ |
| 158 | - protected function addMessageQueueManager( \Aimeos\MShop\Context\Item\Iface $context ) |
|
| 158 | + protected function addMessageQueueManager(\Aimeos\MShop\Context\Item\Iface $context) |
|
| 159 | 159 | { |
| 160 | - $mq = new \Aimeos\MW\MQueue\Manager\Standard( $context->getConfig() ); |
|
| 160 | + $mq = new \Aimeos\MW\MQueue\Manager\Standard($context->getConfig()); |
|
| 161 | 161 | |
| 162 | - return $context->setMessageQueueManager( $mq ); |
|
| 162 | + return $context->setMessageQueueManager($mq); |
|
| 163 | 163 | } |
| 164 | 164 | |
| 165 | 165 | |
@@ -169,16 +169,16 @@ discard block |
||
| 169 | 169 | * @param \Aimeos\MShop\Context\Item\Iface $context Context object |
| 170 | 170 | * @return \Aimeos\MShop\Context\Item\Iface Modified context object |
| 171 | 171 | */ |
| 172 | - protected function addProcess( \Aimeos\MShop\Context\Item\Iface $context ) |
|
| 172 | + protected function addProcess(\Aimeos\MShop\Context\Item\Iface $context) |
|
| 173 | 173 | { |
| 174 | 174 | $config = $context->getConfig(); |
| 175 | - $max = $config->get( 'pcntl_max', 4 ); |
|
| 176 | - $prio = $config->get( 'pcntl_priority', 19 ); |
|
| 175 | + $max = $config->get('pcntl_max', 4); |
|
| 176 | + $prio = $config->get('pcntl_priority', 19); |
|
| 177 | 177 | |
| 178 | - $process = new \Aimeos\MW\Process\Pcntl( $max, $prio ); |
|
| 179 | - $process = new \Aimeos\MW\Process\Decorator\Check( $process ); |
|
| 178 | + $process = new \Aimeos\MW\Process\Pcntl($max, $prio); |
|
| 179 | + $process = new \Aimeos\MW\Process\Decorator\Check($process); |
|
| 180 | 180 | |
| 181 | - return $context->setProcess( $process ); |
|
| 181 | + return $context->setProcess($process); |
|
| 182 | 182 | } |
| 183 | 183 | |
| 184 | 184 | |
@@ -188,11 +188,11 @@ discard block |
||
| 188 | 188 | * @param \Aimeos\MShop\Context\Item\Iface $context Context object |
| 189 | 189 | * @return \Aimeos\MShop\Context\Item\Iface Modified context object |
| 190 | 190 | */ |
| 191 | - protected function addSession( \Aimeos\MShop\Context\Item\Iface $context ) |
|
| 191 | + protected function addSession(\Aimeos\MShop\Context\Item\Iface $context) |
|
| 192 | 192 | { |
| 193 | 193 | $session = new \Aimeos\MW\Session\PHP(); |
| 194 | 194 | |
| 195 | - return $context->setSession( $session ); |
|
| 195 | + return $context->setSession($session); |
|
| 196 | 196 | } |
| 197 | 197 | |
| 198 | 198 | |
@@ -202,10 +202,10 @@ discard block |
||
| 202 | 202 | * @param \Aimeos\MShop\Context\Item\Iface $context Context object |
| 203 | 203 | * @return \Aimeos\MShop\Context\Item\Iface Modified context object |
| 204 | 204 | */ |
| 205 | - protected function addUser( \Aimeos\MShop\Context\Item\Iface $context ) |
|
| 205 | + protected function addUser(\Aimeos\MShop\Context\Item\Iface $context) |
|
| 206 | 206 | { |
| 207 | 207 | $ipaddr = $this->container->request->getAttribute('ip_address'); |
| 208 | 208 | |
| 209 | - return $context->setEditor( $ipaddr ); |
|
| 209 | + return $context->setEditor($ipaddr); |
|
| 210 | 210 | } |
| 211 | 211 | } |
@@ -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 | } |
@@ -47,38 +47,38 @@ discard block |
||
| 47 | 47 | * @param string|null $locale Code of the current language or null for no translation |
| 48 | 48 | * @return \Aimeos\MW\View\Iface View object |
| 49 | 49 | */ |
| 50 | - public function create( \Aimeos\MShop\Context\Item\Iface $context, ServerRequestInterface $request, |
|
| 51 | - ResponseInterface $response, array $attributes, array $templatePaths, $locale = null ) |
|
| 50 | + public function create(\Aimeos\MShop\Context\Item\Iface $context, ServerRequestInterface $request, |
|
| 51 | + ResponseInterface $response, array $attributes, array $templatePaths, $locale = null) |
|
| 52 | 52 | { |
| 53 | 53 | $iface = 'Slim\Views\Twig'; |
| 54 | 54 | $params = $attributes + (array) $request->getParsedBody() + (array) $request->getQueryParams(); |
| 55 | 55 | |
| 56 | - if( isset( $this->container['view'] ) && $this->container['view'] instanceof $iface ) |
|
| 56 | + if (isset($this->container['view']) && $this->container['view'] instanceof $iface) |
|
| 57 | 57 | { |
| 58 | 58 | $twig = $this->container['view']->getEnvironment(); |
| 59 | - $engines = array( '.html.twig' => new \Aimeos\MW\View\Engine\Twig( $twig ) ); |
|
| 59 | + $engines = array('.html.twig' => new \Aimeos\MW\View\Engine\Twig($twig)); |
|
| 60 | 60 | |
| 61 | - $view = new \Aimeos\MW\View\Standard( $templatePaths, $engines ); |
|
| 62 | - $this->initTwig( $view, $twig ); |
|
| 61 | + $view = new \Aimeos\MW\View\Standard($templatePaths, $engines); |
|
| 62 | + $this->initTwig($view, $twig); |
|
| 63 | 63 | } |
| 64 | 64 | else |
| 65 | 65 | { |
| 66 | - $view = new \Aimeos\MW\View\Standard( $templatePaths ); |
|
| 66 | + $view = new \Aimeos\MW\View\Standard($templatePaths); |
|
| 67 | 67 | } |
| 68 | 68 | |
| 69 | 69 | $config = $context->getConfig(); |
| 70 | 70 | $session = $context->getSession(); |
| 71 | 71 | |
| 72 | - $this->addAccess( $view ); |
|
| 73 | - $this->addConfig( $view, $config ); |
|
| 74 | - $this->addCsrf( $view, $request ); |
|
| 75 | - $this->addNumber( $view, $config ); |
|
| 76 | - $this->addParam( $view, $params ); |
|
| 77 | - $this->addRequest( $view, $request ); |
|
| 78 | - $this->addResponse( $view, $response ); |
|
| 79 | - $this->addSession( $view, $session ); |
|
| 80 | - $this->addTranslate( $view, $locale ); |
|
| 81 | - $this->addUrl( $view, $attributes ); |
|
| 72 | + $this->addAccess($view); |
|
| 73 | + $this->addConfig($view, $config); |
|
| 74 | + $this->addCsrf($view, $request); |
|
| 75 | + $this->addNumber($view, $config); |
|
| 76 | + $this->addParam($view, $params); |
|
| 77 | + $this->addRequest($view, $request); |
|
| 78 | + $this->addResponse($view, $response); |
|
| 79 | + $this->addSession($view, $session); |
|
| 80 | + $this->addTranslate($view, $locale); |
|
| 81 | + $this->addUrl($view, $attributes); |
|
| 82 | 82 | |
| 83 | 83 | return $view; |
| 84 | 84 | } |
@@ -90,10 +90,10 @@ discard block |
||
| 90 | 90 | * @param \Aimeos\MW\View\Iface $view View object |
| 91 | 91 | * @return \Aimeos\MW\View\Iface Modified view object |
| 92 | 92 | */ |
| 93 | - protected function addAccess( \Aimeos\MW\View\Iface $view ) |
|
| 93 | + protected function addAccess(\Aimeos\MW\View\Iface $view) |
|
| 94 | 94 | { |
| 95 | - $helper = new \Aimeos\MW\View\Helper\Access\All( $view ); |
|
| 96 | - $view->addHelper( 'access', $helper ); |
|
| 95 | + $helper = new \Aimeos\MW\View\Helper\Access\All($view); |
|
| 96 | + $view->addHelper('access', $helper); |
|
| 97 | 97 | |
| 98 | 98 | return $view; |
| 99 | 99 | } |
@@ -106,11 +106,11 @@ discard block |
||
| 106 | 106 | * @param \Aimeos\MW\Config\Iface $config Configuration object |
| 107 | 107 | * @return \Aimeos\MW\View\Iface Modified view object |
| 108 | 108 | */ |
| 109 | - protected function addConfig( \Aimeos\MW\View\Iface $view, \Aimeos\MW\Config\Iface $config ) |
|
| 109 | + protected function addConfig(\Aimeos\MW\View\Iface $view, \Aimeos\MW\Config\Iface $config) |
|
| 110 | 110 | { |
| 111 | - $config = new \Aimeos\MW\Config\Decorator\Protect( clone $config, array( 'admin', 'client' ) ); |
|
| 112 | - $helper = new \Aimeos\MW\View\Helper\Config\Standard( $view, $config ); |
|
| 113 | - $view->addHelper( 'config', $helper ); |
|
| 111 | + $config = new \Aimeos\MW\Config\Decorator\Protect(clone $config, array('admin', 'client')); |
|
| 112 | + $helper = new \Aimeos\MW\View\Helper\Config\Standard($view, $config); |
|
| 113 | + $view->addHelper('config', $helper); |
|
| 114 | 114 | |
| 115 | 115 | return $view; |
| 116 | 116 | } |
@@ -123,13 +123,13 @@ discard block |
||
| 123 | 123 | * @param ServerRequestInterface $request Request object |
| 124 | 124 | * @return \Aimeos\MW\View\Iface Modified view object |
| 125 | 125 | */ |
| 126 | - protected function addCsrf( \Aimeos\MW\View\Iface $view, ServerRequestInterface $request ) |
|
| 126 | + protected function addCsrf(\Aimeos\MW\View\Iface $view, ServerRequestInterface $request) |
|
| 127 | 127 | { |
| 128 | - $name = $request->getAttribute( 'csrf_name' ); |
|
| 129 | - $value = $request->getAttribute( 'csrf_value' ); |
|
| 128 | + $name = $request->getAttribute('csrf_name'); |
|
| 129 | + $value = $request->getAttribute('csrf_value'); |
|
| 130 | 130 | |
| 131 | - $helper = new \Aimeos\MW\View\Helper\Csrf\Standard( $view, $name, $value ); |
|
| 132 | - $view->addHelper( 'csrf', $helper ); |
|
| 131 | + $helper = new \Aimeos\MW\View\Helper\Csrf\Standard($view, $name, $value); |
|
| 132 | + $view->addHelper('csrf', $helper); |
|
| 133 | 133 | |
| 134 | 134 | return $view; |
| 135 | 135 | } |
@@ -142,14 +142,14 @@ discard block |
||
| 142 | 142 | * @param \Aimeos\MW\Config\Iface $config Configuration object |
| 143 | 143 | * @return \Aimeos\MW\View\Iface Modified view object |
| 144 | 144 | */ |
| 145 | - protected function addNumber( \Aimeos\MW\View\Iface $view, \Aimeos\MW\Config\Iface $config ) |
|
| 145 | + protected function addNumber(\Aimeos\MW\View\Iface $view, \Aimeos\MW\Config\Iface $config) |
|
| 146 | 146 | { |
| 147 | - $sepDec = $config->get( 'client/html/common/format/separatorDecimal', '.' ); |
|
| 148 | - $sep1000 = $config->get( 'client/html/common/format/separator1000', ' ' ); |
|
| 149 | - $decimals = $config->get( 'client/html/common/format/decimals', 2 ); |
|
| 147 | + $sepDec = $config->get('client/html/common/format/separatorDecimal', '.'); |
|
| 148 | + $sep1000 = $config->get('client/html/common/format/separator1000', ' '); |
|
| 149 | + $decimals = $config->get('client/html/common/format/decimals', 2); |
|
| 150 | 150 | |
| 151 | - $helper = new \Aimeos\MW\View\Helper\Number\Standard( $view, $sepDec, $sep1000, $decimals ); |
|
| 152 | - $view->addHelper( 'number', $helper ); |
|
| 151 | + $helper = new \Aimeos\MW\View\Helper\Number\Standard($view, $sepDec, $sep1000, $decimals); |
|
| 152 | + $view->addHelper('number', $helper); |
|
| 153 | 153 | |
| 154 | 154 | return $view; |
| 155 | 155 | } |
@@ -162,10 +162,10 @@ discard block |
||
| 162 | 162 | * @param array $attributes Associative list of request parameters |
| 163 | 163 | * @return \Aimeos\MW\View\Iface Modified view object |
| 164 | 164 | */ |
| 165 | - protected static function addParam( \Aimeos\MW\View\Iface $view, array $params ) |
|
| 165 | + protected static function addParam(\Aimeos\MW\View\Iface $view, array $params) |
|
| 166 | 166 | { |
| 167 | - $helper = new \Aimeos\MW\View\Helper\Param\Standard( $view, $params ); |
|
| 168 | - $view->addHelper( 'param', $helper ); |
|
| 167 | + $helper = new \Aimeos\MW\View\Helper\Param\Standard($view, $params); |
|
| 168 | + $view->addHelper('param', $helper); |
|
| 169 | 169 | |
| 170 | 170 | return $view; |
| 171 | 171 | } |
@@ -178,10 +178,10 @@ discard block |
||
| 178 | 178 | * @param ServerRequestInterface $request Request object |
| 179 | 179 | * @return \Aimeos\MW\View\Iface Modified view object |
| 180 | 180 | */ |
| 181 | - protected static function addRequest( \Aimeos\MW\View\Iface $view, ServerRequestInterface $request ) |
|
| 181 | + protected static function addRequest(\Aimeos\MW\View\Iface $view, ServerRequestInterface $request) |
|
| 182 | 182 | { |
| 183 | - $helper = new \Aimeos\MW\View\Helper\Request\Slim( $view, $request ); |
|
| 184 | - $view->addHelper( 'request', $helper ); |
|
| 183 | + $helper = new \Aimeos\MW\View\Helper\Request\Slim($view, $request); |
|
| 184 | + $view->addHelper('request', $helper); |
|
| 185 | 185 | |
| 186 | 186 | return $view; |
| 187 | 187 | } |
@@ -194,10 +194,10 @@ discard block |
||
| 194 | 194 | * @param ResponseInterface $response Response object |
| 195 | 195 | * @return \Aimeos\MW\View\Iface Modified view object |
| 196 | 196 | */ |
| 197 | - protected static function addResponse( \Aimeos\MW\View\Iface $view, ResponseInterface $response ) |
|
| 197 | + protected static function addResponse(\Aimeos\MW\View\Iface $view, ResponseInterface $response) |
|
| 198 | 198 | { |
| 199 | - $helper = new \Aimeos\MW\View\Helper\Response\Slim( $view, $response ); |
|
| 200 | - $view->addHelper( 'response', $helper ); |
|
| 199 | + $helper = new \Aimeos\MW\View\Helper\Response\Slim($view, $response); |
|
| 200 | + $view->addHelper('response', $helper); |
|
| 201 | 201 | |
| 202 | 202 | return $view; |
| 203 | 203 | } |
@@ -210,10 +210,10 @@ discard block |
||
| 210 | 210 | * @param \Aimeos\MW\Session\Iface $session Session object |
| 211 | 211 | * @return \Aimeos\MW\View\Iface Modified view object |
| 212 | 212 | */ |
| 213 | - protected function addSession( \Aimeos\MW\View\Iface $view, \Aimeos\MW\Session\Iface $session ) |
|
| 213 | + protected function addSession(\Aimeos\MW\View\Iface $view, \Aimeos\MW\Session\Iface $session) |
|
| 214 | 214 | { |
| 215 | - $helper = new \Aimeos\MW\View\Helper\Session\Standard( $view, $session ); |
|
| 216 | - $view->addHelper( 'session', $helper ); |
|
| 215 | + $helper = new \Aimeos\MW\View\Helper\Session\Standard($view, $session); |
|
| 216 | + $view->addHelper('session', $helper); |
|
| 217 | 217 | |
| 218 | 218 | return $view; |
| 219 | 219 | } |
@@ -226,20 +226,20 @@ discard block |
||
| 226 | 226 | * @param string|null $locale ISO language code, e.g. "de" or "de_CH" |
| 227 | 227 | * @return \Aimeos\MW\View\Iface Modified view object |
| 228 | 228 | */ |
| 229 | - protected function addTranslate( \Aimeos\MW\View\Iface $view, $locale ) |
|
| 229 | + protected function addTranslate(\Aimeos\MW\View\Iface $view, $locale) |
|
| 230 | 230 | { |
| 231 | - if( $locale !== null ) |
|
| 231 | + if ($locale !== null) |
|
| 232 | 232 | { |
| 233 | - $i18n = $this->container->get( 'aimeos_i18n' )->get( array( $locale ) ); |
|
| 233 | + $i18n = $this->container->get('aimeos_i18n')->get(array($locale)); |
|
| 234 | 234 | $translation = $i18n[$locale]; |
| 235 | 235 | } |
| 236 | 236 | else |
| 237 | 237 | { |
| 238 | - $translation = new \Aimeos\MW\Translation\None( 'en' ); |
|
| 238 | + $translation = new \Aimeos\MW\Translation\None('en'); |
|
| 239 | 239 | } |
| 240 | 240 | |
| 241 | - $helper = new \Aimeos\MW\View\Helper\Translate\Standard( $view, $translation ); |
|
| 242 | - $view->addHelper( 'translate', $helper ); |
|
| 241 | + $helper = new \Aimeos\MW\View\Helper\Translate\Standard($view, $translation); |
|
| 242 | + $view->addHelper('translate', $helper); |
|
| 243 | 243 | |
| 244 | 244 | return $view; |
| 245 | 245 | } |
@@ -252,24 +252,24 @@ discard block |
||
| 252 | 252 | * @param array $attributes Associative list of URI parameters |
| 253 | 253 | * @return \Aimeos\MW\View\Iface Modified view object |
| 254 | 254 | */ |
| 255 | - protected function addUrl( \Aimeos\MW\View\Iface $view, array $attributes ) |
|
| 255 | + protected function addUrl(\Aimeos\MW\View\Iface $view, array $attributes) |
|
| 256 | 256 | { |
| 257 | 257 | $fixed = array(); |
| 258 | 258 | |
| 259 | - if( isset( $attributes['site'] ) ) { |
|
| 259 | + if (isset($attributes['site'])) { |
|
| 260 | 260 | $fixed['site'] = $attributes['site']; |
| 261 | 261 | } |
| 262 | 262 | |
| 263 | - if( isset( $attributes['locale'] ) ) { |
|
| 263 | + if (isset($attributes['locale'])) { |
|
| 264 | 264 | $fixed['locale'] = $attributes['locale']; |
| 265 | 265 | } |
| 266 | 266 | |
| 267 | - if( isset( $attributes['currency'] ) ) { |
|
| 267 | + if (isset($attributes['currency'])) { |
|
| 268 | 268 | $fixed['currency'] = $attributes['currency']; |
| 269 | 269 | } |
| 270 | 270 | |
| 271 | - $helper = new \Aimeos\MW\View\Helper\Url\Slim( $view, $this->container->get( 'router' ), $fixed ); |
|
| 272 | - $view->addHelper( 'url', $helper ); |
|
| 271 | + $helper = new \Aimeos\MW\View\Helper\Url\Slim($view, $this->container->get('router'), $fixed); |
|
| 272 | + $view->addHelper('url', $helper); |
|
| 273 | 273 | |
| 274 | 274 | return $view; |
| 275 | 275 | } |
@@ -281,21 +281,21 @@ discard block |
||
| 281 | 281 | * @param \Aimeos\MW\View\Iface $view View object |
| 282 | 282 | * @param \Twig_Environment $twig Twig environment object |
| 283 | 283 | */ |
| 284 | - protected function initTwig( \Aimeos\MW\View\Iface $view, \Twig_Environment $twig ) |
|
| 284 | + protected function initTwig(\Aimeos\MW\View\Iface $view, \Twig_Environment $twig) |
|
| 285 | 285 | { |
| 286 | - $fcn = function( $key, $default = null ) use ( $view ) { |
|
| 287 | - return $view->config( $key, $default ); |
|
| 286 | + $fcn = function($key, $default = null) use ($view) { |
|
| 287 | + return $view->config($key, $default); |
|
| 288 | 288 | }; |
| 289 | - $twig->addFunction( new \Twig_SimpleFunction( 'aiconfig', $fcn ) ); |
|
| 289 | + $twig->addFunction(new \Twig_SimpleFunction('aiconfig', $fcn)); |
|
| 290 | 290 | |
| 291 | - $fcn = function( $singular, array $values = array(), $domain = 'client' ) use ( $view ) { |
|
| 292 | - return vsprintf( $view->translate( $domain, $singular ), $values ); |
|
| 291 | + $fcn = function($singular, array $values = array(), $domain = 'client') use ($view) { |
|
| 292 | + return vsprintf($view->translate($domain, $singular), $values); |
|
| 293 | 293 | }; |
| 294 | - $twig->addFunction( new \Twig_SimpleFunction( 'aitrans', $fcn ) ); |
|
| 294 | + $twig->addFunction(new \Twig_SimpleFunction('aitrans', $fcn)); |
|
| 295 | 295 | |
| 296 | - $fcn = function( $singular, $plural, $number, array $values = array(), $domain = 'client' ) use ( $view ) { |
|
| 297 | - return vsprintf( $view->translate( $domain, $singular, $plural, $number ), $values ); |
|
| 296 | + $fcn = function($singular, $plural, $number, array $values = array(), $domain = 'client') use ($view) { |
|
| 297 | + return vsprintf($view->translate($domain, $singular, $plural, $number), $values); |
|
| 298 | 298 | }; |
| 299 | - $twig->addFunction( new \Twig_SimpleFunction( 'aitransplural', $fcn ) ); |
|
| 299 | + $twig->addFunction(new \Twig_SimpleFunction('aitransplural', $fcn)); |
|
| 300 | 300 | } |
| 301 | 301 | } |
@@ -34,28 +34,28 @@ discard block |
||
| 34 | 34 | * |
| 35 | 35 | * @param array $argv Associative array from $_SERVER['argv'] |
| 36 | 36 | */ |
| 37 | - public static function run( array $argv ) |
|
| 37 | + public static function run(array $argv) |
|
| 38 | 38 | { |
| 39 | - array_shift( $argv ); |
|
| 40 | - $options = self::getOptions( $argv ); |
|
| 39 | + array_shift($argv); |
|
| 40 | + $options = self::getOptions($argv); |
|
| 41 | 41 | |
| 42 | - if( ( $jobs = array_shift( $argv ) ) === null ) { |
|
| 42 | + if (($jobs = array_shift($argv)) === null) { |
|
| 43 | 43 | throw new \Aimeos\Slim\Command\Exception(); |
| 44 | 44 | } |
| 45 | - $sites = array_shift( $argv ); |
|
| 45 | + $sites = array_shift($argv); |
|
| 46 | 46 | |
| 47 | - $config = self::getConfig( $options ); |
|
| 47 | + $config = self::getConfig($options); |
|
| 48 | 48 | |
| 49 | - $app = new \Slim\App( $config ); |
|
| 50 | - $aimeos = new \Aimeos\Slim\Bootstrap( $app, $config ); |
|
| 51 | - $aimeos->setup( ( isset( $options['extdir'] ) ? $options['extdir'] : './ext' ) ) |
|
| 52 | - ->routes( ( isset( $options['routes'] ) ? $options['routes'] : './src/aimeos-routes.php' ) ); |
|
| 49 | + $app = new \Slim\App($config); |
|
| 50 | + $aimeos = new \Aimeos\Slim\Bootstrap($app, $config); |
|
| 51 | + $aimeos->setup((isset($options['extdir']) ? $options['extdir'] : './ext')) |
|
| 52 | + ->routes((isset($options['routes']) ? $options['routes'] : './src/aimeos-routes.php')); |
|
| 53 | 53 | |
| 54 | 54 | $container = $app->getContainer(); |
| 55 | - $context = self::getContext( $container ); |
|
| 55 | + $context = self::getContext($container); |
|
| 56 | 56 | |
| 57 | - $siteItems = self::getSiteItems( $context, $sites ); |
|
| 58 | - self::execute( $container->get( 'aimeos' ), $context, $siteItems, $jobs ); |
|
| 57 | + $siteItems = self::getSiteItems($context, $sites); |
|
| 58 | + self::execute($container->get('aimeos'), $context, $siteItems, $jobs); |
|
| 59 | 59 | } |
| 60 | 60 | |
| 61 | 61 | |
@@ -65,16 +65,16 @@ discard block |
||
| 65 | 65 | * @param array $options Associative list of given options |
| 66 | 66 | * @return array Multi-dimensional array of configuration settings |
| 67 | 67 | */ |
| 68 | - protected static function getConfig( array $options ) |
|
| 68 | + protected static function getConfig(array $options) |
|
| 69 | 69 | { |
| 70 | 70 | $config = array(); |
| 71 | 71 | |
| 72 | - if( isset( $options['config'] ) ) |
|
| 72 | + if (isset($options['config'])) |
|
| 73 | 73 | { |
| 74 | - foreach( (array) $options['config'] as $path ) |
|
| 74 | + foreach ((array) $options['config'] as $path) |
|
| 75 | 75 | { |
| 76 | - if( is_file( $path ) ) { |
|
| 77 | - $config = array_replace_recursive( $config, require $path ); |
|
| 76 | + if (is_file($path)) { |
|
| 77 | + $config = array_replace_recursive($config, require $path); |
|
| 78 | 78 | } |
| 79 | 79 | } |
| 80 | 80 | } |
@@ -89,25 +89,25 @@ discard block |
||
| 89 | 89 | * @param \Interop\Container\ContainerInterface $container Dependency injection container |
| 90 | 90 | * @return \Aimeos\MShop\Context\Item\Standard Context object |
| 91 | 91 | */ |
| 92 | - protected static function getContext( \Interop\Container\ContainerInterface $container ) |
|
| 92 | + protected static function getContext(\Interop\Container\ContainerInterface $container) |
|
| 93 | 93 | { |
| 94 | - $aimeos = $container->get( 'aimeos' ); |
|
| 95 | - $context = $container->get( 'aimeos_context' )->get( false, array(), 'command' ); |
|
| 94 | + $aimeos = $container->get('aimeos'); |
|
| 95 | + $context = $container->get('aimeos_context')->get(false, array(), 'command'); |
|
| 96 | 96 | |
| 97 | 97 | $env = \Slim\Http\Environment::mock(); |
| 98 | - $request = \Slim\Http\Request::createFromEnvironment( $env ); |
|
| 98 | + $request = \Slim\Http\Request::createFromEnvironment($env); |
|
| 99 | 99 | $response = new \Slim\Http\Response(); |
| 100 | 100 | |
| 101 | - $tmplPaths = $aimeos->getCustomPaths( 'controller/jobs/templates' ); |
|
| 102 | - $view = $container->get( 'aimeos_view' )->create( $context, $request, $response, array(), $tmplPaths ); |
|
| 101 | + $tmplPaths = $aimeos->getCustomPaths('controller/jobs/templates'); |
|
| 102 | + $view = $container->get('aimeos_view')->create($context, $request, $response, array(), $tmplPaths); |
|
| 103 | 103 | |
| 104 | - $langManager = \Aimeos\MShop\Factory::createManager( $context, 'locale/language' ); |
|
| 105 | - $langids = array_keys( $langManager->searchItems( $langManager->createSearch( true ) ) ); |
|
| 106 | - $i18n = $container->get( 'aimeos_i18n' )->get( $langids ); |
|
| 104 | + $langManager = \Aimeos\MShop\Factory::createManager($context, 'locale/language'); |
|
| 105 | + $langids = array_keys($langManager->searchItems($langManager->createSearch(true))); |
|
| 106 | + $i18n = $container->get('aimeos_i18n')->get($langids); |
|
| 107 | 107 | |
| 108 | - $context->setEditor( 'aimeos:jobs' ); |
|
| 109 | - $context->setView( $view ); |
|
| 110 | - $context->setI18n( $i18n ); |
|
| 108 | + $context->setEditor('aimeos:jobs'); |
|
| 109 | + $context->setView($view); |
|
| 110 | + $context->setI18n($i18n); |
|
| 111 | 111 | |
| 112 | 112 | return $context; |
| 113 | 113 | } |
@@ -120,28 +120,28 @@ discard block |
||
| 120 | 120 | * @param \Aimeos\MShop\Context\Item\Iface $ctx Context object |
| 121 | 121 | * @param array $siteItems List of site items implementing \Aimeos\MShop\Locale\Site\Iface |
| 122 | 122 | */ |
| 123 | - protected static function execute( \Aimeos\Bootstrap $aimeos, \Aimeos\MShop\Context\Item\Iface $ctx, array $siteItems, $jobs ) |
|
| 123 | + protected static function execute(\Aimeos\Bootstrap $aimeos, \Aimeos\MShop\Context\Item\Iface $ctx, array $siteItems, $jobs) |
|
| 124 | 124 | { |
| 125 | 125 | $process = $ctx->getProcess(); |
| 126 | - $localeManager = \Aimeos\MShop\Locale\Manager\Factory::createManager( $ctx ); |
|
| 126 | + $localeManager = \Aimeos\MShop\Locale\Manager\Factory::createManager($ctx); |
|
| 127 | 127 | |
| 128 | - foreach( $siteItems as $siteItem ) |
|
| 128 | + foreach ($siteItems as $siteItem) |
|
| 129 | 129 | { |
| 130 | - $localeItem = $localeManager->bootstrap( $siteItem->getCode(), 'en', '', false ); |
|
| 131 | - $localeItem->setLanguageId( null ); |
|
| 132 | - $localeItem->setCurrencyId( null ); |
|
| 130 | + $localeItem = $localeManager->bootstrap($siteItem->getCode(), 'en', '', false); |
|
| 131 | + $localeItem->setLanguageId(null); |
|
| 132 | + $localeItem->setCurrencyId(null); |
|
| 133 | 133 | |
| 134 | - $ctx->setLocale( $localeItem ); |
|
| 134 | + $ctx->setLocale($localeItem); |
|
| 135 | 135 | |
| 136 | - printf( "Executing the Aimeos jobs for \"%s\"\n", $siteItem->getCode() ); |
|
| 136 | + printf("Executing the Aimeos jobs for \"%s\"\n", $siteItem->getCode()); |
|
| 137 | 137 | |
| 138 | - foreach( (array) explode( ' ', $jobs ) as $jobname ) |
|
| 138 | + foreach ((array) explode(' ', $jobs) as $jobname) |
|
| 139 | 139 | { |
| 140 | - $fcn = function( $ctx, $aimeos, $jobname ) { |
|
| 141 | - \Aimeos\Controller\Jobs\Factory::createController( $ctx, $aimeos, $jobname )->run(); |
|
| 140 | + $fcn = function($ctx, $aimeos, $jobname) { |
|
| 141 | + \Aimeos\Controller\Jobs\Factory::createController($ctx, $aimeos, $jobname)->run(); |
|
| 142 | 142 | }; |
| 143 | 143 | |
| 144 | - $process->start( $fcn, [$ctx, $aimeos, $jobname], true ); |
|
| 144 | + $process->start($fcn, [$ctx, $aimeos, $jobname], true); |
|
| 145 | 145 | } |
| 146 | 146 | } |
| 147 | 147 | |
@@ -32,36 +32,36 @@ discard block |
||
| 32 | 32 | * @param array $args Associative list of route parameters |
| 33 | 33 | * @return ResponseInterface 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,15 +77,15 @@ discard block |
||
| 77 | 77 | * @param array $args Associative list of route parameters |
| 78 | 78 | * @return ResponseInterface 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 ); |
|
| 82 | + $cntl = self::createClient($container, $request, $response, $args); |
|
| 83 | 83 | |
| 84 | - if( ( $html = $cntl->copy() ) == '' ) { |
|
| 84 | + if (($html = $cntl->copy()) == '') { |
|
| 85 | 85 | return $cntl->getView()->response(); |
| 86 | 86 | } |
| 87 | 87 | |
| 88 | - return self::getHtml( $container, $response, $html ); |
|
| 88 | + return self::getHtml($container, $response, $html); |
|
| 89 | 89 | } |
| 90 | 90 | |
| 91 | 91 | |
@@ -98,15 +98,15 @@ discard block |
||
| 98 | 98 | * @param array $args Associative list of route parameters |
| 99 | 99 | * @return ResponseInterface Modified response object with generated output |
| 100 | 100 | */ |
| 101 | - public static function createAction( ContainerInterface $container, ServerRequestInterface $request, ResponseInterface $response, array $args ) |
|
| 101 | + public static function createAction(ContainerInterface $container, ServerRequestInterface $request, ResponseInterface $response, array $args) |
|
| 102 | 102 | { |
| 103 | - $cntl = self::createClient( $container, $request, $response, $args ); |
|
| 103 | + $cntl = self::createClient($container, $request, $response, $args); |
|
| 104 | 104 | |
| 105 | - if( ( $html = $cntl->create() ) == '' ) { |
|
| 105 | + if (($html = $cntl->create()) == '') { |
|
| 106 | 106 | return $cntl->getView()->response(); |
| 107 | 107 | } |
| 108 | 108 | |
| 109 | - return self::getHtml( $container, $response, $html ); |
|
| 109 | + return self::getHtml($container, $response, $html); |
|
| 110 | 110 | } |
| 111 | 111 | |
| 112 | 112 | |
@@ -119,15 +119,15 @@ discard block |
||
| 119 | 119 | * @param array $args Associative list of route parameters |
| 120 | 120 | * @return ResponseInterface Modified response object with generated output |
| 121 | 121 | */ |
| 122 | - public static function deleteAction( ContainerInterface $container, ServerRequestInterface $request, ResponseInterface $response, array $args ) |
|
| 122 | + public static function deleteAction(ContainerInterface $container, ServerRequestInterface $request, ResponseInterface $response, array $args) |
|
| 123 | 123 | { |
| 124 | - $cntl = self::createClient( $container, $request, $response, $args ); |
|
| 124 | + $cntl = self::createClient($container, $request, $response, $args); |
|
| 125 | 125 | |
| 126 | - if( ( $html = $cntl->delete() ) == '' ) { |
|
| 126 | + if (($html = $cntl->delete()) == '') { |
|
| 127 | 127 | return $cntl->getView()->response(); |
| 128 | 128 | } |
| 129 | 129 | |
| 130 | - return self::getHtml( $container, $response, $html ); |
|
| 130 | + return self::getHtml($container, $response, $html); |
|
| 131 | 131 | } |
| 132 | 132 | |
| 133 | 133 | |
@@ -140,15 +140,15 @@ discard block |
||
| 140 | 140 | * @param array $args Associative list of route parameters |
| 141 | 141 | * @return ResponseInterface Modified response object with generated output |
| 142 | 142 | */ |
| 143 | - public static function exportAction( ContainerInterface $container, ServerRequestInterface $request, ResponseInterface $response, array $args ) |
|
| 143 | + public static function exportAction(ContainerInterface $container, ServerRequestInterface $request, ResponseInterface $response, array $args) |
|
| 144 | 144 | { |
| 145 | - $cntl = self::createClient( $container, $request, $response, $args ); |
|
| 145 | + $cntl = self::createClient($container, $request, $response, $args); |
|
| 146 | 146 | |
| 147 | - if( ( $html = $cntl->export() ) == '' ) { |
|
| 147 | + if (($html = $cntl->export()) == '') { |
|
| 148 | 148 | return $cntl->getView()->response(); |
| 149 | 149 | } |
| 150 | 150 | |
| 151 | - return self::getHtml( $container, $response, $html ); |
|
| 151 | + return self::getHtml($container, $response, $html); |
|
| 152 | 152 | } |
| 153 | 153 | |
| 154 | 154 | |
@@ -161,15 +161,15 @@ discard block |
||
| 161 | 161 | * @param array $args Associative list of route parameters |
| 162 | 162 | * @return ResponseInterface Modified response object with generated output |
| 163 | 163 | */ |
| 164 | - public static function getAction( ContainerInterface $container, ServerRequestInterface $request, ResponseInterface $response, array $args ) |
|
| 164 | + public static function getAction(ContainerInterface $container, ServerRequestInterface $request, ResponseInterface $response, array $args) |
|
| 165 | 165 | { |
| 166 | - $cntl = self::createClient( $container, $request, $response, $args ); |
|
| 166 | + $cntl = self::createClient($container, $request, $response, $args); |
|
| 167 | 167 | |
| 168 | - if( ( $html = $cntl->get() ) == '' ) { |
|
| 168 | + if (($html = $cntl->get()) == '') { |
|
| 169 | 169 | return $cntl->getView()->response(); |
| 170 | 170 | } |
| 171 | 171 | |
| 172 | - return self::getHtml( $container, $response, $html ); |
|
| 172 | + return self::getHtml($container, $response, $html); |
|
| 173 | 173 | } |
| 174 | 174 | |
| 175 | 175 | |
@@ -182,15 +182,15 @@ discard block |
||
| 182 | 182 | * @param array $args Associative list of route parameters |
| 183 | 183 | * @return ResponseInterface Modified response object with generated output |
| 184 | 184 | */ |
| 185 | - public static function saveAction( ContainerInterface $container, ServerRequestInterface $request, ResponseInterface $response, array $args ) |
|
| 185 | + public static function saveAction(ContainerInterface $container, ServerRequestInterface $request, ResponseInterface $response, array $args) |
|
| 186 | 186 | { |
| 187 | - $cntl = self::createClient( $container, $request, $response, $args ); |
|
| 187 | + $cntl = self::createClient($container, $request, $response, $args); |
|
| 188 | 188 | |
| 189 | - if( ( $html = $cntl->save() ) == '' ) { |
|
| 189 | + if (($html = $cntl->save()) == '') { |
|
| 190 | 190 | return $cntl->getView()->response(); |
| 191 | 191 | } |
| 192 | 192 | |
| 193 | - return self::getHtml( $container, $response, $html ); |
|
| 193 | + return self::getHtml($container, $response, $html); |
|
| 194 | 194 | } |
| 195 | 195 | |
| 196 | 196 | |
@@ -203,15 +203,15 @@ discard block |
||
| 203 | 203 | * @param array $args Associative list of route parameters |
| 204 | 204 | * @return ResponseInterface Modified response object with generated output |
| 205 | 205 | */ |
| 206 | - public static function searchAction( ContainerInterface $container, ServerRequestInterface $request, ResponseInterface $response, array $args ) |
|
| 206 | + public static function searchAction(ContainerInterface $container, ServerRequestInterface $request, ResponseInterface $response, array $args) |
|
| 207 | 207 | { |
| 208 | - $cntl = self::createClient( $container, $request, $response, $args ); |
|
| 208 | + $cntl = self::createClient($container, $request, $response, $args); |
|
| 209 | 209 | |
| 210 | - if( ( $html = $cntl->search() ) == '' ) { |
|
| 210 | + if (($html = $cntl->search()) == '') { |
|
| 211 | 211 | return $cntl->getView()->response(); |
| 212 | 212 | } |
| 213 | 213 | |
| 214 | - return self::getHtml( $container, $response, $html ); |
|
| 214 | + return self::getHtml($container, $response, $html); |
|
| 215 | 215 | } |
| 216 | 216 | |
| 217 | 217 | |
@@ -224,29 +224,29 @@ discard block |
||
| 224 | 224 | * @param array $args Associative list of route parameters |
| 225 | 225 | * @return \Aimeos\Admin\JQAdm\Iface JQAdm client |
| 226 | 226 | */ |
| 227 | - protected static function createClient( ContainerInterface $container, ServerRequestInterface $request, ResponseInterface $response, array $args ) |
|
| 227 | + protected static function createClient(ContainerInterface $container, ServerRequestInterface $request, ResponseInterface $response, array $args) |
|
| 228 | 228 | { |
| 229 | - $aimeos = $container->get( 'aimeos' ); |
|
| 230 | - $templatePaths = $aimeos->getCustomPaths( 'admin/jqadm/templates' ); |
|
| 229 | + $aimeos = $container->get('aimeos'); |
|
| 230 | + $templatePaths = $aimeos->getCustomPaths('admin/jqadm/templates'); |
|
| 231 | 231 | $params = $args + (array) $request->getParsedBody() + (array) $request->getQueryParams(); |
| 232 | 232 | |
| 233 | - $resource = ( isset( $params['resource'] ) ? $params['resource'] : null ); |
|
| 234 | - $site = ( isset( $params['site'] ) ? $params['site'] : 'default' ); |
|
| 235 | - $lang = ( isset( $params['lang'] ) ? $params['lang'] : 'en' ); |
|
| 233 | + $resource = (isset($params['resource']) ? $params['resource'] : null); |
|
| 234 | + $site = (isset($params['site']) ? $params['site'] : 'default'); |
|
| 235 | + $lang = (isset($params['lang']) ? $params['lang'] : 'en'); |
|
| 236 | 236 | |
| 237 | - $context = $container->get( 'aimeos_context' )->get( false, $args, 'backend' ); |
|
| 238 | - $context->setI18n( $container->get( 'aimeos_i18n' )->get( array( $lang, 'en' ) ) ); |
|
| 239 | - $context->setLocale( $container->get( 'aimeos_locale' )->getBackend( $context, $site ) ); |
|
| 237 | + $context = $container->get('aimeos_context')->get(false, $args, 'backend'); |
|
| 238 | + $context->setI18n($container->get('aimeos_i18n')->get(array($lang, 'en'))); |
|
| 239 | + $context->setLocale($container->get('aimeos_locale')->getBackend($context, $site)); |
|
| 240 | 240 | |
| 241 | - $view = $container->get( 'aimeos_view' )->create( $context, $request, $response, $args, $templatePaths, $lang ); |
|
| 241 | + $view = $container->get('aimeos_view')->create($context, $request, $response, $args, $templatePaths, $lang); |
|
| 242 | 242 | |
| 243 | 243 | $view->aimeosType = 'Slim'; |
| 244 | 244 | $view->aimeosVersion = \Aimeos\Slim\Bootstrap::getVersion(); |
| 245 | - $view->aimeosExtensions = implode( ',', $aimeos->getExtensions() ); |
|
| 245 | + $view->aimeosExtensions = implode(',', $aimeos->getExtensions()); |
|
| 246 | 246 | |
| 247 | - $context->setView( $view ); |
|
| 247 | + $context->setView($view); |
|
| 248 | 248 | |
| 249 | - return \Aimeos\Admin\JQAdm\Factory::createClient( $context, $aimeos, $resource ); |
|
| 249 | + return \Aimeos\Admin\JQAdm\Factory::createClient($context, $aimeos, $resource); |
|
| 250 | 250 | } |
| 251 | 251 | |
| 252 | 252 | |
@@ -258,8 +258,8 @@ discard block |
||
| 258 | 258 | * @param string $content Content from admin client |
| 259 | 259 | * @return ResponseInterface Modified response object with generated output |
| 260 | 260 | */ |
| 261 | - protected static function getHtml( ContainerInterface $container, ResponseInterface $response, $content ) |
|
| 261 | + protected static function getHtml(ContainerInterface $container, ResponseInterface $response, $content) |
|
| 262 | 262 | { |
| 263 | - return $container->get( 'view' )->render( $response, 'Jqadm/index.html.twig', array( 'content' => $content ) ); |
|
| 263 | + return $container->get('view')->render($response, 'Jqadm/index.html.twig', array('content' => $content)); |
|
| 264 | 264 | } |
| 265 | 265 | } |
@@ -32,9 +32,9 @@ 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 deleteAction( ContainerInterface $container, ServerRequestInterface $request, ResponseInterface $response, array $args ) |
|
| 35 | + public static function deleteAction(ContainerInterface $container, ServerRequestInterface $request, ResponseInterface $response, array $args) |
|
| 36 | 36 | { |
| 37 | - return self::createClient( $container, $request, $response, $args )->delete( $request, $response ); |
|
| 37 | + return self::createClient($container, $request, $response, $args)->delete($request, $response); |
|
| 38 | 38 | } |
| 39 | 39 | |
| 40 | 40 | |
@@ -47,9 +47,9 @@ discard block |
||
| 47 | 47 | * @param array $args Associative list of route parameters |
| 48 | 48 | * @return ResponseInterface $response Modified response object with generated output |
| 49 | 49 | */ |
| 50 | - public static function getAction( ContainerInterface $container, ServerRequestInterface $request, ResponseInterface $response, array $args ) |
|
| 50 | + public static function getAction(ContainerInterface $container, ServerRequestInterface $request, ResponseInterface $response, array $args) |
|
| 51 | 51 | { |
| 52 | - return self::createClient( $container, $request, $response, $args )->get( $request, $response ); |
|
| 52 | + return self::createClient($container, $request, $response, $args)->get($request, $response); |
|
| 53 | 53 | } |
| 54 | 54 | |
| 55 | 55 | |
@@ -62,9 +62,9 @@ discard block |
||
| 62 | 62 | * @param array $args Associative list of route parameters |
| 63 | 63 | * @return ResponseInterface $response Modified response object with generated output |
| 64 | 64 | */ |
| 65 | - public static function patchAction( ContainerInterface $container, ServerRequestInterface $request, ResponseInterface $response, array $args ) |
|
| 65 | + public static function patchAction(ContainerInterface $container, ServerRequestInterface $request, ResponseInterface $response, array $args) |
|
| 66 | 66 | { |
| 67 | - return self::createClient( $container, $request, $response, $args )->patch( $request, $response ); |
|
| 67 | + return self::createClient($container, $request, $response, $args)->patch($request, $response); |
|
| 68 | 68 | } |
| 69 | 69 | |
| 70 | 70 | |
@@ -77,9 +77,9 @@ 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 postAction( ContainerInterface $container, ServerRequestInterface $request, ResponseInterface $response, array $args ) |
|
| 80 | + public static function postAction(ContainerInterface $container, ServerRequestInterface $request, ResponseInterface $response, array $args) |
|
| 81 | 81 | { |
| 82 | - return self::createClient( $container, $request, $response, $args )->post( $request, $response ); |
|
| 82 | + return self::createClient($container, $request, $response, $args)->post($request, $response); |
|
| 83 | 83 | } |
| 84 | 84 | |
| 85 | 85 | |
@@ -92,9 +92,9 @@ discard block |
||
| 92 | 92 | * @param array $args Associative list of route parameters |
| 93 | 93 | * @return ResponseInterface $response Modified response object with generated output |
| 94 | 94 | */ |
| 95 | - public static function putAction( ContainerInterface $container, ServerRequestInterface $request, ResponseInterface $response, array $args ) |
|
| 95 | + public static function putAction(ContainerInterface $container, ServerRequestInterface $request, ResponseInterface $response, array $args) |
|
| 96 | 96 | { |
| 97 | - return self::createClient( $container, $request, $response, $args )->put( $request, $response ); |
|
| 97 | + return self::createClient($container, $request, $response, $args)->put($request, $response); |
|
| 98 | 98 | } |
| 99 | 99 | |
| 100 | 100 | |
@@ -107,9 +107,9 @@ discard block |
||
| 107 | 107 | * @param array $args Associative list of route parameters |
| 108 | 108 | * @return ResponseInterface $response Modified response object with generated output |
| 109 | 109 | */ |
| 110 | - public static function optionsAction( ContainerInterface $container, ServerRequestInterface $request, ResponseInterface $response, array $args ) |
|
| 110 | + public static function optionsAction(ContainerInterface $container, ServerRequestInterface $request, ResponseInterface $response, array $args) |
|
| 111 | 111 | { |
| 112 | - return self::createClient( $container, $request, $response, $args )->options( $request, $response ); |
|
| 112 | + return self::createClient($container, $request, $response, $args)->options($request, $response); |
|
| 113 | 113 | } |
| 114 | 114 | |
| 115 | 115 | |
@@ -122,19 +122,19 @@ discard block |
||
| 122 | 122 | * @param array $args Associative list of route parameters |
| 123 | 123 | * @return \Aimeos\Client\JsonApi\Iface JSON client controller |
| 124 | 124 | */ |
| 125 | - protected static function createClient( ContainerInterface $container, ServerRequestInterface $request, ResponseInterface $response, array $args ) |
|
| 125 | + protected static function createClient(ContainerInterface $container, ServerRequestInterface $request, ResponseInterface $response, array $args) |
|
| 126 | 126 | { |
| 127 | 127 | $params = $request->getQueryParams(); |
| 128 | - $resource = ( isset( $args['resource'] ) ? $args['resource'] : ( isset( $params['resource'] ) ? $params['resource'] : null ) ); |
|
| 129 | - $related = ( isset( $args['related'] ) ? $args['related'] : ( isset( $params['related'] ) ? $params['related'] : null ) ); |
|
| 130 | - $tmplPaths = $container->get( 'aimeos' )->getCustomPaths( 'client/jsonapi/templates' ); |
|
| 128 | + $resource = (isset($args['resource']) ? $args['resource'] : (isset($params['resource']) ? $params['resource'] : null)); |
|
| 129 | + $related = (isset($args['related']) ? $args['related'] : (isset($params['related']) ? $params['related'] : null)); |
|
| 130 | + $tmplPaths = $container->get('aimeos')->getCustomPaths('client/jsonapi/templates'); |
|
| 131 | 131 | |
| 132 | - $context = $container->get( 'aimeos_context' )->get( true, $args ); |
|
| 132 | + $context = $container->get('aimeos_context')->get(true, $args); |
|
| 133 | 133 | $langid = $context->getLocale()->getLanguageId(); |
| 134 | 134 | |
| 135 | - $view = $container->get( 'aimeos_view' )->create( $context, $request, $response, $args, $tmplPaths, $langid ); |
|
| 136 | - $context->setView( $view ); |
|
| 135 | + $view = $container->get('aimeos_view')->create($context, $request, $response, $args, $tmplPaths, $langid); |
|
| 136 | + $context->setView($view); |
|
| 137 | 137 | |
| 138 | - return \Aimeos\Client\JsonApi\Factory::createClient( $context, $resource . '/' . $related ); |
|
| 138 | + return \Aimeos\Client\JsonApi\Factory::createClient($context, $resource.'/'.$related); |
|
| 139 | 139 | } |
| 140 | 140 | } |
@@ -31,10 +31,10 @@ discard block |
||
| 31 | 31 | * @param array $args Associative list of route parameters |
| 32 | 32 | * @return ResponseInterface $response Modified response object with generated output |
| 33 | 33 | */ |
| 34 | - public static function indexAction( ContainerInterface $container, ServerRequestInterface $request, ResponseInterface $response, array $args ) |
|
| 34 | + public static function indexAction(ContainerInterface $container, ServerRequestInterface $request, ResponseInterface $response, array $args) |
|
| 35 | 35 | { |
| 36 | - $contents = $container->get( 'aimeos_page' )->getSections( 'account-index', $request, $response, $args ); |
|
| 37 | - return $container->get( 'view' )->render( $response, 'Account/index.html.twig', $contents ); |
|
| 36 | + $contents = $container->get('aimeos_page')->getSections('account-index', $request, $response, $args); |
|
| 37 | + return $container->get('view')->render($response, 'Account/index.html.twig', $contents); |
|
| 38 | 38 | } |
| 39 | 39 | |
| 40 | 40 | |
@@ -47,16 +47,16 @@ discard block |
||
| 47 | 47 | * @param array $args Associative list of route parameters |
| 48 | 48 | * @return ResponseInterface $response Modified response object with generated output |
| 49 | 49 | */ |
| 50 | - public static function downloadAction( ContainerInterface $container, ServerRequestInterface $request, ResponseInterface $response, array $args ) |
|
| 50 | + public static function downloadAction(ContainerInterface $container, ServerRequestInterface $request, ResponseInterface $response, array $args) |
|
| 51 | 51 | { |
| 52 | - $context = $container->get( 'aimeos_context' )->get( true, $args ); |
|
| 52 | + $context = $container->get('aimeos_context')->get(true, $args); |
|
| 53 | 53 | $langid = $context->getLocale()->getLanguageId(); |
| 54 | 54 | |
| 55 | - $view = $container->get( 'aimeos_view' )->create( $context, $request, $response, $args, array(), $langid ); |
|
| 56 | - $context->setView( $view ); |
|
| 55 | + $view = $container->get('aimeos_view')->create($context, $request, $response, $args, array(), $langid); |
|
| 56 | + $context->setView($view); |
|
| 57 | 57 | |
| 58 | - $client = \Aimeos\Client\Html\Factory::createClient( $context, 'account/download' ); |
|
| 59 | - $client->setView( $view ); |
|
| 58 | + $client = \Aimeos\Client\Html\Factory::createClient($context, 'account/download'); |
|
| 59 | + $client->setView($view); |
|
| 60 | 60 | $client->process(); |
| 61 | 61 | |
| 62 | 62 | return $view->response(); |
@@ -32,9 +32,9 @@ 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 deleteAction( ContainerInterface $container, ServerRequestInterface $request, ResponseInterface $response, array $args ) |
|
| 35 | + public static function deleteAction(ContainerInterface $container, ServerRequestInterface $request, ResponseInterface $response, array $args) |
|
| 36 | 36 | { |
| 37 | - return self::createClient( $container, $request, $response, $args )->delete( $request, $response ); |
|
| 37 | + return self::createClient($container, $request, $response, $args)->delete($request, $response); |
|
| 38 | 38 | } |
| 39 | 39 | |
| 40 | 40 | |
@@ -47,9 +47,9 @@ discard block |
||
| 47 | 47 | * @param array $args Associative list of route parameters |
| 48 | 48 | * @return ResponseInterface $response Modified response object with generated output |
| 49 | 49 | */ |
| 50 | - public static function getAction( ContainerInterface $container, ServerRequestInterface $request, ResponseInterface $response, array $args ) |
|
| 50 | + public static function getAction(ContainerInterface $container, ServerRequestInterface $request, ResponseInterface $response, array $args) |
|
| 51 | 51 | { |
| 52 | - return self::createClient( $container, $request, $response, $args )->get( $request, $response ); |
|
| 52 | + return self::createClient($container, $request, $response, $args)->get($request, $response); |
|
| 53 | 53 | } |
| 54 | 54 | |
| 55 | 55 | |
@@ -62,9 +62,9 @@ discard block |
||
| 62 | 62 | * @param array $args Associative list of route parameters |
| 63 | 63 | * @return ResponseInterface $response Modified response object with generated output |
| 64 | 64 | */ |
| 65 | - public static function patchAction( ContainerInterface $container, ServerRequestInterface $request, ResponseInterface $response, array $args ) |
|
| 65 | + public static function patchAction(ContainerInterface $container, ServerRequestInterface $request, ResponseInterface $response, array $args) |
|
| 66 | 66 | { |
| 67 | - return self::createClient( $container, $request, $response, $args )->patch( $request, $response ); |
|
| 67 | + return self::createClient($container, $request, $response, $args)->patch($request, $response); |
|
| 68 | 68 | } |
| 69 | 69 | |
| 70 | 70 | |
@@ -77,9 +77,9 @@ 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 postAction( ContainerInterface $container, ServerRequestInterface $request, ResponseInterface $response, array $args ) |
|
| 80 | + public static function postAction(ContainerInterface $container, ServerRequestInterface $request, ResponseInterface $response, array $args) |
|
| 81 | 81 | { |
| 82 | - return self::createClient( $container, $request, $response, $args )->post( $request, $response ); |
|
| 82 | + return self::createClient($container, $request, $response, $args)->post($request, $response); |
|
| 83 | 83 | } |
| 84 | 84 | |
| 85 | 85 | |
@@ -92,9 +92,9 @@ discard block |
||
| 92 | 92 | * @param array $args Associative list of route parameters |
| 93 | 93 | * @return ResponseInterface $response Modified response object with generated output |
| 94 | 94 | */ |
| 95 | - public static function putAction( ContainerInterface $container, ServerRequestInterface $request, ResponseInterface $response, array $args ) |
|
| 95 | + public static function putAction(ContainerInterface $container, ServerRequestInterface $request, ResponseInterface $response, array $args) |
|
| 96 | 96 | { |
| 97 | - return self::createClient( $container, $request, $response, $args )->put( $request, $response ); |
|
| 97 | + return self::createClient($container, $request, $response, $args)->put($request, $response); |
|
| 98 | 98 | } |
| 99 | 99 | |
| 100 | 100 | |
@@ -107,9 +107,9 @@ discard block |
||
| 107 | 107 | * @param array $args Associative list of route parameters |
| 108 | 108 | * @return ResponseInterface $response Modified response object with generated output |
| 109 | 109 | */ |
| 110 | - public static function optionsAction( ContainerInterface $container, ServerRequestInterface $request, ResponseInterface $response, array $args ) |
|
| 110 | + public static function optionsAction(ContainerInterface $container, ServerRequestInterface $request, ResponseInterface $response, array $args) |
|
| 111 | 111 | { |
| 112 | - return self::createClient( $container, $request, $response, $args )->options( $request, $response ); |
|
| 112 | + return self::createClient($container, $request, $response, $args)->options($request, $response); |
|
| 113 | 113 | } |
| 114 | 114 | |
| 115 | 115 | |
@@ -122,22 +122,22 @@ discard block |
||
| 122 | 122 | * @param array $args Associative list of route parameters |
| 123 | 123 | * @return \Aimeos\Admin\JsonAdm\Iface JSON admin client |
| 124 | 124 | */ |
| 125 | - protected static function createClient( ContainerInterface $container, ServerRequestInterface $request, ResponseInterface $response, array $args ) |
|
| 125 | + protected static function createClient(ContainerInterface $container, ServerRequestInterface $request, ResponseInterface $response, array $args) |
|
| 126 | 126 | { |
| 127 | - $resource = ( isset( $args['resource'] ) ? $args['resource'] : null ); |
|
| 128 | - $site = ( isset( $args['site'] ) ? $args['site'] : 'default' ); |
|
| 129 | - $lang = ( isset( $args['lang'] ) ? $args['lang'] : 'en' ); |
|
| 127 | + $resource = (isset($args['resource']) ? $args['resource'] : null); |
|
| 128 | + $site = (isset($args['site']) ? $args['site'] : 'default'); |
|
| 129 | + $lang = (isset($args['lang']) ? $args['lang'] : 'en'); |
|
| 130 | 130 | |
| 131 | - $aimeos = $container->get( 'aimeos' ); |
|
| 132 | - $templatePaths = $aimeos->getCustomPaths( 'admin/jsonadm/templates' ); |
|
| 131 | + $aimeos = $container->get('aimeos'); |
|
| 132 | + $templatePaths = $aimeos->getCustomPaths('admin/jsonadm/templates'); |
|
| 133 | 133 | |
| 134 | - $context = $container->get( 'aimeos_context' )->get( false, $args, 'backend' ); |
|
| 135 | - $context->setI18n( $container->get( 'aimeos_i18n' )->get( array( $lang, 'en' ) ) ); |
|
| 136 | - $context->setLocale( $container->get( 'aimeos_locale' )->getBackend( $context, $site ) ); |
|
| 134 | + $context = $container->get('aimeos_context')->get(false, $args, 'backend'); |
|
| 135 | + $context->setI18n($container->get('aimeos_i18n')->get(array($lang, 'en'))); |
|
| 136 | + $context->setLocale($container->get('aimeos_locale')->getBackend($context, $site)); |
|
| 137 | 137 | |
| 138 | - $view = $container->get( 'aimeos_view' )->create( $context, $request, $response, $args, $templatePaths, $lang ); |
|
| 139 | - $context->setView( $view ); |
|
| 138 | + $view = $container->get('aimeos_view')->create($context, $request, $response, $args, $templatePaths, $lang); |
|
| 139 | + $context->setView($view); |
|
| 140 | 140 | |
| 141 | - return \Aimeos\Admin\JsonAdm\Factory::createClient( $context, $aimeos, $resource ); |
|
| 141 | + return \Aimeos\Admin\JsonAdm\Factory::createClient($context, $aimeos, $resource); |
|
| 142 | 142 | } |
| 143 | 143 | } |
@@ -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 | } |
@@ -45,24 +45,24 @@ discard block |
||
| 45 | 45 | * @param array Associative list of URI attributes |
| 46 | 46 | * @return array Associative list with body and header output separated by client name |
| 47 | 47 | */ |
| 48 | - public function getSections( $pageName, ServerRequestInterface $request, ResponseInterface $response, array $attr ) |
|
| 48 | + public function getSections($pageName, ServerRequestInterface $request, ResponseInterface $response, array $attr) |
|
| 49 | 49 | { |
| 50 | - $tmplPaths = $this->container->get( 'aimeos' )->getCustomPaths( 'client/html/templates' ); |
|
| 51 | - $context = $this->container->get( 'aimeos_context' )->get( true, $attr ); |
|
| 50 | + $tmplPaths = $this->container->get('aimeos')->getCustomPaths('client/html/templates'); |
|
| 51 | + $context = $this->container->get('aimeos_context')->get(true, $attr); |
|
| 52 | 52 | $langid = $context->getLocale()->getLanguageId(); |
| 53 | 53 | |
| 54 | - $view = $this->container->get( 'aimeos_view' )->create( $context, $request, $response, $attr, $tmplPaths, $langid ); |
|
| 55 | - $context->setView( $view ); |
|
| 54 | + $view = $this->container->get('aimeos_view')->create($context, $request, $response, $attr, $tmplPaths, $langid); |
|
| 55 | + $context->setView($view); |
|
| 56 | 56 | |
| 57 | - $pagesConfig = $this->container->get( 'aimeos_config' )->get()->get( 'page', array() ); |
|
| 58 | - $result = array( 'aibody' => array(), 'aiheader' => array() ); |
|
| 57 | + $pagesConfig = $this->container->get('aimeos_config')->get()->get('page', array()); |
|
| 58 | + $result = array('aibody' => array(), 'aiheader' => array()); |
|
| 59 | 59 | |
| 60 | - if( isset( $pagesConfig[$pageName] ) ) |
|
| 60 | + if (isset($pagesConfig[$pageName])) |
|
| 61 | 61 | { |
| 62 | - foreach( (array) $pagesConfig[$pageName] as $clientName ) |
|
| 62 | + foreach ((array) $pagesConfig[$pageName] as $clientName) |
|
| 63 | 63 | { |
| 64 | - $client = \Aimeos\Client\Html\Factory::createClient( $context, $clientName ); |
|
| 65 | - $client->setView( clone $view ); |
|
| 64 | + $client = \Aimeos\Client\Html\Factory::createClient($context, $clientName); |
|
| 65 | + $client->setView(clone $view); |
|
| 66 | 66 | $client->process(); |
| 67 | 67 | |
| 68 | 68 | $result['aibody'][$clientName] = $client->getBody(); |