@@ -26,11 +26,11 @@ discard block |
||
26 | 26 | /** |
27 | 27 | * Returns the HTML code for a copy of a resource object |
28 | 28 | * |
29 | - * @param Symfony\Component\HttpFoundation\Request $request Symfony request object |
|
29 | + * @param Request $request Symfony request object |
|
30 | 30 | * @param string $resource Resource location, e.g. "product" |
31 | 31 | * @param integer $id Unique resource ID |
32 | 32 | * @param string $site Unique site code |
33 | - * @return string Generated output |
|
33 | + * @return Response Generated output |
|
34 | 34 | */ |
35 | 35 | public function copyAction( Request $request, $resource, $id, $site = 'default' ) |
36 | 36 | { |
@@ -42,10 +42,10 @@ discard block |
||
42 | 42 | /** |
43 | 43 | * Returns the HTML code for a new resource object |
44 | 44 | * |
45 | - * @param Symfony\Component\HttpFoundation\Request $request Symfony request object |
|
45 | + * @param Request $request Symfony request object |
|
46 | 46 | * @param string $resource Resource location, e.g. "product" |
47 | 47 | * @param string $site Unique site code |
48 | - * @return string Generated output |
|
48 | + * @return Response Generated output |
|
49 | 49 | */ |
50 | 50 | public function createAction( Request $request, $resource, $site = 'default' ) |
51 | 51 | { |
@@ -57,11 +57,11 @@ discard block |
||
57 | 57 | /** |
58 | 58 | * Deletes the resource object or a list of resource objects |
59 | 59 | * |
60 | - * @param Symfony\Component\HttpFoundation\Request $request Symfony request object |
|
60 | + * @param Request $request Symfony request object |
|
61 | 61 | * @param string $resource Resource location, e.g. "product" |
62 | 62 | * @param integer $id Unique resource ID |
63 | 63 | * @param string $site Unique site code |
64 | - * @return string Generated output |
|
64 | + * @return Response Generated output |
|
65 | 65 | */ |
66 | 66 | public function deleteAction( Request $request, $resource, $id, $site = 'default' ) |
67 | 67 | { |
@@ -73,11 +73,11 @@ discard block |
||
73 | 73 | /** |
74 | 74 | * Returns the HTML code for the requested resource object |
75 | 75 | * |
76 | - * @param Symfony\Component\HttpFoundation\Request $request Symfony request object |
|
76 | + * @param Request $request Symfony request object |
|
77 | 77 | * @param string $resource Resource location, e.g. "product" |
78 | 78 | * @param integer $id Unique resource ID |
79 | 79 | * @param string $site Unique site code |
80 | - * @return string Generated output |
|
80 | + * @return Response Generated output |
|
81 | 81 | */ |
82 | 82 | public function getAction( Request $request, $resource, $id, $site = 'default' ) |
83 | 83 | { |
@@ -89,10 +89,10 @@ discard block |
||
89 | 89 | /** |
90 | 90 | * Saves a new resource object |
91 | 91 | * |
92 | - * @param Symfony\Component\HttpFoundation\Request $request Symfony request object |
|
92 | + * @param Request $request Symfony request object |
|
93 | 93 | * @param string $resource Resource location, e.g. "product" |
94 | 94 | * @param string $site Unique site code |
95 | - * @return string Generated output |
|
95 | + * @return Response Generated output |
|
96 | 96 | */ |
97 | 97 | public function saveAction( Request $request, $resource, $site = 'default' ) |
98 | 98 | { |
@@ -104,10 +104,10 @@ discard block |
||
104 | 104 | /** |
105 | 105 | * Returns the HTML code for a list of resource objects |
106 | 106 | * |
107 | - * @param Symfony\Component\HttpFoundation\Request $request Symfony request object |
|
107 | + * @param Request $request Symfony request object |
|
108 | 108 | * @param string $resource Resource location, e.g. "product" |
109 | 109 | * @param string $site Unique site code |
110 | - * @return string Generated output |
|
110 | + * @return Response Generated output |
|
111 | 111 | */ |
112 | 112 | public function searchAction( Request $request, $resource, $site = 'default' ) |
113 | 113 | { |
@@ -119,10 +119,10 @@ discard block |
||
119 | 119 | /** |
120 | 120 | * Returns the resource controller |
121 | 121 | * |
122 | - * @param Symfony\Component\HttpFoundation\Request $request Symfony request object |
|
122 | + * @param Request $request Symfony request object |
|
123 | 123 | * @param string $site Unique site code |
124 | 124 | * @param string $resource Resource location, e.g. "product" |
125 | - * @return \Aimeos\MShop\Context\Item\Iface Context item |
|
125 | + * @return \Aimeos\Admin\JQAdm\Iface Context item |
|
126 | 126 | */ |
127 | 127 | protected function createClient( Request $request, $site, $resource ) |
128 | 128 | { |
@@ -145,7 +145,7 @@ discard block |
||
145 | 145 | * Returns the generated HTML code |
146 | 146 | * |
147 | 147 | * @param string $content Content from admin client |
148 | - * @return \Illuminate\Contracts\View\View View for rendering the output |
|
148 | + * @return Response View for rendering the output |
|
149 | 149 | */ |
150 | 150 | protected function getHtml( $content ) |
151 | 151 | { |
@@ -32,10 +32,10 @@ discard block |
||
32 | 32 | * @param string $site Unique site code |
33 | 33 | * @return string Generated output |
34 | 34 | */ |
35 | - public function copyAction( Request $request, $resource, $id, $site = 'default' ) |
|
35 | + public function copyAction(Request $request, $resource, $id, $site = 'default') |
|
36 | 36 | { |
37 | - $cntl = $this->createClient( $request, $site, $resource ); |
|
38 | - return $this->getHtml( $cntl->copy() ); |
|
37 | + $cntl = $this->createClient($request, $site, $resource); |
|
38 | + return $this->getHtml($cntl->copy()); |
|
39 | 39 | } |
40 | 40 | |
41 | 41 | |
@@ -47,10 +47,10 @@ discard block |
||
47 | 47 | * @param string $site Unique site code |
48 | 48 | * @return string Generated output |
49 | 49 | */ |
50 | - public function createAction( Request $request, $resource, $site = 'default' ) |
|
50 | + public function createAction(Request $request, $resource, $site = 'default') |
|
51 | 51 | { |
52 | - $cntl = $this->createClient( $request, $site, $resource ); |
|
53 | - return $this->getHtml( $cntl->create() ); |
|
52 | + $cntl = $this->createClient($request, $site, $resource); |
|
53 | + return $this->getHtml($cntl->create()); |
|
54 | 54 | } |
55 | 55 | |
56 | 56 | |
@@ -63,10 +63,10 @@ discard block |
||
63 | 63 | * @param string $site Unique site code |
64 | 64 | * @return string Generated output |
65 | 65 | */ |
66 | - public function deleteAction( Request $request, $resource, $id, $site = 'default' ) |
|
66 | + public function deleteAction(Request $request, $resource, $id, $site = 'default') |
|
67 | 67 | { |
68 | - $cntl = $this->createClient( $request, $site, $resource ); |
|
69 | - return $this->getHtml( $cntl->delete() . $cntl->search() ); |
|
68 | + $cntl = $this->createClient($request, $site, $resource); |
|
69 | + return $this->getHtml($cntl->delete() . $cntl->search()); |
|
70 | 70 | } |
71 | 71 | |
72 | 72 | |
@@ -79,10 +79,10 @@ discard block |
||
79 | 79 | * @param string $site Unique site code |
80 | 80 | * @return string Generated output |
81 | 81 | */ |
82 | - public function getAction( Request $request, $resource, $id, $site = 'default' ) |
|
82 | + public function getAction(Request $request, $resource, $id, $site = 'default') |
|
83 | 83 | { |
84 | - $cntl = $this->createClient( $request, $site, $resource ); |
|
85 | - return $this->getHtml( $cntl->get() ); |
|
84 | + $cntl = $this->createClient($request, $site, $resource); |
|
85 | + return $this->getHtml($cntl->get()); |
|
86 | 86 | } |
87 | 87 | |
88 | 88 | |
@@ -94,10 +94,10 @@ discard block |
||
94 | 94 | * @param string $site Unique site code |
95 | 95 | * @return string Generated output |
96 | 96 | */ |
97 | - public function saveAction( Request $request, $resource, $site = 'default' ) |
|
97 | + public function saveAction(Request $request, $resource, $site = 'default') |
|
98 | 98 | { |
99 | - $cntl = $this->createClient( $request, $site, $resource ); |
|
100 | - return $this->getHtml( ( $cntl->save() ? : $cntl->search() ) ); |
|
99 | + $cntl = $this->createClient($request, $site, $resource); |
|
100 | + return $this->getHtml(($cntl->save() ?: $cntl->search())); |
|
101 | 101 | } |
102 | 102 | |
103 | 103 | |
@@ -109,10 +109,10 @@ discard block |
||
109 | 109 | * @param string $site Unique site code |
110 | 110 | * @return string Generated output |
111 | 111 | */ |
112 | - public function searchAction( Request $request, $resource, $site = 'default' ) |
|
112 | + public function searchAction(Request $request, $resource, $site = 'default') |
|
113 | 113 | { |
114 | - $cntl = $this->createClient( $request, $site, $resource ); |
|
115 | - return $this->getHtml( $cntl->search() ); |
|
114 | + $cntl = $this->createClient($request, $site, $resource); |
|
115 | + return $this->getHtml($cntl->search()); |
|
116 | 116 | } |
117 | 117 | |
118 | 118 | |
@@ -124,20 +124,20 @@ discard block |
||
124 | 124 | * @param string $resource Resource location, e.g. "product" |
125 | 125 | * @return \Aimeos\MShop\Context\Item\Iface Context item |
126 | 126 | */ |
127 | - protected function createClient( Request $request, $site, $resource ) |
|
127 | + protected function createClient(Request $request, $site, $resource) |
|
128 | 128 | { |
129 | - $lang = $request->get( 'lang', 'en' ); |
|
129 | + $lang = $request->get('lang', 'en'); |
|
130 | 130 | |
131 | - $aimeos = $this->get( 'aimeos' )->get(); |
|
132 | - $templatePaths = $aimeos->getCustomPaths( 'admin/jqadm/templates' ); |
|
131 | + $aimeos = $this->get('aimeos')->get(); |
|
132 | + $templatePaths = $aimeos->getCustomPaths('admin/jqadm/templates'); |
|
133 | 133 | |
134 | - $context = $this->get( 'aimeos_context' )->get( false ); |
|
135 | - $context = $this->setLocale( $context, $site, $lang ); |
|
134 | + $context = $this->get('aimeos_context')->get(false); |
|
135 | + $context = $this->setLocale($context, $site, $lang); |
|
136 | 136 | |
137 | - $view = $this->get( 'aimeos_view' )->create( $context->getConfig(), $templatePaths, $lang ); |
|
138 | - $context->setView( $view ); |
|
137 | + $view = $this->get('aimeos_view')->create($context->getConfig(), $templatePaths, $lang); |
|
138 | + $context->setView($view); |
|
139 | 139 | |
140 | - return \Aimeos\Admin\JQAdm\Factory::createClient( $context, $templatePaths, $resource ); |
|
140 | + return \Aimeos\Admin\JQAdm\Factory::createClient($context, $templatePaths, $resource); |
|
141 | 141 | } |
142 | 142 | |
143 | 143 | |
@@ -147,12 +147,12 @@ discard block |
||
147 | 147 | * @param string $content Content from admin client |
148 | 148 | * @return \Illuminate\Contracts\View\View View for rendering the output |
149 | 149 | */ |
150 | - protected function getHtml( $content ) |
|
150 | + protected function getHtml($content) |
|
151 | 151 | { |
152 | - $version = $this->get( 'aimeos' )->getVersion(); |
|
153 | - $content = str_replace( array( '{type}', '{version}' ), array( 'Symfony', $version ), $content ); |
|
152 | + $version = $this->get('aimeos')->getVersion(); |
|
153 | + $content = str_replace(array('{type}', '{version}'), array('Symfony', $version), $content); |
|
154 | 154 | |
155 | - return $this->render( 'AimeosShopBundle:Jqadm:index.html.twig', array( 'content' => $content ) ); |
|
155 | + return $this->render('AimeosShopBundle:Jqadm:index.html.twig', array('content' => $content)); |
|
156 | 156 | } |
157 | 157 | |
158 | 158 | |
@@ -164,23 +164,23 @@ discard block |
||
164 | 164 | * @param string $lang ISO language code, e.g. "en" or "en_GB" |
165 | 165 | * @return \Aimeos\MShop\Context\Item\Iface Modified context object |
166 | 166 | */ |
167 | - protected function setLocale( \Aimeos\MShop\Context\Item\Iface $context, $site = 'default', $lang = null ) |
|
167 | + protected function setLocale(\Aimeos\MShop\Context\Item\Iface $context, $site = 'default', $lang = null) |
|
168 | 168 | { |
169 | - $localeManager = \Aimeos\MShop\Factory::createManager( $context, 'locale' ); |
|
169 | + $localeManager = \Aimeos\MShop\Factory::createManager($context, 'locale'); |
|
170 | 170 | |
171 | 171 | try |
172 | 172 | { |
173 | - $localeItem = $localeManager->bootstrap( $site, '', '', false ); |
|
174 | - $localeItem->setLanguageId( null ); |
|
175 | - $localeItem->setCurrencyId( null ); |
|
173 | + $localeItem = $localeManager->bootstrap($site, '', '', false); |
|
174 | + $localeItem->setLanguageId(null); |
|
175 | + $localeItem->setCurrencyId(null); |
|
176 | 176 | } |
177 | - catch( \Aimeos\MShop\Locale\Exception $e ) |
|
177 | + catch (\Aimeos\MShop\Locale\Exception $e) |
|
178 | 178 | { |
179 | 179 | $localeItem = $localeManager->createItem(); |
180 | 180 | } |
181 | 181 | |
182 | - $context->setLocale( $localeItem ); |
|
183 | - $context->setI18n( $this->get( 'aimeos_i18n' )->get( array( $lang ) ) ); |
|
182 | + $context->setLocale($localeItem); |
|
183 | + $context->setI18n($this->get('aimeos_i18n')->get(array($lang))); |
|
184 | 184 | |
185 | 185 | return $context; |
186 | 186 | } |
@@ -172,7 +172,7 @@ |
||
172 | 172 | * @param string $content Body of the HTTP response |
173 | 173 | * @param integer $status HTTP status |
174 | 174 | * @param array $header List of HTTP headers |
175 | - * @return \Illuminate\Http\Response HTTP response object |
|
175 | + * @return Response HTTP response object |
|
176 | 176 | */ |
177 | 177 | protected function createResponse( $content, $status, array $header ) |
178 | 178 | { |
@@ -31,15 +31,15 @@ discard block |
||
31 | 31 | * @param string $site Unique site code |
32 | 32 | * @return \Symfony\Component\HttpFoundation\Response Response object containing the generated output |
33 | 33 | */ |
34 | - public function deleteAction( Request $request, $resource, $site = 'default' ) |
|
34 | + public function deleteAction(Request $request, $resource, $site = 'default') |
|
35 | 35 | { |
36 | 36 | $status = 500; |
37 | 37 | $header = $request->headers->all(); |
38 | 38 | |
39 | - $cntl = $this->createController( $site, $resource, $request->get( 'lang', 'en' ) ); |
|
40 | - $result = $cntl->delete( $request->getContent(), $header, $status ); |
|
39 | + $cntl = $this->createController($site, $resource, $request->get('lang', 'en')); |
|
40 | + $result = $cntl->delete($request->getContent(), $header, $status); |
|
41 | 41 | |
42 | - return $this->createResponse( $result, $status, $header ); |
|
42 | + return $this->createResponse($result, $status, $header); |
|
43 | 43 | } |
44 | 44 | |
45 | 45 | |
@@ -51,15 +51,15 @@ discard block |
||
51 | 51 | * @param string $site Unique site code |
52 | 52 | * @return \Symfony\Component\HttpFoundation\Response Response object containing the generated output |
53 | 53 | */ |
54 | - public function getAction( Request $request, $resource, $site = 'default' ) |
|
54 | + public function getAction(Request $request, $resource, $site = 'default') |
|
55 | 55 | { |
56 | 56 | $status = 500; |
57 | 57 | $header = $request->headers->all(); |
58 | 58 | |
59 | - $cntl = $this->createController( $site, $resource, $request->get( 'lang', 'en' ) ); |
|
60 | - $result = $cntl->get( $request->getContent(), $header, $status ); |
|
59 | + $cntl = $this->createController($site, $resource, $request->get('lang', 'en')); |
|
60 | + $result = $cntl->get($request->getContent(), $header, $status); |
|
61 | 61 | |
62 | - return $this->createResponse( $result, $status, $header ); |
|
62 | + return $this->createResponse($result, $status, $header); |
|
63 | 63 | } |
64 | 64 | |
65 | 65 | |
@@ -71,15 +71,15 @@ discard block |
||
71 | 71 | * @param string $site Unique site code |
72 | 72 | * @return \Symfony\Component\HttpFoundation\Response Response object containing the generated output |
73 | 73 | */ |
74 | - public function patchAction( Request $request, $resource, $site = 'default' ) |
|
74 | + public function patchAction(Request $request, $resource, $site = 'default') |
|
75 | 75 | { |
76 | 76 | $status = 500; |
77 | 77 | $header = $request->headers->all(); |
78 | 78 | |
79 | - $cntl = $this->createController( $site, $resource, $request->get( 'lang', 'en' ) ); |
|
80 | - $result = $cntl->patch( $request->getContent(), $header, $status ); |
|
79 | + $cntl = $this->createController($site, $resource, $request->get('lang', 'en')); |
|
80 | + $result = $cntl->patch($request->getContent(), $header, $status); |
|
81 | 81 | |
82 | - return $this->createResponse( $result, $status, $header ); |
|
82 | + return $this->createResponse($result, $status, $header); |
|
83 | 83 | } |
84 | 84 | |
85 | 85 | |
@@ -91,15 +91,15 @@ discard block |
||
91 | 91 | * @param string $site Unique site code |
92 | 92 | * @return \Symfony\Component\HttpFoundation\Response Response object containing the generated output |
93 | 93 | */ |
94 | - public function postAction( Request $request, $resource, $site = 'default' ) |
|
94 | + public function postAction(Request $request, $resource, $site = 'default') |
|
95 | 95 | { |
96 | 96 | $status = 500; |
97 | 97 | $header = $request->headers->all(); |
98 | 98 | |
99 | - $cntl = $this->createController( $site, $resource, $request->get( 'lang', 'en' ) ); |
|
100 | - $result = $cntl->post( $request->getContent(), $header, $status ); |
|
99 | + $cntl = $this->createController($site, $resource, $request->get('lang', 'en')); |
|
100 | + $result = $cntl->post($request->getContent(), $header, $status); |
|
101 | 101 | |
102 | - return $this->createResponse( $result, $status, $header ); |
|
102 | + return $this->createResponse($result, $status, $header); |
|
103 | 103 | } |
104 | 104 | |
105 | 105 | |
@@ -111,15 +111,15 @@ discard block |
||
111 | 111 | * @param string $site Unique site code |
112 | 112 | * @return \Symfony\Component\HttpFoundation\Response Response object containing the generated output |
113 | 113 | */ |
114 | - public function putAction( Request $request, $resource, $site = 'default' ) |
|
114 | + public function putAction(Request $request, $resource, $site = 'default') |
|
115 | 115 | { |
116 | 116 | $status = 500; |
117 | 117 | $header = $request->headers->all(); |
118 | 118 | |
119 | - $cntl = $this->createController( $site, $resource, $request->get( 'lang', 'en' ) ); |
|
120 | - $result = $cntl->put( $request->getContent(), $header, $status ); |
|
119 | + $cntl = $this->createController($site, $resource, $request->get('lang', 'en')); |
|
120 | + $result = $cntl->put($request->getContent(), $header, $status); |
|
121 | 121 | |
122 | - return $this->createResponse( $result, $status, $header ); |
|
122 | + return $this->createResponse($result, $status, $header); |
|
123 | 123 | } |
124 | 124 | |
125 | 125 | |
@@ -131,15 +131,15 @@ discard block |
||
131 | 131 | * @param string $site Unique site code |
132 | 132 | * @return \Symfony\Component\HttpFoundation\Response Response object containing the generated output |
133 | 133 | */ |
134 | - public function optionsAction( Request $request, $resource = '', $site = 'default' ) |
|
134 | + public function optionsAction(Request $request, $resource = '', $site = 'default') |
|
135 | 135 | { |
136 | 136 | $status = 500; |
137 | 137 | $header = $request->headers->all(); |
138 | 138 | |
139 | - $cntl = $this->createController( $site, $resource, $request->get( 'lang', 'en' ) ); |
|
140 | - $result = $cntl->options( $request->getContent(), $header, $status ); |
|
139 | + $cntl = $this->createController($site, $resource, $request->get('lang', 'en')); |
|
140 | + $result = $cntl->options($request->getContent(), $header, $status); |
|
141 | 141 | |
142 | - return $this->createResponse( $result, $status, $header ); |
|
142 | + return $this->createResponse($result, $status, $header); |
|
143 | 143 | } |
144 | 144 | |
145 | 145 | |
@@ -151,18 +151,18 @@ discard block |
||
151 | 151 | * @param string $lang Language code |
152 | 152 | * @return \Aimeos\MShop\Context\Item\Iface Context item |
153 | 153 | */ |
154 | - protected function createController( $site, $resource, $lang ) |
|
154 | + protected function createController($site, $resource, $lang) |
|
155 | 155 | { |
156 | - $aimeos = $this->get( 'aimeos' )->get(); |
|
157 | - $templatePaths = $aimeos->getCustomPaths( 'controller/jsonadm/templates' ); |
|
156 | + $aimeos = $this->get('aimeos')->get(); |
|
157 | + $templatePaths = $aimeos->getCustomPaths('controller/jsonadm/templates'); |
|
158 | 158 | |
159 | - $context = $this->get( 'aimeos_context' )->get( false ); |
|
160 | - $context = $this->setLocale( $context, $site, $lang ); |
|
159 | + $context = $this->get('aimeos_context')->get(false); |
|
160 | + $context = $this->setLocale($context, $site, $lang); |
|
161 | 161 | |
162 | - $view = $this->get('aimeos_view')->create( $context->getConfig(), $templatePaths, $lang ); |
|
163 | - $context->setView( $view ); |
|
162 | + $view = $this->get('aimeos_view')->create($context->getConfig(), $templatePaths, $lang); |
|
163 | + $context->setView($view); |
|
164 | 164 | |
165 | - return \Aimeos\Controller\JsonAdm\Factory::createController( $context, $templatePaths, $resource ); |
|
165 | + return \Aimeos\Controller\JsonAdm\Factory::createController($context, $templatePaths, $resource); |
|
166 | 166 | } |
167 | 167 | |
168 | 168 | |
@@ -174,14 +174,14 @@ discard block |
||
174 | 174 | * @param array $header List of HTTP headers |
175 | 175 | * @return \Illuminate\Http\Response HTTP response object |
176 | 176 | */ |
177 | - protected function createResponse( $content, $status, array $header ) |
|
177 | + protected function createResponse($content, $status, array $header) |
|
178 | 178 | { |
179 | 179 | $response = new Response(); |
180 | - $response->setContent( $content ); |
|
181 | - $response->setStatusCode( $status ); |
|
180 | + $response->setContent($content); |
|
181 | + $response->setStatusCode($status); |
|
182 | 182 | |
183 | - foreach( $header as $key => $value ) { |
|
184 | - $response->headers->set( $key, $value ); |
|
183 | + foreach ($header as $key => $value) { |
|
184 | + $response->headers->set($key, $value); |
|
185 | 185 | } |
186 | 186 | |
187 | 187 | return $response; |
@@ -196,23 +196,23 @@ discard block |
||
196 | 196 | * @param string $lang ISO language code, e.g. "en" or "en_GB" |
197 | 197 | * @return \Aimeos\MShop\Context\Item\Iface Modified context object |
198 | 198 | */ |
199 | - protected function setLocale( \Aimeos\MShop\Context\Item\Iface $context, $site, $lang ) |
|
199 | + protected function setLocale(\Aimeos\MShop\Context\Item\Iface $context, $site, $lang) |
|
200 | 200 | { |
201 | - $localeManager = \Aimeos\MShop\Factory::createManager( $context, 'locale' ); |
|
201 | + $localeManager = \Aimeos\MShop\Factory::createManager($context, 'locale'); |
|
202 | 202 | |
203 | 203 | try |
204 | 204 | { |
205 | - $localeItem = $localeManager->bootstrap( $site, '', '', false ); |
|
206 | - $localeItem->setLanguageId( null ); |
|
207 | - $localeItem->setCurrencyId( null ); |
|
205 | + $localeItem = $localeManager->bootstrap($site, '', '', false); |
|
206 | + $localeItem->setLanguageId(null); |
|
207 | + $localeItem->setCurrencyId(null); |
|
208 | 208 | } |
209 | - catch( \Aimeos\MShop\Locale\Exception $e ) |
|
209 | + catch (\Aimeos\MShop\Locale\Exception $e) |
|
210 | 210 | { |
211 | 211 | $localeItem = $localeManager->createItem(); |
212 | 212 | } |
213 | 213 | |
214 | - $context->setLocale( $localeItem ); |
|
215 | - $context->setI18n( $this->get('aimeos_i18n')->get( array( $lang ) ) ); |
|
214 | + $context->setLocale($localeItem); |
|
215 | + $context->setI18n($this->get('aimeos_i18n')->get(array($lang))); |
|
216 | 216 | |
217 | 217 | return $context; |
218 | 218 | } |
@@ -28,17 +28,17 @@ |
||
28 | 28 | * @param \Symfony\Component\HttpFoundation\Request $request Request object |
29 | 29 | * @return \Symfony\Component\HttpFoundation\Response HTML page for the admin interface |
30 | 30 | */ |
31 | - public function indexAction( Request $request ) |
|
31 | + public function indexAction(Request $request) |
|
32 | 32 | { |
33 | - if( $this->has( 'security.authorization_checker' ) && $this->get( 'security.token_storage' )->getToken() |
|
34 | - && $this->get( 'security.authorization_checker' )->isGranted( 'ROLE_ADMIN' ) |
|
35 | - || $this->has( 'security.context' ) && $this->get( 'security.context' )->getToken() |
|
36 | - && $this->get( 'security.context' )->isGranted( 'ROLE_ADMIN' ) |
|
33 | + if ($this->has('security.authorization_checker') && $this->get('security.token_storage')->getToken() |
|
34 | + && $this->get('security.authorization_checker')->isGranted('ROLE_ADMIN') |
|
35 | + || $this->has('security.context') && $this->get('security.context')->getToken() |
|
36 | + && $this->get('security.context')->isGranted('ROLE_ADMIN') |
|
37 | 37 | ) { |
38 | - $params = array( 'site' => 'default', 'resource' => 'product', 'lang' => 'en' ); |
|
39 | - return $this->redirect( $this->generateUrl( 'aimeos_shop_jqadm_search', $params ) ); |
|
38 | + $params = array('site' => 'default', 'resource' => 'product', 'lang' => 'en'); |
|
39 | + return $this->redirect($this->generateUrl('aimeos_shop_jqadm_search', $params)); |
|
40 | 40 | } |
41 | 41 | |
42 | - return $this->render( 'AimeosShopBundle:Admin:index.html.twig', array( 'email' => $request->get( 'email' ) ) ); |
|
42 | + return $this->render('AimeosShopBundle:Admin:index.html.twig', array('email' => $request->get('email'))); |
|
43 | 43 | } |
44 | 44 | } |
@@ -32,56 +32,56 @@ discard block |
||
32 | 32 | * @param integer $tab Number of the currently active tab |
33 | 33 | * @return \Symfony\Component\HttpFoundation\Response HTML page for the admin interface |
34 | 34 | */ |
35 | - public function indexAction( $site = 'default', $lang, $tab ) |
|
35 | + public function indexAction($site = 'default', $lang, $tab) |
|
36 | 36 | { |
37 | - $context = $this->get( 'aimeos_context' )->get( false ); |
|
38 | - $context = $this->setLocale( $context, $site, $lang ); |
|
37 | + $context = $this->get('aimeos_context')->get(false); |
|
38 | + $context = $this->setLocale($context, $site, $lang); |
|
39 | 39 | |
40 | - $aimeos = $this->get( 'aimeos' ); |
|
40 | + $aimeos = $this->get('aimeos'); |
|
41 | 41 | $bootstrap = $aimeos->get(); |
42 | 42 | |
43 | - $cntlPaths = $bootstrap->getCustomPaths( 'controller/extjs' ); |
|
44 | - $controller = new \Aimeos\Controller\ExtJS\JsonRpc( $context, $cntlPaths ); |
|
43 | + $cntlPaths = $bootstrap->getCustomPaths('controller/extjs'); |
|
44 | + $controller = new \Aimeos\Controller\ExtJS\JsonRpc($context, $cntlPaths); |
|
45 | 45 | $cssFiles = array(); |
46 | 46 | |
47 | - foreach( $bootstrap->getCustomPaths( 'admin/extjs' ) as $base => $paths ) |
|
47 | + foreach ($bootstrap->getCustomPaths('admin/extjs') as $base => $paths) |
|
48 | 48 | { |
49 | - foreach( $paths as $path ) |
|
49 | + foreach ($paths as $path) |
|
50 | 50 | { |
51 | 51 | $jsbAbsPath = $base . '/' . $path; |
52 | 52 | |
53 | - if( !is_file( $jsbAbsPath ) ) { |
|
54 | - throw new \Exception( sprintf( 'JSB2 file "%1$s" not found', $jsbAbsPath ) ); |
|
53 | + if (!is_file($jsbAbsPath)) { |
|
54 | + throw new \Exception(sprintf('JSB2 file "%1$s" not found', $jsbAbsPath)); |
|
55 | 55 | } |
56 | 56 | |
57 | - $jsb2 = new \Aimeos\MW\Jsb2\Standard( $jsbAbsPath, dirname( $path ) ); |
|
58 | - $cssFiles = array_merge( $cssFiles, $jsb2->getUrls( 'css' ) ); |
|
57 | + $jsb2 = new \Aimeos\MW\Jsb2\Standard($jsbAbsPath, dirname($path)); |
|
58 | + $cssFiles = array_merge($cssFiles, $jsb2->getUrls('css')); |
|
59 | 59 | } |
60 | 60 | } |
61 | 61 | |
62 | - $params = array( 'site' => '{site}', 'lang' => '{lang}', 'tab' => '{tab}' ); |
|
63 | - $adminUrl = $this->generateUrl( 'aimeos_shop_extadm', $params ); |
|
62 | + $params = array('site' => '{site}', 'lang' => '{lang}', 'tab' => '{tab}'); |
|
63 | + $adminUrl = $this->generateUrl('aimeos_shop_extadm', $params); |
|
64 | 64 | |
65 | - $token = $this->get( 'security.csrf.token_manager' )->getToken( 'aimeos_admin_token' )->getValue(); |
|
66 | - $jsonUrl = $this->generateUrl( 'aimeos_shop_extadm_json', array( '_token' => $token, 'site' => $site ) ); |
|
65 | + $token = $this->get('security.csrf.token_manager')->getToken('aimeos_admin_token')->getValue(); |
|
66 | + $jsonUrl = $this->generateUrl('aimeos_shop_extadm_json', array('_token' => $token, 'site' => $site)); |
|
67 | 67 | |
68 | 68 | $vars = array( |
69 | 69 | 'lang' => $lang, |
70 | 70 | 'cssFiles' => $cssFiles, |
71 | 71 | 'languages' => $this->getJsonLanguages(), |
72 | - 'config' => $this->getJsonClientConfig( $context ), |
|
73 | - 'site' => $this->getJsonSiteItem( $context, $site ), |
|
74 | - 'i18nContent' => $this->getJsonClientI18n( $bootstrap->getI18nPaths(), $lang ), |
|
72 | + 'config' => $this->getJsonClientConfig($context), |
|
73 | + 'site' => $this->getJsonSiteItem($context, $site), |
|
74 | + 'i18nContent' => $this->getJsonClientI18n($bootstrap->getI18nPaths(), $lang), |
|
75 | 75 | 'searchSchemas' => $controller->getJsonSearchSchemas(), |
76 | 76 | 'itemSchemas' => $controller->getJsonItemSchemas(), |
77 | - 'smd' => $controller->getJsonSmd( $jsonUrl ), |
|
78 | - 'urlTemplate' => urldecode( $adminUrl ), |
|
79 | - 'uploaddir' => $this->container->getParameter( 'aimeos_shop.uploaddir' ), |
|
77 | + 'smd' => $controller->getJsonSmd($jsonUrl), |
|
78 | + 'urlTemplate' => urldecode($adminUrl), |
|
79 | + 'uploaddir' => $this->container->getParameter('aimeos_shop.uploaddir'), |
|
80 | 80 | 'version' => $aimeos->getVersion(), |
81 | 81 | 'activeTab' => $tab, |
82 | 82 | ); |
83 | 83 | |
84 | - return $this->render( 'AimeosShopBundle:Extadm:index.html.twig', $vars ); |
|
84 | + return $this->render('AimeosShopBundle:Extadm:index.html.twig', $vars); |
|
85 | 85 | } |
86 | 86 | |
87 | 87 | |
@@ -91,22 +91,22 @@ discard block |
||
91 | 91 | * @param Symfony\Component\HttpFoundation\Request $request Symfony request object |
92 | 92 | * @return \Symfony\Component\HttpFoundation\Response 2.0 RPC message response |
93 | 93 | */ |
94 | - public function doAction( Request $request ) |
|
94 | + public function doAction(Request $request) |
|
95 | 95 | { |
96 | 96 | $csrfProvider = $this->get('security.csrf.token_manager'); |
97 | 97 | |
98 | - if( $csrfProvider->isTokenValid( new CsrfToken( 'aimeos_admin_token', $request->query->get( '_token' ) ) ) !== true ) { |
|
99 | - throw new \Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException( 'CSRF token is invalid' ); |
|
98 | + if ($csrfProvider->isTokenValid(new CsrfToken('aimeos_admin_token', $request->query->get('_token'))) !== true) { |
|
99 | + throw new \Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException('CSRF token is invalid'); |
|
100 | 100 | } |
101 | 101 | |
102 | - $cntlPaths = $this->get( 'aimeos' )->get()->getCustomPaths( 'controller/extjs' ); |
|
103 | - $context = $this->get( 'aimeos_context' )->get( false ); |
|
104 | - $context = $this->setLocale( $context ); |
|
102 | + $cntlPaths = $this->get('aimeos')->get()->getCustomPaths('controller/extjs'); |
|
103 | + $context = $this->get('aimeos_context')->get(false); |
|
104 | + $context = $this->setLocale($context); |
|
105 | 105 | |
106 | - $controller = new \Aimeos\Controller\ExtJS\JsonRpc( $context, $cntlPaths ); |
|
106 | + $controller = new \Aimeos\Controller\ExtJS\JsonRpc($context, $cntlPaths); |
|
107 | 107 | |
108 | - $response = $controller->process( $request->request->all(), 'php://input' ); |
|
109 | - return $this->render( 'AimeosShopBundle:Extadm:do.html.twig', array( 'output' => $response ) ); |
|
108 | + $response = $controller->process($request->request->all(), 'php://input'); |
|
109 | + return $this->render('AimeosShopBundle:Extadm:do.html.twig', array('output' => $response)); |
|
110 | 110 | } |
111 | 111 | |
112 | 112 | |
@@ -119,27 +119,27 @@ discard block |
||
119 | 119 | { |
120 | 120 | $contents = ''; |
121 | 121 | $jsFiles = array(); |
122 | - $aimeos = $this->get( 'aimeos' )->get(); |
|
122 | + $aimeos = $this->get('aimeos')->get(); |
|
123 | 123 | |
124 | - foreach( $aimeos->getCustomPaths( 'admin/extjs' ) as $base => $paths ) |
|
124 | + foreach ($aimeos->getCustomPaths('admin/extjs') as $base => $paths) |
|
125 | 125 | { |
126 | - foreach( $paths as $path ) |
|
126 | + foreach ($paths as $path) |
|
127 | 127 | { |
128 | 128 | $jsbAbsPath = $base . '/' . $path; |
129 | - $jsb2 = new \Aimeos\MW\Jsb2\Standard( $jsbAbsPath, dirname( $jsbAbsPath ) ); |
|
130 | - $jsFiles = array_merge( $jsFiles, $jsb2->getFiles( 'js' ) ); |
|
129 | + $jsb2 = new \Aimeos\MW\Jsb2\Standard($jsbAbsPath, dirname($jsbAbsPath)); |
|
130 | + $jsFiles = array_merge($jsFiles, $jsb2->getFiles('js')); |
|
131 | 131 | } |
132 | 132 | } |
133 | 133 | |
134 | - foreach( $jsFiles as $file ) |
|
134 | + foreach ($jsFiles as $file) |
|
135 | 135 | { |
136 | - if( ( $content = file_get_contents( $file ) ) !== false ) { |
|
136 | + if (($content = file_get_contents($file)) !== false) { |
|
137 | 137 | $contents .= $content; |
138 | 138 | } |
139 | 139 | } |
140 | 140 | |
141 | - $response = new Response( $contents ); |
|
142 | - $response->headers->set( 'Content-Type', 'application/javascript' ); |
|
141 | + $response = new Response($contents); |
|
142 | + $response->headers->set('Content-Type', 'application/javascript'); |
|
143 | 143 | |
144 | 144 | return $response; |
145 | 145 | } |
@@ -154,11 +154,11 @@ discard block |
||
154 | 154 | { |
155 | 155 | $result = array(); |
156 | 156 | |
157 | - foreach( $this->get( 'aimeos' )->get()->getI18nList( 'admin' ) as $id ) { |
|
158 | - $result[] = array( 'id' => $id, 'label' => $id ); |
|
157 | + foreach ($this->get('aimeos')->get()->getI18nList('admin') as $id) { |
|
158 | + $result[] = array('id' => $id, 'label' => $id); |
|
159 | 159 | } |
160 | 160 | |
161 | - return json_encode( $result ); |
|
161 | + return json_encode($result); |
|
162 | 162 | } |
163 | 163 | |
164 | 164 | |
@@ -168,10 +168,10 @@ discard block |
||
168 | 168 | * @param \Aimeos\MShop\Context\Item\Iface $context Context item object |
169 | 169 | * @return string JSON encoded configuration object |
170 | 170 | */ |
171 | - protected function getJsonClientConfig( \Aimeos\MShop\Context\Item\Iface $context ) |
|
171 | + protected function getJsonClientConfig(\Aimeos\MShop\Context\Item\Iface $context) |
|
172 | 172 | { |
173 | - $config = $context->getConfig()->get( 'admin/extjs', array() ); |
|
174 | - return json_encode( array( 'admin' => array( 'extjs' => $config ) ), JSON_FORCE_OBJECT ); |
|
173 | + $config = $context->getConfig()->get('admin/extjs', array()); |
|
174 | + return json_encode(array('admin' => array('extjs' => $config)), JSON_FORCE_OBJECT); |
|
175 | 175 | } |
176 | 176 | |
177 | 177 | |
@@ -182,16 +182,16 @@ discard block |
||
182 | 182 | * @param string $lang ISO language code like "en" or "en_GB" |
183 | 183 | * @return string JSON encoded translation object |
184 | 184 | */ |
185 | - protected function getJsonClientI18n( array $i18nPaths, $lang ) |
|
185 | + protected function getJsonClientI18n(array $i18nPaths, $lang) |
|
186 | 186 | { |
187 | - $i18n = new \Aimeos\MW\Translation\Zend2( $i18nPaths, 'gettext', $lang, array( 'disableNotices' => true ) ); |
|
187 | + $i18n = new \Aimeos\MW\Translation\Zend2($i18nPaths, 'gettext', $lang, array('disableNotices' => true)); |
|
188 | 188 | |
189 | 189 | $content = array( |
190 | - 'admin' => $i18n->getAll( 'admin' ), |
|
191 | - 'admin/ext' => $i18n->getAll( 'admin/ext' ), |
|
190 | + 'admin' => $i18n->getAll('admin'), |
|
191 | + 'admin/ext' => $i18n->getAll('admin/ext'), |
|
192 | 192 | ); |
193 | 193 | |
194 | - return json_encode( $content, JSON_FORCE_OBJECT ); |
|
194 | + return json_encode($content, JSON_FORCE_OBJECT); |
|
195 | 195 | } |
196 | 196 | |
197 | 197 | |
@@ -203,19 +203,19 @@ discard block |
||
203 | 203 | * @return string JSON encoded site item object |
204 | 204 | * @throws Exception If no site item was found for the code |
205 | 205 | */ |
206 | - protected function getJsonSiteItem( \Aimeos\MShop\Context\Item\Iface $context, $site ) |
|
206 | + protected function getJsonSiteItem(\Aimeos\MShop\Context\Item\Iface $context, $site) |
|
207 | 207 | { |
208 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'locale/site' ); |
|
208 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'locale/site'); |
|
209 | 209 | |
210 | 210 | $criteria = $manager->createSearch(); |
211 | - $criteria->setConditions( $criteria->compare( '==', 'locale.site.code', $site ) ); |
|
212 | - $items = $manager->searchItems( $criteria ); |
|
211 | + $criteria->setConditions($criteria->compare('==', 'locale.site.code', $site)); |
|
212 | + $items = $manager->searchItems($criteria); |
|
213 | 213 | |
214 | - if( ( $item = reset( $items ) ) === false ) { |
|
215 | - throw new \Exception( sprintf( 'No site found for code "%1$s"', $site ) ); |
|
214 | + if (($item = reset($items)) === false) { |
|
215 | + throw new \Exception(sprintf('No site found for code "%1$s"', $site)); |
|
216 | 216 | } |
217 | 217 | |
218 | - return json_encode( $item->toArray() ); |
|
218 | + return json_encode($item->toArray()); |
|
219 | 219 | } |
220 | 220 | |
221 | 221 | |
@@ -227,17 +227,17 @@ discard block |
||
227 | 227 | * @param string $locale ISO language code, e.g. "en" or "en_GB" |
228 | 228 | * @return \Aimeos\MShop\Context\Item\Iface Modified context object |
229 | 229 | */ |
230 | - protected function setLocale( \Aimeos\MShop\Context\Item\Iface $context, $sitecode = 'default', $locale = null ) |
|
230 | + protected function setLocale(\Aimeos\MShop\Context\Item\Iface $context, $sitecode = 'default', $locale = null) |
|
231 | 231 | { |
232 | - $localeManager = \Aimeos\MShop\Factory::createManager( $context, 'locale' ); |
|
232 | + $localeManager = \Aimeos\MShop\Factory::createManager($context, 'locale'); |
|
233 | 233 | |
234 | 234 | try { |
235 | - $localeItem = $localeManager->bootstrap( $sitecode, $locale, '', false ); |
|
236 | - } catch( \Aimeos\MShop\Locale\Exception $e ) { |
|
235 | + $localeItem = $localeManager->bootstrap($sitecode, $locale, '', false); |
|
236 | + } catch (\Aimeos\MShop\Locale\Exception $e) { |
|
237 | 237 | $localeItem = $localeManager->createItem(); |
238 | 238 | } |
239 | 239 | |
240 | - $context->setLocale( $localeItem ); |
|
240 | + $context->setLocale($localeItem); |
|
241 | 241 | |
242 | 242 | return $context; |
243 | 243 | } |