@@ -39,18 +39,18 @@ discard block |
||
39 | 39 | */ |
40 | 40 | public function fire() |
41 | 41 | { |
42 | - $context = $this->getLaravel()->make( 'Aimeos\Shop\Base\Context' )->get( false ); |
|
43 | - $context->setEditor( 'aimeos:account' ); |
|
42 | + $context = $this->getLaravel()->make('Aimeos\Shop\Base\Context')->get(false); |
|
43 | + $context->setEditor('aimeos:account'); |
|
44 | 44 | |
45 | - $code = $this->argument( 'email' ); |
|
46 | - if( ( $password = $this->option( 'password' ) ) === null ) { |
|
47 | - $password = $this->secret( 'Password' ); |
|
45 | + $code = $this->argument('email'); |
|
46 | + if (($password = $this->option('password')) === null) { |
|
47 | + $password = $this->secret('Password'); |
|
48 | 48 | } |
49 | 49 | |
50 | - $user = $this->getCustomerItem( $context, $code, $password ); |
|
50 | + $user = $this->getCustomerItem($context, $code, $password); |
|
51 | 51 | |
52 | - if( $this->option( 'admin' ) ) { |
|
53 | - $this->addPrivilege( $context, $user, 'admin' ); |
|
52 | + if ($this->option('admin')) { |
|
53 | + $this->addPrivilege($context, $user, 'admin'); |
|
54 | 54 | } |
55 | 55 | } |
56 | 56 | |
@@ -62,31 +62,31 @@ discard block |
||
62 | 62 | * @param string $userid Unique user ID |
63 | 63 | * @param string $groupid Unique group ID |
64 | 64 | */ |
65 | - protected function addListItem( \Aimeos\MShop\Context\Item\Iface $context, $userid, $groupid ) |
|
65 | + protected function addListItem(\Aimeos\MShop\Context\Item\Iface $context, $userid, $groupid) |
|
66 | 66 | { |
67 | - $manager = \Aimeos\MShop\Customer\Manager\Factory::createManager( $context )->getSubmanager( 'lists' ); |
|
68 | - $typeid = $this->getTypeItem( $manager, 'default' )->getId(); |
|
67 | + $manager = \Aimeos\MShop\Customer\Manager\Factory::createManager($context)->getSubmanager('lists'); |
|
68 | + $typeid = $this->getTypeItem($manager, 'default')->getId(); |
|
69 | 69 | |
70 | 70 | $search = $manager->createSearch(); |
71 | 71 | $expr = array( |
72 | - $search->compare( '==', 'customer.lists.parentid', $userid ), |
|
73 | - $search->compare( '==', 'customer.lists.refid', $groupid ), |
|
74 | - $search->compare( '==', 'customer.lists.domain', 'customer/group' ), |
|
75 | - $search->compare( '==', 'customer.lists.typeid', $typeid ), |
|
72 | + $search->compare('==', 'customer.lists.parentid', $userid), |
|
73 | + $search->compare('==', 'customer.lists.refid', $groupid), |
|
74 | + $search->compare('==', 'customer.lists.domain', 'customer/group'), |
|
75 | + $search->compare('==', 'customer.lists.typeid', $typeid), |
|
76 | 76 | ); |
77 | - $search->setConditions( $search->combine( '&&', $expr ) ); |
|
78 | - $search->setSlice( 0, 1 ); |
|
77 | + $search->setConditions($search->combine('&&', $expr)); |
|
78 | + $search->setSlice(0, 1); |
|
79 | 79 | |
80 | - if( count( $manager->searchItems( $search ) ) === 0 ) |
|
80 | + if (count($manager->searchItems($search)) === 0) |
|
81 | 81 | { |
82 | 82 | $item = $manager->createItem(); |
83 | - $item->setDomain( 'customer/group' ); |
|
84 | - $item->setParentId( $userid ); |
|
85 | - $item->setTypeId( $typeid ); |
|
86 | - $item->setRefId( $groupid ); |
|
87 | - $item->setStatus( 1 ); |
|
83 | + $item->setDomain('customer/group'); |
|
84 | + $item->setParentId($userid); |
|
85 | + $item->setTypeId($typeid); |
|
86 | + $item->setRefId($groupid); |
|
87 | + $item->setStatus(1); |
|
88 | 88 | |
89 | - $manager->saveItem( $item, false ); |
|
89 | + $manager->saveItem($item, false); |
|
90 | 90 | } |
91 | 91 | } |
92 | 92 | |
@@ -98,23 +98,23 @@ discard block |
||
98 | 98 | * @param \Aimeos\MShop\Customer\Item\Iface $user Aimeos customer object |
99 | 99 | * @param string $privilege Unique customer group code |
100 | 100 | */ |
101 | - protected function addPrivilege( \Aimeos\MShop\Context\Item\Iface $context, \Aimeos\MShop\Customer\Item\Iface $user, $privilege ) |
|
101 | + protected function addPrivilege(\Aimeos\MShop\Context\Item\Iface $context, \Aimeos\MShop\Customer\Item\Iface $user, $privilege) |
|
102 | 102 | { |
103 | - $this->info( sprintf( 'Add "%1$s" privilege to user "%2$s" for sites', $privilege, $user->getCode() ) ); |
|
103 | + $this->info(sprintf('Add "%1$s" privilege to user "%2$s" for sites', $privilege, $user->getCode())); |
|
104 | 104 | |
105 | - $localeManager = \Aimeos\MShop\Locale\Manager\Factory::createManager( $context ); |
|
105 | + $localeManager = \Aimeos\MShop\Locale\Manager\Factory::createManager($context); |
|
106 | 106 | |
107 | - foreach( $this->getSiteItems( $context, $this->argument( 'site' ) ) as $siteItem ) |
|
107 | + foreach ($this->getSiteItems($context, $this->argument('site')) as $siteItem) |
|
108 | 108 | { |
109 | - $localeItem = $localeManager->bootstrap( $siteItem->getCode(), '', '', false ); |
|
109 | + $localeItem = $localeManager->bootstrap($siteItem->getCode(), '', '', false); |
|
110 | 110 | |
111 | 111 | $lcontext = clone $context; |
112 | - $lcontext->setLocale( $localeItem ); |
|
112 | + $lcontext->setLocale($localeItem); |
|
113 | 113 | |
114 | - $this->info( $siteItem->getCode() ); |
|
114 | + $this->info($siteItem->getCode()); |
|
115 | 115 | |
116 | - $groupItem = $this->getGroupItem( $lcontext, $privilege ); |
|
117 | - $this->addListItem( $lcontext, $user->getId(), $groupItem->getId() ); |
|
116 | + $groupItem = $this->getGroupItem($lcontext, $privilege); |
|
117 | + $this->addListItem($lcontext, $user->getId(), $groupItem->getId()); |
|
118 | 118 | } |
119 | 119 | } |
120 | 120 | |
@@ -127,8 +127,8 @@ discard block |
||
127 | 127 | protected function getArguments() |
128 | 128 | { |
129 | 129 | return array( |
130 | - array( 'email', InputArgument::REQUIRED, 'E-mail address of the account that should be created' ), |
|
131 | - array( 'site', InputArgument::OPTIONAL, 'Site codes to create accounts for like "default unittest" (none for all)' ), |
|
130 | + array('email', InputArgument::REQUIRED, 'E-mail address of the account that should be created'), |
|
131 | + array('site', InputArgument::OPTIONAL, 'Site codes to create accounts for like "default unittest" (none for all)'), |
|
132 | 132 | ); |
133 | 133 | } |
134 | 134 | |
@@ -143,21 +143,21 @@ discard block |
||
143 | 143 | * @param string $password New user password |
144 | 144 | * @return \Aimeos\MShop\Customer\Item\Iface Aimeos customer item object |
145 | 145 | */ |
146 | - protected function getCustomerItem( \Aimeos\MShop\Context\Item\Iface $context, $email, $password ) |
|
146 | + protected function getCustomerItem(\Aimeos\MShop\Context\Item\Iface $context, $email, $password) |
|
147 | 147 | { |
148 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'customer' ); |
|
148 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'customer'); |
|
149 | 149 | |
150 | 150 | try { |
151 | - $item = $manager->getItem( $email ); |
|
152 | - } catch( \Aimeos\MShop\Exception $e ) { |
|
151 | + $item = $manager->getItem($email); |
|
152 | + } catch (\Aimeos\MShop\Exception $e) { |
|
153 | 153 | $item = $manager->createItem(); |
154 | 154 | } |
155 | 155 | |
156 | - $item->setCode( $email ); |
|
157 | - $item->getPaymentAddress()->setEmail( $email ); |
|
158 | - $item->setPassword( $password ); |
|
156 | + $item->setCode($email); |
|
157 | + $item->getPaymentAddress()->setEmail($email); |
|
158 | + $item->setPassword($password); |
|
159 | 159 | |
160 | - $manager->saveItem( $item ); |
|
160 | + $manager->saveItem($item); |
|
161 | 161 | |
162 | 162 | return $item; |
163 | 163 | } |
@@ -170,21 +170,21 @@ discard block |
||
170 | 170 | * @param string $code Unique customer group code |
171 | 171 | * @return \Aimeos\MShop\Customer\Item\Group\Iface Aimeos customer group item object |
172 | 172 | */ |
173 | - protected function getGroupItem( \Aimeos\MShop\Context\Item\Iface $context, $code ) |
|
173 | + protected function getGroupItem(\Aimeos\MShop\Context\Item\Iface $context, $code) |
|
174 | 174 | { |
175 | - $manager = \Aimeos\MShop\Customer\Manager\Factory::createManager( $context )->getSubmanager( 'group' ); |
|
175 | + $manager = \Aimeos\MShop\Customer\Manager\Factory::createManager($context)->getSubmanager('group'); |
|
176 | 176 | |
177 | 177 | try |
178 | 178 | { |
179 | - $item = $manager->getItem( $code ); |
|
179 | + $item = $manager->getItem($code); |
|
180 | 180 | } |
181 | - catch( \Aimeos\MShop\Exception $e ) |
|
181 | + catch (\Aimeos\MShop\Exception $e) |
|
182 | 182 | { |
183 | 183 | $item = $manager->createItem(); |
184 | - $item->setLabel( $code ); |
|
185 | - $item->setCode( $code ); |
|
184 | + $item->setLabel($code); |
|
185 | + $item->setCode($code); |
|
186 | 186 | |
187 | - $manager->saveItem( $item ); |
|
187 | + $manager->saveItem($item); |
|
188 | 188 | } |
189 | 189 | |
190 | 190 | return $item; |
@@ -199,8 +199,8 @@ discard block |
||
199 | 199 | protected function getOptions() |
200 | 200 | { |
201 | 201 | return array( |
202 | - array( 'password', null, InputOption::VALUE_REQUIRED, 'Optional password for the account (will ask for if not given)' ), |
|
203 | - array( 'admin', null, InputOption::VALUE_NONE, 'If account should have administrator privileges' ), |
|
202 | + array('password', null, InputOption::VALUE_REQUIRED, 'Optional password for the account (will ask for if not given)'), |
|
203 | + array('admin', null, InputOption::VALUE_NONE, 'If account should have administrator privileges'), |
|
204 | 204 | ); |
205 | 205 | } |
206 | 206 | |
@@ -213,23 +213,23 @@ discard block |
||
213 | 213 | * @return \Aimeos\MShop\Common\Item\Type\Iface Aimeos customer list type item object |
214 | 214 | * @throws \Exception If no customer list type item for the given code is found |
215 | 215 | */ |
216 | - protected function getTypeItem( \Aimeos\MShop\Common\Manager\Iface $listManager, $code ) |
|
216 | + protected function getTypeItem(\Aimeos\MShop\Common\Manager\Iface $listManager, $code) |
|
217 | 217 | { |
218 | - $manager = $listManager->getSubmanager( 'type' ); |
|
218 | + $manager = $listManager->getSubmanager('type'); |
|
219 | 219 | |
220 | 220 | $search = $manager->createSearch(); |
221 | 221 | $expr = array( |
222 | - $search->compare( '==', 'customer.lists.type.domain', 'customer/group' ), |
|
223 | - $search->compare( '==', 'customer.lists.type.code', $code ), |
|
222 | + $search->compare('==', 'customer.lists.type.domain', 'customer/group'), |
|
223 | + $search->compare('==', 'customer.lists.type.code', $code), |
|
224 | 224 | ); |
225 | - $search->setConditions( $search->combine( '&&', $expr ) ); |
|
225 | + $search->setConditions($search->combine('&&', $expr)); |
|
226 | 226 | |
227 | - $result = $manager->searchItems( $search ); |
|
227 | + $result = $manager->searchItems($search); |
|
228 | 228 | |
229 | - if( ( $item = reset( $result ) ) === false ) |
|
229 | + if (($item = reset($result)) === false) |
|
230 | 230 | { |
231 | - $msg = sprintf( 'No user list type item for domain "%1$s" and code "%2$s" found', 'customer/group', $code ); |
|
232 | - throw new \Exception( $msg ); |
|
231 | + $msg = sprintf('No user list type item for domain "%1$s" and code "%2$s" found', 'customer/group', $code); |
|
232 | + throw new \Exception($msg); |
|
233 | 233 | } |
234 | 234 | |
235 | 235 | return $item; |
@@ -177,8 +177,7 @@ |
||
177 | 177 | try |
178 | 178 | { |
179 | 179 | $item = $manager->getItem( $code ); |
180 | - } |
|
181 | - catch( \Aimeos\MShop\Exception $e ) |
|
180 | + } catch( \Aimeos\MShop\Exception $e ) |
|
182 | 181 | { |
183 | 182 | $item = $manager->createItem(); |
184 | 183 | $item->setLabel( $code ); |
@@ -28,54 +28,54 @@ discard block |
||
28 | 28 | */ |
29 | 29 | public function indexAction() |
30 | 30 | { |
31 | - if( config( 'shop.authorize', true ) ) { |
|
32 | - $this->authorize( 'admin' ); |
|
31 | + if (config('shop.authorize', true)) { |
|
32 | + $this->authorize('admin'); |
|
33 | 33 | } |
34 | 34 | |
35 | - $site = \Input::get( 'site', 'default' ); |
|
36 | - $lang = \Input::get( 'lang', 'en' ); |
|
35 | + $site = \Input::get('site', 'default'); |
|
36 | + $lang = \Input::get('lang', 'en'); |
|
37 | 37 | |
38 | - $aimeos = app( '\Aimeos\Shop\Base\Aimeos' )->get(); |
|
39 | - $cntlPaths = $aimeos->getCustomPaths( 'controller/extjs' ); |
|
38 | + $aimeos = app('\Aimeos\Shop\Base\Aimeos')->get(); |
|
39 | + $cntlPaths = $aimeos->getCustomPaths('controller/extjs'); |
|
40 | 40 | |
41 | - $context = app( '\Aimeos\Shop\Base\Context' )->get( false ); |
|
42 | - $context = $this->setLocale( $context, $site, $lang ); |
|
41 | + $context = app('\Aimeos\Shop\Base\Context')->get(false); |
|
42 | + $context = $this->setLocale($context, $site, $lang); |
|
43 | 43 | |
44 | - $controller = new \Aimeos\Controller\ExtJS\JsonRpc( $context, $cntlPaths ); |
|
44 | + $controller = new \Aimeos\Controller\ExtJS\JsonRpc($context, $cntlPaths); |
|
45 | 45 | $cssFiles = array(); |
46 | 46 | |
47 | - foreach( $aimeos->getCustomPaths( 'client/extjs' ) as $base => $paths ) |
|
47 | + foreach ($aimeos->getCustomPaths('client/extjs') as $base => $paths) |
|
48 | 48 | { |
49 | - foreach( $paths as $path ) |
|
49 | + foreach ($paths as $path) |
|
50 | 50 | { |
51 | 51 | $jsbAbsPath = $base . '/' . $path; |
52 | 52 | |
53 | - if( !is_file( $jsbAbsPath ) ) { |
|
54 | - throw new \Exception( sprintf( 'JSB2 file "%1$s" not found', $jsbAbsPath ) ); |
|
53 | + if (!is_file($jsbAbsPath)) { |
|
54 | + throw new \Exception(sprintf('JSB2 file "%1$s" not found', $jsbAbsPath)); |
|
55 | 55 | } |
56 | 56 | |
57 | - $jsb2 = new \Aimeos\MW\Jsb2\Standard( $jsbAbsPath, dirname( $path ) ); |
|
58 | - $cssFiles = array_merge( $cssFiles, $jsb2->getUrls( 'css' ) ); |
|
57 | + $jsb2 = new \Aimeos\MW\Jsb2\Standard($jsbAbsPath, dirname($path)); |
|
58 | + $cssFiles = array_merge($cssFiles, $jsb2->getUrls('css')); |
|
59 | 59 | } |
60 | 60 | } |
61 | 61 | |
62 | - $params = array( 'site' => '{site}', 'lang' => '{lang}', 'tab' => '{tab}' ); |
|
63 | - $adminUrl = route( 'aimeos_shop_admin', $params ); |
|
64 | - $jsonUrl = route( 'aimeos_shop_admin_json', array( '_token' => csrf_token() ) ); |
|
62 | + $params = array('site' => '{site}', 'lang' => '{lang}', 'tab' => '{tab}'); |
|
63 | + $adminUrl = route('aimeos_shop_admin', $params); |
|
64 | + $jsonUrl = route('aimeos_shop_admin_json', array('_token' => csrf_token())); |
|
65 | 65 | |
66 | 66 | $vars = array( |
67 | 67 | 'lang' => $lang, |
68 | 68 | 'cssFiles' => $cssFiles, |
69 | - 'languages' => $this->getJsonLanguages( $context), |
|
70 | - 'config' => $this->getJsonClientConfig( $context ), |
|
71 | - 'site' => $this->getJsonSiteItem( $context, \Input::get( 'site', 'default' ) ), |
|
72 | - 'i18nContent' => $this->getJsonClientI18n( $aimeos->getI18nPaths(), $lang ), |
|
69 | + 'languages' => $this->getJsonLanguages($context), |
|
70 | + 'config' => $this->getJsonClientConfig($context), |
|
71 | + 'site' => $this->getJsonSiteItem($context, \Input::get('site', 'default')), |
|
72 | + 'i18nContent' => $this->getJsonClientI18n($aimeos->getI18nPaths(), $lang), |
|
73 | 73 | 'searchSchemas' => $controller->getJsonSearchSchemas(), |
74 | 74 | 'itemSchemas' => $controller->getJsonItemSchemas(), |
75 | - 'smd' => $controller->getJsonSmd( $jsonUrl ), |
|
76 | - 'urlTemplate' => urldecode( $adminUrl ), |
|
77 | - 'uploaddir' => \Config::get( 'shop::uploaddir' ), |
|
78 | - 'activeTab' => \Input::get( 'tab', 0 ), |
|
75 | + 'smd' => $controller->getJsonSmd($jsonUrl), |
|
76 | + 'urlTemplate' => urldecode($adminUrl), |
|
77 | + 'uploaddir' => \Config::get('shop::uploaddir'), |
|
78 | + 'activeTab' => \Input::get('tab', 0), |
|
79 | 79 | 'version' => $this->getVersion(), |
80 | 80 | ); |
81 | 81 | |
@@ -90,20 +90,20 @@ discard block |
||
90 | 90 | */ |
91 | 91 | public function doAction() |
92 | 92 | { |
93 | - if( config( 'shop.authorize', true ) ) { |
|
94 | - $this->authorize( 'admin' ); |
|
93 | + if (config('shop.authorize', true)) { |
|
94 | + $this->authorize('admin'); |
|
95 | 95 | } |
96 | 96 | |
97 | - $aimeos = app( '\Aimeos\Shop\Base\Aimeos' )->get(); |
|
98 | - $cntlPaths = $aimeos->getCustomPaths( 'controller/extjs' ); |
|
97 | + $aimeos = app('\Aimeos\Shop\Base\Aimeos')->get(); |
|
98 | + $cntlPaths = $aimeos->getCustomPaths('controller/extjs'); |
|
99 | 99 | |
100 | - $context = app( '\Aimeos\Shop\Base\Context' )->get( false ); |
|
101 | - $context = $this->setLocale( $context ); |
|
100 | + $context = app('\Aimeos\Shop\Base\Context')->get(false); |
|
101 | + $context = $this->setLocale($context); |
|
102 | 102 | |
103 | - $controller = new \Aimeos\Controller\ExtJS\JsonRpc( $context, $cntlPaths ); |
|
103 | + $controller = new \Aimeos\Controller\ExtJS\JsonRpc($context, $cntlPaths); |
|
104 | 104 | |
105 | - $response = $controller->process( \Input::instance()->request->all(), 'php://input' ); |
|
106 | - return \View::make('shop::admin.do', array( 'output' => $response )); |
|
105 | + $response = $controller->process(\Input::instance()->request->all(), 'php://input'); |
|
106 | + return \View::make('shop::admin.do', array('output' => $response)); |
|
107 | 107 | } |
108 | 108 | |
109 | 109 | |
@@ -114,32 +114,32 @@ discard block |
||
114 | 114 | */ |
115 | 115 | public function fileAction() |
116 | 116 | { |
117 | - if( config( 'shop.authorize', true ) ) { |
|
118 | - $this->authorize( 'admin' ); |
|
117 | + if (config('shop.authorize', true)) { |
|
118 | + $this->authorize('admin'); |
|
119 | 119 | } |
120 | 120 | |
121 | 121 | $contents = ''; |
122 | 122 | $jsFiles = array(); |
123 | - $aimeos = app( '\Aimeos\Shop\Base\Aimeos' )->get(); |
|
123 | + $aimeos = app('\Aimeos\Shop\Base\Aimeos')->get(); |
|
124 | 124 | |
125 | - foreach( $aimeos->getCustomPaths( 'client/extjs' ) as $base => $paths ) |
|
125 | + foreach ($aimeos->getCustomPaths('client/extjs') as $base => $paths) |
|
126 | 126 | { |
127 | - foreach( $paths as $path ) |
|
127 | + foreach ($paths as $path) |
|
128 | 128 | { |
129 | 129 | $jsbAbsPath = $base . '/' . $path; |
130 | - $jsb2 = new \Aimeos\MW\Jsb2\Standard( $jsbAbsPath, dirname( $jsbAbsPath ) ); |
|
131 | - $jsFiles = array_merge( $jsFiles, $jsb2->getUrls( 'js', '' ) ); |
|
130 | + $jsb2 = new \Aimeos\MW\Jsb2\Standard($jsbAbsPath, dirname($jsbAbsPath)); |
|
131 | + $jsFiles = array_merge($jsFiles, $jsb2->getUrls('js', '')); |
|
132 | 132 | } |
133 | 133 | } |
134 | 134 | |
135 | - foreach( $jsFiles as $file ) |
|
135 | + foreach ($jsFiles as $file) |
|
136 | 136 | { |
137 | - if( ( $content = file_get_contents( $file ) ) !== false ) { |
|
137 | + if (($content = file_get_contents($file)) !== false) { |
|
138 | 138 | $contents .= $content; |
139 | 139 | } |
140 | 140 | } |
141 | 141 | |
142 | - return response( $contents )->header( 'Content-Type', 'application/javascript' ); |
|
142 | + return response($contents)->header('Content-Type', 'application/javascript'); |
|
143 | 143 | } |
144 | 144 | |
145 | 145 | |
@@ -149,30 +149,30 @@ discard block |
||
149 | 149 | * @param \Aimeos\MShop\Context\Item\Iface $context Context object |
150 | 150 | * @return array List of language IDs with labels |
151 | 151 | */ |
152 | - protected function getJsonLanguages( \Aimeos\MShop\Context\Item\Iface $context ) |
|
152 | + protected function getJsonLanguages(\Aimeos\MShop\Context\Item\Iface $context) |
|
153 | 153 | { |
154 | - $paths = app( '\Aimeos\Shop\Base\Aimeos' )->get()->getI18nPaths(); |
|
154 | + $paths = app('\Aimeos\Shop\Base\Aimeos')->get()->getI18nPaths(); |
|
155 | 155 | $langs = array(); |
156 | 156 | |
157 | - if( !isset( $paths['client/extjs'] ) ) { |
|
158 | - return json_encode( array() ); |
|
157 | + if (!isset($paths['client/extjs'])) { |
|
158 | + return json_encode(array()); |
|
159 | 159 | } |
160 | 160 | |
161 | - foreach( $paths['client/extjs'] as $path ) |
|
161 | + foreach ($paths['client/extjs'] as $path) |
|
162 | 162 | { |
163 | - $iter = new \DirectoryIterator( $path ); |
|
163 | + $iter = new \DirectoryIterator($path); |
|
164 | 164 | |
165 | - foreach( $iter as $file ) |
|
165 | + foreach ($iter as $file) |
|
166 | 166 | { |
167 | 167 | $name = $file->getFilename(); |
168 | 168 | |
169 | - if( preg_match('/^[a-z]{2,3}(_[A-Z]{2})?$/', $name ) ) { |
|
169 | + if (preg_match('/^[a-z]{2,3}(_[A-Z]{2})?$/', $name)) { |
|
170 | 170 | $langs[$name] = null; |
171 | 171 | } |
172 | 172 | } |
173 | 173 | } |
174 | 174 | |
175 | - return json_encode( $this->getLanguages( $context, array_keys( $langs ) ) ); |
|
175 | + return json_encode($this->getLanguages($context, array_keys($langs))); |
|
176 | 176 | } |
177 | 177 | |
178 | 178 | |
@@ -182,10 +182,10 @@ discard block |
||
182 | 182 | * @param \Aimeos\MShop\Context\Item\Iface $context Context item object |
183 | 183 | * @return string JSON encoded configuration object |
184 | 184 | */ |
185 | - protected function getJsonClientConfig( \Aimeos\MShop\Context\Item\Iface $context ) |
|
185 | + protected function getJsonClientConfig(\Aimeos\MShop\Context\Item\Iface $context) |
|
186 | 186 | { |
187 | - $config = $context->getConfig()->get( 'client/extjs', array() ); |
|
188 | - return json_encode( array( 'client' => array( 'extjs' => $config ) ), JSON_FORCE_OBJECT ); |
|
187 | + $config = $context->getConfig()->get('client/extjs', array()); |
|
188 | + return json_encode(array('client' => array('extjs' => $config)), JSON_FORCE_OBJECT); |
|
189 | 189 | } |
190 | 190 | |
191 | 191 | |
@@ -196,16 +196,16 @@ discard block |
||
196 | 196 | * @param string $lang ISO language code like "en" or "en_GB" |
197 | 197 | * @return string JSON encoded translation object |
198 | 198 | */ |
199 | - protected function getJsonClientI18n( array $i18nPaths, $lang ) |
|
199 | + protected function getJsonClientI18n(array $i18nPaths, $lang) |
|
200 | 200 | { |
201 | - $i18n = new \Aimeos\MW\Translation\Zend2( $i18nPaths, 'gettext', $lang, array( 'disableNotices' => true ) ); |
|
201 | + $i18n = new \Aimeos\MW\Translation\Zend2($i18nPaths, 'gettext', $lang, array('disableNotices' => true)); |
|
202 | 202 | |
203 | 203 | $content = array( |
204 | - 'client/extjs' => $i18n->getAll( 'client/extjs' ), |
|
205 | - 'client/extjs/ext' => $i18n->getAll( 'client/extjs/ext' ), |
|
204 | + 'client/extjs' => $i18n->getAll('client/extjs'), |
|
205 | + 'client/extjs/ext' => $i18n->getAll('client/extjs/ext'), |
|
206 | 206 | ); |
207 | 207 | |
208 | - return json_encode( $content, JSON_FORCE_OBJECT ); |
|
208 | + return json_encode($content, JSON_FORCE_OBJECT); |
|
209 | 209 | } |
210 | 210 | |
211 | 211 | |
@@ -217,19 +217,19 @@ discard block |
||
217 | 217 | * @return string JSON encoded site item object |
218 | 218 | * @throws Exception If no site item was found for the code |
219 | 219 | */ |
220 | - protected function getJsonSiteItem( \Aimeos\MShop\Context\Item\Iface $context, $site ) |
|
220 | + protected function getJsonSiteItem(\Aimeos\MShop\Context\Item\Iface $context, $site) |
|
221 | 221 | { |
222 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'locale/site' ); |
|
222 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'locale/site'); |
|
223 | 223 | |
224 | 224 | $criteria = $manager->createSearch(); |
225 | - $criteria->setConditions( $criteria->compare( '==', 'locale.site.code', $site ) ); |
|
226 | - $items = $manager->searchItems( $criteria ); |
|
225 | + $criteria->setConditions($criteria->compare('==', 'locale.site.code', $site)); |
|
226 | + $items = $manager->searchItems($criteria); |
|
227 | 227 | |
228 | - if( ( $item = reset( $items ) ) === false ) { |
|
229 | - throw new \Exception( sprintf( 'No site found for code "%1$s"', $site ) ); |
|
228 | + if (($item = reset($items)) === false) { |
|
229 | + throw new \Exception(sprintf('No site found for code "%1$s"', $site)); |
|
230 | 230 | } |
231 | 231 | |
232 | - return json_encode( $item->toArray() ); |
|
232 | + return json_encode($item->toArray()); |
|
233 | 233 | } |
234 | 234 | |
235 | 235 | |
@@ -240,18 +240,18 @@ discard block |
||
240 | 240 | * @param array $langIds List of language IDs |
241 | 241 | * @return array List of associative lists with "id" and "label" as keys |
242 | 242 | */ |
243 | - protected function getLanguages( \Aimeos\MShop\Context\Item\Iface $context, array $langIds ) |
|
243 | + protected function getLanguages(\Aimeos\MShop\Context\Item\Iface $context, array $langIds) |
|
244 | 244 | { |
245 | - $languageManager = \Aimeos\MShop\Factory::createManager( $context, 'locale/language' ); |
|
245 | + $languageManager = \Aimeos\MShop\Factory::createManager($context, 'locale/language'); |
|
246 | 246 | $result = array(); |
247 | 247 | |
248 | 248 | $search = $languageManager->createSearch(); |
249 | - $search->setConditions( $search->compare('==', 'locale.language.id', $langIds ) ); |
|
250 | - $search->setSortations( array( $search->sort( '-', 'locale.language.status' ), $search->sort( '+', 'locale.language.label' ) ) ); |
|
251 | - $langItems = $languageManager->searchItems( $search ); |
|
249 | + $search->setConditions($search->compare('==', 'locale.language.id', $langIds)); |
|
250 | + $search->setSortations(array($search->sort('-', 'locale.language.status'), $search->sort('+', 'locale.language.label'))); |
|
251 | + $langItems = $languageManager->searchItems($search); |
|
252 | 252 | |
253 | - foreach( $langItems as $id => $item ) { |
|
254 | - $result[] = array( 'id' => $id, 'label' => $item->getLabel() ); |
|
253 | + foreach ($langItems as $id => $item) { |
|
254 | + $result[] = array('id' => $id, 'label' => $item->getLabel()); |
|
255 | 255 | } |
256 | 256 | |
257 | 257 | return $result; |
@@ -265,12 +265,12 @@ discard block |
||
265 | 265 | */ |
266 | 266 | protected function getVersion() |
267 | 267 | { |
268 | - if( ( $content = @file_get_contents( base_path( 'composer.lock' ) ) ) !== false |
|
269 | - && ( $content = json_decode( $content, true ) ) !== null && isset( $content['packages'] ) |
|
268 | + if (($content = @file_get_contents(base_path('composer.lock'))) !== false |
|
269 | + && ($content = json_decode($content, true)) !== null && isset($content['packages']) |
|
270 | 270 | ) { |
271 | - foreach( (array) $content['packages'] as $item ) |
|
271 | + foreach ((array) $content['packages'] as $item) |
|
272 | 272 | { |
273 | - if( $item['name'] === 'aimeos/aimeos-laravel' ) { |
|
273 | + if ($item['name'] === 'aimeos/aimeos-laravel') { |
|
274 | 274 | return $item['version']; |
275 | 275 | } |
276 | 276 | } |
@@ -288,17 +288,17 @@ discard block |
||
288 | 288 | * @param string $locale ISO language code, e.g. "en" or "en_GB" |
289 | 289 | * @return \Aimeos\MShop\Context\Item\Iface Modified context object |
290 | 290 | */ |
291 | - protected function setLocale( \Aimeos\MShop\Context\Item\Iface $context, $sitecode = 'default', $locale = null ) |
|
291 | + protected function setLocale(\Aimeos\MShop\Context\Item\Iface $context, $sitecode = 'default', $locale = null) |
|
292 | 292 | { |
293 | - $localeManager = \Aimeos\MShop\Factory::createManager( $context, 'locale' ); |
|
293 | + $localeManager = \Aimeos\MShop\Factory::createManager($context, 'locale'); |
|
294 | 294 | |
295 | 295 | try { |
296 | - $localeItem = $localeManager->bootstrap( $sitecode, $locale, '', false ); |
|
297 | - } catch( \Aimeos\MShop\Locale\Exception $e ) { |
|
296 | + $localeItem = $localeManager->bootstrap($sitecode, $locale, '', false); |
|
297 | + } catch (\Aimeos\MShop\Locale\Exception $e) { |
|
298 | 298 | $localeItem = $localeManager->createItem(); |
299 | 299 | } |
300 | 300 | |
301 | - $context->setLocale( $localeItem ); |
|
301 | + $context->setLocale($localeItem); |
|
302 | 302 | |
303 | 303 | return $context; |
304 | 304 | } |
@@ -31,19 +31,19 @@ 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 | - if( config( 'shop.authorize', true ) ) { |
|
37 | - $this->authorize( 'admin' ); |
|
36 | + if (config('shop.authorize', true)) { |
|
37 | + $this->authorize('admin'); |
|
38 | 38 | } |
39 | 39 | |
40 | 40 | $status = 500; |
41 | 41 | $header = $request->headers->all(); |
42 | 42 | |
43 | - $cntl = $this->createController( $site, $resource ); |
|
44 | - $result = $cntl->delete( $request->getContent(), $header, $status ); |
|
43 | + $cntl = $this->createController($site, $resource); |
|
44 | + $result = $cntl->delete($request->getContent(), $header, $status); |
|
45 | 45 | |
46 | - return $this->createResponse( $result, $status, $header ); |
|
46 | + return $this->createResponse($result, $status, $header); |
|
47 | 47 | } |
48 | 48 | |
49 | 49 | |
@@ -56,19 +56,19 @@ discard block |
||
56 | 56 | * @param integer|null $id Unique resource ID |
57 | 57 | * @return \Illuminate\Http\Response Response object containing the generated output |
58 | 58 | */ |
59 | - public function getAction( Request $request, $site = 'default', $resource, $id = null ) |
|
59 | + public function getAction(Request $request, $site = 'default', $resource, $id = null) |
|
60 | 60 | { |
61 | - if( config( 'shop.authorize', true ) ) { |
|
62 | - $this->authorize( 'admin' ); |
|
61 | + if (config('shop.authorize', true)) { |
|
62 | + $this->authorize('admin'); |
|
63 | 63 | } |
64 | 64 | |
65 | 65 | $status = 500; |
66 | 66 | $header = $request->headers->all(); |
67 | 67 | |
68 | - $cntl = $this->createController( $site, $resource ); |
|
69 | - $result = $cntl->get( $request->getContent(), $header, $status ); |
|
68 | + $cntl = $this->createController($site, $resource); |
|
69 | + $result = $cntl->get($request->getContent(), $header, $status); |
|
70 | 70 | |
71 | - return $this->createResponse( $result, $status, $header ); |
|
71 | + return $this->createResponse($result, $status, $header); |
|
72 | 72 | } |
73 | 73 | |
74 | 74 | |
@@ -81,19 +81,19 @@ discard block |
||
81 | 81 | * @param integer|null $id Unique resource ID |
82 | 82 | * @return \Illuminate\Http\Response Response object containing the generated output |
83 | 83 | */ |
84 | - public function patchAction( Request $request, $site = 'default', $resource, $id = null ) |
|
84 | + public function patchAction(Request $request, $site = 'default', $resource, $id = null) |
|
85 | 85 | { |
86 | - if( config( 'shop.authorize', true ) ) { |
|
87 | - $this->authorize( 'admin' ); |
|
86 | + if (config('shop.authorize', true)) { |
|
87 | + $this->authorize('admin'); |
|
88 | 88 | } |
89 | 89 | |
90 | 90 | $status = 500; |
91 | 91 | $header = $request->headers->all(); |
92 | 92 | |
93 | - $cntl = $this->createController( $site, $resource ); |
|
94 | - $result = $cntl->patch( $request->getContent(), $header, $status ); |
|
93 | + $cntl = $this->createController($site, $resource); |
|
94 | + $result = $cntl->patch($request->getContent(), $header, $status); |
|
95 | 95 | |
96 | - return $this->createResponse( $result, $status, $header ); |
|
96 | + return $this->createResponse($result, $status, $header); |
|
97 | 97 | } |
98 | 98 | |
99 | 99 | |
@@ -106,19 +106,19 @@ discard block |
||
106 | 106 | * @param integer $id Unique ID of the resource |
107 | 107 | * @return \Illuminate\Http\Response Response object containing the generated output |
108 | 108 | */ |
109 | - public function postAction( Request $request, $site = 'default', $resource, $id = null ) |
|
109 | + public function postAction(Request $request, $site = 'default', $resource, $id = null) |
|
110 | 110 | { |
111 | - if( config( 'shop.authorize', true ) ) { |
|
112 | - $this->authorize( 'admin' ); |
|
111 | + if (config('shop.authorize', true)) { |
|
112 | + $this->authorize('admin'); |
|
113 | 113 | } |
114 | 114 | |
115 | 115 | $status = 500; |
116 | 116 | $header = $request->headers->all(); |
117 | 117 | |
118 | - $cntl = $this->createController( $site, $resource ); |
|
119 | - $result = $cntl->post( $request->getContent(), $header, $status ); |
|
118 | + $cntl = $this->createController($site, $resource); |
|
119 | + $result = $cntl->post($request->getContent(), $header, $status); |
|
120 | 120 | |
121 | - return $this->createResponse( $result, $status, $header ); |
|
121 | + return $this->createResponse($result, $status, $header); |
|
122 | 122 | } |
123 | 123 | |
124 | 124 | |
@@ -131,19 +131,19 @@ discard block |
||
131 | 131 | * @param integer|null $id Unique resource ID |
132 | 132 | * @return \Illuminate\Http\Response Response object containing the generated output |
133 | 133 | */ |
134 | - public function putAction( Request $request, $site = 'default', $resource, $id = null ) |
|
134 | + public function putAction(Request $request, $site = 'default', $resource, $id = null) |
|
135 | 135 | { |
136 | - if( config( 'shop.authorize', true ) ) { |
|
137 | - $this->authorize( 'admin' ); |
|
136 | + if (config('shop.authorize', true)) { |
|
137 | + $this->authorize('admin'); |
|
138 | 138 | } |
139 | 139 | |
140 | 140 | $status = 500; |
141 | 141 | $header = $request->headers->all(); |
142 | 142 | |
143 | - $cntl = $this->createController( $site, $resource ); |
|
144 | - $result = $cntl->put( $request->getContent(), $header, $status ); |
|
143 | + $cntl = $this->createController($site, $resource); |
|
144 | + $result = $cntl->put($request->getContent(), $header, $status); |
|
145 | 145 | |
146 | - return $this->createResponse( $result, $status, $header ); |
|
146 | + return $this->createResponse($result, $status, $header); |
|
147 | 147 | } |
148 | 148 | |
149 | 149 | |
@@ -155,19 +155,19 @@ discard block |
||
155 | 155 | * @param string $sitecode Unique site code |
156 | 156 | * @return \Illuminate\Http\Response Response object containing the generated output |
157 | 157 | */ |
158 | - public function optionsAction( Request $request, $site = 'default', $resource = '' ) |
|
158 | + public function optionsAction(Request $request, $site = 'default', $resource = '') |
|
159 | 159 | { |
160 | - if( config( 'shop.authorize', true ) ) { |
|
161 | - $this->authorize( 'admin' ); |
|
160 | + if (config('shop.authorize', true)) { |
|
161 | + $this->authorize('admin'); |
|
162 | 162 | } |
163 | 163 | |
164 | 164 | $status = 500; |
165 | 165 | $header = $request->headers->all(); |
166 | 166 | |
167 | - $cntl = $this->createController( $site, $resource ); |
|
168 | - $result = $cntl->options( $request->getContent(), $header, $status ); |
|
167 | + $cntl = $this->createController($site, $resource); |
|
168 | + $result = $cntl->options($request->getContent(), $header, $status); |
|
169 | 169 | |
170 | - return $this->createResponse( $result, $status, $header ); |
|
170 | + return $this->createResponse($result, $status, $header); |
|
171 | 171 | } |
172 | 172 | |
173 | 173 | |
@@ -177,20 +177,20 @@ discard block |
||
177 | 177 | * @param string $sitecode Unique site code |
178 | 178 | * @return \Aimeos\MShop\Context\Item\Iface Context item |
179 | 179 | */ |
180 | - protected function createController( $sitecode, $resource ) |
|
180 | + protected function createController($sitecode, $resource) |
|
181 | 181 | { |
182 | - $lang = \Input::get( 'lang', 'en' ); |
|
182 | + $lang = \Input::get('lang', 'en'); |
|
183 | 183 | |
184 | - $aimeos = app( '\Aimeos\Shop\Base\Aimeos' )->get(); |
|
185 | - $templatePaths = $aimeos->getCustomPaths( 'controller/jsonadm/templates' ); |
|
184 | + $aimeos = app('\Aimeos\Shop\Base\Aimeos')->get(); |
|
185 | + $templatePaths = $aimeos->getCustomPaths('controller/jsonadm/templates'); |
|
186 | 186 | |
187 | - $context = app( '\Aimeos\Shop\Base\Context' )->get( false ); |
|
188 | - $context = $this->setLocale( $context, $sitecode, $lang ); |
|
187 | + $context = app('\Aimeos\Shop\Base\Context')->get(false); |
|
188 | + $context = $this->setLocale($context, $sitecode, $lang); |
|
189 | 189 | |
190 | - $view = app( '\Aimeos\Shop\Base\View' )->create( $context->getConfig(), $templatePaths, $lang ); |
|
191 | - $context->setView( $view ); |
|
190 | + $view = app('\Aimeos\Shop\Base\View')->create($context->getConfig(), $templatePaths, $lang); |
|
191 | + $context->setView($view); |
|
192 | 192 | |
193 | - return \Aimeos\Controller\JsonAdm\Factory::createController( $context, $templatePaths, $resource ); |
|
193 | + return \Aimeos\Controller\JsonAdm\Factory::createController($context, $templatePaths, $resource); |
|
194 | 194 | } |
195 | 195 | |
196 | 196 | |
@@ -202,12 +202,12 @@ discard block |
||
202 | 202 | * @param array $header List of HTTP headers |
203 | 203 | * @return \Illuminate\Http\Response HTTP response object |
204 | 204 | */ |
205 | - protected function createResponse( $content, $status, array $header ) |
|
205 | + protected function createResponse($content, $status, array $header) |
|
206 | 206 | { |
207 | - $response = \Response::make( $content, $status ); |
|
207 | + $response = \Response::make($content, $status); |
|
208 | 208 | |
209 | - foreach( $header as $key => $value ) { |
|
210 | - $response->header( $key, $value ); |
|
209 | + foreach ($header as $key => $value) { |
|
210 | + $response->header($key, $value); |
|
211 | 211 | } |
212 | 212 | |
213 | 213 | return $response; |
@@ -222,23 +222,23 @@ discard block |
||
222 | 222 | * @param string $lang ISO language code, e.g. "en" or "en_GB" |
223 | 223 | * @return \Aimeos\MShop\Context\Item\Iface Modified context object |
224 | 224 | */ |
225 | - protected function setLocale( \Aimeos\MShop\Context\Item\Iface $context, $sitecode, $lang ) |
|
225 | + protected function setLocale(\Aimeos\MShop\Context\Item\Iface $context, $sitecode, $lang) |
|
226 | 226 | { |
227 | - $localeManager = \Aimeos\MShop\Factory::createManager( $context, 'locale' ); |
|
227 | + $localeManager = \Aimeos\MShop\Factory::createManager($context, 'locale'); |
|
228 | 228 | |
229 | 229 | try |
230 | 230 | { |
231 | - $localeItem = $localeManager->bootstrap( $sitecode, '', '', false ); |
|
232 | - $localeItem->setLanguageId( null ); |
|
233 | - $localeItem->setCurrencyId( null ); |
|
231 | + $localeItem = $localeManager->bootstrap($sitecode, '', '', false); |
|
232 | + $localeItem->setLanguageId(null); |
|
233 | + $localeItem->setCurrencyId(null); |
|
234 | 234 | } |
235 | - catch( \Aimeos\MShop\Locale\Exception $e ) |
|
235 | + catch (\Aimeos\MShop\Locale\Exception $e) |
|
236 | 236 | { |
237 | 237 | $localeItem = $localeManager->createItem(); |
238 | 238 | } |
239 | 239 | |
240 | - $context->setLocale( $localeItem ); |
|
241 | - $context->setI18n( app('\Aimeos\Shop\Base\I18n')->get( array( $lang ) ) ); |
|
240 | + $context->setLocale($localeItem); |
|
241 | + $context->setI18n(app('\Aimeos\Shop\Base\I18n')->get(array($lang))); |
|
242 | 242 | |
243 | 243 | return $context; |
244 | 244 | } |