@@ -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 | { |
@@ -32,54 +32,54 @@ discard block |
||
32 | 32 | */ |
33 | 33 | public function indexAction() |
34 | 34 | { |
35 | - if( config( 'shop.authorize', true ) ) { |
|
36 | - $this->authorize( 'admin' ); |
|
35 | + if (config('shop.authorize', true)) { |
|
36 | + $this->authorize('admin'); |
|
37 | 37 | } |
38 | 38 | |
39 | - $site = \Input::get( 'site', 'default' ); |
|
40 | - $lang = \Input::get( 'lang', config( 'app.locale', 'en' ) ); |
|
39 | + $site = \Input::get('site', 'default'); |
|
40 | + $lang = \Input::get('lang', config('app.locale', 'en')); |
|
41 | 41 | |
42 | - $aimeos = app( '\Aimeos\Shop\Base\Aimeos' )->get(); |
|
43 | - $cntlPaths = $aimeos->getCustomPaths( 'controller/extjs' ); |
|
42 | + $aimeos = app('\Aimeos\Shop\Base\Aimeos')->get(); |
|
43 | + $cntlPaths = $aimeos->getCustomPaths('controller/extjs'); |
|
44 | 44 | |
45 | - $context = app( '\Aimeos\Shop\Base\Context' )->get( false ); |
|
46 | - $context = $this->setLocale( $context, $site, $lang ); |
|
45 | + $context = app('\Aimeos\Shop\Base\Context')->get(false); |
|
46 | + $context = $this->setLocale($context, $site, $lang); |
|
47 | 47 | |
48 | - $controller = new \Aimeos\Controller\ExtJS\JsonRpc( $context, $cntlPaths ); |
|
48 | + $controller = new \Aimeos\Controller\ExtJS\JsonRpc($context, $cntlPaths); |
|
49 | 49 | $cssFiles = array(); |
50 | 50 | |
51 | - foreach( $aimeos->getCustomPaths( 'admin/extjs' ) as $base => $paths ) |
|
51 | + foreach ($aimeos->getCustomPaths('admin/extjs') as $base => $paths) |
|
52 | 52 | { |
53 | - foreach( $paths as $path ) |
|
53 | + foreach ($paths as $path) |
|
54 | 54 | { |
55 | 55 | $jsbAbsPath = $base . '/' . $path; |
56 | 56 | |
57 | - if( !is_file( $jsbAbsPath ) ) { |
|
58 | - throw new \Exception( sprintf( 'JSB2 file "%1$s" not found', $jsbAbsPath ) ); |
|
57 | + if (!is_file($jsbAbsPath)) { |
|
58 | + throw new \Exception(sprintf('JSB2 file "%1$s" not found', $jsbAbsPath)); |
|
59 | 59 | } |
60 | 60 | |
61 | - $jsb2 = new \Aimeos\MW\Jsb2\Standard( $jsbAbsPath, dirname( $path ) ); |
|
62 | - $cssFiles = array_merge( $cssFiles, $jsb2->getUrls( 'css' ) ); |
|
61 | + $jsb2 = new \Aimeos\MW\Jsb2\Standard($jsbAbsPath, dirname($path)); |
|
62 | + $cssFiles = array_merge($cssFiles, $jsb2->getUrls('css')); |
|
63 | 63 | } |
64 | 64 | } |
65 | 65 | |
66 | - $params = array( 'site' => '{site}', 'lang' => '{lang}', 'tab' => '{tab}' ); |
|
67 | - $adminUrl = route( 'aimeos_shop_admin', $params ); |
|
68 | - $jsonUrl = route( 'aimeos_shop_admin_json', array( '_token' => csrf_token() ) ); |
|
66 | + $params = array('site' => '{site}', 'lang' => '{lang}', 'tab' => '{tab}'); |
|
67 | + $adminUrl = route('aimeos_shop_admin', $params); |
|
68 | + $jsonUrl = route('aimeos_shop_admin_json', array('_token' => csrf_token())); |
|
69 | 69 | |
70 | 70 | $vars = array( |
71 | 71 | 'lang' => $lang, |
72 | 72 | 'cssFiles' => $cssFiles, |
73 | - 'languages' => $this->getJsonLanguages( $context), |
|
74 | - 'config' => $this->getJsonClientConfig( $context ), |
|
75 | - 'site' => $this->getJsonSiteItem( $context, \Input::get( 'site', 'default' ) ), |
|
76 | - 'i18nContent' => $this->getJsonClientI18n( $aimeos->getI18nPaths(), $lang ), |
|
73 | + 'languages' => $this->getJsonLanguages($context), |
|
74 | + 'config' => $this->getJsonClientConfig($context), |
|
75 | + 'site' => $this->getJsonSiteItem($context, \Input::get('site', 'default')), |
|
76 | + 'i18nContent' => $this->getJsonClientI18n($aimeos->getI18nPaths(), $lang), |
|
77 | 77 | 'searchSchemas' => $controller->getJsonSearchSchemas(), |
78 | 78 | 'itemSchemas' => $controller->getJsonItemSchemas(), |
79 | - 'smd' => $controller->getJsonSmd( $jsonUrl ), |
|
80 | - 'urlTemplate' => urldecode( $adminUrl ), |
|
81 | - 'uploaddir' => \Config::get( 'shop::uploaddir' ), |
|
82 | - 'activeTab' => \Input::get( 'tab', 0 ), |
|
79 | + 'smd' => $controller->getJsonSmd($jsonUrl), |
|
80 | + 'urlTemplate' => urldecode($adminUrl), |
|
81 | + 'uploaddir' => \Config::get('shop::uploaddir'), |
|
82 | + 'activeTab' => \Input::get('tab', 0), |
|
83 | 83 | 'version' => $this->getVersion(), |
84 | 84 | ); |
85 | 85 | |
@@ -94,20 +94,20 @@ discard block |
||
94 | 94 | */ |
95 | 95 | public function doAction() |
96 | 96 | { |
97 | - if( config( 'shop.authorize', true ) ) { |
|
98 | - $this->authorize( 'admin' ); |
|
97 | + if (config('shop.authorize', true)) { |
|
98 | + $this->authorize('admin'); |
|
99 | 99 | } |
100 | 100 | |
101 | - $aimeos = app( '\Aimeos\Shop\Base\Aimeos' )->get(); |
|
102 | - $cntlPaths = $aimeos->getCustomPaths( 'controller/extjs' ); |
|
101 | + $aimeos = app('\Aimeos\Shop\Base\Aimeos')->get(); |
|
102 | + $cntlPaths = $aimeos->getCustomPaths('controller/extjs'); |
|
103 | 103 | |
104 | - $context = app( '\Aimeos\Shop\Base\Context' )->get( false ); |
|
105 | - $context = $this->setLocale( $context ); |
|
104 | + $context = app('\Aimeos\Shop\Base\Context')->get(false); |
|
105 | + $context = $this->setLocale($context); |
|
106 | 106 | |
107 | - $controller = new \Aimeos\Controller\ExtJS\JsonRpc( $context, $cntlPaths ); |
|
107 | + $controller = new \Aimeos\Controller\ExtJS\JsonRpc($context, $cntlPaths); |
|
108 | 108 | |
109 | - $response = $controller->process( \Input::instance()->request->all(), 'php://input' ); |
|
110 | - return \View::make('shop::admin.do', array( 'output' => $response )); |
|
109 | + $response = $controller->process(\Input::instance()->request->all(), 'php://input'); |
|
110 | + return \View::make('shop::admin.do', array('output' => $response)); |
|
111 | 111 | } |
112 | 112 | |
113 | 113 | |
@@ -118,32 +118,32 @@ discard block |
||
118 | 118 | */ |
119 | 119 | public function fileAction() |
120 | 120 | { |
121 | - if( config( 'shop.authorize', true ) ) { |
|
122 | - $this->authorize( 'admin' ); |
|
121 | + if (config('shop.authorize', true)) { |
|
122 | + $this->authorize('admin'); |
|
123 | 123 | } |
124 | 124 | |
125 | 125 | $contents = ''; |
126 | 126 | $jsFiles = array(); |
127 | - $aimeos = app( '\Aimeos\Shop\Base\Aimeos' )->get(); |
|
127 | + $aimeos = app('\Aimeos\Shop\Base\Aimeos')->get(); |
|
128 | 128 | |
129 | - foreach( $aimeos->getCustomPaths( 'admin/extjs' ) as $base => $paths ) |
|
129 | + foreach ($aimeos->getCustomPaths('admin/extjs') as $base => $paths) |
|
130 | 130 | { |
131 | - foreach( $paths as $path ) |
|
131 | + foreach ($paths as $path) |
|
132 | 132 | { |
133 | 133 | $jsbAbsPath = $base . '/' . $path; |
134 | - $jsb2 = new \Aimeos\MW\Jsb2\Standard( $jsbAbsPath, dirname( $jsbAbsPath ) ); |
|
135 | - $jsFiles = array_merge( $jsFiles, $jsb2->getUrls( 'js', '' ) ); |
|
134 | + $jsb2 = new \Aimeos\MW\Jsb2\Standard($jsbAbsPath, dirname($jsbAbsPath)); |
|
135 | + $jsFiles = array_merge($jsFiles, $jsb2->getUrls('js', '')); |
|
136 | 136 | } |
137 | 137 | } |
138 | 138 | |
139 | - foreach( $jsFiles as $file ) |
|
139 | + foreach ($jsFiles as $file) |
|
140 | 140 | { |
141 | - if( ( $content = file_get_contents( $file ) ) !== false ) { |
|
141 | + if (($content = file_get_contents($file)) !== false) { |
|
142 | 142 | $contents .= $content; |
143 | 143 | } |
144 | 144 | } |
145 | 145 | |
146 | - return response( $contents )->header( 'Content-Type', 'application/javascript' ); |
|
146 | + return response($contents)->header('Content-Type', 'application/javascript'); |
|
147 | 147 | } |
148 | 148 | |
149 | 149 | |
@@ -153,30 +153,30 @@ discard block |
||
153 | 153 | * @param \Aimeos\MShop\Context\Item\Iface $context Context object |
154 | 154 | * @return array List of language IDs with labels |
155 | 155 | */ |
156 | - protected function getJsonLanguages( \Aimeos\MShop\Context\Item\Iface $context ) |
|
156 | + protected function getJsonLanguages(\Aimeos\MShop\Context\Item\Iface $context) |
|
157 | 157 | { |
158 | - $paths = app( '\Aimeos\Shop\Base\Aimeos' )->get()->getI18nPaths(); |
|
158 | + $paths = app('\Aimeos\Shop\Base\Aimeos')->get()->getI18nPaths(); |
|
159 | 159 | $langs = array(); |
160 | 160 | |
161 | - if( !isset( $paths['admin'] ) ) { |
|
162 | - return json_encode( array() ); |
|
161 | + if (!isset($paths['admin'])) { |
|
162 | + return json_encode(array()); |
|
163 | 163 | } |
164 | 164 | |
165 | - foreach( $paths['admin'] as $path ) |
|
165 | + foreach ($paths['admin'] as $path) |
|
166 | 166 | { |
167 | - $iter = new \DirectoryIterator( $path ); |
|
167 | + $iter = new \DirectoryIterator($path); |
|
168 | 168 | |
169 | - foreach( $iter as $file ) |
|
169 | + foreach ($iter as $file) |
|
170 | 170 | { |
171 | 171 | $name = $file->getFilename(); |
172 | 172 | |
173 | - if( preg_match('/^[a-z]{2,3}(_[A-Z]{2})?$/', $name ) ) { |
|
173 | + if (preg_match('/^[a-z]{2,3}(_[A-Z]{2})?$/', $name)) { |
|
174 | 174 | $langs[$name] = null; |
175 | 175 | } |
176 | 176 | } |
177 | 177 | } |
178 | 178 | |
179 | - return json_encode( $this->getLanguages( $context, array_keys( $langs ) ) ); |
|
179 | + return json_encode($this->getLanguages($context, array_keys($langs))); |
|
180 | 180 | } |
181 | 181 | |
182 | 182 | |
@@ -186,10 +186,10 @@ discard block |
||
186 | 186 | * @param \Aimeos\MShop\Context\Item\Iface $context Context item object |
187 | 187 | * @return string JSON encoded configuration object |
188 | 188 | */ |
189 | - protected function getJsonClientConfig( \Aimeos\MShop\Context\Item\Iface $context ) |
|
189 | + protected function getJsonClientConfig(\Aimeos\MShop\Context\Item\Iface $context) |
|
190 | 190 | { |
191 | - $config = $context->getConfig()->get( 'admin/extjs', array() ); |
|
192 | - return json_encode( array( 'admin' => array( 'extjs' => $config ) ), JSON_FORCE_OBJECT ); |
|
191 | + $config = $context->getConfig()->get('admin/extjs', array()); |
|
192 | + return json_encode(array('admin' => array('extjs' => $config)), JSON_FORCE_OBJECT); |
|
193 | 193 | } |
194 | 194 | |
195 | 195 | |
@@ -200,16 +200,16 @@ discard block |
||
200 | 200 | * @param string $lang ISO language code like "en" or "en_GB" |
201 | 201 | * @return string JSON encoded translation object |
202 | 202 | */ |
203 | - protected function getJsonClientI18n( array $i18nPaths, $lang ) |
|
203 | + protected function getJsonClientI18n(array $i18nPaths, $lang) |
|
204 | 204 | { |
205 | - $i18n = new \Aimeos\MW\Translation\Zend2( $i18nPaths, 'gettext', $lang, array( 'disableNotices' => true ) ); |
|
205 | + $i18n = new \Aimeos\MW\Translation\Zend2($i18nPaths, 'gettext', $lang, array('disableNotices' => true)); |
|
206 | 206 | |
207 | 207 | $content = array( |
208 | - 'admin' => $i18n->getAll( 'admin' ), |
|
209 | - 'admin/ext' => $i18n->getAll( 'admin/ext' ), |
|
208 | + 'admin' => $i18n->getAll('admin'), |
|
209 | + 'admin/ext' => $i18n->getAll('admin/ext'), |
|
210 | 210 | ); |
211 | 211 | |
212 | - return json_encode( $content, JSON_FORCE_OBJECT ); |
|
212 | + return json_encode($content, JSON_FORCE_OBJECT); |
|
213 | 213 | } |
214 | 214 | |
215 | 215 | |
@@ -221,19 +221,19 @@ discard block |
||
221 | 221 | * @return string JSON encoded site item object |
222 | 222 | * @throws Exception If no site item was found for the code |
223 | 223 | */ |
224 | - protected function getJsonSiteItem( \Aimeos\MShop\Context\Item\Iface $context, $site ) |
|
224 | + protected function getJsonSiteItem(\Aimeos\MShop\Context\Item\Iface $context, $site) |
|
225 | 225 | { |
226 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'locale/site' ); |
|
226 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'locale/site'); |
|
227 | 227 | |
228 | 228 | $criteria = $manager->createSearch(); |
229 | - $criteria->setConditions( $criteria->compare( '==', 'locale.site.code', $site ) ); |
|
230 | - $items = $manager->searchItems( $criteria ); |
|
229 | + $criteria->setConditions($criteria->compare('==', 'locale.site.code', $site)); |
|
230 | + $items = $manager->searchItems($criteria); |
|
231 | 231 | |
232 | - if( ( $item = reset( $items ) ) === false ) { |
|
233 | - throw new \Exception( sprintf( 'No site found for code "%1$s"', $site ) ); |
|
232 | + if (($item = reset($items)) === false) { |
|
233 | + throw new \Exception(sprintf('No site found for code "%1$s"', $site)); |
|
234 | 234 | } |
235 | 235 | |
236 | - return json_encode( $item->toArray() ); |
|
236 | + return json_encode($item->toArray()); |
|
237 | 237 | } |
238 | 238 | |
239 | 239 | |
@@ -244,18 +244,18 @@ discard block |
||
244 | 244 | * @param array $langIds List of language IDs |
245 | 245 | * @return array List of associative lists with "id" and "label" as keys |
246 | 246 | */ |
247 | - protected function getLanguages( \Aimeos\MShop\Context\Item\Iface $context, array $langIds ) |
|
247 | + protected function getLanguages(\Aimeos\MShop\Context\Item\Iface $context, array $langIds) |
|
248 | 248 | { |
249 | - $languageManager = \Aimeos\MShop\Factory::createManager( $context, 'locale/language' ); |
|
249 | + $languageManager = \Aimeos\MShop\Factory::createManager($context, 'locale/language'); |
|
250 | 250 | $result = array(); |
251 | 251 | |
252 | 252 | $search = $languageManager->createSearch(); |
253 | - $search->setConditions( $search->compare('==', 'locale.language.id', $langIds ) ); |
|
254 | - $search->setSortations( array( $search->sort( '-', 'locale.language.status' ), $search->sort( '+', 'locale.language.label' ) ) ); |
|
255 | - $langItems = $languageManager->searchItems( $search ); |
|
253 | + $search->setConditions($search->compare('==', 'locale.language.id', $langIds)); |
|
254 | + $search->setSortations(array($search->sort('-', 'locale.language.status'), $search->sort('+', 'locale.language.label'))); |
|
255 | + $langItems = $languageManager->searchItems($search); |
|
256 | 256 | |
257 | - foreach( $langItems as $id => $item ) { |
|
258 | - $result[] = array( 'id' => $id, 'label' => $item->getLabel() ); |
|
257 | + foreach ($langItems as $id => $item) { |
|
258 | + $result[] = array('id' => $id, 'label' => $item->getLabel()); |
|
259 | 259 | } |
260 | 260 | |
261 | 261 | return $result; |
@@ -269,12 +269,12 @@ discard block |
||
269 | 269 | */ |
270 | 270 | protected function getVersion() |
271 | 271 | { |
272 | - if( ( $content = @file_get_contents( base_path( 'composer.lock' ) ) ) !== false |
|
273 | - && ( $content = json_decode( $content, true ) ) !== null && isset( $content['packages'] ) |
|
272 | + if (($content = @file_get_contents(base_path('composer.lock'))) !== false |
|
273 | + && ($content = json_decode($content, true)) !== null && isset($content['packages']) |
|
274 | 274 | ) { |
275 | - foreach( (array) $content['packages'] as $item ) |
|
275 | + foreach ((array) $content['packages'] as $item) |
|
276 | 276 | { |
277 | - if( $item['name'] === 'aimeos/aimeos-laravel' ) { |
|
277 | + if ($item['name'] === 'aimeos/aimeos-laravel') { |
|
278 | 278 | return $item['version']; |
279 | 279 | } |
280 | 280 | } |
@@ -292,17 +292,17 @@ discard block |
||
292 | 292 | * @param string $locale ISO language code, e.g. "en" or "en_GB" |
293 | 293 | * @return \Aimeos\MShop\Context\Item\Iface Modified context object |
294 | 294 | */ |
295 | - protected function setLocale( \Aimeos\MShop\Context\Item\Iface $context, $sitecode = 'default', $locale = null ) |
|
295 | + protected function setLocale(\Aimeos\MShop\Context\Item\Iface $context, $sitecode = 'default', $locale = null) |
|
296 | 296 | { |
297 | - $localeManager = \Aimeos\MShop\Factory::createManager( $context, 'locale' ); |
|
297 | + $localeManager = \Aimeos\MShop\Factory::createManager($context, 'locale'); |
|
298 | 298 | |
299 | 299 | try { |
300 | - $localeItem = $localeManager->bootstrap( $sitecode, $locale, '', false ); |
|
301 | - } catch( \Aimeos\MShop\Locale\Exception $e ) { |
|
300 | + $localeItem = $localeManager->bootstrap($sitecode, $locale, '', false); |
|
301 | + } catch (\Aimeos\MShop\Locale\Exception $e) { |
|
302 | 302 | $localeItem = $localeManager->createItem(); |
303 | 303 | } |
304 | 304 | |
305 | - $context->setLocale( $localeItem ); |
|
305 | + $context->setLocale($localeItem); |
|
306 | 306 | |
307 | 307 | return $context; |
308 | 308 | } |
@@ -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 | } |
@@ -35,19 +35,19 @@ discard block |
||
35 | 35 | * @param integer|null $id Unique resource ID |
36 | 36 | * @return \Illuminate\Http\Response Response object containing the generated output |
37 | 37 | */ |
38 | - public function deleteAction( Request $request, $site = 'default', $resource, $id = null ) |
|
38 | + public function deleteAction(Request $request, $site = 'default', $resource, $id = null) |
|
39 | 39 | { |
40 | - if( config( 'shop.authorize', true ) ) { |
|
41 | - $this->authorize( 'admin' ); |
|
40 | + if (config('shop.authorize', true)) { |
|
41 | + $this->authorize('admin'); |
|
42 | 42 | } |
43 | 43 | |
44 | 44 | $status = 500; |
45 | 45 | $header = $request->headers->all(); |
46 | 46 | |
47 | - $cntl = $this->createController( $site, $resource ); |
|
48 | - $result = $cntl->delete( $request->getContent(), $header, $status ); |
|
47 | + $cntl = $this->createController($site, $resource); |
|
48 | + $result = $cntl->delete($request->getContent(), $header, $status); |
|
49 | 49 | |
50 | - return $this->createResponse( $result, $status, $header ); |
|
50 | + return $this->createResponse($result, $status, $header); |
|
51 | 51 | } |
52 | 52 | |
53 | 53 | |
@@ -60,19 +60,19 @@ discard block |
||
60 | 60 | * @param integer|null $id Unique resource ID |
61 | 61 | * @return \Illuminate\Http\Response Response object containing the generated output |
62 | 62 | */ |
63 | - public function getAction( Request $request, $site = 'default', $resource, $id = null ) |
|
63 | + public function getAction(Request $request, $site = 'default', $resource, $id = null) |
|
64 | 64 | { |
65 | - if( config( 'shop.authorize', true ) ) { |
|
66 | - $this->authorize( 'admin' ); |
|
65 | + if (config('shop.authorize', true)) { |
|
66 | + $this->authorize('admin'); |
|
67 | 67 | } |
68 | 68 | |
69 | 69 | $status = 500; |
70 | 70 | $header = $request->headers->all(); |
71 | 71 | |
72 | - $cntl = $this->createController( $site, $resource ); |
|
73 | - $result = $cntl->get( $request->getContent(), $header, $status ); |
|
72 | + $cntl = $this->createController($site, $resource); |
|
73 | + $result = $cntl->get($request->getContent(), $header, $status); |
|
74 | 74 | |
75 | - return $this->createResponse( $result, $status, $header ); |
|
75 | + return $this->createResponse($result, $status, $header); |
|
76 | 76 | } |
77 | 77 | |
78 | 78 | |
@@ -85,19 +85,19 @@ discard block |
||
85 | 85 | * @param integer|null $id Unique resource ID |
86 | 86 | * @return \Illuminate\Http\Response Response object containing the generated output |
87 | 87 | */ |
88 | - public function patchAction( Request $request, $site = 'default', $resource, $id = null ) |
|
88 | + public function patchAction(Request $request, $site = 'default', $resource, $id = null) |
|
89 | 89 | { |
90 | - if( config( 'shop.authorize', true ) ) { |
|
91 | - $this->authorize( 'admin' ); |
|
90 | + if (config('shop.authorize', true)) { |
|
91 | + $this->authorize('admin'); |
|
92 | 92 | } |
93 | 93 | |
94 | 94 | $status = 500; |
95 | 95 | $header = $request->headers->all(); |
96 | 96 | |
97 | - $cntl = $this->createController( $site, $resource ); |
|
98 | - $result = $cntl->patch( $request->getContent(), $header, $status ); |
|
97 | + $cntl = $this->createController($site, $resource); |
|
98 | + $result = $cntl->patch($request->getContent(), $header, $status); |
|
99 | 99 | |
100 | - return $this->createResponse( $result, $status, $header ); |
|
100 | + return $this->createResponse($result, $status, $header); |
|
101 | 101 | } |
102 | 102 | |
103 | 103 | |
@@ -110,19 +110,19 @@ discard block |
||
110 | 110 | * @param integer $id Unique ID of the resource |
111 | 111 | * @return \Illuminate\Http\Response Response object containing the generated output |
112 | 112 | */ |
113 | - public function postAction( Request $request, $site = 'default', $resource, $id = null ) |
|
113 | + public function postAction(Request $request, $site = 'default', $resource, $id = null) |
|
114 | 114 | { |
115 | - if( config( 'shop.authorize', true ) ) { |
|
116 | - $this->authorize( 'admin' ); |
|
115 | + if (config('shop.authorize', true)) { |
|
116 | + $this->authorize('admin'); |
|
117 | 117 | } |
118 | 118 | |
119 | 119 | $status = 500; |
120 | 120 | $header = $request->headers->all(); |
121 | 121 | |
122 | - $cntl = $this->createController( $site, $resource ); |
|
123 | - $result = $cntl->post( $request->getContent(), $header, $status ); |
|
122 | + $cntl = $this->createController($site, $resource); |
|
123 | + $result = $cntl->post($request->getContent(), $header, $status); |
|
124 | 124 | |
125 | - return $this->createResponse( $result, $status, $header ); |
|
125 | + return $this->createResponse($result, $status, $header); |
|
126 | 126 | } |
127 | 127 | |
128 | 128 | |
@@ -135,19 +135,19 @@ discard block |
||
135 | 135 | * @param integer|null $id Unique resource ID |
136 | 136 | * @return \Illuminate\Http\Response Response object containing the generated output |
137 | 137 | */ |
138 | - public function putAction( Request $request, $site = 'default', $resource, $id = null ) |
|
138 | + public function putAction(Request $request, $site = 'default', $resource, $id = null) |
|
139 | 139 | { |
140 | - if( config( 'shop.authorize', true ) ) { |
|
141 | - $this->authorize( 'admin' ); |
|
140 | + if (config('shop.authorize', true)) { |
|
141 | + $this->authorize('admin'); |
|
142 | 142 | } |
143 | 143 | |
144 | 144 | $status = 500; |
145 | 145 | $header = $request->headers->all(); |
146 | 146 | |
147 | - $cntl = $this->createController( $site, $resource ); |
|
148 | - $result = $cntl->put( $request->getContent(), $header, $status ); |
|
147 | + $cntl = $this->createController($site, $resource); |
|
148 | + $result = $cntl->put($request->getContent(), $header, $status); |
|
149 | 149 | |
150 | - return $this->createResponse( $result, $status, $header ); |
|
150 | + return $this->createResponse($result, $status, $header); |
|
151 | 151 | } |
152 | 152 | |
153 | 153 | |
@@ -159,19 +159,19 @@ discard block |
||
159 | 159 | * @param string $sitecode Unique site code |
160 | 160 | * @return \Illuminate\Http\Response Response object containing the generated output |
161 | 161 | */ |
162 | - public function optionsAction( Request $request, $site = 'default', $resource = '' ) |
|
162 | + public function optionsAction(Request $request, $site = 'default', $resource = '') |
|
163 | 163 | { |
164 | - if( config( 'shop.authorize', true ) ) { |
|
165 | - $this->authorize( 'admin' ); |
|
164 | + if (config('shop.authorize', true)) { |
|
165 | + $this->authorize('admin'); |
|
166 | 166 | } |
167 | 167 | |
168 | 168 | $status = 500; |
169 | 169 | $header = $request->headers->all(); |
170 | 170 | |
171 | - $cntl = $this->createController( $site, $resource ); |
|
172 | - $result = $cntl->options( $request->getContent(), $header, $status ); |
|
171 | + $cntl = $this->createController($site, $resource); |
|
172 | + $result = $cntl->options($request->getContent(), $header, $status); |
|
173 | 173 | |
174 | - return $this->createResponse( $result, $status, $header ); |
|
174 | + return $this->createResponse($result, $status, $header); |
|
175 | 175 | } |
176 | 176 | |
177 | 177 | |
@@ -181,20 +181,20 @@ discard block |
||
181 | 181 | * @param string $sitecode Unique site code |
182 | 182 | * @return \Aimeos\MShop\Context\Item\Iface Context item |
183 | 183 | */ |
184 | - protected function createController( $sitecode, $resource ) |
|
184 | + protected function createController($sitecode, $resource) |
|
185 | 185 | { |
186 | - $lang = \Input::get( 'lang', config( 'app.locale', 'en' ) ); |
|
186 | + $lang = \Input::get('lang', config('app.locale', 'en')); |
|
187 | 187 | |
188 | - $aimeos = app( '\Aimeos\Shop\Base\Aimeos' )->get(); |
|
189 | - $templatePaths = $aimeos->getCustomPaths( 'controller/jsonadm/templates' ); |
|
188 | + $aimeos = app('\Aimeos\Shop\Base\Aimeos')->get(); |
|
189 | + $templatePaths = $aimeos->getCustomPaths('controller/jsonadm/templates'); |
|
190 | 190 | |
191 | - $context = app( '\Aimeos\Shop\Base\Context' )->get( false ); |
|
192 | - $context = $this->setLocale( $context, $sitecode, $lang ); |
|
191 | + $context = app('\Aimeos\Shop\Base\Context')->get(false); |
|
192 | + $context = $this->setLocale($context, $sitecode, $lang); |
|
193 | 193 | |
194 | - $view = app( '\Aimeos\Shop\Base\View' )->create( $context->getConfig(), $templatePaths, $lang ); |
|
195 | - $context->setView( $view ); |
|
194 | + $view = app('\Aimeos\Shop\Base\View')->create($context->getConfig(), $templatePaths, $lang); |
|
195 | + $context->setView($view); |
|
196 | 196 | |
197 | - return \Aimeos\Controller\JsonAdm\Factory::createController( $context, $templatePaths, $resource ); |
|
197 | + return \Aimeos\Controller\JsonAdm\Factory::createController($context, $templatePaths, $resource); |
|
198 | 198 | } |
199 | 199 | |
200 | 200 | |
@@ -206,12 +206,12 @@ discard block |
||
206 | 206 | * @param array $header List of HTTP headers |
207 | 207 | * @return \Illuminate\Http\Response HTTP response object |
208 | 208 | */ |
209 | - protected function createResponse( $content, $status, array $header ) |
|
209 | + protected function createResponse($content, $status, array $header) |
|
210 | 210 | { |
211 | - $response = \Response::make( $content, $status ); |
|
211 | + $response = \Response::make($content, $status); |
|
212 | 212 | |
213 | - foreach( $header as $key => $value ) { |
|
214 | - $response->header( $key, $value ); |
|
213 | + foreach ($header as $key => $value) { |
|
214 | + $response->header($key, $value); |
|
215 | 215 | } |
216 | 216 | |
217 | 217 | return $response; |
@@ -226,23 +226,23 @@ discard block |
||
226 | 226 | * @param string $lang ISO language code, e.g. "en" or "en_GB" |
227 | 227 | * @return \Aimeos\MShop\Context\Item\Iface Modified context object |
228 | 228 | */ |
229 | - protected function setLocale( \Aimeos\MShop\Context\Item\Iface $context, $sitecode, $lang ) |
|
229 | + protected function setLocale(\Aimeos\MShop\Context\Item\Iface $context, $sitecode, $lang) |
|
230 | 230 | { |
231 | - $localeManager = \Aimeos\MShop\Factory::createManager( $context, 'locale' ); |
|
231 | + $localeManager = \Aimeos\MShop\Factory::createManager($context, 'locale'); |
|
232 | 232 | |
233 | 233 | try |
234 | 234 | { |
235 | - $localeItem = $localeManager->bootstrap( $sitecode, '', '', false ); |
|
236 | - $localeItem->setLanguageId( null ); |
|
237 | - $localeItem->setCurrencyId( null ); |
|
235 | + $localeItem = $localeManager->bootstrap($sitecode, '', '', false); |
|
236 | + $localeItem->setLanguageId(null); |
|
237 | + $localeItem->setCurrencyId(null); |
|
238 | 238 | } |
239 | - catch( \Aimeos\MShop\Locale\Exception $e ) |
|
239 | + catch (\Aimeos\MShop\Locale\Exception $e) |
|
240 | 240 | { |
241 | 241 | $localeItem = $localeManager->createItem(); |
242 | 242 | } |
243 | 243 | |
244 | - $context->setLocale( $localeItem ); |
|
245 | - $context->setI18n( app('\Aimeos\Shop\Base\I18n')->get( array( $lang ) ) ); |
|
244 | + $context->setLocale($localeItem); |
|
245 | + $context->setI18n(app('\Aimeos\Shop\Base\I18n')->get(array($lang))); |
|
246 | 246 | |
247 | 247 | return $context; |
248 | 248 | } |
@@ -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; |
@@ -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; |
@@ -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 | } |
@@ -26,48 +26,48 @@ 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 | $fixed = $this->getFixedParams(); |
37 | 37 | |
38 | - $i18n = app('\Aimeos\Shop\Base\I18n')->get( array( $locale ) ); |
|
38 | + $i18n = app('\Aimeos\Shop\Base\I18n')->get(array($locale)); |
|
39 | 39 | $translation = $i18n[$locale]; |
40 | 40 | } |
41 | 41 | else |
42 | 42 | { |
43 | - $translation = new \Aimeos\MW\Translation\None( 'en' ); |
|
43 | + $translation = new \Aimeos\MW\Translation\None('en'); |
|
44 | 44 | } |
45 | 45 | |
46 | 46 | |
47 | - $view = new \Aimeos\MW\View\Standard( $templatePaths ); |
|
47 | + $view = new \Aimeos\MW\View\Standard($templatePaths); |
|
48 | 48 | |
49 | - $helper = new \Aimeos\MW\View\Helper\Translate\Standard( $view, $translation ); |
|
50 | - $view->addHelper( 'translate', $helper ); |
|
49 | + $helper = new \Aimeos\MW\View\Helper\Translate\Standard($view, $translation); |
|
50 | + $view->addHelper('translate', $helper); |
|
51 | 51 | |
52 | - $helper = new \Aimeos\MW\View\Helper\Url\Laravel5( $view, app('url'), $fixed ); |
|
53 | - $view->addHelper( 'url', $helper ); |
|
52 | + $helper = new \Aimeos\MW\View\Helper\Url\Laravel5($view, app('url'), $fixed); |
|
53 | + $view->addHelper('url', $helper); |
|
54 | 54 | |
55 | - $helper = new \Aimeos\MW\View\Helper\Param\Standard( $view, $params ); |
|
56 | - $view->addHelper( 'param', $helper ); |
|
55 | + $helper = new \Aimeos\MW\View\Helper\Param\Standard($view, $params); |
|
56 | + $view->addHelper('param', $helper); |
|
57 | 57 | |
58 | - $helper = new \Aimeos\MW\View\Helper\Config\Standard( $view, $config ); |
|
59 | - $view->addHelper( 'config', $helper ); |
|
58 | + $helper = new \Aimeos\MW\View\Helper\Config\Standard($view, $config); |
|
59 | + $view->addHelper('config', $helper); |
|
60 | 60 | |
61 | - $sepDec = $config->get( 'client/html/common/format/seperatorDecimal', '.' ); |
|
62 | - $sep1000 = $config->get( 'client/html/common/format/seperator1000', ' ' ); |
|
63 | - $helper = new \Aimeos\MW\View\Helper\Number\Standard( $view, $sepDec, $sep1000 ); |
|
64 | - $view->addHelper( 'number', $helper ); |
|
61 | + $sepDec = $config->get('client/html/common/format/seperatorDecimal', '.'); |
|
62 | + $sep1000 = $config->get('client/html/common/format/seperator1000', ' '); |
|
63 | + $helper = new \Aimeos\MW\View\Helper\Number\Standard($view, $sepDec, $sep1000); |
|
64 | + $view->addHelper('number', $helper); |
|
65 | 65 | |
66 | - $helper = new \Aimeos\MW\View\Helper\Request\Laravel5( $view, \Request::instance() ); |
|
67 | - $view->addHelper( 'request', $helper ); |
|
66 | + $helper = new \Aimeos\MW\View\Helper\Request\Laravel5($view, \Request::instance()); |
|
67 | + $view->addHelper('request', $helper); |
|
68 | 68 | |
69 | - $helper = new \Aimeos\MW\View\Helper\Csrf\Standard( $view, '_token', csrf_token() ); |
|
70 | - $view->addHelper( 'csrf', $helper ); |
|
69 | + $helper = new \Aimeos\MW\View\Helper\Csrf\Standard($view, '_token', csrf_token()); |
|
70 | + $view->addHelper('csrf', $helper); |
|
71 | 71 | |
72 | 72 | return $view; |
73 | 73 | } |
@@ -82,15 +82,15 @@ discard block |
||
82 | 82 | { |
83 | 83 | $fixed = array(); |
84 | 84 | |
85 | - if( ( $value = \Route::input( 'site' ) ) !== null ) { |
|
85 | + if (($value = \Route::input('site')) !== null) { |
|
86 | 86 | $fixed['site'] = $value; |
87 | 87 | } |
88 | 88 | |
89 | - if( ( $value = \Route::input( 'locale' ) ) !== null ) { |
|
89 | + if (($value = \Route::input('locale')) !== null) { |
|
90 | 90 | $fixed['locale'] = $value; |
91 | 91 | } |
92 | 92 | |
93 | - if( ( $value = \Route::input( 'currency' ) ) !== null ) { |
|
93 | + if (($value = \Route::input('currency')) !== null) { |
|
94 | 94 | $fixed['currency'] = $value; |
95 | 95 | } |
96 | 96 |
@@ -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 |
@@ -36,21 +36,21 @@ discard block |
||
36 | 36 | */ |
37 | 37 | public function fire() |
38 | 38 | { |
39 | - $aimeos = $this->getLaravel()->make( '\Aimeos\Shop\Base\Aimeos' )->get(); |
|
39 | + $aimeos = $this->getLaravel()->make('\Aimeos\Shop\Base\Aimeos')->get(); |
|
40 | 40 | $context = $this->getContext(); |
41 | 41 | |
42 | - $jobs = explode( ' ', $this->argument( 'jobs' ) ); |
|
43 | - $localeManager = \Aimeos\MShop\Locale\Manager\Factory::createManager( $context ); |
|
42 | + $jobs = explode(' ', $this->argument('jobs')); |
|
43 | + $localeManager = \Aimeos\MShop\Locale\Manager\Factory::createManager($context); |
|
44 | 44 | |
45 | - foreach( $this->getSiteItems( $context, $this->argument( 'site' ) ) as $siteItem ) |
|
45 | + foreach ($this->getSiteItems($context, $this->argument('site')) as $siteItem) |
|
46 | 46 | { |
47 | - $localeItem = $localeManager->bootstrap( $siteItem->getCode(), 'en', '', false ); |
|
48 | - $context->setLocale( $localeItem ); |
|
47 | + $localeItem = $localeManager->bootstrap($siteItem->getCode(), 'en', '', false); |
|
48 | + $context->setLocale($localeItem); |
|
49 | 49 | |
50 | - $this->info( sprintf( 'Executing the Aimeos jobs for "%s"', $siteItem->getCode() ) ); |
|
50 | + $this->info(sprintf('Executing the Aimeos jobs for "%s"', $siteItem->getCode())); |
|
51 | 51 | |
52 | - foreach( $jobs as $jobname ) { |
|
53 | - \Aimeos\Controller\Jobs\Factory::createController( $context, $aimeos, $jobname )->run(); |
|
52 | + foreach ($jobs as $jobname) { |
|
53 | + \Aimeos\Controller\Jobs\Factory::createController($context, $aimeos, $jobname)->run(); |
|
54 | 54 | } |
55 | 55 | } |
56 | 56 | } |
@@ -64,8 +64,8 @@ discard block |
||
64 | 64 | protected function getArguments() |
65 | 65 | { |
66 | 66 | return array( |
67 | - array( 'jobs', InputArgument::REQUIRED, 'One or more job controller names like "admin/job customer/email/watch"' ), |
|
68 | - array( 'site', InputArgument::OPTIONAL, 'Site codes to execute the jobs for like "default unittest" (none for all)' ), |
|
67 | + array('jobs', InputArgument::REQUIRED, 'One or more job controller names like "admin/job customer/email/watch"'), |
|
68 | + array('site', InputArgument::OPTIONAL, 'Site codes to execute the jobs for like "default unittest" (none for all)'), |
|
69 | 69 | ); |
70 | 70 | } |
71 | 71 | |
@@ -89,17 +89,17 @@ discard block |
||
89 | 89 | { |
90 | 90 | $lv = $this->getLaravel(); |
91 | 91 | |
92 | - $context = $lv->make( '\Aimeos\Shop\Base\Context' )->get( false ); |
|
93 | - $tmplPaths = $lv->make( '\Aimeos\Shop\Base\Aimeos' )->get()->getCustomPaths( 'controller/jobs/layouts' ); |
|
94 | - $view = $lv->make( '\Aimeos\Shop\Base\View' )->create( $context->getConfig(), $tmplPaths ); |
|
92 | + $context = $lv->make('\Aimeos\Shop\Base\Context')->get(false); |
|
93 | + $tmplPaths = $lv->make('\Aimeos\Shop\Base\Aimeos')->get()->getCustomPaths('controller/jobs/layouts'); |
|
94 | + $view = $lv->make('\Aimeos\Shop\Base\View')->create($context->getConfig(), $tmplPaths); |
|
95 | 95 | |
96 | - $langManager = \Aimeos\MShop\Locale\Manager\Factory::createManager( $context )->getSubManager( 'language' ); |
|
97 | - $langids = array_keys( $langManager->searchItems( $langManager->createSearch( true ) ) ); |
|
98 | - $i18n = $lv->make( '\Aimeos\Shop\Base\I18n' )->get( $langids ); |
|
96 | + $langManager = \Aimeos\MShop\Locale\Manager\Factory::createManager($context)->getSubManager('language'); |
|
97 | + $langids = array_keys($langManager->searchItems($langManager->createSearch(true))); |
|
98 | + $i18n = $lv->make('\Aimeos\Shop\Base\I18n')->get($langids); |
|
99 | 99 | |
100 | - $context->setEditor( 'aimeos:jobs' ); |
|
101 | - $context->setView( $view ); |
|
102 | - $context->setI18n( $i18n ); |
|
100 | + $context->setEditor('aimeos:jobs'); |
|
101 | + $context->setView($view); |
|
102 | + $context->setI18n($i18n); |
|
103 | 103 | |
104 | 104 | return $context; |
105 | 105 | } |
@@ -35,18 +35,18 @@ discard block |
||
35 | 35 | * @param string $classname Name of the setup task class |
36 | 36 | * @return boolean True if class is found, false if not |
37 | 37 | */ |
38 | - public static function autoload( $classname ) |
|
38 | + public static function autoload($classname) |
|
39 | 39 | { |
40 | - if( strncmp( $classname, 'Aimeos\\MW\\Setup\\Task\\', 21 ) === 0 ) |
|
40 | + if (strncmp($classname, 'Aimeos\\MW\\Setup\\Task\\', 21) === 0) |
|
41 | 41 | { |
42 | - $fileName = substr( $classname, 21 ) . '.php'; |
|
43 | - $paths = explode( PATH_SEPARATOR, get_include_path() ); |
|
42 | + $fileName = substr($classname, 21) . '.php'; |
|
43 | + $paths = explode(PATH_SEPARATOR, get_include_path()); |
|
44 | 44 | |
45 | - foreach( $paths as $path ) |
|
45 | + foreach ($paths as $path) |
|
46 | 46 | { |
47 | 47 | $file = $path . DIRECTORY_SEPARATOR . $fileName; |
48 | 48 | |
49 | - if( file_exists( $file ) === true && ( include_once $file ) !== false ) { |
|
49 | + if (file_exists($file) === true && (include_once $file) !== false) { |
|
50 | 50 | return true; |
51 | 51 | } |
52 | 52 | } |
@@ -63,33 +63,33 @@ discard block |
||
63 | 63 | */ |
64 | 64 | public function fire() |
65 | 65 | { |
66 | - $ctx = $this->getLaravel()->make( '\Aimeos\Shop\Base\Context' )->get( false ); |
|
67 | - $ctx->setEditor( 'aimeos:setup' ); |
|
66 | + $ctx = $this->getLaravel()->make('\Aimeos\Shop\Base\Context')->get(false); |
|
67 | + $ctx->setEditor('aimeos:setup'); |
|
68 | 68 | |
69 | 69 | $config = $ctx->getConfig(); |
70 | - $site = $this->argument( 'site' ); |
|
71 | - $template = $this->argument( 'tplsite' ); |
|
70 | + $site = $this->argument('site'); |
|
71 | + $template = $this->argument('tplsite'); |
|
72 | 72 | |
73 | - $config->set( 'setup/site', $site ); |
|
74 | - $dbconfig = $this->getDbConfig( $config ); |
|
75 | - $this->setOptions( $config ); |
|
73 | + $config->set('setup/site', $site); |
|
74 | + $dbconfig = $this->getDbConfig($config); |
|
75 | + $this->setOptions($config); |
|
76 | 76 | |
77 | - $taskPaths = $this->getLaravel()->make( '\Aimeos\Shop\Base\Aimeos' )->get()->getSetupPaths( $template ); |
|
77 | + $taskPaths = $this->getLaravel()->make('\Aimeos\Shop\Base\Aimeos')->get()->getSetupPaths($template); |
|
78 | 78 | |
79 | 79 | $includePaths = $taskPaths; |
80 | 80 | $includePaths[] = get_include_path(); |
81 | 81 | |
82 | - if( set_include_path( implode( PATH_SEPARATOR, $includePaths ) ) === false ) { |
|
83 | - throw new Exception( 'Unable to extend include path' ); |
|
82 | + if (set_include_path(implode(PATH_SEPARATOR, $includePaths)) === false) { |
|
83 | + throw new Exception('Unable to extend include path'); |
|
84 | 84 | } |
85 | 85 | |
86 | - spl_autoload_register( '\Aimeos\Shop\Command\SetupCommand::autoload', true ); |
|
86 | + spl_autoload_register('\Aimeos\Shop\Command\SetupCommand::autoload', true); |
|
87 | 87 | |
88 | - $manager = new \Aimeos\MW\Setup\Manager\Multiple( $ctx->getDatabaseManager(), $dbconfig, $taskPaths, $ctx ); |
|
88 | + $manager = new \Aimeos\MW\Setup\Manager\Multiple($ctx->getDatabaseManager(), $dbconfig, $taskPaths, $ctx); |
|
89 | 89 | |
90 | - $this->info( sprintf( 'Initializing or updating the Aimeos database tables for site "%1$s"', $site ) ); |
|
90 | + $this->info(sprintf('Initializing or updating the Aimeos database tables for site "%1$s"', $site)); |
|
91 | 91 | |
92 | - $manager->run( 'mysql' ); |
|
92 | + $manager->run('mysql'); |
|
93 | 93 | } |
94 | 94 | |
95 | 95 | |
@@ -101,8 +101,8 @@ discard block |
||
101 | 101 | protected function getArguments() |
102 | 102 | { |
103 | 103 | return array( |
104 | - array( 'site', InputArgument::OPTIONAL, 'Site for updating database entries', 'default' ), |
|
105 | - array( 'tplsite', InputArgument::OPTIONAL, 'Site used as template for creating the new one', 'default' ), |
|
104 | + array('site', InputArgument::OPTIONAL, 'Site for updating database entries', 'default'), |
|
105 | + array('tplsite', InputArgument::OPTIONAL, 'Site used as template for creating the new one', 'default'), |
|
106 | 106 | ); |
107 | 107 | } |
108 | 108 | |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | protected function getOptions() |
116 | 116 | { |
117 | 117 | return array( |
118 | - array( 'option', null, InputOption::VALUE_REQUIRED, 'Optional setup configuration, name and value are separated by ":" like "setup/default/demo:1"', array() ), |
|
118 | + array('option', null, InputOption::VALUE_REQUIRED, 'Optional setup configuration, name and value are separated by ":" like "setup/default/demo:1"', array()), |
|
119 | 119 | ); |
120 | 120 | } |
121 | 121 | |
@@ -126,14 +126,14 @@ discard block |
||
126 | 126 | * @param \Aimeos\MW\Config\Iface $conf Config object |
127 | 127 | * @return array Multi-dimensional associative list of database configuration parameters |
128 | 128 | */ |
129 | - protected function getDbConfig( \Aimeos\MW\Config\Iface $conf ) |
|
129 | + protected function getDbConfig(\Aimeos\MW\Config\Iface $conf) |
|
130 | 130 | { |
131 | - $dbconfig = $conf->get( 'resource', array() ); |
|
131 | + $dbconfig = $conf->get('resource', array()); |
|
132 | 132 | |
133 | - foreach( $dbconfig as $rname => $dbconf ) |
|
133 | + foreach ($dbconfig as $rname => $dbconf) |
|
134 | 134 | { |
135 | - if( strncmp( $rname, 'db', 2 ) !== 0 ) { |
|
136 | - unset( $dbconfig[$rname] ); |
|
135 | + if (strncmp($rname, 'db', 2) !== 0) { |
|
136 | + unset($dbconfig[$rname]); |
|
137 | 137 | } |
138 | 138 | } |
139 | 139 | |
@@ -148,12 +148,12 @@ discard block |
||
148 | 148 | * @param array Associative list of database configurations |
149 | 149 | * @throws \RuntimeException If the format of the options is invalid |
150 | 150 | */ |
151 | - protected function setOptions( \Aimeos\MW\Config\Iface $conf ) |
|
151 | + protected function setOptions(\Aimeos\MW\Config\Iface $conf) |
|
152 | 152 | { |
153 | - foreach( (array) $this->option( 'option' ) as $option ) |
|
153 | + foreach ((array) $this->option('option') as $option) |
|
154 | 154 | { |
155 | - list( $name, $value ) = explode( ':', $option ); |
|
156 | - $conf->set( $name, $value ); |
|
155 | + list($name, $value) = explode(':', $option); |
|
156 | + $conf->set($name, $value); |
|
157 | 157 | } |
158 | 158 | } |
159 | 159 | } |