[CLEANUP] Replace count with empty in multiple extensions 85/40685/4
authorAndreas Fernandez <a.fernandez@scripting-base.de>
Sat, 27 Jun 2015 11:53:15 +0000 (13:53 +0200)
committerStefan Neufeind <typo3.neufeind@speedpartner.de>
Fri, 3 Jul 2015 20:35:44 +0000 (22:35 +0200)
Replace occurences of count() with matching empty() pendants.
Affected extensions:
- aboutmodules
- beuser
- compatibility6
- cshmanual
- css_styles_content
- dbal
- felogin
- sys_action
- t3editor
- taskcenter
- tstemplate

Resolves: #67777
Releases: master
Change-Id: I6986c71866c4f27f0c9bccc7d7d0dd14ea5695ac
Reviewed-on: http://review.typo3.org/40685
Reviewed-by: Markus Klein <markus.klein@typo3.org>
Tested-by: Markus Klein <markus.klein@typo3.org>
Reviewed-by: Stephan GroƟberndt <stephan@grossberndt.de>
Reviewed-by: Markus Sommer <markussom@posteo.de>
Reviewed-by: Stefan Neufeind <typo3.neufeind@speedpartner.de>
Tested-by: Stefan Neufeind <typo3.neufeind@speedpartner.de>
21 files changed:
typo3/sysext/aboutmodules/Classes/Controller/ModulesController.php
typo3/sysext/beuser/Classes/Controller/PermissionController.php
typo3/sysext/compatibility6/Classes/ContentObject/ImageTextContentObject.php
typo3/sysext/compatibility6/Classes/ContentObject/SearchResultContentObject.php
typo3/sysext/compatibility6/Classes/Controller/FormDataSubmissionController.php
typo3/sysext/compatibility6/Classes/Controller/Wizard/FormsController.php
typo3/sysext/cshmanual/Classes/Controller/HelpModuleController.php
typo3/sysext/css_styled_content/Classes/Controller/CssStyledContentController.php
typo3/sysext/dbal/Classes/Database/DatabaseConnection.php
typo3/sysext/dbal/Classes/RecordList/DatabaseRecordList.php
typo3/sysext/dbal/Tests/Unit/Database/SqlParserTest.php
typo3/sysext/felogin/Classes/Controller/FrontendLoginController.php
typo3/sysext/sys_action/Classes/ActionTask.php
typo3/sysext/sys_action/Classes/Backend/ToolbarItems/ActionToolbarItem.php
typo3/sysext/t3editor/Classes/Hook/TypoScriptTemplateInfoHook.php
typo3/sysext/t3editor/Classes/T3editor.php
typo3/sysext/taskcenter/Classes/Controller/TaskModuleController.php
typo3/sysext/tstemplate/Classes/Controller/TypoScriptTemplateConstantEditorModuleFunctionController.php
typo3/sysext/tstemplate/Classes/Controller/TypoScriptTemplateInformationModuleFunctionController.php
typo3/sysext/tstemplate/Classes/Controller/TypoScriptTemplateModuleController.php
typo3/sysext/tstemplate/Classes/Controller/TypoScriptTemplateObjectBrowserModuleFunctionController.php

index 5d2c20e..bb48e60 100644 (file)
@@ -62,7 +62,7 @@ class ModulesController extends ActionController {
                                }
                        }
                }
