@@ -59,8 +59,7 @@ |
||
59 | 59 | |
60 | 60 | $i18n = $this->container->get( 'aimeos_i18n' )->get( array( $locale ) ); |
61 | 61 | $translation = $i18n[$locale]; |
62 | - } |
|
63 | - else |
|
62 | + } else |
|
64 | 63 | { |
65 | 64 | $translation = new \Aimeos\MW\Translation\None( 'en' ); |
66 | 65 | } |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | * |
31 | 31 | * @param ContainerInterface $container Dependency container |
32 | 32 | */ |
33 | - public function __construct( ContainerInterface $container ) |
|
33 | + public function __construct(ContainerInterface $container) |
|
34 | 34 | { |
35 | 35 | $this->container = $container; |
36 | 36 | } |
@@ -46,54 +46,54 @@ discard block |
||
46 | 46 | * @param string|null $locale Code of the current language or null for no translation |
47 | 47 | * @return \Aimeos\MW\View\Iface View object |
48 | 48 | */ |
49 | - public function create( ServerRequestInterface $request, ResponseInterface $response, array $attr, array $templatePaths, $locale = null ) |
|
49 | + public function create(ServerRequestInterface $request, ResponseInterface $response, array $attr, array $templatePaths, $locale = null) |
|
50 | 50 | { |
51 | 51 | $params = $fixed = array(); |
52 | - $config = $this->container->get( 'aimeos_config' ); |
|
52 | + $config = $this->container->get('aimeos_config'); |
|
53 | 53 | |
54 | - if( $locale !== null ) |
|
54 | + if ($locale !== null) |
|
55 | 55 | { |
56 | 56 | $params = $attr + (array) $request->getParsedBody() + (array) $request->getQueryParams(); |
57 | - $fixed = $this->getFixedParams( $attr ); |
|
57 | + $fixed = $this->getFixedParams($attr); |
|
58 | 58 | |
59 | - $i18n = $this->container->get( 'aimeos_i18n' )->get( array( $locale ) ); |
|
59 | + $i18n = $this->container->get('aimeos_i18n')->get(array($locale)); |
|
60 | 60 | $translation = $i18n[$locale]; |
61 | 61 | } |
62 | 62 | else |
63 | 63 | { |
64 | - $translation = new \Aimeos\MW\Translation\None( 'en' ); |
|
64 | + $translation = new \Aimeos\MW\Translation\None('en'); |
|
65 | 65 | } |
66 | 66 | |
67 | 67 | |
68 | - $view = new \Aimeos\MW\View\Standard( $templatePaths ); |
|
68 | + $view = new \Aimeos\MW\View\Standard($templatePaths); |
|
69 | 69 | |
70 | - $helper = new \Aimeos\MW\View\Helper\Translate\Standard( $view, $translation ); |
|
71 | - $view->addHelper( 'translate', $helper ); |
|
70 | + $helper = new \Aimeos\MW\View\Helper\Translate\Standard($view, $translation); |
|
71 | + $view->addHelper('translate', $helper); |
|
72 | 72 | |
73 | - $helper = new \Aimeos\MW\View\Helper\Url\Slim( $view, $this->container->get( 'router' ), $fixed ); |
|
74 | - $view->addHelper( 'url', $helper ); |
|
73 | + $helper = new \Aimeos\MW\View\Helper\Url\Slim($view, $this->container->get('router'), $fixed); |
|
74 | + $view->addHelper('url', $helper); |
|
75 | 75 | |
76 | - $helper = new \Aimeos\MW\View\Helper\Param\Standard( $view, $params ); |
|
77 | - $view->addHelper( 'param', $helper ); |
|
76 | + $helper = new \Aimeos\MW\View\Helper\Param\Standard($view, $params); |
|
77 | + $view->addHelper('param', $helper); |
|
78 | 78 | |
79 | - $config = new \Aimeos\MW\Config\Decorator\Protect( clone $config, array( 'admin', 'client' ) ); |
|
80 | - $helper = new \Aimeos\MW\View\Helper\Config\Standard( $view, $config ); |
|
81 | - $view->addHelper( 'config', $helper ); |
|
79 | + $config = new \Aimeos\MW\Config\Decorator\Protect(clone $config, array('admin', 'client')); |
|
80 | + $helper = new \Aimeos\MW\View\Helper\Config\Standard($view, $config); |
|
81 | + $view->addHelper('config', $helper); |
|
82 | 82 | |
83 | - $sepDec = $config->get( 'client/html/common/format/seperatorDecimal', '.' ); |
|
84 | - $sep1000 = $config->get( 'client/html/common/format/seperator1000', ' ' ); |
|
85 | - $helper = new \Aimeos\MW\View\Helper\Number\Standard( $view, $sepDec, $sep1000 ); |
|
86 | - $view->addHelper( 'number', $helper ); |
|
83 | + $sepDec = $config->get('client/html/common/format/seperatorDecimal', '.'); |
|
84 | + $sep1000 = $config->get('client/html/common/format/seperator1000', ' '); |
|
85 | + $helper = new \Aimeos\MW\View\Helper\Number\Standard($view, $sepDec, $sep1000); |
|
86 | + $view->addHelper('number', $helper); |
|
87 | 87 | |
88 | - $helper = new \Aimeos\MW\View\Helper\Request\Slim( $view, $request ); |
|
89 | - $view->addHelper( 'request', $helper ); |
|
88 | + $helper = new \Aimeos\MW\View\Helper\Request\Slim($view, $request); |
|
89 | + $view->addHelper('request', $helper); |
|
90 | 90 | |
91 | - $helper = new \Aimeos\MW\View\Helper\Response\Slim( $view, $response ); |
|
92 | - $view->addHelper( 'response', $helper ); |
|
91 | + $helper = new \Aimeos\MW\View\Helper\Response\Slim($view, $response); |
|
92 | + $view->addHelper('response', $helper); |
|
93 | 93 | |
94 | - $csrf = $request->getAttribute( 'csrf_name' ); |
|
95 | - $helper = new \Aimeos\MW\View\Helper\Csrf\Standard( $view, $csrf, $request->getAttribute( 'csrf_value ') ); |
|
96 | - $view->addHelper( 'csrf', $helper ); |
|
94 | + $csrf = $request->getAttribute('csrf_name'); |
|
95 | + $helper = new \Aimeos\MW\View\Helper\Csrf\Standard($view, $csrf, $request->getAttribute('csrf_value ')); |
|
96 | + $view->addHelper('csrf', $helper); |
|
97 | 97 | |
98 | 98 | return $view; |
99 | 99 | } |
@@ -105,19 +105,19 @@ discard block |
||
105 | 105 | * @param array $attributes Associative list of route attributes |
106 | 106 | * @return array Associative list of parameters with "site", "locale" and "currency" if available |
107 | 107 | */ |
108 | - protected function getFixedParams( array $attributes ) |
|
108 | + protected function getFixedParams(array $attributes) |
|
109 | 109 | { |
110 | 110 | $fixed = array(); |
111 | 111 | |
112 | - if( isset( $attributes['site'] ) ) { |
|
112 | + if (isset($attributes['site'])) { |
|
113 | 113 | $fixed['site'] = $attributes['site']; |
114 | 114 | } |
115 | 115 | |
116 | - if( isset( $attributes['locale'] ) ) { |
|
116 | + if (isset($attributes['locale'])) { |
|
117 | 117 | $fixed['locale'] = $attributes['locale']; |
118 | 118 | } |
119 | 119 | |
120 | - if( isset( $attributes['currency'] ) ) { |
|
120 | + if (isset($attributes['currency'])) { |
|
121 | 121 | $fixed['currency'] = $attributes['currency']; |
122 | 122 | } |
123 | 123 |
@@ -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( $request, $response, $attr, $tmplPaths, $langid ); |
|
55 | - $context->setView( $view ); |
|
54 | + $view = $this->container->get('aimeos_view')->create($request, $response, $attr, $tmplPaths, $langid); |
|
55 | + $context->setView($view); |
|
56 | 56 | |
57 | - $pagesConfig = $this->container->get( 'aimeos_config' )->get( 'page', array() ); |
|
58 | - $result = array( 'aibody' => array(), 'aiheader' => array() ); |
|
57 | + $pagesConfig = $this->container->get('aimeos_config')->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(); |
@@ -30,10 +30,10 @@ discard block |
||
30 | 30 | * @param ResponseInterface $response Response object |
31 | 31 | * @return ResponseInterface $response Modified response object with generated output |
32 | 32 | */ |
33 | - public static function confirmAction( ContainerInterface $container, ServerRequestInterface $request, ResponseInterface $response, array $args ) |
|
33 | + public static function confirmAction(ContainerInterface $container, ServerRequestInterface $request, ResponseInterface $response, array $args) |
|
34 | 34 | { |
35 | - $contents = $container->get( 'aimeos_page' )->getSections( 'checkout-confirm', $request, $response, $args ); |
|
36 | - return $container->get( 'view' )->render( $response, 'Checkout/confirm.html.twig', $contents ); |
|
35 | + $contents = $container->get('aimeos_page')->getSections('checkout-confirm', $request, $response, $args); |
|
36 | + return $container->get('view')->render($response, 'Checkout/confirm.html.twig', $contents); |
|
37 | 37 | } |
38 | 38 | |
39 | 39 | |
@@ -45,10 +45,10 @@ discard block |
||
45 | 45 | * @param ResponseInterface $response Response object |
46 | 46 | * @return ResponseInterface $response Modified response object with generated output |
47 | 47 | */ |
48 | - public static function indexAction( ContainerInterface $container, ServerRequestInterface $request, ResponseInterface $response, array $args ) |
|
48 | + public static function indexAction(ContainerInterface $container, ServerRequestInterface $request, ResponseInterface $response, array $args) |
|
49 | 49 | { |
50 | - $contents = $container->get( 'aimeos_page' )->getSections( 'checkout-index', $request, $response, $args ); |
|
51 | - return $container->get( 'view' )->render( $response, 'Checkout/index.html.twig', $contents ); |
|
50 | + $contents = $container->get('aimeos_page')->getSections('checkout-index', $request, $response, $args); |
|
51 | + return $container->get('view')->render($response, 'Checkout/index.html.twig', $contents); |
|
52 | 52 | } |
53 | 53 | |
54 | 54 | |
@@ -60,9 +60,9 @@ discard block |
||
60 | 60 | * @param ResponseInterface $response Response object |
61 | 61 | * @return ResponseInterface $response Modified response object with generated output |
62 | 62 | */ |
63 | - public static function updateAction( ContainerInterface $container, ServerRequestInterface $request, ResponseInterface $response, array $args ) |
|
63 | + public static function updateAction(ContainerInterface $container, ServerRequestInterface $request, ResponseInterface $response, array $args) |
|
64 | 64 | { |
65 | - $contents = $container->get( 'aimeos_page' )->getSections( 'checkout-update', $request, $response, $args ); |
|
66 | - return $container->get( 'view' )->render( $response, 'Checkout/update.html.twig', $contents ); |
|
65 | + $contents = $container->get('aimeos_page')->getSections('checkout-update', $request, $response, $args); |
|
66 | + return $container->get('view')->render($response, 'Checkout/update.html.twig', $contents); |
|
67 | 67 | } |
68 | 68 | } |
69 | 69 | \ No newline at end of file |
@@ -30,9 +30,9 @@ |
||
30 | 30 | * @param ResponseInterface $response Response object |
31 | 31 | * @return ResponseInterface $response Modified response object with generated output |
32 | 32 | */ |
33 | - public static function indexAction( ContainerInterface $container, ServerRequestInterface $request, ResponseInterface $response, array $args ) |
|
33 | + public static function indexAction(ContainerInterface $container, ServerRequestInterface $request, ResponseInterface $response, array $args) |
|
34 | 34 | { |
35 | - $contents = $container->get( 'aimeos_page' )->getSections( 'basket-index', $request, $response, $args ); |
|
36 | - return $container->get( 'view' )->render( $response, 'Basket/index.html.twig', $contents ); |
|
35 | + $contents = $container->get('aimeos_page')->getSections('basket-index', $request, $response, $args); |
|
36 | + return $container->get('view')->render($response, 'Basket/index.html.twig', $contents); |
|
37 | 37 | } |
38 | 38 | } |
39 | 39 | \ No newline at end of file |
@@ -30,10 +30,10 @@ discard block |
||
30 | 30 | * @param ResponseInterface $response Response object |
31 | 31 | * @return ResponseInterface $response Modified response object with generated output |
32 | 32 | */ |
33 | - public static function indexAction( ContainerInterface $container, ServerRequestInterface $request, ResponseInterface $response, array $args ) |
|
33 | + public static function indexAction(ContainerInterface $container, ServerRequestInterface $request, ResponseInterface $response, array $args) |
|
34 | 34 | { |
35 | - $contents = $container->get( 'aimeos_page' )->getSections( 'account-index', $request, $response, $args ); |
|
36 | - return $container->get( 'view' )->render( $response, 'Account/index.html.twig', $contents ); |
|
35 | + $contents = $container->get('aimeos_page')->getSections('account-index', $request, $response, $args); |
|
36 | + return $container->get('view')->render($response, 'Account/index.html.twig', $contents); |
|
37 | 37 | } |
38 | 38 | |
39 | 39 | |
@@ -45,16 +45,16 @@ discard block |
||
45 | 45 | * @param ResponseInterface $response Response object |
46 | 46 | * @return ResponseInterface $response Modified response object with generated output |
47 | 47 | */ |
48 | - public static function downloadAction( ContainerInterface $container, ServerRequestInterface $request, ResponseInterface $response, array $args ) |
|
48 | + public static function downloadAction(ContainerInterface $container, ServerRequestInterface $request, ResponseInterface $response, array $args) |
|
49 | 49 | { |
50 | - $context = $container->get( 'aimeos_context' )->get( true, $args ); |
|
50 | + $context = $container->get('aimeos_context')->get(true, $args); |
|
51 | 51 | $langid = $context->getLocale()->getLanguageId(); |
52 | 52 | |
53 | - $view = $container->get( 'aimeos_view' )->create( $request, $response, $args, array(), $langid ); |
|
54 | - $context->setView( $view ); |
|
53 | + $view = $container->get('aimeos_view')->create($request, $response, $args, array(), $langid); |
|
54 | + $context->setView($view); |
|
55 | 55 | |
56 | - $client = \Aimeos\Client\Html\Factory::createClient( $context, array(), 'account/download' ); |
|
57 | - $client->setView( $view ); |
|
56 | + $client = \Aimeos\Client\Html\Factory::createClient($context, array(), 'account/download'); |
|
57 | + $client->setView($view); |
|
58 | 58 | $client->process(); |
59 | 59 | |
60 | 60 | return $view->response(); |
@@ -30,14 +30,14 @@ discard block |
||
30 | 30 | * @param ResponseInterface $response Response object |
31 | 31 | * @return ResponseInterface $response Modified response object with generated output |
32 | 32 | */ |
33 | - public static function countAction( ContainerInterface $container, ServerRequestInterface $request, ResponseInterface $response, array $args ) |
|
33 | + public static function countAction(ContainerInterface $container, ServerRequestInterface $request, ResponseInterface $response, array $args) |
|
34 | 34 | { |
35 | - $contents = $container->get( 'aimeos_page' )->getSections( 'catalog-count', $request, $response, $args ); |
|
35 | + $contents = $container->get('aimeos_page')->getSections('catalog-count', $request, $response, $args); |
|
36 | 36 | |
37 | - $response = $response->withStatus( 200 ); |
|
38 | - $response = $response->withHeader( 'Content-Type', 'application/javascript' ); |
|
37 | + $response = $response->withStatus(200); |
|
38 | + $response = $response->withHeader('Content-Type', 'application/javascript'); |
|
39 | 39 | |
40 | - return $container->get( 'view' )->render( $response, 'Catalog/count.html.twig', $contents ); |
|
40 | + return $container->get('view')->render($response, 'Catalog/count.html.twig', $contents); |
|
41 | 41 | } |
42 | 42 | |
43 | 43 | |
@@ -49,10 +49,10 @@ discard block |
||
49 | 49 | * @param ResponseInterface $response Response object |
50 | 50 | * @return ResponseInterface $response Modified response object with generated output |
51 | 51 | */ |
52 | - public static function detailAction( ContainerInterface $container, ServerRequestInterface $request, ResponseInterface $response, array $args ) |
|
52 | + public static function detailAction(ContainerInterface $container, ServerRequestInterface $request, ResponseInterface $response, array $args) |
|
53 | 53 | { |
54 | - $contents = $container->get( 'aimeos_page' )->getSections( 'catalog-detail', $request, $response, $args ); |
|
55 | - return $container->get( 'view' )->render( $response, 'Catalog/detail.html.twig', $contents ); |
|
54 | + $contents = $container->get('aimeos_page')->getSections('catalog-detail', $request, $response, $args); |
|
55 | + return $container->get('view')->render($response, 'Catalog/detail.html.twig', $contents); |
|
56 | 56 | } |
57 | 57 | |
58 | 58 | |
@@ -64,10 +64,10 @@ discard block |
||
64 | 64 | * @param ResponseInterface $response Response object |
65 | 65 | * @return ResponseInterface $response Modified response object with generated output |
66 | 66 | */ |
67 | - public static function listAction( ContainerInterface $container, ServerRequestInterface $request, ResponseInterface $response, array $args ) |
|
67 | + public static function listAction(ContainerInterface $container, ServerRequestInterface $request, ResponseInterface $response, array $args) |
|
68 | 68 | { |
69 | - $contents = $container->get( 'aimeos_page' )->getSections( 'catalog-list', $request, $response, $args ); |
|
70 | - return $container->get( 'view' )->render( $response, 'Catalog/list.html.twig', $contents ); |
|
69 | + $contents = $container->get('aimeos_page')->getSections('catalog-list', $request, $response, $args); |
|
70 | + return $container->get('view')->render($response, 'Catalog/list.html.twig', $contents); |
|
71 | 71 | } |
72 | 72 | |
73 | 73 | |
@@ -79,14 +79,14 @@ discard block |
||
79 | 79 | * @param ResponseInterface $response Response object |
80 | 80 | * @return ResponseInterface $response Modified response object with generated output |
81 | 81 | */ |
82 | - public static function stockAction( ContainerInterface $container, ServerRequestInterface $request, ResponseInterface $response, array $args ) |
|
82 | + public static function stockAction(ContainerInterface $container, ServerRequestInterface $request, ResponseInterface $response, array $args) |
|
83 | 83 | { |
84 | - $contents = $container->get( 'aimeos_page' )->getSections( 'catalog-stock', $request, $response, $args ); |
|
84 | + $contents = $container->get('aimeos_page')->getSections('catalog-stock', $request, $response, $args); |
|
85 | 85 | |
86 | - $response = $response->withStatus( 200 ); |
|
87 | - $response = $response->withHeader( 'Content-Type', 'application/javascript' ); |
|
86 | + $response = $response->withStatus(200); |
|
87 | + $response = $response->withHeader('Content-Type', 'application/javascript'); |
|
88 | 88 | |
89 | - return $container->get( 'view' )->render( $response, 'Catalog/stock.html.twig', $contents ); |
|
89 | + return $container->get('view')->render($response, 'Catalog/stock.html.twig', $contents); |
|
90 | 90 | } |
91 | 91 | |
92 | 92 | |
@@ -98,13 +98,13 @@ discard block |
||
98 | 98 | * @param ResponseInterface $response Response object |
99 | 99 | * @return ResponseInterface $response Modified response object with generated output |
100 | 100 | */ |
101 | - public static function suggestAction( ContainerInterface $container, ServerRequestInterface $request, ResponseInterface $response, array $args ) |
|
101 | + public static function suggestAction(ContainerInterface $container, ServerRequestInterface $request, ResponseInterface $response, array $args) |
|
102 | 102 | { |
103 | - $contents = $container->get( 'aimeos_page' )->getSections( 'catalog-suggest', $request, $response, $args ); |
|
103 | + $contents = $container->get('aimeos_page')->getSections('catalog-suggest', $request, $response, $args); |
|
104 | 104 | |
105 | - $response = $response->withStatus( 200 ); |
|
106 | - $response = $response->withHeader( 'Content-Type', 'application/json' ); |
|
105 | + $response = $response->withStatus(200); |
|
106 | + $response = $response->withHeader('Content-Type', 'application/json'); |
|
107 | 107 | |
108 | - return $container->get( 'view' )->render( $response, 'Catalog/suggest.html.twig', $contents ); |
|
108 | + return $container->get('view')->render($response, 'Catalog/suggest.html.twig', $contents); |
|
109 | 109 | } |
110 | 110 | } |
111 | 111 | \ No newline at end of file |
@@ -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,62 +32,62 @@ discard block |
||
32 | 32 | * @param array $args Associative list of route parameters |
33 | 33 | * @return ResponseInterface $response Modified response object with generated output |
34 | 34 | */ |
35 | - public static function indexAction( ContainerInterface $container, ServerRequestInterface $request, ResponseInterface $response, array $args ) |
|
35 | + public static function indexAction(ContainerInterface $container, ServerRequestInterface $request, ResponseInterface $response, array $args) |
|
36 | 36 | { |
37 | - $site = ( isset( $args['site'] ) ? $args['site'] : 'default' ); |
|
38 | - $lang = ( isset( $args['lang'] ) ? $args['lang'] : 'en' ); |
|
39 | - $tab = ( isset( $args['tab'] ) ? $args['tab'] : 0 ); |
|
37 | + $site = (isset($args['site']) ? $args['site'] : 'default'); |
|
38 | + $lang = (isset($args['lang']) ? $args['lang'] : 'en'); |
|
39 | + $tab = (isset($args['tab']) ? $args['tab'] : 0); |
|
40 | 40 | |
41 | - $aimeos = $container->get( 'aimeos' ); |
|
42 | - $cntlPaths = $aimeos->getCustomPaths( 'controller/extjs' ); |
|
41 | + $aimeos = $container->get('aimeos'); |
|
42 | + $cntlPaths = $aimeos->getCustomPaths('controller/extjs'); |
|
43 | 43 | |
44 | - $context = $container->get( 'aimeos_context' )->get( false, $args ); |
|
45 | - $context = self::setLocale( $context, $site, $lang ); |
|
44 | + $context = $container->get('aimeos_context')->get(false, $args); |
|
45 | + $context = self::setLocale($context, $site, $lang); |
|
46 | 46 | |
47 | - $controller = new \Aimeos\Controller\ExtJS\JsonRpc( $context, $cntlPaths ); |
|
47 | + $controller = new \Aimeos\Controller\ExtJS\JsonRpc($context, $cntlPaths); |
|
48 | 48 | $cssFiles = array(); |
49 | 49 | |
50 | - foreach( $aimeos->getCustomPaths( 'admin/extjs' ) as $base => $paths ) |
|
50 | + foreach ($aimeos->getCustomPaths('admin/extjs') as $base => $paths) |
|
51 | 51 | { |
52 | - foreach( $paths as $path ) |
|
52 | + foreach ($paths as $path) |
|
53 | 53 | { |
54 | - $jsbAbsPath = $base . '/' . $path; |
|
54 | + $jsbAbsPath = $base.'/'.$path; |
|
55 | 55 | |
56 | - if( !is_file( $jsbAbsPath ) ) { |
|
57 | - throw new \Exception( sprintf( 'JSB2 file "%1$s" not found', $jsbAbsPath ) ); |
|
56 | + if (!is_file($jsbAbsPath)) { |
|
57 | + throw new \Exception(sprintf('JSB2 file "%1$s" not found', $jsbAbsPath)); |
|
58 | 58 | } |
59 | 59 | |
60 | - $jsb2 = new \Aimeos\MW\Jsb2\Standard( $jsbAbsPath, dirname( $path ) ); |
|
61 | - $cssFiles = array_merge( $cssFiles, $jsb2->getUrls( 'css' ) ); |
|
60 | + $jsb2 = new \Aimeos\MW\Jsb2\Standard($jsbAbsPath, dirname($path)); |
|
61 | + $cssFiles = array_merge($cssFiles, $jsb2->getUrls('css')); |
|
62 | 62 | } |
63 | 63 | } |
64 | 64 | |
65 | - $csrfname = $request->getAttribute( 'csrf_name' ); |
|
66 | - $csrfvalue = $request->getAttribute( 'csrf_value' ); |
|
65 | + $csrfname = $request->getAttribute('csrf_name'); |
|
66 | + $csrfvalue = $request->getAttribute('csrf_value'); |
|
67 | 67 | |
68 | - $router = $container->get( 'router' ); |
|
69 | - $jqadmUrl = $router->pathFor( 'aimeos_shop_jqadm_search', array( 'site' => $site, 'resource' => 'product' ) ); |
|
70 | - $jsonUrl = $router->pathFor( 'aimeos_shop_extadm_json', array( 'site' => $site, $csrfname => $csrfvalue ) ); |
|
71 | - $adminUrl = $router->pathFor( 'aimeos_shop_extadm', array( 'site' => '<site>', 'lang' => '<lang>', 'tab' => '<tab>' ) ); |
|
68 | + $router = $container->get('router'); |
|
69 | + $jqadmUrl = $router->pathFor('aimeos_shop_jqadm_search', array('site' => $site, 'resource' => 'product')); |
|
70 | + $jsonUrl = $router->pathFor('aimeos_shop_extadm_json', array('site' => $site, $csrfname => $csrfvalue)); |
|
71 | + $adminUrl = $router->pathFor('aimeos_shop_extadm', array('site' => '<site>', 'lang' => '<lang>', 'tab' => '<tab>')); |
|
72 | 72 | |
73 | 73 | $vars = array( |
74 | 74 | 'lang' => $lang, |
75 | 75 | 'cssFiles' => $cssFiles, |
76 | - 'languages' => self::getJsonLanguages( $aimeos ), |
|
77 | - 'config' => self::getJsonClientConfig( $context ), |
|
78 | - 'site' => self::getJsonSiteItem( $context, $site ), |
|
79 | - 'i18nContent' => self::getJsonClientI18n( $aimeos->getI18nPaths(), $lang ), |
|
80 | - 'uploaddir' => $context->getConfig()->get( 'uploaddir', '/.' ), |
|
76 | + 'languages' => self::getJsonLanguages($aimeos), |
|
77 | + 'config' => self::getJsonClientConfig($context), |
|
78 | + 'site' => self::getJsonSiteItem($context, $site), |
|
79 | + 'i18nContent' => self::getJsonClientI18n($aimeos->getI18nPaths(), $lang), |
|
80 | + 'uploaddir' => $context->getConfig()->get('uploaddir', '/.'), |
|
81 | 81 | 'searchSchemas' => $controller->getJsonSearchSchemas(), |
82 | 82 | 'itemSchemas' => $controller->getJsonItemSchemas(), |
83 | - 'smd' => $controller->getJsonSmd( $jsonUrl ), |
|
83 | + 'smd' => $controller->getJsonSmd($jsonUrl), |
|
84 | 84 | 'urlTemplate' => $adminUrl, |
85 | 85 | 'jqadmurl' => $jqadmUrl, |
86 | 86 | 'activeTab' => $tab, |
87 | 87 | 'version' => \Aimeos\Slim\Bootstrap::getVersion(), |
88 | 88 | ); |
89 | 89 | |
90 | - return $container->get( 'view' )->render( $response, 'Extadm/index.html.twig', $vars ); |
|
90 | + return $container->get('view')->render($response, 'Extadm/index.html.twig', $vars); |
|
91 | 91 | } |
92 | 92 | |
93 | 93 | |
@@ -100,22 +100,22 @@ discard block |
||
100 | 100 | * @param array $args Associative list of route parameters |
101 | 101 | * @return ResponseInterface $response Modified response object with generated output |
102 | 102 | */ |
103 | - public static function doAction( ContainerInterface $container, ServerRequestInterface $request, ResponseInterface $response, array $args ) |
|
103 | + public static function doAction(ContainerInterface $container, ServerRequestInterface $request, ResponseInterface $response, array $args) |
|
104 | 104 | { |
105 | - $cntlPaths = $container->get( 'aimeos' )->getCustomPaths( 'controller/extjs' ); |
|
105 | + $cntlPaths = $container->get('aimeos')->getCustomPaths('controller/extjs'); |
|
106 | 106 | |
107 | - $context = $container->get( 'aimeos_context' )->get( false, $args ); |
|
108 | - $context->setView( $container->get( 'aimeos_view' )->create( $request, $response, $args, array() ) ); |
|
109 | - $context = self::setLocale( $context ); |
|
107 | + $context = $container->get('aimeos_context')->get(false, $args); |
|
108 | + $context->setView($container->get('aimeos_view')->create($request, $response, $args, array())); |
|
109 | + $context = self::setLocale($context); |
|
110 | 110 | |
111 | 111 | $params = $request->getQueryParams(); |
112 | - if( ( $post = $request->getParsedBody() ) !== null ) { |
|
113 | - $params = array_merge( $params, (array) $post ); |
|
112 | + if (($post = $request->getParsedBody()) !== null) { |
|
113 | + $params = array_merge($params, (array) $post); |
|
114 | 114 | } |
115 | 115 | |
116 | - $controller = new \Aimeos\Controller\ExtJS\JsonRpc( $context, $cntlPaths ); |
|
117 | - $output = $controller->process( $params, (string) $request->getBody() ); |
|
118 | - $response->getBody()->write( $output ); |
|
116 | + $controller = new \Aimeos\Controller\ExtJS\JsonRpc($context, $cntlPaths); |
|
117 | + $output = $controller->process($params, (string) $request->getBody()); |
|
118 | + $response->getBody()->write($output); |
|
119 | 119 | |
120 | 120 | return $response; |
121 | 121 | } |
@@ -130,30 +130,30 @@ discard block |
||
130 | 130 | * @param array $args Associative list of route parameters |
131 | 131 | * @return ResponseInterface $response Modified response object with generated output |
132 | 132 | */ |
133 | - public static function fileAction( ContainerInterface $container, ServerRequestInterface $request, ResponseInterface $response, array $args ) |
|
133 | + public static function fileAction(ContainerInterface $container, ServerRequestInterface $request, ResponseInterface $response, array $args) |
|
134 | 134 | { |
135 | 135 | $contents = ''; |
136 | 136 | $jsFiles = array(); |
137 | - $aimeos = $container->get( 'aimeos' ); |
|
137 | + $aimeos = $container->get('aimeos'); |
|
138 | 138 | |
139 | - foreach( $aimeos->getCustomPaths( 'admin/extjs' ) as $base => $paths ) |
|
139 | + foreach ($aimeos->getCustomPaths('admin/extjs') as $base => $paths) |
|
140 | 140 | { |
141 | - foreach( $paths as $path ) |
|
141 | + foreach ($paths as $path) |
|
142 | 142 | { |
143 | - $jsbAbsPath = $base . '/' . $path; |
|
144 | - $jsb2 = new \Aimeos\MW\Jsb2\Standard( $jsbAbsPath, dirname( $jsbAbsPath ) ); |
|
145 | - $jsFiles = array_merge( $jsFiles, $jsb2->getFiles( 'js' ) ); |
|
143 | + $jsbAbsPath = $base.'/'.$path; |
|
144 | + $jsb2 = new \Aimeos\MW\Jsb2\Standard($jsbAbsPath, dirname($jsbAbsPath)); |
|
145 | + $jsFiles = array_merge($jsFiles, $jsb2->getFiles('js')); |
|
146 | 146 | } |
147 | 147 | } |
148 | 148 | |
149 | - foreach( $jsFiles as $file ) |
|
149 | + foreach ($jsFiles as $file) |
|
150 | 150 | { |
151 | - if( ( $content = file_get_contents( $file ) ) !== false ) { |
|
151 | + if (($content = file_get_contents($file)) !== false) { |
|
152 | 152 | $contents .= $content; |
153 | 153 | } |
154 | 154 | } |
155 | 155 | |
156 | - return $response->withHeader( 'Content-Type', 'application/javascript' )->getBody()->write( $contents ); |
|
156 | + return $response->withHeader('Content-Type', 'application/javascript')->getBody()->write($contents); |
|
157 | 157 | } |
158 | 158 | |
159 | 159 | |
@@ -163,15 +163,15 @@ discard block |
||
163 | 163 | * @param \Aimeos\Bootstrap $aimeos Aimeos object |
164 | 164 | * @return array List of language IDs with labels |
165 | 165 | */ |
166 | - protected static function getJsonLanguages( \Aimeos\Bootstrap $aimeos ) |
|
166 | + protected static function getJsonLanguages(\Aimeos\Bootstrap $aimeos) |
|
167 | 167 | { |
168 | 168 | $result = array(); |
169 | 169 | |
170 | - foreach( $aimeos->getI18nList( 'admin' ) as $id ) { |
|
171 | - $result[] = array( 'id' => $id, 'label' => $id ); |
|
170 | + foreach ($aimeos->getI18nList('admin') as $id) { |
|
171 | + $result[] = array('id' => $id, 'label' => $id); |
|
172 | 172 | } |
173 | 173 | |
174 | - return json_encode( $result ); |
|
174 | + return json_encode($result); |
|
175 | 175 | } |
176 | 176 | |
177 | 177 | |
@@ -181,10 +181,10 @@ discard block |
||
181 | 181 | * @param \Aimeos\MShop\Context\Item\Iface $context Context item object |
182 | 182 | * @return string JSON encoded configuration object |
183 | 183 | */ |
184 | - protected static function getJsonClientConfig( \Aimeos\MShop\Context\Item\Iface $context ) |
|
184 | + protected static function getJsonClientConfig(\Aimeos\MShop\Context\Item\Iface $context) |
|
185 | 185 | { |
186 | - $config = $context->getConfig()->get( 'admin/extjs', array() ); |
|
187 | - return json_encode( array( 'admin' => array( 'extjs' => $config ) ), JSON_FORCE_OBJECT ); |
|
186 | + $config = $context->getConfig()->get('admin/extjs', array()); |
|
187 | + return json_encode(array('admin' => array('extjs' => $config)), JSON_FORCE_OBJECT); |
|
188 | 188 | } |
189 | 189 | |
190 | 190 | |
@@ -195,16 +195,16 @@ discard block |
||
195 | 195 | * @param string $lang ISO language code like "en" or "en_GB" |
196 | 196 | * @return string JSON encoded translation object |
197 | 197 | */ |
198 | - protected static function getJsonClientI18n( array $i18nPaths, $lang ) |
|
198 | + protected static function getJsonClientI18n(array $i18nPaths, $lang) |
|
199 | 199 | { |
200 | - $i18n = new \Aimeos\MW\Translation\Gettext( $i18nPaths, $lang ); |
|
200 | + $i18n = new \Aimeos\MW\Translation\Gettext($i18nPaths, $lang); |
|
201 | 201 | |
202 | 202 | $content = array( |
203 | - 'admin' => $i18n->getAll( 'admin' ), |
|
204 | - 'admin/ext' => $i18n->getAll( 'admin/ext' ), |
|
203 | + 'admin' => $i18n->getAll('admin'), |
|
204 | + 'admin/ext' => $i18n->getAll('admin/ext'), |
|
205 | 205 | ); |
206 | 206 | |
207 | - return json_encode( $content, JSON_FORCE_OBJECT ); |
|
207 | + return json_encode($content, JSON_FORCE_OBJECT); |
|
208 | 208 | } |
209 | 209 | |
210 | 210 | |
@@ -216,19 +216,19 @@ discard block |
||
216 | 216 | * @return string JSON encoded site item object |
217 | 217 | * @throws Exception If no site item was found for the code |
218 | 218 | */ |
219 | - protected static function getJsonSiteItem( \Aimeos\MShop\Context\Item\Iface $context, $site ) |
|
219 | + protected static function getJsonSiteItem(\Aimeos\MShop\Context\Item\Iface $context, $site) |
|
220 | 220 | { |
221 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'locale/site' ); |
|
221 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'locale/site'); |
|
222 | 222 | |
223 | 223 | $criteria = $manager->createSearch(); |
224 | - $criteria->setConditions( $criteria->compare( '==', 'locale.site.code', $site ) ); |
|
225 | - $items = $manager->searchItems( $criteria ); |
|
224 | + $criteria->setConditions($criteria->compare('==', 'locale.site.code', $site)); |
|
225 | + $items = $manager->searchItems($criteria); |
|
226 | 226 | |
227 | - if( ( $item = reset( $items ) ) === false ) { |
|
228 | - throw new \Exception( sprintf( 'No site found for code "%1$s"', $site ) ); |
|
227 | + if (($item = reset($items)) === false) { |
|
228 | + throw new \Exception(sprintf('No site found for code "%1$s"', $site)); |
|
229 | 229 | } |
230 | 230 | |
231 | - return json_encode( $item->toArray() ); |
|
231 | + return json_encode($item->toArray()); |
|
232 | 232 | } |
233 | 233 | |
234 | 234 | |
@@ -240,17 +240,17 @@ discard block |
||
240 | 240 | * @param string $locale ISO language code, e.g. "en" or "en_GB" |
241 | 241 | * @return \Aimeos\MShop\Context\Item\Iface Modified context object |
242 | 242 | */ |
243 | - protected static function setLocale( \Aimeos\MShop\Context\Item\Iface $context, $sitecode = 'default', $locale = null ) |
|
243 | + protected static function setLocale(\Aimeos\MShop\Context\Item\Iface $context, $sitecode = 'default', $locale = null) |
|
244 | 244 | { |
245 | - $localeManager = \Aimeos\MShop\Factory::createManager( $context, 'locale' ); |
|
245 | + $localeManager = \Aimeos\MShop\Factory::createManager($context, 'locale'); |
|
246 | 246 | |
247 | 247 | try { |
248 | - $localeItem = $localeManager->bootstrap( $sitecode, $locale, '', false ); |
|
249 | - } catch( \Aimeos\MShop\Locale\Exception $e ) { |
|
248 | + $localeItem = $localeManager->bootstrap($sitecode, $locale, '', false); |
|
249 | + } catch (\Aimeos\MShop\Locale\Exception $e) { |
|
250 | 250 | $localeItem = $localeManager->createItem(); |
251 | 251 | } |
252 | 252 | |
253 | - $context->setLocale( $localeItem ); |
|
253 | + $context->setLocale($localeItem); |
|
254 | 254 | |
255 | 255 | return $context; |
256 | 256 | } |
@@ -216,8 +216,7 @@ |
||
216 | 216 | $localeItem = $localeManager->bootstrap( $sitecode, '', '', false ); |
217 | 217 | $localeItem->setLanguageId( null ); |
218 | 218 | $localeItem->setCurrencyId( null ); |
219 | - } |
|
220 | - catch( \Aimeos\MShop\Locale\Exception $e ) |
|
219 | + } catch( \Aimeos\MShop\Locale\Exception $e ) |
|
221 | 220 | { |
222 | 221 | $localeItem = $localeManager->createItem(); |
223 | 222 | } |
@@ -32,15 +32,15 @@ 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 | 37 | $status = 500; |
38 | 38 | $header = $request->getHeaders(); |
39 | 39 | |
40 | - $client = self::createClient( $container, $request, $response, $args ); |
|
41 | - $result = $client->delete( (string) $request->getBody(), $header, $status ); |
|
40 | + $client = self::createClient($container, $request, $response, $args); |
|
41 | + $result = $client->delete((string) $request->getBody(), $header, $status); |
|
42 | 42 | |
43 | - return self::withResponse( $response, $result, $status, $header ); |
|
43 | + return self::withResponse($response, $result, $status, $header); |
|
44 | 44 | } |
45 | 45 | |
46 | 46 | |
@@ -53,15 +53,15 @@ discard block |
||
53 | 53 | * @param array $args Associative list of route parameters |
54 | 54 | * @return ResponseInterface $response Modified response object with generated output |
55 | 55 | */ |
56 | - public static function getAction( ContainerInterface $container, ServerRequestInterface $request, ResponseInterface $response, array $args ) |
|
56 | + public static function getAction(ContainerInterface $container, ServerRequestInterface $request, ResponseInterface $response, array $args) |
|
57 | 57 | { |
58 | 58 | $status = 500; |
59 | 59 | $header = $request->getHeaders(); |
60 | 60 | |
61 | - $client = self::createClient( $container, $request, $response, $args ); |
|
62 | - $result = $client->get( (string) $request->getBody(), $header, $status ); |
|
61 | + $client = self::createClient($container, $request, $response, $args); |
|
62 | + $result = $client->get((string) $request->getBody(), $header, $status); |
|
63 | 63 | |
64 | - return self::withResponse( $response, $result, $status, $header ); |
|
64 | + return self::withResponse($response, $result, $status, $header); |
|
65 | 65 | } |
66 | 66 | |
67 | 67 | |
@@ -74,15 +74,15 @@ discard block |
||
74 | 74 | * @param array $args Associative list of route parameters |
75 | 75 | * @return ResponseInterface $response Modified response object with generated output |
76 | 76 | */ |
77 | - public static function patchAction( ContainerInterface $container, ServerRequestInterface $request, ResponseInterface $response, array $args ) |
|
77 | + public static function patchAction(ContainerInterface $container, ServerRequestInterface $request, ResponseInterface $response, array $args) |
|
78 | 78 | { |
79 | 79 | $status = 500; |
80 | 80 | $header = $request->getHeaders(); |
81 | 81 | |
82 | - $client = self::createClient( $container, $request, $response, $args ); |
|
83 | - $result = $client->patch( (string) $request->getBody(), $header, $status ); |
|
82 | + $client = self::createClient($container, $request, $response, $args); |
|
83 | + $result = $client->patch((string) $request->getBody(), $header, $status); |
|
84 | 84 | |
85 | - return self::withResponse( $response, $result, $status, $header ); |
|
85 | + return self::withResponse($response, $result, $status, $header); |
|
86 | 86 | } |
87 | 87 | |
88 | 88 | |
@@ -95,15 +95,15 @@ discard block |
||
95 | 95 | * @param array $args Associative list of route parameters |
96 | 96 | * @return ResponseInterface $response Modified response object with generated output |
97 | 97 | */ |
98 | - public static function postAction( ContainerInterface $container, ServerRequestInterface $request, ResponseInterface $response, array $args ) |
|
98 | + public static function postAction(ContainerInterface $container, ServerRequestInterface $request, ResponseInterface $response, array $args) |
|
99 | 99 | { |
100 | 100 | $status = 500; |
101 | 101 | $header = $request->getHeaders(); |
102 | 102 | |
103 | - $client = self::createClient( $container, $request, $response, $args ); |
|
104 | - $result = $client->post( (string) $request->getBody(), $header, $status ); |
|
103 | + $client = self::createClient($container, $request, $response, $args); |
|
104 | + $result = $client->post((string) $request->getBody(), $header, $status); |
|
105 | 105 | |
106 | - return self::withResponse( $response, $result, $status, $header ); |
|
106 | + return self::withResponse($response, $result, $status, $header); |
|
107 | 107 | } |
108 | 108 | |
109 | 109 | |
@@ -116,15 +116,15 @@ discard block |
||
116 | 116 | * @param array $args Associative list of route parameters |
117 | 117 | * @return ResponseInterface $response Modified response object with generated output |
118 | 118 | */ |
119 | - public static function putAction( ContainerInterface $container, ServerRequestInterface $request, ResponseInterface $response, array $args ) |
|
119 | + public static function putAction(ContainerInterface $container, ServerRequestInterface $request, ResponseInterface $response, array $args) |
|
120 | 120 | { |
121 | 121 | $status = 500; |
122 | 122 | $header = $request->getHeaders(); |
123 | 123 | |
124 | - $client = self::createClient( $container, $request, $response, $args ); |
|
125 | - $result = $client->put( (string) $request->getBody(), $header, $status ); |
|
124 | + $client = self::createClient($container, $request, $response, $args); |
|
125 | + $result = $client->put((string) $request->getBody(), $header, $status); |
|
126 | 126 | |
127 | - return self::withResponse( $response, $result, $status, $header ); |
|
127 | + return self::withResponse($response, $result, $status, $header); |
|
128 | 128 | } |
129 | 129 | |
130 | 130 | |
@@ -137,15 +137,15 @@ discard block |
||
137 | 137 | * @param array $args Associative list of route parameters |
138 | 138 | * @return ResponseInterface $response Modified response object with generated output |
139 | 139 | */ |
140 | - public static function optionsAction( ContainerInterface $container, ServerRequestInterface $request, ResponseInterface $response, array $args ) |
|
140 | + public static function optionsAction(ContainerInterface $container, ServerRequestInterface $request, ResponseInterface $response, array $args) |
|
141 | 141 | { |
142 | 142 | $status = 500; |
143 | 143 | $header = $request->getHeaders(); |
144 | 144 | |
145 | - $client = self::createClient( $container, $request, $response, $args ); |
|
146 | - $result = $client->options( (string) $request->getBody(), $header, $status ); |
|
145 | + $client = self::createClient($container, $request, $response, $args); |
|
146 | + $result = $client->options((string) $request->getBody(), $header, $status); |
|
147 | 147 | |
148 | - return self::withResponse( $response, $result, $status, $header ); |
|
148 | + return self::withResponse($response, $result, $status, $header); |
|
149 | 149 | } |
150 | 150 | |
151 | 151 | |
@@ -158,21 +158,21 @@ discard block |
||
158 | 158 | * @param array $args Associative list of route parameters |
159 | 159 | * @return \Aimeos\Controller\JsonAdm\Iface JSON admin controller |
160 | 160 | */ |
161 | - protected static function createClient( ContainerInterface $container, ServerRequestInterface $request, ResponseInterface $response, array $args ) |
|
161 | + protected static function createClient(ContainerInterface $container, ServerRequestInterface $request, ResponseInterface $response, array $args) |
|
162 | 162 | { |
163 | - $resource = ( isset( $args['resource'] ) ? $args['resource'] : null ); |
|
164 | - $site = ( isset( $args['site'] ) ? $args['site'] : 'default' ); |
|
165 | - $lang = ( isset( $args['lang'] ) ? $args['lang'] : 'en' ); |
|
163 | + $resource = (isset($args['resource']) ? $args['resource'] : null); |
|
164 | + $site = (isset($args['site']) ? $args['site'] : 'default'); |
|
165 | + $lang = (isset($args['lang']) ? $args['lang'] : 'en'); |
|
166 | 166 | |
167 | - $templatePaths = $container->get( 'aimeos' )->getCustomPaths( 'admin/jsonadm/templates' ); |
|
167 | + $templatePaths = $container->get('aimeos')->getCustomPaths('admin/jsonadm/templates'); |
|
168 | 168 | |
169 | - $context = $container->get( 'aimeos_context' )->get( false, $args ); |
|
170 | - $context = self::setLocale( $container->get( 'aimeos_i18n' ), $context, $site, $lang ); |
|
169 | + $context = $container->get('aimeos_context')->get(false, $args); |
|
170 | + $context = self::setLocale($container->get('aimeos_i18n'), $context, $site, $lang); |
|
171 | 171 | |
172 | - $view = $container->get( 'aimeos_view' )->create( $request, $response, $args, $templatePaths, $lang ); |
|
173 | - $context->setView( $view ); |
|
172 | + $view = $container->get('aimeos_view')->create($request, $response, $args, $templatePaths, $lang); |
|
173 | + $context->setView($view); |
|
174 | 174 | |
175 | - return \Aimeos\Admin\JsonAdm\Factory::createClient( $context, $templatePaths, $resource ); |
|
175 | + return \Aimeos\Admin\JsonAdm\Factory::createClient($context, $templatePaths, $resource); |
|
176 | 176 | } |
177 | 177 | |
178 | 178 | |
@@ -185,13 +185,13 @@ discard block |
||
185 | 185 | * @param array $header List of HTTP headers |
186 | 186 | * @return ResponseInterface $response Populated response object |
187 | 187 | */ |
188 | - protected static function withResponse( ResponseInterface $response, $content, $status, array $header ) |
|
188 | + protected static function withResponse(ResponseInterface $response, $content, $status, array $header) |
|
189 | 189 | { |
190 | - $response->getBody()->write( $content ); |
|
191 | - $response = $response->withStatus( $status ); |
|
190 | + $response->getBody()->write($content); |
|
191 | + $response = $response->withStatus($status); |
|
192 | 192 | |
193 | - foreach( $header as $key => $value ) { |
|
194 | - $response->withHeader( $key, $value ); |
|
193 | + foreach ($header as $key => $value) { |
|
194 | + $response->withHeader($key, $value); |
|
195 | 195 | } |
196 | 196 | |
197 | 197 | return $response; |
@@ -207,23 +207,23 @@ discard block |
||
207 | 207 | * @param string $lang ISO language code, e.g. "en" or "en_GB" |
208 | 208 | * @return \Aimeos\MShop\Context\Item\Iface Modified context object |
209 | 209 | */ |
210 | - protected static function setLocale( \Aimeos\Slim\Base\I18n $i18n, \Aimeos\MShop\Context\Item\Iface $context, $sitecode, $lang ) |
|
210 | + protected static function setLocale(\Aimeos\Slim\Base\I18n $i18n, \Aimeos\MShop\Context\Item\Iface $context, $sitecode, $lang) |
|
211 | 211 | { |
212 | - $localeManager = \Aimeos\MShop\Factory::createManager( $context, 'locale' ); |
|
212 | + $localeManager = \Aimeos\MShop\Factory::createManager($context, 'locale'); |
|
213 | 213 | |
214 | 214 | try |
215 | 215 | { |
216 | - $localeItem = $localeManager->bootstrap( $sitecode, '', '', false ); |
|
217 | - $localeItem->setLanguageId( null ); |
|
218 | - $localeItem->setCurrencyId( null ); |
|
216 | + $localeItem = $localeManager->bootstrap($sitecode, '', '', false); |
|
217 | + $localeItem->setLanguageId(null); |
|
218 | + $localeItem->setCurrencyId(null); |
|
219 | 219 | } |
220 | - catch( \Aimeos\MShop\Locale\Exception $e ) |
|
220 | + catch (\Aimeos\MShop\Locale\Exception $e) |
|
221 | 221 | { |
222 | 222 | $localeItem = $localeManager->createItem(); |
223 | 223 | } |
224 | 224 | |
225 | - $context->setLocale( $localeItem ); |
|
226 | - $context->setI18n( $i18n->get( array( $lang ) ) ); |
|
225 | + $context->setLocale($localeItem); |
|
226 | + $context->setI18n($i18n->get(array($lang))); |
|
227 | 227 | |
228 | 228 | return $context; |
229 | 229 | } |
@@ -216,8 +216,7 @@ |
||
216 | 216 | $localeItem = $localeManager->bootstrap( $sitecode, '', '', false ); |
217 | 217 | $localeItem->setLanguageId( null ); |
218 | 218 | $localeItem->setCurrencyId( null ); |
219 | - } |
|
220 | - catch( \Aimeos\MShop\Locale\Exception $e ) |
|
219 | + } catch( \Aimeos\MShop\Locale\Exception $e ) |
|
221 | 220 | { |
222 | 221 | $localeItem = $localeManager->createItem(); |
223 | 222 | } |
@@ -32,36 +32,36 @@ discard block |
||
32 | 32 | * @param array $args Associative list of route parameters |
33 | 33 | * @return ResponseInterface $response Modified response object with generated output |
34 | 34 | */ |
35 | - public static function fileAction( ContainerInterface $container, ServerRequestInterface $request, ResponseInterface $response, array $args ) |
|
35 | + public static function fileAction(ContainerInterface $container, ServerRequestInterface $request, ResponseInterface $response, array $args) |
|
36 | 36 | { |
37 | 37 | $contents = ''; |
38 | 38 | $files = array(); |
39 | - $aimeos = $container->get( 'aimeos' ); |
|
40 | - $type = ( isset( $args['type'] ) ? $args['type'] : 'js' ); |
|
39 | + $aimeos = $container->get('aimeos'); |
|
40 | + $type = (isset($args['type']) ? $args['type'] : 'js'); |
|
41 | 41 | |
42 | - foreach( $aimeos->getCustomPaths( 'admin/jqadm' ) as $base => $paths ) |
|
42 | + foreach ($aimeos->getCustomPaths('admin/jqadm') as $base => $paths) |
|
43 | 43 | { |
44 | - foreach( $paths as $path ) |
|
44 | + foreach ($paths as $path) |
|
45 | 45 | { |
46 | - $jsbAbsPath = $base . '/' . $path; |
|
47 | - $jsb2 = new \Aimeos\MW\Jsb2\Standard( $jsbAbsPath, dirname( $jsbAbsPath ) ); |
|
48 | - $files = array_merge( $files, $jsb2->getFiles( $type ) ); |
|
46 | + $jsbAbsPath = $base.'/'.$path; |
|
47 | + $jsb2 = new \Aimeos\MW\Jsb2\Standard($jsbAbsPath, dirname($jsbAbsPath)); |
|
48 | + $files = array_merge($files, $jsb2->getFiles($type)); |
|
49 | 49 | } |
50 | 50 | } |
51 | 51 | |
52 | - foreach( $files as $file ) |
|
52 | + foreach ($files as $file) |
|
53 | 53 | { |
54 | - if( ( $content = file_get_contents( $file ) ) !== false ) { |
|
54 | + if (($content = file_get_contents($file)) !== false) { |
|
55 | 55 | $contents .= $content; |
56 | 56 | } |
57 | 57 | } |
58 | 58 | |
59 | - $response->getBody()->write( $contents ); |
|
59 | + $response->getBody()->write($contents); |
|
60 | 60 | |
61 | - if( $type === 'js' ) { |
|
62 | - $response = $response->withHeader( 'Content-Type', 'application/javascript' ); |
|
63 | - } elseif( $type === 'css' ) { |
|
64 | - $response = $response->withHeader( 'Content-Type', 'text/css' ); |
|
61 | + if ($type === 'js') { |
|
62 | + $response = $response->withHeader('Content-Type', 'application/javascript'); |
|
63 | + } elseif ($type === 'css') { |
|
64 | + $response = $response->withHeader('Content-Type', 'text/css'); |
|
65 | 65 | } |
66 | 66 | |
67 | 67 | return $response; |
@@ -77,10 +77,10 @@ discard block |
||
77 | 77 | * @param array $args Associative list of route parameters |
78 | 78 | * @return ResponseInterface $response Modified response object with generated output |
79 | 79 | */ |
80 | - public static function copyAction( ContainerInterface $container, ServerRequestInterface $request, ResponseInterface $response, array $args ) |
|
80 | + public static function copyAction(ContainerInterface $container, ServerRequestInterface $request, ResponseInterface $response, array $args) |
|
81 | 81 | { |
82 | - $cntl = self::createClient( $container, $request, $response, $args ); |
|
83 | - return self::getHtml( $container, $response, $cntl->copy() ); |
|
82 | + $cntl = self::createClient($container, $request, $response, $args); |
|
83 | + return self::getHtml($container, $response, $cntl->copy()); |
|
84 | 84 | } |
85 | 85 | |
86 | 86 | |
@@ -93,10 +93,10 @@ discard block |
||
93 | 93 | * @param array $args Associative list of route parameters |
94 | 94 | * @return ResponseInterface $response Modified response object with generated output |
95 | 95 | */ |
96 | - public static function createAction( ContainerInterface $container, ServerRequestInterface $request, ResponseInterface $response, array $args ) |
|
96 | + public static function createAction(ContainerInterface $container, ServerRequestInterface $request, ResponseInterface $response, array $args) |
|
97 | 97 | { |
98 | - $cntl = self::createClient( $container, $request, $response, $args ); |
|
99 | - return self::getHtml( $container, $response, $cntl->create() ); |
|
98 | + $cntl = self::createClient($container, $request, $response, $args); |
|
99 | + return self::getHtml($container, $response, $cntl->create()); |
|
100 | 100 | } |
101 | 101 | |
102 | 102 | |
@@ -109,10 +109,10 @@ discard block |
||
109 | 109 | * @param array $args Associative list of route parameters |
110 | 110 | * @return ResponseInterface $response Modified response object with generated output |
111 | 111 | */ |
112 | - public static function deleteAction( ContainerInterface $container, ServerRequestInterface $request, ResponseInterface $response, array $args ) |
|
112 | + public static function deleteAction(ContainerInterface $container, ServerRequestInterface $request, ResponseInterface $response, array $args) |
|
113 | 113 | { |
114 | - $cntl = self::createClient( $container, $request, $response, $args ); |
|
115 | - return self::getHtml( $container, $response, $cntl->delete() . $cntl->search() ); |
|
114 | + $cntl = self::createClient($container, $request, $response, $args); |
|
115 | + return self::getHtml($container, $response, $cntl->delete().$cntl->search()); |
|
116 | 116 | } |
117 | 117 | |
118 | 118 | |
@@ -125,10 +125,10 @@ discard block |
||
125 | 125 | * @param array $args Associative list of route parameters |
126 | 126 | * @return ResponseInterface $response Modified response object with generated output |
127 | 127 | */ |
128 | - public static function getAction( ContainerInterface $container, ServerRequestInterface $request, ResponseInterface $response, array $args ) |
|
128 | + public static function getAction(ContainerInterface $container, ServerRequestInterface $request, ResponseInterface $response, array $args) |
|
129 | 129 | { |
130 | - $cntl = self::createClient( $container, $request, $response, $args ); |
|
131 | - return self::getHtml( $container, $response, $cntl->get() ); |
|
130 | + $cntl = self::createClient($container, $request, $response, $args); |
|
131 | + return self::getHtml($container, $response, $cntl->get()); |
|
132 | 132 | } |
133 | 133 | |
134 | 134 | |
@@ -141,10 +141,10 @@ discard block |
||
141 | 141 | * @param array $args Associative list of route parameters |
142 | 142 | * @return ResponseInterface $response Modified response object with generated output |
143 | 143 | */ |
144 | - public static function saveAction( ContainerInterface $container, ServerRequestInterface $request, ResponseInterface $response, array $args ) |
|
144 | + public static function saveAction(ContainerInterface $container, ServerRequestInterface $request, ResponseInterface $response, array $args) |
|
145 | 145 | { |
146 | - $cntl = self::createClient( $container, $request, $response, $args ); |
|
147 | - return self::getHtml( $container, $response, ( $cntl->save() ? : $cntl->search() ) ); |
|
146 | + $cntl = self::createClient($container, $request, $response, $args); |
|
147 | + return self::getHtml($container, $response, ($cntl->save() ?: $cntl->search())); |
|
148 | 148 | } |
149 | 149 | |
150 | 150 | |
@@ -157,10 +157,10 @@ discard block |
||
157 | 157 | * @param array $args Associative list of route parameters |
158 | 158 | * @return ResponseInterface $response Modified response object with generated output |
159 | 159 | */ |
160 | - public static function searchAction( ContainerInterface $container, ServerRequestInterface $request, ResponseInterface $response, array $args ) |
|
160 | + public static function searchAction(ContainerInterface $container, ServerRequestInterface $request, ResponseInterface $response, array $args) |
|
161 | 161 | { |
162 | - $cntl = self::createClient( $container, $request, $response, $args ); |
|
163 | - return self::getHtml( $container, $response, $cntl->search() ); |
|
162 | + $cntl = self::createClient($container, $request, $response, $args); |
|
163 | + return self::getHtml($container, $response, $cntl->search()); |
|
164 | 164 | } |
165 | 165 | |
166 | 166 | |
@@ -173,21 +173,21 @@ discard block |
||
173 | 173 | * @param array $args Associative list of route parameters |
174 | 174 | * @return \Aimeos\Admin\JQAdm\Iface JQAdm client |
175 | 175 | */ |
176 | - protected static function createClient( ContainerInterface $container, ServerRequestInterface $request, ResponseInterface $response, array $args ) |
|
176 | + protected static function createClient(ContainerInterface $container, ServerRequestInterface $request, ResponseInterface $response, array $args) |
|
177 | 177 | { |
178 | - $resource = ( isset( $args['resource'] ) ? $args['resource'] : null ); |
|
179 | - $site = ( isset( $args['site'] ) ? $args['site'] : 'default' ); |
|
180 | - $lang = ( isset( $args['lang'] ) ? $args['lang'] : 'en' ); |
|
178 | + $resource = (isset($args['resource']) ? $args['resource'] : null); |
|
179 | + $site = (isset($args['site']) ? $args['site'] : 'default'); |
|
180 | + $lang = (isset($args['lang']) ? $args['lang'] : 'en'); |
|
181 | 181 | |
182 | - $templatePaths = $container->get( 'aimeos' )->getCustomPaths( 'admin/jqadm/templates' ); |
|
182 | + $templatePaths = $container->get('aimeos')->getCustomPaths('admin/jqadm/templates'); |
|
183 | 183 | |
184 | - $context = $container->get( 'aimeos_context' )->get( false, $args ); |
|
185 | - $context = self::setLocale( $container->get( 'aimeos_i18n' ), $context, $site, $lang ); |
|
184 | + $context = $container->get('aimeos_context')->get(false, $args); |
|
185 | + $context = self::setLocale($container->get('aimeos_i18n'), $context, $site, $lang); |
|
186 | 186 | |
187 | - $view = $container->get( 'aimeos_view' )->create( $request, $response, $args, $templatePaths, $lang ); |
|
188 | - $context->setView( $view ); |
|
187 | + $view = $container->get('aimeos_view')->create($request, $response, $args, $templatePaths, $lang); |
|
188 | + $context->setView($view); |
|
189 | 189 | |
190 | - return \Aimeos\Admin\JQAdm\Factory::createClient( $context, $templatePaths, $resource ); |
|
190 | + return \Aimeos\Admin\JQAdm\Factory::createClient($context, $templatePaths, $resource); |
|
191 | 191 | } |
192 | 192 | |
193 | 193 | |
@@ -199,12 +199,12 @@ discard block |
||
199 | 199 | * @param string $content Content from admin client |
200 | 200 | * @return \Illuminate\Contracts\View\View View for rendering the output |
201 | 201 | */ |
202 | - protected static function getHtml( ContainerInterface $container, ResponseInterface $response, $content ) |
|
202 | + protected static function getHtml(ContainerInterface $container, ResponseInterface $response, $content) |
|
203 | 203 | { |
204 | 204 | $version = \Aimeos\Slim\Bootstrap::getVersion(); |
205 | - $content = str_replace( array( '{type}', '{version}' ), array( 'Slim', $version ), $content ); |
|
205 | + $content = str_replace(array('{type}', '{version}'), array('Slim', $version), $content); |
|
206 | 206 | |
207 | - return $container->get( 'view' )->render( $response, 'Jqadm/index.html.twig', array( 'content' => $content ) ); |
|
207 | + return $container->get('view')->render($response, 'Jqadm/index.html.twig', array('content' => $content)); |
|
208 | 208 | } |
209 | 209 | |
210 | 210 | |
@@ -217,23 +217,23 @@ discard block |
||
217 | 217 | * @param string $lang ISO language code, e.g. "en" or "en_GB" |
218 | 218 | * @return \Aimeos\MShop\Context\Item\Iface Modified context object |
219 | 219 | */ |
220 | - protected static function setLocale( \Aimeos\Slim\Base\I18n $i18n, \Aimeos\MShop\Context\Item\Iface $context, $site, $lang ) |
|
220 | + protected static function setLocale(\Aimeos\Slim\Base\I18n $i18n, \Aimeos\MShop\Context\Item\Iface $context, $site, $lang) |
|
221 | 221 | { |
222 | - $localeManager = \Aimeos\MShop\Factory::createManager( $context, 'locale' ); |
|
222 | + $localeManager = \Aimeos\MShop\Factory::createManager($context, 'locale'); |
|
223 | 223 | |
224 | 224 | try |
225 | 225 | { |
226 | - $localeItem = $localeManager->bootstrap( $site, '', '', false ); |
|
227 | - $localeItem->setLanguageId( null ); |
|
228 | - $localeItem->setCurrencyId( null ); |
|
226 | + $localeItem = $localeManager->bootstrap($site, '', '', false); |
|
227 | + $localeItem->setLanguageId(null); |
|
228 | + $localeItem->setCurrencyId(null); |
|
229 | 229 | } |
230 | - catch( \Aimeos\MShop\Locale\Exception $e ) |
|
230 | + catch (\Aimeos\MShop\Locale\Exception $e) |
|
231 | 231 | { |
232 | 232 | $localeItem = $localeManager->createItem(); |
233 | 233 | } |
234 | 234 | |
235 | - $context->setLocale( $localeItem ); |
|
236 | - $context->setI18n( $i18n->get( array( $lang, 'en' ) ) ); |
|
235 | + $context->setLocale($localeItem); |
|
236 | + $context->setI18n($i18n->get(array($lang, 'en'))); |
|
237 | 237 | |
238 | 238 | return $context; |
239 | 239 | } |