@@ -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 | } |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | * @param RequestStack $requestStack Current request stack |
35 | 35 | * @param Container $container Container object to access parameters |
36 | 36 | */ |
37 | - public function __construct( RequestStack $requestStack, Container $container ) |
|
37 | + public function __construct(RequestStack $requestStack, Container $container) |
|
38 | 38 | { |
39 | 39 | $this->requestStack = $requestStack; |
40 | 40 | $this->container = $container; |
@@ -47,52 +47,52 @@ discard block |
||
47 | 47 | * @param boolean $locale True to add locale object to context, false if not |
48 | 48 | * @return \Aimeos\MShop\Context\Item\Iface Context object |
49 | 49 | */ |
50 | - public function get( $locale = true ) |
|
50 | + public function get($locale = true) |
|
51 | 51 | { |
52 | - if( self::$context === null ) |
|
52 | + if (self::$context === null) |
|
53 | 53 | { |
54 | 54 | $context = new \Aimeos\MShop\Context\Item\Standard(); |
55 | 55 | |
56 | 56 | $config = $this->getConfig(); |
57 | - $context->setConfig( $config ); |
|
57 | + $context->setConfig($config); |
|
58 | 58 | |
59 | - $dbm = new \Aimeos\MW\DB\Manager\DBAL( $config ); |
|
60 | - $context->setDatabaseManager( $dbm ); |
|
59 | + $dbm = new \Aimeos\MW\DB\Manager\DBAL($config); |
|
60 | + $context->setDatabaseManager($dbm); |
|
61 | 61 | |
62 | - $fs = new \Aimeos\MW\Filesystem\Manager\Standard( $config ); |
|
63 | - $context->setFilesystemManager( $fs ); |
|
62 | + $fs = new \Aimeos\MW\Filesystem\Manager\Standard($config); |
|
63 | + $context->setFilesystemManager($fs); |
|
64 | 64 | |
65 | - $mq = new \Aimeos\MW\MQueue\Manager\Standard( $config ); |
|
66 | - $context->setMessageQueueManager( $mq ); |
|
65 | + $mq = new \Aimeos\MW\MQueue\Manager\Standard($config); |
|
66 | + $context->setMessageQueueManager($mq); |
|
67 | 67 | |
68 | 68 | $container = $this->container; |
69 | - $mail = new \Aimeos\MW\Mail\Swift( function() use ( $container) { return $container->get( 'mailer' ); } ); |
|
70 | - $context->setMail( $mail ); |
|
69 | + $mail = new \Aimeos\MW\Mail\Swift(function() use ($container) { return $container->get('mailer'); } ); |
|
70 | + $context->setMail($mail); |
|
71 | 71 | |
72 | - $logger = \Aimeos\MAdmin\Log\Manager\Factory::createManager( $context ); |
|
73 | - $context->setLogger( $logger ); |
|
72 | + $logger = \Aimeos\MAdmin\Log\Manager\Factory::createManager($context); |
|
73 | + $context->setLogger($logger); |
|
74 | 74 | |
75 | - $cache = new \Aimeos\MAdmin\Cache\Proxy\Standard( $context ); |
|
76 | - $context->setCache( $cache ); |
|
75 | + $cache = new \Aimeos\MAdmin\Cache\Proxy\Standard($context); |
|
76 | + $context->setCache($cache); |
|
77 | 77 | |
78 | 78 | self::$context = $context; |
79 | 79 | } |
80 | 80 | |
81 | 81 | $context = self::$context; |
82 | 82 | |
83 | - if( $locale === true ) |
|
83 | + if ($locale === true) |
|
84 | 84 | { |
85 | - $localeItem = $this->getLocale( $context ); |
|
85 | + $localeItem = $this->getLocale($context); |
|
86 | 86 | $langid = $localeItem->getLanguageId(); |
87 | 87 | |
88 | - $context->setLocale( $localeItem ); |
|
89 | - $context->setI18n( $this->container->get('aimeos_i18n')->get( array( $langid ) ) ); |
|
88 | + $context->setLocale($localeItem); |
|
89 | + $context->setI18n($this->container->get('aimeos_i18n')->get(array($langid))); |
|
90 | 90 | } |
91 | 91 | |
92 | - $session = new \Aimeos\MW\Session\Symfony2( $this->container->get( 'session' ) ); |
|
93 | - $context->setSession( $session ); |
|
92 | + $session = new \Aimeos\MW\Session\Symfony2($this->container->get('session')); |
|
93 | + $context->setSession($session); |
|
94 | 94 | |
95 | - $this->addUser( $context ); |
|
95 | + $this->addUser($context); |
|
96 | 96 | |
97 | 97 | return $context; |
98 | 98 | } |
@@ -103,39 +103,39 @@ discard block |
||
103 | 103 | * |
104 | 104 | * @param \Aimeos\MShop\Context\Item\Iface $context Context object |
105 | 105 | */ |
106 | - protected function addUser( \Aimeos\MShop\Context\Item\Iface $context ) |
|
106 | + protected function addUser(\Aimeos\MShop\Context\Item\Iface $context) |
|
107 | 107 | { |
108 | 108 | $token = null; |
109 | 109 | $username = ''; |
110 | 110 | |
111 | - if( $this->container->has( 'security.token_storage' ) ) { |
|
112 | - $token = $this->container->get( 'security.token_storage' )->getToken(); |
|
111 | + if ($this->container->has('security.token_storage')) { |
|
112 | + $token = $this->container->get('security.token_storage')->getToken(); |
|
113 | 113 | } |
114 | - else if( $this->container->has( 'security.context' ) ) { |
|
115 | - $token = $this->container->get( 'security.context' )->getToken(); |
|
114 | + else if ($this->container->has('security.context')) { |
|
115 | + $token = $this->container->get('security.context')->getToken(); |
|
116 | 116 | } |
117 | 117 | |
118 | - if( is_object( $token ) ) |
|
118 | + if (is_object($token)) |
|
119 | 119 | { |
120 | - if( method_exists( $token->getUser(), 'getId' ) ) |
|
120 | + if (method_exists($token->getUser(), 'getId')) |
|
121 | 121 | { |
122 | 122 | $userid = $token->getUser()->getId(); |
123 | - $context->setUserId( $userid ); |
|
124 | - $context->setGroupIds( function() use ( $context, $userid ) |
|
123 | + $context->setUserId($userid); |
|
124 | + $context->setGroupIds(function() use ($context, $userid) |
|
125 | 125 | { |
126 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'customer' ); |
|
127 | - return $manager->getItem( $userid, array( 'customer/group' ) )->getGroups(); |
|
126 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'customer'); |
|
127 | + return $manager->getItem($userid, array('customer/group'))->getGroups(); |
|
128 | 128 | } ); |
129 | 129 | } |
130 | 130 | |
131 | - if( is_object( $token->getUser() ) ) { |
|
132 | - $username = $token->getUser()->getUsername(); |
|
131 | + if (is_object($token->getUser())) { |
|
132 | + $username = $token->getUser()->getUsername(); |
|
133 | 133 | } else { |
134 | 134 | $username = $token->getUser(); |
135 | 135 | } |
136 | 136 | } |
137 | 137 | |
138 | - $context->setEditor( $username ); |
|
138 | + $context->setEditor($username); |
|
139 | 139 | } |
140 | 140 | |
141 | 141 | |
@@ -148,25 +148,25 @@ discard block |
||
148 | 148 | { |
149 | 149 | $configPaths = $this->container->get('aimeos')->get()->getConfigPaths(); |
150 | 150 | |
151 | - $conf = new \Aimeos\MW\Config\PHPArray( array(), $configPaths ); |
|
151 | + $conf = new \Aimeos\MW\Config\PHPArray(array(), $configPaths); |
|
152 | 152 | |
153 | - $apc = (bool) $this->container->getParameter( 'aimeos_shop.apc_enable' ); |
|
154 | - $prefix = $this->container->getParameter( 'aimeos_shop.apc_prefix' ); |
|
153 | + $apc = (bool) $this->container->getParameter('aimeos_shop.apc_enable'); |
|
154 | + $prefix = $this->container->getParameter('aimeos_shop.apc_prefix'); |
|
155 | 155 | |
156 | - if( function_exists( 'apc_store' ) === true && $apc === true ) { |
|
157 | - $conf = new \Aimeos\MW\Config\Decorator\APC( $conf, $prefix ); |
|
156 | + if (function_exists('apc_store') === true && $apc === true) { |
|
157 | + $conf = new \Aimeos\MW\Config\Decorator\APC($conf, $prefix); |
|
158 | 158 | } |
159 | 159 | |
160 | 160 | $local = array( |
161 | - 'admin' => $this->container->getParameter( 'aimeos_shop.admin' ), |
|
162 | - 'client' => $this->container->getParameter( 'aimeos_shop.client' ), |
|
163 | - 'controller' => $this->container->getParameter( 'aimeos_shop.controller' ), |
|
164 | - 'madmin' => $this->container->getParameter( 'aimeos_shop.madmin' ), |
|
165 | - 'mshop' => $this->container->getParameter( 'aimeos_shop.mshop' ), |
|
166 | - 'resource' => $this->container->getParameter( 'aimeos_shop.resource' ), |
|
161 | + 'admin' => $this->container->getParameter('aimeos_shop.admin'), |
|
162 | + 'client' => $this->container->getParameter('aimeos_shop.client'), |
|
163 | + 'controller' => $this->container->getParameter('aimeos_shop.controller'), |
|
164 | + 'madmin' => $this->container->getParameter('aimeos_shop.madmin'), |
|
165 | + 'mshop' => $this->container->getParameter('aimeos_shop.mshop'), |
|
166 | + 'resource' => $this->container->getParameter('aimeos_shop.resource'), |
|
167 | 167 | ); |
168 | 168 | |
169 | - return new \Aimeos\MW\Config\Decorator\Memory( $conf, $local ); |
|
169 | + return new \Aimeos\MW\Config\Decorator\Memory($conf, $local); |
|
170 | 170 | } |
171 | 171 | |
172 | 172 | |
@@ -176,19 +176,19 @@ discard block |
||
176 | 176 | * @param \Aimeos\MShop\Context\Item\Iface $context Context object |
177 | 177 | * @return \Aimeos\MShop\Locale\Item\Iface Locale item object |
178 | 178 | */ |
179 | - protected function getLocale( \Aimeos\MShop\Context\Item\Iface $context ) |
|
179 | + protected function getLocale(\Aimeos\MShop\Context\Item\Iface $context) |
|
180 | 180 | { |
181 | - if( $this->locale === null ) |
|
181 | + if ($this->locale === null) |
|
182 | 182 | { |
183 | - $status = $this->container->getParameter( 'aimeos_shop.disable_sites' ); |
|
183 | + $status = $this->container->getParameter('aimeos_shop.disable_sites'); |
|
184 | 184 | $request = $this->requestStack->getMasterRequest(); |
185 | 185 | |
186 | - $site = $request->attributes->get( 'site', $request->query->get( 'site', 'default' ) ); |
|
187 | - $currency = $request->attributes->get( 'currency', $request->query->get( 'currency', '' ) ); |
|
188 | - $lang = $request->attributes->get( 'locale', $request->query->get( 'locale', '' ) ); |
|
186 | + $site = $request->attributes->get('site', $request->query->get('site', 'default')); |
|
187 | + $currency = $request->attributes->get('currency', $request->query->get('currency', '')); |
|
188 | + $lang = $request->attributes->get('locale', $request->query->get('locale', '')); |
|
189 | 189 | |
190 | - $localeManager = \Aimeos\MShop\Locale\Manager\Factory::createManager( $context ); |
|
191 | - $this->locale = $localeManager->bootstrap( $site, $lang, $currency, $status ); |
|
190 | + $localeManager = \Aimeos\MShop\Locale\Manager\Factory::createManager($context); |
|
191 | + $this->locale = $localeManager->bootstrap($site, $lang, $currency, $status); |
|
192 | 192 | } |
193 | 193 | |
194 | 194 | return $this->locale; |
@@ -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(); |
@@ -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,61 +47,61 @@ 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\MShop\Context\Item\Iface $context, array $templatePaths, $locale = null ) |
|
50 | + public function create(\Aimeos\MShop\Context\Item\Iface $context, array $templatePaths, $locale = null) |
|
51 | 51 | { |
52 | 52 | $params = $fixed = array(); |
53 | 53 | $config = $context->getConfig(); |
54 | 54 | $request = $this->requestStack->getMasterRequest(); |
55 | 55 | |
56 | - if( $locale !== null ) |
|
56 | + if ($locale !== null) |
|
57 | 57 | { |
58 | - $params = $request->request->all() + $request->query->all() + $request->attributes->get( '_route_params' ); |
|
58 | + $params = $request->request->all() + $request->query->all() + $request->attributes->get('_route_params'); |
|
59 | 59 | $fixed = $this->getFixedParams(); |
60 | 60 | |
61 | - $i18n = $this->container->get('aimeos_i18n')->get( array( $locale ) ); |
|
61 | + $i18n = $this->container->get('aimeos_i18n')->get(array($locale)); |
|
62 | 62 | $translation = $i18n[$locale]; |
63 | 63 | } |
64 | 64 | else |
65 | 65 | { |
66 | - $translation = new \Aimeos\MW\Translation\None( 'en' ); |
|
66 | + $translation = new \Aimeos\MW\Translation\None('en'); |
|
67 | 67 | } |
68 | 68 | |
69 | 69 | |
70 | - $view = new \Aimeos\MW\View\Standard( $templatePaths ); |
|
70 | + $view = new \Aimeos\MW\View\Standard($templatePaths); |
|
71 | 71 | |
72 | - $helper = new \Aimeos\MW\View\Helper\Translate\Standard( $view, $translation ); |
|
73 | - $view->addHelper( 'translate', $helper ); |
|
72 | + $helper = new \Aimeos\MW\View\Helper\Translate\Standard($view, $translation); |
|
73 | + $view->addHelper('translate', $helper); |
|
74 | 74 | |
75 | - $helper = new \Aimeos\MW\View\Helper\Url\Symfony2( $view, $this->container->get( 'router' ), $fixed ); |
|
76 | - $view->addHelper( 'url', $helper ); |
|
75 | + $helper = new \Aimeos\MW\View\Helper\Url\Symfony2($view, $this->container->get('router'), $fixed); |
|
76 | + $view->addHelper('url', $helper); |
|
77 | 77 | |
78 | - $helper = new \Aimeos\MW\View\Helper\Param\Standard( $view, $params ); |
|
79 | - $view->addHelper( 'param', $helper ); |
|
78 | + $helper = new \Aimeos\MW\View\Helper\Param\Standard($view, $params); |
|
79 | + $view->addHelper('param', $helper); |
|
80 | 80 | |
81 | - $config = new \Aimeos\MW\Config\Decorator\Protect( clone $config, array( 'admin', 'client' ) ); |
|
82 | - $helper = new \Aimeos\MW\View\Helper\Config\Standard( $view, $config ); |
|
83 | - $view->addHelper( 'config', $helper ); |
|
81 | + $config = new \Aimeos\MW\Config\Decorator\Protect(clone $config, array('admin', 'client')); |
|
82 | + $helper = new \Aimeos\MW\View\Helper\Config\Standard($view, $config); |
|
83 | + $view->addHelper('config', $helper); |
|
84 | 84 | |
85 | - $sepDec = $config->get( 'client/html/common/format/seperatorDecimal', '.' ); |
|
86 | - $sep1000 = $config->get( 'client/html/common/format/seperator1000', ' ' ); |
|
87 | - $helper = new \Aimeos\MW\View\Helper\Number\Standard( $view, $sepDec, $sep1000 ); |
|
88 | - $view->addHelper( 'number', $helper ); |
|
85 | + $sepDec = $config->get('client/html/common/format/seperatorDecimal', '.'); |
|
86 | + $sep1000 = $config->get('client/html/common/format/seperator1000', ' '); |
|
87 | + $helper = new \Aimeos\MW\View\Helper\Number\Standard($view, $sepDec, $sep1000); |
|
88 | + $view->addHelper('number', $helper); |
|
89 | 89 | |
90 | - if( $request !== null ) |
|
90 | + if ($request !== null) |
|
91 | 91 | { |
92 | - $helper = new \Aimeos\MW\View\Helper\Request\Symfony2( $view, $request ); |
|
93 | - $view->addHelper( 'request', $helper ); |
|
92 | + $helper = new \Aimeos\MW\View\Helper\Request\Symfony2($view, $request); |
|
93 | + $view->addHelper('request', $helper); |
|
94 | 94 | } |
95 | 95 | |
96 | - $helper = new \Aimeos\MW\View\Helper\Response\Symfony2( $view ); |
|
97 | - $view->addHelper( 'response', $helper ); |
|
96 | + $helper = new \Aimeos\MW\View\Helper\Response\Symfony2($view); |
|
97 | + $view->addHelper('response', $helper); |
|
98 | 98 | |
99 | - $token = $this->container->get( 'security.csrf.token_manager' )->getToken( '_token' ); |
|
100 | - $helper = new \Aimeos\MW\View\Helper\Csrf\Standard( $view, '_token', $token->getValue() ); |
|
101 | - $view->addHelper( 'csrf', $helper ); |
|
99 | + $token = $this->container->get('security.csrf.token_manager')->getToken('_token'); |
|
100 | + $helper = new \Aimeos\MW\View\Helper\Csrf\Standard($view, '_token', $token->getValue()); |
|
101 | + $view->addHelper('csrf', $helper); |
|
102 | 102 | |
103 | - $helper = new \Aimeos\MW\View\Helper\Access\Standard( $view, $this->getGroups( $context ) ); |
|
104 | - $view->addHelper( 'access', $helper ); |
|
103 | + $helper = new \Aimeos\MW\View\Helper\Access\Standard($view, $this->getGroups($context)); |
|
104 | + $view->addHelper('access', $helper); |
|
105 | 105 | |
106 | 106 | return $view; |
107 | 107 | } |
@@ -117,15 +117,15 @@ discard block |
||
117 | 117 | $urlparams = array(); |
118 | 118 | $attr = $this->requestStack->getMasterRequest()->attributes; |
119 | 119 | |
120 | - if( ( $site = $attr->get( 'site' ) ) !== null ) { |
|
120 | + if (($site = $attr->get('site')) !== null) { |
|
121 | 121 | $urlparams['site'] = $site; |
122 | 122 | } |
123 | 123 | |
124 | - if( ( $lang = $attr->get( 'locale' ) ) !== null ) { |
|
124 | + if (($lang = $attr->get('locale')) !== null) { |
|
125 | 125 | $urlparams['locale'] = $lang; |
126 | 126 | } |
127 | 127 | |
128 | - if( ( $currency = $attr->get( 'currency' ) ) !== null ) { |
|
128 | + if (($currency = $attr->get('currency')) !== null) { |
|
129 | 129 | $urlparams['currency'] = $currency; |
130 | 130 | } |
131 | 131 | |
@@ -139,17 +139,17 @@ discard block |
||
139 | 139 | * @param \Aimeos\MShop\Context\Item\Iface $context Context object |
140 | 140 | * @return \Closure Function which returns the user group codes |
141 | 141 | */ |
142 | - protected function getGroups( \Aimeos\MShop\Context\Item\Iface $context ) |
|
142 | + protected function getGroups(\Aimeos\MShop\Context\Item\Iface $context) |
|
143 | 143 | { |
144 | - return function() use ( $context ) |
|
144 | + return function() use ($context) |
|
145 | 145 | { |
146 | 146 | $list = array(); |
147 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'customer/group' ); |
|
147 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'customer/group'); |
|
148 | 148 | |
149 | 149 | $search = $manager->createSearch(); |
150 | - $search->setConditions( $search->compare( '==', 'customer.group.id', $context->getGroupIds() ) ); |
|
150 | + $search->setConditions($search->compare('==', 'customer.group.id', $context->getGroupIds())); |
|
151 | 151 | |
152 | - foreach( $manager->searchItems( $search ) as $item ) { |
|
152 | + foreach ($manager->searchItems($search) as $item) { |
|
153 | 153 | $list[] = $item->getCode(); |
154 | 154 | } |
155 | 155 |
@@ -29,19 +29,19 @@ discard block |
||
29 | 29 | protected function configure() |
30 | 30 | { |
31 | 31 | $names = ''; |
32 | - $aimeos = new \Aimeos\Bootstrap( array() ); |
|
33 | - $cntlPaths = $aimeos->getCustomPaths( 'controller/jobs' ); |
|
34 | - $controllers = \Aimeos\Controller\Jobs\Factory::getControllers( $this->getBareContext(), $aimeos, $cntlPaths ); |
|
32 | + $aimeos = new \Aimeos\Bootstrap(array()); |
|
33 | + $cntlPaths = $aimeos->getCustomPaths('controller/jobs'); |
|
34 | + $controllers = \Aimeos\Controller\Jobs\Factory::getControllers($this->getBareContext(), $aimeos, $cntlPaths); |
|
35 | 35 | |
36 | - foreach( $controllers as $key => $controller ) { |
|
37 | - $names .= str_pad( $key, 30 ) . $controller->getName() . PHP_EOL; |
|
36 | + foreach ($controllers as $key => $controller) { |
|
37 | + $names .= str_pad($key, 30).$controller->getName().PHP_EOL; |
|
38 | 38 | } |
39 | 39 | |
40 | - $this->setName( 'aimeos:jobs' ); |
|
41 | - $this->setDescription( 'Executes the job controllers' ); |
|
42 | - $this->addArgument( 'jobs', InputArgument::REQUIRED, 'One or more job controller names like "admin/job customer/email/watch"' ); |
|
43 | - $this->addArgument( 'site', InputArgument::OPTIONAL, 'Site codes to execute the jobs for like "default unittest" (none for all)' ); |
|
44 | - $this->setHelp( "Available jobs are:\n" . $names ); |
|
40 | + $this->setName('aimeos:jobs'); |
|
41 | + $this->setDescription('Executes the job controllers'); |
|
42 | + $this->addArgument('jobs', InputArgument::REQUIRED, 'One or more job controller names like "admin/job customer/email/watch"'); |
|
43 | + $this->addArgument('site', InputArgument::OPTIONAL, 'Site codes to execute the jobs for like "default unittest" (none for all)'); |
|
44 | + $this->setHelp("Available jobs are:\n".$names); |
|
45 | 45 | } |
46 | 46 | |
47 | 47 | |
@@ -51,23 +51,23 @@ discard block |
||
51 | 51 | * @param InputInterface $input Input object |
52 | 52 | * @param OutputInterface $output Output object |
53 | 53 | */ |
54 | - protected function execute( InputInterface $input, OutputInterface $output ) |
|
54 | + protected function execute(InputInterface $input, OutputInterface $output) |
|
55 | 55 | { |
56 | 56 | $context = $this->getContext(); |
57 | - $aimeos = $this->getContainer()->get( 'aimeos' )->get(); |
|
57 | + $aimeos = $this->getContainer()->get('aimeos')->get(); |
|
58 | 58 | |
59 | - $jobs = explode( ' ', $input->getArgument( 'jobs' ) ); |
|
60 | - $localeManager = \Aimeos\MShop\Locale\Manager\Factory::createManager( $context ); |
|
59 | + $jobs = explode(' ', $input->getArgument('jobs')); |
|
60 | + $localeManager = \Aimeos\MShop\Locale\Manager\Factory::createManager($context); |
|
61 | 61 | |
62 | - foreach( $this->getSiteItems( $context, $input ) as $siteItem ) |
|
62 | + foreach ($this->getSiteItems($context, $input) as $siteItem) |
|
63 | 63 | { |
64 | - $localeItem = $localeManager->bootstrap( $siteItem->getCode(), 'en', '', false ); |
|
65 | - $context->setLocale( $localeItem ); |
|
64 | + $localeItem = $localeManager->bootstrap($siteItem->getCode(), 'en', '', false); |
|
65 | + $context->setLocale($localeItem); |
|
66 | 66 | |
67 | - $output->writeln( sprintf( 'Executing the Aimeos jobs for "<info>%s</info>"', $siteItem->getCode() ) ); |
|
67 | + $output->writeln(sprintf('Executing the Aimeos jobs for "<info>%s</info>"', $siteItem->getCode())); |
|
68 | 68 | |
69 | - foreach( $jobs as $jobname ) { |
|
70 | - \Aimeos\Controller\Jobs\Factory::createController( $context, $aimeos, $jobname )->run(); |
|
69 | + foreach ($jobs as $jobname) { |
|
70 | + \Aimeos\Controller\Jobs\Factory::createController($context, $aimeos, $jobname)->run(); |
|
71 | 71 | } |
72 | 72 | } |
73 | 73 | } |
@@ -82,15 +82,15 @@ discard block |
||
82 | 82 | { |
83 | 83 | $ctx = new \Aimeos\MShop\Context\Item\Standard(); |
84 | 84 | |
85 | - $conf = new \Aimeos\MW\Config\PHPArray( array(), array() ); |
|
86 | - $ctx->setConfig( $conf ); |
|
85 | + $conf = new \Aimeos\MW\Config\PHPArray(array(), array()); |
|
86 | + $ctx->setConfig($conf); |
|
87 | 87 | |
88 | - $locale = \Aimeos\MShop\Factory::createManager( $ctx, 'locale' )->createItem(); |
|
89 | - $locale->setLanguageId( 'en' ); |
|
90 | - $ctx->setLocale( $locale ); |
|
88 | + $locale = \Aimeos\MShop\Factory::createManager($ctx, 'locale')->createItem(); |
|
89 | + $locale->setLanguageId('en'); |
|
90 | + $ctx->setLocale($locale); |
|
91 | 91 | |
92 | - $i18n = new \Aimeos\MW\Translation\None( 'en' ); |
|
93 | - $ctx->setI18n( array( 'en' => $i18n ) ); |
|
92 | + $i18n = new \Aimeos\MW\Translation\None('en'); |
|
93 | + $ctx->setI18n(array('en' => $i18n)); |
|
94 | 94 | |
95 | 95 | return $ctx; |
96 | 96 | } |
@@ -105,19 +105,19 @@ discard block |
||
105 | 105 | { |
106 | 106 | $container = $this->getContainer(); |
107 | 107 | $aimeos = $container->get('aimeos')->get(); |
108 | - $context = $container->get( 'aimeos_context' )->get( false ); |
|
108 | + $context = $container->get('aimeos_context')->get(false); |
|
109 | 109 | |
110 | - $tmplPaths = $aimeos->getCustomPaths( 'controller/jobs/templates' ); |
|
111 | - $tmplPaths = array_merge( $tmplPaths, $aimeos->getCustomPaths( 'client/html/templates' ) ); |
|
112 | - $view = $container->get('aimeos_view')->create( $context, $tmplPaths ); |
|
110 | + $tmplPaths = $aimeos->getCustomPaths('controller/jobs/templates'); |
|
111 | + $tmplPaths = array_merge($tmplPaths, $aimeos->getCustomPaths('client/html/templates')); |
|
112 | + $view = $container->get('aimeos_view')->create($context, $tmplPaths); |
|
113 | 113 | |
114 | - $langManager = \Aimeos\MShop\Locale\Manager\Factory::createManager( $context )->getSubManager( 'language' ); |
|
115 | - $langids = array_keys( $langManager->searchItems( $langManager->createSearch( true ) ) ); |
|
116 | - $i18n = $this->getContainer()->get( 'aimeos_i18n' )->get( $langids ); |
|
114 | + $langManager = \Aimeos\MShop\Locale\Manager\Factory::createManager($context)->getSubManager('language'); |
|
115 | + $langids = array_keys($langManager->searchItems($langManager->createSearch(true))); |
|
116 | + $i18n = $this->getContainer()->get('aimeos_i18n')->get($langids); |
|
117 | 117 | |
118 | - $context->setEditor( 'aimeos:jobs' ); |
|
119 | - $context->setView( $view ); |
|
120 | - $context->setI18n( $i18n ); |
|
118 | + $context->setEditor('aimeos:jobs'); |
|
119 | + $context->setView($view); |
|
120 | + $context->setI18n($i18n); |
|
121 | 121 | |
122 | 122 | return $context; |
123 | 123 | } |
@@ -30,18 +30,18 @@ discard block |
||
30 | 30 | * @param string $classname Name of the setup task class |
31 | 31 | * @return boolean True if class is found, false if not |
32 | 32 | */ |
33 | - public static function autoload( $classname ) |
|
33 | + public static function autoload($classname) |
|
34 | 34 | { |
35 | - if( strncmp( $classname, 'Aimeos\\MW\\Setup\\Task\\', 21 ) === 0 ) |
|
35 | + if (strncmp($classname, 'Aimeos\\MW\\Setup\\Task\\', 21) === 0) |
|
36 | 36 | { |
37 | - $fileName = substr( $classname, 21 ) . '.php'; |
|
38 | - $paths = explode( PATH_SEPARATOR, get_include_path() ); |
|
37 | + $fileName = substr($classname, 21).'.php'; |
|
38 | + $paths = explode(PATH_SEPARATOR, get_include_path()); |
|
39 | 39 | |
40 | - foreach( $paths as $path ) |
|
40 | + foreach ($paths as $path) |
|
41 | 41 | { |
42 | - $file = $path . DIRECTORY_SEPARATOR . $fileName; |
|
42 | + $file = $path.DIRECTORY_SEPARATOR.$fileName; |
|
43 | 43 | |
44 | - if( file_exists( $file ) === true && ( include_once $file ) !== false ) { |
|
44 | + if (file_exists($file) === true && (include_once $file) !== false) { |
|
45 | 45 | return true; |
46 | 46 | } |
47 | 47 | } |
@@ -56,13 +56,13 @@ discard block |
||
56 | 56 | */ |
57 | 57 | protected function configure() |
58 | 58 | { |
59 | - $this->setName( 'aimeos:setup'); |
|
60 | - $this->setDescription( 'Initialize or update the Aimeos database tables' ); |
|
61 | - $this->addArgument( 'site', InputArgument::OPTIONAL, 'Site for updating database entries', 'default' ); |
|
62 | - $this->addArgument( 'tplsite', InputArgument::OPTIONAL, 'Template site for creating or updating database entries', 'default' ); |
|
63 | - $this->addOption( 'option', null, InputOption::VALUE_REQUIRED, 'Optional setup configuration, name and value are separated by ":" like "setup/default/demo:1"', array() ); |
|
64 | - $this->addOption( 'action', null, InputOption::VALUE_REQUIRED, 'Action name that should be executed, i.e. "migrate", "rollback", "clean"', 'migrate' ); |
|
65 | - $this->addOption( 'task', null, InputOption::VALUE_REQUIRED, 'Name of the setup task that should be executed', null ); |
|
59 | + $this->setName('aimeos:setup'); |
|
60 | + $this->setDescription('Initialize or update the Aimeos database tables'); |
|
61 | + $this->addArgument('site', InputArgument::OPTIONAL, 'Site for updating database entries', 'default'); |
|
62 | + $this->addArgument('tplsite', InputArgument::OPTIONAL, 'Template site for creating or updating database entries', 'default'); |
|
63 | + $this->addOption('option', null, InputOption::VALUE_REQUIRED, 'Optional setup configuration, name and value are separated by ":" like "setup/default/demo:1"', array()); |
|
64 | + $this->addOption('action', null, InputOption::VALUE_REQUIRED, 'Action name that should be executed, i.e. "migrate", "rollback", "clean"', 'migrate'); |
|
65 | + $this->addOption('task', null, InputOption::VALUE_REQUIRED, 'Name of the setup task that should be executed', null); |
|
66 | 66 | } |
67 | 67 | |
68 | 68 | |
@@ -72,51 +72,51 @@ discard block |
||
72 | 72 | * @param InputInterface $input Input object |
73 | 73 | * @param OutputInterface $output Output object |
74 | 74 | */ |
75 | - protected function execute( InputInterface $input, OutputInterface $output ) |
|
75 | + protected function execute(InputInterface $input, OutputInterface $output) |
|
76 | 76 | { |
77 | - $ctx = $this->getContainer()->get( 'aimeos_context' )->get( false ); |
|
78 | - $ctx->setEditor( 'aimeos:setup' ); |
|
77 | + $ctx = $this->getContainer()->get('aimeos_context')->get(false); |
|
78 | + $ctx->setEditor('aimeos:setup'); |
|
79 | 79 | |
80 | 80 | $config = $ctx->getConfig(); |
81 | - $site = $input->getArgument( 'site' ); |
|
82 | - $tplsite = $input->getArgument( 'tplsite' ); |
|
81 | + $site = $input->getArgument('site'); |
|
82 | + $tplsite = $input->getArgument('tplsite'); |
|
83 | 83 | |
84 | - $config->set( 'setup/site', $site ); |
|
85 | - $dbconfig = $this->getDbConfig( $config ); |
|
86 | - $this->setOptions( $config, $input ); |
|
84 | + $config->set('setup/site', $site); |
|
85 | + $dbconfig = $this->getDbConfig($config); |
|
86 | + $this->setOptions($config, $input); |
|
87 | 87 | |
88 | - $taskPaths = $this->getContainer()->get( 'aimeos' )->get()->getSetupPaths( $tplsite ); |
|
88 | + $taskPaths = $this->getContainer()->get('aimeos')->get()->getSetupPaths($tplsite); |
|
89 | 89 | |
90 | 90 | $includePaths = $taskPaths; |
91 | 91 | $includePaths[] = get_include_path(); |
92 | 92 | |
93 | - if( set_include_path( implode( PATH_SEPARATOR, $includePaths ) ) === false ) { |
|
94 | - throw new \Exception( 'Unable to extend include path' ); |
|
93 | + if (set_include_path(implode(PATH_SEPARATOR, $includePaths)) === false) { |
|
94 | + throw new \Exception('Unable to extend include path'); |
|
95 | 95 | } |
96 | 96 | |
97 | - spl_autoload_register( '\Aimeos\ShopBundle\Command\SetupCommand::autoload', true ); |
|
97 | + spl_autoload_register('\Aimeos\ShopBundle\Command\SetupCommand::autoload', true); |
|
98 | 98 | |
99 | - $manager = new \Aimeos\MW\Setup\Manager\Multiple( $ctx->getDatabaseManager(), $dbconfig, $taskPaths, $ctx ); |
|
99 | + $manager = new \Aimeos\MW\Setup\Manager\Multiple($ctx->getDatabaseManager(), $dbconfig, $taskPaths, $ctx); |
|
100 | 100 | |
101 | - $output->writeln( sprintf( 'Initializing or updating the Aimeos database tables for site <info>%1$s</info>', $site ) ); |
|
101 | + $output->writeln(sprintf('Initializing or updating the Aimeos database tables for site <info>%1$s</info>', $site)); |
|
102 | 102 | |
103 | - if( ( $task = $input->getOption( 'task' ) ) && is_array( $task ) ) { |
|
104 | - $task = reset( $task ); |
|
103 | + if (($task = $input->getOption('task')) && is_array($task)) { |
|
104 | + $task = reset($task); |
|
105 | 105 | } |
106 | 106 | |
107 | - switch( $input->getOption( 'action' ) ) |
|
107 | + switch ($input->getOption('action')) |
|
108 | 108 | { |
109 | 109 | case 'migrate': |
110 | - $manager->migrate( $task ); |
|
110 | + $manager->migrate($task); |
|
111 | 111 | break; |
112 | 112 | case 'rollback': |
113 | - $manager->rollback( $task ); |
|
113 | + $manager->rollback($task); |
|
114 | 114 | break; |
115 | 115 | case 'clean': |
116 | - $manager->clean( $task ); |
|
116 | + $manager->clean($task); |
|
117 | 117 | break; |
118 | 118 | default: |
119 | - throw new \Exception( sprintf( 'Invalid setup action "%1$s"', $input->getOption( 'action' ) ) ); |
|
119 | + throw new \Exception(sprintf('Invalid setup action "%1$s"', $input->getOption('action'))); |
|
120 | 120 | } |
121 | 121 | } |
122 | 122 | |
@@ -127,14 +127,14 @@ discard block |
||
127 | 127 | * @param \Aimeos\MW\Config\Iface $conf Config object |
128 | 128 | * @return array Multi-dimensional associative list of database configuration parameters |
129 | 129 | */ |
130 | - protected function getDbConfig( \Aimeos\MW\Config\Iface $conf ) |
|
130 | + protected function getDbConfig(\Aimeos\MW\Config\Iface $conf) |
|
131 | 131 | { |
132 | - $dbconfig = $conf->get( 'resource', array() ); |
|
132 | + $dbconfig = $conf->get('resource', array()); |
|
133 | 133 | |
134 | - foreach( $dbconfig as $rname => $dbconf ) |
|
134 | + foreach ($dbconfig as $rname => $dbconf) |
|
135 | 135 | { |
136 | - if( strncmp( $rname, 'db', 2 ) !== 0 ) { |
|
137 | - unset( $dbconfig[$rname] ); |
|
136 | + if (strncmp($rname, 'db', 2) !== 0) { |
|
137 | + unset($dbconfig[$rname]); |
|
138 | 138 | } |
139 | 139 | } |
140 | 140 | |
@@ -150,12 +150,12 @@ discard block |
||
150 | 150 | * @param array Associative list of database configurations |
151 | 151 | * @throws \RuntimeException If the format of the options is invalid |
152 | 152 | */ |
153 | - protected function setOptions( \Aimeos\MW\Config\Iface $conf, InputInterface $input ) |
|
153 | + protected function setOptions(\Aimeos\MW\Config\Iface $conf, InputInterface $input) |
|
154 | 154 | { |
155 | - foreach( (array) $input->getOption( 'option' ) as $option ) |
|
155 | + foreach ((array) $input->getOption('option') as $option) |
|
156 | 156 | { |
157 | - list( $name, $value ) = explode( ':', $option ); |
|
158 | - $conf->set( $name, $value ); |
|
157 | + list($name, $value) = explode(':', $option); |
|
158 | + $conf->set($name, $value); |
|
159 | 159 | } |
160 | 160 | } |
161 | 161 | } |
@@ -29,35 +29,35 @@ discard block |
||
29 | 29 | * @param $type File type, i.e. "css" or "js" |
30 | 30 | * @return Response Response object |
31 | 31 | */ |
32 | - public function fileAction( $type ) |
|
32 | + public function fileAction($type) |
|
33 | 33 | { |
34 | 34 | $contents = ''; |
35 | 35 | $files = array(); |
36 | - $aimeos = $this->get( 'aimeos' )->get(); |
|
36 | + $aimeos = $this->get('aimeos')->get(); |
|
37 | 37 | |
38 | - foreach( $aimeos->getCustomPaths( 'admin/jqadm' ) as $base => $paths ) |
|
38 | + foreach ($aimeos->getCustomPaths('admin/jqadm') as $base => $paths) |
|
39 | 39 | { |
40 | - foreach( $paths as $path ) |
|
40 | + foreach ($paths as $path) |
|
41 | 41 | { |
42 | - $jsbAbsPath = $base . '/' . $path; |
|
43 | - $jsb2 = new \Aimeos\MW\Jsb2\Standard( $jsbAbsPath, dirname( $jsbAbsPath ) ); |
|
44 | - $files = array_merge( $files, $jsb2->getFiles( $type ) ); |
|
42 | + $jsbAbsPath = $base.'/'.$path; |
|
43 | + $jsb2 = new \Aimeos\MW\Jsb2\Standard($jsbAbsPath, dirname($jsbAbsPath)); |
|
44 | + $files = array_merge($files, $jsb2->getFiles($type)); |
|
45 | 45 | } |
46 | 46 | } |
47 | 47 | |
48 | - foreach( $files as $file ) |
|
48 | + foreach ($files as $file) |
|
49 | 49 | { |
50 | - if( ( $content = file_get_contents( $file ) ) !== false ) { |
|
50 | + if (($content = file_get_contents($file)) !== false) { |
|
51 | 51 | $contents .= $content; |
52 | 52 | } |
53 | 53 | } |
54 | 54 | |
55 | - $response = new Response( $contents ); |
|
55 | + $response = new Response($contents); |
|
56 | 56 | |
57 | - if( $type === 'js' ) { |
|
58 | - $response->headers->set( 'Content-Type', 'application/javascript' ); |
|
59 | - } elseif( $type === 'css' ) { |
|
60 | - $response->headers->set( 'Content-Type', 'text/css' ); |
|
57 | + if ($type === 'js') { |
|
58 | + $response->headers->set('Content-Type', 'application/javascript'); |
|
59 | + } elseif ($type === 'css') { |
|
60 | + $response->headers->set('Content-Type', 'text/css'); |
|
61 | 61 | } |
62 | 62 | |
63 | 63 | return $response; |
@@ -72,10 +72,10 @@ discard block |
||
72 | 72 | * @param string $site Unique site code |
73 | 73 | * @return Response Generated output |
74 | 74 | */ |
75 | - public function copyAction( Request $request, $resource, $site = 'default' ) |
|
75 | + public function copyAction(Request $request, $resource, $site = 'default') |
|
76 | 76 | { |
77 | - $cntl = $this->createClient( $request, $site, $resource ); |
|
78 | - return $this->getHtml( $cntl->copy() ); |
|
77 | + $cntl = $this->createClient($request, $site, $resource); |
|
78 | + return $this->getHtml($cntl->copy()); |
|
79 | 79 | } |
80 | 80 | |
81 | 81 | |
@@ -87,10 +87,10 @@ discard block |
||
87 | 87 | * @param string $site Unique site code |
88 | 88 | * @return Response Generated output |
89 | 89 | */ |
90 | - public function createAction( Request $request, $resource, $site = 'default' ) |
|
90 | + public function createAction(Request $request, $resource, $site = 'default') |
|
91 | 91 | { |
92 | - $cntl = $this->createClient( $request, $site, $resource ); |
|
93 | - return $this->getHtml( $cntl->create() ); |
|
92 | + $cntl = $this->createClient($request, $site, $resource); |
|
93 | + return $this->getHtml($cntl->create()); |
|
94 | 94 | } |
95 | 95 | |
96 | 96 | |
@@ -102,10 +102,10 @@ discard block |
||
102 | 102 | * @param string $site Unique site code |
103 | 103 | * @return Response Generated output |
104 | 104 | */ |
105 | - public function deleteAction( Request $request, $resource, $site = 'default' ) |
|
105 | + public function deleteAction(Request $request, $resource, $site = 'default') |
|
106 | 106 | { |
107 | - $cntl = $this->createClient( $request, $site, $resource ); |
|
108 | - return $this->getHtml( $cntl->delete() . $cntl->search() ); |
|
107 | + $cntl = $this->createClient($request, $site, $resource); |
|
108 | + return $this->getHtml($cntl->delete().$cntl->search()); |
|
109 | 109 | } |
110 | 110 | |
111 | 111 | |
@@ -117,10 +117,10 @@ discard block |
||
117 | 117 | * @param string $site Unique site code |
118 | 118 | * @return Response Generated output |
119 | 119 | */ |
120 | - public function getAction( Request $request, $resource, $site = 'default' ) |
|
120 | + public function getAction(Request $request, $resource, $site = 'default') |
|
121 | 121 | { |
122 | - $cntl = $this->createClient( $request, $site, $resource ); |
|
123 | - return $this->getHtml( $cntl->get() ); |
|
122 | + $cntl = $this->createClient($request, $site, $resource); |
|
123 | + return $this->getHtml($cntl->get()); |
|
124 | 124 | } |
125 | 125 | |
126 | 126 | |
@@ -132,10 +132,10 @@ discard block |
||
132 | 132 | * @param string $site Unique site code |
133 | 133 | * @return Response Generated output |
134 | 134 | */ |
135 | - public function saveAction( Request $request, $resource, $site = 'default' ) |
|
135 | + public function saveAction(Request $request, $resource, $site = 'default') |
|
136 | 136 | { |
137 | - $cntl = $this->createClient( $request, $site, $resource ); |
|
138 | - return $this->getHtml( ( $cntl->save() ? : $cntl->search() ) ); |
|
137 | + $cntl = $this->createClient($request, $site, $resource); |
|
138 | + return $this->getHtml(($cntl->save() ?: $cntl->search())); |
|
139 | 139 | } |
140 | 140 | |
141 | 141 | |
@@ -147,10 +147,10 @@ discard block |
||
147 | 147 | * @param string $site Unique site code |
148 | 148 | * @return Response Generated output |
149 | 149 | */ |
150 | - public function searchAction( Request $request, $resource, $site = 'default' ) |
|
150 | + public function searchAction(Request $request, $resource, $site = 'default') |
|
151 | 151 | { |
152 | - $cntl = $this->createClient( $request, $site, $resource ); |
|
153 | - return $this->getHtml( $cntl->search() ); |
|
152 | + $cntl = $this->createClient($request, $site, $resource); |
|
153 | + return $this->getHtml($cntl->search()); |
|
154 | 154 | } |
155 | 155 | |
156 | 156 | |
@@ -162,20 +162,20 @@ discard block |
||
162 | 162 | * @param string $resource Resource location, e.g. "product" |
163 | 163 | * @return \Aimeos\Admin\JQAdm\Iface Context item |
164 | 164 | */ |
165 | - protected function createClient( Request $request, $site, $resource ) |
|
165 | + protected function createClient(Request $request, $site, $resource) |
|
166 | 166 | { |
167 | - $lang = $request->get( 'lang', 'en' ); |
|
167 | + $lang = $request->get('lang', 'en'); |
|
168 | 168 | |
169 | - $aimeos = $this->get( 'aimeos' )->get(); |
|
170 | - $templatePaths = $aimeos->getCustomPaths( 'admin/jqadm/templates' ); |
|
169 | + $aimeos = $this->get('aimeos')->get(); |
|
170 | + $templatePaths = $aimeos->getCustomPaths('admin/jqadm/templates'); |
|
171 | 171 | |
172 | - $context = $this->get( 'aimeos_context' )->get( false ); |
|
173 | - $context = $this->setLocale( $context, $site, $lang ); |
|
172 | + $context = $this->get('aimeos_context')->get(false); |
|
173 | + $context = $this->setLocale($context, $site, $lang); |
|
174 | 174 | |
175 | - $view = $this->get( 'aimeos_view' )->create( $context, $templatePaths, $lang ); |
|
176 | - $context->setView( $view ); |
|
175 | + $view = $this->get('aimeos_view')->create($context, $templatePaths, $lang); |
|
176 | + $context->setView($view); |
|
177 | 177 | |
178 | - return \Aimeos\Admin\JQAdm\Factory::createClient( $context, $templatePaths, $resource ); |
|
178 | + return \Aimeos\Admin\JQAdm\Factory::createClient($context, $templatePaths, $resource); |
|
179 | 179 | } |
180 | 180 | |
181 | 181 | |
@@ -185,12 +185,12 @@ discard block |
||
185 | 185 | * @param string $content Content from admin client |
186 | 186 | * @return Response View for rendering the output |
187 | 187 | */ |
188 | - protected function getHtml( $content ) |
|
188 | + protected function getHtml($content) |
|
189 | 189 | { |
190 | - $version = $this->get( 'aimeos' )->getVersion(); |
|
191 | - $content = str_replace( array( '{type}', '{version}' ), array( 'Symfony', $version ), $content ); |
|
190 | + $version = $this->get('aimeos')->getVersion(); |
|
191 | + $content = str_replace(array('{type}', '{version}'), array('Symfony', $version), $content); |
|
192 | 192 | |
193 | - return $this->render( 'AimeosShopBundle:Jqadm:index.html.twig', array( 'content' => $content ) ); |
|
193 | + return $this->render('AimeosShopBundle:Jqadm:index.html.twig', array('content' => $content)); |
|
194 | 194 | } |
195 | 195 | |
196 | 196 | |
@@ -202,23 +202,23 @@ discard block |
||
202 | 202 | * @param string $lang ISO language code, e.g. "en" or "en_GB" |
203 | 203 | * @return \Aimeos\MShop\Context\Item\Iface Modified context object |
204 | 204 | */ |
205 | - protected function setLocale( \Aimeos\MShop\Context\Item\Iface $context, $site, $lang ) |
|
205 | + protected function setLocale(\Aimeos\MShop\Context\Item\Iface $context, $site, $lang) |
|
206 | 206 | { |
207 | - $localeManager = \Aimeos\MShop\Factory::createManager( $context, 'locale' ); |
|
207 | + $localeManager = \Aimeos\MShop\Factory::createManager($context, 'locale'); |
|
208 | 208 | |
209 | 209 | try |
210 | 210 | { |
211 | - $localeItem = $localeManager->bootstrap( $site, '', '', false ); |
|
212 | - $localeItem->setLanguageId( null ); |
|
213 | - $localeItem->setCurrencyId( null ); |
|
211 | + $localeItem = $localeManager->bootstrap($site, '', '', false); |
|
212 | + $localeItem->setLanguageId(null); |
|
213 | + $localeItem->setCurrencyId(null); |
|
214 | 214 | } |
215 | - catch( \Aimeos\MShop\Locale\Exception $e ) |
|
215 | + catch (\Aimeos\MShop\Locale\Exception $e) |
|
216 | 216 | { |
217 | 217 | $localeItem = $localeManager->createItem(); |
218 | 218 | } |
219 | 219 | |
220 | - $context->setLocale( $localeItem ); |
|
221 | - $context->setI18n( $this->get( 'aimeos_i18n' )->get( array( $lang, 'en' ) ) ); |
|
220 | + $context->setLocale($localeItem); |
|
221 | + $context->setI18n($this->get('aimeos_i18n')->get(array($lang, 'en'))); |
|
222 | 222 | |
223 | 223 | return $context; |
224 | 224 | } |