@@ -135,7 +135,7 @@ |
||
| 135 | 135 | * Creates a list of all available translations. |
| 136 | 136 | * |
| 137 | 137 | * @param \Aimeos\MShop\Context\Item\Iface $context Context object |
| 138 | - * @return array List of language IDs with labels |
|
| 138 | + * @return string List of language IDs with labels |
|
| 139 | 139 | */ |
| 140 | 140 | protected function getJsonLanguages( \Aimeos\MShop\Context\Item\Iface $context ) |
| 141 | 141 | { |
@@ -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 | } |
@@ -27,7 +27,6 @@ discard block |
||
| 27 | 27 | * |
| 28 | 28 | * @param \Illuminate\Http\Request $request Request object |
| 29 | 29 | * @param string Resource location, e.g. "product/stock/wareshouse" |
| 30 | - * @param string $sitecode Unique site code |
|
| 31 | 30 | * @param integer|null $id Unique resource ID |
| 32 | 31 | * @return \Illuminate\Http\Response Response object containing the generated output |
| 33 | 32 | */ |
@@ -48,7 +47,6 @@ discard block |
||
| 48 | 47 | * |
| 49 | 48 | * @param \Illuminate\Http\Request $request Request object |
| 50 | 49 | * @param string Resource location, e.g. "product/stock/wareshouse" |
| 51 | - * @param string $sitecode Unique site code |
|
| 52 | 50 | * @param integer|null $id Unique resource ID |
| 53 | 51 | * @return \Illuminate\Http\Response Response object containing the generated output |
| 54 | 52 | */ |
@@ -69,7 +67,6 @@ discard block |
||
| 69 | 67 | * |
| 70 | 68 | * @param \Illuminate\Http\Request $request Request object |
| 71 | 69 | * @param string Resource location, e.g. "product/stock/wareshouse" |
| 72 | - * @param string $sitecode Unique site code |
|
| 73 | 70 | * @param integer|null $id Unique resource ID |
| 74 | 71 | * @return \Illuminate\Http\Response Response object containing the generated output |
| 75 | 72 | */ |
@@ -90,7 +87,6 @@ discard block |
||
| 90 | 87 | * |
| 91 | 88 | * @param \Illuminate\Http\Request $request Request object |
| 92 | 89 | * @param string Resource location, e.g. "product/stock/wareshouse" |
| 93 | - * @param string $sitecode Unique site code |
|
| 94 | 90 | * @param integer $id Unique ID of the resource |
| 95 | 91 | * @return \Illuminate\Http\Response Response object containing the generated output |
| 96 | 92 | */ |
@@ -111,7 +107,6 @@ discard block |
||
| 111 | 107 | * |
| 112 | 108 | * @param \Illuminate\Http\Request $request Request object |
| 113 | 109 | * @param string Resource location, e.g. "product/stock/wareshouse" |
| 114 | - * @param string $sitecode Unique site code |
|
| 115 | 110 | * @param integer|null $id Unique resource ID |
| 116 | 111 | * @return \Illuminate\Http\Response Response object containing the generated output |
| 117 | 112 | */ |
@@ -132,7 +127,6 @@ discard block |
||
| 132 | 127 | * |
| 133 | 128 | * @param \Illuminate\Http\Request $request Request object |
| 134 | 129 | * @param string Resource location, e.g. "product/stock/wareshouse" |
| 135 | - * @param string $sitecode Unique site code |
|
| 136 | 130 | * @return \Illuminate\Http\Response Response object containing the generated output |
| 137 | 131 | */ |
| 138 | 132 | public function optionsAction( Request $request, $site = 'default', $resource = '' ) |
@@ -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 | } |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | * |
| 35 | 35 | * @param \Illuminate\Contracts\Config\Repository $config Configuration object |
| 36 | 36 | */ |
| 37 | - public function __construct( \Illuminate\Contracts\Config\Repository $config ) |
|
| 37 | + public function __construct(\Illuminate\Contracts\Config\Repository $config) |
|
| 38 | 38 | { |
| 39 | 39 | $this->config = $config; |
| 40 | 40 | } |
@@ -47,10 +47,10 @@ discard block |
||
| 47 | 47 | */ |
| 48 | 48 | public function get() |
| 49 | 49 | { |
| 50 | - if( $this->object === null ) |
|
| 50 | + if ($this->object === null) |
|
| 51 | 51 | { |
| 52 | - $extDirs = (array) $this->config->get( 'shop.extdir', array() ); |
|
| 53 | - $this->object = new \Aimeos\Bootstrap( $extDirs, false ); |
|
| 52 | + $extDirs = (array) $this->config->get('shop.extdir', array()); |
|
| 53 | + $this->object = new \Aimeos\Bootstrap($extDirs, false); |
|
| 54 | 54 | } |
| 55 | 55 | |
| 56 | 56 | return $this->object; |
@@ -40,7 +40,7 @@ discard block |
||
| 40 | 40 | * @param \Aimeos\Shop\Base\Aimeos $aimeos Aimeos object |
| 41 | 41 | * @param \Illuminate\Contracts\Config\Repository $config Configuration object |
| 42 | 42 | */ |
| 43 | - public function __construct( \Aimeos\Shop\Base\Aimeos $aimeos, \Illuminate\Contracts\Config\Repository $config ) |
|
| 43 | + public function __construct(\Aimeos\Shop\Base\Aimeos $aimeos, \Illuminate\Contracts\Config\Repository $config) |
|
| 44 | 44 | { |
| 45 | 45 | $this->aimeos = $aimeos; |
| 46 | 46 | $this->config = $config; |
@@ -53,22 +53,22 @@ discard block |
||
| 53 | 53 | * @param array $languageIds List of two letter ISO language IDs |
| 54 | 54 | * @return \Aimeos\MW\Translation\Iface[] List of translation objects |
| 55 | 55 | */ |
| 56 | - public function get( array $languageIds ) |
|
| 56 | + public function get(array $languageIds) |
|
| 57 | 57 | { |
| 58 | 58 | $i18nPaths = $this->aimeos->get()->getI18nPaths(); |
| 59 | 59 | |
| 60 | - foreach( $languageIds as $langid ) |
|
| 60 | + foreach ($languageIds as $langid) |
|
| 61 | 61 | { |
| 62 | - if( !isset( $this->i18n[$langid] ) ) |
|
| 62 | + if (!isset($this->i18n[$langid])) |
|
| 63 | 63 | { |
| 64 | - $i18n = new \Aimeos\MW\Translation\Zend2( $i18nPaths, 'gettext', $langid, array( 'disableNotices' => true ) ); |
|
| 64 | + $i18n = new \Aimeos\MW\Translation\Zend2($i18nPaths, 'gettext', $langid, array('disableNotices' => true)); |
|
| 65 | 65 | |
| 66 | - if( function_exists( 'apc_store' ) === true && $this->config->get( 'shop.apc_enabled', false ) == true ) { |
|
| 67 | - $i18n = new \Aimeos\MW\Translation\Decorator\APC( $i18n, $this->config->get( 'shop.apc_prefix', 'laravel:' ) ); |
|
| 66 | + if (function_exists('apc_store') === true && $this->config->get('shop.apc_enabled', false) == true) { |
|
| 67 | + $i18n = new \Aimeos\MW\Translation\Decorator\APC($i18n, $this->config->get('shop.apc_prefix', 'laravel:')); |
|
| 68 | 68 | } |
| 69 | 69 | |
| 70 | - if( $this->config->has( 'shop.i18n.' . $langid ) ) { |
|
| 71 | - $i18n = new \Aimeos\MW\Translation\Decorator\Memory( $i18n, $this->config->get( 'shop.i18n.' . $langid ) ); |
|
| 70 | + if ($this->config->has('shop.i18n.' . $langid)) { |
|
| 71 | + $i18n = new \Aimeos\MW\Translation\Decorator\Memory($i18n, $this->config->get('shop.i18n.' . $langid)); |
|
| 72 | 72 | } |
| 73 | 73 | |
| 74 | 74 | $this->i18n[$langid] = $i18n; |
@@ -47,8 +47,8 @@ discard block |
||
| 47 | 47 | * @param \Aimeos\Shop\Base\Context $context Context object |
| 48 | 48 | * @param \Aimeos\Shop\Base\View $view View object |
| 49 | 49 | */ |
| 50 | - public function __construct( \Illuminate\Contracts\Config\Repository $config, |
|
| 51 | - \Aimeos\Shop\Base\Aimeos $aimeos, \Aimeos\Shop\Base\Context $context, \Aimeos\Shop\Base\View $view ) |
|
| 50 | + public function __construct(\Illuminate\Contracts\Config\Repository $config, |
|
| 51 | + \Aimeos\Shop\Base\Aimeos $aimeos, \Aimeos\Shop\Base\Context $context, \Aimeos\Shop\Base\View $view) |
|
| 52 | 52 | { |
| 53 | 53 | $this->config = $config; |
| 54 | 54 | $this->aimeos = $aimeos; |
@@ -63,23 +63,23 @@ discard block |
||
| 63 | 63 | * @param string $pageName Name of the configured page |
| 64 | 64 | * @return array Associative list with body and header output separated by client name |
| 65 | 65 | */ |
| 66 | - public function getSections( $pageName ) |
|
| 66 | + public function getSections($pageName) |
|
| 67 | 67 | { |
| 68 | 68 | $context = $this->context->get(); |
| 69 | 69 | $langid = $context->getLocale()->getLanguageId(); |
| 70 | - $tmplPaths = $this->aimeos->get()->getCustomPaths( 'client/html' ); |
|
| 71 | - $view = $this->view->create( $context->getConfig(), $tmplPaths, $langid ); |
|
| 72 | - $context->setView( $view ); |
|
| 70 | + $tmplPaths = $this->aimeos->get()->getCustomPaths('client/html'); |
|
| 71 | + $view = $this->view->create($context->getConfig(), $tmplPaths, $langid); |
|
| 72 | + $context->setView($view); |
|
| 73 | 73 | |
| 74 | - $pagesConfig = $this->config->get( 'shop.page', array() ); |
|
| 75 | - $result = array( 'aibody' => array(), 'aiheader' => array() ); |
|
| 74 | + $pagesConfig = $this->config->get('shop.page', array()); |
|
| 75 | + $result = array('aibody' => array(), 'aiheader' => array()); |
|
| 76 | 76 | |
| 77 | - if( isset( $pagesConfig[$pageName] ) ) |
|
| 77 | + if (isset($pagesConfig[$pageName])) |
|
| 78 | 78 | { |
| 79 | - foreach( (array) $pagesConfig[$pageName] as $clientName ) |
|
| 79 | + foreach ((array) $pagesConfig[$pageName] as $clientName) |
|
| 80 | 80 | { |
| 81 | - $client = \Aimeos\Client\Html\Factory::createClient( $context, $tmplPaths, $clientName ); |
|
| 82 | - $client->setView( clone $view ); |
|
| 81 | + $client = \Aimeos\Client\Html\Factory::createClient($context, $tmplPaths, $clientName); |
|
| 82 | + $client->setView(clone $view); |
|
| 83 | 83 | $client->process(); |
| 84 | 84 | |
| 85 | 85 | $result['aibody'][$clientName] = $client->getBody(); |
@@ -26,59 +26,59 @@ discard block |
||
| 26 | 26 | * @param string|null $locale Code of the current language or null for no translation |
| 27 | 27 | * @return \Aimeos\MW\View\Iface View object |
| 28 | 28 | */ |
| 29 | - public function create( \Aimeos\MW\Config\Iface $config, array $templatePaths, $locale = null ) |
|
| 29 | + public function create(\Aimeos\MW\Config\Iface $config, array $templatePaths, $locale = null) |
|
| 30 | 30 | { |
| 31 | 31 | $params = $fixed = array(); |
| 32 | 32 | |
| 33 | - if( $locale !== null ) |
|
| 33 | + if ($locale !== null) |
|
| 34 | 34 | { |
| 35 | 35 | $params = \Route::current()->parameters() + \Input::all(); |
| 36 | 36 | $params['target'] = \Route::currentRouteName(); |
| 37 | 37 | |
| 38 | 38 | $fixed = $this->getFixedParams(); |
| 39 | 39 | |
| 40 | - $i18n = app('\Aimeos\Shop\Base\I18n')->get( array( $locale ) ); |
|
| 40 | + $i18n = app('\Aimeos\Shop\Base\I18n')->get(array($locale)); |
|
| 41 | 41 | $translation = $i18n[$locale]; |
| 42 | 42 | } |
| 43 | 43 | else |
| 44 | 44 | { |
| 45 | - $translation = new \Aimeos\MW\Translation\None( 'en' ); |
|
| 45 | + $translation = new \Aimeos\MW\Translation\None('en'); |
|
| 46 | 46 | } |
| 47 | 47 | |
| 48 | 48 | |
| 49 | 49 | $view = new \Aimeos\MW\View\Standard(); |
| 50 | 50 | |
| 51 | - $helper = new \Aimeos\MW\View\Helper\Translate\Standard( $view, $translation ); |
|
| 52 | - $view->addHelper( 'translate', $helper ); |
|
| 51 | + $helper = new \Aimeos\MW\View\Helper\Translate\Standard($view, $translation); |
|
| 52 | + $view->addHelper('translate', $helper); |
|
| 53 | 53 | |
| 54 | - $helper = new \Aimeos\MW\View\Helper\Url\Laravel5( $view, app('url'), $fixed ); |
|
| 55 | - $view->addHelper( 'url', $helper ); |
|
| 54 | + $helper = new \Aimeos\MW\View\Helper\Url\Laravel5($view, app('url'), $fixed); |
|
| 55 | + $view->addHelper('url', $helper); |
|
| 56 | 56 | |
| 57 | - $helper = new \Aimeos\MW\View\Helper\Partial\Standard( $view, $config, $templatePaths ); |
|
| 58 | - $view->addHelper( 'partial', $helper ); |
|
| 57 | + $helper = new \Aimeos\MW\View\Helper\Partial\Standard($view, $config, $templatePaths); |
|
| 58 | + $view->addHelper('partial', $helper); |
|
| 59 | 59 | |
| 60 | - $helper = new \Aimeos\MW\View\Helper\Parameter\Standard( $view, $params ); |
|
| 61 | - $view->addHelper( 'param', $helper ); |
|
| 60 | + $helper = new \Aimeos\MW\View\Helper\Parameter\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\FormParam\Standard( $view, array() ); |
|
| 72 | - $view->addHelper( 'formparam', $helper ); |
|
| 71 | + $helper = new \Aimeos\MW\View\Helper\FormParam\Standard($view, array()); |
|
| 72 | + $view->addHelper('formparam', $helper); |
|
| 73 | 73 | |
| 74 | - $helper = new \Aimeos\MW\View\Helper\Encoder\Standard( $view ); |
|
| 75 | - $view->addHelper( 'encoder', $helper ); |
|
| 74 | + $helper = new \Aimeos\MW\View\Helper\Encoder\Standard($view); |
|
| 75 | + $view->addHelper('encoder', $helper); |
|
| 76 | 76 | |
| 77 | - $helper = new \Aimeos\MW\View\Helper\Request\Laravel5( $view, \Request::instance() ); |
|
| 78 | - $view->addHelper( 'request', $helper ); |
|
| 77 | + $helper = new \Aimeos\MW\View\Helper\Request\Laravel5($view, \Request::instance()); |
|
| 78 | + $view->addHelper('request', $helper); |
|
| 79 | 79 | |
| 80 | - $helper = new \Aimeos\MW\View\Helper\Csrf\Standard( $view, '_token', csrf_token() ); |
|
| 81 | - $view->addHelper( 'csrf', $helper ); |
|
| 80 | + $helper = new \Aimeos\MW\View\Helper\Csrf\Standard($view, '_token', csrf_token()); |
|
| 81 | + $view->addHelper('csrf', $helper); |
|
| 82 | 82 | |
| 83 | 83 | return $view; |
| 84 | 84 | } |
@@ -93,15 +93,15 @@ discard block |
||
| 93 | 93 | { |
| 94 | 94 | $fixed = array(); |
| 95 | 95 | |
| 96 | - if( ( $value = \Route::input( 'site' ) ) !== null ) { |
|
| 96 | + if (($value = \Route::input('site')) !== null) { |
|
| 97 | 97 | $fixed['site'] = $value; |
| 98 | 98 | } |
| 99 | 99 | |
| 100 | - if( ( $value = \Route::input( 'locale' ) ) !== null ) { |
|
| 100 | + if (($value = \Route::input('locale')) !== null) { |
|
| 101 | 101 | $fixed['locale'] = $value; |
| 102 | 102 | } |
| 103 | 103 | |
| 104 | - if( ( $value = \Route::input( 'currency' ) ) !== null ) { |
|
| 104 | + if (($value = \Route::input('currency')) !== null) { |
|
| 105 | 105 | $fixed['currency'] = $value; |
| 106 | 106 | } |
| 107 | 107 | |
@@ -22,19 +22,19 @@ |
||
| 22 | 22 | * @param string|array $sites Unique site codes |
| 23 | 23 | * @return \Aimeos\MShop\Locale\Item\Site\Iface[] List of site items |
| 24 | 24 | */ |
| 25 | - protected function getSiteItems( \Aimeos\MShop\Context\Item\Iface $context, $sites ) |
|
| 25 | + protected function getSiteItems(\Aimeos\MShop\Context\Item\Iface $context, $sites) |
|
| 26 | 26 | { |
| 27 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'locale/site' ); |
|
| 27 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'locale/site'); |
|
| 28 | 28 | $search = $manager->createSearch(); |
| 29 | 29 | |
| 30 | - if( is_scalar( $sites ) && $sites != '' ) { |
|
| 31 | - $sites = explode( ' ', $sites ); |
|
| 30 | + if (is_scalar($sites) && $sites != '') { |
|
| 31 | + $sites = explode(' ', $sites); |
|
| 32 | 32 | } |
| 33 | 33 | |
| 34 | - if( !empty( $sites ) ) { |
|
| 35 | - $search->setConditions( $search->compare( '==', 'locale.site.code', $sites ) ); |
|
| 34 | + if (!empty($sites)) { |
|
| 35 | + $search->setConditions($search->compare('==', 'locale.site.code', $sites)); |
|
| 36 | 36 | } |
| 37 | 37 | |
| 38 | - return $manager->searchItems( $search ); |
|
| 38 | + return $manager->searchItems($search); |
|
| 39 | 39 | } |
| 40 | 40 | } |
| 41 | 41 | \ No newline at end of file |
@@ -35,24 +35,24 @@ discard block |
||
| 35 | 35 | */ |
| 36 | 36 | public function fire() |
| 37 | 37 | { |
| 38 | - $context = $this->getLaravel()->make( 'Aimeos\Shop\Base\Context' )->get( false ); |
|
| 39 | - $context->setEditor( 'aimeos:cache' ); |
|
| 38 | + $context = $this->getLaravel()->make('Aimeos\Shop\Base\Context')->get(false); |
|
| 39 | + $context->setEditor('aimeos:cache'); |
|
| 40 | 40 | |
| 41 | - $localeManager = \Aimeos\MShop\Locale\Manager\Factory::createManager( $context ); |
|
| 41 | + $localeManager = \Aimeos\MShop\Locale\Manager\Factory::createManager($context); |
|
| 42 | 42 | |
| 43 | - foreach( $this->getSiteItems( $context, $this->argument( 'site' ) ) as $siteItem ) |
|
| 43 | + foreach ($this->getSiteItems($context, $this->argument('site')) as $siteItem) |
|
| 44 | 44 | { |
| 45 | - $localeItem = $localeManager->bootstrap( $siteItem->getCode(), '', '', false ); |
|
| 45 | + $localeItem = $localeManager->bootstrap($siteItem->getCode(), '', '', false); |
|
| 46 | 46 | |
| 47 | 47 | $lcontext = clone $context; |
| 48 | - $lcontext->setLocale( $localeItem ); |
|
| 48 | + $lcontext->setLocale($localeItem); |
|
| 49 | 49 | |
| 50 | - $cache = new \Aimeos\MAdmin\Cache\Proxy\Standard( $lcontext ); |
|
| 51 | - $lcontext->setCache( $cache ); |
|
| 50 | + $cache = new \Aimeos\MAdmin\Cache\Proxy\Standard($lcontext); |
|
| 51 | + $lcontext->setCache($cache); |
|
| 52 | 52 | |
| 53 | - $this->info( sprintf( 'Clearing the Aimeos cache for site "%1$s"', $siteItem->getCode() ) ); |
|
| 53 | + $this->info(sprintf('Clearing the Aimeos cache for site "%1$s"', $siteItem->getCode())); |
|
| 54 | 54 | |
| 55 | - \Aimeos\MAdmin\Cache\Manager\Factory::createManager( $lcontext )->getCache()->flush(); |
|
| 55 | + \Aimeos\MAdmin\Cache\Manager\Factory::createManager($lcontext)->getCache()->flush(); |
|
| 56 | 56 | } |
| 57 | 57 | } |
| 58 | 58 | |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | protected function getArguments() |
| 66 | 66 | { |
| 67 | 67 | return array( |
| 68 | - array( 'site', InputArgument::OPTIONAL, 'Site codes to clear the cache like "default unittest" (none for all)' ), |
|
| 68 | + array('site', InputArgument::OPTIONAL, 'Site codes to clear the cache like "default unittest" (none for all)'), |
|
| 69 | 69 | ); |
| 70 | 70 | } |
| 71 | 71 | |
@@ -36,21 +36,21 @@ discard block |
||
| 36 | 36 | */ |
| 37 | 37 | public function fire() |
| 38 | 38 | { |
| 39 | - $aimeos = $this->getLaravel()->make( '\Aimeos\Shop\Base\Aimeos' )->get(); |
|
| 39 | + $aimeos = $this->getLaravel()->make('\Aimeos\Shop\Base\Aimeos')->get(); |
|
| 40 | 40 | $context = $this->getContext(); |
| 41 | 41 | |
| 42 | - $jobs = explode( ' ', $this->argument( 'jobs' ) ); |
|
| 43 | - $localeManager = \Aimeos\MShop\Locale\Manager\Factory::createManager( $context ); |
|
| 42 | + $jobs = explode(' ', $this->argument('jobs')); |
|
| 43 | + $localeManager = \Aimeos\MShop\Locale\Manager\Factory::createManager($context); |
|
| 44 | 44 | |
| 45 | - foreach( $this->getSiteItems( $context, $this->argument( 'site' ) ) as $siteItem ) |
|
| 45 | + foreach ($this->getSiteItems($context, $this->argument('site')) as $siteItem) |
|
| 46 | 46 | { |
| 47 | - $localeItem = $localeManager->bootstrap( $siteItem->getCode(), 'en', '', false ); |
|
| 48 | - $context->setLocale( $localeItem ); |
|
| 47 | + $localeItem = $localeManager->bootstrap($siteItem->getCode(), 'en', '', false); |
|
| 48 | + $context->setLocale($localeItem); |
|
| 49 | 49 | |
| 50 | - $this->info( sprintf( 'Executing the Aimeos jobs for "%s"', $siteItem->getCode() ) ); |
|
| 50 | + $this->info(sprintf('Executing the Aimeos jobs for "%s"', $siteItem->getCode())); |
|
| 51 | 51 | |
| 52 | - foreach( $jobs as $jobname ) { |
|
| 53 | - \Aimeos\Controller\Jobs\Factory::createController( $context, $aimeos, $jobname )->run(); |
|
| 52 | + foreach ($jobs as $jobname) { |
|
| 53 | + \Aimeos\Controller\Jobs\Factory::createController($context, $aimeos, $jobname)->run(); |
|
| 54 | 54 | } |
| 55 | 55 | } |
| 56 | 56 | } |
@@ -64,8 +64,8 @@ discard block |
||
| 64 | 64 | protected function getArguments() |
| 65 | 65 | { |
| 66 | 66 | return array( |
| 67 | - array( 'jobs', InputArgument::REQUIRED, 'One or more job controller names like "admin/job customer/email/watch"' ), |
|
| 68 | - array( 'site', InputArgument::OPTIONAL, 'Site codes to execute the jobs for like "default unittest" (none for all)' ), |
|
| 67 | + array('jobs', InputArgument::REQUIRED, 'One or more job controller names like "admin/job customer/email/watch"'), |
|
| 68 | + array('site', InputArgument::OPTIONAL, 'Site codes to execute the jobs for like "default unittest" (none for all)'), |
|
| 69 | 69 | ); |
| 70 | 70 | } |
| 71 | 71 | |
@@ -89,17 +89,17 @@ discard block |
||
| 89 | 89 | { |
| 90 | 90 | $lv = $this->getLaravel(); |
| 91 | 91 | |
| 92 | - $context = $lv->make( '\Aimeos\Shop\Base\Context' )->get( false ); |
|
| 93 | - $tmplPaths = $lv->make( '\Aimeos\Shop\Base\Aimeos' )->get()->getCustomPaths( 'controller/jobs/layouts' ); |
|
| 94 | - $view = $lv->make( '\Aimeos\Shop\Base\View' )->create( $context->getConfig(), $tmplPaths ); |
|
| 92 | + $context = $lv->make('\Aimeos\Shop\Base\Context')->get(false); |
|
| 93 | + $tmplPaths = $lv->make('\Aimeos\Shop\Base\Aimeos')->get()->getCustomPaths('controller/jobs/layouts'); |
|
| 94 | + $view = $lv->make('\Aimeos\Shop\Base\View')->create($context->getConfig(), $tmplPaths); |
|
| 95 | 95 | |
| 96 | - $langManager = \Aimeos\MShop\Locale\Manager\Factory::createManager( $context )->getSubManager( 'language' ); |
|
| 97 | - $langids = array_keys( $langManager->searchItems( $langManager->createSearch( true ) ) ); |
|
| 98 | - $i18n = $lv->make( '\Aimeos\Shop\Base\I18n' )->get( $langids ); |
|
| 96 | + $langManager = \Aimeos\MShop\Locale\Manager\Factory::createManager($context)->getSubManager('language'); |
|
| 97 | + $langids = array_keys($langManager->searchItems($langManager->createSearch(true))); |
|
| 98 | + $i18n = $lv->make('\Aimeos\Shop\Base\I18n')->get($langids); |
|
| 99 | 99 | |
| 100 | - $context->setEditor( 'aimeos:jobs' ); |
|
| 101 | - $context->setView( $view ); |
|
| 102 | - $context->setI18n( $i18n ); |
|
| 100 | + $context->setEditor('aimeos:jobs'); |
|
| 101 | + $context->setView($view); |
|
| 102 | + $context->setI18n($i18n); |
|
| 103 | 103 | |
| 104 | 104 | return $context; |
| 105 | 105 | } |