Passed
Push — master ( d3671c...b2bc4e )
by Aimeos
05:29 queued 02:07
created
Classes/Scheduler/Task/Email6.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -44,56 +44,56 @@
 block discarded – undo
44 44
     {
45 45
         $conf = [];
46 46
 
47
-        if (!isset($conf['client']['html']['catalog']['detail']['url']['config']['absoluteUri'])) {
47
+        if( !isset( $conf['client']['html']['catalog']['detail']['url']['config']['absoluteUri'] ) ) {
48 48
             $conf['client']['html']['catalog']['detail']['url']['config']['absoluteUri'] = 1;
49 49
         }
50 50
 
51
-        if (!isset($conf['client']['html']['account']['download']['url']['config']['absoluteUri'])) {
51
+        if( !isset( $conf['client']['html']['account']['download']['url']['config']['absoluteUri'] ) ) {
52 52
             $conf['client']['html']['account']['download']['url']['config']['absoluteUri'] = 1;
53 53
         }
54 54
 
55
-        if ($this->{$this->fieldSenderFrom} != '') {
55
+        if( $this->{$this->fieldSenderFrom} != '' ) {
56 56
             $conf['resource']['email']['from-name'] = $this->{$this->fieldSenderFrom};
57 57
         }
58 58
 
59
-        if ($this->{$this->fieldSenderEmail} != '') {
59
+        if( $this->{$this->fieldSenderEmail} != '' ) {
60 60
             $conf['resource']['email']['from-email'] = $this->{$this->fieldSenderEmail};
61 61
         }
62 62
 
63
-        if ($this->{$this->fieldReplyEmail} != '') {
63
+        if( $this->{$this->fieldReplyEmail} != '' ) {
64 64
             $conf['resource']['email']['reply-email'] = $this->{$this->fieldReplyEmail};
65 65
         }
66 66
 
67
-        if ($this->{$this->fieldPageCatalog} != '') {
67
+        if( $this->{$this->fieldPageCatalog} != '' ) {
68 68
             $conf['client']['html']['catalog']['lists']['url']['target'] = $this->{$this->fieldPageCatalog};
69 69
         }
70 70
 
71
-        if ($this->{$this->fieldPageDetail} != '') {
71
+        if( $this->{$this->fieldPageDetail} != '' ) {
72 72
             $conf['client']['html']['catalog']['detail']['url']['target'] = $this->{$this->fieldPageDetail};
73 73
         }
74 74
 
75
-        if ($this->{$this->fieldPageDownload} != '') {
75
+        if( $this->{$this->fieldPageDownload} != '' ) {
76 76
             $conf['client']['html']['account']['download']['url']['target'] = $this->{$this->fieldPageDownload};
77 77
         }
78 78
 
79
-        if ($this->{$this->fieldPageLogin} != '') {
79
+        if( $this->{$this->fieldPageLogin} != '' ) {
80 80
             $conf['client']['html']['account']['index']['url']['target'] = $this->{$this->fieldPageLogin};
81 81
         }
82 82
 
83
-        if ($this->{$this->fieldTemplateBaseurl} != '') {
83
+        if( $this->{$this->fieldTemplateBaseurl} != '' ) {
84 84
             $themeDir = $this->{$this->fieldTemplateBaseurl};
85 85
 
86
-            if ($themeDir[0] !== '/') {
87
-                $themeDir = realpath(\TYPO3\CMS\Core\Core\Environment::getPublicPath() . '/' . $themeDir);
86
+            if( $themeDir[0] !== '/' ) {
87
+                $themeDir = realpath( \TYPO3\CMS\Core\Core\Environment::getPublicPath() . '/' . $themeDir );
88 88
             }
89 89
 
90 90
             $conf['resource']['fs-theme']['basedir'] = $themeDir;
91 91
         }
92 92
 
93
-        $tsconf = Base::parseTS($this->{$this->fieldTSconfig});
93
+        $tsconf = Base::parseTS( $this->{$this->fieldTSconfig});
94 94
         $jobs = (array) $this->{$this->fieldController};
95 95
 
96
-        Scheduler\Base::execute($tsconf, $conf, $jobs, $this->{$this->fieldSite}, $this->{$this->fieldPageDetail});
96
+        Scheduler\Base::execute( $tsconf, $conf, $jobs, $this->{$this->fieldSite}, $this->{$this->fieldPageDetail});
97 97
 
98 98
         return true;
99 99
     }
Please login to merge, or discard this patch.
Classes/Scheduler/Base.php 1 patch
Spacing   +42 added lines, -42 removed lines patch added patch discarded remove patch
@@ -33,33 +33,33 @@  discard block
 block discarded – undo
33 33
      * @param array $jobs List of job names
34 34
      * @param array|string $sites List of site names
35 35
      */
36
-    public static function execute(array $tsconf, array $conf, array $jobs, $sites, ?string $pid = null)
36
+    public static function execute( array $tsconf, array $conf, array $jobs, $sites, ?string $pid = null )
37 37
     {
38 38
         $aimeos = Aimeos\Base::aimeos();
39
-        $context = self::context($tsconf, $conf, $pid);
39
+        $context = self::context( $tsconf, $conf, $pid );
40 40
         $process = $context->process();
41 41
 
42 42
         // Reset before child processes are spawned to avoid lost DB connections afterwards
43
-        GeneralUtility::makeInstance('TYPO3\CMS\Core\Database\ConnectionPool')->resetConnections();
43
+        GeneralUtility::makeInstance( 'TYPO3\CMS\Core\Database\ConnectionPool' )->resetConnections();
44 44
 
45
-        $manager = \Aimeos\MShop::create($context, 'locale');
45
+        $manager = \Aimeos\MShop::create( $context, 'locale' );
46 46
 
47
-        foreach (self::getSiteItems($context, $sites) as $siteItem) {
48
-            \Aimeos\MShop::cache(true);
49
-            \Aimeos\MAdmin::cache(true);
47
+        foreach( self::getSiteItems( $context, $sites ) as $siteItem ) {
48
+            \Aimeos\MShop::cache( true );
49
+            \Aimeos\MAdmin::cache( true );
50 50
 
51
-            $localeItem = $manager->bootstrap($siteItem->getCode(), '', '', false);
52
-            $localeItem->setLanguageId(null);
53
-            $localeItem->setCurrencyId(null);
51
+            $localeItem = $manager->bootstrap( $siteItem->getCode(), '', '', false );
52
+            $localeItem->setLanguageId( null );
53
+            $localeItem->setCurrencyId( null );
54 54
 
55
-            $context->setLocale($localeItem);
55
+            $context->setLocale( $localeItem );
56 56
 
57
-            foreach ($jobs as $jobname) {
58
-                $fcn = function($context, $aimeos, $jobname) {
59
-                    \Aimeos\Controller\Jobs::create($context, $aimeos, $jobname)->run();
57
+            foreach( $jobs as $jobname ) {
58
+                $fcn = function( $context, $aimeos, $jobname ) {
59
+                    \Aimeos\Controller\Jobs::create( $context, $aimeos, $jobname )->run();
60 60
                 };
61 61
 
62
-                $process->start($fcn, [$context, $aimeos, $jobname], false);
62
+                $process->start( $fcn, [$context, $aimeos, $jobname], false );
63 63
             }
64 64
         }
65 65
 
@@ -73,33 +73,33 @@  discard block
 block discarded – undo
73 73
      * @param array $tsconf Multi-dimensional associative list of key/value pairs
74 74
      * @return \Aimeos\MShop\ContextIface Context object
75 75
      */
76
-    public static function context(array $tsconf = [], array $conf = [], ?string $pid = null) : \Aimeos\MShop\ContextIface
76
+    public static function context( array $tsconf = [], array $conf = [], ?string $pid = null ) : \Aimeos\MShop\ContextIface
77 77
     {
78
-        $config = Aimeos\Base::config($tsconf);
79
-        $context = Aimeos\Base::context($config);
80
-        $context->config()->apply($conf);
78
+        $config = Aimeos\Base::config( $tsconf );
79
+        $context = Aimeos\Base::context( $config );
80
+        $context->config()->apply( $conf );
81 81
 
82 82
 
83
-        $langManager = \Aimeos\MShop::create($context, 'locale/language');
84
-        $search = $langManager->filter(true);
83
+        $langManager = \Aimeos\MShop::create( $context, 'locale/language' );
84
+        $search = $langManager->filter( true );
85 85
 
86 86
         $expr = [];
87 87
         $expr[] = $search->getConditions();
88
-        $expr[] = $search->compare('==', 'locale.language.id', 'en'); // default language
88
+        $expr[] = $search->compare( '==', 'locale.language.id', 'en' ); // default language
89 89
 
90
-        if (isset($GLOBALS['BE_USER']->uc['lang']) && $GLOBALS['BE_USER']->uc['lang'] != '') { // BE language
91
-            $expr[] = $search->compare('==', 'locale.language.id', $GLOBALS['BE_USER']->uc['lang']);
90
+        if( isset( $GLOBALS['BE_USER']->uc['lang'] ) && $GLOBALS['BE_USER']->uc['lang'] != '' ) { // BE language
91
+            $expr[] = $search->compare( '==', 'locale.language.id', $GLOBALS['BE_USER']->uc['lang'] );
92 92
         }
93 93
 
94
-        $search->setConditions($search->combine('||', $expr));
95
-        $langids = $langManager->search($search)->keys()->toArray();
94
+        $search->setConditions( $search->combine( '||', $expr ) );
95
+        $langids = $langManager->search( $search )->keys()->toArray();
96 96
 
97
-        $context->setI18n(Aimeos\Base::i18n($langids, (array) ($tsconf['i18n'] ?? [])));
97
+        $context->setI18n( Aimeos\Base::i18n( $langids, (array) ( $tsconf['i18n'] ?? [] ) ) );
98 98
 
99
-        $tmplPaths = Aimeos\Base::aimeos()->getTemplatePaths('controller/jobs/templates');
100
-        $context->setView(Aimeos\Base::view($context, self::getRouter($pid), $tmplPaths));
99
+        $tmplPaths = Aimeos\Base::aimeos()->getTemplatePaths( 'controller/jobs/templates' );
100
+        $context->setView( Aimeos\Base::view( $context, self::getRouter( $pid ), $tmplPaths ) );
101 101
 
102
-        $context->setEditor('scheduler');
102
+        $context->setEditor( 'scheduler' );
103 103
 
104 104
         return $context;
105 105
     }
@@ -112,20 +112,20 @@  discard block
 block discarded – undo
112 112
      * @param array|string $sites Unique site codes
113 113
      * @return \Aimeos\Map List of site items implementing \Aimeos\MShop\Locale\Item\Site\Iface
114 114
      */
115
-    public static function getSiteItems(\Aimeos\MShop\ContextIface $context, $sites) : \Aimeos\Map
115
+    public static function getSiteItems( \Aimeos\MShop\ContextIface $context, $sites ) : \Aimeos\Map
116 116
     {
117
-        if (!is_array($sites)) {
118
-            $sites = explode(' ', $sites);
117
+        if( !is_array( $sites ) ) {
118
+            $sites = explode( ' ', $sites );
119 119
         }
120 120
 
121
-        $manager = \Aimeos\MShop::create($context, 'locale/site');
121
+        $manager = \Aimeos\MShop::create( $context, 'locale/site' );
122 122
         $search = $manager->filter();
123 123
 
124
-        if (!empty($sites)) {
125
-            $search->setConditions($search->compare('==', 'locale.site.code', $sites));
124
+        if( !empty( $sites ) ) {
125
+            $search->setConditions( $search->compare( '==', 'locale.site.code', $sites ) );
126 126
         }
127 127
 
128
-        return $manager->search($search);
128
+        return $manager->search( $search );
129 129
     }
130 130
 
131 131
 
@@ -136,15 +136,15 @@  discard block
 block discarded – undo
136 136
      * @return \TYPO3\CMS\Core\Routing\RouterInterface Page router
137 137
      * @throws \RuntimeException If no site configuraiton is available
138 138
      */
139
-    protected static function getRouter(?string $pid) : \TYPO3\CMS\Core\Routing\RouterInterface
139
+    protected static function getRouter( ?string $pid ) : \TYPO3\CMS\Core\Routing\RouterInterface
140 140
     {
141
-        $siteFinder = GeneralUtility::makeInstance(SiteFinder::class);
142
-        $site = $pid ? $siteFinder->getSiteByPageId($pid) : current($siteFinder->getAllSites());
141
+        $siteFinder = GeneralUtility::makeInstance( SiteFinder::class );
142
+        $site = $pid ? $siteFinder->getSiteByPageId( $pid ) : current( $siteFinder->getAllSites() );
143 143
 
144
-        if ($site) {
144
+        if( $site ) {
145 145
             return $site->getRouter();
146 146
         }
147 147
 
148
-        throw new \RuntimeException('No site configuration found');
148
+        throw new \RuntimeException( 'No site configuration found' );
149 149
     }
150 150
 }
Please login to merge, or discard this patch.
Classes/Scheduler/Provider/Typo6.php 2 patches
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -34,12 +34,12 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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;
Please login to merge, or discard this patch.
Braces   +10 added lines, -4 removed lines patch added patch discarded remove patch
@@ -36,9 +36,12 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 
Please login to merge, or discard this patch.
Classes/Scheduler/Provider/Email.php 1 patch
Spacing   +42 added lines, -42 removed lines patch added patch discarded remove patch
@@ -48,20 +48,20 @@  discard block
 block discarded – undo
48 48
      *            ['cshKey']        => The CSH key for the field
49 49
      *            ['cshLabel']    => The code of the CSH label
50 50
      */
51
-    protected function getFields(array &$taskInfo, $task, $parentObject)
51
+    protected function getFields( array &$taskInfo, $task, $parentObject )
52 52
     {
53 53
         $additionalFields = [];
54 54
 
55 55
 
56 56
         // In case of editing a task, set to the internal value if data wasn't already submitted
57
-        if (empty($taskInfo[$this->fieldSenderFrom]) && $parentObject->getCurrentAction()->equals(Action::EDIT)) {
57
+        if( empty( $taskInfo[$this->fieldSenderFrom] ) && $parentObject->getCurrentAction()->equals( Action::EDIT ) ) {
58 58
             $taskInfo[$this->fieldSenderFrom] = $task->{$this->fieldSenderFrom} ?? '';
59 59
         }
60 60
 
61
-        $taskInfo[$this->fieldSenderFrom] = htmlspecialchars($taskInfo[$this->fieldSenderFrom] ?? '', ENT_QUOTES, 'UTF-8');
61
+        $taskInfo[$this->fieldSenderFrom] = htmlspecialchars( $taskInfo[$this->fieldSenderFrom] ?? '', ENT_QUOTES, 'UTF-8' );
62 62
 
63 63
         $fieldStr = '<input class="form-control" name="tx_scheduler[%1$s]" id="%1$s" value="%2$s">';
64
-        $fieldCode = sprintf($fieldStr, $this->fieldSenderFrom, $taskInfo[$this->fieldSenderFrom]);
64
+        $fieldCode = sprintf( $fieldStr, $this->fieldSenderFrom, $taskInfo[$this->fieldSenderFrom] );
65 65
 
66 66
         $additionalFields[$this->fieldSenderFrom] = [
67 67
             'code'     => $fieldCode,
@@ -72,14 +72,14 @@  discard block
 block discarded – undo
72 72
 
73 73
 
74 74
         // In case of editing a task, set to the internal value if data wasn't already submitted
75
-        if (empty($taskInfo[$this->fieldSenderEmail]) && $parentObject->getCurrentAction()->equals(Action::EDIT)) {
75
+        if( empty( $taskInfo[$this->fieldSenderEmail] ) && $parentObject->getCurrentAction()->equals( Action::EDIT ) ) {
76 76
             $taskInfo[$this->fieldSenderEmail] = $task->{$this->fieldSenderEmail} ?? '';
77 77
         }
78 78
 
79
-        $taskInfo[$this->fieldSenderEmail] = htmlspecialchars($taskInfo[$this->fieldSenderEmail] ?? '', ENT_QUOTES, 'UTF-8');
79
+        $taskInfo[$this->fieldSenderEmail] = htmlspecialchars( $taskInfo[$this->fieldSenderEmail] ?? '', ENT_QUOTES, 'UTF-8' );
80 80
 
81 81
         $fieldStr = '<input class="form-control" name="tx_scheduler[%1$s]" id="%1$s" value="%2$s">';
82
-        $fieldCode = sprintf($fieldStr, $this->fieldSenderEmail, $taskInfo[$this->fieldSenderEmail]);
82
+        $fieldCode = sprintf( $fieldStr, $this->fieldSenderEmail, $taskInfo[$this->fieldSenderEmail] );
83 83
 
84 84
         $additionalFields[$this->fieldSenderEmail] = [
85 85
             'code'     => $fieldCode,
@@ -90,14 +90,14 @@  discard block
 block discarded – undo
90 90
 
91 91
 
92 92
         // In case of editing a task, set to the internal value if data wasn't already submitted
93
-        if (empty($taskInfo[$this->fieldReplyEmail]) && $parentObject->getCurrentAction()->equals(Action::EDIT)) {
93
+        if( empty( $taskInfo[$this->fieldReplyEmail] ) && $parentObject->getCurrentAction()->equals( Action::EDIT ) ) {
94 94
             $taskInfo[$this->fieldReplyEmail] = $task->{$this->fieldReplyEmail} ?? '';
95 95
         }
96 96
 
97
-        $taskInfo[$this->fieldReplyEmail] = htmlspecialchars($taskInfo[$this->fieldReplyEmail] ?? '', ENT_QUOTES, 'UTF-8');
97
+        $taskInfo[$this->fieldReplyEmail] = htmlspecialchars( $taskInfo[$this->fieldReplyEmail] ?? '', ENT_QUOTES, 'UTF-8' );
98 98
 
99 99
         $fieldStr = '<input class="form-control" name="tx_scheduler[%1$s]" id="%1$s" value="%2$s">';
100
-        $fieldCode = sprintf($fieldStr, $this->fieldReplyEmail, $taskInfo[$this->fieldReplyEmail]);
100
+        $fieldCode = sprintf( $fieldStr, $this->fieldReplyEmail, $taskInfo[$this->fieldReplyEmail] );
101 101
 
102 102
         $additionalFields[$this->fieldReplyEmail] = [
103 103
             'code'     => $fieldCode,
@@ -108,14 +108,14 @@  discard block
 block discarded – undo
108 108
 
109 109
 
110 110
         // In case of editing a task, set to the internal value if data wasn't already submitted
111
-        if (empty($taskInfo[$this->fieldPageCatalog]) && $parentObject->getCurrentAction()->equals(Action::EDIT)) {
111
+        if( empty( $taskInfo[$this->fieldPageCatalog] ) && $parentObject->getCurrentAction()->equals( Action::EDIT ) ) {
112 112
             $taskInfo[$this->fieldPageCatalog] = $task->{$this->fieldPageCatalog} ?? '';
113 113
         }
114 114
 
115
-        $taskInfo[$this->fieldPageCatalog] = htmlspecialchars($taskInfo[$this->fieldPageCatalog] ?? '', ENT_QUOTES, 'UTF-8');
115
+        $taskInfo[$this->fieldPageCatalog] = htmlspecialchars( $taskInfo[$this->fieldPageCatalog] ?? '', ENT_QUOTES, 'UTF-8' );
116 116
 
117 117
         $fieldStr = '<input class="form-control" name="tx_scheduler[%1$s]" id="%1$s" value="%2$s">';
118
-        $fieldCode = sprintf($fieldStr, $this->fieldPageCatalog, $taskInfo[$this->fieldPageCatalog]);
118
+        $fieldCode = sprintf( $fieldStr, $this->fieldPageCatalog, $taskInfo[$this->fieldPageCatalog] );
119 119
 
120 120
         $additionalFields[$this->fieldPageCatalog] = [
121 121
             'code'     => $fieldCode,
@@ -126,14 +126,14 @@  discard block
 block discarded – undo
126 126
 
127 127
 
128 128
         // In case of editing a task, set to the internal value if data wasn't already submitted
129
-        if (empty($taskInfo[$this->fieldPageDetail]) && $parentObject->getCurrentAction()->equals(Action::EDIT)) {
129
+        if( empty( $taskInfo[$this->fieldPageDetail] ) && $parentObject->getCurrentAction()->equals( Action::EDIT ) ) {
130 130
             $taskInfo[$this->fieldPageDetail] = $task->{$this->fieldPageDetail} ?? '';
131 131
         }
132 132
 
133
-        $taskInfo[$this->fieldPageDetail] = htmlspecialchars($taskInfo[$this->fieldPageDetail] ?? '', ENT_QUOTES, 'UTF-8');
133
+        $taskInfo[$this->fieldPageDetail] = htmlspecialchars( $taskInfo[$this->fieldPageDetail] ?? '', ENT_QUOTES, 'UTF-8' );
134 134
 
135 135
         $fieldStr = '<input class="form-control" name="tx_scheduler[%1$s]" id="%1$s" value="%2$s">';
136
-        $fieldCode = sprintf($fieldStr, $this->fieldPageDetail, $taskInfo[$this->fieldPageDetail]);
136
+        $fieldCode = sprintf( $fieldStr, $this->fieldPageDetail, $taskInfo[$this->fieldPageDetail] );
137 137
 
138 138
         $additionalFields[$this->fieldPageDetail] = [
139 139
             'code'     => $fieldCode,
@@ -144,14 +144,14 @@  discard block
 block discarded – undo
144 144
 
145 145
 
146 146
         // In case of editing a task, set to the internal value if data wasn't already submitted
147
-        if (empty($taskInfo[$this->fieldPageDownload]) && $parentObject->getCurrentAction()->equals(Action::EDIT)) {
147
+        if( empty( $taskInfo[$this->fieldPageDownload] ) && $parentObject->getCurrentAction()->equals( Action::EDIT ) ) {
148 148
             $taskInfo[$this->fieldPageDownload] = $task->{$this->fieldPageDownload} ?? '';
149 149
         }
150 150
 
151
-        $taskInfo[$this->fieldPageDownload] = htmlspecialchars($taskInfo[$this->fieldPageDownload] ?? '', ENT_QUOTES, 'UTF-8');
151
+        $taskInfo[$this->fieldPageDownload] = htmlspecialchars( $taskInfo[$this->fieldPageDownload] ?? '', ENT_QUOTES, 'UTF-8' );
152 152
 
153 153
         $fieldStr = '<input class="form-control" name="tx_scheduler[%1$s]" id="%1$s" value="%2$s">';
154
-        $fieldCode = sprintf($fieldStr, $this->fieldPageDownload, $taskInfo[$this->fieldPageDownload]);
154
+        $fieldCode = sprintf( $fieldStr, $this->fieldPageDownload, $taskInfo[$this->fieldPageDownload] );
155 155
 
156 156
         $additionalFields[$this->fieldPageDownload] = [
157 157
             'code'     => $fieldCode,
@@ -162,14 +162,14 @@  discard block
 block discarded – undo
162 162
 
163 163
 
164 164
         // In case of editing a task, set to the internal value if data wasn't already submitted
165
-        if (empty($taskInfo[$this->fieldPageLogin]) && $parentObject->getCurrentAction()->equals(Action::EDIT)) {
165
+        if( empty( $taskInfo[$this->fieldPageLogin] ) && $parentObject->getCurrentAction()->equals( Action::EDIT ) ) {
166 166
             $taskInfo[$this->fieldPageLogin] = $task->{$this->fieldPageLogin} ?? '';
167 167
         }
168 168
 
169
-        $taskInfo[$this->fieldPageLogin] = htmlspecialchars($taskInfo[$this->fieldPageLogin] ?? '', ENT_QUOTES, 'UTF-8');
169
+        $taskInfo[$this->fieldPageLogin] = htmlspecialchars( $taskInfo[$this->fieldPageLogin] ?? '', ENT_QUOTES, 'UTF-8' );
170 170
 
171 171
         $fieldStr = '<input class="form-control" name="tx_scheduler[%1$s]" id="%1$s" value="%2$s">';
172
-        $fieldCode = sprintf($fieldStr, $this->fieldPageLogin, $taskInfo[$this->fieldPageLogin]);
172
+        $fieldCode = sprintf( $fieldStr, $this->fieldPageLogin, $taskInfo[$this->fieldPageLogin] );
173 173
 
174 174
         $additionalFields[$this->fieldPageLogin] = [
175 175
             'code'     => $fieldCode,
@@ -180,17 +180,17 @@  discard block
 block discarded – undo
180 180
 
181 181
 
182 182
         // In case of editing a task, set to the internal value if data wasn't already submitted
183
-        if (empty($taskInfo[$this->fieldTemplateBaseurl]) && $parentObject->getCurrentAction()->equals(Action::EDIT)) {
183
+        if( empty( $taskInfo[$this->fieldTemplateBaseurl] ) && $parentObject->getCurrentAction()->equals( Action::EDIT ) ) {
184 184
             $taskInfo[$this->fieldTemplateBaseurl] = $task->{$this->fieldTemplateBaseurl} ?? '';
185 185
         }
186 186
 
187
-        $taskInfo[$this->fieldTemplateBaseurl] = htmlspecialchars($taskInfo[$this->fieldTemplateBaseurl] ?? '', ENT_QUOTES, 'UTF-8');
187
+        $taskInfo[$this->fieldTemplateBaseurl] = htmlspecialchars( $taskInfo[$this->fieldTemplateBaseurl] ?? '', ENT_QUOTES, 'UTF-8' );
188 188
 
189 189
         $path = 'typo3conf/ext/aimeos/Resources/Public/Themes/default';
190 190
         $path = $taskInfo[$this->fieldTemplateBaseurl] = $taskInfo[$this->fieldTemplateBaseurl] ?? $path;
191 191
 
192 192
         $fieldStr = '<input class="form-control" name="tx_scheduler[%1$s]" id="%1$s" value="%2$s">';
193
-        $fieldCode = sprintf($fieldStr, $this->fieldTemplateBaseurl, $path);
193
+        $fieldCode = sprintf( $fieldStr, $this->fieldTemplateBaseurl, $path );
194 194
 
195 195
         $additionalFields[$this->fieldTemplateBaseurl] = [
196 196
             'code'     => $fieldCode,
@@ -200,7 +200,7 @@  discard block
 block discarded – undo
200 200
         ];
201 201
 
202 202
 
203
-        $additionalFields += parent::getFields($taskInfo, $task, $parentObject);
203
+        $additionalFields += parent::getFields( $taskInfo, $task, $parentObject );
204 204
 
205 205
         return $additionalFields;
206 206
     }
@@ -214,9 +214,9 @@  discard block
 block discarded – undo
214 214
      * @param array $submittedData Array containing the data submitted by the user
215 215
      * @param object $task Reference to the current task object
216 216
      */
217
-    protected function saveFields(array $submittedData, $task)
217
+    protected function saveFields( array $submittedData, $task )
218 218
     {
219
-        parent::saveFields($submittedData, $task);
219
+        parent::saveFields( $submittedData, $task );
220 220
 
221 221
         $task->{$this->fieldSenderFrom} = $submittedData[$this->fieldSenderFrom] ?? '';
222 222
         $task->{$this->fieldSenderEmail} = $submittedData[$this->fieldSenderEmail] ?? '';
@@ -238,33 +238,33 @@  discard block
 block discarded – undo
238 238
      * @param tx_scheduler_Module $parentObject Reference to the calling object (Scheduler's BE module)
239 239
      * @return boolean True if validation was ok (or selected class is not relevant), false otherwise
240 240
      */
241
-    protected function validateFields(array &$submittedData, $parentObject)
241
+    protected function validateFields( array &$submittedData, $parentObject )
242 242
     {
243
-        if (preg_match('/^.+@[a-zA-Z0-9\-]+(\.[a-zA-Z0-9\-]+)*$/', $submittedData[$this->fieldSenderEmail] ?? '') !== 1) {
244
-            throw new \InvalidArgumentException($GLOBALS['LANG']->sL('LLL:EXT:aimeos/Resources/Private/Language/scheduler.xlf:email.error.from-email.invalid'));
243
+        if( preg_match( '/^.+@[a-zA-Z0-9\-]+(\.[a-zA-Z0-9\-]+)*$/', $submittedData[$this->fieldSenderEmail] ?? '' ) !== 1 ) {
244
+            throw new \InvalidArgumentException( $GLOBALS['LANG']->sL( 'LLL:EXT:aimeos/Resources/Private/Language/scheduler.xlf:email.error.from-email.invalid' ) );
245 245
         }
246 246
 
247
-        if (($submittedData[$this->fieldReplyEmail] ?? '') && preg_match('/^.+@[a-zA-Z0-9\-]+(\.[a-zA-Z0-9\-]+)*$/', $submittedData[$this->fieldReplyEmail]) !== 1) {
248
-            throw new \InvalidArgumentException($GLOBALS['LANG']->sL('LLL:EXT:aimeos/Resources/Private/Language/scheduler.xlf:email.error.reply-email.invalid'));
247
+        if( ( $submittedData[$this->fieldReplyEmail] ?? '' ) && preg_match( '/^.+@[a-zA-Z0-9\-]+(\.[a-zA-Z0-9\-]+)*$/', $submittedData[$this->fieldReplyEmail] ) !== 1 ) {
248
+            throw new \InvalidArgumentException( $GLOBALS['LANG']->sL( 'LLL:EXT:aimeos/Resources/Private/Language/scheduler.xlf:email.error.reply-email.invalid' ) );
249 249
         }
250 250
 
251
-        if (preg_match('/^[0-9]+$/', $submittedData[$this->fieldPageCatalog] ?? '') !== 1) {
252
-            throw new \InvalidArgumentException($GLOBALS['LANG']->sL('LLL:EXT:aimeos/Resources/Private/Language/scheduler.xlf:email.error.page-catalog.invalid'));
251
+        if( preg_match( '/^[0-9]+$/', $submittedData[$this->fieldPageCatalog] ?? '' ) !== 1 ) {
252
+            throw new \InvalidArgumentException( $GLOBALS['LANG']->sL( 'LLL:EXT:aimeos/Resources/Private/Language/scheduler.xlf:email.error.page-catalog.invalid' ) );
253 253
         }
254 254
 
255
-        if (preg_match('/^[0-9]+$/', $submittedData[$this->fieldPageDetail] ?? '') !== 1) {
256
-            throw new \InvalidArgumentException($GLOBALS['LANG']->sL('LLL:EXT:aimeos/Resources/Private/Language/scheduler.xlf:email.error.page-detail.invalid'));
255
+        if( preg_match( '/^[0-9]+$/', $submittedData[$this->fieldPageDetail] ?? '' ) !== 1 ) {
256
+            throw new \InvalidArgumentException( $GLOBALS['LANG']->sL( 'LLL:EXT:aimeos/Resources/Private/Language/scheduler.xlf:email.error.page-detail.invalid' ) );
257 257
         }
258 258
 
259
-        if (preg_match('/^[0-9]+$/', $submittedData[$this->fieldPageLogin] ?? '') !== 1) {
260
-            throw new \InvalidArgumentException($GLOBALS['LANG']->sL('LLL:EXT:aimeos/Resources/Private/Language/scheduler.xlf:email.error.page-login.invalid'));
259
+        if( preg_match( '/^[0-9]+$/', $submittedData[$this->fieldPageLogin] ?? '' ) !== 1 ) {
260
+            throw new \InvalidArgumentException( $GLOBALS['LANG']->sL( 'LLL:EXT:aimeos/Resources/Private/Language/scheduler.xlf:email.error.page-login.invalid' ) );
261 261
         }
262 262
 
263
-        if (preg_match('/^[0-9]+$/', $submittedData[$this->fieldPageDownload] ?? '') !== 1) {
264
-            throw new \InvalidArgumentException($GLOBALS['LANG']->sL('LLL:EXT:aimeos/Resources/Private/Language/scheduler.xlf:email.error.page-download.invalid'));
263
+        if( preg_match( '/^[0-9]+$/', $submittedData[$this->fieldPageDownload] ?? '' ) !== 1 ) {
264
+            throw new \InvalidArgumentException( $GLOBALS['LANG']->sL( 'LLL:EXT:aimeos/Resources/Private/Language/scheduler.xlf:email.error.page-download.invalid' ) );
265 265
         }
266 266
 
267
-        parent::validateFields($submittedData, $parentObject);
267
+        parent::validateFields( $submittedData, $parentObject );
268 268
 
269 269
         return true;
270 270
     }
Please login to merge, or discard this patch.
Classes/Scheduler/Provider/AbstractProvider.php 1 patch
Spacing   +40 added lines, -40 removed lines patch added patch discarded remove patch
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
      *            ['cshKey']        => The CSH key for the field
44 44
      *            ['cshLabel']    => The code of the CSH label
45 45
      */
46
-    protected function getFields(array &$taskInfo, $task, $parentObject)
46
+    protected function getFields( array &$taskInfo, $task, $parentObject )
47 47
     {
48 48
         $additionalFields = [];
49 49
 
@@ -52,10 +52,10 @@  discard block
 block discarded – undo
52 52
             $taskInfo[$this->fieldController] = $task->{$this->fieldController} ?? [];
53 53
         }
54 54
 
55
-        $taskInfo[$this->fieldController] = (array) ($taskInfo[$this->fieldController] ?? []);
55
+        $taskInfo[$this->fieldController] = (array) ( $taskInfo[$this->fieldController] ?? [] );
56 56
 
57
-        $fieldCode = sprintf('<select class="form-control" name="tx_scheduler[%1$s][]" id="%1$s" multiple="multiple" size="10" />', $this->fieldController);
58
-        $fieldCode .= $this->getControllerOptions($taskInfo[$this->fieldController]);
57
+        $fieldCode = sprintf( '<select class="form-control" name="tx_scheduler[%1$s][]" id="%1$s" multiple="multiple" size="10" />', $this->fieldController );
58
+        $fieldCode .= $this->getControllerOptions( $taskInfo[$this->fieldController] );
59 59
         $fieldCode .= '</select>';
60 60
 
61 61
         $additionalFields[$this->fieldController] = [
@@ -71,10 +71,10 @@  discard block
 block discarded – undo
71 71
             $taskInfo[$this->fieldSite] = $task->{$this->fieldSite} ?? [];
72 72
         }
73 73
 
74
-        $taskInfo[$this->fieldSite] = (array) ($taskInfo[$this->fieldSite] ?? []);
74
+        $taskInfo[$this->fieldSite] = (array) ( $taskInfo[$this->fieldSite] ?? [] );
75 75
 
76
-        $fieldCode = sprintf('<select class="form-control" name="tx_scheduler[%1$s][]" id="%1$s" multiple="multiple" size="10" />', $this->fieldSite);
77
-        $fieldCode .= $this->getSiteOptions($this->getAvailableSites(), $taskInfo[$this->fieldSite], 0);
76
+        $fieldCode = sprintf( '<select class="form-control" name="tx_scheduler[%1$s][]" id="%1$s" multiple="multiple" size="10" />', $this->fieldSite );
77
+        $fieldCode .= $this->getSiteOptions( $this->getAvailableSites(), $taskInfo[$this->fieldSite], 0 );
78 78
         $fieldCode .= '</select>';
79 79
 
80 80
         $additionalFields[$this->fieldSite] = [
@@ -86,14 +86,14 @@  discard block
 block discarded – undo
86 86
 
87 87
 
88 88
         // In case of editing a task, set to the internal value if data wasn't already submitted
89
-        if (empty($taskInfo[$this->fieldTSconfig]) && $parentObject->getCurrentAction()->equals(Action::EDIT)) {
89
+        if( empty( $taskInfo[$this->fieldTSconfig] ) && $parentObject->getCurrentAction()->equals( Action::EDIT ) ) {
90 90
             $taskInfo[$this->fieldTSconfig] = $task->{$this->fieldTSconfig} ?? '';
91 91
         }
92 92
 
93 93
         $taskInfo[$this->fieldTSconfig] = htmlspecialchars( $taskInfo[$this->fieldTSconfig] ?? '', ENT_QUOTES, 'UTF-8' );
94 94
 
95 95
         $fieldStr = '<textarea class="form-control" name="tx_scheduler[%1$s]" id="%1$s" rows="20" cols="80" >%2$s</textarea>';
96
-        $fieldCode = sprintf($fieldStr, $this->fieldTSconfig, $taskInfo[$this->fieldTSconfig]);
96
+        $fieldCode = sprintf( $fieldStr, $this->fieldTSconfig, $taskInfo[$this->fieldTSconfig] );
97 97
 
98 98
         $additionalFields[$this->fieldTSconfig] = [
99 99
             'code'     => $fieldCode,
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
      * @param array $submittedData Array containing the data submitted by the user
115 115
      * @param object $task Reference to the current task object
116 116
      */
117
-    protected function saveFields(array $submittedData, $task)
117
+    protected function saveFields( array $submittedData, $task )
118 118
     {
119 119
         $task->{$this->fieldSite} = $submittedData[$this->fieldSite] ?? '';
120 120
         $task->{$this->fieldController} = $submittedData[$this->fieldController] ?? '';
@@ -148,8 +148,8 @@  discard block
 block discarded – undo
148 148
         $submittedData[$this->fieldSite] = array_unique( (array) $submittedData[$this->fieldSite] ?? [] );
149 149
         $siteItems = Scheduler\Base::getSiteItems( $context, $submittedData[$this->fieldSite] );
150 150
 
151
-        if (count($siteItems) !== count($submittedData[$this->fieldSite])) {
152
-            throw new \RuntimeException($GLOBALS['LANG']->sL('LLL:EXT:aimeos/Resources/Private/Language/scheduler.xlf:default.error.sitecode'));
151
+        if( count( $siteItems ) !== count( $submittedData[$this->fieldSite] ) ) {
152
+            throw new \RuntimeException( $GLOBALS['LANG']->sL( 'LLL:EXT:aimeos/Resources/Private/Language/scheduler.xlf:default.error.sitecode' ) );
153 153
         }
154 154
 
155 155
 
@@ -157,8 +157,8 @@  discard block
 block discarded – undo
157 157
         $cntlPaths = $aimeos->getCustomPaths( 'controller/jobs' );
158 158
         $submittedData[$this->fieldController] = array_unique( (array) $submittedData[$this->fieldController] ?? [] );
159 159
 
160
-        foreach ($submittedData[$this->fieldController] as $name) {
161
-            \Aimeos\Controller\Jobs::create($context, $aimeos, $name);
160
+        foreach( $submittedData[$this->fieldController] as $name ) {
161
+            \Aimeos\Controller\Jobs::create( $context, $aimeos, $name );
162 162
         }
163 163
 
164 164
         return true;
@@ -172,16 +172,16 @@  discard block
 block discarded – undo
172 172
      */
173 173
     protected function getAvailableSites() : \Aimeos\Map
174 174
     {
175
-        $manager = \Aimeos\MShop::create(Scheduler\Base::context(), 'locale/site');
175
+        $manager = \Aimeos\MShop::create( Scheduler\Base::context(), 'locale/site' );
176 176
 
177 177
         $search = $manager->filter();
178
-        $search->setConditions($search->compare('==', 'locale.site.level', 0));
179
-        $search->setSortations(array($search->sort('+', 'locale.site.label')));
178
+        $search->setConditions( $search->compare( '==', 'locale.site.level', 0 ) );
179
+        $search->setSortations( array( $search->sort( '+', 'locale.site.label' ) ) );
180 180
 
181
-        $sites = $manager->search($search);
181
+        $sites = $manager->search( $search );
182 182
 
183
-        foreach ($sites as $id => $siteItem) {
184
-            $sites[$id] = $manager->getTree($id, [], \Aimeos\MW\Tree\Manager\Base::LEVEL_TREE);
183
+        foreach( $sites as $id => $siteItem ) {
184
+            $sites[$id] = $manager->getTree( $id, [], \Aimeos\MW\Tree\Manager\Base::LEVEL_TREE );
185 185
         }
186 186
 
187 187
         return $sites;
@@ -197,18 +197,18 @@  discard block
 block discarded – undo
197 197
      * @param int $level Nesting level of the sites (should start with 0)
198 198
      * @return string HTML code with <option> tags for the select box
199 199
      */
200
-    protected function getSiteOptions(\Aimeos\Map $siteItems, array $selected, int $level) : string
200
+    protected function getSiteOptions( \Aimeos\Map $siteItems, array $selected, int $level ) : string
201 201
     {
202 202
         $html = '';
203
-        $prefix = str_repeat('-', $level) . ' ';
203
+        $prefix = str_repeat( '-', $level ) . ' ';
204 204
 
205
-        foreach ($siteItems as $item) {
206
-            $active = (in_array($item->getCode(), $selected) ? 'selected="selected"' : '');
207
-            $disabled = ($item->getStatus() > 0 ? '' : 'disabled="disabled"');
205
+        foreach( $siteItems as $item ) {
206
+            $active = ( in_array( $item->getCode(), $selected ) ? 'selected="selected"' : '' );
207
+            $disabled = ( $item->getStatus() > 0 ? '' : 'disabled="disabled"' );
208 208
             $string = '<option value="%1$s" %2$s %3$s>%4$s</option>';
209
-            $html .= sprintf($string, $item->getCode(), $active, $disabled, $prefix . $item->getLabel());
209
+            $html .= sprintf( $string, $item->getCode(), $active, $disabled, $prefix . $item->getLabel() );
210 210
 
211
-            $html .= $this->getSiteOptions($item->getChildren(), $selected, $level + 1);
211
+            $html .= $this->getSiteOptions( $item->getChildren(), $selected, $level + 1 );
212 212
         }
213 213
 
214 214
         return $html;
@@ -221,31 +221,31 @@  discard block
 block discarded – undo
221 221
      * @param array $selected List of site codes that were previously selected by the user
222 222
      * @return string HTML code with <option> tags for the select box
223 223
      */
224
-    protected function getControllerOptions(array $selected) : string
224
+    protected function getControllerOptions( array $selected ) : string
225 225
     {
226 226
         $html = '';
227 227
         $aimeos = Base::aimeos();
228 228
         $context = Scheduler\Base::context();
229
-        $cntlPaths = $aimeos->getCustomPaths('controller/jobs');
229
+        $cntlPaths = $aimeos->getCustomPaths( 'controller/jobs' );
230 230
 
231 231
         $langid = 'en';
232
-        if (isset($GLOBALS['BE_USER']->uc['lang']) && !in_array($GLOBALS['BE_USER']->uc['lang'], ['', 'default'])) {
232
+        if( isset( $GLOBALS['BE_USER']->uc['lang'] ) && !in_array( $GLOBALS['BE_USER']->uc['lang'], ['', 'default'] ) ) {
233 233
             $langid = $GLOBALS['BE_USER']->uc['lang'];
234 234
         }
235 235
 
236
-        $localeItem = \Aimeos\MShop::create($context, 'locale')->create();
237
-        $localeItem->setLanguageId($langid);
238
-        $context->setLocale($localeItem);
236
+        $localeItem = \Aimeos\MShop::create( $context, 'locale' )->create();
237
+        $localeItem->setLanguageId( $langid );
238
+        $context->setLocale( $localeItem );
239 239
 
240
-        $controllers = \Aimeos\Controller\Jobs::get($context, $aimeos, $cntlPaths);
240
+        $controllers = \Aimeos\Controller\Jobs::get( $context, $aimeos, $cntlPaths );
241 241
 
242
-        foreach ($controllers as $name => $controller) {
243
-            $active = (in_array($name, $selected) ? 'selected="selected"' : '');
244
-            $title = htmlspecialchars($controller->getDescription(), ENT_QUOTES, 'UTF-8');
245
-            $cntl = htmlspecialchars(sprintf('%1$s: %2$s', $name, $controller->getName()), ENT_QUOTES, 'UTF-8');
246
-            $name = htmlspecialchars($name, ENT_QUOTES, 'UTF-8');
242
+        foreach( $controllers as $name => $controller ) {
243
+            $active = ( in_array( $name, $selected ) ? 'selected="selected"' : '' );
244
+            $title = htmlspecialchars( $controller->getDescription(), ENT_QUOTES, 'UTF-8' );
245
+            $cntl = htmlspecialchars( sprintf( '%1$s: %2$s', $name, $controller->getName() ), ENT_QUOTES, 'UTF-8' );
246
+            $name = htmlspecialchars( $name, ENT_QUOTES, 'UTF-8' );
247 247
 
248
-            $html .= sprintf('<option value="%1$s" title="%2$s" %3$s>%4$s</option>', $name, $title, $active, $cntl);
248
+            $html .= sprintf( '<option value="%1$s" title="%2$s" %3$s>%4$s</option>', $name, $title, $active, $cntl );
249 249
         }
250 250
 
251 251
         return $html;
Please login to merge, or discard this patch.
Classes/Controller/AdminController.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -26,16 +26,16 @@
 block discarded – undo
26 26
     {
27 27
         $site = 'default';
28 28
 
29
-        if (isset($GLOBALS['BE_USER']->user['siteid']) && $GLOBALS['BE_USER']->user['siteid'] != '') {
30
-            $siteManager = \Aimeos\MShop::create($this->contextBackend(), 'locale/site');
31
-            $siteId = current(array_reverse(explode('.', trim($GLOBALS['BE_USER']->user['siteid'], '.'))));
32
-            $site = ($siteId ? $siteManager->get($siteId)->getCode() : 'default');
29
+        if( isset( $GLOBALS['BE_USER']->user['siteid'] ) && $GLOBALS['BE_USER']->user['siteid'] != '' ) {
30
+            $siteManager = \Aimeos\MShop::create( $this->contextBackend(), 'locale/site' );
31
+            $siteId = current( array_reverse( explode( '.', trim( $GLOBALS['BE_USER']->user['siteid'], '.' ) ) ) );
32
+            $site = ( $siteId ? $siteManager->get( $siteId )->getCode() : 'default' );
33 33
         }
34 34
 
35
-        if (!class_exists('\TYPO3\CMS\Extbase\Http\ForwardResponse')) {
36
-            return $this->forward('search', 'Jqadm', null, ['site' => $site]);
35
+        if( !class_exists( '\TYPO3\CMS\Extbase\Http\ForwardResponse' ) ) {
36
+            return $this->forward( 'search', 'Jqadm', null, ['site' => $site] );
37 37
         }
38 38
 
39
-        return (new ForwardResponse('search'))->withControllerName('Jqadm')->withArguments(['site' => $site]);
39
+        return ( new ForwardResponse( 'search' ) )->withControllerName( 'Jqadm' )->withArguments( ['site' => $site] );
40 40
     }
41 41
 }
Please login to merge, or discard this patch.
Classes/Controller/LocaleController.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@
 block discarded – undo
26 26
      */
27 27
     public function selectAction()
28 28
     {
29
-        $client = \Aimeos\Client\Html::create($this->context(), 'locale/select');
30
-        return $this->getClientOutput($client);
29
+        $client = \Aimeos\Client\Html::create( $this->context(), 'locale/select' );
30
+        return $this->getClientOutput( $client );
31 31
     }
32 32
 }
Please login to merge, or discard this patch.
Classes/Controller/GraphqlController.php 2 patches
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
      */
28 28
     public function indexAction()
29 29
     {
30
-        return \Aimeos\Admin\Graphql::execute($this->contextBackend(''), $this->getPsrRequest());
30
+        return \Aimeos\Admin\Graphql::execute( $this->contextBackend( '' ), $this->getPsrRequest() );
31 31
     }
32 32
 
33 33
 
@@ -57,15 +57,15 @@  discard block
 block discarded – undo
57 57
      * @param \Psr\Http\Message\ResponseInterface $response PSR-7 response object
58 58
      * @return string Generated output
59 59
      */
60
-    protected function setPsrResponse(\Psr\Http\Message\ResponseInterface $response)
60
+    protected function setPsrResponse( \Psr\Http\Message\ResponseInterface $response )
61 61
     {
62
-        if (!isset($this->responseFactory)) // TYPO3 10
62
+        if( !isset( $this->responseFactory ) ) // TYPO3 10
63 63
         {
64
-            $this->response->setStatus($response->getStatusCode());
64
+            $this->response->setStatus( $response->getStatusCode() );
65 65
 
66
-            foreach ($response->getHeaders() as $key => $value) {
67
-                foreach ((array) $value as $val) {
68
-                    $this->response->setHeader($key, $val);
66
+            foreach( $response->getHeaders() as $key => $value ) {
67
+                foreach( (array) $value as $val ) {
68
+                    $this->response->setHeader( $key, $val );
69 69
                 }
70 70
             }
71 71
 
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -59,9 +59,11 @@
 block discarded – undo
59 59
      */
60 60
     protected function setPsrResponse(\Psr\Http\Message\ResponseInterface $response)
61 61
     {
62
-        if (!isset($this->responseFactory)) // TYPO3 10
62
+        if (!isset($this->responseFactory)) {
63
+            // TYPO3 10
63 64
         {
64 65
             $this->response->setStatus($response->getStatusCode());
66
+        }
65 67
 
66 68
             foreach ($response->getHeaders() as $key => $value) {
67 69
                 foreach ((array) $value as $val) {
Please login to merge, or discard this patch.
Classes/Controller/CheckoutController.php 2 patches
Spacing   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -27,8 +27,8 @@  discard block
 block discarded – undo
27 27
      */
28 28
     public function indexAction()
29 29
     {
30
-        $client = \Aimeos\Client\Html::create($this->context(), 'checkout/standard');
31
-        return $this->getClientOutput($client);
30
+        $client = \Aimeos\Client\Html::create( $this->context(), 'checkout/standard' );
31
+        return $this->getClientOutput( $client );
32 32
     }
33 33
 
34 34
 
@@ -38,29 +38,29 @@  discard block
 block discarded – undo
38 38
     public function confirmAction()
39 39
     {
40 40
         $context = $this->context();
41
-        $client = \Aimeos\Client\Html::create($context, 'checkout/confirm');
41
+        $client = \Aimeos\Client\Html::create( $context, 'checkout/confirm' );
42 42
 
43 43
         $view = $context->view();
44
-        $param = array_merge(GeneralUtility::_GET(), GeneralUtility::_POST());
45
-        $helper = new \Aimeos\Base\View\Helper\Param\Standard($view, $param);
46
-        $view->addHelper('param', $helper);
44
+        $param = array_merge( GeneralUtility::_GET(), GeneralUtility::_POST() );
45
+        $helper = new \Aimeos\Base\View\Helper\Param\Standard( $view, $param );
46
+        $view->addHelper( 'param', $helper );
47 47
 
48
-        $client->setView($view)->init();
48
+        $client->setView( $view )->init();
49 49
 
50 50
         $header = (string) $client->header();
51 51
         $html = (string) $client->body();
52 52
 
53
-        if (!isset($this->responseFactory)) // TYPO3 10
53
+        if( !isset( $this->responseFactory ) ) // TYPO3 10
54 54
         {
55
-            $this->response->addAdditionalHeaderData($header);
55
+            $this->response->addAdditionalHeaderData( $header );
56 56
             return $html;
57 57
         }
58 58
 
59
-        GeneralUtility::makeInstance(\TYPO3\CMS\Core\Page\PageRenderer::class)->addHeaderData($header);
59
+        GeneralUtility::makeInstance( \TYPO3\CMS\Core\Page\PageRenderer::class )->addHeaderData( $header );
60 60
 
61 61
         return $this->responseFactory->createResponse()
62
-            ->withAddedHeader('Content-Type', 'text/html; charset=utf-8')
63
-            ->withBody($this->streamFactory->createStream($html));
62
+            ->withAddedHeader( 'Content-Type', 'text/html; charset=utf-8' )
63
+            ->withBody( $this->streamFactory->createStream( $html ) );
64 64
     }
65 65
 
66 66
 
@@ -71,37 +71,37 @@  discard block
 block discarded – undo
71 71
     {
72 72
         try {
73 73
             $context = $this->context();
74
-            $client = \Aimeos\Client\Html::create($context, 'checkout/update');
74
+            $client = \Aimeos\Client\Html::create( $context, 'checkout/update' );
75 75
 
76 76
             $view = $context->view();
77
-            $param = array_merge(GeneralUtility::_GET(), GeneralUtility::_POST());
78
-            $helper = new \Aimeos\Base\View\Helper\Param\Standard($view, $param);
79
-            $view->addHelper('param', $helper);
77
+            $param = array_merge( GeneralUtility::_GET(), GeneralUtility::_POST() );
78
+            $helper = new \Aimeos\Base\View\Helper\Param\Standard( $view, $param );
79
+            $view->addHelper( 'param', $helper );
80 80
 
81
-            $client->setView($view)->init();
81
+            $client->setView( $view )->init();
82 82
 
83 83
             $header = (string) $client->header();
84 84
             $html = (string) $client->body();
85 85
 
86
-            if (!isset($this->responseFactory)) // TYPO3 10
86
+            if( !isset( $this->responseFactory ) ) // TYPO3 10
87 87
             {
88
-                $this->response->addAdditionalHeaderData($header);
88
+                $this->response->addAdditionalHeaderData( $header );
89 89
                 return $html;
90 90
             }
91 91
 
92
-            GeneralUtility::makeInstance(\TYPO3\CMS\Core\Page\PageRenderer::class)->addHeaderData($header);
92
+            GeneralUtility::makeInstance( \TYPO3\CMS\Core\Page\PageRenderer::class )->addHeaderData( $header );
93 93
 
94 94
             return $this->responseFactory->createResponse()
95
-                ->withBody($this->streamFactory->createStream($html));
96
-        } catch(\Exception $e) {
97
-            if (!isset($this->responseFactory)) // TYPO3 10
95
+                ->withBody( $this->streamFactory->createStream( $html ) );
96
+        } catch( \Exception $e ) {
97
+            if( !isset( $this->responseFactory ) ) // TYPO3 10
98 98
             {
99
-                @header('HTTP/1.1 500 Internal server error', true, 500);
99
+                @header( 'HTTP/1.1 500 Internal server error', true, 500 );
100 100
                 return 'Error: ' . $e->getMessage();
101 101
             }
102 102
 
103
-            return $this->responseFactory->createResponse()->withStatus(500)
104
-                ->withBody($this->streamFactory->createStream('Error: ' . $e->getMessage()));
103
+            return $this->responseFactory->createResponse()->withStatus( 500 )
104
+                ->withBody( $this->streamFactory->createStream( 'Error: ' . $e->getMessage() ) );
105 105
         }
106 106
     }
107 107
 }
Please login to merge, or discard this patch.
Braces   +14 added lines, -5 removed lines patch added patch discarded remove patch
@@ -50,9 +50,11 @@  discard block
 block discarded – undo
50 50
         $header = (string) $client->header();
51 51
         $html = (string) $client->body();
52 52
 
53
-        if (!isset($this->responseFactory)) // TYPO3 10
53
+        if (!isset($this->responseFactory)) {
54
+            // TYPO3 10
54 55
         {
55 56
             $this->response->addAdditionalHeaderData($header);
57
+        }
56 58
             return $html;
57 59
         }
58 60
 
@@ -69,7 +71,8 @@  discard block
 block discarded – undo
69 71
      */
70 72
     public function updateAction()
71 73
     {
72
-        try {
74
+        try
75
+        {
73 76
             $context = $this->context();
74 77
             $client = \Aimeos\Client\Html::create($context, 'checkout/update');
75 78
 
@@ -83,9 +86,11 @@  discard block
 block discarded – undo
83 86
             $header = (string) $client->header();
84 87
             $html = (string) $client->body();
85 88
 
86
-            if (!isset($this->responseFactory)) // TYPO3 10
89
+            if (!isset($this->responseFactory)) {
90
+                // TYPO3 10
87 91
             {
88 92
                 $this->response->addAdditionalHeaderData($header);
93
+            }
89 94
                 return $html;
90 95
             }
91 96
 
@@ -93,10 +98,14 @@  discard block
 block discarded – undo
93 98
 
94 99
             return $this->responseFactory->createResponse()
95 100
                 ->withBody($this->streamFactory->createStream($html));
96
-        } catch(\Exception $e) {
97
-            if (!isset($this->responseFactory)) // TYPO3 10
101
+        }
102
+        catch(\Exception $e)
103
+        {
104
+            if (!isset($this->responseFactory)) {
105
+                // TYPO3 10
98 106
             {
99 107
                 @header('HTTP/1.1 500 Internal server error', true, 500);
108
+            }
100 109
                 return 'Error: ' . $e->getMessage();
101 110
             }
102 111
 
Please login to merge, or discard this patch.