@@ -30,9 +30,8 @@ discard block |
||
| 30 | 30 | * Returns the HTML code for a copy of a resource object |
| 31 | 31 | * |
| 32 | 32 | * @param string Resource location, e.g. "product" |
| 33 | - * @param string $sitecode Unique site code |
|
| 34 | 33 | * @param integer $id Unique resource ID |
| 35 | - * @return string Generated output |
|
| 34 | + * @return \Illuminate\Contracts\View\View Generated output |
|
| 36 | 35 | */ |
| 37 | 36 | public function copyAction( $site = 'default', $resource, $id ) |
| 38 | 37 | { |
@@ -49,8 +48,7 @@ discard block |
||
| 49 | 48 | * Returns the HTML code for a new resource object |
| 50 | 49 | * |
| 51 | 50 | * @param string Resource location, e.g. "product" |
| 52 | - * @param string $sitecode Unique site code |
|
| 53 | - * @return string Generated output |
|
| 51 | + * @return \Illuminate\Contracts\View\View Generated output |
|
| 54 | 52 | */ |
| 55 | 53 | public function createAction( $site = 'default', $resource ) |
| 56 | 54 | { |
@@ -67,9 +65,8 @@ discard block |
||
| 67 | 65 | * Deletes the resource object or a list of resource objects |
| 68 | 66 | * |
| 69 | 67 | * @param string Resource location, e.g. "product" |
| 70 | - * @param string $sitecode Unique site code |
|
| 71 | 68 | * @param integer $id Unique resource ID |
| 72 | - * @return string Generated output |
|
| 69 | + * @return \Illuminate\Contracts\View\View Generated output |
|
| 73 | 70 | */ |
| 74 | 71 | public function deleteAction( $site = 'default', $resource, $id ) |
| 75 | 72 | { |
@@ -86,9 +83,8 @@ discard block |
||
| 86 | 83 | * Returns the HTML code for the requested resource object |
| 87 | 84 | * |
| 88 | 85 | * @param string Resource location, e.g. "product" |
| 89 | - * @param string $sitecode Unique site code |
|
| 90 | 86 | * @param integer $id Unique resource ID |
| 91 | - * @return string Generated output |
|
| 87 | + * @return \Illuminate\Contracts\View\View Generated output |
|
| 92 | 88 | */ |
| 93 | 89 | public function getAction( $site = 'default', $resource, $id ) |
| 94 | 90 | { |
@@ -105,8 +101,7 @@ discard block |
||
| 105 | 101 | * Saves a new resource object |
| 106 | 102 | * |
| 107 | 103 | * @param string Resource location, e.g. "product" |
| 108 | - * @param string $sitecode Unique site code |
|
| 109 | - * @return string Generated output |
|
| 104 | + * @return \Illuminate\Contracts\View\View Generated output |
|
| 110 | 105 | */ |
| 111 | 106 | public function saveAction( $site = 'default', $resource ) |
| 112 | 107 | { |
@@ -123,8 +118,7 @@ discard block |
||
| 123 | 118 | * Returns the HTML code for a list of resource objects |
| 124 | 119 | * |
| 125 | 120 | * @param string Resource location, e.g. "product" |
| 126 | - * @param string $sitecode Unique site code |
|
| 127 | - * @return string Generated output |
|
| 121 | + * @return \Illuminate\Contracts\View\View Generated output |
|
| 128 | 122 | */ |
| 129 | 123 | public function searchAction( $site = 'default', $resource ) |
| 130 | 124 | { |
@@ -141,7 +135,7 @@ discard block |
||
| 141 | 135 | * Returns the resource controller |
| 142 | 136 | * |
| 143 | 137 | * @param string $sitecode Unique site code |
| 144 | - * @return \Aimeos\MShop\Context\Item\Iface Context item |
|
| 138 | + * @return \Aimeos\Admin\JQAdm\Iface Context item |
|
| 145 | 139 | */ |
| 146 | 140 | protected function createClient( $sitecode, $resource ) |
| 147 | 141 | { |
@@ -36,19 +36,19 @@ discard block |
||
| 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 | |
@@ -59,12 +59,12 @@ discard block |
||
| 59 | 59 | */ |
| 60 | 60 | protected function getVersion() |
| 61 | 61 | { |
| 62 | - if( ( $content = @file_get_contents( base_path( 'composer.lock' ) ) ) !== false |
|
| 63 | - && ( $content = json_decode( $content, true ) ) !== null && isset( $content['packages'] ) |
|
| 62 | + if (($content = @file_get_contents(base_path('composer.lock'))) !== false |
|
| 63 | + && ($content = json_decode($content, true)) !== null && isset($content['packages']) |
|
| 64 | 64 | ) { |
| 65 | - foreach( (array) $content['packages'] as $item ) |
|
| 65 | + foreach ((array) $content['packages'] as $item) |
|
| 66 | 66 | { |
| 67 | - if( $item['name'] === 'aimeos/aimeos-laravel' ) { |
|
| 67 | + if ($item['name'] === 'aimeos/aimeos-laravel') { |
|
| 68 | 68 | return $item['version']; |
| 69 | 69 | } |
| 70 | 70 | } |
@@ -82,23 +82,23 @@ discard block |
||
| 82 | 82 | * @param string $lang ISO language code, e.g. "en" or "en_GB" |
| 83 | 83 | * @return \Aimeos\MShop\Context\Item\Iface Modified context object |
| 84 | 84 | */ |
| 85 | - protected function setLocale( \Aimeos\MShop\Context\Item\Iface $context, $sitecode = 'default', $lang = null ) |
|
| 85 | + protected function setLocale(\Aimeos\MShop\Context\Item\Iface $context, $sitecode = 'default', $lang = null) |
|
| 86 | 86 | { |
| 87 | - $localeManager = \Aimeos\MShop\Factory::createManager( $context, 'locale' ); |
|
| 87 | + $localeManager = \Aimeos\MShop\Factory::createManager($context, 'locale'); |
|
| 88 | 88 | |
| 89 | 89 | try |
| 90 | 90 | { |
| 91 | - $localeItem = $localeManager->bootstrap( $sitecode, '', '', false ); |
|
| 92 | - $localeItem->setLanguageId( null ); |
|
| 93 | - $localeItem->setCurrencyId( null ); |
|
| 91 | + $localeItem = $localeManager->bootstrap($sitecode, '', '', false); |
|
| 92 | + $localeItem->setLanguageId(null); |
|
| 93 | + $localeItem->setCurrencyId(null); |
|
| 94 | 94 | } |
| 95 | - catch( \Aimeos\MShop\Locale\Exception $e ) |
|
| 95 | + catch (\Aimeos\MShop\Locale\Exception $e) |
|
| 96 | 96 | { |
| 97 | 97 | $localeItem = $localeManager->createItem(); |
| 98 | 98 | } |
| 99 | 99 | |
| 100 | - $context->setLocale( $localeItem ); |
|
| 101 | - $context->setI18n( app('\Aimeos\Shop\Base\I18n')->get( array( $lang ) ) ); |
|
| 100 | + $context->setLocale($localeItem); |
|
| 101 | + $context->setI18n(app('\Aimeos\Shop\Base\I18n')->get(array($lang))); |
|
| 102 | 102 | |
| 103 | 103 | return $context; |
| 104 | 104 | } |
@@ -34,56 +34,56 @@ 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' )->get(); |
|
| 47 | - $cntlPaths = $aimeos->getCustomPaths( 'controller/extjs' ); |
|
| 46 | + $aimeos = app('\Aimeos\Shop\Base\Aimeos')->get(); |
|
| 47 | + $cntlPaths = $aimeos->getCustomPaths('controller/extjs'); |
|
| 48 | 48 | |
| 49 | - $context = app( '\Aimeos\Shop\Base\Context' )->get( false ); |
|
| 50 | - $context = $this->setLocale( $context, $site, $lang ); |
|
| 49 | + $context = app('\Aimeos\Shop\Base\Context')->get(false); |
|
| 50 | + $context = $this->setLocale($context, $site, $lang); |
|
| 51 | 51 | |
| 52 | - $controller = new \Aimeos\Controller\ExtJS\JsonRpc( $context, $cntlPaths ); |
|
| 52 | + $controller = new \Aimeos\Controller\ExtJS\JsonRpc($context, $cntlPaths); |
|
| 53 | 53 | $cssFiles = array(); |
| 54 | 54 | |
| 55 | - foreach( $aimeos->getCustomPaths( 'admin/extjs' ) as $base => $paths ) |
|
| 55 | + foreach ($aimeos->getCustomPaths('admin/extjs') as $base => $paths) |
|
| 56 | 56 | { |
| 57 | - foreach( $paths as $path ) |
|
| 57 | + foreach ($paths as $path) |
|
| 58 | 58 | { |
| 59 | 59 | $jsbAbsPath = $base . '/' . $path; |
| 60 | 60 | |
| 61 | - if( !is_file( $jsbAbsPath ) ) { |
|
| 62 | - throw new \Exception( sprintf( 'JSB2 file "%1$s" not found', $jsbAbsPath ) ); |
|
| 61 | + if (!is_file($jsbAbsPath)) { |
|
| 62 | + throw new \Exception(sprintf('JSB2 file "%1$s" not found', $jsbAbsPath)); |
|
| 63 | 63 | } |
| 64 | 64 | |
| 65 | - $jsb2 = new \Aimeos\MW\Jsb2\Standard( $jsbAbsPath, dirname( $path ) ); |
|
| 66 | - $cssFiles = array_merge( $cssFiles, $jsb2->getUrls( 'css' ) ); |
|
| 65 | + $jsb2 = new \Aimeos\MW\Jsb2\Standard($jsbAbsPath, dirname($path)); |
|
| 66 | + $cssFiles = array_merge($cssFiles, $jsb2->getUrls('css')); |
|
| 67 | 67 | } |
| 68 | 68 | } |
| 69 | 69 | |
| 70 | - $jqadmUrl = route( 'aimeos_shop_jqadm_search', array( 'site' => $site, 'resource' => 'product' ) ); |
|
| 71 | - $jsonUrl = route( 'aimeos_shop_extadm_json', array( 'site' => $site, '_token' => csrf_token() ) ); |
|
| 72 | - $adminUrl = route( 'aimeos_shop_extadm', array( 'site' => '<site>', 'lang' => '<lang>', 'tab' => '<tab>' ) ); |
|
| 70 | + $jqadmUrl = route('aimeos_shop_jqadm_search', array('site' => $site, 'resource' => 'product')); |
|
| 71 | + $jsonUrl = route('aimeos_shop_extadm_json', array('site' => $site, '_token' => csrf_token())); |
|
| 72 | + $adminUrl = route('aimeos_shop_extadm', array('site' => '<site>', 'lang' => '<lang>', 'tab' => '<tab>')); |
|
| 73 | 73 | |
| 74 | 74 | $vars = array( |
| 75 | 75 | 'lang' => $lang, |
| 76 | 76 | 'cssFiles' => $cssFiles, |
| 77 | - 'languages' => $this->getJsonLanguages( $context), |
|
| 78 | - 'config' => $this->getJsonClientConfig( $context ), |
|
| 79 | - 'site' => $this->getJsonSiteItem( $context, $site ), |
|
| 80 | - 'i18nContent' => $this->getJsonClientI18n( $aimeos->getI18nPaths(), $lang ), |
|
| 77 | + 'languages' => $this->getJsonLanguages($context), |
|
| 78 | + 'config' => $this->getJsonClientConfig($context), |
|
| 79 | + 'site' => $this->getJsonSiteItem($context, $site), |
|
| 80 | + 'i18nContent' => $this->getJsonClientI18n($aimeos->getI18nPaths(), $lang), |
|
| 81 | 81 | 'searchSchemas' => $controller->getJsonSearchSchemas(), |
| 82 | 82 | 'itemSchemas' => $controller->getJsonItemSchemas(), |
| 83 | - 'smd' => $controller->getJsonSmd( $jsonUrl ), |
|
| 84 | - 'urlTemplate' => str_replace( ['<', '>'], ['{', '}'], urldecode( $adminUrl ) ), |
|
| 85 | - 'uploaddir' => config( 'shop::uploaddir' ), |
|
| 86 | - 'activeTab' => Input::get( 'tab', 0 ), |
|
| 83 | + 'smd' => $controller->getJsonSmd($jsonUrl), |
|
| 84 | + 'urlTemplate' => str_replace(['<', '>'], ['{', '}'], urldecode($adminUrl)), |
|
| 85 | + 'uploaddir' => config('shop::uploaddir'), |
|
| 86 | + 'activeTab' => Input::get('tab', 0), |
|
| 87 | 87 | 'version' => $this->getVersion(), |
| 88 | 88 | 'jqadmurl' => $jqadmUrl, |
| 89 | 89 | ); |
@@ -99,20 +99,20 @@ discard block |
||
| 99 | 99 | */ |
| 100 | 100 | public function doAction() |
| 101 | 101 | { |
| 102 | - if( config( 'shop.authorize', true ) ) { |
|
| 103 | - $this->authorize( 'admin' ); |
|
| 102 | + if (config('shop.authorize', true)) { |
|
| 103 | + $this->authorize('admin'); |
|
| 104 | 104 | } |
| 105 | 105 | |
| 106 | - $aimeos = app( '\Aimeos\Shop\Base\Aimeos' )->get(); |
|
| 107 | - $cntlPaths = $aimeos->getCustomPaths( 'controller/extjs' ); |
|
| 106 | + $aimeos = app('\Aimeos\Shop\Base\Aimeos')->get(); |
|
| 107 | + $cntlPaths = $aimeos->getCustomPaths('controller/extjs'); |
|
| 108 | 108 | |
| 109 | - $context = app( '\Aimeos\Shop\Base\Context' )->get( false ); |
|
| 110 | - $context = $this->setLocale( $context ); |
|
| 109 | + $context = app('\Aimeos\Shop\Base\Context')->get(false); |
|
| 110 | + $context = $this->setLocale($context); |
|
| 111 | 111 | |
| 112 | - $controller = new \Aimeos\Controller\ExtJS\JsonRpc( $context, $cntlPaths ); |
|
| 112 | + $controller = new \Aimeos\Controller\ExtJS\JsonRpc($context, $cntlPaths); |
|
| 113 | 113 | |
| 114 | - $response = $controller->process( Input::instance()->request->all(), 'php://input' ); |
|
| 115 | - return View::make('shop::admin.extadm-do', array( 'output' => $response )); |
|
| 114 | + $response = $controller->process(Input::instance()->request->all(), 'php://input'); |
|
| 115 | + return View::make('shop::admin.extadm-do', array('output' => $response)); |
|
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | |
@@ -123,32 +123,32 @@ discard block |
||
| 123 | 123 | */ |
| 124 | 124 | public function fileAction() |
| 125 | 125 | { |
| 126 | - if( config( 'shop.authorize', true ) ) { |
|
| 127 | - $this->authorize( 'admin' ); |
|
| 126 | + if (config('shop.authorize', true)) { |
|
| 127 | + $this->authorize('admin'); |
|
| 128 | 128 | } |
| 129 | 129 | |
| 130 | 130 | $contents = ''; |
| 131 | 131 | $jsFiles = array(); |
| 132 | - $aimeos = app( '\Aimeos\Shop\Base\Aimeos' )->get(); |
|
| 132 | + $aimeos = app('\Aimeos\Shop\Base\Aimeos')->get(); |
|
| 133 | 133 | |
| 134 | - foreach( $aimeos->getCustomPaths( 'admin/extjs' ) as $base => $paths ) |
|
| 134 | + foreach ($aimeos->getCustomPaths('admin/extjs') as $base => $paths) |
|
| 135 | 135 | { |
| 136 | - foreach( $paths as $path ) |
|
| 136 | + foreach ($paths as $path) |
|
| 137 | 137 | { |
| 138 | 138 | $jsbAbsPath = $base . '/' . $path; |
| 139 | - $jsb2 = new \Aimeos\MW\Jsb2\Standard( $jsbAbsPath, dirname( $jsbAbsPath ) ); |
|
| 140 | - $jsFiles = array_merge( $jsFiles, $jsb2->getUrls( 'js', '' ) ); |
|
| 139 | + $jsb2 = new \Aimeos\MW\Jsb2\Standard($jsbAbsPath, dirname($jsbAbsPath)); |
|
| 140 | + $jsFiles = array_merge($jsFiles, $jsb2->getUrls('js', '')); |
|
| 141 | 141 | } |
| 142 | 142 | } |
| 143 | 143 | |
| 144 | - foreach( $jsFiles as $file ) |
|
| 144 | + foreach ($jsFiles as $file) |
|
| 145 | 145 | { |
| 146 | - if( ( $content = file_get_contents( $file ) ) !== false ) { |
|
| 146 | + if (($content = file_get_contents($file)) !== false) { |
|
| 147 | 147 | $contents .= $content; |
| 148 | 148 | } |
| 149 | 149 | } |
| 150 | 150 | |
| 151 | - return response( $contents )->header( 'Content-Type', 'application/javascript' ); |
|
| 151 | + return response($contents)->header('Content-Type', 'application/javascript'); |
|
| 152 | 152 | } |
| 153 | 153 | |
| 154 | 154 | |
@@ -158,30 +158,30 @@ discard block |
||
| 158 | 158 | * @param \Aimeos\MShop\Context\Item\Iface $context Context object |
| 159 | 159 | * @return array List of language IDs with labels |
| 160 | 160 | */ |
| 161 | - protected function getJsonLanguages( \Aimeos\MShop\Context\Item\Iface $context ) |
|
| 161 | + protected function getJsonLanguages(\Aimeos\MShop\Context\Item\Iface $context) |
|
| 162 | 162 | { |
| 163 | - $paths = app( '\Aimeos\Shop\Base\Aimeos' )->get()->getI18nPaths(); |
|
| 163 | + $paths = app('\Aimeos\Shop\Base\Aimeos')->get()->getI18nPaths(); |
|
| 164 | 164 | $langs = array(); |
| 165 | 165 | |
| 166 | - if( !isset( $paths['admin'] ) ) { |
|
| 167 | - return json_encode( array() ); |
|
| 166 | + if (!isset($paths['admin'])) { |
|
| 167 | + return json_encode(array()); |
|
| 168 | 168 | } |
| 169 | 169 | |
| 170 | - foreach( $paths['admin'] as $path ) |
|
| 170 | + foreach ($paths['admin'] as $path) |
|
| 171 | 171 | { |
| 172 | - $iter = new \DirectoryIterator( $path ); |
|
| 172 | + $iter = new \DirectoryIterator($path); |
|
| 173 | 173 | |
| 174 | - foreach( $iter as $file ) |
|
| 174 | + foreach ($iter as $file) |
|
| 175 | 175 | { |
| 176 | 176 | $name = $file->getFilename(); |
| 177 | 177 | |
| 178 | - if( preg_match('/^[a-z]{2,3}(_[A-Z]{2})?$/', $name ) ) { |
|
| 178 | + if (preg_match('/^[a-z]{2,3}(_[A-Z]{2})?$/', $name)) { |
|
| 179 | 179 | $langs[$name] = null; |
| 180 | 180 | } |
| 181 | 181 | } |
| 182 | 182 | } |
| 183 | 183 | |
| 184 | - return json_encode( $this->getLanguages( $context, array_keys( $langs ) ) ); |
|
| 184 | + return json_encode($this->getLanguages($context, array_keys($langs))); |
|
| 185 | 185 | } |
| 186 | 186 | |
| 187 | 187 | |
@@ -191,10 +191,10 @@ discard block |
||
| 191 | 191 | * @param \Aimeos\MShop\Context\Item\Iface $context Context item object |
| 192 | 192 | * @return string JSON encoded configuration object |
| 193 | 193 | */ |
| 194 | - protected function getJsonClientConfig( \Aimeos\MShop\Context\Item\Iface $context ) |
|
| 194 | + protected function getJsonClientConfig(\Aimeos\MShop\Context\Item\Iface $context) |
|
| 195 | 195 | { |
| 196 | - $config = $context->getConfig()->get( 'admin/extjs', array() ); |
|
| 197 | - return json_encode( array( 'admin' => array( 'extjs' => $config ) ), JSON_FORCE_OBJECT ); |
|
| 196 | + $config = $context->getConfig()->get('admin/extjs', array()); |
|
| 197 | + return json_encode(array('admin' => array('extjs' => $config)), JSON_FORCE_OBJECT); |
|
| 198 | 198 | } |
| 199 | 199 | |
| 200 | 200 | |
@@ -205,16 +205,16 @@ discard block |
||
| 205 | 205 | * @param string $lang ISO language code like "en" or "en_GB" |
| 206 | 206 | * @return string JSON encoded translation object |
| 207 | 207 | */ |
| 208 | - protected function getJsonClientI18n( array $i18nPaths, $lang ) |
|
| 208 | + protected function getJsonClientI18n(array $i18nPaths, $lang) |
|
| 209 | 209 | { |
| 210 | - $i18n = new \Aimeos\MW\Translation\Zend2( $i18nPaths, 'gettext', $lang, array( 'disableNotices' => true ) ); |
|
| 210 | + $i18n = new \Aimeos\MW\Translation\Zend2($i18nPaths, 'gettext', $lang, array('disableNotices' => true)); |
|
| 211 | 211 | |
| 212 | 212 | $content = array( |
| 213 | - 'admin' => $i18n->getAll( 'admin' ), |
|
| 214 | - 'admin/ext' => $i18n->getAll( 'admin/ext' ), |
|
| 213 | + 'admin' => $i18n->getAll('admin'), |
|
| 214 | + 'admin/ext' => $i18n->getAll('admin/ext'), |
|
| 215 | 215 | ); |
| 216 | 216 | |
| 217 | - return json_encode( $content, JSON_FORCE_OBJECT ); |
|
| 217 | + return json_encode($content, JSON_FORCE_OBJECT); |
|
| 218 | 218 | } |
| 219 | 219 | |
| 220 | 220 | |
@@ -226,19 +226,19 @@ discard block |
||
| 226 | 226 | * @return string JSON encoded site item object |
| 227 | 227 | * @throws Exception If no site item was found for the code |
| 228 | 228 | */ |
| 229 | - protected function getJsonSiteItem( \Aimeos\MShop\Context\Item\Iface $context, $site ) |
|
| 229 | + protected function getJsonSiteItem(\Aimeos\MShop\Context\Item\Iface $context, $site) |
|
| 230 | 230 | { |
| 231 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'locale/site' ); |
|
| 231 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'locale/site'); |
|
| 232 | 232 | |
| 233 | 233 | $criteria = $manager->createSearch(); |
| 234 | - $criteria->setConditions( $criteria->compare( '==', 'locale.site.code', $site ) ); |
|
| 235 | - $items = $manager->searchItems( $criteria ); |
|
| 234 | + $criteria->setConditions($criteria->compare('==', 'locale.site.code', $site)); |
|
| 235 | + $items = $manager->searchItems($criteria); |
|
| 236 | 236 | |
| 237 | - if( ( $item = reset( $items ) ) === false ) { |
|
| 238 | - throw new \Exception( sprintf( 'No site found for code "%1$s"', $site ) ); |
|
| 237 | + if (($item = reset($items)) === false) { |
|
| 238 | + throw new \Exception(sprintf('No site found for code "%1$s"', $site)); |
|
| 239 | 239 | } |
| 240 | 240 | |
| 241 | - return json_encode( $item->toArray() ); |
|
| 241 | + return json_encode($item->toArray()); |
|
| 242 | 242 | } |
| 243 | 243 | |
| 244 | 244 | |
@@ -249,18 +249,18 @@ discard block |
||
| 249 | 249 | * @param array $langIds List of language IDs |
| 250 | 250 | * @return array List of associative lists with "id" and "label" as keys |
| 251 | 251 | */ |
| 252 | - protected function getLanguages( \Aimeos\MShop\Context\Item\Iface $context, array $langIds ) |
|
| 252 | + protected function getLanguages(\Aimeos\MShop\Context\Item\Iface $context, array $langIds) |
|
| 253 | 253 | { |
| 254 | - $languageManager = \Aimeos\MShop\Factory::createManager( $context, 'locale/language' ); |
|
| 254 | + $languageManager = \Aimeos\MShop\Factory::createManager($context, 'locale/language'); |
|
| 255 | 255 | $result = array(); |
| 256 | 256 | |
| 257 | 257 | $search = $languageManager->createSearch(); |
| 258 | - $search->setConditions( $search->compare('==', 'locale.language.id', $langIds ) ); |
|
| 259 | - $search->setSortations( array( $search->sort( '-', 'locale.language.status' ), $search->sort( '+', 'locale.language.label' ) ) ); |
|
| 260 | - $langItems = $languageManager->searchItems( $search ); |
|
| 258 | + $search->setConditions($search->compare('==', 'locale.language.id', $langIds)); |
|
| 259 | + $search->setSortations(array($search->sort('-', 'locale.language.status'), $search->sort('+', 'locale.language.label'))); |
|
| 260 | + $langItems = $languageManager->searchItems($search); |
|
| 261 | 261 | |
| 262 | - foreach( $langItems as $id => $item ) { |
|
| 263 | - $result[] = array( 'id' => $id, 'label' => $item->getLabel() ); |
|
| 262 | + foreach ($langItems as $id => $item) { |
|
| 263 | + $result[] = array('id' => $id, 'label' => $item->getLabel()); |
|
| 264 | 264 | } |
| 265 | 265 | |
| 266 | 266 | return $result; |
@@ -275,17 +275,17 @@ discard block |
||
| 275 | 275 | * @param string $locale ISO language code, e.g. "en" or "en_GB" |
| 276 | 276 | * @return \Aimeos\MShop\Context\Item\Iface Modified context object |
| 277 | 277 | */ |
| 278 | - protected function setLocale( \Aimeos\MShop\Context\Item\Iface $context, $sitecode = 'default', $locale = null ) |
|
| 278 | + protected function setLocale(\Aimeos\MShop\Context\Item\Iface $context, $sitecode = 'default', $locale = null) |
|
| 279 | 279 | { |
| 280 | - $localeManager = \Aimeos\MShop\Factory::createManager( $context, 'locale' ); |
|
| 280 | + $localeManager = \Aimeos\MShop\Factory::createManager($context, 'locale'); |
|
| 281 | 281 | |
| 282 | 282 | try { |
| 283 | - $localeItem = $localeManager->bootstrap( $sitecode, $locale, '', false ); |
|
| 284 | - } catch( \Aimeos\MShop\Locale\Exception $e ) { |
|
| 283 | + $localeItem = $localeManager->bootstrap($sitecode, $locale, '', false); |
|
| 284 | + } catch (\Aimeos\MShop\Locale\Exception $e) { |
|
| 285 | 285 | $localeItem = $localeManager->createItem(); |
| 286 | 286 | } |
| 287 | 287 | |
| 288 | - $context->setLocale( $localeItem ); |
|
| 288 | + $context->setLocale($localeItem); |
|
| 289 | 289 | |
| 290 | 290 | return $context; |
| 291 | 291 | } |