@@ -145,7 +145,7 @@ |
||
145 | 145 | * Creates a list of all available translations. |
146 | 146 | * |
147 | 147 | * @param \Aimeos\MShop\Context\Item\Iface $context Context object |
148 | - * @return array List of language IDs with labels |
|
148 | + * @return string List of language IDs with labels |
|
149 | 149 | */ |
150 | 150 | protected function getJsonLanguages( \Aimeos\MShop\Context\Item\Iface $context ) |
151 | 151 | { |
@@ -30,63 +30,63 @@ discard block |
||
30 | 30 | * @param Request $request Symfony request object |
31 | 31 | * @return Response Generated output for the admin interface |
32 | 32 | */ |
33 | - public function indexAction( Request $request ) |
|
33 | + public function indexAction(Request $request) |
|
34 | 34 | { |
35 | - $site = $request->attributes->get( 'site', $request->query->get( 'site', 'default' ) ); |
|
36 | - $lang = $request->attributes->get( 'lang', $request->query->get( 'lang', 'en' ) ); |
|
37 | - $tab = $request->attributes->get( 'tab', $request->query->get( 'tab', 0 ) ); |
|
35 | + $site = $request->attributes->get('site', $request->query->get('site', 'default')); |
|
36 | + $lang = $request->attributes->get('lang', $request->query->get('lang', 'en')); |
|
37 | + $tab = $request->attributes->get('tab', $request->query->get('tab', 0)); |
|
38 | 38 | |
39 | - $context = $this->get( 'aimeos_context' )->get( false, 'backend' ); |
|
40 | - $context->setLocale( $this->get( 'aimeos_locale' )->getBackend( $context, $site ) ); |
|
39 | + $context = $this->get('aimeos_context')->get(false, 'backend'); |
|
40 | + $context->setLocale($this->get('aimeos_locale')->getBackend($context, $site)); |
|
41 | 41 | |
42 | - $aimeos = $this->get( 'aimeos' ); |
|
42 | + $aimeos = $this->get('aimeos'); |
|
43 | 43 | $bootstrap = $aimeos->get(); |
44 | 44 | |
45 | - $cntlPaths = $bootstrap->getCustomPaths( 'controller/extjs' ); |
|
46 | - $controller = new \Aimeos\Controller\ExtJS\JsonRpc( $context, $cntlPaths ); |
|
45 | + $cntlPaths = $bootstrap->getCustomPaths('controller/extjs'); |
|
46 | + $controller = new \Aimeos\Controller\ExtJS\JsonRpc($context, $cntlPaths); |
|
47 | 47 | $cssFiles = array(); |
48 | 48 | |
49 | - foreach( $bootstrap->getCustomPaths( 'admin/extjs' ) as $base => $paths ) |
|
49 | + foreach ($bootstrap->getCustomPaths('admin/extjs') as $base => $paths) |
|
50 | 50 | { |
51 | - foreach( $paths as $path ) |
|
51 | + foreach ($paths as $path) |
|
52 | 52 | { |
53 | - $jsbAbsPath = $base . '/' . $path; |
|
53 | + $jsbAbsPath = $base.'/'.$path; |
|
54 | 54 | |
55 | - if( !is_file( $jsbAbsPath ) ) { |
|
56 | - throw new \Exception( sprintf( 'JSB2 file "%1$s" not found', $jsbAbsPath ) ); |
|
55 | + if (!is_file($jsbAbsPath)) { |
|
56 | + throw new \Exception(sprintf('JSB2 file "%1$s" not found', $jsbAbsPath)); |
|
57 | 57 | } |
58 | 58 | |
59 | - $jsb2 = new \Aimeos\MW\Jsb2\Standard( $jsbAbsPath, dirname( $path ) ); |
|
60 | - $cssFiles = array_merge( $cssFiles, $jsb2->getUrls( 'css' ) ); |
|
59 | + $jsb2 = new \Aimeos\MW\Jsb2\Standard($jsbAbsPath, dirname($path)); |
|
60 | + $cssFiles = array_merge($cssFiles, $jsb2->getUrls('css')); |
|
61 | 61 | } |
62 | 62 | } |
63 | 63 | |
64 | - $params = array( 'site' => '{site}', 'lang' => '{lang}', 'tab' => '{tab}' ); |
|
65 | - $adminUrl = $this->generateUrl( 'aimeos_shop_extadm', $params ); |
|
64 | + $params = array('site' => '{site}', 'lang' => '{lang}', 'tab' => '{tab}'); |
|
65 | + $adminUrl = $this->generateUrl('aimeos_shop_extadm', $params); |
|
66 | 66 | |
67 | - $token = $this->get( 'security.csrf.token_manager' )->getToken( 'aimeos_admin_token' )->getValue(); |
|
68 | - $jsonUrl = $this->generateUrl( 'aimeos_shop_extadm_json', array( '_token' => $token, 'site' => $site ) ); |
|
67 | + $token = $this->get('security.csrf.token_manager')->getToken('aimeos_admin_token')->getValue(); |
|
68 | + $jsonUrl = $this->generateUrl('aimeos_shop_extadm_json', array('_token' => $token, 'site' => $site)); |
|
69 | 69 | |
70 | - $jqadmUrl = $this->generateUrl( 'aimeos_shop_jqadm_search', array( 'site' => $site, 'resource' => 'product' ) ); |
|
70 | + $jqadmUrl = $this->generateUrl('aimeos_shop_jqadm_search', array('site' => $site, 'resource' => 'product')); |
|
71 | 71 | |
72 | 72 | $vars = array( |
73 | 73 | 'lang' => $lang, |
74 | 74 | 'cssFiles' => $cssFiles, |
75 | 75 | 'languages' => $this->getJsonLanguages(), |
76 | - 'config' => $this->getJsonClientConfig( $context ), |
|
77 | - 'site' => $this->getJsonSiteItem( $context, $site ), |
|
78 | - 'i18nContent' => $this->getJsonClientI18n( $bootstrap->getI18nPaths(), $lang ), |
|
76 | + 'config' => $this->getJsonClientConfig($context), |
|
77 | + 'site' => $this->getJsonSiteItem($context, $site), |
|
78 | + 'i18nContent' => $this->getJsonClientI18n($bootstrap->getI18nPaths(), $lang), |
|
79 | 79 | 'searchSchemas' => $controller->getJsonSearchSchemas(), |
80 | 80 | 'itemSchemas' => $controller->getJsonItemSchemas(), |
81 | - 'smd' => $controller->getJsonSmd( $jsonUrl ), |
|
82 | - 'urlTemplate' => urldecode( $adminUrl ), |
|
83 | - 'uploaddir' => $this->container->getParameter( 'aimeos_shop.uploaddir' ), |
|
81 | + 'smd' => $controller->getJsonSmd($jsonUrl), |
|
82 | + 'urlTemplate' => urldecode($adminUrl), |
|
83 | + 'uploaddir' => $this->container->getParameter('aimeos_shop.uploaddir'), |
|
84 | 84 | 'version' => $aimeos->getVersion(), |
85 | 85 | 'jqadmurl' => $jqadmUrl, |
86 | 86 | 'activeTab' => $tab, |
87 | 87 | ); |
88 | 88 | |
89 | - return $this->render( 'AimeosShopBundle:Extadm:index.html.twig', $vars ); |
|
89 | + return $this->render('AimeosShopBundle:Extadm:index.html.twig', $vars); |
|
90 | 90 | } |
91 | 91 | |
92 | 92 | |
@@ -96,23 +96,23 @@ discard block |
||
96 | 96 | * @param Request $request Symfony request object |
97 | 97 | * @return Response JSON RPC message response |
98 | 98 | */ |
99 | - public function doAction( Request $request ) |
|
99 | + public function doAction(Request $request) |
|
100 | 100 | { |
101 | 101 | $csrfProvider = $this->get('security.csrf.token_manager'); |
102 | 102 | |
103 | - if( $csrfProvider->isTokenValid( new CsrfToken( 'aimeos_admin_token', $request->query->get( '_token' ) ) ) !== true ) { |
|
104 | - throw new \Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException( 'CSRF token is invalid' ); |
|
103 | + if ($csrfProvider->isTokenValid(new CsrfToken('aimeos_admin_token', $request->query->get('_token'))) !== true) { |
|
104 | + throw new \Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException('CSRF token is invalid'); |
|
105 | 105 | } |
106 | 106 | |
107 | - $cntlPaths = $this->get( 'aimeos' )->get()->getCustomPaths( 'controller/extjs' ); |
|
108 | - $context = $this->get( 'aimeos_context' )->get( false, 'backend' ); |
|
109 | - $context->setView( $this->get( 'aimeos_view' )->create( $context, array() ) ); |
|
110 | - $context->setLocale( $this->get( 'aimeos_locale' )->getBackend( $context, 'default' ) ); |
|
107 | + $cntlPaths = $this->get('aimeos')->get()->getCustomPaths('controller/extjs'); |
|
108 | + $context = $this->get('aimeos_context')->get(false, 'backend'); |
|
109 | + $context->setView($this->get('aimeos_view')->create($context, array())); |
|
110 | + $context->setLocale($this->get('aimeos_locale')->getBackend($context, 'default')); |
|
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( $request->request->all(), $request->getContent() ); |
|
115 | - return $this->render( 'AimeosShopBundle:Extadm:do.html.twig', array( 'output' => $response ) ); |
|
114 | + $response = $controller->process($request->request->all(), $request->getContent()); |
|
115 | + return $this->render('AimeosShopBundle:Extadm:do.html.twig', array('output' => $response)); |
|
116 | 116 | } |
117 | 117 | |
118 | 118 | |
@@ -125,27 +125,27 @@ discard block |
||
125 | 125 | { |
126 | 126 | $contents = ''; |
127 | 127 | $jsFiles = array(); |
128 | - $aimeos = $this->get( 'aimeos' )->get(); |
|
128 | + $aimeos = $this->get('aimeos')->get(); |
|
129 | 129 | |
130 | - foreach( $aimeos->getCustomPaths( 'admin/extjs' ) as $base => $paths ) |
|
130 | + foreach ($aimeos->getCustomPaths('admin/extjs') as $base => $paths) |
|
131 | 131 | { |
132 | - foreach( $paths as $path ) |
|
132 | + foreach ($paths as $path) |
|
133 | 133 | { |
134 | - $jsbAbsPath = $base . '/' . $path; |
|
135 | - $jsb2 = new \Aimeos\MW\Jsb2\Standard( $jsbAbsPath, dirname( $jsbAbsPath ) ); |
|
136 | - $jsFiles = array_merge( $jsFiles, $jsb2->getFiles( 'js' ) ); |
|
134 | + $jsbAbsPath = $base.'/'.$path; |
|
135 | + $jsb2 = new \Aimeos\MW\Jsb2\Standard($jsbAbsPath, dirname($jsbAbsPath)); |
|
136 | + $jsFiles = array_merge($jsFiles, $jsb2->getFiles('js')); |
|
137 | 137 | } |
138 | 138 | } |
139 | 139 | |
140 | - foreach( $jsFiles as $file ) |
|
140 | + foreach ($jsFiles as $file) |
|
141 | 141 | { |
142 | - if( ( $content = file_get_contents( $file ) ) !== false ) { |
|
142 | + if (($content = file_get_contents($file)) !== false) { |
|
143 | 143 | $contents .= $content; |
144 | 144 | } |
145 | 145 | } |
146 | 146 | |
147 | - $response = new Response( $contents ); |
|
148 | - $response->headers->set( 'Content-Type', 'application/javascript' ); |
|
147 | + $response = new Response($contents); |
|
148 | + $response->headers->set('Content-Type', 'application/javascript'); |
|
149 | 149 | |
150 | 150 | return $response; |
151 | 151 | } |
@@ -160,11 +160,11 @@ discard block |
||
160 | 160 | { |
161 | 161 | $result = array(); |
162 | 162 | |
163 | - foreach( $this->get( 'aimeos' )->get()->getI18nList( 'admin' ) as $id ) { |
|
164 | - $result[] = array( 'id' => $id, 'label' => $id ); |
|
163 | + foreach ($this->get('aimeos')->get()->getI18nList('admin') as $id) { |
|
164 | + $result[] = array('id' => $id, 'label' => $id); |
|
165 | 165 | } |
166 | 166 | |
167 | - return json_encode( $result ); |
|
167 | + return json_encode($result); |
|
168 | 168 | } |
169 | 169 | |
170 | 170 | |
@@ -174,10 +174,10 @@ discard block |
||
174 | 174 | * @param \Aimeos\MShop\Context\Item\Iface $context Context item object |
175 | 175 | * @return string JSON encoded configuration object |
176 | 176 | */ |
177 | - protected function getJsonClientConfig( \Aimeos\MShop\Context\Item\Iface $context ) |
|
177 | + protected function getJsonClientConfig(\Aimeos\MShop\Context\Item\Iface $context) |
|
178 | 178 | { |
179 | - $config = $context->getConfig()->get( 'admin/extjs', array() ); |
|
180 | - return json_encode( array( 'admin' => array( 'extjs' => $config ) ), JSON_FORCE_OBJECT ); |
|
179 | + $config = $context->getConfig()->get('admin/extjs', array()); |
|
180 | + return json_encode(array('admin' => array('extjs' => $config)), JSON_FORCE_OBJECT); |
|
181 | 181 | } |
182 | 182 | |
183 | 183 | |
@@ -188,16 +188,16 @@ discard block |
||
188 | 188 | * @param string $lang ISO language code like "en" or "en_GB" |
189 | 189 | * @return string JSON encoded translation object |
190 | 190 | */ |
191 | - protected function getJsonClientI18n( array $i18nPaths, $lang ) |
|
191 | + protected function getJsonClientI18n(array $i18nPaths, $lang) |
|
192 | 192 | { |
193 | - $i18n = new \Aimeos\MW\Translation\Gettext( $i18nPaths, $lang ); |
|
193 | + $i18n = new \Aimeos\MW\Translation\Gettext($i18nPaths, $lang); |
|
194 | 194 | |
195 | 195 | $content = array( |
196 | - 'admin' => $i18n->getAll( 'admin' ), |
|
197 | - 'admin/ext' => $i18n->getAll( 'admin/ext' ), |
|
196 | + 'admin' => $i18n->getAll('admin'), |
|
197 | + 'admin/ext' => $i18n->getAll('admin/ext'), |
|
198 | 198 | ); |
199 | 199 | |
200 | - return json_encode( $content, JSON_FORCE_OBJECT ); |
|
200 | + return json_encode($content, JSON_FORCE_OBJECT); |
|
201 | 201 | } |
202 | 202 | |
203 | 203 | |
@@ -209,18 +209,18 @@ discard block |
||
209 | 209 | * @return string JSON encoded site item object |
210 | 210 | * @throws Exception If no site item was found for the code |
211 | 211 | */ |
212 | - protected function getJsonSiteItem( \Aimeos\MShop\Context\Item\Iface $context, $site ) |
|
212 | + protected function getJsonSiteItem(\Aimeos\MShop\Context\Item\Iface $context, $site) |
|
213 | 213 | { |
214 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'locale/site' ); |
|
214 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'locale/site'); |
|
215 | 215 | |
216 | 216 | $criteria = $manager->createSearch(); |
217 | - $criteria->setConditions( $criteria->compare( '==', 'locale.site.code', $site ) ); |
|
218 | - $items = $manager->searchItems( $criteria ); |
|
217 | + $criteria->setConditions($criteria->compare('==', 'locale.site.code', $site)); |
|
218 | + $items = $manager->searchItems($criteria); |
|
219 | 219 | |
220 | - if( ( $item = reset( $items ) ) === false ) { |
|
221 | - throw new \Exception( sprintf( 'No site found for code "%1$s"', $site ) ); |
|
220 | + if (($item = reset($items)) === false) { |
|
221 | + throw new \Exception(sprintf('No site found for code "%1$s"', $site)); |
|
222 | 222 | } |
223 | 223 | |
224 | - return json_encode( $item->toArray() ); |
|
224 | + return json_encode($item->toArray()); |
|
225 | 225 | } |
226 | 226 | } |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | * |
30 | 30 | * @param Container $container Container object to access parameters |
31 | 31 | */ |
32 | - public function __construct( Container $container ) |
|
32 | + public function __construct(Container $container) |
|
33 | 33 | { |
34 | 34 | $this->container = $container; |
35 | 35 | } |
@@ -41,27 +41,27 @@ discard block |
||
41 | 41 | * @param array $languageIds List of two letter ISO language IDs |
42 | 42 | * @return \Aimeos\MW\Translation\Interface[] List of translation objects |
43 | 43 | */ |
44 | - public function get( array $languageIds ) |
|
44 | + public function get(array $languageIds) |
|
45 | 45 | { |
46 | - $i18nPaths = $this->container->get( 'aimeos' )->get()->getI18nPaths(); |
|
46 | + $i18nPaths = $this->container->get('aimeos')->get()->getI18nPaths(); |
|
47 | 47 | |
48 | - foreach( $languageIds as $langid ) |
|
48 | + foreach ($languageIds as $langid) |
|
49 | 49 | { |
50 | - if( !isset( $this->i18n[$langid] ) ) |
|
50 | + if (!isset($this->i18n[$langid])) |
|
51 | 51 | { |
52 | - $i18n = new \Aimeos\MW\Translation\Gettext( $i18nPaths, $langid ); |
|
52 | + $i18n = new \Aimeos\MW\Translation\Gettext($i18nPaths, $langid); |
|
53 | 53 | |
54 | - $apc = (bool) $this->container->getParameter( 'aimeos_shop.apc_enable' ); |
|
55 | - $prefix = $this->container->getParameter( 'aimeos_shop.apc_prefix' ); |
|
54 | + $apc = (bool) $this->container->getParameter('aimeos_shop.apc_enable'); |
|
55 | + $prefix = $this->container->getParameter('aimeos_shop.apc_prefix'); |
|
56 | 56 | |
57 | - if( function_exists( 'apc_store' ) === true && $apc === true ) { |
|
58 | - $i18n = new \Aimeos\MW\Translation\Decorator\APC( $i18n, $prefix ); |
|
57 | + if (function_exists('apc_store') === true && $apc === true) { |
|
58 | + $i18n = new \Aimeos\MW\Translation\Decorator\APC($i18n, $prefix); |
|
59 | 59 | } |
60 | 60 | |
61 | - $translations = $this->container->getParameter( 'aimeos_shop.i18n' ); |
|
61 | + $translations = $this->container->getParameter('aimeos_shop.i18n'); |
|
62 | 62 | |
63 | - if( isset( $translations[$langid] ) ) { |
|
64 | - $i18n = new \Aimeos\MW\Translation\Decorator\Memory( $i18n, $translations[$langid] ); |
|
63 | + if (isset($translations[$langid])) { |
|
64 | + $i18n = new \Aimeos\MW\Translation\Decorator\Memory($i18n, $translations[$langid]); |
|
65 | 65 | } |
66 | 66 | |
67 | 67 | $this->i18n[$langid] = $i18n; |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | * |
30 | 30 | * @param Container $container Container object to access parameters |
31 | 31 | */ |
32 | - public function __construct( Container $container ) |
|
32 | + public function __construct(Container $container) |
|
33 | 33 | { |
34 | 34 | $this->container = $container; |
35 | 35 | } |
@@ -42,10 +42,10 @@ discard block |
||
42 | 42 | */ |
43 | 43 | public function get() |
44 | 44 | { |
45 | - if( $this->object === null ) |
|
45 | + if ($this->object === null) |
|
46 | 46 | { |
47 | - $extDirs = (array) $this->container->getParameter( 'aimeos_shop.extdir' ); |
|
48 | - $this->object = new \Aimeos\Bootstrap( $extDirs, false ); |
|
47 | + $extDirs = (array) $this->container->getParameter('aimeos_shop.extdir'); |
|
48 | + $this->object = new \Aimeos\Bootstrap($extDirs, false); |
|
49 | 49 | } |
50 | 50 | |
51 | 51 | return $this->object; |
@@ -59,14 +59,14 @@ discard block |
||
59 | 59 | */ |
60 | 60 | public function getVersion() |
61 | 61 | { |
62 | - $filename = dirname( $this->container->get( 'kernel' )->getRootDir() ) . DIRECTORY_SEPARATOR . 'composer.lock'; |
|
62 | + $filename = dirname($this->container->get('kernel')->getRootDir()).DIRECTORY_SEPARATOR.'composer.lock'; |
|
63 | 63 | |
64 | - if( file_exists( $filename ) === true && ( $content = file_get_contents( $filename ) ) !== false |
|
65 | - && ( $content = json_decode( $content, true ) ) !== null && isset( $content['packages'] ) |
|
64 | + if (file_exists($filename) === true && ($content = file_get_contents($filename)) !== false |
|
65 | + && ($content = json_decode($content, true)) !== null && isset($content['packages']) |
|
66 | 66 | ) { |
67 | - foreach( (array) $content['packages'] as $item ) |
|
67 | + foreach ((array) $content['packages'] as $item) |
|
68 | 68 | { |
69 | - if( $item['name'] === 'aimeos/aimeos-symfony' ) { |
|
69 | + if ($item['name'] === 'aimeos/aimeos-symfony') { |
|
70 | 70 | return $item['version']; |
71 | 71 | } |
72 | 72 | } |
@@ -31,21 +31,21 @@ discard block |
||
31 | 31 | /** |
32 | 32 | * {@inheritDoc} |
33 | 33 | */ |
34 | - public function load( array $configs, ContainerBuilder $container ) |
|
34 | + public function load(array $configs, ContainerBuilder $container) |
|
35 | 35 | { |
36 | 36 | $configuration = new Configuration(); |
37 | - $config = $this->processConfiguration( $configuration, $configs ); |
|
37 | + $config = $this->processConfiguration($configuration, $configs); |
|
38 | 38 | |
39 | - foreach( $configs as $list ) { |
|
40 | - $this->merge( $config, $list ); |
|
39 | + foreach ($configs as $list) { |
|
40 | + $this->merge($config, $list); |
|
41 | 41 | } |
42 | 42 | |
43 | - foreach( $config as $key => $value ) { |
|
44 | - $container->setParameter( 'aimeos_shop.' . $key, $value ); |
|
43 | + foreach ($config as $key => $value) { |
|
44 | + $container->setParameter('aimeos_shop.'.$key, $value); |
|
45 | 45 | } |
46 | 46 | |
47 | - $loader = new Loader\YamlFileLoader( $container, new FileLocator( dirname( __DIR__ ) . '/Resources/config' ) ); |
|
48 | - $loader->load( 'services.yml' ); |
|
47 | + $loader = new Loader\YamlFileLoader($container, new FileLocator(dirname(__DIR__).'/Resources/config')); |
|
48 | + $loader->load('services.yml'); |
|
49 | 49 | } |
50 | 50 | |
51 | 51 | |
@@ -54,13 +54,13 @@ discard block |
||
54 | 54 | * |
55 | 55 | * @param ContainerBuilder $container ContainerBuilder object |
56 | 56 | */ |
57 | - public function prepend( ContainerBuilder $container ) |
|
57 | + public function prepend(ContainerBuilder $container) |
|
58 | 58 | { |
59 | - $configFile = dirname( __DIR__ ) . '/Resources/config/aimeos_shop.yml'; |
|
60 | - $config = Yaml::parse( file_get_contents( $configFile ) ); |
|
59 | + $configFile = dirname(__DIR__).'/Resources/config/aimeos_shop.yml'; |
|
60 | + $config = Yaml::parse(file_get_contents($configFile)); |
|
61 | 61 | |
62 | - $container->prependExtensionConfig( 'aimeos_shop', $config ); |
|
63 | - $container->addResource( new FileResource( $configFile ) ); |
|
62 | + $container->prependExtensionConfig('aimeos_shop', $config); |
|
63 | + $container->addResource(new FileResource($configFile)); |
|
64 | 64 | } |
65 | 65 | |
66 | 66 | |
@@ -70,15 +70,15 @@ discard block |
||
70 | 70 | * @param array &$original Associative list of original values |
71 | 71 | * @param array $overrule Associative list of new values |
72 | 72 | */ |
73 | - protected function merge( array &$original, array $overrule ) |
|
73 | + protected function merge(array &$original, array $overrule) |
|
74 | 74 | { |
75 | - foreach( array_keys( $overrule ) as $key ) |
|
75 | + foreach (array_keys($overrule) as $key) |
|
76 | 76 | { |
77 | - if( isset( $original[$key] ) && is_array( $original[$key] ) ) { |
|
78 | - if( is_array( $overrule[$key] ) ) { |
|
79 | - $this->merge( $original[$key], $overrule[$key] ); |
|
77 | + if (isset($original[$key]) && is_array($original[$key])) { |
|
78 | + if (is_array($overrule[$key])) { |
|
79 | + $this->merge($original[$key], $overrule[$key]); |
|
80 | 80 | } |
81 | - } elseif( isset( $overrule[$key] ) ) { |
|
81 | + } elseif (isset($overrule[$key])) { |
|
82 | 82 | $original[$key] = $overrule[$key]; |
83 | 83 | } |
84 | 84 | } |
@@ -28,9 +28,9 @@ discard block |
||
28 | 28 | /** |
29 | 29 | * {@inheritdoc} |
30 | 30 | */ |
31 | - public function registerContainerConfiguration( LoaderInterface $loader ) |
|
31 | + public function registerContainerConfiguration(LoaderInterface $loader) |
|
32 | 32 | { |
33 | - $loader->load( __DIR__ . '/config/config.yml' ); |
|
33 | + $loader->load(__DIR__.'/config/config.yml'); |
|
34 | 34 | } |
35 | 35 | |
36 | 36 | |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | */ |
40 | 40 | public function getCacheDir() |
41 | 41 | { |
42 | - return sys_get_temp_dir() . '/aimeos-symfony2/cache'; |
|
42 | + return sys_get_temp_dir().'/aimeos-symfony2/cache'; |
|
43 | 43 | } |
44 | 44 | |
45 | 45 | |
@@ -48,6 +48,6 @@ discard block |
||
48 | 48 | */ |
49 | 49 | public function getLogDir() |
50 | 50 | { |
51 | - return sys_get_temp_dir() . '/aimeos-symfony2/logs'; |
|
51 | + return sys_get_temp_dir().'/aimeos-symfony2/logs'; |
|
52 | 52 | } |
53 | 53 | } |
@@ -3,24 +3,24 @@ discard block |
||
3 | 3 | use Doctrine\Common\Annotations\AnnotationRegistry; |
4 | 4 | |
5 | 5 | |
6 | -setlocale( LC_ALL, 'en_US.UTF-8' ); |
|
6 | +setlocale(LC_ALL, 'en_US.UTF-8'); |
|
7 | 7 | |
8 | 8 | // if the bundle is within a symfony project, try to reuse the project's autoload |
9 | 9 | $files = array( |
10 | - __DIR__ . '/../vendor/autoload.php', |
|
11 | - __DIR__ . '/../../vendor/autoload.php', |
|
10 | + __DIR__.'/../vendor/autoload.php', |
|
11 | + __DIR__.'/../../vendor/autoload.php', |
|
12 | 12 | ); |
13 | 13 | |
14 | 14 | $autoload = false; |
15 | -foreach( $files as $file ) |
|
15 | +foreach ($files as $file) |
|
16 | 16 | { |
17 | - if( is_file( $file ) ) { |
|
17 | + if (is_file($file)) { |
|
18 | 18 | $autoload = include_once $file; |
19 | 19 | break; |
20 | 20 | } |
21 | 21 | } |
22 | 22 | |
23 | -if( !$autoload ) |
|
23 | +if (!$autoload) |
|
24 | 24 | { |
25 | 25 | exit( |
26 | 26 | "Unable to find autoload.php file, please use composer to load dependencies: |
@@ -30,4 +30,4 @@ discard block |
||
30 | 30 | ); |
31 | 31 | } |
32 | 32 | |
33 | -AnnotationRegistry::registerLoader( array( $autoload, 'loadClass' ) ); |
|
33 | +AnnotationRegistry::registerLoader(array($autoload, 'loadClass')); |
@@ -12,12 +12,12 @@ discard block |
||
12 | 12 | $client = static::createClient(array(), array( |
13 | 13 | 'PHP_AUTH_USER' => 'admin', |
14 | 14 | 'PHP_AUTH_PW' => 'adminpass', |
15 | - ) ); |
|
16 | - $crawler = $client->request( 'GET', '/unittest/extadm/de/0' ); |
|
15 | + )); |
|
16 | + $crawler = $client->request('GET', '/unittest/extadm/de/0'); |
|
17 | 17 | |
18 | - $this->assertEquals( 200, $client->getResponse()->getStatusCode() ); |
|
19 | - $this->assertEquals( 1, $crawler->filter( 'head:contains("/{site}/extadm/{lang}/{tab}")' )->count() ); |
|
20 | - $this->assertEquals( 1, $crawler->filter( 'body:contains("You need to enable javascript!")' )->count() ); |
|
18 | + $this->assertEquals(200, $client->getResponse()->getStatusCode()); |
|
19 | + $this->assertEquals(1, $crawler->filter('head:contains("/{site}/extadm/{lang}/{tab}")')->count()); |
|
20 | + $this->assertEquals(1, $crawler->filter('body:contains("You need to enable javascript!")')->count()); |
|
21 | 21 | } |
22 | 22 | |
23 | 23 | |
@@ -26,17 +26,17 @@ discard block |
||
26 | 26 | $client = static::createClient(array(), array( |
27 | 27 | 'PHP_AUTH_USER' => 'admin', |
28 | 28 | 'PHP_AUTH_PW' => 'adminpass', |
29 | - ) ); |
|
29 | + )); |
|
30 | 30 | |
31 | - $token = $client->getContainer()->get( 'security.csrf.token_manager' )->getToken( 'aimeos_admin_token' ); |
|
31 | + $token = $client->getContainer()->get('security.csrf.token_manager')->getToken('aimeos_admin_token'); |
|
32 | 32 | |
33 | - $client->request( 'POST', '/unittest/extadm/do?_token=' . $token->getValue(), |
|
33 | + $client->request('POST', '/unittest/extadm/do?_token='.$token->getValue(), |
|
34 | 34 | array(), array(), array('CONTENT_TYPE' => 'application/json'), |
35 | 35 | '[{"jsonrpc":"2.0","method":"Product_Type.searchItems","params":{"site":"unittest"},"id":2}]' |
36 | 36 | ); |
37 | 37 | |
38 | - $this->assertEquals( 200, $client->getResponse()->getStatusCode() ); |
|
39 | - $this->assertStringStartsWith( '[{', $client->getResponse()->getContent() ); |
|
38 | + $this->assertEquals(200, $client->getResponse()->getStatusCode()); |
|
39 | + $this->assertStringStartsWith('[{', $client->getResponse()->getContent()); |
|
40 | 40 | } |
41 | 41 | |
42 | 42 | |
@@ -45,11 +45,11 @@ discard block |
||
45 | 45 | $client = static::createClient(array(), array( |
46 | 46 | 'PHP_AUTH_USER' => 'admin', |
47 | 47 | 'PHP_AUTH_PW' => 'adminpass', |
48 | - ) ); |
|
48 | + )); |
|
49 | 49 | |
50 | - $client->request( 'GET', '/unittest/extadm/file' ); |
|
50 | + $client->request('GET', '/unittest/extadm/file'); |
|
51 | 51 | |
52 | - $this->assertEquals( 200, $client->getResponse()->getStatusCode() ); |
|
53 | - $this->assertContains( 'Ext.', $client->getResponse()->getContent() ); |
|
52 | + $this->assertEquals(200, $client->getResponse()->getStatusCode()); |
|
53 | + $this->assertContains('Ext.', $client->getResponse()->getContent()); |
|
54 | 54 | } |
55 | 55 | } |
@@ -149,7 +149,7 @@ |
||
149 | 149 | * @param string $site Unique site code |
150 | 150 | * @param string Resource location, e.g. "product/stock/wareshouse" |
151 | 151 | * @param string $lang Language code |
152 | - * @return \Aimeos\MShop\Context\Item\Iface Context item |
|
152 | + * @return \Aimeos\Admin\JsonAdm\Iface Context item |
|
153 | 153 | */ |
154 | 154 | protected function createClient( $site, $resource, $lang ) |
155 | 155 | { |
@@ -31,10 +31,10 @@ discard block |
||
31 | 31 | * @param string $site Unique site code |
32 | 32 | * @return \Psr\Http\Message\ResponseInterface Response object containing the generated output |
33 | 33 | */ |
34 | - public function deleteAction( ServerRequestInterface $request, $resource, $site = 'default' ) |
|
34 | + public function deleteAction(ServerRequestInterface $request, $resource, $site = 'default') |
|
35 | 35 | { |
36 | - $client = $this->createClient( $site, $resource, $request->getAttribute( 'lang', 'en' ) ); |
|
37 | - return $client->delete( $request, new Response() ); |
|
36 | + $client = $this->createClient($site, $resource, $request->getAttribute('lang', 'en')); |
|
37 | + return $client->delete($request, new Response()); |
|
38 | 38 | } |
39 | 39 | |
40 | 40 | |
@@ -46,10 +46,10 @@ discard block |
||
46 | 46 | * @param string $site Unique site code |
47 | 47 | * @return \Psr\Http\Message\ResponseInterface Response object containing the generated output |
48 | 48 | */ |
49 | - public function getAction( ServerRequestInterface $request, $resource, $site = 'default' ) |
|
49 | + public function getAction(ServerRequestInterface $request, $resource, $site = 'default') |
|
50 | 50 | { |
51 | - $client = $this->createClient( $site, $resource, $request->getAttribute( 'lang', 'en' ) ); |
|
52 | - return $client->get( $request, new Response() ); |
|
51 | + $client = $this->createClient($site, $resource, $request->getAttribute('lang', 'en')); |
|
52 | + return $client->get($request, new Response()); |
|
53 | 53 | } |
54 | 54 | |
55 | 55 | |
@@ -61,10 +61,10 @@ discard block |
||
61 | 61 | * @param string $site Unique site code |
62 | 62 | * @return \Psr\Http\Message\ResponseInterface Response object containing the generated output |
63 | 63 | */ |
64 | - public function patchAction( ServerRequestInterface $request, $resource, $site = 'default' ) |
|
64 | + public function patchAction(ServerRequestInterface $request, $resource, $site = 'default') |
|
65 | 65 | { |
66 | - $client = $this->createClient( $site, $resource, $request->getAttribute( 'lang', 'en' ) ); |
|
67 | - return $client->patch( $request, new Response() ); |
|
66 | + $client = $this->createClient($site, $resource, $request->getAttribute('lang', 'en')); |
|
67 | + return $client->patch($request, new Response()); |
|
68 | 68 | } |
69 | 69 | |
70 | 70 | |
@@ -76,10 +76,10 @@ discard block |
||
76 | 76 | * @param string $site Unique site code |
77 | 77 | * @return \Psr\Http\Message\ResponseInterface Response object containing the generated output |
78 | 78 | */ |
79 | - public function postAction( ServerRequestInterface $request, $resource, $site = 'default' ) |
|
79 | + public function postAction(ServerRequestInterface $request, $resource, $site = 'default') |
|
80 | 80 | { |
81 | - $client = $this->createClient( $site, $resource, $request->getAttribute( 'lang', 'en' ) ); |
|
82 | - return $client->post( $request, new Response() ); |
|
81 | + $client = $this->createClient($site, $resource, $request->getAttribute('lang', 'en')); |
|
82 | + return $client->post($request, new Response()); |
|
83 | 83 | } |
84 | 84 | |
85 | 85 | |
@@ -91,10 +91,10 @@ discard block |
||
91 | 91 | * @param string $site Unique site code |
92 | 92 | * @return \Psr\Http\Message\ResponseInterface Response object containing the generated output |
93 | 93 | */ |
94 | - public function putAction( ServerRequestInterface $request, $resource, $site = 'default' ) |
|
94 | + public function putAction(ServerRequestInterface $request, $resource, $site = 'default') |
|
95 | 95 | { |
96 | - $client = $this->createClient( $site, $resource, $request->getAttribute( 'lang', 'en' ) ); |
|
97 | - return $client->put( $request, new Response() ); |
|
96 | + $client = $this->createClient($site, $resource, $request->getAttribute('lang', 'en')); |
|
97 | + return $client->put($request, new Response()); |
|
98 | 98 | } |
99 | 99 | |
100 | 100 | |
@@ -106,10 +106,10 @@ discard block |
||
106 | 106 | * @param string $site Unique site code |
107 | 107 | * @return \Psr\Http\Message\ResponseInterface Response object containing the generated output |
108 | 108 | */ |
109 | - public function optionsAction( ServerRequestInterface $request, $resource = '', $site = 'default' ) |
|
109 | + public function optionsAction(ServerRequestInterface $request, $resource = '', $site = 'default') |
|
110 | 110 | { |
111 | - $client = $this->createClient( $site, $resource, $request->getAttribute( 'lang', 'en' ) ); |
|
112 | - return $client->options( $request, new Response() ); |
|
111 | + $client = $this->createClient($site, $resource, $request->getAttribute('lang', 'en')); |
|
112 | + return $client->options($request, new Response()); |
|
113 | 113 | } |
114 | 114 | |
115 | 115 | |
@@ -121,18 +121,18 @@ discard block |
||
121 | 121 | * @param string $lang Language code |
122 | 122 | * @return \Aimeos\MShop\Context\Item\Iface Context item |
123 | 123 | */ |
124 | - protected function createClient( $site, $resource, $lang ) |
|
124 | + protected function createClient($site, $resource, $lang) |
|
125 | 125 | { |
126 | - $aimeos = $this->get( 'aimeos' )->get(); |
|
127 | - $templatePaths = $aimeos->getCustomPaths( 'admin/jsonadm/templates' ); |
|
126 | + $aimeos = $this->get('aimeos')->get(); |
|
127 | + $templatePaths = $aimeos->getCustomPaths('admin/jsonadm/templates'); |
|
128 | 128 | |
129 | - $context = $this->get( 'aimeos_context' )->get( false, 'backend' ); |
|
130 | - $context->setI18n( $this->get('aimeos_i18n')->get( array( $lang, 'en' ) ) ); |
|
131 | - $context->setLocale( $this->get('aimeos_locale')->getBackend( $context, $site ) ); |
|
129 | + $context = $this->get('aimeos_context')->get(false, 'backend'); |
|
130 | + $context->setI18n($this->get('aimeos_i18n')->get(array($lang, 'en'))); |
|
131 | + $context->setLocale($this->get('aimeos_locale')->getBackend($context, $site)); |
|
132 | 132 | |
133 | - $view = $this->get('aimeos_view')->create( $context, $templatePaths, $lang ); |
|
134 | - $context->setView( $view ); |
|
133 | + $view = $this->get('aimeos_view')->create($context, $templatePaths, $lang); |
|
134 | + $context->setView($view); |
|
135 | 135 | |
136 | - return \Aimeos\Admin\JsonAdm\Factory::createClient( $context, $templatePaths, $resource ); |
|
136 | + return \Aimeos\Admin\JsonAdm\Factory::createClient($context, $templatePaths, $resource); |
|
137 | 137 | } |
138 | 138 | } |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | * |
29 | 29 | * @param Container $container Container object to access parameters |
30 | 30 | */ |
31 | - public function __construct( Container $container ) |
|
31 | + public function __construct(Container $container) |
|
32 | 32 | { |
33 | 33 | $this->container = $container; |
34 | 34 | } |
@@ -40,23 +40,23 @@ discard block |
||
40 | 40 | * @param string $pageName Name of the configured page |
41 | 41 | * @return array Associative list with body and header output separated by client name |
42 | 42 | */ |
43 | - public function getSections( $pageName ) |
|
43 | + public function getSections($pageName) |
|
44 | 44 | { |
45 | 45 | $context = $this->container->get('aimeos_context')->get(); |
46 | - $pagesConfig = $this->container->getParameter( 'aimeos_shop.page' ); |
|
47 | - $result = array( 'aibody' => array(), 'aiheader' => array() ); |
|
46 | + $pagesConfig = $this->container->getParameter('aimeos_shop.page'); |
|
47 | + $result = array('aibody' => array(), 'aiheader' => array()); |
|
48 | 48 | |
49 | 49 | $langid = $context->getLocale()->getLanguageId(); |
50 | - $tmplPaths = $this->container->get('aimeos')->get()->getCustomPaths( 'client/html/templates' ); |
|
51 | - $view = $this->container->get('aimeos_view')->create( $context, $tmplPaths, $langid ); |
|
52 | - $context->setView( $view ); |
|
50 | + $tmplPaths = $this->container->get('aimeos')->get()->getCustomPaths('client/html/templates'); |
|
51 | + $view = $this->container->get('aimeos_view')->create($context, $tmplPaths, $langid); |
|
52 | + $context->setView($view); |
|
53 | 53 | |
54 | - if( isset( $pagesConfig[$pageName] ) ) |
|
54 | + if (isset($pagesConfig[$pageName])) |
|
55 | 55 | { |
56 | - foreach( (array) $pagesConfig[$pageName] as $clientName ) |
|
56 | + foreach ((array) $pagesConfig[$pageName] as $clientName) |
|
57 | 57 | { |
58 | - $client = \Aimeos\Client\Html\Factory::createClient( $context, $tmplPaths, $clientName ); |
|
59 | - $client->setView( clone $view ); |
|
58 | + $client = \Aimeos\Client\Html\Factory::createClient($context, $tmplPaths, $clientName); |
|
59 | + $client->setView(clone $view); |
|
60 | 60 | $client->process(); |
61 | 61 | |
62 | 62 | $result['aibody'][$clientName] = $client->getBody(); |