[CLEANUP] Replace count with empty in EXT:frontend 91/40691/3
authorAndreas Fernandez <a.fernandez@scripting-base.de>
Sat, 27 Jun 2015 15:13:48 +0000 (17:13 +0200)
committerMarkus Klein <markus.klein@typo3.org>
Tue, 30 Jun 2015 16:32:35 +0000 (18:32 +0200)
Resolves: #67784
Releases: master
Change-Id: I65b01b82692a981eee1c0d3cc6d6d161f9d80daf
Reviewed-on: http://review.typo3.org/40691
Reviewed-by: Frederic Gaus <frederic.gaus@flagbit.de>
Tested-by: Frederic Gaus <frederic.gaus@flagbit.de>
Reviewed-by: Markus Klein <markus.klein@typo3.org>
Tested-by: Markus Klein <markus.klein@typo3.org>
typo3/sysext/frontend/Classes/Authentication/FrontendUserAuthentication.php
typo3/sysext/frontend/Classes/ContentObject/ContentObjectRenderer.php
typo3/sysext/frontend/Classes/ContentObject/Menu/AbstractMenuContentObject.php
typo3/sysext/frontend/Classes/ContentObject/Menu/GraphicalMenuContentObject.php
typo3/sysext/frontend/Classes/Controller/TranslationStatusController.php
typo3/sysext/frontend/Classes/Controller/TypoScriptFrontendController.php
typo3/sysext/frontend/Classes/Imaging/GifBuilder.php
typo3/sysext/frontend/Classes/Page/PageGenerator.php
typo3/sysext/frontend/Classes/Plugin/AbstractPlugin.php
typo3/sysext/frontend/Classes/View/AdminPanelView.php

