@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | * @param RequestStack $requestStack Current request stack |
33 | 33 | * @param Container $container Container object to access parameters |
34 | 34 | */ |
35 | - public function __construct( RequestStack $requestStack, Container $container ) |
|
35 | + public function __construct(RequestStack $requestStack, Container $container) |
|
36 | 36 | { |
37 | 37 | $this->requestStack = $requestStack; |
38 | 38 | $this->container = $container; |
@@ -47,57 +47,57 @@ discard block |
||
47 | 47 | * @param string|null $locale Code of the current language or null for no translation |
48 | 48 | * @return \Aimeos\MW\View\Iface View object |
49 | 49 | */ |
50 | - public function create( \Aimeos\MW\Config\Iface $config, array $templatePaths, $locale = null ) |
|
50 | + public function create(\Aimeos\MW\Config\Iface $config, array $templatePaths, $locale = null) |
|
51 | 51 | { |
52 | 52 | $params = $fixed = array(); |
53 | 53 | $request = $this->requestStack->getMasterRequest(); |
54 | 54 | |
55 | - if( $locale !== null ) |
|
55 | + if ($locale !== null) |
|
56 | 56 | { |
57 | - $params = $request->request->all() + $request->query->all() + $request->attributes->get( '_route_params' ); |
|
57 | + $params = $request->request->all() + $request->query->all() + $request->attributes->get('_route_params'); |
|
58 | 58 | $fixed = $this->getFixedParams(); |
59 | 59 | |
60 | - $i18n = $this->container->get('aimeos_i18n')->get( array( $locale ) ); |
|
60 | + $i18n = $this->container->get('aimeos_i18n')->get(array($locale)); |
|
61 | 61 | $translation = $i18n[$locale]; |
62 | 62 | } |
63 | 63 | else |
64 | 64 | { |
65 | - $translation = new \Aimeos\MW\Translation\None( 'en' ); |
|
65 | + $translation = new \Aimeos\MW\Translation\None('en'); |
|
66 | 66 | } |
67 | 67 | |
68 | 68 | |
69 | - $view = new \Aimeos\MW\View\Standard( $templatePaths ); |
|
69 | + $view = new \Aimeos\MW\View\Standard($templatePaths); |
|
70 | 70 | |
71 | - $helper = new \Aimeos\MW\View\Helper\Translate\Standard( $view, $translation ); |
|
72 | - $view->addHelper( 'translate', $helper ); |
|
71 | + $helper = new \Aimeos\MW\View\Helper\Translate\Standard($view, $translation); |
|
72 | + $view->addHelper('translate', $helper); |
|
73 | 73 | |
74 | - $helper = new \Aimeos\MW\View\Helper\Url\Symfony2( $view, $this->container->get( 'router' ), $fixed ); |
|
75 | - $view->addHelper( 'url', $helper ); |
|
74 | + $helper = new \Aimeos\MW\View\Helper\Url\Symfony2($view, $this->container->get('router'), $fixed); |
|
75 | + $view->addHelper('url', $helper); |
|
76 | 76 | |
77 | - $helper = new \Aimeos\MW\View\Helper\Param\Standard( $view, $params ); |
|
78 | - $view->addHelper( 'param', $helper ); |
|
77 | + $helper = new \Aimeos\MW\View\Helper\Param\Standard($view, $params); |
|
78 | + $view->addHelper('param', $helper); |
|
79 | 79 | |
80 | - $config = new \Aimeos\MW\Config\Decorator\Protect( clone $config, array( 'admin', 'client' ) ); |
|
81 | - $helper = new \Aimeos\MW\View\Helper\Config\Standard( $view, $config ); |
|
82 | - $view->addHelper( 'config', $helper ); |
|
80 | + $config = new \Aimeos\MW\Config\Decorator\Protect(clone $config, array('admin', 'client')); |
|
81 | + $helper = new \Aimeos\MW\View\Helper\Config\Standard($view, $config); |
|
82 | + $view->addHelper('config', $helper); |
|
83 | 83 | |
84 | - $sepDec = $config->get( 'client/html/common/format/seperatorDecimal', '.' ); |
|
85 | - $sep1000 = $config->get( 'client/html/common/format/seperator1000', ' ' ); |
|
86 | - $helper = new \Aimeos\MW\View\Helper\Number\Standard( $view, $sepDec, $sep1000 ); |
|
87 | - $view->addHelper( 'number', $helper ); |
|
84 | + $sepDec = $config->get('client/html/common/format/seperatorDecimal', '.'); |
|
85 | + $sep1000 = $config->get('client/html/common/format/seperator1000', ' '); |
|
86 | + $helper = new \Aimeos\MW\View\Helper\Number\Standard($view, $sepDec, $sep1000); |
|
87 | + $view->addHelper('number', $helper); |
|
88 | 88 | |
89 | - if( $request !== null ) |
|
89 | + if ($request !== null) |
|
90 | 90 | { |
91 | - $helper = new \Aimeos\MW\View\Helper\Request\Symfony2( $view, $request ); |
|
92 | - $view->addHelper( 'request', $helper ); |
|
91 | + $helper = new \Aimeos\MW\View\Helper\Request\Symfony2($view, $request); |
|
92 | + $view->addHelper('request', $helper); |
|
93 | 93 | } |
94 | 94 | |
95 | - $helper = new \Aimeos\MW\View\Helper\Response\Symfony2( $view ); |
|
96 | - $view->addHelper( 'response', $helper ); |
|
95 | + $helper = new \Aimeos\MW\View\Helper\Response\Symfony2($view); |
|
96 | + $view->addHelper('response', $helper); |
|
97 | 97 | |
98 | - $token = $this->container->get( 'security.csrf.token_manager' )->getToken( '_token' ); |
|
99 | - $helper = new \Aimeos\MW\View\Helper\Csrf\Standard( $view, '_token', $token->getValue() ); |
|
100 | - $view->addHelper( 'csrf', $helper ); |
|
98 | + $token = $this->container->get('security.csrf.token_manager')->getToken('_token'); |
|
99 | + $helper = new \Aimeos\MW\View\Helper\Csrf\Standard($view, '_token', $token->getValue()); |
|
100 | + $view->addHelper('csrf', $helper); |
|
101 | 101 | |
102 | 102 | return $view; |
103 | 103 | } |
@@ -113,15 +113,15 @@ discard block |
||
113 | 113 | $urlparams = array(); |
114 | 114 | $attr = $this->requestStack->getMasterRequest()->attributes; |
115 | 115 | |
116 | - if( ( $site = $attr->get( 'site' ) ) !== null ) { |
|
116 | + if (($site = $attr->get('site')) !== null) { |
|
117 | 117 | $urlparams['site'] = $site; |
118 | 118 | } |
119 | 119 | |
120 | - if( ( $lang = $attr->get( 'locale' ) ) !== null ) { |
|
120 | + if (($lang = $attr->get('locale')) !== null) { |
|
121 | 121 | $urlparams['locale'] = $lang; |
122 | 122 | } |
123 | 123 | |
124 | - if( ( $currency = $attr->get( 'currency' ) ) !== null ) { |
|
124 | + if (($currency = $attr->get('currency')) !== null) { |
|
125 | 125 | $urlparams['currency'] = $currency; |
126 | 126 | } |
127 | 127 |