@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | * @param \Aimeos\Shop\Base\I18n $i18n I18n object |
| 42 | 42 | * @param \Aimeos\Shop\Base\Support $support Support object |
| 43 | 43 | */ |
| 44 | - public function __construct( \Aimeos\Shop\Base\I18n $i18n, \Aimeos\Shop\Base\Support $support ) |
|
| 44 | + public function __construct(\Aimeos\Shop\Base\I18n $i18n, \Aimeos\Shop\Base\Support $support) |
|
| 45 | 45 | { |
| 46 | 46 | $this->i18n = $i18n; |
| 47 | 47 | $this->support = $support; |
@@ -56,19 +56,19 @@ discard block |
||
| 56 | 56 | * @param string|null $locale Code of the current language or null for no translation |
| 57 | 57 | * @return \Aimeos\MW\View\Iface View object |
| 58 | 58 | */ |
| 59 | - public function create( \Aimeos\MW\Config\Iface $config, array $templatePaths, $locale = null ) |
|
| 59 | + public function create(\Aimeos\MW\Config\Iface $config, array $templatePaths, $locale = null) |
|
| 60 | 60 | { |
| 61 | - $view = new \Aimeos\MW\View\Standard( $templatePaths ); |
|
| 62 | - |
|
| 63 | - $this->addConfig( $view, $config ); |
|
| 64 | - $this->addNumber( $view, $config ); |
|
| 65 | - $this->addRequest( $view ); |
|
| 66 | - $this->addResponse( $view ); |
|
| 67 | - $this->addParam( $view ); |
|
| 68 | - $this->addUrl( $view ); |
|
| 69 | - $this->addCsrf( $view ); |
|
| 70 | - $this->addAccess( $view ); |
|
| 71 | - $this->addTranslate( $view, $config, $locale ); |
|
| 61 | + $view = new \Aimeos\MW\View\Standard($templatePaths); |
|
| 62 | + |
|
| 63 | + $this->addConfig($view, $config); |
|
| 64 | + $this->addNumber($view, $config); |
|
| 65 | + $this->addRequest($view); |
|
| 66 | + $this->addResponse($view); |
|
| 67 | + $this->addParam($view); |
|
| 68 | + $this->addUrl($view); |
|
| 69 | + $this->addCsrf($view); |
|
| 70 | + $this->addAccess($view); |
|
| 71 | + $this->addTranslate($view, $config, $locale); |
|
| 72 | 72 | |
| 73 | 73 | return $view; |
| 74 | 74 | } |
@@ -80,16 +80,16 @@ discard block |
||
| 80 | 80 | * @param \Aimeos\MW\View\Iface $view View object |
| 81 | 81 | * @return \Aimeos\MW\View\Iface Modified view object |
| 82 | 82 | */ |
| 83 | - protected function addAccess( \Aimeos\MW\View\Iface $view ) |
|
| 83 | + protected function addAccess(\Aimeos\MW\View\Iface $view) |
|
| 84 | 84 | { |
| 85 | 85 | $support = $this->support; |
| 86 | 86 | |
| 87 | - $fcn = function() use ( $support ) { |
|
| 87 | + $fcn = function() use ($support) { |
|
| 88 | 88 | return $support->getGroups(); |
| 89 | 89 | }; |
| 90 | 90 | |
| 91 | - $helper = new \Aimeos\MW\View\Helper\Access\Standard( $view, $fcn ); |
|
| 92 | - $view->addHelper( 'access', $helper ); |
|
| 91 | + $helper = new \Aimeos\MW\View\Helper\Access\Standard($view, $fcn); |
|
| 92 | + $view->addHelper('access', $helper); |
|
| 93 | 93 | |
| 94 | 94 | return $view; |
| 95 | 95 | } |
@@ -102,11 +102,11 @@ discard block |
||
| 102 | 102 | * @param \Aimeos\MW\Config\Iface $config Configuration object |
| 103 | 103 | * @return \Aimeos\MW\View\Iface Modified view object |
| 104 | 104 | */ |
| 105 | - protected function addConfig( \Aimeos\MW\View\Iface $view, \Aimeos\MW\Config\Iface $config ) |
|
| 105 | + protected function addConfig(\Aimeos\MW\View\Iface $view, \Aimeos\MW\Config\Iface $config) |
|
| 106 | 106 | { |
| 107 | - $config = new \Aimeos\MW\Config\Decorator\Protect( clone $config, array( 'admin', 'client' ) ); |
|
| 108 | - $helper = new \Aimeos\MW\View\Helper\Config\Standard( $view, $config ); |
|
| 109 | - $view->addHelper( 'config', $helper ); |
|
| 107 | + $config = new \Aimeos\MW\Config\Decorator\Protect(clone $config, array('admin', 'client')); |
|
| 108 | + $helper = new \Aimeos\MW\View\Helper\Config\Standard($view, $config); |
|
| 109 | + $view->addHelper('config', $helper); |
|
| 110 | 110 | |
| 111 | 111 | return $view; |
| 112 | 112 | } |
@@ -118,10 +118,10 @@ discard block |
||
| 118 | 118 | * @param \Aimeos\MW\View\Iface $view View object |
| 119 | 119 | * @return \Aimeos\MW\View\Iface Modified view object |
| 120 | 120 | */ |
| 121 | - protected function addCsrf( \Aimeos\MW\View\Iface $view ) |
|
| 121 | + protected function addCsrf(\Aimeos\MW\View\Iface $view) |
|
| 122 | 122 | { |
| 123 | - $helper = new \Aimeos\MW\View\Helper\Csrf\Standard( $view, '_token', csrf_token() ); |
|
| 124 | - $view->addHelper( 'csrf', $helper ); |
|
| 123 | + $helper = new \Aimeos\MW\View\Helper\Csrf\Standard($view, '_token', csrf_token()); |
|
| 124 | + $view->addHelper('csrf', $helper); |
|
| 125 | 125 | |
| 126 | 126 | return $view; |
| 127 | 127 | } |
@@ -134,14 +134,14 @@ discard block |
||
| 134 | 134 | * @param \Aimeos\MW\Config\Iface $config Configuration object |
| 135 | 135 | * @return \Aimeos\MW\View\Iface Modified view object |
| 136 | 136 | */ |
| 137 | - protected function addNumber( \Aimeos\MW\View\Iface $view, \Aimeos\MW\Config\Iface $config ) |
|
| 137 | + protected function addNumber(\Aimeos\MW\View\Iface $view, \Aimeos\MW\Config\Iface $config) |
|
| 138 | 138 | { |
| 139 | - $sepDec = $config->get( 'client/html/common/format/seperatorDecimal', '.' ); |
|
| 140 | - $sep1000 = $config->get( 'client/html/common/format/seperator1000', ' ' ); |
|
| 141 | - $decimals = $config->get( 'client/html/common/format/decimals', 2 ); |
|
| 139 | + $sepDec = $config->get('client/html/common/format/seperatorDecimal', '.'); |
|
| 140 | + $sep1000 = $config->get('client/html/common/format/seperator1000', ' '); |
|
| 141 | + $decimals = $config->get('client/html/common/format/decimals', 2); |
|
| 142 | 142 | |
| 143 | - $helper = new \Aimeos\MW\View\Helper\Number\Standard( $view, $sepDec, $sep1000, $decimals ); |
|
| 144 | - $view->addHelper( 'number', $helper ); |
|
| 143 | + $helper = new \Aimeos\MW\View\Helper\Number\Standard($view, $sepDec, $sep1000, $decimals); |
|
| 144 | + $view->addHelper('number', $helper); |
|
| 145 | 145 | |
| 146 | 146 | return $view; |
| 147 | 147 | } |
@@ -153,11 +153,11 @@ discard block |
||
| 153 | 153 | * @param \Aimeos\MW\View\Iface $view View object |
| 154 | 154 | * @return \Aimeos\MW\View\Iface Modified view object |
| 155 | 155 | */ |
| 156 | - protected static function addParam( \Aimeos\MW\View\Iface $view ) |
|
| 156 | + protected static function addParam(\Aimeos\MW\View\Iface $view) |
|
| 157 | 157 | { |
| 158 | - $params = ( Route::current() ? Route::current()->parameters() + Input::all() : array() ); |
|
| 159 | - $helper = new \Aimeos\MW\View\Helper\Param\Standard( $view, $params ); |
|
| 160 | - $view->addHelper( 'param', $helper ); |
|
| 158 | + $params = (Route::current() ? Route::current()->parameters() + Input::all() : array()); |
|
| 159 | + $helper = new \Aimeos\MW\View\Helper\Param\Standard($view, $params); |
|
| 160 | + $view->addHelper('param', $helper); |
|
| 161 | 161 | |
| 162 | 162 | return $view; |
| 163 | 163 | } |
@@ -169,10 +169,10 @@ discard block |
||
| 169 | 169 | * @param \Aimeos\MW\View\Iface $view View object |
| 170 | 170 | * @return \Aimeos\MW\View\Iface Modified view object |
| 171 | 171 | */ |
| 172 | - protected static function addRequest( \Aimeos\MW\View\Iface $view ) |
|
| 172 | + protected static function addRequest(\Aimeos\MW\View\Iface $view) |
|
| 173 | 173 | { |
| 174 | - $helper = new \Aimeos\MW\View\Helper\Request\Laravel5( $view, Request::instance() ); |
|
| 175 | - $view->addHelper( 'request', $helper ); |
|
| 174 | + $helper = new \Aimeos\MW\View\Helper\Request\Laravel5($view, Request::instance()); |
|
| 175 | + $view->addHelper('request', $helper); |
|
| 176 | 176 | |
| 177 | 177 | return $view; |
| 178 | 178 | } |
@@ -184,10 +184,10 @@ discard block |
||
| 184 | 184 | * @param \Aimeos\MW\View\Iface $view View object |
| 185 | 185 | * @return \Aimeos\MW\View\Iface Modified view object |
| 186 | 186 | */ |
| 187 | - protected static function addResponse( \Aimeos\MW\View\Iface $view ) |
|
| 187 | + protected static function addResponse(\Aimeos\MW\View\Iface $view) |
|
| 188 | 188 | { |
| 189 | - $helper = new \Aimeos\MW\View\Helper\Response\Laravel5( $view ); |
|
| 190 | - $view->addHelper( 'response', $helper ); |
|
| 189 | + $helper = new \Aimeos\MW\View\Helper\Response\Laravel5($view); |
|
| 190 | + $view->addHelper('response', $helper); |
|
| 191 | 191 | |
| 192 | 192 | return $view; |
| 193 | 193 | } |
@@ -199,27 +199,27 @@ discard block |
||
| 199 | 199 | * @param \Aimeos\MW\View\Iface $view View object |
| 200 | 200 | * @return \Aimeos\MW\View\Iface Modified view object |
| 201 | 201 | */ |
| 202 | - protected function addUrl( \Aimeos\MW\View\Iface $view ) |
|
| 202 | + protected function addUrl(\Aimeos\MW\View\Iface $view) |
|
| 203 | 203 | { |
| 204 | 204 | $fixed = array(); |
| 205 | 205 | |
| 206 | - if( Route::current() ) |
|
| 206 | + if (Route::current()) |
|
| 207 | 207 | { |
| 208 | - if( ( $value = Route::input( 'site' ) ) !== null ) { |
|
| 208 | + if (($value = Route::input('site')) !== null) { |
|
| 209 | 209 | $fixed['site'] = $value; |
| 210 | 210 | } |
| 211 | 211 | |
| 212 | - if( ( $value = Route::input( 'locale' ) ) !== null ) { |
|
| 212 | + if (($value = Route::input('locale')) !== null) { |
|
| 213 | 213 | $fixed['locale'] = $value; |
| 214 | 214 | } |
| 215 | 215 | |
| 216 | - if( ( $value = Route::input( 'currency' ) ) !== null ) { |
|
| 216 | + if (($value = Route::input('currency')) !== null) { |
|
| 217 | 217 | $fixed['currency'] = $value; |
| 218 | 218 | } |
| 219 | 219 | } |
| 220 | 220 | |
| 221 | - $helper = new \Aimeos\MW\View\Helper\Url\Laravel5( $view, app('url'), $fixed ); |
|
| 222 | - $view->addHelper( 'url', $helper ); |
|
| 221 | + $helper = new \Aimeos\MW\View\Helper\Url\Laravel5($view, app('url'), $fixed); |
|
| 222 | + $view->addHelper('url', $helper); |
|
| 223 | 223 | |
| 224 | 224 | return $view; |
| 225 | 225 | } |
@@ -233,20 +233,20 @@ discard block |
||
| 233 | 233 | * @param string|null $locale ISO language code, e.g. "de" or "de_CH" |
| 234 | 234 | * @return \Aimeos\MW\View\Iface Modified view object |
| 235 | 235 | */ |
| 236 | - protected function addTranslate( \Aimeos\MW\View\Iface $view, \Aimeos\MW\Config\Iface $config, $locale ) |
|
| 236 | + protected function addTranslate(\Aimeos\MW\View\Iface $view, \Aimeos\MW\Config\Iface $config, $locale) |
|
| 237 | 237 | { |
| 238 | - if( $locale !== null ) |
|
| 238 | + if ($locale !== null) |
|
| 239 | 239 | { |
| 240 | - $i18n = $this->i18n->get( array( $locale ) ); |
|
| 240 | + $i18n = $this->i18n->get(array($locale)); |
|
| 241 | 241 | $translation = $i18n[$locale]; |
| 242 | 242 | } |
| 243 | 243 | else |
| 244 | 244 | { |
| 245 | - $translation = new \Aimeos\MW\Translation\None( 'en' ); |
|
| 245 | + $translation = new \Aimeos\MW\Translation\None('en'); |
|
| 246 | 246 | } |
| 247 | 247 | |
| 248 | - $helper = new \Aimeos\MW\View\Helper\Translate\Standard( $view, $translation ); |
|
| 249 | - $view->addHelper( 'translate', $helper ); |
|
| 248 | + $helper = new \Aimeos\MW\View\Helper\Translate\Standard($view, $translation); |
|
| 249 | + $view->addHelper('translate', $helper); |
|
| 250 | 250 | |
| 251 | 251 | return $view; |
| 252 | 252 | } |