index 63b2745..a81baa0 100644 (file)
@@ -295,7 +295,7 @@ class FrontendUserAuthentication extends AbstractUserAuthentication {
                        $serviceChain .= ',' . $serviceObj->getServiceKey();
                        $serviceObj->initAuth($subType, array(), $authInfo, $this);
                        $groupData = $serviceObj->getGroups($this->user, $groupDataArr);
-                       if (is_array($groupData) && count($groupData)) {
+                       if (is_array($groupData) && !empty($groupData)) {
                                // Keys in $groupData should be unique ids of the groups (like "uid") so this function will override groups.
                                $groupDataArr = $groupData + $groupDataArr;
                        }
@@ -304,10 +304,10 @@ class FrontendUserAuthentication extends AbstractUserAuthentication {
                if ($this->writeDevLog && $serviceChain) {
                        GeneralUtility::devLog($subType . ' auth services called: ' . $serviceChain, __CLASS__);
                }
-               if ($this->writeDevLog && !count($groupDataArr)) {
+               if ($this->writeDevLog && empty($groupDataArr)) {
                        GeneralUtility::devLog('No usergroups found by services', __CLASS__);
                }
-               if ($this->writeDevLog && count($groupDataArr)) {
+               if ($this->writeDevLog && !empty($groupDataArr)) {
                        GeneralUtility::devLog(count($groupDataArr) . ' usergroup records found by services', __CLASS__);
                }
                // Use 'auth' service to check the usergroups if they are really valid
@@ -336,7 +336,7 @@ class FrontendUserAuthentication extends AbstractUserAuthentication {
                                $this->groupData['TSconfig'][$groupData['uid']] = $groupData['TSconfig'];
                        }
                }
-               if (count($this->groupData) && count($this->groupData['TSconfig'])) {
+               if (!empty($this->groupData) && !empty($this->groupData['TSconfig'])) {
                        // TSconfig: collect it in the order it was collected
                        foreach ($this->groupData['TSconfig'] as $TSdata) {
                                $this->TSdataArray[] = $TSdata;
@@ -347,7 +347,7 @@ class FrontendUserAuthentication extends AbstractUserAuthentication {
                        ksort($this->groupData['uid']);
                        ksort($this->groupData['pid']);
                }
-               return count($this->groupData['uid']) ?: 0;
+               return !empty($this->groupData['uid']) ? count($this->groupData['uid']) : 0;
        }
 
        /**
@@ -385,7 +385,7 @@ class FrontendUserAuthentication extends AbstractUserAuthentication {
         */
        public function fetchSessionData() {
                // Gets SesData if any AND if not already selected by session fixation check in ->isExistingSessionRecord()
-               if ($this->id && !count($this->sesData)) {
+               if ($this->id && empty($this->sesData)) {
                        $statement = $this->db->prepare_SELECTquery('*', 'fe_session_data', 'hash = :hash');
                        $statement->execute(array(':hash' => $this->id));
                        if (($sesDataRow = $statement->fetch()) !== FALSE) {
index b2ec17c..0df1e4b 100644 (file)
@@ -1433,7 +1433,7 @@ class ContentObjectRenderer {
                                continue;
                        }
                        if (isset($value['el'])) {
-                               if (is_array($value['el']) && count($value['el']) > 0) {
+                               if (is_array($value['el']) && !empty($value['el'])) {
                                        foreach ($value['el'] as $ekey => $element) {
                                                if (isset($element['vDEF'])) {
                                                        $conf[$ekey] = $element['vDEF'];
@@ -1473,7 +1473,7 @@ class ContentObjectRenderer {
                        $listArr = $this->checkPidArray($listArr);
                }
                $pidList = array();
-               if (is_array($listArr) && count($listArr)) {
+               if (is_array($listArr) && !empty($listArr)) {
                        foreach ($listArr as $uid) {
                                $page = $GLOBALS['TSFE']->sys_page->getPage($uid);
                                if (!$page['is_siteroot']) {
@@ -2064,7 +2064,7 @@ class ContentObjectRenderer {
                $sPkeys = array_keys($subpartContentArray);
                $wPkeys = array_keys($wrappedSubpartContentArray);
                $aKeys = array_merge(array_keys($markContentArray), $sPkeys, $wPkeys);
-               if (!count($aKeys)) {
+               if (empty($aKeys)) {
                        $GLOBALS['TT']->pull();
                        return $content;
                }
@@ -3918,14 +3918,14 @@ class ContentObjectRenderer {
                                        $d->close();
                                }
                                // Sort if required
-                               if (count($items['sorting'])) {
+                               if (!empty($items['sorting'])) {
                                        if (strtolower(trim($data_arr[3])) != 'r') {
                                                asort($items['sorting']);
                                        } else {
                                                arsort($items['sorting']);
                                        }
                                }
-                               if (count($items['files'])) {
+                               if (!empty($items['files'])) {
                                        // Make list
                                        reset($items['sorting']);
                                        $fullPath = trim($data_arr[4]);
@@ -4701,7 +4701,7 @@ class ContentObjectRenderer {
                $conf['max'] = isset($conf['max.']) ? (int)$this->stdWrap($conf['max'], $conf['max.']) : (int)$conf['max'];
                $conf['min'] = isset($conf['min.']) ? (int)$this->stdWrap($conf['min'], $conf['min.']) : (int)$conf['min'];
                $valArr = explode($conf['token'], $value);
-               if (count($valArr) && (MathUtility::canBeInterpretedAsInteger($conf['returnKey']) || $conf['returnKey.'])) {
+               if (!empty($valArr) && (MathUtility::canBeInterpretedAsInteger($conf['returnKey']) || $conf['returnKey.'])) {
                        $key = isset($conf['returnKey.']) ? (int)$this->stdWrap($conf['returnKey'], $conf['returnKey.']) : (int)$conf['returnKey'];
                        $content = isset($valArr[$key]) ? $valArr[$key] : '';
                } else {
@@ -6053,7 +6053,7 @@ class ContentObjectRenderer {
                $urlChar = intval(strpos($linkParameter, '.'));
 
                // Firsts, test if $linkParameter is numeric and page with such id exists. If yes, do not attempt to link to file
-               if (!MathUtility::canBeInterpretedAsInteger($linkParameter) || count($GLOBALS['TSFE']->sys_page->getPage_noCheck($linkParameter)) == 0) {
+               if (!MathUtility::canBeInterpretedAsInteger($linkParameter) || empty($GLOBALS['TSFE']->sys_page->getPage_noCheck($linkParameter))) {
                        // Detects if a file is found in site-root and if so it will be treated like a normal file.
                        list($rootFileDat) = explode('?', rawurldecode($linkParameter));
                        $containsSlash = (strpos($rootFileDat, '/') !== FALSE);
@@ -6285,7 +6285,7 @@ class ContentObjectRenderer {
                                        }
                                        // Looking up the page record to verify its existence:
                                        $page = $GLOBALS['TSFE']->sys_page->getPage($linkParameter, $disableGroupAccessCheck);
-                                       if (count($page)) {
+                                       if (!empty($page)) {
                                                // MointPoints, look for closest MPvar:
                                                $MPvarAcc = array();
                                                if (!$GLOBALS['TSFE']->config['config']['MP_disableTypolinkClosestMPvalue']) {
@@ -6298,7 +6298,7 @@ class ContentObjectRenderer {
                                                $mount_info = $GLOBALS['TSFE']->sys_page->getMountPointInfo($page['uid'], $page);
                                                if (is_array($mount_info) && $mount_info['overlay']) {
                                                        $page = $GLOBALS['TSFE']->sys_page->getPage($mount_info['mount_pid'], $disableGroupAccessCheck);
-                                                       if (!count($page)) {
+                                                       if (empty($page)) {
                                                                $GLOBALS['TT']->setTSlogMessage('typolink(): Mount point \'' . $mount_info['mount_pid'] . '\' was not available, so \'' . $linktxt . '\' was not linked.', 1);
                                                                return $linktxt;
                                                        }
@@ -6328,7 +6328,7 @@ class ContentObjectRenderer {
                                                $targetDomain = '';
                                                $currentDomain = $this->getEnvironmentVariable('HTTP_HOST');
                                                // Mount pages are always local and never link to another domain
-                                               if (count($MPvarAcc)) {
+                                               if (!empty($MPvarAcc)) {
                                                        // Add "&MP" var:
                                                        $addQueryParams .= '&MP=' . rawurlencode(implode(',', $MPvarAcc));
                                                } elseif (strpos($addQueryParams, '&MP=') === FALSE && $GLOBALS['TSFE']->config['config']['typolinkCheckRootline']) {
@@ -6347,7 +6347,7 @@ class ContentObjectRenderer {
                                                                        $page = $GLOBALS['TSFE']->sys_page->getPage($page['shortcut'], $disableGroupAccessCheck);
                                                                        $maxLoopCount--;
                                                                }
-                                                               if (count($page) == 0 || $maxLoopCount == 0) {
+                                                               if (empty($page) || $maxLoopCount == 0) {
                                                                        // We revert if shortcut is broken or maximum number of loops is exceeded (indicates endless loop)
                                                                        $page = $page2;
                                                                }
@@ -6432,7 +6432,7 @@ class ContentObjectRenderer {
                                                                unset($URLparamsArray['id']);
                                                                unset($URLparamsArray['type']);
                                                                // If there are no parameters left.... set the new url.
-                                                               if (!count($URLparamsArray)) {
+                                                               if (empty($URLparamsArray)) {
                                                                        $this->lastTypoLinkUrl = $sectionMark;
                                                                }
                                                        }
@@ -6613,7 +6613,7 @@ class ContentObjectRenderer {
                        $conf['fileTarget'] = $target;
                }
                if (is_array($urlParameters)) {
-                       if (count($urlParameters)) {
+                       if (!empty($urlParameters)) {
                                $conf['additionalParams'] .= GeneralUtility::implodeArrayForUrl('', $urlParameters);
                        }
                } else {
@@ -6729,7 +6729,7 @@ class ContentObjectRenderer {
                                                break;
                                        }
                                }
-                               if (count($rl_mpArray)) {
+                               if (!empty($rl_mpArray)) {
                                        $MP = implode(',', array_reverse($rl_mpArray));
                                }
                        }
@@ -7104,7 +7104,7 @@ class ContentObjectRenderer {
                }
                $mail->setFrom($sender);
                $parsedReplyTo = MailUtility::parseAddresses($replyTo);
-               if (count($parsedReplyTo) > 0) {
+               if (!empty($parsedReplyTo)) {
                        $mail->setReplyTo($parsedReplyTo);
                }
                $message = trim($message);
@@ -7114,17 +7114,17 @@ class ContentObjectRenderer {
                        $subject = trim($messageParts[0]);
                        $plainMessage = trim($messageParts[1]);
                        $parsedRecipients = MailUtility::parseAddresses($recipients);
-                       if (count($parsedRecipients) > 0) {
+                       if (!empty($parsedRecipients)) {
                                $mail->setTo($parsedRecipients)
                                        ->setSubject($subject)
                                        ->setBody($plainMessage);
                                $mail->send();
                        }
                        $parsedCc = MailUtility::parseAddresses($cc);
-                       if (count($parsedCc) > 0) {
+                       if (!empty($parsedCc)) {
                                /** @var $mail MailMessage */
                                $mail = GeneralUtility::makeInstance(MailMessage::class);
-                               if (count($parsedReplyTo) > 0) {
+                               if (!empty($parsedReplyTo)) {
                                        $mail->setReplyTo($parsedReplyTo);
                                }
                                $mail->setFrom($sender)
@@ -7187,7 +7187,7 @@ class ContentObjectRenderer {
                        // $name and $conf is loaded with the referenced values.
                        $old_conf = $confArr[$prop . '.'];
                        list($name, $conf) = $cF->getVal($key, $GLOBALS['TSFE']->tmpl->setup);
-                       if (is_array($old_conf) && count($old_conf)) {
+                       if (is_array($old_conf) && !empty($old_conf)) {
                                $conf = is_array($conf) ? array_replace_recursive($conf, $old_conf) : $old_conf;
                        }
                        $confArr[$prop . '.'] = $conf;
@@ -7389,12 +7389,11 @@ class ContentObjectRenderer {
                        if ($GLOBALS['TCA'][$table]['ctrl']['tstamp']) {
                                $updateFields[$GLOBALS['TCA'][$table]['ctrl']['tstamp']] = $GLOBALS['EXEC_TIME'];
                        }
-                       if (count($updateFields)) {
+                       if (!empty($updateFields)) {
                                if ($doExec) {
                                        return $GLOBALS['TYPO3_DB']->exec_UPDATEquery($table, 'uid=' . $uid, $updateFields);
-                               } else {
-                                       return $GLOBALS['TYPO3_DB']->UPDATEquery($table, 'uid=' . $uid, $updateFields);
                                }
+                               return $GLOBALS['TYPO3_DB']->UPDATEquery($table, 'uid=' . $uid, $updateFields);
                        }
                }
        }
@@ -7535,7 +7534,7 @@ class ContentObjectRenderer {
                        $OR_arr[] = 'uid=' . (int)$feUserRow['uid'];
                }
                $whereDef = ' AND 1=0';
-               if (count($OR_arr)) {
+               if (!empty($OR_arr)) {
                        $whereDef = ' AND (' . implode(' OR ', $OR_arr) . ')';
                        if ($GLOBALS['TCA'][$table]['ctrl']['fe_admin_lock']) {
                                $whereDef .= ' AND ' . $GLOBALS['TCA'][$table]['ctrl']['fe_admin_lock'] . '=0';
@@ -7812,7 +7811,7 @@ class ContentObjectRenderer {
                                                $where_p[] = $prefixTableName . $field . ' LIKE \'%' . $val . '%\'';
                                        }
                                }
-                               if (count($where_p)) {
+                               if (!empty($where_p)) {
                                        $where .= ' AND (' . implode(' OR ', $where_p) . ')';
                                }
                        }
@@ -8161,7 +8160,7 @@ class ContentObjectRenderer {
         */
        public function checkPidArray($listArr) {
                $outArr = array();
-               if (is_array($listArr) && count($listArr)) {
+               if (is_array($listArr) && !empty($listArr)) {
                        $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('uid', 'pages', 'uid IN (' . implode(',', $listArr) . ')' . $this->enableFields('pages') . ' AND doktype NOT IN (' . $this->checkPid_badDoktypeList . ')');
                        if ($error = $GLOBALS['TYPO3_DB']->sql_error()) {
                                $GLOBALS['TT']->setTSlogMessage($error . ': ' . $GLOBALS['TYPO3_DB']->debug_lastBuiltQuery, 3);
@@ -8283,7 +8282,7 @@ class ContentObjectRenderer {
                        if (!$currentRecord) {
                                $currentRecord = $this->currentRecord;
                        }
-                       if (!count($dataArr)) {
+                       if (empty($dataArr)) {
                                $dataArr = $this->data;
                        }
                        // Delegate rendering of the edit panel to the frontend edit
@@ -8309,7 +8308,7 @@ class ContentObjectRenderer {
                        if (!$currentRecord) {
                                $currentRecord = $this->currentRecord;
                        }
-                       if (!count($dataArr)) {
+                       if (empty($dataArr)) {
                                $dataArr = $this->data;
                        }
                        // Delegate rendering of the edit panel to frontend edit class.
index 0c30f44..b1ed16f 100644 (file)
@@ -1102,7 +1102,7 @@ abstract class AbstractMenuContentObject {
                                        if ($v_b['uid'] == $value_rec['pid']) {
                                                if ($lastKey) {
                                                        $sectionRec_temp = $this->removeInaccessiblePages($this->sys_page->getMenu($prevnextsection_menu[$lastKey]['uid'], '*', $sortingField, $additionalWhere));
-                                                       if (count($sectionRec_temp)) {
+                                                       if (!empty($sectionRec_temp)) {
                                                                $recArr['prevsection'] = reset($sectionRec_temp);
                                                                $recArr['prevsection_last'] = end($sectionRec_temp);
                                                        }
@@ -1708,7 +1708,7 @@ abstract class AbstractMenuContentObject {
        public function subMenu($uid, $objSuffix = '') {
                // Setting alternative menu item array if _SUB_MENU has been defined in the current ->menuArr
                $altArray = '';
-               if (is_array($this->menuArr[$this->I['key']]['_SUB_MENU']) && count($this->menuArr[$this->I['key']]['_SUB_MENU'])) {
+               if (is_array($this->menuArr[$this->I['key']]['_SUB_MENU']) && !empty($this->menuArr[$this->I['key']]['_SUB_MENU'])) {
                        $altArray = $this->menuArr[$this->I['key']]['_SUB_MENU'];
                }
                // Make submenu if the page is the next active
index 5e35500..4d1a5d4 100644 (file)
@@ -393,7 +393,7 @@ class GraphicalMenuContentObject extends AbstractMenuContentObject {
                                if (!$this->I['uid'] && !$this->menuArr[$key]['_OVERRIDE_HREF']) {
                                        $this->I['spacer'] = 1;
                                }
-                               $this->I['noLink'] = $this->I['spacer'] || $this->I['val']['noLink'] || !count($this->menuArr[$key]);
+                               $this->I['noLink'] = $this->I['spacer'] || $this->I['val']['noLink'] || empty($this->menuArr[$key]);
                                // !count($this->menuArr[$key]) means that this item is a dummyItem
                                $this->I['name'] = '';
                                // Set access key
index ffafd05..4ef2cd0 100644 (file)
@@ -285,7 +285,7 @@ class TranslationStatusController extends \TYPO3\CMS\Backend\Module\AbstractFunc
                $res = $this->getDatabaseConnection()->exec_SELECTquery('*', 'sys_language', '1=1' . BackendUtility::deleteClause('sys_language'));
                $outputArray = array();
                while ($row = $this->getDatabaseConnection()->sql_fetch_assoc($res)) {
-                       if (is_array($allowed_languages) && count($allowed_languages)) {
+                       if (is_array($allowed_languages) && !empty($allowed_languages)) {
                                if (isset($allowed_languages[$row['uid']])) {
                                        $outputArray[] = $row;
                                }
index 5ebca9c..e503ea0 100644 (file)
@@ -1072,7 +1072,7 @@ class TypoScriptFrontendController {
                $this->fe_user->showHiddenRecords = $this->showHiddenRecords;
                // no matter if we have an active user we try to fetch matching groups which can be set without an user (simulation for instance!)
                $this->fe_user->fetchGroupData();
-               if (is_array($this->fe_user->user) && count($this->fe_user->groupData['uid'])) {
+               if (is_array($this->fe_user->user) && !empty($this->fe_user->groupData['uid'])) {
                        // global flag!
                        $this->loginUser = TRUE;
                        // group -2 is not an existing group, but denotes a 'default' group when a user IS logged in. This is used to let elements be shown for all logged in users!
@@ -1095,7 +1095,7 @@ class TypoScriptFrontendController {
                $gr_array = array_unique($gr_array);
                // sort
                sort($gr_array);
-               if (count($gr_array) && !$this->loginAllowedInBranch_mode) {
+               if (!empty($gr_array) && !$this->loginAllowedInBranch_mode) {
                        $this->gr_list .= ',' . implode(',', $gr_array);
                }
                if ($this->fe_user->writeDevLog) {
@@ -1277,10 +1277,10 @@ class TypoScriptFrontendController {
                                        $temp_sys_page = GeneralUtility::makeInstance(PageRepository::class);
                                        $temp_sys_page->init($this->showHiddenPage);
                                        // If root line contained NO records and ->error_getRootLine_failPid tells us that it was because of a pid=-1 (indicating a "version" record)...:
-                                       if (!count($temp_sys_page->getRootLine($this->id, $this->MP)) && $temp_sys_page->error_getRootLine_failPid == -1) {
+                                       if (empty($temp_sys_page->getRootLine($this->id, $this->MP)) && $temp_sys_page->error_getRootLine_failPid == -1) {
                                                // Setting versioningPreview flag and try again:
                                                $temp_sys_page->versioningPreview = TRUE;
-                                               if (count($temp_sys_page->getRootLine($this->id, $this->MP))) {
+                                               if (!empty($temp_sys_page->getRootLine($this->id, $this->MP))) {
                                                        // Finally, we got a root line (meaning that it WAS due to versioning preview of a page somewhere) and we set the fePreview flag which in itself will allow sys_page class to display previews of versionized records.
                                                        $this->fePreview = 1;
                                                }
@@ -1500,12 +1500,12 @@ class TypoScriptFrontendController {
         */
        public function getPageAndRootline() {
                $this->page = $this->sys_page->getPage($this->id);
-               if (!count($this->page)) {
+               if (empty($this->page)) {
                        // If no page, we try to find the page before in the rootLine.
                        // Page is 'not found' in case the id itself was not an accessible page. code 1
                        $this->pageNotFound = 1;
                        $this->rootLine = $this->sys_page->getRootLine($this->id, $this->MP);
-                       if (count($this->rootLine)) {
+                       if (!empty($this->rootLine)) {
                                $c = count($this->rootLine) - 1;
                                while ($c > 0) {
                                        // Add to page access failure history:
@@ -1514,13 +1514,13 @@ class TypoScriptFrontendController {
                                        $c--;
                                        $this->id = $this->rootLine[$c]['uid'];
                                        $this->page = $this->sys_page->getPage($this->id);
-                                       if (count($this->page)) {
+                                       if (!empty($this->page)) {
                                                break;
                                        }
                                }
                        }
                        // If still no page...
-                       if (!count($this->page)) {
+                       if (empty($this->page)) {
                                $message = 'The requested page does not exist!';
                                if ($this->TYPO3_CONF_VARS['FE']['pageNotFound_handling']) {
                                        $this->pageNotFoundAndExit($message);
@@ -1569,14 +1569,14 @@ class TypoScriptFrontendController {
                // Gets the rootLine
                $this->rootLine = $this->sys_page->getRootLine($this->id, $this->MP);
                // If not rootline we're off...
-               if (!count($this->rootLine)) {
+               if (empty($this->rootLine)) {
                        $ws = $this->whichWorkspace();
                        if ($this->sys_page->error_getRootLine_failPid == -1 && $ws) {
                                $this->sys_page->versioningPreview = TRUE;
                                $this->versioningWorkspaceId = $ws;
                                $this->rootLine = $this->sys_page->getRootLine($this->id, $this->MP);
                        }
-                       if (!count($this->rootLine)) {
+                       if (empty($this->rootLine)) {
                                $message = 'The requested page didn\'t have a proper connection to the tree-root!';
                                if ($this->checkPageUnavailableHandler()) {
                                        $this->pageUnavailableAndExit($message);
@@ -1590,7 +1590,7 @@ class TypoScriptFrontendController {
                }
                // Checking for include section regarding the hidden/starttime/endtime/fe_user (that is access control of a whole subbranch!)
                if ($this->checkRootlineForIncludeSection()) {
-                       if (!count($this->rootLine)) {
+                       if (empty($this->rootLine)) {
                                $message = 'The requested page was not accessible!';
                                if ($this->checkPageUnavailableHandler()) {
                                        $this->pageUnavailableAndExit($message);
@@ -1631,7 +1631,7 @@ class TypoScriptFrontendController {
                        case PageRepository::SHORTCUT_MODE_RANDOM_SUBPAGE:
                                $pageArray = $this->sys_page->getMenu($idArray[0] ? $idArray[0] : $thisUid, '*', 'sorting', 'AND pages.doktype<199 AND pages.doktype!=' . PageRepository::DOKTYPE_BE_USER_SECTION);
                                $pO = 0;
-                               if ($mode == PageRepository::SHORTCUT_MODE_RANDOM_SUBPAGE && count($pageArray)) {
+                               if ($mode == PageRepository::SHORTCUT_MODE_RANDOM_SUBPAGE && !empty($pageArray)) {
                                        $randval = (int)rand(0, count($pageArray) - 1);
                                        $pO = $randval;
                                }
@@ -1643,7 +1643,7 @@ class TypoScriptFrontendController {
                                        }
                                        $c++;
                                }
-                               if (count($page) == 0) {
+                               if (empty($page)) {
                                        $message = 'This page (ID ' . $thisUid . ') is of type "Shortcut" and configured to redirect to a subpage. ' . 'However, this page has no accessible subpages.';
                                        throw new PageNotFoundException($message, 1301648328);
                                }
@@ -1651,14 +1651,14 @@ class TypoScriptFrontendController {
                        case PageRepository::SHORTCUT_MODE_PARENT_PAGE:
                                $parent = $this->sys_page->getPage($idArray[0] ? $idArray[0] : $thisUid, $disableGroupCheck);
                                $page = $this->sys_page->getPage($parent['pid'], $disableGroupCheck);
-                               if (count($page) == 0) {
+                               if (empty($page)) {
                                        $message = 'This page (ID ' . $thisUid . ') is of type "Shortcut" and configured to redirect to its parent page. ' . 'However, the parent page is not accessible.';
                                        throw new PageNotFoundException($message, 1301648358);
                                }
                                break;
                        default:
                                $page = $this->sys_page->getPage($idArray[0], $disableGroupCheck);
-                               if (count($page) == 0) {
+                               if (empty($page)) {
                                        $message = 'This page (ID ' . $thisUid . ') is of type "Shortcut" and configured to redirect to a page, which is not accessible (ID ' . $idArray[0] . ').';
                                        throw new PageNotFoundException($message, 1301648404);
                                }
@@ -1811,7 +1811,7 @@ class TypoScriptFrontendController {
        public function getPageAccessFailureReasons() {
                $output = array();
                $combinedRecords = array_merge(is_array($this->pageAccessFailureHistory['direct_access']) ? $this->pageAccessFailureHistory['direct_access'] : array(array('fe_group' => 0)), is_array($this->pageAccessFailureHistory['sub_section']) ? $this->pageAccessFailureHistory['sub_section'] : array());
-               if (count($combinedRecords)) {
+               if (!empty($combinedRecords)) {
                        foreach ($combinedRecords as $k => $pagerec) {
                                // If $k=0 then it is the very first page the original ID was pointing at and that will get a full check of course
                                // If $k>0 it is parent pages being tested. They are only significant for the access to the first page IF they had the extendToSubpages flag set, hence checked only then!
@@ -2606,7 +2606,7 @@ class TypoScriptFrontendController {
                        $this->checkTranslatedShortcut();
                        // Request the overlay record for the sys_language_uid:
                        $olRec = $this->sys_page->getPageOverlay($this->id, $this->sys_language_uid);
-                       if (!count($olRec)) {
+                       if (empty($olRec)) {
                                // If no OL record exists and a foreign language is asked for...
                                if ($this->sys_language_uid) {
                                        // If requested translation is not available:
@@ -2620,7 +2620,7 @@ class TypoScriptFrontendController {
                                                        case 'content_fallback':
                                                                $fallBackOrder = GeneralUtility::intExplode(',', $sys_language_content);
                                                                foreach ($fallBackOrder as $orderValue) {
-                                                                       if ((string)$orderValue === '0' || count($this->sys_page->getPageOverlay($this->id, $orderValue))) {
+                                                                       if ((string)$orderValue === '0' || !empty($this->sys_page->getPageOverlay($this->id, $orderValue))) {
                                                                                $this->sys_language_content = $orderValue;
                                                                                // Setting content uid (but leaving the sys_language_uid)
                                                                                break;
@@ -2787,7 +2787,7 @@ class TypoScriptFrontendController {
                $locData = explode(':', $locationData);
                if (!$locData[1] || $this->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->sys_page->getPage($locData[0]))) {
+                       if (!empty($this->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);
@@ -3760,7 +3760,7 @@ class TypoScriptFrontendController {
                                }
                        }
                }
-               if (count($search)) {
+               if (!empty($search)) {
                        $this->content = str_replace($search, $replace, $this->content);
                }
        }
@@ -4523,7 +4523,7 @@ class TypoScriptFrontendController {
         * @return void
         */
        public function convPOSTCharset() {
-               if ($this->renderCharset != $this->metaCharset && is_array($_POST) && count($_POST)) {
+               if ($this->renderCharset != $this->metaCharset && is_array($_POST) && !empty($_POST)) {
                        $this->csConvObj->convArray($_POST, $this->metaCharset, $this->renderCharset);
                        $GLOBALS['HTTP_POST_VARS'] = $_POST;
                }
index 1cd5ba6..a4e4da2 100644 (file)
@@ -815,7 +815,7 @@ class GifBuilder extends \TYPO3\CMS\Core\Imaging\GraphicalFunctions {
         */
        protected function calculateMaximum($string) {
                $parts = GeneralUtility::trimExplode(',', $this->calcOffset($string), TRUE);
-               $maximum = count($parts) ? max($parts) : 0;
+               $maximum = !empty($parts) ? max($parts) : 0;
                return $maximum;
        }
 
index bf65b17..69aae3e 100644 (file)
@@ -177,7 +177,7 @@ class PageGenerator {
                $setEvents = array();
                $setBody = array();
                foreach ($GLOBALS['TSFE']->JSeventFuncCalls as $event => $handlers) {
-                       if (count($handlers)) {
+                       if (!empty($handlers)) {
                                GeneralUtility::deprecationLog('The usage of $GLOBALS[\'TSFE\']->JSeventFuncCalls is deprecated as of TYPO3 CMS 7. Use Javascript directly.');
                                $functions[] = '        function T3_' . $event . 'Wrapper(e) {  ' . implode('   ', $handlers) . '       }';
                                $setEvents[] = '        document.' . $event . '=T3_' . $event . 'Wrapper;';
@@ -187,7 +187,7 @@ class PageGenerator {
                                }
                        }
                }
-               return array(count($functions) ? implode(LF, $functions) . LF . implode(LF, $setEvents) : '', $setBody);
+               return array(!empty($functions) ? implode(LF, $functions) . LF . implode(LF, $setEvents) : '', $setBody);
        }
 
        /**
@@ -363,7 +363,7 @@ class PageGenerator {
                        $docTypeParts = array_reverse($docTypeParts);
                }
                // Adding doctype parts:
-               if (count($docTypeParts)) {
+               if (!empty($docTypeParts)) {
                        $pageRenderer->setXmlPrologAndDocType(implode(LF, $docTypeParts));
                }
                // Begin header section:
@@ -427,7 +427,7 @@ class PageGenerator {
                                        }
                                }
                        }
-                       if (count($temp_styleLines)) {
+                       if (!empty($temp_styleLines)) {
                                if ($tsfe->config['config']['inlineStyle2TempFile']) {
                                        $pageRenderer->addCssFile(self::inline2TempFile(implode(LF, $temp_styleLines), 'css'));
                                } else {
@@ -975,7 +975,7 @@ class PageGenerator {
                                $bodyTag = preg_replace('/>$/', '', trim($bodyTag)) . ' ' . trim($tsfe->pSetup['bodyTagAdd']) . '>';
                        }
                        // Event functions
-                       if (count($JSef[1])) {
+                       if (!empty($JSef[1])) {
                                $bodyTag = preg_replace('/>$/', '', trim($bodyTag)) . ' ' . trim(implode(' ', $JSef[1])) . '>';
                        }
                }
index 5226d6c..93078d7 100644 (file)
@@ -253,7 +253,7 @@ class AbstractPlugin {
                        // cHash mode check
                        // IMPORTANT FOR CACHED PLUGINS (USER cObject): As soon as you generate cached plugin output which depends on parameters (eg. seeing the details of a news item) you MUST check if a cHash value is set.
                        // Background: The function call will check if a cHash parameter was sent with the URL because only if it was the page may be cached. If no cHash was found the function will simply disable caching to avoid unpredictable caching behaviour. In any case your plugin can generate the expected output and the only risk is that the content may not be cached. A missing cHash value is considered a mistake in the URL resulting from either URL manipulation, "realurl" "grayzones" etc. The problem is rare (more frequent with "realurl") but when it occurs it is very puzzling!
-                       if ($this->pi_checkCHash && count($this->piVars)) {
+                       if ($this->pi_checkCHash && !empty($this->piVars)) {
                                $this->frontendController->reqCHash();
                        }
                }
@@ -299,7 +299,7 @@ class AbstractPlugin {
                                        if (is_array($subConfNextLevel) && $subKey === 'stdWrap.') {
                                                $conf[$key] = $this->cObj->stdWrap($conf[$key], $conf[$key . '.']['stdWrap.']);
                                                unset($conf[$key . '.']['stdWrap.']);
-                                               if (!count($conf[$key . '.'])) {
+                                               if (empty($conf[$key . '.'])) {
                                                        unset($conf[$key . '.']);
                                                }
                                        }
@@ -1196,7 +1196,7 @@ class AbstractPlugin {
                                unset($tempPiVars[$k]);
                        }
                }
-               if (!count($tempPiVars)) {
+               if (empty($tempPiVars)) {
                        //@TODO: How do we deal with this? return TRUE would be the right thing to do here but that might be breaking
                        return 1;
                }
@@ -1227,7 +1227,7 @@ class AbstractPlugin {
                                }
                        }
                }
-               if (!count($inArray)) {
+               if (empty($inArray)) {
                        //@TODO: How do we deal with this? return TRUE would be the right thing to do here but that might be breaking
                        return 1;
                }
index 8d66468..ad5634a 100644 (file)
@@ -490,7 +490,7 @@ class AdminPanelView {
                        if ($this->extGetFeAdminValue('cache', 'noCache')) {
                                $theBytes = 0;
                                $count = 0;
-                               if (count($GLOBALS['TSFE']->imagesOnPage)) {
+                               if (!empty($GLOBALS['TSFE']->imagesOnPage)) {
                                        $tableArr[] = array($this->extGetLL('info_imagesOnPage'), count($GLOBALS['TSFE']->imagesOnPage), TRUE);
                                        foreach ($GLOBALS['TSFE']->imagesOnPage as $file) {
                                                $fs = @filesize($file);