@@ -17,38 +17,38 @@ discard block |
||
| 17 | 17 | { |
| 18 | 18 | \Aimeos\Aimeos\Base::aimeos(); // initialize autoloader |
| 19 | 19 | |
| 20 | - $this->object = $this->getAccessibleMock('Aimeos\\Aimeos\\Controller\\JsonapiController', array('dummy')); |
|
| 20 | + $this->object = $this->getAccessibleMock( 'Aimeos\\Aimeos\\Controller\\JsonapiController', array( 'dummy' ) ); |
|
| 21 | 21 | |
| 22 | - $this->request = $this->getMockBuilder('TYPO3\\CMS\\Extbase\\Mvc\\Web\\Request') |
|
| 23 | - ->setMethods(array('hasArgument', 'getArgument', 'getMethod')) |
|
| 22 | + $this->request = $this->getMockBuilder( 'TYPO3\\CMS\\Extbase\\Mvc\\Web\\Request' ) |
|
| 23 | + ->setMethods( array( 'hasArgument', 'getArgument', 'getMethod' ) ) |
|
| 24 | 24 | ->disableOriginalConstructor() |
| 25 | 25 | ->getMock(); |
| 26 | 26 | |
| 27 | - $this->response = $this->getMockBuilder('TYPO3\\CMS\\Extbase\\Mvc\\Web\\Response') |
|
| 28 | - ->setMethods(array('setStatus')) |
|
| 27 | + $this->response = $this->getMockBuilder( 'TYPO3\\CMS\\Extbase\\Mvc\\Web\\Response' ) |
|
| 28 | + ->setMethods( array( 'setStatus' ) ) |
|
| 29 | 29 | ->disableOriginalConstructor() |
| 30 | 30 | ->getMock(); |
| 31 | 31 | |
| 32 | - $this->uriBuilder = $this->getMockBuilder('TYPO3\\CMS\\Extbase\\Mvc\\Web\\Routing\\UriBuilder') |
|
| 33 | - ->setMethods(array('buildFrontendUri')) |
|
| 32 | + $this->uriBuilder = $this->getMockBuilder( 'TYPO3\\CMS\\Extbase\\Mvc\\Web\\Routing\\UriBuilder' ) |
|
| 33 | + ->setMethods( array( 'buildFrontendUri' ) ) |
|
| 34 | 34 | ->disableOriginalConstructor() |
| 35 | 35 | ->getMock(); |
| 36 | 36 | |
| 37 | - if (method_exists($response, 'setRequest')) { |
|
| 38 | - $response->setRequest($this->request); |
|
| 37 | + if( method_exists( $response, 'setRequest' ) ) { |
|
| 38 | + $response->setRequest( $this->request ); |
|
| 39 | 39 | } |
| 40 | 40 | |
| 41 | - $this->object->_set('uriBuilder', $this->uriBuilder); |
|
| 42 | - $this->object->_set('response', $this->response); |
|
| 43 | - $this->object->_set('request', $this->request); |
|
| 41 | + $this->object->_set( 'uriBuilder', $this->uriBuilder ); |
|
| 42 | + $this->object->_set( 'response', $this->response ); |
|
| 43 | + $this->object->_set( 'request', $this->request ); |
|
| 44 | 44 | |
| 45 | - $this->object->_call('initializeAction'); |
|
| 45 | + $this->object->_call( 'initializeAction' ); |
|
| 46 | 46 | } |
| 47 | 47 | |
| 48 | 48 | |
| 49 | 49 | public function tearDown() |
| 50 | 50 | { |
| 51 | - unset($this->object, $this->request, $this->response); |
|
| 51 | + unset( $this->object, $this->request, $this->response ); |
|
| 52 | 52 | } |
| 53 | 53 | |
| 54 | 54 | |
@@ -57,26 +57,26 @@ discard block |
||
| 57 | 57 | */ |
| 58 | 58 | public function optionsAction() |
| 59 | 59 | { |
| 60 | - $this->request->expects($this->exactly(1))->method('getMethod') |
|
| 61 | - ->will($this->returnValue('OPTIONS')); |
|
| 60 | + $this->request->expects( $this->exactly( 1 ) )->method( 'getMethod' ) |
|
| 61 | + ->will( $this->returnValue( 'OPTIONS' ) ); |
|
| 62 | 62 | |
| 63 | - $this->request->expects($this->atLeastOnce())->method('hasArgument') |
|
| 64 | - ->will($this->returnValue(true)); |
|
| 63 | + $this->request->expects( $this->atLeastOnce() )->method( 'hasArgument' ) |
|
| 64 | + ->will( $this->returnValue( true ) ); |
|
| 65 | 65 | |
| 66 | - $this->request->expects($this->any())->method('getArgument') |
|
| 67 | - ->will($this->onConsecutiveCalls('', 'unittest', null, null, 'unittest', null, null)); |
|
| 66 | + $this->request->expects( $this->any() )->method( 'getArgument' ) |
|
| 67 | + ->will( $this->onConsecutiveCalls( '', 'unittest', null, null, 'unittest', null, null ) ); |
|
| 68 | 68 | |
| 69 | - $this->response->expects($this->exactly(1))->method('setStatus') |
|
| 70 | - ->with($this->equalTo(200)); |
|
| 69 | + $this->response->expects( $this->exactly( 1 ) )->method( 'setStatus' ) |
|
| 70 | + ->with( $this->equalTo( 200 ) ); |
|
| 71 | 71 | |
| 72 | 72 | $result = $this->object->indexAction(); |
| 73 | - $json = json_decode($result, true); |
|
| 73 | + $json = json_decode( $result, true ); |
|
| 74 | 74 | |
| 75 | - $this->assertNotEquals(null, $json); |
|
| 76 | - $this->assertArrayHasKey('meta', $json); |
|
| 77 | - $this->assertArrayHasKey('resources', $json['meta']); |
|
| 78 | - $this->assertGreaterThan(1, count($json['meta']['resources'])); |
|
| 79 | - $this->assertArrayHasKey('product', $json['meta']['resources']); |
|
| 75 | + $this->assertNotEquals( null, $json ); |
|
| 76 | + $this->assertArrayHasKey( 'meta', $json ); |
|
| 77 | + $this->assertArrayHasKey( 'resources', $json['meta'] ); |
|
| 78 | + $this->assertGreaterThan( 1, count( $json['meta']['resources'] ) ); |
|
| 79 | + $this->assertArrayHasKey( 'product', $json['meta']['resources'] ); |
|
| 80 | 80 | } |
| 81 | 81 | |
| 82 | 82 | |
@@ -85,25 +85,25 @@ discard block |
||
| 85 | 85 | */ |
| 86 | 86 | public function getAction() |
| 87 | 87 | { |
| 88 | - $this->request->expects($this->exactly(1))->method('getMethod') |
|
| 89 | - ->will($this->returnValue('GET')); |
|
| 88 | + $this->request->expects( $this->exactly( 1 ) )->method( 'getMethod' ) |
|
| 89 | + ->will( $this->returnValue( 'GET' ) ); |
|
| 90 | 90 | |
| 91 | - $this->request->expects($this->atLeastOnce())->method('hasArgument') |
|
| 92 | - ->will($this->returnValue(true)); |
|
| 91 | + $this->request->expects( $this->atLeastOnce() )->method( 'hasArgument' ) |
|
| 92 | + ->will( $this->returnValue( true ) ); |
|
| 93 | 93 | |
| 94 | - $this->request->expects($this->any())->method('getArgument') |
|
| 95 | - ->will($this->onConsecutiveCalls('product', 'unittest', null, null, 'unittest', null, null)); |
|
| 94 | + $this->request->expects( $this->any() )->method( 'getArgument' ) |
|
| 95 | + ->will( $this->onConsecutiveCalls( 'product', 'unittest', null, null, 'unittest', null, null ) ); |
|
| 96 | 96 | |
| 97 | - $this->response->expects($this->exactly(1))->method('setStatus') |
|
| 98 | - ->with($this->equalTo(200)); |
|
| 97 | + $this->response->expects( $this->exactly( 1 ) )->method( 'setStatus' ) |
|
| 98 | + ->with( $this->equalTo( 200 ) ); |
|
| 99 | 99 | |
| 100 | - $this->uriBuilder->expects($this->any())->method('buildFrontendUri') |
|
| 101 | - ->will($this->returnValue('http://localhost/')); |
|
| 100 | + $this->uriBuilder->expects( $this->any() )->method( 'buildFrontendUri' ) |
|
| 101 | + ->will( $this->returnValue( 'http://localhost/' ) ); |
|
| 102 | 102 | |
| 103 | 103 | $result = $this->object->indexAction(); |
| 104 | - $json = json_decode($result, true); |
|
| 104 | + $json = json_decode( $result, true ); |
|
| 105 | 105 | |
| 106 | - $this->assertNotEquals(null, $json); |
|
| 106 | + $this->assertNotEquals( null, $json ); |
|
| 107 | 107 | } |
| 108 | 108 | |
| 109 | 109 | } |
| 110 | 110 | \ No newline at end of file |
@@ -14,31 +14,31 @@ discard block |
||
| 14 | 14 | { |
| 15 | 15 | \Aimeos\Aimeos\Base::aimeos(); // initialize autoloader |
| 16 | 16 | |
| 17 | - $this->object = $this->getAccessibleMock('Aimeos\\Aimeos\\Controller\\AccountController', array('dummy')); |
|
| 17 | + $this->object = $this->getAccessibleMock( 'Aimeos\\Aimeos\\Controller\\AccountController', array( 'dummy' ) ); |
|
| 18 | 18 | |
| 19 | 19 | $objManager = new \TYPO3\CMS\Extbase\Object\ObjectManager(); |
| 20 | 20 | |
| 21 | - $uriBuilder = $objManager->get('TYPO3\\CMS\\Extbase\\Mvc\\Web\\Routing\\UriBuilder'); |
|
| 22 | - $response = $objManager->get('TYPO3\\CMS\\Extbase\\Mvc\\Web\\Response'); |
|
| 23 | - $request = $objManager->get('TYPO3\\CMS\\Extbase\\Mvc\\Web\\Request'); |
|
| 21 | + $uriBuilder = $objManager->get( 'TYPO3\\CMS\\Extbase\\Mvc\\Web\\Routing\\UriBuilder' ); |
|
| 22 | + $response = $objManager->get( 'TYPO3\\CMS\\Extbase\\Mvc\\Web\\Response' ); |
|
| 23 | + $request = $objManager->get( 'TYPO3\\CMS\\Extbase\\Mvc\\Web\\Request' ); |
|
| 24 | 24 | |
| 25 | - $uriBuilder->setRequest($request); |
|
| 25 | + $uriBuilder->setRequest( $request ); |
|
| 26 | 26 | |
| 27 | - if (method_exists($response, 'setRequest')) { |
|
| 28 | - $response->setRequest($request); |
|
| 27 | + if( method_exists( $response, 'setRequest' ) ) { |
|
| 28 | + $response->setRequest( $request ); |
|
| 29 | 29 | } |
| 30 | 30 | |
| 31 | - $this->object->_set('uriBuilder', $uriBuilder); |
|
| 32 | - $this->object->_set('response', $response); |
|
| 33 | - $this->object->_set('request', $request); |
|
| 31 | + $this->object->_set( 'uriBuilder', $uriBuilder ); |
|
| 32 | + $this->object->_set( 'response', $response ); |
|
| 33 | + $this->object->_set( 'request', $request ); |
|
| 34 | 34 | |
| 35 | - $this->object->_call('initializeAction'); |
|
| 35 | + $this->object->_call( 'initializeAction' ); |
|
| 36 | 36 | } |
| 37 | 37 | |
| 38 | 38 | |
| 39 | 39 | public function tearDown() |
| 40 | 40 | { |
| 41 | - unset($this->object); |
|
| 41 | + unset( $this->object ); |
|
| 42 | 42 | } |
| 43 | 43 | |
| 44 | 44 | |
@@ -48,13 +48,13 @@ discard block |
||
| 48 | 48 | public function downloadAction() |
| 49 | 49 | { |
| 50 | 50 | $name = '\\Aimeos\\Client\\Html\\Account\\Download\\Standard'; |
| 51 | - $client = $this->getMock($name, array('process'), [], '', false); |
|
| 51 | + $client = $this->getMock( $name, array( 'process' ), [], '', false ); |
|
| 52 | 52 | |
| 53 | - \Aimeos\Client\Html\Account\Download\Factory::injectClient($name, $client); |
|
| 53 | + \Aimeos\Client\Html\Account\Download\Factory::injectClient( $name, $client ); |
|
| 54 | 54 | $output = $this->object->downloadAction(); |
| 55 | - \Aimeos\Client\Html\Account\Download\Factory::injectClient($name, null); |
|
| 55 | + \Aimeos\Client\Html\Account\Download\Factory::injectClient( $name, null ); |
|
| 56 | 56 | |
| 57 | - $this->assertEquals('', $output); |
|
| 57 | + $this->assertEquals( '', $output ); |
|
| 58 | 58 | } |
| 59 | 59 | |
| 60 | 60 | |
@@ -64,15 +64,15 @@ discard block |
||
| 64 | 64 | public function historyAction() |
| 65 | 65 | { |
| 66 | 66 | $name = '\\Aimeos\\Client\\Html\\Account\\History\\Standard'; |
| 67 | - $client = $this->getMock($name, array('getBody', 'getHeader', 'process'), [], '', false); |
|
| 67 | + $client = $this->getMock( $name, array( 'getBody', 'getHeader', 'process' ), [], '', false ); |
|
| 68 | 68 | |
| 69 | - $client->expects($this->once())->method('getBody')->will($this->returnValue('body')); |
|
| 70 | - $client->expects($this->once())->method('getHeader')->will($this->returnValue('header')); |
|
| 69 | + $client->expects( $this->once() )->method( 'getBody' )->will( $this->returnValue( 'body' ) ); |
|
| 70 | + $client->expects( $this->once() )->method( 'getHeader' )->will( $this->returnValue( 'header' ) ); |
|
| 71 | 71 | |
| 72 | - \Aimeos\Client\Html\Account\History\Factory::injectClient($name, $client); |
|
| 72 | + \Aimeos\Client\Html\Account\History\Factory::injectClient( $name, $client ); |
|
| 73 | 73 | $output = $this->object->historyAction(); |
| 74 | - \Aimeos\Client\Html\Account\History\Factory::injectClient($name, null); |
|
| 74 | + \Aimeos\Client\Html\Account\History\Factory::injectClient( $name, null ); |
|
| 75 | 75 | |
| 76 | - $this->assertEquals('body', $output); |
|
| 76 | + $this->assertEquals( 'body', $output ); |
|
| 77 | 77 | } |
| 78 | 78 | } |
| 79 | 79 | \ No newline at end of file |
@@ -4,7 +4,7 @@ discard block |
||
| 4 | 4 | namespace Aimeos\Aimeos\Tests\Unit; |
| 5 | 5 | |
| 6 | 6 | |
| 7 | -require_once dirname(dirname(__DIR__)) . DIRECTORY_SEPARATOR . 'class.ext_update.php'; |
|
| 7 | +require_once dirname( dirname( __DIR__ ) ) . DIRECTORY_SEPARATOR . 'class.ext_update.php'; |
|
| 8 | 8 | |
| 9 | 9 | |
| 10 | 10 | class UpdateTest |
@@ -21,7 +21,7 @@ discard block |
||
| 21 | 21 | |
| 22 | 22 | public function tearDown() |
| 23 | 23 | { |
| 24 | - unset($this->object); |
|
| 24 | + unset( $this->object ); |
|
| 25 | 25 | } |
| 26 | 26 | |
| 27 | 27 | |
@@ -30,7 +30,7 @@ discard block |
||
| 30 | 30 | */ |
| 31 | 31 | public function access() |
| 32 | 32 | { |
| 33 | - $this->assertTrue($this->object->access()); |
|
| 33 | + $this->assertTrue( $this->object->access() ); |
|
| 34 | 34 | } |
| 35 | 35 | |
| 36 | 36 | |
@@ -41,6 +41,6 @@ discard block |
||
| 41 | 41 | { |
| 42 | 42 | $result = $this->object->main(); |
| 43 | 43 | |
| 44 | - $this->assertContains('Setup process lasted', $result); |
|
| 44 | + $this->assertContains( 'Setup process lasted', $result ); |
|
| 45 | 45 | } |
| 46 | 46 | } |
| 47 | 47 | \ No newline at end of file |
@@ -34,12 +34,12 @@ discard block |
||
| 34 | 34 | * ['cshKey'] => The CSH key for the field |
| 35 | 35 | * ['cshLabel'] => The code of the CSH label |
| 36 | 36 | */ |
| 37 | - public function getAdditionalFields(array &$taskInfo, $task, \TYPO3\CMS\Scheduler\Controller\SchedulerModuleController $parentObject) |
|
| 37 | + public function getAdditionalFields( array &$taskInfo, $task, \TYPO3\CMS\Scheduler\Controller\SchedulerModuleController $parentObject ) |
|
| 38 | 38 | { |
| 39 | 39 | try { |
| 40 | - return $this->getFields($taskInfo, $task, $parentObject); |
|
| 41 | - } catch(\Exception $e) { |
|
| 42 | - $this->addMessage($e->getMessage(), \TYPO3\CMS\Core\Messaging\AbstractMessage::ERROR); |
|
| 40 | + return $this->getFields( $taskInfo, $task, $parentObject ); |
|
| 41 | + } catch( \Exception $e ) { |
|
| 42 | + $this->addMessage( $e->getMessage(), \TYPO3\CMS\Core\Messaging\AbstractMessage::ERROR ); |
|
| 43 | 43 | } |
| 44 | 44 | |
| 45 | 45 | return []; |
@@ -54,9 +54,9 @@ discard block |
||
| 54 | 54 | * @param array $submittedData Array containing the data submitted by the user |
| 55 | 55 | * @param tx_scheduler_Task $task Reference to the current task object |
| 56 | 56 | */ |
| 57 | - public function saveAdditionalFields(array $submittedData, \TYPO3\CMS\Scheduler\Task\AbstractTask $task) |
|
| 57 | + public function saveAdditionalFields( array $submittedData, \TYPO3\CMS\Scheduler\Task\AbstractTask $task ) |
|
| 58 | 58 | { |
| 59 | - $this->saveFields($submittedData, $task); |
|
| 59 | + $this->saveFields( $submittedData, $task ); |
|
| 60 | 60 | } |
| 61 | 61 | |
| 62 | 62 | |
@@ -69,12 +69,12 @@ discard block |
||
| 69 | 69 | * @param tx_scheduler_Module $parentObject Reference to the calling object (Scheduler's BE module) |
| 70 | 70 | * @return boolean True if validation was ok (or selected class is not relevant), false otherwise |
| 71 | 71 | */ |
| 72 | - public function validateAdditionalFields(array &$submittedData, \TYPO3\CMS\Scheduler\Controller\SchedulerModuleController $parentObject) |
|
| 72 | + public function validateAdditionalFields( array &$submittedData, \TYPO3\CMS\Scheduler\Controller\SchedulerModuleController $parentObject ) |
|
| 73 | 73 | { |
| 74 | 74 | try { |
| 75 | - return $this->validateFields($submittedData, $parentObject); |
|
| 76 | - } catch(\Exception $e) { |
|
| 77 | - $this->addMessage($e->getMessage(), \TYPO3\CMS\Core\Messaging\AbstractMessage::ERROR); |
|
| 75 | + return $this->validateFields( $submittedData, $parentObject ); |
|
| 76 | + } catch( \Exception $e ) { |
|
| 77 | + $this->addMessage( $e->getMessage(), \TYPO3\CMS\Core\Messaging\AbstractMessage::ERROR ); |
|
| 78 | 78 | } |
| 79 | 79 | |
| 80 | 80 | return false; |
@@ -36,9 +36,12 @@ discard block |
||
| 36 | 36 | */ |
| 37 | 37 | public function getAdditionalFields(array &$taskInfo, $task, \TYPO3\CMS\Scheduler\Controller\SchedulerModuleController $parentObject) |
| 38 | 38 | { |
| 39 | - try { |
|
| 39 | + try |
|
| 40 | + { |
|
| 40 | 41 | return $this->getFields($taskInfo, $task, $parentObject); |
| 41 | - } catch(\Exception $e) { |
|
| 42 | + } |
|
| 43 | + catch(\Exception $e) |
|
| 44 | + { |
|
| 42 | 45 | $this->addMessage($e->getMessage(), \TYPO3\CMS\Core\Messaging\AbstractMessage::ERROR); |
| 43 | 46 | } |
| 44 | 47 | |
@@ -71,9 +74,12 @@ discard block |
||
| 71 | 74 | */ |
| 72 | 75 | public function validateAdditionalFields(array &$submittedData, \TYPO3\CMS\Scheduler\Controller\SchedulerModuleController $parentObject) |
| 73 | 76 | { |
| 74 | - try { |
|
| 77 | + try |
|
| 78 | + { |
|
| 75 | 79 | return $this->validateFields($submittedData, $parentObject); |
| 76 | - } catch(\Exception $e) { |
|
| 80 | + } |
|
| 81 | + catch(\Exception $e) |
|
| 82 | + { |
|
| 77 | 83 | $this->addMessage($e->getMessage(), \TYPO3\CMS\Core\Messaging\AbstractMessage::ERROR); |
| 78 | 84 | } |
| 79 | 85 | |
@@ -18,7 +18,7 @@ discard block |
||
| 18 | 18 | |
| 19 | 19 | public function tearDown() |
| 20 | 20 | { |
| 21 | - unset($this->object); |
|
| 21 | + unset( $this->object ); |
|
| 22 | 22 | } |
| 23 | 23 | |
| 24 | 24 | |
@@ -29,6 +29,6 @@ discard block |
||
| 29 | 29 | { |
| 30 | 30 | $result = $this->object->execute(); |
| 31 | 31 | |
| 32 | - $this->assertTrue($result); |
|
| 32 | + $this->assertTrue( $result ); |
|
| 33 | 33 | } |
| 34 | 34 | } |
@@ -165,9 +165,11 @@ |
||
| 165 | 165 | $header = (string) $client->header($uid); |
| 166 | 166 | $html = (string) $client->body($uid); |
| 167 | 167 | |
| 168 | - if (!isset($this->responseFactory)) // TYPO3 10 |
|
| 168 | + if (!isset($this->responseFactory)) { |
|
| 169 | + // TYPO3 10 |
|
| 169 | 170 | { |
| 170 | 171 | $this->response->addAdditionalHeaderData($header); |
| 172 | + } |
|
| 171 | 173 | return $html; |
| 172 | 174 | } |
| 173 | 175 | |
@@ -35,15 +35,15 @@ discard block |
||
| 35 | 35 | * @return bool True if the user is allowed to access the site |
| 36 | 36 | * @throws \TYPO3\CMS\Core\Resource\Exception\InsufficientUserPermissionsException If user doesn't have access |
| 37 | 37 | */ |
| 38 | - protected function checkSite(array $sitePath, $userSiteId) : bool |
|
| 38 | + protected function checkSite( array $sitePath, $userSiteId ) : bool |
|
| 39 | 39 | { |
| 40 | - foreach (array_reverse($sitePath) as $siteid) { |
|
| 41 | - if ((string) $userSiteId === (string) $siteid) { |
|
| 40 | + foreach( array_reverse( $sitePath ) as $siteid ) { |
|
| 41 | + if( (string) $userSiteId === (string) $siteid ) { |
|
| 42 | 42 | return true; |
| 43 | 43 | } |
| 44 | 44 | } |
| 45 | 45 | |
| 46 | - throw new \TYPO3\CMS\Core\Resource\Exception\InsufficientUserPermissionsException('Access not allowed'); |
|
| 46 | + throw new \TYPO3\CMS\Core\Resource\Exception\InsufficientUserPermissionsException( 'Access not allowed' ); |
|
| 47 | 47 | } |
| 48 | 48 | |
| 49 | 49 | |
@@ -54,33 +54,33 @@ discard block |
||
| 54 | 54 | * @param bool $withView True to add view to context object, false for no view |
| 55 | 55 | * @return \Aimeos\MShop\ContextIface Context item |
| 56 | 56 | */ |
| 57 | - protected function context(string $templatePath = 'client/html/templates', |
|
| 58 | - bool $withView = true) : \Aimeos\MShop\ContextIface |
|
| 57 | + protected function context( string $templatePath = 'client/html/templates', |
|
| 58 | + bool $withView = true ) : \Aimeos\MShop\ContextIface |
|
| 59 | 59 | { |
| 60 | - $config = Base::config((array) $this->settings); |
|
| 60 | + $config = Base::config( (array) $this->settings ); |
|
| 61 | 61 | |
| 62 | - if (!isset(self::$context)) { |
|
| 63 | - $context = Base::context($config); |
|
| 64 | - $locale = Base::locale($context, $this->request); |
|
| 65 | - $context->setI18n(Base::i18n([$locale->getLanguageId()], $config->get('i18n', []))); |
|
| 66 | - $context->setLocale($locale); |
|
| 62 | + if( !isset( self::$context ) ) { |
|
| 63 | + $context = Base::context( $config ); |
|
| 64 | + $locale = Base::locale( $context, $this->request ); |
|
| 65 | + $context->setI18n( Base::i18n( [$locale->getLanguageId()], $config->get( 'i18n', [] ) ) ); |
|
| 66 | + $context->setLocale( $locale ); |
|
| 67 | 67 | |
| 68 | 68 | self::$context = $context; |
| 69 | 69 | } |
| 70 | 70 | |
| 71 | 71 | // Use plugin specific configuration |
| 72 | - self::$context->setConfig($config); |
|
| 72 | + self::$context->setConfig( $config ); |
|
| 73 | 73 | |
| 74 | - foreach (self::$context->locale()->getSiteItem()->getConfig() as $key => $value) { |
|
| 75 | - $config->set($key, $value); |
|
| 74 | + foreach( self::$context->locale()->getSiteItem()->getConfig() as $key => $value ) { |
|
| 75 | + $config->set( $key, $value ); |
|
| 76 | 76 | } |
| 77 | 77 | |
| 78 | - if ($withView === true) { |
|
| 78 | + if( $withView === true ) { |
|
| 79 | 79 | $langid = self::$context->locale()->getLanguageId(); |
| 80 | - $paths = Base::aimeos()->getTemplatePaths($templatePath); |
|
| 81 | - $view = Base::view(self::$context, $this->uriBuilder, $paths, $this->request, $langid); |
|
| 80 | + $paths = Base::aimeos()->getTemplatePaths( $templatePath ); |
|
| 81 | + $view = Base::view( self::$context, $this->uriBuilder, $paths, $this->request, $langid ); |
|
| 82 | 82 | |
| 83 | - self::$context->setView($view); |
|
| 83 | + self::$context->setView( $view ); |
|
| 84 | 84 | } |
| 85 | 85 | |
| 86 | 86 | return self::$context; |
@@ -94,48 +94,48 @@ discard block |
||
| 94 | 94 | * @param bool $withView True to add view to context object, false for no view |
| 95 | 95 | * @return \Aimeos\MShop\ContextIface Context item |
| 96 | 96 | */ |
| 97 | - protected function contextBackend(string $templatePath = 'admin/jqadm/templates', |
|
| 98 | - bool $withView = true) : \Aimeos\MShop\ContextIface |
|
| 97 | + protected function contextBackend( string $templatePath = 'admin/jqadm/templates', |
|
| 98 | + bool $withView = true ) : \Aimeos\MShop\ContextIface |
|
| 99 | 99 | { |
| 100 | - if (!isset($this->contextBE)) { |
|
| 100 | + if( !isset( $this->contextBE ) ) { |
|
| 101 | 101 | $lang = 'en'; |
| 102 | 102 | $site = 'default'; |
| 103 | 103 | |
| 104 | - $config = Base::config((array) $this->settings); |
|
| 105 | - $context = Base::context($config); |
|
| 104 | + $config = Base::config( (array) $this->settings ); |
|
| 105 | + $context = Base::context( $config ); |
|
| 106 | 106 | |
| 107 | - if ($this->request->hasArgument('locale') && ($value = $this->request->getArgument('locale')) != '') { |
|
| 107 | + if( $this->request->hasArgument( 'locale' ) && ( $value = $this->request->getArgument( 'locale' ) ) != '' ) { |
|
| 108 | 108 | $lang = $value; |
| 109 | - } elseif (!in_array($GLOBALS['BE_USER']->uc['lang'] ?? '', ['', 'default'])) { |
|
| 109 | + } elseif( !in_array( $GLOBALS['BE_USER']->uc['lang'] ?? '', ['', 'default'] ) ) { |
|
| 110 | 110 | $lang = $GLOBALS['BE_USER']->uc['lang']; |
| 111 | 111 | } |
| 112 | 112 | |
| 113 | - if ($this->request->hasArgument('site') && ($value = $this->request->getArgument('site')) != '') { |
|
| 113 | + if( $this->request->hasArgument( 'site' ) && ( $value = $this->request->getArgument( 'site' ) ) != '' ) { |
|
| 114 | 114 | $site = $value; |
| 115 | - } elseif (isset($GLOBALS['BE_USER']->user['siteid']) && $GLOBALS['BE_USER']->user['siteid'] != '') { |
|
| 116 | - $siteManager = \Aimeos\MShop::create($context, 'locale/site'); |
|
| 117 | - $siteId = current(array_reverse(explode('.', trim($GLOBALS['BE_USER']->user['siteid'], '.')))); |
|
| 118 | - $site = ($siteId ? $siteManager->get($siteId)->getCode() : 'default'); |
|
| 115 | + } elseif( isset( $GLOBALS['BE_USER']->user['siteid'] ) && $GLOBALS['BE_USER']->user['siteid'] != '' ) { |
|
| 116 | + $siteManager = \Aimeos\MShop::create( $context, 'locale/site' ); |
|
| 117 | + $siteId = current( array_reverse( explode( '.', trim( $GLOBALS['BE_USER']->user['siteid'], '.' ) ) ) ); |
|
| 118 | + $site = ( $siteId ? $siteManager->get( $siteId )->getCode() : 'default' ); |
|
| 119 | 119 | } |
| 120 | 120 | |
| 121 | - $locale = Base::getLocaleBackend($context, $site); |
|
| 122 | - $context->setLocale($locale); |
|
| 121 | + $locale = Base::getLocaleBackend( $context, $site ); |
|
| 122 | + $context->setLocale( $locale ); |
|
| 123 | 123 | |
| 124 | - if (isset($GLOBALS['BE_USER']->user['siteid']) && $GLOBALS['BE_USER']->user['siteid'] != '') { |
|
| 125 | - $this->checkSite($locale->getSitePath(), $GLOBALS['BE_USER']->user['siteid']); |
|
| 124 | + if( isset( $GLOBALS['BE_USER']->user['siteid'] ) && $GLOBALS['BE_USER']->user['siteid'] != '' ) { |
|
| 125 | + $this->checkSite( $locale->getSitePath(), $GLOBALS['BE_USER']->user['siteid'] ); |
|
| 126 | 126 | } |
| 127 | 127 | |
| 128 | - $i18n = Base::i18n([$lang, 'en'], $config->get('i18n', [])); |
|
| 129 | - $context->setI18n($i18n); |
|
| 128 | + $i18n = Base::i18n( [$lang, 'en'], $config->get( 'i18n', [] ) ); |
|
| 129 | + $context->setI18n( $i18n ); |
|
| 130 | 130 | |
| 131 | - foreach ($locale->getSiteItem()->getConfig() as $key => $value) { |
|
| 132 | - $config->set($key, $value); |
|
| 131 | + foreach( $locale->getSiteItem()->getConfig() as $key => $value ) { |
|
| 132 | + $config->set( $key, $value ); |
|
| 133 | 133 | } |
| 134 | 134 | |
| 135 | - if ($withView) { |
|
| 136 | - $paths = Base::aimeos()->getTemplatePaths($templatePath); |
|
| 137 | - $view = Base::view($context, $this->uriBuilder, $paths, $this->request, $lang); |
|
| 138 | - $context->setView($view); |
|
| 135 | + if( $withView ) { |
|
| 136 | + $paths = Base::aimeos()->getTemplatePaths( $templatePath ); |
|
| 137 | + $view = Base::view( $context, $this->uriBuilder, $paths, $this->request, $lang ); |
|
| 138 | + $context->setView( $view ); |
|
| 139 | 139 | } |
| 140 | 140 | |
| 141 | 141 | $this->contextBE = $context; |
@@ -151,31 +151,31 @@ discard block |
||
| 151 | 151 | * @param \Aimeos\Client\Html\Iface $client Html client object (no type hint to prevent reflection) |
| 152 | 152 | * @return string HTML code for inserting into the HTML body |
| 153 | 153 | */ |
| 154 | - protected function getClientOutput(\Aimeos\Client\Html\Iface $client) |
|
| 154 | + protected function getClientOutput( \Aimeos\Client\Html\Iface $client ) |
|
| 155 | 155 | { |
| 156 | 156 | $uid = $this->ceUid; |
| 157 | - if ($GLOBALS['TYPO3_REQUEST'] instanceof \Psr\Http\Message\ServerRequestInterface |
|
| 158 | - && empty($GLOBALS['TYPO3_REQUEST']->getAttribute('routing')) === false |
|
| 157 | + if( $GLOBALS['TYPO3_REQUEST'] instanceof \Psr\Http\Message\ServerRequestInterface |
|
| 158 | + && empty( $GLOBALS['TYPO3_REQUEST']->getAttribute( 'routing' ) ) === false |
|
| 159 | 159 | ) { |
| 160 | - $uid .= '-' . $GLOBALS['TYPO3_REQUEST']->getAttribute('routing')->getPageType(); |
|
| 160 | + $uid .= '-' . $GLOBALS['TYPO3_REQUEST']->getAttribute( 'routing' )->getPageType(); |
|
| 161 | 161 | } |
| 162 | 162 | |
| 163 | - $client->setView($this->context()->view())->init(); |
|
| 164 | - $header = (string) $client->header($uid); |
|
| 165 | - $html = (string) $client->body($uid); |
|
| 163 | + $client->setView( $this->context()->view() )->init(); |
|
| 164 | + $header = (string) $client->header( $uid ); |
|
| 165 | + $html = (string) $client->body( $uid ); |
|
| 166 | 166 | |
| 167 | - if (!isset($this->responseFactory)) // TYPO3 10 |
|
| 167 | + if( !isset( $this->responseFactory ) ) // TYPO3 10 |
|
| 168 | 168 | { |
| 169 | - $this->response->addAdditionalHeaderData($header); |
|
| 169 | + $this->response->addAdditionalHeaderData( $header ); |
|
| 170 | 170 | return $html; |
| 171 | 171 | } |
| 172 | 172 | |
| 173 | - $renderer = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Core\Page\PageRenderer::class); |
|
| 174 | - $renderer->addHeaderData($header); |
|
| 173 | + $renderer = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance( \TYPO3\CMS\Core\Page\PageRenderer::class ); |
|
| 174 | + $renderer->addHeaderData( $header ); |
|
| 175 | 175 | |
| 176 | 176 | return $this->responseFactory->createResponse() |
| 177 | - ->withAddedHeader('Content-Type', 'text/html; charset=utf-8') |
|
| 178 | - ->withBody($this->streamFactory->createStream($html)); |
|
| 177 | + ->withAddedHeader( 'Content-Type', 'text/html; charset=utf-8' ) |
|
| 178 | + ->withBody( $this->streamFactory->createStream( $html ) ); |
|
| 179 | 179 | } |
| 180 | 180 | |
| 181 | 181 | |
@@ -184,7 +184,7 @@ discard block |
||
| 184 | 184 | */ |
| 185 | 185 | protected function initializeAction() |
| 186 | 186 | { |
| 187 | - $this->uriBuilder->setArgumentPrefix('ai'); |
|
| 187 | + $this->uriBuilder->setArgumentPrefix( 'ai' ); |
|
| 188 | 188 | |
| 189 | 189 | $ce = $this->configurationManager->getContentObject(); |
| 190 | 190 | $this->ceUid = $ce->data['uid'] ?? null; |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | */ |
| 38 | 38 | public function getIdentifier() : string |
| 39 | 39 | { |
| 40 | - return 'aimeos'; |
|
| 40 | + return 'aimeos'; |
|
| 41 | 41 | } |
| 42 | 42 | |
| 43 | 43 | |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | */ |
| 49 | 49 | public function getTitle() : string |
| 50 | 50 | { |
| 51 | - return 'Aimeos database migration'; |
|
| 51 | + return 'Aimeos database migration'; |
|
| 52 | 52 | } |
| 53 | 53 | |
| 54 | 54 | |
@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | */ |
| 60 | 60 | public function getDescription() : string |
| 61 | 61 | { |
| 62 | - return 'Updates the Aimeos database tables and migrates data if necessary'; |
|
| 62 | + return 'Updates the Aimeos database tables and migrates data if necessary'; |
|
| 63 | 63 | } |
| 64 | 64 | |
| 65 | 65 | |
@@ -70,7 +70,8 @@ discard block |
||
| 70 | 70 | */ |
| 71 | 71 | public function executeUpdate() : bool |
| 72 | 72 | { |
| 73 | - try { |
|
| 73 | + try |
|
| 74 | + { |
|
| 74 | 75 | ob_start(); |
| 75 | 76 | $exectimeStart = microtime(true); |
| 76 | 77 | |
@@ -78,7 +79,9 @@ discard block |
||
| 78 | 79 | |
| 79 | 80 | $this->output->writeln(ob_get_clean()); |
| 80 | 81 | $this->output->writeln(sprintf('Setup process lasted %1$f sec', (microtime(true) - $exectimeStart))); |
| 81 | - } catch(\Throwable $t) { |
|
| 82 | + } |
|
| 83 | + catch(\Throwable $t) |
|
| 84 | + { |
|
| 82 | 85 | $this->output->writeln(ob_get_clean()); |
| 83 | 86 | $this->output->writeln($t->getMessage()); |
| 84 | 87 | $this->output->writeln($t->getTraceAsString()); |
@@ -174,7 +177,8 @@ discard block |
||
| 174 | 177 | |
| 175 | 178 | $tables = []; |
| 176 | 179 | foreach(['fe_users_', 'madmin_', 'mshop_'] as $prefix) { |
| 177 | - switch ($adapter) { |
|
| 180 | + switch ($adapter) |
|
| 181 | + { |
|
| 178 | 182 | case "pgsql": $sql = 'SELECT tablename FROM pg_catalog.pg_tables where tablename ~ \'^' . $prefix . '\''; break; |
| 179 | 183 | default: $sql = 'SHOW TABLES like \'' . $prefix . '%\''; |
| 180 | 184 | } |
@@ -187,7 +191,8 @@ discard block |
||
| 187 | 191 | } |
| 188 | 192 | |
| 189 | 193 | foreach($tables as $table) { |
| 190 | - switch ($adapter) { |
|
| 194 | + switch ($adapter) |
|
| 195 | + { |
|
| 191 | 196 | case "pgsql": $sql = 'CREATE TABLE IF NOT EXISTS ' . $table . '()'; break; |
| 192 | 197 | default: $sql = 'SHOW CREATE TABLE `' . $table . '`'; |
| 193 | 198 | } |
@@ -72,16 +72,16 @@ discard block |
||
| 72 | 72 | { |
| 73 | 73 | try { |
| 74 | 74 | ob_start(); |
| 75 | - $exectimeStart = microtime(true); |
|
| 75 | + $exectimeStart = microtime( true ); |
|
| 76 | 76 | |
| 77 | 77 | self::execute(); |
| 78 | 78 | |
| 79 | - $this->output->writeln(ob_get_clean()); |
|
| 80 | - $this->output->writeln(sprintf('Setup process lasted %1$f sec', (microtime(true) - $exectimeStart))); |
|
| 81 | - } catch(\Throwable $t) { |
|
| 82 | - $this->output->writeln(ob_get_clean()); |
|
| 83 | - $this->output->writeln($t->getMessage()); |
|
| 84 | - $this->output->writeln($t->getTraceAsString()); |
|
| 79 | + $this->output->writeln( ob_get_clean() ); |
|
| 80 | + $this->output->writeln( sprintf( 'Setup process lasted %1$f sec', ( microtime( true ) - $exectimeStart ) ) ); |
|
| 81 | + } catch( \Throwable $t ) { |
|
| 82 | + $this->output->writeln( ob_get_clean() ); |
|
| 83 | + $this->output->writeln( $t->getMessage() ); |
|
| 84 | + $this->output->writeln( $t->getTraceAsString() ); |
|
| 85 | 85 | |
| 86 | 86 | return false; |
| 87 | 87 | } |
@@ -106,7 +106,7 @@ discard block |
||
| 106 | 106 | * |
| 107 | 107 | * @param OutputInterface $output |
| 108 | 108 | */ |
| 109 | - public function setOutput(OutputInterface $output) : void |
|
| 109 | + public function setOutput( OutputInterface $output ) : void |
|
| 110 | 110 | { |
| 111 | 111 | $this->output = $output; |
| 112 | 112 | } |
@@ -128,26 +128,26 @@ discard block |
||
| 128 | 128 | */ |
| 129 | 129 | public static function execute() |
| 130 | 130 | { |
| 131 | - ini_set('max_execution_time', 0); |
|
| 131 | + ini_set( 'max_execution_time', 0 ); |
|
| 132 | 132 | |
| 133 | - $extconf = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Configuration\ExtensionConfiguration::class); |
|
| 134 | - $demo = $extconf->get('aimeos', 'useDemoData') ?: false; |
|
| 133 | + $extconf = GeneralUtility::makeInstance( \TYPO3\CMS\Core\Configuration\ExtensionConfiguration::class ); |
|
| 134 | + $demo = $extconf->get( 'aimeos', 'useDemoData' ) ?: false; |
|
| 135 | 135 | |
| 136 | - \Aimeos\MShop::cache(false); |
|
| 137 | - \Aimeos\MAdmin::cache(false); |
|
| 136 | + \Aimeos\MShop::cache( false ); |
|
| 137 | + \Aimeos\MAdmin::cache( false ); |
|
| 138 | 138 | |
| 139 | - $site = $extconf->get('aimeos', 'siteCode') ?: 'default'; |
|
| 140 | - $template = $extconf->get('aimeos', 'siteTpl') ?: 'default'; |
|
| 141 | - $codelen = $extconf->get('aimeos', 'codeLength') ?: 64; |
|
| 139 | + $site = $extconf->get( 'aimeos', 'siteCode' ) ?: 'default'; |
|
| 140 | + $template = $extconf->get( 'aimeos', 'siteTpl' ) ?: 'default'; |
|
| 141 | + $codelen = $extconf->get( 'aimeos', 'codeLength' ) ?: 64; |
|
| 142 | 142 | |
| 143 | 143 | $boostrap = \Aimeos\Aimeos\Base::aimeos(); |
| 144 | - $ctx = self::context(['setup' => ['default' => ['demo' => (string) $demo]]])->setEditor('setup'); |
|
| 144 | + $ctx = self::context( ['setup' => ['default' => ['demo' => (string) $demo]]] )->setEditor( 'setup' ); |
|
| 145 | 145 | |
| 146 | - \Aimeos\Setup::use($boostrap, ['codelength' => $codelen])->verbose('vvv') |
|
| 147 | - ->context($ctx->setEditor('aimeos:setup')) |
|
| 148 | - ->up($site, $template); |
|
| 146 | + \Aimeos\Setup::use( $boostrap, ['codelength' => $codelen] )->verbose( 'vvv' ) |
|
| 147 | + ->context( $ctx->setEditor( 'aimeos:setup' ) ) |
|
| 148 | + ->up( $site, $template ); |
|
| 149 | 149 | |
| 150 | - $extconf->set('aimeos', ['useDemoData' => '']); |
|
| 150 | + $extconf->set( 'aimeos', ['useDemoData' => ''] ); |
|
| 151 | 151 | } |
| 152 | 152 | |
| 153 | 153 | |
@@ -157,45 +157,45 @@ discard block |
||
| 157 | 157 | * @param array $list List of SQL statements |
| 158 | 158 | * @return array SQL statements required for the install tool |
| 159 | 159 | */ |
| 160 | - public static function schema(array $list) : array |
|
| 160 | + public static function schema( array $list ) : array |
|
| 161 | 161 | { |
| 162 | 162 | $ctx = self::context(); |
| 163 | - $connectionNames = array_keys($ctx->config()->get( 'resource')); |
|
| 164 | - $connectionNames = array_filter($connectionNames, fn (string $key): bool => str_starts_with($key, 'db')); |
|
| 163 | + $connectionNames = array_keys( $ctx->config()->get( 'resource' ) ); |
|
| 164 | + $connectionNames = array_filter( $connectionNames, fn ( string $key ): bool => str_starts_with( $key, 'db' ) ); |
|
| 165 | 165 | |
| 166 | - foreach ($connectionNames as $connectionName) { |
|
| 167 | - $conn = $ctx->db($connectionName); |
|
| 168 | - $adapter = $ctx->config('resource/' . $connectionName . '/adapter'); |
|
| 166 | + foreach( $connectionNames as $connectionName ) { |
|
| 167 | + $conn = $ctx->db( $connectionName ); |
|
| 168 | + $adapter = $ctx->config( 'resource/' . $connectionName . '/adapter' ); |
|
| 169 | 169 | |
| 170 | 170 | $tables = []; |
| 171 | - foreach(['fe_users_', 'madmin_', 'mshop_'] as $prefix) { |
|
| 172 | - switch ($adapter) { |
|
| 171 | + foreach( ['fe_users_', 'madmin_', 'mshop_'] as $prefix ) { |
|
| 172 | + switch( $adapter ) { |
|
| 173 | 173 | case "pgsql": $sql = 'SELECT tablename FROM pg_catalog.pg_tables where tablename ~ \'^' . $prefix . '\''; break; |
| 174 | 174 | default: $sql = 'SHOW TABLES like \'' . $prefix . '%\''; |
| 175 | 175 | } |
| 176 | 176 | |
| 177 | - $result = $conn->create($sql)->execute(); |
|
| 177 | + $result = $conn->create( $sql )->execute(); |
|
| 178 | 178 | |
| 179 | - while(($row = $result->fetch(\Aimeos\Base\DB\Result\Base::FETCH_NUM)) !== null) { |
|
| 179 | + while( ( $row = $result->fetch( \Aimeos\Base\DB\Result\Base::FETCH_NUM ) ) !== null ) { |
|
| 180 | 180 | $tables[] = $row[0]; |
| 181 | 181 | } |
| 182 | 182 | } |
| 183 | 183 | |
| 184 | - foreach($tables as $table) { |
|
| 185 | - switch ($adapter) { |
|
| 184 | + foreach( $tables as $table ) { |
|
| 185 | + switch( $adapter ) { |
|
| 186 | 186 | case "pgsql": $sql = 'CREATE TABLE IF NOT EXISTS ' . $table . '()'; break; |
| 187 | 187 | default: $sql = 'SHOW CREATE TABLE `' . $table . '`'; |
| 188 | 188 | } |
| 189 | 189 | |
| 190 | - $result = $conn->create($sql)->execute(); |
|
| 190 | + $result = $conn->create( $sql )->execute(); |
|
| 191 | 191 | |
| 192 | - while(($row = $result->fetch(\Aimeos\Base\DB\Result\Base::FETCH_NUM)) !== null) { |
|
| 192 | + while( ( $row = $result->fetch( \Aimeos\Base\DB\Result\Base::FETCH_NUM ) ) !== null ) { |
|
| 193 | 193 | $str = $row[1]; |
| 194 | 194 | |
| 195 | - $str = str_replace('"', '`', $str); |
|
| 196 | - $str = preg_replace('/CONSTRAINT `[a-zA-Z0-9_-]+` /', '', $str); |
|
| 197 | - $str = preg_replace('/ DEFAULT CHARSET=[^ ;]+/', '', $str); |
|
| 198 | - $str = preg_replace('/ COLLATE=[^ ;]+/', '', $str); |
|
| 195 | + $str = str_replace( '"', '`', $str ); |
|
| 196 | + $str = preg_replace( '/CONSTRAINT `[a-zA-Z0-9_-]+` /', '', $str ); |
|
| 197 | + $str = preg_replace( '/ DEFAULT CHARSET=[^ ;]+/', '', $str ); |
|
| 198 | + $str = preg_replace( '/ COLLATE=[^ ;]+/', '', $str ); |
|
| 199 | 199 | |
| 200 | 200 | $list[] = $str . ";\n"; |
| 201 | 201 | } |
@@ -211,12 +211,12 @@ discard block |
||
| 211 | 211 | * |
| 212 | 212 | * @param AlterTableDefinitionStatementsEvent $event Event object |
| 213 | 213 | */ |
| 214 | - public function schemaEvent(AlterTableDefinitionStatementsEvent $event) |
|
| 214 | + public function schemaEvent( AlterTableDefinitionStatementsEvent $event ) |
|
| 215 | 215 | { |
| 216 | - $list = self::schema([]); |
|
| 216 | + $list = self::schema( [] ); |
|
| 217 | 217 | |
| 218 | - foreach ($list['sqlString'] ?? [] as $sql) { |
|
| 219 | - $event->addSqlData($sql); |
|
| 218 | + foreach( $list['sqlString'] ?? [] as $sql ) { |
|
| 219 | + $event->addSqlData( $sql ); |
|
| 220 | 220 | } |
| 221 | 221 | } |
| 222 | 222 | |
@@ -226,9 +226,9 @@ discard block |
||
| 226 | 226 | * |
| 227 | 227 | * @param AfterPackageActivationEvent $event Event object |
| 228 | 228 | */ |
| 229 | - public function setupEvent(AfterPackageActivationEvent $event) |
|
| 229 | + public function setupEvent( AfterPackageActivationEvent $event ) |
|
| 230 | 230 | { |
| 231 | - if ($event->getPackageKey() === 'aimeos' && \Aimeos\Aimeos\Base::getExtConfig('autoSetup', true)) { |
|
| 231 | + if( $event->getPackageKey() === 'aimeos' && \Aimeos\Aimeos\Base::getExtConfig( 'autoSetup', true ) ) { |
|
| 232 | 232 | self::execute(); |
| 233 | 233 | } |
| 234 | 234 | } |
@@ -240,34 +240,34 @@ discard block |
||
| 240 | 240 | * @param array $config Nested array of configuration settings |
| 241 | 241 | * @return \Aimeos\MShop\ContextIface Context object |
| 242 | 242 | */ |
| 243 | - protected static function context(array $config = []) : \Aimeos\MShop\ContextIface |
|
| 243 | + protected static function context( array $config = [] ) : \Aimeos\MShop\ContextIface |
|
| 244 | 244 | { |
| 245 | - $aimeosExtPath = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath('aimeos'); |
|
| 245 | + $aimeosExtPath = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath( 'aimeos' ); |
|
| 246 | 246 | |
| 247 | - if (file_exists($aimeosExtPath . '/Resources/Libraries/autoload.php') === true) { |
|
| 247 | + if( file_exists( $aimeosExtPath . '/Resources/Libraries/autoload.php' ) === true ) { |
|
| 248 | 248 | require_once $aimeosExtPath . '/Resources/Libraries/autoload.php'; |
| 249 | 249 | } |
| 250 | 250 | |
| 251 | 251 | $ctx = new \Aimeos\MShop\Context(); |
| 252 | - $conf = \Aimeos\Aimeos\Base::config($config); |
|
| 252 | + $conf = \Aimeos\Aimeos\Base::config( $config ); |
|
| 253 | 253 | |
| 254 | - $ctx->setConfig($conf); |
|
| 255 | - $ctx->setDatabaseManager(new \Aimeos\Base\DB\Manager\Standard($conf->get('resource', []), 'DBAL')); |
|
| 256 | - $ctx->setFilesystemManager(new \Aimeos\Base\Filesystem\Manager\Standard($conf->get('resource', []))); |
|
| 257 | - $ctx->setLogger(new \Aimeos\Base\Logger\Errorlog(\Aimeos\Base\Logger\Iface::INFO)); |
|
| 258 | - $ctx->setSession(new \Aimeos\Base\Session\None()); |
|
| 259 | - $ctx->setCache(new \Aimeos\Base\Cache\None()); |
|
| 254 | + $ctx->setConfig( $conf ); |
|
| 255 | + $ctx->setDatabaseManager( new \Aimeos\Base\DB\Manager\Standard( $conf->get( 'resource', [] ), 'DBAL' ) ); |
|
| 256 | + $ctx->setFilesystemManager( new \Aimeos\Base\Filesystem\Manager\Standard( $conf->get( 'resource', [] ) ) ); |
|
| 257 | + $ctx->setLogger( new \Aimeos\Base\Logger\Errorlog( \Aimeos\Base\Logger\Iface::INFO ) ); |
|
| 258 | + $ctx->setSession( new \Aimeos\Base\Session\None() ); |
|
| 259 | + $ctx->setCache( new \Aimeos\Base\Cache\None() ); |
|
| 260 | 260 | |
| 261 | 261 | // Reset before child processes are spawned to avoid lost DB connections afterwards (TYPO3 9.4 and above) |
| 262 | - if (php_sapi_name() === 'cli' && class_exists('\TYPO3\CMS\Core\Database\ConnectionPool') |
|
| 263 | - && method_exists('\TYPO3\CMS\Core\Database\ConnectionPool', 'resetConnections') |
|
| 262 | + if( php_sapi_name() === 'cli' && class_exists( '\TYPO3\CMS\Core\Database\ConnectionPool' ) |
|
| 263 | + && method_exists( '\TYPO3\CMS\Core\Database\ConnectionPool', 'resetConnections' ) |
|
| 264 | 264 | ) { |
| 265 | - $ctx->setProcess(new \Aimeos\Base\Process\Pcntl(\Aimeos\Aimeos\Base::getExtConfig('pcntlMax', 4))); |
|
| 265 | + $ctx->setProcess( new \Aimeos\Base\Process\Pcntl( \Aimeos\Aimeos\Base::getExtConfig( 'pcntlMax', 4 ) ) ); |
|
| 266 | 266 | } else { |
| 267 | - $ctx->setProcess(new \Aimeos\Base\Process\None()); |
|
| 267 | + $ctx->setProcess( new \Aimeos\Base\Process\None() ); |
|
| 268 | 268 | } |
| 269 | 269 | |
| 270 | - $factory = GeneralUtility::makeInstance('TYPO3\CMS\Core\Crypto\PasswordHashing\PasswordHashFactory'); |
|
| 271 | - return $ctx->setPassword(new \Aimeos\Base\Password\Typo3($factory->getDefaultHashInstance('FE'))); |
|
| 270 | + $factory = GeneralUtility::makeInstance( 'TYPO3\CMS\Core\Crypto\PasswordHashing\PasswordHashFactory' ); |
|
| 271 | + return $ctx->setPassword( new \Aimeos\Base\Password\Typo3( $factory->getDefaultHashInstance( 'FE' ) ) ); |
|
| 272 | 272 | } |
| 273 | 273 | } |
@@ -1,89 +1,89 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | 3 | return array( |
| 4 | - 'jqadm' => array( |
|
| 5 | - 'url' => array( |
|
| 6 | - 'batch' => array( |
|
| 7 | - 'controller' => 'Jqadm', |
|
| 8 | - 'action' => 'batch', |
|
| 9 | - 'config' => array( |
|
| 10 | - 'BE' => true, |
|
| 11 | - ), |
|
| 12 | - ), |
|
| 13 | - 'copy' => array( |
|
| 14 | - 'controller' => 'Jqadm', |
|
| 15 | - 'action' => 'copy', |
|
| 16 | - 'config' => array( |
|
| 17 | - 'BE' => true, |
|
| 18 | - ), |
|
| 19 | - ), |
|
| 20 | - 'create' => array( |
|
| 21 | - 'controller' => 'Jqadm', |
|
| 22 | - 'action' => 'create', |
|
| 23 | - 'config' => array( |
|
| 24 | - 'BE' => true, |
|
| 25 | - ), |
|
| 26 | - ), |
|
| 27 | - 'delete' => array( |
|
| 28 | - 'controller' => 'Jqadm', |
|
| 29 | - 'action' => 'delete', |
|
| 30 | - 'config' => array( |
|
| 31 | - 'BE' => true, |
|
| 32 | - ), |
|
| 33 | - ), |
|
| 34 | - 'export' => array( |
|
| 35 | - 'controller' => 'Jqadm', |
|
| 36 | - 'action' => 'export', |
|
| 37 | - 'config' => array( |
|
| 38 | - 'BE' => true, |
|
| 39 | - ), |
|
| 40 | - ), |
|
| 41 | - 'get' => array( |
|
| 42 | - 'controller' => 'Jqadm', |
|
| 43 | - 'action' => 'get', |
|
| 44 | - 'config' => array( |
|
| 45 | - 'BE' => true, |
|
| 46 | - ), |
|
| 47 | - ), |
|
| 48 | - 'import' => array( |
|
| 49 | - 'controller' => 'Jqadm', |
|
| 50 | - 'action' => 'import', |
|
| 51 | - 'config' => array( |
|
| 52 | - 'BE' => true, |
|
| 53 | - ), |
|
| 54 | - ), |
|
| 55 | - 'save' => array( |
|
| 56 | - 'controller' => 'Jqadm', |
|
| 57 | - 'action' => 'save', |
|
| 58 | - 'config' => array( |
|
| 59 | - 'BE' => true, |
|
| 60 | - ), |
|
| 61 | - ), |
|
| 62 | - 'search' => array( |
|
| 63 | - 'controller' => 'Jqadm', |
|
| 64 | - 'action' => 'search', |
|
| 65 | - 'config' => array( |
|
| 66 | - 'BE' => true, |
|
| 67 | - ), |
|
| 68 | - ), |
|
| 69 | - ), |
|
| 70 | - ), |
|
| 71 | - 'jsonadm' => array( |
|
| 72 | - 'url' => array( |
|
| 73 | - 'controller' => 'Jsonadm', |
|
| 74 | - 'action' => 'index', |
|
| 75 | - 'config' => array( |
|
| 76 | - 'absoluteUri' => true, |
|
| 77 | - 'BE' => true, |
|
| 78 | - ), |
|
| 79 | - 'options' => array( |
|
| 80 | - 'controller' => 'Jsonadm', |
|
| 81 | - 'action' => 'index', |
|
| 82 | - 'config' => array( |
|
| 83 | - 'absoluteUri' => true, |
|
| 84 | - 'BE' => true, |
|
| 85 | - ), |
|
| 86 | - ), |
|
| 87 | - ), |
|
| 88 | - ), |
|
| 4 | + 'jqadm' => array( |
|
| 5 | + 'url' => array( |
|
| 6 | + 'batch' => array( |
|
| 7 | + 'controller' => 'Jqadm', |
|
| 8 | + 'action' => 'batch', |
|
| 9 | + 'config' => array( |
|
| 10 | + 'BE' => true, |
|
| 11 | + ), |
|
| 12 | + ), |
|
| 13 | + 'copy' => array( |
|
| 14 | + 'controller' => 'Jqadm', |
|
| 15 | + 'action' => 'copy', |
|
| 16 | + 'config' => array( |
|
| 17 | + 'BE' => true, |
|
| 18 | + ), |
|
| 19 | + ), |
|
| 20 | + 'create' => array( |
|
| 21 | + 'controller' => 'Jqadm', |
|
| 22 | + 'action' => 'create', |
|
| 23 | + 'config' => array( |
|
| 24 | + 'BE' => true, |
|
| 25 | + ), |
|
| 26 | + ), |
|
| 27 | + 'delete' => array( |
|
| 28 | + 'controller' => 'Jqadm', |
|
| 29 | + 'action' => 'delete', |
|
| 30 | + 'config' => array( |
|
| 31 | + 'BE' => true, |
|
| 32 | + ), |
|
| 33 | + ), |
|
| 34 | + 'export' => array( |
|
| 35 | + 'controller' => 'Jqadm', |
|
| 36 | + 'action' => 'export', |
|
| 37 | + 'config' => array( |
|
| 38 | + 'BE' => true, |
|
| 39 | + ), |
|
| 40 | + ), |
|
| 41 | + 'get' => array( |
|
| 42 | + 'controller' => 'Jqadm', |
|
| 43 | + 'action' => 'get', |
|
| 44 | + 'config' => array( |
|
| 45 | + 'BE' => true, |
|
| 46 | + ), |
|
| 47 | + ), |
|
| 48 | + 'import' => array( |
|
| 49 | + 'controller' => 'Jqadm', |
|
| 50 | + 'action' => 'import', |
|
| 51 | + 'config' => array( |
|
| 52 | + 'BE' => true, |
|
| 53 | + ), |
|
| 54 | + ), |
|
| 55 | + 'save' => array( |
|
| 56 | + 'controller' => 'Jqadm', |
|
| 57 | + 'action' => 'save', |
|
| 58 | + 'config' => array( |
|
| 59 | + 'BE' => true, |
|
| 60 | + ), |
|
| 61 | + ), |
|
| 62 | + 'search' => array( |
|
| 63 | + 'controller' => 'Jqadm', |
|
| 64 | + 'action' => 'search', |
|
| 65 | + 'config' => array( |
|
| 66 | + 'BE' => true, |
|
| 67 | + ), |
|
| 68 | + ), |
|
| 69 | + ), |
|
| 70 | + ), |
|
| 71 | + 'jsonadm' => array( |
|
| 72 | + 'url' => array( |
|
| 73 | + 'controller' => 'Jsonadm', |
|
| 74 | + 'action' => 'index', |
|
| 75 | + 'config' => array( |
|
| 76 | + 'absoluteUri' => true, |
|
| 77 | + 'BE' => true, |
|
| 78 | + ), |
|
| 79 | + 'options' => array( |
|
| 80 | + 'controller' => 'Jsonadm', |
|
| 81 | + 'action' => 'index', |
|
| 82 | + 'config' => array( |
|
| 83 | + 'absoluteUri' => true, |
|
| 84 | + 'BE' => true, |
|
| 85 | + ), |
|
| 86 | + ), |
|
| 87 | + ), |
|
| 88 | + ), |
|
| 89 | 89 | ); |
@@ -1,13 +1,13 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | 3 | return array( |
| 4 | - 'common' => array( |
|
| 5 | - 'media' => array( |
|
| 6 | - // Mime icon related settings |
|
| 7 | - 'mimeicon' => array( |
|
| 8 | - // File extension of mime type icons |
|
| 9 | - 'extension' => '.png', |
|
| 10 | - ), |
|
| 11 | - ), |
|
| 12 | - ), |
|
| 4 | + 'common' => array( |
|
| 5 | + 'media' => array( |
|
| 6 | + // Mime icon related settings |
|
| 7 | + 'mimeicon' => array( |
|
| 8 | + // File extension of mime type icons |
|
| 9 | + 'extension' => '.png', |
|
| 10 | + ), |
|
| 11 | + ), |
|
| 12 | + ), |
|
| 13 | 13 | ); |