@@ -12,13 +12,13 @@ discard block |
||
| 12 | 12 | $client = static::createClient(array(), array( |
| 13 | 13 | 'PHP_AUTH_USER' => 'admin', |
| 14 | 14 | 'PHP_AUTH_PW' => 'adminpass', |
| 15 | - ) ); |
|
| 15 | + )); |
|
| 16 | 16 | |
| 17 | - $client->request( 'GET', '/unittest/jqadm/copy/product/0' ); |
|
| 17 | + $client->request('GET', '/unittest/jqadm/copy/product/0'); |
|
| 18 | 18 | $response = $client->getResponse(); |
| 19 | 19 | |
| 20 | - $this->assertEquals( 200, $response->getStatusCode() ); |
|
| 21 | - $this->assertContains( '<div class="product-item', $response->getContent() ); |
|
| 20 | + $this->assertEquals(200, $response->getStatusCode()); |
|
| 21 | + $this->assertContains('<div class="product-item', $response->getContent()); |
|
| 22 | 22 | } |
| 23 | 23 | |
| 24 | 24 | |
@@ -27,13 +27,13 @@ discard block |
||
| 27 | 27 | $client = static::createClient(array(), array( |
| 28 | 28 | 'PHP_AUTH_USER' => 'admin', |
| 29 | 29 | 'PHP_AUTH_PW' => 'adminpass', |
| 30 | - ) ); |
|
| 30 | + )); |
|
| 31 | 31 | |
| 32 | - $client->request( 'GET', '/unittest/jqadm/create/product' ); |
|
| 32 | + $client->request('GET', '/unittest/jqadm/create/product'); |
|
| 33 | 33 | $response = $client->getResponse(); |
| 34 | 34 | |
| 35 | - $this->assertEquals( 200, $response->getStatusCode() ); |
|
| 36 | - $this->assertContains( '<div class="product-item', $response->getContent() ); |
|
| 35 | + $this->assertEquals(200, $response->getStatusCode()); |
|
| 36 | + $this->assertContains('<div class="product-item', $response->getContent()); |
|
| 37 | 37 | } |
| 38 | 38 | |
| 39 | 39 | |
@@ -42,13 +42,13 @@ discard block |
||
| 42 | 42 | $client = static::createClient(array(), array( |
| 43 | 43 | 'PHP_AUTH_USER' => 'admin', |
| 44 | 44 | 'PHP_AUTH_PW' => 'adminpass', |
| 45 | - ) ); |
|
| 45 | + )); |
|
| 46 | 46 | |
| 47 | - $client->request( 'GET', '/unittest/jqadm/delete/product/0' ); |
|
| 47 | + $client->request('GET', '/unittest/jqadm/delete/product/0'); |
|
| 48 | 48 | $response = $client->getResponse(); |
| 49 | 49 | |
| 50 | - $this->assertEquals( 200, $response->getStatusCode() ); |
|
| 51 | - $this->assertContains( '<table class="list-items', $response->getContent() ); |
|
| 50 | + $this->assertEquals(200, $response->getStatusCode()); |
|
| 51 | + $this->assertContains('<table class="list-items', $response->getContent()); |
|
| 52 | 52 | } |
| 53 | 53 | |
| 54 | 54 | |
@@ -57,13 +57,13 @@ discard block |
||
| 57 | 57 | $client = static::createClient(array(), array( |
| 58 | 58 | 'PHP_AUTH_USER' => 'admin', |
| 59 | 59 | 'PHP_AUTH_PW' => 'adminpass', |
| 60 | - ) ); |
|
| 60 | + )); |
|
| 61 | 61 | |
| 62 | - $client->request( 'GET', '/unittest/jqadm/get/product/0' ); |
|
| 62 | + $client->request('GET', '/unittest/jqadm/get/product/0'); |
|
| 63 | 63 | $response = $client->getResponse(); |
| 64 | 64 | |
| 65 | - $this->assertEquals( 200, $response->getStatusCode() ); |
|
| 66 | - $this->assertContains( '<div class="product-item', $response->getContent() ); |
|
| 65 | + $this->assertEquals(200, $response->getStatusCode()); |
|
| 66 | + $this->assertContains('<div class="product-item', $response->getContent()); |
|
| 67 | 67 | } |
| 68 | 68 | |
| 69 | 69 | |
@@ -72,13 +72,13 @@ discard block |
||
| 72 | 72 | $client = static::createClient(array(), array( |
| 73 | 73 | 'PHP_AUTH_USER' => 'admin', |
| 74 | 74 | 'PHP_AUTH_PW' => 'adminpass', |
| 75 | - ) ); |
|
| 75 | + )); |
|
| 76 | 76 | |
| 77 | - $client->request( 'POST', '/unittest/jqadm/save/product/0' ); |
|
| 77 | + $client->request('POST', '/unittest/jqadm/save/product/0'); |
|
| 78 | 78 | $response = $client->getResponse(); |
| 79 | 79 | |
| 80 | - $this->assertEquals( 200, $response->getStatusCode() ); |
|
| 81 | - $this->assertContains( '<div class="product-item', $response->getContent() ); |
|
| 80 | + $this->assertEquals(200, $response->getStatusCode()); |
|
| 81 | + $this->assertContains('<div class="product-item', $response->getContent()); |
|
| 82 | 82 | } |
| 83 | 83 | |
| 84 | 84 | |
@@ -87,13 +87,13 @@ discard block |
||
| 87 | 87 | $client = static::createClient(array(), array( |
| 88 | 88 | 'PHP_AUTH_USER' => 'admin', |
| 89 | 89 | 'PHP_AUTH_PW' => 'adminpass', |
| 90 | - ) ); |
|
| 90 | + )); |
|
| 91 | 91 | |
| 92 | - $client->request( 'GET', '/unittest/jqadm/search/product' ); |
|
| 92 | + $client->request('GET', '/unittest/jqadm/search/product'); |
|
| 93 | 93 | $response = $client->getResponse(); |
| 94 | 94 | |
| 95 | - $this->assertEquals( 200, $response->getStatusCode() ); |
|
| 96 | - $this->assertContains( '<table class="list-items', $response->getContent() ); |
|
| 95 | + $this->assertEquals(200, $response->getStatusCode()); |
|
| 96 | + $this->assertContains('<table class="list-items', $response->getContent()); |
|
| 97 | 97 | } |
| 98 | 98 | |
| 99 | 99 | |
@@ -102,12 +102,12 @@ discard block |
||
| 102 | 102 | $client = static::createClient(array(), array( |
| 103 | 103 | 'PHP_AUTH_USER' => 'admin', |
| 104 | 104 | 'PHP_AUTH_PW' => 'adminpass', |
| 105 | - ) ); |
|
| 105 | + )); |
|
| 106 | 106 | |
| 107 | - $client->request( 'GET', '/invalid/jqadm/search/product' ); |
|
| 107 | + $client->request('GET', '/invalid/jqadm/search/product'); |
|
| 108 | 108 | $response = $client->getResponse(); |
| 109 | 109 | |
| 110 | - $this->assertEquals( 200, $response->getStatusCode() ); |
|
| 111 | - $this->assertContains( '<table class="list-items', $response->getContent() ); |
|
| 110 | + $this->assertEquals(200, $response->getStatusCode()); |
|
| 111 | + $this->assertContains('<table class="list-items', $response->getContent()); |
|
| 112 | 112 | } |
| 113 | 113 | } |
@@ -210,8 +210,7 @@ |
||
| 210 | 210 | $localeItem = $localeManager->bootstrap( $sitecode, '', '', false ); |
| 211 | 211 | $localeItem->setLanguageId( null ); |
| 212 | 212 | $localeItem->setCurrencyId( null ); |
| 213 | - } |
|
| 214 | - catch( \Aimeos\MShop\Locale\Exception $e ) |
|
| 213 | + } catch( \Aimeos\MShop\Locale\Exception $e ) |
|
| 215 | 214 | { |
| 216 | 215 | $localeItem = $localeManager->createItem(); |
| 217 | 216 | } |
@@ -30,10 +30,10 @@ discard block |
||
| 30 | 30 | * @param string $site Unique site code |
| 31 | 31 | * @return Response Generated output |
| 32 | 32 | */ |
| 33 | - public function copyAction( Request $request, $resource, $site = 'default' ) |
|
| 33 | + public function copyAction(Request $request, $resource, $site = 'default') |
|
| 34 | 34 | { |
| 35 | - $cntl = $this->createClient( $request, $site, $resource ); |
|
| 36 | - return $this->getHtml( $cntl->copy() ); |
|
| 35 | + $cntl = $this->createClient($request, $site, $resource); |
|
| 36 | + return $this->getHtml($cntl->copy()); |
|
| 37 | 37 | } |
| 38 | 38 | |
| 39 | 39 | |
@@ -45,10 +45,10 @@ discard block |
||
| 45 | 45 | * @param string $site Unique site code |
| 46 | 46 | * @return Response Generated output |
| 47 | 47 | */ |
| 48 | - public function createAction( Request $request, $resource, $site = 'default' ) |
|
| 48 | + public function createAction(Request $request, $resource, $site = 'default') |
|
| 49 | 49 | { |
| 50 | - $cntl = $this->createClient( $request, $site, $resource ); |
|
| 51 | - return $this->getHtml( $cntl->create() ); |
|
| 50 | + $cntl = $this->createClient($request, $site, $resource); |
|
| 51 | + return $this->getHtml($cntl->create()); |
|
| 52 | 52 | } |
| 53 | 53 | |
| 54 | 54 | |
@@ -60,10 +60,10 @@ discard block |
||
| 60 | 60 | * @param string $site Unique site code |
| 61 | 61 | * @return Response Generated output |
| 62 | 62 | */ |
| 63 | - public function deleteAction( Request $request, $resource, $site = 'default' ) |
|
| 63 | + public function deleteAction(Request $request, $resource, $site = 'default') |
|
| 64 | 64 | { |
| 65 | - $cntl = $this->createClient( $request, $site, $resource ); |
|
| 66 | - return $this->getHtml( $cntl->delete() . $cntl->search() ); |
|
| 65 | + $cntl = $this->createClient($request, $site, $resource); |
|
| 66 | + return $this->getHtml($cntl->delete() . $cntl->search()); |
|
| 67 | 67 | } |
| 68 | 68 | |
| 69 | 69 | |
@@ -75,10 +75,10 @@ discard block |
||
| 75 | 75 | * @param string $site Unique site code |
| 76 | 76 | * @return Response Generated output |
| 77 | 77 | */ |
| 78 | - public function getAction( Request $request, $resource, $site = 'default' ) |
|
| 78 | + public function getAction(Request $request, $resource, $site = 'default') |
|
| 79 | 79 | { |
| 80 | - $cntl = $this->createClient( $request, $site, $resource ); |
|
| 81 | - return $this->getHtml( $cntl->get() ); |
|
| 80 | + $cntl = $this->createClient($request, $site, $resource); |
|
| 81 | + return $this->getHtml($cntl->get()); |
|
| 82 | 82 | } |
| 83 | 83 | |
| 84 | 84 | |
@@ -90,10 +90,10 @@ discard block |
||
| 90 | 90 | * @param string $site Unique site code |
| 91 | 91 | * @return Response Generated output |
| 92 | 92 | */ |
| 93 | - public function saveAction( Request $request, $resource, $site = 'default' ) |
|
| 93 | + public function saveAction(Request $request, $resource, $site = 'default') |
|
| 94 | 94 | { |
| 95 | - $cntl = $this->createClient( $request, $site, $resource ); |
|
| 96 | - return $this->getHtml( ( $cntl->save() ? : $cntl->search() ) ); |
|
| 95 | + $cntl = $this->createClient($request, $site, $resource); |
|
| 96 | + return $this->getHtml(($cntl->save() ?: $cntl->search())); |
|
| 97 | 97 | } |
| 98 | 98 | |
| 99 | 99 | |
@@ -105,10 +105,10 @@ discard block |
||
| 105 | 105 | * @param string $site Unique site code |
| 106 | 106 | * @return Response Generated output |
| 107 | 107 | */ |
| 108 | - public function searchAction( Request $request, $resource, $site = 'default' ) |
|
| 108 | + public function searchAction(Request $request, $resource, $site = 'default') |
|
| 109 | 109 | { |
| 110 | - $cntl = $this->createClient( $request, $site, $resource ); |
|
| 111 | - return $this->getHtml( $cntl->search() ); |
|
| 110 | + $cntl = $this->createClient($request, $site, $resource); |
|
| 111 | + return $this->getHtml($cntl->search()); |
|
| 112 | 112 | } |
| 113 | 113 | |
| 114 | 114 | |
@@ -120,20 +120,20 @@ discard block |
||
| 120 | 120 | * @param string $resource Resource location, e.g. "product" |
| 121 | 121 | * @return \Aimeos\Admin\JQAdm\Iface Context item |
| 122 | 122 | */ |
| 123 | - protected function createClient( Request $request, $site, $resource ) |
|
| 123 | + protected function createClient(Request $request, $site, $resource) |
|
| 124 | 124 | { |
| 125 | - $lang = $request->get( 'lang', 'en' ); |
|
| 125 | + $lang = $request->get('lang', 'en'); |
|
| 126 | 126 | |
| 127 | - $aimeos = $this->get( 'aimeos' )->get(); |
|
| 128 | - $templatePaths = $aimeos->getCustomPaths( 'admin/jqadm/templates' ); |
|
| 127 | + $aimeos = $this->get('aimeos')->get(); |
|
| 128 | + $templatePaths = $aimeos->getCustomPaths('admin/jqadm/templates'); |
|
| 129 | 129 | |
| 130 | - $context = $this->get( 'aimeos_context' )->get( false ); |
|
| 131 | - $context = $this->setLocale( $context, $site, $lang ); |
|
| 130 | + $context = $this->get('aimeos_context')->get(false); |
|
| 131 | + $context = $this->setLocale($context, $site, $lang); |
|
| 132 | 132 | |
| 133 | - $view = $this->get( 'aimeos_view' )->create( $context->getConfig(), $templatePaths, $lang ); |
|
| 134 | - $context->setView( $view ); |
|
| 133 | + $view = $this->get('aimeos_view')->create($context->getConfig(), $templatePaths, $lang); |
|
| 134 | + $context->setView($view); |
|
| 135 | 135 | |
| 136 | - return \Aimeos\Admin\JQAdm\Factory::createClient( $context, $templatePaths, $resource ); |
|
| 136 | + return \Aimeos\Admin\JQAdm\Factory::createClient($context, $templatePaths, $resource); |
|
| 137 | 137 | } |
| 138 | 138 | |
| 139 | 139 | |
@@ -143,12 +143,12 @@ discard block |
||
| 143 | 143 | * @param string $content Content from admin client |
| 144 | 144 | * @return Response View for rendering the output |
| 145 | 145 | */ |
| 146 | - protected function getHtml( $content ) |
|
| 146 | + protected function getHtml($content) |
|
| 147 | 147 | { |
| 148 | - $version = $this->get( 'aimeos' )->getVersion(); |
|
| 149 | - $content = str_replace( array( '{type}', '{version}' ), array( 'Symfony', $version ), $content ); |
|
| 148 | + $version = $this->get('aimeos')->getVersion(); |
|
| 149 | + $content = str_replace(array('{type}', '{version}'), array('Symfony', $version), $content); |
|
| 150 | 150 | |
| 151 | - return $this->render( 'AimeosShopBundle:Jqadm:index.html.twig', array( 'content' => $content ) ); |
|
| 151 | + return $this->render('AimeosShopBundle:Jqadm:index.html.twig', array('content' => $content)); |
|
| 152 | 152 | } |
| 153 | 153 | |
| 154 | 154 | |
@@ -160,23 +160,23 @@ discard block |
||
| 160 | 160 | * @param string $lang ISO language code, e.g. "en" or "en_GB" |
| 161 | 161 | * @return \Aimeos\MShop\Context\Item\Iface Modified context object |
| 162 | 162 | */ |
| 163 | - protected function setLocale( \Aimeos\MShop\Context\Item\Iface $context, $site, $lang ) |
|
| 163 | + protected function setLocale(\Aimeos\MShop\Context\Item\Iface $context, $site, $lang) |
|
| 164 | 164 | { |
| 165 | - $localeManager = \Aimeos\MShop\Factory::createManager( $context, 'locale' ); |
|
| 165 | + $localeManager = \Aimeos\MShop\Factory::createManager($context, 'locale'); |
|
| 166 | 166 | |
| 167 | 167 | try |
| 168 | 168 | { |
| 169 | - $localeItem = $localeManager->bootstrap( $site, '', '', false ); |
|
| 170 | - $localeItem->setLanguageId( null ); |
|
| 171 | - $localeItem->setCurrencyId( null ); |
|
| 169 | + $localeItem = $localeManager->bootstrap($site, '', '', false); |
|
| 170 | + $localeItem->setLanguageId(null); |
|
| 171 | + $localeItem->setCurrencyId(null); |
|
| 172 | 172 | } |
| 173 | - catch( \Aimeos\MShop\Locale\Exception $e ) |
|
| 173 | + catch (\Aimeos\MShop\Locale\Exception $e) |
|
| 174 | 174 | { |
| 175 | 175 | $localeItem = $localeManager->createItem(); |
| 176 | 176 | } |
| 177 | 177 | |
| 178 | - $context->setLocale( $localeItem ); |
|
| 179 | - $context->setI18n( $this->get( 'aimeos_i18n' )->get( array( $lang, 'en' ) ) ); |
|
| 178 | + $context->setLocale($localeItem); |
|
| 179 | + $context->setI18n($this->get('aimeos_i18n')->get(array($lang, 'en'))); |
|
| 180 | 180 | |
| 181 | 181 | return $context; |
| 182 | 182 | } |
@@ -29,23 +29,23 @@ |
||
| 29 | 29 | public function getConfigTreeBuilder() |
| 30 | 30 | { |
| 31 | 31 | $treeBuilder = new TreeBuilder(); |
| 32 | - $rootNode = $treeBuilder->root( 'aimeos_shop' ); |
|
| 32 | + $rootNode = $treeBuilder->root('aimeos_shop'); |
|
| 33 | 33 | |
| 34 | 34 | $rootNode |
| 35 | 35 | ->children() |
| 36 | - ->booleanNode('disable_sites')->defaultValue( true )->end() |
|
| 37 | - ->booleanNode('apc_enable')->defaultValue( false )->end() |
|
| 38 | - ->scalarNode('apc_prefix')->defaultValue( 'sf2:' )->end() |
|
| 36 | + ->booleanNode('disable_sites')->defaultValue(true)->end() |
|
| 37 | + ->booleanNode('apc_enable')->defaultValue(false)->end() |
|
| 38 | + ->scalarNode('apc_prefix')->defaultValue('sf2:')->end() |
|
| 39 | 39 | ->scalarNode('extdir')->end() |
| 40 | 40 | ->scalarNode('uploaddir')->end() |
| 41 | - ->variableNode('admin')->defaultValue( array() )->end() |
|
| 42 | - ->variableNode('client')->defaultValue( array() )->end() |
|
| 43 | - ->variableNode('controller')->defaultValue( array() )->end() |
|
| 44 | - ->variableNode('i18n')->defaultValue( array() )->end() |
|
| 45 | - ->variableNode('madmin')->defaultValue( array() )->end() |
|
| 46 | - ->variableNode('mshop')->defaultValue( array() )->end() |
|
| 47 | - ->variableNode('resource')->defaultValue( array() )->end() |
|
| 48 | - ->variableNode('page')->defaultValue( array() )->end() |
|
| 41 | + ->variableNode('admin')->defaultValue(array())->end() |
|
| 42 | + ->variableNode('client')->defaultValue(array())->end() |
|
| 43 | + ->variableNode('controller')->defaultValue(array())->end() |
|
| 44 | + ->variableNode('i18n')->defaultValue(array())->end() |
|
| 45 | + ->variableNode('madmin')->defaultValue(array())->end() |
|
| 46 | + ->variableNode('mshop')->defaultValue(array())->end() |
|
| 47 | + ->variableNode('resource')->defaultValue(array())->end() |
|
| 48 | + ->variableNode('page')->defaultValue(array())->end() |
|
| 49 | 49 | ->end() |
| 50 | 50 | ; |
| 51 | 51 | |
@@ -11,11 +11,11 @@ discard block |
||
| 11 | 11 | { |
| 12 | 12 | $client = static::createClient(); |
| 13 | 13 | |
| 14 | - $client->request( 'GET', '/admin' ); |
|
| 14 | + $client->request('GET', '/admin'); |
|
| 15 | 15 | $response = $client->getResponse(); |
| 16 | 16 | |
| 17 | - $this->assertEquals( 200, $response->getStatusCode() ); |
|
| 18 | - $this->assertContains( '<form class="login"', $response->getContent() ); |
|
| 17 | + $this->assertEquals(200, $response->getStatusCode()); |
|
| 18 | + $this->assertContains('<form class="login"', $response->getContent()); |
|
| 19 | 19 | } |
| 20 | 20 | |
| 21 | 21 | |
@@ -24,12 +24,12 @@ discard block |
||
| 24 | 24 | $client = static::createClient(array(), array( |
| 25 | 25 | 'PHP_AUTH_USER' => 'admin', |
| 26 | 26 | 'PHP_AUTH_PW' => 'adminpass', |
| 27 | - ) ); |
|
| 27 | + )); |
|
| 28 | 28 | |
| 29 | - $client->request( 'GET', '/admin' ); |
|
| 29 | + $client->request('GET', '/admin'); |
|
| 30 | 30 | $response = $client->getResponse(); |
| 31 | 31 | |
| 32 | - $this->assertEquals( 302, $response->getStatusCode() ); |
|
| 33 | - $this->assertContains( '/default/jqadm/search/product?lang=en', $response->getContent() ); |
|
| 32 | + $this->assertEquals(302, $response->getStatusCode()); |
|
| 33 | + $this->assertContains('/default/jqadm/search/product?lang=en', $response->getContent()); |
|
| 34 | 34 | } |
| 35 | 35 | } |
@@ -19,31 +19,31 @@ discard block |
||
| 19 | 19 | |
| 20 | 20 | public function testGetId() |
| 21 | 21 | { |
| 22 | - $this->assertEquals( null, $this->object->getId() ); |
|
| 22 | + $this->assertEquals(null, $this->object->getId()); |
|
| 23 | 23 | } |
| 24 | 24 | |
| 25 | 25 | |
| 26 | 26 | public function testGetUsername() |
| 27 | 27 | { |
| 28 | - $this->assertEquals( null, $this->object->getUsername() ); |
|
| 28 | + $this->assertEquals(null, $this->object->getUsername()); |
|
| 29 | 29 | } |
| 30 | 30 | |
| 31 | 31 | |
| 32 | 32 | public function testGetPassword() |
| 33 | 33 | { |
| 34 | - $this->assertEquals( null, $this->object->getPassword() ); |
|
| 34 | + $this->assertEquals(null, $this->object->getPassword()); |
|
| 35 | 35 | } |
| 36 | 36 | |
| 37 | 37 | |
| 38 | 38 | public function testGetSalt() |
| 39 | 39 | { |
| 40 | - $this->assertEquals( 'mshop', $this->object->getSalt() ); |
|
| 40 | + $this->assertEquals('mshop', $this->object->getSalt()); |
|
| 41 | 41 | } |
| 42 | 42 | |
| 43 | 43 | |
| 44 | 44 | public function testGetRoles() |
| 45 | 45 | { |
| 46 | - $this->assertEquals( array( 'ROLE_USER' ), $this->object->getRoles() ); |
|
| 46 | + $this->assertEquals(array('ROLE_USER'), $this->object->getRoles()); |
|
| 47 | 47 | } |
| 48 | 48 | |
| 49 | 49 | |
@@ -55,12 +55,12 @@ discard block |
||
| 55 | 55 | |
| 56 | 56 | public function testSerialize() |
| 57 | 57 | { |
| 58 | - $this->assertEquals( 'a:3:{i:0;N;i:1;N;i:2;N;}', $this->object->serialize() ); |
|
| 58 | + $this->assertEquals('a:3:{i:0;N;i:1;N;i:2;N;}', $this->object->serialize()); |
|
| 59 | 59 | } |
| 60 | 60 | |
| 61 | 61 | |
| 62 | 62 | public function testUnserialize() |
| 63 | 63 | { |
| 64 | - $this->object->unserialize( 'a:3:{i:0;N;i:1;N;i:2;N;}' ); |
|
| 64 | + $this->object->unserialize('a:3:{i:0;N;i:1;N;i:2;N;}'); |
|
| 65 | 65 | } |
| 66 | 66 | } |
@@ -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,62 +30,62 @@ 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', 'default' ); |
|
| 36 | - $lang = $request->query->get( 'lang', 'en' ); |
|
| 35 | + $site = $request->attributes->get('site', 'default'); |
|
| 36 | + $lang = $request->query->get('lang', 'en'); |
|
| 37 | 37 | |
| 38 | - $context = $this->get( 'aimeos_context' )->get( false ); |
|
| 39 | - $context = $this->setLocale( $context, $site, $lang ); |
|
| 38 | + $context = $this->get('aimeos_context')->get(false); |
|
| 39 | + $context = $this->setLocale($context, $site, $lang); |
|
| 40 | 40 | |
| 41 | - $aimeos = $this->get( 'aimeos' ); |
|
| 41 | + $aimeos = $this->get('aimeos'); |
|
| 42 | 42 | $bootstrap = $aimeos->get(); |
| 43 | 43 | |
| 44 | - $cntlPaths = $bootstrap->getCustomPaths( 'controller/extjs' ); |
|
| 45 | - $controller = new \Aimeos\Controller\ExtJS\JsonRpc( $context, $cntlPaths ); |
|
| 44 | + $cntlPaths = $bootstrap->getCustomPaths('controller/extjs'); |
|
| 45 | + $controller = new \Aimeos\Controller\ExtJS\JsonRpc($context, $cntlPaths); |
|
| 46 | 46 | $cssFiles = array(); |
| 47 | 47 | |
| 48 | - foreach( $bootstrap->getCustomPaths( 'admin/extjs' ) as $base => $paths ) |
|
| 48 | + foreach ($bootstrap->getCustomPaths('admin/extjs') as $base => $paths) |
|
| 49 | 49 | { |
| 50 | - foreach( $paths as $path ) |
|
| 50 | + foreach ($paths as $path) |
|
| 51 | 51 | { |
| 52 | 52 | $jsbAbsPath = $base . '/' . $path; |
| 53 | 53 | |
| 54 | - if( !is_file( $jsbAbsPath ) ) { |
|
| 55 | - throw new \Exception( sprintf( 'JSB2 file "%1$s" not found', $jsbAbsPath ) ); |
|
| 54 | + if (!is_file($jsbAbsPath)) { |
|
| 55 | + throw new \Exception(sprintf('JSB2 file "%1$s" not found', $jsbAbsPath)); |
|
| 56 | 56 | } |
| 57 | 57 | |
| 58 | - $jsb2 = new \Aimeos\MW\Jsb2\Standard( $jsbAbsPath, dirname( $path ) ); |
|
| 59 | - $cssFiles = array_merge( $cssFiles, $jsb2->getUrls( 'css' ) ); |
|
| 58 | + $jsb2 = new \Aimeos\MW\Jsb2\Standard($jsbAbsPath, dirname($path)); |
|
| 59 | + $cssFiles = array_merge($cssFiles, $jsb2->getUrls('css')); |
|
| 60 | 60 | } |
| 61 | 61 | } |
| 62 | 62 | |
| 63 | - $params = array( 'site' => '{site}', 'lang' => '{lang}', 'tab' => '{tab}' ); |
|
| 64 | - $adminUrl = $this->generateUrl( 'aimeos_shop_extadm', $params ); |
|
| 63 | + $params = array('site' => '{site}', 'lang' => '{lang}', 'tab' => '{tab}'); |
|
| 64 | + $adminUrl = $this->generateUrl('aimeos_shop_extadm', $params); |
|
| 65 | 65 | |
| 66 | - $token = $this->get( 'security.csrf.token_manager' )->getToken( 'aimeos_admin_token' )->getValue(); |
|
| 67 | - $jsonUrl = $this->generateUrl( 'aimeos_shop_extadm_json', array( '_token' => $token, 'site' => $site ) ); |
|
| 66 | + $token = $this->get('security.csrf.token_manager')->getToken('aimeos_admin_token')->getValue(); |
|
| 67 | + $jsonUrl = $this->generateUrl('aimeos_shop_extadm_json', array('_token' => $token, 'site' => $site)); |
|
| 68 | 68 | |
| 69 | - $jqadmUrl = $this->generateUrl( 'aimeos_shop_jqadm_search', array( 'site' => $site, 'resource' => 'product' ) ); |
|
| 69 | + $jqadmUrl = $this->generateUrl('aimeos_shop_jqadm_search', array('site' => $site, 'resource' => 'product')); |
|
| 70 | 70 | |
| 71 | 71 | $vars = array( |
| 72 | 72 | 'lang' => $lang, |
| 73 | 73 | 'cssFiles' => $cssFiles, |
| 74 | 74 | 'languages' => $this->getJsonLanguages(), |
| 75 | - 'config' => $this->getJsonClientConfig( $context ), |
|
| 76 | - 'site' => $this->getJsonSiteItem( $context, $site ), |
|
| 77 | - 'i18nContent' => $this->getJsonClientI18n( $bootstrap->getI18nPaths(), $lang ), |
|
| 75 | + 'config' => $this->getJsonClientConfig($context), |
|
| 76 | + 'site' => $this->getJsonSiteItem($context, $site), |
|
| 77 | + 'i18nContent' => $this->getJsonClientI18n($bootstrap->getI18nPaths(), $lang), |
|
| 78 | 78 | 'searchSchemas' => $controller->getJsonSearchSchemas(), |
| 79 | 79 | 'itemSchemas' => $controller->getJsonItemSchemas(), |
| 80 | - 'smd' => $controller->getJsonSmd( $jsonUrl ), |
|
| 81 | - 'urlTemplate' => urldecode( $adminUrl ), |
|
| 82 | - 'uploaddir' => $this->container->getParameter( 'aimeos_shop.uploaddir' ), |
|
| 83 | - 'activeTab' => $request->query->get( 'tab', 0 ), |
|
| 80 | + 'smd' => $controller->getJsonSmd($jsonUrl), |
|
| 81 | + 'urlTemplate' => urldecode($adminUrl), |
|
| 82 | + 'uploaddir' => $this->container->getParameter('aimeos_shop.uploaddir'), |
|
| 83 | + 'activeTab' => $request->query->get('tab', 0), |
|
| 84 | 84 | 'version' => $aimeos->getVersion(), |
| 85 | 85 | 'jqadmurl' => $jqadmUrl, |
| 86 | 86 | ); |
| 87 | 87 | |
| 88 | - return $this->render( 'AimeosShopBundle:Extadm:index.html.twig', $vars ); |
|
| 88 | + return $this->render('AimeosShopBundle:Extadm:index.html.twig', $vars); |
|
| 89 | 89 | } |
| 90 | 90 | |
| 91 | 91 | |
@@ -95,22 +95,22 @@ discard block |
||
| 95 | 95 | * @param Request $request Symfony request object |
| 96 | 96 | * @return Response JSON RPC message response |
| 97 | 97 | */ |
| 98 | - public function doAction( Request $request ) |
|
| 98 | + public function doAction(Request $request) |
|
| 99 | 99 | { |
| 100 | 100 | $csrfProvider = $this->get('security.csrf.token_manager'); |
| 101 | 101 | |
| 102 | - if( $csrfProvider->isTokenValid( new CsrfToken( 'aimeos_admin_token', $request->query->get( '_token' ) ) ) !== true ) { |
|
| 103 | - throw new \Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException( 'CSRF token is invalid' ); |
|
| 102 | + if ($csrfProvider->isTokenValid(new CsrfToken('aimeos_admin_token', $request->query->get('_token'))) !== true) { |
|
| 103 | + throw new \Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException('CSRF token is invalid'); |
|
| 104 | 104 | } |
| 105 | 105 | |
| 106 | - $cntlPaths = $this->get( 'aimeos' )->get()->getCustomPaths( 'controller/extjs' ); |
|
| 107 | - $context = $this->get( 'aimeos_context' )->get( false ); |
|
| 108 | - $context = $this->setLocale( $context ); |
|
| 106 | + $cntlPaths = $this->get('aimeos')->get()->getCustomPaths('controller/extjs'); |
|
| 107 | + $context = $this->get('aimeos_context')->get(false); |
|
| 108 | + $context = $this->setLocale($context); |
|
| 109 | 109 | |
| 110 | - $controller = new \Aimeos\Controller\ExtJS\JsonRpc( $context, $cntlPaths ); |
|
| 110 | + $controller = new \Aimeos\Controller\ExtJS\JsonRpc($context, $cntlPaths); |
|
| 111 | 111 | |
| 112 | - $response = $controller->process( $request->request->all(), 'php://input' ); |
|
| 113 | - return $this->render( 'AimeosShopBundle:Extadm:do.html.twig', array( 'output' => $response ) ); |
|
| 112 | + $response = $controller->process($request->request->all(), 'php://input'); |
|
| 113 | + return $this->render('AimeosShopBundle:Extadm:do.html.twig', array('output' => $response)); |
|
| 114 | 114 | } |
| 115 | 115 | |
| 116 | 116 | |
@@ -123,27 +123,27 @@ discard block |
||
| 123 | 123 | { |
| 124 | 124 | $contents = ''; |
| 125 | 125 | $jsFiles = array(); |
| 126 | - $aimeos = $this->get( 'aimeos' )->get(); |
|
| 126 | + $aimeos = $this->get('aimeos')->get(); |
|
| 127 | 127 | |
| 128 | - foreach( $aimeos->getCustomPaths( 'admin/extjs' ) as $base => $paths ) |
|
| 128 | + foreach ($aimeos->getCustomPaths('admin/extjs') as $base => $paths) |
|
| 129 | 129 | { |
| 130 | - foreach( $paths as $path ) |
|
| 130 | + foreach ($paths as $path) |
|
| 131 | 131 | { |
| 132 | 132 | $jsbAbsPath = $base . '/' . $path; |
| 133 | - $jsb2 = new \Aimeos\MW\Jsb2\Standard( $jsbAbsPath, dirname( $jsbAbsPath ) ); |
|
| 134 | - $jsFiles = array_merge( $jsFiles, $jsb2->getFiles( 'js' ) ); |
|
| 133 | + $jsb2 = new \Aimeos\MW\Jsb2\Standard($jsbAbsPath, dirname($jsbAbsPath)); |
|
| 134 | + $jsFiles = array_merge($jsFiles, $jsb2->getFiles('js')); |
|
| 135 | 135 | } |
| 136 | 136 | } |
| 137 | 137 | |
| 138 | - foreach( $jsFiles as $file ) |
|
| 138 | + foreach ($jsFiles as $file) |
|
| 139 | 139 | { |
| 140 | - if( ( $content = file_get_contents( $file ) ) !== false ) { |
|
| 140 | + if (($content = file_get_contents($file)) !== false) { |
|
| 141 | 141 | $contents .= $content; |
| 142 | 142 | } |
| 143 | 143 | } |
| 144 | 144 | |
| 145 | - $response = new Response( $contents ); |
|
| 146 | - $response->headers->set( 'Content-Type', 'application/javascript' ); |
|
| 145 | + $response = new Response($contents); |
|
| 146 | + $response->headers->set('Content-Type', 'application/javascript'); |
|
| 147 | 147 | |
| 148 | 148 | return $response; |
| 149 | 149 | } |
@@ -158,11 +158,11 @@ discard block |
||
| 158 | 158 | { |
| 159 | 159 | $result = array(); |
| 160 | 160 | |
| 161 | - foreach( $this->get( 'aimeos' )->get()->getI18nList( 'admin' ) as $id ) { |
|
| 162 | - $result[] = array( 'id' => $id, 'label' => $id ); |
|
| 161 | + foreach ($this->get('aimeos')->get()->getI18nList('admin') as $id) { |
|
| 162 | + $result[] = array('id' => $id, 'label' => $id); |
|
| 163 | 163 | } |
| 164 | 164 | |
| 165 | - return json_encode( $result ); |
|
| 165 | + return json_encode($result); |
|
| 166 | 166 | } |
| 167 | 167 | |
| 168 | 168 | |
@@ -172,10 +172,10 @@ discard block |
||
| 172 | 172 | * @param \Aimeos\MShop\Context\Item\Iface $context Context item object |
| 173 | 173 | * @return string JSON encoded configuration object |
| 174 | 174 | */ |
| 175 | - protected function getJsonClientConfig( \Aimeos\MShop\Context\Item\Iface $context ) |
|
| 175 | + protected function getJsonClientConfig(\Aimeos\MShop\Context\Item\Iface $context) |
|
| 176 | 176 | { |
| 177 | - $config = $context->getConfig()->get( 'admin/extjs', array() ); |
|
| 178 | - return json_encode( array( 'admin' => array( 'extjs' => $config ) ), JSON_FORCE_OBJECT ); |
|
| 177 | + $config = $context->getConfig()->get('admin/extjs', array()); |
|
| 178 | + return json_encode(array('admin' => array('extjs' => $config)), JSON_FORCE_OBJECT); |
|
| 179 | 179 | } |
| 180 | 180 | |
| 181 | 181 | |
@@ -186,16 +186,16 @@ discard block |
||
| 186 | 186 | * @param string $lang ISO language code like "en" or "en_GB" |
| 187 | 187 | * @return string JSON encoded translation object |
| 188 | 188 | */ |
| 189 | - protected function getJsonClientI18n( array $i18nPaths, $lang ) |
|
| 189 | + protected function getJsonClientI18n(array $i18nPaths, $lang) |
|
| 190 | 190 | { |
| 191 | - $i18n = new \Aimeos\MW\Translation\Zend2( $i18nPaths, 'gettext', $lang, array( 'disableNotices' => true ) ); |
|
| 191 | + $i18n = new \Aimeos\MW\Translation\Zend2($i18nPaths, 'gettext', $lang, array('disableNotices' => true)); |
|
| 192 | 192 | |
| 193 | 193 | $content = array( |
| 194 | - 'admin' => $i18n->getAll( 'admin' ), |
|
| 195 | - 'admin/ext' => $i18n->getAll( 'admin/ext' ), |
|
| 194 | + 'admin' => $i18n->getAll('admin'), |
|
| 195 | + 'admin/ext' => $i18n->getAll('admin/ext'), |
|
| 196 | 196 | ); |
| 197 | 197 | |
| 198 | - return json_encode( $content, JSON_FORCE_OBJECT ); |
|
| 198 | + return json_encode($content, JSON_FORCE_OBJECT); |
|
| 199 | 199 | } |
| 200 | 200 | |
| 201 | 201 | |
@@ -207,19 +207,19 @@ discard block |
||
| 207 | 207 | * @return string JSON encoded site item object |
| 208 | 208 | * @throws Exception If no site item was found for the code |
| 209 | 209 | */ |
| 210 | - protected function getJsonSiteItem( \Aimeos\MShop\Context\Item\Iface $context, $site ) |
|
| 210 | + protected function getJsonSiteItem(\Aimeos\MShop\Context\Item\Iface $context, $site) |
|
| 211 | 211 | { |
| 212 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'locale/site' ); |
|
| 212 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'locale/site'); |
|
| 213 | 213 | |
| 214 | 214 | $criteria = $manager->createSearch(); |
| 215 | - $criteria->setConditions( $criteria->compare( '==', 'locale.site.code', $site ) ); |
|
| 216 | - $items = $manager->searchItems( $criteria ); |
|
| 215 | + $criteria->setConditions($criteria->compare('==', 'locale.site.code', $site)); |
|
| 216 | + $items = $manager->searchItems($criteria); |
|
| 217 | 217 | |
| 218 | - if( ( $item = reset( $items ) ) === false ) { |
|
| 219 | - throw new \Exception( sprintf( 'No site found for code "%1$s"', $site ) ); |
|
| 218 | + if (($item = reset($items)) === false) { |
|
| 219 | + throw new \Exception(sprintf('No site found for code "%1$s"', $site)); |
|
| 220 | 220 | } |
| 221 | 221 | |
| 222 | - return json_encode( $item->toArray() ); |
|
| 222 | + return json_encode($item->toArray()); |
|
| 223 | 223 | } |
| 224 | 224 | |
| 225 | 225 | |
@@ -231,17 +231,17 @@ discard block |
||
| 231 | 231 | * @param string $locale ISO language code, e.g. "en" or "en_GB" |
| 232 | 232 | * @return \Aimeos\MShop\Context\Item\Iface Modified context object |
| 233 | 233 | */ |
| 234 | - protected function setLocale( \Aimeos\MShop\Context\Item\Iface $context, $sitecode = 'default', $locale = null ) |
|
| 234 | + protected function setLocale(\Aimeos\MShop\Context\Item\Iface $context, $sitecode = 'default', $locale = null) |
|
| 235 | 235 | { |
| 236 | - $localeManager = \Aimeos\MShop\Factory::createManager( $context, 'locale' ); |
|
| 236 | + $localeManager = \Aimeos\MShop\Factory::createManager($context, 'locale'); |
|
| 237 | 237 | |
| 238 | 238 | try { |
| 239 | - $localeItem = $localeManager->bootstrap( $sitecode, $locale, '', false ); |
|
| 240 | - } catch( \Aimeos\MShop\Locale\Exception $e ) { |
|
| 239 | + $localeItem = $localeManager->bootstrap($sitecode, $locale, '', false); |
|
| 240 | + } catch (\Aimeos\MShop\Locale\Exception $e) { |
|
| 241 | 241 | $localeItem = $localeManager->createItem(); |
| 242 | 242 | } |
| 243 | 243 | |
| 244 | - $context->setLocale( $localeItem ); |
|
| 244 | + $context->setLocale($localeItem); |
|
| 245 | 245 | |
| 246 | 246 | return $context; |
| 247 | 247 | } |
@@ -29,23 +29,23 @@ discard block |
||
| 29 | 29 | */ |
| 30 | 30 | public function indexAction() |
| 31 | 31 | { |
| 32 | - if( $this->isAdmin() ) |
|
| 32 | + if ($this->isAdmin()) |
|
| 33 | 33 | { |
| 34 | - $params = array( 'site' => 'default', 'resource' => 'product', 'lang' => 'en' ); |
|
| 35 | - return $this->redirect( $this->generateUrl( 'aimeos_shop_jqadm_search', $params ) ); |
|
| 34 | + $params = array('site' => 'default', 'resource' => 'product', 'lang' => 'en'); |
|
| 35 | + return $this->redirect($this->generateUrl('aimeos_shop_jqadm_search', $params)); |
|
| 36 | 36 | } |
| 37 | 37 | |
| 38 | - $param = array( 'error' => '', 'username' => '' ); |
|
| 38 | + $param = array('error' => '', 'username' => ''); |
|
| 39 | 39 | |
| 40 | - if( $this->has( 'security.authentication_utils' ) ) |
|
| 40 | + if ($this->has('security.authentication_utils')) |
|
| 41 | 41 | { |
| 42 | - $auth = $this->get( 'security.authentication_utils' ); |
|
| 42 | + $auth = $this->get('security.authentication_utils'); |
|
| 43 | 43 | |
| 44 | 44 | $param['error'] = $auth->getLastAuthenticationError(); |
| 45 | 45 | $param['username'] = $auth->getLastUsername(); |
| 46 | 46 | } |
| 47 | 47 | |
| 48 | - return $this->render( 'AimeosShopBundle:Admin:index.html.twig', $param ); |
|
| 48 | + return $this->render('AimeosShopBundle:Admin:index.html.twig', $param); |
|
| 49 | 49 | } |
| 50 | 50 | |
| 51 | 51 | |
@@ -56,10 +56,10 @@ discard block |
||
| 56 | 56 | */ |
| 57 | 57 | protected function isAdmin() |
| 58 | 58 | { |
| 59 | - if( $this->has( 'security.authorization_checker' ) && $this->get( 'security.token_storage' )->getToken() |
|
| 60 | - && $this->get( 'security.authorization_checker' )->isGranted( 'ROLE_ADMIN' ) |
|
| 61 | - || $this->has( 'security.context' ) && $this->get( 'security.context' )->getToken() |
|
| 62 | - && $this->get( 'security.context' )->isGranted( 'ROLE_ADMIN' ) |
|
| 59 | + if ($this->has('security.authorization_checker') && $this->get('security.token_storage')->getToken() |
|
| 60 | + && $this->get('security.authorization_checker')->isGranted('ROLE_ADMIN') |
|
| 61 | + || $this->has('security.context') && $this->get('security.context')->getToken() |
|
| 62 | + && $this->get('security.context')->isGranted('ROLE_ADMIN') |
|
| 63 | 63 | ) { |
| 64 | 64 | return true; |
| 65 | 65 | } |
@@ -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 | } |
@@ -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\Zend2( array(), 'gettext', 'en', array( 'disableNotices' => true ) ); |
|
| 93 | - $ctx->setI18n( array( 'en' => $i18n ) ); |
|
| 92 | + $i18n = new \Aimeos\MW\Translation\Zend2(array(), 'gettext', 'en', array('disableNotices' => true)); |
|
| 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->getConfig(), $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->getConfig(), $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 | } |