@@ -34,38 +34,38 @@ discard block |
||
34 | 34 | */ |
35 | 35 | public function fileAction() |
36 | 36 | { |
37 | - if( config( 'shop.authorize', true ) ) { |
|
38 | - $this->authorize( 'admin', [['admin', 'editor']] ); |
|
37 | + if (config('shop.authorize', true)) { |
|
38 | + $this->authorize('admin', [['admin', 'editor']]); |
|
39 | 39 | } |
40 | 40 | |
41 | 41 | $contents = ''; |
42 | 42 | $files = array(); |
43 | - $aimeos = app( '\Aimeos\Shop\Base\Aimeos' )->get(); |
|
44 | - $type = Route::input( 'type', Input::get( 'type', 'js' ) ); |
|
43 | + $aimeos = app('\Aimeos\Shop\Base\Aimeos')->get(); |
|
44 | + $type = Route::input('type', Input::get('type', 'js')); |
|
45 | 45 | |
46 | - foreach( $aimeos->getCustomPaths( 'admin/jqadm' ) as $base => $paths ) |
|
46 | + foreach ($aimeos->getCustomPaths('admin/jqadm') as $base => $paths) |
|
47 | 47 | { |
48 | - foreach( $paths as $path ) |
|
48 | + foreach ($paths as $path) |
|
49 | 49 | { |
50 | - $jsbAbsPath = $base . '/' . $path; |
|
51 | - $jsb2 = new \Aimeos\MW\Jsb2\Standard( $jsbAbsPath, dirname( $jsbAbsPath ) ); |
|
52 | - $files = array_merge( $files, $jsb2->getFiles( $type ) ); |
|
50 | + $jsbAbsPath = $base.'/'.$path; |
|
51 | + $jsb2 = new \Aimeos\MW\Jsb2\Standard($jsbAbsPath, dirname($jsbAbsPath)); |
|
52 | + $files = array_merge($files, $jsb2->getFiles($type)); |
|
53 | 53 | } |
54 | 54 | } |
55 | 55 | |
56 | - foreach( $files as $file ) |
|
56 | + foreach ($files as $file) |
|
57 | 57 | { |
58 | - if( ( $content = file_get_contents( $file ) ) !== false ) { |
|
58 | + if (($content = file_get_contents($file)) !== false) { |
|
59 | 59 | $contents .= $content; |
60 | 60 | } |
61 | 61 | } |
62 | 62 | |
63 | - $response = response( $contents ); |
|
63 | + $response = response($contents); |
|
64 | 64 | |
65 | - if( $type === 'js' ) { |
|
66 | - $response->header( 'Content-Type', 'application/javascript' ); |
|
67 | - } elseif( $type === 'css' ) { |
|
68 | - $response->header( 'Content-Type', 'text/css' ); |
|
65 | + if ($type === 'js') { |
|
66 | + $response->header('Content-Type', 'application/javascript'); |
|
67 | + } elseif ($type === 'css') { |
|
68 | + $response->header('Content-Type', 'text/css'); |
|
69 | 69 | } |
70 | 70 | |
71 | 71 | return $response; |
@@ -79,12 +79,12 @@ discard block |
||
79 | 79 | */ |
80 | 80 | public function copyAction() |
81 | 81 | { |
82 | - if( config( 'shop.authorize', true ) ) { |
|
83 | - $this->authorize( 'admin', [['admin', 'editor']] ); |
|
82 | + if (config('shop.authorize', true)) { |
|
83 | + $this->authorize('admin', [['admin', 'editor']]); |
|
84 | 84 | } |
85 | 85 | |
86 | 86 | $cntl = $this->createClient(); |
87 | - return $this->getHtml( $cntl->copy() ); |
|
87 | + return $this->getHtml($cntl->copy()); |
|
88 | 88 | } |
89 | 89 | |
90 | 90 | |
@@ -95,12 +95,12 @@ discard block |
||
95 | 95 | */ |
96 | 96 | public function createAction() |
97 | 97 | { |
98 | - if( config( 'shop.authorize', true ) ) { |
|
99 | - $this->authorize( 'admin', [['admin', 'editor']] ); |
|
98 | + if (config('shop.authorize', true)) { |
|
99 | + $this->authorize('admin', [['admin', 'editor']]); |
|
100 | 100 | } |
101 | 101 | |
102 | 102 | $cntl = $this->createClient(); |
103 | - return $this->getHtml( $cntl->create() ); |
|
103 | + return $this->getHtml($cntl->create()); |
|
104 | 104 | } |
105 | 105 | |
106 | 106 | |
@@ -111,12 +111,12 @@ discard block |
||
111 | 111 | */ |
112 | 112 | public function deleteAction() |
113 | 113 | { |
114 | - if( config( 'shop.authorize', true ) ) { |
|
115 | - $this->authorize( 'admin', [['admin', 'editor']] ); |
|
114 | + if (config('shop.authorize', true)) { |
|
115 | + $this->authorize('admin', [['admin', 'editor']]); |
|
116 | 116 | } |
117 | 117 | |
118 | 118 | $cntl = $this->createClient(); |
119 | - return $this->getHtml( $cntl->delete() . $cntl->search() ); |
|
119 | + return $this->getHtml($cntl->delete().$cntl->search()); |
|
120 | 120 | } |
121 | 121 | |
122 | 122 | |
@@ -127,12 +127,12 @@ discard block |
||
127 | 127 | */ |
128 | 128 | public function getAction() |
129 | 129 | { |
130 | - if( config( 'shop.authorize', true ) ) { |
|
131 | - $this->authorize( 'admin', [['admin', 'editor']] ); |
|
130 | + if (config('shop.authorize', true)) { |
|
131 | + $this->authorize('admin', [['admin', 'editor']]); |
|
132 | 132 | } |
133 | 133 | |
134 | 134 | $cntl = $this->createClient(); |
135 | - return $this->getHtml( $cntl->get() ); |
|
135 | + return $this->getHtml($cntl->get()); |
|
136 | 136 | } |
137 | 137 | |
138 | 138 | |
@@ -143,12 +143,12 @@ discard block |
||
143 | 143 | */ |
144 | 144 | public function saveAction() |
145 | 145 | { |
146 | - if( config( 'shop.authorize', true ) ) { |
|
147 | - $this->authorize( 'admin', [['admin', 'editor']] ); |
|
146 | + if (config('shop.authorize', true)) { |
|
147 | + $this->authorize('admin', [['admin', 'editor']]); |
|
148 | 148 | } |
149 | 149 | |
150 | 150 | $cntl = $this->createClient(); |
151 | - return $this->getHtml( ( $cntl->save() ? : $cntl->search() ) ); |
|
151 | + return $this->getHtml(($cntl->save() ?: $cntl->search())); |
|
152 | 152 | } |
153 | 153 | |
154 | 154 | |
@@ -159,12 +159,12 @@ discard block |
||
159 | 159 | */ |
160 | 160 | public function searchAction() |
161 | 161 | { |
162 | - if( config( 'shop.authorize', true ) ) { |
|
163 | - $this->authorize( 'admin', [['admin', 'editor']] ); |
|
162 | + if (config('shop.authorize', true)) { |
|
163 | + $this->authorize('admin', [['admin', 'editor']]); |
|
164 | 164 | } |
165 | 165 | |
166 | 166 | $cntl = $this->createClient(); |
167 | - return $this->getHtml( $cntl->search() ); |
|
167 | + return $this->getHtml($cntl->search()); |
|
168 | 168 | } |
169 | 169 | |
170 | 170 | |
@@ -175,20 +175,20 @@ discard block |
||
175 | 175 | */ |
176 | 176 | protected function createClient() |
177 | 177 | { |
178 | - $site = Route::input( 'site', Input::get( 'site', 'default' ) ); |
|
179 | - $lang = Input::get( 'lang', config( 'app.locale', 'en' ) ); |
|
180 | - $resource = Route::input( 'resource' ); |
|
178 | + $site = Route::input('site', Input::get('site', 'default')); |
|
179 | + $lang = Input::get('lang', config('app.locale', 'en')); |
|
180 | + $resource = Route::input('resource'); |
|
181 | 181 | |
182 | - $aimeos = app( '\Aimeos\Shop\Base\Aimeos' )->get(); |
|
183 | - $templatePaths = $aimeos->getCustomPaths( 'admin/jqadm/templates' ); |
|
182 | + $aimeos = app('\Aimeos\Shop\Base\Aimeos')->get(); |
|
183 | + $templatePaths = $aimeos->getCustomPaths('admin/jqadm/templates'); |
|
184 | 184 | |
185 | - $context = app( '\Aimeos\Shop\Base\Context' )->get( false ); |
|
186 | - $context = $this->setLocale( $context, $site, $lang ); |
|
185 | + $context = app('\Aimeos\Shop\Base\Context')->get(false); |
|
186 | + $context = $this->setLocale($context, $site, $lang); |
|
187 | 187 | |
188 | - $view = app( '\Aimeos\Shop\Base\View' )->create( $context->getConfig(), $templatePaths, $lang ); |
|
189 | - $context->setView( $view ); |
|
188 | + $view = app('\Aimeos\Shop\Base\View')->create($context->getConfig(), $templatePaths, $lang); |
|
189 | + $context->setView($view); |
|
190 | 190 | |
191 | - return \Aimeos\Admin\JQAdm\Factory::createClient( $context, $templatePaths, $resource ); |
|
191 | + return \Aimeos\Admin\JQAdm\Factory::createClient($context, $templatePaths, $resource); |
|
192 | 192 | } |
193 | 193 | |
194 | 194 | |
@@ -198,12 +198,12 @@ discard block |
||
198 | 198 | * @param string $content Content from admin client |
199 | 199 | * @return \Illuminate\Contracts\View\View View for rendering the output |
200 | 200 | */ |
201 | - protected function getHtml( $content ) |
|
201 | + protected function getHtml($content) |
|
202 | 202 | { |
203 | - $version = app( '\Aimeos\Shop\Base\Aimeos' )->getVersion(); |
|
204 | - $content = str_replace( ['{type}', '{version}'], ['Laravel', $version], $content ); |
|
203 | + $version = app('\Aimeos\Shop\Base\Aimeos')->getVersion(); |
|
204 | + $content = str_replace(['{type}', '{version}'], ['Laravel', $version], $content); |
|
205 | 205 | |
206 | - return View::make( 'shop::jqadm.index', array( 'content' => $content ) ); |
|
206 | + return View::make('shop::jqadm.index', array('content' => $content)); |
|
207 | 207 | } |
208 | 208 | |
209 | 209 | |
@@ -215,23 +215,23 @@ discard block |
||
215 | 215 | * @param string $lang ISO language code, e.g. "en" or "en_GB" |
216 | 216 | * @return \Aimeos\MShop\Context\Item\Iface Modified context object |
217 | 217 | */ |
218 | - protected function setLocale( \Aimeos\MShop\Context\Item\Iface $context, $site, $lang ) |
|
218 | + protected function setLocale(\Aimeos\MShop\Context\Item\Iface $context, $site, $lang) |
|
219 | 219 | { |
220 | - $localeManager = \Aimeos\MShop\Factory::createManager( $context, 'locale' ); |
|
220 | + $localeManager = \Aimeos\MShop\Factory::createManager($context, 'locale'); |
|
221 | 221 | |
222 | 222 | try |
223 | 223 | { |
224 | - $localeItem = $localeManager->bootstrap( $site, '', '', false ); |
|
225 | - $localeItem->setLanguageId( null ); |
|
226 | - $localeItem->setCurrencyId( null ); |
|
224 | + $localeItem = $localeManager->bootstrap($site, '', '', false); |
|
225 | + $localeItem->setLanguageId(null); |
|
226 | + $localeItem->setCurrencyId(null); |
|
227 | 227 | } |
228 | - catch( \Aimeos\MShop\Locale\Exception $e ) |
|
228 | + catch (\Aimeos\MShop\Locale\Exception $e) |
|
229 | 229 | { |
230 | 230 | $localeItem = $localeManager->createItem(); |
231 | 231 | } |
232 | 232 | |
233 | - $context->setLocale( $localeItem ); |
|
234 | - $context->setI18n( app('\Aimeos\Shop\Base\I18n')->get( array( $lang, 'en' ) ) ); |
|
233 | + $context->setLocale($localeItem); |
|
234 | + $context->setI18n(app('\Aimeos\Shop\Base\I18n')->get(array($lang, 'en'))); |
|
235 | 235 | |
236 | 236 | return $context; |
237 | 237 | } |
@@ -36,20 +36,20 @@ |
||
36 | 36 | * @param \Illuminate\Http\Request $request Laravel request object |
37 | 37 | * @return \Illuminate\Contracts\View\View View for rendering the output |
38 | 38 | */ |
39 | - public function indexAction( Request $request ) |
|
39 | + public function indexAction(Request $request) |
|
40 | 40 | { |
41 | - if( config( 'shop.authorize', true ) && ( Auth::check() === false |
|
42 | - || $request->user()->can( 'admin', ['admin', 'editor'] ) ) === false |
|
41 | + if (config('shop.authorize', true) && (Auth::check() === false |
|
42 | + || $request->user()->can('admin', ['admin', 'editor'])) === false |
|
43 | 43 | ) { |
44 | - return View::make( 'shop::admin.index' ); |
|
44 | + return View::make('shop::admin.index'); |
|
45 | 45 | } |
46 | 46 | |
47 | 47 | $param = array( |
48 | 48 | 'resource' => 'product', |
49 | - 'site' => Route::input( 'site', 'default' ), |
|
50 | - 'lang' => Input::get( 'lang', config( 'app.locale', 'en' ) ), |
|
49 | + 'site' => Route::input('site', 'default'), |
|
50 | + 'lang' => Input::get('lang', config('app.locale', 'en')), |
|
51 | 51 | ); |
52 | 52 | |
53 | - return redirect()->route( 'aimeos_shop_jqadm_search', $param ); |
|
53 | + return redirect()->route('aimeos_shop_jqadm_search', $param); |
|
54 | 54 | } |
55 | 55 | } |
56 | 56 | \ No newline at end of file |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | * |
30 | 30 | * @param \Aimeos\Shop\Base\Context $context Context object |
31 | 31 | */ |
32 | - public function __construct( \Aimeos\Shop\Base\Context $context ) |
|
32 | + public function __construct(\Aimeos\Shop\Base\Context $context) |
|
33 | 33 | { |
34 | 34 | $this->context = $context; |
35 | 35 | } |
@@ -42,21 +42,21 @@ discard block |
||
42 | 42 | * @param string|array $groupcodes Unique user/customer group codes that are allowed |
43 | 43 | * @return boolean True if user is part of the group, false if not |
44 | 44 | */ |
45 | - public function checkGroup( $userid, $groupcodes ) |
|
45 | + public function checkGroup($userid, $groupcodes) |
|
46 | 46 | { |
47 | - $groupItems = $this->getGroups( (array) $groupcodes ); |
|
48 | - $manager = \Aimeos\MShop\Factory::createManager( $this->context->get(), 'customer/lists' ); |
|
47 | + $groupItems = $this->getGroups((array) $groupcodes); |
|
48 | + $manager = \Aimeos\MShop\Factory::createManager($this->context->get(), 'customer/lists'); |
|
49 | 49 | |
50 | 50 | $search = $manager->createSearch(); |
51 | 51 | $expr = array( |
52 | - $search->compare( '==', 'customer.lists.parentid', $userid ), |
|
53 | - $search->compare( '==', 'customer.lists.refid', array_keys( $groupItems ) ), |
|
54 | - $search->compare( '==', 'customer.lists.domain', 'customer/group' ), |
|
52 | + $search->compare('==', 'customer.lists.parentid', $userid), |
|
53 | + $search->compare('==', 'customer.lists.refid', array_keys($groupItems)), |
|
54 | + $search->compare('==', 'customer.lists.domain', 'customer/group'), |
|
55 | 55 | ); |
56 | - $search->setConditions( $search->combine( '&&', $expr ) ); |
|
57 | - $search->setSlice( 0, 1 ); |
|
56 | + $search->setConditions($search->combine('&&', $expr)); |
|
57 | + $search->setSlice(0, 1); |
|
58 | 58 | |
59 | - return (bool) count( $manager->searchItems( $search ) ); |
|
59 | + return (bool) count($manager->searchItems($search)); |
|
60 | 60 | } |
61 | 61 | |
62 | 62 | |
@@ -66,13 +66,13 @@ discard block |
||
66 | 66 | * @param array $codes List of group codes |
67 | 67 | * @return array Associative list of group IDs as keys and \Aimeos\MShop\Customer\Item\Group\Iface as values |
68 | 68 | */ |
69 | - protected function getGroups( array $codes ) |
|
69 | + protected function getGroups(array $codes) |
|
70 | 70 | { |
71 | - $manager = \Aimeos\MShop\Factory::createManager( $this->context->get(), 'customer/group' ); |
|
71 | + $manager = \Aimeos\MShop\Factory::createManager($this->context->get(), 'customer/group'); |
|
72 | 72 | |
73 | 73 | $search = $manager->createSearch(); |
74 | - $search->setConditions( $search->compare( '==', 'customer.group.code', $codes ) ); |
|
74 | + $search->setConditions($search->compare('==', 'customer.group.code', $codes)); |
|
75 | 75 | |
76 | - return $manager->searchItems( $search ); |
|
76 | + return $manager->searchItems($search); |
|
77 | 77 | } |
78 | 78 | } |
79 | 79 | \ No newline at end of file |