@@ -31,48 +31,48 @@ discard block |
||
31 | 31 | * @param string|null $locale Code of the current language or null for no translation |
32 | 32 | * @return \Aimeos\MW\View\Iface View object |
33 | 33 | */ |
34 | - public function create( \Aimeos\MW\Config\Iface $config, array $templatePaths, $locale = null ) |
|
34 | + public function create(\Aimeos\MW\Config\Iface $config, array $templatePaths, $locale = null) |
|
35 | 35 | { |
36 | 36 | $params = $fixed = array(); |
37 | 37 | |
38 | - if( $locale !== null ) |
|
38 | + if ($locale !== null) |
|
39 | 39 | { |
40 | 40 | $params = Route::current()->parameters() + Input::all(); |
41 | 41 | $fixed = $this->getFixedParams(); |
42 | 42 | |
43 | - $i18n = app('\Aimeos\Shop\Base\I18n')->get( array( $locale ) ); |
|
43 | + $i18n = app('\Aimeos\Shop\Base\I18n')->get(array($locale)); |
|
44 | 44 | $translation = $i18n[$locale]; |
45 | 45 | } |
46 | 46 | else |
47 | 47 | { |
48 | - $translation = new \Aimeos\MW\Translation\None( 'en' ); |
|
48 | + $translation = new \Aimeos\MW\Translation\None('en'); |
|
49 | 49 | } |
50 | 50 | |
51 | 51 | |
52 | - $view = new \Aimeos\MW\View\Standard( $templatePaths ); |
|
52 | + $view = new \Aimeos\MW\View\Standard($templatePaths); |
|
53 | 53 | |
54 | - $helper = new \Aimeos\MW\View\Helper\Translate\Standard( $view, $translation ); |
|
55 | - $view->addHelper( 'translate', $helper ); |
|
54 | + $helper = new \Aimeos\MW\View\Helper\Translate\Standard($view, $translation); |
|
55 | + $view->addHelper('translate', $helper); |
|
56 | 56 | |
57 | - $helper = new \Aimeos\MW\View\Helper\Url\Laravel5( $view, app('url'), $fixed ); |
|
58 | - $view->addHelper( 'url', $helper ); |
|
57 | + $helper = new \Aimeos\MW\View\Helper\Url\Laravel5($view, app('url'), $fixed); |
|
58 | + $view->addHelper('url', $helper); |
|
59 | 59 | |
60 | - $helper = new \Aimeos\MW\View\Helper\Param\Standard( $view, $params ); |
|
61 | - $view->addHelper( 'param', $helper ); |
|
60 | + $helper = new \Aimeos\MW\View\Helper\Param\Standard($view, $params); |
|
61 | + $view->addHelper('param', $helper); |
|
62 | 62 | |
63 | - $helper = new \Aimeos\MW\View\Helper\Config\Standard( $view, $config ); |
|
64 | - $view->addHelper( 'config', $helper ); |
|
63 | + $helper = new \Aimeos\MW\View\Helper\Config\Standard($view, $config); |
|
64 | + $view->addHelper('config', $helper); |
|
65 | 65 | |
66 | - $sepDec = $config->get( 'client/html/common/format/seperatorDecimal', '.' ); |
|
67 | - $sep1000 = $config->get( 'client/html/common/format/seperator1000', ' ' ); |
|
68 | - $helper = new \Aimeos\MW\View\Helper\Number\Standard( $view, $sepDec, $sep1000 ); |
|
69 | - $view->addHelper( 'number', $helper ); |
|
66 | + $sepDec = $config->get('client/html/common/format/seperatorDecimal', '.'); |
|
67 | + $sep1000 = $config->get('client/html/common/format/seperator1000', ' '); |
|
68 | + $helper = new \Aimeos\MW\View\Helper\Number\Standard($view, $sepDec, $sep1000); |
|
69 | + $view->addHelper('number', $helper); |
|
70 | 70 | |
71 | - $helper = new \Aimeos\MW\View\Helper\Request\Laravel5( $view, Request::instance() ); |
|
72 | - $view->addHelper( 'request', $helper ); |
|
71 | + $helper = new \Aimeos\MW\View\Helper\Request\Laravel5($view, Request::instance()); |
|
72 | + $view->addHelper('request', $helper); |
|
73 | 73 | |
74 | - $helper = new \Aimeos\MW\View\Helper\Csrf\Standard( $view, '_token', csrf_token() ); |
|
75 | - $view->addHelper( 'csrf', $helper ); |
|
74 | + $helper = new \Aimeos\MW\View\Helper\Csrf\Standard($view, '_token', csrf_token()); |
|
75 | + $view->addHelper('csrf', $helper); |
|
76 | 76 | |
77 | 77 | return $view; |
78 | 78 | } |
@@ -87,15 +87,15 @@ discard block |
||
87 | 87 | { |
88 | 88 | $fixed = array(); |
89 | 89 | |
90 | - if( ( $value = Route::input( 'site' ) ) !== null ) { |
|
90 | + if (($value = Route::input('site')) !== null) { |
|
91 | 91 | $fixed['site'] = $value; |
92 | 92 | } |
93 | 93 | |
94 | - if( ( $value = Route::input( 'locale' ) ) !== null ) { |
|
94 | + if (($value = Route::input('locale')) !== null) { |
|
95 | 95 | $fixed['locale'] = $value; |
96 | 96 | } |
97 | 97 | |
98 | - if( ( $value = Route::input( 'currency' ) ) !== null ) { |
|
98 | + if (($value = Route::input('currency')) !== null) { |
|
99 | 99 | $fixed['currency'] = $value; |
100 | 100 | } |
101 | 101 |
@@ -36,31 +36,31 @@ discard block |
||
36 | 36 | */ |
37 | 37 | public function fire() |
38 | 38 | { |
39 | - $ctx = $this->getLaravel()->make( '\Aimeos\Shop\Base\Context' )->get( false ); |
|
40 | - $ctx->setEditor( 'aimeos:setup' ); |
|
39 | + $ctx = $this->getLaravel()->make('\Aimeos\Shop\Base\Context')->get(false); |
|
40 | + $ctx->setEditor('aimeos:setup'); |
|
41 | 41 | |
42 | 42 | $config = $ctx->getConfig(); |
43 | - $site = $this->argument( 'site' ); |
|
44 | - $template = $this->argument( 'tplsite' ); |
|
43 | + $site = $this->argument('site'); |
|
44 | + $template = $this->argument('tplsite'); |
|
45 | 45 | |
46 | - $config->set( 'setup/site', $site ); |
|
47 | - $dbconfig = $this->getDbConfig( $config ); |
|
48 | - $this->setOptions( $config ); |
|
46 | + $config->set('setup/site', $site); |
|
47 | + $dbconfig = $this->getDbConfig($config); |
|
48 | + $this->setOptions($config); |
|
49 | 49 | |
50 | - $taskPaths = $this->getLaravel()->make( '\Aimeos\Shop\Base\Aimeos' )->get()->getSetupPaths( $template ); |
|
50 | + $taskPaths = $this->getLaravel()->make('\Aimeos\Shop\Base\Aimeos')->get()->getSetupPaths($template); |
|
51 | 51 | |
52 | 52 | $includePaths = $taskPaths; |
53 | 53 | $includePaths[] = get_include_path(); |
54 | 54 | |
55 | - if( set_include_path( implode( PATH_SEPARATOR, $includePaths ) ) === false ) { |
|
56 | - throw new Exception( 'Unable to extend include path' ); |
|
55 | + if (set_include_path(implode(PATH_SEPARATOR, $includePaths)) === false) { |
|
56 | + throw new Exception('Unable to extend include path'); |
|
57 | 57 | } |
58 | 58 | |
59 | - $manager = new \Aimeos\MW\Setup\Manager\Multiple( $ctx->getDatabaseManager(), $dbconfig, $taskPaths, $ctx ); |
|
59 | + $manager = new \Aimeos\MW\Setup\Manager\Multiple($ctx->getDatabaseManager(), $dbconfig, $taskPaths, $ctx); |
|
60 | 60 | |
61 | - $this->info( sprintf( 'Initializing or updating the Aimeos database tables for site "%1$s"', $site ) ); |
|
61 | + $this->info(sprintf('Initializing or updating the Aimeos database tables for site "%1$s"', $site)); |
|
62 | 62 | |
63 | - $manager->run( 'mysql' ); |
|
63 | + $manager->run('mysql'); |
|
64 | 64 | } |
65 | 65 | |
66 | 66 | |
@@ -72,8 +72,8 @@ discard block |
||
72 | 72 | protected function getArguments() |
73 | 73 | { |
74 | 74 | return array( |
75 | - array( 'site', InputArgument::OPTIONAL, 'Site for updating database entries', 'default' ), |
|
76 | - array( 'tplsite', InputArgument::OPTIONAL, 'Site used as template for creating the new one', 'default' ), |
|
75 | + array('site', InputArgument::OPTIONAL, 'Site for updating database entries', 'default'), |
|
76 | + array('tplsite', InputArgument::OPTIONAL, 'Site used as template for creating the new one', 'default'), |
|
77 | 77 | ); |
78 | 78 | } |
79 | 79 | |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | protected function getOptions() |
87 | 87 | { |
88 | 88 | return array( |
89 | - array( 'option', null, InputOption::VALUE_REQUIRED, 'Optional setup configuration, name and value are separated by ":" like "setup/default/demo:1"', array() ), |
|
89 | + array('option', null, InputOption::VALUE_REQUIRED, 'Optional setup configuration, name and value are separated by ":" like "setup/default/demo:1"', array()), |
|
90 | 90 | ); |
91 | 91 | } |
92 | 92 | |
@@ -97,14 +97,14 @@ discard block |
||
97 | 97 | * @param \Aimeos\MW\Config\Iface $conf Config object |
98 | 98 | * @return array Multi-dimensional associative list of database configuration parameters |
99 | 99 | */ |
100 | - protected function getDbConfig( \Aimeos\MW\Config\Iface $conf ) |
|
100 | + protected function getDbConfig(\Aimeos\MW\Config\Iface $conf) |
|
101 | 101 | { |
102 | - $dbconfig = $conf->get( 'resource', array() ); |
|
102 | + $dbconfig = $conf->get('resource', array()); |
|
103 | 103 | |
104 | - foreach( $dbconfig as $rname => $dbconf ) |
|
104 | + foreach ($dbconfig as $rname => $dbconf) |
|
105 | 105 | { |
106 | - if( strncmp( $rname, 'db', 2 ) !== 0 ) { |
|
107 | - unset( $dbconfig[$rname] ); |
|
106 | + if (strncmp($rname, 'db', 2) !== 0) { |
|
107 | + unset($dbconfig[$rname]); |
|
108 | 108 | } |
109 | 109 | } |
110 | 110 | |
@@ -119,12 +119,12 @@ discard block |
||
119 | 119 | * @param array Associative list of database configurations |
120 | 120 | * @throws \RuntimeException If the format of the options is invalid |
121 | 121 | */ |
122 | - protected function setOptions( \Aimeos\MW\Config\Iface $conf ) |
|
122 | + protected function setOptions(\Aimeos\MW\Config\Iface $conf) |
|
123 | 123 | { |
124 | - foreach( (array) $this->option( 'option' ) as $option ) |
|
124 | + foreach ((array) $this->option('option') as $option) |
|
125 | 125 | { |
126 | - list( $name, $value ) = explode( ':', $option ); |
|
127 | - $conf->set( $name, $value ); |
|
126 | + list($name, $value) = explode(':', $option); |
|
127 | + $conf->set($name, $value); |
|
128 | 128 | } |
129 | 129 | } |
130 | 130 | } |
@@ -39,21 +39,21 @@ discard block |
||
39 | 39 | */ |
40 | 40 | public function fire() |
41 | 41 | { |
42 | - $code = $this->argument( 'email' ); |
|
43 | - if( ( $password = $this->option( 'password' ) ) === null ) { |
|
44 | - $password = $this->secret( 'Password' ); |
|
42 | + $code = $this->argument('email'); |
|
43 | + if (($password = $this->option('password')) === null) { |
|
44 | + $password = $this->secret('Password'); |
|
45 | 45 | } |
46 | 46 | |
47 | - $context = $this->getLaravel()->make( 'Aimeos\Shop\Base\Context' )->get( false ); |
|
48 | - $context->setEditor( 'aimeos:account' ); |
|
47 | + $context = $this->getLaravel()->make('Aimeos\Shop\Base\Context')->get(false); |
|
48 | + $context->setEditor('aimeos:account'); |
|
49 | 49 | |
50 | - $localeManager = \Aimeos\MShop\Locale\Manager\Factory::createManager( $context ); |
|
51 | - $context->setLocale( $localeManager->createItem() ); |
|
50 | + $localeManager = \Aimeos\MShop\Locale\Manager\Factory::createManager($context); |
|
51 | + $context->setLocale($localeManager->createItem()); |
|
52 | 52 | |
53 | - $user = $this->createCustomerItem( $context, $code, $password ); |
|
53 | + $user = $this->createCustomerItem($context, $code, $password); |
|
54 | 54 | |
55 | - if( $this->option( 'admin' ) ) { |
|
56 | - $this->addPrivilege( $context, $user, 'admin' ); |
|
55 | + if ($this->option('admin')) { |
|
56 | + $this->addPrivilege($context, $user, 'admin'); |
|
57 | 57 | } |
58 | 58 | } |
59 | 59 | |
@@ -65,31 +65,31 @@ discard block |
||
65 | 65 | * @param string $userid Unique user ID |
66 | 66 | * @param string $groupid Unique group ID |
67 | 67 | */ |
68 | - protected function addListItem( \Aimeos\MShop\Context\Item\Iface $context, $userid, $groupid ) |
|
68 | + protected function addListItem(\Aimeos\MShop\Context\Item\Iface $context, $userid, $groupid) |
|
69 | 69 | { |
70 | - $manager = \Aimeos\MShop\Customer\Manager\Factory::createManager( $context )->getSubmanager( 'lists' ); |
|
71 | - $typeid = $manager->getSubmanager( 'type' )->findItem( 'default', array(), 'customer/group' )->getId(); |
|
70 | + $manager = \Aimeos\MShop\Customer\Manager\Factory::createManager($context)->getSubmanager('lists'); |
|
71 | + $typeid = $manager->getSubmanager('type')->findItem('default', array(), 'customer/group')->getId(); |
|
72 | 72 | |
73 | 73 | $search = $manager->createSearch(); |
74 | 74 | $expr = array( |
75 | - $search->compare( '==', 'customer.lists.parentid', $userid ), |
|
76 | - $search->compare( '==', 'customer.lists.refid', $groupid ), |
|
77 | - $search->compare( '==', 'customer.lists.domain', 'customer/group' ), |
|
78 | - $search->compare( '==', 'customer.lists.typeid', $typeid ), |
|
75 | + $search->compare('==', 'customer.lists.parentid', $userid), |
|
76 | + $search->compare('==', 'customer.lists.refid', $groupid), |
|
77 | + $search->compare('==', 'customer.lists.domain', 'customer/group'), |
|
78 | + $search->compare('==', 'customer.lists.typeid', $typeid), |
|
79 | 79 | ); |
80 | - $search->setConditions( $search->combine( '&&', $expr ) ); |
|
81 | - $search->setSlice( 0, 1 ); |
|
80 | + $search->setConditions($search->combine('&&', $expr)); |
|
81 | + $search->setSlice(0, 1); |
|
82 | 82 | |
83 | - if( count( $manager->searchItems( $search ) ) === 0 ) |
|
83 | + if (count($manager->searchItems($search)) === 0) |
|
84 | 84 | { |
85 | 85 | $item = $manager->createItem(); |
86 | - $item->setDomain( 'customer/group' ); |
|
87 | - $item->setParentId( $userid ); |
|
88 | - $item->setTypeId( $typeid ); |
|
89 | - $item->setRefId( $groupid ); |
|
90 | - $item->setStatus( 1 ); |
|
86 | + $item->setDomain('customer/group'); |
|
87 | + $item->setParentId($userid); |
|
88 | + $item->setTypeId($typeid); |
|
89 | + $item->setRefId($groupid); |
|
90 | + $item->setStatus(1); |
|
91 | 91 | |
92 | - $manager->saveItem( $item, false ); |
|
92 | + $manager->saveItem($item, false); |
|
93 | 93 | } |
94 | 94 | } |
95 | 95 | |
@@ -101,23 +101,23 @@ discard block |
||
101 | 101 | * @param \Aimeos\MShop\Customer\Item\Iface $user Aimeos customer object |
102 | 102 | * @param string $privilege Unique customer group code |
103 | 103 | */ |
104 | - protected function addPrivilege( \Aimeos\MShop\Context\Item\Iface $context, \Aimeos\MShop\Customer\Item\Iface $user, $privilege ) |
|
104 | + protected function addPrivilege(\Aimeos\MShop\Context\Item\Iface $context, \Aimeos\MShop\Customer\Item\Iface $user, $privilege) |
|
105 | 105 | { |
106 | - $this->info( sprintf( 'Add "%1$s" privilege to user "%2$s" for sites', $privilege, $user->getCode() ) ); |
|
106 | + $this->info(sprintf('Add "%1$s" privilege to user "%2$s" for sites', $privilege, $user->getCode())); |
|
107 | 107 | |
108 | - $localeManager = \Aimeos\MShop\Locale\Manager\Factory::createManager( $context ); |
|
108 | + $localeManager = \Aimeos\MShop\Locale\Manager\Factory::createManager($context); |
|
109 | 109 | |
110 | - foreach( $this->getSiteItems( $context, $this->argument( 'site' ) ) as $siteItem ) |
|
110 | + foreach ($this->getSiteItems($context, $this->argument('site')) as $siteItem) |
|
111 | 111 | { |
112 | - $localeItem = $localeManager->bootstrap( $siteItem->getCode(), '', '', false ); |
|
112 | + $localeItem = $localeManager->bootstrap($siteItem->getCode(), '', '', false); |
|
113 | 113 | |
114 | 114 | $lcontext = clone $context; |
115 | - $lcontext->setLocale( $localeItem ); |
|
115 | + $lcontext->setLocale($localeItem); |
|
116 | 116 | |
117 | - $this->info( '- ' . $siteItem->getCode() ); |
|
117 | + $this->info('- ' . $siteItem->getCode()); |
|
118 | 118 | |
119 | - $groupItem = $this->getGroupItem( $lcontext, $privilege ); |
|
120 | - $this->addListItem( $lcontext, $user->getId(), $groupItem->getId() ); |
|
119 | + $groupItem = $this->getGroupItem($lcontext, $privilege); |
|
120 | + $this->addListItem($lcontext, $user->getId(), $groupItem->getId()); |
|
121 | 121 | } |
122 | 122 | } |
123 | 123 | |
@@ -132,21 +132,21 @@ discard block |
||
132 | 132 | * @param string $password New user password |
133 | 133 | * @return \Aimeos\MShop\Customer\Item\Iface Aimeos customer item object |
134 | 134 | */ |
135 | - protected function createCustomerItem( \Aimeos\MShop\Context\Item\Iface $context, $email, $password ) |
|
135 | + protected function createCustomerItem(\Aimeos\MShop\Context\Item\Iface $context, $email, $password) |
|
136 | 136 | { |
137 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'customer' ); |
|
137 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'customer'); |
|
138 | 138 | |
139 | 139 | try { |
140 | - $item = $manager->findItem( $email ); |
|
141 | - } catch( \Aimeos\MShop\Exception $e ) { |
|
140 | + $item = $manager->findItem($email); |
|
141 | + } catch (\Aimeos\MShop\Exception $e) { |
|
142 | 142 | $item = $manager->createItem(); |
143 | 143 | } |
144 | 144 | |
145 | - $item->setCode( $email ); |
|
146 | - $item->getPaymentAddress()->setEmail( $email ); |
|
147 | - $item->setPassword( $password ); |
|
145 | + $item->setCode($email); |
|
146 | + $item->getPaymentAddress()->setEmail($email); |
|
147 | + $item->setPassword($password); |
|
148 | 148 | |
149 | - $manager->saveItem( $item ); |
|
149 | + $manager->saveItem($item); |
|
150 | 150 | |
151 | 151 | return $item; |
152 | 152 | } |
@@ -160,8 +160,8 @@ discard block |
||
160 | 160 | protected function getArguments() |
161 | 161 | { |
162 | 162 | return array( |
163 | - array( 'email', InputArgument::REQUIRED, 'E-mail address of the account that should be created' ), |
|
164 | - array( 'site', InputArgument::OPTIONAL, 'Site codes to create accounts for like "default unittest" (none for all)' ), |
|
163 | + array('email', InputArgument::REQUIRED, 'E-mail address of the account that should be created'), |
|
164 | + array('site', InputArgument::OPTIONAL, 'Site codes to create accounts for like "default unittest" (none for all)'), |
|
165 | 165 | ); |
166 | 166 | } |
167 | 167 | |
@@ -173,21 +173,21 @@ discard block |
||
173 | 173 | * @param string $code Unique customer group code |
174 | 174 | * @return \Aimeos\MShop\Customer\Item\Group\Iface Aimeos customer group item object |
175 | 175 | */ |
176 | - protected function getGroupItem( \Aimeos\MShop\Context\Item\Iface $context, $code ) |
|
176 | + protected function getGroupItem(\Aimeos\MShop\Context\Item\Iface $context, $code) |
|
177 | 177 | { |
178 | - $manager = \Aimeos\MShop\Customer\Manager\Factory::createManager( $context )->getSubmanager( 'group' ); |
|
178 | + $manager = \Aimeos\MShop\Customer\Manager\Factory::createManager($context)->getSubmanager('group'); |
|
179 | 179 | |
180 | 180 | try |
181 | 181 | { |
182 | - $item = $manager->findItem( $code ); |
|
182 | + $item = $manager->findItem($code); |
|
183 | 183 | } |
184 | - catch( \Aimeos\MShop\Exception $e ) |
|
184 | + catch (\Aimeos\MShop\Exception $e) |
|
185 | 185 | { |
186 | 186 | $item = $manager->createItem(); |
187 | - $item->setLabel( $code ); |
|
188 | - $item->setCode( $code ); |
|
187 | + $item->setLabel($code); |
|
188 | + $item->setCode($code); |
|
189 | 189 | |
190 | - $manager->saveItem( $item ); |
|
190 | + $manager->saveItem($item); |
|
191 | 191 | } |
192 | 192 | |
193 | 193 | return $item; |
@@ -202,8 +202,8 @@ discard block |
||
202 | 202 | protected function getOptions() |
203 | 203 | { |
204 | 204 | return array( |
205 | - array( 'password', null, InputOption::VALUE_REQUIRED, 'Optional password for the account (will ask for if not given)' ), |
|
206 | - array( 'admin', null, InputOption::VALUE_NONE, 'If account should have administrator privileges' ), |
|
205 | + array('password', null, InputOption::VALUE_REQUIRED, 'Optional password for the account (will ask for if not given)'), |
|
206 | + array('admin', null, InputOption::VALUE_NONE, 'If account should have administrator privileges'), |
|
207 | 207 | ); |
208 | 208 | } |
209 | 209 | } |
@@ -36,18 +36,18 @@ |
||
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() && $request->user()->can( 'admin' ) ) ) { |
|
42 | - return View::make( 'shop::admin.index' ); |
|
41 | + if (config('shop.authorize', true) && !(Auth::check() && $request->user()->can('admin'))) { |
|
42 | + return View::make('shop::admin.index'); |
|
43 | 43 | } |
44 | 44 | |
45 | 45 | $param = array( |
46 | 46 | 'resource' => 'product', |
47 | - 'site' => Route::input( 'site', 'default' ), |
|
48 | - 'lang' => Input::get( 'lang', config( 'app.locale', 'en' ) ), |
|
47 | + 'site' => Route::input('site', 'default'), |
|
48 | + 'lang' => Input::get('lang', config('app.locale', 'en')), |
|
49 | 49 | ); |
50 | 50 | |
51 | - return redirect()->route( 'aimeos_shop_jqadm_search', $param ); |
|
51 | + return redirect()->route('aimeos_shop_jqadm_search', $param); |
|
52 | 52 | } |
53 | 53 | } |
54 | 54 | \ No newline at end of file |
@@ -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 | |
@@ -101,20 +101,20 @@ discard block |
||
101 | 101 | */ |
102 | 102 | public function doAction() |
103 | 103 | { |
104 | - if( config( 'shop.authorize', true ) ) { |
|
105 | - $this->authorize( 'admin' ); |
|
104 | + if (config('shop.authorize', true)) { |
|
105 | + $this->authorize('admin'); |
|
106 | 106 | } |
107 | 107 | |
108 | - $aimeos = app( '\Aimeos\Shop\Base\Aimeos' )->get(); |
|
109 | - $cntlPaths = $aimeos->getCustomPaths( 'controller/extjs' ); |
|
108 | + $aimeos = app('\Aimeos\Shop\Base\Aimeos')->get(); |
|
109 | + $cntlPaths = $aimeos->getCustomPaths('controller/extjs'); |
|
110 | 110 | |
111 | - $context = app( '\Aimeos\Shop\Base\Context' )->get( false ); |
|
112 | - $context = $this->setLocale( $context ); |
|
111 | + $context = app('\Aimeos\Shop\Base\Context')->get(false); |
|
112 | + $context = $this->setLocale($context); |
|
113 | 113 | |
114 | - $controller = new \Aimeos\Controller\ExtJS\JsonRpc( $context, $cntlPaths ); |
|
114 | + $controller = new \Aimeos\Controller\ExtJS\JsonRpc($context, $cntlPaths); |
|
115 | 115 | |
116 | - $response = $controller->process( Input::instance()->request->all(), 'php://input' ); |
|
117 | - return View::make( 'shop::extadm.do', array( 'output' => $response ) ); |
|
116 | + $response = $controller->process(Input::instance()->request->all(), 'php://input'); |
|
117 | + return View::make('shop::extadm.do', array('output' => $response)); |
|
118 | 118 | } |
119 | 119 | |
120 | 120 | |
@@ -125,32 +125,32 @@ discard block |
||
125 | 125 | */ |
126 | 126 | public function fileAction() |
127 | 127 | { |
128 | - if( config( 'shop.authorize', true ) ) { |
|
129 | - $this->authorize( 'admin' ); |
|
128 | + if (config('shop.authorize', true)) { |
|
129 | + $this->authorize('admin'); |
|
130 | 130 | } |
131 | 131 | |
132 | 132 | $contents = ''; |
133 | 133 | $jsFiles = array(); |
134 | - $aimeos = app( '\Aimeos\Shop\Base\Aimeos' )->get(); |
|
134 | + $aimeos = app('\Aimeos\Shop\Base\Aimeos')->get(); |
|
135 | 135 | |
136 | - foreach( $aimeos->getCustomPaths( 'admin/extjs' ) as $base => $paths ) |
|
136 | + foreach ($aimeos->getCustomPaths('admin/extjs') as $base => $paths) |
|
137 | 137 | { |
138 | - foreach( $paths as $path ) |
|
138 | + foreach ($paths as $path) |
|
139 | 139 | { |
140 | 140 | $jsbAbsPath = $base . '/' . $path; |
141 | - $jsb2 = new \Aimeos\MW\Jsb2\Standard( $jsbAbsPath, dirname( $jsbAbsPath ) ); |
|
142 | - $jsFiles = array_merge( $jsFiles, $jsb2->getFiles( 'js' ) ); |
|
141 | + $jsb2 = new \Aimeos\MW\Jsb2\Standard($jsbAbsPath, dirname($jsbAbsPath)); |
|
142 | + $jsFiles = array_merge($jsFiles, $jsb2->getFiles('js')); |
|
143 | 143 | } |
144 | 144 | } |
145 | 145 | |
146 | - foreach( $jsFiles as $file ) |
|
146 | + foreach ($jsFiles as $file) |
|
147 | 147 | { |
148 | - if( ( $content = file_get_contents( $file ) ) !== false ) { |
|
148 | + if (($content = file_get_contents($file)) !== false) { |
|
149 | 149 | $contents .= $content; |
150 | 150 | } |
151 | 151 | } |
152 | 152 | |
153 | - return response( $contents )->header( 'Content-Type', 'application/javascript' ); |
|
153 | + return response($contents)->header('Content-Type', 'application/javascript'); |
|
154 | 154 | } |
155 | 155 | |
156 | 156 | |
@@ -160,15 +160,15 @@ discard block |
||
160 | 160 | * @param \Aimeos\MShop\Context\Item\Iface $context Context object |
161 | 161 | * @return array List of language IDs with labels |
162 | 162 | */ |
163 | - protected function getJsonLanguages( \Aimeos\MShop\Context\Item\Iface $context ) |
|
163 | + protected function getJsonLanguages(\Aimeos\MShop\Context\Item\Iface $context) |
|
164 | 164 | { |
165 | 165 | $result = array(); |
166 | 166 | |
167 | - foreach( app( '\Aimeos\Shop\Base\Aimeos' )->get()->getI18nList( 'admin' ) as $id ) { |
|
168 | - $result[] = array( 'id' => $id, 'label' => $id ); |
|
167 | + foreach (app('\Aimeos\Shop\Base\Aimeos')->get()->getI18nList('admin') as $id) { |
|
168 | + $result[] = array('id' => $id, 'label' => $id); |
|
169 | 169 | } |
170 | 170 | |
171 | - return json_encode( $result ); |
|
171 | + return json_encode($result); |
|
172 | 172 | } |
173 | 173 | |
174 | 174 | |
@@ -178,10 +178,10 @@ discard block |
||
178 | 178 | * @param \Aimeos\MShop\Context\Item\Iface $context Context item object |
179 | 179 | * @return string JSON encoded configuration object |
180 | 180 | */ |
181 | - protected function getJsonClientConfig( \Aimeos\MShop\Context\Item\Iface $context ) |
|
181 | + protected function getJsonClientConfig(\Aimeos\MShop\Context\Item\Iface $context) |
|
182 | 182 | { |
183 | - $config = $context->getConfig()->get( 'admin/extjs', array() ); |
|
184 | - return json_encode( array( 'admin' => array( 'extjs' => $config ) ), JSON_FORCE_OBJECT ); |
|
183 | + $config = $context->getConfig()->get('admin/extjs', array()); |
|
184 | + return json_encode(array('admin' => array('extjs' => $config)), JSON_FORCE_OBJECT); |
|
185 | 185 | } |
186 | 186 | |
187 | 187 | |
@@ -192,16 +192,16 @@ discard block |
||
192 | 192 | * @param string $lang ISO language code like "en" or "en_GB" |
193 | 193 | * @return string JSON encoded translation object |
194 | 194 | */ |
195 | - protected function getJsonClientI18n( array $i18nPaths, $lang ) |
|
195 | + protected function getJsonClientI18n(array $i18nPaths, $lang) |
|
196 | 196 | { |
197 | - $i18n = new \Aimeos\MW\Translation\Zend2( $i18nPaths, 'gettext', $lang, array( 'disableNotices' => true ) ); |
|
197 | + $i18n = new \Aimeos\MW\Translation\Zend2($i18nPaths, 'gettext', $lang, array('disableNotices' => true)); |
|
198 | 198 | |
199 | 199 | $content = array( |
200 | - 'admin' => $i18n->getAll( 'admin' ), |
|
201 | - 'admin/ext' => $i18n->getAll( 'admin/ext' ), |
|
200 | + 'admin' => $i18n->getAll('admin'), |
|
201 | + 'admin/ext' => $i18n->getAll('admin/ext'), |
|
202 | 202 | ); |
203 | 203 | |
204 | - return json_encode( $content, JSON_FORCE_OBJECT ); |
|
204 | + return json_encode($content, JSON_FORCE_OBJECT); |
|
205 | 205 | } |
206 | 206 | |
207 | 207 | |
@@ -213,19 +213,19 @@ discard block |
||
213 | 213 | * @return string JSON encoded site item object |
214 | 214 | * @throws Exception If no site item was found for the code |
215 | 215 | */ |
216 | - protected function getJsonSiteItem( \Aimeos\MShop\Context\Item\Iface $context, $site ) |
|
216 | + protected function getJsonSiteItem(\Aimeos\MShop\Context\Item\Iface $context, $site) |
|
217 | 217 | { |
218 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'locale/site' ); |
|
218 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'locale/site'); |
|
219 | 219 | |
220 | 220 | $criteria = $manager->createSearch(); |
221 | - $criteria->setConditions( $criteria->compare( '==', 'locale.site.code', $site ) ); |
|
222 | - $items = $manager->searchItems( $criteria ); |
|
221 | + $criteria->setConditions($criteria->compare('==', 'locale.site.code', $site)); |
|
222 | + $items = $manager->searchItems($criteria); |
|
223 | 223 | |
224 | - if( ( $item = reset( $items ) ) === false ) { |
|
225 | - throw new \Exception( sprintf( 'No site found for code "%1$s"', $site ) ); |
|
224 | + if (($item = reset($items)) === false) { |
|
225 | + throw new \Exception(sprintf('No site found for code "%1$s"', $site)); |
|
226 | 226 | } |
227 | 227 | |
228 | - return json_encode( $item->toArray() ); |
|
228 | + return json_encode($item->toArray()); |
|
229 | 229 | } |
230 | 230 | |
231 | 231 | |
@@ -237,17 +237,17 @@ discard block |
||
237 | 237 | * @param string $locale ISO language code, e.g. "en" or "en_GB" |
238 | 238 | * @return \Aimeos\MShop\Context\Item\Iface Modified context object |
239 | 239 | */ |
240 | - protected function setLocale( \Aimeos\MShop\Context\Item\Iface $context, $sitecode = 'default', $locale = null ) |
|
240 | + protected function setLocale(\Aimeos\MShop\Context\Item\Iface $context, $sitecode = 'default', $locale = null) |
|
241 | 241 | { |
242 | - $localeManager = \Aimeos\MShop\Factory::createManager( $context, 'locale' ); |
|
242 | + $localeManager = \Aimeos\MShop\Factory::createManager($context, 'locale'); |
|
243 | 243 | |
244 | 244 | try { |
245 | - $localeItem = $localeManager->bootstrap( $sitecode, $locale, '', false ); |
|
246 | - } catch( \Aimeos\MShop\Locale\Exception $e ) { |
|
245 | + $localeItem = $localeManager->bootstrap($sitecode, $locale, '', false); |
|
246 | + } catch (\Aimeos\MShop\Locale\Exception $e) { |
|
247 | 247 | $localeItem = $localeManager->createItem(); |
248 | 248 | } |
249 | 249 | |
250 | - $context->setLocale( $localeItem ); |
|
250 | + $context->setLocale($localeItem); |
|
251 | 251 | |
252 | 252 | return $context; |
253 | 253 | } |
@@ -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; |
@@ -64,12 +64,12 @@ discard block |
||
64 | 64 | */ |
65 | 65 | public function getVersion() |
66 | 66 | { |
67 | - if( ( $content = @file_get_contents( base_path( 'composer.lock' ) ) ) !== false |
|
68 | - && ( $content = json_decode( $content, true ) ) !== null && isset( $content['packages'] ) |
|
67 | + if (($content = @file_get_contents(base_path('composer.lock'))) !== false |
|
68 | + && ($content = json_decode($content, true)) !== null && isset($content['packages']) |
|
69 | 69 | ) { |
70 | - foreach( (array) $content['packages'] as $item ) |
|
70 | + foreach ((array) $content['packages'] as $item) |
|
71 | 71 | { |
72 | - if( $item['name'] === 'aimeos/aimeos-laravel' ) { |
|
72 | + if ($item['name'] === 'aimeos/aimeos-laravel') { |
|
73 | 73 | return $item['version']; |
74 | 74 | } |
75 | 75 | } |
@@ -35,19 +35,19 @@ discard block |
||
35 | 35 | * @param \Illuminate\Http\Request $request Request object |
36 | 36 | * @return \Illuminate\Http\Response Response object containing the generated output |
37 | 37 | */ |
38 | - public function deleteAction( Request $request ) |
|
38 | + public function deleteAction(Request $request) |
|
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 | 47 | $cntl = $this->createController(); |
48 | - $result = $cntl->delete( $request->getContent(), $header, $status ); |
|
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 | |
@@ -57,19 +57,19 @@ discard block |
||
57 | 57 | * @param \Illuminate\Http\Request $request Request object |
58 | 58 | * @return \Illuminate\Http\Response Response object containing the generated output |
59 | 59 | */ |
60 | - public function getAction( Request $request ) |
|
60 | + public function getAction(Request $request) |
|
61 | 61 | { |
62 | - if( config( 'shop.authorize', true ) ) { |
|
63 | - $this->authorize( 'admin' ); |
|
62 | + if (config('shop.authorize', true)) { |
|
63 | + $this->authorize('admin'); |
|
64 | 64 | } |
65 | 65 | |
66 | 66 | $status = 500; |
67 | 67 | $header = $request->headers->all(); |
68 | 68 | |
69 | 69 | $cntl = $this->createController(); |
70 | - $result = $cntl->get( $request->getContent(), $header, $status ); |
|
70 | + $result = $cntl->get($request->getContent(), $header, $status); |
|
71 | 71 | |
72 | - return $this->createResponse( $result, $status, $header ); |
|
72 | + return $this->createResponse($result, $status, $header); |
|
73 | 73 | } |
74 | 74 | |
75 | 75 | |
@@ -79,19 +79,19 @@ discard block |
||
79 | 79 | * @param \Illuminate\Http\Request $request Request object |
80 | 80 | * @return \Illuminate\Http\Response Response object containing the generated output |
81 | 81 | */ |
82 | - public function patchAction( Request $request ) |
|
82 | + public function patchAction(Request $request) |
|
83 | 83 | { |
84 | - if( config( 'shop.authorize', true ) ) { |
|
85 | - $this->authorize( 'admin' ); |
|
84 | + if (config('shop.authorize', true)) { |
|
85 | + $this->authorize('admin'); |
|
86 | 86 | } |
87 | 87 | |
88 | 88 | $status = 500; |
89 | 89 | $header = $request->headers->all(); |
90 | 90 | |
91 | 91 | $cntl = $this->createController(); |
92 | - $result = $cntl->patch( $request->getContent(), $header, $status ); |
|
92 | + $result = $cntl->patch($request->getContent(), $header, $status); |
|
93 | 93 | |
94 | - return $this->createResponse( $result, $status, $header ); |
|
94 | + return $this->createResponse($result, $status, $header); |
|
95 | 95 | } |
96 | 96 | |
97 | 97 | |
@@ -101,19 +101,19 @@ discard block |
||
101 | 101 | * @param \Illuminate\Http\Request $request Request object |
102 | 102 | * @return \Illuminate\Http\Response Response object containing the generated output |
103 | 103 | */ |
104 | - public function postAction( Request $request ) |
|
104 | + public function postAction(Request $request) |
|
105 | 105 | { |
106 | - if( config( 'shop.authorize', true ) ) { |
|
107 | - $this->authorize( 'admin' ); |
|
106 | + if (config('shop.authorize', true)) { |
|
107 | + $this->authorize('admin'); |
|
108 | 108 | } |
109 | 109 | |
110 | 110 | $status = 500; |
111 | 111 | $header = $request->headers->all(); |
112 | 112 | |
113 | 113 | $cntl = $this->createController(); |
114 | - $result = $cntl->post( $request->getContent(), $header, $status ); |
|
114 | + $result = $cntl->post($request->getContent(), $header, $status); |
|
115 | 115 | |
116 | - return $this->createResponse( $result, $status, $header ); |
|
116 | + return $this->createResponse($result, $status, $header); |
|
117 | 117 | } |
118 | 118 | |
119 | 119 | |
@@ -123,19 +123,19 @@ discard block |
||
123 | 123 | * @param \Illuminate\Http\Request $request Request object |
124 | 124 | * @return \Illuminate\Http\Response Response object containing the generated output |
125 | 125 | */ |
126 | - public function putAction( Request $request ) |
|
126 | + public function putAction(Request $request) |
|
127 | 127 | { |
128 | - if( config( 'shop.authorize', true ) ) { |
|
129 | - $this->authorize( 'admin' ); |
|
128 | + if (config('shop.authorize', true)) { |
|
129 | + $this->authorize('admin'); |
|
130 | 130 | } |
131 | 131 | |
132 | 132 | $status = 500; |
133 | 133 | $header = $request->headers->all(); |
134 | 134 | |
135 | 135 | $cntl = $this->createController(); |
136 | - $result = $cntl->put( $request->getContent(), $header, $status ); |
|
136 | + $result = $cntl->put($request->getContent(), $header, $status); |
|
137 | 137 | |
138 | - return $this->createResponse( $result, $status, $header ); |
|
138 | + return $this->createResponse($result, $status, $header); |
|
139 | 139 | } |
140 | 140 | |
141 | 141 | |
@@ -145,19 +145,19 @@ discard block |
||
145 | 145 | * @param \Illuminate\Http\Request $request Request object |
146 | 146 | * @return \Illuminate\Http\Response Response object containing the generated output |
147 | 147 | */ |
148 | - public function optionsAction( Request $request ) |
|
148 | + public function optionsAction(Request $request) |
|
149 | 149 | { |
150 | - if( config( 'shop.authorize', true ) ) { |
|
151 | - $this->authorize( 'admin' ); |
|
150 | + if (config('shop.authorize', true)) { |
|
151 | + $this->authorize('admin'); |
|
152 | 152 | } |
153 | 153 | |
154 | 154 | $status = 500; |
155 | 155 | $header = $request->headers->all(); |
156 | 156 | |
157 | 157 | $cntl = $this->createController(); |
158 | - $result = $cntl->options( $request->getContent(), $header, $status ); |
|
158 | + $result = $cntl->options($request->getContent(), $header, $status); |
|
159 | 159 | |
160 | - return $this->createResponse( $result, $status, $header ); |
|
160 | + return $this->createResponse($result, $status, $header); |
|
161 | 161 | } |
162 | 162 | |
163 | 163 | |
@@ -168,20 +168,20 @@ discard block |
||
168 | 168 | */ |
169 | 169 | protected function createController() |
170 | 170 | { |
171 | - $site = Route::input( 'site', Input::get( 'site', 'default' ) ); |
|
172 | - $lang = Input::get( 'lang', config( 'app.locale', 'en' ) ); |
|
173 | - $resource = Route::input( 'resource' ); |
|
171 | + $site = Route::input('site', Input::get('site', 'default')); |
|
172 | + $lang = Input::get('lang', config('app.locale', 'en')); |
|
173 | + $resource = Route::input('resource'); |
|
174 | 174 | |
175 | - $aimeos = app( '\Aimeos\Shop\Base\Aimeos' )->get(); |
|
176 | - $templatePaths = $aimeos->getCustomPaths( 'controller/jsonadm/templates' ); |
|
175 | + $aimeos = app('\Aimeos\Shop\Base\Aimeos')->get(); |
|
176 | + $templatePaths = $aimeos->getCustomPaths('controller/jsonadm/templates'); |
|
177 | 177 | |
178 | - $context = app( '\Aimeos\Shop\Base\Context' )->get( false ); |
|
179 | - $context = $this->setLocale( $context, $site, $lang ); |
|
178 | + $context = app('\Aimeos\Shop\Base\Context')->get(false); |
|
179 | + $context = $this->setLocale($context, $site, $lang); |
|
180 | 180 | |
181 | - $view = app( '\Aimeos\Shop\Base\View' )->create( $context->getConfig(), $templatePaths, $lang ); |
|
182 | - $context->setView( $view ); |
|
181 | + $view = app('\Aimeos\Shop\Base\View')->create($context->getConfig(), $templatePaths, $lang); |
|
182 | + $context->setView($view); |
|
183 | 183 | |
184 | - return \Aimeos\Controller\JsonAdm\Factory::createController( $context, $templatePaths, $resource ); |
|
184 | + return \Aimeos\Controller\JsonAdm\Factory::createController($context, $templatePaths, $resource); |
|
185 | 185 | } |
186 | 186 | |
187 | 187 | |
@@ -193,12 +193,12 @@ discard block |
||
193 | 193 | * @param array $header List of HTTP headers |
194 | 194 | * @return \Illuminate\Http\Response HTTP response object |
195 | 195 | */ |
196 | - protected function createResponse( $content, $status, array $header ) |
|
196 | + protected function createResponse($content, $status, array $header) |
|
197 | 197 | { |
198 | - $response = Response::make( $content, $status ); |
|
198 | + $response = Response::make($content, $status); |
|
199 | 199 | |
200 | - foreach( $header as $key => $value ) { |
|
201 | - $response->header( $key, $value ); |
|
200 | + foreach ($header as $key => $value) { |
|
201 | + $response->header($key, $value); |
|
202 | 202 | } |
203 | 203 | |
204 | 204 | return $response; |
@@ -213,23 +213,23 @@ discard block |
||
213 | 213 | * @param string $lang ISO language code, e.g. "en" or "en_GB" |
214 | 214 | * @return \Aimeos\MShop\Context\Item\Iface Modified context object |
215 | 215 | */ |
216 | - protected function setLocale( \Aimeos\MShop\Context\Item\Iface $context, $sitecode, $lang ) |
|
216 | + protected function setLocale(\Aimeos\MShop\Context\Item\Iface $context, $sitecode, $lang) |
|
217 | 217 | { |
218 | - $localeManager = \Aimeos\MShop\Factory::createManager( $context, 'locale' ); |
|
218 | + $localeManager = \Aimeos\MShop\Factory::createManager($context, 'locale'); |
|
219 | 219 | |
220 | 220 | try |
221 | 221 | { |
222 | - $localeItem = $localeManager->bootstrap( $sitecode, '', '', false ); |
|
223 | - $localeItem->setLanguageId( null ); |
|
224 | - $localeItem->setCurrencyId( null ); |
|
222 | + $localeItem = $localeManager->bootstrap($sitecode, '', '', false); |
|
223 | + $localeItem->setLanguageId(null); |
|
224 | + $localeItem->setCurrencyId(null); |
|
225 | 225 | } |
226 | - catch( \Aimeos\MShop\Locale\Exception $e ) |
|
226 | + catch (\Aimeos\MShop\Locale\Exception $e) |
|
227 | 227 | { |
228 | 228 | $localeItem = $localeManager->createItem(); |
229 | 229 | } |
230 | 230 | |
231 | - $context->setLocale( $localeItem ); |
|
232 | - $context->setI18n( app('\Aimeos\Shop\Base\I18n')->get( array( $lang ) ) ); |
|
231 | + $context->setLocale($localeItem); |
|
232 | + $context->setI18n(app('\Aimeos\Shop\Base\I18n')->get(array($lang))); |
|
233 | 233 | |
234 | 234 | return $context; |
235 | 235 | } |
@@ -43,21 +43,21 @@ discard block |
||
43 | 43 | */ |
44 | 44 | public function fire() |
45 | 45 | { |
46 | - $aimeos = $this->getLaravel()->make( '\Aimeos\Shop\Base\Aimeos' )->get(); |
|
46 | + $aimeos = $this->getLaravel()->make('\Aimeos\Shop\Base\Aimeos')->get(); |
|
47 | 47 | $context = $this->getContext(); |
48 | 48 | |
49 | - $jobs = explode( ' ', $this->argument( 'jobs' ) ); |
|
50 | - $localeManager = \Aimeos\MShop\Locale\Manager\Factory::createManager( $context ); |
|
49 | + $jobs = explode(' ', $this->argument('jobs')); |
|
50 | + $localeManager = \Aimeos\MShop\Locale\Manager\Factory::createManager($context); |
|
51 | 51 | |
52 | - foreach( $this->getSiteItems( $context, $this->argument( 'site' ) ) as $siteItem ) |
|
52 | + foreach ($this->getSiteItems($context, $this->argument('site')) as $siteItem) |
|
53 | 53 | { |
54 | - $localeItem = $localeManager->bootstrap( $siteItem->getCode(), 'en', '', false ); |
|
55 | - $context->setLocale( $localeItem ); |
|
54 | + $localeItem = $localeManager->bootstrap($siteItem->getCode(), 'en', '', false); |
|
55 | + $context->setLocale($localeItem); |
|
56 | 56 | |
57 | - $this->info( sprintf( 'Executing the Aimeos jobs for "%s"', $siteItem->getCode() ) ); |
|
57 | + $this->info(sprintf('Executing the Aimeos jobs for "%s"', $siteItem->getCode())); |
|
58 | 58 | |
59 | - foreach( $jobs as $jobname ) { |
|
60 | - \Aimeos\Controller\Jobs\Factory::createController( $context, $aimeos, $jobname )->run(); |
|
59 | + foreach ($jobs as $jobname) { |
|
60 | + \Aimeos\Controller\Jobs\Factory::createController($context, $aimeos, $jobname)->run(); |
|
61 | 61 | } |
62 | 62 | } |
63 | 63 | } |
@@ -71,8 +71,8 @@ discard block |
||
71 | 71 | protected function getArguments() |
72 | 72 | { |
73 | 73 | return array( |
74 | - array( 'jobs', InputArgument::REQUIRED, 'One or more job controller names like "admin/job customer/email/watch"' ), |
|
75 | - array( 'site', InputArgument::OPTIONAL, 'Site codes to execute the jobs for like "default unittest" (none for all)' ), |
|
74 | + array('jobs', InputArgument::REQUIRED, 'One or more job controller names like "admin/job customer/email/watch"'), |
|
75 | + array('site', InputArgument::OPTIONAL, 'Site codes to execute the jobs for like "default unittest" (none for all)'), |
|
76 | 76 | ); |
77 | 77 | } |
78 | 78 | |
@@ -95,20 +95,20 @@ discard block |
||
95 | 95 | protected function getContext() |
96 | 96 | { |
97 | 97 | $lv = $this->getLaravel(); |
98 | - $aimeos = $lv->make( '\Aimeos\Shop\Base\Aimeos' )->get(); |
|
99 | - $context = $lv->make( '\Aimeos\Shop\Base\Context' )->get( false ); |
|
98 | + $aimeos = $lv->make('\Aimeos\Shop\Base\Aimeos')->get(); |
|
99 | + $context = $lv->make('\Aimeos\Shop\Base\Context')->get(false); |
|
100 | 100 | |
101 | - $tmplPaths = $aimeos->getCustomPaths( 'controller/jobs/templates' ); |
|
102 | - $tmplPaths = array_merge( $tmplPaths, $aimeos->getCustomPaths( 'client/html/templates' ) ); |
|
103 | - $view = $lv->make( '\Aimeos\Shop\Base\View' )->create( $context->getConfig(), $tmplPaths ); |
|
101 | + $tmplPaths = $aimeos->getCustomPaths('controller/jobs/templates'); |
|
102 | + $tmplPaths = array_merge($tmplPaths, $aimeos->getCustomPaths('client/html/templates')); |
|
103 | + $view = $lv->make('\Aimeos\Shop\Base\View')->create($context->getConfig(), $tmplPaths); |
|
104 | 104 | |
105 | - $langManager = \Aimeos\MShop\Locale\Manager\Factory::createManager( $context )->getSubManager( 'language' ); |
|
106 | - $langids = array_keys( $langManager->searchItems( $langManager->createSearch( true ) ) ); |
|
107 | - $i18n = $lv->make( '\Aimeos\Shop\Base\I18n' )->get( $langids ); |
|
105 | + $langManager = \Aimeos\MShop\Locale\Manager\Factory::createManager($context)->getSubManager('language'); |
|
106 | + $langids = array_keys($langManager->searchItems($langManager->createSearch(true))); |
|
107 | + $i18n = $lv->make('\Aimeos\Shop\Base\I18n')->get($langids); |
|
108 | 108 | |
109 | - $context->setEditor( 'aimeos:jobs' ); |
|
110 | - $context->setView( $view ); |
|
111 | - $context->setI18n( $i18n ); |
|
109 | + $context->setEditor('aimeos:jobs'); |
|
110 | + $context->setView($view); |
|
111 | + $context->setI18n($i18n); |
|
112 | 112 | |
113 | 113 | return $context; |
114 | 114 | } |
@@ -34,12 +34,12 @@ discard block |
||
34 | 34 | */ |
35 | 35 | public function copyAction() |
36 | 36 | { |
37 | - if( config( 'shop.authorize', true ) ) { |
|
38 | - $this->authorize( 'admin' ); |
|
37 | + if (config('shop.authorize', true)) { |
|
38 | + $this->authorize('admin'); |
|
39 | 39 | } |
40 | 40 | |
41 | 41 | $cntl = $this->createClient(); |
42 | - return $this->getHtml( $cntl->copy() ); |
|
42 | + return $this->getHtml($cntl->copy()); |
|
43 | 43 | } |
44 | 44 | |
45 | 45 | |
@@ -50,12 +50,12 @@ discard block |
||
50 | 50 | */ |
51 | 51 | public function createAction() |
52 | 52 | { |
53 | - if( config( 'shop.authorize', true ) ) { |
|
54 | - $this->authorize( 'admin' ); |
|
53 | + if (config('shop.authorize', true)) { |
|
54 | + $this->authorize('admin'); |
|
55 | 55 | } |
56 | 56 | |
57 | 57 | $cntl = $this->createClient(); |
58 | - return $this->getHtml( $cntl->create() ); |
|
58 | + return $this->getHtml($cntl->create()); |
|
59 | 59 | } |
60 | 60 | |
61 | 61 | |
@@ -66,12 +66,12 @@ discard block |
||
66 | 66 | */ |
67 | 67 | public function deleteAction() |
68 | 68 | { |
69 | - if( config( 'shop.authorize', true ) ) { |
|
70 | - $this->authorize( 'admin' ); |
|
69 | + if (config('shop.authorize', true)) { |
|
70 | + $this->authorize('admin'); |
|
71 | 71 | } |
72 | 72 | |
73 | 73 | $cntl = $this->createClient(); |
74 | - return $this->getHtml( $cntl->delete() . $cntl->search() ); |
|
74 | + return $this->getHtml($cntl->delete() . $cntl->search()); |
|
75 | 75 | } |
76 | 76 | |
77 | 77 | |
@@ -82,12 +82,12 @@ discard block |
||
82 | 82 | */ |
83 | 83 | public function getAction() |
84 | 84 | { |
85 | - if( config( 'shop.authorize', true ) ) { |
|
86 | - $this->authorize( 'admin' ); |
|
85 | + if (config('shop.authorize', true)) { |
|
86 | + $this->authorize('admin'); |
|
87 | 87 | } |
88 | 88 | |
89 | 89 | $cntl = $this->createClient(); |
90 | - return $this->getHtml( $cntl->get() ); |
|
90 | + return $this->getHtml($cntl->get()); |
|
91 | 91 | } |
92 | 92 | |
93 | 93 | |
@@ -98,12 +98,12 @@ discard block |
||
98 | 98 | */ |
99 | 99 | public function saveAction() |
100 | 100 | { |
101 | - if( config( 'shop.authorize', true ) ) { |
|
102 | - $this->authorize( 'admin' ); |
|
101 | + if (config('shop.authorize', true)) { |
|
102 | + $this->authorize('admin'); |
|
103 | 103 | } |
104 | 104 | |
105 | 105 | $cntl = $this->createClient(); |
106 | - return $this->getHtml( ( $cntl->save() ? : $cntl->search() ) ); |
|
106 | + return $this->getHtml(($cntl->save() ?: $cntl->search())); |
|
107 | 107 | } |
108 | 108 | |
109 | 109 | |
@@ -114,12 +114,12 @@ discard block |
||
114 | 114 | */ |
115 | 115 | public function searchAction() |
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 | $cntl = $this->createClient(); |
122 | - return $this->getHtml( $cntl->search() ); |
|
122 | + return $this->getHtml($cntl->search()); |
|
123 | 123 | } |
124 | 124 | |
125 | 125 | |
@@ -130,20 +130,20 @@ discard block |
||
130 | 130 | */ |
131 | 131 | protected function createClient() |
132 | 132 | { |
133 | - $site = Route::input( 'site', Input::get( 'site', 'default' ) ); |
|
134 | - $lang = Input::get( 'lang', config( 'app.locale', 'en' ) ); |
|
135 | - $resource = Route::input( 'resource' ); |
|
133 | + $site = Route::input('site', Input::get('site', 'default')); |
|
134 | + $lang = Input::get('lang', config('app.locale', 'en')); |
|
135 | + $resource = Route::input('resource'); |
|
136 | 136 | |
137 | - $aimeos = app( '\Aimeos\Shop\Base\Aimeos' )->get(); |
|
138 | - $templatePaths = $aimeos->getCustomPaths( 'admin/jqadm/templates' ); |
|
137 | + $aimeos = app('\Aimeos\Shop\Base\Aimeos')->get(); |
|
138 | + $templatePaths = $aimeos->getCustomPaths('admin/jqadm/templates'); |
|
139 | 139 | |
140 | - $context = app( '\Aimeos\Shop\Base\Context' )->get( false ); |
|
141 | - $context = $this->setLocale( $context, $site, $lang ); |
|
140 | + $context = app('\Aimeos\Shop\Base\Context')->get(false); |
|
141 | + $context = $this->setLocale($context, $site, $lang); |
|
142 | 142 | |
143 | - $view = app( '\Aimeos\Shop\Base\View' )->create( $context->getConfig(), $templatePaths, $lang ); |
|
144 | - $context->setView( $view ); |
|
143 | + $view = app('\Aimeos\Shop\Base\View')->create($context->getConfig(), $templatePaths, $lang); |
|
144 | + $context->setView($view); |
|
145 | 145 | |
146 | - return \Aimeos\Admin\JQAdm\Factory::createClient( $context, $templatePaths, $resource ); |
|
146 | + return \Aimeos\Admin\JQAdm\Factory::createClient($context, $templatePaths, $resource); |
|
147 | 147 | } |
148 | 148 | |
149 | 149 | |
@@ -153,12 +153,12 @@ discard block |
||
153 | 153 | * @param string $content Content from admin client |
154 | 154 | * @return \Illuminate\Contracts\View\View View for rendering the output |
155 | 155 | */ |
156 | - protected function getHtml( $content ) |
|
156 | + protected function getHtml($content) |
|
157 | 157 | { |
158 | - $version = app( '\Aimeos\Shop\Base\Aimeos' )->getVersion(); |
|
159 | - $content = str_replace( ['{type}', '{version}'], ['Laravel', $version], $content ); |
|
158 | + $version = app('\Aimeos\Shop\Base\Aimeos')->getVersion(); |
|
159 | + $content = str_replace(['{type}', '{version}'], ['Laravel', $version], $content); |
|
160 | 160 | |
161 | - return View::make( 'shop::jqadm.index', array( 'content' => $content ) ); |
|
161 | + return View::make('shop::jqadm.index', array('content' => $content)); |
|
162 | 162 | } |
163 | 163 | |
164 | 164 | |
@@ -170,23 +170,23 @@ discard block |
||
170 | 170 | * @param string $lang ISO language code, e.g. "en" or "en_GB" |
171 | 171 | * @return \Aimeos\MShop\Context\Item\Iface Modified context object |
172 | 172 | */ |
173 | - protected function setLocale( \Aimeos\MShop\Context\Item\Iface $context, $site, $lang ) |
|
173 | + protected function setLocale(\Aimeos\MShop\Context\Item\Iface $context, $site, $lang) |
|
174 | 174 | { |
175 | - $localeManager = \Aimeos\MShop\Factory::createManager( $context, 'locale' ); |
|
175 | + $localeManager = \Aimeos\MShop\Factory::createManager($context, 'locale'); |
|
176 | 176 | |
177 | 177 | try |
178 | 178 | { |
179 | - $localeItem = $localeManager->bootstrap( $site, '', '', false ); |
|
180 | - $localeItem->setLanguageId( null ); |
|
181 | - $localeItem->setCurrencyId( null ); |
|
179 | + $localeItem = $localeManager->bootstrap($site, '', '', false); |
|
180 | + $localeItem->setLanguageId(null); |
|
181 | + $localeItem->setCurrencyId(null); |
|
182 | 182 | } |
183 | - catch( \Aimeos\MShop\Locale\Exception $e ) |
|
183 | + catch (\Aimeos\MShop\Locale\Exception $e) |
|
184 | 184 | { |
185 | 185 | $localeItem = $localeManager->createItem(); |
186 | 186 | } |
187 | 187 | |
188 | - $context->setLocale( $localeItem ); |
|
189 | - $context->setI18n( app('\Aimeos\Shop\Base\I18n')->get( array( $lang, 'en' ) ) ); |
|
188 | + $context->setLocale($localeItem); |
|
189 | + $context->setI18n(app('\Aimeos\Shop\Base\I18n')->get(array($lang, 'en'))); |
|
190 | 190 | |
191 | 191 | return $context; |
192 | 192 | } |