@@ -34,63 +34,63 @@ discard block |
||
34 | 34 | * @param \Illuminate\Http\Request $request Laravel request object |
35 | 35 | * @return \Illuminate\Contracts\View\View View for rendering the output |
36 | 36 | */ |
37 | - public function indexAction( Request $request ) |
|
37 | + public function indexAction(Request $request) |
|
38 | 38 | { |
39 | - if( config( 'shop.authorize', true ) ) { |
|
40 | - $this->authorize( 'admin' ); |
|
39 | + if (config('shop.authorize', true)) { |
|
40 | + $this->authorize('admin'); |
|
41 | 41 | } |
42 | 42 | |
43 | - $site = Route::input( 'site', 'default' ); |
|
44 | - $lang = Input::get( 'lang', config( 'app.locale', 'en' ) ); |
|
43 | + $site = Route::input('site', 'default'); |
|
44 | + $lang = Input::get('lang', config('app.locale', 'en')); |
|
45 | 45 | |
46 | - $aimeos = app( '\Aimeos\Shop\Base\Aimeos' ); |
|
46 | + $aimeos = app('\Aimeos\Shop\Base\Aimeos'); |
|
47 | 47 | |
48 | 48 | $bootstrap = $aimeos->get(); |
49 | - $cntlPaths = $bootstrap->getCustomPaths( 'controller/extjs' ); |
|
49 | + $cntlPaths = $bootstrap->getCustomPaths('controller/extjs'); |
|
50 | 50 | |
51 | - $context = app( '\Aimeos\Shop\Base\Context' )->get( false ); |
|
52 | - $context = $this->setLocale( $context, $site, $lang ); |
|
51 | + $context = app('\Aimeos\Shop\Base\Context')->get(false); |
|
52 | + $context = $this->setLocale($context, $site, $lang); |
|
53 | 53 | |
54 | - $controller = new \Aimeos\Controller\ExtJS\JsonRpc( $context, $cntlPaths ); |
|
54 | + $controller = new \Aimeos\Controller\ExtJS\JsonRpc($context, $cntlPaths); |
|
55 | 55 | $cssFiles = array(); |
56 | 56 | |
57 | - foreach( $bootstrap->getCustomPaths( 'admin/extjs' ) as $base => $paths ) |
|
57 | + foreach ($bootstrap->getCustomPaths('admin/extjs') as $base => $paths) |
|
58 | 58 | { |
59 | - foreach( $paths as $path ) |
|
59 | + foreach ($paths as $path) |
|
60 | 60 | { |
61 | 61 | $jsbAbsPath = $base . '/' . $path; |
62 | 62 | |
63 | - if( !is_file( $jsbAbsPath ) ) { |
|
64 | - throw new \Exception( sprintf( 'JSB2 file "%1$s" not found', $jsbAbsPath ) ); |
|
63 | + if (!is_file($jsbAbsPath)) { |
|
64 | + throw new \Exception(sprintf('JSB2 file "%1$s" not found', $jsbAbsPath)); |
|
65 | 65 | } |
66 | 66 | |
67 | - $jsb2 = new \Aimeos\MW\Jsb2\Standard( $jsbAbsPath, dirname( $path ) ); |
|
68 | - $cssFiles = array_merge( $cssFiles, $jsb2->getUrls( 'css' ) ); |
|
67 | + $jsb2 = new \Aimeos\MW\Jsb2\Standard($jsbAbsPath, dirname($path)); |
|
68 | + $cssFiles = array_merge($cssFiles, $jsb2->getUrls('css')); |
|
69 | 69 | } |
70 | 70 | } |
71 | 71 | |
72 | - $jqadmUrl = route( 'aimeos_shop_jqadm_search', array( 'site' => $site, 'resource' => 'product' ) ); |
|
73 | - $jsonUrl = route( 'aimeos_shop_extadm_json', array( 'site' => $site, '_token' => csrf_token() ) ); |
|
74 | - $adminUrl = route( 'aimeos_shop_extadm', array( 'site' => '<site>', 'lang' => '<lang>', 'tab' => '<tab>' ) ); |
|
72 | + $jqadmUrl = route('aimeos_shop_jqadm_search', array('site' => $site, 'resource' => 'product')); |
|
73 | + $jsonUrl = route('aimeos_shop_extadm_json', array('site' => $site, '_token' => csrf_token())); |
|
74 | + $adminUrl = route('aimeos_shop_extadm', array('site' => '<site>', 'lang' => '<lang>', 'tab' => '<tab>')); |
|
75 | 75 | |
76 | 76 | $vars = array( |
77 | 77 | 'lang' => $lang, |
78 | 78 | 'cssFiles' => $cssFiles, |
79 | - 'languages' => $this->getJsonLanguages( $context), |
|
80 | - 'config' => $this->getJsonClientConfig( $context ), |
|
81 | - 'site' => $this->getJsonSiteItem( $context, $site ), |
|
82 | - 'i18nContent' => $this->getJsonClientI18n( $bootstrap->getI18nPaths(), $lang ), |
|
79 | + 'languages' => $this->getJsonLanguages($context), |
|
80 | + 'config' => $this->getJsonClientConfig($context), |
|
81 | + 'site' => $this->getJsonSiteItem($context, $site), |
|
82 | + 'i18nContent' => $this->getJsonClientI18n($bootstrap->getI18nPaths(), $lang), |
|
83 | 83 | 'searchSchemas' => $controller->getJsonSearchSchemas(), |
84 | 84 | 'itemSchemas' => $controller->getJsonItemSchemas(), |
85 | - 'smd' => $controller->getJsonSmd( $jsonUrl ), |
|
86 | - 'urlTemplate' => str_replace( ['<', '>'], ['{', '}'], urldecode( $adminUrl ) ), |
|
87 | - 'uploaddir' => config( 'shop::uploaddir' ), |
|
88 | - 'activeTab' => Input::get( 'tab', 0 ), |
|
85 | + 'smd' => $controller->getJsonSmd($jsonUrl), |
|
86 | + 'urlTemplate' => str_replace(['<', '>'], ['{', '}'], urldecode($adminUrl)), |
|
87 | + 'uploaddir' => config('shop::uploaddir'), |
|
88 | + 'activeTab' => Input::get('tab', 0), |
|
89 | 89 | 'version' => $aimeos->getVersion(), |
90 | 90 | 'jqadmurl' => $jqadmUrl, |
91 | 91 | ); |
92 | 92 | |
93 | - return View::make( 'shop::extadm.index', $vars ); |
|
93 | + return View::make('shop::extadm.index', $vars); |
|
94 | 94 | } |
95 | 95 | |
96 | 96 | |
@@ -100,23 +100,23 @@ discard block |
||
100 | 100 | * @param \Illuminate\Http\Request $request Laravel request object |
101 | 101 | * @return \Illuminate\Contracts\View\View View for rendering the output |
102 | 102 | */ |
103 | - public function doAction( Request $request ) |
|
103 | + public function doAction(Request $request) |
|
104 | 104 | { |
105 | - if( config( 'shop.authorize', true ) ) { |
|
106 | - $this->authorize( 'admin' ); |
|
105 | + if (config('shop.authorize', true)) { |
|
106 | + $this->authorize('admin'); |
|
107 | 107 | } |
108 | 108 | |
109 | - $aimeos = app( '\Aimeos\Shop\Base\Aimeos' )->get(); |
|
110 | - $cntlPaths = $aimeos->getCustomPaths( 'controller/extjs' ); |
|
109 | + $aimeos = app('\Aimeos\Shop\Base\Aimeos')->get(); |
|
110 | + $cntlPaths = $aimeos->getCustomPaths('controller/extjs'); |
|
111 | 111 | |
112 | - $context = app( '\Aimeos\Shop\Base\Context' )->get( false ); |
|
113 | - $context->setView( app( '\Aimeos\Shop\Base\View' )->create( $context->getConfig(), array() ) ); |
|
114 | - $context = $this->setLocale( $context ); |
|
112 | + $context = app('\Aimeos\Shop\Base\Context')->get(false); |
|
113 | + $context->setView(app('\Aimeos\Shop\Base\View')->create($context->getConfig(), array())); |
|
114 | + $context = $this->setLocale($context); |
|
115 | 115 | |
116 | - $controller = new \Aimeos\Controller\ExtJS\JsonRpc( $context, $cntlPaths ); |
|
116 | + $controller = new \Aimeos\Controller\ExtJS\JsonRpc($context, $cntlPaths); |
|
117 | 117 | |
118 | - $response = $controller->process( Input::instance()->request->all(), $request->getContent() ); |
|
119 | - return View::make( 'shop::extadm.do', array( 'output' => $response ) ); |
|
118 | + $response = $controller->process(Input::instance()->request->all(), $request->getContent()); |
|
119 | + return View::make('shop::extadm.do', array('output' => $response)); |
|
120 | 120 | } |
121 | 121 | |
122 | 122 | |
@@ -127,32 +127,32 @@ discard block |
||
127 | 127 | */ |
128 | 128 | public function fileAction() |
129 | 129 | { |
130 | - if( config( 'shop.authorize', true ) ) { |
|
131 | - $this->authorize( 'admin' ); |
|
130 | + if (config('shop.authorize', true)) { |
|
131 | + $this->authorize('admin'); |
|
132 | 132 | } |
133 | 133 | |
134 | 134 | $contents = ''; |
135 | 135 | $jsFiles = array(); |
136 | - $aimeos = app( '\Aimeos\Shop\Base\Aimeos' )->get(); |
|
136 | + $aimeos = app('\Aimeos\Shop\Base\Aimeos')->get(); |
|
137 | 137 | |
138 | - foreach( $aimeos->getCustomPaths( 'admin/extjs' ) as $base => $paths ) |
|
138 | + foreach ($aimeos->getCustomPaths('admin/extjs') as $base => $paths) |
|
139 | 139 | { |
140 | - foreach( $paths as $path ) |
|
140 | + foreach ($paths as $path) |
|
141 | 141 | { |
142 | 142 | $jsbAbsPath = $base . '/' . $path; |
143 | - $jsb2 = new \Aimeos\MW\Jsb2\Standard( $jsbAbsPath, dirname( $jsbAbsPath ) ); |
|
144 | - $jsFiles = array_merge( $jsFiles, $jsb2->getFiles( 'js' ) ); |
|
143 | + $jsb2 = new \Aimeos\MW\Jsb2\Standard($jsbAbsPath, dirname($jsbAbsPath)); |
|
144 | + $jsFiles = array_merge($jsFiles, $jsb2->getFiles('js')); |
|
145 | 145 | } |
146 | 146 | } |
147 | 147 | |
148 | - foreach( $jsFiles as $file ) |
|
148 | + foreach ($jsFiles as $file) |
|
149 | 149 | { |
150 | - if( ( $content = file_get_contents( $file ) ) !== false ) { |
|
150 | + if (($content = file_get_contents($file)) !== false) { |
|
151 | 151 | $contents .= $content; |
152 | 152 | } |
153 | 153 | } |
154 | 154 | |
155 | - return response( $contents )->header( 'Content-Type', 'application/javascript' ); |
|
155 | + return response($contents)->header('Content-Type', 'application/javascript'); |
|
156 | 156 | } |
157 | 157 | |
158 | 158 | |
@@ -162,15 +162,15 @@ discard block |
||
162 | 162 | * @param \Aimeos\MShop\Context\Item\Iface $context Context object |
163 | 163 | * @return array List of language IDs with labels |
164 | 164 | */ |
165 | - protected function getJsonLanguages( \Aimeos\MShop\Context\Item\Iface $context ) |
|
165 | + protected function getJsonLanguages(\Aimeos\MShop\Context\Item\Iface $context) |
|
166 | 166 | { |
167 | 167 | $result = array(); |
168 | 168 | |
169 | - foreach( app( '\Aimeos\Shop\Base\Aimeos' )->get()->getI18nList( 'admin' ) as $id ) { |
|
170 | - $result[] = array( 'id' => $id, 'label' => $id ); |
|
169 | + foreach (app('\Aimeos\Shop\Base\Aimeos')->get()->getI18nList('admin') as $id) { |
|
170 | + $result[] = array('id' => $id, 'label' => $id); |
|
171 | 171 | } |
172 | 172 | |
173 | - return json_encode( $result ); |
|
173 | + return json_encode($result); |
|
174 | 174 | } |
175 | 175 | |
176 | 176 | |
@@ -180,10 +180,10 @@ discard block |
||
180 | 180 | * @param \Aimeos\MShop\Context\Item\Iface $context Context item object |
181 | 181 | * @return string JSON encoded configuration object |
182 | 182 | */ |
183 | - protected function getJsonClientConfig( \Aimeos\MShop\Context\Item\Iface $context ) |
|
183 | + protected function getJsonClientConfig(\Aimeos\MShop\Context\Item\Iface $context) |
|
184 | 184 | { |
185 | - $config = $context->getConfig()->get( 'admin/extjs', array() ); |
|
186 | - return json_encode( array( 'admin' => array( 'extjs' => $config ) ), JSON_FORCE_OBJECT ); |
|
185 | + $config = $context->getConfig()->get('admin/extjs', array()); |
|
186 | + return json_encode(array('admin' => array('extjs' => $config)), JSON_FORCE_OBJECT); |
|
187 | 187 | } |
188 | 188 | |
189 | 189 | |
@@ -194,16 +194,16 @@ discard block |
||
194 | 194 | * @param string $lang ISO language code like "en" or "en_GB" |
195 | 195 | * @return string JSON encoded translation object |
196 | 196 | */ |
197 | - protected function getJsonClientI18n( array $i18nPaths, $lang ) |
|
197 | + protected function getJsonClientI18n(array $i18nPaths, $lang) |
|
198 | 198 | { |
199 | - $i18n = new \Aimeos\MW\Translation\Gettext( $i18nPaths, $lang ); |
|
199 | + $i18n = new \Aimeos\MW\Translation\Gettext($i18nPaths, $lang); |
|
200 | 200 | |
201 | 201 | $content = array( |
202 | - 'admin' => $i18n->getAll( 'admin' ), |
|
203 | - 'admin/ext' => $i18n->getAll( 'admin/ext' ), |
|
202 | + 'admin' => $i18n->getAll('admin'), |
|
203 | + 'admin/ext' => $i18n->getAll('admin/ext'), |
|
204 | 204 | ); |
205 | 205 | |
206 | - return json_encode( $content, JSON_FORCE_OBJECT ); |
|
206 | + return json_encode($content, JSON_FORCE_OBJECT); |
|
207 | 207 | } |
208 | 208 | |
209 | 209 | |
@@ -215,19 +215,19 @@ discard block |
||
215 | 215 | * @return string JSON encoded site item object |
216 | 216 | * @throws Exception If no site item was found for the code |
217 | 217 | */ |
218 | - protected function getJsonSiteItem( \Aimeos\MShop\Context\Item\Iface $context, $site ) |
|
218 | + protected function getJsonSiteItem(\Aimeos\MShop\Context\Item\Iface $context, $site) |
|
219 | 219 | { |
220 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'locale/site' ); |
|
220 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'locale/site'); |
|
221 | 221 | |
222 | 222 | $criteria = $manager->createSearch(); |
223 | - $criteria->setConditions( $criteria->compare( '==', 'locale.site.code', $site ) ); |
|
224 | - $items = $manager->searchItems( $criteria ); |
|
223 | + $criteria->setConditions($criteria->compare('==', 'locale.site.code', $site)); |
|
224 | + $items = $manager->searchItems($criteria); |
|
225 | 225 | |
226 | - if( ( $item = reset( $items ) ) === false ) { |
|
227 | - throw new \Exception( sprintf( 'No site found for code "%1$s"', $site ) ); |
|
226 | + if (($item = reset($items)) === false) { |
|
227 | + throw new \Exception(sprintf('No site found for code "%1$s"', $site)); |
|
228 | 228 | } |
229 | 229 | |
230 | - return json_encode( $item->toArray() ); |
|
230 | + return json_encode($item->toArray()); |
|
231 | 231 | } |
232 | 232 | |
233 | 233 | |
@@ -239,17 +239,17 @@ discard block |
||
239 | 239 | * @param string $locale ISO language code, e.g. "en" or "en_GB" |
240 | 240 | * @return \Aimeos\MShop\Context\Item\Iface Modified context object |
241 | 241 | */ |
242 | - protected function setLocale( \Aimeos\MShop\Context\Item\Iface $context, $sitecode = 'default', $locale = null ) |
|
242 | + protected function setLocale(\Aimeos\MShop\Context\Item\Iface $context, $sitecode = 'default', $locale = null) |
|
243 | 243 | { |
244 | - $localeManager = \Aimeos\MShop\Factory::createManager( $context, 'locale' ); |
|
244 | + $localeManager = \Aimeos\MShop\Factory::createManager($context, 'locale'); |
|
245 | 245 | |
246 | 246 | try { |
247 | - $localeItem = $localeManager->bootstrap( $sitecode, $locale, '', false ); |
|
248 | - } catch( \Aimeos\MShop\Locale\Exception $e ) { |
|
247 | + $localeItem = $localeManager->bootstrap($sitecode, $locale, '', false); |
|
248 | + } catch (\Aimeos\MShop\Locale\Exception $e) { |
|
249 | 249 | $localeItem = $localeManager->createItem(); |
250 | 250 | } |
251 | 251 | |
252 | - $context->setLocale( $localeItem ); |
|
252 | + $context->setLocale($localeItem); |
|
253 | 253 | |
254 | 254 | return $context; |
255 | 255 | } |