@@ -160,7 +160,7 @@ |
||
160 | 160 | * Creates a list of all available translations |
161 | 161 | * |
162 | 162 | * @param \Aimeos\Bootstrap $aimeos Aimeos object |
163 | - * @return array List of language IDs with labels |
|
163 | + * @return string List of language IDs with labels |
|
164 | 164 | */ |
165 | 165 | protected static function getJsonLanguages( \Aimeos\Bootstrap $aimeos ) |
166 | 166 | { |
@@ -32,63 +32,63 @@ 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, 'backend' ); |
|
45 | - $context = self::setLocale( $context, $site, $lang ); |
|
44 | + $context = $container->get('aimeos_context')->get(false, $args, 'backend'); |
|
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 | - $jsonUrl = $router->pathFor( 'aimeos_shop_extadm_json', array( 'site' => $site, $csrfname => $csrfvalue ) ); |
|
70 | - $jqadmUrl = $router->pathFor( 'aimeos_shop_jqadm_search', array( 'site' => $site, 'lang' => $lang, 'resource' => 'dashboard' ) ); |
|
71 | - $adminUrl = $router->pathFor( 'aimeos_shop_extadm', array( 'site' => '<site>', 'lang' => '<lang>', 'tab' => '<tab>' ) ); |
|
68 | + $router = $container->get('router'); |
|
69 | + $jsonUrl = $router->pathFor('aimeos_shop_extadm_json', array('site' => $site, $csrfname => $csrfvalue)); |
|
70 | + $jqadmUrl = $router->pathFor('aimeos_shop_jqadm_search', array('site' => $site, 'lang' => $lang, 'resource' => 'dashboard')); |
|
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 ), |
|
84 | - 'urlTemplate' => str_replace( ['<', '>'], ['{', '}'], urldecode( $adminUrl ) ), |
|
83 | + 'smd' => $controller->getJsonSmd($jsonUrl), |
|
84 | + 'urlTemplate' => str_replace(['<', '>'], ['{', '}'], urldecode($adminUrl)), |
|
85 | 85 | 'jqadmurl' => $jqadmUrl, |
86 | 86 | 'activeTab' => $tab, |
87 | 87 | 'version' => \Aimeos\Slim\Bootstrap::getVersion(), |
88 | - 'extensions' => implode( ',', $aimeos->getExtensions() ), |
|
88 | + 'extensions' => implode(',', $aimeos->getExtensions()), |
|
89 | 89 | ); |
90 | 90 | |
91 | - return $container->get( 'view' )->render( $response, 'Extadm/index.html.twig', $vars ); |
|
91 | + return $container->get('view')->render($response, 'Extadm/index.html.twig', $vars); |
|
92 | 92 | } |
93 | 93 | |
94 | 94 | |
@@ -101,22 +101,22 @@ 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 doAction( ContainerInterface $container, ServerRequestInterface $request, ResponseInterface $response, array $args ) |
|
104 | + public static function doAction(ContainerInterface $container, ServerRequestInterface $request, ResponseInterface $response, array $args) |
|
105 | 105 | { |
106 | - $cntlPaths = $container->get( 'aimeos' )->getCustomPaths( 'controller/extjs' ); |
|
106 | + $cntlPaths = $container->get('aimeos')->getCustomPaths('controller/extjs'); |
|
107 | 107 | |
108 | - $context = $container->get( 'aimeos_context' )->get( false, $args, 'backend' ); |
|
109 | - $context->setView( $container->get( 'aimeos_view' )->create( $context, $request, $response, $args, array() ) ); |
|
110 | - $context = self::setLocale( $context ); |
|
108 | + $context = $container->get('aimeos_context')->get(false, $args, 'backend'); |
|
109 | + $context->setView($container->get('aimeos_view')->create($context, $request, $response, $args, array())); |
|
110 | + $context = self::setLocale($context); |
|
111 | 111 | |
112 | 112 | $params = $request->getQueryParams(); |
113 | - if( ( $post = $request->getParsedBody() ) !== null ) { |
|
114 | - $params = array_merge( $params, (array) $post ); |
|
113 | + if (($post = $request->getParsedBody()) !== null) { |
|
114 | + $params = array_merge($params, (array) $post); |
|
115 | 115 | } |
116 | 116 | |
117 | - $controller = new \Aimeos\Controller\ExtJS\JsonRpc( $context, $cntlPaths ); |
|
118 | - $output = $controller->process( $params, (string) $request->getBody() ); |
|
119 | - $response->getBody()->write( $output ); |
|
117 | + $controller = new \Aimeos\Controller\ExtJS\JsonRpc($context, $cntlPaths); |
|
118 | + $output = $controller->process($params, (string) $request->getBody()); |
|
119 | + $response->getBody()->write($output); |
|
120 | 120 | |
121 | 121 | return $response; |
122 | 122 | } |
@@ -131,30 +131,30 @@ discard block |
||
131 | 131 | * @param array $args Associative list of route parameters |
132 | 132 | * @return ResponseInterface $response Modified response object with generated output |
133 | 133 | */ |
134 | - public static function fileAction( ContainerInterface $container, ServerRequestInterface $request, ResponseInterface $response, array $args ) |
|
134 | + public static function fileAction(ContainerInterface $container, ServerRequestInterface $request, ResponseInterface $response, array $args) |
|
135 | 135 | { |
136 | 136 | $contents = ''; |
137 | 137 | $jsFiles = array(); |
138 | - $aimeos = $container->get( 'aimeos' ); |
|
138 | + $aimeos = $container->get('aimeos'); |
|
139 | 139 | |
140 | - foreach( $aimeos->getCustomPaths( 'admin/extjs' ) as $base => $paths ) |
|
140 | + foreach ($aimeos->getCustomPaths('admin/extjs') as $base => $paths) |
|
141 | 141 | { |
142 | - foreach( $paths as $path ) |
|
142 | + foreach ($paths as $path) |
|
143 | 143 | { |
144 | - $jsbAbsPath = $base . '/' . $path; |
|
145 | - $jsb2 = new \Aimeos\MW\Jsb2\Standard( $jsbAbsPath, dirname( $jsbAbsPath ) ); |
|
146 | - $jsFiles = array_merge( $jsFiles, $jsb2->getFiles( 'js' ) ); |
|
144 | + $jsbAbsPath = $base.'/'.$path; |
|
145 | + $jsb2 = new \Aimeos\MW\Jsb2\Standard($jsbAbsPath, dirname($jsbAbsPath)); |
|
146 | + $jsFiles = array_merge($jsFiles, $jsb2->getFiles('js')); |
|
147 | 147 | } |
148 | 148 | } |
149 | 149 | |
150 | - foreach( $jsFiles as $file ) |
|
150 | + foreach ($jsFiles as $file) |
|
151 | 151 | { |
152 | - if( ( $content = file_get_contents( $file ) ) !== false ) { |
|
152 | + if (($content = file_get_contents($file)) !== false) { |
|
153 | 153 | $contents .= $content; |
154 | 154 | } |
155 | 155 | } |
156 | 156 | |
157 | - return $response->withHeader( 'Content-Type', 'application/javascript' )->getBody()->write( $contents ); |
|
157 | + return $response->withHeader('Content-Type', 'application/javascript')->getBody()->write($contents); |
|
158 | 158 | } |
159 | 159 | |
160 | 160 | |
@@ -164,15 +164,15 @@ discard block |
||
164 | 164 | * @param \Aimeos\Bootstrap $aimeos Aimeos object |
165 | 165 | * @return array List of language IDs with labels |
166 | 166 | */ |
167 | - protected static function getJsonLanguages( \Aimeos\Bootstrap $aimeos ) |
|
167 | + protected static function getJsonLanguages(\Aimeos\Bootstrap $aimeos) |
|
168 | 168 | { |
169 | 169 | $result = array(); |
170 | 170 | |
171 | - foreach( $aimeos->getI18nList( 'admin' ) as $id ) { |
|
172 | - $result[] = array( 'id' => $id, 'label' => $id ); |
|
171 | + foreach ($aimeos->getI18nList('admin') as $id) { |
|
172 | + $result[] = array('id' => $id, 'label' => $id); |
|
173 | 173 | } |
174 | 174 | |
175 | - return json_encode( $result ); |
|
175 | + return json_encode($result); |
|
176 | 176 | } |
177 | 177 | |
178 | 178 | |
@@ -182,10 +182,10 @@ discard block |
||
182 | 182 | * @param \Aimeos\MShop\Context\Item\Iface $context Context item object |
183 | 183 | * @return string JSON encoded configuration object |
184 | 184 | */ |
185 | - protected static function getJsonClientConfig( \Aimeos\MShop\Context\Item\Iface $context ) |
|
185 | + protected static function getJsonClientConfig(\Aimeos\MShop\Context\Item\Iface $context) |
|
186 | 186 | { |
187 | - $config = $context->getConfig()->get( 'admin/extjs', array() ); |
|
188 | - return json_encode( array( 'admin' => array( 'extjs' => $config ) ), JSON_FORCE_OBJECT ); |
|
187 | + $config = $context->getConfig()->get('admin/extjs', array()); |
|
188 | + return json_encode(array('admin' => array('extjs' => $config)), JSON_FORCE_OBJECT); |
|
189 | 189 | } |
190 | 190 | |
191 | 191 | |
@@ -196,16 +196,16 @@ discard block |
||
196 | 196 | * @param string $lang ISO language code like "en" or "en_GB" |
197 | 197 | * @return string JSON encoded translation object |
198 | 198 | */ |
199 | - protected static function getJsonClientI18n( array $i18nPaths, $lang ) |
|
199 | + protected static function getJsonClientI18n(array $i18nPaths, $lang) |
|
200 | 200 | { |
201 | - $i18n = new \Aimeos\MW\Translation\Gettext( $i18nPaths, $lang ); |
|
201 | + $i18n = new \Aimeos\MW\Translation\Gettext($i18nPaths, $lang); |
|
202 | 202 | |
203 | 203 | $content = array( |
204 | - 'admin' => $i18n->getAll( 'admin' ), |
|
205 | - 'admin/ext' => $i18n->getAll( 'admin/ext' ), |
|
204 | + 'admin' => $i18n->getAll('admin'), |
|
205 | + 'admin/ext' => $i18n->getAll('admin/ext'), |
|
206 | 206 | ); |
207 | 207 | |
208 | - return json_encode( $content, JSON_FORCE_OBJECT ); |
|
208 | + return json_encode($content, JSON_FORCE_OBJECT); |
|
209 | 209 | } |
210 | 210 | |
211 | 211 | |
@@ -217,19 +217,19 @@ discard block |
||
217 | 217 | * @return string JSON encoded site item object |
218 | 218 | * @throws Exception If no site item was found for the code |
219 | 219 | */ |
220 | - protected static function getJsonSiteItem( \Aimeos\MShop\Context\Item\Iface $context, $site ) |
|
220 | + protected static function getJsonSiteItem(\Aimeos\MShop\Context\Item\Iface $context, $site) |
|
221 | 221 | { |
222 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'locale/site' ); |
|
222 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'locale/site'); |
|
223 | 223 | |
224 | 224 | $criteria = $manager->createSearch(); |
225 | - $criteria->setConditions( $criteria->compare( '==', 'locale.site.code', $site ) ); |
|
226 | - $items = $manager->searchItems( $criteria ); |
|
225 | + $criteria->setConditions($criteria->compare('==', 'locale.site.code', $site)); |
|
226 | + $items = $manager->searchItems($criteria); |
|
227 | 227 | |
228 | - if( ( $item = reset( $items ) ) === false ) { |
|
229 | - throw new \Exception( sprintf( 'No site found for code "%1$s"', $site ) ); |
|
228 | + if (($item = reset($items)) === false) { |
|
229 | + throw new \Exception(sprintf('No site found for code "%1$s"', $site)); |
|
230 | 230 | } |
231 | 231 | |
232 | - return json_encode( $item->toArray() ); |
|
232 | + return json_encode($item->toArray()); |
|
233 | 233 | } |
234 | 234 | |
235 | 235 | |
@@ -241,17 +241,17 @@ discard block |
||
241 | 241 | * @param string $locale ISO language code, e.g. "en" or "en_GB" |
242 | 242 | * @return \Aimeos\MShop\Context\Item\Iface Modified context object |
243 | 243 | */ |
244 | - protected static function setLocale( \Aimeos\MShop\Context\Item\Iface $context, $sitecode = 'default', $locale = null ) |
|
244 | + protected static function setLocale(\Aimeos\MShop\Context\Item\Iface $context, $sitecode = 'default', $locale = null) |
|
245 | 245 | { |
246 | - $localeManager = \Aimeos\MShop\Factory::createManager( $context, 'locale' ); |
|
246 | + $localeManager = \Aimeos\MShop\Factory::createManager($context, 'locale'); |
|
247 | 247 | |
248 | 248 | try { |
249 | - $localeItem = $localeManager->bootstrap( $sitecode, $locale, '', false ); |
|
250 | - } catch( \Aimeos\MShop\Locale\Exception $e ) { |
|
249 | + $localeItem = $localeManager->bootstrap($sitecode, $locale, '', false); |
|
250 | + } catch (\Aimeos\MShop\Locale\Exception $e) { |
|
251 | 251 | $localeItem = $localeManager->createItem(); |
252 | 252 | } |
253 | 253 | |
254 | - $context->setLocale( $localeItem ); |
|
254 | + $context->setLocale($localeItem); |
|
255 | 255 | |
256 | 256 | return $context; |
257 | 257 | } |
@@ -23,7 +23,7 @@ |
||
23 | 23 | * |
24 | 24 | * @param array $argv Associative array from $_SERVER['argv'] |
25 | 25 | */ |
26 | - public static function run( array $argv ); |
|
26 | + public static function run(array $argv); |
|
27 | 27 | |
28 | 28 | /** |
29 | 29 | * Returns the command usage and options |
@@ -24,31 +24,31 @@ discard block |
||
24 | 24 | * @param array &$params List of parameters |
25 | 25 | * @return array Associative list of option name and value(s) |
26 | 26 | */ |
27 | - protected static function getOptions( array &$params ) |
|
27 | + protected static function getOptions(array &$params) |
|
28 | 28 | { |
29 | 29 | $options = array(); |
30 | 30 | |
31 | - foreach( $params as $key => $option ) |
|
31 | + foreach ($params as $key => $option) |
|
32 | 32 | { |
33 | - if( $option === '--help' ) { |
|
33 | + if ($option === '--help') { |
|
34 | 34 | throw new Exception(); |
35 | 35 | } |
36 | 36 | |
37 | - if( strncmp( $option, '--', 2 ) === 0 && ( $pos = strpos( $option, '=', 2 ) ) !== false ) |
|
37 | + if (strncmp($option, '--', 2) === 0 && ($pos = strpos($option, '=', 2)) !== false) |
|
38 | 38 | { |
39 | - $name = substr( $option, 2, $pos - 2 ); |
|
39 | + $name = substr($option, 2, $pos - 2); |
|
40 | 40 | |
41 | - if( isset( $options[$name] ) ) |
|
41 | + if (isset($options[$name])) |
|
42 | 42 | { |
43 | 43 | $options[$name] = (array) $options[$name]; |
44 | - $options[$name][] = substr( $option, $pos + 1 ); |
|
44 | + $options[$name][] = substr($option, $pos + 1); |
|
45 | 45 | } |
46 | 46 | else |
47 | 47 | { |
48 | - $options[$name] = substr( $option, $pos + 1 ); |
|
48 | + $options[$name] = substr($option, $pos + 1); |
|
49 | 49 | } |
50 | 50 | |
51 | - unset( $params[$key] ); |
|
51 | + unset($params[$key]); |
|
52 | 52 | } |
53 | 53 | } |
54 | 54 | |
@@ -62,19 +62,19 @@ discard block |
||
62 | 62 | * @param \Aimeos\MShop\Context\Item\Iface $ctx Context object |
63 | 63 | * @param string|null $sites List of site codes separated by a space |
64 | 64 | */ |
65 | - protected static function getSiteItems( \Aimeos\MShop\Context\Item\Iface $ctx, $sites ) |
|
65 | + protected static function getSiteItems(\Aimeos\MShop\Context\Item\Iface $ctx, $sites) |
|
66 | 66 | { |
67 | - $manager = \Aimeos\MShop\Factory::createManager( $ctx, 'locale/site' ); |
|
67 | + $manager = \Aimeos\MShop\Factory::createManager($ctx, 'locale/site'); |
|
68 | 68 | $search = $manager->createSearch(); |
69 | 69 | |
70 | - if( is_scalar( $sites ) && $sites != '' ) { |
|
71 | - $sites = explode( ' ', $sites ); |
|
70 | + if (is_scalar($sites) && $sites != '') { |
|
71 | + $sites = explode(' ', $sites); |
|
72 | 72 | } |
73 | 73 | |
74 | - if( !empty( $sites ) ) { |
|
75 | - $search->setConditions( $search->compare( '==', 'locale.site.code', $sites ) ); |
|
74 | + if (!empty($sites)) { |
|
75 | + $search->setConditions($search->compare('==', 'locale.site.code', $sites)); |
|
76 | 76 | } |
77 | 77 | |
78 | - return $manager->searchItems( $search ); |
|
78 | + return $manager->searchItems($search); |
|
79 | 79 | } |
80 | 80 | } |
81 | 81 | \ No newline at end of file |
@@ -42,8 +42,7 @@ |
||
42 | 42 | { |
43 | 43 | $options[$name] = (array) $options[$name]; |
44 | 44 | $options[$name][] = substr( $option, $pos + 1 ); |
45 | - } |
|
46 | - else |
|
45 | + } else |
|
47 | 46 | { |
48 | 47 | $options[$name] = substr( $option, $pos + 1 ); |
49 | 48 | } |
@@ -20,14 +20,12 @@ discard block |
||
20 | 20 | require 'vendor' . DIRECTORY_SEPARATOR . 'autoload.php'; |
21 | 21 | |
22 | 22 | \Aimeos\Slim\Command\Jobs::run( $_SERVER['argv'] ); |
23 | -} |
|
24 | -catch( \Aimeos\Slim\Command\Exception $e ) |
|
23 | +} catch( \Aimeos\Slim\Command\Exception $e ) |
|
25 | 24 | { |
26 | 25 | echo $e->getMessage() . "\n"; |
27 | 26 | echo \Aimeos\Slim\Command\Jobs::usage(); |
28 | 27 | exit( 1 ); |
29 | -} |
|
30 | -catch( \Throwable $t ) |
|
28 | +} catch( \Throwable $t ) |
|
31 | 29 | { |
32 | 30 | echo "\n\nCaught PHP error while processing setup"; |
33 | 31 | echo "\n\nMessage:\n"; |
@@ -36,8 +34,7 @@ discard block |
||
36 | 34 | echo $t->getTraceAsString(); |
37 | 35 | echo "\n\n"; |
38 | 36 | exit( 1 ); |
39 | -} |
|
40 | -catch( \Exception $e ) |
|
37 | +} catch( \Exception $e ) |
|
41 | 38 | { |
42 | 39 | echo "\n\nCaught exception while processing setup"; |
43 | 40 | echo "\n\nMessage:\n"; |
@@ -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 | } |
@@ -19,14 +19,12 @@ discard block |
||
19 | 19 | require 'vendor' . DIRECTORY_SEPARATOR . 'autoload.php'; |
20 | 20 | |
21 | 21 | \Aimeos\Slim\Command\Cache::run( $_SERVER['argv'] ); |
22 | -} |
|
23 | -catch( \Aimeos\Slim\Command\Exception $e ) |
|
22 | +} catch( \Aimeos\Slim\Command\Exception $e ) |
|
24 | 23 | { |
25 | 24 | echo $e->getMessage() . "\n"; |
26 | 25 | echo \Aimeos\Slim\Command\Cache::usage(); |
27 | 26 | exit( 1 ); |
28 | -} |
|
29 | -catch( \Throwable $t ) |
|
27 | +} catch( \Throwable $t ) |
|
30 | 28 | { |
31 | 29 | echo "\n\nCaught PHP error"; |
32 | 30 | echo "\n\nMessage:\n"; |
@@ -35,8 +33,7 @@ discard block |
||
35 | 33 | echo $t->getTraceAsString(); |
36 | 34 | echo "\n\n"; |
37 | 35 | exit( 1 ); |
38 | -} |
|
39 | -catch( \Exception $e ) |
|
36 | +} catch( \Exception $e ) |
|
40 | 37 | { |
41 | 38 | echo "\n\nCaught exception"; |
42 | 39 | echo "\n\nMessage:\n"; |
@@ -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 | } |
@@ -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, array(), 'account/download' ); |
|
59 | - $client->setView( $view ); |
|
58 | + $client = \Aimeos\Client\Html\Factory::createClient($context, array(), 'account/download'); |
|
59 | + $client->setView($view); |
|
60 | 60 | $client->process(); |
61 | 61 | |
62 | 62 | return $view->response(); |
@@ -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, $tmplPaths, $clientName ); |
|
65 | - $client->setView( clone $view ); |
|
64 | + $client = \Aimeos\Client\Html\Factory::createClient($context, $tmplPaths, $clientName); |
|
65 | + $client->setView(clone $view); |
|
66 | 66 | $client->process(); |
67 | 67 | |
68 | 68 | $result['aibody'][$clientName] = $client->getBody(); |
@@ -143,7 +143,6 @@ |
||
143 | 143 | * Adds the "param" helper to the view object |
144 | 144 | * |
145 | 145 | * @param \Aimeos\MW\View\Iface $view View object |
146 | - * @param array $attributes Associative list of request parameters |
|
147 | 146 | * @return \Aimeos\MW\View\Iface Modified view object |
148 | 147 | */ |
149 | 148 | protected static function addParam( \Aimeos\MW\View\Iface $view, array $params ) |
@@ -60,8 +60,7 @@ discard block |
||
60 | 60 | |
61 | 61 | $view = new \Aimeos\MW\View\Standard( $templatePaths, $engines ); |
62 | 62 | $this->initTwig( $view, $twig ); |
63 | - } |
|
64 | - else |
|
63 | + } else |
|
65 | 64 | { |
66 | 65 | $view = new \Aimeos\MW\View\Standard( $templatePaths ); |
67 | 66 | } |
@@ -212,8 +211,7 @@ discard block |
||
212 | 211 | { |
213 | 212 | $i18n = $this->container->get( 'aimeos_i18n' )->get( array( $locale ) ); |
214 | 213 | $translation = $i18n[$locale]; |
215 | - } |
|
216 | - else |
|
214 | + } else |
|
217 | 215 | { |
218 | 216 | $translation = new \Aimeos\MW\Translation\None( 'en' ); |
219 | 217 | } |
@@ -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 | } |
@@ -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 | } |
@@ -42,18 +42,18 @@ discard block |
||
42 | 42 | * @param array $attributes Associative list of URL parameter |
43 | 43 | * @return \Aimeos\MShop\Locale\Item\Iface Locale item object |
44 | 44 | */ |
45 | - public function get( \Aimeos\MShop\Context\Item\Iface $context, array $attributes ) |
|
45 | + public function get(\Aimeos\MShop\Context\Item\Iface $context, array $attributes) |
|
46 | 46 | { |
47 | - if( $this->locale === null ) |
|
47 | + if ($this->locale === null) |
|
48 | 48 | { |
49 | - $disableSites = $this->container->get( 'aimeos_config' )->get( 'disableSites', true ); |
|
49 | + $disableSites = $this->container->get('aimeos_config')->get('disableSites', true); |
|
50 | 50 | |
51 | - $site = ( isset( $attributes['site'] ) ? $attributes['site'] : 'default' ); |
|
52 | - $lang = ( isset( $attributes['locale'] ) ? $attributes['locale'] : '' ); |
|
53 | - $currency = ( isset( $attributes['currency'] ) ? $attributes['currency'] : '' ); |
|
51 | + $site = (isset($attributes['site']) ? $attributes['site'] : 'default'); |
|
52 | + $lang = (isset($attributes['locale']) ? $attributes['locale'] : ''); |
|
53 | + $currency = (isset($attributes['currency']) ? $attributes['currency'] : ''); |
|
54 | 54 | |
55 | - $localeManager = \Aimeos\MShop\Locale\Manager\Factory::createManager( $context ); |
|
56 | - $this->locale = $localeManager->bootstrap( $site, $lang, $currency, $disableSites ); |
|
55 | + $localeManager = \Aimeos\MShop\Locale\Manager\Factory::createManager($context); |
|
56 | + $this->locale = $localeManager->bootstrap($site, $lang, $currency, $disableSites); |
|
57 | 57 | } |
58 | 58 | |
59 | 59 | return $this->locale; |
@@ -67,17 +67,17 @@ discard block |
||
67 | 67 | * @param string $site Unique site code |
68 | 68 | * @return \Aimeos\MShop\Locale\Item\Iface Locale item object |
69 | 69 | */ |
70 | - public function getBackend( \Aimeos\MShop\Context\Item\Iface $context, $site ) |
|
70 | + public function getBackend(\Aimeos\MShop\Context\Item\Iface $context, $site) |
|
71 | 71 | { |
72 | - $localeManager = \Aimeos\MShop\Factory::createManager( $context, 'locale' ); |
|
72 | + $localeManager = \Aimeos\MShop\Factory::createManager($context, 'locale'); |
|
73 | 73 | |
74 | 74 | try |
75 | 75 | { |
76 | - $localeItem = $localeManager->bootstrap( $site, '', '', false ); |
|
77 | - $localeItem->setLanguageId( null ); |
|
78 | - $localeItem->setCurrencyId( null ); |
|
76 | + $localeItem = $localeManager->bootstrap($site, '', '', false); |
|
77 | + $localeItem->setLanguageId(null); |
|
78 | + $localeItem->setCurrencyId(null); |
|
79 | 79 | } |
80 | - catch( \Aimeos\MShop\Locale\Exception $e ) |
|
80 | + catch (\Aimeos\MShop\Locale\Exception $e) |
|
81 | 81 | { |
82 | 82 | $localeItem = $localeManager->createItem(); |
83 | 83 | } |
@@ -181,8 +181,7 @@ |
||
181 | 181 | $localeItem = $localeManager->bootstrap( $site, '', '', false ); |
182 | 182 | $localeItem->setLanguageId( null ); |
183 | 183 | $localeItem->setCurrencyId( null ); |
184 | - } |
|
185 | - catch( \Aimeos\MShop\Locale\Exception $e ) |
|
184 | + } catch( \Aimeos\MShop\Locale\Exception $e ) |
|
186 | 185 | { |
187 | 186 | $localeItem = $localeManager->createItem(); |
188 | 187 | } |