-               if (count($warnings)) {
+               if (!empty($warnings)) {
                        if (count($warnings) > 1) {
                                $securityWarnings = '<ul><li>' . implode('</li><li>', $warnings) . '</li></ul>';
                        } else {
@@ -105,7 +105,7 @@ class ModulesController extends ActionController {
                        $moduleKey = $moduleName . '_tab';
                        $mainModuleData['name'] = $moduleName;
                        $mainModuleData['label'] = $this->languageService->moduleLabels['tabs'][$moduleKey];
-                       if (is_array($moduleInfo['sub']) && count($moduleInfo['sub']) > 0) {
+                       if (is_array($moduleInfo['sub']) && !empty($moduleInfo['sub'])) {
                                $mainModuleData['subModules'] = $this->getSubModuleData($moduleName, $moduleInfo['sub']);
                        }
                        $mainModulesData[] = $mainModuleData;
index 88dfa4a..ca1e1ef 100644 (file)
@@ -285,7 +285,7 @@ class PermissionController extends ActionController {
                $options = array();
                $options[''] = '';
                // If there are a hierarchy of page ids, then...
-               if ($this->getBackendUser()->user['uid'] && count($tree->orig_ids_hierarchy)) {
+               if ($this->getBackendUser()->user['uid'] && !empty($tree->orig_ids_hierarchy)) {
                        // Init:
                        $labelRecursive = LocalizationUtility::translate('LLL:EXT:beuser/Resources/Private/Language/locallang_mod_permission.xlf:recursive', 'beuser');
                        $labelLevels = LocalizationUtility::translate('LLL:EXT:beuser/Resources/Private/Language/locallang_mod_permission.xlf:levels', 'beuser');
index 8a46a34..59ac511 100644 (file)
@@ -213,7 +213,7 @@ class ImageTextContentObject extends \TYPO3\CMS\Frontend\ContentObject\AbstractC
                                        $maxW = 0;
                                }
                                if ($maxW) {
-                                       if (count($colMaxW)) {
+                                       if (!empty($colMaxW)) {
                                                $imgConf['file.']['maxW'] = $colMaxW[$a % $colCount];
                                        } else {
                                                $imgConf['file.']['maxW'] = $maxW;
index 84d7718..97c2eb0 100644 (file)
@@ -163,7 +163,7 @@ class SearchResultContentObject extends \TYPO3\CMS\Frontend\ContentObject\Abstra
                                        if ($pId) {
                                                $altRootLine = $GLOBALS['TSFE']->sys_page->getRootLine($pId);
                                                ksort($altRootLine);
-                                               if (count($altRootLine)) {
+                                               if (!empty($altRootLine)) {
                                                        // Check if the rootline has the real Level0 in it!!
                                                        $hitRoot = 0;
                                                        $theNewRoot = array();
@@ -501,7 +501,7 @@ class SearchResultContentObject extends \TYPO3\CMS\Frontend\ContentObject\Abstra
                                                $primKeys[] = $key . '.' . $fkey . '=' . $primary_table_and_key;
                                        }
                                }
-                               if (count($primKeys)) {
+                               if (!empty($primKeys)) {
                                        $whereArray[] = '(' . implode(' OR ', $primKeys) . ')';
                                }
                                // Additional where clause:
@@ -551,12 +551,12 @@ class SearchResultContentObject extends \TYPO3\CMS\Frontend\ContentObject\Abstra
                                                }
                                        }
                                }
-                               if (count($sub_query_part)) {
+                               if (!empty($sub_query_part)) {
                                        $main_query_part[] = $this->sword_array[$key]['oper'];
                                        $main_query_part[] = '(' . implode(' OR ', $sub_query_part) . ')';
                                }
                        }
-                       if (count($main_query_part)) {
+                       if (!empty($main_query_part)) {
                                // Remove first part anyways.
                                unset($main_query_part[0]);
                                return implode(' ', $main_query_part);
index 0b13266..aff1f8f 100644 (file)
@@ -146,11 +146,10 @@ class FormDataSubmissionController {
                $locData = explode(':', $locationData);
                if (!$locData[1] || $this->frontendController->sys_page->checkRecord($locData[1], $locData[2], 1)) {
                        // $locData[1] -check means that a record is checked only if the locationData has a value for a record else than the page.
-                       if (count($this->frontendController->sys_page->getPage($locData[0]))) {
+                       if (!empty($this->frontendController->sys_page->getPage($locData[0]))) {
                                return 1;
-                       } else {
-                               $GLOBALS['TT']->setTSlogMessage('LocationData Error: The page pointed to by location data (' . $locationData . ') was not accessible.', 2);
                        }
+                       $GLOBALS['TT']->setTSlogMessage('LocationData Error: The page pointed to by location data (' . $locationData . ') was not accessible.', 2);
                } else {
                        $GLOBALS['TT']->setTSlogMessage('LocationData Error: Location data (' . $locationData . ') record pointed to was not accessible.', 2);
                }
index 9d34407..aff3436 100644 (file)
@@ -700,7 +700,7 @@ class FormsController extends \TYPO3\CMS\Backend\Controller\Wizard\AbstractWizar
                                                        break;
                                        }
                                        $tArr = $this->cleanT($tArr);
-                                       if (count($tArr)) {
+                                       if (!empty($tArr)) {
                                                $thisLine[1] .= ',' . implode(',', $tArr);
                                        }
                                        $thisLine[1] = str_replace('|', '', $thisLine[1]);
index 96c7444..f25d38f 100644 (file)
@@ -119,7 +119,7 @@ class HelpModuleController {
                // The field is the second one
                $this->field = array_shift($identifierParts);
                // There may be extra parts for FlexForms
-               if (count($identifierParts) > 0) {
+               if (!empty($identifierParts)) {
                        // There's at least one extra part
                        $extraIdentifierInformation = array();
                        $extraIdentifierInformation[] = array_shift($identifierParts);
@@ -458,7 +458,7 @@ class HelpModuleController {
                $code = '';
                // Splitting:
                $imgArray = GeneralUtility::trimExplode(',', $images, TRUE);
-               if (count($imgArray)) {
+               if (!empty($imgArray)) {
                        $descrArray = explode(LF, $descr, count($imgArray));
                        foreach ($imgArray as $k => $image) {
                                $descr = $descrArray[$k];
index 66e5f38..e4de3b6 100644 (file)
@@ -257,7 +257,7 @@ class CssStyledContentController extends \TYPO3\CMS\Frontend\Plugin\AbstractPlug
                        // Explode into an array:
                        $fileArray = GeneralUtility::trimExplode(',', $fileList, TRUE);
                        // If there were files to list...:
-                       if (count($fileArray)) {
+                       if (!empty($fileArray)) {
                                // Get the descriptions for the files (if any):
                                $descriptions = GeneralUtility::trimExplode(LF, $this->cObj->data['imagecaption']);
                                // Get the titles for the files (if any)
@@ -484,7 +484,7 @@ class CssStyledContentController extends \TYPO3\CMS\Frontend\Plugin\AbstractPlug
                        return $content;
                }
                $imgs = GeneralUtility::trimExplode(',', $imgList, TRUE);
-               if (count($imgs) === 0) {
+               if (empty($imgs)) {
                        // The imgList was not empty but did only contain empty values
                        if ($restoreRegisters) {
                                $this->cObj->cObjGetSingle('RESTORE_REGISTER', array());
index 9c2f619..ba6041e 100644 (file)
@@ -804,7 +804,7 @@ class DatabaseConnection extends \TYPO3\CMS\Core\Database\DatabaseConnection {
                        $remappedParameters = $this->map_remapSELECTQueryParts($select_fields, $from, $where_clause, $groupBy, $orderBy);
                }
                // Get handler key and select API:
-               if (count($remappedParameters) > 0) {
+               if (!empty($remappedParameters)) {
                        $mappedQueryParts = $this->compileSelectParameters($remappedParameters);
                        $fromTable = $mappedQueryParts[1];
                } else {
@@ -815,7 +815,7 @@ class DatabaseConnection extends \TYPO3\CMS\Core\Database\DatabaseConnection {
                $sqlResult = NULL;
                switch ($hType) {
                        case 'native':
-                               if (count($remappedParameters) > 0) {
+                               if (!empty($remappedParameters)) {
                                        list($select_fields, $from_table, $where_clause, $groupBy, $orderBy) = $this->compileSelectParameters($remappedParameters);
                                }
                                $this->lastQuery = $this->SELECTquery($select_fields, $from_table, $where_clause, $groupBy, $orderBy, $limit);
@@ -834,14 +834,14 @@ class DatabaseConnection extends \TYPO3\CMS\Core\Database\DatabaseConnection {
                                                $numrows = $splitLimit[0];
                                                $offset = 0;
                                        }
-                                       if (count($remappedParameters) > 0) {
+                                       if (!empty($remappedParameters)) {
                                                $sqlResult = $this->handlerInstance[$this->lastHandlerKey]->SelectLimit($this->SELECTqueryFromArray($remappedParameters), $numrows, $offset);
                                        } else {
                                                $sqlResult = $this->handlerInstance[$this->lastHandlerKey]->SelectLimit($this->SELECTquery($select_fields, $from_table, $where_clause, $groupBy, $orderBy), $numrows, $offset);
                                        }
                                        $this->lastQuery = $sqlResult->sql;
                                } else {
-                                       if (count($remappedParameters) > 0) {
+                                       if (!empty($remappedParameters)) {
                                                $this->lastQuery = $this->SELECTqueryFromArray($remappedParameters);
                                        } else {
                                                $this->lastQuery = $this->SELECTquery($select_fields, $from_table, $where_clause, $groupBy, $orderBy);
@@ -856,7 +856,7 @@ class DatabaseConnection extends \TYPO3\CMS\Core\Database\DatabaseConnection {
                                $sqlResult->TYPO3_DBAL_tableList = $ORIG_tableName;
                                break;
                        case 'userdefined':
-                               if (count($remappedParameters) > 0) {
+                               if (!empty($remappedParameters)) {
                                        list($select_fields, $from_table, $where_clause, $groupBy, $orderBy) = $this->compileSelectParameters($remappedParameters);
                                }
                                $sqlResult = $this->handlerInstance[$this->lastHandlerKey]->exec_SELECTquery($select_fields, $from_table, $where_clause, $groupBy, $orderBy, $limit);
@@ -1017,7 +1017,7 @@ class DatabaseConnection extends \TYPO3\CMS\Core\Database\DatabaseConnection {
         */
        public function INSERTquery($table, $fields_values, $no_quote_fields = FALSE) {
                // Table and fieldnames should be "SQL-injection-safe" when supplied to this function (contrary to values in the arrays which may be insecure).
-               if (!is_array($fields_values) || count($fields_values) === 0) {
+               if (!is_array($fields_values) || empty($fields_values)) {
                        return '';
                }
                foreach ($this->preProcessHookObjects as $hookObject) {
@@ -1051,9 +1051,9 @@ class DatabaseConnection extends \TYPO3\CMS\Core\Database\DatabaseConnection {
                                $nArr[$this->quoteFieldNames($k)] = !in_array($k, $no_quote_fields) ? $this->fullQuoteStr($v, $table, TRUE) : $v;
                        }
                }
-               if (count($blobFields) || count($clobFields)) {
+               if (!empty($blobFields) || !empty($clobFields)) {
                        $query = array();
-                       if (count($nArr)) {
+                       if (!empty($nArr)) {
                                $query[0] = 'INSERT INTO ' . $this->quoteFromTables($table) . '
                                (
                                        ' . implode(',
@@ -1063,10 +1063,10 @@ class DatabaseConnection extends \TYPO3\CMS\Core\Database\DatabaseConnection {
                                        ', $nArr) . '
                                )';
                        }
-                       if (count($blobFields)) {
+                       if (!empty($blobFields)) {
                                $query[1] = $blobFields;
                        }
-                       if (count($clobFields)) {
+                       if (!empty($clobFields)) {
                                $query[2] = $clobFields;
                        }
                        if (isset($query[0]) && ($this->debugOutput || $this->store_lastBuiltQuery)) {
@@ -1136,7 +1136,7 @@ class DatabaseConnection extends \TYPO3\CMS\Core\Database\DatabaseConnection {
                        }
                        $blobFields = $clobFields = array();
                        $nArr = array();
-                       if (is_array($fields_values) && count($fields_values)) {
+                       if (is_array($fields_values) && !empty($fields_values)) {
                                if (is_string($no_quote_fields)) {
                                        $no_quote_fields = explode(',', $no_quote_fields);
                                } elseif (!is_array($no_quote_fields)) {
@@ -1164,9 +1164,9 @@ class DatabaseConnection extends \TYPO3\CMS\Core\Database\DatabaseConnection {
                                        }
                                }
                        }
-                       if (count($blobFields) || count($clobFields)) {
+                       if (!empty($blobFields) || !empty($clobFields)) {
                                $query = array();
-                               if (count($nArr)) {
+                               if (!empty($nArr)) {
                                        $query[0] = 'UPDATE ' . $this->quoteFromTables($table) . '
                                                SET
                                                        ' . implode(',
@@ -1174,10 +1174,10 @@ class DatabaseConnection extends \TYPO3\CMS\Core\Database\DatabaseConnection {
                                                WHERE
                                                        ' . $this->quoteWhereClause($where) : '');
                                }
-                               if (count($blobFields)) {
+                               if (!empty($blobFields)) {
                                        $query[1] = $blobFields;
                                }
-                               if (count($clobFields)) {
+                               if (!empty($clobFields)) {
                                        $query[2] = $clobFields;
                                }
                                if (isset($query[0]) && ($this->debugOutput || $this->store_lastBuiltQuery)) {
@@ -1275,15 +1275,15 @@ class DatabaseConnection extends \TYPO3\CMS\Core\Database\DatabaseConnection {
                // $from_table
                $params[1] = $this->_quoteFromTables($params[1]);
                // $where_clause
-               if (count($params[2]) > 0) {
+               if (!empty($params[2])) {
                        $params[2] = $this->_quoteWhereClause($params[2]);
                }
                // $group_by
-               if (count($params[3]) > 0) {
+               if (!empty($params[3])) {
                        $params[3] = $this->_quoteGroupBy($params[3]);
                }
                // $order_by
-               if (count($params[4]) > 0) {
+               if (!empty($params[4])) {
                        $params[4] = $this->_quoteOrderBy($params[4]);
                }
                // Compile the SELECT parameters
@@ -1306,9 +1306,9 @@ class DatabaseConnection extends \TYPO3\CMS\Core\Database\DatabaseConnection {
        protected function compileSelectParameters(array $params) {
                $select_fields = $this->SQLparser->compileFieldList($params[0]);
                $from_table = $this->SQLparser->compileFromTables($params[1]);
-               $where_clause = count($params[2]) > 0 ? $this->SQLparser->compileWhereClause($params[2]) : '';
-               $groupBy = count($params[3]) > 0 ? $this->SQLparser->compileFieldList($params[3]) : '';
-               $orderBy = count($params[4]) > 0 ? $this->SQLparser->compileFieldList($params[4]) : '';
+               $where_clause = !empty($params[2]) ? $this->SQLparser->compileWhereClause($params[2]) : '';
+               $groupBy = !empty($params[3]) ? $this->SQLparser->compileFieldList($params[3]) : '';
+               $orderBy = !empty($params[4]) ? $this->SQLparser->compileFieldList($params[4]) : '';
                return array($select_fields, $from_table, $where_clause, $groupBy, $orderBy);
        }
 
@@ -1372,7 +1372,7 @@ class DatabaseConnection extends \TYPO3\CMS\Core\Database\DatabaseConnection {
                        }
                }
                $ORIG_tableName = '';
-               if (count($precompiledParts) == 0) {
+               if (empty($precompiledParts)) {
                        // Map table / field names if needed:
                        $ORIG_tableName = $from_table;
                        // Saving table names in $ORIG_from_table since $from_table is transformed beneath:
@@ -2594,7 +2594,7 @@ class DatabaseConnection extends \TYPO3\CMS\Core\Database\DatabaseConnection {
                                break;
                }
                // Check mapping:
-               if (is_array($this->mapping) && count($this->mapping)) {
+               if (is_array($this->mapping) && !empty($this->mapping)) {
                        // Mapping table names in reverse, first getting list of real table names:
                        $tMap = array();
                        foreach ($this->mapping as $tN => $tMapInfo) {
@@ -2900,7 +2900,7 @@ class DatabaseConnection extends \TYPO3\CMS\Core\Database\DatabaseConnection {
                        $_tableList = $tableList;
                        $tableArray = $this->SQLparser->parseFromTables($_tableList);
                        // If success, traverse the tables:
-                       if (is_array($tableArray) && count($tableArray)) {
+                       if (is_array($tableArray) && !empty($tableArray)) {
                                $outputHandlerKey = '';
                                foreach ($tableArray as $vArray) {
                                        // Find handler key, select "_DEFAULT" if none is specifically configured:
@@ -3687,7 +3687,7 @@ class DatabaseConnection extends \TYPO3\CMS\Core\Database\DatabaseConnection {
                                                                unset($parseResults[$k]);
                                                        }
                                                }
-                                               if (count($parseResults)) {
+                                               if (!empty($parseResults)) {
                                                        $data['parseError'] = $parseResults;
                                                        $errorFlag |= 2;
                                                }
@@ -3741,10 +3741,10 @@ class DatabaseConnection extends \TYPO3\CMS\Core\Database\DatabaseConnection {
        public function debug_log($query, $ms, $data, $join, $errorFlag, $script = '') {
                if (is_array($query)) {
                        $queryToLog = $query[0] . ' --  ';
-                       if (count($query[1])) {
+                       if (!empty($query[1])) {
                                $queryToLog .= count($query[1]) . ' BLOB FIELDS: ' . implode(', ', array_keys($query[1]));
                        }
-                       if (count($query[2])) {
+                       if (!empty($query[2])) {
                                $queryToLog .= count($query[2]) . ' CLOB FIELDS: ' . implode(', ', array_keys($query[2]));
                        }
                } else {
index 8a7f595..12ec5fd 100644 (file)
@@ -60,7 +60,7 @@ class DatabaseRecordList extends \TYPO3\CMS\Recordlist\RecordList\DatabaseRecord
                                        }
                                }
                                // If search-fields were defined (and there always are) we create the query:
-                               if (count($sfields)) {
+                               if (!empty($sfields)) {
                                        $like = ' LIKE \'%' . $GLOBALS['TYPO3_DB']->quoteStr($this->searchString, $table) . '%\'';
                                        // Free-text
                                        $queryPart .= implode(($like . ' OR '), $sfields) . $like;
index af33f98..65563fb 100644 (file)
@@ -702,7 +702,8 @@ class SqlParserTest extends AbstractTestCase {
                $sql = 'SELECT * FROM pages WHERE pid = ? AND timestamp < ? AND title != \'How to test?\'';
                $parameterValues = array(12, 1281782690);
                $components = $this->subject->_callRef('parseSELECT', $sql);
-               for ($i = 0; $i < count($components['parameters']['?']); $i++) {
+               $questionMarkParamCount = count($components['parameters']['?']);
+               for ($i = 0; $i < $questionMarkParamCount; $i++) {
                        $components['parameters']['?'][$i][0] = $parameterValues[$i];
                }
 
index 5d0f129..a404c95 100644 (file)
@@ -161,7 +161,7 @@ class FrontendLoginController extends \TYPO3\CMS\Frontend\Plugin\AbstractPlugin
                // Redirect
                if ($this->conf['redirectMode'] && !$this->conf['redirectDisable'] && !$this->noRedirect && !$this->conf['showLogoutFormAfterLogin']) {
                        $redirectUrl = $this->processRedirect();
-                       if (count($redirectUrl)) {
+                       if (!empty($redirectUrl)) {
                                $this->redirectUrl = $this->conf['redirectFirstMethod'] ? array_shift($redirectUrl) : array_pop($redirectUrl);
                        } else {
                                $this->redirectUrl = '';
@@ -573,10 +573,10 @@ class FrontendLoginController extends \TYPO3\CMS\Frontend\Plugin\AbstractPlugin
                                $extraHiddenAr[] = $hid;
                        }
                }
-               if (count($onSubmitAr)) {
+               if (!empty($onSubmitAr)) {
                        $onSubmit = implode('; ', $onSubmitAr) . '; return true;';
                }
-               if (count($extraHiddenAr)) {
+               if (!empty($extraHiddenAr)) {
                        $extraHidden = implode(LF, $extraHiddenAr);
                }
                if (!$gpRedirectUrl && $this->redirectUrl) {
@@ -755,11 +755,10 @@ class FrontendLoginController extends \TYPO3\CMS\Frontend\Plugin\AbstractPlugin
                        }
                }
                // Remove empty values
-               if (count($redirect_url)) {
+               if (!empty($redirect_url)) {
                        return GeneralUtility::trimExplode(',', implode(',', $redirect_url), TRUE);
-               } else {
-                       return array();
                }
+               return array();
        }
 
        /**
@@ -833,7 +832,7 @@ class FrontendLoginController extends \TYPO3\CMS\Frontend\Plugin\AbstractPlugin
         */
        protected function getPageLink($label, $piVars, $returnUrl = FALSE) {
                $additionalParams = '';
-               if (count($piVars)) {
+               if (!empty($piVars)) {
                        foreach ($piVars as $key => $val) {
                                $additionalParams .= '&' . $key . '=' . $val;
                        }
index 96deb5f..4be77f9 100644 (file)
@@ -78,7 +78,7 @@ class ActionTask implements \TYPO3\CMS\Taskcenter\TaskInterface {
                } else {
                        $record = BackendUtility::getRecord('sys_action', $show);
                        // If the action is not found
-                       if (count($record) == 0) {
+                       if (empty($record)) {
                                $flashMessage = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Messaging\FlashMessage::class, $this->getLanguageService()->getLL('action_error-not-found', TRUE), $this->getLanguageService()->getLL('action_error'), \TYPO3\CMS\Core\Messaging\FlashMessage::ERROR);
                                $content .= $flashMessage->render();
                        } else {
@@ -124,7 +124,7 @@ class ActionTask implements \TYPO3\CMS\Taskcenter\TaskInterface {
                $content = '<p>' . $this->getLanguageService()->getLL('description') . '</p>';
                // Get the actions
                $actionList = $this->getActions();
-               if (count($actionList) > 0) {
+               if (!empty($actionList)) {
                        $items = '';
                        // Render a single action menu item
                        foreach ($actionList as $action) {
@@ -191,7 +191,7 @@ class ActionTask implements \TYPO3\CMS\Taskcenter\TaskInterface {
                // Get the sys_action records
                $actionList = $this->getActions();
                // If any actions are found for the current users
-               if (count($actionList) > 0) {
+               if (!empty($actionList)) {
                        $content .= $this->taskObject->renderListMenu($actionList);
                } else {
                        $flashMessage = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Messaging\FlashMessage::class, $this->getLanguageService()->getLL('action_not-found-description', TRUE), $this->getLanguageService()->getLL('action_not-found'), \TYPO3\CMS\Core\Messaging\FlashMessage::INFO);
@@ -255,7 +255,7 @@ class ActionTask implements \TYPO3\CMS\Taskcenter\TaskInterface {
                                }
                        }
                        // Show errors if there are any
-                       if (count($errors) > 0) {
+                       if (!empty($errors)) {
                                $flashMessage = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Messaging\FlashMessage::class, implode('<br />', $errors), $this->getLanguageService()->getLL('action_error'), \TYPO3\CMS\Core\Messaging\FlashMessage::ERROR);
                                $content .= $flashMessage->render() . '<br />';
                        } else {
@@ -381,7 +381,7 @@ class ActionTask implements \TYPO3\CMS\Taskcenter\TaskInterface {
                }
                $this->getDatabaseConnection()->sql_free_result($res);
                // If any records found
-               if (count($userList)) {
+               if (!empty($userList)) {
                        $content .= '<br />' . $this->taskObject->doc->section($this->getLanguageService()->getLL('action_t1_listOfUsers'), implode('<br />', $userList));
                }
                return $content;
index e6f4cfb..bedafd6 100644 (file)
@@ -136,7 +136,7 @@ class ActionToolbarItem implements ToolbarItemInterface {
         */
        public function checkAccess() {
                $result = FALSE;
-               if (count($this->actionEntries)) {
+               if (!empty($this->actionEntries)) {
                        $result = TRUE;
                }
                return $result;
index 521d247..5f1b701 100644 (file)
@@ -124,7 +124,7 @@ class TypoScriptTemplateInfoHook {
                                                        }
                                                }
                                        }
-                                       if (count($recData)) {
+                                       if (!empty($recData)) {
                                                // process template row before saving
                                                $tstemplateinfo = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Tstemplate\Controller\TypoScriptTemplateInformationModuleFunctionController::class);
                                                /* @var $tstemplateinfo \TYPO3\CMS\Tstemplate\Controller\TypoScriptTemplateInformationModuleFunctionController */
index cb803c7..ce78c7a 100644 (file)
@@ -316,7 +316,7 @@ class T3editor implements \TYPO3\CMS\Core\SingletonInterface {
                $code .= '<div>' . '<textarea id="t3editor_' . $this->editorCounter . '" ' . 'name="' . $name . '" ' . 'class="' . $class . '" ' . $additionalParams . ' ' . $alt . '>' . htmlspecialchars($content) . '</textarea></div>';
                $checked = $GLOBALS['BE_USER']->uc['disableT3Editor'] ? 'checked="checked"' : '';
                $code .= '<div class="checkbox"><label for="t3editor_disableEditor_' . $this->editorCounter . '_checkbox"><input type="checkbox" class="checkbox t3editor_disableEditor" onclick="T3editor.toggleEditor(this);" name="t3editor_disableEditor" value="true" id="t3editor_disableEditor_' . $this->editorCounter . '_checkbox" ' . $checked . ' />' . $GLOBALS['LANG']->getLL('deactivate') . '</label></div>';
-               if (count($hiddenfields)) {
+               if (!empty($hiddenfields)) {
                        foreach ($hiddenfields as $name => $value) {
                                $code .= '<input type="hidden" ' . 'name="' . $name . '" ' . 'value="' . $value . '" />';
                        }
index 5992842..5ca7d20 100644 (file)
@@ -231,7 +231,7 @@ class TaskModuleController extends \TYPO3\CMS\Backend\Module\BaseScriptClass {
                                $items = $newSorting + $items;
                        }
                }
-               if (is_array($items) && count($items) > 0) {
+               if (is_array($items) && !empty($items)) {
                        foreach ($items as $item) {
                                $title = htmlspecialchars($item['title']);
                                $icon = ($additionalClass = ($collapsedStyle = ''));
@@ -301,7 +301,7 @@ class TaskModuleController extends \TYPO3\CMS\Backend\Module\BaseScriptClass {
                $tasks = array();
                $icon = ExtensionManagementUtility::extRelPath('taskcenter') . 'Resources/Public/Icons/module-taskcenter.png';
                // Render the tasks only if there are any available
-               if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['taskcenter']) && count($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['taskcenter']) > 0) {
+               if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['taskcenter']) && !empty($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['taskcenter'])) {
                        foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['taskcenter'] as $extKey => $extensionReports) {
                                foreach ($extensionReports as $taskClass => $task) {
                                        if (!$this->checkAccess($extKey, $taskClass)) {
index ba2890e..50be5fa 100644 (file)
@@ -157,7 +157,7 @@ class TypoScriptTemplateConstantEditorModuleFunctionController extends AbstractF
                                $theOutput .= $this->pObj->doc->section('', $manyTemplatesMenu);
                        }
                        $theOutput .= $this->pObj->doc->spacer(10);
-                       if (count($this->pObj->MOD_MENU['constant_editor_cat'])) {
+                       if (!empty($this->pObj->MOD_MENU['constant_editor_cat'])) {
                                $menu = BackendUtility::getFuncMenu($this->pObj->id, 'SET[constant_editor_cat]', $this->pObj->MOD_SETTINGS['constant_editor_cat'], $this->pObj->MOD_MENU['constant_editor_cat']);
                                $theOutput .= $this->pObj->doc->section($lang->getLL('category', TRUE), '<span class="text-nowrap">' . $menu . '</span>', FALSE);
                        } else {
index da7f303..375868e 100644 (file)
@@ -199,7 +199,7 @@ class TypoScriptTemplateInformationModuleFunctionController extends AbstractFunc
                                                }
                                        }
                                }
-                               if (count($recData)) {
+                               if (!empty($recData)) {
                                        $recData['sys_template'][$saveId] = $this->processTemplateRowBeforeSaving($recData['sys_template'][$saveId]);
                                        // Create new  tce-object
                                        $tce = GeneralUtility::makeInstance(DataHandler::class);
index 394be7e..66dccdb 100644 (file)
@@ -300,7 +300,7 @@ class TypoScriptTemplateModuleController extends BaseScriptClass {
                                        $url = BackendUtility::getModuleUrl('web_ts', array('id' => $this->id));
                                        $buttons['close'] = '<a href="' . htmlspecialchars($url) . '" title="' . $lang->sL('LLL:EXT:lang/locallang_core.xlf:rm.closeDoc', TRUE) . '">' .  IconUtility::getSpriteIcon('actions-document-close') .'</a>';
                                }
-                       } elseif ($this->extClassConf['name'] === TypoScriptTemplateConstantEditorModuleFunctionController::class && count($this->MOD_MENU['constant_editor_cat'])) {
+                       } elseif ($this->extClassConf['name'] === TypoScriptTemplateConstantEditorModuleFunctionController::class && !empty($this->MOD_MENU['constant_editor_cat'])) {
                                // SAVE button
                                $buttons['save'] = IconUtility::getSpriteIcon('actions-document-save', array('html' => '<input type="image" class="c-inputButton" name="submit" src="clear.gif" ' . 'title="' . $lang->sL('LLL:EXT:lang/locallang_core.xlf:rm.saveDoc', TRUE) . '" ' . 'value="' . $lang->sL('LLL:EXT:lang/locallang_core.xlf:rm.saveDoc', TRUE) . '" ' . '/>'));
                        } elseif ($this->extClassConf['name'] === TypoScriptTemplateObjectBrowserModuleFunctionController::class) {
@@ -526,7 +526,7 @@ page.10.value = HELLO WORLD!
                $cEl = current($rlArr);
                $pArray[$cEl['uid']] = htmlspecialchars($cEl['title']);
                array_shift($rlArr);
-               if (count($rlArr)) {
+               if (!empty($rlArr)) {
                        if (!isset($pArray[($cEl['uid'] . '.')])) {
                                $pArray[$cEl['uid'] . '.'] = array();
                        }
index 82f57bb..d11ea3e 100644 (file)
@@ -94,7 +94,7 @@ class TypoScriptTemplateObjectBrowserModuleFunctionController extends AbstractFu
                                }
                                $this->getBackendUserAuthentication()->pushModuleData($this->pObj->MCONF['name'], $this->pObj->MOD_SETTINGS);
                        }
-                       if (count($this->pObj->MOD_SETTINGS['ts_browser_TLKeys_' . $bType])) {
+                       if (!empty($this->pObj->MOD_SETTINGS['ts_browser_TLKeys_' . $bType])) {
                                $modMenu['ts_browser_toplevel_' . $bType]['-'] = '---';
                                $modMenu['ts_browser_toplevel_' . $bType] = $modMenu[('ts_browser_toplevel_' . $bType)] + $this->pObj->MOD_SETTINGS[('ts_browser_TLKeys_' . $bType)];
                        }
@@ -363,7 +363,7 @@ class TypoScriptTemplateObjectBrowserModuleFunctionController extends AbstractFu
                        );
                        $aHref = BackendUtility::getModuleUrl('web_ts', $urlParameters);
                        if (!$this->pObj->MOD_SETTINGS[('ts_browser_TLKeys_' . $bType)][$this->pObj->sObj]) {
-                               if (count($theSetup)) {
+                               if (!empty($theSetup)) {
                                        $out = '<a href="' . htmlspecialchars(($aHref . '&addKey[' . rawurlencode($this->pObj->sObj) . ']=1&SET[ts_browser_toplevel_' . $bType . ']=' . rawurlencode($this->pObj->sObj))) . '">';
                                        $out .= sprintf($lang->getLL('addKey'), htmlspecialchars($this->pObj->sObj));
                                }
@@ -429,7 +429,7 @@ class TypoScriptTemplateObjectBrowserModuleFunctionController extends AbstractFu
                        $aHref = BackendUtility::getModuleUrl('web_ts', $urlParameters);
                        // Parser Errors:
                        $pEkey = $bType == 'setup' ? 'config' : 'constants';
-                       if (count($templateService->parserErrors[$pEkey])) {
+                       if (!empty($templateService->parserErrors[$pEkey])) {
                                $errMsg = array();
                                foreach ($templateService->parserErrors[$pEkey] as $inf) {
                                        $errorLink = ' <a href="' . htmlspecialchars(($aHref . '&SET[function]=TYPO3\\CMS\\Tstemplate\\Controller\\TemplateAnalyzerModuleFunctionController&template=all&SET[ts_analyzer_checkLinenum]=1#line-' . $inf[2])) . '">' . $lang->getLL('errorShowDetails') . '</a>';