@@ -135,7 +135,7 @@ |
||
135 | 135 | * Creates a list of all available translations. |
136 | 136 | * |
137 | 137 | * @param \Aimeos\MShop\Context\Item\Iface $context Context object |
138 | - * @return array List of language IDs with labels |
|
138 | + * @return string List of language IDs with labels |
|
139 | 139 | */ |
140 | 140 | protected function getJsonLanguages( \Aimeos\MShop\Context\Item\Iface $context ) |
141 | 141 | { |
@@ -28,52 +28,52 @@ discard block |
||
28 | 28 | */ |
29 | 29 | public function indexAction() |
30 | 30 | { |
31 | - $this->authorize( 'admin' ); |
|
31 | + $this->authorize('admin'); |
|
32 | 32 | |
33 | - $site = \Input::get( 'site', 'default' ); |
|
34 | - $lang = \Input::get( 'lang', 'en' ); |
|
33 | + $site = \Input::get('site', 'default'); |
|
34 | + $lang = \Input::get('lang', 'en'); |
|
35 | 35 | |
36 | - $aimeos = app( '\Aimeos\Shop\Base\Aimeos' )->get(); |
|
37 | - $cntlPaths = $aimeos->getCustomPaths( 'controller/extjs' ); |
|
36 | + $aimeos = app('\Aimeos\Shop\Base\Aimeos')->get(); |
|
37 | + $cntlPaths = $aimeos->getCustomPaths('controller/extjs'); |
|
38 | 38 | |
39 | - $context = app( '\Aimeos\Shop\Base\Context' )->get( false ); |
|
40 | - $context = $this->setLocale( $context, $site, $lang ); |
|
39 | + $context = app('\Aimeos\Shop\Base\Context')->get(false); |
|
40 | + $context = $this->setLocale($context, $site, $lang); |
|
41 | 41 | |
42 | - $controller = new \Aimeos\Controller\ExtJS\JsonRpc( $context, $cntlPaths ); |
|
42 | + $controller = new \Aimeos\Controller\ExtJS\JsonRpc($context, $cntlPaths); |
|
43 | 43 | $cssFiles = array(); |
44 | 44 | |
45 | - foreach( $aimeos->getCustomPaths( 'client/extjs' ) as $base => $paths ) |
|
45 | + foreach ($aimeos->getCustomPaths('client/extjs') as $base => $paths) |
|
46 | 46 | { |
47 | - foreach( $paths as $path ) |
|
47 | + foreach ($paths as $path) |
|
48 | 48 | { |
49 | 49 | $jsbAbsPath = $base . '/' . $path; |
50 | 50 | |
51 | - if( !is_file( $jsbAbsPath ) ) { |
|
52 | - throw new \Exception( sprintf( 'JSB2 file "%1$s" not found', $jsbAbsPath ) ); |
|
51 | + if (!is_file($jsbAbsPath)) { |
|
52 | + throw new \Exception(sprintf('JSB2 file "%1$s" not found', $jsbAbsPath)); |
|
53 | 53 | } |
54 | 54 | |
55 | - $jsb2 = new \Aimeos\MW\Jsb2\Standard( $jsbAbsPath, dirname( $path ) ); |
|
56 | - $cssFiles = array_merge( $cssFiles, $jsb2->getUrls( 'css' ) ); |
|
55 | + $jsb2 = new \Aimeos\MW\Jsb2\Standard($jsbAbsPath, dirname($path)); |
|
56 | + $cssFiles = array_merge($cssFiles, $jsb2->getUrls('css')); |
|
57 | 57 | } |
58 | 58 | } |
59 | 59 | |
60 | - $params = array( 'site' => '{site}', 'lang' => '{lang}', 'tab' => '{tab}' ); |
|
61 | - $adminUrl = route( 'aimeos_shop_admin', $params ); |
|
62 | - $jsonUrl = route( 'aimeos_shop_admin_json', array( '_token' => csrf_token() ) ); |
|
60 | + $params = array('site' => '{site}', 'lang' => '{lang}', 'tab' => '{tab}'); |
|
61 | + $adminUrl = route('aimeos_shop_admin', $params); |
|
62 | + $jsonUrl = route('aimeos_shop_admin_json', array('_token' => csrf_token())); |
|
63 | 63 | |
64 | 64 | $vars = array( |
65 | 65 | 'lang' => $lang, |
66 | 66 | 'cssFiles' => $cssFiles, |
67 | - 'languages' => $this->getJsonLanguages( $context), |
|
68 | - 'config' => $this->getJsonClientConfig( $context ), |
|
69 | - 'site' => $this->getJsonSiteItem( $context, \Input::get( 'site', 'default' ) ), |
|
70 | - 'i18nContent' => $this->getJsonClientI18n( $aimeos->getI18nPaths(), $lang ), |
|
67 | + 'languages' => $this->getJsonLanguages($context), |
|
68 | + 'config' => $this->getJsonClientConfig($context), |
|
69 | + 'site' => $this->getJsonSiteItem($context, \Input::get('site', 'default')), |
|
70 | + 'i18nContent' => $this->getJsonClientI18n($aimeos->getI18nPaths(), $lang), |
|
71 | 71 | 'searchSchemas' => $controller->getJsonSearchSchemas(), |
72 | 72 | 'itemSchemas' => $controller->getJsonItemSchemas(), |
73 | - 'smd' => $controller->getJsonSmd( $jsonUrl ), |
|
74 | - 'urlTemplate' => urldecode( $adminUrl ), |
|
75 | - 'uploaddir' => \Config::get( 'shop::uploaddir' ), |
|
76 | - 'activeTab' => \Input::get( 'tab', 0 ), |
|
73 | + 'smd' => $controller->getJsonSmd($jsonUrl), |
|
74 | + 'urlTemplate' => urldecode($adminUrl), |
|
75 | + 'uploaddir' => \Config::get('shop::uploaddir'), |
|
76 | + 'activeTab' => \Input::get('tab', 0), |
|
77 | 77 | 'version' => $this->getVersion(), |
78 | 78 | ); |
79 | 79 | |
@@ -88,18 +88,18 @@ discard block |
||
88 | 88 | */ |
89 | 89 | public function doAction() |
90 | 90 | { |
91 | - $this->authorize( 'admin' ); |
|
91 | + $this->authorize('admin'); |
|
92 | 92 | |
93 | - $aimeos = app( '\Aimeos\Shop\Base\Aimeos' )->get(); |
|
94 | - $cntlPaths = $aimeos->getCustomPaths( 'controller/extjs' ); |
|
93 | + $aimeos = app('\Aimeos\Shop\Base\Aimeos')->get(); |
|
94 | + $cntlPaths = $aimeos->getCustomPaths('controller/extjs'); |
|
95 | 95 | |
96 | - $context = app( '\Aimeos\Shop\Base\Context' )->get( false ); |
|
97 | - $context = $this->setLocale( $context ); |
|
96 | + $context = app('\Aimeos\Shop\Base\Context')->get(false); |
|
97 | + $context = $this->setLocale($context); |
|
98 | 98 | |
99 | - $controller = new \Aimeos\Controller\ExtJS\JsonRpc( $context, $cntlPaths ); |
|
99 | + $controller = new \Aimeos\Controller\ExtJS\JsonRpc($context, $cntlPaths); |
|
100 | 100 | |
101 | - $response = $controller->process( \Input::instance()->request->all(), 'php://input' ); |
|
102 | - return \View::make('shop::admin.do', array( 'output' => $response )); |
|
101 | + $response = $controller->process(\Input::instance()->request->all(), 'php://input'); |
|
102 | + return \View::make('shop::admin.do', array('output' => $response)); |
|
103 | 103 | } |
104 | 104 | |
105 | 105 | |
@@ -110,30 +110,30 @@ discard block |
||
110 | 110 | */ |
111 | 111 | public function fileAction() |
112 | 112 | { |
113 | - $this->authorize( 'admin' ); |
|
113 | + $this->authorize('admin'); |
|
114 | 114 | |
115 | 115 | $contents = ''; |
116 | 116 | $jsFiles = array(); |
117 | - $aimeos = app( '\Aimeos\Shop\Base\Aimeos' )->get(); |
|
117 | + $aimeos = app('\Aimeos\Shop\Base\Aimeos')->get(); |
|
118 | 118 | |
119 | - foreach( $aimeos->getCustomPaths( 'client/extjs' ) as $base => $paths ) |
|
119 | + foreach ($aimeos->getCustomPaths('client/extjs') as $base => $paths) |
|
120 | 120 | { |
121 | - foreach( $paths as $path ) |
|
121 | + foreach ($paths as $path) |
|
122 | 122 | { |
123 | 123 | $jsbAbsPath = $base . '/' . $path; |
124 | - $jsb2 = new \Aimeos\MW\Jsb2\Standard( $jsbAbsPath, dirname( $jsbAbsPath ) ); |
|
125 | - $jsFiles = array_merge( $jsFiles, $jsb2->getUrls( 'js', '' ) ); |
|
124 | + $jsb2 = new \Aimeos\MW\Jsb2\Standard($jsbAbsPath, dirname($jsbAbsPath)); |
|
125 | + $jsFiles = array_merge($jsFiles, $jsb2->getUrls('js', '')); |
|
126 | 126 | } |
127 | 127 | } |
128 | 128 | |
129 | - foreach( $jsFiles as $file ) |
|
129 | + foreach ($jsFiles as $file) |
|
130 | 130 | { |
131 | - if( ( $content = file_get_contents( $file ) ) !== false ) { |
|
131 | + if (($content = file_get_contents($file)) !== false) { |
|
132 | 132 | $contents .= $content; |
133 | 133 | } |
134 | 134 | } |
135 | 135 | |
136 | - return response( $contents )->header( 'Content-Type', 'application/javascript' ); |
|
136 | + return response($contents)->header('Content-Type', 'application/javascript'); |
|
137 | 137 | } |
138 | 138 | |
139 | 139 | |
@@ -143,30 +143,30 @@ discard block |
||
143 | 143 | * @param \Aimeos\MShop\Context\Item\Iface $context Context object |
144 | 144 | * @return array List of language IDs with labels |
145 | 145 | */ |
146 | - protected function getJsonLanguages( \Aimeos\MShop\Context\Item\Iface $context ) |
|
146 | + protected function getJsonLanguages(\Aimeos\MShop\Context\Item\Iface $context) |
|
147 | 147 | { |
148 | - $paths = app( '\Aimeos\Shop\Base\Aimeos' )->get()->getI18nPaths(); |
|
148 | + $paths = app('\Aimeos\Shop\Base\Aimeos')->get()->getI18nPaths(); |
|
149 | 149 | $langs = array(); |
150 | 150 | |
151 | - if( !isset( $paths['client/extjs'] ) ) { |
|
152 | - return json_encode( array() ); |
|
151 | + if (!isset($paths['client/extjs'])) { |
|
152 | + return json_encode(array()); |
|
153 | 153 | } |
154 | 154 | |
155 | - foreach( $paths['client/extjs'] as $path ) |
|
155 | + foreach ($paths['client/extjs'] as $path) |
|
156 | 156 | { |
157 | - $iter = new \DirectoryIterator( $path ); |
|
157 | + $iter = new \DirectoryIterator($path); |
|
158 | 158 | |
159 | - foreach( $iter as $file ) |
|
159 | + foreach ($iter as $file) |
|
160 | 160 | { |
161 | 161 | $name = $file->getFilename(); |
162 | 162 | |
163 | - if( preg_match('/^[a-z]{2,3}(_[A-Z]{2})?$/', $name ) ) { |
|
163 | + if (preg_match('/^[a-z]{2,3}(_[A-Z]{2})?$/', $name)) { |
|
164 | 164 | $langs[$name] = null; |
165 | 165 | } |
166 | 166 | } |
167 | 167 | } |
168 | 168 | |
169 | - return json_encode( $this->getLanguages( $context, array_keys( $langs ) ) ); |
|
169 | + return json_encode($this->getLanguages($context, array_keys($langs))); |
|
170 | 170 | } |
171 | 171 | |
172 | 172 | |
@@ -176,10 +176,10 @@ discard block |
||
176 | 176 | * @param \Aimeos\MShop\Context\Item\Iface $context Context item object |
177 | 177 | * @return string JSON encoded configuration object |
178 | 178 | */ |
179 | - protected function getJsonClientConfig( \Aimeos\MShop\Context\Item\Iface $context ) |
|
179 | + protected function getJsonClientConfig(\Aimeos\MShop\Context\Item\Iface $context) |
|
180 | 180 | { |
181 | - $config = $context->getConfig()->get( 'client/extjs', array() ); |
|
182 | - return json_encode( array( 'client' => array( 'extjs' => $config ) ), JSON_FORCE_OBJECT ); |
|
181 | + $config = $context->getConfig()->get('client/extjs', array()); |
|
182 | + return json_encode(array('client' => array('extjs' => $config)), JSON_FORCE_OBJECT); |
|
183 | 183 | } |
184 | 184 | |
185 | 185 | |
@@ -190,16 +190,16 @@ discard block |
||
190 | 190 | * @param string $lang ISO language code like "en" or "en_GB" |
191 | 191 | * @return string JSON encoded translation object |
192 | 192 | */ |
193 | - protected function getJsonClientI18n( array $i18nPaths, $lang ) |
|
193 | + protected function getJsonClientI18n(array $i18nPaths, $lang) |
|
194 | 194 | { |
195 | - $i18n = new \Aimeos\MW\Translation\Zend2( $i18nPaths, 'gettext', $lang, array( 'disableNotices' => true ) ); |
|
195 | + $i18n = new \Aimeos\MW\Translation\Zend2($i18nPaths, 'gettext', $lang, array('disableNotices' => true)); |
|
196 | 196 | |
197 | 197 | $content = array( |
198 | - 'client/extjs' => $i18n->getAll( 'client/extjs' ), |
|
199 | - 'client/extjs/ext' => $i18n->getAll( 'client/extjs/ext' ), |
|
198 | + 'client/extjs' => $i18n->getAll('client/extjs'), |
|
199 | + 'client/extjs/ext' => $i18n->getAll('client/extjs/ext'), |
|
200 | 200 | ); |
201 | 201 | |
202 | - return json_encode( $content, JSON_FORCE_OBJECT ); |
|
202 | + return json_encode($content, JSON_FORCE_OBJECT); |
|
203 | 203 | } |
204 | 204 | |
205 | 205 | |
@@ -211,19 +211,19 @@ discard block |
||
211 | 211 | * @return string JSON encoded site item object |
212 | 212 | * @throws Exception If no site item was found for the code |
213 | 213 | */ |
214 | - protected function getJsonSiteItem( \Aimeos\MShop\Context\Item\Iface $context, $site ) |
|
214 | + protected function getJsonSiteItem(\Aimeos\MShop\Context\Item\Iface $context, $site) |
|
215 | 215 | { |
216 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'locale/site' ); |
|
216 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'locale/site'); |
|
217 | 217 | |
218 | 218 | $criteria = $manager->createSearch(); |
219 | - $criteria->setConditions( $criteria->compare( '==', 'locale.site.code', $site ) ); |
|
220 | - $items = $manager->searchItems( $criteria ); |
|
219 | + $criteria->setConditions($criteria->compare('==', 'locale.site.code', $site)); |
|
220 | + $items = $manager->searchItems($criteria); |
|
221 | 221 | |
222 | - if( ( $item = reset( $items ) ) === false ) { |
|
223 | - throw new \Exception( sprintf( 'No site found for code "%1$s"', $site ) ); |
|
222 | + if (($item = reset($items)) === false) { |
|
223 | + throw new \Exception(sprintf('No site found for code "%1$s"', $site)); |
|
224 | 224 | } |
225 | 225 | |
226 | - return json_encode( $item->toArray() ); |
|
226 | + return json_encode($item->toArray()); |
|
227 | 227 | } |
228 | 228 | |
229 | 229 | |
@@ -234,18 +234,18 @@ discard block |
||
234 | 234 | * @param array $langIds List of language IDs |
235 | 235 | * @return array List of associative lists with "id" and "label" as keys |
236 | 236 | */ |
237 | - protected function getLanguages( \Aimeos\MShop\Context\Item\Iface $context, array $langIds ) |
|
237 | + protected function getLanguages(\Aimeos\MShop\Context\Item\Iface $context, array $langIds) |
|
238 | 238 | { |
239 | - $languageManager = \Aimeos\MShop\Factory::createManager( $context, 'locale/language' ); |
|
239 | + $languageManager = \Aimeos\MShop\Factory::createManager($context, 'locale/language'); |
|
240 | 240 | $result = array(); |
241 | 241 | |
242 | 242 | $search = $languageManager->createSearch(); |
243 | - $search->setConditions( $search->compare('==', 'locale.language.id', $langIds ) ); |
|
244 | - $search->setSortations( array( $search->sort( '-', 'locale.language.status' ), $search->sort( '+', 'locale.language.label' ) ) ); |
|
245 | - $langItems = $languageManager->searchItems( $search ); |
|
243 | + $search->setConditions($search->compare('==', 'locale.language.id', $langIds)); |
|
244 | + $search->setSortations(array($search->sort('-', 'locale.language.status'), $search->sort('+', 'locale.language.label'))); |
|
245 | + $langItems = $languageManager->searchItems($search); |
|
246 | 246 | |
247 | - foreach( $langItems as $id => $item ) { |
|
248 | - $result[] = array( 'id' => $id, 'label' => $item->getLabel() ); |
|
247 | + foreach ($langItems as $id => $item) { |
|
248 | + $result[] = array('id' => $id, 'label' => $item->getLabel()); |
|
249 | 249 | } |
250 | 250 | |
251 | 251 | return $result; |
@@ -259,12 +259,12 @@ discard block |
||
259 | 259 | */ |
260 | 260 | protected function getVersion() |
261 | 261 | { |
262 | - if( ( $content = @file_get_contents( base_path( 'composer.lock' ) ) ) !== false |
|
263 | - && ( $content = json_decode( $content, true ) ) !== null && isset( $content['packages'] ) |
|
262 | + if (($content = @file_get_contents(base_path('composer.lock'))) !== false |
|
263 | + && ($content = json_decode($content, true)) !== null && isset($content['packages']) |
|
264 | 264 | ) { |
265 | - foreach( (array) $content['packages'] as $item ) |
|
265 | + foreach ((array) $content['packages'] as $item) |
|
266 | 266 | { |
267 | - if( $item['name'] === 'aimeos/aimeos-laravel' ) { |
|
267 | + if ($item['name'] === 'aimeos/aimeos-laravel') { |
|
268 | 268 | return $item['version']; |
269 | 269 | } |
270 | 270 | } |
@@ -282,17 +282,17 @@ discard block |
||
282 | 282 | * @param string $locale ISO language code, e.g. "en" or "en_GB" |
283 | 283 | * @return \Aimeos\MShop\Context\Item\Iface Modified context object |
284 | 284 | */ |
285 | - protected function setLocale( \Aimeos\MShop\Context\Item\Iface $context, $sitecode = 'default', $locale = null ) |
|
285 | + protected function setLocale(\Aimeos\MShop\Context\Item\Iface $context, $sitecode = 'default', $locale = null) |
|
286 | 286 | { |
287 | - $localeManager = \Aimeos\MShop\Factory::createManager( $context, 'locale' ); |
|
287 | + $localeManager = \Aimeos\MShop\Factory::createManager($context, 'locale'); |
|
288 | 288 | |
289 | 289 | try { |
290 | - $localeItem = $localeManager->bootstrap( $sitecode, $locale, '', false ); |
|
291 | - } catch( \Aimeos\MShop\Locale\Exception $e ) { |
|
290 | + $localeItem = $localeManager->bootstrap($sitecode, $locale, '', false); |
|
291 | + } catch (\Aimeos\MShop\Locale\Exception $e) { |
|
292 | 292 | $localeItem = $localeManager->createItem(); |
293 | 293 | } |
294 | 294 | |
295 | - $context->setLocale( $localeItem ); |
|
295 | + $context->setLocale($localeItem); |
|
296 | 296 | |
297 | 297 | return $context; |
298 | 298 | } |
@@ -27,7 +27,6 @@ discard block |
||
27 | 27 | * |
28 | 28 | * @param \Illuminate\Http\Request $request Request object |
29 | 29 | * @param string Resource location, e.g. "product/stock/wareshouse" |
30 | - * @param string $sitecode Unique site code |
|
31 | 30 | * @param integer|null $id Unique resource ID |
32 | 31 | * @return \Illuminate\Http\Response Response object containing the generated output |
33 | 32 | */ |
@@ -48,7 +47,6 @@ discard block |
||
48 | 47 | * |
49 | 48 | * @param \Illuminate\Http\Request $request Request object |
50 | 49 | * @param string Resource location, e.g. "product/stock/wareshouse" |
51 | - * @param string $sitecode Unique site code |
|
52 | 50 | * @param integer|null $id Unique resource ID |
53 | 51 | * @return \Illuminate\Http\Response Response object containing the generated output |
54 | 52 | */ |
@@ -69,7 +67,6 @@ discard block |
||
69 | 67 | * |
70 | 68 | * @param \Illuminate\Http\Request $request Request object |
71 | 69 | * @param string Resource location, e.g. "product/stock/wareshouse" |
72 | - * @param string $sitecode Unique site code |
|
73 | 70 | * @param integer|null $id Unique resource ID |
74 | 71 | * @return \Illuminate\Http\Response Response object containing the generated output |
75 | 72 | */ |
@@ -90,7 +87,6 @@ discard block |
||
90 | 87 | * |
91 | 88 | * @param \Illuminate\Http\Request $request Request object |
92 | 89 | * @param string Resource location, e.g. "product/stock/wareshouse" |
93 | - * @param string $sitecode Unique site code |
|
94 | 90 | * @param integer $id Unique ID of the resource |
95 | 91 | * @return \Illuminate\Http\Response Response object containing the generated output |
96 | 92 | */ |
@@ -111,7 +107,6 @@ discard block |
||
111 | 107 | * |
112 | 108 | * @param \Illuminate\Http\Request $request Request object |
113 | 109 | * @param string Resource location, e.g. "product/stock/wareshouse" |
114 | - * @param string $sitecode Unique site code |
|
115 | 110 | * @param integer|null $id Unique resource ID |
116 | 111 | * @return \Illuminate\Http\Response Response object containing the generated output |
117 | 112 | */ |
@@ -132,7 +127,6 @@ discard block |
||
132 | 127 | * |
133 | 128 | * @param \Illuminate\Http\Request $request Request object |
134 | 129 | * @param string Resource location, e.g. "product/stock/wareshouse" |
135 | - * @param string $sitecode Unique site code |
|
136 | 130 | * @return \Illuminate\Http\Response Response object containing the generated output |
137 | 131 | */ |
138 | 132 | public function optionsAction( Request $request, $site = 'default', $resource = '' ) |
@@ -207,8 +207,7 @@ |
||
207 | 207 | $localeItem = $localeManager->bootstrap( $sitecode, '', '', false ); |
208 | 208 | $localeItem->setLanguageId( null ); |
209 | 209 | $localeItem->setCurrencyId( null ); |
210 | - } |
|
211 | - catch( \Aimeos\MShop\Locale\Exception $e ) |
|
210 | + } catch( \Aimeos\MShop\Locale\Exception $e ) |
|
212 | 211 | { |
213 | 212 | $localeItem = $localeManager->createItem(); |
214 | 213 | } |
@@ -31,17 +31,17 @@ discard block |
||
31 | 31 | * @param integer|null $id Unique resource ID |
32 | 32 | * @return \Illuminate\Http\Response Response object containing the generated output |
33 | 33 | */ |
34 | - public function deleteAction( Request $request, $site = 'default', $resource, $id = null ) |
|
34 | + public function deleteAction(Request $request, $site = 'default', $resource, $id = null) |
|
35 | 35 | { |
36 | - $this->authorize( 'admin' ); |
|
36 | + $this->authorize('admin'); |
|
37 | 37 | |
38 | 38 | $status = 500; |
39 | 39 | $header = $request->headers->all(); |
40 | 40 | |
41 | - $cntl = $this->createController( $site, $resource ); |
|
42 | - $result = $cntl->delete( $request->getContent(), $header, $status ); |
|
41 | + $cntl = $this->createController($site, $resource); |
|
42 | + $result = $cntl->delete($request->getContent(), $header, $status); |
|
43 | 43 | |
44 | - return $this->createResponse( $result, $status, $header ); |
|
44 | + return $this->createResponse($result, $status, $header); |
|
45 | 45 | } |
46 | 46 | |
47 | 47 | |
@@ -54,17 +54,17 @@ discard block |
||
54 | 54 | * @param integer|null $id Unique resource ID |
55 | 55 | * @return \Illuminate\Http\Response Response object containing the generated output |
56 | 56 | */ |
57 | - public function getAction( Request $request, $site = 'default', $resource, $id = null ) |
|
57 | + public function getAction(Request $request, $site = 'default', $resource, $id = null) |
|
58 | 58 | { |
59 | - $this->authorize( 'admin' ); |
|
59 | + $this->authorize('admin'); |
|
60 | 60 | |
61 | 61 | $status = 500; |
62 | 62 | $header = $request->headers->all(); |
63 | 63 | |
64 | - $cntl = $this->createController( $site, $resource ); |
|
65 | - $result = $cntl->get( $request->getContent(), $header, $status ); |
|
64 | + $cntl = $this->createController($site, $resource); |
|
65 | + $result = $cntl->get($request->getContent(), $header, $status); |
|
66 | 66 | |
67 | - return $this->createResponse( $result, $status, $header ); |
|
67 | + return $this->createResponse($result, $status, $header); |
|
68 | 68 | } |
69 | 69 | |
70 | 70 | |
@@ -77,17 +77,17 @@ discard block |
||
77 | 77 | * @param integer|null $id Unique resource ID |
78 | 78 | * @return \Illuminate\Http\Response Response object containing the generated output |
79 | 79 | */ |
80 | - public function patchAction( Request $request, $site = 'default', $resource, $id = null ) |
|
80 | + public function patchAction(Request $request, $site = 'default', $resource, $id = null) |
|
81 | 81 | { |
82 | - $this->authorize( 'admin' ); |
|
82 | + $this->authorize('admin'); |
|
83 | 83 | |
84 | 84 | $status = 500; |
85 | 85 | $header = $request->headers->all(); |
86 | 86 | |
87 | - $cntl = $this->createController( $site, $resource ); |
|
88 | - $result = $cntl->patch( $request->getContent(), $header, $status ); |
|
87 | + $cntl = $this->createController($site, $resource); |
|
88 | + $result = $cntl->patch($request->getContent(), $header, $status); |
|
89 | 89 | |
90 | - return $this->createResponse( $result, $status, $header ); |
|
90 | + return $this->createResponse($result, $status, $header); |
|
91 | 91 | } |
92 | 92 | |
93 | 93 | |
@@ -100,17 +100,17 @@ discard block |
||
100 | 100 | * @param integer $id Unique ID of the resource |
101 | 101 | * @return \Illuminate\Http\Response Response object containing the generated output |
102 | 102 | */ |
103 | - public function postAction( Request $request, $site = 'default', $resource, $id = null ) |
|
103 | + public function postAction(Request $request, $site = 'default', $resource, $id = null) |
|
104 | 104 | { |
105 | - $this->authorize( 'admin' ); |
|
105 | + $this->authorize('admin'); |
|
106 | 106 | |
107 | 107 | $status = 500; |
108 | 108 | $header = $request->headers->all(); |
109 | 109 | |
110 | - $cntl = $this->createController( $site, $resource ); |
|
111 | - $result = $cntl->post( $request->getContent(), $header, $status ); |
|
110 | + $cntl = $this->createController($site, $resource); |
|
111 | + $result = $cntl->post($request->getContent(), $header, $status); |
|
112 | 112 | |
113 | - return $this->createResponse( $result, $status, $header ); |
|
113 | + return $this->createResponse($result, $status, $header); |
|
114 | 114 | } |
115 | 115 | |
116 | 116 | |
@@ -123,17 +123,17 @@ discard block |
||
123 | 123 | * @param integer|null $id Unique resource ID |
124 | 124 | * @return \Illuminate\Http\Response Response object containing the generated output |
125 | 125 | */ |
126 | - public function putAction( Request $request, $site = 'default', $resource, $id = null ) |
|
126 | + public function putAction(Request $request, $site = 'default', $resource, $id = null) |
|
127 | 127 | { |
128 | - $this->authorize( 'admin' ); |
|
128 | + $this->authorize('admin'); |
|
129 | 129 | |
130 | 130 | $status = 500; |
131 | 131 | $header = $request->headers->all(); |
132 | 132 | |
133 | - $cntl = $this->createController( $site, $resource ); |
|
134 | - $result = $cntl->put( $request->getContent(), $header, $status ); |
|
133 | + $cntl = $this->createController($site, $resource); |
|
134 | + $result = $cntl->put($request->getContent(), $header, $status); |
|
135 | 135 | |
136 | - return $this->createResponse( $result, $status, $header ); |
|
136 | + return $this->createResponse($result, $status, $header); |
|
137 | 137 | } |
138 | 138 | |
139 | 139 | |
@@ -145,17 +145,17 @@ discard block |
||
145 | 145 | * @param string $sitecode Unique site code |
146 | 146 | * @return \Illuminate\Http\Response Response object containing the generated output |
147 | 147 | */ |
148 | - public function optionsAction( Request $request, $site = 'default', $resource = '' ) |
|
148 | + public function optionsAction(Request $request, $site = 'default', $resource = '') |
|
149 | 149 | { |
150 | - $this->authorize( 'admin' ); |
|
150 | + $this->authorize('admin'); |
|
151 | 151 | |
152 | 152 | $status = 500; |
153 | 153 | $header = $request->headers->all(); |
154 | 154 | |
155 | - $cntl = $this->createController( $site, $resource ); |
|
156 | - $result = $cntl->options( $request->getContent(), $header, $status ); |
|
155 | + $cntl = $this->createController($site, $resource); |
|
156 | + $result = $cntl->options($request->getContent(), $header, $status); |
|
157 | 157 | |
158 | - return $this->createResponse( $result, $status, $header ); |
|
158 | + return $this->createResponse($result, $status, $header); |
|
159 | 159 | } |
160 | 160 | |
161 | 161 | |
@@ -165,20 +165,20 @@ discard block |
||
165 | 165 | * @param string $sitecode Unique site code |
166 | 166 | * @return \Aimeos\MShop\Context\Item\Iface Context item |
167 | 167 | */ |
168 | - protected function createController( $sitecode, $resource ) |
|
168 | + protected function createController($sitecode, $resource) |
|
169 | 169 | { |
170 | - $lang = \Input::get( 'lang', 'en' ); |
|
170 | + $lang = \Input::get('lang', 'en'); |
|
171 | 171 | |
172 | - $aimeos = app( '\Aimeos\Shop\Base\Aimeos' )->get(); |
|
173 | - $templatePaths = $aimeos->getCustomPaths( 'controller/jsonadm/templates' ); |
|
172 | + $aimeos = app('\Aimeos\Shop\Base\Aimeos')->get(); |
|
173 | + $templatePaths = $aimeos->getCustomPaths('controller/jsonadm/templates'); |
|
174 | 174 | |
175 | - $context = app( '\Aimeos\Shop\Base\Context' )->get( false ); |
|
176 | - $context = $this->setLocale( $context, $sitecode, $lang ); |
|
175 | + $context = app('\Aimeos\Shop\Base\Context')->get(false); |
|
176 | + $context = $this->setLocale($context, $sitecode, $lang); |
|
177 | 177 | |
178 | - $view = app( '\Aimeos\Shop\Base\View' )->create( $context->getConfig(), $templatePaths, $lang ); |
|
179 | - $context->setView( $view ); |
|
178 | + $view = app('\Aimeos\Shop\Base\View')->create($context->getConfig(), $templatePaths, $lang); |
|
179 | + $context->setView($view); |
|
180 | 180 | |
181 | - return \Aimeos\Controller\JsonAdm\Factory::createController( $context, $templatePaths, $resource ); |
|
181 | + return \Aimeos\Controller\JsonAdm\Factory::createController($context, $templatePaths, $resource); |
|
182 | 182 | } |
183 | 183 | |
184 | 184 | |
@@ -190,12 +190,12 @@ discard block |
||
190 | 190 | * @param array $header List of HTTP headers |
191 | 191 | * @return \Illuminate\Http\Response HTTP response object |
192 | 192 | */ |
193 | - protected function createResponse( $content, $status, array $header ) |
|
193 | + protected function createResponse($content, $status, array $header) |
|
194 | 194 | { |
195 | - $response = \Response::make( $content, $status ); |
|
195 | + $response = \Response::make($content, $status); |
|
196 | 196 | |
197 | - foreach( $header as $key => $value ) { |
|
198 | - $response->header( $key, $value ); |
|
197 | + foreach ($header as $key => $value) { |
|
198 | + $response->header($key, $value); |
|
199 | 199 | } |
200 | 200 | |
201 | 201 | return $response; |
@@ -210,23 +210,23 @@ discard block |
||
210 | 210 | * @param string $lang ISO language code, e.g. "en" or "en_GB" |
211 | 211 | * @return \Aimeos\MShop\Context\Item\Iface Modified context object |
212 | 212 | */ |
213 | - protected function setLocale( \Aimeos\MShop\Context\Item\Iface $context, $sitecode, $lang ) |
|
213 | + protected function setLocale(\Aimeos\MShop\Context\Item\Iface $context, $sitecode, $lang) |
|
214 | 214 | { |
215 | - $localeManager = \Aimeos\MShop\Factory::createManager( $context, 'locale' ); |
|
215 | + $localeManager = \Aimeos\MShop\Factory::createManager($context, 'locale'); |
|
216 | 216 | |
217 | 217 | try |
218 | 218 | { |
219 | - $localeItem = $localeManager->bootstrap( $sitecode, '', '', false ); |
|
220 | - $localeItem->setLanguageId( null ); |
|
221 | - $localeItem->setCurrencyId( null ); |
|
219 | + $localeItem = $localeManager->bootstrap($sitecode, '', '', false); |
|
220 | + $localeItem->setLanguageId(null); |
|
221 | + $localeItem->setCurrencyId(null); |
|
222 | 222 | } |
223 | - catch( \Aimeos\MShop\Locale\Exception $e ) |
|
223 | + catch (\Aimeos\MShop\Locale\Exception $e) |
|
224 | 224 | { |
225 | 225 | $localeItem = $localeManager->createItem(); |
226 | 226 | } |
227 | 227 | |
228 | - $context->setLocale( $localeItem ); |
|
229 | - $context->setI18n( app('\Aimeos\Shop\Base\I18n')->get( array( $lang ) ) ); |
|
228 | + $context->setLocale($localeItem); |
|
229 | + $context->setI18n(app('\Aimeos\Shop\Base\I18n')->get(array($lang))); |
|
230 | 230 | |
231 | 231 | return $context; |
232 | 232 | } |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | * |
35 | 35 | * @param \Illuminate\Contracts\Config\Repository $config Configuration object |
36 | 36 | */ |
37 | - public function __construct( \Illuminate\Contracts\Config\Repository $config ) |
|
37 | + public function __construct(\Illuminate\Contracts\Config\Repository $config) |
|
38 | 38 | { |
39 | 39 | $this->config = $config; |
40 | 40 | } |
@@ -47,10 +47,10 @@ discard block |
||
47 | 47 | */ |
48 | 48 | public function get() |
49 | 49 | { |
50 | - if( $this->object === null ) |
|
50 | + if ($this->object === null) |
|
51 | 51 | { |
52 | - $extDirs = (array) $this->config->get( 'shop.extdir', array() ); |
|
53 | - $this->object = new \Aimeos\Bootstrap( $extDirs, false ); |
|
52 | + $extDirs = (array) $this->config->get('shop.extdir', array()); |
|
53 | + $this->object = new \Aimeos\Bootstrap($extDirs, false); |
|
54 | 54 | } |
55 | 55 | |
56 | 56 | return $this->object; |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | * @param \Illuminate\Contracts\Config\Repository $config Configuration object |
46 | 46 | * @param \Illuminate\Session\Store $session Laravel session object |
47 | 47 | */ |
48 | - public function __construct( \Illuminate\Contracts\Config\Repository $config, \Illuminate\Session\Store $session ) |
|
48 | + public function __construct(\Illuminate\Contracts\Config\Repository $config, \Illuminate\Session\Store $session) |
|
49 | 49 | { |
50 | 50 | $this->config = $config; |
51 | 51 | $this->session = $session; |
@@ -58,48 +58,48 @@ discard block |
||
58 | 58 | * @param boolean $locale True to add locale object to context, false if not |
59 | 59 | * @return \Aimeos\MShop\Context\Item\Iface Context object |
60 | 60 | */ |
61 | - public function get( $locale = true ) |
|
61 | + public function get($locale = true) |
|
62 | 62 | { |
63 | - if( self::$context === null ) |
|
63 | + if (self::$context === null) |
|
64 | 64 | { |
65 | 65 | $context = new \Aimeos\MShop\Context\Item\Standard(); |
66 | 66 | |
67 | 67 | $config = $this->getConfig(); |
68 | - $context->setConfig( $config ); |
|
68 | + $context->setConfig($config); |
|
69 | 69 | |
70 | - $dbm = new \Aimeos\MW\DB\Manager\PDO( $config ); |
|
71 | - $context->setDatabaseManager( $dbm ); |
|
70 | + $dbm = new \Aimeos\MW\DB\Manager\PDO($config); |
|
71 | + $context->setDatabaseManager($dbm); |
|
72 | 72 | |
73 | - $fs = new \Aimeos\MW\Filesystem\Laravel( app( 'filesystem.disk' ) ); |
|
74 | - $context->setFilesystem( $fs ); |
|
73 | + $fs = new \Aimeos\MW\Filesystem\Laravel(app('filesystem.disk')); |
|
74 | + $context->setFilesystem($fs); |
|
75 | 75 | |
76 | - $mail = new \Aimeos\MW\Mail\Swift( function() { return app( 'mailer' )->getSwiftMailer(); } ); |
|
77 | - $context->setMail( $mail ); |
|
76 | + $mail = new \Aimeos\MW\Mail\Swift(function() { return app('mailer')->getSwiftMailer(); } ); |
|
77 | + $context->setMail($mail); |
|
78 | 78 | |
79 | - $logger = \Aimeos\MAdmin\Log\Manager\Factory::createManager( $context ); |
|
80 | - $context->setLogger( $logger ); |
|
79 | + $logger = \Aimeos\MAdmin\Log\Manager\Factory::createManager($context); |
|
80 | + $context->setLogger($logger); |
|
81 | 81 | |
82 | - $cache = new \Aimeos\MAdmin\Cache\Proxy\Standard( $context ); |
|
83 | - $context->setCache( $cache ); |
|
82 | + $cache = new \Aimeos\MAdmin\Cache\Proxy\Standard($context); |
|
83 | + $context->setCache($cache); |
|
84 | 84 | |
85 | 85 | self::$context = $context; |
86 | 86 | } |
87 | 87 | |
88 | 88 | $context = self::$context; |
89 | 89 | |
90 | - if( $locale === true ) |
|
90 | + if ($locale === true) |
|
91 | 91 | { |
92 | - $localeItem = $this->getLocale( $context ); |
|
92 | + $localeItem = $this->getLocale($context); |
|
93 | 93 | $langid = $localeItem->getLanguageId(); |
94 | 94 | |
95 | - $context->setLocale( $localeItem ); |
|
96 | - $context->setI18n( app('\Aimeos\Shop\Base\I18n')->get( array( $langid ) ) ); |
|
95 | + $context->setLocale($localeItem); |
|
96 | + $context->setI18n(app('\Aimeos\Shop\Base\I18n')->get(array($langid))); |
|
97 | 97 | } |
98 | 98 | |
99 | - $session = new \Aimeos\MW\Session\Laravel4( $this->session ); |
|
100 | - $context->setSession( $session ); |
|
99 | + $session = new \Aimeos\MW\Session\Laravel4($this->session); |
|
100 | + $context->setSession($session); |
|
101 | 101 | |
102 | - $this->addUser( $context ); |
|
102 | + $this->addUser($context); |
|
103 | 103 | |
104 | 104 | return $context; |
105 | 105 | } |
@@ -110,20 +110,20 @@ discard block |
||
110 | 110 | * |
111 | 111 | * @param \Aimeos\MShop\Context\Item\Iface $context Context object |
112 | 112 | */ |
113 | - protected function addUser( \Aimeos\MShop\Context\Item\Iface $context ) |
|
113 | + protected function addUser(\Aimeos\MShop\Context\Item\Iface $context) |
|
114 | 114 | { |
115 | - if( ( $userid = \Auth::id() ) !== null ) |
|
115 | + if (($userid = \Auth::id()) !== null) |
|
116 | 116 | { |
117 | - $context->setUserId( $userid ); |
|
118 | - $context->setGroupIds( function() use ( $context, $userid ) |
|
117 | + $context->setUserId($userid); |
|
118 | + $context->setGroupIds(function() use ($context, $userid) |
|
119 | 119 | { |
120 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'customer' ); |
|
121 | - return $manager->getItem( $userid, array( 'customer/group' ) )->getGroups(); |
|
120 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'customer'); |
|
121 | + return $manager->getItem($userid, array('customer/group'))->getGroups(); |
|
122 | 122 | } ); |
123 | 123 | } |
124 | 124 | |
125 | - if( ( $user = \Auth::user() ) !== null ) { |
|
126 | - $context->setEditor( $user->name ); |
|
125 | + if (($user = \Auth::user()) !== null) { |
|
126 | + $context->setEditor($user->name); |
|
127 | 127 | } |
128 | 128 | } |
129 | 129 | |
@@ -135,13 +135,13 @@ discard block |
||
135 | 135 | */ |
136 | 136 | protected function getConfig() |
137 | 137 | { |
138 | - $conf = $this->config->get( 'shop' ); |
|
138 | + $conf = $this->config->get('shop'); |
|
139 | 139 | |
140 | - $configPaths = app( '\Aimeos\Shop\Base\Aimeos' )->get()->getConfigPaths( 'mysql' ); |
|
141 | - $config = new \Aimeos\MW\Config\PHPArray( $conf, $configPaths ); |
|
140 | + $configPaths = app('\Aimeos\Shop\Base\Aimeos')->get()->getConfigPaths('mysql'); |
|
141 | + $config = new \Aimeos\MW\Config\PHPArray($conf, $configPaths); |
|
142 | 142 | |
143 | - if( function_exists( 'apc_store' ) === true && $this->config->get( 'shop.apc_enabled', false ) == true ) { |
|
144 | - $config = new \Aimeos\MW\Config\Decorator\APC( $config, $this->config->get( 'shop.apc_prefix', 'laravel:' ) ); |
|
143 | + if (function_exists('apc_store') === true && $this->config->get('shop.apc_enabled', false) == true) { |
|
144 | + $config = new \Aimeos\MW\Config\Decorator\APC($config, $this->config->get('shop.apc_prefix', 'laravel:')); |
|
145 | 145 | } |
146 | 146 | |
147 | 147 | return $config; |
@@ -154,18 +154,18 @@ discard block |
||
154 | 154 | * @param \Aimeos\MShop\Context\Item\Iface $context Context object |
155 | 155 | * @return \Aimeos\MShop\Locale\Item\Iface Locale item object |
156 | 156 | */ |
157 | - protected function getLocale( \Aimeos\MShop\Context\Item\Iface $context ) |
|
157 | + protected function getLocale(\Aimeos\MShop\Context\Item\Iface $context) |
|
158 | 158 | { |
159 | - if( $this->locale === null ) |
|
159 | + if ($this->locale === null) |
|
160 | 160 | { |
161 | - $site = \Route::input( 'site', 'default' ); |
|
162 | - $lang = \Route::input( 'locale', '' ); |
|
163 | - $currency = \Route::input( 'currency', '' ); |
|
161 | + $site = \Route::input('site', 'default'); |
|
162 | + $lang = \Route::input('locale', ''); |
|
163 | + $currency = \Route::input('currency', ''); |
|
164 | 164 | |
165 | - $disableSites = $this->config->has( 'shop.disableSites' ); |
|
165 | + $disableSites = $this->config->has('shop.disableSites'); |
|
166 | 166 | |
167 | - $localeManager = \Aimeos\MShop\Locale\Manager\Factory::createManager( $context ); |
|
168 | - $this->locale = $localeManager->bootstrap( $site, $lang, $currency, $disableSites ); |
|
167 | + $localeManager = \Aimeos\MShop\Locale\Manager\Factory::createManager($context); |
|
168 | + $this->locale = $localeManager->bootstrap($site, $lang, $currency, $disableSites); |
|
169 | 169 | } |
170 | 170 | |
171 | 171 | return $this->locale; |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | * @param \Aimeos\Shop\Base\Aimeos $aimeos Aimeos object |
41 | 41 | * @param \Illuminate\Contracts\Config\Repository $config Configuration object |
42 | 42 | */ |
43 | - public function __construct( \Aimeos\Shop\Base\Aimeos $aimeos, \Illuminate\Contracts\Config\Repository $config ) |
|
43 | + public function __construct(\Aimeos\Shop\Base\Aimeos $aimeos, \Illuminate\Contracts\Config\Repository $config) |
|
44 | 44 | { |
45 | 45 | $this->aimeos = $aimeos; |
46 | 46 | $this->config = $config; |
@@ -53,22 +53,22 @@ discard block |
||
53 | 53 | * @param array $languageIds List of two letter ISO language IDs |
54 | 54 | * @return \Aimeos\MW\Translation\Iface[] List of translation objects |
55 | 55 | */ |
56 | - public function get( array $languageIds ) |
|
56 | + public function get(array $languageIds) |
|
57 | 57 | { |
58 | 58 | $i18nPaths = $this->aimeos->get()->getI18nPaths(); |
59 | 59 | |
60 | - foreach( $languageIds as $langid ) |
|
60 | + foreach ($languageIds as $langid) |
|
61 | 61 | { |
62 | - if( !isset( $this->i18n[$langid] ) ) |
|
62 | + if (!isset($this->i18n[$langid])) |
|
63 | 63 | { |
64 | - $i18n = new \Aimeos\MW\Translation\Zend2( $i18nPaths, 'gettext', $langid, array( 'disableNotices' => true ) ); |
|
64 | + $i18n = new \Aimeos\MW\Translation\Zend2($i18nPaths, 'gettext', $langid, array('disableNotices' => true)); |
|
65 | 65 | |
66 | - if( function_exists( 'apc_store' ) === true && $this->config->get( 'shop.apc_enabled', false ) == true ) { |
|
67 | - $i18n = new \Aimeos\MW\Translation\Decorator\APC( $i18n, $this->config->get( 'shop.apc_prefix', 'laravel:' ) ); |
|
66 | + if (function_exists('apc_store') === true && $this->config->get('shop.apc_enabled', false) == true) { |
|
67 | + $i18n = new \Aimeos\MW\Translation\Decorator\APC($i18n, $this->config->get('shop.apc_prefix', 'laravel:')); |
|
68 | 68 | } |
69 | 69 | |
70 | - if( $this->config->has( 'shop.i18n.' . $langid ) ) { |
|
71 | - $i18n = new \Aimeos\MW\Translation\Decorator\Memory( $i18n, $this->config->get( 'shop.i18n.' . $langid ) ); |
|
70 | + if ($this->config->has('shop.i18n.' . $langid)) { |
|
71 | + $i18n = new \Aimeos\MW\Translation\Decorator\Memory($i18n, $this->config->get('shop.i18n.' . $langid)); |
|
72 | 72 | } |
73 | 73 | |
74 | 74 | $this->i18n[$langid] = $i18n; |
@@ -47,8 +47,8 @@ discard block |
||
47 | 47 | * @param \Aimeos\Shop\Base\Context $context Context object |
48 | 48 | * @param \Aimeos\Shop\Base\View $view View object |
49 | 49 | */ |
50 | - public function __construct( \Illuminate\Contracts\Config\Repository $config, |
|
51 | - \Aimeos\Shop\Base\Aimeos $aimeos, \Aimeos\Shop\Base\Context $context, \Aimeos\Shop\Base\View $view ) |
|
50 | + public function __construct(\Illuminate\Contracts\Config\Repository $config, |
|
51 | + \Aimeos\Shop\Base\Aimeos $aimeos, \Aimeos\Shop\Base\Context $context, \Aimeos\Shop\Base\View $view) |
|
52 | 52 | { |
53 | 53 | $this->config = $config; |
54 | 54 | $this->aimeos = $aimeos; |
@@ -63,23 +63,23 @@ discard block |
||
63 | 63 | * @param string $pageName Name of the configured page |
64 | 64 | * @return array Associative list with body and header output separated by client name |
65 | 65 | */ |
66 | - public function getSections( $pageName ) |
|
66 | + public function getSections($pageName) |
|
67 | 67 | { |
68 | 68 | $context = $this->context->get(); |
69 | 69 | $langid = $context->getLocale()->getLanguageId(); |
70 | - $tmplPaths = $this->aimeos->get()->getCustomPaths( 'client/html' ); |
|
71 | - $view = $this->view->create( $context->getConfig(), $tmplPaths, $langid ); |
|
72 | - $context->setView( $view ); |
|
70 | + $tmplPaths = $this->aimeos->get()->getCustomPaths('client/html'); |
|
71 | + $view = $this->view->create($context->getConfig(), $tmplPaths, $langid); |
|
72 | + $context->setView($view); |
|
73 | 73 | |
74 | - $pagesConfig = $this->config->get( 'shop.page', array() ); |
|
75 | - $result = array( 'aibody' => array(), 'aiheader' => array() ); |
|
74 | + $pagesConfig = $this->config->get('shop.page', array()); |
|
75 | + $result = array('aibody' => array(), 'aiheader' => array()); |
|
76 | 76 | |
77 | - if( isset( $pagesConfig[$pageName] ) ) |
|
77 | + if (isset($pagesConfig[$pageName])) |
|
78 | 78 | { |
79 | - foreach( (array) $pagesConfig[$pageName] as $clientName ) |
|
79 | + foreach ((array) $pagesConfig[$pageName] as $clientName) |
|
80 | 80 | { |
81 | - $client = \Aimeos\Client\Html\Factory::createClient( $context, $tmplPaths, $clientName ); |
|
82 | - $client->setView( clone $view ); |
|
81 | + $client = \Aimeos\Client\Html\Factory::createClient($context, $tmplPaths, $clientName); |
|
82 | + $client->setView(clone $view); |
|
83 | 83 | $client->process(); |
84 | 84 | |
85 | 85 | $result['aibody'][$clientName] = $client->getBody(); |
@@ -26,59 +26,59 @@ discard block |
||
26 | 26 | * @param string|null $locale Code of the current language or null for no translation |
27 | 27 | * @return \Aimeos\MW\View\Iface View object |
28 | 28 | */ |
29 | - public function create( \Aimeos\MW\Config\Iface $config, array $templatePaths, $locale = null ) |
|
29 | + public function create(\Aimeos\MW\Config\Iface $config, array $templatePaths, $locale = null) |
|
30 | 30 | { |
31 | 31 | $params = $fixed = array(); |
32 | 32 | |
33 | - if( $locale !== null ) |
|
33 | + if ($locale !== null) |
|
34 | 34 | { |
35 | 35 | $params = \Route::current()->parameters() + \Input::all(); |
36 | 36 | $params['target'] = \Route::currentRouteName(); |
37 | 37 | |
38 | 38 | $fixed = $this->getFixedParams(); |
39 | 39 | |
40 | - $i18n = app('\Aimeos\Shop\Base\I18n')->get( array( $locale ) ); |
|
40 | + $i18n = app('\Aimeos\Shop\Base\I18n')->get(array($locale)); |
|
41 | 41 | $translation = $i18n[$locale]; |
42 | 42 | } |
43 | 43 | else |
44 | 44 | { |
45 | - $translation = new \Aimeos\MW\Translation\None( 'en' ); |
|
45 | + $translation = new \Aimeos\MW\Translation\None('en'); |
|
46 | 46 | } |
47 | 47 | |
48 | 48 | |
49 | 49 | $view = new \Aimeos\MW\View\Standard(); |
50 | 50 | |
51 | - $helper = new \Aimeos\MW\View\Helper\Translate\Standard( $view, $translation ); |
|
52 | - $view->addHelper( 'translate', $helper ); |
|
51 | + $helper = new \Aimeos\MW\View\Helper\Translate\Standard($view, $translation); |
|
52 | + $view->addHelper('translate', $helper); |
|
53 | 53 | |
54 | - $helper = new \Aimeos\MW\View\Helper\Url\Laravel5( $view, app('url'), $fixed ); |
|
55 | - $view->addHelper( 'url', $helper ); |
|
54 | + $helper = new \Aimeos\MW\View\Helper\Url\Laravel5($view, app('url'), $fixed); |
|
55 | + $view->addHelper('url', $helper); |
|
56 | 56 | |
57 | - $helper = new \Aimeos\MW\View\Helper\Partial\Standard( $view, $config, $templatePaths ); |
|
58 | - $view->addHelper( 'partial', $helper ); |
|
57 | + $helper = new \Aimeos\MW\View\Helper\Partial\Standard($view, $config, $templatePaths); |
|
58 | + $view->addHelper('partial', $helper); |
|
59 | 59 | |
60 | - $helper = new \Aimeos\MW\View\Helper\Parameter\Standard( $view, $params ); |
|
61 | - $view->addHelper( 'param', $helper ); |
|
60 | + $helper = new \Aimeos\MW\View\Helper\Parameter\Standard($view, $params); |
|
61 | + $view->addHelper('param', $helper); |
|
62 | 62 | |
63 | - $helper = new \Aimeos\MW\View\Helper\Config\Standard( $view, $config ); |
|
64 | - $view->addHelper( 'config', $helper ); |
|
63 | + $helper = new \Aimeos\MW\View\Helper\Config\Standard($view, $config); |
|
64 | + $view->addHelper('config', $helper); |
|
65 | 65 | |
66 | - $sepDec = $config->get( 'client/html/common/format/seperatorDecimal', '.' ); |
|
67 | - $sep1000 = $config->get( 'client/html/common/format/seperator1000', ' ' ); |
|
68 | - $helper = new \Aimeos\MW\View\Helper\Number\Standard( $view, $sepDec, $sep1000 ); |
|
69 | - $view->addHelper( 'number', $helper ); |
|
66 | + $sepDec = $config->get('client/html/common/format/seperatorDecimal', '.'); |
|
67 | + $sep1000 = $config->get('client/html/common/format/seperator1000', ' '); |
|
68 | + $helper = new \Aimeos\MW\View\Helper\Number\Standard($view, $sepDec, $sep1000); |
|
69 | + $view->addHelper('number', $helper); |
|
70 | 70 | |
71 | - $helper = new \Aimeos\MW\View\Helper\FormParam\Standard( $view, array() ); |
|
72 | - $view->addHelper( 'formparam', $helper ); |
|
71 | + $helper = new \Aimeos\MW\View\Helper\FormParam\Standard($view, array()); |
|
72 | + $view->addHelper('formparam', $helper); |
|
73 | 73 | |
74 | - $helper = new \Aimeos\MW\View\Helper\Encoder\Standard( $view ); |
|
75 | - $view->addHelper( 'encoder', $helper ); |
|
74 | + $helper = new \Aimeos\MW\View\Helper\Encoder\Standard($view); |
|
75 | + $view->addHelper('encoder', $helper); |
|
76 | 76 | |
77 | - $helper = new \Aimeos\MW\View\Helper\Request\Laravel5( $view, \Request::instance() ); |
|
78 | - $view->addHelper( 'request', $helper ); |
|
77 | + $helper = new \Aimeos\MW\View\Helper\Request\Laravel5($view, \Request::instance()); |
|
78 | + $view->addHelper('request', $helper); |
|
79 | 79 | |
80 | - $helper = new \Aimeos\MW\View\Helper\Csrf\Standard( $view, '_token', csrf_token() ); |
|
81 | - $view->addHelper( 'csrf', $helper ); |
|
80 | + $helper = new \Aimeos\MW\View\Helper\Csrf\Standard($view, '_token', csrf_token()); |
|
81 | + $view->addHelper('csrf', $helper); |
|
82 | 82 | |
83 | 83 | return $view; |
84 | 84 | } |
@@ -93,15 +93,15 @@ discard block |
||
93 | 93 | { |
94 | 94 | $fixed = array(); |
95 | 95 | |
96 | - if( ( $value = \Route::input( 'site' ) ) !== null ) { |
|
96 | + if (($value = \Route::input('site')) !== null) { |
|
97 | 97 | $fixed['site'] = $value; |
98 | 98 | } |
99 | 99 | |
100 | - if( ( $value = \Route::input( 'locale' ) ) !== null ) { |
|
100 | + if (($value = \Route::input('locale')) !== null) { |
|
101 | 101 | $fixed['locale'] = $value; |
102 | 102 | } |
103 | 103 | |
104 | - if( ( $value = \Route::input( 'currency' ) ) !== null ) { |
|
104 | + if (($value = \Route::input('currency')) !== null) { |
|
105 | 105 | $fixed['currency'] = $value; |
106 | 106 | } |
107 | 107 |
@@ -39,8 +39,7 @@ |
||
39 | 39 | |
40 | 40 | $i18n = app('\Aimeos\Shop\Base\I18n')->get( array( $locale ) ); |
41 | 41 | $translation = $i18n[$locale]; |
42 | - } |
|
43 | - else |
|
42 | + } else |
|
44 | 43 | { |
45 | 44 | $translation = new \Aimeos\MW\Translation\None( 'en' ); |
46 | 45 | } |
@@ -22,19 +22,19 @@ |
||
22 | 22 | * @param string|array $sites Unique site codes |
23 | 23 | * @return \Aimeos\MShop\Locale\Item\Site\Iface[] List of site items |
24 | 24 | */ |
25 | - protected function getSiteItems( \Aimeos\MShop\Context\Item\Iface $context, $sites ) |
|
25 | + protected function getSiteItems(\Aimeos\MShop\Context\Item\Iface $context, $sites) |
|
26 | 26 | { |
27 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'locale/site' ); |
|
27 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'locale/site'); |
|
28 | 28 | $search = $manager->createSearch(); |
29 | 29 | |
30 | - if( is_scalar( $sites ) && $sites != '' ) { |
|
31 | - $sites = explode( ' ', $sites ); |
|
30 | + if (is_scalar($sites) && $sites != '') { |
|
31 | + $sites = explode(' ', $sites); |
|
32 | 32 | } |
33 | 33 | |
34 | - if( !empty( $sites ) ) { |
|
35 | - $search->setConditions( $search->compare( '==', 'locale.site.code', $sites ) ); |
|
34 | + if (!empty($sites)) { |
|
35 | + $search->setConditions($search->compare('==', 'locale.site.code', $sites)); |
|
36 | 36 | } |
37 | 37 | |
38 | - return $manager->searchItems( $search ); |
|
38 | + return $manager->searchItems($search); |
|
39 | 39 | } |
40 | 40 | } |
41 | 41 | \ No newline at end of file |
@@ -35,24 +35,24 @@ discard block |
||
35 | 35 | */ |
36 | 36 | public function fire() |
37 | 37 | { |
38 | - $context = $this->getLaravel()->make( 'Aimeos\Shop\Base\Context' )->get( false ); |
|
39 | - $context->setEditor( 'aimeos:cache' ); |
|
38 | + $context = $this->getLaravel()->make('Aimeos\Shop\Base\Context')->get(false); |
|
39 | + $context->setEditor('aimeos:cache'); |
|
40 | 40 | |
41 | - $localeManager = \Aimeos\MShop\Locale\Manager\Factory::createManager( $context ); |
|
41 | + $localeManager = \Aimeos\MShop\Locale\Manager\Factory::createManager($context); |
|
42 | 42 | |
43 | - foreach( $this->getSiteItems( $context, $this->argument( 'site' ) ) as $siteItem ) |
|
43 | + foreach ($this->getSiteItems($context, $this->argument('site')) as $siteItem) |
|
44 | 44 | { |
45 | - $localeItem = $localeManager->bootstrap( $siteItem->getCode(), '', '', false ); |
|
45 | + $localeItem = $localeManager->bootstrap($siteItem->getCode(), '', '', false); |
|
46 | 46 | |
47 | 47 | $lcontext = clone $context; |
48 | - $lcontext->setLocale( $localeItem ); |
|
48 | + $lcontext->setLocale($localeItem); |
|
49 | 49 | |
50 | - $cache = new \Aimeos\MAdmin\Cache\Proxy\Standard( $lcontext ); |
|
51 | - $lcontext->setCache( $cache ); |
|
50 | + $cache = new \Aimeos\MAdmin\Cache\Proxy\Standard($lcontext); |
|
51 | + $lcontext->setCache($cache); |
|
52 | 52 | |
53 | - $this->info( sprintf( 'Clearing the Aimeos cache for site "%1$s"', $siteItem->getCode() ) ); |
|
53 | + $this->info(sprintf('Clearing the Aimeos cache for site "%1$s"', $siteItem->getCode())); |
|
54 | 54 | |
55 | - \Aimeos\MAdmin\Cache\Manager\Factory::createManager( $lcontext )->getCache()->flush(); |
|
55 | + \Aimeos\MAdmin\Cache\Manager\Factory::createManager($lcontext)->getCache()->flush(); |
|
56 | 56 | } |
57 | 57 | } |
58 | 58 | |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | protected function getArguments() |
66 | 66 | { |
67 | 67 | return array( |
68 | - array( 'site', InputArgument::OPTIONAL, 'Site codes to clear the cache like "default unittest" (none for all)' ), |
|
68 | + array('site', InputArgument::OPTIONAL, 'Site codes to clear the cache like "default unittest" (none for all)'), |
|
69 | 69 | ); |
70 | 70 | } |
71 | 71 |